sentences:
Texture won't appear using a vector of unique pointers of an Object I am working on a top down 2d shooter game. I have a player Sprite and a Bullet class. I made a vector of pointers to Bullet to store the bullets. Here is the code of the vector and the functions I’m using:

    std::vector<std::unique_ptr<Bullet>> b;

    while(win.isOpen)
    {
    //Getting Key Press
    if (Keyboard::isKeyPressed(Keyboard::Space))
    {
        space = true;
    }
    else
    {
        space = false;
    }
    if (space)
    {
        Bullet b1;
        b1.setPos(player.getPosition());
        b.push_back(std::make_unique<Bullet>(b1));
    }

    for (auto& it : b)
    {
        //Keep Updating
        it->update();
    }

    //Bullet out of Screen
    for (int i = 0; i < b.size(); i++)
    {
        if (b[i]->getPos().y < 0.0f)
        {
            b.erase(b.begin() + i);
            i--;
        }
    }

    //Drawing Bullet
    for (auto& i : b)
    {
        win.draw(i->getSprite());
    }
     }

The game runs fine but the bullet’s texture won’t load. I’m assuming it has something to do with the vector but I don’t know how to solve it.
Here is the Bullet class:
Header:

 #pragma once
 #include <SFML/Graphics.hpp>

 using namespace sf;

 class Bullet
 {
private:
Texture t;
Sprite bullet;
Vector2f pos;
public:
Bullet();
void setPos(Vector2f pos);
void update();
Sprite& getSprite();
Vector2f getPos();
};

Cpp File:
     #include "pch.h"
     #include "Bullet.h"
     #include

Bullet::Bullet()
{
//Setting Texture
if (!t.loadFromFile("Graphics/bullet.png"))
{
    std::cout << "Bullet Texture Failed to Load\n";
}
else
{
    t.loadFromFile("Graphics/bullet.png");
    bullet.setTexture(t);
}

}

void Bullet::setPos(Vector2f pos)
{
//Setting Position
this->pos = pos;
bullet.setPosition(this->pos);
}

void Bullet::update()
{
pos = bullet.getPosition();

bullet.move(0.0f, -4.0f);

}

Sprite& Bullet::getSprite()
{
return bullet;
}

Vector2f Bullet::getPos()
{
return pos;
}

sentences:
enemy behavior with boundary to change direction I'm doing space shooter kind of game, the logic is to reflect the enemy if it hits the boundary. With my logic, sometimes enemy behaves like flickering instead of changing the velocity. It's like trapped in the boundary and checking for if loops.
This is my code for velocity changing:

if(this->enemyPos.x>14)
{
   this->enemyVel.x = -this->enemyVel.x;
}

if(this->enemyPos.x<-14)
{
   this->enemyVel.x = -this->enemyVel.x;
}

How can I get around this? Its going out of boundary and don't know where to go and after sometimes its coming into field. I know whats the problem is, I dont know how to get around this problem.

sentences:
How do I get a Metal texture ID to render to it with Ogre? I looked in the documentation, but I don't know how to get the texture ID.

void* texPtr = SixDegreesSDK_GetBackgroundTexture();
            if (texPtr != nil) {
                id<MTLTexture> mtlTexture = (__bridge id<MTLTexture>)texPtr;

                id<MTLDevice> device = [mtlTexture device];
                // !!! Not fond of creating a new command queue for every texture
                id<MTLCommandQueue> commandQueue = [device newCommandQueue];
                id<MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
                id<MTLBlitCommandEncoder> blitEncoder = [commandBuffer blitCommandEncoder];

                NSUInteger textureWidth = mtlTexture.width;
                NSUInteger textureHeight = mtlTexture.height;
                NSUInteger rowbytes = mtlTexture.bufferBytesPerRow;
                MTLPixelFormat  pixFormat = mtlTexture.pixelFormat;
                CVPixelBufferRef _CVPixelBuffer = NULL;
                NSDictionary* cvBufferProperties = @{
                                                     (__bridge NSString*)kCVPixelBufferOpenGLCompatibilityKey : @YES,
                                                     (__bridge NSString*)kCVPixelBufferMetalCompatibilityKey : @YES,
                                                     };
                CVReturn cvret = CVPixelBufferCreate(kCFAllocatorDefault,
                                                     textureWidth, textureHeight,
                                                     kCVPixelFormatType_32RGBA,
                                                     (__bridge CFDictionaryRef)cvBufferProperties,
                                                     &_CVPixelBuffer);
                const IOSurfaceRef surface  = CVPixelBufferGetIOSurface(_CVPixelBuffer);             // available in ios11 sdk, ios4 runtime

                MTLTextureDescriptor* textureDescriptor = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixFormat
                                                                                width:textureWidth
                                                                                height:textureHeight
                                                                                mipmapped:NO];
                id<MTLTexture> metalTexture = [device newTextureWithDescriptor:textureDescriptor
                                                                          ioSurface:surface
                                                                              plane:0];

                MTLRegion region = MTLRegionMake2D(0, 0, textureWidth, textureHeight);

                [blitEncoder copyFromTexture:mtlTexture
                                 sourceSlice:0
                                 sourceLevel:0
                                sourceOrigin:region.origin
                                  sourceSize:region.size
                                   toTexture:metalTexture
                            destinationSlice:0
                            destinationLevel:0
                           destinationOrigin:region.origin];

                [blitEncoder endEncoding];
                [commandBuffer commit];
                [self.mEAGLContext texImageIOSurface:surface target:GL_TEXTURE_2D internalFormat:GL_RGBA width:textureWidth height:textureHeight format:GL_RGBA type:GL_UNSIGNED_BYTE plane:0];

sentences:
How to stop movement when an action key is pressed even if movement key is pressed I'm making a 2d side-scrolling fighting game in game maker:studio and I want to make a code that when the player attacks he stops moving.
I've tried some options:

keyboard_check(ord("D"));

both this and

keyboard_check_pressed(ord("D"));
x += 0

I also tried

hspeed = 0

I also tried adding these to my left and right key events:

if (sprite_index = spr_atk_right)
 {
 x -=4 for right key event or x += 4 for left key event
 }

I have a right key and left key event with the simple code
x += 4 for the right key and x -= 4 for the left key. I was hoping the second set of codes would cancel it out but neither worked.

sentences:
Unable to create suitable graphics device? I've been following the Eye of the Dragon tutorial, which is basicly a guide to making a 2D RPG game, obviously.

I recently finished the tutorial about making pop up screens in the menu and changed the screen to load as a full screen.

Whenever I try and load the game it just goes black and my mouse sits there. I cannot change out of it other then with CtrlAltDel. Once i do that it says No suitable graphics card found, unable to create graphics device.

I read somewhere about XNA not allowing more then one screen when any one of them is full screen. but it wasnt very informative. Anyone have any ideas whats going on and/or how to fix this?

Just incase if this helps this is the code for the graphics device:

public Game1()
{
    graphics = new GraphicsDeviceManager(this);
    graphics.PreferredBackBufferWidth = 900;
    graphics.PreferredBackBufferHeight = 768;
    graphics.IsFullScreen = true;
    this.Window.Title = "Eyes of the Dragon";
    Content.RootDirectory = "Content";
}

sentences:
2D collision-detection middleware (This question was split off from 3D collision-detection middleware)

Are there any recommendable middleware available for 2D collision detection?

I believe I've heard that Box2D could be used for collision detection without the physics part. I'd like to hear if people have any experiences on Box2D or others libraries for 2D collision detection specifically.

sentences:
Divide a tile map into multiple images So let's say I have a tilemap 5 x 5, which equals 25 tiles.
How can I divide my tilemap into 25 different images? I'm using tiled, but I don't know if it is possible to do it on there or if I need to use one other program.
Of course, my tilemap is bigger than 5 x 5, so it's why I'm asking because it would consume a lot of my time.
Thanks.

sentences:
Fair monetization of a MMO with a simulated economy I am in the design phase of a MMO game based around flying age-of-sail airships.  Players will be able to captain their own ship (owned by their  in-game nation or faction or themselves if they become sufficiently wealthy), or play as a crewmember on their own or another ship in battle , or as ground defence personnel when their own ship becomes too boring.

The players might also design or redesign the flying sailing ships (and later, as technology progresses, flying steam or diesel ships), and test new ship design, or plan ground defences.

All of this would be based around a simulated economy, where resources are produced, shipped and either consumed or lost to make value-added foods, commodities, communities or vessels.  In a war, commerce raiding should - eventually - have an impact as much as direct military action against enemy troops and vessels.

Players could be merchants, pirates, smugglers, privateers, naval captains, or just another member of a ship's crew.  Players could also design airships and ground defences, and contribute to the governance of their province.

So, for all of this, how can I monetize this game?  I need to consider startup capital, but more importantly, it needs to make a profit.

However... I don't want to fall into the ways of many games with micro-transactions.   That means no pay-to-win - a paying player must have only their own skills and equipment to help them win against a free-to-play player... if I go with that method.

The economy is simulated, and I would like the method of monetization to have a minimal impact on that, but not necessarily no impact. Players must know exactly what they are spending their in-game currency upon, an must be able to sell for in-game or possibly even real currency any 'physical' game object - with a cut to the broker (i.e. the developer).

I have considered an up-front cost, but that alone does not guarantee an income stream as the player base becomes saturated.  I have considered instant IAP of objects that would otherwise take time to produce - the player buys them from the developer's nation.  I have considered allowing a certain amount of free screen time per month, extendable by a purchase.

What methods would guarantee continual income for a number of years at least, without unduly upsetting players who may be wary of traps such as loot chests or pay-to-win?  Can a game such as this be funded prior to the commencement of development?

sentences:
Backface culling without light leaking through I want to be able to see through walls, so to do this I used planes for the walls, and enabled backface culling. However with shadow mapping I have a lot of light leaking through:

I read that using a thick wall solves this, so I did just that. This solved the leaking light:

but now I cannot see through the walls (camera is within the room in the above screen), all the backfaces are inward.

How could I prevent light leaking, as well as enable seeing through the walls?

sentences:
Alternatives to Camera.main.ScreenToWorldPoint in Unity What are alternatives to Camera.main.ScreenToWorldPoint in Unity?

So, here is my code (just the piece which is relevant for the question):

void sendPointerMove(ref Vector3 mousePosition)
{
    lastMousePosition = mousePosition;

    Vector3 mousePositionInWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    PointerData pointerData = new PointerData(
       mousePositionInWorld: mousePositionInWorld
    );
}

void FixedUpdate()
{
    Vector3 mousePosition = Input.mousePosition;

    if (needToSendPointerMove(mousePosition))
    {
       sendPointerMove(ref mousePosition);
    }
}

I am using JetBrains Rider to develop for Unity. And the ide suggests me the following about my sendPointerMove function invocation inside the FixedUpdate:

  Expensive method invocation

I am sure that the issue is due to the Camera.main.ScreenToWorldPoint because when I comment out the part the warning disappears.

Thank you.

sentences:
Performance of ClearRenderTargetView While profiling GPU usage in VS2017, I've noticed a strange disproportion in performance of ClearRenderTargetView compared to ClearDepthStencilView:

What can cause this four-orders-of-magnitude difference?

First idea was that the 1.0f I'm writing to the depth buffer is a special optimized value, so I've tried 0.0f and 0.4f, but it seem to affect nothing. Then I tried to change the clear color from (0,0,0,1) to (0,0,0,0) to no avail.

Googling for ClearRenderTargetView performance brings up nothing.

The only thing I can think of is that the target texture is somehow affected by the D3D9 interop it participates in:

private void InitRenderTarget(int width, int height) {
    var renderTargetDescr = new Texture2DDescription() {
        Width = width,
        Height = height,
        MipLevels = 1,
        ArraySize = 1,
        SampleDescription = new DxgiSampleDescription(1, 0),
        Usage = ResourceUsage.Default,
        CpuAccessFlags = CpuAccessFlags.None,

        // The following are mandatory for WPF interop:
        Format = DxgiFormat.B8G8R8A8_UNorm,
        BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
        OptionFlags = ResourceOptionFlags.Shared
    };
    _renderTarget = new Texture2D(_device, renderTargetDescr);
    var renderTargetViewDescr = new RenderTargetViewDescription {
        Format = renderTargetDescr.Format,
        Dimension = RenderTargetViewDimension.Texture2D
    };
    _renderTargetView = new RenderTargetView(_device, _renderTarget, renderTargetViewDescr);
}

private void SetupWpfInterop() {
    _surfaceD3D9 = _d3d9.DXDevice.GetSharedD3D9(_renderTarget).GetSurfaceLevel(0);
    _targetImage.Lock();
    _targetImage.SetBackBuffer(D3DResourceType.IDirect3DSurface9, _surfaceD3D9.NativePointer);
    _targetImage.Unlock();
}

But then, calls to DrawIndexed would likely also be affected, which doesn't seem to be the case (or I just misinterpret the profiler diagrams).

sentences:
Problem with action mapping Summarizing my problem well, I need a single button (right mouse button) to do two things.

In my project (TopDown) I defined that instead of the left mouse button, the character moves with the right mouse button.

I happen to like that when I click the right mouse button on a particular actor, a simple event is called (print hello).

I tried doing this with the Event On Clicked, but it only works with the left mouse button:

With the help of these links:

https://www.unrealengine.com/en-US/blog/input-action-and-axis-mappings-in-ue4

https://answers.unrealengine.com/questions/134349/right-click-on-an-actor.html

https://answers.unrealengine.com/questions/17729/how-to-create-a-right-mouse-click-event-with-bluep.html

I figured out how to do an action/event call with the right mouse button, but even then I did not succeed.

Soon I discovered that the reason was that there was already an action that was executed with the right mouse button (walk/set destination):

I would like my character to continue to move with the right click of the mouse, but how do I also call an event when I click the right mouse button?

EDIT 1

If the mapping is done with two different keys, it works perfectly:

In this case the character jumps and walks (instead of jumping it could be anything else):

I want this to happen by right-clicking (walking and jumping):

This action I want to perform is when clicking on the mesh of any actor, but I can only do this with the left button.

sentences: How to make a gaussian blur effect in UDK I want to make a plane shape (surface) that have a gaussian blur applied to it and this plane is transperant, so all objects behind it looks like they are having a gaussian blur effect.

sentences:
Where is the Aves game engine? The Aves game engine made a splash last spring/summer, with very impressive demo videos. I went back to check on them, and it looks like their site has long since died. Google also doesn't seem to know anything new about them.

Where can I find news about Aves? Is the project dead?

sentences: Cocos2d: Using single timer/scheduler for multiple sprites want to know if is it possible to use single timer or scheduler method for multiple sprites ? Like I am now working on a game and there could be any number of sprites and i want to perform some actions on all of that sprites, So do I have to use as many timers or schedulers as sprites ? Or How can the job be done using only a single timer or scheduler ? What is I schedule a method and use it for, Say 10 sprites ? Will it affect the performance..?

sentences:
How to figure out what's moving my GameObject? I have a GameObject as part of a complex scene with a handful of interconnected parts, that's moving when it shouldn't be.  I've tried running under the debugger and setting breakpoints on all of the script points that are supposed to move its Transform, and ensured that none of them are firing.  There seems to be some "spooky action at a distance" going on, some rogue script doing something I don't want it to be doing, but I can't for the life of me figure out where it is.

What I'd really like is some way to set a "breakpoint" on the object's Transform that will break me into the debugger when it gets moved by any script, but that doesn't appear to be supported.  Is there any way to figure out exactly what it is that's moving my object around when it shouldn't be?

(And before anyone says "trial and error, disable components and see when it stops moving," I already know exactly which component to disable to make it stop moving.  Unfortunately, that isn't helping track down the problem because the movement isn't coming directly from that component's MonoBehaviour script.)

sentences:
Unity2D 100x100 tile map, best practice? I'm trying to create a top-down map in Unity2D, this map will act as an ocean that a 1 tile sized boat will drive across. I want to be able to generate this map programmatically by going through the grid to create shallow areas, spawn things, etc.

I've been reading it's not good practice to create game objects for each tile as there's so many. You can use object pooling but that sounds harder to manage. I've read that using a mesh map is the best way but no one follows up with the best way to implement it. Any clues to push me in the right direction?

sentences:
When I pause my game scene in unity editor by keyboard ctrl+shift+P，‘Assertion failed ...’ appears in console window I am using Unity 2017.2.0f3. When I pause my game scene by use mouse click on pause button & play it frame by frame, it works OK. Instead, pause by use ctrl+shift+P keys down, an error will play once in console window at the time I press frame by frame button.

Assertion failed: Assertion failed on expression: '!dest.m_MultiFrameGUIState.m_NamedKeyControlList'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This would happens even in the new created empty scene!

Any help will be appreciated!

sentences:
Inaccurate UI button unity As you see in this screenshot I must hover the mouse on that that spot to click on button in overall you must hover the mouse upper than button to click on it, tried to change the Sprite but even with default Sprite I have this problem so I don't think there is problem with Sprites.

Let me explain more about this panel:
In this scene I have two canvas's one for Pause button only and another one for this panel that is disabled. When you click on Pause this panel will appear ( second canvas will be activated. Why is that? I tried to change some things in the canvas like change UI scale mode to scale with screen size but no luck.
I will be grateful for help I don't really know where problem is.

Update : I just now found very odd behavior when hit play if mouse be in game view that problem wont occur, after mouse leave the button issue will appear again.

sentences:
DirectX11 how to use textures and samplers in slots in shaders I have a system to render many objects, but I don’t know how to render more tan one object with same shader, let me explain:

I have a sphere and a cylinder, but both objects can be rendered by different shaders, example:
Shader1: Shader to render object using 1 texture
Shader2: Shader to render object using 2 textures

Both objects need to coexist in space, so if I want to render sphere with shader 1 and I use:
shader1 resources:

context_->PSSetShaderResources(0, 1, &texture);
context_->PSSetSamplers(0, 1, &sampler);
…

shader2 resources:

context_->PSSetShaderResources(1, 1, &texture);
context_->PSSetSamplers(1, 1, &sampler);
context_->PSSetShaderResources(2, 1, &texture);
context_->PSSetSamplers(2, 1, &sampler);
…

in Shader1 the resources are references like this:

Texture2D colorTexture: register(t0);
SamplerState sampler: register(s0);

And in Shader2 the resources are references like this:

Texture2D colorTexture: register(t1);
SamplerState sampler: register(s1);
Texture2D colorTexture: register(t2);
SamplerState sampler: register(s2);

But what if I need to use shader1 resource’s in shader2???? How to manage those resources or do I need to replicate shader2 with shader1 registers?? this is the simplest example, this is part of a very much complex system with many many shaders and many textures, but I don’t know in what slot will be setted the resources, this can be absolutely generic, example, slot 5 will be used for texture 1 of shader2… It is possible to render many objects with minimal change of shaders, but the resources could be updated at any time..
I’m using directX11.

sentences:
Total Texture memory size iOS / OpenGL ES My team is running into an issue where the amount of texture memory allocated via the glTexImage2D is high enough that it crashes the app ( at about 400 MB for iPhone 5). We're taking steps to minimize the texture allocation ( via compression, using fewer bits/channel and doing procedural shaders for VFX etc).

Since the app crashed on glTexImage2D, I felt like, it's running out of texture memory (as against virtual memory). Is there any documentation/guideline on the recommended texture memory usage by an app (not just optimize your texture memory) .

AFAIK on iOS devices ( and many Android devices) there's no dedicated VRAM and our app process is still well within the virtual memory limit. Is this some how related to the size of physical RAM ? My searches so far has resulted only in info on max texture size and tricks for optimizing texture usage and such. Any information is appreciated.

sentences:
Manager game questions (Sorry about the bad title, it's the best I could come up with)

I've been planning a gladiator manager game for a while now. Something similar to Blood Bowl (or Football Manager, only with fighting rather than kicking a ball), only with a much larger focus on the actual managerial aspects of running a team. I'm still fairly new to game development, and have only created games with a very narrow focus (i.e. simple first person shooters), so taking on a project with a larger scope is very interesting, but also problematic since I really don't have a grip on how exactly to make the damn thing work.

Basically my two major hurdles are the interface and database. Obviously the interface is incredibly important since the player will spend most of his/her time doing managerial tasks. The game will be team-based, with various leagues in which those teams fight in, so it all relies on a database. I have never done any real work with databases, so this in particular has me stumped.

At this point, my idea is to use XNA in a WPF application, with an XML database. This just seems like a combination that would work well together, and as I have a C#/XNA background, I wouldn't need to learn a new language or graphics framework to work in.

Does that seem like a sensible combination, and if not, why? I have never done anything with WPF, so all of my information on it's uses comes from Google, and that may or may not be a good thing. Would XML be a smart choice? There will likely be a fairly low (think 20-30) number of teams, all of which will have a dozen or so fighters, so it's not a monstrously large set of data.

Thanks in advance, I know I didn't write the most intelligent post ever, but I had to get my ramblings out somehow. ;)

sentences:
How would you design components for an entity like this? This is not a question about how to implement a component based system. I have my own system implemented and working fairly well, just can't figure out a good way to split some entities to fit the componnet based paradigm.

The entity is fairly simple, it can walk,jump and fire. It can get into some states like "frozen" that avoids movement of the player. It has other restrictions like can't do double jump.

In my current system, I have an input manager that has a target entity that receives events mapped to actions with semantics. I mean, my entity doesn't know about 'D' key or 'Left mouse click', it knows about Up,Down, Button1, etc...

Now the problem, when the user presses for example SPACE, the  target entity  is notified with a Left action and all the components are notified, but how would for example the Movement Component know that the entity is in "Frozen State" and it shouldn't be applying movement to it?.

Would you throw all this properties into an entity properties component and let all the other components check for them? Would you split entity in such a granulated level that a component for every property would be created? In this case we could have a component that has the "can be frozen" property and when it receives the collision with an ice projectil (it would be receiving a collision message) it can set the main entity state (that I would place it into the brain component) to frozen.

Could you suggest how you handle this tasks? The question could be rewritten as, How would you execute actions from an input system taking into account the restrictions of the entity.

Thanks in advance.

sentences:
Why do my velocity estimates have such a large margin of error I am writing a script in unity that applies a force to the object to advance it a set distance in an environment without friction or drag, producing a cosine force curve.

However, as the target approaches the destination, the force to apply is less than the value specified by the curve as the time unit is too large and will cause the object to reverse direction.

To resolve this, I estimate what the speed will be after applying this frames force and, if that reverses the direction, we take a proportion of the force.

It is working well around 4 times out of 5, but every so often it will not detect the reverse in direction and will apply the force for an extra frame or 2, causing the object to back up.

Closer investigation revealed that basically the problem stems from my estimate being significantly (some times up to 0.05) different from the velocity the next frame. I compute it as follows:

Vector3 currentVelocity = ship.rigidbody.velocity;
Vector3 direction = ship.transform.right;

// this is the value I use for the "actual" speed
float velocityAlongDir = Vector3.Dot(currentVelocity, direction);

// this is my estimate
float estimatedVelocity = velocityAlongDir + (applyingForce * lDeltaTime);

Where the applyingForce is applied thus:

ship.rigidbody.AddForce((applyingForce * ship.rigidbody.mass) * transform.right);

Some sample data:

Predicted velocity: 0.3048308
Actual velocity: 0.2880591
Predicted velocity: 0.2068605
Actual velocity: 0.1900333
Predicted velocity: 0.09798826
Actual velocity: 0.1900333
Predicted velocity: 0.1082982
Actual velocity: -0.007007703

As you can see by the last entry, the predicted value doesn't change sing, but the real value does. Trying to work around this using does it go below a small value get different problems where the current velocity is too small etc.

Any idea why my calculation for next frame velocity seems so wrong and is there anything I can do about it?

Update

As pointed out in the comments, I needed to apply the force in the FixedUpdate and calculate my next frames velocity using Time.fixedDeltaTime. However, the following can happen, presumably in adverse frame conditions:

Predicted Velocity: 15.67547
Actual Velocity: 15.67547
Predicted Velocity: 17.54726
Actual Velocity: 15.67547 // note the same as the previous update, there has been no physics step!
Predicted Velocity: 17.51759 // estimate is subtly different, because my own timer has advanced

I fixed this by using fixedTime as opposed to fixedDeltaTime. However, then when I do a double update I am wrong for that frame, its like the physics step is trying to make up for the lost time:

// all going well...
Predicted Velocity: 52.25977
Actual Velocity: 52.25977
Predicted Velocity: 52.40138

// the estimate is wrong, we are moving at the same speed => no physics update
Actual Velocity: 52.25977
// we predict the same velocity for next frame
Predicted Velocity: 52.40138
// but we are wrong, like it is trying to catch up for lost time
Actual Velocity: 52.543

// then after that point we are precisely right
Predicted Velocity: 52.66479
Actual Velocity: 52.66479

This wouldn't be an issue except in the edge case where we do this double step precisely at the point we need to detect when the speed will change and apply the ratio. Since the physics step seems to play catch up, I miss the fact we changed speed.

sentences:
Collision detection with heightmap based terrain I am developing a 2D tank game. The terrain is generated by Midpoint Displacement Algorithm, so the terrain is represented by an array:

index --->  height of terrain
[0]   --->  5
[1]   --->  8
[2]   --->  4
[3]   --->  6
[4]   --->  8
[5]   --->  9
...         ...

The rendered mountain looks like this:

        *
  *     * *
  *     * *
  *   * * *
* *   * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
0 1 2 3 4 5 ...

I want tanks to be able to move smoothly on the terrain (I mean tanks can rotate according to the height when they move), but the surface of the terrain is not flat, it is polygonal. Can anyone give me some help with collision detection in this situation?

Thanks in advance.

sentences:
Converting 2D coordinates from multiple viewpoints into 3D coordinates Here's the situation.  I've got a set of 2D coordinates that specify a point on an image.  These 2D coordinates relate to an event that happened in a 3D space (video game).

I have 5 images with the same event point on it, so I have 5 sets of 2D coordinates for a single 3D coordinate.  I've tried everything I can think to translate these 2D coordinates into 3D coordinates, but the math just escapes me.  I have a good estimate of the coordinates from which each image was taken, they're not perfect but they're close.

I tried simplifying this and opening up Cinema 4D, a 3D modeling application.  I placed 5 cameras at the coordinates where the pictures were taken and lined up the pictures with the event points for each one and tried to find a link, but nothing was forthcoming.  I know it's a math question, but like I said, I just can't get it.  I took physics in high school 6 years ago, but we didn't deal with a whole lot of this sort of thing.

Any help will be very much appreciated, I've been thinking on it for quite a while and I just can't come up with anything.

sentences:
How to retrieve vertex information from ID3DXMesh I need to know the position of each vertex (and triangles) from a mesh (a pointer to ID3DXMesh, created by calling functions like D3DXCreateBox, D3DXCreateTeapot and D3DXCreateSphere) to perform some collision detection.

I've tried using GetVertexBuffer() and GetIndexBuffer() but I don't know how to use the structures to retrieve point data in the world coordinate system. How can I achieve that?

sentences:
What is Minecraft's database? I was wondering, what kind of database does Minecraft use? Is it a relational database, maybe something common like MySQL? Do we even know what he's using?

And maybe even a better question, SHOULD he be doing it that way? What type of database should be used?

sentences:
Monogame intermediateSerializer with winforms I want my xml files to be game ready on save in my winforms. Right now I am trying to serialize a simple object like this and it is accessing the XML file, but not outputting anything. Am I missing something? I have tried adding [Serializable()] to myTest and that did not work either.

using System;
using System.IO;
using System.Windows.Forms;

namespace WinformXMLIntermediateSerializer
{
 public partial class Form1 : Form
 {
    private const string filePath = "test.xml";
    private myTest mytest = new myTest();
    public Form1()
    {
        InitializeComponent();
    }

    private void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (File.Exists(filePath)) {
                XnaSerializer.Serialize(filePath, mytest);
                label1.Text = "File serialized...";
            }
        }
        catch(Exception Ex) {
            MessageBox.Show(Ex.ToString());
        }
    }
  }
}

Serialize Class:

using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
using System.IO;
using System.Xml;

static class XnaSerializer
{
 public static void Serialize<T>(string filename, T data)
 {
    XmlWriterSettings settings = new XmlWriterSettings();
    settings.Indent = true;
    using (XmlWriter writer = XmlWriter.Create(filename, settings))
    {
        IntermediateSerializer.Serialize<T>(writer, data, null);
    }
 }
}

Object to be serialized:

using Microsoft.Xna.Framework;

public class myTest
{
 private string name;
 public string Name
 {
    get { return name; }
    set { name = value; }
}

private Point tilesize;
public Point TileSize
{
    get { return tilesize; }
    set { tilesize = value; }
}

 public myTest() {
    Name = "test name";
    TileSize = new Point(32, 32);
 }
}

sentences:
Casting a Matrix4 class to float* glUniformMatrix4fv(glGetUniformLocation(program, "projMatrix"), 1, false, (float*)&projMatrix);

projMatrix is a an object of type Matrix4 where the first variable declared is a float array. Does (float*)&projMatrix therefore somehow retrieve this array? What does the casting appear to be doing?

sentences:
HLSL How to flip geometry horizontally I want to flip my asymmetric 3d model horizontally in the vertex shader alongside an arbitrary plane parallel to the YZ plane. This should switch everything for the model from the left hand side to the right hand side (like flipping it in Photoshop). Doing it in pixel shader would be a huge computational cost (extra RT, more fullscreen samples...), so it must be done in the vertex shader.
Once more: this is NOT reflection, i need to flip THE WHOLE MODEL.

I thought I could simply do the following:

Turn off culling.
Run the following code in the vertex shader:

input.Position = mul(input.Position, World);

// World[3][0] holds x value of the model's pivot in the World.
if (input.Position.x <= World[3][0])
    input.Position.x += World[3][0] - input.Position.x;
else
    input.Position.x -= input.Position.x - World[3][0];

...

The model is never drawn. Where am I wrong? I presume that messes up the index buffer. Can something be done about it?

P.S. it's INSANELY HARD to format code here.

Thanks to Panda I found my problem. SOLUTION:

// Do thins before anything else in the vertex shader.
Position.x *= -1;   // To invert alongside the object's YZ plane.

sentences: Velocity and drag in unity So I have an object that is bouncing around the screen randomly, physics still works on it so it will speed up or slow down depending on what it hit and when. To try to normalize the speed I want to apply force or drag when ever it goes above or below the thresh hold. My question is, do I need to make note of the direction the object is moving to add force? Or can I just add force to the way it is currently traveling?

sentences:
SQl, noSQL, and Doctrine with Symfony 2.0 I've had the idea of creating a webgame for a while now, and as it becomes more and more accurate i started playing around with Symfony 2.0.

First question :

it seems that it is recommanded to use Doctrine2 (ORM) to manipulate database with Symfony, but i'll feel more comfortable with pure SQL. Am i wrong ?

Second question :

The game i'm thinking of is somewhat a kind of RPG, with the classic character, stats, inventory, etc.

I have some notions of SQL, and i'm improving my knowledge of it at school right now (though i deplore they only teach us oracle environment), but there's a point i need to discuss :
How would you modelise the character's inventory ?
Is a noSQl databse (mongoDB) usefull here ?

sentences:
Unity: Why do my 2 gameObjects 'share' materials? no one has answered this on Unity answers yet so I thought I might as well ask this here:

recently, I imported my .blend game character and the character consisted of 2 colors: Red and black. Therefore as unity always does it creates 2 red and black materials for the colors of the character. Then, I imported the grass platform for my game. Because the grass platform is green and brown, Unity should have created 2 new green and brown materials and the platform should have stayed green and brown. But, instead, my grass platform decided to use my character's materials and my platform is now red and black. (If I import the grass platform first, my character becomes brown and green). Please help, this is an extremely annoying problem, thanks!

sentences:
Enter in a match that is already started In my Unity mobile game, I need multiplayer online functionalities. All the players should be visible in the world at any given time (of course, with some filtering), and a player should be able to connect at any time. Let's say that, for the purpose of this question, only 100 players at the time will log into the game.

My first try involved using Unity's built-in NetworkManager, but the two problems that arose are that:

One player is always the host, meaning that if that player logs out all the other players.
I did not manage to make it work on two different networks.

The implementation I used comes from this tutorial.

Next try was using an extension of NetworkLobbyManager, that allows through the Matchmaking system to solve problem 2.

This is my implementation:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.Match;
using UnityEngine.SceneManagement;

public class AutoLobbyManager : NetworkLobbyManager {

    protected int currentPage = 0;
    protected int previousPage = 0;

    public void CreateOrJoin() {
        StartMatchMaker();
        RequestPage(0);
    }

    public void OnMatchListReceived(bool success, string extendedInfo, List<MatchInfoSnapshot> matches)
    {
        if (matches.Count == 0) {
            // Server does not exist yet. Create one.
            CreateMatch();
            return;
        }

        // There is then a server. Join it.
        JoinMatch(matches[0]);

    }

    public void RequestPage(int page) {
        matchMaker.ListMatches(page, 1, "", true, 0, 0, OnMatchListReceived);
    }

    public void CreateMatch() {
        matchMaker.CreateMatch( "Main Match", (uint)maxPlayers, true, "", "", "", 0, 0, OnMatchCreate);
    }

    void JoinMatch(MatchInfoSnapshot match) {
        matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, OnMatchJoined);
    }

    public override void OnMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo) {
        base.OnMatchCreate(success, extendedInfo, matchInfo);
        Debug.Log("Match created!");
        ServerChangeScene(playScene);
    }

     public override void OnClientSceneChanged(NetworkConnection conn) {
         string loadedSceneName = SceneManager.GetSceneAt(0).name;
         if (loadedSceneName == lobbyScene) {
           if (client.isConnected)
               CallOnClientEnterLobby();
         } else {
           CallOnClientExitLobby();
         }

         OnLobbyClientSceneChanged(conn);
    }

    void CallOnClientEnterLobby() {
        OnLobbyClientEnter();
        foreach (var player in lobbySlots)
        {
            if (player == null)
                continue;

            player.readyToBegin = false;
            player.OnClientEnterLobby();
        }
    }

    void CallOnClientExitLobby() {
        OnLobbyClientExit();
        foreach (var player in lobbySlots)
        {
            if (player == null)
                continue;

            player.OnClientExitLobby();
        }
    }

}

This makes possible to create a Lobby if there is no Lobby, and join the first if there is. It works, if we remove the highlighted line here:

public override void OnMatchCreate(bool success, string extendedInfo,
MatchInfo matchInfo) {
    base.OnMatchCreate(success, extendedInfo, matchInfo);
    Debug.Log("Match created!");
    ***** ServerChangeScene(playScene); *****
}

Because this starts the game. If that line is activated (since I want to start the game as soon as possible), when a client tries to connect, the Server logs:

NetworkLobbyManager can't accept new connection [hostId: 0 connectionId: 1 isReady: False channel count: 2], not in lobby and game already in progress.

And the client is not added to the game. I understand that lobbies usually work like that, but:

1. Is it possible to add a client after a game is added, with NetworkLobbyManager?

2. Is it the right approach to achieve a multiplayer, non-lobby-based, non-host-based, online game in Unity?

sentences:
Unreal Engine 4 HierarchicalInstancedStaticMesh (HISM) not distance culling What I'm trying to do:
I am trying to programmatically spawn a lot of HierarchicalInstancedStaticMesh on a very very large ProceduralMeshComponent (PMC) (very simplified for the sake of this question).
I generate the "ground" PMC in chunks during run time, and then spawn instances at points on the mesh.

An initial n amount of these  are generated before the player spawns. Additional chunks spawn by calculating values with a separate thread and then spawning them from the original thread. All I am doing in the separate thread is calculating vectors essentially

I have an actor with just a HISM component at the root.

Cull start and end distance is set to 5000
Mesh material has Dithered LOD Transition set to true

What is happening:
The culling on the HISM is simply not working.

Sometimes It won't even show up to begin with
When it does show up, it doesn't cull no matter how far away the camera gets (spectator)
Sometimes it will cull correctly on the initially spawned chunks, but not on the chunks that were generated and spawned after the player spawned

The weirdest part, is that I am also spawning an HISM of a different mesh in exactly the same manner, and it is culling perfectly (though admittedly there are far FAR fewer instances)
Example code:
Here is an example of what I am trying to do. The Terrain actor is placed in the world, the HISM is referenced in a public variable, and this code runs in BeginPlay (and Tick, for subsequent chunks)
Terrain.H:
// The Actor with the HISM as the root component
UPROPERTY(Category = "hism", BlueprintReadWrite, EditAnywhere) TSubclassOf<AActor> FoliageInstance;

Terrain.cpp:
auto spawner = World->SpawnActor<AActor>(FoliageInstance, FVector(0, 0, 0), FRotator::ZeroRotator);

// Another class I wrote that just calculates a ton of vectors
TArray<FVector> spawnPoints = OtherClass.GetATonOfRandomVectors();

// Add an instance for each of the spawn points
for (auto& spawn: spawnPoints)
{
    FRotator grassRotation = FRotator(rand() % 5, rand() % 360, rand() % 5);
    FTransform grassTransform = FTransform(grassRotation, spawn);

    if (spawner != nullptr)
    {
        auto instance = Cast<UHierarchicalInstancedStaticMeshComponent>(spawner->GetRootComponent());
        instance ->AddInstance(grassTransform);
    }
}

sentences:
How to get DXGI_ERROR description? In a D3D12 program, I encounter a DGXI_ERROR (CreateSharedHandle return an int <0), but I could not find a way to translate it into the "error description" or "error name" (or both).

I have a description by Microsoft: https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/dxgi-error

Is there such function out there ?

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

Which RPC method will be called? Unity says this:

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

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

sentences:
How to draw an image on canvas without html I'm trying to add a sprite to the canvas of my game. However, I don't want to use an image tag. However, I haven't found a way to do this no matter how hard I searched. Something like:

var image = 'sample.jpg'
draw(image)

sentences:
How to bounce the ball off a collider and destroying it using trigger? I am making a Breakout game.
I have bricks with box colliders and the ball is a rigidbody2d with circular collider.
I have applied the PhysicsMaterial2D on the ball with bounciness set to 1 so the ball is bouncing off the bricks as intended.
Now I want to detect this collision in C# so I could destroy the brick but I cannot enable the isTrigger property as it will disable the collisions in that brick.
So, I am looking for a way to do that.

sentences:
libgdx onto existing IOS and Android App, Feasiblity and App Size I am an IOS developer, my client has an existing app which they want to add some simple microgames onto. The main requirement is that the app size footprint is as small as possible.

I suggested that Spritekit would give the smallest footprint but they want a cross-platform solution.

My initial reading on libgdx is that is is difficult to implement on IOS.

So before I begin learning libgdx I would like to know whether it is feasible to implement on top of an existing IOS app and whether this is the best solution for a small app size footprint

sentences: Unity - Scripting Runtime Version Option Missing I have been trying to open and run my couple-months old project in Unity3D, and I'm getting about 500 errors. So idecided to reinstall Unity. On the tutorial for the project, it tells us to make sure the "Scripting Runtime Version" is set to 4.x equivalent. Only problem for me is I cannot see such an option in Unity5.5.4p4. How can I set .NET 4.x in Unity for good?

sentences:
Is there a repository of game logic algorithms? I'm writing my first 2D game, and I'm writing some tracking logic for the computer enemies. Basic follow-the-player tracking was easy, but ineffectual. Too easy to escape. So I'm trying to implement some more sophisticated flanking and other tactics, and (as expected) it's pretty tricky. This is a topic I know nothing about.

I'm going to keep trying, but it'd be awesome to have some examples or tips to work off of.

Is there any place that has a decent set of pseudocode AI algorithms, or tips or advice on the subject, e.g. for 2D tracking?

sentences: XNA Texture2D storage question Are Texture2D objects stored on the graphics card or on system memory? I am thinking that the backbuffer is located on the graphics card (by default) and that the textures are on the system memory. I am using a spritebatch class that writes the textures to the backbuffer which are then rendered when the Present() function is called. Is this how XNA does it or am I completetly off?

sentences:
pyglet how to disable image smoothing? I'm using sprites made up of very few pixels. When scaling the sprite gets blurry, so how do I disable this smoothing? I couldn't find anything in the docs or elsewhere online

Sprite:

In pyglet, scaled 8:

sentences:
My grid based collision detection is slow Something about my implementation of a basic 2x4 grid for collision detection is slow - so slow in fact, that it's actually faster to simply check every bullet from every enemy to see if the BoundingSphere intersects with that of my ship. It becomes noticeably slow when I have approximately 1000 bullets on the screen (36 enemies shooting 3 bullets every .5 seconds). By commenting it out bit by bit, I've determined that the code used to add them to the grid is what's slowest.

Here's how I add them to the grid:

for (int i = 0; i < enemy[x].gun.NumBullets; i++)
{
   if (enemy[x].gun.bulletList[i].isActive)
   {
      enemy[x].gun.bulletList[i].Update(timeDelta);

      int bulletPosition = 0;
      if (enemy[x].gun.bulletList[i].position.Y < 0)
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450);
      }
      else
      {
         bulletPosition = (int)Math.Floor((enemy[x].gun.bulletList[i].position.X + 900) / 450) + 4;
      }

      GridItem bulletItem = new GridItem();
      bulletItem.index = i;
      bulletItem.type = 5;
      bulletItem.parentIndex = x;

      if (bulletPosition > -1 && bulletPosition < 8)
      {
         if (!grid[bulletPosition].Contains(bulletItem))
         {
            for (int j = 0; j < grid.Length; j++)
            {
               grid[j].Remove(bulletItem);
            }
            grid[bulletPosition].Add(bulletItem);
         }
      }

    }
}

And here's how I check if it collides with the ship:

if (ship.isActive && !ship.invincible)
{
   BoundingSphere shipSphere = new BoundingSphere(
    ship.Position, ship.Model.Meshes[0].BoundingSphere.Radius * 9.0f);
   for (int i = 0; i < grid.Length; i++)
   {
   if (grid[i].Contains(shipItem))
   {
      for (int j = 0; j < grid[i].Count; j++)
      {
         //Other collision types omitted
         else if (grid[i][j].type == 5)
         {
            if (enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive)
            {
               BoundingSphere bulletSphere = new BoundingSphere(enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].position,
               enemy[grid[i][j].parentIndex].gun.bulletModel.Meshes[0].BoundingSphere.Radius);
               if (shipSphere.Intersects(bulletSphere))
               {
                   ship.health -= enemy[grid[i][j].parentIndex].gun.damage;
                   enemy[grid[i][j].parentIndex].gun.bulletList[grid[i][j].index].isActive = false;
                   grid[i].RemoveAt(j);

                   break; //no need to check other bullets

                }
             }
             else
             {
                grid[i].RemoveAt(j);
             }
          }

What am I doing wrong here? I thought a grid implementation would be faster than checking each one.

sentences:
FXAA Parameter Confusion I have a question about the popular FXAA shaders that are out there written using HLSL or GLSL, and they all mainly feature these three parameters:

#define FXAA_REDUCE_MIN (1.0 / 128.0)  //0.0078125
#define FXAA_REDUCE_MUL (1.0 / 8.0)  //0.125
#define FXAA_SPAN_MAX 8.0

What is the function of each parameter?

sentences:
How to implement map scrolling inertia formulae I'm looking for a mathematical formulae to calculate map scrolling inertia. Basically I have an HTML5 Canvas displaying part of a map and I capture the mousedown / mousemove / mouseup to calculate my new offset.

And when I scroll the map I want the map to continue scrolling for a few moments after the user stopped dragging the cursor.

I do have a sample implementation but I'm not really satisfied with it. I'd be looking for a nice clean math formulae to achieve this. I'd like my map to behave for example like in Civ-5 when you scroll the map around.

Here is part of my implementation: (working jsfiddle: https://jsfiddle.net/CowWarrior/dkxnj5d8/1/)

//mouseup
stopMapDrag: function (e) {
    var movementX = (e.pageX - this.startX);
    var movementY = (e.pageY - this.startY);
    this.mapOffsetX = parseInt(this.mapOffsetX) + movementX;
    this.mapOffsetY = parseInt(this.mapOffsetY) + movementY;
    this.isDragging = false;
    this.displayMap();

    //calculate last vector
    ui.vectorX = parseInt(e.pageX - ui.absStartX);
    ui.vectorY = parseInt(e.pageY - ui.absStartY);

    //show inertia
    setTimeout(function(){ ui.dragInertia(2); }, 30);
    console.log("(vectorX:" + ui.vectorX + ", vectorY:" + ui.vectorY + ")");

    $('#canViewport').css('cursor', 'default');
},

//need to find a good formulae for inertia
dragInertia: function (factor) {
    var movementX = parseInt(ui.vectorX / factor);
    var movementY = parseInt(ui.vectorY / factor);
    ui.mapOffsetX = parseInt(ui.mapOffsetX + movementX);
    ui.mapOffsetY = parseInt(ui.mapOffsetY + movementY);
    ui.displayMap();

    if (factor < 8)
        setTimeout(function(){ ui.dragInertia(factor * 1.2); }, 30);
},

sentences:
Resizing a Framebuffer Object (ie: its attachments) on Screen Resize I have been experimenting with some post-processing effects and I have been using FBOs to store stuff.

The problem is, I attempt to resize them when I change resolution. I get no errors, however the image has been stretched so that I only see about the bottom-left quarter of it on my screen.

I have looked over the internet and and found issues such as not using glTexStorage because it is immutable, and being sure to call glViewport after binding a framebuffer. As far as I can see I'm not missing anything simple like that.

Here are some (very dark) screen shots showing the issue:

Please excuse the horrible graphics. I am working on a bloom filter and these images only contain the bright bits so it looks dark and weird.

My FBOs are initialised with a blank texture attached to GL_COLOR_ATTACHMENT0. Here is the rough pseudo code (in java). (my actual code is abstracted behind a game engine I'm writing)

Generating texture:

    // Creates the texture

    this.id = glGenTextures();

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

    glBindTexture(GL_TEXTURE_2D, this.id);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    // Set up texture scaling
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magnification);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minification);

Filling it with data: (data is a ByteBuffer filled with 0s)

    glTexImage2D(GL_TEXTURE_2D, 0, colorMode, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
    glGenerateMipmap(GL_TEXTURE_2D);

Binding the framebuffer:

   glBindFramebuffer(GL_FRAMEBUFFER, this.id);
   glViewport(0, 0, width, height); // width and height taken from width and height of framebuffer texture

Resizing the framebuffer:

    // stores new width and height to be used with glViewport
    this.width = width;
    this.height = height;
    // resize renderbuffer
    if(renderbuffer != 0) {
        glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
        glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
        glBindRenderbuffer(GL_RENDERBUFFER, 0);
    }

    glBindTexture(GL_TEXTURE_2D, texture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
    glGenerateMipmap(GL_TEXTURE_2D); // do i need this?

Thanks very much in advance if you can spot an issue with my code. Let me know if you need the full source as well.

I have a couple of ideas for issues:

is it possible to resize the renderbuffer like that?
do I have to re-attach the textures after resizing them
should i just re-create the entire framebuffer/renderbuffer/textures instead of resizing them.

sentences:
Drawing particles with CPU instead of GPU (XNA) I'm trying out modifications to the following particle system. http://create.msdn.com/en-US/education/catalog/sample/particle_3d

I have a function such that when I press Space, all the particles have their positions and velocities set to 0.

for (int i = 0; i < particles.GetLength(0); i++)
{
    particles[i].Position = Vector3.Zero;
    particles[i].Velocity = Vector3.Zero;
}

However, when I press space, the particles are still moving. If I go to FireParticleSystem.cs I can turn settings.Gravity to 0 and the particles stop moving, but the particles are still not being shifted to (0,0,0).

As I understand it, the problem lies in the fact that the GPU is processing all the particle positions, and it's calculating where the particles should be based on their initial position, their initial velocity and multiplying by their age. Therefore, all I've been able to do is change the initial position and velocity of particles, but I'm unable to do it on the fly since the GPU is handling everything.

I want the CPU to calculate the positions of the particles individually. This is because I will be later implementing some sort of wind to push the particles around. How do I stop the GPU from taking over? I think it's something to do with VertexBuffers and the draw function, but I don't know how to modify it to make it work.

sentences:
OpenGL - What steps to take to correctly set up an Uniform Block Array I have managed to get uniform blocks to work, but I seem to make something wrong when trying to setup an array of uniform blocks.

Assume this glsl:

layout(std140, binding=1) uniform LightingBlock
{
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec3 factors;
    float shininess;
} lighting[3];

What's the exact procedure to bind this? What I am doing (and what works for a single block, not an array):

GenBuffer...
BindBuffer...
BindBufferRange(UNIFORM_BUFFER, 1, buffer_id, 0, size_in_bytes)
index = GetProgramResourceIndex(program_id, UNIFORM_BLOCK, "LightingBlock")
UniformBlockBinding(program_id, index, 1);

I read that I should replace the LightningBlock with lighting[0], [1] etc, but this only returns invalid indices. So my current attempt looks like this:

GenBuffer...
BindBuffer...
binding = 1
for(int i = 0; i < 3; ++i)
{
    BindBufferRange(UNIFORM_BUFFER, binding + i, buffer_id, 0, size_in_bytes)
    index = GetProgramResourceIndex(program_id, UNIFORM_BLOCK, "lighting[" + str(i) + "]")
    UniformBlockBinding(program_id, index, binding+i);
}

What am I doing wrong? How to do this correctly?

sentences:
Save game feature in SDL 2? I am making a 2D action-adventure platformer video game using the C++ computer programming language and the Simple DirectMedia Layer 2.0 (SDL 2.0.5) development library.

So far I have created over 50 levels, added enemies (with A.I.), assigned controls, animations, and of course, added the player.

As you know one of the most important features of a video game is the game save feature, in which the game software actually stores the data in the computer memory.

Is there any way to add this feature to my game using SDL 2? If so, please answer in detail with the nessecary code.

Thank you. You have been the most helpful.

Here are the items I'm using:

Microsoft Windows 10 (O.S.)
Microsoft Visual Studio Community 2017       (I.D.E.)

VSX 17 C/C++ Compiler (Compiler)
C++ (Programming Language)
Simple DirectMedia Layer 2 (Version 2.0.5) (Development Library)

Thanks again.

sentences:
One big asset file or many small asset files? I'm working on a game and I'm wondering if it is better for performance and memory usage to have one large file containing all my assets (the assets are in a custom format) with a look up table at the front telling the location of the asset in the file or is it better to have each asset in its own file?

Thanks,
Philip

sentences: Chrome Angry Birds engine? Was Chrome AngryBirds game made using html5 canvas? And if yes: what kind of engine did they use?

sentences: Is Font Squirrel for real? I found Font Squirrel, and while it claims to have fonts free for commercial use, i can't find a license or legal pages anywhere. Are these fonts really usable for commecial use like they say?

sentences: Class design for instantly switching between free-roaming world to/from battle world? I plan to have an isometric world, which can be freely roam around. However, I desire the system to instantly apply the grid onto isometric world for battling system on any random encounter. Therefore, from what I expect, I should have a class of character that can generally switch between free-roaming and battle system. However, because I am still new to game programming, I do not know how should I approach this. If I make my character class such that I could abruptly derived it into either Free-roaming or Battle system, it may sound convenient, but I will have to implement this feature for all other class too (enemy, object, etc.). If I use Interface, then I won't have flexibility to add extra function to certain special class of object (maybe boss?). Or should I have a set of hierarchy of interface to tackle this problem? If so, it would be too complicated. Therefore, any suggestion?

sentences:
Blending Lightmaps and Dynamic Texture Shadows in HLSL/GLSL I'm using Gile[s] as my lightmapper and my engine can execute GLSL/HLSL scripts.

I would like to accomplish something like this for performance reasons. I was told that this technique can only be done by shaders.

Someone has provided me with a quick code example and starting code but it is still far from being implemented.

lightmapColor*=shadowmapValue;
colorIntensity = (lightmapColor.r+lightmapColor.g+lightmapColor.b)/3.0;
lightCol = (1-colorIntensity)*ambient+(colorIntensity)*lightmapColor;

Not sure if it is applicable in my engine so I am looking for some guidance and perhaps some basic hlsl code to accomplish this. My lightmap texture uses the UV2 Channel if it helps. Thanks.

sentences: rotate to movement direction If I have a player character that can move 8-directionally, I can set the rotation of the player to face the direction of movement. But if I want to smoothly rotate to a direction, sometimes the player will take the "long way around" (i.e., player is at -90 degrees, facing right; I press S and it will rotate 270 degrees to be at 180 degrees, facing down). How can I fix this? I tried adding 360 to the desired angle until it was within 90 degrees, but that didn't work (probably just because I'm too tired, though). Any help is appreciated!

sentences:
Get the up vector of the camera in ARKit I'm trying to get the four vectors that make up the boundaries of the frustum in ARKit, and the solution I came up with is as follows:

Find the field of view angles of the camera
Then find the direction and up vectors of the camera
Using these information, find the four vectors using cross products and rotations

This may be a sloppy way of doing it, however it is the best one I got so far.

I am able to get the FOV angles and the direction vector from the ARCamera.intrinsics and ARCamera.transform properties. However, I don't know how to get the up vector of the camera at this point.

Below is the piece of code I use to find the FOV angles and the direction vector:

func session(_ session: ARSession, didUpdate frame: ARFrame) {
  if xFovDegrees == nil || yFovDegrees == nil {
    let imageResolution = frame.camera.imageResolution
    let intrinsics = frame.camera.intrinsics
    xFovDegrees = 2 * atan(Float(imageResolution.width) / (2 * intrinsics[0,0])) * 180 / Float.pi
    yFovDegrees = 2 * atan(Float(imageResolution.height) / (2 * intrinsics[1,1])) * 180 / Float.pi
  }

  let cameraTransform = SCNMatrix4(frame.camera.transform)
  let cameraDirection = SCNVector3(-1 * cameraTransform.m31,
                                   -1 * cameraTransform.m32,
                                   -1 * cameraTransform.m33)
}

I am also open to suggestions for ways to find the the four vectors I'm trying to get.

sentences: How to implement a network proximity checker in Unity using LLAPI? I'm trying to implement a network proximity checker using my own functions in Unity, using LLAPI. How can I implemnet a network proximity checker, with similar functionalities than the ones in the HLAPI proximity checker?

sentences:
Map not loading after building Quake 2 from source I'm a big fan of the game Quake 2. Recently I've decided to spend some of my free time for digging into the Quake 2 source code. There are 2 versions of the full game code, 3.19 and 3.21 (including the game exe as well as the game dll).
As regards to the Q2 Mission Packs, the source files for both The Reckoning and Ground Zero are for version 3.20 as the filename suggests (xatrixsrc320.exe and roguesrc320.exe)
I've compiled the 3.21 exe and 3.20 xatrix dll and when I run quake2 +set game xatrix I'm getting the following message in the game console:

... Dropped frame 21 > 20 ...

...and the map/game isn't loading.
How do I allow the map/game to be loaded?

sentences:
Free Moddable 2d game with good community and tools Disclaimer: I'm okay with making this a community wiki, as I see a lot of benefit in having a place to ask this question and get good answers from people who have experience.

I would like to mod a 2D game. Having never modded a 2D game before (unless you count Starcraft custom maps back in 199x), I am looking for a game/system that has:

A good community: this means I can ask questions if I get stuck and expect a (decent) answer in roughly a day.
Solid tools: I would ideally prefer clicking and creating content over diving into optimized C++ to make changes. The better the tools, the faster you move.
Scripting language: Ideally, access to some scripting language above and beyond the main tools is an ideal middle-ground between high-level puritan tools (SC level editor) and low-level coding.
Free: I'm looking for something I can try out free, or very cheap.

It also goes without mention that I want something current; I'm sure I can mod Super Mario Brothers, Link to the Past, etc. (SNES-era games) but that's pretty worthless to me.

And please don't say "Starcraft (1)" :)

sentences:
How do I fix the "Failed to recompile android resource files." build issue? I've tried similar solutions I found on this website, nothing worked. There are thee errors that pop up... been banging my head for quite a while now, please help!

Also note: I updated my JDK using the download link (next to the browse option in the external preferences). Then linked it to this file, which I am lead to believe is the correct file. C:/Program Files/Java/jdk-9

Failed to compile resources with the following parameters:
-bootclasspath "C:/NVPACK/android-sdk-windows\platforms\android-24\android.jar" -d "C:\Users\Dylan\Desktop\ContentCreater\Repo\DoodlePlanes\DoodlePlanes\DoodlePlanes\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\android\vending\billing\R.java" "com\SoloDeveloperStudio\DoodlePlane\R.java" "com\unity\purchasing\R.java" "com\unity\purchasing\googleplay\R.java"
warning: [options] source value 1.6 is obsolete and will be removed in a future release
warning: [options] target value 1.6 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings

UnityEditor.HostView:OnGUI()

UnityException: Resource compilation failed!
Failed to recompile android resource files. See the Console for details.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex)
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message)
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuildPointToConsole (System.String title, System.String message)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.CompileResources (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.Tasks.BuildResources.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:263)
UnityEditor.HostView:OnGUI()

UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
UnityEditor.HostView:OnGUI()

sentences: Indexing a point outside of a 3D signed distance field I have a 3D signed distance field that is voxelized into a grid, surrounding an object. However, I would like to query the signed distance field to determine the shortest possible distance between points outside of the signed distance field grid, and the mesh itself. Is there any way to determine this distance without increasing the size of the signed distance field? Thank you!

sentences:
Finding roots/zeros for collision detection? For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the x/y Cartesian plane, but am now interested in understanding the basics of a priori collision detection...

In the link here, I noticed the reference to Newton’s Method.  So, I want to better understand the link b/w finding zeros of an equation and detecting a posteriori collision.

Let's start with the most obvious case of finding roots of an equation:  If you have a projectile's trajectory modeled as a quadratic function, you can find the roots to predict at what time the height will equal zero (or any other constant height, actually, by just solving f(x)=C to be f(x)-C=0 and then finding roots of that expression).

So, as I understand, finding the root can tell me the time at which the object will be at any chosen height.  More broadly, we basically know the (x,y) location of the object for any given time.  But how does root finding, in particular, translate to detecting collisions with another object?  (The other object may be stationary, or be moving.  If the latter, do you also determine roots/location of this moving object as well? Calculate the (x,y) trajectory of both objects and determine where they will intersect?)

Again, the basic question is where does root finding come into play?  Any links to a basic primer on this topic, with a simple example would also be greatly appreciated.

sentences:
Is it okay to copy a game's formula? (damage, etc) Is it okay to copy a game's formula? Formulas like damage formulas, taking the stats STR, DEX, INT, critical rate, etc. into account. Specifically I want to copy Ragnarok Online's damage calculation. But I will probably remove some stuff from the formula to reduce the scope of my game.

  Your question has been identified as a possible duplicate of another question.

I think game formulas and the like are different from game mechanics. Game mechanics is how the game is played.

sentences:
Why a method call in OnStateEnter and OnStateExit do not invoke in the correct order? I have a class that extends from StateMachineBehaviour. All I want to do is invoke some code in a specific state's first frame and the last frame to trigger some action in the game. But method calls in OnStateEnter and OnStateExit invoke inaccurately like below. And I saw a couple of articles in the Unity forum about how inaccurate StateMachineBehaviour works. Is there something I should pay attention to or any suggestion on how to invoke some code in the specific frame?
Here is the code

sentences:
Generate 2D Triangular Mesh from Vertices on a Map Given a map of vertices {(x1,y1), (x2,y2), ... (xn,yn)}, how can I generate a 2D triangular mesh covering all vertices, and where the area of all triangles completely covers the map?

The triangular areas may fully enclose other triangular areas, but no two triangles may intersect.

sentences:
Access vertex data stored in VBO in the shader If I wanted to store extra data in a VBO for skinning (indices for indexing into an array of matrices of bones and floats for applying weights to those bones) How would I go about accessing that data in GLSL? I already know how to put the data in the buffer, interleaved with the rest of the data.

For example I want each vertex for a model to contain:

Vec3 position;
Vec3 normal;
Vec4 color;
Vec2 texCoords;
int boneCount;
int[3] boneIndex;
float[3] boneWeight;

Then drawing like:

bind(vertexBufferID);
glVertexPointer(3, GL11.GL_FLOAT, stridePlus, 0 * 4);
glNormalPointer(GL11.GL_FLOAT, stridePlus, 3 * 4);
glColorPointer(4, GL11.GL_FLOAT, stridePlus, (3 + 3) * 4);
glTexCoordPointer(2, GL11.GL_FLOAT, stridePlus, (3 + 3 + 4) * 4);
glVertexPointer(7, GL11.GL_FLOAT, stridePlus, (3 + 3 + 4 + 2) * 4);
glDrawArrays(GL11.GL_TRIANGLES, 0, VPNCTEnd);

Then in my vertex shader I want:

 //Get indices of bones
 //Get weights of bones
 //Get bone transforms
 //for each bone transform, apply it to gl_Position at the specified weight

What is the GLSL required for the last part of the process? It seems like I need to set a attribute pointer to the data somehow, but I'm not sure where to do that when the data is stored in the VBO.

sentences:
Zoom camera on player I am developing a simple side scrolling game. I want to target and zoom camera on player when he dies. But it rotates the screen, and I want to prevent it. I'm copying the snippet of code here :

IEnumerator ZoomIn()
{
    while (GameCamera.orthographicSize > 2) {
        yield return new WaitForSeconds (0.01f);
        GameCamera.orthographicSize -= 0.2f;
    }
}

public void ZoomCamera()
{
    CameraZoomSource.Play ();
    StartCoroutine (ZoomIn ());
}

public void TargetPlayer()
{
    transform.LookAt (PlayerTransform);
    GameCamera.orthographicSize = 3;
    GameCamera.transform.Rotate (0, 0, -2);
}

Should I change anything in this?

sentences:
How to detect 2D line on line collision? I'm a flash actionscript game developer who is a bit backward with mathematics, though I find physics both interesting and cool.

For reference this is a similar game to the one I'm making: Untangled flash game

I have made this untangled game almost to full completion of logic. But, when two lines intersect, I need those intersected or 'tangled' lines to show a different color; red.

It would be really kind of you people if you could suggest an algorithm for detecting line segment collisions.
I'm basically a person who likes to think 'visually' than 'arithmetically' :)

Edit: I'd like to add a few diagrams to make convey the idea more clearly

P.S I'm trying to make a function as

private function isIntersecting(A:Point, B:Point, C:Point, D:Point):Boolean

Thanks in advance.

sentences:
Quixel asset to unity I downloaded asset from Quixel, I'm using Unity HDRP, the problem I am facing is how to properly create a mask map cause the asset from Quixel doesn't have metalness map where in HDRP mask map it requires channel R should be metalness map, and the base map requires RGB color and I've got diffuse map from the asset, to put diffuse map to the basemap slot the right way to do? I'm fairly new to the channel, so put it simple
1.How to pack channels for mask map if no metalness map in the asset, what to do with the empty channel
2.Is it right to put diffuse map to basemap slot?
3.What to do with the detail map in the maskmap , the same as to no metalness map provided in the asset.
4.Another question is heightmap, Unity provide pixsel mode and vertex mode, what is the consideration before choose the displacement mode, When I choose pixsel mode, the whole texture seems to be lowered down not the pixsel on the texture surface bumped or lowered down, it is the whole texture moved.
Thanks for answering these!

sentences:
Passing multiple Vertex Attributes in GLSL 130 (note this question is closely related  to this one however I didn't fully understand the accepted answer)

To support videocards in laptops I have to rewrite my GLSL 330 shaders to GLSL 130. I'm trying to do this but somehow I don't get vertex attributes to work properly.

My 330 shaders look like this:

#version 330
layout(location = 0) in vec4 position;
layout(location = 3) in vec4 color;

smooth out vec4 theColor;
void main()
{
    gl_Position = position;
    theColor = color;
}

Now this explicit layout is not allowed in GLSL 130 so I referenced this page to see what the default layouts for some values would be. As you can see position should be the 0th vertex attribute and color should be the 3rd vertex attribute. Because this is a test case I had already configured my explicit layouts in the same way, which worked, so I now simply rewrote my shader to this and expected it to work:

#version 130
smooth out vec4 theColor;
void main()
{
    gl_Position = gl_Vertex;
    theColor = gl_Color;
}

However this doesn't work, the value of gl_Color is always (1,1,1,1). So how should I pass multiple vertex attributes to my GLSL 130 shaders?

For reference, this is how I set my vertex buffer object and attributes (I've just adapted this tutorial to JAVA+JOGL)

gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vertex_buffer_id);
gl.glEnableVertexAttribArray(0);
gl.glEnableVertexAttribArray(3);
gl.glVertexAttribPointer(0, 4 , GL3.GL_FLOAT, false, 0, 0);
gl.glVertexAttribPointer(3, 4, GL3.GL_FLOAT, false, 0, 4*4*4);

gl.glDrawArrays(GL3.GL_TRIANGLE_STRIP, 0, 4);

gl.glDisableVertexAttribArray(0);
gl.glDisableVertexAttribArray(3);

EDIT
I solved the problem by querying for the layout locations of position an color using glGetAttribLocation however I still don't understand why the 'hardcoded' values like gl_Color didn't work, can't I upload data in there as normal? Shouldn't they be used?

sentences:
Strange artifacts in Unity Lightmaps I experienced this weird lightmapping bug in my game that causes some models to have glowing artifacts on their surface. These artifacts "move" around, when I edit the UVs of the model in Blender, so I assume that it has something to do with them. I took a few screenshots to hopefully clarify the issue.

Engine used: Unity 2019.1.4f1
3D Software: Blender 2.79b

If you need any other screenshots or something, let me know. Thank you in advance!

Lightmap Bug (lights off):

Lightmap Bug (lights on):

Models without Lightmaps baked:

Unity Lightmapper Settings:

Tree model in Blender with UVs:

Model Configuration in Hierarchy:

Model Asset Configuration:

sentences:
How do I change a LÖVE2D game executable's icon? I merged my game.love file and the love.exe with the command copy /b love.exe+app.love game.exe. But the resulting executable has the default LÖVE2D icon.

Is there a way to change that icon to another one?

sentences:
Isometric Collision Detection I am having some issues with trying to detect collision of two isometric tile.

I have tried plotting the lines between each point on the tile and then checking for line intercepts however that didn't work (probably due to incorrect formula)

After looking into this for awhile today I believe I am thinking to much into it and there must be a easier way.

I am not looking for code just some advise on the best way to achieve detection of overlap

sentences:
Can't Get .enabled to Work for Children Sprites. What Gives? So I have an object with a few children. I want to be able to disable/enable 2 of their SpriteRenderers via one of my scripts. I feel like I'm doing things right, but apparently I'm not. And yes, my game objects have the appropriate tags that are being searched for in my code. I'll paste the relevant bits of code below:

public bool isAiming = false;
Animator playerAnim;

GameObject arm;
GameObject weapon;

SpriteRenderer armRenderer;
SpriteRenderer weaponRenderer;

void Start()
 {
     playerAnim = gameObject.GetComponent<Animator>();

     arm = GameObject.FindGameObjectWithTag("Arm");
     weapon = GameObject.FindGameObjectWithTag("EquippedWeapon");

     armRenderer = arm.GetComponent<SpriteRenderer>();
     weaponRenderer = weapon.GetComponent<SpriteRenderer>();
 }

void Update()
 {
     CheckIfAiming();
 }

void CheckIfAiming()
 {
     if (Input.GetButton("Fire2")) // Holding right click
     {
         isAiming = true;

         armRenderer.enabled = true;
         weaponRenderer.enabled = true;

         playerAnim.SetBool("isAiming", isAiming);
     }
     else
     {
         isAiming = false;

         armRenderer.enabled = false;
         weaponRenderer.enabled = false;

         playerAnim.SetBool("isAiming", isAiming);
     }
 }

What gives? I want to just enable the sprite rendering when I hold down the right mouse click. SetActive(false/true) is not an option as I still want code to affect them while they're not visible.

Am I just trying to access the SpriteRenderers incorrectly?

sentences:
Efficient way to store entities in javascript I am trying to design a game from strach with Javascript.

It's a 2D game (a kind of Zelda on old devices).

I am trying to find an efficient way to store my data because I know I will have to face some major challenges among which :

Pathfinding
collision

I may have more than 1 000 entities on screen and maybe even more background objects (let's shoot for the stars !)

Do you have some advices / hints / articles about an efficient way to store objects so that I can (for e.g.) retrieve only a reduced set of entities in my collision algorithm

maybe there are some design patterns to deal with those challenges ?

sentences:
Is there a way to use the ContentManager with full directory paths So i want to figure out a way to use the ContentManager.Load method with full directory paths, so lets say

Content.Load<T>(@"Images\SomeImage");

becomes

Content.Load<T>(@"C:\Users\UserName\Documents\Visual Studio 2013\Projects\MyProject\Content\SomeImage");

Thanks in advance.

sentences: Map Positions in LibGDX I am developing an RPG game where there is a main world map, locations such as towns or ruins on that map and buildings in those locations where players can interact to go into. For example, I have a map and my character goes to a local town where there is a inn that I can freely enter and interact in. Once I wish to leave the building, I leave and I'll be at the same position that I had once entered the building from, albeit facing the opposite direction. The one problem that I have with imagining a map system that could be complex like this are the coordinates. Is there a way of accomplishing this with the use of universal coordinates, such as only one x and y position throughout all 3 stages of this map system, or would I need to have 3 coordinates, a Map coordinate system for the world map, a Local coordinate system for the town or ruin and a Temporary coordinate system for when I am in a building? Also, is there something in libGDX that could help out with this?

sentences:
Best way of implementing custom UI objects jawa.awt.Graphics What is the best way to implement custom sliders (for volume), buttons normal, with images (icons) and with text, text boxes and other stuff with java.awt.Graphics?

Thanks,
Kerdo

sentences:
Creating a static background when using camera transforms in Allegro 5 How can I draw a static bitmap for the background of an Allegro 5 graphics window, if I'm using camera transformations to apply perspective to bitmaps in front of the background so it appears that they're otherwise in a 3D space?

If I try simply drawing a bitmap to the backbuffer without any transforms applied, and then call al_use_transform on a perspective transform when drawing the other objects, the "background" moves along with the transform.

sentences:
How can I make a car follow the terrain in a 2D (side-view) game? I'd like to create a game where a car drives over a 2D terrain.
Which algorithm to use so the car will follow the mountain incline?

sentences:
Marching cubes and LoD I have and octree based world constructed (on the start) via marching cubes with certain density function to make a terrain (variations on noises). The terrain is rater smooth, it is not like minecraft blocky terrain at all. The deepest level of LoD is 12 and on this level (let's say) player is moving. The player have an ability to place blocks (just like in minecraft) and dig holes (block-like) in terrain. The blocks are stored as an overrides to density function so that the rendering algorithm looks if there's an override for each point of the certain marching cube block, and if there is, it constructs solid block, or hole there. Pretty simple.

The question is, what technique of LoD do you recommend, when I move away from the certain place where I have put my blocks to sustain details on lower LoD levels as much as possible?

I can see two ways there:

Render the terrain separately on each LoD and custom geometry (blocks) leave as they are. What this means is that my terrain will contain all blocks I placed rendered on LoD 12 while the terrain will be on appropriate LoD. This will lead to resource drain because all my custom blocks need to be rendered with maximum detail not depending how close I am to them, but on the other hand my house I built will look as house from the distance.
Just interpolate weights when switching to lower LoD level. This will be fast, but it will change how my blocks look (or should I say it will change a lot how looks whole my construction) drammatically - if I make a house from blocks and move away, my house won't look as house anymore.

sentences:
How can I reduce a bezier curve using a slider till all points converge to it's original midpoint I am using the code from the question here to create bezier curves (I didn't think it was necessary to repost the code here since I haven't made any significant changes to it yet).

I have a symmetric bezier curve (please see image) that I want to reduce till all points converge at the midpoint of the original curve. I would like to preserve it's symmetry while it moves.
I would like achieve this using a  float slider (with values from 0 to 1) in editor mode.

sentences:
Reading from depth textures always returns 1 I create a packed depth/stencil texture and attach it to a framebuffer like this:

glGenTextures(1,&_depthStencilTexture);
glBindTexture(GL_TEXTURE_2D,_depthStencilTexture);
//set filtering to gl_nearest, not shown cause not important
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH24_STENCIL8,width,height,0,GL_DEPTH_STENCIL,GL_UNSIGNED_INT_24_8,nullptr);

//... create framebuffer and attach some color attachments
glFramebufferTexture(GL_FRAMEBUFFER,GL_DEPTH_STENCIL_ATTACHMENT,_depthStencilTexture,0);

The creation of the framebuffer causes no OpenGL status errors.

In terms of usage for depth and stencil testing, the texture/attachment seems to work correctly. If I disable depth testing, I get the usual artifacts of objects in the back being drawn over objects in the front if they are drawn in the wrong order. If I disable stencil testing, the effects I'm using related to that don't work anymore (I'm masking out areas that shouldn't be lit by the lighting pass). Also, if I simply don't attach the depth/stencil buffer to the framebuffer, the related tests stop working (as expected).

However, reading from that texture in a shader always returns 1 if I read the depth part, and 0 if I read from the stencil part.

I confirmed this via glReadBuffer(GL_DEPTH_STENCIL_ATTACHMENT) and glReadPixels. All integers read show up as 0xffffff00, directly after clearing them via glClear and a black clearcolor and also after the screen is drawn full of stuff.

Drawing to and reading from the rest of the attached textures (four color buffers for now) works fine.

I have to note that I'm not actually manually drawing anything to the depth-stencil attachment in the fragment shader when rendering - I'm assuming OpenGL automatically draws depth and stencil values to the correct buffer.

What could be the cause of these incorrect values showing up when reading from the texture?

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

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

sentences:
Drawing multiple objects from one Vertex Buffer Object in OpenGL/OpenTK I am trying to experimenting drawing method using VBO in OpenGL. Many people normally use 1 vbo to store one object data array. I was trying to do something quite opposite which is storing multiple object data into 1 vbo then drawing it. There is story behind why i want to do this. I want to group many of objects as a single object sometime. However my code doesn't do the justice. Following is my pseudo code:

//Data
int[] _vBO = new int[1]; //vertex buffer objects

_triangleVertices = new float[]
                  { 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, //first triangle lineloop, positions in the middle of the screen.
                    3.0f, 1.0f, 0.0f, 2.0f, -1.0f, 0.0f, 4.0f, -1.0f, 0.0f, //second triangle lineloop, positions on the left side of the first triangle.
                    -3.0f, 1.0f, 0.0f, -4.0f, -1.0f, 0.0f, -2.0f, -1.0f, 0.0f  }; //third triangle lineloop, positions on the right side of the first triangle.

//Setting Up
void init()
{
   GL.GenBuffers(1, _vBO);
   GL.BindBuffer(BufferTarget.ArrayBuffer, _vBO[0]);
   GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(sizeof(float) * _triangleVertices.Length), _triangleVertices, BufferUsageHint.StaticDraw);
   GL.VertexPointer(3, VertexPointerType.Float, 0, 0);
   GL.EnableClientState(Array.VertexArray);
}

//Drawing
void display()
{
    GL.Clear(ClearBufferMask.ColorBufferBit);
    GL.Clear(ClearBufferMask.DepthBufferBit);

    //setting up camera and projection.
    float[] eyes = { 0.0f, 0.0f, -10.0f };
    float[] target = { 0.0f, 0.0f, 0.0f };
    Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView(0.785398163f, 4.0f / 3.0f, 0.1f, 100f);  //45 degree = 0.785398163 rads
    Matrix4 view = Matrix4.LookAt(eyes[0], eyes[1], eyes[2], target[0], target[1], target[2], 0, 1, 0);
    Matrix4 model = Matrix4.Identity;
    Matrix4 MV = view * model;

    GL.MatrixMode(MatrixMode.Projection);
    GL.LoadIdentity();
    GL.LoadMatrix(ref projection);

    GL.MatrixMode(MatrixMode.Modelview);
    GL.LoadIdentity();
    GL.LoadMatrix(ref MV);

    GL.Viewport(0, 0, glControlWindow.Width, glControlWindow.Height);
    GL.Enable(EnableCap.DepthTest); //Enable correct Z Drawings
    GL.DepthFunc(DepthFunction.Less); //Enable correct Z Drawings
    GL.MatrixMode(MatrixMode.Modelview);

    //Draw
    drawTriangleLineLoops();

    //Finally...
    GraphicsContext.CurrentContext.VSync = true; //Caps frame rate as to not over run GPU
    glControlWindow.SwapBuffers(); //Takes from the 'GL' and puts into control
}

void drawTriangleLineLoops()
{
   GL.BindBuffer(BufferTarget.ArrayBuffer, _vBO[0]);
   GL.VertexPointer(3, VertexPointerType.Float, 0, 0);
   GL.EnableClientState(ArrayCap.VertexArray);
   GL.DrawArrays(BeginMode.LineLoop, 0, 3); //drawing first triangle lineloop, first vertex starts at index 0.
   GL.DrawArrays(BeginMode.LineLoop, 9, 3); //drawing second triangle lineloop, first vertex starts at index 9.
   GL.DrawArrays(BeginMode.LineLoop, 18, 3); //drawing third triangle lineloop, first vertex starts at index 18.
   GL.DisableClientState(ArrayCap.VertexArray);
}

I expect 3 different triangles to be drawn, but only one was drawn. I don't know what went wrong.

sentences:
Events management using SDL 2.0 I wrote a simple SDL program using SDL 2.0. I have a little problem when I want to check the mouse wheel events. Actually, in the version 2.0 the flags SDL_BUTTON_WHEELDOWN and SDL_BUTTON_WHEELUP no longer exist. There is just the flags SDL_MOUSEWHEEL. The code below check correctly the' WHEELUP' and 'WHEELDOWN' events but with the same flag.

while(!terminer)
    {
        while (SDL_PollEvent(&evenements))
        {
            switch (evenements.type)
            {
            case SDL_QUIT:
                terminer = true;
                break;
            case SDL_KEYDOWN:
                switch (evenements.key.keysym.sym)
                {
                case SDLK_ESCAPE:
                    terminer = true;
                    break;
                }
                break;
                case SDL_MOUSEMOTION:
                    std::cout << "MOUSE : MOVE" << std::endl;
                    break;
                case SDL_MOUSEBUTTONUP:
                case SDL_MOUSEBUTTONDOWN:
                    std::cout << "MOUSE : BUTTON DOWN" << std::endl;
                    break;
                case SDL_MOUSEWHEEL:
                    std::cout << "MOUSE : WHEEL" << std::endl;
                    break;
            }
        }

But I would like to handle separately the 'WHEELUP' and 'WHEELDOWN' events. I tried several others flags in my condition but without success. Does anyone can help me, please ?

Thanks a lot in advance for your help.

sentences: Making color of sprite darker or lighter Is there any way to make a sprite darker or lighter in AndEngine? I dont want to use the alpha thing. Nor I want to loose the texture/design of the image.

sentences:
Bounding Boxes and XNA So heres some straight up code for you:

BoundingBox b  = new BoundingBox(
  Vector3.Up   + Vector3.Right    + Vector3.Forward,
  Vector3.Down + Vector3.Backward + Vector3.Left);
BoundingBox bb = new BoundingBox(
  Vector3.Up/2   + Vector3.Right/2    + Vector3.Forward/2,
  Vector3.Down/2 + Vector3.Backward/2 + Vector3.Left/2);

Debug.GraphicsManager.DrawLine(b, Color.Purple);
Debug.GraphicsManager.DrawLine(bb, Color.Yellow);

if (bb.Contains(b) == ContainmentType.Disjoint)
  Debug.DisplayVariable("Disjoint", "");
if (bb.Contains(b) == ContainmentType.Contains)
  Debug.DisplayVariable("Contains", "");
if (bb.Contains(b) == ContainmentType.Intersects)
  Debug.DisplayVariable("Intersects", "");

What this does is create two bounding boxes, that /obviously/ intersect.
DrawLine is a function that accepts a bounding box and draws it.
Math and visuals tells us that these intersect and contain.

But all I get is disjoint.

So I started a new blank fresh clean project and only added this to the update code:

BoundingBox b = new BoundingBox(
  Vector3.Up + Vector3.Right + Vector3.Forward,
  Vector3.Backward + Vector3.Left);
BoundingBox bb = new BoundingBox(
  Vector3.Up / 2 + Vector3.Right / 2 + Vector3.Forward / 2,
  Vector3.Backward / 2 + Vector3.Left / 2);

if (bb.Contains(b) == ContainmentType.Disjoint)
  System.Console.WriteLine("Disjoint");
if (bb.Contains(b) == ContainmentType.Contains)
  System.Console.WriteLine("Contains");
if (bb.Contains(b) == ContainmentType.Intersects)
  System.Console.WriteLine("Intersects");

if (bb.Intersects(b))
  System.Console.WriteLine("intersex");

and this has the same problem.

So I'm stumped. Does XNA just not have good bounding box collison code?
Or am I doing something wrong?
should I write my own collison code?

Thanks for reading, no this is not debug for me, I simply don't understand.

edit: I also have mouse picking set up and it can identify and pick
all my "models" based on Ray.Intersects(model.boundingbox) no problem.

sentences:
How can I position different size creatures in a group automaticly I'm doing a game (in xna) on my free time, as I'm not in the game market, I'm pretty sure I'm missing something that would help me get this right.  Think of Ogre Battle. A group of unit moves, and when they cross enemy, a small automatic Final fantasy battle starts for 2 or 3 round.

I'm struggling on how I should place the creatures in the combat screen. A fight started. (final fantasy rpg battle ) The creatures part of this group needs to be positionned in a 16x16 grid. Some creatures are bigger and use larger than 1x1 square.

I create a class called group to represent groups of creature walking around. So far, I decide to put in an array of 4x4 representing the grid. How do I go around and position all the creatures on that grid and make sure they arent stepping on top of each other ?

some pseudo code I have right now :

 Class Group
  array(4,4) of rectangle
  array(4,4) of creature

  Public sub Update()
    adjustCreaturePosition
  end sub
End class

Class Creature
    CombatValue as List of Enum.Qualities
    PreferedPosition as Enum.Position
    Range as smallint( 1 = melee, 2 = small range, 3 = long range)
End Class

 Public Enum Position
  Front
  Middle
  Back
 End Enum

 Public Enum Qualities
    Melee
    Armored
    Strengh
    Dodge
    Siege
    SmallRange
    DPS
    Nuker
    Controller
    Buffer
    Dex
    Int
    Sick
    Weak
End Enum

In the update of the group class , I need to create a function to set the position of all creatures when the combat starts.

Private Sub AdjustCreaturePosition()
       ' check the "prefered position" of all creep ( front, middle, back).
       ' if there are no more spot left for a creature, I need to check which creature is moved to the middle row based on A. if one of the creature on the front row will be able to attack on middle row ( based on the range ). If no unit can attack from the middle row,  the weaker one is send on the back ( the sum of their combatValue list)
    Next
End Sub

I got no idea how I'll do the AdjustCreaturePosition in a smart way yet. but lets say it works.
Where I'm at a loss is how should I handle large creature who needs a 2x2 grid ?

sentences:
Why my dynamically generated Sprites overlap? I'm trying to dynamically generate scene representing chess board made from sprites. I'm using two textures for these:
 - pieces.png (taken from here: http://opengameart.org/sites/default/files/chess_2.png)
 - tiles.png (drawn by hand, consists of two 128x128 squares filled with different colors)

The best result I achieved so far is a board with overlapping tiles:

The sprite mode for these textures is "Single" and pixels per unit are set to "128" (unsure whether I should've done this or not)

The textures are being sliced to sprites in my MonoBehavior.Start:

            var tiles = new Dictionary<int, Tile> ();
            var sprites = new Dictionary<int, Sprite> ();

            // Load all tilesets
            foreach (var externalTileset in map.tilesets) {
                    var tilesetAsset = (TextAsset)Resources.Load ("Boards/" + externalTileset.source);
                    var tileset = (Tileset)tilesetSerializer.Deserialize (new StringReader (tilesetAsset.text));

                    Texture2D texture = (Texture2D)Resources.Load ("Boards/" + tileset.image.source.Replace (".png", ""), typeof(Texture2D));
                    Debug.Log ("Texture for " + tileset.image.source + " loaded: " + texture.width + 'x' + texture.height);

                    int tilesPerRow = tileset.image.width / tileset.tilewidth;
                    int totalTiles = (tileset.image.width / tileset.tilewidth) * (tileset.image.height / tileset.tileheight);
                    for (int tileId = 0; tileId < totalTiles; tileId++) {
                            float x = tileset.tilewidth * (tileId % tilesPerRow);
                            float y = (tileId / tilesPerRow + 1) * tileset.tileheight;
                            sprites [externalTileset.firstgid + tileId] = Sprite.Create (texture, new Rect (x, texture.height - y, tileset.tilewidth, tileset.tileheight), new Vector2 (0.5f, 0.5f));
                    }

                    if (tileset.tiles != null) {
                            foreach (var tile in tileset.tiles) {
                                    tiles.Add (externalTileset.firstgid + tile.id, tile);
                            }
                    }
            }

And when sprites are added to newly created game objects:

        float minX = -4;
        float maxX = 4;
        float minY = -4;
        float maxY = 4;

        for (int i = 0; i < map.height; i++) {
                float y = minY + i * (maxY - minY) / map.height;
                for (int j = 0; j < map.width; j++) {
                        float x = minX + j * (maxX - minX) / map.height;
                        if (pieces [i, j] != null) {
                                GameObject piece = new GameObject (pieces [i, j].properties ["Color"] + ' ' + pieces [i, j].properties ["Type"]);
                                SpriteRenderer renderer = piece.AddComponent<SpriteRenderer> ();
                                renderer.sprite = piecesSprites [i, j];
                                piece.transform.position = new Vector2 (x, y);

                        }
                        if (tileSprites [i, j] != null) {
                                GameObject tile = new GameObject ("Tile");
                                SpriteRenderer renderer = tile.AddComponent<SpriteRenderer> ();
                                renderer.sprite = tileSprites [i, j];
                                tile.transform.position = new Vector2 (x, y);
                        }
                }
        }

I believe I can hack something to make this work, but I want to know how to do it properly
What's wrong with my code or scene/resources setup?

sentences:
Managing and rendering bullets I'm developing something similar to Galaga and I'm not entirely sure how to "manage" the bullets i.e. what data structures/algorithms/approaches to use when rendering them on the screen. Let's forget collision detection for now. The way I'm thinking of implementing this is:

When the application starts, create an array of bullets. Make sure this is at least as big as the total number of bullets you want to have on the screen at any given time. Initialize all the bullets to some default settings. Also create a list of the bullets that are on the screen at any time. Obviously this will be empty initially.
When the user shoots, get an element of the array and add it to a list of bullets that are currently rendered.
When drawing, iterate the list of bullets and render each of them. If a bullet gets out of the screen (say y > 1.0f) then remove it from the list and reset it to default position.

Is this a sensible approach to the problem? Are there alternatives I should consider?

P.S. This question is language/framework (etc) agnostic, but if you think it makes a difference, I'm using OpenGL ES 2 on Android.

sentences:
Roblox script: Can't get "IntValue"? I am new to Roblox scripting (Lua apparently) and was fiddling with a function that is called when one Part (dubbed the "Sender") is touched by another Part, which is actually a tool with a Part called "Handle" inside of it, and a third Part nested inside that. I have also added an IntValue to the latter to be read upon touching.

The object tree looks like this:

__Apple (Tool)
  L_Handle (Part)
    L_TouchInterest
    L_Value (IntValue)
    L_Apple (Part)
    L_Handle-to-Part Strong Joint

The function is called alright, and the part with the name "Handle" is correctly identified, but I cannot for the world get a hold of the IntValue using the following code:

function onTouch(hit)
    print("Sender touched by "..hit.Name)
    local val = hit:FindFirstChild("IntValue", true)
    if val == not nil then
        print("Found IntValue: "..val.Name)
        if val.Name == "Cash" then
            --Get Money For Apple
            print("Players: "..game.Players.LocalPlayer.Name)
            game.Players.LocalPlayer.leaderstats.Money.value = game.Players.LocalPlayer.leaderstats.Money.value + val.value
        end
    else
        print("IntValue Not Found!")
    end
    hit:Destroy()
end
script.Parent.Touched:connect(onTouch)

In other words: It keeps on logging "IntValue Not Found"!
I have changed the name of the IntValue to "Value" and back to "IntValue" to no avail. I have been adding clones of it to several different layers of the composite object, but no results.

Any help is greatly appreciated!

BTW The object is a Tool, because the player is supposed to be able to pick it up and place it on the "Sender".

sentences:
Can I remake a game I don't own any copyright to? Can I remake a game I don't own any copyright to?

There's a online browser game which I played 5 years ago. Some time ago, this game was shutdown because its developer went bankrupt. I want to re-make this game and provide it to Web again. Can I do this? Or there's some copyright problem or something like this?

sentences:
Aligning animation frame assets with different sizes I have code that changes texture in each frame depending on the player's state - walking, idle.

My problem is that the idle texture (from separate png) has a slightly different size, and due to that it appears not in line with rest of the animations, seemingly being in a slightly different position when returning to idle.

How can I position the frames based on the center of texture instead of the bottom left?

batch.draw(determineTexture(), position.x, position.y,
            currentFrame.getRegionWidth()/2f, currentFrame.getRegionHeight()/2f,
            currentFrame.getRegionWidth(), currentFrame.getRegionHeight(),1f,1f, rotation,false);

TextureRegion determineTexture(){
        if(playerState == State.idle)
            currentFrame = idleAnimation.getKeyFrame(stateTime, true);
        else if (playerState == State.walkingUP || playerState == State.walkingDOWN || playerState == State.walkingRIGHT || playerState == State.walkingLEFT )
            currentFrame = walkAnimation.getKeyFrame(stateTime, true);
        return currentFrame;
}

One png has a height of 57 - idle, while 6 columns and one row of walking frames have a height of 87 pixels.

sentences:
Can Mobile Games use Fragments instead of SurfaceViews? All the tutorials of mobile games for android (such as this one), use the  to display game objects. Most other applications tend to use an Activity > Layout Resource architecture.

The guide explains why he uses a Activity > SurfaceView Subclass architecture because of threading and canvasing at this point in the video.

Could you use fragments to have take care of threading and displaying game objects?
If you can, why is using a SurfaceView preferred?

sentences:
How to work with edge Texture Im not sure if i use the right terms, but im not able to find something to start with.

Im trying to develop a little HTML5 game. I have a ground with a texture and now I want to make a surrounding texture. The texture is an image wich should be bend around the ground.

At the moment im using easelJS for display my images/textures. So im looking for some sort of Tutorial/Script/Advice. Im not even sure if I can bend a image in javascript. So the worst case I can think of is split the image in 100 pieces and then put it back together and rotate each piece.

for example like this:

sentences:
Does Google Play allow an account to log in to the same game on 2 devices? I'm developing an online Android game with Unity. I want all Google Play accounts to have only one session logged in at a time.

Do I need to write my own code to disconnect an existing session on new login attempts, or does Google Play already handle this?

Edit:

An idea popped to my mind. I can save the logged in device's state to a a file on Google's Saved Games cloud, and write an instance-specific identifier to that file that indicates who has logged on last. And checking file constantly on all instances will allow me to disconnect instances whose identifier doesn't match the one on the file on the cloud.

Do you think this is a good idea? I mean, fetching file from cloud every second or so?

sentences:
What are the differences between EGA and VGA for MSDOS API? How different is the API for EGA and VGA for MSDOS applications? We're talking about the API that was used in games like Doom, Quest for Glory, Duke 3D, etc.

More specifically, how much work would be involved in changing an application's use of EGA APIs to VGA APIs? or SVGA even? They seem to be fairly similar in terms of interrupt strategies, registers used, etc. Looking for a little more definite answer though, if possible.

Forum post that suggests wrapping memory access may provide a partial solution:
http://www.allegro.cc/forums/thread/604334

Some basic information on using VGA, but nothing on EGA:

http://www.brackeen.com/vga/basics.html

http://www.wagemakers.be/english/doc/vga

sentences:
OpenGL equivalent of .fx files in GLSL or Cg? There's a lot of learning material in the DirectX world that uses .fx files to manage shaders, and .fx seems to be well integrated with 3D packages such as Maya and 3D Studio Max

What do larger OpenGL projects use? Do they all have a bespoke format or are there any common standards in use that might have some tools to go with them?

I have found a 404 page on http://www.khronos.org/glfx/ and http://sourceforge.net/projects/glfx/files/ has no files at all in the download section.

Can you use .fx files with Cg as the languages are so close syntactically?  I hear that Cg has poor performance on the ATI Linux drivers but at least it my help me get going on my own Nvidia system.

sentences:
Procedural terrain using 3D noise I'm coding a procedural terrain generation based on this article from GPU Gems 3.

But using CPU (not GPU). I'm stuck at generating the procedural terrain. I just can't
figure out how make a 3D texture the way it looks in the article (fig. 1-10). Am I missing something big here? Here is the code:

float CTerrain::DensityFunction(float x, float y, float z) {
    CPerlin3DTexture perl_tex;
    float noise;
    uint32_t octaves = 3;
    float amplitude[10] = {0.25,0.5,1.0,1.9,4.1,8.1,16.1,9,10};
    float lacunarity = 1.5;
    float freq[10] = {4.03,1.96,1.01,0.51,0.2487,0.12563,0.8013,0.39913, 0, 0};
    uint32_t i;

noise = 0.0;
    for(i=0; i < octaves; ++i ) {
        noise += perl_tex.noise(x * freq[i],
                                y * freq[i],
                                z * freq[i]) * amplitude[i];
        x *= lacunarity;
        y *= lacunarity;
        z *= lacunarity;
    }

    return noise;
}

Values (nx,ny,nz) = (128,128,10)

float ***CTerrain::GenerateDensityTexture(uint32_t nx, uint32_t ny, uint32_t nz) {
float step[3];
int32_t i, j, k;

step[0] = 1.0 / (float)nx;
step[1] = 1.0 / (float)ny;
step[2] = 1.0 / (float)nz;
for(i = 1; i < nx-1; i++) {
    for(j = 1; j < ny-1; j++) {
        for(k = 1; k < nz-1; k++) {
            tex[i][j][k] = DensityFunction((float)i * step[0],
                                           (float)j * step[1],
                                           (float)k * step[2]);
        }
    }
 }

return tex;
}

Help, anybody? This is what I get from the above code:

sentences:
C++: Smart pointers, Raw pointers, No Pointers? Within the scope of developing games in C++, what are your preferred patterns in regard to use of pointers (be it none, raw, scoped, shared, or otherwise in between smart and dumb)?

You might consider

object ownership
ease of use
copy policy
overhead
cyclic references
target platform
use with containers

sentences:
Moving sprites based on Delta time - consistent movement across all devices with different resolutions This is the formula I am currently using to move my sprites across the screen:

Examples below only deal with X coordinates to keeps things as short as possible.

Initial variable declarations:

float frames_per_second = 30;         //Set this to target frames per second, 30 for this example.
float dt = 1/frames_per_second;       //Delta
float spriteXGrid;                    //Sprite's position on a grid (grid can be any explicit value, I use something simple like 800 x 600)
float spriteXScreen;                  //Sprite's actual final position in screen coordinates
float spriteXTime=5;                  //Time variable.  This is in seconds and is the amount of time the sprite should take to traverse the screen
float spriteXVel=1/spriteXTime;       //Velocity value used in conjunction with time value to calculate new position

To set my sprite's initial position I simply do this:

spriteXGrid = (pos/800);           //Where pos is the position on the grid (0-800) and 800 is the grid size that I chose to work with.
spriteXScreen=spriteXGrid*width;  //To convert to actual screen coordinates - where width is the actual width of the device currently running on.

Then to move my sprite, I do this:

spriteXGrid = spriteXGrid + (spriteXVel * dt);  //Update sprite's position on the grid
spriteXScreen=spriteXGrid*width;                //And convert to screen coordinates (again, width is the screen width of the current device)

Then I just use the spriteXScreen variable to plot the sprite, something like:

sprite.drawSprite(spriteXScreen,0);            //this is from a custom class I wrote that takes in sprite's x and y coordinate and draws it there.

My question is, is there an easier way I can do this?!  It's a nightmare to manage when it comes to collision detection etc.... because, you have 2 different coordinates, the 'screen' one (which I would describe as 'superficial'), and the 'grid' one which is needed for all the good stuff, and is a nightmare to actually work out and work with.

is there anyway I can just do something like:

spriteXScreen+='some value'

Which would allow my sprite to move across the screen in the same amount of time on all devices?

(I mean I can't just say move it by 1 pixel, because if I move 400 pixels in say 5 seconds on a 400 pixel wide screen, the sprite will have passed the whole screen in those 5 seconds, but on an 800 pixel wide screen it would have only passed halfway in the same amount of time).

The whole business of have a 'grid' coordinate and having to convert it to a 'screen' coordinate is extremely irritating and I'm wondering if I'm doing this all wrong....?

Suggestions and solutions would be very welcome

sentences:
Convert quaternion to a different coordinate system OSVR has a right-handed system: x is right, y is up, z is near.

I need to convert orientation data from a sensor in OSVR to a different right-handed system in which x is forward, y is left, and z is up.

I need to calculate the transformation that will convert a quaternion from one system to the other.

I naively tried:

void osvrPoseCallback(const geometry_msgs::PoseStampedConstPtr &msg) { // osvr to ros
    geometry_msgs::PoseStamped outputMsg;

    outputMsg.header = msg->header;
    outputMsg.pose.orientation.x = msg->pose.orientation.y;
    outputMsg.pose.orientation.y = msg->pose.orientation.z;
    outputMsg.pose.orientation.z = msg->pose.orientation.x;
    outputMsg.pose.orientation.w = msg->pose.orientation.w;

    osvrPosePub.publish(outputMsg);
    ros::spinOnce();
}

But that made things really weird. Facing north pitch is pitch, facing west, pitch is yaw, facing south, pitch is negative pitch...

How can I convert my OSVR quaternion to the a corresponding quaternion in the new coordinate system?

sentences:
Speed up content loading I am using WinForms Sample downloaded from microsoft website. The problem is, that the model loading time is quite long, using:

contentBuilder.Add(ModelPath, ModelName, null, "ModelProcessor");
contentManager.Load<Model>(ModelName);

even a simple model, such as a cube with no textures, takes 4+ seconds to load. Now, I am no expert on this, but is there anyway to decrease loading time?

EDIT:

I've gone thru the code and found out that calling contentBuilder.Build(); ,which comes right after contentBuilder.Add() method takes up most of the time.

sentences: Is it good to use 24 fps animation in 60 fps game? Is it normal to use 24 fps animation in 60 fps game or it will hurt perfomance or create bugs?

sentences:
Self-righting agents that have fallen over I need insect-like agents that have fallen/rolled on their back/side to naturally re-orient themselves.  The agents are modeled as simple cuboids in the physics engine (Bullet) to approximate an ant-like shape.

At the moment I correct the orientation by instantly altering it when the dot product of surface 'up' and agent 'up' is less than some number (e.g. -0.5).  Thus the agents can fall over only so much before they are insta-righted in the blink of an eye.

Obviously this looks nasty. Plus in the border cases, where the dot product isn't quite low enough, they can still fall over and don't get self-righted.

So, I need a way to have the critters automatically roll back onto their feet. How can I do this? The way I see it there are two problems:

1) How to determine the best rotation axis (e.g. better to roll on their back than head-to-tail)?

2) How to work out the magnitude of torque required to overcome the physics engine, whilst not being too much that has them flipping end over end?

[Full disclosure: I originally posted this question on gamedev.net, to no response.  I also posted in StackOverflow, but deleted the post when this stackexchange was recommended instead]

sentences:
How can you effectively filter your community feedback? I am not asking for myself, I am asking for someone else who will likely not read this question because he is too busy reading his email, but I am sure that this question will be of a lot of value to others.

The poor guy has the problem that his development project got quite a bit more attention during development than he liked. Now he gets bombarded with emails full of bad suggestions and useless bug reports. Reading through all these emails takes him several hours of development time each day. However, not reading it is not an option either as it would mean that he could miss some emails which are actually important, like mails from potential project members, useful bug reports or press and business contacts.

He recently called it the biggest problem for the development of his project in a 20 minute video (you don't need to watch this rant entirely. The blog post linked in the first sentence of this question summarizes it very well)

How can a game developer canalize and filter their feedback stream to improve the signal-to-noise ratio?

sentences:
In game engine, how to get the vertices buffers of different vertex formats for render from the mesh file properly? I'm a fresher on engine programming. I have a question of how we can get the vertices buffers of vertex formats from the mesh file.

For example, in OBJ file or FBX file, we save the positions, normals separately. So the whole mesh file is a structure of different arrays which contain the different attribute of the vertices.

But when we offer those data to the graphics card, we'll offer an array of vertex structs, here the vertex struct contains the position, normal, UV... for one vertex.

So, suppose we want to generate different vertex buffers for different shaders from the mesh file(the struct of arrays), then I think we can use 2 solutions:

generate a different array of structs, here the different struct will be the different formats of vertices.
The problem is: It takes a lot of memory to save the different vertex buffers.
generate a general array of struct, here the struct contains all of the vertex attributes we can get from the mesh file, and use offset to get the correct data for different vertex format.
The  problem is: will it be slow for shader program to access the vertex data?

Which one is the better way to do? Or is there any better solution?
Again, I'm just a fresher, So I hope my description is clear enough for the problem :-)

Thank you all very much!

sentences:
How can I efficiently store tilemaps in work memory? I've been working on different tile-based projects, but never really bothered with being efficient memory-wise. Each tile was represented by a tile class which would hold the following:

X and Y ID of the tile
Solid boolean
Events for entities when leaving or entering a tile
Graphic data
Size

But especially now, when using a component based system where everything is an entity (which has some base functionality which already takes some memory), I've started to run into memory issues.

I started looking at existing tile engines and noticed that a lot of them don't even have a tile class, but just use an array of integers. I figured you could just use the index of the array for position and the actual integer value for the graphics.

But how would store the other data for this tile? With the events for example, would save them externally from the array or something? This would mean that you would need to have a list for every property you want to save, which sounds like a pain in the ass.

It might be good to know how they would have handled this on a more limited platform, let's say the SNES?

sentences:
How can I support direct P2P for mobile devices? I'm Interested in two or more player co-op in Godot, via direct P2P without connection to a central server.
I have this idea that would utilize two smartphones in proximity to one another. I don't know an awful lot about Bluetooth or networking so please explain simply.

sentences:
Rotate a 2D object slowly to the touch position in Unity I am creating a circular Joystick like setup in Unity. Played a lot with it in different ways but I don't get the desired results.

void Update()
     {
         //movement = Input.GetAxisRaw("Horizontal");
         if (Input.touchCount > 0)
         {
             touch = Input.GetTouch(0);
             if (touch.phase == TouchPhase.Began)
             {
                 firstTouchY = touch.position.y;
             }

             if (touch.phase == TouchPhase.Moved)
             {
                 if (touch.deltaPosition.y < 0)
                 {
                     movement = -1;
                 }
                 else if (touch.deltaPosition.y > 0)
                 {
                     movement = 1;
                 }
                 rotatePlayer();
             }
         }
     }

     private void rotatePlayer()
     {
         transform.RotateAround(Vector3.zero, Vector3.forward, movement * Time.fixedDeltaTime * moveSpeed);
     }

This is what I want.

sentences:
CCMoveBy values on update() This is my problem: I have a scheduled update, here I track the movements of my objects (sprites), I move them with CCMoveBy, and I need to constantly update the zOrder. For setting the zOrder I've made a setZOrder(), which it takes the actual position of the sprite.

And here is the problem, I get all the X and Y values after the object is in the target. I know I get the values after the object is in the new position because I've made a CCLog. I can read all the values from the sprite, only when it's in the new position, so everything is well sorted only when the objects are not moving.

How can I get the CCMoveBy values on every tick update? (or how can I get the CCMoveBy values in "real-time"?)

Here is an idea of my code.

this->schedule(schedule_selector(Game::update));

void Game::update(float dt)
{
   setZOrder();
   moveObjects();
}

void Game::setZOrder()
{
  //This function takes the X and Y position and the row and column where the sprite is.
  //Is working good. But I'm getting the "move" action values, after the object is in place.
}

void Game::moveObjects()
{
   for (i=0; i < numChildren; i++)
   {
     CCActionInterval* move = CCMoveBy::create(targetPoint, time);
     object[i]->runAction(move);
   }
}

sentences:
Collaborative Diffusion vs. A* for loose armies combat: any clear winner? Collaborative Diffusion (CD) takes a lot of the work that A* does and combines (writes) it cheaply for multiple agents to read cheaply. This is because the majority of CD's processing works via a simple CA / diffusion approach that produces a single shared map for every agent to use on a given game update. Agents then perform hill-climbing within that space, which is also very cheap.

The primary downside is that the data structure created by CD must apply for all agents; that is, each agent's subjective view of the environment is identical; A* OTOH needs a path calculation per agent, each frame. In spite of this, the relatively low cost associated with CD would seem to make it, on average, a far more suitable approach than A*, even when we must create unique views for agents (comments / experience on this are welcome).

EDIT Consider the following example using Collaborative Diffusion:

Two armies are on a battlefield, each army emitting a uniform scent. They charge (climb the scent gradient), and as the two lines clash, each agent takes on the first, closest enemy agent on the opposing line. This happens because on each approach step for each unit, it checks whether it's yet adjacent to an enemy; if so it locks on / attacks indiscriminately. This is much freer than specific targeting, which is where A* would seem to be a better choice.

Am I correct in these assumptions? Are there other downsides to CD as opposed to [insert your flavour of] A*, for selecting ANY target between large groups?

sentences:
DirectX11: Drawing multiple objects How can I draw many different objects on screen at once, with multiple vertex buffers, using DrawIndexed()? (Drawing the same object is simple, and I'm not looking to instance)

...but I am looking to transform two different vertex buffers. (Yes I am using indexed vertices)

sentences:
Server side game loop Many java games use thread.sleep() to controll fps. Since the server does not display graphics, should the server game loop keep running just calculating delta time? Like this example:

long lastLoopTime = System.nanoTime();
final int TARGET_FPS = 60;
final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;

while (gameRunning)
{
   long now = System.nanoTime();
   long updateLength = now - lastLoopTime;
   lastLoopTime = now;
   double delta = updateLength / ((double)OPTIMAL_TIME);

   doGameUpdates(delta);
}

sentences: Updating the position of a prefab in Unity for A* pathfinding I am trying to use Aron Granberg A* pathfinding project in my game. I am very new to Unity, so I am having some trouble figuring out how to instantiate multiple enemies from a prefab that will seek out my player. I am unable to set the player object from the scene as the target, since prefabs cannot take in scene objects. However, if I use the player prefab as the target, the enemies will only go toward the starting position of the player. Is there any way to update the prefab position as the player instance moves? Or is there a better way of doing this? I want this to be a top-down shooter style game (2D) with constant enemy spawning, so it doesn't make sense to set the target for each individual enemy instance. Any help would be greatly appreciated. Thank you!

sentences:
Collision filtering techniques I was wondering what efficient techniques are out there for mapping collision filtering between various bodies, sub-bodies, and so forth.
I'm working on a physics engine and I need ways for a user to easily specify some complex relationships between bodies (what should/shouldn't collide), and ways to organize that filtering data so that it's easily attainable / memory-efficient.   One part of my engine that could also be taken advantage is what my 'bodies' actually are. They're like folders that you can put convex shapes, and other bodies in as to organize the parts of a complex rigid body.

I'm familiar with the simple idea of having different layers of 2D bodies, but this is not sufficient for more complex mapping:

EXAMPLE:
(Think of having sub-bodies of a body, such as limbs, collide with each other by placing them on the same layer, and then wanting to only have the limbs collide with the ground but not the body)
- I don't see how a user could accomplish the above example with just a bunch of different layers... The body must collide with the ground and therefore be in the same layer, but the limbs must also be in the same layer as the ground, causing unwanted collision between the body and the limbs.

This can be solved with a multidimensional layer setup, but I would probably end up just creating more and more layers to the point where the simplicity and efficiency of layer filtering would be gone.

Are there any more complex filtering techniques that would solve complex situations such as the example? And even more possibly complex situations?

sentences: When should rendering be performed during a frame? When working with OpenGL or DirectX, should draw calls be done all at once, at the end of the update loop, or is it better to have draw calls occur during the update loop rather than just at the end?

sentences:
Skybox Development Help I'm a freelance game designer, and I can't afford to hire someone to do skyboxes for me.

However, I am unable to do them my self.

Let's say I have a texture that can be tiled on four sides...

If I put that very texture on each side of the skybox.. It just comes out looking like a cube.

I'd like to know how exactly I need to "warp" a texture, so that when applied to a cube on all four sides, it looks spherical.

Thanks! -- G

sentences:
Is there any equivalent to glPushMatrix in XNA? I'm trying to implement a scene graph for my 2D game in XNA, and I was looking for a way to draw every object while saving only the local transformation of the object. This seems a bit like glPushMatrix. If such a function exists I can just push a matrix for every node and then call the draw function for all its children.

The whole idea is to avoid passing parent transformations to children. Is there anyway to do so?

sentences:
ASP.NET Browser game Timers I am developing a simple browser game, using ASP.NET, C# and SQL Server 2012.
I need to implement build time of some unit or building. One way would be storing finish date to database and just fetch remaining time on refresh, but there is one problem. If user doesn't refresh in a long time and building finished days before, the dependent records in database won't get updated (e.g. I have finished building Iron Mine 3 days ago, but the production per hour wont get updated until user refreshes).
How would you approach this problem ? Is there some sort of timed event in database, that will not ruin database server performance when there will be a lot of timers ?

sentences:
How to do collision detection for fluids in 3D? Is there an algorithm or a technique which can detect the collision between 3D fluids?

I currently treat my fluids as dynamic meshes. Is it possible to find collisions with these, or will I need a different representation?

I have considered traditional collision detection techniques like bounding boxes and 'trees' of bounding boxes, but they seem to be more accurate for rigid/solid objects, not for fluids.

sentences:
Which elements make some maps in multiplayer FPS games more fun than others? I'm working on a sci-fi multiplayer FPS game, and am currently designing maps with layout influences from the 2015 Star Wars: Battlefront game and from the original Halo CE game, as those games have the maps which I find very enjoyable.  When I was building the map layouts for my game, I started to wonder why I was looking at these older games for reference instead of, say,  maps from these games's sequels.  I know that the enjoyability of certain maps is subjective, but there's a big difference in the amount of fun my friends and I have had playing the maps in these specific games instead of the newer sequels.  Something about the maps in these games provides an inherently fun, memorable experience, and some newer games (like Battlefront II or Halo V) lack that experience.  Maybe some of these maps aren't really anything special, but  I know that certain maps like Blood Gulch have been praised by fans for years.

What makes these maps so memorable and fun to play on multiplayer?  Is it a product of the developers' map-making experience and the resources of the large  companies (the Battlefront devs went to Iceland for reference), or are there specific layout styles and/or structures that are known to provide interesting close-quarters scenarios?  Is there an intangible quality to good maps?

sentences:
Movement constrained to the faces of a cube The basic setup I'm working with is a cube rendered in-Engine (Panda3d, although I only am looking for a generalized solution) as well as a 2d square on one face of the cube. The eventual outcome I'm looking for is for the player to control the 2d square with WASD as it moves on the faces of the cube (never anywhere else)

My current solution is to have the player object contain two unit vectors: forward and right. The forward vector controls with direction the player moves when W/S are pressed, and right controls the direction for A/D. So for example, the player starts out on the near Y face (y = -1), so the vectors are:

forward = {0, 0, 1}
right = {1, 0, 0}

When the player's position exceeds the a boundary of the cube (e.g. on a unit-cube, the Z coordinate is greater than 1), forward and right are recalculated for the new face the square should be on, and the square is appropriately rotated.

I've started to get this working, however, in this early implementation, there is a fixed camera. Eventually, the camera is planned to move to be orthogonal to the face the cursor is currently on, so I realized that what signifies "forward" is going to vary based on the path a player takes to get to a face. My struggle is to now find an appropriate movement method to the cube-face constrained motion, with a moving camera.

sentences:
I have a problem rotating a 2D game object after collision I'm developing a simple flip game where a cube flips and the bar a it collides with should start rotating after collision. Most snips involve destroying an object, but that's not my case.

Here is my code:

using UnityEngine;

public class CheckI : MonoBehaviour
{
    float x;
    public Rigidbody2D rb2d;

    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "bar")
        {
            x += Time.deltaTime * -10;
            transform.rotation = Quaternion.Euler(0, 0, x);
        }
    }
}

How do I start rotation after collision?

sentences:
Unity Rendering Pass Before Refraction not showing In the documentation it states:

Before Refraction: Draws the GameObject before the refraction pass. This means that HDRP includes this Material when it processes refraction. To expose this option, select Transparent from the Surface Type drop-down.

I have selected the Transparent option for surface type but the Before refraction rendering pass is not in the drop down list for rendering pass. How can I get it to be there? Are there some other option that might be disabling it?

sentences: How to place same canvas on multiple cameras in Unity? I know how to do It on one, but I don't know how to do it using multiple cameras, 3 of them are important, i want to show the whole UI except for the minimap. I need to change the camera angle on some spots, while keeping the same canvas for displaying the number of coins XP and the current level.

sentences: How to reverse gravity in Unity I'm trying to figure out how script gravity reversal on collision with an object. How can I reverse gravity?

sentences:
Algorithm to generate multifaced cube? Are there any elegant soloution to generate a simple-six sided cube, where each cube is made out of more than one face? The method I have used ended up a horrible and complicated mess of logic that is imopssible to follow and most likely to maintain. The algorithm should not generate reduntant vertices, and should output the indice list for the mesh as well.

The reason I need this is that the cubes vertices will be deformed depending on various factors, meaning that a simple six-faced cube will nto do.

sentences:
Block picking / ray casting through 3d blocks always slightly off I've been working on adding a line-of-sight/ray-tracing system to my 3d block-world game. I've tried several different methods and they all work fairly well. At the moment I'm using something similar to what Bukkit uses.

Essentially, using the point of origin (the player location, plus the extra height for the "eye" of the camera), and the current yaw and pitch, I'm looking for every block that the line of sight would pass through.

For the most part it works - however, the "ray" is always slightly off, by roughly half a block or so. What I mean is, as I slowly move my cursor left/right or up/down, the block I'm actually focusing on doesn't "highlight" (for testing, I set it to snow) until the cursor is roughly to the middle. This offset varies a bit based on my angle to the block.

http://d.pr/i/vaZo

It seems like when my cursor is on the left 50% of a block, the block to the left highlights. The top 50% of the block, the block above highlights. Same for right/bottom 50%s.

I'm trying to understand where this discrepancy is coming from. I've been tweaking and toying with code based on the assumption that one of the following is the issue:

The "eye" offset or the player's location are wrong. I'm using the same y offset the camera uses and as far as I can tell from collision, the standing location of the player is accurate
The ray somehow needs adjusted yaw/pitch values? I don't see how, those yaw/pitch values are used for the camera. They should describe the exact direction the ray needs
The "normalization" code for the vector is wrong. I've found essentially same code in multiple examples, and it seems like it doesn't round/cast values, so I shouldn't be losing anything

I'm looking for advise on:

What values are the most likely cause for a half-block offset?
or, how do I fix?

The player's camera is set like this:

GL11.glLoadIdentity();
GL11.glRotatef(pitch, 1.0f, 0, 0);
GL11.glRotatef(360.0f - yaw, 0, 1.0f, 0);
GL11.glTranslatef(-position.x, -position.y - EYE_HEIGHT, -position.z);

EYE_HEIGHT is 1.8f

The "direction" vector is normalized like this:

Vector vector = new Vector(0,0,0);
vector.setY( (float)-Math.sin(Math.toRadians(pitch)) );
float v = (float)Math.cos(Math.toRadians(pitch) );
vector.setX( (float)(Math.sin(Math.toRadians(yaw))*-v)  );
vector.setZ( (float)(Math.cos(Math.toRadians(yaw))*v)  );

And the player's location is essentially just a `Vector3f.

I've found several alternate methods of calculating the right info here on gamedev, but the code I have is so close it doesn't seem worth ditching. Though I will if needed, lol.

sentences:
Are there still advantages to using gl_quads? OK, I understand that gl_quads are deprecated, and thus we're not 'supposed' to use them anymore. I also understand that a modern PC when running a game using gl_quads is actually drawing two triangles.

Now, I've heard because of that a game should be written using triangles instead. But I'm wondering if, due to the specifics of how OpenGL makes that quad into two triangles, it is ever advantageous to use quads still?

Specifically, I'm currently rendering many unconnected quads from rather large buffer objects. One of the areas I have to be careful is how large the vector of floats I'm using to make/update these buffer objects get (I have quite a few extra float values per vertex, and a lot of vertices in a buffer - the largest buffers are about 500KB).

So it strikes me that if I change my buffer objects to draw triangles this vertex data is going to be 50% larger (six vertices to draw a square rather than 4), and take 50% longer for the CPU to generate.

If gl_quads still work, am I getting a benefit here, or is the 50% extra memory and CPU time still being used on OpenGL's automatic conversion to two triangles?

sentences:
How do dialog trees work? That is, what is connected to what and how to move between lines of speech when a sub-conversation ends?

If you have any examples of a basic dialog tree in C#, please post them.

sentences:
State machine in C for SDL game I want to create a state machine for menu in my SDL game. So this is my code without the SDL I just want to ask if this is a good way to create it.
here is a code:
#include <stdio.h>
#include <windows.h>
enum states
{
Menu,
Game,
Game_over,
Exit
};

int main()
{
 int game_is_running = 1;
 enum states state = Menu;
 while(game_is_running == 1)
{
  switch(state)
 {
  case Menu:
    state = Game;
    printf("menu screen with play and exit button.\n"); //need to add if
                                                //exit or play is pressed
                     // if exit then exit program if play than you know...
     break;
    case Game:
     state = Game_over;
    printf("after play button is pressed game screen will show up.\n"); //after this i will come back to menu.
    break;
  case Game_over:
    state = Exit;
    printf("screen after game.\n");
    break;
  case Exit:
    printf("turn game off.\n"); //this will be in the if function with a game.
    game_is_running = 0;
    break;
}
 Sleep(1000); // sleep for a second just for test
}
   return 0;
}

sentences:
Should the entity handle his own movement? I am currently building a simple turn based game with a Room consisting of a 2D array of Tile objects. Those can be WallTile or FloorTile. Tile objects have a north, east, south and west  Neighbour. The FloorTiles have a Stack of Entities so I can easily draw the top entity.
Now I am wondering, my Player is an Entity, when the player moves, should the player handle that logic, or the Game that holds my Player?
In the first case it would be something along the lines of:
class Player : Entity {
    public Tile CurrentLocation

    public bool CanMoveTo(Direction) {
        // Let's say that direction is East
        return CurrentLocation.EastNeighbour == FloorTile
    }

    // This method does the actual move
    public void MoveTo(Direction)
}

In the second case it would be like this:
class Game {
    public Player Player;
    public Room Room;

    public void Update() {
        // Lets say we get direction from some input from somewhere
        if Room.TileAt(player.Y, player.X) is FloorTile then MoveThere()
    }
}

I am not quite sure what the nicest of the two options is. Initially I am thinking about the first solution. Any help or tips would be appreciated.

sentences:
Move collider along with model with Mecanim jump animation I've been creating an infinite runner game in Unity3D for a while and I got stuck in this point that whenever my character jumps using Mecanim system his model (mesh) goes to air but his attached collider does not.

For jumping I don't apply any force or somethings else. (He does not even have a rigid body component). The jumping process is only done by Mecanim animation jump.

Is there any way to make that collider to move along with the model?

Please note that since I've used character controller to controlling my character, I cannot use "Apply root motion".

sentences:
HTML5 game : Secure way of saving score I wrote a pretty basic game for colleagues to play : the player shoots on an enemy which has 50 lives while other smaller enemies pop randomly on the screen. The goal is to kill the main enemy as fast as possible.

One important point : the game is written in javascript (using HTML5 canvas).

At the end of the game, I send the score and username to my php function in Ajax, and that's where I have trouble : I find it really hard to restrain my colleagues from cheating.

Here are the different ways of cheating I've noted so far :

Changing the score sent during the ajax call
At the beginning of the game, reducing the number of lives of the enemy
At the beginning of the game, reducing the probability for enemies to appear

Here are the solutions I implemented to counter that cheating :

Create an array that I fill each time I enter the game loop with "delta", the time between that frame and the previous. I send that list to my php save function and then check that the total time of the deltas is equal to the score sent.
Create an array where I store the times when the Enemy loses 1 life. Then in the php save function I check that the list trully has 50 elements, and that the time between 2 elements is not less than a certain value
Create an array where I store the time when an enemy appears. Then in the php save function I check the number of enemies is not less than a certain number.

The 2 first points seem good enough for me : it becomes too much trouble for anyone to try and cheat that.
The last point is causing me much trouble. I cannot stop the user from changing apparition rate to 0, then in the ajax call just fill the array with 30 values, that seems pretty easy.

This is my first try with this kind of issue, so I have several questions :

Am I on the good way?
Are there any "patterns" I am missing for this kind of issue?
What would be your approach? What would you do? How to make it even more difficult for the players to cheat?

sentences:
How does Aspect Ratio and Resolution work in Unity? I am trying to make progress in Unity on understanding how aspect ratios and resolution work. I can't quite wrap my head around the topic. For example, I am trying to make a simple breakout style game, but in order to do that, I need to consider the world units and how each brick would fit into the scene. From what I have read, world units are dependent on screen resolution and aspect ratio. How would I be able to make something like this if mobile games are played on different devices (and ones with notches nonetheless). Also I'd like to know how to achieve this without using the tacky black bars that some games use.
Any information regarding this would be extremely appreciated.

sentences:
Error in the order of the target points to be followed. How to set the order of elements in an array? I have a project where it has 1 NPC and 3 target points:

In the project I set the NPC to go to target point 1, then to 2, then to 3.

Expected path:

Path that is occurring:

This problem did not happen out of nowhere, but first I will explain the creation of the target points.

I created the first target point, added the components it needed, and then replicated it. Selecting the first target point and pressing CONTROL + W. I positioned the second target point, and then, again selecting the first target point, I again replicated it.

The order of the path was as expected. I modified some code (none of the codes I modified related to the NPC or target points). After that I created a new target point (replicating it from the first target point) and then my problem started.

The NPC was initially going to target point 3, to the 4, 1 and then 2.

Even excluding target point 4, the order did not return to the expected (1, 2 and 3).

I inserted a print after the loop that causes the NPC to move toward the target points, so I could figure out the order of the target points, and it is making sense with the order of the path that is taking place.

Blueprint + Print:

3 to 1 to 2.

I created 2 more target points, and see how the order changes without any sense:

4 to 5 to 1 to 2 to 3.

I added another 1 target point to see if it meets a pattern:

No sense at all.

I'd like to know how to set the order of target points in the array.

EDIT 1 (Root of the problem)

From what I researched, I came to the conclusion that the problem is due to the function Get All Actors Of Class (that I use to make the NPC follow the target point):

It was also researching that I discovered that I can search for a specific actor using tags.

Link where I made the discovery:

https://docs.unrealengine.com/en-us/Gameplay/HowTo/FindingActors/Blueprints

But this feature does not serve me, because I do not want to establish an exact number of target points, I would like the order of the path to be given by the name of the target points or at least by the creation order.

EDIT 2 (today opening the project again, the order is correct)

Correct order:

I suspected that if I added new target points, the problem would come back, but that was not what happened.

Again the order is correct:

Even so, I'd like you to tell me if there is any way to know all the elements of an array, and thus be able to treat, set, and order them. For this problem may occur again at some crucial moment.

sentences:
Unity3d Transform.position float range I thought floating point has a very large range, for example up to 3.4*10^38.
However today I tried to set my player's Transform.position.x to 1000000 in the GUI and it gave me a warning:

  "Due to floating-point precision limitations, it is recommended to bring the world coordinates of the GameObject within a smaller range."

Does that mean that my single scene has to be smaller than 1000000*1000000*1000000. Is this considered big enough? I will need multiple scenes if I want a larger world? When a new scene gets loaded, will my player's position be reseted? How do I manage the position data so that it doesn't go out of range?

I'm using Unity3D Pro.

sentences:
Why does Assimp appear to be loading vertices in the incorrect order in this code? I'm getting a weird bug in my code that is reading in the vertices from an .obj file.

The .obj file is just a cube, hence there are eight vertices. When I print out the vector it seems to work perfectly up until the 5th vertex, and then it seems to read the last 3 backwards.

This is the file:

# Blender v2.69 (sub 0) OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v 2.000000 -2.000000 -2.000000
v 3.000000 -3.000000 3.000000
v -4.000000 -4.000000 4.000000
v -5.000000 -5.000000 -5.000000
v 6.000000 6.000000 -6.000000
v 7.999999 7.000000 7.000001
v -8.000000 8.000000 8.000000
v -9.000000 9.000000 -9.000000
usemtl Material
s off
f 1 2 3 4
f 5 8 7 6
f 1 5 6 2
f 2 6 7 3
f 3 7 8 4
f 5 1 4 8

This is my code:

m->vertices = new glm::vec3[m->numVertices];
for (GLuint i = 0 ; i < m->numVertices ; i++) {
    const aiVector3D* pPos = &(mesh->mVertices[i]);
    m->vertices[i] = glm::vec3 (pPos->x, pPos->y, pPos->z);
    std::cout << "X:" << m->vertices[i].operator[](0) << " Y:" << m->vertices[i].operator[](1) << " Z:" << m->vertices[i].operator[](2) << std::endl;
}

However this is what is stored in the vector (what the above code prints out):

X:2 Y:-2 Z:-2
X:3 Y:-3 Z:3
X:-4 Y:-4 Z:4
X:-5 Y:-5 Z:-5
X:6 Y:6 Z:-6
X:-9 Y:9 Z:-9
X:-8 Y:8 Z:8
X:8 Y:7 Z:7

As you can see the last three lines are messed up, I have no idea how this is happening in the loop.

sentences:
Newbie game programmer - Where do I start? Okay, so I have been really inclined towards game programming this past few weeks. I have primarily been a web programmer and know a fair number of lanugages like PHP, Java, javascript, python, etc. I also know a little bit of C++ as I heard that it's used heavily in the game industry. I have no experience in game development, but I am a fast learner.(I am 15 so I guess I still have a lot of time.)

So, is there any language I should learn to develop 2d and 3d games? Also which IDE(free) is a nice place to start compiling your ideas(something like Polycode:-  http://polycode.org/). I looked up Polycode but it was a little confusing for me to build it. I have a fair idea about what DirectX, OpenGL, SDL and shaders are but I have absolutely no clue about programming them. I know it's a little early to start jumping into this stuff already but you gotta start somewhere right? Please help me as I really want to get into serious game programming. Thanks!

I am running Windows 8 Pro 32 bit. Please suggest me any software accordingly!

sentences:
using lua in kobold2d to control parameters Is there a tutorial on using LUA in Kobold2d?

I want to know if its possible to use it to control the game behavior (like max speed decrease of timer, and bonus points) by uploading a new script to the app.

I found this link in the FAQ:

http://www.kobold2d.com/pages/viewpage.action?pageId=917888

but it does not mention if I can replace the lua script from within the game, and reload it, is that possible?  Should i just have a parameter file instead that i can download and replace?

sentences:
More than 8 lights without deferred shading / lighting I want to know if there is any technique (efficient) to use more than 8 lights in a scene made with OpenGL and GLSL. Without making use of deferred shading / lighting.

I have not implementadon these techniques for their limitations and not being able to use transparency or antialiasing.

If there is a good alternative, describe it with an example.

I use OpenGL 2.0.

Thank you.

sentences:
How many views can be bound to a 2D texture at a time? I am a newbie trying to learn on DX11.x. While reading about resources and views in MSDN, I thought this question
For a given 2D Texture created with ID3D11Texture2Dinterface (or for that matter any kind of resource), how many of following views can be bound to it?

1) DepthStencilView
 2) RenderTargetView
 3) ShaderResourceView
 4) UnorderedAccessView

Thanks in advance.
PS: I know the answer would be app specific, but still any insight into this would be helpful.

sentences:
How to move my cube left or right using touch Inputs (C#) in unity I am trying to create a 3d game in unity. I have a cube in unity and I want it to move left or right on swipe . It should move to a distance till where user swipe or take their finger off of a screen. I want it to move fast or the cube should move fast on swipe and cube should flow smooth. Like in the gif there is a circle and the user use their finger to move the circle till wherever the user swipe it and it should be instant and I want my cube to move like that at a distance till where user swipe their finger and it should be instant and fast.
 I don't know how to do it. Any help is appreciated!

sentences:
Picking random monster cards from a deck What is the best way to go about making user defined classes (monsters, items, loot, armor, weapons, spell types, etc) and then calling them later during an encounter? Looking at the entire card list for a trading card game is intimidating, and I would love some advice on tackling this before I go about it the wrong way.

class Card(object):
def __init__(self, name, value, type, power):
    self.name = name
    self.value = value
    self.type = type
    self.power = power
    self.expan = 'Base'

class Monster(Card):
def __init__(self, name, value, type, power):
    self.active = False
    Card.__init__(self, name, value, type, power)
    #monsterlist.append((self.name, self.value, self.type, self.power))

Is it ideal to just make a random number and create the monster like this (there's over a thousand cards, so this doesn't seem optimal to me):

def pickMonster():
    chance = random.randint(1,2)
    if chance == 1:
        goblin = Monster('goblin', 8, 'animal', 'run')
    if chance = 2:
        troll == Monster('troll', 8, 'troll', 'smash')

Can I define monsters in a list/dictionary somehow and pull them at random from there?  I was trying to use this method to make the code easier to read, but I'm having a hard time figuring out exactly how to do it that way (as I'm not even sure it's possible to put more than 2 values into a list, and dictionaries are the bane of my existence -- I'm fairly new to python).

sentences:
cocos2d-x v2.1 CCSpeed, CCRepeatForever, and CCAnimation jerky at high speed I worked to port Tim Roadley's cocos2d-iphone example from (Box2D Driven Cocos2D Animation) to cocos2d-x to learn cocos2d-x for a project. It is all relatively simple to do, but I am suffering from one obstinate problem. When the ball speeds up, the animation gets very jerky. This problem does not exist in Tim's cocos2d example.

From my investigation and close watching of the animation, it skips frames at the end of the animation sequence when the speed is high (above 4 or 5 in my code).

Here is Tim's original code and some context:

// LOAD ANIMATION FRAMES FROM SPRITESHEET
NSMutableArray *rollFrames = [NSMutableArray array];
for(int i = 1; i <= 120; ++i) {
    [rollFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"Ball%i.png", i]]];
}

// CREATE ANIMATION ACTION
speedAction = [CCSpeed actionWithAction:
              [CCRepeatForever actionWithAction:
              [CCAnimate actionWithAnimation:
              [CCAnimation animationWithFrames:rollFrames delay:0.1]]] speed:3.5];

// CREATE BALL SPRITE
ball = [TRBox2D spriteWithSpriteFrameName:@"Ball1.png"];
[ball setPosition:ccp((screenSize.width/2), (screenSize.height/2))];
original = ball.position;  // used to determine ball trajectory
[ball runAction:speedAction];
[ball setTag:isTheBall];  // used so we can pick out this sprite during the physics loop
[ball setScale:0.7];

Here is my translation, again with some context:

// LOAD ANIMATION FRAMES FROM SPRITESHEET
CCArray *spriteFrames = CCArray::create();
for (int i = 1; i <= 120; i++) {
    std::stringstream spriteName;
    spriteName << "Ball" << i << ".png";

    CCSpriteFrame *spriteFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(spriteName.str().c_str());
    spriteFrames->addObject(spriteFrame);
}

CCAnimation *animation = CCAnimation::createWithSpriteFrames(spriteFrames, 0.1);
CCAnimate *animate = CCAnimate::create(animation);
CCRepeatForever *repeat = CCRepeatForever::create(animate);
speedAction = CCSpeed::create(repeat, 3.5f);

spriteFrames->release();

// CREATE BALL SPRITE
ball = (PhysicsSprite *)PhysicsSprite::createWithSpriteFrameName("Ball1.png");
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
ball->setPosition(ccp((screenSize.width/2), (screenSize.height/2)));
original = ball->getPosition();

ball->runAction(speedAction);

ball->setTag(1);
ball->setScale(0.7f);

Tim's example uses COCOS2D_VERSION==0x00010001 (v1.0.1)
I am using COCOS2D_VERSION==0x00020100 (v2.1.0)

I dug through the CCSpeed, CCRepeatForever, and CCAnimate. The major difference I find is in CCActionInterval.cpp where CCAnimate was changed to use "new animation format that supports delays per frame" (commit d0ab4515a4736bdf31aaed6394d95f8ea02beea1). If I revert this change to the previous "animation format" which does not support delays per frame, the sprite animates flawlessly at higher speeds.

Now to my question, am I mis-interpreting how the animation actions are intended to work in cocos2d-x 2.1? Have I missed something that is causing my jerky animation? It does not seem like changing some of the core code is the right answer, though bugs do exist.

sentences:
What's the best way to index my object? Obviously, lists automatically create their own index. So basically I wouldn't need this function at all. But I figured it was safer in case my list index ever changed (e.g. adding a new item at the beginning of the list, would shift the index numbers for all the other list items).

public EmpireAgentView ShowEmpireView(int eIndex)
{

    foreach (EmpireAgentView e in EmpireViews)
    {
        if (e.EmpireIndex == eIndex)
        {
            Debug.Log("Showing Empire for Agent: " + e.AgentName);
            return e;
        }
    }

    Debug.LogError("No EmpireAgentView Found for that empire: " + eIndex);
    return new EmpireAgentView(9999);
}

So in this case, I added the property "EmpireIndex" to the EmpireAgentView object. So now, whenever I need to access a specific EmpireAgentView from the EmpireViews list, I would use ShowEmpireView(1) instead of EmpireViews[1].

Each EmpireAgentView object has unique information about the same Agent object. For example, where the Agent is currently located. If we have 4 empires, than there will be 4 EmpireAgentView objects in the Agent class. Each empire has their own idea of where the Agent is currently located, so I need to be able to access the specific empires data on this agent. Right now, I assign a simple int called EmpireIndex to each EmpireAgentView, so that I can make sure I got the right view for the right empire. If i simply used EmpireViews[3], and that list rearranged itself somehow, (like adding an EmpireAgentView object to the beginning of the list, presumably) than all that information would be mixed up for the empires.

Is that the best way of doing that? is there a better way of finding it? Or am I being TOO careful, and just need to not add new EmpireView's to the beginning of the list? (I'm new to C#, is there anything else that would change the index of a list item?)

sentences:
SharpDX (DirectX) - possible to measure Frame time? I'm trying to benchmark various ways to draw 2D lines and have a snag. A D3D10Device that I draw with (and flush) doesn't appear to block, so I can't accurately measure frame rate (or time to render 1 frame).

Here's some code

    // Inside my custom render context - at end of setting up draw calls
    public void Dispose()
    {
        {
            _vertexBufferStream.Close();

            _direct3D10Image._d3d10Buffer.Unmap();

            // Vertex buffer contains LineList with 200k vertices
            _direct3D10Image._d3d10Device.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(_direct3D10Image._d3d10Buffer, 32, 0));

            int targetWidth = _direct3D10Image._renderTargetTexture2D.Description.Width;
            int targetHeight = _direct3D10Image._renderTargetTexture2D.Description.Height;
            _direct3D10Image._d3d10Device.OutputMerger.SetTargets(_direct3D10Image.DepthStencilView, _direct3D10Image.RenderTargetView);
            _direct3D10Image._d3d10Device.Rasterizer.SetViewports(new SharpDX.Direct3D10.Viewport(0, 0, targetWidth, targetHeight, 0.0f, 1.0f));
            _direct3D10Image._d3d10Device.ClearRenderTargetView(_direct3D10Image.RenderTargetView, _direct3D10Image.ClearColor);
            _direct3D10Image._d3d10Device.ClearDepthStencilView(_direct3D10Image.DepthStencilView, DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);

            // Shader is generating geometry based on line-list to render a 2D plot
            for (int i = 0; i < _direct3D10Image._technique.Description.PassCount; i++)
            {
                _direct3D10Image._pass.Apply();
                _direct3D10Image._d3d10Device.Draw(
                    (int)(_linesCount * 2),
                    0);
            }
        }

        // Flush doesn't appear to block - how to get meaningful time to draw out of SharpDX?
        _direct3D10Image._d3d10Device.Flush();
        _direct3D10Image._dx10ImageSource.InvalidateD3DImage();
    }

Now if I time the setup of draw calls and the Dispose method above, it reports 15ms to draw. However, there appears to be a significant lag between start of draw and the screen actually presenting.

How can I measure the time to present (or is it possible to make D3D10Device.Flush() blocking?)

sentences:
Efficient movement of units to different points with different speeds I have a series of units and have been given 2d points that they must go to. However they are free to go to what point they like as long as all the units get to all the points  in the quickest time possible. Each unit has its own speed.

What is the best algorithm if I ignore unit collisions and terrain is perfectly flat with no obstacles.

sentences:
Camera with zoom that follows the player in javascript I'm passing the time programming a little game in javascript, I've done what I'm trying this in several in game engine. And what I'm trying to do is generate the world while the player walks around the map. Using engines like unity and godot, I have always had the facilities to deal with the camera and the scene. Now with pure javascript I'm kind of not knowing where to go.

Come on, what I have so far:

A world generated by 2D noise and my character in it can move with the keys of the keyboard. What I want to do now is that when walking he generate the world and also the camera accompany him. And that with the scroll of the mouse I can take the camera to a bigger zoom so that I can better visualize the generated world.

So there are 3 questions I have:

1 - How to create a camera that will follow the player, already thinking about the best way to make the world be generated when walking the player.

2 - How to generate the world while he walks (This I believe I can do.)

3 - How to zoom in with the mouse scroll?

sentences:
Creating a single GUI Text with Fade-In I have this line of code

void Update () {

    float alVal = 0.0f;
    float damping = 1f;
    alVal += damping * Time.time;
    GameObject text2 = new GameObject();

    text2.AddComponent (typeof(GUIText));
    text2.guiText.color = new Color (1f,1f,1f);
    text2.guiText.name = "name";
    text2.guiText.text = "YOLOMF";
    text2.guiText.pixelOffset = new Vector2 (100, 100);

    text2.guiText.color = new Color(1f,1f,1f,alVal);

    Debug.Log (alVal);

}

I want to create a SINGLE TEXT, but I guess the Update() function keeps on making more.

I need that SINGLE TEXT to do an animation of Fade-In that's why it is in Update()

sentences:
Enable IME in a non-windows control I'm writing my own game in DirectX using C#. I'm at the point where I'm implementing my own textbox, written from scratch. It has the very basic functions for now, but works well. I want, however, to be able to input non-English text using Microsoft's IME (such as Japanese or Korean).

I've spent quite a lot of time looking for tutorials and documentations. I found a lot of functions (mainly contained in imm32.dll), but I can't really figure out how to make them work in order to make the input work:

my problem is that I can't use the IME inside my own textbox (contained in the DirectX Window form) as it is disabled. How do I tell the IME that my textbox can get input from keyboard and therefore get the IME enabled? Is there any method I should call?

I already tried stuff like ImmGetContext() and ImmAssociateContext(), using my window form as handle, but with no real results.

sentences:
Fixed timestep without physics? I read Gaffer's Fix Your Timestep article many years ago, and have since had the impression that game code should have a fixed timestep, with only non-gameplay related tasks outside of that in the main loop.

However, I recently reread the article, along with several others, and realized the emphasis is on physics. Which makes sense, but now I'm wondering if it only applies to physics.

What about games which don't use a real physics simulation? People talk about 60fps games, doesn't that imply a fixed timestep? What about multiplayer where you have regular updates to and from the server?

The only alternative I know of is variable rate with time delta, but that sounds like it wouldn't be any better, and less exact. What method is typically used?

sentences:
Exporting 3DS Max animated biped character into Assimp I've been having some trouble with MD5 meshes exported from 3DS Max into my C++ program, using Assimp to import the model and its skeletal animation.  If the models were rigged manually with bones, the export and animations work perfectly, but if they were rigged as a biped character, the animation hits a "deadly import error" and all the bones appear to get smooshed together into a big pile.  This seems like it might just be a limitation of the MD5 exporter (we're currently using the one found here.

Our plan is to try out a different MD5 exporter (this one), and if that still has problems, then try switching from MD5 to COLLADA.

Our modeler won't be able to make time to try out these other exporters for a few days, so in the meantime I wanted to see if there were any better methods out there for getting biped rigged models from 3DS Max into our app via Assimp.  Out of Assimp's supported formats, I need to figure out which will support the following:

Skeletal animations
Exportable from 3DS Max biped rigged models

Failing that, an alternative would be a way to convert a biped character to its corresponding bones before exporting.  We did find one script to do that, but it only seems meant as a starting point for modeling -- it doesn't carry over any hierarchy, skinning, or animation -- so it can't be used solely during export.

sentences:
What are the parameters for a smooth wall jump I want to make a platformer like Celeste and trying to implement wall jump.
When the player is on the air and near a wall, and presses jump, the player gains x velocity opposite the wall direction, and some y velocity. So the player jumps against the wall, but it shouldn't climb the wall thru wall jumping.
Game runs 60 frames per second. resolution is 320x180. Tile size is 16.
Here's some constants for calculating velocity and gravity:
export const vMax = 4; // maximum velocity in pixels
export const tMax = 20; // time to reach maximum velocity in frames

export const hMax = 16 * 3; // maximum jump height
export const xSubH = 16 * 3; // x distance that is reached in one jump

export const xFriction = 5 / tMax;  // friction to apply to x velocity
export const hAccel = vMax * xFriction; // accelaration for x

export const v0Jump = (2 * hMax) * vMax / xSubH; // initial jump velocity
export const gJump = - (2 * hMax * vMax * vMax) /
      (xSubH * xSubH); // gravity applied to y velocity on jump

Here's how I do wall jump:
 // player object
 let p = {
   x: 0, // position
   y: 0,
   dx: 0, // velocity
   dy: 0,
   ax: 0, // acceleration
   ay: 0
 };

 // let inputX = -1 for left input 1 for right input

 // x movement
 let _hAccel = inputX * hAccel;
 p.dx += _hAccel;
 p.dx += - p.dx * xFriction;

 // let isGrounded = ...
 // let wallDir = ... // -1 for left wall 1 for right wall

 // fall
 if (!isGrounded) {
   p.ay = -gJump;
 }

 // jump
 p.ay = -gJump;
 p.dy = -v0Jump;

 // wall jump
 p.dy = -v0Jump;
 p.dx = - wallDir * hAccel;

 p.dy += p.ay;

 // position
 p.x += p.dy;
 p.y += p.dx;

What are the parameters of the wall jump I need to control and tweak so it looks smooth and doesn't allow player to climb up the wall. But player can climb two walls side by side jumping one off another vs.
As you can see I have parameters like vMax and tMax that I can tweak to control the jump and movement. I tried setting arbitrary fractions of current values to give more x velocity or y velocity for wall jumping, but I can't quite get a wall jump that feels good to climb against two walls.
If you look at the Celeste Pico 8 source code:
  if (E.abs(spd.X) > maxrun)
        spd.X = G.appr(spd.X, E.sign(spd.X) * maxrun, deccel);
    else
        spd.X = G.appr(spd.X, input * maxrun, accel);

When the x velocity is greater than maxrun, it is decelarated towards maxrun, otherwise it is decelarated towards input. So this basically disables input when given a big x velocity, thus disallowing to approach the wall thru input.

sentences:
How do I wrap an image around a sphere? Ideally I'd like a reference of the math involved, so I can start breaking down the problem.

The simplest thing I can deduce about this problem is that the part of the sphere that the user is currently seeing is a circle on the image that is located somewhere on the image, and the rest of the coordinates on the image are somehow mapped to 3D with a linear transformation.

Consider the following example:

If I rotate the sphere theta degrees on the Y axis (up/down) to the left, the sun will come close to the center of the sphere and the tree that is currently positioned in the center will be shifted to the left as the three on the left currently is. You can consider that the volume of the image is exactly enough to have the image completely wrap the sphere.

sentences:
What causes undefined geometry to be drawn? I am currently using the polygonSpriteBatch of libgdx to draw triangles, rectangles and a concave polygon as border. After adding the concave polygon for the colored borders everything seems to break and random geometry appears (sometimes even with a gradient).

Some Examples

Here you can see on the left everything looks good and after drawing the additional rectangle with its border and removing the other borders you can still see some weird red regions.

This is even more extreme. On the left part of the concave polygon is drawn with a different color, and after it despawns (on the right) there is still part of it left and other triangles not created by me are drawn.

I am quite confident that all convex polygons are defined in counter-clockwise ordering.

In the past I had trouble with providing the correct TextureRegion and it still doesn't feel like my current implementation is how it should be, but it worked for simple rectangles and triangles. Currently I have a (3px)*(3px) Region and all polygon vertices are between (0f,0f) and (3f,3f).

Because I define all triangles of the polygons myself the short array given to the PolygonRegion for a rectangle looks like this: (0, 1, 2, 3, 4, 5) and the corresponding Vector2 polygon array like this: ((0.0, 3.0), (0.0, 0.0), (3.0, 0.0), (0.0, 3.0), (3.0, 0.0), (3.0, 3.0))

I experienced even more artifacts when executing this on android and for some reason drawing a small rectangle for each vertice (for debugging) fixed some of the artifacts above.

This is quite a complex problem but I hope somebody knows what could cause such a behaviour.

sentences:
Project collision shapes to plane for 2.5D collision detection I am working on a top down 2.5D game. In the game anything that overlaps on the screen should be 'colliding' with each other regardless of whether they are on the same plane in the 3D world. This is illustrated below from a side-ways view:

The orange and green circles are spheres floating in the 3D world. They are projected onto a plane parallel to the viewport plane (y = 0 in the image) and if they overlap there is a collision event between them. These spheres are attached to other meshes to represent the sphere bounding boxes for collisions.

The way I plan to implement this at the moment is the following:

Get the 3D world position at the center of the sphere.
Use Camera.WorldToViewportPoint to project the point to the viewport plane.
Move a Sphere Collider with the radius of the sphere to that point.
Test for collisions using unity colliders.

My question is how to extend this to work for rotated cuboids. For instance if I have two rotated cuboids, if I follow the logic above it would not work as intended as the cuboids may not collide but they could still be intersected on the view plane. An example is below:

In the example above the cuboids are overlapping from the view of the player, but not colliding when they should be.

Is there a way to project a cuboid that would be aligned with the plane? Would it be a valid cuboid for all rotations if I did this?

EDIT: Corrected the images, before they were incorrectly projecting onto the y=0 plane at 0 rotation, not the plane parallel to the viewport plane.

sentences:
2D platformer multiple rectangle collision cause jitter I posted this question two weeks ago: 2D platformer corner collision and I implemented NoobsArePeople2's solution.

Problem is, when player intersects two rectangles that are inside each other, he starts jittering. I don't know how to describe it so I made a video: http://www.youtube.com/watch?v=2AYUGeuxM0c

In the first 4 or so seconds, you can see that when he collides with two rectangles that arent in each other or touching each other, everything works fine, but in the rest of the video, you can see that when player touches side, he starts to jitter (please note that because of fraps, my game was running at quarter of FPS I normaly have, so without fraps the jitter is much faster)

To give you idea how my collision rectangles look now, here is debug mode (each rectangle is randomly colored)

I have couple of algortihms in place that merge rectangles into one (still need to do some work on that), but some simply cannot be merged. One example is the C object on the right. Right now it is made of 7 rectangles (will be 3 after I complete my algorithm) and when player slides on side of it, he starts to jitter.

I suspect problem is in my gravity, but Im not sure. I've spent 5 days on trying to fix this and Im lost.

Heres my code (slighty modified from platformer sample):

        for (int i = 0; i < playerCollisionRectangles.Count; i++)
        {
            Vector2 depth = Collision.GetIntersectionDepth(player.PlayerRectangleInWorld, playerCollisionRectangles[i]);
            if (depth != Vector2.Zero)
            {
                float absDepthX = Math.Abs(depth.X);
                float absDepthY = Math.Abs(depth.Y);

                // Resolve the collision along the shallow axis.
                if (absDepthY < absDepthX)
                {
                    // Resolve the collision along the Y axis.
                    player.PlayerPositionY += Convert.ToInt32(depth.Y);
                }
                else
                {
                    // Resolve the collision along the X axis.
                    player.PlayerPositionX += Convert.ToInt32(depth.X);
                }
            }
        }

And here is my gravity code (very very simple):

        if (Gravity)
        {
            //for camera
            position.Y += 2;
            //position in world
            playerPositionY += 2;
        }

And lastly here is one of my methods to move player (i have similiar methods to move him left and up):

    public void MoveRight()
    {
        animate.Enabled = true;
        animate.Row = 0;
        position.X += speed;
        playerPositionX += speed;
    }

sentences: How would I write a shader that supports 2 different texture coordinates? Hi I am not very good with writing shaders. How would I make a shader that simply supports 2 texture coordinates so I can load up 2 different textures to be used at the same time but on different parts of my world? Right now I have 1 texturecoord variable setup and I load a texture through it using GraphicsDevice->SetTexture(0, &Texture); and making sure my VertexDeclaration and FVF both support that, but how can I add a second texture to this? Would I make it so that I make separate coordinates and link the coordinates to a texture? How would I write that?

sentences:
Lua or C++ in Cococ2d-x I am going to use Cocos2d-x to make a game for Android and ios, but my question is, do I use the Lua integration or only c++, I see Lua useful here because the compilation thing.

Or do I use only Lua for the configuration, save data and things in runtime?

I don´t know if using Lua for the whole game is the right thing :/

Can anyone help me with this question and why use it or not?

Thanks

sentences:
Match Making Groups of Players Given a situation where I have a pool of X people of different scores (ranks) S with game size N. How do I partition the pool into N sized games where the standard deviation of ranks for each games is minimized?

(quality of the game is inversely proportional to STD of ranks)

sentences:
Why do most video game guns reload without losing unused ammo in the magazine? If I have picked up 500 spare ammo and I 73/100 bullets in my current gun, why will I end up with 473 spare ammo instead of 400 (losing the 73 unused rounds in the previous magazine)?

Is this just to make it easier on the player?

I want to make a challenge shooting game and it seems like timing your reloads would be interesting.

Is there any reason I should stick to the norm?

sentences:
Ease out elastic function with equivalent start and end values? I have an elastic ease out function, formula in code:

float easeOutElastic(float t, float b, float c, float d) {
    float ts = (t/=d) * t;
    float tc = ts*t;
    return b+c*(33*tc*ts + -106*ts*ts + 126*tc + -67*ts + 15*t);
}

Taken from here, the elastic out small variant:
http://www.timotheegroleau.com/Flash/experiments/easing_function_generator.htm

I'm trying to modify the function so that the start and end values are equivalent. Essentially the red line.

I am not sure which of the parameters to modify to achieve this. Is anyone familiar with this particular easing function that could provide some guidance?

My goal is to use this function on the scaleY param of a rectangle I'm animating. I think this would provide a nice stretch/squash animation, where the rectangle returns to its original size at the end of the animation.

Thank you

sentences:
What are the advantages and disadvantages of using pointers to change data in my physics engine? I am working on an entity-component system, and I am thinking about this communication protocol:

The physics component of a game object sends an UpdateMyState message, with its state attached.
The physics engine receives this.
The physics component sends a pointer to its data, and the physics engine changes the state. Because it is a pointer, no messaging back is required.

The standard way involves the physics engine sending back an UpdatedState message, with the new state attached. This will be processed by the physics component. I am not sure if my way is a good exercise. It is not a complete message-based system, but it decreases the amount of required messages, and it simplifies the system.

What are the advantages and disadvantages of using pointers to change data in my physics engine?

sentences: What happens to allocated video memory when the program terminates? Using OpenGL it is possible to load textures, buffer arrays, compiled shaders and more to the video memory. When a C++ program exits, heap memory that was allocated by it is cleaned. What happens to the stuff allocated on the video memory? Will memory leak beyond program's scope?

sentences:
Game Trailer Reference other Games I am currently developing a game that pulls in the basic ideas and concepts from 3 other games.
I want to make a trailer, and can I put in the trailer something like this:

  Pulling Game Concepts from:   ...Pokemon   ...Fable   ...and Harvest
  Moon

Can i do this? Or would I have to get permission to even reference them?

sentences:
cocos2d-x - object creation and management in game design How do others keep track of everything going on in their games? I am working on a new game and I am quickly realizing everything that I need to keep track of.

Example:

Maybe a layerManager that keeps track of all the layers and what is happening for a particular scene.

Maybe a sceneManager for sharing objects among scenes

But then getting to game play itself, what if you have 100 objects on the screen each with its own state and happenings, there needs tobe a way to keep track of all of that.

Drawing everything out is really helping me.

Can anyone share with me how they go about object tracking/management? I am seeing a few different managers and then maybe even a parent object that manages the managers..is my thinking way off?

Any design patterns that may be useful for me to read about?

Update: doing some reading and maybe a Factory pattern might apply.

sentences:
In a component/entity system, what's the correct way to implement entity-specific components? I'm trying to create a basic C/E game engine for Android, and I'm trying to re-create pong as a basic warm-up. I currently have a EntityManager class that contains a list of all the UUIDs for its Entities, and has a render() function that calls render() on all Components that implement RenderableComponent (a basic interface with a render() function itself), and the same for update().

Stop me if I'm already doing something incorrectly...

My question is, should I be creating specific components that only apply to each entity? (E.g. a BallMovement, BallDraw, etc. component for the ball) or what is the correct way to create components for Entities?

Thanks in advance! (:

sentences:
Procedural... house with rooms generator I've been looking at some algorithms and articles about procedurally generating a dungeon. The problem is, I'm trying to generate a house with rooms, and they don't seem to fit my requirements.

For one, dungeons have corridors, where houses have halls. And while initially they might seem the same, a hall is nothing more than the area that isn't a room, whereas a corridor is specifically designed to connect one area to another.

Another important difference with a house is that you have a specific width and height, and you have to fill the entire thing with rooms and halls, whereas with a dungeon, there is empty space.

I think halls in a house is something in between a dungeon corridor (gets you to other rooms) and an empty space in the dungeon (it's not explicitly defined in code).

More specifically, the requirements are:

There is a set of predefined rooms
I cannot create walls and doors on the fly.
Rooms can be rotated but not resized
Again, because I have a predefined set of rooms, I can only rotate them, not resize them.
The house dimensions are set and has to be entirely filled with rooms (or halls)
I.e. I want to fill a 14x20 house with the available rooms making sure there is no empty space.

Here are some images to make this a little more clear:

As you can see, in the house, the "empty space" is still walkable and it gets you from one room to another.

So, having said all this, maybe a house is just a really really tightly packed dungeon with corridors. Or it's something easier than a dungeon. Maybe there is something out there and I haven't found it because I don't really know what to search for.

This is where I'd like your help: could you give me pointers on how to design this algorithm? Any thoughts on what steps it will take? If you have created a dungeon generator, how would you modify it to fit my requirements? You can be as specific or as generic as you like. I'm looking to pick your brains, really.

sentences: Problems setting up dx12 I'm following the Frank Luna directX12 book, I have installed the windows 10 SDK etc but now, when I compile any project from his demo they wont build. Error I am getting is Cannot open source file  which I have never had a problem including before I installed windows 10 SDK, any suggestions? If any more info is needed let me know

sentences:
OpenGL to DIRECTX RayCasting and Picking Im doing some ray casting and picking from a book that is Open GL. I Get perfect movement on the x and y(I rotated the grid 90 so it would match the x and y. Buy when I try to put it on the the z axis, it is not right

How can I  get this to work in a left handed coordinate system in directx 11?

Here is my code, maybe somneone can help out.

GetPickRay( float sx, float sy, float fov, float width, float height )//sx-sy window coordinates, fov fieldofview, width height size of window
{
    //view cords from NDC,SCREEN
   float vx = (+2.0f*(float)sx/(float) mClientWidth - 1.0f)/P(0,0); //P is projection matrix
    float vy = (-2.0f*(float)sy/(float) mClientHeight + 1.0f)/P(1,1);

    XMFLOAT3 viewPoint2(vx,vy,1.0f);
    XMVECTOR viewPoint = XMLoadFloat3(&viewPoint2);
    XMMATRIX invView = XMMatrixInverse(&XMMatrixDeterminant(V), V);
    XMVECTOR T = XMVector3Transform(viewPoint,invView);

    return T - EYEPOINT;
}

    OnMouseDown(WPARAM btnState, int x, int y)
{
    mLastMousePos.x = x;
    mLastMousePos.y = y;

    XMVECTOR ray = GetPickRay( (float) x, (float) y, 45.0f,(float) mClientWidth,(float)mClientHeight );

    XMFLOAT3 ra;
    XMStoreFloat3(&ra,ray);
    XMFLOAT3 EyePoint;
    XMStoreFloat3(&EyePoint,EYEPOINT);
        // compute intersection with z=0 plane
        float t = -EyePoint.z/ra.z;
        XMVECTOR tt = EYEPOINT + t*ray;
        XMFLOAT3 d;
        XMStoreFloat3(&d,tt);
        moveIT = XMMatrixTranslation(d.x,d.y,d.z);

My up vector for the view matrix is 0,1,0

Thx if someone could point me in the right direction

sentences:
Unity: Apply an Image Effect on one layer only Please consider this simple scene.

It’s composed of 3 different game objects. 1 background image + 1 static character image + 1 small part (with the pet) that is changed at runtime to perform an animation.

The Background is rendered using a dedicated camera. The character (static + anim) is rendered using another dedicated camera. Both camera are set to Depth Only with a different culling mask (each camera renders only its part). Note that the camera in charge of the character has a greater depth than the one in charge of the background (i.e. Character is rendered after the background).

I need to apply an image effect only on the character camera, but I can’t manage to find a way for this effect to not affect the background.

Example here with a Vortex effect on the character camera.

How would you do such a trick?

sentences:
Calculating distance in procedurally generated mesh LOD system I'm creating a procedurally generated planet mesh based on quadtree splitting to support LOD system. I cannot find any relevant info how can I calculate distance between the camera and LOD chunks.
I have a surface view in my game where the camera is near at the planet surface and can move around the planet, it has also some zoom levels (elevation of the camera) but camera always looks in the direction to the surface like in strategy games.
A: Should I use simple distance calculation between the camera and the center of the chunk mesh or edge vertices of the mesh?
B: Is it better when I use Great-circle distance?
C: How should I modify the calculation when camera's elevation can be changed?
D: How can I determine the distance limits for each LOD level? Does it depend on the project or does it have some basics?
Update #1:
Here is a sample when I use simple distance calculation between the center vertex of the meshes and the camera object:

the camera is right above the point A
point A is the center of the level 0 mesh (it is not visible because it is already divided)
when the camera reaches the distance limit of B (which is a level 1 mesh and it is already divided in the sample) then it will be divided into four meshes where the centers are C, D, E, F
at this time the mesh where the center point is F will be also divided because the distance of the previously generated F point is under the current LOD level minimum distance

So the base problem this: after dividing a mesh the new submeshes can be also divided because the distance is under the current LOD level minimum distance. And I think it does not work like a normal LOD system because there is a level 1 neighbour next to level 3 mesh.

Update #2:
I tried some approaches to get the right distance calculation:

minimum distance between the corner edges (4) and the camera
minimum distance between the edge center vertices (4) and the camera
minimum distance between the corner and edge center vertices (8) and the camera

Important thing: I use great-circle distance calculation.
I got wrong results using these until I created a new algorithm to define transition distance limits. Maybe it is not a very well algorithm but currently this is the most acceptable result. Here is the algorithm:

Note: ignore the heightmap (noise) during the calculation, only a simple sphere with radius R is used

calculate the width of each meshes (arc length)
decrease the distance limit in each LOD level

float meshSphericalWidth = 2 * Mathf.PI * _shapeGenerator.Radius * (90 / (float)(CurrentLevelOfDetail + 1) / 360f);
float currentTransitionLimit = meshSphericalWidth * Mathf.Pow(0.90f, CurrentLevelOfDetail + 1);

After this distance calculation change I didn't notice any significant difference when I use the corner or the edge vertices to get the minimum distance.
And I got this. Green is LOD1, yellow is LOD2 and red is LOD3.

It seems a good progress but we can see sometimes between two chunks the LOD level difference is 2.
Can I fix it with another distance calculation adjustments or is it a different story? I want to solve the cracks between meshes.

sentences:
How to execute a code from many scripts I want to execute a function from many scripts attached on gameobjects  which will be spawned. Since game objects are spawned, I can't assign the script in the inspector. What i want is that, there are three gameobjects, A,B,C. C is already in the scene. A and B are spawned with different scripts,the spawned gameobject's script should call the function on the gameobject C. I can make a delegate but there are different scripts that want to call the function. So should i have to create different delegates for each script on A and B and then assign them onto the gameobject C so that A and B can call their delegates and these delegates will trigger the function on C or there is something like a event that i can call from B. If it was possible, i can create a event on A and assign it on C. Now A can call the delegate and B can also call that event and trigger the function on C, but this is not possible as event can't be called from another script.
I need something like a function that i can call from any script and it calls the function from C.
Note that function should not be static.
As i can call a static function from any script but it can call only static methods, which i don't want.

sentences: How do you create 2D skeletal animations without extra software? I'm working on a Cocos2d-x game and I'm developing on Windows. What I want is to make some skeletal animations, without using a tool or extra software to do so?

sentences:
Aspect ratio of drawn quad messed up after rotating When I draw a quad that is rotating the aspect ratio of the quad gets messed up and the size changes.

Gif of what is happening

I am confident it has something to do with the way I calculate the size because that is relative to the width and height of the screen, I just don't know why the aspect ratio would change since the aspect ratio of the screen doesn't change.

Code of transformationMatrix creation:

        Matrix4f matrix = Maths.createTransformationMatrix(
                new Vector2f(
                        gui.getPosition().getX() / Display.getWidth() * 2 - 1 + gui.getSize().getX() / Display.getWidth(),
                        -gui.getPosition().getY() / Display.getHeight() * 2 + 1 - gui.getSize().getY() / Display.getHeight()
                ), gui.getRotation()
                ,new Vector2f(
                        gui.getSize().getX() / Display.getWidth(),
                        gui.getSize().getY() / Display.getHeight()
                )
        );
        shader.loadTransformation(matrix);

The x size, y size, x position and y position are in pixels, if you put in 1600 pixels for x position and the screen is 1600 pixels wide it will fill the whole screen. The calculation that is done here will translate those sizes to a value that the shaders will display on the screen.

I had tried calculating the sizes in a different way:

gui.getSize().getX() / (float) (Display.getWidth() * Math.abs(Math.cos((Math.toRadians(gui.getRotation())))) + Display.getHeight() * Math.abs(Math.sin((Math.toRadians(gui.getRotation()))))),

but this does not work at all, my thought process was that if it is sideways it should use Display.getHeight to calculate the x size and if it is vertical it should use Display.getWidth. This does work for 0, 90, 180 and 270 degrees rotation, but in between it gets smaller and weird. Of course I've also done this for the x position but then cos and sin switched around.

video of this method

And this is the createTransformationMatrix method:

public static Matrix4f createTransformationMatrix(Vector2f translation, float rotation, Vector2f scale) {
    Matrix4f matrix = new Matrix4f();
    matrix.setIdentity();
    Matrix4f.translate(translation, matrix, matrix);
    Matrix4f.rotate((float) Math.toRadians(rotation), new Vector3f(0, 0, 1), matrix, matrix);
    Matrix4f.scale(new Vector3f(scale.x, scale.y, 1f), matrix, matrix);
    return matrix;
}

sentences:
Joint based destructible physics (like Armadillo Run) I've implemented a destructible terrain system like Worms before (where weapons create holes in the terrain), but for the game I'm designing I want something more like Armadillo Run: https://www.youtube.com/watch?v=4JoPlcyxxb4 where everything is made from individual parts connected by physics joints.

I've figured out how to make a chain of planks using Unity's joints that can fall, swing off each other, bend if unsupported, and break at the joints. But I can't think of how to make planks break instead of the joints. There's an example of what I want at 2:25 in the video, where the plank on the right breaks (not the joints, but the actual plank itself). Obviously I'd just have to destroy the plank object, but how do I decide when to do that?

I'm using the Unity engine (2D physics), but I'd be perfectly happy to implement something myself if someone can direct me to some research on the subject or anything else to help me get started.

sentences:
Maintaining facing direction at the end of a movement I want to make my 2D top-down walking animation stop and revert to the idle animation while continuing to face in the same direction as the previous movement.
For example, when I go up then stop, my character should continue to look up. If I go down, it should continue to look down.
I use lastmoveX and lastmoveY floats for idle and for walking I use moveX and moveY floats. moveX and moveY change when I move with the joystick, but lastmoveX and lastmoveY do not change, and I don't know how to fix this.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    private Rigidbody2D myRB;
    private Animator myAnim;
    public Joystick joystick;
    public MoveByTouch controller;

    [SerializeField]
    private float speed;

    // Use this for initialization
    void Start ()
    {
        myRB = GetComponent<Rigidbody2D>();
        myAnim = GetComponent<Animator>();

    }

    // Update is called once per frame
    void Update ()
    {
        myRB.velocity = new Vector2(joystick.Horizontal, joystick.Vertical) * speed * Time.deltaTime;

        myAnim.SetFloat("moveX", myRB.velocity.x);
        myAnim.SetFloat("moveY", myRB.velocity.y);

        if(joystick.Horizontal == 1 || joystick.Horizontal == -1 || joystick.Vertical == 1 || joystick.Vertical == -1)
        {
            myAnim.SetFloat("lastMoveX", joystick.Horizontal);
            myAnim.SetFloat("lastMoveY", joystick.Vertical);
        }

    }
}

sentences:
How do I detect when an HTML 5 game has ended? I'd like to embed HTML5 games in a website, but I need to be able to detect when the game has ended so I can run some of my own JavaScript.

Looking at the output of some game engines (Construct 2, for example) reveals a nightmare of code that I couldn't hope to tweak so that it fires off an event when done.

How can I detect when a game has ended?

sentences:
How do you set the target location for a navmesh using a GameObject? I am trying to get a GameObject to navigate through a map and get to the exit.  I have created a navmesh for the map and given the player GameObject a navmesh agent. The exit is marked with a empty GameObject. Using the unity manual I made this script and atached it to the player:

function Start ()
{
    var agent: NavMeshAgent = GetComponent.<NavMeshAgent>();
    agent.SetDestination(GameObject.Find("exit"));
}

The porblem is that this script gives the error

"Assets/Scripts/enemy.js(4,29): BCE0017: The best overload for the method 'UnityEngine.NavMeshAgent.SetDestination(UnityEngine.Vector3)' is not compatible with the argument list '(UnityEngine.GameObject)'."

I think is is because unity wants a vector3 but I have given it a GameObject.
How can I get this to work with a game object?

sentences:
Making an RTS game- how to handle player-created units interacting with each other I'm making an RTS game in Unity with C#. However, the interaction I'm going to have with player-created units interacting with other player-created units is what has me stumped. The player and his opponent can purchase units when they have the resources, and it instantiates them in the game. The main thing is checking whether an opponent's unit is within range to attack. Obviously, you can't have every unit asking every other unit what its position is, or it would get exponentially more CPU-consuming the more units are built, right? I'm trying to figure out how I'm going to go about this.

I figured I could have every unit report its position to a sort of master 'tracker', and then every unit could ask the tracker if any opponents' units have a position within X of their own. How I would actually implement this in Unity, though, I'm not sure about.

Moreover, I'm trying to get my head around Instantiated objects. If every unit is telling its position to the master 'tracker', what does it call itself? And let's say a unit asks the tracker if an enemy is in range and one is, what does the tracker tell it so it can locate the right GameObject and attack it? Sorry if I'm talking about it all wrong, I'm sure there's a simple methodology that exists on how to do it, but I can't think of any. Thank you.

sentences:
Using USB sound input for an android game - is it possible? We are brainstorming ideas for an app, for a major project using Android Studio, and writing in java. My major is game development, so I intend on trying to build a video game based off the use of an electric guitar, as input.

While I can set up a means to provide input via the audio-in, through the 3.5mm, having USB input would be far more effective.

My main question is: Is it feasible?

To give background, I believe it must be entirely possible, however, I am unsure how difficult the process would be.

I am basing my question off three things.

If I plug my Xbox controller directly into my phone, it automatically works. So the requirement for local support does not work as strictly as I understood it too.
If I plug the Rocksmith cable into a computer, and tell my sound card to "listen" to it, the guitar automatically comes through the speakers as if I was using the computer as an amplifier. This implies that no software is required on the computer side to interpret the input.
If you set up the electric guitar to connect to the computer via the microphone, it is not only compatible with Rocksmith, but it works just as well. This tells me the USB cable does not do anything fancy, in order to interpret the guitar - it must all be software side.

To start me off, all I really need to do is be able to interpret the frequencies. If I run into brick walls, further on, I will simply build around it, or change my games scope.

In terms of accessibility, I do understand the repercussions of requiring the Rocksmith cable to run the game. However, at the moment, simple being able to use the Rocksmith cable allows me to work on the part I am being marked on. If it goes to plan, I can access a more accessible means to use USB, later.

For those that are not familiar with Rocksmith, for the purpose of this question, it is simply a game that includes an electric guitar to USB cable, and is able to assess the player as they play the guitar, by reading its frequencies to determine what notes are being hit.

sentences:
Collision detection circle-segment-segment I've already implemented collision detection in my game loosely following this tutorial, which works great, but I realized there's one major flaw.
The player and the enemies are circles, while the obstacles can be either segments or polygons or circles.
Now, let's say I have segment A from point (100, 100) to point (300, 100) and segment B from point (100, 200) to point (300, 100), which means they form an acute angle, and player has it center in point (100, 125), with a radius of 25.
If player starts moving right, it will eventually collide against segment B. My method checkCollisions() will return a vector, but if I apply that vector on player, it will be moved up and left, and will overlap segment A.
If I call checkCollisions() a second time, player will be pushed down and collide again with segment B, so recursive invocations aren't a solution. Any ideas?

Here's a picture to explain:
 The g->n vector direction is along the bisector of the two little vectors, but how do I find the length?

sentences:
Why aren't more games 64-bit executables? Until now I've seen that many games are still compiled in 32-bit architecture although nearly 50% of current Windows users are on 64-bit OS? Why is this?

If the reason is for getting larger audience (since 32-bit app could run on 64) why don't they make two versions of it, since it is more or less about recompilation and running 64 bit apps could give performance benefit due to more available CPU registers and other features.

sentences:
Save Script Doesn't Save Item Variables I've been working on an RPG videogame, and I have been trying to implement a Save button into my game, which is supposed to save the player's itemAmount variable, which is in another script, called ItemInformation. I retrieve the itemAmount variable at Start() by getting the script from the itemHolder GameObject. I plan to use this script in multiple GameObjects, because I use the same variable (itemAmount) with different values in different GameObjects. For some reason, I don't receive any errors or warnings in the Console. Here is my script to the Saving System:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public class InventorySave : MonoBehaviour
{
    // Public variables for inventory and health
    private GameObject itemHolder;
    private ItemInformation myItemAmount;

    // Initiates before the first frame
    void Start()
    {
        // Gets components for the player variables
        itemHolder = transform.gameObject;
        myItemAmount = itemHolder.GetComponent<ItemInformation>();
    }

    // Function that will be called when player saves game from pause menu
    public void SaveGame()
    {
        // Creates file to store variables
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/SaveData.dat");
        SaveData data = new SaveData();

        // Gets the player data
        data.itemSave = myItemAmount.itemAmount;

        // Writes player data to file and encrypts it
        bf.Serialize(file, data);
        file.Close();
    }
}

// Holds data that is to be saved
[Serializable]
class SaveData
{
    // Variables for save file
    public int itemSave;
}

sentences:
Instantiated Object returns Null outside Start method I'm attempting to access an instantiated 'goalTemp' GameObject from a different function inside the same script. I'm getting the information in the Start method, assigning the GameObject find/get component script code to a variable. When I'm printing the results outside the Start method, it returns null, even though the 'goal' variable is public.

void Start()
 {
     GameObject goalTemp = (GameObject)Instantiate(goal,respawnGoalLocation[CreateLevel.currentLevel-1],Quaternion.identity);
     goal = goalTemp.gameObject;
 }

public void Explode()
 {
     Debug.Log(goal);
     Instantiate(rockParticle, goal.transform.position, goal.transform.rotation);
     Instantiate(explosionParticle, goal.transform.position, goal.transform.rotation);
 }

What am I doing wrong here? Thanks for your time!

sentences:
Proper use of async, await and task.delay for a game loop I'm currently in the process of making a game loop in a console application. I'm trying to make the game loop wait at the end of its loop for (1000*10000/fps) - ElapsedTicks to put a cap on game loop speed. For reference 1 millisecond is 10,000 ticks.

If the ElapsedTicks < FrameTimeTicks I execute await Task.Delay(FrameTimeTicks - ElapsedTicks) but this ends my console application.

The code responsible is the await Task.Delay so I assume I'm not using it properly.

My code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace ConsoleApp1
{
    class Program
    {
        static byte fps = 30;
        public static byte Fps { get { return fps; } set { fps = value; } }
        //user specified fps

        static long frameTimeTicks = (1000 * 10000) / Fps;
        static long FrameTimeTicks { get { return frameTimeTicks; } }
        //amount of ticks desired in one frame

        static bool draw = true;
        public static bool Draw { get { return draw; } set { draw = value; } }

        static long elapsedTicks;
        static long ElapsedTicks { get { return elapsedTicks; } set { elapsedTicks = value; } }
        //ticks elapsed in one game loop

        static void Main(string[] args)
        {
            GameLoop();
        }

        static void UpdateGame()
        {
            int a = 0;
            a++;
        }
        static void Render()
        {
            Console.WriteLine("@");
        }

        public static async void GameLoop()
        {
            Stopwatch gameLoopTicks = Stopwatch.StartNew();

            while (true)
            {
                gameLoopTicks.Restart();

                if (Console.KeyAvailable == true)
                {
                     char KeyPressed = Console.ReadKey().KeyChar;
                }
                UpdateGame();
                if (Draw == true)
                {
                    Render();
                }
                ElapsedTicks = gameLoopTicks.ElapsedTicks;
                if (ElapsedTicks > FrameTimeTicks)
                {
                    Draw = false;
                }
                else
                {
                    Draw = true;
                    await Task.Delay(TimeSpan.FromTicks(FrameTimeTicks - ElapsedTicks));
                }
            }
        }
    }
}

I Have also tried this variation but to the same result, my console application ends.

public static async void GameLoop()
    {
        Stopwatch gameLoopTicks = Stopwatch.StartNew();
        async Task PauseGameLoop()
        {
            //Console.ReadKey(); execution ends here!
            await Task.Delay(TimeSpan.FromTicks(FrameTimeTicks - ElapsedTicks));
            GameLoop();
        }

        while (true)
        {
            gameLoopTicks.Restart();

            if (Console.KeyAvailable == true)
            {
                 char KeyPressed = Console.ReadKey().KeyChar;
            }
            UpdateGame();
            if (Draw == true)
            {
                Render();
            }
            ElapsedTicks = gameLoopTicks.ElapsedTicks;
            if (ElapsedTicks > FrameTimeTicks)
            {
                Draw = false;
            }
            else
            {
                Draw = true;
                await PauseGameLoop();
            }
        }

Task.Delay MSDN, await MSDN. Am I tackling this problem the wrong way ? This post is why I chose this method. Thanks for the help!

sentences:
why is it faster to draw lots of small arrays than one big array? This application on-line here has interesting performance characteristics:

Sorting the rectangles to be drawn so it keeps having to change colour is faster than sorting the rectangles by their colour and drawing all of each colour at once...

(Timings are printed to Javascript console.  Javascript profiling and understanding what is happening between the emitting of draw ops and the actual rendering of frames is, well, guesswork and disappointment.  But the result is still surprising (to me).)

I'm very interested in the fps logged to the javascript console when run in your browser, and how it differs when sorted by colour vs sorted by z

Now naturally I assume GPU batches are expensive and in my normal apps I get that impression, but I cannot distill a simple test case to show this; quite the opposite, in fact!

Deep in my code, it places all the vertex data interleaved into a single big VBO array.  It then calls glDrawArrays as often as needed.  So drawing a rectangle (6 vertices, each 4 floats) in three colours can be:

Red*1,Blue*1,Red*1 = 3 glDrawArrays calls
Red*2,Blue*1 = 2 glDrawArrays calls, but is slower

I am not sorting, creating, uploading the vertices each frame.  I compute the buffers to draw once.  Each frame, I simply call glDrawArrays as often as needed.

Because I've built this vertex attribute VBO once, and keep reusing it, I have a tight little draw-loop for rendering each frame.  So the Javascript code is doing more work when I have lots of little calls, and less work when I'm emitting concatenated rectangles.

So why is it faster to call glDrawArrays multiple times with small sub-sequences of the array, instead of calling it only a few times and telling it draw long sequences from the array?

Related: there's +500 pts up for grabs over on StackOverflow for the best general discussion about optimising the drawing of a 2D scene.

sentences:
Constant rotation of a revolute joint in box2d I would like to have a line with one end attached to a location and have it rotate constantly (with the same speed) with a maximum of 45 to -45 degrees (i.e. I would like to have it swing like a rope back and forth 90 degrees).

Is this possible or should I use non box2d objects to do this (cheat box2d engine)?

sentences:
LibGDx android : Show animation on button click I am trying to create an application using libgdx where i need an animation to be played on pressing an image button, i've been able to achieve it using this code

   if(slapBossFlag==true) {
        currentFrame = animation.getKeyFrame(timePassed, true);
            batch.begin();
            timePassed += Gdx.graphics.getDeltaTime();
        Gdx.app.log("time","time is"+timePassed);
            batch.draw(currentFrame, screenWidth / 2 - ((currentFrame.getRegionWidth()) / 2), screenHeight / 2 - ((currentFrame.getRegionHeight()) / 2));
            batch.end();
            slapBossFlag = false;
    }

the problem is the animation goes by too quickly.

i've tried setting timePassed to zero when slapBossFlag is false, and that didnt work.

Can anyone help?

sentences:
How do I implement fog of war in a tile-based game? I have created a 2D Tile Based game. The game has a single path that the sprite can move on. I want to create to make the entire screen black except for where the sprite is.

The sprite has commands such as left where he keeps looking left, right where he keeps looking right and move forward where he moves in the direction he is looking. I want to make it such that when he looks left then the tile on the left of the sprites, fog should be removed and so on for all the sides.

How can I do this?

sentences:
recommended shader pipeline infrastructure in core opengl 3.3 I am writing a game project in Go and I am using an OpenGl 3.3 core context to do my rendering stuff. At the moment I have different types of renderers. Each renderer has it's own pair of vertex- and fragment-shader, a struct of uniform- and attribute locations. A struct with glBuffers, vertex-array-object, and numverts (int) which contains all data required to render one object (mesh). Last but not least a constructor to create and initialize the attribute/uniform locations a method to load a mesh into mesh data and the render method itself.

I am absolutely not happy with this design. Every time I want to create a new simple shader, I have to write all this code, and I haven't found a way to make the overhead of a new shader smaller. All I was able to make with the help of go reflections is to automatically get the attribute/uniform location based on the variable name in attribute/uniform location struct and to automatically set the attribute pointers based on the layout of the vertex struct.

another thing that I don't like, is that when I want to implement for example the functionality of the function glClipPlane of the fixed function pipeline, I need to add the uniform to each shader separately and I need to set this uniform in each shader and I need to implement the discard of fragments in each fragment shader

Are there some common practices that significantly reduce the code overhead of a new shader? Are there good shader pipelines that you can recommend me to take a look at?
Are there some good practices to add functionality to several shaders at once?

sentences:
Restrict render in Blender is not working I click "Restrict renderability", so that everything except the item I want to export is grayed out. However, it still exports lights and everything when I import it into Unity.

How can I fix this?

sentences:
Player position triggering teleports I'm developing a Minecraft plugin (bukkit) in which a server admin can create 'portals' - a small region that will teleport any  players who enter it. I have the teleportation sorted and I know how I could define areas that the player's position could be tested against.

This would involve an ArrayList containing the zones and then hooking the PlayerMoveEvent so that the ArrayList is searched each time for a matching portal region.

Although this method would work, I doubt that it would be very efficient when 100+ players are all moving around at the same time. Is there a better way of checking a player position against a set of 'zones' / regions?

sentences:
How can I compute the average color of a texture? I'm making a mini-map system for my tile based game, and I thought the best way to accomplish this would be the following:

At the beginning of the game, I calculate the predominant color of every block (tile type), and store it somewhere. Then, to create the mini-map, I just run through the block matrix and paint a single pixel for each block, instead of it's full 16x16 image.

To do this, I need to be able to get the pixel color of a given position in the texture (to compute the average color). The way I was doing it was using getTextureData().

This method, however, seems to be buggy and very poorly-documented. It returns a single array with all the data in what I thought was RGBA order. Thus, the code to get the average color of a rectangle starting at x and y with dimensions w and h from the texture t would be:

int r = 0, g = 0, b = 0;
byte[] bytes = t.getTextureData();
for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
        r += bytes[4*((y + i)*t.getImageWidth() + x + j)];
        g += bytes[4*((y + i)*t.getImageWidth() + x + j) + 1];
        b += bytes[4*((y + i)*t.getImageWidth() + x + j) + 2];
    }
}

r /= bytes.length / 4;
g /= bytes.length / 4;
b /= bytes.length / 4;

However, this does not seem to work. It produces incorrect (often negative) values for each pixel. Is my approach correct or should be I handling the problem differently?

sentences:
How to generate tiled delaunay triangulation mesh (delaunay triangulation within a rectangle with triangles connecting opposing edges)? I have a nice triangulation of a square mesh. The way I do this currently is

generate square mesh (two triangles), from (0.,0.) to (1.,1.) (axis-aligned and normalized for simplicity)
add point somewhere within square (poisson disk sampling)
detect which triangle point falls within
subdivide into 3 triangles
iterate over all tris, perform "delaunay flips" where necessary
GOTO 2

This works great (a bit simplified, as there's also edge-case detection code to account for colinear points, fp precision errors, etc...).

Anyways, what I want to do now is have the edges of this square "wrap".

EDIT:
Upon request, here are some illustrations to help convey my problem:

So, we have an initial set of pts:

A normal delaunay triangulation would generate something like this:

What I want is a tessalated delaunay triangulation. That is, what edges would have to exist to allow this to be infinitely tile-able:

An example set of edges might be like this:

Now, imagine if you left those connections, but didn't tile them. I've drawn just the "wrapping" connections for the red dot and the purple dot in green, assuming there is only one instance of each dot in view (centered around the initially displayed set of dots):

Already, it's a topological mess. But in theory, I'd expect it would work, assuming I stick to some implementation constraints.

So, the plan would be to create a mesh containing all these pts and their respective connections. I would have some offset, and move the points in the vertex shader as a modulus of that offset. That way, every point will exist as "the closest instance of that point in the infinitely tiling plane" to the offset (for example, the camera). Since all the connections are in place, I wouldn't have to mess with them, and would get infinitely-scrolling (repeating) "terrain". All the topologically-messy-wrapping connections would be "backfacing" triangles, and would be culled... right?

Edit: Ok no they would not necessarily be backfacing... shoot. (if the wrap of the triangle was both vertically and horizontally wrapped, it would be back to frontfacing. My best guess at a solution is to, in the vert shader, artificially lower all the pts "close" to being wrapped, so any wonky giant tri's show up way below any legitimate tris. #hack.

Ok. off to try this. Will report back with any updates...

sentences:
How to remove seams from a tile map in 3D? I am using my OpenGL custom engine to render a tilemap made with Tiled, using a well spread tileset from the web. There is nothing fancy going on. I load the TMX file from Tiled and generate vertex arrays and index arrays to render the tilemap. I am rendering this tilemap as a wall in my 3D world, meaning that I move around with a fly camera in my 3D world and at Z=0 there is a plane showing me my tiles. Everything is working correctly but I get ugly seems between the tiles.

I've tried orthographic and perspective cameras and with either I found particular sets of parameters for the projection and view matrices where the artifacts did not show, but otherwise they are there 99% of the time in multiple patterns, depending on the zoom and camera parameters like field of view.

Here's a screenshot of the artifact being shown: http://i.imgur.com/HNV1g4M.png
Here's the tileset I am using (which Tiled also uses and renders correctly): http://i.imgur.com/SjjHK4q.png

My tileset has no mipmaps and is set to GL_NEAREST and GL_CLAMP_TO_EDGE values. I've looked around many articles in the internet and nothing helped.

I tried uv correction so the uv fall at half of the texel, rather than the end of the texel to prevent interpolating with the neighbour value(which is transparency). I tried debugging with my geometry and I verified that with no texture and a random color in each tile, I don't seem to see any seams. All vertices have integer coordinates, i.e, the first tile is a quad from (0,0) to (1,1) and so on. Tried adding a little offset both to the UV and to the vertices to see if the gaps cease to exist. Disabled multisampling too. Nothing fixed it so far.

Thanks.

sentences:
WEBGL antialias false to pixel art low resolution I know this issue maybe repeated and seems to be very common but I searched first and did not find anything concrete.

I am doing some test and playing around with pixijs. I created an stage 320x180 and I am rendering an sprite of 27x27 in a autodetected renderer (WEBGL always is selected) I am in a macos retina resolution (devicepixerate 4) the problem is I can not achieve having the sprite pixelated even setting antialias false in the renderer. I tested the same without pixijs but native canvas 2d context using drawImage and I could get what I wanted using some hacks like after every drawImage set context.imagesmoothingenabled to false and I have CSS file to canvas image-rendering: pixelated. With those I am having exactly what I want, but of course I would like to obtain the same using pixijs and WEBGL. Is it possible? Disable at all antialias in a WEBGL context? How we can deal with this to render pixel arts properly?

EDITED:
Using canvas 2d context native api

Using PixiJS webgl context.

Cheers.

sentences:
TMPro Double Outline Hi, This is what I am trying to achieve: TextMeshPro with double outline.
So far I have tried these combinations:

TextMeshPro + Outline[int the mid] + Underlay [external]. It is close, but not the one I am trying to make. The problem in here: The outer shadow Underlay's Y offset is limited and can't go down below -1.

Then I tried to add built-in Shadow component but it did nothing.

Is there any way I can achieve this? I don't want to use 2 TextMeshPros. I haven't tried to achieve this in code because I am a super beginner in unity and open to any guidance on that.
Thanks

sentences:
Best way to go for simple online multi-player games? I want to create a trivia game for my website. The graphic design does not have to be too fancy, probably no more advanced than a typical flash game. It needs to be secure because I want users to be able to play for real money. It also needs to run fast so users don't spend their time frustrated with game freezing. Compatibility, as with almost all online products, is key because of the large target market.

I am most acquainted with Java programming, but I don't want to do it in Java if there is something much better. I am assuming I will have to utilize a variety of different languages in order for everything to come together.

If someone could point out the main structure of everything so I could get a good start that would be great!

Language choice for simple secure online multiplayer games?
Perhaps use a database like MySQL, stored on a secure server for the trivia questions?
Free educational resources and even simpler projects to practice?

Any ideas or suggestions would be helpful...

sentences:
Unity mouse input not working in webplayer build I have a button script with the following code

void OnMouseDown()
{
    animation.Play("button-squish");
    enlarged = true;
    audio.PlayOneShot(buttonSound);
}

void OnMouseUpAsButton()
{
    if (enlarged)
    {
        SelectThisButton();
        enlarged = false;

        animation.Play("button-return");
    }
}

void OnMouseExit()
{
    if (enlarged)
    {
        enlarged = false;
        animation.Play("button-return");
    }
}

It works great in the editor, but when I made a build and tested it in Chrome none of the buttons had any response.  Further testing revealed that it did work in Firefox.  Rather than telling people to change their browser if they want to play, I want to make the button code work.  How else can I get the buttons to know when they're being pressed if the built-in stuff isn't working?

sentences:
Problems with rendering a SkyBox At the moment I'm writing an Android OpenGL ES 2.0 game but now I get stuck on rendering a SkyBox. Here is my (a bit simplified) code for the SkyBox:

float vertices [] = {-1,1,1,1,1,1,-1,-1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1};
byte drawOrder[] = {1,3,0,0,3,2,4,6,5,5,6,7,0,2,4,4,2,6,5,7,1,1,7,3,5,1,4,4,1,0,6,2,7,7,2,3};

private final void bindTexture()
{
    int shaderTextureUnit = GLES20.glGetUniformLocation(shaderProgram, "u_TextureUnit");

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_CUBE_MAP, texture);
    GLES20.glUniform1i(shaderTextureUnit, 0);
}

public void draw(float[] viewMatrix) // viewMatrix = Camera = data array
{
    GLES20.glUseProgram(shaderProgram);
    bindTexture(); // Load Texture

    shaderPosition = GLES20.glGetAttribLocation(shaderProgram, "a_Position");
    shaderMatrix = GLES20.glGetUniformLocation(shaderProgram, "u_Matrix");

    // get handle to shape's transformation matrix
    GLES20.glUniformMatrix4fv(shaderMatrix, 1, false, vpMatrix, 0);

    // Prepare the triangle coordinate data
    GLES20.glEnableVertexAttribArray(shaderPosition);
    GLES20.glVertexAttribPointer(shaderPosition, 3, GLES20.GL_FLOAT, false, 0, vertexBuffer);

    // Draw the object to the screen GL_UNSIGNED_BYTE
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, orderBuffer.capacity(), GLES20.GL_UNSIGNED_BYTE, orderBuffer);
    GLES20.glDisableVertexAttribArray(shaderPosition); // Free the position in shader
}

I think this code should be perfect because I got it from an OpenGL for beginners book. My problem now is that it looks like this if I render the SkyBox to the screen. I initialize my Camera with this code and here you have also the code for my touch event. If my considerations are right this should produce a circle around the origin so I can see all sides of the SkyBox.

private float angle = 90;

Matrix.setLookAtM(data, 0,   0, 0, 0,   0, 0, -1,   0, 1, 0); // the viewMatrix
// Z+ out of screen     Z- in screen

public void onTouch()
{
    angle += 2;

    float s = (float) Math.sin(angle * Math.PI / 180);
    float c = (float) Math.cos(angle * Math.PI / 180);

    Matrix.setLookAtM(data, 0,   0, 0, 0,   c, 0, -s,   0, 1,  0); // the viewMatrix
}

The draw Method from the SkyBox is called with the data Matrix from the camera (ViewMatrix) and with disabled depthBuffer. Do you have any ideas why the SkyBox is rendered so strange? What is wrong with my code? Only to be sure that all is right with my shaders here is the code from them:

FragmentShader

precision mediump float;

uniform samplerCube u_TextureUnit;
varying vec3 v_Position;

void main()
{
    gl_FragColor = textureCube(u_TextureUnit, v_Position);
}

VertexShader

uniform mat4 u_Matrix;
attribute vec3 a_Position;
varying vec3 v_Position;

void main()
{
    v_Position = a_Position;
    v_Position.z = -v_Position.z;

    gl_Position = u_Matrix * vec4(a_Position, 1.0);
    gl_Position = gl_Position.xyww;
}

sentences:
Is there a way to turn collision detection system off completely in Unity? My world setup is 2D Top-Down. All collisions are disabled from the collision matrix.

There are no collisions in the scene as I wanted, but as I perceive, Unity is still trying to calculate collisions in the background. So I'm experiencing serious frame rate drops because of Physics2D.Simulate when I have about 2k colliders moving over each other on the scene.

I followed the suggestions about colliders and rigidbodies on the API exactly (so I know the stuff about not to move static colliders without rigidbody, that's not the case here), but I somehow can't manage to tell Unity that I don't want her to calculate "possible" collisions.

I only want colliders for Raycast2D, OverlapCircle and making movements a bit realistic.

Thanks in advance for all suggestions.

sentences:
How can I check the shader model capabilities of an adapter? I'm writing an application that targets Direct3D11 (through SlimDX) and shader model 5.

When I'm running it on a system that doesn't have SM5 capable hardware, I will get a NullReferenceException when trying to access the techniques in the compiled effect instance.

How can I check if the adapter is capable of this before I even attempt to use any of these features?

sentences:
Recreating Common "Glowing Pillar" Effect in UE4 I've noticed a common "glowing pillar beacon" effect in a few games lately (Overwatch, Fortnite, etc). The effect provides a translucent glowing beam pointing upwards that tapers off towards the top and fades out.

I'm attempting to recreate the effect and was wondering if this is some form of particle emitter and what is involved in the effect?

Thanks!

Examples:

sentences:
How do I Rigidbody.AddForce(Vector3) in Unreal Engine? I am coming from the Unity Engine, and trying to get my feet wet with Unreal Engine 4.8.x.  I want to add a one-time force to an object.  To accomplish this in Unity 5, I would use:

void Start(){
    GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, 5));
}

Explanation:

  GetComponent<Rigidbody>() retrieves the Rigidbody Component.  The Rigidbody is
  already attached to the GameObject.
  The AddForce method is called on the Rigidbody, and applies the force of
  a Vector3.  The parameters of the Vector3 indicate the force on each
  axis which is applied.  In the example above, the GameObject would
  move forward on its z-axis.

How would I accomplish this same thing in Unreal Engine 4?  I would appreciate if you can elaborate on what exactly is happening in the code as well.  I currently have an empty AActor script, and I am struggling to find out what to put in my BeginPlay() method.

void AMyActor::BeginPlay()
{
    Super::BeginPlay();
    //What goes here?  Why?
}

As CobaltHex pointed out, UPrimitiveComponent has a UPrimitiveComponent.AddForce(FVector, BoneName) method.  However, I cannot figure out how to use it.  The real objective of this question is as a basic introduction to programming with Unreal Engine.  I chose AddForce, because it is an extremely commonly used method with a visible effect (in Unity).  All of the existing tutorials are either with an older version of unreal (which has different scripting) or are using blueprints (which has no scripting).  That is why I am trying to figure out what the actual code would be and what that code does.

Specifically, I am looking for an answer which tells me what code is missing from my Unreal Engine script, and what that code does, similiarly as is presented with my Unity Engine example.

sentences: How to reach IK Pass and weight by script? I need to reach IK Pass box, and control the weight by time from 1 to 0. I tried GetLayerIndex and did not give me any of those options.

sentences:
Huge level size after build APK in Unity I made maps used bunch of small objects which are mostly scenary, like part of road, buildings, obstacles. They are all lightmap static, batching static, occludee static.

However after build APK, "levels" takes most spaces:

Uncompressed usage by category:
Textures      23.4 mb    5.3%
Meshes        24.9 mb    5.6%
Animations    4.5 mb     1.0%
Sounds        1.9 mb     0.4%
Shaders       1.8 mb     0.4%
Other Assets  4.8 mb     1.1%
Levels        287.1 mb   65.0%
Scripts       2.1 mb     0.5%
Included DLLs 3.9 mb     0.9%
File headers  389.1 kb   0.1%
Complete size 442.0 mb   100.0%

As you can see, it's 287.1mb, it's too big. Actual APK size is almost 100mb. Funny thing is that in my game, I don't use lightmap. I have 9 different maps, all of them don't have light map, only has baked navigation mesh and occlusion data.

I don't think that occlusion data and navigation mesh takes that much, because I can see that occlusion data is less than 1MB even in the biggest map.

Does it matter that using lots of small objects to create level without lightmapping takes much spaces?

Also I combined those scenary objects together with MeshBaker, which is Unity Asset that combine meshes and materials/textures. After build, there's a little size reduction only in "Levels" part, however overall game performance getting worse and total apk size is not changed.

So, why I have those huge "levels" size, and how do I reduce it? Is there something that I missed?

And which situtation is proper to combine multiple meshes into single? In stats result, average batches are 40 in my game. Should I combine those bunch of small objects as big single object?

sentences:
How can I render images to multiple windows without creating double textures in SDL2? Simply put: What is the simplest way to render an image to two different sdl2 windows?

I'm pretty new to SLD2, but I have a nice little level editor working. I then decided to move the area with edit tools to a separate window. I immediately got the following error:

  Texture was not created with this renderer.

Alas, it looks like each window needs to have its own SDL_Renderer, and each renderer needs to create its own textures for the images I want to display.

IMG_LoadTexture() needs a renderer and will only render the resulting texture to that renderer.

SDL_CreateRenderer() then needs a window as a parameter and doesn't seem to be able to ever render to another output window.

So does this really mean I have to create separate textures of each of my images for each and every renderer/window? Or is there a way to load graphics into textures that can be used by any renderer, or on any window?

sentences:
Having trouble combining clampMagnitude and some explosion force I have a character that uses rigidbody, and I am using AddForce() to make it move. And so I do rb.velocity = Vector3.ClampMagnitude(rb.velocity, maxSpeed) to limit diagonal speed. Yes that did worked but my problem is adding for example explosion force. So if explosion force is very high, it will still clamp the velocity of the player. What way should I use to combine movement that limits diagonal speed and a properly working explosion force toward the player. At least give a clue how can I do it?
My only main problem here is the way that I implemented to limit diagonal movement. I wanna improve that by not using Vector3.ClampMagnitude() so the AddExplosionForce() will work properly to the player. Because clamping magnitude of the player will also limit the velocity when it is affected by the explosion force.
So can anyone give a clue how can I implement to limit diagonal movement without using clamp magnitude?
I thought about normalizing the move like:
Vector3 move = transform.right * x + transform.forward * z;
move = move.normalized * Time.deltaTime * moveSpeed;

But I realized I am using AddForce(). Even though I limited the diagonal speed, it will go faster and faster because there is no maxSpeed. Help please.

sentences:
How can I convert screen coordinates to world coordinates on the floor (when the y component = 0)? I am using the Irrlicht Engine and would like to convert the coordinates of the mouse on the screen to the floor of my world. I am currently trying to use

getRayFromScreenCoordinates()

which returns a "Ray starting from the position of the camera and ending at a length of the far value of the camera at a position which would be behind the 2d screen coodinates." Then I do this to get the position:

    core::line3df line = getRayFromScreenCoordinates(receiver.mousePos, device);
    irr::core::vector3df lineVector = line.getVector().normalize();
    irr::core::vector3df pos = line.start + lineVector*x;

x would be the magnitude from camera to the coordinate. However I do not know how to calculate x (as I don't know the coordinate yet).

The page I got the code from, written in 2003

sentences:
Shuffle tiles position in the beginning of the game XNA Csharp I'm trying to create a puzzle game where you move tiles to certain positions to make a whole image. I need  help with randomizing the tiles start position so that they don't create the whole image at the beginning. There is also something wrong with my offset, that's why it's set to (0,0). I know my code is not good, but I'm just starting to learn.

My start-up tile positioning code

        spriteBatch = new SpriteBatch(GraphicsDevice);
        PictureTexture = Content.Load<Texture2D>(@"Images/bildgraff");
        FrameTexture = Content.Load<Texture2D>(@"Images/framer");

        //Laddar in varje liten bild av den stora bilden i en array

        for (int x = 0; x < 4; x++)
        {
            for (int y = 0; y < 4; y++)
            {

                Vector2 position = new Vector2(x * pictureWidth, y * pictureHeight);

                position = position + Offset;

                Rectangle square = new Rectangle(x  * pictureWidth, y * pictureHeight, pictureWidth, pictureHeight);

                Square frame = new Square(position, PictureTexture, square, Offset, index);
                squareArray[x, y] = frame;

                index++;
            }
        }

For reference, here is the square class:

class Square
{

    public Vector2 position;
    public Texture2D grafTexture;
    public Rectangle square;
    public Vector2 offset;
    public int index;

    public Square(Vector2 position, Texture2D grafTexture, Rectangle square, Vector2 offset, int index)
    {
        this.position = position;
        this.grafTexture = grafTexture;
        this.square = square;
        this.offset = offset;
        this.index = index;
    }

    public void Draw(SpriteBatch spritebatch)
    {
        spritebatch.Draw(grafTexture, position, square, Color.White);
    }

    public void RandomPosition() {  }

    public void Swap(Vector2 Goal )
    {
        if (Goal.X > position.X)
        {
             position.X = position.X + 144;
        }
        else if (Goal.X < position.X)
        {
            position.X = position.X - 144;
        }
        else if (Goal.Y < position.Y)
        {
            position.Y = position.Y - 95;
        }
        else  if (Goal.Y > position.Y)
        {
            position.Y = position.Y + 95;
        }
    }
}

sentences:
Strange GLSL performance problems I'm having weird performance problems with a GLSL shader I'm working on. This small example fragment shader:

#version 450
out vec4 fragColor;

struct ST { float a; float b; float c; float d; float e; };

void main() {
    ST s = ST (0.0,0.0,0.0,0.0,0.0);
    ST[1] stack;
    int ptr = 0;
    for (int i = 0; i < 32; i++) {
        if (i > -1) // Always true
            stack[ptr++] = s;
        s = stack[--ptr];
    }

    fragColor = vec4(1.0);
}

has horrible performance, but the same shader with almost anything taken out, for example, removing e from the struct, performs fine. I'm just using these on a fullscreen triangle.

I can't figure out what's going on, and how I could fix this problem in my actual shader. Any ideas?

sentences:
Verlet collision with impulse preservation I came across this article, recently, that presented a technique for impulse preservation with position-based verlet integration. What was interesting was that the integration steps are seemingly done differently from typical position-based verlet schemes, as well as the ordering of the integration step and collision resolutions.

Specifically, the typical verlet position integrator is:

newPosition = 2 * position - oldPosition + acceleration * timeStepSquared
oldPosition = position
position = newPosition
DoConstraints()

Where the article has:

position += acceleration * timeStepSquared
DoConstraints()
newPosition = position * 2 - oldPosition
oldPosition = position
position = newPosition

Which ignoring constraints for a moment works out to be:

newPosition = 2*position - oldPosition + 2*acceleration*timeStepSquared
oldPosition = position + acceleration*timeStepSquared
position = newPosition

Which is different in a term of acceleration * timeStepSquared.  I haven't quite convinced myself that those terms cancel out through the iteration, as the prior acceleration * timeStepSquared term may not be the same as the current one.

Could someone explain the reasoning for this, and if indeed it makes sense?

sentences:
Bilinear Interpolation In the context of bilinear interpolation, if we look at the image below:

I'm confused about what P is exactly. I'm not sure if it's a point (as in (x, y)) or if it's a single value.

sentences: How to solve problem with Terrain Flashing and then disappears when flying away? I am making flight simulator( my first Unity project) , the biggest challenge so far is terrain, so whenever I fly away from it (not that far) the terrain starts flashing and disappears which is just green mountains, so when i come back to it, i have no idea where its position is, but it suddenly appears (again flashing) when I am close , the terrain size is normal but it's on top of a huge other terrain (about 100,000 * 100,000 which is the max),I tried changing pixel error and base map distance, no change, I looked at big terrain solutions online, but non of them really helped me, Any advice? Thanks

sentences:
Optimizing Draw calls in MonoGame Android platformer I am working on a 2D platformer that is in the final stages of optimization. I have a few different devices for testing, and I am trying to get the best possible framerate on the weaker ones.

On a Nexus 5 I get a constant 60fps, with an occasional hiccup.
On a Galaxy S4 I also get a good 55-60fps
On an original Galaxy S (Vibrant) The frames drop to about 20-25

My question is, given the tile system described below, what can I do to increase the FPS on low-end devices?
And granted the Galaxy S came out years ago, should I even worry about it?

My background consists of 3 scrolling parallax layers.

The world I am drawing in a viewport of 25x15 tiles, at a size of 32x32px per tile, with 3 layers each (32x32x3px).  The camera already culls tiles that are out of view. All tiles are found in one texture, and this is done in a single SpriteBatch call that locates the correct texture location for the tile layer. Code is below:

public void Draw(SpriteBatch spriteBatch, bool upsideDown)
{
    int startX = GetCellAtPixelX( (int)Camera.Position.X );
    int startY = GetCellAtPixelY( (int)Camera.Position.Y );

    int endX = GetCellAtPixelX( (int)Camera.Position.X +
        Camera.ViewportWidth );
    int endY = GetCellAtPixelY( (int)Camera.Position.Y +
        Camera.ViewportHeight );

    for (int x = startX; x <= endX; x++)
    {
        for (int y = startY; y <= endY; y++)
        {
            for (int z = 0; z < MapLayers; z++)
            {
                if ((x >= 0) && (y >= 0) &&
                    (x < MapWidth) && (y < MapHeight))
                {
                    // ...

                    /// The very last parameter in this draw call is
                    /// the draw depth. This draw format will arrange
                    /// layers from front to back (0 = front, 1 = back)
                    /// so we subtract 1 from the z-index as a decimal
                    /// to get the appropriate location:
                    ///     Background      -> 0.7
                    ///     Middleground    -> 0.6
                    ///     Foreground      -> 0.5
                    spriteBatch.Draw(
                        tileSheet,
                        CellScreenRectangle(x, y),
                        TileSourceRectangle(mapCells[x,y].
                            GetLayerIndex((TileLayers)z)),
                        Color.White,
                        0.0f,
                        Vector2.Zero,
                        effect,
                        0.7f - ((float)z * 0.1f)
                    );
                }
            }
        } /// End y loop
    } /// End x loop
}

As you can see, it's not very complex code.  I have checked if my Update calls are slowing the game down, but it's very clearly in the Draw function. When I leave out my call to world.Draw(), fps shoot up to about 50 on the Galaxy S. Also, if I draw only a single layer, I get better performance around 42-45 fps.

I can discard one layer if necessary, but I need at least 2 tile layers. How else can I speed up the draw calls?

I am using MonoGame for Android (XNA)

sentences:
Creating a working game with Unity3D? I recently start learning Unity3D and following VTC's video tutorials and others tutorial, so far i've found it very easy to work it and to create stuff, i havent got to the part where i need to script anything YET.

While i still havent hit the scripting part yet i did like to ask:

Do i really need to script anything to
make a simple game with it ? (why am i asking this ? until now from the tutorials i've been watching it seems that unity3d has most of the physics and codes needs to create a working version of a simple game, for example making falling crates, the rigidbody functions, it taking into account flags and grass being touched by the wind and moving)
What are some simple examples of
where will i be scripting for ? (just wondering if there will be something to script for even for a simple game and what would that be)
When i build the finish project will it compile everything as if it was a VS project and make a working version without the need of any other wrappers for it is data, etc ? (this is sort of self replied by their webpage but i just wanted to confirm if i got this right)

I am aware those might be subjective questions but while i am unexperienced with it and havent found anything related to those questions yet or havent meet the end of a project to be able to confirm for myself i would like to receive some advices and information in regards this.

PS: i did a search but i was not sure of what should i look for to find answer for this kinda of questions so if this is a duplicate of any sort let me know and i will delete it once i am pointed out for the duplicate.

Best regards.

sentences: How do I implement space partitioning in entity component system? My systems work on components without needing to now anything about entities. I want to implement simple grid partitioning, so each entity will be given a cell based on its current position. But how will systems know which components to update and how? For example: CollisionSystem must check collision between each components within a cell, but CollisionComponents must be somehow attached to the grid for system to know what collision to test, which doesn't seem like a good solution. What should I do?

sentences:
How to clamp a mouse angle within a field of view range of the facing direction In my top down shooter game, the player can face in any of the 8 compass directions using the keyboard.
Depending on the direction, the player will have a 90 degree field of view to turn based on the angle selected by the mouse position. Obviously the mouse can go anywhere so it has to be restricted within -45 and 45 of the angle faced.
The eight direction angles:
    135 90 45
180            0
   225 270 305

So if the player is facing to the left at 180, their range of view will be -45 and 45 of that ie 135 to 225. So it's simply mouseAngle - facingAngle, which works fine, except if the player is facing around 0, 45 or 305 degrees where the mouse angle passes zero causing issues in calculation.
As it is I'm using this formula.
private void setAngleFOV() {
    if (facing == 0 || facing == 360)
        facing = mouseAngle < 360 && mouseAngle >= 180 ? 360 : 0;
    angleFOV = mouseAngle - facing;
    angleFOV = Math.max(Math.min(angleFOV, 45), -45);
}

It can either be 0 or 360 for either facing or mouseAngle, whichever works best but I haven't found an ideal solution. The above formula works for facing right at angle 0, but not with diagonal angles 45 and 305.
It could maybe work with lots of if statements and such, but I feel there must be a better way?

sentences:
Text not instantiating under a canvas (unity) Below is my code for a text I want to spawn under a canvas. Both spawn and I no longer get errors, but the text isn't spawning under the canvas.

        Instantiate(canvasparent);
        Text savescore = Instantiate(score) as Text;
        savescore.transform.SetParent(canvasparent.transform, false);

sentences:
Using EaselJS, my spritesheet-based map is not showing up I have a random map that generates based on a level and a set of Tile ID's, constructed using a Height Map generator I wrote using the BitmapData extension.

I've confirmed that the Tile IDs are generated correctly and can be modified to cycle through a set of tiles and changing circumstances.

The actual base image that holds the tiles is loaded and I was able to draw
it separately.

However... after I update the stage when the function finishes building, I don't see any map at all and I don't understand why. I've tried to add to a container and to the stage directly, neither method is working.

Could anyone identify the problem?

function buildBackground()
{
    var mapSeed = Math.round(Math.random() * 2);

    var channel = Object.create(createjs.BitmapDataChannel);
    var channelOptions = channel.RED | channel.GREEN | channel.BLUE;

    var offsets = [new createjs.Point(0, 0), new createjs.Point(0, 0)];
    var interpolateType = "cos";

    var TileMap = new Array();

    accessMap = new createjs.BitmapData(null, 200, 200);
    accessMap.perlinNoise(100, 100, 6, mapSeed, true, false, channelOptions, true, offsets, interpolateType);

    var BitmapLayout = new createjs.Bitmap(accessMap.canvas);

    BitmapLayout.scaleX = 5;
    BitmapLayout.scaleY = 4;

    BitmapLayout.x = 0;
    BitmapLayout.y = 0;

    var gridSizeX = 10;
    var gridSizeY = 7;

    heightMap = new Array();

    for (x = 0; x < gridSizeX; x++)
    {
        heightMap[x] = new Array();
        for (y = 0; y < gridSizeY; y++)
        {
            heightMap[x][y] = 0;
        }
    }

var pixelPoint = new createjs.Point();
var darkest_pixel = 1;
var brightest_pixel = 0;

for (x = 0; x < gridSizeX; x++)
{
    for (y = 0; y < gridSizeY; y++)
    {
        pixelPoint.x = Math.round((x/gridSizeX) * accessMap.width) + 1;
        pixelPoint.y = Math.round((y/gridSizeY) * accessMap.height) + 1;

        heightMap[x][y] = accessMap.getPixel(pixelPoint.x, pixelPoint.y);

        heightMap[x][y] /= 0xffffff;

        if (heightMap[x][y] < darkest_pixel) {
            darkest_pixel = heightMap[x][y];
        }

        heightMap[x][y] = Math.round(heightMap[x][y] * (Math.random() * 3));
    }
}

for (x = 0; x < gridSizeX; x++)
{
    TileMap[x] = new Array();
    for (y = 0; y < gridSizeY; y++)
    {
        TileMap[x][y] = 0;
        TileMap[x][y] = Math.round(heightMap[x][y] * (Math.random() * 5));
    }
}

var bitmap = new createjs.Bitmap(preload.getResult("BackgroundTiles"));

var BackgroundTileObjData = {
    images: [bitmap],
    frames: {width: 100, height: 100}
};

var BackgroundTileInfo = new createjs.SpriteSheet(BackgroundTileObjData);

var frameSize = 100;

var graphic = new createjs.Graphics();

for (x = 0; x < gridSizeX; x++)
{
    for (y = 0; y < gridSizeY; y++)
    {
        var TileID = TileMap[x][y];

        var levelModifier = 1;
        var tile = new createjs.Sprite(BackgroundTileInfo);
        tile.gotoAndStop(TileID);
        tile.x = 100 * x;
        tile.y = 100 * y;

        stage.addChild(tile);

    }
}

stage.update();
console.log("Tile SpriteSheet?");

}

sentences: Web Card Game , MySQL vs SQLite performance wise Been thinking of creating a js/PHP/MySQL game, with multiple players / games happening concurrently. Is there any chance SQLite might be faster for something like this than MySQL? Keep in mind that I'll propably test this on a shared hosting server...

sentences:
2D graphic over 3D perspective projection To draw a 2D HUD (just a simple trianlge, for now) over 3D graphics in OpenGL I :

draw all 3D objects, then
call glDisable(GL_DEPTH_TEST) before drawing 2D HUD
draw 2D triangle
call glEnable(GL_DEPTH_TEST);

however it seems I am missing something and the triangle is only rendered when I set Model-View-Projection matrix to Identity :

DrawFrame() {
.
.. // Draw 3D objects
.
/*
*  Coordinates of 2D triangle
vert[0] = 0.0f; vert[1] = 0.5f; vert[2] = 0.0f;   // TOP
vert[3] = -0.5f; vert[4] = -0.5f; vert[5] = 0.0f;  // LEFT
vert[6] = 0.5f; vert[7] = -0.5f; vert[8] = 0.0f;   // RIGHT
*/

glDisable(GL_DEPTH_TEST);

glm::mat4 guiMVP = glm::mat4(1.0f);
//glm::mat4 guiMVP = Ortho * View * glm::mat4(1.0f);   // This does not render triangle
//glm::mat4 guiMVP = Projection * View * glm::mat4(1.0f);   // This DOES render triangle at its place but in 3D world
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &guiMVP[0][0]);
...
.. // render2D triangle
glEnable(GL_DEPTH_TEST);
}

OnSurfaceChanged(int width, int height) {

    glViewport(0, 0, width, height);

    aspect = (float) width / height;

    // Projection Matrix
    Projection = glm::perspective(45.0f, aspect, 0.1f, 10000.0f);
    // Orthographic Matrix for 2D HUD
    Ortho = glm::ortho(0.0f, (float)width, (float)height, 0.0f);
}

setCamera(float cameraX, float cameraY, float cameraZ, float cameraLX, float cameraLY, float cameraLZ) {
    // Camera/View matrix
    View = glm::lookAt(
        glm::vec3(cameraX, cameraY, cameraZ),     // Camera position
        glm::vec3(cameraLX, cameraLY, cameraLZ),     // pointing at
        glm::vec3(0, 1, 0)      // Angle
     );
}

here's my Vertex shader :

attribute vec3 in_Position;

uniform mat4 MVP;

void main(void) {
    vec4 v = vec4(in_Position, 1.0);

    gl_Position = MVP * v;

}

This is screenshot of what I want :

I DO get this output by using an Identity MVP matrix for 2D graphics. I know this is an ugly hack that works for now.

How to do this properly using Orthographic matrix ?

sentences:
LibGDX ShapeRenderer rotated I'm having a weird problem with the LibGDX ShapeRenderer where it draws everything rotated.
Here are some images to show you what i mean:
This is what it looks like in Tiled(Map Editor):

This is how it looks like in game:

As you can see, its rotated.
Heres the Code i use to render the mapobjects:
    shapeRenderer.setProjectionMatrix(cam.combined);
    shapeRenderer.setColor(1, 1, 0, 1);
    shapeRenderer.begin(ShapeType.Line);
    for (RectangleMapObject o : MovementSystem.objects.getByType(RectangleMapObject.class)) {
        Rectangle rect = o.getRectangle();
        shapeRenderer.rect(rect.x, rect.y, rect.height, rect.width);
    }

    shapeRenderer.end();

The rectangle is positioned at the right place and it is definitely NOT rotated!
I checked this with a small collision detection test where i moved another rectangle over this one.
So it just gets drawn like this and i have no idea why^^
Would be nice if anybody could help me :)
Thanks for your help in advance!

sentences:
Entity/Component System and UI "Entities" I'm still green to entity/component systems. I find that since I have useful components for drawing sprites (or spritesheets) and handling input (mouse/touch clicks), I naturally want to reuse these to create UI components (like buttons, eg. level-select screen).

This strikes me as very odd. I always understood entities as "game model" things like players, enemies, power-ups, etc. On the other hand, from a code-reuse perspective, reusing compnents for UI makes perfect sense.

How (and where) do UI/GUI concerns fit into an entity/component system?

(Note: this question is platform agnostic since it applies to multiple platforms/languages)

sentences:
Can't figure out how to create texture from a font-surface I can't seem to be able to render my font, it crashes and I can't figure out why. It seems to load the font correctly, but the parts relating to surface crashes.

Why does my texture crash?

Here is the code bits relating to it. SDL2 and TTF has been initialized properly.

        TTF_Font *arial;
        SDL_Color mm_txt_color = {255, 255, 255, 0};
        SDL_Texture *myTexture;
        SDL_Rect myRect;
        load_font(MM_FONT_ARIAL, 18,  &arial);

        get_text_and_rect(0, 0, "Exit", arial, &myTexture, &myRect);

int load_font(char *filepath, int size, TTF_Font **font)
{
    (*font) == TTF_OpenFont(filepath, size);
    if((*font) == NULL ) {
        printf("ERROR: Failed to load font: %s.\n", filepath);
        return FAILURE;
    }
    return SUCCESS;
}

    void get_text_and_rect(int x, int y, char *text, TTF_Font *font,
        SDL_Texture **texture, SDL_Rect *rect)
    {
        int text_width;
        int text_height;
        SDL_Surface *surface;
        SDL_Color textColor = {255, 255, 255, 0};

        surface = TTF_RenderText_Solid(font, text, textColor);
        *texture = SDL_CreateTextureFromSurface(renderer, surface);
        text_width = surface->w;
        text_height = surface->h;
        SDL_FreeSurface(surface);
        rect->x = x;
        rect->y = y;
        rect->w = text_width;
        rect->h = text_height;
    }

sentences:
Why is perlin noise generating flat terrain in Unity? I am trying to generate terrain using perlin noise however the terrain being generated is a plateau. Here is the code that I'm using:

var xlength = 65.0;
var ylength = 65.0;
var scale = 4.1f;
var heights = new float[xlength, ylength];
function Start () {
    for (var i = 0; i < xlength; i++)
        for (var j = 0; j < ylength;j++)
            heights[i,j] = Mathf.PerlinNoise(Time.time * i / xlength * scale/1000,Time.time * j / ylength * scale/1000)*i*j;
    gameObject.GetComponent(Terrain).terrainData.SetHeights(0,0,heights);
}

What am I doing wrong here?

sentences:
How to compute the area of an irregular shape? I have a room object defined by a collection of looping line segments that I need to calculate the area for. The classes can be described as follows (in pseudo-code):

class Point {
    float x;
    float y;
    ...
    float distanceFrom(Point p);
}

class Segment {
    Point start;
    Point end;
    ...
    float length();
}

class Room {
    List<Segment> walls;
    ...
    float area();
}

The walls of a room can never intersect anywhere but at the endpoints of the segments and any "sub-loops" created will also be separated into a new room. The solution does not need to be perfectly accurate (10% margin of error is acceptable) and is also not computed very often (<1/s).

sentences:
Poor CUDA performance, raytracing I use CUDA 7.5 to learn the basics of raytracing. So far I've done nothing but constant color no-lighting spheres-only raytracing. But my delta time is already 14 - 16 ms for 800x600 resolution - 1 ray for each pixel.

Some pc specs, if needed:
GPU - nvidia titan black,
CPU - intel core i7...,
enough RAM.

Here is the kernel:

__global__ void runKernel(Camera* cam, SphereData* objs, uint* size, uchar* out_img)
{

vec3 pos = cam->getPos();
rs::Rectangle rec = cam->genNearPlaneRectangle();
vec3 start = rec.center - rec.right - rec.up;
float pixelsizex = 1.0F / cam->getWidth();
float pixelsizey = 1.0F / cam->getHeight();
uint width = cam->getWidth();

uint id = threadIdx.x + blockIdx.x * blockDim.x;
uint i = id % width;
uint j = id / width;

vec3 pixelW = start + rec.right * 2 * (pixelsizex / 2 + pixelsizex*i) + rec.up * 2 * (pixelsizey / 2 + pixelsizey*j);
vec3 dir = (pixelW - pos).normalize();

Ray ray = Ray(pos, dir);

vec3 resColor = Tracer::rayTraceSpheres(ray, objs, *size);

out_img[4 * width * j + 4 * i + 0] = 255 * resColor.x();
out_img[4 * width * j + 4 * i + 1] = 255 * resColor.y();
out_img[4 * width * j + 4 * i + 2] = 255 * resColor.z();
out_img[4 * width * j + 4 * i + 3] = 255;

}

I have a really basic standart setup for OpenGL, I use it to render a fullscreen texture of raytracing results.

Main loop's update and render functions:

void Graphics::update()
{
cameraUpdate();

//println(camera.genLookingRay().dir.toString());

uint objSize = objs.size();
cudaMemcpy(cudaData.d_cam, &camera, sizeof(Camera), cudaMemcpyHostToDevice);
cudaMemcpy(cudaData.d_objs, objs.getArray(), sizeof(SphereData)*objs.size(), cudaMemcpyHostToDevice);
cudaMemcpy(cudaData.d_size, &objSize, sizeof(uint), cudaMemcpyHostToDevice);

uint threadsPerBlock = 128;
uint blocks = ((uint)(width*height) + threadsPerBlock - 1)/threadsPerBlock;

runKernel <<< blocks, threadsPerBlock >>>(cudaData.d_cam, cudaData.d_objs, cudaData.d_size, cudaData.d_out_img);

// Check for any errors launching the kernel
cudaError cudaStatus = cudaGetLastError();
if (cudaStatus != cudaSuccess) {
    fprintf(stderr, "addKernel launch failed: %s\n", cudaGetErrorString(cudaStatus));
}

cudaStatus = cudaDeviceSynchronize();

cudaMemcpy(image, cudaData.d_out_img, sizeof(uchar)*4*width*height, cudaMemcpyDeviceToHost);

RenderFullScreen::setupTexture(width, height, image, 0);
RenderFullScreen::build();

}

void Graphics::render()
{
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

Shader::setCurrent(Shader::SHADER_HUD);
Shader::getCurrent().enable();
Shader::getCurrent().setUniformMat4f("P", camera.getMatOrthographic());
RenderFullScreen::render();
Shader::getCurrent().disable();

glfwSwapBuffers(window);
}

Function "rayTraceSpheres(...)":

__CUDA__ vec3 Tracer::rayTraceSpheres(Ray& ray, SphereData* objs, uint size)
{
    vec3 color(0,0,0);
    float tmin = INFINITY;

    for(size_t i = 0; i < size; i++)
    {
        Sphere obj = Sphere(objs[i]);

        float ct = tmin;
        vec3 cc(0,0,0);
        bool res = obj.hit(ray, ct, cc);

        if(ct < tmin) {
            color = cc;
            tmin = ct;
        }
    }

    return color;
}

__CUDA__ bool Sphere::hit(Ray& ray, float& tmin, vec3& color)
{
    float t;
    vec3 temp = ray.start - center;
    float a = ray.dir * ray.dir;
    float b = temp * 2 * ray.dir;
    float c = temp * temp - radius * radius;
    float disc = b * b - 4 * a * c;

    if(disc < 0){
        return false;
    }
    else
    {
        float e = sqrt(disc);
        float denom = 2 * a;
        t = (-b - e)/denom;
        if(t > 0){
            tmin = t;
            color = this->color;
            return true;
        }
        t = (-b + e)/denom;
        if(t > 0)
        {
            tmin = t;
            color = this->color;
            return true;
        }
    }
    return false;
}

What could be the issue ?

sentences:
What is better: One texture per model or assigning multiple models to one single huge texture? If I'm making a low-poly car pack of multiple cars for mobile platforms, should I:

Make a large texture like of 2048x2048 and unwrap all the models to it
Make separate, smaller (256x256) textures for all cars

Will there be a difference in performance? Which way of texturing is preferred? I've never seen any PC game have one large texture for all the cars, instead every car has its own set of textures and materials.

sentences:
Rate-limiting players actions in a multiplayer game I'm thinking about building a multiplayer game with combat between players and monsters. Actors need to have a maximum actions per minute, otherwise users could cheat by holding down the attack key. Plus, I'd like to vary the maximum APM depending on the player class and monster.

How should I handle rate limiting combat in my game?

Assuming every actor has a timestamp of when their last action occurred, should I queue up actions to execute or should I drop them if they're received too early? Can you think of any reading material or examples I could research?

sentences:
How can I get animated bone's transformation in LibGDX? I am trying to get transformation from a bone, but i can't, I exported just a animated armature with just a bone from blender, then I converted to .g3dj, so I just need the bone transformations so that I can get it value for some effects like moving sprites and other things.

any ways to read just transformation in "render()" method, seems bones animation does not effect on bone's value!
I want to use just openGL ES 1.x.

sentences:
Entity Component Architecture and Scripting without using threads I am working on a small game engine for practicing purpose and also for putting
some of my ideas into action. What I have so far is a couple of systems for
rendering, sound etc. The next step is to put all these things together.
I already looked into entity component systems, in particular the following
article:
http://www.gamedev.net/page/resources/_/technical/game-programming/implementing-component-entity-systems-r3382

I think that this approach would suit my needs to a certain level, but I also
would like to implement the game logic itself inside scripts. I came up with a
slightly different approach:

The rendering, sound, physics, input and simulation systems perform actions
on the data, which is basically a level object and a list of entities
(for technical reasons I have to distinguish between entities and level
geometry). The particular systems only perform actions on those entities which
match their criteria (e.g. the physics system only handles entities with a
bounding volume). In my approach the systems do not directly implement behavior.
Instead they are either creating output (rendering, sound) or input
(physics, input). The simulation system manages the scripts which may be
assigned to entities. The script of an entity consists of two parts, first the
initialization code which is executed when the entity is added to the scene,
and second the code which is executed once per frame (or less, depending on
whether the code contains a wait-statement). Additionally every entity may
implement event handlers which are called whenever the input or physics system
throws an event (e.g. a CollisionEvent, KeyDownEvent etc.). Entity scripts may
define parameters, which can be modified inside the level editor.

My question is, whether this architecture has some severe weaknesses. Since I
want to avoid threading, my scripts will be scheduled by the simulation system,
which lead me to the restriction that an entity script is called once per frame
(which means that loops should be avoided, since basically everything already is
inside a big loop). Is this reasonable or is there any better way?

sentences:
View matrix in opengl Sorry for my clumsy question.
But I don't know where I am wrong at creating view matrix.

I have the following code:

 createMatrix(vec4f(xAxis.x, xAxis.y, xAxis.z, dot(xAxis,eye)),
 vec4f(  yAxis.x_, yAxis.y_, yAxis.z_, dot(yAxis,eye)),
 vec4f(-zAxis.x_, -zAxis.y_, -zAxis.z_, -dot(zAxis,eye)),
 vec4f(0, 0, 0, 1)); //column1, column2,...

I have tried to transpose it, but with no success.
I have also tried to use gluLookAt(...) with success.
At the reference page, I watched the remarks about the to-be-created matrix, and it seems the same as mine. Where I am wrong?

sentences:
HLSL float4 addition returning all 0.0f vector, unexpected result Edit: Added images at the bottom to show the current issue.

I have the following few lines in my hlsl pixel shader where color and specular are both float4.

color = color * textureColor;

// Add specular component and clamp
color = saturate(color + specular);

Running VS2013 graphics debugger and debugging into the pixel shader I see specular coming through as (0.0f, 0.0f, 0.0f, 0.0f) which I expect for the pixel I'm checking since it's not within the specular portion of the viewDirection, but the float4 addition is making the final color as zero after the addition.

Am I completely missing something here? I would assume the following math:

   color (0.65f, 0.0f, 0.0f, 1.0f)
 + specular (0.0f, 0.0f, 0.0f, 0.0f)

   result = (0.65f, 0.0f, 0.0f, 1.0f)

Any thoughts would be greatly appreciated. I have a feeling, I'm missing something really simple here.

EDIT:

 // If I remove the specular and return color after multi by tex Sample,
 // I get the following expected result
 color = color * textureColor;

// As soon as I add the specular component back in
color = saturate(color + specular);

sentences:
Should scripts interact with an abstraction of the engine? I'm using Java and Jython, and after some research I discovered giving scripts direct access to the engine interface could be a mistake, as it would tightly couple the two.

It looks like most scripting that allows mods to create and manage entities does so through some sort of abstraction. Are these abstractions there for this reason, or is it just to provide a more intuitive way for non-programmers to mod the game?

sentences:
setting a time delay between two frame when animation a sprite sheet this is my jsfiddle :http://jsfiddle.net/Z7a5h/

As you can see the animation of the sprite sheet when the player is not moving is too fast so i was trying to make it slow by declaring two variable lastRenderTime: 0,RenderRate: 50000

but my code is not working and it seem i have a misunderstanding of the algorithm i am using so can anyone lay me a hand to how can i fix it ?

 if (!this.IsWaiting) {
                    this.IsWaiting = true;
                    this.Pos = 1 + (this.Pos + 1) % 3;

                }
                else {
                    var now = Date.now();
                    if (now - this.lastRenderTime < this.RenderRate) this.IsWaiting = false;
                    this.lastRenderTime = now;

                }

sentences:
Problems when randomizing x and y position of a picturebox So, I'm making a simple game. It's like snake but the picturebox doesn't grow. In the game, you have to get fruits and other objects.
Look at berry's code:

public class Berry : PictureBox
{
    public bool ON_SCREEN;
    public Berry()
    {
        this.BackColor = Color.White;
        this.Size = new Size(20, 20);
    }
}

And then I randomize it on a form. Like this:

public void Generator_Berry()
    {
        Berry b = new Berry();
        Random randomY = new Random();
        int rY = randomY.Next(10, 270);
        Random randomX = new Random();
        int rX = randomX.Next(10, 270);
        this.Controls.Add(b);
        b.BringToFront();
        b.Location = new Point(rX, rY);
        b.ON_SCREEN = true;
    }

So the problem is that Berry's X position is the same as Y or vice-versa. I've never got a problem like this.(It look very simple, but I can't get the solution) What is wrong?!
Am I that very stupid?!

sentences:
Root Animation unusual position and non root animation snaps back Im trying to do a stop animation . when i release the W key then from Run it will do this animation then goto IDLE . But somehow this is not working right. as you see in those videos below. So how do i achieve this ?

Im using animation from mixamo.

After Root Motion http://i.imgur.com/JwY98P2.gifv

Before Root Motion  https://fat.gfycat.com/ReflectingMealyCrane.mp4

sentences:
Layers in Unity won't drag I'm trying to rearrange my layers in Unity but I can't seem to drag them. When I try to do this I'm in edit layers under the heading sorting layers and I click on the = symbol and try to drag it but it won't move. I also tried restarting Unity twice but it won't resolve the problem.

Could someone help me with this?

sentences:
How does Application.genuine work? In Unity, does anyone know exactly what is behind the scenes of Application.genuine?

More specifically, I would like to understand its exact process so I can understand:

If I can use it safely without "false negatives".
If it considers text (or other) assets stored in a Resources folder (e.g. my level config files).

Just for context, I want to say that my target platform is iOS.

sentences: How do Aimbots get detected? I was wondering on the programming methods which are used to detect when a player is using an Aimbot/AutoAim cheat.

sentences:
See precision (pr curves) in TensorBoard (Unity ml-agents) How could I log and later view the precision values and/or pr curves of my Unity ml-agents onnx model? Precision values don't seem to be logged by default, as TensorBoard doesn't display anything at the moment despite me having a few trained models
Thanks in advance! :)

sentences:
How to create enemy "flash-light" for 2D game? I'm developing a 2D stealth game but I cannot figure out how to create something like a torch (flashlight) that the enemies hold and look around with.Any help?
Also, if relevant, I'm using MonoGame.

sentences:
Sprite rotation and question about sampler state I'm not an expert in creating game engines, but I'm doing fine for now. Recently I reached a point that I couldn't solve any of my problems. I have two questions:

I'm using D3DXMatrixTransformation2D to produce the transformation matrix for my sprites, but I have a problem with rotation. Whenever I try to set a rotation for my sprite, it does turn when there is a fixed value of rotation. If I give 0.5f it won't rotate, but when I set 1, 2, 3, ... it'll work and that's not really cool. And, I searched a lot about pScalingRotation but it seems it's hasn't any influence. My rotation's value is fine, but the produced matrix doesn't act the way I expect it to.
I want to get a smooth edge for my sprites when they're rotating and I saw p_device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);. Where should I set the sampler state? After creating the device or after every update? And, what about texture filters? I use D3DXCreateTextureFromFileEx to load textures from file and it has Filter and MipFilter. Are these related to the sampler state?

sentences:
Drawback of using multiple bind flags As far as I understand Direct3D 11 I have to specify certain BindFlags in order to use a resource in a specific stage of the pipeline.

From my experience some combinations are more common like BindFlags.RenderTarget | BindFlags.ShaderResource for post processing effects. And I guess it could also be quite handy sometimes to set the ShaderResource flag for DepthStencilBuffers.

So I would like to know what is happening behind the scenes. What is the drawback of simply setting all of them? Would it be a minor performance hit? Or is as bad as an individual copy of the resource for every different flag?

sentences:
Replicating no. of sprites without letting the app to slow down and crash Is it possible that if I'm making a a simple drag-n-drop game, does making a new sprite via constructor with texture as a parameter makes the game slower and depletes more memory until it crashes or does making a new texture via constructor cause the memory to go slow? I'm on a revision for the new drag-n-drop puzzle game where the only goal is to stack the most no. of objects as you can before it falls off the platform. Is it a good idea to create another sprite with texture as a parameter every time a player drag-n-drop another object?

Here's the start of the dry run looked like and I set it to debug mode so that the platform is completely block the pit to test the replication test.

Afterwards, when it reaches from hundreds to thousands, this will be like this and the game gets slower.

When the game crashes, here's the result via Logcat:

12-11 16:38:53.953: E/AudioTrack(25701): AudioFlinger could not create track, status: -22
12-11 16:38:53.953: E/SoundPool(25701): Error creating AudioTrack
12-11 16:38:53.993: D/dalvikvm(25701): GC_EXPLICIT freed 947K, 14% free 14414K/16672K, paused 2ms+4ms, total 96ms
12-11 16:39:16.363: E/AudioTrack(25701): AudioFlinger could not create track, status: -22
12-11 16:39:16.363: E/SoundPool(25701): Error creating AudioTrack
12-11 16:39:16.433: D/dalvikvm(25701): GC_FOR_ALLOC freed 2120K, 15% free 14418K/16848K, paused 47ms, total 47ms

By the way, I'm using BodyEditor library for Box2D program and rendering, a physics engine.

sentences:
Will there be legal issues in using cracked assets for internal development? While the artwork for my game is being finished, can I use cracked assets for internal prototyping or testing? I am not going publish anywhere outside my company. Does it attract any legal issues?

By "cracked assets" here I mean extracting embedded graphic assets like images and .swf files from a browser cache or an encrypted URL.

sentences:
Texture not working on object I have a project that I'm having a bit of trouble with. Let me try and explain. In short, I'm trying to apply a texture to an object, but instead it is a solid color.

I built a building in "Autodesk 123d design", and exported it as stl. Then I used an online converter to convert it to obj, then added that to the unity scene. I created a material with a texture and tried to apply it to the object, but it was a solid color.

I think the UVs on the object might be messed up. I tried some things in blender, but had no luck. Any ideas on how I can fix this?

Edit:

Here is the 3D model I'm working with: http://www.123dapp.com/123D_Design/Conisbrough-Castle-Keep/4578568

sentences:
RTS game: How to handle disconnects in a fully connected peer to peer architecture? I'm currently working on a game in which I am considering implementing a networking architecture as described in this article: http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php

In order for the implementation as described in the article to work, all peers need to be interconnected without any exceptions. Like so:

This works fine when everything is well. But I am wondering how to agree on disconnects in such a network. (Sadly something the article does not go into). It is relatively easy if one client goes down. Just give every client a timeout, and if a client does not respond for a certain time, it is removed from that client.

However, how should the system solve a case in which one client does not respond to another, but still responds to all others. In such a system the following could happen, resulting in a invalid state:

Of course this can be solved by giving one of the clients some kind of "master" role. It being the only one that can decide whether or not to disconnect other clients. But I'm wondering if it can be achieved in a pure p2p network.

Note I realize this case is not one that can likely occur "naturally". But I want to prevent players from being able to ruin a networking game for others by playing a trick like this by using the firewall for example.

sentences:
Unable to access jar. Why? I was making a game in java and exported it as jar file. Then after that, I opeed jar splice. I added the libaries and exported jar. I added the natives then i made a main class. I created a fat jar and put it on my desktop. I'm using Mac OS X 10.8 Mountain Lion. When I put in the terminal, java -jar System Front.jar it says unable to access System Front.jar Even if i double click on the file, it doesen't show up! Help! I'm using slick.

I added slick and lwjgl as libraries for the jar splice at the jars.

sentences:
Implement spherical mapping for texture coordinates I am using a texture of a world map and I am trying to put that image on a sphere made up of many triangles. Each triangle has points a,b,c with their own (x,y,z) coordinates.

I am trying to use the coordinate system conversions formula from Wikipedia. This is my world to spherical coordinates function:

function worldToSpherical(p) {

  const r = Math.sqrt(Math.pow(p[0],2)+ Math.pow(p[1],2) + Math.pow(p[2],2));
  const u = Math.atan2(p[1],p[0]);
  const i = Math.atan2(Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2)),p[2]);

  const s =  r * Math.sin(i) * Math.cos(u);
  const t =  r * Math.sin(i) * Math.sin(u);
  return [s, t];

}

But this is what my output looks like:

It seems to be wrapping around twice. Am I using the wrong formula, or using it wrong?

sentences:
Successful Elements to a 4X Game 4X games (That is, Xpand, Xplore, Xploit and Xterminate) like Civilization, Sins of a Solar Empire, and other top Strategy games, all seem to have the same addictive hook. I'd like to know what elements these developers incorporate into their games to make them:

Well paced (You can't beat the game in 5 minutes, but it wont take a week)
Replayable (The first game isn't your last)
Competetive (The AI doesn't play like a 3 year old)
Not repetetive (Such as using the same strategy over and over, or spamming units)
Economical (Not having 7 trillion metal and coins after 10 minutes of play)
Not to much micro-managing
Exciting (Necessary?) combat
You stil need to use strategy
Intuitive interfaces (Civilization 5 is a good example)
And any other important parts to the Strategy/4X genre

Some of these seem pretty simple, but others look like balancing acts, and I'd like to have some opinions on how to make a game that is fun to play. I'd be grateful if anyone could answer tell me how you or another game\developer has managed to successfully balance them together.

sentences:
Is component-based design an architectural pattern or design pattern? When using the component-based paradigm in game development with engines like Unity, is component-based design an architectural pattern, or a design pattern?

Can I even say that component-based design is my "main" architectural pattern for my game?

I see architectural patterns as being more high-level than design pattern. The component-based design in game development's context (like with Unity engine) seems to fit as an architectural pattern to me. However, on some sites, I read that component-based design is a behavioural pattern, much like other behavioural design patterns, and not so much like an architectural pattern like MVC.

sentences:
Transparency in XNA-4 primitives I'm using XNA 4 with Visual Studio 2010. I'm trying to create a simple 3D world with walls and doors in which the user to free to roam around.

A wall is just a rectangle which is currently being rendered with four vertices using triangle strips. But to create a door, I'd have to split it into three rectangles as shown in the figure.

Four quadrilaterals if I want to have the following door-style

It will become more complex to have multiple doors on the same wall or if I have windows.

Is there any shorter way to handle this? I am looking for something that will just make the wall transparent wherever I want.

I found a solution but facing a problem here

sentences:
Enemy movement in straight line to player in chase game I'm creating a game where the enemies spawn randomly on a map then move towards the player every frame at a random speed. The map has no obstacles so the enemies should always move in a straight line. I wrote the movement function a few times but no matter what the enemies always hit 0, 45, 90, 135, 180, 225, 270, 315 angles but never a straight line. Here is an example of the code:

    base_speed = random();

    diff_x = abs(enemy_y_pos - player_x_pos);
    diff_y = abs(enemy_x_pos - player_y_pos);
     if (diff_x > diff_y) {
      y_speed = base_speed;
     } else if (diff_y > diff_x) {
      x_speed = base_speed;
     }

     if (enemy_x_pos < player_x_pos) {
      velocity.x = x_speed;
     } else if (enemy_x_pos > player_x_pos) {
      velocity.x = -x_speed;
     } else {
      velocity.x = 0;
     }

     if (enemy_y_pos < player_y_pos) {
      velocity.y = y_speed;
     } else if (enemy_y_pos > player_y_pos) {
      velocity.y = -y_speed;
     } else {
            velocity.y = 0;
    }

    enemy_x_pos = enemy_x_pos + velocity.x;
    enemy_y_pos = enemy_y_pos + velocity.y;

This is my first attempt at game programming. I guessing it's should use algorithm like Bresenham’s Line( http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm) but my attempts to implement have the same issue. How do I make enemies move in a straight line?

sentences:
Can a local UDK server have two clients connected locally? To do some basic testing on players interacting with other players I would need to have at least two players in my world. My solution is to run the server from my computer, then run two clients. When I run the second client and connect to the server, I find a weapon dropped by client 1 in the appropriate position(but no body). What happened?

server.bat:
C:\UDK\UDK-2015-01\Binaries\Win32\UDK.exe server ieTestMap?GoalScore=0?TimeLimit=0?Game=ie.ieGame  -log

client.bat:
C:\UDK\UDK-2015-01\Binaries\Win32\UDK.exe 127.0.0.1 -log

class ieGame extends UTDeathmatch;

simulated function PostBeginPlay()
{
}
defaultproperties
{
    bScoreDeaths=false
    PlayerControllerClass=class'ie.iePlayerController'
    DefaultPawnClass=class'ie.iePawn'

    bDelayedStart=false
    GameReplicationInfoClass=class'ie.ieGameReplicationInfo'
}

class iePlayerController extends UTPlayerController;
reliable client function ClientSetHUD(class<HUD> newHUDType)
{
    if(myHUD != none)
        myHUD.Destroy();

    myHUD = spawn(class'ieHUD', self);
}
defaultproperties
{
}

I have kept the other classes of my game 'bare-bone.'

sentences:
Why transform.find() does not need actual object[unity] I m new to unity and C#.

I suspect that transform.find() function below does not need actual object reference like

  player.transform.find()

because it transform find is already applied to the gameObject the script is attached to? Am I right?
Why transform.find() does not have any game object in front of it?

public class PlayerControl : MonoBehaviour{

private Transform groundCheck ;

void Awake()
{
    groundCheck = transform.Find("groundCheck");
}

sentences:
Preferred way of calculating run chances in Game of Cricket For modelling a simple game of cricket, Considering a batsman has a single attribute rating. I can go about deciding run chances by weighted probabilities. Something like
    if batsman.rating <= 30:
        # map of run: probability
        probabilites = {0: 0.7, 1: 0.1, 2: 0.1, 3:0.5, 4:0.5, 6:0 }
    elif 30 <batsman.rating < 60
        probabilites = {0: 0.7, 1: 0.1, 2: 0.1, 3:0.5, 4:0.5, 6:0 }
    else:
        probabilites = {0: 0.7, 1: 0.1, 2: 0.1, 3:0.5, 4:0.5, 6:0 }

Now there are two challenges:

What if I want finer control over batsman.rating and probabilities? How do I manage to keep the sum of all probabilities equal to 1?
How to manage a second attribute to a batsman, let's say aggression. Which can lower chances of 0 and increase chances of 6?

Initially tried dealing to have finer control like below:
# map of batsman.rating: probability,
rating_to_zero_chances = {0: 0.9, 10: 0.7, 30: 0.5, 60: 0.3, 90: 0.1}
rating_to_one_chances = {0: 0.9, 10: 0.7, 30: 0.5, 60: 0.3, 90: 0.1}
chances_of_zero =  <some library>.interpolate(rating_to_zero_chances).yvalue(batsman.rating)
chances_of_one =  <some library>.interpolate(rating_to_one_chances).yvalue(batsman.rating)
.
.
.
#do this for each run

The problem with this is that I cannot interpolate the probabilities such that they are equal to 1, Since the slope of runs for the interpolated data are different
For challenge 2, Initially tried handling it by making a probability density function and shifting the mean of the curve if the aggression is more. This creates a problem when there is a 3rd or 4th attribute added (such as timing etc are added).
Currently am planning to deal with a single run with its chance, rather than having to sum their probabilities to 1 like below:
zero_chance = interpolate(rating_to_zero_chances).yvalue(batsman.rating)
zero_chance += aggression / 100  # assuming aggression on 1-100
is_zero_scored = binom([0,1], p=zero_chance).random()
if is_zero_scored:
    return 0
one_chance = interpolate(rating_to_one_chances).yvalue(batsman.rating)
one_chance += aggression / 90  # assuming aggression on 1-100
is_one_scored = binom([0,1], p=one_chance).random()
if is_one_scored:
   return 1
. # similarly for 2
.
.

Is there any neater way to do this? I am new to game development and had learned about probability distributions recently. Are there some theoretical/ practically established concepts I should be looking at?
How do game developers handle and balance different chances of an event?

sentences:
How do I manage multiplayer login? How is the typical login, loading the level and spawning handled?
For example:

Client sends "iwanttologinwithcharacterx"
Server does some validity checks and instantiates characterx
Server sends back "loadlevelx"
Client sends "iaminloadingscreen", when finished sends "finishedloading"
Server sends "spawnyourcharacterx"

OR just after the "iwanttologinwithcharacterx" the server tells the client to handle steps 3, 4, and 5 without interaction?

I'm confused about what would be the ideal approach with the least room for errors.

Some info: The level in which players begin is always the same. Players can have multiple characters and during the game they often switch levels (this would be linked to my first question, how would I handle that cleanly? Don't destroy the playerobject between level load and just change their positions accordingly?)

sentences:
How is game development different from other software development? For a solid general purpose software developer, what specifically is different about game development, either fundamentally or just differences in degree?

I've done toy games like Tic-tac-toe, Tetris, and a brute-force sudoku solver (with UI) and I'm now embarking on a mid-sized project (mid-sized for being a single developer and not having done many games) and one thing I've found with this particular project is that separation of concerns is a lot harder since everything affects state, and every object can interact with every other object in a myriad of ways.

So far I've managed to keep the code reasonably clean for my satisfaction but I find that keeping clean code in non-trivial games is a lot harder than it is for my day job.

The game I'm working on is turn-based and the graphics are going to be fairly simple (web-based, mostly through DOM manipulation) so real time and 3d work aren't really applicable to me, but I'd still be interested in answers regarding those if they're interesting.  Mostly interested in general game logic though.

P.S. Feel free to retag this, I'm not really sure what tags are applicable.

sentences:
Unity3d: Rotation of game object Quaternion objectRotation = Quaternion.identity;
Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
objectRotation *= rotation;

gameObject.transform.rotation *= objectRotation;

here angle = -90

But the gameobject isn't rotating as desired,
when I replaced

gameObject.transform.rotation *= objectRotation;

with

 gameObject.transform.Rotate (0,0,angle);

Then the gameobject rotated -90 degree, dont understand why the Quaternion part isn't working? It rotated 90 degrees

sentences:
Linear filter problem with diagonal lines on adjecent tiles I am quite new at using OpenGL/GLSL. Basically, the project I am working on is my first 'real' experience with it.
I do not know whether this is relevant, but I use libgdx for my project.

Currently, I am trying to use the GL_LINEAR filters to draw tile of my (tile) map (before I was using GL_NEAREST without problems).

My map contains diagonal roads (just simple lines in this example). A partial overview/example of my map (using the nearest filter without corrections):

With the GL_NEAREST filter, initially I added a 1 pixel border, so the tiles were slightly overlapping and the diagonal roads were draw without the small gaps at the edges of the tiles.

This does not work with the GL_LINEAR filter, because I suppose that the overlapping parts are drawn twice, resulting in a darker 'blob':

I tried to get rid of the blobs, by making the horizontal lines shorter, but there is always an irregularity, either a blob or an 'decrease of line width' (as seen in the diagonal part of the line).

So I removed the 1 pixel additional border and have this as a result:

Now I am trying to fill in the 'gaps' by drawing the two triangular fillers like this:

but I can't get it completely right (this is the best I managed to get):

I suppose it is virtually impossible to get this perfectly right by 'manually' drawing these triangles. Also, when looking at the third image, the lines at the 'edges' (that need to be filled) are very sharp. I suppose this is problematic..?

So, my question is: how does one solve this problem? Do I need to prepare/modify my textures for this? Can I use a shader to fill the gaps automatically? Is manually filling the gaps with the triangles the way to go? Or is there some entirely different technique to have smooth diagonal lines that span multiple tiles?

sentences:
Armor damage reduction system? So I want to develop a Dota2-like armor system where damage reduction never reaches 100%.

Armor values be like:

Armor --- Reduction

10 ---------- 10%

20 ---------- 19%

30 ---------- 27%

40 ---------- 35%

How to make something like that, where reduction never reachs 100%?

sentences:
How can I write a dots effect shader when the character is behind an object? I watched an interesting effect while I was playing Super Mario Odyssey: when Mario or another character was behind an obstacle (walls, etc), a tiny gray silhouette mesh appears.

I tried to build something similar using an amplify shader with Unity but I could not achieve it.

How could I write this?

Here is an example from the game:

sentences:
How to make a iOS plugin for Unity3d I've passed last 2 days reading articles and book for understand how can i make a plugin for iOS in Unity. Basically i need just a demo for understand how it work. For now i've tried to make this process (with really poor luck):

I've started a new project in Unity and writed a simple script

using UnityEngine;

using System.Collections;

using System;

using System.Runtime.InteropServices;

public class CallPlugin : MonoBehaviour {

    [DllImport ("__Internal")]

    private static extern int test();

    void Start ()

    {

        Debug.Log(test());

    }

}

Then i've created a project in Xcode with this simple script:

extern "C"{

    int test()

    {

       int che = 5;

        return che;

    }

}

Then i've tried:

to put the .mm and .h in the Assets/Plugins/iOS = nothing

to build the unity project and than add the .h and .mm in the Xcode project = nothing

In Unity i will always get the EntryPointNotFoundException, so unity see the file but is unable to reach the method. The problem is... how?! :)

Maybe i miss something or i've done something wrong?
Thanks a lot for every help that you can give me :)

sentences:
Workflow for creating spherical heightmaps I'm wondering how I can create a spherical heightmap.

In my ideal workflow, you'd see a 3D sphere that you can edit using procedural terrain techniques (like World Creator) and that spherical terrain can be exported into six seamless images based on what layout you want your images to fold up into a cube in-game to create your planet.

Another option would be if you can at least tell the program you want specific images to tile with other images, such as the designated 'front, right, back, left' images tile with each other and the 'up, down' images seamlessly.

Specifically, I'm making planets for a game that wraps six images into a cube and 'inflates' them into a planetary terrain.

I've made a few basic heightmap sets in a program called Scape, and flipped them so at least four of the images mirror each other, then I edited the interior of those maps to all be different so the landscape isn't repetitive. However, manually editing the top and bottom maps is very daunting to get perfect, and I'm creating a dozen or more planets.

I'd like to know how to make 'front, right, back, left' images tile with 'up and down' images and I can edit the interiors of the images in a 3D program of choice. I've been directed to this site from search queries many times, but I'm a newbie to all things code so I have no clue how to use things such as the Diamond-Square method or any algorithms to achieve seamless textures (what program do you actually use, literally a python script you write in Notepad++ or something?).

sentences:
Failed to pass uniform in Metal shader modifier I'm trying to write a simple shader able to pass the color to be used for drawing in the fragment shader, through a uniform. I load the shader modifier and pass the uniform:

let fragmentShaderPath = bundle.pathForResource("Cube", ofType: "fragment")!
let fragmentShader = try String(contentsOfFile: fragmentShaderPath)

let shaderModifiers : [String:String] = [
    SCNShaderModifierEntryPointFragment : fragmentShader
]

cube.geometry?.shaderModifiers = shaderModifiers

SCNTransaction.begin()
cube.geometry?.setValue(NSValue(SCNVector4: SCNVector4Make(0.0,1.0,0.0,1.0)), forKey: "myColor")
SCNTransaction.commit()

And this is my fragment shader modifier code:

#include <metal_stdlib>
using namespace metal;

float4 myColor;

_output.color = myColor;

But nothing happens: the object is drawn as black. If I try declaring myColor as a uniform, I get an error:

sentences:
Get type of the object where attribute was declared - Hide In Derived Inspector Attribute I want to implement a custom Unity inspector attribute, like usual ones [HideInInspector] or [Range(0, 100f)].

This attribute should hide a field from the inspector if it's inherited from a base type, rather being defined directly in the type of the object we're inspecting.

So, for example, if I have these classes...

public class Enemy : MonoBehaviour {
    [SuperField]
    public int EnemyHealth;
}

public class GiantMonster : Enemy {
    [SuperField]
    public int Armor;
}

then the inspector for a base Enemy should show a control for the EnemyHealth variable, but when inspecting a GiantMonster we should not see a control for this variable.

So far I have my attribute:

public class SuperFieldAttribute : PropertyAttribute {}

which has its own PropertyDrawer:

[CustomPropertyDrawer(typeof(SuperFieldAttribute))]
public class SuperFieldDrawer : PropertyDrawer {

    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
        // ...
    }
}

Inside OnGUI I need to access/find the type where the field we're drawing was declared with the [SuperFieldAttribute].

So if SuperFieldDrawer.OnGUI() is called for the SerializedProperty corresponding to GiantMonster.EnemyHealth, I should be able to determine that the type where EnemyHealth was declared is Enemy and not GiantMonster. (I'll use this to hide the field so it's not drawn)

And if SuperFieldDrawer.OnGUI() is called for the SerializedProperty corresponding to GiantMonster.Armor, I should be able to determine that the type where Armor was declared is GiantMonster itself. (Meaning I should proceed and draw the field)

So far I've found ways to access the type of the component we're inspecting, but not the type where the field was first declared, so that's the missing piece I need to fill in.

It's OK if I use reflection and so on; any method is good, performance isn't a concern.

sentences: Jump function of player I'm developing game in marmalade sdk in c++. I have player in the area.and I wanna make him jump when i pressed a button.When I use this player.moveUp(5px); it just go up 5px, but he has to fall down back. so that when i use these: player.moveUp(5px); and player.movedown(5px); it do nothing.Because the fps is 30 and it's performing so fast. how i can fix that?

sentences:
Sizing a Box2D ground object I am developing a platformer game using SDL2 for graphics and Box2D for physics.
I am currently designing my levels and would like to know if it is better to make the static part of each level (ie: ground) one big (500+ units wide) polygon or to break each level up into multiple tiles just a few units wide.

The Box2D manual says that I should keep my objects small to avoid bugs in the floating point code but having a single large ground object seems like a resonable way of reducing the number of objects in the simulation.

So, can I make my ground object one large 500+ unit polygon or should I break it up into many smaller 1-2 unit polygons.

sentences:
What size should I scale my sprites to before importing them to Unity? I'm developing a game with an 8bit look. I want to target iOS and Android devices.

The real resolution for my backgrounds is 108 x 192.

Should I should put them in that same resolution and scale them in Unity using FilterMode / or s there a way to make the camera use nearest neighbor?

Or should I resize all my sprites before importing to something bigger? And if so to what size? 1920 x 1080?

sentences:
2D Collision detection: rewinding to moment of first intersection I am working on a collision system in a Platformer tile-based game. All tiles are AABB.

I am trying to implement "Rewind to Moment of First Intersection" mentioned in this post's second point.

The following case is to be considered:

Without vectors for clarity:

With vectors:

I am trying to find the vector \$\vec{w}\$, which is the vector \$\color{red}{\vec{v}}\$ multiplied by a factor \$f \in (0, 1) \$. All other vectors are known.

\$\color{red}{\vec{v}}\$ represents the reversed movement (or velocity) vector between current and previous frame, whereas \$\vec{w}\$ represents \$\color{red}{\vec{v}}\$ scaled in such a way, that translating the player object over \$\vec w\$ leaves the player in the moment of first intersection.

\$\color{green}{\vec{a}, \vec{b}}, \color{blue}{\vec{c}, \vec{d}}\$ represent the penetration depths of colliding objects on corresponding horizontal/vertical axises.

Tiles' width and height is also known.

Assuming that tiles are AABB, strictly-aligned, immovable and all share the same width/height - how do I find the vector \$\vec{w}\$?

Seeing pseudocode would be awesome.

I am also having surprisingly hard time finding any collision solving learning materials that would suit my needs; if anyone knows such materials, I would be thankful for sharing.

sentences:
No response to touch from XNA page after navigated from Silverlight page I am creating XNA/Silverlight game in Windows Phone Mango. Testing with the emulator in both the Release and Debug mode.

From the main page, I call a settings page written in Silverlight. Then I back out without making any changes. I enter the XNA page, the touch does not work properly.

If I start the app, then enter the XNA page straight from the main page, the touch does work.

In OnNavigatedTo:

TouchPanel.EnabledGestures = GestureType.Tap

Calling the settings page from main page:

NavigationService.Navigate( new Uri("/Pages/SettingPage.xaml", UriKind.Relative));

Games.cs buttons tap detection (only the detection lines):

while (TouchPanel.IsGestureAvailable && ! actionFound)
{
    GestureSample gestureSample = TouchPanel.ReadGesture();
    if (gestureSample.GestureType == GestureType.Tap)
    {
        // do work
    }
}

I add breakpoints in the 'do work' sections, it only gets hit after 3-4 taps.

I change the settings page to embedded Silverlight on XNA page, the same problem happens.

Just to make sure the timer is working, I change one of the sprites to move up and down in OnDraw. The sprite moves OK in both cases.

I been stuck on this for two days, and I got three more pages to code I need to call for a proper game.

Thanks in advance for any help.

sentences:
How to get started in Card Games My end goal is to play a card game with my friends from other locations over the internet. I am going to start with a card game like blackjack and want people to be able to play in real time or close to it. I am not really sure where to start here and in which language. I was kind of thinking of making a website that can do this but I am not really sure. My end goal is to play MTG with friends and build decks.

Any ideas on a language to choose or where to get started? My current plan is C# asp.net webforms... Would Java be a good idea? I dont need it fancy, just functional. I am good at C and C# and some Java.

Thanks.

sentences:
Update dependent values of Serializable C# classes on Inspector I have some data types' properties that depend on the input given into other attributes, but I haven't found in the Unity's API an elegant way to update them automagically on the Inspector.

As an example, let's say I have a struct that has a divider value. Since I want to save division computations, I also have on the class a multiplicative inverse value that depends on the divider's, so I'd rather multiply instead of dividing.

Example Code Snippet:

[Serializable]
public struct SomeNumbers
{
    [SerializeField] private float divider;
    private float multiplicativeInverse;

    /// When the divider is set, the multiplicative inverse is also set.
    public float Divider
    {
        get { return divider; }
        set
        {
            divider = value;
            multiplicativeInverse = (1f / divider);
        }
    }

    public float MultiplicativeInverse
    {
        get { return multiplicativeInverse; }
        private set { multiplicativeInverse = value; }
    }

    /// Constructor.
    public SomeNumbers(float divider) : this()
    {
        Divider = divider;
    }
}

public class ExampleScript : MonoBehaviour
{
    public float value;
    public SomeNumbers numbers;

    void Update()
    {
        float result = (value * numbers.MultiplicativeInverse); /// Instead of (value / numbers.divider)...
        Debug.Log("Result: " + result.ToString());
    }
}

What I'd like, is that each time I change the divider's field, the value under the hood (this case the multiplicative inverse) also gets changed, as if I used the Divider's setter. Since the idea is to have an independent data type, the approach of using OnValidate on a class that contains this struct would not be applicable, since that would be a hard case.

I could also set the Divider's setter on each class at Start/Awake do that for me, but that would be prone to be forgotten. I know about Property Drawers
, but I am not sure if that would be the right approach.

I hope the question was clear enough, if not make me know so I correct it. Thanks in advance.

sentences:
What is the right way to implement a loading screen in cocos2d-js? We have two scenes that are loaded with heavy computation; a map screen and a puzzle screen. When we change the scene from A to B, the app gets stuck on scene A for a while before it renders scene B.

So to avoid confusion, we created a dummy scene with 'Loading...' written on it and then on it's onEnter function we change to scene B. The game now gets stuck on the dummy loading scene now instead. But the loading scene takes in touch inputs and the device's native button inputs and triggers it as soon as scene B enters. So the map scrolls if you swipe on the loading scene and puzzle takes input on tapping the loading screen.

Has anyone implemented a proper loading scene with cocos2d-js?

sentences: How to use proximity sensor in android with unity3d? I want to create a android game with unity3d using proximity sensor an I don't know how to access that sensor with java script

sentences:
Alternatives to storing all my entities in an SQL database I've been trying to build my entity system based on pure SQL data storage as explained in this post series. The idea is that every entity or component is stored in an SQL table. I created my framework to manage that, only to realize that many SQL queries took more than 10ms, which is unsuitable for use in a game loop.

I first thought the delay was I/O-bound, so I created an in-memory MySQL cluster. This was better, but still not real-time enough for a game loop.

Has anyone built an SQL-based entity system? If so, how did you manage to keep query times manageable?

If an SQL database isn't feasible for performance issues, what data structure could I use to retain the entity system idea and the possibilities of direct SQL requests on components?

I've heard of many MMOs running on SQL. Do they use it for only part of the data or a full entity system? How to separate database-stored and classical memory-stored structures in that case?

Edit for clarification: Yes, all game data is stored in the database. If say I run my physics system it will first get data from SQL, then do its stuff, then insert the updated data back to the database.

sentences:
Will polishing my current project be a better learning experience than starting a new one? I started programming many years ago. Now I'm trying to make games. I have read many recommendations to start cloning some well known games like galaga, tetris, arkanoid, etc. I have also read that I should go for the whole game (including menus, sound, score, etc.).

Yesterday I finished the first complete version of my arkanoid clone. But it is far from over. I can still work on it for months (I program as a hobby in my free time) implementing a screen resolution switcher, remap of the control keys, power-ups falling from broken bricks, and a huge etc.

But I do not want to be forever learning how to clone ONE game. I have the urge to get to the next clone in order to apply some design ideas I have come upon while developing this arkanoid clone (at the same time I am reading the GoF book and much source code from Ludum Dare 21 game contest).

So the question is: Should I keep improving the arkanoid clone until it has all the features the original game had? or should I move to the next clone (there are almost infinite games to clone) and start mending the things I did wrong with the previous clone?

This can be a very subjective question, so please restrain the answers to the most effective way to learn how to make my own games (not cloning someone ideas). Thank you!

CLARIFICATION

In order to clarify what I have implemented I make this list:

Features implemented:

Bouncing capabilities (the ball bounces on walls, on bricks, and on the bar).
Sounds when bouncing on bricks and the bar, and when the player wins or loses.
Basic title menu (new game and exit only). Also in-game menu and win/lose menus.
Only three levels, but the map system is so easy I do not think it will teach me much (am I wrong?).

Features not-implemented:

Power-ups when breaking the bricks.
Complex bricks (with more than one "hit point" and invincible).
Better graphics (I am not really good at it).
Programming polishing (use more intensively the design patterns).

Here's a link to its (minimal) webpage: http://blog.acamara.es/piperine/
I kind of feel ashamed to show it, so please do not hit me too hard :-)

My question was related to the not-implemented features. I wondered what was the fastest (optimal) path to learn. 1) implement the not-implemented features in this project which is getting big, or 2) make a new game which probably will teach me those lessons and new ones.

ANSWER

I choose @ashes999 answer because, in my case, I think I should polish more and try to "ship" the game. I think all the other answers are also important to bear in mind, so if you came here having the same question, before taking a rush decision read all the discussion.

Thank you all!

sentences:
How to achieve uniform speed of movement on a bezier curve? I'm trying to move an image along Bezier curve. This is how I do it:

- (void)startFly
{
 [self runAction:[CCSequence actions:
             [CCBezierBy actionWithDuration:timeFlying bezier:[self getPathWithDirection:currentDirection]],
             [CCCallFuncN actionWithTarget:self selector:@selector(endFly)],
             nil]];

}

My issue is that the image moves not uniformly. In the beginning it's moving slowly and then it accelerates gradually and at the end it's moving really fast. What should I do to get rid of this acceleration?

sentences: How can I play and stop a Visual Effect Graph effect through script? Can anyone please give an example lines of code one could use to play/stop a VFX through C# script.

sentences:
How can I process extra mouse buttons using Monogame? I use Monogame for game development. For processing mouse input, I can use the Mouse class to query basic information like left click state, right click state, and screen position. That works fine for a generic three-button mouse (left, right, and scroll wheel), but falls short for more complex gaming mice with side buttons. My question is, how can I query those extra side buttons?

Since Mouse doesn't include that functionality, are there additional C# libraries I can use? How do I account for the fact that mice can have any number of extra buttons and wheels? Is there some standard for representing those additional buttons programatically?

Edit: This question originally also asked about complex keyboards with extra buttons or wheels. Now, I'm asking only about processing extra mouse buttons (ideally any number of extra buttons).

sentences:
Hand cards auto arrangement I'm making a card game with libgdx scene2d and what I'm trying to achieve is auto arrange the cards in a way the all fit the screen. This is what it looks now when the hand is full:

I have done that using a horizontalGroup and puting a -1/3 cardWidth space between the cards. I want the cards to spread evenly when some are removed.
I think I have to change the space between the cards whenever a card is removed or added but I don't know how much.

This is my code:

    CardActor[] cards = new CardActor[14];
    HorizontalGroup hand = new HorizontalGroup();
    int width = Gdx.graphics.getWidth()/10;
    int height = width * 2;
    hand.setBounds(width/2, -height/4, stage.getWidth()-width, height);
    hand.space(width / -3f);
    hand.align(Align.bottom | Align.center);
    for (int i = 0; i < cards.length; i++) {
        cards[i] = new CardActor(new Card(MathUtils.random(3), MathUtils.random(3, 10)));
        hand.addActor(cards[i]);
    }
    stage.addActor(hand);`

And this is the CardActor:

public class CardActor extends ImageButton {

public CardActor(Card card) {
    super(new TextureRegionDrawable(CardTextures
            .getTexture(card.getType(), card.getRank())));

    int width = Gdx.graphics.getWidth()/10;
    int height = width*2;
    getImageCell().prefSize(width, height);
    setBounds(getX(), getY(), getWidth(), getHeight());
    addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            onSelected();
        }
    });
}

sentences:
Should I create a Lua wrapper classes for my C++ classes, or should I bind them directly? I have a fairly standard architecture like this:

GameObjects have Transform, and can have Renderer, Rigidbody, Camera, LightSource, etc, and all of these classes have their corresponding methods.

GameObject has GetName, SetName, etc. and its own Transform.
Transform has GetPosition, SetPosition, etc.
Renderer has SetTexture, SetMaterial, etc. and references a Transform/GameObject.

If I want to implement Lua scripting using LuaBridge, and I would like to achieve an API similar to this...

function update()
    local gameObject = this()
    local renderer = gameObject:GetRenderer()
    renderer:SetTexture("Brick")
    local rigidbody = gameObject:GetRigidbody()
    rigidbody:SetMass(10)
    local transform = gameObject:GetTransform()
    transform:SetPosition(1, 10, -5)
end

...then which of these should I choose?

Solution A:

I bind every C++ class directly to Lua classes.

In this way I have to implement some extra scripting quality-of-life methods for the classes, so no big deal.
But it's not so easy to see whether a method is callable in Lua script, or is only available in native code. (for example I need to name method XYZ as LuaXYZ)
Methods which are only created so that scripting is made easier, are mixed with core functionality.

Solution B:

I create a wrapper class for every required class, like: Renderer->RendererHandler, Transform->Transform Handler, GameObject->GameObjectHandler, etc.

Lua and core functionality is separated, much easier to see what is the scripting API and what is not.
For every class I have to create another similar class which got a lot of methods, which are just calling the calling the same method in the wrapped class. Like GameObjectHandler->GetName() just calls GameObject->GetName()

Thanks in advance.

Summary:

In my opinion, Solution B is the best. That is the easiest to handle, the most transparent, and the most separated.
But I got lots of new classes and new dependencies, which messes up my clean architecture. Solution A makes expanding functionality much easier to handle (I dont have to create a lua interface class for new components).
But error handling is worse, because I don't have to care about if a scripter uses a NULL pointer (like a non existent component)
But if that happens due to my engine implementation I'll have to handle it seriously. (And how can I signal whether a NULL pointer in a method is "don't care type" or "serious problem" type?)
So currently I think that the best solution is this:

class GameObject {
   ...

   GetName()
   SetName()

   Lua_getName()
   Lua_setName()

   ...

I don't have to create "Lua interface" classes, and handle that mess that comes with it.
I directly bind the Lua functions to the classes, but I create new methods in that class for scripting purposes.
For example I implement GetName() for "InEngine" functionality, and a Lua_getName() which is bound to Lua functions and used only in scripts.
The problem here is that, yeah you can't call InEngine methods from Lua because it's not bound. But what about calling Lua_getName() instead of GetName()?

There is no compile check for that, and if the developer is tired and makes this mistake, it will be hell to debug that.

sentences:
Literature about Open World Games, Freedom to Choose I'm doing a diploma thesis about the development of games with freedom to choose or open world.

Topics will be i.e. development issues in programming and the design itself, mechanics etc.

For that I need literature and lot's of it. Do you have any suggestions?

sentences:
Collider does not call callback functions I have a script that will create new GameObjects and will place it where the mouse is placed on the terrain. Now I need to have a check for collision on other already placed GameObjects on the field.

I check different tutorials and documentation and cannot find a way to do this in code.

My code looks like:

objectToPlace = (GameObject)AssetDatabase.LoadAssetAtPath("Assets/Game/3D Models/Buildings/" + objectName + ".fbx", typeof(GameObject));
objectToPlace.SetActive(true);
objectToPlace.transform.localScale = new Vector3(1, 1, 1);
objectToPlace = Instantiate(objectToPlace);

objectToPlace.transform.Rotate(Vector3.right * 90);

BoxCollider collider = (BoxCollider)objectToPlace.AddComponent(typeof(BoxCollider));
collider.isTrigger = true;

In the same class as the above code I have OnTriggerEnter function. But that function is not called. How can I link the Collider to that function in Unity 5.6?

I also tried using the Physics.CheckBox for checking if my new create gameObject does not collide to any other object. But without any succes.

sentences:
Manipulating an animation towards a target object (ie. The hand and arm lean towards the target) I am trying to make a boxing game just for fun (I dont expect the end product to be anything decent lol) . I have my boxers in the ring and they are animated quite well so far, with Idle, and punch Left and Right. They also rotate so they are always looking at each other.

What I want to do is give the punch some aim towards the head. I will give the punch a set amount which it can move from the standard animation and move the hand bone in the direction of the targets head object. But I don't know how to do this :S

So far i have used dragged the 3 animation files into Mecanim and coded it to do the animations when a button is pressed.

Is there a way to manipulate the animation in this way? (ie. actually make the arm reach towards the target object )

sentences: How to create a vertex buffer that provides this pattern? I have a series of vertices that I want to layout with the following configuration, but I haven't been able to find out how to do this with the square and X pattern.  Most of the time I have generally seen a quad split  into two triangles usually using triangle lists.  I suspect this is using triangle strips but I am not exactly sure how to do it.  Could anyone help?

sentences:
Are metal slug art assets free use? I'm making a mobile game and I've gotten by with completely free art assets so far, but I have an explosion from metal slug. I love it and it's perfect, but I don't want to get sued. I've seen metal slug art assets posted around the internet on various clip art websites, but haven't found any statements outright saying they're free to use in one's own commercial application.

Could someone show me a link saying whether or not metal slug assets are free to use?

sentences:
Transforming bounding spheres When testing bounding spheres as part of the collision detection process, I'm using this method:

    public static BoundingSphere TransformBoundingSphere(Matrix m, BoundingSphere b)
    {
        var center = b.Center;
        var edge = b.Center + Vector3.Right * b.Radius;

        var worldCenter = Vector3.Transform(center, m);
        var worldEdge = Vector3.Transform(edge, m);

        return new BoundingSphere(worldCenter, (worldEdge - worldCenter).Length());
    }

... to get a sphere in world coordinates (where m is a world matrix for the object encompassed by the original sphere).

(Yes, I'm aware that this relies on uniform scaling.)

This is obvious, reliable and easy, but is there a better way?

sentences:
Examples of TIN-based terrain formats in FPS games Do you know of any terrain formats for FPS games that use a triangulated irregular network (TIN) instead of a grid for elevation representation? Or at least a game whose development tools accept a TIN as input for terrain elevation?

The only example I have is the ASCII Scene Export (ASE) format that can be used as input in the terrain editor for the Unreal engine (UnrealEd). I am mainly looking for formats that support terrain holes (both visually and in collision detection) and allow underground models. I want to avoid having to carve and cover gridded terrain elevation grids to place underground models.

sentences:
3D Sandbox game: Detecting when a block is no longer attached to the ground I've been playing "Ace of Spades" recently, mostly because my son likes that. They have a feature that my son calls "gravity", but I don't know the official name. Anyway, the effect of "gravity" is that if you have a tower, and you remove the last block at the bottom, the game engine detects that the rest of the tower is not connected to the game world/ground anymore, and makes the tower fall apart.

My question is: how do you quickly detect that a part of the game world is not connected anymore (and which part)?

While "Ace of Spades" levels are fixed-size, an algorithm that also works for "infinite worlds" would be preferred. If that kind of problem has a specific name, I'd like to know that as well, since it helps when looking for possible implementations ...

I think this is somehow similar to how a garbage collector works: when there is no "path" from the ground to a block, then it is disconnected (garbage).

sentences:
What is the purpose of a guild bank? I've seen guild banks in Wow, or Dofus, and other MMO games.

In the guild I've been a part of, we mostly used the bank as storage; resources stored that end up not being used are wasted. Sometimes there is a free share policy, but there is always that one guy who will take stuff he does not really need and sells it.

This led me to wonder what is the original purpose of a guild bank, what do players like to use it for, and how can a game help them do it?

sentences:
My FollowPlayer script runs AWAY from the player? With the script I'm using, it would make whatever model it was attached to, follow the player when they were close enough. Even though I have NOT updated to the newer version of Unity, the script isn't working how it used to.

While it does make the model face towards the player, it no longer follows/chases then and I have a suspicion that it may be because I am using rigidbody for the player controls instead of character controller (due to Character Controller no longer working after the latest Unity, which I did NOT update to)

Below is a copy of the script I'm using, which is super simple:

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

public class FollowPlayer : MonoBehaviour {

    //The target player
    public Transform Player;
    //At what distance will the enemy walk towards the player?
    public float walkingDistance = 10.0f;
    //In what time will the enemy complete the journey between its position and the players position
    public float smoothTime = 10.0f;
    //Vector3 used to store the velocity of the enemy
    private Vector3 smoothVelocity = Vector3.zero;

    //Call every frame
    void Update()
    {
        //Look at the player
        transform.LookAt(Player);

        //Calculate distance between player
        float distance = Vector3.Distance(transform.position, Player.position);

        //If the distance is smaller than the walkingDistance
        if (distance < walkingDistance)
        {
            //Move the enemy towards the player with smoothdamp
            transform.position = Vector3.SmoothDamp(
                transform.position,
                Player.position,
                ref smoothVelocity,
                smoothTime);
        }
    }
}

Any ideas why the model isn't chasing the player? I keep changing the settings to see if it's anything silly like that, but no matter what I put it, or what I do, the model just wants to stare but not follow or chase the player :/

Here's a screenshot of the hierarchy:

[

And the player model does have the player tag. No matter what values I put into the inspector for the FollowPlayer script, the model with the attached script will not move towards the player.

UPDATE: I figured out it was because the model with the script attached didn't have a rigidbody component. The problem now is, the model runs away from the player.

sentences:
Using gluLookAt to move camera in 2D iPhone game? I'm trying to use gluLookAt to move the camera in my iPhone game, but every time I've tried to use gluLookAt my screen just goes "blank" ( grey in this case )

I'm trying to render a simple triangle and to move the camera, this is my code:

to setup my scene I do:

glViewport(0, 0, backingWidth, backingHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glRotatef(-90.0, 0.0, 0.0, 1.0); //using iPhone in horizontal mode
glOrthof(-240, 240, -160, 160, -1, 1);
glMatrixMode(GL_MODELVIEW);

then my "triangle rendering" code looks like:

GLfloat  triangle[] = {0, 100, 100, 0, -100, 0,};
glClearColor(0.7, 0.7, 0.7, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f(1.0, 0.0, 0.0, 1.0);
glVertexPointer(2, GL_FLOAT, 0, &triangle);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableClientState(GL_VERTEX_ARRAY);

This draws a red triangle in the middle of the screen, when I try to apply gluLookAt ( I got the implementation of the function from Cocos2D so I asume it's correct ), i do:

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,1,0,0,0,0,0,1); // try to move the camera a bit ?

GLfloat  triangle[] = {0, 100, 100, 0, -100, 0,};
glClearColor(0.7, 0.7, 0.7, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
glColor4f(1.0, 0.0, 0.0, 1.0);
glVertexPointer(2, GL_FLOAT, 0, &triangle);
glDrawArrays(GL_TRIANGLES, 0, 6);
glDisableClientState(GL_VERTEX_ARRAY);

This leads me to grey screen (glClearColor is grey), I've tried all sort of things and read what I've found about gluLookAt on the net, but no luck :(, if someone could explain me or show me how to move to move the camera in a top-down fashion ( zelda, etc ), I would really appreciate it.

Thanks!

sentences:
Unity3D) Is there a way not to draw line renderer if vertex pos is zero? I make a curved line with line renderer.
and a sphere move along it.
i want to draw a line only behind the sphere.

so i do something like this.

``
lr.positionCount = 256;

    while (delta < time)
    {
        lr.SetPosition(i++, curPos);

        yield return new WaitForFixedUpdate();
    }

``

and the problem is, because of i set the size of Positions 256,
if time is short, there are zero vectors in position.
so line renderer draw meaningless line.

is there a way to set PositionCount dynamically like List?
or any good way to not draw if positions are zero?

sentences:
Why can't I see how many installs my game has on its Google Play page? I made an Android game, and I uploaded and published it to Google Play. Then, I installed it on my phone.

Why can't I see the install count, on its Google Play page?

sentences:
Compiling a shader with fxc results in invalid ps_5_0 output semantic 'COLOR0' I'm attempting to compile a shader at the command prompt.  What am I doing wrong that would make it generate this error?

fxc /Od /Zi /T ps_5_0 /E "ps_main" /Fo "basic.pso" "basic.ps"

Here is the pixel shader

struct VS_OUTPUT
{
    float4 Color    : COLOR0;
};

float4 ps_main(VS_OUTPUT input) : COLOR0
{
    return input.Color;
}

The return is:

<path here>\basic.ps(8,33-40): error X4502: invalid ps_5_0 output semantic 'COLOR0'

compilation failed; no code produced

sentences:
Is OpenGL 1.x deprecated? I'm familiar with OpenGL 1.x. I typically use SDL with OpenGL 1.4 on Linux, and I've never run into problems, even on my modern system.

I've read on the OpenGL site about deprecation and compatibility contexts, but I'm still unclear as to whether it's safe to continue to use old versions of OpenGL, as opposed to using old features in newer versions.

  When functionality is marked deprecated ... future versions of OpenGL may remove it.

Does deprecation simply imply that those functions can't be used alongside newer features?

More specifically, are there any systems today (other than embedded) where OpenGL 1.x isn't available? The old-skool stuff like, glBegin, glEnd, glDrawPixels, etc.

Note: I'm not a professional games developer, so you'll have to excuse my ignorance. I'm working on a mostly 2D game that I would like to keep multi-platform, supporting at least Linux, Mac, and Windows.

sentences:
Why is the camera view pink in Unity 5? I am a beginner. I created a 3D project with a cube object, and I am getting this pink display, in the camera view.

Why is the camera view pink?

sentences:
Unity-Animation parameters are not being set I have the following animation controller:

with two parameters of walkingSpeed and Jump. I have the following code which should change the values:

animator.SetFloat("walkingSpeed",0.9f);
animator.SetBool("Jump",true);

and animator is the correctly referenced animator object. However the values that the parameters are set to do not appear to change in the animator window, nor do they appear to impact what is happening on the screen. However they do seem to impact the values obtained when doing the following:

animator.GetFloat("walkingSpeed");

The animator consists of the shown blend tree, which works correctly and is always active, however due to the values not being changed it does not blends, and always acts as if the value with which it blends (walkingSpeed is 0).

What is going on?

sentences:
Problem unrolling loop in compute shader I'm pretty new to compute shaders and shader writing in general. I'm trying to write a compute shader for a procedural generation project I'm working on, it's purpose is to blend biomes together. The function works by taking a sample of points around the point it's trying to calculate, and counting up how many points of each biome are in the sample, then it uses this info to blend the biomes at the given point.
The problem is that I have to loop through all of the sample points, and I keep getting the error “forced to unroll loop, but unrolling failed.” I've tried various different things to try and fix such as using the [loop] attribute, in which case I get “can't unroll loops marked with loop attribute”, and I've tried using the [unroll()] attribute to specify the amount of iterations the loop goes through, but I get the unrolling failed message again. I was wondering if anyone could suggest a solution? Here is my code:
#pragma kernel CSMain

struct BlendInputData
{
    int x;
    int z;
    int i;
    int blendRadius;
    int biomeIndexIterat;
    int xSize;
    int zSize;
};

StructuredBuffer<BlendInputData> inputData;
StructuredBuffer<int> biomeList;
RWStructuredBuffer<float4> outputData;

static int blendRadius = inputData[0].blendRadius;
static int biomeIndexIterat = inputData[0].biomeIndexIterat;
static int xSize = inputData[0].xSize;
static int zSize = inputData[0].zSize;

int MeshIndexToBiomeIndex(int meshIndex)
{
    int biomeIndex = meshIndex;
    biomeIndex += (2 * blendRadius * blendRadius) + (blendRadius * xSize);
    biomeIndex += floor((meshIndex / (xSize + 1)) + 1) * 2 * blendRadius;
    return biomeIndex;
};

float Vector2Distance(int xOne, int yOne, int xTwo, int yTwo)
{
    float distance = sqrt(pow(xOne - xTwo, 2) + pow(yOne - yTwo, 2));
    return distance;
};

[numthreads(1, 1, 1)]

void CSMain(uint3 id : SV_DispatchThreadID)
{
    RWStructuredBuffer<float> blendedBiome;
    int x = inputData[id.x].x;
    int z = inputData[id.x].z;
    int i = inputData[id.x].i;
    int index = MeshIndexToBiomeIndex(i) - biomeIndexIterat - blendRadius;
    for (int sampleZ = -blendRadius; sampleZ <= blendRadius; sampleZ++)
    {
        for (int sampleX = -blendRadius; sampleX <= blendRadius; sampleX++)
        {
            int iterator = 1 - (floor(Vector2Distance(x, z, sampleX + x, sampleZ + z) / blendRadius));
            int biome = biomeList[index];
            blendedBiome[biome] += iterator;
            index++;
        }
        index += (biomeIndexIterat / blendRadius) - (2 * blendRadius) - 1;
    }

    float denominator = pow(blendedBiome[0], 2) + pow(blendedBiome[1], 2) + pow(blendedBiome[2], 2) + pow(blendedBiome[3], 2);
    blendedBiome[0] = pow(blendedBiome[0], 2) / denominator;
    blendedBiome[1] = pow(blendedBiome[1], 2) / denominator;
    blendedBiome[2] = pow(blendedBiome[2], 2) / denominator;
    blendedBiome[3] = pow(blendedBiome[3], 2) / denominator;

    outputData[id.x].x = blendedBiome[0];
    outputData[id.x].y = blendedBiome[1];
    outputData[id.x].z = blendedBiome[2];
    outputData[id.x].w = blendedBiome[3];
}

sentences:
Physics in carrom like game using cocos2d + Box2D I am working on carrom like game using cocos2d + Box2D. I set world gravity(0,0), want gravity in z-axis. I set following values for coin and striker body:

Coin body (circle with radius - 15/PTM_RATIO):

density = 20.0f;
friction = 0.4f;
restitution = 0.6f;

Striker body (circle with radius - 15/PTM_RATIO):

density = 25.0f;
friction = 0.6f;
restitution = 0.3f;

Output is not smooth. When I apply ApplyLinearImpulse(force,position) the coin movement looks like floating in the air - takes too much time to stop.

What values for coin and striker make it look like real carrom?

sentences:
Marketing a browser game with a specific audience My issue is that I have extensively developed an online browser game, but mainly the marketing and independent developer guides tailor to action packed executable games. My game also tailors to a specific audience that is not typically on the indie gaming promotional websites. Namely those interested in Politics, Economy, Law, and/or Sociology.

(My first issue) I wanted to know if there are any suggestions, ideas, or references to any resources that may bring marketing value to my gaming community pre and post-launch? I have began development on my beta campaign already to include some crowd funding websites (mostly for promotion), a press kit, advertisements, and the like. However I would greatly appreciate more resources for the development and launch, namely for the target audience.

(My second issue) Many of the marketing strategies for games depend on a video, game photos, etc. While I can take photos of the screen, there are not too many things I can do for a video except add some stock footage and dress it up by explaining game mechanics and showing some photos of the game. Would that contribute to the game or is it just a waste of time? (Feel free to suggest any ideas for this as well if you are willing).

Thank you for your assistance!

sentences:
How to load images on startup I want to load all my game's images on the game's startup and have a loading bar to show it's progress. I already know how to create and display the loading bar, but I can't figure out how to load the images, and then add the image's frames to it's array.

Not using SLick

sentences:
Extending the camera vs CameraHelper class vs camera field I am following an eBook called "Learning Libgdx Game Development"

In it, the author implements a CameraHelper class that implements Zoom, target-following behaviour, and probably some other things along the way.

Can I do this just by extending the camera class, or using composition?

Approaching it like this seems like a clearer code to me:

public class Camera extends OrthographicCamera {
    GameObject target;
    boolean followTarget;

    Camera(float viewWidth, float viewHeight){
        super(viewWidth, viewHeight);
    }

    public void setTarget(GameObject target) {
        this.target = target;
    }

    public GameObject getTarget() {
        return target;
    }

    @Override
    public void update(){
        if(followTarget && target != null){
            this.position.x = target.position.x;
            this.position.y = target.position.y;
        }
        update(true);
    }
}

Any problems with this that I can expect?

sentences:
3D Vector "End Point" Calculation for procedural Vector Graphics 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.

sentences:
Platforms for sharing content and expertise Are there any platforms / sites where people can share expertise in game development and where you can share (either payed or free) digital content (like images, sounds, animations but also frameworks or libraries) to be used in games?
I'd also like the possibility to contact users and request specific pieces of content.

I'd like to start out as an indie developer and have programming skills but I lack the experience and time to create ingame artwork and sound.
Is there any site where I could locate other people (artists mostly) who would want to work on a game for free?

I know I can get most technical questions answered on this site and I have some contacts but I'm affraid this won't be enough.

sentences:
Game Editor - When screen is clicked, how do you identify which object that is clicked? I'm trying to create a Game Editor, currently just placing different types of Shapes and such. I'm doing this in Windows Forms while drawing the 3D with XNA. So, if I have a couple of Shapes on the screen and I click the screen I want to be able to identify "which" of these objects you clicked.

What is the best method for this? Since having two objects one behind the other, it should be able to recognize the one in front and not the one behind it and also if I rotate the camera and click on the one behind it - it should identify it and not the first one.

Are there any smart ways to go about this?

sentences: How can I pack repeated textures into one texture efficiently? I have an obj mesh with some textures, several of them are repeated(uvs are not within [0,1]). I'd like to merge all those textures into one texture and transform the uvs of obj.

sentences:
How can you run events after a set amount of time in SFML 2.0? I've been using SFML 1.6 for a while and recently upgraded to 2.0, apparently there's a new sf::Time type however I'm clueless as to how I can achieve running of a certain function after a set amount of time.

How would you go about doing this? Say you want something to execute after 5 seconds, how would you do it in SFML?

sentences:
Does CharacterController benefit from adding lerp? Does CharacterController benefit from adding lerp?

as in this script.

mouse = Input.GetAxis("Mouse X");
current = Mathf.Lerp(current, mouse, Time.deltaTime * 10);
transform.Rotate(0, current * 600 * Time.deltaTime, 0);

I was using,

transform.Rotate(0, mouse * 18, 0);

But read into the idea of lerp and wrote that.

sentences:
Height and width of a Farseer body? I have a body named PersonA. If PersonA collides with another body, the width and height of that body should be saved. I tried it like this but I always get error messages that "Width" and "Height" don't exist.

bool PersonA_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
{
//How tall and broad is the body that collided with PersonA
float Width = fixtureB.Body.Width;
float Height = fixtureB.Body.Height;

return true;
}

How can I get the width and height of another body? What should I change?

sentences:
Render Texture shows opposite view of camera when rendered? I am using render texture (cube) to render what camera sees into it. However, the render texture shows me opposite side of cameras view (flipped) instead of what camera sees. Any solution for this?

    void Update()
    {
         renderTexture.isPowerOfTwo = true;
         //Graphics.SetRenderTarget(renderTexture, 0, CubemapFace.PositiveZ);
         renderTexture.dimension = TextureDimension.Cube;
         camera.RenderToCubemap(renderTexture, 63);
    }

What camera sees:

What Render Texture shows:

What happens when I rotate Render Texture manually by hand 180 degrees:

So, instead of rotating per hand, what I want is for the render texture to be rotated via code so that what is in camera view is shown exactly the same in render texture view.

sentences:
Where do I find the code for the open-source game Warmux? I found an open source game called Warmux but I don't know how to get the code.  I downloaded the file from here, but I don't know where to go from there.  I didn't find any instructions on how to use the source.
While I was looking for it, I came across something called git and repo. Do I use that?

sentences: Control Entity Moving Speed Without Using a Delay Function In a Tetris game I'm trying to make (using C++/SDL), I need to control the falling speed of, say, one block. I have successfully done this by incramenting its y value then setting SDL_Delay(200). So every 200 ms, the block moves down one unit. However, using SDL_Delay lags the whole game, and using the controls to move the block around gets delayed as well. I need to control the falling speed in a way that nothing gets delayed except the falling of the block. How can I achieve this? Thanks.

sentences: Separate data tables for different item types? I have two types of items in my game, consumables, and equipment. For my database, should I store them in two different tables, or all in one big items table?

sentences:
How can I store in-game money so that nobody can manipulate the amount? People get coins for completed tasks(for example completing a level) in my game. In addition, they can purchase coins(they need to pay for that with real money) in the app store. With these coins, people can purchase different items in the game.

Is it easy for somebody to manipulate the amount of coins when I store it as an integer variable in a text file on the device(iOS and Android phones and tablets)?

What is the best way in MonoGame/Xamarin to store the amount of coins so that nobody can manipulate it afterwards?

sentences:
Optimization with VBOs I am currently working on a cube engine and am experiencing some issues with CPU optimization.

I store all my quad VBO data inside a Block (at x,y,z of a chunk) class, which is stored inside an array with a length of 6 (the maximum number of cube faces). I would prefer to merge it all inside one VBO. The only issue I am having with this is that I cannot find a way to render 6 different textures on each face.

    GL11.glPushMatrix();
    GL11.glTranslatef(LENGTH.x * origin.x, LENGTH.y * origin.y, LENGTH.z * origin.z);
    for (int z = 0; z < LENGTH.z; z++) {
        for (int y = 0; y < LENGTH.y; y++) {
            for (int x = 0; x < LENGTH.x; x++) {
                Block b = get(x, y, z);
                if (b.getBlockType().isTransparent() || b.getVisibleFaces() == 0)
                    continue;
                GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
                GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
                for (int i=0; i < b.getVertexBuffers().length; i++) {
                    QuadVBO q = b.getVertexBuffers()[i];
                    if (q == null || !q.isValid())
                        continue;
                    Game.GRASS.bind(i);
                    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, QuadVBO.faceHandles[i].get(0));
                    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0);
                    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, q.getVertexHandle());
                    GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0);
                    GL11.glNormalPointer(GL11.GL_FLOAT, 0, q.getPointerVerticesBytes());
                    GL11.glDrawArrays(GL11.GL_QUADS, 0, q.getVerticesCount());
                    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
                }
                GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
                GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
            }
        }
    }
    GL11.glPopMatrix();

I am aware that this is a horrible way to do it but I cannot seem to find a better way to render these cubes on a screen, any help would be extremely appreciated!

sentences: How to start development for PSN? I'm interested in making a game that can be distributed on PSN. Any suggestions?

sentences:
What kind of projection is demonstrated in this screenshot? I want to know what projection is used in the following game:

The game is Goodgame Empire.

sentences:
How area-of-effect effects are projected into games world? I see a lot of skills in the games I play where they have a skill or a search area that projects a drawing on to a map, like a circle or something similar and I have no idea how that is done, and I don't think they use a texture to draw it. For the projection, I think, they use some kind of ray-cast to find the shape of the map and then go from there but I may be far off from truth.

In the linked image example you can see the circle is projected on the flat surface and the stairs. (And how is that glow effect around the circle achieved or is that part of a texture?)

Can someone tell me how is that done or point me to the right direction?

sentences:
How do I fix missing anti-aliasing in the Unity scene view and game? Both the editor and the game seem to lack anti-aliasing even though quality is set to Ultra.
I chose the "3D" project template when I created the project, so I am using the build-in render pipeline.

sentences:
Aligning bullet's position in Asteroid Game I'm writing an asteroid game and I would like to align the bullets on the ship's tip. I also want when the ship fires, the bullet gets the same orientation(angle, direction) of the ship and also be fired at a different velocity.

I'm drawing the ship by the following code:

gl::drawLine(Vec2f(-43,-52),Vec2f(59,1));
gl::drawLine(Vec2f(-14,-31),Vec2f(-14,38));
gl::drawLine(Vec2f(59,1),Vec2f(-43,54));

sentences:
How can I create a buffer suitable for dynamic updates in SharpDX? I want to set a buffer that is updated every frame but can't figure it out, what i have to do.

The only working thing i have is this:

mdexcription = new BufferDescription(Matrix.SizeInBytes * Matrices.Length, ResourceUsage.Dynamic, BindFlags.VertexBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0);
instanceBuffer = SharpDX.Direct3D11.Buffer.Create(Device, Matrices, mdexcription);

vBB = new VertexBufferBinding(instanceBuffer, Matrix.SizeInBytes, 0);
DeviceContext.InputAssembler.SetVertexBuffers(1, vBB);

Draw:

//Change Matrices (Matrix[]) every frame...
instanceBuffer.Dispose();
instanceBuffer = SharpDX.Direct3D11.Buffer.Create(Device, Matrices, mdexcription);

vBB = new VertexBufferBinding(instanceBuffer, Matrix.SizeInBytes, 0);
DeviceContext.InputAssembler.SetVertexBuffers(1, vBB);

I guess Dispose() and creating a new buffer is slow and can be done much faster.

I've read about DataStream but i do not know, how to set this up properly.

What steps do i have to do to set up a DataStream to achieve fast every-frame update?

Edit:

Finally got it. I used that:

mdescription = new BufferDescription(Matrix.SizeInBytes * Matrices.Length, ResourceUsage.Dynamic, BindFlags.VertexBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0);
instanceBuffer = SharpDX.Direct3D11.Buffer.Create(Device, Matrices, mdescription);

vBB = new VertexBufferBinding(instanceBuffer, Matrix.SizeInBytes, 0);
DeviceContext.InputAssembler.SetVertexBuffers(instSlot, vBB);

Draw:

DataStream stream;
var dataBox = DeviceContext.MapSubresource(instanceBuffer, MapMode.WriteDiscard, SharpDX.Direct3D11.MapFlags.None, out stream);
stream.WriteRange(Matrices);
DeviceContext.UnmapSubresource(instanceBuffer, 0); //to update the data on GPU

stream.Dispose();

sentences:
Change entity's size based on health [ECS] I'm making a kind of entity component system framework and I have a doubt:

I have two components 'health_damage', 'physic' (which contains position, weight,...) and 'sprite' (position, dimensions...).

When this entity takes damage I want to reduce its dimensions based on health percentage (50% life -> 50% original size) and I thought that I need to create a new system 'change_dimensions_on_hit', register the entity and on hit send a message to it which will update the dimensions (and weight) based on health. And that's, in my opinion, it's fine.

The problem is: imagine I create an item which increases the dimensions of the entity when it's picked up. It would increase the size of a fixed amount without knowing it's original or not (maybe it's at 10%) and when the entity regains health it will become huge
Ex.
Health = 10; MaxHealth = 100
ActiveDimensions = 10 (original is 100);
I take a +20 size object and then a full heal item:
ActiveDimensions would be (10 + 20)/0.1*1.0f = 300 (and not 120)

These are the solutions I found (but I don't really like anyone of them):

storing for each 'mutable variable' its current and max value like for health, so I can always calculate the current percentage and change correctly the original size. I think that's not a good idea because really few entities would have this behaviour and so I would waste a lot of memory.
make the physic component aware of the existence of the health component and (if a flag is set) look for che percentage when it is modified. I think it similar to the first and it also forces a tied relationship which I think it's even worse.
(the one that I think it's the best) I'm using a message system to handle things such as damage on collision, creation of entities... I still need to figure if it's the best way but I'm pretty sure of this. I can use it to handle everything possible and so also the changing of sizes: the item picked up sends a message to the entity 'grow up/shrink'; the entity spreads it to all the systems which is registered to and they can modify the message data before it's handled by the 'base components' (physic, dimensions,...). So it will be received at first by the change_dimensions_on_hit which would adjust the amount of growing based on current health. At the moment I handle messages in a very specific way:
1) it's handled by the systems which will modify them directly (ex.'double_growing_items')
2) by the ones which need to read other components to perform the change (ex. 'Change_dimensions_on_hit')
3) by the base components such as dimensions.
This solution seems the best to me, even if has its own limitation (I have a specific path for each message and I'll face problems such as 'I need that this message, in this case, is handled first by this system and then from that, and not the opposite') and relies entirely on a message system which isn't the best solution performance wise (but I don't think that's a real problem).

Any advice and suggestion is welcomed. Do you think message system is the right way? Or maybe the firsts methods with slightly changes? Something totally new? (I can't change too much because I need to finish this project in one two month for the high school's final exam)

sentences:
How can I calculate current level from total XP, when each level requires proportionally more XP? In my game, XP needed to reach the next level is Current Level × Level Threshold.  Given that, how can I get my current level from the total XP ever earned?

For example:

Level Threshold = 50
Current Level = 1

Starting at level 1, I would need (1 × 50) = 50 XP to get to level 2, and so on.

Level 1: 50 XP needed to reach level 2
Level 2: 100 more XP needed to reach level 3
Level 3: 150 more XP needed to reach level 4

In other words, the progression table is as follows:

Level 1: 0 XP to 49 XP
Level 2: 50 XP to 149 XP
Level 3: 150 XP to 299 XP
Level 4: 300 XP to 499 XP

If I have 300 XP, I'll just reached level 4. How can I calculate that generally?

sentences:
Pygame circular cropping/masks I have been going through the documentation and the Pygame functions and classes today, but couldn't find a reasonable way to either create a circular crop of an image or how to use a mask to perform this: assume an empty circle with a line width of 50px, with a single key color, that is supposed to be removed from surface A and then replaced with the contents of the same pixels on surface B (perhaps I'm mixing definitions here between Pygame's Mask and image editors' - such as Photoshop - masks).

I know surfarray can be used for the task (after a list of pixel coordinates is extracted from surface B), but my tests were too slow and ended up hanging the main loop.

Is there a way to achieve the described above through an efficient and quick method, that can be embedded into the main loop of the application without a significant drawback to the overall processing?

sentences: Why doesn't games use CORDIC for sin and cos? If the game devs add CORDIC sin cos calculation to their games, their games will have much better FPS. Why do they use normal sin cos function (e.g. Math.sin) instead of CORDIC?

sentences:
Using Unity3D from within Eclipse Is it possible to use Unity3D from within Eclipse?  I've seen that I can import a Unity3D project into Eclipse, but I cannot seem to be able to access classes such as Terrain or Ray.  I don't know if that's because I haven't imported the correct libraries or if that's a limitation and that data can only be accessed by methods within Unity3D.  I am designing an Android game within Eclipse and would prefer to use Eclipse than Unity3D, even if that means my game will only be available for Android.

The only real reason I'm using Unity3d is for use of the 3D terrain and to hopefully help in getting the data, such as slope, terrain type, collisions, etc.

sentences:
How can I encourage players to "talk to" to each other in team-based games? With the goal of attracting a certain kind (highly sociable, that is) of players, I have wondered what game mechanics require, or at least encourage, players to verbally (I'm assuming an advanced text chat system, with team and private channels, maybe even chat-bots) communicate with each other, if they want to succeed as a team, or at least get the best possible results, within a game.

I'm interested in anything that requires discussion; before, during or after a "match".

If it matters, it would be (mostly) a team-vs-environment game, but also allow some tasks to be achieved by players alone (team is offline), or the occasional PvP/GvG (I'm bored with the grunts).

Getting team players to talk (rather than argue!) to each other increases their "closeness", and so plays an important role as a long-term "retention mechanism".

sentences:
Why do some networked games use interpolation and some use pathfinding for remote movement? This is a bit of an open question but I'd like to see someone contribute a good reasoning for both.

For a quick example of both:

Interpolation Model

Think the Valve model where the client is receiving position updates frequently and the remotes  update their positions using interpolation on this data.

Path-finding

In this model, think the user sends a destination and everyone pathfinds to it.

What types of games are suited to each and when should one use each?

sentences:
Storage and Lookup of Voxel Chunks How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory?

The problem with a HashMap<Vector3i, Chunk> is that you have to keep creating Vector3i objects, just to use them in the lookup.

I am basically looking for a solution that does not involve the creation of an object to perform a lookup.

sentences:
Multilayer game HTML5 canvas I've have a problem with HTML5 canvas and using multiple layers.

I'm using 3 layers. The first layer is where the player and the collision base objects are. And the second and the third layer have the rest of that objects, and that are suppose to cover the character if is behind them. But I have this problem:

The tile in the upper layer than the character cover him, even if he is in front of that object.

And I have other problem:

When is a the back of the element, there's a part of the character that appears in the middle of the poster.

How can I resolve this? I don't know how exactly do this, and I think that use layers is not very convenient.

Here's how I render the map:

function drawMap () {

for (var rowCtr = 0; rowCtr < map.tileMap[0].length; rowCtr++) {

    for (var colCtr = 0; colCtr < map.tileMap[0][0].length; colCtr++){

        var tileId  = map.tileMap[0][rowCtr][colCtr] - 1;
        var sourceX = Math.floor(tileId % 8) * 32;
        var sourceY = Math.floor(tileId / 8) * 32;

        ctx.drawImage(map.sprite.img, sourceX, sourceY, 32, 32, colCtr * 32, rowCtr * 32, 32, 32);

    }

}

finn.movement(this.ctx, this.world);

if (map.tileMap.length > 1) {

    for (var capa = 1; capa < map.tileMap.length; capa++) {

        for (var rowCtr = 0; rowCtr < map.tileMap[0].length; rowCtr++) {

            for (var colCtr = 0; colCtr < map.tileMap[0][0].length; colCtr++){

                var tileId  = map.tileMap[capa][rowCtr][colCtr] - 1;
                var sourceX = Math.floor(tileId % 8) * 32;
                var sourceY = Math.floor(tileId / 8) * 32;

                ctx.drawImage(map.sprite.img, sourceX, sourceY, 32, 32, colCtr * 32, rowCtr * 32, 32, 32);

            }

        }

    }

  }

}

And here's an example of the map:

  `[
    [0, 0, 0, 0],
    [0, 0, 0, 0],
    [0, 0, 0, 0],
    [0, 1, 1, 0]
   ],
   [
    [0, 0, 0, 0],
    [0, 1, 1, 0],
    [0, 1, 1, 0],
    [0, 0, 0, 0]
   ]`

That's the array of the layers. The first is the first layer, where the character moves, and the second element is the layer where the part of the objects which cover are drew.

Is there any solution for this without using any external Engine, only using canvas and javascript?

Thanks advance!

sentences:
When drawing text, numbers appear as D1 or NumPad1 rather than just numbers Been writing a class for a main menu, there's a play button and when pressed it goes to a window that asks for coordinates, sadly when writing with the keys and using the numbers the output is either D1, D2, D3... and so on, or NumPad1, NumPad2... and such. What I want is for the output to be just the number itself rather than the key name.

    private string Coordinates = string.Empty;
    private SpriteFont font;

    private Keys[] lastPressedKeys = new Keys[5];
    public void GetKeys()
    {
        KeyboardState kbState = Keyboard.GetState();

        Keys[] pressedKeys = kbState.GetPressedKeys();

        foreach (Keys key in lastPressedKeys)
        {
            if (!pressedKeys.Contains(key))
            {
                //key is no longer pressed
                OnKeyUp(key);
            }

        }
        foreach (Keys key in pressedKeys)
        {
            if (!lastPressedKeys.Contains(key))
            {
                OnKeyDown(key);
            }
        }
        lastPressedKeys = pressedKeys;
    }
    public void OnKeyUp(Keys key)
    {

    }

    public void OnKeyDown(Keys key)
    {
        KeyboardState kbState = Keyboard.GetState();

        if (key == Keys.Back && Coordinates.Length > 0)
        {
            Coordinates = Coordinates.Remove(Coordinates.Length - 1);
        }
        else
        {

            Coordinates += key.ToString();

        }

    }

Here's the whole class
https://pastebin.com/ZJqXx0zc

is there something wrong with using ToString? Or should I be using something different for numbers?

sentences:
How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile I know that in OpenGL I can do something like this

glReadBuffer( GL_FRONT );
glReadPixels( 0, 0, _width, _height, GL_RGB, GL_UNSIGNED_BYTE, _buffer );

And its pretty fast, I get the raw bitmap in _buffer.
When I try to do this in DirectX. Assuming that I have a D3DDevice object I can do something like this

if (SUCCEEDED(D3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackbuffer))) {
   HResult hr = D3DXSaveSurfaceToFileA(filename, D3DXIFF_BMP, pBackbuffer, NULL, NULL);

But D3DXSaveSurfaceToFile is pretty slow, and I don't need to write the capture to disk anyway, so I was wondering if there was a faster way to do this.

EDIT: I am targeting only DirectX applications. Actually DX9 apps. I am doing this through a hook to Present. (I am using Detours if that is relevant), and I am doing this for every frame. I don't need (or want) a particular bitmap format like BMP PNG JPEG etc, and a colorspace of RGB24 is OK. Getting it as YUV480p would be better but definitely not necessary. Thanks everyone for the very helpful answers

sentences: Game loop with multithreading I have learned how to create and manage threads in C++. Now I'm trying to create game loop based on multithreading but I can't imagine how should I split whole game to tasks. I mean, should rendering be separated from updating physics?

sentences:
How do I define a required component on a Unity game object? I have a script that expected the game object to have a Terrain component.

Is there an attribute I can add (or some other way) which will prevent a designer from adding my script/component/MonoBehavior to a GameObject that does not have the Terrain component?

The only alternative I have been able to find is to attach my script to something else, and then have a public Terrain field, which requires the user to attach the terrain object to it.  (since the editor won't allow you to associate a different object type.) - I just want the reverse.

Any thoughts?

sentences:
How to procedurally (create) grow an artistic (2D) tree in real-time (L-System?) Recently I programmed an L-system module, It got me interested further. I am a Plants vs Zombies junkie as well, really liked the concept of Tree of Wisdom. Would love to create similar procedural art just for fun and learn more.

Question: How should I approach the process of creating an artistic tree (2d perhaps with  fixed camera/perspective) dynamically?

Ideally I would like to start with a plant (only a stem with a leaf) and grow it dynamically using some influence (input/user action) over its structure. These influences may result in different type of branching, curves in branches, its spread, location of fruits, color of flowers, etc. Want it to be really full of life/spirit. :)

Plants vs Zombies: Tree of wisdom
It would be great to dynamically grow a similar tree, but with lot more variation and animations happening.

My Background: Programmer, have used few game engines (Ogre3d, cocos2d, unity). Haven't really programmed directly using openGL, trying to fix that :).

I am ready to spend considerable time, Please let me know about the APIs? and how would an expert like you would take on this problem?

Why 2D? I think it's easier to solve the problem only considering 2 dimensions.

Artistic inspirations:

Only the tree, with fruits and leaves, without the shrubs at the bottom

The large tree (visible branches, green leaves, flowers, fruits, etc) on the left, behind monkey.

PixelJunk's Eden (Art style inspiration).

Procedurally Generated Apple Tree using Fractals

Please let me know if it was easy for you to understand the question, I may elaborate further.

I hope a discussion of various approach would be helpful for everyone. You guys are awesome.

sentences: Any book about math in game design? Game designers need math as one of their tools for designing game, unfortunately I can't find one book concentrate on this topic. I know there's math book about game programmer, but designer need different math sub-branch knowledge like probability, game theory etc. And most important is examples tell us how to use these math knowledge as our powerful tools. Is there some books or articles available talk about this topic? Thanks in advance.

sentences:
How can I create and animate 2D skeletons for HTML5 Javascript games? I'm trying to make a 2D fighting game in HTML5(somewhat like street fighter). So basically there are two players, one AI and one Human. The players need to have animations for the body movements. Also, there needs to be some collision detection system. I'm using createjs for coding but to design models/objects/animations, I need some other software.

So I'm looking for a software that can:

easily make custom animation of 2d objects. The objects
structure(skeleton etc.) will be same once defined but need to be
defined once.
Can export the animations and models in a js readable
    format(preferably json)

Collision detection can be done easily after
the exported format is loaded in a game engine.

For point 1, I'm looking for some generic skeleton based animation. Sprite-sheet based animations will be difficult for collision detection.

sentences:
Unity3d CarController character positioning issue I use the unity standard asset components CharacterController and Car and put an empty gameobject onto the car where the camera should be placed when i am inside the car. The empty gameobject is called "Driver". The character controller has an empty called "Head" where its head is.

When i get in the car i perform the following operation

GameObject car = GameObject.Find("Car");
transform.position = car.transform.Find("Driver").transform.position + Vector3.up*1;
transform.parent = car.transform.Find("Driver").transform;
Camera.main.transform.position = car.transform.Find("Driver").transform.position;
Camera.main.transform.rotation = car.transform.Find("Driver").transform.rotation;

and to get out of it, i use the following

GameObject car = GameObject.Find("Car");
transform.position = car.transform.position;
transform.parent = null;
transform.rotation = Quaternion.identity;
Camera.main.transform.position = transform.Find("Head").transform.position;

My problem is when i get into the car and out again, the character is positioned at the position where i have entered the car, so it doesnt seems to update its position with the car movement.

What am i doing wrong?

Thanks in advance

sentences:
How can I get the parents and childs from the hierarchy in the same order it is in the hierarchy the structure of the hierarchy? The line:

var gameObjects = GameObject.FindObjectsOfType<GameObject>();

Is getting all the parents and children but not in the order it is in the hierarchy. I tried to use the gos List and to add first the childs then the parents to create a List with all parents and it's childs but it's getting messed. I want to get the structure of the Hierarchy.

        var gos = new List<GameObject>();

        var gameObjects = GameObject.FindObjectsOfType<GameObject>();
        for (int i = 0; i < gameObjects.Length; i++)
        {
            if (gameObjects[i].transform.childCount > 0)
            {

                //get children
                GameObject[] children = new GameObject[gameObjects[i].transform.childCount];
                for (int z = 0; z < children.Length; ++z)
                {
                    children[z] = gameObjects[i].transform.GetChild(i).gameObject;
                    gos.Add(children[z].gameObject);
                }
            }
            else
            {
                gos.Add(gameObjects[i]);
            }
        }

sentences:
Relation between TFLOPS and Threads in a GPU? What's the relation between Teraflops and Threads in a GPU like GTX Titan X has 7 TFOPS of Compute Performance but how many threads it has ? And Like Xbox and PS4 have 1.32 and 1.84 TFLOPS of compute performance but how many threads they have? Like what’s the relation between teraflops and threads?

If they are different concepts. Can you please explain both of them?

sentences:
OpenGL Applications Bring computer to halt Whenever I run any application that utilizes the OpenGL interface, my entire computer comes to a halt, but it doesn't do this when it utilizes the DirectX interface. I run both Linux (Ubuntu 15.10) and Windows 10 so this isn't exactly caused by the operating system. I'm running the latest drivers from NVidia and both OS's are completely up to date. This is happening on a Dell Precision M6300 laptop (Core 2 Dou 2.5ghz, NVidia Quadro FX 1600M, 4gb ram) and although it's a bit old it should be completely capable of rendering a blank OpenGL window using GLFW, however it slows down my entire computer (every application starts freezing to where it becomes unusable until the application is closed). This happens in games like Left4Dead, Half-life 2, etc., but also in my own OpenGL programs. The same programs and games do not have the same effect on my desktop (although much better hardware, a blank OpenGL window shouldn't matter). Any help would be greatly appreciated, thank you. Also; my apologies if I left out any vital information or made a confusing question. Just ask me to clarify or add something and I shall.

; Added the code for the blank OpenGL window in question

#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
using namespace glm;

int main(int argc, char* argv[]) {
if ( !glfwInit() ) {
    fprintf(stderr, "Failed to initialize GLFW\n");
    return -1;
}

glfwWindowHint(GLFW_SAMPLES, 4); // 4x AA
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); // GL 3.3
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

GLFWwindow* window;
window = glfwCreateWindow(1024, 768, "OpenGL Tutorial", NULL, NULL);
if (window == NULL) {
    fprintf(stderr, "Failed to create OpenGL Window.");
    return -1;
}
glfwMakeContextCurrent(window);
glewExperimental=true;
if (glewInit() != GLEW_OK) {
    fprintf(stderr, "Failed to initiate the glew context!");
    return -1;
}

glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);

do {

    glfwSwapBuffers(window);
    glfwPollEvents();
} while (glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
    glfwWindowShouldClose(window) == 0);
}

sentences:
Need info on creating a tile grid data structure in Java I'm trying to create a game with a fixed size map (2D Tile array).
I suppose I can inherit other tiles from this base Tile, e.g.: a BankTile.
Placing and removing tiles is all too easy, but forming rooms keeps me puzzled.

Rooms can only be formed by adjacent tiles (4-way: above, below, left and right)

This way, 2 tiles can form a 'room', e.g. a Bank with a maximum amount of resources it can hold (sum of both its tiles).

I am wondering on how I should be implementing this, if there are any existing (and optimal) solutions to this.

Some things I considered:

Tiles must keep a reference to the Room they are in AND rooms must keep a vector of all tiles they hold. So adding tiles and removing tiles becomes pretty efficient.
Only obstacle this poses is the splitting of rooms: if 1 tile connects 2 rooms and this tile is removed, it should split the room and creating a new room for the split-off part.
Rooms will be 2D vectors with a begin-position (the room will be a surrounding square of the actual room polygon)
Rooms are 4-way linked lists of tiles
?

What needs to be done with rooms:

tiles need to be added and removed
allowing rooms to merge and split
calculating size of a room
finding a room quickly on a map

This image clarifies what I need:

Should I pick data structure 1? Rooms are 2D arrays with null-pointers for not-room-tiles.
Or should I pick data structure 2? Rooms are 4-way linked lists of tiles.
Or should I think of something else, e.g. vector of tiles = room?
Given the operations I need to be able to perform on them, which is best?

sentences:
- 2 Parts: Object/Material displays at 90degrees + Material Mask will not rotate with object? Hi I have a 2 part issue.
Part 1: I have a planet in Unreal, in the object editor it is aligned properly and the material displays correctly but in the game even with the rotation set to 0 it displays as being flipped 90 degrees to one side? Why is this happening and how do I make it display correctly?
Part 2: The material for the planet has a mask on it to make it display day and night. However, when I attempt to manually rotate the object everything BUT the mask rotates which screws everything up. Why does the mask not rotate and how do I make it rotate with the rest for manual manipulation?

sentences:
How to do I make my sprite move when it's instantiated in Unity5? Here's the code I currently try to use to move my instantiated sprite:

time++;

    if (cow == 1 && time >= wait)
    {
        Cow0Walk();
    }

    if (cow == 2 && time >= wait)
    {
        Cow1Walk();
    }

    if (cow == 3 && time >= wait)
    {
        Cow2Walk();
    }

    if (cow == 4 && time >= wait)
    {
        Cow3Walk();
    }

    if (cow == 5 && time >= wait)
    {
        Cow4Walk();
    }

    if (time >= walkTime)
    {
        wait = rnd.Next(45, 140);
        cow = rnd.Next(1, cowAmount);
        walkTime = rnd.Next(1, 4);
        direction = rnd.Next(1, 4);
    }

Heres the one of the walk methods:

    void Cow0Walk()
{
    if (time <= walkTime && direction == 1)
    {
        cows[0].transform.Translate(Vector2.up * speed);
        cows[0].transform.Translate(Vector2.right * speed);
    }

    if (time <= walkTime && direction == 2)
    {
        cows[0].transform.Translate(Vector2.up * speed);
        cows[0].transform.Translate(Vector2.left * speed);
    }

    if (time <= walkTime && direction == 3)
    {
        cows[0].transform.Translate(Vector2.down * speed);
        cows[0].transform.Translate(Vector2.right * speed);
    }

    if (time <= walkTime && direction == 4)
    {
        cows[0].transform.Translate(Vector2.down * speed);
        cows[0].transform.Translate(Vector2.left * speed);
    }
}

sentences:
How to access Lit shader properties through code? Currently i'm using HDRP in my project, so i have a question.
How can i access Lit shader properties through code ? Or where i can see names of variables in this shader ?

For example:

sentences:
Hide Environment Texture in Babylon.js Is it possible to hide an environment texture as to preserve the reflections/light it provides while keeping the background transparent (as seen in picture 2)? I know this is done in Blender by removing light rays from the environment texture that directly hit the camera.
When I use the defaultEnvironment() and set scene.clearColor, this blue box is still showing up. (as seen in picture 1)
scene.createDefaultEnvironment();
scene.clearColor = new BABYLON.Color4(0,0,0,0)

Picture 1:

Picture 2:

sentences:
Integration of gravitational interaction I don't know if this question get her place in physics.stackoverflow forum. I prefer post here, with code etc.
So, I want simulate 2D movements (no rotation) of an asteroid in space affected by a planet's gravity, the problem is how integrate that ?
Any better integration for performance ?
Here is the code in C:
struct vec2
{
  float x;
  float y;
};

struct body
{
  double mass; //kg
  struct vec2 prev_pos; //for semi-implicit euler method
  struct vec2 pos; //position
  struct vec2 v; //velocity
};

void move_asteroid(float dt) {
  //semi-implicit euler integration #1 -moving the object
  asteroid.pos.x += asteroid.v.x * dt;
  asteroid.pos.y += asteroid.v.y * dt;

  //START
  float x = planet.pos.x - asteroid.pos.x;
  float y = planet.pos.y - asteroid.pos.y;
  float d = x * x + y * y; //distance^2 between asteroid and center of planet

  //acceleration
  float ah = G * ((planet.mass * asteroid.mass) / d); //gravity

  //get components of gravity
  float rad = atan2(y, x);
  float ax = ah * cos(rad);
  float ay = ah * sin(rad);

  //semi-implicit euler integration #2 -update velocity
  asteroid.v.x += ax * dt;
  asteroid.v.y += ay * dt;
}

this is for 'fun' and sadly my knowledge is quite not good, I try to find with my vocabulary (not native english), if you have directions, ideas for better implementation (like study RK4 for correctness etc), it's welcome

sentences:
Why does the script stop working after respawning? I have a flying enemy that follows the player:
public class MoveTowardsPlayer : MonoBehaviour
{
    public float moveSpeed, sightDistance;
    public Rigidbody2D theRB;
    public Transform target;
    private void Start()
    {
        theRB = GetComponent<Rigidbody2D>();
    }
    private void Update()
    {
        Vector3 targetDir = target.position - transform.position;
        targetDir = targetDir.normalized;
        float dist = Vector3.Distance(target.position, transform.position);
        if (dist < sightDistance)
            theRB.velocity = targetDir * moveSpeed;
    }

}

And here is what happens when the enemy dies, and then respawns:
  public void Die()
    {
        Instantiate(enemyDieEffect, transform.position, transform.rotation);
        gameObject.SetActive(false);
    }

    public void Respawn()
    {
        gameObject.transform.position = initialPosition;
        gameObject.SetActive(true);
        currentHealth = maxHealth;
    }

The enemy respawns if the player dies and goes back to the last checkpoint.
Interestingly, if the player dies before reaching any checkpoint, the MoveTowardsPlayer scripts still works after respawning. It only stops working after any of the checkpoints are reached.
For the sake of completeness, here is the Checkpoint script, which has absolutely nothing to do with the enemies:
public class Checkpoint : MonoBehaviour
{
    private Animator animator;
    public bool isReached;

    // Start is called before the first frame update
    void Start()
    {
        isReached = false;
        animator = GetComponent<Animator>();
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            CheckpointController.instance.DeactivateCheckpoints();
            animator.SetBool("isActive", true);
            CheckpointController.instance.SetSpawnPoint(transform.position);
        }
    }

    public void ResetCheckpoint()
    {
        animator.SetBool("isActive", false);
    }
}

sentences:
How to implement circle clipping in SDL2? In SDL2 there's a function to set a rectangular clip mask:

int SDL_RenderSetClipRect(SDL_Renderer* Renderer, SDL_Rect* clip);

If i call this function, copied textures will be displayed in this clip rect but not outside of it.
What I'm wondering is if it's possible to set a circle as a clip?

For example, in Material Design:

There are some buttons with the shape of a circle and when you click on them, it appears a small circle from the cursor and this becomes bigger.
This small circle is not display outside the button but only inside.
And so, i want to do this. I want to renderer a texture that is clipped with a circle.

I don't think SDL_RenderSetClipCircle exists, so how could I emulate this?

sentences:
How to stop SDL from freezing the rendering while resizing the window? I have a simple SDL application with a re-sizeable window. If I minimize it and then maximize the window the rendering freezes. I've included a simple code example below which makes the screen flash through varying shades of grey. Try minimizing and then maximizing the window, and you can see that the rendering halts while the window is resizing. How do I stop the rendering freezing when going from minimized to maximized?

//FLASHING SCREEN CODE
//Demonstrates screen freeze when you minimise then maximise the screen....

#include "SDL.h"

using namespace std;

int main( int argc, char* args[] )
{
    //Initialise SDL2, declare Window + Renderer
    SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ); //Initialize SDL for video and audio
    SDL_Window* pWindow = NULL;
    SDL_Renderer* pRenderer = NULL;
    pWindow = SDL_CreateWindow("Minimise Maximise Test", 50, 50, 1200, 600, SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED);
    pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_TARGETTEXTURE);

    //The Screen colour which is going to flash through different shades of grey
    SDL_Color screenColour = {0, 0, 0};

    //SDL event for detecting X-out (quit)
    SDL_Event event;
    bool quit = false;

    //Loop
    while( quit == false )   //While SDL has not been X'ed out
    {
        //Handle quit
        if (SDL_PollEvent(&event) != 0)
        {
            if(event.type == SDL_QUIT) quit = true; //Press X-out to quit (but not visible on fullscreen)
        }

        //Make screen flash by changing its colour through shades of grey
        screenColour.r++;
        screenColour.g++;
        screenColour.b++;

        //Render the screen
        SDL_SetRenderDrawColor(pRenderer, screenColour.r, screenColour.g, screenColour.b, 255);
        SDL_RenderFillRect(pRenderer, NULL);
        SDL_RenderPresent(pRenderer); //like SDL_flip
    }

    //Shutdown
    SDL_DestroyRenderer(pRenderer);
    SDL_DestroyWindow(pWindow);
    SDL_Quit();

    return 0;
}

I'm currently running SDL2.0 v 2.0.3 on Windows 10 machine (experienced the same problem running on previous Windows 7 machine).

sentences:
Geometric clipping of triangles intersecting near plane I was reading about how rasterization works but there is one topic I can't quite understand.
After perspective projection, our point is in clip space as I understand it.
Now we test all points in a triangle like so
rejected = true
for every point:
   if (abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w) &&
      abs(point.x) <= abs(point.w)
      point.w > 0) {
      rejected = false;
    }

So the triangle is only rejected if all points are behind the near clipping plane or fall out boundaries, but it can happen that one point is behind the near clipping plane and others are in front.
Now there is a part I don't understand.
To deal with this we somehow clip points in 3d space by constructing new triangles.
So how is this exactly works?
And why we can't just interpolate our z values to test if the point is behind or in front of the near plane?

sentences:
Clamping the camera isn't so smooth when moving the camera around. Is there a way to make the clamping smoother? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class CamerasManager : MonoBehaviour
{
    public CinemachineFreeLook playerCameraCloseLook;
    public CinemachineFreeLook playerCameraGameplayLook;
    public float timeBeforeSwitching;
    public float clampMin;
    public float clampMax;
    public float pitch;
    public float speed;

    private float brainBlendTime;

    // Start is called before the first frame update
    void Start()
    {
        brainBlendTime = Camera.main.GetComponent<CinemachineBrain>().m_DefaultBlend.m_Time;

        StartCoroutine(SwitchCameras(timeBeforeSwitching));
    }

    // Update is called once per frame
    void LateUpdate()
    {
        if (playerCameraGameplayLook != null)
        {
            pitch += speed * Input.GetAxis("Mouse Y");
            pitch = Mathf.Clamp(pitch, clampMin, clampMax);
            playerCameraGameplayLook.GetRig(1).GetCinemachineComponent<CinemachineComposer>().m_TrackedObjectOffset.y = pitch;
        }
    }

    IEnumerator SwitchCameras(float TimeBeforeSwitching)
    {
        yield return new WaitForSeconds(TimeBeforeSwitching);

        playerCameraCloseLook.enabled = false;
        playerCameraGameplayLook.enabled = true;

        PlayerLockManager.PlayerLockState(false);

        StartCoroutine(BlendTime());
    }

    IEnumerator BlendTime()
    {
        yield return new WaitForSeconds(brainBlendTime);

        PlayerLockManager.PlayerLockState(true);
    }
}

I can look around up down left right using Cinemachine CinemachineFreeLook but when using the clamping in this script and then when moving the camera around with the mouse it looks like the camera is a bit stuttering/jittering.
Without the clamping, in the LateUpdate the camera will work fine but then I can't move the camera up down left right only to the left and right.
The reason I'm trying to do the clamping on my own is that in the FreeLookCamera in the Axis Control > Y Axis if I set the speed to 100 or 300 when I move the camera up and down it will also zoom in/out on the player and I don't want that zooming but there is no option to remove/disable the zooming.

sentences:
Unity - Understanding the SRP batcher Im trying to understand the SRP batcher. I have a scene with 300 fairly low-poly models.
These are my rendering stats with SRP Batcher:

And this is without SRP Batcher:

Some observations (This is all with dynamic batching enabled, models share a GPU instanced material):

With SRP Batcher the Tris and Verts seem to lower almost impossibly low, sitting at the low thousands, while without the SRP Batcher they are almost 5 million.
With SRP Batcher the draw calls are at almost 3000, with none being batched. On the other hand, without SRP Batcher the draw calls are at 103, with almost 2500 being batched.

I cannot really make sense of this. I see no noticable effect on the FPS. I have no idea which is actually better for performance. The stats above make no real sense to me, seems strange that enabling SRP batcher removes all batched calls... Can someone help me understand which is better and when to use what?
Everything is tested on latest unity and URP versions.

sentences:
How does Unity's Entity-Component System Work In Practice? On the surface Entity-Component seems like a good way to program games. Everything is a game object and those game objects are made up of components. The attraction is components are very flexible, just requiring you to "add" them to a game object to inherit it's functionality.

So, obviously a good example might be a platform the character has to jump on. Maybe this thing has a collider, a moving component, maybe a rotating component, or maybe even a rigid "RotatingAndMovingPlatformComponent". Okay, that sounds great, just add all these components to the game object and that's it, you have this extra functionality. However, I find that this level of complexity is where it's usefulness ends.

Try this with menus, complex character movement with multiple states, abstract ideas like game modes or game state, and your flexibility and modularity are destroyed. Menus involve a lot of specifics, complex character movement often involves many states meaning either communication between these components is needed or there must be a controlling component made just for this type of character. On top of this, some components will need to rely on game state in some way.

I see very little benefit to programming this way over ordinary inheritance. The lack of object structures at compile time makes doing a lot of things very difficult and unreliable.

I feel the best and easiest way of going about things would be using larger components with more dependencies. I don't see this as a problem ( more like unreal 4's architecture ), but then I wonder what's the point in the Entity-Component architecture.

sentences:
How do you display non-cutout transparent 2D textures with a depth buffer? (OpenGL) I've been able to get my 2D renderer to display transparent cutout textures by testing the alpha of a fragment and discarding if it is less than 1 (or any fraction really). The problem is I want to support using translucent textures.

The current way I sort my sprites is by what texture they use, so that I can minimize texture changes. The only way I can think of getting this to work properly is by scrapping that and only sorting by z-order. But I don't want to throw away the optimization I already did. Is there any way to do both?

Does only rendering in 2D simplify the problem at all?

I was hoping to support translucent sprites, but my font renderer makes translucent font textures, so I can't just only use cutouts.

EDIT: After doing some research, it seems there really is no easy way to do this. (depth peeling for a 2D renderer seems a little overkill) I'm going to compromise by having my renderer hold 2 different sets of sprites, cutouts and translucent. I can draw the cutouts first in whatever order I want, making full use of texture atlases. The translucent textures, however, will need to be in z-order, ignoring atlases.

If anyone can tell me a better way, I'm all ears.

sentences:
Keeping track of onscreen objects in opengl es on Android In a small game Im working on I was able to implement ray picking with an opensource 3d engine called min3d but I cant figure how to keep track of what object is onscreen. I will some times have upwards of 120 objects to render within my scene and the raypicking is off occasionally. What id like to do is keep track of how many screen objects are within the camera and being rendered onscreen and set a boolean value based on that to add or remove objects from my arraylist I iterate through when the screen touch is registered and the ray picking method goes off.

So how can I check for which objects are onscreen and offscreen in opengl es on android.

sentences:
How to store level information on iOS Let's imagine I have a breakout game. I make a level like this:

For columns < max columns
    For rows < max rows
        Create sprite from file, put it on some position based on
        current column and row, put it into array of objects.

Now, imagine I have 100 levels and I want them to be different. What tools should I use to ease my life? How do I load a level from file? Maybe a plist?

sentences:
Have a while loops but inputs depend on events fired, what are some ways on getting the input? I think I'm at a conundrum here, I've creating a matching game in C# winforms. And I'm 90% done, the only thing left is the game loop.

The matching games consits of two multidimensional arrrays which are panels. And after I set everything up, I can RunGame(), which where my game loop is, the problem I am having is getting input. I'm not sure how to do that yet.

For example.

It's a while loop.

So,

while(game.isRunning()){

//get input from player.

//getchoice then redraw panels accordingly

//get input from player 2.

//getchoice then redraw panels accordingly

}

The problem is my players click on panels that's how I get the choice they've made. So I wanted to know if you guys have any good ways of getting input in a loop from an event that will be launched outside the loop for a game.

Thanks.

sentences:
How can I customize the DefaultInput.ini? I need to make some bindings false.  The ones are:
.Bindings=(Name="W", Command="GBA_MoveForward") and the same for S, A, D, LEFT, RIGHT, and LeftControl.

sentences: Turn based game - HTTP or WebSocket? My game will be a turn based game which will need a server gateway in order to send requests. What would be better for the server: using REST HTTP GET for making the requests? Or using WebSocket which enables you to have an active connection?

sentences:
Checking if shapes will tessellate I'm trying to figure out where to start with getting code together to check if a shape tessellates.

An example:

Consider that the shapes cannot be rotated, just as-is. A 'compound' shape (as seen in the pic - second and third shapes) will have a series of co-ordinates that make them up.

Where could I begin to getting the computer to figure out if they can tessellate?

I'm using c# & unity. Thanks in advance.

sentences: Mobile game textures sizes I am developing a Windows Phone 7 game using XNA 4.0 which I plan to later port to iOS and android using Monotouch and Monodroid. My question is how to determine what texture size should I include? This is because the in-game objects that utilize the textures dont care about the actual texture size and just re-size them. Windows phone by its own exists in multiple resolution variants. Should I pick the highest resolution emulator and then measure the sizes of my in-game objects, and then re-size their respective textures to be the same?

sentences:
What is the term that describes the "user" of a status ailment Suppose a Snake performs a skill that inflicts a "poison" status on the Hero, and every minute the Hero receives damage equal to the Snake's skill level.

What is a term that would describe the snake as the object that inflicted the status ailment, that players would recognize or be able to figure out based on context? I imagine there are some standard terminology used in the industry.

Some things I have thought of include "applier" or "inflicter".

sentences:
Will DirectCompute run this HLSL code I found a sample about how to run a HLSL code with DirectCompute.

https://code.msdn.microsoft.com/windowsdesktop/DirectCompute-Basic-Win32-7d5a7408

This is the HLSL script I want to run

https://github.com/zachsaw/MPDN_Extensions/blob/master/Extensions/RenderScripts/SuperRes/SuperResEx.hlsl

It doesn't seem the same as the BasicCompute sample. First, the main function's name is called "main" instead of "CSMain". Second, it uses data types like float2, float3 and float4 while BasicCompute uses standard data types. So, is it the same or something else?

Will DirectCompute run this script or it has to be done through other means?

sentences:
How can this kind of entity/component organization improve cache efficiency? I've been reading up about entity component systems as a design pattern for an OpenGL engine. The style I'm trying to implement has entities only being integers, and components being long contiguous arrays of, for example glm::vec3 for a world-position component.

The entity integers then work as indices into those arrays. All of this described best by this post.

As I understand, the main benefits of an ECS would include:

Simplification and elimination of unnecessary dependencies and spaghetti code
Performance boost: contiguous component arrays translate into fewer cache misses and an overall de-bloating of complex inheritance

While I do agree with the first point, I don't understand how the second could be true.

On a regular draw call, you'd need almost always the majority of components. You need position, scale, rotate for loading a MVP matrix into the shaders. You need the mesh and textures for rendering itself. You even need details like light color or whether or not it casts shadows. Everything! This means that you will inevitably encounter cache misses in some form, since you can't fit your component arrays in cache.

Add to that the fact that since the entity integers are indices into the component arrays, all of the component arrays need to grow in size whenever you add an entity - independent of it's type. This means that adding 30 entities with no mesh will inevitable generate 30 empty mesh allocations that will never be used.

How would you implement such a system to truly minimize cache misses without incurring in unnecessary memory waste?

sentences:
Algorithm to propagate internal Physics force in a structure of building Scenario:

A floating structure composes of many nodes (or in more visual meaning - a cubic block).

Every node is snapped to the same 3D grid. (similar to a minecraft castle)

There are external forces apply to each node at different values.

For example, node A receives force = Vec3(1,0,0) at time = 1s-3s, node B receives force = Vec3(0,1,0) at time 2s-4s.   Most external forces apply to center of mass of node.

Every pair of adjacent nodes (6 neighbors) is tied together by a "joint" i.e. glue.
Each joint can received some (but limited) pulling/pushing force/torque.

Question:
How to calculate/approximate force of each and every joints?
I want to use them to break object apart / create some spark graphics.

Maximum flow problem is fast, but too limit for this case.  Although it is quite efficient to propagate force like fluid in pipe system, it don't support Torque and many sources/sinks.
https://en.wikipedia.org/wiki/Maximum_flow_problem

Networks of Torque Propagation requires a solid ground, so it can't be used for this problem.
http://www.cs.brandeis.edu/~pablo/thesis/html/node29.html

Bullet Physics Engine : I tried to use its constraint, but for very high amount of nodes (400), they are not stable, i.e. become divergent & explode.

My poor approach : I initialized all force between joint = Vec3(0,0,0), and then use Newton Rules (F=ma & T=Ixw) to propagate force gradually in each iteration.  It always yields perfect result but take too much time (10+ ms), so it is unusable.

Note that the algorithm can provide non-optimal solution and can have some limitation (e.g. no torque).
Performance is important (500 nodes within 1-2 ms, C++).

sentences:
How does Unity's Collider.Bounds work? From waht I understand, Collider.Bounds are the sides or bounds of the collider of the GameObject (at least for a cube with a BoxCollider). But I got a result that I wasn't expecting when I tried moving a cube continuously downwards and drawing the bounds with lines. While moving frame by frame, the collider bounds seemed to be not bounding the cube (or at least that's what my test is showing, if my test is correct).

Here's 3 frames of screenshot:

What I did for this is create a new 3D project, add a Cube, then added a single script and then added this script to the Cube. The whole script is:

using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    Vector3 velocity;

    // Start is called before the first frame update
    void Start()
    {
        velocity = Vector3.zero;
    }

    // Update is called once per frame
    void Update()
    {
        velocity.y += -0.5f;
        transform.Translate(velocity);

        Bounds bounds = GetComponent<Collider>().bounds;
        Debug.DrawLine(new Vector3(bounds.min.x, bounds.min.y, bounds.min.z), new Vector3(bounds.max.x, bounds.min.y, bounds.min.z), Color.red);
        Debug.DrawLine(new Vector3(bounds.max.x, bounds.min.y, bounds.min.z), new Vector3(bounds.max.x, bounds.max.y, bounds.min.z), Color.red);
        Debug.DrawLine(new Vector3(bounds.max.x, bounds.max.y, bounds.min.z), new Vector3(bounds.min.x, bounds.max.y, bounds.min.z), Color.red);
        Debug.DrawLine(new Vector3(bounds.min.x, bounds.max.y, bounds.min.z), new Vector3(bounds.min.x, bounds.min.y, bounds.min.z), Color.red);
        Debug.DrawLine(bounds.min, bounds.max, Color.red);
    }
}

Am I not understanding something or am I doing something wrong?

sentences:
Unity 2019 build for Oculus Go not appearing on device My project was building fine in 2018 and showing up on my Go under "unknown sources".

My project builds fine in 2019 and it says it gets installed but it no longer shows up under "unknown sources" or anywhere else that I can see.

I can uninstall using adb - so it's there apparently, but where, and how can I launch it?

thanks

sentences:
DirectX Tessellation Cracks I have the following simple patch function in DX11, but I keep getting rips, and when I look at the wireframe its clear that adjacent edges are not getting the same tessellation factor. The CalcTessFactor() function just does a distance from the camera to the point passed, so should always give the same value for the same edge center that I pass in.

PatchTess patchFunction_Far(InputPatch<VertexToPixel_Far, 3> patch, uint patchID : SV_PrimitiveID)
 {
  PatchTess pt;

 // Compute midpoint on edges, and patch center
  float3 e0 = 0.5f*(patch[0].WorldPosition + patch[1].WorldPosition);
  float3 e1 = 0.5f*(patch[1].WorldPosition + patch[2].WorldPosition);
  float3 e2 = 0.5f*(patch[2].WorldPosition + patch[0].WorldPosition);
  float3  c = (patch[0].WorldPosition + patch[1].WorldPosition + patch[2].WorldPosition) / 3.0f;

 pt.EdgeTess[0] = CalcTessFactor(e0);
  pt.EdgeTess[1] = CalcTessFactor(e1);
  pt.EdgeTess[2] = CalcTessFactor(e2);

 pt.InsideTess = CalcTessFactor©;

 return pt;
 }

My patches are triangles.

Is there something I'm doing trivially wrong here (like assuming that EdgeTess[0] is correctly assumed to be edge 0-1, rather than edge 2->0 for instance ? - its a wild guess..

sentences:
How could I generate a document that catalogs a collection of 3D models? I have a lot of 3D models (.obj and .fbx) I can re-use in some games, but sometimes I forget them.

So I want to create a (for instance) Word document with the images of all my 3D models.

This can be useful to organize & reuse models from my personal library.

I know I could do this by hand, but that's not efficient; how could I somehow automate some parts of the process to achieve this?

sentences:
Event Driven Behavior Tree: deterministic traversal order with parallel I've studied several articles and listen some talks about behavior trees (mostly the resources available on AIGameDev by Alex J. Champandard).

I'm particularly interested on event driven behavior trees, but I have still some doubts on how to implement them correctly using a scheduler.

Just a quick recap:

Standard Behavior Tree

Each execution tick the tree is traversed from the root in depth-first order
The execution order is implicitly expressed by the tree structure. So in the case of behaviors parented to a parallel node, even if both children are executed during the same traversing, the first leaf is always evaluated first.

Event Driven BT

During the first traversal the nodes (tasks) are enqueued using a scheduler which is responsible for updating only running ones every update
The first traversal implicitly produce a depth-first ordered queue in the scheduler
Non leaf nodes stays suspended mostly of the time. When a leaf node terminate(either with success or fail status) the parent (observer) is waked up allowing the tree traversing to continue and new tasks will be enqueued in the scheduler
Without parallel nodes in the tree there will be up to 1 task running in the scheduler
Without parallel nodes, the tasks in the queue(excluding dynamic priority implementation) will be always ordered in a depth-first order (is this right?)

Now, from what is my understanding of a possible implementation, there are 2 requirements I think must be respected(I'm not sure though):

Now, some requirements I think needs to be guaranteed by a correct implementation are:

The result of the traversing should be independent from which implementation strategy is used.
The traversing result must be deterministic.

I'm struggling trying to guarantee both in the case of parallel nodes. Here's an example:

Parallel_1
-->Sequence_1
---->leaf_A
---->leaf_B
-->leaf_C

Considering a FIFO policy of the scheduler, before leaf_A node terminates the tasks in the scheduler are:

P1(suspended),S1(suspended),leaf_A(running),leaf_C(running)

When leaf_A terminate leaf_B will be scheduled (at the end of the queue), so the queue will become:

P1(suspended),S1(suspended),leaf_C(running),leaf_B(running)

In this case leaf_B will be executed after leaf_C at every update, meanwhile with a non event-driven traversing from the root node, the leaf_B will always be evaluated before leaf_A.

So I have a couple of question:

do I have understand correctly how event driven BT work?
How can I guarantee the depth first order is respected with such an implementation?
is this a common issue or am I missing something?

sentences:
Tile collision detection Right. So I was making this simple game. The player is two tiles wide, and four tiles high. My current code is really buggy (it was better before my rewrite)

Here it is:

    float newx = position.x + velocity.x;
    float newy = position.y + velocity.y;

    int tx = (int) newx;
    int ty = (int) newy;

    Tile tile = WorldHandler.currentWorld.getTile(tx, ty);
    Tile ground = WorldHandler.currentWorld.getTile((int) position.x, (int) position.y-1);

    if (tile.type == 0) {
        position.x = newx;
        position.y = newy;
    }
    if (ground.type != 0) {
        grounded = true;
        //position.y = Math.round(position.y);
    }

    if (grounded) {
        velocity.x = 0.0f;
        velocity.y = 0.0f;
        //position.y = Math.round(position.y);
    } else {
        velocity.x = velocity.x * (1.0f - Math.min(0.1f, 1.0f));
        velocity.y += 0.0f;
    }

it basically uses the indices for performance.

But I need a decent collision detection system that wouldn't be painful to implement, would AARBs be of use here? Also, the game loop is a tick based one, it runs at 30 ticks/s.

sentences:
Smooth animation in Cocos2d for iOS I move a simple CCSprite around the screen of an iOS device using this code:

[self schedule:@selector(update:) interval:0.0167];

- (void) update:(ccTime) delta {
    CGPoint currPos = self.position;
    currPos.x += xVelocity;
    currPos.y += yVelocity;

    self.position = currPos;
}

This works however the animation is not smooth. How can I improve the smoothness of my animation?

My scene is exceedingly simple (just has one full-screen CCSprite with a background image and a relatively small CCSprite that moves slowly).

I've logged the ccTime delta and it's not consistent (it's almost always greater than my specified interval of 0.0167... sometimes up to a factor of 4x).

I've considered tailoring the motion in the update method to the delta time (larger delta => larger movement etc). However given the simplicity of my scene it's seems there's a better way (and something basic that I'm probably missing).

sentences:
Strange result, when changing variable name I have no idea, what is going on. The mat4 xxx is the cause. Renaming it to "bones"/"bone_transfromations" etc. won't work it gives me an error. Renaming it to "test" works perfectly fine... This is my GLSL code:

#version 400 core

//data from VBO
in vec3 position;
in vec2 texture_coordinates;
in vec3 normal;
//bone data
in int bone_pointer;
in float bone_intensity;
//vertex color output
out vec4 color;
//texture coordinates
out vec2 pass_texcoords;
out vec2 texCoord0;
//normal
out vec3 surface_normal;
//vector pointing towards the light
out vec3 to_light_vector;

//position, rotation, scale
uniform mat4 transformationMatrix;
//perspective projection
uniform mat4 projectionMatrix;
//TODO: material color
uniform vec3 in_color;
//camera viewmatrix
uniform mat4 viewMatrix;
//lights
uniform vec3 lightPosition;
uniform vec3 lightColor;
//skeleton data
uniform mat4 xxx;

void main()
{
mat4 total_transform = xxx * transformationMatrix;
vec4 worldPosition;

worldPosition =  total_transform * (vec4(position, 1)) ; //

vec4 pos =  projectionMatrix * viewMatrix * worldPosition;
gl_Position = pos;

//Texture
pass_texcoords = texture_coordinates;

//light
surface_normal = (total_transform *  vec4(normal, 0)).xyz;
to_light_vector = lightPosition * worldPosition.xyz;

//textures
 texCoord0 = texture_coordinates;

}

sentences:
Compute Corners of Cuboid In 3D How can I compute the eight corners of a cuboid given a Depth and Height and two points: A(x,y,z) and B(x,y,z)?

Is it possible to calculate the eight corners/points of a cuboid given only a limited data? I'm trying to make a cuboid with only two 3D vectors by computing the eight vectors.

sentences:
libgdx - Scalable UI without Scene2D I currently have a fairly decent framework for a side-view strategy-ish game built around libgdx. While I may have reinvented the wheel a couple of times, I believe I've done the vast majority with tools already existing in libgdx parts properly: camera, viewport, sprites, etc.

One thing I've not used at all is Scene2D, as I've simply not had a need for it (yet). Drawing the sprites at their positions is more than enough. The terrain is procedurally generated pixel art that is drawn beforehand.

Now I've come to the point where I need to implement some fairly basic UI-systems. Nothing out of the ordinary: A few buttons to click, and an area with additional info.

I haven't decided entirely on which approach to use when implementing the UI, but in the meantime I'm going with a fairly simple approach:
When everything else is drawn, I reset the projectionmatrix so that everything drawn after that never moves with the world:

    Matrix4 uiMatrix = camera.combined.cpy();
    uiMatrix.setToOrtho2D(0,0,viewport.getWorldWidth(), viewport.getWorldHeight());
    batch.setProjectionMatrix(uiMatrix);
    // Then draw the UI

This works fine, except when the aspect ratio changes and/or when the window resizes. Therefore I would like to find a more scalable way.

Is Scene2D the way to go? It currently looks like the only reasonable way of getting an UI that works well with resizing the screen and panning around.

The info I find on how to implement it either assumes a complete rewrite to use actors instead of sprites, or doesn't scale well at all.

sentences:
Producing a smooth mesh from density cloud and marching cubes Based on my results from this question I decided to build myself a 3D noise map containing float values in place of my existing boolean point values. The effect I'm trying to produce is something like this, rather than typical rolling hills; which should explain the "missing cubes" in the image below.

If I render my density map in normal "minecraft mode" (1 block per point in the density map) varying the size of the cube based on the value in my density map (floats in the range 0 to 1) I get something like this:

I'm now happy that I can produce a density map for the marching cubes algorithm (which will need a little tweaking) but for some reason when I run it through my implementation it's not producing what I expect.

My problem is that I'm getting something like the first image in this answer to my previous question, when I want to achieve the effect in the second image.

Upon further investigation I can't see how marching cubes does the "move vertex along the edge" type logic (i.e. the difference between the two images on my previous link). I see that it does do some interpolation, but I'm not convinced I have the correct understanding of what I think it should do, because the code in question appears to give the same result regardless of whether I use boolean or float values.

I took the code from here which is a C# implementation of marching cubes, but instead of using the MarchingCubesPrimitive I modified it to accept an object of type IDrawable, containing lists for the various collections (vertices, normals, UVs, indices), the logic was otherwise untouched.

My understanding is that given a very low isovalue the accuracy level of the surface being rendered should increase, so in short "less 45 degree slows more rolling hills" type mesh output. However this isn't what I'm seeing.

Have I missed something or is the implementation flawed and need to be fixed?

EDIT:

A little more detail on what I am seeing when I "marching cube" the data.

Ok so firstly, ignore the fact that the meshes created by the chunks don't "connect" (i'll probably raise another question about this later).

Then look at the shaping of the island, it's too ... square, from the voxels rendered as boxes you get the impression there's a clean soft gradual hill and yet from the image there are sharp falling edges even in the most central areas where the gradient in the first image looks the most smooth.

The data is "regenerated" each time I run this so no 2 islands come out the same, and it's purely random so not based on noise, but still, how can it look so smooth in 1 image and so not smooth in the other?

sentences:
(LWJGL) Pixel Unpack Buffer Object is Disabled? (glTextImage2D) I am trying to create a render target for my game so that I can re-render at a different screen size. But I am receiving the following error:

Exception in thread "main" org.lwjgl.opengl.OpenGLException: Cannot use offsets when Pixel Unpack Buffer Object is disabled

Here is the source code for my Render method:

    // clear screen
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    // Start FBO Rendering Code
    // The framebuffer, which regroups 0, 1, or more textures, and 0 or 1 depth buffer.
    int FramebufferName = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, FramebufferName);

    // The texture we're going to render to
    int renderedTexture = glGenTextures();

    // "Bind" the newly created texture : all future texture functions will modify this texture
    glBindTexture(GL_TEXTURE_2D, renderedTexture);

    // Give an empty image to OpenGL ( the last "0" )
    glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, 1024, 768, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);

    // Poor filtering. Needed !
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

    // Set "renderedTexture" as our colour attachement #0
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, renderedTexture, 0);

    // Set the list of draw buffers.
    IntBuffer drawBuffer = BufferUtils.createIntBuffer(20 * 20);
    GL20.glDrawBuffers(drawBuffer);

    // Always check that our framebuffer is ok
    if(GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE){
        System.out.println("Framebuffer was not created successfully! Exiting!");
        return;
    }

    // Resets the current viewport
    GL11.glViewport(0, 0, scaleWidth*scale, scaleHeight*scale);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    // let subsystem paint
    if (callback != null) {
        callback.frameRendering();
    }

    // update window contents
    Display.update();

It is crashing on this line:

glTexImage2D(GL_TEXTURE_2D, 0,GL_RGB, 1024, 768, 0,GL_RGB, GL_UNSIGNED_BYTE, 0);

I am not really sure why it is crashing and looking around I have not been able to find out why. Any help or insight would be greatly welcome.

sentences: Can I use xna tutorials to learn monogame? Can I use xna tutorials to learn monogame? I can't find any good monogame tutorials but there are tons of xna tutorials available and from what I have seen they are pretty much the same thing.

sentences:
What shall I choose between CoronaSDK or AirPlay? 1st Question is I want to write a board game for iOS and Android so I'm coming up with CoronaSDK and AirPlay. Since I have a mac, development platform is not an issue but the problem is which one should I choose. I'm fluent with PHP and web languages and familiar with C but it's a new language for Lua. I know a lot of people prefer Corona but why not Airplay? It even provides more devices and able to write in C/C++.

2nd Question is I want a SDK with shortest development time and easier coding. I don't need complex 3D or animation engine since the game is a board game like chess or monopoly. What would you recommend?

Really appreciate anyone trying to answer my questions here :)

sentences:
Start Countdown on Resuming Game (Unity) I am pausing game by setting Time.timeScale to 0. And When the Game resumes Time.timeScale is set to 1f again, and game resumes. Now I want to add timer before actually resuming game. It shows 3,2,1,Go and player starts running. But problem is that It is not counting as Time.timeScale is set to zero. And if i set Time.timeScale to 1, the player starts running immidiately and countdown also starts perallaly. Actually I want to start countdown first and then to resume game. I've added the code below, that i've used. The game and timer both is activated perallally by following code.

IEnumerator WaitToResumeGame()
{
    for (int i = 0; i <= 3; i++) {
        yield return new WaitForSeconds (1f);
        TimerText.GetComponent<Text> ().text = "" + i;
    }
    TimerText.SetActive (false);
}

public void ResumeGame()
{
    pausePanel.SetActive (false);
    TimerText.SetActive (true);
    Time.timeScale = 1f;
    StartCoroutine (WaitToResumeGame ());
}

sentences:
How to use a boolean to activate every item with the same tag? I've been really stuck on this one and need some help.

I've got some accessories for my player, and my goal is to have a collider,
with the script attached. When the player walks into the script, the inactive model components on the player, will be set to active.

This is the script I'm using:

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

public class ItemEquip : MonoBehaviour
{
    public GameObject[] Apparel;
    public bool SetActive;

    void Start()
    {
        Apparel = GameObject.FindGameObjectsWithTag("Apparel");
    }

    void OnTriggerEnter(Collider ApparelCollect)
    {
        if (ApparelCollect.CompareTag("Player"))
        {
            GameObject[] clothes = GameObject.FindGameObjectsWithTag("Apparel");
            foreach (GameObject apparel in clothes)
            {
                apparel.SetActive(true);
            }
        }
    }
}

I'm really stuck on this. It's something basic but despite trying several tutorials, asking some people I know and experimenting, nothing is getting this script to work.

What I've tried:
-Deactivating the individual components
-Attaching a script to each component, along with the trigger
-Activating the individual components (from inspector)
-Activating the script (from inspector)
-Double checking that each component I want affected has the Apparel tag
-Cry in a corner

I've been going around in a loop for ages trying to get this thing to work, but still nothing.

I'm self taught on game development, working on my first game. I've read the Unity manual (that absolutely did not help) as well as hit up YouTube and multiple forums, all with no luck.

sentences:
Problem calculating screen point for a point in a 3D world with view matrix and projection matrix I am trying to calculate the 2D screen point of a 3D world position. For this I use the multiplication ViewMatrix * ProjectionMatrix. But I am not getting good results and I think I am messing up my calculations or my ViewMatrix itself is wrong (I think the latter).

This is a snapshot of how my ViewMatrix looks like when the camera is looking downwards (at my feet):

 0.362,    0.932,    0.000,    0.000
-2.241,    0.094,   -0.966,    0.000
-0.900,    0.350,    0.259,    0.000
 8.100,  -16.860,    4.598,    1.000

I calculate my left handed perspective ProjectionMatrix manually using 4/3 aspect ratio 60 FOV and using 0.1 and 1000 for my near and far Z. This is the ending projection matrix:

-0.117,    0.000,    0.000,    0.000
 0.000,   -0.156,    0.000,    0.000
 0.000,    0.000,    1.000,    1.000
 0.000,    0.000,   -0.100,    0.000

I multiply the previous 2 matrices with ViewMatrix * ProjectionMatrix and use that as my ViewProjectionMatrix.

Now I need to calculate the clipping space coordinates of the 3D point. I do this as follows:

XMFLOAT4 clipCoords;
clipCoords.x = pos.x * viewMatrix._11 + pos.y * viewMatrix._21 + pos.z * viewMatrix._31 + viewMatrix._41;
clipCoords.y = pos.x * viewMatrix._12 + pos.y * viewMatrix._22 + pos.z * viewMatrix._32 + viewMatrix._42;
clipCoords.z = pos.x * viewMatrix._13 + pos.y * viewMatrix._23 + pos.z * viewMatrix._33 + viewMatrix._43;
clipCoords.w = pos.x * viewMatrix._14 + pos.y * viewMatrix._24 + pos.z * viewMatrix._34 + viewMatrix._44;

Now I convert this to normalised device coordinates:

XMFLOAT3 NDC;
NDC.x = clipCoords.x / clipCoords.w;
NDC.y = clipCoords.y / clipCoords.w;
NDC.z = clipCoords.z / clipCoords.w;

As a final step I convert it to the 2D point on a screen for a given size:

XMFLOAT2 screen;
screen.x = (windowWidth / 2 * NDC.x) + (NDC.x + windowWidth / 2);
screen.y = -(windowHeight / 2 * NDC.y) + (NDC.y + windowHeight / 2);

Can you spot the problem with the above calculation?

Steffen

sentences: Will changing app name in iOS app store affect/reset app ranking? I want to change the name of my app but was wondering if that would change/affect/reset the ranking it already has. Anyone know?

sentences:
Manipulating Perlin Noise I've been learning about Procedurally Generated Content lately (in particular, Perlin noise). Perlin noise works great for making things like landscapes, height maps, and stuff like that. But now I am trying to generate structures more like mountain ranges (in 2D, as 3D would be way over my head right now) or underground veins of ores.

I can't manage to manipulate Perlin Noise to do this. Making a cut off point (i.e. using only the tops of the 'mountains' of a heightmap) wouldn't work, because I would get lumps of mountains/veins. Any suggestions?

Thanks,
Numeri

sentences:
Coins are solid objects and I can't collect them I am just starting out with Unity following along with this video, and I am stuck at roughly 1 hour and 54 minutes in: https://www.youtube.com/watch?v=pwZpJzpE2lQ
It is worth noting that the video uses Unity 2019.4.4f1 whereas I am using Unity 2020.3.2f1.
My issue is that I cannot get my character to pick up coins and they are currently solid, uncollectable objects. The coins are all set to the Coin layer (layer 9) as per the video.
Here is my code (which I looked over a dozen times to see if there were any differences from the video's code and couldn't find any, hence my confusion). Does anyone know where I went wrong?
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    [SerializeField] private Transform groundCheckTransform = null;
    [SerializeField] private LayerMask playerMask;

    private bool jumpKeyWasPressed;
    private float horizontalInput;
    private Rigidbody rigidbodyComponent;

    // Start is called before the first frame update
    void Start()
    {
        rigidbodyComponent = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        // Check if space key is pressed down
        if (Input.GetKeyDown(KeyCode.Space))
        {
            jumpKeyWasPressed = true;
        }

        horizontalInput = Input.GetAxis("Horizontal");
    }

    // FixedUpdate is called once every physic update
    private void FixedUpdate()
    {
        rigidbodyComponent.velocity = new Vector3(horizontalInput, GetComponent<Rigidbody>().velocity.y, 0);

        if (Physics.OverlapSphere(groundCheckTransform.position, 0.1f, playerMask).Length == 0)
        {
            return;
        }

        if (jumpKeyWasPressed)
        {
            rigidbodyComponent.AddForce(Vector3.up * 7, ForceMode.VelocityChange);
            jumpKeyWasPressed = false;
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.layer == 9)
        {
            Destroy(other.gameObject);
        }
    }
}

sentences: How to simulate cylinder shape in collision detection? AFAIK, many physics engines like Physx and Havok don't incorporate cylinder as basic shape because it is expensive than sphere, box and capsule. But bullet engine does incorporate cylinder as a basic shape. Do they found any fast algorithm to simulate the cylinder and what is that?

sentences:
Correct normal map for rotated sprites I am trying to find the best way to correctly do normal mapping in a 2D batched sprite renderer.

For each sprite sheet (aka texture atlas) I render all sprites as a textured quads with a single glDrawElements() call. Therefore, vertex coordinates in VBO are already transformed (on CPU) according to sprite position, rotation and scale.

Unfortunately, on rotated sprites normal map texture is also rotated, leading to incorrect normals:

I did a bit of research on this subject and so far I found few possible solutions:

Pass tangents to shader. Pretty straightforward, the same way it's usually done for 3D models. While this approach would work, doing it for just simple 2D sprites seems quite wasteful.
Pass just sprite rotation in additional vertex attribute. Then I could use this attribute in the fragment shader to rotate normal vector accordingly.
Use dFdx(), dFdy() functions. It looks like I could use these functions to deduce transformation from screen to texture coordinates and then use it to rotate normals. To be honest, this approach is not entirely clear to me, and I don't fully understand its possible performance implications, especially on mobile platforms.
Use geometry instancing. I think if I use glDrawElementsInstanced() and just dump all the sprite coordinates + transformations in one giant texture buffer, I then could use this information in the fragment shader to rotate normals. But as with approach #3, I don't fully understand if it could lead to possible performance or compatibility issues on mobile platforms.

So far I think approach #2 is probably the better solution. Not only it is simple and requires minimal changes to the code, but it would also allow me to offload sprite rotation calculations from CPU to GPU. I'd still have to pass sprite rotation per-vertex (and not per-sprite), but I don't think this is to big overhead.

But maybe there is a better, more elegant or more performant solution to this problem? How this is typically done in 2D games?

sentences: Should I give each character its own VBO or should I batch them into a single VBO? I'm making a 3D first person game. Should I give each character its own VBO or should I batch all characters into a single VBO?  What are the pros/cons?

sentences:
What are patterns and how to use them? (Othello/Chess...) I'm currently trying to make a Othello-playing program. My biggest concern at the moment is the evaluation function of game positions. Currently my evaluation function is quite primitive...move counting, looking for corner plays etc.

I tried to implement the evaluation functions of IAGO(1981) and BILL(1986).

I tried to read a bunch of papers, Michael Buro's stuff especially, but I failed horribly. It seems as I miss some fundamental knowledge. I neither get to understand how patterns work nor how to create them.

As far as I understand they are used to rate constellations of rows, columns, edges, 3x3 corners etc.

I'd highly appreciate if someone could provide me the following information:

What data structure has a pattern?
Given a certain game position how would I make use of this pattern to evaluate the situation?

I think if I get answers to those questions, I'll probably be able to understand the following aswell, but I'll mention them anyway.

How are patterns created? I saw that an approach is to assign static values to different squares of the game board, dependant of their current properties(color, stability). But then there is some iterative algorithm called.
So are patterns created on the fly e.g. while searching a tree? Or computed before and used like a mask?

I hope this question isn't too broad, but I got the impression that creation and use of patterns is some obvious common knowledge, that everyone does almost the same way, like use of alphabeta.

sentences:
Update function - design patterns I started reading about game development design patterns and from my experience there are 2 options for update methods. The first one receive from the game loop and delta time of this update and multiple everything by it, for example position += speed * delta_time. And this will happen in the game loop without delay.

The second option is too set constant frame delay and use it. In the end of the loop function you use sleep(last_frame_time + frame_length - current_time).

Does it matter what do I use? What's more common? I know unity use the delta time technique but it's the only one I saw that use it. I would like to hear your opinions on what to use for both options.

Should I always use the first option? always the second?

Thank you for your time.

sentences:
Drawing a pixel to RenderTexture I would like to know how you would go about drawing a single pixel to a RenderTexture in Unity.

In XNA, it was just a matter of setting the graphic device's active renderTarget, and drawing to it.

In Unity, I am unable to figure out how to do this properly.  I attempted to use Graphics.DrawTexture, but that seems to be horribly slow.

I imagine there is something that can be done with GL, but I haven't been able to make it draw in side the RenderTexture properly.

Here was my attempt with DrawTexture:

    RenderTexture.active = rt;
    GL.PushMatrix();
    GL.LoadPixelMatrix(0, 128, 128, 0);

    for (int x = 0; x < 128; x++)
    {
        for (int y = 0; y < 128; y++)
        {
            Graphics.DrawTexture(new Rect(x, y, 1, 1), texture, mat);
        }
    }

    GL.PopMatrix();
    RenderTexture.active = null;

sentences:
Mouse state not acting as I intend it to I am creating an inventory system.  I have it working well, but for some reason when I pick up an item from a slot(lets say slot 2 of 20) and drop it into that same slot(slot 2) the mouse state fails to update correctly, resulting in the item being dropped and picked back up in the same cycle.  I feel like I am missing something here, but would appreciate any help.  Below is my code.

The method that controls the Item being Dropped into the inventory:

    public void ItemDropped(Vector2 pos, Item item)
    {
        for (int intlc = 0; intlc < InvBoxes.Count; intlc++)
        {
            if (InvBoxes[intlc].Intersects(new Rectangle((int)pos.X, (int)pos.Y, 1, 1)))
            {
                if (Items[intlc] != null)
                {
                    ClampedItem = Items[intlc];
                }
                else
                {
                    //Set bln in Game to stop drawing item at cursor
                    ClampedItem = null;
                    GlobalVariables.TheGame.blnClamp = false;
                }
                Items[intlc] = item;
                break;
            }
        }
    }

Logic in my Inventory Class' Update method to Update the mouse state, after setting the old mouse state.  Then it check for hovering over an item, and sets all old hovers to false.  It then looks for if I am clicking on the item hovered over, and therein lies the problem :

        oms = ms;
        ms = Mouse.GetState();

        //set hover
        for (int intlc = 0; intlc < Items.Count; intlc++)
        {
            if (Items[intlc] != null)
            {
                if ((ms.X - Items[intlc].location.X) < 50 && (ms.X - Items[intlc].location.X) > 0 && (ms.Y - Items[intlc].location.Y) < 30 && (ms.Y - Items[intlc].location.Y) > 0)
                {
                    Items[intlc].invhover = true;
                }
                else
                {
                    Items[intlc].invhover = false;
                }
            }
        }

            for (int intlc = 0; intlc < Items.Count; intlc++)
            {
                if (Items[intlc] != null)
                {
                    if (Items[intlc].invhover)
                    {

                        if (ms.LeftButton == ButtonState.Pressed && oms.LeftButton == ButtonState.Released)
                        {
                            ClampedItem = Items[intlc];
                            Items[intlc] = null;
                            GlobalVariables.TheGame.blnClamp = true;
                        }
                    }
                }
            }

In my game Class at the end of the the Update I have a few calls that pertain to this issue :

        Rectangle rect = new Rectangle(mouseState.X, mouseState.Y, 1, 1);

        if (blnClamp)
        {
            if (rect.Intersects(inventory.Bounds) && mouseState.LeftButton == ButtonState.Pressed && MoldState.LeftButton == ButtonState.Released)
            {
                inventory.ItemDropped(new Vector2(mouseState.X, mouseState.Y), inventory.ClampedItem);
            }
        }

        inventory.Update(InvPos);

If you look at the conditional in my game's inventory's Update method's check for mouse state's current and old button state being pressed and released, when I grab an item from slot 1 and drop it into slot 2, the mouse state conditional validate as intended.  But when trying to grab the item at slot 1 and drop it back into slot one, the item drops, and is immediately clamped again because old mouse state is up and new mouse state is down.  Both instances will hit the conditional that is inside the hover conditional.

Additional Note : When I put a breakpoint on the ItemDropped Method inside my inventory class, the debugger causes the mouse state to update as intended, and the item that I picked up out of slot 2 is placed into slot 2 without fail.  There is a flaw programatically to how I have my updates set up somehow.

sentences:
What are the responsibilities of a game engine, and which of these things need to especially be efficient? Possible Duplicate:
  What should a game engine do?

What are the usual responsibilities of a game engine, and which of these things especially need to be efficient (performance-wise)?

Can I get a break-down of the purposes that a game engine is used to serve, and how it differs from a game itself? I'm a newb, so some intuitive things may need to be explained.... Thanks! :)

sentences:
FMod, Multisound Module not looping in game I am currently trying to implement a simple soundtrack in the Unity3D Angry Bots Demo using FMod. I created an event with a Multisound Event, containing 2 loops a 16 Bars. The event is 16bars long and inside a Loop Region. I set the the Module to loop (not the individual loops) and the Playlist mode to random. When I trigger the the event from inside Unity3D using .play() the event plays, but after 32 bars there's silence. After a while the module starts playing again. I Believe the module waits a couple of bars before it triggers another loop. I have Quantization set to tempo (though I think that makes no difference in my case).

Are Multisound events the right way to go - or am I missing something else?

sentences:
Designing a simple snake A.I I've looked at some stuff online regarding this specific topic, and a lot of the info that I read involved graphs and path finding.

I really don't want to get involved in something too complex & out of my level, and also I don't need my snake to be that intelligent (it will be a large board with the snake not growing in size on every munch).

How could you structure a simpler AI for the snake that gets the job done relatively well? I would be able to get the snake to move towards the food item correctly, but my issue is that I'm not sure how to deal with the snake colliding with itself. Say the snake has a look ahead, and it finds that its tail is in the way, it could change direction, but what happens next?

Any ideas on how to tackle this? Should the snake build an instruction set from every square, or should it think on the go?

sentences:
unity game engine - should I be using a di framework / ioc container Is it worthwhile for a solo dev to take up the widely recommended practice of using a dependency injection framework within the unity game engine? I have seen reason for concern regarding the clash of development methodologies that seems to have put some people off. If you would recommend against the practice, what would be a better substitute to avoid rigid bindings and singletons.

The focus of this question is primarily on the supposed clash with the unity way of things, which has apparently made a lot of people feel like they are spending more of their time fighting their tools instead of making games. I don't want to spend all my time worrying about nice code and have no game at the end of it, so advice and answers are appreciated.

So far my thinking is that it might be worthwhile for larger projects/ long term projects or projects with a team of more than a few people, but for small projects, time limited projects and indie/hobbyist projects its probably not a worthwhile investment of effort. Instead so far I'm thinking a minimum of tdd but then whatever you feel comfortable with, trying to maintain some of the most important principles in programming, such as yagni, kiss and srp. I watched a talk by johnathon blow where he essentially says to keep things simple and don't overthink them.

Am I mistaken in my assesment? Am I attributing more effort to working with di frameworks than is fair? Is it skewed by my inexperience? If you work with di and you find it actually speeds up your workflow while at the same time gaining the advantages di offers, please leave a comment or answer as you are someone I would love to hear from.

sentences:
Render object with different shader depending on the camera I have an object with a custom shader. When it is being rendered by cameraA, then I want it to render a particular way (ex red). When it is rendered by another cameraB, I want it to render a different way (ex green).

Is there some way I can tell what is the current camera rendering in the shader? Or perhaps I can toggle a boolean value in my shader between rendering of each camera? Where would I do this (OnPostRender() maybe?).

sentences:
Imageeffects: No need for Framebuffer? Just use Textures and Shaders? I am doing simple Image Effects, and always i see in examples, that people are binding textures to framebuffers. Why can't i just use textures?

So the process would be.

1) Input Texture
2) Shader: Do Processing on this Shader
3) Render to the same Texture

So no need for framebuffer? This step is done completely linear...no off-screen rendering. So cani say that i don't need a framebuffer in this scenario?

thanks!

sentences:
My 2D Sprite/Diffuse material is not lighting when I start the game I put a Sprite/Diffuse Material on my Player.

In the scene, before starting the game it looks ok (1st screenshot).

After starting the game it still works fine, but when I am starting to move the player on x-axis the it becomes black (2nd screenshot).

Why?

This is the script I use to transform the Player's position and scale:

void Update()
{
    Move();
    {
        float moving = Input.GetAxis("Horizontal");
        characterAnim.SetFloat("Speed", moving);
    }
}

void Move()
{
    if (Input.GetKey("right"))
    {
        transform.localScale = new Vector2(1, 1);
        transform.Translate(Vector2.right * speed * Time.deltaTime);
    }
    if (Input.GetKey("left"))
    {
        transform.localScale = new Vector2(-1, 1);
        transform.Translate(Vector2.right * speed * Time.deltaTime);
    }
    //    rb2D.AddForce(transform.up * 20);
}

sentences:
Making multiple VertexPositionColor variables in the same class? - XNA I have studying XNA on my spare time for about a year now and I could use some professional help on this issue. Any time given to my problem is appreciated.

I have two VertexPositionColor variables both of which are placed into two separate vertex buffers to draw up three triangles

basicEffect = new BasicEffect(GraphicsDevice);
        VertexPositionColor[] vertices = new VertexPositionColor[6];
        vertices[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Red);
        vertices[1] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Green);
        vertices[2] = new VertexPositionColor(new Vector3(1, -1, 0), Color.Blue);
        vertices[3] = new VertexPositionColor(new Vector3(0.05f, 1, 0), Color.Yellow);
        vertices[4] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Blue);
        vertices[5] = new VertexPositionColor(new Vector3(-1, 1, 0), Color.Pink);
        vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 6, BufferUsage.WriteOnly);
        vertexBuffer.SetData<VertexPositionColor>(vertices);

        VertexPositionColor[] vertices2 = new VertexPositionColor[3];
        vertices2[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Blue);
        vertices2[1] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Red);
        vertices2[2] = new VertexPositionColor(new Vector3(0.9f, -0.9f, 0), Color.Orange);
        vertexBuffer2 = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 6, BufferUsage.WriteOnly);
        vertexBuffer2.SetData<VertexPositionColor>(vertices2);

I then use the draw function to draw all three triangles ..

public override void Draw(GameTime gameTime)
    {
        basicEffect.World = world;
        basicEffect.View = view;
        basicEffect.Projection = projection;
        basicEffect.VertexColorEnabled = true;
        GraphicsDevice.SetVertexBuffer(vertexBuffer);
        GraphicsDevice.SetVertexBuffer(vertexBuffer2);
        RasterizerState rasterizerState = new RasterizerState();
        rasterizerState.CullMode = CullMode.None;
        GraphicsDevice.RasterizerState = rasterizerState;
        foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
        {
            pass.Apply();
            GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 3);

        }
        base.Draw(gameTime);
    }

But it does not draw all three triangles. I have tried various variations and all that gets drawn is either the last vertex buffer or the first one. I know it would be more efficient to place them all in the same buffer or have them used with indices, but in the future I will run into issues where I am going to need more than one buffer to draw something and I want to be prepared. What is the problem here and how do I draw more than one vertex buffer at a time?

sentences:
Why does the player fall down when in between platforms? Tile based platformer I've been working on a 2D platformer and have gotten the collision working, except for one tiny problem. My games a tile based platformer and whenever the player is in between two tiles, he falls down.
Here is my code, it's fire off using an ENTER_FRAME event. It's only for collision from the bottom for now.

        var i:int;
        var j:int;
        var platform:Platform;
        var playerX:int = player.x/20;
        var playerY:int = player.y/20;
        var xLoopStart:int = (player.x - player.width)/20;
        var yLoopStart:int = (player.y  - player.height)/20;
        var xLoopEnd:int = (player.x + player.width)/20;
        var yLoopEnd:int = (player.y + player.height)/20;
        var vy:Number = player.vy/20;
        var hitDirection:String;
        for(i = yLoopStart; i <= yLoopEnd; i++)
        {
            for(j = xLoopStart; j <= xLoopStart; j++)
            {
                if(platforms[i*36 + j] != null && platforms[i*36 + j] != 0)
                {
                    platform = platforms[i*36 + j];
                    if(player.hitTestObject(platform) && i >= playerY)
                    {
                        hitDirection = "bottom";
                    }
                }
            }
        }

This isn't the final version, going to replace hitTest with something more reliable , but this is an interesting problem and I'd like to know whats happening. Is my code just slow? Would firing off the code with a TIMER event fix it? Any information would be great.

sentences:
How to achieve smooth sprite movement with a scaled up canvas? I'm developing a simple 2d platformer using haxe & openfl (currently targeting flash). To achieve the old school pixelation effect I draw 16x16 sprites over a 4x scaled up canvas. With this approach character movement is very jerky since it seems to consist of a sequence of 4px jumps.

So my question is: how to be smooth & old school at the same time? Thank you for your time.

sentences:
Determining whether an object is in field of view considering obstacles I'm thinking of stealth games where an object has a certain field of view that you want to avoid otherwise game over.

The field of view may be linear or circular or any arbitrary group of pixels/tiles.

If I don't consider obstacles (for example, if you're standing behind a wall, they can still see you), I can determine whether the player is within an object's field of view using simple geometric properties using the two object's positions and range. This can be done efficiently, though it kind of assumes the objects are points.

However, to make it realistic, you should be able to hide behind a wall or a tree without being seen.

How is this problem usually solved?
What are some articles that I can read to understand more about this problem?

sentences:
Importing materials from blender to UE4 So my problem is that I have a nice green glass material in blender which I imported to UE4 (4.8.1) but in the editor the material was just a simple green colour.

I have no idea what I should do to fix this problem.

I appreciate any help. If you need any more details or pictures, let me know.

Thank you

Glass in blender:

Material in blender:

Glass in UE4:

Material in UE4:

sentences:
What's the difference between UnityEngine.Random and System.Random? What's the different between this

int randomNumber = UnityEngine.Random.Range(0, 10);

and this

// on top of the class
private System.Random _rnd = new System.Random();

// inside a methode of the same class
int randomNumber = _rnd.Next(0, 10);

I know System.Random must always be initialized on the top of your class what's by UnityEngine.Random is not needed. I know also that System.Random works with a intern "clock" and the "random" number is based on that.

My question is now are there some other difference between UnityEngine.Random and System.Random and witch code is better to use for an Unity project?

sentences:
Unity3D Raycasting in Start behaves uncorrectly, but works correctly in Update? I have this method, which just raycasts at a position downwards, and checks what tile is there, if there is one:

    public static Tile RaycastTile(Vector3 position)
    {
        Debug.Log("raycastTile at pos: " + position);
        var layerMask = 1 << LayerMask.NameToLayer("Floor");
        RaycastHit hit;
        Debug.DrawRay(position, new Vector3(0, -10, 0), Color.red, 50);
        if (Physics.Raycast(position, new Vector3(0, -1, 0), out hit, 10, layerMask))
        {
            var tile = hit.collider.gameObject.transform;
            Debug.LogWarning(tile.name + " - " + tile.parent.name + " - at pos: " + tile.position);
            var coordinates = new Vector2Int(Mathf.RoundToInt(tile.position.x) / 2, Mathf.RoundToInt(tile.position.z) / 2);
            return map.GetTile(coordinates);
        }
        else
        {
            Debug.LogError("Tile not found under position: " + position);
            Debug.Break();
            return null;
        }
    }

Currently it is called for the player

at Start() ("starting at: < player's absolute position >")
and at Update() ("update at pos: < player's absolute position >")
And the map is being generated (tiles created, destroyed, etc) in Awake().

and for some reason this is the output:

And the map generation works like this:

Creates a room at (0, 0) with tiles and all, then it searches for a connection point on the existing map, whom the new room could be connected to. (with some rotation, if it's needed)
(Every tile is 2x2 meters, and they are on a strict grid)

So for some reason calling this method at Start() (with the same position) hits a totally different tile. While in Update() it works correctly.

At first I thought that it's because of Destroy(), because the objects are only destroyed at the end of the frame. But I tried DestroyImmediate() and it didn't help. (And after thinking, I realised that destroying objects at the end of the frame wouldn't cause issues. Or is it?)

Then I had the idea, that maybe Start doesn't wait for Awake because it compute heavy. And the raycast in the Start hits a (yet) non translated newly generated room. So I edited the code so every room is initially created at very far away, which is relatively "infinite far away" from the player: at (9999, 9999). But the issue remained.

EDIT: With (9999, 9999) Sometimes (maybe half of the time?) now it is correctly raycasted even at start, while before it was never correct in start.

EDIT2: With (0, 0) it hits correctly at start as well, but very very rarely.

Do you have any idea what could cause this issue?

Sorry if there isn't enough info, feel free to ask. :)

sentences:
How would I handle input with a Game Component? I am currently having problems from finding my way into the component-oriented XNA design.

I read an overview over the general design pattern and googled a lot of XNA examples. However, they seem to be right on the opposite site. In the general design pattern, an object (my current player) is passed to InputComponent::update(Player). This means the class will know what to do and how this will affect the game (e.g. move person vs. scroll text in a menu).

Yet, in XNA GameComponent::update(GameTime) is called automatically without a reference to the current player.

The only XNA examples I found built some sort of higher-level Keyboard engine into the game component like this:

class InputComponent: GameComponent
{
    public void keyReleased(Keys);
    public void keyPressed(Keys);
    public bool keyDown(Keys);

    public void override update(GameTime gameTime)
    {
        // compare previous state with current state and
        // determine if released, pressed, down or nothing
    }
 }

Some others went a bit further making it possible to use a Service Locator by a design like this:

interface IInputComponent
{
    public void downwardsMovement(Keys);
    public void upwardsMovement(Keys);
    public bool pausedGame(Keys);

    // determine which keys pressed and what that means
    // can be done for different inputs in different implementations
    public void override update(GameTime);
 }

Yet, then I am wondering if it is possible to design an input class to resolve all possible situations. Like in a menu a mouse click can mean "click that button", but in game play it can mean "shoot that weapon".

So if I am using such a modular design with game components for input, how much logic is to be put into the InputComponent / KeyboardComponent / GamepadComponent and where is the rest handled?

What I had in mind, when I heard about Game Components and Service Locator in XNA was something like this:

use Game Components to run the InputHandler automatically in the loop
use Service Locator to be able to switch input at runtime (i.e. let player choose if he wants to use a gamepad or a keyboard; or which shall be player 1 and which player 2).

However, now I cannot see how this can be done.

First code example does not seem flexible enough, as on a game pad you could require some combination of buttons for something that is possible on keyboard with only one button or with the mouse)
The second code example seems really hard to implement, because the InputComponent has to know in which context we are currently. Moreover, you could imagine your application to be multi-layered and let the key-stroke go through all layers to the bottom-layer which requires a different behaviour than the InputComponent would have guessed from the top-layer.
The general design pattern with passing the Player to update() does not have a representation in XNA and I also cannot see how and where to decide which class should be passed to update(). At most time of course the player, but sometimes there could be menu items you have to or can click

I see that the question in general is already dealt with here, but probably from a more elobate point-of-view. At least, I am not smart enough in game development to understand it. I am searching for a rather code-based example directly for XNA.

And the answer there leaves (a noob like) me still alone in how the object that should receive the detected event is chosen. Like if I have a key-up event, should it go to the text box or to the player?

sentences:
Approach to puzzle generation I have a task in hand about making a puzzle generator, that can fill a game board with colored pearls, that then needs to be solved by the player.

The core rules are

Pearls are placed in a grid, size varying each level.
The player needs to clear out all the pearls, or the level is lost.
Only three pearls in a row (adjacent to each other) can be popped.
Popping 7 or more will pop each pearl of that color, easing up the board quite a lot.
Pearls are affected by gravity, and will fall down on the cleared pearls place.
No new pearls are spawned.

I also need two levers to adjust difficulty. One being the number of colors the pearls can have (clear to the player) and another being a "cruelty" factor in how tight the spectrum of right solutions vs dead ends the level contains.

I seem to be at a crossroad between two ways of approaching this, and would like feedback from you gents and gals.

My two options seems to be :

Start out with a clean board, and programmatically add pearls-combos to the board till its full. Then the player needs to track backwards from there to solve it. (They wont see it actually being generated, this will happend backstage) This should ensure that a board always have at least one solution, which is backtracking how the engine placed the pearls in the first place.
Making a pure random board, and then set a scripted runner to try and solve it, branching every time there are more than poppable option, and starting over on a new board if all branches leads to a dead end. This should give me a good result about how many dead ends vs solutions the board contains.

Im not sure which is the best approach, or if I got it all wrong and need to go for a third approach to this. Admittedly, this is my first attempt on a puzzle game mechanics.

sentences:
Farseer: What can I do so that a body can move through a special kind of bodies? I have three different kinds of rectangles. Black, white and blue rectangles. The rectangles are moving and can collide with each other. But with one exception, the blue rectangle can collide normally with the black rectangle, but the blue rectangle should move through the white rectangle if it's touching the white rectangle. The white and black rectangles can collide normally.

How can I do that? In the moment, the blue rectangle isn't moving through the white rectangle if it's touching the white rectangle. What can I do so that the blue rectangle can move through the white rectangle, but not through the black rectangle?

I solved the problem with CollisionWidth.

For expamle:
Body.CollisionWidth = Categorie.Cat5

In this case, the body just collides with bodies which have the CollisionCategorie 5.

sentences:
Unity - Issue with Camera follow script I have a camera follow script which is attached to the main camera and it follows the players position and rotation. The player needs to be near the top of the screen. However when I hit play, the player  is shown at the center of the screen. This is how it looks in the scene view and this is how it should reflect when I hit play. Here the "y" position is -2 and "x" rotation is 0.

But when I press play, the "y" position is still -2 but "x" rotation changes to -14.9. And the player is shown at the center of the screen and not near the top.

Here is the camera follow script:
[SerializeField] Transform target;
public Vector3 defaultDist;
[SerializeField] float distDamp = .1f;

public Vector3 velocity = Vector3.one;

Transform myT;

void Awake()
{
    myT = transform;
}

void LateUpdate()
{
    SmoothFollow();
}

void SmoothFollow()
 {
    Vector3 toPos = target.position + (target.rotation * defaultDist);

    Vector3 curPos = Vector3.SmoothDamp(myT.position, toPos,ref velocity ,distDamp);
    myT.position = curPos ;

    myT.LookAt(target, target.up);
 }
}

After I hit play, I want the x rotation to stay at 0 and the player to be shown near the top of the screen. Can someone please help?

sentences: Python interpreter as in-game console Say I have a game which has lots objects (NPCs, monsters, etc.), I want a console so I can change the variables of the objects (like changing HP for example), how could I embed python into my program, so that I can change these variables and classes with a few keystrokes in the console? An example of a command would be: /monster 1 1 HP 100 (monster is the object name, 1 1 is the coordinates, and HP 100 is the variable to change, and to what amount)

sentences:
How can I prioritize the call order of decoupled scripts? I have a player with many individual components that each handle a behavior such as jump, block, attack, duck, etc..  None of the scripts know about one another. Each listens for a specific input to fire. Some behaviors share the same input depending on the characters state such as ok the ground, in the air.

I'm running into issue where the wrong behavior will fire that has shared input (down+attack instead of down+attack being held down for x seconds).

I'm looking for advice on how to manage these behaviors and have more control over what can happen when.

I've tried resolving this issue by creating a method that will disable other behaviors temporarily while completing the action and I've changed the script execution order.

I thought about adding a discrete player state and restricting what behaviors are able to be performed at any given time but this increases the complexity quiet a bit.

sentences:
Animating child objects via parent object animator in script I'm using unity 5

I'm trying to animate multiple child objects via a parent object. The animation worked in the animation view but would not work when I tried to preview the game. In the script I use the code:

ParentObject.GetComponent<Animator>().Play("intro");

to play the animation. A similar line of code worked when playing a singular object, not sure what's going wrong now, any sugestions?

sentences: AndEngine: How to add multiple fixtures into body? I want to create a custom body which have very random shape like a table. So how to add/combine multiple fixtures into a body?

sentences:
How do I allow a player to build a dedicated server, but prevent them from cheating? Instead of maintaining a central server, many games allow players to build their own server, like Minecraft.

But if you give them the server-side program, how could you prevent them from cheating? I thought it's impossible, but Team Fortress 2 seems doing that. Usual TF2 servers are built by players. But Valve sells the items in TF2, so they must have a way to prevent server owner generating these items.

sentences:
Handling buildings in isometric tile based games A simple question, to which i couldn't find a definitive answer - how to manage buildings on a tiled map? Should the building be sliced in to tiles or one big image?

EDIT:
The game is being built from scratch using C++/SDL 2.0, it will be a turn based strategy, something like Fallout 1 & 2 without the hex grid, a simple square grid, where the Y axis is squished by 50%.
Buildings can span multiple tiles, the characters move tile by tile. For now, the terrain is completely flat. Some basic functionality is in place, so I'm aiming to advancing the terrain and levels them selves - adding buildings, gates, cliffs, not sure about the elevation.

sentences: A ball hits the corner, where will it deflect? I need to brush up my trigonometry and hope you can help here with a simple mathematical model. Here is my model so far in the image attached. I am aware that the frame animation has other problems when the ball is moving very fast, but for now I just need to calculate ballDx and ballDy. It is also possible that ballDx = 0 (vertical movement only), but when the ball deflects ballDx may get a different value.

sentences:
MMO Client / Server Architecture (NoSQL) The main aim is to keep the games variables server-side for obvious security reasons.
I believe having server-side code to check before updating the games database values will protect me from classic game hacking methods.

To avoid clients sending direct updates to the database, the server first validates the clients requested actions.

The database keeps track of every Mobile & Item

The Server has all the game-logic

The clients simply render and work as controllers that send the server actions that wont occur unless validated by the servers logic.

Clients should only send the server "Action Request"

Server then checks the "Action Request" with two possible outcomes :

Valid Request : Update DB and Re-send updated data to Clients for post-processing.
Invalid Request : Notify the client that the Request was invalid.

I need to know if im thinking in the right tracks.
Thanks.

sentences: How to flip a box2d body when it can't move forward? LibGDX I'm attempting to create a simple enemy for a platformer. It should move forward constantly until it hits something like a wall, and then it should flip and move forward the other direction. How might I accomplish this?

sentences:
GameObject not destroyed in ExecuteInEditMode and spooky Instantiating I was trying to get familiar with Unity's ExecuteInEditMode

Everything is fine it keeps the old object although I have deleted them.

And one more thing, although every-thing (cube) is instantiated is set as child of GameObject script is attached to, they where the other cubes come from?

I have this code:

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

[ExecuteInEditMode]
public class Road : MonoBehaviour
{
    public List<Vector3> points = new List<Vector3>();
    public List<GameObject> gameObjects = new List<GameObject>();
    private int count = 0;
    void Start()
    {}
    void Update()
    {
        if(count!=points.Count)
        {
            count = points.Count;
            foreach(GameObject g in gameObjects)
            {
                DestroyImmediate(g);
            }
            gameObjects.Clear();
            int i = 0;
            foreach (Vector3 point in points)
            {
                Debug.Log(++i + "  " + point);
                GameObject tem = Instantiate(GameObject.CreatePrimitive(PrimitiveType.Cube), point, Quaternion.identity);
                tem.transform.parent = gameObject.transform;
                gameObjects.Add(tem);
            }
        }
    }
}

Here is a snap:

sentences:
How can I create straight, glowing lines? What techniques are used in this style?  What steps would be required to recreate it?

(Screenshot of this app: https://play.google.com/store/apps/details?id=com.dkeesto.holographlw)

sentences:
How can I end my game when the right character statistics get to 0? I'm creating a text-based RPG game.  In my game, a player has five different stats, which might decrease over time as the player does certain things.

public static int HP = 100;         //CHARACTER STARTING VITAL HIT POINTS
public static int food = 100;       //CHARACTER STARTING FOOD
public static int water = 100;      //CHARACTER STARTING WATER
public static int sanity = 100;     //CHARACTER MENTAL SANITY
public static int stamina = 100;    //CHARACTER STARTING STAMINA

I'm not sure how I can implement the logic to end the game when any of those stats reaches zero. My main game loop looks like this:

public static void main(String args[]){
    Map mainMap = new Map(10, 10);
    Character hero = new Character(mainMap);
    Main.start();

    while (true) {
        printmap(hero, mainMap);

        // Ask the player what direction to move, move the player.
        Character.moving();

        // ...
    }
}

The Character type has instances of all the players stats (as well as methods to increase or decrease them). How can I accomplish ending the game when a stat hits zero?

sentences:
Limit rotation angles for Quaternion I have a short snippet that's rotating the meshes of the wheels as I'm driving forward, but it's also rotating wheels to match the direction I'm turning, and I wish to turn this off completely.

        Quaternion quat;
        Vector3 position;
        m_WheelColliders[i].GetWorldPose(out position, out quat);
        m_WheelMeshes[i].transform.position = position;
        m_WheelMeshes[i].transform.rotation = quat;

How would I lock what angles I don't want the wheel meshes rotating?

sentences:
Best physics engine for OpenGL ES (different implementations)? Can you recommend a good physics engine which is easily portable between WebGL and other OpenGL ES implementations like in Android and iPhone?

I don't want a game engine. Only the physics part.

sentences: Detect android device rotation I am developing a game in android and I want to be able to use device rotation for moving. So, I am not sure what sensors should I use. I tried gyroscope, it will do, but there are not a lot of devices that supports gyroscope sensors. So, I want to use rotation around x,y,z axis not change like landscape/portrait mode. What sensors would be the best? I already tried to google it but I couldn't find anything.

sentences:
Create BoundingBoxes on a Model I am trying to create multiple BoundingBoxes on a Model by following this tutorial:

https://electronicmeteor.wordpress.com/2011/10/25/bounding-boxes-for-your-model-meshes/

However, I keep getting this error: Requested range extends past the end of the array. on this line:

part.VertexBuffer.GetData(part.VertexOffset * stride, vertexData, 0, part.NumVertices, stride);

I can't figure out why it is giving me that. I load my model and try to create the boxes like this:

Model model = this.Content.Load<Model>("Cube");
MeshModel box = new MeshModel(model);

Instead of passing a String path of the model, I just pass the Model itself (I changed the constructor to accept Model model).

Any help would be appreciated!

Here's what the debugger says (the vertexStride and VertexBuffer has 24 which is the same size as the vertexData so it should be ok):

sentences:
When do I copyright a game? I don't know how to copyright a video game idea.

I don't know if I should make a game document and get that copyrighted first or make the game then copyright it.

The main gist is.. I am lost.

sentences:
Calculating the weight of an object irrespective of the triangle or vertices count in Unity I have a meat piece which I want to weigh. Now there can be anything like fish, cheese, or other items that we can cut and measure. I want the weight to be determined by myself instead of determining from getting the surface of the item as it varies with different tris count.
Currently, I am calculating the weight from the following code.
public static float CalculateSurfaceArea(Mesh mesh)
{
    var triangles = mesh.triangles;
    var vertices = mesh.vertices;

    double sum = 0.0;

    for (int i = 0; i < triangles.Length; i += 3)
    {
        Vector3 corner = vertices[triangles[i]];
        Vector3 a = vertices[triangles[i + 1]] - corner;
        Vector3 b = vertices[triangles[i + 2]] - corner;

        sum += Vector3.Cross(a, b).magnitude;
    }
    // weightMultiplier is a constant value for getting a reasonable weight value.
    return (float)(sum / 2.0) * weightMultiplier;
}

So if there's a meat piece like bellow and I want it to be a weight of let's say 3kg(6.6lb)

then when I cut it into half it should give me values respectively (1.5kg).

So I want the weighing factor to be in my control so that if in the future we have really detailed high poly items the weight shouldn't get affected by that.

sentences:
GLSL - Only draw arond point / flashlight effect I'm currently trying to achieve a sort of flashlight effect in GLSL. I only want to draw textures within a certain distance of a specified point (the mouse position, for example). Here's a quick example drawing of the effect I wish to achieve:

I've successfully created a shader that checks the position from a certain point to the position of the fragment, and then discards the fragment if the distance is larger than the specified light radius. The frag shader looks like this:

#version 400

#ifdef GL_ES
precision mediump float;
#endif

in vec4 v_color;
in vec2 v_texCoords;
in vec2 v_position;

out vec4 outColor;

uniform sampler2D u_texture;
uniform vec2 u_mousePos;
uniform float u_lightRadius;

void main() {
    float distance = distance((v_position + 1.0) / 2.0, u_mousePosition);
    if(distance > u_lightRadius) {
        discard;
    }

    outColor = v_color * texture2D(u_texture, v_texCoords);
}

The problem with this shader is that the visible area isn't a circle, it's an elipse. This is obviously because the screen aspect ratio is not 1:1. I've tried multiplying the Y values of all of the position variables with a resolution uniform, but it still remains an elipse.

My other problem is that I wish to have smooth edges on my visible area. I've read up some on the subject and I see that you can use mix and/or smoothstep to achieve this, but I'm unsure on how to implement it.

Anyone got any suggestions?

sentences:
When to return a reference and when to return a copy? I was looking at the d3dx math .h and noticed that a difference between the "+" and "+=" operators:

D3DXVECTOR3& operator += ( CONST D3DXVECTOR3& );
D3DXVECTOR3 operator + ( CONST D3DXVECTOR3& ) const;

Why is it returning a reference in the case of a += operation and a copy in the case of + operation ?

I'm guessing in the first case it's modifying the vector on which you call the += operation, something like this:

this->_x += x;
...
return *this;

and in the case of a + operation it would be doing something like this:

return D3DXVECTOR3(this->_x + x, this->_y + y, this->_z + z);

That being said, if that's what happens in the D3DXVECTOR3 implementation, why not return a reference in the case of + operation ?

sentences: Is it a bad idea to have several audio sources on the same object in unity? The title is actually self-explanatory. I would like to know if there are any drawbacks (performance-wise, good-practice wise, etc.) for having multiple audio sources on the same GameObject. My initial intuition is that it gives me more freedom to have specific audio settings (volume, pitch, etc.) for each audio clip I want to play, but I want to know if this setup is advisable.

sentences:
Add a random number to an existing number to produce output in Unity I am trying to add a random number to an existing number. I am able to get the output in Unity console, but in the inspector, I can see that the public variable is on a non stop loop.

I intend to produce the result when I press the enter key. Is this an efficient way, or can I improve on the code? I am a beginner, and passionate to learn.

Here's the code:

using UnityEngine;
using System.Collections;

public class LearningScript : MonoBehaviour
{
    public int number1 = 5;
    public int number2 = 10;
    public int number3=20;
    public int finalResult;
    public string statement = "NO KEY PRESSED";

    void Update()
    {
        input ();
        if (Input.GetKeyDown (KeyCode.Return))
            Debug.Log (finalResult);
    }

    void Start(){}

    int addnumbers(int num1,int num2)
    {
        int additionResult = num1 + num2;
        return additionResult;
    }

    void input()
    {
        int randomNumber = Random.Range (1, 10);
        finalResult=    addnumbers (number1, randomNumber);
    }
}

sentences: How does an Input Pipeline work? I found this article on implementing an input pipeline for Android, but I don't really understand how it works. I also don't completely understand the programming concept of a pipeline or a pool either. Could someone explain these concepts and how they work as this input pipeline?

sentences:
Implementing navigatable achievement menu in javascript I am in the process of learning javascript for game design, and wanted to make a separate achievement page that the user can navigate to that will allow them to check their achievements on various games. (at the moment I am not concerned with implementing localstorage/cookies etc, I just want to work on the page for now)

So the requirements of my base idea is as follows:

Able to drag around the viewport/page to view all the achievement categories as they will likely not all be in view on smaller screens
Able to click on a category to open a small box containing all achievements belonging to that game/category
Able to mouse over all achievements in the boxes to get text descriptions of what they are
OPTIONAL: have lines connecting each box on the "overworld" to show users where nearby boxes are if they are off screen

At first, I thought I would need canvas to be able to do this. I learned a bit about it and got decently far until I realized that canvas has a lot of restrictions like not being able to do mouseover events unless manually implementing each one. Here is the current progress I was at in doing a test-run of learning canvas, but it's not very far:

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');

canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

function resize()
    {
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
        ctx.setTransform(1, 0, 0, 1, 0, 0);
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        ctx.translate(panning.offset.x, panning.offset.y);
        draw();
    }
    window.addEventListener("resize", resize);

var global = {
    scale   : 1,
    offset  : {
        x : 0,
        y : 0,
    },
};
var panning = {
    start : {
        x : null,
        y : null,
    },
    offset : {
        x : 0,
        y : 0,
    },
};
var canvasCenterWidth = (canvas.width / 2);
var canvasCenterHeight = (canvas.height / 2);

function draw() {
    ctx.beginPath();
    ctx.rect(canvasCenterWidth, canvasCenterHeight, 100, 100);
    ctx.fillStyle = 'blue';
    ctx.fill();

    ctx.beginPath();
    ctx.arc(350, 250, 50, 0, 2 * Math.PI, false);
    ctx.fillStyle = 'red';
    ctx.fill();
}

draw();

canvas.addEventListener("mousedown", startPan);

function pan() {
    ctx.setTransform(1, 0, 0, 1, 0, 0);
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    ctx.translate(panning.offset.x, panning.offset.y);
    draw();
}

function startPan(e) {
    window.addEventListener("mousemove", trackMouse);
    window.addEventListener("mousemove", pan);
    window.addEventListener("mouseup", endPan);
    panning.start.x = e.clientX;
    panning.start.y = e.clientY;
}

function endPan(e) {
    window.removeEventListener("mousemove", trackMouse);
    window.removeEventListener("mousemove", pan);
    window.removeEventListener("mouseup", endPan);
    panning.start.x = null;
    panning.start.y = null;
    global.offset.x = panning.offset.x;
    global.offset.y = panning.offset.y;
}

function trackMouse(e) {
    var offsetX  = e.clientX - panning.start.x;
    var offsetY  = e.clientY - panning.start.y;
    panning.offset.x = global.offset.x + offsetX;
    panning.offset.y = global.offset.y + offsetY;
}
body{
  overflow: hidden;
}
canvas {
  top: 0;
  left: 0;
  position: absolute; }
<canvas id="canvas"></canvas>

So I guess my question is now: what is the best way to implement this? Is it feasable to do it with canvas, or should I just scrap that and try to figure out something with div movement? Should I be concerned with performance issues and should that affect how I implement it?

sentences:
How can I save my game state so it can be resumed when my application resumes? I've found that after resuming my game the whole engine is reloaded and application is reinitialized. I want to save engine state and in "onResume," resume the game process from where it left off.

I've tried to save the engine (mEngine) and then after resume the game in "onLoadEngine" return saved engine. I think it is a bad solution and it doesn't work anyway.

What is the best solution for resuming my game (after the power key was pressed, for example) in AndEngine ?

sentences:
How can I sync billiard balls in network? I'm developing a billiard game my problem is I don't know how can I sync balls in network
I use forge for networking but feel free to answer photon or unet because I know them.

What I tried
1.sending position and rotation of each ball in network
2.sending force direction and Intensity inside network

networkObject.SendRpc(RPC_SHOOT,Receivers.AllBuffered,force);

    public override void Shoot(RpcArgs args)
    {
       Vector3 Force = args.GetNext<Vector3>();
       GetComponent<Rigidbody>().AddForce(Force);
    }

I don't know why but when I send force direction and Intensity in network sometimes Physics is different!
I asked this question in forge forum and they tell me:

It's non-deterministic It's how most physics simulations work Because
of floating point inaccuracies and different CPU architectures and a
whole load of other factors That's how PhysX works Well PhysX is
technically deterministic for the same inputs But all inputs have to
be identical

source is available:
https://github.com/smkplus/BilliardNetwork

sentences:
Combining multiple sprites vs separate sprites I have a character which can hold ten types of weapons.

Should I:

Create ten sets of animations for the character with each weapon
Create animations for each weapon, and programmatically draw them on the character

Option 1 is simpler in general, but requires more work on the artist, and results in larger game size.

Option 2, to me, is a programming nightmare...

Whats the better practice in general? Thanks.

sentences:
unity: how to make instantiated gameobject to have rectTransform of the canvas? (c#) public GameObject canvas;  // the canvas

GameObject changerSign = Instantiate(changerPopup,
    new Vector3(235, 350, 0),
    this.transform.rotation);
changerSign.transform.SetParent(canvas.transform);

this will make a UI at the screen. while it does make the object as wanted, the rect transform won't get fixed(?) to the newly set parent(the Canvas), but instead to where it was first made. how could I get it under canvas's rect transform? could be some too basic question, but couldn't find any answer anywhere so far :(

sentences:
Implementing getters for a singleton script in unity Ok the title might be a bit confusing but what I want to do is make a getter that returns the class, exactly like unity does with the camera.current.

You should just be able to go class.current and get the running instance of the class but I have no idea how to do this as it would most likely be a static method but how would you return the class form a non static class without some sort of out of class variable? or do you have to make the class static?

sentences:
c++ Opengl handle elements drawn I am currently working on a game and I want to know if there is any way of handling with the elements i am drawing . For example : if i draw in a loop 100 cubes , how can i show / hide the cube number 15 or 63 or n ... clicking  I thought that initializing elements in a list would work , but i didn't find any property of it that could help.

GLuint cube;
cube = glGenLists(1);

 glNewList(cube,GL_COMPILE);

for(int i = -30; i < 3; i++) {
     for(int j = -30; j < 3; j++) {
        glPushMatrix();
        glTranslatef(i*2.0,0,j * 2.0);
           Dcube();

        glPopMatrix();
     }
 }
 glEndList();

I googled a while for deleting elements after displaying them , like in minecraft , but i couldn't find anything useful(e.g: When mouse - right click -> then create cube , and when mouse - left click  -> then delete the cube.. ) Some sugestions would be all i need ..  ...Thank you.

sentences:
How can I make permanent death in a MUD seem acceptable and fair to players? I have considered writing a MUD for years, and I have a lot of ideas my friends think are really cool (and that's how I'd hope to get anywhere -- word of mouth).

Thing is, there's one thing I have always wanted, that my friends and strangers hated: permanent death. Now, the emotional response I get to this is visceral revulsion, every time. I'm pretty sure I am the only person that wants this, or if I'm not, I'm a tiny minority.

Now, the reason I want it is because I want the actions of the players to matter. Unlike a lot of other MUDs, which have a set of static city-states and social institutions etc, I want the things my players do, should I get any, to actually change the situation. And that includes killing people.

If you kill someone, you didn't send them to time out, you killed them. What happens when you kill people? They go away. They don't come back in half an hour to smack talk you some more. They're gone. Forever.

By making death non-permanent, you make death not matter. It would be similar if a climax to a character's arc is getting a speeding ticket. It cheapens it. Non-permanent death cheapens death.

How can I:
1) Convince my players (and random people!) that this is actually a good idea?, or

2) Find some other way to make death and violence matter as much as it does in real life (except within the game, of course) sans character deletion? What alternatives are there out there?

sentences:
Proper way to encapsulate components? I've tried my hand at writing component systems and entity systems.

What I haven't managed to solve is the problem of event collision.

Say, we have an components A,B and C. A triggers 'kill B' event. When B recieves it, it erases the message (doesn't propagate it further). When C recieves it, it erases B. The order of which component will get the event first is not defined.

When the order is 'A,B,C', B stays alive but with 'A,C,B' B is erased. In other words, side effects of the event are undefined. A,B and C need to know about each other (which I don't want) to handle the event properly.

I intend to use components for games so for a more substantial example: we have an arrow (Projectile component) which fires of a collision event upon striking Link (Collidable component). Link has shield (also Collidable) which stops damage from affecting Link's Health component.

Arrows and health were written without the shield in mind and my component architecture is supposed to be encapsulated, so Health processes the collision event without knowing about the arrow or shield. Whether or not the damage is stopped depends on the order of components, which is random.

The best I've came up with is keeping a 'cache' of actions the event will do at the end of processing but still this solution has the same problems, only delayed. I could ditch events and try entity component system with storing 'mutations' in systems but that's not much different from just using global data for everything.

EDIT:

Okay, my communication skills are terrible. Here's what I've done to make components working without knowing about each other:

Use 'pure' entity system (components are pure data, all logic in systems)
Components do not talk to each other. The systems talk to each other by adding system-exclusive components to entities
Systems for above situation are: Movement, HandleCollision, ApplyArrowDamage. Movemen t appends a Collision component to the 'reciever' of the collision (Link) when calculating movements. HandleCollision reacts to Collision component, appends ArrowDamage component to Link entity and removes Collision component from Link. ApplyArrowDamage does just that and removes ArrowDamage component and maybe appends Dead component to be handled elswere.
Now, to create the situation when the shield blocks arrows, I create an CheckShield system and place it between HandleCollision and ApplyArrowDamage. CheckShield works with ApplyArrowDamage, checks whenether the reciever (Link in this case) has a shield equiped and removes ArrowDamage component if so.
This way, my old code doesn't need to account for new code to work properly and vice versa.

For the 'ABC' situation I do the same: If I want C to erase B, I write a new system that works with C and fires off before the system that works with B.
The only sane way to solve this problems with event raising is to keep rethrowing the event whenether it's state changed, and keep rethrowing it until it doesn't changed in the last iteration.

sentences:
How to support more than 4 XInput controllers? I'm making a multiplayer game in GameMaker Studio 2. The game supports upto 12 controllers, where the first four are XInput controllers. The rest would be DirectInput.

If I try playing with 8 Xbox controllers, only 4 of them are detected in the game, as expected.

But, is there a way to get more than 4 Xbox controllers working?

sentences:
Graphics messed up when I try to reskin the game in Android Studio I need a little help. I'm new in Android Studio, I have a game where I want to reskin the design. First of all when I install it on my phone with the original files the game run perfectly without problems. When I try to reskin the photos in my assets folder, I save it, build it in APK file, I install the game and then the graphics is messed up. Here is screenshot of the game after the reskin.
Sorry for my bad English...

sentences:
Is a HashTable the best way to store replay data in C#? I'm looking to make a deterministic replay in my 2D game. I want to follow a similar approach to braid in storing the relevant information every frame (at 60 frames per second).

I wanted to know what the best way to store this information is. My friend suggested using a hashtable and being new to C# I'm sort of leaning towards just using an array, but I wanted to see if there were other schools of thought.

I've read posts like this How to design a replay system and this "Super meatboy"-ish replay which were very informative, but not very specific to C# and XNA.

My game is 2D and does not have all that many moving parts. At any given time there is probably less than 50 bodies I would need to track the position/rotation of.

Curious to hear your thoughts.

sentences:
High-definition Full-motion background system in XNA I'm mostly just working on this as a hobbyist thing, but here's my problem:
I got a bit excited over finding the 'Video' and 'VideoPlayer' classes in XNA 4, and hoped to make a game that works a little bit like how Myst does - with very active backgrounds, but no actual 3D graphics. (Technically, Myst 1 had static backgrounds, but maybe you get the idea) I threw together a small test game in XNA, with a pretty simple WMV included.

The problem I have is that it's not quite responsive enough. I'd like my system to be able to swap the current video in a millisecond, so that the player could click a contraption in the background and instantly see it move. Right now, when I press my trigger key that calls this code:

    private void cycleVideos()
    {
        videoIndex++;
        if (videoIndex == videos.Count)
        {
            videoIndex = 0;
        }
        activeVideo = videos[videoIndex];

        vp.Stop(); // Couldn't find a 'Seek(0)' method
        vp.Play(activeVideo);

    }

...it takes about a full second to re-seek the position it needs, and start playing again. In this example, I hadn't even encoded my video to the HD (1920x1080) resolution I had been planning on. I can understand if XNA's video system is really only meant for full cutscenes between missions or that sort of thing; I'm willing to use additional memory to have large parts of my videos cached, or even include a bit of a dynamic caching system so that things are loaded/unloaded over time (after all, this is the main visual of the game), but I'd like to hear if I have any decent options to accomplish this.

I'm also somewhat open to the idea of using a different engine or coding environment entirely.

EDIT: I've been doing some experimentation in my eagerness to solve this. I can definitely get some faster responsiveness by avoiding the 'stop()' calls, and by maintaining multiple instances of VideoPlayer. A paused video will resume much more quickly; and it's possible to play(), then pause() a video immediately (at the beginning of the program, in order to 'cache' it). It's not a full solution yet - I want to be able to seek back to the beginning of a video, and I still feel like there should be some possibility of that somewhere.

sentences:
Moving sprite from one vector to the other I'm developing a game where enemy can shoot bullets towards the player. I'm using 2 vector that is normalized later to determine where the bullets will go.

Here is the code where enemy shoots:

private void UpdateCommonBullet(GameTime gt)
        {
            foreach (CommonEnemyBullet ceb in bulletList)
            {
                ceb.pos += ceb.direction * 1.5f * (float)gt.ElapsedGameTime.TotalSeconds;
                if (ceb.pos.Y >= 600) ceb.hasFired = false;
            }

            for (int i = 0; i < bulletList.Count; i++)
            {
                if (!bulletList[i].hasFired)
                {
                    bulletList.RemoveAt(i);
                    i--;
                }
            }
        }

And here is where i get the direction (in the constructor of the bullet):

direction = Global.currentPos - this.pos;
direction.Normalize();

Global.currentPos is a Vector2 where currently player is located, and is updated eveytime the player moves.

This all works fine except that the bullet won't go to player's location. Instead, it tends goes to the "far right" of the player's position.

I think it might be the problem where the bullet (this.pos in the direction) is created (at the position of the enemy). But I found no solution of it, please help me.

sentences:
Xna, writing XML  end element got another question here. Its not about actually writing/reading files in XML, i already know how to-do this. But rather something that has bugged me for awhile.
Ok, so when i write out my files, they look like this:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
 <Asset Type="ProjectWitch.Animation">
      <Filename>C:\Users\Daniel Randell\Desktop\Project Witch\Project Witch (MAIN)\Project_Witch (MAIN)\Project_Witch (MAIN)Content\player.png</Filename>
      <CurrentFrame>0</CurrentFrame>
      <Number_Of_Frames>1</Number_Of_Frames>
      <Max_Time_Per_Frame>0</Max_Time_Per_Frame>
      <Animate_Once>0</Animate_Once>
      <Using_Image>1</Using_Image>
      <Rect>
        0    166  64   58
      </Rect>
      <Vector2>
        12   12
      </Vector2>
      <Rect>
        81   71   51   59   False
        80   71   13   43   True
        121  71   12   22   True
        130  82   7    41   True
        89   63   11   23   True
      </Rect>
 </Asset Type="ProjectWitch.Animation">

As you can see the problem, it should write out at the end:

      </Asset>
 </XnaContent>

But it's always writes out the:

 </Asset Type="ProjectWitch.Animation">

Its a bit annoying to keep having to look into the XML files and deleting this, so i'm wondering what i'm doing wrong?

Saving Code:
http://pastebin.com/yyC3q3aS

Thanks for any help :).

sentences:
Looking for a full featured C/C++ UV Mesh Unwrapper My first question!
Is there an open source C++/C piece of code easy to integrate to solve the UV Unwrapping of arbitrary meshes out there ?
I would like to use it to build a light mapper or similar stuff.
Of course i'm looking for non-naive solutions but something that solves the issue with maximum exploiting of texture surface and so on..

Thank you guys in advance.

sentences:
Is there a reason to add options to not use advanced technologies in a game engine? I have been developing a game engine, and have been discovering and reading up on game technologies such as anisotropic filtering, ambient occlusion, anti-aliasing, etc.

Usually in games, you can toggle these settings on and off. However, if these settings only add nothing but positives, is there a reason to add toggle values for these in a game engine for the developer?

I understand that performance is a major factor, but is there any other reason why these settings are always available to change?

sentences:
Scrolling background loop I'm trying to scroll my background forever and so I'm using the background image twice. When the first one goes off screen, it should relocate to the end of the second one. However, there seems to be a black bar inbetween the two images and so it seems that the image is not being moved into place quick enough. What would be the algorithm to do such a thing to give the illusion of a continuous background?
I've got this at the moment (which loops, but with a black bar in between the background image)

 GeneralTransform gt = bg1Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);
        Point bg1Offset = gt.Transform(new Point(0, 0));

 GeneralTransform gt2 = bg2Canvas.TransformToVisual(Application.Current.RootVisual as UIElement);
        Point bg2Offset = gt2.Transform(new Point(0, 0));

 bg1.TranslateX -=  playerVel.X; //bg1 and bg2 are the composite transforms for the canvas
 bg2.TranslateX -=  playerVel.X;

 if (bg1Offset.X < -bg_width)
     bg1.TranslateX -= bg1Offset.X - bg_width;
 if (bg2Offset.X < -bg_width)
     bg2.TranslateX -= bg2Offset.X - bg_width;

Any ideas?

Edit - Updated code
Edit 2: New code with three images (all same width). Works for the first few scrolls, then suddenly stops working and no background is displayed.

if (bg1Offset.X < -bg_width )
                bg1.TranslateX = bg3Offset.X+bg_width;

            if (bg2Offset.X < -bg_width )
                bg2.TranslateX = bg1Offset.X + bg_width;

            if (bg3Offset.X < -bg_width)
                bg3.TranslateX = bg2Offset.X + bg_width;

sentences:
2D Platformer AABB collision issues Before anyone say that this questions already has a answer, I will list all the questions I read and tried:

AABB collision resolution issues
Trouble with AABB collision response and physics
https://gamedev.stackexchange.com/questions/98323/hard-time-implementing-aabb-collision-into-a-platformer
2D Platformer AABB collision problems
2D Platformer Collision Handling
Collisions not working as intended
Checking Collisions In 2D Platformer With Tiles
And a lot more...

So, whats my problem? I am tring to implement a solid collision handling/response, but every time I try I fail. After fail with a lot of tile based solutions, like this one:

player.Y = tile.Y - player.height;

I am using the XNA Platformer Example as base, it is solid, but not completly. Some of the bugs is this:

This happens very often when the character is even wider than from the example. I solved it changing this line:

if (absDepthY < absDepthX || collision == GameMap.TileCollision.Platform)

To this:

if (absDepthY < absDepthX || collision == GameMap.TileCollision.Platform || _velocity.X == 0)

So, if the player isn't moving in the X axis, don't resolve it (resolve the Y axis instead). It worked very well, but it only hides the problem. After some gameplay the error is evident when you fall down and is pushed some tiles to the right. See this example from my game, I slowed down the X velocity:

I can't walk to the left and if I fall on the middle of the tiles, I'm pushed to the right. In the game the velocity isn't too slow, but as I said, it still happens. This is the real problem.

Update

The problem above was solved using David's solution, now I need implement the one-way platforms. The code I have so far is this, I commented the most important parts:

private void HandleCollisions(Direction direction)
{
    Rectangle playerBounds = BoundingRectangle;
    int leftTile = playerBounds.Left / (int)GameMap.Instance.TileSize.X;
    int topTile = playerBounds.Top / (int)GameMap.Instance.TileSize.Y;
    int rightTile = (int)Math.Ceiling((float)playerBounds.Right / GameMap.Instance.TileSize.X) - 1;
    int bottomTile = (int)Math.Ceiling(((float)playerBounds.Bottom / GameMap.Instance.TileSize.Y)) - 1;

    _isOnGround = false;

    for (int y = topTile; y <= bottomTile; ++y)
    {
        for (int x = leftTile; x <= rightTile; ++x)
        {
            Vector2 depth;
            Rectangle tileBounds = GameMap.Instance.GetTileBounds(x, y);
            GameMap.TileCollision collision = GameMap.Instance.GetCollision(x, y);

            if (collision != GameMap.TileCollision.Passable && GameMap.Instance.TileIntersectsPlayer(playerBounds, GameMap.Instance.GetTileBounds(x, y), direction, out depth))
            {
                if (collision == GameMap.TileCollision.Platform && direction == Direction.Vertical && previousBottom < tileBounds.Top)
                {
                    // This is reachable if I fall on a platform tile only from the top!
                    _isOnGround = true;
                }

                if (collision == GameMap.TileCollision.Block || (direction == Direction.Vertical && _isOnGround))
                {
                    // The position is increased
                    Position += depth;
                    playerBounds = BoundingRectangle;
                    // But the player falls through the platform block.
                }
            }
        }
    }

    previousBottom = playerBounds.Bottom;
}

If I jump from bellow of the platform, when I reach the top of the tile the _isOnGround is set to true, so the condition bellow is executed and the player is supposed to be pushed to top, but he falls through the platform. I debugged and the Position is really increased, but it only happens one time. What am I doing wrong?

sentences:
drawing meshes so that they respect the position in space (doesn't draw on top of another mesh if behind it) How can i make my meshes be drawn taking in account which one is in from of another? i.e. if i have a mesh that is farder than another it should be drawn behind the second.

Is there a way to do this in xna that is more standardized or do i have to calculate for each mesh myself? If i have to calculate for each mesh by myself, from which point do i calculate the distance to the mesh? the camera position?

Here is how i draw them :

        Matrix[] transforms = new Matrix[gameobject.model.Bones.Count];
        gameobject.model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in gameobject.model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.Projection = camera.projectionMatrix;
                effect.View = camera.viewMatrix;
                effect.World = transforms[mesh.ParentBone.Index] * gameobject.orientation;
           }
            mesh.Draw();
        }

sentences:
Procedural Star Generator I want to develop a procedural galaxy / starfield generator.

A rather simple approach would be to use some pseudo-random algorithm to repeatedly create a star and its properties (such as position, mass, luminosity, density, and so on...). But in doing that, I would be quite limited in terms of the total number of stars. They would all be created at startup, and kept in memory, even the ones which are totally out of the player's range.

I do not want to end up with millions of star instances.

What I need is some way to only generate the stars which are near to the player and, therefore, being rendered. On the other side, I want the player to be able to return to stars, once they disappear due to being too far away.
Take Space Engine for example, it also does not generate all its trillion stars at the start of the simulation.

What would be a suitable approach to this kind of problem?

sentences:
How can I avoid "bleeding bullets"? I'm making a top-down shoot-em-up in XNA, and I have placeholder blocks for my characters and bullets. Here's a picture:

I have all the Bullets stored in a List<Bullet>, such that a Bullet is deleted whenever it collides with the window bounds. So I have a List<Bullet> called bullets, and I call bullets.RemoveAt(i) to delete a Bullet object.

However, if I keep on holding down Space to shoot Bullets, my "Mango Warfare" application starts "bleeding bullets," or bleeding memory. The app starts to climb up the memory rankings in Windows Task Manager:

Here's my code for removing out-of-window-bounds bullets:

private void CheckBulletCollisions()
{
    foreach (Bullet bullet in bullets)
    {
        if (bullet.X > GraphicsDevice.Viewport.Width ||
            bullet.X < -5 ||
            bullet.Y > GraphicsDevice.Viewport.Height ||
            bullet.Y < -10)
        {
            bullet.Enabled = false;
            continue;
        }
    }
}

private void RemoveDisabledBullets()
{
    int num_bullets = bullets.Count;
    int count = 0;
    int i = 0;
    while (count < num_bullets)
    {
        if (!bullets[i].Enabled)
        {
            bullets.RemoveAt(i);
            ++count;
            continue;
        }
        ++count;
        ++i;
    }
}

Clearly, RemoveAt() is not working. Is there anything else I can do to free up memory for out-of-window-bounds bullets?

sentences: Good practices in data management in big projects? I am making a game using Unity ECS. All the data I have: Items, Defined Interactions, Monsters etc. are stored as .json. What are good practices to manage this data? For now I am storing all those objects in dictionary fashion where keys are "ModName.ObjectType.ObjectTag" for example "Core.Item.Sword1". All parts of the game has access to this data bank because it's static. I am not sure if what I am doing is right and if there could be problems that emerge. Overall, what are good practices for managing assets in game which should be moddable?

sentences:
Touch taps only on very short flicks on Win7 with Monogame I have an application on win7 which needs to support touch and mouse input using monogame. But reading touch taps proves to be a very hard thing.

The TouchPanel is initialized like this:

TouchPanel.EnableMouseTouchPoint = true;
TouchPanel.EnabledGestures = GestureType.Tap | GestureType.DoubleTap | GestureType.Hold | GestureType.Pinch |
                             GestureType.FreeDrag | GestureType.DragComplete | GestureType.Flick | GestureType.HorizontalDrag |
                             GestureType.VerticalDrag;
TouchPanel.EnableMouseGestures = true;

Without EnableMouseTouchPoint and EnableMouseGestures there is no reaction from the touchscreen. Enabling both will at least get me touch locations and gestures on drag moves (this already makes me think that there is something essential missing here).

I have the following code to read input which is called on every Update:

private void GetInput(GameTime gameTime)
    {
        var gesture = default(GestureSample);
        MouseState mouseState = Mouse.GetState();

        TouchCollection touchCol = TouchPanel.GetState();
        foreach (var touch in touchCol)
        {
            Console.WriteLine(touch.Position);
        }

        while (TouchPanel.IsGestureAvailable)
        {
            gesture = TouchPanel.ReadGesture();
            Console.WriteLine(gesture.GestureType);
            if (gesture.GestureType == GestureType.Tap)
            {
                DoHitTest(mouseState.X, mouseState.Y);
            }
        }
     }

The touch collection will remain empty until the finger is dragged across the screen. Taps are not showing up. To get an actual tap i have to do a very short flick. In this case, there is a touch in the touch collection.

What am i missing? Am i doing something fundamentally wrong here?

sentences:
Get closest Child to cursor I'm currently rewoking my RTS cover system. This should highlight the closest coverspots from my mouse cursor and sent the units to these locations. everything works, but I can't get the closest sport, it always selects the sames ones, regardless to the mouse position.

These cover spots are child objects of the obstacle, that has this script attached.

This is my not working implementation of the idea:

 void Update()
    {

        var dist = Mathf.Abs(transform.position.z - Camera.main.transform.position.z);
        var v3Pos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, dist);
        v3Pos = Camera.main.ScreenToWorldPoint(v3Pos);
        mousePos = v3Pos;
}

...

public void getPointDistances()
    {
        foreach (CoverPosition pos in coverPositions)
        {
            if (!pos.occupied)
            {
                pos.distanceToCursor = Vector3.Distance(pos.transform.position, mousePos);
            }
        }
        Array.Sort(coverPositions, delegate (CoverPosition x, CoverPosition y) { return y.distanceToCursor.CompareTo(x.distanceToCursor); });

    }

Later, I simply Iterate over the sorted array and make it visisible.

I'm woking on this for hours, but i cannot find, a solution why it always displays the same cover spots.

I hope, someone can find my (possibly stupid) error.

Edit:

I also tried this, but tata returned always the same values, regardless of my mouse positioning:

Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
            mousePos = hit.transform.position;

sentences:
Designing Collision Detection for 2D Rectangular Adventure/RPG TLDR: I'm looking for an efficient way to detect collisions between irregular/small objects that are not a full tile size (like small cans) and a free-moving character in a 2D game.

I'm planning to design a 2D RPG-style game in XNA. It will be similar to the style of Chrono Trigger (pictured below) -- I will explain what that means. The main issue I have is how to properly design the collision detection.

First, a description of two of the main points of my game design:

Sprites are rectangular. So a character is two parts: lower-half (which collides with solid tiles) and upper half (which is "above" the lower half).
Free movement. Even though I use tiles, you don't move from tile to tile; you can move in any direction in a small increment (such as 8px).

Another important aspect of my design is that I don't (can't?) do any pre-processing on images to detect collision spaces. It must be either generic (eg. a 4px range outside of each tile), or cheaply calculatable. (This is to make it easier to develop by cutting down on the time needed to make sprites.)

My initial design for this (which I prototyped) was to use the (bottom half of the) character to collide with anything on the "ground" level. This works well with things that are full-tile covering (like walls), but not small objects (like cans). Pixel-level collision detection solved this, but can lead to irregularities, problems with granularity (eg. checking 4 pixels to either side), and of course, performance.

What I really want in this case is for the character to be able to move close to small or irregular objects. Is pixel-level collision detection the right answer? What about encapsulating it in a small polygon approximation (say a rectangle, even) and colliding with that area?  I'm concerned that, even with spatial partitioning, the performance will be poor and the user perception of collision will be poor-quality.

How do other 2D games deal with this?

sentences:
Projectile Shoot three at a time In my game there is a bird flying and on touch it throws different artifacts projectile downwards. And these artifacts should hit the containers moving right to left on the screen. Now if user keeps on tapping rapidly it make a line of artifacts and it didn't miss a single container. So what I want to do is to restrict user to throw 3 artifacts at a time and when one of them got destroyed it'll make room for one more. Here is how I'm doing it:
In my player.cs I'm using a static int named inventory and then in Update() method I've the code where it increment the inventory.

if (Input.GetTouch(i).phase == TouchPhase.Began){
                OnShoot ();
                inventory++;
                Debug.Log ("Inventory: " + inventory);
            }

and in OnShoot() I'm checking if (inventory < 4) then Instantiate otherwise if (inventory > 4) set inventory = 0;.
 Now in the artifacts.cs if it hit the container and get destroyed or got destroyed going out of the bound missing the container it should Player.inventory--;
This code works fine but if the user speed of tapping is more then it again started throwing like in a line form as described above.

sentences:
Transmit map vs Transmit seed Given a map created with procedural generation algorithms, should the server transmit the seed used to generate this map (so client must contain the same algorithm) or maybe send all the information?.

I'm inclined to send the seed, i have in mind generating big maps. Right now, i have one seed to generate multiples seeds, and each one is used to generate a chunk, so this last seed would be transmited to each client everytime someone needs information about a new chunk.

sentences:
Is there a way to make it easy to add new content to my game without much effort ? Good evening !

Im currently developing an little "mmorpg" on my own. I started some months ago and i noticed that its pretty hard to add new content or features to it due to the complexity of the code, structre and the framework. Let me give your an little example...

In my game, players can build stuff. So theres a base class called "BaseEntity". It will be used for all entity related stuff, buildings, resources, duengongs and so on. Theres also a "BuildingEntity" which extends "BaseEntity" and a "TowerEntity" which extends "BuildingsEntity". So all in all this makes it very easy to add new Buildings to my game without writing the same base class ever and every again.

But there problems too. In many places i need to check if the "GameObject" holds an certain Class as a Component. For example, when my player clicks on the tower, i need to check if theres a building script assigned to it. And when i create new "branches" i need to add those to my existing codes every and ever again. This makes it very complicated at some point.

Are there any structures or tricks to make adding new content to a game much more easier ?

sentences:
Unity: RaycastHit2D continually returns point (0,0) firstly I'm a bit of a Unity noob so sincere apologies if I've done something dumb.

I'm attempting to use a RaycastHit2D to detect when the player is on a platform. If he is, the point it returns should be passed back and used to set the player's rigidbody transform y coordinate so he sits on top of the platform.

The problem appears to be that the RaycastHit2D is continually returning a point of (0,0), so the player keeps getting reset to (x,0) - which causes an amusing bouncing effect, but not the desired effect.

Here's the code:

if (onPlatform) {

  RaycastHit2D walkingOnPlat = Physics2D.Raycast(rb.transform.position,Vector2.down,Mathf.Infinity,8);
            platYCollision = walkingOnPlat.point.y;
            rb.transform.position = new Vector3(x, platYCollision,-5f);

        }

If I can clarify anything please do let me know, and thanks in advance for your help!

sentences:
Is normal mapping cpu overhead or gpu overhead? In Unity3D Engine,

I usually apply normal mapping using fragment shader.

In this case,

this normal mapping is cpu overhead or gpu overhead?

sentences:
Shading Languages vs Materials in 3D editors There are many 3d packages which are able to construct materials. Autodesk Maya, 3ds max, Houdini, etc.

There are languages which are able to construct materials as well, like GLSL and Cg.

How does first group correspond to the second? Are there workflows, where they are used simultaneously?

From my experience, constructing materials in 3d packages is way faster than writing code in GLSL. They also have scripting systems for more customization. Do shading languages have their own benefits?

sentences:
Keyframing or programmatically changing attachment transparency in Spine I've just recently been getting to grips with Spine and Unity 2D, porting some
of my assets from different sources (SWFs, SVGs, GIFs, Canvas animations).
Whilst I'm able to reproduce a lot of what I can do in these other systems
— very nicely I might add — one thing that seems to be alluding me
is how to animate an attachment.

Obviously Spine is still developing, so I don't expect to be able to run
full bitmap/vector animations as attachments; but one thing the software does
seem to have already is the ability to set transparency, and to set multiple
attachments to one slot. I was hoping someone out there would know if these
abilities can be combined to at least achieve a faded switch between attachments
— either using the GUI or via coding.

For example, this video shows my
character animated with the two states I wish to switch between.

I'm aware that you can key frame a switch between attachments, but this leads to
a sudden jump in what graphic is shown. I could theoretically create
8 extra attachments on each slot and set their opacity graduating from 0.1 to
0.8 — but this seems like a rather hack way of doing things, and would
also be awkward to shift along the timeline.

My fallback would be to animate the two full states of the character, export them, and leave Unity to handle switching from one to the other.

Any ideas?

sentences:
Where should I go looking for low-polygon 3D assets? The biggest problem for me as a game programmer (who isn't also an artist) is getting good quality 3D models. I have checked out some of the 3D model market places like The 3D Studio and Top 3D Models but I have had difficulty finding the artwork I am looking for and, when I do find something I like, getting the level of detail appropriate for my platform.

Do people have any suggestions for sites they have dealt with successfully in the past? Am I better off building a relationship with an individual artist?

sentences:
OpenGL, Offset and Camera Space I was reading chapter 4 of the Arcsyntesis OpenGL tutorial when I came across this line in the GLSL shader.

vec4 cameraPos = position + vec4(offset.x, offset.y, 0.0, 0.0);

About it, the tutorial says

  The first statement simply applies the offset to get the camera space positions of the vertices.

I understand what cameraPos is but I don't get what the offset is. It's defined as a uniform and it's passed to the shader by the main program like this:

glUniform2f(offsetUniform, 1.5f, 0.5f);

So offset.x = 1.5f and offset.y = 0.5f. But I see no mention of that offset in the rest of the tutorial and its values seem quite random to me. I know that the offset from the projection plane to the eye is always -1 but that refers to a value of Z. Where do X and Y come from? Are they arbitrary values? What they mean, what they do? I understood everything up to the point but I can find no reference to said offset in the tutorial and I'd like to know if someone can explain it to me, please.

Edit: the last line I posted was probably forgotten by the author of the tutorial and can be find in the book's source distribution here.

sentences:
How to make my Diamond-Square-algorithm less 'random'? I'm currently writing a world generator for a Tilemap-Engine in C++.
But there is a little problem concerning the Water to Land ratio.
My DiamondSquare-class returns a field of random float-values between 0 and 1, and my condition to let my tilemap-class generate a Land-Tile on the given spot, is that the returned value is bigger than 0.5. The problem is, that the amount of values bigger or smaller than 0.5 fluctuates with every call of my float-field-generation function, so that i often only have a few little Islands/a few little lakes on my map. How could i manipulate my code, so that a 50/50 distibution is more likeley to happen?

include "DiamondSquare.h"
include <Windows.h>
pragma comment (lib, "winmm.lib")
floatfield /*typedef floatfield is std::vector<std::vector<float>>*/ DiamondSquare::generate(int n, float randomness) {

// Initializing stuff
srand(timeGetTime());
fieldSize = pow(2,n)+1;
randField.resize(fieldSize);
for (int i=0; i<fieldSize; i++)
{
    randField[i].resize(fieldSize);
    for (int j=0; j<fieldSize; j++)
    {
        randField[i][j] = 0;
    }
}
stepDist = pow(2, n-1);
m_randomness = randomness;

// Setting corner point values
randField[0][0] = (float)(rand()%1001)/1000;
randField[fieldSize-1][0] = (float)(rand()%1001)/1000;
randField[0][fieldSize-1] = (float)(rand()%1001)/1000;
randField[fieldSize-1][fieldSize-1] = (float)(rand()%1001)/1000;

// Core Algorithm
for (int i=0; i<n; i++)
{
    for (int k=0; k<pow(2,i); k++)
    {
        for (int l=0; l<pow(2,i); l++)
        {
            // Getting position of current tile
            int xPos = k*2*stepDist+stepDist;
            int yPos = l*2*stepDist+stepDist;
            // Getting Average of sorrounding tiles
            randField[xPos][yPos] = (randField[xPos-stepDist][yPos-stepDist]+randField[xPos+stepDist][yPos-stepDist]+
                                      randField[xPos+stepDist][yPos+stepDist]+randField[xPos-stepDist][yPos+stepDist])/4;
            // Random displacement
            if (rand()%2 == 1)
                randField[xPos][yPos] += (float)(rand()%1001)/1000/pow(randomness,i+1);
            else randField[xPos][yPos] -= (float)(rand()%1001)/1000/pow(randomness,i+1);

            // Doing the same for the Square-Step tiles left of and above     the current tile
            squareAvg(xPos-stepDist, yPos, i);
            squareAvg(xPos, yPos-stepDist, i);

            // If diamond-step-tile is part of the right side row
            if (k == pow(2,i)-1)
                squareAvg(xPos+stepDist, yPos, i);
            // If diamond-step tile is part of the bottom row
            if (l == pow(2,i)-1)
                squareAvg(xPos, yPos+stepDist, i);
        }
    }
    stepDist /= 2; // Self explanatory
}
return randField; // Return random field.
[![Often, insted of maps like this, there is stuff like 10% water or 10% land][1]][1]}

void DiamondSquare::squareAvg(int x, int y, int i) {
// Testing if square-Tile lies at on of the sides of the map, if so, adding         0 (i tried implementing wrapping, but this option generated better looking     landscapes)
randField[x][y] = (x!=0) ? randField[x-stepDist][y] : 0;
randField[x][y] += (x!=fieldSize-1) ? randField[x+stepDist][y] : 0;
randField[x][y] += (y!=0) ? randField[x][y-stepDist] : 0;
randField[x][y] += (y!=fieldSize-1) ? randField[x][y+stepDist] : 0;
// If 4 values were added /= 4, otherwise /=3.
if (x!=0 && x!=fieldSize-1 && y!=0 && y!=fieldSize-1)
    randField[x][y] /= 4;
else randField[x][y] /= 3;
// Displacement
if (rand()%2 == 1)
    randField[x][y] += (float)(rand()%1001)/1000/pow(m_randomness,i+1);
else randField[x][y] -= (float)(rand()%1001)/1000/pow(m_randomness,i+1);
}

Is it maybe even possible to preciseley control n<0.5 to n>0.5 ratio ? That would be ideal. I just don't know how and where to manipulate the code.
That's about it.

sentences: Port libgdx application to iOS I made my game using libgdx which is a cross-platform framework which supports desktop, Android and html5 (using Google Web Toolkit). What could be a possible route to port my game to iOS?

sentences:
How can I implement collision detection for these tiles? I am wondering how this would be possible, if at all.

In the image below:

The light brows tiles are ground, while the dark brown is background, so the player can pass over those tiles.

Here's the for loops that draws the level:

        float scale = 1f;

        for (row = 0; row < currentLevel.Rows; row++)
        {
            for (column = 0; column < currentLevel.Columns; column++)
            {
                Tile tile = (Tile)currentLevel.GetTile(row, column);
                if (tile == null) { continue; }

                Texture2D texture = tile.Texture;

                spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle(
                    (int)(column * currentLevel.CellSize.X * scale),
                    (int)(row * currentLevel.CellSize.Y * scale),
                    (int)(currentLevel.CellSize.X * scale),
                    (int)(currentLevel.CellSize.Y * scale)), Microsoft.Xna.Framework.Color.White);
            }
        }

Here's what I have so far to determine where to create a Rectangle:

    Microsoft.Xna.Framework.Rectangle[,,,] groundBounds = new Microsoft.Xna.Framework.Rectangle[?, ?, ?, ?];

        int tileSize = 20;
        int screenSizeInTiles = 30;

        var tilePositions = new System.Drawing.Point[screenSizeInTiles, screenSizeInTiles];

        for (int x = 0; x < screenSizeInTiles; x++)
        {
            for (int y = 0; y < screenSizeInTiles; y++)
            {
                tilePositions[x, y] = new System.Drawing.Point(x * tileSize, y * tileSize);
                groundBounds[x, y, tileSize, tileSize] = new Microsoft.Xna.Framework.Rectangle(x, y, 20, 20);
            }
        }

First off, I'm not sure how to initialize the array groundBounds (I don't know how big to make it). Also, I'm not entirely sure how to go about adding information to groundBounds.

I want to add a Rectangle for each tile in the level. Preferably I'd only make a Rectangle for those tiles accessible by the player, and not background tiles, but that's for a different day.

FYI, the map was made with a freeware program called Realm Factory.

sentences: Why are games locked at a certain frame per second? A lot of PC games are locked at 60 frames per second. I know that this is because a high frame rate can cause glitches/bug in a game and mess up the physics but is there another reason? Should anyone who makes games lock their games at 30-120fps? Thanks in advance!

sentences:
Implementing an existing (but out of print) game electronically One of my favorite games is the old Avalon Hill class, PanzerBlitz.

I would like to implement it electronically, and have a couple questions related to that:

Would I be in legal trouble if I do this? (note - this is not for sale or distribution)
How would I go about implementing the hex grid and piece database most effectively (each piece has a variety of 'factors' (movement, carryability, attack, defense, unit type)?

The game play and mechanics are already well-defined in the written rules - so I'm not writing the game from scratch - just programming it to follow the board game.

sentences:
Dealing with edges on spherical heightmapped terrain This is the problem I'm having: where the height has been applied to the vertex, the edge of each face has been pushed apart. I was wondering how I can best deal with this issue?

I read elsewhere that calculating the mean between the two adjacent edge vertices and applying to both will seal the gap, but wouldn't that cause some UV stretching?

Any advice would be great, Caius.

sentences:
Triangle Strips of Tetraheron I am confused about the triangle strip representation of closed mesh .The vertex buffer for triangle strip representation of the a figure is shown below:

A(0,1) B(0,0) C(1,1) D(1,0)E(2,1)

vertex buffer=[A,B,C,D,E] where, T1=(A,B,C) T2=(B,C,D) T3=(C,D,E)

Now, if I have a tetrahedron with four vertex A(0,0,0),B(1,0,0),C(0,1,0) and D(0,0,1) then what would be its vertex buffer representation?

Thank you very much.

sentences:
How can I make user-friendly polar coordinate movement around a circle? I am working on a 2D game where you land on planets with a ship and can exit the ship and walk around.

These planets are very small (think ~350 pixel radius sometimes), and are seen from the side. So you can easily see the whole planet on the screen generally.

This may be sort of confusing so here's a picture:

I am using the A and D keys to move counter-clockwise and clockwise, respectively. The problem is that if you are on the "top" of the planet (upper half), this makes sense: A moves to the left, D moves to the right. However, if you are on the "bottom" of the planet (bottom half), A moves to the right, and D moves to the left.

Any ideas on how can I make this more user-friendly?

sentences:
Progressively loading the racing arena in a 3D driving sim I need advice and resources on a 3D car simulator.
I want to progressively load the track for the player as I'm thinking of porting the game to mobile devices.
This seems too difficult to me as I'm trying to separate the racing arena model design and the code as much as possible. Is there a structured method for achieving that for any model (arena/map). I think this is something that comes up a lot in games in general not just this instance.

sentences:
Fix latency when sending state I have a multiplayer game done with Phaser, which runs in the browser and on a node.js server.

The server is authoritative, every 50ms or so it sends the game state object to all clients. The clients receive the state and update all instances accordingly. The game runs at 60fps, and the physics and AI are the same on clients on server, so if there is no user interaction the game will evolve exactly the same (the next frame on the server will be equal to the next one on the client). This should make sync much easier, but I have a problem:

When the client receives the state from the server, the state is no longer up to date (as there is the latency between server and client).

Here is a drawing:

Server: State1 -> State2 -> State3 -> State4 -> State5
................................................*-------------------V
Client : State1 -> State2 -> State3 -> State4 -> State5State3

So, when the client receives State3, it is no longer usable as it has already been at State3. This makes the game always rewind a few frames when it receives the update from the server. How can I solve this, taking in account that the same game engine runs on both client and server (so prediction is much easier).

I would try "rendering the game in the past" as I have seen in other cases, but I do not really think I can break Phaser physics/render loop connection.

sentences:
Pretty open source game/rendering engine? It might be outside the domain of open source (as there isn't much in the way of open source games that would want/need to implement all these) but is there an existing open source game or rendering engine capable of things such as :

day/night cycles
dynamic weather wind/rain/clouds/etc
wet surfaces (surfaces look wet during rain)
realistic water
large terrains with the ability to define "roads"
seamless exterior and interior
forests (lots of trees, clutter, etc)
realistic lighting (ie. light from a fire/candle flickers)

if game engine :

integrated physics
support for vehicles
ai
multiplayer/network capable.. maybe mmo
voice recognition
etc

sentences:
'CoreMinimal.h' file not found when building on Unreal Engine on Mac I'm trying out C++ on Unreal Engine 4.25 on Mac. If relevant, my Xcode version is 12. When I try to compile, there's an error: 'CoreMinimal.h' file not found.
I've looked around and some solutions mention a workaround, which is to add the path to CoreMinimal.h into the .vscode/c_cpp_properties.json file. I did that:
...
    "includePath": [
        "${workspaceFolder}/**",
        "/Users/Shared/Epic Games/UE_4.25/Engine/**" // This is the filepath to CoreMinimal.h
    ],
...

I still get the same error. I couldn't find any other solution. Has someone found a solution to this?
Thanks.

sentences:
Why do Unity networking libraries fail when building for the Windows Store? I am using Lidgren and RSA in my networking framework, but things like IPAddress are "nonexistent" when I try building for windows store. RSA classes don't work, either.

Why is this? How could I still have a networked game on the Windows Store?

sentences:
Heightmap terrain picking I've implemented an OpenGL based terrain unsing a tesselation-shader for dividing each 'terrain-cell' into the desired tiles.
The heightmap is uploaded to the GPU and applied on the shader.

When it comes to picking, I don't really know what to do.
Testing triangles on intersection with the pick ray is not possible because only the GPU 'knows' the mesh.

Is render to texture with an unique color the way to go?
Or holding an additional mesh in RAM, only for picking/collision?

sentences:
OpenGL ES 2 shaders for drawing buildings and roads like Google Maps does I'm trying to create a shader that'll give me an effect similar to what buildings and roads look like on 3D Google Maps. You can see the effect interactively if you enable WebGL at maps.google.com, and I also found a couple of screenshots that illustrate what I'm trying to achieve:

Thing I noticed:

There's some kind of transparency thing going on with the roads/ground and the buildings, but not between the buildings themselves. It might be that they're rendering the ground and roads after the buildings with the right blend functions to achieve that effect.
If you look closely, you'll see parts of the building profiles have an outline. The roads also have nice clean outlines. There are a lot of techniques for outlining things with shaders... but I'm curious to find out what might have been used in this case considering mobile hardware and a large number of entities with outlines (roads and buildings)
I'm assuming that for the lighting, some sort of simple diffuse per-vertex shader is being used for the buildings though I could be wrong.

I'm especially curious about the 'look' they achieved with buildings (clean, precise outlines/shading). It reminds me a little of what you'd see when designing stuff with CAD applications like SolidWorks:

I'd appreciate any advice on achieving this kind of look with ES 2 shaders.

sentences:
background move to the right I'm developing an android app and want to make move the background to the right.
The problem that I have is if it moves it does not repeat the background.
I appreciate every suggestion. Thanks.

The code:

public class Background
{
    private Bitmap bmp = null;
    private int newWidth = 0;
    private int newHeight = 0;
    private Bitmap bmpScaled = null;
    private int move = 0;
    private float scale = 0;
    private GameView gameView = null;

    public Background(GameView gameView, Bitmap bmp, int x, int y)
    {
        this.gameView = gameView;
        this.bmp = bmp;
        scale = (float) bmp.getHeight() / (float) gameView.getHeight();
        newWidth = Math.round(bmp.getWidth() / scale);
        newHeight = Math.round(bmp.getHeight() / scale);
        bmpScaled = Bitmap.createScaledBitmap(bmp, newWidth, newHeight, true);
    }

    private void start()
    {
        move++;
    }

    private void update()
    {
        start();
    }

    public void onDraw(Canvas canvas)
    {
        update();
        canvas.drawBitmap(bmpScaled, move, 0, null);
    }
}

sentences:
OOP architecture for Hero with many attributes I'm about to start a simple browser text RPG, with characters that can (passively) fight other people. This involves a list of about 10 skills like strength, dexterity and so on, with additional proficiencies for different weapons.

Is there a better way to design this character class then just having those skills as class attribute? It seems easy, but I'm reluctant because it's clumsiness.

class Char(self):
    int strength
    int dexterity
    int agility
    ...
    int weaponless
    int dagger
    ...

sentences:
How to implement pathfinding in this situation So I'm creating a game for android using the libgdx library. I render the map from a tmx file and in it all the water tiles have the property of blocked. My player(a sprite) moves to where I clicked/tapped.

My problem is that I am unsure as to how to implement pathfinding. I can get in the layer with the tiles that which have the blocked property but I'm not sure as to how to stop my player from moving through them. I am using the tweenengine to move the player.

I was thinking that perhaps the code would create waypoints for the tween movement from a path finding code but again I'm not sure as to how to implement it.

I looked at A* and all the examples I was looking at were using rectangles and my player doesnt move in a uniform way(1 tile per move). So I cant really assign it values (10 for vertical/horizontal, 14 for diagonal).

If I have said anything that is not true then please correct me

sentences:
How do I rotate shoulder bone up and down using Rotate and Space.World independend on model orientation I wanted to move my character's arms up and down in a straight way.
The Rotation Gizmo tool can do exactely that.
Playing with the wheel of the Rotation Gizmo tool in the attached screenshot (marked with red arrows in my screenshot), I could move the arms down in a straight way:

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

public class MyPlayer : MonoBehaviour
{
    public Transform Shoulder;

    private Quaternion _Rotation;
    private float _f = 0f;

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

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

public class MyPlayer : MonoBehaviour
{
    public Transform Shoulder;

    public Transform Mother;

    private float _f = 0f;

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

sentences: Projector making the scene objects grey in Unity Everytime I enable my projector, it makes all the overlapping elements look entirely grey. The shadows also disapear. I tryed a couple of other shaders found on the internet but the issue still persists.

sentences:
Dealing with back to front drawing with alpha blending and z buffer for a list of 2d quads I'm using depth buffer as a layering system for my 2d render and I have to draw them from back to front to make semi-transparent quads work out. The problem is I have to sort my quads vector based on their depths whenever I add or remove one and that is time consuming. I've done this before, but I'm not sure what's the down side because in my mind I think if I sort a vector of let's say 5000 quads, then it'll really keep CPU busy if I remove one of them and sort the other 4999 items in a single frame.

I need to know if there is an alternate way for this or this is just it.

sentences:
XNA SoundEffect with offset I've been trying to make a soundmanager recently which has several functions which fits my needs. But one thing I can't solve, is the offsetting the soundeffects.
Is it possible to play a soundeffect from a specific point? I know I have to use the buffering, but I couldn't find anything on the net about it. Any help would be appreciated!

sentences: Can we develop a game for iPhone on Windows platform? Is it possible by any means to have a game developed for iPhone using the iPhone sdk on Windows?

sentences:
Why when getting the waypoints objects in script the order in the array is not the same as in the hierarchy? At the top

public GameObject[] waypoints;

In Start

void Start()
    {
        waypoints = GameObject.FindGameObjectsWithTag("Waypoint");
    }

In the Hierarchy i have 5 Spheres:
In this order:

But when using a break point i see in the variable waypoints:

Why when getting the waypoints in the script they are not in the same order ?

sentences:
Resolving Diplomatic actions in a RISK-style board game I'm working on a board game called Farlanthia: Lords of War. And I need some help with resolving diplomacy during play.

My original idea was to have Diplomacy be a form of "attack" like in RISK. This would force another player to perform an action (like a trade, or peace treaty, etc.) The idea is that each "season" you would send a diplomat to court, and politics would play out. Sometimes things go your way, sometimes they don't. This would allow me to use modifier cards (say, you have as prisoner a general from the other player, this would give you +2 in diplomacy with them).

However, as was pointed out on BoardGameGeek this isn't optimal for everyone. So I'm considering adding in a voluntary portion where if both parties agree to the treaty at hand, it goes into place without die rolling.

Thoughts? I'm just not sure how to arbitrate the rules of diplomacy during an otherwise concrete game if the diplomatic actions aren't just as concrete.

Thanks,

(Cross-posted to Board and Card Games)

sentences:
How to detect collision with non-rectangular objects in 2D games? Detecting collision with rectangular objects is quite easy. I am able to write simple tile based games. Now I want to learn to write non-tile based games in which objects may not be rectangular, for example, a mountain.

Suppose I want an uneven terrain with hills and mountains how do I store the shape of the terrain? Also how do I detect the collisions for such uneven objects?

sentences:
Can't Create High Definition Render Pipeline Asset in Unity (Create > Rendering Doesn't Exist) I've upgraded my project to Unity version 2019.3.0a11. It complains and can't load scripts, mostly because it can't seem to load the original HDRPipeline. I want to make graphics display properly.

In Unity's instructions, they say to go to Assets > Create > Rendering and click High Definition Render Pipeline Asset and create this in the Assets folder. Problem is, Assets > Create > Rendering doesn't exist.

I'm in Assets/Settings
I upgraded the High Definition RP, Post Processing, and Core RP Packages
Restarted Unity many times
Searched for a suitable asset

Here is what the package manager says:

There is an exception thrown in Unity about Shader error in HDRP/Lit: failed to open source file: 'Packages/com.unity.render-pipelines.core/ShaderLibrary/Version.hlsl' at /…/Library/PackageCache/com.unity.render-pipelines.high-definition@7.0.0/Runtime/ShaderLibrary/ShaderVariables.hlsl …

In fact, there is a whole wall of exceptions:

sentences:
Using enums for detecting object collisions As far as I know, I can detect what objects the player is colliding with is by the following code:

private void OnCollisionEnter2D(Collision2D collision)
{
    if(collision.collider.name.Equals(""))
}

But I have heard that I can use enums instead to reduce computations. Could anyone explain to me using examples?

sentences:
minecraft like game server database arhitecture Let's say we have a 2d map 500*500 tiles in size. And each tile is editable by players and has many states. So it's 250k tiles.  The game is multiplayer online game.

What would be the best approach from a server database perspective? Store each tile as an object in db with coordinates? Or store them in chunks? Or any other way?

sentences:
UDP Netcode Architecture for Fighting Game I am programming a fighting game that uses a UDP client/server architecture for multiplayer. The server can handle multiple clients, two of which (or one being the server) are playing and the rest are watching and chatting. I would prefer to use UDP for everything, including: player input from client, player state from server, and chat going both ways.

My concern is keeping the order of the player inputs in sync from the client to the server. Since moves involve a specific sequence of inputs (e.g., Left,Left-down,Down,Light Punch), if the server processes them out of order then the game is ruined. What is a good approach for dealing with packet loss and packets arriving out of order in this case?

I have considered having a linked list of outgoing packets in the client and server. With each step the list is traversed and unsent packets are sent, and if an ack packet(one I program the receiver to send back) was received for a particular packet (which I can identify simply with an integral value) then the outgoing packet is removed from the list. However, this does not guarantee order of delivery. Perhaps the server could keep a queue of inputs and evaluate another integral value in the packet for each input, organizing them into the correct order.

I'm not entirely sure, if someone could point me in the right direction I would be very grateful. I have working client and server chat code but before I starting seriously designing the network architecture I wanted to see what others have to say.

sentences:
How do I activate a game action when a UI button is held? I want to make my button do stuff when the player holds it. In this case, I want to make a grab function: when the button is down the character can grab objects, but if the button is up they do not grab it.
I already have the function using the Standard Assets CrossPlatformInput.
Here is how I have configured my button so far:

Here is my script:
void Update()
{

    Physics2D.queriesStartInColliders = false;
    RaycastHit2D hit = Physics2D.Raycast(transform.position, Vector2.right * transform.localScale.x, distance, boxMask);

    if (PushKey())
    {
        isGrab = !isGrab;

        if (hit.collider != null && hit.collider.gameObject.tag == "Box" && isGrab)
        {
            box = hit.collider.gameObject;
            box.GetComponent<FixedJoint2D>().connectedBody = this.GetComponent<Rigidbody2D>();
            box.GetComponent<FixedJoint2D>().enabled = true;
            box.GetComponent<Rigidbody2D>().gravityScale = 1;
            box.GetComponent<Rigidbody2D>().mass = 1;

        }
        else if (!isGrab)
        {
            box.GetComponent<FixedJoint2D>().enabled = false;
            box.GetComponent<Rigidbody2D>().gravityScale = 6;
            box.GetComponent<Rigidbody2D>().mass = 6;
        }
    }
}

public bool PushKey()
{
    return CrossPlatformInputManager.GetButtonDown("E");
}

With this function, the first tap on the button means "grab activated" and the second tap means "grab deactivated", like a toggle. Instead, I want the grab to be active as long as the button is held.

sentences:
Making sense of the Game State manager tutorial? I have come across the Game State Managemnet tutorial at http://create.msdn.com/en-US/education/catalog/sample/game_state_management because I thought this would be a good place to start a game off.

I have added a new screen, but I am still a bit lost on how everything works.  When I make my game, do I only need one more additional screen? just for gameplay? or should I have a different screen for each level?

sentences:
Bullet Physics Applying Torques Effects not noticeable I am applying torques to a rag doll in order to make it move/walk.

For some reason, I am unable to view any effects when I use a call to rigidbody to apply torques even though these torques are pretty large i.e in the hundreds of Nm.

When I start the simulation, the doll just falls and the torques don't seem to have any effect. When I apply torque impulses however, there is a huge effect and the rag doll blows up because the angular velocity component becomes large that my velocity damping factor multiplies it and the torque impulse becomes huge.

I seem to notice effects of the torque though when I pause the simulation and then resume it after some time.

Am I missing something when I am trying to applying torques?
I know that when applying torque, it accumulates the torque value rather than updating the angular velocity directly.

I'm applying torques at every internal tick callback.

I'd be happy to supply necessary code.

Thank you all.

sentences:
How to iterate through the frames of an AnimationClip in editor mode I'm working on a 2D game, using spritesheets as the basis for four AnimationClips. (Every frame from the spritesheet is a keyframe in the animation.) I'm trying to step through the frames of these AnimationClips and programmatically create Collider2Ds which fit the dimensions of each frame.

The problem is, I'm having an impossible time actually iterating through the frames. My character has an Animator component, with 4 different states. I've tried various inputs to my editor script, but the closest I've gotten has an AnimationClip as input:

private AnimationClip clip; // set in inspector
private GameObject targetForColliders; // set in inspector

void createColliders() {
    Animation animation = new Animation();
    AnimationUtility.SetAnimationClips(animation, new AnimationClip[] { clip });

    foreach (AnimationState state in animation) {
        // do useful things here
    }
}

Unfortunately, somehow the animation local variable is null, crazy as that sounds. I've confirmed that by both logging it and attempting to use it, which causes a NullReferenceException every time.

I can't access the Sprite containing the spritesheet directly, because I've made manual adjustments within Unity to the keyframes (removing some, duplicating others) and I don't want to have to manually sync my colliders with the modified assets.

Has anyone attempted to do something similar to this before? tl;dr: What's the easiest way to iterate through the frames of a 2D animation in an editor script?

sentences:
Is there an advantage to creating a tileset instead of multiple content items? I'm using MonoGame to build my first game (yes, I'm new to game development). I'm trying to start by creating a 2D platformer so I want to have different "tiles" for the ground, walls, ceiling, etc.

I don't recall which tutorial I was reading, but I do know that they mentioned creating a tileset.png file and they gave a code sample of how to draw a specific tile from the tileset. I found a tileset on https://opengameart.org/ that I want to use for now, until I can replace the tileset.

I'm curious, is there any advantage to creating a tileset compared to creating, for example, multiple png content files?

sentences:
Sort Textures by name before looping through them im using a system to get textures from the device persistent data path and assign them to an array in order to show them in the game scene. So far everything works as expected, images are getting pulled into the array and are selected based on the level index. My issue is that on some android devices each time the image is loaded its either random or its a different image than it should be.
  public void LoadTextureArray(string _dirname)
    {

        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + _dirname + "/", "*.jpg");

        source = new Texture2D[fileNames.Length];

        int index = 0;
        foreach (var fileName in fileNames)
        {
            source[index] = LoadTextureFromPath(fileName);
            source[index].name = fileName;
            index++;
        }
    }

    public Texture2D LoadTextureFromPath(string path)
    {
        if (string.IsNullOrEmpty(path))
        {
            Debug.LogError("Texture path is null or empty");
            return null;
        }

        if (!File.Exists(path))
        {
            Debug.LogError($"File not found: {path}");
            return null;
        }

        byte[] bytes = File.ReadAllBytes(path);
        Texture2D texture = new Texture2D(2048, 2048, TextureFormat.RGB24, false);
        texture.LoadImage(bytes);
        Debug.Log("success");
        return texture;
    }

and i assign them based on another variable with this code here
 if (LevelSystemManager.Instance.CurrentLevel < source.Length)
                    {
                        selectedText = source[LevelSystemManager.Instance.CurrentLevel];
                        DifficultySet();
                        Debug.Log("selected Texture Name is :" + selectedText.name);
                    }

The LoadTextureArray function is called on Awake and on Start i do the assignment based on that index. Now in both Unity editor and my phone everything works fine and no matter how many times i load the level its the same image. Whereas on my wifes it either skips a couple of images from the array (displaying the 5th for instance as index 1) or everytime i open the level i see a different one!
Thank you!
Edit : it seems my problem is that i need to sort them out before assigning them to that array so any help would be appreciated!

sentences:
How can I accurately lerp Colors over seconds? I have some code to lerp between two colors over a set number of seconds, and the lerp works fine:

private Color lerpingColor;

private IEnumerator LerpColorsOverTime(Color startingColor, Color endingColor, float time)
{
    float step = 0.0f;
    while (step < 1.0f)
    {
        step += Time.deltaTime / time;
        yield return new WaitForSecondsRealtime(Time.deltaTime);
        lerpingColor = Color.Lerp(startingColor, endingColor, step);
    }
}

The problem is, the lerp time takes longer than the time I provide in my parameter.  For example, LerpColorsOverTime(Color.white, Color.black, 5.0f); takes over 8 seconds to lerp.

My best guess is that I am being very inefficient in the way I am lerping.  I tried accounting for the calculation time, but it does not seem to work.  In the particular case shown, it is because calculationTime is always 0, since the code to update the time is never run between my Time.time checks.  I tried various approaches, with this being my best:

private Color lerpingColor;

private IEnumerator LerpColorsOverTime(Color startingColor, Color endingColor, float time)
{
    float calculationTime = Time.time;
    float step = 0.0f;
    while (step < 1.0f)
    {
        step += Time.deltaTime / time;
        calculationTime = Time.time - calculationTime;
        yield return new WaitForSecondsRealtime(Time.deltaTime - calculationTime);
        calculationTime = Time.time;
        lerpingColor = Color.Lerp(startingColor, endingColor, step);
    }
}

I also tried other variations of Time.time, such as DateTime.Now.Miliseconds / 1000.0f and Time.realtimeSinceStartup, but they failed as well.

How can I make this code efficient enough to run in the expected time, or make some sort of change with the seemingly same effect?

sentences:
How to translate from Slick2d coordinates to jBox2d I read through this question to try and get a grasp on the topic, but I can't figure out how to apply this to my Slick2d window.

I'm trying to do something as simple as place an edge on the bottom of the screen, so I had been thinking of something like

bottomEdge.setAsEdge(new Vec2(0f, SCREEN_HEIGHT), new Vec2(SCREEN_WIDTH, SCREEN_HEIGHT))

...but I have no idea how move from my pixel system to the MKS system of jBox2d. In fact, the body.getPosition().x of a movable body I am drawing returns a decimal value between 100 and 101, but I have no idea how it's deciding on this value. As I move off screen to the left, it decreases down to 99, 98, and so on.

How should I go about making this conversion and thereby also being able to support different screen sizes & resolutions? My instinct is to somehow use the LWJGL underneath Slick, but I'm lost.

sentences:
I need a map generation algorithm for towerdefense I'm making a simple JavaScript tower defense game, I've experimented on some map generation my self, i seem to get one that works properly.

What I want is for you to provide a start point (possibly an end point) and an algorithm to generate a random path between them in a tower defense like style.

Examples

sentences:
Is it possible to use SFML with the Android NDK? I've started using SFML recently and I absolutely love it. I'd like to make games that could be ported to android, linux, mac and windows, but it seems that SFML lacks portability.

I've searched for a while and I've only found unrelated or unanswered questions on forums.

Does anyone know of any way to use SFML with the android NDK or any plans to support it in the future?

sentences:
Concerns about using a 3D tileset grid I'm thinking of implementing a 3D tile system for my engine, and tie it to it's world streaming system as well. As in, using it for it's terrain for an open world in an engine that theoretically can support up to about 80 kilometers squared even if it won't be fully used.

The game will be making use of both free form movement, and tiled movement when it comes to combat. With cover systems involved.

I was wandering about a few questions.

How viable is it to use a bunch of smaller tiles for terrain? Think Dota 2 Reborn. Where the increased levels are guaranteed to be flat and at exact heights. And there will be hills and the like connecting them.

If I was to use tiles, do I need to weld the vertexes and recompute the normals for the affected vertices?

If I do not need to connect them, will it cause any visible artifacts? Or any sort of performance hits? I know I can batch all the standard tiles. But I don't think the same can be said if I treat the terrain tiles like normal terrain when it comes to texturing.

sentences:
How to set blur on mouse over and remove on mouse out in AS3? How can I do it? I want to active glow when the mouse is over a Sprite and remove it when the mouse is out. Is it possible?

I have the following code:

var myGlow:GlowFilter = new GlowFilter();
myGlow.color = 0xFFFFFF;
myGlow.blurX = glowMobilha.blurY = 20;
var miniatura:MovieClip = _scene.d1[link];
miniatura.addEventListener(MouseEvent.CLICK,
                           function(e:Event):void {
                               MainSoundManager._sm.stopAllSounds();
                               GameManager.loadSection(link, false);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });
miniatura.buttonMode = true;

I set the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });

How can I "hide" the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });

UPDATE
I think I found the solution in the following code:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                           glowMobilha.alpha = 1;
                           miniatura.filters = [glowMobilha];
                           _controle.visible = true;
                           _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                             function(e:Event):void {
                             glowMobilha.alpha = 0;
                             miniatura.filters = [glowMobilha];
                             _controle.visible = false;
                             _controle.gotoAndStop(1);
                           });

is it the best solution?

sentences:
Multiple Vertex Buffers per Mesh I've run into the situation where the size of my mesh with all its vertices and indices, is larger than the (optimal) vertex buffer object upper limit (~8MB). I was wondering if I can sub-divide the mesh across multiple vertex buffers, and somehow retain validity of the indices. Ie a triangle with a indice at the first vertex, and an indice at the last (ie in seperate VBOs).

All the while maintaining this within Vertex Array Objects.
My thoughts are, save myself the hassle, and for meshes (messes :P) such as this, just use the necessary size (> 8MB); which is what I do at the moment.
But ideally my buffer manager (wip) at the moment is using optimal sizes; I may just have to make a special case then...

Any ideas? If necessary, a simple C++ code example is appreciated.

Note: I have also cross-posted this on stackoverflow, as I was not sure as to which it would be more suitable (its partly a design question).

sentences:
Moving an object toward another object on sphere knowing their quaternions I have a sphere centered in world origin. On the sphere surface I have two objects and I know their quaternions (rotation around sphere).

Currently my movement works on Vector2 inputs (cannot change distance from sphere surface) concatenating the current movement quaternion to existing quaternion:

 RotationQuaternion *= Quaternion.CreateFromRotationMatrix(
        Matrix.CreateRotationX(-_movementDirection.Y * Speed * deltaSeconds) *
        Matrix.CreateRotationY(_movementDirection.X * Speed * deltaSeconds));

How would I move one object toward another? I have looked into quaternion lerping functionality, but this does not really help, as what I would ideally want is movement direction and apply my own speed and acceleration to it.

Thanks for any help - geometry is not my strongest suite!

sentences:
How to make inputing large inputs more engaging I asked this question on another exchange "Encrypted content in games" and it made me wonder about game design.

The basics of that question is that you are using user-input, either directly or indirectly through the current game state, to generate a decryption key which unlocks/decrypts some secret content. This input would be the solution to some puzzle or come from a series of clues.

The problem is that the input space has to have high entropy to prevent it from being brute-forced, even by a computer. Having a series of levers would mean you need to have 90-120 or so of them. If I want a shorter input like let's 7, then you need 7500 different symbols to match those 90 levers which is way to many for people to distinguish between.

So I would like to hear ideas about how you could make an engaging/fun input method with high entropy. Ideally one that's visible to the user, meaning that the user is aware of it and not happening in the background.

Here is one example I thought about:

Imagine a secret altar outside of any quest lines. In front of it are 10 slots. Any of the 500+ game objects can be placed in the slots. Based on the game objects used and their permutation, a unique decryption key is generated using the object's game-IDs. Then the clues to what objects to use and in what order could be cleverly hidden through the game or somewhere else.

It still suffers from users possible being unable to effectively distinguishing the 500 different objects in the game. Also if your game is small and doesn't have that many objects it doesn't work.

sentences:
ScreenToWorldPoint and ViewportToWorldPoint I'm currently following tutorials on Youtube to learn howto use Unity. My code runs perfectly as per the tutorial, but i just have some questions regarding the code, with regards to screenToWorldPoint & viewportToWorldPoint.

The purpose of the code is for a 2D platformer, where the character's arms will rotate and face where the mouse cursor is.

Code:

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

public class ArmRotation : MonoBehaviour {

    public int rotationOffset = 0;

    // Update is called once per frame
    void Update () {
        Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position; //Gets the difference between
        difference.Normalize(); //Normalizing the vector

        float rotateZ = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;
        transform.rotation = Quaternion.Euler(0f, 0f, rotateZ + rotationOffset);
    }
}

I've done some googling and am aware of the difference between screenToWorldPoint and viewportToWorldPoint as per the answer here  https://answers.unity.com/questions/168156/screen-vs-viewport-what-is-the-difference.html

Where

Screen: from [0,0] to [Screen.width, Screen.height]
Viewport: from [0,0] to [1,1]

Questions:

Why do we have to calculate the difference between the position of the mouse cursor and the position of the character's arm instead of just setting the following:
. Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition);

I've tried setting it to the position of the mouse cursor instead of using the difference between the arm & the cursor and while the code still works and the arm is still able to rotate, it is a little "off" from the direction of the cursor. E.g A little higher than where the cursor is. Why does using the difference solve this issue?

Why do we call difference.Normalize() ? To my understanding, Normalize returns a vector between 0 & 1.However, Mathf.Atan2 returns the angle in radians whose Tan is calculated by y/x. As such, calling Normalize and returning a vector to a value between 0 & 1 makes no difference because the value calculated will be the same between a un-normalised and normalised vector since the proportions are the same?

When i use ViewportToWorldPoint instead of ScreenToWorldPoint, i do not use Normalize because to my understanding, the Vector returned by ViewportToWorldPoint should already be within 0 & 1, hance we do not have to normalise it. However, when i test the code out in play mode,the arm barely rotates. Why is this so?

I would appreciate any help or pointers in the right directions.

Thanks!

EDIT: I had a look at the manual and realise that Normalize() returns a vector with the same direction, but magnitude 1, but i'm still just as confused

sentences:
How to store 3d transformation in a game? I am curious what is the best strategy to save 3d transformation of a model.

Here are the few choices I think about:

4x4 matrix
4x3 matrix(skip the bottom row of a 4*4 matrix)
Dual quaternions with a 3d scaling vector
3x3 matrix with a 3d translation vector

sentences: Why would you want multiple render targets? In d3d11, you can bind multiple render targets ID3D11DeviceContext::OMSetRenderTargets.  But why would you want to do this?

sentences:
How do I make function on user clicked on close button Ads reward? So I'm here want to make function when the user closed the Ads before video ads end, the function is stopping or revert, in this case, I'm using ienumerator methods, but I don't know how to add the handler on Ads, because I already using HandleRewardClosed method not like I want but because its same with user watch the vid till end not closed the videos before ended .
    public void loadRewardVideo()
    {
        rewardedAd.LoadAd(new AdRequest.Builder().Build(), rewarded_Ad_ID);

        rewardedAd.OnAdLoaded += HandleRewardedAdLoaded;
        rewardedAd.OnAdClosed += HandleRewardedAdClosed;
        rewardedAd.OnAdOpening += HandleRewardedAdOpening;
        rewardedAd.OnAdFailedToLoad += HandleRewardedAdFailedToLoad;
        rewardedAd.OnAdRewarded += HandleUserEarnedReward;
        rewardedAd.OnAdLeavingApplication += HandleOnRewardAdleavingApp;

    }

    /// rewarded video events //////////////////////////////////////////////

    public event EventHandler<EventArgs> OnAdLoaded;

    public event EventHandler<AdFailedToLoadEventArgs> OnAdFailedToLoad;

    public event EventHandler<EventArgs> OnAdOpening;

    public event EventHandler<EventArgs> OnAdStarted;

    public event EventHandler<EventArgs> OnAdClosed;

    public event EventHandler<Reward> OnAdRewarded;

    public event EventHandler<EventArgs> OnAdLeavingApplication;

    public event EventHandler<EventArgs> OnAdCompleted;

    /// Rewared events //////////////////////////

    public void HandleRewardedAdLoaded(object sender, EventArgs args)
    {
        Debug.Log("Video Loaded");
    }

    public void HandleRewardedAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
    {
        Debug.Log("Video not loaded");
    }

    public void HandleRewardedAdOpening(object sender, EventArgs args)
    {
        Debug.Log("Video Loading");
    }

    public void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
    {
        Debug.Log("Video Loading failed");
    }

    public void HandleRewardedAdClosed(object sender, EventArgs args)
    {
        Debug.Log("Video Loading failed");

        StartCoroutine(ClosedAds());
    }

    IEnumerator ClosedAds()
    {
        _GameManager.instance.isGameOver = true;
        yield return new WaitForSeconds(.05f);
        _GameManager.instance.isStarted = false;

        Time.timeScale = 0;

        _FirebaseRemoteConfig.instance.DisplayAds();

        _GameManager.instance.ShowingGameOverPanel();

        _GameManager.instance.pauseBtn.SetActive(false);
    }
```

sentences:
What I need to do to integrate in game micro payments for virtual goods in desktop games? Does anyone here have experience in implementing in game payments , does such thing is possible ?
Where should I look in to?

sentences:
blending with the foreground but not the background I want to draw some very-semi-transparent objects on top of my scene and have them blend nicely with the other pixels in the scene, but not blend with the background; if I draw a semi-transparent object over the (black) background, I don't want it tainted and drawn dark.

The top scene is what I get - the semi-transparent orange triangle on top is blended with the black background.  The bottom scene is what I want - the semi-transparent orange triangle is blended only with the blue triangle, but not with the black background.

How can this best be achieved?  Is there a simple blend func that does this?  I would like to avoid deferred rendering and such if I possibly can.

Is there some way that gl.blendFunc and perhaps gl.blendFuncSeparate can be used to achieve this?

sentences:
How do I calculate the tangent to a point on a circle? I have a line that is from the center of a circle to a point on it's edge that is changing constantly (radius is drawn to a point orbiting a circle)
I want to make a line tangential to the circle whose midpoint is always the orbiting point. I know how to do it on paper but coding it in logic is the problem. Can someone show me how or point me to resources that I could use that would help me?

    public Line calculateTangent(Circle ball){

    //the point orbiting the circle
    circleEdge = new Vector2f((float)(radius*Math.cos(angle*Math.PI/180f)), (float)(radius*Math.sin(angle*Math.PI/180f)));
    //the line that I want to be perpendicular to at all times
    radiusLine = new Line(ball.getCenterX(), ball.getCenterY(), circleEdge.getX(), circleEdge.getY());
    //no idea how to do this last part
    perpendicular =

    }

sentences:
Where to start learning OpenGL with C++? Possible Duplicate:
  What are some good learning resources for OpenGL?

I have learnt C++ and made some cool text based games and such but I would love to start graphical programming. I'm a decent artist (I will have some of my work below) I know the basics of C++ but I really would like to get into OpenGL.

I need someone to show me some good tutorials for OpenGL with C++ so I can really get into game development. My goal is to be able to program a simple 2D game by the end of the year and I have lots of time to do so. I'm en-rolled in a game development course next year and really need some help with starting off.

sentences:
String table or a tree for virtual filesystem I am developing a binary file format to store my game's assets and I am thinking about how to implement the "file table". One option to would be to create a structure for file entries like this:

    struct Entry
    {
        uint16_t nameLength; //< This basically stores the whole path e.g "dir1/file1.txt"
        char*    name;
        uint64_t dataSize;
        uint64_t dataOffset;
    };

Or i could use a method, which I think is more elegant and is based off the ISO 9660 filesystem, however I think it may have a performance impact on traversing the file tree.

    struct Entry
    {
        uint16_t entrySize; //< This is used for going to the next entry (next = current + current.entrySize)
        uint8_t  entryType; //< 0 for file, 1 for directory + may be extended later
        uint16_t nameLength; //< Now this only stores the concrete file/directory name
        char*    name;
        uint64_t dataSize;
        uint64_t dataOffset;
        Entry*   children; //< Actually an array where entrySize is used for iterating
                            // and the last entry is a "null entry" which has entrySize = 0
    };

So which one of theese will be better considering that the resource files are "read only" and cannot be modified, only created again? Or is there a solution better tailored for virtual filesystems?

Because in the first case the system only needs to traverse all the entries lloking for "dir1/file1.txt", but in the second case it will have to first search for "dir1" in the root entry, and the for "file1.txt".

I hope that I was clean enough.

sentences:
Confuse with OpenGL, SFML, and its library I am a beginning to enter the world of game development.

Lately, I researched that "OPENGL" is one of the tools to use in graphics,
then I found out about "SFML" (I think that its a library or something that uses opengl).

I am so confuse because all books/ sites said using "GLUT",
but many people/fellow developers said that I must use a more updated one like "SFML"
but sfml has few/none tutorials.

What I am trying to say is "how to create own library or something like your own glut or sfml",
and why does opengl has no source code? And how can I use the EXACT(not glut/sfml) opengl in my c++
program?

I am so confuse....

sentences:
AS3/Flashdevelop - Controlling a 2D character to move around a planet with gravity With a little help I have managed to create a 2D planet with working gravity that constantly pulls a character towards its center. The only problem now is that I am completely stumped on how to make it so the user is able to make this character traverse the planet as one would expect rather than the simple up/down/left/right we are used to in natural platformers.

It should be noted the planet being traversed will have platforms/layers to jump and fall onto, so the moving and jumping should be in relation to the center of the planet, where the center of the planet acts as "down" would in a traditional platformer (which is why I seem to think I need a complicated way to create this kind of natural movement).

I had the idea of recalculating a new left and right direction to move in every time position is changed but the logic I have to work out to achieve this is beyond my knowledge.

Is this the only way to go or should I try tackling the problem differently? I hope not because I don't think I'd be able to achieve this otherwise.

This is my current code showing how the gravity works, with a simple placeholder for movement that just allows the character to move up/down/left/right on the screen:

public function moveChar(event:Event):void
    {
            if (leftPressed)
            {
                character.x -= mainSpeed;
            }
            if (rightPressed)
            {
                character.x += mainSpeed;
            }
            if (upPressed)
            {
                character.y -= mainSpeed;
            }
            if (downPressed)
            {
                character.y += mainSpeed;
            }
        }

public function gravity():void
{
    //tan2(planet.y - player.y, planet.x - player.x)
    angle = Math.atan2((planet1.y + 2245) - (character.y+5), (planet1.x+2245) - (character.x+5));
    gravityX = Math.cos(angle) * gravitationalAcceleration;
    gravityY = Math.sin(angle) * gravitationalAcceleration;

    //distance = Math2.Pythagoras(planet1.x + 50, planet1.y + 50, character1.x + 5, character1.y + 5);
    distance = Math.sqrt((yDistance * yDistance) + (xDistance * xDistance));

    //Calculate the distance between the character and the planet in terms of x and y coordinate
    xDistance = (character.x + 5) - (planet1.x + 2245);//320 to 50
    yDistance = (character.y + 5) - (planet1.y + 2245);//320 to 50

    //Make sure this distance is a positive value
    if (xDistance < 0) {
        xDistance = -xDistance;
    }
    if (yDistance < 0) {
        yDistance = -yDistance;
    }

    //Update the current velocity before new velocity is calculated
    initialXVelocity = finalXVelocity;
    initialYVelocity = finalYVelocity;

    //Send the character into the correct direction
    character.x += gravityX;
    character.y += gravityY;

    //Basic collision detection of the surface, basic stop of gravity
    if (distance <= planet1Radius) {
    trace("hit!");

    if (planet1.x - 2180 < character.x - 5) { //320 to 50
        character.x -= gravityX*1.025;
    }
    else {
        character.x += gravityX*1.025;
    }
    if (planet1.y - 2180 < character.y - 5) { //320 to 50
        character.y -= gravityY*1.025;
    }
    else {
        character.y += gravityY*1.025;
    }
    } else {
    trace(" no hit!");
    }
}

edit1:
I now have this code thanks to @DMGregory:

var characterPosition:Point = new Point();
var planetPosition:Point = new Point();
characterPosition.x = character.x;
characterPosition.y = character.y;
planetPosition.x = planet1.x;
planetPosition.y = planet1.y;

var localUp = normalize(characterPosition - planetPosition);
var localRight = new vector2( -localUp.y, localUp.x);

However, I have trouble understanding the syntax I should be using here, and also for when I need to move the character. Should it look something like this:

if (rightPressed)
{
    character.x += localRight;
{
if (leftPressed)
{
    character.x -= localLeft;
{

sentences:
How do I sort isometric sprites into the correct order? In a normal top-down 2D game one could use the screen y axis to sort the images. In this example the trees are properly sorted but the isometric walls are not:

Wall 2 is one pixel below wall 1 therefore it is drawn after wall 1, and ends up on top.

If I sort by the isometric y axis the walls appear in the correct order but the trees do not:

How do I do this correctly?

sentences:
Dynamic bodies with Parallax Scrolling I have an object that has a dynamic body. Currently, I'm setting it's position to follow the sprite when the parallax layer move. After a certain event, the object suppose to fall to the ground. That's when I set it to Awake. But as the object falls and the parallax is moving, how do I control these factor?

When the object falls by right the sprite should be updated to follow the dynamic body position. Let's say I have a character, to avoid the falling object, I move the parallax layer. The sprite is attached to the parallax layer. I'm asking what should I do in this case. Any advice?

sentences: What is the purpose of these purple images in these sprite files of Super Mario Maker? I was looking at the Wii U's Super Mario Maker Sprites and noted that all of them have purple images that each correspond to one of the animation frames (see below). What could they have been used for? Why not simply using the finished colored ones?

sentences: How can non-indie devs stop reinventing the wheel? It seems like the status quo in the games industry is to write most software in-house, maybe excluding the engine if you use one of the dozen or so big ones. Before working here I was mostly an open-source developer, so this mindset seems downright crazy to me. Is there any good way we can all stop building things like log viewers, network diagnostics, and patching systems?

sentences:
specific function of class Time Is there a function that according to the name of the object, its tag and the time taken since the beginning of the game(for example time+=Time.deltaTime), gives the position of this object?

if yes which one?

thanks

from a rectilinear trajectory unknown to a randomly translated object, I need to press a Q key to know its direction vector. For this, I get the position of the object to the object. Q support and if I get the position of the object in the lapse of time preceding the moment of this support, the difference of these 2 positions gives me the direction sought of the trajectory at this moment.

When I have perfectly resolved this script, I will create another very similar one that will give me the vector direction of the rectilinear trajectory of the object at each collision on another object

Here is my script:

  Blockquote

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class script5 : MonoBehaviour {

//public GameObject sphere;
public static float t;
//public float laps_time;
public static float temps;
//public float difftime;
//float temps_appui;

float x1,y1,j1;
float x2,y2,j2;
float x3,y3,j3;

// Vector3 cat = transform.position;
    struct vecteur {
    public float k1;
    public  float k2;
    public float k3;

};

// Use this for initialization
    void Start ()
    {
        temps+=Time.deltaTime;

}

//fonction retournant la position d'un objet à un instant précis
vecteur function_script6(float t)

{
    vecteur v;
    v.k1 = 0;
    v.k2 = 0;
    v.k3 = 0;

    Vector3 cat = transform.position;

    if (temps == t) {
        v.k1 = cat.x;
        v.k2 = cat.y;
        v.k3 = cat.z;

    }

    return v;
}

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

    float temps_appui;
    public float difftime;
    public float laps_time;
    //t += Time.time;

    //donner les coordonnées de la sphère au temps où la touche Q est appuyée
    if (Input.GetKeyDown (KeyCode.Q)) {

        //donner les coordonnées de la sphère au temps où la touche Q est appuyée
        temps_appui = temps;
        difftime=temps_appui-laps_time;

        function_script6 (temps_appui);

        //donner les coordonnées de la sphère au temps juste avant l'appui de la touche Q
        function_script6 (difftime);

        x1=function_script6(difftime).k1;
        x2=function_script6(difftime).k2;
        x3=function_script6(difftime).k3;

        j1=function_script6 (temps_appui).k1;
        j2=function_script6 (temps_appui).k2;
        j3=function_script6 (temps_appui).k3;

        //donne le vecteur de la trajectoire de la sphère à l'appui de la touche Q
        y1=function_script6 (temps_appui).k1-function_script6 (difftime).k1;
        y2=function_script6 (temps_appui).k2-function_script6 (difftime).k2;
        y3=function_script6 (temps_appui).k3-function_script6 (difftime).k3;

        print ("(position appui:" + j1 + "," +j2 + "," + j3 + ")");
        print ("(position difftime:" + x1 + "," + x2 + "," + x3 + ")");
        print ("(vecteur trajectoire:" + y1 + "," + y2 + "," + y3 + ")");
        print ("-----------------------------");

}

}
}

almost everything is good except for the position of difftime which is always null.
Why?

sentences:
OpenGL ES 2.0 Framebuffer stays empty? As first I want excuse me for opening another FBO question. I found alot of them but I still can not manage to get it working. I want to implement a framebuffer class for postprocesing in my 2D Android Applikation. Since it's 2D I do not need a renderbuffer for depth testing. My current code has the problem that nothing gets rendered so the framebuffer is maybe empty. I am doing this steps:

private final int framebuffer[] = new int[1];
private final int mTextureID;
//GLTexture is my Class for drawing textures..
//I can secure that this class works with drawing normal Textures
private final GLTexture mFrame;

//init
public GLPostProcessor()
{
    //create empty Texture
    mTextureID = GLSurf.mTexMng.createNewEmpty();

    //gen Framebuffer
    GLES20.glGenFramebuffers(1, framebuffer, 0);

    //bind
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, framebuffer[0]);

    //set Texture
    GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mTextureID, 0);

    //unbind
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);

    //init GLTexture
    mFrame = new GLTexture(-1, false);
    mFrame.setPos(0, 0, 1920, 1080);
    mFrame.mTextureID = mTextureID;
    mFrame.setShader(GLShader.sProgram_PostProcessing);
}

public final void beginRender()
{
    //bind framebuffer
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, framebuffer[0]);

    //reset Viewport and clear
    GLES20.glViewport(0, 0, 1920, 1080);
    GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); //white
}

public final void endRender()
{
    //unbind
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
}

public final void Render()
{
    mFrame.Render();
}

My createNewEmpty() which returns 1 as new Texture ID:

public final int createNewEmpty()
{
    final int texid = getfreeGLID(); //In this case it has the value 1

    if (texid >= MAX_TEXTURES)
        return 0;

    // Bind texture to texturename
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + texid);
    //mTextureIDs is created by glGenTextures()
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureIDs[texid]);

    // Set filtering
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER,
                           GLES20.GL_NEAREST);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER,
                           GLES20.GL_NEAREST);

    // Set wrapping mode
    //is this necessary or not?
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,
                           GLES20.GL_CLAMP_TO_EDGE);
    GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,
                           GLES20.GL_CLAMP_TO_EDGE);

    GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 1920, 1080, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null);

    return texid;
}

I already tried a POT colorbuffer (1024x1024 at glTexImage2D() and glViewport()). That did not make a difference for my problem. But i found out, that if i change my shader code to sth. like "Color = Position" my screen gets colored.. so the rendercall is working in some way but the texture seems to be empty..

I think it's obvious but this is how I use the class:

GLPostProcessor glpp = new GLPostProcessor();
//...
glpp.beginRender();
//render some things
glpp.endRender();
glpp.Render();

Thanks in advance and comment if code is missing.

sentences:
synchronizing character movement in different clients i want to synchronize the character movement in different clients,
while i got an problem here.
The script below is attach at the other players' characters,
say if you are player A in client A, then the player B,C,D.....' characters will have the below script.
My problem is that:
When player A in client A moving forward at the same time using a normal attack.
for example, pressing key "up arrow" and "z" (without key up).
In client A, it give me the expected result,i.e. player A standing at the current position and playing the normalatt animation repeatedly without moving.

While when the above data send to the server and receive by player B,
player A character in client B, did play the normalatt animation , but when the animation end, SOMETIMES it will move forward before the animation replay.

How can i correct the script so that player A in client B won't move forward before player A in client A key up the key "z"

an video showing my problem

void Update () {
       if(moving){
         transform.position += transform.forward*speed ;
       }
    }

    //and event which get response from server
    void updatecharactermovement(int playeruid,string command,float rotx,float roty,float rotz){
        //if an character move, change it direction
       if(command=="move"){
         if(playeruid==this.playerid){
          transform.eulerAngles=new Vector3(rotx,roty,rotx);
          moving=true;
         }
       }

       //if a character stop, reset it position
       if(command=="stop"){
         if(playeruid==this.playerid){
          transform.position=new Vector3(rotx,roty,rotz);
          moving=false;
         }
       }

    }

//function which play the character skills
    void updatecharacterskill(int playerid,string skill){
       if(playerid==this.playerid){
         if(skill=="normalatt"){
          animation.CrossFade("normalatt");
          StartCoroutine(attacting(skill));
         }
       }
    }

 // allow the character continue to move until the skill animation end
public IEnumerator attacting(string skill){
         moving=false;
         animation.CrossFade(skill);
         yield return new WaitForSeconds ( (float) animation[skill].length);
         moving=true;
    }

sentences:
List of Anti-Cheat Packages for MMOs? i would like to start this topic for programs to counter-attack link text.

I am not aware of a big list but with everyone's help i hope to make this a fine topic.

Posting format:

NAME: nProtect GameGuard

GAME TYPE: any type of game

Website: http://global.nprotect.com/product/gg.php

FEATURES?

Protect the users' PC from fast
evolving hacking technologies and
viruses.
Real-time protection, diagnose
various patterns latest hacking tools
that can harm games, but also memory
debugging prevention technology will
be applied, completely blocking
hacking tools through real-time
hacking tool monitoring and blocking
function.
Blocks hacking attacks through memory
scan
Blocks online outflow of personal
information

sentences:
How to store the updated score in mysql databse from android? I want to store the updated score in mysql database. So, what i do for that?

private void updateScore() {
    if (winner.equalsIgnoreCase("You")) {
        tally = 100 - computer.getId();
        MainActivity.userScore += tally;
        if (MainActivity.userScore >= MainActivity.maxEnd) {
            MainActivity.   stat++;
            MainActivity.totTurn++;
            MainActivity.userScore = 0;
            MainActivity.computerScore = 0;

        }

    }
    if (winner.equalsIgnoreCase("computer")) {
        tally = 100 - buddy.getId();
        MainActivity.computerScore += tally;
        if (MainActivity.computerScore >= MainActivity.maxEnd) {

            MainActivity.totTurn++;
            MainActivity.userScore = 0;
            MainActivity.computerScore = 0;
        }
    }
    MainActivity.saveConfig();
}

sentences:
Incorrect click event when resize on libGdx I want to use scene2D, in libGDX, to detect click on object.

I have this simple Game sample :

Stage stage;

@Override
public void create()
{
    this.stage = new Stage(1280, 720, true);
    MyActor actor = new MyActor();

    Gdx.input.setInputProcessor(stage);

    actor.setTexture(new TextureRegion(new Texture(Gdx.files.internal("plateau.jpg"))));
    actor.setScale(0.1f);

    stage.addActor(actor);

    actor.addListener(new InputListener()
    {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
        {
            System.out.println("down"+Math.random());
            return true;
        }
    });
}

@Override
public void render()
{
    stage.act();
    stage.draw();
}

MyActor is a simple class extending Actor with a rendertexture.
The Event is working fine at start.
But when resizing the frame, while the Actor is streched as wanted, the coordinates of the click are not updated and thus misplaced.

How to make the stage using the new size of the items as base to the event ?

Thanks.

sentences: Android in-game pause screen Right now Im calling a new activity with an xml-view when I pause my game, but Since I do this I need to use context in my real-time code, and this is causing a memory leak. Is there any preffered way to pause the game? By pause I mean if game is over, if I die, or if I press pause-button. Would a custom dialog work just aswell? this would mean I wont have to leave my main-activity while im in-game.

sentences: Why is clip space always referred to as "homogeneous clip space"? I've noticed in almost everything I've read so far that the term "clip space" is prepended with the word "homogeneous". Now I understand that it roughly means "all the same", but I don't understand why there is the express need to say "homogeneous clip space". When is clip space not homogeneous and why do we need to differentiate? And for that matter, what exactly does it mean that we're calling it "homogeneous clip space"? Homogenous in relation to what? In what way are the vertices "all the same"?

sentences:
Why this if logic isnot short circuiting? I've this script in UNITY to check if the hit RayCastHid2D variable has some gameobject with hole tag or a parent gameobject with hole tag when I Raycast...

if (hit.collider != null && (hit.collider.gameObject.tag == "hole" || (hit.collider.gameObject.transform.parent.gameObject != null && hit.collider.gameObject.transform.parent.tag == "hole")))

Everything is fine until if (hit.collider != null && (hit.collider.gameObject.tag == "hole" ||

but when I enter (hit.collider.gameObject.transform.parent.gameObject != null && hit.collider.gameObject.transform.parent.tag == "hole") it throws a NullReferenceException....

But why?

It supposed to short circuit here hit.collider.gameObject.transform.parent.gameObject != null && if there's no parent gameobject!

sentences: How to change FPS when using a sprite sheet and AnimationPlayer? With AnimatedSprite it is easy to change FPS. Is there a convenient way to do that with AnimationPlayer?

sentences: Setup script variables before attaching to an object I need to attach a script at runtime, but that script requires some public members to be set in order to be helpful. Is there a way for me to setup the public members of the script before attaching it to a GameObject at runtime?

sentences:
Maximum range of projectile fired at given force and elevation I've gone over this again and again, and my result is obviously wrong when viewed in-action. Here's the initial formula I converted (first one):

http://en.wikipedia.org/wiki/Range_of_a_projectile

and here's my C# code:

float CalculateMaximumRange() {
    float g = Physics.gravity.y;
    float y = origin.position.y;
    float v = projectileSpeed;
    float a = 45;

    float vSin = v * Mathf.Sin(a);
    float vCos = v * Mathf.Cos(a);

    float sqrt = Mathf.Sqrt(vSin * vSin + 2 * g * y);

    return Mathf.Abs((vCos / g) * (vSin + sqrt));
}

Does anyone see what I did wrong?

sentences:
C# Minesweeper - When cells with no mines nearby gets clicked I'm currently making a Minesweeper in C#. I've already done the basics (generating minefield, rules and ui) but I don't know how I should implement when the user clicks a cell and the cell has no mines nearby and clicks nearby cells with also no mines nearby, like this:

And after click

This is my current code on this:

if (MineField(x,y) == false) // If the clicked cell isn't a mine
{
    if (GetNeighbours(x,y) == 0) // GetNeighbours returns the amount of mines in the closest 8 cells
    {
        // To be honest, no idea...
    }
}

sentences:
Looking for an Open Source Game Engine with Crowd Simulation I am looking for a game engine for my school project on computer graphics. There are specific requirements that I do not want to implement by myself, since they are irrelevant for the grade, but relevant for the final result.

So reusing other one's code is a good thing here and I am looking for an engine that supports the following features, or that has plugins/3rd party projects available that can do it for me. I have already been looking for it for 2 days, but maybe some of you might just know the right fit for me.

Requirements:

Open Source / Free [so people can always view back my code without any licensing.]
3D
OO [I'm not so good at C++. Preferred are: Java, C#]
Crowd Simulation [I need walking people in my scene. This could be a 3rd party lib. Probably best with nav meshes.]
Render to Texture [I need panels with moving images on it. Unity3d fails here.]
Multi-project [I cannot adjust the installation folder on my school computer. UDK and CryEngine fail here.]
Networking
Cross Platform (at least for Linux)

Engines that fail my requirements:

CryEngine 3
UDK
Unity3d
OpenSceneGraph: not a real engine. I need more interactive components.
XNA: not cross platform.

Update
I found a nice crowd simulation lib after a long long search: http://gamma.cs.unc.edu/RVO2/ So that is not a big issue anymore

Update 2
Apparently, my mentor wants it to be cross platform. Which is an ouch for XNA.

sentences:
How to get an game object to instantiate lower than where It's created? When I press the collider where my allies spawn I want for them to spawn a little bit lower when I instantiate. I have tried to use Vector 3 and GetComponent, but It gives this error:

'Assets/Scripts/PlaceMonster.cs(26,33): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer'

I just want for my allies to spawn a little bit lower than the collider, but I'm stumped on what's the problem.

void OnMouseUp () {
    theAllyMenu.gameObject.SetActive (false);
    if (canPlaceAlly ()) {
        ally = (GameObject)
            //GetComponent<Transform>().transformPic = transformPic;
            transform.position = new Vector3(transform.position.x, transform.position.y - -5, transform.position.z);
            Instantiate (allyPrefab, transform.position, Quaternion.identity);
    }

}

sentences:
How to create a shader for this hue change effect? In this cut scene from Shovel Knight, the individual pixel art tableaux don't merely fade in and out. Rather, they fade in and out as well as undergo various hue changes.

Here's an example:

The changes in color appear to be discrete, and follow some kind of pattern.

I want to achieve a similar effect using a GLSL shader, but I am having trouble discerning exactly what pattern the colors follow. It seems like lighter colors in the palette are progressively swapped for darker colors in the same palette.

Any ideas how to achieve a similar effect?

Would achieving a similar effect require predefining palette swaps as well as creating gray scale masks of the areas that eventually get blacked out? I would prefer it if there was an easier solution, for example, identifying some general pattern in the color changes that could be used for any palette.

sentences:
Unity3D Tag as a public variable in editor How do you incorporate Tag strings into a scripts editor found in the inspector?

What it is I'm babbling about: When you create a public GameObject fooObject in a script, it shows up as a box that can have Game Objects dragged onto in its editor. It also has a small clickable dot that shows every Game Object that could be selected.

Now, say I have a public string fooString that would specifically be used for referencing the Tag strings of Game Objects (such as if (fooObject.tag == fooTag) or another use). Is there a way to define that string so that in the script's editor it strictly allows tag names to be used with it? I'm assuming with a similar clickable dot or a drop down menu of every selectable tag.

Although I could just manually type my string, a solution like the one above would have big object-orientated advantages. For example, if I was to change the name of this tag, it would change the string variable accordingly, as if the variable was a reference to such tag.

[Note to the moderators: I looked for an answer to this question for nearly 2 hours now to no avail. I understand that I may be missing some specific wrong word choice, in which case this question easily could have already been answered here. If this is closed as a duplicate, then, a quick comment explaining my mistake would be greatly appreciated.]

sentences:
Too Low Amount of Tris in Statistics Window, Only in the Tens (Unity) I'm working on a mobile game, and for optimization it would be useful to see the correct amount of polygons rendered.
However in the Statistics window the amount of polygons displayed are suspiciously low, only 62. Getting the poly count this low would be quite an achievement.
I'm using the Universal Rendering Pipeline.
Would there be a way to fix this?

sentences:
How to create endless scrolling landscape using coco2d's CCParallaxNode I created a horizontally scrolling landscape using CCParallaxNode. However it does not seem to support endless scrolling in one direction. As soon as the first image "ends" the background shines through. Adding an unlimited number of images is of course not an option. I thought about the usual way, namely adding two sprites for each parallax layer next to each other, and simply moving one at the end of the other at the appropriate time.

However, I have two issues:

parallax child nodes can't seem to be
re-positioned
the position of the child nodes vs
how far they have moved seem to be in
no relation to the parallax factor

This is how I set up the parallax node using 4 sprites with identical horizontal width:

CGPoint topOffset = CGPointMake(0, screenSize.height);
CGPoint midOffset = CGPointMake(0, screenSize.height / 2);
CGPoint downOffset = CGPointZero;

// Create a parallax node and add the sprites to it.
CCParallaxNode* paraNode = [CCParallaxNode node];
[paraNode addChild:para1 z:1 parallaxRatio:CGPointMake(0.5f, 0)
positionOffset:topOffset];
[paraNode addChild:para2 z:2 parallaxRatio:CGPointMake(1, 0) positionOffset:topOffset];
[paraNode addChild:para3 z:4 parallaxRatio:CGPointMake(2, 0) positionOffset:midOffset];
[paraNode addChild:para4 z:3 parallaxRatio:CGPointMake(3, 0) positionOffset:downOffset];
[self addChild:paraNode z:0 tag:ParallaxSceneTagParallaxNode];

Did anyone succeed in using CCParallaxNode for seamlessly endless scrolling?

sentences:
Video play in unity3d skybox I want to play 360 video in skybox. Is there any direct way avaiable to do this task. One long, boring, inefficient  procedure which seems that

Convert 360 to frames
Convert frames into cubmap
Use that cubeMap in skybox and Programatically change it's textures(Frame) quickly so that video effects shown

This is the long task which seems to me possible but is there any other way available?

sentences:
Are realtime lightning calculated every frame , also the ones not 'visible'? I've a big scene, with a lot of realtime light.

I noticed a big drop in FPS after finished to add lights, so I suppose that too many realtime light are a 'bad practice'.

But my question is: are all realtime light calculated every frame despite they are not visible from player camera ?

Is there any option to specify the behaviour of that calculation ?

sentences:
Can I use PBOs for textures in iOS? As far as I can see, there is no GL_PIXEL_UNPACK_BUFFER. Also, the OpenGL ES 2.0 specification (and as far as I know, no iOS device currently supports OpenGL ES > 2.0) states that glMapBufferOES() can only use GL_ARRAY_BUFFER as a target, yet glTexImage2D() and glTexSubImage2D() only seem to use PBOs if GL_PIXEL_UNPACK_BUFFER is bound.

The OpenGL documentation for glBindBuffer() also states that:

  GL_PIXEL_PACK_BUFFER and GL_PIXEL_UNPACK_BUFFER are available only if the GL version is 2.1 or greater.

So, can I use PBOs for textures? Am I missing something obvious?

sentences:
How to get this type of movement in LibGDX? I want objects in my game to move randomly but always from right side of the screen to the left side. The movement must be as smooth and natural as possible, like they are following a path.
Can i obtain this with the wander steering behavior without having objects going in every direction randomly? (that's what i have right now)

sentences:
Can anyone recommend an AI sandbox? I'm passionate person, who has been around AI from a long time [1] but never going in deep enough. Now it's time!

I've been really looking for some way to concentrate on AI coding but couldn't succeeded to find an AI environment I can focus on. I just want to use an AI sandbox environment which would let me have tools like:

visibility information
character controller
able to easily define a level, with obstacles of course
physics
collider management
triggers management
don't need to be a shiny, eye candy graphical render : this is about pathfinding, tactical reasoning, etc..

I have tried :

Unreal Dev Kit : while the new release announce is about C++ coding, this is about external tools and will be released in 2013
Cry Engine : really interesting as AI is presents here but coding with it appears to be an hell: did I got it wrong ?
Half Life source, C4, Torque, Dx Studio : either quite old, not very useful or costly these imply to dig in documentation (when provided) to code everything, graphics included.
Unity 3D : the most promising platform. While you also need to create your own environment, there are lot of examples. The disadvantage is, in addition to spend time to have this env. working, is the languages choice : C#, Javascript or Boo. C# is not that hard, but this implies you'll allways have to convert papers (I love those from Lars Linden) books codes, or anything you can have in Aigamedev are most often in C++. This is extra work. I've look at "Simple Path", the very good Arong Greenberg work but no source provided and AngryAnt work.
AI Sandbox : this seems to be exactly what as AI coder I want to use. I saw some preview but from 2009 we still don't know what it will be about precisely, will it be opensource or free (I strongly doubt), will I be able to buy it? will it really provide me tools I need to focus on AI ?

That being said, what is the best environment to be able to focus on AI coding only, is it even possible?

sentences:
Converting Projected Vertex Positions to Normalized Device Coordinates I'm using directx 9 and vertex shaders to rasterize triangles...I have vertex shader input structs like this:

struct VS_INPUT_Quad
{
   float4 Position : POSITION;
   float2 UV : TEXCOORD0;
};

and pixel shader input structs like this:

struct PS_INPUT_Quad
{
   float4 Position : POSITION;
   float4 Pos2 : TEXCOORD0;
   float2 UV : TEXCOORD1;
};

Here is vertex shader:

    PS_INPUT_Quad SkyboxVisibilityPass_Vertex_Shader( VS_INPUT_Quad Input )
    {
        PS_INPUT_Quad Output = ( PS_INPUT_Quad )0;

// projected vertex position
        Output.Position = mul( Input.Position, mWVP );

// normalized device coordinates of the vertex
        Output.Pos2 = Output.Position / Output.Position.w;
        Output.Pos2.xy *= float2( 0.5, -0.5 );
        Output.Pos2.xy += float2( 0.5, 0.5 );

// prop uv coordinates
        Output.UV = Input.UV;

        return( Output );
    }

Here is pixel shader( simply returns a color from a texture ):

    float4 SkyboxVisibilityPass_Pixel_Shader( PS_INPUT_Quad Input ) : COLOR0
    {
        return tex2D( g_SamplerMultiplier, Input.Pos2.xy );
    }

I'm finding that the Pos2 value sent to the pixel shader is incorrect. Am I incorrectly converting projected vertex position coordinates to normalized device coordinates? PIX says that values are well above 1 when dubugging the pixel shader, however, the output looks correct when looking at the 'mesh' tab while hiliting the draw call...

Here is debug output for a single pixel whose position lies within the clip space:

   //
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// Parameters:
//
//   sampler2D g_SamplerMultiplier;
//
//
// Registers:
//
//   Name                Reg   Size
//   ------------------- ----- ----
//   g_SamplerMultiplier s0       1
//

    ps_2_0
    dcl t0.xy  // Input<4,5>
    dcl_2d s0
    texld r0, t0, s0  // ::SkyboxVisibilityPass_Pixel_Shader<0,1,2,3>
    mov oC0, r0  // ::SkyboxVisibilityPass_Pixel_Shader<0,1,2,3>

// approximately 2 instruction slots used (1 texture, 1 arithmetic)

Registers:
    oC0 (0.435, 0.435, 0.435, 1.000)    float4
r0  (0.435, 0.435, 0.435, 1.000)    float4
s0      float4
t0  (11.871, 8.631, 0.000, 0.000)   float4

As you can see above, t0 is the Pos2 coordinates that i use to sample the texture...they are well above 1 ... the vertex they belong to is visible so this pixel should have valid normalized device coordinates. Are the coordinates being altered after leaving the vertex shader and arriving at the pixel shader?

sentences:
Object completely losing orientation using Lerp So, I am making a 2d board game with unity.
Basically, two characters are moving on the board when clicking a spot on the board.
Since it's a static one frame 2d game, I put all of my game objects children of the canvas.
All the positions seems to be aligned, in the canvas itself everything is in place, also when I am debugging I notice that both of the positions, the local position and the target position are correct, so when I'm not using lerp and just setting the character position to the target position, it works perfect.
Lerp/Smooth damp are working perfect outside the canvas
I think it's something related to the update function, as it's updating false positions, but that's all I can guess...
This is the Update function of the Player class:
        private void FixedUpdate()
{
    if (moveTowards == true)
    {
        velocity = Vector3.zero;
        this.transform.position = Vector3.SmoothDamp(this.transform.localPosition, targetSpotPosition, ref velocity, .08f);
    }

    if (this.transform.position == targetSpotPosition)
    {
        moveTowards = false;
    }
}

moveTowards set to true when clicking a spot.
    public void movePlayerTo(Spots moveHere)
{
    moveTowards = true;
    moveHere.transform.position = Camera.main.ScreenToWorldPoint(moveHere.transform.position);
    targetSpotPosition = moveHere.transform.position;
    //targetSpotPosition = Camera.main.ScreenToWorldPoint(targetSpotPosition);
}

moveHere is the spot's position, there's no problem there.
I set my canvas to camera space render mode, and of course scale with screen size. Before putting everything in the canvas, it worked perfectley.
HELP PLEASE.
Thanks in advance,
Omer

sentences:
Quake 3 Bot Programming Example I would like to implement an intelligent bot for Quake-3. I downloaded the and built the code successfully under Linux. My problem is that I couldn't find any complete tutorial telling me how to build an agent; telling which files to use( as there are many files in the source code).

Can you give me a website or piece of source code telling me how to start? Or something like an example source code for a bot.

sentences:
Unity - Set quad to angle of floor mesh I have a cursor object (simple quad) that I'm moving around above a floor mesh. The floor mesh has varying heights (hills and such).
How can I set my quad to sit at the same angle as the mesh floor?
I'm using a raycast to cast down on the position of the cursor and get the angle of the floor mesh using hit.normal, then reflect.
RaycastHit hit;
var rayStart = new Vector3(transform.position.x, transform.position.y + 5f, transform.position.z);
if (Physics.Raycast(rayStart, Vector3.down, out hit, 10f)) {
    if (hit.collider.tag == "Floor") {
        Vector3 incomingVec = hit.point - rayStart;
        Vector3 reflectVec = Vector3.Reflect(incomingVec, hit.normal);
        cursorSprite.transform.eulerAngles = reflectVec;
        }
    }

(I've left out the position code, that works, its just the angle code that doesnt)
I've tried a bunch of variations, altering the reflectVec angle x, y and z but I can't figure out how to get it correct :/

sentences:
Recursive method causes an OutOfMemory error If a GameObject in my game has a special ability it triggers it, but I want all the special GameObjects that this GameObject affects to also trigger their abilities, for example if a bomb hits some objects, if these objects are also bombs, trigger them too. I though this would be easy by calling the method that handles all the special abilities recursively, but it wasn't. Basically what happened is a chain reaction of bullcrap that caused Unity to show an OurOfMemory error. Also makes my PC freeze completely while politely turning all the screens off.

The question is, how can I make it so it triggers all the affected cubes' special abilities, without everything going nuts?

Code:

     //Triggers the cube's special ability, if it has any
    private void TriggerSpecialCubeAbility(GameObject specialCube) {
        switch (specialCube.tag) {

            //Destroy all cubes in a radius from the special cube
            case "Bomb":
                TriggerBombAbility(specialCube);
                break;

            //Destroy all cubes of the same color as the special cube
            case "Lighting":
                TriggerLightingAbility(specialCube);
                break;
            default:
                break;
        }
    }

    private void TriggerBombAbility(GameObject specialCube) {
        var nearbyColliders = Physics2D.OverlapCircleAll(specialCube.transform.position, explosionRadius);
        Instantiate(particles[0], specialCube.transform.position, specialCube.transform.rotation);
        Instantiate(particles[1], specialCube.transform.position, specialCube.transform.rotation);

        foreach (var collider in nearbyColliders) {
            if (collider.tag == "Indestructible")
                return;

            var affectedCube = collider.gameObject;
            TriggerSpecialCubeAbility(affectedCube);
            Destroy(affectedCube);
        }

        destroySelectedCubes = true;
    }

sentences:
Approaches for storing grid-like information I am drawing this simple grid on my NodeJS server:

var grid = [];

for(var x = 0; x < 20; x++){
    grid[x] = [];
    for(var y = 0; y < 20; y++){
    grid[x][y] = 0;

    }
}

console.log(grid);

The outcome looks like this:

I know, pretty right?!

0 is supposed to indicate FREE, thus if a player requests to move to a field with 0, he will!

The problems come when I want to add more then just Free/Occupied, for instance I would like to give each Array Element an ID number for the Client Updates, or certain features on the field to be stored.

I tried to assign { something: N, something2: N}

But thought it looked rather performance expensive in the long run. (On a big Grid)

I read about using a single Object for several elements, but I cannot find this any more..

Should I perhaps use an Array of Objects, or an Additional Array inside each X,Y element?

Any performance / convenience / anything goes   tips are welcome :D

Edit:
Thank you for the ideas so far, I was now thinking to perhaps using Strings. Storing Variable_A + "," + Variable_B   and then later using the .split to use the information. Any thoughts on this?

sentences:
Collision with Two Angled Platforms I've encountered a problem in my attempt to implement Collision Handling for a game I'm creating, involving a collision with two angled platforms.

I'm using GJK-EPA for detecting/handling collisions so I can pull the penetration vector and depth from each collision, and using this I have been calculating the angle of the surface the player collides with.

What I don't understand, is how I should resolve a collision when the character is moving from one slope to a steeper slope, one slope to a shallower slope and flat-surface -> slope and vice versa.

I attempted comparing penetration depths but due to the nature of GJK, I can only do this with some additional vector maths which then refuses to work for steep->shallow slopes. Additionally: It sometimes seems to 'spasm' on direct contact with vertices.

Basically, can anyone tell me a good/common way of handling angles of objects that are touching TWO platforms, using GJK-EPA?

Thank you!

(To note: I'm relatively new to game development, and I'm trying to get some smooth slope physics working, just so you know the 'situation').

sentences:
Normals showing unexpected results I am making a game in c++ with opengl and glm and was working on my terrain when this happend :

as it appears it is renderering just the way i planned it, but my question was, how do i make it appear so that the their are not as many shadows? i have no idea of how i can fix this.

Here is the normal code:

        glm::vec3 calculateNormal(int x, int z) {
            float heightL = getHeight(x - 1, z);
            float heightR = getHeight(x + 1, z);
            float heightD = getHeight(x, z - 1);
            float heightU = getHeight(x, z + 1);
            glm::vec3 normal(heightL - heightR, 2.0f, heightD - heightU);
            glm::vec3 result = glm::normalize(normal);
            return result;
        }

and here is the terrain normal generation code

for (int i = 0; i < vertex_count; i++) {
                for (int j = 0; j < vertex_count; j++) {

                    float height = getHeight(j, i);

                    vert[vertexPointer * 3] = (float)j / ((float)vertex_count - 1) * size;
                    vert[vertexPointer * 3 + 1] = height;
                    vert[vertexPointer * 3 + 2] = (float)i / ((float)vertex_count - 1) * size;

                    glm::vec3 normal = calculateNormal(j, i);

                    norm[vertexPointer * 3] = normal.x;
                    norm[vertexPointer * 3 + 1] = normal.y;
                    norm[vertexPointer * 3 + 2] = normal.z;
                    ...

here is the terrain generation code

float getNoise(int x, int z) {
            int seed = x + z + (std::rand() % (0 - 15));
            return seed * 2.0f - 1.0f;
        }

        float generateheight(int x, int z) {
            return getIntoplatedNoise(x/16.0f, z/ 16.0f);
        }

        float getSmoothNoise(int x, int z) {
            float corners = (getNoise(x - 1, z - 1) + getNoise(x + 1, z - 1) + getNoise(x - 1, z + 1) + getNoise(x + 1, z + 1)) / 16.0f;
            float sides = (getNoise(x - 1, z) + getNoise(x + 1, z) + getNoise(x, z - 1) + getNoise(x, z + 1)) / 8.0f;
            float center = getNoise(x, z) / 4.0f;
            return corners + sides + center;

        }

        float getIntoplatedNoise(float x, float z) {
            int intX = (int)x;
            int intZ = (int)z;
            float fracX = x - intX;
            float fracZ = z - intZ;

            float v1 = getSmoothNoise(intX, intZ);
            float v2 = getSmoothNoise(intX + 1, intZ);
            float v3 = getSmoothNoise(intX, intZ + 1);
            float v4 = getSmoothNoise(intX + 1, intZ + 1);

            float i1 = interplate(v1, v2, fracX);
            float i2 = interplate(v3, v4, fracX);
            return interplate(i1, i2, fracZ);
        }

        float interplate(float a, float b, float blend) {
            double theta = blend * M_PI;
            float f = ((float) 1.0f - cos(theta)) * 0.5f;
            return a * (1.0f - f) + b * f;
        }

        float getHeight(int x, int z) {
            return generateheight(x, z);
        }

Thank you very much for you time

sentences:
Simple Bounding Box Multiple Collision problem I'm making my first game, and in it I use a moving ball to hit static blocks (kinda like breakout).

Basically, I loop through all of the static blocks on the screen each frame, update the position of the ball based on its velocity, and if it collides with a block, the ball will bounce back off of the block.

If the ball hits one block exactly, then there is no problem whatsoever. But if the ball happens to hit two blocks at the same time (that is, it hits in between both blocks), it passes right through both of them--no deflection whatsoever.

(I know the looping is inefficient and I'm looking to correct that later, but if it has to do with the problem, I just hope someone can point to me why it is that the collision resolution fails when two similar objects are hit at once.)

sentences:
Fbx SDK Importer issue (texture / uv related) I am using the latest autodesk FBX Importer SDK, but whatever I do, I am unable to get the uvs right. Some parts are textured properly while others are not.

I am using Direct3D9 and Direct3D11 (same result in both).

Image:

360 image: https://i.gyazo.com/5a2e5f6e127521915508c9c300eb03e5.mp4

The model uses a single texture and a single material shared among 4 meshes.

Is there someone who sees immediately what the problem could be? Or is there someone who can replicate the issue for me and figure out what I am missing?

FBX Test File: http://www.4shared.com/rar/o_WG0Crpce/Peach64FBX.html

My UV reading method:

int vertexCounter = 0;
for (int j = 0; j < nbPolygons; j++) {

    for (int k = 0; k < 3; k++) {

        int vertexIndex = pFbxMesh->GetPolygonVertex(j, k);

        Vector2 uv;
        _readUV(pFbxMesh, vertexIndex, pFbxMesh->GetTextureUVIndex(j, k), uv);

        pVertices[vertexIndex].uv.x = uv.x;
        pVertices[vertexIndex].uv.y = 1.0 - uv.y;
        vertexCounter++;
    }
}

void _readUV(fbxsdk::FbxMesh* pFbxMesh, int vertexIndex, int uvIndex, Vector2& uv) {

    fbxsdk::FbxLayerElementUV *pFbxLayerElementUV = pFbxMesh->GetLayer(0)->GetUVs();

    if (pFbxLayerElementUV == nullptr) {
        return;
    }

    switch (pFbxLayerElementUV->GetMappingMode()) {

        case FbxLayerElementUV::eByControlPoint:
        {
            switch (pFbxLayerElementUV->GetReferenceMode()) {

                case FbxLayerElementUV::eDirect:
                {
                    fbxsdk::FbxVector2 fbxUv = pFbxLayerElementUV->GetDirectArray().GetAt(vertexIndex);

                    uv.x = fbxUv.mData[0];
                    uv.y = fbxUv.mData[1];

                    break;
                }

                case FbxLayerElementUV::eIndexToDirect:
                {
                    int id = pFbxLayerElementUV->GetIndexArray().GetAt(vertexIndex);
                    fbxsdk::FbxVector2 fbxUv = pFbxLayerElementUV->GetDirectArray().GetAt(id);

                    uv.x = fbxUv.mData[0];
                    uv.y = fbxUv.mData[1];

                    break;
                }
            }

            break;
        }

        case FbxLayerElementUV::eByPolygonVertex:
        {

            switch (pFbxLayerElementUV->GetReferenceMode()) {

                // Always enters this part for the example model
                case FbxLayerElementUV::eDirect:
                case FbxLayerElementUV::eIndexToDirect:
                {

                    uv.x = pFbxLayerElementUV->GetDirectArray().GetAt(uvIndex).mData[0];
                    uv.y = pFbxLayerElementUV->GetDirectArray().GetAt(uvIndex).mData[1];

                    break;
                }
            }

            break;
        }
    }
}

I am doing V = 1.0 - uv.y because I am using Direct3D11.

NOTE: the MappingMode is always eByPolygonVertex and ReferenceMode is always eIndexToDirect

Rendering Info:

Rendered as a Triangle List
Uv wrapping mode: Wrap (Repeat)
Culling: None

sentences:
What is GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS? I am a beginner in OpenGL. I am learning about textures in OpenGL. What I don't understand is how to determine how many texture units are in the GPU. I heard someone said that you can see how many texture units by writing the following code.
int total_units;
glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &total_units);
std::cout << total_units << '\n';  // the result is 192

Is there 192 texture units in my GPU?  In documentation, it says:

GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
params returns one value, the maximum supported texture image units that can be used to access texture maps from the vertex shader and the fragment processor combined. If both the vertex shader and the fragment processing stage access the same texture image unit, then that counts as using two texture image units against this limit. The value must be at least 48. See glActiveTexture.

So I wanted to know how many texture units can be used to access texture maps from the vertex and fragment shaders. So I wrote and run the following code.
int vertex_units, fragment_units;
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &vertex_units);
std::cout << vertex_units << "\n";   // the result is 32
glGetInteferv(GL_MAX_TEXTURE_IMAGE_UNITS, &fragment_units);
std::cout << fragment_units << "\n"; // the result is also 32

So 32+32=64. But why does GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS shows me the result of 192? I think I am missing something. What do I need to calculate to get 192?
And also, in OpenGL, why are there only GL_TEXTURE0 to GL_TEXTURE31 macros? I think these macros are for each shaders. Am I right?

sentences:
What are some ways to texture map a terrain? I'm working with XNA on a 3D Game, and I'm trying to have a proper and nice environnement.
I actually followed a tutorial to create a terrain from a heightmap. To texture it, I just apply a grass texture on it and tile it a number of times.

But what I want to do is to have a really realistic texturing, but also generate it automatically (for example if I want to use Perlin noise to generate a terrain and then texture it).

I already learned about multi-texturing, loading a map file with different colors for different textures, but I don't think this is really efficient, for instance for cliffs or very steep areas it will tile a texture badly as it's a view from the top.
(Also, I don't know how I'll draw roads or dirt paths with that.)

I'm looking for an efficient solution to realistically texture mapping procedurally-generated terrain.

sentences:
Implementing a multilanguage AI contest platform This is a followup to this question. To sum: I'm implementing an AI contest site, where each user may submit several AI implementations for different games. Think about Google AI Challenge
but instead of just having a big event once a year, I would like it more on a league fashion, with all virtual players playing with each other every some close period of time.

I want to support as many programming languages as possible. I've seen that contest sites (like codeforces) ask you to submit a source code and interact through stdin and stdout. The first question is: what is the best way of supporting multiple languages?

As I see it, I can either ask people to upload some binary/script, and interact either through stdin/stdout, or sockets, or the file system; or ask people to submit source code, and wrap it with whatever is necessary for the interaction. I would like to skip the need to compile the code by myself (in the server, I mean), but I am willing to do it if its the "best" choice. I need to comunicate virtual players with each other, or even better, with some intermediary arbiter.

The second question is regarding security. If I'm going to be running user code in my server, I want to ensure strict security conditions, like no file system access, no networking, etc. Otherwise it would be a safe heaven for hackers.

I will be implementing the engine/arbiter in .NET. I would like to support at least C#, C++, Java and Python for the user's implementations. I'm willing to write interfaces for each of these languages to simplify the user interaction with the system.

Thanks in advance.

sentences:
Depth Intersection Shader I am trying to create a shader in Unity that shows where intersections occur between objects.

Most of the shader I have so far is based off of this youtube tutorial. However, I have made some slight modifications to it. The main one being that it is only using a camera's depth texture instead of the depthnormal texture.

Shader "Intersection/Unlit"
{
    Properties
    {
        _Color("Color", Color) = (0,0,0,0)
        _GlowColor("Glow Color", Color) = (1, 1, 1, 1)
        _FadeLength("Fade Length", Range(0, 2)) = 0.15
    }
    SubShader
    {
        Blend SrcAlpha OneMinusSrcAlpha
        ZWrite On

        Tags
        {
            "RenderType" = "Transparent"
            "Queue" = "Transparent"
        }

        Pass
        {
            CGPROGRAM
            #pragma target 3.0
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
                float3 normal : NORMAL;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float2 screenuv : TEXCOORD1;
                float4 vertex : SV_POSITION;
                float depth : DEPTH;
            };

            sampler2D _MainTex;
            float4 _MainTex_ST;

            v2f vert(appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = TRANSFORM_TEX(v.uv, _MainTex);

                o.screenuv = ((o.vertex.xy / o.vertex.w) + 1) / 2;
                o.screenuv.y = 1 - o.screenuv.y;
                o.depth = -UnityObjectToViewPos(v.vertex).z *_ProjectionParams.w;

                return o;
            }

            sampler2D _CameraDepthTexture;
            fixed4 _Color;
            fixed3 _GlowColor;
            float _FadeLength;

            fixed4 frag (v2f i) : SV_Target
            {
                float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, i.screenuv));
                float diff = screenDepth - i.depth;
                float intersect = 0;

                if(diff > 0)
                    intersect = 1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff);

                fixed4 glowColor = fixed4(lerp(_Color.rgb, _GlowColor, pow(intersect, 4)), 1);

                fixed4 col = _Color * _Color.a + glowColor;
                col.a = _Color.a;
                return col;
            }
            ENDCG
        }
    }
}

This shader produces a result that looks like this.

However, this is a problem as there are large areas of the object that remain the initial blue colour. What I was expecting was something that looked like this.

I think the issue is caused when calculating screen depth from i.screenuv

float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, i.screenuv));

I have tried removing the difference check, this initially appeared to work. Although, when I placed an object in front of the object with this shader, the shader behaved as if there was a collision when there was not. As you can see below.

I would appreciate any help in resolving the issue

sentences:
Textures rendering upside down and small with Pixel Shader in Mono Game but not XNA I'm new to HLSL, attempting to use MonoGame to do some simple post processing effects.

Here is my HLSL file, taken from one of rbwhitaker's xna tutorials (I would post the link, but can't post more than two with my current reputation).

//------------------------------ TEXTURE PROPERTIES ----------------------------
// This is the texture that SpriteBatch will try to set before drawing
texture ScreenTexture;

// Our sampler for the texture, which is just going to be pretty simple
sampler TextureSampler = sampler_state
{
    Texture = <ScreenTexture>;
};

//------------------------ PIXEL SHADER ----------------------------------------
// This pixel shader will simply look up the color of the texture at the
// requested point, and turns it into a shade of gray
float4 PixelShaderFunction(float2 TextureCoordinate : TEXCOORD0) : COLOR0
{
    float4 color = tex2D(TextureSampler, TextureCoordinate);

    float value = (color.r + color.g + color.b) / 3;
    color.r = value;
    color.g = value;
    color.b = value;

    return color;
}

//-------------------------- TECHNIQUES ----------------------------------------
// This technique is pretty simple - only one pass, and only a pixel shader
technique BlackAndWhite
{
    pass Pass1
    {
        PixelShader = compile ps_4_0 PixelShaderFunction();
    }
}

The only line I've changed is the compiler version from ps_2_0 -> ps_4_0, since MonoGame needs 4.0 (I think?)

I'm using MonoGame 3.4, and I've changed nothing from the initial project template except the following:

protected override void LoadContent()
{
    // Create a new SpriteBatch, which can be used to draw textures.
    spriteBatch = new SpriteBatch(GraphicsDevice);
    // TODO: use this.Content to load your game content here
    BlackAndWhiteEffect = Content.Load<Effect>("BlackAndWhite");
    Image = Content.Load<Texture2D>("smiley");
}

private Effect BlackAndWhiteEffect
{
    get;
    set;
}

private Texture2D Image
{
    get;
    set;
}

protected override void Draw(GameTime gameTime)
{

    GraphicsDevice.Clear(Color.CornflowerBlue);

    spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, BlackAndWhiteEffect);
    //spriteBatch.Begin();

    spriteBatch.Draw(Image, GraphicsDevice.Viewport.Bounds, Color.White);

    spriteBatch.End();

    base.Draw(gameTime);
}

Here is the result of the code executing in monogame:

And here is the result from an identical project created in XNA (except for ps_2_0 in the shader, as mentioned before):

Would appreciate any help. I can upload both solution files if needed.

sentences:
How to change pre-splash image for iOS? When I launched my game on my iPad, the screen first displayed a faulty splash image with a black lower half momentarily, before displaying the normal splash image.

No matter what I tried, I couldn't get rid of this faulty 'pre-splash image'. I have tried the following:

Entered my Plus package serial number and updated my seat in Unity.
Deleted and left all splash images blank in Unity.
Checked all the LaunchScreen-XXX.png images in Xcode.
Checked the files referenced by Images.xcassets in Xcode.
Changed all the above images to a completely black image. Still, the old faulty picture would appear.
Cleared all the data and installation files on my iPad.
Deleted General > Launch Images Source.

I wonder where Xcode kept the faulty image.

I am using Unity 5.5.1 and Xcode 9.2.

Could someone please help?

sentences:
Creating a 2D perspective in 3D game I'm new to XNA and 3D game development in general.

I'm creating a puzzle game kind of similar to tetris, built with blocks. I decided to build the game in 3D since I can do some cool animations and transitions when using 3D blocks with physics etc.

However, I really do want the game to look "2D". My blocks are made up of 3D models, but I don't want that to be visible when they're not animating.

I have followed some XNA tutorials and set up my scene like this:

this.view = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
            this.aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
            this.projection = Matrix.CreatePerspectiveFieldOfView(
                        MathHelper.ToRadians(45.0f), aspectRatio,
                        1.0f, 10000.0f);

... and it gives me a very 3D-ish look. For example, the blocks in the center of the screen looks exactly how I want them, but closer to the edges of the screen I can see the rotation and sides of them.

My guess is that I'm not after a perspective field of view, but any help on which field of view/settings to use to get a "flat" look when the blocks aren't rotated would be great!

sentences:
AI discover algorithm I am curious as to what algorithm/logic game AI/NPCs would use when discovering information about their environment.

There are two scenarios that I could envision.

The NPCs are all knowing in regards to elements in the environment, but choose to ignore them unless certain conditions are met (e.g. the guard will not "find" his fallen comrade's body unless he is x feet from the body)
The NPCs really do discover the environment by scanning it or something... (maybe similar to path finding?)

Maybe these are both used in conjunction...

Could anyone point me in the right direction towards any preferred methods?

I tried googling for this information, but could not find anything that seemed relevant.

sentences:
How should I isolate game entities with their concrete Drawable components (in C#)? I've designed my game entities using a common pattern of separating the entity from its components.  In my case, I've used the Strategy pattern to give each of my entities an IDrawable component.

I construct my entities using a factory, which constructs the entity and adds an appropriate drawable, e.g.:

public static PlayerEntity CreatePlayerEntity(...)
{
   PlayerEntity playerEntity = new PlayerEntity(...);
   SpriteDrawable spriteDrawable = new SpriteDrawable(...);
   playerEntity.Drawable = spriteDrawable;

   ...

   return playerEntity;
}

Now here's the question: If I later want to update the player drawable in some way (e.g. modify the sprite, change the animation, etc.), how and where should I do this?

My first thought is to have C# events that the PlayerEntity publishes and the Drawable subscribes to, but this gets tricky from a purist standpoint, because it's hard to do this without the Drawable requiring a reference to a PlayerEntity.  My current hacky solution is to subscribe to these events from within the CreatePlayerEntity() method itself, using anonymous delegates, which can take advantage of the fact that you've still got a reference to the concrete IDrawable implementation.  It just doesn't seem right for the factory to have this responsibility, though:

public static PlayerEntity CreatePlayerEntity(...)
{
   PlayerEntity playerEntity = new PlayerEntity(...);
   SpriteDrawable spriteDrawable = new SpriteDrawable(...);
   playerEntity.Drawable = spriteDrawable;

  playerEntity.SomeEvent += new EventHandler((sender, e) => { spriteDrawable.Texture = blah; });

   ...

   return playerEntity;
}

What is a better, approved way to accomplish this communication between concrete implementations?

sentences:
Game Center: Leaderboard score inconsistencies Background

I'm currently developing a simple library that mirrors Game Center's functionalities locally. Basically, this library is a system that manages achievements and leaderboards, and optionally sync it with the Game Center. So, if the game is not GC enabled, the game will still have achievements and leaderboards (stored inside a plist). But of course, the leaderboards will then only contain the local player's scores (which is kind of useless, I know :P).

Problem

Currently I have coded both of the achievements and leaderboards subsystems. The achievements subsystem have already been tested and it works. I'm currently testing the leaderboards subsystem using multiple test user accounts. I loaded the test app on a device and on the simulator, both logged in with 2 different user accounts. Then I performed these steps:

I first used the device to upload a score.
Then, I ran the simulator, and the score submitted by the user on the device is shown. Which is cool.
Then, I used the simulator to upload a score. But on the device, still, only one score is listed.

I checked on the Game Center app (to see if the bug lies within my code), and I got the same thing. Under "All players", there is only one score on the device, but there are 2 scores on the simulator. I wanted to make sure that the simulator is not causing this, so I swapped the users on the device and the simulator, and the result is still the same. In other words, the first user is oblivious of the second user's score, but the second user can see the first user's score.

Then I tried with a third user. The result: the third user can only see the scores of the first user and himself. The second user still sees the scores of the first user and himself. The first user only sees his own score.

Now here comes the weird part. I then make the first user and the second user befriend each other. The result: under "Friends", the first user can see the second user's score, but under "All Players", the first user's score is the only one listed.

Screenshots

The first user sees this:

The second user sees this:

So, is this a normal thing when using sandboxed GC accounts? Is this behavior documented somewhere by Apple?

sentences: Unity3D - Cancel a build process (Windows, Unity 5) I accidently pressed build for iOS and just realized that it might take a few hours to build the project. I tried to kill the unity process in the task manager, but on next start up unity instantly starts to build it again. Is there any option to cancel the build?

sentences:
In regards to real time turn based games, where should the turn handler be? I'm currently developing a pool-like browser game. I'm stuck on where should I handle the turn changing, timer, etc.
Currently, turn timer (i.e. 15 seconds left to do action, then turn will change) is handled by the server. But the changing of turns itself is handled by the client (the browser itself).
Now in my current setup, whenever a player leaves window focus, the game gets out of sync. Should I migrate the turn change handling to the server instead?

sentences:
Reusing entities across screens: game data vs. object modelling I'm working on a 2D RPG. I currently have a MainWorldScreen which has a Player entity, and some MapObjects that he can collide against. The player has a few components (sprite, keyboard input) etc. that implement specific logic for it to work in the main world screen.

The problem now arises when I start working on a "battle" screen. The crux of it is, should I reuse/extend my Player entity or create one entity per screen?

Up to now, components are all behaviour based -- sprites to display something on-screen, input components to capture and expose events to handle input, etc. My entities are a composition of components that implement game logic (eg. move on keyboard click).

If I did this as "pure" object-oriented, I would probably have a larger Player class which had all the combined attributes needed for all screens -- list of equipment, health, etc. and each screen would only take what it needs.

However, since I have components, if I reuse my player entity, it doesn't make much sense to reuse it; I will have to remove and re-add new components, since screens use completely different data, and I don't really know where the player state should go (eg. equipment).

What's the right way to handle this? Should I go with one Player entity per screen (at least with these two screens)? Should I keep player state in the entity, and just add/remove components depending on the screen when I pass it from screen to screen?

sentences:
algorithm to "explode" mesh i have a simple triangle mesh which i want to explode.
so i am looking for an algorithm that makes every triangle to move outwards from the centerpoint.
is there already something premade like this?

thanks!

sentences:
How to increase update speed of game? I have a basic game, in which the player moves the environment around the screen, to give the gamer an impression that the player is actually moving.
I want this game to be large and have an open world, each piece of scenery is an object and each frame it updates the scenery to make itself move relative to the player. The trouble is with large amounts of objects this causes the game to slow down, but the objects HAVE to be updated otherwise they will become out of synch with the player. So how can I increase the performance of my game without splitting it up into tiny little levels?

Its a 2D top down game. The position of each object is updated each time, but when there are a large number of objects this takes a long time.

sentences:
Mobile Game: Google Play no supported dev country and capitalization alternatives (no policies violation or suspicious behavior)? If my country is listed as not supported as a developer country (for payments), this mean developer can upload app but no make any money with it. If I understood correctly, not even in app ads are allowed (I have my doubts about ads because It has no sense they aren't allowed).

Is there any mean, friendly with Google policies, to monetize the app?

For example:

Desktop version is free to play. Optional content requires a payment.
Mobile version is free to play. Optional content requires you to log in with same account you used to purchase it on desktop. No ads and no in-app purchase in mobile version.

Is the above scenario OK? Which are the alternatives?

Notes:

To me, no ads has no sense. After reading Developer Console documentation I assumed that ads are OK but after doing some research It turns on that many people thinks that ads are not OK.

sentences:
At this point in time, avoid XNA? XNA seemed like a valid option a few years ago, but XNA was never a real success, and now it seems like a footnote, even Microsoft seems to treat it that way.

Should I just go the DirectX route instead?

Ideally, eventually, I'd like my games to be playable on all major platforms (Windows, Linux, Mac + all consoles), but my primary focus is getting the games out the door on Windows XP, 7 and 8.

EDIT: This question and releated might already be answered here: What is the future of XNA in Windows 8 or how will managed games be developed in Windows 8?

sentences:
TileMap or Voxel collision detection I have a conceptual question:
In the case of Tile Map, each block has the information from the enemies who are going about it. But what if some of these enemies are far greater than the block?
I have to have the same element in each of the information blocks?
And updating the position must clear each block?
If I have large and small enemies, it means that each block will have a list of enemies?

Now, in the case of Voxel Map:
In Minecraft, for example, its character and most enemies x and z dimensions is smaller than one block, but its height (y) is greater than one block.
This means that these elements will record information in two blocks? and in the case of a "Gast," which is much larger?

I'm using Google Translate, so sorry if my english is very bad.
Thanks in advance.

sentences:
How can I find the distance from bezier curve anchor points to control points for a circle approximation and their positions From the image below, I have represented a circle by a closed bezier curve made of two cubic bezier segments. I am aware that a bezier curve cannot represent a perfect circle.
How can I calculate the distance from the anchor points to the control points based on the distance from both anchor points to give a close approximation of a circle?

Also how can I use the calculated distance to find the positions for the control points?

sentences:
Why is my enemy kill code not working? I'm trying to make an enemy for my game, and everything works, except for the bit of code where the enemy is supposed to die.

My player attacks but nothing happens.

I filled in the prefabs, I have the right tags, I tried remaking it and I can't find anything that is wrong.

What am I doing wrong?

#pragma strict
var EnemyItself : GameObject;
var EnemyCorpse : GameObject;

function OnTriggerEnter(other : Collider) {
    if (other.gameObject.tag == "Hero Punch") {
        EnemyItself.SetActive(false);
        EnemyCorpse.SetActive(true);
    }
}

sentences: Want to create live-voice chat between players either in unity or unreal engine I would like to create a real-time voice chat in either in unreal or unity between the players.I would like to associate and apply this voice-chat depend on username. I am saying "or" for the application because I want it to create in easiest(less programming) way. Do you know what class or script I should use? I have a limited budget so I am looking for a in-house or cheap way solution of building it.What would be the easiest way of starting this project?

sentences:
UI clicks hitting game objects below I have a canvas with a panel with set width / height inside. The canvas rendermode is set to ScreenSpace Overlay.

My clicks on the panel are falling through and hitting the game objects below triggering their mouse events.

The little green circle is a Sprite with the following event

  public void OnMouseDown() {
        Debug.Log("click");
        Vector3 newPos = Camera.main.WorldToScreenPoint (this.transform.position);
        newPos.x -= panel.GetComponent<RectTransform>().rect.width / 2.0f;
        newPos.y -= panel.GetComponent<RectTransform>().rect.height / 2.0f;

        panel.transform.position = newPos;
  }

I've been reading through the docs but I'm missing something... How do I stop my clicks hitting the game objects below the panel?

sentences:
How to fix texture edge artefacts? This issue has been annoying me for a long time now and even after reading a lot of articles about it, I am still unable to fix the issue.

First, to my setup. I'm using LWJGL for a 2D project, rendering in immediate mode (yes, I know, FBOs, but I feel like it's too late to change it now). Textures can be scaled, rotated tinted and cropped in any way and are read from packed spritesheets that are multiples of 2 (the one in question is 512x1024 for example).

The Problem

Because there is no smoothing applied to the textures, scaled and rotated textures look quite ugly, showing jagged lines and black outlines. I tried improving it with using glEnable(GL_POLYGON_SMOOTH) (even though I know now that this is apparantly a bad practice, but I have no idea how to add multisampling to immediate mode rendering, other sites even state that multisampling is probably overkill for 2D games, which leaves me even more confused). This is what it looks like, with and without POLYGON_SMOOTH:

Quite clearly, there are multiple issues visible:

With POLYGON_SMOOTH disabled, there are horribly jagged lines and dark edges (that aren't there in the texture)
With POLYGON_SMOOTH enabled, the edges are no longer jagged, but the dark edges are still there and now there are those diagonal lines. After reading up on that a bit, I found out that it has something to do with how graphics cards render quads, which is as two triangles, and when smoothing is applied, this happens. To test that out, instead of drawing a single quad I draw two triangles which indeed moves the diagonal lines around.

The dark edges seem to be caused by something like like pre-multiplied alpha (according to this), but when I check the raw pixel data, it doesn't look pre-multiplied to me. A completely white texture with 0.5f alpha for example is represented as (in ARGB) 0x80FFFFFF. So applying the "fix" (using glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA) instead of the default glBlendFunc(GL_SRC, GL_ONE_MINUS_SRC_ALPHA)suggested in the article doesn't really work, because my textures aren't premultiplied alpha, so alpha components don't work anymore (same texture, black background):

Texture without alpha:

I do use custom shaders, so I guess I probably could make alpha work in some way by passing it to the shader and then multiplying the color by it, would that fix the dark edges (which would enable me to use GL_ONE, the "better" blend function)? That would still leave me with the issue of the diagonal lines though, which I seem to be able to move around, but not remove.

sentences:
Rectangles render with gaps in between them (Box2D) 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

sentences:
Where's Anti-Aliasing in LWRP? In Unity 2019.2 -LWRP (lightweight render pipeline project) the default Game Output(Quality = High) is rendering with jaggies.

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

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

sentences:
Multiplayer game communication framework for mac/ios (Cross post from stackoverflow)

I am creating a multiplayer 2D game for Mac and iOS devices. I'll be using cocso2d for graphics/game engine, however I am largely blank on what to use for multiplayer communication. Please note that I cannot use central severs e.g. SmartFox, RedDwarf, etc since I want the players to "host" games for others and be able to play it on their LAN, VPN or my own servers.

Any pointers? I checked lidgren but it's for .NET only and hence not an option for me.

EDIT: just in case it wasn't clear, the messaging has to be real time hence it's probably going to be over UDP

sentences:
Detecting a Collision Between Two Bodies Undergoing Multiple Transformations I have been searching for an answer to this for a really long time and I have not found any definitive answers as of yet.  What I am trying to do is determine if and when two bodies collided between the times t0 and t1.  Calculating this is much more straight forward if each body is only either translating or rotating (about center or any point), but when adding multiple transformations on top of each other, things become a bit more messy.  I made this animation to illustrate the problem.

As you can see, at times t0 and t1 there are no collisions, but between there are multiple collisions occurring.

One way I thought of for tackling this problem was to reduce the size of the time intervals.  So, between t0 and t1 there would be a total of n updates to check for collisions.  This works, but the only way I found that I could guarantee no false negatives, i.e. not finding a collision that happened, was to integrate over extremely small time-steps.  As you can imagine, this is very costly because it resulted in the tens to hundreds of time-steps per body per update cycle.  I am not saying this idea has no merit (it makes calculating the collision response much easier since I know the exact points of contact), but I would need to find a way to calculate the minimum number of time-steps rather than uniformly moving each body forward one unit of distance/rotation until they reach the desired position and orientation.

So, my question is two parts:

Is there a better way of determining if and when a collision occurs?
If not, is it possible to calculate the minimum number of time-steps?

P.S.

I think the maximum translation per time-step can be the shortest distance between any two points in the body.  This would not allow it to hop over anything.  When it comes to rotation about the center or orbiting a point I do not know how to determine the minimum angle.  It probably has to do with the arc length, but what should that maximum distance be?

EDIT: this is not right. For a triangle, the base would be the shortest distance between two of its points, but the top could pass through something that is less wide than the triangle base.

sentences:
OpenGL light calculation I want to add somebasic point lights to my OpenGL application. I read here that I have to caluclate the light in a pre-projection space:

  Lighting can be done in any pre-projection space (e.g., world coordinates or eye coordinates), as long as all the objects and lights are all in that same space.

And here is my problem. My Renderer currently looks something like this:

public void onDrawFrame(GL10 unused)
{
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
    Matrix.multiplyMM(camProjection, 0, projection, 0, camera, 0);

    for(int i=0; i < sceneObjects.size(); i++)
    {
        SceneObject object = sceneObjects.get(i);
        object.draw(camProjection);
    }

    // ...
}

As you can see I multiply my projectionMatrix with the viewMatrix and I think that is a good solution because I only have to do this once. To draw I give the PVMatrix to all objects and multiply it with their modelMatrix and then I push the finall MVPMatrix to the shader. This is a problem because I can not calculate the light direction in eye space in the shader because I do not have any pre-projection matrix here. Do I really have to push a MVMatrix to the shader and calculate the normals and so on with it? I think this is really inefficient because I have to do much more matrix multiplications, isn't it? What would you suggest to calculate this efficiently?

sentences:
Best depth sorting method for a Top Down 2D game using a 3D physics engine I've spent many days googling this and still have issues with my game engine I'd like to ask about, which I haven't seen addressed before.  I think the problem is that my game is an unusual combination of a completely 2D graphical approach using XNA's SpriteBatch, and a completely 3D engine (the amazing BEPU physics engine) with rotation mostly disabled.

In essence, my question is similar to this one (the part about "faux 3D"), but the difference is that in my game, the player as well as every other creature is represented by 3D objects, and they can all jump, pick up other objects, and throw them around.

What this means is that sorting by one value, such as a Z position (how far north/south a character is on the screen) won't work, because as soon as a smaller creature jumps on top of a larger creature, or a box, and walks backwards, the moment its z value is less than that other creature, it will appear to be behind the object it is actually standing on.

I actually originally solved this problem by splitting every object in the game into physics boxes which MUST have a Y height equal to their Z depth.  I then based the depth sorting value on the object's y position (how high it is off the ground) PLUS its z position (how far north or south it is on the screen).

The problem with this approach is that it requires all moving objects in the game to be split graphically into chunks which match up with a physical box which has its y dimension equal to its z dimension.  Which is stupid.

So, I got inspired last night to rewrite with a fresh approach.  My new method is a little more complex, but I think a little more sane: every object which needs to be sorted by depth in the game exposes the interface IDepthDrawable and is added to a list owned by the DepthDrawer object.  IDepthDrawable contains:

public interface IDepthDrawable
{
    Rectangle Bounds { get; } //possibly change this to a class if struct copying of the xna Rectangle type becomes an issue
    DepthDrawShape DepthShape { get; }
    void Draw(SpriteBatch spriteBatch);
}

The Bounds Rectangle of each IDepthDrawable object represents the 2D Axis-Aligned Bounding Box it will take up when drawn to the screen.  Anything that doesn't intersect the screen will be culled at this stage and the remaining on-screen IDepthDrawables will be Bounds tested for intersections with each other.  This is where I get a little less sure of what I'm doing.  Each group of collisions will be added to a list or other collection, and each list will sort itself based on its DepthShape property, which will have access to the object-to-be-drawn's physics information.  For starting out, lets assume everything in the game is an axis aligned 3D Box shape.  Boxes are pretty easy to sort.  Something like:

if (depthShape1.Back > depthShape2.Front) //if depthShape1 is in front of depthShape2.
    //depthShape1 goes on top.
else if (depthShape1.Bottom > depthShape2.Top) //if depthShape1 is above depthShape2.
    //depthShape1 goes on top.

//if neither of these are true, depthShape2 must be in front or above.

So, by sorting draw order by several different factors from the physics engine, I believe I can get a really correct draw order.  My question is, is this a good way of going about this, or is there some tried and true, tested way which is completely different and has somehow completely eluded me on the internets?

sentences:
Photon-Unity Instantiation not working I use Unity and Photon for the multiplayer. I Instantiate my gameObjects using this method :

void LoadGameObject(PhotonPlayer player,bool isMaster)
 {
  if (isMaster)
  {
    GameObject baby = PhotonNetwork.InstantiateSceneObject(babies[0].name,
    babies[0].transform.position, Quaternion.identity, 0,null);
    baby.SetActive(true);
    Debug.Log("playerpref created on " + player.ID);
  }
  else
  {
   //Nothing for the moment
  }
}

I call the method in "OnJoinedRoom()" and "OnPhotonPlayerConnected(PhotonPlayer other)", but when the second player join the room, he can't see the gameObjects because they aren't activated on his scene.

Any Idea of the mistake ?

sentences:
UV map data structure I've received a few instructions on what kind of usage UV maps allows, and currently try to understand how it works. However, I can't figure out what kind of data there is inside a UV map.

Googling around, I found... almost nothing. Maybe this simple example. That was totally unexpected. Is it non standard, with as many possibilities as software vendors ?

Anyway, if that is the case, I'm nonetheless interesting in understanding what kind of data can be found inside an UV map save file, in order to properly complement my understanding of the process, and try to figure out what kind of post-processing would be possible.

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

xPosition += xSpeed;
yPosition += ySpeed;

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

How can I go about dealing with this?

I've tried changing the speed, such as;

  xSpeed -= 10;
  ySpeed += 10;

Any help would be greatly appreciated.

sentences:
Enemy fire does not travel to player using RayCast2D Enemies are using raycast to fire and detect player. The bullet has its own script that makes it move forward after instantiating it, but the problem is that it always moves in the right direction and does not take into account the rotation of the enemy.

Here is my enemy fire script

public class EnemyFire : MonoBehaviour {

    public GameObject ustaazPlayer;
    public GameObject enemyLaser;
    float timeToSpawnEffect = 0;
    public float effectSpawnRate = 4;
    public int damage;

    // Use this for initialization
    void Start () {
        InvokeRepeating("EnemyShoot", 0.00001f, effectSpawnRate);
    }

    void EnemyShoot()
    {
        Vector2 playerPosition = new Vector2(ustaazPlayer.transform.position.x, ustaazPlayer.transform.position.y);  //position of player
        Vector2 bossPosition = new Vector2(transform.position.x, transform.position.y); //enemy location
        RaycastHit2D hit = Physics2D.Raycast(bossPosition, playerPosition - bossPosition, 100);

        //if (Time.time >= timeToSpawnEffect)
        //{
            Instantiate(enemyLaser, transform.position, transform.rotation);
            AudioManager.instance.PlaySound("enemyLaser");
        //    timeToSpawnEffect = Time.time + 1 / effectSpawnRate;
        //}
        Debug.DrawLine(bossPosition, (playerPosition - bossPosition) * 100, Color.cyan);
        if (hit.collider != null)
        {
            Debug.DrawLine(bossPosition, hit.point, Color.red);
            //Debug.Log("We hit " + hit.collider.name + " and did " + damage + " damage.");
            Player player = hit.collider.GetComponent<Player>();
            if (player != null)
            {
                player.DamagePlayer(damage);
            }
        }
    }
}

and here is the script on the laser object

public class MoveBulletTrail : MonoBehaviour {

    public int speed = 200;

    // Update is called once per frame
    void Update () {
        transform.Translate(Vector3.right * Time.deltaTime * speed); //move it forward in the direction it was spawned
        Destroy(gameObject, 1); //destroy the trail after 1 second so that inspector does not get bogged down in them - so much easier than having a shredder!
    }
}

How would I make it shoot towards the player?

sentences:
How to find a non active gameobject in unity? I am trying to find a gameobject, which is not active in the current scene.It throws Null Reference error.

GameObject gameObject;
void start(){
//a non active gameobject tagged with InactiveTag
gameObject = GameObject.FindGameObjectWithTag("InactiveTag");
}
void update(){
if(someCondition){
gameObject.setActive(true); //this line throws Null Reference error
}
}

sentences:
Direct3D11 Depth buffer problem Encountered a strange error when using Direct3D11, feature level 10.0.

If the depth buffer texture is created with the format DXGI_FORMAT_R24G8_TYPELESS, bind flag D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE and the depth stencil view format DXGI_FORMAT_D24_UNORM_S8_UINT, everything is correct.
Also, there are no problems when the depth buffer texture format is DXGI_FORMAT_R32G8X24_TYPELESS and the depth stencil view format is DXGI_FORMAT_D32_FLOAT_S8X24_UINT.

However, when the depth buffer format is DXGI_FORMAT_R32_TYPELESS,
and the depth stencil view format is DXGI_FORMAT_D32_FLOAT, the whole geometry is not rendered at all, only the clear color is visible. I used Visual Studio 2015's Graphics Debugger to check if the geometry is rendered as desired, but during the Output Merger stage the whole geometry is discarded because it failed the depth test. Every Direct3D function call returns no error and the Direct3D debugging output reports no error (only INFO messages about creation/destruction of resources). I do not use the stencil functionality at all, and it is disabled.

I use a Windows 7 virtual machine as a developer machine and using DXGI_FORMAT_R32_TYPELESS and DXGI_FORMAT_D32_FLOAT worked flawlessly before I switched from a Windows 7 host to an Arch Linux host, because the old hard-drive started to fail and the operating system was unable to read its own files during boot. After I switched the host operating system, this problem started to occur inside the virtual machine.

Is it possible to have a bug somewhere else in my code?

Is there a limitation when using DXGI_FORMAT_D32_FLOAT and sometimes it may not be possible to use DXGI_FORMAT_D32_FLOAT or the other depth formats on every machine (considering D3D11 feature level 10.0 is available)?

Or is this a bug somewhere else, possibly in VMware player or Linux or Bumblebee (Optimus - Intel HD 4000 + GeForce GTX 650M)?

sentences:
Do game engines compile games or just interpret them I know that many game engines like Unity3d use scripting languages like c# or java script but does that mean that a game engine is just an interpreter?

If so, does that mean that if I move the executable of a game made with Unity to the folder of another game made with the same engine then the game will run fine because all the engine is doing is interpreting the code?

If not does the engine just ship with a compiler and turns scripting code into compiled code?

sentences:
Calculating interpolation percentages I've been reading valve's article on multiplayer networking repeatedly recently and everything is starting to make since. One thing I'm wondering on though however is what percentage value to use for interpolation. For example the article shows this image:

Then the following explanation is given:

  The last snapshot received on the client was at tick 344 or 10.30 seconds. The client time continues to increase based on this snapshot and the client frame rate. If a new video frame is rendered, the rendering time is the current client time 10.32 minus the view interpolation delay of 0.1 seconds. This would be 10.22 in our example and all entities and their animations are interpolated using the correct fraction between snapshot 340 and 342.

At the end of the last sentence it states to use "the correct fraction between snapshot 340 and 342". What would this fraction be? Is it the time it takes for a frame to render?...or am I way off?

sentences: Unity UI InputField does not consume the keyboard input Unity UI:  I have an input field in which I can type.  Unfortunately, when I hit any of the movement keys, such as the space bar, I move while I'm typing which is not the effect I want.  Is there a way to force the input field to consume the keyboard input so it doesn't also get picked up by the game?  Or do I have to write the code in my game to do that for me.  (Seems like it should be configurable at least).

sentences:
How to correctly specify the offset in a call to glVertexAttribPointer()? I'm trying to draw a simple triangle using the following vertices:

std::vector<VertexFormat> vertices;
vertices.push_back(VertexFormat(glm::vec3(0.25, -0.25, 0.0),
    glm::vec4(1, 0, 0, 1)));
vertices.push_back(VertexFormat(glm::vec3(-0.25, -0.25, 0.0),
    glm::vec4(0, 1, 0, 1)));
vertices.push_back(VertexFormat(glm::vec3(0.25, 0.25, 0.0),
    glm::vec4(0, 0, 1, 1)));

The corresponding Vertex format is given by the following struct:

struct VertexFormat
{
    glm::vec3 position;
    glm::vec4 color;

    VertexFormat(const glm::vec3 &iPos, const glm::vec4 &iColor)
    {
        position = iPos;
        color = iColor;
    }
};

The first call to glVertexAttribPointer() is easy since the position vector appears first in the struct, the call is as follows:

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)0)

The second call to glVertexAttribPointer() should be made specifying a suitable offset for the color attribute of a vertex. Since the color vector appears after the position, then such offset should be given by sizeof(glm::vec3). The corresponding call is:

glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)(sizeof(glm::vec3)))

The output of the program using these parameters is:

This output is wrong. There are only two colors (green and blue) and the colors are in the wrong position, note that the bottom-left vertex is blue, but according to the code the vertex should be green.

If the offset is changed to sizeof(glm::vec4) the call is:

glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)(sizeof(glm::vec4)));

And the triangle is rendered correctly

So, Is my understanding of the offset parameter wrong? Why using an offset with the size of a vec4 gives the right output?

Any help would be appreciated.

P.S. Sorry for the bad english.

Edit: After reading the answer of Fibbles, and the comments of Fuzz Logic, I checked the size of the VertexFormat struct. A sizeof() gives a size of 32 bytes for a 32 bit executable. So padding is indeed the problem here. Using the macro suggested by Fibbles solves the problem. Thanks for everything guys!

sentences:
What is the standard practice for animating motion -- move character or not move character? I've downloaded a bunch of (free) 3d warriors with animations. I've noticed for about 25% of them, the 'run' animation physically moves the character forward in the z direction. For the other 75%, the animation just loops with the characters feet moving etc., but does so in place, without changing the character's physical location.
I could fix this by:
1.) Manually updating the transform in code for this 75%, to physically move the character
2.) Alter the animation by re-recording it, with a positive z value at the end (when I did this it caused the character to shift really far away the rest of the units, probably something to do with local space vs world space I haven't figured out yet).
But before I go too far down this rabbit hole, I wonder if there is any kind of standard? In the general case, are 'run' / 'walk' animations supposed to move the character themselves, or is it up to the coder to manually update the transform while the legs move and arms swing in place? Is one approach objectively better than the other, or maybe it depends on the use case? If so, what are the drawbacks of each? I know nothing about animation, so I don't want to break convention (if there is one).

sentences:
What are some basic zoning guidelines for designing game cities? I am planning out a fictional game city. Based on the gameplay and story I have decided on several locations which will need to exist. I'm wondering though to what extent I need to take zoning into consideration when planning everything out. For example, there is an industrial area with processing plants, but there is also a residential area fairly close to this.

It is my understanding that industrial areas need to be a certain distance away from residential areas due to health concerns. This varies of course based on many factors, but I'm wondering to what extent I should be considering this when planning out the city. The game in no way requires realistic city planning, but for the sake of not making it obviously unrealistic I'm wondering if there are any rules of thumbs when planning this.

sentences:
Widget button hover event works but not click This is my first time making a widget and I'm trying to make a super simple one, just a button. However, when I attach the widget to an actor and try to press it, it doesn't register any click events but it does register hover events and responds to those.
I have my widget blueprint which looks like this:

I then have the mouse events set up like so:

In my scene I just attached a widget component to an empty actor:

And lastly I added a WidgetInteraction component to my player:

Now when I hit play and test it out, I get the hovered message but I can never get the click message when I click on the button and I'm not sure why.

sentences:
How can I switch between cinemachine free look cameras by script? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class CamerasManager : MonoBehaviour
{
    public CinemachineFreeLook[] freeLookCameras;
    public float timeBeforeSwitching;

    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(SwitchCameras(timeBeforeSwitching));
    }

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

    }

    IEnumerator SwitchCameras(float TimeBeforeSwitching)
    {
        yield return new WaitForSeconds(TimeBeforeSwitching);

        for(int i = 0; i < freeLookCameras.Length; i++)
        {
            freeLookCameras[i].en
        }
    }
}

If I have two or more cameras I want that after X seconds start switching between all the cameras in the array by disabling/enable the cameras. disable the first enable the second then disable the second enable the third and so on.

sentences:
Event Trigger for sprite not working I have set up a script to set game objects as active/inactive depending on a particular number representing the index of a gameObject array. As you can see the image below. I have two buttons as shown on the page, a backward button and a forward button. I have attached event trigger components to each of the buttons so as to turn pages forward / backward depending on which button I click

The forward button works but this is not the case with the backward button. The function is not even being called. In fact only this sprite which on being clicked does not call the function assigned to it.

More details on the backbutton :

Here is the script for the MonsterRosterManager.cs

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

public class MonsterRosterManager : MonoBehaviour
{
    int MonsterPageNo;
    public GameObject[] MonsterPages;

    void Start()
    {
        MonsterPageNo = 0;
    }

    void Update()
    {
        switch (MonsterPageNo)
        {
            case 0:
                MonsterPages[0].SetActive(true);
                MonsterPages[1].SetActive(false);
                MonsterPages[2].SetActive(false);
                break;
            case 1:
                MonsterPages[0].SetActive(false);
                MonsterPages[1].SetActive(true);
                MonsterPages[2].SetActive(false);
                break;
            case 2:
                MonsterPages[0].SetActive(false);
                MonsterPages[1].SetActive(false);
                MonsterPages[2].SetActive(true);
                break;
        }
    }

    public void PrevMonsterPage()
    {
        Debug.Log ("Monster Page No to decrement: "+MonsterPageNo);
        MonsterPageNo -= 1;
        if (MonsterPageNo == -1)
            MonsterPageNo = 0;
    }

    public void NextMonsterPage()
    {
        Debug.Log ("Monster Page No to increment: "+MonsterPageNo);
        MonsterPageNo += 1;
        if (MonsterPageNo == MonsterPages.Length)
            MonsterPageNo = MonsterPages.Length - 1;
    }
}

Furthermore, the logs below show that the NextMonsterPage() function is called on clicking the forward button, but no calls to the PrevMonsterPage() are being registered.

What am I overlooking here?

sentences: Is there an SDK to write console apps to simulate an Xbox 360 controller? Is there any SDK I can use to write a console app that can connect to an Xbox 360 as a controller and simulate controller interaction?

sentences:
Transition Player Position I'm currently working on a Java MMO with a pretty solid start, but I've come across an issue I need a little help with.

I'm working on player positions. Meaning their X/Y on the screen, if the PlayerA has a higher FPS (Frames Per Second) than other players, the resulting action will be that PlayerA will move faster than everyone else. I know the reasoning for this, it's because when the game draws I just use x++.

What would a better method be?

sentences:
D3DCompileFromFile() failed, gives an error HRESULT i'm reading the "3D game programming with directx 11 " book (Frank Luna) and i'm struggling becouse he uses the old D3DX11CompileFromFile() method, which can't be used anymore. So i searched on internet how to solve this problem and i found out i have to use D3DCompileFromFile instead, which is a little bit different, but not totally. Now this is my script

DWORD flags = D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_DEBUG;
    ID3DBlob*compiledShader = nullptr;
    ID3DBlob*compilationMsgs = nullptr;

    HRESULT hr = D3DCompileFromFile(L"FX/effects.fx", 0, 0, 0, "fx_5_0", flags, 0,  &compiledShader, &compilationMsgs);

    if (FAILED(hr))
        MessageBox(0, L"Failed D3DCompileFromFile", 0, 0);  //THIS POPS OUT

I did this by myself and than i started copying things from internet to make it work. Could the problem be in entryPoint=0? What do i have to put there?
This is the effect.fx file

cbuffer cbPerObject
{
    float4x4 gWorldViewProj;
};
struct VertexIn
{   float3 Pos : POSITION;
    float4 Color : COLOR;
};

struct VertexOut {
    float4 PosH : SV_POSITION;
    float4 Color : COLOR;
};
VertexOut VS(VertexIn vin) {
    VertexOut vout; // Transform to homogeneous clip space.
    vout.PosH = mul(float4(vin.Pos, 1.0f), gWorldViewProj); // Just pass vertex color into the pixel shader.
    vout.Color = vin.Color; return vout; }

float4 PS(VertexOut pin) : SV_Target {
    return pin.Color;
}
technique11 ColorTech {
    pass P0 {
        SetVertexShader( CompileShader( vs_5_0, VS() ) );
SetPixelShader( CompileShader( ps_5_0, PS() ) );
    }
}

float3 iPosL; // local space
float3 gEyePosW; // world space
float3 normalV; // view space
float4 posH; // homogeneous clip spac

Thanks

sentences:
Unity - Game not running on android 8 and 9 Game  is crashing with message "app has stoped" when i am opening it (it doesnt show splash screen) ,  everything is fine when I am creating new project with same unity version, build, player and sdk settings . No errors in unity and log from logcat. Any ideas??
Link to logcat log https://pastebin.com/yzvkB3Jv  (Game name is iPenkim)

sentences:
How can I find the position of a corner of a transformed sprite in SFML? I need help with calculating the end points of a stick (a sprite) in my stick game.

First, I set up it's position by some coordinate (x,y) after that I rotate it by theta degrees.

I know the width and height (427, 17), but I can't figure out how to calculate it's end points after the rotation (I need them for intersect detection algorithm).

Moreover, I can't figure out how to detect when I clicked on it with the mouse, because getGlobalbounds.contains(mouse) gives me its bounding box, but I want to detect that I was clicked exactly on the entity..

sentences:
Minimum Hardware for iPhone Dev So I'm planning to get into iPhone dev (2D games). I understand that my only real option is to get a Mac. I'll probably go the MonoTouch route.

I'm not sure what hardware to buy; I just want the minimum that'll be "good enough" to develop with. Some posts recommend a Mac Mini, although it seems on the more expensive side; even on the iPhone front, I'm not sure what to look for.

Also, I may skip on the iPhone until I'm ready to launch my first game, since I can get away with the MonoTouch evaluation version. (Albeit that it's probably not the best idea.)

sentences:
Assimp, Blender and model rotating There is something I can't figure out.

I have two models - grass.blend and tower.blend.

grass.blend:

tower.blend:

Note X, Y and Z axises.

The problem is that when I load these models using Assimp the scene looks like this:

The tower should be placed vertically, but for some reason it is placed horizontally. I didn't rotate it this way. Why is it happening?

Project example is here (tower was rotated in Blender right way for now). Tower model could be downloaded from blendswap.com.

sentences: How can I find the reflection of a point in a perpendicular line? From the image below I know the positions A and B. How can I find positions C and D and the reflection (Er) of an object E in the line CD? I saw the solution in How can I reflect a point about a line in Unity? but I don't understand it enough to apply it in my case. Please note that I'm trying to achieve this in 2D.

sentences:
GL ES: Fragment shader optimization Summary:
I get FPS slowdown as soon as I try to tint the sprites (i.e: multiply texture with color in the fragment shader)

Details:

Hardware: iPod touch 4

I am drawing 700 sprites on the screen using glDrawArrays. And yes I am batching all of these in a single draw call. Following shows Vertex data structure:

struct Vertex {
    float Position[2];
    float Color[4];
    float Texture[2];
};

Yes I am sending colour with each vertex because I selectively need to tint some sprites but not others. Following is the fragment shader I am using:

varying lowp vec2 TexCoord;
uniform sampler2D TextureSampler;

void main(void)
{
    gl_FragColor = texture2D( TextureSampler, TexCoord );
}

Till now it is working GREAT, giving me full 60 FPS !!!

BUT

As soon as I change the fragment shader to the following (to allowing tinting):

varying lowp vec4 DestinationColor;
varying lowp vec2 TexCoord;
uniform sampler2D TextureSampler;

void main(void)
{
    gl_FragColor = texture2D( TextureSampler, TexCoord ) * DestinationColor;
}

Using following 64x64 png texture containing alpha channel, rendering with glEnable(GL_BLEND):

The performance drops to 47 FPS only due to this single change {just by multiplication with ONE vector} (FPS measured using xcode instruments and OpenGL detective). Any ideas what is going on ?

Thanks.

Edit:

I've also tried stripping off per vertex color attribute:

struct Vertex {
    float Position[2];
    float Texture[2];
};

And modifying the fragment shader as follows:

precision lowp float;
varying lowp vec2 TexCoord;
uniform sampler2D TextureSampler;

void main(void)
{
    gl_FragColor = texture2D( TextureSampler, TexCoord ) * vec4(1.0,0.0,0.0,1.0);
}

It is running at 52 FPS for 700 sprites (a gain of only 5 FPS). So this is not interpolation, seems like the multiplication is extremely expensive. Just this ONE multiplication?

sentences:
360 degree viewer for AR I want to implement a 360-degree viewer for Augmented-Reality in Unity. Augmented-Reality means in this case, that I want to place an image like an interface mockup in my viewer which has transparency. The transparency is getting filled with the real world. So the real world part is working without problems, but that is also the reason, why a sky box is not possible since the sky box would block that.

So I already had 2 approaches:

A sphere with a shader which rendered only the inside (turned the
normals), worked on my MAC, but didn't render anything on my vr/ar
device (Samsung GearVR)... Here a picture how it should look like and does look like in the Unity Editor. But nothing of this "crosshair" is showing up on the GearVR

A sphere or cylinder where I turned the normals beforehand in
Blender, didn't apply the texture correctly and didn't show anything
in Unity and on Device except a blank color.

sentences:
Pathfinding: Tile-Based Navigation Mesh I'm developing a real time, tile-based RTS. This is an example map:

This map consists of 4 regions with 256 tiles each. Blue tiles represent obstacles. Units can move in the standard eight directions. Units are bound to tiles; one tile can hold one unit.

These are some examples of the ideal paths I'm looking for. Typical A* stuff:

My question is: Is a navigation mesh applicable to a tile-based RTS? I've only seen navigation maps used in games where units are free-moving and not bound to a grid of tiles. What would the navigation mesh look like on this particular map? An example image would be excellent.

sentences:
Bullet Physics: Difference between Motion State and World Transform In Bullet Physics, when I create a new btRigidBody, one of the parameters passed to the constructor is the btMotionState, which defines the initial pose of the body. However, if I then later want to change the pose of the body manually (for example, if it is a kinematic body), how can I do this?

What I have tried so far, is to use the body's setWorldTransform() function. For example:

glm::mat4 pose;
pose[3][0] = 0.5;
pose[3][1] = 2.0;
pose[3][2] = 1.0;
btTransform new_transform;
new_transform.setFromOpenGLMatrix((float*)&pose[0]);
my_body->setWorldTransform(new_transform);

However, when I then try to read the pose of the object again:

btTransform trans = my_body->getWorldTransform();
std::cout << "Y = " << trans.getOrigin().getY() << std::endl;

It returns the value set in the body's constructor, not the value set in setWorldTransform().

Please can somebody explain the different between the motion state, and the world transform, and how I should go about manually updating the pose of a kinematic object?

sentences:
How to read rendered textures back without killing performance I have an application where I need to render some OpenGL based dlls, read the rendered textures back, and send them to another directx based application that will render them in directx.

Right now, I am rendering them using FBOs, reading them back, and then sending the data across the network.  However, the "reading them back" step is killing the performance.

My basic loop is as follows:

while(true)
   ... render 5 to 10 textures ...
   foreach( texture in renderedTextures )
      bind texture
      glGetTexImage( data )
      push data onto a queue to send asyncronously

Commenting out the glGetTextImage call causes performance to improve drastically.  What techniques can I use to read the data back faster?

sentences:
Pros & Cons on different game engines I've been working with the XNA-Framework(only in 2D) for over a year now. Now I want to try and start a bigger 3D-project. But somehow I have difficulties to decide which engine/Framework I should use. So far I gathered three possible Frameworks, I want to list here:

XNA with the OX-engine: I already have some experience with XNA and the Ox-engine seems to be the best possible open source engine I could use here.
OGRE-engine: Always wanted to get a little deeper into C++ and the engine seems to be well documented.
Cryengine/Sandbox 2 or higher: Well this one also needs C++ knowledge, seems to be user friendly and lets face it one of the most powerful engines out there.

My goals are to start learning 3D-programming and to realize first 3D projects by taking baby steps.

So the question is what engine would you guys recommend? Is there any other stuff I have overseen? as mentioned before getting a little more into C++ would be great to but it is not a "must have" as I alredy worked with C/C#. Most important to me would be that I could lear stuff that I can use later on for example in other Frameworks. This is important to me because I want to get deep into one thing I will be doing for a long time.

Thanks in advance!

sentences:
Unity How does Time.smoothDeltaTime work I can't seem to find any actual information on what Time.smoothDeltaTime does or how it works.

I would assume it takes a rolling average of previous deltaTimes but how does it do that? Is the average asymptotic? How sensitive is it to outliers? What is it's actual intended use case?

If anyone could explain how it works, or link to a resource on what it is doing it would be really helpful.

sentences:
Libgdx: api fadein() and fadeout() methods are switched? I've been trying to create a white-screen fade effect for my libgdx game.

When I run the following code with fadeOut = false, nothing happens (white-screen does not appear because alpha is 0). When fadeOut = true, it works (fades out) until the actors alpha is down to 0.5f, then it rebounds and starts fading in. No clue why.

    if(fadeOut){
        map.setColor(new Color(1, 1, 1, 1));
        addAction(Actions.fadeOut(duration));
    }else{
        map.setColor(new Color(1, 1, 1, 0));
        addAction(Actions.fadeIn(duration));
    }

When I run the exact same code but switch the starting alpha's like this:

if(fadeOut){
        map.setColor(new Color(1, 1, 1, 0)); //notice this is 0 now
        addAction(Actions.fadeOut(duration));
    }else{
        map.setColor(new Color(1, 1, 1, 1)); // notice this is 1 now
        addAction(Actions.fadeIn(duration));
    }

When I run this code with fadeOut = false, nothing happens (screen is all white though, because starting alpha is 1). When fadeOut = true, it actually fades in. sigh...

Here's the draw method i'm running, but I doubt there's an issue there.

@Override
public void draw(Batch batch, float parentAlpha){
    batch.draw(texture, 0, 0);

    //Get the current color of the actor
    batch.setColor(getColor());

    act(Gdx.graphics.getDeltaTime());

}

I really don't know why this is happening, any insight would be valuable.

Thanks!

Edit:
Here's the full code I'm using to call the fades:

I have a "StartScreen" object that gets initialized (and contains the stage), and this piece of code is in it's constructor:

fade = new Fade((int)GdxGame.getWidth(), (int)GdxGame.getWidth(), Color.WHITE, fadeOut, duration);
stage.addActor(fade);

In the same StartScreen class, I have the following code to draw the stage:

@Override
public void render() {
    super.render();
    stage.draw();
}//end render

The following code then calls the "Fade" objects constructor which has the code mentioned above:

public Fade(int width, int height, Color color, boolean fadeOut, float duration){

    this.fadeIn = fadeOut;
    this.duration = duration;

    Pixmap map = new Pixmap(width, height, Pixmap.Format.RGBA8888);

    if(fadeOut){
        map.setColor(new Color(1, 1, 1, 1));
        addAction(Actions.fadeOut(duration));
    }else{
        map.setColor(new Color(1, 1, 1, 0));
        addAction(Actions.fadeIn(duration));
    }

    map.fillRectangle(0, 0, width, height);

    texture = new Texture(map);

    map.dispose();
}

Update: Changing the alpha with this line:

map.setColor(new Color(1, 1, 1, alpha)); to 0.2f or 0.7f works fine. Though that's because it's changing the alpha of the pixmap (and later becomes the texture)- which leads me into investigation of whether fadeOut or fadeIn change the texture's alpha or something else...

sentences:
How does condition 5 of the Open Font License apply to using a font in my game/engine? For my game-engine I have created an debug-console I use for more complex operations and tests, logging, etc.

When looking for a good & clean font I considered using Google Fonts. Many if not all fonts on there are licensed under the Open Font License1, which seems to be the real deal.

Yet when reading the license I got confused if condition 5 also applies to videogames/engines:

  5) The Font Software, modified or unmodified, in part or in whole,
  must be distributed entirely under this license, and must not be
  distributed under any other license. The requirement for fonts to
  remain under this license does not apply to any document created
  using the Font Software.

emphasis mine

So, how does this condition translate to me using it for my engine/game? And how would I go about properly attributing?

1Link to the license definition: http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL

sentences:
How to handle equipment on a 3D animated character Im working on a 3D engine in Java using OpenGL. Animated models are set up and working by transforming vertices based on joint weights in the vertex shader, i think this is common practice.

I am now trying to figure out how to manage equipment that can be worn or carried by a character, like armor and weapons. How is this commonly done, or whats the best way to do it?

Im imagining that you make some sort of attachment point for weapons on the character model, but since that all happens in the vertex shader, how do you go about that? Would you "intercept" the joint transformations and render the weapon independently? Also, how do you find out what the attachment point for the weapon is? Im using a collada file loader to parse .dae files for models and animations, can you somehow "index" bones with special attributes in Blender/other 3D programs?

And for armor: Since armor has to not just move with the character but also stretch and deform with him, do you somehow merge the models, or overlap them?

Im really in the dark about the practices for this but i can't find anything comprehensive on the internet that explains it.

sentences: Analyzing movement data for a checkerboard For a psychology experiment - subject has to learn that the 2D grid is a checkerboard, and collect all the 1s (rewards). How do I test if subjects are actually doing it in the most optimal way -- making least effort for moving from one square to the next by taking smaller steps (or selecting closest reward neighbour). My guess is that if I could simulate a learning algorithm and approximate how long it takes to learn the reward distribution, and then explore it optimally (optimality is defined as a unit of time and exploring closest squares first), I could compare the behaviour.

sentences:
Why does this work? - camera rotation from screen space I do not understand the math behind the linked function or why it works. I would like to know this.

https://sidvind.com/wiki/Yaw,_pitch,_roll_camera

void Camera::motion(int x,int y){
        theta+= x / 200;        /* Adjust this to control the sensitivity */
        phi+= y / 200;

        target.x = cos(theta) * sin(phi);
        target.y = cos(phi);
        target.z = sin(theta) * sin(phi);
}

sentences:
Does the order of vertex buffer data when rendering indexed primitives matter? I'm building a 3d object's triangles. If I can write them to the buffer in the order they are calculated it will simplify the CPU code. The vertices for the triangles will not be contiguous.

Is there any performance penalty for writing them out of order?

sentences:
How are profiling- and tracing -techniques used in Game Development? I feel that in order to create realistic real-life games, game developers need some ways to monitor the system itself i.e. players' moves, other events and the state of the system itself. I know that creation of profiling/tracing -systems is not that easy, look how many people have tried to do better coverage -program in Python and fell far away from the original coverage.py.

I may be associating profiling/tracing wrongly to this game-development phase of dynamic monitoring but I am interested to know where/how profiling and tracing -techniques such as pythonic sys.settrace() are used in game development?
What is their purpose and what are the dynamic event monitoring systems really called? Game engines?
Are there some ready systems to advance/investigate profiling/tracing -areas in game development?

sentences:
Can i make a Game for play store on my own I am not sure what i am asking for. Sorry if this question look stupid.

I love to play games on android and pc . Some times very cool  ideas strike me , but i don't know what to do with them. and they vanish over time.

I got no computer science background , since i am a math student . Although i learned C++ for a week for a exam. In short I know C++ but just the alphabets.

Is it possible that i can learn to make games. What should i have to learn.
Is it possible to learn from youtube. Since it's like side hobby i can give it few hours a day ( not money ).

sentences:
How to add a movieclip to the stage then make it move down? I am making a game where i want to spawn zombies then make them move down the screen. I also want to have multiple on the screen at once. I have tried multiple ways now but none of them have worked.

Here is my code

if ((zombie == 1)||(zombie == 3)||(zombie == 5)||(zombie == 7))
{
    var Z = new Z;
    Z.x = 403.25;
    Z.y = -86.9;
    Z.rotation = 90;
    addChild(Z)
    zombie += 1;
}

//Functions
function startzombie(event)
{
    trace("start zombies")
    zombie = 1;
    addEventListener(Event.ENTER_FRAME,zombiemove)
}
function zombiemove(event:Event)
{
    Z.y += 1;
}

Z is the zombie

sentences:
How to make an object destructible? I have some 3d models that I have downloaded from Unity asset store. Most of the time, these objects are not "separatable" so I can't apply a destructible effect.

Is there a way to separate a model into small pieces, whether by using Blender, or a Unity script, or something else?

sentences:
LibGDX Stage and Viewport management for Actors? So I've done research about how to use Stage, Actor and Viewports etc. To optimize the game for most devices running Android. I'm pretty sure that the viewport is configured or the background image is just being drawn over the screen without actually using the viewport. That is fine though. So I'm basically telling the viewport to draw an image over the whole screen and it seems that that applies to actors also. So I guess the viewport is trying to draw the actor over the whole screen.

When testing the app on emulators with different screen sizes the actor is not resized (probably because of the viewport setting), but how can I get the actor to resize so that the actor fits in the world? The world will be the whole screen of the device.

Do I need to use two viewports where one is for UI (background so far) and another for the game? If I need to do that wouldn't the UI viewport need to be the screen size and the Game viewport holding the world size would have size constants? If so, then I don't have the whole screen size as the world, but drawing the Game viewport using the screen width and height would probably result in drawing the actor over the whole screen again, right?

And I've seen in some tutorials that they often set a constant unit of the world width and world height. Wouldn't that fail to fit all devices since they have a specific constant for width and height?

I want all of my Actors to be resized so that they fit inside the world (screen size).

UPDATE TO CLARIFY MY QUESTION

As you see the background is scaled up and down due to being drawn as the width and height of the screen, I guess, but I need the actors to also be scaled up or down. The actors can't remain the same size for all screens.

MyGdxGame

public class MyGdxGame extends ApplicationAdapter {

private OrthographicCamera camera;
private Stage stage;
private Viewport viewport;
private Texture textureBackground;

@Override
public void create () {
    camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);

    final float GAME_WORLD_WIDTH = Gdx.graphics.getWidth();
    final float GAME_WORLD_HEIGHT = Gdx.graphics.getHeight();
    viewport = new FitViewport(GAME_WORLD_WIDTH, GAME_WORLD_HEIGHT, camera);

    stage = new Stage(viewport);
    MyActor actor = new MyActor(new Texture("badlogic.jpg"));
    actor.setPosition(0, 0);
    stage.addActor(actor);
    stage.getViewport().apply();
    Gdx.input.setInputProcessor(stage);

    textureBackground = new Texture("TheWorld.png");
}

@Override
public void resize(int width, int height) {
    stage.getViewport().update(width, height);
    stage.getCamera().position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);
}

@Override
public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.getBatch().setProjectionMatrix(stage.getCamera().combined);
    stage.getCamera().update();

    stage.getBatch().begin();
    stage.getBatch().draw(textureBackground, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    stage.getBatch().end();

    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
}
}

MyActor

package com.mygdx.game;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.scenes.scene2d.Actor;

public class MyActor extends Actor {

    private Texture texture;
    public MyActor(Texture texture) {
        this.texture = texture;
    }

    @Override
    public void draw(Batch batch, float parentAlpha) {
        batch.draw(texture, getX(), getY());
    }
}

Images:

Research links:

Using two viewports for UI and Game

Viewports and World units

LibGDX Viewport Tutorial

sentences:
Scale a normalized 2D vector always to the same length For any normalized 2D vector, except for ( 0, 0 ), how would I scale the vector to always be the same length?

For example:

int length = 10;

vector v = vector( 0.1, 0.5 );
vector v2 = vector( 0.3, 0.8 );

// Scale v to be length of 10
// Scale v2 to be length of 10

sentences:
Can we measure the distance between and AR marker and camera? I'm in the middle of developing a game in Augmented Reality using Unity and ARToolkit plugin. I wanted to measure the approximate distance between the AR marker and the position of camera.
Can anyone help me with a solution to this problem?
Thanks in advance.

sentences:
Hide/move the Particle Effect panel on the Scene view window The problem for example is if I want to drag the particle system object to the bottom-right corner of my view, then it goes behind the Particle Effect panel.
Is there any way to do hide or move this panel in editor mode and/or in runtime mode?

sentences:
Output pixel to different position from pixel shader? Is it possible to output a pixel processed by my pixel shader to a different position?

For example if SV_POSITION of the pixel is 14,26, can I change it to 14,27?

I see there are only two possible output semantics, COLOR and DEPTH, so I am guessing the answer is not directly.

But are there alternative techniques, workarounds for achieving this?

sentences:
Unity is losing track of changes to Resources I have a Unity project, where I recently changed the names of a few files in my Resources folder.  This is relevant because I have code that looks like this:

        internal void LoadItems(string[] names)
        {
            var items = Resources.LoadAll<TileBase>("Tiles\\Items");
            var itemMap = items.ToDictionary(m => m.name.ToUpperInvariant());
            _items.Clear();
            _items.AddRange(names.Select(n => itemMap[n.ToUpperInvariant()]));
        }

The AddRange call is currently throwing an exception, because the incoming data is expecting the new names to be present, but itemMap for some reason still contains the old names.  I've verified this in the debugger, and I've verified in Unity's file search that no file matching the old version of the name that's causing trouble here exists anywhere in the project anymore.  And yet, when I run the project, (using the Attach To Unity And Run option from Visual Studio,) the old names still show up.

If I go into Build Settings and tell it to rebuild the project, this code works correctly... once.  Subsequent runs cause it to fail, going back to the old names again, so it kind of feels like Unity is actively trolling me at this point.

The old data has to be cached somewhere, but I'm not sure where or how to fix it.  Anyone know how I can resolve this?

sentences:
What is the "MSN Game API"? The other day I herd this "MSN Game API" mentioned, but I can not find any information about it anywhere. This particular API seems to be for browser based games (Such as Flash, and ActiveX embedded games).

What exactly is this API for? And is that its correct name? is it to do with the MSN Zone? Where can I find more information about it, and maybe even some documentation on the actual API.

sentences:
Are any scripting languages designed to be reloaded at runtime? I'm currently working on my first game engine. So far, I have a cross-platform rendering framework and support for numerous file types, but game development is still a hard slog when I'm having to wait for resources to reload and then follow the game flow to the point I need to test.

Ideally, I'd like to be able to develop the game while it's running, through a scripting language that could be reloaded at runtime without compromising the game's state.

However, my biggest problem with this plan has been with pointers-to-functions appearing in the state. Whenever a script gets reloaded, these pointers either point to an old copy of the bytecode, or worse, if the old bytecode gets garbage-collected, they end up dangling!

I've found this in two of the most common (and appealing) scripting languages - Python and Lua, and I know that Javascript is similarly capable of this same issue. All the cases I've tested have been JIT-compiled - I've thought about running interpreted-only, but I've been worried about the performance hit. I've also considered trying a stateless language, but I like object-oriented syntax, especially if my game actors in the script are going to mirror entities in the renderer.

So my question is, is there any scripting language that gives me the best of all worlds? A scripting language with OO syntax that's designed to be reloaded at runtime, or at least limits the ability for pointers-to-code to get stored in the runtime state?

Right now, my best option looks like taking a batteries-not-included scripting engine, like TinyPy, and modifying it myself!!!

EDIT:

In one last vain appeal, I'm going to try a slightly different question...

Does anyone know of any scripting languages that DON'T treat functions as first-class objects???

sentences:
Where can I find sales figures for PSN Minis? I work for a small game studio that develops games for iOS and Android currently. The engine we are building will be portable and our upcoming game is quite ambitious. Therefore we are considering porting it to PSP also, making it available at the PSN as a mini. I have been searching for days now but I am having trouble finding any numbers of what an average PSN mini game can sell. What a hit or a bad game could sell is also really interesting.
As we are trying to calculate if it is worth going into this market any clue would be helpful!

sentences:
Recommended polycount for a MMORPG character "How much polygons is too many for a MMORPG character?"

I did some research and found a few discussions about the matter. But the answers I found was mostly "Polygons has nothing to do with networking" and they just start to argue and flame each other.

I think the question wasn't received well because it wasn't clear. So, I'll try to make it a bit clearer.

Consider the main character of an offline game, it has so much details, but it is the only character on the scene for most of the time.

Now, on a MMORPG everyone is a main character. Let us say 100 players are in sight of each other at a given time. If we had the same character from the offline game we'd have too many polygons and frame-rate/performance would suffer.

If I target a minimum system requirement of 4GB memory, Intel i3 (3rd gen) CPU, and at-least a laptop GPU (cheap nvidia mobile?).

How much polygon should my characters be limited to?
or, How much polygons should be on the scene/sight at a time? (including terrain, other objects...)
or, Is there a rule of thumb for polycount that applies to any genre of games?

sentences:
how to sync clients and local avoidance in mobile RTS game? I have been making mobile RTS game in Unity look like Clash Royale similarly.

Unfortunately, I faced to two big problems.

First is two phones(clients) to be synchronized each other in game state.
And second is "path finding" or "local avoidance"(collision check).

To solve the path finding issue, I have searched about "Flow Field".

Should I do consider on 3 layer map(cost field, integration field, flow field) to apply "Flow field"?
If I do apply "flow field" to my game, can I have a liberty from the problem of Sync two clients?

Thank you in advance.

sentences:
How to handle complex input In my Libgdx project i need to handle several types of inputs.

In particular these input events are needed in order to interact with the Actors that the user puts in the Stage.

The possible interactions are:

1) Drag And Drop with DragAndDrop class.

2) Rotate the Actor (90 degrees clockwise each time)

3) Remove the Actor

I thought that i could rotate the Actor with a simple click (touchDown), and remove the Actor with double tap, but this strategy gives rise to some issues.

1) When the user does double tap on the Actor, before the Actors gets removed it rotates 2 times.

2) If the user wants to drag and drop the Actor, when he clicks on the Actor it rotates.

Then, i thought that i could rotate the Actor in the touchUp method, only if the current position of the Actor is the same as before in order to avoid to rotate the Actor when the user just want to move it.

This gives rise to another problem. In order to detect the double tap, i need to implement GestureListener interface that does not have the touchUp method!

I could remove the actor when the user does long press on it, but this will be a game that will require fast interaction.

So.. i need your help, any kind of help, thank you very much!

sentences:
My texture is doing weird, either not loaded correctly or not rendered correctly. DirectX11 I'm loading a texture from a file called owl.png. But it renders really weird.

Original picture(512 X 512):

But it renders like this:

It's rendered on a square, that is initialized like this:

 { XMFLOAT4(-0.5f, -0.5f, 0, 0), XMFLOAT2(0,1) },
 { XMFLOAT4(-0.5f,  0.5f, 0, 0),XMFLOAT2(0,0) },
 { XMFLOAT4(0.5f,  0.5f, 0, 0), XMFLOAT2(1,0) },
 { XMFLOAT4(0.5f,  -0.5f, 0, 0), XMFLOAT2(1, 1) }

Where the XMFLOAT2 are the tex coords.
It's loaded like this:

ID3D11ShaderResourceView* m_texture;
DirectX::CreateWICTextureFromFile(device, fileName, 0, &m_texture);

My samplerDesc looks like this:

samplerDesc.Filter = D3D11_FILTER_ANISOTROPIC;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.MaxAnisotropy = 4;

And I use the normal sample method in my PS.

What did I do wrong?

sentences:
In Box2D, what exactly does a fixture represent? In Box2dWeb, when we create a body we attach a fixture to the body object.
We make the shape, friction, restitution and so on by tinkering with the fixture object.

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

sentences:
How to receive broadcast message in Unity? I am trying to get the broadcasted message in overridden method of NetworkDiscovery.OnReceivedBroadcast(). For that what I had done is below:

I create class which implements NetworkDiscovery where I override the method OnReceivedBroadcast() to capture the broadcast messages.
In Unity Editor, I created an empty GameObject where I add the class in step #1 as component.

Now in code, I started the custom NetworkDiscovery class as below:

Discovery.Initialize();
Discovery.StartAsClient();

Now, when I start the broadcast in server, I am not receiving any broadcast message in OnReceivedBroadcast().

Below is my custom NetworkDiscovery class.

public class CustomNetworkDiscovery : NetworkDiscovery
{

// Use this for initialization
void Start()
{

}

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

}

public override void OnReceivedBroadcast(string fromAddress, string data)
{
    base.OnReceivedBroadcast(fromAddress, data);
}
}

One thing I noted is, If I use the NetworkDiscovery component directly in step #2; instead of using custom NetworkDiscovery class. I am able to see broadcast messages in it's default GUI.

How can I receive the broadcast message in the inherited class?

Any help will be appreciated.
Thanks.

sentences: How does pixeljunk shooter simulate its liquids? I am really impressed by the liquids in pixeljunk shooter. I would love to know how they do it.

sentences:
Maintain proper symbol order when applying an armature in flash I am trying to animate a character's leg in flash CS 5.5 for a game I am working on. I decided to use the bone tool because it's awesome. The problem I am having, however, is that for my character to be animated properly, the symbols that make up his leg (upper leg, lower leg, and shoe) need to be on top of each other in a specific way (otherwise the shoe looks like its next to the leg, etc). Applying the bones results in the following problem: the first symbol I apply it to is placed in the rear on the armature layer, the next on top of it, and so on, until the final symbol is already on top. I need them to be in the opposite order, but arrange > send to back does nothing on the armature layer. How can I fix this?

tl;dr: The bone tool is not maintaining the stacking order of my objects, please help.

Thanks for helping :).

sentences:
SDL.NET no longer detecting modifier keys I'm using SDL.NET with C#.
Recently, a bug has appeared where the library does not detect if the shift key is held down; although it used to do so.

private static void KeyboardEventHandler(object sender, KeyboardEventArgs args)
    {
            case (Key.Comma):

                if (args.Mod == ModifierKeys.LeftShift || args.Mod == ModifierKeys.RightShift || args.Mod == ModifierKeys.ShiftKeys) { actionBuffer = GameAction.MoveU; Console.WriteLine("Going up..."); }
                else { actionBuffer = GameAction.Pickup; }
                break;

            case (Key.Period):
                if (args.Mod == ModifierKeys.LeftShift || args.Mod == ModifierKeys.RightShift || args.Mod == ModifierKeys.ShiftKeys) { actionBuffer = GameAction.MoveD; Console.WriteLine("Going down..."); }
                else { actionBuffer = GameAction.Wait; }
                break;

            default:
                actionBuffer = GameAction.Null;
                break;
        }
    }

However, recently, the checks to see if a shift key is held have returned incorrectly false, despite previously previously evaluating to true.

This means the function never returns the "MoveU" or "MoveD" values, just the "Pickup" and "Wait" values.
Why is this?
Thanks in advance.

sentences:
Collision detection between axis-aligned bounding box and bitmap (pixel perfect) terrain Working on a Worms-type game, I have my objects in bounding boxes and they sit on the pixel terrain.

Currently I am able to successfully do the collision detection for objects when they enter the game by checking the middle-bottom pixel of the bounding box, if it is solid, reduce the x and y velocity to 0, other wise keep moving down at a value of gravity.

The trouble comes in when I start to move the "player sprites" as they can walk into walls and I'm not sure how to approach how to detect collision if moving into pixels, and finally how to resolve these collisions.

I need to be able to detect solid walls I cannot pass, and gradient hills where the player should "walk up".

Could you help point me in a way to do this or how it has been done in the past?

sentences:
How to distort graphics in a wave-like way? I saw a certain graphics distortion effect on multiple games over time and am interested in doing it in 2D. It is like a wave-like texture distortion, I am not entirely sure what it is called actually. Super Mario 64 had an effect like that when you enter a painting depending on your position (https://www.youtube.com/watch?v=H6r5oF73gNI#t=72), also Braid has one which is even more similar to that what I am trying to achieve when you use the time ring (https://www.youtube.com/watch?v=uqtSKkyJgFM#t=38).

I would really like to know how those effects were implement and if there is support for something like that in LWJGL (or even Slick2D). So far, I found absolutely nothing explaining on how it was done.

sentences:
How to achieve single animation for different charcters? I've been playing a game called Marvel Contesnt of Champions for android. In that game two opponent fights with each other in most 2D view but the game is developed in 3D. Each character has their own special move which dynamically interacts with opponent. So how does they achieve single animation for different characters?

By single animation I mean, for example, I'm playing with X character and he uses his special move on Y character and in that animation X character grabs character Y's neck and smashes him on the ground. Now, I'm fighting Z character with X character and in the special move he smashes Z character same way he smashed Y character. Is it like a common skeletal movements that are just changing their clothes(textures) ?

I'm pretty sure it's not pre-animated thing cause there are like more than 50 characters. I'm currently working in Blender and getting my character design right but this question was bugging me for a while and I thought there could be no better place other than here to clarify my confusion.

sentences:
Unity3D position of 2D objects with size of Object I'm making a 2D project in Unity3D.
I want to place an image in the right upper corner.
I've got this working, but ofcourse the image is falling of the screen for a part (and completely when I change the screenrotation).

This is the code I've got for it;

posImage = new Vector2(Screen.width - imgGear.transform.localScale.x, Screen.height - imgGear.transform.lossyScale.y );

As you can see in the code I've tried to adapt the position with the size of the object, using localScale 1.0f and lossyscale 0.9...f doesn't really do much as it will be changed with 1 unit.
Is their a way to get the real width and height of the objects?

sentences:
Independent Arcade Game Development So I've been looking around, but it seems that information on this is scarce.

If one wants to develop an arcade game (as in, coin operated), ignoring the software side, where does one start on the hardware side?

I mean, is there some kind of company that sells arcade systems with some kind of spec for you to develop things on, etc?

I suppose this question is asking a lot more about the entrepreneurial side of stuff, but it's probably still related to game development..

sentences:
How do you time jump animation with uneven landing surface? Say my player jumps off from a certain point on a 2D surface. Say my surface is uneven, and has varying y positions along the level, how would I then be able to time my jump animation accordingly?
(The issue being is that the animation might get cut off half way through, or vice versa - the animation would be already finished while the player is still jumping/landing)

sentences:
Move object along world X/Z axes taking account it's own rotation I have a camera 9 units up, tilted down at a 60° angle (rotated around it's X-Axis), which means forward for the camera is pointed down at the floor as shown in the picture below

Now when I press W, i want the camera to move horizontally forward without changing it's Y coordinate, but not along the world Z axis, as that breaks when the camera is rotated around it's Y axis. Here are a few images demonstrating what I want
Side view:

Top view:

sentences:
How do I implement real-time mesh deformation, with regards to environmental damage? I would like to be able to add the following feature to my tech demo: at the moment bullets hit the walls, little pieces fly out of them, as well as decals appearing on the walls. Computing power is good enough, now, so that many games have destructible environments.

I would like bullets to shatter small surface segments off the wall, ideally the segments that fly off would directly relate to the hole that is left, though I don't even know if this is how it's done in commercial games.

How is this done? Are there simply a number of different meshes that are swapped out as, and when, objects are hit? I assumed that this would not be an accurate enough solution. Is real-time mesh deformation feasible. and if so, how is it done?

sentences:
RPG game engine. Skill application calculations Short preface
I am a part of a small team which is entering game development. We're creating a new RPG setting with custom game system and mechanics based on dice rolls. I'm server-side java programmer, so the game engine is my responsibility.
The problem
I have a problem designing talent classes. Each character may have a set of talents. The problem is, most talents are unique and different from others. For example:
Talent Season fever gives character a stat bonus depending on the season of the year, e.g. strength +2 in Winter, dexterity +2 in Spring, etc. Which gives player an opportunity to add and swap talents because of changed stats four times a year.
Talent Fortune Wheel allows a player to roll d6 each morning and get a bonus on one of the six stats (strength, dexterity, etc.) for that day.
Talent Attuned to partner gives a player +2 on his hit roll if his character has exactly one partner in the battle. If his partner also has this talent, both of them get +4 instead.
As you see mechanics of each talent are different. Question is how to universally implement all this different functionalities in Java classes.
Some technical details
I use latest version of JDK 7.
Springframework stack (spring-data, spring-mvc, spring-security, etc.)
MongoDB for persistent storage.
My ideas
The solution I came up with:

Create a parent Talent class with generic fields and methods, like
id, name, description, requirements to obtain, etc. and an abstract apply() method.
For each talent in the game extend Talent class and add custom logic by implementing the apply() method.
I also need some trigger mechanism (I don't really know how it would look, so please advise if you have ideas). For example, if character has some talent which gives him bonus to a melee attack in some situations (preconditions) the trigger would fire on each event of melee attack made by the player, when the trigger fires it also checks if preconditions are met and if they are it calls the apply() method of a talent.
I have to implement scheduling for triggering or processing talents which depend on times or periods like the Season fever talent described above.

Disclaimer
I have really small experience of asking questions on stack-exchange, so feel free to point out suggestions on question format and additional info required. Also, English is not my native language, so feel free to correct me if something annoys you (grammar-nazi style)

sentences:
Patterns for racing AI behaviour So let's say you've got a spline-based racing AI.  Assume it can already handle the basics of braking and steering around the track.

How would you structure and implement collision avoidance, overtaking, drafting, blocking and other behaviours so your cars remain competitive but make interesting races?

Links to papers/implementations would be awesome.

sentences:
How can I find all connected objects of the same type recursively? In my game, when a user selects an object of some type, I'd like to search for all other objects of the same type that are connected to that first one.

For example, if the user selects a object of type 2, I want to check the object next to that one to see if it is also of type 2 and so on in all directions (up, down, left and right, et cetera) until there are no more objects of that type connected.

Does anyone know how I could do something like this? You can assume I have access to the set of connections from any given object.

sentences:
Calculating collision of polygons Say I have a multitude of 2D polygons floating about on a plane. These polygons can have any side count and aren't necessarily regular.

Assuming I know absolutely everything about the polygons (area, collision point, location, velocity, rotation, angular velocity... etc) how to I calculate what happens to two polygons after collision?

I.e. what will their resultant velocities and angular velocities be after collision?

If not an exact solution, what resources could help me learn how to accomplish this?

sentences:
Protecting XNA Assets With so many XNA asset viewers out there, how do I distribute my XNA game for PC without having my assets open for persons to steal or manipulate? I know i can create custom asset importer/processor, but that's too time consuming right now. So, are there any alternatives to securing my assets?

model viewers:

http://modelviewer.codeplex.com/

http://xnamodelviewer.codeplex.com/

https://github.com/devpro/Xna-Model-Viewer

Edit:
found a solution:
http://www.xnawiki.com/index.php/Compressed/Encrypted_Content_Archive
I was looking for something like this all along, but there is still the problem of 3d ripper dx. I guess i'll have to rely on copyright as my protection

sentences:
Rendering objects with either normal maps, either specular maps, or with both, or with neither? My hobby engine has a deferred renderer that supports normal maps and specular maps. Now, some objects may have normal maps, and some may have specular maps. In some cases, an object has both maps, and in some cases, it has neither.

The question is: how should I implement the rendering of these objects? Should I have a render queue for each different object type and render them with separate shaders like this:

Queue A: Objects without normal and specular map
Queue B: Objects with normal map, without specular map
Queue C: Objects without normal map, with specular map
Queue D: Objects with both normal map and specular map

// Render loop
bind shader for type 'A' objects
for each object in Queue A:
    render object

bind shader for type 'B' objects
for each object in Queue B:
    render object

// and so forth...

Or, should I use a single shader and bind a "default" normal map and specular map for those objects that do not have such maps? By a default map, I mean for example a normal map texture that's completely colored (128, 128, 255). This would be something like this:

bind shader
bind default normal map texture
bind default specular map texture

for each object in Queue A:
    render object

for each object in Queue B:
    bind object's normal map
    render object

bind default normal map texture
for each object in Queue C:
    bind object's specular map
    render object

for each object in Queue D:
    bind object's normal map
    bind object's specular map
    render object

Basically, the first approach would involve less texture binds and more shader binds, whereas the second approach would be the opposite. Is either of these a preferred way to approach the problem? Or have I missed something completely here?

You can assume the objects are queued correctly to the queues.

sentences:
How are bullets simulated in video games? I have been playing games like MW2 recently and, as a programmer, I tend to ask myself how do they make the game so immersive. For example, how to they simulate bullet speed.

When an NPC fires a bullet from his gun, does the bullet really travel from his gun to the given target or do they they completely ignore this part and just put a bullet hole on the target?
If the bullet is really travelling from the gun to the target, at what speed is it actually travelling?

sentences:
How do I create an animation without noticeable loops? I'd like to create vivid idle and passive animations for a creature, but I want to avoid the appearance of obvious loops in the animation and avoid the use of obviously-identifiable pre-baked animation clips.

How can I accomplish this?

sentences:
Libgdx collision detection and response I am trying to create a simple platformer game with libgdx.
I implemented a collision detection for the player's bounding box with the map's tiles using the Rectangle.overlaps method.

In response I am trying to find out at what edge the player hits the tile and then react accordingly.

Somehow it happens that when the player collides on the X axis, the response of a collision on the Y axes happens (player gets moved to the top of the tile).

I was looking into the SAT (Seperating Axis Theorem), but I don't feel like it's applicable here, since I am not trying to draw any line betwen the Rectangles. In fact, since Rectangle.overlaps() is used I am only reacting to a collision already happening.

Here the source:

private void resolveCollision() {
    setUpPlayerRec(allObjects.get(0));
    for (Rectangle r2 : tiles) {
        if (!playerRec.overlaps(r2)) {
            continue;
        } else {
            onCollisionWithTile(r2);
        }
    }
}

private void onCollisionWithTile(Rectangle r2) {
    Gdx.app.log("Collision Detected", "Player collided with tile");

    float diff;

    if (playerRec.x +playerRec.width < r2.x) {
        // LEFT EDGE OF TILE
        controlledPlayer.getPosition().x =(r2.x - playerRec.width);
        controlledPlayer.getVelocity().x = 0;
    } else if (playerRec.x > r2.x + r2.width) {
        // RIGHT EDGE OF TILE
        controlledPlayer.getPosition().x =(r2.x + r2.width);
        controlledPlayer.getVelocity().x = 0;
    }

    if (playerRec.y < r2.y) {
        // HIT TOP OF TILE
        diff = (playerRec.y + playerRec.height) - r2.y;
        controlledPlayer.getPosition().y -= Math.abs(diff);
        jumptime = MAXJUMP;
        controlledPlayer.setJumpState(JUMP_STATE.GROUNDED);
    } else if (playerRec.y < r2.y + r2.height) {
        // HIT BOTTOM OF TILE
        controlledPlayer.setJumpState(JUMP_STATE.GROUNDED);
        jumptime = 0;
        diff = playerRec.y - (r2.y + r2.height);
        controlledPlayer.getPosition().y = r2.y + r2.height;
    }
}

sentences:
How can I find the "end" vertices on an open-ended mesh? I was looking at a video of a system that extrudes meshes along a curve, connecting them end to end but adjusting the vertices for a smooth connection. It does this with a mesh that as far as I know is guaranteed to have open ends that are later capped with a separate mesh.

Here is a video showing the effect I am trying to reproduce.

Let's suppose I have a mesh, then, that is open like in the picture below. How can I find the vertices that are on one edge only of this mesh? For example the ones that are selected here.

Previously I used a plain cylinder with open caps as an example, and finding edges that were only used for one face might have been able to do the job, but in a case like this, it would end up selecting any vertices in the middle along the bottom as well, which I don't want.

I want to be able to find the ends of a particular side like those that are selected in the picture. Theoretically I can then manipulate these into new positions if I wanted to, for example, string cylindrical segments into a curved cable structure.

For what it's worth, I'm trying to accomplish this in Unity with C#, but it's the algorithm I need help with.

sentences:
Unity 5 Animation attaching I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not attached to the object.

When I drag the walking/idle animation and drop to that object, it creates an animation controller. Again I run it, still same error. I can't find where to attach the animation

Here's my script:

function Update ()
{
  if(Input.GetKeyDown("w"))
  {
    GetComponent.<Animation>().Play("walk_anim2", PlayMode.StopAll);
  }
  if(Input.GetKeyUp("w"))
  {
    GetComponent.<Animation>().Play("idle_anim2", PlayMode.StopAll);
  }
}

Where do I need to attach the animation?

sentences:
How do I interpolate an object's rotation on a Z-axis based on mouse position? I need to apply rotation to an object, based on the mouse movement around it to a z-axis only.

Let's take this picture:

Violet - current mouse position
Blue - mouse movement
Red - the
object to be rotated

I use this script and it works fine:

mousePos = Input.mousePosition;
screenPos = Camera.main.ScreenToWorldPoint(Vector3(mousePos.x, mousePos.y,
transform.position.z - Camera.main.transform.position.z));

transform.rotation.eulerAngles.z = Mathf.Atan2((screenPos.y - transform.position.y), (screenPos.x - transform.position.x)) * Mathf.Rad2Deg;

but... it work's in real-time which I don't want, so I need to interpolate it. I used Quaternion.Lerp/Slerp and I got a strange result.

When I move the mouse too fast (rotate it around the cube) it lerps to mouse's new position (which is ok) but it changes the rotation direction when the angle changes from -180 to 180 or 180 to -180.

It's because of Quaternion math probably, to be precise - Quaternion decides to switch the rotation direction, because it found a shorter path.

The question

How do I smoothly (with lerp) rotate the object (on a z-axis) to look at the mouse position so it doesn't make the above glitch when lerping?

sentences:
Circular lighting mask stretches to ellipse in Monogame using Pixel Shader I am trying to implement a very simple pixel shader for some basic lighting using this tutorial http://www.xnahub.com/simple-2d-lighting-system-in-c-and-monogame/

My problem is that when the effect is applied the circular gradient ends up looking like an ellipse(left) instead of its circular shape(right).

The technique I use is to have two render targets in monogame and blend them together. The first one is all of the light masks textures, and the second is the render target I want to add the lighting effect to.

I believe the problem is related to the shader itself because when I use this code I get the ellipse(left picture)

//Blend both render targets together onto the backbuffer
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
effect1.Parameters["lightMask"].SetValue(lightsTarget);
effect1.CurrentTechnique.Passes[0].Apply();
spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White);
//spriteBatch.Draw(lightsTarget, Vector2.Zero, Color.White);
spriteBatch.End();

However, when I comment out the effect and just draw the light render target. I get a nice circle(right picture)

//Blend both render targets together onto the backbuffer
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
//effect1.Parameters["lightMask"].SetValue(lightsTarget);
//effect1.CurrentTechnique.Passes[0].Apply();
//spriteBatch.Draw(mainTarget, Vector2.Zero, Color.White);
spriteBatch.Draw(lightsTarget, Vector2.Zero, Color.White);
spriteBatch.End();

This is my effect file

sampler s0;

texture lightMask;
sampler lightSampler : register(s1) = sampler_state {Texture = <lightMask>;};

float4 PixelShaderFunction(float4 pos : SV_Position, float4 color1 : COLOR0, float2 coords: TEXCOORD0) : COLOR0
{
    float4 color = tex2D(s0, coords);
    float4 lightColor = tex2D(lightSampler, coords);
    return color * lightColor;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

Thanks.

sentences:
Unity Guitext object always triggering a collision - 2D I have a guitext object which I can drag.  I have attached a 2d rigid body.  I have also attached the collider with the following code:

void setCollider()
    {
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        var boxX = box.width;
        var boxY = box.height;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

I have a sprite with a collider set as trigger.  However, it triggers as soon as the game starts and is not anywhere near the trigger sprite.  It will only trigger the one time when it starts.  My Trigger on my sprite is as follows:

void OnTriggerEnter2D (Collider2D other){
        Debug.Log ("Order Right Arm");
        Debug.Log (other.bounds);
    }

EDIT: based on answer I have changed the size of the collider to account for the pixel/unit difference:

void setCollider()
    {
        float pixelRatio = (Camera.main.orthographicSize * 2) / Camera.main.pixelHeight;
        Debug.Log ("Pixel Ratio "+pixelRatio);
        Rect box = this.guiText.GetScreenRect ();
        BoxCollider2D boxCollider = (BoxCollider2D) gameObject.AddComponent (typeof (BoxCollider2D));
        float boxX = box.width * pixelRatio;
        float boxY = box.height * pixelRatio;
        Debug.Log ("boxX = " + boxX + "boxY = " + boxY);
        boxCollider.size = new Vector2(boxX, boxY);
    }

Any ideas on how I can get this to trigger only when I drag the guitext over the sprite?

sentences:
Am I allowed to release a fan-made version of a Trading Card Game on a fansite? Consider a Trading Card Game that is currently available for play in digital format only, the game in question would be HEX: Shards of Fate, but this question is intended as a general question about all Trading Card Games.

Now my idea is to create an AI player for that game and see how good it performs. For this I'll need to build a client that is capable of playing the game and initially I want to test it myself and distribute it to a few friends so they can play around with it.

I am myself unsure of whether the EULA specific to this game are of any importance, as I believe all games will try to protect their games to the fullest extent as possible. However we also know that there are fansites out there which are allowed (are they legally allowed?) to display the cards of the game (including artwork) as long as they have a clear reference to the game which it is about and they do not attempt to make any money out of the cards themselves. I do believe that premium services on a fansite itself are legal.

Ultimately I want to create a fansite where:

There is an obvious reference that the cards, etc. belong to the company that created the game.
You can as player play versus an AI, using a game interface that is similar to the one that is in the actual digital version. It most likely won't be an exact 1:1 copy and some substitute interface will be used that doesn't look as nice.
Playing versus the AI is not promoted as an actual game, it is just a site where you can test your skill as player, and as creator I can test the effectiveness of the AI.
All cards are freely available to any player, I most surely do not intend to monetize that part.
There is possibly a premium service that offers benefits, possibly more detailed statistics or more AI matches, more options, etc.

So I've got the following questions about this:

Is the limited distribution amongst myself and friends legal?
Is this fansite legal without the premium service?
Is the premium service legal?
Would selling booster packs (where you can obtain the cards) and having the player start with a minimal collection actually be illegal?

sentences:
World to Pixel Transformation My objects have a location in world coordinates (basically 1.0f is a meter).
If I simply draw my objects using their world coordinates, each meter will correspond to a pixel. Obviously that's not what I want.

Now, I don't want to have to apply a transformation to each and every object's position when I draw them. As I happen to be using XNA, and spritebatch allows a Matrix to be passed in as an argument in it's begin method, I was wondering if there is a way to pass the World to Pixel transformation in there. Any suggestions?

So far Matrix.CreateScale(new Vector3(zoom, zoom, 1)) puts the objects in their proper spot, but it also scales up the sprites. Is there a way to transform the position without enlarging the sprite?

Thanks

sentences:
indices for surface of revolution I'd like to implement a surface of revolution.

I already implemented creating Vertices based on a 2D line.
I now want to get the indices to render the mesh with GL_TRIANGLES

Here's the code to create the 3D Vertices out of a 2D line:

void createVertices(vector<Vector2>& points,unsigned int iterations)
{
    int i;
    int j;

    unsigned int index;

    vector<Vertex> newVertices;
    vector<unsigned int> newIndices;
    for(j = 0; j < points.size();++j)
    {
        for(i =0; i < iterations;++i)
        {
            Vector2 p = points.at(j);
            float theta = M_PI*2.0*(float)i/(float)iterations;
            float x = sinf(theta)*p.x;
            float z = cosf(theta)*p.x;
            newVertices.push_back(Vertex(x,p.y,z));
        }
    }
}

and here's the code that will be called to save the Vertices:

void addVertices(vector<Vertex>& vertices,vector<unsigned int>& indices)
{
    this->vertices = vertices;
    this->indices = indices;

    unsigned int verticesSize = vertices.size() * sizeof(Vertex);
    unsigned int indicesSize = indices.size() * sizeof(unsigned int);

    float* vertexBuffer = new float[vertices.size()*sizeof(Vertex)];

    createBuffers(vertices,vertexBuffer);

    glGenVertexArrays(1,&VAO);
    glBindVertexArray(VAO);

    glGenBuffers(1,&verticesVBO);
    glBindBuffer(GL_ARRAY_BUFFER,verticesVBO);
    glBufferData(GL_ARRAY_BUFFER,verticesSize,vertexBuffer,GL_STATIC_DRAW);

    glGenBuffers(1,&indicesVBO);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indicesVBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER,indicesSize,&indices[0],GL_STATIC_DRAW);

    delete[] vertexBuffer;
}

someone has a basic idea?

sentences:
Unity 5.3 with C# - Toggle Sound On/Off I'm working with Unity 5.3 with C# as code editor

These are what I have :

I have 2 scenes in my project : home and options. I have bg object on both scenes. Both bg objects have Audio Source component, which contains same background music that play on awake. I don't use any codes for these background musics, I only click the Add Component button from Unity and add Audio Source.

This is what I want :

Options scene can toggle the background music on/off for all scenes. Therefore, there are btnOn and btnOff in Options scene.

This is my code in Audio Manager.cs :

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class AudioManager : MonoBehaviour {
    public Button btnOn;
    public Button btnOff;

    // Use this for initialization
    void Start () {
        btnOn = GetComponent<Button>();
        btnOff = GetComponent<Button>();

        btnOn.onClick.AddListener(() => PlayAudio());
        btnOff.onClick.AddListener(() => StopAudio());
    }

    void PlayAudio()
    {
        AudioSource.volume = 0.5f;
    }

    void StopAudio()
    {
        AudioSource.volume = 0f;
    }
}

This is the problem :

I have this error : An object reference is required to access non-static member UnityEngine.AudioSource.volume. Maybe, this is because I don't write public AudioSource audioSource in my code. But, if I write this, I have to add another audio in Get Component box, and I will have double Audio Source in one scene. What should I do? Thanks

sentences: How to use X,Y, and Z instead of Pitch, Roll and Yaw I'm learning Unreal engine, and I'm rather disappointed because it uses pitch roll and yaw instead of the standard x, y, and z that I'm used to.  Is there any way to convert this easily, or is there a preference, or do  I have to get used to using y,z,x, instead of x,y,z.

sentences:
How to store and update presentation strings describing effects with parameters? Consider this spell:

As you can see in my design a Spell is a composition of one or more Effects. An Effect has properties on it like value, range, etc. So, I can say that the Spell Description is an aggregate description of the composition of effects.
Presentation Layer
In my presentation, I want to decorate part of the description string in HTML tags and display as rich text. I also want to ensure that my string's numeric values come from data.
Solution 1
Simply hard code the string. In this case the spell description would look like: Choose a target within <#f4b350>4</color> squares. Deal <#f33613>4</color> damage to that target and restore your HP by <#3cf73c>50%</color> of the damage done.
This approach has some obvious issues, namely:

Changing the color value of a particular tag would be a nightmare when there are hundreds of abilities

Changing the damage value of a spell means updating it in two places, the string and the data

Solution 2
Create a tag series separated by _ that indicates various properties. I could for example, do something like Deal {subtractive_value} damage to that target with the idea that when I go to parse the string, subtractive could be a tag indicating a red color, and value can be a tag indicating that its the effect's value that should go there.
This is all fine except that a spell can have multiple effects. I need a way to associate the part of the description with the specific effect that drives it.
Modification to Solution 2
So then I suppose I could just add IDs to the spell effects such that the string defined in data becomes:
Choose a target within {neutral_damageEffect_range} squares. Deal {subtractive_damageEffect_value} damage to that target and restore your HP by {additive_healEffect_value}.
But now you see that its getting a bit cumbersome and I'm dubious of how scalable that solution is.
Non-Goal
Lastly I figured I'd mention a non-goal. If you take my approach thus far to its ultimate conclusion, you would probably end up with trying to find a way to generate your description text from the effect themselves. While this is an interesting idea, I think it's a bit too ambitious, so I'm specifically not trying to do that. That said, if you feel like that's easier than I think it is, feel free to make that suggestion!
Question
So, given what I've tried and the problem I'm trying to solve, there's no way this is a unique problem to me. Is there a battle-tested solution to this problem? What's a good way to go about it or some patterns to use I might not know about?
EDIT
Some have asked for some code, it is lengthy though so I can just link to a gist here:
https://gist.github.com/jsandersr/ef6d560ad95f1d63b1f8e3b2099038a5

sentences:
Cubes are separating from each other I recently asked this question

        public void spawnCube() {
      cubes = new Array < Rectangle > ();
      for (int i = 0; i < 3; i++) {
          Rectangle cube = new Rectangle();
          cube.x = xpos;
          cube.y = ypos;
          cube.width = width;
          cube.height = height;
          xpos += 28;
          if (Gdx.input.justTouched()) {
              cubes2.add(cube);
              score++;
          }
          cubes.add(cube);
      }
  }

  public void moveCube() {
      Iterator < Rectangle > iter = cubes.iterator();
      while (iter.hasNext()) {
          Rectangle cube = iter.next();
          cube.x += speed * Gdx.graphics.getDeltaTime();
          if (cube.x + cube.width > 800 || cube.x < 0)
              speed = -speed;
      }
  }

The first method generates 3 cubes, the second one moves them from right to left and back. Cube size 15w 30h. Screen size 800w 400h.

The problem I have is that after 2 or 3 cycles of the cubes going from right to left, the cube on the left gets seperated from the other two. It seems that the other two cubes are pushing the first one out of place. How to prevent that from happening?

sentences:
How to convert this resource texture creation code from DirectX 11 to DirectX 12? I have some code below that is Directx 11 that im using to make a resource texture.

D3D11_TEXTURE2D_DESC fullScreenTextureDesc;
        ZeroMemory(&fullScreenTextureDesc, sizeof(fullScreenTextureDesc));
        fullScreenTextureDesc.Width = 800;
        fullScreenTextureDesc.Height = 600;
        fullScreenTextureDesc.MipLevels = 1;
        fullScreenTextureDesc.ArraySize = 1;
        fullScreenTextureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
        fullScreenTextureDesc.SampleDesc.Count = 1;
        fullScreenTextureDesc.SampleDesc.Quality = 0;
        fullScreenTextureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
        fullScreenTextureDesc.Usage = D3D11_USAGE_DEFAULT;

        HR(device->CreateTexture2D(&fullScreenTextureDesc, nullptr, &fullScreenTexture));

How can i convert this to directx 12?

sentences:
Object moving in a hollow pipe, want collision detection, how do I do that? Do I need to add a rigidbody and sort the collider to fit to both the pipe and the object? I'd like the game to end if the object touches the pipe.

I've only seen sphere and box colliders. How would it work with a hollow pipe?

sentences:
Libgdx Sprite rotation around specific point I made complex dynamic body that rotates around other body that is static. It works perfectly, however I got messed up with sprite position on that body.
Here's what I have now

and here's what I need to have

I will add my code

private Body createSide(float x, float y, Sprite tmpSprite, boolean sharp){
      BodyDef bDef = new BodyDef();
      bDef.type = BodyDef.BodyType.DynamicBody;

    PolygonShape shape = new PolygonShape();
    if(!sharp){
        shape.setAsBox(1.8f / PPM, 0.2f / PPM);
    } else {
        shape.setAsBox(0.2f / PPM, 1.8f / PPM);
    }

    FixtureDef fdef = new FixtureDef();
    fdef.shape = shape;

    bDef.position.set(x, y);
    Body body = world.createBody(bDef).createFixture(fdef).getBody();
    body.setAngularVelocity(-1f);
    tmpSprite.setPosition(bDef.position.x * 32, bDef.position.y * 32);
    return body;
}

private void createBody(int y, final int V_WIDTH){
        staticBody = createStaticBody(y, V_WIDTH);
        Body rightSide = createSide(5.5f, 15, sprites[0], true);
        Body leftSide = createSide(9.5f, 15, sprites[1], true);
        Body top = createSide(7.5f, 17, sprites[2], false);
        Body bottom = createSide(7.5f, 13, sprites[3], false);

        bodies[0] = rightSide;
        bodies[1] = leftSide;
        bodies[2] = top;
        bodies[3] = bottom;

...
...
...
    }

and here's my draw method

@Override
    public void draw(SpriteBatch sb) {
        for (int i=0; i<bodies.length; i++){
            sprites[i].setRotation(bodies[i].getAngle() * MathUtils.radiansToDegrees);
            sprites[i].draw(sb);
        }
    }

sentences:
OpenGL fix objects to camera I'm developing some game in order to learn OpenGL.

I can make an object follow me around when I move forward, backward, left, right, up or down, by setting it's position right infront of the camera.

Problem starts when the camera rotates / tilts (looking up, down, left, right...).

The object is indeed sticks infront of the camera position (because I calculate a vector going out from the camera position and place it there), however I can't make the angle of the object to rotate/tilt along with the camera, so it is just fixed.

I think I might have to set the object coordinate system to correlate with the camera's coordinate system, but I can't figure out how. Maybe I'm wrong and there's another way to do that.

My game implementation

I have 4 vectors for the camera and 4 vectors for each object: origin, x, y and z (to represent the objects coordinate system).

To move the camera, I substract z axis from origin.

Same for other directions.

In order to tilt the camera, for example to the right, I just calculate rotation around Z axis and apply to X,Y axes.

Note: Movement in the world works good, in all directions and angles.

Here's the (the relevant) code I use to position objects in the world. Before drawing them I first put them in their origin (recall: I save an origin and x,y,z axes to all my objects), then do some scale to fit my desired size:

// translate to position
gl.glTranslatef((float)origin.x, (float)origin.y, (float)origin.z);
// scale to size
gl.glScalef((float)size.x, (float)size.y, (float)size.z);

Any ideas?

sentences:
Continous Movement and Gravity Switch With 1 button I have a sphere with a rigidbody on it, and it moves to the right continously as I need it, but as it moves I want the space bar to be able to switch the gravity (so it either rides on the ceiling or on the floor), as it moves along to the right.

Please help, have been googling consistently for the past 3 hours.

Here is the code I have so far:

public class movement : MonoBehaviour {

    public float movementSpeed = 10;
    private bool haspressed;

    void Start()
    {
    }

    void FixedUpdate()
    {

        transform.Translate(Vector3.down * movementSpeed * Time.deltaTime);

        if (Input.GetKeyDown ("space") && haspressed == true) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = false;
        } else if (Input.GetKeyDown ("space") && haspressed == false) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = true;
        }
    }
}

Thank you sooo much!

sentences:
How does this game loop actually work? I read this playfulJS post, about ray-casting:
http://www.playfuljs.com/a-first-person-engine-in-265-lines/

It looks really interested, so I decided to look at his javascript. I am no expert in javascript, so I quickly got lost.

It's the game loop "object" that really gets me.
I simply don't understand how it works.
From the code:

function GameLoop() {
        this.frame = this.frame.bind(this);
        this.lastTime = 0;
        this.callback = function() {};
      }

      GameLoop.prototype.start = function(callback) {
        this.callback = callback;
        requestAnimationFrame(this.frame);
      };

      GameLoop.prototype.frame = function(time) {
        var seconds = (time - this.lastTime) / 1000;
        this.lastTime = time;
        if (seconds < 0.2) this.callback(seconds);
        requestAnimationFrame(this.frame);
      };

var loop = new GameLoop();

      loop.start(function frame(seconds) {
        map.update(seconds);
        player.update(controls.states, map, seconds);
        camera.render(player, map);
      });

Now, what really confuses me here, is this bind stuff and how this actually loops.

I am guessing, that if less than 0.2 seconds have passed, since the last time the loop was run, it simply goes back to re-check the time. If more than 0.2 seconds have passed, it leaves the frame function, and executes the 3 lines in the loop.

But, if this is true, then how does the loop.start() get called again?
And what on earth is the meaning of this.frame = this.frame.bind(this);?

I've looked up prototypes bind() but I really don't understand it.

sentences:
Is it a bad practice to add helper methods if the class is intended only for data? For example, if I have something like:

class ItemData
{
    public int cost;
    public int level;
    ...
    public List<ItemData> childItems;
}

And I'm aiming to separate data from logic, is it ok if I add methods to ItemData such as:

class ItemData
{
    ...
    public void AddChildItemData(ItemData childItem);
    ...
}

that are helper methods for setting or manipulating the data? Or should these be moved elsewhere to service classes?

sentences:
What is the best abilities modding system that you encounter in games? I'm thinking about designing an abilities system (as in a moba game).

Most important goal is to be able to easily create new abilities in the editor, with a low learning curve (ultimate goal: simple visual constructor, without any programming)

I'm searching for existing production systems, which allow to mod abilities, to analyze their design decisions.

By now, I explored DOTA2 system (tutorial >>) and SC2 system (tutorial >>), because of their success in modding community.

What other good abilities systems do you know, that are worth considering?

Thanks!

sentences:
How to calculate collision detection from big rectangle to small rectangle? I have big rectangle that can move from side to side, its boundaries can't enter the small rectangle inside it, the anchor point is in the middle of both of them.

Let's say the big rect is 1000 * 1000, and the small one is 200 * 200
in the game the small rect is the "camera" and the big rect is the ground, only the ground moves.

The solution can be in any programming language.

Here is some drawing to show what I mean :

sentences:
How to rotate an object along its trajectory path? I have a missile launcher that uses initial velocity for the trajectory. I edit the launch angle from the editor, and then the script calculates the initial velocity required to land the missile to the target location. The inputs for the calculation are

Launcher position
Target position
Firing angle

In this scenario, the target and the launcher position has the same Y coordinates. I simply instantiate the missile prefab and set its initial rotation to match the firing angle (initial X rotation), rotate it to face the target position (corrected Y rotation), calculate the initial velocity using local space (calculate the Y and Z component of initial velocity), and then set its velocity so the trajectory is handled by the physics engine.

// initial X rotation of the missile: -_firingAngle;
GameObject missile = Instantiate(_projectile, transform.position, Quaternion.Euler(-_firingAngle, 0f, 0f)) as GameObject;
missile.transform.LookAt(_targetPosition);  // fix the Y rotation of the missile
// ...
// velocity calculations
// ...

// launch the missile
missile.GetComponent<Rigidbody>().velocity = Local2GlobalVelocity;

The missile lands its target just fine, however, the X rotation of the projectile during the trajectory doesn't change.

This is how the missile prefab looks like:

I want the missile to be rotated by the physics engine, or put another way, I want it to look natural while in motion. As you may have noticed from the first image, I have visited numerous unity forums to solve the issue. I tried updating the rotation of the missile on each frame as follows

transform.rotation = Quaternion.LookRotation(rb.velocity);

However, this results in a funny trajectory -- imagine an erect missile tilted a little backward, and at the time of landing, the missile is tilted a little forward. I'm not sure why, but when I try to edit the X rotation of the missile mid air when I use the LookRotation(rb.velocity) while the game is paused, the Z value of the rotation also changes. Since the velocity is a Vector3 with non-zero X,Y and Z components, I think the missile is subject to Gimbal Lock.

What are my options to make it look like a trajectory of a badminton ball?

Can I achieve this by adding rigidbodies to the parts that are at the top of the missile and adjust their mass so that the physics engine handles the trajectory rotation as it is a badminton ball, instead of me messing up with the rotation by scripting? If yes, how can I do that exactly?

sentences: Does 2D Platformer games still have popularity among gamers? I'm currently working on a 2D platformer game that i wanted to put out as my first game but seeing the popularity of other games made by Voodoo and others are quite distressing and made me ask myself this question and now you guys. will the 2D Platformer games that had the popularity will have any popularity for developers to take interest and make some living out of it in the for future projects or can they work on the more popular games like color bump 3d.

sentences:
Cancel a SpriteBatch I've started drawing Background:

I'm working on a control library for XNA to use in a couple game clients I've written. The way I've implemented Dialogs is to have them derive from the base XNAControl class.

XNAControl objects follow the Game Component model and are all derived from DrawableGameComponent. They are added to the Game.Components list as soon as the base class XNAControl constructor is called.

Problem:

Dialogs are popped up in game by instantiating an XNADialog object, unlike MessageBox.Show() which uses a static method. The constructor of XNADialog, in turn, instantiates a couple controls that are 'children' of the parent dialog control. Children are tracked by the dialog, and removed from the Game.Components list automatically when the Dialog is closed.

The problem with the model that I've created is that the child controls are added to the Game's components when they're constructed, so they start updating and drawing and thus show on the screen before the dialog is fully constructed. The case I'm trying to debug is where the labels for a dialog box will appear in the top left, and then move to the center of the screen a split second later once the Dialog is constructed.

What I've tried:

Separate constructor for base class XNAControl that doesn't add the control to the components when it's constructed. Instead, it relies on the child control (in this case dialog) to add itself to the Game.Components collection. This is what I have in place so far and it isn't working, which makes sense, because the labels are being added to the components collection prematurely anyway.
Initialized property of XNAControl. This property is set in the XNAControl.Initialize() method, and the base class XNAControl.Update and XNAControl.Draw return automatically if it is false. However, this isn't working either (also in place) because child controls have to call the base methods of update and draw before after they do their own drawing logic because otherwise some things would be drawn in the wrong order. I also don't want to have to check the Initialized property in every single child class I make because there are a lot of them and I'm looking for something more elegant
Moving the addition of the control to the components collection to the Initialize method. This didn't work because the control's initialize method didn't get called automatically because the control wasn't in the components collection yet.

Question:

What is the best way to keep the child controls from being updated and drawn prior to their parent control's construction? My only other ideas are:

Using a theading sync object, but this seems like overkill/unnecessary (or maybe it's exactly what I need?). I can't think of an elegant way to do it.
Finding a way to cancel any drawing that's been done by the SpriteBatch in the child classes, in XNAControl.Draw. I don't think this is possible though, and I can't find anything searching.

sentences:
Exporting unity features to your game I wonder if it is possible to export Unity features to my game.

For example if I want user to be able to modify scale or rotation of object, do I have to scritp it myself or can i somehow export it ?
Same question about some simple texturing, adding lights, etc.

sentences: 3ds Max Rigs to Cinema 4D I exported the rig from 3ds Max as a FBX file and opened it with Cinema 4D. Everything works great, but the model and a different look to it. Also the mask on her head has a different texture, but it was imported with only 1 object. Just wondering if it can be fixed, if not its ok.

sentences: What are the pros and cons of HLSL vs GLSL vs cg? What are the pros / cons of the three?

sentences:
Aligning Camera to Rectangle I'm working on a game in Java, and I'm having some trouble with finding the correct camera position. I've already made a Rectangle that shows exactly where I want the camera to be, and at what scale:

However, whenever I actually try to adjust the camera so it fits with the rectangle, I get weird results. The camera goes in weird places when I get to a point where the scale isn't 1:

(The blue rectangle shouldn't be visible in the above gif, because that's where the camera's edges should be.)
Right now I have a camera class, where I set the position with:

x=-((leftX+Math.abs(leftX-rightX)/2)-Main.WINDOW_WIDTH/2/scale);
y=-((topY+Math.abs(topY-bottomY)/2)-Main.WINDOW_HEIGHT/2/scale);

Where leftX, rightX, topY, and bottomY are the topmost, rightmost, topmost, and bottommost points of the rectangle. Those two lines of code are where the problem lies. I simply need to figure out where to move the camera based on the scale.

For translating and scaling, I have this:

g.translate(cam.getX(), cam.getY());
g.scale(cam.scale, cam.scale);

//Render in-game objects

g.translate(-cam.getX(), -cam.getY());
g.scale(1/cam.scale,1/cam.scale);

What I'm asking is, how can I move the camera so that it's perfectly aligned with the rectangle?

sentences:
Implementing "Fix Your Time Step" So far I have this implementation of "FYTS".

However I am facing several problems.

    final int TICKS_PER_S = 60;
    double accumulator = 0.0;
    //The timestep
    final double dt = 1/(double)TICKS_PER_S;
    long previousTime = System.currentTimeMillis();

    //State previous;
    //State current;
    while(running){

        long currentTime = System.currentTimeMillis();
        double frameTime = (currentTime - previousTime)/1000;

        if(frameTime > 0.25){
            frameTime = 0.25;
        }
        previousTime = currentTime;
        accumulator += frameTime;

        while(accumulator >= dt){

            //previousState = currentState;
            this.gamePanel.update(dt);
            accumulator -= dt;
        }

        //Interpolation
        // final double alpha = currentState * alpha +
        //               previousState * (1.0 - alpha);

        //This is the draw call. Not yet using interpolation
        this.gamePanel.postInvalidate();
    }

Problem 1:

frameTime is always 0 meaning that the game is never updating. It seems obvious: In the beginning it is 0, but that should change, shouldn't it?

Problem 2:

Let's assume that Problem 1 wouldn't exist. I understand that you take an arbitrary frameTime and split it up into discrete timesteps and then update the game. But what's the point of updating in a separate nested loop anyways? Most of the time you are left with a little remainder at the end of finishing the inner update loop. That remainder is how much of the simulation is left to complete until the running loop starts again and takes a new frameTime on which a part of the simulation has to be performed on. But what does the interpolation do that's worth to even consider doing it Isn't the inner update loop just a waste of time?

Problem 3:

The outer loop is running without any limitations at max speed. Isn't that just wasting clock cycles (and draining the battery life on mobile devices)? Is there anything I could do to counteract that?

sentences:
Runtime Issues on 144Hz Monitors I've recently finished my first ever Unity game. The game runs okay in my end but two of my friends had issues with the game. They both have 144hz monitors and the issues are solved when they lower the refresh rate to 60Hz. The problems are that any object who has a velocity depending on Time.deltatime, it gets halved. Is there a way to fix this on code so that nobody has to reduce their refresh rate when playing?
Here is an example code of a snowball projectile's behaviour. The snowball usually stays alive for 3f seconds and that allows him to go across the whole screen but in 144hz runtime, the snowball goes really slow and it does not last enough to even get across the half of the screen.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Snowball : MonoBehaviour
{
    [SerializeField] private float speed = 20f;
    [SerializeField] private Rigidbody2D rb;
    [SerializeField] private GameObject impactEffect;

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

        Destroy(gameObject, 3f);
    }

    void Update()
    {
        rb.velocity = transform.right * speed * Time.deltaTime * 75;
    }

    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        if(hitInfo.CompareTag("Player") || hitInfo.CompareTag("Enemy"))
        {
        Destroy(gameObject);
        Instantiate(impactEffect, transform.position, transform.rotation);
        }
    }
}

Here is my game if anyone is interested in further examination: itch.io link

sentences:
Crash when setting a new screen In my almost finished game I want to set a new screen on game over. I got my game over method:

    private void gameOver(Label score) {
    for (Body body : worldBodies) {
        world.destroyBody(body);
        dispose();
        ((Game) Gdx.app.getApplicationListener()).setScreen(new GameOver());
    }
}

Whenever the method gets called the screen freezes for a second and the game crashes with this statement:

09-02 22:04:34.036      391-425/com.joelbrun.jetskirider.android A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x8 in tid 425 (GLThread 29501)

sentences:
How to make ranked matches in a head-to-head multiplayer game? I am working on a field hockey like game for Android and iOS.
Currently I support being able to play against another player online in a client/server fashion where one device host and the other provide an IP address.

I would like to be able to have ranked matches that are recorded in something like Amazon's GameCircle or something similar.

For recording the win/loses I thought having one leaderboard for wins, one leaderboard for loses and perhaps another leaderboard for amount of games in progress...

That is assuming I can read the leaderboard result for each player which I think I can.

Other than that, there are many issues in how to have ranked matches.
I am guessing the biggest difficulty is actually being able to have a client/server session since most devices are not set up to have a direction communication with another device?

What are your suggestions for having ranked matches given no extra server? And what are your suggestions given my own server?

sentences:
What do I need to learn so I can make games on XBox Kinect? I am interested to learn more about game development especially on XBox Kinect. What do I need to learn and what books I should read so I can make games on XBox Kinect?

Thanks

sentences:
Libgdx stage rendering issues I'm using scene2d for the first time, and I can't get anything to draw EXCEPT the stage ui. Say I have my ui on top of my game screen:

uiStage.act():
batch.begin();
gameSprite.draw(batch); //does not show up
uiStage.draw();
batch.end();

How can I render my game, and then render my gui stage on top? Should I use a stage for both the game and the ui?

sentences:
Grid collision - finding the location of an entity in each box I am trying to implement grid-based collision in a 2d game with moving circles. The canvas is 400x400 pixels. Below you can see the code for my Grid class. What I want it to do is check inside which box the entities are located and then run a collision check if there are 2 or more entities in the same box.

Right now I do not know how to find the position of an entity in a specific box. I know there are many tutorials online, but I haven't been able to find an answer to my question, because they are either written in C/C++ or use the 2d array approach.

Code snippets and other help is greatly appreciated. Thanks.

public class Grid {

ArrayList<ArrayList<Entity>> boxes = new ArrayList<>();
double boxSize = 40;
double boxesAmount = 10;
...
...
public void checkBoxLocation(ArrayList<Entity> entities) {

      for (int i = 0; i < entities.size(); i++) {
// Get top left coordinates of each entity
            double entityLeft = entities.get(i).getLayoutX() - entities.get(i).getRadius();
            double entityTop = entities.get(i).getLayoutY() + entities.get(i).getRadius();

// Divide coordinate by box size to find the approximate location of the entity
            for (int j = 0; j < boxesAmount; j++) {   //Select each box
                if ((entityLeft / boxSize <= j + 0.7) && (entityLeft / boxSize >= j)) {
                    if ((entityTop / boxSize <= j + 0.7) && (entityTop / boxSize >= j)) {
                        holdingBoxes.get(j).add(entities.get(i));
                        System.out.println("Entity " + entities.get(i) + " added to box " + j);
                    }
                }
            }
        }
    }
}

sentences:
Creating an interactive grid for a puzzle game I am trying to make a slitherlink game, and am not too sure how to approach creating the game, more specifically the grid structure on which the puzzle will be played on.

This is what a empty and completed slitherlink grid would look like:

The numbers in the squares are sort of clues and the areas between the dots need to be clickable:

I would like to create the game in VB .NET. What data structures should I try to use, and would it be beneficial using any frameworks such as XNA?

sentences:
Find out hit child with RaycastHit Let's assume having a (2d-) gameobject with 3 images: Head, body, feet.
By using RaycastHit2D I can find out if the gameobject was hit (for example by the mouse):

RaycastHit2D newSelectedObject = Physics2D.Raycast(cameraVector, Vector2.zero);

Now I'd like to find out if the head, body or feet was hit. How can I do that?

sentences:
What do you use to create sprite graphics? Possible Duplicate:
  What tools do you use for 2D art/sprite creation?

What do you folks suggest for creating sprite graphics and sprite sheets?

I fiddle with pixelformer and tilestudio.

Pixelfromer has a kicken interface, it is quick and easy to make graphics, but a bit cumbersom if you want to make a spritemap.
Tile Studio is a interesting mix or tiles and maps, but it is a bit buggy and basic.

The Adobe series, just don't really seem to handle tiny graphics well.

(there is a previous posting of this question existing,  but it is a year old and I was hoping for further/updated input from the community)

sentences:
"Industry Standard" JSON formats for game assets This question is inspired by my venture into the Phaser game engine but seems to apply to any engine that uses JSON for its asset format.

Phaser relies on PhysicsEditor to export and create the JSON data for its physics bodies and TexturePacker for its sprite atlases. When I learned this I found some free alternatives that look like they might do the job.

So here's the problem. These JSON creators claim their output works for a slew of different engines, but how can I be certain of that when there can't possibly be such universal collaboration between the creators of these engines? It's especially dubious considering I can't find a standard anywhere. I don't want to rely on a solution only to encounter a glitch I don't understand. I want certainty.

After a lot of searching I finally found this thread, in which a couple of posters also expressed these frustrations. The final post appears to come from the horse's mouth, explaining that there's some "industry standard" that everyone uses, but the poster doesn't seem to know where the industry standard comes from either.

So I'd really like to know, is this specification actually documented anywhere? Does it have an origin or did it just... accrete?

If there's no good answer to this question, can I at least trust the claims of, say, Physics Body Editor and Shoebox, that their exports will work anywhere?

sentences:
Time Required for Animation to Finish Using a tutorial found on the AppHub, I've been attempted to add controls to a sample sprite sheet. I am able to get all the animations working, but for stuff like punching or stabbing, the animations require a timer to stop them from playing repeatedly. XNA uses a default framerate of 60, but I have the animations running at 10 FPS using the following code:

int punchIndex = walk.GetIndex("obj_Walk000");

punchIndex += (int)(time * animationFPS) % punchFC;
batch.Draw(punch.Texture, position, punch.SourceRectangle(punchIndex), Color.White, rotation, origin, 1.0f, SpriteEffects.FlipHorizontally, 1.0f);
break;

Where animationFPS = 10 and punchFC is 6, which is the number of frames in the animation. Using this data, I have calculated a required time of 0.5 seconds for the animation to complete, but that seems to be incorrect, so I'm looking for someone to show me how to do the math properly.

sentences:
SNES development: why bitplanes get scrambled? I am following this tutorial https://georgjz.github.io/snesaa04/. I am stuck on trying to draw a sprite.
Where the end result should be this:

My end result is this:

As I have not been able to find samples of tile and palette files, I am not sure if I have done everything right.
Sprites.vra:
0b 2e 2a 3f 1e 1f 0f 3f 2e 3f 1c 1f 0c ff f3 fe
2f 00 3f 00 1f 00 3c 00 38 00 10 00 00 00 00 00

SpriteColors.pal:
fe 3f 3e 77 f8 5d 0f 49 ff 7f f8 6f 8a 6b 49 62
64 39 e0 2c 60 18 98 04 9f 0e 3e 09 2c 00 00 00

As the tutorial proposes, I use cc65 as a compiler. The files are included like this:
.segment "SPRITEDATA"
SpriteData: .incbin "Sprites.vra"
ColorData:  .incbin "SpriteColors.pal"

As I could not get bsnes working, I am using Snes9X.
As this failed, I tried to draw a plane with just one color as well to figure out the logic. I did not manage, as the colors were always scrambled.
Questions:
How should the tile/bitplane and palette files look like?
What is the checksum error my emulator throws?
As a last note: please be patient if this is basic stuff. I am ex web dev and a retro game hobbyist, and assembly code is completely foreign world to me.

sentences:
Idle/Clicker games, supporting numbers many factors bigger than trillions in C# using Unity Apologies for sloppy work and probably a poor grasp of fundamentals.

I have a (likely primitive) way to convert the ever increasing number values of my enemy hp into a string format to display in game. (K for thousands, M for millions, B for billions etc)

 if (target_healthmax >= 1000)
     {
         if (target_healthmax >= 1000000000)
         {
             enemy_hp_text.text = "Health: " + (target_healthcur * 0.000000001f).ToString("#.00") + "/" + (target_healthmax * 0.000000001f).ToString("#.00") + "B";
         }
         else
         {

             if (target_healthmax >= 1000000)
             {
                 enemy_hp_text.text = "Health: " + (target_healthcur * 0.000001f).ToString("#.00") + "/" + (target_healthmax * 0.000001f).ToString("#.00") + "M";
             }
             else
             {
                 enemy_hp_text.text = "Health: " + (target_healthcur * 0.001f).ToString("#.00") + "/" + (target_healthmax * 0.001f).ToString("#.00") + "K";
             }
         }
     }
     else
     {
         enemy_hp_text.text = "Health: " + target_healthcur + "/" + target_healthmax;
     }

but I stopped here after I noticed that although I could convert long numbers I would eventually hit a number too large to handle such as "-2.147484e+09" in my editor, and it would stop working.

I am using floats currently, is there a different type of variable that handles this easily? if not, what is an efficient way of solving this?

Would it be efficient to convert every new factor of 100 to a new variable and only handle the highest valued variable?
eg

if num >= 1000, k += 1, num = 0;

 if k>= 1000, m += 1, k = 0;
 ...

(Please feel free to let me know anything about my post I may need to amend, I am new here)

sentences:
Unity3D | Cost of accessing a script via a static reference to the instance I saw this pattern around and I was wondering what would be the pros and cons about it. Does this suffer performance issues ? If so what would be a better alternative?

using UnityEngine;
using System.Collections;

public class SomeClass : MonoBehaviour
{

    public static SomeClass instance;

    void Awake ()
    {
        instance = this;
    }

}

And in an other script use it like so:

SomeClass.instance.SomeMethod();

sentences:
Difference and interaction between Viewport and Camera I'm very very confused about some very basic concepts in game/grafical developing. The interaction between the individual components (camera, viewport, window-sizes, gameworld-sizes, ...) when rendering graphical things are still confusing me.

As far as I understand:

A camera "filming"/viewing something as long it is between the near- and the far-clipping plane
Camera has a Width and Height which defines the area of what will get "viewed"... ?

The viewport can connect to an camera
the viewport is the area which will get shown withing the window
the cameras view will get projected onto the viewport
so if the camera has a size of 1024x768 and the viewport ist only 300x400, the 1024 pixels will get upset on 300 "real" pixels

As you may have have recognized Im very unsure about this. Maybe you can help me with that.

I want to run the test-app down bellow in a way, that the picture will not get stretched. Also Im wondering what "game coordinates" are in that context.
For Demo-Cases and learning I've just created a piece of src:

package com.mygdx.game;

import ...

public class MyGdxGame extends ApplicationAdapter {
    public PerspectiveCamera cam;
    public Model model;
    public ModelBatch modelBatch;
    public ModelInstance instance;
    private FitViewport viewport;

    @Override
    public void create() {
        modelBatch = new ModelBatch();

        // creating a camera; gets width and height from the window
        // so it will "fit" best in the current window
        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(10f, 10f, 10f);
        cam.lookAt(0, 0, 0);
        cam.near = 1f;
        cam.far = 300f;
        cam.update();

        // creating viewport; width n height r not really necessary since it gets new
        // values within
        // the rezise() method; correct?
        viewport = new FitViewport(1920, 1080, cam);

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)),
                Usage.Position | Usage.Normal);
        instance = new ModelInstance(model);
    }

    @Override
    public void render() {
        Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

        // what is happening here?
        cam.update();

        modelBatch.begin(cam);
        modelBatch.render(instance);
        modelBatch.end();
    }

    @Override
    public void dispose() {
        model.dispose();
    }

    @Override
    public void resize(int w, int h) {

        // putting new values into the viewport
        // and updating it will "resize" the camera ... ?
        float aspectRatio = (float) w / (float) h;
        // viewport.update((int) (h * aspectRatio), h);
        viewport.update(1920, 1080);
        viewport.update(w, h);
    }
}

sentences:
Combining Minecraft and Dwarf Fortress: Simulating autoplay in a pseudo-infinite procedurally generated world? One of the interesting things about Dwarf Fortress (and other procedurally generated games like Civilization) is that the game simulates multiple AI factions interacting with each other over time (what might be termed "autoplay") to generate an evolving world which changes over time, even whilst the player is playing the game.

On the other hand, simulating all the factions simultaneously is surely going to become a bottleneck as the map grows. With a bigger map and more factions, the performance requirements become exorbitant. Minecraft gets around this problem by simply storing the inactive chunk in memory as-is as soon as the player leaves the area. The minecraft world is a static, never-changing place. When a player comes back from a trip, the chunk is exactly as he left it. No world evolution occurs. Everything is always the same.

The most straightforward approach to this, which is to just to make chunks remain loaded in memory even after the player is no longer in them, has the same performance issues as mentioned earlier - as the player moves across thousands of blocks, you will sooner or later run into computation limits. Moreover, this does not solve the general problem of faction simulation - factions can expand or contract through many chunks, whereas keeping one chunk loaded in memory would not affect its neighboring chunks, so that doesn't quite achieve the same effect as autoplay.

The "solution" that I thought of is to come up with a closed form formula that simulates autoplay somehow. That is, a function f(time,coordinates), such that given the time and and coordinates of a block, will tell you what state that block should be in. The problem with this is that this assumes a truly predeterministic world evolution, in which players have control over only their local chunk and no others. In other words, no butterfly effect. Furthermore, when a player leaves a chunk, he has made some changes to it, but the function cannot take those changes into account when computing the state of the block the next time the player enters it, in other words all changes that the player made to the block are lost as soon as he leaves. This is obviously not ideal.

Am I asking for something impossible?

sentences:
Sending a players mouse movement to the server in an FPS So I have a server-client model FPS set up. It uses udp to send data between the two with the server having a constant tick rate of 100 ticks per second (It updates movement 100 times a second) on the server with the client doing update of its key states etc 30 times a second and for keys the system works well. But now my question is how would I send the mouse movement to the server as this in not an on/off system is is constantly changing.

So my question is how do you send the movement of the mouse to the server. Do you send the direction and speed that the mouse is moving each update and interpolate it or something else. The problem I can see with interpolating something like a mouse is that in an FPS it is required to be very accurate and interpolating is literally guessing. Any advice would be appreciated.

The other problem that I see is that to get a direction vector of a mouse you would have to wait for enough movement to get the vector.

Another idea has come to me and that is just sending the direction that the client thinks its looking when it shoots.

Any advice would be much appreciated.

sentences:
Best way to de-clutter name tags on units in RTS This is an RTS-MMO mobile game I am building, Each unit has health-bar and name of the unit and owner on top of it and a small circle indicating if the unit is friendly and/or has weapons activated or not.

Problem is, when there are a lot of units in one spot, the tags become so cluttered and the critical information becomes lost.

I have tried making the name tags more transparent but this does not help.
Tried putting some name tags above the unit, other tags under the units, also to no avail.
Tried removing the healthbars unless the unit is damaged, didn't help much either!

How does RTS games solve this issue?
I have seen some RTS games remove the healthbars for non-damaged units, but this didn't have any impact on how it looks, and having no name tags or at least no owner-name-tags will be a no-go as this information is critical when attacking/approaching other units, or when picking own units (as units might be equipped with different tools and be named by their owner to be recognized.)

sentences:
What is an actor in game development? I am reading a book about game development (Game Coding Complete, Fourth Edition) and there is an "Actors" topic which just explains how to use them briefly instead of explaining what it is.

Here's how the book introduces these actors:

  Games are full of objects that bring your world to life. A World War
  II game might be full of tanks and planes, while a futuristic science
  fiction game might have robots and starships. Like actors on a stage,
  these objects are at the heart of the gameplay. It seems fitting that
  we call them “game actors” because that’s exactly what they are.

  A game actor is an object that represents a single entity in your game
  world. It could be an ammo pickup, a tank, a couch, an NPC, or
  anything you can think of. In some cases, the world itself might even
  be an actor. It’s important to define the parameters of game actors
  and to ensure that they are as flexible and reusable as possible.

  There are as many ways for defining a game actor as there are games.
  Like everything else in computer programming, there is rarely a perfect solution.

I could only understand a very few things: it is an abstraction of everything in the game which can perform actions; it has it's own state; it's behaviour is usually implemented as a state machine. This is it. I am coming with systems programming background to the game development, and so I would like to know in general, what the actor is in game development meaning, how to use it, how it is used in general, what problem it solves, how and why. I would like the explanation to be such that a kid could understand.

I have tried to find this information on google but it heads me to another "actors" instead: concurrent programming most of the time or game actors but without a good explanation of it.

sentences:
How can I write a terrain into a .raw file? I want to generate a terrain through Perlin noise and store it into a .raw file.

From Nehe's HeightMap tutorial I know the .raw file is read like this:

#define MAP_SIZE        1024

void LoadRawFile(LPSTR strName, int nSize, BYTE *pHeightMap)
{
    FILE *pFile = NULL;

    // Let's open the file in Read/Binary mode.
    pFile = fopen( strName, "rb" );

    // Check to see if we found the file and could open it
    if ( pFile == NULL )
    {
        // Display our error message and stop the function
        MessageBox(NULL, "Can't find the height map!", "Error", MB_OK);
        return;
    }

    // Here we load the .raw file into our pHeightMap data array.
    // We are only reading in '1', and the size is the (width * height)
    fread( pHeightMap, 1, nSize, pFile );

    // After we read the data, it's a good idea to check if everything read fine.
    int result = ferror( pFile );

    // Check if we received an error.
    if (result)
    {
        MessageBox(NULL, "Can't get data!", "Error", MB_OK);
    }

    // Close the file.
    fclose(pFile);

}

pHeightMap is one-dimensional, so I don't understand how I would write the x,y correspondence to a height value.  I was planning to use either libnoise or the noise2 function on Ken Perlin's page, to make each value in a 1024x1024 matrix correspond to the height for the point, but the .raw file is stored in a single dimension, how can I make x,y correspondence work there?

sentences:
Should I scale gravity for small objects? If I am working with objects that are small in real life, but in the Unity world they are scaled larger, should I increase the Gravity with the scale of the objects?

For example, if an object of size one would actually be 10 cm across, would gravity scaled to be 10x make the object behave more like a small object would in real life.

I know objects fall at the same rate, but the rate is the same so small objects fall more in proportion to their size don't they?

sentences:
Achieving Retro Resolution with HD I couldn't really find any tips on this (or perhaps I just lack the proper words once again), but I'm thinking about how to get some retro looks (SNES 16 Bit, specifially) using a modern system. Basically, the game still runs with the native resolution, however, vertially and horizontally we're limited to 256x224 (512x448). The colour palette is not an issue nowadays.

So I basically came up with this idea and am wondering if it's a smart approach (using OpenGL):

Create Orthogonal Projection Matrix with 256 units width and 224 units wide.
Use a fragment shader that doesn't do anti-aliasing on the textures, so the textures are upscaled to look pixel-y.

Since I couldn't really find a shader for 2), I also came up with a plan b):

Same as 1a)
Don't use textures at all, replace pixels with 1x1 coloured quads, convert spritesheets to 3D models made of quads.

I think plan a) seems more realistic, however. But I do wonder how other games (Shovel Knight, Freedom Planet) approach a pixel-y, retro look that stays true to the systems of 20 years ago.

sentences:
Bad FPS for smaller size (OpenGL ES with SDL) If you saw my other question, well, there is still a little problem:

Click here to watch on youtube

Basically, the frame rate is very bad on the actual device, where for some reason the animation is scaled (it looks like the left side on the video). It is quite fast on the simulator where it is not scaled (right side).

For a test, I submitted this new changeset that simply hard-codes the smaller size (in SDL_CreateWindow() and in glViewport()), and as you see in the video, now it is slow even in the simulator (left side shows the small size, right side shows the original size -- otherwise the code is the same).

I'm clueless why it's soooo slow with a smaller galaxy, in fact it should be FASTER.

The question is not about general speed optimization like reducing screen resolution or joining glBegin(GL_POINTS)/glEnd() blocks.

Update: For a test, I simply reduced the screen size to 320x480 and compiled it to OS X desktop -- got the same speed as with 800x800, so this size-specific slow-down is on iOS only. Will post this on the SDL mailing list now.

sentences: Custom node editor in Unity Im currently making a game on unity, and in the game i want to make quest system to be flexible, as the game world is generated randomly. I also want to make it easy to create quests for myself and possibly modders. So i want to make a menu for creating quests, however i couldnt find any info on how to make node editor window in unity(like shader graph, vfx graph, etc.). How do I do this?

sentences:
Overlay Image on Mesh Unity I have a whiteboard object that I would like to put images/pdfs/powerpoints on. I am not sure how to overlay an image on a white shader. I looked at this post:

Loading .PNG file and using it for UnityEngine.UI.Image

But I am not sure where to put the UI.Image. If I create a mesh from the image won't it cover up my entire whiteboard?

sentences:
How do I take Direct3D9 full screen using SlimDX? I'm writing a Direct3D9 application wrapped by SlimDX. I'm trying to take my application full screen but I am having problems. I can reset the device so that it covers the entire screen, however, it seems as though the device window loses focus. The cursor belongs to that of the window beneath my device window. When I click on the screen(while in full screen mode) the window beneath my device window gets focus. This shouldn't happen.

In my c# code for managing the device I have converted DXUT(from the DirectX SDK) to c#...There is a lot of code to cover but I was hoping for a theoretical answer.

What is happening to the device as I take the app full screen? Why does the window beneath the device window get focus while the device window continues to render and cover the screen?

Could my problem have anything to do with the fact that Windows Forms draws with GDI? I found a post here that describes a problem that differs in result but may be along the same lines wrt cause.

sentences:
Can problems arise in client-server network games due to the permanent sending of messages? I'm my Client-Server-based game I'm using the following stack:

libGDX (Engine)
Ashley (ECS)
KryoNet (Networking)
Box2D (Physics)

Server =========> Client
I've got a Box2DSyncSendingSystem on server-side and a Box2DSyncReceivingSystem on client-side.
This will create a list of all body-values from every entities with a BodyComponent in its update()-method and till than send this list via a BodyUpdateMsg to the clients. The client therefore receiving it and adjust all the values to the local bodies.
Client =========> Server
On the other Hand the clients will keep sending their Input values to the server via a InputSendingSystem so the server can adjust the velocities.

The problem that concerns me is that these steps happen every time the update methods are run. So several times a second. Somehow it doesn't seem very well resolved to me.
Sure: You could only send body updates if values have changed. But even if you follow this approach, you could not do without the repeated and permanent sending of the input update messages from the client to the server.
It is also clear to me that there are topics where client-side prediction should compensate for the high latencies, but the problem with the input updates is still there.
I don't want to implement a rocket science like high-end solution (the project is not big enough for that), but rather to implement a good and classic approach, which is typical for network games.
My previous approach may also not be wrong and absolutely common.
Thanks in advance!

sentences:
Using compressed(ETC1) textures in LibGDX I use standard android tool for compressing PNG texture and archiving it with gzip:

/android-sdks/tools/etc1tool texture.png --encodeNoHeader
gzip texture.pkm

Then I try to load it:

FileHandle file = ...;
ETC1.ETC1Data data = new ETC1.ETC1Data(file);
ETC1TextureData td = new ETC1TextureData(data, false);
Texture texture = new Texture(td);

But I get an java.nio.BufferOverflowException inside ETC1Data (FileHandle pkmFile) constructor:

  in = new DataInputStream(new BufferedInputStream(new GZIPInputStream(pkmFile.read())));
  int fileSize = in.readInt();
  compressedData = BufferUtils.newUnsafeByteBuffer(fileSize);
  int readBytes = 0;
  while ((readBytes = in.read(buffer)) != -1) {
      compressedData.put(buffer, 0, readBytes);//Exception occurs here
  }
  compressedData.position(0);
  compressedData.limit(compressedData.capacity());

How to fix it? Thanks.

ps if it's important: unarchived pkm file size is 33KB

sentences:
How should I calculate the new angle/direction of my ball hitting a wall? I'm building a Pong game and I am stuck at how the ball should bounce when hitting a  horizontal wall.
I tried a few methods but none seems to work.

So far I have an update method, which is called every 15ms and which does this:

float scale_x = Math.Cos(ball._angle).ToFloat();
float scale_y = Math.Sin(ball._angle).ToFloat();

//speed multiplied by scale_x is our x velocity
float velocity_x = (gameSpeed * scale_x);

//speed multiplied by scale_y is our y velocity
float velocity_y = (gameSpeed * scale_y);

ball._vector.x += velocity_x;
ball._vector.y += velocity_y;

and if the ball hits the horizontal wall

if (ball._vector.y + velocity_y < 0){
    Vector n = new Vector(ball._vector.x, ball._vector.y);
    n.nor();

    float dot = (ball._vector.dot(n));
    ball._vector = ball._vector.add(n.mul((-2 * dot)));
}

I've been using this formula R = 2 * (V dot N) * N - V to calculate the new direction. But I can't seem to get it to work. To be honest, I'm not sure what kind of formula I need. I just need to find the new angle when it hits the wall.

Here is the solution for my game.
first i made velocity_x and y instance variables.

private float velocity_x;
private float velocity_y;

then i sat the start for my direction in my constructor

float scale_x = Math.Cos(ball._angle).ToFloat(); //The x scale is the cosine of the angle
float scale_y = Math.Sin(ball._angle).ToFloat(); //The y scale is the sin of the angle

velocity_x = (gameSpeed * scale_x); //speed multiplied by scale_x is our x velocity
velocity_y = (gameSpeed * scale_y); //speed multiplied by scale_y is our y velocity

Finally in my updateBall method i leave:

ball._vector.x += velocity_x;
ball._vector.y += velocity_y;

sentences:
Background replacement with 3D moving objects using Intel RealSense SDK I have done background replacement with static image and video using RealSense and c#, but now the requirement is to replace the background with the 3D moving object in still background.

Is it possible with RealSense?

sentences:
Dijkstra's Algorithm - Infinite loop While running Dijkstra's Algorithm to assign a direction to every tile and when an object land on the tile, follow the direction to a goal. I encountered an infinite loop (or I think it is). The following is my code:

while (openList.Count > 0)
    {
        Debug.Log("Running alg");
        failsafe++;
        if (failsafe > 1000) { break; }

        Tile currentTile = openList[0];
        openList.Remove(currentTile);
        closedList.Add(currentTile);

        List<Tile> neighbours = GetNeighbours(currentTile.localX, currentTile.localY, grid);

        foreach (var neighbour in neighbours)
        {
            if (!closedList.Contains(neighbour))
            {
                neighbour.parentX = currentTile.localX;
                neighbour.parentY = currentTile.localY;
                openList.Add(neighbour);
            }
        }
    }

Under these conditions, the failsafe triggered and broke the loop. The grid is a 11x11 grid and as such by my understanding should have never reached 1000 cycles.

When the failsafe triggers, it explored 9 tiles away from the goal and the rest are unexplored.

What am I doing wrong here?

sentences: How do 3d game engines draw this pattern? I am doing a small project, where there is a 3d engine, however I do not know how to draw something if it is like the image below. Usually I would draw from farthest back to closest. But here there is no order? How would modern 3d Engines draw this?

sentences:
Mark positions of spawnpoint in editor I am creating a digital boardgame, which consits of muliple boards, between which the gamepieces are moved by the players.
The script of the game board needs a 2D array of positions to know where to move a gamepiece when it recives one.
Currently to mark the positions on the game boards, I added placeholder gameobjects to the prefab and named them "spawnpoint\d".In the Awake() method I use Transform.Find() to search for those gameobjects. Then, after I save their positions I call Destroy() on them, so they do not show up in the game.
I see two problems:

This is done for all Instantiated game board, altough the positions are the same on all of them.
I read that using Transform.Find() is heavily discourged by the experts in the community.

I wish to store the spawnpoint positions in a static array, so all instances refer to the same data. Furthermore I wish to easily modify these positions in the editor with visual help.
I tried serializing static members, but those do not show up in the editor to be able to modify.
    [SerializeField]
    public static int TestNumber;

TLDR:
How to make static members visually changeable from the Unity editor?

sentences:
Best way to initialize values on 32-bit FP framebuffer in OpenGL I have a framebuffer bound to 32-bit FP texture:

glGenTextures(1, &texColor);
glBindTexture(GL_TEXTURE_2D, texColor);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, w, h, 0, GL_RGBA, GL_FLOAT, (GLvoid*)NULL);
glBindTexture(GL_TEXTURE_2D, 0);

glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texColor, 0);

What's the best way to initialize framebuffer to a value 1000.0?

The problem is that

glClearColor(1000.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);

clamps values to [0,1] interval, and clearing the texture texColor would require memory allocation of w * h * sizeof(float) bytes of memory and manual filling of that buffer with value 1000.0 which is slow (I would inject it using glTexImage2D).

I'm using OpenGL 3.2 Core profile.

Thanks,
Josip

sentences:
Flowfield density conversion I'm trying to implement flowfield navigation, as described in http://grail.cs.washington.edu/projects/crowd-flows/
but I can't understand how the Density Function in Figure 4 of the paper is supposed to handle unit radius.

Has anyone ever implemented that and can provide more information?

This is the part in question:

Their algorithm seems to be using only 4 cells, pointing to the lower left of the unit, so is this some kind of kernel that needs to be applied multiple times?

Thanks.

sentences:
Character progression through leveling, skills or items? I'm working on a design for an RPG game, and I'm having some doubts about the skill and level system. I'm going for a more casual, explorative gaming experience and so thought about lowering the game complexity by simplifying character progression. But I'm having trouble deciding between the following:

Progression through leveling, no complex skill progression, leveling increases base stats.
Progression through skills, no leveling or base stat changes, skills progress through usage.
Progression through items, more focus on stat-changing items, items confer skills, no leveling.

However, I'm uncertain what the effects on gameplay might be in the end. So, my question is this:

What would be the effects of choosing one of the above alternatives over the others?
(Particularly with regards to the style and feel of the gameplay)

My take on it is that the first sacrifices more frequent rewards and customization in favor of a simpler gameplay; the second sacrifices explicit customization and player control in favor of more frequent rewards and a somewhat simpler gameplay; while the third sacrifices  inventory simplicity and a player metric in favor of player control, customization and progression simplicity.

Addendum: I'm not really limiting myself to the above three, they are just the ones I liked most and am primarily interested in.

sentences:
Simultaneous events in a realtime system, where processing order causes different outcomes I am working on a realtime dungeon crawler, focusing on a relatively complex and flexible skill system. Somewhat similar to MMORPGs with many compound spells, area effects, buffs/debuffs, ect. I am working on the last few subsystems of the engine.

I found a problem with actions happening in the same logic frame which change an actor's attributes.

For example, let's say two actors use a skill on eachother in the same logic tick, which deals 100 damage and leaves a debuff which halves damage done.
If I simply iterate over each actor and process their abilities, the one which gets processed sooner will deal full damage, the other will do so with the debuffed state, dealing only 50.
Ideally, I'd like both of them to work similarly, dealing full damage and leaving the debuff.
What annoys me is the undetermined nature arising from the order of iteration.

One solution I thought about was to defer all the stat value changes and buff/debuff application until all the abilities are processed, since these are the only things which can affect the behaviour of abilties.
So essentially I loop over actors, process their ability methods, but queue up the stat and status effect changes in a list.
Once I processed every ability I iterate over once more, this time changing the actual stats from the queued values.

This fixes the determinism problem, but causes another.

To use another example (since I can't exactly phrase the general case):
Let's say the player has 100 mana, and gets hit by ten manaburn attacks in one frame, each burning at most 50 mana, and dealing damage equal to the mana burned.
If I don't use the former fix, it'll work correctly, two will burn out the 100 mana of the player dealing 100 damage, the rest eight will do nothing.

With the fix however, since the player's mana value doesn't change yet, all ten attacks will land and deal 500 damage, more than the amount of mana the player has, which is an even more silly situation than before.

I'm quite an amateur, I have less experience than wit for designing complex systems.
Is it possible to have determined behaviour for actions happening in the same frame while avoiding nastier consequences like the second example?

I know the player will unlikely notice the errors in the first case, and I don't think other developers bother with this issue either.

I'm still curious though, is such thing possible, a pipe dream, or just I have a warped idea about how the game logic should work?

Thank you!

sentences:
Do sprite animations usually run at the same framerate as the game itself? Just getting into game development and wondering about fps. For example, Binding of Isaac can run at 60 fps, but looking at its sprite sheet, the walk animation is only 12 frames. The game animation definitely doesn't look like its running at 60 fps, but I think the collision, movement, etc. systems are?

I'm working on a game I plan on running at 60 fps, is this a good frame rate for a first game, and how do you fit sprite frames into a higher frame rate? I assume if you have a 12 frame/second animation, you can run each sprite frame for 5 in game frames.

I've seen people talk about issues in running a 12 frame cycle in a 30 fps game, because the ratio isn't a whole number, so it doesn't scale. Will this be a problem if someone wants to run the game at a lower frame rate? Or is the frame rate locked and the game slows down if a computer can't run it?

Sorry if I'm asking some obvious questions, I'm pretty new to this.

sentences:
Making A Sprite Rotate To A Specific Angle XNA 4.0 I have a game that the character spins when you press either of the triggers on the xbox remote. Here's the code.

if (gamepadState.IsButtonDown(Buttons.RightTrigger))
        RotationAngle += spinSpeed;

if (gamepadState.IsButtonDown(Buttons.LeftTrigger))
        RotationAngle -= spinSpeed;

what i want to happen is when neither of the triggers are being pressed he rotates back to a rotation angle of 0. I know How to make him go back to 0 when neither triggers are pulled but its too abrupt. How can i make the sprite actually rotate back to an angle of 0?

sentences:
prefab editor not working for NGUI in unity2018 i just updated my project from unity5 to unity 2018. my project uses ngui as UI solution. eveything works fine in updated version but when i want to edit prefabs in prefab mode i get this message:

is there any idea about cause of this problem and how to solve it?

i looked for updating ngui for unity 2018 but because of many changes ngui has, it causes lots of problem in project that takes lots of time to solve the mall

sentences:
2D narrow-phase line intersection with square bounding box for calculating height efficiently I've performed partitioning of my level into broad and narrow phase. I'm down to narrow phase and focusing on the height from the ground.

I want to see what polygon the player is on top of. Since some polygon sectors may be lower than others (this is a birds eye view), I want the player to be stand on top of the highest one. Therefore I thought what I can do is each game tick would be to check which boxes the player intersects, and then find the polygon with the highest 'height' and use that as the base height for the player.

An example would be below:

Is this a viable way of doing it? That this game is 3D, but I only have to do two dimensional calculations for the height which reduces the computation and makes this easier.

The level has been cut up into a BSP tree so the following is a gross misrepresentation of the level, however I don't see any obvious way (immediately) to exploit the BST property to find out the highest sector that the player would be standing in. So far the best way I could think of was to use narrow phase collision detection described above and hope that is extremely fast.

I am looking for speed here, so if you know of any better algorithms or some faster way of doing this, please let me know.

EDIT: The focus of this post is for high level algorithms, of which they can be optimized later on. No actual collision detection code has been made yet.

sentences:
Making a wrapping wire (like the Worms Ninja Rope) work correctly with moving geometry I have implemented a 2D wire like the one described in this question which is made up of straight line segments between wrapping points. However, while the algorithms described in this answer work just fine for colliding with static geometry, it does not behave correctly when interacting with moving geometry. The method described in this answer does work correctly in some cases, but not when the rope does not move, since the collision detection method does not account for the movement of points.

How would you make the wire behave correctly when interacting with moving geometry?

sentences:
In the new InputSystem of Unity, how to detect the keyboard and the mouse "as the same input device"? I'm trying to use the PlayerInputManager of the new InputSystem (preview 7) and my keyboard and mouse are being detected as separate devices. I'm not saying that it is wrong, but it is not useful at all and I would like to know how to fix it.

As shown in this video, the PlayerInputManager has the ability of Instantiating new players when they press a button of their controller. This is almost exactly what I need, but it is not perfect.

All works fine using controllers but if someone wants to join using the keyboard/mouse, "they won't be able".

When a key is pressed in the keyboard, a player joins, and when the mouse is used, another player joins (despite the fact that in that game youn need both to control a character and neither one of the spawned characters would be playable).

So my question is: how can I configure the InputSystem so that only one player joins when either a keyboard or mouse is used and it reads the input from both devices?

Maybe it is simply a missing feature, but I think that it would be nice if you could achieve what I want because a lot of times the keyboard is used alongside a mouse.

Thanks in advance!

sentences:
Where to cast light/shadows in a 2.5D view? I'm working on a tile-based 2D pseudo top-down/side-on game very much in the graphical style of Prison Archiect. More specifically, I'm referencing their style of drawing wall tiles where you can see the south, east and west sides of the wall at once. Here's an example from my engine:

I'm also working on a pixel-based (i.e. not tile-based) lighting and shadows implementation. I'm currently struggling with trying to decide how/where to project from a light source on intersections with these wall tiles.

I can't decide where on these tiles should occlude light cast out by light sources. If the red highlighted areas are the "top" of the wall, and the blue highlighted areas are the "side" of the wall, I believe I have two options:

A) Only occlude light from the "top" of the wall

It's worth mentioning that I also plan to use UV-mapping so that only the walls facing the light source will be illuminated, rather than the pre-shaded tiles I'm using as an example. However, that would mean that the tiles adjacent to a wall in shadow may be lit and I don't think this would look quite right. Alternatively...

B) Occlude light from the entirety of the wall tile

This seems more realistic for the ground tiles but does not let me easily illuminate the wall "sides".

I'm not really happy with either solution so my question is: is there another alternative which will give more realistic shadow-casting in a 2.5D view? I'd also rather keep the sides of the walls visible rather than use a top-down only perspective as I feel this would force the rest of the art into a top-down perspective, rather than pseudo side-on.

sentences:
Octahedral impostors, Octahedral mapping I'm facing some issues understanding this article about octahedral impostors.

More specifically I quite don't understand how one can map the hemi-octahedron (subdivided) vertices to texture coordinates.

Quote from the article :

  "For those not familiar with octahedra, they are a convenient way to convert between 2D and 3D space, or vice versa."

This two images help visualize the transformation:

Here we can see an animated transition from a tesselated quad mesh to a hemisphere or a full sphere.

Here we see a view of the model to be imitated associated with each vertex of the mesh, giving coverage of viewpoints around the hemisphere: side views around the perimeter of the square, and top-down views near the center.

I don't understand the math used to perform this mapping from the square domain of the quad to the hemisphere or sphere of directions around the model.

This article also says that we can easily map 3D to 2D uvs, without explaining how or why. I found a few research papers about octahedron and normals compression but it is quite a different problem and honestly I didn't really get the grasp of them.

Could someone explain to me how to map a vertex expressed in 3D (ie impostor camera position) from the octahedron to a plain 2D texture?

The goal is to be able to cast a ray to the octahedron and map the hit point coordinates to 2D uvs, or find the nearest vertex and render the texture associated with it.

sentences:
Play and Stop Animation on Condition - Unity I've applied a scale animation on Play button of my game. I want to stop animation when play button is not interactable. It stops playing animation, but animation is not playing again, even when play button gets interactable. Here is my snippet to Play and Stop Animation.

if (!PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Stop ();
} else if (PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Play ("Play_Button_Animation");
}

What should i do to play animation again. Thanks in advance :)

sentences:
Collision/Intersection of (2D) Ray to Line Segment Given a ray (r0, r1) and a line segment (a, b), I need to calculate the normal of the line segment based on the direction of the ray. For example, in the following picture:

The correct normal given the ray (from picture) and segment should be normal n1. Here is the algorithm I am using to calculate the point of intersection:

public static Vector2? lineSegmentIntersection(Vector2 r0, Vector2 r1, Vector2 a, Vector2 b)
{
    Vector2 s1, s2;
    s1 = r1 - r0;
    s2 = b - a;

    float s, t;
    s = (-s1.Y * (r0.X - a.X) + s1.X * (r0.Y - a.Y)) / (-s2.X * s1.Y + s1.X * s2.Y);
    t = (s2.X * (r0.Y - a.Y) - s2.Y * (r0.X - a.X)) / (-s2.X * s1.Y + s1.X * s2.Y);

    if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
    {
        // Collision detected
        // Return the point of intersection
        return new Vector2(r0.X + (t * s1.X), r0.Y + (t * s1.Y));
    }

    return null; // No collision
}

Ideally, I would like to modify this algorithm to calculate the proper normal. Further, I know how to calculate the normals n0 and n1:

norm0 = new Vector2((b.Y - a.Y), -(b.X - a.X));
norm1 = new Vector2(-(b.Y - a.Y), (b.X - a.X));

What do I do next to determine which of those two normals to choose? I get the feeling this is fairly simple and I've been looking at it for too long...

sentences:
Procedural Islands Voronoi Pattern I'm trying to keep this as simple as possible, as I've found out the last few days this is a very difficult topic. I'd like to generate multiple flat islands, formed by a voronoi diagram. I've followed a long and (for me) difficult tutorial of building a procedural hexagonal grid just to find out it looks to artificial.

I'd like to create a plane with faces divided in a voronoi diagram, and extrude multiple groups upwards to create islands. With that I'd like to achieve something similar as this: http://applemagazine.com/wp-content/uploads/2015/10/image2.jpg

Please help to get me started in the right direction, since my approach might be wrong in itself.

EDIT:

I've found this: https://github.com/jceipek/Unity-delaunay. Which draws lines in a voronoi diagram. Now I'm guessing the next step is to convert this to a mesh. Then I'd have to highlight random faces to be extruded to create the islands. Maybe this could be done with perlin noise, which I've just learned about. Extruding might not be the best way. Maybe deleting the faces that won't be land, and creating fall of edges (Like Wardy said).  I'm doing my best to figure this out on my own, but any help is greatly appreciated.

sentences:
Collision detection against large arbitrarily shaped textures What is the most effecient way to do collision detection on strangely shaped textures in XNA? Here is an example texture:

As you can see, it is far from a perfect square. I want the player to collide with the brown parts and pass through the transparent ones.

How do I create a bounding box that wraps around irregular terrain? Should I create many smaller bounding boxes instead?

sentences:
Question about mipmaps + anisotropic filtering I'm a bit confused here and maybe someone can explain this to me. I created a simple test texture for my terrain which is nothing more than a solid green color with a black grid overlayed on top of it. If I look at the terrain in the distance with mipmapping on and linear filtering, the grid lines become blurry fairly quickly and further back the grid is pretty much invisible. With these settings, I don't get any moire patterns at all. If I turn on anisotropic filtering, however, the higher the anisotropic level, the more the terrain looks like it did with without mipmapping. The lines are much crisper nearby but in the distance I start to see terrible moire patterns.

My understanding was that mipmapping is supposed to get rid of moire patterns. I've always had anisotropic filtering on in every game I play and I've never noticed any moire patterns as a result, so I don't understand why it's happening in my game.  I am using logarithmic depth however, could that be causing any problems?  And if it is, how do I resolve it?

I've created my sampler state like so (I'm using slimdx):

ssa = SamplerState.FromDescription(Engine.Device, new SamplerDescription
{
       AddressU = TextureAddressMode.Clamp,
       AddressV = TextureAddressMode.Clamp,
       AddressW = TextureAddressMode.Clamp,
       Filter = Filter.Anisotropic,
       MaximumAnisotropy = anisotropicLevel,
       MinimumLod = 0,
       MaximumLod = float.MaxValue
});

Point Filtering

Anisotropic 1

Anisotropic 8

Anisotropic 16

Anisotropic 16 at an angle

sentences:
How to avoid self-intersection when applying stroke to a curve? I have several Spline2D objects in my code, each of which has a Position, Velocity, and Acceleration method that returns a vector of the specified quantity at a particular time. I've been using these vectors in order to construct geometry to create gradient strokes for the curves, but I'm having problems with self-intersections at steep curves. As an example, here's one curve where I'm having this occur:

Wireframe: http://twitpic.com/2zplw1/full
Filled: http://twitpic.com/2zpmnt/full

As you can see, on the second bend, the inner portion intersects itself, which causes that ugly artifact. Is there a good algorithm/method to stroke curves without causing that self-intersection?

EDIT: More extreme examples, plus a mock-up of what I'd like to achieve:

Wireframe: http://twitpic.com/2ztwzi/full
Filled: http://twitpic.com/2ztwkt/full
Ideal Outcome (Mock-Up): http://twitpic.com/2ztxa8/full

sentences:
Is it possible to copyleft license a game engine and still allow users to sell games made with it? I have recently been studying and working on implementing my own game engine. I am interested in making my work open source so that others may use and modify it freely. However, I also want to make sure any modified or improved versions of my engine would also be free to use or modify. This led me to believe a copyleft license would be most appropriate. However, despite wanting all future versions and modifications to the engine source code to be open source, I want people to be able to sell or profit off the games made with the engine. In other words, while the source code of the engine for the sake of the engine itself should remain open source, anything made with the engine for the sake of being played should be allowed to be closed source. Is there an appropriate license for this?

The reason I include the architecture tag is to also ask: If no simple license exists, then is there a way to architect my engine such that what I want to accomplish with licensing is possible? For instance, if my engine uses a scripting language with some entity component system written in the engine's compiled code, then maybe the scripts (which a gameplay programmer using my engine would write to dictate game logic) would be allowed to be closed source? But then anyone playing the game would still require the compiled engine in order to run said scripts. I do not know if this particular example could work, but it is just to give an idea of what I am getting at.

sentences:
Why does WorldToScreenPoint return "strange" results? I would like to show a menu to the right side and at the same y coordinate as a certain gameobject (shown as a green cube in the screenshot).

Therefore I'm trying to get the screen coordinates of the object in my scene using WorldToScreenPoint.

The code I'm using is this:

Vector3 nPos = new Vector3(GlowCube.position.x + GlowCube.localScale.x, GlowCube.position.y, GlowCube.position.z);
Vector3 nOff = Camera.main.WorldToScreenPoint(nPos);

The resulting values however don't look right to me.
I have created a red rectangle in order to demonstrate where the coordinates "nOff" would actually be in the screen:

At first I thought I get these strange results because the GlowCube is parented to the case, but since I use GlowCube's world coordinates (GlowCube.postion...) and not its local coordinates (GlowCube.localPosition...), I thought that this wouldn't matter.

What am I forgetting here?

Thank you!

sentences:
Why are meshes limited to 65k indices or uint16 in most game engines? Why are most game engines like unity limiting their meshes to 65k indices by default, or enforcing to use uint16 as the default datatype for indexbuffers?

I know that its better for performance to use uint16 indexbuffers, but I think there might be more reasons, because webGL 1.0 specification allows only uint16 vertexbuffers. I know that it's possible to use uint32 indexbuffers in webGL if the "OES_element_index_uint" extension is available in webGL 1.0 devices.

How big is the performance impact when using uint32 indexbuffers instead of uint16 indexbuffers? I think the only difference is in the memory bandwidth during the initial upload of the indices and should not matter much during runtime.

sentences:
Screenshot always returning as a white image on iOS using robovm and libgdx I am trying to take a screenshot for sharing on social media.  This code works on my Desktop project, but when I use it on iOS it always shows up as a white image, I am using the standard libgdx code for the screenshot factory, any suggestions?

public class ScreenShotFactory
{
public static void SaveScreenshot()
{
    try
    {
        Gdx.files.local("shot.png").delete();
        FileHandle fh;
        do
        {
            fh = new FileHandle(Gdx.files.getLocalStoragePath() + "shot.png");
        }
        while (fh.exists());

        Pixmap pixmap = getScreenshot(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);

        PixmapIO.writePNG(fh, pixmap);

        pixmap.dispose();
    }

    catch (Exception e)
    {
    }
}

private static Pixmap getScreenshot(int x, int y, int w, int h, boolean yDown)
{
    final Pixmap pixmap = ScreenUtils.getFrameBufferPixmap(x, y, w, h);

    if (yDown)
    {
        // Flip the pixmap upside downx
        ByteBuffer pixels = pixmap.getPixels();
        int numBytes = w * h * 4;
        byte[] lines = new byte[numBytes];
        int numBytesPerLine = w * 4;
        for (int i = 0; i < h; i++) {
            pixels.position((h - i - 1) * numBytesPerLine);
            pixels.get(lines, i * numBytesPerLine, numBytesPerLine);
        }
        pixels.clear();
        pixels.put(lines);
        pixels.clear();
    }
    Logger.Log("ScreenShot Taken!");
    return pixmap;
 }
}

sentences:
Is there any documentation comparing/contrasting C++ standard library implementations? (This is not game programming per se, but I'm certain if I asked this on SO I'd get told not to prematurely optimize, even though history tells us every large game ends up worrying about these things.)

Is there a document anywhere that summarizes the differences in performance, and particularly memory usage, between different C++ standard library implementations? The details of some implementations are protected by NDA, but a comparison between even STLport vs. libstdc++ vs. libc++ vs. MSVC/Dinkumware (vs. EASTL?) seems like it would be immensely useful.

In particular I'm looking for answers to questions like:

How much memory overhead is associated with the standard containers?
What containers, if any, do dynamic allocations merely by being declared?
Does std::string do copy-on-write? Short string optimization? Ropes?
Does std::deque use a ring buffer or is it crap?

sentences:
Problems moving a rectangle in Pygame I'm making a game in Pygame and I want to be able to target enemy unit.
I made it so when I click on them a variable "targeted" becomes true, and stays true until I click somewhere else on the screen. I also want targeted units to have a small green circle around them, so I made it in GEDIT. I have made a function that draws everything on the screen (the background, the player, objects, etc) and in the part where it draws the units it checks if the variable "targeted" is true and if  it is it should move that little green circle over the enemy units.

here is the code that does that:

screen.blit(enemy_unit.pic, enemy_unit.rect) #draw the unit

if enemy_unit.targeted == True: #if the unit has been targeted then draw a circle over it
    target_rect.move_ip(enemy_unit.pos)  #move the circle to the unit
    target_rect.fit(enemy_unit.rect)     #there are some bigger units and some smaller ones, so we have to "scale" the circle
    screen.blit(target_pic, target_rect) #actually draw the circle

This doesn't work, when I target the unit the circle just appears for a 1/5 of second next (not on, but just next) to the unit and then disappears. I am sure that I am keeping a good track of "enemy_unit.pos" because I tested it (I added a piece of code that would print one units position and mouse's position every time i clicked the mouse and when i was near him the numbers were same).

If you could give me a hint about what I'm doing wrong. I think its in move_ip function, but I tried just move and it didn't work either (the circle didn't even show at all)!

sentences: What are the restrictions of 3g online games I am looking into make a 3g online multiplayer game for the iphone. Multiplayer is my main focus but I have noticed all game apps require wi-fi. Dose anyone know if this is simply an issue with the speed of the 3g network or dose apple put restrictions on their 3g network that prevents developers from doing this?

sentences:
Distrubuted Rendering in a CAVE system I am currently working with CAVE systems and I'm looking into hooking up a pre-exisiting game engine in one. I know this is possible through Unity and the Unreal Engine as there is already research out there showcasing that it has been done.

Right now, I have not decided upon one game engine to use and I'm currently looking around and researching if it is possible with the likes of CryEngine and Valve's Source Engine. The one issue that I am going to face, however, is getting the image to correctly render across all four of the monitors / screens.

Thusly, as a result I have two questions:

Does anyone know of any good research / books on distrubuted rendering? It doesn't need to be specificly for games, just the topic in general would be very useful
Does anyone know if other developers have managed to get Source and the CryEngine to run in a CAVE system? Through all my research I haven't been able to find anything on this, but then my google skills aren't the greatest.

If anyone could spare the time to answer these questions, I'd be extremely greatful.

Thanks.

sentences:
XNA partially extending the content pipeline using a ModelContent I am trying to extend XNA's content pipeline in order to import a model in .obj format (a very simple and text-based format, see here for details). Writing a full extension library seems like an overkill to me so I decided I would only create a custom importer and a processor which returns a ModelContent so that I could use the default writer and reader.
My processor sort of works but not exacly as expected: what should look like an aircraft is actually a bunch of triangles stick together! Before writing this I had a simple class derived from DrawableGameComponent which loaded the model in its LoadContent, but that's not exacly XNA-ish. The point is that the code worked, so there must be a problem in the construction of the MeshContent.
I have followed the pattern I found in this question during my researches.

Here's the relevant part:

[ContentProcessor( DisplayName = "dotObjProcessor" )]
public class dotObjProcessor : ContentProcessor<dotObjContent, ModelContent> {
    public override ModelContent Process( dotObjContent input,
        ContentProcessorContext context ) {

        var mc = new MeshContent( );
        foreach ( dotObjContent.Vertex p in input.Vertices )
            mc.Positions.Add( new Vector3( p.X, p.Y, p.Z ) );

        var gc = new GeometryContent( );
        foreach ( dotObjContent.Face f in input.Faces ) {
            gc.Vertices.Add( f.V1 );
            gc.Vertices.Add( f.V2 );
            gc.Vertices.Add( f.V3 );

            gc.Indices.Add( f.V1 );
            gc.Indices.Add( f.V2 );
            gc.Indices.Add( f.V3 );
        }

        mc.Geometry.Add( gc );
        MeshHelper.CalculateNormals( mc, true );

        return context.Convert<MeshContent, ModelContent>( mc, "ModelProcessor" );
    }
}

A dotObjContent is the output of my importer, it simply contains two collections for vertices and indices.

sentences:
NodeJS setTimeOut - How to run callback before delay time exceeded I'm developing a card game server.
I want to do this :
While server process a turn for players, players have 20 seconds to do something. If players send a request to server within 20 secs, timer will stop and the callback will fire.

I'm doing like this :

self.tables[table.id].currentTimer = setTimeout(function () {
    callback();
}, 20*1000);

How should I run the callback before delay time exceeded ?

sentences:
How can I exit an Unreal game with a specific exit code? How could I quit out of a Unreal game with a specific exit code? In Unity you can just Application.Quit(exitCode); but I could not find anything regarding Unreal.

I know you can use the QuitGame-node or FGenericPlatformMisc::RequestExit(false); in C++ but without the custom exit code that I am looking for.

Any ideas?

sentences:
Graphic Engine/Programming/Etc resources? Posting this question here rather than SO because of it's relevance with game development.

My dilemma is this: It is currently my summer vacation after my first semester of CompSci and I have learned enough C++ to actually get started in a little more advanced stuff.

I don't want to start games programming yet until I teach myself linear algebra, trigonometry, etc. However, I do want to know the fundamentals, the theory and the methods used in game programming!

I thought I had some decent books in the college library, but they were horribly outdated with books on game programming or game engines or game/graphic (topic here) from the early 90s to 2002.

Knowing the volatile state of computer technology, I figured grabbing knowledge on cutting-edge technology from a decade-old book isn't a good idea. Amazon itself leaves me clueless as to what book I want.

What I don't want:  A platform-dependent book. I'm not out to learn OpenGL, Direct3D or any specific API. I just want to know things like tessellation, how the GPU handles stuff, what goes on under the hood and what kind of raytracing and radiosity methods there are. The basics, the core concepts- those kinds of things.

I hope that's clear! Books, resources are all welcome. Though I much prefer a book over a website!

sentences:
Raycasting in Unity3D? I have a game object on screen represented by a cube (but say it was a quad or something else all the same).

How do I raycast to check intersections? Keeping in mind I may not be raycasting fora  physical object, just a gameobject of any sort.

Another question I have is, how can you raycast in Unity3D just to check against an intersection against anything in general (say the first gameobject to be hit)?

sentences: What is the color value of daylight? This is a very short question. I want to implement ambient light in the color of daylight from the sun. What is the color value of sun light?

sentences:
Objective-C Moving UIView along a curved path I'm not sure if I am approaching this the correct way. In my app, when a user touches the screen I capture the point and create an arc from a fixed point to that touch point. I then want to move a UIView along that arc.

Here's my code:

ViewController.m

//method to "shoot" object - KIP_Projectile creates the arc, KIP_Character creates the object I want to move along the arc

...

//get arc for trajectory
    KIP_Projectile* vThisProjectile = [[KIP_Projectile alloc] initWithFrame:CGRectMake(51.0, fatElvisCenterPoint-30.0, touchPoint.x, 60.0)];
    vThisProjectile.backgroundColor = [UIColor clearColor];
    [self.view addSubview:vThisProjectile];

...

 KIP_Character* thisChar = [[KIP_Character alloc] initWithFrame:CGRectMake(51, objCenterPoint-5, imgThisChar.size.width, imgThisChar.size.height)];
    thisChar.backgroundColor = [UIColor clearColor];
    thisChar.charID = charID;
    thisChar.charType = 2;
    thisChar.strCharType = @"Projectile";
    thisChar.imgMyImage = imgThisChar;
    thisChar.myArc = vThisProjectile;
    [thisChar buildImage];
    [thisChar traceArc];

in KIP_Projectile I build the arc using this code:

- (CGMutablePathRef) createArcPathFromBottomOfRect : (CGRect) rect : (CGFloat) arcHeight {

    CGRect arcRect = CGRectMake(rect.origin.x, rect.origin.y + rect.size.height - arcHeight, rect.size.width, arcHeight);

    CGFloat arcRadius = (arcRect.size.height/2) + (pow(arcRect.size.width, 2) / (8*arcRect.size.height));
    CGPoint arcCenter = CGPointMake(arcRect.origin.x + arcRect.size.width/2, arcRect.origin.y + arcRadius);

    CGFloat angle = acos(arcRect.size.width / (2*arcRadius));
    CGFloat startAngle = radians(180) + angle;
    CGFloat endAngle = radians(360) - angle;

    CGMutablePathRef path = CGPathCreateMutable();
    CGPathAddArc(path, NULL, arcCenter.x, arcCenter.y, arcRadius, startAngle, endAngle, 0);

    return path;

}

- (void)drawRect:(CGRect)rect {

    CGContextRef currentContext = UIGraphicsGetCurrentContext();

    _myArcPath = [self createArcPathFromBottomOfRect:self.bounds:30.0];

    CGContextSetLineWidth(currentContext, 1);
    CGFloat red[4] = {1.0f, 0.0f, 0.0f, 1.0f};
    CGContextSetStrokeColor(currentContext, red);
    CGContextAddPath(currentContext, _myArcPath);
    CGContextStrokePath(currentContext);

}

Works fine. The arc is displayed with a red stroke on the screen.

In KIP_Character, which has been passed it's relevant arc, I am using this code but getting no results.

- (void) traceArc {

    CGMutablePathRef myArc = _myArc.myArcPath;

    // Set up path movement
    CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    pathAnimation.calculationMode = kCAAnimationPaced;
    pathAnimation.fillMode = kCAFillModeForwards;
    pathAnimation.removedOnCompletion = NO;
    pathAnimation.path = myArc;
    CGPathRelease(myArc);

    [self.layer addAnimation:pathAnimation forKey:@"savingAnimation"];

}

Any help here would be appreciated.

sentences:
SMFL C++: IntRect intersection not working? I'm trying to find free space to place rectangles, but even though I check for a collision using .intersects() it still places them through each other and somehow doesn't see the intersection happening while it's blatantly there.

This is my code at the moment:

#include "dungeonGenerator.h"

std::map<int, dungeonGenerator::dungeon_room> dungeonGenerator::newDungeon(int x, int y, int n)
{
    srand(time(NULL));
    std::map<int, dungeon_room> rooms;
    bool canPlace;

    for (auto i = 0; i < n; ++i)
    {
        canPlace = false;
        dungeon_room dungeon_room;
        while (!canPlace)
        {
            int height = rand() % x;
            int width = rand() % y;

            int pos_x = rand() % 512;
            int pos_y = rand() % 512;

            sf::RectangleShape room;
            room.setSize(sf::Vector2<float>(height, width));
            room.setFillColor(sf::Color(rand() % 255, rand() % 255, rand() % 255));
            room.setPosition(sf::Vector2<float>(pos_x, pos_y));
            dungeon_room.image = room;
            dungeon_room.collider = sf::IntRect(pos_x, pos_y, width, height);

            if (!rooms.empty())
            {
                auto i = 0;
                for (auto& room : rooms)
                {
                    std::cout << ++i;
                    canPlace = canPlaceRoom(&dungeon_room, &room.second);

                    if (canPlace == false)
                    {
                        break;
                    }
                }
            } else
            {
                canPlace = true;
            }
        }
        rooms[i] = dungeon_room;
    }
    return rooms;
}

bool dungeonGenerator::canPlaceRoom(dungeon_room* room, dungeon_room* target)
{
    if (room->collider.intersects(target->collider))
    {
        return false;
    }
    return true;
}

sentences: Unlock cursor through script I am using unity's default FPS controller script. My game switches scenes, and when it does I can't move the mouse. I know that this is because of unity's m_mouselook's lock cursor is on. What I don't know how to do is turn that boolean to false through a different script.

sentences:
Barter system data type My game has 4 supplies, Gold Wheat Iron Fuel, a player is allowed to select a supply to trade and what supply to receive from merchant NPCs.

Currently, when the user trades an item I have the following logic
I am using c# but this is not the exact code used.

if(sellGold){
    if(buyGold){
        tradeRatio = .5;
    }
    if(buyWheat){
        tradeRatio = 3;
    }
}
else if(sellIron){
    if(buyGold){
        tradeRatio = 1;
    }
    if(buyFuel){
        tradeRatio = 2;
    }
}
...etc

Where the amount a player receives is calculated by multiplying the trade ratio by the amount sold.

This works, it is just rather tedious and would be a pain to add more supplies later. What would a better approach be? I'm thinking of assigning each item a value and that value is different based on the trade type, but that still involves a whole bunch of nested conditionals.

sentences:
CloneNode or Audio Pool? I have a game, but I have to make a decision about audio.
Should I preload an audio pool, or create cloneNode when played?
Which is better in terms of best loading and better performance?

sentences:
What is Serialization? I have been around programming for a while as a hobby, but I did not start seeing this concept until recently. I have google'd "what is serialization" numerous times, but I never actually get any sort of definition, usually just examples of how to do it. I am seeing it around the Ogre forums, the Bullet forums, and every other forum I go to, so I think it is about time I actually understand what it is, and why to use it.

Edit

To clarify, I am looking more for why to use it, especially in the sense of game programming. For example, the Bullet Physics API talks a lot about serializing a mesh, so I want to understand why that is.

Thank you :)

sentences:
Game Loop getting 58-62 FPS. Why not exactly 60FPS? (SDL/C++/OSX) Here's my game loop:

uint64 target_fps = 60;
  uint64 ticks_per_s = SDL_GetPerformanceFrequency();
  uint64 target_ticks_per_f = ticks_per_s/target_fps - (ticks_per_s/1000); //aim for (target - 1ms) to err on side of > 60fps

  uint64 ticks_per_cur_f = 0;
  uint64 t_last_render = 0;
  uint64 t_last_update = SDL_GetPerformanceCounter()-target_ticks_per_f;
  int max_updates = 3;
  int updates = max_updates-1;

  while(!done)
  {
    while(
      t_last_update > SDL_GetPerformanceCounter() - target_ticks_per_f &&
      t_last_render > SDL_GetPerformanceCounter() - target_ticks_per_f
    )
    {
      SDL_Delay(1);
    }

    //update
    updates = 0;
    while(updates < max_updates && t_last_update < SDL_GetPerformanceCounter() - target_ticks_per_f)
    {
      t_last_update += target_ticks_per_f;
      updates++;
      pollEvents(); //possibly sets done = true
      simData();
    }
    if(updates >= max_updates) t_last_update = SDL_GetPerformanceCounter();

    if(t_last_render < SDL_GetPerformanceCounter() - target_ticks_per_f)
    {
      ticks_per_cur_f = SDL_GetPerformanceCounter()-t_last_render;
      t_last_render = SDL_GetPerformanceCounter();
      render();
      SDL_GL_SwapWindow(window);
      glFinish();
    }
  }

It's a fixed timestep (to simplify/make consistent any updates).

It essentially just does this:

Wait (SDL_Delay()) until enough time has passed requiring either an update or a render
While "last update" was > 16ms ago, update() and add 16ms to when "last update" was (maxing out at 3 updates assuming it got really far behind)
If "last render" was > 16ms ago, render (and set "last render" to "now")
Repeat

Even when I do nothing in update() or render(), it fluctuates anywhere between 58FPS and 62FPS. Why would this be?
I understand that SDL_Delay only has a fidelity of 1ms, but I even set "target ticks" to be 1ms less than necessary to try to account for this.

Any ideas?

Thanks!

sentences:
How to get a job as a game programmer/developer in AAA studios? I have looked up and down on the internet and haven't really found the solution, or maybe I am just too confused to know the answer.

I love games and wanted to get into making them from a long time. I first started working with Unity and then realized that I could not see how this could help me in getting into AAA studios as all there job requirements had stuff that I didn't learn in the process. Then it felt like making a game engine would help me learn better what those studios want. But then that stuff was too overwhelmingly tough for me to actually get something competitive done. I did learn some things, but it was not a one man job.
I then again decided to go into making games on a pre-existing engine, this time I took up Unreal Engine 4. But this time I have a better idea of what I want to do. I am interested in making game play logic, AI system, and on a side have fair bit of interest in modelling (not texturing) and animation. I may not be good at all this right now, but I have figured out what I have to do exactly, and on the side.
Now again I did end up one some companies job page(Naughty Dog, Santa Monica and Sucker Punch) and I found myself in the sea of confusion and hopelessness, half of the time I couldn't figure out what the requirements.

So my question is, is learning how to get complex AI running in UE4, setting up some nice game play mechanics in UE4, and setting up a nice UI in UE4 and creating some models and animating them in Maya will be enough to get me a job at some of the AAA studios I mentioned?

I know I haven't done all the stuff I mentioned in depth, but I can't proceed without having a proper aim and path, the path can change in between but should lead me somewhere at least.

I will be thankful for any good advice.

Edit. I am not good at art, just in case.

sentences:
How can I make a Soft Outline Shader? Most Outline Shaders or Tutorials found online, are Shaders which are sharp edge-outlines.  Like here:

Even though a lot of games are already using soft outlines
 like here:

with a nice gradienty- blurry effect.

Creating a Outline is basically easy (as described here: http://wiki.unity3d.com/index.php/Silhouette-Outlined_Diffuse)

Also ive seen that wanted effect in 2D:
https://www.assetstore.unity3d.com/en/#!/content/84126

But how do they do it in 3D?

Ive found a useful step-by-step guide here: (https://willweissman.wordpress.com/tutorials/shaders/unity-shaderlab-object-outlines/) . But the first step is already not working. (rendering the 3d object in as pure white to a rendertexture).

sentences:
Obtaining a world point from a screen point with an orthographic projection I assumed this was a straightforward problem but it has been plaguing me for days.

I am creating a 2D game with an orthographic camera.  I am using a 3D camera rather than just hacking it because I want to support rotating, panning, and zooming.  Unfortunately the math overwhelms me when I'm trying to figure out how to determine if a clicked point intersects a bounds (let's say rectangular) in the game.

I was under the impression that I could simply transform the screen point (the clicked point) by the inverse of the camera's View * Projection matrix to obtain the world coordinates of the clicked point.  Unfortunately this is not the case at all; I get some point that seems to be in some completely different coordinate system.

So then as a sanity check I tried taking an arbitrary world point and transforming it by the camera's View*Projection matrices.  Surely this should get me the corresponding screen point, but even that didn't work, and it is quickly shattering any illusion I had that I understood 3D coordinate systems and the math involved.

So, if I could form this into a question: How would I use my camera's state information (view and projection matrices, for instance) to transform a world point to a screen point, and vice versa?  I hope the problem will be simpler since I'm using an orthographic camera and can make several assumptions from that.

I very much appreciate any help.  If it makes a difference, I'm using XNA Game Studio.

sentences: GLSL Shader Solution for Ambient Occlusion? For the iOS app I am writing I want to incorporate some aspects of ambient occlusion for photo manipulation. Can someone suggest a GLSL approach that will work. Realtime performance is not super critical. Under a second compute time is fine.

sentences:
Direct3D - Get screen coordinates for printing multiple text elements I have a function that I use to print text PrintText(char* text) that stores the text to a vector, which is then displayed if the vector is not empty. I'm trying to figure out how can I correctly print multiple char* to the screen, one under the next?

For example:This is line one.This is line two.

Both of those are stored in separate char* elements in the vector. How can I use Direct3D or C++ to correctly display consecutive char* elements as it is in the above example? As in getting the correct screen coordinates to display the next element?

Code:

void DrawString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont)
{
    RECT ShadowPos;
    ShadowPos.left = x + 1;
    ShadowPos.top = y + 1;
    RECT FontPos;
    FontPos.left = x;
    FontPos.top = y;
    ifont->DrawTextA(0, String, strlen(String), &ShadowPos, DT_NOCLIP, D3DCOLOR_ARGB(255, r / 3, g / 3, b / 3));
    ifont->DrawTextA(0, String, strlen(String), &FontPos, DT_NOCLIP, D3DCOLOR_ARGB(255, r, g, b));
}

sentences:
Optimizing hierarchical transform I'm transforming objects in 3D space by transforming each vector with the object's 4x4 transform matrix. In order to achieve hierarchical transform, I transform the child by its own matrix, and then the child by the parent matrix. This becomes costly because objects deeper in the display tree have to be transformed by all the parent objects.

Is there a faster way to transform vertices to achieve hierarchical transform?

sentences:
Avoiding constant IF checks for loops As an example, I have 3 different loops that are executed in certain conditions.
I want to know if there's any way short of something like this:

if(day)
   x++;
else if(night)
   y++;
else
   z++;

Avoiding the continuous if checks, because I know under what conditions they will be executing... do I make myself clear?

I've thought of something along the lines of starting to execute a loop under the said x or y conditions, like so:

if(day)
 loopX();
else if(night)
 loopY();
else if(something else)
 loopZ();

But by doing this I'll effectively have to do checks for when to exit the loops, which ends up being the same, right?

I want to be able to say: "Start doing this!", and then eventually, at my discretion, "Now start doing this, instead!", without constant polling of conditions!

For example, were I currently in the "something else" state, I'd be doing 3 if checks every frame just to enter the loop! If I had something like 100 states, and was on the 100th, I would be checking 100 conditions just to get to the loop I want to execute!

A pratical game programming example: every frame, I do collision checking. Suddenly, I want to stop doing the collision checking.
I do not want to have it check an if(collideStuff), I want it to straight out not do it.

void gameloop() {
   movestuff();
   something();
   collision(); // this would suddenly not have effect, as if it weren't there
}

sentences:
Debug logging in Factorio mod I'm writing a Factorio mod, and I'm trying to figure out why it doesn't work. Can I do some kind of error / debug logging somewhere? Both manual (printing variables) and simple error reporting (accessing a property that doesn't exist) would be great. I know about the player.print method, but I can only get it to print string literals, not objects:

script.on_event(defines.events.on_player_created, function(event)
    pcall(function()
        local player = game.get_player(event.player_index)
        player.print("Hi player") -- works
        player.print(player) -- does not work. Any error message would be nice
    end)
end)

I've also tried the log file in the application folder, and the various debug modes (F5/F6 in game), but so far haven't found anything useful.

sentences:
How can I create a custom PropertyDrawer for my Point struct? I created a Point struct:

[System.Serializable]
public struct Point
{
    public int x;
    public int y;
}

I am trying to create a property drawer for it, so that when it shows in the inspector, it is shown in a Vector2 field.  I have the following script in the "Editor" folder:

using UnityEditor;
using UnityEngine;

[CustomPropertyDrawer(typeof(Point))]
public class PointEditor : PropertyDrawer
{
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.Vector2Field(position, label, property.vector2Value);
    }
}

It shows up in the inspector the way I want, but the values are locked at 0. Basically, I am trying to access the Point instance from inside the OnGUI method, but this could be the completely wrong approach. How can I make this so that when the values are changed in the inspector, the respective Point is also changed?

sentences:
Calculation: Is a sphere/square/plane visible from a certain point? I'm searching for a way to detect if a form (shape can be changed if algorithm requires it) is visible from a single point in a 3D tile-based world. This should be used as some kind of wall-hack protection to hide players from the client if they are fully covered behind a wall.

This does not have to be extremely precise. The only condition is that the algorithm never returns a false-negative. Therefore I thought it might be the easiest choice to create a rather large sphere around each other player and peform visibly operations from the viewpoint to that that imaginary sphere. I'm planning to use this on larger maps and only if players are far away from each other. It wouldn't be a problem if you could see players that a behind a wall right next to you.

Since I have no clue how the solution may look like I'm searching for a very abstract description of how such an algorithm works.

I found this very similiar question: Precomputing Visibility But I think this led me into the wrong direction since my main aspect ist speed rather than accurancy.

sentences:
Is there a way to exclude original sprites in spritepacker that's in asset bundle? I use spritepacker with assetbundle. It's working great. Its memory assumption is about just 8 MB. However, when I looked at the disk space that asset took on android phone, it took about 25MB. Which is 4 times from 8 MB. If I sum up all original sprites that have been used to create the atlas in spritepacker, they will be about 25MB as they are. Is there a way to exclude original sprites out of the bundle? It waste too much space in the device. I think only output atlas that generate from sprite would be enough to pack within the bundle.

I'm sure of it. I tested with 18 sprites and use the packer to generate 1024x2048 atlas. If I choose 2 sprites to make asset bundle, it used 5.76 MB disk space. If I choose 3 sprites to make asset bundle, it used 6.62MB. Its different is about 0.9MB which is the size of each sprite.

sentences:
Simple 2D Collision Detection Algorithm Library I'm building a simple OpenGL game and I was looking for some simple collision detection library for objects like squares, triangles and circles. Any suggestions?

PS: Preferably a library that is very well documented and provide examples of 2D collision detections.

sentences:
Entity Component System - Handling Input I'm developing a using the Entity-Component model, and so far have components for position, input, graphics and a camera, and systems for rendering graphics and handling input.

All seems to be working well, and I can use my model to create a multi-player, multi-camera setup relatively easily.

Anyway, my problem is that my input system checks keypresses against each player's controls, but I'm not sure how to react to these keypresses without introducing a lot of coupling.

For example, if 'W' is pressed, I want to tell player 1 to move upwards, but that first involves some collision detection -- something I'm not sure my input system should handle.

Advice greatly appreciated!

Thanks in advance,
Rich.

sentences:
Why is this animation jerky? I am trying to create a simple game on android but I am unsure the best way to do the game loop.  Looking at the LunarLander sample the game loop just loops like a variable time step loop (elapsed = now-lastupdate).  I tried using this method to draw a circle that grows in size to a max radius then shrinks to a min radius and repeats.  However, when I run the program the growing stage is very choppy and slow (it takes longer than it should to get to max radius).

My Code:

    public void updateSize(double elapsed) {
        if (mGrowing == true && mRadius > mMaxRadius) {
            mGrowing = false;
        }
        if (mGrowing == false && mRadius < mMinRadius) {
            mGrowing = true;
        }

        if (mGrowing == true) {
            mRadius += mDRadius * elapsed;
        } else {
            mRadius -= mDRadius * elapsed;
        }
    }

mDRadius is the number of pixel the radius should change per second and elapsed is the number of seconds that has passed.

I tried putting in a sleep of 2ms and 5ms in my game loop and I get the same result.

I converted my loop to a fixed time step (only run physics update if now-lastupdate > TIME_STEP) and the animation was a lot smoother.

UPDATE: I change the sleep to 15ms and it's a lot smoother.  Every other example I've seen of an android game does not have a sleep in the main loop.  Is this because my sample is just so simple that it takes virtually no time to update and all other examples just have a longer update time or am I missing something?

sentences: Help with modifying a geometry grass shader to allow removing areas? So I have this geometry grass shader from a roystan tutorial I followed but it applies the grass effect to the entire mesh at once. I need to find a way to only apply grass to set areas much like how the unity painting vegetation tools work. I had an idea of using a "guiding" texture that the shader would follow which would only apply grass onto set areas on the texture e.g areas that are green but I'm not sure how to implement it. I would appreciate any advice!

sentences:
Vector magnitude in orientation First, a quick overview of my problem: I have a game entity which has a quaternion to represent its rotation/orientation. It also has a 3D vector in world space for its linear velocity. From the perspective of the entity there are also 3 virtual axes (the standard z=forward/backword, y=up/down, x=left/right).

With those relevant pieces, I want to find the amount of velocity relative to one of the entity's virtual axes (i.e. how fast is it moving to its right) so that I can display that to the player and/or apply a counteracting force in that direction.

I have a vague idea that I need to transform the unit vector corresponding to the direction I'm querying by the orientation quaternion and then calculate the angle between the result and the velocity vector. Then with that angle figure out how much of the velocity magnitude is in the target direction (maybe using cosine?).

sentences:
What is the best way to learn Cocos2D? I've messed around with iPhone development for a couple years now. I've done some contract work. I want to get into Cocos2D to develop a game idea that I have.

I was wondering what might be the best/quickest way to get up in running in cocos2d?

I've thought about a book, but I wondering if that is needed? I'm the type of guy that just wants to know what everything does and is suppose to be used for.

Any ideas?

sentences:
Looking for an elegant way to represent fixed parts of a randomly generated level map I'm coding from scratch a small experimental game on a medium-sized random rectangular square tile map. (Say, a map of a dungeon.)

There are several types of tiles (for example: floor, wall, monster, boss, treasure, player etc.). There are no extra information stored in the map tiles, just tile type.

Most parts of map are randomly generated. However there are several features that are to appear on every generated map in pre-set places. Say, walls around the dungeon, boss locations, player spawn point and the treasure.

Note: Since the game is small, coded for fun, and the only game designer is a programmer (that is, me myself), I do not plan to spend resources on coding a level editor or supporting an existing one. Also, I do not plan to support existing tile map libraries as I want to dig into some of the related coding problems myself (see above about fun), but I be happy happily to look at relevant existing code as a reference.

When I look at my map generation code, I find it rather ugly.

Is there an elegant way to deal with the problem? If that matters, I'm writing this game in JavaScript, but I will be happy to see a relevant reference in any programming language.

Here is a partial pseudocode to illustrate how my current tile generator solution looks like:

this.init = function(w, h) {
  this.w = w;
  this.h = h;
  this.tile_presets_ = { };

  var mid_h = Math.floor(h / 2);
  var quarter_w = Math.floor(w / 4);

  /* Here is the part I don't like -- a set of generator rules: */

  this.preset_col_(0, Tile.GRASS);
  this.preset_tile_(0, mid_h, Tile.FLOOR);

  this.preset_col_(1, Tile.GRASS);
  this.preset_tile_(1, mid_h, Tile.FLOOR);

  this.preset_col_(2, Tile.WALL);
  this.preset_tile_(2, mid_h, Tile.FLOOR);

  this.preset_tile_(2, mid_h, Tile.PLAYER);

  this.preset_tile_(1 * quarter_w, mid_h, Tile.BOSS);

  this.preset_tile_(2 * quarter_w, mid_h, Tile.BOSS);

  this.preset_tile_(3 * quarter_w, mid_h_, Tile.TREASURE);

  this.preset_col_(w - 1, Tile.WALL);
};

Implementation details that may help to understand the code above:

this.tile = function(x, y) {
  var preset = this.tile_presets_[x + y * this.w];
  if (preset !== undefined) {
    return preset;
  }

  return this.random_tile_();
};

this.preset_tile_ = function(x, y, tile) {
  this.tile_presets_[x + y * this.w] = tile;
};

this.preset_col_ = function(x, tile) {
  for (var y = 0; y < this.h; ++y) {
    this.preset_tile_(x, y, tile);
  }
};

Note that I shown a rather simple set of generator rules above. Actual thing is several times longer.

I hate that the code looks imperative — and it is hard to figure out what is going on from the first glance. I think that declarative approach could help. But so far I can't figure out a good solution.

Any clues?

sentences:
Kinect for Windows Commercial License Kinect for Windows SDK 1.6 is available for users to download. What I enquire is: Can I publish a commercial game with it? Do I have to apply for anything?

I've searched through the Microsoft's Kinect documentation about the subject but failed to find the information I'm looking for. It is impossible to publish a game for XBOX using Kinect, I know that. But what about Windows?

sentences:
Calculating normal vector on a 2d pixelated map I want to know an efficient way to get the normal of the surface of a 2d map. suppose an object hit the map, i want the object to bounce accordingly. The problem is, the "bounding box" of said object is several pixels in size and the map has many curves.

I thought about getting the pixels that collides with the object (don't ask me how) and calculating it's mean, and having the normal to be the line between said pixel and the center of the object

for those familiar with worms, I want to do the same when a grenade hits the map and bounces back

EDIT: I'm not looking for a 100% accurate formula, I want it to be efficient and believable enough

sentences:
Difference between the terms Material & Effect I'm making an effect system right now (I think, because it may be a material system... or both!). The effects system follows the common (e.g. COLLADA, DirectX) effect framework abstraction of Effects have Techniques, Techniques have Passes, Passes have States & Shader Programs.

An effect, according to COLLADA, defines the equations necessary for the visual appearance of geometry and screen-space image processing. Keeping with the abstraction, effects contain techniques.

Each effect can contain one or many techniques (i.e. ways to generate the effect), each of which describes a different method for rendering that effect. The technique could be relate to quality (e.g. high precision, high LOD, etc.), or in-game-situation (e.g. night/day, power-up-mode, etc.). Techniques hold a description of the textures, samplers, shaders, parameters, & passes necessary for rendering this effect using one method.

Some algorithms require several passes to render the effect. Pipeline descriptions are broken into an ordered collection of Pass objects. A pass provides a static declaration of all the render states, shaders, & settings for "one rendering pipeline" (i.e. one pass).

Meshes usually contain a series of materials that define the model. According to the COLLADA spec (again), a material instantiates an effect, fills its parameters with values, & selects a technique. But I see material defined differently in other places, such as just the Lambert, Blinn, Phong "material types/shaded surfaces", or as Metal, Plastic, Wood, etc.

In game dev forums, people often talk about implementing a "material/effect system". Is the material not an instance of an effect? Ergo, if I had effect objects, stored in a collection, & each effect instance object with there own parameter setting, then there is no need for the concept of a material... Or am I interpreting it wrong?

Please help by contributing your interpretations as I want to be clear on a distinction (if any), & don't want to miss out on the concept of a material if it should be implemented to follow the abstraction of the DirectX FX framework & COLLADA definitions closely.

sentences:
Is there a difference between using one large mesh with 100k polygons and using 1000 meshes with 100 polygons each? I'm planning on creating a first-person shooter for mobile. Now I know that fps games usually have a lot of meshes in the scene (trees, buildings, terrains, etc.). So I've been looking at a lot of Unity optimization tips. One thing I've noticed is that they always say "If you have a lot of objects in your scene, then each mesh must have low polygon count".

But how exactly does this help? If I have a lot of houses in my scene and I ensure that each house has very few polygons, wouldn't the total number of polygons in my scene be affecting the performance anyways? Or will my scene be rendered differently now that I've broken up the total polygon count into multiple parts?

sentences:
Keeping raycast on the same level I want my raycast to end at certain height(red line). But as the game is 3D and the camera rotates I can't use a fixed magnitude. What I thought was a stroke of genius, I figured I'd project the height vector(a) to the ray direction to get vector(b). The result is in the right direction, but the magnitude of b is not big enough.

The wanted result is to get the vector b always reach the red line(Magnitude changes depending on the camera). My previous knowledge of vector projection says it should work, but obviously it doesn't. Where am I going wrong here?

---- EDIT: Question clarification ----

Step one: The ray is cast depending on used input. And it fails to hit any of the gameobjects.

Step two: Check the area around the midlevel(redline) to see if any gameobjects are close enough(green circle). For this to work, I need the magnitude of b-vector to use the Ray.GetPoint().

sentences:
Transform inertia tensor using quaternion I have inertia tensor T in body coordinates and quaternion q for the body. I know I can transform T to world coordinate by converting quaternion to rotation matrix R and then use the relation (R * T * R^T). However this seems unnecessarily expensive and unwieldy (especially if you are doing this often).

So my question is:

How do I transform inertia tensor from body to world coordinate directly using quaternion and without having to generate rotation matrix from quaternion?

sentences:
How to bind more texture array objects into shader? I can't find information if it is posiible, to bind few texture array objects into shader. Any searches for "array of texture arrays" or "multiple texture arrays" end with how to use texture array object.
I'm creating a texture array object in this way:

glGenTextures(1, &array_texture_object_A);
glBindTexture(GL_TEXTURE_2D_ARRAY, array_texture_object_A);
...
glBindTexture(GL_TEXTURE_2D_ARRAY, 0);  //unbind

Texture array object is distinguishable by texture width, height and bits per pixel.
When I want to load texture with different size I create anoter texture array object:

glGenTextures(1, &array_texture_object_B);
glBindTexture(GL_TEXTURE_2D_ARRAY, array_texture_object_B);
...
glBindTexture(GL_TEXTURE_2D_ARRAY, 0);  //unbind

And my question is how to bind array_texture_object_A and array_texture_object_B into shader.
(For example I have diffuse map in array_texture_object_A and specular map in array_texture_object_B).

For binding function (glBindTexture) first argument - target, has only GL_TEXTURE_2D_ARRAY enum, there is no something like GL_TEXTURE_2D_ARRAY_0, GL_TEXTURE_2D_ARRAY_1 etc. End now I'm stuck at this point.

Many thanks for any help.

sentences:
Jump handling and gravity I'm new to game development and am looking for some help on improving my jump handling for a simple side scrolling game I've made.  I would like to make the jump last longer if the key is held down for the full length of the jump, otherwise if the key is tapped, make the jump not as long.  Currently, how I'm handling the jumping is the following:

Player.prototype.jump = function () {
    // Player pressed jump key
    if (this.isJumping === true)
    {
        // Set sprite to jump state
        this.settings.slice = 250;

        if (this.isFalling === true)
        {
            // Player let go of jump key, increase rate of fall
            this.settings.y -= this.velocity;
            this.velocity -= this.settings.gravity * 2;
        }
        else
        {
            // Player is holding down jump key
            this.settings.y -= this.velocity;
            this.velocity -= this.settings.gravity;
        }

    }

    if (this.settings.y >= 240)
    {
        // Player is on the ground
        this.isJumping = false;
        this.isFalling = false;
        this.velocity = this.settings.maxVelocity;
        this.settings.y = 240;
    }
}

I'm setting isJumping on keydown and isFalling on keyup.  While it works okay for simple use, I'm looking for a better way handle jumping and gravity.  It's a bit buggy if the gravity is increased (which is why I had to put the last y setting in the last if condition in there) on keyup, so I'd like to know a better way to do it.  Where are some resources I could look at that would help me better understand how to handle jumping and gravity?  What's a better approach to handling this?  Like I said, I'm new to game development so I could be doing it completely wrong.  Any help would be appreciated.

sentences:
Best practice where to store Projectile Damage amounts? I have a projectile and an enemy, both with colliders. On the projectile script, I'm destroying the projectile OnTriggerEnter:
public class bulletBehavior : MonoBehaviour
{
    private Rigidbody rb;
    public float smallGunSpeed = 500f;

    void Start()
    {
        rb = this.GetComponent<Rigidbody>();
        rb.AddForce(transform.forward * smallGunSpeed);
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Enemy")
        {
            Destroy(this.gameObject);
        }
    }
}

On the Enemy Script I'm handling the health and the damage from the different projectiles using tags.  Is this the right way to do it? I would much rather attach the damage amount to the projectile but I'm not sure how to "Transfer" the damage value to the NPC script from the projectile script?  Storing them on the NPC script seems incredibly inefficient.
public class NPCscript : MonoBehaviour
{
    public int maxHealth = 300;
    public int currentHealth;
    public HealthBar healthBar;
    private GameObject enemy;

    void Start()
    {
        currentHealth = maxHealth;
        healthBar.SetMaxHealth(maxHealth);

        StartCoroutine(AutoHeal());
    }

    void Update()
    {
        if (currentHealth <= 0)
        {
            Destroy(this.gameObject);
        }
    }

    void TakeDamage(int damage)
    {
        currentHealth -= damage;
        healthBar.SetHealth(currentHealth);
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Bullet")
        {
            TakeDamage(10);
        }
        else if (other.tag == "Grenade")
        {
            TakeDamage(75);
        }
    }
}
```

sentences: LibBDX create a tail when the object is moved I am looking for a way to implement in my game a kind of shadow/tail which will be displayed after the object is moved. Should I use animation? If yes how? Here an example:

sentences:
How do I make perfect sprite sheets? I made a .GIF using sprite sheet animation, but I do not think it is working properly, because it shivers at the base. I made it in Photoshop Max Power.

How do I easily make perfect sprite sheets with images? I want to be able to add my images, resize them for my game and create a sprite sheet. Alternate software recommendation might be considered.

sentences:
Using box2d with starling In my game I have a Main class in which i am initializing starling framework by passing Game class like below

myStraling = new Starling(Game , stage);

In the game class I have Instances of Welcome class and InGame class these two classes extends starling.display.Sprite.I have a PhysicsHandling class seperately. Now i want to make instance of PhysicsHandling class  in the InGame class.
The physics handling class does not extend any class because it only does calculations. I have made its some variables public to position starling sprites accordingly.

My question is. Is it the right way to integrate physics in starling Performance wise .I mean is there a better way to do that

sentences:
Shader change alpha depending on light I use Unity, and I need a shader a bit special.
Unfortunatly my skills about shaders are very limited and I need this shader quickly.

So I want a shader to display a unlit texture on a plane, and when a light affect the plane, instead of make the lighting on the plane, I want that the light change the alpha to make the "lighted" surface transparent.

I think that it's not very hard for someone who know how to make shaders, so if you can help me to do this, it can be very useful for me!

Edit:

Ok, maybe it's not very clear.

I speak about a light, but it's not necessary a light, it can be with an other type of object, or just a position.

What I want is to have an unlit image, with a movable circle zone on this texture which make the zone transparent, like the white circle on this picture (imagine that the with is just the transparency).

The border shouldn't be necessarily with smooth border, it will be also fine with an hard border.

I have thought about a spotlight, because it's like move a spotlight on the picture, but instead of doing the lighting, I want to set the "lighted" pixel transparent (but it's not lighted, it's just to explain what I want), a,d it's not necessary with a light

And yes, the unlit shader can't do this I think, I probably need a custom shader but I don't know how to this (I have thinked about take a basic lighting shader, and use the computed intensity of the light on the pixels to set the alpha instead of use it to set the intensity of the pixel, but I don't know exactly how to do this)

sentences:
Play animation when click on each player with in maincamera unity3d I have 3 gameobjects (player1, player2, player3). I attached a script "playerscript" to these game objects.  In the main camera, I have added another script called "testscript". Clicking on a player should play the animation.  For that, I need to call the update() of "testscript.cs" in maincamera to the onMouseDown() of "playerscript.cs".

testscript.cs:

public class testscript : MonoBehaviour {
public bool selected;
public GameObject player1;
public GameObject player2;
public GameObject player3;

void Update () {
    //animation PickRightAndLeft
    player1.animation.Play("PickRightAndLeft");
}

playersscript.cs:

public class Playersscript : MonoBehaviour {
     void OnMouseDown () {
         Debug.Log (gameObject.name);
      }
}

sentences:
Why does this implementation of sweep and prune freeze, and how can I fix it? When I try to implement sweep and prune the aabb and sphere collisions don't collide properly. I have debugged the code and traced the problem to these methods.

AABB and Sphere collisions(The code for both is slightly different)

@Override
public boolean collides(Sphere other) {
            //AABB
    float dist = sqDistance(other.getCenter(), this);

    return dist <= (other.getRadius() * other.getRadius());

}

    @Override
public boolean collides(AABB other) {
    float dist = sqDistance(center, other);

    return dist <= (radius * radius);
}

 public default float sqDistance(Vector3f point,AABB aabb) {
    float sqDist = 0.0f;
    for( int i = 0; i < 3; i++ ){
        // for each axis count any excess distance outside box extents
       sqDist += check(point,aabb,i);
    }
    return sqDist;
}

public default float check(Vector3f point,AABB aabb,float axis) {
        float sqDist = 0;
        if(axis == 0) {
            float v = point.x;

            if( v < aabb.getMin().x ) sqDist += (aabb.getMin().x - v) * (aabb.getMin().x - v);
            if( v > aabb.getMax().x ) sqDist += (v - aabb.getMax().x) * (v - aabb.getMax().x);
        }
        if(axis == 1) {
            float v = point.y;

            if( v < aabb.getMin().y ) sqDist += (aabb.getMin().y - v) * (aabb.getMin().y - v);
            if( v > aabb.getMax().y ) sqDist += (v - aabb.getMax().y) * (v - aabb.getMax().y);
        }
        if(axis == 2) {
            float v = point.z;

            if( v < aabb.getMin().z) sqDist += (aabb.getMin().z - v) * (aabb.getMin().z - v);
            if( v > aabb.getMax().z) sqDist += (v - aabb.getMax().z) * (v - aabb.getMax().z);
        }
        return sqDist;
}

Could anyone please try and tell me what is wrong with these methods.

sentences:
Convert triangle mesh to group of line segments I have a 3D .OBJ model file that is loaded in my OpenGL ES 2 Android application using ASSIMP library. All the faces are triangulated.

I want to draw the wireframe for my mesh. In OpenGL we have something called glPolygonMode that enables wireframe drawing just in one line.

Is there a function I can use to convert those triangulated faces into a pair of Line segments and then draw these line segments using GL_LINES?

Any better approach to draw wireframe for 3D mesh in OpenGL ES 2 would be appreciated. Maybe something based on GLSL shader.

sentences: Is there any way to bring animation into unity without a rig/bones? I am developing for mobile and to make the game run on lower spec mobiles, I was only going to import bones/rig for the main character. There are other humanoid characters in the scene which do move about and are rigged already in my 3d app but since they wont be controlled in anyway by the player in the game, I just wanted to bake and import their animations alone without the bones. I know unity can handle blendshapes but I am more comfortable with rigs and also cos these characters are already rigged properly.

sentences: How do I get rights to an game? I' looking to get rights to an game called Grand Theft Auto: Chinatown Wars for the Nintendo DS. I am a Nintendo 3DS Developer trying to make a remastered version for the Nintendo 3DS. How would I go about getting the rights for the game. Do I get the rights from Rockstar, Nintendo, or another party. I'm not sure.

sentences:
Using peer to peer for prediction in a client-server network model By implementing peer to peer connections between clients in a client-server network model I should be able to increase the prediction fidelity as this theoretically would provide the client with other clients commands for a given tick earlier than it would receive the servers game states for the same tick.

One problem I can think of is that clients would have to be able to interpret other clients commands (usually they just have to listen for game states, not commands). This would be a little bit like an RTS model I guess. This should be solvable without any negative effects on gameplay.

Another problem is that clients could cheat by sending fake data to their peers when it is beneficial to them. This can be mitigated by having the client aware of the real commands through the server and have them immediately stop listening to any clients that fed it false data. This should therefore be solvable with different degrees of negative effect on gameplay depending on the design of the game and how impactful a few ticks of wrong command info is at the worst possible moment.

(Unfortunately, you can't have the server punish any client because it has no idea who's lying, it can only help clients themselves understand if they are being lied to by providing them with correct data).

Am I correct in assuming that this would increase prediction fidelity or is there something I'm not accounting for? The idea is that this allows the client access to some information about the other clients faster than in a traditional non peer to peer model where it would base predictions solely on its own commands.

sentences:
Why here does my use of GetOwner() make UE4 crash editor? I am new to Unreal Engine. I am following a tutorial where at the end he challenged me to build some extra features to the game.

Basically. This code crashes UE4, but I found out if I remove "GetOwner()->" from the code it works just fine.

But I struggle to understand why this is. I understand that maybe the 'Switch' variable is already at Root level (ie. is the Owner already) but surely the GetOwner() function could just return itself in that scenario?

Here is my function (The line causing crash is 4th line of actual code below. If I make it "    UBoxComponent* SwitchCollider = Switch->FindComponentByClass();" instead, the game works perfectly:

float UDoorOpener::GetCurrentWeightOnPlate()
{
float TotalMass = 0;

// Find all the overlapping actors
TArray<AActor*> OverlappingActors;
UBoxComponent* SwitchCollider = Switch->GetOwner()->FindComponentByClass<UBoxComponent>();
if (SwitchCollider)
{
    SwitchCollider->GetOverlappingActors(OUT OverlappingActors);

    if (OverlappingActors.Num() > 0)
    {
        UE_LOG(LogTemp, Warning, TEXT("MOFOOOOO"));

        // Iterate through them and add mass to total
        for (AActor* Element : OverlappingActors)
        {
            float ObjectMass = Element->FindComponentByClass<UPrimitiveComponent>()->GetMass();
            TotalMass += ObjectMass;
            UE_LOG(LogTemp, Warning, TEXT("%s has mass of %f. Total Mass currently: %f"), *Element->GetName(), ObjectMass, TotalMass);

        }
    }
}
else
{
    UE_LOG(LogTemp, Error, TEXT("SwitchCollider is null!"));
}

return TotalMass;

}

sentences:
UI Button Not Working On Animation I have hit a problem with my player, I have been following a tutorial on building a platformer. I have put in the UI buttons and linked then to the functions with a script like this:

public GameObject player;// link to player script;
    Player playerVariable;
    // Start is called before the first frame update
    void Start()
    {
        playerVariable = player.GetComponent<Player>();
    }

    public void MobileMoveLeft()
    {
        playerVariable.MobileMoveLeft();
    }

    public void MobileMoveRight()
    {
        playerVariable.MobileMoveRight();
    }

    public void MobileStop()
    {
        playerVariable.MobileStop();
    }

    public void MobileFireGun()
    {
        playerVariable.MobileFireGun();
    }

    public void MobileJump()
    {
        playerVariable.MobileJump();
    }

When I press the up arrow on the keyboard the player jumps and the animation jump is played, but when I press the UI jump button the player still jumps however the jump animation is NOT played.

public void Jump()
{
     if (SantaOnGround)
     {

         SantaOnGround = true;
         rb.AddForce(new Vector2(0, JumpForce));
         Animation.SetInteger("state", 2);
     }
}

sentences:
OpenGL behaviour depending on the graphics card? This is something that never happened to me before. I have an OpenGL code that uses GLSL shaders to texture a 3D model. The code involves a lot of GPU texture processing, blending, etc...

I wanted to check how the performance of my code improves using a faster graphics card (both new and old are NVIDIA, using always the NVIDIA development drivers). But now I have found that once I run the code using the new graphics card, it behaves completely different (the final render looks wrong), probably because some blending effect is not performed correctly.

I haven't really look into what has changed, but I am guessing that some OpenGL states are, by default, set different. Is this possible? Have you ever found different OpenGL/GLSL behaviour using different graphics cards? Any "fast" solution? (So far I've thought of plugging back the old one, push all OpenGL default states, and compare with the ones I initially get using the new card..)

Edit #1: The graphics cards are NVIDIA Quadro GX7300 (in which my code works OK) and NVIDIA GeForce GTX 560 Ti (in which the results changes / fails)

Edit #2 I have commented out a lot of my code, and apparently the strange behaviour has nothing to do with texture handling. A simple chessboard-like floor looks differents. The diagonal white lines did not appear using the old NVIDIA Quadro GX7300. Any guess what OpenGL related thing could be causing this?

Figure 1

Edit #3 I have now fixed the issue commented on the previous edit, regarding the weird unwanted diagonal thin whit lines. As I commented below, I had to remove the glEnable(GL_POLYGON_SMOOTH);, which was affecting the NVIDIA GeForce GTX 560 for whatever reason (probably due to reasons explained by mh01 in his answer.

However, I am still facing a "texture blending" problem when using the NVIDIA GeForce GTX 560. I have a 3D model that is being textured using a shader that blends 8 different images to compute the right texture, depending on where the camera is at that particular moment. The resulting texture is then a combination of different images, and ideally they were blended nicely, using a set of blending weights computed each time the camera moves. The blending weights are still well computed, but the resulting texture is wrong. I am guessing that the GL_BLEND function is somehow behaving different, but I have checked it in both graphics cards and it is actually the same one. I have no idea what else can be involved in getting this wrong result:

As you can imagine, the black line is where two original textures are being blended in order to get a seamless texture. If I use the exact some code and a NVIDIA Quadro GX730, the shader works as expected. However, when I use the NVIDIA GeForce GTX 560, the texture blending goes wrong. Any guess?

This is the GLSL shader I am using.

sentences:
In lockstep networking game, how to handle sudden lags and disconnection? I am trying to implement a game similar to "Street Fighter" by using lockstep networking model so that two players can play remotely via Internet.

I have read a lot of articles about lockstep networking method and I can basically implement the turn/frame handling for each step.

My understanding is that if it's now turn 101 and if player A has not received turn 101 action (packet) from player B, player A has to wait.

When this situation happens, player B has to wait too because player A will not send out further actions to player B because he is waiting.

Should the game do anything for this situation? For example, I saw games like Starcraft, sometimes there is a dialog showing up to wait for other players and if the count down goes to 0, players can disconnect this hanging player.

In order to do so, I don't understand how to decide who is lagging and what the proper handling is. Both player A or player B would think the other party is lagging because he does not receive the packet for his current turn. What am I going to show to the user? And if the lagging continues, how to end the game earlier by giving a correct game result (the player who lags should be given a loss and the other player should be given a win)? Just similar to the countdown dialog in Starcraft.

And on the other hand, what if the situation is not lagging but is a disconnection from player B?

sentences:
What's the URL of the video showing an EA representative talking about game programming? The video shows an EA representative talking about how a programmer can get into the industry by showing some demos (in fact, he shows a physics demo presented by a candidate who wanted a job at EA). The demo shown depicts kind of a ragtime doll made of yellow cobblestones.

I don't remember if I watched on YouTube or Vimeo and I frankly cannot find it after a few hours of work. I just remember the fact that it was taken at a GDC or a SIGGRAPH convention.

Thanks in advance. I'm really frustrated because I'd love to show this video to some fellow developers (coders).

sentences:
How to calculate delta time with SDL? I have heard that you can calculate delta time with two functions called SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency. I'm not sure how they work completely, but I heard it is a bit similar to using SDL_GetTicks()

    Uint64 NOW, LAST;
    double deltaTime = 0;

    while (somebool)
    {
       LAST = SDL_GetPerformanceCounter();
       NOW = SDL_GetPerformanceCounter();
       LAST = NOW;

       deltaTime = (NOW - LAST) / (double)SDL_GetPerformanceFrequency();

       /**Rendering**/
    }

I have this code but whenever I print out deltaTime or try to use it it always equals some really random and insane numbers. Is this correct?

sentences:
UE4: "Ignore Move Input" Does not get Set back on I have the following issue:

I have some logic which I call to Set Ignore Move Input on for a specific player character, based on a boolean. However, after half a second, I set it back on.

Everything works great, I can not move my character while it kicks.. However, if I press the "kick" input twice in succession.. the Set Ignore Move Input breaks and never gets turned off, even if I "Kick" again later.

Here is the blueprint .. Any help is greatly appreciated (and yes I realize that to somebody more experienced this blueprint makes little to no sense, but I'm just starting out... My core issue as a software developer here is I don't understand what locks me out of the logic that would reset Ignore Move Input back off).

Thank you for your time!

sentences:
XNA- Transforming children So, I have a Model stored in MyModel, that is made from three meshes. If you loop thrue MyModel.Meshes the first two are children of the third one. And was just wondering, if anyone could tell me where is the problem with my code.

This method is called whenever I want to programmaticly change the position of a whole model:

public void ChangePosition(Vector3 newPos)
{
    Position = newPos;

    MyModel.Root.Transform = Matrix.CreateScale(VectorMathHelper.VectorMath(CurrentSize, DefaultSize, '/')) * Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Up, MathHelper.ToRadians(Rotation.Y)) *
        Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Right, MathHelper.ToRadians(Rotation.X)) * Matrix.CreateFromAxisAngle(MyModel.Root.Transform.Forward, MathHelper.ToRadians(Rotation.Z)) *
        Matrix.CreateTranslation(Position);

    Matrix[] transforms = new Matrix[MyModel.Bones.Count];
    MyModel.CopyAbsoluteBoneTransformsTo(transforms);

    int count = transforms.Length - 1;
    foreach (ModelMesh mesh in MyModel.Meshes)
    {
        mesh.ParentBone.Transform = transforms[count];
        count--;
    }
}

This is the draw method:

foreach (ModelMesh mesh in MyModel.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.View = camera.view;
        effect.Projection = camera.projection;
        effect.World = mesh.ParentBone.Transform;
        effect.EnableDefaultLighting();
    }
    mesh.Draw();
}

The thing is when I call ChangePosition() the first time everything works perfectlly, but as soon as I call it again and again. The first two meshes(children meshes) start to move away from the parent mesh.

Another thing I wanted to ask, if I change the scale/rotation/position of a children mesh, and then do CopyAbsoluteBoneTransforms() will children meshes be positioned properlly(at the proper distance) or would achieving that require more math/methods?

Thanks in advance

sentences:
I have a question about 3D game models and copyright I am making a game that is like a combination of minecraft and unturned. It is like minecraft as it is very block based. It is like unturned because it has vehicles and other unturned functionalities. This is what the player model would probably look like:

The player model is very similar to minecraft's Steve. It does however have some major differences that make it unique. For instance the eyes are not stationary and can actually look around. The mouth has two sets of teeth which act as the jaw line and lips that represent the mouth. Both the teeth and the lips can be animated for a "Talking" animation. The eyes also have eyelids which can close and open with proper animating skill. The player model can also be customized in game, as the hair style, beard style, eye color, skin color, hair and beard color, can be changed during game play. Unlike minecraft's character, It is not restricted to just helmet, chest plate, leggings and boots for armor. This model can change its shirt, pants, helmet, hat, pants, leg armor, armor boots, chest plate, backpack (If he equips one), gloves, shoulder pads, elbow pads, and any other piece of armor and clothing that can be used in game.

My problem is, even with the major differences in the model, will it still be too similar to Steve? Or is this model too different to have me sued for copyright/IP infringement?

Thanks for any input.

I just started working on the model again, This time the player can hold things and also wears shoes:

sentences:
game-state update structure and distribution in MMO? I'm developing an MMO, which has to maintain a global game-state.

Now I want to distribute the updates, which the players make to this state, to players which can see those updates (area of interest etc.)

Is there a common structure/format for these updates and for a global game-state?

Like, every action a player sends to the server has to include a type, the coordinates etc.

And are the updates, which gets distributed from the server to the players in the same format or are they different?

Also should I include timestamps or use the receive-time from the server to check which action came first and which sencond etc.?

And what should I send back to the player if he send an invalid action?

sentences:
Is it possible to use unnormalized texture coordinates from a GLES2 GLSL fragment shader? I want to look up a texel from my GLES2 GLSL fragment shader using un-normalized texture coordinates (0-w, 0-h instead of 0-1, 0-1). The reason is that this texture is used as a look up table and I get precision problems with normalized coordinates.

I see that GL_TEXTURE_RECTANGLE is not supported wihtout extensions and neither is texelFetch(), so I have ruled out those options.

Thanks!

sentences:
Game Maker picking the wrong network adapter for broadcast In my game I need to get the local network IP of the computer that is running the game, and for that purpose I have the following code:

// Create event
randomize();
var random_port = irandom_range(49152,65535);
host = network_create_server(network_socket_udp, random_port, 5);

if ( host < 0 ) {
    show_message("Failed to create a broadcast server");
    game_end();
} else {
    var tsock = network_create_socket(network_socket_udp);
    var tbuff = buffer_create(32, buffer_fixed, 1);
    buffer_fill(tbuff, 0, buffer_bool, 0, 32);
    network_send_broadcast(tsock, random_port, tbuff, buffer_get_size(tbuff));
    network_destroy(tsock);
    buffer_delete(tbuff);
}

/// Async network event
global.game_ip = string(async_load[? "ip"]);
instance_destroy();

I've manually set up my local network IP to be 192.168.1.150, but when I run the code above, I get the IP 169.254.51.115.

Because I wasn't expecting such IP, I ran the ipconfig/all command (on Windows) and I got the following output (I've translated the output because my computer is in another language, and I've deleted the information that isn't relevant to this):

Ethernet adapter:

   Specific dns for this connection. . : Home
   Description . . . . . . . . . . . . . . . : Realtek PCIe GBE Family Controller
   [...]
   IPv4 address. . . . . . . . . . . . . . : **192.168.1.150(Preferred)**
   Subnet Mask . . . . . . . . . . . . : 255.255.255.0
   Default gateway . . . . . : 192.168.1.1
   DHCP server . . . . . . . . . . . . . . : 192.168.1.1
   DNS Servers. . . . . . . . . . . . . . : fe80::1%13
                                       1.1.1.1
                                       1.0.0.1

Ethernet Npcap Loopback Adapter:

   Specific dns for this connection. . :
   Description . . . . . . . . . . . . . . . : Npcap Loopback Adapter
   IPv4 automatic configuration address: **169.254.51.115(Preferred)**
   Subnet mask . . . . . . . . . . . . : 255.255.0.0
   Default gateway . . . . . :
   DNS Servers. . . . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                       fec0:0:0:ffff::2%1
                                       fec0:0:0:ffff::3%1

So, from my understanding point of view, Game Maker is getting the Ethernet Npcap Loopback Adapter instead of the regular ethernet adapter.

I could delete the Npcap Loopback adapter, but what if a user has wifi and ethernet connection?

Is there a way for Game Maker to choose one or another adapter?

In case the previous answer is no, is there a workaround for this  to avoid getting the Npcap loopback adatper?

sentences: Unity, depth behind a transparent object Is there a way to know how far away is any object behind a transparent object in shader? Like making water fully transparent when close to shore.

sentences:
Is naming convention a good base for a sorting and tagging system for game assets? TLDR: what are the pros and cons of using a naming convention for tagging and sorting game assets?

for the UI to search and handle it
for devs and gamers to move files around

I am building a game that is designed to be moddable under UE4.
I am going to have tons of assets (clothes, hairs, jewleries and their textures materials and whatnot) to deal with.
This has to be organised well to avoid issues later on, and for the UI to be able to handle it in a user friendly way.
Eventually the game has to be localized for a bunch of non-latin character systems, too.
The easiest way would be to use a prefix/suffix system when naming the assets, which would come in the game in as Blueprints, containing the asset and some extra data as well. This would be a requirement for modders.
For example:
tag_othertag_clothname.uasset
tag          |name

And then all I do is just search tru the name of the asset. I feed it the text the user typed for the name part, and the tags as strings for the tag part, and than hide the tag part from the user.
I set up a test scene and it does work ok with 500 assets, running the search every time you hit a button.
Later on I can store tag data in json or just as a plain string in the Blueprint.
The issue is that as the number of tags grow, the length of the string grows too, which can be a problem later on.
I thought about using strings and json files to store the tagging data in the Blueprint as well.
I would like to have 2 categories of tags by default

region or body part: head, torso etc ---> makes searching and
categorizing very easy but not as efficient, can be appied to nearly all asset types

asset type: cloth, jewlery, armour, etc

My questions are:
In your experience

are there pitfalls of using a prefix suffix system, for example security, performance, ease of use etc? if yes what are they?
what are the alternatives - I thought of using databases, but I don't have much experience with them, not sure which one works best with a high number of Blueprints, I saw quite a few on the Marketplace...

I 'd like to make it as simple as it can be, no overcomplication or overengineering.
I just want it to be usable, user friendly and easily extendable as the project grows.

sentences:
Some theory questions about classic endless arcade games I had read in the book "A theory of fun for game design" that once the player realizes that he cannot overpower the computer in anyway (or) the AI is unbeatable (badly designed/coded) he will leave the game and not try to beat it. But looking at new age games like "Jetpack Joyride" I think this rule is not true for everyone anymore. Not sure if this is a deliberate choice or just bad design.

I want to know if there exists any history about how the old classic ATARI / Arcade machines games were implemented/tested. Best example would be Pac-man/Asteroids etc. I am hoping that those game makers didn't just increment the speed of the enemies blindly with the level number. They must have tested it enough to ensure that the game can actually beaten up to very high levels and might have tweaked the required parameters to ensure it in their code.

Are there articles/tutorials about designing endless arcade games? I have been searching a lot but couldn't find any.

sentences:
How to make smooth animations Say I want to write a card game. I have a hand of cards and I want to be able to draw a smooth animation of a card moving from the hand to the table. I am looking for suggestions on how to elegantly represent the situation in data structures. Of course, I am not solely interested in cards, it seems to be a problem with more complex user interfaces in general.

The obvious representation of the hand is an array/list of cards. Given a rectangle in 2d space this hand is trivial to draw. When playing a card I can remove that card from the array and create a new structure that draws that card moving along any curve I like. The problem is then how the hand is drawn. In trivial implementation the hand in one instant shrinks in width by one card (as the array was replaced). Also, the selected card is now either above or bellow the hand (as it is drawn before or after drawing the hand), while a moment ago it was between the two cards next to it. These problems I'm not sure how to solve. They get even worse if trying to move several cards at once.

It would most likely work to make every card a separate body aware of it's position and movement in the plane (and possibly, the z axis to make overlaps work, as OpenGL allows this). It does seem like poor design to allow a system that almost always stays in a fixed shape too much flexibility. It also looks like a recipe for unexplainable bugs.

I would like to hear from someone who has done this, what is the best approach. To put it briefly, "specific and restrictive representation in data structures" versus "entirely free environment with some external limits".

Thanks a lot

sentences:
Best cross-platform solution for building 3D toolsets? I am looking to develop an in-browser game in Unity3D, but I would like to write my builder tools for my project on a more powerful platform.

The assets I am building for the game are not traditional 3D models, so I'll probably be creating my own format. I was thinking about writing something in Blender or Maya, but that is a lot of overhead for what I want to do.

A Unity3D desktop app was also a possibility, but at the end of the day I decided I wanted to build it outside of the game engine.

Since the Unity3D app is going to be cross platform, I would like the tool to be as well.

Saying that, does anyone know of a 3D library/platform that will run well on Windows and OS X?

sentences:
Nullpointerexception when loading resources in openGL ES 2.0 Android project Overview

My splash screen starts by display a 'loading' dialogue and then kicks off an asyncTask (The loading dialogue is derived from the standard Android View class)

Within the doInBackground method of the asyncTask, all of my quads / sprite objects are created and other values set etc.

When the code gets to onSurfaceCreated, it loads all of the textures and runs the game.

The texture loading happens in onSurfaceCreated because it has to be done on the GL Thread.

Now, on a nice fast tablet, it all works great and it's all very stable.  However, when I run it on an old handset, it (intermittently) crashes all over the place with nullpointerexceptions.

Reason

What's happening is on the slower device, the asyncTask is running and (due to the asynchronous nature of it), continues to run in the background while the main code moves on to the onSurfaceCreate method of the GLRenderer, there it attempts to apply textures to objects that don't yet exist because the asyncTask is still doing it's business.

How best to proceed?

What are some methods I can implement that would allow me to guarantee that the async has done it's stuff before attempting to affect any of the objects that it creates?

Is there a way to 'halt' the GLThread until the asyncTask has finished?  I've been told in the past to use a separate thread or an async for loading resources, but I'm confused as to how to handle it correctly and keep everything sync'd between it and the GL thread (if "sync'd" is the correct term in this context).

Any help would be appreciated.

Code example

Showing onCreate and doInBackground from Activity Class

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        //Request full screen
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

        super.onCreate(savedInstanceState);

        //Create a displayMetrics object to get pixel width and height
        metrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(metrics);
        width = metrics.widthPixels;
        height = metrics.heightPixels;

        //Create splash-screen object and pass in scaled width and height
        splash = new SplashScreen(MainActivity.this, width, height);

        //Create dialog that will show splash-screen
        loading_dialog = new Dialog(MainActivity.this,android.R.style.Theme_Black_NoTitleBar_Fullscreen);

        //Create and set View
        myView = new MyGLSurfaceView(MainActivity.this);

        //Create a copy of the Bundle
        if (savedInstanceState != null){
            newBundle = new Bundle(savedInstanceState);
        }

        //Create splash object

        goSplash = new DisplaySplash(newBundle);
        goSplash.execute(); //Start asyncTask

        setContentView(layout);

    }

And....

    @Override
    protected Void doInBackground(Void... params) {
        createObjects();
        initialise();
        return null;
    }

Showing onSurfaceCreated from GLRenderer Class

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {

    //Eek! Running before AsyncTask has finished on slower devices! :(
    res.loadResources();
    res.setTextures();
    res.RecycleBitmaps();

}

sentences:
Efficient visualization of a large voxelized volume Lets consider a large voxelized volume stored in an oct-tree or any other convenient structure. This volume represents, for instance, a landscape, where each block is either empty (air), or it has an specific material that will be later used to apply a texture.
Voxels that are next to each other represent connected sections of the surface.

What I need is an algorithm to generate a mesh from this voxels that represents the volume, with the following caracteristics:

All the "holes" in the voxelized volume are correct.
All the connections are correct, i.e. seamless.
The surface appears smooth.

In a broad sense, I want to somehow preserve the surface topology, meaning that connected sections remain connected in the resulting mesh and that the surface has a curvature that responds to the voxels topology. Imagine trying to render the Minecraft world but getting the mountain ladders to be smooth instead of blocky.

sentences:
Is there a way to convert built unity games back into a project I accidentally deleted my game.
I had been working on it for about 2 months and I accidentally deleted it while cleaning up my files. I am so smh. I have a ton of builds of the game though and since the game and all its scripts was converted to a file. Would I be able to un-pack said build back into a unity project? I am not that cut about the game because I didn't like it but I did spend a lot of time on it. Oh yeah and also its a school assignment...
Please help.

sentences:
Generating "tile map" by stamping a full map I'm building a game using Tiled tilemap editor.

I was originally creating tilesets to stamp around and create my map in Tiled.

Id prefer to create the base map in a Adobe Illustrator and stamp in the whole map as the level. Then stamp in trees or whatever on more layers as needed.

What are the implications on performance doing it this way vs creating the tilemaps and stamping them in tiled?

Example:

Tile:

Stamped Map:

sentences:
What do shaders encompass? I'm researching shaders as I'm thinking about doing them for my final year project at Uni. I've looked at a lot of examples online and I think I get it. It's something that you apply to an object or scene in order to create a desired effect without changing the original object/scene, I think. I know that there are different types of shaders but that's the basic goal right?

Furthermore, what do shaders encompass? Are weather systems in games shaders? Particle effects? Landslides? I don't know where the line is drawn between animations/cinematics and shaders. Also I guess shaders which effect something in the game world, for example, a tower blowing up in BF4. The explosion itself would be shaders but the way the tower effects the world around it would be physics and collisions. Am I right?

sentences:
How to constrain a ball and chain like object? Following up  on this question, I have created a snakelike enemy which consists of a head followed by segments. I get the segments to follow the head by constraining each segment's position relative to the segment in front of it. I get the difference between the actual distances between the segments and the desired distance, and correct that error 30% per frame.

The GDScript code looks like this:

for segment in [segment1, segment2, segment3, segment4, segment5, segment6]:
    # get actual distance between segment and its target
    var distance = segment.global_position.distance_to(segment.target.global_position)
    # find difference with desired distance
    var error = distance - desired_distance
    # move segment a percentage of the error toward its target segment
    var vector_to_target = (segment.target.global_position - segment.global_position).normalized()
    segment.global_position += vector_to_target * error * 0.30

I am happy with the result.

Now I want to create a similar enemy also composed of segments, but whose final segment is a kind of base, rooted to one position. Similar to the Chain Chomp from Mario.

I then want to code movement of the head, but for everything to be constrained. I'm guessing all intermediate segments would be doubly constrained by both of their neighbor segments, and the head itself would also have to be constrained by its neighbor segment, even though I'd be coding movement for it.

I'm not sure how to set up constraints like these which have to look in both directions, and would appreciate any advice?

Although I work in Godot, an engine-neutral explanation of the technique would suffice.

sentences:
Get MouseUp event outside of Sceneview scene window? So I have an editor script that uses a dragging operation which works quite nicely.  Except, if you release the button while OUTSIDE the Scene Window, the event doesn't register.
How do I detect mouseup outside of the scene window?
private static void OnScene(SceneView sceneview)
{
    Event e = Event.current;
    if (e.type == EventType.MouseDrag)
    {
        //do some drag stuff
        e.Use();
    }

    if (e.type == EventType.MouseUp && e.button == 1)
    {
        //is the Right Mouse button released?
    }
}

I suspect somehow it's due to my Event e being inside the OnScene making the mouse actions only existing in the context of the Scene Window perhaps?  I have no idea, very new to Editor scripting...

sentences:
Would A* or Dijkstra be more proper for a grid-based tactics game? In a grid-based tactical game (think Fire Emblem), would A* or Dijkstra be more proper for finding a path to use for enemy AI to determine the best place to move?

A* has a better performance that Dijkstra, however Dijkstra may offer me better/smarter looking results for an AI.

If possible, I'd like to have the answer for both a hexagon based grid, and a rectangle based grid, if it'll make a difference.

sentences:
Rotating pitch and yaw causes roll So I'm new to working with a 3D space and not sure how to fix my problem, I basically have a turret that rotates along its Z axis, and pitches along it's Y but after rotating 180 on the Z axis the turret points down as I completely understand despite being unexpected.

I have a fiddle with what I'm working on here https://jsfiddle.net/2v4ezmaz/2/

So the question is, how do I make it rotate like it does in blender where the barrel end stays pointing up while rotating the z? After lots of reading it's all to do with cross vectors since the .rotation property is euler angles which I think is my problem. I need to use quaternions but I can't logically see what needs to happen.

My brain is thinking of it as needing to reset the rotation back to its default then apply Z rotation and apply the Y rotation, but that can't be right.

After reading http://blog.wolfire.com/2010/07/Linear-algebra-for-game-developers-part-4 I'm sure my answer is there somewhere but I cant think what the code needs to be to do what i want.

Any pointers would be super helpful since my brain is fried reading/trying vector and matrix rotations.

sentences:
Unity3D Resize texture without corruption I am currently working on a solution to make my game look very pixelated, like Doom or Quake. But there is a big problem.

I'm using Unity Personal.

I render my camera to a 1920x1080 texture, then I try to use Texture2D.Resize on it, then render it back to the screen using ScaleMode.StretchToFill.

But the problem is that the texture seems to corrupt when I use Texture2D.Resize on it.

And here is my current code:
using UnityEngine;
using System.Collections;

public class PixelRenderer : MonoBehaviour {

    Texture2D texture;

    // Use this for initialization
    void Start () {
        texture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
    }

    // Update is called once per frame
    void OnPostRender() {
        texture = new Texture2D(Screen.width, Screen.height, TextureFormat.ARGB32, false);
        texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        texture.Apply();
        texture.Resize(256, 256);
    }

    void OnGUI() {
        GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture, ScaleMode.StretchToFill);
    }
}

Is there something that I'm missing here? Or am I doing something wrong?

sentences:
Help comparing Cocos2d and Unity3d for this project I will not go into details, but I would like to hear your opinions about this:

Essentially, my project will be a 2d game, with lots of complex levels, where some might be simple and others might be a bit more deep, with physics, etc. We want to implement our very own online structure: logging in, leaderboards, achievements, friends etc with our own servers. This means no OpenFeint nor GameCenter at all. We expect this game to be very large in both graphics and audio. We wish to use in-app purchases.

Now, we considered two options. Cocos2d and Unity3d.

We need help deciding using the factors I mentioned before (networking, good performance even for a large game in terms of graphics and audio like this, in-app purchases, etc) which option would fit better this?

Technically, both options can create 2d games. I'd like to hear your opinion.

sentences: How to add tiles randomly? I made a set of 10 different "ocean" tiles, all interchangeable with one another, and I'd like to randomly attach these 10 different tiles together in different combinations over a large rectangular area -- what would be the best way to do so? I've thought of just adding each sprite into a script and then calling a for/foreach loop to add it into my world but that seems extremely expensive since I'd be adding over 1000 sprites. I don't want to reduce the number of sprites I have to add, I'm just seeing if there's a typical way people do this sort of thing.

sentences:
Project location to perspective fake 3D view I am trying to implement a perspective view in a 2D soccer game, such like Nintendo World Cup. In this case, the soccer pitch will look like a isosceles trapezoid, but not a rectangle in real.

Here is my solution:

I separate the game logic location and the final rendering location. In the game logic part, the pitch is still a rectangle, so we can make easy collision detection, player area change, out-of-bound checks, goal check, etc.. Just like an answer to Stack Overflow question Implement a projectile motion and collision detection - response in a 2D top-down game said:
Then I just project players', ball's location into final screen location, so that player can fit in pitch (because the exact pitch image is a trapezoid like the screenshot)

I tried to do like that post said, but the result is wired, so I am thinking do I need to make a perspective projection like in a 3D game, but I do not know how. A 3D perspective projection needs to know the camera position, camera angle, near plane, but these do not exist in a 2D game.

How do I solve this problem?

sentences:
RaycastHit2D.point is acting weird when used with circlecast2d When I make circleCast2d intersects with another circle collider, I get a RaycastHit2D.point that doesn't point at the tip of the collision as it states in the documentation. Instead it always points at the centre of the intersected junction or pointC as shown in the figure below.
I checked this numerous times with different values to make sure the error was not from my end.
Is this intended? If so is there another way where I can actually find the closest point from collider(B) to the centre of collider(A) which corresponds to point(D) in the figure?
This is a picture of what looks like:
A = circleCast
B = collided object
C = where RaycastHit2D.point is pointing at
D = where I'd like it to point.

sentences:
jumping and movement with rigidbody2d.velocity, gravity problem i'm making a 2d platformer and i move my character with rigidbody2d.velocity swiping up to jump and moving while holding the left or right side of the screen.

the problem is that when i jump and i try to move left or right in the air, my character falls very slowly. i've read that the reason why that happens is because rb.velocity overrides gravity at every frame, is there a way to move left or right in the air with normal gravity?

my full code is

{
 Rigidbody2D rb;
public float speed = 1f;
public float jumpforce = 3.5f;
private Vector3 mouseDownPos;
private float startTime = 0f;
public float holdTime = 0.15f;

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

void Update()
{

 if (Input.GetMouseButtonDown(0))
    {

        mouseDownPos = Input.mousePosition;
        startTime = Time.time;
    }

    if (Input.GetMouseButtonUp(0))
    {

        if ( startTime + holdTime > Time.time & Input.mousePosition == mouseDownPos)// tap
        { Debug.Log("T A P");}

    if (Input.mousePosition.y > mouseDownPos.y + 100 )//jump
        {

            rb.velocity = new Vector2(rb.velocity.x, jumpforce);
        }

    }

    if (Input.GetMouseButton(0) & startTime + holdTime <= Time.time)///move while grounded
    {
        if (Input.mousePosition.x < Screen.width / 2)
        {
            Debug.Log("Left click");
            rb.velocity = transform.right * speed;

        }
        else if (Input.mousePosition.x > Screen.width / 2)
        {
            Debug.Log("Right click");
            rb.velocity = transform.right * speed;

        }

        if (Input.mousePosition.x < Screen.width / 2)/// move while in the air
        {
            Debug.Log("Left click");

            rb.velocity = new Vector2(-speed, rb.velocity.y);

        }
        else if (Input.mousePosition.x > Screen.width / 2)
        {
            Debug.Log("Right click");

            rb.velocity = new Vector2(speed, rb.velocity.y);

        }

    }

}

the rigidbody2d of my character is

sentences:
How do I portray characters with a bum leg properly in an action game like Devil May Cry, without making him a liability? Right now, I'm designing a character for a 2D action platformer game. The problem is that said character has a bum leg due to an accident a few years prior to the game's setting, but was the first one to be dragged into a dungeon formed by the newly developing incident, and had to escape on his own.

What I've thought about until now about this:

The character will move slower than the normal movement speed, cannot double jump, and have a lower jump height than the normal jump height.
However, he would use a sword that doubles as a retractable whip, allowing his melee attacks to have a wide coverage. Said sword-whip has low damage by default, however.
There's also that his melee attacks are less focused on launching enemies upwards and more focused on knocking them back - and maybe apply bleeding (non-elemental damage over time).
He would also have a shotgun that can be 'charged' to maximize the damage output, very much like the Gunslinger Style Shotgun in DMC3 and 4.

My problem is that this character will be one from around eight (for now), and the other seven characters don't have such a disability - two of them I intend to have the ability to glide mid-air.

The game will have a feature of switching between three characters chosen to engage the other dungeons, so he can be switched out for sections that require double jumping, but I'm not sure that's an optimal solution, especially considering the lower damage his weapon deals (making him a non-optimal pick for boss battles).

Should I just make each character fulfill a specific niche in terms of mobility options, melee attack options, and ranged attack options? How does one design the map and bosses for these cases, without making it seem like giving him too much of a break?

P.S. Can a grappling hook be involved, without ending up making him the best option to navigate the map (like refreshing it only after landing)?

EDIT: I also have a thought of integrating this grappling hook into the sword-whip, being able to pull enemies towards him, or him towards them. Is it possible to use this as a melee charge attack? Because I still think that it doesn't feel right.

sentences:
How many update and draw calls can a windows phone suppport I'm making a Windows Phone game (XNA 4.0) which requires a lot of activity on the screen. It's working well for now. But what I am concerned about is that it uses a lot of sprites and many of them as 'lists' so that I can make multiple copies of the sprite, and this causes a lot of Update() calls which have 'for' loops and collision testing method calls also. This also increases the number of Draw() calls.
As the game progresses, I am going to need to add more sprites and update calls.

Can that cause problems in Windows Phone? (Currently I have no device to test it on).

My game has 18 sprites for now and most of them requires multiple copies to be drawn on screen.

Is there a more efficient way to achieve this?

sentences:
Yield and loading textures I have a need to dynamically load textures from the player's filesystem. WWW provides the functionality I need, but I can't get the example code to compile.

"yield www" causes my code to not compile. Here, the code is short:

    private List<Texture> LoadTextures (String prefix, int numTextures)
    {
        List<Texture> textures = new List<Texture> ();
        for (var i = 0; i < numTextures; i++ )
        {
            var www = new WWW(prefix + i);
            yield www;
            textures.Add(www.texture);
        }
        return textures;
    }

Why doesn't yield work here, like the code sample on the Unity docs suggests?

EDIT:

In response to Lasse:

    private IEnumerable<Texture> LoadTextures (String prefix, int numTextures)
    {
        for (var i = 0; i < numTextures; i++ )
        {
            var www = new WWW(prefix + i + ".png");
            yield return www.texture;
        }
    }

The above compiles, but I now get this error:

  You are trying to load data from a www stream which has not completed
  the download yet. You need to yield the download or wait until isDone
  returns true.

It's as if it is not even yielding. What gives? The file does exist in this directory. I tried prepending "file:///" but that didn't do anything. Do I need to provide an absolute path, or is relative OK?

sentences:
When an animation involves movement, where is the movement better to implement? For context, I am using Blender and Unity. Regarding the question, as an example, in some games, when you get hit, your character tucks a bit and gets knocked back a few distance. The tucking animation I want to implement in Blender but how about the knockback distance? Do you move your model in Blender (tuck and knockback), or do you do the tuck animation only (tuck in place) and then handle the knockback in Unity (basically triggering the tuck animation and then moving the model backwards a bit).

My question basically is, what's commonly done and if there's any specific reason, why?

sentences:
How to create pixel perfect noise shader? I would like to know how they created the pixel perfect noise shader in monument valley 2 in that b/w level (example picture). I think it starts with a billboard shader, but I have no clue how to scale the texture to it's native size.

I'm using ShaderLab (unity, mobile platforms)

sentences:
How would I balance a multiplayer competitive game I'm looking at my first foray into developing a game, and would love to know whether you guys have any thoughts on game balancing on limited multiplayer games.

The game I have in mind involves a neutral player that has to achieve a goal, with two supporting "deity" players who are one of 'good' and 'evil' - One of the deity players would try to help the player achieve their goal, while the other would try to thwart them.

Any thoughts or pointers on how I can ensure the deities are balanced?

If you want me to expand, I will, just didn't want to give away too much of the game play before I finish it.

sentences:
How to create and populate a 2D Texture Arrays in DirectX11 I have generated a bunch of ID3D11ShaderResourceView that are a 2D textures that have a depth map screen shot for my lights shadows. I would like to take all of these textures and put them into a single 2D Texture Array.

I have seen examples of how to create a 2D Texture array like in this question here but I don't know how to copy the data to the newly created texture array.

sentences:
Problem with Input.GetKeyDown to set a counter in Unity: multiple values in only one pressing Using Unity 5, I want to use have one keyboard key ("f") increase a counter when pressed. It means, using Input.GetKeyDown("f") function in a way that: if "f" is pressed when the counter=1, then the counter is set to be equal 2. If counter was equal 2 when "f" is pressed, then counter is set to 3.

However, it does not work properly: it seems that Unity detects the key being pressed many times, no matter if it was only pressed once. See the code that illustrates the situation:

using UnityEngine;
using System.Collections;

public class TestingKeyGetRecursion : MonoBehaviour {

int counter = 1;

void Update () {

    if(counter == 1 && Input.GetKeyDown("f"))
    {
        counter = 2;
        Debug.Log(counter);
    }
    if(counter == 2 && Input.GetKeyDown("f"))
    {
        counter = 3;
        Debug.Log(counter);
    }
    if(counter == 3 && Input.GetKeyDown("f"))
    {
        counter = 1;
        Debug.Log(counter);
    }
}

void OnGUI()
{
    GUI.Label(new Rect(30, 10, 250, 20),  "counter: " + counter.ToString());
}
}

As you can see in the console if you run the above example, the values are properly set into the counter variable and printed in the console. However, it happens several times in the same key-hit and, in the end, the counter ends up equal as it started, i.e. equal 1.

Can anyone please explain:

1) why does the Engine behave like that;

2) is there a way to solve such situation? I cannot substitute the counter with a bool variable and just do "counter != counter" when "f" is pressed.

sentences:
Non-Perfect maze generation with objectives I need an algorithm that can generate mazes with these requirements:

Allows for random structures to be made (Ex: a center spawn area, objective points and 'Caverns (corridors with 2 or more entrances and a width > 1)' )

Generates paths from structures to required connections

Can be implemented in Python with relatively little difficulty

No extra modules (unless supports Python 3.5.5)

As an example, the objectives would look like this in game (I use integers to store the walls in the ray caster):

2 2 2 2
2 0 0 2
2 0 0 2
2 2 2 2

I also tried looking on wikipedia
and I found this semi-helpful link
but none have helped me achieve this so far.

sentences:
Play videos via 3rd party library or as animation in libGDX? I want to add an animated splash screen to my desktop game, which I develop using libGDX. Now I see there is no native support for videos in libGDX, so I guess I have two options:

Include a 3rd party framework for video playback (like the Java
media framework); or
Save the video as a series of PNG images and
play them as a libGDX animation.

Since the splash screen video is not very long, maybe 5 seconds or so, I tend to the libGDX animation option. However, the video would be full screen, so rather large images, and I am not sure whether an animation would really be the best option in that case.

Does anyone of you guys have some experience with (full screen) video playback under libGDX on the desktop?

sentences: World border in World composition A question. In World Composition there is such a border of the world. As I understand it, everything that goes beyond its limits is destroyed, but is there an option to evade it?

sentences: How to set LOD specifications for all meshes in unreal at once? I have a large model and want to avoid separately setting the LOD specifications for each component in the model. Is there are way set LOD specifications for all meshes in unreal at once since I want to set the same specifications for each one? (percentages, how many LOD's, and at what screen distance they kick in, using Unreal's autogenerated LOD's).

sentences:
How do I show a minimap in a 3D world? Got a really typical use-case here. I have large map made up of hexagons and at any given time only a small section of the map is visible. To provide an overview of the complete map, I want to show a small 2D representation of the map in a corner of the screen.

What is the recommended approach for this in libgdx? Keep in mind the minimap must be updated when the currently visible section changes and when the map is updated.

I've found SpriteBatch(info here), but the warning label on it made me think twice:

  A SpriteBatch is a pretty heavy object so you should only ever have
  one in your program.

I'm not sure I'm supposed to use the one SpriteBatch that I can have on the minimap, and I'm also not sure how to interpret "heavy" in this context.

Another thing to possibly keep in mind is that the minimap will probably be part of a larger UI, is there any way to integrate these two?

sentences:
What is the advantage of OpenGL's direct state access mechanism? I've been reading about OpenGL 4.5 Direct State Access (DSA) at opengl.org and not sure if I'm getting it right.

It seems to imply, that the old way is less efficient:

glBind(something)
glSetA(..)
glSetB(..)
glSetC(..)

than the new way:

glSetA(something, ..)
glSetB(something, ..)
glSetC(something, ..)

From the looks of it now each glSet has to include glBind(something) inside of it and if OpenGL still being a state-machine cannot take advantage of streamed changes applied to a single something.

Please explain the reasoning behind and advantages of the new DSA.

sentences:
For timed levels, how do you determine time steps that are less than 1/(frames per second)? I have made a simple HTML5 racing game.  The laps are timed.  I am running the game are 40 frames per second, each frame represents 40 milliseconds.  There for my timer will increase in 0.025 increments.

My question is how can I get my timer to record lap times more accurately, without running at 100 frames per second! How do other games do it?  Could it be to do with gauging the distance from the car to the finish line in the frame before and after it crosses the finish line?

sentences:
How to code a 4x shader/filter which emulates arcade crt display behavior? I want to write a shader/filer probably in adobe Pixel Bender that will do the best job possible in emulating the fill of an oldskul monochromatic arcade CRT screen. Much like this here:

http://filthypants.blogspot.com/2012/07/customizing-cgwgs-crt-pixel-shader.html

Here are some attributes I know will exist in this filter:

It will take in a low res image 160 x 120 and return a medium res image 640 x 480.
It will add scanlines
It will blur the color channels to create that color bleeding effect
It will distort the shape of the image from a perfect rectangle into a rounder shape.

The question is, could you please provide any other attributes that are beneficial to emulating an arcade CRT feel and links and resources on coding these effects.

Thanks

sentences:
Generating background tiles for a side-scroller with variable player speed I'm currently working on a side-scroller which lets the player alter their speed and I wondered how should I properly generate and control background tiles for such a kind o game. I'm using Flixel but I believe it's a strictly mathematical problem. Here's how I see and do it right now:

actually the player is static but he has a pseudo-velocity, that can be increased and decreased (but there is some minimal pseudo-velocity)
tiles are random so they are not kept in any tilemap - they are generated by an emitter instead
background tiles observe player's pseudo-velocity and alter their own velocity (base velocity is static for a given tile but different tiles can have different base velocities) based on it (so they use their velocity to move in the opposite direction to the player but they also increase/decrease this velocity according to the player to create the illusion of acceleration/deceleration)
the starting velocity of each background tile is maintained no matter what the pseudo-velocity of player is (so when the player accelerates, two given tiles with different velocities approach faster to the player but there is no change in the delta of their velocities, so you can say  that one tile aproaches the player fast and the other even faster :-))
background tiles are generated based on same frequency which is also dependend on the player's pseudo-velocity (so when for example the velocity of all tiles is constant, the distance between consecutive tiles is also constant but when the player accelerates, the frequency of tile generation should increase to retain the same distance between generated tiles)
and the last one trick: when the player is moving at minimal speed their sprite is located exactly on the center of the screen but when they accelerate the sprite floats to the left edge of the screen (proportionally to the current speed but with some lag) so the player can see more and has more time to react

Ok, now it's finally time for the problems! :D

I cannot come up with the proper formula for the tile generation frequency according to the player's pseudo-velocity (when the player accelerates the frequency increases too slowly and the distance between tiles increases, and when the player decelerates the frequency decreases also too slowly and the distance between tiles gets much too small, they begin to clutter)
the problem is also intensified by the last point of the above list - when the pseudo-velocity increases the player's sprite is moved to the left so the tile generation frequency should be additionally increased (and respectively delayed during player's deceleration)

Phew! I think that's a whole description of the problem. Has any of you ever fiddled with such a game mechanic and if yes, have you encountered similar problems and what were your solutions?

If the description is not clear enough, please let my know and I'll provide working example showing above concerns.

sentences: Libgdx--how to store every single point drawn using touchdragged? Basically i am trying to detect line collision. The problem is when intersection occurs quickly(touch dragged is done quickly like fling), the collision is not detected. It seems as if 'touch dragged' doesn't store all points.

sentences:
How to convert and handle (controlling) OOP game objects via ECS? I'm having hard time converting OOP game objects to Ashley ECS framework. I have a character, gun & a bullet class. The character uses the gun as weapon, the gun class has a fire method that handles the creation of bullet. In the below code, is my current WeaponSystem that serves as a generic system for any weapon like Gun class.

public interface Weapon {
     void use();
}

public class WeaponComponent implements Component {
     Weapon weapon;
}

public class WeaponSystem extends IteratingSystem {

    ... // Constructor

    ... // Process Entity

    public void use(Entity weapon) {
         WeaponComponent weaponComponent = Components.getWeapon(weapon);
         weaponComponent.use();
         ...
    }

}

The character system..

public class CharacterSystem extends IteratingSytem {

    ... // Constuctor

    ... // Process Entity

    public void attack(Entity character) {
        getEngine().getSystem(WeaponSystem.class).use(character);
        // also can be use like this
        // CharacterComponent characterComponent = ...
        // it seems that, it was redundant
        // characterComponent.weapon.use();
    }

}

And the user controlled system ...

public class UserControlledSystem extends IteratingSystem {
     ...

     public void move(Entity character) {
          ... Set character directions

          InputComponent input ...
          input.key == arrow key, etc...

          getEngine().getSystem(CharacterSystem.class).move(character, direction);
     }

     public void attack(Entity character) {
          getEngine().getSystem(CharacterSystem.class).attack(character);
     }
}

Based on this article, they are using event dispatcher. But do I really need to use dispatcher? Is that possible to not to use dispatcher, just purely ECS? Anyways let's back to the main question(How to convert and handle (controlling) OOP game objects via ECS?). Currently, the Ashley ECS Entity has an access to engine and systems. Like in the above code example, do you think it is the proper way of handling the system?

sentences:
How to disable collider2D when another gameobject is on top of it Each black colored square has a BoxCollider2D. How can I disable the collider after I put another game object on top of it?

Here is the sample output:

sentences:
Rendering to specific face of a cubemap I have working omnidirectional shadow maps for point lights. Rendering a shadow map for one point light consists of rendering the scene to 6 separate rendertargets, then send those render target textures (shaderresourceviews) to a pixel shader which will shadow the scene by projective texturing. Switching rendertargets 6 times for each point light however is quite costly, and so does sampling from those in the pixel shader later.
My question is how would I access a face of the cubemap to render to? Now I am doing Id3d11devicecontext::omsetrendertargets(1,NULL,&depthtarget) . My depthtarget is a texture2d which is bound to a depthstencil view and a shaderresource which is set up to be a cubemap. Can I even set an individual face to render to or is the process completely different?

sentences:
How big should my tiles be for tilemaps? I'm creating my first tilemaps.

Tutorials usually do 32x32px (example), but this tutorial did 128x128px, which made it easier for me to see without zooming in so much.

In tiled, I did a 40 x 40 tile map at 128 x 128 px, and the map was 5120 x 5120 px big, versus the same 40 x 40 tile map at 32 x 32 px giving me 1280 x 1280 px in resolution. I'm making a web game from the typical HTML 5 (with canvas), JS, CSS3, and melonJS engine.

Does it matter if I make 32 x 32 px tiles vs 128 x 128 px? Will it affect performance?

sentences:
SerializeField vs GetComponent Efficiency As far as I know, there are two built in ways to get an instance of a component in Unity.

1 - Serialize the field and drag in the component manually in the editor

[SerializeField] private MyScript script;

2 - Using MonoBehaviour's GetComponent method

script = GetComponent<MyScript>();

I would think that it is more efficient to drag the component in the editor lest making the engine illiterate through every component in the GameObject to find the component.

Is it more or less efficient to drag the component in the editor compared to using GetComponent? Or does Unity find components in a different way or dragging components in the editor is handled in a different way such that it would be more efficient to use GetComponent? Would using one over the other have any impact on performance in the real world?

A similar question would also be raised regarding GameObject.FindGameObjectWithTag() vs dragging in the editor.

As far as optimization go, should you use one method over another?

sentences: understanding the basics of raytracing I have got a sphere in my world space. I don't understand how can i find my sphere using my X and Y on my screen, because i don't understand what the value Z of my ray assuming the fact that we use world coordinate system.

sentences:
Specular light flickering with high specular power I'm having some issues with specular lights, to be more specific, the specular color seems to be flickering when I set high power, like 512 (I set the specular color to green, so you can see better):

http://i.imgur.com/PY0cmJA.gif

And when a power like 32 is used, everything seems ok:

Pixel shader hlsl:

pin.NormalW = normalize(pin.NormalW);

float3 toEyeW = normalize(gEyePosW - pin.PosW);

// Start with a sum of zero.
float4 ambient = float4(0.0f, 0.0f, 0.0f, 0.0f);
float4 diffuse = float4(0.0f, 0.0f, 0.0f, 0.0f);
float4 spec    = float4(0.0f, 0.0f, 0.0f, 0.0f);

// Sum the light contribution from each light source
float4 A, D, S;

ComputeDirectionalLight(gMaterial, gDirLight, pin.NormalW, toEyeW, A, D, S);

ambient += A;
diffuse += D;
spec    += S;

float4 litColor = ambient + diffuse + spec;

litColor.a = gMaterial.Diffuse.a;

return litColor;

ComputeDirectionalLight function:

void ComputeDirectionalLight(Material mat, DirectionalLight L,
  float3 normal, float3 toEye,
out float4 ambient,
out float4 diffuse,
out float4 spec)
{
      // Initialize outputs.
      ambient = float4(0.0f, 0.0f, 0.0f, 0.0f);
      diffuse = float4(0.0f, 0.0f, 0.0f, 0.0f);
      spec = float4(0.0f, 0.0f, 0.0f, 0.0f);

      // The light vector aims opposite the direction the light rays travel.
      float3 lightVec = -L.Direction;

      // Add ambient term.
      ambient = mat.Ambient * L.Ambient;

      // Add diffuse and specular term, provided the surface is in
      // the line of site of the light.

      float diffuseFactor = dot(lightVec, normal);

      // Flatten to avoid dynamic branching.
      [flatten]
      if (diffuseFactor > 0.0f)
      {
          float3 v = reflect(-lightVec, normal);
          float specFactor = pow(max(dot(v, toEye), 0.0f), mat.Specular.w);

          diffuse = diffuseFactor * mat.Diffuse * L.Diffuse;
          spec = specFactor * mat.Specular * L.Specular;
      }
  }

I'm using DirectX 11.

sentences:
box2d tween what am I missing I have a Box2D project and I want to tween an kinematic body from position A, to position B. The tween function, got it from this blog:

function easeInOut(t , b, c, d ){
    if ( ( t /= d / 2 ) < 1){
        return c/2 * t * t * t * t + b;
    }
    return -c/2 * ( (t -= 2 ) * t * t * t - 2 ) + b;
}

where t is the current value, b the start, c the end and d the total amount of frames (in my case). I am using the method introduced by this lesson of todd's b2d tutorials to move the body by setting its linear Velocity

so here is relevant update code of the sprite:

if( moveData.current == moveData.total ){
        this._body.SetLinearVelocity( new b2Vec2() );
        return;
    }

    var t = easeNone( moveData.current, 0, 1, moveData.total );

    var step = moveData.length / moveData.total * t;

    var dir = moveData.direction.Copy();

    //this is the line that I think might be corrected
    dir.Multiply( t * moveData.length * fps /moveData.total ) ;

    var bodyPosition = this._body.GetWorldCenter();

    var idealPosition = bodyPosition.Copy();
        idealPosition.Add( dir );

    idealPosition.Subtract( bodyPosition.Copy() );

    moveData.current++;

    this._body.SetLinearVelocity( idealPosition );

moveData is an Object that holds the global values of the tween, namely:

current frame (int),
total frames (int),
the length of the total distance to travel (float)
the direction vector (targetposition - bodyposition) (b2Vec2) and
the start of the tween (bodyposition) (b2Vec2)

Goal is to tween the body based on a fixed amount of frames: in moveData.total frames.

The value of t is always between 0 and 1 and the only thing that is not working correctly is the resulting distance the body travels.

I need to calculate the multiplier for the direction vector. What am I missing to make it work??

Greetings philipp

sentences:
C++ in Unity with dependencies I am currently creating a c++ program to eventually use in Unity. This c++ program contains references to libraries like OpenCV and dlib, referenced with a include statement which calls in other files, which are installed on my machine. My question is:

How do you compile your c++ project so that it runs in Unity completely self-contained? i.e no reference to external files are needed, and all that are references are included within the program. Is there a specific tool to use, or a useful tutorial on the net?

Thanks for the help.

sentences:
Unreal: Y-Axis boundary on a Camera Bounding Box I was wondering if I could get some help with modifying a Blueprint I'm currently using for a project in Unreal Engine.

I am currently attempting to make a side-scrolling platformer game and I'm using a camera bounding box Blueprint to restrict where the camera can move when tracking the player's movement, based on the following series of tutorials on YouTube by JvtheWanderer: How to make a Metroidvania/ 2D Camera Blueprint System on #UE.

The camera bounding box works as intended, in that it prevents the camera from moving beyond the limitations of the camera box placed within the scene, but I want to go even further than that and establish a limitation within the camera bounding box that not only limits the camera's movement but also prevents the player from moving on the Y-axis beyond the box's boundaries.

Pretty much every platformer from Super Mario to Sonic the Hedgehog to Castlevania, have such boundary limitations, usually at the very start of the level and also frequently at the end.  The limitation on the Y-axis boundary is also frequently used to lock the player into a particular area for forced enemy encounters, mini-boss fights as well as proper boss battles, a limitation that lasts until the player has vanquished the threat.

I wish to implement similar boundaries on the camera bounding boxes within my project to restrict where the player can go without having to place walls everywhere to keep the player from wandering beyond the level's limits.  Using walls to restrict the player's movement is fine for indoor areas, but it ends up looking distractedly out of place in outdoor areas if used in excess.

I've included screenshots below of the Construction Script & Event Graph from the SideScrollerCamera Blueprint I'm using. I would also include the Viewport and the Level Blueprint as well, except that the time being, I am unable post more than two links.

Construction Script:

Event Script:

Any help with this matter would be greatly appreciated.

sentences:
Why is my shadowmap all white? I was trying out a shadowmap. But all my shadow is white. I think there is some problem with my homogeneous component. Can anybody help me? The rest of my code is written in xna

Here is the hlsl code I used

float4x4 xWorld;
float4x4 xView;
float4x4 xProjection;

struct VertexToPixel
{
float4 Position         : POSITION;
float4 ScreenPos        : TEXCOORD1;
float Depth : TEXCOORD2;
};
struct PixelToFrame
{
float4 Color            : COLOR0;
};

//------- Technique: ShadowMap --------
VertexToPixel MyVertexShader(float4 inPos: POSITION0, float3 inNormal: NORMAL0)
{
VertexToPixel Output = (VertexToPixel)0;

float4x4 preViewProjection = mul(xView, xProjection);
float4x4 preWorldViewProjection = mul(xWorld, preViewProjection);
Output.Position =mul(inPos, mul(xWorld, preViewProjection));
Output.Depth = Output.Position.z / Output.Position.w;
Output.ScreenPos = Output.Position;

return Output;
}

float4 MyPixelShader(VertexToPixel PSIn) : COLOR0
{
PixelToFrame Output = (PixelToFrame)0;

Output.Color = PSIn.ScreenPos.z/PSIn.ScreenPos.w;

return Output.Color;
}

technique ShadowMap
{
pass Pass0
{
    VertexShader = compile vs_2_0 MyVertexShader();
    PixelShader  = compile ps_2_0 MyPixelShader();
}
}

sentences:
How to Stop TextMeshPro Truncate from Removing Next Line? Unity 2020.3.1f1 In updating from Unity 2019 to 2020, it appears the TextMeshPro (TMP_Text) is behaving differently. The code for TMP stayed the same upon updating Unity, so I presume Unity itself must be doing something differently. Nevertheless, I also updated the TMP package and it did not resolve the issue.
The Issue:
I have two lines of text in one text box. I want the overflow to be truncated, but to keep the second line in existence. Example Input:
This is the really long text on the first line that I want cut but
still have this line show.

In short, I want it to read as follows when using the "truncate" option like it used to work before
This is the really long text
still have this line show.

Instead, the second line disappears and it acts as if I have only that first line (centered vertically).
This is the really long text

So how do I get this functionality back? Is it possible?

sentences:
How good do I have to be at Math to create a 3D game using three.js? A question I've often had, how good at Math do I need to be to create 3 dimensional games? I get along with 2d games just fine. I understand everything I'm doing without problems after practise. However, jumping into 3d does seem a little scary and I'm worried my "bad at maths brain" will take it. I love creating games, I really don't want this to hold me back.

Is it possible to learn as I go along or do I need to have some natural math talent to be able to create 3d games? Also... if anyone can find a good place to start for a guy like me I'd really appreciate that too.

Thanks

sentences:
What are good ways to keep the player spending in a single-player RPG? I'm designing a game where I want the player to take the in-game money into consideration as opposed to majority where they just get rich pretty much all the time with nothing meaningful to spend it on. What are some good ways to keep them spending their money without making it feel like a tedious chore?
I'm already planning to have monsters nor quests not give gold.
And if preventing them from becoming extremely rich eventually is not possible, at least mitigate "easy" ways of generating infinite income. I want them to struggle with their money.

sentences:
Zoom at a specific point using Orthographic camera Currently I can perform Zoom which seems to be working fine but essentially what I'm really trying to do is zoom on a position offset from center as currently when I zoom then zoom is performed at the center.

Not sure how to achieve this ?

One way i'v though is either not use the orthographic camera and rather clip the texture, so that the my clipped texture will be drawn onto my directx surface covering the entire view. I could possibly perform the clipping using a constant buffer but then that would stretch the entire clipped texture over my viewport area.

Any suggestions on the above ?

I'm using Directx11, SharpDx with D3DImage & C#.

Do note: I'v created my vertexes directly screen co-ordinates.

Edit:

    this.eye = new Vector3(0.0f, 0.0f, 0.0f);
    this.lookAt = new Vector3(0.0f, 0.0f, 1.0f);
    this.up = new Vector3(0.0f, 1.0f, 0.0f);
    viewMatrix = Matrix.LookAtLH(eye, lookAt, up);

NOTE:
My application isn't a game but rather a video player

sentences:
Level design community help? I'm developing a 2D physics platformer game, with commercial purposes. Almost everything is finished:

An original game concept
The whole 2D self-written game engine
A level interpreter to read xml levels
A level editor with an advanced GUI to generate levels in xml
An advanced level object system
Profile manager (load & save game progress)
etc ...

But, my problems are of course inspiration for levels...

Is it possible to publish my game concept and ask community for level designs? And still keep my game concept save from being copied by others. Do I have copyrights on a game concept for a game which isn't officially released?

And if I should ask community, should I do an action like, for everyone who submits an approved level design (not the xml, but only a sketch), they receive one cent per sold copy of the game?

What do you think? Tips, pitfalls?

Thank you in advance!

For the interested people, here is a screenshot from the level-editor:

Fullscreen image

sentences: How to make a hand-drawn squared texture periodic with as little modification as possible? The obvious part is drawing as periodic as possible, but hand-drawing is impossibly so perfect, so what kind of modifications are possible that do not make the textures loose their hand-drawn character?

sentences:
How to achieve a Gaussian Blur effect for shadows in LWJGL/Slick2D? I am currently trying to implement shadows into my game, and after a lot of searching in the interwebs I came to the conclusion that drawing hard edged shadows to a low resolution pass combined with a Gaussian blur effect would fit best and make a good compromise between performance and looks - even though theyre not 100% physically accurate.

Now my problem is, that I dont really know how to implement the Gaussian blur part. Its not  difficult to draw shadows to a low resolutions buffer image and then stretch it which makes it more smooth, but I need to add the Gaussian blur effect.

I have searched a lot on that and found some approachs for GLSL, some even here, but none of them really helped it.

My game is written in Java using Slick2D/LWJGL and I would appreciate any help or approaches for an algorithm or maybe even an existing library to achieve that effect.

Thanks for any help in advance.

sentences: Artificial player evaluation I have a problem concerning a board game I'm creating. I plan on making an artificial player for the game using MiniMax with AlphaBeta prunning, but I'm not sure how to evaluate ir the player is good at the game. Since it's a new game I can't get a player who is good to give feedback. So I'd like to know if there is any technique to determine objectively if the artificial player is actually good. Thank you in advance.

sentences:
Creating orientation Quaternion from forward vector Suppose that I have an orientation Quaternion Q, I can compute its forward vector from V = Q * Vector3.forward easily.

Inversely, suppose that I have its forward vector V, how do I compute Q?

I know that is not possible, please tell me what's needed beside V, in order to compute Q.

Motivation behind the problem: I have a forward direction of a game object, I want to find out its up direction and its right direction. I can find out all these 3 directions if I have the orientation Quaternion.

sentences: Loading multi-texture 3ds c++ I have a question about loading 3ds using this tutorial. I want to use more than one texture on the model (because here all the models have more than one) but it seems that this library can't do that. Do you know any other alternatives or a way to edit this existing library to reach my aim?

sentences:
How do I handle game lag due to background apps I'm developing a game using libgdx and have noticed on several occasions that other background apps running can cause lag in my game - especially when those apps are being updated in the background. I'm talking serious lag like from 50-60 fps down to under 10 fps while the other app installs.

How should I handle this very noticeable lag?

Thanks!

sentences:
Click on an isometric plane and obtain normal coordinates I have photos distributed as cells. When I click, I get the corresponding row and column.
console.log("Col:" + X + "Row:" + Y);

When applying an isometric view conversion like this:

ctx.translate(0, 300);
ctx.scale(1, 0.5);
ctx.rotate(-45 * Math.PI /180);

I do not know what mathematical formula applies to get the coordinates correctly.

Based on feedback so far, I've been able to get this far. The x coordinate seems to work fine, but the y coordinate not.

Isometrico();

function Isometrico(){
     ctx.translate(0, 300);
     ctx.scale(1, 0.5);
     var radianes= -45 * Math.PI /180;
     ctx.rotate(radianes);
}

/*
document.addEventListener("mousedown", function(e) {
             CorIsometrico( e.offsetX, e.offsetY);
});
*/

/*
function CorIsometrico(xI,yI){
     //RESPUESTA yI=yI-300;
     yI = yI * 2;
     xI = xI * Math.cos(45) - yI * Math.sin(45);
     I  = yI * Math.sin(45) + yI * Math.cos(45);
     console.log("Coor Isometricas:" + xI + "/"+ + yI);
}
*/

Edit:

Each cell is 50x50. Having 10 columns and 50 rows, the information of each cell would look like this:

1: 50/50
2: 100/50
3: 150/50
...
49: 450/250
50: 500/250

Maximum Y value = 250.

xI=xI*Math.cos(45 / 180 * Math.PI)-yI*Math.sin(45 / 180 * Math.PI);
yI=yI*Math.sin(45 / 180 * Math.PI)+yI*Math.cos(45 / 180 * Math.PI);
yI=yI*2;
yI=yI-300;

Click in X:1 / Y:1 = -138.5929291125633/ 531.5575746753798
Click in X:1 / Y:5= 198.69700551341987/ 90.3229432149742

Y exceeds the maximum value.

Edit2:

var xI2=xIMath.cos(45 / 180 * Math.PI)-yIMath.sin(45 / 180 * Math.PI);
 var yI2=xIMath.sin(45 / 180 * Math.PI)+yIMath.cos(45 / 180 * Math.PI);
 yI2=yI*2;
yI2=yI-300;
xI2=xI2+150;

/// console.log("Coor Isometricas:" + xI2 + "/"+ + yI2 );

x coor : 100 to 400 px if x+150; y coor: 0 to -155.

Been thinking that the problem is not necessary on isometry.
What I'm looking for can be simplified to get the coordinates of a 2d plane by having it rotated X degrees

sentences:
Pressed key doesn't run out of special powerups So I'm making a game in Lua/Love2D and have a problem with my game logic. Mainly I have a spaceship that can use boost and stuff. That part is fine, I click space and it boosts up to speed quickly.

The problem is that if the person holds down space, they stay boosted, which is not the intended behavior. How do I make sure that once boost runs out, it decelerates to normal speed? This is how it is currently:

  Note: Normal speed, 1000. Max boost possible speed, 3000.

if love.keyboard.isDown('space') then
    if player.v < 3000 and UICounters.currentboost > 0 then
        player.v = player.v + 200
        if player.v > 3000 then
            player.v = 3000
        end
        UICounters.currentboost = UICounters.currentboost - 1
    end
else
    if player.v > 1000 then
        player.v = player.v - 100
    end
    if UICounters.currentboost < UICounters.maxboost then
        UICounters.currentboost = UICounters.currentboost + dt
    end
end

sentences:
OpenGL - How can I make the edges of this textured circle smoother? I'm building a game and I've applied a certain texture (RAW file) to a circle (GL_POLYGON) in OpenGL. It loads correctly, with the right size and all, but the edges seem a bit jagged and I would prefer them smooth (without any evidence of a polygon being underneath).

GLuint loadTex(int wrap){
GLuint texture;
int width, height;
BYTE * data;
FILE * file;

file = fopen( "tex.raw", "rb" );
if (file == NULL){
    std::cerr << "O ficheiro da textura não foi encontrado" << std::endl;
    return 0;
}

width = 128;
height = 128;
data = (BYTE*)malloc( width * height * 3 );//Alocação do buffer

fread( data, width * height * 3, 1, file );//Ler dados da textura
fclose( file );

glGenTextures( 1, &texture );//Nome da textura
glBindTexture( GL_TEXTURE_2D, texture );//Selecção da textura actual
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );//Parâmetros da Textura
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap ? GL_REPEAT : GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap ? GL_REPEAT : GL_CLAMP );
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, data );

free(data);

return texture;
}

void drawCircle(float cx, float cy, float r, float aspectRatio){

GLuint t = loadTex(1);
float angle, radian, x, y, tx, ty, xcos, ysin;

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, t);

glBegin(GL_POLYGON);

for (angle=0.0; angle<360.0; angle+=2.0){
    radian = angle * (M_PI/180.0f);

    xcos = (float)cos(radian);
    ysin = (float)sin(radian);
    x = xcos * r  + cx;
    y = ysin * r*aspectRatio + cy;
    tx = xcos * 0.5 + 0.5;
    ty = ysin * 0.5 + 0.5;

    glTexCoord2f(tx, ty);
    glVertex2f(x, y);
}

glEnd();
glDisable(GL_TEXTURE_2D);
}

Is this a problem from my texture file? Or is it from my code? I apply Line Smoothing before drawing anything (and it is being applied correctly in my lines I believe)

sentences:
Playing a Song in MonoGame I'm trying to play a song in a MonoGame project, but it always gives me a weird error. Here is the (Very simple) code:

Song song = Content.Load<Song>("Song1");
        MediaPlayer.Play(song);

But whenever I run the program, it says this:

System.InvalidCastException: 'Unable to cast object of type 'Microsoft.Xna.Framework.Audio.SoundEffect' to type 'Microsoft.Xna.Framework.Media.Song'.'

Do you know why this happens? Any help would be appreciated! :D

sentences:
How to identify performance issues with large numbers of mods? My current problem is with RimWorld, but in the past I had the same issue with Minecraft. Basically the game gets more fun with more mods, up until the point where performance becomes unmanageable. Most mods are open source and I am confident that I could fix many of these performance issues if I could only identify where the hotspots are.

So as a modder, how can I figure out where I should try and help out?

200+ mods, though obviously I would add more if I could.
I don't have access to the core game source code.
I don't have access to a debug version of the core game.
I probably have source code access to a given mod.
I'm looking for ways to help the community, not ways to make the game faster for just me (like adding more memory).

sentences: Age Rating: female nipples poking through clothing? Pretty simple and straightforward question, what rating would a game get for something like this?

sentences: How to smooth scene2d ui default skin? I am usng uiskin.png, default.fnt, uiskin.atlas to create my game UI, but the images is blurred, How do I make it smooth?

sentences:
How to design AI to understand its selling decisions? I am programming a game where there are 4 competitors (players) who have finished goods that they can then sell to given markets for which they have (at most a single) contracts for.  Any finished goods is for a given market.

Turn order is important in the game as this will decide who sells first.

Scenario.

Turn order: Player #A, #C, #D, #B

The problem I'm having is I have no idea how to make the AI players aware of the following factors; they seem to need to know a lot of things which may impact on where to sell first.

For example, AI needs to know.

Am I the only person who can sell to a given market?
If so, that's fine -- sell all goods to market.

If not, do the following

Who are my competitors for a given market and will I be able to sell first?
If I sell in Market A, will I still get a chance to sell to Market B when turn order returns to me?  (demand for items goes down for every sale and can bottom out)

Indeed, this is one strategy I'm wanting to employ --  sell to a given market because i he does not he might not get a chance to sell again when turn order returns to them.

If I sell, should the AI go for most revenue per selling round.

Currently I am looking to order all markets for a given player based upon selling ability (who can sell first)

Basically an array of people who can sell for a given market based on player order.

These people then sell, and we reduce the array by one and repeat the process.

Whilst this solves some problems, it does not solve the bigger problem, which is the AI will just end up selling stuff in the order that of the Markets array; and not specifically to the ones where it is either advatangeous to do so, or will generate them the most money.

I am wondering, how do you design an AI to make coheriant, logical decisions about what when and why they would sell to a given market?

Sorry for the wall of text.

Many thanks

sentences:
Selection with region (when rendering with shaders and VAO) I am currently render my geometry using "Modern OpenGL" approach (with shaders and buffers). I have already implemented picking of single primitives using glReadPixels. Now I am faced with problem how to implement selection of multiple objects. I cannot use glReadPixels because maximum (and it seems meaningful for me) number of objects that I could select with 10x10 box is 100. But it is really necessary for my purposes to have ability to select thousands of objects in small selection area.

I already read answer to similar question where was recommended to test each point against selection rectangle. But it gives new problems: all my vertices are already stored in buffers and it looks like huge performance to test each point on CPU.

Could someone help with such issue?

sentences:
sprite jitter when max acceleration reached at camera Camera seems making sprite jitter when max acceleration is reached :

Thats my camera code :

            var delta = (float)time.ElapsedGameTime.TotalSeconds * 10;
            var speed = (player.recCamPosition().X - _pos.X) / FocusSpeed;
            _pos.X += speed * delta;
            var speedY = (player.GetPosition.Y - 120 - _pos.Y) / FocusSpeed;
            _pos.Y += speedY * delta;
            Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0));

and here my player physic code :

     if (TileColission(new Vector2(position.X, position.Y +velocity.Y), map, 1))//&& velocity.Y>0
        {
            if (velocity.Y > 0)
            {
                //    Rectangle t = TileColission2(new Vector2(position.X, position.Y + velocity.Y), map);
                //    position.Y = t.Y-16;
                while (!TileColission(new Vector2(position.X, position.Y + 1), map, 1))
                {
                    position.Y += 1;
                }
                StandingOnGround = true;
            }
            velocity.Y = 0;
        }
        else
        {
            position.Y += velocity.Y;
            StandingOnGround = false;
        }
        if (TileColission(new Vector2(position.X+velocity.X, position.Y ), map, 1))
        {
            velocity.X = 0;
        }
        else
        {

            position.X += velocity.X;
        }

all my sprites are round to (int) at his respective drawings methods.

is not very appreciable at gyazo idk why. but the player viber when its moving.
thx for read .

sentences:
Find projecting triangle for UV mapping in RuneScape model format I am using an old Runescape model format, also used by Thief and Quake. In this format, instead of specifying UV coordinates for each vertex ABC, we specify a second trio of vertices PMN. Those vertices are then used to project UV texture coordinates onto ABC.
Some previous Q&A explains this projection algorithm and how to reverse it.
I have a mesh with UVs that I want to save in this format. To do that, I want to find a trio of vertices PMN for each triangle ABC that reproduce the correct UVs.
These PMN vertices are chosen from the collection of vertices already in my mesh.
I could search every possible ordered triangle in my mesh, but that scales as \$O(n^3)\$ and would be impractical for meshes with high vertex counts.
How can I more efficiently find a PMN triangle that produces my desired UV coordinates on each triangle ABC?

sentences:
What's the best way of drawing a glowing 3d line using LWJGL? Sort of like a strip-light effect; not actually a light source, but just a polygon with glowing edges.

Can this be done easily? Right now I'm contemplating drawing a line more than once with varying alpha/width values to achieve this, but I think that'll cause weird glowing points at the vertices, which is far from ideal.

sentences:
Editor throwing NullReferenceException I have the following exception being thrown at compile time:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:272)
UnityEditor.Graphs.Graph.WakeUp () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:250)
UnityEditor.Graphs.Graph.OnEnable () (at C:/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:245)

I know well enough what a NullReferenceException is and what causes one, but the stack trace above implies that it's being thrown by the editor or some other internal thing.

Does anyone have any advice on how to debug this?

sentences:
exact point on a rotating sphere I have a sphere that represents the Earth textured with real pictures.
It's rotating around the x axis, and when user click down it has to show me the exact place he clicked on.
For example if he clicked on Singapore the system should be able to:

understand that user clicked on the sphere (OK, I'll do it with unProject)
understand where user clicked on the sphere (ray-sphere collision?) and take into account the rotation
transform sphere-coordinate to some coordinate system good for some web-api service
ask to api (OK, this is the simpler thing for me ;-)

some advice?

sentences:
Explain the difference between extrapolation and interpolation http://www.unagames.com/blog/daniele/2010/06/fixed-time-step-implementation-box2d here there are two algorithms of smoothing in case of fixed time step physics simulation. I don't understand the formula of interpolation:

state = currentState * alpha + previousState * (1-alpha)

And also I don't understand the comparison figure. Please explaing what is the meaning of multiplying current state with alpha and summing with previous state with 1 - alpha.

sentences:
Dynamic vertex buffer mapping call order From the book Introduction to 3D Game Programming with DirectX10:

 // Update the vertex buffer with the new solution. Vertex* v = 0;
 HR(mVB->Map(D3D10_MAP_WRITE_DISCARD, 0, (void**)&v ));

 for(DWORD i = 0; i < mNumVertices; ++i) {
     v[i].pos = mCurrSolution[i];
     v[i].color = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f); }

 mVB->Unmap();

  The ID3D10Buffer::Unmap function must be called when you are done
  updating the buffer. The argument D3D10_MAP_WRITE_DISCARD passed into
  the first parameter of the Map function instructs the hardware to
  discard the buffer and return a pointer to a newly allocated buffer;
  this prevents the hardware from stalling by allowing the hardware to
  continue rendering from the discarded buffer while we write to the
  newly allocated buffer.

The bold text says that it's supposed to render while we are writing to the buffer.
Doesn't that mean that the Draw() call should happen right after we called the Map() function?

If not, why not?

EDIT:

A second question about dynamic vbuffers: When we don't only want to change the vertices inside the buffer, but we also want to create additional vertices, would it be more performance-friendly to just create a static buffer and recreate the buffer?

sentences: How to make inventory pause screens in Gamemaker? I'm making a game in Game Maker, and I want to know how to make it so you can pause into an inventory screen and then go back to the same position you were in (also the same room) after you press a back button. It would also be great if all the dead enemies were dead and the alive ones were at the same position also.

sentences:
Are Differing Store Identifiers Necessary with the Unity IAP Plugin? I am looking at implementing the new Unity In App Purchasing API for the first time.

Through the guide and the tutorial, I see that there is the ability to add different store identifiers for product ids that vary across stores... and all the examples reference that way of doing it.

Eg.:

public class MyIAPManager {
    public MyIAPManager () {
        var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
        builder.AddProduct("100_gold_coins", ProductType.Consumable, new IDs
        {
            {"100_gold_coins_google", GooglePlay.Name},
            {"100_gold_coins_mac", MacAppStore.Name}
        });
    }
}

In my case, my product id's DONT differ, so this seems like unnecessary code bloat to implement it this way... but I don't see any other option?

EDIT

Argh, I'm using VS Code on OS X, which is getting better, but still has
issues, such as having problematic code-completion / API referencing issues, so didn't see the overloaded method option... It's simply enough to do this:

var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable);

sentences:
How do I make a character "jump" when leaving an up slope? I have developed a game in Android using a tile-based system. I´ve implemented 22º, 45º and 67º up and down slopes and everything works (almost) perfect.
The problem now is that, when the character gets to the end of an up slope, it justs falls until it finds the ground. I want it to perform some kind of parabola depending on the slope and its speed. I think it´s better explained in the picture:

I already have a function that determines whether or not the character is leaving the slope, I just want some ideas of how to achieve that kind of "jump" in some pseudo-code or explanation because I don't know how to start. Any help would be appreciated.

sentences:
Changing the camera movement in unity I have a code that allows me to move the camera on the x-axis. I need it to move on the y-axis as well as the x.

    using UnityEngine;
using System.Collections;

public class orbit : MonoBehaviour {

    public float turnSpeed = 4.0f;
    public Transform player;

    private Vector3 offset;

    void Start () {
        offset = new Vector3(player.position.x, player.position.y + 8.0f, player.position.z + 7.0f);
    }

    void LateUpdate()
    {
        offset = Quaternion.AngleAxis (Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset;
        transform.position = player.position + offset;
        transform.LookAt(player.position);
    }
}

sentences:
How to calculate a quaternion rotation between 2 vectors with a specific final up vector? I know you can calculate the quaternion rotation between 2 vectors with something like this after all the optimizations:

quat quat::fromtwovectors(vec3 u, vec3 v) {
    vec3 w = cross(u, v);
    quat q = quat(dot(u, v), w.x, w.y, w.z);
    q.w += q.magnitude();
    return normalize(q);
}

However, this returns the shortest quaternion rotation between vec u and vec v. Is there a way to calculate a quaternion rotation between orientation A (with a dir vector and up vector ) and orientation B?

something like

quat quat::from_two_orientations(vec3 u_dir, vec3 u_up, vec3 v_dir, vec3 v_up)

sentences:
Why would a game engine developer use both DirectX and OpenGL? It's very common for cross-platform game engines to support both DirectX and OpenGL, and even Vulkan. Why would a studio want to write abstraction code 2, 3, or even 4 times? OpenGL/Vulkan are practically on par with DirectX.

In my experience, businesses care about their bottom line. Paying developers to write duplicate code gets expensive very quickly. It'd be nice to use the most native API for each target platform, but I don't understand how the cost and overhead is worth it.

Since Windows support OpenGL/Vulkan, why bother writing the DirectX code when the final game will look nearly identical?

sentences:
Unity launches both Visual Studio and Monodevelop simultaneously When I open a script for editing from Unity, both Visual Studio and Monodevelop are launched, resulting in two instances of the same solution to be open in two different script editors.

I am presently running the latest version of Unity 5.50fs (though I also experienced this issue in the previous build prior to installing Unity's latest update), in conjunction with Visual Studio Community Edition 2015, and Visual Studio Tools For Unity 2.3.0.

I also have my external script editor set to VS in the preferences window of Unity.

While investigating this issue I came across a forum thread of someone experiencing a similar problem, where MD opens instead of VS. This seemed to be a result of a hard coded reference to MD for redundancy in cases where VS might fail to load, which I thought sounds like a plausible explanation for my situation as well.

The general consensus was that when VS takes a little too long to open, Unity reverts to MD under the assumption that their is a problem with VS. This explanation seems even more likely in my case because this issue only occurs when I first open Unity for the day- if I have had VS open recently MD does not open, and VS opens quite quickly, likely a result of being cached in my computers memory.

The work around offered to avoid MD launching instead of VS in that thread, was to change the name of the MD executable, so that Unity would be unable to launch MD, giving VS time to finish loading. I was however hoping to find a better solution. I like the fact that Unity has that redundancy in place and would rather keep it intact, and I don't know why but changing the executable solely for that purpose makes me feel a little OCD.

Other ideas I have tried include reinstalling Unity, running both Unity and VS as an administrator, and launching VS prior to opening the script in Unity (in this case Unity opens a second instance of VS).

Has anybody else experienced both script editors being launched simultaneously and/or have any other ideas on how to resolve it? It's obviously not a critical issue or anything, but it is a bit annoying.

sentences:
Unity Events executed out of order According to this page Events in unity are suppose to execute in a specific order.  Specifically, OnCollisionEnter is supposed to be called right after OnTriggerEnter; however, FixedUpdate and Update are both being called at least once in between calls to my OnTriggerEnter2D and OnCollisionEnter2D functions in my Enemy class, why is this the case?

Here is my code:

public class Enemy : Combatant
{
public int kill_points;
public float force;
public List<GameObject> path_verticies;
private int pathi;
private bool on_path;
private bool is_flying;
private bool ignore_collision;          //Used for ignoring collisions with walls, if the enemy has already touched an enemy_controller.

void Start ()
{   Init();
    pathi = 0;
    ignore_collision = false;
    is_flying = false;
    if (gameObject.tag.Contains("Fly")) is_flying = true;//Assuming contains is cheaper than a full string compare.
    on_path = null != path_verticies && 0 != path_verticies.Count;
}

private void FixedUpdate() { ignore_collision = false; }

void Update ()
{   if (!CheckBounds()) Destroy(gameObject);
    if (on_path)
    {   transform.LookAt(path_verticies[pathi].transform, Vector3.up);
        transform.Rotate(new Vector3(0,-90,0));
        phys.velocity = transform.right * speed;
    }
    else dx = Mathf.Sign(Cx) * speed;
}

public void Flip(){ Cx *= -1; }

#pragma warning disable CS0642 // Possible mistaken empty statement
private IEnumerator OnCollisionEnter2D(Collision2D collision)
{   if (on_path && path_verticies[pathi] == collision.gameObject)
    {   if (collision.gameObject == player)
        {   throw new System.NotImplementedException();
            yield return new WaitForSeconds(0.1f);//Used to prevent damage to the player if the player landed on top of the enemy.
            var atk = player.GetComponent<Combatant>().vigor.Attack(2);
            if (Health.Atk.DIES == atk) player.GetComponent<Life>().Die();
        } else pathi = (pathi+1) % path_verticies.Count;
        yield return new WaitForSeconds(0.0f);
    }
    else if (on_path)
    {   if (collision.gameObject == player)
        {   yield return new WaitForSeconds(0.1f);//Used to prevent damage to the player if the player landed on top of the enemy.
            var atk = player.GetComponent<Combatant>().vigor.Attack(2);
            if (Health.Atk.DIES == atk) player.GetComponent<Life>().Die();
        } else if (collision.collider == On(Truebounds)) /*nothing*/;
        else if (collision.gameObject.layer == 0 || collision.gameObject.layer == 8)// TODO
            /*take velocity in the direction opposite of the normal and add it to
             * the perpendicular component the enemy is moving in*/;
        yield return new WaitForSeconds(0.0f);
    }
    else
    {   if (collision.gameObject == player)
        {   yield return new WaitForSeconds(0.1f);//Used to prevent damage to the player if the player landed on top of the enemy.
            var atk = player.GetComponent<Combatant>().vigor.Attack(2);
            if (Health.Atk.DIES == atk) player.GetComponent<Life>().Die();
        } else if (ignore_collision) /*nothing*/;
        else if (collision.collider == On(Truebounds)) { if (is_flying) Flip(); }
        else if (collision.gameObject.layer == 0 || collision.gameObject.layer == 8) Flip();
        yield return new WaitForSeconds(0.0f);
    }
}

private IEnumerator OnTriggerEnter2D(Collider2D collider)
{   var component = collider.GetComponent<MonoBehaviour2>();
    if(!component) yield return null;
    else if (on_path && path_verticies[pathi] == collider.gameObject)
        pathi = (pathi+1) % path_verticies.Count;
    else if (on_path) /*nothing*/;
    else if (component.type == typeof(Enemy_Controller)) { Flip(); ignore_collision = true; }
    yield return null;
}
#pragma warning restore CS0642 // Possible mistaken empty statement

//public void OnDestroy(){  }
}

and these are my timestep settings:

sentences:
How does this bezier curve rendering shader determine if a curve is concave or convex? I have read an article about rendering quadratic splines on a GPU with a shader.

The algorithm is explained like this:

For each quadratic Bézier curve we use Bézier control points of the curve to create triangles. Triangles we get contain curves that are either convex or concave.
Then we need to assign [u v] coordinates to the vertices of the triangles (article says that we assign values [0 0], [½ 0], and [1 1]; I'm not sure why these values are used).
Then it say that instead of using [u v] coordinate to look up a color value as in texture mapping, we use the [u v] coordinate to evaluate a procedural texture. The pixel shader computes the expression u^2 - v using the sign of the result to determine pixel inclusion. For convex curves, a positive result means the pixel is outside the curve; otherwise it is inside. For concave curves, this test is reversed.

At the end of the article an example implementation of that algorithm is provided (reproduced below). It says it is a "quadratic curve pixel shader" so as I understand it, it should be able to render both convex and concave curves, but I am only able to get it to render convex curves.

Is it an incomplete example? If not, how / where it is specified if the curve is convex or concave?

float4 QuadraticPS(float2 p : TEXCOORD0, float4 color : COLOR0) : COLOR
    {
       // Gradients
       float2 px = ddx(p);
       float2 py = ddy(p);
       // Chain rule
       float fx = (2*p.x)*px.x - px.y;
       float fy = (2*p.x)*py.x - py.y;
       // Signed distance
       float sd = (p.x*p.x - p.y)/sqrt(fx*fx + fy*fy);
       // Linear alpha
       float alpha = 0.5 - sd;
       if (alpha > 1)       // Inside
         color.a = 1;
       else if (alpha < 0)  // Outside
         clip(-1);
       else
         // Near boundary
         color.a = alpha;
       return color;
    }

PS: Gradients and Chain rule sections of the shader are about anti-aliasing I think.

sentences: What is "terrain mesh generation" exactly? I'm new to computer graphics and need to know and understand what the "terrain mesh generation" is? I read about "terrain", "mesh", "terrain generation" but can't find an article named "terrain mesh generation". So is there anyone can explain "terrain mesh generation" ?

sentences:
How to use a buffer in GLSL to do a LUT-lookup? I am currently on a medical application which needs different kinds (up to totally individual) lookup tables (LUT) for image display. And this done with 10bit finish. So it is most of the time required to use 16-bit gray scale pixels.

I chose to use modern OpenGL and thus I'll want the lookup to happen in a GLSL shader program.

I had a try in uploading a 1D-Tedture (R16) using sampler1D to do the lookup as such:

        uniform sampler2D tex;
        uniform sampler1D lutData;
        in vec2 fragTexCoord;
        out vec4 finalColor;
        void main()
        {
            float primaryLvl = texture(tex, fragTexCoord);
            // index image 'color' in Lut-Texture
            float red = texture(lutData, primaryLvl);
            finalColor = vec4(red, red, red, 1.0);
        }

It works about as expected - however Textures (also 1D aparently) are limited to 8192 in size (on my machine). So the requirement for full range 16-bit images is not met.

For this above test I upload my images as R16 (for me it is gray) - normalized float 0-1.0.

Would it be feasible to upload a buffer (arbitrary data) and do the lookup there?
How would I do this (Syntax)?

And will my current pixel format interfere with my idea so I have to upload it as R16_INT instead. Or can (and should) I convert it in the shader from Normalized to Int (how is this done)?

Thanks

sentences:
Black bars on 720p emulator? I'm making a game for Windows Phone 8 using XNA 4.0 in Visual Studio express 2012. I'm trying to add a background image to the game with a size of 1366x768 (as I believe WP8 only supports up to 720p). Everything stretches  well on the other emulators (WVGA and WXGA) until I use the 720p emulator and I get black bars on the sides:

How can I fix this, or is this normal?

This is all the code I have used so far:

GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D Background;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";

        graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;

        this.graphics.IsFullScreen = true;

        // Frame rate is 30 fps by default for Windows Phone.
        TargetElapsedTime = TimeSpan.FromTicks(333333);

        // Extend battery life under lock.
        InactiveSleepTime = TimeSpan.FromSeconds(1);
    }

    /// <summary>
    /// Allows the game to perform any initialization it needs to before starting to run.
    /// This is where it can query for any required services and load any non-graphic
    /// related content.  Calling base.Initialize will enumerate through any components
    /// and initialize them as well.
    /// </summary>
    protected override void Initialize()
    {
        // TODO: Add your initialization logic here

        base.Initialize();
    }

    /// <summary>
    /// LoadContent will be called once per game and is the place to load
    /// all of your content.
    /// </summary>
    protected override void LoadContent()
    {
        // Create a new SpriteBatch, which can be used to draw textures.
        spriteBatch = new SpriteBatch(GraphicsDevice);

        Background = Content.Load<Texture2D>("SkyBackground");

    }

    /// <summary>
    /// UnloadContent will be called once per game and is the place to unload
    /// all content.
    /// </summary>
    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    /// <summary>
    /// Allows the game to run logic such as updating the world,
    /// checking for collisions, gathering input, and playing audio.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        base.Update(gameTime);
    }

    /// <summary>
    /// This is called when the game should draw itself.
    /// </summary>
    /// <param name="gameTime">Provides a snapshot of timing values.</param>
    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);

        // TODO: Add your drawing code here
        spriteBatch.Begin();
        drawBackground();
        spriteBatch.End();

        base.Draw(gameTime);
    }

    private void drawBackground()
    {
        spriteBatch.Draw(Background, GraphicsDevice.Viewport.Bounds, Color.White);
    }

sentences:
Why use asset manifest files? Sometimes you'll see people recommend that rather than using graphics/sound files/etc. like this...

// Game code
Image myImage = new Image("path/to/image.png");

... you should use a manifest file as a level of indirection instead:

// Manifest file
MY_IMAGE: path/to/image.png

// Game code
Manifest myManifest = new Manifest("path/to/manifest");
Image myImage = myManifest.getImage("MY_IMAGE");

What reasons would I have of taking this sort of approach? If I'm not using a compiled language, would there still be reasons to do this?

sentences: How to keep player in the center of the screen but let him move to the edge of the map without moving camera there? In my rpg-styled (top-down perspective) 2d game, I want my player to be at the center of the screen, while the entire world moves, giving the effect of player movement. I can make that, but my problem is at the edges of the game-world, I want the world to stop moving and the player to move.

sentences:
Libgdx - accelerating string displaying My renderBoard is slow and it's because of font.draw function. I read that I should use stringBuilder instead of string, but it didn't help at all. I suppose I'm using it wrong. Could you guide me to the right way?

public void renderBoard(SpriteBatch sb, BitmapFont font) {
    int L = 0;
    String string;
    ...
    // "size" is a private variable of the class, the same goes for "stringBuilder"
    for(int k = - size + 1; k <= size - 1; k++) {
        for (int j = 1; j <= size - Math.abs(k); j++) {
            string = L + "";
            for(int g = 0; g < string.length(); g++) {
                stringBuilder.setCharAt(g, string.charAt(g));
            }
            sb.draw(
                    this.getTexturesArray().get(L),
                    x_j_k_position,
                    y_j_k_position
            );
            font.setColor(Color.WHITE);
            font.draw(
                    sb,
                    stringBuilder,
                    x_j_k_position,
                    y_j_k_position
            );
            L++;
        }
    }
}

If I comment out the font.draw line, the game accelerates, so I guess here lies the problem.

sentences:
How do you implement 2D collision detection? I would like to know the best or most efficient way to test for 2D collision.

I am currently using AABBs, but the problem with this, is that your objects will be hitting things when they shouldn't. On top of this, AABBs cannot be rotated.

I was considering using per pixel collision, but I feel that it would lag on large bitmaps, since there would be a lot of pixels to check.

What I would like to know, is how I can allow my bounding boxes to be rotated, and use any polygon instead of just rectangles for collision. Also, is there a way of creating circular collision bounds that aren't just approximations of circles?

sentences:
What is the difference between libraries like C++/PDCurses and SFML? I have read that PDCurses is a library that can be used to create 2D games however SFML is also a library but they are not in the same category I presume according to what I have read:
"The system terminal is a part of your operating system which allows communicating with the computer using text. If you choose to do this, it is also a good idea to use a library — but now, you use a library for creating programs working in the terminal, rather than a game library. Here, the most popular choice is Curses"
Can somebody explain the difference?

sentences:
Need some advice regarding collision detection with the sprite changing its width and height So I'm messing around with collision detection in my tile-based game and everything works fine and dandy using this method. However, now I am trying to implement sprite sheets so my character can have a walking and jumping animation.

For one, I'd like to to be able to have each frame of variable size, I think. I want collision detection to be accurate and during a jumping animation the sprite's height will be shorter (because of the calves meeting the hamstrings). Again, this also works fine at the moment. I can get the character to animate properly each frame and cycle through animations.

The problems arise when the width and height of the character change. Often times its position will be corrected by the collision detection system and the character will be rubber-banded to random parts of the map or even go outside the map bounds. For some reason with the linked collision detection algorithm, when the width or height of the sprite is changed on the fly, the entire algorithm breaks down.

The solution I found so far is to have a single width and height of the sprite that remains constant, and only adjust the source rectangle for drawing. However, I'm not sure exactly what to set as the sprite's constant bounding box because it varies so much with the different animations.

So now I'm not sure what to do. I'm toying with the idea of pixel-perfect collision detection but I'm not sure if it would really be worth it. Does anyone know how Braid does their collision detection? My game is also a 2D sidescroller and I was quite impressed with how it was handled in that game.

Thanks for reading.

sentences:
Using VMs for game development or physical machine? When I was doing web development, I would develop websites inside my virtual machines, which had all tools and packages downloaded on them and ready to go. I quite liked this approach to development since I didnt have to clutter up my Host OS with a bunch of different packages and other other software only needed for development.

So for game development, given its focus on speed and much higher demand for system resources, is developing in VMs viable? Or are there any gotcha's or other difficulties when using VMs that could deter someone from developing and testing a game within a VM vs directly on the physical computer hardware? Mainly wondering about speed and if the extra abstraction layer of a VM would cause any significant slow down of game testing (having slower or wonky FPS or things of that nature)?

EDIT: Also, for more info, I'm currently developing on my windows 10 PC with a core i7 processor. I can switch to the built in hypervisor (hyper-v) at any time.

sentences:
How can I apply a mesh distortion to walls like in Dungeon Keeper 2? In Dungeon Keeper 2, the walls of the dungeon have different random shapes depending on its state (freshly dug or reinforced, and so on).

They look like they are cubes of 3x3 vertices that have a x-z planar jitter or distortion. However, the corner vertices are shared by adjacent cubes, so there must be some kind of algorithm rather than just a random jitter.

How could I achieve a similar effect?

sentences:
How do I work around the "You are missing the recommended JDK" error? After switching to 2019.4 LTS I got this error (using Windows 10)

You are missing the recommended JDK. Install the recommended version using Unity Hub.

I installed the JDK using Unity Hub many times now, still the same error.
Tho I don't think it's getting installed.
As you can see below, the "OpenJDK" checkbox remains blue no matter how many I try to install it.

When I tried downloading and installing the JDK (JDK 1.8.0_181) myself I get this error instead:

You are missing the recommended JDK, versions other than 1.8.0 are not officially supported.

sentences:
When I use rigidbody.move rotation, my player sinks I am trying to implement a simple movement on an object and when I use movePosition from rigid body, the player starts to sink:

How can I resolve this issue?
Below is my code.
void Update()
{
    Movement();
    MouseLook();
}

void MouseLook()
{
    //get X movement of mouse and save as float y
    //get Y movement of mouse and save as float x
    float _xMove = Input.GetAxis("Mouse Y") * mouseSensetivity * Time.deltaTime;
    float _yMove = Input.GetAxis("Mouse X") * mouseSensetivity * Time.deltaTime;

    //make vector of that movements
    Vector3 xLook = new Vector3(_xMove, 0f, 0f);
    Vector3 yLook = new Vector3(0f, _yMove, 0f);

    //apply Y vector to body and rotate it entirely
    _rigidBody.MoveRotation(_rigidBody.rotation * Quaternion.Euler(yLook));
    //apply X vector on camera to rotate it.
    _camera.transform.Rotate(-xLook);
}
void Movement()
{
    //Vector3 move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
    //_charController.Move(move * Time.deltaTime * WalkSpeed);

    //register x axis movement
    //register y axis movement
    float _xWalk = Input.GetAxisRaw("Horizontal");
    float _zWalk = Input.GetAxisRaw("Vertical");

    //Make vectors
    Vector3 _WalkSum = (transform.right * _xWalk + transform.forward * _zWalk).normalized;

    //feed this to Move position of rigid body
    if (_WalkSum != Vector3.zero)
    {
        //_rigidBody.velocity=transform.forward+_WalkSum;
        //_rigidBody.AddForce(_WalkSum*WalkSpeed);
        //_rigidBody.MovePosition(_WalkSum);
        _charController.Move(_WalkSum * WalkSpeed * Time.deltaTime);
    }
}

sentences:
Problem when importing fbx in Unity made in Blender First I will explain how do I make my object in Blender:

I want to make an object with a texture that have transparecies (png image). I unwrap my object and then apply the image to it in the UV editor. Then I export my object as fbx.

To try the transparecy first I imported a PNG image as a plane on Blender and adjusted the necessary things in order to make work the transparency. You can appreciate the settings I used in the following image:

Until there is all fine. The problem appears when I import the fbx in Unity. The material that I created with the png image is not well visualized.

When I import the fbx object in Unity, this messages appears in the Materials tab:

What do I have to set here in order to visualize well the image with its alpha channel working?

Furthermore, if I try to change the material settings it is impossible because I cannot click the different options as they are disabled:

Can anybody tell me what I'm doing wrong? I don't know if my error is when creating the material in Blender or when I import the fbx in Unity.

sentences:
How to use TEnumAsByte Unreal 4.22 The problem

I am attempting to use a TEnumAsByte in one of my class headers:

I get compilation errors:

Code sample

I have included everything relevant to the member variable I am trying to create:

Header File:

#pragma region Engine Includes

#include <Containers/EnumAsByte.h>

#pragma endregion

UCLASS( Blueprintable, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class PLATFORMER_API UGrappleAbilityComponent : public UActorComponent
{
    GENERATED_BODY()

protected:
    // Begin AActor Interface //

    /** Called when play starts */
    virtual void BeginPlay() override;

    // End AActor Interface //

public:
    /** Determines what type of debug draw is used for the continuous grapple scanning */
    UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Grapple Scan", meta = (AdvancedDisplay, DisplayName = "Grapple Cont Scan Debug Draw Type"))
        TEnumAsByte<EDrawDebugTrace::Type> m_GrappleScanDebugDraw;
}

Source File:

UGrappleAbilityComponent::UGrappleAbilityComponent()
{
    PrimaryComponentTick.bCanEverTick = true;

    // Give an initial value to the debug draw mode for the continuous grapple scanning.
    m_GrappleScanDebugDraw = EDrawDebugTrace::None;
}

...

void UGrappleAbilityComponent::GrappleScanContinuous(FHitResult & OutHit)
{
    // Only scan if the player is not attached and their airbrake is not active
    if (!m_GrappleHook->IsAttached() && !m_OwnerCharacter->IsAirbrakeActive()) {

        // Increment the trace lerp value.  -   Then wrap the Trace lerp value back around to 0.
        m_GrappleScanTraceLerp += 0.1f;         if (m_GrappleScanTraceLerp > 1.f) { m_GrappleScanTraceLerp = 0.f; }

        // Calculate the proposed end point of the grapple.
        FVector EndPoint = m_StartPoint + m_StartPointDirection * m_GrappleCastDistance;
        float zOffset = FMath::Lerp(m_GrappleContScanLowHeight, m_GrappleContScanHighHeight, m_GrappleScanTraceLerp);
        EndPoint.Z += zOffset;

        // Perform the box traces.
        UKismetSystemLibrary::BoxTraceSingle(GetWorld(),
            m_StartPoint, EndPoint, m_GrappleContScanHalfSize, FRotator::ZeroRotator,
            UEngineTypes::ConvertToTraceType(ECollisionChannel::ECC_GameTraceChannel5),
            false, {}, m_GrappleScanDebugDraw.GetValue(), OutHit, true);
    }
}

Additional Info

The compilation errors relating to the BoxTraceSingle call are irrelevant as they only occur due to the compilation errors with the TEnumAsByte. Aside from the .GetValue() call. Removing this still causes similar compilation errors however.

I can confirm this as, by looking at Epic's engine code, they use TEnumAsByte in exactly the way I have done here, aside from the .GetValue() call.

What the hell is going on here?

sentences:
How should I go about randomizing levels in a "runner" game? I'm working on a runner type of game (basically it's a never ending run through hordes of enemies and platforms and whatnot). 2d platformer view.

Should I random a bit of map every now and then? Few screens or 30 screens? And what about platforms and ground to make the whole thing "doable". Can I find any resources on that subject?

sentences:
FPS controller initializing at bizarre location I have got the hang of basic construction, terrain modification, applying materials, placing trees, etc.  I have created a water plane, positioned my terrain above it, and am able to sink lakes and pools, and raise hills and mountains.  Built a couple of primitive structures too.

Initially (before mucking about with the Y position of the terrain) I was also able to invoke Gameplay mode and walk around my game using FPS Character Controller.  I could walk into and out of my structures and hike over the hills and valleys of my terrain.

However, since changing the Terrain Heightmap to make the "sinkhole" (negative altitudes) work, I am having the strangest trouble with my FPS Character Controller.  I position it at a reasonable height above the terrain, and everything looks fine in Editor mode;  but when I start Play mode my FPS character starts out miles below the world, looking up at the underside of the terrain.

So far nothing I have tried will make the FPS Controller start in the location where I have dragged it in Editor mode.  I have tried Saving Scene and exiting and reloading.  I have deleted and recreated the FPS controller.  No matter what I do, it persists in initializing itself in this oddball "way below the world in outer space" location.

I have googled diligently but have not found any mention of this problem.  Presumably I'm skipping some important step, but tutorial videos don't offer any advice beyond "drag the fps controller into the scene and it should work."

sentences:
Easing towards stepped value I'm currently developing this rhythm game in lua (on top of a c++ engine) and I'm having trouble keeping a steady playhead position for the song currently playing.

The playhead position that the engine gives me updates in steps, so I get a fresh one every 2, 3 or 4 frames. But I need to have a steady one for sprites moving smoothly with the rhythm and stuff.

So I just keep track of my own playhead variable, which I initialize in 0 and then constantly add delta time to it. This variable eventually gets out of sync with the actual playhead, so every time I get a fresh playhead (or a "new step"), I correct my variable using the average between these two.

This however results in choppy movement.

I've seen many easing functions out there but I'm not sure which one would work in this case, nor when should I call it.

What would be the best way to ease my playhead variable into the stepped one?

This is the code I excecute every frame:

-- add delta to my own playhead variable

playhead = playhead + delta_time

-- if there's a new stepped_playhead value, correct my playhead

if stepped_playhead ~= last_stepped_playhead then
    playhead = (playhead + stepped_playhead) / 2
    last_stepped_playhead = stepped_playhead
end

sentences:
Effective SpriteBatching in XNA? What is an example of efficient sprite batching in XNA?

I don't know when (if ever) I would do something like this:

spriteBatch.Begin()
DrawSprite1();
spriteBatch.End();

spriteBatch.Begin();
DrawSprite2();
spriteBatch.End();

Is there any time within a draw method that I would separate drawing calls like this?

Thanks!

sentences:
Gamemaker vs Unity2d - Speed of Development I know coding, so programming is not a problem
Money is not a problem at all, I can get both GameMaker Master
Collection and Unity Pro

I want to make a 2d game.

So which one is better for speed of development? On which one would I be able to finish my project earlier?

sentences:
How do I organize my class structure for networking? In my gameclient I have the following classes(compontents):
Game, GameScreen, GameWorld, Player.

They are structured like this:
Game has two GameScreens: MenuScreen and MainScreen.
MenuScreen has an instance of GameWorld.
GameWorld has an instance of Player.

Now I wanted to add a multiplayer mode to my game. For this I have a class "NetworkConnection".
For the problem keep in mind that this class needs to access individual objects in the game world, as well as vice-versa. Meaning that individual objects (as a simple example the player) need to send messages to the class.
It could look like this for example:

networkConnection.SendPlayerPositionUpdate(x, y, playerID);

The problem

Where do I put my NetworkConnection?

I thought about adding it to "Game" because it is a part of the game (duh).
But when I want the player to tell its position to the server I have to do this:

(Inside the player class)
world.screen.game.networkConnection.SendPositionUpdate(...);

The otherway around (when messages are being received from the server)

(Inside the network class)
game.currentScreen.world.player.SetHealthPoints(receivedHealth);

Where should I place NetworkConnection?
Should I make NetworkConnection a global singelton ?

sentences:
Control rig sequence is not in UE4 menu In the Unreal Engine docs, it is mentioned that, in order to create a Animation Sequence using the Control Rig, it is possible to create a ControlRig Sequence.
Now, why do I need that?
I need it to create Animation Sequences for my character and I do not want to create the Animation Sequence in other softwares, like Blender.
So why I can not find  ControlRig Sequence in UE4 menus?

sentences:
2D shader to draw representation of rotating sphere I want to display a 3D textured sphere, and then rotate it in one direction. The direction will never change, and the camera will never move. One way is to actually create a spherical mesh, map a texture to it, rotate the sphere, and render in 3D.

My question is, is there a way to display a 2D circle, that looks like a rotating sphere, with just a 2D shader.

In other words, can someone think of a trick, like mapping a texture to the circle in a particular way, to give the appearance of an in-place rotating sphere, that is always viewed from the side?

I don't need exact shader code, I'm just looking for the right idea.

sentences:
Set Layer of UI Object being Dragged In my game, I have an inventory system with slots and images in those slots. The images are by default disabled, but when an item is added to the slot, the image component becomes enabled. I have implemented a very simple drag and drop system for moving objects around in the inventory using IBeginDragHandler, IDragHandler, and IEndDragHandler. As I am dragging an item from one slot to another, I want the item image to be rendered in front of the slots and the rest of the inventory. Currently, when dragging an item image, it renders behind the empty slots.

I don't want to use hierarchy order to organize the layers of these slots because moving items around is very dynamic and the hierarchy order of the slots changes seemingly randomly when I press play. Is there another way to ensure that the item image being dragged is "closer to the camera" or in front of the rest of the inventory? Thanks.

sentences:
Networking with UDP, should I keep sockets open on the server I am working on making a 2D platforming game that will have multiplayer functionality. Over the last few days, I have done a lot of reading regarding how to deal with the networking, and believe that I am on the way to implementing some of the concepts I have read about.

I have decided to go with an Authoritative server/client model, where multiple clients will send actions made by the user to the server, client will predict the players next steps before comparing against the Authoritative reply from the server, etc. This seems to have been suggested in numerous corners of the web regarding games networking, and seems reasonable.

Before jumping straight into trying to get snapshots sent from the server, I wanted to make sure that I had an idea of some of the technical nuances of a language, as conceptual knowledge can only get me so far. I have set up a simple Echo Server that has worked rather well for a single client, but now my next step is to have multiple clients connected to the server at a single moment, and have each message that is sent from a client echoed to all clients connected to the server.

I feel that the answer might be language dependent, so I will mention now that currently I am using Java for the networking (a little bit of preliminary testing may suggest that Java has significant overhead in its network implementation, so I am open to change upon suggestion). I am using UDP for speed sake (and this seems to be what is predominantly suggested).

My question is with the server, should I be keeping each DatagramSocket that represents a connected client open and send DatagramPackets directly out without ever closing them (until the program terminates, client disconnects, etc.), and have them stored in some form of Collection, or should I close them after each message is sent and create a new outgoing socket whenever I need to send a packet? There are obvious performance disadvantages of creating a  socket whenever I need to send a message, but is there some fundamental reason that I have not come across that suggests leaving sockets open is not a good idea?

sentences:
Interpolate camera rotation over many keyframes smoothly I have a defined set of rotation/position keyframes that I want a camera to animate between smoothly.  Handling the position is easy enough using cubic bezier curves (and just auto-generating the control points between each keyframe).  But after a day of research I'm still having a lot of trouble figuring out how to handle rotation similarly.

My first thought was that there must be a similar way to do it using bezier curves, except applied to quaternions instead of 3d vectors.  I found a bunch of research papers on the subject, but as is so often the case with research papers, actually implementing them is another story entirely (and frustratingly, source code is never provided).  So if anyone with experience in this stuff could give me some direction as to the best approach here I'd really appreciate it

sentences:
Computer Graphics degree or Game Development degree to get into game industry? I am currently having a BSc degree in Computer Science. I want to get into AAA game industry. My focus is on the core stuffs like rendering, physics, graphics programming. I plan to get a master's degree for that. Now, should I choose a broader branch, Computer Graphics, or should I go for the specific Game Development for the degree?
Note: It maybe easier for me to get the Computer Graphics degree. And I know that I have to show some complete projects, practical knowledge, passions to get the job in the industry.

sentences:
Problems with converting from Screen Space to World Space I have an unproject function I've written, which takes in x and y values between -1 and 1, and a z value between 0 and 1 (0 is near plane, 1 is far plane).  I create a vector off of this, and multiply it onto Matrix.Invert(ViewMatrix * ProjectionMatrix) to get the world-space coordinates of that screen position at that depth.  The problem I'm having is that the given depth values don't result in the right position (at least as I understand it).

Above is a rough sketch of what I'm seeing.  The black lines are the frustrum edges, red lines are near and far plane, and green line is the plane drawn at the given z depth.  My assumption was that the depth would be linear, with z = 0.5 being halfway between the near and far plane, however the values all sit very close to the near plane until z is real close to 1, at which point it rapidly approaches the far plane.  Am I doing my calculations wrong somewhere?  Or did I just misunderstand how projections work?

sentences:
How to override onSetContentView while Using Ratio Resolution policy in Andengine Base game activity I am developing (Learning to build :)  ) a game with  andengine GLES2.
I am using base game acitvity , and i overrides the setContent view to place my admob ad.Every thing works fine except the resolution policy . Ratio Resolution policy is the one I am using along with CAMERA_WIDTH = 800; and CAMERA_HEIGHT = 480;

The issue is whenever overided onsetContentView scene is not get aligned to center ,margins displayed only on bottom not on both top and bottom, Same will cause when horizontally align the margin will be displayed only at right side, not on both sides. how can i correct this. I am giving my code below

@Override
protected void onSetContentView() {

    System.out.println("Content setting");
    this.mRenderSurfaceView = new RenderSurfaceView(this);

    final LayoutParams layoutParams = new LayoutParams(
            android.view.ViewGroup.LayoutParams.MATCH_PARENT,
            android.view.ViewGroup.LayoutParams.MATCH_PARENT);

    layoutParams.gravity = Gravity.LEFT ;

    final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams = new FrameLayout.LayoutParams(
            layoutParams);

    adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxxxxx");

    final FrameLayout.LayoutParams adViewLayoutParams = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.WRAP_CONTENT,
            FrameLayout.LayoutParams.WRAP_CONTENT, Gravity.LEFT
                    );

    final FrameLayout frameLayout = new FrameLayout(this);
    final FrameLayout.LayoutParams frameLayoutLayoutParams = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.FILL_PARENT,
            FrameLayout.LayoutParams.FILL_PARENT,Gravity.CENTER);

    frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams);
    frameLayout.addView(adView, adViewLayoutParams);

    this.setContentView(frameLayout, frameLayoutLayoutParams);
    this.mRenderSurfaceView.setRenderer(this.mEngine, this);

}

here is the image what i get you can see the white margin below the scene if you select the image ( its not get into attention due to stack overflow also had white background )

any suggestions will be very help full to me

How Can i solve this Isuue Please help me

Thanks to all,

sentences:
Unity / Box2D / Raycasting and Performance Im currently using the Unity Engine and the Box2D Physics Engine.

I have this line of code:

    "RaycastHit2D ray = Physics2D.Raycast(origin, direction, distance);"

Im planning to use this line of code ... like "a lot" times (maybe like 100.000 times per frame)

And I have 3 simple Questions about Raycasting and Performance:

How much does 1 Raycast cost (approximately).
Is the Raycast processed by the CPU now or by the GPU?
Does the number of the BoxColliders affect the cost of the Raycast? (for example:
If I have 1000.000 Tiles on the map which have box Colliders, does one ray has the same performance cost as if i would have 1 single Tile?
And if I have 1000.000 tiles - is the cost millionfold then?

sentences: Trophies programming design pattern What design pattern is best for implementing trophies in a game? I am not a games developer, but is it easy for each player's action to check and update conditions that satisfy 50-100 trophies at any time aside from everything that goes on in the game engine? How is it best done?

sentences:
Move towards view direction opengl? I'm trying to get the basics of 3d with opengl 2.0(I know, I know, it's deprecated etc, etc. It's just for the sake of prototyping). I'm trying to get a cube on the screen which you can move around. I have rendered the cube, and I can navigate the "world"(black background with the colored cube). However, when I try to rotate the camera, and then move, the camera moves independently of the camera's direction. For example, I rotate 90 degrees to the left, then I press "w" and it looks like I'm strafing to the right.
I use sdl2 to get keyboard input, and when the user presses a key, I increase deltaX, deltaY, deltaZ, rotationX and rotationY accordingly(that's right, no rotation around the z axis).

And the rendering occurs as follows:

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    // Apply transformations
    glRotatef(rx, 1, 0, 0);
    glRotatef(ry, 0, 1, 0);
    glTranslatef(dx, dy, dz);

    // Draw each face with a different color
    glColor3f(1.0, 1.0, 0.0);
    glDrawArrays(GL_QUADS, 0, 4);
    glColor3f(1.0, 0.3, 0.4);
    glDrawArrays(GL_QUADS, 4, 4);
    glColor3f(0.0, 1.0, 0.5);
    glDrawArrays(GL_QUADS, 8, 4);
    glColor3f(1.0, 1.0, 1.0);
    glDrawArrays(GL_QUADS, 12, 4);
    glColor3f(0.3, 0.8, 0.0);
    glDrawArrays(GL_QUADS, 16, 4);
    glColor3f(0.0, 0.0, 1.0);
    glDrawArrays(GL_QUADS, 20, 4);

How can I do this?

EDIT: forgot to add, I would like to do this without glu. I don't like linking against a lot of libraries, especially when it's only to get a few functions.

EDIT2: I got forward movement to work using trigonometry like this:

case SDLK_w:
    posZ += (float)cos(rotY * M_PI / 180); // I use rotY * PI/180 to convert rotY to radians
    posX -= (float)sin(rotY * M_PI / 180);
    break;
case SDLK_s:
    posZ -= (float)cos(rotY * M_PI / 180);
    posX += (float)sin(rotY * M_PI / 180);

And now the only thing to add is strafing, which I thought would be something like this

case SDLK_a:
    posX += (float)sin(rotY * M_PI / 180) + (float)cos(rotY * M_PI / 180);
    posZ += (float)sin(rotY * M_PI / 180);
    break;
case SDLK_d:
    posX -= (float)sin(rotY * M_PI / 180) + (float)cos(rotY * M_PI / 180);
    posZ -= (float)sin(rotY * M_PI /180);
    break;

But it doesn't work, if you strafe when looking down the x axis, you move backwards in the z axis(wtf?)

Thanks!

EDIT3: Never mind, solved it by doing

case SDLK_a:
    posX += (float)cos(rotY * M_PI / 180);
    posZ += (float)sin(rotY * M_PI / 180);
    break;
case SDLK_d:
    posX -= (float)cos(rotY * M_PI / 180);
    posZ -= (float)sin(rotY * M_PI /180);
    break;

I don't know if this is the best way to do it, but it works. Thanks everyone for helping me!

sentences:
How are components properly instantiated and used in XNA 4.0? I am creating a simple input component to hold on to actions and key states, and a short history of the last ten or so states. The idea is that everything that is interested in input will ask this component for the latest input, and I am wondering where I should create it.

I am also wondering how I should create components that are specific to my game objects - I envision them as variables, but then how do their Update/Draw methods get called?

What I'm trying to ask is, what are the best practices for adding components to the proper collections? Right now I've added my input component in the main Game class that XNA creates when everything is first initialized, saying something along the lines of this.Components.Add(new InputComponent(this)), which looks a little odd to me, and I'd still want to hang onto that reference so I can ask it things.

An answer to my input component's dilemma is great, but also I'm guessing there is a right way to do this in general in XNA.

sentences:
Avoiding bouncing between states in an FSM Suppose you have a simple state machine for a game character with two states:

StandingIdle
Walking

In the update logic for the StandingIdle state you have (pseudo code):

if input received
    setState(Walking)

In the Walking state you have:

intendedLocation = calculate new location based on current heading and speed

if intendedLocation is blocked
    setState(StandingIdle)
else
    move to intendedLocation

Now this creates the problem that the state machine can bounce back and forth between the states, which can result in an awful visual effect. This is because the StandingIdle state may switch to Walking, whereupon the Walking state may determine that something is blocking the way and subsequently switch back to StandingIdle. As long as there is input being received (ie. the player is trying to move), then the state machine will bounce back and forth between these two states.

In order to deal with this, the StandingIdle state could first check whether there is sufficient room in which to start walking. But that requires either duplicating logic that already exists in the Walking state, or exposing that logic in some fashion and calling it from the StandingIdle state. I am leaning towards the latter route at this stage.

Another option I considered was exposing some kind of canTransition() method from my state objects and having the state machine call it prior to allowing a state change. That way, the Walking state could return false if there is insufficient room to walk. This, however, creates other problems.

Is there a best practice way to deal with this problem?

sentences:
Where to start writing games, any tutorials or the like? I'm actually an industrial systems developer with knowledge of .NET C# and VB.NET, C/C++, Delphi, and an intermediate knowledge of 80286 Intel assembly language.

I would be interested to learn how to develop games while taking as fully as possible advantage of my already acquired experience.

My first objective is to learn the differences between management and game software development so that I may make my mind up as to what is important to think about as a game developer.

Any hint as to where to start to learn is appreciated, such as game writing tutorials, the kind of "Hello World!" program, if I may say.

Besides, these following tutorials were found while "googling":

C++ Game Programming;
C and C++ Programming Games and Entertainment Tutorials;
C++ Game Programming Resource Center;
Creating a game in C++.

Are they any good?

The answer that will have guided me the most will be accepted. Thanks for your help! =)

sentences:
Best solution for "level string"? I have a game that generates a random level map at the start of the level. I want to implement some way to save and load the level.

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

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

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

sentences:
libGDX box2D not setting user data I am working about box2D.
Even if I set userData, when I retrieve it via getUserData(), it returns null. Using debugger, I noticed that object passed to setUserData() is not null, but on the next istruction: fixtureDef.shape.dispose();
Body user data returns being null, such as setUserData() set on a copy of body. I read on other topics that setUserData() must be called before body creation...but it throws an exception
      @Override
public void setPhysic(@Null Shape shape, BodyDef.BodyType bodyType, FixtureDef fixtureDef) {

    if(shape == null) {
        PolygonShape polygonShape = new PolygonShape();
        BoundingBox boundingBox = this.model.calculateBoundingBox(new BoundingBox());
        polygonShape.setAsBox(boundingBox.getWidth(), boundingBox.getHeight());
        fixtureDef.shape = polygonShape;
        fixtureDef.density = 1f;
    }else{
        fixtureDef.shape = shape;
    }

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = bodyType;
    bodyDef.position.set(this.getPosition().x, this.getPosition().y);

    this.body = Game.world.createBody(bodyDef);
    this.body.setUserData(this); //<-- Add this line to fix the problem
    this.body.createFixture(fixtureDef).setUserData(this);

    fixtureDef.shape.dispose();
}

Here I get userData:
  if(body[0].getUserData() instanceof Block){
            if(button == Input.Buttons.RIGHT){
                ((Block)body[0].getUserData()).onBlockClicked(player);
            }else if(button == Input.Buttons.LEFT){
                player.onPlayerBlockDestroying((Block)body[0].getUserData(), mouseCords);
            }
        }

sentences: What level editor is Phil Fish using in Indie Game: The Movie? Does anyone know what program Phil Fish is using to edit models of levels? Or is it it something he built himself? I'm new to game development and was looking for something to design levels with besides my notebook.

sentences:
Creating a Full Stadium of People, Ready as a Game Asset (ie. not too CPU intensive) I am trying to make a boxing scene in my game. I decided to attempt to make the large stadium first (It's a boxing management game, so the scene can be 'pre-rendered' perhaps, the fight events (eg. Big hits, blocks, dodges) are going to be calculated based upon the boxers skill values and some luck etc.
I have this scene in Maya:

My first idea was to 'scatter' assorted people into the crowd. But on further advice it seems this might be too resource-heavy.
I am very keen to learn such things as LOD, or effects to make it look like the crowd is full of people. Also smoke etc effect to cover empty areas (or allow for much reduced detail) would be amazing.
A little bit broad question I realise, but I'm looking for some starting points of what to learn to achieve this stuff.
Many thanks

sentences:
Best way to let the player know there are multiple solutions to a problem?(and force them to play again) I am going to work on a map for my game that is in first person mode. This is the story(planned).

He is on a sinking ship and he wants to escape before the ship sinks. He has a few ways of doing so, either with the on board seaplane or an emergency raft. Both methods will lead the player to different maps in the game. So here is the question:

How can I notify the player that there is another way of "winning" the map if he chooses one. I do not want to just pop out and say "hey you could have used the boat" or even include a progress map of some sorts, but I still want the player to visit the map again in the future to figure out the paths. Any suggestions would be awesome.

The lighting would be dimmer as the scene is set at night. There will be blood, grease and other dirty stuff on the player's screen. The ship itself is most probably going to wobble around.

edit
Sorry that I didn't clarify, but I want to know methods to lure players to play the map again. Methods of letting the player know that there are different methods works, but I think that should not be the only method. I'll change the title.

sentences:
Canvas UI elements out of place in Unity3d I placed all elements in the places I want to show in the Game mode,
nevertheless, when I go to Game Mode they are shown in the wrong place as it was shown in the pictures (they go to the center). I tried different modes of render mode but no one seems to work in this case. I want the elements to be fixed in the window no matter monitor size.

sentences:
3D sphere generation I have found a 3D sphere in a closed-source game engine that I really like the look of and would like to have something similar in my own 3D engine.

This is how the sphere looks like when it is created in the game engine, at program/game start:

At program start, a function named CreateSphere is called and the user has the option to choose a 3D position and a radius of the sphere. That's all I know about the function since the engine is closed source.

Anyone have any idea of how this sphere might be generated programmatically?
I have checked other posts/sites discussing spheres but none of them has the look of the sphere in the image.

Edit: removed some unnecessary information to get to the point of what I need help with.

sentences:
representing transforms without a world/global reference frame Background:

I'm trying to make a segmented/portal-based game engine
that supports impossible (non-euclidean?) geometry.

By segmented/portal-based I mean the world is divided into segments which are connected by portals.
This technique was used by the engines for classic shooters like Doom and Duke Nukem 3d.

The portals do not look or function like the portals in the game Portal, which is unfortunately what most of the results that queries containing "portal" bring up.

Each area is in its own coordinate system
with each portal defining the transformation between
the portal entrance in the origin segment and
the portal exit in the destination segment.

It is possible for there to be multiple portals connecting the segments and for those portals to have different transformations.
If I understand correctly, this makes the world non-euclidean and precludes storing a transformation for each connected segment on a segment.

Objects have transforms for each segment they are present in.
So instead of the usual transform setup of objects having a local transform, a parent transform, and a world transform
there is no world transform and it is possible to have more than one "parent" transform.

Advanced math is not my strong point.
I understand the basics of the transformations
but there are some details I don't fully grok
and almost certainly some important or useful
properties that I am not aware of.

Questions:

Where do I "store" or "collect" the results of applying transformations to an object?

Do I apply them to the object's local tranform or do I apply it to the object's transforms relative to "parent" segments?

It seems like a bad idea to accrue transformations on the local transform, but perhaps I don't understand the purpose of the local transform.

Research before asking question:

tutorial on simple portals in unreal that helped with outlining the transformation logic, but is focused on unreal and does not answer my questions.

flipcode portal rendering tutorial which gets brought out anytime there is a question about portal-based rendering. I have read through it a couple times, although the small font is hard for me to read so it is very possible I missed some details.

related question

related question

discussion on gamedev subreddit

sentences:
Airplane passenger point of view scene I'm building a game with unity where a lot of scenes take place in an airplane as a passenger seated near the window, the airplane has to do a take off and a landing.

I can't find any examples of similar scenes anywhere on Internet.
So I was wondering which would be the best approach to do this :

Simulate the airplane physics, "checkpoints" system where the airplane travels through each checkpoints (current solution)
Animate the airplane with the unity animator system (tried it but it feels really cheap)
Static plane but make things move around him (possibility to have better lightings inside the plane as it is static)
360° Videos

The current solution works ok but I'm looking for improvements. I found the intro scene from The Forest pretty similar to what I'm trying to acheive here and I was wondering how they did it.

The current system works like this :

The plane has two engines script who control the speed of the plane. Another script controls the yoke, roll and pitch of the plane. And the last script is the 'Autopilot', each checkpoint tells the plane where to go and at whitch speed. You have to tweak the values until you have a good result which can be really time consuming.

Thank you !

sentences:
Nested input in an event-driven system I am using an event-based input handling system with events and delegates. An example:

InputHander.AddEvent(Keys.LeftArrow, player.MoveLeft); //Very simplified code

However, I started wondering about how to deal with 'nested' input. For example in Half-Life 2 (or any Source game, really), you can pick up items with E. When you've picked up an item, you cannot fire with Left Mouse, but instead you throw the object. You can still jump with Space.

(I am saying nested input is where you press a certain key, and the actions you can do change. Not a menu.)

The three cases are:

Being able to do the same action as before (like jumping)
Not being able to do the same action (like firing)
Doing a different action entirely (like in NetHack, where pressing the open door key means you do not move, but select a direction to open the door in)

My original idea was to just change it after the input had been received:

Register input 'A' to function 'Activate Secret Cloak Mode'

In 'Secret Cloak Mode' function:
Unregister input 'Fire'
Unregister input 'Sprint'
...
Register input 'Uncloak'
...

This suffers from large amounts of coupling, repetitive code, and other bad design signs.

I guess the other option is to maintain some kind of input state system - perhaps another delegate on the register function to refactor out those numerous register/deregister into a cleaner place (with some kind of stack on the input system) or maybe arrays of what to keep and what not to.

I'm sure someone here must've encountered this problem. How have you solved it?

tl;dr How can I deal with specific input received after another specific input in an event system?

sentences:
Precalculating timespan of bullet collision on cubic bezier curve circles? I'm fairly new to game logics, C#/XNA (The language/library of choice) and bezier curves in general, and is stuck in my current project. I'm going to try to explain as thoroughly as I can what the issue at hand is.

The illustration above shows a line (P/Player) and three cubic bezier curves (A/B/C = "Enemies") between the time interval 0 ≤ t ≤ 1.

When the player holds down the right arrowkey, the player will move in a linear path to the right accordingly to a time variable (t). If the player also holds down the "fire button", the player character will shoot out bullets with a width of about 5 px from the top of it.

If the engine I have in mind is going to work, I will have to know precisely for how long period of time the enemies moving in their cubic bezier curves are being exposed to these bullets being shot out of the player. E.g. during the timespan of 0 ≤ t ≤ 1, enemy A will be exposed to bullets for a total of 0.43 units, B = 0.27 and C = 0 (these are made up results)

Which would be the most efficient and best way to take on this issue? So far I'm thinking of solving it by finding out the roots of the intersection of the line and the curve on the X-Axis to know if the players bullets will make contact during the timespan. But even if they do make contact, how can I make sure which enemy the player hits if the enemies paths kind of "overlap" eachother (like A and B in the picture)?

Some facts about the bullets that could clarify the behavior of the bullets I have in mind:

Bullets can't penetrate enemies. When it hits it's first target, it does not affect the one's behind it
For now, I'm satisfied if someone could come up with a solution without "bullet travel time" in mind. That the bullets hits instantly doesn't bother me too much. Bonus points if "travel time" is added in the solution of course.
In the picture, I show two lines. I would like to be able to multiple bullets being able to fire from different starting points on the player (like a dual-shot, quad-shot ect).

To sum my question up: (Quick reference guide)
When player goes to the right within 0 ≤ t ≤ 1, for how long does the player's bullets collide with the enemies?

sentences:
Unity animations in iOS I'm an iOS developer and I'm trying to make 2d animations with Unity 4.3 + RageTools Pro + RageSpline. I want to integrate the animations into a native iOS application.
In Unity I have different kind of animations, different characters, and I want to control these separately in Xcode.

I know how to build unity project to Xcode and I know how to customize the Unity view in Xcode, my problem is that I can't access individually the animations, I can't loop them and I can't switch them in a specific view.
My another problem is that the built Xcode project from Unity is too large (more than 300 MB).

So the question is if I continue to develop the character animation within unity is it possible to handle separately the animations in Xcode? Or do I have to find a another solution (use another animation tool, or export from unity into some different file format like FBX).
In summary I want to make a simple iOS app with simple animations and i'm looking for the simplest solution.

Thanks in advance for your help.

sentences:
How to find a safe path for an AI snake? I have been working on a game in which a player can compete with a snake ai to get the most apples.  The current path finding technique i use (A* Pathfinding) works fine. But I am struggling with coming with an effective way to make sure that the AI snake does not go for an objective that leads to it trapping itself. Consider that the snake can teleport and that there may be max 4 apples on the map at any given time. The decision tree I am trying to create looks somewhat like this:

If path to goal is safe : go for apple!
Else check next apple until a safe path is found or all apples are checked.
If no path to any apple is safe including the paths produced if teleportation is possible, Then find the farthest path to the tail and remain chasing the tail until a safe path to an objective becomes available. If no path to tail is found : stall until death!

The problem is that it is really hard to find a fast and efficient way to determine if a path is safe!

My question is: what is a good way to determine if a path into an enclosed area is safe given that you cannot take the same path back out of that area?

sentences:
How to rotate a rigidbody with a Pid controller I would like someone to describe me how to use a PID controller to rotate a rigidbody with AddTorque to a specific position. (like a spacecraft that rotates the Y axis of rotation towards Camera.forward for example). Can anyone show it to me with a script?

Actually I already use this script to rotate with AddTorque but the object almost never stops at the precise point.

Vector3 camForward = Camera.main.transform.forward;
Vector3 rbForward = rb.transform.forward;
Vector3 torqueY = Vector3.Project(torque, Vector3.up);
Vector3 torque = Vector3.Cross(camForward, rbForward);
rb.AddTorque(torque);
rb.AddTorque(-rb.angularVelocity);

sentences:
Fast pixelshader 2D raytracing I'd like to do a simple 2D shadow calculation algorithm by rendering my environment into a texture, and then use raytracing to determine what pixels of the texture are not visible to the point light (simply handed to the shader as a vec2 position) .

A simple brute force algorithm per pixel would looks like this:

line_segment = line segment between current pixel of texture and light source

For each pixel in the texture:
{
  if pixel is not just empty space && pixel is on line_segment
       output = black
  else
       output = normal color of the pixel

}

This is, of course, probably not the fastest way to do it. Question is: What are faster ways to do it or what are some optimizations that can be applied to this technique?

sentences: Is it a good idea to perform all matrix operations on the GPU? I was wondering if it is a improvement to use OpenGL for matrix calculations instead of using the CPU. And if it is a improvement, is it worth it to change the math class to use OpenGL?

sentences:
Matrix rotation of a rectangle to "face" a given point in 2d Suppose you have a rectangle centered at point (0, 0) and now I want to rotate it such that it is facing the point (100, 100), how would I do this purely with matrix math?

To give some more specifics I am using javascript and canvas and I may have something like this:

var position = {x : 0, y: 0 };
var destination = { x : 100, y: 100 };
var transform = Matrix.identity();

this.update = function(state) {

  // update transform to rotate to face destination

};

this.draw = function(ctx) {
  ctx.save();
  ctx.transform(transform); // a helper that just calls setTransform()
  ctx.beginPath();
  ctx.rect(-5, -5, 10, 10);
  ctx.fillStyle = 'Blue';
  ctx.fill();
  ctx.lineWidth = 2;
  ctx.stroke();
  ctx.restore();
}

Feel free to assume any matrix function you need is available.

sentences:
Question about top down/side scrolling! I know that its just the background that scrolls and the player pretty much stays centered.  What I am wondering what technique is more correct when I am implementing a large side scrolling map (I am not using tiles like some other questions I have found).

using a very large map 16000 pixels map, and scrolling that. and create an image list, with maybe 4 4000 pixel maps?

also, lets say I want a box at a certain point in my map. Right now I am just counting the pixels that I am scrolling and once I get to pixel 2000 I insert the box, and scroll it with the background.  Does that seem correct? or is there a better way to do all of this?

sentences:
How do you simulate UV light and materials with UV-reflective/fluorescent properties within a PBR renderer? I have a PBR setup, say, in Unity (or Unreal, doesn't really matter, I'm asking about the general principle, not specific implementation), and I would like to add a UV light source, and have control over how my materials respond to it, but still ideally have it conform to the rules of physically-based rendering.
Question is: what do I need to extend with what kinds of properties, and what are the equations to wire them together, and where do I plug those?
Do I need to actually do modifications like this, or does the fact that it already is PBR mean that I only need to plop in a light source with correct combination of settings, and correct responses to that UV source just naturally happen?
Edit:
I am asking about fluorescence, where I want certain materials to glow in particular visible light colours in places where the invisible UV light hits them.

sentences: Unity5 using non-convex meshcollider with rigidbody I want to build a car using wheel collider, mesh collider and rigidbody. The problem is that unity wants the meshcollider to be convex, and that cannot happen because my base model is bigger than 255 poly's.

sentences:
Conversion of a number from Single precision floating point representation to a Half precision floating point Hope it is relevant here.

I have a code where I have to work on Half precision floating point representation
numbers. To achieve that I have created my own C++ class fp16 with all operators(arithmetic logical, relational) related to this type overloaded with my custom functions, while using a Single precision floating point number with a Half precision floating point number.

Half precision floating point = 1 Sign bit , 5 exponent bits , 10 significand bits = 16 bit

Single precision floating point = 1 Sign bit, 8 exponent bits, 23 significand bits = 32 bits

So what I do to convert from a Single precision floating point number to a Half precision floating point number:-

For significand bits - I use truncation i.e. loose 13 bits from the 32 bits to get 10 bits significand for half precision float.

What should I do to handle the exponent bits. How do I go from 8 exponent bits to 5 exponent bits?

Any good reading material would help.

sentences:
Unity 5 Networking Send Rate: Send Rate is Zero but server movement is still happening I have a client server scenario, just a player moving about on the client and he moves about on the server using the built in networking provided in Unity 5. I have my client scene running in the editor and was playing about with the Network Transform Script Values, more specifically the Network Send Rate. Setting this Value to 29 (its highest) the movement on the server is almost smooth. Setting this value to 1 and the movement on the server is very laggy as I expected. However, if I set the network send rate to 0 on the client, I expected it not to move at all on the server, but it moves and alot smoother than the value 29.

Why is it, that when the network send rate is set to 0 that my character still moves on the server?

sentences:
How to measure time interval (different languages) What is the recommended way to measure time intervals for a game loop?

Consider the situation in which a developer is writing their own game loop. Using a third party game engine such that you do not write your own game loop is beyond this question.

In general I want the best API from the standard library, unless there is reason to not use it. The exception being well stablished game development libraries that do not force a game loop on the developers.

Ideally the solution is not to use System time. We want something unaffected by time zones, leap seconds, daylight saving, the user messing with the system clock, etc… plus the system time usually has poor resolution for games.

I also found Time a Function - Rosetta Code, it uses system time in some cases.

This is a community wiki.

sentences:
Monogame scale/resizing texture without stretching the borders I would like to scale or resize my texture2d but when I do it, the texture border becomes stretched.

Here's an example :

This is my original texture

And this the texture after I change the Scale:

The texture's border becomes stretched compared to the original, and I would like to preserve exactly the same border than the original texture.

Is there a way to re-scale a texture without having it stretched?

If so, could you help me find the best way to do it?

sentences:
Do GLSL 4.x subroutine variables cause any performance overhead? There's not too much deep information about them on the web.

How are they implemented and how they work under the hood? I'd like to know that they cause any performance overhead or not, especially in the case of multiple subroutines to decide what's the best practice to create different versions of shaders: subroutines or separate shaders.

Any info or advice?

sentences:
Open_GL Camera somehow not centered I setup my OpenGL viewport via

    ViewPort( 0,0,WindowW, WindowH )
    MatrixMode( Projection )
    LoadIdentity()
    MaxY = ClipNear * Tan(FieldOfView * 0.00872664626)
    MaxX = MaxY * Ratio
    Frustrum(-MaxX ,MaxX ,-MaxY ,MaxY ,ClipNear ,ClipFar)
    MatrixMode(ModelView)

Then I add rotation and move the Camera accordingly

    LoadIdentity()
    Rotated(ry,1,0,0)
    Rotated(rx,0,1,0)
    Translated(z,y,x)

However the center of the frustrum is not the middle of the Window.
It is slightly right and up in the window.

I'm sure there is a bug in my code but I can't seem to find it.
I have checked every place I could think of.

The bug could be caused by setting a wrong viewport however that doesn't seem to be the case as a similar Project (however not using modular code) works fine with the same viewport settings.

The bug could also be caused by setting a wrong Frustrum. However that also works in the other project.

Aside from that I do not know of anything that could cause this.

As my Code is written in a rather weird language posting it here wouldn't do any good.

So my question is what kind of mistake/bug can cause a behaviour like that.

sentences:
line to point collision without doing three square roots Is it possible to test a point to line collision without doing three square roots? Here's how I'm currently doing it:

I have point P that I want to check is on the line, and point A and B for the two ends of the line. I use the Pythagorean equation to get length PA, PB, and AB. Now I check to see if PA + PB = AB. if PA + PB is larger than AB, the point cannot be on the line.

private boolean PTLCollisionCheck(float px, float py, float ax, float ay, float bx, float by) {
    float PA = (float) Math.sqrt(((px - ax) * (px - ax)) + ((py - ay) * (py - ay)));
    float PB = (float) Math.sqrt(((px - bx) * (px - bx)) + ((py - by) * (py - by)));
    float lineLength = (float) Math.sqrt(((ax - bx) * (ax - bx)) + ((ay - by) * (ay - by)));
    return (PA + PB) <= (lineLength + 1);
}

sentences:
Xna c# picking model with Ray mouse cursor select the wrong model i made a small 3D game and i just try to apply a basic sample from here : http://rbwhitaker.wikidot.com/picking
for picking model by the mouse cursor.
For that i use the Ray object and check if some model intersect my Ray.
But i don't know why, the model object target by my cursor is always offset to the left.there is a shift difference.

Here is the code i use.

// Update Ray cursor each frame in the Update loop function

public void UpdateRayCursor()
        {
            Vector3 nearPoint = new Vector3(Globals.mouseState.Position.ToVector2(), 0);
            Vector3 farPoint = new Vector3(Globals.mouseState.Position.ToVector2(), 1);

            nearPoint = graphic.GraphicsDevice.Viewport.Unproject(nearPoint, CameraNode.Camera.Projection, (Matrix)CameraNode.View, Matrix.Identity);
            farPoint = graphic.GraphicsDevice.Viewport.Unproject(farPoint, CameraNode.Camera.Projection, (Matrix)CameraNode.View, Matrix.Identity);

            Vector3 direction = farPoint - nearPoint;
            direction.Normalize();

            Ray = new Microsoft.Xna.Framework.Ray(
                nearPoint
                ,
                direction
                );
        }

// check if a model is target by the Ray

public void UpdateIntersectSceneRay()
    {
        float? nearestDistance = 0f;
        bool findModelTarget = false;
        foreach (var bdgToCheck in ListBlocksSelectable)
        {
            //Check if the boundingBox intersect with the ray
            var checkIntersectDistance = _mainPlayer.Ray.Intersects(bdgToCheck);
            if (checkIntersectDistance != null)
            {
                if ((float)checkIntersectDistance < (float)nearestDistance || nearestDistance == 0)
                {
                    nearestDistance = checkIntersectDistance;
                    _mainPlayer.ItemFocusByReticle = item;
                    findModelTarget = true;
                }
            }
        }
        if(!findModelTarget)
        {
            _mainPlayer.ItemFocusByReticle = null;
        }

    }

Some people have some idea why ? i use monogame library with XNA.
Thank you in advance

sentences:
Why does setting a static member value in MonoBehaviour child class constructor have no effect? I am following a tutorial for Unity. I don't know C# but I know other similar languages.

I got the tutorial to work. Here is the script I used.

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

public class PlayerMove : MonoBehaviour {

    private Rigidbody rb;
    public float speed;

    // Use this for initialization
    void Start () {
        speed = 3.5f;
        rb = GetComponent <Rigidbody> ();
    }

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

        float fx = Input.GetAxis ("Horizontal");
        float fz = Input.GetAxis ("Vertical");

        rb.AddForce (new Vector3 (fx, 0, fz) * speed);
    }
}

This goes slightly against my C++ instincts, which are to put initialization values in a constructor.

    public PlayerMove ()
    {
        speed = 3.5f;
    }

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

This doesn't work. In Unity, the speed field has an initial value of 0.

Why does setting the initial value in a constructor not work?

sentences:
Are all conditions in an if statement checked? If I have an if statement like this:

bool conditionOne = true;
bool conditionTwo = false;
bool conditionThree = false;

if(conditionOne || conditionTwo || conditionThree)
{
    //do something
}

Will conditionTwo and conditionThree actually be checked even though conditionOne is already true, and thus has met the requirements of the if statement to run the code inside it? It would be pointless to check if conditionTwo and conditionThree are true because either way the code inside the if statement would be run.

I'm thinking this would be useful to know if I have some really long and quite expensive checks to do.

sentences:
Do I need more than one UDP socket on the server? I'm trying to make a UDP game server using the SDL_net library. This library offers SocketSets which are, according to the documentation, an analogy to the select function. Right now I have successfuly made a simple server which has just one UDPsocket and dumps every message to stdout.

Can I use those SocketSets somehow to make the server responsive, or am I just fine using only one UDPsocket for everything?

sentences:
Heightmap in Shader not working I'm trying to implement GPU-based geometry clipmapping and have problems to apply a simple heightmap to my terrain. For the heightmap I use a simple texture with the surface format "single". I've taken the texture from Catalinz's XNA blog.

What I'm trying to do is just getting the single float value from the texture at the vertex world coordinate and apply the value to the Y-Value of the Vertex. I'm applying the heightmap through the shader, because there is no fixed grid in-code it could be applied on. What I've tried so far was using the tex2Dlod function, but there seems to be no output or an output of 0. The Direct X vertex shader's code looks like this:

float4 worldPos = mul(float4(pos.x,0.0f,pos.y, 1.0f), worldMatrix);
float elevation = tex2Dlod(HeightmapSampler, float4(worldPos.x, worldPos.z,0,0));
worldPos.y = elevation * 128;

Where HeightmapSampler is a point-mirror sampler of the heightmap texture. Here is the output, I actually get no elevation:

And here's the heightmap I'm using:

sentences:
Are VBOs only for OpenGL 3.x? Are VBOs only for OpenGL 3.x?

I'm using immediate mode and I know it's bad, slow, and deprecated. But then I looked at display lists but they are deprecated too. I guess the VBO is the only one left so is it only for OpenGL 3.x?

sentences:
Is it feasible to stream your game when the screen is small? My game consists of a very small screen (256x256). Behind that screen, though, there is a lot of very, very expensive ray tracing going on, which requires a very powerful GPU. Moreover, all clients see a variation of the same scene, so, a single GPU could render the whole scene for everyone.

Given that scenario, I had the idea of just rendering the screen on the server and streaming it to the clients. This way, one could run my game even on very weak machines. But I guess the bandwidth use could make it unpractical; is it possible to stream a 256x256 screen at 30 fps without delay and in a lossless format?

sentences:
PhysX - Revolute joint around unit vector I'm using a right-handed coordinate system with (0,0,-1) = forward, (1,0,0) = right and (0,1,0) = up. PhysX version is 3.3.0.

I have a unit vector which represents the axis around which my actor is supposed to be able to rotate, (0,1,0).

The problem is, if I build a quaternion rotation from that vector, like so:

physx::PxQuat q = (0, physx::PxVec3(0, 1, 0));

and use that for the joint, the actor will actually rotate around the direction of the rotation around the axis:

http://youtu.be/pXMlRRBVOpc

However, what I want is this:

http://youtu.be/MlBx-hC1Z9Q

In the second case I used (0,0,1) as axis and 90 degree as rotation and used that to build the quaternion.

So, how can I use my axis (0,1,0) and actually get the rotation as shown in the second video?

sentences:
How do I make game server for UDK game? I'm new in UDK and I'm starting to develop online multiplayer games.
There is a one problem, I couldn't find any tutorials about how to make a game server using udk. I suppose, that it uses unreal script. But that's about all I know about it.
So I'd really like for some help.

sentences:
Can this script be edited to create a "shotgun" type spread when firing? [Top down shooter] I have this code and I'd like to add a shotgun to the game by slightly modifying the code. I've looked online for any example but everything I find is for FPS not a TDS.

void Shoot ()
{
    timer = 0f;

    gunAudio.Play ();

    gunLight.enabled = true;

    gunParticles.Stop ();
    gunParticles.Play ();

    gunLine.enabled = true;
    gunLine.SetPosition (0, transform.position);

    shootRay.origin = transform.position;
    shootRay.direction = transform.forward;

    if (Physics.Raycast (shootRay, out shootHit, range, shootableMask))
    {
        EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
        if(enemyHealth != null)
        {
            enemyHealth.TakeDamage (damagePerShot, shootHit.point);
        }
        gunLine.SetPosition (1, shootHit.point);
    }
    else
    {
        gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    }
}

I have a basic understanding of most of this code. I don't quite understand how shootRay.direction understands transform.forward means always the front of player. As DMGregory stated adding a variable of some sort that runs through a for loop firing multiple different angles (or simply different coordinates if making angle rays is over my head) is the route I first thought of but I cannot find a way to implement it. I'm having issues with understanding how to manipulate ray coordinates because they cannot be changed by floats which is the extent of my current knowledge of problem solving.

sentences:
Android APK export duplicating libgdx assets folder I'm developing a game using libgdx targetting Java desktop and Android. For the assets I have a "data" folder inside the "assets" folder in the Android project. Then, I link it from the desktop project.

My problem comes when I export, my .apk contains:

assets
com
lib
data
META-INF
res
AndroidManifest.xml
resources.arsc
classes.dex

This means my data files are duplicated in "assets/data" and "data" being the first one the only relevant one. This increases my APK size from 5 to 10MB which is kind of annoying. In my file system I only have the "assets/data" folder, no trace of the intruder there.

Does someone have any ideas why is this happening? How can I solve it?

PS: I've tried deleting the intruder manually opening the apk with 7zip but that destroys the checksum and prevents updates to be properly installed (needs complete reinstall).

sentences:
Terrain Generation - Diamond Square Algorithm I'm trying to implement a Map Generator in Java. Since it´s said to be simple I wanted to use the Diamond Square Algorithm [2D] for that purpose.

However, I can´t find any complete understandable description of the algorithm, so I am using ~4 different sites (eg. this one from grubz) to build it, and on some sites things are described differently than on others.

As far as I understand it, the algorithm works as follows:

generate a map with random values (just setting every x,y of the map)
make square step
make diamond step
begin with square again

The map size is defined by a "step". That step will be

step =Math.pow(2,step)+1

which denotes the width and height of the map. This means if I want a map with ~300 tiles I will have to provide step = 9 - but on other sites it´s written that the step is only changing the "smoothness". What is it?

-square step
I begin at halfStep (x/y), take the surrounding "square" Points and average those.

-diamond step: Same as above but I begin halfStep earlier.

Here is what I did so far. Not working due to an ArrayError.

Question:

How do I control how big the map is gonna be? (I assume step?).

How do I control here what the output map looks like? eg.: to generate island/continents/deserts/half-islands/ how would I get one big Continent at the center/thick jungles etc. (I have seen something like scale, scaleMod, etc)

Is my Code correct according to the algorithm? I just don´t get it exactly.

sentences:
How do I deal with collision resolution causing another collision? I'm making a simple 2D, top-view simulation of an evacuation, sprites running around, looking for exits, going at it, all that good stuff.

I have no control over them when the simulation is running, I just program their behaviour.

I'm using the simulation space provided by JADEX, but I'm just using the simplest of what it provides, so it comes down to Java and OOP.

I already have collision detection working, each person has a radius and I search for objects within that radius, so my question is focused on the aftermath.

Say two people collide and one gets pushed to the ground while the other keeps going. No problem so far, but in the cicle after the collision they will again register a collision - since they are still close enough to each other - and trigger a confrontation.

Is there any general or already known technique to deal with this?

Or should I instead focus on another way of detecting a collision?

EDIT:

The expected cases are, when two people collide:

They are both up
One is up (D0) and the other one is down (D1).

In case 2, there are two outcomes:

D0 helps D1
D0 tramples D1

In case 1 there are 3 outcomes:

Both are aggressive. Dices are rolled, one keeps going the other one goes down and his physical condition deteriorates.
Both are non aggressive. Physical condition is compared, winner keeps going, loser is pushed but not to the ground, physical condition does not suffer.
Only one is aggressive. He will always be the winner. Rest as in 1).

As suggested, I will start by having people maintain a list of objects they just collided with and add an extra comparison to that list in the collision detection to filter them and also make sure that when they are no longer colliding to remove them from that list and see how far that takes me.

sentences:
Prevent rendering queue from overflowing when using Vsync My game loop currently looks something like this:

while (!quit) {
    takeInput(); // Input is sampled however fast loop can run

    time_now = get_time()
    time_passed += (time_now - time_prev);
    time_prev = time_now;

    while (time_passed > SOME_TIME) {
        update(); // Update is done over fixed time-step for determinism
        time_passed -= SOME_TIME_STEP; // This time step is less than or equal to SOME_TIME
    }
    render(time_passed); // Render using interpolation from previously updated position and velocity
}

Basically, I take input as fast as I can, run the movement and physics only in discreet chunks of time after certain period and interpolate the difference in the renderer. The renderer is set to draw at Vsync (using SDL_GL_SetSwapInterval(-1)) and currently, the value of SOME_TIME is set so that update() runs at half of display's refresh frequency (but with a minimum bound of SOME_TIME_STEP which is set to 5 millisecond).

The problem is that I am running the renderer as fast as I can which is submitting frames continuously. Because I am currently loading a test level, the game loop is basically finishing up in a few microseconds (unless there is something wrong with how I am calculating time too). As far as I understand, my program will submit frames to the driver way faster than it is going to draw (because of Vsync) and this should lead to some type of periodic locking up/lagging.

So my question is, how to I prevent this? Should I put the render call in a time bound loop too just like update()? Should I call sleep() manually instead of relying on graphics driver for Vsync?

sentences:
"Pixel-perfect" camera positioning in 2d game I am writing a 2d game using LibGDX. The view to the game world is top-down. The game shows a grid of lines, which looks nice when the camera is at its initial position (0,0).

The problem is now that when I move (shift) the camera left/right/up/down this grid sometimes becomes a bit blurry, so the lines do not look perfectly sharp any more.

I assume this is because in these cases the grid lines are not exactly on screen pixels, but somewhere in between. Is this correct?

In any case: Are there any "best practices" how to address this problem (not necessarily LibGDX-specific)?

sentences:
Character Controller and Reverse Gravity So I have a Game object with Rigid Body, a Character controller and my Movement script. On a specific condition I am reversing gravity. The problem is that the velocity.Y when the gravity is reversed, keeps increasing to the infinity. If I try to reset it like in the first if statement (which works for normal gravity) the object keeps bouncing from the ground. Gravity scale is either 1 or -1 in order to reverse gravity and movement.
This is the code:
 void Update()
    {

        _isGrounded = Physics.CheckSphere(groundCheck.position, 0.4f, whatIsGround);
        Move();
    }

void Move(){
//Reseting States for new cycle , unless the object is falling
        if ((_isGrounded && velocity.y < 0))
        {
            velocity.y = -2f;
            _isRunning = false;
            _isJumping = false;
            _isFalling = false;
        }else if (velocity.y < 0 && !_isGrounded)
        {
            _isFalling = true;
        }
        //Moving on X axis
        float x = Input.GetAxis(KeyInputMove);
        if (x != 0)
        {
            _isRunning = true;
        }
        moveDirection = gravityScale*_transform.right * x;
        _controller.Move(moveDirection * moveSpeed * Time.deltaTime);

        //Perfoming jump
        if (Input.GetButtonDown(KeyInputJump) && _isGrounded)
        {
            velocity.y = (float) Math.Sqrt(1 * -2f * globalGravity);
            _isJumping = true;
        }

        velocity.y += gravityScale * globalGravity * Time.deltaTime;
        _controller.Move(velocity * Time.deltaTime);
//Updating animation states
        _animator.SetBool("Grounded",_isGrounded);//^This is the idle state
        _animator.SetBool("Running",_isRunning);
        _animator.SetBool("Jumping",_isJumping);
        _animator.SetBool("Falling",_isFalling);

    }

    private void OnTriggerExit(Collider other)
    {
       //Reverse Gravity and Model Rotation
        if (other.gameObject.tag == "Portal")
        {
            _transform.Rotate(0,0,gravityScale*180);
            gravityScale *= -1;
        }
    }

sentences:
Can I dynamicaly modify 3D objects? I am new to OpenGL, I am able to render a model object (a human model) that is using .obj and .mtl file in iOS.

Now I want to make a modification to the loaded model. For example, I want to change the height, or change the shoulder width, stomach size, et cetera.

Is this possible ? If so, how do I go about it?

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

Easier to implement

Cons:

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

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

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

Cons:

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

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

sentences:
Does a game engine affect the quality of pre-baked Global Illumination? If I were to pre-bake Global Illumination into light maps using a high quality renderer like Mental Ray or PRman, and loaded it into two different engines such as Unity and Unreal, would there be a noticeable difference in quality?

If there is a difference, could you give me a few examples of engines that are better at it than others?

sentences:
Animated Typing Memory Usage with Immutable Strings Right now I'm programming a game that has an animated typing effect typically seen in older 1980's and 90's role-playing games. An example can be seen here.

The typing effect is generated by taking a target string and rendering a substring of it each frame. The length of the substring is initially zero, but it is incremented every few hundred milliseconds. This gives the impression that the string is being typed out. The pseudocode would more or less look like:

var message = "This is some dialogue.";
var substringLength = 0;

if (someTimeHasPassed)
{
   render(message.substring(0, substringLength);
   substringLength++;
}

This works great, but I'm using a garbage-collected language with immutable strings. Every few milliseconds, I create a new substring on the heap. Garbage collections become very frequent and I receive memory warnings on mobile devices.

Is there a way to generate this typing effect without creating lots of strings in memory?

sentences:
What does HLSL's tex2D return at (0,0)? I'm trying to understand the mapping of texels to pixels, especially in the context of pixel shaders. I already found out the following:

When I define a standard quad with vertices at integer positions (texture coordinates ranging from 0 to 1), a pixel shader for the upper left pixel will be called with texture coordinates (0,0)
When I subtract 0.5 from the vertices' coordinates (as it's recommended when drawing sprites), the pixel shader for the upper left pixel will be called with texture coordinates (1/(2*quadWidth), 1/(2*quadHeight))

My question is about the behaviour of the tex2D function in HLSL:

I would have assumed that it just returns the color of the upper left pixel of the texture when called with texture coordinates of (0,0). But obviously this is not the case, since the second of the above-mentioned variants actually leads to the desired 1:1 mapping.

So is it correct that tex2D returns the original pixel values of a texture when given the following texture coordinates?

sentences:
Switch axes and handedness of a quaternion? I have a quaternion, coming from a system with the following:(intertial sensor)

Right handed.
Forward direction: Y axis
Right direction: X axis
Up direction: Z axis

I need to convert this into a coordinate system that is: (Unreal engine)

left-handed.
Forward direction: X axis
Right direction: Y axis
Up direction: Z axis

I have tried negating the axis, and angle, I have tried switching values, i cannot get this to work. All help greatly appreciated! I am working in C#, with Microsoft.Xna.Quaternion.

sentences:
Why won't character stay at the x-axis rotation I set In the inspector? Here is a snippet of my Update function, which contains everything regarding my rotations for the character:

// Higher the Z float, the LESS of a rotation when moving
Vector3 v3 = new Vector3 (Input.GetAxis ("Horizontal"), 0.0f, 1.5f);

// A Quaternion variable named "quaternion" that's equal to LookRotation class that takes
// the "v3" variable
Quaternion quaternion = Quaternion.LookRotation (v3);

// The actual rotation is done using the Slerp class
transform.rotation = Quaternion.Slerp (
  transform.rotation,
  quaternion,
  Rotspeed * Time.deltaTime);

// When Countdown timer is done, then the animator is enabled
adventureAnimator.enabled = true;

When I put "357" on the X-Axis tab of Rotation, why does it go back to 0 whenever the game starts? After some debugging I know it is because of my logic contained in my "transform.rotation = Quaternion.Slerp" line of code. What do I need to change?

If you need more information or need me to elaborate, please let me know.

sentences:
Creating an object in javascript with unity (unityscript) So I have a ton of experience with JavaScript (its what I do for a living) but I am new to unity. I have built a game engine in javascript but now want to move it over to unity. I have been trying to implement my player class but am running into this error.

I have a getter function for my level_up stats. and inside of my level_up function I call that getter function and store it now I know this would work in normal javascript but its not in unity and I have having a heck of a time googling any information on objects in unityscript. Here is the relevant code:

function level_getter(){
    return {base_level_exp : float , lvl_exp_modifier : float , current_level : int};
}

function level_up(){
    var level_object = new Object();
    level_object = level_getter();

    level_object.current_level += 1;
    level_object.base_level_exp = level_object.base_level_exp * level_object.lvl_exp_modifier;

    level_setter(level_object.base_level_exp, level_object.lvl_exp_modifier, level_object.current_level);

}

I guess my first question is, is it even valid to return an object like that in unityscript?(in the level_getter() function). If its not valid what do people suggest I do instead. Set a getter function for each var? My second is how do I declare level_object so that it can accept the return if it is valid, and so that I can access the members of the object.

I have been looking around at tutorials and google for several hours now and have found nothing to clear up my confusion over objects in unityscript. So any help would be appreciated.

sentences:
How to handle multiple clipping rectangles in a CanvasItem? Let's say I have a CanvasItem that needs to draw the background first, occupying the entire item rect, and then draw all its content within a smaller rect leaving a margin.

How should this be done in the NOTIFICATION_DRAW within _notofication?

This is what I've tried:

void MyCustomItem::_notification(int p_what) {

    case NOTIFICATION_DRAW: {
        // Enable clipping
        VisualServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true);

        draw_background();

        // Clip to margins
        VisualServer::get_singleton()->canvas_item_set_custom_rect(get_canvas_item(), true, Rect2(
            Point2(
             MARGIN_LEFT,
             MARGIN_TOP
            ),
            Size2(
             width - MARGIN_LEFT - MARGIN_RIGHT,
             height - MARGIN_TOP - MARGIN_BOTTOM
            )
        ));

        draw_stuff();
    }

The problem with this is that it will clip everything to the margins including the background.

sentences: Editor Window - How to create this? I am trying to create this in my editor window but not sure how. Basically a drop down arrow, next to a C# icon, next to a toggle, next to a Label with a cog at the end

sentences: The recommended road map to be a good graphics/game engine programmer I am a computer science student and I am developing with C/C++ and Python and I want to begin learning graphics tools to start developing with game engines, especially the Blender Game Engine. So what is your recommendation for me to learn and to read? And recommend me a road map for it.

sentences:
SpriteBatch Draw Using Floats with the Destination Rectangle So I created a nice little isometric tile engine and I have it so that when you scroll with the mouse it changes a variable called scale. Scale is a float and gets passed through the spritebatch.draw() function. I apply scale to all of the math I do when generating the positions of the tiles.

The problem I am having is Rectangle will not accept float numbers so when I make my Dest Rectangle for the spritebatch.draw() I can not use the numbers I need to because they are now floats.

I tried using vector4 instead of rectangle but the spritebatch.draw was throwing an exception saying it was expecting Rectangle not Vector4.

Is it possible to draw the dest rect using floats instead of ints?

Btw the scale is all working properly however since I am casting the floats to ints any scale that should have a decimal gets truncated and I end up with spaces between my tiles.

sentences:
How can I implement fast, accurate 2D collision detection? I'm well aware of how to detect if two or more 2D objects collide but I'm interested in how to decide whether to check for a collision. In previous projects, I just had every object check against every other object (I know, O(n^2) level of stupidity) and it created a less than fluid gameplay.

Various forums hail the greatness of Quadtrees, B-Trees, and any other kind of tree or structure you can think of.

What is the most efficient structure for determining whether a collision should be checked?

sentences:
How do I copy box2d data from one body to another? I want to copy all Box2D-related data (position, velocity, rotation, impulse, ...) from one body to another.

This is what I've got working (with box2djsweb):

var t = body.GetTransform();
other_body.SetTransform(t);

var vel = body.GetLinearVelocity();
other_body.SetLinearVelocity(vel);

I think that covers most things, but judging by the behaviour, I've missed something. It's as if it's a frame or tick behind. Also, this isn't placing the other_body in the exact location as the the original body.

Is there a better way to do this?

sentences:
Why is it a bad idea to store methods in Entities and Components? (Along with some other Entity System questions.) This is a followup to this question, which I answered, but this one tackles with a much more specific subject.

This answer helped me understand Entity Systems even better than the article.

I've read the (yes, the) article about Entity Systems, and it told me the following:

Entities are just an id and an array of components (the articles says that storing entities in components isn't a good way of doing things, but doesn't provide an alternative).
Components are pieces of data, that indicate what can be done with a certain entity.
Systems are the "methods", they perform manipulation of data on entities.

This seems really practical in many situations, but the part about components being just data classes is bothering me. For example, how could I implement my Vector2D class (Position) in an Entity System?

The Vector2D class holds data: x and y coordinates, but it also has methods, which are crucial to its usefulness and distinguish the class from just a two element array. Example methods are: add(), rotate(point, r, angle), substract(), normalize(), and all other standard, useful, and absolutely needed methods that positions (which are instances of the Vector2D class) should have.

If the component was just a data holder, it wouldn't be able to have these methods!

One solution that could probably pop up would be to implement them inside systems, but that seems very counter-intuitive. These methods are things that I want to perform now, have them be complete and ready to use. I don't want to wait for the MovementSystem to read some expensive set of messages that instruct it to perform a calculation on the position of an entity!

And, the article very clearly states that only systems should have any functionality, and the only explanation for that, which I could find, was "to avoid OOP". First of all, I don't understand why should I refrain from using methods in entities and components. The memory overhead is practically the same, and when coupled with systems these should be very easy to implement and combine in interesting ways. The systems, for example, could only provide basic logic to entities/components, which know the implementation themselves. If you ask me - this is basically taking the goodies from both ES and OOP, something that can't be done according to the author of the article, but to me seems like a good practice.

Think about it this way; there are many different types of drawable objects in a game. Plain old images, animations (update(), getCurrentFrame(), etc), combinations of these primitive types, and all of them could simply provide a draw() method to the render system, which then doesn't need to care about how the sprite of an entity is implemented, only about the interface (draw) and the position. And then, I would only need an animation system which would call animation-specific methods that have nothing to do with the rendering.

And just one other thing... Is there really an alternative to arrays when it comes to storing components? I see no other place for components to be stored other than arrays inside an Entity class...

Maybe, this is a better approach: store components as simple properties of entities. For example, a position component would be glued to entity.position.

The only other way would be to have some kind of a strange lookup table inside systems, that references different entities. But that seems very inefficient and more complicated to develop than simply storing components in the entity.

sentences:
Collision Detection Unresponsiveness I'm creating a simple jumper game in Libgdx that makes the player jump over obstacles in order to stay alive.

The only problem is that the collision detection for when the player just touches the ground, it:

1) Looks a little bit like there's a hitch in the repainting (because it tends to go a y axis little too far before being brought back to above 0).

2) Can't jump right away again (a very small, but annoying delay).

Here is the code that checks for collisions:

public void update(float dt) {
    if (location.y < screenBounds.y) {
        location.add(MOVEMENT * dt, 0, 0);
        velocity.y = 0;
        location.y = 0 + dt;
    } else {
        velocity.add(0, GRAVITY, 0);
        velocity.scl(dt);
        location.add(MOVEMENT * dt, velocity.y, 0);
        velocity.scl(1 / dt);
    }

}

I know why, it does this though:

LOCATION BEFORE RESETTING -0.45871875
LOCATION AFTER RESETTING 0.017244088

It takes too long to realize that the location on the y axis is below 0. This creates a hitch as well as a small delay between the times where it lets the player jump again.

I don't know how to fix this problem. I've looked at many posts that discuss collision detection, but none address the same problem I'm having.

For example, these tell me to do what I'm currently doing:

Collision detection
Collision detection in libgdx

But they both don't solve my issue.

Any help would be greatly appreciated.

sentences:
Shooting Projectiles I am using cocos2D-x and am trying to achieve the effect of enemies going past and shooting projectiles at the player who is moving around the screen. I am using the code below, which is based on this article (Scroll down to the ’Shooting Projectiles’ section): https://www.raywenderlich.com/95835/cocos2d-x-tutorial-beginners

Point projPos = shooter->getPosition();
projectile->setPosition(projPos);
projectile->setVisible(true);

Vec2 offset = target->getPosition() - projPos;
offset.normalize();

auto shootAmt = offset * 1000;
auto projEndPt = shootAmt + projPos;

// Approach 1.
auto moveAct = MoveBy::create(10.0f, shootAmt);

// Approach 2.
auto moveAct = MoveTo::create(10.0f, projEndPt);

projectile->runAction(moveAct);

It works most of the time, however the projectiles speed varies, it seems based on the distance between the player and shooter. At medium distances the speed is fine, at shorter distances the speed is too slow and at longer distances the speed is too fast. The time being fixed (10.0f) over a variable distances seems to be the cause. I have tried both approaches as commented in the code, moving by move amount (Approach 1) and move to point (Approach 2) and both seem to give the same result.

sentences:
Create shape from points / lines in editor and mathematically calculate nearest points within shape If I want an editor that accepts "points" of a minimum of three (a triangle) and I just add some points first, like this:

how can I mathematically connect these corners (points) into an object of multiple triangles? so amount of triangles looks like something like this, by connecting nearest point:

and then later render this and also being able to define what it is and check for collisions on this ground, so I can create more than Rectangle based "bricks" on a Platformer for example. Also being able to texturize the whole object without it looking ugly.

Any ideas? Or what is this called in game programming?

sentences:
Replacing assets in Unity real-time but keeping the references intact I'm looking forward to adding mod support into my game by allowing users to easily replace some assets with their own versions.
The way I want it to work - if there's, say, a certain texture in some folder in my compiled game, I replace the texture with the same name in my resources, but I keep references intact. That means that the texture will be replaced for every material using this texture. I don't want to change materials themselves to reference the new texture, mainly because I'll have to keep a list of materials for each texture, and because materials might be replaced by potential modder as well. It's also important to note that I want to give people the ability to change basically anything (but scripts). Sounds, music, textures, meshes, materials, fonts, localization files, shaders, so the list of references might be absolutely changed upside down and that is absolutely not the solution.

sentences:
Flash framerate reliability I am working in Flash and a few things have been brought to my attention. Below is some code I have some questions on:

addEventListener(Event.ENTER_FRAME, function(e:Event):void
{
    if (KEY_RIGHT)
    {
        // Move character right
    }
    // Etc.
});

stage.addEventListener(KeyboardEvent.KEY_DOWN, function(e:KeyboardEvent):void
{
    // Report key which is down
});

stage.addEventListener(KeyboardEvent.KEY_UP, function(e:KeyboardEvent):void
{
    // Report key which is up
});

I have the project configured so that it has a framerate of 60 FPS. The two questions I have on this are:

What happens when it is unable to call that function every 1/60 of a second?
Is this a way of processing events that need to be limited by time (ex: a ball which needs to travel to the right of the screen from the left in X seconds)? Or should it be done a different way?

sentences:
How can I detect if a gamepad stick has been pushed to the limit? As in the question, really. I want to be able to detect if a gamepad has it's analogue input pushed as far as it can go in any direction.

Given x and y axis values in the range [-1, 1] (-1 being left and down respectively), how can I account for all of the angles between horizontal and vertical, as this means that I can't simply check if abs(axis) == 1.

As I'm unaware of how it might affect it, the engine I'm using is UE4, so any answer could take that into account.

sentences:
How do I call the sprite auto-slicer from a script in the Unity editor First of all let me start with an apology. I know this may not be the right place for this question, but the good people over at stackoverflow did not answer me and neither did I get a answer over at Unity Answers, so I'm hoping that someone here will know. So without further ado here is my problem.

I'm writing my own asset importer and would like to automatically slice the sprite sheet.Slicing it with a grid is not viable since we have sprites with different sizes and I need to use the automatic slice option form the Sprite Editor. So far if the imported file has "sheet" in the name I can set all the properties I want. All that is left is do the automatic slicing but I cant even find anything in the documentation. Is this even possible ?

Edit: here is a screen shot. I want to access this functionality from my custom EDITOR script.

In simples words I want to click this button from a script instead of the artist when he imports a new spritesheet.

sentences:
Sort buttons in unity 2D I've a list of buttons that I create using XML stored data. To achieve it, I've created a Prefab. These buttons are created correctly, and now I want them to be sorted for the user.

public List<GameObject> myButtons;

As I said, now I want to sort them. I've found out that sorting the List itself, buttons are sorted in the UI.

myButtons.Sort((x, y) => ...);

The problem is, that I don't have the necessary data to sort them within them. This leaves the .Sort() method unavailable for use.

I've tried to sort them adding an script to each one, which contains the data that I need to use to sort them. However, it doesn't work correctly and I seem unable to find out why, so I'm wondering about other more direct methods to sort them.

Notice that I'm referring to simple buttons in a 2D game, and that they're all inside the same parent/gameobject.

Technical Details

Let's start by the basics: I want to order the buttons taking into account if the user has reached a point in which the item it represents should be available.

This is stored in an instance of a class that represents the items related to the buttons of the question.

public class myItemClass
    {
        # Here there are other properties
        public bool available;
    }

Therefore, we've a correspondence between two lists:

public List<myItemClass> myItems;
public List<GameObject> myButtons;

Where:

  myItems[0] is related/represented by myButtons[0]

  ...

NOTICE that this relation exist at the initialization of the game, so i need to keep it at any moment (meaning, having to sort both lists).

What I tried

To be able to order my buttons depending on if the items are available or not, what I've done is:

Creating an script myItemScript, which has a reference to my original items from the other list.
Sorted the items using Sort function over them.

public class myItemScript: MonoBehaviour {
    public OtherClass.myItemClass dataObject;
}

And then sorting them like:

myButtons.Sort((x, y) => y.GetComponent<myItemScript>().dataObject.available.CompareTo(x.GetComponent<myItemScript>().dataObject.available));

As I said before, both list need to be following the same order, so just after it, I order the item list as well:

myItems.Sort((x, y) => y.available.CompareTo(x.available));

Checking/Debug

As result, I found that items were in fact sorting different. However:

Items inside myItems List were sorted as expected.
Buttons in UI (and hence, myButtons List were not sorted as expected. Mixed items (available = true/false) were mixed and not ordered in two blocks, one first and then the other one.

This was checked using breakpoints within VS2017 and pausing the game in Unity interface.

sentences:
OpenGL Texturing Isn't working: displaying just white Basically, see the title: for whatever reason, I load a texture into OpenGL, bind it, draw a quad with texture coordinates specified, and the quad remains totally white regardless of what the texture is.

I have made sure that GL_TEXTURE_2D is enabled. I have verified (using glGetTexImage) that the Texture has the correct data in it (or, if not the correct data, data that should be visible, as the pixels have different values).

My glTexture2D function is called as follows:

        glTexImage2D(GL_TEXTURE_2D, 0, pixelFormat, this->width, this->height, 0, pixelFormat, GL_UNSIGNED_BYTE, &(pixelData[0]));

This is where pixel format is either GL_RGBA or GL_RGB (according to pixel depth), and pixelData is the array of pixels. I verified that pixelFormat and pixelData and width and height have within them the correct values. Note that pixelData is a std::vector.

I bind the texture as such:

    glActiveTexture(GL_TEXTURE0 + this->multiTexNumber);
    glBindTexture(GL_TEXTURE_2D, this->texID);

For the purposes of my testing, this->multiTexNumber = 0;

Have I done something wrong here? Is the problem elsewhere?

EDIT: via very thorough checking, I have ensured that OpenGL doesn't throw any errors. The problem persists.

sentences:
C++/OpenGL Game - How to Make it Compatible with Screen Recorders? I'm developing a 3D tower defense-like game in C++/OpenGL on Windows.

The problem I'm having isn't about the game itself (the game runs fine), but it's about using screen recording software to record gameplay.

For some reason, whenever I try to record the screen (I've tried both Camtasia Studio 8 and Fraps 3.5.9), it slows down the game (I'm not talking about just an FPS drop; the actual game timers run slower).

To show an example of what I mean, see the following screenshot: I ran two instances of my game at once (side by side), and recorded the righthand one using Fraps. As you can see in the image below, Fraps is causing the game time for the recorded instance to increase almost twice as slowly as it should.

I'm getting around 800-1000 FPS when running the game without Fraps recording, and around 300-400 FPS with Fraps recording. But playing the game with recording causes everything to happen in slow-motion, despite it running smoothly rendering-wise.

For timing I've tried using both the QueryPerformanceCounter() and timeGetTime() approaches - the slowdown still occurs using either.

Does anyone have an idea what might be causing this? Could it be because of the way I'm rendering with OpenGL?

sentences:
How to Ignore Raycast for Boxcollider2D by layer or boolean? How do I ignore raycasts for specific objects?  I want a filter, to ignore raycasts for some objects. As an example, when my player selects the ground, I do not want them to accidentally select bullets.

Is it possible to add boolean to the BoxCollider2D component, to identify raycast targets? I want to make it similar to the Image component.

My problem is that when several objects overlap, I need some of the objects to ignore the raycast.

I can't use Queries Hit Trigger or disable the collider component, because I need them to enter the OnCollisionEnter and OnTriggerEnter methods.

Here is my Update method:

void Update ()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity,
                1 « LayerMask.NameToLayer("Object"));

        if (hit)
        {
          Debug.Log(hit.collider.gameObject.name);
        }
    }
}

sentences:
Pre- or post-multiplication for rotation between coordinate frames I have three 3D coordinate frames: O, A and B, as shown below.

I want to know the rotation matrix RAB between A and B, that is the rotation that is required, with respect to the frame A, to move from A to B.

Let us imagine that all I know, is the rotation matrix RAO between A and O, and the rotation matrix ROB between O and B.

So, what is the correct way to determine RAB? There are two suggestions that come to mind:

(1) RAB = RAO ROB

(2) RAB = ROB RAO

Now, my intuition is that (1) is correct, i.e. post-multiplication. This is because I am multiplying everything with respect to the local coordinate frame (as discussed in http://web.cse.ohio-state.edu/~whmin/courses/cse5542-2013-spring/6-Transformation_II.pdf).

However, when I compute this, I get a different answer to that which I get by inspection of the diagram. The correct answer, I have noticed, is equal to the pre-multiplication solution of (2).

Please can somebody explain to me why (2) seems to be correct, rather than (1)? I was under the impression that if all your transformations are with respect to the current local frame, then post-multiplication should be done, i.e. multiply the matrices from left to right as you move between each frame. However, when doing the maths, pre-multiplication gives the expected answer.

sentences:
Can I use Google Ads on a game published on non-Google platforms? I just made a game with unity personal. And I want to publish/release it on sites like Getjar, Aptoide, Slideme etc. instead of Play Store.

So I want to know if I can still get revenue from Google ads or if I have to publish it on the play store to get revenue from ads.

sentences: If someone is using JNI then are they are true user of NDK (c++)? As someone involved in the hiring of engineers that must have experience using NDK (I work for Unity and support the VR/graphics groups), I see quite a few resumes of people who claim to be using NDK and c++ but at the same time reference the use of JNI.  I thought JNI basically made it possible to use NDK using java without using c++.  Any thoughts?  ( I know I am a recruiter but I am not using stack overflow to recruit, rather, better understand the very technologies I am working around every day.  I appreciate your help in advance )

sentences:
Rotating a group of sprites - How to calculate origin I am rotating a group of sprites in XNA, which I developed with the help of the following example:  http://msdn.microsoft.com/en-us/library/bb194912%28v=xnagamestudio.10%29.aspx

It all works very well, however, the rotations rely on a point of origin, which it will rotate around.  The problem is that I do not know how to calculate the point of origin, so that it is exactly in the center of the sprite group.

I am able to set the point of origin to where I want it, but as soon as the sprite group changes, the origin is typically off, and it doesn't rotate from the center of the group.

My main question, is there a way to calculate the center of a group of sprites?  My original idea was to calc the boundaries (left, right, top, bottom), and place the origin the the center, but this doesn't work properly.

sentences: How to read a data from text file in unity Can anybody help me out with giving the steps needed for reading data from the text file in unity and how can the script be added.

sentences:
How to combat exponential growth in sprite messaging? In my 2D platformer game, I have a number of sprites moving around the world. When two sprites collide with each other, I calculate how deep the collision is and then call a virtual method on both sprites that lets them handle the collision (for instance, a fireball would kill the other sprite).

Each sprite is checked for collision against each other sprite "near" it. "Nearness" is determined through my lazy Quadtree which is really just a list of evenly-sized cells that objects are sorted into.

However, the number of virtual method calls (or messages) increases exponentially with the number of sprites colliding at once, leading to <1fps with only about 120 sprites onscreen. If three sprites overlap each other, six messages need to be send. Four sprites need 12 messages, and twenty sprites need 380.

Just checking for collisions can be costly, even with the game world being divided into cells - if 30 sprites are in the same cell, 900 collision checks are required.

Now, I don't expect 120 onscreen sprites to be the norm - it'd probably be closer to 20, but I'm really concerned with how little range there is between playable and slideshow.

I strongly suspect that if I really want each sprite to message each other, there's no way to do any better than N*(N-1)/2 messages. Is there anything I can do to reduce the costs?

Edit: On request, here's the relevant code:

foreach (var collidableSprite in Sprites.GetItemsNearItem(sprite))
{
    if (Object.ReferenceEquals(collidableSprite, sprite)) { continue; }

    BoundingRectangle hitboxA = sprite.Hitbox;
    BoundingRectangle hitboxB = collidableSprite.Hitbox;

    Vector2 intersectA = hitboxA.GetIntersectionDepth(hitboxB);
    Vector2 intersectB = hitboxB.GetIntersectionDepth(hitboxA);

    if (!intersectA.IsNaN() && !intersectB.IsNaN())
    {
        sprite.HandleSpriteCollision(collidableSprite, intersectA);
        collidableSprite.HandleSpriteCollision(sprite, intersectB);
    }
}

Essentially, for each sprite in the world, for each sprite near this sprite (in the same grid cell(s)), check to see if there's an intersection and how deep it is. If there is, call the collision handlers on both sprites.

internal IEnumerable<T> ItemsInCells(SparseCellRange range)
{
    foreach (T item in items)
    {
        if (GetCellsItemIsIn(item).Equals(range))
        {
            yield return item;
        }
    }
}

internal IEnumerable<T> GetItemsNearItem(T item)
{
    SparseCellRange range = GetCellsItemIsIn(item);

    return ItemsInCells(range);
}

Here's the code that checks for nearness. The SparseCellRange is a pair of Vector2 instances for TopLeft and BottomRight cell numbers.

sentences:
Texture size and scaling, 2D, for OpenGl ES 1.0/1.1 I read everywhere that you have to use a power of two
size for your texture width and height, like 16, 32 or 64,
but right now my sprite drawing is based on Grid.java from
SpriteMethodTest, and I set the Vertex array "quad" to the pixel
size, 20 X 28, and and apply the texture, the same pixel size, to that,
and I'm not using any scaling information, and it's drawing them fine
and I don't seem to be getting any errors.

Is it actually scaling it behind the scenes?

When I process each Bitmap I use:

gl.glBindTexture(GL10.GL_TEXTURE_2D, iTextureName);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,    GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);

So if I start doing sprite batching instead, the image I grab
out of the bigger image has to be a power of two width
and height, if I want it drawn without any scaling?

Thanks!

sentences:
Creating Font Textures in Direct3d without D3DX Update: The completed solution using Nathan Reed's answer is posted in my answer below

A few open source programs I've seen that render installed fonts do something like this...

Create a texture for the font
Draw font to texture using native calls
Store the coordinates for each character
Create a vertex buffer with a quad for each character
Render the vertex buffer using the font texture

But I'm really having trouble getting this to work consistently. GetTextExtentPoint32A() for Win32 font sizes which does NOT include italic support and seems to cut off some of the stranger fonts.

Here is an example output from my code. Notice the cut off edge of the Q and a few other characters. A much more exaggerated version happens when rendering italics.

http://i30.photobucket.com/albums/c308/thentsc/font_test.jpg

The code looks something like this...

for (uint8 c = 0; c < 127 - 32; c++)
{
    str[0] = c + 32;
    SIZE size;
    GetTextExtentPoint32A(hDC, str, 1, &size);
    if (x+size.cx+1 > m_TextureSize)
    {
        x  = 0;
        // 1 pixel vertical margin
        y += size.cy + 1;
    }

    uint32 Diff;
    ExtTextOutA(hDC, x+0, y+0, ETO_OPAQUE | ETO_CLIPPED, NULL, str, 1, NULL);
    m_fTexCoords[c].Left = x/m_TextureSize;
    m_fTexCoords[c].Top = y/m_TextureSize;
    m_fTexCoords[c].Right = x+size.cx/m_TextureSize;
    m_fTexCoords[c].Bottom = y+size.cy/m_TextureSize;

    // 1 pixel horizontal margin
    x += size.cx;
}

The image above is actually just a render of the whole texture stretched from -1,-1,0 to 1,1,0 not using the stored texture coordinates to show clipping due to GetTextExtentPoint32A.

Again this works fine for some fonts but looks terrible for others and doesn't support italics.

It is designed to work in a system like this...

cFont* g_Font;
cTextObject g_TextObject;

Setup()
{
    g_Font = SetupFont("Arial", BOLD | ITALIC, 24pt);
    g_TextObject = CreateTextObject("The quick brown fox...", g_Font, X, Y);
}

OnRender()
{
     g_TextObject->Render();
}

So in general I guess my question is what is the correct approach for this issue?

Should I just let each text object have a texture and on text object creation use the GDI to render all text to it (which would bypass the italics and font face problem)?

But then wouldn't texture memory usage get out of hand?

sentences:
Why is my diffuse lighting changing with camera position? I am trying to do lighting in view space, but I am afraid I have an issue. I calculate the normals as:

N = norm_mat * vec4(vert_norm,0.0)

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

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

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

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

What am I doing wrong?

sentences:
Avoiding lag when rendering Texture2D for first time I have found a similar question here, but it is about playing sounds.

I am using 2048 x 2048 textures for sprite sheets and every time I call spriteBatch.Draw using a sheet for the first time in game execution, causes a considerable lag. The lag doesn't appears for the next times.

Someone has faced this problem before? What can I do to overcome this?

Update:

I inserted a code in the end of content load routine that draws EVERY Texture2D that is loaded into ContentManager before follow to the game screen. This works well. None lag occurs when different textures are rendered over the time, EXCEPT if the IsFullScreen are changed. Apparently, changing this property makes the textures loaded in the GPU gone. Is that correct?

sentences:
Can a UIKit application co-exist with a Unity game as a single application? I have a typical UIKit application with three buttons - one opens an RSS feed in a UITableView, the second opens some kind of gallery view, and the third opens a Unity 3D game.

Is it possible and how easy it is to support both in one application?

sentences:
XNA Skinning Sample - exporting from Blender recognize only first animation clip (and sorry for my English)
I'm using animation components from XNA Skinning Sample. It works great but when I export a model from Blender, it does not recognize any other animation clips than the first one. So I have three animation clips, but XNA recognize only one. Also, when I looked up on Xml file of the model in Debug\Content\obj directory, there is only one animation clip, but when I check code directly from .fbx file, it seems to be alright.

Link to my model files:
https://skydrive.live.com/redir?resid=8480AF53198F0CF3!139

BIG Thanks in forward!

sentences:
What is the signifigance of the Dot Product in World to Local Transformations? Looking for help understanding why this World to Local Space function works.

I'm working my way through Buckland's Programming Game AI By Example The following function is used in the book to convert a point from world space to an agent's local coordinate space (its i hat and j hat are AgentHeading and AgentSide respectively)

    inline Vector2D PointToLocalSpace(const Vector2D &point,
                             Vector2D &AgentHeading,
                             Vector2D &AgentSide,
                              Vector2D &AgentPosition)
{

    //make a copy of the point
  Vector2D TransPoint = point;

  //create a transformation matrix
    C2DMatrix matTransform;

  double Tx = -AgentPosition.Dot(AgentHeading);
  double Ty = -AgentPosition.Dot(AgentSide);

  //create the transformation matrix
  matTransform._11(AgentHeading.x); matTransform._12(AgentSide.x);
  matTransform._21(AgentHeading.y); matTransform._22(AgentSide.y);
  matTransform._31(Tx);           matTransform._32(Ty);

  //now transform the vertices
  matTransform.TransformVector2Ds(TransPoint);

  return TransPoint;
}

I've been learning about vectors and matrices for the last three weeks and still I'm having a lot of trouble understanding why this works in terms of vectors and matrices. What is the reason for using a a dot product in the translation coordinates? Why is it the dot product of the agent's position and its heading? What does this dot product correspond to geometrically?

Why not just translate by the Agent's position?

Are there any simpler ways of representing this algorithm?

sentences:
What are some good podcasts for game developers to listen to? This could include specific game dev, general dev or general game podcasts.

Please provide a brief description along with links.

sentences:
How do I wrap my web browser game as a standalone for Steam? I've got a PHP/Java based game, which runs in the browser. However, I want to submit this game to Steam.

Now Steam doesn't allow web-based games unless they come in some kind of wrapper.

How can I package my web broswer game so that I could distribute it through Steam?

sentences:
Is dynamic casting Entities A good design? For my game,

Everything inherits from Entity, then other things like Player, PhysicsObject, etc, inherit from Entity. The physics engine sends collision callbacks which has an Entity* to the B that A collided on. Then, lets say A is a Bullet, A tries to cast the entity as a player, if it succeeds, it reduces the player's health.

Is this a good design?

The problem I have with a message system is that I'd need messages for everything, like:
entity.sendMessage(SET_PLAYER_HEALTH,16);

So that's why I think casting is cleaner.

sentences:
How could I implement destruction of bases in Space Invaders type game? What approaches could you use to implement the the gradual destructions of bases/shields in a top down shooter type game similar to Space Invaders?

The simplest approach could be to use a series of sprites that are replaced to show increasing deterioration after each missile hit.

A more advanced approach might be to randomize the deterioration pixel by pixel after each hit, but I'm not sure how to implement an approach like this. Does anyone have any suggestions for how to approach something like this?

sentences: Easy to use cross-platform 3D engines for C++ game development? I want to try my hand at writing a 3D game. However I don't want to start at such a low level of drawing individual triangles and writing my own 3D object loader and so on. I've heard of things like Irrlicht, Crystal Space 3D, and Cafu, but I don't have any experience with any of them. I'm looking for suggestions from people who have experience with these or other engines on which ones are well written, and are easy to get started using, without having to learn a ton of 3D math theory and how GPUs work internally.

sentences:
A specific but basic tutorial for Corona SDK? I have been looking at Corona SDK and it would be helpful if I could see a tutorial/example to accomplish the following:

Load an image as a background/map
Draw a circle on the screen
user can tap elsewhere and the circle moves to that location (this can be repeated)

Does anyone know of any examples out there?

sentences: How can I obtain a triangle ID during rasterization? I want to know the triangle ID of each rendered pixel is coming from. Is there a way to do this in OpenGL?

sentences:
From maya to c++ and opengl I want to load an object created with Maya in c++ with opengl, how could I do this?

Thank you.

sentences:
XNA - DrawIndexedPrimitives or DrawUserIndexedPrimitives? When rendering primitives in XNA, does it matter if I use DrawIndexedPrimitives() versus DrawUserIndexedPrimitives()? RB Whitaker uses the former, while Reimer's uses the latter.

From what I can tell, the intent is that if you're using a premade type that ships with XNA (such as VertexPositionNormalTexture), you should use the normal draw primitives function, while if you create a custom struct which satisfies IVertexType and/or VertexDeclaration, you should use the DrawUserPrimitives instead.

However, XNA places no such restriction on how they're used, and I am wondering why it wasn't just all rolled into one generic function to begin with.

sentences:
Extracting gamefiles from a game, modify it, then use it commercially, would it be illegal? I kinda get a chance to extract gamefiles from the game fortnite(assets, sounds, etc), and then I want to use them for my animation, would that be illegal.

If it is illegal, what if I alter the assets, like modifying it to a voxel, and use it commercially, is it still illegal?

sentences:
Can I change the background color where a sprite is shown in the inspector? this is how a sprite shows in the inspector.
It's white pixelart with transparent background.
Is there a way to change the background checkered pattern color in the inspector so I can actually see the sprite?

Note: I don't want to change any color in the game, just the background in the inspector, in the editor, so there's some contrast and I can actually see the sprite pattern.

sentences:
Tetris block kinematic rigidbodies pass through one another with Transform.Translate I am trying to build a Tetris 3D game in Unity but I am stuck at getting the different blocks to interact (to detect each other, to sit one on top of the other rather than going through each other). I have set the ground with a box collider and the spwaned blocks come in with rigidbodies and trigger colliders.
This works for them to nicely settle on the ground but when I try to sit a block on top of another block they both have kinematic rigidbodies and the collision detection doesn't work and they end up overlapping. The problem is if I remove the rigidbody of the already settled block then it will go through the ground.
Any idea how to get 2 spawned objects to detect each other?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;

public class moveBlock : MonoBehaviour
{
    public static float speed = 2;
    public GameObject[] blocks;
    public static List<GameObject> blocksSpawned = new List<GameObject>();
    public static List<Rigidbody> blocksRBSpawned = new List<Rigidbody>();
    public static bool triggerPlatform = true;
    Rigidbody rb;

    void Update()
    {
        Vector3 input = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
        Vector3 direction = input.normalized;
        Vector3 velocity = direction * speed;
        Vector3 moveAmount = velocity * Time.deltaTime;

        if (triggerPlatform)
        {
            blocksSpawned.Add((GameObject)Instantiate(blocks[Random.Range(0, 7)], new Vector3(0, 6, 0), Quaternion.Euler(Vector3.right)));
            rb = blocksSpawned[blocksSpawned.Count - 1].GetComponent<Rigidbody>();
            blocksRBSpawned.Add(rb);
            triggerPlatform = false;
        }
        /*if (!triggerPlatform)
        {
            Destroy(blocksRBSpawned[blocksRBSpawned.Count - 1]);
        }*/
        if (blocksSpawned[blocksSpawned.Count - 1] != null)
        {
            blocksSpawned[blocksSpawned.Count - 1].transform.Translate(Vector3.down * Time.deltaTime*speed, Space.World);
            blocksSpawned[blocksSpawned.Count - 1].transform.Translate(moveAmount);
        }
    }
}

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

public class trigger : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
        moveBlock.triggerPlatform = true;
    }
}

sentences:
Too fast swipe in Unity game I am letting the user to swipe around in some movement and to see the scene on mobile device.
Facing too fast swipe.
Need to make swipe slower, smother.Using the code:

foreach(Touch touch in Input.touches)
{
    transform.localEulerAngles = new Vector3(
        transform.localEulerAngles.x + touch.deltaPosition.y, transform.localEulerAngles.y + touch.deltaPosition.x, transform.localEulerAngles.z);
}

sentences:
Receiving server data inside game loop I'm planning on how my multiplayer game client game loop should work. While I'm convinced that server should be moved from game loop into it's own thread, I'm not sure what should I do about receiving server data. To me most logical approach would be something like this:

protected override void Update(GameTime gameTime)
    {
        receiveServerData(); //may receiving data lag the game?
        updateWorld();
        processInput();
        sendClientMovementToServer();
    }

private void receiveServerData()
    {
        NetIncomingMessage msg;
        while ((msg = netClient.ReadMessage()) != null)
        {
            // ...
        }
    }

But I'm afraid that reading incoming data inside game loop can lag the game if processing too much data, so here's my question: Is it good idea to process incoming server data inside game loop, or should create thread for receiving this data instead? And if so, how should I do it?

sentences:
Spline type to achieve a specific result Is there a type of spline which can produce (approximately) the following result given the specified points indicated. I want to be able to specify how curved the corners are from the "centre points" so that I get "very square" corners to "very round" corners. Sorry about my shakey hand ! Points along a line should produce (roughly) a linear curve.

I found quite a few questions and answers online about this but they all seem to be B-spline related, and don't (I think) quite capture my constraints. If anybody knows what I'm looking for, direction to an online reference/article would be great.

My points always appear on an integer lattice (grid), and are always equally spaced.

I'm looking for something low complexity, but which I can pass a value, say t in [0,1] and returns the (x,y) position of the curve at that time. I realise I could probably build a function like this piece-wise, but wondered if there is a ready made spline solution (piece-wise equation) which could achieve the same result.

Maybe B-splines or NURBS are the answer, but maybe they are heavy on computation too...

Given Sirisian's answer below, I suddenly realised how Bezier curves work. Wow they really are a clever idea!

Everything seems centred around a single t value, e.g.

l1(t) = a+t(b-a)
l2(t) = b+t(c-b))
m(t)  = l1(t)+t(l2(t)-l1(t))

We can expand m to simplify if necessary.

I think B-Splines give a nice result, e.g. see below. It also has the advantage of not being restricted to a uniform grid. Not sure about speed of computation yet though...

sentences:
How do I get the id of an object that created a point in a path? I'm making a rollercoaster tycoon type game. As the title says, I need to get the id of an object that created a path point. These points are currently greated by the rail pieces. I need this because each rail type (down, up, corners, etc) decides how fast the cart is going to go. The cart follows a path, with points created when a new rail is created. Normally, I would just use instance_place, but since the coaster has multiple levels (defined by z), I can't use this because some rails will overlap other. If you have any suggestions, I will be very grateful! For more information just ask and I will respond. Thank you for your time.

Here's a screenshot of the game for reference (the blue thing is the cart, the white numbers are the added or subtracted speed for that particular rail type):

sentences: XNA Development on PC but Designing for Xbox 360 I'm working on a project with a buddy, he doesn't have a 360 nor does he have the money to get one right now, but we want our game to be submitted to XBLIG.  So right now we're both designing our game on the PC but we're using adapted 360 controllers.  What are the things we need to keep in mind during the process so that we can "easily" port our game to the 360 from the PC?

sentences:
Lighting effects with 2D sprites I would like to know how to best achieve lighting effects with 2D.

I guess the only way is to make sprites of the area to be lit in specific colors?
Say I have a streetlamp, and around this place sprites to make it appear lit?

Is there a better way?

Edit: Found a good screenshot of what I'm looking for:
http://www.saltgames.com/wp-content/uploads/2009/11/multipleLights.png

sentences:
Opengl ES 2.0: Is there a way to use less resources to draw in-game background texture 1.Should my in-game background be drawn with my game loop renderer, or if

2.I don't want to draw my background image every frame in my main renderer since it could possibly be a heavy job while the game loop is running. Do I need to use a separate thread or some other method to achieve this?

FYI, the background should be able to scale and translate with zooming function, it should be flexible.

sentences:
Placing sprites properly to form an object I'm working with XNA in Visual Studio, and I'm trying to draw this sprite:
https://i.imgur.com/Dy5nSuG.png

Only using this sprite:
https://i.imgur.com/6T8TeTQ.png

My current attempt relies on a matrix boolean, which then gets drawn in a foreach loop:

//Variable
 bool[,] centerPiece = new bool[,] { { false, true, false }, { true, true, true }, { false, true, false } };

//Loop
 foreach (bool b in centerPiece)
            {
                if (b == true)
                {
                    spriteBatch.Draw(squareTex, screenView(), null, Color.White, 0f, IMGCenter(), 1f, SpriteEffects.None, 0f);
                }
            }

While this draws all 5 squares, it doesn't place them as desired (because of they're all being drawn in the screenView() method placement(The center of the screen):

public Vector2 screenView()
        {
            Viewport viewport = GraphicsDevice.Viewport;
            Vector2 screenCenter = new Vector2(viewport.Width / 2f, viewport.Height / 2f);
            return screenCenter;
        }

How do I modify my loop to place the squares correctly, and/or do I need to change my implementation completely to achieve my desired goal?

Note: I need to both be able to access the object as a whole, and also access each individual square, in each individual object.

sentences:
How big can a background file in Unity be? I want to start a new 2D top-down project in Unity and want to figure out how to organize my background (one big file or a lot of files joined together).

So how big can a background file get in Unity?

The target platform is Windows.

sentences:
C++:Segmentation fault (core dumped) while creating gameobject i made a small code to debug and i get this error

player inherit from gameobject

code

///main
#include "game.h"

 gameobject* pla;

int main()
{

    std::vector<gameobject*> objects;

    gameobject* pla = new player(32,32);  -----> error is here

    objects.push_back(pla);
    cout<<objects[0]->numberID<<endl;
    return 0;
}

/// gameobject
pragma once

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "game.h"

class gameobject
{

    public:

        virtual ~gameobject(){};
        virtual void init()=0;
        virtual void tick()=0;
        virtual void render(SDL_Renderer* ren)=0;
        virtual void destroy()=0;
        virtual void setVelx(int velx)=0;
        virtual void setVely(int vely)=0;

        int numberID=0;

    protected:

        int width = pos.w;
        int height = pos.h;
        int posx = pos.x;
        int posy = pos.y;

        float velox;
        float veloy;

        SDL_Rect crop;
        SDL_Rect pos;

        SDL_Texture* tex;

////player.h

#pragma once

#include "gameobject.h"

class gameobject;

class player : public gameobject
{

public:

    void init() override;
    void tick() override;
    void render(SDL_Renderer* ren) override;
   // SDL_Renderer* renderer;
    player(int pwidth,int pheight);

    void destroy() override{
        this->~player();
    }

    void setVelx(int velx) override;
    void setVely(int vely) override;

    int i = 0;

private:

    ~player() override;

};

/// player.cpp

#include "player.h"

player::player(int pwidth, int pheight)
{

    this->pos.w = pwidth; //width
    this->pos.h = pheight; // height
    this->pos.x = 100; //posx
    this->pos.y = 100; //posy

    // cout<<"yes iam ren : "<<ren<<endl;

    this->numberID = gameobject::numberID;

    gameobject::numberID++;
    //this->tex = IMG_LoadTexture(ren,"/home/younlok/Desktop/dash/res/pss.png");
    this->tex = game::textures[0];
    crop.x = 0;
    crop.y = 0;
    crop.w = 32;
    crop.h = 32;

    //game::hand->addObject(this);

}

void player::init()
{
}

void player::tick()
{

    this->pos.x += this->velox;
    this->pos.y += this->veloy;

}

void player::render(SDL_Renderer* ren)
{

 SDL_RenderCopy(ren,tex,&crop,&pos);

}

void player::setVelx(int velx)
{
    this->velox = velx;
}

void player::setVely(int vely)
{
    this->veloy = vely;
}

player::~player(){}

sentences:
Changing Animation Sprites At Runtime Once I am designing a 2d platformer with pixel 32x32 sprites, right now I’m using the method that’s utilized at 20 minutes in this video.
I’m pretty much creating a main player parent object and adding the players equipment (helmet, breastplate, leggings) sprites underneath. But obviously when the player animates and starts running the pixel equipment needs to move and shift with the player.
The solution provided by the video seems to work fine, but why can’t this just be called once at the start and be set until changed? Basically why can’t I set the sprites at the different frames of the animation when the game starts and leave it. I basically redrew all of equipment to fit the character during each frame of the run animation etc. If I equip a specific helmet, I just want to set all the sprites in the animation once, and if I replace the equipment, a new sprite sheet is used that contains the breastplate and its animations during the run animation for example.
Is there any way to not repeatedly set renderer.sprite for each sprite in an animation via the late update function? I’m just worried that the function I attached will cause animation lag or lag to the game in general.
(I do not wish to piece and part the character together, especially not a 32 pixel drawing, and boning the character and stretching the pixels is definitely not a good option either)

sentences:
Monogame + Render Target + antialiasing doesn't work Is there any proper way to use antialiasing, while rendering to a RenderTarget2D and using Monogame?

I do this:

renderTarget = new RenderTarget2D(GameData.GraphicsDevice,
    pp.BackBufferWidth, pp.BackBufferHeight, false,
    GameData.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24,
    4, RenderTargetUsage.DiscardContents);

but AA is disabled despite setting multiSampleCount to 4. The hardware supports it and it works if rendering directly to the back buffer.

I googled around and it seems it used to work for XNA, but for Monogame I found this: https://github.com/mono/MonoGame/issues/1162

This link suggests it's an open issue and is from 2013. This is hard to believe for me, because it would effectively make using Monogame render targets unusable for most applications..

sentences:
Spherical fragment shader shockwave regardless of screen dimensions I've been working on a shockwave shader based on some examples I've looked at. My primary issue is that the screen/resolution dictates the shape of the shockwave. I need it to be spherical, but with default screen shapes it's an oval.

I can resolve the issue by reverse the resolution ratio calc but that winds up stretching the actual texture.

https://www.shadertoy.com/view/XlfBWj

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    float offset = (iTime- floor(iTime))/iTime;
    float CurrentTime = (iTime)*(offset);

    vec3 WaveParams = vec3(10.0, 0.8, 0.1 );

    vec2 center = vec2(0.5, 0.5);

    vec2 uv = fragCoord.xy / iResolution.xy;

    //float ratio = iResolution.y/iResolution.x;
    //WaveCentre.y *= ratio;
    //texCoord.y *= ratio;

    float dist = distance(uv, center);

    vec4 Color = texture(iChannel0, uv);

    if (dist <= CurrentTime + WaveParams.z &&
        dist >= CurrentTime - WaveParams.z) {
        //The pixel offset distance based on the input parameters
        float Diff = (dist - CurrentTime);
        float ScaleDiff = (1.0 - pow(abs(Diff * WaveParams.x), WaveParams.y));
        float DiffTime = (Diff  * ScaleDiff);

        //The direction of the distortion
        vec2 dir = normalize(uv - center);

        //Perform the distortion and reduce the effect over time
        uv += ((dir * DiffTime) / (CurrentTime * dist * 40.0));
        Color = texture(iChannel0, uv);

    }

    fragColor = Color;
}

sentences:
Blender 2.6: How to Undo 3D Cursor Movement I sometimes place the 3D cursor at the wrong location by a undesigned click on the left mouse button.

But when I'm trying to click Control + Z in order to undo the accidental 3D cursor movement, it doesn't revert.

So my question is: Is there an easy way to get Blender's (2.6) 3D cursor back to it's previous location? Thanks.

sentences:
How to achieve realistic fake physics? In my opinion, games that are most entertaining to watch and play implement fake physics, the difficult issue is how to implement the fake physics and still allow it to appear realistic. Most popular car driving games implement this really well.

Question
Anyone has any tips or know of anywhere I can learn more about how these are implemented?

Long Story
For example, Need For Speed is entertaining when the player car crashes into the computer car, but it would not be fun if we land off the track each time the player collide. In the game, it is obvious that some game logic is in place to steer or land the player car upright, face correct direction and on track most of the time even after a massive collisions. The game instead causes the computer car to suffer heavier damages like flying of the screen after many spins etc to enhance effects.

As another example, suppose at a time instance, a speeding player car is driving at the close rear left of a computer car and real physics dictates in the next time instance the player will definitely bump into the computer and lose speed and control. Then at this point, the player could steer right to avoid the car, or steer left to bump into its rear. In an entertaining game, we may still want the player to avoid the front car completely if he steers away and experience an exciting near miss.

In NFS, this experience appears to be implmented in a few ways such as player auto-steer avoidance, scraping pass and rebound to right of computer, computer car steer away to avoid, computer gets hit but lose control and spin off track to give way to player.

On the other hand, it the player steers to engage in a collision, we want to add excitement to spin the computer very badly but still keep the player on track with a good speed.

In NFS, these fake collisions and steering are not easily noticeable as they feel very realistic even though if we study them closely, it looks almost like the are scripted. One method I have tried is to determine the final state of collision and then compute the path backwards. But this only ensures the car is in a desired final state, does not address the realism.

sentences:
Change of direction after Collision I am having a pickup image which is moving at random direction and have to change the direction after collision with some tiles, which are a rectangle. I've my own algorithm for detecting the collision, but I couldn't accurately calculate new direction. Please have a look at my code for collision detection.

void PickUpManager::CheckPickUpToTileCollision(){
CIwArray<_TILE*> tiles=m_GAME.m_Datamine->m_Tile;
uint16 tileTop,tileLeft, tileBottom, tileRight, pickTop,pickLeft, pickBottom, pickRight;
for(uint32 i=0;i<tiles.size();i++){
    tileTop=tiles[i]->m_TilePos.y;
    tileLeft=tiles[i]->m_TilePos.x;
    tileBottom=tiles[i]->m_TilePos.y+tiles[i]->m_TileSize;
    tileRight=tiles[i]->m_TilePos.x+tiles[i]->m_TileSize;

    pickTop=m_Pos.y;
    pickLeft=m_Pos.x;
    pickBottom=m_Pos.y+pickHeight;
    pickRight=m_Pos.x+pickWidth;
    //Collision from Top of Tile
    if(pickBottom>=tileTop && pickBottom<=tileBottom && pickRight>=tileLeft && pickLeft<=tileRight &&!yFlag){
        yDir=-PICK_SPEED;
        yFlag=true;
    }
    //Collision from Bottom of Tile
    if(pickTop<=tileBottom && pickTop>=tileTop && pickRight>=tileLeft && pickLeft<=tileRight &&!yFlag){
        yDir=PICK_SPEED;
        yFlag=true;
    }
    //Collision from Left of Tile
    if(pickBottom>=tileTop && pickTop<=tileBottom && pickRight>=tileLeft && pickRight<=tileRight &&!xFlag){
        xDir=-PICK_SPEED;
        xFlag=true;
    }
    //Collision from Right of Tile
    if(pickBottom>=tileTop && pickTop<=tileBottom && pickLeft<=tileRight && pickLeft>=tileLeft &&!xFlag){
        xDir=PICK_SPEED;
        xFlag=true;
    }
    if(xFlag && yFlag)
        return;
}
}

void PickUpManager::Move(){
xFlag=false;
yFlag=false;
CheckPickUpToTileCollision();
    m_Pos.x+=xDir;
    m_Pos.y+=yDir;
}

The problem is the tiles are like bricks making a wall. So if the pickup hit the tile from top left, it changes it's x and y both direction, while the change of direction should be only in the x direction, as there's another tile which ended before this tile. I know it's some stupid problem, but still couldn't make it out.

sentences:
Unity collision help So my problem is this:

I have a block, which is used as a "pointer block" to show where a block will be spawned. It will be green if it isn't colliding anyone, meaning you can spawn a block. It gets red when it's colliding with something.

The pointer block is a trigger.

OnTriggerEnter gets called when the collider touches another collider. I want to know when another collider is in my pointer block, not when something is just on the edge of the colldier.

https://www.youtube.com/watch?v=0yNqSJ3yAxA&feature=youtu.be

sentences:
How to test a Unity game with different graphics APIs? If I don't have a device with Metal, is there a way to test the application with it anyway?
And if my device supports both DirectX and OpenGL, how can I tell the application, for example on Windows, which one should it use?

sentences:
Delaying certain actions/functions in libgdx using Timer? Hello I am trying to delay a part of the processes in my game, but it happend that I use one of my variables in an inner class so I have to make it final, but by making it final I can't assign new value when I find it. All I am asking for is to explain me how to do the delay without making my variable final.
Here is my code:

public class TomatoScript implements IActorScript {

private CompositeActor tomato;
private static final int speed = 100;
private BitmapFont bFont;
private Batch bch;
ArrayList<FruitScript> fruits;
private final int dmg = 10;
private int hp = 50;
private Rectangle bounds;
private int state = 0;
private FruitScript collidetFruit;

private boolean dead() {
    return hp <= 0;
}

private void setHp(int dmg) {
    hp = hp - dmg;
}

public TomatoScript(Batch b, BitmapFont bf, ArrayList<FruitScript> fruits) {
    this.bch = b;
    this.bFont = bf;
    this.fruits = fruits;
}

@Override
public void init(CompositeActor entity) {
    this.tomato = entity;
    tomato.setPosition(200, 129);
    bounds = new Rectangle(tomato.getX(), tomato.getY(), tomato.getWidth(), tomato.getHeight());
    bch.begin();
    bFont.draw(bch, Integer.toString(hp), tomato.getX() + 20, tomato.getY() + 95);
    bch.end();

}

@Override
public void act(float delta) {
    switch (state) {
        case 0:
            tomato.setX(tomato.getX() + speed * delta);
            bounds.setX(tomato.getX());
            bch.begin();
            bFont.draw(bch, Integer.toString(hp), tomato.getX() + 20, tomato.getY() + 95);
            bch.end();
            if (tomato.getX() >= 1090) {
                tomato.remove();
            }
            if (collisionFound()) {
                state++;
            }
            break;
        case 1:
            if (collisionAct(collidetFruit)) {
                state = 0;
            }
            break;

    }

}

private boolean collisionFound() {
    for (FruitScript f : fruits) {
        if (f.getBounds().overlaps(bounds)) {
            collidetFruit = f;
            return true;
        }

    }
    return false;

}

private boolean collisionAct(FruitScript f) {
    com.badlogic.gdx.utils.Timer.schedule(new com.badlogic.gdx.utils.Timer.Task() {
        @Override
        public void run() {
            f.setCol(true);//here it says I should make the "f" final.
            f.setHp(dmg);//here also.
            setHp(f.getDmg());
        }
    },2);

    if (f.dead()) {
        fruits.remove(f);
        return true;
    }
    if (dead()) {
        if (!f.dead()) {
            f.setCol(false);
            tomato.getScripts().remove(this);
            tomato.remove();
        }
        return false;
    }

    return false;
}

@Override
public void dispose() {
}}

I've tried to make it final, but it ruins everything it's supposed to stop the actors do the damage taking and then the one alive to continue, but it was doing it too fast in a blink of an eye. When you make the f final, it can't get the new item it should collide with. I hope someone can help :)

sentences:
Efficient collision detection - tile based HTML5/Javascript game I'm building a basic RPG game and I'm looking at collisions/pickups etc now.

It's tile based and I'm using HTML5 and Javascript.

I use a 2D array to create my tilemap.

I'm currently using a switch statement for whatever key has been pressed to move the player.

I have if statements to stop the player going off the edge of the map and viewport. If the player is about to land on a tile with tileID 3 then the player stops.

Here is the statement:

canvas.addEventListener('keydown', function(e) {
    console.log(e);
    var key = null;
    switch (e.which) {
        case 37:
            // Left
            if (playerX > 0) {
                playerX--;
            }
            if(board[playerX][playerY] == 3){
                playerX++;
            }
            break;
        case 38:
            // Up
            if (playerY > 0) playerY--;
            if(board[playerX][playerY] == 3){
                playerY++;
            }
            break;
        case 39:
            // Right
            if (playerX < worldWidth) {
                playerX++;
            }
            if(board[playerX][playerY] == 3){
                playerX--;
            }
            break;
        case 40:
            // Down
            if (playerY < worldHeight) playerY++;
            if(board[playerX][playerY] == 3){
                playerY--;
            }
            break;
    }

    viewX = playerX - Math.floor(0.5 * viewWidth);
    if (viewX < 0) viewX = 0;
    if (viewX+viewWidth > worldWidth) viewX = worldWidth - viewWidth;

    viewY = playerY - Math.floor(0.5 * viewHeight);
    if (viewY < 0) viewY = 0;
    if (viewY+viewHeight > worldHeight) viewY = worldHeight - viewHeight;

}, false);

Is there a more efficient way of handling collisions, than loads of if statements for each key?

The reason I ask is because I plan on having many items that the player will need to be able to pickup or not walk through like walls cliffs etc.

sentences:
Is there a grey-area with Copyright infringement? Currently a student, I'm trying to put together a game for iOS. From everywhere I've read, it seems any game's sound and art are apart of their IP and covered under their Copyright.

That being said, say I wanted to use the coin sound effect from the original Mario (less than 1s long and used sparsely)... would anyone really care? Having no experience with this, I'm just wondering if cases like this are treated like "Ya you're driving slightly over the speed limit, but nobody cares" or as "you stole that car".

Thanks for any insight anyone may be able to provide.

sentences:
Better quality texture when zooming Is there any way to have better quality textures ?

I thought that creating huge textures will improve their quality in game, that's why I draw textures with 0.25f or 0.5f scale.

I understand that computer can't display 4 pixels in 1 screen pixel, but how people do to have beautiful sprites while zooming ? even on smartphones...

Hope you can help me.

sentences:
Turn Based AI Algorithm (Small Board, Two Steps) This is my Game-Board:

-> The Red Balls are the AI-Controlled Actors.
-> The Blue Balls are the Player-Controlled Actors.
-> The Yellow Cells are the locations, from which the Red Balls can attack.
-> Each Red Ball can do 2 actions: move-move, move-attack, attack-attack.
-> At no time there can be 2 minions on one cell, but a minion can arrive on a cell another just left.

Its the AI's turn. Its planning the whole turn for all minions, each of them has the two moves.
The objective is to maximize the number of melee attacks, which can performed in a single turn (2 actions) on the player balls.

Problem I have in my current (brute-force) implementation:

Sometimes it is advisable for a minion to move, although it is already in a melee position, to make space for another minion, which can then move into melee range aswell.

Example:

In this situation its more effective for the front minion to move once, so another minion can move into melee range as well.

Do you know an effective algorithm for this job? Thank you for your time!

sentences:
Java - Load new classes from a folder automatically at startup I want to make my game-coding very flexible; so I wanted to make the game automatically load new Mobs from a folder named "mobs".

This must be only at startup; not while it's already running.

I just want to put a file with a name like "mouse.jar" (or others -> dynamic) into this folder, and the game should load it at startup.

I already saw this in "Robocode" (Robots) and "MCForge" (whole Mods), so it must be possible.

Can anyone tell me, how is it possible to load classes as resources in game at startup, regardless of the quantity?

sentences:
XNA Sprites Not Drawing Correctly I have a problem through out my current code where certain Texture2D's are not drawing correctly over each other.

For example, at the start I have sprite font being drawn over a background image and half the text is not shown when I add the image.

        _sb.Draw(_background, new Rectangle(0, 0, 800, 480), Color.White);
        if (isPaused)
            _sb.DrawString(_bigFont, "Resume", new Vector2(295, 200), Color.Black);
        else
        _sb.DrawString(_bigFont, "Start", new Vector2(315, 200), Color.Black);

The text then seems to appear if I change the value of other text on the screen.

Is there something I am missing here?

Thanks.

sentences:
How to tilt an object(2D) after collision and the rotate continuously I am having trouble rotating and object after collision. The object only transforms to the given angle of rotation once and stops. I would like to achieve in a way that after it has collided with the player object it rotates continuously till its killed after exiting the screen. The OnCollisionEnter2D(Collision2D collision) can't achieve this.

How can I achieve it using the FixedUpdate function?

Here is the code:

namespace Assets.scripts
{
    public class Barmovementscript : MonoBehaviour
    {
        public float Tilt;

        private void FixedUpdate()
        {
        }

        // upon collision the object rotates in a clockwise direction.
        void OnCollisionEnter2D(Collision2D collision)
        {
            if (collision.collider.tag == "Player")
            {
                Tilt += Time.deltaTime * -10;
                gameObject.transform.rotation = Quaternion.Euler(0, 0, Tilt);
            }
        }
    }
}

sentences:
How to create a wind tunnel / sky diving effect like in Fortnite? I am using Unity and I want to create a sky diving effect, as if you were looking directly down while falling and have the wind fly past you. My guess is I have to do something with the particle system. How can I do this?

An example is this video of Fortnite https://youtu.be/JFHs3uNJ9Cw?t=23s, you can see the wind flowing from the characters hands and feet.

sentences:
Stencil Buffer not working as expected in OpenGL ES 2.0 (Android) I'm trying to get to grips with the stencil buffer.

Apart from setting up viewport, camera, etc, my OpenGL ES 2.0 initialisation code is:

GLES20.glDisable(GLES20.GL_CULL_FACE);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glEnable(GLES20.GL_STENCIL_TEST);

GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
GLES20.glClearColor(0.2f, 0.8f, 1.0f, 0);
GLES20.glClearStencil(0);

My main code is below.

        GLES20.glEnable(GLES20.GL_STENCIL_TEST);
        GLES20.glColorMask(false, false, false, false);
        GLES20.glStencilFunc(GLES20.GL_NEVER, 1, 0xFF);
        GLES20.glStencilOp(GLES20.GL_REPLACE, GLES20.GL_KEEP, GLES20.GL_KEEP);

        GLES20.glStencilMask(0xFF);
        GLES20.glClear(GLES20.GL_STENCIL_BUFFER_BIT);

        // draw sprites
        player.draw();

        GLES20.glColorMask(true, true, true, true);
        GLES20.glDepthMask(true);
        GLES20.glStencilMask(0x00); // don't effect the stencil buffer
        GLES20.glStencilFunc(GLES20.GL_EQUAL, 0, 0xFF);
        // draw where stencils value is 0 if we want...

        GLES20.glStencilFunc(GLES20.GL_EQUAL, 1, 0xFF);
        // draw where stencils value is 1 if we want...

        level.draw();

        GLES20.glDisable(GLES20.GL_STENCIL_TEST);

However, this doesn't work. As expected this code does not draw the payer. The player (or the filled square surrounding the player) should be drawn to the stencil buffer. The next part of the code should draw the level, which should be clipped to the boundary of the player (or the square boundary of the player). What this code actually does is draw the whole level.

Why is the code not clipping the level to the profile of the player, or at least the square bounding the player ?

sentences:
In Unity, is there a difference between Vector3.down and -Vector3.up? I've noticed numerous tutorials and examples using something like "transform.up * -1" or "-Vector3.up" instead of simply saying "transform.down" and "Vector3.down".

Is there a good reason for this, or is it simply a style difference?

I'm specifically thinking about downward raycasts, if that matters at all.

sentences:
2D physics without "rebound" I'm trying to get my 2D top down shooter to use -some- physics.
I want the player and enemies not be able to exist in the same position, in other words, use collisions.
My first attempt was to use a CharacterController, but I could not get my other game objects to collide with my player, even though I had a RigidBody2D and a BoxCollider2D on them. Obviously, due to using a CharacterController, I was not able to add these components on my player.
Going one step back, I removed the CharacterController, and rather opted to go the Rigidbody2D route. This worked partially. I now get collisions on my player when he walks into other gameobjects (with RB2D and BC2D on them), but there seems to be a "rebound" anomaly occurring; my player moves around after collision.
I've tried playing around with the settings on the RigidBody2D on the player, but it does not seem to have any effect.
This is my PlayerMovement script :
void Update()
{
    HandleRotation();
    HandleMovement();
}

void HandleRotation()
{
    var mousePos = Input.mousePosition;
    mousePos.z = 5.23f;

    var objectPos = Camera.main.WorldToScreenPoint(transform.position);
    mousePos.x -= objectPos.x;
    mousePos.y -= objectPos.y;

    float angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg;
    transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));
}

void HandleMovement()
{
    float horizontal = Input.GetAxisRaw(Constants.Axis.Horizontal);
    float vertical = Input.GetAxisRaw(Constants.Axis.Vertical);

    Vector3 direction = new Vector3(horizontal, vertical, 0f).normalized;

    if (direction.magnitude >= 0.1f)
    {
        var speed = (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            ? mobileController.runningSpeed
            : mobileController.walkingSpeed;
        var moveVector = (direction * speed) + transform.position;
        mobileController.rigidbody2d.MovePosition(moveVector);

        var camPosition = new Vector3(mobileController.transform.position.x, mobileController.transform.position.y, -10);
        cam.position = camPosition;

    }
}

The settings on my Player :

I would like my player to stop dead in his tracks when colliding with another RigidBody2D. Is this possible? And if so, how would I go about doing that?

sentences:
How to move 3D Object With Touch Dragging Finger By the screen In android Unity Game My Code is As Followed:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Sphere : MonoBehaviour

{
    [SerializeField]
    private Touch touch;
    private float speedModifier;
    // Start is called before the first frame update
    void Start()
    {
        speedModifier = 0.01f;
    }

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

    {
        if (Input.touchCount > 0)
        {
            touch = Input.GetTouch(0);

            if (touch.phase == TouchPhase.Moved)
            {
                transform.position = new Vector3(
                    transform.position.x + touch.deltaPosition.x * speedModifier,
                    transform.position.y,
                    transform.position.z + touch.deltaPosition.y * speedModifier);
            }
        }

    }
}

I tried with this code but object is not even responding

sentences:
How do I get the correct values from glReadPixels in OpenGL 3.0? I'm currently trying to Implement mouse selection into my game editor and I ran into a little problem when I look at the values stored in &pixel[0],&pixel[1],&pixel[2],&pixel[3]; I get

r: 0
g: 0
b: 0
a: 0

As you can see I'm not able to get the correct values from glReadPixels();

My 3D models are red colored using glColor3f(255,0,0);

I was hoping someone could help me figure this out.

Here is the source code:

  case WM_LBUTTONDOWN:

  {

    GetCursorPos(&pos);
    ScreenToClient(hwnd, &pos);

     GLenum err = glGetError();

     while (glGetError() != GL_NO_ERROR) {cerr << err << endl;}

     glReadPixels(pos.x, SCREEN_HEIGHT - 1 - pos.y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixel[0] );

    cerr << "r: "<< (int)pixel[0] << endl;
    cerr << "g: "<< (int)pixel[1] << endl;
    cerr << "b: "<< (int)pixel[2] << endl;
    cerr << "a: "<< (int)pixel[3] << endl;

    cout << pos.x << endl;
    cout << pos.y << endl;

  }

break;

I use :

WIN32 API
OPENGL 3.0
C++

sentences:
How to resolve multiple simultaneous ball collisions in a pool game? I'm trying to simulate a break shot in billiards (1 ball hits a pyramid of 15 balls).
The formula for 2D ball collision works correctly in my game. But when it is applied to the break-shot, the result doesn't look realistic. (Only the 2 balls in the corners of the pyramid move, but the rest stays in place).

The problem is that because 15 balls are touching each other, there is an "infinite" number of simultaneous collisions following the first one.

What algorithm or formula can be used to resolve that?

sentences:
How can I calculate DeltaTime in seconds? Here is how I've been trying to implement delta time based on different internet resources.

var startTime:Number = getTimer();
game.Update(deltaTime);
deltaTime = Number(getTimer() - startTime) * 0.001;

My issue with this is it doesn't seem to be giving me accurate timing. The main update shows the frame time at 0.001 and when reinitializing the level it goes to 0.002. I'm using dt else where for a timer and later on time based physics so I would like it to work as expected. I must be missing something silly.

sentences:
Manually updating HTML5 local storage? I'm just starting out HTML5 game developement (and game dev in general) and watching all the videos and tutorials available something has crossed my mind.

Everyone keep saying I should set the cookie's (or cached files) to be expired after a certain amount of time. So that when it reaches that time the browser automatically downloads all assets again, even if it's the same asset's.

Wouldn't it be possible to manually define the version of the game?
For example the user has downloaded all the files for 1.01 of the game, when updating I change a simple variable to 1.02.
When the user logs in it would compare his version to the current and if they are not equal only then it downloads the files?

This could even be improved to download only specific files depending on what needs to be updated?

Would this be possible or am I just dreaming? What are the possible downsides of this approach?

sentences:
Why can't I play 2 animation track at the same time in Timeline for additional Camera? I try to move and rotate camera at the same time in timeline. To do this, I added two animation track to camera. One animation track changes position of the camera. And the other one changes rotation of camera. But they are not working at the same time. When I press "preview" button, only rotation of camera changes

This video may help understanding if question is not clear
https://vimeo.com/user133731359/review/517045792/43b6c6ec49

sentences: Why might a PC game have a set number of resolutions? There's an obvious reason games choose to use a set number of resolutions in fullscreen mode - a machine only has access to its own set of resolutions, and the intersection of the two sets determines what resolutions the game can run.  However, even in windowed mode the user is often limited to some set of resolutions.  What are some reasons games might opt to limit the size of the window in this way, rather than let the user dynamically resize the window themselves?

sentences:
Finding relative x and y value on a sprite [Gamemaker] I'm having a little conundrum that may just result from a lack of knowledge of Gamemaker's functionality. I've attached two images to aid explanation.

I have a sprite of a turret (with a gun barrel), attached to a turret object, and at certain points in gameplay this object will spawn another object on top of it (let's call it the 'bullet object').

I would like the bullet object to spawn at the x and y coordinates at the end of the gun barrel. This would be easy to find as a pair of coordinates if the sprite was always stationary, in this configuration. Alas, it is not. It rotates like billy-oh. This means that the x and y coordinates at the end of the gun barrel are constantly different.

How do I find this constantly changing x and y coordinate? I imagine (though am most likely wrong) that there the initial x and y coordinates of the sprite are saved and can be found even if rotated; is there a function that does this? Or do I need to write a script and then call it every time I want to spawn the bullet object?

Thanks for your help.

sentences:
how to rotate enemy to face player? Okay so i havebeen rotating my enemy to face the player using

float targetrotation = Math.Atan2(playerpos-enemypos);
enemy.rotation = targetrotation; (<this line of code i want to change)

This simple method has worked fine so far for getting the enemy to look at the player's position. However i decided to add some extra code to get the enemy to gradually rotate towards the player using this method:

if(enemy.rotation < targetrotation)
{
   enemy.rotation++;
}

if(enemy.rotation > targetrotation)
{
   enemy.rotation--;
}

Now the problem i am having is that when the player moves for example from 360 degree target to 1 degree then the enemy rotates the long way round to move to the 1 degree instead of simply adding 1 degree. Any help on how to correct this problem would be welcomed. I have a picture below:

sentences:
How should the player unlock things? Imagine a mobile phone game that is meant to be played in short sessions (5-10 mins). You can choose one out of many characters, and each character slightly alters the way the game plays.

Those characters are all locked and have to be unlocked by purchasing them with in-game money.

Should the player be able to choose which one to unlock?

Besides the obvious benefit of being able to choose who you want to unlock, the downside of this method is that players often end up having choice paralysis: With tons of characters to choose from, the player will just not bother reading every character's pros and cons and make a choice.

Should the player just be able to unlock a random character?

This is a more casual friendly method, as the player will just spend their in-game money without thinking because there's no other options. The downside of this is that paying for a character that doesn't suit your playstyle may feel bad.

Other solutions?

Maybe you have another solution on your mind? Note that some characters make the game more high risk/high reward, aimed for veteran players, while other characters just make the game easier to play.

sentences:
SDL, SFML, OpenGL, or just move to Java I recently started a new project, and I'm wondering if I should change the technology now before it's too late.

I'm using SDL with C++, I have around 6 classes, and the game is going alright, but I got to this point where I have to rotate my sprite to make it point to the coordinates of the mouse.

It's a 2D topdown game, so if I pre-cached the images, I'd have to load 360 images, which is bad for memory. If I used SDL_glx, I could do the rotation real time, but I heard it'd drop my frame rate very drastically, and I don't want my game to be slow.

I also read I could use OpenGL, which is faster at these things. The problem is, how much would I have to change my code if I moved to OpenGL with SDL.

So, I considered moving to a completely different language - Java - which is much simpler, and would allow me to focus on the game and handle networking much more easily than with C++.

I am very confused, and would like to hear your opinion - thank you!

sentences:
Node.js in LibGDX project I'm developing a game with LibGDX, and right now I'm trying the multiplayer part. I have managed to connect several players through Node.js and socketIO but when I try to make the lobby I am doubting if it's correct to use this.

I have read that it's oriented to web applications, so my question is: Is it advisable to use it with Java? Should I change it?

Thank you for reading and forgive my bad english.

sentences:
Path Modifier in Tower Of Defense Game I implemented PathModifier for path of each enemy in my tower of defense game. So I applied fixed time to path modifier in that enemy complete their path. Like following code describe.

new PathModifier(speed, path);

Here speed define the time to complete the path. But in tower of defense game my problem is, there is a tower which slow down the movement of the enemy. In that particular situation I was stuck. please someone provide me some guidance what to do in this situation.

EDIT :

        Path path = new Path(wayPointList.size());
        for (int j = 0; j < wayPointList.size(); j++) {
            Point point = grid.getCellPoint(wayPointList.get(j).getRow(),
                    wayPointList.get(j).getCol());
            path.to(point.x, point.y);
        }

sentences:
How to extract data from a resource compiler script in c# I need to know how to extract all data from a resource compiler script to a folder or the desktop.

the .res files are compiled and added to an exe file.

.res is the file extension.

and if that is possible I need to know how to re-pack the data after it's been changed.

The shorter answer I need to extract the data from a resource compiler script aka ".res" and then after data changed re-pack the data back into the ".res" file.

sentences:
Unity2D: Apply gravity to some items, when everything else is gravity-free? Sorry for the incredibly vague title:
Let's say you have an NPC, and when he dies he'll spawn items, coins for example.
Instead of just pushing the coins in random directions it would look a lot neater if they coins arced to the ground (see picture below)

The red circle represents a dead npc, the black lines represents gold coins.

Every entity in my game has a RigidBody2D with gravity set to 0, otherwise they'd fall to the bottom of the gray box.

Is it possible to 'pretend' that the ground around the dead npc has collision?

I thought about maybe adding a collision-box below the coins which follow the coins in the X-dimension only, but I'm not sure how to set the coins to only collide with these boxes (and perhaps left and right walls)

sentences:
Redefining the SDL rect struct Upon checking the docs of SDL (1.2) I saw that the SDL_Rect struct defines the x and y as Sint16. I'm making a bitmap font text scroller and I need those specifically to be unsigned ints because the text does need to go offscreen, yet still using the same struct because the SDLBlit method needs it. I tried creating my own and typecasting it as an SDL_Rect but that didn't work. Any ideas?

Also, to be more clear. The string of text scrolls to the left, therefore the first letter of my text does indeed go off screen but the rest doesn't. I assumed this was the problem.

for(int i=0;i<strlen(string);i++) {
  SDL_Blitsurface(bitmapsurface, rects[chars[i]], screen, destrect);
  destrect.x+=8;
}

sentences:
What resources are available for Mac OS game development? Are there are any modern resources on how to develop games for Mac OS?  I suppose this would include objective c, cocoa and opengl 3+.

The book Beginning Mac OS X Game Development with Cocoa looks very promising but isn't out until early next year.

sentences:
How to flip a sprite that is noncentered I have a sprite that I want to flip horizontal but I don't want it to look like the sprite is "changing position". I have code that changes the sprite horizontal direction depending if you go right or left, the problem is that it looks like the character is changing position.

I don't understand how I can solve this problem cause changing the origin is not doing anything when fliping the texture. Meaning it doesn't matter if I change the origin cordinates. How should I go about to flip horizontal but to not make it look like it is "changing position"
Edit
var temporg = Origin;
temporg.X = currenttexture.Width / 2;
temporg.Y = currenttexture.Height / 2;
Origin = temporg;
Position = new Vector2(Origin.X, Origin.Y);

And I have a class called AnimationHandler with a draw function that draw out my texture like this
spriteBatch.Draw(CurrentTexture, position, null, Color.White, 0f, Origin, 1f, spriteEffect, 0f);

Where 'spriteEffect' is the horizontal flip.

sentences:
How should I organise classes for a space simulator? I have pretty much taught myself everything I know about programming, so while I know how to teach myself (books, internet and reading API's), I'm finding that there hasn't been a whole lot in the way of good programming.

I am finishing up learning the basics of XNA and I want to create a space simulator to test my knowledge. This isn't a full scale simulator, but just something that covers everything I learned. It's also going to be modular so I can build on it, after I get the basics down. One of the early features I want to implement is AI. And I want to take this into account as I'm designing my classes so I can minimize rewriting code.

So my question:
How should I design ship classes so that both the player and AI can use them?

The only idea I have so far is:

Create a ship class that contains stats, models, textures, collision data etc. The player and AI would then have the data for position, rotation, health, etc and would base their status off of the ship stats.

sentences:
Acute corner - Collision Detection So I have set up a Swept test for AABB vs Line Collision that works fine, now the problem is that I have to deal with acute corners, where this happens:

As you can see the AABB just falls through the bottom Line, when it should stop.

I have been trying to do this for a month now, and I can't find any solution at all.

Why does this happen and how do I fix it?

Project: http://murplyx.net/sss - Move with WAD and draw lines with mouse

Source Code: http://murplyx.net/sss/js/main.js and http://murplyx.net/sss/js/vec.js

sentences:
Unity problems with OnTriggerStay and Input.GetKeyDown Background information

Some weeks ago, I start by creating my own platform game. You control a character, that can collect logs and should hold all the campfires on in the game.
When the user has collect more then one log, the player have to use this log to hold the fire on. So you should walk to the campfire and should press E to give the log to the fire.

Problem

What the problem momently is, is that when I press the E key, it will fired the input more then one time. This is because I use a OnTriggerStay2D function, to check every second if my Player is collide with the campfire object.

Do some search on the internet, results in people with the same problem. So one of the solutions was to create an bool and set it to true on OnTriggerEnter2D. But this isn't working for me. The same problem as before will occur.

Is there another solution to fix this conflict. When the user press the button, it should be fired ones. Below script is linked to the campfire object.

Also tried it with: if(Input.GetKeyDown(KeyCode.E)) { isTrigger = true; } and the same for GetKeyUp, but then isTrigger = false;

My current working code:

public Animator anim;
    public int campfireStatus;
    bool inTrigger = false;

    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update () {
        anim.SetInteger("Intensity", campfireStatus);
    }

    void OnTriggerEnter2D(Collider2D other) {
        inTrigger = true;
    }

    void OnTriggerExit2D(Collider2D other) {
        inTrigger = false;
    }

    void OnTriggerStay2D(Collider2D other) {
        // If player comes in contact with gameObject
        if (other.gameObject.tag=="Player"){
            print ("player");
            if(Input.GetKeyDown(KeyCode.E)) {
                print ("E Pressed");
                if (WoodBehaviour.count > 0) {
                    campfireStatus++;
                }
            }
        }
    }

So when the Player is collide with the campfire object AND the player pressed the E key AND you have more then one logs (this counter will be set in the WoodBehaviour script, that is linked to the player object ) than it should increase the campfireStatus with plus one.
The problem is, that the if statements will fired more then one times when pressing the E key.

sentences:
Calculating the flavour of a dish in a cooking game I'm currently working on a game that sees players cook dishes and are scored on their performance. To determine whether a dish is good or not, I will be looking to see if these elements are balanced:

Salt
Fat
Acid

A dish is made up of multiple ingredients and each ingredient will have its own salt, fat and acid levels. Adding too much or too little of an element (e.g. over-salting) results in a weaker score for the player.
There are also a few other factors that affect the salt, fat and acid balance:

The number of ingredients (adding more ingredients should reduce saltiness, fattiness and acidity)
Acid can reduce the saltiness and fattiness of a dish.
Salt can reduce the acidity of a dish.

This idea comes from Samin Nosrat's book Salt, Fat, Acid Heat. Below is an image from her book where she breaks down 4 popular salads and shows how each of the ingredients affects each element. If the player was to recreate "The Caesar" salad, they should get a perfect score for balancing all those ingredients but if they created a salad with just bacon and anchovies it should be considered too salty.
Texture is another element that the player needs to balance but this won't need to be calculated in the same way as the other elements. My plan here is to check if the player is making a salad it should have some crunch to it, whereas if they are making a roast the meat should be tender.

Given a set of ingredients, I would like to calculate whether the dish is balanced or not. The game will probably have 100s of ingredients and I would like some advice on how to best calculate these elements, score the player and balance the many ingredient combinations a player can come up with.

sentences:
Algorithm for a rain effect (Shaders) I'm trying to implement a rain effect using shader, I use godot 3-alpha, which uses a simplified GLSL 3.0 language. But I'm just finding very complex examples for me, I understand little about shaders, I wanted to achieve something very basic even to be able to walk. I thought of doing the following, moving the texture with just a few painted pixels. Yet I still do not know where to start.

I found this code, I really wanted to understand what is done in it:

http://www.glslsandbox.com/e#36547.0

I managed to translate the code for godot 3, but it does not work very well, I believe this line is to blame:

p=0.5+0.35*sin(11.0*fract(sin((s+p+scale)*mat2(vec2(7,3),vec2(6,5)))*5.0))-f;

What really is done that line? I can not understand what he does.

I did so:

shader_type canvas_item;

uniform float direction;
uniform float velocity = 1.0;
uniform float intensity;

float snow(vec2 uv, float scale, float time)
{
    float w = smoothstep(1.0,0.0,-uv.y*(scale/10.0));
    if(w<0.1){return 0.0;}
    uv+=time/scale;
    uv.y-=time*velocity/scale; //VELOCITY
    uv.x+=sin(uv.y+time*0.5)/scale;
    uv*=scale;
    vec2 s=floor(uv);
    vec2 f=fract(uv);
    vec2 p;
    float k=3.0;
    float d;
    vec2 t = (s*p*vec2(scale))*mat2(vec2(7.0, 3.0), vec2(6.0,5.0));
    p.y=-(0.5+0.35*sin(11.0*fract(sin((s.y+p.y+scale)*t.y)*5.0))-f.y);
    p.x = f.x;

    d=length(p);
    k=min(d,k);
    k=smoothstep(0.0,k,sin(f.x+f.y)*0.01);
    return k*w;
}

void fragment(){
    vec2 uv=(COLOR.xy*2.0-SCREEN_UV.xy)/min(SCREEN_UV.x,SCREEN_UV.y);
    float c=smoothstep(1.0,0.3,clamp(uv.y*0.3+0.8,0.0,0.75));
    c+=snow(uv, 30.0, TIME)*0.3;
    c+=snow(uv, 20.0, TIME)*0.5;
    c+=snow(uv, 15.0, TIME)*0.8;
    c+=snow(uv, 10.0, TIME);
    c+=snow(uv, 8.0, TIME);
    c+=snow(uv, 6.0, TIME);
    c+=snow(uv, 5.0, TIME);
    c+=snow(uv, 2.0, TIME);
    COLOR = vec4(vec3(c),0.5);

}

and this happens:

I have discovered that by decreasing the value I am passing to the scale, it increases the "particles", I mean how octaves in a noise, the smaller the number last, the greater the peaos generated. But my screen seems to be divided in two, cut by a diagonal line, I do not understand much because. I realize that here is the problem:

vec2 uv=(COLOR.xy*2.0-SCREEN_UV.xy)/min(SCREEN_UV.x,SCREEN_UV.y);

  Up 1:

I managed to improve with this:

vec2 uv= UV;

now it's like this:

but what he wanted was to be able to pass three uniforms, direction, velocity and intensity, and to be able to control the direction (right equer), the speed with which they fall, the intensity (higher or lower particles, more or less drops). But I still do not understand how well it is done to do that. Even more that what I will do is rain, I have to understand what is done with the colors to get the idea of rain and not snow.

  Up 2:

I was stirring here and the velocity, intensity and direction I was able to configure passing a uniform. But I can not change the color of the drops, it always comes out black and white. How would you put a blue color for example?

I try to change the color to red for example using the mix() function:

vec3 col2 = vec3(1.0, 0.0, 0.0);
vec3 resultColor= mix(vec3(c), col2, 0.7);
COLOR = vec4(vec3(resultColor),0.3);

and I get this:

I wanted to change only the color of the drops?

R= I got it like this:

 COLOR = vec4(vec3(0.3, 0.3, c),0.5);

but I'm not very fond of the result, it's very bright, and my breasts are too big, I'll fix it.

sentences:
Swapping Y and Z causes problems with Camera I am trying to swap the Y and Z axis in my program.  Everything worked great when Y used to be the axis coming out of the plane.  After having swapped y and x,  I have been able to draw my terrain using the X Y as the plane and Z as the height, however when converting the code for the camera I am running into trouble.

Here is the code that gives me the correct camera (so y is the axis coming out of the plane), along with an illustration.  The code is in SharpDX which is a C# wrapper for DirectX

// Setup the position of the camera in the world.
      Vector3 position = new Vector3(PositionX, PositionY, PositionZ);

      // Setup where the camera is looking  forwardby default.
      Vector3 lookAt = new Vector3(0, 0, 1.0f);

      // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
      float pitch = RotationX * 0.0174532925f;
      float yaw = RotationY * 0.0174532925f;
      float roll = RotationZ * 0.0174532925f;

      //// Create the rotation matrix from the yaw, pitch, and roll values.
      Matrix rotationMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, roll);

      // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
      lookAt = Vector3.TransformCoordinate(lookAt, rotationMatrix);
      Vector3 up = Vector3.TransformCoordinate(Vector3.UnitY, rotationMatrix);

      // Translate the rotated camera position to the location of the viewer.
      lookAt = position + lookAt;

      // Finally create the view matrix from the three updated vectors.
      ViewMatrix = Matrix.LookAtLH(position, lookAt, up);

Here is an illustration of what this produces, I am able to successfully move the camera around with the mouse by having the mouse differences affect the x and y rotation:

Now if I swap all the X and Y in my terrain, without affecting the camera, I get this:

So now the camera is facing the terrain directly, and attempts to yaw will not produce the desired view.  (the world will revolve around the camera when looking perpendicular to the terrain, and spin in place when looking at the horizon, the exact opposite of what we want.)

Now I thought that maybe if I just change the lookAt to 0, 1.0f, 0 ; swap the y and z rotations, and change the Up vector to use Vector3.UnitZ, it would solve all my problems.

// Setup the position of the camera in the world.
      Vector3 position = new Vector3(PositionX, PositionY, PositionZ);

      // Setup where the camera is looking  forwardby default.
      Vector3 lookAt = new Vector3(0, 1.0f, 0);

      // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
      float pitch = RotationX * 0.0174532925f;
      float yaw = RotationZ * 0.0174532925f;
      float roll = RotationY * 0.0174532925f;

      //// Create the rotation matrix from the yaw, pitch, and roll values.
      Matrix rotationMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, roll);

      // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
      lookAt = Vector3.TransformCoordinate(lookAt, rotationMatrix);
      Vector3 up = Vector3.TransformCoordinate(Vector3.UnitZ, rotationMatrix);

      // Translate the rotated camera position to the location of the viewer.
      lookAt = position + lookAt;

      // Finally create the view matrix from the three updated vectors.
      ViewMatrix = Matrix.LookAtLH(position, lookAt, up);

However, doing this, I get the same issue as before, the world will revolve around when looking perpendicular to the ground, but spin in place when looking parallel to the ground (so towards the horizon).  I believe the camera now looks like this:

Which doesn't make sense to me, since I thought changing the Up vector to UnitZ would make Z face up and not parallel to the ground.  Any suggestions to change the second code block is appreciated.

sentences:
What is the difference between framerate independent vs framerate dependent? What is the difference between framerate independent vs framerate dependent?
Can you please give an example.

sentences:
Relative movement in Box2D (keep object from falling off planet) I'm creating a game with planets orbiting around a sun, like this:
The brown square is the earth, rotating around its center and around the sun. The yellow square is the sun, which doesn't move.
Now imagine a player standing on the planet, the planet moves at a velocity of 20 m/s. How do I prevent the player from falling off? I have to give the perception to the player that the planet isn't moving.
I got the gravity on earth working, but I don't know how I can keep the player on the planet! I have thought about two solutions until now:

Just apply the angular velocity and linear velocity of the planet on the player (if it's in a specified radius), I think this method will cause jittery movement/glitches.

Create a separate Box2D world for the planet and render this Box2D world with the rotation/translation of the planet. This method is complex though since it would add the problem of moving bodies between different worlds if the player would leave the planet. This image explains it:

I think there is another (better) way to fix this problem, but I haven't found a solution yet.

sentences:
How could I do simple per-fragment lighting on BSP geometries? I am programming a graphics engine for an old game. The game uses a BSP geometry which I have rendering perfectly. For it's lights however, it simply has light instances with the standard x, y, z, rgba, brightness, type. Now I know that OpenGL has an 8 light limit. How should I go about handling multiple lights.

I am learning per fragment light just to have the concepts under my belt. I know per pixel lighting is the standard and I will eventually move there, just want to learn how to get this concept put in play as well.

I assume I will just calculate which lights are the closest and render those 8. Does anyone have any other ideas?

sentences:
IsoSurface Normals\Texture Coords Problems(DX11\SharpDX) Hi and thanks for your time!

So over the past few days I have been playing with isosurface construction from volume textures, I have it running on the cpu and all is well from a "just got it working" stand point eg. surface reconstruction works and I have my really cool voxel mesh drawing.

I have based my code(converted to VB.net) on Paul Bourke's work here: Polygonising a scalar field
and like I said it works well apart from the fact that my normals are wrong and I have these strange fully black on both sides triangles, I think I'm doing my normals wrong but the way they are now is the beast I can get, I tried a few ways to build the normals and this one is the only way I could get smooth normals.

Here you can see how my normals are wrong, green should be up, gray\dark should be unlit and the hay'ish colour is the lit side.

I have tried to flip and invert them but as you can see they are not wrong all the same way.

HLSL Normals 1st try:

float3x3 cotangent_frame(float3 N, float3 p, float2 uv)

// get edge vectors of the pixel triangle
float3 dp1 = ddx(p);
float3 dp2 = ddy(p);
float2 duv1 = ddx(uv);
float2 duv2 = ddy(uv);

// solve the linear system
float3 dp2perp = cross(dp2, N);
float3 dp1perp = cross(N, dp1);
float3 T = dp2perp * duv1.x + dp1perp * duv2.x;
float3 B = dp2perp * duv1.y + dp1perp * duv2.y;

// construct a scale-invariant frame
float invmax =   -sqrt(max(dot(T, T), dot(B, B)));
return float3x3(T * invmax, B * invmax, N);

HLSL Normals 2nd try:

NormalData CalcWS_Normal(float2 WS_TexCoord, float3 WS_Pos)

NormalData dout;

float3 dp1 = ddx(WS_Pos);
float3 dp2 = ddy(WS_Pos);
float2 duv1 = ddx(WS_TexCoord);
float2 duv2 = ddy(WS_TexCoord);

float3x3 M = float3x3(dp1, dp2, cross(dp1, dp2));
float2x3 inverseM = float2x3(cross(M[1], M[2]), cross(M[2], M[0]));

float3 t = mul(float2(duv1.x, duv2.x), inverseM);
float3 b = mul(float2(duv1.y, duv2.y), inverseM);
float3 normal = normalize(cross(normalize(b), normalize(t)));

dout.Normal = normal;
dout.Tang = t;
dout.BiTang = b;

return dout;

Heres is how I'm doing it now, takes a vertex and then samples the volume texture

VB.net

   Private Function vGetNormal(fX As Single, fY As Single, fZ As Single, fScale As Single) As Vector3
    Dim rfNormal As Vector3
    rfNormal.X = fSample1(fX - fScale, fY, fZ) - fSample1(fX + fScale, fY, fZ)
    rfNormal.Y = fSample1(fX, fY - fScale, fZ) - fSample1(fX, fY + fScale, fZ)
    rfNormal.Z = fSample1(fX, fY, fZ - fScale) - fSample1(fX, fY, fZ + fScale)
    Return Vector3.Normalize(rfNormal)
End Function

Private Function vGetNormal(fX As Single, fY As Single, fZ As Single, fScale As Vector3) As Vector3
    Dim rfNormal As Vector3
    rfNormal.X = fSample1(fX - fScale.X, fY, fZ) - fSample1(fX + fScale.X, fY, fZ)
    rfNormal.Y = fSample1(fX, fY - fScale.Y, fZ) - fSample1(fX, fY + fScale.Y, fZ)
    rfNormal.Z = fSample1(fX, fY, fZ - fScale.Z) - fSample1(fX, fY, fZ + fScale.Z)
    Return Vector3.Normalize(rfNormal)
End Function

Volume sampling code:

VB.net

Public Function GetVolumeData(_pos As Vector3) As Half
    Dim x2 As Single = Math.Abs((_pos.X / CellsPerPatch * 32) Mod mWidth)
    Dim y2 As Single = Math.Abs((_pos.Y / CellsPerPatch * 8) Mod mDepth)
    Dim z2 As Single = Math.Abs((_pos.Z / CellsPerPatch * 32) Mod mHeight)

    Return mScalars(CInt(Math.Truncate(x2)) + (CInt(Math.Truncate(z2)) * mWidth) + (CInt(Math.Truncate(y2) * mWidth * mWidth)))
End Function

The rest of the isosurface construction code is just a copy-> convert-> paste of Paul Bourke's c code.

Just to makes sure everyone knows what I'm asking: Can anyone tell me what I'm doing wrong? Is it a problem with my normals or the isosurface stuffs or both?

All of the above is just so u have some context, I'm happy to post more code if ppl need to see it

[EDIT]: Black squares come from having no depth info at that point so my deferred render hates those spots, this is leading back to maybe a problem with the surface reconstruction? But why its only happening in those spots, one would think that it would happen everywhere?

sentences: Exporting Blender bones I wrote an exporter for blender models that works great for meshes. I'm attempting to extend that to bones defined in blender. However I haven't found good information for exporting bone data. How can I access bone data? I'd like access all the vertices that the bone affects, the weight of each vertex and the matrix. Do I need to export anything else for skeletal animation and dynamic dismemberment?

sentences:
Term for "Massively Multiscale world browsing"? There is a type of multi-scale world browsing that has appeared in games in the last few years and I would be interested to know if there is a specific term that this browsing is known as and more importantly, if there are already specific patterns or techniques for implementing it.

I am referring to games like:

Universe Sandbox
EVE online
Startrek Armada
Heat Signature

The common characteristic of these games is that they allow you to zoom across an incredible range of scale from "item" all the way out to "galaxy" without (apparent) loss of synchronisation between what is happening at each scale. So, it looks like the world "advances" across all of these different scales simultaneously. Also, it is likely that each browsing level is a different visualisation type which is then blended seamlessly by matching the camera viewpoints and "cutting" from one level to the next but that might just be my perception.

What I am specifically interested to know would be:

If this technique has a name already (?)
If there is a ready made component (or pattern) that sorts out the architecture for achieving this kind of browsing (?)
If the "world" is really simulated at all levels (?)

sentences:
How can I add to the text multiple words or numbers? Now I'm using {0} I add anywhere in the text in the editor {0} and it will add the random number or random word. But I want now to be able to add for example also {1} and {2} so if for example the array of words is: hello,hi,bye and I will make in the editor in the text {0}……{1} it will add randomly two words from the array like hello and hi or hi and bye. It will pick up two random words. I don't place the {0} and {1} in same place each one in other place in the text and each time it will pick two random words and will display one word at {0} and one at {1}

Same for the numbers.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;

public class CustomText : MonoBehaviour
{
    public Text textField;
    public Vector2 randomRangeHours;
    public string[] words;
    public bool randomWords = false;

    private string defaultValue;
    private string originalValue;

    public void Init()
    {
        defaultValue = textField.text;
        originalValue = textField.text;
        GenerateRandomHour();
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            GenerateRandomHour();
        }
    }

    private void GenerateRandomHour()
    {
        string word = "";
        if (words.Length > 0)
        {
            word = words[UnityEngine.Random.Range(1, words.Length)];
        }

        string numberName = UnityEngine.Random.Range((int)randomRangeHours.x, (int)randomRangeHours.y).ToString();

        int t = Int32.Parse(numberName);
        if (t == 1)
        {
            defaultValue = defaultValue.Replace("hours", "hour");
        }
        else
        {
            defaultValue = originalValue;
        }

        if (randomWords)
        {
            textField.text = string.Format(defaultValue, word);
        }
        else
        {
            textField.text = string.Format(defaultValue, numberName);
        }
    }
}

sentences:
What is the AlphaToCoverage blend state useful for? Alright, just finished most of my early UI stuff and I wanted the windows to have some transparency. So I expanded my application to initialize and bind blend states so that my UI shader could implement alpha blending. I was initially having no luck but I got the blend state configured to achieve my purpose, however the way it is configured doesn't make sense to me so I must be missing something.

Here is how I initialize my blend state.

bool BlendState::StartUp() {
    D11DeviceManager* _pDeviceManager = D11DeviceManager::GetSingleton();

    D3D11_BLEND_DESC _desc;
    _desc.AlphaToCoverageEnable = false;
    _desc.IndependentBlendEnable = false;

    _desc.RenderTarget[0].BlendEnable            = true;
    _desc.RenderTarget[0].SrcBlend               = D3D11_BLEND_SRC_COLOR;
    _desc.RenderTarget[0].DestBlend              = D3D11_BLEND_DEST_COLOR;
    _desc.RenderTarget[0].BlendOp                = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].SrcBlendAlpha          = D3D11_BLEND_SRC_ALPHA;
    _desc.RenderTarget[0].DestBlendAlpha         = D3D11_BLEND_DEST_ALPHA;
    _desc.RenderTarget[0].BlendOpAlpha           = D3D11_BLEND_OP_ADD;
    _desc.RenderTarget[0].RenderTargetWriteMask  = 7;

    return !FAILED(_pDeviceManager->GetDevice()->CreateBlendState(&_desc, &pBlendState));
}

Right now my alpha blending only works when the AlphaToCoverage bool is set to false... I thought this was just a bool enabling the pixel fragment blending (which upon retrospection would be redundant considering the BlendEnable flags...) but looking at the MSDN documentation is appears to do this...

  You can use the AlphaToCoverageEnable member of D3D11_BLEND_DESC1 or D3D11_BLEND_DESC to toggle whether the runtime converts the .a component (alpha) of output register SV_Target0 from the pixel shader to an n-step coverage mask (given an n-sample RenderTarget). The runtime performs an AND operation of this mask with the typical sample coverage for the pixel in the primitive (in addition to the sample mask) to determine which samples to update in all the active RenderTargets.

Could someone explain this to me and how it differs from when the AlphaToCoverageEnable bool is false? I see that it adds a new mask to the fragment but I don't quite follow what the mask exactly is.

sentences:
How to make my components only contain raw data? I'm reading that Components in ECS are just only data and have no logic. I'm trying to follow this and I got that working:

class Sprite : public Component
{
public:
    Sprite(const std::string &textureid = "");

    std::string getTextureId() const;
    void setTextureId(const std::string& textureid);

    void setColor(const Color& color);
    Color getColor() const;
private:
    std::string m_textureid;
    Color m_color;
};

Now in my SpriteRenderingSystem I have to create every frame for every Entity that has a Sprite component a SFML Sprite object (I'm using it right now), set the parameters of that object, render it and destroy it. I know it's not optimized and I don't like it.

I think that I can use my component to hold a pointer to the SFML::Sprite object and then I only have to render it every frame without having to create/set/render/destroy it as you can see there:

class Sprite : public Component
{
public:
    Sprite(const std::string &textureid = "");

    std::string getTextureId() const;
    void setTextureId(const std::string& textureid);

    void setColor(const Color& color);
    Color getColor() const;

private:
    friend class ::SpriteRenderSystem;
    std::shared_ptr<sf::Sprite> m_sfspr;
    std::string m_textureid;
};

Am I breaking the "only data in a component" rule here? If so, what other alternatives are there?

sentences: Graphics for non-Graphics Designers Are there resources for programmers with little to no graphics design talent, but still want to make good-enough graphics for their own programs? I'm interested in both 2d and 3d computer generated graphics techniques, as well as free graphics repositories.

sentences:
GameObject remains null for some reason The idea is to access the function BlockWasDestroyed(); from Combo class.
Instead of var combo = gameObject.GetComponent(Combo); I've also tried with

var combo = GetComponent(Combo);
var combo:Combo = gameObject.GetComponent(Combo);
var combo:Combo = GetComponent(Combo);

But the console keeps telling it's null. However it could work when the function was static, but thing is now that function is calling another function, and so the errors happen once again.
Here's my code so far:
Brick.js
#pragma strict

public class Brick extends MonoBehaviour{

    function OnCollisionEnter(col : Collision){
        if(col.gameObject.name == "Ball"){
            var ballb = gameObject.GetComponent(BouncingBall);
            var combo = gameObject.GetComponent(Combo);
            combo.BlockWasDestroyed();
            ballb.velocityZ = ballb.velocityZ * -1;
            Score.score += 20;
            Destroy(this.gameObject);
        }
    }
}

sentences:
Loading data for an RPG I'm creating a small text RPG as a way to practice python and I'm running into a question about how to load data.  The game is a wild west game, though that isn't too relevant, and I need to store lists of weapons and their properties, as well as lists of characters, scenarios, etc.  I've got a good idea of how to represent this data as classes but I'm not as clear on how to store and load the data.

My main question revolves around the relationship between data and classes.  I have read through some posts here on SE and many of them relate to storage, so I have some good information there.

When should I load that data in?  For example, the player chooses from several weapons when the game starts.  Should I load in all the weapons and instantiate all the weapon objects at that point?  Should the weapon class have the ability to show weapons from the database without instantiating them?

Thanks for any help.

sentences:
Switch from left click to right click to make character walk in the Top Down Example, in UE4? When creating a new project in the Unreal Engine 4, you can choose to create a project already with some added features and things (Top Down Example):

This project has a character (which I changed its appearance) and it moves around the map when I click the left mouse button:

I looked at the blueprints of the project, but I did not identify where the command is that makes the character walk, so I'd like it to walk when I right-click.

Alls blueprints of project:

M_Cursor_Decal:

TopDownCharacter:

TopDownController:

TopDownGameMode:

The circled blocks of reds are the ones I suspected could be where I should make the modification, but no information on them gave me the certainty that that was where I was supposed to change.

I still do not create projects in C ++ programming mode, because I do not have Visual Studio 2017.

Some links from websites where I spent before coming here and that can help you to help me:

https://docs.unrealengine.com/en-us/Engine/Blueprints

https://www.youtube.com/watch?v=EFXMW_UEDco

The video is 2015, so although it's good, I did not take it so well, because I know that with all this time that has already happened, a lot is different.

Sorry for any translation errors, I'm not English speaker.

sentences:
Moving players into same square simultaneously? Consider a 2 x 2 grid of squares. A player can move onto a square if:

  no other player wants to move into the square next turn
  no other player has waited and is still occupying the square this turn

I have included the image above to describe my problem.

Players move simultaneously.

If 2 (or more) players try to move into the same square, neither move.

sentences:
2D animation example in pyglet (python) looping through 2 images/sprites every x seconds Suppose you have two images: step1.png and step2.png .

Can anyone show me a very simple example in pyglet how to loop through those 2 images say every 0.5 seconds?

The character doesn't have to move, just a simple black screen with a fixed region wherein the two images continually change every 0.5 secs.

I know how to make a character move, shoot projectiles etc. but I just can't figure out how to control the looping speed of the images.

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

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

Maybe a will need a special api ?

thank.

sentences:
Move an object with other objects connected (via joints) the right way What is the best way to move an object with other objects connected to it via joints?

Let's assume we have the following setup:

A player that can move on the x and the z axis

"Normally configured" RigidBody
Moving like this:

    void FixedUpdate() {
        Vector3 movement = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical"));
        movement = movement.normalized * 2f * Time.deltaTime;

        // m_rb is the RigidBody of the player
        m_rb.MovePosition(transform.position + movement);
    }

Another object that should be moving with the player as it were its child

Connected to the player via a fixed joint
"Normally configured" RigidBody

When moving the player without any object connected the movement looks as expected:

Now moving the player with the object connected results in some kind of dragging effect as seen here:

One way to solve this behaviour would be to also move the connected object:

// m_otherRb is the RigidBody of the connected object (m_other)
m_otherRb.MovePosition(m_other.transform.position + movement);

Is there a better way to solve this? Shouldn't the joint handle the movement of the other object? Moving the connected object like this results in many problems like to high impulse forces when colliding with something as both elements get pushed towards the collider. Also handling the rotation of the connected object isn't as easy as the position.

sentences:
How do I let game maker know that recieved json data is an array? In python I created an array called lobbyList = ["Awesome","Funny","Epic"]

I sent this array to Game maker studio 1.4 using JSON, I made a variable called RecievedData and made the following script

var name = argument0;
var data = argument1;

RecievedData = json_decode(data);
show_message(RecievedData); //Let's me know data has been recieved

I can recieve data fine, but when I show_message(RecievedData) it returns 4, when I do show_message(data) it gives me a string of ["Awesome","Funny","Epic"]

So how do I tell game maker that this is an array and not just a number or string? I want to draw this array coming from the server into a lobby list but for the life of me, I can't figure out how say this is an array.

sentences:
XNA - Darkening background and drawing something on top In a game a group of friends and I are working on using XNA, we wanted to create an effect where we could darken the screen and draw something else on top of the darkened portion. For example, we have a title screen that is drawn as a background sprite, a logo, a few buttons, and a lot of particle effects (all separate Texture2D's), but when you select the "Exit" button, the entire title screen darkens, and two (undarkened) buttons are drawn over-top ("exit" and "cancel" buttons).

Initially, we were going to do this by having two separate render targets, one for the title screen, and one for the yes and no buttons. Then, when we wanted to display the topmost render target, we darkened the render target that the title screen was drawn to, and then draw the new render target on top. The problem with this is that the second render target is filled with black pixels that simply get drawn over the background, blocking it out completely.

We have two ideas to fix this. The first idea is to draw the second render target on top of the first using BlendState.Additive, so that the black pixels are simply added to the background instead of drawn over-top. The problem with this is that it makes the other buttons look weird, since they're being drawn over top other things on the title screen. The second idea was to manually set every black pixel in the second render target to Color.Transparent, but we're not sure how efficient that is.

Any ideas on how we could achieve this effect?

sentences:
Path finding with identical values I have been reading up about path finding and find it all very confusing, however this is probably the best I have found for a logical explanation:

Path

If the cost of two nodes has the same value, I'm not sure how the path would be worked out though. How would it be worked out?

sentences:
Entity Component System for HUD and GUI This is a very rough sketch of how I currently have things designed.  It should, at least, give an idea of how my ECS is currently designed.

If you notice in that diagram, I have basically split the HUD out of the ECS. They have their own set of things (HudLayer, HudComponent, etc) and are handled differently. This is where I'm struggling, though.

There are many different instances in which the HUD will need to know about entities. Not just data changing (I have an event dispatcher for that), but the actual entity and all it encompasses. There are also situations where entities will need to be able to query the HUD for data. Let's take a couple examples:

First, my equipment screen. On here I can change the equipment on a character (Entity). In order for this to happen, I need to know about the entity. At least I think I do?  How can I handle this?
The second scenario involves my Systems needing to query a HudComponent for data. A specific example would be my battle system. Each "team" is given a 3x3 grid they can move around in. See here:

Skills target these cells, and not the player, so I would need a way for my systems to determine which cells are occupied and which are not. Basically I need a way for two way communication between Systems and my HUD. I know it's recommended (by some people, anyways) to take your HUD out of the ECS. Is that appropriate in my case?

sentences:
Are javascript MVC model implementations too slow for games? I wanted to implement a game in javascript with an MVC design pattern, with each entity's state stored in a model.
So for example,
In an update loop we iterate over all models and apply the velocity attribute to the position attribute of the model.
A view associated with each entity/model would then receive a position changed event,
and update the representation of the entity.
This would happen independently of the views render method being called in a requestAnimationFrame callback.
What I found though, through a possibly naive implementation, is that setting attributes of a model is simply too slow.
As much as I prefer the architecture of this code, the framerate was significantly lower.
Should I give up on using MVC for frequently updated attributes like position?
Below, I've included some code to test aspects of setting attributes of an object.
The most minimal model-like behaviour, in which an attribute is set only when the new value differs from the current,
and a "changed" update event is triggered, is about 10x slower than just setting attributes directly.
Output:

> test(1000, 100, 10)
object[key]: 163 ms
object[key] if changed: 172 ms
object[key] if changed & emit backbone event: 953 ms
Backbone.Model: 4043 ms
eventsBackboneCount: 100000

var test = function(creations, iterations, keyCount){
  var eventsBackbone = _.extend({}, Backbone.Events);
  var eventsBackboneCount = 0;
  eventsBackbone.on('all', function(){
    eventsBackboneCount = eventsBackboneCount + 1;
  });

  var looper = function(label, create, set){
    var start = (new Date()).getTime();

    var data = {};

    for(var i = 0; i < creations; i++){
      data[i] = create(i);
    }

    for(var j = 0; j < iterations; j++){
      for(var i = 0; i < creations; i++){
        var key = ''+(j % keyCount);
        set(data[i], key, Math.random());
      }
    }

    var end = (new Date()).getTime();

    console.log(''+label+': '+(end - start)+' ms');

    return data;
  };

  looper(
    'object[key]',
    function(id){
      return {};
    },
    function(datum, key, value){
      datum[key] = value;
    }
    );

  looper(
    'object[key] if changed',
    function(id){
      return {};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
     }
    }
    );

  looper(
    'object[key] if changed & emit backbone event',
    function(id){
      return {id:id};
    },
    function(datum, key, value){
      if(datum[key] !== value){
        datum[key] = value;
        eventsBackbone.trigger('changed:'+datum.id, datum, key);
     }
    }
    );

  looper(
    'Backbone.Model',
    function(id){
      return new Backbone.Model({});
    },
    function(datum, key, value){
      datum.set(key, value);
    }
    );

  console.log('eventsBackboneCount: '+eventsBackboneCount);
};

sentences:
Efficient method to export a lot of pre-rendered sprites from 3D models I have a lot of 3D Characters and I wish to use them in a 2.5D game as Sprites; in doing this I have to render them from a fixed camera angle and since each should have its own atlas file containing animation frames, it's going to be a very time consuming job!
I was thinking to write a python script (models are in Blender format) and let it render the Sprites. Since I don't know Python do you think that it is efficient of me to learn the python first and write the script to do the job for me?
Does anyone have a better idea?

In brief:
I am looking for an efficient method to export pre-rendered sprites from 3D models considering that they all have the same armature with the same animations.

sentences:
Confusion about Rotation matrices from Euler Angles I am trying to learn more about Euler Angles so as to help myself in understanding how I can control my camera better in the game.

I came across the following formula that converts Euler Angles to rotation matrices:

In the equation, I could see that the first matrix from the left is the rotation matrix about x-axis, the second is about y-axis and the third is about z-axis.

From my understanding about ordinary matrix transformations, the later transformation is always applied to the right hand side. And if I'm right about this, then the above equation should have a rotation order starting from rotating about z-axis, y-axis, then finally x-axis.

But, from the symbols  it seems that the rotation order start rotating about x-axis, then y-axis, then finally z-axis. What should the actual order of the rotation be?

Also, I am confuse about if the input vector, in this case, would be a row vector on the left, or a column vector on the right?

sentences:
How can I create a 2D "gooey"/"sticky" separation effect? I want to create an effect similar to this animation where two shapes separate over time but are connected (for a time) by something gooey that stretches and eventually breaks. Like pizza cheese, but specifically in 2D.

I'm using Swift and SpriteKit. I'm thinking this probably involves keyframes bezier path animations, but I'm not sure. How can I achieve this effect?

sentences:
Capturing a programs performance I'm trying to capture the performance of the GPU, CPU, FPS and memory usage on a program I'm currently working with and want to avoid having to write my own performance capture stuff. Does anyone know of a good program/programs that can do 1 or more of the above?

Ideally something that is simple to use. I've googled a few, but getting them to work has been a right pain. The couple that I've tried out have given me my entire systems performance, as opposed to just my running program.

Any help would be appreciated. I'm currently using DirectX 9 and C++ for my program.

sentences:
Keyboard.GetState() only work first time, and Memory increase (not Disposing) EDIT UPDATE 3
I been searching the web for a solution and found several people struggling with Memoryleak using MonoGame while trying to dispose objects.
It could be the case that MonoGame should be started and then closed as a own process, not from another program which are my case.
When I click on the button, a new thread is created and the MonoGame application is started:

 viThread = new Thread(startDemo);
 viThread.Priority = ThreadPriority.Highest;
 viThread.Start();

 private void startDemo()
 {
        using (Demo d = new Demo())
            d.Run();
 }

The "Demo" is closed by a Game.Exit command and i have also tried with Disposed(true) without any success. Next time I launch the MonoGame is Keyboard.GetsState() always empty and the memory is incresed. I made a loop where I started and closed the application 100times and it are eating my memory. I have seen lots of discussion about SharpDX not working correcly with dispsing resources. So here I am, stuck. Just want to point out that this worked fine for XNA but not now when changed to MonoGame. And again, thanks for all comments I got so far.

I have uploaded a project where you can see the issue by yourself. The second time dosn't the keyboard input work but mouseinput does and the memory is increasing for each time:

Donwload sln project

EDIT UPDATE 4

It is SharpDX which increase the memory, I perform following line before i exit:

SharpDX.Diagnostics.ObjectTracker.ReportActiveObjects().Length

And its increasing all the time. So I guess it isnt released.
Someone know how to do that?

sentences:
Component based architecture: "pure" or some inheritance? (I asked a similar question, but it had more questions inside it and I feel it wasn't clear enough, so I'm opening a new one).

Until recently I implemented all my games using an inheritance hierarchy. Those were simple games.

For example:

          Entity
          /    \
      Movable  Static
      /  \        /  \
    Orc  Mage   Tree  Wall

This worked for simple games.

However recently I read about 'entity component systems'. Using this approach, a class doesn't inherit from another class in order to receive functionality. Instead it is composed with it, which allows for more flexible designs.

My question is this:

I know that each component is a class (derived from a common base class).

However, there is one thing I don't understand: In the 'component system' approach, is there one class that all entities are instances of - and the only difference between entities is the components they contain?

For example: There is a class Entity. All entities in the game are instances of this class.

The only differences between them is that they are composed with different Component objects.

For example:

Component aiComponent = new AIComponent();
Component movementComponent = new MovementComponent();
Component physicsComponent = new PhysicsComponent();
Component rangedAttackComponent = new RangedAttackComponent();

Entity orc = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(movementComponent);
orc.addComponent(physicsComponent);

Entity shootingCastle = new Entity();
shootingCastle.addComponent(aiComponent);
shootingCastle.addComponent(rangedAttackComponent);
shootingCastle.addComponent(physicsComponent);

All of this as opposed to my old approach:

Orc orc1 = new Orc();
ShootingCastle castle1 = new ShootingCastle();

As you can see, both orc and shootingCastle are instances of the Entity class. But they are composed with different components.

Is this how 'entity component systems' are supposed to be? No inheritance hierarchy at all? Or is there still a basic inheritance hierarchy, but most of the logic is inside components?

sentences:
Create a instance of a C++ class within a blueprint I'd like to create an instance of a C++ class in a blueprint.
That's my current approach, but the instance is None. Why?

sentences: Line Collision In Pygame? I am working on a game(a platformer) that is physics and momentum based. I want to make it so that the player(a single dot) can bounce off of the lines with correct physics, but to do that, I need to know which line it is touching. Knowing if it is touching a line or not is simple. I just have to check for a white dot where the player is. The problem is that I cannot find out which line the player is touching. I thought of making a ton of rects along each line and testing for the player, but that would cause too much lag. Does anyone have any ideas? :/

sentences: OpenGL - using gluSphere I have an OpenGL code that currently draws several spheres at different locations. I generate the vertex buffer data (and normal data) myself. However, to simplify the code and increase efficiency, I am now trying to use gluSphere instead. The problem is that if I want to draw several spheres at different locations, I think I will need several different model matrices, and thus several different MVP matrices (because I am using OpenGL 4.3 and there is no glTranslate). But if I want to rotate the whole scene, I will need to rotate all of these model matrices, instead of just one as before. Is there a workaround for this? Is there a simple way to draw several different things with gluQuadrics objects at different locations?

sentences:
How can I model a star? I'm trying to model a star in Unity, and it, sort of works, but it's not ideal. Currently, I'm using a large sphere with a self-illuminating material containing a star texture applied to it's surface, and a spotlight to create the effect of starlight, like this:

While it works, it doesn't look the greatest. I'm looking for an effect more along the lines of how Kerbal Space Program models a star:

How can I achieve this effect?

sentences:
Java2D Game Flickering I'm in the process of trying to get familiar with making games in Java, using the Swing library.

Coding my Snake game however, I've got to a point where the game is flickering/ghosting and I haven't a clue why.

An example of the flickering can be seen on this short youtube video:
http://www.youtube.com/watch?v=QP1IcZ5TRoY

I dread to post too much code here as it won't help anyone, but for glancers, I'll post some facts.

Painting on a JComponent
I do call super.paintComponent(g) at the start of my overrriden
paintComponent method
I've set setDoubleBuffered(boolean) to true.
Although unsure of its necessity, I've invoked
createBufferStrategy(2) on my JFrame
My "game loop" is based on a swing.Timer calling repaint every 17ms, but tried, 30fps
Snake piece moves at 25 pixel paces (or relative to world size).

This is how I draw each tile:

    for (int i = 0; i < gamePieces.length; i++) {
        int x = i % ROW_COL_SIZE;
        int y = i / ROW_COL_SIZE;

        if (gamePieces[i].equals(Tile.EMPTY)) {
            continue;

        } else {
            final SnakeGraphics gfx = gamePieces[i].getGraphic();
            gfx.draw(g2d, x, y, direction);
        }
    }

This is what is called on repaint:

public void render(Graphics2D g2d) {
    Direction dir = keyboard.getDirection();
    snake.setDirection(dir);
    snake.move();
    gameWorld.draw(g2d, dir);

}

and finally, how the snake moves:

public boolean move() {
    Point snakeHead = snake.getFirst();
    int x = snakeHead.x;
    int y = snakeHead.y;

    boolean success = validateStep(snakeHead); //boundary control + move

    if (success) {
        gameWorld.setTile(x, y, Tile.EMPTY);
        gameWorld.setTile(snakeHead.x, snakeHead.y, Tile.SNAKE_HEAD);
    }
    return success;

}

where gameWorld has all the tile information, i.e. what tiles get drawn and where, and Snake is just current position of the head thus far.

Apologies for the code-drop, but its all that I can determine to be relevant.

sentences:
Texture object and texture unit in GL As I understand texture usage consist of two parts

How to store this discrete data about texture internally. How much dimensions, channels, etc.
How to fetch/sample/filter

The question relative to OpenGL are:

q1: What parameters are stored in texture object (glGenTexture) and what parameters are store in texture unit (glActiveTexture) ?

q2: Does glTexParameter perform setup per texture object or per texture unit?

sentences: Unity Ragdoll Colliders don't collide I have a humanoid character with Ragdoll setup in Unity. However the box/capsule colliders on the various parts of the body don't collide with other static geometry. They do collide with the ground but not with any other static meshes. Is it possible to use them as colliders towards static meshes and what do I need to do for it to work?

sentences:
Targeting with a ballistic gun I am trying to determine the gun elevation angle of a gun that fires ballistic projectiles.

For a target at a certain distance D, I will have to compute an angle that increases with D.

This relation ship is non-linear, by the way, because the projectile loses velocity as it travels, for starters, due to drag.

In the past, I have done this with a lookup table.... for a whole bunch of test firings, see where the projectile hits the ground.

But this only works if there is no delta in the elevation between gun and target.

A target that is on a hill top, will need adjustment for extra range. Whereas a target in a valley below, would mean a lower gun elevation.

This means that the table-lookup will break down, and a 2D table seems like a kludge.

What would be an effective way to compute this targeting? I know things also depend on nozzle-velocity and air-drag, but these will not vary (but drag will be non-zero.) Neither will I be modeling the wind.

Additional information:

This is for AI assisted targeting. NPC or player targets a point in the world. The algorithm will find the corresponding angle to hit the target.

Currently, I am using Bullet Physics, with a discretely stepped world.

sentences:
What is this type of camera called? I am trying to find a name like "perspective view" of how a camera like this is called:

It is 2d and 3d at the same time. I'm having a hard time trying to find the name.

sentences:
Simple GLSL example to render a 2d textured quad? I would really love to add shader support in my game , although i can't seem to find a SIMPLE example on how to setup opengl for using shaders.

So i would like to ask : Does anyone knows if there are any SIMPLE examples for beginners ? (ie Rendering a simple 2d quad or something like that)

sentences:
Java - Loading background music into memory I am currently developing a game with Java, with a soundtrack consisting of ten tracks in .ogg format, 1-2 MB in size each. To be able to switch between these tracks quickly and easily in the game, before the game starts, I load all of them into memory by creating ten Clip classes. Unfortunately, but understandably, pre-loading these tracks increases the application's CPU usage from about 61 MB to 340 MB.

Since I'm only ever playing one track at a time, I could make it so that only one Clip is ever in memory, and is destroyed when the track needs to change. This means, though, that I'll have to hang the game up on loading the Clip when this happens, or do this on a different thread during a few seconds of undesirable silence.

Is there a smarter, more conventional way to handle large BGM files, or do I just have to pick my poison?

sentences:
How do I align the cube in which shadows are computed with the view frustrum? ("View Space aligned frustum") Short and concise:

Given 8 world space positions that form a cube of arbitrary size, position and orientation and given an arbitrary light direction.

How do I compute the View and Projection matrix for a directional light, such that the shadows are computed in exactly and only this cube?

Edit: Clarification: I want to create Shadow Maps, in the way, that Crytek calls "View Space aligned" (http://www.crytek.com/download/Playing%20with%20Real-Time%20Shadows.pdf page 54-55), so I want that the cube in which shadows are computed is aligned with the view frustrum. How do I achieve that, when I have already have the 8 world space positions of a cube, around the view frustrum?

sentences: How are objects represented in raymarching shaders How does one represent geometry in raymarching shader? Say I wanted to pass a tree of SDF primitive shaders. My current idea is to pass texture containing their positions as rgb and type as alpha channel but that seems to be quite crude method which additionaly forces me to use same type of blending between  all objects.

sentences:
Tilting problem in Unity I want to tilt my object left or right depending on which side I'm moving my mouse. I wrote something like that:

    if (Input.GetAxis ("Mouse X") > 1) {
        transform.localRotation = Quaternion.Euler(0, 0, (-35 * Time.deltaTime * speed));
    }
    else if (Input.GetAxis ("Mouse X") < -1) {
        transform.localRotation = Quaternion.Euler(0, 0, (35 * Time.deltaTime * speed));
    }
    else if (Input.GetAxis ("Mouse X") == 0) {
        transform.localRotation = Quaternion.Euler(0, 0, 0);
    }

It's working only when I move mouse very fast and it's not 'smooth'. Would be thankful if anyone would help me :)

sentences:
algorithm for Shooting objects that bounce off the wall I'm trying to make a 2D game where my Hero is standing in a 2D plan and surrounded by enemies(highest 3) that throwing balls. and my hero have a shield in hands and and will stop the balls...

well the problem is i'm not able to found the direction on which enemy shoot the ball to reach to the Hero...
i want to make enemy little bit smarter so they don't just shoot straight

as in picture the ball can bounce of the wall same as light bounce off wall, the indecent angle and refractive angle will be same(sorry image angles not perfect. i draw them in paint) so i know that slop of this path line will be same in whole path just interchange in negative and positive.

now i want to find the directions in which i can shoot like 2 coordinates of x,y or something where i can shoot and the ball reaches to the hero.

i not want just one direction... i want the all possible directions where my enemy can shoot and that hit to the hero

and also the ball will be gone after 4-5 times bounce

there is an android game "Stupid zombies" that have exactly this kind system in game

any algorithm and solution to archive this....i'm working in java so later i can port my game to android easily

i also tried below link but my ball hitting more then 2 times and i'm not able to find solution
https://softwareengineering.stackexchange.com/questions/290628/algorithm-for-calculating-a-bullet-path-to-a-target-with-max-2-ricochets

please edit if you found anything not properly asked ...i tried to make as simple as possible, but its my first time here.

sentences:
Simple browser game help As my first "real" project, I'm working on a game that I intend to be single-player, web-based, and primarily in text. I need the ability to save choices the players make, and to have certain variables increase based on those choices. (Like bravery increasing after a heroic choice is made, for example.) There's a very small inventory; not RPG-style elaborate. The big thing about it is the choice aspect; every choice impacts where the player can go/future success or failure in other situations/etc. So I really have to be able to save those. (Choice input was being done by simple buttons, but I'm not married to that.) I'd like the player to be able to close the browser, then come back to it later where they left off- so, a login system, too.

My biggest problem is that I feel like I'm getting jerked left and right on which language(s) to use for this. I started off with Python a few months ago and started getting comfortable in that, but then didn't like how hard it was to integrate it in to a website afterward. (Hard for me, anyway. I might just be stupid, or failing to find the right tutorials on it.) I got a book on Javascript ("The Good Parts"), but found it unhelpful for what I was trying to do and my skill level. Then I got a book on PHP and MySQL ("PHP and MySQL Web Development") and started getting used to that, thinking it would be useful for saving player choices, but now all I see when I google specific questions about mySQL with games is people saying, "You don't want to use MySQL for games." So have I been wasting my time on that?

What language would you use for a single-player web game that was text-based and had to save many player choices? Or was I already going the right direction to start with?

sentences:
MMORPG game server data storage performance When writing a MMORPG game server...

Which storage design is better:

Should I only save character data from specific times?

On character log-out.
User disconnect.
From time to time. (every few minutes)

Should I save it immediately? Which would make writing be more extensive.

Other things:

What is the best practice when dealing with data on a real time
MMORPG game?
Which database is best with being multi-platformed in mind?

sentences:
Input.GetAxis("Horizontal") not updating I'm having trouble with Unity's basic character controlling. After i implemented the crouching in the code below the Input.GetAxis("Horizontal") does not update (while the left control is pressed (crouching), Input.GetAxis("Horizontal") is always set to zero even if left or right arrows are pressed.

The reason why this happens is not because of keyboard buffer etc. because horizontal input is working while jumping, which is implemented pretty much the same way the crouching is implemented in the code below. Btw. no root motion is used. Here's the code:

void HandleInput()
{
    currentBaseState = animator.GetCurrentAnimatorStateInfo(0);

    var deadZone = 0.1f;

    verticalVelocity = moveVector.y;
    moveVector = Vector3.zero;

    // print for testing
    print(Input.GetAxis("Horizontal"));

    if (Input.GetAxis("Horizontal") > deadZone || Input.GetAxis("Horizontal") < -deadZone)
    {
        yRotation += Input.GetAxis("Horizontal");
        animator.SetFloat("Direction", Input.GetAxis("Horizontal"));
    }

    if (Input.GetAxis ("Vertical") > deadZone)
    {
        speed += 0.1f;
        moveVector += new Vector3 (0, 0, Input.GetAxis ("Vertical") + speed);
    }
    else if(Input.GetAxis ("Vertical") < -deadZone)
    {
        if(speed >= 0)
            speed -= 0.1f;
        else
            speed += 0.1f;
        moveVector += new Vector3 (0, 0, Input.GetAxis ("Vertical") + speed);
    }
    else
    {
        moveVector += new Vector3(0, 0, Input.GetAxis ("Vertical") + previousSpeed);
        if(speed > 0)
            speed -= 0.1f;
    }

    animator.SetFloat ("Speed", Input.GetAxis ("Vertical"));

    totalRotation = yRotation * rotationMultiplier;

    transform.eulerAngles = new Vector3(0, totalRotation, 0);

    moveVector = transform.TransformDirection(moveVector);

    if (moveVector.magnitude > 1)
        moveVector = Vector3.Normalize(moveVector);

    Physics.Raycast (gameObject.transform.position, Vector3.down, out hitInfo, 0.5f);
    if(hitInfo.distance < 0.5f)
    {
        if (enableJump)
        {
            if (Input.GetButtonDown("Jump"))
            {
                animator.SetBool("Jump", true);
                verticalVelocity = jumpSpeed;
                skillSlider.value -= 1f;
                if(skillSlider.value == 0f){
                    enableJump = false;
                    bunnyImage.gameObject.SetActive(false);
                    skillSlider.gameObject.SetActive(false);
                }
            }
        }
    }

    if (Input.GetButtonDown ("Crouch")) {
        animator.SetBool ("Crouch", true);
        crouching = true;
    }

    if (Input.GetButtonUp("Crouch")) {
        crouching = false;
    }

    if (currentBaseState.fullPathHash == crouchState) {
        if(!animator.IsInTransition(0)){
            if(!crouching)
                animator.SetBool("Crouch", false);
        }
    }

    if (currentBaseState.fullPathHash == jumpState) {
        if (!animator.IsInTransition(0)) {
            animator.SetBool("Jump", false);
        }
    }

    previousSpeed = speed;

    moveVector = new Vector3(moveVector.x, verticalVelocity, moveVector.z);

    if (moveVector.y > -terminalVelocity)
        moveVector = new Vector3(moveVector.x, moveVector.y - gravity * Time.deltaTime, moveVector.z);

    if (characterController.isGrounded && moveVector.y < -1)
        moveVector = new Vector3(moveVector.x, -1, moveVector.z);

    characterController.Move(moveVector * Time.deltaTime);

}

sentences:
Hold and swipe can't work together I Have a character in my game that must go when player hold finger at the screen, but when I swipe character first go, and then do swipe. (for example jumping - character first go, and only then jump).
This my code for touch:

 if (Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            startTime = Time.time;
            startPos = touch.position;
        }
        else if (touch.phase == TouchPhase.Ended)
        {
            endTime = Time.time;
            endPos = touch.position;
            swipeDist = (endPos - startPos).magnitude;
            swipeTime = endTime - startTime;

            if (swipeTime < maxTime && swipeDist > minSwipeDist)
            {
                swipe();
            }
        }
        else if (touch.phase == TouchPhase.Stationary && isTap == 0)
        {
           hold();
        }
    }

This my code for a hold:

  void hold()
{

        moveVelocity = 3f;

}

And for swipe:

void swipe()
{
    Vector2 distance = endPos - startPos;
        if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y))
    {
           if (distance.x > 0)
        {
            Debug.Log("Right swipe");
        }
        if (distance.x < 0)
        {
           Debug.Log("Left swipe");
        }
    }
    if (Mathf.Abs(distance.x) < Mathf.Abs(distance.y))
    {
        if (distance.y > 0)
        {
            Debug.Log("Up swipe");
        }
        if (distance.y < 0)
        {
            Debug.Log("Down swipe");
        }
    }
}

My question is: When player swipe left character first go, and only then do swipe left. I want player swipe, without going forward. How can I do this?

sentences:
How to update UI after changing text in a view After applying a text change to a scrolling view, how do you get the new height of the text, resize other UI elements around the changed text length, etc?

Many have posted this question. Some have noted that the rect size doesn't change or that they have to wait multiple frames to then react to the UI updates.

sentences:
Collision detection for 2D RTS game in C++ I'm currently working on a real time strategy game in C++, and I need to implement a collision detection algorithm. I need to have a very efficient algorithm because this game will be running on mobile devices, and has potential to have many objects on the screen at one time.

I was thinking that a QuadTree might work for this, but then I realized it could be slow since QuadTree's are designed for static objects, and having many objects moving around the Q-Tree might not be optimal.

So I'm wondering what a good algorithm is for detecting collisions? The objects in my game will just have simple axis aligned bounding boxes to check for collisions, so I need a nice spacial indexing system so an object only checks for collisions with objects around it.

sentences: Unity - Outline each pixel on a texture So I have a 16x16 sprite. I would like to make each pixel on the sprite to have a border/outline so you can distinguish each pixel from another, like shown in the picture below (ignore the colored boxes). How would I do so? Please note, I will be coloring those pixels, so those borders should be gone when colored

sentences:
How to make compound data in Game Maker? In other languages, such as Lisp, there is such a thing as "compound data", where several variables are grouped together.

For example, if I want to represent an orbital that rotate around the player without creating a new object, I may use something like this:

(define (Orbital rx ry colour))
;; creating a new data type called "Orbital", with 3 var.s

(define ORB1 (make-Orbital 30 -20 "red"))
;; creating a particular orbital at (30, -20) with red as colour,
;; stored under the name "ORB1"

Is there a similar mechanism in Game Maker (made in Delphi) that permits such grouping of information under a structure which itself can be considered a single item, and thus such things to be stored in lists?

sentences:
Is there a good existing starting point for realistic 2d racing car physics? I'm trying to get a realistic behaving racing car into my 2d top-down game.

Making a very simple car that drives around is straight forward but I want a reasonably sophisticated model that models Newtons laws and the forces on the car well and results in something great.

I searched the web for a good tutorial on how to do this but there doesn't seem to be much example code out there.

I followed this tutorial http://www.gamedev.net/topic/470497-2d-car-physics-tutorial/ which was very good and seems like a good starting point but if you have a play with the included demo you can see it still has a fair way to go before its a convincing racing car.

I hear that some 3d game engines like Unity come with a good starting vehicle model out of the box. Is there something like that out there for 2D?

Just want to make sure I am not missing some great existing 2d starting point I don't know about before I spend a LOT of time reading and figuring out all the correct forces etc needed to build my own from scratch.

This article seems to describe all the things you need: http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html but the source code links are broken unfortunately.

sentences:
Why is anti aliasing not being applied to my 2D objects in Unity? I am drawing 2D objects in Unity.  Some of these objects are drawn using the standard sprite method that is built into Unity.  Others are computed as distance functions in a shader.

In both cases I can't get Unity to apply anti aliasing despite the setting being set.

Is there an extra step that I am missing that is required to get anti aliasing to work properly?

Would it be better to implement my own form of AA in a shader?

sentences:
Can't import shaders/textures to Godot from Blender 2.8 I'm using this shader for my models and then i import them like this
This is the original model in blender:

the result in godot:

I think i might have missed some step but not sure of which one, i followed the tutorial video on how to import and other similar guides but the results is the same. Any ideas of what i'm doing wrong?
Looks like my model not importing shader and textures cor

sentences:
Bug with OnColliderEnter/Exit when colliding with multiple objects at almost the same time Unity Version: 2017.4.1f1

I currently have a game with a jumping mechanic. I only want the jump to work where you're on ground, so I have planes on top of everything, which, if you are on a plane, then you can jump.

This works, however if you are in a position where you are falling and then in quick succession, hit one plane, fall off that plane (like when your centre of mass is hanging off the edge), then land on another plane, at the end of it all, it still thinks you are on the air.

Note: I don't think this is an error with the velocity of the player, at no point do you go through a collider.

So my question is, is there an error in my code (shown below) which I can fix, or should I take another approach towards jumping, thanks. Relevant code below.

private bool canJump;
private Rigidbody rb;
public float jumpStrength;

private void OnCollisionEnter(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = true;
    }
}
private void OnCollisionExit(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = false;
    }
}
private void Update()
{
    if (canJump && Input.GetKey(Keyode.W))
    {
        rb.velocity += new Vector3(0, jumpStrength, 0);
        canJump = false; // Safety measure to ensure consistent jump height
    }
}

Thanks

sentences:
Can I use DirectX with C#? I thought that if you wanted to make games using DirectX, you had to know C++. But I recently found out that that is not actually true. It looks like some parts of Direct3D can be used from C#. This MSDN document, for example, which has C# examples.

Am I understanding this incorrectly? Have I waited all these years for nothing?

sentences:
Parabolic movement of a gameObject in Unity Currently I'm working on a 3D game. In this game my player is a ball and it can jump from tile to tile. The movement of the ball is 45 degrees left or right when it jumps. I want to make it jump in a parabolic path. But I'm unable to do that.
I have used Mecanim, AngleAxis, and lerp as well. But the problem is when I use lerp and animation together, firstly the lerp works then the animation(Jump animation).
Basically the ball has a parent and mainly the parent lerps between the tiles and the ball itself has the animation clip attached to it.

Any suggestions or help is appreciated.

sentences:
Find points inside a closed area I have a 2D rectangular grid (100x100) with 3 types of cell (Empty, Base and Outline). I need to find cells inside the territory formed by Base and Outline cells.

For example, in this scheme:

I need to find the yellow cells.

The same algorithm, but with hexagonal grid, was implemented in the game in this YouTube video: https://youtu.be/6zyMHnBM5x8.

Any help on how to achieve that would be very helpful. Thanks.

sentences:
Draw quad with OpenGL VBO using OpenTK I'm trying to learn how to use VBO (Vertex Buffer Objects) by putting together a simple program that draws a quad to the screen using OpenTK (C# OpenGL bindings).

Unfortunately I'm not seeing anything on screen.  If I draw the same quad in immediate mode it shows up fine.

Since it wasn't working I tried adding Color Data too (in case this was the problem) but it didn't help.

Any help would be greatly appreciated!

    private uint indexBufferId;
    private uint vertexBufferId;
    private uint colorBufferId;

    private void InitialiseData()
    {

        // Set-up index buffer:
        ushort[] indices = new ushort[] { 0, 1, 2, 3 };

        GL.GenBuffers(1, out indexBufferId);
        GL.BindBuffer(BufferTarget.ElementArrayBuffer, indexBufferId);
        GL.BufferData(
            BufferTarget.ElementArrayBuffer,
            (IntPtr)(indices.Length * sizeof(ushort)),
            indices,
            BufferUsageHint.StaticDraw);

        // Set-up vertex buffer:
        float[] vertexData = new float[] {
            50.0f, 50.0f,
            100.0f, 50.0f,
            100.0f, 100.0f,
            50.0f, 100.0f };

        GL.GenBuffers(1, out vertexBufferId);
        GL.BindBuffer(BufferTarget.ArrayBuffer, vertexBufferId);
        GL.BufferData(
            BufferTarget.ArrayBuffer,
            (IntPtr)(vertexData.Length * sizeof(float)),
            vertexData,
            BufferUsageHint.StaticDraw);

        // Set-up color buffer:
        float[] colorData = new float[] {
            1.0f, 1.0f, 1.0f, 1.0f,
            1.0f, 1.0f, 1.0f, 1.0f,
            1.0f, 1.0f, 1.0f, 1.0f,
            1.0f, 1.0f, 1.0f, 1.0f
        };

        GL.GenBuffers(1, out colorBufferId);
        GL.BindBuffer(BufferTarget.ArrayBuffer, colorBufferId);
        GL.BufferData(
            BufferTarget.ArrayBuffer,
            (IntPtr)(colorData.Length * sizeof(float)),
            colorData,
            BufferUsageHint.StaticDraw);

    }

    protected override void OnRenderFrame(FrameEventArgs e)
    {

        base.OnRenderFrame(e);

        GL.Clear(ClearBufferMask.ColorBufferBit);

        // Bind vertex buffer:
        GL.BindBuffer(BufferTarget.ArrayBuffer, vertexBufferId);
        GL.EnableClientState(ArrayCap.VertexArray);
        GL.VertexPointer(2, VertexPointerType.Float, 0, IntPtr.Zero);

        // Bind color buffer:
        GL.BindBuffer(BufferTarget.ArrayBuffer, colorBufferId);
        GL.EnableClientState(ArrayCap.ColorArray);
        GL.ColorPointer(4, ColorPointerType.Float, 0, IntPtr.Zero);

        // Bind index buffer:
        GL.BindBuffer(BufferTarget.ElementArrayBuffer, indexBufferId);

        // Draw:
        GL.DrawElements(
            BeginMode.Quads,
            1,
            DrawElementsType.UnsignedShort,
            IntPtr.Zero);

        // Disable:
        GL.DisableClientState(ArrayCap.VertexArray);
        GL.DisableClientState(ArrayCap.ColorArray);

        SwapBuffers();

    }

sentences:
Why is my texture displaying incorrect colours using dx11? I am trying to load my data from a binary file (ppm) and create a texture using this data. It is important that I learn to do it this way as I am eventually going to be packing all of my textures into a single binary file and then index them so creating the texture with pure binary data is something that I need to be able to do.

It seems that the texture is drawing correctly, but the colours are incorrect. I saved my image as .ppm just for this test application.

Here is the code to load my data

ppm ppm;

ppm.read(std::string("textureppm.ppm"));

//just to ensure the data is correct
uint32_t val = ppm.pixels[0];
unsigned char r = (val & 0xFF000000) >> 24;
unsigned char g = (val & 0x00FF0000) >> 16;
unsigned char b = (val & 0x0000FF00) >> 8;
unsigned char a = (val & 0x000000FF);

ID3D11ShaderResourceView* texSRV = nullptr;
D3D11_SUBRESOURCE_DATA initData = { &ppm.pixels, ppm.width * sizeof(uint32_t), 0};

D3D11_TEXTURE2D_DESC desc = {};
desc.Width = ppm.width; desc.Height = ppm.height; desc.MipLevels = 1; desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_IMMUTABLE;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;

ID3D11Texture2D* tex;
HRESULT hr = getDevice()->CreateTexture2D(&desc, &initData, &tex);

if (SUCCEEDED(hr))
{
    D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
    SRVDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    SRVDesc.Texture2D.MipLevels = 1;

    hr = getDevice()->CreateShaderResourceView(tex,
        &SRVDesc, &texSRV);
}

if (FAILED(hr)) {
    throw 0;
}
else {
    setTexture(texSRV);
}

I have packed each byte into a uint32_t as it seems that is the format that is required DXGI_FORMAT_R8G8B8A8_UNORM

Here is the packing

uint32_t ppm::CreateRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
{
    uint32_t value = 0;
    int r2 = (r & 0xff) << 24;
    int g2 = (g & 0xff) << 16;
    int b2 = (b & 0xff) << 8;
    int a2 = (a & 0xff);

    value += r2 + g2 + b2 + a2;

    return value;
}

This code produces the following texture

When the original texture is

Does anyone know what I am doing wrong?

sentences:
Slingshot gravity effect I am trying to make a sling-shot that fires a projectile. I want it to act like the standard sling-shot in angry birds.

So far I managed to get the "pulling" effect, ie. If I draw backwards it fires in the opposite angle of the direction my finger went, and with different speeds depending on how far I dragged the finger from the "start-position".

Touch Code/logic:

@Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        touchPos.set(screenX, screenY, 0);
        camera.unproject(touchPos);
        Vector2 temp = new Vector2(touchPos.x, touchPos.y);

        Vector2 d = temp.sub(startPos); //subtract finger-position from start-position
        float velX = d.x * FIRE_SPEED; //add speed
        float velY = d.y * FIRE_SPEED;
        d.set(velX, velY); // set the velocity

        projectile.setVelocity(d); //send velocity to object
        projectile.setFired(true); //signal the object that its been fired

        return false;
    }

Object Code:

public void update(float delta){
        if(fired){
            pos.x -=  velocity.x * delta; //since I want it to move the opposite direction of where I dragged, I subtract
            pos.y -=  velocity.y * delta;
        }
    }

How would I go about adding gravity here? I want it to shoot in the set direction, then after a certain time/distance I want it to start falling (taking into account the direction so that it looks like real gravity), exactly as in angry birds.

sentences: Vision Cone for Enemy AI in Unity 2d I am trying to develop an Enemy AI with vision cone in unity 2d top down game, can you please suggest me some approach or sample script, so I can get an idea.

sentences:
Is it possible to work with a dedicated server in XNA? Hi I want to release my XNA game to the XBOX platform, but I'm worried about the networking limitations. Basically, I want to have a dedicated (authoritative) server, but it sounds like that is not possible.

Which is why I'm wondering about:

Using port 80 web calls to php-driven database
Using an xbox as a master-server (is that possible?)

I like the sound of #1, because I could write my own application to run on the xbox, and I would assume other users could connect to it similar to the p2p architecture.
Anyone able to expand on theory #2 above? or #1 as worst-case scenario?

sentences:
Simulating air pressure I am working on a space orientated game, and I have done some research on the best way to simulate gas with traditional physics technologies (Creating a lots of circles)

The only obstacle I have is how to simulate pressure. For example, if one corner of the room has lots of these little circle physics bodies, how can I make them evenly distribute? If I have a huge vacuum, what is the best way to have the particles get sucked out through the corridors etc of a room into space?

I can't think of any way to do this without iterating over every single particle against every singe other particle. Obviously, I cannot do this in a real-time simulation.

Maybe I could do this on a tile-based level?

The specific technologies I am using are Java and Dyn4j.

Thanks,

sentences:
Implementing a scrollable Panel in XNA/MonoGame I am trying to create a scrolling Panel for my game. The code I've shown below works but there is a problem.

I read Andrew's answer here and decided to implement the scrolling effect by using a Translation Matrix. However my Controls (Buttons, ComboBoxes, etc.) have a fixed Rectangle on the screen (the Rectangle I'm using to check if the cursor is over the Control). As I found out the Matrix translation will only move the texture of the Control and not the Rectangle.

The Problem:

So if I scroll down and click where the button was initially in the panel, it will trigger the Click event even though the button texture is "outside" the scissorRectangle.

What I considered:

I thought I should disable interaction with Controls outside of the scissorRectangle, but what about controls that are still partially visible?
If Matrix Translation won't work I thought about iterating over the Panel's _controls List and sending the offset to each individual Control (ugh), where it will adjust its Rectangle position. :/

I've got the following code for my Panel:

// ...
private RasterizerState _rasterizerState = new RasterizerState() { ScissorTestEnable = true };
private Vector2 _scrollOffset = Vector2.Zero;
private Matrix _matrix = Matrix.Identity;
// ...

In Update():

_matrix = Matrix.CreateTranslation(new Vector3(_scrollOffset, 0));
if (Enabled && BorderBox.Intersects(inputManager.MouseRect))
{
    if (inputManager.ScrolledDown())
    {
        if (_combinedRowHeight - (ContentBox.Height -_scrollOffset.Y) > -_combinedTextHeight)
        {
            _scrollOffset.Y -= 14;
        }
    }
    else if (inputManager.ScrolledUp())
    {
        if (_scrollOffset.Y < 0)
        {
            _scrollOffset.Y += 14;
        }
    }
}

And then in Draw():

// Save the previous RasterizerState
RasterizerState oldState = spriteBatch.GraphicsDevice.RasterizerState;
// Save the initial scissor rectangle
Rectangle currentScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;

spriteBatch.End();

spriteBatch.Begin();
// Draw Panel
spriteBatch.End();

spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, rasterizerState: _rasterizerState, transformMatrix: _matrix);

spriteBatch.GraphicsDevice.ScissorRectangle = ContentBox;

if (_drawControls)
{
    for (int i = 0; i < _rows.Count; i++)
    {
        _rows[i].Draw(spriteBatch);
    }
}

spriteBatch.End();

// Restore the scissor rectangle
spriteBatch.GraphicsDevice.ScissorRectangle = currentScissorRect;

// Restore the RasterizerState
spriteBatch.Begin(rasterizerState: oldState);

So is there no other way? Should I just send the offset to Controls and modify their position? Can't the matrix approach be used for interactable Controls?

sentences:
How to select the most powerful vkDevice? I've been messing around with Vulkan recently. In all of my experiments, when I select a gpu/vkDevice, I always just take the first one vulkan provides. I've looked at the documentation for vkDevice, and found that there is a lot of info, however I don't know how to decide what gpu is best for my program. I've considered using just max resolution, but it seems to me that there must be a better way.

Thanks :D

sentences:
How much do inconsistencies in update timing matter? Yesterday I wrote my first game loop with fixed timesteps.
It is supposed to run every 50 ms, however it runs at 50-53 ms.
Does it matter?

I'm guessing no, but I figured I would ask anyway.

startTime = std::chrono::high_resolution_clock::now();

while(running == true){

    updateTime = std::chrono::high_resolution_clock::now();

    deltaTime = std::chrono::duration_cast<std::chrono::milliseconds>(updateTime - lastUpdateTime).count();
    lag += deltaTime;

    eventChecker();
    keyboardManager();

    while(lag >= MS_PER_UPDATE){
        update();
        lastUpdateTime = updateTime;
        //cout << lag << "|";
        lag -= MS_PER_UPDATE;
    }

    render(lag / MS_PER_UPDATE);

}

sentences:
Slope handling in a tile-based platformer I'm trying to implement slopes in my 2D tile-based platformer made in GameMaker Studio 1.4.

I'm done with the normal solid block tiles, they work like charm, but slopes are even harder than I expected.

There are many problems with what I already tried. At some point, I was somewhat OK with it, but somewhat OK is not enough, it must be perfect.

So let's talk about uphill and let's assume our slope is going right.

So I need to check if we are in a slope. When we are, I need to calculate how much we are in the slope. Since it's a 45 degree slope for now, we should move the character upwards the same amount of pixels as we are in the slope. That looks and works fine for most of the cases.

But let's face some of the issues: If there are not wall tiles (black
ones in the picture) then the player may fall down between two slope
tiles.
Going down doesn't work in my current implementation, it works    if
I ignore, how much I am in the tile (but then, it snaps to the
slope even if I don't touch it, but I'm really in the slope tile),
really visible, when I am at the left-most part of the slope (snaps
to the bottom). Also sometimes it just positions kinda badly... Look
at the Grounded variable state.

If I ignore the intrusion amount (so it snaps into the tile), then
I'm still not good yet, as reaching the bottom of the slope may move me out
sideways. Applying the x velocity may make me leave the slope tile
before applying the y position and since I left the tile, there won't be y position applying. My character will be above ground
for a while depends on x velocity and gravity. At higher x velocity,
the player may left the slope tile more than one pixels above the
ground.

In overall, all the solutions I tried were imperfect. Most of the times, it work, but there are those situations where it becomes unreliable, especially at higher speeds. I think I will go until 8 pixels / frames speed with a very few of the objects. I wonder how specific games did it? I tried to learn from games like Castlevania - Dawn of Sorrow, since I got an editor for it and I experimented with slopes. To make the slopes work perfectly, there must be an solid block below the slopes at the intersections, or the player will fall between them. I wouldn't mind this that much. Worst case scenario, I would mark some tiles with some special flag below the slopes.

Screenshots from Symphony of the Night's hidden debug mode room:

This is how Dawn of Sorrow (not) handles slopes:

So I'm a bit confused / puzzled about the situation.

sentences: Getting and playing AudioClips by string name Is there anyway I can get an audioclip by the name it has in the assets folder? Or will I always have to make a reference to it by dragging and dropping the clip on a SoundClip in the inspector?

sentences:
How do you rotate RigidBody2D along a given access using velocity and not transform? I am trying to rotate my player along the centre of the world in Unity3D.
All the tutorials and references I have looked through till now have left me to this working code:

void MoveAlongCurve(bool moveClockwise) {
    if (!moveClockwise)
        timeCounter += moveSpeed*Time.fixedDeltaTime;
    else
        timeCounter -= moveSpeed*Time.fixedDeltaTime;

    float x = Mathf.Cos (timeCounter);
    float y = Mathf.Sin (timeCounter);

    transform.position = new Vector3 (distFromCentre*x, distFromCentre*y,0);
}

Also this seems to work fine as well:

transform.RotateAround (Vector3.zero,new Vector3(0,0,1),speed);

Now my question is how do i move my player using velocity? I was forced to keep my body as 'kinematic rigidbody2D' however I want my player to be a 'dynamic rigidbody2D'.

My reason for this is several:
1. Movement via velocity makes it independent of the timeCounter.
2. Dynamic Bodies enable collisionDetection. Hence it is basically a requirement for my game.

Thank you so much for taking the time to read this! Any suggestions or nudges in the right direction would be greatly appreciated and if you find anything wrong in my code or approach please comment!

sentences:
Creating state machines to handle multiple aspects of a game? So first off, I'm not sure if it matters but I am using SFML and C++. I've been wanting to write a game and I've read a lot on FSMs and what they do/make things easier for managing games, etc. What I gathered so far is that a state machine can be set up for each entity as well as the overall game so we are transitioning between states. What I am having trouble with is actually starting off and making a basic implementation of this. So I'd appreciate it if someone can point me in the right direction.

  How do I implement multiple state machines to handle different aspects of the game? For example for characters, for menu/loading/splash/credits etc. If I understood it correctly I would need something like an entity class, and then derive/inherit from it in order to make characters/mobs with various AIs? Is that the right way? Can I do it in a simpler fashion?
  How do I handle transitions if I don't want to use a switch statement? It seems like a naive approach if a more object oriented method exists. What is going to do the switching, do I have to remember the previous state or only know next state?

Thank you in advance!

sentences: No idea of how to simulate car crashes I have a simple car game with all the basic collision detection and movement in Unity with C#. But when I was building the "engine" for the game I didn't include a detail I later decided to include. I want the possibility so that cars can get damaged and so that the model can change. For example the car looked like it was new and after a crash it looks like a wreck. Please help me by pointing to some resources or by telling me approximate ways of implementing this new feature. Thanks!

sentences:
Approximating particles with with nebula I have a 2d galaxy where each star is rendered a particle:

I'd like to approximate it with nebula, so that instead of seeing lots of tiny dots from afar, users will see lots smooth light in the area. Something like this:

I'm more interested in technology-agnostic solution which accurately resembles underlying particles. E.g. how would one approach this problem from math/physics standpoint?

But if you have hints how to do it in a specific technology - those are welcome too! I don't even know how to approach it. The final thing is implemented with WebGL.

sentences:
How to get the closest "visible" object from my "player"? I'm using Unity 3d and i have to accomplish the following task: get the closest "visible" object to my player in forward direction.

It is a sort of radar.

I don't know where to start.
Any advice is welcomed.

Thanks

sentences:
OpenGL ES 2.0: Highly variable time spent in GLES20.glDrawArrays(). How to find the cause? How can I debug why the time take to issue exactly the same GL commands to render a frame, especially the call to GLES20.glDrawArrays(), is highly variable even when there is no garbage collection and no change in the scene? I'm developing for Android using Android Studio.

The slowest part of my render loop consists of rendering ~ 175 rectangles (2 triangles each) that are each transformed by a different matrix and each have a different texture. I'm using a VBO for the rectangle vertices and texture coordinates, however I load the matrix for each rectangle separately when I draw it. Since the images are up to 512x512 pixels each, I haven't bothered combining them into texture atlases. I could probably save memory bandwidth by mipmapping, but haven't done that yet.

All rectangles are currently draw using texture unit 0 (cycling through them doesn't seem to make a difference).

The main part of my onDrawFrame() code is:

for (int i = 0; i < images.length; i++) {
  int textureId = images[i].textureId;
  float[] modelMatrix = images[i].modelMatrix;
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureId);
  GLES20.glUniformMatrix4fv(modelMatrixId, 1, false, modelMatrix, 0);
  GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 6);
}

I narrowed the variability down using System.nanoTime() measurements and found that the GLES20.glDrawArrays() call is the one with the most (but not all of the) variability: For a frame (175 calls), it averages about 3msec total but goes up to 8msec a couple of times per second, and 13msec every couple of seconds.

How can I find the cause of this variability?

My render loop doesn't allocate any objects, so there is no garbage collection. I also don't think it can be the data bandwidth between CPU and GPU because the glUniformMatrix4fv() call executes super quickly (always < 2msec).

I don't know how asynchronous the CPU-GPU communication is so I don't know how directly I can attribute slowness to particular method calls. That said, the glDrawArrays() call is the one that blocks (on the CPU) for the most, and for the most variable, amount of time.

Any ideas how to debug this?

PS. Since it was asked, here are my shaders:

Fragment shader:

precision mediump float;
uniform sampler2D textureMap;
varying vec2 fragmentTextureCoord;
void main() {
  gl_FragColor = texture2D(textureMap, fragmentTextureCoord);
}

Vertex shader:

uniform mat4 modelMatrix;
uniform mat4 viewProjectionMatrix;
attribute vec4 position;
attribute vec2 vertexTextureCoord;
varying vec2 fragmentTextureCoord;
void main() {
  gl_Position = viewProjectionMatrix
               * modelMatrix
               * position;
 fragmentTextureCoord = vertexTextureCoord;
}

sentences:
How can I add a transparent overlay to a UI in libGDX? I am attempting to use the following code

        shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
        shapeRenderer.setColor(3,3,3,.3f);
        shapeRenderer.rect(0,0,gameWidth,gameHeight);
        shapeRenderer.end();

So that when the menu is accessed, a transparent background appears. The problem I am facing is that when I try to do this the objects rendered by the SpriteBatch seem to misbehave. Upon further research i found that attempting to nest that code within SpriteBatch.begin() and SpriteBatch.end() is the cause of that. However, If I try to place the code after the SpriteBatch.end(), because the SpriteBatch has ended the objects rendered by it do not appear behind the transparent rectangle.
(I tried assigning SpriteBatch and Shaperender a different camera, however, that didn't fix the problem.) How can I fix this or find another way to implement the transparent background for the menu.

sentences:
How to determine where on a path my object will be at a given point in time? I have map and an obj that is meant to move from start to end in X amount of time.

The movements are all straight lines, as curves are beyond my ability at the moment. So I am trying to get the object to move from these points, but along the way there are way points which keep it on a given path.

The speed of the object is determined by how long it will take to get from start to end (based on X).

This is what i have so far:

//get_now() returns seconds since epoch
var timepassed = get_now() - myObj[id].start; //seconds since epoch for departure
var timeleft = myObj[id].end - get_now(); //seconds since epoch for arrival
var journey_time = 60; //this means 60 minutes total journey time
var array = [[650,250]]; //way points along the straight paths

if(step == 0 || step =< array.length){
  var destinationx = array[step][0];
  var destinationy = array[step][1];
}else if( step == array.length){
  var destinationx = 250;
  var destinationy = 100;
} else {
  var destinationx = myObj[id].startx;
  var destinationy = myObj[id].starty;
}
step++;

When the user logs in at any given time, the object needs to be drawn in the correct place of the path, almost as if its been travelling along the path whilst the user has not been at the PC with the available information i have above.

How do I do this?

Note: The camera angle in the game is a birds eye view so its a straight forward X:Y rather than isometric angles.

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

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

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

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

sentences:
Deferred Rendering and skeletal animation I am working on a deferred rendering engine and just finished skeletal animation in the vertex shader, but soon realized that this was only updating the rendered geometry and not the shadows, as the animation was only done in the VS of the deferred rendering step, and not in the VS of each light.

I assume this means I should just calculate the animation on the cpu, as otherwise it will be done #oflights + 1 times in the gpu, which seems like a huge waste of cycles.

Is this how it is typically done?

Edit:  As a note, I am currently implementing this in OpenGL

sentences:
Rotate around a 3d Object (Software Renderer) I have a simple 3d software renderer (SDL / C++) which can load a 3ds Model and render it (shaded) and rotate it around X Y Z - Axis.
Now I would like to rotate / move around the object, meaning, the object itself stands still, and everything in the scene is displayed from the angle of the view. Is that what a camera in 3d engines does, and how would I implement something like this ?

(No OpenGL / DirectX is used, just plain software)

sentences:
Correctly Implementing a "Double Jump" I'm working on a 2D iPhone game using Corona (Trial version, so I can't use their forums). The game involves the character falling through the sky, and I'm trying to implement a "double jump" for the character, for him to be able jump up while falling. I'm using Corona's physics library to have the character fall, and so far the best method of having him jump is using the vertical impulse method

object:applyLinearImpulse(0, -0.4, object.x, object.y)

The problem I face is that when the character is just starting out (vertical velocity is low), he jumps really high, and when he's been falling for a while (vertical velocity is high), the jump is negligible. I'm guessing that the best solution is to use some sort of equation with the velocity as input to make the jump the same regardless of velocity, but I can't figure out what that equation would be.

Okay, so that's all my thoughts. The end question is, how exactly do you implement a double jump with physics? Is there a proper equation for my problem? Should I take a different approach? It's been done before in games like Smash Bros, so there's a repeatable solution, right?

sentences:
Map editor undo function - Not actually setting values to tiles I'm currently attempting to implement an undo/redo function for my map editor for a tile-based 2D platformer game made with XNA. I've found a lot of resources online about this and decided to try to write my own code for it to gain a better understanding of how it works.

My issue is when I pass the my tile's information into a stored "Action" and change the data within the newly created Action, it does not actually change the data in my tiles.

Below is the Action struct and the UndoBuffer class where I modify the tile's data based on the stored actions that I created elsewhere:

public struct Action
{
    public object[] StoredItem { get; set; }
    public object[] ModifiedItem { get; set; }
}

public class UndoBuffer
{
    private readonly List<Action> _undoBuffer;
    private readonly List<Action> _redoBuffer;

    public UndoBuffer()
    {
        _undoBuffer = new List<Action>();
        _redoBuffer = new List<Action>();
    }

    public void StoreAction(object[] storedItem, object[] modifiedItem)
    {
        var action = new Action {StoredItem = storedItem, ModifiedItem = modifiedItem};

        _undoBuffer.Insert(0, action);
    }

    public void Undo()
    {
        if (_undoBuffer.Count == 0) return;

        _redoBuffer.Insert(0, new Action {ModifiedItem = _undoBuffer[0].ModifiedItem, StoredItem = _undoBuffer[0].StoredItem});

        for (int i = 0; i < _undoBuffer[0].StoredItem.Count(); i++)
        {
            Action tempAction = _undoBuffer[0];
            tempAction.ModifiedItem[i] = tempAction.StoredItem[i];
            _undoBuffer[0] = tempAction;
        }

        _undoBuffer.RemoveAt(0);
    }
}

Here's how I'm passing the data in to the class above:

private void ReplaceTile(Tile oldTile, TileInfo tileInfo, bool storeAction = true)
{
    int tileX = (int)oldTile.Position.X / Tile.Width, tileY = (int)oldTile.Position.Y / Tile.Height;
    if (tileX < 0 || tileY < 0 || tileY >= _tileData.Tiles.Count || tileX >= _tileData.Tiles[tileY].Count) return;

    var storedTiles = new ArrayList();
    var modifiedTiles = new ArrayList();

    if (storeAction)
        storedTiles.Add(_tileData.Tiles[tileY][tileX].TileInfo);

    _tileData.Tiles[tileY][tileX].TileInfo = tileInfo;

    if (storeAction)
    {
        modifiedTiles.Add(_tileData.Tiles[tileY][tileX].TileInfo);
        _undoBuffer.StoreAction(storedTiles.ToArray(), modifiedTiles.ToArray());
    }

    _saved = false;
}

And here is the actual Tile class and its TileInfo struct:

public struct TileInfo
{
    public string ViewName;
    public int Frame;
    public TileCollision Collision;
    public CollisionType CollisionType;
    public TileProperty TileProperty;
    public SpriteEffects Effects;
    public Color TileColor;
    public float Rotation;
    public float Layer;
}

[Serializable]
public class Tile
{
    public TileInfo TileInfo;
    public Vector2 Position;

    public const int Width = 8;
    public const int Height = 8;

    public static readonly Vector2 Size = new Vector2(Width, Height);

    public Tile CreateTile(TileInfo tileInfo, Vector2 position)
    {
        var tile = new Tile
        {
            TileInfo = tileInfo,
            Position = position
        };

        return tile;
    }
}

So essentially, I just need the UndoBuffer class to actually change the data within the TileInfo structs that are passed into it, and not change a boxed copy of them.

sentences:
Enemy Follow Player Orthogonal Movement I have a Enemy class that Seeks a player if he is in his field of view.
Problem is i want the enemy only to move up/down/right/left, not like for example up and left at the same time (diagonal movement).

EDIT: Code updated

    private void SeekPlayer(GameTime gameTime, Player player)
    {
        directionToPlayer = player.Image.Position - Image.Position;
        directionToPlayer.Normalize();

        if(Image.Position != player.Image.Position)
        {
            if (directionToPlayer.X != player.Image.Position.X)
            {
                if(directionToPlayer.X < player.Image.Position.X)
                    Image.Position.X += directionToPlayer.X * MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
                else
                    Image.Position.X -= directionToPlayer.X * MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
            }
            else if (directionToPlayer.Y != player.Image.Position.Y)
            {
                if (directionToPlayer.Y < player.Image.Position.Y)
                    Image.Position.Y += directionToPlayer.Y * MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
                else
                    Image.Position.Y -= directionToPlayer.Y * MoveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
            }

        }
        UpdateFOV();
    }

With the current code the enemy sometimes follows the play on the X coordinates, and when it's the same has the player's, doesn't continue to follow on the Y coordinate. And vice-versa for Y.

sentences:
How to destroy object after animation I've made an object and when the player has pick it up, rise it up and stop it out of screen. But because you can see the shadow of that object, I will destroy it after the animation has played. But how can I do this whit Unity and C#?

Just destroy is just like this:

Destroy(gameobject);

and start an animation like this:

private Animator _anim;           // global variable
_anim = GetComponent<Animator>(); // in start() methode
_anim.SetTrigger("Picked");       // in other methode

sentences:
Getting isometric grid coordinates from standard X,Y coordinates I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y),  instead of isometric grid X and Y format. Usually you would just divide them by the tile size, but isometric needs some sort of transform.

For example on a 64x32 isometric tilemap of size 40 tiles by 40 tiles an object at (20,21)'s coordinates come out as (640,584)

So the question really is what formula gets (20,21) from (640,584)?

sentences: Static Camera on Endless Runner I am developing a mobile game in ue4. For this project, I need to have a "static" camera so that the player can move within the frame not affecting camera location and rotation. But as this is an endless scroller I also need to have the camera move at a constant pace limiting the player's area of movement. Does anyone know how to do this?

sentences: How do I instantiate a prefab to a specific coordinate? I have a prefab called ‘road’.  How can I instantiate it (using C#) such that it appears initially at coordinates (5, 5, 5)?

sentences:
Box2D platformer: Why does horizontal movement stop jumping? I'm writing my sBox2D game character's movement code, but my implementation of jumping is failing:

When I press the Jump key, the character jumps OK. However, when I press jump and another key (like the left arrow key) at the same time, it kind of blocks the jump from happening.

I'm using applyForceToCenter and setLinearVelocity to move the character.

What could the problem be?

Here's how I've bound keys trigger movement:

// press W key (aka Up key or BTNup)
if (RHInput.isDown(RHInput.BTNup)) {

    if(rhcl.isPlayerOnGround()) {
        toniBody.applyForceToCenter(0, 100, true );
        System.out.println("Toni jumps");
    }
}

// press A key (aka Left key or BTNleft)
if (RHInput.isDown(RHInput.BTNleft)) {

    if(rhcl.isPlayerOnGround()) {
        toniBody.setLinearVelocity(-5, 0);
        System.out.println("Toni walks left");
    }
    else {
        toniBody.setLinearVelocity(-1, 0);
    }
}

sentences: How to fix cutting corner problem in A-star pathfinding So this is a problem when doing diagonal jumps (checking diagonal neighbor nodes). In 2d it can be prevented by doing some checks, like if up and right is blocked, don't take up-right neighbor for calculations. But in 3d thous check become a bit to much and to tedious.. so if I still want diagonal paths, what could be a good solution?

sentences:
Unity ECS: How do I stop an entity from spawning twice? I am implementing a flight dynamics model using Unity's built-in ECS package, Entities, and I keep running into one particular issue where the aircraft I'm trying to spawn gets converted into an entity twice.
Essentially, I have a singleton Monobehaviour that handles setting up the aircraft entity from a GameObject Prefab. Here's the script:
public class GameManager : MonoBehaviour
{

    private BlobAssetStore blobAssetStore;

    public static GameManager main;

    public GameObject planePrefab;

    public float zBound = 0.0f;
    public float throttleMaxBound = 1.0f;
    public float alphaMaxBound = 20.0f;
    public float bankMaxBound = 20.0f;
    public float flapMaxBound = 40.0f;
    public float throttleMinBound = 0.0f;
    public float alphaMinBound = 0.0f;
    public float bankMinBound = -20.0f;
    public float flapMinBound = 0.0f;

    public State state;
    public Properties prop;

    Entity planeEntityPrefab;
    EntityManager manager;

    private void Awake()
    {
        if (main != null && main != this)
        {
            Destroy(gameObject);
            return;
        }

        main = this;

        manager = World.DefaultGameObjectInjectionWorld.EntityManager;

        blobAssetStore = new BlobAssetStore();

        GameObjectConversionSettings settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, blobAssetStore);
        planeEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(planePrefab, settings);

        SpawnEntity();
    }

    private void OnDestroy()
    {
        blobAssetStore.Dispose();
    }

    void SpawnEntity()
    {
        Entity plane = manager.Instantiate(planeEntityPrefab);

        prop = new Properties(
            16.2f,
            10.9f,
            2.0f,
            0.0889f,        // slope of Cl-alpha curve
            0.178f,         // intercept of Cl-alpha curve
            -0.1f,          // post-stall slope of Cl-alpha curve
            3.2f,           // post-stall intercept of Cl-alpha curve
            16.0f,          // alpha when Cl=Clmax
            0.034f,         // parasite drag coefficient
            0.77f,          // induced drag efficiency coefficient
            1114.0f,
            119310.0f,
            40.0f,          // revolutions per second
            1.905f,
            1.83f,          //  propeller efficiency coefficient
            -1.32f          //  propeller efficiency coefficient
            );

        state = new State(
            0.0f,           // time
            0.0f,           // ODE results
            0.0f,
            0.0f,
            0.0f,
            0.0f,
            0.0f,
            0.0f,           // roll angle
            4.0f,           // pitch angle
            0.0f,           // throttle percentage
            0.0f            // flap deflection
            );

        float3 position = new float3(state.q1, state.q3, state.q5);

        manager.SetComponentData(plane, new Translation { Value = position });
    }

}

After a little bit of commenting here and there, I was able to determine that the following two lines are responsible for creating two separate entities, though the latter is the only one I'm capable of manipulating using the system. It's also worth mentioning that these two entities are virtually identical in the Entity Debugger, except for the fact that the first entity contains the "prefab" tag.
planeEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(planePrefab, settings);

and...
Entity plane = manager.Instantiate(planeEntityPrefab);

Is there a way to spawn this entity without both showing up in the debugger or is this unavoidable? If not, is there a way to remove the entity with the "prefab" tag from the world?
Thanks! :)

sentences:
Unity3d Transfer of value from one script to another Script 1

public class enemy : MonoBehaviour {
    private Vector3 Player;
    private Vector2 PlayerDirection;
    public float Xdif;
    public float Ydif;
    private float speed;
    private float distance;
    private bool stun;
    private float stuntime;
    GameObject playerObj;
    private Rigidbody2D myRigidbody2D;
    private bool isEnemyFear;

    // Use this for initialization
    void Start () {
  stuntime = 0;
  stun = false;
  speed = 6;
  playerObj = GameObject.Find ("Player");
  myRigidbody2D = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    public void Update () {
  distance = Vector2.Distance (Player, transform.position);
  Player = playerObj.transform.position;
  if (stuntime > 0) {
   stuntime -=Time.deltaTime;
  } else {
   stun = false;
  }
  if(isEnemyFear){  //here to pass a value from script 2
   EnemyFear();
  }
  else{
   EnemyAttack();
  }

    }
    void EnemyAttack(){

  if (distance < 25 & !stun) {
   Xdif = Player.x - transform.position.x;
   Ydif = Player.y - transform.position.y;
   PlayerDirection = new Vector2 (Xdif, Ydif);
   myRigidbody2D.AddForce (PlayerDirection.normalized * speed);
   Debug.Log("Attack");
  }
    }

    void EnemyFear(){

  if (distance < 25 & !stun) {
   Xdif = Player.x + transform.position.x;
   Ydif = Player.y + transform.position.y;
   PlayerDirection = new Vector2 (Xdif, Ydif);
   myRigidbody2D.AddForce (PlayerDirection.normalized * speed);
   Debug.Log("Fear");
  }
  StartCoroutine(Timer());
    }

    void OnCollisionEnter2D(Collision2D Playerhit){
  if (Playerhit.gameObject.CompareTag("Player")) {
   stun = true;
   stuntime = 1;
  }
    }
    IEnumerator Timer() {
  yield return new WaitForSeconds(10);
  isEnemyFear = false;
  StopCoroutine ("Timer");
    }

}

Script 2

public class randomizer : MonoBehaviour {

    private bool isEnemyFear;

    public void CheckFear(){
  int rand = Random.Range(0, 100);
  if(rand > 35)
   isEnemyFear = true; //this value should be passed to the script 1
    }

}

How to pass a value isEnemyFear = true from Script 2 in Script 1?

sentences:
Unity Android Immersive mode leaving a black bar in the soft key area? The black bar is not hiding anything. Everything is drawn above it. But the black bar is there in place of the soft keys even when they are hidden.
I don't know how to hide it and render using whole screen.
The bar is only visible with device having soft keys not for device with physical keys.
 I have set the Screen.fullScreen = true.

Unity 2018.3.4f1

sentences:
What makes a shader function with a LineRenderer? A LineRenderer has both Material and Color properties.
But many shaders do not work, ie the line will not respect the Color property, or the line will show black (regardless of the materials having its own color).

For example the Standard, Diffuse, Mobile/Diffuse shaders all show black.  Unlit/Color ignores the LineRenderer color and uses only the Material Color property.  Particles>Additive works great, but Particles>Standard Surface does not.

What part of the shader code is important to make a LineRenderer display using its own Color property?  When it does work, how should shader code decide how to merge between the two colors?

sentences:
NodeJS client gameloop running slightly faster than server gameloop So I'm working on a real time multiplayer game in NodeJs (Client and Server). Both loops handle the same "physics" (movement at a constant rate) and both are running at 40hz or 40 times per second. I am using setInterval on both client and server with a delay of 40ms. The issue is that my server average delta between each tick is ~41 and my client average delta between each tick is ~40. This leads to results like this:

See in the last result, there is a difference of 46 ticks meaning the client is rendering about 1.8 seconds ahead of server time. My first guess on solving this is to sync the client every so often but that would lead to it "teleporting" backwards quite often due to how much it is desyncing.

sentences:
Best way to handle tick-based resource generation in an online multiplayer strategy game I'm building an online multiplayer strategy game. The game has no offline mode and requires syncing up to a server. Part of this game is constructing buildings which will generate resources each second. These resources would be generated whether the player is online or offline.

If this was a purely offline game, this would be easy: get the delta between when the app was closed and when it was opened again and multiply by resources per second and just fast forward everything.

Since it's an online game, and other players can be affected by the resources an offline user has, these calculations have to occur on the backend.

My question is: if I have 10,000 players, each with 20 buildings generating resources on a per second basis, how on earth should I handle 200,000 things all at once and syncing to a database?

sentences: Stop Unity UI Buttons from being clicked when a Facebook Window is overlayed Having an odd issue. When I play with the Facebook SDK for Unity, and the Windows popup like the login window or the Friend Selector window, if I use the mouse to click in the window I end up clicking the Unity 4.6 UI buttons underneath it. Anyone know how to avoid this?

sentences:
TurnBasedGame with libGDX + Google Play Services I'm trying to write a small card game for Android using libgdx framework. My game is turn-based. I wrote to interface with the necessary methods to access the API interface from Google. I faced the problem after I called Games.TurnBasedMultiplayer.createMatch(gameHelper.getApiClient(), tbmc) I got the result of the callback. If initiateMatchResult.getMatch().getData() is null I am initiating games data, and here's the PROBLEM: I don't know how to go back in GameScreen???

This is piece of code in AndroidLauncher:

Games.TurnBasedMultiplayer
                .createMatch(gameHelper.getApiClient(), tbmc)
                .setResultCallback(new ResultCallback<TurnBasedMultiplayer.InitiateMatchResult>() {
                    @Override
                    public void onResult(@NonNull TurnBasedMultiplayer.InitiateMatchResult initiateMatchResult) {
                        if (!initiateMatchResult.getStatus().isSuccess()) {
                            gameHelper.showFailureDialog();
                            return;
                        }
                        TurnBasedMatch match = initiateMatchResult.getMatch();

                        if (match.getData() != null) {
                            Log.d("MyLogs", "match: not null");
                        }
                        initGame();
                        myGame.setScreen(myGame);
                    }
                });

If just call myGame.setScreen(new GameScreen(myGame)) is the GameScreen displaying is not correct. In GameScreen I have table and images in this table and the images displaying is not correct!!!

This code of my GameScreen

public class GameScreen implements Screen {

final MyGame myGame;
private Stage stage;
private Table table;
private Image card1, card2, card3, card4, card5, card6;

public GameScreen(MyGame myGame) {
    this.myGame = myGame;

    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    card1 = new Image(new Texture(Gdx.files.internal("1.png")));
    card2 = new Image(new Texture(Gdx.files.internal("2.png")));
    card3 = new Image(new Texture(Gdx.files.internal("3.png")));
    card4 = new Image(new Texture(Gdx.files.internal("4.png")));
    card5 = new Image(new Texture(Gdx.files.internal("5.png")));
    card6 = new Image(new Texture(Gdx.files.internal("6.png")));

    table = new Table();
    table.setFillParent(true);
    table.setDebug(true);
    table.add(card1).width(140).height(202).padLeft(15).padRight(15).padBottom(10);
    table.add(card2).width(140).height(202).padBottom(10);
    table.add(card3).width(140).height(202).padLeft(15).padRight(15).padBottom(10).row();
    table.add(card4).width(140).height(202).padLeft(15).padRight(15);
    table.add(card5).width(140).height(202);
    table.add(card6).width(140).height(202).padLeft(15).padRight(15).row();

    stage.addActor(table);
}

@Override
public void show() {

}

@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.act(delta);
    stage.draw();
}

@Override
public void resize(int width, int height) {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {
    stage.dispose();
    mySkin.dispose();
    dixit.getScreen().dispose();
}

SCREENSHOT BELOW

this screenshot shows how to display images in my table
Tell me what my mistake and what am I doing wrong? Can anyone advise how best to do otherwise??

sentences:
Biome Transition in a Grid & Borderless World I have a universe: a list of "Systems", each with their own center, type and radius.

A small part of such a universe could look like this:

Systems:

Can be very close to a different system, e.g. overlap
Can be inside another, much bigger system
Can be very far away from any other systems
Spawn system specific entities and particles inside the system radius
Have some properties like background color

So far so good. However, the player can fly around freely, inside and outside of systems, in real time.

How do I interpolate and determine things like the background color now, depending on camera position?

E.g. if you are halfway between a green and a red system you should see a background halfway between red and green, or if you are inside a lilac system near the center and at the border of a green system you should get a mostly lilac background etc.

sentences: Better ways of handling the server for a Multiplayer Browser Based Game I am looking to create a multiplayer browser based game, similar to tribal wars and such, and i'm trying to think of better ways of handling the server, for example when troops and buildings are completed and the landing of troop movements

sentences:
How can I manually call/fire OnTriggerExit() for colliders a trigger is inside of in Unity? In Unity, the OnTriggerExit() method is not called/fired (not sure if it's an event or not) when an object is disabled or destroyed within it's collider. In comparison to it being fired is an active object that was within it's collider no longer being inside the bounds of that collider on the next frame. I want to be able to call OnTriggerExit() on my triggers OnDisable() method as a workaround.

How would I go about calling/firing OnTriggerExit() manually?

sentences:
Tracing a 2d path through multiple gravity fields For a projectile starting at origin O, an initial velocity V, and several stationary planets P[n], how would I pre-calculate and store the path it would take without actually stepping through each frame along the curve?

I have some idea of how to do this for a single gravity source (conic section, parametric curves), but how do you blend multiple forces, and thus multiple curves, together?

The idea is to give the player some idea of the trajectory their shot will take, so it doesn't need to reflect the actual path exactly, but the closer the better.

sentences:
Tile based collision detection errors if player is smaller than tiles I have implemented a tilemap where each tile is at a non-negative x and y position. (So at the moment think like chess)

At the moment a tile is 16, 16 pixels in size

Tile 0,0 is at the left bottom corner

Some tiles should be collidable. I've never implemented something like that and during research stumbled upon: https://jonathanwhiting.com/tutorial/collision/

The general idea + collision response handling:

let mut new_pos = Point2::new(curr_pos.x + x_offset, curr_pos.y);

let collision_on_x = collide_with_world(&new_pos, &world);

if !collision_on_x  {
    transform.translate_x(x_offset);
}

new_pos.y = curr_pos.y + y_offset;

let collision_on_y = collide_with_world(&new_pos, &world);

if !collision_on_y  {
    transform.translate_y(y_offset);
}

The collision detection

fn collide_with_world(new_pos: &Point2<f32>, world: &World) -> bool {
    // TODO make these sizes i16 instead so we can grow in any direction!
    let mut left_tile: u16 = (new_pos.x / TILE_SIZE_IN_PIXELS as f32) as u16;
    // -1 so that we do not collide until we are exactly at the thing
    let mut right_tile: u16 = ((new_pos.x + PLAYER_WIDTH - 1.0) / TILE_SIZE_IN_PIXELS as f32) as u16;
    let mut top_tile: u16 = ((new_pos.y + PLAYER_HEIGHT - 1.0) / TILE_SIZE_IN_PIXELS as f32) as u16;
    let mut bottom_tile: u16 = (new_pos.y / TILE_SIZE_IN_PIXELS as f32) as u16;

    println!("new_pos: {:?}, left {}, right {}, top {}, bottom {}", (new_pos.x, new_pos.y), left_tile, right_tile, top_tile, bottom_tile);

    // Useless as long as we use unsigned coordinates
    //if left_tile < 0 {
    //    left_tile = 0;
    //}

    if right_tile > WORLD_WIDTH_IN_TILES {
        right_tile = WORLD_WIDTH_IN_TILES;
    }

    // Useless as long as we use unsigned coordinates
    //if bottom_tile < 0 {
    //    bottom_tile = 0;
    //}

    if top_tile > WORLD_HEIGHT_IN_TILES {
        top_tile = WORLD_HEIGHT_IN_TILES;
    }

    let mut any_collision = false;

    for i in left_tile..=right_tile {
        for j in bottom_tile..=top_tile {
            let tile = world.get_tile(i, j);
            println!("tile at {:?} is {:?}", (i, j), tile);

            match tile {
                Some(tile) => {
                    if tile == WALL {
                        println!("hit a wall at {:?}!", (i, j));
                        any_collision = true;
                    }
                }
                None => (),
            }
        }
    }

    return any_collision;
}

I basically took (or tried to take) the optimised version of the linked blog-entry.

Now to the problems:

If PLAYER_WIDTH and PLAYER_HEIGHT are both 16.0 - collision works fine

But note that I had to put -1.0 in the calculation of the right_tile and top_tile, else the collision for UP and RIGHT would occur one pixel to early (so the player would never touch walls to their top or right)

This change alone makes me a bit suspicious - looks like I made an error there.

The real problems start if the player is smaller than a tile:

In the following screenshots the following rules apply:

*) the PLAYER_WIDTH and PLAYER_HEIGHT are both 8
*) Greenish tiles are the only walls!
*) All the screenshots were taken in ONE run - no parameters were changed during this run!

1)  -> Trying to collide with right tile -> overlapping
2)  -> Trying to collide with top tile -> cannot go any nearer than 4 pixels (half the height of the player)
3)  -> Trying to collide with left tile -> cannot go any nearer than 4 pixels (half the width of the player)
4)  -> Trying to collide with top tile -> suddenly overlapping although different tile didn't collide?
5)  -> Trying to collide with bottom tile -> cannot go any nearer than 4 pixels

I cannot grasp 2 and 4 at the moment.

sentences:
Health zone heals player but I have a problem Hello I am creating a special health zone that gives the player health and my current scripts health is going up super fast and I want it to go up by 2 hp per second. How would I do this?
Here is the health zone script.
{
    public PlayerHealth playerHealth;
    public float healthGain = 2f;

    void OnTriggerStay2D(Collider2D other)
    {
        if (playerHealth.currentHealth < playerHealth.maxHealth)
        {
            playerHealth.currentHealth += (int)healthGain;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }

        if (playerHealth.currentHealth >= playerHealth.maxHealth)
        {
            playerHealth.currentHealth = playerHealth.maxHealth;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }
    }
}

sentences:
2D Quads : Translation with OpenGL ES 2.0 on Android I have a simple 2D engine that renders 2D textured quads, and right now I can scale the quad or rotate it, but when I try to translate it I have a strange distortion (the quad is squashed in the half left part of the screen with an infinite perspective effect), here's the code :

private final float quad_vertex[] = {
-0.5f, 0.5f, 0.0f,   // top left
-0.5f, -0.5f, 0.0f,  // bottom left
0.5f, -0.5f, 0.0f,   // bottom right
0.5f,  0.5f, 0.0f    // top right
};

final float left = -width/2.0f;
final float right = width/2.0f;
final float bottom = -height/2.0f;
final float top = height/2.0f;
final float near = 0.1f;
final float far = 200.0f;

Matrix.orthoM(projection_matrix, 0, left, right, top, bottom, near, far);
Matrix.setLookAtM(view_matrix, 0, 0, 0, 1.0f, 0.0f, 0f, 0f, 0f, 1.0f, 0.0f);

...

Matrix.setIdentityM(model_matrix, 0);

Matrix.scaleM(model_matrix, 0, scale_width, scale_height, 1.0f);
Matrix.translateM(model_matrix, 0, x, 0, 0);
//Matrix.rotateM(model_matrix, 0, x, 1, 0, 0);
x = x + 1.0f;

Matrix.multiplyMM(viewprojection_matrix, 0, projection_matrix, 0, view_matrix, 0);
Matrix.multiplyMM(modelviewprojection_matrix, 0, viewprojection_matrix, 0, model_matrix, 0);

So, any idea what is the problem ? Thanks in advance :)

sentences:
Combining Many Small Colliders into Larger Ones I am creating a game using a tile-map made of many thousands of grid squares. At the moment, each square has a square collider on it for checking collisions.

However, with many thousands of tiny blocks, checking them all for collisions is inefficient. If I had known the tilemap was going to look like this in advance, I could have just used 3 or 4 big colliders rather than thousands of tiny ones:

Is there some sort of standard algorithm for combining many small adjacent tiles into maximally large ones? If so, could someone describe it here, or point to literature on such algorithms?

Alternatively, maybe pre-processing the tile colliders in this way is completely the wrong approach. If so, what is the correct one to deal with the efficiency of an extremely large number of colliders?

sentences:
Separating Axis Theorem is inconsistent I recently implemented the SAT algorithm into my 2D game and at first it appeared to be working fine. However, when I move around and rotate the character in and out of the wall tiles, there are some angles and positions that do not register as a collision when the player and wall tile are clearly overlapping. I created my own RotatingRectangle class that rotates around the player and is the bounding box.

I am unsure what could be causing this, or if this is just natural SAT behaviour and it does not actually detect all collisions accurately? There are no other resources online for inconsistent SAT collision detection so I am lost. I will post my code for the projections and actual collision detection in case I made a silly mistake somewhere

    // Returns an array of projections, one onto each axes
    public Vector2[] ProjectOntoAxes(List<Vector2> points)
    {
        Vector2[] projections = new Vector2[2];

        for (int i = 0; i < Axes.Length; i++)
        {
            float max = float.MinValue;
            float min = float.MaxValue;

            for (int j = 0; j < points.Count; j++)
            {
                float res = Vector2.Dot(Axes[i], points[j]);

                if (res < min)
                {
                    min = res;
                }
                else if (res > max)
                {
                    max = res;
                }
            }

            projections[i] = new Vector2(min, max);
        }

        return projections;
    }

        private bool PlayerTileCollision(Tile tile)
    {
        // Check overlap on projections onto player axes
        Vector2[] projections = Player.BoundingRect.ProjectOntoAxes(tile.BoundingRect.Corners);
        for (int j = 0; j < projections.Length; j++)
        {
            if (Player.BoundingRect.Projections[j].X > projections[j].Y ||
                Player.BoundingRect.Projections[j].Y < projections[j].X)
            {
                // No overlap can exit
                return false;
            }
        }
        // Check overlap on projections onto tile axes
        projections = tile.BoundingRect.ProjectOntoAxes(Player.BoundingRect.Corners);
        for (int j = 0; j < projections.Length; j++)
        {
            if (projections[j].X > tile.BoundingRect.Projections[j].Y ||
                projections[j].Y < tile.BoundingRect.Projections[j].X)
            {
                // No overlap can exit
                return false;
            }
        }

        return true;
    }

UDPATE:
I have added code to visualise the projections and axes to see what is going on, and it appears that the projection code is not properly selecting the correct minimum and maximum values. I will try to figure out why now. (Purple lines are player projections and orange is the projections of that tile I am standing on, the top left one and the player axes can be visualised via the white lines at the origin)

sentences:
Shader works in Editor but not on iPhone I am using the next script for a painting asset found on this website.

As you render the faces of your mesh in the uv space of the mesh, you are reconstruction the islands one triangle at the time. On the edges of the island, it can be that due to underestimation the rasterizer doesn’t consider a pixel which is actually in the island. For these pixels, no pixel shader will be executed and you will be left over with a crease. (text and image taken form the website)

The basic idea is that every frame, after the paint texture has been updated, I run a shader over the entire texture, and using a filter and a pre baked mask of the uv islands, extend the islands outwards.

The problem is that it does not work on iPhone. There is no error, no weird coloring, it is like that script does not get applied. I am not sure where the problem is coming from..maybe the for loops or the command buffers used in c#.

Shader "Unlit/FixIlsandEdges"
{

    SubShader
    {
        // =====================================================================================================================
        // TAGS AND SETUP ------------------------------------------
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass
        {

        // =====================================================================================================================
        // DEFINE AND INCLUDE ----------------------------------
            CGPROGRAM
            #pragma  vertex   vert
            #pragma  fragment frag

            #include "UnityCG.cginc"

            // =====================================================================================================================
            // DECLERANTIONS ----------------------------------
            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv      : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv      : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

                    sampler2D    _MainTex;
            uniform    float4        _MainTex_TexelSize;
                    sampler2D   _IlsandMap;

            // =====================================================================================================================
            // VERTEX FRAGMENT ----------------------------------
            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv     = v.uv;
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {

            fixed4 col = tex2D(_MainTex, i.uv);
            float map  = tex2D(_IlsandMap,i.uv);

            float3 average = col;

            if (map.x < 0.2) {                                    // only take an average if it is not in a uv ilsand
                int n = 0;
                average = float3(0., 0., 0.);

                for (float x = -1.5; x <= 1.5; x++) {
                    for (float y = -1.5; y <= 1.5; y++) {

                        float3 c =  tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy*float2(x, y));
                        float  m =  tex2D(_IlsandMap, i.uv + _MainTex_TexelSize.xy*float2(x, y));

                               n += step(0.1, m);
                         average += c * step(0.1, m);

                    }
                }

                average /= n;
            }

            col.xyz = average;

                return col;
            }
            ENDCG
        }
    }
}

I've read somewhere that using tex2D in for loops is a big no no, so I changed that to a tex2Dlod but the same thing happens.

You can check out the Git project here

I am completely lost on this one and google isn't very helpful. Thank you for any comments.

sentences: Finding physical gamejams I'm interested in participating in some gamejams and was hoping to be able to attend one in person. Is there a way I could search for gamejams in the general Dallas area?

sentences: Inclusive vs Exclusive voxel bounding box Let's say I have a few voxel at (1,1,1) and (2,2,2), I would like to know if would be better to consider that the smallest box that contains both voxels is either (1,1,1) to (2,2,2) or (1,1,1) to (3,3,3). That is to say is it more correct to make the box contains the lower point of the voxels or the voxels as cubes inside the box?

sentences:
How can I create a walking zone logic for my player? First I will show a screenshot and explain the logic I think of and what I'm trying to do :

In the diagram the circle is the player the big rectangle is the zone area for increase/decrease speed movement of the player and the small black rectangle is the target.
What I'm trying to do is to add some rules for this case.
I'm controlling the player in third person movement with the keys WSAD and the mouse to rotate around looking around. This is the player structure screenshot in the Hierarchy :

There are few rules I'm trying to set for the player in this specific situation in the game and I want to make it generic so I can add the rules or create this behaviour in any place in the game when I need to.
The idea is when the player is getting inside the green zone rectangle facing the target make the player slow down to stop smooth. The green zone is the distance from the target to start slow down only if the player is facing the target.
If I rotate the player back facing away from the target in the green zone at any time increase the player speed back to normal speed.
The idea is that if in the green zone I rotate the player at any time and move hi he will decrease/increase the movement speed. Facing target decrease slowly to stop facing away from target increase the speed slowly to normal.

sentences: Canvas Element Not Render In Proper Position I don't know what's going wrong. The Text and Slider must be on the red square area. Anyone can help to determine this bug ? Thanks

sentences:
How do you de/serialize a monobehaviour class? It seems JsonUtility.FromJson does not work for MonoBehaviour classes (and I can't get Newtonsoft to parse strings to Vector3s)
Suppose you have a MonoBehaviour class like this (so that the values can be easily specified in inspector in editor)

public class PropertyClass:MonoBehaviour{
  public Vector3 location;

  public string name;
}

Suppose you have json data downloaded as a string called text, that you try to convert to PropertyClass[] format via using an JSONHelper around JSONUtility.FromJson(text);
How do you have it autopopulate?
If you specify a FromJsonOverwrite solution - how do you have that work with JSONHelper?
using System;
using UnityEngine;
using System.Collections;

public static class JSONHelper
{
    public static T[] FromJson<T>(string json)
    {
        Wrapper<T> wrapper = UnityEngine.JsonUtility.FromJson<Wrapper<T>>(json);
        return wrapper.Items;
    }

    public static string ToJson<T>(T[] array)
    {
        Wrapper<T> wrapper = new Wrapper<T>();
        wrapper.Items = array;
        return UnityEngine.JsonUtility.ToJson(wrapper);
    }

    [Serializable]
    private class Wrapper<T>
    {
        public T[] Items;
    }
}
```

sentences:
How to achieve the top-down (oblique) projection of textures using an OrthographicCamera? This question is related to (How to calculate the initial velocity of projectile motion by a given distance and angle from point A to B) question.

Details

In the below image is the graphical projection of top-down (oblique).

And this is the pattern that I used to reference.

Currently

From the answer, the Coordinate systems describes how the oblique projection works.

screenPos.x = (worldPos.x - cameraOffset.x) * zoomFactor;
screenPos.y = (worldPos.y + worldPos.z - cameraOffset.y) * zoomFactor;

From the related question, currently the camera that I'm using is OrthographicCamera.

Additional question

In the above GIF animation, do I need to customize OrthographicCamera class to achieve the oblique projection? Or do I need to create a new ObliqueCamera class that extends Camera? (If yes, what pointers do I need to review to be able to do it, because I am new to graphical projection).

sentences:
Mobu: Motion Files Naming Scheme for Unity When exporting takes as several fbx files in Motionbuilder 2014 with File > Motion File Export..., the files are named like so:

file_Take1.fbx
file_Take2.fbx
file_Take3.fbx

In order for the motion files to be loaded into Unity correctly, I have to rename them to:

file@Take1.fbx
file@Take2.fbx
file@Take3.fbx

Having to replace underscores with '@' is fine for small projects but can become time consuming when working with many takes in large projects.
Is there a way to change the default naming scheme in Motionbuilder, through preferences or python scripting, so that the default underscore is replaced with an '@'?

sentences:
Setting Camera's Viewing parameters manually I am working on Context-aware camera in Unity. in this project i have to set parameters of the camera each frame manually depending on what camera sees on the screen. New View (v) direction is given and Up (u) and Right (r) vectors should be such that they minimize torsion with previous frame's u and r. I have deployed the following code to accomplish the given task:

 Vector3 viewNew = -m_Normal;
 Vector3upNew=Vector3.Cross(viewNew,m_CameraPrevTransform.right).normalized;
 Vector3 rightNew = Vector3.Cross(viewNew, upNew).normalized;
         ...
 transform.forward = viewNew;
 transform.up = upNew;
 transform.right = rightNew;

The problem is: it seems like Unity tries to automatically adjust parameters when one of the directions (up, forward, right ) are set. Is there a workaround ? is it possible to get more control of the camera?

sentences:
Alternative path not working I am using Android studio (libGDX), and I can't figure out why alternative paths doesn't work. I've tried it as it said in the book, but it doesn't do anything, it shows a black window and than the program exterminates.
If the .png file would be in the .../android/assets/ folder, it wouldn't work either.

Book: Java Game Development with LibGDX 2nd edition

This is what the book wants me to do it:

public Spaceship(float x, float y, Stage s){

    super(x,y,s);
    loadTexture( "assets/spaceship.png" );
    setBoundaryPolygon(8);

    setAcceleration(200);
    setMaxSpeed(100);
    setDeceleration(10);
}

This is the shortest form that works for me:

public Spaceship(float x, float y, Stage stage) {

    super(x, y, stage);

    loadTexture("core/src/com/dusi/game/ch04/assets/spaceship.png");
    setBoundaryPolygon(8);

    setAcceleration(400);
    setMaxSpeed(200);
    setDeceleration(20);
}

This is what my path looks like:

sentences: Oculus Rift DK1 and DK2 compatability issues For a project I need to make a multiplayer game using Unity and the Oculus Rift. My project works fine with the DK2 but it turns out the second rift is a DK1 and it won’t work with Unity. I was thinking the best way forward would be to use an older version of the Oculus Runtime and Unity. Does anyone know what versions of Unity and the Runtime I need to have both the DK1 and DK2 work with Unity?

sentences:
Bitwise operators in DX9 ps_2_0 shader I've got the following code in a shader:

// v & y are both uints
nPixel = v;
nPixel << 8;
nPixel |= y;

and this gives me the following error in compilation:

shader.fx(80,10): error X3535: Bitwise operations not supported on legacy targets.
shader.fx(92,18): ID3DXEffectCompiler::CompileEffect: There was an error compiling expression
ID3DXEffectCompiler: Compilation failed

The error is on the following line:

nPixel |= y;

What am I doing wrong here?

sentences:
Where does the Game class come from in the DrawableGameComponent constructor? I'm making a project to Windows Phone using Silverlight + XNA, but I don't know how I can use the DrawableGameComponent because the constructor requires a Game class, it looks like this:

Planet.cs

class Planet : DrawableGameComponent
{
    public Planet(Game game): base(game){

    {
}

but in my first page of Silverlight and XNA project not is a Game class it's this:

GamePage.xaml.cs

public partial class GamePage : PhoneApplicationPage
{
   ...
}

Where do I find the Game class to pass into the DrawableGameComponent constructor?

sentences:
Efficient Collision detection for polygons (fleet) in an RTS I'm trying to make an RTS for android using libgdx. I would like to have collision detection to be able to detect ships inside the range of weapons and collision between my bullets and the ships.

So far my strategy has been to use a PM QuadTree that I coded myself to store every segment of every polygons. A polygon being the hitbox of a ship.

Every frame I clear and add all the segments back in the quadtree. Every segment has a reference to the ship it belongs to. When I add a ship, I add it recursively to the nodes of the quadtree based on the intersection with the bounds of a node.

Detection collision is done by polling every polygon inside a rectangle that look into every node that fit entirely or partially inside the rectangle.

My problem is that adding every ship every frame gives bad result on Android. On Desktop it is fast enough but on Android it can takes up to 100 ms just to add around 200 segments.

Is there something wrong with my implementation (it shouldn't be this slow ?) or should I use another strategy for collision detection ? I thought about clearing the quadtree only every 5 frames but it would make the detection unprecise.

I have measured that some simple math operation to calculate intersection takes up to 50 more times on my android and I'm not sure why. Surely my phone cpu is not 50 times slower than my laptop, is it ?

It's a sufficiently fast moving RTS. Often the whole fleet is moving, thus every segment.

I heard about RDC in that article. Would that be a better algorithm ? My issue is that some ships are hard to be bounded by a sphere if they're very long but not wide.

sentences:
Get all OffMeshLink objects in Unity What I'm trying to do is to make an edit-mode script that gets all off-mesh links and makes some of them bi-directional(depends whether a jump is possible).

My (obvious) attempt was:

FindObjectsOfType<OffMeshLink>();

However, it returns only the links I have created manually.

My question is the following: how to access the off-mesh links generated by unity in the baked NavMesh?

Any help would be greatly appreciated.

sentences:
How do i make floors of varying height in OpenGL? So I am currently working on a small Game(/engine) in OpenGL and I want to build a little world editor. Nothing too fancy: Just some functions to add objects to a scene and manipulate them (rotation, translation etc). Up to now I have everything set up for loading models into the scene and setting up simple directional- and pointlights.

But one thing has been bugging me since the start: What is an average floor / ground made out of? I would guess that, for exmaple, a grass floor is just a lot of vertices / faces with a grass texture wrapped on them. But how are those textures connected and how can you change the elevation for certain vertices to create hills?

I am essentially asking how the recommended implementation of floors is in 3D environments (preferrably OpenGL 3.3) since I can't find anything on that topic on Gergl.

sentences:
Get number of sides of a shape created with LineRenderer in Unity In my game I'm using LineRenderer to draw a line at every mouse click.

As you can see, everytime the lines collides with itself it creates a new shape.

I'm able to detected position using an EdgeCollider that I update everytime I add a position to the LineRenderer.

This is my code:

    private LineRenderer lineRenderer;
private Vector3 target;
private int currentIndex;
private bool hasTarget;
private EdgeCollider2D edgeCollider2D;
private List<Vector2> edgeColliderPoints;

void Start ()
{
    lineRenderer = gameObject.GetComponent<LineRenderer>();
    edgeCollider2D = gameObject.GetComponent<EdgeCollider2D>();
    currentIndex = 0;
}

// Update is called once per frame
void Update ()
{
    var position = lineRenderer.GetPosition(currentIndex);
    if (hasTarget && target != position)
    {
        var currentPosition = Vector3.MoveTowards(position, target, targetSpeed * Time.deltaTime);
        lineRenderer.SetPosition(currentIndex, currentPosition);

        CheckDetection(currentPosition);
    }
    else
    {
        hasTarget = false;
    }

    if (Input.GetMouseButtonDown(0) && !hasTarget)
    {
        target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        target.z = 0;
        hasTarget = true;
        currentIndex++;
        lineRenderer.positionCount++;
        lineRenderer.SetPosition(currentIndex,position);
        edgeColliderPoints.Add(transform.InverseTransformPoint(position));
        edgeCollider2D.points = edgeColliderPoints.ToArray();
    }
}

private void CheckDetection(Vector3 currentPosition)
{
    lineRenderer = gameObject.GetComponent<LineRenderer>();

    var hit = Physics2D.Linecast(currentPosition, target);

    if (hit.collider != null)
    {
        print("Hit " + hit.collider.name + " at point " + hit.point);
    }
}

What I want to do is get the number of sides of every shape that is created after a collision.

How can I do that ?

sentences:
XNA C# Platformer - physics engine or tile based? I would like to get some opinions on whether I should develop my game using a physics engine (Farseer Physics seems to be the best option) or follow the traditional tile-based method.
Quick background:

It's a college project, my first game, but have 4 years academic programming experience
I just want a basic platformer with a few levels, nothing fancy
I want a shooting mechanic, run and gun, just like contra or metal slug for example
Possibly some simple puzzles

I have made a basic prototype with Farseer, the level is hardcoded with collisions and not really tiled, more like big full-screen sized tiles, with collision bodies drawn manually along the ground and walls etc. My main problem is I want a simple retro feel to the jumping and physics, but because it's a physics simulation engine, it's going to be realistic, whereas typical in air controllable physics for platformers aren't realistic. I have to make a box with wheel body fixture under it to have this effect, and it's glitchy and doesn't feel right.
I chose to use a physics engine because I tried the tile method initially and found it very hard to understand. The engine took care of a lot things to save me time. Being able to do slopes easily was nice, as was the freedom to draw collision bounds wherever I liked, rather then be restricted to a grid. This also gave me more freedom for art design.
In conclusion, I don't know which method to pick. I want to implement this in the most straightforward way, so it won't give me a headache later on. Preferably, a method which has an abundance of tutorials and resources so I don't get "stuck" doing something which has been done a million times before!

sentences:
Unity multiplayer (online) - How to connect to a 'Client-Host' without using Unity Paid Service I'm slightly annoyed with the official Unity guides here, because I have been following through some, and they have indeed helped me create a local network mulitplayer situation. However, at no point did they mention that using these methods (ie. UnityEngine.Networking // NetworkManager // NetworkManagerHUD // NetworkIdentity) will require me to pay Unity for Pro, and a monthly server usage fee, if I wanted to play via internet.

I've set up my own Rust server in the past and it was very simple. I just installed a Rust Dedicated Server on my desktop PC (which I have fibre internet connection) and ran the server. I could then have 20 people playing with me and we didn't notice any slow-down or lag or any problems with it. (Rust is made in Unity I believe)

I've tried searching lots on this matter, and there are many many differing voices of how I can do this (many out-of-date, and many explicitly stating its impossible without hiring a server) - I disagree, and think I can make my desktop run the server, BUT I haven't a clue if I'm correct and also how I would be able to make it.

Unity docs seem to be trying to hide this solution if it exists (perhaps I'm being paranoid).

I have the NetworkManagerHUD all working and can play locally as I say.

So, it appears that the NetworkManager allows a user to start my game in 'Client-host' mode, it also allows another instance elsewhere to click "Connect Client" and has a space for IP address.

Would I even need a dedicated server if a player has clicked to start as 'Client-Host'? assuming I don't, how can I then connect to this host from another machine? Does typing the client-hosts external IP allow this?

Sadly, I don't have anybody to help me test this right now.

If a dedicated server version is the preferable way to go, could anybody please help me in the direction of how to start creating this?

For info: The game at this stage is a very simple FPS shooter. The NetworkManager is assigning the 'isLocalPlayer' flag correctly to one instance of the player object. I see in the Editor Hierarchy that it is handling the game overall and has two player objects once I have logged in with two instances locally.

sentences:
How to create reel/slider with mobile controls How can I create a reel/slider with mobile game controls so that it looks something like this?

The slider is normally non visible, and can be accessed if I slide my finger from the right side of the screen to the left. The slider allows me to switch my current weapon and use items in my inventory.
This is my current setup in Unity.

I can figure out the inventory portion of the slider, as there are many tutorials out there on an inventory system, and how to make the slider move based on touch, using something similar to a mobile joystick script, but I can't figure out how to make the slider so that it:

Can "jump" from icon to icon (not have the slider be completely fluid/prevent it from stopping in-between item icons)

Detect what item/slot the slider is currently on (in the case of the example, the item that will be used is the icon in the center of the screen.

Make the icons more transparent the further away it is from the icon in use (I'm guessing that I would have to set the alpha channel value in the color settings of the item to a lower value, but I'm not sure how to detect the icon in use and count how many icons away the other icons are from the one in use.

sentences:
Move an object by rotation AS3 I am currently trying to move an object (a square) around the stage in 2D space. Think Cuboid but in 2D platformer space, and vertical walls as well as the ground.

The idea is that during each rotation, if any collision occurs, I want the block to move onto that square.

For example, if the "player" is moving left, and there is a wall directly in front of him, he will hit the wall and start to move up the wall instead of on the ground.

There will be edge cases of the player moving left, no block directly in front of him, but a block one width and height to the left of him. I.E. there is a block diagonally up-left of the player, so when the player moves once more to the left, he will collide with the block during the rotation. When that happens, I want to continue the player's movement up the wall as well.

Below is the code of how I am rotation the object and moving it. I do not want to rotate the object around it's center point and move it at along a constant speed. It looks better moving the object with the rotation.

The questions are:

a) Is there a better way to accomplish what I am trying to do (I'm sure there is).

b) Is there a way to get the positions of each corner while the object is rotating? How I am currently doing it, the only static point is always the bottom left of the player. Since I rotate around that point, and when the rotation has rotated a full 90 degrees, I scaleX and move the object to the new position. So the registration point is always at the bottom left.

Object info: blocks and the player are both 16x16. Their registration points are bottom left.

Game info currently: I just have the player bouncing between the stage boundaries. Hence the moveLeft boolean checks.

if (moveLeft){
    rotation -= moveSpeed;
    if (Math.abs(rotation) >= 90){
        if (x == 16){
            moveLeft = false;
            scaleX *= -1;
        }
        else{
            x -= 16;
        }
        rotation = 0;
    }
}
else{
    rotation += moveSpeed;
    if (Math.abs(rotation) >= 90){
        if (x == 624){
            moveLeft = true;
            scaleX *= -1;
        }
        else{
            x += 16;
        }
        rotation = 0;
    }
}

If you need anymore information, please let me know. I hope I explained the situation sufficiently.

sentences:
Combat numbers in an MVC Bear with me this will take some explaining...

I'm trying to design my game as close to Model-View-Controller design principles as possible. At least in and so far as I understand those principles.

I have two relevant classes in my View and Model respectively (with an irrelevant-in-this-case playerInput class acting as the controller)

BattleSerializable (My model that handles battle logic)
BattleView (My view that handles battle display stuff)

BattleSerializable has a method called DoDamage that subtracts health from a player. BattleView has a method DoDamageView that calls the model's method (DoDamage) and then renders a number on the screen to indicate the amount of damage done.

So far so good.

But there's a friendly fire penalty! In the sense that if you do damage to an ally, you also take damage.

Ok, so now I can go one of three ways:

1) My BattleView can handle the friendly fire logic and call the DoDamage method twice in the case of a friendly fire occurrence, but this goes against what "View" is supposed to do. It doesn't make sense that BattleView should handle friendly fire logic. It should handle view logic only.

2) My BattleSerializable class can handle the friendly fire logic, but now I have to return a complex custom return object instead of a simple integer to handle all the state that changed. This seems needlessly complex or, at the very least, in-eloquent.

3) Instead of calling my model method from the view method, I could have the model run independently and, from the view, "poll" the Model every frame for changes and then render combat numbers if a change is detected. This seems inefficient and in-eloquent to me as well.

What is the preferred way to design this?

sentences:
Implementing my own UI sprite class in Unity using shaders: where and how to position the sprites For learning purposes, I am trying to implement my own UI classes in Unity "from scratch", in the GPU using shaders. I mean, I am trying to use simple 2D sprites either positioned via shaders or created within the geometry shaders. These sprites should be, of course, displayed above all else.

I know how to create or translate the sprites within the shader. However, I am struggling with a couple of conceptual issues:

1) where exactly, relative to the camera (or to the near frustum plane), should the UI sprites be positioned? I man, thinking of the Z axis as being the camera.forward, what is the correct default distance to display the sprites at (assuming that at that location, the sprite texture would be the closes to its correct 100% zoom scale).

2) for the correct positioning+rotation, would it just be the case of, every frame, calculating in the shader such correct world position of the sprite in relation to the camera/near frustum plane, and then making the sprite rotate towards the camera? Or is there a better way of doing that, i.e. disregarding world position at all and going directly for the screen position of the sprites within the shaders, since the final step of shaders is to paint the pixels in screen-space?

Thanks for your suggestions!

sentences:
Consistency of DirectX models Is there a way to check the consistency of a DirectX model (.x) ?

Whilst compiling .x files with XNA GameStudio 3.1 compilation is aborted with the following error message:

Error  2   Could not read the X file. The file is corrupt or invalid. Error code: D3DXFERR_PARSEERROR. C:\WFP\Browser\Content\m.x  KiviBrowser

Some models compile correctly without any error/warning and some abort as described. The files of each model have several thousand lines.

I am creating the files in Googles SketchUp 8 where they all look fine and don't show any sign of corruption.

Suppose I have such a model my XNA compiler won't compile because their is an inconsistency somewhere in the file - how could I identify this in order to correct it ?

sentences:
Separate renderng thread in Android (OpenGL ES 2.0) I'm used to mainly working with the Canvas SurfaceView API on Android and have recently been learning openGL ES 2.0

With canvas I know that surfaceView gives you the ability to start a new thread to render on, but it doesn't specifically do this for you, so I was creating a new thread and managing that thread when the app was ended / paused etc....

However, from what I've read with glSurfaceView it seems that this is actually done for you automatically? Does this mean I don't actually need to manually create / start and manage my own rendering thread? (I'm talking specifically about a rendering thread (which could also be used for logic updates) which is separate the main UI thread.

Clarification on this matter would be greatly appreciated.

sentences: Do retail games use "inversion of control" and "dependency injection"? Many of the more diligent software developers I know are moving to inversion of control and dependency injection to handle references to objects. Coming from a Flash games perspective I don't know all the ins and outs of AAA studios, so: are these used in the retail game world?

sentences:
What is the best way to avoid colorblind issues? About 5-10% of males have some form of colorblindness.  What's the best way to ensure you are not turning away 5-10% of your male population from your game?

Just to note colorblindness does not mean people see in black and white.  It usually means they see less green and get red/green confused easily.  Colorblindness comes in degrees.  Some forms are mild some are extreme.

sentences:
Unity - 3D Sound sounds weird if audio listener is moving fast If you place 3D Sound which is set to logarithmic falloff and move very fast, then it sounds extremly weird and plays way faster than normal. How can I prevent this?

I made a short video:
https://www.youtube.com/watch?v=-bZJ7YS775E&feature=youtu.be

sentences:
What is the best way to limit player movement? I'm currently programming a 2d game where the player moves around on a rectangular playing field. The player has a direction and a velocity. What is the best way to limit the player's movement so he/she cannot move past the boundaries of the playing field?

Thanks,

DLiKS

sentences:
Retrieve variable from another class and send to another scene in Unity Sorry for asking a noob question, but I have never used c# in Unity, only unityscript.

Basically I have a public int score variable stored in Players Class.

I need to retrieve it in the following method:

void OnTriggerEnter(Collider c)
{
    if(c.tag == "PlayerCollision")
    {
        if(!c.gameObject.transform.parent.gameObject.GetComponent<Player>().isDead)
        {
            Debug.Log("Hit");
            //Load next scene
        }
    }
}

How can I retrieve the score variable in this method below and send the variable to the next scene? (In unity script I had to do something like Application.LoadLevel(1); after of course building the scene as levels. Thanks

sentences:
How can I load raw Bayer images using OpenGL? I want to load a raw Bayer format image and convert it to RGB using OpenGL.

So far I have played around with glTexImage2D() and loaded a Bayer image as a monochrome texture. My question is: how can I do per-pixel operations on this texture so that I can convert it to an RGB image?

sentences:
Drawing beam effect in UDK? I'm having trouble drawing a particle effect between two actors in UDK - Both the source and the target are not static objects, so as far as I can tell I need to do it in the code not in kismet. Here's what I've got at the moment and it seems to not be doing anything at all. Ideas?

BeamEmitter[0] = new(self) class'UTParticleSystemComponent';
BeamEmitter[0].SetAbsolute(false, false, false);
BeamEmitter[0].SetTemplate(BeamTemplate[0]);

BeamEmitter[0].SetTickGroup(TG_PostUpdateWork);
BeamEmitter[0].bUpdateComponentInTick = true;
self.AttachComponent(BeamEmitter[0]);
BeamEmitter[0].SetBeamEndPoint(2, tarPos);
BeamEmitter[0].ActivateSystem();

sentences:
Longest path algorithm for roguelike maze generation I have a simple grid-based map composed of rooms, like this (A=entrance, B=exit):

   0 1 2 3
  #########
0 #B# #####
  #########
1 #   ### #
  #########
2 # #     #
  # #     #
3 # #     #
  #########
4 # ###   #
  #########
5 ###A    #
  ###     #
6 ###     #
  #########

And I'm stuck trying to make a suitable algorithm to create a path of doors between the rooms, in such a way that the player has to explore most of the map before finding the exit.

In other words, I'm trying to find the longest possible path from A to B.

(I'm aware that this problem can be solved for acyclic graphs; however, in this case there can be cycles.)

EDIT: Another example where rooms are connected using floodfill, and the exit is chosen as the farthest room from the entrance:

   0 1 2 3
  #########
0 #B#     #
  # #-#####
1 # | #   #
  ### #   #
2 ### #   #
  ###-#-###
3 #   | ###
  #-#######
4 #A|     #
  # #     #
5 # #     #
  # #     #
6 # #     #
  #########

Note that the path to the exit is not the longest possible path at all.

sentences:
Essentials for building a RTS I was wondering if anyone had any links to good reads or books in regards to things to think about when developing a RTS game, I would have been reading things like this and this but would like to read more into it.

Also I have development experience and soon would like to start building the skeleton myself but if anyone has any additional articles about the process (not in programming, but more on planning) that would be great help.

sentences: How is scripting done in games such as Zelda? How do games implement their triggers and events that make up the plot of the story. For example, to be concrete how would one implement the story of a game such as The Legend of Zelda: A Link to the Past. I'm assuming there is some kind of scripting that somehow hooks into the game world state? I know absolutely nothing about scripting and game development. And have no clue how the underlying code would be architected in terms of classes, data structures, design patterns, etc.

sentences:
What is a good way to code dialogue creation? I'm thinking of making a single method/class/something that will handle my dialogue in the game. AKA, something like:

Main text:

Choice 1
Choice 2

So I want a method that will able to put different strings into the main text section and also different strings into the Choice options. I've been thinking about solutions, and so far I've come up with just a simple method that accepts parameters for main text, choice1 and choice2 -- problem being that the strings called will be quite long and I think it looks a little clumsy? Also I won't want to have 2 choices every time, OR I want to have multiple "pages" of dialogue show up before you need to take an action. This would require me to overload methods which may turn out quite ugly?

So yeah I don't have a lot of experience with this and method overloading is all I've thought about for now. I've given thought to interfaces/abstract classes but I'm not entirely sure if they're even relevant for what I want to do. Any thoughts?

sentences:
(Why) Should I choose Unity 3 or Cocos2d (or something third) for my app? My colleague and me made an HTML 5 iPad game ( http://braille.gandzo.com/ ) and we would like to upgrade it, and our framweork is not enoguh, for what we want. Some of the things we would change are: graphics update, animations/"effects", multi-player, achievements and so on. The game would stay 2d. Now, as far as I understand, both Unity and Cocos would be good for this task, with Unity having the advantage of being multi-platform.

What I want to know is are there unknown qualites/"flaws" to these two programs which would influence my decision (maybe even by choosing something else). Examples that come to mind are "Unity is too complicated/has too much unneeded options/hoops because it's made with 3d in mind" or "Cocos is significantly more suited for 2d games".

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

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

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

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

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

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

sentences:
How do I better organise rendering in an entity component system? I'm developing an isometric RPG, with 3D characters in 2D level. I was using a standard object orientated programming paradigm, but was faced with a lot of issues. Recently, I learned about entity component systems, and am currently rewriting my engine using this paradigm.

I use OpenGL, and have two rendering systems - one for drawing in 2D, and one for drawing in 3D. Each system consists of one VBO id, with the appropriate geometry, shader program id, id of texture unit binded to the texture atlas (which accommodates all tilesets or all model textures) and other information like that. The alternate systems provide different logic for drawing in 2D and 3D.

When it comes to the components for these systems, I am stuck.

Say I have component, defined by the buffer offset from the beginning of VBO buffer and the primitive count that needs to be rendered. Let's pretend that I have two instances of these components. The first instance belongs to the level floor entity, and describes the bunch of quad tiles. The second instance is a character mesh that belongs to the player entity. The first component instance should use the 2D rendering system, and second instance should use the 3D rendering system, but the data structure of these instances are identical. It must be said that I use EntityX and the components gets in the systems, automatically depending on their type.

Both systems require position and craphics components, so both systems will take both component instances, and one of these component will be processed improperly, what with a 2D graphics component in a 3D rendering system, and vice versa. I'm thinking about creating the "hollow" components, like sprite and model, which will indicate what graphics components in the entity mean. Since these component will not contain any properties, and would be used only as flags, this solution seems clumsy.

How do I better organise rendering in an entity component system?

sentences:
My GUI stopped working? Okay I bought this asset online so I would like not to show the whole script. The problem is this asset stopped working when I updated from unity 5.0 to 5.1.2. The script is for a controller GUI interface but it seems to be giving me an error :

  NullReferenceException: Object reference not set to an instance of an
  object UnityEngine.UI.Selectable.Select ()

on this line of code :

selectedOject.GetComponent<Button> ().Select ();

so there is a null reference and its no longer recognizing the child objects as buttons is what I'm assuming

if you want to have a better look at his set up he has a short video On youtube :
HERE

I would like to continue to use this script and continue updating Unity.

sentences:
Simplify navmesh path I'm trying to implement pathfinding in my game, I'm using navmesh with triangles.

I'm able to find a path but I want to simplify the path. This is what I have right now :

Green quad is start position and blue quad is the destination, the path taken by my character is in white.

Wireframe :

Node 1 and Node 2 are in differents triangles, I want to delete Node2 and go from Node1 to final destination.

How can I simplify this path ?

sentences:
Automatch / queueing players I'm using Node.js and Redis. I'm trying to come up with a reliable way to automatch players. There is a matching server and then multiple game servers set up.

The following is what I need to have happen:

Player sends join request with game type (small/medium etc)
Matching server adds player to the current game type that is waiting for players
Game server sends player the game ID

Currently I have implemented this as follows:

Matching server listens to game:queue:small using BRPOP
Checks if game:queue:small:id = id exists
Checks if game:id:users length is <= 6 (max players)
Adds player to game:id:users list if it is
If game length is now 6, it removes game:queue:small:id

If the matching server finds game:queue:small:id is missing, it does as follows:

INCR game:nextGameId
Sets game:queue:small:id to the previously generated ID
Adds the game ID to game:queue:waiting

The game servers wait using BRPOP for new games. When they get one, they wait until the game has a minimum of 2 users then start a timer. If they don't fill up in that time, they begin with the users they have and subsequently remove game:queue:small:id (thus forcing the matchmaker to request a new game).

Whilst my method is working, I'm not convinced it will work well in production and it seems very convoluted. I can see the potential for the following issues:

Game server crashes after accepting the game ID from the waiting list resulting in users getting added to the game:id:users but nothing happening with them (the crash itself isn't a problem, but users continuing to get added to that games queue is)
If a user disconnects and the game hasn't started, the game server will remove the user from the game:id:users list. Whilst it is in the process of doing that, the matchmaking server could be adding a user to the list and think the game is full, thus removing it from the queue.

My initial thoughts were to change to a single queue of users waiting for one game type. However, this presents further issues:

If the server that the users connects to crashes, it won't remove the user from the queue thus leaving that user to be entered into a game when they don't exist. I could use sorted sets to store the time of the request and have the client poll until it gets a game ID returned but this would mean that I have no idea of how long that client has waited and therefore do not know whether to start the game with fewer users.
Without putting the users into a game, they have no ability to see what users have joined, nor the ability to chat with the users that are waiting (as that requires a game ID).

None of the way I have set this up feels right so I was hoping someone might be able to offer some better suggestions. I really need to keep the game servers and the matchmaking servers separate though in order to grow them out as required.

sentences:
Turn based game in HTML/JS/CSS - new joiner messes with state of game while animations are still running for other players I developed a playing cards web app using HTML/JS/CSS.
Communication with the server is performed using WebSocket.
The server is developed in Java Spring.

The game proposes to join one of the many available tables where you can immediately perform an action.

The players who are already in the table are perfectly in sync with each other, as when they receive a message from the server, I show a screen overlay preventing them from clicking on any element on the table while an animation is running.
After the animation is terminated, the game becomes available and runs normally.

My problem is that if a new player joins the table after a message has been sent by the server, then he can perform an action while the animation is still running for the other players, thus starting a new animation for them at the same time and the game becomes messy.

Is there a way to either prevent the new joiner from performing an action before the animation has ended for the rest of the players ? Do you have any other idea how I can solve this issue ?

Thanks for your help

sentences:
How do you design a record/replay system for a frequently changing game? I'm working in a free MMORPG and I have a problem.

I'm (with other people) developing a video recording system for the game. The idea is basically: we record all the packages sent & received with timestamps, plus some local data from the client, and then dump it in a file. For playing the video, we just emulate everything that's on the file. We also have an option to export the video to avi with ffmpeg.

The problem is: when we change between versions of the game, it is hard to maintain backwards compatibility for the video (commands added / removed, function changes, etc). Is there a good way to handle this problem? instead of having a bunch of different players and choose the right one for each version of the video file?

It would be helpful to know how does other games handle this situation.

Thanks for the help, sorry for my english.

sentences:
Animating object, setting isKinematic=false, and then letting physics take over I'm trying to create a "tree felling" effect, where the tree trunk falls over after being cut down by the player. I've used one prefab which contains my tree stump and tree trunk as children.

In its default state, my tree trunk as a rigidbody with isKinematic=true. When the player cuts down the tree, I begin an animation on the trunk which "tips it over". On the last frame, it sets isKinematic=false - at this point it should "fall over" because physicals/gravity is in control and the center of mass is definitely over its base.

However, the animation seems to be preventing it, like it's still "controlling" the transform.

Adding a transition from the "fell" state to an "exit" state just resets the position/rotation.
Setting the animator to "animate physics" kind of works, but the tree just flies away, probably colliding with the stump or something.
Disabling the animator after the animation kind of works, but this also causes the tree to go flying with some crazy physics.
When left alone, OnCollisionEnter is called on the tree for colliding with my ground, yet the gameobject appears to still be stuck at 45 degrees and never touched the ground. It seems like the rigibody/collider is not where the mesh/transform is?

Animating the object and then turning off isKinematic should work, it's been recommended to me on reddit and is the accepted answer on this question, so I'm not sure what could be wrong.

Edit: I can ease the physics problems by telling the trunk to ignore it's own stump (Physics.IgnoreCollision(Trunk.transform, Stump.transform);), but the base of the tree still "jumps" away from the stump, rather than "continue tipping over". I'm not sure what else could be at play.

sentences:
How to save Unity assests to another drive? My C:\ volume has almost no space left.
Therefore I want to transfer all my assets to the volume E:/. And save my new assets automatically on the E:/ volume. I have searched very long in unity for save options of unity assets but nowhere found a setting option for this.

sentences:
LibGDX Drawing sprites when moving orthographic camera I've been having this problem for a long time and I just can't seem to find the exact problem. I have a game where the map is 480x1600 and my camera has a view of 480x800. I have a button that when pressed, allows the user to place a platform on the map, and since the map is too big to fit on the screen, I made it so the user can move the camera up and down the map by dragging.

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    Vector3 pos = new Vector3(screenX, screenY, 0);
    cam.unproject(pos);
    cam.position.y = pos.y;
    return true;
}

Method that controls when the user tries to put a platform down

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Vector3 pos = new Vector3(screenX, screenY, 0);
    cam.unproject(pos);
    Gdx.app.log(Game.LOG, "X Coordinate: " + pos.x + " Y Coordinate: " + pos.y);

    if (GameScreen.createPlatform == true) {
        world.setPlatform(new Vector2(pos.x - 0.6f, pos.y - 0.1f), 1);
        GameScreen.createPlatform = false;
        return true;
    }

    ...
}

Where I render the platform sprites

public void render(float delta) {
    ...
    spriteBatch.setProjectionMatrix(cam.combined);
    spriteBatch.begin();
    for (Sprite platformSprite: world.getPlatformSprites()) {
        platformSprite.draw(spriteBatch);
    }
    spriteBatch.end();
    ...

}

The game works fine when I don't move the camera. But when I do, the platforms aren't placed where I click, they're always either higher or lower where I actually clicked. Also, the platforms are always placed somewhere where the camera was originally looking before anything has been moved.

I think it's doing this is because for some reason, the coordinates never actually change. So wherever I am on the map, the top of the screen is always 120 and the bottom is always 90. This also causes objects on the map to have different coordinates if I move the camera.

This problem has me completely lost and I would appreciate any help.

sentences:
How can I get a velocity vector for an object moving in a circle? I am simply trying to make an object move in a circle around a point. Let's say I have an object with a position vector going from that point to the object, and also the angle of the object with the x axis.

What is the equation I can use to obtain a velocity vector for that object so that it continues to move in a circle? What other information do I need?

sentences:
Occasional lag-spikes in performance in heavily optimized game (profiler screenshots included) So I've been working on a mobile-based platformer for a few years now. I've spent more than a year optimizing the game for mobile as much as I could. Almost every single one of my meshes are using Mobile/Diffuse shader. When I test the performance of my game (on my phone) with the profiler, the frame rate stays at clean 60 fps for the most part. The CPU time fluctuates between 16 ms and 17 ms. The rendering statistics are also excellent, with draw calls fluctuating between 18 and 25, triangles fluctuating between 1.0k and 2.0k and vertices fluctuating between 2.0k and 3.1k. Below is a screenshot of the Rendering profiler when the game is running smoothly. I believe that for a mobile device, these should be very good numbers.

However, every now and then, I see a spike in the profiler window (see below):

According to the profiler, the spike is being caused by Render.OpaqueGeometry.

Under normal scenarios (when the performance is smooth), Render.OpaqueGeometry takes between 1 ms and 2 ms of CPU time. However, as you can see in the screenshot above, Render.OpaqueGeometry is taking 5.36 ms of CPU time and the total CPU time has jumped to 24.16 ms.

Based on my observations, this spike shows up once or twice per minute. Sometimes, several minutes go by without any spikes. And in very rare occasions, the spike can show up 3 times in a single minute (although I don't think that happened the last couple of times I tested it).

So why do you guys think this is happening despite the game being heavily optimized? I read in a post in Unity Answers that Render.OpaqueGeometry spikes are frequent in all games and it's nothing to worry about. But do you think 2 spikes per minute is too frequent for a simple platformer?

sentences:
Hashing 3D position into 2D position I am doing volumetric raycasting and curently working on depth jitter. I have 3D position on ray and want to sample 2D noise texture to jitter the depth.

Function for converting (or hashing) 3D position to 2D have to produce absolutely different numbers for a little changes (especialy because i am sampling in texture space so sample values differs very very little) and have to be "shader-wise" - so forget about branches, cycles etc.

I'm looking forward for yours nice and fast solutions.

sentences:
File format for static and animated 3D models I'm currently writing a 3D game in C++ with OpenGL and I'm coming to the part where to load 3D models in. Therefore I'm looking for popular file formats and techniques to

display static meshs and
render animated meshs.

I've already found quite a large number of possible formats and techniques, like keyframe animations, skeletal animation, MD2 up to MD5, 3DS, X, Collada etc. pp.

For simplicity I'd like to use a format (and technique) that allows both, namely static and animated meshs. So my question is if one format is suitable for that task and which one you'd suggest. And to clarify a bit: I don't need super-smooth animations or brandnew features.

Sidenote: Because I'm a blender fan (but not an expert ;-)) it'd be helpful if it can be used with that -- but of course that shouldn't be the show stopper, here.

sentences: What comes with Nintendo's DS SDK? Presumably a development machine for sure, but would it contain any sort of editor (of any kind)? Or are there any editors in existence that work with the SDK that are commercially available?

sentences:
What is an elegant way to localize level data? I'm writing a simple android game. I planned to store all levels in xml files that contain info about level, including a level_name field. The Level class would load an appropriate level by parsing the corresponding XML file and reading data into the Level's fields) when user selects it.

Everything seems fine, until I want the game to support multiple languages. With UI it is clear how to solve this problem since we have strings.xml file. But what about localizing level data stored in XML files?

I considered having multiple fields for a given piece of data in a level.xml file, with each containing a different translation. Another thought was storing only the ID of level and get related level name from strings.xml file.

However, neither of these seem very elegant. Is there a more better way of doing this?

sentences:
How do i make enemy tank to follow and face player tank? I'm creating tank game demo , in game i want enemy tank to always face toward the player tank.

I already check look_at() function but it will face immediately, i don't want that. I want enemy tank to slowly rotate toward player.

What i'hv done so fare is :

MainWindow.gd

extends Node2D

func _ready():
    $Tank2.loadPlayer1($Tank1)
pass

EnemyTank.gd

extends KinematicBody2D

var rotSpeed = 0.3

var player1

var speed = 30
var velocity = Vector2()

func _ready():
pass

func loadPlayer1(obj):
    player1 = obj

func _process(delta):
    if player1 != null:
        velocity = Vector2()
        var rot_dir = (player1.position - position).angle()
        rotation += rotSpeed*rot_dir * delta
        velocity = Vector2(0,0).rotated(rotation)
        move_and_slide(velocity)
pass

My Result is  : Enemy Tank (red) keep rotating

Does anyone know how do i fix this?

Thank you

sentences:
Quaternion - rotating rigidBody to particular angle over time Using Bullet Physics.

There's a rigid body that is rotated.
For some delta-time I need to rotate that body to have rotation of (0, y, 0) - keep the old y value rotation but reset x and z.
The position of the body is described by Quaternion.
And, of course, I can modify the angular velocity.

So, how to calculate what angular velocity should I set for rigidBody to rotate to necessary rotation angle in delta-time?
Seen this article: http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation, but it would be exageration to say if I understand how to implement those formulas...

Here's what I have as initial state of the rigidBody:

 rigidBody.getWorldTransform(tmpM1);
 Quaternion rotation = new Quaternion();
 tmpM1.getRotation(rotation);
 Vector3 angles = new Vector3();
 rotation.getAxisAngle(angles);

sentences:
How can I reference multiple XNA content projects from my game project? I'm developing an engine in XNA and would like to have two different ContentManagers: one for the game (sprites, sounds, etc.) and one for the engine (shaders, dlls, etc.)

Right now, I have this:

using Microsoft.Xna.Framework;
....
public class Engine
{
    public ContentManager GameContent;
    public ContentManager EngineContent;
    public IServiceContainer Services = null;

    public Engine(GraphicsDeviceManager Graphics, ContentManager Content)
    {
        Services = new ServiceContainer();
        Services.AddService(typeof(IGraphicsDeviceService), Graphics);
        Services.AddService(typeof(IGraphicsDeviceManager), Graphics);
        GameContent = Content;
        EngineContent = new ContentManager(Services, "EngineContent");
        ...
    }
}

The GameContent and EngineContent projects root directories are set to GameContent and EngineContent, respectively. I have a content reference to EngineContent in the Engine project and references to both GameContent and EngineContent in the Game project.

Why can I access my GameContent but not my EngineContent?

sentences:
Rotation matrices from Quaternion.Identity and -Quaternion.Identity are the same? If I create a rotation matrix from an identity quaternion then it is the same as a creating it from a negative identity quaternion

        Matrix m0 = Matrix.CreateFromQuaternion(Quaternion.Identity);
        Matrix m1 = Matrix.CreateFromQuaternion(-Quaternion.Identity);

        Console.WriteLine(m0);
        Console.WriteLine(m1);

        Console.WriteLine(m0.Forward);   // {X:0 Y:0 Z:-1}
        Console.WriteLine(m1.Forward);   // {X:0 Y:0 Z:-1}

Why is this the case?

If I use a negative identity matrix

        Quaternion q0 = Quaternion.CreateFromRotationMatrix(Matrix.Identity);
        Quaternion q1 = Quaternion.CreateFromRotationMatrix(-Matrix.Identity);

the orientation will be rotated 180 degrees as expected.

sentences:
Using proxy servers to tunnel data between clients and world servers Background
I've read up a little on the concept of splitting the world into regions which in turn can each be run on a node within a cluster. However my game concept revolves less around zones but rather bubbles.
In short, a bubble is a region of space defined by a radius which dynamically expands and contracts depending on how many players are in close enough proximity.

For example if two players are over 1000KM apart and there is no one else that close to them, then those two players will be in their own bubbles. However once they come within 1000KM to each other, their bubbles connect, effectively creating a larger bubble.
In terms of the server space, one of those players is switched to the others instance. In practice it may be the case that a single server node could handle multiple bubbles, but for arguments sake we'll say that each bubble is run on a different server.
Problem
Secrecy may well be a big part of this game, so its important that when one player is close to another they aren't able to detect this by listening for connections to new instances.
My current thinking is that players would be grouped into proxy servers which in turn dynamically connect and disconnect from the bubbles therefore separating the client from this process.

The problem of course is latency. There is already latency in the communication itself, and I am concerned that this additional step of tunneling data like this may unnecessarily make it worse.

I would also love to find material to read on this type of instancing.

sentences:
Advantages and disadvantages of libgdx I've been an android developer for a while and am thinking about getting into gaming. While looking for a game dev framework, I thought libgdx provides very friendly documentation and functionality. So I would like to use it if there is no big obstacle.

But when I tried to see how many developers employ this library, I could find not that many. Is there anything wrong with this library? In other words, I would like to know its advantages or disadvantages from any experienced developer.

UPDATE: After reviewing its documentations and trying to build simple games with libgdx, I decided to go with it as its documentations are good enough and its community is very active. What I liked the most is that it provides a bunch of demo games that I can learn a lot from.

sentences:
MonoGame - Scale Texture2D from 16x16 to 64x64 I need to scale a Texture2D (let's say it's 16x16) to 64x64.

I tried scaling it in the SpriteBatch#Draw method, but it doesn't look like pixel art as soon as it's drawn, more like a lot of anti-aliasing happened.

I chose 64x64 because 16x16 is pretty small, and I thought I could just scale every pixel by 4 (1x1 pixel in 16x16 could be 4x4 pixels in 64x64), basically I don't want MonoGame to anti-alias when I draw the scaled Texture.

Thank you!

sentences:
UE4. How to create a reference to the physical material asset (which I create in editor) in C++ Oftenly, when we want to assign asset to the particular component in C++ we write code like that:

.h

UPROPERTY(BlueprintReadWrite)
UStaticMeshComponent* Body = nullptr;

.cpp

Body = CreateDefaultSubobject<UStaticMeshComponent>("Mesh Component");
// find mesh asset
auto MeshForBody = ConstructorHelpers::FObjectFinder<UStaticMesh>(TEXT
                        ("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere'"));
if (MeshForBody.Object != nullptr)
{// if asset is finded -> set to the component
    Body->SetStaticMesh(MeshForBody.Object);
}

Question: how can I set the PhysicalMaterial in C++ through the reference to the asset in editor? Is it possible?

.h
    UPROPERTY(EditDefaultsOnly)
    UPhysicalMaterial* MyPhysicalMaterial = nullptr;

.cpp

    ???

Find this, but still waiting maybe the best solution without casting exists:

auto PhysicalMaterialAsset = ConstructorHelpers::FObjectFinder<UObject>(TEXT(
         "PhysicalMaterial'/Game/PhysicsMaterials/MyPhysicsMaterial.MyPhysicsMaterial'"));

if (PhysicalMaterialAsset.Object)
{
    Sphere->BodyInstance.SetPhysMaterialOverride((UPhysicalMaterial*)PhysicalMaterialAsset.Object);
}

THNX for any tips in advance ;)

sentences:
drawing line using angle code below make enemy move towards player.

    //Calculate Distance formula
    double xDiff = player.x - enemy.x;
    double yDiff = player.y - enemy.y;
    double dist = Math.sqrt(xDiff * xDiff + yDiff * yDiff);

    //find angle
    angle = (int) Math.toDegrees(Math.atan2(yDiff, xDiff));
    if (angle < 0)
        angle += 360;

    xDiff = xDiff / dist;
    yDiff = yDiff / dist;
    x += xDiff * speed;
    y += yDiff * speed;

how to draw line with length 20, same direction as enemy is moving?

enemy.x2 = angle?
enemy.y2 = angle?
draw(enemy.x1, enemy.y1, enemy.x2, enemy.y2);

sentences: Equivalent to Draw() method in Unity project? I have been using xna/monogame before this. So I read tutorials about unity, made some classes, loaded some sprites, everything "seems" to be going good, but I can't figure out how to add things into the environment, could anyone tell me or guide me to what's the equivalent of Monogame's Draw() method in Unity? Thank you.

sentences:
Rendering the whole game world I'm trying to create a live minimap of the complete game world. In order to do that I'm taking a snapshot of the whole game world (not only the part that is displayed) every 100ms or so.

The code I've used to take the snapshot is this (called every update()):

if (game.time.time < this.nextUpdate) { return; }
{
    this.stage.drawFull(game.world);

    //  Draw our black border rect
    this.thumbnail.rect(0, 0, this.thumbnail.width, this.thumbnail.width, '#000');

    //  And copy the stage capture to our Thumbnail (offset by 2px for the black border)
    this.thumbnail.copy(this.stage, 0, 0, this.stage.width, this.stage.height, 2, 2, this.thumbnail.width - 4, this.thumbnail.width - 4);
    this.thumbnail.update();

    this.nextUpdate = game.time.time + this.updateRate;
}

The code that creates these variable is this (called in create()):

//  The Stage is a BitmapData the size of the Game window
this.stage = game.make.bitmapData(game.world.width, game.world.height);

//  Thumbnail will hold our scaled-down version (+4px padding for the black border)
this.thumbnail = game.make.bitmapData(150, 150);

//  And thumbContainer is a Sprite with the thumbnail for its texture
this.thumbContainer = game.make.sprite(game.width - 150, game.height - 150, this.thumbnail);

//  Note we add the thumbContainer to the Stage, not the World, to avoid it being captured itself
game.stage.addChild(this.thumbContainer);

This is the result:

As you can see in the bottom-right minimap - The bitmap is rendered but the background isn't rendered for the whole thing (I think it's only rendered properly for the first 800x600 pixels). Also, if the player goes further down to the bottom ledge the minimap messes up completely:

It seems like a render issue, or a bitmap copy issue, but I can't find the problem. Does anyone have any idea why is this happening?

Thanks!

sentences:
Help with the calculation of the usage of my speed stat I am working on a freeroam, action RPG (before you read further, I am not noobish to programming, plus have friends to help with actual content rather than the base code). Anyway, I am trying in Skills to the game. I decided the movement-based skills and animations should be a priority, so I began integrating it in. The animations work fine, but alas my movement skill Athleticism is making the character move unrealistically fast at a higher skill. The skill ranged from 1 to 100. After realising I should do some calculations to make you go from normal to Sonic the Hedgehog, I am using this formula currently:

(Athleticism / Mathf.Sqrt(Athleticism)) * 0.05f * runMod;

This has helped, but it still looks weird. I need some help to make a formula that makes that the skill doesn't have such of a linear effect on the movement.

EDIT:

Trying to be specific. The player moves, currently about 0.05 walking units per second at Athleticism 10, which is nice. However, the movement rate at Athleticism 100 cranks up to 0.15 units, which is a little too fast. I am aiming for 0.1 instead.

sentences:
Algorithm to see if two voxels are interconnected I'm looking for a good algorithms for the following problem: Given a 3D grid of voxels (which may be either empty or filled), if I pick two non-adjacent voxels, I want to know if they are connected to each other by other voxels.

For example (to illustrate the situation in 2D), where # is a filled square:

  1 2 3
a # # #
b # #
c # # #

If I pick a3 and c3, I want to determine as quickly as possible if they they are connected; if there is a path between a3 and c3 through filled pixels. (The real situation is in a 3D voxel grid, of course.)

I've looked at floodfill algorithms and path finding algorithms, but I'm not sure which to choose. Both do unneccesary work: Flood fill tries to fill all voxels, but this is not needed. Path-finding algorithms are usually concerned with finding the shortest path, which is also not necessary. I only need to know if there is a path.

What algorithm should I be using?

Edit: based on the comments, I think should add the following: the content of the voxels are not known in advance, and also, the algorithm is needed to detect if removal (emptying) of a voxel would cause the group of voxels to break into two or more smaller groups.

sentences:
Variable Variables in unity using JavaScript? I'm working on a custom built save system for a project a friend an myself are working on. Currently all variables that are saved to file, are stored as static variables in a global variables script file. The current save system involves running through each variable individually and saving it a line on a document, completely hard coded and very annoying to expand upon with new variables and elements in the game. I've decided to look into serialization of the global variables file, however static variables are not serializable. My solution is to use a getter and setter function, that is called instead of the direct GV.whatevervariable, that we currently use.

Ive been looking for something that allows me to store a variables name inside of another variable and then call it.

for example, say the variable in the GV script is A , the function would look like

static function getter(vget){
    return GV['vget'];
 }
 var A : string = "testcode"

where the call code would look like:

 var stuff : string = GV.Getter("A");

the problem with this though is that I keep getting "system.type does not support slicing" I currently cannot think of any other way to do this, and would really prefer not to hard code a getter and setter for each variable.

sentences:
How can it be that if I click on rawimage it's getting the right file name from the hard disk ? I don't understand it In this script once only I'm getting the all the files from the hard disk type png images.
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class SavedGamesSlots : MonoBehaviour
{
    public GameObject saveSlotPrefab;
    public float gap;

    private Transform slots;
    private string[] imagesToLoad;

    // Start is called before the first frame update
    void Start()
    {
        imagesToLoad = Directory.GetFiles(Application.dataPath + "/screenshots", "*.png");
        slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

        for (int i = 0; i < imagesToLoad.Length; i++)
        {
            var go = Instantiate(saveSlotPrefab);
            go.transform.SetParent(slots);

            Texture2D thisTexture = new Texture2D(100, 100);
            string fileName = imagesToLoad[i];
            MouseHover.savedGameFName = fileName;
            byte[] bytes = File.ReadAllBytes(fileName);
            thisTexture.LoadImage(bytes);
            thisTexture.name = fileName;
            go.GetComponent<RawImage>().texture = thisTexture;
        }
    }

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

    }
}

At this line I'm doing reference from another script to a public static variable:
MouseHover.savedGameFName = fileName;

Then in the MoueHover script that I'm using it calling it from each raw image event trigger I'm using also the mouse button down:
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class MouseHover : MonoBehaviour
{
    public SaveLoad saveLoad;
    public SceneFader sceneFader;
    public RawImagePixelsChange rawImagePixelsChange;
    public static string savedGameFName;
    public static string folder;
    public static bool loadingwithfolder = false;

    private bool loadGame = false;

    public void OnHover()
    {
        Debug.Log("Enter");
        rawImagePixelsChange.modifyPixels(0.3f);
        PlaySoundEffect();
        loadGame = true;
    }
    public void OnHoverExit()
    {
        Debug.Log("Exit");
        rawImagePixelsChange.restorePixels();
        loadGame = false;
    }

    private void Update()
    {
        if(loadGame)
        {
            if (Input.GetMouseButtonDown(0))
            {
                MenuController.LoadSceneForSavedGame = false;
                loadingwithfolder = true;
                folder = Path.GetDirectoryName(savedGameFName);
                StartCoroutine(sceneFader.FadeAndLoadScene(SceneFader.FadeDirection.In, "Game"));
                loadGame = false;
            }
        }
    }

    private void PlaySoundEffect()
    {
        transform.GetComponent<AudioSource>().Play();
    }
}

At this line :
if (Input.GetMouseButtonDown(0))

After clicking the mouse left button inside I'm using a break point on one of the lines and I see that the variable savedGameFName contains the correct clicked raw image full directory with the file name, for example:
d://screenshots//screen_1920x1080_2021-01-26_18-56-46.png
But how does it know to assign to the variable savedGameFName the correct file name of the clicked raw image? It's not a list or something, it's just public static string variable. and the only other using is in the first script when running the game once first time.
I don't understand it.
It's working fine!!! but I don't understand how.

sentences: Hammer BSP file size inefficiency I haven't posted here before but I came across a problem, when I save a map in Hammer as .bsp it ends up being over 10x bigger than all of the source files put together. I found the source for one map rp_downtown_v2.bsp, which the map is 2mb but when I used the source and compiled it in hammer its 40MB? Why would this be? Any further help will aid thanks!

sentences:
TileMapRenderer in libGDX not drawing anything So I followed the tutorial on the libGDX wiki to draw Tiled maps but it doesn't seem to render anything.

Here's how I setup my OrthographicCamera and load the map:

camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

map = TiledLoader.createMap(Gdx.files.internal("maps/test.tmx"));
atlas = new TileAtlas(map, Gdx.files.internal("maps"));
tileMapRenderer = new TileMapRenderer(map, atlas, 8, 8);

And here is my render function:

Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

camera.update();
tileMapRenderer.render(camera);

Also I did pack the tile map using the TiledMapPacker.

I'm completely stumped... am I missing anything obvious here?

EDIT:

While debugging I noticed that the TileAtlas seems to be empty, which I guess shouldn't be the case, but I have no idea why it's empty.

sentences:
Pygame Particle Emitter Problems so I've been trying to create a basic particle system in pygame which I can later expand upon but I've run into a spot of bother creating the particle emitter. Obviously what's supposed to happen is it's supposed to create a new particle every frame (or a set of particles) but instead it just alters the particle that's created first time round. I understand why this is happening, as far as the game is concerned, every frame I add the same object to the particle list so when I call the update function it calculates the positional and velocity sums multiple times, what I'm having trouble with is fixing it. How would I go about making a new particle every time?

My existing classes for this are as follows:

class Particle():
    def __init__(self, pos, vel, accel, image):
        self.pos = pos
        self.vel = vel
        self.accel = accel
        self.life = 255
        self.lifecount = 1
        self.image = image

    def update(self):
        self.vel.add(self.accel)
        self.pos.add(self.vel)
        self.life -= self.lifecount

    def is_dead(self):
        if self.life <= 0:
            return True
        else:
            return False

class Emitter():
    def __init__(self, pos):
        self.pos = PVector(pos[0], pos[1])
        self.particles = []
        self.part_list = [Particle(self.pos, PVector(0,2), PVector(0,0), pygame.image.load("resources/particles/fireball.png"))]

    def update(self):
        self.particles.extend(self.part_list)
        for p in self.particles[:]:
            p.update()
            if p.is_dead():
                self.particles.remove(p)

    def draw(self, surface):
        for p in self.particles:
            x = p.pos.x
            y = p.pos.y
            temp = pygame.Surface((p.image.get_width(), p.image.get_height())).convert()
            temp.blit(surface, (-x, -y))
            temp.blit(p.image, (0, 0))
            temp.set_alpha(p.life)
            surface.blit(temp, (x, y))

The positions, velocities and accelerations are all part of a vector class with vector math functions.

sentences:
How are Roguelike/Bullet Hell mechanics stored in Unity? I'm going to be creating a roguelike bullet hell game wherein the play will be a bullet hell game, but you will be traveling between "rooms" wherein the action takes place. The "rooms" will be randomly generated like in roguelikes such as The Binding of Isaac, but with bullet hell play similar to Touhou or Batsugun, with a possible twist. It will be similar to Enter the Gungeon, but there will be some differences.

I'd like to know how Unity will deal with storing possibly thousands of different "rooms" and generating these each time, along with the enemies and bullets these enemies will begin to shoot after you enter the room. Only one room will be visible at a time.

How would Unity deal with mapping possibly thousands of rooms, and will it be able to store this while generating bullet patterns? I know that in classic bullet hell arcade games, when there were many bullets on the screen, the game tended to slow down because of hardware limitations.

sentences:
How do I get the width of a string as it would be displayed on screen? What is the best and easiest way to get the width of a String using Slick2D?

I'm working on the achievement interface menu in my game that displays some images. On each image I need to draw a string such as "Reach Level 5.". Only problem is that I don't know how to get the string width to properly center the string on the image.

sentences:
Cloning a Game - Dev diary while using original assets I'm currently cloning a game and still using the sound and graphic assets of the original.

I know that I may not distribute those assets but what about publishing a video of my progress as part of a dev diary, is that allowed?

Thanks.

sentences:
Implementing game state without switch statements everywhere? Executive summary

Are there any good tutorials on Game State FSMs, particularly OOP/OOD-based and not switch-statement-based?

Summary

Is there a practical process for creating a game state engine other than using a switch statement, preferably with examples? Wikipedia's event-driven FSM article only shows a switch statement and the article on FSMs is strictly theory-based with no practical examples.

Background

Currently all my games use a very simplistic game state "engine" that uses switch statements everywhere. It's very messy, violates DRY horribly, and does not scale very well.

Each state is treated as a level and must be checked at all three points throughout the game loop, i.e. Input, Processing, and Render. If a level or screen is added it must be added to all the switch statements.

Practical example of recreation of pac-man for educational purposes (seriously, this was a school project a few years ago):

enum STATE {
    LOADING,
    TITLE,
    LEVEL_ONE,
    LEVEL_TWO,
    // ...
    WIN,
    GAME_OVER,
    CREDITS,
}GAME_STATE;

void Input() {
    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...
            InputCommon();
            break;
        case WIN:
        case GAME_OVER:
            if(keyboard->KeyDown(KEY_ENTER))
                GAME_STATE = CREDITS;
            break;
        case CREDITS:
            if(keyboard->isKeyPressed())
                quit = true;
            break;
    }
}

void Processing(int dead) {

    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...
            ProcessLevel();
            if(GAME_STATE == LEVEL_SEVEN) {
                // ...
            }
            break;
        case WIN:
            break;
        case GAME_OVER:
            break;
        case CREDITS:
            break;
    }
}

void Render() {
    // ...

    switch(GAME_STATE) {
        case LOADING:
            break;
        case TITLE:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(0));
            break;
        case LEVEL_ONE:
        case LEVEL_TWO:
        // ...

            // ...
            break;
        case WIN:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(3));
            break;
        case GAME_OVER:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(1));
            break;
        case CREDITS:
            sh->Draw(_gw->GetBackBuffer(), sh->Index(2));
            break;
    }

    //End render process, display to screen.
    _gw->EndRender();

}

sentences:
Box2D : rotate and set position to a static body with another origin I try to rotate a static body of a PolygonShape, from another origin, and set the position regarding this new origin.

Why ? Because I create bodies from TiledMapEditor object. And origins of objects in this editor are in the left upper corner.

Regarding the documentation, I can set origin using the setAsBox method. But then when I set the position, the body is not where it is supposed to be. (an offset is apply between the current position and the expected position)

I assume that the origin is used for the rotation, but not the position.

How can I set the position from another origin, and rotating from this same origin ? (the upper left corner and not the center of the shape)

My attempt :

  val rotation = 45f // rotation angle (in degree)
  val shape = PolygonShape()
  shape.setAsBox(rectangle.width*0.5f, // half width
                rectangle.height*0.5f, // half height
                Vector2(0f, rectangle.height), // new origin
                rotation * MathUtils.degreesToRadians) // angle to radians

   val bodyDef = BodyDef()
   bodyDef.type = BodyDef.BodyType.StaticBody
   bodyDef.position.set(rectangle.x, rectangle.y) // set the position

Regards

sentences:
Pathfinding with multiple actors moving in sync I am trying to implement a path-finding routine involving the following:

Multiple agents
Multiple Goals
Obstacles
Both agents move in sync, i.e. they both move in the same direction unless one is stopped by an Obstacle. See explanation below in the edit section.

See the following image for illustration:

A1 and A2 represent the starting position of two agents. The dark squares marked with "X" represent obstacles. "G1" and "G2" represent the final goal.

I played around with A* path finding algorithm, and it works great with 1 actor with one goal. However, I couldn't get it to work with more than one actor and goal.

Any suggestions and pointers about how to go about it would be very helpful.

Edit: Synchronized movement explained

If for instance, A1 is stopped by the obstacle but A2 can move, it is a valid option. A1 would stay in place but A2 will move.

Example:

Move Right: A1 moves to (2,1) and A2 moves to (2,7)
Move Right: A1 stays in place but A2 moves to (3,7)
Move Up: A1 moves to (2,0) and A2 moves to (3,6)
Move Up: A1 stays at (2,0) and A2 moves to (3,5)

sentences:
Three.js camera turning leftside right In Three.js I am trying to implement an orbiting camera can be rotated around the x and the y axis. I am using these two functions:

    function rotateX(rot) {
        var x = camera.position.x,
            y = camera.position.y,
            z = camera.position.z;

        camera.position.x = x * Math.cos(rot) + z * Math.sin(rot);
        camera.position.z = z * Math.cos(rot) - x * Math.sin(rot);

        camera.lookAt(scene.position);
    }

    function rotateY(rot) {
        var x = camera.position.x,
            y = camera.position.y,
            z = camera.position.z;

        camera.position.z = z * Math.cos(rot) + y * Math.sin(rot);
        camera.position.y = y * Math.cos(rot) - z * Math.sin(rot);

        camera.lookAt(scene.position);
    }

Now the x rotation works fine but the y rotation does not. Once I go over the top of the model as in that the camera's z position becomes negative then suddenly the lookAt method rotates the camera by PI amount on the Z axis and suddenly the left side of the model is on the right and vice versa. Now I can fix this by checking for a negative Z and then just fixing the camera's rotation but this then causes a malfunction when using x ad y rotation at the same time, the x then suddenly gets this inverting behavior.

How should I go about fixing this?

sentences:
object position handling for multiplayer a game I am creating a multiplayer HTML game which focuses on manipulating planet trajectories with gravity points. I am creating bunch of planets with random initial velocity and random direction and i am sharing info about this planets
to a server. Though i am keeping track of every planets position on server, i am not sharing this values every second to each player. My idea  is that if i only share planets position whenever a new player joins then from that point onward clients should be able to calculate new position of planet every second because directions and speed of the planets will be same for all players.
This idea works for screens with same resolutions and aspect ratio but it fails for other cases.

can anyone suggest other idea for keeping track of planets position for screen with resolutions?

This game is multiplayer so i need something that will allow me to provide same scene to every player.

sentences:
Adding a feedback survey to a game So I am currently making a game that aims to help people with anxiety management. I , however, would like to ask them how they feel before playing the game and then again after playing the game. Would it be possible to do this directly on Unity? I would like for them to be able to log their entries much like an online journal. I have attached pictures from the daylio app. I would like to do something similar. At this point, I really do not know how to begin doing this on Unity. Any advice, or tutorial suggestions would be appreciated.

This far I have managed to do the following (in the picture below):
This is how the survey looks (its pretty rudimentary at this point):

And this is where the information is getting displayed (in the inspector):

So now, what I would like to know, is how would I go about sending this data to somewhere else i.e. as it is in the daylio app?

sentences:
Javascript canvas check if all recs on the screen overlap a new one So I know the AABB collision detection formula, however, this code does not work. Whenever I press space, a new square pops up. But this new square can spawn inside another, something that I do not want to happen. Here is a snippet of the code I think is going wrong:

var xTopsBotsYTopsBotsSquares = [];

//Makes a randint() function.
function randint(min, max) {

    return Math.floor(Math.random() * (max - min + 1)) + min;
}

function checkForOccupiedAlready(left, top, right, bottom) {

    if (xTopsBotsYTopsBotsSquares.length == 0) {
        return true;
    }
    for (var i = 0; i < xTopsBotsYTopsBotsSquares.length; i++) {
        var data = xTopsBotsYTopsBotsSquares[i];

        if (data[0] <= right || data[1] <= bottom ||
            data[2] >= left  || data[3] >= top) {/*Do nothing*/}
        else {

            return false;
        }
    }

    return true;
}

//Makes a new square
function makeNewsquare() {
    var checkingIfRepeatCords = true;
    //DO loop that checks if there is a repeat.
    do {
        //Makes the square x/y positions
        var squareRandomXPos = randint(50, canvas.width - 50);
        var squareRandomYPos = randint(50, canvas.height - 50);

        //Tests if that area is already occupied
        if (checkForOccupiedAlready(squareRandomXPos,
                                    squareRandomYPos,
                                    squareRandomXPos+50,
                                    squareRandomYPos+50) == true) {

            xTopsBotsYTopsBotsSquares.push([squareRandomXPos,
                                            squareRandomYPos,
                                            squareRandomXPos+50,
                                            squareRandomYPos+50]);
            console.log(squareRandomXPos, squareRandomYPos, squareRandomXPos+50, squareRandomYPos+50);
            checkingIfRepeatCords = false;
        }
    }
    while (checkingIfRepeatCords == true);

}

sentences:
When prototyping, how can I more easily explore game behaviour? I build indie games myself, but I'm usually out of energy once I've taken a newly developed game to a level where it's possible to play with behavior, so I settle for refinement instead of exploration. With awful results.

(picture from the Intercom blog)

For example, I find that the iteration cycles for tweaking behavior (i.e. linking and restarting a C++ application) are so long that they kill all creativity. I'm building a tool to deal with this.

What other ways exist to quickly explore game behavior? I'm interested in the methodologies used by indie developers as well as larger companies.

sentences:
Collision of grenadelauncher shell The shell of a grenadelauncher is very small (10cm) and the speed is very fast (80m/s). Collision detection using colliders is impossible.

To get the collision point of a rocket launcher I send a Ray out from the rocket with a length of say 5 metres. If the Ray detects an object it will wait for 5/SpeedOfRocket seconds and then detonate. A rocket travels in a straight line, therefore no problem:

Grenades however travel in an Arch. They are not selfpropelled, they slow down due to air resistance and they are pulled down by gravity. If I fire a grenade up into the air and use a Ray to detect the collision, it will simply fall through the floor, or another object. The grenade doesn't rotate towards the direction of travel.

Using a second and third Ray to detect collisions behind and below the grenade catch all collisions successfully. However you will not be able to shoot a grenade closely above a hill or through a narrow window without it triggering a collision if within range of the Ray.

For now I have "solved" the problem by using the grenade just like a rocket. I simulate gravity by simply rotating the grenade as it moves. One ray to catch collision is enough because the Grenade will always face the direction of travel.

It works fine if you use the Grenade Launcher "normally". Until you shoot it like a mortar launcher: straight up in the air. I find it mathematically impossible to simulate the trajectory as such. There are too many variables involved and it would be a ridiculous attempt at solving a (what seems to be) a trivial initial problem.

I need to get the grenade to face the direction of travel like this:

sentences:
Understanding diffuse lighting in The Division Here is a screenshot of the main character walking under a bright lamp:

His hat, that was originaly dark grey, turns completely white. My question is how can such lightsource do this without making everything around it superbright? Cuz that's what my humble attempts resulted in.

I can only think of two options:
 - they either use a standard diffuse formula (it has got to be diffuse light as it does not react to camera movement) and have a lightsource that fades extremely quickly (fastar than the standard quadratic attenuation model.
 - or they use some clever shaders for clothes to make them "catch light" so fast.

Maybe there is an easier solution?

Here are two more shots, the floor is not nearly as bright as the character that goes under the lamp:

UPDATE: I think I got my problem - they have a different attenuation formula. I think if I improve my attenuation I whould be able to achieve similar results.

sentences:
Eliminate an Actor dragged outside SlotTarget As the title suggests, i would like to eliminate an Actor from the Stage when the player moves it outside my SourceTarget. The default behavior of DragAndDrop class doesn't allow to drag an Actor on a place that isn't a valid SourceTarget, but i need to implement the elimination of an Actor in this way.

So, can i implement one or both the following solutions?

1) When the Actor is dragged outside SourceTarget, remove it

2) Use a special TargetActor over which the dragged Actor gets removed (like a trash can)

In this latter case i should create a second special TargetActor, but seems that Libgdx doesn't allow it. I can have only one TargetActor. In my particular case SourceActor and TargetActor are the same.

dragAndDrop.addSource(new SourceActor(slotActor));
dragAndDrop.addTarget(new TargetActor(slotActor));

Thank you

sentences:
What is the correct formula for penalty forces? I am trying to add penalty forces between two hard body objects, so when they collide they move in a realistic way. What I have so far is this:
var totalMass = aMass + bMass;
var temp = (aMass / totalMass * aVelocity) + (bMass / totalMass * bVelocity);
newVelocityB = (bMass / totalMass * bVelocity) + (aMass / totalMass * aVelocity);
newVelocityA = temp;

Originally I thought this was correct and it seems to work for the most part. However, this doesn't seem to be flawless. For example, if the collided object is a vertical wall (represented with a mass of infinity), the wall's velocity of (0,0) will be the final result. So, for an object moving diagonally with a velocity of (10,10) and hitting the wall, will result in a velocity of (0,0). In my case I would expect that the y component of the velocity remains 10, and it keeps sliding up the wall.
Can anyone tell me if I'm on the right path, and how I can modify my formula to make sure that the y-velocity does not become 0?
I have considered that the collision normal of the wall could be important (in this example [-1, 0]), or the perpendicular of the normal, however I still have not figured out how to apply it in this formula. Multiplying by the perpendicular of the normal was my first idea, but this isn't the correct answer.

sentences:
UDK: Toggle Material on Brushes? I'm attempting to change / toggle the material that's applied to a BSP brush. I've seen where it's possible on static meshes, but I can't seem to get it to work on brushes. Below is an example scenario.

The ground (BSP Brush) is covered in a stone material
The player hits a trigger.
A new "moss" material is applied to the brush, removing the old stone material.

Any assistance you could offer would be greatly appreciated.

sentences:
Should a transform class store a matrix or seperate position/rotation/scale values? I'm creating a transform class to make storing the transform of individual objects in a scene easier, but I'm unsure on how to do it.

I could create one like this:

class Transform
{
public:
    //...

private:
    Matrix4f matrix;
};

Easy to concatenate
Easy to perform operations on (since the matrix functions already exist)
Can store certain information such as the camera projection
Difficult to get the individual values such as the position of the object
Performing operations in the wrong order can lead to unexpected results (rotate/translate/rotate results in a very different transform than rotate/rotate/translate)
Lots of memory usage (64 bytes of data for a single-precision transform)

Or like this:

class Transform
{
public:
    //...

private:
    Vector3f position;
    Quaternionf rotation;
    Vector3f scale;
};

Very easy to extract individual values
Very easy to change individual values
Because the position, rotation, and scale are independent from one-another, there is no "correct" order for rotate/translate/scale
Smaller, being only 40 bytes for single-precision
Cannot store anything beyond position/rotation/scale
Performing operations which require information stores in more than one value (such as strafing, which changes the position but depends on the rotation) are much more difficult to implement

I'm not entirely sure how most game engines deal with this. Which implementation should I go with?

sentences:
Why doesn't RGB565 lead to a smaller memory footprint on Android? I'm using LibGDX for my game. I'm loading 9 bitmaps into memory at once using the AssetManager, about 512x512 pixels each on average.

TextureParameter texParam = new TextureParameter();
texParam.format = Format.RGBA8888;

assetManager.load("islands/island_0.png", Texture.class, texParam);
assetManager.load("islands/island_1.png", Texture.class, texParam);
assetManager.load("islands/island_2.png", Texture.class, texParam);
assetManager.load("islands/island_3.png", Texture.class, texParam);
assetManager.load("islands/island_4.png", Texture.class, texParam);
assetManager.load("islands/island_5.png", Texture.class, texParam);
assetManager.load("islands/island_6.png", Texture.class, texParam);
assetManager.load("islands/island_7.png", Texture.class, texParam);
assetManager.load("islands/island_8.png", Texture.class, texParam);

However, if I switch the format to Format.RGB565, then run the Heap allocation tracker in the DDMS view of Eclipse, I see absolutely no change in the memory allocated. The bitmaps being drawn on the screen though are being rendered differently (without an alpha channel when I use RGB565).

Am I missing something? Why aren't the bitmaps using less memory?

sentences:
How do I check for collision between transparent textures? I am creating a 2D game using OpenGL.
For sprites, I use textured quads (actually two triangles).
The texures contain transparent pixels, since objects are not always perfectly rectangular.

How do I do collision detection on the objects, not the quads?
I was thinking to first check the quads for collision and if they match, check the textures.

But how can I check if two non-transparent pixels are on top of each other (or next to each other) for the two objects?

Or is there a completely different way of how this is done best?

sentences:
Strange diagonal line artifact in simple ripple shader I have a simple shader, converted from GLSL to HLSL. This is the original:
https://www.shadertoy.com/view/tdKSWG

The problem is that there is a very visible diagonal line artifact going from UV(1,1) to UV(0,0) and this artifact is not visible in the GLSL original.

No artifacts visible when ripples are started in any other screen position:

The sampler AddressU is set to "Wrap" and in shadertoy it is set to "Repeat", it should do the same but the waves still get reflected at the screen border (It works fine in GLSL)...

Does anyone know how to fix this?

This is my HLSL version:

//-- Include some common stuff
#include "mta-helper.fx"

float STRENGTH = 5.0;
float MODIFIER = 0.91;
float STEP = 2.6;
float FADESTRENGTH = 20;
float2 iResolution = {1024,512};
float3 iMouse = {0,0,0};
texture buffer;

sampler myself = sampler_state
{
    Texture = (buffer);
    MinFilter = Linear;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Wrap;
    AddressV = Mirror;
};

//------------------------------------------------------------------------------------------
// Structure of data sent to the vertex shader
//------------------------------------------------------------------------------------------
struct VSInput
{
    float4 Position : POSITION0;
    float4 Diffuse : COLOR0;
    float2 TexCoord : TEXCOORD0;
};

//------------------------------------------------------------------------------------------
// Structure of data sent to the pixel shader ( from the vertex shader )
//------------------------------------------------------------------------------------------
struct PSInput
{
    float4 Position : POSITION0;
    float4 Diffuse : COLOR0;
    float2 TexCoord: TEXCOORD0;
};

//------------------------------------------------------------------------------------------
// VertexShaderFunction
//------------------------------------------------------------------------------------------
PSInput VertexShaderFunction(VSInput VS)
{
    PSInput PS = (PSInput)0;

    // Calculate screen pos of vertex
    PS.Position = MTACalcScreenPosition(VS.Position);

    // Pass through color and tex coord
    PS.TexCoord = VS.TexCoord;
    //PS.TexCoord.y -= 0.5;
    PS.Diffuse = VS.Diffuse;
    return PS;
}

float4 psFunction(PSInput PS) : COLOR0
{

    float4 color = tex2D(myself, PS.TexCoord);
    float value = 0;

    float3 direction = float3(STEP, STEP, 0) / iResolution.xyy;

    float s1 = tex2D(myself, PS.TexCoord - direction.zy).r;
    float s2 = tex2D(myself, PS.TexCoord - direction.xz).r;
    float s3 = tex2D(myself, PS.TexCoord + direction.xz).r;
    float s4 = tex2D(myself, PS.TexCoord + direction.zy).r;

    if (length(PS.TexCoord - iMouse.xy) < 0.005 && iMouse.z == 1) {
        value = STRENGTH * smoothstep(3, 0.5, length(iMouse.xy - PS.TexCoord));
    }

    value += -(color.g - 0.5) * 2 + (s1 + s2 + s3 + s4 - 2);
    value *= MODIFIER;
    value = value * 0.5 + 0.5;

    float alphaFade = saturate(FADESTRENGTH * PS.TexCoord.y) * saturate(FADESTRENGTH * (1 - PS.TexCoord.y));
    return float4(value, color.r, value, alphaFade);
}

technique shield
{
    pass P0
    {
        VertexShader = compile vs_3_0 VertexShaderFunction();
        PixelShader  = compile ps_3_0 psFunction();
    }
}

sentences:
Why do games seemingly reload the entire level when restarting a level? Is the data really modified that much during play?

I'm assuming the longish pause between restarting a level is the entire level reloading. But it seems to me that a well implemented system should just be able to 'ping' back to the start of the level.

It's more noticeable on consoles, but its not unnoticeable on PC games.

sentences:
How to make a text box where text "types" smoothly I want to create a textbox that behaves like most textboxes seen in other games where the text appears gradually. So far this has been my attempt at it but unfortunately, the text appears very unevenly and slow even when changing the letter pause to an insanely low amount.

public float letterPause = 0.1f;

IEnumerator TypeText()
{
    //number of char typed per loop
    int len = 3;
    for (int i = 0; i < text.Length; i += len)
    {

        if (i + len > text.Length)
        {
            ibubbletext.text += text.Substring(i, text.Length - i);
        }

        else
        {
            ibubbletext.text += text.Substring(i, len);
        }
        yield return new WaitForSeconds(letterPause);
    }
}

sentences:
Trouble with Inventory System and Item References I'm currently trying to get a simple inventory system to work but I'm having a lot of trouble.

This isn't the exact code I have, but it's a shorter version that I'm pretty sure would function the same:

public struct ItemSlot {
    public Item item;

    public ItemSlot(Item item) {
        this.item = item;
    }
}

public class Item : MonoBehaviour {
    public string itemName;
}

public class Accessory : Item {

}

public class Inventory : MonoBehaviour {
    public ItemSlot[] itemSlots = new ItemSlot[1];

    public void AddItem(ItemSlot slot) {
        itemSlots[0] = slot;
    }
}

public class Player : MonoBehaviour {
    public Inventory inventory;

    private void Update() {
        if (Input.GetKeyDown(KeyCode.E)) {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hitInfo;

            if (Physics.Raycast(ray, out hitInfo, 20)) {
                GameObject target = hitInfo.collider.gameObject;

                inventory.AddItem(new ItemSlot(target.GetComponent<Item>()));
                Destroy(target);
            }
        }

        if (Input.GetKeyDown(KeyCode.G)) {
            print(inventory.itemSlots[0].item);
        }
    }
}

For a bit more prefacing I have a capsule object with the Player script on it, an empty with the Inventory script on it, which is then attached to the Player script (I'm not sure if I want to make the inventory a scriptable object which is why I've done this), and then lastly I have a cube object with the Accessory script on it.

So, when I press E and pick up the item it gets added into the player's inventory and then destroyed from the scene. Then, when I press G to display that item in the inventory the console just says null. Not Null, which is what an actual null would show up as, but the string "null". If I use visual studio's debugger and have a look at what the accessory's base is, it also says null, but for some reason if I then try and print the accessory's name then that works fine, even though that variable is defined in the Item class.

If I instead do this in the Inventory class:

public void AddItem(ItemSlot slot) {
    ItemSlot[0] = slot;
    print(ItemSlot[0].item);
}

It works fine and prints Item (Accessory) in the console. Even if I print it right after I destroy target in the Player class, that also prints Item (Accessory), so I have no idea why it doesn't work on the next block of code.

Sorry this is so long and maybe an easy fix, but I'm lost.

Edit: I think everything should be fixed now.

sentences:
Should NPC dialog be stored in XML or in a script? I'm developing an action RPG with some friends. I would like to know the differences and pros/cons of making NPC's dialogue using a file in XMLformat instead of using a script.

I see that script method is often used by game developers for NPC text, but is it better then a XML file? We've thought that a XML file with tags like

<FirstText>[text1]<SecondText>[text2]

et cetera is perfect for NPC text and also for possible quests to give the player.

So what are the differences between this two methods? Is a script suitable for this aim?

sentences: Unity - UI - Raw Image with Texture becomes Smaller after Build I am a beginner in the game development world, I have just one quick problem with the UI, as you can see during the Unity Player, the UI (Raw Image w/ Texture) is normal in size but when I build my game to APK or EXE and run it, the UI is small. Why is this happening and how to fix it?

sentences:
Custom lookAt function goes wild I have written a custom lookAt function based on a lot of posts from all over the net, and it works very nice... except when a rotation (which is stored in a quaternion) crosses some 'threshold'. However, it works flawless when the camera's position is on the same horizontal plane as the model I'm lookingAt

On the below GIF, all I do is hold a key to lookAt the model together with a left arrow key to move the camera along the right vector:

My following understanding about how this function should look like (in a brief):

1 .Calculate a quaternion rotation needed to rotate an object from it's facing vector and a target vector.

1.a. Calculate an angle between those vectors by taking their dot product and a perpendicular axis by taking their cross product.

1.b Convert angle-axis info to a quaternion using this formula.

2 .Multiply the main quaternion rotation by the quaternion received above.

If I'm right, I believe that I may have a bug in my code, but I'm not sure. My code below:

lookAt: function(vec) {
    if (this.position.isEqual(vec)) {
        return;
    }
    this.rotation.multiply(new Quaternion().twoVecToQuat(this.rotation.getForwardVector(), this.position.sub(vec)));
    MVMatrix.setRotation(this.rotation.quaternionToMatrix());
},

// And the twoVecToQuat function based on Ogre3D quaternion library:

twoVecToQuat: function(v0, v1) {
    v0.normalize();
    v1.normalize();

    var dot = v0.dot(v1);
    // If dot === 1, vectors are the same
    if (dot >= 1) {
        return this.makeIdentity();
    }
    // If vectors are opposite
    if (dot < (1.0e-06 - 1)) {
        var fallbackAxis = new vec3().make(1, 0, 0);
        fallbackAxis.crossSelf(this);
        // If collinear, pick another vector
        if (Math.areScalarsSimilar(fallbackAxis.length(), 0)) {
            fallbackAxis.make(0, 1, 0);
            fallbackAxis.crossSelf(this);
        }
        fallbackAxis.normalize();
        this.axisToQuaternion(Math.PI, fallbackAxis);
    }
    else {
        var sDot = Math.sqrt((1 + dot) * 2);
        var invSDot = 1 / sDot;
        var tempVec = v0.cross(v1);

        this.x = tempVec.x * invSDot;
        this.y = tempVec.y * invSDot;
        this.z = tempVec.z * invSDot;
        this.w = sDot * 0.5;

        this.normalize();
    }

    return this;
},

UPDATE: Slin's solutions proved to be working (that one about calculating lookAt matrix), but I still don't know where is the bug in the quaternions library code. Working lookAt function below:

lookAt: function(at) {
    if (this.position.isEqual(at)) {
        return;
    }
    var zAxis = this.position.sub(at).normalize();
    var up = upVec(); // World's up vector instead of camera's up vector will unroll the camera
    var xAxis = up.cross(zAxis).normalize();
    var yAxis = zAxis.cross(xAxis);
    MVMatrix.make(
        xAxis.x,            xAxis.y,            xAxis.z,
        yAxis.x,            yAxis.y,            yAxis.z,
        zAxis.x,            zAxis.y,            zAxis.z,
        this.position.x,    this.position.y,    this.position.z);

    this.rotation.matrixToQuaternion(MVMatrix);
    this.copyEulerAngles();
},

sentences: Perlin noise terrain: 3 coordinates from one I am making a game with procedural terrain, like minecraft. I have a perlin noise function which takes one integer and returns a number between zero and one. However, for terrain, I need a single density value from three coordinates: x, y and z. But my noise function only takes one number. Should I take the average of the noise values for x, y and z for a single density value? Or something else?

sentences:
Slowdown in sliding background with Libgdx I´m new with libgx and i have a basic question. I want an background like an image that repeats indefinetely, and moves down. I did with 2 images and it worked, but the problem is that is very slow. I stored the images with 512x512px. My code is very simple but i dont know what im doing wrong.

public void render() {
   Gdx.gl.glClearColor(0, 0, 0.2f, 1);
   Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
   offset -= 600 * Gdx.graphics.getDeltaTime();
   offset = offset % 512;
   camera.update();
   batch.setProjectionMatrix(camera.combined);
   batch.begin();
   batch.draw(backgroundImage, 0, offset);
   batch.draw(backgroundImage, 0, offset + 512);
   batch.draw(bucketImage, 0, offset + 1024);
   batch.end();
}

Any suggestions will be appreciated Thanks a lot!

sentences:
Is a dynamic enviroment map using pincushion curvilinear perspective projection possible? I'm wondering if it is possible to generate a dynamic spherical environment map using a single frame render using a pincushion curvilinear perspective projection matrix (phew, that's a mouthful)?

I've been researching this for a few days now and the closest thing I can find is a curvilinear perspective but it isn't a commonly used projection matrix so there isn't any help I was easily able to find and I still don't know if it supports a full circle FOV.

Why?

The standard perspective matrix but it begins to look very strange and distorted above 180 degrees vertical FOV and completely fails to render when approaching 360 degrees. So instead most games render the scene six times using 90 degree FOV facing the faces of a cube.

Rendering the scene 6 times seems like a waste if it might be possible to simply imagine a camera that has a 360 degree view across both axis and then render that to a spherical environment map.

sentences:
Unity 5.x - Editor only constructor/initilization event I have three scripts:

Level - Represents a Tile Based level.

LevelEditor - Custom Editor for Level.

Tile - A non monobehaviour class for storing tile information.

Level contains an array of Tiles to be allocated with 'new'. To avoid putting 'If array != null' everywhere in the code, I want to initialize the array simply to a size of 0 before anything else is ran.

However, I do not want this initialization to happen at run time, just only for editing purposes.

Is there some event I can use that will run before Level.OnDrawGizmos(), and also not be part of runtime code? Or is LevelEditor.OnEnable() the best I can do, with some checks in Level.OnDrawGizmos()?

sentences:
How can i get component script from FirstPersonCharacter? In the Hierarchy i have a FPSController and as child of it FirstPersonCharacter.
I can get script that attached to the FPSController but not from the FirstPersonCharacter.

What i want to get is the Blur script from the FirstPersonCharacter.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public CharacterController firstPersonCharacter;
    public FirstPersonController fpc;
    public float fadeDuration = 5;
    public float speed;

    private Material material;
    private float targetAlpha = 0;
    private float lerpParam;
    private float startAlpha = 1;
    private bool rotated = false;

    void Start()
    {
        material = GetComponent<Renderer>().material;
        SetMaterialAlpha(1);

        fpc.enabled = false;
    }

    void Update()
    {
        lerpParam += Time.deltaTime;

        float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
        SetMaterialAlpha(alpha);

        if (alpha == 0)
        {
            fpc.enabled = true;

            if (rotated == false)
            {
                fpc.GetComponent<FirstPersonController>().enabled = false;
                fpc.transform.localRotation = Quaternion.Slerp(fpc.transform.rotation, Quaternion.Euler(0, 0, 0), speed * Time.deltaTime);
            }

            if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))
            {
                fpc.GetComponent<FirstPersonController>().enabled = true;
                firstPersonCharacter.GetComponent<Blur>
                rotated = true;
            }
        }
    }

    public void FadeTo(float alpha, float duration)
    {
        startAlpha = material.color.a;
        targetAlpha = alpha;
        fadeDuration = duration;
        lerpParam = 0;
    }

    private void SetMaterialAlpha(float alpha)
    {
        Color color = material.color;
        color.a = alpha;
        material.color = color;
    }
}

I can get scripts from the FPSController like this:

fpc.GetComponent<FirstPersonController>().enabled = true;

But i can't get the Blur script from the firstPersonCharacter.
I tried before instead:

public CharacterController firstPersonCharacter;

With GameObject:

public GameObject firstPersonCharacter;

But Blur is not exist. When i make GetComponent The Blur is not exist.

sentences:
Game window systems and internal frames I don't know if this is a valid question, but: What kind of window manager do games use which have internal frames (Frames inside frames)? Does this differ between the programming languages (Are e.g. in Java the AWT/Swing libraries used to manage these and other graphical elements, such as buttons,or is this to restrictive (speed, graphical possibilities?))

A special example would be EVE Online, where the client can use the ingame windows like on a normal desktop.

sentences:
Run a physics simulation on both client and server? I'm implementing a multiplayer asteroids clone to learn about client/server network architecture in games.  I have spent time reading GafferOnGames and Valve's publications on their client/server tech.  I am having trouble with two concepts.

Currently I have an authoritative game server simulating physics with box2d and sending out the state of the world to clients about 20 times per second.  Each client keeps track of the last few snapshots it received and lerps between two states to smooth out the movement of sprites.  However it's not that smooth.  It can be smooth for a while, then jerky a bit, then back to smooth, etc.  I have tried both TCP and UDP, both are about the same.  Any idea what my problem might be?  (Note: I implemented this for single player first, and the sprite movement is perfectly smooth at 60fps when updating the physics world only 20 times per second).

In order to solve the first problem I thought maybe the client should run a box2d simulation as well and just update the positions of its sprites to match the server snapshots when they don't match.  I thought this might be smoother since my single player implementation is smooth.  Is this a good idea?
Even if it won't fix the above problem, is it necessary for client-side prediction?  For example, if a player attempts to move their ship, how will they know if they hit an asteroid, wall, or enemy ship without a physics simulation?  It seems like their ship would appear to pass through the object it should collide with before they receive a snapshot from the server that says they hit the object.

Thanks!

sentences:
What direction does directional audio come from for a 2D view? In a 3D game, it makes sense that stereo balance is based on the angle between your camera direction and the directionto the audio source.

Is 2D audio just "fudge the left-right balance until it sounds good"? Are there games where the audio balance was still character-oriented rather than view oriented (so a character facing south causes stereo balance to be backwards)?

I'd be interested in answers supported by examples where a notable game was played by blind players using audio cues. The only one that comes to mind is Brood War

sentences:
how can I rotate a tetrahedron's vertices so that it's pointing straight up? I am trying to render an Equilateral triangle in 3D, and I came across this answer:
https://math.stackexchange.com/a/562895/15497
So based off of that, I made my vertex points:
(1, 1, 1),
(1, -1, -1),
(-1, -1, 1),
(-1, 1, -1),

This looks great when I draw lines across these points, however the triangle is not pointing straight up as I would like it to.  I am trying to understand how to calculate the right amount to rotate the X, and Z axis so that it is pointing upwards?

I messed around with rotating the X by PI / 5 and Z by -PI / 5 and got something close:

But that is not right...

sentences:
interpolating frames in a vertex shader My models are stored as a set of meshes, each with a vertex list and normal list per key-frame, and indices for GL_TRIANGLES which is shared for all frames.  Each frame I lerp between two adjacent key-frames to generate the vertices for that frame on the CPU and then draw it.

How can I move this into a GLSL vertex shader?  Can a shader interpolate between two sets of vertices, and how can I store those vertices on the GPU?

sentences:
How to iterate through a list of enemies and display results? I'm making an turnbased RPG and I wanted to add a traditional multiple enemy system where a user could attack different enemies when it's there turn. I started by making a list of everybody who is going to attack and having that as the turn order. My question is how do I go through that list, and for every enemy that attacks display the damage they did and wait for the user input to continue to the next enemy.

Getting it to process all the attacks is easy, but a computer will do it in milliseconds and I need it to wait for the user input to continue.

I have started the following code:

for (int i = 0; i < turnOrder.Count; i++)
{
     if (turnOrder[i].isMonster)
     {
          ProcessEnemyChoice(enemyToAttack);
     }
     else if (turnOrder[i].isMonster == false)
     {
          ProcessUserChoice(enemyToAttack);
     }
     //enemyToAttack is assigned as a the enemy the user selected
}

I tried a do-while loop but that stopped my program from doing any updating, which makes sense. I'm at a loss here and any input from the geniuses here would be much appreciated.

sentences: How to track many in-game statistics I am looking to track many in-game events, e.g. the score of each move, how many moves are taken, what types of moves, etc. A lot of stats can simply be tracked with a counter. In some cases I need to aggregate data in order to calculate the value (e.g. most common move). How are you tracking in-game stats for your games? How do you avoid creating a class with tens or hundreds of fields? How do you avoid littering the code with tracking invocations? How do you abstract the aggregate data so as to avoid rewriting it for each scenario?

sentences:
How to get distance from point to line with distinction between side of line? I'm making a 2d racing game. I'm taking the nice standard approach of having a set of points defining the center of the track and detecting whether the car is off the track by detecting its distance from the nearest point. The nicest way I've found of doing this is using the formula:

d = |Am + Bn + C| / sqrt(A^2 + B^2)

Unfortunately, to have proper collision resolution, I need to know which side of the line the car is hitting, but I can't do that with this formula because it only returns positive numbers.

So my question is: is there a formula that will give me positive or negative numbers based on which side of the line the point is on? Can I just get rid of the absolute value in the formula or do I need to do something else?

sentences:
Architecture for extremely modular game? I'm developing a modular game in Unity 5.6. Each module has very little overlap in assets with the others. I'm concerned about having a bloated repository after a few months of development, and since I'm using Bitbucket (a free account) I'm limited in my repo size, but not in my number of repos. So instead of having one huge folder for my game I'm considering having a launcher project and scene that loads builds from a folder in /Assets. Each module would be its own project, and I would just drop its build into the launcher's folder.

My question is, is this a reasonable approach to building a highly modular game? Hopefully I'll be continuing development for quite a while, and I want to make sure the project is as lightweight and extendable as possible. Or am I overthinking this, and should I just use one big repo?

sentences:
Cascaded Shadow Maps: clipping against scene bounds I just implemented an initial version of CSMs based on the MSDN articles Common Techniques to Improve Shadow Depth Maps and Cascaded Shadow Maps.

I fit the shadow projection to the view frustum, and do not clip against the scene bounds, because in Common Techniques to Improve Shadow Depth Maps it is stated:

  It is also possible to clip the frustum to the scene AABB to get a tighter bound. This is not advised in all cases because this can change the size of the light camera's projection from frame to frame. Many techniques, such as those described in the section Moving the Light Texel-Sized Increments, give better results when the size of the light's projection remains constant in every frame.

However, in the paper from the Nvidia SDK the frustum is further clipped against the scene bounds to achieve a maximum used area for the shadow map.

This confuses me. Did the guys from MSDN miss something, is the Nvidia paper simply older or am I not understanding the Nvidia approach correctly?

Edit: I was right in not understanding the Nvidia approach, basically not at all. I confused the crop matrix with a clipping against scene bounds.

sentences:
How can I refactor an enum so that it is still available in the inspector? I am trying to use an enum so that it is available in the inspector. This code works:

public ArmorTypeEnum ArmorType;
public enum ArmorTypeEnum { Light, Medium, Heavy };

How can refactor it into a single line?

How can I make ArmorTypeEnum private while keeping ArmorType public?

sentences:
Percentages for different platform generation I have a level manager, which creates levels and levels create platforms.

Levels can contain a variety of platforms.

I dont really understand how I can say:

  I want a 10% of one platform being made, 30% chance of another, and 70% chance for anotgher and so on...

At the moment I have a method that looks like this:

   private void creationManager(float moveChance, float breakableChance, float superJumpChance)

I'm not sure how I can use these values and probabaility to determine which type of paltform is created.

Any ideas?

sentences:
Finding cells within range on a hexagonal grid I'm looking for a way to get the cells based on a N range. But no luck.

I'm converting Row Column offset to Cube Coordinate system QR -> XYZ

$range = 1;
for ($dx = -$range; $dx <= $range; $dx++)
{
    for ($dy = max(-$range, -$dx - $range); $dy <= min($range, -$dx + $range); $dy++)
    {
        $dz = -$dx-$dy;
        $points = $hexagon->cube_to_oddq(array($dx,$dy,$dz));
        $x = $hexagon->ver + $points[0] * $hexagon->size * 1.5;
        $y = $hexagon->height + $points[1] * $hexagon->height + ( ($points[0]%2) * ( $hexagon->height / 2 ) );
        $points = $hexagon->drawHex($x,$y, true);
        $pointss = array();
        foreach($points as $p) {
            $pointss[] = $p[0];
            $pointss[] = $p[1];
        }
        imagefilledpolygon ( $png_image , $pointss , 6 , $black );
    }
}

Result:
Inside every hex cell
(First line is QR coordinate)
(Second line is XYZ converted coordinate)

Any advice what I'm doing wrong?

Update:

As requested, the Oddq (Q,R) to Cube conversion XYZ

    $i = $hex[0] = ROW
    $j = $hex[2] = COLUMN
    public function oddq_to_cube($hex){
        $hex[2] = $hex[1];
        $x = $hex[2];
        $z = $hex[0] - ($hex[2] - ($hex[2]&1)) / 2;
        $y = -$x-$z;
        return array($x, $y, $z);
    }
    $curr_cube = $hexagon->oddq_to_cube(array($i,$j));

sentences:
LibGDX Shader does not work with FBO texture I have a shader and I want to run the shader on the whole rendered image at the end instead of each individual sprite that I render on screen. For this purpose I created an FBO, I render the all my images to the FBO and then I render to colorBufferTexture generated by the FBO. There is just one problem, the shader does not work when I render the FBO texture. The withoutFbo() method render the image with the shader working just fine, but the withFbo() method only renders the image without the shader. Also I know that the shader in withFbo() is working because if I try to render something other then the colorBufferTexture from the FBO the shader will work. So why isn't the shader working with the texture generated by the FBO?

public class Application3 extends ApplicationAdapter
{
    float time;
    Sprite sprite;
    FrameBuffer fbo;
    SpriteBatch batch;
    Texture noiseTexture;
    TextureRegion fboTexture;
    ShaderProgram shaderProgram;

    @Override public void create()
    {
        ShaderProgram.pedantic = false;
        batch = new SpriteBatch();

        sprite = new Sprite(new Texture("game.png"));
        sprite.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

        shaderProgram = new ShaderProgram(Gdx.files.internal(Shader.GLITCH2.getVertex()), Gdx.files.internal(Shader.GLITCH2.getFragment()));

        noiseTexture = new Texture(Gdx.files.internal(Shader.GLITCH2.getPath() + "noise.png"));
        noiseTexture.bind(0);

        fbo = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
        fboTexture = new TextureRegion(fbo.getColorBufferTexture());
        fboTexture.flip(false, true);
    }

    @Override public void render()
    {
        //withFbo();
        withoutFbo();
    }

    void withoutFbo()
    {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        time += Gdx.graphics.getDeltaTime();

        shaderProgram.setUniformi("u_noise", 0);
        shaderProgram.setUniformf("u_time", time);
        batch.setShader(shaderProgram);
        batch.begin();

        batch.draw(sprite, sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight());

        batch.setShader(null);
        batch.end();
    }

    void withFbo()
    {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        time += Gdx.graphics.getDeltaTime();

        fbo.begin();
        batch.begin();

        batch.draw(sprite, sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight());

        batch.end();
        fbo.end();

        shaderProgram.setUniformi("u_noise", 0);
        shaderProgram.setUniformf("u_time", time);
        batch.setShader(shaderProgram);
        batch.begin();

        batch.draw(fboTexture, sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight());

        batch.setShader(null);
        batch.end();
    }
}

sentences:
Move two different objects to two different destinations so they arrive at the same time without using lerp I might be missing some simple thing but I'm not I am able to wrap my head around this. Normally, if I want to move two objects to different positions so they arrive at the same time I would use a lerp like so:

var speed = 2.0f;
var amount = Math.Min(1f, this.elapsedTime * speed);

var obj1NewPosition = Vector2.Lerp(this.obj1Start, this.obj1End, amount);
var obj2NewPosition = Vector2.Lerp(this.obj2Start, this.obj2End, amount);

this.obj1Position = obj1NewPosition;
this.obj2Position = obj2NewPosition;
this.elapsedTime += dt;

But I want to do this in a way where I only add to their positions:

var speed = 2.0f;

this.obj1Position += obj1Vector * speed * dt;
this.obj2Position += obj2Vector * speed * dt;

// obj1Vector is a normalized vector headed to obj1End
// obj2Vector is a normalized vector headed to obj2End

How do I make the second approach work such that each object will arrive at the destination I choose at the same time by only adding to their positions?

I don't have to consider acceleration or deceleration, simply: have two objects arrive at their respective destinations at the same time and then stop.

sentences:
I want to test the Animator component of a gameobject using nunit, but I am having issues I made a Blender 3D model with animations. Then I used the Animator Controller, and attached it to the model. The Animator Controller has a few Boolean parameter variables like isWaving, isDoing, and isIdle and more variables like that. If, say, a non-idle action is true, then the animation of my model transitions to the next one. I am into test-driven development, but I have never done it with Unity.

I tried writing the following code to test my project:

[SetUp]
public void SetUp()
{
    Crystal = GameObject.FindGameObjectWithTag("CrystalModel");
    CrystalScript = Crystal.GetComponent<CrystalChanPlayer>();
    CrystalAnimator = Crystal.GetComponent<Animator>(); // unity game animator
}

[Test]
public void ifSetAnimationIstodoThenToDoAnimationIsPlayed()
{
    CrystalScript.setAnimationStrategy("todo"); // set strategy
    CrystalScript.playAnimation(); // sets todo boolean to true and idle to false

    // first debug output
    Debug.LogError("todo is " + CrystalAnimator.GetBool("isDoing") +
        " idle is " + CrystalAnimator.GetBool("isIdle"));

    //second output
    Debug.LogError("current state is " +
        CrystalAnimator.GetCurrentAnimatorStateInfo(0).IsName("idle"));

    Assert.True(CrystalAnimator.GetCurrentAnimatorStateInfo(0).IsName("todoAnimation"));
}

I received the following output:

  "todo is true and idle is false"
  "true"

I think this is because Unity isn't really running, and my Animator doesn't get to update based on the variable changes. The first output assures me that todo is set to true and idle is false, hence the Animator should transition that animation to the todoAnimation. Yet, I can't seem to show that, in my tests.

Is there any way to test the Animator class? Are there any design patterns I can use?

sentences:
Select a block of tiles from tilemap by click and dragging I'm creating my first game in Godot 3.1, a top-down 2D sim game where you can build rooms on a space station. I am using a tileset I created inside a TileMap node. I placed a script inside the node that checks for the mouse position in the world, converts it into a tilemap coordinate, then loads a tile into that tilemap coordinate.

func _input(event):
if (event is InputEventMouse):
    var button = event.get_button_mask()
    if (button == 1):
        var tile_pos = world_to_map(event.position)
        var name = _tileset.tile_get_name(0)
        set_cellv(tile_pos, _tileset.find_tile_by_name(name))

Works like a champ! As long as the left mouse button is held down, any tile the mouse pointer touches is filled with the tile from the tileset.

Now I am trying to expand this function so that I can click the world and drag across several tiles to form a rectangle or square, then have all of the tiles inside the selected area filled with the selected tile.

func _input(event):
if (event is InputEventMouse):
    var button = event.get_button_mask()
    if (button == 1):
        var tile_pos = world_to_map(event.position)
        if (dragStart == Vector2(-1,-1)):
            dragStart = tile_pos
        var name = _tileset.tile_get_name(0)
        if (dragStart != Vector2(-1,-1) && dragStart != tile_pos):
            var newX = dragStart.x - tile_pos.x
            var newY = dragStart.y - tile_pos.y
            while (newX != 0 && newY != 0):
                var next = Vector2(-1,-1)
                if newX > 0:
                    next = Vector2(dragStart.x - 1,dragStart.y)
                    newX = newX - 1
                elif newX < 0:
                    next = Vector2(dragStart.x + 1,dragStart.y)
                    newX = newX + 1
                elif newX == 0:
                    if newY > 0:
                        next = Vector2(dragStart.x,dragStart.y - 1)
                        newY = newY - 1
                    elif newY < 0:
                        next = Vector2(dragStart.x,dragStart.y + 1)
                        newY = newY + 1
                print(next)
                set_cellv(next, _tileset.find_tile_by_name(name))
    else:
        dragStart = Vector2(-1,-1)

However, it seems to only load some of the tiles and functions sporadically. Am I not understanding how the system iterates through the while loop or am I missing something else?

sentences:
Relative vertical alignment of 3 Texts on Canvas This is a menu that appears if I press Enter on the RE4 inventory if an item is selected. I have drawn a thin red rectangle around it:

And here is a video that shows some of the menu's effects.

I am familiar with a simple text canvas.
I understand that I need to make each line a separate "Text" object so that I can scroll up and down through them.

Here is what I have so far:

The problem that I'm facing now is that the Canvas will be scaled at runtime.
I don't work with fixed values.
This is a problem since I don't see how I could easily make it so that each TextLine object fills 33,3% of the canvas.

Am I right to assume that I can only solve this by making a scripts that holds a reference to each TextLine object and which then calculates their position when the scale of Canvas is known?

Or is there any easier solution?

Thank you!

sentences:
Do I need a company name to publish on Google Play? I'm going to upload my Android mobile game on Google Play. But it seems like all games are developed by companies(such as Zynga, and King) and I don't see individual's names as developers. Do I need to register a company name officially? I think it costs a few hundred dollars... If I have to, how and where do I register? or instead of registering a company for a few hundred dollars, if I make a domain website that is named as my company name, would it provide me some protections?
Also, do I need to trademark my game's title as well?
Thanks!

sentences:
How to play more than one background song in XNA? The current tutorial I am using to play background songs only allows me to play one song throughout the entire game.

Link to tutorial --> http://rbwhitaker.wikidot.com/playing-background-music

I want to have multiple songs where after one song is finished playing another random song will be selected and played.

How would I do that?

Also I would not liked to get involved in XACT.

sentences:
Is it a good idea to implement a MVC pattern into my LibGDX 2D RPG-style game? For example I currently have a Player object that contains it's textures/animations and how to render these (I'd consider this as the view). Player also has an update() method which controls where the player is going to move, if it's going to lose health etc. (controller). Finally Player also has all it's attributes like runspeed, health, max health, inventory items etc.

The Player class is starting to look very cluttered and unorganized and serializing the complete Player class isn't really possible, so I made a separate PlayerState class which basically contains all it's attributes that could be changed while playing (This could actually be turned into the PlayerModel). I was wondering if it would be a good idea to split the Player up using a MVC pattern. I would have a Player, PlayerController and PlayerRenderer. Serializing the Player would be easy and it would be easier to keep the rendering separate from the updating and make sure rendering only happens when everything for the next frame has been updated.

This seemed like a good idea, however then I would also want to do this for GameMap. A GameMapRenderer that renders the map and it's textures to the screen. A GameMap model that contains what animals and hostiles are in the map and other various attributes the map might have. And of course a controller that controls everything that happens in that map.

I could go even further and say a Pig may need a model since it has attributes that can change, a renderer to render it's texture and a controller to control movement etc. but this seems a bit excessive. However, I don't like only implementing the MVC pattern to the player and then ignoring it for other classes like Pig. But the way I'm working currently is very badly structured imo and it's frustrating to work with.

sentences:
UE4 - openGL context Is there a way to get an openGL context to do my drawings in UE4?

I'd like to use some shaders before the loading of a scene (kind of an intro thingy), but I couldn't find anything related to get an openGL context.

sentences:
searching for "university kind"  free online course about OPENGL I know there are a lot of free university courses, but I'm trying to find one about OpenGL.
Do you know where can I find one, online?

sentences:
Generating transformation matrix for 2D camera with pan/zoom/rotate Question

How do you implement a camera with pan/zoom/rotation for a 2d game? Is it acceptable to multiply together a series of transformation matrixes to generate a final transformation matrix that is applied to the vectors/vertices in a scene, or is there a more efficient way?

Overview

Working on a 2d game in löve2d I recently tried implementing a camera class that allows for panning/rotation/scrolling.

I tried finding a good resource for how to implement such a 2d camera, but was unable to find one that covered all three degrees of movement, and so I came up with my own solution.

I would like some feedback on if this is a good approach, and how it could be optimized/improved upon.

My Attempt

My camera object stores the following values:

position: (Vector2)(World-Space position relative to the origin)
angle: (float)(how much the world is rotated, in radians)
zoom: (float)(the zoom factor, 1 = normal, 0.5 = 2x zoom, etc)
offset_center: (Vector2)(center the camera on the point of rotation using [screen_width/2,screen_height/2])
offset: (Vector2)(any additional offset away from the center of rotation, typically just [0,0]

Whenever a camera value changes (basically each frame) I run camera:computeMatrix() which calculates its transformation matrix:

Camera.computeMatrix = function (self)

    local m_pos = Matrix{ -- World-space Position
        {1, 0, self.position.x},
        {0, 1, self.position.y},
        {0, 0, 1}
    }

    local m_zoom = Matrix{ -- Zoom
        {self.zoom, 0, 0},
        {0, self.zoom, 0, 0},
        {0, 0, 1}
    }

    local m_rot = Matrix{ -- Rotation
        {math.cos(self.angle), math.sin(self.angle), 0},
        {-math.sin(self.angle), math.cos(self.angle), 0},
        {0, 0, 1}
    }

    local m_offset = Matrix{ -- Screen-space Offset
        {1, 0, self.offset_center.x + self.offset.x},
        {0, 1, self.offset_center.y + self.offset.y},
        {0, 0, 1}
    }

    self.matrix = nil
    -- reverse order than when applying them 1 by 1
    self.matrix =  m_offset * m_rot * m_zoom * m_pos
end

So once Camera.matrix is calculated as a 3x3 matrix, I apply that to a given vertex/vector:

Vector2.TransformM = function (v, m)
    -- m is a 3x3 matrix of format {{a,b,c},{d,e,f},{g,h,i}}
    return Vector2(v.x*m[1][1]+v.y*m[1][2]+m[1][2], v.x*m[2][2]+v.y*m[2][2]+m[2][3])
end

An example of this implementation:

Download (pan with WASD, rotate with Q/E, zoom with 1/2)

sentences:
libgdx - collision detection with tiled map java currently, I am working on a 2d rpg game which is similar to final fantasy 1-4. I can load up a tiled map and the sprite can walk freely on the map. However, I will like to create a wall for it to stop walking through it.

I created three tiled layer Background, Collision, Overhead and one  Collision object layer with rectangles only.

"How do I handle collisions with the object layer in the tiled map?"

"Do I have to create every single rectangle that is in the object layer with Rectangle rectangle = new Rectangle() and rectangle.set(x, y, width, height)in the code?"

Thank you very much in advance. Any help is greatly appreciated!

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

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

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

sentences:
SetFullscreenState not returning When I call the IDXGISwapChain::SetFullscreenState method, it does not return. The window goes fullscreen, but accepts no further input. A println!() put right after never fires. I am assuming there is some sort of deadlock happening behind the scenes, but the docs don't go into what all it locks.

Does SetFullscreenState perform any locking?

If so, what does it lock?

What other issues could cause SetFullscreenState to never return?

I am using Rust 1.44.1 with winapi 0.3.9. I am passing minwindef::TRUE and a null pointer as arguments (passing minwindef::FALSE returns, but does the opposite of what I want). I am using the following options in the swapchain desc:
desc.BufferCount = 1;
desc.BufferDesc.Width = width;
desc.BufferDesc.Height = height;
desc.BufferDesc.Format = dxgiformat::DXGI_FORMAT_R8G8B8A8_UNORM;
desc.BufferDesc.RefreshRate.Numerator = 60;
desc.BufferDesc.RefreshRate.Denominator = 1;
desc.BufferUsage = dxgitype::DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc.OutputWindow = *hwnd.inner();
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Flags = dxgi::DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
desc.Windowed = minwindef::TRUE;

sentences:
In general, are programmers or artists paid better? I'm in a private game programming school where there also are 3D art classes; sadly, there seems to be a lot more students in those latter classes, something like 50% or 100% more.

So I was wondering: in the real video game industry, which of the artist/modeler or the programmer is more likely to be wanted in a company, so who will be paid more ?

I'm sure there are artists which are obviously paid better than other programmers and I'm sure there are other sorts of jobs in the game industry (sound, management, testers), but I wanted to know if there is a general tendency for one or the other. And sometime I wonder even if an artist can happen to write scripts...

sentences:
Does swf provide better compress rate than zlib for png image? Somebody told me that when a png image is stored in swf, it's separated to several layer, hence the alpha channel can be compressed better. Is it true? Or, once png image is imported into a swf, it's format is changed, e.g converted into bitmap data, and than compressed by swf's compress algorithm. That's, it is not in png format anymore.
I don't know how swf packing its resource, please tell me if you know.

sentences:
z ordering in directx11 Hi recently i am trying to implement z ordering system into my directx framework.
So every object will have z order property(int), and this value will have higher priority than depth checking for rendering.
the current idea is from these three my assumptions that

depth check happens after vertex shader
value of SV_POSITION is used for depth checking
modifying z component of the value of SV_POSITION doesn't affect anything except in depth checking, because it is in projection space.

so after calculating projection position(local pos * WVP mat), i did projective dividision(it seems to make problem) and modified only z component corresponding orders that i want to draw with.

This is brief Vertex shader code

VS_OUTPUT output;

output.pos = mul(WVPMat, input.pos); // projection pos
output.pos /= output.pos.w;
output.pos.z -= renderPriority;

return output;

And !!! it kinds of works !!! but when i get my camera closer to any object,
it weird thing happens

it doesn't make any this weird thing unless projective division.
i am just curious why it happens instead of knowing another alternative way for z ordering.
but any further advices and informations would be really appreciated.

sentences:
How to implement simple shadows on XNA? UPDATE: See photos below the description

I try desperately to implement shadows on my XNA games.
My game is a style of games like Voxel (minecraft).

The problem is that I do not find support / help or example explaining how to add shadows on cubes (vertices and indices) with (BasicEffect).
I just find examples to add shadows with a (HLSL Effect) or a "Model".

Is it possible to create shadows with the class "BasicEffect" on vertices cube ?
I already try with "Matrix.CreateShadow(...)" but no success .

I really hope so.

The logic of my function "DrawWorld":

#region DrawWorld
    // Draw all cubes in the world
    public void DrawWorld(GameTime gameTime)
    {
        effet.TextureEnabled = true;
        Plane lightPlane = new Plane(Vector3.UnitY, 0);
        Vector3 lightPos = new Vector3(-10f, 10f, 10f);

        //Try to initialize shadowMatrix
        Matrix shadowMatrix = Matrix.CreateShadow(Vector3.Normalize(lightPos), lightPlane);

        // Light settings
        effet.LightingEnabled = true;
        effet.DirectionalLight0.Enabled = true;
        effet.DirectionalLight1.Enabled = true;
        effet.DirectionalLight2.Enabled = true;
        effet.DirectionalLight0.DiffuseColor = col.ToVector3();

        effet.SpecularPower = 512f;

        // Fog settings
        effet.FogEnabled = true;
        effet.FogStart = arcadia.camera.NearPlane;
        effet.FogEnd = arcadia.camera.FarPlane;
        effet.FogColor = Microsoft.Xna.Framework.Color.White.ToVector3();

        // Set World with shadow matrice
        effet.World = Matrix.Identity * shadowMatrix  ;
        effet.View = arcadia.camera.View;
        effet.Projection = arcadia.camera.Projection;

        // Set the cube vertexBuffer and indice
        arcadia.Game.GraphicsDevice.SetVertexBuffer(graphicData[regionIndex][a].VertexBuffer);
        arcadia.Game.GraphicsDevice.Indices = graphicData[regionIndex][a].IndexBuffer;

        // Apply the basic effect
        effet.CurrentTechnique.Passes[0].Apply();

        // Draw the cubes vertices
        arcadia.Game.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, graphicData[regionIndex][a].VertexPosition.Length, 0, graphicData[regionIndex][a].Indices.Length / 3);

    }
    // #END OF DRAWWORLD
    #endregion

Without shadow is this :

When i try to add shadow with "Matrix.CreateShadow(...)" i got this bad result:

sentences:
How to delay jump to syncronize with an animation ? I'm using Unity and First Person Controller.
If i press the jump button, my charachter jump immediately. I want,instead, that jump movement starts after (for instance) 1 second, to be syncronized with a jumping animation I trigger.

How to do that ?

Thanks

sentences:
How do I find the name of the current audio clip being played? I have a title scene and a credits scene that use the same music. When I start my game the title scene music plays, and I have my game set up so the audio manager is not destroyed on load. When I enter my credits scene I do not instruct any new music to play, but each time I reload my title scene the title music restarts because a script in the scene tells it do so.

How can I get the name of the current audio track so that I will only play audio if it differs from what's currently being played?

This is my "LevelMaster" script which is responsible for handling the audio in each scene.

public class LevelMaster : MonoBehaviour
{
private AudioManager AudioManager;

[SerializeField]
private string trackName;

private void Start()
{
    AudioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>();
    AudioManager.Play(trackName);
}

public void PlaySound(string soundName)
{
    AudioManager.Play(soundName);
}

public void StopSound(string soundName)
{
    AudioManager.Stop(soundName);
}

sentences:
Where can I find good designers/animators for the graphics of a 2d game? Possible Duplicate:
  Where to hire 2D sprite artists?

I've got a little bit of experience in this field already, and I noticed that it's way better to look for animators than graphic designers, because games need explosions, looping sprite sheets, etc. But it would be even better if I could go somewhere and find people with experience in making graphic assets FOR GAMES, not for general markets. Is there some specialized site or something?

sentences:
How to define default graphic setting? Currently I'm developing a PC game using Unity

Usually on PC games we found graphic/video settings due to varying hardware installed and limitation. Just as in the title, how does a game set its default graphic setting? What parameters do I need to take into account for defining my default graphic setting? Or does the game detect installed hardware capability and programatically enable/disable graphic effects?

AFAIK, most of the time when I tried to play some AAA games with minimum system requirement after installation, the game would be laggy because of some effects like ambient occlusion, high quality texture, and stuff are enabled. So I'm sure the default setting is not the lowest/worst graphic setting available.

sentences:
Problem animating in Unity/Orthello 2D. Can't move gameObject I have a enemy npc that moves left and right in a corridor.
It's animated with 2 sprites using Orthello 2D Framework.

If I untick the animation's play on start and looping, the npc moves correctly.
If I turn it on, the npc tries to move but is pulled back to his starting position again and again because of the animation loop.
If I turn looping off during runtime, the npc moves correctly again.

What did I do wrong?

Here's the npc code if needed.

using UnityEngine;
using System.Collections;

public class Enemies : MonoBehaviour
{
    private Vector2 movement;
    public float moveSpeed = 200;
    public bool started = true;
    public bool blockedRight = false;
    public bool blockedLeft = false;
    public GameObject BorderL;
    public GameObject BorderR;

    void Update ()
    {
        if (gameObject.transform.position.x < BorderL.transform.position.x)
        {
            started = false;
            blockedRight = false;
            blockedLeft = true;
        }
        if (gameObject.transform.position.x > BorderR.transform.position.x)
        {
            started = false;
            blockedLeft = false;
            blockedRight = true;
        }

        if(started)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedRight && !started && blockedLeft)
        {
            movement = new Vector2(1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
        if(!blockedLeft && !started && blockedRight)
        {
            movement = new Vector2(-1, 0f);
            movement *= Time.deltaTime*moveSpeed;
            gameObject.transform.Translate(movement.x,movement.y, 0f);
        }
    }
}

sentences:
How much slower is it to draw on "half pixels"? I've noticed that games like Diep.io are using floating decimal points for thin stroke lines on the grid. I have even tried this myself, by adding 0.5 to all of the positions for the grid lines to make the lines more thin.

I heard it from a friend that drawing on half pixels causes the GPU to do more work to smooth it out, like anti-aliasing. I am really trying to make my game look nice, by making the most smoothest lines as I can. How much slower is it really, and should I use it in an online competitive 2D game using Canvas?

sentences:
Implementing Explosions I want to add explosions to my 2D game, but im having a hard time with the architecture. Several game elements might be responsible for explosions, like, lets say, explosive barrels and bullets (and there might be chain reactions with close barrels). The only options i can come up with are:

1 - Having an array of explosions and treat them as a game element as important as any other

Pros: Having a single array which is updated and drawn with all the other game element arrays makes it more organized and simple to update, and the explosive barrels at a first glance would be easy to create, simply by passing the explosion array as a pointer to each explosive barrel constructor

Cons: It might be hard for the bullets to add an explosion to the vector, since bullets are shot by a Weapon class which is located in every mob, so lets say, if i create a new enemy and add it to the enemy array, that enemy will have a weapon and functions to be able to use it, and if i want the weapon (rocket launcher in this case) to have access to the explosions array to be able to add a new one, id have to pass the explosion array as a pointer to the enemy, which would then pass it to the weapon, which would pass it to the bullets (ugly chain).
Another problem I can think of is a little more weird: If im checking the collisions between explosions and barrels (so i create a chain reaction) and i detect an explosion colliding with a barrel, if i add a new explosion while im iterating the explosions java will trow an exception. So this is kinda annoying, i cant iterate through the explosions and add a new explosion, i must do it in another way...

The other way which isnt really well thought yet is to just add an explosive component to every element that might explode so that when it dies, it explodes or something, but i dont have good ways on implementing this theory either

Honestly i dont like either the solutions so id like to know how is it usually done by actual game developers, sorry if my problem seems trivial and dumb.

sentences:
How to organize level blocks in an Infinite runner I'm working on an Infinite Runner game. I have created many level blocks(sections) with different obstacles and pick-ups for the player. They are positioned and placed manually, in such a way, to give the player a challenge. I thought that making every block a prefab and placing every obstacle and coin as a child of that prefab is going to be easier for me..because the player is going to run and these block prefabs are going to be randomly spawned in front of him and then destroyed after the player gets past them. It worked well.

Then I wanted to make a change on my coins. So naturally I took the coin prefab, made the changes, and applied them hoping that the change is going to take effect on all my blocks... Well..it didn't. Then I found out that nested prefabs don't work in Unity, so now I have to reorganize everything again?

How do I create organized level blocks, and then make them randomly spawn in front of the player? Is there any other option besides prefabs? Don't tell me I have to use a script for every block?

Think about Banana Kong, Temple Run, Subway Surfers. The levels seem random, but it's an organized randomness with certain portions of the level repeating themselves. That's what I'm trying to do, and I don't know how to organize it...

sentences:
Frame independent box2d object movement In my game I use box2d objects and, as I understand it, you can move them only in two ways, SetLinearVelocity, and ApplyImpulse. I need to move the object 32 pixels in 1 turn. So I make a constant speed and the next problem appears. If the laptop is connected to the charge and gives 60 frames, the object begins to move faster. How do I make frameindependent movement? Without connection - 30 FPS and the game makes slowly.

I also know that if you want to be frameIndependent you need to use this formula:

x = x + speedPerSecond * secondsElapsedSinceLastFrame

But i cant use this formula, because i cant set box2d position. It is make box2d itself. I only can set the Velocity :( Or may me i just dont know.

2 - it is meters per second. 64 pixels.
private void handleInput(float delta) {

    if (Gdx.input.isKeyPressed(Input.Keys.W)) {

        b2body.setLinearVelocity(0, 2);
    }

    if (Gdx.input.isKeyPressed(Input.Keys.S)) {

        b2body.setLinearVelocity(0,-2);
    }

    if (Gdx.input.isKeyPressed(Input.Keys.A)) {
        b2body.setLinearVelocity(-2, 0);
    }

    if (Gdx.input.isKeyPressed(Input.Keys.D)) {
        b2body.setLinearVelocity(2, 0);
    }
}

How can i move object in another way or how to make movement frameindependent? SetTransform is not a good decision becasuse collisions are ignored. Thank You!

sentences:
Unity C# Invoke Function Freezes Program if(Input.GetKeyDown(KeyCode.G) && ammo <= 9)
        {
            ableS = false;
            while(ammo <= 9)
            {
                Invoke("bulletplus", 0.5f);
            }
            ableS = true;
        }

This is the main part I am having trouble with.
Down there is ALL my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class gun : MonoBehaviour
{
    Vector2 rotation = new Vector2 (0, 0);
    public float rot = 3;
    public Vector3 pos;
    public Rigidbody Orb;
    public Text ammoT;
    public int ammo = 10;
    bool ableS = true;

    void Update () {
        // Ammo
        if(ammo >= 7)
        {
            ammoT.GetComponent<Text>().color = Color.green;
        } else if(ammo >= 4)
        {
            ammoT.GetComponent<Text>().color = Color.yellow;
        } else {
            ammoT.GetComponent<Text>().color = Color.red;
        }

        // Rotation
        rotation.x += -Input.GetAxis ("Mouse Y");
        rotation.x = Mathf.Clamp(rotation.x, -70, 70);
        rotation.y += Input.GetAxis("Mouse X");
        transform.eulerAngles = (Vector2)rotation * rot;
        pos = new Vector3(transform.position.x, transform.position.y, transform.position.z);

        // Shoot Choklats
        if(Input.GetMouseButtonDown(0) && ammo >= 1 && ableS)
        {
            ammoT.text = "Ammo: " + ammo.ToString();
            ammo -= 1;
            Rigidbody projectile = Instantiate(Orb, pos, transform.rotation);
            projectile.velocity = transform.forward * 50f;
        }

        // Reload
        if(Input.GetKeyDown(KeyCode.G) && ammo <= 9)
        {
            ableS = false;
            while(ammo <= 9)
            {
                Invoke("bulletplus", 0.5f);
            }
            ableS = true;
        }
    }

    void bulletplus()
    {
        ammo += 1;
        ammoT.text = "Ammo: " + ammo.ToString();
    }
}

sentences:
How is actual object size in a scene calculated? I've got stuck with 'pixel per unit' parameters and object scale.

I've created two different sprites. A background picture, 1000x1000 pixels, and another one for a 'player', 200x200 pixels.
I've added two empty game objects, with default transform, so positions are (0; 0; 0) and scale is (1; 1; 1). I added a sprite renderer to both of them, and assigned the required sprites. Both sprites have 1 pixel per unit.

And the 'player' in the scene looks much more bigger than the background.

I expect that if ppu=1, then the background would have a size of 1000 units, a player 200 units and it would be 5 times smaller.

What am I doing or understanding wrong? What is an actual object size?

sentences:
Cannot build project for Xbox, using XNA I'm trying to build a project for Xbox, and when I try to Package as an XNA Creator's Club Game I receive the following errors:

The best overloaded method match for 'Pong.MessageBoxScreen.MessageBoxScreen(Microsoft.Xna.Framework.Game, string)' has some invalid arguments.

Argument 1: cannot convert from 'string' to 'Microsoft.Xna.Framework.Game'

Argument 2: cannot convert from 'bool' to 'string'

        /// <summary>
    /// Event handler for when the Unlock Game menu entry is selected.
    /// </summary>
    void UnlockMenuEntrySelected(object sender, PlayerIndexEventArgs e)
    {
 #if XBOX
        try
        {
            Guide.ShowMarketplace(e.PlayerIndex);
        }
        catch (GamerPrivilegeException gamerPrivilegeException)
        {
            const string message = "Please use Xbox Live account.";

            MessageBoxScreen promptForPurchase = new MessageBoxScreen(message, false);
            ScreenManager.AddScreen(promptForPurchase, e.PlayerIndex);
        }
 #else
        const string message = "Unlock Full Game (Xbox Only)";
        MessageBoxScreen unlockMessageBox = new MessageBoxScreen(Game, message,      false);
        ScreenManager.AddScreen(unlockMessageBox, e.PlayerIndex);

 #endif
    }

Everything within the #if XBOX area is grayed out, I suppose because it is surrounded by that tag.

What do you think is suddenly causing these issues, and how can I correct it?

sentences:
Increase restitution (bounciness) of an object in a JavaScript formula I'm going slightly around the houses on this one.  I originally started a thread over on Stack Overflow about it but then it seemed to diverge into mathematics,  with no joy from the SO community over there (https://math.stackexchange.com/questions/295485/modify-formula-for-bouncing-object-to-increase-restitution).  So my final attempt before I admit complete failure is to ask here.  I don't know if you guys do JavaScript, nor how similar this may be to any traditional gaming language, but it's worth asking.

Basically I have the following JavaScript formula representing a bouncing object with gravity, from the standard jQuery UI library: http://code.jquery.com/ui/1.10.0/jquery-ui.js (search for 'Bounce: function'). A demo here shows it in action: http://jsfiddle.net/NtkNB.

Bounce: function ( p ) {
    var pow2,
        bounce = 4;

    while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
    return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
}

It works nicely but I need to increase the 'bounciness' of the object.  I believe this is called 'restitution'.

I've played around with the numbers but it's admittedly just trial and error (mostly error!) and just can't get it to work as desired.  I wondered if someone here might be able to understand this and could say whether it's actually possible to increase the restitution of the object within the bounds of this equation, or if not, how it could be modified such.

I totally appreciate any help anyone can give on this one as I've sunk so many hours into this without any joy whatsoever.

Many thanks.

sentences:
Best way of writing pixel manipuliting-intensive applications with OpenGL/Direct3D Recently I have been making little experiments with engines similar to old Wolfenstein 3D, Doom and Build, engines where the 3D rendering is entirely done in software and therefore you need full access to the screen buffers at pixel level.

In the days of DOS and before we had current GPUs it was relatively straightforward to get a surface to plot pixels. You had to devise the fastest way to do your calculations and the fastest way of updating the framebuffer. In fact, it is still possible by using libraries like SDL, which still give you a reasonable speed when you manipulate surfaces at pixel level.

So I wonder which would be the best way of dealing with pixel-intensive applications like the ones I suggest using current GPUs, by using OpenGL or Direct3D.

I understand this sounds absurd, but I have been looking at API documentation and it seems that it is a feature that we have somewhat lost in current hardware. I see suggestions as using glDrawPixels or using pixel shaders, but no solid explanation or theory which can help me to make the right decisions.

sentences:
How to prevent (most) cheating (server-side) in my JavaScript, Node JS, socket.io MORPG? I'm working on a fairly simple JavaScript + Node JS + socket.io (M)MORPG where multiple people play in the same world.
This is actually working, but cheating is insanely easy at the moment.

My goal is not to stop people from cheating client-side, I know this is impossible.
My goal is to have the server know when someone is cheating and do something about it.
What I really want to know is how well a Node JS server would be able to handle the constant anti-cheat checking.

People can just adjust the client-side JS code and the server currently doesn't do too much checking.

So a player could just change his X & Y coordinate and teleport around the map at will.

It would be fairly simple to implement basic checks that don't allow crazy cheats.
But I'd like a real way to prevent this.

One possibility is to keep track of all player data on the server and make sure nothing weird is happening client-side by constantly comparing the data the server has.
My issue with this is that I have a lot of collision checking and my world will become rather big.
I'm not sure how good of an idea it is to do all of this collision checking server side as well. Sure it would work for one or two players, but what about 10? 50? 200?
Especially with all of these players bouncing off walls, shooting bullets, hitting monsters, getting hit by monsters, colliding with monsters, ...

As far as I know, the only way to actually prevent cheating is by making the server check all movement and wall/bullet/monster collisions.

Are there any other options? Like using an anti-cheat engine of some sort? I know games like MapleStory have that, but I have no idea how they work or how affordable that would be?

Or will doing all the collision checks server side be fine?
At some point, like around 50-100 players, I could set up a second server instance to limit the amount of players on each server.
Ofcourse I would also only check collisions near the player, so not map-wide for each player.

Any help/advice on this is appreciated.

Here's a link to my game that will make my questions less abstract.
It's far from finished and the world is still very small, but it should give a good idea of what I'm asking:

http://185.115.218.199:3000/

sentences:
Question about references I have an enemy game object and an item game object.

Enemies have an ItemDrops script attached.
Items have a DisplayItemLabel script attached.

Attached to each enemy:

public class ItemDrops : MonoBehaviour
{
    public Transform itemPrefab;
    private EnemyHealth enemyHealth;

    private float originToGroundDistance;
    private Vector3 offset;

    private bool itemDropped;
    private bool numberGenerated;
    private float randomNumber;

    private ItemData itemData;
    public string nameOfDroppedItem;

    void Start()
    {
        enemyHealth = GetComponent<EnemyHealth>();

        itemData = GameObject.Find("Item Manager").GetComponent<ItemData>();
    }

    void Update()
    {
        //Initialized in Update instead of Start because enemy floats to 1.083333 on the Y-axis after some time after Start
        originToGroundDistance = transform.position.y - 0.25f;
        offset = new Vector3(0f, originToGroundDistance, 0f);

        if (enemyHealth.isDead && !itemDropped)
        {
            if (!numberGenerated)
            {
                RandomNumberGenerator();

                //Debug.Log(randomNumber);

                if (randomNumber < 1)
                {
                    SpawnItem(itemData.coin);
                }
            }
        }
    }

    private void RandomNumberGenerator()
    {
        numberGenerated = true;

        randomNumber = Random.value;
    }

    private void SpawnItem(Item item)
    {
        itemDropped = true;
        nameOfDroppedItem = item.itemName;

        Instantiate(itemPrefab, transform.position - offset, Quaternion.identity);
    }
}

Attached to each item:

public class DisplayItemLabel : MonoBehaviour
{
    private GameObject itemLabel;
    private Text itemNameText;

    void Start()
    {

        itemLabel = transform.Find("Canvas/Item Label").gameObject;
        itemNameText = itemLabel.GetComponentInChildren<Text>();

        itemNameText.text = "Item Name";

        itemLabel.SetActive(false);
    }

    void Update()
    {
        ClampLabelToItem();
    }

    private void ClampLabelToItem()
    {
        Vector3 offset = new Vector3(0f, 16f, 0f);

        Vector3 desiredPosition = Camera.main.WorldToScreenPoint(transform.position) + offset;
        itemLabel.transform.position = desiredPosition;

        itemLabel.SetActive(true);
    }
}

Item is not a child of enemy for multiple reasons I can think of. One is that enemies are destroyed when they are killed. With that said, how do I get the item to know who dropped it or get the enemy to know which item it dropped?
MY GOAL is to get itemNameText.text = "Item Name"; to say something like itemNameText.text = itemDrops.NameOfDroppedItem; but I can't use GameObject.FindGameObjectWithTag("Enemy").GetComponent<ItemDrops>(); because it won't always grab the correct enemy and thus the correct ItemDrops script.
I also can't set DisplayItemLabel.itemNameText.text = nameOfDroppedItem in the SpawnItem function because it wouldn't know which item's DisplayItemLabel script to get.

So clearly, I'm having issues with references. What should I do?

sentences:
Unity 5.6 - Can no longer select empty GameObject with Gizmo in editor Has anyone else noticed this?
I'm using the latest version of Unity (5.6.0p2) and it appears Gizmos are no longer selectable by default.

Is there any way to restore this behaviour?

Some of my objects are essentially empty (no meshrenderer/Filter) with a MonoBehavior attached, which require a gizmo drawn sphere so it can be selected.

Is there a better/more appropriate way of making non-mesh gameobjects selectable in the editor that I'm not aware of?

I understand I could use Handles to detect a mouse click but this doesn't allow for simple drag selection (marquee tool) if I want to select a load at once.

sentences:
How to handle shoot instructions, in a multiplayer TD I'm currently working on a Multiplayer Tower Defense game, using ImpactJS & Node. I seek some clarification about how to handle projectiles from towers, let me explain.

So the server is running the master game, and the clients just follow the instruction from the server. Lets say there is about 20 towers on the stage, all needs instructions for which creeps to shoot at. Now lets say each towers fires twice in a second, that's 40 shots each second, (worst case scenario) which is 40 request per second to each client, would't this casue alot of stress to the server, saying that we have 50 games running the same time.
So what i am really asking, is this method inefficient, and is there a smarter way to handle all these instructions.

Thank you.

sentences:
Best next step for game AI implementation I have recently finished a small framework that employs agents governed by a small hierarchical finite state machine, however I have quickly discovered the drawbacks of this approach. Namely the fact that increasing numbers of behaviours call for an exponentially complicated rule-base to govern the switches.

It occurs to me that there is probably a much better way of coding AI, where they have overall goals and can assess new information with regards to this.

I did some research but was a little overwhelmed by the amount of methodologies, and for that matter the lack of information about which techniques are more commonly used and which are best for certain situations.

what would be a good next implementation/methodology for a 3rd / 1st person shooter? such as a neural network or GOAP.

sentences:
iOS Facebook SDK, Games Start Playing post im trying to implement a method in my native iOS game the publish a story on face book such as this photo

most games that is integrated with facebook share stories like this in the activity section on the timeline

any good example especially for iOS 6

sentences:
Game Object, components priority? So, my first attempt to create a component based game object is this:

class GameObject;

class GameObjectComponent
{
public:
    virtual ~GameObjectComponent();
    virtual void Update(GameObject* obj, const sf::Time& deltaTime) = 0;
};

class GameObject
{
public:
    GameObject();
    virtual ~GameObject();

    virtual void Update(const sf::Time& deltaTime);
    virtual void AddComponent(
      std::unique_ptr<GameObjectComponent> component,
      std::string componentName);
    virtual GameObjectComponent* GetComponent(std::string componentName);

    float GetVelocity();
    float AddVelocity(float velocity);
    void SetVelocity(float velocity);
    sf::Vector2f GetPosition();
    sf::Vector2f MovePosition(sf::Vector2f movement);
    void SetPosition(sf::Vector2f position);

private:
    float mVelocity;
    sf::Vector2f mPosition;
    std::unordered_map<std::string, std::unique_ptr<GameObjectComponent>> mComponents;
};

The cpp

#include "GameObject.h"

namespace Engine{
GameObjectComponent::~GameObjectComponent()
{
}

GameObject::GameObject()
{
    mVelocity = 0.f;
    mPosition = sf::Vector2f(0.f,0.f);
}

GameObject::~GameObject()
{
}

void GameObject::Update(const sf::Time& deltaTime)
{
    for (
      auto iterator = mComponents.begin();
      iterator != mComponents.end();
      ++iterator)
    {
        iterator->second->Update(this, deltaTime);
    }
}

void GameObject::AddComponent(
  std::unique_ptr<GameObjectComponent> component,
  std::string componentName)
{
    mComponents[componentName] = std::move(component);
}

GameObjectComponent* GameObject::GetComponent(std::string componentName)
{
    return mComponents[componentName].get();
}

float GameObject::GetVelocity()
{
    return mVelocity;
}
float GameObject::AddVelocity(float velocity)
{
    mVelocity += velocity;
    return mVelocity;
}
void GameObject::SetVelocity(float velocity)
{
    mVelocity = velocity;
}
sf::Vector2f GameObject::GetPosition()
{
    return mPosition;
}
sf::Vector2f GameObject::MovePosition(sf::Vector2f movement)
{
    mPosition += movement;
    return mPosition;
}
void GameObject::SetPosition(sf::Vector2f position)
{
    mPosition = position;
}
}

and it works, but now I'm worried about priority.

Let's say I have these components: Movement, Phyisic, Renderer, NetworkSync
then they should run in order, otherwise the player could be rendered in the wrong spot, make a movement they should be able to do, or don't sync correctly with other players.

I'm not sure how to handle this without tanking the performance, and without losing too much flexibility.

Any suggestions?

Thank you.

sentences:
2D Collision : detection and design So, listening to this very smart piece of advice, I've already completed a basic Tetris game. Moving on, I started a small breakout. But suddenly : a nightmare came. Collisions.

Since I've been struggling with this a lot, I read a bunch of article of the web. Being a beginner, I thought that, in the first approach, I would only use Rectangle to detect collisions.

Right.

Now I still have some problems.

First of all, all the articles I stumbled upon on the Internet told me how to detect collisions, e.g. checking if objects A and B collided with each other. But it is not what I really need. In order to respond properly, I need to tell my objects if the collision happened on the X or Y axis and then setting the new velocity according to some rules. The problem is that there are so many possibilities when making the distinction between types of collisions that I don't think I've taken the right path.

The second point (which, I believe, is really tied with the first) is the pattern in which the detection and the resolution of a collision happen.
Right now, I have a CollidableObject classes and a CollisionDetector classes which knows about these objects. Each frame, the detector is looking for collision (or at least for me, is trying) and when he finds one, it alerts each collided object, saying "Hey you ! You've have collided with Z on the X axis, change that velocity now." and the object abides.

The main issue right now is that I can detect the collision axis and therefore, when saying "Hey you ! You collided !", I cannot respond properly. In which direction should my velocity change ?

I've been thinking a lot about this lately, trying to figure it out on my own, but I haven't find something that I liked so I am asking here now.

Thank you for your answers !

(Note : I don't know if this is relevant, but I'm coding in C++ using SDL)

sentences:
How to embed icons in a font? I'm looking to have several icons within a label; for example a coin instead of a dollar sign. I'm using a TTF font, and as much as I'd like to keep it that way (simply because I've heard it's "better"), I've looked into using a Bitmap Font Generator to embed images and replacing some unicode characters with arbitrary icons specific to my game. Seems like you're not able to preserve color that way.

Here's an example tool I've looked at, Bitmap Font Generator, from the cocos2dx docs.

My question is there some other way to embed icons with color in either a TTF or BMP font, other than replacing arbitrary characters with icons?

sentences:
How can I make a ball glow and cast light? I want to make my ball glow and cast light on other objects in the scene.
The scene is generated at run time so I believe baking is out of the question.
Emission materials work only when the object casting the glow/light is static.

sentences:
Scale around a point I am trying to create an image editing application for the purpose of generating UV maps in my own format. I am currently working on scaling the image for the purpose of zooming. I can get the image to zoom correctly, but it always zooms around the center of the image. I would like to scale around the mouse instead.

My Question

How can I scale a rectangle(image) around a point(the mouse)?

My Variables

float X = imgX;
float Y = imgY;
float W = imgWidth;
float H = imgHeight;
float mX = mouseX;
float mY = mouseY;

My Code

function scale(float ratio){
        W += ratio;
        H += ratio;
        X -= ratio/2;
        Y -= ratio/2;
}

To Clarify

I am not trying to change camera or view-port. I am trying to scale an BufferedImage through the Graphics.drawImage() function. The function take the image and the x, y, width, and height of the image to be rendered.

Example
In the Windows Photo Viewer, when you zoom in using mouse scroll, the image is zoomed around the mouse.

sentences:
How to move a cube withour rolling it? I am trying to move a cube with my keyboard on a plane surface. However, the cube always rolling instead of moving. How could I slide the cube on the plane?

What I have done:

I added a plane game object with a mesh colider
I added a 3D cube object with a box colider and rigidbody
I appended a ControllerScript to the cube

  ControllerScript

private const float Speed = 10;

private Rigidbody rb;

void Start()
{
    this.rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    var x = Input.GetAxis("Horizontal");
    var z = Input.GetAxis("Vertical");

    this.rb.AddForce(Speed * x, 0, Speed * z);
}

It looks like the AddForce method upset the cube. I already tried to reduce the friction of the plane and the cube, but this only delays the problem.

How could I move the cube without rolling it? Whats the common way to do it?

sentences: Multiple points of gravity in GameMaker Studio 2 I'm trying to make a simple 2D prototype in GameMaker Studio 2 where there're multiple points of gravity, essentially static objects in the scene that attract the player-object based on distance and mass of the object. Does anyone know if this would be complicated to get working? I've been trying to find resources on how to do this, but so far I've not found much helpful, so if anyone has any pointers for me that would be much appreciated.

sentences: EXE-ifying custom levels/scripts/graphics/music My game is pretty much just a game-builder, where you create your own levels, scripts, graphics, music etc. and the game just loads them from a file you tell it. But how would I make it so the user could generate an exe that would just load the game files and act like a standalone game but actually be made with the game-builder thing? I'm using C++.

sentences:
What should a game engine do? I'd like to improve my skills/try something new and I'd like to start with 3D. I have read Starting programming in 3D with C++ but I have question about engines:

What should engine do? I know it is abstraction layer above 3D API (i.e. OpenGL or DirectX) but what should it exactly do?

sentences:
Instantiating a GameObject at my desired position not working I'm sure I am misunderstanding something about Unity vectors or something here. I am brand, brand new to Unity so this is part of the problem.

I am trying to make a simple atomic model and I am trying to model valence electrons.

I've got a game object with two children - the symbol (which is working perfectly), and a child electron.

If an atom has more than 1 valence electrons, I add those as additional child objects.

All of this is working just fine - except for one part. I have a default position for the original child valence electron, but when I try to add additional children and set their positions, they're not anywhere near where they should be.

For example:

My Model:

My base electron:

My additional electrons look like this:

And here is my output - obviously not right:

So here's my function to add additional electrons:

  void addElectrons(Rigidbody2D atom)
  {
    AtomData.AtomData atomData = atom.GetComponent<Atom>().atomData;

    if (atomData.ValElec > 1)
    {
      for (int i = 1; i < atomData.ValElec; i++)
      {
        GameObject electron = Instantiate(electron_obj, new Vector2(0.2f, 0), Quaternion.identity) as GameObject;
        electron.name = "Electron " + (i + 1).ToString();
        //electron.transform.localPosition = new Vector3(.02f, 0, 0);
        electron.transform.localScale = new Vector3(.05f, .05f, 0);
        electron.transform.parent = atom.transform;
      }
    }
  }

I've tried Vector2 (currently shown above), a new Vector3 in transform.localPosition (shown and commented out), as well as in transform.position (not shown, but similar to localPosition).

What exactly am I doing wrong here? I am strongly guessing that I am misunderstanding the vector math or something here.

sentences:
Pixel thin lines appearing between sprites on camera move I'm going to apologize in advance for the lack of screenshots, but this was a very hard thing to capture, but very obvious to see.

I'm using LibGDX to create a tile base rogue-like. Everything is going alone smoothly and working well, but there is one graphical glitch that is very bothersome. I have the camera LERPing towards the player, but this smooth movement causes very small gaps to appear for about a frame between the floor tiles that's quite distracting.

The tile rendering code looks something like this:

for(int y = 0, i = 0; y < mHeight; y++) {
    for(int x = 0; x < mWidth; x++, i++) {
        batch.draw(mTiles[i].textureRegion, x * TILE_SIZE, y * TILE_SIZE);
    }
}

Where mTiles is a 1D array representing the 2D dungeon, batch is the main SpriteBatch used for rendering, and textureRegion is the TextureRegion of the tile.

The camera code looks like this:

pos = mEntity.getPosition();
mCam.position.x = MathUtils.lerp(mCam.position.x, pos.x * TILE_SIZE, delta);
mCam.position.y = MathUtils.lerp(mCam.position.y, pos.y * TILE_SIZE, delta);

The problem is solves if I cast the result of the LERP to an int, forcing the camera to line up with the tiles, but it's not ideal. I also tried creating a new texture of the entire dungeon floor from the texture regions that make it up, but there doesn't seem to be any elegant way to do this.

Anyone else face a similar situation? I'll try and capture some screenshots and post them later.

sentences:
Detecting Left and Right Mouse clicks on UI Text objects that are dynamically created So, in my game I create a bunch of UI Text game objects dynamically (in the C# script), but I just can not find out how to properly detect Left and Right mouse clicks on these UI Text that were dynamically generated.

I have tried adding Colliders and Colliders2D to the UI Text game objects for raycasting, but with no luck. And differently from UI Button, it seems that Unity has left proper "on mouse click" functions out from UI Text

Can anyone help out on how to accomplish that?

PS: no, I can not use UI Buttons, it has to be Texts. And the UI Texts have to be generated on the fly, not in the editor

sentences:
Pack four alpha maps into one I have read an article about texture splatting that says:

  Because the alphamap only has to be in a single channel of a texture,
  we can pack up to four alphamaps into a single texture – one in red,
  one in green, one in blue, and one in alpha.

But it does not mention a way to this. Can anyone tell me or point me to an article on how to do this? I've been googling it the whole afternoon but can't find any. Or maybe I just don't know the correct terms to search. :?

Thanks.

sentences:
Typedef redefinition error when running Unity iOS project in Xcode 9 simulator I was able to run my Unity 2017.1.0b10 iOS project successfully on my iPhone 6S+ (Using Xcode 9). I changed the Target SDK to Simulator SDK to try it out on other device simulators then I got the following errors in the UnityMetalSupport.h file.

Below are screenshots of my player settings:

sentences:
Lua Unknown error when typing something in Zerobrane studio IDE What is this weird error that I am getting when I typing something in the Zerobrane studio IDE? It crashes my IDE. But The game project compiles and runs fine.

When I turn off "Autocomplete Identifiers" from Edit menu, then the error doesn't come up.

Also, I searched entire google and facebook for some help or solution but no luck at all.

sentences:
Explain Reciprocal Velocity Objects to me This is follow-up on this question (Unit collision avoidance for RTS)

I'm developing an RTS. I'm having difficulty with collision detection... I looked up RVO and it seems like the correct solution, but I'm having difficulty understanding how it exactly works. Can someone explain the math behind RVO in comprehensible terms?

I tried compiling the RVO sample program but it won't compile in the latest version of Visual Studio. I'm stumped.

sentences: In terms of Game Design, is the definition more of designing the ENTIRE game, or can it be limited to contributing to the artwork? 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.

sentences:
Prefab sorting layer wrongly displayed I have a prefab 'WhiteSmoke' that should render on top of the other objects on my game view but instead it just stays behind. The sorting layer some you see on the image named 'smoke' is the top layer, changing it to default and keeping the big order in layer number does not solve the problem.

The canvas render mode is ScreenSpace-Overlay.

Have any idea what I'm missing here? I don't know what else to try.

sentences:
storing game options in java I'm making a game using java. I'm wondering what would be the best way to store games options (like screen height and width, full screen boolean and many other similar options the user can select) at run time?

Currently, I read the options from a text file so everything that comes out of the reader is a string. I would like to add the value of the string to the appropriate variable in as few steps as possible. I would also avoid having to code getters and setters for all variables there is and have a general getter and setter that takes the name of the option as a parameter.
ex:

    public void set(String name, Object value){
        options[name] = value;
    }

    public Object get(String name){
        return (Object options[name]);
    }

I was thinking about a hashmap of variable names and values but the problem is: not all variables are of the same type, I'll have ints and doubles and booleans. so what would be the best way to store all those different variable types and access them with general calls? Should I leave them as Object and cast them as I need to use them? Or do i really have to set them all manually in my code (which would be quite the hassle should i decide to add more options down the line)?

UPDATE: So, here's the code i got so far for serialization but still not working:

Options.java:

public class Options implements java.io.Serializable{

//Final variables declaration
static transient final String SAVE_DIR = System.getProperty("user.dir") + "\\res\\saves\\";
static transient final String OPTION_FILE = "options.ser";

//Static variables declaration
public int s_width;
public int s_height;
public float fov;
private static transient Options instance;

private Options()
{
    this.s_width = (this.s_width == 0)? 800 : this.s_width;
    this.s_height = (this.s_height == 0)? 600 : this.s_height;
    this.fov = (this.fov == 0)? 60 : this.fov;
}

public static Options GetInstance()
{
    if(instance ==  null)
        instance = new Options();
    return instance;
}

Serializer.java:

public class Serializer {
private static Options o = Options.GetInstance();

    public static void loadOptions()
    {
        File dir = new File(Options.SAVE_DIR);
        if(dir.exists())
        {
            File file = new File(dir + "\\" + Options.OPTION_FILE);
            if(!file.exists())
            {
                saveOptions();
            }

            try {
                FileInputStream fileIn = new FileInputStream(file);
                ObjectInputStream in = new ObjectInputStream(fileIn);
                o = (Options) in.readObject();
                in.close();
                fileIn.close();
            } catch (IOException | ClassNotFoundException e) {
                e.printStackTrace();
            }
        }
        else
        {
            dir.mkdir();
            saveOptions();
        }
    }

    public static void saveOptions()
    {
        File dir = new File(Options.SAVE_DIR + "\\" + Options.OPTION_FILE);
        try {
            if(!dir.exists())
            {
                dir.createNewFile();
                o = Options.GetInstance();
                System.out.println("otpion.ser created and initialised succesfully!");
            }
            FileOutputStream f = new FileOutputStream(dir);
            ObjectOutputStream out = new ObjectOutputStream(f);
            out.writeObject(o);
            out.close();
            f.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

sentences:
How to solve the Google Ads problem in iOS? Step 1: I'm implementing a Google AdMob using this link.

Step 2: When I import this plugin in unity->build(ios)-> and implement in xcode then  give this error: 'GoogleMobileAds\GoogleMobileAds.h' file not found

I'm tried this one for iOS
but the error is still not solved.

Reference:

GoogleMobileAds.h Not Found

I'm surfacing this problem the last 3 days - what is the issue with the plugin?

sentences:
LibGDX - TiledMap Unit Scale I'm working on a 2D rpg-style game and I'm currently rewriting my game to get a more clean and structured code. Some thing that has been bugging me is that I have no idea how unit scales work with the OrthogonalTiledMapRenderer, it's kind of like a "Hey it works, I don't know how, but it works" solution. Basically to scale my map up, since it's a pixel game I use

renderer = new OrthogonalTiledMapRenderer(map, 4);

which seems completely wrong since I've seen other examples using things such as 1/32f. However using that makes me unable to even find my map in game when moving the camera.

I've looked up on unit scales but I have a hard time grasping why and how I should use them and if they are really necessary. And by using the code above, which I'm guessing I use the wrong way, does that bring any problems?

Thanks in advance!

sentences:
How to prevent object from moving when it's mesh/collider is being updated? So I a made a script that lets the player grab a vertex, move it, and then update the mesh. To help prevent the player from trying to clip it through other objects I made it so the mesh/collider is constantly being updated. It works however there is an issue where it keeps falling into itself. So I tried updating the constraints to prevent this but it doesn't seem to help anything.

Visualization...

With the mesh being updated after the LMB is released: http://gifyu.com/images/withnocollisionprevetnion.gif (SE doesn't like non-imgur links apparently and they are too big for imgur).

With the mesh being updated in real time: http://gifyu.com/images/withcollisionprevetnion.gif

Also here is a gif showing how constraints on the RB don't solve the problem
 (I've tried freezing on different axes but those still cause issues too): http://gifyu.com/images/constprob.gif

So basically what can I do to prevent the object from moving when it's mesh/collider is being updated?

sentences:
How can I avoid assets reload if an Android activity is re-created? I've put my libGDX view inside a bigger Android layout. When the user rotates the screen, a new layout specific for the orientation is drawn, for this reason, the activity is rebuilt from scratch forcing the libGDX view to reload all assets.

I tried to store these assets in a static variable, but on the second time I create the libGDX view, they are not rendered correctly (it looks like textures are not loaded and everything is transparent).

How can I avoid reloading heavy assets (models and textures)?

sentences:
Should I package and sell my game on the unity3d asset store? I'm trying to figure out if I should refurbish and refactor a game I and some friends have made. It's released on kongregate and wasn't a super hit but I feel there's a lot of interesting techniques and solutions going on that new or intermediate developers would like to see. The only thing that's holding me back is that I don't know if people are interested in it at all. Would you be interested in buying the source code and assets for this game?

Check it out and you'll see that there's a lot of things happening in the game. If we packaged it and sold it, we would of course tidy it up a bit which would involve more work so I would really appreciate your honest opinion.

We've looked around and haven't found actual released games in the unity3d asset store. Maybe we just didn't look enough though. We're thinking of setting a price tag of between 150 and 200€. What's your opinion on this price?

And in general, what's your opinion on selling assets and source code? Should I be wary of any legal implications (like my customer licensing my stuff and then forbidding me from selling it)?

I posted this over at UnityAnswers as well but I know I rather go here for gamedev questions so I'm hoping other unity devs will drop by here too.

Edit:
Reconsidering after getting some great advice we'll probably rip out the assets only and market those as space stuff or something. We'll then market the assets with the help of some free classes of code showing off some of the examples that were hard for us to do when we were (more) beginners. The unify wiki might benefit from having some of the code that we've done and that isn't all that hard but a bit tedious.

If we actually "finish" the game (it is indeed an asteroids spinoff and was never intended to be anything else, apart from some sandbox modes we've been experimenting with) we'll probably sell it with a decent price tag for an indie game like this.

sentences:
Determine if ray hits an edge of a model in Unity 3D How can i determine if a ray was hitting an edge of a mesh?

The figure below shows what I want to achieve:

Any ideas?

sentences:
Inherited property in derived class reference only base class [Context] I am developing a game in Unity, and wanted to make a Game Manager. Like many examples out there, it uses a Singletron design pattern. But i have several other Managers, all using Singletron pattern, so i decided to make a Singletron base class and make all the managers derive from it. When trying to access the Instance property declared in Base Class within one method in Game Manager derived class, the Instance property refers to the Singletron base class, which is expected.

But it`s not the behaviour i need. I have tried to look for alternatives, but everytime i found a possible solution, i have to declare the member variables/properties in the derived class, and there would be no need to a Singletron Base Class.

I have also looked for generic alternatives (Singletron < T >) but it was not clear how to use these without the need of another script calling it, which would be nonsense since the Game Manager should be the object to manage the game. I could use something like a root game object to creat the managers is instances, but it feels like a ugly and inelegant solution.

The managers are all coded, and this refactor would improve code maintenance, in future.

[Code from Singletron Base Class]

public abstract class Singletron : MonoBehaviour
{
    public static Singletron Instance { get; protected set; }

    protected virtual void Awake ()
    {
        if (Instance == null) {
            Instance = this;
        } else {
            Destroy (gameObject);
        }

        DontDestroyOnLoad (gameObject);
    }
}

[Pertinent code from Game Manager Derived Class]

public class GameManager : Singletron
{
    public List<GameObject> gameObjectsList;

    public static void SomeMethod()
    {
        foreach (GameObject go in Instance.gameObjectsList)
        {
            go.DoSomething();
        }
    }
}

[Question] What can i do inside Singletron Base Class to make the Instance.gameObjectList refers the actual class (in example, Game Manager Derived Class) so that i could use the gameObjectsList? Should i cast it to the pertinent manager inside the method (which seens like an inneficient option)?

Thanks in advance!

[Edit] Looking into design patterns page in wikipedia, i found another design pattern related to singletron. In my case, each manager follows the singletron pattern, but its somewhat equivalent to my singletron base class following a Multiton Pattern

sentences:
Move circle inside semi-circle based on external object I have a circle that I'd like to move around in semicircle with it's location following an external object.
I can get the direction the circle should be facing with something like this:
Vector3 targetDir = X.transform.position - circle.transform.position;

How can I stick the movement of the circle inside a semicircle?

sentences:
Can I use fictional city/country names from public domain/fiction etc. in a potentially monetized browser game? I'm currently developing a browser game with a focus on economy, trading and industry. For that I'm building a fictional world with countries and cities. To avoid political drama within the games player interactions, I'd like to avoid using real countries that currently exist/are recognized. I tried to come up with several fictional country names, but I'm reaching the limitations of my creativity where they are still OK-sounding...
My questions are now...

Can I use fictional countries e.g. from movies/comics etc (e.g. Sokovia from the Marvel universe)? Maybe with slight adjustments?
Can I use older country or empire names (e.g. Babylonia)? Maybe also with slight adjustments.
Can I use city names from the real world? I need a lot of them, so coming up with thousands brings me to my limit and there may probably be overlaps without me knowing. Based on the following question that should be fine, also since they have nothing to do with the real-life equivalents. Do I need licensing to use real city names in my game?
What about using planet or galaxy names which are public domain (or how are they protected, if at all)?

I found some generators in the internet which are helpful to a certain degree, but I'd rather write my own to be honest.
Since the game might be monetized, are there any licensing issues involved? I'm pretty new to this from a legal perspective.

Another thing are the fictional company names the users can choose. I guess I can set certain restrictions there to exclude real world companies and provide a "report" button for real companies to request the removal/change to be on the safe side.

Thanks in advance

PS: Since I also needed flags, I already found a nice generator, in case someone is interested:
https://www.reddit.com/r/vexillology/comments/4ha19q/flagmaker_20/?st=jb6e4qyk&sh=c1544079

sentences: How can I create beautiful, random, abstract images? To generate random, beautiful, abstract images – which algorithms are not too complex and give good results?

sentences:
Bartle taxonomy formula Anyone knows the formula inside the Bartle Test of players taxonomy?

I need to do the test, but I need the weight of each question to make something more accurate and trustworthy to the real test...

Some links to the online test:

http://matthewbarr.co.uk/bartle/
http://4you2learn.com/bartle/

sentences:
Rotating a vector by a quaternion I am trying to rotate a direction vector (0,0,1,0) by a rotation quaternion in DirectX.

From what understanding, to rotate the vector you must do

NewVector = rotQuaternion * Vector * inverse(rotQuaternion)

In directX11, I am testing out the algorithm above using an identity quaternion.

XMVECTOR qIdentity = XMQuaternionIdentity();
XMVECTOR inverse = XMQuaternionInverse(qIdentity);
XMVECTOR test = qIdentity * XMVectorSet(0.0f,0.0f,1.0f,0.0f) * inverse;

My new test vector should just be (0,0,1,0), however it is completely zeroed out, and I am not exactly sure why or if I multiplied it correctly.

sentences:
How to update vertices and indices in OpenGL I want to change and update the vertices and indices of the 3D object.
I am new to openGL and I do not know if this the right place to ask this question.
I searched and read about that, and I found that I should bind the VAO and VBO and make that, but nothing changed in vertices and indices.
The vertices vector class type has the position, normal and uv coords and the vertices vector class type is int. I wonder how I can make changes to these two vectors when I translate or scale the model.
here is the code:
// Create buffers/arrays
glGenVertexArrays(1, &this->VAO);
glGenBuffers(1, &this->VBO);
glGenBuffers(1, &this->EBO);

glBindVertexArray(this->VAO);
// Load data into vertex buffers
glBindBuffer(GL_ARRAY_BUFFER, this->VBO);
// A great thing about structs is that their memory layout is sequential for all its items.
// The effect is that we can simply pass a pointer to the struct and it translates perfectly to a glm::vec3/2 array which
// again translates to 3/2 floats which translates to a byte array.
glBufferData(GL_ARRAY_BUFFER,this->vertices.size() * sizeof(vertex), &this->vertices[0], GL_STATIC_DRAW);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, this->EBO);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, this->indices.size() * sizeof(int), &this->indices[0], GL_STATIC_DRAW);

// Set the vertex attribute pointers
// Vertex Positions
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)0);
// Vertex Normals
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, normal));
// Vertex Texture Coords
glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(vertex), (GLvoid*)offsetof(vertex, uv));

glBindVertexArray(0);

sentences:
AI not pathing correctly with pathfinding I have implemented A* pathfinding to use in a game that im making for a project. The issue is that the AI that's using the pathfinding does not seem to wanna follow the path correctly. as displayed in the picture

blue dots = AI's path

yellow dots = path to take according to the pathfinding

red dots = impassable wall

As you can see the AI completly ignores the path to follow according to the pathfinding. I have been twisting my head multiple times around and have been unable to figure out the issue.

Below is the code where the pathfinding is used by the AI and shows all the states it cant be in. Position and rotation is applied later down in the code which is not shown here.

if (_pathState == SEARCHING)
        {
            if (glm::length(enemy->getPosition() - player->getPosition()) < 10.0f)
            {
                _isAtGoal = true;
                _pathState = ATTACKING;
            }

            _pathFinding->findPath(enemy->getPosition(), player->getPosition(), map);
            _isAtGoal = false;
            if (_pathFinding->foundGoal)
            {
                _targetPos = player->getPosition();
                _pathState = FOUND_GOAL;
            }
        }
        if (_pathState == FOUND_GOAL)
        {
            if (!_isAtGoal)
            {
                glm::vec3 targetDistance = _pathFinding->nextPathPos(enemy->getPosition(), getRadius()) - enemy->getPosition();
                angle = glm::degrees(atan2(targetDistance.x, targetDistance.z));
                rotation = glm::angleAxis(glm::radians(angle), glm::vec3(0, 1, 0));
                _velocityX += 0.1f * cosf(angle);
                _velocityZ -= 0.1f * sinf(angle);

                /*if (glm::length(_targetPos - enemy->getPosition()) < 10.0f)
                {
                    _pathFinding->intializedStartGoal = false;
                    _pathFinding->foundGoal = false;
                    _pathFinding->clearPathToGoal();
                    _pathState = SEARCHING;
                }

                if (glm::length(_targetPos - player->getPosition()) > 10.0f)
                {
                    _pathFinding->intializedStartGoal = false;
                    _pathFinding->foundGoal = false;
                    _pathFinding->clearPathToGoal();
                    _pathState = SEARCHING;
                }*/

                if (glm::length(enemy->getPosition() - player->getPosition()) < 1.0f)
                {
                    _isAtGoal = true;
                    _pathState = ATTACKING;
                }
            }
        }
        if (_pathState == ATTACKING)
        {
            if (glm::length(enemy->getPosition() - player->getPosition()) > 10.0f)
            {
                _pathFinding->intializedStartGoal = false;
                _pathFinding->foundGoal = false;
                _pathFinding->clearPathToGoal();
                _pathState = SEARCHING;
            }
            else
            {
                glm::vec3 playerDir = enemy->getPosition() - player->getPosition();
                angle = glm::degrees(atan2(playerDir.x, playerDir.z));
                rotation = glm::angleAxis(glm::radians(angle), glm::vec3(0, 1, 0));
            }
        }

The tutorial that I followed when implementing the pathfinding is from here:

https://www.youtube.com/watch?annotation_id=annotation_654919&feature=iv&src_vid=-A2HYXj186c&v=NJOf_MYGrYs

And my pathfinding is pretty much as follows. My own suspicion is that the radius is whats causing the problem, since the radius is just a set number that I didn't put any thought into when I set it.

sentences:
How many BasicEffects do you have in a Game? What is the best way to render multiple objects/shapes at once? I'm trying to understand 3D rendering and it seems that everytime you render a new object (A 3D Cube or something) you need to have a new BasicEffect for each Box you render unless you want the exact same texture?

...so if I have over a hundred boxes with each different textures, I need at least as many BasicEffects? Will that not be "too much" for the CPU/GPU in the end or result in lagging? Is there any good way to render multiple objects (cubes or other shapes) at the same time?

I've tried changing the BasicEffect.Texture with each cube drawn, but it resulting in changing the first Cube's texture too.

Any suggestions would be really appreciated, I'm really new to 3D in XNA so I'm trying to wrap my head around the best methods for example render a Map with objects (of shapes).

Example:
I create some Cube3D (by providing location and size) and it creates a list of Vertices.

I have to render it this way:

            gameEffect.TextureEnabled = true;
            gameEffect.Texture = gameTexture;
            gameEffect.EnableDefaultLighting();

            foreach (EffectPass pass in gameEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                foreach (Cube3D cube in gameCubes)
                {
                    cube.Render(GraphicsDevice);
                }
            }

...thereby having the same Texture on each Cube. Are there any other ways?

sentences:
Transactions on lists of coins of different values For learning purposes, I am developing the first steps of an idle game with exponentially higher income numbers. Usual int, long, etc. can't store big enough numbers for that.
I looked through many threads which I found on google and using a list (or an array) which is separated in e.g. bronze coins, silver coins, gold coins, etc. seems to be the cleanest version.
In my first approaches I created this list:
namespace Coins
{
    public class script_coinHandler : MonoBehaviour
    {
        public List<Coin> coinList = new List<Coin>() // list based on the "Coin" class
        {
            new Coin() { Name = "bronze"},
            new Coin() { Name = "silver"},
            new Coin() { Name = "gold"},
            new Coin() { Name = "diamond"},
        };
    }

    public class Coin
    {
        public string Name { get; set; }
        public int Amount { get; set; }
        public int Multiplier { get; set; }
    }

}

I want each coin type to go up to 999999. This means 1 silver = 1000000 bronze, 1 gold = 1000000 silver.
I can't get my head around a way to do maths with this list.
Example:
Player has 3000 GOLD, 320000 SILVER, 524321 BRONZE
Player wants to buy something for 20 GOLD, 120000 SILVER, 300000 BRONZE
Just subtracting 20 from GOLD, 120000 from SILVER, and 300000 from BRONZE won't always work. For example when a Player has no BRONZE but some SILVER - you can't subtract 300000 BRONZE without converting SILVER to BRONZE first.
Q: What would be an efficient function to subtract the price from the total amount? What about multiplying and dividing?
Accuracy is not important. When spending a few GOLD, nobody will care about 10000 BRONZE.

sentences:
How to move NavMesh Agent by animation? What's the best way to create a simple moving navmesh agent with animation? (e.g. a human enemy running to player)

I have run animation that moves the enemy

public void Run ()
{
    animator.SetFloat ("Speed", 1f);
}

but I am not sure how to combine it with navmesh.

In one tutorial I saw Standard Assets ThirdPersonController .Move(...) used for that, but I am not sure if I should use it for that purpose, as I understand it was intended only for player characters?

Or should I use animation that runs in place?

sentences:
How do I keep an MMO synchronized? I'm making a 2D, top down MMO game. ATM I can connect a player to a server and they get the map data from a DB. They can move around and hit some stuff and if they move near a viewport edge, the server sends new data etc.

Even a few players can do this, but since I don't have an, lets call it, "update manager" which tells the players where they are and the DB that the map has been altered. It's just a read only game at the moment.

My idea is, to tell the server where a player is and how big his viewport is. Then if any other player is in this viewport, the server will distribute the updates to each other player.

So I wouldn't have to tell the whole world what's going on.

The problem, however, is the ping.

If I have a ping of ~300ms, every other player would probably "jump" over the map, and not move smoothly. I could keep this synchronized with vector clocks, but it would still lag.

Also, how to keep the players from cheating? All ideas I got, don't really work. The only "safe" thing seems to be to calculate the game on the server and client, then throw away all data when the calculations are wrong. But this seems rather excessive to me.

--- Edit ---

Ok, I had some ideas after I read the comments.

I will send an absolute state to the server for ever game entity I have. This state object will consist  of the position, orientation, speed and an "action", which can be anything someone can do.
I'm gonna keep the clients seperated in "small" arrays, each representing a area of the map. So I can calculate which client is near or in my viewport and needs to get my information.
I have to find out if it's possible to get a timestamp of the request, to use it for sanity checking, so no player can send me actions from an invalid time-range to get his actions evaluated before the other players.
Only only updates from other clients and errors from the server get sent to the client, if everything is ok the server just takes the informations.

sentences:
Ball vs 45-degree slope collision detection I have a simple game in which the player moves a ball around. The ball bounces off of walls. Right now I have square walls(■) implemented: I use simple bounding-box collisions to check if the player will move into a wall when updating its x or y speed and if so, I multiply that speed with -1 to make them bounce.

However, I also want to implement triangular pieces(◢◣◤◥). To bounce back I believe one can simply use:

   newxspeed = -1*yspeed;
   newyspeed = -1*xspeed;

However, what I am having trouble with is the collision detection: When does the player hit the diagonal?

sentences:
Accounting for waves when doing planar reflections I've been studying Nvidia's examples from the SDK, in particular the Island11 project and I've found something curious about a piece of HLSL code which corrects the reflections up and down depending on the state of the wave's height.

Naturally, after examining the brief paragraph of code:

// calculating correction that shifts reflection up/down according to water wave Y position
float4 projected_waveheight = mul(float4(input.positionWS.x,input.positionWS.y,input.positionWS.z,1),g_ModelViewProjectionMatrix);
float waveheight_correction=-0.5*projected_waveheight.y/projected_waveheight.w;
projected_waveheight = mul(float4(input.positionWS.x,-0.8,input.positionWS.z,1),g_ModelViewProjectionMatrix);
waveheight_correction+=0.5*projected_waveheight.y/projected_waveheight.w;
reflection_disturbance.y=max(-0.15,waveheight_correction+reflection_disturbance.y);

My first guess was that it compensates for the planar reflection when it is subjected to vertical perturbation (the waves), shifting the reflected geometry to a point where is nothing and the water is just rendered as if there is nothing there or just the sky:

Now, that's the sky reflecting where we should see the terrain's green/grey/yellowish reflection lerped with the water's baseline. My problem is now that I cannot really pinpoint what is the logic behind it. Projecting the actual world space position of a point of the wave/water geometry and then multiplying by -.5f, only to take another projection of the same point, this time with its y coordinate changed to -0.8 (why -0.8?).

Clues in the code seem to indicate it was derived with trial and error because there is redundancy. For example, the author takes the negative half of the projected y coordinate (after the w divide):

float waveheight_correction=-0.5*projected_waveheight.y/projected_waveheight.w;

And then does  the same for the second point (only positive, to get a difference of some sort, I presume) and combines them:

waveheight_correction+=0.5*projected_waveheight.y/projected_waveheight.w;

By removing the divide by 2, I see no difference in quality improvement (if someone cares to correct me, please do). The crux of it seems to be the difference in the projected y, why is that? This redundancy and the seemingly arbitrary selection of -.8f and -0.15f lead me to conclude that this might be a combination of heuristics/guess work. Is there a logical underpinning to this or is it just a desperate hack?

Here is an exaggeration of the initial problem which the code fragment fixes, observe on the lowest tessellation level. Hopefully, it might spark an idea I'm missing. The -.8f might be a reference height from which to deduce how much to disturb the texture coordinate sampling the planarly reflected geometry render and -.15f might be the lower bound, a security measure.

sentences:
Using large textures on limited hardware I've run into a problem where some of the models that I'm loading can have very large textures (2000x2000 for example). While my desktop computer can load them just fine, my laptop gets a segfault at the glTexImage call. I've thought of a couple of things I can do in this situation:

Before giving the image to OpenGL, I could downscale it so it's below the max texture size, but I'm not sure how to then stretch the image to its original width and height
I could also outright refuse to load the texture, and replace it with a generic repeating texture, like Valve's black and purple grid, but this isn't at all reliable or desired

Are these two options viable? How is it done with game engines like Unity or Source? Are there any other options that are better than my ideas?

sentences:
Why are most windowed games not resizeable? I find it incredibly rare to find a game where the window can be resized, even if permitting it is a single click away in their game engine. For what reason is this done?

Thoughts that come to mind are...

Performance, is it possible that certain resolutions still perform better in windowed mode?
Easy switching to fullscreen, as fullscreen usually requires supported resolutions. However, I find even borderless fullscreen games still prevent resizing.
Management of aspect ratios? I don't think this would be a big issue to overcome however.

There's so many games that I want to be able to resize so I can fit them where I want on my screen, but alas, it's rare.

sentences: What is a good clock implementation for a multiplayer game? In cases where players need to send out their times for game state sync, can everyone send out their default timestamp implementation or should something like NTP be used? http://en.wikipedia.org/wiki/Network_Time_Protocol

sentences: How do I calculate sprites/frame usage on my platform's ram? I plan on building a 2d game for mobile and possibly pc. I also plan on using sprites/frames for the animation of my 2d game. What's stopping me from doing so is because I can't figure out if the sprites/frames containing the animation is gonna use up a lot of RAM on my device. Does anybody here know what I'm talking about?

sentences:
How is text/scripts/dialogue stored and accessed in games? For large, complex games, I imagine that text descriptions, dialogue lines, etc, are organized in some sort of database, and not actually hardcoded into the source.

Are there any conventions on how such textual data is organized and inserted/loaded into the game? And how does this "database" get "compiled" into the executable along with the source code? (Because for most AAA games there aren't additional files containing said database, etc).

In particular, I'd like to know how to load text into a game, without opening some external client-side file (so the client can't just browse the file and read the ending!). I don't see how an external file/database could be bundled into the compiled source executable (for example, how would you do this in C)?

sentences:
Efficient removal and adding of Components in ECS i'm working with the Ashley Entity-Component-System (related to libGDX) to program a server-side simulation for an online game and i stumbled upon a serious performance drawback, that is probably caused by how it manages Entity-Sets:

"Family", these are basically descriptors for Entities with a specific set of components.
Removing a component is an costly operation because the Family-instance needs to search through an Array of entities that it manages and remove the Entity from that Array. This is O(n) for every single removal at worst.

And here's my problem:
I have a Family that describes all Entities that do have a position and a velocity component. If i want to remove the velocity-component, for example, to turn it into an static entity and re-add it later to make it move again, this completely eats up my budget of frame time (50ms->20fps) with only ~7000 Entities changing Family back and forth within a frame. At the same time, moving 100000 entities takes only about 15ms at max (without multithreading ~30ms).

I have thought of these options yet:

-Change the data-structure that the Entities are sorted into, this creates new problems, but may still be the most viable Solution, i thought of mapping the Entity IDs to Objects or keeping them in a sorted data-structure.

-Sort everything once after a System has finished execution, requires redesigning a lot of code but probably reduces the time-consumption greatly

-Changing the Entity System, i know of Artemis, but it would be great if you could point me at something else for Java if you know a library that does it better.

-This whole thing may not even become a bottleneck when running the final game-simulation, it might or might not, so just going on and thinking about this later may be acceptable, since I'm probably over-engineering again.

What do you think is the way to go?

sentences:
Where does the game code fit into the engine? I was wondering if somebody could tell me how the game and the game engine fit into game development. What I specifically mean is, the game engine does not actually contain a game. Do game developers build an engine, then create a new class that inherits from the engine, which becomes the game?

For example,

class ShooterGame : public Engine
{
};

I'm not sure about where the game code fits into the engine.

sentences:
Advantages and disadvantages of LWJGL for a beginner? I am starting a 2D side scroller, tile based RPG sort of game in Java. I do have lots of knowledge in Java, so that's not a problem, but I have NO experience in game development, at all. I had found a couple of books / tutorials and I am trying to decide between using LWJGL or doing everything myself. What do you guys suggest?

Thanks!

sentences: Unity 2.5D Character Movement I'm wondering if anyone can point me in the right direct as to how to take a 2D character/sprite in Unity and have said character turn corners in a 3D style. Solutions or resources welcome.

sentences:
Applying an outline effect to primitives I am trying to draw an outline on a collection of quads in Direct3D. I have three intersecting quads on the same plane in the following configuration:

(The different colors here are just to visually break out the quads). Using two pixel shaders, one for the longer segments and another for their intersection (the purple quad), I am rendering this as a single color:

I would like to outline this shape, something like the following (please excuse my Paint skills):

My first approach was to write a pixel shader that would calculate the distance along the y-axis (before the transform) from the center of the quad and colorize based on that. However, when I render this, there is a problem where the quads overlap:

What is the best way to achieve my desired result? Is this possible with a texture and a clever use of blending, perhaps? What about somehow stenciling the non-outline areas?

I should mention that my outlines need to be thicker than one pixel, and that I'm working in DirectX 9 with shader model 4 level 9.1, and C++.

sentences:
How to make sure a game can be completed I'm not sure what the correct term for what I'm looking for is described, so apologies if this is a duplicate question. But is there a term/algorithm for making sure a game is "completable" with relation to an infinite scroller. What I mean by completable is that, if I had a game, where a user has to keep jumping up blocks as the screen tries to catch up with them, how would I ensure that there is always a reachable new block that the user could in theory jump to?

I know in theory I would check how high the user can jump and ensure there is a block within that reach, but is there anything else to it? i.e avoiding expensive checks when placing new blocks to make sure they're not overlapping etc?

I'm specifically looking at html5/js but I wondered if there was a term for this or a specific type of algo that I could investigate?

Thanks

sentences:
How to bounce a 2d point particle off of a circular edge In a prototype I'm building, a particle can spawn anywhere within a larger, confining circle. Important to note is that the particle will not spawn in the origin of the larger circle, but anywhere within it.

This particle will essentially be given a random x and y velocity and set on it's way.

When the particle hits the edge of the confining circle, I want it to bounce back inwards appropriately.

Unfortunately I'm extremely new to vector math, and have never really directly dealt with it before.

Given that I'm treating the particle as a point, and I don't care about any loss of force or friction, what should I ultimately do to the particle's x and y velocities after the bounce?

I will know the particle's x and y velocity, it's x and y coordinate when it hits the outer circle, the radius of the outer circle, and the x and y coordinates of the origin of the outer circle (since its origin will likely not be 0,0).

My brief research on vector math tells me I need to find the normal velocity at the point where the particle hits the outer circle and then negate that, but unfortunately I'm not sure how to do that exactly.

sentences:
Unity frame-rate drops / stall I have an issue where my game suddenly stops for a second and then continues. And I think it has something to do with my performance so I took at look at the profiler:

I tried to take a screenshot as soon as the crack happened:

However, since I am a bit new to optimization could anyone give me a helping hand on what might be the problem here?

sentences:
Multilevel 2D grid graph and A* I've coded up a little grid based dungeon game. Everything working quite nicely in a Tile[,]. The AI uses basic GOAP for tasks and A* for moving around. Tile reachability is done using a floodfill.

Thinking about what my next step would be, I decided to change the art style from being the typical dungeon to a more sci-fi approach and thought it'd be great to have multiple levels.

This is where I ran into a problem because A* in a 2d grid I understand. But adding extra levels makes it a wee bit harder. My initial thoughts would be to add connections to the next levels in 'stairs' or 'elevator' tiles and adding these to the neighbor list of a Tile for evaluation by A*.

But this throws my heuristic for a loop. I'm using Manhattan distance.

TL;DR: How should I improve my heuristic for multi level path finding?

sentences:
Import Blender files to SharpGL (openGL for c#) please i have problem with import 3D models to SharpGL (openGL in c#).
Have you got pls any project where is this problem solved?
I need create any models in for example blender, and then import to sharpGL.
I try this 4 days, and without result. Please can you post me any project with loading (obj,3ds,...) files with texturing? I do big school project and without this i never completed this project.
Thank you for answer.

Sorry for my english.

sentences: Match-3 game level generator I made match-3 game and now i trying to add level generator. Now I generate level by filling random cells with random blocks, but I want to create generator which for given number of moves and number of block kinds generate level. What algorithms I can use if they exists?

sentences:
Find point along x axis where yz plane flips to back facing after perspective projection. Have a solution but don't know why it works I am trying to find the point along the x axis where a plane with normal pointing along the x axis would flip to back facing after perspective projection. Essentially the red line in this image.
My first attempt to find it I just sampled along the x axis checking if a triangle there was back facing after projection. This only gave me an approximation but I could make the approximation as accurate as I wanted by just sampling more planes so I used this as a baseline to verify other solutions.
I then tried the following:
vec4 center = projection.inverse()*vec4(0,0,0,1);
center /= center.w;
float d = dot(center.xyz, vec3(1,0,0));
vec3 point = vec3(1,0,0)*d;

But this did not work, it was close but not right. See this image, the red line is the sampled point and the blue is the one calculated from that.
I then tried changing the calculation for center to projection.inverse()*vec4(0,0,-1,1) to see what that would look like. With the the sampled point in red, the blue line being the previous version and the green the new version. I got the following image which as you can see is still not correct.
But I noticed that the green was always directly between the blue and the red so I tried the following.
vec4 c1 = projection.inverse()*vec4(0,0,0,1);
c1 /= c1.w;
float d1 = dot(c1.xyz, vec3(1,0,0));
vec4 c2 = projection.inverse()*vec4(0,0,-1,1);
c2 /= c2.w;
float d2 = dot(c2.xyz, vec3(1,0,0));
float d = (d2-d1)*2 + d1;
vec3 point = vec3(1,0,0)*d;

Which seems to be correct but I have no idea why that works. It is always extremely close to the sampled point so I assume it is correct.
My question is why does this work?

sentences: How does A* pathfinding work? I would like to understand on a fundamental level the way in which A* pathfinding works. Any code or psuedo-code implementations as well as visualizations would be helpful.

sentences:
Is allowing the server to remotely execute code on a client a security risk? My game uses scripts that can be edited by the player and I'm trying to figure out how to handle multi-player, while still allowing custom scripts. What I am thinking about doing is having the server send it's scripts' source code over to the clients and have the clients execute that. So if a client joins a modded server, the client can use those mods, and this prevents the client from easily cheating by editing scripts.

What can I do to prevent the scripts from being abused? Or is this just an all-around bad idea?

sentences:
How do I write a shader that lights up when objects are near a surface? In this Overwatch gameplay video, the character's shield lights up white in areas that are near other objects' geometry.

Note the white edges on the blue shield, near the floor, walls and pillar.

I believe the shield has its own model and the effect is done with a shader, but I'm lost trying to figure how to translate the concept of "nearness" to shader programming.

sentences:
Unity won't compile project successfully I am trying to build the project into a Web GL, but it throws 3 errors when it reaches the "Building additional assets" stage.

Error 1
Building - Failed to write file: resources.assets
UnityEditor.HostView:OnGUI()
Error 2
An asset is marked with HideFlags.DontSave but is included in the
build: Asset: 'Library/unity editor resources' (You are probably
referencing internal Unity data in your build.)
UnityEditor.HostView:OnGUI()
Error 3
Error building Player: Couldn't build player because of unsupported
data on target platform.

Things to note:

I do not use NGUI or any other third-party GUI solution, but Unity's
new UI system
I have tried versions 5.2.3 and higher and it still has returned me
errors
I have one DLL LitJson that is used to parse JSON files
Project includes StreamingAssets and Resources folders
Error occurs even if I try building on other platforms such as
Windows. Same errors are returned
I am using a custom font downloaded online
Blacksmith's Character "Challenger" is also included
I thought the project folder has been corrupt so I decided to migrate
all assets to a clean project. No changes

Any idea how do I fix these?
Thanks in advance!

sentences:
Heightmap and Textures Im trying to find the "best way" to apply a texture to a heightmap with opengl 3.x.

Its really hard to find something on google because tutorials are olds and they're all using different methods, im really lost and i dont know what to use at all.

Here is my code that generates the heightmap (its basic)

    float[] vertexes = null;
    float[] textureCoords = null;

    for(int x = 0; x < this.m_size.width; x++)
    {
        for(int y = 0; y < this.m_size.height; y++)
        {
            vertexes ~= [x, 1.0f, y];
            textureCoords ~= [cast(float)x / 50, cast(float)y / 50];
        }
    }

As you can see, i dont know how to apply the texture at all (i was using / 50 for my tests).

Result of that code :

I would like to have something very basic like :

(you can find more pics in his blog)

Edit : my texture size is 1024x1024.

sentences:
Create and use a Button class on AS3.0 I am currently working on a game and it is all going well.
On the shop screen there are several buttons that affect the player's stats for when the player restarts the game.

The button's names (with a text on the left), however, are rather cryptic and it's hard to figure out what they do unless you test or something.

So the solution I came up with, is to create an InfoBox with an InfoText inside so that when the cursor is over the button it appears with the description, cost and etc.

This I managed to do too however, the way I was about to do it would mean that I had to create 3 event listeners per button (CLICK, ROLL_OVER, ROLL_OUT) and, obviously, 3 functions connected to each event listener.

Now, I don't mind much about having 1 event listener per button, for the click, but since the other events are just to make a box appear and disappear as well as display some text, I thought it was way too much of a mess of code.

What I tried to do: I created a new class called InfoBoxButton, and this is the class' code:
    package  {

import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.ui.Mouse;
import flash.events.MouseEvent;

public class InfoBoxButton extends SimpleButton
{
    public var description:String;
    public var infoBox:InfoBox;

    public function InfoBoxButton(description)
    {
        this.addEventListener( MouseEvent.ROLL_OVER, displayInfoText, false, 0, true);
        this.addEventListener( MouseEvent.ROLL_OUT, hideInfoText, false, 0, true);
    }

    private function displayInfoText()
    {
        infoBox.infoText.text = description;
        infoBox.visible = true;
    }

    private function hideInfoText()
    {
        infoBox.infoText.text = "";
        infoBox.visible = false;
    }
}

}

But now I don't have an idea how to associate it with the button, I have tried this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

The SoonButton is a button I made on the shopscreen, SoonButton is it's instance name, but I can't think of a way of associating one button to the other... I have been fiddling with the code for like 3 hours yesterday and no luck... can anyone give me some pointers on how I should go about doing it?

--EDIT--

I tried to trace the SoonButton after it is created like this:
    public var SoonButton:InfoBoxButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

and I got an error saying:
    1120: Access of undefined property SoonButton.

if I separeted the first line a bit to:
    public var SoonButton:InfoBoxButton;
    SoonButton = new InfoBoxButton("This is merely a test");

    trace(SoonButton, "whut?");

I would get the same error but two times, for each SoonButton... so clearly it must be the InfoBoxButton that isn't being created... what am I missing?

sentences:
What are "free vertex indices" in WebGL 2 and how do they relate to geometry shaders? In January Notch tweeted about WebGL 2:

WebGL 2 is happening. Bye, compatibility! Hello, 3d textures and pixel buffers!
oh god it's got free vertex indices in the shader. That is basically a geometry shader.
.. which is great considering I'm rendering like five triangles..

What are these "free vertex indices" and how do they relate to geometry shaders? I'm new to all this and my google-fu is failing me on this occasion.

sentences:
Profiling the GPU of a tablet We are working on a tablet game in Unity Pro (for the first time). Unity's profiler works great for probing the CPU, but the tablet's GPU isn't supported in the profiler, so we have no idea where the rendering bottlenecks are.

Are there any other means of profiling the GPU of an android tablet? (We are working with a Samsung galaxy tab 2 10.1 ) How do other mobile devs do this?

We are basically looking for any ways of getting info from the gpu as we're running the game. Benchmarking software wouldn't help; we don't need benchmark scores.

Cheers!

sentences:
How Could I accommodate Gender Fluid Players In My Game I'm world building for a fantasy MMORPG and I really want to have a safe and acceptable environment for all possible players. Of course I am going to be realistic and have prejudice in game, it wouldn't be believable if everyone got along. However I personally feel that if a paying consumer of my game feels like having a non binary character, why should I limit them and make them feel uncomfortable? They could always make two separate characters, but then there's a lack of sync and feeling that they are one person. My team also discussed having a feature that switched between avatars while keeping gear and skills. Another idea was a sort of illusion spell that would alter the players body to a set form based off of their original facial shape and general traits. I would like to hear more suggestions and thought of this topic in games, or if something like this has been done before, even if it was not intended for gender fluid people.
In the end I would like to have a believable way for a player to switch between male and female in game.

Previous Comments

Do characters in the game have the possibility to beget offspring (male) or to give birth to offspring (female)? Otherwise, they are not male and female, but rather masculine and feminine: which is a much simpler problem, and one that should have minimal impact, if it has any impact at all. Actually, what exactly would be the impact of switching the identifier of a character from Cao Pi to Guo Nüwang? (One of those names is feminine, and the other masculine; which is which is left as an exercise.)

We are working on a function for players to have NPC children. So if they had gotten pregnant they would not be able to change the sex of their avatar, that would cause problems. This is more of gender and appearance, not so much biological sex. Though I guess it would be plausible for them to be pregnant, and then get some one else pregnant after giving birth. If of course it wasn't illusion magic.

It seems like you already know your answer. If it's about gender and appearance, then it's about how a character is physically portrayed. Right? So for example, in an typical MMORPG, you purchase a breastplate from the local armory, you'll have a 'male' version and a 'female' version. Perhaps just give an option to purchase a variety or degree of masculine and feminine armor regardless what biological sex your player is. For example, a male player can purchase a very feminine looking breastplate.

we have plenty of possible answers. It's more of what would make people feel most comfortable. A lot of gender fluid people can have body dysmorphic disorder, and some of them play games for gender comfort. It's like a self applied therapy where you can be what ever you identify with, and others will see and accept you as that gender. So masculine and feminine armor would work and is probably an idea we will use, we don't want someone to feel confined to one gender. Especially because gender fluid people can change from masculine to feminine day to day. the armor also means they may have to buy multiple sets. also some one may feel strongly masculine one day, and strongly feminine another, making a gender ambiguous character a bit awkward.

sentences:
How to handle multiple enemies with the same script? i'm working on a basic Top-Down Shooter, kind of like... Nuclear Throne or The Binding of Isaac, but since i'm new to Unity, and it's something i'm required to do for school, i'm quite in a rush so i didn't have enought time to look at all the documentation i should've, so i apologize if i'm asking too much.

The thing is like this : I have the Player that moves around, and a Sword that rotates in the mouse direction, clicking the mouse activates a Trigger Collider around the Sword, and it's suposed to Hit all enemies inside its range

The problem :

How should i "plan" my Scripts? i mean, i have a Sword script that handles the click and the OnTriggerEnter, and it should, somehow (Working on it), check if it hit an enemy, and access the Enemy Script to modify its Life Points, but how do handle the GameObject Enemy = GameObject.FindObjectWithTag("Enemy")[...]? since this just gives me one enemy...

I apologize again since i'm really bad at focusing on one point, i dont think it's neccessary to provide all the code since i dont really need you to provide me with code, just... guidelines or a basic pattern of doing this kind of things.

Thank you a lot!.

sentences:
Drag an object in unity3d I want to drag an object to a perticular place.In case I release that dragged object before I reach that particular area ,the object should come to its initial place where i start to drag.  How it possible? Is there any specific motion for this?

void OnMouseDown()
{

    drag = true;
    //Debug.Log("haii ");
}
  void OnMouseDrag()
{
    if(drag)
    {
        var pos =Input.mousePosition;
        pos.x =Mathf.Clamp(pos.x,0,Screen.width);
        pos.y =Mathf.Clamp(pos.y,0,Screen.height);
        if(zdist>0)
        {
     zdist=Vector3.Distance(Camera.main.transform.position,transform.position);
            pos.z=zdist;
            pos = Camera.main.ScreenToWorldPoint(pos);
            transform.position =pos;

        }
    }
}

sentences:
Invoking a common method after a button press I want to implement a common method that handles several numeric values and performs and action based on those values. So I have buttons with specific methods to change this values without affecting the rest. However I want to link them all to a final method that runs right after the press of a button, so this way the game will change only when the player chooses to change it and changes according to the players decisions. How can I implement this in my script?
Most of my methods are like this:

public void "ButtonIDGoesHere" (int "SpecificVariable"){
//Add, Sub, Multiply, etc.

}

What can I add so that it goes to a common method right after it executes its instructions?

sentences:
How do I rotate a sprite so that it is 'pointing' in the direction it is moving? I have a sprite, e.g a missile, heading in a certain direction (using a velocity vector).
How do I figure out its how much to rotate it so that it gets drawn 'pointing' in the direction it is heading?

sentences:
Partially colorizing a sprite in XNA I'm looking for a clean way of making sprites that look like the following glowing circle, except in any arbitrary colour.

Originally we thought we could start with a gray-scale version of the above image (shown below) and then use the tint parameter in spriteBatch.Draw to change the colour of the glow.

The problem is that because spriteBatch.Draw uses multiplicative blending to blend the tint and the colour the white parts don't stay white, they become the colour of the tint. The next image shows (approximately) what this looks like.

The other solution we thought of is to have two separate sprites, a white interior and a grayscale glow, and then we apply the tint to the glow and draw that on top of the white interior. This produces the desired effect (to a degree) but is annoying on our part since it requires is to double all the sprites we want to draw this way.

Is there any other cleaner solution that produces the desired effect for an arbitrary colour?

sentences:
Ray-Triangle Intersection: does the direction of the triangle normal matter? Found an article here about ray triangle intersection: https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution
It states that D of plane Ax+By+Cz+D = 0 can be found as triangleNormal.Dot(triangleVertex).
But depending on the sign of the normal, D would have a different value. Doesn't that make a difference as to which side of the origin the plane lays? Doesn't the normal of the triangle always need to face the origin for this equation to be correct?

sentences:
Where can I find True Type fonts that are free for commercial use? Possible Duplicate:
  Where can I find fonts for my game?

Does anyone know of fonts that are true type and unicode that can be used in a commercial game for free?

sentences:
3D pathing finding with flying Does anyone know of a (free or paid) solution that enables 3D path finding?  Basically something like:

CalculateRoute(input_geometry, start_pos, end_pos, variance)

I found a good paper on the topic, but I haven't found any solutions via Google or even searching sites like odesk, etc...

I know recast/detour is great for ground navigation, but I can't find anything that involves flying/3D space.

Any suggestions would be great to existing solutions.

sentences:
Cross & dot product using ASSIMP's aiVector3t vector class I'm using ASSIMP's built in aiVector3t class but I can't find any mention of dot product or cross product in the class documentation.

Are these operations defined? If so what is the syntax?

sentences:
How can I analyze which level on which of three difficulty settings causes players to quit my game? I have a puzzle game with N stages where each stage has 3 difficulty levels. Users have to finish current unlocked stage to access next stage, but they can access any difficulty level for unlocked stage.

As example, User A played stage 1 with difficulty level EASY, then he changed the difficulty level to HARD and finished stage 2.

I'm using Flurry Analytics to log as above: "stage1_Completed_Easy" and "stage2_Completed_Hard"

The problem is: there could be more users completed stage N than those who sompleted stage N-1
As example,  there are:

100 players completed stage1 EASY
50 players completed stage1 HARD
50 players completed stage2 EASY
25 players completed stage2 HARD
70 players completed stage2 NORMAL

I'm making assumption that each player only completed each stage once. This means from stage 1 to stage 2, I'm losing 5 players

I want to know which level and what difficulty that makes users stop playing my game

sentences:
Skeletal Mesh Cloth Simulation bug (UDK), unexpected behaviour When I try to move to the left (A) the pawn and the cloth move to the left,
and when I move to the right (D) the pawn and the cloth move to the right too...

Why the cloth always goes in same direction than the pawn? I would expect the cloth to go in the opposite direction, like dragged by the pawn.

To anyone who's experienced with pawn with cloth simulation: please help me T_T

Flag model for testing :
Flag bug

sentences:
boost/geometry replacement in Java/for the JVM (Destructable Box2D terrain) I'd like to reimplement https://github.com/seemk/DestructibleBox2D in Java. The main problem is finding an adequate replacement for the boost/geometry library.

Any ideas?

sentences:
When serializing a class, can its fields take their defaults from the Unity editor? Can I have a custom serialized class whereby I set a value in the editor and that value persists into runtime, as happens with serialized monobehaviour fields?
Currently it sets itself to 0 or a default hard coded from within the class.
I noticed that using a struct actually works but using a struct breaks the events used in my actual use case (included below).
Example code:
public class Class1 : MonoBehaviour
{
    // this variable can be set in the editor and persist into run time
    [SerializeField]
    private float testVar1;

    // this variable can not
    [SerializeField]
    private Class2 class2;

    private void Start()
    {
        class2 = new Class2();
    }
}

[Serializable]
public class Class2
{
    [SerializeField]
    private float testVar2;
}

My use case:
[Serializable]
public class EditorFloat
{
    [SerializeField]
    public float value;
    public EventProperty<float> eventProperty;

    public EditorFloat(EventProperty<float> eventProperty)
    {

        this.eventProperty = eventProperty;
        Object.FindObjectOfType<CentralParams>().OnUiChange += Update;
        this.eventProperty.OnChanged += UpdateEditor;
    }
    public void Update()
    {
        eventProperty.Value = value;
    }
    public void UpdateEditor(float valueFromEventProperty)
    {
        value = valueFromEventProperty;
    }
}

Thanks!

sentences:
How to change TPS camera angle in Unity I'm very new to Unity and this may simply be a failure of google-fu but I hope someone here can help me out.

I'm working through a series of tutorials on how to create an RPG in Unity, making small improvements and embellishments as I go to make sure I understand the concepts.

I've built a player character with walk and run animations and a camera which follows the player around and stays aimed at the centre of the character model using the following code.

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

public class CameraFollowPlayer : MonoBehaviour
{
    GameObject target;

    // Start is called before the first frame update
    void Start()
    {
        target = transform.parent.gameObject;
    }

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

The problem with this is the angle this leaves the camera pointing at in-game is to acute, making it difficult to see what is ahead of the character. How can I adjust the target of the LookAt instruction to result in a shallower X-axis rotation of the camera?

sentences:
How to create array with unique sprites? in cocos2d iphone I write the code like this. This displays only one sprite (red colour bubble) with number of times and moving down, but actually I want to display different sprites (different colour bubble) every time and moving down. I also add no of .png images in resource folder of my project. Here I used only 3.png, but I need to display all *.png images (different colour bubbles) in my project but I don't know how to get this.
Please help me
Thank you.
Here is the code:

-(void)addTarget {
CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)];

CGSize winSize = [[CCDirector sharedDirector] winSize];
int minY = target.contentSize.height/2;
int maxY = winSize.height - target.contentSize.height/2;
int rangeY = maxY - minY;
int actualY = (arc4random() % rangeY) + minY;

// Create the target slightly off-screen along the right edge,
// and along a random position along the Y axis as calculated above
target.position = ccp(winSize.width + (target.contentSize.width/2), actualY);

[self addChild:target];

// Determine speed of the target
int minDuration = 4.0;
int maxDuration = 12.0;
int rangeDuration = maxDuration - minDuration;
int actualDuration = (arc4random() % rangeDuration) + minDuration;

// Create the actions
id actionMove = [CCMoveTo actionWithDuration:actualDuration position:ccp(-target.contentSize.width/2,actualY)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
[target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];

// Add to targets array
target.tag = 2;
[_targets addObject:target];
}

-(void)gameLogic:(ccTime)dt {

[self addTarget];

}

-(id) init
{

if( (self=[super initWithColor:ccc4(255,255,255,255)] )) {

// Enable touch events
self.isTouchEnabled = YES;

// Initialize arrays
_targets = [[NSMutableArray alloc] init];
_projectiles = [[NSMutableArray alloc] init];
// Get the dimensions of the window for calculation purposes

CGSize winSize = [[CCDirector sharedDirector] winSize];

[self schedule:@selector(gameLogic:)
interval:1.0];
[self schedule:@selector(update:)];

}
return self;
}

- (void)update:(ccTime)dt {

NSMutableArray *projectilesToDelete = [[NSMutableArray alloc] init];
for (CCSprite *projectile in _projectiles) {
CGRect projectileRect = CGRectMake(projectile.position.x - (projectile.contentSize.width/2),
projectile.position.y - (projectile.contentSize.height/2),
projectile.contentSize.width,
projectile.contentSize.height);

NSMutableArray *targetsToDelete = [[NSMutableArray alloc] init];
for (CCSprite *target in _targets) {
CGRect targetRect = CGRectMake(target.position.x - (target.contentSize.width/2),
target.position.y - (target.contentSize.height/2),
target.contentSize.width,
target.contentSize.height);

if (CGRectIntersectsRect(projectileRect, targetRect)) {
[targetsToDelete addObject:target];
}
}

for (CCSprite *target in targetsToDelete) {
[_targets removeObject:target];
[self removeChild:target cleanup:YES];
_projectilesDestroyed++;
if (_projectilesDestroyed > 30) {
//GameOverScene *gameOverScene = [GameOverScene node];
//  [gameOverScene.layer.label setString:@"You Win!"];
//  [[CCDirector sharedDirector] replaceScene:gameOverScene];
}
}

if (targetsToDelete.count > 0) {
[projectilesToDelete addObject:projectile];
}
[targetsToDelete release];
}

for (CCSprite *projectile in projectilesToDelete) {
[_projectiles removeObject:projectile];
[self removeChild:projectile cleanup:YES];
}
[projectilesToDelete release];

}

sentences:
Available Small Open Source Game Engines for tutorial I'm learning to create a game engine from scratch in XNA. I'm seeking examples of very small game engines, specifically the architecture and structure of source files, etc. It should include a scripting engine. Articles are also appreciated.

More specifically, I have a problem knowing how to connect the scripting engine to the rest of the game engine, like loading a models from the script.

sentences: Would making a satirical version of someone else's character get me sued? Licensing the rights to a popular character is definitely a hard process. Rather than licensing the rights to (insert hero here), what if I were to make a satirical version of the IP owner's character(s) like Spaceballs did? What sort of legal trouble could I face for making a satirical rip-off of a character?

sentences:
How can I make sure my game runs on older GPUs than mine? My game must stay at 75fps to be playable (I'm developing for the Oculus Rift) and I'm optimizing with that hardware in mind.

My mid-range Nvidia GTX 650 Ti struggles a little with some Rift demos, but most do OK at medium-low graphics settings. I believe it's a reasonable optimization target if I want to enable more people to play my game.

Now, I've acquired a better-performing GTX 970, but I'd like to still optimize for older hardware. I don't want to be spoiled by my current better performance and develop something that could run only on high-end cards. In a few days, I won't have my old card available to me anymore.

While developing, how can I test if my game still runs at acceptable frame rate on older GPUs?

What I have in mind is to benchmark my GTX 650 now with some software, then underclock my GTX 970 until I get to the older card benchmark score. Is that a good approach? Would it effectively have the same performance?

If yes, what about memory and shader clocks? How can I objectively benchmark them separately?

(If relevant, I'm using Unity and Unreal Engine 4.)

sentences:
Multi-threading for rhythm game? I'm trying to recreate a rhythm game. However trying to get the key-presses with SDL2 I ran into the problem, that you can only get an event every time a frame has been successfully rendered (I can't poll the events from another thread than the main thread). As you could separate game-logic from rendering, I thought I could run the game logic (including the polling of the events) for every 1ms and render the screen for every 16ms (60fps).

I read some articles stating that it doesn't make much sense to use multi-threading for that usage, but 16ms are quite a lot of latency for a rhythm game (which has about 30ms to determine a better rating for a better high-score).
(The problem is also described here: Accuracy and frame-rate in a rhythm game)

EDIT: Here It's being said that multi-threading shouldn't be used:

What is the best way to handle event with SDL/C++

Now my question is:"Should I really not separate game-logic from render logic, as I don't need visual feedback for this kind of game and accuracy is more important"

sentences:
Scaling Skeletal values to be able to reach objects on the screen I have created a game using Kinect + XNA and the game runs on full screen mode.. However when i try to touch or reach a certain area on the screen using hand.. I cant reach it.. I will already be outside the range of the sensor trying to touch the object on the game screen..

Is there anyway I can scale the skeletal values so that the users can easily touch objects on the screen without having to stretch or bend too much?

sentences: How can I implement dialog trees into my game? What is the best way to implement a dialog tree system in my game? I want an NPC to give the player different sets of responses, some which may only appear when the Player has an item or a previous event has occurred.

sentences:
Client code handling its own generics when returned by an engine I'm writing a game engine in Java 8, and have prototype client code written in Groovy.

New Game objects can be created with a builder which defines everything which fills in the blanks. To simplify things, suppose the only thing the Game class needs is a mapping of keyboard inputs (which both the client and engine know about) to dynamic input events (which only the client knows about).

The input events are defined by the client, and are only ever dealt with by the client. The engine acts only to notify the client that an input has occurred which has been mapped to that input event. At that point, it then calls a method implemented by the client with that input event as the sole parameter.

My goal is to have the client code which receives the input event know at compile time the type of the event which is first provided by the client when the Game object is instantiated. My initial naive attempt at this was to turn all my engine code into generic type of <T extends Enum<?>> but this just made a mess of everything, and solved nothing since the client code, as far as I know, only knows it's dealing a generic enum when it gets a callback.

Is this what I'm attempting even possible? Am I heading down the road with enums and generics?

sentences:
Creating Entities from Identifiers (C#) I am writing a game in C#/XNA. Often, it's useful to have a function like this in a game engine:

   Entity CreateEntity(string id, Vector3 location)
   {
       ...
   }

So that, for instance, you can do something like this:

   List<string> entitiesToSpawn = { "Tree", "Bird", "Flower", ... }

   foreach (string entity in entitiesToSpawn)
   {
       CreateEntitiy(entity, location);
   }

Or else you can easily store the ids in data files, or populate generic GUI elements with them, for instance. What, in your opinion, is the best way to implement CreateEntity in such a way that is scalable and preserves this kind of interface? Right now, I have a gigantic static switch statement, which is obviously not sustainable. Perhaps I can create a big static map of strings to functions? Or is there an easier way to get this kind of functionality out of my engine?

sentences:
Red5 or zendZMF or BlazeDS or Cirrus? I've been trying to develop a multiplayer turn based game which is mostly free to play - I just want to see if the game idea is appreciated - hence I want to do it with minimal cost and I'm confused which one of these to use: red5, zendamf, BlazeDS or Cirrus.

Red5 seemed the best option for me initially but getting a media server to host seems to be quite expensive. Same reason why I couldn't use Electroserver - cost. Both are very attractive options though.

ZendAMF then looked a feasible option since it supported remoting. But how do I let the other players get updates on actions of one player through zendAMF, which as far as I know does not do data push. I'll have to do it by polling - asking server constantly for updates - which wont look very real time.

Then I heard about BlazeDS which does support data push. Now I have to learn java if I want to use that and get a new web host because my existing host does not have tomcat.

Then I heard about cirrus which is still in 'codename cirrus' stage. It looks like a very feasible option since its peer to peer with miniamal server support needed. Is it good for a mutiplayer game?

Well if anyone has experience developing multiplayer flash games I'd like to know if a turn based multiplayer game with more than two players participating can be implemented using zendamf. ZendAMF because I know PHP and AS3.

sentences:
How to implement this collision detection function? I would like to know how to implement this collision detection function, but I'm not even sure what it's called.

The input shapes are 2D convex polygons, with an optional "rounding radius": imagine putting a circle on each vertex of the polygon, and filling in the area between them.

I already have a function that uses SAT to tell if they intersect (and return a minimum correction vector), but I also need a function that takes two of these shapes, A and B, and a unit direction vector. It should tell whether A will ever touch B if it moves along the direction, and if so, report how far it could move and the surface normal where they would touch.

So how would that be implemented, or at least how is it called, so I could search for hints?

sentences:
LibGdx Sound start to give an error after loading GameScreen multiple times I have a LibGdx game, where the user taps on the screen, and a Sound will play. When the user taps on the screen, a texture will "fire" another texture as a missile, and can hit a target, when this target "dies", another sound will play.

I use these two Sounds often in the game, Shooting Sound, and Hit Sound.
When I load the game, everything works fine - the sound doesn't get an error when I load multiple instances of the Sound/Textures on level 1 - so it doesn't seem to be related to memory, because this error can appear when I use a lot less instances of sound/textures, but when I have loaded the "game screen" more times, it starts to appear.

The error is only related to two sound-files, one when the user taps the screen, and the other when the "target" dies. So it does only happen when I load Sounds a lot of times.

The problem only occurs when I go to higher levels, and load the game screen more times. I load the same game screen over and over, only with more instances of "targets".

Error:

W/SoundPool﹕ Sample was not loaded. Waiting for 30ms.
W/AudioTrack﹕ AUDIO_OUTPUT_FLAG_FAST denied by client
com.mygdx.game.android E/AudioTrack﹕ AudioFlinger could not     create track,     status: -12
com.mygdx.game.android E/SoundPool﹕ Error creating AudioTrack

I load my Sound like this:

 Sound playDeadSound;
 public void playDeadSound(){
 soundDead = Gdx.audio.newSound(Gdx.files.internal("dead.ogg"));
 soundDead.play();
 soundDead.dispose();
  }

Things I have tried

To instantiate the Sound file in the create method, and then use the
same object over and over.
I have tried to call soundDead.resume(); instead of play(); to load
the sound.
I have tried to re-sample my audio to 48KHz, and to the lowest (which
was around 5-8KHz IIRC).
I have tried to start out with 40 targets, and I get no errors, and I
have tried to start out with 5 targets, and errors start appearing
when I go a few levels higher and the targets are 10-15.
I have tried to remove all other sounds except one of the Sounds that
creates the error (Shooting Sound/Hit Sound).
I have tried to stop and then dispose the sound, and then create it when I call it.
I have tried to have 2 sound files, and then call them one after
another, so they doesn't get used at the same time.

The files are 5KB big each, and around 1 second long.
Any ideas on what could cause this error? Thanks!

Solution:

The problem was that I reloaded the Sound over and over when I started a new level, hence why the problem never occured when I was at level 1. The problem got fixed when I used the same sound during the whole app's lifetime. A big thanks to Alesegdia for coming up with the answer.

sentences:
Where do I write code in my minecraft modding environment? So this is probably a stupid question but I'm just beginning so I hope someone can help. I set up my whole modding environment in eclipse but the problem is that I don't know where to start writing code that will be run while playing the game. I'm used to there being a run method that will constantly loop and run the code within that method but there doesn't seem to be such a thing. I tried putting stuff in my main class under the init event handler but that just crashed my game. I was just testing stuff out and tried putting this code in the init area which caused the game to crash when I tried running the client:

Entity player = Minecraft.getMinecraft().player;
if(player.posX>100.0)
{
 player.posX = 12.0;
}

sentences:
How to draw point sprites with transparency in OpenGL without depth sorting? I am trying to render point sprites with alpha transparency and because I render millions of points depth sorting would kill performance. My issue as you can probably imagine is that artifacts appear in some of the borders when the draw order is not correct:

My code for drawing:

glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_POINTS,0,nSamples);

In my shader I just specify a alpha value in the output color depending on how close to the point center we are.

Is there any way to get rid of the artifacts and get a correct transparency render?

sentences:
How do I compile a namespace to a .DLL in Unity? I'm developing a core library that I will use in my other games. I've only heard of using Unity .DLLs recently, and have spent some time putting my core scripts into a namespace. If I understand .DLLs correctly, I should be able to take that .DLL, plop it into one of my other projects, and then immediately start using it.

The question is, how do I compile that namespace into a .DLL that I can use in other projects? I'm using Visual Studio and Unity 2018.2.17f1.

sentences:
What is the most efficient container to store dynamic game objects in? I am making a first person shooter and I know about about a lot of different container types but I would like to find the container that is the most efficient for storing dynamic objects that will be added and deleted from the game quite frequently. EX-Bullets.

I think in that case it would be a list so that the memory is not contiguous and there is never any re sizing that is going on.  But then I am also contemplating using a map or set.  If anyone has any helpful information I would appreciate it.

I am writing this in c++ by the way.

Also I came up with a solution that I think will work.

To start off I am going to allocate a vector of a big size.. say 1000 objects.  I am going to keep track of the last added index in this vector so that I know where the end of the objects are.  Then I will also create a queue that will hold the indices of all objects that are "deleted" from the vector. (No actual deleting will be done, I will just know that that slot it free). So if the queue is empty I will add to the last added index in the vector + 1, else I add to the index of the vector that was at the front of the queue.

sentences:
Efficiently pathfinding many flocking enemies around obstacles I'm working on trying to improve the pathfinding for my game's enemies. Right now, they basically just constantly move towards the player's exact position by calculating the angle between themselves and the players and moving in that direction. I also have a flocking algorithm which prevents the enemies from stacking on top of each other, so they will form up into groups rather than clip through each other.

However, now that I've added a tile-based map, I need the enemies to also be able to path around obstacles and walls for example. I initially tried adding a separation value to "non-walkable" tiles so that the flocking algorithm would consider the walls and obstacles as objects to move away from. I have yet to work out whether or not this is feasible because my initial test showed the enemies hitting an invisible "wall" where there are no non-walkable tiles, yet for some reason, they hit it and start spazzing out.

I was wondering if it might be too performance heavy to calculate a path to the player using A* and then use the flocking algorithm to prevent clumping. Originally my game was going to be a wave-based shooter, but I've decided instead to make it level-based in the vein of Hotline Miami, so it's likely I'll have fewer enemies, with the occasional horde, and just make them stronger.

Is this a viable solution? I'm using Java with Slick2D as my game engine. Or is there a better solution / algorithm that tackles both these problems?

sentences:
Why do these quaterion multiplications produce different results? I am trying to use quaterions to modify the camera direction vector.

This code works perfectly:

glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x  * mouse_sens * time_step), glm::vec3(0.0, 1.0, 0.0)) );
glm::quat temp2 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.y  * mouse_sens * time_step), dir_norm) );

Camera1.SetCameraDirection(temp2 * (temp1 * Camera1.GetCameraDirection() * glm::inverse(temp1)) * glm::inverse(temp2));

This code does not:

glm::quat temp1 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.x  * mouse_sens * time_step), glm::vec3(0.0, 1.0, 0.0)) );
glm::quat temp2 = glm::normalize( glm::quat((GLfloat)( -Input1.MouseMove.y  * mouse_sens * time_step), dir_norm) );

glm::quat temp3 = temp2 * temp1;
Camera1.SetCameraDirection(temp3 * Camera1.GetCameraDirection() * glm::inverse(temp3));

Why can I not multiply quaterions successfully?
Am I using GLM wrong?

sentences: How do I remove 'playerachievementcache.dat' from my GMS project? I am working with a GameMaker: Studio project that outputs a file called "playerachievementcache.dat". It isn't used for anything, and I can't seem to remove it from my project. Is it possible that this is something the studio automatically includes? Any ideas on how to locate what is creating the file?

sentences:
Unity: How to keep the music muted on reloading the scene? I am giving the user a UI button to mute and unmute the ingame sounds but the problem is when I mute the sounds and then when the game ends and the game scene reloads the sounds comes back up which is really annoying.

After some searching I came to know that I need to use DontDestroyOnLoad(transform.gameobject); but it makes the copy of the whole thing and now I have two copies of the same music.

Also I don't know if this is the only way or not but just to mute/unmute an audio source it feels kind of overkill to me since I have a many components attached to my gameobject and then just to mute/unmute it copies the whole thing.

Can someone tell me how to fix that duplicating problem and also is there any simpler way to achieve this?

sentences:
How to Implement Screen Freeze in Godot Many 2D games have an intentional screen freeze (say, 75 milliseconds) when the player takes or deals damage. During this freeze, all physics and animation processing stops.

How can one implement a screen freeze in Godot?

If you want to suggest how to do this in Unity or another engine, that's fine too. It might help me to figure out how to do it in Godot.

My only idea is to have a boolean called is_screen_freeze along with some variables freeze_start_time and freeze_duration. In all my nodes' _process() and _physics_process()methods, I can just pass if is_screen_freeze is true. This seems like a rather inelegant way of going about a screen freeze, and I'm not even sure it would work since animations would probably keep playing. Is there a better way?

sentences:
How can I create an efficient bloom shader with GLSL? I have searched the net for resources related to rendering a bloom effect using GLSL, but haven't found anything. Although the tutorial at Philip Rideout's website is a good one, it performs very poorly on my Nvidia GPU.

Can anyone guide me as to how should I approach this problem and build a fairly efficient implementation of a bloom effect?

sentences:
UDK Modular construction (customisable vehicles etc) I'd like to build an interface whereby the user can attach various components and blocks onto a vehicle, this is then saved (as object/coordinate, rotation, scale values - in database) and can be used again later.

After looking into sockets I haven't been able to find a way of saying connect ObjectA's SocketOne to ObjectB's SocketX with rotation Z and Scaling V for instance.

If that sounds infeasible to you (which it may well be), is there another way of scripting 2 objects to be "joined", so they act as one item when they move/animate?

   Create ObjectA at 0,0,0
   Create ObjectB is at 10,0,0
   ObjectA.link(ObjectB)

I would like the sub objects to still be animated etc (like meshes connected to sockets can)

If anyone has any pointers they would be greatly appreciated.

Thanks,
Martin

sentences: Are there 3x3 matrices in DirectX 11? I have a parameter in HLSL shader in a constant buffer which is a float3x3. Is there is 3x3 matrix struct in Directx 11 or should I use 4x4 matrix instead, and if so, how?

sentences:
How to make fighting roster fair I plan on creating a fighting game in the future, and I'm wondering how to make a roster functionally fair, and feel fair. You see, Super Smash Brothers Ultimate is functionally fair (I think), but at certain times, it doesn't feel fair (partially because I suck at the game).

Mario's up smash is one of the few that can't hit people on the lower platforms of battlefield, however, it still feels fair game somehow (up tilt is my guess). However, when playing against Ness, it can feel unfair to play because the other player can just spam PK Fire (side special) and then smash attack them at high enough HP. In other words, it is fair, but not fun.

How can I avoid something being spammed feeling unfair when creating a fighting game, and all the other moves of characters feel (and actually be) fair?

sentences:
Loading SpriteFont through a different class than Game.cs I am trying to load up a single SpriteFont to print some debug information.
In our current game, we load up both Textures and Music through a ResourceManager. They are both loaded with a filestream, and thus do not require Content.Load

SoundEffect soundEffect = SoundEffect.FromStream( fs );

Since this ResourceManager does not inherit from Game or is like Game.cs, I cannot use the usual method:

SpriteFont spriteFont = Content.Load<SpriteFont>(resource.Key.Item2);

Anyone have any idea how I can either:
-Load the SpriteFont a different way
-Create my own Contentmanager

sentences:
Unity IUnityLifecycleManager already exists I followed this tutorial https://www.youtube.com/watch?v=OElh7wda4Qc in Unity version 2019.3.1f.1 Personal Edition, but I got 6 errors like this in the console, also I updated to version 3.4.4 via the package manager, because it said that the asset store version was not compatible anymore.

  Library\PackageCache\com.unity.ads@3.4.4\Runtime\Monetization\AndroidPlacementContentOperations.cs(55,40): error CS0433: The type 'IUnityLifecycleManager' exists in both 'UnityEngine.Advertisements.Editor, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Advertisements, Version=3.4.2.0, Culture=neutral, PublicKeyToken=null'

This is the code I am using, its the same as the code in the official website, but personalized to my project.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;

public class adsController : MonoBehaviour, IUnityAdsListener
{
    public bool testMode = true;
    public Button rewardedAd;

    private string storeID = "3509232";

    private string rewardedVideo = "rewardedVideo";

    private void Start()
    {
        rewardedAd.interactable = Advertisement.IsReady(rewardedVideo);
        rewardedAd.onClick.AddListener(ShowRewardedVideo);

        Advertisement.Initialize(storeID, testMode);
    }

    private void Update()
    {

    }

    private void ShowRewardedVideo()
    {
        Advertisement.Show(rewardedVideo);
    }

    // Implement IUnityAdsListener interface methods:
    public void OnUnityAdsReady(string placementId)
    {
        // If the ready Placement is rewarded, activate the button:
        if (placementId == rewardedVideo)
        {
            rewardedAd.interactable = true;
        }
    }

    public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
    {
        // Define conditional logic for each ad completion status:
        if (showResult == ShowResult.Finished)
        {
            // Reward the user for watching the ad to completion.
            Debug.Log("Reward");
        }
        else if (showResult == ShowResult.Skipped)
        {
            // Do not reward the user for skipping the ad.
            Debug.Log("Not Reward");
        }
        else if (showResult == ShowResult.Failed)
        {
            Debug.LogWarning("The ad did not finish due to an error.");
        }
    }

    public void OnUnityAdsDidError(string message)
    {
        // Log the error.
    }

    public void OnUnityAdsDidStart(string placementId)
    {
        // Optional actions to take when the end-users triggers an ad.
    }
}

EDIT:
Looks like I forgot a line in the code and reinstalling the unity ads package now it runs but still gives this warning.

  Please consider upgrading to the Packman Distribution of the Unity Ads SDK.  The Asset Store distribution will not longer be supported after Unity 2018.3

sentences:
Testing for 2D collision outcome I'm currently building a small 2D game in Processing (and it has to be Processing) for a school project. The basic makeup of the game is 4 different cells (objects, all are circles): An avatar, controlled by the player, a number of cowardly cells fleeing from all other cells, huntercells hunting and attempting to eat everything, and passive disruptorcells which will burst apart other cells in differnt ways depending on what they hit. Also, whether one cell is bigger than another affects the outcome of collisions. All these different cells are child classes of the cell superclass, all stored in a cells ArrayList, which is handled inside a World class, which is updated/displayed in the main Draw loop.

My main problem right now is how I should handle the outcome of all these different collisions, without too much code-duplication: My idea is to do it through a double for-loop, which would then again need 16 different if-like methods to figure out who's colliding with who, and what to do about it.

E.g. if a predator cell collides with prey cell, the latter will be eaten and the predator will grow a certain amount in size and speed. The outcome should be the same (predator grows, prey dies) if the tested subjects are found in reverse order through the for-loops. Cells also need to know where they are in relation to eachother all the time, so they know when/what to flee from/chase.

Any thoughts/suggestions on best practices and how to do this most efficiently are much appreciated.

sentences:
Keyboard input system handling Note: I have to poll, rather than do callbacks because of API limitations (SFML). I also apologize for the lack of a 'decent' title.

I think I have two questions here; how to register the input I'm receiving, and what to do with it.

Handling Input

I'm talking about after the fact you've registered that the 'A' key has been pressed, for example, and how to do it from there.

I've seen an array of the whole keyboard, something like:

 bool keyboard[256];  //And each input loop check the state of every key on the keyboard

But this seems inefficient. Not only are you coupling the key 'A' to 'player moving left', for example, but it checks every key, 30-60 times a second.

I then tried another system which just looked for keys it wanted.

std::map< unsigned char, Key> keyMap; //Key stores the keycode, and whether it's been pressed. Then, I declare a load of const unsigned char called 'Quit' or 'PlayerLeft'.
input->BindKey(Keys::PlayerLeft, KeyCode::A);  //so now you can check if PlayerLeft, rather than if A.

However, the problem with this is I cannot now type a name, for example, without having to bind every single key.

Then, I have the second problem, which I cannot really think of a good solution for:

Sending Input

I now know that the A key has been pressed or that playerLeft is true. But how do I go from here?

I thought about just checking
 if(input->IsKeyDown(Key::PlayerLeft) { player.MoveLeft(); }
This couples the input greatly to the entities, and I find it rather messy. I'd prefer the player to handle its own movement when it gets updated. I thought some kind of event system could work, but I do not know how to go with it. (I heard signals and slots was good for this kind of work, but it's apparently very slow and I cannot see how it'd fit).

Thanks.

sentences:
How can I orient a projectile along its flight path? I have a projectile that is moving around the world (in a ballistics trajectory right now). I am currently keeping track of its position and velocity. I want to draw it oriented to its velocity, so that it is facing the direction it is going. This seemed like as good of a time as any to try to understand quaternions so I was attempting to solve the orientation problem using them.

Here is my drawing code:

var alignmentVector = Vector3.Normalize(velocity);
var rotationAxis = Vector3.Cross(Vector3.Up, alignmentVector);
var rotationAngle = (float)Math.Acos(Vector3.Dot(Vector3.Up, alignmentVector));
var rotationQuat = Quaternion.CreateFromAxisAngle(rotationAxis, rotationAngle);

var transform = Matrix.CreateScale(5.0f) *
                Matrix.CreateFromQuaternion(rotationQuat) *
                Matrix.CreateTranslation(position);

PresentationHelper.Draw(model, transform); //This just draws the model using the transform parameter as the world matrix

This kinda of works, but not really. In fact, I am having a hard time finding the words to describe what is happening with it. It looks like its tracking for a little while then it goes off course and becomes flattened(is that possible????)

Am I on the right track with the quaternions and can my code be fixed? If not what is a good approach to solving it?

sentences:
Tracking Object Position - Firing on a Trajectory How can I calculate the position of an object after "firing" it from a fixed point?

I am to create a small game - most likely with canvas (pure HTML, JS based) or Adobe Flash - in which the player fires objects at other obstacles in order to clear them.

sentences:
Gradient fill color on circular sprite I have a white circle sprite. I know how to change its color to a solid fill color. using GetComponent<Renderer>().material.color.
But how would I give it a gradient fill color.

I've been trying to do this with a shader.
But so far the shader I've created doesn't take the circle sprite into account, simply its bounding box. It also looks a bit weird.

here's my shader code

   Shader "Custom/SpriteGradient" {
 Properties {
 [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
 _Color ("Left Color", Color) = (1,1,1,1)
 _Color2 ("Right Color", Color) = (1,1,1,1)
 _Scale ("Scale", Float) = 1
 }

 SubShader {
 Tags {"Queue"="Background"  "IgnoreProjector"="True"}
 LOD 100

 ZWrite On

 Pass {
     CGPROGRAM
     #pragma vertex vert
     #pragma fragment frag
     #include "UnityCG.cginc"

     fixed4 _Color;
     fixed4 _Color2;
     fixed  _Scale;

     struct v2f {
         float4 pos : SV_POSITION;
         fixed4 col : COLOR;
     };

     v2f vert (appdata_full v)
     {
         v2f o;
         o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
         o.col = lerp(_Color,_Color2, v.texcoord.x );
         return o;
     }

     float4 frag (v2f i) : COLOR {
         float4 c = i.col;
         c.a = 1;
         return c;
     }
         ENDCG
     }
 }
 }

sentences:
Bouncing ball slowing down over time I use the unreal engine 4 to bounce a ball off of walls in a 2D space, but over time the ball gets slower and slower.

Movement happens in the tick function of the ball

FVector location = GetActorLocation();

location.X += this->Velocity.X * DeltaSeconds;
location.Y += this->Velocity.Y * DeltaSeconds;

SetActorLocation(location, true);

When a wall gets hit I get a Hit Event with the normal of the collision.
This is how I calculate the new velocity of the ball:

FVector2D V = this->Velocity;
FVector2D N = FVector2D(HitNormal.X, HitNormal.Y);

FVector2D newVelocity = -2 * (V.X * N.X + V.Y * N.Y) * N + V;

this->Velocity = newVelocity;

Over time, the more the ball bounced around, the velocity gets smaller and smaller.
How do I prevent speed loss when bouncing off walls like that? It's supposed to be a perfect bounce without friction or anything.

sentences:
Qt based C++ game structure : which class types to use here, and how to correctly structure the relationship between these objects I am writing a C++ game using Qt. As this is the first time, I am trying to understand how the structure should be.

I have two objects derived from the type QGraphicsRectItem which appear as boxes on the screen, which will each represent a player. I want to make them move independently in response to key presses, with a different set of keys assigned to the motion of each object. These are added to a QGraphicsScene object, which is set by a QGraphicsView inherited object.

As only one of these can be focused at any given point of time, and thus respond to key press events, I have defined a function in a class which inherits from QGraphicsView (and is used as a view for viewing the scene) that receives all the key press events. Its constructor receives pointers to the two box objects, and sends the required information (by setting a variable) to the appropriate object through the pointer based on the key press.

I have a few questions regarding this:

Is QGraphicsRectItem (or QGraphicsItem) the correct class for creating such "objects"? I see that there is a QObject class, but I could not understand where it is meant to be used.
Sending pointers of the box objects to the constructor of the view during initialization doesn't seem right. What would be a more appropriate way to design this? The idea is that based on the key pressed, the corresponding box should respond. The problem is, how does this class access the object, unless it is declared inside it or passed as an argument?
Is there a better or more commonly used way to handle the requirement of different objects responding to different key presses, even if done simultaneously? I have seen suggestions for using Event filters, which would pass the event using postEvent. However, event filters send messages to objects of type QObject, which is not what I am currently using. Additionally, the question again arises - who would receive the key press events? How would it know about the existence of the box objects?

I have been reading about design patterns. Is there any particular pattern that would be suitable for this?

Thank you.

sentences:
How do I rotate a gameobject towards a point in world space? I wanted to create a very simply turret.
This turret should aim at the point on the screen where the mouse pointer is currently located.
I have added a cube to serve as a very simple turret in my scene.
To visualize its aiming direction, I'm drawing a ray from it.

To rotate the "turret" to the mouse pointer position, I have created a script and added it to the "turret" gameobject:
void Update()
{
    var mousePos = Input.mousePosition;
    mousePos += Camera.main.transform.forward * 10f; // Make sure to add some "depth" to the screen point
    var aim = Camera.main.ScreenToWorldPoint(mousePos);

    transform.LookAt(aim);

    RaycastHit hit;

    int layerMask = 1 << 8;
    layerMask = ~layerMask;

    Color color;
    if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask))
    {
        color = Color.green;

    }
    else
    {
        color = Color.red;
    }

    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 10000, color);
}

However, there must be something wrong in my code.
In this screenshot, I have added a red arrow that points to the position of the mouse pointer:

The mouse pointer is over that orange tool. However, the turret is rotated towards the floor while it should be rotated upwards to the orange tool.
I do believe that my turret is well positioned (the blue arrow points forward):

How do I change my code so that it aims correctly, and what is my mistake?
I guess the problem is in these 2 lines, but I don't see what's wrong about it:
    mousePos += Camera.main.transform.forward * 10f; // Make sure to add some "depth" to the screen point
    var aim = Camera.main.ScreenToWorldPoint(mousePos);

Thank you.
Edit:
I finally understand what Kevin wanted to tell me.
I made a thinking mistake, and really need the Raycast to determine where my Worldspace point actually is.
Here is why:

Even though the Y screen coordinate of the mouse position is just a few pixels different in each game window on the right side, the worldspace point is totally different (as can be seen in the scene view window on the left side).
I thought in 2D space, while I should have thought in 3D space.

sentences:
Why is account sharing so bad? In games where you have to use an account to sign in or otherwise authenticate yourself (e.g MMO games), it is often prohibited to share your account with other people.

For example in the World of Warcraft Official Terms of Use Agreement:

  [...] You may not share the Account with anyone, except that if you are a parent or guardian, you may permit one (1) minor child to use the Account when not in use by you. You are liable for all uses of the Account that has been enabled by you […]

And the League of Legends Terms of Use:

  [...] You can’t share your account or Login Credentials with anyone. You can’t sell, transfer or allow any other person to access your account or Login Credentials, or offer to do so. You’re entirely responsible for maintaining the confidentiality of your Login Credentials. [...]

What is the reason for this? Is it because of legal reasons and / or security reasons? I imagine account sharing would not be a problem if there weren't some real-world consequences for the company, not just the end-user.

sentences:
Circular Bullet Spread Is Not Even I'm creating a bullet shooter much in the style of Touhou. Right now I want to have a very simple circular shot being fired from the enemy.

However, the spacing is very uneven, which isn't very good if you want to survive.

The code I'm using is this:

private function shoot() : void
{
    const BULLETS_PER_WAVE : int = 72;
    var interval : Number = BULLETS_PER_WAVE / 360;

    for (var i : int = 0; i < BULLETS_PER_WAVE; ++i)
    {
        var xSpeed : Number = GameConstants.BULLET_NORMAL_SPEED_X * Math.sin(i * interval);
        var ySpeed : Number = GameConstants.BULLET_NORMAL_SPEED_Y * Math.cos(i * interval);

        BulletFactory.createNormalBullet(bulletColor_, alice_.center, xSpeed, ySpeed);
    }

    canShoot_ = false;
    cooldownTimer_.start();
}

I imagine my mistake is in the sin &  cos functions, but I'm not entirely sure what's wrong.

sentences:
How to get one KinematicBody2D to push another? I am working in Godot 3, where my player is a KinematicBody2D. When I collide with a block which is also a KinematicBody2D I'd like my player to push it without losing velocity.

My block is in a group called moveables, has no script, and has no other forces acting on it.

After I calculate the velocity of my player in _physics_process(), I have the following code.

# update position and handle collision

var collision = move_and_collide(vel * delta)
if collision:
    var collider = collision.collider
    var normal = collision.normal
    var remainder = collision.remainder
    var collision_angle = rad2deg(acos(normal.dot(Vector2(0,-1))))

    # floors
    if collision_angle == 0:

        # reset y vel so it doesn't keep accumulating
        vel.y = 0

        var horizontal_movement = Vector2(remainder.x, 0)
        move_and_collide(horizontal_movement)

    # moveables
    elif collision_angle == 90:
        if collider in get_tree().get_nodes_in_group("moveables"):
                collider.move_and_collide(remainder) # move block by remainder
                move_and_collide(remainder) # move player by remainder

This code does allow the player to push the block, but only slowly. I can't figure out why. Ideally, the player would push the block without losing any velocity.

Even if I directly update only the horizontal position of my block, it still moves slower than expected, and my player sprite is blurred, presumably because of collision corrections.

        if collider in get_tree().get_nodes_in_group("moveables"):
            collider.global_position.x += remainder.x
            move_and_collide(remainder)

The problem seems to be that when I move the player by the remainder, the player is still colliding with the block, even though I move the block itself in the previous line. This is confirmed by analyzing the collision object move_and_collide(remainder).

What's wrong and how can I achieve the desired movement?

I asked a variant of this question on a Godot forum, but am also asking it here for increased visibility.

sentences:
Good 3D Math Theory Books I've been developing a modification for the Source engine for well over a year, but am now facing some troubles with the weapons, gamemovement (player physics) and player feedback from explosives.

This is all because of my weakness in mathematics!!!

What books, tutorials or any  other various texts could you recommend (that have helped you).

sentences:
What should I wear to a job interview with a game development company? Many game development companies are less formal in terms of workplace attire than other types of software development houses. For example, I know that one place at which I will be interviewing soon has a predominant workplace culture of jeans and polos or t-shirts.

Should I wear a suit? Shirt and tie? Shirt and sport jacket, with or without tie? I want to show that I'm serious about the job, but that I understand the culture, too.

sentences:
Resolving collisions with float precision errors I'm facing a problem when I try to resolve the collision between two units using floats as positions of the units in my game.

I am detecting the collisions using the SweptAABB algorithm and if there is a collision I fix it by using the normalized collision time that the SweptAABB function returns. Something like this:

collisionTime = SweptAABB(unitA, platform)
fixedPosition = (currentPos - previousPos) * collisionTime;

This generally works fine but not always, due of the floats precision errors the fixedPosition can result in a VERY SMALL overlap.
For example: suppose that the fixedPosition for the Y axis should be 12.345234 to avoid the collision but instead of getting that value (after multiplying by the collisonTime) I get something like 12.345239 (a difference of 0.000005) and when eventually the overlap method is executed it will still detecting the overlap:

public boolean overlap(AABB b) {
    Vector2 distance = new Vector2(b.position).substract(position);

    return Math.abs(distance.x) < (extents.x + b.extents.x)
        && Math.abs(distance.y) < (extents.y + b.extents.y);
}

So I decided to start changing the code so that I can get the face of the box that collides and use simple arithmetic addition of the positions instead of multiplication but this also fails for the same reason. For instance, suppose this:

// unitA collides with unitB at this point in the X axis:
float unitB_Face_X = 0.7466669f;
// since position is defined at the center of the unit I move unitA to the right:
float unitA_Fix_X = unitB_Face_X + 2;

But unitA_Fix_X will result in a slightly different value (2.746667) that will eventually be detected as an overlap.

Just a clarification: My game is like Super Mario Bros, a 2D platform. I dont need fine precision, two decimals places (or one) is more than enough for my game world (each unit character has 1f for width and 2f for height).

I think that there must be a correct way to deal with this kind of problem (every 2d platform game out there has solved this problem). I have only think in one solution: Use integers instead of floats for the position of every unit in my game. I cannot avoid floats completly  because of deltaTime (also libgdx uses them for the sprites positions and rendering), but I think I can make the integer conversion at the begining of each frame by doing something like this:

float fPos = unitA.velocity * deltaTime;
int intPosition = (int)(fPos * 1000);

And use the intPosition for detecting and resolving the collisions. After that I will have to convert it back to float for rendering the sprites.

Is this a bad approach? I dont want to shoot my self in the foot.
Thanks in advance.

sentences:
Shall we create our game engine in this case? Although my friend and I are not interested in game development, we like creating tools. We would really like to give life to our own game engine, however, we don't want to put effort into something useless. Develop something what can be used by smaller or "medium-sized" companies. It's not about the most modern graphics and technologies. Something like WoW's engine 10 years ago or GTA III's would be a dream.

So, is it possible that 2 (assuming) experienced programmers can create something like that?

sentences:
Weird blending behavior on PowerVR SGX544MP2 On PowerVR SGX544MP2, sometimes blending behaves in a very strange way for me.

Instead of blending with the actual color from the previous draw calls, it tries to blend with black:

(sorry about the low quality, it's not my tablet and not my photo)

Some polygons render correctly, however (that blue hit decal on the left (which is blended with black in the middle, however), the beam and the HUD), but certain decals are broken.

How do I fix or work around the problem? It seems to be related to deferred rendering of tiles, but I don't really know. On other GPUs, it looks alright.

sentences:
Text based cards tracker I wish to build a card tracker that reads in game text and keeps track on the cards that are out.

Like an Overwolf app, but for a card game.  I mailed Overwolf and asked what are my options, they suggested to use image recognition.  However, it sounds complex (and I luck any experience in it).  Is there a simple way to do it?

The tracker that I want to build is for Twilight struggle and I would like to automate this card counter such that It will track the cards that been played from the a text box in the game that state their name.

sentences:
Consturcting a sprite bitmap from mutliple partial sprties across sheets First of all, I am not using engine and this is for Android. Bear with me if I use incorrect lingo as I am not experienced in game dev (but I am trying)

I am being provided multiple sprite sheets. Each sheet represent the animation of one part of a warrior (ie. Head sheet, arm sheet, leg sheet and body sheet).

I intend to basically construct the frames of the warrior using the sprite sheets. I basically thought of the following. For every Frame, I will create a bitmap that consists of the different parts ( by extracting the correct part from every sheet and placing it in the intended x/y position). That way every bitmap represent a frame.

Is my approach correct? Is there different way/recommended way to do this?

Please share your advice ( anything but game engine as it is tool late to use)

Thank you

PS: I need the end result to be a bitmap because at the end, I will supplying a bitmap to another function at once every 200ms.

sentences:
How can I load a picture with alpha channel in JME? This code loads a picture into the game:

Picture mypic= new Picture("mypic");
        Texture2D tex = (Texture2D) assetManager.loadTexture("Textures/mypic.png");
        mypic.setTexture(assetManager, tex, false);
        mypic.setHeight(settings.getHeight());
        mypic.setWidth(settings.getWidth());

What have to be modified or add to show properly a picture with an alpha channel?

sentences:
Euler angles to directional vector I wanted to implement a directional light system in my game, and instead of passing the direction to the light, I chose to use an angle, and only later convert it to a directional vector, so it is a bit more easier, to manage.

I tried to search on the internet for a good solution to this conversion, but the answers I found said different things (Like this one and this one), and not always in understandable form (like using pitch, yaw and roll incorrectly). One of them said to use a format like

x = sin(roll) * sin(yaw)
y = sin(roll) * cos(yaw)
z = sin(yaw)

An other one used something like

x = cos(yaw) * cos(pitch)
y = cos(yaw) * sin(pitch)
z = sin(pitch)

So my question is:

What is the correct way to transform Euler angles (Tait-Bryan version) into a Directional vector?

sentences:
How do I use a JBox2D ContactListener to check if my character is standing on the ground? I want to know when my character is touching a wall or floor. I've had no luck searching for information on this. I saw a few things about ContactListeners and getContactList(), but I don't understand how to use them.

How can I do this?

sentences:
Why are microtransactions more or less universally hated? In many games nowadays we see micro-transactions in the form of in-game purchases. The benefits of these purchases can be anything from disabling ads, cosmetic unlocks, or in-game currency. Here's an example:

That is of course an extreme example of pricey micro-transactions. But it seems that even more "reasonable" in-game purchases are more or less despised by the community as a whole, even though they are there to help monetize the game and without them the game wouldn't exist.

So why are micro-transactions so despised?

sentences:
What should I keep in mind when making 2D games for multiple resolutions? I'm making a 2D (Android) game. Android devices vary quite a lot in screen resolution; what do I need to keep in mind when making my game?

Do I need to keep big versions of all images and scale down depending on the resolution (doesn't that waste space)?
Do bitmap fonts scale well or do I need to use something else?
Anything else I'm forgetting?

sentences:
Python library for scripting (C++ integration) Please advise me good wrapper/library for python. I need to implement simple scripting in c++ app; Under "good" I mean pretty understandable, well documented, no memory leaking, fast. For creating base interface of GameObject on Python and C++; Your own experience and useful links will be nice!!! I found link about it, but I need more specific within gamedev context. What combinations of libraries you used for python integration into c++? For example about ogre-python it said

  built using Py++ and Boost.Python library

And one more question, maybe someone of you know how Python was integrated into BigWorld engine (it's own port or some library)?

Thank you!!!

sentences:
Switch character to play animation() in Unity3D using c# I have two or more 2D character (Character A, B, n..).
I made an animation on the character using the Animator class "AnimCharacter.cs".
if i press the 'PgUp' character 'A' can call the function AnimCharacter.cs, when i press 'PgUp' again, character 'B' can call that function so the character A is in idle.
I've tried to make the class "aktifChar" but still error. Everybody can help me ? Thanks

"AnimCharacter.cs"

using UnityEngine;
using System.Collections;

public class AnimCharacter : MonoBehaviour {
    public float maxSpeed = 10f;
    bool facingRight = true;
    Animator anim;
    bool grounded = false;
    public Transform groundCheck;
    float groundRadius = 0.2f;
    public LayerMask whatisGround;
    public float jumpForce = 700f;
    bool doubleJump = false;

    void Start () {
        anim = GetComponent<Animator> ();
    }

    void FixedUpdate () {
        try{
            grounded = Physics2D.OverlapCircle (groundCheck.position, groundRadius, whatisGround);
            anim.SetBool ("Ground", grounded);

            if (grounded)
                doubleJump = false;

            anim.SetFloat ("vSpeed", rigidbody2D.velocity.y);

            //if(!grounded) return;

            float move = Input.GetAxis ("Horizontal");
            anim.SetFloat ("Speed", Mathf.Abs(move));
            rigidbody2D.velocity = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);
            if (move > 0 && !facingRight)
                Flip ();
            else if (move < 0 && facingRight)
                Flip ();
        }catch{

        }
    }

    void Update(){
        if ((grounded || !doubleJump) && Input.GetKeyDown (KeyCode.UpArrow)) {
            anim.SetBool ("Ground", false);
            rigidbody2D.AddForce(new Vector2(0,jumpForce));

            if (!doubleJump && !grounded)
                doubleJump = true;
        }
    }

    void Flip(){
        facingRight = !facingRight;
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;

    }
}

aktifChar .cs

using UnityEngine;
using System.Collections;

public class aktifChar : AnimCharacter {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        if (Input.GetKeyDown (KeyCode.PageUp)) {
                 animation.Play("Running", PlayMode.StopAll);
        }
         }
}

there is a image of the Animator :

the error is saying :
MissingComponentException: There is no 'Animation' attached to the "CharacterLamp" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "CharacterLamp". Or your script needs to check if the component is attached before using it.
aktifChar.Update () (at Assets/Script/aktifChar.cs:14)

sentences:
How do I create a game that runs on Windows, iOS and Android? I use C++ to create windows games and now I want to step into another other OS like Android or iOS. I'm totally familiar with C++ so I tried to create app for iOS using objective C it was working awesome. However, I also want to publish games for Android but not by using Java.

I don't want to create a single game 5-6 times for other platforms. Is their any way that if I create game for Windows then it will work in Android and iOS ? Or should I use Action Script 3.0? If I use action script 3.0, will it require Flash player to run the game in Windows, Android, iOS?

sentences:
DontDestroyOnLoad() doesn't work in Unity I have a problem with DontDestroyOnLoad() in Unity. It does not work!

My code:

private static PlayerSpawningScript instance;

public void Awake()
{
    Debug.Log ("PlayerSpawningScript awake");
    Debug.Log ("Instance: " + instance);
    if (instance == null) {
        Debug.Log ("Initializing PlayerSpawningScript instance");
        instance = this;
        DontDestroyOnLoad (gameObject);
    }
    if (instance != this) {
        Debug.Log ("PlayerSpawningScript instance exists. Destroying new copy.");
        Destroy (gameObject);
    }
    Debug.Log ("PlayerSpawningScript instance: " + instance);
}

public void OnDestroy()
{
    Debug.Log ("Destroying PlayerSpawningSceript instance: " + instance.ToString ());
}

Basing on the console output, I successfully create an instance in scene1, but when I change the scene, it gets destroyed - I know this because I get "Destroying PlayerSpawningScript (...)" before the new scene is loaded, and the same script set up in scene2 does not find an existing instance (which held data saved in scene1) and sets up itself as the instance instead of getting Destroyed. What am I doing wrong?

sentences: Simple Alternate Art Style I'm looking for suggestions on easy or simple art styles that can be created by anyone. It would be for a 2D game, but pixel art isn't really my thing. An example from a game would help. Thank you very  much.

sentences:
How can I create an outline shader for a plane? All these toon shaders I have been seeing render an duplicated mesh behind it and extrude the normals of the vectors to make it look like it has a border, but it feels a bit hacky to me.

Basically I am trying to create an outline shader for a plane so these toon shaders do not really work.

It's probably due to my lack of deep knowledge about shaders in particular but I am really confused and would like someone to explain. I'm also a bit worried that rendering an object twice would hit the performance.

Edit: Added picture for reference. (Thanks for the edit Alexandre!)

sentences:
How to place an object at the mouse position? How can I place a object to position where I clicked in just x,y axis not in z,
I am trying to achieve it with

Vector3 mousepos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
object.transform.position = new Vector3(mousepos,mousepos);

but it does not seem to work, in fact the object doesn't even move.

sentences:
How to add a callback to addAction in scene2d Sorry if this is a newbie question, I'm still learning libgdx. I'm using scene2d and I am trying to fade a tooltip into my scene and fade it out after 4.5 seconds.

Everything is working in my code except that tooltip.setVisible() always overrides the fading animation. I'm wondering if there's a way to set up a callback function or if there's any way to tell when an action has completed so I can trigger setVisible after the fade animation has completed. I thought about setting up a second timer that triggers after 5 seconds, but that seems like a hacky way to do things.

Here's my TooltipListener class:

public class TooltipListener extends InputListener {

private Actor tooltip;
private InputListener inputListener;
private Timer timer = new Timer();

public TooltipListener(Actor tooltip) {
    this.tooltip = tooltip;
}

@Override
public boolean touchDown(
    InputEvent event,
    float x,
    float y,
    int pointer,
    int button
){
    tooltip.setVisible(true);
    tooltip.addAction(fadeIn(1f));
    tooltip.toFront();

    timer.scheduleTask(new Timer.Task() {
        @Override
        public void run() {
            tooltip.addAction(fadeOut(1f));
            tooltip.setVisible(false);
        }
     }, 4.5f);

    return true;
}

}

sentences:
Encapsulating parameterised prefabs I'm currently using the following general pattern for most of my configurable components (i.e. MonoBehaviours):

public class MyComponent : MonoBehaviour
{
    // Configurable fields
    [SerializeField]
    private bool someParameter;
    [SerializeField]
    private int anotherParameter;

    // Fake constructor to act as a replacement for GameObject.AddComponent
    // with additional parameters.
    public static MyComponent AddTo(GameObject gameObject, bool someParameter, int anotherParameter)
    {
        var myComponent = gameObject.AddComponent<MyComponent>();

        myComponent.someParameter = someParameter;
        myComponent.anotherParameter = anotherParameter;

        return myComponent;
    }

    // Public properties and other methods
    // ...
}

This works around the lack of constructors for MonoBehaviours but still encapsulates the parameters in such a way, that they can only be set at the time the object is created, or through the Inspector (which is effectively the same thing once the game is built).

Unfortunately, this approach doesn't help once I want to use my component inside a prefab. When I instantiate the prefab, the component has already been created, and I can no longer touch those parameters. And as far as my google-fu can tell, there's no way to pass parameters into prefab instantiation (much like there isn't a way to pass a parameter into AddComponent). It seems like everyone just instantiates their prefabs and then fiddles with some public properties to configure them.

So the question is, is there any way to set things up, such that I can configure some fields on my prefabs, but without exposing them publicly and breaking encapsulation?

(I realise that I could add a similar static "factory" method which instantiates a specific prefab and then configures the component inside that prefab, but a) this means adding one such method for each prefab and b) it breaks down once I want to configure multiple components within the same prefab.)

sentences:
What are some common ways to generate revenue from a free game? When creating a free game what revenue options are there and how successful are they? What are the pros and cons of different revenue models such as ad-supported, freemium, partnerships, merchandising, virtual goods, etc.?

If possible, give specific examples of games using different revenue models and provide data as evidence (otherwise it could get quite subjective).

sentences:
Collison detection trouble. (c++ SDL2) I have a small trouble with my collsion detection system, ill show it on images.
im checking the detection by using that logic with example when moving to the right:

obj.x+obj.w+obj.mov > block.x
obj.x+obj.w+obj.mov < block.x+block.w
and
(
    obj.y <= block.y
    obj.y+obj.h >= block.y
    or
    obj.y <= block.y+block.h
    obj.y+obj.h >= block.y+block.h
)

when object size and block size are equal, the problem appears

the 3 blocks are detected

1 = is the trouble maker

2 = isnt making much problem, since its on same axis

3 =  is working

the 1 block is detected since its within Y + H area of the block (

it happens when the object is sticked with 0 pixel distance.

im using motion based on min(mov,dist) [dist is Y distance between object and block] function and when it tries to move to the right, it gets moved like that

because min(mov,dist) will become negative when getting distance to object 1 instead of 3, making it buggy

im asking if its possible to prevent block 1 (block 2 optionaly) when that situation happens. (or atleast change the logic)

sentences: Does PS3 have a program similar to the "Xbox 360 Creator Club"? Wondering if the PS3 has a way for game developers to make free / affordable games available to their consumer base?  Is the only way to get your game on the PS3 to go through an approval process which may cost money?

sentences:
Should the engine for an eventual web-based game start as a web-service? I've recently decided to start writing an engine for a card game. I'm not a big "cards" player, but a friend introduced me to the game (it's a spin on the game Danish), and I fell in love.

I want to develop the game in 3 segments:

The basic engine, handles cards/decks/gamestate, etc.
A user interface (in the form of a mobile/desktop web app.)
An artificial intelligence with various strategies/difficulties, etc.

These are very distinct projects, in my mind... and I'm struggling with seeing how they'll all fit together in the long run.
At first, I don't even want to be able to "play" the game using the engine. The engine will primarily be tested by its unit tests. Play testing won't start until a client exists. So there's something of a client-server relationship here.

The engine is a very large piece of the puzzle. What I'd like to know is: how would you go about developing the "public API" for this engine?

I was thinking the engine could be a very basic web service, that returns its state via queries to a RESTful API, but I'm worried that developing the engine itself as a web app may lead to poor programming decisions. (For instance, if I chose an MVC micro-framework, well, this API wouldn't really have views... it's just returning serialized objects via JSON, or something to that effect. Is it bad to use MVC for a service like this? )

My other idea was that the engine would just be a console app, and I would later write a bridge of some kind to pipe data between it and the web-app. (The bridge could really be anything. I mean, the web server and the game engine could both idle in an IRC server and share their state in channels.)

What approach would you take (develop as a web service, or develop as a standalone app and bridge it later), and why?

Thanks,
Robbie.

EDIT: So I guess this belongs in Game Development. To clarify, I'm going to write a card game engine. I'm trying to figure out the best way to expose the engine's API so it can be integrated in the future with a web client, and an AI client.

I didn't even have an account here, so howdy :)

sentences:
What causes regions of improperly-lit terrain when my pixel light count is below 4? My Unity3d game has a strange bug where if you have the pixel light count set below 4, these strange boxes appear on the terrain.  Because this game is going to be for mobile, if I set the pixel light count too high, won't run fast enough.

The screenshot will show you what I mean:

You can see this box on the left of the image where light is entering, I want light to enter all around the coin. How can I fix or prevent this?

sentences:
The farther I move my character, the more its projectiles fire in the wrong direction I'm making a top down shooter, and the movement is working fine.
However, I'm having trouble getting my Fire function to work correctly. When I run the game, it kind of fires in the right direction, but the more I move, the more off the shooting becomes. Anyone have any idea why?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    private float _horizontalInput = 0;
    private float _verticalInput = 0;

    public int movementSpeed = 2;
    public int rotationSpeed = 2;

    Rigidbody2D rb2d;

    float coolDown = 0;

    public Rigidbody2D bulletPrefab;
    public float attackSpeed = 0.5f;
    public float bulletSpeed = 500;
    public float yValue = 1f; // Used to make it look like it's shot from the gun itself (offset)
    public float xValue = 1f; // Same as above

    // Start is called before the first frame update
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
    }

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

        MovePlayer();
        RotatePlayer();
    }

    void Update()
    {
        GetPlayerInput();

        // Determines if the player can fire
        if (Time.time >= coolDown)
        {
            if (Input.GetKeyDown(KeyCode.Space))
            {
                Fire();
            }
        }
    }

    private void GetPlayerInput()
    {
        _horizontalInput = Input.GetAxisRaw("Horizontal");
        _verticalInput = Input.GetAxisRaw("Vertical");

    }

    public void MovePlayer()
    {
        rb2d.velocity = transform.right * Mathf.Clamp01(_verticalInput) * movementSpeed;
    }

    private void RotatePlayer()
    {
        float rotation = -_horizontalInput * rotationSpeed;
        transform.Rotate(Vector3.forward * rotation);
    }

    private void Fire()
    {
        Rigidbody2D bPrefab = Instantiate(bulletPrefab, new Vector3(transform.position.x + xValue, transform.position.y + yValue, transform.position.z), transform.rotation) as Rigidbody2D;

        bPrefab.GetComponent<Rigidbody2D>().AddForce(transform.position * bulletSpeed);
        coolDown = Time.time + attackSpeed;
    }
}

sentences:
How does Lumberyard stack up against Unity 5 and UE4? Amazon released a new game engine called Lumberyard today.

How does it compare to the other two major 3D game engines, Unity and Unreal Engine? What advantages and disadvantages does it have? What can it do that the other two can't do, and vice versa?

sentences:
Difficulties with rotation of a sprite Possible Duplicate:
  How do I make a jumping dolphin rotate realistically?

I want to program a dolphin that jumps and rotates like a real dolphin. Jumping is not the problem, but I don't know how to make the rotation. My dolphin always rests in the same angle while it jumps. But I want that it changes the rotation during the jump, like a real dolphin does.
How can I improve the rotation?

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D image, water;
    float Gravity = 5.0F;
    float Acceleration = 20.0F;
    Vector2 Position = new Vector2(1200,720);
    Vector2 Velocity;
    float rotation = 0;
    SpriteEffects flip;
    Vector2 Speed = new Vector2(0, 0);

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        graphics.PreferredBackBufferWidth = 1280;
        graphics.PreferredBackBufferHeight = 720;
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        image = Content.Load<Texture2D>("cartoondolphin");
        water = Content.Load<Texture2D>("background");
        flip = SpriteEffects.None;
    }

    protected override void Update(GameTime gameTime)
    {
        float VelocityX = 0f;
        float VelocityY = 0f;

        float time = (float)gameTime.ElapsedGameTime.TotalSeconds;
        KeyboardState kbState = Keyboard.GetState();
        if(kbState.IsKeyDown(Keys.Left))
        {
            rotation = 0;
            flip = SpriteEffects.None;
            VelocityX += -5f;
        }

        if(kbState.IsKeyDown(Keys.Right))
        {
            rotation = 0;
            flip = SpriteEffects.FlipHorizontally;
            VelocityX += 5f;
        }

        // jump if the dolphin is under water
        if(Position.Y >= 670)
        {
            if (kbState.IsKeyDown(Keys.A))
            {
                if (flip == SpriteEffects.None)
                {
                  rotation = 45;
                  VelocityY += 40f;
                }
                else
                {
                  rotation = -45;
                  VelocityY += 40f;
                }
            }
        }
        else
        {
            VelocityY += -10f;
        }

        float deltaY = 0;
        float deltaX = 0;

        deltaY = Gravity * (float)gameTime.ElapsedGameTime.TotalSeconds;

        deltaX += VelocityX * (float)gameTime.ElapsedGameTime.TotalSeconds * Acceleration;
        deltaY += -VelocityY * (float)gameTime.ElapsedGameTime.TotalSeconds * Acceleration;

        Speed = new Vector2(Speed.X + deltaX, Speed.Y + deltaY);

        Position += Speed * (float)gameTime.ElapsedGameTime.TotalSeconds;

        Velocity.X = 0;

        if (Position.Y + image.Height/2 > graphics.PreferredBackBufferHeight)
            Position.Y = graphics.PreferredBackBufferHeight - image.Height/2;

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        spriteBatch.Draw(water, new Rectangle(0, graphics.PreferredBackBufferHeight -100, graphics.PreferredBackBufferWidth, 100), Color.White);
        spriteBatch.Draw(image, Position, null, Color.White, MathHelper.ToRadians(rotation), new Vector2(image.Width / 2, image.Height / 2), 1, flip, 1);
        spriteBatch.End();

        base.Draw(gameTime);
    }
}

sentences:
Camera not in sync with player I am currently working on a game in XNA and MonoGame. This game is supposed to be a port of KidsCanCode's tutorial series of creating tile-based games in Python. Here is a link to one of the videos in the series I'm talking about: https://www.youtube.com/watch?v=3zV2ewk-IGU&index=4&list=PLsk-HSGFjnaGQq7ybM8Lgkh5EMxUWPm2i

My issue is that my player and camera don't move like how KidsCanCode's player and camera move (you can see KidsCanCode's player and camera movement by clicking on the link above). My camera and player are out of sync. The player can easily go outside of the camera.

Here is the camera code:

public class Camera
{
    public float Rotation { get; private set; } = 0;
    //private Matrix OldTransform;
    //public Vector2 Position { get; private set; }
    public float Zoom { get; private set; } = 1f;

    public int ScreenWidth { get; set; }
    public int ScreenHeight { get; set; }

    public int MapWidth { get; set; }
    public int MapHeight { get; set; }

    private Vector2 Position;

    const float Velocity = 280f;

    public void GetTransformation(out Matrix transform)
    {
        float x = -Position.X;
        float y = -Position.Y;

        transform =
      Matrix.CreateTranslation(new Vector3(x, y, 0));

    }

    public Camera(int screenWidth, int screenHeight, int mapWidth, int mapHeight)
    {
        ScreenWidth = screenWidth;
        ScreenHeight = screenHeight;

        MapWidth = mapWidth;
        MapHeight = mapHeight;
    }

    public void ApplyPositionFromSprite(Sprite sprite)
    {
        //Camera is supposed to center on sprite

        //Camera is always supposed to be ahead of player unless player is close to the edge

        float x = sprite.Position.X;
        float y = sprite.Position.Y;

        x = Math.Max(x, 0);
        y = Math.Max(y, 0);

        x = Math.Min(x, MapWidth - ScreenWidth);
        y = Math.Min(y, MapHeight - ScreenHeight);

        this.Position = new Vector2(x, y);
   }

Can someone tell me what's wrong with my code? Here is a link to the GitHub page.

sentences:
Heightmap implementation in javascript question, a 2D water heightmap I have a height map function from GPU Gems 2 Chapter 18, where they're generating a set of B/W pixels from this equation:

H(x,y,t) = Σi=0N h (
Axi x + Bxi,
Ayi y + Byi,
Ati x + Bti )

The article suggests using 4 height maps to generate the final height map, so that's N = 4. I understand it's using 3 equations of a line to describe the 2D plotting of a 1D B/W pixel. So, I have to iterate through a set of points, say from (0,0) to (100,100):

[
x0 - x100,
y0 - y100,,
t0 - t100
]

So that's a "for loop" of 100 x 100 x 100 and with the 4 times that's 100 x 100 x 100 x 4 loops, the number of A's,B's and T's, i.e. the data I would need to provide would be:

[
A0x,
A0y,
A0t
] , [
B0x,
B0y,
B0t
]
[
A1x,
A1y,
A1t
] , [
B1x,
B1y,
B1t
]
[
A2x,
A2y,
A2t
] , [
B2x,
B2y,
B2t
]
[
A3x,
A3y,
A3t
] , [
B3x,
B3y,
B3t
]

My question is, is this correct? Are my for loops correct? Did I interpret the equation OK so that its just 4 for loops of 4x100x100x100 and the 24 pieces of data are all I need to generate this map?

I'm implementing this in javascript, using a plot pixel function.

Edit: I have another problem, how do I output the data? If I have say a 100x100 pixel height map, how do I "keep" only the data that applies to that area, do I just "throw away" the rest of the data in a conditional if statement that only does within that range?

Edit: also it was my understanding that x and y were the plots for the u and v of the height map and t was that alpha channel? I think I'm misunderstanding that part if the equation

sentences:
How do I draw multiple irregular polygons with OpenGL ES? In this post I was asking how to program a map of a Risk-like game.
Now that the map is pretty coded, both client and server-side, I'd like to finally draw the map.
I'll try to keep least broad as possible in this question, and also avoid XY problem.
So, my X problem is that I need an interactive map, based on (irregular) polygons.
Now, since this question would be really broad (there is a heavy number of possible solutions and libraries for a skilled programmer), this is how I imagined my Y solution:
Since the polygons have to be 10,  touch-interactive, filled with plain color, I think that OpenGL ES should go fine for me. I'm also attracted by Path and Point classes, but the problem is that

The map should be displayed for lot of different screen sizes, but at the same time it should keep its ratio, instead of appearing more large or more little in the Activity.

The polygons have to be drawn to fit each others.

Every polygon should be touchable and the event should differ from the others. Also their color could change depending of the situation.

I don't know if Path and Point classes would fit for this. My intent is more game-like than generic, so I think I'll stick with OpenGL ES solution.
The problem is that I don't understand

How can I map the polygons vertex and dimension for different screen sizes?

(considering we're talking about 10 polygons, there is a kind of environnment for doing this?)

Should I use triangulation or not? I've done lot of research but this point wasn't clear to me.

I followed Android Open GL tutorial, but it only shows simple polygons and alone, I'd need 10 with lot of vertexes and above all that can fit each others.
How can I do this?
EDIT: I also tried to follow this tutorial. This is an image taken from that one:

(source: xamarin.com)
To me instead, it's more little and near top-left corner. This is another trouble I'd like to avoid (as I said in point 1 above): my polygons should always fit the screen (and this is also why I want to use OpenGL ES).

sentences: Determine Resulting Angle of Wall Collision So I have an object moving in a direction towards a fixed horizontal or vertical wall. How do I compute the angle that the object should bounce off at? The object can approach the wall at an arbitrary angle.

sentences:
Enemy mathematical behavior I'm really trying to up my game in game mathematics and now I'm working on enemy movement and a bit of AI. I have an enemy with two modes attack and avoid, based on an integer avoid variable that's either 1 or 0.

On avoid I want it to hover by the player, moving back and forth at a distance until it is set to avoid.

On attack I want to go close at a steady pace say an x and y velocity of 12, then once it reaches a certain distance to gain speed.

I have disx and disy variables that have the distance from each other for each coordinate. I also have a totDis variable with the normal a^2 + b^2 = c^2 formula. I'm pretty sure I'll need another variable that I'll have to change depending on the distance that effects the speed.

It kinda feels like I have all the pieces to the puzzle, I just don't know how to put them together though lol.

I'd like to be able to do this as mathematically as possible and I don't want anyone to give the the answer or do it for me. I was hoping if anyone could give me pointers or tips or just ideas on the directions I can go myself because I really want to have an understanding of this. I hope this is specific enough, if not I'll try to edit my question for you.

sentences:
Will an optional bad words censoring system affects the age rating as well? My game project is a 2D top down RPG with dating simulator & visual novel elements in it, and I have a few parts of dialogue in my game that have bad words and used often by a character.

However, I'm afraid those bad words will affect the age rating up to 17+, so I decided to censor bad words optionally. This means player can enable bad words after confirming legal disclaimers.

Will this feature results more friendly age rating? I'm targeting for 15+ age rating.

sentences:
3d platformer with 2d point of view I made my first 2d platformer game using java + swing.

Now I want to achieve the same gameplay adding 1 dimension. I think this will require opengl knowledge.

I know the basics but i don't consider myself an expert.

This is an idea of how the game should look like.

So the question is, what will i need in order to do this(libraries,programs etc)?

Please do not start writing answers and comments on how hard this will be. I know that it will take me some time but i am willing to finish the project.

sentences:
How do I get text width and height in Swing/AWT? I'm making a game engine based on Java Swing and I wonder if I can get the text width/height.

Say, what I have is:

the text string
the font and text size (the Font object)

What I've done is:

g.drawString(...)

What I want to know is:

the width/height of the text that displayed on the screen

sentences:
In unity, making a navmesh for a tiny planet? I'm trying to build a scene in a small planet, and baking will always give me the result on the half top of the planet. But what I want is to create a navmesh all around the small planet.

I am wondering if there is a way to convert a mesh that I well built in blender, to be a navmesh in Unity. That means using the mesh totally without baking. Or, if there is some other ways to create navmesh for my poor planet.

sentences:
Game Design. Question about balance progression Playing in the main mode, the player receives Glory for victory, and for defeat, loses it. When the player reaches the required number of Glory, he moves to the next League. There are N Leagues in the game.
Each League has a recommended Promotion (level) of the Hero. When a player has a Hero's Promotion below the recommended one, he loses more often. The Hero has K Promotions.
And Quastion
Player must complete N Leagues for 360 days. How can i reach this?

sentences:
LibGDX FileHandle does not delete file I'm using this line of code to delete a file:

if(Gdx.files.local("/files/ids.json").exists()) {
   Gdx.files.local("/files/ids.json").delete();
}

The same code works for all previous levels except the last one. The file does exist, but the delete() method returns false.

Any help would be greatly appreciated as it has exhausted me. I've seen similar topics in Java but nothing has worked for me. It's really weird that the same code works in some cases.

Edit

Also, in case this provides any information, when I step through the program with the debugger, the delete() returns true.

sentences:
LibGdx - Move sprite in the direction of other sprite I'm kind new to LibGdx and I'm still learning. I'm working on a small game project to learn this nice framework. However, I'm having some issues with my game. My game is a top down shooter. There is a human character(space marine) that has to shoot an alien, which will be always moving in his direction until it  dies. My code doesn't have any bullets yet.I was able to make the shooter rotate in the direction of the cursor, as well, the alien rotate in the direction of the shooter, but I can't make the alien move in his direction. I'm pretty sure that my method that does that is completely wrong. I've tried a lot to fix it , but I can't get it fixed ! I appreciate your attention guys !
You can find the full code of the main class here:
 https://github.com/Igor-Lopes/LibGdx/blob/master/Splash.java#L125

public void moveAlien() {
    float mX = 0;
    float mY = 0;
    int velocity = 50;
    vAlien = new Vector2(-1 * (float) Math.sin(Alienbody.getAngle()) * velocity,
            (float) Math.cos(Alienbody.getAngle() * velocity));

    mX = (float) Math.cos(Math.toRadians(spacemarine.getRotation()));
    mY = (float) Math.sin(Math.toRadians(spacemarine.getRotation()));

    vAlien.x = mX;
    vAlien.y = mY;
    if (vAlien.len() > 0) {
        vAlien = vAlien.nor();
    }
    vAlien.x = vAlien.x * velocity;
    vAlien.y = vAlien.y * velocity;
    vAlien.x += vAlien.x * Gdx.graphics.getDeltaTime();
    vAlien.y += vAlien.x * Gdx.graphics.getDeltaTime();
}

public float rotateMarine() {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = Gdx.input.getX();
    mouseY = 677 - Gdx.input.getY();
    angle = (float) Math.toDegrees(Math.atan2(mouseX - spacemarine.getX(),
            mouseY - spacemarine.getY()));
    if (angle < 0)
        angle += 360;
    spacemarine.setRotation(angle * -1);
    return angle;
}

public float rotateAlien(Sprite s, float posX, float posY) {
    float angle = 0;
    float mouseX = 0;
    float mouseY = 0;
    mouseX = posX;
    mouseY = posY;
    angle = (float) Math.toDegrees(Math.atan2(mouseX - s.getX(), mouseY - s.getY()));
    if (angle < 0)
        angle += 360;
    s.setRotation(angle * -1);
    return angle;
}

@Override
public void render(float delta) {
    float angle;
    moveAlien();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    angle = rotateMarine();
    rotateAlien(alien, spacemarine.getX(),
            spacemarine.getY());
    if (Gdx.input.isKeyPressed(Input.Keys.W) == true
            && spacemarine.getY() < 560) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() + 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.S) == true
            && spacemarine.getY() > 0) {
        Marinebody.setTransform(spacemarine.getX(), spacemarine.getY() - 4,
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.D) == true
            && spacemarine.getX() < 920) {
        Marinebody.setTransform(spacemarine.getX() + 4, spacemarine.getY(),
                angle);
    }
    if (Gdx.input.isKeyPressed(Input.Keys.A) == true
            & spacemarine.getX() > 8) {
        Marinebody.setTransform(spacemarine.getX() - 4, spacemarine.getY(),
                angle);
    }
    alien.setPosition(Alienbody.getPosition().x, Alienbody.getPosition().y);
    spacemarine.setPosition(Marinebody.getPosition().x, Marinebody.getPosition().y);
    batch.begin();
    spacemarine.draw(batch);
    alien.draw(batch);
    batch.end();
    // stage.act();
    // stage.draw();
}

sentences:
2D fighting bounding boxes I'm prototyping a 2D platformer/brawler game for uni and I'm having some trouble with creating collision/bounding boxes. This is most likely going to end up on a Vita so I do have some library constraints as well as performance implications.

None of this has yet been implemented but is all theory.

My idea was to have the artist create a sprite sheet for the character animation and then a second identical sprite sheet with the corresponding  collisions in a solid colour (e.g green for where the character can be hit and red for dealing damage, near the foot if kicking etc.)

With this, I would then parse the collision sheet and generate the various collisions required storing them in the character model. This is the point I feel would be most inefficient.

While I think this is a possible solution, I was wondering if there was a more standard way of doing this or a more efficient way as I feel this would have severe performance problems.

sentences:
Anti-Aliasing in OpenGL [C++] I'm trying to make anti-aliasing work inside of OpenGL, here's what I've tried:

glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

But so far none of these have worked.

I have gotten antialiasing to work by enabling it on the control panel for my video card (Catalyst Control Center in my case), but I would like to get it working inside my program instead.

This is what the rendering looks like with 4x antialiasing enabled via the video card control panel:
And this is what it looks like when I do it with my program:

How do I get antialiasing to work?

sentences:
Camera follow rotating ball - ortogonal direction I have a ball, that has been moved via addForce. It colides in the scene with objects, leading to rotation in all axes.

I want a camera to follow this ball but from the side (direction ortogonal to the move vector and UP vector).
No matter what I do, I cannot get this working. The closest I get is almost correct, but camera "bumps" during frames.

I have used this in camera script to attach camera to the ball and move it with it:

this.transform.LookAt(this.cannonBall.transform.position, Vector3.up);

this.transform.position = ball.transform.position;

No I need to rotate camera 90 degree aroun up axis and move it a little backward to track ball from the side.

How can I achive this? If I use

this.transform.Rotate(Vector3.up, 90, Space.World);

It mess up lookAt

sentences:
Ridiculous Error on Unity 5.6.4p4 Method Name doesn't exists I am facing a strange issue on Unity version 5.6.4p4
The code compiles and runs just perfectly fine in editor but when I build it for android I see an error message saying that my method doesn't exists. I have checked many times but there is no such issue. I am not doing anything wrong. Can anyone suggest what could be wrong ?

sentences:
How to rotate "stacked sprites" in XNA? I'm working on a simple Sinistar-style shooter in XNA, and I'm constantly running into trouble with transformations.  I feel like I'll get it eventually, but this problem is really bending my mind.

My little ship has two states: idle and engines-firing.  Idle is a single frame, and engines is a few frames that animate. Got all that.  Part 1 of the issue: Instead of using rotated images, I just use XNA's rotation to orient the ship.  Seems to work ok, but I think my origin point is off because it seems to rotate at a point just below the vertical axis of the ship (default orientation is ship's nose pointing up), instead of in the dead center of the ship.  Likewise, when I switch to engines, the sprites are different heights (due to the flames) so the origin of rotation doesn't seem like it would be constant.  Do I need to specify all my frames the same size so as to preserve the origin point?

Second bit: The gun turret sits on top of the ship, as a separate sprite.  With a bit of trial-and-error and calculation, I can get the gun to align on top where I want it.  But then when the ship rotates, it rotates out from under the gun!  Would fixing the first problem adequately cover this one, or is there some trick to getting the gun's position to translate properly?

So:

Do I need to have all my sprite's frame-rectangles be the same dimensions?
Is there a standard technique in XNA for stacking multiple sprites so they act as one unit, including for rotations?

sentences:
Game AI Implementation I'm very new to game development, but an experienced software engineer. As an introduction to game dev, I'm making a 2D zombie game in Python, using pygame. The game is almost done, but I still have to write the AI for the other humans and the different zombies in the game.

Should I have a centralized AI module that looks for the position of each character and zombie and determines the best way to move each of them? Or should each instance of a zombie or human be responsible for its own behavior?

In my mind it is more straight forward to make each unit responsible of it's own behavior and I think that it would be easier to give them a more "natural" look implementing it this way. However it's probably a lot more inefficient in memory and processing time that a centralized one. Again, I'm super new to games so any example of how is the AI implemented in some major games would be appreciated.

I understand this is probably a very subjective question, but I'm looking for an answer that covers something like pros vs cons, industry standard or known cases of each one.

sentences:
Quaternion based rotation and pivot position I can't figure out how to perform matrix rotation using Quaternion while taking into account pivot position in OpenGL.What I am currently getting is rotation of the object around some point in the space and not a local pivot which is what I want.
Here is the code [Using Java]

Quaternion rotation method:

  public void rotateTo3(float xr, float yr, float zr) {

    _rotation.x = xr;
    _rotation.y = yr;
    _rotation.z = zr;

    Quaternion xrotQ = Glm.angleAxis((xr), Vec3.X_AXIS);
    Quaternion yrotQ = Glm.angleAxis((yr), Vec3.Y_AXIS);
    Quaternion zrotQ = Glm.angleAxis((zr), Vec3.Z_AXIS);
    xrotQ = Glm.normalize(xrotQ);
    yrotQ = Glm.normalize(yrotQ);
    zrotQ = Glm.normalize(zrotQ);

    Quaternion acumQuat;
    acumQuat = Quaternion.mul(xrotQ, yrotQ);
    acumQuat = Quaternion.mul(acumQuat, zrotQ);

    Mat4 rotMat = Glm.matCast(acumQuat);

    _model = new Mat4(1);

   scaleTo(_scaleX, _scaleY, _scaleZ);

    _model = Glm.translate(_model, new Vec3(_pivot.x, _pivot.y, 0));

    _model =rotMat.mul(_model);//_model.mul(rotMat); //rotMat.mul(_model);

    _model = Glm.translate(_model, new Vec3(-_pivot.x, -_pivot.y, 0));

   translateTo(_x, _y, _z);

    notifyTranformChange();
   }

Model matrix scale method:
      public void scaleTo(float x, float y, float z) {

    _model.set(0, x);
    _model.set(5, y);
    _model.set(10, z);

    _scaleX = x;
    _scaleY = y;
    _scaleZ = z;

    notifyTranformChange();
  }

Translate method:
      public void translateTo(float x, float y, float z) {

    _x = x - _pivot.x;
    _y = y - _pivot.y;
    _z = z;
    _position.x = _x;
    _position.y = _y;
    _position.z = _z;

    _model.set(12, _x);
    _model.set(13, _y);
    _model.set(14, _z);

    notifyTranformChange();
   }

But this method in which I don't use Quaternion works fine:

  public void rotate(Vec3 axis, float angleDegr) {
    _rotation.add(axis.scale(angleDegr));
    //  change to GLM:
    Mat4 backTr = new Mat4(1.0f);

    backTr = Glm.translate(backTr, new Vec3(_pivot.x, _pivot.y, 0));

    backTr = Glm.rotate(backTr, angleDegr, axis);

    backTr = Glm.translate(backTr, new Vec3(-_pivot.x, -_pivot.y, 0));

    _model =_model.mul(backTr);///backTr.mul(_model);
    notifyTranformChange();

   }

sentences:
Face-Click Detection ( like in Minecraft ) I am working on a box-based game engine like minecraft and I was wondering how to detect the "clicked face" when placing blocks.

I have created this engine in C++ ( DirectX / D3D ), C# ( XNA ) and Flash ( away3d & papervision3d ).

The engine code is pretty much the same on each, however as one is C# and the other C++ I'm just looking for the pseudo code, theory or advice on how to "snap" placed blocks on the face that has been clicked on.

How should I get its orientation and then place a block on that face in that position with the corresponding orientation.

UPDATE

For now, I've decided to go with a simple but effective method:

First I've remembered the basic 3D to 2D Projection Algorythm.

If I now have a click-point on the screen, I can simply trace a line from the camera ( eye ) through the screen, up to a specific distance.

With this line "in mind" and a modified ( 3D ) version of Bresenham's ( 2D ) line algorithm,
I was now able to see, if my imagined line is "pointing" onto a Block in my 3D grid.

thx for all of your suggestions.

UPDATE 2

I hope it explains my solution. ( red is the original algorythm, green is my modified version )

also: with "rounded" i mean that the original algorythm is just rounding the x-y-factor-value to get the nearest pixel. hope u guys know what i'm talking about.

sentences:
Fixed timestep on the server without hogging CPU? It sounds backwards, but it's the situation I'm currently trying to solve on my dedicated server.

Everything I've read about fixed timestep assumed it was on a client, where you're already running in a loop as fast as you can to render the game, and you are just inserting the fixed timestep updates within that.

Problem is, on the server, that's the only thing being done in the loop, aside from checking for network activity. So my server ends up using 100% CPU, looping needlessly while waiting for the next fixed timestep.

The only way I know to fix this is by adding a sleep to the loop, but I know how inaccurate that delay can be, which would throw off the accuracy of the timesteps.

Is there a better way to keep it from burning CPU? Or is sleep what most dedicated servers are doing anyway?

sentences:
Unity inconsistent memory profiling when running same scene I'm in the making of a 2D silhouette style game where I'm trying basically 2 setups:

One where it consists only of sprites,
One where it consists of a mix of sprites and meshes with NO texture.

Now, I'm experimenting with the two as I wish to want the scenes to take up the least memory.

I have these weird outcomes:

SPRITE SETUP:

Total 280 MB, Textures 155.5 MB, Meshes 1.7 MB
Total 249 MB, Textures 151 MB, Meshes 4.1 MB
Total 279 MB, Textures 151.0 MB, Meshes 10.8 MB

SPRITE & MESH SETUP:

Total 334.4 MB, Textures 188.2 MB, Meshes 1.8 MB
Total 241 MB, Textures 148,0 MB, Meshes 2,3 MB
Total 253.1 MB, Textures 157.7 MB, Meshes 4.2 MB
Total 301.8 MB, Textures 157.7 MB, Meshes 8.4 MB
Total 234.8 MB, Textures 145.3 MB, Meshes 1.9 MB

Now, I find these result strange because:

It was checked on the exact same scene (the mesh setup had same amount of objects, just swapped the sprites for meshes) and the data is inconsistent, meaning there is about 100MB difference between the same mesh scene
A scene of mostly mesh with zero textures uses more, or at least not less, textures than a sprite only scene??

By taking a look at the data above, I would require someone skilled to guide me through this. Shall I keep using those meshes or just go for sprites? What is really goind on here with this data?

sentences:
Scaling textures with nearest neighbour without having to use seperate sprite batches I'm interested in being to scale textures up via nearest neighbour. I can do this via a SpriteBatch.Draw() overload however this means that any other sprites drawn within that batch will also have the scaling.

What happens if I have 50 objects I want to to scale, and another 50 objects I don't want to be drawn using nearest neighbour. Assuming they alternate depths, that's 100 calls to to spriteBatch.End() in order to get depth drawn correctly. Now also let's say each object has it's own texture.

One way is to you use Texture2D.SetData() to manually scale up the textures but this could get messy, very quickly.

Any tips?

sentences: Indicate key options in a keyboard-only game I am creating a music-based app for one of the courses I teach at a high school, so it's not for sale in the app store, it's only for my students to use. I decided to make it keyboard only partially because I didn't want to have to create a whole bunch of buttons and then link them to code. What's a good way to indicate on the screen what certain keys do? For example, the escape key will exit the user from the settings menu scene, it is also used to bring up a list of options in-game. Is there a slick way to explain what certain keys do without having some sort of legend on screen in the various scenes? Screens = scenes (I'm using SpriteKit for OS X). Remember, using the mouse is not at all an option.

sentences:
Unity sprites rendering problems on Android I'm creating a simple 2d game for android, with normal sprites and animations. The problem is that when I open the game on my smartphone (Samsung galaxy trend plus), The sprites are rendered this way:

Of course, this is not what should happen. Moreover, within the Unity editor everything works flawlessly. My settings for the export are:

Texture compressions: ETC2 (GLES 3.0) - Tested also with "Don't override"
Player settings

Default orientation: landscape
Use 32 bit display buffer: unchecked - tried also with this option checked
Rendering path: forward - tried also with Legacy Deferred
Static batching/Dynamic batching: both checked

Camera settings

Clear flags: Solid color - tried also skybox

I don't have any other scene, and this one has only one camera (I saw some topics where people were having problems because they had two or more cameras). The sprites are all .png images with transparence, except for the background, that has no transparence, but is lagging. There are three sprites which are animated using the spritesheet, but they're terribly lagging, and almost can't be seen in this screenshot. I really can't understand why, I'll continue to try, waiting for your answers. Thank you in advance!

EDIT:
If in the player settings the orientation is set to auto-rotate and the device is in portrait, all the sprites works perfectly!!! The problem is that my game is meant for landscape...

sentences:
Are there any alternative JS ports of Box2D? I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library.

I found out Box2D and its JS port.

http://box2d-js.sourceforge.net

It seems to be quite old port, made in 2008. Is it lacking many features of current Box2D or does it have major issues with it? And are there any alternatives for it?

sentences:
Best way to go with 3D dungeon crawler generation I'm trying to prototype a little 3D dungeon crawler. That is, the same system as any rogue-like : A map with little rooms, linked by hallways.

But in 3D. The world is still in blocks, but I can go up and down. This game is a nice exemple of what I want. I still want the world to be mostly flat (for exemple every room could be at the same height) but I need some little up-and-downs in the rooms, or the hallways between them.

I already tried 2D dungeon generation with no precise algorithm (just by myself) but I think this time it would be best to have some nice algorithm and a good workflow about it.

So I need help about this :

A nice 3D generation
What data structures should I use to store my levels ?
How should I then create it ? I'm on Unity, and for now I am associating an enum to prefabs for each type of map blocks, and then I instantiate every case. Is it a good way of doing this ?

sentences:
Moving script not working after SetActive/Pause change I have a pause menu for my game which instantiates a texture and sets a text frame to active and slides both objects onto the screen using the code below:

Instantiating the menu texture and activating the text frame:

public void MenuPressed ()
{
    Vector3 newPosition = new Vector3 (-13, -0.06f, -2);
    Quaternion newRotation = Quaternion.Euler (0, 0, 0);
    Instantiate (menu, newPosition, newRotation);

    menuButton.SetActive (false);

    textFrame.SetActive (true);

    Time.timeScale = 0;
}

Moving the menu items:

float xLimit = -5;
float speed = 0.6f;

void Start ()
{
    StartCoroutine ("MoveMenu");
}

IEnumerator MoveMenu ()
{
    while (true)
    {
        transform.position += Vector3.right * speed;
        if (gameObject.name == "Main Text Frame")
            xLimit = -7;
        if (transform.position.x > xLimit)
            yield break;
        yield return new WaitForEndOfFrame ();
    }
}

Now this all works fine, but the issue that I have is on a multiple pause situation. When the pause button is pressed and spawns the menu and activates the text, the game pauses as expected. One of the options on the menu is to resume playing, when the pressed the game carries on as expected.

The problem I am having is that if the pause button is pressed again, the menu texture spawns in and slides on screen as intended, but the frame for the text does not. The frame gets set active but does not actually move.

Any ideas for how to fix this?

P.S

Here is the code I use to resume the game after it had been paused

public void Button1Pressed ()
{
    Time.timeScale = 1;
    GameObject menu = GameObject.FindWithTag ("Menu");
    Destroy (menu);
    gameController.paused = false;
    textFrame.SetActive (false);
    menuButton.SetActive (true);
    textFrame.transform.position = new Vector3 (-15.2f, -4.0f, -2.5f);
}

sentences:
Select motion path from curve in Maya Python I need to obtain the motion path attached to a curve in maya using Python.
This is the situation as shown in the editor:

I want to obtain motionPath1 by calling a method on curve3 since they look like they are related.

However, I have tried pleny of list methods (listAttr, listHierarchy, etc) but they only return the curveShape3.

What is the command, if it exists at all, to get the name of the motion path in Python knowing the object curve3?

sentences:
lwjgl licence and requirements for commercial use is it completely legal to use light weight java game library in a commercial 2 dimension game engine like drag and drop not straight code?if yes what are their  requirements?if not what are my options?
thanks in advance.

sentences:
How Should I Go About Updating My XNA Game? So, I've created an XNA game, but I'm not selling it... it's just a private game to give away to my friends, more of a practice project. But say I find a bug, or think of a new feature...

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

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

Thanks in advace!

sentences:
Issues with 2D Body/Limb system In my game I have programmed Body and Limb classes. The Body is guaranteed to have an origin in the center of its sprite. The Body class has a List of children Limbs, each with their own offset. Every Limb has a Master value which references the parent Body, but it also has a Parent value which references the Limb it is a child of. However, Limbs do not have to have a parent, they can directly connect to the Body.

The Master, Parent, and Children values of the Limb class:

    //Body containing all limbs this limb is connected to and others.
    public Body Master
    { get; set; }

    //Parent limb, if null then limb directly connected to the body.
    public Limb Parent
    { get; set; }

    //Children limbs
    public List<Limb> Children
    { get; set; }

The Limb methods have if statements to handle these situations. In relation to the offsets and rotations of the Limbs around the Body (using transformation matrices) things seem to work fine. Now, the problem I'm having is when a Limb is attached to another Limb. The child Limb draws and behaves as if it is rotating around the Body instead of its parent Limb, and the parent Limb itself vanishes. Limbs without Children that are directly connected to the Master Body have no issues. Because of this sort of recursive hierarchy I believe the problem has to do with reference types but I may be mistaken. Here is some additional code:

Demonstration:

Here is the worldPosition() method which is used to acquire the Limb's position in world space. I suspect it may be the culprit. The Master.Position is already in world space:

    public Vector2 worldPosition()
    {
        if (Parent != null) return (LocalPosition += Parent.worldPosition());
        else return (LocalPosition += Master.Position);
    }

Finally here is the Update() method of the Limb class:
http://pastebin.com/5L5v5p6x

EDIT: Upon further analysis it appears that any changes I make to either Limb seem to affect the other Limb in one way or another even though they are both quite clearly different instances.

Here is the code to make the initial Body and first Limb:

        b = new Body()
        {
            Sprite = FileFactory.Textures["shoulders"],
            Position = new Vector2(this.Position.X, this.Position.Y),
        };

        Limb l = new Limb()
        {
            Sprite = FileFactory.Textures["left_arm"],
            Master = b,
            Offset = new Vector2(2, 13),
            Origin = new Vector2(0, Sprite.Height / 2),
            RotationalDifference = (float)(0.2 * Math.PI),
            RotateSpeed = 0.15f
        };

        b.Children.Add(l);
        b.Initialize();

And the code to add the child Limb to the first (Parent) Limb:

            Children.Add(
            new Limb()
            {
                Sprite = FileFactory.Textures["right_arm"],
                Master = this.Master,
                Parent = this,
                Offset = new Vector2(27, 0),
                Origin = new Vector2(0, Sprite.Height / 2),
                RotationalDifference = (float)(0.2 * Math.PI),
                RotateSpeed = 0.15f
            }
            );

sentences:
Warcraft III, SharpCraft C# plugin: Usage of native "TimerStart"? about:

Blizzard Warcraft III [furthermore abbreviated as WC3]
related version: WC3: The Frozen Throne 1.26.0.6401 (german Patch 1.26a)
MindWorX Sharpcraft [furthermore abbreviated as SC]
related version: 1.2.4.0

issue:

I'm trying to use the native "TimerStart" from the WC3 "common.j" package inside a SC plugin written in C#. what gives me problems is the last argument from the native ("code handlerFunc"). as there is no native for creating functions, I dont know how to use it properly, can you give an example? for reference of the "code"-argument (it isnt even declared in the "common.j") i used Vexorians thread on wc3c.net, part: "I. The code type". here is the native like declared in "common.j":

native TimerStart           takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing

in the SC plugin I initialized the native like this:

private delegate void TimerStartPrototype(JassTimer whichTimer, JassRealArg timeout, JassBoolean periodic, JassCode handlerFunc);
private static TimerStartPrototype TimerStart = WarcraftIII.Jass.GetNative("TimerStart").ToDelegate<TimerStartPrototype>();
//native TimerStart           takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing

additionally in SC plugin, I created a void to pass to the last argument of the native: (note that "StopCamera" is another native from "common.j" i also initialized in the SC plugin but not showing here, because it is done in the same way "TimerStart" was.)

private delegate void StopCameraFuncPrototype();
private void StopCameraFunc() {
    StopCamera();
}

usage of the native "TimerStart" in SC plugin: (note that the variable "jTim_mouseWheel" is a "JassTimer" created somewhere else in the SC plugin.)

TimerStart(jTim_mouseWheel, (JassRealArg)0.01, false, (JassCode)StopCameraFunc());

when im trying to run WC3 with SC, the SC console window prints that it couldnt compile the appropriate plugin *.cs-file due to not being able to convert void to JassCode. by simply renaming "void" into "JassCode" I get the error, that not all code paths return a value...

sentences:
SocketException: No connection could be made because the target machine actively refused it I am working on connecting a client to a server using socket connection. I have a button, when I click on the button, it's giving the below exception in Unity.

"SocketException: No connection could be made because the target machine actively refused it.".

What will be the issue? Can anyboady help me out? Below is the code I have written for connecting to the server:

internal Boolean socketReady = false;
NetworkStream theStream;
StreamWriter writer;
StreamReader reader;
try{
        connect = new TcpClient (host, port);
        theStream = connect.GetStream ();
        writer = new StreamWriter (theStream);
        reader = new StreamReader (theStream);
        return true;
        //socketReady = true;
    }
    catch(ObjectDisposedException) {
        return false;
    }

sentences:
How to stop a jump midair and remove y velocity in the process What I want to do is to cut a jump midair by turning off the y velocity when the player releases the jump button (like in Hollow Knight). I managed to do that with:
rb.velocity = new Vector2(rb.velocity.x, 0f);

My problem is when I cut the jump and I am midair, if I repeat the release jump button process, the whole thing happens again, the character staggers as long as I am releasing the jump button continously.
I would like to be able to do that only once when I am off the ground. I am a noob when it comes to coding so I don't really know what to do.
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.Events;

 public class PlayerController : MonoBehaviour {

     public Animator animator;

     private Rigidbody2D rb;
     public float speed;
     private float moveInput;
     public float jumpForce;

     private bool isGrounded;
     public Transform feetPos;
     public float checkRadius;
     public LayerMask whatIsGround;

     private float jumpTimeCounter;
     public float jumpTime;
     private bool isJumping;
     private bool facingRight = true;
     public float jumpDownForceY = 0;

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

     }

     void Update()
     {

         isGrounded = Physics2D.OverlapCircle(feetPos.position, checkRadius, whatIsGround);

         if (Input.GetButtonDown("Jump") && rb.velocity.y == 0)
             rb.AddForce(Vector2.up * 700f);

         if (Mathf.Abs(moveInput) > 0 && rb.velocity.y == 0)
             animator.SetBool("Running", true);
         else
             animator.SetBool("Running", false);

         if (rb.velocity.y == 0)
         {
             animator.SetBool("Jumping", false);
             animator.SetBool("Falling", false);
         }

         if (rb.velocity.y > 0.2)
         {
             animator.SetBool("Jumping", true);
         }

         if (rb.velocity.y < 0)
         {
             animator.SetBool("Jumping", false);
             animator.SetBool("Falling", true);
         }

         if (isGrounded == true && Input.GetButtonDown("Jump"))
         {
             isJumping = true;

             jumpTimeCounter = jumpTime;
             rb.velocity = Vector2.up * jumpForce;
         }

         if (Input.GetButton("Jump") && isJumping == true)
         {

             if (jumpTimeCounter > 0){
                 rb.velocity = Vector2.up * jumpForce;
                 jumpTimeCounter -= Time.deltaTime;
             } else {
                 isJumping = false;
             }

         }

         if (Input.GetButtonUp("Jump"))
         {
             isJumping = false;
             rb.velocity = new Vector2(rb.velocity.x, 0f);

         }

     }

     void FixedUpdate()
     {
         moveInput = Input.GetAxisRaw("Horizontal");
         rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
         Flip(moveInput);

     }

     private void Flip(float moveInput)
     {
         if (moveInput > 0 && !facingRight || moveInput < 0 && facingRight)
         {
             facingRight = !facingRight;
             Vector3 theScale = transform.localScale;
             theScale.x *= -1;
             transform.localScale = theScale;
         }

     }
 }

sentences:
Help with dropping items in a game I am making a game where i have items or blocks stacked on top of each other.

What i would like to do is, when the first item(or the item at the bottom of the stack) is removed, i would like to shift all the blocks above, down into the next position below it and add another block to the top of the stack.

Sort of like in a match 3 game.

Could someone provide instructions for doing this? or some type of psuedocode?

Thanks guys

sentences:
How to balance experience gain in an RPG I am currently developing an RPG game with a classic experience-points and levelup mechanic. The player kills monsters, gains experience points, levels up when they collect enough and become stronger.

How do I balance the amount of Exp points necessary for reaching each level and the amount of Exp awarded by each monster on each level?

sentences:
Selecting a range of hex tiles within radius of main tile What I'm doing is pretty new to me, or at least I think it is, so I'm not really sure of what I'm looking for. Hopefully someone here knows =-)

Using a grid of hexes I generate, I can hover over any tile and it will highlight just fine. Now what I'm trying to figure out is how to allow for a radial selection of tiles around that hovered tile (brush size, basically), eventually allowing for a somewhat radial soft-selection gradient to allow falloff.

Each hex already knows about their neighbors, so currently I am hard-coding logic to handle a radius of 1, 2 or 3. I could duplicate that logic over and over to handle bigger radii but this is definitely not going to work for much longer, so I am trying to figure out a more efficient and cleaner way using loops/recursion/whatever.

Can anyone offer any pseudo-code or possibly a link that explains how to do this? Below is a (probably bad) attempt at what I think it would look like.

OnMouseOver(){
    // This would select a radius of x hex tiles including center tile
    this.SelectTile(3);
}

SelectTile(selectionRadius){
    if(!this.alreadySelected){
        this.Select();
    }
    for(int i = 0; i <= selectionRadius; ++i){
        if(i < selectionRadius){
            foreach(HexTile tile in thisTile.neighbors){
                tile.SelectTile(selectionRadius - i);
            }
        }
    }
}

Edit: I'm using this fantastic resource to help with hexes - http://www.redblobgames.com/grids/hexagons/ - so might there be a section on this page that may explain what I need and I'm just missing?

sentences:
Convert large range of numbers to a smaller scale 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

sentences:
Apply delta time to physics correctly So I'm trying to create a simple physics engine for the game I'm creating. I'm trying to add jumping to the game. To do this I used (where jumpPower is 30000):

impulses.emplace_back(0.0f, mass * World::getGravityForce() + jumpPower, 0.0f);

This creates a nice jump effect when using vsync, but when I turn vsync off the jump is low. This is caused by the fact that in lower fps rates, the velocity is less affected by gravity. In the code below, how could I fix this issue? (In a generalized way, so not just using the velocity vector instead)

A possibility could be updating physics at a fixed rate, but I don't know if that is the best solution.

At the moment forces is filled with a downward gravity, applied each frame
and impules is filled with a jump force as soon as the player presses Space. No other forces are used and only this code affects force/velocity/acceleration.

for (vec3f& f : forces)
    force += f;

for (vec3f& f : impulses)
    force += f;

impulses.clear();

//Add movement forces
velocity += movementVec/mass * delta;

vec3f new_acceleration = force / mass;
velocity += delta * (acceleration + new_acceleration) * 0.5;
acceleration = new_acceleration;

sentences:
OpenGL assets and new OpenGL context So I have a bunch of meshes, materials, etc and then all of a sudden the window needs to be torn down and then recreated (such as switching on fullscreen with GLFW) which means I will get a new OpenGL context and my old OpenGL data is invalid.

What is the best way to reload all my OpenGL assets - do I save all the mesh and material data in system RAM (which is quite a waste isn't it? if you do not recreate the window during the game, it does absolutely nothing for alot of RAM) -OR- do you map the filepaths to all assets, and then re-read from disk when you reload them? (could lead to alot of file i/o)

Or is there a better alternative? What is the best-practice here?

sentences:
Swift - Why does my SKShapeNode pass through an object, pausing briefly beforehand? The code below when run on a device that’s flat on the table shows a red circle (the 'ball') and a line.

When I gently tip the device the circle moves towards the line. When it reaches the line, it stops which is the expected and desired behaviour.

BUT if I keep tipping, the circle moves through the line. I’ve been trying for 2 days to work out why grrr I just want the circle to hit the line and not go through it.

Any ideas? Anything to do with the line being an 'edge'?

Cheers,
Andy

import SpriteKit
import CoreMotion

class GameScene: SKScene, SKPhysicsContactDelegate {
    var ball : SKShapeNode!
    var line : SKShapeNode!
    var motionManager = CMMotionManager()
    var destX : CGFloat!
    var destY : CGFloat!
    let ballRadius = CGFloat(20.0)

override func didMoveToView(view: SKView) {
    backgroundColor = SKColor.whiteColor()
    physicsWorld.gravity = CGVector(dx: 0, dy: 0)
    physicsWorld.contactDelegate = self

    ball = SKShapeNode(circleOfRadius: ballRadius)
    ball.fillColor = UIColor.redColor()

    ball.position = CGPoint(x: frame.size.width/4, y: frame.size.height / 2)
    destX = frame.size.width/4
    destY = frame.size.height / 2
    ball.physicsBody = SKPhysicsBody(circleOfRadius: ballRadius)
    addChild(ball)

    line = SKShapeNode()
    var lineStart = CGPoint(x: frame.size.width/2, y: 0)
    var lineEnd = CGPoint(x: frame.size.width/2, y: frame.size.height)
    var linePoints = [lineStart, lineEnd]
    var linePos : CGMutablePathRef = CGPathCreateMutable()
    CGPathAddLines(linePos, nil, linePoints, 2)
    line.path = linePos
    line.strokeColor = UIColor.blackColor()
    line.physicsBody = SKPhysicsBody(edgeFromPoint: lineStart, toPoint: lineEnd)
    addChild(line)
}

override func update(currentTime: NSTimeInterval) {
    moveBall()
}

func moveBall() {
    motionManager.startAccelerometerUpdatesToQueue(
    NSOperationQueue.currentQueue(), withHandler: {
        data, error in
        var currentX = self.ball.position.x
        var currentY = self.ball.position.y
        self.destY = currentY - CGFloat(data.acceleration.x * 100)
        self.destX = currentX + CGFloat(data.acceleration.y * 100)
        }
    )
    ball.position = CGPoint(x: destX, y: destY)
    }
}

import UIKit
import SpriteKit

class GameViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    let skView = self.view as! SKView
    let scene = GameScene(size: CGSizeMake(
    skView.bounds.size.width, skView.bounds.size.height))
    skView.showsFPS = true
    skView.showsNodeCount = true
    skView.ignoresSiblingOrder = true
    scene.scaleMode = .AspectFill
    skView.presentScene(scene)
}

override func prefersStatusBarHidden() -> Bool {
    return true
}
}

EDIT: many thanks to Attackfarm :)

I changed the moveBall() function as follows:

func moveBall() {
    motionManager.startAccelerometerUpdatesToQueue(
        NSOperationQueue.currentQueue(), withHandler: {
            data, error in
                self.ball.physicsBody!.applyForce(CGVector(dx: -data.acceleration.x*100,
                        dy: data.acceleration.y*100))
        }
    )

which in this proof of concept demonstrates what I needed. Thanks again!

sentences:
libgdx game process dies on loading texture atlases I try to load a lot of texture atlases (10) with approximately 5 (~2048x~2048)(not using PoT) .pngs each. I'm using AssetManager and there is no trouble with it on my pc but when I try it on my tablet the app just dies without any error messages or crash reports and there aren't any outOfMemoryExceptions.

Here's my log:

DropBox link

the max memory: 67 is

Runtime().getRuntime().maxMemory() / 1000000

I'm running out of ideas of what to do. Maybe I don't fully understand the way mobile games work: is that a lot of atlases (I have other textures not atlases apart from these atlases)? because everything looks quite fine in the memory segment as much as I know. Anyway I'm open to suggestions and maybe some tips. And I'd really like to keep these atlases in my game.

EDIT: the game loads on my tablet but not phone when I use 1 png per atlas (8192x8192) but my tablet doesn't show images larger than 2048x2048 for some reason oh and the images in the atlas aren't even 1024x1024 so idk why it doesn't show them must be because the atlas is 8192x8192.

EDIT #2: I load only atlases now, no separate .png files and I am now using PoT (2048x2048). 17 atlases some have 2 pngs some even have 1 png but there are some that have 5+ and that's my level plus player animations plus I'm using a gradient for my whole level that is ~10000px in width combined and I use FBO to do a Lighten shader on the level and my level has animations. Is that too much? Anyway this time the game died @ 94% on my phone(Galaxy S2) and @ 58% on my tablet(Lenovo IdeaTab A2109) and here's my new log but this time from my phone:

DropBox link log_new

I'm confused because there aren't any outOfMemory exceptions and I'm disposing every possible thing there is to dispose. btw my app in the logs is com.comraz.slashem
Is theree something I can do? f.e. downscale textures or use mipmaps or something? my level textures are 1024x768 when zoomed in and 1024x1536 when zoomed out. If you have any ideas or any questions please do ask or tell me. Oh and my camera size is 1280x768

sentences:
Creating a curved mesh on inside of sphere based on texture image coordinates In Blender, I have created a sphere with a panoramic texture on the inside.  I have also manually created a plane mesh (curved to match the size of the sphere) that sits on the inside wall where I can draw a different texture.

This is great, but I really want to reduce the manual labor, and do some of this work in a script -- like having a variable for the panoramic image, and coordinates of the area in the photograph that I want to replace with a new mesh.

The hardest part of doing this is going to be creating a curved mesh in code that can sit on the inside wall of a sphere.

Can anyone point me in the right direction?

sentences:
How to set up the camera for a PS Vita game? I am starting my first project for Unity and I want to start a new game for PS Vita. This console has a resolution of 960x544 pixels.

How do I have to set up my camera so that it adapts to this aspect ratio?

sentences: Jumping with a player Matrix My players position is stored in a world matrix and I want to make him jump. Can I do this just by creating a translation from the matrix? I want the player to be able to jump while moving in a direction also. I've looked on google but didn't find any tutorials on jumping with a matrix

sentences:
Make zoomable Camera and Environment follow player smoothly I am making a 2D side-scroller racing game. The Player is a car that moves on a 2D terrain already created. The Camera follows the Player. I also wanted to created more depth by making the background follow the y-axis of player so that the background doesn't look like a plain picture. The effect I want to replicate is that when the player jumps the camera just zooms out.

I am using a perspective camera so it zooms out by moving it slightly farther away from the Player. Unfortunately, the effect isn't smooth.

The platform is using 2D edge collider. The movement gave me motion sickness and I just don't know what I should be doing to make this follow nicely.

I have tried using smooth damp that gave me spring effect which isn't needed here. I used Lerp which just doesn't work at all. It's dang slow and when I make it fast it just same undesirable behaviour. The MoveTowards works a bit but not quite really. The smoothness is just not what I want.

For reference, my game is pretty much same like the I hate zombies.
check video https://youtu.be/YQZoBC1hVyk?t=31s

attached is my code.

 Vector3 newPos;
public Vector3 camOffSet = Vector2.zero;
public float speed = 2;
Vector3 velocity = Vector3.zero;
void FixedUpdate()
{
    if (CarController.Instance != null)
    {
        newPos = CarController.Instance.transform.position + camOffSet;
        if (CarController.Instance.IsGrounded)
        {

            newPos.z = -10;
        }
        else
        {
            float zz = Mathf.Clamp(-10 - newPos.y, -20, -10);
            newPos.z = Mathf.Clamp(-10 - newPos.y, -20, -10);
            //newPos.x = CarController.Instance.transform.position.x + (camOffSet.x * 3);
            newPos.x += (zz * -0.4f);
            //newPos.z = Mathf.MoveTowards(transform.position.z, Mathf.Clamp(-10 - newPos.y, -20, -10),
            //    speed * Time.deltaTime);
        }
        //transform.position = newPos;
        transform.position = Vector3.MoveTowards(transform.position, newPos, speed * Time.deltaTime);
    }
}

sentences:
Character movement in Unity For an endless runner game such as Subway Surfer, in order to move your character so smoothly in both z-axis and x-axis, which component of the followings is better:

CharacterController or RigidBody?

Can we use both of them together; if so, will it have any effect on the performance of our game?

sentences:
How do I implement 2d color animation like in this video? link on youtube
at 1:38 - 1:42, purple things (I think this is particle system) that come off from the moon.

Someone else had decompiled the game in the past, and the assets shows that the dark blue area around the moon (after purple things come off) is just background image. So my assumption is that there are many of those 'purple things', that use additive blending to give different density of 'purpleness'.

The details that I'm looking at are:

As those purple things come off completely from the moon, it forms
jagged shapes
At the edge of those jagged shapes, color blends
smoothly instead of sharp turn between purple and dark blue(I know
how to do it with simple shapes, but in here, the jagged shape
itself constantly changes)
further from edge between dark blue and
purple, at the light purple direction, the density of purple is nice
and smooth

I'm pretty familiar on animating objects by manipulating transform,  but this one seems like a lot of color works with programatically created shapes, any idea?

sentences:
What is a direction vector and why should it be normalized? I've been trying to get the hang of vectors and I read Wolfire's blog about linear algebra and I seem to understand most stuff except when it comes to storing a direction as a vector and using it by multiplying the velocity by it. I know it has to be normalized (have a length of 1), but why does it have to be 1 specifically and how would I use it?

Also how would I represent it in 2D [x,y] coordinates. For example if I wanted a direction such as North-East?

sentences:
How can I make an enemy to step around solid objects and follow the player at a given distance? var target_distance = 40;
var distance_to_object = 0;

target_distance = distance_to_object(objPlayerParent);

if ( target_distance >= follow_distance )
{
    mp_potential_step_object(objPlayerParent.x, objPlayerParent.y, 1, objEnemyParent);
}

With this code, the enemy ships are chasing the player, but are still colliding with each other, they also rather fly around the player than following his trail.

mp_potential_step(objPlayerParent.x, objPlayerParent.y, 1, true)

This did not lead to the desired effect either.

How can I make an enemy to step around all solid objects in my level and follow the player at the given distance?

More context: The whole game plays in space and at the moment there are not many objects, but each type of object has it's own parent ( objPlayerParent, objEnemyParent, objPowerUpParent etc) and they are supposed to avoid all objects marked as solid. I also apologize for the quite noobish question but I am really new to advanced AI programming.

sentences:
Combining cubes Issue in Marching Cubes I was trying to implement the marching cubes and combine every little cube this way:

I get a cube of vertices depending on their surfaceLevel
I look for the ones that are below the surfaceLevel and get the edges that relates to them
get a vertice out of the edge using the formula on: http://paulbourke.net/geometry/polygonise/
I put every vertex i created based on the edges on mesh.vertices
I make the order on mesh.triangles based of the edge number on triTable
i combine everything
but i get this:

Here's my code: https://pastebin.com/jqetCk8r.
My guess was that the combine order of every marched little cube is not good.
I've got no idea know how to solve this.
ps: the triTable doesn't show in the pastebin, i copied it from the same link above.

sentences:
Generating multiple instances of one opengl object with random coordinates Sorry if the question is dumb but my brain just cannot solve it for some reason..

So I've made one opengl object public static Square ball = new Square(75,75);

And I am trying to make it so that every so often a new ball appears on the screen

public void Loop(GL10 gl) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glLoadIdentity();
    long timeSinceStart = SystemClock.uptimeMillis();
    long deltaTime = timeSinceStart - oldTimeSinceStart;
    oldTimeSinceStart = timeSinceStart;
    if(deltaTime >= 15) {
        RandBall(gl);
    }}

code for RandBall()

   `public void RandBall(GL10 gl) {
     gl.glPushMatrix();
         gl.glTranslatef(rand.nextInt((1280 - 0) + 1) + 0,
                         rand.nextInt((720 - 0) + 1) + 0, 0);
         getBall().draw(gl);
     gl.glPopMatrix();
}`

but when I run the code it draws only one object and constantly changes its coordinates. How do I make it so that it draws multiple objects with different random coordinates? The solution is probably going to be an easy one but I just can't see it :/

sentences:
Libgdx - Collision position - Box2D I'm currently developing my own game but I'm facing a little problem. I am trying to figure out how to get the position of a fixture (collision) between two entities.

For example this:

(the grey rectangle is the player and the greens is an entity (not moving)).

With this code :

        Array<Contact> contacts = levelDatas.world.getContactList();
        try {
            for(Contact contact : contacts) {
                if(contact.getFixtureA().equals(playerBody.getFixtureList().get(0))) {
                    levelDatas.bodyIsWall(contact.getFixtureB().getBody());
                }
                if(contact.getFixtureB().equals(playerBody.getFixtureList().get(0))) {
                    levelDatas.bodyIsWall(contact.getFixtureA().getBody());
                }
            }
        } catch(GdxRuntimeException exp) {
        }

I get all the collision between a player and something else. But my problem is that I want to know where the collision is happening (on the left? on the right? bottom? top?). We can see that if there is a collision between 2 entities, a little point is draw. Anyone have a tip to give me the position of the collision?

Thanks

sentences:
Editing attached component property in Unity (C#) This might be more of a general C#/programming query, but since it's game dev related, I'm putting it here.

I am trying to randomise a property in a custom component (C# script) across several Unity game objects.

hostiles is a list of game objects, each with an attached Stats component.

foreach (GameObject gO in hostiles)
{
    // Randomise spawn area…
    gO.GetComponent<Stats>().AreaNo = Random.Range(0, 3);
}

Perhaps unsurprisingly, all of my objects end up with the same value for AreaNo. It seems as though I’m reassigning some global version of Stats.AreaNo in my loop, rather than the individual instances. What am I missing?

(Sorry in advance for the noobish question!)

sentences:
Update variable before building the unity build Before building the standalone build I want to update one of the variables in the script using this.

class MyCustomBuildProcessor : IPreprocessBuild
 {
      public int callbackOrder { get { return 0; } }
      public void OnPreprocessBuild(BuildTarget target, string path) {
        // Do the preprocessing here
        CopyRightCls.buildDateTime = System.DateTime.Now;
        Debug.Log("+++++++++++++++++++++++++++++++++++BuildDateTime" + CopyRightCls.buildDateTime);
      }
 }

But the problem is my date variable is not updating its showing 1 january 0001.

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

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

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

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

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

My lighting method is below

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

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

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

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

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

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

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

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

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

sentences:
How to target an entity that is moving I want my arrow to chase the minion that I just rightclicked on.
I have a Minion Class and an Arrow Class. These are the constructors:

    /// <summary>
    ///  Constructs a minion
    /// </summary>
   public Minion(Texture2D sprite, int x, int y, int windowWidth, int windowHeight, bool isFriendly, int minionHealth)

    /// <summary>
    /// Constructor of the bullet from champion to minion
    /// </summary>
   public Arrow(Texture2D sprite, Vector2 sourceEntity, Vector2 targetEntity, float arrowSpeed, int arrowAttackSpeed, int damageDone, bool isArrowActive)

In the Game1 I have the standard if-click structure and I check if the click is on the minions. But I check this with

    foreach (Minion minion in enemyMinions)

So - I want to mark somehow the minion I clicked on and then to send the arrow directly to its moving location.

How to do that?

Update:

        //checks if rightmouse button was clicked to activate the arrow
        if (mouse.RightButton == ButtonState.Released && previousButtonState == ButtonState.Pressed)
        {
            //checks if the right mouse click was on a minion and the minion is in champion's range
            for (int i = 0; i < enemyMinions.Count; i++)
            {
                if (enemyMinions[i].CollisionRectangle.Contains(mouse.X, mouse.Y)
                    && (Math.Abs(mouse.X - enemyMinions[i].X) < vayne.ChampionRange) ||
                    Math.Abs(mouse.Y - enemyMinions[i].Y) < vayne.ChampionRange)
                {
                    //mark the minion that the click was made on
                    theCurrentTarget = enemyMinions[i];

                    //sets the arrow.targetEntity to that particular minion
                    arrow.TargetX = theCurrentTarget.X;
                    arrow.TargetY = theCurrentTarget.Y;

                    arrow.IsArrowActive = true;
                }
            }
        }
        previousButtonState = mouse.RightButton;

sentences:
SDL render to a texture I am trying to create a button for my game there are lots of similar buttons so using an image for each one is a bit inefficient. So I want to load an image then copy some text over it and render that to the screen. But it just doesn't render anything, it just gives me a transparent surface.

SDL_Texture* button = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA888, SDL_TEXTUREACCES_TARGET, 200, 50);
SDL_SetRenderTarget(renderer, button);

SDL_Texture* border = IMG_LoadTexture(renderer, "border.png");
SDL_Texture* text = SDL_CreateTextureFromSurface(renderer, TTF_RenderText_Blended(font, "new race", color));

SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, border, NULL, NULL);
SDL_RenderCopy(renderer, text, NULL, &text_centered);
SDL_SetRenderTarget(renderer, NULL);

Then I do some extra stuff and finally:

SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, background, NULL, NULL);
SDL_RenderCopy(renderer, button, NULL, &position);
SDL_RenderPresent(renderer);

But it just rendered the background not the button, that indicates that the textures I tried to render to button where not rendered and it is still just a blank texture. I already set SDL_RENDERER_TARGETTEXTURE but it just doesn't work.

UPDATE:

I found out that the problem was that the format and the access where passed in the wrong way, I corrected it and now when I compile there is an access violation, this is because I pass SDL_TEXTUREACCES_TARGET as the access argument, if I pass SDL_TEXTUREACCES_STATIC there is no such violation, the problem is that I can't use SDL_SetRenderTarget if it is static, it needs to be target (which causes an access violation error).

sentences:
Fading back and fourth Unity Image alpha I'm trying to create a way in which if I press a button, it'll highlight other objects whilst at the same time fading other objects. I also have other buttons that will fade and highlight different objects. Some of which may have been modified by the first button.

I had done this originally in a really dumb way like so

public void Highlight()
{
    foreach (Image image in imagesToHighlight)
    {
        Color c = image.color;
        if(c.a < maxColor)
        {
            c.a = maxColor;
        }

        image.color = c;
    }

    foreach (Image image in imagesToFade)
    {
        Color c = image.color;
        if(c.a > halfColor)
        {
            c.a = halfColor;
        }
        image.color = c;
    }
}

This works, but I was wanting it to happen gradually to provide a smother transition. I managed to get the fade working, by changing the code to this:

IEnumerator Fade(Image image)
{
    float elapsedTime = 0.0f;
    Color c = image.color;
    while (elapsedTime < 1)
    {
        yield return fadeInstruction;
        elapsedTime += Time.deltaTime;
        c.a = 1.0f - Mathf.Clamp01 (elapsedTime / fadeTime);
        image.color = c;
    }
}

I then call the method in my foreach loop like so:

foreach (Image image in imagesToFade)
{
    StartCoroutine (Fade (image));
}

Again, this works fine. The problem I'm having is checking to see if the image is faded, and if it is and needs to be highlighted, it reverses from the fade value to the highlight value (0.5 to 1.0).

I thought this would be a simple change as did this

IEnumerator HighLight(Image image)
{
    float elapsedTime = 0.0f;
    Color c = image.color;

    while (elapsedTime < 1 )
    {
        yield return fadeInstruction;
        elapsedTime += Time.deltaTime;

        c.a +=  Mathf.Clamp01 (elapsedTime / fadeTime);

        image.color = c;
    }
}

Simply changing the alpha line. However, now my image alphas jump all of the place in the highlight method. I'm at a loss as to how I can fix this. Can someone please tell me what I'm doing wrong?

sentences:
Calculating size and position of Tilemap for camera bounds I'm new to Unity and I'm following a series of tutorials covering off building a 2D Zelda-like game. I'm at a stage where I have two Tilemaps side by side and I'm working on a transition between them, triggered when the player collides with a trigger at the edge of Tilemap 1.
I have a basic camera movement script which follows the player and constrains the camera within the bounds of Tilemap 1 - it's constrained by two Vector2 fields (a min and a max). I got the values for these two Vector2 fields manually in the Scene editor by moving my camera to the desired edges, noting its transform position and entering in those values to the camera movement script.
For the transition, I will change these min and max Vector2 values in the camera movement script to then constrain the camera to Tilemap 2. I could just hard code these in again, but it seems like a good learning opportunity to try and calculate these values dynamically.
My room change script stores a reference to the camera movement script so that it can amend the min and max values itself. In an attempt to get it to calculate the next room's bounds dynamically, I added a public Tilemap field to the room change script so it can examine it and determine the bounds of the next room itself. I then set this field in the Inspector to point to Tilemap 2.
I've so far been unable to calculate these new bounds from the Tilemap reference. The cellBounds property looked promising: Position (-44, -7, 0), Size: (19, 20, 1) - the size is right, but the actual origin position I calculate manually by moving my camera in the scene editor is -35.14, -2.02. As a result, setting the bounds off of what cellBounds tells me does not work. I've made sure that I've used the 'Compress Tilemap Bounds' too.
I've tried accessing individual tiles within the Tilemap and using CellToWorld - this only seems to give me the Tile's position relative to the Tilemap (?).
The transforms for all of the Tilemaps in my scene - and their parents (which are Grids) - are set to 0, 0, 0.
Basically, I know I should calculate a value of approximately -35.14, -2.02 for my new min position, but I can't see any way to calculate that. How do I go about achieving this, and the same for max?
Here is what my scene looks like:

Main Camera [Camera, Audio Listener, Camera Movement (script)]
Player [Sprite Renderer, RigidBody 2D, Box Collider 2D, Player Movement (script), Animator]
Room1 [Grid]

Ground [Tilemap, Tilemap Renderer]
Collision [Tilemap, Tilemap Renderer, Tilemap Collider 2D, RigidBody 2D, Composite Collider 2D]

Room2 [Grid]

Tilemap [Tilemap, Tilemap Renderer]

RoomTransfer [Box Collider 2D, Room Move (script)]

sentences:
Code reuse for a CRPG data model on the server-side I'm working on a turn-based game with CRPG (Computer RPG) elements in HTML5. It has to support 10K+ CCUs (Concurrently Connected Users).
The CRPG elements in the game are item and character systems:

The game has characters, characters have items.
Items may be worn or used as consumables.
Items may be crafted and upgraded.
Characters gain experience and get new levels.
Characters and items have characteristics (like health, attack strength etc.).
Characters may have buffs and debuffs placed on them that affects characteristics.
Characters have talents that acts like permanent buffs or debuffs.
Items worn and consumables used may affect character characteristics.
Characters may strike each other, and strike outcome is calculated based on the effective characteristics of the attacker and target.

All of the above has to be stored and handled on the server-side.
To avoid developing everything from scratch for the 100th time, I'd like to maximize my reuse of existing code: original, free, or commercial.
I can adapt the CRPG model requirements to the implementation limitations to a certain (considerable) extent. Technology stack does not matter much either — as long as it is reasonably scalable.
How can I author my server-side solution to maximize code reuse?

sentences:
How do I interpolate air drag with a variable time step? So I have a little game which works with small steps, however those steps vary in time, so for example I sometimes have 10 Steps/second and then I have 20 Steps/second. This changes automatically depending on how many steps the user's computer can take. To avoid inaccurate positioning of the game's player object I use y=v0*dt+g*dt^2/2 to determine my objects y-position, where dt is the time since the last step, v0 is the velocity of my object in the beginning of my step and g is the gravity. To calculate the velocity in the end of a step I use v=v0+g*dt what also gives me correct results, independent of whether I use 2 steps with a dt of for example 20ms or one step with a dt of 40ms.

Now I would like to introduce air drag. For simplicity's sake I use a=k*v^2 where a is the air drag's acceleration (I am aware that it would usually result in a force, but since I assume 1kg for my object's mass the force is the same as the resulting acceleration), k is a constant (in this case I'm using 0.001) and v is the speed.

Now in an infinitely small time interval a is k multiplied by the velocity in this small time interval powered by 2. The problem is that v in the next time interval would depend on the drag of the last which again depends on the v of the last interval and so on... In other words: If I use a=k*v^2 I get different results for my position/velocity when I use 2 steps of 20ms than when I use one step of 40ms.

I used to have this problem for my position too, but adding +g*dt^2/2 to the formula for my position fixed the problem since it takes into account that the position depends on the velocity which changes slightly in every infinitely small time interval.

Does something like that exist for air drag too?
And no, I dont mean anything like Adding air drag to a golf ball trajectory equation or similar, for that kind of method only gives correct results when all my steps are the same.
(I hope you can understand my intermediate english, it's not my main language so I would like to say sorry for all the silly mistakes I might have made in my question)

sentences:
Animator, gameObject position not being kept I have idle & popout animations. Idle- simple scaling up and down 2d object and popout- get the gameobject's position to the right and leave it there. I'm using animator for this purpose. I have a trigger Popout, which when triggered the animator goes from playing the Idle animation to the popout animation. Then another transition from the popout anim back to the idle anim. The problem is that when it gets back to the idle anim, the position gets back to the first one(i.e. as if the popout anim hasn't been played). My goal is, after playing the popout, the gameObject to stay at the last position from the popOut anim and to continue to be scaled up and down(the idle anim). My goal is, the gameObject to keep its last position set from the popout anim(which is to the right of its initial one) and to continue playing the idle anim from there instead of going back to its initial position.

Why does the animator reverses the gameobejct's position to its initial one, after the popout anim has been played?

In this video you can see the problem and what exaclty I'm doing.

sentences:
Optimization of Cube-based World I'm currently working on taking an idea I've been toying with in C++ and bringing it into Unity, but I'm struggling to figure out how to make it performant and how to do things the "Unity way".

My world is made up of cubes and cube shaped tiles viewed from a fixed angle (à la Monument Valley). I've watched their behind the scenes video and seen that they have a step in their workflow that removes the unused faces from their cubes and combines them into quads. I want to achieve something similar.

Ideally I want to build up my world using a bunch of prefab cube objects (with different textures and components) and then run some kind of process over my scenes before I export/play to optimize them (otherwise I'm going to be doing potentially thousands of draw calls that I don't need to do and have lots of colliders I don't need).

My questions are as follows:

What hooks does Unity provide to do this sort of processing? Should I be using PostProcessSceneAttribute for this?
I understand that I can use Mesh.CombineMeshes to combine my cubes, but what about for their colliders?
How can I determine groups of cubes that are touching (for removing faces and combining colliders)? In my C++ project I keep all of the blocks in a 3D array and use that, but using the Unity editor to place the blocks means I don't have this available. Is there a way I could easily build one from my scene, or is there a more "Unity" way of doing this?
Is my approach sensible? Or should I drop the idea of placing individual cubes in the editor and take a different approach?

sentences:
How do i set conditions for an IF statement as the game progress through "difficulty"? This is code that I wanted to put in my IF statement
    public GameObject fallingRockPrefab;
public Vector2 spawnsMinMax;
float randX;
float randY;

//Spawn Positions
Vector2 SpawnPosition;
float nextSpawnTime;

void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(spawnsMinMax.y, spawnsMinMax.x, Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

        randX = Random.Range(-5.6f, 5.6f);
        randY = 5.57f;
        SpawnPosition = new Vector2(randX, randY);
        Instantiate(fallingRockPrefab, SpawnPosition, Quaternion.identity);

    }

}

This is the code from my "Difficulty.GetDifficultyPercent"
    public static class Difficulty{
static float secondsToMaxDifficulty = 30;

public static float GetDifficultyPercent()
{
    return Mathf.Clamp01(Time.timeSinceLevelLoad / secondsToMaxDifficulty);
}}

I'm planning to make a certain event happen when my game bypass a certain stage of a difficulty as it progress but I just don't know what to put it as.
My guess is this,
if(Time.time > Difficulty(25))
but didn't work.

sentences:
In a shader, why does substituting a variable with the expression producing it cause different behaviour? I have this correctly-working OpenGL shader producing Perlin noise:

 float left = lerp(fade(v),  downleft,  topleft);
 float right = lerp(fade(v), downright, topright);
 float result = lerp(fade(u), left, right);

Then I tried plugging the definitions of right and left into result:

float result = lerp(fade(u),
                    lerp(fade(v), downleft,  topleft),
                    lerp(fade(v), downright, topright));

Surprisingly, this behaves completely differently, giving visible edges in my Perlin noise. Below are both results:

My whole 30-line shader is here.

What is the difference between those?

sentences:
Rotate an object around a point in Ogre3D Possible Duplicate:
  How can I rotate about an arbitrary point in 3D (instead of the origin)?

I am new to 3D programming and I have been using Ogre3D lately to get a grasp of it.

What I am trying to do is the following:

I want to make an entity rotate around a point (probably the parent SceneNode) in a circular way only in the X and Z axis.

I have tried using yaw/pitch/roll and rotate but no luck, and I can't find any good tutorials/how-tos online.

sentences:
Polygon draw order issue I'm working on a software and I'd to move the rendering API from SlimDX to SharpDX. I've done that but I noticed that the solid polygon are not drawn correctly i.e., even if the polygon is at the back side of another polygon, part of it is visible, also part of the polygon lie inside terrain that is also visible. Below are the images from SlimDX implementation and SharpDX implementation for reference:

I tried to set the Stencil & ZBuffer but there are not working as expected. I've already applied DepthBias to it which worked fine with SlimDX but not with SharpDX.
Please let me know if, I'm missing something or I'm doing something wrong.
Update 1 (Polygon rendering):
// set the render state to device
device.SetRenderState(RenderState.AlphaTestEnable,
                      true);
device.SetRenderState(RenderState.AlphaBlendEnable,
                      true);
device.SetRenderState(RenderState.SourceBlend,
                      Blend.SourceAlpha);
device.SetRenderState(RenderState.SeparateAlphaBlendEnable,
                      true);
device.SetRenderState(RenderState.DestinationBlendAlpha,
                      Blend.One);
device.SetRenderState(RenderState.SourceBlendAlpha,
                      Blend.InverseDestinationAlpha);

// set the render state to the device
device.SetRenderState(RenderState.DepthBias,
                      -1E-06f);

this.effectVectoring.Begin(FX.None);

// binds the vertex buffer to device data stream
device.SetStreamSource(0,
                       this.vertexBuffer,
                       dataGeometry.FillVertexOffset,
                       stride);
// pass 1 to shader as a pass if it is 3D mode else 0
this.effectVectoring.BeginPass(is3D ? 1 : 0);
// renders the non-index geometric primitives using the data from current input stream
device.DrawPrimitives(SharpDX.Direct3D9.PrimitiveType.TriangleList,
                      0,
                      primitiveCount);
// end the pass
this.effectVectoring.EndPass();

this.effectVectoring.End();
device.SetRenderState(RenderState.AlphaBlendEnable,
                    false);
device.SetRenderState(RenderState.AlphaTestEnable,
                    false);
device.SetRenderState(RenderState.DepthBias,
                    0);
device.SetRenderState(RenderState.FillMode,
                    FillMode.Solid);
device.SetRenderState(RenderState.SeparateAlphaBlendEnable,
                    false);

Update 2 (Terrain rendering):
device.SetRenderState(RenderState.AlphaBlendEnable,
                      false);
device.SetRenderState(RenderState.AlphaTestEnable,
                      false);
device.SetRenderState(RenderState.CullMode,
                      Cull.Counterclockwise);

device.Indices = this.terrainIB;
device.SetStreamSource(0,
                       this.terrainVB,
                       0,
                       12);
device.VertexFormat = VertexFormat.Position;

// Set texture in effect...

effect.Begin(FX.None);

effect.BeginPass(pass);
device.DrawIndexedPrimitive(PrimitiveType.TriangleStrip,
                            baseVertexIndex,
                            0,
                            vertexCount,
                            startIndex,
                            primitiveCount);
effect.EndPass();

effect.End();
device.SetRenderState(RenderState.FillMode,
                      FillMode.Solid);
device.SetRenderState(RenderState.CullMode,
                      Cull.None);

sentences:
How to make a background fill the screen on different-resolution phones? I am developing my first Android OpenGL game. It's a 2D game and I would like the background to always fill the screen. I've managed to achieve this by stretching the texture to fit the size of the screen based on the aspect ratio, but the texture becomes quite pixelated when stretched.

What is the correct way to achieve this?

sentences:
How to create polygons from tilemap areas? I'm currently working on a project which needs simple AI's to walk around using pathfinding.

I'm trying to find a way to generate a polygon based on the connected tiles (explained below), an i'm wondering how to do this.

I know about the flood fill algorithm, but have never used it before.

This is what a map (could) look like (maps are created by the players)

Basically, i wan't the yellow outline as one polygon (vector2 array)
and the red outline/area as another polygon (vector2 array)

sentences:
3D Object in 2D Unity Project Is there a way to bring 3D objects into a 2D project that is using the 2D Universal pipeline for rendering light? I have some 3D objects I want to bring in to the project I'm working on, but they just get imported as pure white.
Is there a way to import 3D models into a 2D game, and keep the 2D pipeline for lighting? I'l tried a few different shaders, but if they're not pure white they're pink. I would like them to have shading as a 3D object, and still interact with light and rotate on all axis if possible. If it's impossible to use a 3D object, if there was a way to at least have a 2D sprite taken from a 3D object, but still react to light as if it were 3D, that'd work too I suppose. This is what it looks like,
https://i.stack.imgur.com/HJeIN.jpg
I've also tried adding 3D lights as well, but to no avail. I'm guessing the issue is because of my 2D lighting renderer, and for the record, this is what this tree looks like in a 3D project.
https://i.stack.imgur.com/nKCyd.jpg
I have since attached a custom shader graph to it that I made, it looks okay, but it still doesn't receive shading at all...
Thanks in advance.

sentences:
Bounding Box Collision Glitching Problem (Pygame) So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, I've made a simplified example of the problem. (It's worth noticing that I don't have rotating sprites on my game or anything like that. After showing the code, I'll explain better).

Here's the whole code:

from pygame import *

DONE = False
screen = display.set_mode((1024,768))
class Thing():
    def __init__(self,x,y,w,h,s,c):
        self.x = x
        self.y = y
        self.w = w
        self.h = h
        self.s = s
        self.sur = Surface((64,48))
        draw.rect(self.sur,c,(self.x,self.y,w,h),1)
        self.sur.fill(c)
    def draw(self):
        screen.blit(self.sur,(self.x,self.y))
    def move(self,x):
        if key.get_pressed()[K_w] or key.get_pressed()[K_UP]:
            if x == 1:
                self.y -= self.s
            else:
                self.y += self.s
        if key.get_pressed()[K_s] or key.get_pressed()[K_DOWN]:
            if x == 1:
                self.y += self.s
            else:
                self.y -= self.s
        if key.get_pressed()[K_a] or key.get_pressed()[K_LEFT]:
            if x == 1:
                self.x -= self.s
            else:
                self.x += self.s
        if key.get_pressed()[K_d] or key.get_pressed()[K_RIGHT]:
            if x == 1:
                self.x += self.s
            else:
                self.x -= self.s
    def warp(self):
        if self.y < -48:
             self.y = 768
        if self.y > 768 + 48:
             self.y = 0
        if self.x < -64:
             self.x = 1024 + 64
        if self.x > 1024 + 64:
             self.x = -64
r1 = Thing(0,0,64,48,1,(0,255,0))
r2 = Thing(6*64,6*48,64,48,1,(255,0,0))
while not DONE:
    screen.fill((0,0,0))
    r2.draw()
    r1.draw()
    # If not intersecting, then moves, else, it moves in the opposite direction.
    if not ((((r1.x + r1.w) > (r2.x - r1.s)) and (r1.x < ((r2.x + r2.w) + r1.s))) and (((r1.y + r1.h) > (r2.y - r1.s)) and (r1.y < ((r2.y + r2.h) + r1.s)))):
        r1.move(1)
    else:
        r1.move(0)
    r1.warp()
    if key.get_pressed()[K_ESCAPE]:
        DONE = True
    for ev in event.get():
        if ev.type == QUIT:
            DONE = True
    display.update()
quit()

The problem:

In my actual game, the grid is fixed and each tile has 64 by 48 pixels. I know how to deal with collision perfectly if I moved by that size. Nevertheless, obviously, the player moves really fast.

In the example, the collision is detected pretty well (Just as I see in many examples throughout the internet). The problem is that if I put the player to move WHEN IS NOT intersecting, then, when it touches the obstacle, it does not move anymore. Giving that problem, I began switching the directions, but then, when it touches and I press the opposite key, it "glitches through". My actual game has many walls, and the player will touch them many times, and I can't afford letting the player go through them.

The code-problem illustrated:

When the player goes towards the wall (Fine).

When the player goes towards the wall and press the opposite direction. (It glitches through).

Here is the logic I've designed before implementing it:

I don't know any other method, and I really just want to have walls fixed in a grid, but move by 1 or 2 or 3 pixels (Slowly) and have perfect collision without glitching-possibilities. What do you suggest?

sentences:
How would I make a bullet shoot from my player to my mouse. So far I've created an object called obj_mouse. And my plan is whenever the player left clicks, it spawns a bullet from him toward where ever the mouse is pointing. I've got the concept down, but I'm struggling getting it to work.

Extra bits of code I'm messing around with to try and get it to work:

    bullet=instance_create(x,y,obj_bullet)
with (bullet) {
move_towards_point(mouse_x,mouse_y,5)
image_angle=direction
}

point_direction(obj_mouse,obj_mouse,obj_mouse,obj_mouse)
image_angle=direction

(In the above code, I havent attempted to specify to the program that I want the bullet to go in the direction of obj_mouse, or rather, just the mouse. The above code works, and bullets do shoot, however the player must have the mouse on the players sprite for it to work.)

Thank you in advance for any advice given.

sentences:
Ogre3d 2.1 - How to apply texture on mesh? I have searched forums and tried to read the Ogre 2.1 samples, but I still have no clue how to apply texture on mesh  :(

Here what I've done so far.

I use Easy Ogre Exporter to export the scene (actually I just need the model and texture). I got the following files:

modelRoot.mesh
modelRoot.skeleton
model.material
model.tga

Note: I also use OgreMeshTool_d.exe to upgrade the mesh from v1 to v2.

I render this model into Ogre:

In the file resources2.cfg:

[Essential]
Zip=../Data/DebugPack.zip

I add the model files (4 files I got from Easy Ogre Exporter at step 1 above) into DebugPack.zip file.

And I use this code to add the model into the Ogre scene

void MeshHelper::CreateMesh(Ogre::String szFileName, Ogre::Vector3* scale)
{
    /*Bring the mesh to scene*/
    m_meshItem = m_sceneManager->createItem(szFileName,
        Ogre::ResourceGroupManager::
        AUTODETECT_RESOURCE_GROUP_NAME,
        Ogre::SCENE_DYNAMIC);
    m_meshSceneNode = m_sceneManager->getRootSceneNode(Ogre::SCENE_DYNAMIC)->
        createChildSceneNode(Ogre::SCENE_DYNAMIC);
    m_meshSceneNode->attachObject(m_meshItem);
    if (nullptr != scale)
        m_meshSceneNode->scale(scale->x, scale->y, scale->z);
}
...
meshHelper.CreateMesh("modelRoot.mesh", &meshScale);

But I can only render the model without texture  :(

Please help me to apply these texture into my model

model.material
model.tga

Thanks for reading :)

sentences: How to get a random Vector 2 within a range I'm working on a game and I need the objects that get spawned to launch within a range of angles, so like in the horrible 2 second paint image seen below, I need to grab a random vector within that range of arrows, and then the ball will go off in that direction. I'm just not sure how to get a vector within a range like that. This is in C# and Unity, the game is 2D. Any ideas?

sentences:
Which network engine/library/system to use in a .NET turn-based game? I'm developing an abstract strategy turn-based game in C#.

Being so, high network load is not expected. The players don't even have to be connected all the time. The host could wait for the current player to connect and make his move. I know I could make a web site to run that, but I want anyone to be able to host their own games.

I need something reliable and that enables me to have good productivity.

I'm already underway with WCF. Was that a good choice? Which other network framework should I consider?

sentences:
Unity 5 Dynamic Button Creation with Event Parameters According to the documentation, you cannot instantiate buttons except via prefab instantiate.

http://docs.unity3d.com/Manual/HOWTO-UICreateFromScripting.html

  You might wonder why we don’t have a API methods to create the various types of controls, including visuals and everything. The reason is that there are an infinite number of way e.g. a button could be setup. Does it use an image, text, or both? Maybe even multiple images? What is the text font, color, font size, and alignment? What sprite or sprites should the image use? By letting you make a prefab and instantiate that, you can set it up exactly the way you want. And if you later want to change the look and feel of your UI you can just change the prefab and then it will be reflected in your UI, including the dynamically created UI.

What I'm trying to do is dynamically create a table of buttons, each one going to a level in my game. The amount of button depends on how many levels the user has unlocked.

I can create a prefab for a button, that's fine, but how do I go about assigning an OnClick event to each of these buttons with an appropriate 'levelIndex' parameter?

I can not find any scripting method to do this, and I'd like to avoid hacky solutions like creating 50 buttons and only showing the first N children.

sentences:
FPS using mouse to move rather than keys Hi I am developing a First person game but would like to use the mouse to move on a click to move as opposed to the keys. I also need to disable Y movement and restrict the x movement to 180. What ever values I enter into the input manager, it seems to be ignoring them as I still have both x and y when I run the game.

I dabbled with the standard unity FPS but is seems very jagged on movement and from what I can see being a new user, their doesn't seem to be a way to restrict y movement. Can someone help with this or suggest a good tutorial on this type of movement. Thanks

sentences:
Hex tile systems and the efficient use of classes So I've built myself a system of classes for what I think is an efficient way to describe an entity that would live in my game.

Is this an effective approach or am I creating entities that are too large in size? I want the game to be able to run well even with an inane amount of tiles.

I read the post (Map with 20 million tiles makes game run out of memory, how do I avoid it?) about having one million tiles and memory problems and I'm worried that my tile system I've created using the entity system will not be able to handle such large sized maps as there is so much information to be processed.

To give you an idea about what each component of a Hex Entity holds, the sprite comp maintains the following variables: the texture, position, rotation, height and width; while the hex comp of the hex entity maintains: the position, the coordinates on the board, the orientation, and what hex's are adjacent to it. Should i simplify the date types

sentences:
Unity - blur only selected layers I'm messing around with Unity 2017's post processing tools while making a 2D game that benefits from the parallaxing effect using a perspective camera.
Please note that the game is mostly made using sprites.

Now, I have a playerGround, a backGround and a foreGround. I wish to blur the background and foreground only but not the playerground.
I'd like to know how to do this as playing with the focal length didn't do anything, everything receives the same blur amount regardless of the distance from camera.

sentences:
How to achieve persistence of objects between game states? What are the possible ways of sharing different objects between game states?

Lets say a game has a couple of states (a menu state and a game state for example), at first the engine calls the menu state's load function which loads menu textures, music et cetera.

After returning from the load function the engine enters a loop which calls update and render over and over. At this point the menu state makes a TCP connection to a IP (joining a lobby for a 1v1?) which simply creates a object of a connection class and then signals the engine to switch to the game state, the menu state then unloads all the stuff it loaded up.

Now the engine calls game state's load function, the game state loads models, textures et cetera and then enters the update-render loop.

The question now is, how will the game state know about the connection class object that the menu state created? How do the states share objects between themselves? And not only connections, different object types too, even templates maybe, imagine a template class called container which can hold anything such as textures, models, integers, strings, settings under the form of strings that are shared between the menu state and game state such as what game save the player chose when in menu state, or the difficulty...

There are two questions that look like this one but neither of them answered my question:

Game states affecting each other's objects
Game state sharing data

sentences:
How can I structure in-game menus? I'm working on a multiplayer RPG using only C++ and SDL2. I've already made the main menu and a map editor, and I'm preparing to make the actual game. The main menu and map editor were easy to structure, because they had repetitive visuals and concepts -- map-editing tools can be represented as an enumerated list, just like saved-games and settings -- and so I was able to store them in structured vectors, and then when I went to render everything and check for user actions I could just iterate through the lists and hit every visible menu item. My code for those sections is small and neat; I'm proud of it.

Now, in the game, I'm realizing that my HUD is composed of a rather random assortment of types of things that the player can click on. There's a quick-access area for items, another one for spells, another one for the map, another for NPC-buddy commands, etc, and each of those have totally unique popup menus associated with them. Then there's a menu for crafting, a menu for NPC dialog, and several of the items have their own independent menus for interacting with them.

I'm trying to think of the right way to structure all these lists. Storing them in vectors like I did with the menu and stuff seems like it will land me with an unwieldy and asymmetrical set of nested vectors, and it might be complicated to iterate through it. How do good programmers handle this kind of thing? Should I just make an independent section in code for each in-game menu?

sentences:
What is an efficient mobile rendering order supporting transparent and opaque objects? I'm interested to know how others would do / have done this.

Part 1. Constraints.

My current renderer is being built to support OpenGL ES 2.0 primarily and so aims for performant mobile as well as desktop. Separate render paths for mobile and desktop are avoided for simplicity's sake, so I'm discussing a single, unified ES 2.0 render path here, minimally targeting devices that support glDrawInstanced().

I have different categories of renderables. Terrain chunks, for example, are fully opaque and with the depth buffer turned on, can be rendered in any order. So far, so good. Foliage OTOH consists of semi-transparent objects suited to alpha testing / discard given a desktop GPU.

But because of the mobile requirement, alpha testing is not an option - see impacts of alpha testing / discard on graphics pipeline for mobile GPUs like the PowerVR SGX series: source, and source.

Part 2. Approach.

As a result, I must fall back to alpha blending and the painter's algorithm for transparent objects. So it seems there are two sort-categories of renderables, to be rendered separately and in this order:

solid objects: no explicit sorting (or front-to-back for optimised z-reject), depth buffer write on
transparent objects: back-to-front sort, depth buffer write off

(could there be more of these?)

Given this, I now wish to sort my display lists as efficiently as possible by minimising GL API calls. To this end, it seems best to:

order the display list primarily by sort-category (as 1 & 2 above),
(within same sort-category) order secondarily by similar material and thus shader program,
(within same material-bucket) order tertiarily by similar mesh / vertex data.

And then of course render everything.

This way if we have same sort-category, same material, and same mesh on each of two objects, glDrawInstanced() becomes a viable option to combine those two objects into a single draw call, and even if not, we've (hopefully) minimised the number of context changes that need occur.

Does the proposed render order 1-2-3 sound right? If not, explain differently, and justify.

sentences:
What do I risk if I name my game the same as another company? I came up with the best title for my game - a title that is catchy and also indicative of the gameplay, plus there isn't any other game on the market with a similar name. But after a Google search, I found a company in another country using the same name.
To put my situation better in context, imagine a game like Minecraft being in development, only to find out that there's another company called something like Minecraft Studios in a far-off country dealing with digital graphics and art for media (including games).
Aside from the legal aspect of it (lawsuits, cease-and-desists, etc.), what disadvantages would there be to have my game named the same as a company dealing in a similar field?

sentences:
What do you call the logic gates visual programming of PS4 Dreams? The PlayStation 4's Dreams app has a visual programming framework made up of sensors (detect touch, a person etc.), logic gates (AND, NOT, splitters etc.), wires, and action outputs (move somewhere, execute keyframe, teleport etc.). Through these flows energy which is usually a value between (presumably) 0.0 to 1.0. This in turn is used to create full games logic, movies and more.

Is there a name for this type of programming UI? I can think of a general "logic gates" programming or so, but maybe there's something more specific. Thanks!

sentences:
Convert Canvas Space point to local space of a rotated rect? I got a quite tricky problem:

I have my mouse position and my rectangle position in canvas space(screen space but with adjusted scaling). Now I want my mouse position converted to local space of the rectangle. Problem is, the rectangle can be rotated. Without rotation its quite simple and works nicely.

Heres a graphic for better demonstration:

Edit3: Got it finally working. I messed up with a minus in the calculation instead of using a +. Also the hierarchy of the image in unity was incorrect. Lastly I had to change the rotation from CCW to CW(Thanks unity for using CCW in your UI...). This is my final solution:

Code Unity C#:

    var mapRect = MapContentTransform.rect;

    // Canvas Space Map Center
    var mapPositionCenter = CanvasRectTransform.InverseTransformPoint(MapContentTransform.position);
    mapPositionCenter.x += CanvasRectTransform.rect.width / 2.0f;
    mapPositionCenter.y += CanvasRectTransform.rect.height / 2.0f;
    // Mouse Position in Canvas Space
    Vector2 mousePositionCanvasSpace = CalculateScreenspacePositionCanvasSpace(new Vector2(Input.mousePosition.x, Input.mousePosition.y));

    // Rotation angle of the Map in Radians
    float theta = -(MapContentTransform.eulerAngles.z - 360.0f) * Mathf.Deg2Rad;

    var rotatedX = ((mousePositionCanvasSpace.x - mapPositionCenter.x) * Mathf.Cos(theta) -
                   (mousePositionCanvasSpace.y - mapPositionCenter.y) * Mathf.Sin(theta)) + mapRect.width / 2.0f;

    var rotatedY = ((mousePositionCanvasSpace.y - mapPositionCenter.y) * Mathf.Cos(theta) +
                   (mousePositionCanvasSpace.x - mapPositionCenter.x) * Mathf.Sin(theta)) + mapRect.height / 2.0f;

Thank you Kyy13!

sentences:
How to generate or smooth really large procedural terrain? I'm currently trying to generate a really large procedural terrain in WebGL. I use a quadtree for LOD and plan to generate 1 heightmap for each quadtree node (terrain patch).

The heightmaps are generated on the GPU and with such a large terrain, 32 bits floats don't have enough precision for the smaller terrain patches. This results in terrain becoming "blocky". This article uses bicubic surfaces to smooth things out.

I thought a lot about it and the only other solution I have is to generate the smallest terrain patche on the CPU (with double precision) instead of the GPU, but continue to generate the larger patches on the GPU. But this doesn't seem like the best thing to do. Does someone have an idea for a better solution?

Also, I can't use double precision on the GPU because I'm using WebGL, which doesn't support it.

Thanks a lot :)

sentences:
Can't figure out why my mouse picking code doesn't work I am trying to create code to check for intersections between bounding spheres and the mouse. I get a mouse ray but it doesnt seem to point in the direction you think it should Attached is a screenshot and code. If anyone can help I would appreciate it as this is driving me crazy.

    auto state = m_mouse->GetState();

    float mouseX = state.x;
    float mouseY = state.y;
    float m_screenWidth = m_deviceResources->GetScreenViewport().Width;
    float m_screenHeight = m_deviceResources->GetScreenViewport().Height;

    // Normalized device coordinates
    float x = (2.0f * mouseX) / m_screenWidth - 1.0f;
    float y = 1.0f - (2.0f * mouseY) / m_screenHeight;

    DirectX::XMMATRIX viewMatrix = DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&cameraComponentHandle->view));
    DirectX::XMMATRIX projectionMatrix = DirectX::XMMatrixTranspose(DirectX::XMLoadFloat4x4(&cameraComponentHandle->projection));
    DirectX::XMMATRIX inverseviewproj = DirectX::XMMatrixInverse(nullptr, viewMatrix * projectionMatrix);

    DirectX::SimpleMath::Vector3 origin = DirectX::SimpleMath::Vector3(x, y, 0);
    DirectX::SimpleMath::Vector3 farPoint = DirectX::SimpleMath::Vector3(x, y, 1);

    DirectX::SimpleMath::Vector3 rayorigin = DirectX::XMVector3TransformCoord(origin, inverseviewproj);
    DirectX::SimpleMath::Vector3 rayend = DirectX::XMVector3TransformCoord(farPoint, inverseviewproj);
    DirectX::SimpleMath::Vector3 raydirection = (rayend - rayorigin);
    raydirection.Normalize();

    rayComponentHandle->position = rayorigin;
    rayComponentHandle->direction = raydirection;

sentences:
Do Game-Maker scripts save the variables or are they deleted after excecution? When i make a script that excecutes at the beggining and has a var ammo and that finishes excecution, will i be able to call the var ammo in other scripts or it will be deleted? If it will not be deleted, will I be able to change its value on other scripts?

Thanks in advance.

sentences:
How can I implement UI in Unity using Chromium? I'm looking for an alternative to UI Builder.
Ideally I'd like to have basically a Chromium instance atop Unity3D which would have its JS calls somehow land in the C# (maybe in the "Update" loop it listens to a constant stream of potential calls and the parameters will correspond to function names in my Unity code, I don't know)
here's what I found which doesn't quite live up to my expectations:

Unity WebView doesn't support Windows.

3D WebView for Windows and macOS (Web Browser) requires the UI to be served on an actual live URL and for Unity to access it via that URL and for all interaction to be handled via API, impractical or slow at best.

PowerUI - HTML/CSS is interesting, but was made in 2011. The documentation is all gone. the support for css feature is probably incredibly slim.

Embedded Browser looks pretty good, but I'm unsure that it could be bent into a UI system. I want it to frame my game, not to cover it.

Coherent Gameface looks probably the best,
although the CSS implementation seems a tad lackluster. Also this project was started in 2012, it's probably carrying very old, very slow code.

This Unity forum thread may be relevant.
Chromium Embedded Framework was a tool used by some assets on the asset store to create chromium UI but it has been removed.
If not using these assets, how can I implement my idea of using Chromium as my UI layer?

sentences:
Returning a List of coords for a sphere in order of inside to outside I'm looking for any algorithm that can return a list of Vector3 coordinates that form a sphere. If you read the list from the beginning it would appear the sphere was expanding.

The only algorithms I've found are for circles, the algorithm doesn't have to make a sphere of a particular radius, just a number of coordinates would be fine.

If anyone could point me in the right direction for such an algorithm that would be great. Any language or even just sudo code for a basic algorithm would be appreciated.

sentences:
How to always land a square box in 90 degree How can i Always Land a box in 90 degree

Here What i want

Here what i don't want

{
public Rigidbody2D boxRb;
public float jumpSpeed;
 public Vector3 rotation;
public float rotationSpeed;
public bool rotationEnabled;
public float gravityMultiplier;
void FixedUpdate()
{
    if (Input.GetMouseButtonDown(0))
    {
        boxRb.velocity = jumpSpeed * Vector2.up;
    }
    if (rotationEnabled = true)
    {
        transform.Rotate(rotation * rotationSpeed * Time.deltaTime);
    }
    if (Input.GetMouseButtonDown(1))
    {
        boxRb.velocity += Vector2.up * Physics2D.gravity.y * (gravityMultiplier - 1) * Time.deltaTime;
    }

}
void OnCollisionEnter2D(Collision2D collision)
{
    rotationEnabled = false;
    Debug.Log("Collided");
    rotationSpeed = 0f;
    boxRb.constraints = RigidbodyConstraints2D.FreezePositionX;
    transform.Rotate(0, 0, 90f);

}
void OnCollisionStay2D(Collision2D collision)
{
    rotationEnabled = false;
    Debug.Log("In collison");
    rotationSpeed = 0f;
    boxRb.constraints = RigidbodyConstraints2D.FreezePositionX;
}
void OnCollisionExit2D(Collision2D collision)
{
    rotationEnabled = true;
    Debug.Log("Free");
    rotationSpeed = 10f;
}

}

sentences:
How to make the winner emerge as late as possible in a quiz game? I have a quiz game with my 4 friends. We've had 3 seasons so far. One season consists of 5 games (every player organizes one). Each game must have a total of 20 points that a player can earn. There are no rules regarding how many questions a game must consist of but the ideal range is 15-25. Season's winner is the player with the most wins. If there's a draw the player who has more points wins.

Sometimes it is quite clear who is going to win the season after the 4th game because he/she has at least 2 wins and leads with around 10 points.

Ideally the winner of the season would emerge after the results of the 5th game are in. Is there any ideas we could implement to make the winner emerge as late as possible and this way make the game more interesting?

sentences:
Uncaught TypeError: Cannot read property 'Mesh' of undefined I would like to use dragonBones with pixi.js. I got a problem.

When the following line executes in dragonBones, I am getting an error:

slot.init(slotData, displays, new PIXI.Sprite(), new PIXI.mesh.Mesh(null, null, null, null, PIXI.mesh.Mesh.DRAW_MODES.TRIANGLES));

The error says: Uncaught TypeError: Cannot read property 'Mesh' of undefined.. And yeah, while debugging, I noticed that PIXI.mesh is really undefined.

What can I undertake against the error?

I am using this file for a dragonbones.

May it be that the problem is in the fact that I am using pixi.js - v4.5.6?

sentences:
OpenGL Fragment Shader Interpolation Vs Inverse Calculation I have found openGL fragment shader tutorials on the web, some that use use inverse calculations to revert the fragment coordinate back to the world space and others that interpolate the position.  With that said...

Is there a difference between interpolated world-space position and the actual world space position calculated using inverse matrices and the fragment window space coordinates?
Does anyone know of any resources that would help me understand the mathematical differences between these two things, if they are different?
If they aren't different, then why would anyone use inverse matrices instead of interpolating, which seems less expensive?

I wrote a shader to test 1, but I cannot tell if rounding errors are to blame for the differences or not.

Thanks!

sentences:
How can i collide two bodies without filtering(collision filtering)? I have two bodies with fixtures. One is platform or ground and other is the player itself.I want to collide the player to the platform without bit filtering.How can i do that?I can see the rectangular ghost layer(like a rectangular box) and the box2d falling through it.I want the box2d to collide.

create player

sentences:
What are the most popular software development methodologies used by game studios? What is the best (as in most used by professional game developers and/or companies) software development methodology used in game development?

I've heard that SCRUM is popular, but i'm not sure.

sentences:
from normal to rotation matrix (i'm on OPENGL)

i have a mesh O (object) and a mesh T (terrain).
i know a single triangle in T and i want to orient O to be aligned to that triangle (torate O to align to T in that point).

i have only the normal in the triangle. how can i achive the roation matrix?

i have thought this algorithm:

// pseudocode
float[] normal2rotation(Vector3D normal) {
    angleX = Vector3D.angleBetween(normal, Vecto3D.Axis3D.X);
    angleY = Vector3D.angleBetween(normal, Vecto3D.Axis3D.Y);
    angleZ = Vector3D.angleBetween(normal, Vecto3D.Axis3D.Z);

    float[] result = {angleX, angleY, angleZ};
    return result
}

but it does not give me the desired result.

sentences:
Particle systems on multiplayer games I'm working on a 2D javascript/Three.js multiplayer game, using web sockets and an authoritative server currently written in Python.

The combat mechanic will be similar to Geometry Wars however i'm struggling to get my head around how to implement this in an efficient way.

There are several drawbacks/concerns I need to take into account:

Efficiency is key
Three.js particle systems aren't mutable, you cannot add or remove particles once the system has been created, only move them off screen
All calculations with respect to collision and damage must be done server side
My game currently implements entity interpolation with fixed time step updates from the server
Potentially several different weapons/projectile types

I can see several solutions:

Handle each 'bullet' particle individually

Pros

Most accurate way of doing thigs

Cons

Slow on server
Lots of bandwidth
Hard to batch draw objects, will have to draw each individually

Use ray casting on server and have some form of network synced particle emitter

Pros

Much easier on the server and network

Cons

Network synching issues
What happens when a bullet hits an object? Bullet will pass right through

Use ray casting on server for collision/damage and use raycasting on client for more accurate particles

Pros

Much easier on the server and network
Will look more accurate

Cons

May still have some synching issues
More work for the client

Obviously the amount of players currently connected will have an impact on the implementation, I would ideally like to allow hundreds of players to share a game world but there may only ever by 20 or so on screen at once.

The mutable particle system is an issue for all of these but I would still like to use it as it is more efficient that drawing each particle individually. In a test I could have over 10000 particles all moving and still get 60fps.

Any help or comments on my though process would be greatly appreciated. Is there another approach that would be better?

sentences:
What engine/technology should I work with to accomplish my unique design goal? I'm looking to begin a procedurally generated open-ended sandbox game and would like some educated opinions on a good starting point. (Take a look at the "Engine Specifications" if you don't want to read the whole post) I do not expect there to be an engine/set of libraries that meets all my requirements, but instead meet some essential ones (like rendering/collisions). I realize I will be building many engine components from scratch and appreciate any extra advice you want to include in your answer.
A little background
I am a fairly experienced programmer with intimate knowledge of modern design practices and know most popular programming languages like C++ and C#.
I've dealt with other 3D engines before like the Source Engine (C++) and UDK (UnrealScript) for some personal projects. I'd like to think most of my knowledge is of FPS game design and what the standard components are of FPS oriented game engines.
My design goal
In a nuteshell: I plan for my game to be a procedurally generated open-ended sandbox game that consists of large blocks as the basic geometry. The player will play in the first person.
These uniformly sized blocks will be large enough so that it can act as a segment to a hallway that the player could walk through. A block could also act as a wall to a building, be completely solid, or be completely empty. These blocks are changeable, removable, and placable.
By now this should sound familiar but its important to understand some critical and defining aspects of the game:
Engine Specifications

Blocks themselves contain collisions meshes within themselves; a wall can be placed on any of the 4 sides of the cube and a ceiling/floor on the remaining top and bottom faces.

Example of block collision configurations:

Blocks contain (unless they are empty or fully solid) independent visual meshes on each of their sides that contain collision meshes. They will be relatively simplistic and contain generally low resolution textures (the right resolution would come from benchmarking tests).

No complex shaders, effects, or lighting will be implemented. Only very basic implementations for performance.

Blocks contain basic navigation information and when connected to eachother, form a navigation network of nodes. The blocks themselves act as nodes and their connectivity to other nodes are determined by wall placement and so on.

Basic node based pathfinding will be implemented for AI.

The most challenging aspect will be multiplayer I presume.

Ray tracing

Simple particle engine

Physics simulation not likely, just basic fps movement physics

I realize I have a sizable workload in front of me as most engines are not geared for this type of game and so common design paradigms will be sparse. However, I believe there is an engine out there that I can work with to speed things up.
Game engines I have knowledge of

Gamestudio (clight)
Source Engine (C++)
UDK (UnrealScript)
Panda3D (C++/Python)
Torque3D (C++/TorqueScript)
Unity (C#)

I don't really prefer to use any of the ones I've listed for different reasons (mostly because they're FPS engines), but if you think one of them would be a good choice let me know.
Do you know of a game engine or technology bundle that would best help me implement my specifications? Apologies for the lengthy post.
Note: I wouldn't mind investing a few thousand dollars if it justifies itself.

sentences:
X, Y, Z rotation around camera I'm making a 3d orthogonal-projected, game using painters' algorithm in java.

I'm able to rotate the objects with incremental rotations (e.g. rotate all objects 10 degrees) using affine transformations, but that involves changing/saving the rotated positions of the objects.

I want be able to rotate using a viewing direction vector. What is the maths and/or java code to do this?

Assume the default viewing direction (no rotation needed) would be (0,0,1) (looking down the z axis).

I can elaborate and/or clarify if wanted.

EDIT: What I'm doing currently:

  for all drawable things:

  // using transform matrices (translate to origin, rotate around origin, translate back)

  rotate around center by x,y,z radians

What I want:

  for all drawable things:

  rotate around center using viewing direction (vector)

sentences:
Quaternion based camera pitch freaking out, and Z-axis drift This is the code I use to control my (first person) camera's movement and
rotation. Translation successfully keeps orientation in mind, so that up and
left and such are always in the expected directions, and 'mouselook' controlling
rotation around the Y (yaw) and X (pitch) axes starts out working fine as well.

My problems are two-fold;

First, rotating around the Y and X axes slowly builds up rotational drift around
the Z axis. Now what I think I need to do to correct this is to keep track of an
additional 'up' vector, and to rotate the quaternion so that the camera's up
direction always coincides with this up vector (which would only change when
intended, instead of by drift). But I have no idea how to go about doing this.

The second problem is more clearly a bug. When rotating around the Y (yaw) axis,
the rotation around the X (pitch) axis starts to freak out. At Y 180 degrees, the
up and down motion of the camera's pitching are precisely inverted. And at 90
degree Y angles from the starting orientation, it's as if pitch has become roll
instead, rotating around the Z axis.

So, how do I 'roll up', and what's going on with the pitching?

glm::quat mOrientationQuaternion;
glm::vec3 mPositionVector;
glm::mat4 mViewMatrix;

/*
 *  Takes a translation value for each axis, turns it into a vector, then
 *  rotates that vector by the current orientation in the quaternion, before
 *  adding the result to the position vector.
 */
void Camera::translate(float x, float y, float z)
{
    glm::vec3 translation(x, y, z);
    translation = translation * mOrientationQuaternion;
    mPositionVector += translation;
}

/*
 *  Takes three angles in degrees, and creates a quaternion via an
 *  intermediate vector to represent their rotations. Then the orientation
 *  quaternion is multiplied by this new rotation quaternion to get the new
 *  orientation.
 */
void Camera::rotate(float x, float y, float z)
{
    glm::vec3 angles(glm::radians(-x), glm::radians(y), glm::radians(z));
    glm::quat rotation(angles);
    mOrientationQuaternion = glm::normalize(mOrientationQuaternion * rotation);
}

/*
 *  Creates the view matrix from the orientation quaternion, then translates
 *  it by the position vector.
 */
void Camera::buildViewMatrix()
{
    mViewMatrix = glm::mat4_cast(mOrientationQuaternion);
    mViewMatrix = glm::translate(mViewMatrix, mPositionVector);
}

sentences:
my iPhone app skips the splash screen! I have developed an iPhone app. When I have installed it in the device, it worked fine, ie it showed, the logo screen, the title screen and goes to game screen and now I have exited pressing the home button. The problems starts when I relaunch the app, it straightly goes to the game screen, by skipping the splash screens.

While I was working on it the app crashed and when I launched again it showed the logo screen and title screen. But when I relaunched it, the splash screens where skipped.

Could you tell me the possible errors that might have occurred?

sentences:
Can Bullet Physics (or another 3d physics engine) use callbacks in my engine to check static geometry? I'm wondering if it's possible to use or hack Bullet 3d Physics (or another free 3D physics engine) so that I don't need to "import" my static geometry into Bullet - instead I want to do it the other way, so Bullet uses some sort of callback system to check geometry properties of my mesh/polygons.

Sort of like that Bullet would expect a method in my static geometry classes "checkRayIntersection" or similar, and I take care of the details and optimizations myself. The meshes are immovable, so the only thing that I expect Bullet to care about is intersections and their normals, but I might be missing something..

EDIT: as an example, consider a 10 million polygon terrain mesh which is changing all the time. You probably don't want to keep parallel data structures in the render-engine and in the physics engine for this. You don't want to use an approximation for the physics either.

Bullet uses something called MotionStates to solve this problem for its output - I was hoping there was a similar design pattern for passing geometry input.

sentences:
Implement delay using polling or threads? I'm making a real-time risk-like game in Python. Players can move armies from one region to another. I want army movement to take time proportional to the distance between the two regions, therefore I need to keep a new timer every time an army moves from one region to another (until the army arrives).

I've thought of 2 ways to do this:

One way is to have a list of moving troops and do a for loop through this list every iteration of the main server loop to check if the time is up for each unit.

Another way is to create a new thread for each moving troop and have the run() method of the thread continuously check whether the time is up yet for the unit.

Which way is better?

sentences:
Designing a weather system for biomes in a roguelike I'm making a roguelike game similar to dwarf fortress. So far, I have an average temperature map and average yearly precipitation map generated with simplex noise. Now, I'm trying to implement a weather system that seems realistic, as in it rains more often in biomes with higher precipitation rates, but still seems coherent.

Some of my thoughts on designing this system would be to have a weather object for each individual biome, and every time it rains (and the startup) it picks the next time it will rain based on the biomes precipitation rate.

One problem with this approach is that it would always rain within the exact edges of a biome, and I don't think it would look very realistic.

Another option could be to have cloud objects move around the map, and have them pick up water while in biomes with high precipitation rates, and when reaching the max, they rain.

This seems like a good approach to me that could be very realistic, I would just have no idea how to program the movement for the clouds.

Any thoughts on a better approach or how to implement either of these to make them work?

sentences:
Render rivers in a grid I have created a random height map and now i want to create rivers. I've made an algorithm based on a* to make rivers flow from peaks to sea and now i'm in the quest of figuring out an elegant algorithm to render them.

It's a 2D, square, mapgrid. The cells which the river pases has a simple integer value with this form :rivernumber && pointOrder. Ie: 10, 11, 12, 13, 14, 15, 16...1+N for the first river, 20,21,22,23...2+N for the second, etc. This is created in the map grid generation time and it's executed just once, when the world is generated.

I wanted to treat each river as a vector, but there is a problem, if the same river has branches (because i put some noise to generate branches), i can not just connect the points in order.

The second alternative is to generate a complex algorithm where analizes each point, checks if the next is not a branch, if so trigger another algorithm that take care of the branch then returns to the main river, etc. Very complex and inelegant.

Perhaps there is a solution in the world generation algorithm or in the river rendering algorithm that is commonly used in these cases and i'm not aware of.

Any tips? Thanks!!

sentences: SDL gray scale image from a a color image? I am new to sdl. I have basically have the following codes which can load the images. I know how to access the pixel as below. What I need it to convert the image to 8 bit grey level and 1 bit monochrome separately. I know it got to do with pixel manipulation. Any hint or idea how to to this? I am not too sure what to set for SDL_CreateRGBSurface and also once I get the pixel what manipulation to be done?

sentences:
How does Texture Mapping work? I read the answers from What exactly is UV and UVW Mapping? and How does UVW texture mapping work?, which are quite nice, but am still not 100% sure, if I understand correctly.

Lets start with a 2D example. So, say I have a triangle (obviously described by 3 vertices). Now my question is, how do I convert a (x,y)-coordinate to the (u,v)-coordinate of my texture? Since {x,y} could be any value between [0,n] with n being all real numbers, considering that it is in object space. But my texture coordinates are between [0,1]. How do I know how to map lets say (3,4) to (u,v)? If I know how to map the object coordinates to the texture coordinate it is easy to interpolate the values, I assume (either using bilinear interpolation or barycentric interpolation).

And then how would this work for 3D? Lets say in this case we would have a pyramide with 5 vertices (4 bottom, 1 tip). I guess the procedure would be similar, with the exception that I know have an additional depth value. But how does the mapping of a 2D texture work on a 3D object, when I don't have nice flat surfaces like on a pyramide, but instead have a circular surface, like a tea pot?

I hope I'm clear in my questions. I'm still little confused myself. I just don't quite get the mathematical background of texture mapping.

It would be enough, if you could point me to some website with good explanation, maybe with clear graphics and step by step description.

Thanks for your time!

sentences:
Affect movieclip scale from a .as doc to another I've been working on a game following a tutorial on the internet, the game is an avoider where you have the Avatar, that has to avoid the objects that fall.

The way it is made is: I have a DocumentClass which addChild's the screen you should be seeing and removeChild's the screen that you were.

For example: first it loads the menuScreen, then when you press play unloads menu and loads playscreen. When you die it loads the gameoverScreen and loads the playscreen.

And from the gameOverScreen you can press the SHOP button to go to the shop.
From here on I'm on my own and not following any tutorials.

The shop has a button that is supposed to alter the Avatar's X and Y scale to 0.5, but the problem is: how do I make that work?

I tried creating a sharedObject.data.avatarSize, on the store's size button the code would be something like:

sharedObject.data.avatarSize *= 0.5;

And on the AvoiderGame.as, which is the most of the actual game, on the part where the avatar is created I tried putting this after it's creation:

scaleX.avatar = sharedObject.data.avatarSize;
scaleY.avatar = sharedObject.data.avatarSize;

This did not work since it gives me the error 1009 saying can't access something that is null. I tried this before "using" the sharedObject:

if( sharedObject.data.avatarSize == null )
{
    sharedObject.data.avatarSize = 1;
}

But it did not work...

So now I'm not sure on what to do. I know we should reduce global variables as much as we can but how do I do it?

--EDIT--

Also, if it helps, I'm using Flash CS5 and working with AS3.0 and if you don't know about flash, you can also tell me how you would do it on any other language and I would try to convert it to flash.

sentences:
How to implement special weapon and armor effects (ex: vampiric, holy, damage shield, thorns)? I'm working on the inventory system for my game, and am interested in how do I implement additional weapon and armor properties that are not just damage or armor?

If all I have is damage and armor, the equation is simple: damage = weapon damage - armor;

But I'm looking for a more interesting user experience - namely items that have 2-3 properties that modify various game mechanics.

For example, I can use a bunch of flags and write a big if/else statement in my attack method and check for all these at appropriate points:

if (weapon is vampiric)
{
heal attacker for x
}

if(weapon is holy)
{
check defender type, add extra damage
}

if(armor absorbs first x damage)
{
reduce damage to defender by x
}

Another way that I thought might be better is the decorator design pattern - progressively wrapping the output of one weapon creation into another :

public class Main {

    public static final void main(String[] args) {
    Weapon w = new MeleeWeapon();

        w = new Holy(w);
        w = new Vampiric;
        w = new Enchanted(w,1);

        Damage damage = w.damage();

    }

}

It seems to me that decorator would allow me to write more flexible code and add more types later, but I'm not sure if it will just move the if/else statements into the weapons special property method.

sentences:
Game development and research Game development is currently a largely non-academic enterprise.  There are a lot of commercial developers of games, as well as a large hobbyist community.  The academic community focusing on games seems to be small, and new.  [Or so it appears to me].

Having said all that, are there some must read papers/books on game development from academics?

sentences:
Drawing Transparency in XNA 4.0 Using C# (VS2010) with XNA 4.0, I have a terrain layer (RenderTarget2D) in a 2D side-scroller.  My visual system tracks updates to redraw individual tiles, but I am having trouble finding a way to clear out the rectangle where the tile will be drawn, which I must do because A) there may no longer be a tile or B) the tile may itself contain transparency.

How can I draw a rectangle of transparency onto an existing RenderTarget2D?
I essentially want to clear just that rectangular portion of it.

My Google searches have not yielded anything relevant.

sentences: Planning to start a right game design pattern I'm planning start a game development (I did develop many promo games but now I will start my games with the best code design patterns). I will use QT Creator with C++14, OpenGL and some physical engines. Will I going on right direction? I will use it to compile in multiple plataforms (PC/MAC/iOS/Android)

sentences:
how get collision callback of two specific objects using bullet physics? I have got problem implementing collision callback into my project. I would like to have detection between two specific objects. I have got normall collision but I want one object to stop or change color or whatever when colides with another. I wrote code from bullet wiki:

int numManifolds = dynamicsWorld->getDispatcher()->getNumManifolds();
    for (int i=0;i<numManifolds;i++)
    {
        btPersistentManifold* contactManifold =  dynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
        btCollisionObject* obA = static_cast<btCollisionObject*>(contactManifold->getBody0());
        btCollisionObject* obB = static_cast<btCollisionObject*>(contactManifold->getBody1());

        int numContacts = contactManifold->getNumContacts();
        for (int j=0;j<numContacts;j++)
        {
            btManifoldPoint& pt = contactManifold->getContactPoint(j);
            if (pt.getDistance()<0.f)
            {
                const btVector3& ptA = pt.getPositionWorldOnA();
                const btVector3& ptB = pt.getPositionWorldOnB();
                const btVector3& normalOnB = pt.m_normalWorldOnB;
                bool x = (ContactProcessedCallback)(pt,fallRigidBody,earthRigidBody);
                if(x)
                    printf("collision\n");
            }
        }
    }

where fallRigidBody is a dynamic body - a sphere and earthRigiBody is static body - StaticPlaneShape and sphere isn't touching earthRigidBody all the time. I have got also other objects that are colliding with sphere and it works fine. But the program detects collision all the time. It doesn't matter if the objects are or aren't colliding.

I have also added after declarations of rigid body:

    earthRigidBody->setCollisionFlags(earthRigidBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
fallRigidBody->setCollisionFlags(fallRigidBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);

So can someone tell me what I am doing wrong? Maybe it is something simple?

sentences:
Problem with Blender model imported to Unity (Lighting problems) I made a simple box in blender and imported it to unity. Now I'm facing with this weird lighting problem:

I've been messing around with normals, duplicated vertex, lots of things, even lightning properties but still I'm not getting any results at all. Why does this happen and how can I solve it?

Source blend file: https://drive.google.com/open?id=1Ze1JBRFBvhnnY-w36U2KDe7Q2zcfXsmf

sentences:
Unity - Particle System Shuriken - Setting particles in code with random row in texture animation? Good day, I'm attempting to randomly generate a space scene (quite large actually) in Unity through C# code mainly. So far, I've gotten stunning results up to what image #2 will show you. However, now I'm looking to expand the look with more random particles. So, I've made a texture atlas of 8 in a vertical row, which works on the random setting if you have an emitter and the particle system is called with PS.Play();

Assigning different materials would only work on a per particle system basis(which would be new texture PER cloud, so to speak) which is not what I want. So, my question:

How can I use the Shuriken Particle System's Texture Sheet Animation functionality through code, without having an "active" particle system? More precisely, I wish to use the 'Random Row' feature of it to assign random textures to each particle.

Since I can't share my code (due to policies), here is a bit more info on how I do it:

I create an array with coordinates for each cloud.
Assign a particle system to that cloud.
Randomly generate all the particles for the cloud with relative offsets.
Use PS.setParticles(particlesArray);

Using a Texture Atlas consisting of the letters A to H to test, only B showing on all particles.

Using a Texture Atlas consisting of the fog particles to test, only 2nd showing on all particles.

Thank you @DMGregory for the help, I've tested it multiple times and it works perfectly now, I've also went ahead and tweaked a few of my settings just to get a more "clear" space:

sentences:
How can I make a proxy server between a client and a server to analyise my packets Otherhand how can i manipulate where the game client want to connect?
I've built a python proxy server that can handle this proxy server, it is a basic thing that just: bind a server, wait till the client connect, and connect to the server, and send all data that have got from the client via this proxy, and send forward to the main server.
And here is the problem that i not able to solve, the client don't want to connect to my proxy server. I modified my etc/hosts before, and i failed as well.
Any idea to solve this problem?

sentences:
Introducing generic commands in text-based interactive fiction game Writing a compact text-adventure engine I was thinking about possible commands a player could use. For each location i have special commands described in the text but what about generic commands like

examine
open / close
trigger
...

So here are my questions concerning this:

Is there anywhere a good enumeration of commands which should be mandatory? If no, what commands would you expect in such game?
Concerning usability, should I suppose that the player knows the commands so he can try to use them from the beginning or should I implement tutorial-like explanations which  unlock the usage of those commands?

sentences:
render trajectory of particle in forcefield using GLSL shader I want to visualize flow of particles in some forcefield e.g. electromagetic, gravitional or potential flow in fluid (streamlines);

I was thinking to use Geometry Shader which would look like this (not tested, just sketch):

#version 330 core
layout (points) in;
layout (line_strip, max_vertices = 64) out;

uniform float dt;

vec3 getForce(in vec3 pos){ /* ... don't care now ... */ }

void main() {
    vec3 pos = gl_in[0].gl_Position;
    for( int i=0; i<64; i++ ){
        pos += getForce(pos) * dt; // it's actually velocity field but who cares
        gl_Position = pos;
        EmitVertex();
    }
    EndPrimitive();
}

However, I read that Geometry shaders are very slow (I did not yet tested). So I wonder if it would be helpful in this situation?

Or would Tesselation shaders or Compute shaders be suitable for this job and achieving better performance?.

background: I have experience with vertex-shaders, fragment-shaders, OpenCL ... but I have never tried geometry-,tesselation- nor compute-shaders.

EDIT: there is my simple example implementation using geometry shader in 2D
https://github.com/ProkopHapala/SimpleSimulationEngine/blob/ca16b6f8d72864a8a572ed2a21ded99c5c2cc3e4/cpp/sketches_SDL/OGL3/test_GeometryShader.cpp

which plots this (for velocity field defined by dipole):

sentences:
In Unity unable to find second github branch I'm using github for unity asset and for some reason I can't find new branch that was created on a different PC.
I tried refreshing, fetching, reinstalling asset, reinstalling asset and recloning repository.

Strangely, my laptop shows the branch, but not my personal home computer.

Any ideas why is this happening?

sentences:
C# creating a simple snake game I was thinking about creating a snake game with C#, so I ran ideas in my head, and some problems came up.

How can I track and output in the correct location the blocks that run after the snake's head?

If the snake is built of five blocks, and the user starts going in a circle, how can I print the snake body in the right location?

Also, how can I create an action that will run on the background, which will move the snake forward, no matter what the user does?

What structure should my code have? (code design structure)

This should be a console application, since it's the only framework I am familiar with.

I am not looking for finished code, since I want to really understand how it should work.

sentences:
Help me understand this vbo/rotation, and how its done opengl c++ Im pretty new to opengl, and I just cant figure out how to rotate this vbo/vao in 2d space. This is how I bind my coordinates:

float points[] =
{
    0.0f,  0.10f,  0.0f,
    -0.10f, -0.10f,  0.0f,
    0.10f, -0.10f,  0.0f
};

glGenBuffers(1, &points_vbo);
glBindBuffer(GL_ARRAY_BUFFER, points_vbo);
glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(float), points, GL_STATIC_DRAW);

I place the vbo at vao[0]

glBindBuffer(GL_ARRAY_BUFFER, points_vbo);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);

And I enable the array

glEnableVertexAttribArray(0);

and call to draw in the cpu, with

glDrawArrays(GL_TRIANGLES, 0, 3);

In my shader, I load the array by:

//glsl shader
layout ( location = 0 ) in vec3 vertex_position ;
void main()
{
 gl_Position = vec4(vertex_position, 1.0);
}

Ive edited out the coloring/fragment to save space, but this is my problem:
I can make a uniform to move my triangle around, but idk how to apply a transformation matrix to a vec4.

It seems the shader reads my vertex_position VAO one vec/element at a time, and trying to apply any matrix just gives an error.

How do you make or apply a rotation matrix on vao, am I inputting it wrong? All the uniforms I apply seem to only stretch, zoom, or move the overall triangle.

Sorry if the question is bad, or partially confused, shading is new to me overall, so thanks in advance.'

my shader:

#version 410 core
layout ( location = 0 ) in vec3 vertex_position ;
layout ( location = 1 ) in vec3 vertex_colour ;

out vec3 colour;
uniform vec3 fade=vec3(0.0,0.0,0.0); //fade
uniform float zoom=1.0;
uniform mat4 transform = mat4(vec4(1.0,0.0,0.0,0.0),
vec4(0.0,1.0,0.0,0.0), vec4(0.0,0.0,1.0,0.0), vec4(0.0,0.0,0.0,1.0));

void main()
{
colour=vertex_colour+fade;
gl_Position=transform*vec4(vertex_position,1.0);
}

this example https://open.gl/transformations and the answer made it doable.

sentences:
How to make Unity Layout switch while in Play mode I'm looking for a way to auto switch the Unity layout when I go to play mode.

I want to Unity Editor layout automatically changes to my preset layout when I click on Play button and When I stop the game, It goes back to the default layout.

sentences:
Game Asset Size Over Time The size (in bytes) of games have been growing over time. There are probably many factors contributing to this: trailer/cut scene videos being bundled with the game, more and higher-quality audio, multiple levels of detail being used, etc.

What I'd really like to know is how the size of 3D models and textures that games ship with have changed over time. For example, if one were to look at the size of meshes and textures for Quake I (1996), Quake II (1997), Quake III: Arena (1999), Quake 4 (2005), and Enemy Territory: Quake Wars (2007), I'd imagine a steady increase in file size. Does anyone know of a data source for numbers like this?

sentences: Need help implementing shadows on platform with limited feature set I am writing a game that very much relies on real-time shadowing and would like to implement shadow volumes. I was thinking of doing shadow mapping, but the platform I am using is Molehill/Stage3D and it's limited to 8 bits per channel, BGRA textures, and shaders can only read from textures, not depth buffers. I have never done stencil shadows before, but would it be possible to generate a shadow volume entirely on the GPU without the use of Geometry shaders, and only vertex shaders?

sentences:
Connect 4 Iphone game I'm new to game development and development in general, I want to make a Connect 4 game. I have made a few simple game tutorials and I decided I wanted to make my own game now. I figured a connect 4 game should be a simple start for me, can anyone help me out how to go about with this please?

Should I use Cocos2d or write it in ObjC?

Thanks
David H.

sentences: How do I animate a custom ability with a continuous beam in Starcraft 2? I'm building an ability that drains energy from the target unit and gives it to caster unit.  I've tried to associate an actor that hooks in to the ability's start event to create the continuous beam, but the beam never appears.  What's the right way to do this?

sentences:
Efficient types of 2D animation I currently am doing art for a game being made (by me...) and started to think of multiple different ways of animating.

The two I am currently debating, with myself, is single layered animation and multiple layered animation.

Single: The entire character is done on one layer, with all of the required frames.

Multiple: Different body parts on their own separate layer (i.e. arm on one, leg on another, and so on)

I would like help figuring out the pros and cons of these so then I could decide, preferably from someone who has done one or the other...or both, but anyone that could offer assistance would be greatly appreciated.

sentences:
PID controller error value for heading correction I'm using a PID controller in my AI to steer my NPCs to a desired heading (by adding torque). I've adapted the code from here: http://answers.unity3d.com/questions/199055/addtorque-to-rotate-rigidbody-to-look-at-a-point.html

The above example uses the cross-product of the two headings as the error value for the PID controller. This works great if the angle between the desired and current headings is less than 90 degrees but if the angle is greater than that, the PID controller corrects to the opposite direction than I want (as it tries to correct to zero)!

What is a good error value between two vectors to pass into a PID controller that works no matter what the angle between the desired, and current heading?

Note: because the PID controller returns the correction as a vec3, the error value must also be a vec3

sentences:
Experiences of test-driven devleopment in large projects I've used TDD in personal projects, but I wondered if anyone had any experience of using this approach across a large team? Was there resistence to the test-first approach? Did you keep code coverage high for the whole project? How did coverage survive fixing those two-in-the-morning-and-you-ship-in-four-hours crash bugs?  Did you run tests on all platforms, or just assume that passing on one meant passing the others?

I love the decoupled code that TDD produces, and the large suite of regression tests you get for free, but if you only have a few in the team who don't want to contribute tests, won't everyone suffer?

sentences:
How can I resize a set of sprite images? Hey StackExchange GameDev community, I'm attempting to resize series of sprites upon instantiation of the class they're located in.

I've attempted to use the following code to resize the images, however my attempts have been unsuccessful. I have been unable to write an implementation that is even compilable, so no error codes yet.

    wLeft.getScaledInstance(wLeft.getWidth()*2, wLeft.getHeight()*2, Image.SCALE_FAST);

I've heard that Graphics2D is the best option.

Any suggestions?
I think I'm probably best off loading the images into a Java project, resizing the images then outputting them to a new directory so as not to have to resize each sprite upon class instantiation. What do you think?

Photoshopping each individual sprite is out of the question, unless I used a macro.

Code:

package game;

//Import
import java.awt.Image;
import javax.swing.ImageIcon;

public class Mario extends Human {
    Image wLeft = new ImageIcon("sprites\\mario\\wLeft.PNG").getImage();

 //Constructor
    public Mario(){
        super("Mario", 50);
        wLeft = wLeft.getScaledInstance(wLeft.getWidth()*2, wLeft.getHeight()*2, Image.SCALE_FAST);
    }

sentences: What name should I give each difficulty level? I have a game with 4 difficulty levels (or levels of AI) and I'm wondering what to name them instead of the boring Easy, Normal, Hard, Impossible.

sentences:
2D collision detection Let's assume I'm using this character.

(source: iconbug.com)
How would you implement collision detection for it? Using a bounding box doesn't seem to be a good approximation, because the bird's shape is nowhere near a square.
I was thinking of having a sort of quad tree data structure inside the object that represents portions of the image. Each leaf could be either false (in case it covers the white/transparent space outside the bird) or true (in case it represents an area of the bird i.e. beak, eye etc). Then somehow test the only obstacle in the scene for collision with the bird.
But my problems in my approach are:

I don't know how to initialize the quad tree.
Once the quad tree is initialized, I'm not sure how to traverse & use it once the obstacle is within the coordinates of the image.

How would you do collision detection with non-squarish characters?
LE: The other approach I've seen was to use multiple bounding boxes. For example I'd have one or a few bounding boxes for the beak, then a few of them for the hair or the tail. But it can get tedious. If this is a valid approach in my case, how would I generate those bounding boxes? I doubt I'd have to have them hardcoded in my program.
LE2: I care about fairly precise collisions. I can't imagine how a single bounding box or circle can at least approximate decently that shape, so this approach won't work.

sentences:
Grouping entities of the same component set into linear memory We start from the basic systems-components-entities approach.

Let's create assemblages (term derived from this article) merely out of  information about types of components. It is done dynamically at runtime, just like we would add/remove components to an entity one by one, but let's just name it more precisely since it is only about type information.

Then we construct entities specifying assemblage for every of them. Once we create the entity, its assemblage is immutable which means we cannot directly modify it in place, but still we can obtain existing entity's signature to a local copy (along with contents), make proper changes to it, and create a new entity out of it.

Now for the key concept: whenever an entity is created, it is assigned to an object called assemblage bucket, which means that all entities of the same signature will be in the same container (e.g. in std::vector).

Now the systems just iterate through every bucket of their interest and do their job.

This approach has some advantages:

components are stored in a few (precisely: number of buckets) contiguous memory chunks - this improves memory friendliness and it is easier to dump whole game state
systems process components in a linear manner, which means improved cache coherency - bye bye dictionaries and random memory jumps
creating a new entity is as easy as mapping an assemblage to bucket and pushing back needed components to its vector
deleting an entity is as easy as one call to std::move to swap the last element with the deleted one, because order doesn't matter at this moment

If we have a lot of entities with completely different signatures, benefits of cache coherency kind of diminish, but I don't think it would happen in most applications.

There is also a problem with pointer invalidation once vectors are reallocated - this could be solved by introducing a structure like:

struct assemblage_bucket {
    struct entity_watcher {
        assemblage_bucket* owner;
        entity_id real_index_in_vector;
    };

    std::unordered_map<entity_id, std::vector<entity_watcher*>> subscribers;

    //...
};

So whenever for some reason in our game logic we want to keep track of a newly created entity, inside the bucket we register an entity_watcher, and once the entity has to be std::move'd during removal, we lookup its watchers and update their real_index_in_vector to new values. Most of the time this imposes just a single dictionary lookup for every entity deletion.

Are there any more disadvantages to this approach?

Why is the solution nowhere mentioned, despite being pretty obvious?

EDIT: I'm editing the question to "answer the answers", since comments are insufficient.

  you lose the dynamic nature of pluggable components, which was created
  specifically to get away from static class construction.

I don't. Maybe I did not explain it clearly enough:

auto signature = world.get_signature(entity_id); // this would just return entity_id.bucket_owner->bucket_signature or so
signature.add(foo_component);
signature.remove(bar_component);
world.delete_entity(entity_id); // entity_id would hold information about its bucket owner
world.create_entity(signature); // automatically assigns new entity to an existing or a new bucket

It's as simple as just taking existing entity's signature, modifying it and uploading again as a new entity. Pluggable, dynamic nature? Of course.
Here I'd like to emphasize that there is only one "assemblage" and one "bucket" class. Buckets are data-driven and created at runtime in an optimal quantity.

  you'd need to go through all buckets that might contain a valid
  target. Without an external data structure, collision detection could
  be equally as difficult.

Well, this is why we have the aforementioned external data structures.
The workaround is as simple as introducing an iterator in System class that detects when to jump to next bucket. The jumping would be purely transparent to the logic.

sentences:
Clipping walls in Doom-style FPS view I have two points representing a line, and a player position. I translated and rotated the points around the player, and this works just fine.
Next I want to clip the resulting line like Bisqwit did it in his video (around 2:30-3:40), so that walls behind you won't be seen and the wall is clipped to the screen, but I don't really understand where all these constants in the code came from.
Here is the link to his code.
And here is my actual code rewritten in terrible Pascal (I just use it for testing :D )
program graph3dtest;
uses graph,crt, math;

// here we will set up the graphics routines
// and other stuff
procedure initgraphics;
var gd,gm: smallint;
begin
  gd:=detect; // detect the graphic size
  gm:=0;      // autodetect
  InitGraph(gd,gm,'');     // this '' is not needed for the moment...
  if GraphResult<>grok then begin
    // this is needed in case the driver won't start
    writeln(' *** ERROR *** ');
    writeln(' FATAL ERROR WHILE STARTING GRAPH UNIT... ');
    CloseGraph;
    halt;
  end;
end;

// gloabal variables here --- !
var
   vx1,vx2,vy1,vy2,px,py,angle:real;
   hwidth,hheight:real;
   tx1,tx2,ty1,ty2,tz1,tz2: real;
   running: boolean;
   kbpress: char;   // keyboard pressed
   x1,y1a,y1b,x2,y2a,y2b: integer;
   width,height: integer;
begin
  initgraphics;
  // main code here
  hwidth:=GetMaxX/2;
  hheight:=GetMaxY/2;
  circle(round(hwidth),round(hheight),10);
  writeln(hwidth,hheight);
  running:=TRUE;
  // set up variables
  vx1:=70; vy1:=20;
  vx2:=70; vy2:=70;
  px:=50; py:=50; angle:=0;
  while(running) do
  begin
    circle(round(hwidth),round(hheight),2);
    // transform the points
    tx1:=vx1 - px; tx2:=vx2 - px;
    ty1:=vy1 - py; ty2:=vy2 - py;
    // rotate them around the player
    tz1:=tx1*cos(angle) + ty1*sin(angle);
    tz2:=tx2*cos(angle) + ty2*sin(angle);
    tx1:=tx1*sin(angle) - ty1*cos(angle);
    tx2:=tx2*sin(angle) - ty2*cos(angle);
    line(round(hwidth-tx1),round(hheight-tz1),round(hwidth-tx2),round(hheight-tz2));
    // calculate the perspective projection
    x1 := round(-tx1*16/tz1); y1a:=round(-hheight/tz1); y1b:=round(hheight/tz1);
    x2 := round(-tx2*16/tz2); y2a:=round(-hheight/tz2); y2b:=round(hheight/tz2);
    width:=round(hwidth);
    height:=round(hheight);
    line(width+x1,height+y1a,width+x2,height+y2a);
    line(width+x1,height+y1b,width+x2,height+y2b);
    line(width+x1,height+y1a,width+x1,height+y1b);
    line(width+x2,height+y2a,width+x2,height+y2b);
    // get kb input
    if(keypressed) then
    begin
      kbpress:=readkey;
      if(kbpress='q') then running:=FALSE;
      if(kbpress='w') then
      begin
         ClearDevice;     // clear the screen
         px:=px+cos(angle); py:=py+sin(angle);
      end;
      if(kbpress='s') then
      begin
         ClearDevice;
         px:=px-cos(angle); py:=py-sin(angle);
      end;
      if(kbpress='a') then
      begin
         ClearDevice;
         angle:=angle-0.1;
      end;
      if(kbpress='d') then
      begin
         ClearDevice;
         angle:=angle+0.1;
      end;
    end;
  end;
end.

I hope you can explain it to me so that I understand it.
So the important question is the following:
Why does he use in the SUB intersect 12 variables (ok 2 are redundant because the implement ix and iy) and why do he use such numbers like 0.0001 and -20 and 5?

sentences:
XNA Drawing Glitches (maybe Viewfrustum related?) I'm drawing a simple Voxel world.  When I naively render all the vertices, things look fine.  But when I change my code to include a ViewFrustum check, I start getting strange visual glitches like this:

glitch http://www.phillipwei.com/game/glitch.png

The large square block is meant to be there; the strange triangles on the bottom left are not.  These glitches appear all over the screen, and intermittently appear/vanish as I move my camera around.  The draw code looks something like this:

basicEffect.World = Matrix.Identity;
basicEffect.View = Matrix.CreateLookAt(
    camera.Position,
    camera.Position + camera.GetForward(),
    camera.GetUp()
);
basicEffect.Projection = Matrix.CreatePerspectiveFieldOfView(
    camera.FieldOfView,
    camera.AspectRatio,
    1.0f,
    1000.0f
);

BoundingFrustum viewFrustum = new BoundingFrustum(basicEffect.View * basicEffect.Projection);

List<VertexPositionTexture> vertices = new List<VertexPositionTexture>();
foreach (Voxel voxel in voxelWorld.GetAllVoxels())
{
    if (viewFrustum.Intersects(voxel.Cube.BoundingBox))
    {
        vertices.AddRange(voxel.Cube.GetVertices());
    }
}

if (vertices.Count != 0)
{
    foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
    {
        pass.Apply();
        using (VertexBuffer buffer = new VertexBuffer(
            graphicsDevice,
            VertexPositionTexture.VertexDeclaration,
            vertices.Count,
            BufferUsage.WriteOnly))
        {
            buffer.SetData(vertices.ToArray());
            graphicsDevice.SetVertexBuffer(buffer);
        }
        graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, vertices.Count);
    }
}

So if I remove the viewFrustum.Intersects() check everything is fine.  It seems unlikely to me that the viewFrustum check itself is causing the error, but I can't figure out where the problem is coming from.  Any suggestions?

sentences:
Unity ads showing only 3 or 4 times I have published a game on googleplay that uses Unity rewarded ads. Once the player dies, they have an option of reviving by watching a rewarded ad. However when I try this, the ad shows only 3 or 4 times and then nothing happens after that(when I click the revive button). Here is the ad manager script:
string GooglePlay_ID = "123456";
bool test_mode = false;
string myPlacementId = "rewardedVideo";

void Start()
{
   Advertisement.AddListener(this);
   Advertisement.Initialize(GooglePlay_ID, test_mode);
}

public void DisplayVideoAD()
{
    Advertisement.Show(myPlacementId);
}

public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{

    if (showResult == ShowResult.Finished)
    {
      GameManager.instance.ReceiveReward();
    }
    else if (showResult == ShowResult.Skipped)
    {

    }

    else if (showResult == ShowResult.Failed)
    {
        Debug.LogWarning("The ad did not finish due to an error.");
    }
}

 public void OnUnityAdsReady(string placementId)
{

    if (placementId == myPlacementId)
    {

    }
}

public void OnUnityAdsDidError(string message)
{

}

public void OnUnityAdsDidStart(string placementId)
{

}

Here is the ReceiveReward() function that's in the game manager. This function seems to work fine as after clicking the button, the game restarts with the score before the player died.
public void ReceiveReward()
{
    savedScore = (int)playerScore;
    UpdateUI(GameStates.Start);
    SceneManager.LoadScene(1);
}

I'm not sure what's going wrong as the ads work a few times...Can someone please help?

sentences:
How can I set the radius the object will rotate around the target? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TargetBehaviour : MonoBehaviour
{
    // Add this script to Cube(2)
    [Header("Add your turret")]
    public GameObject Turret;//to get the position in worldspace to which this gameObject will rotate around.

    [Header("The axis by which it will rotate around")]
    public Vector3 axis;//by which axis it will rotate. x,y or z.

    [Header("Angle covered per update")]
    public float angle; //or the speed of rotation.

    public float upperLimit, lowerLimit, delay;// upperLimit & lowerLimit: heighest & lowest height;
    private float height, prevHeight, time;//height:height it is trying to reach(randomly generated); prevHeight:stores last value of height;delay in radomness;

    // Update is called once per frame
    void Update()
    {
        //Gets the position of your 'Turret' and rotates this gameObject around it by the 'axis' provided at speed 'angle' in degrees per update
        transform.RotateAround(Turret.transform.position, axis.normalized, angle);
        time += Time.deltaTime;
        //Sets value of 'height' randomly within 'upperLimit' & 'lowerLimit' after delay
        if (time > delay)
        {
            prevHeight = height;
            height = Random.Range(lowerLimit, upperLimit);
            time = 0;
        }
        //Mathf.Lerp changes height from 'prevHeight' to 'height' gradually (smooth transition)
        transform.position = new Vector3(transform.position.x, Mathf.Lerp(prevHeight, height, time), transform.position.z);
    }
}

Now it's rotating in a constant radius.
I set the variable axis to 0,1,0

But if I want the object to rotate around the turret very close to it or very far ? I want to add a radius variable so I can change and set the radius.

sentences:
How do I find artists to work on my game? I ask "how" rather than "where" because there are undoubtedly lots of artists that are just plain lousy or unreliable.

Let's assume both paying and non-paying (mods, free games/open-source) positions.

sentences:
How can I make a swinging rope? Base question: How can I make a swinging rope in box2d?

Context: The idea is to have a rope where the player can grab it, swing a little bit to get more "momentum" and reach the next platform. Like in the Mario games for Nintendo DS and Wii.

What I did: I constructed a chain like rope with a series of RevoluteJoint. This is the fixture of the different links:

fixtureDef.shape = robeLinkShape;
fixtureDef.density = 1.0f;
fixtureDef.friction = 0.0f;
fixtureDef.restitution = 0.0f;
fixtureDef.filter.categoryBits = Box2DConst.BIT_ROPE;
fixtureDef.filter.maskBits = Box2DConst.BIT_PLAYER;

BodyDef bodyDef = new BodyDef();
bodyDef.angularDamping = 1.0f;
bodyDef.linearDamping = 1.0f;

I've implemented a ContactListener which creates a RevoluteJoint to connect the body and on of the links of the body. Now the problem I face is this: The rope does not swing, if I apply a linearImpulse to the player (attached to the rope) e.g. to the left, it goes to the left but it doesn't swing back. If the player isn't attached the rope swings.

Last points:

I made the player a dynamic body with a density of 1. Is it better, if the player body does not have a density set?
If the chain is to "light" (lower density) the player can torn it apart if he is attached to the rope. If I connect the last link with the first link of the chain with a RopeJoint the last and the first link stay at the same distance but for some reason, the links between still get torn apart. Question is, should I make my rope only of RopeJoins?

I know there are some tutorials out there with some instructions but some of them use a special class which is not available to me and other simply construct a rope and use a MouseJoint. Again in this scenario my rope thing looks good the problem that when the player body is attached to it it behaves a little bit strange. I know there are also similar posts to mine but since I have some sort of a working solution there solution (if the have any) was not helpful.

Update

If I create the rope solely from RopeJoints I get a nice swinging rope. It behaves exaclty as I woulrd expect. If I then a RevoluteJoint with a density (my player body fixture also has a density) the rope does no longer swing.

sentences:
How to avoid many import iterations while generating sub assets? I have a ScriptedImporter that generates other assets in the same directory.

Whenever it happens, import progress bar pops in again, this time like Importing (iteration N).

I've tried to use AssetDatabase.DisallowAutoRefresh to circumvent this behavior but that failed.

Question:

How to prevent subsequent import iterations and rather group them to happen all at once ?

sentences:
How to change chance of spawn based on distance? I am trying to make a cellular automate cave but want to keep the middle empty.

How should I change the chance based on the distance from the middle?

I don't want to completely deny it just want a small enough chance to keep it almost empty.

sentences:
GameMaker Studio: fullscreen vs. dialogs When setting my game to fullscreen, I get problems with dialogs:

"get_save_filename" opens in the background, and when I close it, the game doesn't react anymore.
Asking the user a yes/no question exits fullscreen mode and does not enter it again afterwards.
"window_set_fullscreen" doesn't seem to do anything either...

Can anyone help?

sentences:
Is my technique for client-side character movement in an MMORPG reasonable? I started an MMORPG game, and I can already make a character move around the map and see other characters. But I have doubts about my architecture.

I have a loop which, every x milliseconds, request from the database the actual position of all characters around the main character. After that, I remove all the objects from the screen and redraw them based on the data retrived from database. Is this reasonable, or is there a better solution?

sentences:
Pitch/Yaw in circle causes undesired Tilt I've made my own Camera object, with a forward vector as well as a up vector. I happen to be programming in Android using OpenGL ES 2.0 but I think this question is relevant to all frameworks, it seems to be some math issue I'm not understanding.

Here's a gif of my Pitch/Yaw working correctly:

Here's a gif of Pitch/Yaw in a circle, causing the square to rotate, because the camera is tilting (the up vector becomes negative as I continue).

Here's pseudocode for my pan/yaw functions:

function pitch(amount) {
    if (amount == 0) return;
    forward = normalize(forward + up * amount);

    // Now fix the incorrect up vector
    right = cross(forward, up);
    up = normalize(cross(right, forward));
}

function yaw(amount) {
    if (amount == 0) return;

    right = cross(forward, up);
    forward = normalize(forward + right * amount);
}

I get the same issue if I use Vector rotations instead of Vector Addition (amount is an angle and I use a Rotation Matrix in the X or Y axis)

Pitch: forward = normalize(rotated(forward, angle, Vector3(1, 0, 0)));
Yaw: forward = normalize(rotated(forward, angle, Vector3(0, 1, 0)));

Why is this happening? Is there a way to stop it?

EDIT: I followed the instructions at Why is the camera tilting around the z axis when I only specified x and y? to pitch using the local X axis and yaw using the world Y axis, same result.

Here's the new pseudocode:

function pitch(angle) {
    if (angle == 0) return;

    right = cross(forward, up);
    forward = normalized(rotated(forward, angle, right));

    // Fix the now incorrect up vector
    up = normalized(cross(right, forward));
}

function yaw(angle) {
    if (angle == 0) return;

    forward = normalized(rotated(forward, angle, Vector3(0, 1, 0)));
}

You can see all the code at https://github.com/repwolfe/paper-escaper-android/tree/master/app/src/main/java/com/studioussoftware/paperescaper

sentences:
How to detect and prevent abuse (botting) of online game API? I have been ocassionally working on a game idea in my free time. The gameplay and content renders it to be implemented as a online multiplayer game built with well established web technologies. You should know that it falls into the strategy and simulation genre. That means: No running around with characters or similar but only atomic actions (regarding client-server communication) like "build thing A on location X".

At one point I realized there is a huge problem: having a browser based front end relying on a REST API back end makes it a more than excellent target for bots. While automation is desireable for business it is poison to a game which is about fun. I experienced it first hand in a browser game in the past were the most successful players were bots which subdued everybody.

From my current point of view I do not see any possibility to protect against bots when building a multiplayer online game based on  a REST API. Exception: Making it open source so everybody can host his own instance for private groups or even just oneself (to not get annoyed by jerks with bots).

Is there any way to differenciate between an honest player who just set an alarm for the next possible action and a bot automatically taking every chance on appearance of it? Besides such show stoppers like captchas. If not, I would think about another technology stack which makes it at least much harder to mess with client-server communication (proprietary encrypted binary protocol in a native code client).

Edit: Thank you, your answers are inspiring but also made me realize that specific countermeasures cannot be made by going further into details of the game. However, that would be too much for a question on Stack Exchange. So I just want to point out the most important points:

Players are exploring, developing and managing whenever they want to. Their businesses still run fine when they are offline (it is a peaceful game, no weapons involved). Only expansion and progress need the players action. Those actions are limited by:
time is one of the key resources (like in EVE Online skill training). All processes in game require it. There is no point in being online 24/7. The average player should be successful already with spending not more than an hour every day in one or two sessions (roughly, the concept is still in development).

sentences:
How can I make a shader that renders only the scene's skybox? I am trying to replicate the following image:

There are a few ways about doing this that involve camera stacking, layers, etc. Is it possible to create a shader that will only render the skybox?

sentences:
std::map inserts a NULL pointer I ran into an access violation reading error and when I debugged it, I saw that the insert function of std::map is inserting a NULL pointer into the map.

Though I've fixed the error by first inserting a NULL value into the map and then changing that value to the corresponding object I wanted to insert in the map. But I want to know the reason the error occurs and why it got fixed.
My code looks like this:

void CTextureBank::AddTexture(int ID)
{
    // Create a CTexture object, load texture into it and insert it into the Texture List
    CTexture* texture = new CTexture();
    texture->LoadTextureFromFile(mRenderer, ID);
    mTextureList.insert(std::make_pair<int, CTexture*>(ID, texture));
}

In the AddTexture function, I'm first creating a texture object, loading a texture into it and putting that texture into the map.
But, this one gives me an access violation reading error.

And doing this doesn't:

void CTextureBank::AddTexture(int ID)
{
    // Create a CTexture object, load texture into it and insert it into the Texture List
    CTexture* texture = new CTexture();
    texture->LoadTextureFromFile(mRenderer, ID);
    mTextureList.insert(std::make_pair<int, CTexture*>(ID, NULL));
    mTextureList[ID] = texture;
}

So it would be great if someone can tell me why this occurs.
Thanks :)

sentences:
Procedural generation of heightmap for non rectangular surface I'm working on procedural generation of terrain for a continent, meaning I need a wide range of hills, mountains and valleys generated around the continent. For mountains I've adopted Amit's algorithm for island generation, which produces quite good looking mountain with very clear ridges, slopes and everything else mountain tend to have. Now my problems is with some smoother hilly terrain.

Due to a hexagonic nature of my continent, the mesh is subdivided into triangles. Also due to needing multiple mountains/hills/valleys I also split my continent into sectors, which are then stitched together easily due to the fact the edges of the sectors always have zero elevation. So the constraints are the following:

The surface is hexagonal, this actually is less of a problem, since I can still generate elevation for "square" grid and use bilinear interpolation on "real" hexagon verts.
The surface is not a square, this I have absolutely no idea how to deal with.

Now most of the terrain generating algorithms always generate the terrain on a square surface, midpoint displacement, noise, you name it. Also they don't generate zero values on the edges, which is a strict requirement for me.

Now I would really like to adopt the double simplex noise approach, but once again, I need a way to force it to always generate zeroes outside of the bounds of my polygonal sector (which obviously varies), and smooth values inside the bounds, which would form nice hilly terrain. Question is... is it even possible, or should I be looking for a diferent approach?

sentences: How to avoid ghosting when pressing multiple keys? I am working on a 2d side-scrolling pc game that uses SFML game library. The problem that I am not able to solve is that in many keyboards combination of three or more keys (like w + d + k) is not working. Is there any way to solve this issue?

sentences:
Terrain square loading Games like Skyrim, Morrowind, and more are using quads or square to divide the terrain if im correct. The player is always at #5

1 | 2 | 3
4 | 5 | 6
7 | 8 | 9

So whenever you cross the border you unload and load the new "areas" But if the user goes just over the edge and then the second after goes back previous area a lot of unnecessary loading and unloading is done. Is there a general approach to this because I dont think games like skyrim have this issue?

Cheers!

sentences: Importance of templates? From a game developing point of view, how important do you consider templates to be as a topic to know about in C++? Have you used templates as a part of developing games or similar? Neither do I really understand how important templates can be considered from a general point of view.

sentences:
Circle Collider Vibrates on Edge Collider I am making a game (kind of bricks) and using edge collider objects as world bounds collider. I am increasing count of balls on each iteration, after 5 balls, balls start to vibrate when they contact with edge colliders. Vibrating means, they do not bounce directly when they contact with edge collider, they vibrate on x axis for some period while they are moving upwards on y axis.

Ball physics: (friction is 0, bounciness is 1)

Wall physics: (friction is 0, bounciness is 0)

I am not updating transform of ball object, directly set a velocity to balls.

Also i've recorded a video for this behavior: https://www.youtube.com/watch?v=K-bjkXZjXjs&feature=emb_logo

Which point i am missing on this setup? Can you help me to solve this problem?

Best,

Edit:

I have a input listener class, that updates BallThrowHandler.thrown variable, when you put your finger to screen, move and release.

Code that adds velocity to balls (which is running on another object):

using UnityEngine;
using System.Collections;

public class BallContainerBehaviour : MonoBehaviour
{
/// <summary>
/// total speed of the balls
/// </summary>
public float totalSpeed = 5f;

public float timeBetweenBalls = 0.2f;

WaitForSeconds wait;

public float degrees = 0f;

Rigidbody2D childBody;
Vector3 speedVector;

float cosinus;
float sinus;

void Start()
{
    wait = new WaitForSeconds(timeBetweenBalls);
}

void Update()
{
    if(BallThrowHandler.thrown)
    {
        //start throw animation

        startBallMovement();
    }
}

// start ball movement if they thrown
private void startBallMovement()
{
    calculateDegrees();

    //speedUpBalls();

    if(BallThrowHandler.thrown)
    {
        StartCoroutine("speedUpBalls");
    }

    CollectBallHandler.CollectingBallsStarted = false;
    BallThrowHandler.BricksMovedDown = false;
}

private void calculateDegrees()
{
    degrees = Vector3.Angle(Vector3.right, BallThrowHandler.ThrowVector) * Mathf.Deg2Rad;
}

private IEnumerator speedUpBalls()
{
    cosinus = Mathf.Cos(degrees);
    sinus = Mathf.Sin(degrees);

    speedVector = new Vector3(totalSpeed * cosinus, totalSpeed * sinus, 0f);

    foreach (Transform go in transform)
    {
        childBody = go.gameObject.GetComponent<Rigidbody2D>();
        childBody.velocity = speedVector;
        yield return wait;
    }
    BallThrowHandler.thrown = false;
}}

And here is whole code for a ball object: (only bottom collider is trigger, left right and top is not)

using UnityEngine;
using System.Collections;

public class BallEndTurnBehaviour : MonoBehaviour
{
Rigidbody2D body;

public float ballMinY;

public GameObject bricksContainer;

private BrickSpawner brickSpawner;
private BrickTurnOverMover brickTurnOverMover;

private const float EPSILON = 0.01f;

private void Awake()
{
    body = GetComponent<Rigidbody2D>();
}

void Start()
{
    brickSpawner = bricksContainer.GetComponent<BrickSpawner>();
    brickTurnOverMover = bricksContainer.GetComponent<BrickTurnOverMover>();
}

private void Update()
{
    if(System.Math.Abs(body.velocity.x) < EPSILON && System.Math.Abs(body.velocity.y) < EPSILON && CollectBallHandler.CollectingBallsStarted)
    {
        transform.position = Vector3.Lerp(transform.position, CollectBallHandler.CollectingBallsPoint, 0.1f);
    }
}

private void OnTriggerEnter2D(Collider2D collision)
{
    if (!CollectBallHandler.CollectingBallsStarted)
    {
        CollectBallHandler.CollectingBallsStarted = true;
        CollectBallHandler.CollectingBallsPoint = transform.position;
        CollectBallHandler.CollectingBallsPoint.y = ballMinY;
    }
    body.velocity = new Vector3(0, 0, 0);

    Vector3.Lerp(transform.position, CollectBallHandler.CollectingBallsPoint, 1f);

    if(!BallThrowHandler.BricksMovedDown)
    {
        brickTurnOverMover.moveBricks();
        BallThrowHandler.BricksMovedDown = true;
        brickSpawner.spawn();
    }
}
}

sentences:
Incorporating HttpSession into libGDX communication I wrote my server-side code prior to learning libGDX and writing my client-side code.  Gdx.net provides for the http get communication I designed for, except for session authentication.  I say that based on not finding sessions mentioned in the API, and a couple heavies confirming it on the libGDX discord.
Are there any libraries / examples out there of libGDX developers who mirrored session authentication functionality?  The key limitation here is I want to stay with http request/response communication.

Minus any such direction, my next step will be to try using the "javax.servlet" libraries I used server-side on the client, and forgo the http classes that come included in the Gdx.net package.  I'm reluctant to take this step noting that libGDX has its own versions of lots of classes, for efficiency and to prevent memory leaks given how libGDX programs execute.  It'll be a while yet before my programming skills can detect and address such subtle issues.  Also, I think that browsers and the server servlets run on participate in session architecture.  With neither component in a libGDX PC app for "javax.servlet" to collaborate with, I'm doubtful this solution can work.
If it doesn't work, I'll think about moving up my goal of researching and learning how to use cloud hosting services. Some of these were recommended to me on discord as having frameworks with built-in support for authentication.

sentences:
Cocos2dx- Draw primitives(polygons) on Update In my game I'm trying to draw polygons on on each step i.e. update method. I call draw() method to draw new polygon with dynamic vertices. Following is my code:

void HelloWorld::draw ()
{
    glLineWidth (1);

    CCPoint filledVertices[] = {
        ccp (drawX1, drawY1),
        ccp (drawX2, drawY2),
        ccp (drawX3, drawY3),
        ccp (drawX4, drawY4)
    };

    ccDrawSolidPoly (filledVertices, 4, ccc4f (0.5f, 0.5f, 1, 1));
}

I call the draw() method from the update(float dt) method. The engine is behaving inconsistently i.e. sometimes it displays the polygons and on other occasions it does not.

Is it the right approach to do such a task? If not what is the best way to display large number of primitives?

sentences:
How do I get a list of all available entities in a Source engine game? How do I get a list of all available entities in a Source engine game?

There is only one exported function in the server DLL - CreateInterface - so it's not an option. In GoldSrc games, the server DLL features all entities as exported functions.

sentences: How to make ghosts AI chase Pac-Man in Java I'm beginner at Java and I want to make ghosts chase Pac-Man in game. I read some algorithm like A* or Dijkstra but I don't know how to implement them in my game. Please help me.

sentences:
Rotate Rigidbody to face away from camera with AddTorque I have a camera that rotates around an object with "Look At" .

I want the object to rotate to face the direction the camera is pointing (Camera.main.transform.forward) using AddTorque, but I can't understand how.

I tried to create a rotation in which the more the object's forward vector rotates towards the camera, the more it should slow down the rotation until it stops. But it only works in sections, when I use the rotation of the camera the object rotates and then stops, as if it detects only one part of the rotation, while the other is a blind spot.

What equation can I use to rotate the object well?

var currentR = rb.rotation.y;
var targetR = Camera.main.transform.rotation.y;
rb.AddTorque(transform.up * 1000f * (targetR - currentR));

@DMGregory♦
I put your script as it is in a separate new script on a new object, equipped with a rigidbody.
I post the script how I entered it. At "targetOrientation" I gave the value of "Quaternion.LookRotation (Camera.main.transform.forward);" because I want the object to follow the direction of that camera.
The result is that all the axes of the rigidbody are influenced by the rotation (if I lift the camera the object turns towards the ground, etc.), and above all that the rotation works even if I block the axes with Freeze Rotation, and with this script the object is no longer affected by external forces.

public class rotation : MonoBehaviour
{
    private Rigidbody rb;
    public Transform direction;
    // Start is called before the first frame update
    void Start()
    {
      rb = GetComponent<Rigidbody>();
    }

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

     Quaternion targetOrientation = Quaternion.LookRotation(Camera.main.transform.forward);
    Quaternion rotationChange = targetOrientation * Quaternion.Inverse(rb.rotation);

    rotationChange.ToAngleAxis(out float angle, out Vector3 axis);
    if (angle > 180f)
        angle -= 360f;

    if (Mathf.Approximately(angle, 0)) {
        rb.angularVelocity = Vector3.zero;
        return;
    }

    angle *= Mathf.Deg2Rad;

    var targetAngularVelocity = axis * angle / Time.deltaTime;

    float catchUp = 1.0f;
    targetAngularVelocity *= catchUp;

    rb.AddTorque(targetAngularVelocity - rb.angularVelocity, ForceMode.VelocityChange);

     }
    }

I set a command [if (Input.GetKeyDown (KeyCode.T)) rb.AddTorque (transform.up * 5500f, ForceMode.Impulse);] to rotate the object with an impulse and this does not work when your rotation script is active.
I also place a video where you see the object before activating the rotation script, and after it is active, to see how it does not react to the impulse with T, and how it rotates reacting on all rotation axes, while I want only that the rigidbody only rotates its Y-axis of rotation, in the direction of the camera (as a person does when turning in one direction). In the video The axes of rotation X and Z are on freeze (otherwise without fixed the rotation the object falls moving).
I also put a video of the desired effect taken from a game so as to explain me better.

My video
desired rotation

sentences:
GLSL - Overlap shapes generated by the same function with custom size/color I'm trying to make a ui button shader by overlaping a rounded rectangle on another rounded rectangle but with different size and gradient color. This way I'll have a small outline of a color (e.g. grey) and the body with a grey-ish gradient.

This is how my fragment code looks so far:

#ifdef GL_ES
precision mediump float;
#endif

uniform vec2 u_resolution;

const float PI = 3.14159265;

// from http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm
float rect( vec2 p, vec2 size, float r ) {
    return length(max(abs(p)-size+r,0.0))-r;
}

void main() {
    vec2 halfRes = 0.5 * u_resolution.xy;
    float aspect = u_resolution.y/u_resolution.x;
    // compute box
    float b = rect(gl_FragCoord.xy - halfRes, halfRes, 30.0);
    b *= rect(gl_FragCoord.xy - halfRes, halfRes * vec2(0.99, 0.96), 30.0);

    // colorize (red / black )
    vec4 c = mix( vec4(0.326,0.603,1.000,1.000), vec4(0.0), smoothstep(0.0, 13.264,b) );

    gl_FragColor = c;
}

You can modify it directly here by cp http://editor.thebookofshaders.com/

EDIT: I've managed to get the border, now I'll only need to fill the hollow..

sentences:
Referencing individual cells of a tilemap and changing texture I have a tilemap and am trying to proceduraly generate islands on it by changing the texture of the tiles and marking it as land ( I want to do this without texture atlas for now). How do you change the texture of an individual tile and how do you mark the tile to distinguish it from other tiles within map as land . I have tried to do this but for some reason even though I reference an individual tile all tiles are changing textures.

private static TiledMapTileLayer baseLayer;
private static TextureRegion landTextureReg;
private static Texture landTexture;
private static TiledMapTile landTile;

public static TiledMap generateMap(){
landTexture = new Texture(Gdx.files.internal("hex_land_trans.png"));
landTextureReg = new TextureRegion(landTexture);
TiledMap map = new TmxMapLoader().load("ocean_hex_map.tmx");
baseLayer = (TiledMapTileLayer)map.getLayers().get(0);
baseLayer.getCell(1, 1).getTile().setTextureRegion(landTextureReg);
return map;
}

sentences:
Unity | How to create C# classes with different properties like Objects in javascript and put them in an array? I just started my gamedev journey on unity this week and while I have a background with coding, I'm still somewhat of a beginner. Last year I made a text/UI based game on the web browser with javascript and have been trying to make the same game on Unity.

One of the main features of my game is that you press a button to "go hunting" and I had an array filled with enemies that were objects with different properties such as health, mana, attack, etc...

Then I'd randomly pick one of those objects from the array to be chosen as my enemy that I'd fight. I've been trying to figure out the best way to do this with C# and I might just be overthinking this.

As a bonus, I'd also like to be able to see the individual enemy objects in the array in my inspector if possible so I could tweak the stats within unity.

I've looked at scriptableObjects and different things but I am having a hard time putting it all together in an array from within unity.

[System.Serializable]
public class playerClass
{
    public string playerName;
    public int lvl;
    public int maxHealth;
    public int health;
    public int maxEnergy;
    public int energy;
    public int exp;
}

public class playerScript : MonoBehaviour
{
    public playerClass player;

}

This is how I created an object for the player, I want to do something similar for the enemies but put them in an array so I could randomly pick from them.

If there is a better way to do this I'd also welcome some advice :) thank you

sentences:
How to make Box2D bodies automatically return to a initial rotation I have two long Box2D bodies, that can collide while moving one of them around with MouseJoint. I want them to try to hold their position and rotation.

Blue body is moved using MouseJoint (yellow) towards the Red body. Red body has another MouseJoint - Blue can push Red, but Red will try to return to the start point thanks to the MouseJoint - this works just fine.
Both bodies correctly rotate along the middle. This is still as I want. I change the MouseJoint to move the Blue away.
What I need is both bodies return to their initial rotation (green arrows)
Desired positions and rotations

Is there anything in Box2D that could do this automatically? The MouseJoint does that nicely for position. I need it in AndEngine (Java, Android) port, but any Box2D solution is fine.

EDIT: By automatically I mean having something I can add to the object "Paddle" without the need to change game loop. I want to encapsulate this functionality to the object itself. I already have an object Paddle that has its own UpdateHandler which is being called from the game loop. What would be much nicer is to attach some kind of "spring" joint to both left and right sides of the paddle that would automatically level the paddle. I will be exploring this option soon.

sentences:
Getting an images rgb value at click I'm not sure if this is at all possible, but maybe it will spark up an interesting conversation. (Sidenote: working on a small game in Löve).

I'm making an archery shooting kind of game, and I was thinking it might be cool to have critical and regular hits based on where the user shoot the arrow at the enemy. Example, if I have a troll image, and the user clicks the head of the troll, it will count as a critical hit.

Checking to see if the user clicked on the top part of the image vs the bottom, isn't the tricky part. The hard bit will be to check if the user clicked on apart of the image, instead of blank space in the png...

So, main question: Is it possible to get the rgb value of where an image has been clicked, to determine if they hit or missed the target.

Also, if this is at all possible, is there anyone familiar with Löve that can confirm it is doable?

Edit: I'm realizing now it's not the rgb value I want to look for, it is whether or not the clicked pixel has transparency. If it is 100% transparent that means the user missed the image.

sentences:
(LWJGL) Resize window content I am having a little issue with my game trying to get the screen to draw a ton larger. I am going for a retro type of feel for my game and I believe that this would help with that.

I am basically trying to take a small area (example 100x177) and draw it 9 times the original size while still keeping the nearest neighbor. The image below shows what I am trying to achieve.

(image taken from: http://forums.tigsource.com/index.php?topic=27928.0).

I have been trying to set the current render area to an FrameBuffer then draw the Frame Buffer larger on the window. I have not been able to find any example code or how I would go about doing that.

Thank you in advance for the help.

EDIT: Added sample code

This code is in the same method where I initialize OpenGL

    fboID = GL30.glGenFramebuffers();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboID);
    colID = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, colID);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, scaleWidth, scaleHeight, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    depID = GL30.glGenRenderbuffers();
    GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, depID);
    GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL11.GL_DEPTH_COMPONENT, scaleWidth, scaleHeight);
    GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER, depID);
    //GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, colID, 0);
    drawBuffs = BufferUtils.createIntBuffer(1);
    drawBuffs.put(0, GL30.GL_COLOR_ATTACHMENT0);
    GL20.glDrawBuffers(drawBuffs);
    if(GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE){
        System.out.println("Framebuffer not complete!");
    } else {
        System.out.println("Framebuffer is complete!");
    }

And this is my render method that the game loop runs (updates at 60fps)

    // clear screen
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    // Start FBO Rendering Code
    //GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fboID);
    // Resets the current viewport
    GL11.glViewport(0, 0, scaleWidth, scaleHeight);                 // Set viewport to be the size of the FBO
    // Clear the FrameBuffer
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    // Actual render code!
    gameMap.render();

    // draw the texture from the FBO
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    GL11.glViewport(0, 0, scaleWidth*scale, scaleHeight*scale);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glTexCoord2f(0.0f, 0.0f); GL11.glVertex3f(0.0f, 0.0f, 0.0f);
    GL11.glTexCoord2f(1.0f, 0.0f); GL11.glVertex3f((float)scaleWidth*scale, 0.0f, 0.0f);
    GL11.glTexCoord2f(1.0f, 1.0f); GL11.glVertex3f((float)scaleWidth*scale, (float)scaleHeight*scale, 0.0f);
    GL11.glTexCoord2f(0.0f, 1.0f); GL11.glVertex3f(0.0f, (float)scaleHeight*scale, 0.0f);
    GL11.glEnd();

    // Resets the current viewport
    GL11.glViewport(0, 0, scaleWidth*scale, scaleHeight*scale);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();

    // let subsystem paint
    if (callback != null) {
        callback.frameRendering();
    }

    // update window contents
    Display.update();

I had to comment out "GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER,GL30.GL_COLOR_ATTACHMENT0, colID, 0);" because it was throwing a "Function not supported" error.

Thanks

sentences: How to force XNA to render model very far away as a light dot? Making a space strategy game focusing on commanding a large fleet, with 1000+ ships per side.(I'm new in XNA 3D...below is a test screenshot. The ships will be scaled down another 2-5 times) When a unit is too far away, it's not rendered anymore.(obviously...when people get killed, they die) are there any way (as fast as possible) to force XNA to render the model into a 1-pixel dot if it's too far/smaller than 1 pixel? (I'm thinking about dynamic scaling, but that will probably drag down the performance severely)

sentences:
Any idea to be able to make the character still continue the game until no heart left I am newbie I am making a 2d game in unity 3d my code for the character game over is this.. I can get the heart less one heart if game over but turn back to five again I just want to decrease heart whenever character die until it loss all the five heart

and my code for the heart is this...

function Start () {
    coins = PlayerPrefs.GetInt("Coin");
    moveSpeed=10;
    anim=GetComponent(Animator);
    MainCode.Hearts = 5;
}

function Update () {

    transform.rotation.z=0;
    if(Input.GetKey(KeyCode.UpArrow)){
         transform.position.y+=moveSpeed*Time.deltaTime;
    }

    if(transform.position.y<-5) {
         Application.LoadLevel(Application.loadedLevel);
         MainCode.Hearts -=1;
    }
    if (MainCode.Hearts <= 0){
         GameOver();
    }

}

var image : GUITexture;
var Image_01 : Texture2D;
var Image_02 : Texture2D;
var Image_03 : Texture2D;
var Image_04 : Texture2D;
var Image_05 : Texture2D;
var Image_06 : Texture2D;

function Update {
    if(MainCode.Hearts == 5){
         image.texture= Image_01;
    }
    if(MainCode.Hearts == 4){
        image.texture= Image_02;
    }
    if(MainCode.Hearts == 3){
        image.texture= Image_03;
    }
    if(MainCode.Hearts == 2){
         image.texture= Image_04;
    }
    if(MainCode.Hearts == 1){
        image.texture= Image_05;
    }
}

however its not working properly any help would be really much appreciated thank you in advance

sentences:
What are the pros and cons to building an audience with a small, simple, free game first as opposed to focusing efforts on a commercial release There are two projects we can work on. One would be a small free game to try and get our name out/build an audience. The second is our main idea for a first product.

What are the pros and cons of building the small, simple, free game first instead of focusing that time/effort into the main money making project.

sentences:
How can I convert .X files from text to binary form? Is there a tool for Linux (preferably a command-line tool) that can convert from the .x text format to the binary format? I wish to use this format with Irrlicht but the text format is loading very slowly (taking around 8 seconds to load one model), so I'm wondering if the binary format will be faster.

I have seen this question, but that seems to be asking more for pointers on learning the .x format, whereas I am specifically looking for a Linux tool.

sentences:
How can I reverse the effect of a transformation matrix? I have recently been working on a game with using OpenGL and C++ through GLFW.

In the game I have an airship with a turret mounted on it. The airship moves around in world space coordinates and the turret 'follows' it.

The turret has it's own coordinate space for its look/aim direction. Basically, when the turret aims in direction (0,0,1), it aims parallel to the airships direction of movement.

To give the turret a world space target, I have a matrix that takes world space coordinates and transforms these to turret space coordinates.

As the turret fires, I want it to spawn projectiles in world space, so is there an elegant way of using my transformation matrix to convert turret space coordinates back to world space?

A more general way of asking the question might be: if I have a matrix M that takes coordinates from space A to space B. Is there an easy way to use M to get the coordinates from B to A?

sentences:
What new programming languages are being used to develop web-based games? I've got around 10 years behind me of casually creating AS1/2/3 games and have found myself wondering recently what other options are available for web-based games.

I have recently found haXe and will probably start coding in that, since it is largely based on AS3/ECMAScript, and I am also aware of JavaScript/jQuery etc and HTML5 being suitable for purpose, but what else is there?

What up and coming languages are being used to develop / are targeted at making web-based games?

sentences:
Trying to get an object to move in the mouse direction XNA C# Right, so in my Player class where I call the object I got an if statement which gets the coordinates for the mouse

        bool PickedCoords = true;
        MouseState mouseState = Mouse.GetState();
        if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released)
        {
            PickedCoords = true;
            int MouseX = mouseState.X;
            int MouseY = mouseState.Y;
        }
        else
        {
            PickedCoords = false;
        }
        oldState = newState; // this reassigns the old state so that it is ready for next time

Now how would I make MouseX and MouseY be used as the direction of the vector of my object moving in the specified X and Y coordinates? What I'm, almost trying to do is move the object in the direction of the mouse click and make it continue to move in that direction until it's stopped by whatever.

sentences:
Is there an HLSL equivalent to GLSL's "map" function? Google has not helped me in this area.

Here is the GLSL shader:

vec3 globalIllumination(vec3 p, vec3 n) {
vec3 g = vec3(0.0);
float dist;
for (float i = 1.0; i <= samples; i++) {
    dist = stepDistance * i;
float d =  vec3(dist - map(p + n * dist, returnColor));
    g += returnColor*d/ i;
}
return g;
}

I know how to convert this to HLSL, except for that map function. I could use some help.

sentences:
Problem with Moving object with touch and make camera to follow the object I watched a tutorial about  Unity Mobile From Scratch: Moving a 3D Object with Touch in Perspective on YouTube but when I added a camera follow script to follow that 3D object the object keeps moving even I clicked or dragged the ball once. Does anyone know why this is happening?

This is the code of moving the ball with mouse or touch from the tutorial

if (Input.GetMouseButtonDown(0))
    {
        Ray mouseRay = RayGenerator();
        RaycastHit hit;

        if (Physics.Raycast(mouseRay.origin, mouseRay.direction, out hit))
        {
            if (hit.transform.gameObject.tag == "BowlingBall")
            {
                obj = hit.transform.gameObject;
                objPlane = new Plane(Camera.main.transform.forward * -1, obj.transform.position);

                Ray mRay = Camera.main.ScreenPointToRay(Input.mousePosition);
                float rayDistance;
                objPlane.Raycast(mRay, out rayDistance);
                ballTouchOffset = obj.transform.position - mRay.GetPoint(rayDistance);
            }

        }
    } else if (Input.GetMouseButton(0) && obj)
    {
        cameraFollow.enabled = false;
        isDragging = true;
        Ray mRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        Ray mouseRay = RayGenerator();
        Debug.DrawRay(mouseRay.origin, mouseRay.direction, Color.red);

        float rayDistance;

        if (objPlane.Raycast(mRay, out rayDistance))
        {
            obj.transform.position = Vector3.Lerp(transform.position, new Vector3(mRay.GetPoint(rayDistance).x + ballTouchOffset.x, obj.transform.position.y, obj.transform.position.z), sideForce * Time.deltaTime);
        }

    } else if (Input.GetMouseButtonUp(0) && obj)
    {
        obj = null;
        isDragging = false;
        cameraFollow.enabled = true;
    }
}

And this is the camera script to follow that ball

public Transform bowlingBall;
public Vector3 offset;
public float cameraSlideSpeed = 5f;

void LateUpdate()
{
    transform.position = Vector3.Lerp(transform.position, bowlingBall.position + offset, cameraSlideSpeed * Time.deltaTime);
}

sentences:
How can I make the transform to keep moving the direction it was moving when pausing and then resuming? using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Experimental.GlobalIllumination;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class Moving : MonoBehaviour
{
    public Transform destination;
    public float moveSpeed = 5f;

    private Coroutine movementCoroutine;
    private bool pause = false;
    private Vector3 startPosition;

    private void Start()
    {
        startPosition = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        if(Input.GetKeyDown(KeyCode.Space))
        {
            pause = false;
            MoveToDestination();
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            pause = true;
        }
    }

    private void MoveToDestination()
    {

        // if the coroutine is still running, stop it
        if (movementCoroutine != null)
        {
            StopCoroutine(movementCoroutine);
        }

        // start the coroutine
        movementCoroutine = StartCoroutine(MoveToDestinationCoroutine());
    }

    // the coroutine
    private IEnumerator MoveToDestinationCoroutine()
    {

        // while this object is not at the destination
        while (transform.position != destination.position)
        {
            if (pause)
                break;
            // move it towards the destination, never moving farther than "moveSpeed" in one frame.
            transform.position = Vector3.MoveTowards(transform.position, destination.position, moveSpeed);

            // wait until next frame to continue
            yield return null;
        }

        while (transform.position != startPosition)
        {
            if (pause)
                break;
            // move it towards the destination, never moving farther than "moveSpeed" in one frame.
            transform.position = Vector3.MoveTowards(transform.position, startPosition, moveSpeed);

            // wait until next frame to continue
            yield return null;
        }

        StartCoroutine(MoveToDestinationCoroutine());
    }
}

I'm using the bool flag pause variable to pause and resume.
Pressing space to start moving then pressing s to pause and then space to resume the movement from the current paused position.
The problem is when it's resuming the movement it's not moving to the direction it was moving. It will resume the movement always to the left side even if it was moving to the right.
space key to start and resume and s key for pause.
Update :
I changed the pausing part to this :
private IEnumerator MoveToDestinationCoroutine()
    {
        // while this object is not at the destination
        while (transform.position != destination.position)
        {
            if (pause)
            {
                yield return null;
            }
            else
            {
                // move it towards the destination, never moving farther than "moveSpeed" in one frame.
                transform.position = Vector3.MoveTowards(transform.position, destination.position, moveSpeed);

                yield return null;
            }
        }

        while (transform.position != startPosition)
        {
            if (pause)
            {
                yield return null;
            }
            else
            {
                // move it towards the destination, never moving farther than "moveSpeed" in one frame.
                transform.position = Vector3.MoveTowards(transform.position, startPosition, moveSpeed);

                yield return null;
            }
        }
    }

sentences:
Sending high scores to a web server in an open source game I've never dealt with sending/receiving data from web servers in my games, so I absolutely have no idea how to do this. I tried googling for a good solution but couldn't find anything satisfying.

I currently get data from my web server by doing a HTTP request that gets the contents of a JSON text file stored on the server, and parses them in-game.

I do not know how to "write" high scores to the server, and even worse I do not know how to avoid people sending what they want to the server since the game is open source.

How is this usually done?

sentences:
Make the texture array node work with cubemaps? I am working on a procedural interior mapping shader in Unity's Shader Graph. Ideally, I'd like to feed it a set of cubemaps it can pick from semi-randomly.
However, it seems that by default the texture array asset one can provide to a graph does not support reading cubemaps.
Does anyone have a way to use this, or perhaps a clever custom node or alternate texture mapping, so that I can read a number of cubemaps into the shader semi-randomly? Preferably an arbitrary number, but even a fixed number would be somewhat of an improvement.

sentences:
How can I customize scrollbar sensitivity in editor property drawers in Unity3D? A custom property drawer, in my Unity 2017.3 project, has code like this in its OnGUI implementation:

public void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
    ...
    EditorGUI.BeginDisabledGroup(maxX == 0);
    scrollX = (uint)GUI.HorizontalScrollbar(new Rect(xyPos + new Vector2(slHeight, normalizedSize), new Vector2(normalizedSize, slHeight)), scrollX, 1, 0, maxX + 1, GUI.skin.horizontalScrollbar);
    EditorGUI.EndDisabledGroup();
    EditorGUI.BeginDisabledGroup(maxY == 0);
    scrollY = (uint)GUI.VerticalScrollbar(new Rect(xyPos, new Vector2(slHeight, normalizedSize)), scrollY, 1, maxY + 1, 0, GUI.skin.verticalScrollbar);
    EditorGUI.EndDisabledGroup();
    ...
}

But these scrollbars have a sensitivity of 10 (pressing the up/down, or left/right, buttons will change the current value by 10 in the respective direction). I need them to have a sensitivity of 1. How can I do it?

sentences:
game multiplayer service development I'm currently working on a multiplayer game. I've looked at a number of multiplayer services(player.io, playphone, gamespy, and others) but nothing really hits the mark. They are missing features, lack platform support or cost too much. What I'm looking for is a simple poor man's version of steam or xbox live. Not the game marketplace side of those two but the multiplayer services.

User accounts, profiles, presence info, friends, game stats, invites, on/offline messaging. Basically I'm looking for a unified multiplayer platform for all my games across devices.

Since I can't find what I'm planning to roll my own piece by piece. I plan to save on server resources by making most of the communication p2p. Things like game data and voice chat can be handled between peers and the server keeps track of user presence and only send updates when needed or requested. I know this runs the risk of cheating but that isn't a concern right now. I plan to run this on a Amazon ec2 micro server for development then move to a small to large instance when finished.

I figure user accounts would be the simplest to start with. Users can create accounts online or using in game dialog, login/out, change profile info. The user can access this info online or in game. I will need user authentication and secure communication between server and client. I figure all info will be stored in a database but I dont know how it can be stored securely and accessed from webserver and game services.

I would appreciate and links to tutorials, info or advice anyone could provide to get me started. Any programming language is fine but I plan to use c# on the server and c/c++ on devices. I would like to get started right away but I'm in no hurry to get it finished just yet. If you know of a service that already fits my requirements please let me know.

sentences:
Cocos2dx launcher - how do I set a newer engine version? Why doesn't Cocos(V3.10) detect my newer engine version (3.14) which I downloaded and placed into the engine folder? ( I mean the launcher, the all-in-one version where you can create your project much easier)

thanks in advance!

sentences:
Android Game Slows Down I had been developing a Maze Game which is dragging a bitmap down on the maze going on the finish line. on first my game response quickly on my onTouch and dragging and after couples of
adding toast message, generate random mazes, changing character from drawCircle into a bitmap and a background from a solid color into a customize PNG file my game seems to Slows Down.

Can anyone explain why could this happen?

And what should I do to make my game to response more quickly?

Tnx for the help and godbless.

UPDATE: I found out that it all started when i change my solid color background to a bitmap background.

here's my code:

From this:

protected void onDraw(Canvas canvas)
canvas.drawRect(0, 0, width, height, background);

To this:

protected void onDraw(Canvas canvas) {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.menu_bg);
//Set Rectangle Size and Coordinates
RectF rect = new RectF(0,0,width,height);
//Maze with Background
canvas.drawBitmap(bitmap, null, rect, null);

sentences:
Split a region into arrays based on point region I have an array of points forming a grid. I want to split this array into multiple arrays that each contain a region of point. Let's say each point as a value like on this image

The points having the same value and being connected would go into the same array. If it was only an array of all the 8 or all the 7, it wou;d be easy, but in thsi case I need the arrays to contain connected equal values. For example, the purple region of 1 would make an array, the 8 region on the left would make an array and the one on the right too, but a different one.
I just don't know how to use a loop to navigate in the grid and affect each point to an array based on they relation with other points of the same value. As this is the objective, think of the values as biome that I want to assign to an array.

sentences:
Helmet Mounted Display Math I'm trying to create a helmet mounted display as a mod for a flight simulator. Unfortunately, I've been trying to figure out the math for this, but, to be honest, I'm stuck. I've done my best to look up the math related to this, but this kind of math really isn't my thing, so I figured I'd ask here to see if anyone can provide some help.
The information I have access to is as follows:

The pilot's position
The pilot's head's rotation
The location of the "thing" I'm trying to put a box on the HMD over top of

The HMD itself is drawn in screenspace as normalized 2D coordinates starting from the bottom left corner.
From what I can find, I can treat the pilot's head like a camera in a scene, and the thing I'm trying to track as an object in that scene, which means I'd need to use a view matrix, followed by a projection matrix, which would get me all the way there aside from translating that to the screenspace coordinates; at least that's what I can determine, but as there's no real way to debug problems aside from guessing and trying to fix them, I'd really appreciate having someone confirm/deny that route and correct any misinformation.

sentences: How do you make use of all texture units on today's graphics cards? I saw a review of the GeForce GTX 460 graphics card.  It has 56 texture units.  I'm not that knowledgeable about graphics effects.  But, the ones I know use around 3 or 4 texture units.  In this graphics card case, that would leave a lot of texture units idle.  How are these graphics cards with so many texture units used?

sentences:
Why was my Facebook game rejected with the note that "your app icon must not overlap with content in your cover image?" My FB game just recently got rejected for two reasons. The first I fixed, but I just can't see to figure out what they mean by the second, and I was hoping someone else got the same issue and did know what they meant.

The remaining error is:

  Cover Image

  Your app icon must not overlap with content in your cover image.  Click on 'Web Preview' in the 'App Details' section to check for overlap prior to submitting your app.  See more here.

All I know is that the rejection has something to do with the cover image, not the icons or the screenshots.

The web preview of my game looks like this now:

Please let me know what to do to get approved.

sentences:
Unity Graphics.DrawMesh lags behind rotation? I have a setup in unity using Graphics.DrawMesh() to draw a mesh on my players camera location in the update loop, Graphics.DrawMesh(viewModel, matrix, material, layer, null, 0);
matrix = Matrix4x4.TRS(cam.transform.position, cam.transform.rotation, scaleFps);
when I use my mouse to move around the camera, it lags behind where the camera is, as can be seen in the video. I have no idea how to fix this. I've tried not using the matrix, and it doesn't change anything.

https://youtu.be/eWFFYcOX_4Q

Here's the script I use for moving the camera:

    //Get the current mouse input.
    yaw += Input.GetAxis("Mouse X") * mouseSensitivity;
    pitch -= Input.GetAxis("Mouse Y") * mouseSensitivity;

    //Clamp the camera rotation.
    pitch = Mathf.Clamp(pitch, -maxLookAngle, maxLookAngle);

    //Calculate and rotate the camera.
    currentRotation = Vector3.SmoothDamp(currentRotation, new Vector3(pitch, yaw), ref rotationSmoothVelocity, mouseSmoothScale);

    //Rotating the player.
    Vector3 bodyRotation = new Vector3(0, currentRotation.y, 0);
    transform.localEulerAngles = bodyRotation;

    //Rotating the camera.
    Vector3 cameraRotation = new Vector3(currentRotation.x, 0, currentRotation.z);
    playerCamera.transform.localEulerAngles = cameraRotation;'

sentences:
How to make it two seconds for Time.time? var targetscript : Diamond;
var red : Color;
var orange : Color;

function Start () {
    gameObject.camera.backgroundColor = red;
}

function Update () {
    if (targetscript.score > 4) {
        gameObject.camera.backgroundColor = Color.Lerp(red, orange, Time.time);
    }
}

So right now, if the score is larger than 4 then it would change the camera background color to orange with lerp. But its too quick. I read on the internet that Time.time is 1 second. What is the alternative way but for 2 or 3 seconds? I tried this : http://answers.unity3d.com/questions/328891/controlling-duration-of-colorlerp-in-seconds.html
I tried the code for the voted answer but it didn't work. It still lerps through quickly. Does anyone have any ideas? Thanks

sentences:
How should you structure your graphics system around your logic system? C++ & Cocos2d-x, but I think the issue is language-independent.

I just recently finished up writing the foundational logic for my game. The way I've decided to keep my logic and my graphics decoupled is by simply having two base objects: LogicBody and GraphicsBody. Any object that needs to show up in the game needs to be comprised of both. So far, so good.

However, I am struggling with the initialization and interaction framework. I'll explain:

1) How should I make sure the logic body and graphics body stay together (in hopes of maintaining code readability).

Should they? Take the case of object Monster. It will need a logic body and a graphics body. But should both of these be contained in one overarching Monster class? Won't accessing either internal structure become unnecessarily verbose (i.e. Monster->getGraphicsBody() every time). However, this makes initialization easy:

Monster::init();

Alternatively, it is possible to initialize both logic and graphics separately:

Logic::init(); Graphics::init();

How can I then keep them abreast/aware of each other though? This will create clutter too, as I will likely need to call setters on each at initialization to make sure they reference each other:

Logic::setGraphicPtr(); Graphics::setLogicPtr();

2) What is the appropriate way to change graphics: polling, logic-driven, or both?

In the simplest of cases, updating graphics is as easy as polling direction, isMoving, health, etc. However, let's say that I want to play a particular animation when the Monster gets hit. The easiest way seems to be to call the "getHitAnimation" of the graphics body from within the logic body at the time of being hit. The alternative is to poll, but it seems that a certain point you will be polling twenty different variables, which has the potential to make the graphics implementation indecipherable without reference to the logic class anyways.

3) Should a logic body have reference to its graphics body at all?

I understand how clean it would be to simply have the graphics body reference the logic body for rendering purposes, in which case the logic body has no business with the graphics body. But what about the case where logic body A has met logic body B, and graphics bodies A and B need to interact. How do I let graphics bodies A and B know where to look for another?

I want to know the best way to implement these parallel systems with the least amount of coupling. Pseudo code welcomed.

sentences:
using Mathf.Clamp in Vector3 to restrict object drag I'm making a checkers game and I've got a movement controller working to move the pieces. I want to restrict the drag to be within the board. The center of the board is 0,0 so the far left side's x value is -4, top of the boards y is 4, etc...

This is my drag script so far

void OnMouseDrag()
{
        float distance_to_screen = Camera.main.WorldToScreenPoint(gameObject.transform.position).z;
        transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, distance_to_screen));
}

but when I try to clamp my new Vector3's x and y between -4 and 4 like this,

transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Mathf.Clamp(Input.mousePosition.x,-4f,4f), Mathf.Clamp(Input.mousePosition.y,-4f,4f), distance_to_screen));

it shoots the pieces way off camera. This may be because don't truly understand Camera.main.ScreenToWorldPoint, is it returning different x,y coordinates than the global ones?

sentences:
Should I use SAX or DOM to parse Game dialogue/text events in XML? I'm planning to put all my text dialogue/events in an XML file and then use either SAX or DOM parser in Java to retrieve the correct text.

I'm intending for there to be A LOT of text in this game, so which parser would make more sense to use?

I know SAX has to go through the whole document and I need the text to be retrieved more or less immediately while a DOM parser needs to store the DOM in memory and, as I said, I'm going to have a lot of text in it, plus the rest of the game requires memory too.

I'm developing for PC. Which parser would generally make more sense to use?

sentences:
Issues with importing bezier curve animation (curve does not distort?) 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!

sentences:
Efficiently rendering tiled map on OS X I'm writing an original (top-down) SimCity clone in Swift and attempting to use SpriteKit as the basis for the game. However, I am running into performance issues when rendering and animating the tile map which represents the city map.

I'm rendering a 44x44 tile map with each tile being 16x16 pixels. Tile animation could happen on any arbitrary tile and is implemented by having a separate image for each frame of the animation. The map is dynamic (naturally) since the player will draw on it and tiles can be animated (roads, etc). I have tried several implementations to render the map the screen and each has had its own performance issues.

What I've tried:

Each tile is an SKSpriteNode with its texture loaded from a texture atlas. Textures were swapped for tiles that were dirty (needed redraw). I disabled physics simulations and physics bodies on the nodes.

Pros:

Minimal draws (due to the Texture atlas)
Code wasn't very complex

Cons:

Redrawing the entire map destroyed performance
Swapping textures to animate was inefficient

Map was rendered using NSView, drawRect, etc.

Pros:

Drawing was relatively efficient
Dirty rectangle drawing was easy to implement

Cons

Not really suitable for animation (really bad performance)

My question is: What is the most efficient way of rendering/animating my tile map? Is there an optimization I can make to SpriteKit to speed this up? Or do I need to use something lower level (OpenGL/GLSL) to draw/animate the map efficiently?

Any help would be greatly appreciated!

sentences:
How to split a 2D sprite tile set into individual sprites? I see a lot of sprite catalogs for games provided as single PNG image, like the one below.

I'm interested if I have to manually create tiles from that, or if there's some program that can split it into various tile combinations for me? For example, given the tile combination below, I will have to create a flat grass surface, and 8 other combinations with various edges. Is there something that can automate this task?

sentences:
Scrolling 2D sprites on a map with a camera I'm working on a 2D sprite-based strategy-type game (ok, full disclosure: it's a tower defense game), and I'm having a problem getting the actors to behave correctly when I move the camera.

I've got a Camera class, which contains data and methods for moving the camera and exposing its' current position. When I draw the background, I offset the background thusly (and it works great):

var backPos = new Vector2(background_bounds.X - camera.CameraPositionX,
                          background_bounds.Y - camera.CameraPositionY);
spriteBatch.Draw(background_texture, backPos, Color.White);

My sprites each have a GraphicsComponent that directs the rendering. I've been playing around with different combinations, but none seems to give the proper (expected behavior); I lose collision detection (done via my CollisionComponent object), or the physics misbehave, etc, because actor's position is different than what the other components expected. Here's the GraphicsComponent.Draw(...Camera camera):

 //...snip
 var adjustedPosition = new Vector2(actor.Position.X - drawOffsetX,
                                    actor.Position.Y - drawOffsetY);
 //Uncommenting this line doesn't work either - just makes things seem worse
 //actor.Position = adjustedPosition;
 DrawContext.Draw(actor.Texture, adjustedPosition,
                  actor.SpriteBounds, DrawColor);

How do you folks approach applying camera offsets to sprites in a way that avoids exposing the camera to every component? Do you offset the actual position by the camera's position, or do you simply render the position with the offset, and compensate elsewhere?

sentences:
I've completed my mobile game - now what? After months of development, I've finally finished my mobile app, but I have no idea what to do next. I want to publish my app to the Google Play Store and the App Store, yet I don't know how. I've done tons of research and every single website shows different methods and requirements. I've seen that I'm supposed to have some kind of license, a specific certificate, and all these other connections that I'm really confused on how I'm supposed to get them, and where to even start. I've gotten as far as getting Apple Developer and Google Developer, but that's basically it. I just want a simple step-to-step guide. I've already looked on StackExchange for an answer, but all have slightly different questions, such as marketing the app and updating the app, but nothing on how to get it out there.

I'm using Unity as an engine and X-Code via my Mac to test my app on my iPhone.

I appreciate any help in advance. Thank you!

sentences:
What are common methods for organizing game objects? I'm in the early stages of developing a game in C++.

As of currently, I've defined a base GameObject class that is the base class for any interactive item in my map (e.g. enemies, loot, projectiles, etc.). When these items are created, I want to give them to an ObjectManager class. The ObjectManager class is responsible for iterating over each object and calling abstract methods like "update" or "render".

Originally, I planned on storing all objects (or references to the objects) in a single container. I would then iterate over this container.

However, I'm starting to have second thoughts about whether or not this is a good idea. I've come up with two reasons why this might be a bad idea:

1.) Regarding object collision, it makes sense to only perform calculations between certain objects on whether or not they've collided. For example, I would want to determine if the main character has collided with a loot item. However, I would never to want to calculate if a loot item has collided with another loot item (at least in my case).

2.) Object pools. Referencing this article, it has come to my attention that continuously allocating/de-allocating memory is expensive. Because of this, it is a common technique to use object pools that request memory upfront and then manage that memory without actually deleting it. One of the comments made in the article is that the objects that exist within the pool must all be the same size (or each pool slot must be big enough to accommodate the largest object).

Both of these examples make me think having a single container that houses all GameObject is a bad idea.

Instead, it seems like it would make more sense to have different containers for each type GameObject type. For example, it would make sense to have a container for enemies, loot, projectiles, etc. This way I would have more control in iterating/comparing only on objects that make sense for certain object types (e.g. don't try to calculate collisions between two loot items).

The problem I'm facing however is that I don't know how to break up these containers. Should all projectiles go in a single container? However, what if I later decide to create a "fire projectile" that performs some kind of "burn" logic. Would this require a new container to then to iterate over all fire projectiles? Essentially, I don't know how granular my containers should be.

I haven't come across any reference material on this topic. Any advice would be appreciated.

sentences:
Sudoku generation doesn't finish Heyho,

i got problems with my sudoku generator. First of all I generate some numbers between 1 and 9 and put them (according to the sudoku rules) into my game. After that I solve it using my second algorithm, but there's a problem with. It stops solving in the middle of the sudoku and says that there isn't a single solution for it, even if this sudoku has around 200 solutions.

private void generateSudoku()
{
//iSeed für den Random-Generator
iSeed = seeder.Next();
rnd = new Random(iSeed);

for(int i = 0; i < FIELDSIZE; i++)
{
    iContent[i] = 0;
    bEditable[i] = true;
}

switch(iDifficulty)
{
    case 0:  iNumbers = rnd.Next(30, 35);
        break;
    case 1:  iNumbers = rnd.Next(24, 29);
        break;
    case 2:  iNumbers = rnd.Next(18, 23);
        break;
    default: iNumbers = rnd.Next(24, 29);
        break;
}

for(int i = 0; i <= iNumbers; i++)
{
    int iValue = rnd.Next(1, 10);
    int iRow = rnd.Next(0, ROWSIZE);
    int iCol = rnd.Next(0, ROWSIZE);

    if(check(iRow, iCol, iValue) == 0)
    {
        iIndex = (ROWSIZE*iRow+iCol);
        iContent[iIndex] = iValue;
        bEditable[iIndex] = false;
    }else
    {
        i--;
    }
}

iSolutionCounter = 0;
solveSudoku(0);

Console.WriteLine("Solutions: " + iSolutionCounter);

if(iSolutionCounter != 1)
{
    //generateSudoku();
    //return;
}

for(int i = 0; i < FIELDSIZE; i++)
{
    if(bEditable[i] == true)
    {
        iSolution[i] = iContent[i];
        //iContent[i] = 0;
    }else
    {
        iSolution[i] = iContent[i];
    }
}

}

FIELDSIZE = 81;    The number of fields in complete sudoku (9x9)
ROWSIZE = 9;       The number of fields in a single row or column (9)
iNumbers           The amount of random generated startnumbers

And the solveSudoku(), which should solve the sudoku and sum up all solutions (but fails)

private bool solveSudoku(int iPos)
{
    int iCol = (iPos % ROWSIZE);
    int iRow = (int)(iPos / ROWSIZE);

    if(iPos >= FIELDSIZE)
    {
        iSolutionCounter++;
        return false;
    }

    if(iContent[iPos] >= 1)
    {
        return solveSudoku(iPos + 1);
    }
    for(int i = 1; i <= ROWSIZE; i++)
    {
        if(check(iRow, iCol, i) == 0)
        {
            iContent[iPos] = i;
            if(solveSudoku(iPos + 1))
            {
                return true;
            }
        }
    }

    return false;
}

That's what I mean (grey numbers are the ones, which are available at start, so you (or my algorithm) can't edit them:

sentences:
How to generate .sln files manually in Unity I'm using git with a Unity project of mine. I'm working on my home machine and also on one at school.
I started it at home and it works perfectly on my machine.
Once I cloned it at school it opened fine and everything still worked. Only problem was VS did not generate a project. At home I have 2019 and school has 2017.

If I generate a new Unity Project at school it has the .sln and I can open it using Assets -> Open C# Project. There is no such project generated when opening the cloned project.
I need get around this as it's near impossible for me to code efficiently at school.
Because it is an EDU machine I have very limited access to certain things. Can I create a project by hand or run a command to generate one?

sentences:
How to model irregular boundary of a 2D map in Game? I am creating a map in a game, the map contains different countries, my question:

Q. How to model the irregular boundary of each countries? How to do quick country searching if I click on the map (given x,y values)?

sentences:
A canvas to let through a given layer I have two canvases, both of them having a UI element on them.
At some point, both canvases will be active in the game (I just act like so, I want to make sure that my game works even if that's the case) and I want one of them to never block the other canvas's layer.

These two, let's say Canvas1 is on layer UI and is responsible for character jumping.
Canvas2 is on layer toggle time scale and it's job is to switch between timescale 0 and 1.
I want Canvas2 to be ALWAYS accessible, so its layer, toggle time scale is NOT blocked by the first canvas.
I tried messing around with the Blocking Mask but that didn't help, sometimes the ray still gets blocked out. How to set up those Blocking Masks for my canvases to work?

sentences:
Detecting collision with walls (is this a good solution?) I'm trying to make the collision smooth (it must open the animation, but not move the character).

I've implemented 'fake positions':

int step = 20;
fake_left_x = x-step;
fake_right_x = x+step;
fake_up_y = y+step;
fake_down_y = y-step;

While updating player position, I'm checking if fake positions are out of the screen. If yes - nothing happens.

Is this a good solution? What do you think?

sentences:
How do I move my character using accelometer (android)? I created a class for accelerometer, and there are no errors, my game does not crash when I run it, but my character does not move when I tilt my phone. I have been trying to figure out how to use the accelerometer for some days now, but every tutorial uses it in an activity, and there is no activity in my application.

Here is the code:

package com.saladchef.bananasplit;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;

public class MyAccelerometerClass implements SensorEventListener {
private SensorManager sensorManager;

public float x, y, z;

public MyAccelerometerClass(Context context) {
    sensorManager = (SensorManager) context
            .getSystemService(Context.SENSOR_SERVICE);
}

@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
    // TODO Auto-generated method stub

}

@Override
public void onSensorChanged(SensorEvent event) {
    x = event.values[0];
    y = event.values[1];
    z = event.values[2];

    if (y == 0.0){
        Banana.stop();
    }
    if(y >= 1.5){
        Banana.moveRight();
    }

    if (y <= -1.5){
        Banana.moveLeft();
    }

}

public SensorManager getSensorManager() {
    return sensorManager;
}

public void setSensorManager(SensorManager sensorManager) {
    this.sensorManager = sensorManager;
}

public float getX() {
    return x;
}

public void setX(float x) {
    this.x = x;
}

public float getY() {
    return y;
}

public void setY(float y) {
    this.y = y;
}

public float getZ() {
    return z;
}

public void setZ(float z) {
    this.z = z;
}

// codes

}

sentences:
Monogame fails to load Effect I'm currently porting an old XNA game over to MonoGame and everything (including custom shaders) build fine.

However when i try to load the xnb file using content.Load<Effect>("BaseDraw");
I receive the following error:

An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll

Additional information: HRESULT: [0x80070057], Module: [General],
    ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

I even tried building the shaders with 2MGFX.exe and loading it manually but that throws the same error.

I have no idea what to so any help would be appreciated!

sentences:
Isometric drawing "Not Tile Stuff" on isometric map? So I got my isometric renderer working, it can draw diamond or jagged maps...Then I want to move on...How do I draw characters/objects on it in a optimal way?

What Im doing now, as one can imagine, is traversing my grid(map) and drawing the tiles in a order so alpha blending works correctly.

So, anything I draw in this map must be drawed at the same time the map is being drawn, with sucks a lot, screws your very modular map drawer, because now everything on the game (but the HUD) must be included on the drawer..

I was thinking whats the best approach to do this, comparing the position of all objects(not tile stuff) on the grid against the current tile being draw seems stupid, would it be better to add an id ON the grid(map)? this also seems terrible, because objects can move freely, not per tile steps (it can occupies 2 tiles if its between them, etc.)

Dont know if matters, but my grid is 3D, so its not a plane with objects poping out, its a bunch of pilled cubes.

sentences:
Rotate/Translate object in local space I am just trying to create a movementcontroller class for game entities. These class should  transform the entity affected by the mouse and keyboard input. I am able to calculate the changed rotation and the new globalPosition. Then I multiply:

 newGlobalMatrix = changedRotationMatrix * oldGlobalMatrix;
 newGlobalMatrix = MatrixSetPosition(newPosition);

The problem is that the object rotates around the global axis and not around the local axis.

I use XNAMath for the matrix calculation.

sentences:
Should I use Box2D for collision-detection only (not simulating physics)? I'm using Box2D only to check collisions and for no physical simulation. I create bodies (and shapes for them) and use my own code to move them, by setting their velocities and positions every frame. I only fetch collision data from the Box2D world.

Is this a good idea? For example, can it cause undefined behaviour from Box2D? Is there a more performance friendly way of dealing with different shape collision detections?

Do better methods exist for this?

sentences:
Detecting collision between a sprite and many tiles I have been looking at the following question:- Tile coordinates and am thinking of using this for collision detection in my tile game.

The set up in my game is similar to this, in that there is a grid of tiles, and the sprite will move to (x,y) coordinates. However, if I were to have an object such as a box in my world that is made from multiple tiles, how would I get the collision detection to work?

Any ideas welcome.

sentences:
Access Single-Pass RenderTexture I'm trying to achieve a mirror effect where a second camera renders to a render texture, which is then passed into a shader using SetGlobalTexture.

Everything works fine outside of VR, but in Steam VR it seems like the render texture only stores the texture for one eye (left), even with single-pass stereo enabled in player settings.

How can I access the texture for the second eye? Or rather, how can I access the texture where both eyes have been drawn, one on each half of the screen?

What I'm doing at the moment:

void Awake()
{
    mirrorCameraRenderTexture = new RenderTexture(vrCam.pixelWidth, vrCam.pixelHeight, 24);
    mirrorCamera.targetTexture = mirrorCameraRenderTexture;

    Shader.SetGlobalTexture("_MirrorCameraRenderTexture", mirrorCameraRenderTexture);
}

sentences:
What does the term "channel" mean when used in regards to computer graphics? I was studying terminology for computer graphics, and this statement came up that confused me.

  The image can have alpha channels for transparency.

I tried searching for the meaning of the term "alpha channel," but I got really confused by the definition which used another concept called a "channel." I'm not really sure what this means, so could someone be kind enough to please explain this term to me?

sentences:
Is creating a separate thread for each game session a bad idea? I'm currently working on iocp game server. My game is just like diablo3 basically. 1~4 players join a separate session.

I did basic iocp preparations and now I'm working on game session class. The reason why I'm stuck right now is that I'm not sure if I should create a separate thread for each game session. This concept is the first idea that I came up with but I can't come up with other ideas to avoid creating so many threads for sessions when there are so many game sessions.

So here's my question.

Should I create a separate game logic loop(thread) for each game session? Because that sounds so inefficient when it comes to the situation where only one player joins each session.
If there are some other ways to design the server, please let me know what I should look for to study.

Thanks for your help in advance and sorry for my bad English.

sentences:
How can I play user-provided music stored on the phone inside my game? I am creating a car game. Is any way to play the music stored on the phone inside the game? I'd like the player to choose files that are already on their device and hear them played in the game.

For example, in GTA Vice City game there was a folder named Music, and if we placed songs in there they would play on the car radio while we're driving around inside the game. If we want to switch the songs around, we can do so. how can I do the same in Android and iOS?

I am using unity 5.2, C#.

sentences:
How to make and correctly use progress bar in cocos2d-iphone? I have a game that uses a progress bar to inform player of level of certain stats of the player. For example hunger, when it starts at zero and slowly adds up to maximum bar. When he eats the hunger reduces.

I tried implementing as progressBar, but it works wrong, as the bar expands both ways, and I need it to grow one side only. Also I had hard time setting the bar, since it uses actions.

Is there an easy way to do it?

sentences:
Mathf.Hermite not available in Mathf I see here that Hermite should be function in the class Mathf.

However, when I try to use it, the compiler tells me that Mathf doesn't contain a definition for Hermite.

This is an example:

    float fNewDistance = Mathf.Hermite(_initialDistance, _GoalDistance, fTime);

What am I doing wrong here?

Thank you!

sentences:
Unity: Implementing Fall with Animation I have a character controller.  I am primarily using FSM with the animations and blends.  However, I am running into some trouble with the fall.

I walk up to a ledge and walk off...sometimes I will make it off the edge and the falling animation will play...but sometimes I get stuck halfway off the edge.

Also, the falling animation completely disregards any motion vectors I had prior to transferring to the falling state.

Is there a way to transition to fall, retaining the current x-y velocities?

In an effort to fix this, I tried giving the attached rigidbody a force vector slightly up and in the direction of travel so that the character gets a little hop over the edge...but again, no luck.

sentences:
libgdx texture edge blending problem I have two completely white bitmaps here:

They're there, trust me.

When I put one on top of the other and scale them down with TextureFilter.Linear I get this:

How do I get rid of the dark pixels?

sentences:
How do I share a downloadable WebGL build in Unity? When I make a WebGL build for my project, I get a folder that lets me click a .html to play my game in a browser.  Is there a way I can share a folder like this for playtesters?
I tried sending a .zip folder to playtesters, but they only got a Unity loading screen that didn't do anything.

sentences:
AI does not stop walking like it is supposed to, instead spins in place and lags game I've got this very simple enemy AI that follows the player and is supposed to stop and shoot at the player when he enters a trigger, however it doesn't seem to do that it doesn't stop or shoot. This is one of my first scripts so it isn't really good. Any and all help will be appreciated.

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

public class EnemyAI : MonoBehaviour

{
    public GameObject Destination;
    NavMeshAgent agent;
    public Collider TriggerCollider;
    public GameObject Enemy;
    public GameObject bullet;
    public float EjectionForce;
    public float firingrate = 20f;
    private float NextFire = 0f;
    public GameObject GunArea;

    // Start is called before the first frame update
    void Start()
    {
        agent = GetComponent<NavMeshAgent>();
        agent.SetDestination(Destination.transform.position);

    }

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

    }
    void OnTriggerStay(Collider other)
    {
        if (other.transform.tag == "Player" && Time.time >= NextFire)
        {
            agent.isStopped = true;
            AimAndShoot();
            NextFire = Time.time + 1f / firingrate;
        }
        else agent.isStopped = false;
        agent.SetDestination(Destination.transform.position);
    }
    void AimAndShoot()
    {
        Enemy.transform.LookAt(Destination.transform.position);
        GameObject enemybullet = Instantiate(bullet, GunArea.transform.position, GunArea.transform.rotation) as GameObject;
        enemybullet.GetComponent<Rigidbody>().AddForce(enemybullet.transform.forward * EjectionForce);
        Destroy(enemybullet, 1f);
    }
}

sentences:
User Leveling System I've already asked this before, but I just wanna encode this again with a new leveling format. What I want to do is that, the user will gain exp and once they leveled up, their previous experience will be added to their current exp.

So, to put it in a Scenario it goes like this:
User1 is on a Level 1 with an exp_needed of 1000 to reach level 2. He gained an exp of 1000, so he is now on level 2 with a current_exp of 1000 and an exp needed of 1,400. Or if User1 gained an exp of 1,100 he is on level 2 with a current_exp of 1,100 and 1,400 exp needed. And so on, depending on the algorithm. But I get a result of -900/1,400 if the user gains 1,100 exp.

Here is the code below:

while($user->curr_exp >= $user->exp_needed){
       $user->curr_exp -= ($user->exp_needed) + $user->prev_exp;
       $user->prev_exp = $user->exp_needed;
       if($user->level <= 19){
       $user->exp_needed = $user->prev_exp * 1.4;
       }
       elseif($user->level >= 20 && $user->level <= 39){
       $user->exp_needed = $user->prev_exp * 1.1;
       }
       elseif($user->level >= 40 && $user->level <= 59){
       $user->exp_needed = $user->prev_exp * 1.05;
       }
       elseif($user->level >= 60 && $user->level <= 79){
       $user->exp_needed = $user->prev_exp * 1.04;
       }
       elseif($user->level >= 80 && $user->level <= 99){
       $user->exp_needed = $user->prev_exp * 1.03;
       }
       elseif($user->level == 100){
       $user->exp_needed = $user->exp_needed * 0;
       }
       $user->level += 1;
       $user->save();
      }

Any ideas how to deal with this? Thanks.

sentences:
Why does launching an object using Rigidbody2d.velocity not work properly I am currently trying to launch a gameobject using Rigidbody2d.velocity but whenever I launch it goes backward instead of forwards. I have already tried making the vector 3 that I am using negative, but nothing seems to work. Please help as I don't even know why this happening.

Here is my code

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

public class ArmPower : MonoBehaviour {

    //Priority Script

    public ArmAngle armAngle;
    public bool allowLaunch = false;
    public GameObject armPowerSlider;
    public bool ifLaunched;
    public GameObject armPowerPhone;
    public StartAllowStrengthPower startAllow;
    public PhoneController armPhoneController;

    // Use this for initialization
    void Start () {
        armAngle = FindObjectOfType<ArmAngle>();
        armPowerSlider = GameObject.Find("PowerSlider");
        ifLaunched = false;
        armPowerPhone = GameObject.Find("Phone");
        startAllow = FindObjectOfType<StartAllowStrengthPower>();
        armPhoneController = FindObjectOfType<PhoneController>();
    }

    // Update is called once per frame
    void Update () {
        if (allowLaunch)
        {
            LaunchPhone( (int) (Mathf.Round(armPowerSlider.GetComponent<Slider>().value) ));
            ifLaunched = false;
        }
        if(startAllow.allowLaunchChanger <= 0)
        {
            LaunchPhone((int)(Mathf.Round(armPowerSlider.GetComponent<Slider>().value)));
        }

    }

    public void LaunchPhone(int launchAmount)
    {

        Vector3 launchValue = new Vector3(armPowerPhone.transform.position.x, launchAmount, armPowerPhone.transform.position.z);

        armPowerPhone.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;

        armPowerPhone.GetComponent<Rigidbody2D>().velocity = launchValue;

        armPhoneController.armAudio.Play();

        armPowerPhone.transform.SetParent(null);
        armAngle.allowStrength = false;
        allowLaunch = false;
        ifLaunched = true;
        startAllow.allowLaunchChanger = 5;

    }
}

sentences:
Showing "Please buy" screen to pirates I recently saw this and this, and that got me thinking

When publishing a commercial game without DRM, would it be a good idea to upload a slightly modified copy of the game that shows a screen like this at startup to, say, The Pirate Bay:

  Hello pirate! Looks like you downloaded this game from The Pirate Bay! That's okay, but:
  Making a game costs time and money. If you like the game, please buy it so we can continue to update this game with new content! You buy it for only $xx.xx at www.example.com!

  In the meantime: Have fun!

  Press Enter to continue

And then continues to the title screen and from there is identical to a legal copy.

The point is that it will probably (very, very, VERY high chance that it will) be uploaded sooner or later anyway, so this may decrease the harm.

Would that be a good idea?

sentences:
Market as a single game or as a studio? I'm creating an RPG with a theme of a hero that must restore peace to a world fallen to evil forces. It serves as an educational tool.

I'm creating a promotional website for it and using other online social tools for marketing.

I only have one focus: to make this game as great as possible for people to learn. I've seen some companies that market themselves as their product name, like DuoLingo, and some that market as the studio, such as Strawberry Games.

I don't have a game studio and have simply been marketing (FB page, website URL, etc) as the game's name, Lexicana's Destiny.

Does it really matter which way I market it? If so, why?

sentences:
TexturePacker ignores extensions I'm using TexturePacker in one of my games, though when packing a bunch of textures their extension is kept in the data file. So when I want to find a texture I need to search for "image.png" instead of just "image". Is there an option to let texture packer ignore the extensions of my source images in the data file?

Solved:

So if anyone else wants this, here's the exported I made: https://www.box.com/s/bf12q1i1yc9jr2c5yehd Just extract it into "C:\Program Files (x86)\CodeAndWeb\TexturePacker\bin\exporters\UIToolkit No Extensions" (or something similar) and it should show op as an exporter.

sentences:
Simple 2D Fish Obstacle Avoidance I am currently working on a simple obstacle avoidance system in unity. I have a player and a school of Ai fish that are traveling in a fixed direction (Down-Right). While swimming, I want the Ai fish to keep away from the player, and also keep away from incoming obstacles. I first thought I should use a boid flocking algorithm, but it may be overkill for what I need as I am trying to limit computation to as low as possible since it will need to run on a mobile device. the fish do not need to avoid each other and they simply need to head toward the fixed direction. Other notes: I can't use unity's NavMesh system since I am using 2d physics and obstacles will be random at runtime.

My issue is that I do not know how to efficiently steer the AI when there are multiple obstacles and players in the proximity. I have something working(Below), but I am manually steering it when it gets too close but this won't work when I have multiple obstacles to avoid within their proximity. Could someone steer (ha) me in the right direction on how to approach this?

Thank You

Below is the class I made for the Ai fish:

public class FishMoveTest : MonoBehaviour {
public float Speed;
Rigidbody2D rb;
public float MinSpeed;
public float MaxSpeed;
public float DisableDistance;
private float DistanceFromPlayer;
public GameObject Player;
 Material NormalMat;
public Material CollideMat;
 MeshRenderer MeshRend;
public UnderwaterObstacle _UnderwaterObstacle;
public float AvoidDistance;
public float SteerSpeed;
float DistanceFromObstacle;
// Use this for initialization
void Awake () {
    MeshRend =  GetComponent<MeshRenderer> ();
    NormalMat = MeshRend.material;
    rb = GetComponent<Rigidbody2D> ();
    Speed = Random.Range (MinSpeed, MaxSpeed);
}

// Update is called once per frame
void FixedUpdate () {
    DistanceFromObstacle = Vector3.Distance(transform.position, _UnderwaterObstacle.Obstacle.position);
    if (DistanceFromObstacle < AvoidDistance) {
        CastObstacleRay ();
        if (MeshRend.material != CollideMat) {
            MeshRend.material = CollideMat;
        }
        if (transform.position.y > _UnderwaterObstacle.Obstacle.position.y) {
            //Move Up-Right;
            rb.velocity = Vector3.Lerp(rb.velocity,new Vector3 (0.5f, 0.5f, 0) * Speed,SteerSpeed);

        } else {
            //Move Down
            rb.velocity = Vector3.Lerp(rb.velocity,new Vector3 (0, -1, 0) * Speed,SteerSpeed);
        }
    } else {

        rb.velocity = Vector3.Lerp(rb.velocity,new Vector3 (0.5f, -0.5f, 0) * Speed,SteerSpeed);
        if (MeshRend.material != NormalMat) {
            MeshRend.material = NormalMat;
        }
    }
}

sentences:
How Can I Make These Collisions Work Outside Of Unity's Built-In? (C#) I'm having some trouble working out what's wrong with my code. Basically I want to have my player be able to collide with obstacles it's flying through.

So I have an obstacle, and a pathway or two for the player to go through, if they don't make it into the pathway and hit the obstacle, they'll die, but if they do make it in, I need the floor and roof of the path to stop my player from going through it.

Here is what I've got so far (sorry for the copious amounts of code, I've tried to compress it down to the bare essentials for you but it's still a lot):

void OnTriggerEnter2D(Collider2D obstacles) {

    if (obstacles.gameObject.tag == "Obstacles") {
        playerInObstacle = true;
    }

    if (obstacles.gameObject.tag == "Path") {
        playerInPath = true;
        path = obstacles;
    }
}

void OnTriggerExit2D(Collider2D obstacles) {

    if (obstacles.gameObject.tag == "Obstacles") {
        playerInObstacle = false;
    }
    if (obstacles.gameObject.tag == "Path") {
        playerInPath = false;
    }
}

void Update() {

    playerY = transform.position.y;

    if (playerY > Y_Max) {
        aboveClouds = true;
    } else {
        aboveClouds = false;
        hasJumped = false;
    }

    if (aboveClouds == false) {

        if (Input.GetKey (KeyCode.UpArrow)) {

            ySpeed += horizontalSpeed * Time.deltaTime;
        }
    }

    //a bunch of other movement stuff is actually in this section, if you need that, let me know and I'll post it.

    if (timer >= jumpTime) {
        hasJumped = true;
        timer = 0;
    }

    if (aboveClouds == false) {
        hasJumped = false;
    }

    if (ySpeed > ySpeedLimit) {
        ySpeed = ySpeedLimit;
    } else if (ySpeed < -ySpeedLimit) {
        ySpeed = -ySpeedLimit;
    }

    transform.position += Vector3.up * ySpeed * Time.deltaTime;

    //floor collisions (this one works)

    if (playerY < Y_Min) {
        floorOn = true;
        ySpeed = noSpeed;
    } else {
        floorOn = false;
    }

    //path & obstacles collisions (this one doesn't work)

    if (playerInObstacle == true) {

        if (playerInPath == true) {

            if (playerY > path.bounds.max.y) {
                ySpeed = noSpeed;
            } else if (playerY < path.bounds.min.y) {
                ySpeed = noSpeed;
            }
        }
    }

    playerY = transform.position.y;

}

Also, I originally tried having the onTriggerEnter2D's as separate entities for both the obstacles tag and the path tag, but apparently you can't do that, so maybe I'm doing this part wrong too..

All help is greatly appreciated, thank you!

sentences:
How do you start development of a game? When you start a new game project, what do you do first? How do you begin? What gives you the best head start toward completing the project rather than burning out before it gets anywhere?

Mods please help with the tags... I have no clue how to categorize this... :)

sentences:
What is the purpose of integration in physics engines? All online resources seem to assume that you know what this means and/or state that this is related to object movement in some way.

How does this differ than just position.x++ and position.y++ and how does integration allow us to simulate movement? (calculus integration?)

I understand there are a few different methods, namely Euler explicit, RK4, and Verlet. These methods I read are meant to solve ODE's, what are we solving for when we solve these equations?

sentences:
Deserialize inherited classes into the same list in XNA I am writing a Gui for a game (for what else ...).
Therefor I wrote a class GuiElement which has some serializeable fields. From this class I deflect a Class "Button" which has one serializeable field more.
Furthermore, I have a Class GuiWindow, which is as well deflected from "GuiElement".
An Object of this Class has a Field "HandledElements" of the type "List". To know the layout of the Menues, I use XML-Files, which look like that (for example):

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent xmlns:Generic="System.Collections.Generic">
 <Asset Type="System.Collections.Generic.List[GUI.GuiWindow]">
  <Item>
   <Position>0 0</Position>
   <AlternativeImagePath></AlternativeImagePath>
   <IsActive>true</IsActive>
   <Name>MainMenu</Name>
   <HandledElements>
    <Item>
      <Position>100 100</Position>
      <AlternativeImagePath></AlternativeImagePath>
      <IsActive>true</IsActive>
      <Name>Optionen</Name>
      <Caption>Optionen</Caption>
    </Item>
   </HandledElements>
 </Item>

  <Item>
   <Position>0 0</Position>
   <AlternativeImagePath></AlternativeImagePath>
   <IsActive>false</IsActive>
   <Name>Options</Name>
   <HandledElements>
   </HandledElements>
  </Item>
 </Asset>
</XnaContent>

As you can see, the first window has in its "HandledElements" List an Item with the Field . This is a field which only a Button has. The Problem is now: I can't deserialize this XML file, because GuiElement does not have this Field, it only has the few fields above.
I thought it would know automatically which Class to use,but it doesn't.
Do I really have to give my windows a list for each child class of GuiElement?
Or can I do another workaround?

sentences:
Using Smartphone as a steering wheel on Linux I am making a car simulation game, however, I find it being inefficient and difficult to test the simulation realism and accuracy via keyboard or even joystick control. I need a steering wheel controller to do this. However, getting good steering wheel controllers is so difficult - they cost a lot. However, I noticed(when playing Real Racing 3) that the phone actually can handle such task kinda well.

What sort of code could I write to use a smart phone as a steering wheel?

Looking forward to see some useful answers ;)

sentences:
Use an object's x position to seek within an animation I have an animation clip I want to play, using the object's x position to control which frame of the animation is displayed. ie.

When the object is at x = -2, the animation should show its initial frame.
As the object moves rightward (increasing x) the animation should play forward.
When the object is at x = 6, the animation should show its final frame.
As the object moves leftward (decreasing x) between these values, the animation should play in reverse.

I thinks this is a form of clamping where I want to map x values into key frames of the animation.

Below just a simple code to run animation:

void Update () {
    if (isPositionChanging)
    {
        if(transform.position.x > xPos){
            if(incrementOrDecrement <=12) {
            incrementOrDecrement ++;
            AnimationPlayOnPositionValue(1, incrementOrDecrement);
            }
        }
        else {
            if (incrementOrDecrement >= 0)
            {
            incrementOrDecrement--;
            AnimationPlayOnPositionValue(1, incrementOrDecrement);
            }
        }

    }
}

void AnimationPlayOnPositionValue(float speed,float timeToUpdate) {
    animatedObject["MachineAnimationComplete"].speed = speed;
    animatedObject["MachineAnimationComplete"].time = timeToUpdate;
    animatedObject.Play();

}

sentences:
Renaming Texture 2D nodes in Unity's shader graph? I am new here so thanks for having me. I have a query regarding renaming the Texture 2D nodes I have created in my first Shader graph.
I have setup a shader graph with a normal map, base colour, smoothness and ao. These are showing up as exposed parameters which is just what I wanted so I can drag and drop new texture maps for the other materials easily (please see screen shot attached).
I would love to be able to name each of those Texture 2D maps accordingly so it is clear where each map from the assets folder needs to be dragged.
E.g The Texture node that contains the normal map is simply called 'Normal' instead of 'Texture 2D', the base colour map named 'base colour' etc.
Atm I have 4 exposed parameters all called Texture 2D.
Not the most serious of issues I would agree, but I feel like I must be missing something. No sign of a 'rename' option for those nodes.
Any help very much appreciated.
Cheers
Nick

sentences:
Optimal solution to render sprites with transparent edges in Unity Since I'm currently developing a 2D game for mobiles, overdraw and drawcall count is my first priority in the design of the application
I've thought initially to split each sprite in two parts: one where each pixel is fully opaque (to render with cutout shaders in front-to-back order) and the other part with semi transparent edges (which will be ordered back to front)

Since I need to support ES2.0 devices, I can't use texture-arrays and I need to fit as many sprites as possible in a single 2048x2048 texture atlas to reduce drawcalls and ensure mobile compatibility, but as you can see from this picture:

Splitting sprites in opaque and non-opaque parts will certainly double the space occupied in the atlas, thus decreasing by half the potential amount of consecutive sprites I can draw in a single drawcall

This way, I'm paying drawcalls to reduce overdraw.
By rendering the entire sprite with transparent shaders I'd pay overdraw to reduce drawcalls.

Am I missing something? Is there a better approach?

sentences: What mistake did I make? Source engine reskin issues Here is a reskin of the Half Life 2 Wallace Breen model that I made for a mod I am developing, but the checkerboard on the suit is very odd. All my other skins have no issue, but this skin has checkerboards under certain lighting situations. When mat_fullbright 1 is on, chekerboards do not show. When dynamic shadows and shading in on, or when mat_fullbright 0 is in use, the suit checkerboards.

sentences: Can I always assume that fixed time step in Unity is reliable? I was thinking about games on low end machines or phones where the CPU would be limited. If I were to move all of my game logic into FixedUpdate() can I assume that it will always be called with the same time delta? Or would it still be worth adding code to make it take the actual time delta into account?

sentences:
Yet another libGDX resolution independance question I am developping a Android smartphone game in LibGDX, and I am encountering issues about resolution managing. Most notably, I have no clue how to handle that in LibGDX.  For now, I am developping based on my Nexus 5 screen, but it will certainly not (down)scale well to devices with lower density screens.

On the web, most data are about LibGDX < 1.0.0 and is totally irrelevant. The few things I have found talks about the Viewport classes, but it is poorly explained ; the game is either horribly stretch or way too small on high-definition devices.

At this point, I have understood that I need to define a "virtual screen" of some unit (lets say meters) and then place my elements based on this unit. But there is no fragment of clue on how to do that the right way in LibGDX ; when using Scene2D, for example, buttons are totally misshaped, with letters out of the box, buttons clearly overstretched and such, or ultra small based on the Viewport class used.

In the same way, using multiple asset size is not clear ; how to load them based on pixel density, how to force them to be there at the good size ? Etc... This stuff can make anyone crazy at start.

What I want to know is : is there somewhere some good, updated to recent libGDX, demos, examples or tutorial to the proper way to handle resolution, screen ratio and such in recent libGDX ? The libGDX viewport example, while a good start, are still unclear to me, and don't show the multiple asset size thing.

Thanks for any help, it is highly needed.

sentences:
UE4 Navmesh precision I'm trying to make my very tiny man pathfind his way through a map of a school but the navmash won't recognize some of the hallways cause they are very narrow like this.

So as you can see the man can fit but the navmesh says no so can anyone help and keep in mind that i am very new to unreal engine so please make your explanation easy to understand.

sentences: Assistance with bomb throwing mechanics akin to Zelda 2D Does anyone have a good algorithm for managing the carrying and throwing of bombs? I've attempted to find a tutorial and can't find anything that covers the subject matter. I'm just looking for a very high-level algorithm; the coding I can handle.

sentences:
How to create custom 3D "areas" at runtime I've been puzzled for a few days trying to solve this problem, so far with no results.

On a map, currently a Terrain, I'd need to have some "areas" which can be controlled by a specific players. The shape of those areas can arbitrarily change during the course of the game, such as you add a  marker in any point, and the area evolves (like a spline, say) to pass through that point too.

The problem isn't drawing the boundary itself, of course, but having the GameObjects detecting the area they are in.

Currently I have absolutely zero idea on how to make this exactly.

I've thought about a nice approximation, which is splitting the terrain in fixed chunks, and having the player control them "chunk by chunk": every chunk can have its own collider, and that should be easy if not trivial. So the question is how to do it "properly", since I already have this workaround.

sentences:
Car (or other "object") acceleration and braking: how to? I'm not good in math so I'm here to ask you how to manage, in a simple 2d game, the car acceleration and braking.

I'm trying to develop it (as a hobby) in c# and sdl.net.

sentences:
Slick2D Simple StateBasedGame not working I recently started trying to work with outside Java libraries like Slick2D. This is my first time doing so, so I basically have no clue what I am doing.

I tried making a simple StateBasedGame that only displays a menu bar showing three options. The problem is that in my 'Game' class, the initStatesList() method isn't being called and I don't know why not. Here's the code:

Game class

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

public class Game extends StateBasedGame {
    public Game(String title) {
        super(title);
    }

    public static void main(String[] args) {
        Game game = new Game("Text Based");
    }

    @Override
    public void initStatesList(GameContainer arg0) throws SlickException {
        System.out.println("InitStates");
        addState(new Menu());
    }
}

Menu class:

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

public class Menu extends BasicGameState {

    private int ID = 1;

    @Override
    public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {
    }

    @Override
    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
        g.setColor(Color.white);
        g.drawString("Higher or Lower", 50, 10);

        g.drawString("1. Play Game", 50, 100);
        g.drawString("2. High Scores", 50, 120);
        g.drawString("3. Quit", 50, 140);

    }

    @Override
    public void update(GameContainer arg0, StateBasedGame arg1, int arg2) throws SlickException {

    }

    @Override
    public int getID() {
        return ID;
    }

}

I have no clue why it doesn't work...

sentences:
Transform 3D vectors between coordinate systems I've got 6 points in 3D space: A,B,C,D,E,F, that represent 4 vectors. AB is perpendicular to AC and DE is perpendicular to DF.

I need to find a transformation matrix M, that transforms AB to DE and AC to DF. In other words: M⋅AB=DE, M⋅AC=DF

If no scaling was involved, this could be solved with a simple rotation matrix. But since the ratios |AB|/|DE|, |AC|/|DF| might be different, I'm not sure how to proceed.

sentences:
Game State / Screen Management What's the best way to handle game states / screens?  My problem is this:

PlayGameScreen adds a new InventoryGameScreen to the game during it's update.  This immediately adds InventoryGameScreen to the array of GameScreens.  That's throwing an exception when iterating over the array that the contents of the array have changed.

Should I have two more arrays, like screensToBeAdded and screensToBeRemoved and do all the processing for them at the end of the game loop after drawing all the other screens?

sentences:
Can I develop games for mobile platforms in C++? I have a good grasp in C++ and C and have also experience developing AAA game using C++.
Now, I'm shamelessly thinking to dive into mobile game development either in iOS or Android. Unfortunately, I don't know objective-C and java and neither have courage to learn it.
So, As above mentioned reason, Is there any possibility to do mobile development in C++ without using any single statement of JAVA and Objective-C ?

sentences:
How can I use the animation transitions? So I want to make my animation transitions smooth, thats why I made transitions on the animator, but how can I activate them if I use trigger paramaters???
Heres the code:

public float speed = 0.3f;
public float sprintSpeed = 2.5f;
private Rigidbody rigidB;
private float midJump = 1f;
public float rotSpeed = 2;
Animator anim;

void Start()
{
    rigidB = GetComponent<Rigidbody>();
    anim = GetComponent<Animator>();
}
void Update()
{

    //Character rotation with A and D

    var z = Input.GetAxis("Horizontal") * rotSpeed;

    //Character movement with W and S

    var y = Input.GetAxis("Vertical") * speed;

    //Character animations

    if (Input.GetKey(KeyCode.RightShift))
        y = y * sprintSpeed;

    if (Input.GetKey(KeyCode.RightShift) && y > 0.31)
        anim.Play("Sprint");

    if (y < 0.001)
        anim.Play("Idle");

    if (y > 0.001 && y < 0.31)
        anim.Play("Run");

    transform.Translate(0, -y, 0);
    transform.Rotate(0, 0, -z);

    //Character Jump

    if (midJump == 1 && Input.GetKeyDown(KeyCode.Space))
    {
        rigidB.velocity = new Vector3(0, 45, 0);
        midJump = 2;

    }
    else if (rigidB.velocity.y == 0)
        midJump = 1;

}

sentences:
How can I detect disconnected clients in a peer-to-peer network of this topology? I'm working on my first multiplayer game (RTS genre) and for the networking model, I'm leaning more towards a peer-to-peer model as opposed to a client-server model. I want my game to be able to handle a large number of users concurrently (around 50-100 users) in a reasonable manner.

I've come up with a proof of concept that can achieve moderate speed and moderate load balancing across the network. For it to work, one of the peers has to be designated as a central authority (i.e. the host). The host then receives updates from users through a star topology and then broadcasts the changes to other users through a tree topology, as below:

This type of network has one big problem: churn. I'm having trouble figuring out how to deal with users that disconnect from the network. If nothing is done for them, all of that user's children (and descendants) will lose connection.

How can I detect disconnected nodes in a peer-to-peer network of my expected size and remove them without harming the other, still-connected clients and without placing undue load on the designated host?

sentences:
Shader value remap - Blend Falloff I would like to know if there's a way to remap a value that goes from 0 to 1 constantly like this.

Into those values (those are examples).

This might be some function transformation but I can't find the way to do that. I've tried using a lookup texture but in my opinion this is not the best solution.
Thank you very much.

sentences:
How can I create random noise that is seamless across modular game assets? Does anyone know how I can create a texture for a modular tile, such that when the tiles are arranged, random weathering effects such as scratches will be continuous across seams?

An example photo below shows the ideal result. The scratches are continuous between different tiles. Is creating weathering effects like this possible using any procedural software?

sentences:
Unity - can i make children of a moving platform also work as moving platforms? I have a moving platform that is a kinematic body, moving by a script, which is working as expected.

I tried to parent it to another kinematic body, and make the child also function as a moving platform (the script only moves the parent), but it seems that the friction is ignored for the child object, and the carried object slips behind it and falls down when the child platform moves. The child platform is the same physical material as the parent.

Is there any way i can make the child's friction work too, while having the script only move the parent?

This is important, because in my real application the child moves and rotates inside a couple nested levels of transformations (basically the fork
teeth of a fork truck).

here is a simple abstraction of my question:

https://youtu.be/U854IcS96-Y

Thanks!

sentences:
What pitfalls should one look out for when starting a studio What are the common mistakes or oversights made when starting a new game studio?

Please only one mistake or oversight per answer and if you can explain why it is an issue and what one should do to avoid falling into the mistake or recover if they've already made it.

sentences:
Is Windows window creation faster / more efficient than GLFW window creation? Are there any benefits to using Windows window for OpenGL or Vulkan rendering, rather than using GLFW window?

Is there any performance hits when using C++ Window creation over GLFW since it provides OpenGL and Vulkan interface?

sentences:
"Blind" PathFinding for fleeing agent I know there are plenty of algorithms for finding a path from A to B. There's also a good few articles on how to avoid an enemy in a 2D space. I can't find anything on escaping from an enemy in a blind 2D space. Here's what I mean by "blind" 2D space.
1, The fleeing agent only knows its position in the grid and the enemy's position.
2, I do not know how big the grid is.
3, I do not know where the walls or obstacles are.
4, If I want to check what's directly next to me I have to "go" there, if my position changes it's an empty space, else it's a wall or an obstacle.
The goal is to avoid the chaser (enemy) for 1000 moves. I move 2x as fast therefore I get to make 1000 moves while the enemy can only make 500 (moves every 2nd turn). Furthermore I can only move in 4 directions; up, down, left, right. The enemy gets to move in diagonals too.
My first idea was to find a block or a cluster of blocks I could circle around. Well, didn't work, by the time I found one the enemy caught me. Is there a way or an article describing this problem? Would appreciate any suggestions or articles sent my way.

sentences:
Clipping a windows draw area - Direct x 9 and c++ - 2D using D3D DirectX 9, C++... Let me set the scene:

I have a 16:9 image.
I have a 16:10 screen.
I want the 16:9 image to be drawn so that it is vertically centred within my 16:10 screen.
My 16:9 image is 1920 x 1080.
My screen is 1920 x 1200.

Easy:

float topOffset = ( 1200 - 1080 / 2 )

But what if my screen was 1400 x 900

I have to resize the image and get its new height, then do the above again:

float newHeightForScaledImage = ( 1080 * 1400 ) / 1920

Okay so now I have a topOffset for both widescreen cases. I draw all of my images and interactive objects at their ( y position + the topOffset ).

New problem is that the menu is also needed to take into consideration, so I use that systemmetricssomething call which returns 20 which I then subtract from the topOffset... Okay my drawing is vertically centred... perfect!

Question is, regardless of my entire game now being vertically centred (in the most crazy long hauled way possibly known to man), I can still draw outside of the game area into the black zone that now exists.

I know I am approaching this wrong, but I am too new to this to know any better.

How do you guys vertically centre your games if they are a different ratio to the artwork you have created for the backgrounds etc?

sentences:
uv tiling and offset for uvs not min-max 0-1 For the purpose of the question, a unit = 1 meter.

So, I have a triangle strip that is 4x8 meters (for argument's sake; it is procedurally generated by player). I also have a texture which is 512x512px.

For normal UV mapping, I just make U 0 or 1 (depending on the side of the strip), and I make V a value normalized between 0 and 1, based on the distance "traveled" along the strip.

Then I set tiling based on the distance, and the texture. In this case, the tiling would be 2 along Y, since the texture is a square.

I am having trouble dealing with a scenario where I do NOT use UV 0 to 1 though. I only want to sample the "middle" of the texture,. such that the min/max of the UV coords are 0.0x0.25 to 1.0x0.75.

When I try to make this work, I notice that as I lay my strip (done by player in game; mesh updates continually during placement), the texture moves along the strip. I figure I need to adjust the offset, but I am having difficulty figuring out the formula to use to determine what the offset should be based on the tiling (which in turn is based on the length of the strip).

when the tiling is 1, there is no problem with the offset (0). A tiling of 3 is also correct with no offset. Same for tiling 5, 7, etc. Odd numbers basically. When the tiling is an even number though, or a fractional number, offset 0 no longer works. On top of that, the needed offset seems to change based on the tiling.

How would one go about calculating this?

In addition, if I lay two of these strips end to end, and I want the texture to be continuous; how would one calculate the offset based on the tiling/offset of the previous strip behind it?

sentences:
What do you use to support multiplayer turn-based network game for iOS and Android games? If I'm doing a turn-based card game, what kind of technique do you use to support multiplayer gameplay over Internet?

Is it socket? If it's socket, which SDK (CoronaSDK etc.) can provide solid socket library?

Can Unity3D can be used solely to support what I need without using other socket servers like SmartFox or Electro?

sentences:
Instance vs individual updating I am making a game in SFML, and whilst I was making an AI moving system I was wondering which would be better, If I was to instance update all my entities at once, or individually update them via a function in each of the entity class instances.

I know that instance rendering is much faster but was wondering if this would even be needed for updating the logic of the game, afterall I'm not making a giant physics simulation.

So, I am wondering what would the effect be if I updated the game logic for each entity individually or did it via instancing. And if there is an impact is it really worth it for a game like mine where there isn't too much complexity.

sentences:
Practical balance of "chance" video game mechanics I've been a small games developer and designer for years, and I've recently begun working on more serious design documents for bigger projects.

A common theme I'm running in to is imbalance when it comes to "chance" RPG mechanics.
Critical Strike Chance. Chance to Hit/Dodge/Miss/Parry/Block so on.
The biggest problem in modern RPG games is factoring in Haste (Attack Speed), since it compounds so aggresivly with the other base mechanics.
Obviously, the more times a player attacks, indirectly increases their "rate" of critical strikes, or hits. This creates an immense imbalance, and most of the solutions come in the form of capping haste or utilizing diminishing returns or to killing the big stat increases.

As a designer and player, I don't feel this is a healthy way to deal with the issue. It's not a "fun" solution. Recently, gamers seen Blizzard's answer to this Haste issue in Diablo3, by halfing the stat increases on most all items.

Here is a practical example:

50% chance to critically strike, with 1 attack per second = on average 0.5 critical strike per second.
50% chance to critically strike, with 2 attacks per second = on average 1 critical strike per second.

The second situation is by far favorable, rather than increasing your Critical Strike Chance alone, since not only will you see more larger numbers (or hits in terms of a miss chance mechanic) per unit of DPS, you'll also be hitting more and games with Proc Chance mechanics also benefits.
More Complex games balance such things with Internal Cooldowns and Weighing the stats against each other, but often times Haste still comes out on top as being the supremely powerful stat.

Is it practical to instead use a Rate to decide weather or not something happens vs stat weights, capping and cooldowns?
My simplified example is:
Critical Strike RATE = Crit Chance / Attacks Per Second

The result is basically a simple stat weight system. Mechanics such a proc chances still benefit from Haste, however it may be easier to change the damage output of attacks and abilities to reflect the balance.
This keeps enjoyable haste mechanics in the game, which are fun to play. It also creates more depth for slower attack builds, rather than just an ability or proc benefiting from slow weapons.

Is this a near-sighted solution? Are there working examples of games currently on the market that don't cap or punish "haste" character builds?

sentences:
Using GLFW and GLUT together I'm new to OpenGL

Lets say I create an OpenGL window using glfw and I need the UI feature from glut (such as popup menu). Is it possible to use glfw and glut in one program?

Thank you

sentences:
How can I determine where to show a nameplate over a character? I'm working on a naming system that displays the name of enemies above their heads.

The problem is that I have some enemies that are larger or smaller than others. So I'm trying to use a function that gets the height of the enemy, and then uses that as the modifier for the name's position.

Here's what I'm doing (I should mention that the target is the enemy that is currently being targeted):

public Vector3 offset = Vector3.up;
...
thisTransform.position = cam.WorldToViewportPoint(target.position + offset);

What I'd like to do:

public float enemyHeight;
...
enemyHeight = target.collider.bounds.size.y + .5f;
thisTransform.position = cam.WorldToViewportPoint(target.position + enemyHeight);

But obviously it is giving me an error that I can't add a float to a vector. How can I accomplish this?

sentences:
Pygame bullet firerate not working sometimes i have made this bullet class but i have a problem with the firerate. Sometimes  i'm not able to shoot even when the little delay (700ms) between the two shots has ended. I guess it's due to the pygame.time.set_timer(). Anyways i'm looking for a quick solution because i wanna move on to work on another part of this game.
...

class Singlebullet(object):

    def __init__(self):
        self.img = pygame.image.load(r'C:\Users\Salem\Documents\MyGame1\bullet.png')
        self.state = 'ready'
        self.speed = 0
        self.firerate = 700

    def shoot(self):
        if current_bullet_type == 'single':
            if self.state == 'ready':
                self.x = myplane.x + 71
                self.y = myplane.y
            if self.state == 'fire':
                self.speed = -13
            for event in events:
                if event.type == pygame.KEYDOWN or event.type == pygame.KEYUP:
                    if event.key == pygame.K_SPACE:
                        self.state = 'fire'
                        pygame.time.set_timer(pygame.USEREVENT+1, self.firerate)
                if event.type == pygame.USEREVENT+1:
                    self.state = 'ready'
            MyScrollingScreen.blit(self.img, (self.x, self.y))
            self.y += self.speed
s1 = Singlebullet()
...
while running:
    ...
    s1.shoot()
    ...

sentences:
Which language and tools should I choose for creating 2D games? Recently I have returned to my childhood hobby (programming games) and found it quite enjoyable. I've been tinkering with PyGame (for Python) for a few months, made a couple of projects for educational purposes. PyGame is nice, however there is not an awful lot of commercial games using PyGame, and I'd like to invest my time in the best way and ideally to make an extra buck in the future.

What I like:

doing things alone. I do not dream about working at huge corporation and making one tiny bit of World of Duty-7
frameworks like LÖVE (for Lua) or PyGame. I doubt I am able to figure out
how to draw those fancy pixels without it
cross-platform things.
free stuff.

What I don't like:

C++ scares me, however feel free to tell me how stupid I am
IDEs like GameMaker, RPGmaker etc. I like making my own tools.

My goal is to make 2D games like Terraria, Super Meat Boy, DefCon, etc. Which language and tools should I choose to accomplish my goal?

sentences:
What's the best way to make a game launcher? I am a new game dev, and would like to make a launcher for my games. All my games would be in ONE launcher, and it'd be similar to the Minecraft Launcher. I wanna do it for free too.
The main reason I wanna do it is to update my games. I don't have a file server, so the files would be on Google Drive.
Thanks!

sentences:
Update sprite position when speed changes if frame rate is low I have a sprite moving horizontally from left to right. For each iteration I want to start decreasing the speed.
This works ok, and the sprite will stop at some point, however depending on the frame rate it won't always stop
at the same place. What's wrong with my code?

...
Vector2 Position;
Vector2 Speed;
...
Speed.X = 50;
...

public override void Update(GameTime theGameTime)
{
    float time = (float) theGameTime.ElapsedGameTime.TotalSeconds;

    Position += Speed * time;

    Speed.X-=10; // Reduce speed for next iteration
    if ( Speed.X < 0 ) Speed.X = 0;
}

I have also tried by doing

Speed.X-=10 * time;

but that didn't work.

sentences: How to access the nth element in a 2d texture from a pixel shader in XNA How can I access the nth element in a texture2d from a pixel shader? For example if I wanted to get the 5th vector4 from 10 x 10 texture2d

sentences:
Pushing an object left and right (gravitation towards center of a circle) So this is the problem:

I have an object pulled towards the center of a circle and I am unable to figure out how to move the object left and right depending on its rotation around the circle.

I basically need to know in which "angle" to push the object if the left or right key was pressed.

Thank you

sentences:
Godot: How do I get the id mask for a physics layer by name? I would like to figure out whether a collider is in a physics layer by the name (string) I set in project settings:

func _physics_process(delta):
    var collision = move_and_collide(direction * delta * speed)
    if collision and (collision.collider.collision_layer & get_collision_layer("Walls")) != 0:
        direction = direction.bounce(Vector2.LEFT)
    # more behaviors based on other layer tests

Walls is the name of the physics layer and I am trying to find get_collision_layer.

I am using Godot 3.2.1.  self is a KinematicBody2D & colliders are StaticBody2D's & also KinematicBody2D's.

I have figured out the collision id (as an int) but still think it would be cleaner to use layer names, preferably using a built-in function.

sentences:
Unity Shadow shows on my Android device but NOT my Windows Mobile device Unity version: 2017.1.1f1
Problem:
I'm using Directional Light. Shadow is not showing in my Windows Mobile device (Lumia 640 XL), but works fine when I run the exact same UWP project as PC (Local Machine) as well as Android.

Attempted solutions:
1) Quality Setting: I even removed the rest of levels and left only 1 level of quality.
2) Both soft and hard shadows, 10 Shadow distance, Stable Fit of shadow projection, very high resolution, low resolution, No Cascade.
3) Tried realtime and mixed light mode.

any idea? Thanks in advance for read my question.

Screenshots:
Windows 10 Mobile (Lumia 640 XL)

Android (Redmi Note 3)

sentences:
Screen objects sometimes not rendering I am a mildly experienced programmer who has created several game engine templates and small 2D games in Java. I am currently expanding to 3D game engines and I am re-writing a previous engine to be more adaptive and Object-oriented.

My issue is, and has been periodically, that the objects are only sometimes rendered. This causes me to have to constantly re-run the program just to display any images.

I have not found any direct answers to this question, and nobody else seems to have this same issue (even when observing sources with the exact same code setup). The problem apparently lies within the render() method sometimes not properly creating or utilizing the Graphics & BufferStrategy objects while inside a thread called from the main method.

Here is some code of the 'Main' class:

public Main() {
    addScreenAndFrame();
}

public static void main(String[] args) {
     main = new Main();
     frame.add(main);
     thread =

new Thread(main);
         running = true;
         thread.start();
     }
public void run() {
    while (running) {
        render();
        tick();
    }
}
public void tick() {
    screen.tick();
}
public void render() {
    bs = getBufferStrategy();
    if (bs == null) {
        createBufferStrategy(3);
        return;
    }
    g = bs.getDrawGraphics();
    screen.paintComponent(g);
    g.dispose();
    bs.show();
}

Here is some code from the Screen class:

public Screen(int width, int height) {
    this.width = width;
    this.height = height;
    addEntities();
}
public void paintComponent(Graphics g) {
    p.render(g);
}
public void tick() {
    KeyInput.tick();
    renderInput();
}
public void addEntities() {
    p = new PolygonObject(new double[] {50,200,50}, new double[] {50,200, 200} );
}

And finally here is the PolygonObject class:

    public PolygonObject(double x[], double y[]) {
        Screen.polygonSize ++;
        polygon = new Polygon();
        for (int i=0; i < x.length; i++) {
            polygon.addPoint((int)x[i], (int)y[i]);
        }
    }
    public void render(Graphics g) {
        g.fillPolygon(polygon);
        g.setColor(Color.black);
        g.drawPolygon(polygon);
    }

I don't know why calling render() while within a thread would yield inconsistent results when drawing images to the screen. I have seen many source codes for game templates and tutorials with the exact same code without any rendering issues. The only way rendering works consistently is when I draw images with the paintComponent() method of the Canvas class outside of a thread which limits my program functionality and is poor design of a game engine.

I would like an explanation of this and any possible solutions. There is NO accurate way for me to build the game engine without the use of a thread in order to have controlled time-based functionality.

sentences:
How to use CreateGridMesh in RuntimeMeshComponent I don't know to pass on the 5th parameter. I'm still new with C++ so if someone could help me with the pointer

void AGrid::GenerateMeshes_Implementation()
{
    FRuntimeMeshDataPtr Data = GetRuntimeMeshComponent()->GetOrCreateRuntimeMesh()->GetRuntimeMeshData();
    Data->EnterSerializedMode();

    Data->CreateMeshSection(0, false, false, 1, false, true, EUpdateFrequency::Average);

    auto Section = Data->BeginSectionUpdate(0);

    FVector BoxSize = FVector(100, 100, 100);
    URuntimeMeshShapeGenerator::CreateBoxMesh(BoxSize, *Section.Get());
    URuntimeMeshShapeGenerator::CreateGridMesh(128.0f, 128.0f, 64, 64, *Section.Get()); // <---- This one

    Section->Commit();
}

It says it needs to be a TSharedPtr<FRuntimeMeshAccessor>&

void URuntimeMeshShapeGenerator::CreateGridMesh(float Width, float Height, int32 NumSubdivisionsX, int32 NumSubdivisionsY, const TSharedPtr<FRuntimeMeshAccessor>& MeshBuilder)
{
    MeshBuilder->EmptyVertices(CREATEGRIDMESHTRIANGLES_NUMVERTS(NumSubdivisionsX, NumSubdivisionsY));
    MeshBuilder->EmptyIndices(CREATEGRIDMESHTRIANGLES_NUMTRIS(NumSubdivisionsX, NumSubdivisionsY));
    FVerticesBuilderFunction VerticesBuilder = [&](const FVector& Position, const FVector& Normal, const FRuntimeMeshTangent& Tangent, const FVector2D& UV0)
    {
        int32 NewVertex = MeshBuilder->AddVertex(Position);
        MeshBuilder->SetNormalTangent(NewVertex, Normal, Tangent);
        MeshBuilder->SetUV(NewVertex, UV0);
    };

    FTrianglesBuilderFunction TrianglesBuilder = [&](int32 Index)
    {
        MeshBuilder->AddIndex(Index);
    };

    CreateGridMesh(Width, Height, NumSubdivisionsX, NumSubdivisionsY, VerticesBuilder, TrianglesBuilder);
}

sentences: Configurable Dice Cup Sound Effect for HTML5 Game I am developing an HTML5/javascript based game, where the players will have to roll virtual dice. I am working on a 3d model of a dice Cup and plan on having the users shake it and turn it upside down in order to roll the dice. I would like some realistic sound effects to go along with this interaction, but do not know how to achieve this. The problem is that the number of dice, the duration, intensity and speed of the dice cup shake will vary. Consequently, I don't think I will be able to create a convincing sound experience by using a prerecorded sound effect. How does one deal with making such sound effects configurable?Would I need to programmatically generate the sound using the web audio API? If so I would be grateful for any pointers as to how to do it.

sentences:
Unity: Assigning a key to perform an action in the inspector I am trying to write a simple piece of code in JavaScript where a button toggles the activation of a shield, by dragging a prefab with Resources.load("ActivateShieldPreFab") and destroying it again (Haven't implemented that yet).

I wish to assign this button through the inspector, so I have created a string variable which appears as intended in the inspector. Though it doesn't seem to register the inspector input, even though I changed the value through the inspector.

  It only provides the error: "Input Key named: is unknown" When the
  button name is assigned within the code, there is no issues.

Code as follows:

var ShieldOn = false;
var stringbutton : String;

function Start(){
}

function Update () {
    if(Input.GetKey(stringbutton) && ShieldOn != true)
    {
        Instantiate(Resources.load("ActivateShieldPreFab"), Vector3 (0, 0, 0), Quaternion.identity);
        ShieldOn = true;
    }
}

sentences:
Texture2D GetPixels - Finding pixels that are not transparent. Problem as finding more than expected I am trying to make a level design system where I use a low resolution png file with certain pixels filled. My code will turn this location of the pixel in the image into placement of platforms in my game.

But I test the following code with a png i made with only 1 pixel in it (the rest are transparent). But the result is it finds 4 every time. Is it possible there is a discrepancy between the Gimp png and the texture that Unity sees. (In GIMP I used pencil 100% hardness 1px width. There are also settings for 'resolution' of the image, which i left at defaults):

public class LevelBuilder : MonoBehaviour
{
public Texture2D sourceTex;
Color32[] pixels;
int pixelsFound = 0;

private void Start()
{
    pixels = sourceTex.GetPixels32();
    for (int i = 0; i < pixels.Length; i++)
    {
        if (pixels[i].a != 0)
        {
            Debug.Log("found colored pixel. total: " + ++pixelsFound);
        }
    }
}
}

sentences:
Rotate an objects velocity I have a collision system (in 3D but for the purpose of the question assume 2D) where I want to calculate the new velocity (stored as a vector) after a collision.

What I have is the velocity of the object colliding against a plane and I want the object to then slide down that plane.

I know the angle of impact with the plane and I know the normal of the plane.  I can create a Rotation Matrix for the rotation that the velocity needs to be changed by, I just am not sure how I rotate the velocity vector by that matrix.

I'm sure it's an easy answer but I haven't quite been able to get it.

I added a picture as requested

Any help would be appreciated.

sentences: Can Simple Direct Media Layer be used with WebGL? I have read that on desktop OpenGL + SDL is a great way to learn. In looking at WebGL I couldn't find a Web version of SDL. On their site I see bindings for all sorts of languages, but no JavaScript. It seems obvious that this gives an answer of 'no' to my question, but I also came upon code snips while googling around that seemed to be doing it. Whatever the missing piece is I'm not getting it...

sentences:
Relative Transformations for Bones I'm using Blender to export my armatures in relative coordinates, and I'm trying to get to absolute coordinates in my engine. For the above example, the childBone's tip is an offset of [-1,0,0], which is relative to the forward direction of the rootBone, not the global X axis. I understand how matrix multiplication works, but I can't quite seem to get there. Could someone break down the exact steps needed to calculate the absolute coordinates? Here's my attempt:

Vector3f rootRoot = new Vector3f(1,1,0);
Vector3f rootTip = new Vector3f(2,1,0);
Vector3f rootTipOffset = Vector3f.sub(rootTip, rootRoot);
float rootLength = rootTipOffset.length();
Quaternion rootRotation = new Quaternion(new Matrix4f().initRotation(rootTipOffset, Vector3f.Y_AXIS));
Matrix4f rootBindPose = new Matrix4f().initTranslation(rootRoot).mult(rootRotation.toRotationMatrix());
//Matrix for the root of the root bone

Matrix4f childOffset = new Matrix4f().initTranslation(rootTipOffset).mult(rootBindPose);

Vector3f childRoot = new Vector3f(0,0,0); //2,1,0
Vector3f childTip = new Vector3f(-1,0,0); //2,2,0
Vector3f childTipOffset = Vector3f.sub(childTip, childRoot);
float childLength = childTipOffset.length();
Quaternion childRotation = new Quaternion(new Matrix4f().initRotation(childTipOffset, childOffset.getRotation().getUp()));
Matrix4f childBindPose = childOffset.mult(new Matrix4f().initTranslation(childRoot).mult(childRotation.toRotationMatrix()));
Matrix4f testMatrix = new Matrix4f().initTranslation(new Vector3f(0,0,childLength)).mult(childOffset);
System.out.println(testMatrix.getTranslation()); //Prints [2, 1, 1]

sentences:
How to make an animation play when a button is pressed once? I have added an idle and jump animation to a character in unity. I can make the animation happen when the button is pressed. If the button is up middle at the animation the character goes to the idle position. But I want the whole animation happen in one press to the button and then go back to the idle position. My current script and Animator views are:

if (Input.GetKeyDown(KeyCode.Space))
    {
        Anim.SetBool("is_jumping", true);
        ApplyInput(moveAxis, turnAxis);
    }
    else if (Input.GetKeyUp(KeyCode.Space))
    {
        Anim.SetBool("is_jumping", false);
    }

sentences:
Rendering multiple RenderTargets to the screen Let's say I have a background and a set of entities.
I have managed to draw the background into a Texture2D using a RenderTarget
I have also managed to draw all my entities into another RenderTarget

Now I want to take these two Textures and render them on the screen as so:

// Top-level rendering
entitiesSystem.Process();
background.Process();
Texture2D entitiesTexture = entitiesSystem.EntitiesTexture;
Texture2D backgroundTexture = background.BackgroundTexture;

graphicsDevice.SetRenderTarget(null);
graphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(
    backgroundTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    1
);
spriteBatch.Draw(
    entitiesTexture,
    LevelManager.LEVEL_RECTANGLE,
    null,
    Color.White,
    0.0f,
    Vector2.Zero,
    SpriteEffects.None,
    0
);
spriteBatch.End();

Here is how the background system renders the background:

graphicsDevice.SetRenderTarget(BackgroundTexture);
spriteBatch.Begin();
for (int i = 0; i < 2; i++)
    spriteBatch.Draw(textures[i], positions[i], Color.White);
spriteBatch.End();

Almost the same thing happens for the entities: I set the render target to the relevant one (not the same as the one for the background), start the spritebatch (again, not the same one), draw the entities and end the spritebatch.

If I set BlendMode to additive, the result is correct (they blend together). However, if I set to to AlphaBlend, then I can only render one of them (depending on the SpriteSortMode).

I have come as far as understanding that the problem lies in not preserving... something, but I am not sure how to preserve it :P

By the way, I read that multiple render targets are not supported for the XBOX... Soooooooo... what is the alternative of doing what I am doing now?

sentences:
Why is my TextMesh always on top? I have a 2-d game that I am making, using 3-d assets, including TextMeshes for text. I have decided that in some instances, I would like to have the TextMesh appear behind objects in the foreground. The below is one such example.

It seems that the TextMesh is always in front. I have tried a number of things to get the text between the map and object layers, with no success. These include:

Moving the text between the map and object.
Changing the SortingLayers and SortingOrder. The map, objects, and labels are on 3 different layers, with the Objects being the highest layer, the map the lowest, and default and label in between.
Using a perspective camera, not orthographic.

Any ideas as to what else could be going on? Thanks!
How can I make the TextMesh appear that isn't on the top layer? Thanks!

sentences:
How can I detect enclosed areas in an arbitrary set of overlapping lines I have game where there can be arbitrary lines, these lines can overlap. I want to find out first if there are any enclosed shapes created by overlapping lines, and then I want to fill the enclosed shape.
The best guess I have at doing this comes from this other post: determine if a set of tiles on a grid forms and enclosed shape. From what I can gather this would be, given a graph you can detect loops. However I can't quite figure out how to construct the graph from my data.
Is this a good way to go about solving this problem? And if so, any pointers on how I might get there given a list of collisions?

sentences:
How do I find the face of an object? I'm working on a build mode but the thing of it is the player is able to deform meshes. Part of my build system includes having "snap" points thus I need to be able to find the face and recenter the snap point on deformed meshes.

So, how do I find the face of an object and the center of said face? Also how would I find the center?

To clarify: The end goal is to keep the snap point positioned properly with the face that has been deformed/manipulated.

sentences:
Which buffering process would be more efficient? I'm working on the base engine of my game right now, specifically converting a text file into a level on-screen. As a 2D platformer, each level has an array of rectangles that can be drawn to the screen. Obviously I don't want to draw all these bad boys to the screen every frame, as that would slow everything down. I've thought up two solutions to this problem myself:

Draw these rects to a separate texture (I'm using SDL2, by the way) and paint a specific portion to the screen every frame
Choose which rects to draw every frame based on the player's position by checking collision between every rect and an imaginary moving "chunk"

My question: Which of these two processes, if either, would be less of a burden to the cpu? If neither seem reasonable, what other alternatives are there?

sentences:
Rotate model using quaternion Currently I have this to rotate my 3D model that rotates on it's local axis independent from the world's axis:

// Rotate model with Right Thumbstick
modelRotation -= pController.ThumbSticks.Right.X * mRotSpeed; // float value

What I'm trying to do is rotate the model using quaternion and not by a matrix.

I've searched for tutorials, but have found none that explains thoroughly on how to achieve this. Does anyone know how to I can use quaternions to rotate my model or a complete tutorial?

sentences:
Farseer physics engine: The name 'ConvertUnits' does not exist in the current context http://digitalerr0r.wordpress.com/2012/03/11/farseer-physics-in-xna-4-0-for-windows-phone-1/

I tried this Farseer tutorial but I always get that error message in the following lines:

spriteBatch.Draw(rectangleSprite, ConvertUnits.ToDisplayUnits(rectangle.Position),
                                        null,
                                        Color.White, rectangle.Rotation, new Vector2(rectangleSprite.Width / 2.0f, rectangleSprite.Height / 2.0f), 1f,
                                        SpriteEffects.None, 0f);

        spriteBatch.Draw(rectangleSprite, ConvertUnits.ToDisplayUnits(rectangle2.Position),
                                        null,
                                        Color.White, rectangle2.Rotation, new Vector2(rectangleSprite.Width / 2.0f, rectangleSprite.Height / 2.0f), 1f,
                                        SpriteEffects.None, 0f);

        spriteBatch.Draw(rectangleSprite, ConvertUnits.ToDisplayUnits(rectangle3.Position),
                                        null,
                                        Color.White, rectangle3.Rotation, new Vector2(rectangleSprite.Width / 2.0f, rectangleSprite.Height / 2.0f), 1f,
                                        SpriteEffects.None, 0f);

What is wrong? I added the two usings to my code but I always get this error message:
The name 'ConvertUnits' does not exist in the current context

sentences:
Compute billboard rotation I'm trying to compute a matrix to have object always facing the camera. For the moment, my result look pretty good, the problem is that my original billboard scale isn't preserved (Every billboard have a size of 1/1).

Here is what I've done using this post:

glm::vec3 look = glm::normalize(camera->getPosition() - objectPosition);
glm::vec3 right = glm::cross(up, look);
glm::vec3 up2 = glm::cross(look, right);
glm::mat4 transform;
transform[0] = glm::vec4(right, 0);
transform[1] = glm::vec4(up2, 0);
transform[2] = glm::vec4(look, 0);
transform[3] = glm::vec4(objectPosition, 1);

glm::quat q = glm::quat_cast(transform);
objectTransformable->setOrientationFromQuat(q);

I've tried to add something like that but the result is a bigger object with bad proportion:

transform = glm::scale( transform, objectScale );

To resume, I would like to extract orientation from result matrix to apply it on my transform object, something like Unity:

MyTransform.LookAt(Cam.transform.position, upVector);

sentences:
What are the different ways to balance an online multiplayer game where user spend different amounts of time online? Let's consider a game where every player is building his own medieval town. To make this question simple, let's assume that, on this persistent world, some people will play an hour every day (heavy players), and others will spend an hour per week (light players).

To keep the game fair, a gamer with a lot of free time shouldn't be able to grow much faster than a less present gamer just because he connects more often to the game.

So the first idea is to have a sort of time-based budget: You are saving "action points" as the time is passing. When you connect, you are able to spend this "action points". This way, players are fairly treated...

I see 2 problems:

On one hand, heavy gamers should have the opportunity to play. As often that they want to...
On the other hand, light gamers will be able to connect and make a lot of "actions" in a really short range of "real time" (for instance without been "seen" as the heavy players are..)

So my question is:

What are the solutions that allows light and heavy players to play flairly and balanced regardless of free time to play?

sentences:
What algorithm to use to fill a KenKen square board with cages? I am working on recreating KenKen, a popular math puzzle involving a blank grid that is divided into "cages". Each cage is just a collection of adjacent squares and has a clue which is generally a number and an operand, shown below:

What type of algorithm would be best to fill the square with cages? Assume the maximum number of cells per cage would be 3 and the board is 4x4 in size, like in the example above.

sentences:
How to determine what color will be written into single pixel framebuffer? I thinking about rendering into single pixel (1x1) framebuffer.
For example we have two triangles which covers whole NDC area, one is green second red.

What color will be written to 1x1 framebuffer? As far as I understend graphic API (no matter which) tries to put whole scene in to given framebuffer, in our example, into single pixel. But I can't figure how GPU will choose what should  be written into that pixel.

sentences: What middle tier and backend libraries exist for handling player matching and out of game information? Are there any libraries or frameworks readily available that handle player metrics, rankings, matching, tournaments, etc? Anything for managing the player community? (Please don't say DotNetNuke)

sentences:
"SetSelectedGameobject" only highlights button on second try (Unity 2017.3) To support the use of a gamepad in the options menu I set SetSelectedGameObject and firstSelectedGameObject (which doesn't seem to do anything) to the button in the upper left, so it's highlighted. This works fine in my pause and option menus (panels that are enabled/disabled) but there's also a third panel that displays the controls as an image. On this screen the first button is set as selected but it doesn't get highlighted until I go back to the pause menu and then open the "controls" screen again.

The Hierarchy:

The ControlsPanel looks like this: click

All 4 buttons are set to "automatic" and they're all accessible to the gamepad but, like I said, the first one ("Keyboard") doesn't light up the very first time I access the panel. It should be like this:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is highlighted
Pressing right on the gamepad highlights the next button ("Controller")

What actually happens:

Click on "Controls" in the pause menu
ControlsPanel is enabled
"Keyboard" button is still grey
Pressing right on the gamepad highlights the next button ("Controller")
Press the "Back" button ("ControlsPanel" is disabled and "PausePanel" enabled)
Click on "Controls" again
This time the "Keyboard" button is highlighted

The "ControlsPanel" script:

public Image pic;
public GameObject controllerChoicePanel;
public GameObject firstControls;
private String controls;
private bool windows;

void Start() {
    controls = GetControls();
    windows = GetOS();
    pic.sprite = Resources.Load<Sprite>(controls);

    if(windows) {
        controllerChoicePanel.SetActive(true);
        EventSystem es = EventSystem.current;
        es.firstSelectedGameObject = firstControls;
        es.SetSelectedGameObject(firstControls);
    }
}

Any idea why it would work fine in my pause/options menu but not in the "Controls" one, even though I'm doing the same thing?

sentences:
How to set speed based on screen size 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?

sentences:
Developing for Chrome App/Android? I have been developing for win7 mobile (XNA/silverlight and will continue to do so, love everything about it) but I wanted to branch a few of my more polished games to google app store online, and perhaps android(though not sure, as with all the different versions it makes learning/loading applications a bit tricky)

What is the most versatile language to start learning from chrome apps/android:

Java would be excellent for android, but could I port it to a web app for chrome? (and its close to C#)

Flash would work for a web app as I can just embed it into a html page (have done actionscript before, didn't care much for the IDE though), but would it also work on android?

or I guess there is always C/C++ but haven't heard much about that, though I think it works for both (though C++ does interest me)

Any advice would be excellent, thanks.

sentences:
2D object-aligned bounding-box intersection test I have two object-aligned bounding boxes (i.e. not axis aligned, they rotate with the object).  I'd like to know if two object-aligned boxes overlap.  (Edit: note - I'm using an axis-aligned bounding box test to quickly discard distant objects, so it doesn't matter if the quad routine is a little slower.)

My boxes are stored as four x,y points.  I've searched around for answers, but I can't make sense of the variable names and algorithms in examples to apply them to my particular case.

Can someone help show me how this would be done, in a clear and simple way?  Thanks.  (The particular language isn't important, C-style pseudo code is OK.)

sentences:
OnMouseEnter() function stops working when I set the canvas render mode to: Camera Overlay Basically the title says it all. I have a OnMouseEnter() function that works fine when I have the canvas render mode on Worldspace but stops working when I change it to Camera Overlay.

Before, it would work with just the script with the mouse functions on it attached to the image object. Now to work I need to use an event trigger and add the script to another object to put it into the trigger.

Any idea why?

sentences:
Batching and Z-order with Alpha blending in a 3D world I'm working on a game in a 3D world with 2D sprites only (like Don't Starve game). (OpenGL ES2 with C++)

Currently, I'm ordering elements back to front before drawing them without batch (so 1 element = 1 drawcall). I would like to implement batching in my framework to decrease draw calls.

Here is what I've got for the moment:

Order all elements of my scene back to front.
Send order list of elements to the Renderer.
Renderer look in his batch manager if a batch exist for the given element with his Material.

Batch didn't exist: create a new one.
Batch exist for element with this Material: Add sprite to the batch.

Compute big mesh with all sprite for each batch (1 material type = 1 batch).
When all batches are ok, the batch manager compute draw commands for the renderer.
Renderer process draw commands (bind shader, bind textures, bind buffers, draw element)

Image with my problem here:

But I've got some problems because objects can be behind another objects inside another batch.

How can I do something like that?

sentences:
Bullets doesn't do any damage I have a melee enemy tagged as enemy. enemy has two coliders: a capsule(physics) and a sphere(for attacking player in radius and istrigger) and a particlesystem, enemy has enemyhealth script attached.

Similarly, bullet has capsule collider and set istrigger, I've attached enemyhealth script to bullet as enemy sphere and bullet capsule are triggers (bullet doesn't have any particle system need fix for this too without raycast), bullets are destroyed on colliding with enemy but doesn't damage the enemy.

script used for enemy health

using UnityEngine;
using System.Collections;

public class enemyhealth : MonoBehaviour {
  public int health = 40;
  public int current;
  //public int score = 10;
  public AudioSource deathclip;
  public ParticleSystem death;
  CapsuleCollider Collider;
  bool dead;
  // Use this for initialization
  void Start ()
  {
    deathclip = GetComponent<AudioSource> ();
    Collider = GetComponent<CapsuleCollider> ();
    death = GetComponentInChildren <ParticleSystem> ();
    current = health;
    dead = false;
  }

  void Update()
  {}

  public void Takedamage (int amount )
  {
    if (dead)
      return;
    current -= amount;

    if (current <=0)
      die ();
  }

  void die ()
  {
    //GetComponent<NavMeshAgent> ().enabled = false;
    dead = true;
    Collider.isTrigger = true;
    deathclip.Play ();
    death.transform.parent = null;
    death.Play ();
    Destroy(death.gameObject);
    Destroy(gameObject);
  }
}

script used for bullet

using UnityEngine;
using System.Collections;

public class mover : MonoBehaviour {
  public float speed;
  public int damage = 10;
  enemyhealth Enemyhealth;
  GameObject ENEMY;
  bool enemyinrange;

  // Use this for initialization
  void Awake () {
    GetComponent<Rigidbody>().velocity = transform.forward*speed;
    Enemyhealth = GetComponent<enemyhealth> ();
    ENEMY = GameObject.FindGameObjectWithTag ("enemy");
  }
  void OnTriggerEnter(Collider other)
  {
    if(other.gameObject == ENEMY && Enemyhealth.currenthealth >=0)
      enemyinrange=true;

    //Destroy(gameObject);
  }
  void OnTriggerExit(Collider other)
  {
    if (other.gameObject == ENEMY)
      enemyinrange = false;
  }
  void Damage()
  {
    Enemyhealth.Takedamage (damage);
  }

  // Update is called once per frame
  void Update ()
  {
    if (enemyinrange)
        Damage ();
  }
}

sentences:
How would I apply gravity to a bullet so that it would drop slightly the longer that it travels? How would I apply gravity to a bullet so that it would drop slightly the longer that it travels?

I somewhat understand how the gravity works, Im just asking for second opinions for more optimized ways of doing this.

VOID update()
{
    veloc_Y += gravity;//0.5f
    posX += veloc_X;
    posY += veloc_Y;

       if(posY > 650)
       {
           posY = 650.0f;
           veloc_Y = 0.0f;
           on_g = true;//lets my game know im on the ground
       }
}

so, would I apply gravity to bullet veloc_Y?

ex:

b_veloc_Y += gravity;
b_pos_Y += b_veloc_Y;

would this make my bullet drop?

thanks for help in advance

sentences:
Custom Content Package for Files I am about to purchase quite a few model packs from a website for prototyping my game. In the contract it states that I must protect them as to prevent the public from gaining access to them.

I remember working with the Valve games, they used .gcf (game content file) that basically was an archive of all the content for each game. They packed in sound/materials/models/maps/etc. I figured it might not be a bad idea to develop something similar to this, and just write a small tool to let me add/remove files from it.

Problem is I really have no idea how to go about starting on something like this. I tried Google but I didn't even know what to search for. If anyone has any ideas, links that might be of use, or anything else I would greatly appreciate it.

sentences:
How do I sort with both depth and y-axis in OpenGL? Continuing my misadventures in pyOpenGL, I've refactored the whole thing to use 4 buffers:

tile vertices - all drawn at the start, probably never modified
tile texture co-ords - not modified often (but enables support for animated tiles later)
sprite vertices - modified often as sprites move around the map
sprite texture co-ords - modified often as sprites animate

My draw loop binds each buffer, and calls drawArrays() twice. I have enabled depth testing, and clear the depth buffer on each draw:

glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_DEPTH)
...
glDepthFunc(GL_LESS)
glEnable(GL_DEPTH_TEST)
...
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

For the moment, I've hard-coded the z coordinate for each of the things I'm drawing, just to be sure they're definitely in the right order - grass tiles are at 0.9, the tree (4 tiles) is set to -1.0 and the sprites are at 0.0. This is what I get:

In a previous attempt to build this engine without openGL, I was using Tkinter canvas images, which ended up very slow. To get the draw order right, I had to sort all the objects by their y-coordinate plus their z-coordinate, because it is all on a 2D plane. I want something similar, here. I don't understand why the grass tiles cause this problem, when they should be drawn right at the back. GL_DEPTH_TEST is definitely enabled - if I disable it by commenting out the glEnable() call, the sprites are drawn on top of everything (including on top of the trees). I want an illusion of depth by being able to walk behind high-sticking-up objects.

I've continued hacking away at this, and I've gotten a little further by modifying my shader:

fragment_shader = shaders.compileShader("""
    uniform sampler2D u_image;

    varying vec2 v_texCoords;

    void main()
    {
        vec4 tex = texture2D(u_image, v_texCoords);
        if(tex.a < 1.0)
          discard;
        gl_FragColor = tex; //texture2D(u_image, v_texCoords);
    }
""", GL_FRAGMENT_SHADER)

By checking for transparent pixels and throwing them away, I get a lot closer to my goal, however it is still not quite right, and I do not know how to fix it.

The wizard is at z:-0.5, and the tree trunk is at z:-0.2; it is doing what I'm telling it to do, just not what I want it to do. If I put them on the same z-level, the trunk is drawn over the wizard when he stands in front of the tree, and correctly when he stands behind it:

I don't just want depth sorting, I also want to sort on the y-axis. How can I do this in OpenGL?

sentences:
Android opengles how to use glunproject How to use glunproject in my android app?

I have the following parts in my engine:

A projection matrix
A view matrix for the camera
A model matrix for each of the objects in my world. This matrix is calculated from the parent objects model matrix and the objects own model matrix. These matrices are calculated from a translation, rotation and scale matrix. (this all works fine)

These matrices are then multiplied and passed to my vertex shader.

Now I understand glunproject needs the model matrix and the projection matrix and can caluclate a near and far 3d coordinate depending on the camera viewport settings ( for the near and far plane)

Do I need to use glunproject for each of the objects in my world and then check if the ray produced by these near and far coords intersects my object?
This seems quite expensive on the cpu?

What is the proper use for glunproject

sentences:
canvas not found in game view with unity I am working on a GearVR app with Unity3D.I have an environement and I have placed a canvas in the scene.I have set the canvas Render mode to "World Space".But when I runned my project,the canvas is getting displayed on the scene view,but in the game view the canvas is not getting on the scene.But whereas in the camera view its showing the canvas.What will be the issue?.

When I set me canvas Rendere mode to Screen Space-Overlay the canvas is getting displayed in the scene but as the lookup change,the canvas is also moving along with the camera

Can anybody please help me out.

sentences: Eclipse/LibGDXgame doesn't load textures Our LibGDX project doesn't load textures after building on PC/Android but when it's built from Eclipse using  Ctrl + F11 (Run/Debug) everything is fine. What could be causing that?

sentences:
How to cut a desired shape out of a mesh? I want the player to be able to cut a hole through a wall, similar to what's shown in this video

I know for the fact that it's really difficult to achieve, so I was wondering how I can cut a shape out of a simple mesh at run time (or even cut a shape out of a 2D sprite).

sentences:
unity2D Top-Dow Mobile rigibody2D im using this code for my 2D TopDown mobile player movement.but when i move player With UI Image buttons player keep moving.it didnt stop.and also player starting of move he is very slow. the he accelerate his speed.how can i fix this.

i add BoxCollider 2D and Rigibody2D my sprite.the set Gravity to 0.

this is my code.

    public class PlayerScript : MonoBehaviour {
public float speed = 150f;
float hInput ;
void FixedUpdate()
{
    Move (hInput);

}

public void Move(float horizontalInput){
    if (horizontalInput.Equals(1)) {
                    rigidbody2D.AddForce (Vector2.right);

    }if (horizontalInput.Equals(2)) {
        rigidbody2D.AddForce (-Vector2.right);
    }if(horizontalInput.Equals(3)) {
        rigidbody2D.AddForce (Vector2.up);
    }
    if(horizontalInput.Equals(4)) {
        rigidbody2D.AddForce (-Vector2.up);
    }
    }

    public void StartMoving(float horizontalInput){
    hInput = horizontalInput;
    }
    }

sentences: Asset opening wrong unity version 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.)

sentences:
Problem to match font size to the screen resolution in libgdx I'm having problems to show text on my game at same size on different screens, and I did a simple test.

This test consists to show a text fitting at the screen, I want the text has the same size independently from the screen and from DPI.

I've found this and this answer that I think should solve my problem but don't. In desktop the size is ok, but in my phone is too big.

This is the result on my Nexus 4: (768x1280, 2.0 density)

And this is the result on my MacBook: (480x800, 0.6875 density)

I'm using the Open Sans Condensed (link to google fonts)

As you can see on desktop looks good, but on the phone is so big.

Here the code of my test:

public class TextTest extends ApplicationAdapter
{
    private static final String TAG = TextTest.class.getName();
    private static final String TEXT = "Tap the screen to start";

    private OrthographicCamera camera;
    private Viewport viewport;

    private SpriteBatch batch;
    private BitmapFont font;

    @Override
    public void create ()
    {
        Gdx.app.log(TAG, "Screen size: "+Gdx.graphics.getWidth()+"x"+Gdx.graphics.getHeight());
        Gdx.app.log(TAG, "Density: "+Gdx.graphics.getDensity());

        camera = new OrthographicCamera();
        viewport = new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getWidth(), camera);
        batch = new SpriteBatch();

        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/OpenSans-CondLight.ttf"));
        font = createFont(generator, 64);
        generator.dispose();
    }

    private BitmapFont createFont(FreeTypeFontGenerator generator, float dp)
    {
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();

        int fontSize = (int)(dp * Gdx.graphics.getDensity());
        parameter.size = fontSize;

        Gdx.app.log(TAG, "Font size: "+fontSize+"px");

        return generator.generateFont(parameter);
    }

    @Override
    public void render ()
    {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        int w = -(int)(font.getBounds(TEXT).width / 2);

        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        font.setColor(Color.BLACK);
        font.draw(batch, TEXT, w, 0);
        batch.end();
    }

    @Override
    public void resize(int width, int height)
    {
        viewport.update(width, height);
    }

    @Override
    public void dispose()
    {
        font.dispose();
        batch.dispose();
    }
}

I'm trying to find a neat way to fix this.
What I'm doing wrong? is the camera? the viewport?

UPDATE:

What I want is to keep the same margins in proportion, independently of the screen size or resolution. This image illustrates what I mean.

sentences:
3D Texture Mapping (Atlas) This is a pretty simple question. If I was to use multiple images in a single texture for a 3D cube, how would I go about re-using each vertex (having 8 total vs 24)?
With a single buffer of 8 vertices, I don't see how I'd properly reuse the UV values.
Any help on that? I know it's not terribly clear, but I figured it was a simple question.
The 2D method is pretty easy, the next coordinates would be the same as the first (0,0 and 0,1 respectively).

However, the above 3D version has me quite befuddled.

sentences:
Fitting a rectangle into screen with XNA I am drawing a rectangle with primitives in XNA. The width is:

width = GraphicsDevice.Viewport.Width

and the height is

height = GraphicsDevice.Viewport.Height

I am trying to fit this rectangle in the screen (using different screens and devices) but I am not sure where to put the camera on the Z-axis. Sometimes the camera is too close and sometimes to far.

This is what I am using to get the camera distance:

//Height of piramid
float alpha = 0;
float beta = 0;
float gamma = 0;

alpha = (float)Math.Sqrt((width / 2 * width/2) + (height / 2 * height / 2));
beta = height / ((float)Math.Cos(MathHelper.ToRadians(67.5f)) * 2);
gamma = (float)Math.Sqrt(beta*beta - alpha*alpha);

position = new Vector3(0, 0, gamma);

Any idea where to put the camera on the Z-axis?

sentences:
TiledMap renders but gets duplicated when I move the camera I've created a map (TMX file) using Tiled, imported it and it shows great but when I move the camera, it duplicates itself and the whole screen flickers.
In Tiled, I didn't use a spritesheet but rather a collection of images as they have different sizes.

See attached image:

Here is my game class:

public class MyGdxGame extends ApplicationAdapter {

    private IsometricTiledMapRenderer renderer;
    private OrthographicCamera camera;
    private TiledMap map;
    private Vector2 dragOld, dragNew;

    @Override
    public void create() {

        map = new TmxMapLoader().load("isometric_map.tmx");
        renderer = new IsometricTiledMapRenderer(map);

        camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);

        Gdx.input.setInputProcessor(new InputAdapter() {
            public boolean touchDown(int screenX, int screenY, int pointer, int button) {
                if (button == Input.Buttons.LEFT) {
                    dragNew = new Vector2(Gdx.input.getX(), Gdx.input.getY());
                    dragOld = dragNew;
                    return true;
                }

                return false;
            }
        });
    }

    @Override
    public void render() {
        super.render();

        camera.update();

        renderer.setView(camera);
        renderer.render();

        if (Gdx.input.isTouched()) {
            dragNew = new Vector2(Gdx.input.getX(), Gdx.input.getY());
            if (dragOld != null && !dragNew.equals(dragOld)) {
                camera.translate(((int) dragOld.x - dragNew.x), ((int) dragNew.y - dragOld.y)); //Translate by subtracting the vectors
                camera.update();
                dragOld = dragNew; //Drag old becomes drag new.
            }
        }
    }

    @Override
    public void resize(int width, int height) {
        super.resize(width, height);

        camera.viewportWidth = width;
        camera.viewportHeight = height;
        camera.update();
    }

    @Override
    public void dispose() {
        super.dispose();

        map.dispose();
    }
}

What am I missing?

sentences:
Unity Animator default values overwriten I have created a project to reproduce the problem I'm currently facing.
I'm running a simple unity animation that moves a game object and expect to be able to reset the gameobject position. This can be done by adding an empty animation, that (since it does not change anything) simply writes the default values, thus returning our gameobject to its original position.

But here is where things get complicated: if the animator gameobject is set inactive while the animation is running, new incorrect defaults values will be saved when gameobject is activated, and I am unable to reset my gameobject position.

To reproduce this issue, run the attached project:
(Download from here)

Change the stop method to "PlayEmpty"
Hit Start Animation and watch the left "Hello world" text travel.
While it is traveling, click Disable Text GO. The left text disappears.
Click Enable Text GO and see the text comes back at its last location.
Click Start Animation and watch the left "Hello world" text travel.
Click Stop Animation - the text is returned to the position where it was when enabling the gameobject, rather than its original position.

Any help is welcome, suggestions on how to change the code to make the above scenario work.

Thanks,
Yaniv

sentences:
Unity SkinnedMeshRender: is there a way to cache mesh and restore later? In unity, I'm writing a script that deforms a mesh associated with a SkinnedMeshRenderer pretty significantly. However, at some point, I'd like to reset it back to particular states. I'd like the ability to both reset to its original position, and an intermediate position.

Right now, I've tried baking the mesh:

Mesh originalMesh = new Mesh();
skinnedMeshRenderer.BakeMesh(originalMesh);

But when I then try to restore it:

skinnedMeshRenderer.sharedMesh = originalMesh;

It doesn't seem to behave as I would have expected.

I've also tried:

Mesh originalMesh = skinnedMeshRenderer.sharedMesh;
//deform sharedMesh
skinnedMeshRenderer = originalMesh;

but this does nothing since it seems to be just storing a reference.

Am I missing something obvious here?

Just to add detail, I want to take a snapshot of all the verticies, weights, blendshapes, etc. And then restore everything back to the snapshot at a later moment in time. I can reset the blendshapes fine, but the mesh seems to be messed up.

sentences:
How do I call OpenGL methods that require pointers in C#? I have found the following C++ code in this tutorial to draw a triangle with OpenGL 4:

float points[] = {
   0.0f,  0.5f,  0.0f,
   0.5f, -0.5f,  0.0f,
  -0.5f, -0.5f,  0.0f
};
GLuint vbo = 0;
glGenBuffers (1, &vbo);
glBindBuffer (GL_ARRAY_BUFFER, vbo);
glBufferData (GL_ARRAY_BUFFER, 9 * sizeof (float), points, GL_STATIC_DRAW);

I use C# and OpenTK, so I tried to translate the code:

        float[] points =
        {
           0.0f,  0.5f,  0.0f,
           0.5f, -0.5f,  0.0f,
          -0.5f, -0.5f,  0.0f
        };
        uint[] vbo = {0};
        GL.GenBuffers(1, vbo);
        GL.BindBuffer(BufferTarget.ArrayBuffer, vbo[0]);
        GL.BufferData(BufferTarget.ArrayBuffer, 9 * sizeof(float), ppoints, BufferUsageHint.StaticDraw);

The problem is that GL.GenBuffers() and GL.BufferData() require pointers (Visual Studio shows *int or out int and ref float*, IntPtr).

I've tried to fix this, but it didn't work:

        float[] points =
        {
           0.0f,  0.5f,  0.0f,
           0.5f, -0.5f,  0.0f,
          -0.5f, -0.5f,  0.0f
        };
        uint[] vbo = {0};
        GL.GenBuffers(1, vbo);
        GL.BindBuffer(BufferTarget.ArrayBuffer, vbo[0]);

        unsafe
        {
            fixed (float* ppoints = points)
            {
                GL.BufferData(BufferTarget.ArrayBuffer, 9 * sizeof(float), ppoints, BufferUsageHint.StaticDraw);
            }
        }

So my question is how to use these methods in a good C# style?

sentences:
Asset is up to date but does not have a correct hash assigned in GuidPersistentManager I have a ScriptedImporter that generates a few extra assets, this works fine except when I re-import it after version upgrade, I get the following message:

Asset with guid 'bbe94cef9d5f3464ab6ba6913e6747a2' and path '...' is up to date, but does not have a correct target hash assigned to it in the GuidPersistentManager
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

Inside that ScriptedImporter I've tried File.Delete, AssetDatabase.Refresh, AssetDatabase.ImportAsset but neither helped out, only when I delete it manually it does work.

Furthermore, that error message is quite useless as basically Unity handles it but still notifies you.

Note that the asset generated is next to the format being imported, this is because if for instance you create a texture and add it to the AssetImportContext then it becomes readonly in the Inspector and cannot be tweaked further. So basically I generate a PNG file in same folder which then has the usual TextureImporter that can be edited as will.

Question:

How to avoid incorrect GUID errors when re-importing an asset generated by a ScriptedImporter?

Alternatively, how to solve this incorrect GUID clash when overwriting an asset?

sentences:
How to fill with empty space with retangles I have a 'square' class with the representation of its limits from the variables x1, y1 and x2, y1 these variables define points 1 and 3 of the same, in this case the coordinates would be (0,0), (10, - 10):

From this drawing I want to insert rectangular areas, also defined through x1, y1, x2, y2 coordinates, within that area. In this example case I will use the following values (input):
area1 = (0,0)(3,-3),
area2 =  (4,-2)(6,-4),
area3 =  (8,-1)(10,-4),
area4 =  (1,-5)(6,-7),
area5 =  (7,-6)(9,-9)

How to obtain a function from there that returns the rectangles (coordinates) of the largest possible areas within the remaining empty areas and not occupied within the main square, as shown in the visual representation?

Notice, the output of the function in this case should be:
outputArea1 = (3,0)(8,-2),
outputArea2 = (8,0)(10,-1),
outputArea3 = (3,0)(4,-3),
outputArea4 = (6,-2)(8,-4),
outputArea5 = (6,-4)(10,-6),
outputArea6 = (0,-5)(1,-7),
outputArea7 = (6,-6)(7,-7),
outputArea8 = (9,-6)(10,-10),
outputArea9 = (0,-7)(7,-10),
outputArea10 = (7, -7)(9,-9),
outputArea11 = (7,-8)(9,-10)
The following code demonstrates the implementation without the requested function:
class Retangle {

borderLimitX1 = 0;
borderLimitX2 = 10;
borderLimitY1 = 0;
borderLimitX2 = -10;

static void Main() {

    List < Retangle > areas = new List < Retangle > ();

    ///areas.Add(x1,x2,y1,y2)

    areas.Add(0, 0, 3, -3);
    areas.Add(4, -2, 6, -4);
    areas.Add(8, -1, 10, -4);
    areas.Add(1, -5, 6, -7);
    areas.Add(7, -6, 9, -9);

    List < Retangle > remainingAreas = CalculateRemainingAreas(areas);

}

List < Retangle > CalculateRemainingAreas(List < Retangle > originalAreas) {

    List < Retangle > remainingAreas = new List < Retangle > ();

    ///// --> Algorithm to calculate Remaining Areas   <-- ///

    return remainingAreas;
}
}

  internal class Retangle {
int x1,
y1;
int x2,
y2;

Retangle(int x1, int y1, int x2, int y2) {
    this.x1 = x1;
    this.y1 = y1;
    this.x2 = x2;
    this.y2 = y2;
}

}

sentences:
Beginner question about vertex arrays in OpenGL Is there a special order in which vertices are entered into a vertex array?  Currently I'm drawing single textures like this:

glBindTexture(GL_TEXTURE_2D, texName);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, coordinates);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

where vertices has four "xy pairs".  This is working fine.

As a test I doubled the sizes of the vertices and coordinates arrays and changed the last line above to:

glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

since vertices now contains eight "xy pairs".  I do see two textures (the second is intentionally offset from the first).  However the textures are now distorted.  I've tried passing GL_TRIANGLES to glDrawArrays instead of GL_TRIANGLE_STRIP but this doesn't work either.  I'm so new to OpenGL that I thought it's best to just ask here :-)

Cheers!

sentences:
How can I make my character jump? I'm trying to make a platformer. I'm trying to figure out how to make my character jump. I have tried setting a direction variable (after I enabled physics on the room, the character, etc), and it does jump, but it spins, and falls weird. I just want a simple Mario jumping up or something.

I'm using Game Maker Studio 2 (drag-n-drop).

sentences:
How do I optimize searching for the nearest point? For a little project of mine I'm trying to implement a space colonization algorithm in order to grow trees.

The current implementation of this algorithm works fine. But I have to optimize the whole thing in order to make it generate faster. I work with 1 to 300K of random attraction points to generate one tree, and it takes a lot of time to compute and compare distances between attraction points and tree node in order to keep only the closest treenode for an attraction point.

So I was wondering if some solutions exist (I know they must exist) in order to avoid the time loss looping on each tree node for each attraction point to find the closest... and so on until the tree is finished.

sentences:
Raycasting to AddForceAtPosition goes to the wrong direction I'm trying to get my coin object's Rigidbody to move whichever way it was swiped on by the user through RayCast

void Awake()
{
    coinRigidBody = coin.GetComponent<Rigidbody>();
}

void Update()
{

    foreach (Touch touch in Input.touches)
    {
        if (touch.phase == TouchPhase.Began)
        {
            firstTouchPos = new Vector3(touch.position.x, touch.position.y, Camera.main.nearClipPlane);
        }
        if (touch.phase == TouchPhase.Moved)
        {

            lastTouchPos = new Vector3(touch.position.x, touch.position.y, Camera.main.farClipPlane);
        }

        if (touch.phase == TouchPhase.Ended)
        {

            Vector3 firstTouchWorldPos = Camera.main.ScreenToWorldPoint(firstTouchPos);
            Vector3 lastTouchWorldPos = Camera.main.ScreenToWorldPoint(lastTouchPos);
            Vector3 diffWorldPos = lastTouchWorldPos - firstTouchWorldPos;
            direction3D = diffWorldPos.normalized;
            power = diffWorldPos.magnitude * (force / Time.deltaTime);

            Ray firstTouchRay = Camera.main.ScreenPointToRay(firstTouchPos);
            Ray lastTouchRay = Camera.main.ScreenPointToRay(lastTouchPos);

            RaycastHit hit;
            Debug.DrawRay(firstTouchRay.origin, lastTouchRay.direction - firstTouchRay.direction, Color.red, 50.0f);

            if (Physics.Raycast(firstTouchRay.origin, lastTouchRay.direction * 100, out hit))
            {
                Vector3 hitLocation = hit.point;
                if (hit.collider.tag == "Coin")
                {

                    projectedVector = Vector3.ProjectOnPlane(direction3D, plane.normal);
                    coinRigidBody.AddForceAtPosition(projectedVector * power, hitLocation * 5);
                    throwCoinObject.throwWithForce(power, hitLocation, direction3D);
                }
            }
        }
    }
}

The Code is working but my only problem is that it goes only in a certain direction? And it seems that direction is manipulated by how the camera is facing the objects.
I just want it to hit the first touch origin then move to the direction the swipe was made.

Help would be really appreciated

sentences:
Calculating the bounding box of a game object based on its children 2D game with Unity. Have a parent game object, with several children objects scattered all over the scene.

I want to calculate the bounding rectangle of the parent game object.

Let the black dots be the children objects. The red rectangle is the bounding box. I am not really interested in the position - I only want the dimensions of such box.

Of course, the bounding box should also consider the bounding boxes of the children... and so on.

How can I achieve this? I heard that Renderer has a bounds property... but my parent object doesn't have a renderer. And when I put one, the value is 0 anyway.

sentences:
Coroutines in series How would i go about stacking up a series of Coroutine calls that should be executed one after the other?

I have tried getting a flashing color effect looping a series of color lerps in a coroutine but its not working.

sentences:
How can I implement pre-rendered 2D sprites that can face any direction? I've been Googling how games like Clash of Clans render their troops, and it appears they are pre-rendering 3D models to 2D sprite sheets before runtime, and rendering those 2d images at runtime. However, troops in Clash of Clans can face any direction.

In my similar game, if I were to create an image for every orientation (0-360 degrees) for every troop type (there are 18 types) at each frame in their animation, they would have to produce a massive amount of images. I can't imagine this is what other developers are doing, so how can I actually accomplish this?

sentences:
Adding character stats/traits in Ren'py I'm coding a relatively simple VN with RPG elements in Ren'py, with little prior programming knowledge. There's one aspect that I can't simplify further because it's important to the game's branches, but that I'm not sure how to enact.

There are four traits/stats the main character can have in this game:

Viciousness
Intelligence
Creativity
Charisma

You have two of the four. They don't have levels or anything -- it's simply 'do you have this trait or not'. You can't change traits after picking the two of them, you just have e.g. a Creativity/Viciousness build for the rest of that playthrough.

With my limited prior knowledge, the only way I can figure out how to enact this is with a giant mess of if-else statements. You would, for instance, start with:

default Intelligence = False

Then if you pick Intelligence as one of your stats:

$ Intelligence = True

Then, for anything further that requires Intelligence (or precludes it, as the case may be):

if Intelligence = True

But this sounds like a giant overcomplicated mess if I'm doing it for each and every time the game checks if you have/don't have a trait. There's a better way. What is it?

sentences:
POST JSON method does not work when project has been exported to WEBGL and uploaded to firebase hosting I have a database set up on firebase and when i run my game in the unity edtitor and as a standalone exported Windows .exe file, the call gets made correctly to the database and JSON data gets posted correctly. However when I export the exact same project to WEBGL and upload it to my firebase hosting server, the JSON call does not work. Here is my code, could someone please help?

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

 public class GameOverMenu : MonoBehaviour
{
 public InputField nameInputField;

 public void MainMenu()
 {
     SceneManager.LoadScene("Menu");
 }

 public void SubmitScore()
 {
     StartCoroutine(SendScore());
     SceneManager.LoadScene("Menu");
 }
 // Use this for initialization
 void Start()
 {

 }

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

 }

 public IEnumerator SendScore()
 {
     Scoreboard s = new Scoreboard(nameInputField.text, PlayerPrefs.GetInt("Score"), PlayerPrefs.GetInt("Seed"));
     Dictionary<string, string> headers = new Dictionary<string, string>();
     headers.Add("Content-Type", "application/json");
     Hashtable data = new Hashtable();
     data.Add("name", s.Name);
     data.Add("score", s.Score);
     data.Add("seed", s.Seed);

     UnityHTTP.Request postRequest = new UnityHTTP.Request("post", "https://alexclearythesisgame.firebaseio.com/Scoreboard.json", data);
     postRequest.Send();
     yield return postRequest.isDone;
 }

}

sentences:
ShaderBytecode Compiler one technique multiple passes I have an effect code with a basic structure like

technique TechniqueName {
    pass FirstPass {
        Profile = fx_4_0
        VertexShader = RenderFirstVS
        GeometryShader = null
        PixelShader = RenderFirstPS
    }
    pass SecondPass {
        Profile = fx_4_0
        VetrexShader = RenderSecondVS
        GeometryShader = null
        PixelShader = RenderSecondPS
    }
    pass ThirdPass {
        Profile = fx_4_0
        VertexShader = RenderThirdVS
        GeometryShader = null
        PixelShader = RenderThirdPS
    }
}

Now I tried to compile this with

using (BinaryReader reader = new BinaryReader(stream)) {
    CompilationResult result = ShaderBytecode.Compile(reader.ReadBytes((int)stream.Length), "fx_4_0");
    if (result.HasErrors) {
        throw new Exception(result.Message, new Exception(result.ResultCode.ToString()));
    }
    Data = result.Bytecode.Data;
}

stream is new MemoryStream(Encoding.Default.GetBytes(effectContent)).
The Data-Property (byte[]) is about 1 KiB large but if I try to load it via

context.InputAssembler.InputLayout = new InputLayout(device, effect.Data, someElements)

it crashes with following exception D3D11 ERROR: ID3D11Device::CreateInputLayout: Input Signature in bytecode could not be parsed.  Data may be corrupt or in an unrecognizable format. [ STATE_CREATION ERROR #161: CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE]

Any idea how I can fix this or why the error is thrown? I do not want to use multiple shaders because I reuse many parameters I do not want to reassign in a deferred shading setup.

sentences:
How to clip textures when drawing? How do i draw a texture2D in a specific area (rectangle) where the texture is bigger than the rectangle, and i dont want to draw outside the rectangle. So that means i want to cut the texture so it fits the rectangle area (if its too big).

For example if the rectangle area is 200 x 100 and my texture (the smiley) is 200 x 150
then i want to cut the last 50 off so it only draws 200 x 100

sentences:
How do I make parts of a texture transparent in Max? I am applying an eye.psd eye-texture to my character model's face, but the results aren't what I'm expecting.

Here's what it looks like (Observe the eye on the right. Ignore the other one.):

The image is attached to a quad. I want to either

change the color of the blank area to the skin color, as it is nearby, or
make the image be the shape of the eye instead of square?

As shown, my image is a square and parts of it show as white, even though I erased them in Photoshop:

I expected this area to be skin-coloured:

How can I make this work right?

sentences:
Collision detection in Pong clone Well I'm trying to create a pong clone using SDL and I had some problems with the frames and some times the ball would go through the paddles despite the fact that at other times the collision worked perfectly. So I searched it a bit and I came to the conclusion that it was because in one frame the ball was already through the paddle and in another frame the ball was not or something like this. So thought that if I would manually adjust the position of the ball, like move it a couple of pixels away the moment it hits a paddle or the walls too, this would solve the problem. But now when the ball goes right past a paddle its movement is getting weird and it goes right in the playing field.  for reference also some code if you want to look it . I feel bad for doing the whole collision like these but I couldn't think some other way. Please enlighten me if there are better ways to do it that I can avoid the frame problem I mentioned above. Here is the code that handles the ball's movement :

   void Ball::move(float xLeftPaddle, float yLeftPaddle,float xRightPaddle, float yRightPaddle, Uint32 deltaTicks)
{

    y +=  yVelocity * ( deltaTicks / 1000.f );
    x +=  xVelocity * ( deltaTicks / 1000.f );

    if(   y + BALL_HEIGHT > SCREEN_HEIGHT )
    {
        x = x-1;
        y = y-1;
        yVelocity = -yVelocity;

    }
    else if( y < 0 )
    {
        x = x+1;
        y = y+1;
        yVelocity = -yVelocity ;
    }
    else if(x + BALL_WIDTH >= xRightPaddle && y <= yRightPaddle + PADDLE_HEIGHT && y >=yRightPaddle  )
    {
        x = x-1;
        y = y-1;
        xVelocity = -xVelocity;

    }
    else if( x <= xLeftPaddle + PADDLE_WIDTH && y <= yLeftPaddle + PADDLE_HEIGHT && y >= yLeftPaddle)
    {
        x = x+1;
        y = y+1;

        xVelocity = -xVelocity ;
    }
    else if(x < 0 || x > SCREEN_WIDTH)
    {
        x = SCREEN_WIDTH/2;
        y = SCREEN_HEIGHT/2;
    }

}

sentences: How to create same paradigm of monobehaviour and processing in C++ Having worked with monobehaviour and processing before, is it possible to create the same paradigm both frameworks use which basically is writing all code in two main functions, start/setup and update/draw. To further elaborate, much like working in unity when creating a new script the user is presented with two functions a start and an update. The first function always gets called on the first frame while the latter gets called every frame there is no main function present only these two. I'd like to imitate that same structure on to c++.

sentences:
How do I convert screen coordinates to between -1 and 1? I'm writing a function that allows me to click on my tiles. The origin for my tiles is the center, however, the mouse's origin is the top left. I need a way to transform my mouse coordinates into my tile coordinates.

Here is what I already have (but is not working):

void mouseClick(int button, int state, int x, int y)
{
    x -= 400;
    y -= 300;
    float xx = x / 100; // This gets me close but the number is still high.
    float yy = y / 100; // It needs to be between -1 and 1
}

sentences: How to place an object so that it does not overlap the objects in my scene? In my game, the user has to click at a point to place an object (mesh). I can cast a ray and find the horizontal point where the object can be translated and then attached to rootNode to display it. However, the problem is that if the user click too near to another object/scene_wall the object to be placed, runs into it. How can I prevent that?

sentences:
Player area in navmesh? In my game, If i click on terrain my soldier goes there. In my terrain there is no place without a navmesh. So, I want to make area where player moves his soldiers on it. If he clicks outside this area, soldier will not move there or moves to closest point inside the area to this outside. Could invisible wall do this ?
Image.Image2.
update:
To solve this, make any object fit your area. then, use mouse to detect that object.

sentences: How do I deal with scale of the universe when generating a simulated universe? I have a dataset of 100,000 actual stars. I wish to create a game where I can fly between the stars and fly up to them and click on them etc. How do I go about dealing with the problem of the scaling of the universe, even If I were to allow fast as light travel it would be too vast. Should I cluster my data and then implement a subtle sort of scaling to move around? Sorry for the broad question but I'm rather stuck at the moment.

sentences:
How to add ambiant occlusion to a mesh created by script We created a mesh point by point with a script (a huge mesh), and we would like to add ambiant occlusion to this mesh.
We use Unity 2019.1.6 and the LWRP template.

we already tested the unity ambiant occlusion post-processing , but it's not working on any gameobject...
We searched for tutorials but on Unity 2019 it's pretty uncommon.

Edit:
High quality AO isn't our goal, we just want to better see the difference between two faces of same colour.
We create the whole mesh (vertices and triangles) in script following the Sebastian Lague tutorial about planet generation. (Here's the first ep. link )

Our code is basically the same : loop over whole array, determine the world position of the vertex and save triangle indexs, then give all of this to the mesh component.

We "patched" the problem for now by adding a flat shader to it.

Edit 2 : How we determine world position of each vertex.

We are creating a plane mesh of [resolution * resolution] vertices. Then we apply noises to create a landscape.

(localUp, axisA and axisB can be replaced by x, y and z, we use them because we create 6 meshes for the 6 sides of the planet.)

Here's the loop for creating the vertices :

    for (int y = 0; y < resolution; y++)
    {
        for (int x = 0; x < resolution; x++)
        {
            int i = x + y * resolution; //index of this vertex on mesh
            //pointOnUnitCube determines the position of the vertex on the mesh
            Vector3 pointOnUnitCube = localUp + (percent.x - .5f) * 2 * axisA + (percent.y - 0.5) * 2 * axisB;
            //Transforms the cube to a sphere by normalizing
            Vector3 pointOnUnitSphere = pointOnUnitCube.normalized;
            //the ShapeGenerator uses noises to change the "height" of this pointOnUnitSphere
            vertices[i] = shapeGenerator.CalculatePointOnPlanet(pointOnUnitSphere);

            //Add to the triangles index array the 2 triangles this point is part of
            if (x != resolution - 1 && y != resolution - 1)
            {
                triangles[triIndex] = i;
                triangles[triIndex + 1] = i + resolution + 1;
                triangles[triIndex + 2] = i + resolution;

                triangles[triIndex + 3] = i;
                triangles[triIndex + 4] = i + 1;
                triangles[triIndex + 5] = i + resolution + 1;
                triIndex += 6;
            }
        }
    }

Have you any idea how we could achieve this ?

Thanks for your answers.

sentences:
XNA/MonoGame RenderTargets not working I'm having a problem with drawing 2 RenderTargets to the screen.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Content;

namespace Please
{
    class Class1
    {
        RenderTarget2D rt;
        Texture2D temp;
        Vector2 v;
        public Class1(Vector2 v,GraphicsDevice g)
        {
            this.v = v;
            rt=new RenderTarget2D(g,800,600);
        }

        public void Draw(SpriteBatch sb,GraphicsDevice gd,ContentManager cm)
        {
            gd.SetRenderTarget(rt);
            sb.Begin();
            sb.Draw(cm.Load<Texture2D>("Untitled.png"),v,Color.White);
            sb.End();
            gd.SetRenderTarget(null);

            temp = (Texture2D)rt;

            sb.Begin();
            sb.Draw(temp, Vector2.Zero, Color.White);
            sb.End();
        }
    }
}

Here's my draw function in the actual "game"

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);
    base.Draw(gameTime);
    one.Draw(spriteBatch, graphics.GraphicsDevice, Content);
    two.Draw(spriteBatch, graphics.GraphicsDevice, Content);
}

one and two have positions (100,200) and (300,200) respectively, so, they should be drawn 100 pixels apart, however, only two is being drawn with the rest of the screen black

sentences:
Issues to display a texture loaded with libPNG with opengles 3.0 I'm trying to load a texture loaded with libPNG on a XY coordinates. I know the width and the height of the texture (32x32).

The texture is already loaded successfully and I have his Id.

Here is my function to print any (32x32) texture on a XY position :

void printTexture(GLuint idTexture, GLfloat x, GLfloat y) {
    glActiveTexture(GL_TEXTURE0);
    glBindVertexArray(this->VAO[0]);
    glUniform1i(this->mTagShaderHandle, 0); //to execute a particular code on the Pixel Shader
    glUniform1i(this->mTextShaderHandle, 0); //the uniform Sampler2D from my Fragment Shader bound to 0.

    GLfloat xpos = x;
    GLfloat ypos = y;

    GLfloat w = 32;
    GLfloat h = 32;

    GLfloat vertices[6][4] = {
            { xpos,     ypos + h,       0.0, 0.0 },
            { xpos,     ypos,           0.0, 1.0 },
            { xpos + w, ypos,           1.0, 1.0 },

            { xpos,     ypos + h,       0.0, 0.0 },
            { xpos + w, ypos,           1.0, 1.0 },
            { xpos + w, ypos + h,       1.0, 0.0 }
    };

    glBindTexture(GL_TEXTURE_2D, idTexture);
    checkGlError("glBindBuffer");

    glBufferSubData(GL_ARRAY_BUFFER, GL_ZERO, sizeof(vertices), vertices);
    glDrawArrays(GL_TRIANGLE_STRIP, GL_ZERO, 6);
    glBindVertexArray(GL_ZERO);
    glBindTexture(GL_TEXTURE_2D, GL_ZERO);
}

Here is how I initialize my VAO and VBO :

glBindVertexArray(this->VAO[0]);
glBindBuffer(GL_ARRAY_BUFFER, this->VBO[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 6 * 4, GL_ZERO, GL_DYNAMIC_DRAW);
glEnableVertexAttribArray(GL_ZERO);
glVertexAttribPointer(GL_ZERO, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), GL_ZERO);
glBindVertexArray(GL_ZERO);

Here is how I set up my texture:

glTexImage2D(GL_TEXTURE_2D, GL_ZERO, GL_RGB, temp_width, temp_height, GL_ZERO, GL_RGB, GL_UNSIGNED_BYTE, image_data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);

And my Vertex Shader :

const char           gVertexShader[] =
        "#version 320 es\n"
        "layout (location = 0) in vec4 vertex;\n"
        "out vec2 TexCoords;\n"
        "uniform mat4 projection;\n"
        "uniform int tag;"
        "void main() {\n"
                "  gl_Position = projection * vec4(vertex.xy, 0.0, 1.0);\n"
        "  if (tag > 0) {\n"
        "      TexCoords = vertex.zw;\n"
        "  } else {\n"
        "      TexCoords = vertex.xy;\n" //here is the code that should be executed by the pixel shader program because Tag = 0.
        "  }\n"
        "}\n";

The texture is not displaying at all. I tried a lot of things but nothing change. I should keep this pixel shader because I have some functions to print texts so that's why I have the if/else statement on my Pixel Shader code.

What's wrong with my code ?

Thanks a lot for help.

sentences: Is using a half-edge mesh structure feasible? Is it feasible to use half-edge mesh, in games, instead of vertex-face structure? What comes to my mind is that it could be useful in mesh simplification (dynamic level of detail). However, I'm worried it could take too much memory, or even have a negative impact on a games rendering performance.

sentences:
How should I go about abstracting away the graphics device? I would like to be able to move my game from using a XNA graphics device to possibly an OpenGL device in the future. So I'd like to have a somewhat abstract interface to submit polygons to. Its ok if it does not fully hide the directx pipeline. I simply want something that takes in a bunch of vertices and draws them.

I was wondering if anyone has done this and/or if you guys had any advice for me.

sentences:
Set the start orientation of the gyroscope to initial phone orientation I am making a mobile VR project in Unity, and I have a 360-degree video that starts playing where I can look around using a VR headset.

I am trying to set the start rotation of the video to the same rotation as my phone. So no matter where I look when I start the video, that should be my start rotation. I used Input.gyro.attitude in the start but that did not fix my problem. I think I am using it wrong.

This is my code (on the camera inside the sphere):

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

public class Gyroscope : MonoBehaviour
{
    private bool gyroEnabled;
    private Gyroscope gyro;
    private GameObject cameraContainer; //A camera container for my main camera
    private GameObject videoSphere; //The sphere my video is in
    private Quaternion rot;

    private void Start()
    {
        videoSphere = GameObject.FindGameObjectWithTag("Video");
        cameraContainer = new GameObject("Camera Container");

        gyroEnabled = EnableGyro();

        cameraContainer.transform.position = transform.position; // put the cameracontainer into the sphere
        cameraContainer.transform.rotation = Input.gyro.attitude; // here I want to set the cameracontainer to the rotation of my phones gyroscope
        transform.SetParent(cameraContainer.transform); // make my main camera a child of the camera Container

        videoSphere.transform.localRotation = cameraContainer.transform.rotation; // Here I wanted to set my sphere rotation to the camera rotation
        Debug.Log(videoSphere.transform.localRotation);
    }

    private bool EnableGyro()
    {
        if (SystemInfo.supportsGyroscope)
        {
            Input.gyro.enabled = true; // turn on my gyroscope

            cameraContainer.transform.rotation = new Quaternion(0, 90, -90, 0); // rotate my camera container so the video shows good
            rot = new Quaternion(0, 0, 1, 0); // set the variable rot so that you can turn your device
            return true;
        }
        return false;
    }

    private void Update()
    {
        if (gyroEnabled)
        {
            transform.localRotation = Input.gyro.attitude * rot; //this makes you turn the device and it recognizes the input of the phones gyroscope
        }
    }
}

sentences:
How do I make a MoveToward() GameObject jump without Rigidbody, CharacterController or Raycast? I have a prefab that is moving from one point to another thanks to  MoveTowards().

Currently, I am having trouble with a functionality where the player can press a button and make the object jump, affecting only the Y coordinate.

I tried doing the following before putting the MoveTowards() code down:

void Start()
{
    playerInstance = Instantiate(playerPrefab, startPos.position, Quaternion.LookRotation(endPos.position), null);
    speed = Random.Range(2f, 8f);

    currentPlayerInstancePositionY = playerInstance.transform.position.y;
    isGrounded = true;
}

void Update()
{
    if (isGrounded)
    {
        if (Input.anyKeyDown)
        {
            playerInstancePositionY = jumpForce;
        }
        else
        {
            playerInstancePositionY = currentPlayerInstancePositionY;
        }
    }
    else
    {
        playerInstancePositionY -= gravity * Time.deltaTime;
    }

    currentPlayerInstancePositionY = playerInstancePositionY;

    playerInstance.transform.position = Vector3.MoveTowards(playerInstance.transform.position, endPos.position, speed * Time.deltaTime);

I just used custom gravity to decide when the object falls. But the problem I found was that MoveTowards() takes a Start Position, an End Position and a Float in its method. But it cannot change individual coordinate values.

As the only control you have over the object is making it jump, I was wondering if there was another way to implement this since the Y value is not being inserted into the prefab before it is given the MoveTowards() function. I am trying to implement the jump mechanic without any RigidBodies, CharacterControllers or Raycasts.

Any help would be appreciated.

sentences:
How to calculate corner positions/marks of a rotated/tilted rectangle? I've got two elements, a 2D point and a rectangular area. The point represents the middle of that area. I also know the width and height of that area. And the area is tilted by 40° relative to the grid.

Now I'd like to calculate the absolute positions of each corner mark of that tilted area only using this data. Is that possible?

sentences: Animator animation does not show in game after gameobject is disabled and re-enabled I'm trying to understand why an animator stops working in-game after a gameobject is disabled and then re-enabled. The animator pane shows the animation is still going on, but the character is no longer animated in the game/scene.

sentences:
Preventing Unity from writing to the registry? I see that Unity automatically writes some info to registry when it launches the game. Several people have this problem too:

Preventing Unity from writing to the registry.

How to disable writing to Windows registry?

It seems several years have passed but I still can't find how to prevent Unity from writing to registry. I just want to make Unity save & load settings from file in document folder.

sentences:
Opengl shader questions I'm currently building a shader that takes a 2D texture sampler and uses UV coordinates to map it. This works fine for all textured objects. However, I'm having a bit of a problem as I'm trying to render a Mesh with no texture and the shader objects just keeps sampling based on the parameters of the last object I rendered. What is a good way to make sure whenever no texture is available it will just treat it as a white texture or something?

One thing I've thought of was creating and binding a white 1x1 texture but that seems overkill.

Related question:
I've been wondering about this and I've yet to find an answer: Is it best to make a multi-purpose shader or constantly change the shader program for different objects in the same render update? For instance, should I have just created a shader for non-textured objects?

sentences:
What kind of environment is expected in elevated, hot areas? I'm creating an "exploration" game where the overworld map will be randomly generated.
The biomes are generated using the data given by a "temperature map" , a "humidity map", and an elevation map for instance : cold + humidity = snow, hot + humidity = jungle, etc
The problem I'm left with is how to deal with elevated zones in hot climate. Right now it is set to the "bare" biome (the gray areas in the following pic), which I guess is supposed to mean "deserted dry land". On the other hand, elevated zones with colder temperatures is set to snow (in white), which is ok.
So, how should I deal with the elevated zones in cold climate? I have several ideas but I feel that none of them works:
1) set it to snow as well, but I think it would feel weird
2) set it to "bare" but I don't think it actually exists IRL or that i'd have any interesting gameplay perspectives

sentences:
Can I make a character solid but not lose non-physics behaviour? My character can walk around in the world, but walks through other objects, for example a cylinder (stand-in for a cannon). To fix this I added a capsule collider to each of the character and cylinder, but that wasn't enough. Apparently I have to add a Rigidbody as well. [1] [2]

When I add a Rigidbody to either one, they collide as expected. However, when I add a Rigidbody to my character, it falls over when I move forward. When I add a Rigidbody to my cylinder, other functionality fails (it is supposed to shoot cannonballs, and they act strangely). If I enable Kinematics on either, they stop colliding.

Is there any other way to make the character and cylinder solid with respect to each other, without breaking existing non-physics functionality?

sentences:
How do you create hitboxes that will detect stationary targets too? I've created a basic attack combo system that chains 3 attacks together.

When the player clicks the mouse button, it enables a boxCollider2D attached to the player.

The boxCollider is a trigger and will cause damage to a valid target using OnTriggerEnter2D.

This doesn't seem to be very responsive, and often will not work if the target is stationary. I've thought about trying Raycasts as an alternative but am looking for advice on how to handle this properly.

public class Attack : MonoBehaviour
{
     private int comboIndex;
     public float lastAttack;
     private Animator _animator;
     private string[] attackName;
     private float comboResetTimer;
     private BoxCollider2D _hitbox;

     private void Awake()
     {
         attackName = new[] {"Attack1", "Attack2", "Attack3"};
         _animator = GetComponent<Animator>();
         _hitbox = GetComponent<BoxCollider2D>();
     }

     private void Update()
     {
         var canAttack = Input.GetMouseButtonDown(0);

         if (canAttack && comboIndex < attackName.Length)
         {
             _animator.SetTrigger(attackName[comboIndex]);

             _hitbox.enabled = true;
             comboIndex++;
             comboResetTimer = 0f;
         }

         if (comboIndex > 0)
         {
             comboResetTimer += Time.deltaTime;
             if (comboResetTimer > lastAttack)
             {
                 _animator.SetTrigger("Reset");
                 comboIndex = 0;
                 _hitbox.enabled = false;
             }
         }
     }
 }

sentences:
Permanent Adjacency Problem [Gamemaker Studio] Situation: I started work on a pet project recently. It's a bit like Puzzlecraft, or Bejewled, but slightly different. You click one gem, as we'll call it, and if it's the first in the link, then it's added to the link.

That works well enough. However, the problem comes in that after that, in order to link, it must be adjacent to the last link... and somehow, something goes wonky. The first time you click something not adjacent, it doesn't get put on the link...or it at least doesn't highlight. It also doesn't run across any of my show_message popups - aside from "second else".

Yet, somehow, it seems to act as though that one you clicked on was the Last_Link, after that point...permanently...which shouldn't even be possible...

So, if you click adjacent to the one that got to "second else", it will still consider that "adjacent", even if it's across the entire board from the last one that actually highlighted.

And this permanent allocation of Last_Link can happen for every gem on the board. At the same time. (Note: It does deallocate once you restart the program.)

This DOESN'T make sense!

I have no step events (yet). This is also the only left click event in the game at the moment. Every other event is a create or game start event, mostly for initialization purposes. So I have no idea what is doing this. Can someone tell me?

Left Click Event for the Gems

if (obj_Handle_Links.Match_Length = 0) //if this would be the first in the link
{
    show_message("first to link");
    obj_Handle_Links.Match_Length +=1; //because we're increasing the length
    image_index = 1; //this should highlight
    //add to link, later
    show_message( Matrix_Location_y );
    obj_Handle_Links.Last_Link = id; //makes it so this is what's seen as last link
    show_message(obj_Handle_Links.Last_Link.Matrix_Location_y);
}
else
{
    // show_message("first else");
    //check if the target is the same type as the last Link's type
    if(obj_Handle_Links.Last_Link.Type = Type &&
        //check if the last link in the chain is adjacent to the target link
        //includes diagonals
         (obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y-1)
         || obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y+1)
         || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x-1)
         || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x+1)) )
        {

            show_message( Matrix_Location_y );
            //show_message("third if");
            obj_Handle_Links.Match_Length +=1; //because we're increasing the length
            image_index = 1; //this should highlight
            //add to link, later
            obj_Handle_Links.Last_Link = id; //makes it so this is what's seen as last link
           show_message(obj_Handle_Links.Last_Link.Matrix_Location_y);
         }
    else{

        show_message("second else");
        //play sound that link failed
    }
}

sentences:
Partially observable game map — is A* appropriate? I know very little about game development and I'm trying to wrap my head around pathfinding algorithms.

Consider this setup: an agent is on a 2D map and must find the shortest path to a globally know object but only has information about obstacles in his local vision scope (ie. only immediate obstacles are known, the general layout of the map is unknown).

Also, every move to an adjacent square is expensive and the pathfinding algorithm should minimize the number of moves.

Computational efficiency is also of utmost importance and more important than accuracy.

Is A* appropriate for this use-case?

sentences:
Making a parent system with euler angles (gimbal lock problem) I have a system where objects can be connected to each other - as the parent rotates the child objects will rotate too and child objects themself can rotate too. The system is already working, however, I am doing it with rotation matrices.
I want to dynamically simulate angular physics and for that, I would need the angular velocity for which I thought the direct and easiest way would be to get the difference of the euler angles.
I am still a beginner with those rotation maths like matrices, quaternions etc.
The problem is that the rotation of the children would be local and currently I am just adding the euler angle values (which works fine if I only rotate around one axis). So when I rotate a child on the x axis by 90 degrees and then rotate the parent on the y or z axis the system breaks (y and z should be swapped in this scenario with 90 degrees x rotation)
As far as I have understood it the problem could be explained with "gimbal lock".
Is there a way to calculate the local euler angles? Or is there in general a better way to achieve what I am trying to do here? I have heard that quaternions also don't save 360+ degrees, so that would be also a problem for angular velocity.

sentences:
How to remotely host my c++ game server on Ubuntu? I made a server for a 3D multiplayer game I'm working on. The game is currently functional to a point where I know multiplayer gameplay is possible locally on Windows.

IDE: Visual Studio 2019
Target platforms: Windows & Ubuntu
Server linked libraries: winmm.lib, ws2_32.lib, sfml-system-s-d.lib, sfml-network-s-d.lib

I want the server to work on a remotely hosted dedicated server where I have Ubuntu installed, and to be capable of connecting the client locally from Windows, how should I do this? Considering the following:

My project currently uses the visual C++ compiler from VS,
which I presume makes my own c++ code only work on windows (correct?).
I've done some simple aplications for Ubuntu in C++, and know that
for an aplication to work on Ubuntu, it needs to be compiled using
the g++ compiler, however, this doesn't seem to be an option on my
current environment.
Also, 2 of the libraries my sfml dependencies depend on, seem to be
designed for windows (This could mean issues with the sfml modules I'm
using?).
Finally, I also know there could be some endianness issues, for now
I did a quick check and found out both my local, and remote cpu's,
use little endian formats.

Additional note: I really could just install any other OS on my remote machine, including Windows, but I like Ubuntu's lightweightness, and I'm familiar with the OS.

sentences: Add a tag in Unity editor in code How to add a tag in editor? I am working on automatic asset generation and I would like to use tags for certain objects.

sentences:
How to implement a physical with perspective effect on Android? I'm working on a project that looks like PaperToss. Instead of tossing a page, you toss a coin. Suppose that I have a coin put in three-dimensional that have coordinates at A(x,y,z). I throw that point ahead, after 1/100 second, that coin move from A(x,y,z) to A'(x',y',z'). By this way, I  have two problems need to solve.

Where will be the coin at time t?
How can I display this on a screen?

For 2., I thought about using Orthographic projection & Perspective projection. I'm told that OpenGL can help me, but I don't know how.

How can I solve 1. and 2.?

sentences: How to create a main menu using java swing I have been trying to figure out for quite some time on how to create a basic main menu for a game that just has a couple clickable labels, but I don't know how to write them. I have created a class that extends JFrame, made a JLabel and that is it. I don't know much to do after that.

sentences: libgdx - Should I use OOP in ECS framework? For example I have OOP class of Bullet and I have created the pool and factory. Should I convert it to componet based? Like BulletComponent, then handle by BulletSystem? by the way I'm using Ashley ECS framework.

sentences: Does marking a GameObject as static actually improve performance? I'm currently working on a small game that will include somewhat large levels. Each level will have a somewhat large amount of GameObjects lying around as props. I was told by a friend of mine that marking the GameObjects that the map is comprised of as static will improve performance. However, I am aware that this can greatly increase the amount of space the built game takes up on the disk. Does the performance boost gained from marking GameObjects as static outweigh the cost of increased build size? Is there even a performance increase at all?

sentences: What is the difference between an impulse and a force related to a physics engine? What is the difference between an application of an impulse and an application of a force in relation to a physics engine?

sentences:
Unity Unable to blend 2D Light renderers I've followed the documentation on Unity regarding 2D lighting. It said to turn on Alpha blending in the options. But this is how it turns out:
If Alpha blending is off:

If Alpha blending is on:

I'm not entirely sure why it's turning black. These are my settings for the 2D light:

I've checked my layers, specifically the tile map floor, and it's on the Default layer.

I just want my lights to blend well.

sentences:
Can you use A* to make a unit move nonspecifically? A* is typically used to calculate the best way to move towards something, and it's quite flexible when it comes to threats, extra movement costs, and 'refuelling' on the way to something.

However, if you designate only threats, perhaps with a main threat first and foremost, can you use it for "finding somewhere to go"? What about adding both threats, safety, resources and other such heuristic influencers to determine what a unit does when idle?

sentences:
Unity Vertex Color Shader with Transparency I'm trying to achieve a simple effect: I have a cube mesh and I want some of the vertices to change color. In this case, I want it to form some sort of a gradient where the unchanged vertices are set to the default color (with alpha = 1) and the changed vertices to slowly fade (default color with alpha decreasing towards 0).

I'm able to modify these vertices' color with this piece of code:

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

public class Test : MonoBehaviour
{
    Mesh mesh;
    Vector3[] vertices;
    Color[] colors;
    List<int> verticesToChange;

    void Start()
    {
        mesh = GetComponent<MeshFilter>().mesh;
        vertices = mesh.vertices;
        colors = new Color[vertices.Length];
        verticesToChange = new List<int>();

        for(int i = 0; i < vertices.Length; i++) {
            colors[i] = Color.white; //Set the default vertex color
            if(Mathf.Approximately(vertices[i].y, 0.5f)) //Change only the vertices on the plane y=0.5
                verticesToChange.Add(i);
        }

    }

    void Update()
    {
        foreach(int i in verticesToChange) {
            colors[i].a = Mathf.Max(colors[i].a - Time.deltaTime * 0.5f, 0f);
        }

        mesh.colors = colors;
        //Not needed here, but I will be changing the vertices' position too later
        mesh.RecalculateBounds();
        mesh.RecalculateNormals();
        mesh.RecalculateTangents();
    }
}

My problem is selecting a shader that actually uses this color and this color only. I've tried Unlit/Color, Unlit/Transparent and Particles/Standard Unlit with multiple combinations of Rendering Mode, Color Mode and Albedo color.

Is there a built-in shader that does this and I'm not getting the right combination of its parameters? Or do I have to build my own shader?
I've never wrote a shader with Unity, so I would prefer a built-in option or an open source / free shader.

sentences:
How to make my model's top section rotate without rotating the entire model? I'm trying to learn a bit of Maya modeling so that I can be self sufficient when it comes to creating super basic assets for my game development. I'm trying to understand skeletal rigging and how it modifies the model geometry itself.

I've got the most basic model - a cube with proportions that make it into a 3D rectangle. I've rigged it with a very simplistic skeleton. My goal is to learn how all of this works, and create a character that has motion similar to maybe the magic carpet from Aladdin - it's a rectangle but the edges somewhat move like it has arms and legs.

When I rotate some joints, it distorts the entire model. I added a bit more geometry thinking that it'd allow the top section of my model to rotate a bit more without having to deform the entire model, but it still just seems to do the same thing.

How can I make the top section of my model be capable of moving forward and backward in such a way that it does not cause the entire model to move forward?

Here are some screenshots to help explain and show my situation ...

This is my model and skeleton (I told you it was super basic, lol) ...

And here is what happens when I rotate around the neck joint ...

And here is sort of what I was hoping to achieve ...

sentences:
Physically-based BRDFs I'm starting to implement a real-time PBR shading pipeline in one of my projects and had a few questions that I thought folks around here could help clarify.

1) Is it fair to say that in a PBR shading model, you'd typically have two separate BRDFs - one for specular and one for diffuse? So far, I've been using a simple Lambertian diffuse term and a more complicated BRDF for specular (i.e. one that uses a normal distribution function, a geometric shadowing term, and fresnel attenuation). At the end of my shading routine, I simply add these two terms together.

2) Why do so many diffuse models ignore surface roughness? I don't understand why the microfacet model wouldn't drastically change the way light is refracted, scattered, and re-emitted through a surface (i.e. the diffuse term).

3) People often parameterize this material model with three variables: roughness, metallic, and specular. In my current model, I use 'roughness' for various calculations in the specular BRDF. Obviously, the Lambertian diffuse model doesn't take into account the surface roughness, but I may adopt a more advanced shading model later (i.e. Oren-Nayar). I use 'metallic' to blend between the diffuse and specular terms. It also controls the color of the specular highlight - a higher 'metallic' value will result in highlights that are tinted towards the diffuse color of the material, while lower values result in highlights that are white. Finally, 'specular' just controls the final intensity of the specular highlight. Does this make sense?

4) I'm confused where environment maps, irradiance maps, and pre-filtered cube maps fit into this model. Is it fair to say that irradiance maps are used for indirect diffuse lighting, pre-filtered cube maps are used for indirect specular lighting, and environment maps are used for reflections (based on how 'metallic' a material is)? The relationship between direct and indirect lighting in a PBR material model is confusing to me.

Any help would be greatly appreciated. Thanks all

sentences:
Travel over step angle http://www.gamasutra.com/blogs/AdamWinkels/20140220/211306/DevLog_7_Learning_How_to_Walk.php

Following the link above I have been able to get my character to move and rotate very smoothly over angled surfaces up-to 80 degrees.  Anything over that and it begins to clip and wobble when traveling down the surface. The spiders rotation only reaches half of the desired angle.  So at 85 degrees it only rotates to 42.5.  Going up is a mess, but I have not implemented the fix for that from the link above, so I am less worried about that.  Any suggestions?

private float RayDuration = 0;
private float RayAngle = 5f;
private float RayLength;
Vector2 MovementDirection;
float OffSetY  = 5;
float OffSetX = .5f;
int GroundMask = 1 << 8;

 void Start()
{
    SpiderRect = GetComponent<RectTransform>();
    RayLength = SpiderRect.rect.height;
}

private void TouchHeld(CustomEvent customEvent)
{

    if (Input.mousePosition.x > 400)
    {
        MovementDirection = transform.right;
    }
    else
    {
        MovementDirection = -transform.right;
    }

    Vector2 transformUp = transform.up;
    Vector2 position = transform.position;

    Vector2 rightRayPosition = new Vector2(transform.position.x + OffSetX, transform.position.y + OffSetY);
    Quaternion rightOffSetAngle = Quaternion.AngleAxis(-RayAngle, new Vector3(0, 0, 1));
    Vector2 rightRayAngle = rightOffSetAngle * Vector2.down ;

    Vector2 leftRayPosition = new Vector2(transform.position.x - OffSetX, transform.position.y + OffSetY);
    Quaternion leftOffSetAngle = Quaternion.AngleAxis(RayAngle, new Vector3(0, 0, 1));
    Vector2 leftRayAngle = leftOffSetAngle * Vector2.down;

    RaycastHit2D rightHit = Physics2D.Raycast(rightRayPosition, rightRayAngle, RayLength, GroundMask);
    RaycastHit2D leftHit = Physics2D.Raycast(leftRayPosition, leftRayAngle, RayLength, GroundMask);

    #region move
    if (rightHit && leftHit)
    {

        Debug.DrawRay(rightRayPosition, rightRayAngle, Color.red, RayDuration);
        Debug.DrawRay(rightRayPosition, rightHit.normal, Color.green, RayDuration);

        Debug.DrawRay(leftRayPosition, leftRayAngle, Color.yellow, RayDuration);
        Debug.DrawRay(leftRayPosition, leftHit.normal, Color.magenta, RayDuration);

        Vector2 averagePoint = (leftHit.point + rightHit.point) / 2;
        Debug.DrawRay(averagePoint, -transform.up, Color.cyan, RayDuration);

        Vector2 averageNormal = (leftHit.normal + rightHit.normal) / 2;
        Debug.DrawRay(averagePoint, averageNormal, Color.cyan, RayDuration);

        Quaternion targetRotation = Quaternion.FromToRotation(Vector3.up, averageNormal);
        Quaternion finalRotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 10);
        transform.rotation = Quaternion.Euler(0, 0, finalRotation.eulerAngles.z);

        transform.position = Vector2.MoveTowards(transform.position, averagePoint + MovementDirection, .15f);
    }
    else
    {
        Debug.Log("What");
    }

sentences: How to add clickable text link in Game Maker Studio 2? I was wondering if anybody knew how to add text, that when clicked, would take you to another website in Game Maker Studio 2.

sentences:
Handling keyboard input in SDL2 I'm using SDL2 with .NET bindings. Keyboard handling is encapsulated in static class, and keyboard handling code part looks like this:

// class members
private static int _numkeys;
private static IntPtr _keysBuffer;
private static byte[] _keysCurr = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];
private static byte[] _keysPrev = new byte[(int)SDL_Scancode.SDL_NUM_SCANCODES];

// called once, to get buffer pointer
_keysBuffer = SDL_GetKeyboardState(out _numkeys);

// update keyboard state each frame
var tmp = _keysPrev;
_keysPrev = _keysCurr;
_keysCurr = tmp;
// copy new state
Marshal.Copy(_keysBuffer, _keysCurr, 0, _numkeys);

all is workig as expected mostly, however once in while one of the following behavior occurs:

Physical key is pressed, but no key press is detected. Keypress is detected after key repeat interval.
Physical key is pressed, but no key press is detected. Lasts for infinite amount of time.

For example, I press Right (D), the movement to right starts, shortly after I press Fire (SPACE), movement is stopped, no firing occurs, then after key repeat interval firing starts, but movement to Right is stopped despite key is also still pressed.

Unfortunatelly I have both 1) not discovered 100% reproducible pattern for the bug yet (seems like it happens on burst sequental presses), 2) have no ideas what is the cause.

For now I just want, a fresh view on my code (is it solid?) and maybe some ideas on what to check. Thanks!

sentences: How would I get the positon of my avatar's head? I'm developing an XNA Game. Basically, I have a first person camera. What I want to do is get the position of an avatar's head. The reason I want to do that is because I want the camera to be on the avatar's head thus, giving it a real life view (you can see the hands and that type of stuff.

sentences:
How do I dispose of OpenGL resources cleanly on Android? I am creating a framework for OpenGL ES 2.0 for Android. How can I cleanly dispose of my OpenGL resources when my Android app is done?

I check for isFinished() in the onPause() event and then dispose of the resources but it calls the OpenGL functions from the main UI thread so it gives me an error (0x501).

When I try to call isFinished() inside my onDraw() in my GLSurfaceView.Renderer class, it is never called when I quit my app.

Anyone got any ideas?

sentences:
How do I determine the rotation of a Tile using Tilemap in Unity 2d? I want to know the rotation of the tile in C# in order to do some logic on another object that is sitting on the tile. The rotation matters for the logic. I don't see anything except GetTileData in the doc, but that doesn't actually seem to "Get" the tile data. I could cast to Tile but not all tiles are Tile. Alternatively, I think I can get the rotation if I can get the GameObject for the tile but I have no idea how to do that either from a BaseTile.

Anyone have any suggestions? Maybe I'm trying to do this wrong and I should make different tiles for each orientation or extend BaseTile or some other solution instead of trying to determine rotation. Any help or ideas would be greatly appreciated!

Additional info: When I inspect around in the Unity editor I see that the rotation is stored in Z in something called "Grid Selection" but I can't find a programmatic way of accessing that.

sentences:
Proper and easier way to make isometric animated art Assuming I don't want to use 3D engine/models (no 3D in the game, I can use 3D offline), only 2D, in order to make for a game, for example, a single character, this would be the workflow I already got in mind:

Model in 3D
Texture it
Rig it
Animate it
Render it

For each part of the body/items -in order to sort gearing-
For each type of animation (attack, move, idle, die, dodge, hurt)
For each angle (I'd like 16 angles, or 8 as minimum)
For each frame (let's say 15 frames/sec)

This is a ridiculous amount of sprites. 400 sprites for 1 item. (Could it be too much?)

And then

Get the animation controller with extra work: sort the sprites properly depending on animation frames and angles (example at p. 11 of Paul Siramy extracting animations of Diablo II)

All this seems to me, for a bad designer, and a person who aims to make a game for the moment alone, too much work. Are there alternatives to get similar results, without 3D engine? I've heard about something called 3D bitmaps or "Vortex" (used in don't remember which strategy game for vehicles), but I could not find any information about it.

sentences:
How do I make a pop-up window with Scene2D? I have a main-menu screen with a logo and a bunch of buttons. When the Login-button is pressed, I pop up a dialogue asking for a username and password.

This works fine, other than the "popping up". At the moment the new the dialogue box just shifts everything about, but I'd want to position it over the current scene.

I'm just learning Scene2D.

sentences:
Detecting a sequence of nodes in a grid Given the image below, I need to detect the most optimal sequence on the board (the green line). The blue/red lines represent possible, but not the best moves.

Here are the rules:

You can move to any tile that is the same, and is your neighbor (diagonal is valid)
Once you have visited a tile, you can't visit it again.

I have thought about looping through each node, and looking at its neighbors, then recursively going through. Once I find a possible move I can put it into a structure. Once all possible moves are found I just pick the move with the highest count of node. It becomes more difficult when a node has more than one neighbor that matches.

So, is there some algorithm that I can use? I was thinking some sort of flood fill, but that doesn't meet rules #2.

As requested, here is a video of similar gameplay. http://youtube.com/watch?v=eumnCTG0AE8

sentences:
debug unreal engine c++ - how to run in break mode I have a number of things not working properly with my FBX imports and I would like to understand how FBX imports work internally. Now, I am noob in software development, so how do I debug the internal C++ code of Unreal? I want to set a breakpoint in Visual Studio Code and explore variables / memory etc. I have found some sources, but for my level of knowledge, they explain nothing to me
To make it clearer: I need to debug internal code, for fbx imports, like not the code that I am writing for my game objects. Basically, I want the engine to stop at the break point once it starts importing fbx (I have found functions seemingly responsible for that)

sentences:
Unity - Logic for saving and loading objects with both static and dynamic data I need help to get some structure for my save and load.

I am making a city builder, so I have Buildings thats need to be saved.

Each building has a lot of static Data, for example name, description, etc.

However it also has a lot of dynamic Data, for example worldPosition, id, etc.

My current structure looks like this:

On each Building GameObject I keep a reference to a ScriptableObject that stores all the static data.
I also store a reference to an Object that stores all the dynamic data.

This means I need 2 classes for storing Building data, which I already don't like (BuildingStaticData & BuildingDynamicData)

When I Save/Load my game I only need to store the Dynamic data, so for saving I just save the DynamicData.

For Loading I load the DynamicData, and instantiate a Building GameObject that is associated with it, then the GameObject has the reference to the StaticData.

While this works, I would prefer to have a structure where I only have a single class for BuildingData, but I also don't want to lose the power of a ScriptableObject where I can reference other Prefabs etc.

I need some help with this logic.

sentences:
Textures drawn with visible missing lines of pixels I am making a game in monogame and have encountered the following problem:

The black arrows mark the places where the rendering is "off". As you can see the gray lines aren't "flush" or "smooth". Instead they have a "cut".

The two cuts at the top is at the same height, suggesting that an error happens with the positioning during drawing in that height. The two topmost cuts are 1 pixel off (from the cut and down) and the bottom cut is 1 pixel off  compared to the texture but 2 pixels in total (again from cut and down). Furthermore, the cuts are always in the same place. The topmost cuts and the bottom cut are part of two different "draws" and happens even if the other is removed.

The background experiences this too some other places, but vertically and not horizontally as with the HUD.

This only happens in the resolution of 1920x1080 and not in any other I've tried. The problem fixes itself in fullscreen though.

What causes this and how do I fix it?

EDIT

The resolution is certainly 1920x1080. I've double checked that.

This is how i draw the gray frame at the top

spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

spriteBatch.Draw(txtExpFrameLeft, new Vector2(0, 7), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0.81f);

spriteBatch.End();

No resizing at all.

EDIT 2

Here is the result from the checker board:

As said, there are missing lines spread evenly around. When i move the gamecursor onto one of those "lines", it itself is also affected. Everything is still fine in fullscreen

sentences:
Determining which edge of a box was clicked in Unity How would I go about figuring out which edge of a box is clicked in Unity?

Quick image I created, colored in boxes represent edges on a face I would like to check for.

The current solution I have is half working. I create a raycast, check if it collided with a box, get the normal from the hit (to determine which side it collided with) & check if the point meets the criteria for X, Y, or Z (in the buffer zone, as outlined in the image). For example, if the raycast intersects the forward face I check that the point is inside one of the X buffers and not in one of the y buffers.

Currently only 2 sides on the forward / backward face work, as shown below

Finally, the related code.

void forwardMethod(RaycastHit hit){
    if(intersectsX(hit.point, hit.transform) && !intersectsY(hit.point, hit.transform)){

    }
    else if(intersectsY(hit.point, hit.transform) && !intersectsX(hit.point, hit.transform)){

    }
}

bool intersectsX(Vector3 hit, Transform transform){
    float buffer = transform.localScale.x * edgeBufferPercent;
    return hit.x <= buffer || hit.x >= transform.localScale.x - buffer;
}

bool intersectsY(Vector3 hit, Transform transform){
    float buffer = transform.localScale.y * edgeBufferPercent;
    return hit.y <= buffer || hit.y >= transform.localScale.y - buffer;
}

bool intersectsZ(Vector3 hit, Transform transform){
    float buffer = transform.localScale.z * edgeBufferPercent;
    return hit.z <= buffer || hit.z >= transform.localScale.z - buffer;
}

The buffer is equal to .15 if anyone is interested in that as well.

Any ideas? Am I approaching this wrong or is there a bug in my code I'm not seeing?

sentences:
How to play a video with audio using an image marker I want to play a video with audio using an image marker. In other words, user scans image marker with phone and a video with audio plays.
I am finding plenty with vuforia but how can I do this with AR Foundation?

sentences:
Get enum value "string", and get int value of that Sorry if the title is confusing, but I literally don't even know how to summarise this into a title. So here's the problem:

I have a list of combat moves for a character. I have an animation for each of those possible moves. When the "combat manager" (instantiated to manage each individual fight) works out what move the enemy and your person will make, it should tell the Animator to play the animation specific to the selected move. I'm really not sure how to go about this so:

The player's Animator has a state for each possible move, containing that move's animation. The script controlling the Animator has a public enum "CombatMove" containing every possible move (ie. CombatMove.WhicheverMove). So the Combat Manager will get the name of the move (eg. "Right Middle Jab"), remove the spaces and search for an enum value whose name is that string (eg. CombatMove.RightMiddleJab). Now it has the corresponding enum value, it retrieves the int value of that (eg. 0). It then sends that int value to the Animator, where each move's transition will occur if the int value equals the move's int value on the enum. So summed up:

move's string name, turned into an enum value name, turned into its int value, used to specify which move animation should be played.

The questions:

1) How do you find an enum value whose name equals a given string?

2) How do you get the int value of that enum value?

If this is confusing, please comment what makes no sense and I will try to explain, I'm honestly so lost that I don't even know how to ask what I need to ask.

EDIT:

IF anyone is wondering what I mean by 'int value', Fafase's answer at http://answers.unity3d.com/questions/764091/using-c-enums-to-control-an-animator.html says that each enum value has an int value by default, which can be used in animation conditions; however I have no idea how to access them, which part 2 of my problem.

sentences:
Pygame for python 3.5? I just got Python 3.5 from...
LINK: https://www.python.org/downloads/windows/

previously i had Python 3.4 and the Pygame version 1.9.2a0. It worked perfectly. However, my the new Python 3.5 isn't compatible with that version of Pygame that i had gotten for the 3.4. I Found the latest Pygame file at...
LINK: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

I downloaded the Pygame file, however, it is a .whl format file. What am i supposed to do?

I have tried looking it up all day yesterday. So far all i've figured out is something about pip and wheel and doing some commands like 'pip install' etc. etc. but i am completely lost. I never knew about pip or any of that before.

I am not even sure if there is a version of Pygame that works with Python 3.5, but i did try to find out by looking it up but i never found such information. All i want is to get Python 3.5 up and running with Pygame and for it to work just as fine as it used to when i had Python 3.4. If Pygame is yet to be compatible with Python 3.5 thats fine, i'll just reinstall python 3.4 and the according pygame file for it.

sentences:
object reference not set to an instance of an object hello i have a error "object reference not set to an instance of an object"

when my ball collide with the spikes.its supose to remove one heart but it doesnt.

health code:

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

public class Health : MonoBehaviour {
  public int health;
  public int numOfHearts;

  public Image[] hearts;
  public Sprite fullHeart;

  // Use this for initialization
  void Start () {

  }

  // Update is called once per frame
  void Update () {
    if (health > numOfHearts)
    {
      health = numOfHearts;
    }

    for (int i = 0; i < hearts.Length; i++)
    {
      if (i < health)
      {
        hearts[i].sprite = fullHeart;
      }
      if (i < numOfHearts)
      {
        hearts[i].enabled = true;
      }
      else
      {
        hearts[i].enabled = false;
      }
    }

  }
  public void Damage(int dmg)
  {
    numOfHearts -= dmg;
  }
}

spikes code:

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

public class Spikes : MonoBehaviour {

  private Health Player;

  // Use this for initialization
  void Start () {
    Player = GameObject.FindGameObjectWithTag("Player").GetComponent<Health>();

  }

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

  }

  void OnTriggerEnter2D(Collider2D col)
  {
    if (col.CompareTag("Player"))
    {
      Player.Damage(1); // here i have the error.
    }
  }
}

sentences:
libgdx sprite placement Im making a soccer game where you basically have to shoot the ball to the goal and the ball goes to where you touch the screen.
Im having an issue with the ball though, when the ball spawns on the player it goes directly to the top left corner of the screen, without even touching the screen. This might be really easy but I cant seem to find the solution

Here's the code:

Ball class

public void shootToward(float targetX, float targetY) {

    velocity.set(targetX - position.x, targetY - position.y);
}

public void update(float deltaTime) {

    position.add(velocity.x * deltaTime, velocity.y * deltaTime);
    velocity.scl(1 - (1f * deltaTime));
}

Game class

public void create () {

    cam = new OrthographicCamera();
    cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    batch = new SpriteBatch();
    batch.setProjectionMatrix(cam.combined);

    player = new Sprite(player1);
    player.setX(MathUtils.random(Gdx.graphics.getWidth()));
    player.setY(MathUtils.random(Gdx.graphics.getHeight() / 2));

    b.position.set(player.getX(), player.getY());

}

public void render () {
    Gdx.gl.glClearColor(255, 255, 255, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    b.update(Gdx.graphics.getDeltaTime());

    batch.begin();
    batch.draw(bg, 0, 0);
    batch.draw(goal1, Gdx.graphics.getWidth()/4-20, Gdx.graphics.getHeight() - 180, 420, 130);
    if (!Gdx.input.isTouched()) {
        batch.draw(bs, b.position.x, b.position.y);
        b.shootToward(Gdx.input.getX(), Gdx.graphics.getHeight() - Gdx.input.getY());
    }
    player.draw(batch);
    batch.end();
}

Thanks in advance.

sentences:
How to give a certain scene different preference settings then other scenes unity In my unity game that I am creating there are 4 scenes. 3 of those scenes rely on a backdrop because they are the main menu, death screen and the escape screen(for when you escape the place). Therefore they need a high resolution image. However, the other scene (the main game scene) is incredibly laggy when the quality setting for the texture quality isn't "eighth res". How can I make it so that the texture quality for only my game scene is eighth res and the rest is normal res? This might help: my build order value is the main menu is 0, my game is 1, my death scene is 2 and my escape scene is 3.
thanks in advance

sentences:
Build a Unity asset bundle on linux? I'm trying to generate an asset bundle on a remote linux machine and stream the bundle to a running Unity instance.

Is it possible to download the same libraries Unity uses and compile on Linux?

sentences:
Mixamo Models not Importing Correctly in Unity Mixamo (now Adobe Mixamo) allows us to choose character and then animations from its website from free samples. I have done one simple animation and added the model to Unity. The animation works fine but the model is very changed once being imported, have a look here.

I am using following import settings,

Format: Fbx for Unity

Skin: With Skin

FPS: 30

Keyframe Reduction: Uniform

I tried "Fbx" format only too, but no luck.I also applied "humanoid" in rigging, but I think it is not relevant here. Since I am not good with modeling that is why I am using this service, and I have no idea how to tackle this. Once it did worked well, but unfortunately I could not remember how, so I am stuck again.

sentences:
Windows Phone XAML and XNA Apps with Game Components I am using the Windows Phone Template "Windows Phone XAML and XNA Apps" and targeting Windows Phone 7/8. Most examples show your game inheriting from Microsoft.Xna.Framework.Game and then adding Microsoft.Xna.Framework.GameComponent items to the Components collection. But as my game page inherits from PhoneApplicationPage there isn't a Components collection  or a Game property.

How can I use GameComponent from within PhoneApplicationPage?

sentences:
Creating A Board Game AI I want to code a board game that name is Okey and mostly popular in Turkey. http://en.wikipedia.org/wiki/Okey

But i have got some problems about AI.

Firslty let me explain the game..

The game is played by 4 players.

In this game there are 106 tiles, 2 of them are fake joker. Other 104 tiles are divided 4 colours generally green, black, blue and red. All colours have two sets of tiles. A set ise contains 13 tiles that numbered sequentially 1 to 13.

Each player start 14 tiles (one is start 15 and starts first) and throws one of the most unwanted tile the next player. Next player can get this tile or can get another tile from stack in the middle of table. The game played in anti-clockwise..

The aim of this game is find the valid sequence of 14 tiles as soon as possible. Player can align tiles by sequential numbers in the same colour until 13. For examle Green 1, Green 2, Green 3. There is an exception here, 1 can be follow to 13. For example Red 12, Red 13 and Red 1 is a valid set. But Red 13, Red 1 and Red 2 is not valid.

Or player can align tiles by colors in the same number. For examle Green 1, Black 1, Red 1, Blue 1.

Each set need to be 3 or more tiles to be valid and each of this set named as "Per". Less then 3 tiles is not valid for the finish. A valid finish set can be like this. G: Green, B:Blue, R:Red, BL: Black G1|G2|G3 B2|R2|BL2 R9|R10|R11|R12 BL13|R13|G13

Last thing, when starting game a tile selected to determine joker (okey). For example if you select Blue 3; Blue 4 will be joker (okey) and player can use this tile instead of any tile that player needs to win or complete a set (per).

Of course these rules are general rules and summarized to explain question. If you can read English you can check this link for more information http://tr.wikipedia.org/wiki/Okey or translated page by Google Translate http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=tr&tl=en&u=http://tr.wikipedia.org/wiki/Okey

So which AI algorithm that i can used? I searched for minimax theory and alpha beta pruning. But these theories are generally about 2 players game like chess or tic-tac-toe.

Original Question is at stackoverflow: https://stackoverflow.com/questions/4419628/creating-a-board-game-ai

sentences:
Ways to describe resouces I have one way - xml and code like this:

<Texture file="file_name.jpg">
  <Sprite id="ID_SPRITE_1" coordinates="0 0 64 64"/>
  <Sprite id="ID_SPRITE_2" coordinates="64 0 64 64"/>
  <Sprite id="ID_SPRITE_4" coordinates="128 0 64 64"/>
</Texture>

then parse and load it, when application starts, then use resources by id.

What another ways to describe paths and propeties of resources used by developers and why?

sentences:
Cycling through colors with the same brightness Ok.  So I have a game I am working on with a bunch of colored particles.  Each of them gets their own color however they are all close to a specific shade.

To explain that better I am using the HSV color space, and I have a global variable that is cycling from 0-360 (H) and each of the specific particles add or subtract a random amount from that.

I use HSV because it is the easiest way for me to cycle through colors because you can just change H.

This looks very nice and all, however the particles are supposed to be pure light that is colored.  Right now all they are are circles colored with the shade, but later on I might add glow effects and other shading techniques.

The problem is that not all shades (I dont mess with H or V) are equal as far as the brightness our eyes see, and this causes problems.  For example when all of them are shades of blue things look pretty dark.

Obviously in the shader I have to convert these HSV colors to RGB colors and doing some math I quickly saw what was wrong... the colors didn't have equal luminance!

As I understand it luminance is roughly (0.2126*color.r + 0.7152*color.g + 0.0722*color.b) which is why everything is off.

Is their a way to get it so I can still get all of the different chroma (colors on the wheels degrees) while maintaining a high luminance? Perhaps I should work with a different type of color then HSV, or perhaps their is a formula that finds a color at degree x on the color wheel with luminance of y?

Thanks much!

sentences:
glColor3f() 0.0 = no intensity 5.0 = full intensity? I have a very weird behavior of openGL's glColor right now.

I've wasted hours to detect why my line colors acting so weird until I found out that 0.0 rgb values is zero intensity and 5.0 lead to full intensity (yes NOT 1.0 it's not clamping!)

If I color a line with 1.0, 1.0 1.0 I get very dark grey instead of white.
If I color a line with 5.0, 5.0 5.0 I get white.
Here is my code:

gl.glDisable(GL2.GL_BLEND);
gl.glDisable(GL2.GL_TEXTURE_2D);

/* We need to disable any shaders to get colored lines */
gl.glUseProgramObjectARB(0);

gl.glColorMaterial(GL2.GL_FRONT_AND_BACK, GL2.GL_AMBIENT_AND_DIFFUSE );
gl.glEnable(GL2.GL_COLOR_MATERIAL);

gl.glBegin(GL2.GL_LINES);
for (int lineIndex = 0; lineIndex < lineSegments.getNumberOfLines(); lineIndex++) {
  gl.glColor3d(5, 0, 0);
  //gl.glColor3dv(lineSegments.getLineColor(lineIndex).data(), 0);
  gl.glVertex3fv(lineSegments.getLineStartPoint(lineIndex).floatData(), 0);
  gl.glVertex3fv(lineSegments.getLineEndPoint(lineIndex).floatData(), 0);
}
gl.glEnd();

gl.glEnable(GL2.GL_TEXTURE_2D);
gl.glEnable(GL2.GL_BLEND);

Why is OpenGL acting so weird on glColor? Did I miss a gl state or something?
I could scale up the colors so I bypass this, but I want to find out whats wrong here.

(The code example leads to a line that ist 100% red)

sentences: how do game implement customization of characters I am looking to create a game a rpg. I want to add customization of character so that each players char is unique. How do i do it?

sentences:
Alternative ways to make a battle system in a mobile indie game more fun and engaging I'm developing an indie game for mobile platforms, and part of the game involves a PvP battle system (where the target player is passive). My vision is simple: the active player can select a weapon/item, then attack/use, and display the calculated outcome. I have a concept for battle modifiers that affect stats to make it more interesting, but I'm not convinced this by itself will add enough of a fun factor.

I've received some inspiration from the game engine that powers Modern War/Kingdom Age/Crime City, but I want more control to make it more fun. In those games, you don't have the option to select weapons or use items, and the "battling" screen is simply 3D eye candy. Since this will be an indie game, I won't be spending $$$ on a team of professional 3D artists/animators, so my edge needs to be different.

What are some alternatives to expensive eye candy that you or others have used to make a non-3D PvP game more fun and engaging? Did the alternative concepts survive the release?

sentences:
Converting Shader to ShaderGraph for URP conversion I know there are a bunch of threads asking for help with converting old shaders to ShaderGraph, and this one is no different.
I spent a lot of time trying to get a shader to cast shadows from sprites that also works with transparency. Eventually landing on this thread
I was able to work out the following shader that did what I wanted
Shader "Custom/SpriteShadowWithAlpha"{
    Properties
    {
        [PerRendererData] _MainTex("Texture", 2D) = "white" {}
        _EffectColor1("Effect Color", Color) = (1,1,1,1)
        _Crossfade("Fade", float) = 0
        _FlashColor("Flash Color", Color) = (1,1,1,1)
        _FlashAmount("Flash Amount",Range(0.0,1.0)) = 0
        _Cutoff("Alpha Cutoff", Range(0,1)) = 0.9
        _Color ("Color", Color) = (1,1,1,1)
    [Toggle(_ALPHABLEND_ON)] ALPHABLEND_ON("Enable Dithered Shadows", Float) = 0.0

    }
    SubShader
    {
        Tags
        {
            "Queue" = "Transparent"
            "IgnoreProjector" = "True"
            "RenderType" = "TransparentCutOut"
            "PreviewType" = "Plane"
            "CanUseSpriteAtlas" = "True"
        }

        Cull Off
        Lighting Off
        ZWrite Off
        Blend SrcAlpha OneMinusSrcAlpha
        CGPROGRAM
            #pragma surface surf Lambert alpha:blend fullforwardshadows alphatest:_Cutoff
            #pragma target 3.0

            struct Input {
                fixed2 uv_MainTex;
                fixed4 color : COLOR;
            };
            sampler2D _MainTex;
            fixed4 _EffectColor1;
            fixed _Crossfade;
            fixed4 _FlashColor;
            float _FlashAmount;
            void surf(Input IN, inout SurfaceOutput o)
            {
                fixed4 col = tex2D(_MainTex, IN.uv_MainTex);
                fixed4 returnColor = lerp(col, col * _EffectColor1, _Crossfade) * _EffectColor1.a + col * (1.0 - _EffectColor1.a);
                o.Albedo = returnColor.rgb * IN.color.rgb;
                o.Alpha = col.a * IN.color.a;
                o.Albedo = lerp(o.Albedo,_FlashColor.rgb,_FlashAmount);

            }
        ENDCG
    }
    Fallback "Standard"
}

After that I found that using the built-in render pipeline was the difference between 40% and 7% GPU utilization when converted to URP using a different sprite shadow shader.
Problem is the URP shader I found did make sprites cast shadows, but all the lighting was off, and messing with the X rotation on the sprites to get them to stand off the ground would cause them to explode into balls of white light from the directional light....I don't get why.
So I set off to try and convert my old working Shader to ShaderGraph
I have been trying to deduce what parts of this code corelate to what blocks exist in ShaderGraph.
I understand when 2 variables have a * between them I need to use a multiply block
After about 3 hours of linking different blocks I was left with....nothing and a mess

I was wondering if anyone could point me in the right direction as to what blocks correspond to what variables.
Like the code
void surf(Input IN, inout SurfaceOutput o)

I am not too sure what sort of block this would be, it seems like a function, and I have no clue how to make that visually
or the block of "Tags" no idea where to start there
or the toggling of _ALPHABLEND_ON

sentences:
How can I use XNA with Visual Studio Express 2013 for Windows? http://dev.windowsphone.com/en-us/downloadsdk

I downloaded the current version of Visual Studio to develop Windows Phone apps, but I don't know how to add XNA. I tried to install XNA, but it's not working with Visual Studio.

How can I use XNA with Visual Studio Express 2013 for Windows?

sentences:
Calculating approximations of contact between two meshes I'm looking for ways to calculate the degree of contact between two objects in a scene. I was thinking that calculating the hausdorff distance would be a useful approximation if it is then normalized somehow using the surface area/volume of the objects. Does anyone have any experience calculating this in Unity? Or have any suggestions for other ways to approximate this?

Edit: For some context, I'm working on a project which involves looking at the relationship between geometric properties and relations of objects, and what language/words people use to describe objects and I am using scenes in unity to test this. The notion of 'contact' appears to be an important one and it would be useful to be able to quantify the amount of contact between two objects in a scene

sentences:
Problem with Animating on local position Unity Currently, I am having a Cube that needs to be animated to roll on its edge. Using unity built-in animation feature, I created 4 animations (RotateUp, RotateDown, RotateLeft, RotateRight). At the end of each animation I would put an Event to call a method on my script. To be able to move the object every time the animation is played, I put the cube with animator attached inside a parent object.
Below is the script attached to my cube.

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

public class RedCubeBehavior : MonoBehaviour
{

    Animator anim;

    bool isMoveTriggered = false;

    void Start()
    {
        anim = gameObject.GetComponent<Animator>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            MoveUp();
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            MoveDown();
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            MoveLeft();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            MoveRight();
        }

        if (isMoveTriggered)
        {
            if (IsBackToIdle())
            {
                transform.parent.position = transform.position;
                transform.localPosition = Vector3.zero;
                isMoveTriggered = false;
            }
        }
    }

    void AnimationFinished()
    {

        anim.Play("IdleState");

    }

    public void MoveUp()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveUp");
            isMoveTriggered = true;
            anim.Play("RotateUp");
        }
    }

    public void MoveDown()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveDown");
            isMoveTriggered = true;
            anim.Play("RotateDown");
        }
    }

    public void MoveLeft()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveLeft");
            isMoveTriggered = true;
            anim.Play("RotateLeft");
        }
    }

    public void MoveRight()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveRight");
            isMoveTriggered = true;
            anim.Play("RotateRight");

        }
    }

    bool IsBackToIdle()
    {
        return anim.GetCurrentAnimatorStateInfo(0).IsName("IdleState");
    }

}

Every time the arrow key is pressed the object would rotate but in the end when AnimationFinished() is called, the cube would just roll back to its starting position (because of playing IdleState). It will only work (the object didn't return to its starting position) if I pressed the arrow twice quickly.

I've tried to not call the IdleState (which is only an empty state), but what happens next is it just won't play another animation again when triggered.

What should I do in order to get it work without having to press the key twice?

sentences:
SlimDX Direct3D10 Sprite stretches with window size I'd like to draw a sprite bitmap with SlimDX Direct3D10, but I'm stuck at this  problem, where I can see my image on screen, but it gets stretched depending on the window size.

The issue looks like this:

I got the same general idea of drawing sprites in Direct3D9 and Direct2D working fine, because there I simply resize the RenderTarget or reinitialize the Device with a new BackBuffer.

How do I fix this, so that the sprite remains the same dimensions independent from window size?

I'm seeing two potential issues:

I don't know if and how I need to set the different Transforms to adjust for window size (I'd rather resize the backbuffer, and only transform sprites for positioning and scaling)
I suppose I need to update the backbuffer or do something in the form's resize event.

Here is my rendering code:

using DiscSim;
using SlimDX;
using SlimDX.Direct3D10;
using SlimDX.DXGI;
using System.Windows.Forms;
using System.Drawing;
using Device = SlimDX.Direct3D10.Device;
using Vector2 = SlimDX.Vector2;
using Resource = SlimDX.Direct3D10.Resource;

namespace DiscSimSlimDX
{
    class Camera_DX10 : Camera
    {
        private RenderTargetView renderTarget;
        private Device device;
        private SwapChain swapChain;
        private Sprite sprite;
        private SpriteInstance[] spriteInstances;

        public Camera_DX10(ISimulation simulation, Form form, string spritePath)
            : base(simulation, form, spritePath)
        {
            var swapChainDescription = new SwapChainDescription()
            {
                BufferCount = 1,
                ModeDescription = new ModeDescription(0, 0, new Rational(60, 1), Format.R8G8B8A8_UNorm),
                IsWindowed = true,
                OutputHandle = form.Handle,
                SampleDescription = new SampleDescription(1, 0),
                Flags = SwapChainFlags.AllowModeSwitch,
                SwapEffect = SwapEffect.Discard,
                Usage = Usage.RenderTargetOutput
            };

            Device.CreateWithSwapChain(null,
                DriverType.Hardware,
                DeviceCreationFlags.Debug,
                swapChainDescription,
                out device,
                out swapChain);

            using (var backBuffer = Resource.FromSwapChain<Texture2D>(swapChain, 0))
            {
                renderTarget = new RenderTargetView(device, backBuffer);
                RenderTargetViewDescription r = renderTarget.Description;
            }

            device.OutputMerger.SetTargets(renderTarget);
            device.Rasterizer.SetViewports(new Viewport(0, 0, form.ClientSize.Width, form.ClientSize.Height, 0, 1));

            device.OutputMerger.BlendState = BlendState.FromDescription(device,
                new BlendStateDescription()
                {
                    IsAlphaToCoverageEnabled = true,
                });

            sprite = new Sprite(device, 512 * 512); // How big should the buffer size be?
            sprite.ProjectionTransform = Matrix.Identity; // ?
            sprite.ViewTransform = Matrix.Identity; // ?

            ShaderResourceView texView = ShaderResourceView.FromFile(device, "Resources/World.png");
            var spriteInstance = new SpriteInstance(texView, Vector2.Zero, new Vector2(1, 1));
            spriteInstance.Transform = Matrix.Identity; // ?

            spriteInstances = new SpriteInstance[1] { spriteInstance };

            form.ResizeEnd += (s, e) =>
            {
                // How do I resize the backbuffer or what do I need to do
                // to adjust for the new window size?

            };
        }

        public override void Draw()
        {
            device.ClearRenderTargetView(renderTarget, Color.Black);
            sprite.Begin(SpriteFlags.None);
            sprite.DrawBuffered(spriteInstances);
            sprite.End();
            swapChain.Present(0, PresentFlags.None);
        }
    }
}

sentences:
Mixing 3D and 2D content on the iPhone? I am at the design phase of a board game on the iPhone and am considering a couple of options for rendering the view:

Quartz to render top down views of the board with core animation to do the transitions to close ups etc. Using a 3D library (or GL directly) to render dice rolls on top of the 2D view.
Full 3D interface to render the board and do the transitions (something like the Monopoly app on the iPhone).

Keeping most of the game in 2D simplifies the implementation and the artwork, but I wonder if the overall finish will suffer.  Is it practical to render 3D views (for the dice rolls) on top of a Quartz 2D app?

Should I just bite the bullet and go 3D?

sentences:
How can I render cloud patterns like in these examples? I have a quick question.

I see in many games, usually in the menu, some moving "clouds" in the background, apparently additive blended into each other, which does a really nice job immersing the player, in my opinion.

A couple of examples that jump to mind right now are the Far Cry 3 main menu background: https://www.youtube.com/watch?v=B5XcMx3GjPA

and the Plague Inc main menu background: https://www.youtube.com/watch?v=RQv60ywrLxU (the first seconds show it)

These cloudy patterns seem like some kind of noise to me, like Perlin or other. So, how would you proceed to achieve that kind of blurred cloud effect with vivid colors?

More specifically, would you pre-generate sets of clouds and include them in the game package? Or generate them on-the-fly? On the CPU as a regular texture or on-draw in the GPU shader program?

I am interested in mastering this kind of visual effect, and as such any help would be appreciated pointing me in the right way. Thanks.

sentences:
Marmalade SDK 6.1: missing Studio UI Builder Marmalade SDK 6.1 they removed the UI Studio builder tool used in previous versions to construct the UI for apps.
http://www.madewithmarmalade.com/devnet/documentation#/tools/uibuilder.html

now is there any alternative to the tool or we have to construct the UI programmatically ?

Thanks

sentences:
Implement navmesh for climbing cliffs and walls I am trying to implement dynamic wall climbing similar to Conan exiles and Legend of Zelda: Breath of the Wild.
My system as of now uses a raycast to get the direction of a geometry's normal, and I make the player face that. I send another raycast in the direction of the players input, which takes the hit point, and lerps the player to that ray's hit position on the geometry.
Although this system works well on a flat wall it struggles a lot on complex geometry such as a bumpy cliff, and constantly hangs on small edges.
I recently saw this video from the cancelled game Worlds Adrift that seems to implement some sort of navmesh by making a flat plane that follows the terrain's normals. This allows the player to climb over gaps and complex geometry as if it was a smooth surface.

I don't completely understand how they managed this, and I was wondering if someone who is knowledgeable about these things could explain how I could implement something like this in Unity.

sentences:
Unity : Android Button : Select (Highlight) by touch, before clicking I have a multiplatform game with dozens of buttons in many menus.

I used the animated buttons setup to have a normal state and highlight state. Highlight will most of the time resize the button with a nice anim AS WELL as make a dedicated text box appear with extra information. So far so good. Everything works perfectly on PC.

However, as I am testing my build on android, I cannot find how to access the "highlight" state since touching the screen = click and it execute the on click () associated.

What I need is a way to select a button when it is first touched, since selected = highlight (somewhat) then if it is touched (clicked) a second time while selected then to do the on click ( ) function.

I have a few theory on how to do it, but it would require recreating every of my 80 or so buttons as well as changing everything from using the Unity GUI system to make my own C# version which would take weeks.

I am also trying a few other way to achieve the same thing. One of which is using the "button.select()" to select the button on its first click. That works. problem is I cannot seem to write a way to do:
"if (thisbutton.IsSelected == true)" that just refuses to work.

sentences:
Engine with Terrain and Indoor Areas (BSP-like) I'm not really a graphics programmer, but I used to toy around with Truevision3D 6.5 a few years ago. It wasn't too bad, but TV3D was just going nowhere so my foray into 3d game dev ended there.

I know nothing of XNA. I think it's time to get up to date.

My goal is to be able to render chunks of terrain from heightmaps (big huge terrain a la Morrowind) and BSP-like indoor areas (think Quake, so moveable objects like doors included).

I googled for "xna engine", "best xna engine" but the quantity of results is a bit scary for a xna-impaired like me.

Can anyone recommend a xna engine (or a combination of libraries) to achieve the desired result? If you targeted similar features, can you share your experience?

(and for a laugh, has anyone tried TV3D 6.5 here?)

Edit: I'm looking for something xna-related.

sentences:
My timer won't work in Unity In my game, you can spawn a cube by clicking. After 10 seconds I want the cube to disappear. That's what I'm trying to do in my code but it won't work:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class circleThing : MonoBehaviour
{
    public GameObject circle;
    public GameObject block;
    public float time;
    void Start() {
         Vector3 temp = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         temp.z = 5f;
         transform.position = temp;
         if (Input.GetMouseButtonDown(0)) {
             StartCoroutine(timer());
             Instantiate(block, temp, Quaternion.identity);
         }
         if (time >= 10) {
             Destroy(block);
         }
    }
    void Update()
    {

    }
     IEnumerator timer(){

        while (true)
        {
            Debug.Log(time);
            yield return new WaitForSeconds(1);
            time++;
        }
    }
}

What am I doing wrong? I get the error: Destroying assets is not permitted to avoid data loss.

sentences:
SDL2: Unable to get center of screen when drawing more than one texture? so I've been trying for the last four hours to get this to work and although I can get to the center of the screen when printing one texture using:

TextureManager::getInstance()->drawTexture("block_brown",
    SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - 101 / 2,
    SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 /2,
    101,
    171,
    Game::getInstance()->getPrimaryRenderer(),
    SDL_FLIP_NONE);

I get the following result:

I can keep the center of up to two textures in a row and after that it gets out of hand and I completely lose it. I'm using the following for the two:

for (int i = 0; i < 2; i++) {
    for int j = 0; j < 2; i++) {
        TextureManager::getInstance()->drawTexture("block_brown",
            SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->w / 2 - i * 101,
            SDL_GetWindowSurface(Game::getInstance()->getPrimaryWindow())->h / 2 - 171 / 2,
            101,
            171,
            Game::getInstance()->getPrimaryRenderer(),
            SDL_FLIP_NONE);

which produces the following result:

As you can see, it looks to be in the center of the window, but if I try to add more than two in a row or more than one in a column, I then have to start fighting it to keep it in the center.

So my question is, how would one manage to get the textures to stay central, no matter how many I add?

EDIT:

This is the final result I'm ultimately looking for:

When I start trying to add layers I then have to start fighting it again to keep it central?

This the result I'm having right now:

The more I think about this, the more I think I'm going completely the wrong way and doing it completely wrong.

sentences:
How to implement OpenGL triple buffering of buffer objects to avoid stalls? I'm trying to implement the triple buffering described here. The intent is to gain higher frame rate by avoiding waiting for glBufferSubData() to finish.

My understanding is that this is how to implement triple buffer:

- make 3 buffers with glGenBuffers()
Current frame:
  - bind to buffer3
  - draw last frame
  - bind to buffer1
  - glBufferSubData for all the vertices,
  keep track of their texture/vertex count,blend function, etc
Next frame:
  - bind to buffer 1
  - draw last frame (bind texture, blend func, glDrawArrays)
  - and so on

There doesn't seem to be any performance gain between this and doing glBufferSubData() and then immediately calling glDrawArrays().

Am I missing something or misunderstand how triple buffer should work?

Also is there a way to know when glDrawArrays() stalls due to glBufferSubData() still not being finished?

sentences:
Resizing a parallax background (bug) I'm attempting my first 2D vertical scroller and can't seem to get the background size to work. For some reason, it stays small. I think in the beginning of the parallax scrolling class, I was told to initialize variables and I know which ones I have to change.

public Texture2D picture;
public Vector2 position = Vector2.Zero;
public Vector2 offset = Vector2.Zero;
public float depth = 0.0f;
public float moveRate = 0.0f;
public Vector2 pictureSize = Vector2.Zero;
public Color color = Color.White;

I think I must change pictureSize to make it bigger, as the current sizing I get this:

Finally, how can I remove the whitespace from the ship image?

EDIT: Here is the code for the rendering of the actual ship:

public void Render(SpriteBatch batch)
{
    batch.Begin();
    batch.Draw(shipSprite, position, null, Color.White, 0.0f, spriteOrigin, 1.0f,
    SpriteEffects.None, 0.0f);
    batch.End();
}

The whitespace seems to be provided by XNA as I've tried clearing it using Photoshop. Because I can't directly upload to the site, I have put it here

This renders the background:

public void Draw()
{
layerList.Sort(CompareDepth);
batch.Begin();
for (int i = 0; i < layerList.Count; i++)
{
   if (!moveLeftRight)
   {
       if (layerList[i].position.Y < windowSize.Y)
       {
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y), layerList[i].color);
       }
       if (layerList[i].position.Y > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y - layerList[i].pictureSize.Y),
           layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(0.0f,
           layerList[i].position.Y + layerList[i].pictureSize.Y),
           layerList[i].color);
   }
   else
   {
       if (layerList[i].position.X < windowSize.X)
       {
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X,
           0.0f), layerList[i].color);
       }
       if (layerList[i].position.X > 0.0f)
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X -
           layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       else
           batch.Draw(layerList[i].picture, new Vector2(layerList[i].position.X +
       layerList[i].pictureSize.X, 0.0f), layerList[i].color);
       }
   }
   batch.End();
}

(It's from a XNA tutorial book I'm reading.)

sentences:
Initiated a animation in unity via use of an animator component I've written a coroutine that starts an animation.

GameObject.FindWithTag(names[number]).GetComponent<Animator>().StartPlayback();

This is the line of code that I wrote to  start the animation. However, the animation does not start. I've even replaced the GameObject.FindWithTag(String) method with a reference to the actual object by declaring a GameObject in the script and setting it to a particular object in Unity's IDE. The animation still didn't start. Also, I must say the GameObject does have an animator component, you can see it in the inspector panel. No error messages can be seen in the console during play  mode. What can I do to get the animation to play when I want it to play.

sentences:
Running two simultaneous animations on a model? I am just looking for a broad answer to this question. I am more curious about the general information rather than the specific. Also, I tried to search for this, but I think it's hard to word it so you get the right question. Anyway:

One common thing I see in a lot of games is multiple animations on the same model.

i.e.

A character runs, but also raises his arms an shoots.

A character has a walking animation, but can also be carrying resources as he walks.

I am curious if the first model has a "run" animation and a "run while shooting" animation. Or if they have a "run" animation and a "shoot" animation and run them at the same time. Obviously the first is possible, but I am wondering how the second one is done.

Do they use two models for upper and lower body or is there a way to ignore certain parts of a model when animating?

I know this depends a lot on the model, the programmer, language and the way the animation is done.

But broadly, if you were making a model with the intent of it doing multiple animations at once, what would be the best way to go about it?

Again, not after detailed specifics, just an overview :)

Thanks!

sentences:
Is a final yield return 0 required in corutines? I have the following code run in a coroutine.

I would like to know if the last yield return 0 is necessary and why.

Thank you!

private IEnumerator pChangeFoV()
{
    float duration = 0.7f;
    float zValue = 5f;

    for (float t = 0f; t < duration; t += Time.deltaTime)
    {
        float fNew = Mathf.Lerp(_camera.fieldOfView, zValue, t / duration);
        _camera.fieldOfView = fNew;
        yield return 0;
    }
    _camera.fieldOfView = zValue; //make sure we're really where we want to be

    //now do everything that should be done after we're done with this coroutine

    pEnableSomeScripts();

    yield return 0; //is this final yield return 0 required???
 }

sentences:
How do I represent blended tiles in a mesh/vertex array? I recently started making a Terraria clone using the LÖVE library, which is based in OpenGL.

In Terraria, for each tile, there is a large texture with all possible combinations for merging with neighbouring tiles. They usually only  support tiles of the same type, and sometimes other materials, like dirt. As a result, they only need a single vertex array.

In Starbound, it seems to be simpler. A tutorial I found notes the use of basic 8x8 blocks, with a few edges drawn if the block is next to a block of a different type.

I want to implement a similar mechanic, but I encountered a serious issue. A single vertex array does not allow z-ordering, which I would need.

My first idea was to use one vertex array for each type of block, but that would eat a lot of memory.
My second idea was to use the fact that OpenGL vertex array draws primitives in order. I could use some complicated data structure to represent tiles, so I would always know where to place their vertices in the array. However, that would either require moving lots of vertices or lots of memory.

What is the best way to implement this?

sentences:
What scripting language would you recommend for a C++ game project? By scripting here I mean not just putting config data in a script, but scripting parts of the project like some class methods, test specific game loop, etc. This would be not just to accelerate development, but also allow players to see some of these scripts to tweak some aspects of the game.

Some language like Lua have some wrappers like luabind, but when I've used it in the past it had problems because it didn't support method redefinition in a context of inheritance.

What are your suggestions of language / wrappers to use or not to use?

sentences:
Absorbtion 2d image effect I want to create a specyfic 2d image effect. It consists in modifying a sprite so it looks like it is being zoomed to a point or "absorbed" by that point. I'm not really sure what is the technical name of this effect so I cannot explain it correctly.

Here you can see a video of what I'm talking about, it is the effect when the character absorbs the three glyphs.

http://www.youtube.com/watch?v=PIo-GddsMcU&t=4m45s

What is the name of this effect?
How can I implement it with XNA for 2D textures/sprites?

sentences:
SDL or SFML: which is the best option if I only want to use OpenGL for my graphics? I've read a lot about creating graphics with OpenGL in SDL and SFML over the past few days, and I want to know which one I should pick. As mentioned in most of the things that I've read, both allow the programmer to use OpenGL.

However, I want to know which one would serve me best if I wanted to do graphics in OpenGL only. From what I've read, SFML does not work as well with OpenGL as SDL. Is this true?

To reiterate, I will only be using SDL or SFML for features like audio, input, and networking. All graphics will be done with OpenGL code that I write.

Also, I read a bit on LWJGL and LWJGL is essentially what I want, but I am much better at C and C++ than Java so I would like to use SDL or SFML. Which one is most similar to LWJGL?

sentences:
How to change the position of a dialog? I have created a dialog in Libgdx main menu screen.

I have tried

dialog.setPosition(300, 300);
dialog.show(stage);

It doesn't do anything. Is it a camera trick? Am I missing something?

sentences:
How to offer directional ambient audio I'm working on a game side-project that will be heavily audio-based. One feature I'd like to offer are ambient sound zones which correspond to locations of nearby areas.

Say for instance the player is standing on a beach with waves breaking to the right, and a rainforest to the left. Each of these regions has its distinct ambience. If you continue forward, the breaking waves should still be just as loud on your right. Similarly, if you head into the forest, the sound of the waves should slowly be replaced as you move away from the beach. Many games seem to treat ambient sound as either vaguely positional, or as an environmental sound that comes from everywhere at once. What I'm trying for are different areas with different distinct sounds so you can actually orient yourself to them (I.e. you should be able to return to the beach by listening for the breaking waves, they shouldn't just be omnidirectional and faint.)

I don't want to get too deep into architecture, but my system is simple 2-D tile-based. I've thought of several possible approaches and am wondering a) which is best or b) if I've missed one that is better.

Place distinct, loud ambient sounds in specific locations. This would certainly provide directionality of a sort, but I wonder if the ocean waves might eventually sound ahead or behind and right as you walk down the beach, since all the ambience is coming from a single point. This also wouldn't allow for, say, walking out in the ocean past the breakers and hearing them behind you.
Placing sound sources throughout the area, spaced a reasonable distance apart. So for instance the breakers might be a single row of wave sounds which you could walk along or past. Similarly, the forest would be a grid of scattered nature sounds. This seems like the best approach, but I wonder if I'd quickly hit some limit for number of sounds that can be mixed. I'm using the web audio API, not sure if that intelligently doesn't render sounds that are too soft to hear. While this seems conceptually simpler, a long beach might have hundreds of distinct sound nodes placed along it.
Track the player's nearest intersection with a given zone, and play its ambience at those coordinates. So if you're walking along a beach with breaking waves to your right, I'd project out an invisible circle for as far as you can realistically hear, identify the closest intersection with various audio zones, and play their respective ambience. Maybe limit this to the nearest 2-3, since any more would likely be overwhelming. This seems least demanding in that it'd play fewer sounds, but would likely require more collision checks and thus might be impractical.

Thoughts?

sentences:
Smooth Lighting Falloff So, I'm having some issues with lighting in my Unity game.  I had implemented torches, which seem to be working fine, but I have a creature (gelatinous cube) that I've put spot lights facing to give it a "glow".  The reflected and refracted light ends up having two issues:

the light abruptly ends at the edge of floor tiles, and
depending on the position, the light sometimes goes from it's blue color to a reddish color.

I have a short (11 second) video here:  http://www.labyrintheer.com/wp-content/uploads/2016/11/Nov-17-2016-21-07-57.mp4 so that you can see what I'm talking about.  I've tried changing global lighting settings and playing with the settings on the spot lights, but nothing seems to resolve the issue.

Still images for anyone hesitant to click the video link:

Hard falloff:

Reddish color:

Using a single point light inside the cube, instead:

You can see it on the wall in the upper right and the floor at the top a bit.  The upload seems to have lowered the quality a bit, but you can still see it.  The single light makes it a little bit better, but there's still complete falloff.

sentences: Import blender camera with key frames to unity? I am wondering if I can take a camera tracked camera from blender and import it into unity. Is there any way to do this? Please let me know! Thanks in advance.

sentences: Support function of Minkowski Difference I am watching this and if you stop at 7:25, you will find an implementation of the support function. The goal of the function is to give you the farthest point in a given direction. My question is how do we achieve this without looking at all the points in the Minkowski Difference? How is this not an O(m*n) algorithm ? Is there a way to get just the points that lie on the edges (I am asking because in the slide after that he just shows the edge points and not all the internal ones)? Am I missing something ?

sentences:
Which app markets should I deploy my Android game to? I just launched my Android game today. I'm curious to know where I can deploy it. Of course, Google Play is the veritable king of markets, and my own game site will be next.

After that, which marketplaces are mature and are worth deploying to?

I looked at:

SlideMe
GetJar
Soc.io

And some other ones that I didn't use:

YAAM (kept crashing and erroring out)
1Mobile (couldn't figure out how to upload my app)
Insyde Market

My question is really, which ones are out there and are worth uploading too? (And 1Mobile seems good, but just can't figure out how to upload.)

Each site requires their own size screenshots and logo, so it's a bunch of extra work. I'd rather stick to the 80/20 rule and apply 20% effort to hit 80% of the markets.

sentences:
What is the best way to handle "Fangame" licensing? ( I understand that this is a subjective question. My goal is obtaining some personal feedback from other game designers )

I wish to develop a digital version of an existing board game.
What would be the "best" course of action regarding contacting the original game designer?

Some additional information:

This is not a question about copyright. My understanding is that this is something that I can do as long as I do not use copyrighted material.
I have a recently obtained a  masters in informatics and computing engineering and have a serious interest in pursuing a career in game design and development.
The game in question is a board game for which there is no digital version on my medium of choice.

sentences:
Flipped Normals On Back Faces I'm trying to create grass quads and have therefore disabled backface culling when rendering these quads. With each vertex normal set upwards ( 0.f, 1.f, 0.f ), all front faces are lit correctly, but backfaces are black. If I change the the Y normal to -1.f the backfaces light up and the front faces go black.

D3D11_RASTERIZER_DESC desc {};

desc.AntialiasedLineEnable  = false;
desc.CullMode               = D3D11_CULL_NONE;
desc.DepthBias              = 0;
desc.DepthBiasClamp         = 0.f;
desc.DepthClipEnable        = true;
desc.FillMode               = D3D11_FILL_SOLID;
desc.FrontCounterClockwise  = false;
desc.MultisampleEnable      = false;
desc.ScissorEnable          = false;
desc.SlopeScaledDepthBias   = 0.f;

I'm not so sure there's a problem here. Any ideas?

sentences:
Passing data between engine layers I am building a software system (game engine with networking support ) that is made up of (roughly) these layers:

Game Layer
Messaging Layer
Networking Layer

Game related data is passed to the messaging layer (this could be anything that is game specific), where they are to be converted to network specific messages (which are then serialized to byte arrays).

I'm looking for a way to be able to convert "game" data into "network" data, such that no strong coupling between these layers will exist.

As it looks now, the Messaging layer sits between both layers (game and network) and "knows" both of them (it contains Converter objects that know how to translate between data objects of both layers back and forth).

I am not sure this is the best solution.

Is there a good design for passing objects between layers? I'd like to learn more about the different options.

sentences:
Calculate Position on Tile Map by single Index I stumble about a Math Problem for calculating a Position on a dynamic tile-map.

So i got a List of Tile Entities. Every Tile got his one unique Index Value and i have to set the parameters for Map Height and Width.

Example A
Map X = 3 Y = 4

Example B
Map X = 4 Y = 3

To get the X Position Value of Tile E6 i know i have to use Map.X % 6.
But i'm not sure how to get the Y Position of the Tile by his Index. % in this case stands for the modulo operation (c#).

Is there a name for such an calculation? Does somebody already know the answer?

sentences:
Unity - Access to svPosition in fragment shader I am trying to access to the svPosition in my fragment program in Unity but I keep having this error.

  invalid input semantic 'POSITION': Legal indices are in [1,15] invalid ps_3_0 input semantic 'POSITION'

Here are some information about my whole shader.

struct : float4 pos : SV_POSITION;
vertex : o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
fragment : col.rgb = i.pos.xyz;

Any idea how to access this value?

sentences:
How to linearly "blend" between multiple 3D points? I have a set of 3D points that I need to "blend" between. Lets say I have points [A,B,C] and I have the amount I want to blend each as [0.5, 0.2, 0.8], how can I blend between these points with the amount I need?
Obviously if I just had 2 points I could use the vector math (A + (B - A) * ratio).
Method 1:
I'm currently using a weighted average, which I suppose gives me the weighted center, but I need to try different blending styles to see visually which looks best.
Method 2 What If I did this:

Calculated a difference vector, each 3D point against the default point (I do have a default point)
A - Default

Then multiplied this difference with the blend amount
(A - Default) * Amount

And added these up, would that work? What result would I get?
(A - Default) * A_Amount + (B - Default) * B_Amount + (C - Default) * C_Amount

sentences:
How to update and render an 2D endless runner that goes bothways I want to make an 2D endless runner, that also allows player to go backwards.

So I have to create random world as the map goes, also keep the old map in case player goes back. I ask about how to update and render this program.

I am thinking having a generate function that takes an x value and generates world from x to (x + chunk size) and when camera reaches x + chunk size, call this function again to generate more map:

function source(x) {
  // generate world for x value
};

And maybe use this function like:

  let worldThings = [];

   // push the world from 0 to chunk size
   worldThings.push(...source(0));

   // called every frame to update world
   function update() {
     if (camera.x > chunkSize) {
       // generate more world
       worldThings.push(...source(chunkSize));
     }
   }

To render these something like:

   // object pooling for rendering things in view
   let renderPool = new Pool();

   function render() {
     // release all objects
     renderPool.releaseAll();

     // take things that are visible
     let renderThings = worldThings.filter(thingsInCameraView);

     // for everything allocate a resource in the render pool
     renderThings.each(renderPool.allocate);

     // render the pool
     renderPool.each(renderThing);
   }

sentences:
How should I develop my Android game efficiently? I have attached a image of a flow chart that I made in paint.

The image shows how I want to develop my game. I want a game that runs great with smart coding that is easy to update and ad features over time. My target platform is the Android smartphone and all code will be written in java with XML inflated resources, if that matters. I am not looking for hard code,although pseudo code will help, I would more so prefer suggestions and advise from the pros.

My questions are :

Is this a good way to program a game or are there better ways to do this? Are there any modifications that need to be made? Any suggestions would be useful because I am not experienced in game programming so I would prefer the advice from someone who has written several games and knows from experience how one should go about setting their code up to run efficiently.

sentences:
Alternative to Dictionary serialization I am working on a set of ScriptableObjects that represent base stats for characters in my game. Think Strength, Speed, Intellect, etc. A whole laundry list of em (about 20 stats).
I'd like to later be able to reference these specific stats via an enum. Therefore, the easiest way to store them in the object seemed to initially be a Dictionary<StatType, int>. These then get linked to sliders in a custom editor (which works fine).
However, Unity appears to have no idea how to serialize a Dictionary, so between sessions all my finely tuned values get removed.
I need some sort of workaround for this. Either I need another data structure Unity will serialize (but see below), OR I need to find a way to force Unity to serialize my data some other way.
Requirements for an alternate data structure: Integer values should be able to be read and written through reference to the enum value alone. It should be possible to check whether an enum key has been added to the structure or not. It should not allow duplicate enum keys, but duplicate values are fine. Obviously, Unity should be able to serialize it.

sentences:
Is triangle count so much cheaper on hard surface models that on animated meshes? I have a human character that consists of 40k triangles.
When I animated him, I noticed a huge impact on the frame rate.

Then I created a 10k tris version of the same model and animated him, and the frame rate was significantly higher.

I would like to ask if there is any formula or any other way to compare this situation with a high-poly model of a hard surface model against a low poly version of a hard surface model.

For example, I see some 3D model vendors that offer weapons for FPS games, and they call their weapons with 25k tris "lo poly".

Am I missing something here?

Is it really so cheap (for some reason that I haven't found out) to throw 25k of hard surface geometry to CPU or GPU, and it wouldn't make a noticable difference in comparision to a 3k tris hard surface model?

I'm working with Unity and HDRP, if that is important for an estimation.

Thank you.

sentences:
Tons of textures using vbo I recently learned how to create shaders and was looking to make a simple top down game, starting with a tilemap. The problem I encountered, Whilke I can store a vbo of all the blocks in a "chunk" of blocks, I can't specify what texture it should have... or at least I don't see how! I could just bind the texture using GL.BindTexture() function, but that would only allow me to use one texture in the whole chunk! I don't know how many textures I might render, it could certainly be more than 8! Is there a way to bind a texture inside a vertex shader?

I basicly would like to do something like "Display Lists" in earlier opengl versions... but I want to use modern opengl techinques as much as possible!

sentences:
Texture not appears? I make fat cube "fbx" with blender and export it to unity. this fat cube not allowed texture to appears ! i make a small cube by unity and texture pop-up !
What is wrong ?

sentences:
Lifting vehicles (and spawners) using InterActors, strange collisions causing flying vehicles Making a VCTF map with the Unreal Tournament 3 Editor, and thus have vehicles in it. Currently I have 2 walkways next to each other (Big enough for a vehicle). One of them (A InterActor) drops down, and a grate covers the hole until the vehicle respawns. Once its respawned the InterActor Walkway lifts the vehicle up (and the grate pulls back). However what I'm finding is that the vehicle seems to collide with something when it gets near the top.

(Looks something like this: ----_ where _ is the moving InterActor and - is a walkway)

I created a new map to test this, and found it seems the front of the scorpion collides with the walkway in front of it, however I don't know why, it physically (in terms of how it looks in game) does not touch the walkway in front of it, but its actions look like it has.

Im using InterActors, and a vehicle spawner, looking like so

How do I stop this from happening? Right now everything is perfect, except the vehicle keeps flying away every time its lifted up, likes it been forced in between the "lift" and another object!

sentences:
How do open world game engines allocate memory? My troubles
I've been trying to create a game engine but since I am not well experienced in C++ I am having trouble deciding on how to load new scenes efficiently level by level or just an open world.
Example
Recent games are heavy, Most populat games are about 40 to 100 gigabytes but neither RAM nor GPU have that much memory at least Normal PC or Consoles.
So obviously most game engines pre-allocate enough memory to fit the scene and sometimes just tolerate some wasted memory but how would you decide how much is enough?
Possible solution
I was planning to create separate game loops, before entering the game loop I would load each level, then start the loop, thus I would be able to deallocate preceding level and then reallocate new memory for a next level.
Since I am new to the world of games and memory management my solution may sound rather stupid, But I need to know how to handle such situations efficiently.

sentences:
How to organize messages queue in a fast-paced multiplayer game I'm trying to develop a fast-paced multiplayer game. I decided to build my own protocol over UDP and now I'm stuck with the following question.

The idea of the protocol is very basic and it's similar to many others:

Client does NOT do any game logic except of some predictions (like smooth walking). It just sends 'ping', 'connect', 'disconnect' and 'keypressed' / 'keyreleased' actions to the server.
On contrary, the server does game logic based on the users inputs and sends diffs to each client every 30 ms

As I already mentioned, the client sends 'ping' messages (to notify server that we're still alive when there's no other messages in some period of time) as well as 'keypressed' / 'keyreleased' stuff.

I thought that the 'ping' messages can be unrelirable -- the client sends them at steady intervals anyway, so if one was lost, nothing bad will happen.

However, such messages like 'keypressed' and 'keyreleased' should be reliable. By this I mean that the client should resend them in case of any failure and they should appear on the server in the same order they were sent (otherwise 'keyreleased' message could arrive before 'keypressed' resulting in the incorrect game behavior).

So, the questions is -- how is it usually handled? I mean, what is the right way to implement such logic on the server? Should I queue all incoming reliable messages in some container and wait until messages with smaller sequence IDs also arrive? If so, what should I do with unrelirable messages then? Because I definitely shouldn't wait before 'ping' message arrived (and there's a chance that it won't arrive at all). Should I use a distinct sequence numbers for unrelirable messages or should I make 'ping' messages reliable as well?

sentences:
Keeping the camera from going through walls in a first person game in Unity? I'm using a modified version of the standard Unity First Person Controller. At the moment when I stand near walls, the camera clips through and lets me see through the wall. I know about camera occlusion and have implemented it in 3rd person games, but I have no clue how I'd accomplish this in a first person game, since the camera doesn't move from the player at all.

How do other people accomplish this?

sentences:
Still having problems using Json data in Unity I have the following classes and json file, i thought id followed the documentation exactly but I am clearly wrong. Can anyone see why I get an error just saying : INVALID VALUE in my unity console:

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

[Serializable]
public class DataReader
{
public float[] x;
public float[] y;
public float[] z;
}

GameController:

public class GameController : MonoBehaviour {
    public static GameController instance;

DataReader dataReader;

private string gameDataFileName = "level1.json";

private void Awake()
{
    dataReader = JsonUtility.FromJson<DataReader>(gameDataFileName);
    instance = this;
}

void Start () {

    // create level:
    print("DATA: " + dataReader.x[0]);
}

}

and the json is stored in StreamingAssets folder (I also tried a copy in Resources folder):

{
"x": [{1},{1},{1},{1}],
"y": [{1},{1},{1},{1}],
"z": [{1},{2},{3},{4}]
}

sentences:
Programmatically drawing a "pencil" line or curve If you look closely (scan it on a computer and zoon in) at a carbon pencil line you can see that there are differing shades of gray.  I tried looking on the Internet for any kind of algorithm or statistical model for how that gray would be drawn programatically.  Does anyone have information on this?  Thanks a lot!!

I want to make drawings on a computer that look they were drawn with a pencil.

sentences:
Tile Map Coordinates I am have now this code: http://jsfiddle.net/DK67k/2/ In here is 2D tile map and when you click on tile you get coordinates on alert. But for get precises coordinate you need click on top left tile(tiles is 16x16) and if I click on bottom right tile I am get second tile coordinates.

Maybe anyone have idea how to fix this?

sentences:
From camera coordinates to world coordinates I want to calculate world coordinates from camera coordinates. However, I seem to have problems with my understandings of how matrices in HLSL work.

From world to camera is clear:

cameraPosition = mul(mul(worldPosition, view), projection);

Logic would now say that for the reverse, I could just use something like

worldPosition = mul(mul(cameraPosition, invProjection), invView);

However, when I check if it is correct with

cameraPosition = mul(mul(mul(mul(cameraPosition, invProjection),
                                   invView), view), projection);

I don't get the same point back anymore.

The inverses should be fine as view * invView produces the identity matrix etc.

What is my misunderstanding here? Even the simpler case does not work:

void VS_test(in  float4 inPosition            : POSITION,
             out float4 outPosition           : POSITION)
{
    outPosition = inPosition;
}

produces the triangle I want. However, using

void VS_test(in  float4 inPosition            : POSITION,
             out float4 outPosition           : POSITION)
{
    outPosition = mul(mul(inPosition, view), invView);
}

already produces no visible triangle. Same with

void VS_test(in  float4 inPosition            : POSITION,
             out float4 outPosition           : POSITION)
{
    outPosition = mul(inPosition, mul(view, invView));
}

Pixel shader is just a shader which returns a constant color.

UPDATE

I have 3D camera-space coordinates WITH z-buffer value, like (0, 0, zNear) for the point directly in the center of the screen. I want to know what world coordinates correspond to this by doing the whole view-transform backwards.

sentences:
Is it bad practice to add GameComponents and DrawableGameComponents outside of the main initialization method? I'm working on a snake game that has multiple game objects (snakes, apples, obstacles), and game modes (classic, adventure), that are DrawableGameComponents. Is it OK that I'm adding them as needed instead of in the main initialization method?

If not, how should I go about drawing and updates components of my game that need to be added in other methods?

If yes, is there any way to get the initialization or load overridden methods to run? Or is making my own load method and calling it right after adding the component how it should be done?

Thanks!

sentences:
Creating a Pawn that simulates physics I'm trying to make a Pawn that I can raycast against. Starting from the DefaultPawn object, I can't find a way to have a StaticMesh cube that simulates physics. My raycasting code works with Actors, but I'd like to apply the same feature to moving objects now.

Any advice on how to achieve this?

sentences:
Pick a color and then Chop image with that color into 7 easy pieces I have an image with 8 colors - (ROYGBIV and white) - I want to create 7 images - each has only one of the colors in the resulting image. I can do that fairly easily in GIMP.

Next I need to chop each of the 7 images into 7 layers - 7 pieces across with identical widths - with full height.

Finally I need to overlay the 7 layers on top of each other and see the resulting locations of the selected color.

Any ideas how to automate this image processing?

sentences: How do I use the morpher modifier in 3dsmax to morph into several targets simultaneously? I have a 3D-Face from Facegen here including all necessary phenomes' positions. But these targets are separated into upper, lower teeth, sock and eyes. How do I combine them for the face to morph into each facial position at once?

sentences:
How to check in single event if two objects are clicked at the same time in libGDX? I am newbie to libGDX and I have written two functions for touchdown,

    LockerKeyHalfImage.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("clickrd Locker>>>>>>>>");
              return false;
        }
        });

    MasterKeyHalfImage.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("clickrd Master>>>>>>>>");
              return false;
        }
});

My problem is to check if these two images are clicked at the same time (multi-touch detection). I tried to use the following lines without success:

 InputMultiplexer im = new InputMultiplexer();
      //  GestureDetector gd = new GestureDetector(ui);
         //   im.addProcessor(gd);
            im.addProcessor(ui);
            Gdx.input.setInputProcessor(im);

Can anyone point me in the right direction?

sentences:
Buggy behavior on basic hinge joint (pinball flipper) I'm trying to make a pinball flipper, but before I begin working on the script to incorporate user controls, I want to get the rotational movement working. Basically it rotates in a circle around the left-most point.

Clearly one option is to make half the flipper invisible. This is the easiest way but it leaves me still not really understanding how to work with rotation. For example:

<======o======>

where o is the midpoint.

I want it to rotate along the same axis, but without the left half of the shape:

       o======>

I have tried watching this video a couple times but am coming short of understanding how the hinge joint works. I attached one my left flipper and set the axis to 0,1,0 so it rotates along the y axis (remaining parallel to the playfield). I also moved the anchor to the leftmost position. I have left the rest of the hinge joint at its default configuration. Here is some evidence:

the placement of the hinge joint (it's the little yellow arrow at the left of the flipper)
the hinge joint config
The buggy behavior
The left paddle's rigid body (it is locked on all position and all rotation except y)

What I'm really trying to do is have the flipper rotate from it's leftmost point as the origin. I just want it to free-rotate when the ball hits it.

sentences:
Creating custom types that extend certain objects Really new to C# scripting. I'm trying to extend a TileBase type object to be able to hold custom methods and variables.

I want to create a pathfinding script and I need to store certain information for each tile. Something like this:

TileBase startPoint = tilemap.GetTile (tilemap.WorldToCell (transform.position));

startPoint.customVariable = 5;

Is there a way to extend TileBase into a new type and create custom methods inside it? How can I achieve this in Unity?

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

public class Tiles {

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

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

private Image grass, dirt, fence, mound;

private SpriteSheet tileSheet;

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

Player player = new Player();

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

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

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

public void update(GameContainer gc) {

}

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

Mouse picking

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

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

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

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

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

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

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

sentences:
Designing a trade / market system I'm working on an idea for a trading game. Players would be traders buying in place A and selling in place B, hopefully for a profit.

I want prices to be dynamic, based on demand and supply. So if place A produces less food than it consumes, prices for food would he high and getting higher the closer they get to running out, while in place B, which has much more production than supply, prices would be near the production cost (minimum price). But if someone buys up a lot of the supply in B, prices would rise, and if someone sells a lot in place A, prices would drop.

Obviously, there are many ways to game such a system if it's not well-designed. The most easy is to empty the market, wait for the price to adjust, then sell everything back.

How could I design this system? I mean the actual math and functions, not philosophical musings. I searched a lot and haven't found anything specific.

I found this question but it and its answers are a lot more specific to the specific formula the guy uses in his game. I'm looking for a more generic approach (I want different price elasticity for different goods, maybe non-linear price curves, etc.)

sentences:
GLSL Sphere from Vertex I am working on a particle simulation where we have a lot of spheres which can have different radii. Using this tutorial http://mmmovania.blogspot.de/2011/01/point-sprites-as-spheres-in-opengl33.html (see also code below) I was able to create a sphere from a point, but they all have the size from glPointSize(). Is it possible to extend this with a radius?

#version 330
out vec4 vFragColor;

uniform vec3 Color;
uniform vec3 lightDir;

void main(void)
{
    // calculate normal from texture coordinates
    vec3 N;
    N.xy = gl_PointCoord* 2.0 - vec2(1.0);
    float mag = dot(N.xy, N.xy);
    if (mag > 1.0) discard;   // kill pixels outside circle
    N.z = sqrt(1.0-mag);

    // calculate lighting
    float diffuse = max(0.0, dot(lightDir, N));

    vFragColor = vec4(Color,1) * diffuse;
}

Maybe of interest: I am using #version 120 for my shaders.
Or, is there a better way to do this?

So, combining the two answers I now have:

void
Draw::setGeometry(float* geometry, float* velocity, float* radius, GLuint size){
    this->_size = size;

    glGenBuffers(1, &_vertexData);
    glBindBuffer(GL_ARRAY_BUFFER, _vertexData);
    glBufferData(GL_ARRAY_BUFFER, _size * 3 * sizeof(float), geometry, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glGenBuffers(1, &_velocityData);
    glBindBuffer(GL_ARRAY_BUFFER, _velocityData);
    glBufferData(GL_ARRAY_BUFFER, size * 3 * sizeof(float), velocity, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glGenBuffers(1, &_radiusData);
    glBindBuffer(GL_ARRAY_BUFFER, _radiusData);
    glBufferData(GL_ARRAY_BUFFER, size * sizeof(float), radius, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

}

And the drawing method:

void
Draw::paint(GLenum mode){
    glBindBuffer(GL_ARRAY_BUFFER, _vertexData);
     glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, 0);

    glDrawArrays(mode, 0, _size * 3 * sizeof(float));
    glDisableVertexAttribArray(0);
}

And the Vertex Shader:

#version 130

attribute vec3 position;
attribute vec3 velocity;
attribute float size;

uniform mat4 MVP;
uniform mat4 MV;

void main(){
   gl_PointSize = size;

   gl_Position = MVP * vec4(position, 1.0);
}

The problem is that when gl_PointSize = 15 is set, they are drawn well. When I make it equal with size, then it looks like this: http://picpaste.com/Big_particles-daIBnJCG.png

Works better now. Particles still getting bigger as they move along.

sentences:
How can I generate biome borders? I'm looking for ways to generate random biome borders (like what Minecraft has).

One technique involves choosing specific biomes based on (eg) a rainfall map and a temperature map. But that just determines which biome to place, not where the borders between biomes are.

I don't want to use quantized Perlin noise directly; that would generate certain quantized values strictly within other zones, whereas I'd like finer control over which biomes can abut others. For example, in Minecraft one can see mountainous terrain, forests, plains, or deserts right next to the ocean.

Many of the solutions to "the biome problem" propose computing the whole universe in a heuristic manner. I want to generate infinite terrain, and to me that suggests the algorithm be strictly functional: given an X,Y value (and a world seed) the algorithm can easily spit out a biome value.

So, my question: what are some techniques for identifying random, non-trivial-sized, contiguous chunks of terrain to be of a given biome?

sentences:
How can I test on a device I don't have? I received a report that my application fails to run on a specific device (smartphone).

However, not only I don't have access to that device, but they're also quite rare, and I'm not going to buy one just to fix this problem.

Unfortunately, it is imperative that I support that device, as it is a requirement to get published on a store I need to publish on.

Do you guys have any ideas on what can you do when you need to test on a device you don't and can't have?

sentences:
Why every character I drag to timeline is disabled in the timeline? I dragged 3 different characters to the timeline window and each one asked for track so I did animation track for all of them but on each track on the left side there is a yellow triangle say "The component is disabled"

I created cinemachine virtual camera and it added the brain component to the main camera and created a timeline automatic for the virtual camera but when dragging a character to the timeline window I'm getting this yellow triangle with the message it's disabled.

You can see in the screenshot on the left side in the timeline window the yellow triangles with the message.

sentences:
How do I implement a retro-style password-based "savegame" system? How would I make a password system for a single-player game like the ones used in older console games?

For example, Mega Man X saves work by giving you a series of numbers that you can enter later to load your save.

sentences:
How to generate a "loop room" in a platformer game (by Unity)? I want to build a level with a room whose left edge is linked to right edge in a 2D platformer game in Unity.

My goal is let all objects disappear in one side will appear in other side of the room.
Just like this:

Both sides should have collision with other objects.

Right now I'm doing this by cloning objects on the other side, but it is too complicated. Is there any other good way to solve this?

sentences: How can i draw a curve in modern Opengl? OpenGl is capable of rendering points, lines, triangles and quads;  but what if i want to draw a bezier curve? I read online you should use something called GL_STRIP, but the solutions were using either legacy Opengl, or they were not explaining well the process. The question is: How can i render bezier curves in Modern Opengl? I'm using C++.

sentences: When tracing how do I tell if I hit a wall or floor? I perform a trace and when it hits the world I get a location and the surface normal.  Does anyone have a good way to find out if I hit a wall or a floor?

sentences:
Tiling 2D textures in random order I am wondering what the best way to make a random set of 2D textures. Currently I have tried the follow code but I am aware that when this comes to collisions that would be an issue. Therefore I would really appreciate a different method of achieving this.

Random random = new Random();
        for (int i = 0; i < 10; i++)
        {
            GenPos = new Vector2((800 + (Length * Stone.Width)), (500 - (i * Stone.Height)));

            int number = random.Next(1, 3);

            if (i == 9)
            {
                if (Length < 31)
                {
                    i = 0;
                    Length++;
                }

            }
            else if (number == 1)
            {
                spriteBatch.Draw(Stone, GenPos, Color.White);
            }
            else if (number > 1)
            {
                spriteBatch.Draw(Grass, GenPos, Color.White);
            }

        }

This code works except for two critical things, the collision detection method dose not work as the GenPos changes throughout the code and that the Stone and Grass flashes. Also note that the grass is just a place holder for a future texture of Iron_Ore. I am wondering what the best method for achieving this would be because I need it to be able to detect collisions using a similar detection method to:

public Boolean StonePlayerCollision()
    {
        if (playerPosition.Y >= (StonePosition.Y + Stone.Height) && playerPosition.Y <= StonePosition.Y ))
        {
            return true;
        }
        else
        {
            return false;
        }

    }

If you are to suggest a new method, which would be much better than maintaining this messy system please note that the Tiled area will need to be in the view matrix method as seen below:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend,
            SamplerState.LinearWrap, null, null, null, camera.ViewMatrix);

I hope that someone will be able to suggest the best / most efficient way of making a randomly tiled textures that can be detected by collisions.
Thank You.

sentences:
Roatating a Game Object downward In my game I have a rocket which is traveling horizontally across the screen.

What I am trying to do is when the player runs out of fuel, the rockets engine stops (already coded) and then the rocket will slowly rotate to point at an almost 45 degree angle and fall down off the screen as gravity takes its affect.

How do I do this?

sentences:
How can I tweak this A* search pathfinding algorithm to handle different terrain movement values? I'm creating a 2D map-based action game with similar interaction design as Diablo II. In other words, the player clicks around a map to move their player. I just finished player movement and am moving on to pathfinding.

In the game, enemies should charge the player's character. There are also five different terrain types that give different movement bonuses. I want the AI to take advantage of these terrain bonuses as they try to reach the player.

I was told to check out the A* search algorithm (http://en.wikipedia.org/wiki/A*_search_algorithm). I'm doing this game in HTML5 and JavaScript, and found a version in JavaScript: http://www.briangrinstead.com/blog/astar-search-algorithm-in-javascript I'm trying to figure out how to tweak it though.

Below are my ideas about what I need to change. What else do I need to worry about?

When I create a graph, I will need to initialize the 2D array I pass in passed on with a traversal of a map that corresponds to the different terrain types.
in graph.js: "GraphNodeType" definition needs to be modified to handle the 5 terrain types. There will be no walls.
in astar.js: The g and h scoring will need to be modified. How should I do this?
in astar.js: isWall() should probably be removed. My game doesn't have walls.
in astar.js: I'm not sure what this is. I think it indicates a node that isn't valid to be processed. When would this happen, though?
At a high level, how do I change this algorithm from "oh, is there a wall there?" to "will this terrain get me to the player faster than the terrain around me?"

Because of time, I'm also debating reusing my Bresenham algorithm for the enemies. Unfortunately, the different terrain movement bonuses won't be used by the AI, which will make the game suck. :/ I'd really like to have this in for the prototype, but I'm not a developer by trade nor am I a computer scientist. :D

If you know of any code that does what I'm looking for, please share!

Sanity check tips for this are also appreciated.

sentences: How to open a .RKV file from Wii ISO So, a few days ago, I got the itch to try my hand at creating a modded version of one of my favorite Wii games: Star Wars: The Force Unleashed. However, when I unpacked the ISO, I noticed some of the files had the extension .RKV. I have scoured the internet in search of any information, but all I could find was that this file extension is typically associated with RKive archives. After going through all the trouble of getting that software to run on a Win95 VM, it too could not open the file. In fact, it said it wasn't even an RKive archive. I have spent all whole day researching with no progress, so if anyone could tell me what this file extension is and how to open it, I would greatly appreciate it.

sentences:
How do I create a knockback-movement? I am a web developer new to game development, and with limited math knowledge. I am writing a character movement controller in Unity. The game has an isometric Diablo-like camera. The character moves on mouse click within a limited area.

The character moves like this now:

I want it to move like this:

I don't need you to write the code for me: I just want to understand what the math for this looks like. A Unity- and C#-specific explanation would be great, but not necessary.

sentences:
How to create offsetting lines that draw across the screen in Monogame? I'm trying to create an effect on the screen like the gif below. Basically lines that are offset by 1 pixel draw across the screen from either side which then eventually creates a solid color.

I'm using Monogame for this and I'd prefer a shader doing it. The only resolution I'd need to support is 240x160.

I've delved a bit into a scanline shader to see if I could adapt it, but so far it doesn't look like it's going to work.

sentences: SDL2 - Why use `SDL_Window* win` and not `SDL_Window win`? Is there a reason to allocate the window on the heap and not the stack?

sentences: How can I use gpu to crop unnecessary pixels from an image? I would like to keep only the color and x,y coordinates of the pixels that are touching a pixel that is a different color than itself (basically the edges) and remove the rest so that the gpu can compare two edge pixels without needing to read through all the pixels that fill the shape. I want to process this more afterwards but I am trying to do this to limit how many gpu cores the edge detection need so that I can use those cores for other processing at the same time. I am not planning on this as a shader or any graphic thing I’m using it as an AI vision for a game character. I know that they have machine learning for this but I want to avoid that if possible. Not for any reason except I want to know what is going on in there. How can I do this without using the cpu?

sentences:
Box2D Body creation causing performance issues I have at max 10 dynamic bodies in my world at any time. they are created at random and fired up from below they screen. when a new body is being created, the fps falls from 59 - 61 to about 35- 40 and then jumps back up again straight away which obviously causes the other dynamic bodies that are moving about the screen to stick for a split second. i am creating the bodies like below...

private void addBadger(){
    badgerCount++;
    //dimensions
        //pix
            float badgerWidthPix = RandomNum.randFloat(screenWidth/16f, screenWidth/16f);
            float badgerHeightPix = badgerWidthPix;
        //meters
            float badgerWidthMet = badgerWidthPix*pix2met;
            float badgerHeightMet = badgerHeightPix*pix2met;
    //position
        //pix
            float badgerXPosPix = RandomNum.randFloat(0, screenWidth-badgerWidthPix);
            float badgerYPosPix = -badgerHeightPix;
        //met
            float badgerXPosMet = badgerXPosPix*pix2met;
            float badgerYPosMet = badgerYPosPix*pix2met;
    //Image
        Badger badger = new Badger(badgerAliveTexture, badgerShotTexture, badgerXPosPix, badgerYPosPix, badgerWidthPix, badgerHeightPix, String.valueOf(badgerCount), manager, tweenManager, this, screenWidth, screenHeight);
        badgerArray.add(badger);
        badgerGroup.addActor(badger);
    //body
        //get object from json
            jsonBodyLoader = new BodyEditorLoader(Gdx.files.internal("json_objects/badger.json"));
        //define body
            bodyDef = null;
            bodyDef = new BodyDef();
            bodyDef.position.set(badgerXPosMet, badgerYPosMet);
            bodyDef.gravityScale = 1;
            bodyDef.fixedRotation = false;
            bodyDef.type = BodyType.DynamicBody;
        //set velocities
            float xVel = RandomNum.randFloatPossNeg(0.25f, 1f);
            float yVel = RandomNum.randFloat(11.5f, 14f);
            float rotation = RandomNum.randFloat(1, 5);
            if(xVel < 0){ rotation = -rotation; }
            bodyDef.linearVelocity.x = xVel;
            bodyDef.linearVelocity.y = yVel;
            bodyDef.angularVelocity = rotation;
        //define fixture
            fixtureDef = null;
            fixtureDef = new FixtureDef();
            fixtureDef.density = 2;
            fixtureDef.friction = 0.5f;
            fixtureDef.restitution = 0.25f;
            fixtureDef.filter.categoryBits = CollisionCategories.BADGER;
            fixtureDef.filter.maskBits = CollisionCategories.BADGER;
        //create body
            Body badgerBody = world.createBody(bodyDef);
            badgerBody.setUserData(badger);
        //attach fixture
            jsonBodyLoader.attachFixture(badgerBody, "Badger", fixtureDef, badgerWidthMet, 1, 1);
        //set body to image
            badger.body = badgerBody;

//call new badger
    //get interval
        badgerCreationInterval = (RandomNum.randFloat(minAddBadgerDelay, maxAddBadgerDelay));

the filtering I am using on the Images is mipmap.LinearNearest, Nearest

sentences:
How to calculate a direction vector for camera? I have a vector that describes change in movement, and I have a 3d-vector, m_rot, that describes a rotation given to an object.
I want to calculate a direction vector using both this data.
How to achieve that?

I tried to multiply the components of a direction vector onto sin and cos of m_rot values, but that gave me nothing.

direction.x = direction.x * ::cosf(m_rot.x);
direction.y = direction.y * ::sinf(m_rot.y);
this->camera_world_pos += direction;

But after that my camera still walks into a simple directions, and not a direction that it looks at.

sentences:
Problem modifying GameObject in list of GameObjects Unity So I've been working on a little project that involves Valve's "Portal" style portals, the type where you can seamlessly see what's on the other side and walk through. I've run into a problem when it comes to teleporting an object to it's new location upon hitting the portal. I have a List<GameObject> that contains all the objects that are in close enough range to feasibly travel through the portal, but when I try to modify the transform.position of one of these GameObjects, nothing happens, no error messages.
So I've been going through my script line by line and writing little dummy functions to test different parts of it to see where the problem lies, and everything seems to work up until I index the list and try to modify a value, nothing happens. So was thinking that perhaps the List doesn't actually contain a reference to the GameObject in the scene, but simply a copy of the GameObject's data at the time it was passed into the list. So I checked this by making the list public so that I see it in the inspector, and when I click on an item in the list it highlights that same GameObject in the hierarchy, which suggests it is actually a reference. See bellow...

I am at a loss as to what's happening here and would really appreciate if anyone could offer a suggestion, Here is the dummy function where I try to arbitrarily modify the GameObject data from the List...
        if (Input.GetKeyDown("k"))
        {
            for (int i = 0; i < trackedTravelersObjects.Count; i++)
            {
                trackedTravelersObjects[i].transform.position += new Vector3(0, 30, 0);
                Debug.Log("K");
            }
        }

You'll notice a Debug.Log("k"), this is just to check that the code is actually being called, which it is.
Thanks.

sentences:
How can I get textures on edge of walls like in Super Metroid and Aquaria? Games like Super Metroid and Aquaria present the terrain with the other facing parts having rocks and stuff while deeper behind them (i.e. underground) there's different detail or just black.

I would like to do something similar using polygons. Terrain is created in my current level as a set of overlapping square boxes. I'm not sure if this rendering method will work such a system for creating terrain but if anyone has ideas I'd love to hear them. Otherwise I'd like to know how I should re-write the terrain rendering system so it actually works to draw terrain in this manner...

sentences:
How to create a re-usable layout of text fields that can be bound to in world space? Current tools:

Unity 2020.3.2f1 (Win10)
UI Builder preview package

My end-goal is to do the following:

At varying intervals, change values for many data objects in the background, such as prices, resources, demand, supply, etc.
Display those values in a flat table/list (as they change) in world space to the player, e.g. on a TV screen (or a transparent panel hovering above it, etc.)
Have the ability to apply that layout (and its bindings) to another world space object of a different size, e.g. on a smaller or wider TV screen

Imagine an office with 15 desks, all with 3 monitors showing the same data feeds and changing statistics, except the monitors were all different shapes and sizes. How could you avoid building all 45 monitor layouts individually, and binding to each field separately? So my question is:
What is the "right" way to build a re-usable UI (ideally with UXML/USS), display it in world space, and have the ability to update the text in that layout?
I thought that UI Builder + UXML/USS would be the answer, but I am having trouble parsing how my end goal would be accomplished using that (or if that is even an appropriate use case for UI Builder). Fields that are displayed using UIDocuments are not exposed in the Hierarchy, and can't be dragged onto a script's input in the Inspector, for example. I'm able to project a UXML/USS layout onto a texture => material => object, but I'm not sure how to bind to the fields within the layout:

The screenshot above is my latest attempt, a POC of a live timer (on the right) manually being updated (using a TextMeshPro field, works great), and the yellow panel to the left is a UXML/USS layout pasted onto a texture/material that's applied to a panel (in a canvas). On the far left is that same layout being used as a HUD, just to confirm it works the same as the floating panel. In-game, this data will not be part of the HUD, it will only be in world space. As a POC, I have been trying unsuccessfully to get the timer value from the gray panel to bind to the "should be time" text in the UXML.
So, should I just bite the bullet and build each layout by hand using game objects (such as in the gray panel)? Or am I halfway there with the UXML and just misunderstanding how UIDocuments work? Or is there a new smarter way of doing this I haven't heard of yet? Not looking for a full code example or anything, just a push in the right direction.

sentences:
How to check strings from multiple lines in one input field? I need help with input fields. I already set the line type to 'Multi_Line NewLine' in inspector, but I have problem with submitting the string. Here's the code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class GameController : MonoBehaviour {
    public string code;
    public string code1;
    [SerializeField]
    public InputField input;

    public void Check(string guess)
    {
        if (string.Equals (guess,code)) {
            Debug.Log ("correct");
        } else
            Debug.Log ("wrong");
    }
    public void GetInput(string guess)
    {
        Check (guess);
        input.text = "";

    }
}

I want to have both 'code' and 'code1' strings to be inserted in different lines inside the same input field but I don't know how to check both 'code' and 'code1' string value inside the Check(). Any help would be appreciated.

sentences:
Texture Mapping to procedurally generated geometry How can I calculate texture coordinates of such geometry?

The angle shown in the image (89.90 degree) may vary, therefore the geometry figure is changing and is not always such uniform.(maybe like geometry in the bottom of image) and red dots are generated procedurally depends on degree of smoothness given.

sentences:
Handling differing inventory items on use interactions Hey there my fellow programmers. Looking for a little input into a potentially smelly code problem (I was about to post this on the Code Review SE, let me know if that's the more proper place).

After looking at a few of the answers here on setting up an rpg like inventory and using a component based system, I've come up with a format to creating items, here are a couple of examples.

Entity potion = new Entity("Potion", new Item(100,50), new Healing(75,0));
Entity elixer = new Entity("Elixer", new Item(50, 25), new TempStatIncrease(0,5,...));

Here are the classes involved.

Entity Class
IComponent[] components
string name

IComponent Interface
ComponentType componentType

Item Class : IComponent
int purchasePrice
int resaleValue

TempStatIncrease Class : IComponent
int strength;
int agility;
...

Healing Class : IComponent
int hpAmount;
int mpAmount;
Heal(Character character);

Now where I run into a bit of design trouble is how to handle interacting with these items. If I have "Potion" selected, and hit the use key in my inventory, it brings up the character list for me to select a character. When I select a character this is the code that would run:

Character Class
UseItem(Entity entity)
{
    foreach(IComponent component in entity.components)
    {
      switch(component.Type)
      {
         case Healing: { ((Healing)component).Heal(this); } break;
         case TempStatIncrease: { ((TempStatIncrease)component).Increase(this); } break;
         case ... //This could get ugly quick.
      }
    }
}

I feel like the above approach is prone to disaster. It's a switch for one, I have to modify this every time I want a character to be able to use a new component. Two, I have to do a not-so-nice cast to the concrete component. Add to the fact I have to create a new ComponentType enumeration for each new component, another piece of maintenance.

Any thoughts on how I might be able to re-factor my implementation to remove the potentially disastrous switch statement and that complex component casting?

sentences:
Unity - UI button not triggering custom script function I have created simple movement buttons in my game. They should trigger functions of the player's scripts, but I can't link the button to the player object/script canonically from the inspector 'cause the player is created at runtime.
So I created a custom script attached to the buttons:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class ActionButton : MonoBehaviour {

    private Button btn;

    void Start()
    {
        btn = GetComponent<Button>();
        btn.onClick.AddListener(TriggerFoo);
    }

    public void TriggerFoo()
    {
        Debug.Log("Btn triggered!!!!");
    }
}

Haven't implemented yet the behavior I want to achieve with it, but even at this point the button doesn't print the string on console.

Here is how the button is set up in the inspector:

I am missing something very obvious here....?

sentences:
Implement Fast Inverse Square Root in Javascript? The Fast Inverse Square Root from Quake III seems to use a floating-point trick. As I understand, floating-point representation can have some different implementations.

So is it possible to implement the Fast Inverse Square Root in Javascript?

Would it return the same result?

float Q_rsqrt(float number) {

  long i;
  float x2, y;
  const float threehalfs = 1.5F;

  x2 = number * 0.5F;
  y = number;
  i = * ( long * ) &y;
  i = 0x5f3759df - ( i >> 1 );
  y = * ( float * ) &i;
  y = y * ( threehalfs - ( x2 * y * y ) );

  return y;

}

sentences:
where have the shape drawing functions gone in DirectX10? such as the CreateTeapot function - http://msdn.microsoft.com/en-us/library/windows/desktop/bb172798(v=vs.85).aspx

Is there an equivalent in DX10? If so, how do I use it?

In DX9 you..

Declared:

LPD3DXMESH meshTeapot;

Initialised:

D3DXCreateTeapot(device, &meshTeapot, NULL);

Drew:

meshTeapot->DrawSubset(0);

Released:

meshTeapot->Release();

Is there an equivalent set of methods for drawing primitives? (to be honest the sphere is of more interest to me than the teapot!)

sentences: Using UDP vs Websockets I am running a Unity Game on a PC (for development purposes) and then on an Android phone (for production). I need to send data to the Game continuously from a WiFi enabled microcontroller (Esp32). Is it better for me to use UDP or Websockets for data transfer? What are the pros and cons of each method? In this scenario, the game device will act as a mobile hotspot while the esp32 will connect to this hotspot.

sentences:
Error while reading TGA file and doing Texture Cube map In my program, i read a TGA file with a function like this:

char* LoadTGA(char* filename, int* width, int* height, int* bpp);

As you can see, this function: return a char array of image data (without TGA file header, from the first pixel row of image to the last pixel row of image), width of TGA image, height of TGA image, and bits per pixel of image data. The part of code that read image data is this:

    int w = pHeader->width; //width of image
    int h = pHeader->height;  // height of image
    int rowSize = w * pHeader->bits / 8;   //The bit is bits per pixel
    bool bInverted = ( (pHeader->descriptor & (1 << 5)) != 0 );  //My TGA image is not inverted so bInverted is false.
    for ( int i = 0; i < h; i ++ )
    {
        char * pSrcRow = pSrc +
            ( bInverted ? ( h - i - 1 ) * rowSize : i * rowSize );
        if ( pHeader->bits == 24 )
        {
           for ( int j = 0; j < w; j ++ )
           {
               *pDest ++ = pSrcRow[2];
               *pDest ++ = pSrcRow[1];
               *pDest ++ = pSrcRow[0];
               pSrcRow += 3;
        }
    }
}

As this code show, for my TGA image, which have bits per pixel (bpp) equals to 24, not inverted, the return char array will be from the first pixel row of image to the last pixel row of image.

I read a image of 512 x 384 pixels like this image below:

I use this image for texture cube so i read 6 parts of this image in following function:

bool Texture::SplitTextureCube(int i, char* des)
{
int l, m, size = width/4;
int aTopLeft[][2] = {{size*2, size}, {0, size}, {size, 0}, {size, size*2}, {size, size}, {size*3, size}};
int rowSize = height * bpp / 8;
for (int j = 0; j < size; j++ ) //height
{
    char * pSrcRow = imageData + (aTopLeft[i][2] + j) * rowSize + aTopLeft[i][0];
    if ( bpp == 24 )
    {
        for ( int k = 0; k < size; k ++ )   //width
        {
            *des ++ = pSrcRow[0];
            *des ++ = pSrcRow[1];
            *des ++ = pSrcRow[2];
            pSrcRow += 3;
        }
    }
    else
    {
        for ( int k = 0; k < size; k ++ )
        {
            *des ++ = pSrcRow[m + 0];
            *des ++ = pSrcRow[m + 1];
            *des ++ = pSrcRow[m + 2];
            *des ++ = pSrcRow[m + 3];
            pSrcRow += 4;
        }
    }
}
return true;
}

This function is called as below:

 char *face = new char[width/4 * height/3 * bpp/8];
    glGenTextures(1, &textureId);
    glBindTexture(GL_TEXTURE_CUBE_MAP, textureId);
    for (int i=0; i<6; i++)
    {
        SplitTextureCube(i, face);
        glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_RGB, width/4, height/3, 0, GL_RGB, GL_UNSIGNED_BYTE, face);
        //glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
    }
    delete [] face;

I guess you need no more explain. The problem is when my program running, my cube texture is disordered like this:

I sure that problems are inside my "SplitTextureCube" function, i sure that i read pixels in the wrong order, please help me fix that function.

sentences:
How to make child object a member of two parents in unity? So I have an parent game object that has multiple objects.

This format is desirable:

-GameObject
    -object1 (abstract)
        -subobject1

    -object2 (abstract)
        -subobject2

    -object3 (abstract)
        -subobject1
        -subobject2
// There are two objects in the scene, subobject1 and subobject2

The problem is when i drag and drop one subobject from an object it removes it from the other object. When i copy the subobjects to another object, there are now two.

I hope this makes sense.

sentences:
Voronoi / Delaunay Graph - Triangle Circumcenter error I have written a Delaunay Graph script that given a set of points (voronoi cell/region) will generate the Delaunay triangles with their edges. Considering that the Voronoi diagram is complimentary to the Delaunay graph, I can infer the Voronoi regions, edges and corners once the Delaunay graph is complete.

I had previously implemented this in 2D without any troubles and the results were flawless in all of the diagrams I generated. However, I have since tried to implement this in 3D and have now encountered issues.

My implementation of this appears to work fine in 99.9% of cases which leads me to believe that perhaps floating point/rounding errors may be the problem or (more likely) my understanding of the code used to determine the circumcenter is incorrect.

I have based the following implementation on this answer from How do I find the circumcenter of a triangle in 3D?

public static Vector3 Circumcenter(Vector3 a, Vector3 b, Vector3 c)
{
    Vector3 ab = (b - a);
    Vector3 ac = (c - a);

    Vector3 abXac = Vector3.Cross(ab, ac);

    Vector3 i = (ab.sqrMagnitude * ac);
    Vector3 j = (ac.sqrMagnitude * ab);
    Vector3 k = Vector3.Cross((i - j), abXac);

    return (a + (k * (0.5f / abXac.sqrMagnitude)));
}

The screenshots below are of two separate graphs both generated by creating the Voronoi cells/regions in nested for-loop's before attempting to solve the graph. I have tried creating the points randomly, hard coding them, setting different values along the Y-axis or having them all set to a specific constant on the Y-axis, all of which exhibit the same behaviour.

These examples do not use Lloyd relaxation but for the sake of completion, running the solver over several iterations also produces incorrect results.

I have been trying to debug this for weeks now and cannot for the life of me understand why this does not work. My understanding of the math is fairly solid but I really can't begin to narrow this down to resolve the issue.

It would appear that when solving the graph, the circumcenter for three of the nodes is sometimes incorrect (or so i'm lead to believe from the visual output). However, the Delaunay representation appears to be correct which leads to even more confusion on my part.

In the above images, the lines and points represent:

Red point: Voronio cell/region.
Black Line: Delaunay Edge.
Blue point: Voronoi Corner.
White Line: Voronoi Edge.

The Voronoi graph is determined by creating a Delaunay edge between two nodes and first setting the start point of a Voronoi edge. Once the graph finds another Delaunay triangle along this exact same edge between two nodes, the end point of the Voronoi edge is then set completing this edge entirely.

As you can see in the both images, the Delaunay representation of the graph is correct. However, again in both images, the Voronoi representation has incorrect corners which then leads to incorrect edges.

If anyone can shed any light on this, or point me in the right direction, that would be greatly appreciated.

sentences:
Object array in unity not instantiating properly I'm trying to instantiate my CarMovement class with my population class for a Genetic Algorithm, but when i run the project, the car prefab doesnt spawn.

Everything is wired up in the inspector correctly. Anyone know whats going on?

Here's the population class:

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

public class Population : MonoBehaviour {

    public int populationSize = 10;
    private CarMovement[] cars;

    // Use this for initialization
    void Start () {
        cars =  new CarMovement[populationSize];
        for (int i = 0; i < populationSize; i++) {
            cars [i] = new CarMovement ();
            cars [i].score = 1+i;
            Debug.Log (cars [i].score);
        }
        //cars[0].Start();
    }

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

Here's the CarMovement/Individual class:

public class CarMovement : MonoBehaviour {

    public float speed = 2f;
    public Rigidbody2D rb2d;
    public Vector2 spawnPosition = new Vector2((1.0f)*0.1f,3.83f);
    public int score;
    public GameObject carPrefab;

    // Use this for initialization
    public void Start () {
        rb2d = GetComponent<Rigidbody2D> ();
        GameObject.Instantiate (carPrefab,spawnPosition,Quaternion.identity);
        Debug.Log ("YAAAA");

    }

    // Update is called once per frame
    public void Update() {
        rb2d.transform.Translate (speed * Time.deltaTime, 0, 0);

    }
}

sentences:
How to abstract mouse movement event streams for networked multiplayer? I'm building a mouse driven 3rd person shooter with client-server network architecture.

My input system is event based. Keyboard input is captured by keys.S.onUp() keys.S.onDown() events. When these events are triggered I immediately pass them across the network to be replicated on the server and other clients.

Mouse input is captured by a mouse.onmove() event that receives data from screen coordinates x,y. This method is fired constantly as the mouse is moved producing a flood of data. This may be premature optimization, but I feel like its a bad idea to immediately pass this flood over the network.

I currently have an abstraction that wraps the mouse.onmove() event and creates essentially a mouse.moveStart() and mouse.moveStop(). This significantly reduces the flood of mouse input to send on the network.

Unfortunately, this abstraction produces a less responsive feel on the local client experience. I am setting a lookVelocity. When mouse.moveStart() is triggered the camera position and player rotation is updated per-frame by the lookVelocity value. This produces a stiff fixed rate movement. If you rapidly move the mouse the camera movement is not reflected.

Additionally, this is an isomorphic/universal code base. Meaning I am using the same code between client and server. Ideally, I would like to reuse the same mouse event abstraction between both client and server.

sentences:
Monogame - SpriteBatch.DrawString() won't work Here is my Game1.Draw() method (Constants.HeroLayerDepth is equal to 1):

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

        //  gameEngine.DrawEverything(spriteBatch, camera);
        spriteBatch.Begin();

        spriteBatch.DrawString(defaultFont, "Test Field", new Vector2(0, 0),
            Color.Black, 0, new Vector2(0, 0), 0f, SpriteEffects.None, Constants.HeroLayerDepth);

        spriteBatch.End();

        base.Draw(gameTime);
    }

Although I am calling DrawString(), I only see this after running the code:

How can I fix this?

sentences:
Is it possible to generate a Spheremap from a Texture2D in Unity at run-time? I was trying to create a spheremap from a Texture2D for a skybox at run-time (Standalone build) in Unity. Does anyone know if this is possible and how to do that in Unity?

In the editor you can set a texture to a cubemap and then select it's import setting as a spheremap, but I can't find a way to do this at run-time using the Unity API.

sentences:
Declaring Keycodes as strings How do I declare the keycodes as strings instead of selecting the keys from a list? Such that the user can input a key in inspector window and it will be read?
public string StringKey = "a";

void Update () {

   if (Input.GetKeyDown (KeyCode.StringKey)) {

   }

sentences:
Scale VBO magnitudes based on aspect ratio On my screen I have drawn a box. When I adjust my screen size (to a non 1:1 aspect ratio) I get a rectangle. This is obviously something wrong with my projection matrix.

I am attempting to keep everything in my engine scaled from 0->1 to make it simple to define assets and have them look good on any size screen.

I would like to make my internal VBO sizes scale with the window's aspect ratio. In this example I have one asset that I define as having a width and height of "0.01" which is 1/100th the screen size.

I create the following VBO with this...

    GLuint VAO, VBO, EBO;
    GLfloat verts[] = {
            width, height, 0.0f,
            width,   0.0f, 0.0f,
             0.0f,   0.0f, 0.0f,
             0.0f, height, 0.0f
    };
    GLuint idxs[] = {
            0, 1, 3,
            1, 2, 3
    };

    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &VBO);
    glGenBuffers(1, &EBO);

    glBindVertexArray(VAO);

    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(idxs), idxs, GL_STATIC_DRAW);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), NULL);
    glEnableVertexAttribArray(0);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);

I'm using an ortho matrix from (0, 1, 0, 1, 0, 1), I'm correclty doing my PVM multiplication in my shader, and I've correctly translated my matrix.

My boxes are still rectangles and I believe that this is because my original "1/100th" screen size is different from my new screen's width and height. How do I correctly scale my width and height that I've given to my VBO?

Edit: PS you can find all of the important pieces of code in my git repo (https://github.com/gravypod/solid-snake/). I'd link directly to the right section but StackExchange seems to have a karma based limit...

sentences:
Simulating "line of sight" with obstacles on 2d grid? Ran into an interesting problem. I need to figure out how to simulate line of sight - simple enough, just on a 2d grid with obstacles. Either a grid cell is visible, or it's not.

I can get something really rudimentary going - like spreading n spaces from player, or blocking horizontal propagation when an adjacent obstacle is detected, but I can't let myself live with it. Plenty of other apps are using more sophisticated methods that slope the line of sight around corners etc, and I want to be up to par.

So far DCSS has been my source of inspiration when I'm stumped, I'm hoping to get something close to what they have: http://crawl.s-z.org/.

Any insight would be appreciated - thanks for the help!

(Forgive if this is embarassingly noobish - only started game dev a few weeks ago, trying hard to catch up.)

sentences:
How to adapt my mobile game for different aspect ratios? Before I start, I'd like to note that I work in the Unity Engine, but the basic theoretical stuff should be similar just about anywhere.

It's not really hard to get the game's camera/World view or UI to scale to many types of devices with different pixel counts as long as they have the same aspect ratio. But devices in general, and especially mobile phones, have all sorts of variables, aspect ratios can be anywhere from 16:9 to 20:9, and there are all sorts of different types of notches too. For this question I'm primarily going to ask about the aspect ratio and not touch on notches for now to stay on topic, but if you could explain how I can handle notches, that would be a good bonus.

So, how do I make a game for a mobile device, that can be played in portrait and horizontal mode, on anything from small 16:9 screens like the Samsung Galaxy S5, to larger 19:9 aspect ratio (A notch) in the Google Pixel 4?

Unfortunately due to IP restrictions, I can't show art, and I can't reveal the core mechanic of the game. but I have created a general mock up of what the ideal world/UI scaling would look like:

The UI needs to be able to scale to the edges of the display like any other game. But the edges of the world need to be the edges of the screen (There needs to be walls that appear at on all 4 edges of the screen), however because the game is physics based, the walls can't actually move else it would cause inconsistencies between in the game from device to device.

I know what I'm talking about here is primarily theoretical, but as someone who doesn't know much about aspect ratios (or notches), how can I ensure my game works consistently on this range of devices?

sentences:
GL_SPOT_CUTOFF not working properly I'm new to OpenGL. I'm studying OpenGL 2.1 and I'm trying to make a little program to test the GL_SPOT_CUTOFF property, but when I set a value between 0.0-90.0, the light doesn't work and everything is dark.

The code:

void lightInit(void) {

    GLfloat light0Position[] = {0.0,0.0,2.0,1.0};
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0);
    glLightfv(GL_LIGHT0, GL_POSITION, light0Position);
}

void reshapeFunc(int w, int h) {

    glViewport(0, 0, (GLsizei) w, (GLsizei) h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    if (w <= h)
        glOrtho(-4, 4, -4*(GLfloat)h/(GLfloat)w, 4*(GLfloat)h/(GLfloat)w, -4.0, 4.0);
    else
        glOrtho(-4*(GLfloat)w/(GLfloat)h,4*(GLfloat)w/(GLfloat)h, -4, 4, -4, 4.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    gluLookAt(0,0,0,0,0,-1,0,1,0);

}

void displayFunc(void) {

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // center sphere
    glutSolidSphere(1, 100,100);

    // right sphere
    glPushMatrix();
        glTranslatef(3,0,0);
        glutSolidSphere(1, 100,100);
    glPopMatrix();

    // left sphere
    glPushMatrix();
        glTranslatef(-3,0,0);
        glutSolidSphere(1, 100,100);
    glPopMatrix();

    glutSwapBuffers();

}

void keyboardFunc(unsigned char key, int x, int y) {

    if (key==27) {
        exit(EXIT_SUCCESS);
    }

}

int main(int argc, char** argv) {

    //freeglut init and windows creation
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(600, 500);
    glutInitWindowPosition(300, 100);
    glutCreateWindow("OpenGL");

    //glew init and errors check
    GLenum err = glewInit();
    if (GLEW_OK != err) {
      fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
      return 1;
    }
    fprintf(stdout, "---GLEW %s---\n\n", glewGetString(GLEW_VERSION));

    //general settings
    glClearColor(0.0, 0.0, 0.0, 0.0);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);

    //light settings
    lightInit();

    //callback functions
    glutDisplayFunc(displayFunc);
    glutReshapeFunc(reshapeFunc);
    glutKeyboardFunc(keyboardFunc);

    glutMainLoop();

    return 0;

}

This code produces this image:

If I delete glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 45.0);, the next image is produced:

Is there some kind of bug ?

sentences:
How do i set Lua variables? You can pretty easily read variables, but what about writing them to the lua file?

Ive given it a little go, but it doesnt seem to work...

void Lua::setBool(string path, string var, bool val) { //"Lua" is a class with my Lua functions (such as get bool, get float...)
    lua_State *L = luaL_newstate();
    luaL_openlibs(L);
    if (luaL_dofile(L, path.c_str())) { // For some reason, "!luaL_dofile" triggers if i input the path Correctly
        string msg = "Unable to open file " + path;
        MessageBox(NULL, msg.c_str(), "Lua IO", MB_ICONERROR);
    }

    lua_pushboolean(L, val);
    lua_setglobal(L, var.c_str());

    lua_close(L);
}

And yes, ive inputted "var" and "path" correctly.

sentences:
How to make an irregular shape that displays how far a unit can move through the map? I'm still new to programming, and I was wondering if there is a way to make an irregular shape that displays how far a unit can move through the map taking in account pathing around obstacles. For example, as shown in the overworld of Total War:

I do not want to brute force it by checking every pixel that is in range as that's probably too slow to do in the game maker engine.

The pathing uses the mp_grid of game maker which I heard is A* (but I don't really know what that means or how it affects what I want to accomplish).

Is there a way to get a similar thing in a 2D space, but not necessarily as precise?

sentences:
Collision Resolution I know quite well how to check for collisions, but I don't know how to handle the collision in a good way.

Simplified, if two objects collide I use some calculations to change the velocity direction. If I don't move the two objects they will still overlap and if the velocity is not big enough they will still collide after next update. This can cause objects to get stuck in each other.

But what if I try to move the two objects so they do not overlap. This sounds like a good idea but I have realised that if there is more than two objects this becomes very complicated. What if I move the two objects and one of them collides with other objects so I have to move them too and they may collide with walls etc.

I have a top down 2D game in mind but I don't think that has much to do with it. How are collisions usually handled?

This question is asked on behalf of Wooh

sentences: 2D game with 3D collision? How do they do this bounce? Looks awfully complicated in 2D.

sentences:
Can ARToolKit be used for color detection? I'm trying to make an app that will show an object from different sides, but the target will be too small for any real marker detection.

Think of a cube with one or two centimeter sides. The camera distance is not a problem but it has to be at least ten centimeters out or what I'm trying to do won't work.

I was wondering whether it was possible to color one side of the cube differently than others and make ARToolKit recognize the color to know which side it's looking at. Is this possible or just not in the range of things ARToolKit can do? If so, is there any kind of AR that can do this.

sentences:
Generate a 2d mesh terain out of triangles (low details) I'd like to learn a good algorithm to generate a 2d mesh made out only of triangles to be used as a terrain.

Its not important to get a high detail terrain. It should just have a triangle looking style.

Also the mesh should be extendable endlessly in all directions because the map will be endless. I thought about to having chunks of meshes saved in a file so they can be loaded during the execution.

Something like this (from Chasing Aurora):

sentences:
OpenGL ES black screen I am a beginner to drawing with OpenGL ES and I have a problem. I am drawing a figure consisting of triangles in orthographic projection, but when I run my app, I see a black screen and system buttons only (I am using a real device and not an emulator).

Why do I get a black screen, and how could I fix it?

I am using OpenGL ES 1.0 version.

Initialization before drawing:

float[] verticesArray = new float[] {
        180.0f, 80.0f, 10.0f,
        260.0f, 80.0f, 10.0f,
        318.0f, 138.0f, 10.0f,

        260.0f, 80.0f, 10.0f,
        318.0f, 138.0f, 10.0f,
        318.0f, 216.0f, 10.0f,

        318.0f, 138.0f, 10.0f,
        318.0f, 216.0f, 10.0f,
        260.0f, 264.0f, 10.0f,

        318.0f, 216.0f, 10.0f,
        260.0f, 264.0f, 10.0f,
        180.0f, 264.0f, 10.0f,

        260.0f, 264.0f, 10.0f,
        180.0f, 264.0f, 10.0f,
        122.0f, 216.0f, 10.0f,

        180.0f, 264.0f, 10.0f,
        122.0f, 216.0f, 10.0f,
        122.0f, 138.0f, 10.0f,

        122.0f, 216.0f, 10.0f,
        122.0f, 138.0f, 10.0f,
        180.0f, 80.0f, 10.0f,

        122.0f, 138.0f, 10.0f,
        180.0f, 80.0f, 10.0f,
        260.0f, 80.0f, 10.0f
};
verticesAmountTotal = verticesArray.length/3;
coordsOfVerticesAmountTotal = verticesArray.length;

ByteBuffer byteBuffer = ByteBuffer.allocateDirect(coordsOfVerticesAmountTotal * 4);
byteBuffer.order(ByteOrder.nativeOrder());
vertices = byteBuffer.asFloatBuffer();
vertices.put(verticesArray);
vertices.flip();

Drawing method:

gl.glViewport(0, 0, glGraphics.getWidth(), glGraphics.getHeight());
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrthof(0, 480, 0, 320, 30, -1);
gl.glColor4f((float)Math.random(), (float)Math.random(), (float)Math.random(), opacity);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertices);
gl.glDrawArrays(GL10.GL_TRIANGLES, 0, verticesAmountTotal);

sentences:
XNA UV Mapping flipping the Texture every second time I am making a tile based game. Recently I moved to drawing tiles as primitives to speed up things and also allow for easier lighting (Vertex Shader).

I then took it a step further and made some calculations to "merge" together tiles into the same primitive to gain even more performance, and to get around UV texture problems I simply did this...

if (!top)
{
    //Adds the top vertices
    thisquad.Vertices[0] = new VertexPositionTexture(new Vector3(new Vector2(p.X, p.Y), 0), new Vector2(0, 0));
    thisquad.Vertices[1] = new VertexPositionTexture(new Vector3(new Vector2(Tile.Size + p.X, p.Y), 0), new Vector2(1, 0));
    top = true;
}
//Extends the bottom vertices
thisquad.Vertices[2] = new VertexPositionTexture(new Vector3(new Vector2(p.X, Tile.Size + p.Y), 0), new Vector2(0, currentquadtilecount));
thisquad.Vertices[3] = new VertexPositionTexture(new Vector3(new Vector2(Tile.Size + p.X, Tile.Size + p.Y), 0), new Vector2(1, currentquadtilecount));
currentquadtilecount++;

With currentquadtilecount starting at 1, if a tile is floating on its own it will display the texture properly, but for every second tile that merges, the texture is flipped. As shown below...

What am I doing wrong? Is this even the right way to do this??

Twitchy

sentences: Blending effect on textures Hi i am trying to build screen animation like flickering, interlace, color separation similar to old style malfunctioning Amiga screens. The intended effects are shown in this  video. I am using libgdx and I already discovered the universal tween engine, which helps a lot to build transitional animations, but how should I approach those blending effects, any suggestions? I will specify my question once I learned more about libgdx, but maybe you could give me some hints already. Thanks!

sentences:
Fragment shader, tint color problem I am new to shaders, and I am trying to tint a texture to mark status of a enemy.

I am implementing shaders on OpenGL ES 2.0 (Mobile)

The problem is that with this shaders, I see the enemy without change (even if I assign de fragcolor to (1.0, 0 , 0 ,1.0), the real code is commented).

Vertex shader

uniform mat4 u_MVPMatrix;       // A constant representing the combined model/view/projection matrix.
uniform mat4 u_MVMatrix;        // A constant representing the combined model/view matrix.

attribute vec4 a_Position;      // Per-vertex position information we will pass in.
attribute vec3 a_Normal;        // Per-vertex normal information we will pass in.
attribute vec2 a_TexCoordinate; // Per-vertex texture coordinate information we will pass in.

varying vec3 v_Position;        // This will be passed into the fragment shader.
varying vec3 v_Normal;          // This will be passed into the fragment shader.
varying vec2 v_TexCoordinate;   // This will be passed into the fragment shader.

// The entry point for our vertex shader.
void main()
{
    // Transform the vertex into eye space.
    v_Position = vec3(u_MVMatrix * a_Position);

    // Pass through the texture coordinate.
    v_TexCoordinate = a_TexCoordinate;

    // Transform the normal's orientation into eye space.
    v_Normal = vec3(u_MVMatrix * vec4(a_Normal, 0.0));

    // gl_Position is a special variable used to store the final position.
    // Multiply the vertex by the matrix to get the final point in normalized screen coordinates.
    gl_Position = u_MVPMatrix * a_Position;
}

Fragment shader

precision mediump float;        // Set the default precision to medium. We don't need as high of a
                                // precision in the fragment shader.
uniform sampler2D u_Texture;    // The input texture.

varying vec3 v_Position;        // Interpolated position for this fragment.
varying vec3 v_Normal;          // Interpolated normal for this fragment.
varying vec2 v_TexCoordinate;   // Interpolated texture coordinate per fragment.

// The entry point for our fragment shader.
void main()
{

    vec4 texVal = texture2D(u_Texture, v_TexCoordinate);
    gl_FragColor = (1.0, 0 , 0 ,1.0);//vec4(texVal.rgb, texVal.a)*(1.0, 0 , 0 ,1.0);

}

sentences:
Combining rotation,scaling around a pivot with translation into a matrix In short: I need to combine rotation (in the form of a quaternion), scaling around a pivot point along with translation into a transformation matrix.

The long:
I am trying to implement a proprietary model format. This format includes animations. Part of that animation involves generating a matrix which combines rotation (in the form of a quaternion) and scaling around a pivot point, with translation into a transformation matrix. I am using OpenGL and the OpenGL math library (GLM)

Someone else has already implemented parts of the proprietary model format using DirectX. The part in question was implemented in directX like this:

D3DXMatrixTransformation(&BaseMatrix, &ModelBaseData->PivotPoint, NULL, &ScalingVector, &ModelBaseData->PivotPoint, reinterpret_cast<D3DXQUATERNION*>(&RotationVector), &TranslationVector);

I found the WINE implementation of this function and attempted to duplicate it like this:

mat4 m1, m2, m3, m4, m5, m6, m7, p1, p2, p3, p4, p5;

m5 = glm::translate(0,0,0);
m7 = glm::translate(pivot+translationVector);
m1 = glm::translate(-pivot);
m3 = glm::scale(scalingVector);
m6 = glm::mat4_cast(rotationQuaternion); //Convert quaternion to a matrix

//m2 & m4 are identity
p1 = m1;// * m2
p2 = p1 * m3; //Apply scaling first
p3 = p2;// * m4;
p4 = p3 * m5;
p5 = p4;
p5 = p4 * m6;
mat4 result = p5 * m7;

(I realize glm::translate(0,0,0) is the identity matrix)
Unfortunately neither the scaling nor the rotation seems to work correctly like this. So I took another approach based off of this ordering of translation, rotation and scaling.

mat4 result = glm::scale(scalingVector) * glm::translate(pivot) * glm::mat4_cast(rotationQuaternion) * glm::translate(translationVector);

However the scaling does not appear to be around the pivot point and I'm not entirely sure about the rotation. Does anyone have any tips on how to accomplish this?

sentences:
Trying to Access Components of an Object in another class I think my C# is a bit lacking here but I am trying to access a component in a list of objects in another class. I am trying to access UnitController from MultiSelectClient and I'm not sure how to do this. I can remove the objects from the list but I can't seem the access each one even if I try a ForEach loop, I can't wrap my head around it.

UnitController.SelectedUnits //Is the list I'm trying to access.

Ive tried doing

UnitController.SelectedUnits.Find/FindAll(gameObject)//but that returns an error

This is where the list is defined

public class UnitController: MonoBehaviour
{
    bool clicked = false;
    bool dragging = false;
    //public float speed = 10f;
    //public float rotationSpeed = 10f;

    public LayerMask groundLayer;
    public NavMeshAgent playerAgent;

    public static Vector3 mouseDownPoint;
    public static Vector3 mouseUpPoint;
    public static Vector3 currentMousePoint;

    public static Rect selection = new Rect(0, 0, 0, 0);
    private Vector3 startClick = -Vector3.one;
    public Texture2D selectionHighLight;

    public static List<GameObject> SelectedUnits;

    public RaycastHit firstRay;
    public RaycastHit secondRay;

    private void Start()
    {
        SelectedUnits = new List<GameObject>();
    }

This is the script that needs to access it. At least I want to be able to iterate through the list and access each unit in the list and its components.

public class MultiSelectClient : MonoBehaviour
{
    public bool Selected = false;
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            Vector3 camPos = Camera.main.WorldToScreenPoint(transform.position);
            camPos.y = Screen.height - camPos.y;

            //if inside the cameras drag selection area then mark player as selected
            Selected = UnitController.selection.Contains(camPos);

            Debug.Log("Selected");
            if (Selected)
            {
                addTo();
            }
            else
            {
                UnitController.SelectedUnits.//something
                UnitController.SelectedUnits.Remove(gameObject);

            }
        }

    }
```

sentences:
When creating a game, what are some architectural desgin concepts I can use to be able to port my game from single to multiplayer? I am a software developer but, I mostly develop games in Unity. I have experience creating single player games as well as multiplayer games. I am at a crossroads where I am in the middle of development of a proof of concept or small demo and all of a sudden I am asked to turn it into a multiplayer game without prior knowledge of this I turn around and say it would add 50% to development time because I basically have to start over from scratch because I didn't necessarily take into account that later down the road they might want to change the experience from single to multiplayer.

So with all of that out of the way, are there any different methodologies out there that would make it easier on the developer to port a game from single player to multiplayer?

I have thought of a possible way of doing this by just setting the game up as single player, however, making my functions where they are easily able to wrap them using Commands and RPCs. But I find this may or may not help me and is only dependent on what the requirements are.

My biggest time killer when it comes to porting these PoC's is typically the UI. Most of the time my requirements are so that the UI will be the same shared UI for all clients and having to update it for each action performed on it and dealing with handling ClientAuthority. (Any tips for dealing with this would be greatly appreciated too) Think of this as something like, making something with Legos in multiplayer and having shared instructions based on the step the user is on.

Summary

What are different ways that I can design a small demo/concept where I can easily port it to multiplayer later on, or make my game where it is "multiplayer friendly" ? Or should I try to stay away from this type of thinking altogether and just develop a single player aspect and just develop a multiplayer aspect, arguments for and against this concept are sought after.

sentences:
Machine Learning in AI for benefit analysis round to round in a rummy like game For fun I am building the game 5 crowns. Well I've gotten to the point where I am implementing the rules for the computer players.
I've found that my decision tree has so many nodes on it that I wonder if it would be easier to implement an algorithm that would take a small subset of the nodes and infer the rest from that basic subset.

Basically I would like to input a subset of rules.
So the following are the rules for each round

Round number determines which card is wild

Minimum card value is 3 so in round one 3's are wild.

You may only have a specific number of cards in your hand.

The amount of cards in your hand is equal to the value of the card that's wild.

You can draw from the discard pile or the deck.
Your goal is to be the first one to lay down their hand by building sets or runs.

A set or run must have at least 3 cards in it.
Runs can only have cards of the same suite.

After a player lays down their hand each remaining player has one more turn to lay down.
Any cards left in your hand when the round ends are totaled and added to your score.
Higher cards are worth more points.

So if my hand was the following, and it was the first round (I.E. 3's are wild):

hand = [{value: 3, suite: hearts},  //3 of hearts
        {value: king, suite: clubs}, //king of clubs
        {value: 7, suite: spades}]  // 7 of spades

And the card on top of the discard pile is a 5 of diamonds ({value: 5, suite: diamonds})

I would engage in the following thought process:

The 5 has a lower score then the 12 or 7, which would be good if I can't lay down when the round ends.
However, unless someone before me has already laid down, I will have at least one more turn; at which point, if I need to, I can ditch the 12.

There is a high probability that if the player right before me has a 12, they will dump it. Allowing me to pick it up next turn and lay down.

This may not be the first turn and I may of seen the player after me take a 7 or 12.
If I draw a card there is a higher probability of getting something useful (I.E. another 7, 12, or wild). Which would let me go out.

Most human players would accept the risk inherent in keeping the 7 or 12 and draw a card from the deck, instead of taking the 5.

The above logic isn't very hard to implement. It's when you extrapolate it out and have to do the cost/benefit analyses on 13 cards in your hand, that decision making tree becomes a lot more complex. Which would be why I want to look into machine learning to solve this problem.

As a note I have already implemented the logic to determine if you can go out. The above applies to how the computer should evaluate the pro's and cons of a specific action (which card to draw, and which card to discard, and to an extent, when in higher rounds, how to structure the runs/sets needed to lay down it's hand).

sentences:
Creating a Custom Map Editor using XNA and Windows Forms I'm looking to create my own level editor for a game I'm making, and I came across the following post:

Tutorial or Example of creating custom sprite tool/map editor for XNA?

In the example posted by Blau, I am unsure what needs to be replaced in this line, and with what:

XnaControlGame.CreateAndShow<MainDialog, VoxelEditorGame>( );

If anyone could help at all, that would be great!

sentences:
Can I include PCM audio data in a commercial application? For certain reasons, I need raw audio data in my application. I would convert certain sounds to a PCM format (at development time), and store & load these PCM files in my game.

PCM stands for Pulse Code Modulation, and as far as I can see, it is a representation of signal, and thus cannot be patented by anyone. Only formats can be patented I suppose (e.g. WAV, which relies on PCM), but PCM sequence of bits cannot be.

So if I include PCM data in my application package, I don't violate any patent, do I?

I'm developing for Android, by the way.

sentences:
Animated Energy/Combo Bar (Unity 4.6) How could I achieve the animated Combo bar effect used in Ski Safari / Ski Safari: Adventure time? Preferably with Unity 4.6 UI. General explanations also welcome!

Links to videos showing the wanted effect:
https://www.youtube.com/watch?v=CnfCkqiM890#t=4m46s
and
https://www.youtube.com/watch?v=aqj61liRJ74#t=7m00s

sentences:
Rotating UI element using touch for mobile - Unity 2D I want to create the above object that will rotate on z-axis following the direction of a finger. Like a dial. I have written the following code and attached it to that element:

private float rotationRate = 3.0f;

    void Update()
    {
        // get the user touch input
        foreach (Touch touch in Input.touches)
        {
            Debug.Log("Touching at: " + touch.position);

            if (touch.phase == TouchPhase.Began)
            {
                Debug.Log("Touch phase began at: " + touch.position);
            }
            else if (touch.phase == TouchPhase.Moved)
            {
                Debug.Log("Touch phase Moved");
                transform.Rotate(touch.deltaPosition.y * rotationRate,
                                 -touch.deltaPosition.x * rotationRate, 0, Space.World);
            }
            else if (touch.phase == TouchPhase.Ended)
            {
                Debug.Log("Touch phase Ended");
            }
        }
    }

But the element does not move at all. Any ideas?

EDIT:

Here is a gif for better understanding:

sentences: How to create a polygon button in LibGDX? I need to make a button not a standard square shape, but a polygon shape.How to create a polygon button in LibGDX?

sentences:
Should iOS games use a Timer? No matter what frameworks we use -- Core Graphics, Cocos2D, OpenGL ES -- to write games, should a timer be used (for games that has animation even when a user doesn't do any input, such as after firing a missile and waiting to see if the UFO is hit)?

I read that NSTimer might not get fired until after scheduled time (interval), and CADisplayLink can delay and get fired at a later time as well, only that it tells you how late it is so you can move the object more, so it can make the object look like it skipped frame.  Must we use a Timer?  And if so, what is the best one to use?

sentences:
How to Clamp rotation of a turret I'm going mad to clamp rotation of an object.

I've tested using Inspector that correctly rotation range is Z>-15 and Z<30.

I've written this code but it isn't working properly !

if (rb.transform.rotation.eulerAngles.z > 30)
    rb.transform.Rotate (-Vector3.forward * speedTurretMovement  , Space.Self);
if (rb.transform.rotation.eulerAngles.z < -15 )
    rb.transform.Rotate (Vector3.forward * speedTurretMovement , Space.Self);

Thanks

sentences:
Deferred decals normal problem I've been working on a deferred decal system. So far I have finished the projection part, meaning I can click something in the scene and it will properly project a decal onto the surface of the object.

There are a couple other things I wish to add to this system: normal clipping and normal mapped decals. Normal clipping is when I discard fragments that are stretched across a sharp angle. Seen here. A way to solve this is to  discard fragments that have a large difference between the normal in the G-Buffer and the decal's normal. This would require reading the G-buffer's normal texture.

In order to do decal normal mapping, I need to blend the decal's normal (from a normal map) with the G-buffer's normal. The requires writing to the G-buffer's normal texture.

I hope it's clear that in order to support these two features, I need to read and write to the normal texture in the same shader pass. Sadly, this is undefined behavior, so I'm wondering if there is some other way to implement these features.

sentences:
How can I render a single object that uses multiple textures? I'm looking for a technique to render an object with multiple texture sources. One texture is static, the other is generated dynamically (it's a render target). For example, say I was rendering a TV. The frame of the TV is a static texture and the image comes from a render-to-texture pass.

It doesn't sound difficult but I've been unable to find a decent approach. Some of my ideas are:

Instead of rendering to a unique texture I render to a part of the other texture (so the part with the TV screen is overwritten, the frame remains). This doesn't work if I want to combine multiple textures (two TVs with different frames, same show playing)
Create a two-part object: render the TV frame as one-object then render the image as another. This would require leaving a hole in the one model, or putting the other model slightly on top. Is there a drawback to this approach?

Is there another approach that works well?

sentences:
DXUT getters are always null using DLL I'm struggling with a problem for a while and I hope some of you can help me out. The title for this question is vague, so I will try to explain my problem as best as I can!
I'm am creating a project (in C++ using Visual studio 2012) with a DLL that has the DirectX toolkit and DXUT as references. I initialize DXUT (the device and all that kind of stuff) in the DLL and create a GameScene (GameScene is in the executable) after DXUT is initialized. The GameScene derives from its base class BaseScene (BaseScene is in the DLL project).
When I call DXUTGetD3D11Device() to get the DirectX device in the GameScene (in the executable) it is all fine, but when I call DXUTGetD3D11Device() in the BaseScene it returns null.
Note: This counts for all the DXUT functions!
Note: The executable has the same references as the dll + the dll!
If you need more information to answer my question, ask me! I find it really hard to explain my problem and I will try my best to make it more clear!

sentences:
Affect of timeStep on PhysicsBodies in SceneKit In SceneKit, I had a problem on collision of two dynamic spheres, when the one strikes to another with fast speed, it was passing through inside of it. After i have reduced physicsWorld.timeStep value from 1/60 to 1/300, collision of Spheres becomes perfect. However in this moment, if sphere strikes to static wall, it started to slide along the wall (like sticky) instead of being reflected from wall. Ball started to lose so much energy after colliding to wall.

When timeStep was 1/60, ball was bouncing on the wall even in so low speeds, instead sticking to wall. What kind of parameters are affected in physicsBody of the wall or ball by the timeStep?

Wall Parameters;

let ballMass: CGFloat = 0.08
physicsWorld.timeStep = 1/300

let wallGeometry = SCNPlane(width: (maxX - minX), height: wallHeight)
wallGeometry.firstMaterial?.diffuse.contents = UIColor.red
wallGeometry.firstMaterial?.isDoubleSided = true
let shapeWallGeometry = SCNPhysicsShape(geometry: wallGeometry, options: nil) //su an lik bir ise yaramiyor

let wallNode = SCNNode(geometry: wallGeometry)

wallNode.position = SCNVector3( x: Float(xCenter), y: Float(minY-cushionHeight/2), z: Float(cushionHeight)/2 )

wallNode.physicsBody = SCNPhysicsBody(type: .static, shape: shapeWallGeometry)
wallNode.physicsBody?.restitution = 0.82
wallNode.physicsBody?.friction = 0.91

wallNode.physicsBody?.categoryBitMask = PhysicsCategory.WallType.rawValue | PhysicsCategory.GravityType.rawValue
wallNode.physicsBody?.collisionBitMask = PhysicsCategory.BallOneType.rawValue | PhysicsCategory.BallTwoType.rawValue | PhysicsCategory.BallThreeType.rawValue | PhysicsCategory.GravityType.rawValue
wallNode.physicsBody?.contactTestBitMask = PhysicsCategory.BallOneType.rawValue | PhysicsCategory.BallTwoType.rawValue | PhysicsCategory.BallThreeType.rawValue
self.rootNode.addChildNode(wallNode)

sentences: Easiest way to make a button in Gamemaker Studio 2 I want to make a menu for my title screen where the user can click on the option they want. The only way I can think of doing this is by making an object that checks if there is a click and then checks if the mouse is on top of it. This feels like a really round-about way to do this. Is there an easier way? I don't yet know how to use the GML so, please use DnD.

sentences:
Making neural nets more efficient in Unity Some backstory: currently using a Asus x555la so not the fastest laptop. Computing power is kind of the problem.

Hi there. I am currently doing hand tracking in Unity. I have developed a half-and-half approach to cut down lag and CPU stress (using one half image processing and one half good old fashioned neural nets). I am trying to embed an object detection neural net in Unity, and I have done so using TensorFlowSharp, but I can't figure out how to cut down lag. It's currently managing around 1FPS. How do I speed up neural nets in Unity. It doesn't have to be loads, just around 30FPS.

Has anyone had any experience using neural nets in Unity, and how did you make it work well?

sentences:
ECS and life management of entities I am done with my game's framework and I am trying to implement a
life-management system. My framework so far has:

Systems that hold pointers to the Entities they are interested in.
An Engine class that owns the different systems.
An EntityManager that owns the Entities.

Now every time you add/remove a Component to/from an Entity, the Entity notifies the engine class to run a(n) (un)registration routine that passes the Entity to the Systems which in turn decide whether they want to (un)register the Entity or not.

Say that I have a DestroyerSystem that remembers all Entities with a HealthComponent and is responsible for deleting the ones with no life:

void DestroyerSystem::update(float dt = 0)
{
        for (auto& entity : registered_entities)
        {
                if (entity.getComponent<HealthComponent>().hp == 0)
                {
                        EntityManager.destroy(entity);
                }
        }

}

The problem is that the Systems are supposed to keep valid pointers to the Entities and I am not sure how I can achieve that cleanly.

The only solution that I have so far is to make the Systems have an unregister() function that takes the pointer to the deleted element and erases it from the registered_entities container. The Engine class would also have an unregister() function that would call the unregister() functions of the Systems. This works good for the other systems but creates problems when applied to the DestroyerSystem because it breaks iteration. To tackle this I copy the container and iterate on that one instead:

void DestroyerSystem::update(float dt = 0)
{
        auto entities = registered_entities;
        for (auto& entity : entities)
        {
                if (entity.getComponent<HealthComponent>().hp == 0)
                {
                        entityManager.destroy(entity);
                        engine.unregister(entity);
                }
        }

}

Does anyone have any better proposals for this?

sentences:
Lag compensation with networked 2D games I want to make a 2D game that is basically a physics driven sandbox / activity game. There is something I really do not understand though. From research, it seems like updates from the server should only be about every 100ms. I can see how this works for a player since they can just concurrently simulate physics and do lag compensation through interpolation.

What I do not understand is how this works for updates from other players. If clients only get notified of player positions every 100ms, I do not see how that works because a lot can happen in 100ms. The player could have changed direction twice or so in that time. I was wondering if anyone would have some insight on this issue.

Basically how does this work for shooting and stuff like that?

Thanks

sentences:
GameObject not exiting through leftScreen I'm trying to wraparound game object so that, it exits through right screen and enters through left and vice versa.
The code snippet below is what I'm working on.

Vector3 Pos = mainCam.WorldToScreenPoint(transform.position);
Vector3 LS  = mainCam.ScreenToWorldPoint(new Vector3(-1, 0f, 0f));
Vector3 RS  = mainCam.ScreenToWorldPoint(new Vector3(1, 0f, 0f));

if (Pos.x > Screen.width)
        transform.position = new Vector3(LS.x, transform.position.y, transform.position.z);

if (Pos.x < 0)
        transform.position = new Vector3(RS.x, transform.position.y, transform.position.z);

So far, exit through right and re-enter through left works, but the gameObject does not exit through the left screen, there seems to be a barrier preventing it, or maybe my parameters for the second if statement are wrong.

sentences:
How can I simulate thousands of things at high frame-rates? I'm working on a simulation game like SimTower where I'd like to keep track of thousands of items at once.

Other games like this, appear to have hundreds or thousands of rooms with elevators with what looks like hundreds or thousands of people. I'm concerned about achieving the same thing in my game.

How can I realistically keep track of each individual person/room/elevator in the game? I assume I can only render what's on the screen, but how can I afford to constantly simulate everything that is off the screen?

sentences:
Pathfinding in multi goal, multi agent environment I have an environment in which I have multiple agents (a), multiple goals (g) and obstacles (o).

.  .  .  a  o  .  .  .
.  .  .  .  o  .  g  .
.  a  .  .  .  .  .  .
.  .  .  .  o  .  .  .
.  o  o  o  o  .  g  .
.  o  .  .  .  .  .  .
.  o  .  .  .  .  o  .
.  .  .  o  o  o  o  a

What would an appropriate algorithm for pathfinding in this environment?

The only thing I can think of right now, is to Run a separate version of A* for each goal separately, but i don't think that's very efficient.

sentences:
Texturing in OpenGL, Should texture coordinates be assigned to vertices in the shader? I attempting to texture 3D models (a cube for example) using ibo’s, with OpenGL in Java. Currently, my textures are distorted. I believe this is because only a single texture coordinate is being assigned to each vertex, as the meshes are loaded from wave front (.obj) files.

As each vertex should correspond to multiple texture coordinates, should I be assigning texture coordinates to vertices as the data is loaded from file or would it be better to assign texture coordinates to vertices in the shader?

I would appreciate example code.

sentences:
Any recommended books/resources on component-based design? I come from a background with heavy use of the classical object-oriented paradigm for software development.

The company I am a part of switched to Unity not too long ago, and we're all very excited to get started using it  However, one aspect that have sparked my interested, and which I think will become a very important part of our future development, is Unity's approach to component-based design with scripting; with less focus on typical hierarchical aspect.

Question

I was wondering if anyone could recommend any good books on this subject? I have had trouble finding any books or books with reliable reviews, and was wondering if anyone more experienced here had something to say on the issue?

Any other kind of resource would be excellent too, I'm just interested in getting to learn everything I can about it.

This is not meant as a discussion about best books or resources on the topic, but simply a question regarding any resources that any of you find useful.

Thank you all for your time!

sentences:
How to animate material alpha property via script? I am creating Animator OverrideController via script based on current controller assigned to animator component. I have created animation curve for position and it works. When i try to animate transparency (material color alpha) it does not work (it does not make any effect, however in Animation Dopesheet there is yellow line: "Object name : Material.Color.a (Missing!)"). Did I fail to properly access this property or is it the consequence that creating animation via script works only for legacy animations with Animation component?

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

public class AnimationScript : MonoBehaviour {

    void Start()
    {
        AnimationClip clip = new AnimationClip();

        AnimationCurve curve = AnimationCurve.EaseInOut(0.0f, transform.position.x, 1.0f, transform.position.x);
        clip.SetCurve("", typeof(Transform), "localPosition.x", curve);

        curve = AnimationCurve.Linear(0.0f, 1.0f, 1.0f, 0.0f);
        clip.SetCurve("", typeof(Material), "_Color.a", curve);

        Animator anim = GetComponent<Animator>();
        AnimatorOverrideController animatorOverrideController = new AnimatorOverrideController(anim.runtimeAnimatorController);
        // "loop" is the name of clip not name of state
        animatorOverrideController["loop"] = clip;
        anim.runtimeAnimatorController = animatorOverrideController;
    }

}

However analogous code for legacy Animation component works:

void Start()
{
    Animation anim = GetComponent<Animation>();
    AnimationCurve curve;

    // create a new AnimationClip
    AnimationClip clip = new AnimationClip();
    clip.legacy = true;

    // update the clip to a change color
    curve = AnimationCurve.Linear(0.0f, 1.0f, 2.0f, 0.0f);
    clip.SetCurve("", typeof(Material), "_Color.a", curve);

    // now animate the GameObject
    anim.AddClip(clip, clip.name);
    anim.Play(clip.name);
}

What am I missing and why is first script not working?

sentences:
Using State Pattern with Unity I am new to Game Development and Unity. I have written a component for Jumping and Running, CharacterJumpAbility.cs and CharacterRunAbility.cs.

I would like the Character to be able to Jump only if the Character is not moving. I came across a State Pattern but I can't understand how to apply it. For example if I want to Jump, first I must check if the Character is Running, but I have to do this in the CharacterJumpAbility.cs or in the CharacterController.cs (the component who handles inputs)?

If I define a state for example:

public enum CharacterState {
    Run,
    Jump
}

For example if the player is pressing the space bar, I have to set the Jump state, the code that sets state = CharacterState.Jump should be written in the CharacterJumpAbility.cs or in the component that handles inputs?

And if I want to set a new state for example Jump, while I am running, this is clearly not possible, how to handle situations like these?

sentences:
How to detect when the player has filled a shape? In my game, the player is presented with a plane containing obstacles (orange / blue) and regions of empty space (white).

The player moves their green cube around the empty space, which instantiates a trail of green cubes behind it, painting the path they've travelled.

I need to detect when the player has painted all of the empty space, so that they can proceed to the next level.

Initial state of the board:

When the player has painted all of the empty space:

Currently I store my instantiated paint objects in a list.

But I don't know how to check that the objects in this list cover all of the empty space. How can I do that?

public float speed = 10f;
private RaycastHit hit;
public GameObject paintcube;
float maxdistance = 0.51f;
bool moves;

private void FixedUpdate()
{
    Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 3, Color.green);
    if (Physics.Raycast(transform.position,transform.TransformDirection(Vector3.forward), out hit, maxdistance/*,layerMask*/))
    {
         if (hit.collider.gameObject.tag == "myobstacle")
         {
             moves = false;
         }
         if(moves)
         {
             movepaint();
         }
     }
}

public void movepaint()
{
     if (moves)
     {
         MyList.Add( Instantiate<GameObject>(paintcube, position, transform.rotation) );
     }
}

sentences:
Touch through GameObject, best practice in the game I am doing atm you have an area with monsters.
There are two modes to damage monsters :

tapping on them
casting spells on the ground

Tapping and damaging a monster works fine.

The problem : If I have selected a spell and want to cast it on the ground, the monster collider blocks my touch of the ground behind the monster.

My solution was to disable the monster collider when I want to cast a spell.

    GameObject[] toDisable = GameObject.FindGameObjectsWithTag ("Touch");

    foreach (GameObject g in toDisable) {
        g.GetComponent<Collider>().enabled = active;
    }

And ... it works.

Now my question is : Is this an adequate solution? They say GetComponent is slow, but I guess with 20 to 30 monsters running around it should be fine?
Anything else that could be done? Maybe there is some Unity magic I am not aware of.

sentences:
Basic 2D Lighting Optimization Issue in Fragment Shader with OpenGL (GLSL) I'm using a fragment shader to implement 2D lighting (code further below). Even though I am satisfied with the visuals of the light i noticed that it has a quite big GPU usage, and when trying to add about 40+ light sources the usage is close to 100% (GTX 1050).
I have a uniform array of structs that contain data about each light source and for loop that goes through all of them.
At first I thought I was pushing too much data to the GPU so I combined the RGB values of the light color in a single 32 bit integer and the two strengths of the light in a single 32 bit integer as well. Then I tried simplifying the formulas I used (using a composed, by composed I'm not referring to the operation, function from multiple linear functions) but it seemed that just made the matters worse.
I think it's worth noting the difference between LightStrength and VisualStrength values that I used in the code, the LightStrength is the strength of the light that lights up the medium around it and the VisualStrength is the strength of the colored hue around the light. And there is also a dark hue variable that is used to make the scene darker as of in the different times of the day.
The code of the fragment shader:
#version 450 core

in vec2 texCoord0;
uniform vec3 CameraPosition;
uniform mat4 Projection;
uniform float DarkHue;

uniform sampler2D u_Texture;
uniform vec2 u_resolution;

struct LightSource {
    vec2 Position;
    int LightColor;
    int ArgumentValue;
};

uniform LightSource LightSources[300];
uniform int LightSourceCount;

float GetLightfactor(float x,float Streght) {
    return min(1/(x*(Streght/100.0)+1),1);
}

void main() {
    gl_FragColor = texture2D(u_Texture,texCoord0);

    vec3 LightSum = vec3(0);
    vec4 PCameraPosition = vec4(CameraPosition,0) * Projection;

    vec2 NormalizedPosition = gl_FragCoord.xy*2/u_resolution-1;

    float LightFactor,VisualFactor,LightStreght,VisualStreght;

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

        vec4 Pos = vec4(LightSources[i].Position,0,0) * Projection + PCameraPosition;

        vec2 coord = (NormalizedPosition-Pos.xy) * u_resolution;
        LightFactor = 0.0;
        VisualFactor = 0.0;

        LightStreght = LightSources[i].ArgumentValue & 0xffff;
        VisualStreght = (LightSources[i].ArgumentValue >> 16) & 0xffff;

        float lng = length(coord);

        LightFactor = GetLightfactor(lng,LightStreght);
        VisualFactor = GetLightfactor(lng,VisualStreght);

        LightSum = mix(LightSum,vec3(1),gl_FragColor.rgb * LightFactor * (1-DarkHue)) + vec3(((LightSources[i].LightColor >> 16)&0xff)/255.0,((LightSources[i].LightColor >> 8)&0xff)/255.0,(LightSources[i].LightColor&0xff)/255.0) * VisualFactor;

    }

    gl_FragColor.rgb *= DarkHue;
    gl_FragColor.rgb += LightSum;

}

The code of the c++ function that adds a light source. (Yes when setting uniforms caching is used)
static void AddLightSource(Vec2 Position, uint8_t R, uint8_t B, uint8_t G, uint16_t LightStrenght,uint16_t VisualStrenght) {
        std::string access = "LightSources[" + std::to_string(ActiveLightSources) + "]";
        int Value = (VisualStrenght << 16) | LightStrenght;
        int Color = (R << 16) | (G << 8) | B;
        Vec3 Translated = VertexArrayManager::TranslateValue;
        shader->setUniform2f(access + ".Position", glm::vec2(Position.x+Translated.x,Position.y + Translated.y));
        shader->setUniform1i(access + ".LightColor", Color);
        shader->setUniform1i(access + ".ArgumentValue", Value);
        ActiveLightSources++;
        shader->setUniform1i("LightSourceCount", ActiveLightSources);
}
```

sentences:
What is a good linear algebra book for game programmers? I was told that I should start learning Linear Algebra in order to create good games with good physics.

I'm reading Linear Algebra book and it's completely foreign to me. The author starts out with solving linear equations (two equations, two variables) and I remember learning about that in school, but almost immediately he jumps into other things that seem to be taken directly from the Necronomicon.

What book can I read to learn some good math, but starting from the fundamentals?

Thanks a lot for the help.

sentences:
Why have a publisher on Steam now, when you can self-publish and the Greenlighting process is the same? I can't find a definitive answer to whether putting up your game on Steam via a publisher helps somehow, other than bringing some popularity due to publisher's other games/apps. It seems that Greenlight procedure doesn't change or speed up if you have a publisher, or decide to publish yourself (at least according to Steam itself, officially, but who knows what goes on behind the scenes).

The general sentiment on the internet seems to be that you should "cut out the middleman" and save your money that would otherwise go elsewhere, for almost nothing.

People are comparing the Steam publisher to other game, music and video publishers (networks), saying they exist to help distribute your product by making physical copies (optical discs, usb drives, third-party stores), but this doesn't seem to apply to Steam, as there's nothing physical involved.

There's also a matter of advertisement, community management and posting news, updates, etc to create more visibility, which you can also manage on your own, if you wish.

So besides that, are there any important benefits to having a publisher on Steam?

sentences:
unable to map one object position to another object over network objective: I have a player which instantiate by network manager class. I want to map/sync its position/rotation to another object which is also instantiate by my player object.

(what it i have tried)
Below code is attached to my network player which instantiating another object (mimic object)

         void Start() {
                if (isLocalPlayer)
                {
                    CmdInstantiate();
    }

         [Command]
            void CmdInstantiate()
            {
                // This [Command] code is run on the server!
                mimic = (GameObject)Instantiate(
                     mimicObject);
                // spawn the bullet on the clients
                NetworkServer.Spawn(mimic);
            }

void Update()
    {
        if (!isLocalPlayer) {

            return;
        }
        CmdMimicObjectPosSync();//updating position on server
    }

   [Command]
    void CmdMimicObjectPosSync()
    {//position sync method
        mimic.transform.position = this.transform.position;
        mimic.transform.GetChild(0).position = this.transform.GetChild(0).position;
        mimic.transform.GetChild(1).position = this.transform.GetChild(1).position;
        mimic.transform.GetChild(2).position = this.transform.GetChild(2).position;
    }

it is working fine on the player side but another player who has joined the network unable to see it although mimic object has instantiated but its value remains same (no change). Mimic object has attached network identity and network transform.

sentences:
Java applet game design no keyboard focus THIS IS PROBABLY THE WRONG PLACE. POSTED ITHERE (STACKOVERFLOW)

I'm making an applet game and it is rendering, the game loop is running, the animations are updating, but the keyboard input is not working. Here's an SSCCE.

public class Game extends JApplet implements Runnable {

    public void init(){
        // Initialize the game when called by browser
        setFocusable(true);
        requestFocus();
        requestFocusInWindow();  // Always returning false
        GInput.install(this);    // Install the input manager for this class
        new Thread(this).start();
    }

    public void run(){
        startGameLoop();
    }

}

And Here's the GInput class.

public class GInput implements KeyListener {

    public static void install(Component c){
        new GInput(c);
    }

    public GInput(Component c){
        c.addKeyListener(this);
    }

    public void keyPressed(KeyEvent e){
        System.out.println("A key has been pressed");
    }

    ......

}

This is my GInput class. When run as an applet, it doesn't work and when I add the Game class to a frame, it works properly.

Thanks

sentences:
Unity Diablo style Multiplayer Good time of the day to everyone who is reading this topic.

I've been enjoying playing Diablo 3 and decided to try myself in game development (to lure my friends into Diablo 3 and to, ofcourse, practice in game development).

I'd like to split the question in to following sections:

Lobby System (using Unet)
Game Server
Scene Loading

So, lets start with the first part:
As far as i know, when user decided to play the multiplayer part of the game, he is either creating new game for others to join, or joining an existing game. This process can be observed on the "Joining/Creating Game" screen.

What i'm actually can't figure out, is that if the game created on the users machine (lets name it local) or the Blizzard server (this will be remote). If it is created on the local machine, how then it is protects itself from cheating. If it is created on the remote machine, does that mean that for every 5 (just any number) players, i will have to start new copy of the game server (probably on the different port)

Moving to the second question:
This requires to run a "headless" version of the game on the server. Is there a possibility to create many different rooms for many players by using only one server instance, or will it require to run separate instance for every 5 players. Also, if player is playing in single-player mode, he seems to be also connected to the game server. Looks like the game server is performing all of the necessary calculations and player only sends in the commands for server to process (e.g, move me from 1,0 to 1,1) and after receiving the response, client interpolates the movement received from the server.

And finally, the third question:
Server may have many different scenes, but many players may be situated across many different scenes. There could also be dungeons and other player oriented stuff. So the question is, is it possible to achieve this goal using default Unity functionality.

sentences:
SetIKHintPosition and SetIKHintPositionWeight seems to have no impact I have recently been exploring Unity's inverse kinematics, to further polish the interaction between our rigged avatars and props.

I have made a sample project, using PuppetMaster's basic humanoid for the model, rig, and idle animation, but without Final IK; meaning this is Unity's inverse kinematics.  Inside our OnAnimatorIK method, we set the right elbow's SetIKHintPosition and SetIKHintPositionWeight like we did with the hand IK:

animator.SetIKHintPosition(avatarIKHint, hintPosition);
animator.SetIKHintPositionWeight(avatarIKHint, hintBlendValue);

animator.SetIKPosition(sourceIKGoal, targetPosition);
animator.SetIKPositionWeight(sourceIKGoal, blendValue);

You can see the left and right hand correctly move to where we set it.  However, it seems like the right elbow is ignoring the hint position entirely.  You can see the white debug line connecting the elbow to the hint position in the picture above.

It seems like the elbow ONLY bends if it absolutely must for the hand to reach the target position, regardless of where the hint is set, and the weight value given.

I have fiddled with this on and off for days and still haven't found a solution.  Others have asked the same question here and on other sites, but no one has posted an answer.

sentences:
Algorithm to zoom a plotted function I'm making a game in android and I need plot a function, my algorithm is this:

    @Override
    protected void onDraw(Canvas canvas) {
        float e = 0.5f;
        //from -x axis to +x evaluate f(x)
        for (float x = -z(canvas.getWidth()); x < z(canvas.getWidth()); x+=e) {
                 float x1,y1;
                 x1 = x;
                 y1 = f(x);
                 canvas.drawPoint((canvas.getWidth()/2)+x1, (canvas.getHeight()/2)-y1, paintWhite);
        }
        super.onDraw(canvas);
    }

This is how it works. If my function is, for example f(x)=x^2, then z(x) is sqrt(x). I evaluate each point between -z(x) to z(x) and then I draw them. As you can see I use the half of the size of the screen to put the function in the middle of the screen. The problem isn't that the code isn't working, actually plots the function. But if the screen is of 320*480 then this function will be really tiny like in the image below. My question is: how can I change this algorithm to scale the function?. BTW what I'm really wanting to do is trace a route to later display an animated sprite, so actually scale this image doesnt gonna help me. I need change the algorithm in order to draw the same interval but in a larger space. Any tip helps, thanks!

Current working result

Desired result

UPDATE:
I will try explain more in detail what the problem is. Given this interval [-15...15] (-z(x) to z(x)) I need divide this points in a bigger interval [-320...320] (-x to x). For example, when you use some plotting software like this one. Although the div where is contain the function has 640 px of width, you dont see that the interval is from -320 to 320, you see that the interval is from -6 to 6. How can I achieve this?

sentences:
What does 'Discretizing Space' mean in the context of paper prototyping I was browsing some lecture slides by Eric Anderson for his Cornell course CS 4154 (Analytics-driven Game Design). In a series of slides he mentions discretizing space as a way of paper prototyping action games. As an example he illustrates  with a screen shot of Super Mario with a grid overlay (shown below). Unfortunately the slides do not expound on how this technique is used.

How is discretizing space used to prototype platform games or action games generally?

sentences:
Speed up loading of png files (used for textures) in Android OpenGL Game My game has a few texture atlases that need to be loaded (in my XHDPI folder they total 3.49MB) and on a top-end device they don't take that long to load, however on a low-end device they seem to take an age.

An example would be my old Samsung Galaxy Ace which uses the MDPI folder for it's resources (total: 1.51MB), this takes 16 seconds, which I personally consider far too long.

Originally, I had a separate atlas for each sprite, so I merged the majority of my atlases into one big atlas after reading that it may speed things up.

Unfortunately, it hasn't really made any difference to the load-speed.

This is how I'm loading my png files:

atlas = BitmapFactory.decodeResource(view.getResources(), R.drawable.atlasimage);

As the default load format is ARG_B8888, I though I'd attempt to load them in RGB565 as this is supposed to be quicker to load and render as well as take up less memory.

So I tried this:

BMFOptions = new BitmapFactory.Options();
BMFOptions.inDither=false;
BMFOptions.inPreferredConfig = Bitmap.Config.RGB_565;

atlas = BitmapFactory.decodeResource(view.getResources(), R.drawable.atlasimage, BMF Options);

Unfortunately, although this does reduce the quality of the image, it doesn't reduce the load time and yields no noticible performance increase.  Also, (and this may be expected), it doesn't reduce the memory footprint of my app.

So my question is how can I optimise this so that my png's are loaded quicker (rendering speed increase not being as important at the moment as load-speed).

sentences:
How much does joystick axis resolution matter? While developing, I started integrating joysticks into my framework, and had some questions since different OSs handle joysticks differently.  My framework may potentially be opened to the public at a later date, so I thought I'd ask these for consideration:

What's the minimum amount of resolution a framework should offer to developers?  While watching the values of the axes, I can get a reasonably smooth range from my joystick; however I can't think of too many use cases for the higher resolutions.

Are there any real benefits of having high resolution vs a lower one?  I was thinking about having just a 3-bit resolution for my games, (standing, creeping, walking, running, plus one bit for the opposite direction).

I can only see high resolutions being useful on driving or airplane simulator games, so are there reasons to use them in other types of games?  Personally, I still see having three, or even four bits for such games as enough.

Thanks.

sentences:
How to script sequential events in GameMaker? I am wondering if there is an elegant way to script sequential events in GameMaker 2.

In Godot 3.1, it is very easy to chain events together using yield() and signals. You just start doing something, yield until it emits a signal that it's done, and then continue your code. I am wondering if there is anything similar in GameMaker 2.

In Godot, for example, if i wanted to spawn an explosion cluster which consisted of 10 explosions, each starting 50 milliseconds after each other, I could do something like this.

func create_explosion_cluster(x, y):
    for x in range(10):
        create_explosion(x, y)
        timer = Timer.new()
        add_child(timer)
        timer.wait_time = 0.05
        timer.start()
        yield(timer, "timeout")
        timer.queue_free()

I used this method for complex boss behaviors as well. For example,

func boss_attack():
    animation_player.play("intro_to_attack")
    yield(animation_player, "animation_finished")
    animation_player.play("attack")
    for x in range(10):
        create_projectile(x, y, vector_to_player)
        timer = Timer.new()
        add_child(timer)
        timer.wait_time = 0.05
        timer.start()
        yield(timer, "timeout")
        timer.queue_free()
    animation_player.play("outro_to_attack")
    yield(animation_player, "animation_finished")`

In fact, I use this technique all over the place when I want certain events to follow other events (in transitions, cutscenes, enemy behaviors, etc.)

Is there a way to script sequential events in GameMaker with similar flexibility as you have in Godot?

If there is a general design pattern to solve this kind of problem without yield(), co-routines, and so on, I'd love to know it.

sentences:
How to make a z-depth buffer with pygame? I am making a 3d renderer with python and so far am sorting the triangles which I want to replace with a z-depth buffer. The thing is, I don't know how to make a z-depth buffer in pygame. I still want it to be playable however.
By the way, I am using pygame polygons.

sentences:
How can I make several 2D objects move in complex pre-defined patterns? I will be making my mobile 2D game in Unity and the objects in the game will have complicated movement. For example, there will be lots of squares (around 10-15 tiny squares) in the middle of the screen which will move in pre-defined patterns like in the shape of an X or an M or O. The tiny squares forming the pattern M will be constantly moving within that X symbol and will be constantly instantiated at one end and destroyed at the other to achieve the effect (or just allowed to move within a pattern if the patterns shape permits).

Unity tutorials explain the basics on how to work with the transform component, etc but I have been looking for a resource that tells you how to achieve the above. How can I implement it?

sentences:
Game engine like Unity 3D that allow me to use .NET code I've been looking at Unity 3D for developing a 3D PC game and I really like the scene editor and how it simplifies the process of constructing 3D scenes, managing assets, animations, transitions etc. However, I don't want to restrict myself to using the Unity 3D scripts for handling every bit of game logic in the game.

E.g. If I want to construct a RPG dialogue system I don't want to do it with unity 3d scripts - I'd like to use C#/.net. Also, I might want to use e.g. windows azure and sql azure as backend, and use 3rd party .net libraries such as reactive-extensions etc.

Is there a .net engine out there that helps me with asset loading, animations, physics, transitions, etc. with a scene editor, but allow me to plug it into a visual studio .net project?

Thanks

sentences:
Is it more efficient to render full size with AA, or scaled down with no AA? Which is more resource-efficient (given a typical modern 3D game scene):

Rendering it at 100% scale with anti-aliasing, or
Rendering it larger and scaling it down to fit the screen, but without AA?

The idea is that anti-aliasing is a really expensive operation and avoiding it makes things faster. Is this the case?

I haven't had the opportunity to try it, since I work almost exclusively with 2D games.

sentences:
Designing RPG player classes, and the trend to avoid a Priest or Cleric RPG class From my experience, RPG classes ("hero" or "villain" types) are often divided into four categories:
 1. Mage
 2. Priest
 3. Rogue
 4. Warrior

However, there are quite a few popular RPGs that ignore the Priest or Cleric "base" character class entirely.  Two game series of note: The Elder Scrolls (Skyrim), and Dragon Age.

Is there a specific reason why this is so?  Perhaps the background story makes allowing players to be a Cleric difficult; for example, if there is a large amount of NPCs in the game that have the adventure class of Cleric, and making that class available to players would be detrimental to the story of the game.

I've pondered this quandary myself when working on developing my own video RPG; should the character class options be sub-categorized with the aforementioned base classes?  Or perhaps even more difficult of a question to answer, should a video RPG include some kind of Deity system?

The RPG approach to "gods" is difficult for me, particularly because I've have somewhat of a spiritual perspective on real life, I'm not sure how to reconcile my choices with game design to my choices regarding spirituality.

Any helpful responses will be greatly appreciated!

sentences:
How to implement a stack of game states in C++ I'm new to C++ and as a college proyect I'm building a 2D platformer with some classmates, I recently read that it's a good idea to have a stack of gamestates instead of a single global variable with the game state (which is what I have now) but I'm not sure how to do it.

Currently this is my implementation:

class GameState
{
    public:
        virtual ~GameState(){};
        virtual void handle_events() = 0;
        virtual void logic() = 0;
        virtual void render() = 0;
};

class Menu : public GameState
{
    public:
        Menu();
        ~Menu();
        void handle_events();
        void logic();
        void render();
};

Then I have a global variable of type GameState:

GameState *currentState = NULL;

And in my Main I define the currentState and call it's methods:

int main(){
    currentState = new Menu();
    currentState.handle_events();
}

How can I implement a stack or something similar to go from that to something like this:

int main(){
    statesStack.push(new Menu());
    statesStack.getTop().handle_events();
}

sentences: English dictionary for word games There are lots of popular games now-days that enable a player to construct a word while opposing some limitations. If player constructs a valid word successfully, he gets a point. For this a big amount of English words is needed so that the game would be able to check if such a word exists in English. Where can I take such a bank of words? And how big the size will be? Would it we good for mobile games?

sentences: Standard key bindings for movement along three axes? I understand that the WASD keys are standard for moving a character along two axes (left/right, up/down) because in the QWERTY layout, they are arranged like the arrow keys. I want to make a game where the character can move along three axes, i.e. also front/back. Are there standard key bindings for this as well?

sentences:
Input handling in component based design I know this question has been asked several times, but I'm still not sure how to implement input handling in a component based engine.

The component based design I used was based on T=Machine's blog series and on Artemis in which Entities are just ids.

There are three main ideas I have in implementing input handling:

The input component will hold events it's interested. The input system will translate key and mouse events to game events and loop through the entities with the input component and if they are interested in the event an appropriate action will be taken by the input system. This action would be hard coded to the input system.
No input component. You would register entities with specific events to the input system. The input system would then send messages (with the entity id and event type) to other systems so that these can take the appropriate action. Or as in the first case, the actions would be hard-coded to the input system.
Similar to the first method, but instead of hard coding the action to the input system, the component would contain a map of events to functions (i.e. std::map<std::function>) which would be called by the input system. This has the added effect of being able to couple the same event to different actions.

Would you recommend any of the above methods or do you have any suggestions that would help me implement a flexible input handling system? Also, I'm not yet familiar with multi-threading but any suggestions that would make the implementation thread-friendly are also welcome.

Note: One added requirement I'd like the implementation to fulfill is that
I'd be able to pass the same input to many entities, like for example moving a camera entity and the player at the same time.

sentences:
The difference between shading and data interpolation Using methods like Phong you can make mesh look smooth and real. However you can do the same interpolation at the data level creating a surface (for example B-Spline surface).

What is the difference and when would you use shading over data interpolation?

sentences:
How to manage ammo when firing and reloading I have this script and I need to fix one thing which is count correctly the number of bullets I have.

public GameObject ebullet;
public Transform Bullet_position, target;

public int ammo = 200;
public int ammo_Hold = 600;
public bool reload = false;
public bool readyToShoot;

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

    if (ammo == 0)
    {
        ammo_Hold = ammo_Hold - 200;
        ammo = 200;
    }

    if (reload == true && ammo_Hold >=0)
    {
        ammo_Hold = ammo_Hold - ammo;
        reload = false;
    }

    if (readyToShoot == true)
    {

        Quaternion rotation = Quaternion.LookRotation(target.position - transform.position);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * 5.0f);

        GameObject bullets = Instantiate(ebullet) as GameObject;
        bullets.transform.position = Bullet_position.transform.position * 1;
        Rigidbody rb = bullets.GetComponent<Rigidbody>();
        rb.velocity = transform.forward * 100;
        Destroy(bullets, 2f);
        ammo--;

    }
    else
    {
        print("Don't Shoot");
    }

} // end update

sentences:
Are there any serious advantages for C++ compared to C? so I know a little bit about C (read like a few university level textbooks on it, I am not an experienced programmer or anything) and now I would like to learn the ropes of the Unreal engine to fidle with it an make my first 3D game :P (I know it's a huge step easier said than done but I just want to go with it)
My question is about how wise would it be to stuck with what I already know and built upon it?
Will I hit soon some nasty walls while trying to make things work using C should I instead use C++ or will I be fine? In other words does C++ will make my life easier or can do things I wouldn't be able to do with C or that I needed serious puzzlesovling skills and much bigger hardware level knowledge in order to overcome them while using C?
Long story short should I invest more time expanding what I know in C or should I start learning C++ instead which would save me time and bring me the most comfort?

sentences:
Efficient Bullet Firing Class I've been struggling with this for a while. I have been trying to create a bullet pool class for a game I have made that doesn't cause a significant fps drop.

I have tried creating a bullet pool and have also tried dynamically creating and deleting bullets, both of which drop the fps of the game around 10-15.

I ran a test a few days ago and just put a return statement in the bullet pool's firebullet function, which represented the logic leading up to this, function calling, etc.

This only dropped the fps 2-4. If I can fire bullets without dropping the fps more than another 2-3, I would be satisfied. My bullets are autorelease objects that are a subclass of a ccnode.

I create a ccsprite and a box2d b2body for each one. I am working on the ios platform. Any thoughts on how to make this more efficient? Has anyone managed to do something similar to this?

sentences:
What is wrong with my Item collection/Itemcounter Script So I am making a script for item collection and a counter for it. I have a script made but for some odd reason I can't seem to the get the GUI part right. The compiler error says something like "This isn't a member of UnityEngineGUI" IDK what I am doing wrong. Could someone help out?

#pragma strict
var Collectable : GameObject;
var Counter : int;
var CounterGUI : GUI;

function OnTriggerEnter (other : Collider){
    if (other.gameObject.tag == "Player"){
        Collectable.SetActive(false);
        Counter += 1;
        CounterGUI.GUI = Counter.ToString();
    }
}

sentences:
3 Button Multi-touch for Android OK, my multi-touch system was somewhat convoluted, but was working perfectly OK until I tried to run my game on my Nexus 10 which is running Jellybean.

Crashing all over the place!  So I removed my whole multi-touch routine and am trying to start from scratch and to simplify it.

Basically, I have 3 buttons, left, right and jump.  Left is left of screen, right is right of screen and jump is in the middle.

What I need is when the player presses left and that button held down and then they press right, for the latter touch to override, so the right touch registers and the character moves from left to right.  If he then releases one of the buttons the character moves in the direction of the button which remains pressed.  Again, same with jump.

I can get my character moving left and right with single-touch but all day I've been trying to understand multi-touch and just can't get it.

I don't understand the whole pointer ID's and pointer Indexes and would be really grateful if someone could just explain and give an example of some code which would accomplish what I require.  Just 2 buttons would do and I could go from there.

Many thanks!

edit

Here is some really basic code and the results I get from it:

public boolean onTouchEvent(MotionEvent event) {

int action = event.getAction() & MotionEvent.ACTION_MASK;
int pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT;
int pointerId = event.getPointerId(pointerIndex);

        Log.v("multitouch","pointer ID "+pointerId);
            Log.v("multitouch","pointer Index "+pointerIndex);

    return true;

}

when I press the first finger down, ID and Index are both 0
when I press the second finger down, ID and Index are both 0
if second finger is released and the first one remains, the ID and Index are both 0
However, if the first finger is release and the second one remains then the Index is 0 but the ID is 1

I don't understand how this works and how I can use it to determine which fingers are on the screen at which time and would really be grateful if someone could throw some light on it for me - thanks!!

sentences:
Where is the "Scripts Window" menu in Blender 2.59? I'm trying to import a script into Blender, and I have the script in my directory and I pushed F8 to reload scripts, but the instructions for running this script say:

  In the "Scripts Window" run "Scripts → Export → OGRE Meshes".

I've seen other similar instructions for other scripts. But the toolbar only contains "File/Add/Render/Help." Changing the "screen layout" to Scripting doesn't reveal any additional options, either.

I'm sure I'm just missing something obvious. Please help!

sentences:
GUI Library for MonoGame Is there any GuiLibrary available, which works with MonoGame? I know there are some GUI Libraries for XNA but I assume most will not work with MonoGame.

Even simple stuff like Buttons and Inputfields would help me...

Thanks.

sentences:
How do I update this code to hit a moving target from a moving shooter? I am working on a game where one spaceship("Origin") can shoot a dumb projectile("Projectile") at another spaceship("Target").
Since the target is moving we will have to lead the target.
The projectile will move at a given speed (to be clear I differentiate between "velocity" which i use when talking about a vector and "speed" when i am talking about the length of said vector).
I am trying to calculate the point where I will have to aim in order to hit the target (assuming it does not change its velocity).
I tried this example.
UPDATED THE CODE
This is part of the "projectile" class that a wrote.
self.targetVessel is the target
self.originVessel is the shooter
this function is called one in the constructor so that self.originVessel.velocity is the starting velocity
self.totalSpeed is the "kick" that the projectile gets from the shooter
    def takeAim (self):
    t = 0

    #self.totalSpeed += math.sqrt(np.dot(self.originVessel.velocity, self.originVessel.velocity))

    posRel = self.pos - self.targetVessel.pos
    velRel = self.originVessel.velocity - self.targetVessel.velocity
    #velRel =  - self.targetVessel.velocity #this hits the target but the speeds don't add up

    a = (np.dot(velRel, velRel))-(self.totalSpeed**2)
    b = 2.0 * (np.dot(velRel,posRel))
    c = np.dot(posRel, posRel)

    disc = (b*b) - (4.0*a*c)

    print("Disc: ", disc)

    if disc < 0:
        print("Target is too fast - no point shooting!")
    else:
        t0 = (-b - math.sqrt(disc)) / (2.0*a)
        t1 = (-b + math.sqrt(disc)) / (2.0*a)

        print("t0: ", t0)
        print("t1: ", t1)

        if t0 < 0:
            t = t1
            print ("Choosing t1")
        elif t1 < 0:
            t = t0
            print ("Choosing t0")
        else:
            if t0 < t1:
                t = t0
                print("Choosing t0")
            else:
                t = t1
                print("Choosing t1")

    shoot = velRel + (posRel / t)
    self.velocity =  shoot + self.targetVessel.velocity
    self.aimPoint = self.targetVessel.pos + self.targetVessel.velocity*t
    targetDirection = self.aimPoint-self.pos
    targetDirection = targetDirection / math.sqrt(np.dot(targetDirection,targetDirection))
    self.velocity = (targetDirection * self.totalSpeed)

sentences: Unity using 40% GPU for just a UI interface on ultra but 90 on low? So I made some software using unity for my FRC team. All this application is, is just a User Interface with labels, input fields, buttons, etc... When I choose the quality to be on Ultra, I will get about 50% GPU usage but when on very low, I got 90%, close to 100%. How can I optimize my software to use much less of the GPU(Preferably less than 15%)? I am measuring with the Task Manager Performance Menu

sentences:
OpenGLES 2.0 batching method and do not draw inactive object I am researching about "batching" objects for one big VBO and reduce draw call.

These are what I am doing now:

Create interleaved VBO based on texture or render state (like Blending)

So, for example, there will be two separate VBO and draw call if I want only some object has blending

For more batching, add unused vertex data.

eg) Object "A" doesn't need to have color data, but I added white empty color, so can be batched in interleaved array

For hiding object, set vertex positions to 0.0. So, stay on the array, but cannot see.

eg) if it is quad, set to [0.0, 0.0, 0.0, 0.0]

These are my questions:

Should I create one Giant VBO, and use draw call based on offset??

If I do that, then is there any limitation on glbufferData?? (or performance drop, if too much data in)
Is there any method that vbo can contain different types of interleaved vertex?
Is multiple "offset" draw call not affect performance unlike single draw call?

Should I bind multiple texture atlas to each unit, and use uniform?

Currently, I am only binding one texture per draw.

Is there correct way for above #3 method?? (Feels like not correct)
I am updating "All" vertices every frame, even though some object doesn't need to be updated. (glBufferData) Should I do multiple update call??

Sorry for my wording, but please point me anything that I am doing something wrong.

Thank you.

sentences:
Inventory implementation in Java RPG In my game (simple RPG with Java) there will be an abstract class Creature.

Critter, Beast, Vampire... will inherit from Creature. But not ALL classes that inherit from Creature will have an inventory.

Should I

a) make another abstract class such as CreatureWithInventory and inherit from it?

or

b) make an interface such as Inventory and make stuff as (Vampire implements Inventory)?

Is there a reason to prefer one over the other? Any considerable trade-offs?

Should Inventory itself be a class and let some Creatures have a field for it? If so, how would I test if Creature foo has Inventory? Is that even possible?

sentences:
What is the right approach for using foot ik for characters in slopes(Specially when in walk or run)? i use unity but this question applies for any third person controller or enemy controller.
i need to use foot ik on slopes(any condition and any kind of slope) to place foot on right places. as i considered some important third person games, it seems they only use ik when character is idle and not moving otherwise no ik is applying and leg animations run purely.
i use the same approach and result looks good enough but im looking for applying when character is walking or running.
as i looked, some people disable ik when leg is going up and enable it when its coming down. some other do a raycast from foot bone to the ground to check foot need ik on little distance to ground. but all of these are prototypes and has flaws. can you give me a good approach that works best in all conditions?

sentences:
Add Boo or Python to Unity 5 I'm new to Unity, but I'm more comfortable with Python.

Is there any way to use Python as scripting language in Unity 5?

I heard there is some language called Boo that has a syntax like Python but it seems Unity just supports C# and Javascript.

How can I add Boo or Python scripting to Unity 5?

sentences:
Hexagonal tilemap is being distorted So I made a hexagonal tilemap of ocean tiles and then picked a few tiles to be land. When I pick all adjacent tiles to the hexagon it usually works, but for tiles that are on certain columns it does not. Also, on these columns the tops and bottoms of tiles are missing.

It's hard to explain but here's a screenshot that should clear it up:

As you can see, on every other column the top and bottom of hexagons are missing, when all adjacent tiles are filled in to the centre tile it works fine for those columns without a bottom and top on hex, but when it's on the other column one of the adjacent tiles is displaced.

Any suggestions?

Code:

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y - 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y + 1, landCell);

sentences:
Networking a fast-paced game (2D) - Forced Movement - Server / Client I started a new project, a fast-paced online game (some sort of 2D MOBA). I encountered a problem with the part of netcode about client prediction & server reconciliation.
Game Mechanics: 2D - Platformer (MOBA)
Movement: WASD (jump / left / down / right)
Abilites & Autoattack: J/K/L
Architecture: Client/server (authoritative)
My netcode is using these techniques:

Client-side prediction & server reconciliation

Server is sending position & data to the player, the player is replaying the last unprocessed inputs
Client is sending input each frame at a fixed timestep (60 times/sec) which are processed on the server-side

Other entities are interpolated
Bullets/abilities are extrapolated (Dead reckoning)

So far, this is working good on clients. My question is, how to handle some sort of forced movement?
For example, another player stuns or slows down you, on the server, you will be slowed down or stunned, but you will not know it before the packet arrives, since you are predicting the next state, it will teleport you back because your speed was changed to 0 or lower (in case of slow), it will immediately turn you back (teleport).
What is a good way to handle this technique? I was thinking about interpolating between the current position and the position on the server, but it is not working well for me.

sentences:
Android Game - Screen Flickers When an Entity Removed From The List I am using Canvas in my android game. When I remove a no longer displayed entity in my entity list, all other entities are flickering for a brief time. When it's not removed, there is no such problem. But since I am not a big fan of memory leaks, that's not an option.
The canvas rendering system is already double-buffered by design and I have utterly no idea how to fix such a problem.
I have thought maybe it is because the list is sorting itself after the item removal and tried changing it to a Set, but that didn't work either.
Does anyone have any idea why this might be happening and how to fix it?
Structure of the code:
private val gameObjects: List<GameObject> = mutableListOf()

    fun update(deltaTime: Long)
    {
        gameObjects.forEach {
            it.update(deltaTime)
    }

 fun render(canvas: Canvas)
    {
      gameObjects.forEach {
         when (getVisibilityStatus(it.virtualY))
         {
            VisibilityStatus.VISIBLE -> it.render(canvas, virtualToPhysicalY(it.virtualY))

            VisibilityStatus.BELOW_SCREEN ->
            {
              if (virtualToPhysicalY(it.virtualY) > screenSizePairXY.second)
                gameObjects.remove(it)

            }
         }
    }

sentences:
What kind of data structure should I use for a resource container? I am curious what kind of container would be the best choice for a resource container.
BTree, binary search tree or something else?
What like is the priority of the operations over it?
So best inserting performance or best searching performance or between them?

Are there any open source implementation over the net?

sentences:
Collisions between players in multiplayer racing game I'm creating a simple racing game (spaceships, no gravity) using p2.js, phaser and node.js.

What I have done:
Client receives world state from server:

extrapolate other players based on latest velocity/position from server
check if client-side prediction was correct - if no apply position from server and process inputs that server was not aware of.
fixed physics step

Server:

receives inputs from clients and apply
fixed physics step
sends world state to each client

Now I'm struggling with collisions between players.
Colliding player is jumping all time during collision. I think it's because client-side prediction is not calculating similar results to the server.

Server doesn't know all inputs from player (lag).

Player doesn't have the same position of colliding player as the server (lag).

Combining this two makes the client to resolve collision different than the server and when world state arrives player has to make a big correction.

sentences:
Latency benchmarks for WebSocket games? I'm trying to find some actual latency benchmarks for using WebSockets in HTML5 games. If I were to go down this route, I'd probably end up using (as you might expect) Node.js and Socket.IO.

However, most search results I find tend to discuss what is possible or how it would be done. I'm more concerned about what kind of performance you can get out of this platform.

These are the only demos that I've found that include a latency meter for the user:

http://rawkets.com/

http://o.smus.com/client/

Most of the time it stays around 100-200ms.. Not sure how reasonable that number is for other games out there, although I have come across people using long-polling on top of Node.js, which gets you some pretty bad lag..

sentences:
What is the standard way to synchronize sound effects with sprite animations? Let's take a situation where you have an RPG with spells and each spell animations have a different number of frames and they have very different requirements for sound effects. Let's assume that each spell has only 1 continuous animation associated with it (as opposed to multiple modular pieces that are used to form a full animation) ala the old 16 Bit Final Fantasy games.

The only way I can think of in order to make sure that the sounds and animations sync up is to:

Get the number of frames of an animation.
Get the time between each frame of the animation. (if it's 30 fps then it's 1/30th of a second per frame.)
Then create a sound file that is exactly the same length as the animation.

So this means that if an animation is 5 seconds long, running at 30 fps, with a total of 150 frames, the sound file will also be 5 seconds long. If the animation should have an "impact" sound on the 30th frame, that means the sound file will include the sound of impact at the 1.0 second mark.

At the end, we start the animation and the sound effect at exactly the same time and hope that the frames and the sound sync up.

This sounds like it could pose problems when frames are skipped or something happens during the animation and the sound gets played slightly too soon or too late, and will cause the sound and the animation to go out of synch. Is this the best approach or are there usually a better way that I'm just not seeing?

The answer doesn't necessarily need to be for Cocos2D specifically if it's conceptual, but if there's a specific solution for cocos2d, I'd love to hear it.

EDIT: I just also realize that with this method, if we happen to go in and adjust the number of frames or timing of the animation later, we MUST also go back and change the sound file. This sounds like a terrible cause for human error (forgetting to update sound files after animation change.) I hope there are better methods out there.

sentences:
OpenGL color overlay I want to create a pause menu where everything in the background gets darker. I've looked up a bunch of possible solutions (even the second page on google) but it doesn't seem to work. I do already have something in my code that makes a single texture darker when hovered over, by calling: GL11.glColor3f(alpha, alpha, alpha); before drawing vertices. What I want to achieve is everything getting darker, so when hovering over a texture it should be even darker than before so it is still darker than the rest in the background when that has been made darker because of a pause menu that pops up.

Another thing I noticed is that glColorMask(true, false, false, true); does not get overridden and blends colours everywhere, so I was wondering if there is a version of this method that puts a transparent black overlay so everything becomes darker. I have enabled blending.

-Edit-

One solution I came up with (not just now) is multiplying alpha in every glColor3f function with a variable that is smaller than 1 so everthing gets relatively smaller, but I worry about this being uneffective and badly mantainable

sentences:
Separating physics and game logic from UI code I'm working on a simple block-based puzzle game.

The game play consists pretty much of moving blocks around in the game area, so it's a trivial physics simulation. My implementation, however, is in my opinion far from ideal and I'm wondering if you can give me any pointers on how to do it better.

I've split the code up into two areas: Game logic and UI, as I did with a lot of puzzle games:

The game logic is responsible for the general rules of the game (e.g. the formal rule system in chess)
The UI displays the game area and pieces (e.g. chess board and pieces) and is responsible for animations (e.g. animated movement of chess pieces)

The game logic represents the game state as a logical grid, where each unit is one cell's width/height on the grid. So for a grid of width 6, you can move a block of width 2 four times until it collides with the boundary.

The UI takes this grid, and draws it by converting logical sizes into pixel sizes (that is, multiplies it by a constant). However, since the game has hardly any game logic, my game logic layer [1] doesn't have much to do except collision detection. Here's how it works:

Player starts to drag a piece
UI asks game logic for the legal movement area of that piece and lets the player drag it within that area
Player lets go of a piece
UI snaps the piece to the grid (so that it is at a valid logical position)
UI tells game logic the new logical position (via mutator methods, which I'd rather avoid)

I'm not quite happy with that:

I'm writing unit tests for my game logic layer, but not the UI, and it turned out all the tricky code is in the UI: Stopping the piece from colliding with others or the boundary and snapping it to the grid.
I don't like the fact that the UI tells the game logic about the new state, I would rather have it call a movePieceLeft() method or something like that, as in my other games, but I didn't get far with that approach, because the game logic knows nothing about the dragging and snapping that's possible in the UI.

I think the best thing to do would be to get rid of my game logic layer and implement a physics layer instead. I've got a few questions regarding that:

Is such a physics layer common, or is it more typical to have the game logic layer do this?
Would the snapping to grid and piece dragging code belong to the UI or the physics layer?
Would such a physics layer typically work with pixel sizes or with some kind of logical unit, like my game logic layer?
I've seen event-based collision detection in a game's code base once, that is, the player would just drag the piece, the UI would render that obediently and notify the physics system, and the physics system would call a onCollision() method on the piece once a collision is detected. What is more common? This approach or asking for the legal movement area first?

[1] layer is probably not the right word for what I mean, but subsystem sounds overblown and class is misguiding, because each layer can consist of several classes.

sentences:
What does it mean to develop a VR game from the ground up? Some virtual reality games are advertised as being created from the ground up for virtual reality. What does this mean exactly?
What are some of the differences between developing a 3d pc game and a vr game?

sentences:
Numerical differentiation to calculate size of circular buffer I'm using Allegro 5 to create a software-generated "motion blur" effect for my 2D sprites. I basically just have a boost::circular_buffer of some length which holds "snapshots" of the sprite going back in time. Each render cycle a new "snapshot" of the main sprite is pushed onto the front of the buffer, and the last is popped off the back. The "snapshots" are then rendered with alpha values scaled by how old/far back in the buffer they are.

To save on CPU power I'd like to have the circular buffer dynamically resized so that the length of the trail is proportional to the object's velocity, i.e. don't store and push back lots of snapshots for trail sprites that won't be needed anyway because the object is moving too slowly.

The inputs I have to the data structure that holds the main sprite and its associated effect buffer are just the dx and dy values of how much its position vector changed since the last update cycle of the game logic. So I'm looking for a suggestion for an algorithm that can use that to increment/decrement some kind of unsigned counter that can be used to resize the buffer proportional to velocity.

sentences:
2D/3D Soft body physics in Unity I want to implement soft bodies in my game similar to this link.
I tried using this Soft body simulation plugin but it has the following problems:

Only works with box colliders.
Doesn’t work with Unity’s physics engine i.e. the bodies don’t react to the forces applied.

For my game,

The soft bodies should be able to collide and interact with any types of colliders (including mesh collider).
The bodies should work with Unity’s physics engine i.e. the bodies should react to the forces and gravity applied.

I am flexible in implementing soft bodies in 2D or 3D.
I would appreciate any suggestions and thoughts on this topic.

sentences:
Pausing game with State machine and handling jumps I am adding pause functionality to my upcoming racing game.The players can jump in it.

Time.timeScale = 0 is obvious solution to pause game.I am avoiding this solution as users can do in app purchases in pause menu and with timeScale to 0 its somehow preventing them.

So to overcome that problem I have added state machine pattern to start,pause,resume,finish game.

The thing is when I pause game with my state machine pause behaviour it pauses the game properly without any hesitation until the player is Jumping and pause occurs.

When player is jumping everything gets pause perfectly,just player falls to ground.

So to overcome that problem what I tried was if user pauses game and player is on air the isKinematic on player gets set to to true and game gets pause with player halt on air.

The problem with this approach was that when user resume the game ,unexpected jump movement happens, i.e., player does not land on expected position .

Example if player on y = 10 and game gets pause, with Time.timeScale player will always land on Z = 17 ,but with my this second approach player sometimes land on Z = 20 ,Z = 21 Z = 19 etc

so my question is how will I do properly pause game with state machine without causing unexpected jump movement.

sentences:
GetComponentsInChildren() raises error I have a gameobject to which a script is attached.

In this script I have the following code:

    foreach (GameObject g in this.GetComponentsInChildren<GameObject>())
    {
        BagItem nBagItemScript = g.GetComponent<BagItem>();
        if (nBagItemScript != null)
        {
            Bounds nBounds = Helpers.BoundsFromGO(g);

            Vector3 nPos = new Vector3((nBounds.size.x / 2) - nBounds.center.x, mapHeight - (nBounds.size.y / 2) - nBounds.center.y, -0.01f);
            g.transform.localPosition = nPos;

        }
    }

I thought this code was fail-safe, but Unity outputs the following error message:

ArgumentException: GetComponent requires that the requested component 'GameObject' derives from MonoBehaviour or Component or is an interface.
UnityEngine.GameObject.GetComponentsInChildren[GameObject] (Boolean includeInactive) (at C:/buildslave/unity/build/Runtime/Export/GameObject.bindings.cs:133)
UnityEngine.Component.GetComponentsInChildren[GameObject] (Boolean includeInactive) (at C:/buildslave/unity/build/Runtime/Export/Component.bindings.cs:88)
UnityEngine.Component.GetComponentsInChildren[GameObject] () (at C:/buildslave/unity/build/Runtime/Export/Component.bindings.cs:98)
Bag.pUpdatePositions () (at Assets/Bag.cs:173)
Bag.Update () (at Assets/Bag.cs:107)

Can somebody tell me which error Unity / C# is choking on here?

Is the error really in this line

foreach (GameObject g in this.GetComponentsInChildren<GameObject>())

... or perhaps somewhere else?

Thank you very much!

sentences:
Using multiple sprite sheets for same object AndEnginge I have multiple sprite sheets for my object(Parrot) like eating, moving left to right, right to left and much more. I am using AndEngine gles2.0. How should I implement it? Every time I have to use different sprite sheet, detach previous one and on same location add new one. This is going to be hectic!

Anyone here who already implemented this kind of scenario? If I use single sprite sheet for every animation it size will increase and it will throw a exception of out of memory!

sentences:
Box2DLights in libGDX - Bad quality of the light gradient on Android I am facing a problem while porting one of my libGDX project from desktop to Android : My game uses Box2DLights. While the light effect look very fancy on the desktop version of the game, it looks really ugly on the Android version. The light gradient is not smooth at all. Take a look at the comparative screenshot below :

To use Box2DLights in my game, I use this code in my GameScreen :

 rayHandler = new RayHandler(world);
 rayHandler.resizeFBO(Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/5);
 rayHandler.setBlur(true);
 RayHandler.useDiffuseLight(true);
 rayHandler.setAmbientLight(new Color(0.15f, 0.15f, 0.15f, 0.1f));

Of course, I tried to play with different parameters, such as :

RayHandler.useDiffuseLight(fasle);

Or

rayHandler.diffuseBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);

Or

rayHandler.shadowBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);

Everything I tried so fare gave the same ugly light gradient. I already played games that uses Box2DLights that rendered very well on my tablet, thus, I don't think it's due to a limitation of Android.

Does anybody know what's the trick to overcome this problem ?

Thanks !

sentences:
Libgdx - Transparent color over texture I am attempting to tint a texture a color but I want the texture to show under the tint. For example, I have a picture of a person but I want to tint them a light green and not change the transparency of the actual person itself.

So far I have attempted to use the SpriteBatch method setColor which takes rgba values. When I set the alpha value to .5 it will render the tinting and the texture with that alpha value. Is there any way to separate the alpha values of the tint and the texture?

I know I could draw another texture on top of it but I don't want to have two draw passes for the one texture because it will be inefficient. If there's anyway to do it in raw OpenGL that'd be great too.

sentences:
Controlling a balance wheel using a Unity script I am working on a small demonstration project with Unity like this (screenshot from footage below).

I don't want to use Unity physics, which is too heavy. I plan to create a rotation function with ratio params for gears.  But I am not sure how to control the balance wheel rotation like that video, I tried animation tools which is hard to make the acceleration like real physics.

sentences:
What problem does double or triple buffering solve in modern games? I want to check if my understanding of the causes for using double (or triple) buffering is correct:

A monitor with 60Hz refresh's the monitor-display 60 times per second.
If the monitor refresh the monitor-display, he updates pixel for pixel and line for line.
The monitor requests the color values for the pixels from the video memory.

If I run now a game, then this game is constantly manipulating this video memory.

If this game don't use a buffer strategy (double buffering etc.) then the following problem can happen:

The monitor is now refreshing his monitor-display. At this moment the monitor had refreshed the first half monitor-display already. At the same time, the game had manipulated the video memory with new data. Now the monitor accesses for the second half monitor-display this new manipulated data from the video memory. The problems can be tearing or flickering.

Is my understanding of cases of using buffer strategy correct? Are there other reasons?

sentences: Should I create .fla files in Flash Professional and import them into Flash Builder? With Flash Builder and Flash Professional at my disposal for creating games, I'm having a hard time figuring out if I should be creating the .fla files in Flash Professional and then importing them into Flash Builder, or something else? Does it matter?

sentences:
Physics system imploding under force I have a basic physics body system (incomplete/very basic; as collision resolution and detection are not implemented, just mass, position, velocity, acceleration, force and impulse).

I implemented position, velocity, acceleration, force and impulse as described in Game Coding Complete 3rd. Ed. by Mike "Mr. Mike" McShaffrty et al. specifically Chapter 15: Collision and Simple Physics by Jeff Lake which is: (paraphrasing from text and code, US copyright law and all that.)

  Gravity is a Force.

  Application of a Force vector adds it to a std::list of forces.

  Application of an Impulse vector adds it to a std::list of impulses.

  Upon calling Update on the physics body:

  Add all forces and all impulses together (F).
  Clear the impulses list.
  Set acceleration to (F / mass)
  Set velocity to (velocity + (acceleration * deltaTime))
  Set position to (position + (velocity * deltaTime))

(See code below)

The problem I'm having is when gravity is applied as a force the list grows linearly...forever. Eventually it overcomes any attempt to directly set the position of an object to the point that A) The object is always affected by gravity no matter if or how fast the position is changed (clamping to the screen is a good example) B) The list grows so large that the system implodes and chugs. C) If, before the system implodes, the object is stopped at a specific position, the acceleration due to gravity continually increases making it ever harder to change the acceleration/velocity/position of the object (specifically applying an impulse or force upwards).

If I change the noted line in GravityHandler to elem->ApplyImpulse(deltaG); it works satisfactorily but is this correct or am I missing something?

My implementation according to his example:

RigidBody and its state:

void State::ApplyImpulse(const Vector2D& impulse) {
    _impulse.push_back(impulse);
}

void State::ApplyForce(const Vector2D& force) {
    _forces.push_back(force);
}

//RigidBody is a `friend` of State.
void RigidBody::ApplyForce(const Vector2D& force) {
    _curState.ApplyForce(force);
}
void RigidBody::ApplyImpulse(const Vector2D& impulse) {
    _curState.ApplyImpulse(impulse);
}

GravityHandler:

void GravityHandler::Update(double deltaTime) {

    class UpdateObject {
    public:
        UpdateObject(double deltaTime) : _deltaTime(deltaTime) { };
        void operator() (RigidBody* elem) {
            double mass = elem->GetMass();
            if(Math::IsEqual(mass, 0.0)) return;

            double gxm = elem->GetXGravityModifier();
            double gym = elem->GetYGravityModifier();

            Vector2D deltaG(_GRAVITY_VALUE.GetX() * gxm * mass * _deltaTime, _GRAVITY_VALUE.GetY() * gym * mass * _deltaTime);
            elem->ApplyForce(deltaG); //The problem seems to be here.
        };
    private:
        double _deltaTime;
    };

    _accumulator += deltaTime;
    if(_accumulator < (1.0 / 60.0)) return;
    _accumulator -= deltaTime;
    if(!_isActive) return;
    std::for_each(_subscribers->begin(), _subscribers->end(), UpdateObject(deltaTime));
}

RigidBody:

void RigidBody::Update(double deltaTime) {

    double mass = GetMass();
    //If static body, do nothing.
    if(Math::IsEqual(mass, 0.0)) return;

    Vector2D F;
    F += std::accumulate(_curState._forces.begin(), _curState._forces.end(), Vector2D());
    F += std::accumulate(_curState._impulses.begin(), _curState._impulses.end(), Vector2D());
    _curState._impulses.clear();
    SetAcceleration(F / mass);
    SetVelocity(GetVelocity() + GetAcceleration() * deltaTime);
    SetPosition(GetPosition() + GetVelocity() * deltaTime);

}

sentences:
Validating building "completion/enclosure" in infinite 2D tile map I have a 2D infinite tile map game in which the player can place floors and walls to construct "buildings".

I'm trying to think of an efficient way to determine whether the player is inside a "complete" building, meaning it's fully enclosed by walls and a door.

Normally, the logic isn't difficult since it's easy to tell if the walls fully encircle an area - but in the case of an infinite map, the "building" may extend into unloaded areas of the game.

For example, if a player makes a complete rectangular building, 10x100 tiles long, only some of the chunks it covers will be loaded at once.

I have a few ideas:

If a player is near candidate walls, follow them and load all necessary chunks to check completeness. This would work, but could load a moderate number of unused chunks.
Cache a list of "complete" buildings as they're completed. So option #1 is applied only as the player builds the building. This would have to saved/loaded, and updated when integral walls/doors are removed, so it trades efficiency for a little overhead, which might be OK.
Using a different metric to determine "indoors". I can't think of one though.

Anyone have any other ideas? Has this ever been implemented somewhere else, something I can at least use as an example?

sentences:
SceneManager.GetActiveScene(); return -1 when Debugging active scene in editor I'm trying to use the new SceneManagement since Application.LoadLevel is obscelete and I've read that we need to put it like this.

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class UI : MonoBehaviour {

    private Scene activeScene = SceneManager.GetActiveScene();

    // Use this for initialization
    void Start () {
        Debug.Log (activeScene.name);
    }

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

    }

    public void restartLevel(){
        SceneManager.LoadScene (activeScene.buildIndex);
    }
}

The Debug.Log show "-1" and it should be "0" and throw this error in console

Scene '' (-1) couldn't be loaded because it has not been added to the build settings or the AssetBundle has not been loaded.

The Scene is added in the build setting too by the way.

Seems that it can't return me the good index and even with the activeScene.name, still returns NULL. I miss how Application.LoadLevel was easier and more robust that this new way...

sentences:
Sprites are rendered as black rectangles in android 4.0.x only I have some problems rendering sprites correctly on a LG optimus vu (android version 4.0) with libgdx.
Basically sprites are black rectangles, while other images that i declare as Texture are correct.
I've tested my game with android 4.2 4.3 and 5.0 and I have no problems...

Is there some difference between 4.0 and 4.2 in graphics rendering? Maybe it's Gl10 and not Gl20?

sentences:
my movement is working good on keyboard but on android its not So basically here is what my movement is like for keys:

key down

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

key up

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

touch down

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

touch up

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

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

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

sentences:
ECS - should everything be a system? I've just recently started working with LibGDX and Ashley, and I find it to be really useful and I like working with the whole entity/component/system workflow. But I've been starting to layout the GUI and other aspects of the interface that dont exactly, to me, seem like they should be entities.

When using an ECS should EVERYTHING in your game be an entity with components/a system to control them?

sentences:
Unity3d or WebGL: Where should I go? I am interested in making a simple 3D game this summer, and I'd prefer if it were playable in a browser. My choices I am considering are Unity and WebGL. Currently I have no experience in either. But I have taken an introduction course to OpenGL. As well I will later be taking a course that will use Unity. I have some C# experience, but no web background.

The factors I'm considering are ease to learn and the penetration each has. I know Unity games can be uploaded to Kongregate, which seems like a pretty big deal if I made a game that would be somewhat successful. But of course that may not be the case at all.

Which way should I lean? Personally I think learning WebGL would be the easiest transition, but I am not sure

sentences:
Dynamic chunk loading with high FPS. But still chops I am creating a voxel world, (like any other person), but I currently have a small performance hit when loading/unloading chunks.

Right now I can load and unload chunks dynamically with "infinite" type world. I am using VBO's to store chunk data with float buffers. Also, (my big point), I am using Greedy meshing to only render the edges I need. My only thought of why it's not loading well is that I am using SSAO shading, which should have a hit on my FPS, but my FPS stays in the high 200's. Also, I am using frustum culling and normal culling. What I want is the player to have a really large render distance without actually rendering the chunks until the player is close. Almost like fog but instead of covering up unloading, it's actually reducing the detail as you move away.

Also, when a player creates a voxel or destroys a voxel (basically any change in the chunk) it saves the chunk to a file in the corresponding world folder.

Any ideas?

Here is a video of the game in its' current stage.

Here's a screenshot with a far render distance. Anything with a render distance that is far, hits the performance BAD

sentences:
How can I create a tile set that will allow me to render a soccer pitch in perspective? I am making a soccer game that needs a large pitch image (the whole play field area is about 3300 * 1200 pixels).

I know I should use the Tiled map editor to create a tile map so that I can create the whole soccer pitch by using just a few tiles, but I'm not sure how I can create a tile set that will allow me to create good-looking fields like in these games:

As you can see, the soccer pitch is not a rectangle but more of a trapezoid, so it changes the way we draw border and grass stripes. The grass stripes are sloping, and the slope changes the closer they are to the goal. That makes it very hard to replicate in a limited amount of tiles.

Currently, I have 3 layers for my field. Each tile is 64 * 64 in size, and I create them this way:

The border tiles. Since the border is not repeating, I take the border, cut it up into tiles, and add them to the tile set. It's fussy, but it seems this is the only way.
Light colored grass. I have a single, repeating 64 * 64 tile that is used to cover the base layer of the field.
Deep colored, sloping stripe grass. This is the one I can't figure out how to create.

How can I create that last set of tiles or otherwise achieve my effect?

sentences:
How to create mipmap for Unity3d textures loaded with www? When I load a texture using the code below:

WWW www = new WWW(textureName);

yield return www;

renderer.material = new Material(Shader.Find("Diffuse"));

Texture tex = www.texture;
tex.filterMode = FilterMode.Trilinear;

renderer.material.mainTexture =tex;

The texture does not come with mipmaps, how can I tell unity to generate the mipmaps?

sentences:
How can I create a VBO of a type determined at runtime? I've written a Vbo template class to work with OpenGL.

I'd like to set the type from a config file at runtime. For example:

<vbo type="bump_vt" ... />

Vbo* pVbo = new Vbo(bump_vt, ...);

Is there some way I can do this without a large if-else block such as:

if( sType.compareTo("bump_vt") == 0 )
    Vbo* pVbo = new Vbo(bump_vt, ...);
else if
    ...

I'm writing for multiple platforms in C++.

sentences:
How to store and update data table on client side (iOS MMO) Currently I'm developing an iOS MMO game with cocos2d-x. The game depends on many data tables (Excel file) given by the designers. These tables contain data like how much gold/crystal will be cost when upgrade a building (barracks, laboratory, etc.). We have about 10 tables, each have about 50 rows of data.

My question is how to store those tables on client side and how to update them once they have been modified on server side?

My opinion: use SQLite to store data on client side, the server will parse the Excel files and send the data to client with JSON format, then the client parse the JSON string and save it to SQLite file.

Is there any better method?  I find that some game stores CSV files on client side, how do they update the files? Could server send a whole file directly to client?

sentences:
How to use AssetBundles with Unity WebGL I have a Unity WebGL project that tries to load AssetBundles, but I get an error:

  Unable to open archive file: http://localhost:50212/StreamingAssets/Bundles/language_english

The code that creates the AssetBundles:

using UnityEditor;
using System.IO;
using UnityEngine;

public class JC_Bundler: Editor
{
    [MenuItem("Assets/Build AssetBundles")]
    static void BuildAllAssetBundles()
    {
        string path = Path.Combine(Application.streamingAssetsPath, JC_Bundles.Directory);
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }

        BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
        AssetDatabase.Refresh();
    }
}

I can see the AssetBundles do get created and it works on other Windows Standalone and Android platforms.

The code that read the AssetBundle:

public void PrepareLanguageAssets(SystemLanguage language, UnityAction onDone, UnityAction onFail)
{
    StartCoroutine(LoadBundle("language_" + language, bundle => {
        if (bundle == null)
        {
            onFail();
        }
        else
        {
            if (languageBundle) languageBundle.Unload(true);
            languageBundle = bundle;
            onDone();
        }
    }));
}

public void LoadLanguageAsset<T>(String name, UnityAction<T> callback) where T : UnityEngine.Object
{
    StartCoroutine(LoadAsset(languageBundle, name, callback));
}

IEnumerator LoadAsset<T>(AssetBundle bundle, string objectNameToLoad, UnityAction<T> callback) where T: UnityEngine.Object
{
    AssetBundleRequest asset = bundle.LoadAssetAsync<T>(objectNameToLoad);
    yield return asset;

    callback(asset.asset as T);
}

So when I switch my Unity Editor Platform to WebGL and do a "Build And Run" with the same project I see the above mentioned error.

How can I load AssetBundles in WebGL?

sentences:
Separating axis Theorem rotation issue I made a post yesterday to see if anyone could understand my problem.

However I did not receive much guidance, probably because my question was not clear.

I have worked on it a little more and discovered the actual issue and now have a clearer picture of what is causing the problem.

As you can see from the image, the boxes are projected correctly along their appropriate axis (all components labeled 1 are from the main white box 1 and vice versa).

The problem comes when the box is rotated. (See image 2). Box 1 has been rotated but the corner (projection?) in green clearly does not match the shape of the rotated box 1 and is much much closer to box 2 than it should be. The axis projections have changed and axis 1 is on the far left but axis 3 has gone?

THE CODE CAN BE SEEN ON MY PREVIOUS POST
Separating Axis Theorem Issue

Thank you! ;D

sentences:
How do I remove the background from pixel art sprites in Gimp? I drew a pixel art tree using GIMP. My problem is, how can I cut out the white background, because if I want to build a tile map with it, in my case with tiled, it always has the white background with it.

I know you can cut it manually, but I want to know whether there is an easier way.

sentences:
(Three.js) - What object3D properties are required to make rayCaster.intersectObjects() work? FYI, i am trying to do something almost identical to the following:
Merging geometry/mesh without losing benefits

I essentially have a list of Three.object3D's. These objects are "merged" together into a single BufferGeometry (so that i can draw thousands of these objects with a single draw call).

After merging these objects I still do have references to all of the original objects (via a class which simply "has a" object3D object reference).

* Question *

I am calling raycaster.intersectObjects(myObjects) on this list of original Object3D's. Im wondering what properties are required for this intersectObjects method to work? In other words, the ray caster must be checking against each objects position and geometry. What properties (position, geometry?) are required and where do these properties exist (within the Object3D reference)?

Whew. I hope this all makes sense.

sentences:
How should I prepare for migration from D3D9 to D3D10 or D3D11? I'm considering a Direct3D9 texture streaming solution, but my company will eventually be going to D3D11 in the future.

I wanted to make my solution as forward compatible as possible, so I was hoping that someone could give me some feedback on exactly what D3D11's capabilities were and what I should be looking for when preparing such a migration?

For reference, here's what I'm considering on D3D9:

Load low res mip maps for all meshes at load time
Create bounding boxes around each of my objects and detect when I'm inside any given bounding box
For any bounding box that I'm inside of I will load the high res portion of the mip map
Any bounding box that I've left I'll unload the texture from
I've also got to cook up some scheme to manage fragmentation of the GPU memory, initially I'll probably just cycle the GPU memory whenever the camera and my objects are still

sentences:
How to use PhotonPeer in Unreal Engine 4.8 I'm trying to implement PhotonPeer in Unreal Engine 4.8 but I'm stuck at the connect function. I need to provide an AppId, but nothing I try is accepted by UE4.

Here's my code:

DALGameInstance.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Engine/GameInstance.h"
#ifdef __clang__
#pragma clang diagnostic ignored "-Woverloaded-virtual"
#endif
#if _EG_WINDOWS_PLATFORM
#include "AllowWindowsPlatformTypes.h"
#endif
#pragma warning (disable: 4263)
#pragma warning (disable: 4264)
#include "Photon/Photon-cpp/inc/PhotonPeer.h"
#include "Photon/Photon-cpp/inc/PhotonListener.h"
#pragma warning (default: 4263)
#pragma warning (default: 4264)
#if _EG_WINDOWS_PLATFORM
#include "HideWindowsPlatformTypes.h"
#endif
#include "DALGameInstance.generated.h"

/**
 *
 */
UCLASS()
class DALGAME_API UDALGameInstance : public UGameInstance
{
    GENERATED_UCLASS_BODY()

public:
    //UDALGameInstance(const class FObjectInitializer& ObjectInitializer);
    ExitGames::Photon::PhotonPeer* peer;
    ExitGames::Photon::PhotonListener* listener;
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DALGameInstancePhoton)
    FString ServerAddress = "127.0.0.1:5055";
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DALGameInstancePhoton)
    FString ApplicationName = "MasterServer";
};

DALGameInstance.cpp

// Fill out your copyright notice in the Description page of Project Settings.

#include "DALGame.h"
#include "DALGameInstance.h"

UDALGameInstance::UDALGameInstance(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
    peer = new ExitGames::Photon::PhotonPeer(*listener, ExitGames::Photon::ConnectionProtocol::UDP);
    UE_LOG(LogTemp, Warning, TEXT("Connecting to server"));
    if(!peer->connect(*ServerAddress, **ApplicationName**))
    {
        UE_LOG(LogTemp, Warning, TEXT("Connection failed"));
    }
    else
    {
        UE_LOG(LogTemp, Warning, TEXT("Connection established"));
    }
}

The part with ApplicationName is the problem. BuildTool complains No suitable conversion from FString to const nByte. I have tried everything to get this up and running but with no luck at all.

Does someone have the same issue or a hint at what I missed?

sentences:
Android: 2d scrolling background I am a very beginner in game development. All I want to achieve in the beginning is a free scrollable background like in a strategy game with my custom graphics. In my case it is supposed to be a 2d city map where the user can select buildings.
How can I achieve that as easy as possible in android? With OpenGL? Die you have any examples especially for this scrolling functionality?

sentences:
What are the common methods for achieving dynamic asset destruction? I am trying to determine the most appropriate destruction solution for an online desktop game. There are two main factors here that I am considering; 1) the performance of the approach taken and how much resources it requires, 2) the turn around time for making an asset "destructible".

There are three main destruction approaches which I am aware of:

1) Creating a destruction animation for each asset, which plays based on specific conditions

2) Create a second version of each asset consisting of rigidbodies. Under specific conditions, replace the static asset with the rigidibodies and gravity/ other physics forces will cause it to collapse

3) Use a mesh splitting system to dynamically split static assets into rigidbodies at runtime

Option 1 appears to have the best performance, however it also requires the most preparation time to do realistically. Option 3 on the other hand requires no preparation time for assets, however it is the heaviest on performance since it is completely physics based.

My question than is, which of the above approaches is most common in the industry today? Or if there is another better approach which I have missed, what is it. Ideally I would like to go with option 3, but I fear that the performance hit would be too severe.

sentences:
How to draw grass sprites without using gameobjects? I am making a rimworld-like procedurally generated 2D game using Unity's tilemap system.
Just like tiles, I also have to procedurally generate grass and trees. Each grass instance should have logic inside that keeps track of it's growth progress and update the grass size appropriately.
The downside is, I have to have maps as big as 400x400. That could be THOUSANDS of grass instances and each of them having their own GameObject seems ridiculous and like the game would lag.
How can instantiate those grass sprites without creating new gameobjects for each one while still being able to control the growth and similar things?
(Come to think of it, the DOTS / ECS system in Unity would be perfect for this, however it is nowhere near ready and many things I want to do are just not supported.)

sentences:
Performing movement per game tick Assume we have a player on a map, whereby the grid is represented as a floating point.

When a player is moving, they have an x and y velocity.

How to do you properly apply their movement each gametic?

By that I mean: do you keep nudging the player forward by one map unit and repeat that by the velocity? Where is that fine line where I say "we don't go any smaller movements than this like 0.5, or 0.25, etc"

Further, is there a way to optimize this to be able to make movement fast computationally? I thought of having some kind of blocks where you can quickly check if you'd intersect anything and make some optimizations, but I have no idea if this is good, bad, or how it should be done.

Update: Suppose you have a projectile traveling 100 map units North, and it would collide with an object 50 map units North of it. In the period of one world 'ticking', would you just halt it in a dead on collision (assuming the line is impassible), or would you detect a collision and then do something after it since that remaining 100 map unit velocity (like maybe if it's on an angle then cancel its Northward momentum and continue trying to move it to the East/West.

sentences:
What does the Node2D transform property do? Following a Godot tutorial I encountered the transform property, but I'm not sure what it means nor how to use it.
I read the official Godot documentation, but it didn't give me a full explanation about the theme. I just got this:

Transform2D transform
Setter set_transform(value)
Getter get_transform()

Could someone explain to me more about this?

sentences:
Removing all destroyed objects from a list I am a little confused on deleting objects in a List. I realise that clearing the list doesn't destroy the gameobject in Unity. Hence I have written this routine to destroy and remove:
//clear all block sprites away
for (int i = 0; i < blockSprites.Count; i++)
{
    Destroy(blockSprites[i]);
}
blockSprites.Clear();

But what if I only wanted to destroy some of the elements (a variable amount)?
In that scenario the List.Clear() function wouldn't work. Would I have to make another list of indexes in order to go through destroying and removing from the list in two sweeps. Or is there a better way?

sentences:
Unity built-in Network Lobby How to move GUI? I'm using built-in network manager HUD and I'm fine with it for now.
But I can't move lobby GUI, only Network Manager HUD. Is there a way to move it down to make space for Title Art?

sentences: Unity how to set Off mesh link speed How can I set agent's speed on off mesh link? I want it to look like a jump, but now it looks like it was in slow motion.

sentences:
How to custom file formats work, encryption, packing etc So say I take an example from Telltale games, they pack all their file assets into ttarch files, now I guess this is a custom file format that allows many file assets such as dds, jpg, bik, wav, 3ds etc to be packed into one file.

So someone has worked out how to explore these ttarch files and inside as you would imagine there are hundreds of files each with non standard file extensions(apart from the  lua files) such as d3dtx, d3dmesh, vers, spline, style, scene, there are also lua files which we all know.

The d3dtx files will be dds, jpg, bmp etc, so do you actually encrypt a dds file in this way, can someone enlighten me on the process of file encryption/packing files together?

sentences:
Moving/spilling water inside a cup of glass I made a glass of water but there are somethings i didnt know how to do well, what i did is i put a mesh on the top of the glass to represent the surface of the water but it doesnt really work well with glass because if you look from the sides you wont really see that there is water in there, this is what i did :

the glass from the side :

as you can see it doesnt really work well in my case.
I also tried putting an object that has the same shape as the cup inside to represent water but that would make it difficult for what i want to do next, because my next step would be to make the water rotate in the opposite rotation of the cup and make it spill if it reaches the top of the cup, and that is my second question how do i make the water spill from the cup?

Any help is very much appreciated.

sentences:
How can I programatically generate sprite instances in Unity? I want to create a block-based puzzle game that generates blocks as they are required, however I cannot seem to find any good information on how to do something like this using Unity's new sprite system.

Ideally the following would occur:

Generate a random number to determine the type of block
Create a sprite object of correct block type
Display block on screen

I currently have the following:

using UnityEngine;
using System.Collections;

public class Block : MonoBehaviour {

    public SpriteRenderer blockSprite;
    int row;
    int column;

    // Use this for initialization
    void Start ()
    {
        row = 0;
        column = 0;
    }

    // Update is called once per frame
    void Update ()
    {
        // gravity check
    }

    public void GenerateNewBlock()
    {
        int randNumber = Random.Range(0, System.Enum.GetNames(typeof(BlockType)).Length);
        Sprite sprite = new Sprite();

        blockSprite = gameObject.GetComponent<SpriteRenderer>();

        switch (randNumber)
        {
        case 0:
            sprite = Sprite.Create(AssetsLoader.Instance.BlockSprites[BlockType.Water], new Rect (0, 0, 100, 100), new Vector2(0, 0), 100.0f);
            break;
        case 1:
            sprite = Sprite.Create(AssetsLoader.Instance.BlockSprites[BlockType.Fire], new Rect (0, 0, 100, 100), new Vector2(0, 0), 100.0f);
            break;
        }
    }
}

public enum BlockType
{
    Water,
    Fire
}

And an assets loader Singleton class to load in the textures once into memory

using UnityEngine;
using System.Collections.Generic;

public class AssetsLoader : MonoBehaviour
{
    // instance variable to prevent multiple instances of this class
    private static AssetsLoader instance;

    // variables we want to retain state
    public Dictionary<BlockType, Texture2D> BlockSprites;

    // empty private constructor
    private AssetsLoader() {}

    // Property that holds the instance
    public static AssetsLoader Instance
    {
        get
        {
            if (instance == null)
            {
                instance = new AssetsLoader();
            }

            return instance;
        }
    }

    // Use this for initialization
    void Start ()
    {
        BlockSprites = new Dictionary<BlockType, Sprite>();

        Sprite newSprite;

        newSprite = Resources.Load("Sprites/water block") as Texture2D;
        BlockSprites.Add(BlockType.Water, newSprite);

        newSprite = Resources.Load("Sprites/fire block") as Texture2D;
        BlockSprites.Add(BlockType.Fire, newSprite);
    }
}

Can someone please help me understand what needs to be done to create block objects in my scene. Ideally I would only use Sprite objects but I think I might need to load the assets in as Textures in order to get them to display.

sentences:
How to calculate ray polygon intersection? I'm in a class where we are creating a ray tracer from the ground up in C++. I'm at a point where I can't seem to wrap my head around the math that is required to calculate the point at which a ray intersects a polygon.

We have some direction for how to do this, but all of the class materials as well as my Googling of the subject have not helped.

These are the functions we must complete:

bool polygon::Intersect(const ray &R, intersection &inter)
{
    // To Do: If you have implemented the "CalculateNormal" method
    // below, should already be calculated and placed in the member
    // "n".
    //
    // Now, using n, you need to calculate the intersection of the
    // ray with the plane containing the polygon.  Then, once you
    // have that point, you need to loop through each edge in the
    // polygon and make sure the point is to the left of that edge.
    //
    // If it is to the left of every edge, then fill the structure
    // inter with all of the data for the intersection and return
    // true, if not, return 0.
    //
    // Don't forget to check to see if the t you calculate for the
    // ray is > 0.

    return false;
}

void polygon::CalculateNormal(void)
{
    // To Do: Use the edges of the polygon to calculate the normal
    // of the polygon. You should be careful to take care of the
    // case where two edges give you a zero normal.  Place the
    // normal into the member "n" so that the intersection method
    // can use it when called.
    //
}

Could someone please explain this in a bit further detail?

Note: I am not asking for anyone to write the code or do my homework for me, but instead help me understand what exactly is going on here.

Thank you.

sentences:
Vectors and corners of squares I am having some problems with some vector math.

Imagine a square and coming from each corner of the square is an invisible vector, which starts at the square's centre and ends at the edge of the screen.

   \          /
    \   a    /
     \______/
     |      |
  d  |      | b
     |______|
    /        \
   /    c     \
  /            \
THIS IS A VERY CRUDE IMAGE AND THE ANGLES OF THE VECTORS ARE NOT EQUAL

There are 4 areas: a, b, c and d

I would like to say that if you touch within one of the areas then something happens.

Is there a simple way to do this?

sentences:
Storing player's tilemap position inside the player object I'm trying to create a multidimensional array as a sort of 2D map for a text-based RPG game. I want to create a multidimensional array that's, for example, 5x5. The array would be filled with 0s to represent a space void of an object. Other numbers would represent the player on the map, an enemy, an npc, a skill-object (like an enchantment table, etc.), doors that link to maps, and chests. They would all have different values to represent what object is there. If a player tries walking into a chest, it would instead loot the chest. Then the chest would be reset to 0 to represent the empty space, letting the player walk there and representing that there is no more chest. If the player tries walking over an enemy, it would instead engage combat (handled by a separate class and functions). Walking over a number representing a door would link to another multidimensional array that represents another map.

I want to know what kind of property I need to put inside the player class to handle where he is on the map. A function would then change that value to move him around the map. Would creating a class for a map be a good idea? Would I store the values for the objects there or in the individual classes for those objects? How would I go about this? Thank you for your help. For reference, here's my player class (careful, it's long...):

public class Player
{
    public string   name        { get; set; }        //Name of Player
    public int      level       { get; set; }        //Player's combat level         (average of combat-related skills' levels)
    public int      health      { get; set; }        //Player's health               (player dies when this value reaches 0)
    public int      health_max  { get; set; }        //Player's maximum health
    public int      stamina     { get; set; }        //Player's stamina              (used for power attacks, slowly recharges on own)
    public int      stamina_max { get; set; }        //Player's maxiumum stamina
    public int      fatigue     { get; set; }        //Player's fatigue rate         (player cannot fight or run while fatigue is 100)
    public int      hunger      { get; set; }        //Player's hunger level         (player becomes weaker as hunger increases)
    public int      style       { get; set; }        //Player's fighting style       (refer to styles.txt)
    // tons of skills fields
}

sentences:
What am I missing for this flycam to work correctly? Through reverse engineering, I've found an instruction to inject on which allows me to obtain the XYZ coordinates of the camera, as well as pitch and yaw. Thus, I have the following:

  camX (Plane) -- Value is a float ranging from negative to positive
  camY (Plane) -- Value is a float ranging from negative to positive
  camZ (Up/Down) -- Value is a float ranging from negative to positive
  camH (Horizontal/Yaw) -- Value is a float in degrees from +180 to -180
  camV (Vertical/Pitch) -- Value is a float in degrees clamped to +89 to -89

I've written a script in Lua which allows me to bind directions (forward, backward, left, right, up, and down) to keys (W, A, S, D, Q, and E); however, those simply add/subtract to/from XYZ values along with a speed modifier, meaning if I'm facing forward and moving forward, everything is fine. Turning 180 degress with the mouse, though, effectively means back is forward, left is right, etc.

What I'm looking to achieve is having those directional keys apply to wherever I'm aiming the mouse pointer. So, forward is always where I'm facing, etc.

I've been piecing together the necessity of sin/cos for calculations related to this; however, I'm apparently in over my head with understanding everything I'm reading/watching. I've found a number of calculations for this based on degrees, radians, converting degrees to radians, etc., but I'm just completely lost as nothing I've tried has panned out (even though I think I understand what I'm reading).

I've ascertained that, where applicable, respective games have sin/cos values stored somewhere in memory which I could use in lieu of calculating those values myself, but I'm honestly not sure what those values look like to seek out in the first place...or exactly what I need to do to make the calculations myself. They're probably staring me right in the face in nearby memory or on the stack as I trace through code, but I simply don't know.

Are there multiple ways to calculate the appropriate angles via sin/cos? Can I use some combination of the 5 values I listed above, along with a speed modifier and Lua's math.* methods (math.rad, math.sin, math.cos), to get this flycam to work properly?

Thank you for any guidance you can provide!

sentences:
Lock mouse in center of screen, and still use to move camera Unity I am making a program from 1st person point of view. I would like the camera to be moved using the mouse, preferably using simple code, like from XNA

var center = this.Window.ClientBounds;
 MouseState newState = Mouse.GetState();

  if (Keyboard.GetState().IsKeyUp(Keys.Escape))
  {
      Mouse.SetPosition((int)center.X, (int)center.Y);
      camera.Rotation -= (newState.X - center.X) * 0.005f;
      camera.UpDown += (newState.Y - center.Y) * 0.005f;
  }

Is there any code that lets me do this in Unity, since Unity does not support XNA, I need a new library to use, and a new way to collect this input.

this is also a little tougher, since I want one object to go up and down based on if you move it the mouse up and down, and another object to be the one turning left and right.

I am also very concerned about clamping the mouse to the center of the screen, since you will be selecting items, and it is easiest to have a simple cross-hairs in the center of the screen for this purpose.

Here is the code I am using to move right now:

using UnityEngine;
using System.Collections;

[AddComponentMenu("Camera-Control/Mouse Look")]

public class MouseLook : MonoBehaviour {

public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 }
public RotationAxes axes = RotationAxes.MouseXAndY;
public float sensitivityX = 15F;
public float sensitivityY = 15F;

public float minimumX = -360F;
public float maximumX = 360F;

public float minimumY = -60F;
public float maximumY = 60F;

float rotationY = 0F;

void Update ()
{
    if (axes == RotationAxes.MouseXAndY)
    {
        float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;

        rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
        rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);

        transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
    }
    else if (axes == RotationAxes.MouseX)
    {
        transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
    }
    else
    {
        rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
        rotationY = Mathf.Clamp (rotationY, minimumY, maximumY);

        transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
    }
    while (Input.GetKeyDown(KeyCode.Space) == true)
    {
        Screen.lockCursor = true;
    }
}

void Start ()
{
    // Make the rigid body not change rotation
    if (GetComponent<Rigidbody>())
        GetComponent<Rigidbody>().freezeRotation = true;
}
}

This code does everything except lock the mouse to the center of the screen. Screen.lockCursor = true; does not work though, since then the camera no longer moves, and the cursor does not allow you to click anything else either.

sentences:
How can I compute a velocity proportional to the difference between two hand positions? I'm working on a project with the Kinect SDK and XNA 4. I need take the position of the hands and draw a sprite over it. I'm was doing it directly and because of that I get a "trembling hands" effect. So, I was thinking of making the sprite move from the previous position to the new one given in every frame by the new hand position.

This way, the sprite does not jump from one position to another. This is working just fine, but I'm using a constant value for the velocity, and I really would like to use a variable velocity given by the difference between the previous and the new position. That is: if the hand move more quickly in the reality, the velocity will be higher.

I really don't have a clue on how to make this work. Can somebody point me in the right direction?

sentences: When should I talk to a lawyer about intellectual property for an indie team? Let's say you have a team building a decent game and all is well technically and people-wise. You feel pretty sure you'll get to a product that can be sold. How does an indie studio (with good practices in this domain) typically manage the IP, esp. trademarking and copyrighting? When's the right time to do this, early or later?

sentences:
Map file format for Real-time strategy game I am planing to create a 2D RTS game on iPhone using cocos2d, besides the tile map, any other suggestion for storing the map details for the game?

Would be nice if a GUI editor is also provided.

sentences:
Unity Co-ordinate system to latitude longitude conversion floating point precision lost I am using a Github script (Unity GPS Convertor) to convert unity co-ordinate system x,z into latitude and longitude. It is actually working fine but the problem is, when I go farther from the origin (0,0,0) my conversion is no more accurate. I deeply try to study this topic and found a valuable blog about unity coordinate limitation which states that

  Floating Point Accuracy Unity allows you to place objects anywhere
  within the limitations of the float-based coordinate system. The
  limitation for the X, Y and Z Position Transform is 7 significant
  digits, with a decimal place anywhere within those 7 digits; in effect
  you could place an object at 12345.67 or 12.34567, for just two
  examples.

  With this system, the further away from the origin (0.000000 -
  absolute zero) you get, the more floating-point precision you lose.
  For example, accepting that one unit (1u) equals one meter (1m), an
  object at 1.234567 has a floating point accuracy to 6 decimal places
  (a micrometer), while an object at 76543.21 can only have two decimal
  places (a centimeter), and is thus less accurate.

It means that if I put any object at 10000 position of x then, the floating point accuracy will only be 2 decimal places? My Current environment is very large and even one object position is at 90000 of x coordinate in unity position. So my question is that how can I convert the lat-long correctly keeping in mind this floating point accuracy problem. The Unity GPS Convertor library is fine but it based on float.

Remember:
My Project is a very large 3D environment where someone can provide lat/long then, I move my camera at that position. This require conversion which i have discussed in this caution that is not accurate. The environment is very large so I am also shifting the origin but whenever user try to set lat/long of the player/camera, I stop origin shifting and move back everything on its original position in order to carryout right conversion. Then, I again start origin shifting.

Edit:
Floating Origin Code:

 void Update()
{
    //As camera distance reached at certain limit set the environment parent position according to the inverse of camera local position
    if (AlllowShifting && CompareDistance())
    {
        ChangeEnvironmentPositionAtZero();//TODO Uncomment
    }
}

public void ChangeEnvironmentPositionAtZero() {

    Vector3 cameraInversePosition = new Vector3(camera.localPosition.x * -1f, camera.localPosition.y * -1f, camera.localPosition.z * -1f);//
    parent.transform.position = cameraInversePosition;

}

bool CompareDistance()
{

    distanceNow = Vector3.Distance(this.transform.position, origin.transform.position);
    return distanceNow > cameraDistanceLimit;

}

Note: All the objects are inside one main parent. The position is changing of the parent. While you can find Unity Co-ordinate conversion to GPS here.

sentences:
OnTriggerEnter With First Person Controller I'm working on an FPS for my first time.

I'm creating a simple terrain and instatiating 15 cubes on my terrain. (This works fine). Each cube is named "cube" and has a static trigger collider.

Here's what my scene looks like:

When my first person controller collides with my cube (instantiated object) then I want the cube to deactivate and add 1 to my score, but nothing happens.

Code:  I added this code in FirstPersonController.cs

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.name == "cube")
    {

        other.gameObject.SetActive(false);
        // when the player touches my spawned object then I want to
        // deactivate my cube, but nothing happens

        Debug.Log("collidedwith:" + other.gameObject.name);

        score += 1;
        scoreText.text = score.ToString();

    }
}

sentences:
Changing the texture filtering methodology within the same SpriteBatch Begin/End pair How would I go about using changing the texture filtering method being used within the same SpriteBatch Begin/End pairing?

I have this code so far.

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null);

spriteBatch.Draw(PixelArtTexture, new Vector2(x, y), null, Color.White, 0f, Vector2.Zero, new Vector2(8, 8), SpriteEffects.None, 0f);

spriteBatch.End ();

This draws a pixel art texture using point filtering, however I want to draw another texture using linear filtering, so how would I do that?

sentences:
Best approach for destructible car in Unity I'm developing a simple racing car game.
I'm wondering what is the best approach to manage visually car destruction.
For instance: i think one option (expensive) is to build car 3d model with 'separate' mesh, each for any component (bump, door, glass) and relative cooliders..
Other options ?
Thanks

sentences: How to load a custom SpriteFont? Is there any possible option where you can open a custom SpriteFont? Because I need to add to my game a font that is not in Windows already. I saw this page Custom Sprite Fonts and it's like I want it, but there's no explanation on how to do it...

sentences:
Tile pair matching algorithm I'm trying to make a tile matching game. User can select a pair of tiles from a square grid, and if they match, both are removed from the grid.

Tiles are matched if:

they are of the same type (many types of tiles are in the grid) AND
they can be connected in the grid (either adjacent, or has a clear path of empty spaces between them in the grid)

I would like to scan the grid in advance and find the currently matching pairs (desirably with the path that connects them). Thus I can:

give hint to users if they're stuck in finding a pair
detect a situation when no more pairs can be matched (so the tiles will be reordered)

Ideally during the scan each tile pair of the same type should be taken and checked for matching. Is there any algorithm/technique I can use in here to obtain an optimized approach in finding the connecting paths?
Also, is there anything I should take care of while initializing the grid (currently just random assignment) so as to ensure at least some tiles are adjacent in the beginning (and that I won't have to reorder them too much during the game) ?

sentences:
My cube goes through side walls on android device I have a cube and it's on the ground and there are two walls (Plane) next to the ground.

Like in the image there is a ground and in side there is a wall.
Here is my code:

    void Update() {

      transform.Translate(userDirection * speed * 14f * Time.deltaTime);
    transform.Translate(mSpeed * Input.GetAxis("Horizontal") * 2 *  Time.deltaTime, 0f, mSpeed * Input.GetAxis("Vertical") * 2 *  Time.deltaTime);

    if (Input.touchCount == 0)
        return;
    Touch touch = Input.GetTouch(0);
    float originalY = transform.position.y;
    float cameraZ = Camera.main.WorldToScreenPoint(transform.position).z;

    if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Began) {
        Vector3 screenPoint = new Vector3(touch.position.x, touch.position.y, cameraZ);
        Vector3 worldPoint = Camera.main.ScreenToWorldPoint(screenPoint);
        worldPoint.y = originalY;
        transform.position = worldPoint;
    }
}

My cube goes through the side walls, but on laptop it works perfectly, and on android device my cube goes through the side walls. Can anyone please tell why is my cube is going through side walls?
Any help is appreciated!

sentences:
Why is my enemy object shaking in my AI code? My script here is attached to an 'enemy' object. My enemy walks to certain "points" if the player is far away from him. If the player gets close to him, the enemy follows the player. The problem is that after chasing the player, when he escapes, the enemy should walk back to the "points".

Now I see the enemy object shaking and walking far away from the expected direction?!

public class enemyscript: MonoBehaviour {

    public Transform target;
    public Transform[] waypoint; // points
    NavMeshAgent ePath;
    private int farPoint = 0;
    public float elife = 100f,distance,look_range = 20.0f;

    // Use this for initialization
    void Start () {
        ePath = GetComponent<NavMeshAgent>();
        ePath.speed = 2;
    }

    // Update is called once per frame
    void Update () {
        distance = Vector3.Distance(gameObject.transform.position, target.transform.position);

        if (ePath.remainingDistance < 0.5f)
        {
            nextpoint();
        }

        if (distance < look_range)
        {
            attack();
        }
    }

    void attack() {
        ePath.SetDestination(target.position);
        ePath.speed = 6;
    }

    void nextpoint() {
        if (waypoint.Length == 0)
            return;
        ePath.destination = waypoint[farPoint].position;
        farPoint = Random.Range(0, waypoint.Length);
        ePath.speed = 2;
    }
}

sentences:
Line plane intersection: what is this variable? I'm doing line plane intersection, and have come across an un-referenced variable or constant in the tutorial I'm following.
One of the formulae given is this:
t = N dot (p2 – p0)
     N dot V
The variable I'm stuck with is V. Can someone tell me what V is and how I'd go about finding it?
For more info on that formula, please see the link given in the first para.
Thanks,
James

sentences:
How to know if mouse coordinates is delta or absolute on Window and Android in Unity? I wrote sample application, that allows to "rotate" object by mouse. Rotation occured by rotating of camera object around central object and the code is following:

float mouseX = -Input.GetAxis("Mouse X");
float mouseY = -Input.GetAxis("Mouse Y");

float magnitude = transform.position.magnitude;

Vector3 mouseSwipe = new Vector3(mouseX, mouseY, 0);
Vector3 startPoint = new Vector3((float)camera.pixelWidth / 2, (float)camera.pixelHeight / 2, magnitude - 1);

Vector3 startPointWorld = camera.ScreenToViewportPoint(startPoint);
Vector3 endPointWord = camera.ScreenToViewportPoint(startPoint + mouseSwipe);

Vector3 mouseSwipeWord = endPointWord - startPointWorld;

float dragLat = mouseSwipeWord.y;
float dragLng = mouseSwipeWord.x;

Vector3 oldPosition = transform.position / magnitude;

float lat = Mathf.Asin(oldPosition.y);
float rsmall = Mathf.Acos(oldPosition.y);

float lng = Mathf.Atan2(oldPosition.z / rsmall, oldPosition.x / rsmall);

lat += dragLat * 10 * 2 * Mathf.PI;
if( lat*180/Mathf.PI > 80 )
{
    lat = 80 * Mathf.PI / 180;
}
else if( lat*180/Mathf.PI < -80)
{
    lat = -80 * Mathf.PI / 180;
}

lng += dragLng * 10 * 2 * Mathf.PI * 2;

float y = Mathf.Sin(lat);
rsmall = Mathf.Cos(lat);

float x = rsmall * Mathf.Cos(lng);
float z = rsmall * Mathf.Sin(lng);

Vector3 newPosition = new Vector3(x, y, z);
newPosition *= magnitude;

transform.position = newPosition;

LookAtTarget();

The code assumes that mouse returns delta value on each swipe and this works well on Windows. For example, if I do several separate swipes, I can gradually rotate object for full circle.

Unfortunately, when I run this on Android, it doesn't happen. Each swipe object restarts from some position, depending on swipe point. I.e. on Android, swipes return in absolute value.

Is it possible to know, whether swipes retunrs delta or absolute values and how? Is it possible to claim compatible return units?

sentences:
OpenGL ES 1.1 - How to batch draw particles with different translations? Assuming that I've combined all of my vertex data for many particles into a single array, how would I batch draw all of those particles in a manner that preserves their unique translations?

Any code examples would be greatly appreciated.

sentences:
How many database connection should use in a MMO game server? Game server links to database, how many database connection should use? The data update works like this:
update role object to database every X minutes, commit all updates every Y minutes.

There are 3 ways:

Only one database connection
One worker thread one database connection and set transaction level to "Read Uncommitted". Worker thread loop all roles in it to do update & commit periodically
One game session one database connection and set transaction level to "Read Uncommitted". A dedicated thread to loop all connections to do update & commit periodically

Method 1 has a problem which database connection object needs shared by multiple worker threads, for JDBC, connection class is thread safe, but I don't know what about C++ such as MySql driver. If it have to use mutex to make thread safe, there will be a performance degrade: all worker threads have to synchronize their data frequently.

Method 2 has a problem to update old data. One map in game server run in dedicated worker thread. For example, role A in map 1 which compute by thread 1. role A transport to map 2 which compute by thread 2. This might cause thread 1's commit call after thread 2's commit call, so the older update which already executed in thread 1 commit after thread 2's commit.

Method 3 seems is a waste of system resource. Because in MMO there is no need to be transaction isolation, any change in a game session should be immediately seen by other sessions. In contrast with web app, so many connections has litte meaning. However the "Read Uncommitted" isolation level can let other session read data which has not committed yet.

==================================

I forget there is a thing called connection pool. Generally it is thread safe implemented so I do not need to care synchronization problem anymore. And the connection number is dynamic so I can leave problem of how many connection number to it. Only I do is get a connection from it.
So, method 1 & 3 both practical.

sentences: How can I change the rendering backend on Windows in Monogame? I'm using MonoGame with Visual Studio 2013 Express. I'd like to switch from a SharpDX backend to OpenGL and OpenAL. How do I achieve that?

sentences:
Issues with the camera following the spline I am trying to make a roller coaster and currently I have created a spline class which loads a spline from a text file .
So I have all the points and I have a Catmull-Rom Spline function but I have trouble figuring how a proper track can be created from those points.

Anyone done anything similar?

edit:
Ok i think i will make it more clear now. I was working on it yesterday that's why i didn't reply sooner.

First problem is that my camera is going off tracks.
This is the path generated: http://prntscr.com/ci9sud drawing it as GL_LINE_STRIP.

I have a cameraUpdate function:

float t = (float)TrackPointIndex / (float)1000; ++TrackPointIndex;
point viewPoint = tr->over->getInterpolatedSplinePoint(t);

t = (float)TrackPointIndex / (float)1000; ++TrackPointIndex;
point nextPoint = tr->over->getInterpolatedSplinePoint(t);

std::cout << "viewPoint " << glm::to_string(viewPoint) << std::endl;
std::cout << "nextPoint " <<glm::to_string(nextPoint) << std::endl;

if (TrackPointIndex == 1000)
    TrackPointIndex = 0;

control->bodyTranslation = viewPoint;
control->bodyRotation = nextPoint;

which with the use of getInterpolatedSplinePoint(t) returns the viewPoint and the nextPoint which are points on the spline.  Printing them proves they are indeed on the line. But since i am using GLM i update my camera with the glm::lookAt function . So i thought that the first argument which is the camera position should be the viewPoint and the second one which is where the camera should be pointing at should be nextPoint . But that just doesn't work .
cameraUpdate is called every 250ms or so but it is off tracks . Do i have to do any extra calculations to define where the camera should be / or be looking at?

That's my first problem.

The second one is not really a problem because i have not started working on it yet. I want to know how can somebody generate from the path a fairly good looking rail track.

Thanks.

Edit2: I put a sphere to travel through the tracks and it seems to be working fine . Still if i try moving the camera along the path it does not .

Anyone knows any way around this?

sentences:
Android differences (Dalvik+Java vs Old School C++) Developing in Android is going to be different for me, having spent the last 10 years coding games in C++. What's the main differences / pitfalls / bottlenecks to developing for the Android? My big worry is moving to Java, what am I going to miss most?

To be clearer: what would I miss if I coded the whole thing in Java compared to the way I normally code C++ for consoles?

sentences:
How should I do 3D games through Java on a mac? I have been self-teaching myself Java on the mac mostly because the language is cross-platform. Recently, I have been only able to develop 2D games using the Graphics2D class.
Now, I want to learn how to make 3D games in Java. I used to model and animate stuff in 3D, so my knowledge of 3-Dimensional stuff is okay.

I have spent the last 3 hours using google to look up ways of making 3D games in java. Apparently the best one to use is OpenGL, so i looked up a tutorial on it and i cannot find a tutorial that shows how to (if there is a way) install JOGL on the Mac platform.

Should i continue to use Java?

How can i make 3D games using Java?

What is the best way to make 3D games on a mac?

sentences:
Cast a circle around an object and detect other objects in range (with visual) I have my "player" object moving around an arena type area, with miscellaneous objects scattered about. What I want to do is move the player near any of these objects, and on keypress I want to display a circular radius with the player in the center that will detect nearby objects (eventually being filtered by tag).

I realize there are many ways to accomplish this, but being relatively new to Unity I am trying to find a way that is intuitive to me. Looking at the documentation, Physics2D.CircleCastAll seems like it would fit my needs, but I am unable to test at this time (at work).

Provided CircleCastAll is what I do use, is there a way in the scene to display the circle that is being cast so that the player can visually see the radius? I know it returns a RayCastHit2D, so I can get the objects from that, but the player should have something visual to let them know if they are slightly out of range or not.

Any suggesions/tips are welcome. Thanks in advance!

sentences:
TopDown 2d player control Whats the usual way to control a player in a top down game? We have to look in the direction of the mouse cause the player hold a torch.

My first try was:

to to make it absolute like W move to screen top, A left, D right, S bottom... But it feels a kind of strange.
second try was to make it relative to the player. So W is always straight forward, A and D is moving sideway and S is backwards. But i heard of my tester thats very hard.

So whats the better / right way for the movement in a top down game in that you can move in a another direction as you look?

sentences:
How can I simulate light using mask images on the iPad? Possible Duplicate:
  Can I achieve a torchlight effect (lighter area around a light source) in a 2D game?

I want to have a picture as a background, say this:

Then I would like to apply a mask, just a circle with blurred edges, so it looks like this:

The idea is to simulate something emitting. Is this a good way of simulating light or should I use another method? And if so how? And I'm not really sure how to apply this method.

sentences:
AABB Collision Problems in SFML I have a problem with AABB collision.

I am making a top down rougelike in SFML and my collision algorithm does't quite work properly.

HERE IS A GIF OF THE PROBLEM.

It mostly works, except for when you're against the corner of the block and hold the direction towards the block for a second. For some reason, after about a second, the player is clipped through the block to the adjacent side.

I think the problem is caused when, for example, the x axis needs to be resolved as the player is approaching the object from the left, but the y penetration ends up being more than the x and thus the collision is resolved incorrectly.

This is my collision code:

sf::FloatRect collisionRect;
std::vector<Entity*> activeEntities;
for each (Entity* e in entities)
    if (e->otype == Dynamic)
        activeEntities.push_back(e);
for each (Entity* dynamicEntity in activeEntities)
{
    for each (Entity* target in entities)
    {
        if (dynamicEntity->sprite.getGlobalBounds().intersects(target->sprite.getGlobalBounds(), collisionRect) && dynamicEntity != target)
        {
            dynamicEntity->velocity = sf::Vector2f(0, 0);
            if (collisionRect.width > collisionRect.height)
            {
                if (collisionRect.contains(collisionRect.left, dynamicEntity->sprite.getPosition().y))
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x, dynamicEntity->sprite.getPosition().y + collisionRect.height);
                else
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x, dynamicEntity->sprite.getPosition().y - collisionRect.height);
            }
            else if (collisionRect.height > collisionRect.width)
            {
                if (collisionRect.contains(dynamicEntity->sprite.getPosition().x + dynamicEntity->sprite.getGlobalBounds().width - 1.f, collisionRect.top + 1.f ))
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x - collisionRect.width, dynamicEntity->sprite.getPosition().y);
                else
                    dynamicEntity->sprite.setPosition(dynamicEntity->sprite.getPosition().x + collisionRect.width, dynamicEntity->sprite.getPosition().y);
            }
        }
    }
}

EDIT: I have tried making only one call to getPosition() getSprite() etc., and that only makes it glitchier.

EDIT2: I made a gfy of the problem. Sorry for the low res.

sentences:
How are the Unreal Development Kit (UDK) and Unreal Engine 4 (UE4) related? I'm thinking of learning Unreal Engine 4, but it costs money, and I want to try and keep costs as low as possible while I'm learning. In contrast, the Unreal Development Kit is free.

How similar are the two? If I learn UDK first, how easily can I transition to UE4?

sentences:
Game physics presentation by Richard Lord, some questions I been implementing (in XNA) the examples in this physics presentation by Richard Lord where he discusses various integration techniques. Bearing in mind that I am a newcomer to game physics (and physics in general) I have some questions.

15 slides in he shows ActionScript code for a gravity example and an animation showing a bouncing ball. The ball bounces higher and higher until it is out of control. I implemented the same in C# XNA but my ball appeared to be bouncing at a constant height. The same applies to the next example where the ball bounces lower and lower.

After some experimentation I found that if I switched to a fixed timestep and then on the first iteration of Update() I set the time variable to be equal to elapsed milliseconds (16.6667) I would see the same behaviour.
Doing this essentially set the framerate, velocity and acceleration to zero for the first update and introduced errors(?) into the algorithm causing the ball's velocity to increase (or decrease) over time. I think!

My question is, does this make the integration method used poor?
Or is it demonstrating that it is poor when used with variable timestep because you can't pass in a valid value for the first lot of calculations? (because you cannot know the framerate in advance).

I will continue my research into physics but can anyone suggest a good method to get my feet wet?
I would like to experiment with variable timestep, acceleration that changes over time and probably friction. Would the Time Corrected Verlet be OK for this?

sentences:
Game Loop delay the right way and game speed I am a newbie game developer. I am trying to find a right way to create my game loop.

Consider following example.
Simple Android Game
I have a game with a simple gameplay - bouncing ball.

I want to have a control of the ball speed.
Also I want my game to have the same framerate (framespeed) on all devices.

Where the speed logic should be implemented ? In my case I have simple ball object with a velocity vector. I can change the velocity vector properties in order to make my ball move faster or slower, am I right ?
The Main Loop. I have read a lot of about this part of a game. I found this article http://gameprogrammingpatterns.com/game-loop.html . And decided to use this code example

    double previous = getCurrentTime();
    double lag = 0.0;
    while (true)
    {
    double current = getCurrentTime();
    double elapsed = current - previous;
    previous = current;
    lag += elapsed;

    processInput();

    while (lag >= MS_PER_UPDATE)
    {
    update();
    lag -= MS_PER_UPDATE;
    }
   render();
   }

I have a lot of questions about this example.

I have the similar loop in my game.

 @Override
        public void run() {
            while (mIsRunning) {
                processGameInput();
                updateGameState();
                drawGame();
            }
        }

I cannot understand while update(); is called while waiting for a constant delay ? Why not the render method ?
Maybe I am missing something.

Here is how my update for the ball looks like.

   public void updatePosition() {
        mCenterX += mVector.x;
        mCenterY += mVector.y;
    }

As you could see, each time I increase the position of the ball by the value of the velocity vector.

But as can guess, in case of using the example from the article, the update method will be called for instance 100 times. And the render method only once per 100 update method calls.
So in this case I guess, I the ball will be changing its position lagging.

My goal is to control the speed of the ball, for example from 0.1s - 2s.

How can achieve this ?

Please help to understand this topic. Any help would be highly appreciated.

sentences: What could I use to search tiles in a game I'm creating a tile based game similar to Minesweeper. When a user clicks on a tile and its not a mine or a number space I need to search and expose the adjacent tiles that are empty and stop when it hits a number or the edge of the board. I have it working right now so that it will clear the row of the tile clicked and stop at a numbered tile or the edge of the board. What I have is going to get ugly quickly and I am sure there is a easier way of doing this. Is there a searching algorithm I can use that will find all adjacent tiles to the one the player click only stopping once it hits the edge of the board or hit a numbered tile?

sentences:
Unity Content Size Fitter to large I have a content size fitter on the content within the scroll view. However the content size fitter is over double the height needed and when scolling there is a large blank space at the bottom on the content that keeps scrolling.

I have tried to change all the settings but nothing has made it shrink and fit the content.

sentences:
Libgdx sprite rotation (image quality) This one is probably really simple but I didn't find a solution.

I'm trying to create a widget (speedometer) with libgdx.
For the arrows I'm using the setRotation() function.
But when the image is rotated, the quality drops.

The result looks like this:

How can I improve the quality of the arrows?

sentences:
Displaying total playing seconds at end of game Creating a simple survival game.

When the player has been caught I want to display the amount of seconds that they survived for.

How do I go about this?

sentences:
How to replicate Unity's Rigidbody.AddForceAtPosition in C++? I am trying to replicate the function Rigidbody.AddForceAtPosition of Unity in C++, it means, to apply force to a body offset from its center.

How could I achieve that in C++?

sentences:
How to change the time dilation using C++ in Unreal Engine? I searched a bit and found a blueprint solution which does this but I've just started using Unreal and I prefer C++ instead of this visual programming thingy.

I'm looking for a Unity-like Time.timeScale property which could be easily set during runtime.

Is there a thing like that in Unreal?
I just want to play with changing the speed of time of the whole world.

sentences:
Grouped enemy movement out of sync after changing directions Im working on a Galaxian/Space Invaders Inspired game. Im working on the enemy movement and am running into an issue where the enemies get out of sync when changing direction.

My setup is that I have a global variable enemyHorizontalDirection. Its initially set to left and any time an enemy hits the left or right side of the screen its set to whatever direction the enemies should go in. While this works Im running into an issue where the enemy that triggers the global variable enemyHorizontalDirection gets out of place. Below is a video of the behavior.
http://www.youtube.com/watch?v=3kRlT9_Dt1Q&feature=youtube_gdata_player

The enemies are created from left to right from a 2d array. Each enemy is added to a List at creation. I am looping through the list end to beginning at the moment. The problem occurs on the left side. When I loop through from beginning to end the problem occurs on the right side.

Here is the enemy Update Method:

if(groupedMovement)
{
    // When hitting right side of the screen set direction to left
    if(this.x > (Futile.screen.halfWidth - GMain.instance.gameScreenOffset) - (this.width / 2))
    {
        GMain.instance.enemyHorizontalDirection = "left";
    }

    // When hitting left side of the screen set direction to right
    else if(this.x < (-Futile.screen.halfWidth + GMain.instance.gameScreenOffset) + (this.width / 2))
    {
        GMain.instance.enemyHorizontalDirection = "right";
    }

    if(GMain.instance.enemyHorizontalDirection == "left")
    {
        this.x -= 4f;
    }

    if(GMain.instance.enemyHorizontalDirection == "right")
    {
        this.x += 4f;
    }
}

Here is where I loop through the enemies and call their Update();

for(int p = _player.Count-1; p >= 0; p--)
{
    Player player = _player[p];
    player.UpdateLocalVertices();

    Rect playerRect = player.GetTextureRectRelativeToContainer();

    if(_player.Count == 0) break;

    // Handle player/enemy collisions
    for(int e = _enemies.Count-1; e >= 0; e--)
    {
        GSpriteEnemyGameObject enemy = _enemies[e];
        enemy.UpdateLocalVertices();

        if(enemy.active)
        {
            Rect enemyRect = enemy.GetTextureRectRelativeToContainer();

            if (enemyRect.CheckIntersect(playerRect))
            {
                CreateEnemyDeathEffect(enemy, true);

                enemy.RemoveFromContainer();
                _enemies.Remove(enemy);
                PlayerHit();
            }
        }

        if(enemy.y < -Futile.screen.halfHeight)
        {
            enemy.RemoveFromContainer();
            _enemies.Remove(enemy);
        }

        if (_debug) DebugLineDraw.drawHitBox(enemy, Color.red);

        enemy.Update();
    }
}

Im hoping someone can point me in the right direction. Im not sure of the exact cause of this or how to approach a fix for it.

Any help much appreciated!

sentences:
approach for the system that record player actions and imitate it I am trying to implement some kind of system, that would allow AI to imitate player's action at certain points in similar cases. Case example

Player (hp: 10, mp: 5) used skill [BasicAttack] when in battle

When I set for a bot parameters like hp: 10, mp: 5 and state attack it should use BasicAttack skill because in same case player used that action. (I'd like to have ability to define similar cases like when hp: 11, mp: 6 then bot use BasicAttack too because it is similar to hp: 10, mp: 5 case but whatever)

The question is that what are the basic approaches for such cases? Leaving aside snapshotting of player's state, how can such system be implemented?

So far I have two ideas.
My ideas are

1. order player parameters by priority and states and create tree where every node would be
corresponding parameter value. For example node with name [hp] and value [10] will have a
child note [mp] with value [5] thus I can create required paths to actions

2. I have event log with recorded player events. It keeps its record ordered. I iterate over
it and using pattern matching I compare player parameters and retrieve corresponding player
action

The first approach seems much faster though.

But I'd like to know if there already exist approaches for such systems, in order not to reinvent the wheel as I used to do. Are any?

sentences:
Sending RPC calls from server to client inside Unity In my game inside Unity, I have two scenes setup. One for the main server ( acts like authoritative server ) and the other scene for my client. The game starts once my client connects to the server.

Now I am able to send RPC function calls from my scripts in my client scene to the server but I am not able to do it the other way around.

** Further edit to my code after comments **
*********** This is my client side script attached to GameObject CursorDetection inside Scene2 *****

 using UnityEngine;
    using System.Collections;

    // ON THE CLIENT SIDE
    public class CursorDetectionScript : MonoBehaviour {

        private bool hasGameStarted = false;
        void Update()
        {
           if (Input.GetMouseButtonDown(0))
           {
              networkView.RPC("mouseDown", RPCMode.Server,true);
           }
        }

        [RPC]
        public void mouseDown(bool isMouseDown)
        {

        }

    }

**** On the server side script inside scene1 *******

private void OnPlayerConnected(NetworkPlayer player)
{
    Debug.Log(" PLAYER CONNECTED " +player);
    networkView.RPC("AddNetworkPlayer", RPCMode.AllBuffered, player);
}

[RPC]
public void AddNetworkPlayer(NetworkPlayer player)
{
    playersList.Add(player);
    Debug.Log(" FIRST PLAYER IS " + playersList[0]);
}

 if(startGame)
 {
    networkView.RPC("SendMessageToClient1", RPCMode.AllBuffered, playersList[0]);
 }

[RPC]
public void mouseDown(bool isMouseDown, NetworkMessageInfo sender)
{
    isMouseDown = true;
    Debug.Log("CAN PLACE PANELS NOW" + " VIEW IS " + sender.sender.guid);
}

**** back on the client side script inside scene2 I called the SendMessageToClient1 function call *******

[RPC]
public void SendMessageToClient1()
{
    Debug.Log(" INSIDE CLIENT 1 ");
}

sentences:
For Visual Studio Community 2017, 'Unreal Engine Installer' option is not available On Visual Studio Community Installer, I cannot find 'Unreal Engine Installer' under 'Desktop Developemtn with C++' - 'Optional'. According to the tutorials I am learning, the 'Unreal Engine Installer' should be availbl.e

I have Visual Studio installed on 'C:' and Unreal installed on 'H:'; can this be the problem?

sentences:
Need simple 3D terrain render with big texture map I have a 1000 x 700 height map

I have a 1000 x 700 texture map

I did something very similar about 8 years ago:

Using XNA. Unfortunately, when I bring up this old project and convert it to Visual Studio 2010 it will no longer compile and just throws tons of errors.

I'm looking for something very simple. Is there a 3D terrain single texture XNA example floating around out there that I can convert? I haven't touched XNA since about 2009 or 2010 and none of my old code will run anymore (I have no idea what's going on).

I need to do a 3D terrain proof of concept where the terrain texture is stretched over the height map. Nothing fancy. Maybe XNA.

Any ideas?

sentences:
How do 3d engines create frames? I wanted to start on a little project of making a simple 3d engine, but I can't seem to find anywhere how 3d engines actually make frames. (I don't mean the math behind the 3d projection). Do they use bitmaps and edit the pixels, or do they use the GPU in some way? Also is editing the pixels in a bitmap using CPU or GPU?
EDIT:

I only mean after they do the math and find each pixel value for the frame how do they display the frame? Do they change the pixels in a bitmap while rendering a scene, or do they have an array that has all the pixels color values then use the GPU do display the pixels?

sentences:
How do I load chunks of data from an assest manager during a loading screen? I'm developing an Android game.  Basically I want to pre-load all graphics/sounds when the app is first loaded.  But I also would like to show a progress bar as this is happening.  Here is a snippet of Java/Android code to display a progress bar while doing some work:

public class LoadingScreen extends Activity {

private static int progress = 0;
private ProgressBar progressBar;
private int progressStatus = 0;
private Handler handler = new Handler();

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.loadingscreen);

    progressBar = (ProgressBar) findViewById(R.id.progress);

    //---do some work in background thread---
    new Thread(new Runnable()
    {
        public void run()
        {
            while (progressStatus < 100)
            {
                progressStatus = doSomeWork();

                //---Update the progress bar---
                handler.post(new Runnable()
                {
                    public void run() {
                        progressBar.setProgress(progressStatus);
                    }
                });

            }
            //---hides the progress bar---
            handler.post(new Runnable()
            {
                public void run() {
                    progressBar.setVisibility(8);
                }
            });
        }

        private int doSomeWork()
        {
            try
            {
                //---simulate doing some work---
                Thread.sleep(50);
            } catch (InterruptedException e)
            {

            }
            return ++progress;
        }

    }).start();

}

My question is: how do I design my Asset Manager to load "chunks" of data (bitmaps and sounds/music) in the doSomeWork() function?  Would it be some sort of stack that I keep popping off the next asset to load?  How do I determine how much of the progress bar I should increment after loading a "chunk" of data?

Is there a better way to approach this or is this the correct way?

sentences: How can a game engine's renderer be visually compatible with Maya's? Say you create some model in say Maya, you apply all kinds of effect to the model and then export the file. Then the game engine has to load the file and render it, so surely the game engine needs the same renderer as Maya's to reproduce the effects created in Maya?

sentences:
Have both Cubemaps and TextureArray in a single texture register? I want to have both Point Lights, aswell as Spot Lights.
For the Point Lights I have a TextureCubeArray and for the Spot Lights I have a Texture2DArray. Is it possible to combine these two into a single Texture2DArray and treat the Point Light Shadow Maps as Cubemaps, and treat the SpotLight shadow maps as single textures?
I would like to bind only one array instead of multiple ones.

sentences:
How should I track real-time resource generation in a client-server scenario? I am currently building a game that has a "City" entity.  These cities generate and consume resources such as food variably over a period of time.  I need to be able query the server often to find exactly how much food the city at any given point.  These queries can take place  multiple times per minute.  There could also be 400,000 cities to track at a given time.

How would you handle tracking these resources?  Would you do it in real time, keeping an instance of the city in memory on the server, with some sort of a snapshot in time of the resources, then computing the growth/consumption from that snapshot time for subsequent queries?  Would you work exclusively with a database, using a similar "snapshoting" scheme?  Maybe a mixture of the 2, caching recently queried cities in memory for a period of time?

There is also a lot of other data that each city needs to track.  A player can queue units to build in a barrack.  The armies available in the city will need to be updated as units complete.

I'm interested in everyone's input on where/when/how you'd manage the real time data.

sentences: How to view 360 degree images in Unreal Engine 4 Is there any way I can view 360 degree images in UE4, Ive read about possibly mapping it onto a hollow sphere however it always seems warped. I am working on a virtual tour and would like to be able to transition between multiple 360 images such as the ones found here : http://www.wpanorama.com/panoramas.php?page=01n . I am new to Unreal Engine and any help would be greatly appreciated. Ideally I would like to have it mapped to a sky sphere with the image on the sky sphere changing based on the "point" the user clicks on however I am not sure how I could go about this.

sentences:
What level of use can I give to these third person IP based art assets? I'm making my first game (2D), and while details are irrelevant it compromises lots of spaceships in and out of the screen. They are not the main character or controllable by any means (I don't know if it makes any difference).

For the sake of variety and fun, I decided to re-create some iconic spaceships of various known series. They would compromise a small portion of the overall, less than one percent. Their addition would go in the lines of 'easter eggs' or rare sights, just to warm the fans hearts with lovely memories and enrage the ultrafans brains with conflicting date frames and galaxies far far away mixing with milky way lore.

I will implement them on the developer version of the videogame, as I assume private use is as free as air (I really make the game I'd like to play, and hell if I won't be the one that has most fun). I could implement them as an option for the public version if I was sure it was completely safe.

But considering the scenario in which I finish the game and want to fully release it.
This are some of the assets, as example: they are external designs, but I painted them pixel by pixel and generally have some little discrepancies with the canon, besides having one dimension less than they have in most of the original commercial products.

My question is:
Under what conditions can I publish them?
I would'nt claim them as original or own designs, but I am the maker(and thus, the owner) of the art asset nontheless. The fact that they are so low resolution could allow me to use them as parody work?
What if I don't want to make any money of it, and just publish the game without charge?

The simple truth is that I don't really want any problem with anybody. Nor I consider this to end up beeing of any help to my economy. But it would be nice to know if I can distribute it, and what options does it have of helping prevent starvation of one guy. Like, putting a donations button in the same web I use to distribute it, while clearly stating that the development of the game is unrelated to the donations it recives (web without ads, I know that would be considered commercial).

Thank you for your time.
(Non-native speaker, feel free to cry blood)

sentences:
HLSL : Offset and length were out of bounds //Vertex Shader Constants
float4x4 World; float4x4 View; float4x4 Projection; float4x4 WorldViewIT;

//Color Texture
texture Texture;

//Normal Texture
texture NormalMap;

//Specular Texture
texture SpecularMap;

//Albedo Sampler
sampler AlbedoSampler = sampler_state
{
    texture = <Texture>;
    MINFILTER = LINEAR;
    MAGFILTER = LINEAR;
    MIPFILTER = LINEAR;
    ADDRESSU = WRAP;
    ADDRESSV = WRAP;
};

//NormalMap Sampler
sampler NormalSampler = sampler_state
{
texture = <NormalMap>;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
};

//SpecularMap Sampler
sampler SpecularSampler = sampler_state {
texture = <SpecularMap>;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
};

//Vertex Input Structure
struct VSI {
float4 Position : POSITION0;
float3 Normal : NORMAL0;
float2 UV : TEXCOORD0;
float3 Tangent : TANGENT0;
float3 BiTangent : BINORMAL0;
};

//Vertex Output Structure
struct VSO {
float4 Position : POSITION0;
float2 UV : TEXCOORD0;
float3 Depth : TEXCOORD1;
float3x3 TBN : TEXCOORD2;
};

//Vertex Shader
VSO VS(VSI input) {
//Initialize Output
VSO output;

//Transform Position
float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);
//Pass Depth
output.Depth.x = output.Position.z;
output.Depth.y = output.Position.w;
output.Depth.z = viewPosition.z;

//Build TBN Matrix
output.TBN[0] = normalize(mul(input.Tangent, (float3x3)WorldViewIT));
output.TBN[1] = normalize(mul(input.BiTangent, (float3x3)WorldViewIT));
output.TBN[2] = normalize(mul(input.Normal, (float3x3)WorldViewIT));

//Pass UV
output.UV = input.UV;

//Return Output
return output;
}

//Pixel Output Structure
struct PSO {
float4 Albedo : COLOR0;
float4 Normals : COLOR1;
float4 Depth : COLOR2;
};

//Normal Encoding Function
half3 encode(half3 n) {
n = normalize(n);

n.xyz = 0.5f * (n.xyz + 1.0f);

return n;
}

//Normal Decoding Function
half3 decode(half4 enc) { return (2.0f * enc.xyz - 1.0f); }

 //Pixel Shader
PSO PS(VSO input) {  //Initialize Output
PSO output;

//Pass Albedo from Texture
output.Albedo = tex2D(AlbedoSampler, input.UV);
//Pass Extra - Can be whatever you want, in this case will be a Specular Value
output.Albedo.w = tex2D(SpecularSampler, input.UV).x;

//Read Normal From Texture
half3 normal = tex2D(NormalSampler, input.UV).xyz * 2.0f - 1.0f;

//Transform Normal to WorldViewSpace from TangentSpace
normal = normalize(mul(normal, input.TBN));

//Pass Encoded Normal
output.Normals.xyz = encode(normal);
//Pass this instead to disable normal mapping
//output.Normals.xyz = encode(normalize(input.TBN[2]));

 //Pass Extra - Can be whatever you want, in this case will be a Specular Value
output.Normals.w = tex2D(SpecularSampler, input.UV).y;

//Pass Depth(Screen Space, for lighting)
output.Depth = input.Depth.x / input.Depth.y;

//Pass Depth(View Space, for SSAO)
output.Depth.g = input.Depth.z;

//Return Output
return output;
}

//Technique
technique Default {
pass p0 {
    VertexShader = compile vs_3_0 VS();
    PixelShader = compile ps_3_0 PS();
}
}

This is my current shader… it is producing a "Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection" argumente axeception… I don't understand what's wrong with it….

Any help is appreciated.

sentences:
How do I get parabolic movement in Unity using Rigidbody2d? EDIT: It was the Animator after all. Apply Root Motion basically nullifies any physics based work.

I "know" this answer but I can't figure out what can possibly be wrong. My code is in FixedUpdate(). My Rigidbody2D has a Gravity Scale of 4 and a Mass of 1. For whatever reason a Gravity Scale of 1 just isn't strong enough to keep it from floating away. In the pictures below the little cubes should be marking each frame.

Using the below code I get a jagged leap movement. The object shoots upwards and falls like a feather.

if(Game.inputManager.GetKey("Jump").KeyPressed())
{
    yForce = 1000f;
    this.rigidbody2D.AddForce(Vector2.up*yForce);
}

And using another suggestion I distribute the force over a second of time.

if(Game.inputManager.GetKey("Jump").KeyPressed())
    {
        addForceTimer = 1;
        yForce = 1000f;
    }
    addForceTimer -= Time.deltaTime;
    if(addForceTimer > 0)
    {
        this.rigidbody2D.AddForce(Vector2.up*yForce* Time.deltaTime*4);

    }

And I get a more desirable but still just as wrong movement where there is no hang at the top of the jump.

From what I thought I knew neither of these should be happening at all. The object shouldn't be falling at a constant speed like it is. Does anybody have any suggestions?

The character is animated if that can possibly have some sort of effect but I don't imagine it would.

sentences:
Querying game objects in real-time I'm thinking about working on a game where I need to find all the objects matching certain properties.

For instances I might need to look up all the objects...

Producing gold.
Whose level is 5 or higher.
Within 10 meter from a point.
Currently fighting.
That have anything to do with metal (e.g. producing, consuming, made of, wearing, standing on etc).

And so on and so forth. I would also like to be able to add new objects with new properties without having to change everything else.

Ideally I would need to run multiple queries per frame (hundreds or thousands per second). I'll probably rely on some properties way more than others, but this kind of usage pattern is likely to change over time.

Is there any data structure, design pattern, method or idea to help me implement an efficient real-time query system?

I've been thinking about assigning to each object a dynamic set of tags with properties, then recursively partition the space storing in each partition a mapping from those tags to the objects. It might work, but I'd like to hear about existing solutions before wasting efforts.

sentences:
How to make an object with its own sprite draw an additional sprite on top of itself I'm making character select buttons for a Game Maker Studio 2 game, hoping to do so by just having a single object I can edit on an individual basis to change which character it represents. I also want the button itself to display the sprite of the character it's meant to represent like an image overlaying the button's own sprite. I can't seem to get a clear, direct answer on how this is done.

To sum up:

Character select button is an object with its own assigned sprite.
Each individual button object holds (a reference to) a corresponding character object the player may select by clicking that specific button.
Button object should be able to check the sprite of the character object it references, and draw it on top of its own sprite without replacing it entirely.

If anyone can help show me how to do that last part- or barring that, perhaps point me toward a better way to achieve a similar effect, it would be appreciated.

sentences:
Add a "fake" Loading Screen I'm working on a 2D game for WPF8 using XNA 4.0.

Everything goes great, but it's too fast. I was just wondering, what could I do between the end of the game and the score screen, and before the game starts? I'm looking for a sample of how to do that (black screen with "loading" write in windows phone style) or a way to implement it.

sentences:
Why is Metal is rendering textures SLIGHTLY darker than they should be? I already checked this question. Using [MTKTextureLoader.Option.SRGB : false] in texture loader options doesn't work. All that happens is when I do [MTKTextureLoader.Option.SRGB : true], it's a lot darker instead of slightly darker. There must be something else. Here is an example of this unwanted behavior.

As you can see I am using the mouse to hold the original packed ice texture over the rendered one. It's considerably lighter, even with [MTKTextureLoader.Option.SRGB : false].

Here is my fragment function:

fragment half4 TextureFragment(VertexOut VertexIn [[stage_in]], texture2d<float> Texture [[texture(0)]]) {
    constexpr sampler ColorSampler(mip_filter::nearest, mag_filter::nearest, min_filter::nearest);
    float4 Color = Texture.sample(ColorSampler, VertexIn.TexCoord.xy / VertexIn.TexCoord.z);
    return half4(Color.r, Color.g, Color.b, 1);
}

How can I fix the problem? How can I render the actual texture instead of a darker version?

Note: I must fix the problem, not work around it. A workaround would be like return half4(Color.r, Color.g, Color.b, 1); from the fragment shader. I must fix the problem from the root.

sentences:
Sound effects in separate thread? Does it make sense to carry out all audio (music, sound effects, etc.) in a separate thread?

In your experience, how large would you expect the performance impact of playing some MP3 music and 10-30 sound effects to be?

Could performance be an issue with starting to play many different sound effects (e.g. in the same frame)?

sentences:
Rotate sprite direction Cocos2d I want that my sprite go always forward, and you can only control his direction moving right and left (on 360 degrees). I don't know why, but the movement it's senseless.

The constants to move and rotate:

const int POD_DEGRE_MOVE = 5;
const int POD_STEP_MOVE = 3;

The sprite initalization:

_dragonSprite->setPosition(Point(visibleSize.width / 2,_dragonSprite->getContentSize().height * 0.75));
addChild(_dragonSprite, 2);

The event key listener:

void GameScene::onKeyPressed(EventKeyboard::KeyCode keyCode, Event *event){
    _pressedKey = keyCode;

    switch (_pressedKey) {

    case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
        giro = -POD_DEGRE_MOVE;
        _isMoving = true;
        break;
    case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
        giro = POD_DEGRE_MOVE;
        _isMoving = true;
        break;

    }

}
    void GameScene::onKeyReleased(EventKeyboard::KeyCode keyCode, Event *event){
        if (_pressedKey == keyCode) {
            _pressedKey = EventKeyboard::KeyCode::KEY_NONE;
            _isMoving = false;
            giro = 0;
        }
    }

And the calculations of the new direction:

void GameScene::update(float dt) {

    _dragonSprite->setRotation(_dragonSprite->getRotation() + giro);
    _podVector = Vec2(cos(_dragonSprite->getRotation()) * POD_STEP_MOVE, sin(_dragonSprite->getRotation()) * POD_STEP_MOVE);
    Vec2 newPos = Vec2(_dragonSprite->getPosition().x + _podVector.x, _dragonSprite->getPosition().y + _podVector.y);

_dragonSprite->setPosition(newPos);
}

Another problem is that the sprite at the start moves to the right (because Cos(0)==1), so I rotate the image of the sprite 90 degrees to the right, to then rotate it again at the initialization 90 to the left so the sprite is in the right position and his start angle is 90 (sin(90)==1), but the angle is not 90, and it moves as he wishes.

The last problem I have with this is that when I press a key (right or left), the sprite stops, rotates, and starts again (a direction that is not the direction where the sprite is aiming, that's the main problem). The sprite shouldn't stop while you are moving it.

Can anyone help me?

sentences:
switch between player camera/non-camera positioning Sorry if this sounds ambiguous. But I am writing a traditional top down game.
And normally the player would be centered in the middle while moving the orthographic camera. However, I would like this to be dynamic. Therefore, use player.setPosition(x,y) near screen boundaries but center on player if its far from screen boundary.

This is some sample code:

public void centerCamOnPlayer() {
         camera.position.set(player.getX() + (player.sprite.getOriginX()),
                             player.getY() + (player.sprite.getOriginY()),
                             0);
}

public void update() {
     boolean shouldCenterOnChar = ???;
     if (shouldCenterOnChar) {
         centerCamOnPlayer();
     } else {
         player.setPosition(x,y);
     }
}

Therefore render will call update(). However how do I determine the shouldCenterOnChar?
I tried using frustum.pointInFrustum but its only when the sprite moves completely out of screen. I'm sure there is a better way to switch dynamically. Any one has an idea? Tks!

sentences:
Why don't I see tile-based 3D graphics? As we know, tiles can make it quicker to update large portions of the display at once, as compared with a bitmap. To put, say a letter, on the screen, the Commodore 64 typically does two writes (the screencode and the attribute), but the ZX Spectrum typically does 9 (eight bytes which make up an 8x8 bitmap, plus 1 for the attribute).

Recently, a demo for the SEGA Genesis was released called Red Eyes. My understanding is that the 3D scenes were rendered on a PC, and some kind of program converted these animations to a tileset so that each frame can quickly be written into VRAM.

But, however hard I search I cannot find any contemporaneous games for these retro systems which use a tileset to render (an approximation of) three-dimensional graphics. So is there a technical reason for that?

The nature of this question is such that it could be answered in the following ways:

It wouldn't work because ...
You obviously weren't looking hard enough because here's an example of a game that does that. Here's a disassembly or source code so you can figure out how it worked
It might be possible, but you'd have to watch out for ...

sentences:
Normal Matrix in plain English I'm into shader language with Webgl and GLSL.
I've seen some tutorial about normal matrix and I don't really understand it.
I mean, I think I'm ok with the math such as:

modelViewMatrix = mat4.multiply(camera.view, modelMatrix);
inverseModelViewMatrix = mat4.invert(this.modelViewMatrix);
normalMatrix = mat3.fromMat4(inverseModelViewMatrix);
normalMatrix = mat3.transpose(this.normalMatrix);

But why do I need it? Where can I find a case where I can see the difference between using it and not using it? Ot when do I don't need it?

sentences: background animation algorithm for single screen I’m writing simple strategy game (in xna), and would like to have an animated background. In my game all the actions happens inside one screen and thus standard parallax effect does not look appropriate. However, I found a video of a game with suitable background animation for my game http://www.youtube.com/watch?v=Vcxdbjulf90&feature=share&list=PLEEF9ABAB913946E6 (from 3 to 6s, while main character stays at the same place). What is the algorithm to do this stuff? It would be nice if someone can provide a reference for a similar example (language is not important).

sentences:
What's the correct way to move 2d sprites in opengl 2.1? I'm getting into Opengl 2.1 and wanted to know how can I move 2d sprites.
I already created my vbo and ibo, and the vertex data is already there. But, how can I move a sprite once it's already drawn?

Should I update the vertex data with glBufferSubData(I don't think that's efficient), or whould I use glTranslate3f? If I use glTranslate I move all the sprites in the screen.

Any help appreciated, thanks!

sentences:
Rotate a rigid body not around its centre of mass I have a rigid body (a boat) whose centre of mass is towards the front of the object. However, this makes the rotation look strange as the rudder that is turning the object is at the back of the boat so the rotation would be around that point.

How can I rotate the object from the a separate point (using forces) without changing the centre of mass?

Applying a force at a location still causes the object to rotate around the centre. In real life, you need to pin down the point that you want to rotate around, forcing the object to rotate around that point.

This would suggest using constraints but I can't figure out how that would work. You sort of need the rotation point to act as a hinge, but when I apply a suitable constraint, but that would just block the rotation rather than convert it into a rotation around the new point.

I want to resolve this using physics driven operations in Unreal Engine 4.

I don't want to move the Centre of Mass, admittedly for not a particularly good reason, but this still feels like a valid question even if that was an option - what if you want to rotate around two different points.

sentences:
Rendering tiles on 3/4 perspective Using a 3/4th perspective, I'm trying to create a way to render cliffs where nothing is overlapped, and it creates an accurate representation of the elevation.
This is a rough mockup of how it might look in-game:

The way the tile data is organized is by layer. Each elevation has a layer class which holds all of the ground data for that specific layer, and all unoccupied space is simply null in the array.
I can't seem to come up with a way to render the data so it would look something like this. I've thought about rendering from highest to lowest elevation, the other way around, etc. All entailed a situation where something is getting overlapped that shouldn't be.

What's the best way to do this?

sentences:
Deferred rendering: camera inside point light's sphere of effect I'm trying out deferred rendering and I'm using the tutorials at http://ogldev.atspace.co.uk. I've got the basics working and I'm currently trying to implement the final step from tutorial 37 (http://ogldev.atspace.co.uk/www/tutorial37/tutorial37.html). In the previous tutorial, the author explains how to render point lights as spheres in a second render pass, combing the effect of the lights with the data generated in the geometry buffers in the first pass, and I've got this working already.

In tutorial 37, he explains how to use the stencil buffer to limit the influence of the lighting to only light up objects actually inside the light sphere. He describes how the stencil buffer is set up to decrease the stencil value when the depth test fails for front facing polygons and increase it for back facing polygons, resulting in the stencil buffer containing zeroes for all pixels belonging to objects outside the light sphere (as these will either be in front of the light sphere, leading to the depth test failing both for the front facing and the back facing polygons of the lights sphere, causing the stencil value to first decrease by one and then increase by one, or behind it, leading to neither front facing nor back facing polygons of the light sphere failing the test so the stencil value remains unchanged). Objects inside the sphere though cause the depth test to fail only for back facing polygons, leading to the stencil value being not zero. This will later be used to only render the light sphere on pixels for which the stencil value is not zero.

So far, so good. But then there is a remark saying that the case when the camera is inside the light sphere is left as an exercise for the reader, and this comment puzzles me. Won't it still work the same way? If the camera is inside the light sphere, then objects in front of the light sphere will not be rendered at all (since they are behind the camera). Objects behind it will still not cause the depth test to fail for the back facing polygons of the light sphere (and the front facing polygons will of course not be rendered) so the stencil values for those pixels will still be zero. As for objects inside the light sphere, the depth test for the back facing polygons will fail, causing the stencil value to be different from zero. It seems to me that no special consideration will need to be taken for the case when the camera is inside the light sphere, but maybe I'm missing something. Can someone please help me figure this out?

sentences: SDL for 3D game programming? I have been studying SDL for a few weeks and I have succeeded in making a 2D Ping-Pong game, but  I want to get started in 3D development, and I'd like to know if SDL is capable (and suitable) for 3D game development, or I must use OpenGL?

sentences:
Unity WheelJoint2D will not rotate when increasing motor speed I have a wheel joint 2D attached to a game object in Unity:

In its associated wheel script I am increasing the motor speed as described in the tutorial.

public class Wheel : MonoBehaviour
{
    WheelJoint2D wheel;
    JointMotor2D motor;

    void Start()
    {
        wheel = GetComponent<WheelJoint2D>();
        motor = wheel.motor;
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.RightArrow))
            motor.motorSpeed += 10;

        if (Input.GetKey(KeyCode.LeftArrow))
            motor.motorSpeed -= 10;

        //Debug.Log(motor.motorSpeed);
    }
}

The problem is that the sprite does not rotate and I am not certain as to why?

Does the wheel joint have to be attached to another rigid body in order to function?

sentences:
Mobile game without game engine I am planning on making a 2D mobile game for iOS and Android. It will have animations (including some simple flash/light and particle effects, like in Candy Crush), but the only physics the game will need is hit-detection between 2 circles, and dragging a sprite across the screen. And the game isn't very complicated. Since these would be easy to implement on my own, I'm considering using the native iOS/Android SDKs for this (on Xamarin), with no game engine.

Is this a good or bad idea? Would avoiding using game engines, and using the native SDKs (on Xamarin) improve the performance of my game? Wouldn't fixing bugs become easier (in some odd cases) since both platforms are separated into different builds/code? Looking at games like Candy Crush, I don't see any physics involved and so believe that a game engine isn't even needed for a game like that. Any advice/suggestions would be appreciated.

sentences:
Creating Level iPhone I am thinking about a new game idea for the iPhone and presumably all the levels would have to be made programatically. So Im wondering what the best method to approach it?

Say I have a game with a standard typical 2d, top down maze. Thise maze is simply made up of walls, multiple rectangles on screen, making paths.

Do I have to manually work out the position of every rectangle and put it in with an x and y position or is there a better way? I see this taking, forever, there must be certain ways developers approach these situations to get by them efficiently and quickly surely?

Thanks.

sentences:
LIBGDX - Artifacts when scaling background image I've got a problem with libgdx.

First off, im working with libgdx and box2d on a little physics game.

Im using the aproach mentioned in this answer and thereby setting my camera to some smallish numbers and it worked out fine so far.

Now I've ran into following problem.
When drawing my background (1920x1080) I am experiencing artifacts ingame and I am not sure where they are coming from.

I tried linear and nearest Filtering on the Texture with no differing results and I scale the image once via

beachSprite.setScale(camera.viewportWidth/Gdx.graphics.getWidth(), camera.viewportHeight/Gdx.graphics.getHeight());

This is what the background image looks when opening it With a regular image viewer:

And this is what it looks like ingame:

Oddly enough, there seem to appear no artifacts with smaller images, like the player character, or they are just too small to notice.

Thanks in advance for any help.

sentences:
Ogre3D: customize water demo On the water demo supplied with Ogre3D's SDK, controls are set to actually control the camera and environment, but not actually the ogre head that generates the disturbances. I tried digging into the SDK code but couldn't find the actual pieces of code that allow customization of the controls (keyboard input). Maybe that's coming from the SampleBrowser application?

I intend to use that demo to generate the same Pygame/OpenGL water ripple effect I seek here: Pygame water ripple effect with the added benefit of the 3D engine. This is also targetted at a multitouch library that tries to stay away from Flash in support of harder reverse-engineering of the output binaries.

Bottom line, my question is, where are the keyboard controls bound to the scene on Ogre's SDK Water Demo? I am just starting in C/C++.

sentences:
What can be a game-play element in a game with Shakespeare's plays as the main theme? I was thinking of learning about making games, so I thought of an idea about making a game on a play, since the content is already there. I actually found well parsed XMLs of Shakespeare's plays. I thought of a few rather simple game-play elements, but none seem fun. I thought of a 'word shooter' but it wouldn't be much fun since there are so many speech lines. Then I thought of a game where you have to match which of the characters currently on the screen said a particular dialog.

I know that this game probably will not be much fun, but I could try to make it fun.
What I may be able to do right now is make an application which 'enacts' the whole play. You can skip right to any act or a scene in an act etc.
It will be a 2d game and i will use pygame.

sentences:
How can I set the attribute index location? I am trying to set up a shader which takes three input parameters. I have the following code:

GLuint vert = glCreateShader(GL_VERTEX_SHADER);
GLuint frag = glCreateShader(GL_FRAGMENT_SHADER);
const GLchar* vertsrc = src.vertex.c_str();
const GLchar* fragsrc = src.fragment.c_str();
glShaderSource(vert, 1, &vertsrc, NULL);
glShaderSource(frag, 1, &fragsrc, NULL);
glCompileShader(vert);
glCompileShader(frag);
GLuint program = glCreateProgram();
glAttachShader(program, vert);
glAttachShader(program, frag);

glBindAttribLocation(program, 0, "position");
if (glGetError() != GL_NO_ERROR) ...
glBindAttribLocation(program, 1, "normal");
if (glGetError() != GL_NO_ERROR) ...
glBindAttribLocation(program, 2, "texcoord");
if (glGetError() != GL_NO_ERROR) ...

glLinkProgram(program);
//...check linking errors

auto p = glGetAttribLocation(program, "position");
auto n = glGetAttribLocation(program, "normal");
auto t = glGetAttribLocation(program, "texcoord");

GL_MAX_VERTEX_ATTRIBS is 16. I don't understand why, after this code executes, the values I get from glGetAttribLocation are as follows:

p = 0
n = -1
t = -1

Needless to say, I am unable to pass anything beyond vertex attrib array no. 0 to my shader. What am I doing wrong?

sentences:
Method subscribed to an event is called twice for every time the event is raised I am trying to make an inventory system in Unity with ScriptableObjects and a text driver that displays the contents of an inventory. So far the code looks like this:
-An InventoryObject is defined as having a "Container" List of ItemObjects (simple scriptable objects, they just have a little information on the object as its sprite, its name, and whether or not it is stackable) and some methods to properly add or remove items (taking item stacking into account) from that list. https://pastebin.com/t4P3aGmi
-A PlayerInventory is a script that will be carried by the player's character. It contains a method for adding items collided with to its assigned InventoryObject instance. It also contains an OnItemPickedUp event that takes its InventoryObject instance as a parameter and passes it to listeners like UpdateDisplay. OnItemPickedUp is raised whenever a collision with a compatible item happens. https://pastebin.com/RsV7XYPp
-An UpdateDisplay script that listens to the OnItemPickedUp event and subscribes the
ProcessInventoryToSingleString(InventoryObject _inventory) method, that subsequently calls several methods to transform the contents of the InventoryObject's Container list into a single, formatted string. https://pastebin.com/N0nsvcWH
-The items are represented by giving a GameObject with a collider2D, aSpriteRenderer and script that contains the particular ItemObject's data and sets its SpriteRenderer's sprite to the ItemObject's.
The problem I'm having is that the method subscribed to the event is being called more than once for each time the event is raised. as shown by the debug logs. Sometimes it's called twice, sometimes even four. This results in my UI display showing more items than there are.
https://files.catbox.moe/afa467.mp4
https://files.catbox.moe/6oxh9b.mp4
Here are pictures of the console debug logs:

I appreciate any help.
EDIT: These errors also appear. I'd like to believe that they're unrelated.

sentences: Should I rotate the Camera using the View or World? I have an issue with roll/rotation. I have a Camera defined to move along X and Y axis at a given Z for zoom. The camera is always pointed straight down the Z axis so there is not any yaw or pitch. I do however need to roll or rotate. The problem I have is that when I roll/rotate left or right I am modifying up in the view. So, when the mouse or keyboard are moved up toward the top, the target actually moves toward the new up. If I rotate 90 right degrees when I move mouse up or arrow up it moves right. I fully understand why it is behaving this way. I need to find a way to make it not behave that way. I need to roll/rotate independent of x, y. My first thought is to use the view when moving camera along x and y. Then rotate the target (1-9 quads) in the world space. Any thoughts on this? Any Examples would help and would be greatly appreciated.

sentences:
How can I get Steam username and avatar image from leaderboard? After I downloaded leaderboard data (using the Steamworks.NET API), I couldn't find any related info about the user's name and the avatar picture. The only thing I can get is a CSteamID.
I saw some games implement a Steam Leaderboard, displaying their name and avatar images, and I'm trying to achieve the same thing. However, I've searched on the Steamworks documentation and on Google for almost a day, but couldn't find any related information.
The only thing I found was an API with SteamFriends, there were some API's that retrieved the user's name and avatar image.
Here's the code I'm trying:
private CallResult<LeaderboardScoresDownloaded_t> m_DownloadResult = new CallResult<LeaderboardScoresDownloaded_t>();

...

SteamAPICall_t hSteamAPICall = SteamUserStats.DownloadLeaderboardEntries(
    m_CurrentLeaderboard,
    ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobalAroundUser,
    -4,
    5
);
m_DownloadResult.Set(hSteamAPICall, OnLeaderboardDownloadScore);

...

void OnLeaderboardDownloadScore(LeaderboardScoresDownloaded_t pCallback, bool failure) {
    Debug.Log("Failure: " + failure);

    if (!failure) {
        int count = pCallback.m_cEntryCount;

        for (int i = 0; i < count; i++) {
            LeaderboardEntry_t leaderboardEntry;

            SteamUserStats.GetDownloadedLeaderboardEntry(
                pCallback.m_hSteamLeaderboardEntries,
                i,
                out leaderboardEntry,
                null,
            0);

            CSteamID user = leaderboardEntry.m_steamIDUser;

            Debug.Log("Rank" + i);
            Debug.Log("User Name: " + leaderboardEntry.    // how to get user name and avatar?
            Debug.Log(leaderboardEntry.m_nScore);

            Debug.Log("===========================");
        }
    }
}

In LeaderboardEntry, I can only get the score and CSteamID. In SteamUser and SteamUserStat classes, there was no API that can get the user's name and avatar image.

sentences:
Unity UI making it responsive I am attempting to create a simple Jeopardy game using the UI features of Unity:

However as im trying to change the size of the screen it does not seem that my UI is responsive:

Here is it in 16:9:

Here it is in 600x900

My Question is. is there a way to make it responsive?

Is it even nessary to do so in unity or am i thinking way to much web based? :)

Hope someone is able to help me and guide me abit

sentences: Gameobject with Canvas child (Unwanted inspector behavior) When I try to focus (by double clicking or pressing f) on gameobjects in my scene which have a Canvas as a child, the scene view zooms out to show the Canvas. I would like to be able to see the gameobjects themselves when focusing on them. Is there a way to do this?

sentences:
Toggle action for gamepad triggers, whilst being held down I'm doing a small fighting game project, as up now every button command in my map code is occupied with their designated functions. All except the triggers; as up now they only have their basic "press n hold" actions assigned; "sidestep" for the [LT] and "jump/fly" for the [RT].

However there are still two more actions that I would like to implement to the triggers "if possible"; they being, "Block" for the [LT] and "Fly up" for the [RT].

That being said, is it possible to somehow, add a "tap toggle action" to the triggers while they're still being held? If yes please let me know.

For Tom Tsagk: Yes, I'm trying to cause an event while holding down a button "this case a trigger", but 'not' by pressing another button for the execution, "since every other button is occupied doing something else".

What I'm trying to attempt is: when holding a trigger down, to be able to give small "taps" to the trigger without the need let go.

sentences:
How much to modify yaw? XNA 4.0 Heres a picture that explains better than my words can

For rotating an object I'm using quaternions.
    CreateFromAxisAngle(vector3.Right,yaw)

Maybe this isn't how I should be doing it but I also keep my yaw as radians that
are always between 0 and 360;more or less than 0 or 360 puts it at 0 or 360 respectively.

(object is build up of vertices and indices)

I can rotate it no problem. Move it all about.
But what I really want to do is to find how much I should alter the
yaw so that the my models right vector will sync up with the line
I can draw between the objects center and the camera's position(y is always 0).

Which I guess is the problem now, but long term I am trying to find how I modify the yaw to match any direction.

Say I am travelling Left, I may want to rotate my yaw so that my objects forward is also left.

I have been researching here and elsewhere and there seem to be solutions, I just can't wrap my head around any. Maybe someone could help shed some light?

sentences:
C# Unity - Multiplying Colors in loop results in wrong results Good day, I'm trying to generate a tilemap, my current setup is a base tileset, and a few overlays for the different biomes / terrain heights. In my code, I generate each biome's tileset, based off of the base tileset, multiplied by the biome's overlay. However, as you can see in he image, it's reusing the first biome's overlay for all biomes.

Preview of result

Base Tileset

Overlays

Here's my code:

        for (int i = 0; i < biomes.Length; i++)
        {
            StatusText.text = "Generating Biome["+i+"] Tileset...";
            biomes[i].TileSet = new Sprite[_tileSet.Length]; // Creates the sprite array for the tileset of biome [i].
            Color[] b = biomes[i].Overlay.texture.GetPixels(); // Gets biome[i] overlay in a color array.
            for (int x = 0; x < _tileSet.Length; x++)
            {
                Debug.Log(biomes[i].Name);
                Debug.Log(biomes[i].Overlay);
                Color[] a = _tileSet[x].GetPixels(); // Get's base tile [x] in tileset pixels.
                for (int j = 0; j < a.Length; j++)
                {
                    a[j] *= b[j]; // Multiplies each pixel of the copy of base tile in the new color array with the overlay of biome[i].
                }
                Texture2D tex = new Texture2D(8, 8);
                tex.SetPixels(a);
                tex.filterMode = FilterMode.Point;
                tex.Apply();

                biomes[i].TileSet[x] = Sprite.Create(tex, new Rect(0, 0, 8, 8), new Vector2(4, 4), 8); // Creates sprite from generated texture.
            }
        }

sentences:
removing triangle artifacts from overlapping height maps OpenGL I have two 100x100 height maps that I am drawing using a triangle mesh. One represents the land height, and the other represents (water + land) height.

I currently draw both meshes on top of each other, and I make the water mesh transparent when the water level is 0.

But where the land meets the water there are lots of artifacts.

I believe the cause is the water mesh is >= the height of the land mesh so at the edges the water mesh height goes from being > land mesh height to == , the visible slope is actually the water mesh slope and not the land mesh slope.

That said, I don't know any good way to fix it.

Note: water level may not be flat so replacing the water mesh with a plane wont work

sentences:
Why do I get these "Invalid command android" errors trying to build for Android in Unity? Trying to move a unity project over to android using gradle as the build system. I get the following 3 errors:

Error:Invalid command android

CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]
exit code: 64
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
UnityEditor.HostView:OnGUI()

and

Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/java -Xmx2048M -Dcom.android.sdkmanager.toolsdir="/Users/joeljohnson/Library/Android/sdk/tools" -Dfile.encoding=UTF8 -jar "/Applications/Unity/PlaybackEngines/AndroidPlayer/Tools/sdktools.jar" -

stderr[
Error:Invalid command android
]
stdout[

]

It turns out a lot of people have been having this problem and the most common solution is to move to an earlier version of the apk. When I tried that, I still received the same three errors. I moved down to api level 23 from the most current. I am one a mac.
    exit code: 64

sentences:
What is the state of the art in procedural character animations? I'm a programmer and I'm interested in programmatic character animation — walking or running, bipedal or many-legged: what is the state of the art today?

I heard about NaturalMotion's Euphoria system and Ubisoft's IK Rig, and they look amazing. Where can I find more info about similar algorithms?

sentences:
List to hold copies of a prefab for later deletion I'm working on a game in which obstacles are Instantiated randomly 5 to 20 units ahead of the player.

When they are instantiated, I want to add them to a list so that when there are too many obstacles loaded in the game, it will remove them from the list and then delete them from the game.

I'm having trouble adding them to the list, because using obstacleList.Add(Obstacles.name); doesn't work.

Here's my code:

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

public class Generate : MonoBehaviour{

    //player position
    public Transform Player;

    // The prefab for an obstacle
    public GameObject Obstacle;

    // Holds float distance from 0 for each obstacle that is instantiated
    private float nextObstacle = 30;

    // is supposed to hold the names of all active instances of the obstacle prefab
    List<string> obstacleList = new List<string>(10);

    void FixedUpdate()
    {
        //Checks to see if the player is colser than 30 units to the most recently spawned obstacle
        if (nextObstacle - Player.position.x < 30)
        {
            //Generates a new obstacle
            GenerateObstacle();
        }
    }

    void GenerateObstacle()
    {
        // Randomly assignes a number for horizontal and vertical Transform
        int randH = Random.Range(5, 20);
        int randV = Random.Range(1, 3);

        //Instantiates an obstacle using those random values
        Instantiate(Obstacle, new Vector3(nextObstacle + randH, randV, 0), Quaternion.identity);

        //Makes that obstacle the new distance so a new obstacle can be spawned
        nextObstacle += randH;

        // Is supposed to add the name of the obstacle that was Instantiated to a list
        obstacleList.Add(Obstacle.name);

        //checks when list has more than 10 items in it
        if (obstacleList.Count > 10)
        {
            DeleteObstacles();
            // Removes the first item from the list
            obstacleList.RemoveAt(0);
        }
    }
    void DeleteObstacles()
    {
        // Supposed to destroy the copied prefab
        Destroy(Obstacle);
    }
}

sentences:
2D layerDepth not working XNA 4.0 I'm struggling with getting the depth layer to work properly.  No matter what I do, the line is drawn over the top of the circle texture.

public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Begin(
            SpriteSortMode.BackToFront,
            BlendState.AlphaBlend,
            null,
            null,
            null,
            null,
            Camera.getTranslation());

        // Draw all planets
        foreach (PlanetNode p in planets)
        {
            p.Draw(spriteBatch);
        }

        spriteBatch.End();
    }

PlanetNode's Draw:

public void Draw(SpriteBatch spriteBatch)
{
    // Draw forwarding line
    if (resourceForward)
    {
        double dist = Math.Sqrt(Math.Pow(location.X - forwardTo.location.X, 2) +
                                Math.Pow(location.Y - forwardTo.location.Y, 2));
        float angle = Utility.GetAngle(location, forwardTo.location);
        spriteBatch.Draw(Textures.BlackPixel, new Rectangle((int)location.X, (int)location.Y, (int)dist, 1), null, Color.Black, angle, Vector2.Zero, SpriteEffects.None, 0.9f);
    }

    // Draw Planet
    if (mouseOver)
    {
        Color c = new Color(color.R + 0.2f, color.G + 0.2f, color.B + 0.2f);
        spriteBatch.Draw(Textures.Planet, position, null, c, 0f, texOrigin, SpriteEffects.None, 0.5f);
    }
    else
        spriteBatch.Draw(Textures.Planet, position, null, color, 0f, texOrigin, SpriteEffects.None, 0.5f);

    // Draw overlay text
    Vector2 size = Textures.TextFont.MeasureString(resources.ToString());
    spriteBatch.DrawString(Textures.TextFont, resources.ToString(), new Vector2(position.X - size.X / 2, position.Y - size.Y / 2), Color.Black);
}

sentences:
Merging multiple image with DirectX D3DImage best approach? I'm currently rendering up to 6 images (7440 x 7440) together via a series of colorizing shaders (one each image) and then merging shaders (5 to merge colorizer result). I'm not getting the performance I would expect. I'm using D3DImage to render into a WPF application. The rendering is appearing to be very slow. However, the shaders are rendering in .005 secs each. This is currently rendered on one quad...

Is it better to flush between image and merge or send on flush at the end?

Are C# for loop slowing it do? The benchmarks are not showing that but...

Also I use the colorize shader to change color in near real time the UI locks up...

Windows 7 I know is limited to 1 device. Windows 10 I know support multiple instances of devices... is there a way to use that capability? is it worth it?

Here is the kicker I will need to eventually do this on 20 quads.

Thank you in advance!

sentences:
Unity: Water shader vertex offset - how to add mesh collider which updates with vertex offset? I have written a shader (in the new LWRP shader graph) which simulates an ocean with vertices which offset to create a moving "waves" effect.

I believe that in order to have objects "float" on my moving waves, I shall need to create a mesh collider which is a trigger (please correct me if I'm wrong) which updates with the moving vertices of the mesh as per direction from the shader.

How is such an effect possible? Am I taking the correct approach here? Please advise :)

Many thanks in advance!!

(the original model for the water is a plane which has been subdivided multiple times to provide suitable resolution for the vertices to be offset)

sentences:
Audio Clip not working on Collision when destroying an object So I made a game where you shoot a laser and if it hits the enemy it makes an explosion sound and destroys the enemy. The only thing is whenever I try to get the audio to play it doesn't which I assume is caused by the enemy being destroyed. I have tried to use the Play() methods and PlayOneShot() methods but they both don't seem to help me out.

This is my current code:

public AudioClip explosion;
public AudioSource explosionAudioSource;

public void OnTriggerEnter2D(Collider2D other)
    {

    void Start() {
    explosionAudioSource = GetComponent<AudioSource>();
    }
        if (this.tag == "Enemy" && other.tag == "Laser")
        {
            explosionAudioSource.PlayOneShot(explosion);
            Destroy(other.gameObject);
            Instantiate(enemyExplosion, new Vector3(transform.position.x, transform.position.y, transform.position.z), Quaternion.identity);
            Destroy(this.gameObject);
            uiManager.UpdateScore();
        }

Thanks!

sentences:
What continuous integration technology is used for games? Which continuous integration technology & software would you recommend for use with games?

Also are there any build technology libraries or specific languages you would recommend to use when a custom part of the game asset pipeline needs to be coded in-house?

Are there any good resources for demonstrating the business case for using continuous and automated build systems for games?

sentences:
How do I make my foreground tiles stand out more from the background? (the background implemented in the game)

In the game that I work on, the background and the map tiles are pretty indistinguishable for new players, probably because they have similar colors and theme.

Are there any tips or tricks to make the background more like a background and be distinguishable from the map tiles?

The game has motion blur which kinda helps, when the player is running the background gets blurry therefore making it more distinguishable from the map tiles.
However, that is clearly not enough.

Any suggestions, tips or tricks will be greatly appreciated!

(purely the background)

EDIT: Thank you for the suggestions and the ideas! here are some variations of this background that I came with.

(darker and way more blurry)

(dawn colors and some blur)

(one of the coolest things I've done + blur)

(one of the coolest things combined with dawn colors + blur)

sentences:
Unity : Objects become black when size is changed to smaller While working with Unity 5.4, my models become black when I resize them to a smaller scale. When I make the models bigger they are fine. I am using a directional light . On the image below as you can see on the left the model is fine. But the others are black.

HOPE YOU CAN HELP.

sentences:
How can I name and organize resources at design time? I'm having a very hard time trying to figure out a good way to add new resources to my game project in a way that's convenient for designers.

To try and better understand the problem, I'm trying to create a very simple game.  It's in the style of an old text adventure.  The user begins in a room, and at the start of each turn an image of the room is displayed and some text describing the room is printed.  Then several options are shown (in a multiple choice format).  The user picks one and option and the result of the action is printed to the screen.  Then the turn ends and the next turn begins (the new image and description are shown, more options are printed, etc).

This game will require several resources:
    - String tables (to hold the text)
    - Images (Shown in each room)
    - Places (links to the image and description, as well as the list of options)
    - New Game Scenerio (used to initialize game.  Just tells the user where the starting room is)

I would like to create an editor where designers can just start it up and then start adding and editing rooms.

The straight forward approach would be to create a simple, stand alone editor that can load and save independent Place files.  It would use relative file paths to locate the linked images and string tables.  These Place file format would be XML which would later be compiled to a binary form when the final resource archive containing all resources is compiled.

The trouble with using paths, though, is that if you rename and move files (as you likely will as the project get larger), the paths that point to it will break (at well as any relative paths it points to itself).

Relative paths can also be a problem if you need to refer to resources that are in a completely different branch off the root.  For example, let's say I have the following resources in my project:

/item/MagicWand.xml
/place/grassyPlain/castle/DarkTower.xml

If I want to place a MagicWand in my DarkTower, I'd have to use a relative path that looks something like "../../../item/MagicWand.xml".  That's pretty cumbersome.  It would be nicer to use something like "item.MagicWand".

Also, since these resources are going to be compiled, if I need to refer to them from my scripts I will need something to call them.  If my user is in the DarkTower and selects the option "go to the griffon pen", I'm like to be able to do this with code similar to

getUser().setLocation("place.grassyPlain.castle.GriffonPen");

All this suggests importing my resources into some sort of super editor project that knows how to handle all resources and provides names for them (and even provide interactive editors for some of them).  While this would simplify the naming problem, but would be a lot of work - especially if more than one person need to design resources at the same time.  (for multiple users, I'd need a database-like locking mechanism to make sure multiple people weren't renaming things or working on the same file at the same time).  The whole thing would have a look and feel that calls to mind the Flash editor.

My thinking keeps leaning toward this super-duper editor solution, since I've been exposed to tools like this before.  However, this seems like a lot of work, especially for so simple a project.  I can't help but think that I'm over thinking this.  I would like to have a system for managing my game's resource that is simple yet, flexible and which integrates well with my code/scripts.

Does anyone have any thought on what makes a good resource managment/naming system?

sentences:
How can I convert 3D mesh to SDF? Previously, I found an useful article that explained how to convert 3d mesh to SDF easily.

  I want our artists to be able to easily convert from polygonal data to SDFs with little-to-no effort.

  http://colourmath.com/2018/development/signed-distance-fields-in-unity/

this article is what I want but unfortunately there wasn't simple Implemention.

there is algorithm in this article:

foreach (pixel in texture)
    foreach (triangle in mesh)
         get pixel center as mesh bounds position
         get closest point on triangle
         calculate distance from pixel position to triangle
         keep the smallest distance
         perform a raycast along arbitrary vector against triangle
         if(raycast intersects triangle)
            increment an intersection counter
    if(number of intersections is even)
        pixel value is positive // outside mesh
    else
        pixel value is negative // inside mesh

I like to Implement this article but I can't understand above algorithm and I don't know how can I convert 3D mesh to SDF data and then sotre this data to 3D RenderTexture?

sentences:
'Destroyed Actors' and 'Save Games' Background

Our team is creating an adventure platformer, and I have been tasked with creating a Save Game system.

Our game features the usual progression systems, and is relatively linear.

Approach

I have began my approach by using the EMS Easy Multi-Save plugin for Unreal.

Problem

We have a 'Switch' system:

Player takes cube to switch.
cube gets used by switch
switch can now be activated.

In stage 2, where the cube is used by the switch - the actor for the cube is destroyed in Unreal, and the switch's model is changed to one with a switch.

The EMS plugin does not provide plug-and-play functionality for keeping track of destroyed actors, which means I must do this myself.

Example problem scenario

Player approaches area with switch and cube.
Player saves game (cube present and switch deactivated)
Player picks up cube and takes to switch (cube destroyed and switch activated)
Player loads prior save game
Scene reloads with switch in the correct state, however the cube is no longer present (it has been destroyed by Unreal and is no longer tracked by EMS)

Problem solving approach

Reading around, I have been given the idea of creating my own class that keeps track of destroyed actors when they are destroyed.

This class can be saved by EMS, and then can reload these destroyed actors if needed when a game is loaded.

Question

There is a lack of real advice for the task at hand here, so I wanted to come here and ask for people's advice and opinions on the best approach to making Destroyed Actors within Unreal compatible with Save Games.

sentences:
Building a unified interface for a swap chain in both DirectX 12 and Vulkan Most objects in DirectX 12 have natural analogues in Vulkan, e.g.

VkInstance = IDXGIFactory
VkPhysicalDevice = IDXGIAdapter
VkDevice = ID3D12Device
VkQueue = ID3D12CommandQueue
VkCommandBuffer = ID3D12CommandList

However, when it comes to the swap chain, it's not clear how the entries in VkSwapchainCreateInfoKHR correspond to entries in DXGI_SWAP_CHAIN_DESC1.
Clearly, there is not always a 1-1 correspondence, but I would really like to know how I can implement a unified interface for both.

sentences:
How can I deploy and unreal engine windows exe build to the cloud? I don’t have a coding background, so I am struggling with this. Someone will have to dumb down a lot of the language for me.

I’m trying to deploy my unreal engine game to a cloud computing service using the .exe file I built. I would like to do this in order to maintain the maximum quality of the game and have multiple users access the game simultaneously by a hyperlink. I don’t need the users interacting with each other. I was able to get this to work with x.io but that service is kind of limited. I also messed around with AWS but all of that was too confusing for me. Please let me know if the community can guide me.

sentences: What Collider should I use for my Player object? I am making a 3rd person game with a simple orbit cam and it works fine most of the time, but since I have a box collider and I walk across an uneven surface, the player tends to tip over. How should I set it up so the player would not tip over anymore?

sentences:
How can I scale by time a canvas scaler > scaler factor float value from 0.01 to 1? The minimum is 0.01f the maximum I want it to be is 1
I want that when I start a Coroutine to be able to decide the time it will take to change the value to 1 and also the direction if from 0.01 to 1 or from 1 to 0.01
I tried this :
if (buttonType == "LoadGame")
        {
            StartCoroutine(DisplaySavedGamesWindow(5f, true));
        }

And
IEnumerator DisplaySavedGamesWindow(float time, bool direction)
    {
        float scaler = GameObject.Find("Save Slots").GetComponent<CanvasScaler>().scaleFactor;

        float currentTime = 0;
        while (currentTime < time)
        {
            scaler = currentTime / time;
            currentTime += Time.deltaTime;

            yield return null;
        }
    }

I used a break point on the line :
scaler = currentTime / time;

I see that scaler is changing up to 1 or to 0.9 ot sure why it's not getting to 1
And also it's not changing the value to 0.9 or to 1 in the editor in the scale factor it's still 0.01
Also how to use the bool flag ? true should be from 0.01 to 1 and false from 1 to 0.01
Ok I managed to make it working to be changed up from 0.01 to 1 :
IEnumerator DisplaySavedGamesWindow(float time, bool direction)
    {
        float currentTime = 0;
        while (currentTime < time)
        {
            var scaler = currentTime / time;
            GameObject.Find("Save Slots").GetComponent<CanvasScaler>().scaleFactor = scaler;
            currentTime += Time.deltaTime;

            yield return null;
        }
    }

The problem now is that when it's changing the value from the script the result is gray.
This is how it looks like when I'm changing it to 1 in the editor :
You can see the blue scroll view on the left :

but when it's changing the value from the script the result is gray scroll view and not blue like before :

sentences:
For Vertex Buffer Steaming, Multiple glBufferSubData VS Orphaning? I was learning OpenGL recently.
In games, we need to update the position of game objects frequently, and they will come in & out of screen constantly. So it means in rendering we need to update the vertex buffer quite often as well.

In OpenGL's context, one intuitive way is to use glBufferSubData to update those that changed.

But I also read online a trick called Orphaning that creates a new buffer data and upload the whole vertices data to it.

Also due to state chagnes cost and uploading cost, multiple glBufferSubData may also cost more.

Here is my question,

Which method is better?
Is stalls really matters in this case?
Is state changes and uploading cost really matters in this case?

Thanks!

sentences:
Frame-rate drops when drawing 2D map tiles Update: I figured out it has nothing to do with the camera but instead framerate drops when drawing my map tiles onto the screen.

Here’s a link to a video showcasing the bug in action (For further reference): https://streamable.com/m4zuf3
Any and all guidance is appreciated, thanks.
Here's the draw functions:
    protected override void Draw(GameTime gameTime)
    {
        m_mainLevel.Draw(spriteBatch);
    }

        public void Draw(SpriteBatch sb)
        {
            //Draw Background
            for (var i = 0; i < BackgroundTiles.Length; i++)
            {
                int id = BackgroundTiles[i].m_id;

                int column = id % TilesetTilesWide;
                int row = (int)Math.Floor((double)id / (double)TilesetTilesWide);

                int width = Map.TileWidth * 2;
                int height = Map.TileWidth * 2;

                float x = (i % Map.Width) * width;
                float y = (float)Math.Floor(i / (double)Map.Width) * height;

                Rectangle tilesetRec = new Rectangle(TileWidth * column, TileHeight * row, TileWidth, TileHeight);
                Rectangle dest = new Rectangle((int)x, (int)y, width, height);
                sb.Draw(Tileset, dest, tilesetRec, Color.White);
            }
        }

Is the problem that I'm drawing too many tiles per frame? the map size is 250 x 250 tiles, with each tile being 16x16px.

sentences: How do I make something I flash/blink more frequently as it gets closer to disappearing? In my game when you kill an enemy they may drop something like a health pack or gold.  I want this to have a time limit so that it eventually disappears if you don't pick it up.  I want the item to flash more frequently the closer the drop gets to "death".  How do you do the "more frequently flashing" algorithm?

sentences:
Server Side Movement Box2D LibGDX I am trying to implement server-side movement using box2d on libgdx client and planck-js(box2d for javascript)  on nodejs server.
I am running box2d world on both client and server.

Before server i was moving player on client with applying force on input

player.body.applyForce( Vector2(-4.5f, 0f), player.body.worldCenter, true)

Now from client to server i am just sending input data and applying force on server side:

Client if left key pressed:

 var inputData:JSONObject = JSONObject()

            inputData.put("type", "left");
            inputData.put("x", player.body.worldCenter.x);
            inputData.put("y", player.body.worldCenter.y);
            socket.emit("inputFired",inputData)

So server gets this data and applies force code to move player on server side.

    var movePlayer = find_playerid(this.id);
    if (!movePlayer) {
        console.log('player does not exist');
        return;
    }
      console.log(data)
      var positionVector = Vec2(data.x,data.y)
      if(data.type =="left"){
        var impulseVector = Vec2(-4.5,0.0)

      }else if(data.type =="right"){
        var impulseVector = Vec2(4.5,0.0)

      }else if(data.type=="up"){
        var impulseVector = Vec2(0.0,4.5)

      }else if(data.type=="down"){
        var impulseVector = Vec2(0.0,-4.5)

      }
  movePlayer.body.applyForce(impulseVector,positionVector,true)
      movePlayer.x = movePlayer.body.getPosition().x
      movePlayer.y = movePlayer.body.getPosition().y
      console.log("new position")

After this point what is confusing me is what should i really return to client ? If i just return position values of body after applying force,how im gonna position client side body according to this ?

sentences: Unreal Engine Physics creation is slower in Editor I just figured out that when UPrimitiveComponent::CreatePhysicsState() is called, it calculates the mass, but only in editor, also when i build for non-editor it is faster (standalone) this is not because the editor is eating up resources, because time is measured in code. Why is the mass only calculated in editor?

sentences:
Sharpdx DirectX11 MapSubresource is failing trying to map a staging texture I'm trying to render to a texture and then pull the image data out.  I've created one texture as a render target and another as a staging texture.  After rendering to the render target, I use CopyResource to copy from the render target texture to the staging texture.  So far, so good.  However, when I use DeviceContext.MapSubresource to get the data from the staging texture, I get E_INVALIDARGS exception, and I can't figure out why.

Here is how I create the staging texture:

        textureDesc = new Texture2DDescription()
        {
            ArraySize = 1,
            BindFlags = BindFlags.None,
            CpuAccessFlags = CpuAccessFlags.Read,
            Format = Format.B8G8R8A8_UNorm,
            Height = 256,
            MipLevels = 1,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Staging,
            Width = 256
        };
        _renderStaging = new Texture2D(_dev, textureDesc);

Here is how I populate the staging texture and then try to map it:

            DataStream stream;
            _con.CopyResource(_renderTarget, _renderStaging);
            // The following is the line that fails
            box = _con.MapSubresource(_renderStaging, 0, MapMode.Read, MapFlags.None, out stream);

I have the same code working in C++, so I know I have the general idea right.  This is the working C++ code:

textureDesc.Width = 256;
textureDesc.Height = 256;
textureDesc.MipLevels = 1;
textureDesc.ArraySize = 1;
textureDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
textureDesc.SampleDesc.Count = 1;
textureDesc.MiscFlags = 0;
textureDesc.Usage = D3D11_USAGE_STAGING;
textureDesc.BindFlags = 0;
textureDesc.CPUAccessFlags = D3D10_CPU_ACCESS_READ;
hr = dev->CreateTexture2D(&textureDesc, NULL, &renderStagingTexture);

devcon->CopyResource(renderStagingTexture, renderTargetTextureMap);
D3D11_MAPPED_SUBRESOURCE mappedResource;
devcon->Map(renderStagingTexture, 0, D3D11_MAP_READ, 0, &mappedResource);

sentences:
How to Make Objects Fall Faster in a Physics Simulation I used the collision physics (i.e. Box2d, Physics Body Editor) and implemented onto the java code. I'm trying to make the fall speed higher according to the examples:

It falls slower if light object (i.e. feather).
It falls faster depending on the object (i.e. pebble, rock, car).

I decided to double its falling speed for more excitement. I tried adding the mass but the speed of falling is constant instead of gaining more speed. check my code that something I put under input processor's touchUp() return method under same roof of the class that implements InputProcessor and Screen:

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button)
{
    // TODO Touch Up Event

    if(is_Next_Fruit_Touched)
    {
        BodyEditorLoader Fruit_Loader = new BodyEditorLoader(Gdx.files.internal("Shape_Physics/Fruity Physics.json"));

        Fruit_BD.type = BodyType.DynamicBody;
        Fruit_BD.position.set(x, y);

        FixtureDef Fruit_FD = new FixtureDef(); // --> Allows you to make the object's physics.
        Fruit_FD.density = 1.0f;
        Fruit_FD.friction = 0.7f;
        Fruit_FD.restitution = 0.2f;

        MassData mass = new MassData();
        mass.mass = 5f;

        Fruit_Body[n] = world.createBody(Fruit_BD);
        Fruit_Body[n].setActive(true); // --> Let your dragon fall.
        Fruit_Body[n].setMassData(mass);
        Fruit_Body[n].setGravityScale(1.0f);

        System.out.println("Eggs... " + n);

        Fruit_Loader.attachFixture(Fruit_Body[n], Body, Fruit_FD, Fruit_IMG.getWidth());
        Fruit_Origin = Fruit_Loader.getOrigin(Body, Fruit_IMG.getWidth()).cpy();

        is_Next_Fruit_Touched = false;
        up = y;
        Gdx.app.log("Initial Y-coordinate", "Y at " + up);

        //Once it's touched, the next fruit will set to drag.
        if(n < 50)
        {
            n++;

        }else{

            System.exit(0);

        }
    }

    return true;
}

And take note, at show() method , the view size from the camera is at 720x1280:

    camera_1 = new OrthographicCamera();
    camera_1.viewportHeight = 1280;
    camera_1.viewportWidth = 720;
    camera_1.position.set(camera_1.viewportWidth * 0.5f, camera_1.viewportHeight * 0.5f, 0f);
    camera_1.update();

I know it's a good idea to add weight to make the falling object falls faster once I released the finger from the touchUp() after I picked the object from the upper right of the screen but the speed remains either constant or slow. How can I solve this? Can you help?

sentences:
Unity polymorphism in editor through a list So I have an ItemDatabase class which basically only has a list of Item

public class ItemDatabase : MonoBehaviour {
    public List<Item> Items = new List<Item>();
}

The Item class looks as follows:

[System.Serializable]
public class Item {

    public string Name;
    public int Id;
    public string Description;

    public Texture2D Icon;
}

Now I have some item types deriving from the Item class, for example Consumable

[System.Serializable]
public class Consumable : Item {
    public int Resore;
}

I next created a gameobject (empty) in my editor and hooked up my ItemDatabase to that object, providing a number of items in the list is no problem but I would like to make sure that - from my editor - I can choose a type of Item to put into the list, as of now, it only lets my add Item and not Consumable because it is a list of Item.

Can I also force the editor not to accept just Item by making it an abstract class?

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

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

sentences:
Most efficient way to hide out of bounds object in tile based environment I am working on a desktop game in C#, with Monogame framework. I am storing the tile instances in a 2D Array, for the sake of easy collision detection. But the levels are big (often 100x100 or bigger) and there are lots of tiles out of the screen bounds all the time which I should not draw. At the moment I'm running through the arrays and checking whether they are in the screen bounds or outside, but that may not be too efficient due to the big count of the tiles.

Is there any better way to hide out of bounds tiles?

sentences:
Why are textures always square powers of two? What if they aren't? Why are the resolution of textures in games always a power of two (128x128, 256x256, 512x512, 1024x1024, etc.)? Wouldn't it be smart to save on the game's file size and make the texture exactly fit the UV unwrapped model?

What would happen if there was a texture that was not a power of two?

Would it be incorrect to have a texture be something like 256x512, or 512x1024? Or would this cause the problems that non-power-of-two textures may cause?

sentences:
C# XNA: Effecient mesh building algorithm for voxel based terrain ("top" outside layer only, non-destructible) To put this bluntly, for non-destructible/non-constructible voxel style terrain, are generated meshes handled much better than instancing? Is there another method to achieve millions of visible quad faces per scene with ease? If generated meshes per chunk is the way to go, what kind of algorithm might I want to use based on only EVER needing the outer layer rendered?

I'm using 3D Perlin Noise for terrain generation (for overhangs/caves/etc). The layout is fantastic, but even for around 20k visible faces, it's quite slow using instancing (whether it's one big draw call or multiple smaller chunks). I've simplified it to the point of removing non-visible cubes and only having the top faces of my cube-like terrain be rendered, but with 20k quad instances, it's still pretty sluggish (30fps on my machine).

My goal is for the world to be made using quite small cubes. Where multiple games (IE: Minecraft) have the player 1x1 cube in width/length and 2 high, I'm shooting for 6x6 width/length and 9 high. With a lot of advantages as far as gameplay goes, it also means I could quite easily have a single scene with millions of truly visible quads.

So, I have been trying to look into changing my method from instancing to mesh generation on a chunk by chunk basis. Do video cards handle this type of processing better than separate quads/cubes through instancing? What kind of existing algorithms should I be looking into?

I've seen references to marching cubes a few times now, but I haven't spent much time investigating it since I don't know if it's the better route for my situation or not.

I'm also starting to doubt my need of using 3D Perlin noise for terrain generation since I won't want the kind of depth it would seem best at. I just like the idea of overhangs and occasional cave-like structures, but could find no better 'surface only' algorithms to cover that. If anyone has any better suggestions there, feel free to throw them at me too.

Thanks,
Mythics

sentences:
Aim at moving target (or predicting target's position at time it takes for projectile to hit it) I have a game where I know the location and velocity of my target. I know my own location and the speed of my projectile. I want to determine either

the location of the intersection between my projectile fired and the target, or

the time taken for my projectile to intersect the target

All entities are travelling with constant speed and direction which makes life easier. I have been trying to work out the maths for some time but cannot quite get it right. I know that the predicted location of the target intersecting the projectile will be

Pp = Tp + Tv * t

Where Pp is the predicted position, Tp is the current target position, Tv is the target velocity, and t is time.

I also know that

t = |Pp - Sp| / Bs

where Sp is my (source) position and Fs is the projectile (bullet) speed. But I cannot figure out a way to solve this to get either Pp or t.

I know that all speeds are constant. I am free to aim in any direction and I know that the projectile is faster than the target therefore a hit is guaranteed

Can anyone enlighten me? Thanks

I found a website detailing one method but this doesnt seem to work (http://howlingmoonsoftware.com/wordpress/leading-a-target/). My verification method to determine if it worked was to use the predicted position to determine the time for the target to reach it, and for the projectile to reach it. These should be very similar but in my game they are out by almost a factor of 2.

sentences:
Using a Vertex Buffer and DrawUserIndexedPrimitives? Let's say I have a large but static world and only a single moving object on said world.

To increase performance I wish to use a vertex and index buffer for the static part of the world.

I set them up and they work fine however if I throw in another draw call to DrawUserIndexedPrimitives (to draw my one single moving object) after the call to DrawIndexedPrimitives, it will error out saying a valid vertex buffer must be set.

I can only assume the DrawUserIndexedPrimitive call destroyed/replaced the vertex buffer I set. In order to get around this I must call device.SetVertexBuffer(vertexBuffer) every frame. Something tells me that isn't correct as that kind of defeats the point of a buffer?

To shed some light, the large vertex buffer is the final merged mesh of many repeated cubes (think Minecraft) which I manually create to reduce the amount of vertices/indexes needed (for example two connected cubes become one cuboid, the connecting faces are cut out), and also the amount of matrix translations (as it would suck to do one per cube). The moving objects would be other items in the world which are dynamic and not fixed to the block grid, so things like the NPCs who move constantly.

How do I go about handling the large static world but also allowing objects to freely move about?

sentences:
How to control the list of items on the screen? I am an experienced app developer (c#) however I am just looking at starting 2d game development.

I have read some articles and understand the concept of the gaming loop controlling the application flow. However there seems few articles explaining general concepts for an existing developer. From these I assuming that each on screen item becomes it's own object and handles it's own location, drawing, collision detection etc. (though correct me if I am wrong)

My question is how to control the list of items on the screen? Are these stored in a simple collection and then removed as they fall out of play and is this collection held by the game engine or individual components? An example would be bullets from a gun?

sentences:
How much a scene would be done in 3D modelling program before exporting? What I am trying to work out is, when creating a level, or section of a level, how much is created in the modeling package before it is exported, take the scene in the link. Would this whole scene be created in Max first, if so what is the point of a level editor, where does that come into play.

Basically how are levels made, how much of a whole level, or section of a level is created in the modeling software, how can multiple people work on the same level at once, what is the relationship of a level editor to modeling package like 3ds max?

I would be using Unreal 4 and 3ds Max.

sentences:
What resolution should I render art for a 3D game for PC? I hope this is not too stupid a question. I'm making my first game for PC and I'm wondering what resolution I should render the artwork at. It will be a fixed-perspective game, so I'm using a 2D background with 3D characters moving around.

How big should I render the background? Is 1920x1080 enough these days or should I go even higher? How big should the character textures be?

Thanks a lot!

sentences:
Game programming course materials: What should it include? I am tasked to create the course materials for a game programming class, and I’d like your opinion on what aspects and areas of game programming, such as game state management, game object storing or simple AI, should I include in it? The course is intented to be the first step into game programming for students with novice skills in programming.

There will be mathematics as well, but I found that there are multiple questions, with good answers, on that subject already.

sentences:
Monogame - How to correct “brightness-additivity” while using Alpha-Blend-State When using

GraphicsDevice.BlendState = BlendState.AlphaBlend;

in monogame

following happens:

Is there any avaible method to keep the color brightness everywhere the same regardless of an overlap?

sentences:
Room Detection on a Tilemap I am working on a 2D top-down game inspired by Prison Architect.
What I just can't wrap my head around is recognizing rooms built by the player.

The game is built on a tilemap, meaning the map is always a rectangle, while the rooms can be of any shape. I'd like to be able to detect whenever walls & doors create a new wall, like in the example below.

Since I have no formal education in CS (yet), I can't think of any algorithm or class of algorithms that might be of use here and also can't figure out one by myself. So if you have any ideas, suggestions or resources, I'd be very thankful!

In case this is relevant, I am using a custom implementation of a tilemap using Monogame, a reimplementation of XNA and Nez.

sentences:
XNA Rotation results in a pixelated image I have a "problem" with XNA 4 and spriteBatch. When I draw a rectangle and rotate it, the sides get quite pixelated and look bad: example:

What do I need to do to make the edges look smooth?

spriteBatch.Draw(box, new Rectangle(350, 350, 100, 100), null, Color.Red,MathHelper.ToRadians(65), new Vector2(50, 50), SpriteEffects.None, 0.0F);

EDIT: Found the solution.

As Tetrad's comment suggested, one needs to activate anti-aliasing. Under XNA4.0 you can use this code

GraphicsDeviceManager graphics;
graphics.PreferMultiSampling = true;
graphics.ApplyChanges();

sentences:
Shot em up! Vertical or Horizontal "side scrolling"? Question it’s about "Shot em up" style game (For example: Tyrian) also known as Top-Down shooters.
These games in the past mostly exist as top down concept, it means player object can move from the left to the right and enemies start appearing from the top of the screen and moving down to the screen.
This concept was probably picked due to the monitors aspect ratios in the past where was most spreaded 4:5.
Also this concept are very popular on mobile phones, because is sometimes more user friendly not using landscape mode when playing.
There was a very little titles, when the concept Top-Down are changed Right-left It means, player object is on left screen side and moving Top and Down, and the enemies moving from right to the left.  Also, there is almost no titles on desktops when current aspect ratios are mostly 16:9. Even if some new “Modern” Shot em up is released, mostly pick the Top Down concept.
And my question is, is there any reason for that on Desktops target platform?
I think for the current monitor aspect ratios 16:9 “Right-Left” better fit the gameplay and user experience. Or Am I missing something?

sentences: Mesh vs LineRenderer Performance I've created a script, which is drawing a line along a bezier curve, so that I can animate whatever I want with lines, mostly for UI purposes. For the moment I'm using a line renderer, which works, but the performance is not that great in my opinion. So I was wondering if there are actually some better methods to draw lines, like simply creating a mesh along the path I've got.

sentences:
Rotation ascending into infinity? I'm creating a rotation for my sun to move, however it quickly extends to Infinity before going into NaN. I thought that taking advantage of the Matrix4f would make this much easier but it does as previously stated. Ideally should have the sun rotate around the sunCenter. Why is it doing this and how would I fix it?

private Vector3f getSunPosition() {
    double rotation = (time / DAY_LENGTH) * 360;
    Matrix4f matrix = new Matrix4f();

    Vector3f pos = sun.getPosition();
    matrix.m03 = pos.x;
    matrix.m13 = pos.y;
    matrix.m23 = pos.z;

    Matrix4f.rotate((float) Math.toRadians(rotation), sunCenter, matrix, matrix);

    return new Vector3f(matrix.m03, matrix.m13, matrix.m23);
}

I had it print out the Vector3f and rotation. The rotation looks a bit odd at first, however I can fix that another time.

Vector3f[1.0, 1.0, 1.0] 0.0
Vector3f[288375.56, 0.18377686, 287549.88] 79.41000366210938
Vector3f[1.96323607E11, -125296.0, 1.96323607E11] 158.82000732421875
Vector3f[1.05730567E17, 0.0, 1.05730567E17] 238.23001098632812
Vector3f[5.5935644E22, 0.0, 5.5935644E22] 240.02999877929688
Vector3f[2.9050322E28, 0.0, 2.9050322E28] 241.8300018310547
Vector3f[1.4801178E34, 0.0, 1.4801178E34] 243.6300048828125
Vector3f[Infinity, 0.0, Infinity] 243.8400115966797
Vector3f[Infinity, NaN, Infinity] 244.04998779296875
Vector3f[NaN, NaN, NaN] 244.25999450683594
Vector3f[NaN, NaN, NaN] 244.41000366210938
Vector3f[NaN, NaN, NaN] 244.55999755859375

sentences: Pseudo 3D Track editor Does anyone know of a pseudo 3D track editor ? I now need one to design my stages, as manually trying to create segments, and position static and movable objects would be too time consuming.

sentences:
Does the protagonist's age matter in a 3rd person shooter? There have been very young characters in modern games that wield weapons including firearms before. Two good examples include Ellie from The Last of Us, and Clementine from The Walking Dead. Whilst I don't support the idea of having gun wielding children as characters, I do understand the context of use in the above two examples and the points being made.

I am designing the concepts of a 3rd person action game. The protagonist is a modern male adolescent (about 13 years old) and their age is important because the game's design is centred around the idea of growth and having the protagonist learn and achieve milestones through the game's progression. Being an action game there is combat and weapons including firearms. What I would like to know is, is there particular considerations I need to take with the issue of having firearms and a very young protagonist? At the moment the gameplay progression has the protagonist starting of as completely unarmed, having to initially rely solely on hand to hand combat and other stealth and platformer based skills to progress and learn new abilities. I would like to make more weapons and eventually firearms available to the protagonist, but have their use be completely up to the player and not a necessity for game progression. Most importantly I would like to make sure that the finished game does not come across as promoting the underage use of guns.

So is the protagonist age an important consideration in this type of game genre, or not? For example would I need to make sure I include a tutorial scene where the protagonist is taught how to fire a gun by an adult?

sentences:
Porting a SFML game to the browser? I've been messing around with SFML, it's my first experience with C++ and I'm enjoying it. But I'm wondering how to publish my game onto anything other than a native platform. Noting that this is my first time dealing with porting and C++, could anyone explain this to me as if I'm 5?

Thanks in advance.

sentences:
I add a straight big plane over terrain(3d). Vibrations are happening when i move camera I have this problem in my OpenGL project but i will show you the same thing over blender3d with video. So I believe that I will better explain the problem. it is just 30 seconds. Take a look.  Youtube LINK
How can i fix these problem ?

sentences:
Server List for a game I'm making a c++ multiplayer game, and I'm trying to implement a server list, where everyone can host his own server. But I don't know how to start, I've google'd for a while and I didn't find anything about this. I tried to search for a master server specially designed to handle with the server list, so if I refresh it, it will ask the master how many servers it has, and tell the client the servers' informations, and I don't have any idea on how I could make it.

Could you just show me an example, or tell me how could I begin?

Any help is really appreciated.

sentences:
Unity - DontDestroyOnLoad - FindObjectsOfType(GetType()).Length is always returning 1 I'm trying to have an object with the DontDestroyOnLoad property. I want an object with NetworkIdentity to persist across scenes, so I can have a holder script for RPCs.

This answer suggests the following code:

public void Awake()
{
    DontDestroyOnLoad(this);

    if (FindObjectsOfType(GetType()).Length > 1)
    {
        Destroy(gameObject);
    }
}

Despite this, I still end up with duplicate objects. FindObjectsOfType(GetType()).Length is always returning 1, and I don't know why, or how to fix it. It makes no difference whether this object is a prefab instance or a simple object in the hierarchy.

I have also tried to clone this object in my NetworkManager script, which is automatically persistent, but GameObject.Find("ObjectNameHere(Clone)") is always returning false. However, the above solution seems simpler so I'd prefer to figure out  FindObjectsOfType(GetType()).Length.

sentences:
Projector does only affect model I'm working on a simple selection of a RTS unit. Therefore I used a projector to display a circle on the ground around the unit.
But it happened, that the circle is only displayed on the head of the unit-placeholder, not on the ground.

At first I thought it has something to do with the terrain, but as I added a Plane there was'nt a change.

I followed the steps from this tutorial: http://hyunkell.com/blog/rts-style-unit-selection-in-unity-5/ (skipped the drag box part)

Here's a screenshot from the scene:

I'm wondering how I can solve this. I'll provide every information you'll need.

sentences: Unsure how to decide ray intersection interval I'm coding an intersection algorithm with AABB, as found here. However, I'm absolutely unsure what to pass in as t0 and t1. The paper states that it's a ray intersection interval, but the only material I've been able to find on this is that it's some kind of guess or bound as to the final values. Any suggestions as to how to define t0 and t1?

sentences: Why do unidentified items seem to solely exist in roguelikes? Playing a variety of games I noticed that some concepts are "trapped" in the realm of roguelikes. One of the most intriguing game-play elements in roguelikes is the unidentified item. The unidentified item can be used at any time adding another layer of randomness and chance to the game-play. I think the reason this element cannot co-exist with a saving mechanic is that you could save, use the item and then load if you are unhappy with the results. I am still puzzled if this mechanic is overlooked and it could possibly be successfully incorporated into some modern games? If you do know of examples where it is being used, please share.

sentences:
Randomly generating the hallways between a network of rooms So here's my base map:

(It won't necessarily be 5x5, just using this as an example.)

It's kinda boring the way it is with all the rooms connected. I want it to be more of a randomly generated labyrinth, where every room is accessible like so:

I've tried setting the hallways randomly:

foreach(Room r)
{
    r.northWall = randomBoolean();
    r.southWall = randomBoolean();
    r.eastWall = randomBoolean();
    r.westWall = randomBoolean();
}

But that almost always ends up with rooms that you're unable to go to, like this:

And often some rooms have no hallways at all. I tried saying each room must have a minimum of 2 hallways, but it still doesn't fix the problem that sometimes there an inaccessible areas.

How should I go about doing this? I'm not too worried about the speed, as long as it's not ridiculously slow (Some levels will have 100+ rooms).

sentences:
How do you spawn a component from a class in UE4? Background
I'm working on a shooter game at the moment and I'm trying to spawn an Actor Component for the weapon currently in use, in order to have less Actors to keep track of.
The problem with this is that I can't easily switch out components on the fly, without making a separate function for each weapon.

Question
Is there currently any way to spawn a component with blueprints from a class like you would do with an Actor?

sentences:
Place an UI Image between two 2D sprites in Unity I am developing a 2D game with Unity.

I have two sprite objects rendered using SpriteRenderer.

With the new UI system, I want to use it to display an image between my two sprites. That is, my first sprite has a sorting order of 100, then my UI Image has a sorting order of 200 and then my second sprite has a sorting order of 300.

Is that possible?

I tried using sorting layers, but no matter what, the UI image seems to always overlay my two sprites.

sentences:
How do I disable the graphical output of Quake 3? I have been working with the Quake 3 source code for a few weeks now and am in the process of integrating a custom bot as part of my M.S. thesis. I am using a machine learning algorithm to allow the bot to improve over time; however, for testing purposes I would like to disable the graphics out and load up a bot vs. bot match which can play out at a faster speed.

Has anyone done this before or can anyone recommend somewhere to read? I know I have seen this done before, but I have not seen any code examples. I have also heard there may be some 3rd party utilities that will allow you to disable graphics arbitrarily on any application. As a note, I am working with this on Windows if that makes a difference.

sentences: How to convert -1 to 1 coordinate back to screen coordinates? Here is a question in which Questioner asks how to convert world coordinates to 1 to -1 coordinates like Opengl, I want to know how to do that in reverse, that given a coordinates between 1 and -1 (both x and y axis), how can i change it back to screen coordinates. i.e if my width and height is 1000, and given a coordinate (0,0), how can i change it to 500, 500, So that i can render it.

sentences:
Android game to iOS, go with an engine? I have developed a game on android using native coding. However I am being asked to port it to ios.

So I thought that I should bite the bullet and recode it in unity so I can go cross platform.

I am just upset that I have to recode everything in unity. Is there any other way or tool that at least will make me use half of my code or so thing?
Basically what would you do.

Ps:I don't even know unity but I heard learning it is easy

sentences: Easiest way to create a 2d game in Java? I would like to create a 2d game in Java, but tutorials online for game libraries such as LWJGL are usually filled with errors once I compile the project. Most people do not explain very well, and just go on very quickly. Can someone please provide me a couple examples with source code, and somewhere to have a starting point? I used to have trouble with making a GUI and you guys helped me through, hopefully you can do the same again!

sentences:
how to make coins explode out of monster in phaser? I am trying to make coins explode out of a monster when it is killed.
the explode would be similar to this example: http://phaser.io/examples/v2/particles/diamond-burst

I also want the coins to be clicked individually similar to this example:
http://phaser.io/examples/v2/groups/call-all-input

I am confused as to how to incorporate the two above examples together. Is emitting particles the way to go? I am also confused as to how to set each coin to have a different value depending on the monster.

Any help is appreciated.

sentences:
Xna - How do you use large animations for a menu In the main menu of my game I have several animations that pause in specific frames.

I made the sprite sheets for the different layers, but then I found out that the sprite sheet has to be smaller than 2048 pixels. My sprite sheet is 14400 pixels with 18 frames...

How can I play these large animations? I tried video playback but I couldn't find a way to do this...

sentences:
Drawing circles at the background of a 3D scene and updating their size So, here is what I am trying to do in Unity 5 (using C#). I want to draw a a 2D circle at the background of a 3D scene and apply a texture/image to fill it.

Just like it would be if the circle was in the GUI, but now being always behind everything else instead of always in front (think of a moon in the sky of a piloting game, or a distant planet in a space game, etc).

What would be the fastest way to draw such a circle and, of course, update its radius depending on the camera distance? Of course, I don't want to use a sphere, I want to learn how to that with a simple circle that gets bigger or smaller depending on the distance of the viewer.

sentences: Rushing water in Unity How would I go about creating a river with rushing water?  I can do the texture around it but I'm stuck on the actual water part.  This is in Unity3D.

sentences:
Transform matrix hierarchy issue I'm trying to implement a parent child relationship between Sprites and draw them to the screen. I'm calculating transforms by chaining transform matrices.

I'm using code from here:

    private void Draw(Texture2D texture, Matrix transform)
    {
        Vector2 p, s;
        float r;
        DecomposeMatrix(ref transform, out p, out r, out s);
        spriteBatch.Draw(texture, p, null, Color.White, r, new Vector2(texture.Width / 2, texture.Height / 2), s, SpriteEffects.None, 0.0f);
    }

    private static Matrix GetMatrix(Vector2 position, Vector2 scale, float rotation)
    {
        return Matrix.CreateScale(scale.X, scale.Y, 1f) * Matrix.CreateRotationZ(rotation) * Matrix.CreateTranslation(position.X, position.Y, 0f);
    }

    private static void DecomposeMatrix(ref Matrix matrix, out Vector2 position, out float rotation, out Vector2 scale)
    {
        Vector3 position3, scale3;
        Quaternion rotationQ;
        matrix.Decompose(out scale3, out rotationQ, out position3);
        Vector2 direction = Vector2.Transform(Vector2.UnitX, rotationQ);
        rotation = (float)Math.Atan2(direction.Y, direction.X);
        position = new Vector2(position3.X, position3.Y);
        scale = new Vector2(scale3.X, scale3.Y);
    }

And I'm drawing things like this:

        Matrix parentT = GetMatrix(parentPosition, parentScale, parentRotation);
        Matrix childT = GetMatrix(childPosition, childScale, childRotation);
        childT = childT * parentT;
        Draw(parent, parentT);
        Draw(child, childT);

This seems to be working fine except when the parent has a different scale than [1, 1]. For example, when the scale is [2, 1] and the child is rotating - the child gets scaled along the world X axis which causes it to look deformed:

The result I actually want is:

I still want the child to be affected by the parent's scale while taking the rotation into the account. I guess I could temper with the scale and apply it manually but that doesn't feel right. How to achieve this behaviour using matrices?

sentences:
Is single/double frame allocator suitable only for POD datas? Let´s say I have a single frame stack allocator, so I´m using it for allocating memories for my temporary data.

size_t freeTilesSize = 10;
int* freeTiles = _allocator.allocate<int>(freeTilesSize);

The stack doesn´t save any conditional stuff about the memory it creates(it cares only about the size of the chunk so it knows the new header offset). I see this a good for using with POD data structures or classes with default destructor, however, is it usable also for bigger entities with some behavior at the destruction? At this moment, my function rewind only sets the header ptr to the start of the allocated block so it doesn´t call any destructors.

Am i doing something wrong? What was your approach?

sentences:
Shader code not working While compiling the following code. I get a error

float tess = saturate((gMinTessDistance - d) / (gMinTessDistance - gMaxTessDistance));

// Rescale [0,1] --> [gMinTessFactor, gMaxTessFactor].
vout.TessFactor = tess;

if i do this it works.

float tess = saturate((gMinTessDistance - d) / (gMinTessDistance - gMaxTessDistance));

// Rescale [0,1] --> [gMinTessFactor, gMaxTessFactor].
vout.TessFactor = 0.4;

..

struct VertexOut
{
    float3 PosL       : POSITION;
    float3 NormalW    : NORMAL;
    float3 TangentW   : TANGENT;
    float2 Tex        : TEXCOORD;
    float  TessFactor : TESS;
};

Here is code for vertex shader part

VertexOut VS(VertexIn vin)
{
    VertexOut vout;

    // Transform to world space space.
    vout.PosL = mul(float4(vin.PosL, 1.0f), gWorld).xyz;
    vout.NormalW = mul(vin.NormalL, (float3x3)gWorld);
    vout.TangentW = mul(vin.TangentL, (float3x3)gWorld);

    // Output vertex attributes for interpolation across triangle.
    vout.Tex = mul(float4(vin.Tex, 0.0f, 1.0f), gTexTransform).xy;

    float d = distance(vout.PosL, gEyePosW);

    // Normalized tessellation factor.
    // The tessellation is
    //   0 if d >= gMinTessDistance and
    //   1 if d <= gMaxTessDistance.
    float tess = saturate((gMinTessDistance - d) / (gMinTessDistance - gMaxTessDistance));

    // Rescale [0,1] --> [gMinTessFactor, gMaxTessFactor].
    vout.TessFactor = tess;

    return vout;
}

Im in Directx 12 Shader model 5.0

sentences:
Road / river generation on 2d grid map This is a newbie question, but here it goes:

My map is a 2d grid, and I want to generate roads and rivers. The route from the starting to ending point must not be the optimal route in number of tiles. Instead, they should have a certain level of randomness (turns).

Is there a standard algorithm for this kind of thing?

Cheers!

UPDATE:

This is the result of playing with weights on the grid, and applying a shortest path algorithm (Bellman-Ford) using the jgrapht library. I went with Donutz' answer after all.

http://pastebin.com/AGQGK5ik

sentences:
How are Spot It cards generated? Spot It is a card game 55 cards. Each card has exactly 8 symbols on it (though the total number of different symbols used in the 55 card set is 57). For any two cards in the deck, they share exactly one symbol. For example:

What is the algorithm behind building this deck? Intuitively I think there is a formula for creating a deck of N cards, with I symbols per card and using J total symbols.

For the life of me I cannot figure it out.

Can it be done?

sentences:
FXC: Error X3501: 'main': entrypoint not found I am trying to compile a vertex shader using VS2013, but every time I try, FXC returns the following error:

Error error X3501: 'main': entrypoint not found

I've reduced the vertex shader to its simplest form and yet I'm still getting the same result:
DefaultVS.hlsl
#include "Include.hlsl"

cbuffer CameraTransform {
    float4x4 ViewProjMat;
};

VS_OUT main(VS_IN input) {
    VS_OUT result;

    result.Position = mul(input.Position, mul(input.WorldMat, ViewProjMat));

    return result;
}

Include.hlsl
struct VS_IN {
    float4 Position : POSITION;
    float4x4 WorldMat : INSTANCE_TRANSFORM;
};

struct VS_OUT {
    float4 Position : SV_POSITION;
};

And the properties of both files:

/Zi /E"main" /Od /Fo"Path\To\Output\DefaultVS.cso" /vs"_5_0" /nologo
/Zi /Od /Fo"Path\To\Output\Include.cso" /nologo

sentences:
Spawning words based on screen size I'm creating a typing game where the words fall from the top of the screen to the bottom. How do I set the words to spawn so that they adjust to the screen size of the device. This is the code that I have:

Vector3 randomPosition = new Vector3(Random.Range(-2.5f,2.5f), 7f);
GameObject wordObj = Instantiate(PrefabWord, randomPosition, Quaternion.identity, Canvas);

But this doesn't scale properly with the size of the device.

Edit:

When I change the randomPosition to "new Vector3(Random.Range(0,Screen.width), 7f);", the words spawn all over the screen and not just within the bounds of the camera or canvas.

I have also switched the platform to android and selected 480x800 resolution. And in the old script where the random values were hardcoded from -2.5f to 2.5f, some of the words were getting clipped depending on the resolution selected.

sentences:
How can I stop explodable objects from creating new ones during cleanup? I have a problem with the handling of explosions in my game.

Currently, I have an entity create an explosion when it is destroyed (in the destructor). The issue with this is that when I change states, all my game objects are deleted. This causes explodable objects to create explosions when my EntityManager is already deleted.

I'm still pretty new to game development and I believe my design is very poor. How can I solve this problem?

sentences:
Rotate perspective camera to align screen width to procedural object's width (Unity, C#) I give up. After much trying and searching, I have to say I was unable to achieve the following task, for which I must call for your wise advice.

In my current Unity 5 application (using C#), there is a procedurally generated object (therefore with variable shape) to which the camera should be aligned when players hit a given key. By aligned, please understand it making the width of the screen parallel to the longest part of the object. The idea is represented in the following picture, where in black one can see the irregular object, in yellow is the bounding box.

In other words, it means that I want the camera to be rotated so to align to the longest side of the object's bounding box. I tried that. Still, I was unable to properly calculate the correct angles so to rotate the camera in a way that the horizontal axis of the screen becomes parallel to the width of the objects' bounding box.

Any help would be much appreciated.

sentences:
Sprite drag drop andengine How to drag an andEngine sprite anywhere on the phone screen?

I have written this code in onAreaTouched function of IOnAreaTouchListener interface which is implemented in my activity, but its not working:

public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
      ITouchArea pTouchArea, float pTouchAreaLocalX,
      float pTouchAreaLocalY) {
    // TODO Auto-generated method stub

    Log.v(TAG,"Sprite Touched ##########");

    secondSprite = new
    Sprite( CAMERA_WIDTH/2, CAMERA_HEIGHT/2,
            playerTextureRegion, this.getVertexBufferObjectManager()){
        @Override
        public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,
                                     final float pTouchAreaLocalX,
                                     final float pTouchAreaLocalY) {
            secondSprite.setPosition(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
            System.out.println(String.format("spriteB %fx%f", pSceneTouchEvent.getX(),
                pSceneTouchEvent.getY()));
            return true;
        }
    };
    scene.registerTouchArea(secondSprite);
    return true;
}

sentences:
Is the standard collision detection in Slick2D too heavy for broadphase? I was wondering two things about the built in shape detection of Slick2D. When executed on a lot of shapes, how performant are the intersects and containsmethods, and what kind of algorithm is behind those.

I have implemented SAT collision detection but I don't want to execute this detection on all my entities. So I thought I would use the built in methods to look for entries which are near my player, and for those do the SAT detection.

But if the built in methods are as good as or better than SAT, this wouldn't be good. Also if the built in methods need more time or are kind of heavy for the cpu.

What is the proper way to have my collision detection on the smallest amount of game objects. How would I filter only the near objects?

sentences:
Getting mouse movement value with DirectX Tool Kit today I want to ask a question about how to get mouse movement value with DirectX Tool Kit.

While I can certainly use Mouse::SetMode(MODE_RELATIVE), to do this, I want to be able to get the mouse cursor position at the same time (which can only be done with MODE_ABSOLUTE).

The method I thought of involves leaving mouse mode as the default MODE_ABSOLUTE, and then subtract the mouse position from the previous frame from that of the current one.
But with this method, the mouse cursor can jump out of the window.

So I thought of restricting the mouse cursor to a certain point, but this obviously prevents me from calculating the movement value with said method.

Does anyone have some ideas on how to achieve this with DirectX Tool Kit ?
Or am I missing some obvious thing ?

Thanks in advance!

sentences:
How do I derive an appropriate acceleration value for my game? I am creating a Flappy Bird clone from this tutorial.

I have a question about acceleration in libgdx. The author assigned the bird a constant acceleration vector in the constructor of the bird

        acceleration = new Vector2(0, 460);

and later updated the velocity vector from the accleration vector with

        velocity.add(acceleration.cpy().scl(delta));

I understand generally why acceleration is constant - like the author mentioned, acceleration due to gravity is 9.81m/s^2, meaning that the speed of an object falling will increase by 9.81m/s every second. It seems the author somehow got from 9.81 real world value to 460 in the actual code. How does one go about deriving this value? Is this a standard derivation or something the author just made up?

sentences: How do i change the vertical fit of a constant size fitter? How do i change the vertical fit of a constant size fitter? For example changing vertical fit from min size to unconstrained. Is it posible to do this?

sentences: How can I detect a clicked element in an Editor Script? I want to implement a custom LayoutManager, e.g. a HorizontalLayout. (Yes I know, that this already exists, but I want my own behaviour) So when I let my script calculate the width, that works. But now I want to adjust the width of one Element and let the script recalculate the width of the other elements accordingly, I run into the problem, that the width is "locked" because the script is calculating all the time. So I want to tell the script, that it should only recalculate for the elements which are not clicked on the layout for the moment. I hope something like this is possible.

sentences:
Can't give my pictures the right location in libGDX I have this code here

 sb.draw(title, (PPlane.WIDTH / 2) - (title.getWidth() / 2), (float) (PPlane.HEIGHT / 10));
 sb.draw(playBtn, (PPlane.WIDTH / 2) - (playBtn.getWidth() / 2), PPlane.HEIGHT / 2);

This gives me a picture in the middle (playBtn) and a picture beneath it (title). But I want the picture title to be above picture playBtn. So what i did was:

 sb.draw(title, (PPlane.WIDTH / 2) - (title.getWidth() / 2), (float) (PPlane.HEIGHT / 1.2));
 sb.draw(playBtn, (PPlane.WIDTH / 2) - (playBtn.getWidth() / 2), PPlane.HEIGHT / 2);

I changed the number that divide PPlane.HEIGHT in draw.title so it would appear above playBtn, but instead it just dissapeared.

I also tried to change the cam.setOrtho to True with the first code but that didn't work either.

What should I do to fix this?

sentences:
How can I represent collection of distant but visit-able stars while using minimal resources? I have recently started to plan a project in Unity that will be for Android. I have a database that consists of over 150,000 stars (may trim this down if I/O cripples the overhead). The game will hopefully consist of a free-to-explore universe creating the illusion that the user is flying in a realistic representation of the stars.

My biggest concern at the moment is how do I create a realistic environment with these starts, while keeping the resource impact on the phone to a minimum? Some people mentioned using octrees, would this be wise?

This is my first game that I am looking to create so any help would be much appreciated to this novice!

sentences:
Clamp view direction vector to nearest axis In JMonkeyEngine, given any view direction Vector3f instance, I'd like to get a new vector facing the nearest x or z axis (positive or negative), with y set to 0.

For example

[-0.99915564, -0.036672898, -0.018518358]
// -> should return [-1, 0, 0]

[-0.01313778, 0.042407744, 0.99901414]
// -> should return [0, 0, 1]

Is there a nifty math trick for this or do I need to manually check x and z and then set y to 0?

Thanks.

Update

So far, what I do is this

dir.x = dir.x >= 0 ? Math.floor(dir.x + 0.5) : Math.ceil(dir.x - 0.5);
dir.y = 0;
dir.z = dir.z >= 0 ? Math.floor(dir.z + 0.5) : Math.ceil(dir.z - 0.5);

Which produce the desired output. I was wondering if this can be done in a more elegant fashion (i.e. through some nifty matrix operation).

sentences:
Getting the Halo property of a point light in Unity I am adding point lights in my scene ( max 6 ) and I want to be able to enable its Halo property via script. However in the documentation reference, they haven't mentioned how to enable the halo property of a light source via script.

This is what I have so far.

GameObject lightObj = new GameObject("Light");
lightObj.AddComponent<Light>();
lightObj.light.color = Color.blue;
lightObj.transform.position = city.transform.position + new Vector3(-6.0f,0,0);

Point Lights have a property "Draw Halo" on the Inspector but how do I enable it via script?

sentences: Is there any way to enable the HiDef graphics profile property on a Silverlight 5 3d Web App? I have an XNA Windows Game that uses the HiDef profile to load complex fbx and obj files. Trying to move it over to a Silverlight 3d Web App, Silverlight seems to only want to use the Reach profile, and I get an error that the Reach profile does not support a sufficient number of primitive draws per call. Is there any way to change to HiDef in Silverlight 5? It is not in the project properties and attempting to change it in mainpage.xaml.cs only gives me the option of setting it to Reach.

sentences:
Any tips on figuring out programming in Unreal Engine (without focusing mainly on blueprints, or at least a fairly even mix of the two?) So for the past few months I've been attempting to learn Unreal Engine. Most tutorials feature blueprints which I guess makes sense as it's new and simple and their solution to artists trying to make games. However, when learning to code or program anything, I've always valued actually understanding what I'm typing in. It makes it easy to remember, especially when it's not a habit like say, typing in int main()
before starting your C++ code.
When I need to write code spontaneously, I find it valuable to understand what I'm typing in.

However, UE4's usage of C++ is almost as if you're learning a new derived language, which is what was once done by users of Unreal Engine. Outrageously though, I've found no source which explains the vast amount of macro's and jargon used when programming games in UE4. Thing's such as GENERATED_UCLASS_BODY() or void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
Perhaps the terms void, class, and override have been mentioned in typical C++, but the Unreal API is a mystery, and I've found no place where I can know what any of this actually means, or more importantly -in my view of course-, why I'm connecting them the way I'm told too. It's somewhat obvious that all these are related, but it's harder to uncover how they're to be formatted and linked together. Does anyone know a way I can get a better understanding of the library of macros and terms Epic has taken no time to explain?

sentences:
Abstracting entity caching in XNA I am in a situation where I am writing a framework in XNA and there will be quite a lot of static (ish) content which wont render that often. Now I am trying to take the same sort of approach I would use when doing non game development, where I don't even think about caching until I have finished my application and realise there is a performance problem and then implement a layer of caching over whatever needs it, but wrap it up so nothing is aware its happening.

However in XNA the way we would usually cache would be drawing our objects to a texture and invalidating after a change occurs. So if you assume an interface like so:

public interface IGameComponent
{
    void Update(TimeSpan elapsedTime);
    void Render(GraphicsDevice graphicsDevice);
}

public class ContainerComponent : IGameComponent
{
    public IList<IGameComponent> ChildComponents { get; private set; }

    // Assume constructor

    public void Update(TimeSpan elapsedTime)
    {
        // Update anything that needs it
    }

    public void Render(GraphicsDevice graphicsDevice)
    {
        foreach(var component in ChildComponents)
        {
            // draw every component
        }
    }
}

Then I was under the assumption that we just draw everything directly to the screen, then when performance becomes an issue we just add a new implementation of the above like so:

public class CacheableContainerComponent : IGameComponent
{
    private Texture2D cachedOutput;
    private bool hasChanged;
    public IList<IGameComponent> ChildComponents { get; private set; }

    // Assume constructor

    public void Update(TimeSpan elapsedTime)
    {
        // Update anything that needs it
        // set hasChanged to true if required
    }

    public void Render(GraphicsDevice graphicsDevice)
    {
        if(hasChanged)
        { CacheComponents(graphicsDevice); }
        // Draw cached output
    }

    private void CacheComponents(GraphicsDevice graphicsDevice)
    {
        // Clean up existing cache if needed
        var cachedOutput = new RenderTarget2D(...);
        graphicsDevice.SetRenderTarget(renderTarget);
        foreach(var component in ChildComponents)
        {
            // draw every component
        }
        graphicsDevice.SetRenderTarget(null);
    }
}

Now in this example you could inherit, but your Update may become a bit tricky then without changing your base class to alert you if you had changed, but it is up to each scenario to choose if its inheritance/implementation or composition. Also the above implementation will re-cache within the rendering cycle, which may cause performance stutters but its just an example of the scenario...

Ignoring those facts as you can see that in this example you could use a cache-able component or a non cache-able one, the rest of the framework needs not know. The problem here is that if lets say this component is drawn mid way through the game rendering, other items will already be within the default drawing buffer, so me doing this would discard them, unless I set it to be persisted, which I hear is a big no no on the Xbox. So is there a way to have my cake and eat it here?

One simple solution to this is make an ICacheable interface which exposes a cache method, but then to make any use of this interface you would need the rest of the framework to be cache aware, and check if it can cache, and to then do so. Which then means you are polluting and changing your main implementations to account for and deal with this cache...

I am also employing Dependency Injection for alot of high level components so these new cache-able objects would be spat out from that, meaning no where in the actual game would they know they are caching... if that makes sense. Just incase anyone asked how I expected to keep it cache aware when I would need to new up a cachable entity.

sentences: How do they made Pokémon games so flawlessly balanced? I find it hard to believe how well balanced the Pokémon games are. Not just within the games, where you'll find amazing balance from the very beginning to the very end, but, surprisingly, even when things get more competitive. If you have ever played the simulators that are available, you'll know what I'm talking about www.smogon.com. There are thousands of unique Pokémon characters, moves, traits and items. Yet, if you try to find a single broken strategy, You can't. And if you do find something obscure that could give you a good advantage, you'll realize it's impossible. The emerging competitive scenario is one of the most amazing strategy games I've ever seem, and it's not even a feature of the Pokémon games!

sentences:
Canvas - darken sprites rendered by drawImage I am implementing lighting in a tile engine, and I need a way to darken tiles, based on their light level.

For the ground tiles, I can clear the context to black, then set the globalAlpha and use drawImage normally. But what about foreground tiles, such as trees? I don't want them to be translucent, just darker. Is there any way to filter the output of drawImage?

sentences:
How does collisions caculates when developing game in Build an HTML5 Game book I don't understand author's logic when calculating collisions between two circles (bubbles). Here is the Calculating collisions section.

Author writes:

  The bubble being fired follows a set of coordinates defined by the
  equations:

  px = ex + tdx py = ey + tdy

  where px and py are points on the trajectory of the bubble’s center
  point. The calculation of px and py happens in jQuery’s animate method
  and is the standard equation for moving a point along a line. Next,
  we’ll calculate t at the closest point on this line to the center of
  the bubble that we’re checking against:

  var t = dx * distToBubble.x + dy * distToBubble.y;

I don't understand what t is  and why it calculates by the following formula:

var t = dx * distToBubble.x + dy * distToBubble.y;?

sentences:
How do I determine color resolution of an output in DXGI/D3D? i'm was revising some code i wrote some time ago when working on the window wrapper for my rendering framework. The framework is based off DirectX, but it wasn't really using any D3D-related facility. Instead it was wrapping the EnumDisplaySettings call :

DEVMODE dm;
dm.dmSize = sizeof(dm);
int_32 count{ 0 };
while (EnumDisplaySettings(NULL, count, &dm))
{
    if (dm.dmPelsWidth == _width && dm.dmPelsHeight == _height)
    {
        m_width = dm.dmPelsWidth;
        m_height = dm.dmPelsHeight;
        m_color_resolution = dm.dmBitsPerPel;
        m_display_frequency = dm.dmDisplayFrequency;
        return true;
    }
    ++count;
}

Simple as that, this doesn't take into account the format. It does take the refresh rate in count (DisplayFrequency) that I've supposed being the same thing. I'm using this Win32 call because later whenever someone needs to set the window to fullscreen I apply the DEVMODE through ChangeDisplaySettings().

I could have used the IDXGIAdapter::EnumOutputs call, but this doesn't give me the bits per pixel (or color resolution). I've done some tests and its value is 32 most of the times but I don't want to take it for granted. My question(s) is(are):

Is there any way to get the color resolution through Direct3D ? is it strictly related to the format ?
Is my approach correct at all ? because i'm having some doubts, should i keep using the Win32 calls or use the D3D ones ?

I apologize if this question has already been answered or if it has an obvious answer that I can't get, I bet I'm missing something.

sentences:
Rendering issues in Monogame when using shaders I am currently fiddling with Monogame, trying to work with Shaders and I have encountered a really weird issue. If the first ever draw in the application's lifetime is with a custom shader all further draws without a custom shader get this red tint (as if blue and green channels were set to 0):

(A is the correct one, the sprite is white and black)

The following code produced these:

spriteBatch.Begin(); // Use this for A
//spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, Gfx.MyShader); // Use this for B
spriteBatch.Draw(Gfx.PlayerStand2, new Vector2(10, 10));
spriteBatch.End();
spriteBatch.Begin();
spriteBatch.Draw(Gfx.PlayerStand2, new Vector2(50, 50));
spriteBatch.End();
spriteBatch.Begin();
spriteBatch.Draw(Gfx.PlayerStand2, new Vector2(80, 80));
spriteBatch.End();

And this is the shader:

sampler TextureSampler : register(s0);

float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
    return tex2D(TextureSampler, texCoord);
}

technique Shader1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

It all depends on the first draw - if I replace the first two lines with this:

counter++; // Starts at 0
if (counter == 1){ // Run only on the first draw
    spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, Gfx.GaussianBlur);
} else {
    spriteBatch.Begin();
}

They all become red. If I replace == with != they all display correctly.

I am using OpenGL for rendering. I am aware I could circumvent this problem by always using a custom shader but I fear that this is but a symptom of a greater issue that will come later to bite my bottom. Or hopefully something completely trivial that I missed.

Update: I tried to reproduce it in DirectX version and in this case the batch with the shader does not render, but the other sprites are not red.
I also tried to compile the files via Monogame Pipeline with the same effect.

sentences:
How to model the double jump in Super Mario using projectile motion So the single jump in Super mario games follows a curved trajectory of the formula s = s0 + v0t + ½ at2. The double jump in mario consists of two different parabolas combined. I know that the max height of the first jump is the beginning of the second jump and the gravity doubles by the end of the second jump making a faster landing than the first. Would it be a piece-wise function or how would it work?
*Could anyone guide me through/ explain what equation would that result in? Any help would be very much appreciated!
If anyone needs me to explain more, please let me know.
Here is a link to explain my question https://www.youtube.com/watch?time_continue=1096&v=hG9SzQxaCm8&feature=emb_title
@ 17:58
I would be very grateful for any help :) Even if it is only ideas, thanks

sentences:
LineRenderer not working using Vuforia in Unity So I'm trying to render a line that shows up when camera sees an image target and moves around with it. Very typical AR application. But my line renderer doesn't seem to show at all.

Here's the code:

using UnityEngine;
using System.Collections;

public class myLine : MonoBehaviour
{
    // Creates a line renderer that follows a Sin() function
    // and animates it.

    public Color c1 = Color.yellow;
    public Color c2 = Color.red;
    public int lengthOfLineRenderer = 20;

    void Start()
    {
        LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
        lineRenderer.widthMultiplier = 0.2f;
        lineRenderer.positionCount = lengthOfLineRenderer;

        // A simple 2 color gradient with a fixed alpha of 1.0f.
        float alpha = 1.0f;
        Gradient gradient = new Gradient();
        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
            );
        lineRenderer.colorGradient = gradient;
    }

    void Update()
    {
        LineRenderer lineRenderer = GetComponent<LineRenderer>();
        var t = Time.time;
        for (int i = 0; i < lengthOfLineRenderer; i++)
        {
            lineRenderer.SetPosition(i, new Vector3(i * 0.5f, Mathf.Sin(i + t), 0.0f));
        }
    }
}

and here's my set up:

I also tried attaching the script directly to the ImageTarget and nothing happened.

sentences:
Creating three-dimensional biomes I have an idea for a space-based game where there are different sectors of control. These would be set up in a manner similar to terrain biomes, where there will be clusters with limited space between them where there are 'mixed' biomes or even no biomes whatsoever, indicating no 'side' has control over that region.

There are a plethora of articles on the web these days about how to create two dimensional biome maps, but I have seen none about making three-dimensional maps. Has anyone done any coding like this before? My Google-fu is strong but I haven't found any significant pages on it.

I will continue to work on it solo, but as a beginning, solo programmer I expect I will be quite slow on it. I was just wondering if anyone had done this already.

sentences:
Large game statistics database management I am making a management game in Java with a farming theme. I am rather beginner in software development and every steps requires lots of thoughts. I am at a point now that I want to log and keep every lots of statistics of what happens in the game. For example every time a task is completed, state of every crop field and animal  at the end of every day and so on. So I learned how to use some basic feature of Log4j2 and got a text file to log a new line every time I want to log an event. I noticed that after just 3 game days with a tiny farm size the file is already over 10kB (1KB zipped). I suspect that it will quickly become rather large for long games, bigger farm size, more complex farms... It made me wonder if it was not the best way of doing such a thing. I still have to implement a parsing method to read the text files, process the data and visualize it.

So is there a better approach? Should I write my events in a list and serialize it in binaries(I have never done that in fact I use gson for my saved games). Then again I would not want multiple hundreds of MB of data loaded up in RAM all the time. Since my project is rather small compared to many others I suspect there is a better way.

sentences:
Why do I get this error when converting an XNA .fx to a MonoGame .fx? I am learning game development in Monogame via book for XNA 4.0. In the code below which is for drawing the terrain, I get the error in the comment.
Im using an effect from Monogame content pipeline folder, and I noticed that there are some differences between the effect file described in the book and the pipeline generated effect. how do i convert the syntax of XNA to Monogame?

    public void Draw(ArcBallCamera camera, Effect effect)
    {
        effect.CurrentTechnique = effect.Techniques["BasicColorDrawing"];
        effect.Parameters["WorldViewProjection"].SetValue(Matrix.Identity * camera.View * camera.Projection);
        foreach (EffectPass pass in effect.CurrentTechnique.Passes)
        {
            pass.Apply();
            device.SetVertexBuffer(vertexBuffer);
            device.Indices = indexBuffer;
            device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, vertexBuffer.VertexCount);
            //ERROR: An error occurred while preparing to
            //draw. This is probably because the current vertex declaration
            //does not include all the elements required by the current
            //vertex shader. The current vertex declaration includes these
            //elements: SV_Position0, NORMAL0, TEXCOORD0.

        }
    }

the effect file:

#if OPENGL
#define SV_POSITION POSITION
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#else
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1
#endif

matrix WorldViewProjection;

struct VertexShaderInput
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
};

struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
};

VertexShaderOutput MainVS(in VertexShaderInput input)
{
VertexShaderOutput output = (VertexShaderOutput)0;

output.Position = mul(input.Position, WorldViewProjection);
output.Color = input.Color;

return output;
}

float4 MainPS(VertexShaderOutput input) : COLOR
{
return input.Color;
}

technique BasicColorDrawing
{
pass P0
{
    VertexShader = compile VS_SHADERMODEL MainVS();
    PixelShader = compile PS_SHADERMODEL MainPS();
}
};

the book is "XNA 4 3D Game Development by Example Beginners Guide" BY Kurt Jaegers, published in 2012

sentences:
Fallback for R32F alpha blending I'm rendering an aggregation of value into an R32F format texture, using alpha blending to accomplish the sum operation.

R32F alpha blending is not supported on all hardware. What kind of fallback options do I have for accomplishing the addition in when the hardware doesn't support blending?

sentences:
Unity3D - How to tessellate 2D sprites? I use dynamic vertex lighting on 2D sprites. On larger sprites the lighting is uglier than on smaller ones. This is because every sprite is just a quad of two triangles. Not enough vertices there for lighting on larger areas.

Is there a way to use more triangles on a sprite? Maybe even depending on how much screen space they cover?

sentences:
Keep 2d GUI shape through rotation I've been working on creating the GUI system for a 3d game I've been working on, and have hit a bit of an obstacle in trying to rotate GUI elements (Google searching did not yield what I was looking for). This is how the screen looks without any rotation. As of now, rotating each element distorts the GUI elements, like this, whereas I want an effect closer to this, without any stretch or skewing.

My code, using glm, looks like this:

void GUI::NewGUIBase::rebuildMatrix()
{
    glm::vec3 newModel = glm::vec3(absoluteTopLeft.x, absoluteTopLeft.y, 1.0f);

    glm::mat4 rotate = glm::rotate(glm::mat4(1.0f), glm::radians(this->rotation), glm::vec3(0, 0, 1));
    glm::mat4 trans = glm::translate(glm::mat4(1.0f), newModel);
    this->setModel(trans * rotate);
}

I believe that the issue is due to the fact that my game window is not a square given that OpenGL uses window coordinates from -1 to 1. However, I can't figure out how I would take this into account to achieve the desired effect of rotation without any stretch.

In case it helps, a GUI element knows its own top left corner and its own dimensions (in OpenGL coordinates), and the game window's width and height in pixels.

sentences:
UDK and Protocol Buffers Actually two questions:

Can I use TCP sockets in UDK to implement my own networking protocol? (I guess TCPLink is an answer)
Is there any way I can user Protocol Buffers inside UDK? Or anything like that? (i.e. thrift, bson)

sentences:
Why is alpha channel ignored in Texture I am binding a texture to draw over some geometry (using the ImmediateModeRenderer20) but the alpha channel of the texture turns into colour black when drawn. Why is that happening?

My draw call loop looks sort of like this:

immediateModeRenderer20.begin(renderer.getUiCamera().combined, GL20.GL_TRIANGLE_STRIP);
immediateModeRenderer20.color(new Color(1, 1, 1, 1));
immediateModeRenderer20.texCoord(distance, tc.y);
immediateModeRenderer20.vertex(point.x, point.y, 0f);
immediateModeRenderer20.end();

sentences:
Testing spheres without extracting planes I am currently a bit stuck. On OpenGL I am attempting to do view frustum culling,
so far I managed to do it by using a PCM.
Where center is the world position of the mesh.

bool shouldRenderMesh(mat4 VP, vec3 center, float radius)
{
    vec4 transformedCentre = VP * vec4(center, 1);
    vec3 PCN = vec3(
        transformedCentre.x / transformedCentre.z,
        transformedCentre.y / transformedCentre.z,
        transformedCentre.z / transformedCentre.z
        );
    if( abs(PCN.x) > 1 || abs(PCN.y) > 1 || abs(PCN.y) > 1 )
    {
        return false;
    }
    return true;

The problem is, while the approach works, items will disappear too soon, as the testing is based on the centre point of the mesh, rather than the bounding box.

Is it possible to test a sphere or box without extracting planes?

Thanks

sentences:
Why have the player pick up loot manually? From a game-design perspective, I was wondering what the mechanic of manually picking up items off the ground does for the player. Keep in mind that items that fall on the ground can most likely be put into one of two groups:

Equipment Items: depending on the character the player is creating, the majority of these items might be ignored and left on the ground. Players will only pick up the ones that they want to "spend" inventory space and time (by clicking and eventually having to go back to town) on.
Consumables: gold, gems, crafting materials, etc - which players generally always want to pick up and sometimes don't take up inventory space.

While I can see that making players choose which items to pick up is an interesting "collecting" mechanic for the Equipment group, why make the "Consumable" group require manual picking up as well?

Examples of games which do this: (most diablo-esque dungeon crawlers)

Diablo 3

Path of Exile

Grim Dawn

Torchlight 2

sentences:
If statement works fine until I add a tag check requirement. Why is this? I'm trying to add a tag check to an if statement but for some reason when I add said tag check it stops working.

void Update ()
    {
        Vector3 fwd = transform.forward; // Equivalent to the code you had.

        Ray ray = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        if (Input.GetMouseButton(0) && Physics.Raycast(ray, out hit, 10f) && isPlayerHolding == false && gameObject.CompareTag("Pickable"))
        {
                isPlayerHolding = true;
                hit.transform.SetParent(Player.transform);
                Debug.Log("We hit: " + hit.transform.name);
                hit.rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
                hit.rigidbody.constraints = RigidbodyConstraints.FreezePosition;

        }
        if (Input.GetMouseButton(1) && Physics.Raycast(ray, out hit, 10f) && isPlayerHolding == true)
        {
            hit.transform.parent = null;
            isPlayerHolding = false;
            hit.rigidbody.constraints = RigidbodyConstraints.None;
        }

More specifically this is the bit of code that is holding things up "&& gameObject.CompareTag("Pickable")".

Things I've tried:

Debugged variables in C# to be sure nothing is missing/null.
Making sure the tag is setup properly within Unity.

I really can't think of what the problem is. Anyone have any ideas?

sentences:
Read an object from compressed file generated from ActionScript 3 I have made a simple game Map Editor and I want to save a array that contain map tile info to a file, as below:

var arr:Array = [.....2d tile info in it...];
var ba:ByteArray = new ByteArray();
ba.writeObject(arr);
ba.compress();
var file:File = new File();
file.save(ba);

I had successfully saved a compressed object to a file.
Now the problem is my server side need to read this file and decompress the array out from the file, then convert it to a Python list.  Is that possible?

sentences:
What is AABBvsAABB Collision detection? Currently studying Game Engineering at university and my lecturer has asked us to implement a collision manager. He asks us to use AABBvsAABB to build it, so then we can add the physics.

My question is and if anyone can answer it as simple as possible (as the notes he uses I am still lost).

What exactly is AABBvsAABB for collision detection?

Any links to sites that explain it or just some basic examples would be appreciated.
EDIT: links or examples that explain it in simple terms, I can't seem to find any :(

sentences:
blender: 3D model from guide images In a effort to learn the blender interface, which is confusing to say the least, I've chosen to model a model from referrence pictures easily found on the web.

Problem is that I can't ( and won't ) get perfect "right", "front" and "top" pictures. Blender only allows you to see the background pictures when in ortographic mode and only from right|front|top, which doesn't help me.

How to I proceed to model from non-perfect guide images?

sentences:
What libraries/engines should I use? I have some pretty decent general programming skills and elementary C/C++ skills. I am a complete noob in game/graphics programming and I would like to start.

I want to gradually learn, starting off by something like Pong, and gradually making more difficult stuff for learning. My ultimate goal is to make some COD:BO zombies clone (I love this game).

So what libraries/engines can you guys recommend, first to even start drawing stuff on the screen, and later more sophisticated stuff for getting a FPS going.

sentences:
using delta timing is causing shake I am using delta timing to account for potential drop in frame rate. Only trouble being when I do this, I can notice an ever so slight wobble. I checked out the following JSFiddle coming from a tutorial on the subject and I can even see the wobble there, specifically on the 30fps example. http://jsfiddle.net/straker/bLBjn/

my code is:

var delta = {
    now: 0,
    last: 0,
    difference:0,
    time: 1000/60
}

var d = function(val){
    return val/delta.time * delta.difference;
}

Then further down at the game loop

delta.last = Date.now();
animate();
function animate(){
    delta.now = Date.now();
    delta.difference = delta.now - delta.last;
    delta.last = delta.now;

    //update a sprite
    platform.x -= d(10);

    requestAnimationFrame( animate );
}

How can I keep the animation smooth?

sentences:
OpenTK Camera Rotation issue I'm currently developing a 3D game engine in C# using OpenTK.

I have basic game objects, and each game object has transform (translation, rotation and scaling). A game object can have components (much like Unity).

One game object (The camera game object) has three components, A camera, free move and a free look component. The free move component allows the user to move the camera around the scene, whilst the free look camera is SUPPOSED to rotate the camera. However, I get this odd effect:

https://youtu.be/rcdWZcaEqSY

(Note that, the plane isn't changing position, it seems the camera is ... turning upside down?)

On top of that, once I rotate the camera, moving the camera (using the arrow keys) gets really weird, up can become down, left can become right. It's all very odd.

Anywho, here is the update method for my Free Look component:

protected override void OnUpdate(object sender, UpdateEventArgs e)
{
    Rectangle bounds = Game.GetCurrentGame().Window.Bounds;

    Vector2 center = new Vector2(bounds.Left + (bounds.Width / 2), bounds.Top + (bounds.Height / 2));

    Vector2 mousePosition = new Vector2(System.Windows.Forms.Cursor.Position.X,
                                            System.Windows.Forms.Cursor.Position.Y);
    Vector2 deltaPosition = center - mousePosition;

    bool rotX = deltaPosition.X != 0;
    bool rotY = deltaPosition.Y != 0;

    if(rotY)
        Transform.Rotate(new Vector3(0, 1, 0), MathHelper.DegreesToRadians(-deltaPosition.X * sensitivity));
    if(rotX)
        Transform.Rotate(new Vector3(1, 0, 0), MathHelper.DegreesToRadians(-deltaPosition.Y * sensitivity));

    if (rotY || rotX)
        System.Windows.Forms.Cursor.Position = new Point((int)center.X, (int)center.Y);

    base.OnUpdate(sender, e);
}

here is the Rotate method in my transform class:

public void Rotate(Vector3 axis, float angle)
{
    rotation = (Quaternion.FromAxisAngle(axis, angle) * rotation).Normalized();
}

I hope someone can help me get to the bottom of this, I've been so frustrated!

If there's any other code you need to see, just let me know.

sentences:
i want to move arrow by dragging and than want to toss/throw when i give swipe event In My Application I Have One Arrow Image With Fix Center and i Can rotate it by touch move method on same center but i also need to Toss/trow the arrow after doing some rotation with dragging or without doing that
   How Can I Put The Toss/Throw Action  in MyApplication

Thank You Very Much In/ advance

sentences:
Why are my explosions not showing? I'm creating a space shooter using type script and I don't understand why explosions won't work meaning that nothing is drawn on the screen and I don't understand what I'm doing wrong.

for (var i = 0; i < projectileList.length; i++) {
    if (this.y >= projectileList[i].y) {
        let projDist = this.x - projectileList[i].x;
        if (projDist < 0) {
            projDist = projDist * (-1);
        }

        if (projDist >= 0 && projDist <= 30) {
            this.x = Math.floor(Math.random() * 600) + 1;
            this.y = 20;
            projectileList[i].x = 2000;
            for (var j = 1; j <= 9; j++) {
                this.sprite = "/images/explode_" + j + ".png";
                this.img.src = this.sprite;
                this.gameContext.drawImage(this.img, 200, 200);
            }
        }
    }
}

Basically when there is a collision between projectiles and asteroids, I'm just trying to draw some images on the screen but nothing is happening and the console won't give any errors :( Do you guys know what is wrong?

Thanks for help!

sentences:
Correct order of tasks in each frame for a Physics simulation I'm playing a bit around with 2D physics. I created now some physic blocks which should collide with each other. This works fine "mostly" but sometimes one of the blocks does not react to a collision and i think that's because of my order of tasks done in each frame.

At the moment it looks something like this:

function GameFrame(){
    foreach physicObject do
        AddVelocityToPosition();

        DoCollisionStuff();      // Only for this object not to forget!

        AddGravitationToVelocity();
    end

    RedrawScene();
}

Is this the correct order of tasks in each frame?

sentences:
Why can't I use the operator '>=' with Vector3s? I am trying to get a rectangle to move between two positions which I refer to as _positionA and _positionB. Both are of type Vector3. The rectangle moves just fine. However, when it reaches _positionB it does not move in the opposite direction, like it should.

I went back into the code to take a look. I came to the conclusion that as the object moved, the if statements in the code missed the frame in which the rects position was equal to _positionB. I decided to modify the code to reverse direction if the rects position is greater than or equal to _positionB. My code is not too long, so I will display it below:

using UnityEngine;
using System.Collections;

public class Rectangle : MonoBehaviour
{
    private Vector3 _positionA = new Vector3(-0.97f, -4.28f); //Start position
    private Vector3 _positionB = new Vector3(11.87f, -4.28f); //End position
    private Transform _rect_tfm;
    private bool _atPosA = false, _atPosB = false;

    public Vector2 speed = new Vector2(1f, 0f);

    private void Start()
    {
        _rect_tfm = gameObject.GetComponent<Transform>();
        _rect_tfm.position = _positionA;
        _atPosA = true;
    }

    private void Update()
    {
        /*NOTE: Infinite loops can cause Unity to crash*/
        Move();
    }

    private void Move()
    {
        if (_atPosA)
        {
            _rect_tfm.Translate(speed * Time.deltaTime);

            if (_rect_tfm.position == _positionB)
            {
                _atPosA = false;
                _atPosB = true;
            }
        }

        if (_atPosB)
        {
            _rect_tfm.Translate(-speed * Time.deltaTime);

            if (_rect_tfm.position == _positionA)
            {
                _atPosA = true;
                _atPosB = false;
            }
        }
    }
}

When I changed it, however, it warned me of the following error message:

  Operator >= cannot be applied to operands of type Vector3 and Vector3.

This confuses me for two reasons; first, both values are of the same data type. Second, using the comparison operator(==) on the two values works without error. Why can't I use the operator >= with Vector3s?

sentences:
Want to develop my own primitive physics engine, don't know how to start with its high-level architecture. Suggestions? Few years ago I tried to make a simple 3D game - billiards. Completed like 50%, stuck with physics. Basically, I only need to calculate balls rolling over flat surface, but it would be nice to make something more flexible.
I know all the formulas and laws (most of them, anyway). the problem is I have no idea of how to make good physics engine architecture-wise.
I tried google and other forums but didn't find what I was looking for. The only suggestion was to look at open-source engine, but I'm not that good a programmer to make heads or tails out of it...

sentences:
Insert 3d text to the front face of a cube GameObject I want to add a text to a cube in Unity.

I have a cube which has a 3d text as a child.

I am using the below UnityScript to write on the 3d text:

var countdown : int = 200;

function Update()
{
    GetComponent(TextMesh).text = countdown.ToString();
}

I am trying to write/show the text to the front face(or very close) of the cube but I am failing.

EDIT: My difficulty is to make the text appear in the front side/face of the cube, like it is written on it. Attaching the text or the script to any object is not an issue

My last failed try was to use the below lines:

var tm = gameObject.AddComponent(TextMesh);
tm.text = countdown.ToString();

Any ideas?

sentences:
Why doesn't the y Axis work with SuperBible frame reference or GluLookAt I'm currently trying to understand how to use the GLFrame Class in the superbible book, and acording to the 4th edition of the book, the camera matrix derived from the Frame of reference class should work the same as GluLookAt

When I add these lines

cameraFrame.SetForwardVector(-0.5f, 0.0f,-0.5f);
cameraFrame.Normalize();

The camera looks in the correct direction, yaw at 45 Degrees (Am I doing that right!)

However when I add this

cameraFrame.SetForwardVector(0.0f, 0.5f,-0.5f);

The camera just looks as if it was set to (0.0f, 0.0f, 1.0f)

Why is this! It's been driving me mad for three days. Maybe I'm not passing in the vectors correctly, but I'm not sure how to pass in x,y 360 degrees for the look at (forward) location/vector. Do the vectors have to be normalized before passing them in?

Eventually I hope to do full mouse look (FPS style) , but for now just understanding why I can't make the camera simply pitch up would be a good start.

Thansk!

Here is the code in situ.

// Called to draw scene
void RenderScene(void)
{
// Color values
static GLfloat vFloorColor[] = { 0.0f, 1.0f, 0.0f, 1.0f};
static GLfloat vTorusColor[] = { 1.0f, 0.0f, 0.0f, 1.0f };
static GLfloat vSphereColor[] = { 0.0f, 0.0f, 1.0f, 1.0f };

// Time Based animation
static CStopWatch   rotTimer;
float yRot = rotTimer.GetElapsedSeconds() * 60.0f;

// Clear the color and depth buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Save the current modelview matrix (the identity matrix)
modelViewMatrix.PushMatrix();

M3DMatrix44f mCamera;

/////////
///////// My Code

cameraFrame.SetForwardVector(-0.5f,-0.5f,-0.5f);
cameraFrame.Normalize();

///////// End of my code
cameraFrame.GetCameraMatrix(mCamera);
modelViewMatrix.PushMatrix(mCamera);

// Transform the light position into eye coordinates
M3DVector4f vLightPos = { 0.0f, 10.0f, 5.0f, 1.0f };
M3DVector4f vLightEyePos;
m3dTransformVector4(vLightEyePos, vLightPos, mCamera);

// Draw the ground
shaderManager.UseStockShader(GLT_SHADER_FLAT,
                             transformPipeline.GetModelViewProjectionMatrix(),
                             vFloorColor);
floorBatch.Draw();

for(int i = 0; i < NUM_SPHERES; i++) {
    modelViewMatrix.PushMatrix();
    modelViewMatrix.MultMatrix(spheres[i]);
    shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF,     transformPipeline.GetModelViewMatrix(),
                            transformPipeline.GetProjectionMatrix(), vLightEyePos, vSphereColor);
    sphereBatch.Draw();
    modelViewMatrix.PopMatrix();
    }

// Draw the spinning Torus
modelViewMatrix.Translate(0.0f, 0.0f, -2.5f);

// Save the Translation
modelViewMatrix.PushMatrix();

    // Apply a rotation and draw the torus
    modelViewMatrix.Rotate(yRot, 0.0f, 1.0f, 0.0f);
    shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF, transformPipeline.GetModelViewMatrix(),
                                 transformPipeline.GetProjectionMatrix(), vLightEyePos, vTorusColor);
    torusBatch.Draw();
modelViewMatrix.PopMatrix(); // "Erase" the Rotation from before

// Apply another rotation, followed by a translation, then draw the sphere
modelViewMatrix.Rotate(yRot * -2.0f, 0.0f, 1.0f, 0.0f);
modelViewMatrix.Translate(0.8f, 0.0f, 0.0f);
shaderManager.UseStockShader(GLT_SHADER_POINT_LIGHT_DIFF, transformPipeline.GetModelViewMatrix(),
                            transformPipeline.GetProjectionMatrix(), vLightEyePos, vSphereColor);
sphereBatch.Draw();

// Restore the previous modleview matrix (the identity matrix)
modelViewMatrix.PopMatrix();
modelViewMatrix.PopMatrix();
// Do the buffer Swap
glutSwapBuffers();

// Tell GLUT to do it again
glutPostRedisplay();

}

sentences:
Why does my RigidBody collision fail depending on which entity is moving? I am working on a UDK project and have a collision problem.

I have a Crate which is a kActor with RigidBody physics and my player who is a Pawn. When my player moves and collides with the crate, the event Bump is called, as expected.

However, when my Crate collides with the Pawn when the Pawn isn't moving, the Bump event is not called. In this case, the crate goes through my Pawn without any collision. How can I make this collision case work such that it raises the Bump event?

sentences:
How should I organize my matrices in a 3D game engine? I'm working with a group of people from around the world to create a game engine (and hopefully a game with it) within the next upcoming years. My first task is to write a camera class for the engine to use in order to add cameras to the scene, with position and follow points.

The problem I have is with using matrices for transformations in the class, should I keep matrices separate to each class? Such as have the model matrix in the model class, camera matrix in the camera class, or have all matrices placed in one class/chuck?  I could see pros and cons for each method, but I wanted to hear some input form a more professional standpoint.

sentences:
Unity3D animation trigger reset How can I reset conditions for animations using an animation controller?

I have a door that will open when a boolean property in a script is set to true. This then calls setTrigger on the animator to play the open door condition and then reset the boolean property to false. After 5 seconds I then close the door. However when I change the boolean to true again to open the door, either the setTrigger isn't working again on the animator, or the trigger for the door close is conflicting. How would I resolve this? Is there a way in the animator to set a condition to false when a particular animation has finished? Initially I was using a boolean condition in the animator but ran into the same problem. I looked at the 2D sample project which used trigger instead and assumed this would only fire once. However I guess something else could be wrong. The code in my script is as follows: (where anim is the animator component)

   void Update(){
    if (open) {
        OpenDoor();
        open = false;
    }
}

void OpenDoor(){
    anim.SetTrigger ("OpenDoor");
    Invoke("CloseDoor",5);
}

void CloseDoor(){
    anim.SetTrigger ("CloseDoor");

}

As I say the animation fires correctly the 1st time but not on subsequent times. I'm just trying this by changing the public "open" property in the inspector

thanks

sentences:
In Unity, how to hide objects from specific cameras without using Layers The situation is that there are multiple players that can collect items. When a player collects an item, the item will disappear from that player's screen but still be visible to other players. I know I can use LayerMask to achieve this effect. However, what if there are more than 32 players? (Unity Layer has 32 bits). How can I still hold this effect?

I tried using OnWillRender() to check which camera is rendering the object in order to disable its renderer. This does not work because once the renderer has been disabled, OnWillRender() will not be called again for other cameras.

sentences:
Using Volumes to reveal secret doors in UE4 C++ project I'm working on a maze project and I would like to have secret doors. My basic idea is to have the walls be destroyed when the player is both within the bounds of a trigger volume, and presses a button. I know the basic way to implement the code, but my main concern is how to handle the volumes. Should I create a class, maybe called "SecretController" that holds the code that says:

"if player is in box[i] and presses fire, destroy door[i]"

This seems like it would work, but I'd rather know before I go create a ton of stuff I'll just have to delete later. Thanks for the help folks!

sentences:
When scene loaded up, Position player at a start point. (Unity2D) If pointName and player.startPoint are true, shown by the inspector, why doesn't the player's position go to the start point with a pointName of "ToNeighborhood". Note: The code runs if pointName == player.startPoint. It isn't running even when they both contain the same string shown by the inspector

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

public class PlayerStartPoint : MonoBehaviour {

    private PlayerController player;
    private CameraController theCamera;

    public string pointName;

    // Use this for initialization
    void Start () {
        player = FindObjectOfType<PlayerController>();
        theCamera = FindObjectOfType<CameraController>();
        if (pointName == player.startPoint)
        {
            Debug.Log("Changing");
            player.transform.position = gameObject.transform.position;
            theCamera.transform.position = new Vector3(transform.position.x, transform.position.y, theCamera.transform.position.z);
        }

     }

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

    }
}

sentences:
Best way to manage weapons as GameObject on a script in Unity with C# I have a player game-object with a script Player. In the Player script I have a public properties weapons.

I want to have to just drag in this properties a script/prefabs. And the Player script must can get the properties of the weapons selected.

For example: imagine, we have two weapons, one is a pistol with 5 attack power, the other is a knife with 7 attack power.

Now I want to set pistol in the Player script.

What should I drag here ? A game-object with a weapon script ? Or a weapons script who instantiate a weapon ? Or maybe an another solution ...

The idea is to be able to create easily some weapons without scripting more. Just place a sprite, and modify some properties.

sentences:
Is "pure" OpenGL productive enough? I know that this is a difficult question and I hope I can convey my meaning. Over time I've used many different engines from XNA over Unity to Panda3d and even tried native directX once. My final impression is that an engine basically serves to do this:

implement a scene graph
offer classes like actor to add them to the scene graph
implement an asset pipeline that exports to actors or something similar
allow for custom logic scripts that hook onto the engine and are called at the right times. In Unity you can override update() in panda3d you can add methods to the taskmanager that are then called repeatedly. In Jmonkey they are called controls. It's basically the same. Additionally you can listen to physics events and the like.
then there's work done under the hood: physics, rendering and networking.

I appreciate all of these points very much and acknowledge the comfort a good engine can offer. The problem is: I'd like to create a game in a comparably young language (Google's Go) and there's no engine out there yet. Bindings for OpenGL exist and I figure I could easily hack a little engine of my own together.

The points one, two and four are not too difficult. I'd do the rendering with custom shaders anyways so that's work that has to be done in any case. For now I don't need complex physics and the standard raycast and collision check wouldn't be too hard for me. The only problem is an asset pipeline because I've got no experience in processing 3d data at all. I've only lived on the programmatical side up to now and the 3d models I've used were admittedly ugly. In the end it will probably add up to a weekend of coding and ongoing maintaining work.

The bottom-line is: I don't have to use go but then again there's no deadline for the project and I figured it might be fun to use this language. Is anyone out there still using "pure" OpenGL and can tell me about the work that lies ahead? Have you ever done this before?

Do you think that low-level OpenGL is a too complex choice for a one-man team or does the work to hack together something of my own pay off in the end ?

EDIT: You might want to read the comments below Nicol Bolas post since they explain the question a little better.

sentences:
XNA: Classes with Texture2D to be treated as one Summarised Problem:

I have an Animation class that I want to be able to treat as a Texture2D field when need be. I do not want to inherit from the class or its parents. I'd rather not create a parent class of both the animation class and a 'container' for a Texture2D, though that may be the only way to achieve what I want.

Code:

public class Animation : IComponent
{
  public Texture2D texture => frames[currentFrame];

  public Texture2D[] frames;
  public byte currentFrame { get; protected set; }
  /// <summary>
  /// Frame time in milliseconds;
  /// </summary>
  public ushort interval;
  public bool looping;
  public bool animate;

  protected ushort progress;

  /// <param name="interval">Time until frame is succeeded.</param>
  /// <param name="loop">Whether to loop frames.</param>
  /// <param name="start">Whether to start cycling through frames.</param>
  public Animation(Texture2D[] frames, ushort interval, bool loop, bool start)
  {
    this.frames = frames;
    currentFrame = 0;
    this.interval = interval;
    looping = loop;
    animate = start;
  }

  public void Update(ushort milliseconds)
  {
    if (looping)
      currentFrame = (byte)((progress += milliseconds) % interval % frames.Length);
    else
      currentFrame = (byte)((progress += milliseconds) % interval);
    progress %= interval;
  }
}

It's an extremely simple class that is subject to change. Its purpose is to stand in for a Texture2D for external handling of spreadsheets and whatnot. It is going to be used in an ECS but probably not as a component as I have it now.

So, for instance, I'd like to be able to put it as a stand in for a Texture2D in draw calls (can be done with the 'texture' property it has) and also be kept in the same field and be cast to treat it as the animation class again.

If anyone thinks there's a much superior implementation of this please let me know.

If there's a way I could do something like this that would be perfect:
spriteBatch.Draw(Anim as Texture2D, Vector2.Zero, Color.White);

sentences:
Find the Contact Normal of Rectangle Collision It seems a lot of people have asked similar questions on this site, and every time it seems like a whole bunch of answers that don't work are given.
Basically, I have two rectangles (AABBs) that collide, and I want to find out on what side they collided with each other.

I know the velocities of each object before they collide, and of course their positions before and when they've actually collided (if I use discrete collision checking that is, currently I'm using speculative). Many people say find the lowest penetration distance or take the largest speed (either horizontal or vertical) and that will give you the answer. But the collision is dependent on both of those values, I just don't know how they fit together to tell me where the collision is coming from. I don't think I need an exception for corner collisions.

I do not want to do my horizontal and vertical collisions separately as that just opens up even more problems.

So, any suggestions?

sentences:
Unity 5 - how to toggle realtime global illumination I am using Unity 5.5. Is there a way to enable and disable precomputed realtime GI at runtime? and if so, how can I do it?

The idea is that I want to set dynamic lights as a graphics quality option that the player can choose to toggle.

sentences: Collision Detection algorithm using Line Detection For a 2D physics sandbox I am working on, I need a way of detecting detecting a collision using lines. This sandbox uses a class called Particle, which has a x and a y (stored as a struct called vector2) and a velocity, which also has a x and y. Previously, to find a collision, I tried to detect if the coordinates + the velocity was where another particle's coordinates + velocity was, and then I divided the velocities by the highest velocity, then checked all the velocities incrementally, to prevent tunneling. However, I could not get this to work, and I had suspicions it would be slow when velocities were very large. I now want an algorithm that detects whether two lines (one point is the coordinates, the other is coordinates + velocity) intersect, then put the particles one space before the collision. Since this algorithm is for a physics sandbox, it has to detect any collision, including, for example, if the two lines will collide but are parallel. For simplicity's sake, I won't post the Particle class code, so feel free to create the function using whatever variables you wish (as long as they're self-explanatory)

sentences:
How to loop background music through splash screen, main menu, options menu? I am making a small game to sort of test the waters with Game Maker and I'm trying to have an mp3 play when the splash screen loads - and persist until the game either ends or the game starts (meaning splash, menu, options all play the background mp3).

I've created an object that isn't visible, but is present in my rooms (Menu, Splash, Options) that reads:

if (!sound_isplaying(BGM_Menu))
{
    sound_loop(BGM_Menu);
}

Which will, to my understanding, go through and check for whether or not the background music is playing, if not, start it. Well no music plays on any of the menu screens.

I figured I'd try something simple, to even just get my background music to play:

play_sound(BGM_Menu);

Nothing.

So then I decided I'd go to drag and drop since sound_loop and sound_play don't seem to want to work for me. What happens is, the BGM_Menu will start to play on my splash screen, then as soon as as it transfers over to my Menu room (from Splash) it starts to loop the same song over the one that's still currently playing from the splash screen.

I've tried to solve this issue for about an hour and figured I'd come here to see if anyone else has experienced this or knows a fix.

Thanks!

sentences:
Increase Precision on multiplayer location drawin I'm building a multiplayer snake-like game with Javascript. I'm having problems with the precision of the opposite players location not reacting fast enough. Which in turns makes the worm "crash", but only for some players, where the change in position happened too late due to latency.

My current game logic sends the change in direction, eg: "Up","Left" as soon as player #1 reacts.

Player #2 then receives Player#1 new direction, and sets his worm to now travel "up" (the direction received).

Since this introduces latency and that the change in direction might be applied too late, i'm wondering what other possibilities is available?

One might be to send current coordinates, or have the game loop on the server aswell, to make sure all movement changes is synced properly.

sentences: How to limit the distance of a point? I'm making an Angry Birds like game and I need to limit the distance that the user can pull back the slingshot, how do I do this?

sentences:
Suitable Client Server setup for Network Game testing I want to test my Client/Server game for which, currently, I am using localhost for both Client and Server.

Obviously I'm not getting any fluctuation in data and measure idea of performance, and in other parameters, what I wanted to ask how I would test a real world scenario:

if i create a little network with two computers or

if check that on LAN on which i am or

Are these cases (localhost included) equivalent?

or do I really need to test my game on different LANs to have reliable and realistic testing data?

How these different network setups influence the testing process?

Can somebody please suggest methods for testing the effect of network latency and packet loss on my game?

which above setup will give me more up and downs in number with LEAST setup/implementing efforts.

The game is supposed to be played on a LAN but it IS capable of more.

sentences:
What does distance divided by acceleration mean? I'm reading a book named "Programming Game AI by Example". Here's a method to help an autonomous character to slow down when it's getting closer and closer to its target:

Vector2D SteeringBehavior::Arrive(Vector2D TargetPos, Deceleration deceleration)
{
    Vector2D ToTarget = TargetPos - m_pVehicle->Pos();

    //calculate the distance to the target
    double dist = ToTarget.Length();

    if (dist > 0)
    {
        //because Deceleration is enumerated as an int, this value is required
        //to provide fine tweaking of the deceleration..
        const double DecelerationTweaker = 0.3;

        //calculate the speed required to reach the target given the desired
        //deceleration
        double speed =  dist / ((double)deceleration * DecelerationTweaker);

        //make sure the velocity does not exceed the max
        speed = min(speed, m_pVehicle->MaxSpeed());

        //from here proceed just like Seek except we don't need to normalize
        //the ToTarget vector because we have already gone to the trouble
        //of calculating its length: dist.
        Vector2D DesiredVelocity =  ToTarget * speed / dist;

        return (DesiredVelocity - m_pVehicle->Velocity());
    }

    return Vector2D(0,0);
}

For this line:

//calculate the speed required to reach the target given the desired
//deceleration
double speed =  dist / ((double)deceleration * DecelerationTweaker);

The Deceleration is an enum like this.

//Arrive makes use of these to determine how quickly a vehicle
//should decelerate to its target
  enum Deceleration{slow = 3, normal = 2, fast = 1};

I just don't understand how can it get a speed by dividing a distance by an acceleration (deceleration)? Did I misunderstand anything?

sentences:
Collision quadrant in godot appears I am learning to use godot following this video:
Collisions with Autotiles
The problem is that when I create the collision for the cliffs using tilemap, it appears me a blue quadrant indicating the collision. What should I do for what these "quadrants" do not appear?

As you can see, all the cliffs are blue for indicate me the collision, but I have no idea about what to do for hide them.

sentences:
How to get the blocks seen by the player? I'm writing a Minecraft-like game using Ogre engine and I have a problem. I must optimize my game, because when I try draw 10000 blocks, I have 2 FPS... So, I got the idea that blocks display of the plane and to hide the invisible blocks. But I have a problem - how do I know which blocks at a time are visible to the player?

And - if you know of other optimization methods for such a game, write what and how to use them in Ogre.

sentences:
A* pathfinding for dynamic obstacles and player made blockages? Hi I'm creating a TD in Unity 5 and need some help with my Pathfinding.

I'm going to use Arons A* pathfinding for my AI which enables me to use dynamic objects and update the path during run-time. However in my game I want the player to be able to block the minions with special turrets which will force the minions to attack the "block tower" instead to get past to their destination.

How could I accomplish something like this?

Image for more clarity:

sentences:
How can I ensure I still get correct touch inputs when my scene is offset? How can I accept touch input beyond the scene's bounds, so that no matter what I set self.position to, touches can still be detected?

I'm creating a tile based game from Ray Winderlich on Cocos2d version 3.0. I am at the point of setting the view of the screen to a zoomed in state on my tile map. I have successfully been able to do that although now my touches are not responding since I'm out of the coordinate space the touches used to work on.

This method is called to set the zoomed view to the player's position:

-(void)setViewPointCenter:(CGPoint)position{
    CGSize winSize = [CCDirector sharedDirector].viewSizeInPixels;
    int x = MAX(position.x, winSize.width/2);
    int y = MAX(position.y, winSize.height/2);
    x = MIN(x, (_tileMap.mapSize.width * _tileMap.tileSize.width) - winSize.width / 2);
    y = MIN(y, (_tileMap.mapSize.height * _tileMap.tileSize.height) - winSize.height / 2);
    CGPoint actualPosition = ccp(x, y);

    CGPoint centerOfView = ccp(winSize.width/2, winSize.height/2);
    NSLog(@"centerOfView%@", NSStringFromCGPoint(centerOfView));
    CGPoint viewPoint = ccpSub(centerOfView, actualPosition);
    NSLog(@"viewPoint%@", NSStringFromCGPoint(viewPoint));

    //This changes the position of the helloworld layer/scene so that
    //we can see the portion of the tilemap we're interested in.
    //That however makes my touchbegan method stop firing
    self.position = viewPoint;
}

This is what the NSLog prints from the method:

2014-01-30 07:05:08.725 TestingTouch[593:60b] centerOfView{512, 384}
2014-01-30 07:05:08.727 TestingTouch[593:60b] viewPoint{0, -832}

As you can see the y coordinate is -800. If i comment out the line self.position = viewPoint then the self.position reads {0, 0} and touches are detectable again but then we don't have a zoomed view on the character. Instead it shows the view on the bottom left of the map.

Here's a video demonstration.

How can I fix this?

Update 1

Here is the github page to my repository.

Update 2
Mark has been able to come up with a temporary solution so far by setting the hitAreaExpansion to a large number like so:

self.hitAreaExpansion = 10000000.0f;

This will cause touches to respond again all over! However, if there is a solution that would not require me to set the property with an absolute number then that would be great!

sentences: Is there a simple C++/.NET game with scripting? I would like to play around with games that use scripting to see how much easier it makes development. What --simple-- C++ or .NET game may i download and play with using a scripting language. I dont really care which scripting language it is.

sentences:
Cylindrical billboarding around an arbitrary axis in geometry shader I found an answer on this site relating to this question already, but it doesn't seem applicable in the context of my project.
Basically I'd like to create a method which fits this signature:
float3x3 AxisBillboard(float3 source, float3 target, float3 axis)

That is to say, when given a source point (i.e an object's position in world space), a target (camera position in world space), and an axis (the object's up vector, which is not necessarily the global y axis), it produces a 3x3 rotation matrix by which I can multiply the vertices of my point so that it's properly rotated.
I've found many solutions and tutorials online which work nicely assuming I only want to rotate around the y axis.
For example, here's a solution which billboards around the global y axis:
float3 dir = normalize(target - source);

float angleY = atan2(dir.x, dir.z);
c = cos(angleY);
s = sin(angleY);

float3x3 rotYMatrix;
rotYMatrix[0].xyz = float3(c, 0, s);
rotYMatrix[1].xyz = float3(0, 1, 0);
rotYMatrix[2].xyz = float3(-s, 0, c);

For context, I'm working on a grass shader, and each individual blade of grass should be billboarded to face the camera while remaining aligned with the normal of the terrain.
edit:
Thanks to @DMGregory I'm using his matrix method in the following way:
float3 viewDir = normalize(vertexPosition); // camera is at (0, 0, 0)
float3x3 billboardMatrix = transpose(AxisBillboard(worldUp, viewDir));
float3 worldPosition = vertexPosition + mul(billboardMatrix, localPosition);

This works correctly when grass is rotated to align with world space. In other rotations, grass is still billboarding 'correctly' around its local y axis but also has another rotation applied. Any ideas?

sentences:
How to clamp the rotation between two values in unity 3d How can i clamp the rotation of cube between two values and then rotate between them gradually

Details Of what i Want
When I press A or D keys cube should Rotate On Y Axis  from 0 to 13 deg gradually and when key is released cube back to straight position

sentences:
Web workers for HTML5 game physics simulation? A bit related to this question.

The idea is to guarantee the same physics behavior as much as possible. Would it be possible to run fixed time step physics on a web worker? The UI would update itself with different/variable refresh rate.

Has anyone tried such yet?

sentences:
Why aren't regular quadratic and cubic splines used much in games? After investigating a bit about splines and reading a bunch of docs, I have noticed regular quadratic and cubic splines are not used very much in games.

Splines using quadratic/cubic Bézier curves, Catmull-Rom, B-splines, and other spline interpolation methods seem to be used widely though.

I can be totally wrong here but from books and tutorials I have seen that for regular cubic/quadratic you have to solve systems including first derivative for continuity and second derivative to match curvature. It seems that the most used splines (Bézier, Catmull-Rom, etc...) implicitly bring these features with fewer calculations.

Is this the reason that regular quadratic and cubic spline interpolation are not often used in game programming?

sentences:
Impulse resolution for purely rotational collisions (relative linear velocity = 0) I've been writing a basic physics engine, (loosely) following Randy Gaul's online tutorial. I have been using this equation that he derives:

$$j=\frac{-(1+e)((V^A-V^B)*t)}{\frac{1}{{mass}^A}+\frac{1}{{mass}^B}+\frac{(r^A\times t)^2}{I^A}+\frac{(r^B\times t)^2}{I^B}}$$

(https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-oriented-rigid-bodies--gamedev-8032)

This equation works well for the majority of all collisions. However, if two objects collide through rotation and rotation alone (that is, their relative linear velocity is 0), an impulse of 0 will be applied since VA - VB is 0. This results in one object clipping into another, passing through as if it were never there. While less noticeable, this can also be a problem for collisions where relative linear velocity is non-zero, but angular velocity is much greater than relative velocity.

This is clearly not how objects would interact with real-world physics. That being said, how would I determine the "effective" relative velocity used in the equation for rotating bodies? I have already tried adding the linear velocity of the collision contact point to the center of mass velocity for both objects, but have gotten unsatisfactory results.

sentences:
Why i can not load a simple pixel shader effect (. fx) file in xna? I just want to load a simple *.fx file into my project to make a (pixel shader) effect.

But whenever I try to compile my project, I get the following error in visual studio Error List:

Errors compiling ..
ID3DXEffectCompiler: There were no techniques
ID3DXEffectCompiler: Compilation failed

I already searched on google and found many people with the same problem. And I realized that it was a problem of encoding. With the return lines unrecognized '\ n' .

I tried to copy and paste to notepad and save as with ASCII or UTF8 encoding. But the result is always the same.

Do you have an idea please ? Thanks a looot :-)

Here is my [.fx] file :

sampler BaseTexture : register(s0);
sampler MaskTexture : register(s1)
{
    addressU = Clamp;
    addressV = Clamp;
};

//All of these variables are pixel values
//Feel free to replace with float2 variables
float MaskLocationX;
float MaskLocationY;
float MaskWidth;
float MaskHeight;
float BaseTextureLocationX;  //This is where your texture is to be drawn
float BaseTextureLocationY;  //texCoord is different, it is the current pixel
float BaseTextureWidth;
float BaseTextureHeight;

float4 main(float2 texCoord : TEXCOORD0) : COLOR0
{
    //We need to calculate where in terms of percentage to sample from the MaskTexture
    float maskPixelX = texCoord.x * BaseTextureWidth + BaseTextureLocationX;
    float maskPixelY = texCoord.y * BaseTextureHeight + BaseTextureLocationY;
    float2 maskCoord = float2((maskPixelX - MaskLocationX) / MaskWidth, (maskPixelY - MaskLocationY) / MaskHeight);
    float4 bitMask = tex2D(MaskTexture, maskCoord);

    float4 tex = tex2D(BaseTexture, texCoord);

    //It is a good idea to avoid conditional statements in a pixel shader if you can use math instead.
    return tex * (bitMask.a);
    //Alternate calculation to invert the mask, you could make this a parameter too if you wanted
    //return tex * (1.0 - bitMask.a);
}

sentences:
Car licensing if real cars appear in FMV cutscenes? We are doing 2D game which will feature Full Motion Video for cutscenes in between the levels. Game is car oriented, although its not a racing game but it will feature some of the driving in it, and we would like to film some real cars for our cutscenes. There will be some "exclusive" cars on our shoot like Porsche, Lambo and Range Rover and we are really concerned about licensing logistics, especially about Porsche and whole EA exclusivity. Bear in mind that no characters will mention cars by its name or model designation and we are ready to remove any badging in post. Still concern is out there.

As far as the driving in game goes we will be using drawn sprites that only resemble physical models to some degree.

sentences: Obstacle avoidance in Bezier Curves I use an A* algorithm to find a path voiding obstacles. On obtaining the path it would be a good idea to reduce the number of points. Then I would like to typically do a spline interpolation or Bezier Curves to find a smooth path but is it not possible that post smoothening my character bumps into an obstacle? If not possible then why and if it is possible, then how do I avoid it?

sentences:
Make player to always move along the terrain I'm working on a 2D platformer side scroller game. I am giving high impulse to player, the player starts moving and if it hits a slope on terrain, it gets a vertical movement and starts to fly over (Box2D physics).

What I need is that the player should always be on the terrain and move along the ground.

I would like to know if it's possible using Box2D engine.

sentences:
Problem with Parameters for polymorphism class This is going to be a bit tricky but it is really bothering me so I hope you will have the patience to follow along :)
Here is my very basic architecture:

So in the framework, I am creating I have Actions these currently have a list of Conditions or Considerations (same thing different name).
While each Condition share some of the same functionality  such as:

Returning a float score
Using an evaluation formula

They implement these in very different ways depending on the situation.
Take a look at the following code:
[CreateAssetMenu(fileName = "Consider my health vs max health",
    menuName = "AnAppGames/AI/Example/Decisions/Health Consideration")]
public class MyHealth : BaseConsideration
{
    private float health;
    public float maxHealth;

    public override float Consider<T>(BaseAiContext context, BaseAction action, T value)
    {
        health = value as float;
        return EvaluateValues(health / maxHealth);
    }

}

What you are looking at is my first attempt at making some sort of "reusable" Consideration.
Now in the continuation of my development, I had to make the following Consideration:
public class DistanceFromMe : BaseConsideration
{
    public float minRange;
    public float maxRange;

    private float ConsiderWithValues(Transform target, Transform caller)
    {
        return EvaluateValues(new FloatData(Vector3.Distance(target.transform.position, caller.position),
            minRange,
            maxRange).GetNormalizedData());
    }

    public override float Consider<T>(BaseAiContext context, BaseAction action, T value)
    {
        Transform target = value as Transform;
        if (target == null)
        {
            return 0;
        }
        return ConsiderWithValues(target.transform, context.transform);
    }

    public override float Consider(float x)
    {
        return EvaluateValues(new FloatData(x,
            minRange,
            maxRange).GetNormalizedData());
    }

}

And now the trouble begins I thought "This is not a scaleable solution" as soon as I need more than 1 generic parameter I am screwed and have to create additional overrides of this Consider function.
So what I need is somehow to add different types of parameters to the Consideration however these parameters will vary a lot.
Another problem I have with this is that when I loop through the list I won't be able to tell what parameters i needed and how to fulfill the needs of the Consideration.
I thought of different ways of dealing with this inside the editor but I have come up empty :(
Can anyone help me out with this architectural mess? :)
It is worth mentioning that at the current point each of these are ScriptableObjects I am not 100 set in the fact that they should be but i am just not sure how to deal with this problem.

sentences:
Separating Assets in Unity Well, my question in rather simple - or so I hope. What I would like to do is separate my game assets in the Unity game engine into separate files for the build. This way not all the assets are in one large file, therefore making for easier and faster updates (don't have to re-download one large file if there's only a small change to one asset). How would I go about doing this? The best case solution would be if I could have everything separated during the final build, this way if I update one tree asset I don't need to update all tree assets, but I'm not sure if this is possible.

Example Structure:
+ A common set of assets that's loaded on startup (menu textures, trees used often, etc).
+ A set containing trees, rocks, and other foliage.
+ A set containing various scripts (AI scripts that would get updated frequently for example).

Thanks for the help!

sentences:
"Running" against a steep slope on a Box2D Platformer Ive seen alot of pages talking about how to emulate a platformer on Box2D, specially about how people dont want to slide down a slope. Well, my problem is different and Im surprised I cant find posts/solutions about it.

The problem happens when I have a very steep slope and I run against it. This is what happens:

Being the square a common platformer hero fixture, since in a Box2D platformer the movement is based on applying impulses or setting the velocity, what happens when I "move" torwards such a slope, its like im pushing against it, which creates a vertical force and therefore the square moves UP (specially since friction is 0 to avoid the "sticking to a wall" thing).

I've solved most of Box2D's non-platformer-proficient issues. This one seems unsolveable.

So, how do I avoid my object to go up a steep slope when pushed against it, and instead slide down since its too steep to be climbed?

sentences:
Where do I place XNA content pipeline references? I am relatively new to XNA, and have started to delve into the use of the content pipeline. I have already figured out that tricky issue of adding a game library containing classes for any type of .xml file I want to read.

Here's the issue. I am trying to handle the reading of all XML content through use of an XMLHandler object that uses the intermediate deserializer. Any time reading of such data is required, the appropriate method within this object would be called. So, as a simple example, something like this would occur when a character levels:

public Spell LevelUp(int levelAchived)
{
    XMLHandler.FindSkillsForLevel(levelAchived);
}

This method would then read the proper .xml file, sending back the spell for the character to learn. However, the XMLHandler is having issues even being created. I cannot get it to use the using namespace of Microsoft.Xna.Framework.Content.Pipeline. I get an error on my using statement in the XMLHandler class:

using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;

The error is a typical reference error:

  Type or namespace name "'Pipeline' does not exist in the namespace 'Microsoft.Xna.Framework.Content' (are you missing an assembly reference?)"

I THINK this is because this namespace is already referenced in my game's content. I would really have no issue placing this object within my game's content (since that is ALL it deals with anyways), but the Content project does not seem capable of holding anything but content files.

In summary, I need to use the Intermediate Deserializer in my main project's logic, but, as far as I can make out, I can't safely reference the associated namespace for it outside of the game's content. I'm not a terribly well-versed programmer, so I may be just missing some big detail I've never learned here. How can I make this object accessible for all projects within the solution? I will gladly post more information if needed!

sentences:
Events vs direct reference in Unity3D? I'm developing a simple NPC controller that the player can talk with.

At the moment a NPCController script on the NPC gameobject manages several "high level" feature of the NPC such as intelligence.

Every time the player talks with the NPC, the latter will respond with "Bzz", "Hello" or "Heya" depending on his intelligence level.

The talking part is implemented in a TalkController script. I did this way in order to have multiple behaviours depending on the player/npc interaction without creating a giant NPCController class. Plus some NPC may not speak at all (in this case I'd simply remove the TalkController).

I have a small dilemma on how to change the NPC response in TalkController based on the intelligence level in NPCController.

I could use Events:

// NPCController.cs

public delegate void OnIntelligenceLevelHandler(int level);
public static event OnIntelligenceLevelHandler OnIntelligenceLevelChanged;

// When intelligence increases
OnIntelligenceLevelChanged(2);

and:

// TalkController.cs

// Store _intelligence = 1;
// Subscribe to OnIntelligenceLevelChanged
// Upgrade _intelligence when the event fires
// Switch word on _intelligence when talking

I could use a direct reference:

// TalkController.cs

// Store _npccontroller = GetComponent<NPCController>();
// Switch word on _npccontroller.Intelligence when talking

What would be the best approach?

sentences:
How do we convert a pex file to a psc file? How do we convert a pex file to a psc file?

https://skyrim.nexusmods.com/downloads/file.php?id=2909

There used to be a file here that allegedly converted pex files to psc files, but it's no longer available, so I was wondering if there was a alternative GUI program that allows you to do this. I am trying to modify a pex file in a Skyrim mod.

sentences:
OOP implementation of BUFFS and Stats. Suggestion I am developing an MMORPG server using NodeJS.

I am not sure how to implement Buffs, i mean, equipped objects or used skills have effects on the Player() which has many Stats(), some of them have a max cap...

Effects can change the Stat value, increasing or decreasing it by a value, a percentage or completly rewrite the value of the stat.

After a while I have decided to create a base class for buffs, which can be hidden (if they are casted from an equipped object) or shown if they came from an ability (Spell).

Anyway I need suggestion how to implement it, use an array for all active buffs for a stat and have a function calculate the value of the stat affected by buffs each time I need the value of the stat or...? Other more OOP's ways to do it?

I have read this What's a way to implement a flexible buff/debuff system? but this implements only a percentage system, which buffs can only say "+10%, +20%, etc...", but I would love to have an hybrid system, which can have percentage values or static values (like WoW does), and using modifiers it's hard to implement, because modifiers refers to the current value of stat :/

Thanks for suggestions :)

sentences: How can i show all edges in monogame? I am using Monogame 3.5 and i have simple model of cube. I use BasicEffect to draw it. I want it transparent so i use effect.Alpha = 0.5f. Is it possible to show all edges something like on picture?

sentences:
Java rendering performance bottlenecks I've read a lot of forums about making 3D games in Java but I was unable to build a full picture of how it performs in video games.

I know that it works smoothly for small and average size games, but what would happen if one tried to write Crysis 3 scale game on Java? What would become the bottleneck of rendering performance? Would there be any difference at all compared with the same game written in C++? How much performance trouble would additional JNI layer give?

I would be glad to receive a detailed answer (or at least a link to some article) describing parts that JVM would never be able to optimize enough to give performance comparable with C++.

Thanks in advance.

sentences:
Unity's "Stats" window displays bizzare number of triangles and vertices In my Unity scene I have:

7-8 Barrels (with lids) each at about 2-400 triangles.
4 planes, each at at the very most 200 triangles
camera, 3 lights, a FPS controller

When I turn on the "Status" button in the lower left view port, it reports "14.1K triangles and 12.k vertices":

I've double checked everything, there's no way the elemens in the scene can amount to so many triangles. The barrels in both Blender and Unity report having the number of triangles I've specified above:

Here's a Blender screen shot:

And here's one from Unity:

I've also checked the Hierarchy panel to see if I haven't accidentally duplicated stuff which might get to be on top of stuff (such as 100 barrels all in the same position so as to look as if there's just one there), and this is not the case.

So my question is: am I misinterpreting the Unity stats window? Is it a bug in the reported triangles count there? Or am I just completely missing how all this works ?

sentences:
How do I animate pieces between puzzle states? I'm developing a simple C# puzzle game as a learning exercise, using OpenTK. It's similar to Puzzles and Dragons' puzzle part: The aim is to match 3 pieces to remove them. Removed pieces are replaced.

I have the puzzle part done such that matches are deleted and more pieces are added from the top. How can I animate tiles dropping from the top after rows/columns have been deleted? (You can see this happening about 4~5 seconds into the video on the website linked above.)

My idea was to create an "imaginary" board above the actual board so when tiles are deleted, I would in essence lower the imaginary board down, moving it further down on each frame. This brute force approach sounds like it could be done more easily with some APIs, but I've not had any luck with this.

Is there a better way to do these animations?

sentences:
Libgdx Android app: Avoid fullscreen and show titlebar I am developing an app using Libgdx and I don't want the app to go fullscreen and want to show the title bar but the app goes to fullscreen and hides title bar despite all efforts.

Here is my style.xml file

<style name="MyStyle" parent="android:Theme.Light"></style>

Here is AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyStyle" >
    <activity
        android:name="com.mygdx.game.android.AndroidLauncher1"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Here is AndroidLauncher class

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.hideStatusBar=false;
    initialize(new MyGdxGame(), config);
    setContentView(R.layout.main_activity);
    tv=(TextView)findViewById(R.id.tv);
    tv1=(TextView)findViewById(R.id.tv1);
    button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Build.VERSION.SDK_INT < 19) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
            }
            else{
                Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                intent.setType("image/*");
                startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
            }
        }
    });

}

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == SELECT_PICTURE) {
            Uri selectedImageUri = data.getData();
            selectedImagePath = getPath(selectedImageUri);
            Intent act2 = new Intent(this ,AndriodLauncher2.class);
            act2.setData(selectedImageUri);
            startActivity(act2);
        }
    }
}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

sentences:
Moving large group of units 1 by 1 takes too long, how can I improve this? I use use Unity's own NavMesh/AI system and I think it works pretty well. The only problem I have is that when I move large groups of units, they will find a path one by one, but it takes a really long time as you can see in the video:

https://gfycat.com/blankhalfdartfrog

To set destinations I use this:

    public bool SetDestination(Vector3 point)
    {
        if (SamplePosition(point))
        {
            agent.SetDestination(point);
            return true;
        }

        return false;
    }

I know I could wait until they all have pathPending == false, but that would mean the entire group moves with a huge delay. Is there some way I can improve or fix this issue?

Edit: It is quite simple to recreate (if you have some basic knowledge on Unity NavMesh): simply create a "click to move"-script that moves a List of units to where you clicked using the code above (just fill the list in Start on each unit). Put down a few obstacles and you're done.

sentences:
PHP Browser Game Private Messages? First off, I'm asking this question here because gaming and messaging are intimately connected.  Why win if you can't gloat?  Nevertheless, I won't be offended if this needs to be moved to overflow.

I need a PM system for my browser game, which already has a user and authentication system (To clarify: the game already has a user system).  Specifically, I'm wondering if a PHP library already exists that I can use to save some time.  Better yet, if anyone knows of a nice Codeigniter library for messaging, that would be perfect.

I already have a good idea on how I would approach this if I have to write my own, but it seems like something that would already exist in a robust form (despite my failed Google searches).

Requirements:

Messages can be sent to individuals,  multiple users, and guild mates (which is essentially just multiple users with server-side selecting who to target).
Users can reply to individual or all recipients
Messages appear in sender's outbox and receiver's inbox.
Utilizes some 2-table design to handle marking read / deleting messages on a user-by-user basis
Messages are semi-threaded.  I.e. I won't necessarily have them appear in the GUI as threaded, but previous messages should be included at the bottom of a reply.  Maybe better to say, previous messages are identifiable and accessible.  (This, I'm not yet 100% sure how I would design if I write my own.  I.E. whether to include the text of the previous message into the new message or somehow remember the previous message's database ID to link later)

Technology in Use: PHP, Codeigniter, Javascript, JQuery, Ajax, Sqlite

Note:
I have seen that there are some similar questions on overflow, but they were very little help in the answer department. Otherwise, people were looking for either chat boxes or more umm.. like social media site threads, which I find a bit different than something you would find in a game.

sentences:
How to demo Advanced Game AI as a portfolio piece? Basically every Game company wants to see a portfolio that exhibits your skill set.  If you're specializing in AI though, what and how should you show off your skills.
Some thoughts

Is nice graphics in an AI demo a must(get past nontechnical HR that don't understand AI, think 3d verse 2d)?
Demo multi-featured AI or a single focused example.
Fundamental skills like path-finding, hfsm, planning, etc are critical AI components but does it really impress as a portfolio piece?
Single AI entity, multiple entities, or large populations, is more always better?
Also as a portfolio piece ideally there would be an executable, and videos which should show off whatever is trying to be shown off within only a few minutes.

Examples
I would say any of the skills exhibited in this video would make for a great portfolio piece but are game companies really expecting this from a single person.

Autodesk Kynapse

AI Sandbox is another great example but this was made from the work of many many people.

AI Sandbox

Any examples of good AI portfolios would be great.

sentences:
RPG stats degrading by level I'm looking for some math to "degrade" stats over level. The idea is that if you have x value for a stat that it's affect will be less when you increase your level, making you have to put more points into that stat to maintain.

For my specific example I have a stat I call Focus. I want the Focus stat combined with the level to create a percentage. I will use this percentage against each abilities damage/heal value to get a value. This value will act as the low end and the abilities value will act as the high end for finding a random number between. So if "Strike" has a value of 10 and my focus % is 50% then then I find a random number between 5 and 10 to get the actual damage to apply.

So at level 1 ideally this % is 100% (so "Strike" will do 10 damage always). At level 2 with no more points in the Focus stat, I want this final % to go down but putting points into the Focus stat could keep it up.

This seems like the kind of thing every RPG game has, but I'm not sure how it's done. I'm picturing all stats being like this. Each level I would increase base damage/heal values for abilities by x% and then degrade other stats. Like strength for example. The idea would be to try and keep the strength state so it results in 100% of the ability damage by putting points into it each level.

Does this make sense or am I way off base in my thinking on how this kind of stuff is done or can be done?

sentences:
Should collision detection be done server-side or cooperatively between client/server? I am working on an online game that will have very heavy collision detection processing. Player models will collide with other players, mobs, structures, terrain, and solid objects that only exist server side (not stored in client data files).

For security purposes, should I do all collision detection server-side? Or should I have the client do the detection and have the server follow up on it somehow? I feel like it will be too much for the server to do by itself (I am designing the engine for hundreds of players on one server).

Does anyone know how mainstream MMOs do it? I know that almost all MMOs right now are susceptible to physics hacks and usually deal with them by detecting hacks and banning people. I would rather the hacks did not work at all, at least for the physics component.

sentences:
Unity3d OverlapSphere and raycasting problem I have a grenade (rigidbody) which make a spherecast when it detonates. On each found colliders, i will make a raycast to check if it is visible to the grenade or not.

void Explode() {

    Collider[] colliders = Physics.OverlapSphere(transform.position, radius);

    foreach(Collider coll in colliders) {

        // when the collider belongs to a player..
        if(coll.transform.GetComponent<Player_Controller>() != null) {

            RaycastHit hit;

            // ..i want to check whether its behind an obstacle or not
            if(Physics.Raycast(transform.position, (coll.transform.position - transform.position), out hit)) {

                coll.transform.GetComponent<Player_Controller>().TakeDamage();

            }

        }

    }

    Destroy(gameObject);

}

My problem is i will get the collider for all players, but when i do the raycast from the grenade to the found collider, i only hit the environment i play in. So basically my map. The grenade is laying on the ground so maybe there is an error in my raycast direction.

Edit: I solved this, the raycast was pointing not at the very bottom of the collider instead a little bit below so it was under the ground. I havent seen it unless i draw a debug ray..

sentences:
XNA: How to make the Vaus Spacecraft move left and right on directional keys pressed? I'm currently learning XNA per suggestion from this question's accepted answer:
Where to start writing games, any tutorials or the like?

I have then installed everything to get ready to work with XNA Game Studio 4.0.

  General Objective

Writing an Arkanoid-like game. I want to make my ship move when I press either left or right keys.

  Code Sample

    protected override void Update(GameTime gameTime) {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        // TODO: Add your update logic here
#if WINDOWS
        if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            this.Exit();
        else {
            if (Keyboard.GetState().IsKeyDown(Keys.Left))
                MoveLeft(gameTime);
        }
#endif

        // Move the sprite around.
        BounceEnergyBall(gameTime);

        base.Update(gameTime);
    }

    void MoveLeft(GameTime gameTime) {
        // I'm not sure how to play with the Vector2 object and its position here!...
        _vausSpacecraftPos /= _vausSpacecraftSpeed.X; // This line makes the spacecraft move diagnol-top-left.
    }

  Question

What formula shall I use, or what algorithm shall I consider to make my spaceship move as expected left and right properly?

Thanks for your thoughts! Any clue will be appreciated. I am on my learning curve though I have years of development behind me (already)!

sentences: Can a prefab of a complete Unity scene be created? Can we create a prefab out of a complete unity scene, so that we can instantiate the complete scene like we instantiate gameobjects in unity.

sentences:
What is the pixels to units property in Unity sprites used for? I'm starting to learn Unity for 2D development.

So, I am importing several sprites into the game, and I couldn't help but notice that there is a "pixels to units" property, by default on 100. I normally set it to 1. Is there a reason why I would need to have this value different than 1? Or, more generally, is there a reason to have multiple sprites with different

sentences:
How to access the currently touched instance of the Prefab? I have a prefab which is instantiated in the Scene and what I am trying to do is to disable with a touch or timeCounter but sometimes it disables all the instances of the prefab and sometimes 2 or 3 of them.

I want to disable particular object which I have touched currently.

when i am passing the collider in Destroy(hit.collider) it works perfect but how to handle it null is passed as parameter.

Here is my code:

 void Update () {
     blastingTimeCounter -= Time.deltaTime;

     if (blastingTimeCounter <= 0) {
         DestroySquare (null);
     }

     for (int i = 0; i < Input.touchCount; i++) {
         if (Input.GetTouch (i).phase == TouchPhase.Stationary) {
             hit = Physics2D.Raycast (Camera.main.ScreenToWorldPoint (
                 Input.GetTouch (i).position),
                 Vector2.zero);
             if (hit.collider != null) {
                         DestroySquare (hit.collider);
             }
         }
     }
  }

  void DestroySquare(Collider2D collider){

     if(collider == null)
     {

     }
     else{
     collider.gameObject.SetActive (false);
     blastingTimeCounter = blastingTime;
     }
   }

sentences:
2D object move & evade obstacle Description:

Actor{
    int x,y,width,height;
    float speed, angle;
}

actor is an object that move around the map
every frame, actor change position(x,y) according to it’s speed & angle

Problem:

If: Next frame actor A will collide with actor B
Then: A should turn to what angle to evade B?

sentences:
C# Script file is not showing in Onclick Event in Unity 5.0.4f1? I uploaded the levelLoader file to the gameobject. Still, when I drag the script file onClick Event, the no function is null. Why? Can anybody help me?

C# code:

using UnityEngine;
using System.Collections;

public class LevelLoader : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame

    public void LoadLevel(int a)
    {

        Application.LoadLevel(a);
    }

    public void Quit()
    {

        Application.Quit();
    }
}

Correct me where I am wrong. I am following this racing car game tutorial. At 7:58 he added this event.
Please help me!!!

sentences:
Loading texture from constructor doesn't work but does from function call I am trying to load a SDL texture through my class's constructor. All I'm doing is calling a function from the constructor to load the texture. As mentioned in the title, this does not seem to work. However, if I call the function directly then it loads fine and I can see it on the screen. I'm fairly new to C++ so please let me know what I'm doing wrong.

Game.h

#include "Player.h"

class Game {
  private:
   Player player;

  public:
   Game();
   ~Game();

   void update();
   void draw();
}

Game.cpp

#include "Game.h"

Game::Game() {
  this->player = Player("somefile.png", 0, 0, 10, 10);  // Doesn't draw
  this->player.load("somefile.png", 0, 0, 10, 10) // Will draw
}

void Game::update() { /* ... */ }

void Game::draw() { /* ... */ }

Player.h

class Player {
  private:
    SDL_Texture* texture;
    SDL_Rect source, destination;

  public:
    Player();
    Player(const std::string& filepath, const int x, const int y, const int w, const int h);
    ~Player();

    void load(const std::string& filepath, const int x, const int y, const int w, const int h);

    void update();
    void draw();
  }

Player.cpp

#include "Player.h"

Player::Player() {}

Player::Player(const std::string& filepath, const int x, const int y, const int w, const int h) {
  this->load(filepath, x, y, w, h);
}

void Player::load(const std::string& filepath, const int x, const int y, const int w, const int h) {
  this->texture = SDL_CreateTextureFromSurface(renderer, IMG_Load(filepath.c_str());

  if (this->texture != nullptr) {
    this->source = { x, y, w, h};
    this->destination = { 0, 0, w, h};
  }
  else {
    std::cout << "Could not load image." << std::endl;
  }
}

void Player::update() { /* ... */ }

void Player::draw() { /* ... */ }

In Game.cpp, if I use the line with the constructor then nothing draws in the window. If I use the line that has load(), then it works fine. I never get the Could not load image. error in either cases.

sentences:
When to unload graphics object from main memory? I writing my resource mangaer, and I consider about how it can work for graphics objects (like textures, meshes). I think about this :
I want to load texture (in pseudocode):

Texture t = resMgr.GetTex("image.png");

and GetTex make something like this:

load texture from disk to main memory
create texture object (load it to gpu memory)
unload texture from main memory

I consider about 3 step, does game engines that you know unload meshes/textures after load them into gpu memory ?

sentences:
How can I export a 3D model with keyframes to use in Blender? I'm currently trying to export some 3D data and load it into Blender, but I've encountered some problems at the time of processing the meshes. They all have keyframes (nothing too complex, just texture change and rotation) but I cannot use traditional Wavefront Obj to export it, because it does not support this data.

How can I export this keyframe information in a way Blender will understand?

sentences: How do games go about designing weapon damage? In Action-RPG games, I was wondering how weapon damage numbers  and attack speeds are decided on. Do most games come up with their own or do they "steal" numbers from other games? How would I go about coming up with my own numbers?

sentences: Dynamic Shader Linkage in DirectX12? Do the dynamic shader linking concepts introduced in DirectX11 ShaderModel 5.0 still work in DirectX12? In the documentation the reflection API is still available (e.g. ID3D12LibraryReflection), claiming it is provided especially for the shader linking technology, but I couldn't find other important interfaces like ID3D11FunctionLinkingGraph or ID3D11ClassLinkage in DX12.

sentences:
Unity – How to keep sprites sharp and crisp, even while rotating How can I maintain crisp, sharp edges on sprites, while avoiding the aliasing caused by rotation?

None of the things I've tried produce a pixel-perfect non-rotated block, while allowing rotation without aliasing

Click here for the sample project, which also has some extra images in it.

Click here for my Unity Forums Thread

Ideally, this is what it would look like

From Photoshop, not Unity.

Flawless edges, smooth corners, and very faint aliasing when rotated.

Screenshot from Github project:

Row 1

Non-rotated: Perfect edges, pixelated corners

Rotated: Pixelated everywhere

Row 2

Non-rotated: Perfect edges, smooth corners.

Rotated: Pixelated edges, smooth corners

Row 3

Non-rotated: Blurry everywhere.

Rotated: Blurry everywhere

Row 4

Non-rotated: Not quite perfect edges, pixelated corners

Rotated: Blurry everywhere

Row 5 (MY BEST SOLUTION SO FAR)

Non-rotated: Semi-blurry everywhere.

Rotated: Semi-blurry everywhere

Texture for "no border padding" texture:

Texture for "with padding" texture:

Shader Method

(Note: I'm a total shader newbie)

I created a fragment shader to draw the block.

It has AA (via smoothstep) built in, and throttles it on as block is rotated (so that there is no AA when it's not rotated)

This has some problems:

A (geometry) shader doesn't seem like the correct solution for this problem at all, since I'd have to make a shader for all the geometry that has this problem.

But maybe there is a shader that can apply AA to a texture, that doesn't do anything for vertical or horizontal (non-rotated) edges?

Corners of block with AA turned off are pixelated

This doesn't seem too difficult to fix
I'd probably want it to work identically to row 2 (non-rotated)

Not sure how much AA to apply (when rotated) so that it's as sharp as possible for a given screen DPI.

I thought this is what mip maps were good for, since the highest possible res texture should be chosen. (Another reason why a texture-based solution seems best)

Other things I've tried:

Vector graphics (per Unity's vector package)

Unity's vector package required 4x MSAA to look right, which was too intensive for mobile devices

MSAA

Creates blurry graphics (is there a way around this?)

sentences:
player movement variable is not being set to false i have a player with a basic movement. when i press W he just keep on going
this my code
private void fixedupdate
{
    rigid.AddForce(new Vector3(0, 0, 10) * speed, ForceMode.Impulse);

    moveup = false;
}

sentences:
Using same buffer for vertex and index data? Is it possible to use the same buffer for both GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER?

I load both vertex data and index data into a big slab of memory, so it would be easier for me to just load it all into a single buffer. So naturally, I do like this

glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBufferData(GL_ARRAY_BUFFER, dataSize, data, usage);
glBindBuffer(GL_ARRAY_BUFFER, 0);

Is it legal to – during rendering – simply use it as both?

glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboId);
glVertexAttribPointer(...);
...
glDrawElements(mode, count, dataType, (void*)indexOffset);

I can't find anything in the spec saying it's ok to do so, but I can't find anything that says that I can't either. Googling doesn't turn up much either, but I might be looking in the wrong places.

sentences:
How can I create a flexible system for tiling a 2D RPG map? Using libgdx here.  I've just finished learning some of the basics of creating a 2D environment and using an OrthographicCamera to view it.  The tutorials I went through, however, hardcoded their tiled map in, and none made mention of how to do it any other way.  By tiled map, I mean like Final Fantasy 1, where the world map is a grid of squares, each with a different texture.

So for example, I've got a 6 tile x 6 tile map, using the following code:

Array<Tile> tiles = new Array<Tile>();

tiles.add(new Tile(new Vector2(0,5), TileType.FOREST));
tiles.add(new Tile(new Vector2(1,5), TileType.FOREST));
tiles.add(new Tile(new Vector2(2,5), TileType.FOREST));
tiles.add(new Tile(new Vector2(3,5), TileType.GRASS));
tiles.add(new Tile(new Vector2(4,5), TileType.STONE));
tiles.add(new Tile(new Vector2(5,5), TileType.STONE));

//... x5 more times.

Given the random nature of the environment, for loops don't really help as I have to start and finish a loop before I was able to do enough to make it worth setting up the loop.  I can see how a loop might be helpful for like tiling an ocean or something, but not in the above case.

The above code DOES get me my final desired output, however, if I were to decide I wanted to move a piece or swap two pieces out, oh boy, what a nightmare, even with just a 6x6 test piece, much less a 1000x1000 world map.  There must be a better way of doing this.

Someone on some post somewhere (can't find it now, of course) said to check out MapEditor.  Looks legit.  The question is, if that is the answer, how can I make something in MapEditor and have the output map plug in to a variable in my code?  I need the tiles as objects in my code, because for example, I determine whether or not a tile is can be passed through or collided with based on my TileTyle enum variable.  Are there alternative/language "native" (i.e. not using an outside tool) methods to doing this?

sentences:
Display object at different position Id' like to create impression of shaking holographic image of NPC in Unity 2018, but moving it with transform will cause unnecesary transform-rigidbody syncing, and using Rigodbody.position isn't an option for other reasons (too long to explain). I could write custom shader for moving vertices by given vector, but I'd like to keep flexibility of Standard Shader.

Is there any way to properly render object at different position than it's transform.position? I was thinking about passing custom matrix to shader, but not sure which matrix should I overwrite and if it's not gonna complicate things (like break shadows or something).

sentences:
Do old games still generate revenue for their developer companies? For the purpose of this question, let's say an "old" game is one released over 20 years ago, or for which the platform it runs on has become unavailable.

Do the developers still earn revenue off of titles this old?

If the answer is no, why aren't more of these titles made available for free (officially)?

sentences:
How to structure a non rectangular maze I have built a few mazes and are familiar with maze algorithms however all examples I have learnt from are square or rectangular.

In these mazes the code structure usally has a 2d array of maze cells and it is easy to navigate or test to adjacent cells.

How do you structure the code for a say a Y or circular shaped maze to know what the avaliable joints between cells/nodes in the maze are?

sentences:
How to synchronize moving hazards? I am trying to implement a saw blade hazard in my platformer. The saw blade simply moves from point A to point B, and back, at constant velocity. (Let's assume all saw blades move at the same velocity.)

I currently achieve this using my engine's built-in tweening functionality, which allows me to specify a start position, end position, and duration of the tween.

I start the object at position A, tween to position B, then tween it back to A.

This works well enough, but it limits what I can do with level design. There is no way for me to start the saw blades at intermediate points, which means I can't really design interesting patterns with them, for example, getting them to pass some intermediate point at the same time in their cycles.

Ideally, I'd like to be able to set the terminal points, duration of a cycle, as well as the initial configuration of the saw blades. This would allow me to start them at a pattern I want to repeat, and simply let them run.

So, my question is: How can I set up my moving hazards so that I can easily achieve and experiment with different patterns and synchronizations?

I work in Godot 3.0, but I don't think that matters. I am looking for general advice about how to set up moving hazards so that they can be synced in reliable yet highly customizable ways.

sentences:
How do i set up 9-slicing in Opengl? What is the ideal way to set up 9-slicing?

(for the people who don't know what 9-slicing is)

Let's say we have a quad, with a texture applied to it.
9-slicing is basically a way of dividing a texture in 9 parts.
The reason why we do this is to have a quad with a texture, that can be resized without the issue of having the texture all warped. we divide the edges, the corners, and the main body of the texture:

As can be seen in the pictures, we have a quad that can be scaled without warping the texture

which would look something like this(no 9-slicing):

Now, to come back to my question: How should i set up 9-slicing? should i have a multiple quads(one for the center part, one for the right edge, one for the left edge....) but then how do i specify the different texture coordinates for each quad? Another way would be to just create the quads with their texture coordinates and relative textures and then move them all toghether like a whole object. I hope someone explain me a little more about this "9 slicing" approach, since I've never used it before. Thanks everyone for the help

EDIT: (to answer HolyBlackCat)

"Another way would be to just create the quads with their texture coordinates and relative textures and then move them all toghether like a whole object."

What i wanted to say is this: I create separate quads, attach separate textures to them, render and move them at the same time:

This is, in my opinion, the most logical way to do this. Despite that, I still want to know what would be a better, faster way to do this, without having to have too many vertices for a quad

sentences:
Minecraft Bukkit Rename world and use in Java Plugin I run a Minecraft server (Bukkit 1.7.9) and would like to have a second overworld-like world, into which I can teleport players from my plugin.
I did some testing with the "world" folder:

tried to simply rename the folder, but then a new world is generated on server start (into folder "world")
moved another world with different folder name into the server directory (in addition the original world folder)
tried to change the "level-name" value in server.properties but that does just generate new nether and end folders containing the new name

But in all cases the additional world is not listed when

Bukkit.getWorlds()

is called from the plugin (of course I restarted the server after adding the world).
So now the question is how do I properly rename a world?
I was not able to find something via a search engine nor could I find a file in the world folder that contains the world's name to change it there.

I know that I could use Multiverse or a similar plugin to do what I want but I hope that there is an easier way (like the one i tried).

I hope you can understand everything, sorry that it's not the best English but I'm not a native speaker ^^ .
If I missed to tell you something you need to know please ask :)
If anything else is wrong with this post please tell me as this is my first question posted here.
Any idea or help is appreciated!

sentences: How to resize an image texture according to the size of a sprite in directx9 or slimdxDirect3d9? I want to know that is there any way of resizing our texture to the size of a sprite in slimdx direct3d9 or directx9. That is if my image size is 1024x768 and sprite size is 500x500, how can i resize the image in slimdx to display it fully on the sprite without any cropping.

sentences:
Additive Scene Loading Buttons not Becoming 'Active' I'm quite new to Unity but I'm making a game, and have created a simple Pause menu, when a key is pressed (escape), I just load a Pause scene, additively, and set that Pause scene to the active scene, however, only the buttons on the previous 'game' scene are interactive.
The mouseEnter, exit etc aren't triggering on the pause menu buttons, despite the pause menu being overlayed on top of the 'game' scene; the Pause scene being the active one and the 'game' scene buttons are still the interactive ones (i.e. register clicks, mouse overs etc).
Obviously when I open the pause menu, I want the pause menu buttons to be the interactive ones (registering clicks, mouse over etc), not the previous 'game' scene buttons.
The pause menu scene interacts perfectly when loaded additively with a scene that had no buttons.
Many thanks.

sentences:
How do we enable the swapping of function definitions, at runtime? I am developing a cross-platform game-engine with a friend, using C++, OpenGL 2 and 4, and some other low level API provided by the platform. Recently, we had an idea to adapt function definition at runtime. For example, Machine 1 provides only OpenGL 2; the engine will see that, and use only OpenGL 2 functions. Machine 2 provides OpenGl 4 ,as well, so the engine will use OpenGL 4, instead.

Our problem with this is the implementation, and how we should approach it. On first thought, we decided to use function pointers, but after trying for a bit, it led us into problems with the code. The code was hard to understand, and hard to both fix and extend. The second approach we thought about was to replace the .DLL (Windows) or .SO (Linux) file (or hot swapping). So far, we can not implement a working, stable build.

How do we enable the swapping of function definitions, at runtime?

sentences:
Global variables in a multiplayer environment I would like to know what's the best approach to solve this problem.
In a racing game, i need to create the final result chart.
In a single environment i've tought something like:

private string [] arrivalOrder;

void playerArrived(string playerName) {
   arrivalOrder[arrivalOrder.getLength()+1] = playerName;
}

I would like to know how to do in a multiplayer environment.

How the client can communicate to server "my player finishes the racing"?
Thanks

sentences:
Why is the Position Handle placed at certain distance away from vector3 unit in Unity? I have a vector3 value that I am setting in inspector and I am drawing a ray using OnDrawGizoms to draw that vector line.

However, the position handle I made using Handles API to set the vector3 value is placed certain distance away from the vector unit. It's not placed exactly at the end point of the vector line that is drawn and I am not sure why.

My goal is to just make a handle to position a vector3 value.

EDIT: For some reason, the handle is positioned correctly for y position alone but not for x and z positions.

Here is my code:

In this script, it is the localTargetPosition vector3 value that I want to make my handle for.

public class MovePlatform : MonoBehaviour
{
public Vector3 localTargetPosition = new Vector3(5, 0, 0);
public Vector3 m_initialPosition { get { return initialPosition; } set { initialPosition = value; } }
private Vector3 initialPosition, targetPosition, targetPosDebug;
public float speed = 3;
public bool loop;

void Start()
{
    initialPosition = transform.position;
    SetTargetPosition(localTargetPosition);
}

void Update()
{
    transform.position = Vector3.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime);

    if (transform.position == targetPosition)
    {
        if (loop)
        {
            SwitchDirection();
        }
    }
}

public void SwitchDirection()
{
    if (transform.position == initialPosition)
    {
        SetTargetPosition(localTargetPosition);
    }
    else
    {
        targetPosition = initialPosition;
    }
}

private void SetTargetPosition(Vector3 localPosition)
{
    targetPosition = initialPosition + transform.TransformDirection(localPosition);
    targetPosDebug = targetPosition;
}

void OnDrawGizmos()
{
    if (Application.isPlaying)
    {
        Debug.DrawLine(initialPosition, targetPosDebug, Color.red);
    }
    else
    {
        Debug.DrawRay(transform.position, transform.TransformDirection(localTargetPosition), Color.red);
    }
}
}

This is the script used for making handle:

[CustomEditor(typeof(MovePlatform)), CanEditMultipleObjects]
public class MovePlatformEditor : Editor
{
protected virtual void OnSceneGUI()
{
    MovePlatform movePlatform = (MovePlatform)target;

    Vector3 initialPosition = movePlatform.transform.TransformPoint(movePlatform.m_initialPosition);
    Vector3 targetPosition = movePlatform.transform.TransformPoint(movePlatform.localTargetPosition);

    EditorGUI.BeginChangeCheck();
    Handles.Label(targetPosition, "Target", "button");
    targetPosition = Handles.PositionHandle(targetPosition, movePlatform.transform.rotation);

    if (EditorGUI.EndChangeCheck())
    {
        Undo.RecordObject(movePlatform, "Move Handles");

        movePlatform.localTargetPosition = movePlatform.transform.InverseTransformPoint(targetPosition);
    }

    Handles.color = Color.yellow;
    //Handles.DrawLine(initialPosition, targetPosition);
}

}

sentences:
How do I make my iOS game free for users who 'like' it on Facebook? I've seen a game for free on iOS when the user 'likes' a page. Though it appears the promotion was run by Apple, not the developers of the game being given away.

How can I make my game free for a Facebook 'like'?

sentences:
OpenGL glTexImage3D not working? I'm trying to use arrax textures with opengl 3.3 since this the target version for my application. So I have to use the glTexImage3D() method instead of glTexStorage3D(). The problem is, if I use glTexImage3D() instead of glTexStorage3D() the screen is always black. The other way round, everything works. Here is how I create the array texture:

public ArrayTexture(int width, int height) {
    this.width = width;
    this.height = height;
    this.arrayTextureHandle = GL11.glGenTextures();
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, arrayTextureHandle);

        //Works perfect
        GL42.glTexStorage3D(GL30.GL_TEXTURE_2D_ARRAY, 1, GL11.GL_RGBA8, width, height, 10);
        //Doesn't work with these parameters
        //GL12.glTexImage3D(GL30.GL_TEXTURE_2D_ARRAY, 0, GL11.GL_RGBA8, width, height, 10, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);

    GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, 0);
}

public void addTexture(ScrollingSprite... sprites) {
    if(zLayerCounter + sprites.length <= MAX_LAYERS) {
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, arrayTextureHandle);

        Arrays.asList(sprites).forEach(sprite -> {
            sprite.getTexture().getTextureData().prepare();
            GL12.glTexSubImage3D(GL30.GL_TEXTURE_2D_ARRAY,
                0,                      //Mipmap number
                0, 0, zLayerCounter++, //xoffset, yoffset, zoffset
                width, height, 1,          //width, height, depth
                GL11.GL_RGBA,                 //format
                GL11.GL_UNSIGNED_BYTE,       //type
                sprite.getTexture().getTextureData().consumePixmap().getPixels()); //pointer to data

            GL11.glTexParameteri(GL30.GL_TEXTURE_2D_ARRAY, GL11.GL_TEXTURE_WRAP_S, sprite.getTextureWrapS());
            GL11.glTexParameteri(GL30.GL_TEXTURE_2D_ARRAY, GL11.GL_TEXTURE_WRAP_T, sprite.getTextureWrapT());
        });

        GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, 0);
    } else {
        throw new IllegalArgumentException("Maximum number of textures reached!");
    }
}

sentences:
Creating a random lottery system I would like the game to give all 16 characters (15 NPC + 1 player) a number: 1-16. This number stays the same no matter what and is unique only to that character so two characters cannot have the same number. At a point in the game, the character presses a button.

I need this button to generate a random number and load a scene based on the number. Example: Player's pre-determined number is "8", if the number generator generates an "8" as well, it would load the next scene (where the player has to run away from a mob) If the generator generates anything else other than "8" It will load a different scene (where the player chases an NPC)

Just to clear it up if the number generator generates 1-7 or 9-16 it will load the same scene no matter what. (Getting "9" from the generator would load the same scene as "2" would. Only when "8" is generated, would there be a separate scene)

I'm still incredibly new to Unity and coding in general, so a brief summary of what each line of code is doing would be majorly appreciated! (but not at all demanded!)

I'm most comfortable with C# so if you could have the code in that would be great!

sentences:
Jerky motion when standing on hovering object In a level of a 3D FPS I'm making, I have several floating pillars that move up and down (the x and z positions are always the same). When the player stands on one of the pillars, the motion is incredibly jerky going up, but smooth going down. I think the player is sinking into the pillar slightly and then catching up.

I've tried different colliders, all sorts of combinations with rigidbodys and character controllers. I've tried setting the pillar as a parent of the character and then having the player hover slightly. I've just hit a brick wall and would appreciate an outside perspective. Here's my code just in case the issue is in there.

Player movement

 public float walkSpeed = 6.0F;
 public float runSpeed = 10.0F;
 public float jumpSpeed = 8.0F;
 public float gravity = 20.0F;
 private Vector3 moveDirection = Vector3.zero;

 void FixedUpdate(){
     CharacterController controller = GetComponent<CharacterController>();

         moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
         moveDirection = transform.TransformDirection(moveDirection);
         moveDirection *= walkSpeed;
         if (Input.GetButtonDown("Jump")){
             moveDirection.y = jumpSpeed;
         }

         if (Input.GetButton("Sprint")){
             walkSpeed = runSpeed;
         }
         else{
             walkSpeed = 6.0F;
         }

     moveDirection.y -= gravity * Time.deltaTime;
     controller.Move(moveDirection * Time.deltaTime);
 }

 void OnCollisionStay(Collision hit) {
     if (hit.gameObject.tag == "Column") {
         transform.parent = hit.transform;
     } else {
         transform.parent = null;
     }
 }

Pillar movement

 float height;
 float speed;
 Vector3 start;
 Vector3 end;
 Vector3 startOrEnd;
 void Start(){
     speed = 0.01F;
     start = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
 }

 void Update () {
     motionControl(speed);
 }

 float randomNumber(float min, float max){
     float number = Random.Range(min, max);
     return number;
 }

 void motionControl(float speed){
     if (gameObject.transform.position == start) {
         end = new Vector3(gameObject.transform.position.x, randomNumber(0, 10), gameObject.transform.position.z);
         startOrEnd = end;
     }else if (gameObject.transform.position == end) {
         startOrEnd = start;
     }
     gameObject.transform.position = Vector3.MoveTowards(gameObject.transform.position, startOrEnd, speed);
 }

sentences:
object array positioning-LibGdx In my game,if I touch a particular object,coin objects will come out of them at random speeds and occupy random positions.

public void update(delta){
if(isTouched()&& getY()<Constants.WORLD_HEIGHT/2){
         setY(getY()+(randomSpeed * delta));
         setX(getX()-(randomSpeed/4 * delta));
         }
  }

Now I want to make this coins occupy positions in some patterns.Like if 3 coins come out,a triangle pattern or if 4 coins, rectangular pattern like that.

I tried to make it work,but coins are coming out and moved,but overlapping each other.Not able to create any patterns.
patterns like:

This is what I tried

int a = Math.abs(rndNo.nextInt() % 3)+1;//no of coins
        int no =0;

        float coinxPos = player.getX()-coins[0].getWidth()/2;
        float coinyPos = player.getY();
        int minCoinGap=20;
        switch (a) {
        case 1:
            for (int i = 0; i < coins.length; i++) {
                if (!coins[i].isCoinVisible() && no < a) {
                    coins[i].setCoinVisible(true);

                    coinxPos = coinxPos+rndNo.nextInt()%70;
                    coinyPos = coinyPos+rndNo.nextInt()%70;
                    coins[i].setPosition(coinxPos, coinyPos);
                    no++;
                }
            }
            break;
        case 2:
            for (int i = 0; i < coins.length; i++) {
                if (!coins[i].isCoinVisible() && no < a) {
                    coins[i].setCoinVisible(true);
                    coinxPos = coinxPos+minCoinGap+rndNo.nextInt()%70;
                    coinyPos = coinyPos+rndNo.nextInt()%150;
                    coins[i].setPosition(coinxPos, coinyPos);
                    no++;
                }
            }
           break:
          ......
          ......
          default:
            break;

may be this is a simple logic to implement,but I wasted a lot of time on it and got confused of how to make it work.
Any help would be appreciated.

sentences: Realistic 3D Collision Detection Implementation I understand how box collision, sphere collision, and other such collisions work. However, how would one implement realistic 3D collisions? That is, objects would interact with one another as they would in real life. For example, take a rod and a torus. Assume that the thickness of the rod is smaller than the hole in the torus. With simple collision systems, as far as I know, inserting the rod into the hole of the torus would result in a collision detection. In reality, no collision would take place. Hopefully, that explains what I am looking for.

sentences:
Only StartCoroutine of Update on child prefab functions I have a script attached to a prefab.  That prefab attached to a child and I want it to rotate the root transform.

The Update of the script executes nothing but the Coroutine of a class I wrote.
Attached is the hierarchy of the outside and inside of playmode as well as the script on the prefab and the class.

From the Editor, Not on Playmode.

and in Plamode

uiTurnTileScropt.cs

//THIS SCRIPT IS CURRENTLY ON THE CCW PREFAB

using UnityEngine;
using System.Collections;

public class uiTurnTileScript : MonoBehaviour {
public float rotSpeed = 7.0f;
public float degree = 36.0f;
public float waitTime = .3f;
private bool rotate = false;
private Quaternion newRotation = Quaternion.identity;
BlockButton clickTapBlocked ;

void Start(){
    clickTapBlocked = gameObject.AddComponent<BlockButton>();
    clickTapBlocked.bttnName = "clickTap";
    clickTapBlocked.setFalse();
}
void Update () {
    Debug.Log (transform.name);
    if(Input.GetButtonDown (clickTapBlocked.bttnName) && (!clickTapBlocked.blocked)  ){
        Debug.Log("MouseDown");
        StartCoroutine(clickTapBlocked.forTime(waitTime));
        newRotation = Quaternion.AngleAxis (transform.root.rotation.eulerAngles.z - degree, Vector3.forward);
        rotate = true;
    }
    RotateSetAmount ();
}
void RotateSetAmount(){
    Debug.Log ("In Rotate function");
    if (rotate){
        this.transform.rotation = Quaternion.Lerp(transform.root.rotation, newRotation, Time.deltaTime * rotSpeed);
        if (transform.root.rotation.eulerAngles.z <  newRotation.eulerAngles.z){
            transform.root.rotation = newRotation;
            rotate = false;
        }
    }
}
}

and the referenced class BlockButton in uiTurnTileScript.cs

using UnityEngine;
using System.Collections;

/*  This class is more intuitive if you name thie instance created ("buttonValue" +     blocked)
 *  Example: for a button in the Input Project settings with a string of Fire1  I     would name the instance fire1Blocked
 *  Declare with your other variables

    BlockButton fire1Blocked

void Start(){
    //
    Fire1Blocked = gameObject.AddComponent<BlockButton>();
    Fire1Blocked.bttnName = "Fire1Blocked";
    Fire1Blocked.setFalse();
}
 */
public class BlockButton  : MonoBehaviour  {

public string bttnName;
public bool blocked = false;

public bool setFalse(){
    blocked = false;
    return blocked;
}

public bool setTrue(){
    blocked = true;
    return blocked;
}

public IEnumerator forTime(float duration){
    Debug.Log ("I was called");
    float dur = duration;
    blocked = true;
    yield return new WaitForSeconds(dur);
    blocked = false;
}
}

In my output,no matter what I click, I get nothing but the code from the BlockButton Instance.  No debug from the Update() happens but the coroutine happens.  I am not understanding how that happens and how to implement this properly.  Any help is appreciated.

sentences:
Quaternion.LookRotation on z-up gameEngine I'm trying to implement a look rotation method, similar to Unitys one, but with the difference that in Unity, Z is forward, and in my engine, Z is up. I have an implementation where Z is forward, and I'm not able to convert it.

My "engine" is the GTA V .net Script Hook; I'm making a mod. The function is not working as expected. It gives wrong rotations, and I think it's because of the different coordinate systems, as I said above.

This is the function, currently:

private static Quaternion LookRotation(Vector3 forward, Vector3 up)
{
    forward = Vector3.Normalize(forward);
    Vector3 right = Vector3.Normalize(Vector3.Cross(up, forward));
    up = Vector3.Cross(forward, right);
    var m00 = right.x;
    var m01 = right.y;
    var m02 = right.z;
    var m10 = up.x;
    var m11 = up.y;
    var m12 = up.z;
    var m20 = forward.x;
    var m21 = forward.y;
    var m22 = forward.z;
    float num8 = (m00 + m11) + m22;
    var quaternion = new Quaternion();

    if (num8 > 0f)
    {
        var num = (float)Math.Sqrt(num8 + 1f);
        quaternion.w = num * 0.5f;
        num = 0.5f / num;
        quaternion.x = (m12 - m21) * num;
        quaternion.y = (m20 - m02) * num;
        quaternion.z = (m01 - m10) * num;
        return quaternion;
    }

    if ((m00 >= m11) && (m00 >= m22))
    {
        var num7 = (float)Math.Sqrt(((1f + m00) - m11) - m22);
        var num4 = 0.5f / num7;
        quaternion.x = 0.5f * num7;
        quaternion.y = (m01 + m10) * num4;
        quaternion.z = (m02 + m20) * num4;
        quaternion.w = (m12 - m21) * num4;
        return quaternion;
    }

    if (m11 > m22)
    {
        var num6 = (float)Math.Sqrt(((1f + m11) - m00) - m22);
        var num3 = 0.5f / num6;
        quaternion.x = (m10 + m01) * num3;
        quaternion.y = 0.5f * num6;
        quaternion.z = (m21 + m12) * num3;
        quaternion.w = (m20 - m02) * num3;
        return quaternion;
    }

    var num5 = (float)Math.Sqrt(((1f + m22) - m00) - m11);
    var num2 = 0.5f / num5;
    quaternion.x = (m20 + m02) * num2;
    quaternion.y = (m21 + m12) * num2;
    quaternion.z = 0.5f * num5;
    quaternion.w = (m01 - m10) * num2;

    return quaternion;
}

As a workaround, I'm doing this:

velocityQuaternion = MathR.LookAt(Vector3.Zero, entity.velocity);

but it gives the wrong rotations when the entity rotates at extreme angles (when it rolls over, for example). LookAt is much like Transform.LookAt, in Unity.

I'm trying to use LookRotation like this:

 velocityQuaternion = MathR.LookRotation(veh.Velocity, Vector3.WorldUp);
 // Vector3.WorldUp is (0f,0f,1f)

 targetCamera.Position = veh.Position + (velocityQuaternion * Vector3.RelativeBack * distance); // Vector3.RelativeBack is (0, -1, 0)

The camera shuold be placed rear the vehicle when it goes forward, but instead, it's placed at the right, so you see the bottom side of the vehicle instead of rear (the camera places below the floor itself). If I use the vehicle quarternion instead of velocityQuaternion it works fine

I think this can be useful to determine what the diffrerences between coordinate systems are:

These ones are of the engine I currently use:

    // GTAV script hook vector3 shortcuts
    Back vector. (0,-1,0)
    Bottom vector. (0,0,-1)
    Front vector. (0,1,0)
    Left vector.(-1,0,0)
    Right vector. (1,0,0)
    Top vector. (0,0,1)

And these ones are of unity (which is left handed) (LookRotation was originally written for this coordinate system)

   // Unity vector3 shortcuts
   back => (0, 0, -1).
   down => (0, -1, 0).
   forward => (0, 0, 1).
   left => (-1, 0, 0).
   right => (1, 0, 0).
   up => (0, 1, 0).

What am I doing wrong?

sentences:
error after changing the app name I have made a game in Libgdx(eclipse).I changed the name of the app inside the
string.xml file.Now I have an error in AndroidManifest.xml. in this line:
  android:label="@string/app_name" (line 12).
its written:" No resource found that matches the given name (at 'label' with value '@string/app_name')."
what is the solution?

sentences:
How do Action RPGs make different weapon types feel unique? I'm getting feedback on my game which has Action RPG elements (think Diablo, Torchlight, etc.) but you control a team of heroes.  When you kill enemies sometimes new weapons will drop.  In my game the DPS of the weapon will be randomized but stronger the further you get.  Each weapon type has a hard coded range and rate of attack, but it differs between types.  As an example, every Pistol will attack once per second and every Machine Gun will attack 5 times per second.

A common complaint I'm getting is:

  The weapons needs more variety, there's not really many reasons to change weapons because they all have the same speed and small damage differences.

I'm struggling to achieve this.  I can vary speed and range for each type, and this seems like an "ok" solution but it's not good enough.  This just feels like a sliding scale that looks like this:

range <-----|-----------------> rate of attack
dps: 10

Here you can change the range and the rate of attack, but the DPS is still going to be based on the level of the enemies.  In the end, it's still not going to matter which weapon you choose because they'll all have about the same DPS.

If I make it so they don't have the same DPS, then yeah, there will be reasons to change weapons, but it'll be because some weapons suck and some weapons are good.  I don't think this puts me in a better place.

I want the player to feel like weapon type X has pros and cons over weapon type Y.  How can I achieve this?

sentences:
Text resource not loading I'm trying to load text from a .txt file into a TextAsset variable. The file is in the assets folder under Texts/. My problem is that bindata is returned as null.

string instructions;

void Start ()
{
    //LOAD TEXT ASSETS

    TextAsset bindata = Resources.Load ("Texts/Instructions") as TextAsset;
    instructions = bindata.text;
}

sentences:
libGDX: Linking 3D scene from 2D screen Using libGDX I have created a few 2D screens, such as a splash screen and a main menu, and also created a 3D scene which I want to be able to load when clicking a button on the main menu.
I know how to add a listener but I don't know what command to use to show the 3D scene on the screen. If I use setScreen(new World3D) (or other similar extended methods) it gives me:
 World3D cannot be cast to com.badlogic.gdx.Screen

What I want to know is how to get from the 2D screen to the 3D scene. Do I wrap the 3D scene inside the screen or am I doing it right but my World3D class is not set up properly?
Here is a pastebin of my World3D class in case that is the problem.

NOTE: The classes are in separate sub-packages but the proper imports have been added in the required classes.

sentences:
How do I determine if a tiled shape is closed, but without checking diagonal connections? This is a follow-up to a similar question Determine if a set of tiles on a grid forms an enclosed shape.  My needs are similar, but I do not need to check diagonal connections.  I am also using Unity.

I’ve been in the process of trying to workout if a shape is closed.  I decided to use VB.net as my language of choice.

Red = walls
Light Blue = water
Black = Towers
Dark Blue = Fill

I’ve workout the code for filling the shape using the following website

lodev.org/cgtutor/floodfill.html

As far as I’m aware the graph formula is taken from here:

  Tarjan strongly connected components algorithm

I’ve seen versions that have a list of connecting nodes in a node.  The problem with that is not all sides could be connected (e.g. a node has four sides top, right, bottom, left edges these can have a connection to another node).

Although the list will only have a maximum of four connections the order could be all over, with a list depending on what order they where inserted (yes you could order them) it’s an overload that I wanted to mitigate if all possible then I though to make this easy on checking for connections each node could have four connection variables e.g. TopConnection, RightConnection, BottomConnection and LeftConnection, this would greatly simplify checking.

Please can you let me know if I’m on the correct track, if you still think the other ways is best please can you make it in layman’s terms or I’ll get lost before you start.

sentences:
Simple Water surface simulation problems (GDC2008 Matthias Muller- Hello World) Im attempting to implement a simple height field water surface simulation outlined in Matthias Muller's GDC 2008 talk. "http://www.matthiasmueller.info/talks/gdc2008.pdf"

I can't seem to see why it my implementation doesnt work. Could anyone help? Any advice or help would be much appreciated.
The main processing loop is below
The obstruction array is initialized as 1. And the source just adds 0.1f to a point.

void wave()
    {
        for( int i = 0; i<size ; i++)
        {
            height[i] += source[i];
            height[i] *= obstruction[i];
        }

        for (int i = 1 ; i<iwidth-1 ; i++)
        {
            for(int j = 1 ; j < iheight-1 ; j++)
            {

                velocityField[indexFind(i,j)] += (height[indexFind(i-1,j)] +
                                                  height[indexFind(i+1,j)] +
                                                  height[indexFind(i,j-1)] +
                                                  height[indexFind(i,j+1)])/4 - height[indexFind(i,j)];

                velocityField[indexFind(i,j)] *= dampening;

                height[indexFind(i,j)] += velocityField[indexFind(i,j)];

            }

        }
    }

    int indexFind(int x, int y)
    {
        return (x + iwidth*y);
    }

This is what happens (height field rendered as a texture on a plane)

This is the page from the link that outlines the algorithm

sentences:
3d puzzle game generating levels I want to create a puzzle game for my first year in college.
I will use OpeGL and C++.

The point of the game is to create a path between squares that have the same color, without making the paths intersect each other.

This is the game I want to reproduce: http://mypuzzle.org/3d-logic-2

When I first told my teacher that I want to create this game, I told him I will generate levels, not store them internally.

Then when I actually give it a little thought, I realised I don't have a great idea, just a bad-medium idea (one that doesn't generate "good levels", levels that are actually hard, that use as much space as possible, levels that have multiple solutions).

So my question is:

Does anyone of you know a great idea, an algorithm, some math etc. to use it to generate good levels?

sentences:
How do you determine where the user wants to place a block in a 3d scene? I am still in the think-ahead-and-plan stage of a project where I'll want the player to be able to drag-out blocks - tiles but a minecraft-like 3D block-world.

So my question is: how can you determine where the user wants to place a block?

Here's a random minecraft screenshot I found on the internet:

My game will not be first-person camera; the user will be able to click anywhere to place a block.

If the user clicks on the centre of that green cross I've marked, which just misses the stonework to its right, where should the block be placed?

Technically determining the ray under the mouse cursor is trivial.

Given a ray and computing its distance / intersection with all existing block faces, and knowing the blocks that have previously been placed e.g. the last placed block, how can you 'do the right thing' with regards ambiguous movement?  What rule set can you use?

sentences:
Where can I find a opengl pixel shader example for smooth SpotLight? I am using Ardor3D, and find the spotlight is quite bumpy. Anybody has a good pixel shader can smooth the edges of the spot light?

thanks,

sentences:
Precision timing in Unity3d I am trying to implement a method which should be called each 10ms with a precision not less than 0.1ms (better 0.05ms). This method is very complex and it is generating sound samples which are placed to float[] buffer to be played with OnAudioFilterRead function.

I have tried both Coroutines and InvokeRepeating - both are bad, because they can call the method with period from 7ms to 13ms which is not acceptable.

The only idea I have is another Task with while() cycle checking the Time.realtimeSinceStartup permanently. But I feel like this is a bad idea.

Can you help me? Thanks.

sentences:
Unity Facebook WebGL build... Does this work or not?!?! Getting conflicting answers So here is the facebook documentation..

It seems to be saying you can output a Facebook WebGL build from Unity and upload it.
It does not work for me, I get this message when I upload.

"Games must reference one of our supported SDKs via our CDN."

Theres also this thread, with people saying it is not supported.

https://forum.unity.com/threads/facebook-instant-games-support-html5.499198/

Yet the latest version of Unity has a WebGL option when building to Facebook platform.

What is going on?
Does or doesn't this work?

sentences:
Bullet hits the object not in the center of the screen When player shoot, the bullet fly to the center of the screen. But if player stay too close to some object, then bullet hits it not in the center, because it flies from the gun on the right side of the screen. How can I fix this?

 public Rigidbody projectile;
 public int speed = 50;
 public Transform startBulletPosition;

 void Update()
 {
     if (Input.GetButtonDown("Fire1"))
     {
         Rigidbody clone;
         clone = Instantiate(projectile, startBulletPosition.position, transform.rotation) as Rigidbody;
         var centre = new Vector3(0.5f, 0.5f, 0f);
         var ray = Camera.main.ViewportPointToRay(centre);
         clone.velocity = ray.direction * speed;
     }
 }

Edit 1

sentences:
LibGdx: Texturing cube results in jagged transparent edges currently I'm in the works of programming a game - surprise xD
I'm using LibGdx for this manner but I've encountered a very unknown bug I guess.
I wasn't able to get any further by searching the internet.

If you're interested in the entire source code - it's on Github

here is the code of the Block class

package richbar.com.github.treasurepyramid.block;

public abstract class Block implements EventSubscriber, Loadable {

    public abstract String getId();

    Vector3 pos;
    String name;
    Model model;
    BoundingBox bounds;
    Texture texture;
    Material attributes;

    private boolean loadedData;
    public boolean isLoaded(){return loadedData;}

    public Block(){
        Main.getInstance().addAssetListener(this, "blocks/"+getId()+".json",    Text.class);
    }

    public Block(Block block){
        Main.getInstance().addAssetListener(this, "blocks/"+block.getId()+".json", Text.class);
        pos = block.pos;
        attributes = block.attributes;
        bounds = block.bounds;
    }

    public Model getModel(){
        if(model != null) return model;
        texture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat);
        Material material = new Material(TextureAttribute.createDiffuse(texture));
        ModelBuilder modelBuilder = new ModelBuilder();
        modelBuilder.begin();
        modelBuilder.node();
        MeshPartBuilder mesh_part_builder = modelBuilder.part("box", GL20.GL_TRIANGLES, VertexAttributes.Usage.Position
            | VertexAttributes.Usage.Normal | VertexAttributes.Usage.TextureCoordinates, material);
        BoxShapeBuilder.build(mesh_part_builder, 5, 5, 5);
        return modelBuilder.end();
    }

    boolean stayUpdated = true;
    @Override
    public void eventUpdate(Event e, Object args) {
        AssetManager manager = Main.getInstance().getAssetManager();
        if(e == Event.ASSET_LOADED && manager.isLoaded("blocks/"+getId()+".json")){
            Main.logger.log("loaded blocks/"+getId()+".json");
            stayUpdated = false;
            JsonValue json = new JsonReader().parse((manager.get("blocks/"+getId()+".json")).toString());

            name = json.getString("name");
            texture = new Texture(Gdx.files.internal(json.getString("texture")));
            loadedData = true;
        }
        //generate Cube Model if Absent
        model = getModel();
    }

    @Override
    public boolean stayUpdated() {
        return stayUpdated;
    }
}

Pic of this weird behavior     ||   Changing angles only changes the jaggedness

I'd really appreciate if anyone could help me fix this issue : )

Have a nice evening,

Marco

sentences:
Collisions between moving ball and polygons I know this is a very typical problem and that there area a lot of similar questions, but I have been looking for a while and I have not found anything that fits what I want.

I am developing a 2D game in which I need to perform collisions between a ball and simple polygons. The polygons are defined as an array of vertices.

I have implemented the collisions with the bounding boxes of the polygons (that was easy) and I need to refine that collision in the cases where the ball collides with the bounding box. The ball can move quite fast and the polygons are not too big so I need to perform continuous collisions.

I am looking for a method that allows me to detect if the ball collides with a polygon and, at the same time, calculate the new direction for the ball after bouncing in the polygon.

(I am using XNA, in case that helps)

sentences:
How do I dynamically use the rect tool in Unity2D? The rect tool in Unity2D (I honestly do not remember if it is present in Unity3D) allows you to scale down/scale up an object in just one direction (what it does is it simultaneously increases/decreases the height of an object in transform.scale and transform.position. I was trying to scale down an object while keeping its position the same using this code (P.S. I took the first four lines of code from here: The Best Way To Generate a Random Float in C#):
       float range = (double)float.MaxValue - (double)float.MinValue;
       float sample = scaleRand.NextDouble();
       float scaled = (sample * range) + float.MinValue;
       float f = (float)scaled;
        if (f > 0.6f)
        {
            f = 0.6f;
        }
            gameObject.localScale = new Vector2(gameObject.lossyScale.x, (gameObject.lossyScale.y - f));

However, this code does not work. So, how can I recreate the effect of using the rect tool in Unity Editor using C#?

sentences:
Changing one prefab changes all other instances of that prefab too I have made two prefabs of my enemies for my 2D game: normal and damaged. The I put several of these prefabs on scene. When enemies health <=0 I need to destroy its GameObject and then instantiate a damaged prefab on its position. But when I am doing this, all other prefabs are destroying too and damaged prefabs are instantiated on their positions. After searching this site I found out that any changes with one prefab are applying to all other prefabs on scene? Is this right?

P.S. I have edited the script where I am destroying prefab and added to it a simple check, if the prefabs renderer is visible on scene, then I need to destroy it, because all other prefabs are not visible at this moment. Do I need to check to make sure that this is the instance of the prefab is that I need every time when I want to apply to it some change?

sentences:
How to create a reasonable AI? I'm creating a logic game based on Fox and Hounds game. The player plays the fox and AI plays the hounds. (as far as I can see) I managed to make the AI perfect, so it never loses. Leaving it as such would not be much fun for human players.

Now, I have to dumb-down the AI so human can win, but I'm not sure how. The current AI logic is based on pattern-matching - if I introduce random moves which make the board go out of pattern space the AI would most probably play dumb until the end of the game.

Any ideas how to dumb down the AI in such way that is does not go from "genius" to "completely dumb" in a single move?

sentences:
Turning a game into a server-client game I'm redoing a game i wrote in XNA to Unity. The XNA game was the client to a server I wrote as a console application.

How does Unity work with a server exactly, and how do you set that up?

sentences:
How do I spawn enemies with a delay using threads? Right now I have this:

Thread enemySpawner = new Thread(new Runnable() {
    public void run() {
        if(world.getCurrentState() == gameState.GAME) {
            world.spawnEnemy(x, y);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
});
enemySpawner.start();

It is called in the constructor of my game. For some reason, only one enemy spawns. How do I fix this?

sentences:
Animator.SetTrigger does not trigger an Animation I have a basic animator setup for my Unity Character which has a "block" functionality when pressing the E key. So far, so good.

However I've made a transition from "Blocking Idle" to "Blocking_React" (which means that the character was hit) using a Trigger "tookDamage" (default to false).
The problem is that the character gets hit but does not transition to "Blocking_React" animation.

Code Sample:

//From Character Controller script
if (Input.GetKeyDown(KeyCode.E) && !_isBlocking)
        {
            _animator.SetBool("isBlocking", true);
            _isBlocking = true;
        }
        else if (Input.GetKeyUp(KeyCode.E) && _isBlocking)
        {
            _animator.SetBool("isBlocking", false);
            _isBlocking = false;
        }
//------------------------
//From my Character script

public void TakeDamage(float damage)
    {
        health -= damage;
        this.GetComponent<Animator>().SetTrigger("tookDamage");
    }

And this is my transition:

Am I missing something?

sentences: Is there any way to automaticaly rig a sprite? I'm making an AR test where the player takes a photo, them i get the bones from the pose and set a t-shirt sprite's bones position to match the ones from the photo. I was wondering if there's any way to make the sprite rigging process, with just the main bones like LRshoulder,LRelbow and LRHip, automatic in Unity.

sentences:
Curved movement between two points What is a good technique to enable an object to move between to points in a nice curved motion?

The end position could also be in motion, such as the trajectory of a homing missile.

sentences: Multiple inputs for Google Cardboard on iOS and Android? So far I am having a problem with having only a singular input mechanism (the magnetic trigger) for Google Cardboard games.  Are there any other options to augment this in order to have at least two or three input "buttons" or triggers for a Cardboard app or are we stuck with one?

sentences:
Atmospheric scattering and sky geometry I'm trying to implement an atmospheric scattering in my graphics (game) engine based on the GPU Gems article: link. An example implementation from that article uses a skydome. My scene is different - I don't render a whole earth with an atmosphere which can be also visible from the space but some finite flat (rectangle) area with objects, for example a race track. In fact this is the most common scenario in many games. Now I wonder how to render a sky in such case:

What kind of geometry I should use: skydome, skybox or a full screen quad - then I have to move almost all calculations to the fragment shader, but I don't know if it makes sense in terms quality/performance ?
How to place sky geometry on the scene ? My idea: I have a hemisphere (skydome) geometry with radius = 1 and center in vec3(0, 0, 0) - in object space. Those vertices are sent to the atmospheric scattering vertex shader:

layout(location=0) in vec3 inPosition;
Next, In the vertex shader I transform vertex this way:

v3Pos = inPosition * 0.25f + 10.0f;
Uniform v3CameraPos = vec3(0.0f, 10.0f, 0.0f), uniform fInnerRadius = 10.0f, uniform fCameraHeight = 10.0f

Then I have correct an inner/outer radius propotion (10/10.25),right? I also send to the vertex shader a model matrix which sets a position of the hemisphere to the postion of the mobile camera vec3(myCamera.x, myCamera.y, myCamera.z):

vec4 position = ProjectionMatrix * ViewMatrix * ModelMatrix * vec4(inPosition, 1.0);
gl_Position = position.xyww; // always fails depth test.

The hemisphere moves together with the camera (encloses only some space around camera with radius = 1, but it also always fails a depth test.)

Unfortunately a sky color which I get is not correct:

What about a "sky curve"? Here is a picture which demonstrate what I mean:

How should I set a sky curve?

Edit1 - debugging: In the vertex shader I assigned to v3Pos position of the "highest" vertex in  the hemisphere:

vec3 v3Pos = vec3(0.0f, 10.25f, 0.0f);

Now the whole sky contains a color of that vertex:

sentences:
How to make low poly ground look better I'm working in Unity and have created some low poly meshes using blender. Currently, the meshes look good, but the ground seems very lacking. I am not sure how to make it feel natural or even look good in general.

Here is a current image

The ground needs to remain mostly flat due to the game placing flat objects on the top of the plane and the image shows the exact camera angle we are using. But, as you can see in the image, the ground is extremely lacking and it doesn't look like a ground but instead just a flat background color. I've tried textures but it does not look good with the trees and low poly design.

How can I make the ground look better?

sentences:
Parallax Scrolling - Layers not preserving their relational positions I've created a little 2D game engine with parallax scrolling and something has been bugging me for some time.

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

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

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

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

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

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

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

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

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

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

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

UPDATE

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

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

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

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

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

Then, in my render function that updates every frame:

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

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

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

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

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

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

sentences:
How do I know if a perspective matrix is right or left handed coordinate system? For example, if I define my perspective matrix as the following:

m[0]  = 1.f / ( aspect * focalLength );
m[5]  = 1.f / focalLength;
m[10] = -zFar / (zFar - zNear);
m[11] = -1;
m[14] = -(zFar*zNear)/(zFar - zNear);

How can I tell if my perspective matrix is right or left handed coordinate system?

sentences:
Particles to Denote Movement in Space I'm currently working on a WebGL project to realise an idea I've had for some years. On my desk is book on making a space sim written 15 years ago.

There I found some algorithm for particles in space. The idea is simple: A cloud of particles that stay in place so they fly past the player, but reset to be in front of the player when they move past the ship. This shows the player they're moving while there's nothing else around. For this, I reworked the algorithm found in the book a little:

ParticleField.prototype.updateCloud = function(frustum, position, direction) {
  var s = this.size, s2 = s * 2;

  for (var i = 0; i < this.vertices.length; i++) {
    if (!frustum.containsPoint(this.vertices[i])) {
      this.vertices[i].set(
        (position.x + s - Math.floor(Math.random() * s2)) + (s * direction.x),
        (position.y + s - Math.floor(Math.random() * s2)) + (s * direction.y),
        (position.z + s - Math.floor(Math.random() * s2)) +
                         ((s + Math.floor(Math.random() * s2)) * direction.z)
      );
    }
  }
};

Where s is the size of cloud. I played around with the sizes, but this simple function has several weaknesses.

The particles 'pop up' in front of the player when they're moving.
If the player backs up and moves backwards, the particles won't reset, leaving the cloud visible popping the illusion.
Particles appear to be flying through the player.

Without regard of how the particles look (they're simple points right now), how can I make this look more natural? I've seen the effect in games like Elite: Dangerous and Freelancer, and I'd like to be closer to them, and I'd appreciate any hint on the topic.

sentences:
Unity Vector3 y and z Components being set 0 So I'm working on an RTS game and I'm trying to set pre-defined positions for units using my own formula. It takes the list of units and makes a position for each one in an array. The array then goes through a for loop which offsets each x position so units don't collide. The problem is that the Y and Z components are set to 0 whenever I try to get them to move. I'm not sure why because I'm not touching them.

Here it is:

Selected units list if you needed it

    public static List<GameObject> SelectedUnits;

    void MakeFormation(RaycastHit hit)
    {
        Vector3 origin = hit.point;
        float Separation = 10f;
        Vector3[] positions = new Vector3[SelectedUnits.Count];

        for(int i = 0; i < positions.Length; i++)
        {
            positions[i].x = origin.x+Separation*i;
        }
        MultiSelect(positions, origin);
    }

And the function that actually gets the units going

    void MultiSelect(Vector3[] positions, Vector3 origin)
    {
        Debug.Log(SelectedUnits);
        if (SelectedUnits.Count > 0)
        {
            for (int i= 0; i < positions.Length; i++)
            {
                Debug.Log("Moving group to area: " + positions[i].ToString("F4"));
            }

            for(int i=0; i< SelectedUnits.Count;i++)
            {

                Debug.Log("Index: " + i);
                SelectedUnits[i].GetComponent<NavMeshAgent>().SetDestination(positions[i]);
            }
        }
    }
```

sentences:
Do I need to obtain a license to use real car brands in a game? We are small team which working on car racing game but we don't know about licensing process for branded cars like Nissan, Lamborghini, Chevrolet and etc.

Do we need to buy any licence for using real car brand names, models, logos,... or we can use them for free?

Second option we think about using not real brand with real models is it possible?
If someone have experience with that, fell free to share it.
Any information about that is welcome.

sentences:
Problem in player Rotation in Unity I am trying to rotate game camera using my android device orientation.Like this  Using accelerometer input of device this may be done. But I don't know how to do this. I tried lot of methods, but failed. Anybody please help.

I am using unity 5.3 with C#.

sentences:
Recommended book for cocos2d? I'm an experienced programmer that recently got into iOS development by working through the big nerd ranch book by Aaron Hillegass and Joe Conway. I loved the way the book was structured in terms of typing in the code and doing the challenges.

I'm interested in learning more about iOS gaming and cocos2d, but am a complete newbie in terms of game development/design. There are a number of books on amazon on cocos2d, can anyone recommend one in particular?

sentences:
Copyright infringement in game title I'm a wanna-be indie developer, and I am working on my first flash game. But, before I even start with the code, I want to know this: When determining the title of my game, how can I decide if it is copyrighted or not?

For example, at first I thought about "Into the Void" for the title. When I Googled it, I found out that it is a name of a song by Black Sabbath. Is it okay if I use this title, or is it copyright infringement?

sentences:
Approximately circular range of motion on a square tile grid I've been working on a grid based tactics style game to learn the ropes of Unity. I have an issue with movement range for a player unit. Let's say the units move range is 3 spaces..
If I set up each grid tile with 4 neighbours (up down left right), I get this movement range:

If I give each tile diagonal neighbours too- 8 in total, I get this;

What I'm actually looking for is what you'd see in these type of games traditionally, like this;

Here is the code that finds the unit move range list, starting at tile (5, 5). It adds the initial tile/node and its neighbours to the movelist, then works outward looping through all their neighbours. It's based off a youtube tutorial.
public HashSet<Node> getUnitMovementOptions() {

    float[,] cost = new float[mapSizeX, mapSizeY];
    HashSet<Node> moveList = new HashSet<Node>();
    HashSet<Node> tempMoveList = new HashSet<Node>();
    HashSet<Node> finalMoveList = new HashSet<Node>();

    int moveSpeed = 3;
    Node unitStartNode = graph[5, 5];
    finalMoveList.Add(unitStartNode);

    /// Initial costs for the neighbouring nodes
    foreach (Node n in unitStartNode.neighbours) {
        cost[n.x, n.y] = costToEnterTile(n.x, n.y, unitStartNode.x, unitStartNode.y);
        if (moveSpeed - cost[n.x, n.y] >= 0) {
            moveList.Add(n);
            }
        }

    finalMoveList.UnionWith(moveList);

    while (moveList.Count != 0) {
        foreach (Node n in moveList) {
            foreach (Node neighbour in n.neighbours) {
                if (!finalMoveList.Contains(neighbour)) {
                    cost[neighbour.x, neighbour.y] = costToEnterTile(neighbour.x, neighbour.y, n.x, n.y) + cost[n.x, n.y];

                    if (moveSpeed - cost[neighbour.x, neighbour.y] >= 0) { tempMoveList.Add(neighbour); }
                    }
                }
            }

        moveList = tempMoveList;
        finalMoveList.UnionWith(moveList);
        tempMoveList = new HashSet<Node>();
        }

    Debug.Log("Total move spaces for this unit is: " + finalMoveList.Count);
    return finalMoveList;
    }

Here is the costToEnterTile function:
public float costToEnterTile(int targetX, int targetY, int sourceX, int sourceY) {

    Tile t = tileTypes[tiles[targetX, targetY]]; // get current tile type
    float cost = t.movementCost;

    // diagonal
    if (sourceX != targetX && sourceY != targetY) {
        cost += 0.3f;
    }

    return cost;
}

If I tamper with the cost value in here, I can get different results in the movement range overall shape, but it's a bit hit and miss depending on the movement range.
Can anyone offer insights in to what path I need to head down to solve this?

sentences: Merging InputProcessor and GestureDetector I'm planning to make a simple soccerball app. When I attempt to drag the ball, I use the touchDragged() from InputProcessor to move the ball left or right. Next, while holding before releasing, I use the fling() from the GestureDetector to set the power. However, when I'm trying to set the input processor of both the implementing InputProcessor and the GestureDetector, it didn't work.  Moreover, whenever the last time you set the input processor and that would be either the two of them. Why?

sentences:
How to handle MANY enemies in networked P2P game? Let's suppose a game of 4 players, one is the host.

They will fight many enemies, along the lines of 20-40 at the time. Among other things like sending their own state to the other players (position, rotation, shot this frame, crouched, etc). How do I handle the enemies?

Do the host "decides" the enemies state? (again position, rotation, isattacking, etc). And then sends several messages to the other players so they sync their own game? or do I "divide" the enemies, lets say 40, and 4 players, 10 enemies "controlled" by each player game? and then, each player sends those messages to the other players so all enemies are in sync?

Also, should I group the messages and send one big message instead of 40 little ones? How do I know how big can the message be (how many enemies info in each message)?

Basically I'm asking whats the best way to handle a 4 player p2p game with many enemies on screen.

Any good tip is appreciated.

sentences:
How to determine depth of a pixel perfect collision I am trying to figure out how to determine the depth of a pixel perfect collision in XNA.  I want to know the depth in order to be able to use it in my collision response.

At the moment I have the following code, that provides me with a working pixel perfect collision detection:

public static bool IntersectPixels(Matrix transformA, int widthA, int heightA, Color[] dataA, Matrix transformB, int widthB, int heightB, Color[] dataB)
{
    Matrix transformAToB = transformA * Matrix.Invert(transformB);

    Vector2 stepX = Vector2.TransformNormal(Vector2.UnitX, transformAToB);
    Vector2 stepY = Vector2.TransformNormal(Vector2.UnitY, transformAToB);

    // Calculate the top left corner of A in B's local space
    // This variable will be reused to keep track of the start of each row
    Vector2 yPosInB = Vector2.Transform(Vector2.Zero, transformAToB);

    // For each row of pixels in A
    for (int yA = 0; yA < heightA; yA++)
    {
        // Start at the beginning of the row
        Vector2 posInB = yPosInB;

        // For each pixel in this row
        for (int xA = 0; xA < widthA; xA++)
        {
            // Round to the nearest pixel
            int xB = (int)Math.Round(posInB.X);
            int yB = (int)Math.Round(posInB.Y);

            // If the pixel lies within the bounds of B
            if (0 <= xB && xB < widthB && 0 <= yB && yB < heightB)
            {
                // Get the colors of the overlapping pixels
                Color colorA = dataA[xA + yA * widthA];
                Color colorB = dataB[xB + yB * widthB];

                // If both pixels are not completely transparent,
                if (colorA.A != 0 && colorB.A != 0)
                {
                    // then an intersection has been found
                    return true;
                }
            }

            // Move to the next pixel in the row
            posInB += stepX;
        }

        // Move to the next row
        yPosInB += stepY;
    }

    // No intersection found
    return false;
}

How would I determine how deep the collision is into the dataB texture data?

sentences: How can I upload a pygame that I made on a website? I'm a beginner programmer and I want to know how can you upload your pygame on websites like coolmathgames or any game websites, do you upload your code after you get a deal with them? do you save it into a file and then upload it through some button? Like how does the whole thing work. Thanks!

sentences:
Unity C# - Raycasts, How to Ignore Triggers? Let's say I have a Raycast, but I don't want it to collide with any triggers. I don't want to change the Project settings since that's a little inflexible.

How can I have a Raycast ignore any triggers?

sentences:
How do I balance these numbers in a rock-paper-scissors attack system? I have three arrays of numbers. If you take a random one from x, it will 'win' more times than a random number from z, which will win more times than a number from y, which will win more times than a number from x.

However, the distribution is not equal.

y beats x 51% of the time, being beaten by x 46% of the time

x beats z 46% of the time, being beaten 42% of the time

z beats y 52% of the time, being beaten 46% of the time

How can I change these to make them approximately equal, winning more than 50% of the time?

Each array must have every number from 0 to 21, add up to the same amount (currently 735) and be of equal length. The closer the probabilities are the better, the higher the better, with as few numbers as possible.

x = [21,21,21,21,21,21,21,21,21,20,19,18,17,16,15,14,13,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,11,10,9,9,9,9,9,9,9,9,9,8,7,6,6,6,6,6,6,6,6,6,5,4,3,3,3,3,3,3,3,3,3,2,1,0]

y = [21,20,19,18,18,18,18,18,18,18,18,18,17,16,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

z = [21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,20,19,18,17,16,15,14,13,12,12,12,12,12,12,12,12,12,11,10,9,8,7,6,5,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,0]

sentences: LWJGL3 Input for single press of keyboard I am making a game with lwjgl and GLFW and am having a hard time figuring out how to check for a single press on the keyboard.

sentences:
Unity 4.6 UI button AddListener sets the same callback to all items in List I have this method that is looping through a list and sets values on the current item in the list. Everything works fine the lists values are correct exept the AddListener. All listeners on the elements are the exact same as the last element! I have no clue where to go from here. Why is all values working exept the callback? Can anyone explain this to me please.
Thanks in advance

void PopulateList() {
        foreach (var item in itemList) {
            GameObject newButton = Instantiate(sampleButton) as GameObject;
            SampleButton button = newButton.GetComponent<SampleButton>();
            button.playerLabel.text = item.PlayerName;
            button.opponentLabel.text = item.opponentName;
            //sampleButton.myTurn.SetActive(item.MyTurn);
            button.myTurn = item.MyTurn;
            button.button.onClick.RemoveAllListeners();
            button.button.onClick.AddListener(() => test(item.callbackText)); // item.callbackText is just a a string
            button.playerTurnLabel.text = item.PlayerTurnText;
            newButton.transform.SetParent (contentPanel); // sets parent of button
        }
    }

void test(string whatever) {
        Debug.Log(whatever);
    }

public class SampleButton : MonoBehaviour {

    public Button button;
    public Text playerLabel;
    public Text playerPoints;
    public Text opponentLabel;
    public Text opponentPoints;
    public bool myTurn;
    public Text playerTurnLabel;

}

sentences: How to calculate players engagement? What metrics could be used to know what certain people think about the game and how much they liked it?  I would prefer parameters that don't need players to rate by themselves. Would hours of playing in a single seat be a good parameter about how much players wanted to spend time on game?

sentences:
Can a behavior tree represent the same logic as a finite state machine? So I was just learning about Behaviour trees and I thought they're really cool. So I decided to use them in my games. But what I don't quite understand is:

Short: Can everything done in an FSM, be done in a BT?

Long: So one of the games I'm involved in has some RE (classical resident evil) mechanics. In RE, interaction with triggers could change. For ex see this video, take 2:40 as an example (it's the tiger statue puzzle from RE1) - basically, if you interact with it the first time, it says "It's a tiger statue, it appears to have holes in its eyes". If then you use the Blue gem on it, it rotates to the left (or right) revealing an item behind it, if you pickup the item you go back to the initial state. Use the red gem and it would rotate the other direction revealing another item, pickup it and you're back again. This is obviously an FSM. Here's how it looks:

So how can this tiger statue puzzle FSM be done in a BT? (if at all) - Is this more suited for an FSM? or a BT would be nice to use here as well?

Thanks for all tips/any help.

EDIT: Gamedev.net crosslink.

sentences:
Why aren't my Unity Ads showing "real" ads? I don't have "Enable Test Mode" checked under in the ads setting in Services, but when ads pop up on my published game, it's showing Unity ads as if the test mode is on. How can I fix this? Thanks!
This is the code I use to add the ads:
Advertisement.Initialize(GooglePlay_ID, GameMode);
Advertisement.Show();

sentences:
How does real-time raytracing draw reflections of off-screen geometry? I know what raytracing is, but I'm a bit curious how games are able to reflect off-screen geometry using raytracing in real-time.

I tried looking up the technical details but most of the articles are "what it is"

sentences: Why Are Some Foreign Characters Not Displaying Properly I am localizing a game for the first time and I'm noticing some characters are not displaying properly. Most are fine but there is a small handful that are not correct. For example on a loading screen I display the word Loading. In German I'm displaying Lädt. The ä character is not displayed as ä, instead isn't displayed as shown in the image. I'm running in a standalone game. I packaged a development build to see if the problem was there too but it seem localizing is not working when I package it but I can tackle that problem later unless there is a known issues with this. To change languages I am calling Set Current Culture in blueprints.

sentences:
Can't get the current animation state name (hash or .IsName) to work I have some hard times trying to get the current animation state name in Unity, to perform specific actions while I'm in a certain state.
I want to know when I'm the "ThoughtsStill" state, I only have the default layer (Base Layer):

To do this, here is what I tried:

AnimatorStateInfo curr_state = _animator.GetCurrentAnimatorStateInfo(0);
if (curr_state.shortNameHash == Animator.StringToHash("ThoughtsStill"))
{
    Debug.Log("I'm in ThoughtsStill state").
}

which is not working.

I also tried with IsName() method but it is not working too (both tried to compare "Base Layer.ThoughtsStill" and "ThoughtsStill").

I'm certain that I'm going in this ThoughtsStill state but I don't know why I can't get it.

Do you guys have any ideas or leads?

Thanks !

sentences:
When should I decide what language and platforms I will use for a project? During your development process, when is the recommended phase to decide what platform to aim for, and what language to use?

I figured that it would be better to choose at the beginning what would be your target platform, as it would affect your design decisions, and limit the language you are supposed to use.

However, I have heard several stories of people developing their game with whatever language they were the most confident with, and then porting it to the various platforms.

So, what is the best moment to choose? Before, during, after? If there is not one best choice, what factors should affect the decision?

sentences: The reasons behind Unity3D engine design (game object/transform component) I'm trying to understand the reasoning behind Unity3D engine design and this is something I can't get my head around yet: why is transform data stored in a separate component, instead of being a part of GameObject, like name, layer masks and tags? It cannot be removed like all of the other components anyway, there are no alternatives and thus no need for it to be removed.

sentences: Unity Get corners of camera in world space I'm making a 2D game and i need to get the corners of the camera in world cordinates. Is this possible in unity?

sentences:
Game maker else checks all ifs? I have a list of if functions (checking if various spots in the room are empty) in one event. I want to check them ALL with an else statement (if none of the spots are cleared), and display a message.
How would I do this?

sentences:
One or multiple VertexBuffers I'm currently working on a personal project where I'm trying to load the levels and all of the geometry from the game "Medal of Honor Allied Assault" into my own C# code-base based on SharpDX.

I managed to do all that, but now that I'm trying to cleanup the code I came across a few questions on which Google and other sites don't give me a clear answer to, hence I'm turning myself to StackExchange once more!

Currently, I'm rendering the whole scene using the following equation:
1 VBO (BSP) + 1 VBO (Terrain) + (1 VBO (Model) * NumberOfModels)

For each VBO, I'm keeping track when and where I have to start a new DrawIndexedPrimitive-call (eg. Texture-swap).

Is my current setup sufficient, or should I put everything into as less VBO's as possible? Or is there a better approach. How about culling which I'm not bothered with just yet, would one massive VBO work better for that than lots of smaller ones?

To give a little more information: some models require 3-4 Texture-swaps, are relatively small (128 vertices to 4k vertices) and I'm currently not even animating them yet.

If I'd go with my feeling, I would give everything its own VBO, arranging vertices in such a way I can batch textures and use instancing techniques, but I'm unsure this the way to go.

Feel free to ask for more information!

sentences:
Setting uniform value of a vertex shader for different sprites in a SpriteBatch I'm using libGDX and currently have a simple shader that does a passthrough, except for randomly shifting the vertex positions. This shift is a vec2 uniform that I set within my code's render() loop. It's declared in my vertex shader as uniform vec2 u_random.

I have two different kind of Sprites -- let's called them SpriteA and SpriteB. Both are drawn within the same SpriteBatch's begin()/end() calls. Prior to drawing each sprite in my scene, I check the type of the sprite.

If sprite instance of SpriteA: I set the uniform u_random value to Vector2.Zero, meaning that I don't want any vertex changes for it.
If sprite instance of SpriteB, I set the uniform u_random to Vector2(MathUtils.random(), MathUtils.random().

The expected behavior was that all the SpriteA objects in my scene won't experience any jittering, while all SpriteB objects would be jittering about their positions.

However, what I'm experiencing is that both SpriteA and SpriteB are jittering, leading me to believe that the u_random uniform is not actually being set per Sprite, and being applied to all sprites. What is the reason for this? And how can I fix this such that the vertex shader correctly accepts the uniform value set to affect each sprite individually?

passthrough.vsh

attribute vec4 a_color;
attribute vec3 a_position;
attribute vec2 a_texCoord0;

uniform mat4 u_projTrans;
uniform vec2 u_random;

varying vec4 v_color;
varying vec2 v_texCoord;

void main() {

    v_color = a_color;
    v_texCoord = a_texCoord0;

    vec3 temp_position = vec3( a_position.x + u_random.x, a_position.y + u_random.y, a_position.z);

    gl_Position = u_projTrans * vec4(temp_position, 1.0);

}

Java Code

this.batch.begin();
this.batch.setShader(shader);

for (Sprite sprite : sprites)
{
    Vector2 v = Vector2.Zero;
    if (sprite instanceof SpriteB)
    {
        v.x = MathUtils.random(-1, 1);
        v.y = MathUtils.random(-1, 1);
    }

    shader.setUniformf("u_random", v);

    sprite.draw(this.batch);
}

this.batch.end();

sentences:
How to stack sprites? I am currently working on a 2D game in Unity, I am using Animation Controllers / Animators for the different slots of armor on the character. The scripts set the Animation to the player object and that seems to work out alright for the most part.

However when I walk long distances without stopping it seems like the armor tends to drift away from the player object and I haven't been able to find out why.

// This will update the player and then update all his inventory to match his position.
public void UpdateMovement()
{
    if (IsActive == true)
    {
        float input_x = Input.GetAxisRaw("Horizontal");
        float input_y = Input.GetAxisRaw("Vertical");
        bool playerMoved = false;

        Vector2 movement = new Vector2(input_x, input_y);
        float delta = Time.deltaTime;

        if (movement != Vector2.zero)
        {
            _animator.SetBool("IsWalking", true);
            _animator.SetFloat("x", input_x);
            _animator.SetFloat("y", input_y);
            playerMoved = true;
        }
        else
        {
            _animator.SetBool("IsWalking", false);
            playerMoved = false;
        }

        PlayerController.transform.position += new Vector3(input_x, input_y, 0).normalized * delta;
        Inventory.UpdateMovement(input_x, input_y, delta, playerMoved, PlayerController.transform.position);
    }

   // This code is for each slot to update it's position.
   public void UpdateMovement(float x, float y, float time, bool isWalking, Vector3 pos)
    {
        _animator.SetBool("IsWalking", isWalking);

        if (isWalking == true)
        {

            _animator.SetFloat("x", x);
            _animator.SetFloat("y", y);
        }

        _animator.transform.position += new Vector3(x, y, 0).normalized * time;

        // _animator.transform.position = pos;
    }

So my question is, what is the best approach for layering armor sprite animations on a player in Unity 5?

sentences:
Defining collision rules in Farseer XNA I'm trying to integrate Farseer into my XNA game.
Since I'm using an EntityComponentSystem approach, I've added the Body inside a component and added it to the players' components.

One thing I'm struggling with is that I don't know how to control "collision rules".

For example,

I want Players to colide with other Players/Walls, but not move them on contact, which is what happens when I set BodyType = BodyType.Dynamic.

I want players to be able to block other players, but I what happens now is that if a player remains still, if another player runs into them, they move, physically, which is not the kind of behavior I want.

I move them by giving them a LinearVelocity, and then when I Step the World, I set the players' position to their Body's position. I tried changing BodyType = BodyType.Static, but that removed the collision between the players.

I know that if it was Unity, I'd give the object a BoxCollision2D and a RigidBody2D and it'd behave like I want. I guess that what I'm missing is the RigidBody part of the collision, but how can I implement it in Farseer?

sentences:
How can I assign a layer to tiles on an individual level? I've just started out with my first game in Unity. It's a simple 2D Platformer with a tile-based level.

When coding in the movement, I used the Physics2D.OverlapCircle() and an empty to check whether my player was touching the ground. However, I need to use a layer to make sure only the ground is detected.
my code below
//fixed update used for physics calculations
void FixedUpdate()
{
    //right or left arrows being pressed
    float moveX = Input.GetAxis("Horizontal");

    Vector2 moveDir = new Vector2(moveX * playerSpeed, rb.velocity.y);
    rb.velocity = moveDir;
}

//update used for spacebar input and force
void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        rb.velocity = Vector2.up * jumpForce*Time.deltaTime;
    }

    //is my circle overlapping any other colliders
    Collider2D collider =  Physics2D.OverlapCircle(feet.position, checkRadius, groundLayer);
    Debug.Log(collider);
}

When I tried assigning layers to my tiles, I couldn't find a way to do it.
I would be really grateful if anyone could show me how to, or if anyone can tell me a more efficient way to deal with jumping in a 2D platformer.

sentences:
How do the systems find the entities they should operate on in Entity-Component-System pattern? I have read many articles about ECS patterns. Many of them are clear on what the entity and components are  but don't really talk about the system because it "varies" or just use plain English to describe the behavior like "it finds the entities the system should work on", but how exactly that happens?

Let's say we have an Entity class which holds the all the components it needs (Transform, Texture, and Rigidbody). Now I have one system called RenderingSystem that uses Texture and Transform to render the entity to the scene. Then how would this RenderingSystem efficiently find all the Entities that need to be drawn on the scene?

sentences:
How do multiple shaders in a DirectX Engine work? So as I have been learning DirectX 11, I have been looking at a few tutorials online and in the sample code provided there are more than the usual pixel and vertex shaders (along with the geometry shaders etc..). Based on my understanding there should be minimum 2 shaders (vertex & pixel) which work together.

With these additional shaders how do they work with the vertex and pixel shaders? In these additional shaders there are alse PS and VS functions so could someone explain whats going on here? So as soon as I call the return function in one shader the data is passed to the next?

sentences:
Help with Windows RawInput I am having some trouble to receive and interpret mouse movement data from RawInput. Generally mouse input seems to work, I can query mouse buttons and receive updates of mouse movement.

The problem is that data.mouse.lLastX and data.mouse.lLastX are both 0 if the data is relative. However when the data is absolute there is no problem. Does anybody know how this can happen?

Let me know if you need some code in order to help.

sentences:
How can I write my scoring system and add a score multiplier? I am new to the scripting world and I am currently trying to add a score multiplier to the game code I am working on.

Right now the score is set to increase as the player runs across the level however I want to set it up so that the players gains X amount of score for every Y amount of distance traveled. I also want to add a multiplier for when they come into contact with certain objects X amount of time. Any help would be greatly appreciated.

sentences:
How to print Depth to a Texture2D and then read it in the next pass on a shader in DirectX11 I'm programming a two-pass effect in DirectX 11 (SharpDX). It's supposed to write the depth to a texture in the first pass and then use that texture to extract data on the second one in the pixel shader.

What I get is a white screen, with nothing but the interface and I don't know why nothing is being printed. What could be the problem? I would say I should get at least something from the Depth Texture.

This is how I'm setting the depth texture values:

this.depthBuffer = new Texture2D(device, new Texture2DDescription()
        {
            Format = Format.R32_Typeless,
            ArraySize = 1,
            MipLevels = 1,
            Width = (int)host.ActualWidth,
            Height = (int)host.ActualHeight,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
            BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.None,
        });

this.depthBufferShaderResourceView = new ShaderResourceView(this.device, this.depthBuffer, new ShaderResourceViewDescription()
        {
            Format = Format.R32_Float,
            Dimension = ShaderResourceViewDimension.Texture2D,
            Texture2D = new ShaderResourceViewDescription.Texture2DResource()
            {
                MipLevels = 1,
                MostDetailedMip = 0,
            }
        });
var depthStencilDesc = new DepthStencilStateDescription()
        {
            DepthComparison = Comparison.LessEqual,
            DepthWriteMask = global::SharpDX.Direct3D11.DepthWriteMask.All,
            IsDepthEnabled = true,
        };

And here is how I sample the depth in the .fx file:

int3 posTex = int3(input.p.xy, 0);
float depthPixel = DepthTexture.Load(posTex);
float4 color = float4(depthPixel, depthPixel , depthPixel, 1.0f );
return color;

And here the way I'm now setting the Depth Buffer stencil view as a Render Target in 2 passes. In the first I try to set the depthstencilview as a target. In the second pass I'm trying to set teh depth texture as a shader resource to read from it.

this.device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, LinesVertex.SizeInBytes, 0));

// PASS 0
this.device.ImmediateContext.OutputMerger.SetTargets(depthBufferStencilView);
this.device.ImmediateContext.ClearDepthStencilView(this.depthBufferStencilView,     DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
this.technique.GetPassByIndex(0).Apply(this.device.ImmediateContext);
this.device.ImmediateContext.DrawIndexed(this.geometry.Indices.Length, 0, 0);

// PASS 1
this.device.ImmediateContext.OutputMerger.ResetTargets(); // unbinding the depthStencilView

this.device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, LinesVertex.SizeInBytes, 0));
this.depthStencilShaderResourceVariable = effect.GetVariableByName("DepthTexture").AsShaderResource();
this.depthStencilShaderResourceVariable.SetResource(this.depthBufferShaderResourceView);
this.technique.GetPassByIndex(1).Apply(this.device.ImmediateContext);
this.device.ImmediateContext.DrawIndexed(this.geometry.Indices.Length, 0, 0);

Finally, this is how I set the two passes in the .fx file:

technique11 RenderMyTechnique
{
pass P0
{

SetDepthStencilState( DSSDepthLessEqual, 0 );
SetVertexShader     ( CompileShader( vs_4_0, VShader() ) );
    SetHullShader       ( NULL );
    SetDomainShader     ( NULL );
    SetGeometryShader   ( NULL  );
SetPixelShader      ( NULL );
}

pass P1
{
SetDepthStencilState( DSSDepthLessEqual, 0 );
SetVertexShader     ( CompileShader( vs_4_0, VShader() ) );
    SetHullShader       ( NULL );
    SetDomainShader     ( NULL );
    SetGeometryShader   ( CompileShader( gs_4_0, GShader() ) );
SetPixelShader      ( CompileShader( ps_4_0, PShader() ) );
}
}

sentences:
How can I make sure all army compositions are counterable in an RTS game? Most RTS games I played have some kind of rock-paper-scissors system that ensure that there is no single best unit you can mass and win with all the time.
However this breaks down when players start to combine different kinds of units. Just make one unit type then make the counter of its counters to protect it. Eventually players will find the best pairing that mutually protect each other, then everyone will copy that and all other combinations become inferior to that and won't see play.
We can see this in Empire Earth 1 for example, where up to middle ages all you need to do is just mass chariot/cavalry archers and swordsmen. Although spearmen and knights wreck the swords, they are destroyed by arrows. And archers are destroyed by swords, but your swords are blocked by enemy swords so you'll have hard time reach enemy archers... So all you can do is just try to make more swords and archers than the enemy.
You can also use area of effect siege weapons against archers, but they are expensive and totally wrecked by swords.
So all players use just swords and archers against everything - including buildings. This what I would like to avoid and I would like to make sure other units also see play.
So the question is: How can I make sure that not just individual unit types but but all possible combinations of them have a counter combination that costs less resources than the opponent's army?
Is there a mathematical framework for that?

sentences:
Unity5 imported models show no texture I've got a problem with Unity materials.
I'm a beginner- so I used Wings3d for creating 3d models.
But there's a little Problem.
Both objects on the picture below have the same material(a Standart Material with 0 smoothness, 0 metallic and only a only an Albedo picture)-but obviously the right one has no texture( and that's the problem).

First I ignored it and used a custom shader ("Custom/WorldCoord Diffuse) which I found in a package for fixing it. Poorly this shader doesn't support Normal or Height maps and strangely slows down my game extremly (my scene with only Standart shaders ~80 FPS | my scene with this strange shader~7 FPS).
I don't know how to write my own shaders and I don't know blender, and I don't have much time to fix this.

sentences:
Camera LookAt position with fixed screen position I have a perspective "lookAt-type" camera. I'm trying to compute specific focus point of the camera, which should be placed in the middle of the screen: I also have a custom 3d point in world space, margin values in screen space and camera's tilt as inputs. I want to compute lookAt point, & camera distance with restriction, that input world space point has to be visible in the middle of the free screen space area (not affected by margin values) and it has to have a given tilt.

I'm able to compute this in 2D, but I'm lost in 3D. Any idea how to achieve this? Here's a sketch of the problem, red and blue area's are margin values of 0.5f in both x and y direction.

sentences:
custom mesh object orientation is not correct using I am making a custom mesh with the help of Traingulator script.  At runtime, user can click and and generate a point then mesh creation start. Here is the way i am getting user input.

void Update()
    {
        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit))
        {
            if (Input.GetMouseButtonDown(0))
            {
                GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                sphere.transform.position = hit.point;
                sphere.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
                positions.Add(sphere.transform.position);
                positionsVector2.Add(new Vector2(sphere.transform.position.x, sphere.transform.position.z));

                traingulatorTester.MeshMaker(positionsVector2.ToArray());
            }
        }

    }

And here is the mesh maker function that calling tringulator

 public void MeshMaker(Vector2[] vertices2D)
    {
        // Use the triangulator to get indices for creating triangles
        Triangulator tr = new Triangulator(vertices2D);
        int[] indices = tr.Triangulate();

        // Create the Vector3 vertices
        Vector3[] vertices = new Vector3[vertices2D.Length];
        for (int i = 0; i < vertices.Length; i++)
        {
            vertices[i] = new Vector3(vertices2D[i].x, vertices2D[i].y, 0);
        }

        // Create the mesh
        Mesh msh = new Mesh();
        msh.vertices = vertices;
        msh.triangles = indices;
        msh.RecalculateNormals();
        msh.RecalculateBounds();
        if (gameObject.GetComponent<MeshRenderer>() == null)
        {
            // Set up game object with mesh;
            gameObject.AddComponent(typeof(MeshRenderer));
            filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;
        }
        filter.mesh = msh;

    }

Now the problem is the rotation of the custom mesh object is not correct look at this.

Now I have manually set the rotation.

sentences:
Store metadata for tile in Tiled Map Editor In my tilemap-based game, I need to associate lights with light switches, buttons with doors etc. I am using the Tiled map editor (mapeditor.org), but I have yet to find a way to store these associaltion. My idea is to store a number with each tile, so I can have groups of tiles that interact with each other.

Is there a way to store custom data with each tile in the Tiled map editor? Just to be clear: I don't want to store custom data with each tile type, but with individual instances of one tile type.

sentences:
Client/Server Object updates seems to run at different speeds i have been playing around with the NetworkPrediction sample from Microsoft. Trying to adapt it to use gameTime. The client is running without fixed TimeStep and the server is custom C# and updates a lot faster than client.

Both client and server runs this code at update:

protected void UpdateState(ref ShipState state, GameTime gameTime)
    {
        if (turnRightAcceleration)
            state.Rotation += (this.RotationSpeed * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
        else if (turnLeftAcceleration)
            state.Rotation -= (this.RotationSpeed * (float)gameTime.ElapsedGameTime.TotalMilliseconds);

        Vector2 shipForward = new Vector2((float)Math.Cos(state.Rotation),
                                          (float)Math.Sin(state.Rotation));

        if (trustAccelerating)
            state.Velocity += ((shipForward * this.TrustSpeed) * (float)gameTime.ElapsedGameTime.TotalMilliseconds);

        // Update the position and velocity.
        state.Position += (state.Velocity * (float)gameTime.ElapsedGameTime.TotalMilliseconds);
    }

This seems theoretically correct, every time a value is increased or decreased its affected by ElapsedGameTime.

And this is my Server Pump:

    public void Run()
    {
        foreach (GameServerComponent component in this.Components)
            component.Initialize();

        Console.WriteLine("Server running...");

        //DateTime serverStart = DateTime.Now;
        //DateTime lastUpdate = DateTime.Now;

        Stopwatch sw = Stopwatch.StartNew();
        TimeSpan lastTime = sw.Elapsed;
        GameTime gameTime;

        while (!exit)
        {
            TimeSpan currentTime = sw.Elapsed;
            TimeSpan elapsedTime = currentTime - lastTime;
            lastTime = currentTime;

            gameTime = new GameTime(currentTime, elapsedTime);

            foreach (GameServerComponent component in this.Components)
                component.Update(gameTime);
        }

        sw.Stop();
    }

This seems theoretically correct as well. Unless there is something about time management in .NET and XNA, but i cant find anything indicating it.

But the server and client updates at different rates, and the further you get from Vector 0,0 the greater the difference becomes and close to 0,0 it works quite well.
But at Vector2(-1387865f, -1158338f) the "Ship" is barley able to move. I believe this tells me the server "Clock" is running slower than the client (the ship moves slower on server than on client), but i dont understand why it would be more prominent further away from 0,0 (makes me think its the UpdateState() function I need to look at)

I dont know what to test next and I have no idea how to fix this behavior.

Please, i need ideas. Or even better, can you see something obvious wrong with the code i have?

Thank you.

Update:
This are the results from some measurements, recommended from William 'MindWorX' Mariager. Im currently trying to throttle the server to get closer to the clients updates. And i think i need to look at some performance from the client as well (later), since it seems it runs slower than 60fps atm. Ill update with results.

Server
updateCount             252092674

gameTime.TotalGameTime          {00:09:59.9810854}

avgElapsed.TotalMilliseconds        0.0021000000000000003

(float)avgElapsed.TotalMilliseconds 0.0021

Client
updateCount             24027

gameTime.TotalGameTime          {00:09:55.5527941}

avgElapsed.TotalMilliseconds        24.03

(float)avgElapsed.TotalMilliseconds 24.03

sentences:
How do I enable "look up/down" in the dialog mode? I'm developing scenario in the Virtual Battlespace 2 Virtual Tool Kit. In my scenario I need to use dialog mode for satisfying some requirements. I've successfully created dialog, and I need movement in the dialog, so that is also done.

The problem is that, if the player gets shot by a terrorist in the scenario, then the player body reacts to that impact. This causes the player head to lock in the upward and downward direction. From this position, the player can no longer look up or down. I need to close the dialog, reset ther player position and start the dialog, again.

How do I enable "look up/down" in the dialog mode?

sentences:
Terminology in a hierarchy of levels My game has a 2-tier hierarchy of levels, it is composed of 6 or more "outer levels" that consist of 8 or more "inner levels". Reaching an inner level unlocks the next inner level. Reaching the top inner level of an outer level unlocks the next outer level. The first inner levels of an outer level resemble the inner levels of the previous outer level, but each outer level has more inner levels than its predecessor.

What terms are common to refer to "outer levels" and "inner levels" in such a situation? The game is very abstract, so something like "world" for the outer level would be inappropriate.

sentences:
OpenGL ES 2.0: 2D game rendering, no performance gain with glDraw call batching I just did a small benchmark. To my surprise batching sprites into a single draw call doesn't give any significant performance boost. Following are my results:

Hardware: iPod touch 4

Extra info: OpenGL ES 2.0. 1 sprite (64x64) having some transparency (smiley face with drop shadow). NO rotation, NO scale. (Texture is bound only once at the start in the init function). Compiled in "Release" mode.

The first column labeled 'N' shows number of sprites being tested. Second column shows FPS when sprites are batched in a huge vertex array (only 1 draw call). Third column shows FPS on multi draw calls, eg: 5000 draw calls for 5000 sprites.

Benchmark 1: Alpha blending off

Benchmark 2: Alpha blending ON

Smiley image used:

Source code:

For single draw call:

Vertex hugeArray[SPRITE_COUNT*6];
GLsizei stride = sizeof(Vertex);
int drawCallCount = 0;

const GLvoid* pCoords = &hugeArray[0].Position[0];
const GLvoid* pColors = &hugeArray[0].Color[0];
const GLvoid* pTexCoords = &hugeArray[0].Texture[0];

glVertexAttribPointer(positionSlot, 2, GL_FLOAT, GL_FALSE, stride, pCoords);
glVertexAttribPointer(colorSlot, 4, GL_FLOAT, GL_FALSE, stride, pColors);
glVertexAttribPointer(textureSlot, 2, GL_FLOAT, GL_FALSE, stride, pTexCoords);

GLsizei vertexCount = sizeof(hugeArray) / sizeof(Vertex);
glDrawArrays(GL_TRIANGLES, 0, vertexCount);
drawCallCount++;

cout << "DrawCall Count: " << drawCallCount << endl;

For multiple draw calls:

Vertex hugeArray[SPRITE_COUNT*6];
GLsizei stride = sizeof(Vertex);
int drawCallCount = 0;

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

    const GLvoid* pCoords = &hugeArray[i*6].Position[0];
    const GLvoid* pColors = &hugeArray[i*6].Color[0];
    const GLvoid* pTexCoords = &hugeArray[i*6].Texture[0];

    glVertexAttribPointer(positionSlot, 2, GL_FLOAT, GL_FALSE, stride, pCoords);
    glVertexAttribPointer(colorSlot, 4, GL_FLOAT, GL_FALSE, stride, pColors);
    glVertexAttribPointer(textureSlot, 2, GL_FLOAT, GL_FALSE, stride, pTexCoords);

    GLsizei vertexCount = 6;
    glDrawArrays(GL_TRIANGLES, 0, vertexCount);
    drawCallCount++;
}
cout << "DrawCall Count: " << drawCallCount << endl;

I thought that batching sprites into a huge array resulting in a single draw call would give a HUGE performance gain but benchmarks show otherwise. Any ideas what is going on here?

Thanks for reading the question :)

sentences:
Player jitters when Jumping at object edges So I have a bit of an issue with my Player controller script. Everything works fine except with very specific jump cases. If I jump at an object and I don't reach the top edge I will just fall normally with no issue. However, when the object is short enough for me to possible jump on top of it, if I collide with its side when jumping my player will halt in that spot, jitter for a second and then fall normally.
Here is my code:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ThirdPersonPlayerController : MonoBehaviour
{
    public CharacterController controller;
    public Transform camera;
    public Transform groundCheck;

    Vector3 direction;
    Vector3 velocity;

    public float moveSpeed = 10f;
    public float turnSmoothTime = 0.1f;
    private float turnSmoothVelocity;
    public float gravity = -39.24f;
    public float groundDistance = 0.4f;
    public float jumpHeight = 3f;

    public LayerMask groundMask;
    private bool isGrounded;

    // Update is called once per frame
    // Unity is currently working on a new input system***
    private void Update()
    {
        IsPlayerGrounded();

        float horizontal = Input.GetAxisRaw("Horizontal");
        float vertical = Input.GetAxisRaw("Vertical");
        direction = new Vector3(horizontal, 0f, vertical).normalized; // direction player is moving

        if (Input.GetButtonDown("Jump") && isGrounded)
        {
            Jump();
        }

        MoveAndRotate();
        Gravity();
    }

    private void MoveAndRotate()
    {
        if (direction.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + camera.eulerAngles.y;
            float angle = Mathf.SmoothDampAngle(transform.eulerAngles.y, targetAngle, ref turnSmoothVelocity, turnSmoothTime);
            transform.rotation = Quaternion.Euler(0f, angle, 0f);

            Vector3 moveDirection = Quaternion.Euler(0f, targetAngle, 0f) * Vector3.forward;
            controller.Move(moveDirection.normalized * moveSpeed * Time.deltaTime);
        }
    }

    // Implemented proper gravity from /_\ y = 1/2g * t^2
    private void Gravity()
    {
        velocity.y += gravity * Time.deltaTime;

        controller.Move(velocity * Time.deltaTime);
    }

    // Check if player is grounded and reset velocity
    private void IsPlayerGrounded()
    {
        isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

        if (isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }
    }

    private void Jump()
    {
        velocity.y = Mathf.Sqrt(jumpHeight * -2 * gravity);
    }

    // Current issue (Not yet fixed): When jumping against a wall the player will stick/jitter (starts to jitter at the top edge).
}

Here is a visual representation of what I mean by colliding near its top edge

Any help at all is greatly appreciated. Note: I thought it had something to do with objects having the Ground layer attached to them, but the bug is still present if they don't have a layer.

sentences: What are the advantages and disadvantages of different grids in a turn-based strategy-game? The two most common types are using hexagons and squares. My question is rather concerned with game design. Why are specifically those two found so often? What are disadvantages that speak against using other polygons such as triangles, pentagons or octagons?

sentences:
libgdx images go out of proportion on some devices I'm trying to develop a simple game using libgdx. The game works perfectly on emulator ( Nexus 5x API 26 x86 ). But when I generated its apk and tested on my phone(Samsung J7), the images somehow seem to go out of proportion.

I dont know if the problem is libgdx-specific or something else is causing the problem. I suspect that the issue is about the different screen sizes or resolution.

This is how I want it to be.

This is how it appears. The images appear to be enlarged.

The app seems to work as expected on larger mobile screens but the images do not scale well to smaller screens.

Does libGdx or the android not automatically resize images according to the hardware being run on ?

Any help would be highly appreciated.

Edit :

boy = new Texture("boyfinal.png");
batch.draw(boy, Gdx.graphics.getWidth()/4 - boy.getWidth()/2, boyY  );

sentences:
How can I apply a "genie animation" to a CCSprite? I am new to Cocos2D and following this tutorial.

I want to animate a CCSprite with the genie effect that OS X uses for hiding windows to the dock and showing them again.

Here's an example from an iOS library:

How can I do this in Cocos2D?

sentences: Use a different language for engine and game Just a quick question that I haven't been able to find an answer to, I am creating an engine for a game, I have begin making the engine in C++ but I want to make the game in java. My question is, is there a way to maker my game in a different language on a separate "layer"?

sentences:
Xna GS 4 Animation Sample bone transforms not copying correctly I have a person model that is animated and a suitcase model that is not. The person can pick up the suitcase and it should move to the location of the hand bone of the person model. Unfortunately the suitcase doesn't follow the animation correctly. it moves with the hand's animation but its position is under the ground and way too far to the right. I haven't scaled any of the models myself. Thank you.
The source code (forgive the rough prototype code):

        Matrix[] tran = new Matrix[man.model.Bones.Count];// The absolute transforms from the animation player
        man.model.CopyAbsoluteBoneTransformsTo(tran);

        Vector3 suitcasePos, suitcaseScale, tempSuitcasePos = new Vector3();// Place holders for the Matrix Decompose
        Quaternion suitcaseRot = new Quaternion();

        // The transformation of the right hand bone is decomposed
        tran[man.model.Bones["HPF_RightHand"].Index].Decompose(out suitcaseScale, out suitcaseRot, out tempSuitcasePos);

        suitcasePos = new Vector3();
        suitcasePos.X = tempSuitcasePos.Z;// The axes are inverted for some reason
        suitcasePos.Y = -tempSuitcasePos.Y;
        suitcasePos.Z = -tempSuitcasePos.X;

        suitcase.Position = man.Position + suitcasePos;// The actual Suitcase properties
        suitcase.Rotation = man.Rotation + new Vector3(suitcaseRot.X, suitcaseRot.Y, suitcaseRot.Z);

I am also copying the bone transforms from the animation player in the Person class like so:

        // The transformations from the AnimationPlayer
        Matrix[] skinTrans = new Matrix[model.Bones.Count];
        skinTrans = player.GetBoneTransforms();

        // copy each transformation to its corresponding bone
        for (int i = 0; i < skinTrans.Length; i++)
        {
            model.Bones[i].Transform = skinTrans[i];
        }

EDIT:

Unfortunately I can't add screenshots, as this specific project has been lost to time. I still want to know why it didn't work, though.

sentences:
Do I need to keep the old ID3D11Device around after querying for ID3D11Device5? When attempting to create a directx11 device using the newer ID3D11Device5 interface the compiler complains that ID3D11Device5** is incompatible with ID3D11Device**.

Research via docs.microsoft (RIP msdn) says that the proper way to create a version 5 device is to call QueryInterface on a ID3D11Device to get a ID3D11Device5.

Do I need to keep the pointer to a temporary ID3D11Device around after calling QueryInterface to get a ID3D11Device5 or can I release it as shown below?

#include <array>
#include <vector>

struct AdapterInfo {
    IDXGIAdapter4* adapter = nullptr;
    DXGI_ADAPTER_DESC3 desc{};
    void Release() noexcept {
        if(adapter) {
            adapter->Release();
            adapter = nullptr;
        }
    }
};

//...

struct DeviceInfo {
    D3D_FEATURE_LEVEL highest_supported_feature_level{};
    ID3D11DeviceContext* dx_context = nullptr;
    ID3D11Device5* dx_device = nullptr;
};

//...

DeviceInfo CreateDeviceFromFirstAdapter(const std::vector<AdapterInfo>& adapters) noexcept {
    //Snip Error handling...
    DeviceInfo info{};

    unsigned int device_flags = 0U;
#ifdef _DEBUG
    device_flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
    device_flags |= D3D11_CREATE_DEVICE_BGRA_SUPPORT;

    std::array feature_levels{
    D3D_FEATURE_LEVEL_12_1,
    D3D_FEATURE_LEVEL_12_0,
    D3D_FEATURE_LEVEL_11_1,
    D3D_FEATURE_LEVEL_11_0,
    D3D_FEATURE_LEVEL_10_1,
    D3D_FEATURE_LEVEL_10_0,
    D3D_FEATURE_LEVEL_9_3,
    D3D_FEATURE_LEVEL_9_2,
    D3D_FEATURE_LEVEL_9_1,
    };

    auto first_adapter_info = std::begin(adapters);

    //Snip Debug/Logging output...

    auto first_adapter = first_adapter_info->adapter;
    bool has_adapter = first_adapter != nullptr;

    //Create a temporary "old" device
    ID3D11Device* temp_device{};
    auto hr_device = ::D3D11CreateDevice(has_adapter ? first_adapter : nullptr
        , has_adapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE
        , nullptr
        , device_flags
        , feature_levels.data()
        , static_cast<unsigned int>(feature_levels.size())
        , D3D11_SDK_VERSION
        , &temp_device
        , &info.highest_supported_feature_level
        , &info.dx_context);

    //Snip error handling...

    //Ask old device for newer interface.
    auto hr_dxdevice5i = temp_device->QueryInterface(__uuidof(ID3D11Device5), (void**)&info.dx_device);

    //Snip error handling

    //Release old device.
    temp_device->Release();
    temp_device = nullptr;
    return info;
}

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

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

sentences:
Fast method of detecting whether point is inside mesh I'm trying to construct a 3d object from a large number of particles. I think this is called BVH (Bounding volume hierarchy). I figured the best way is to draw the particles inside the mesh, then let them drop down. Repeat as often as produces suitable results.

For this, I need to check for each point whether they lie inside the 3d model. I might be using something in the order of 1 million particles, so the point-in-mesh code needs to be fast. I have some clues about creating a 2d stencil projection first, and checking against that. But I'm not really sure what's the smart way to go about this.

sentences: Unity game onto Windows 8 store I've been searching around the web to see if it is possible to submit a unity game onto the windows 8 store. All I have found so far are articles months old saying it is coming soon, can anyone give me an update if this is yet possible and how would i go about doing this?

sentences:
how do i make an object in gamemaker only overlap on one side? I am making a small flash game in game maker 8.0 pro and I need some help. In my game, the character is in an office with cubicles. I need my character to be able to walk behind and in front of the cubicles with the correct overlapping for each scenario. Here are some pics. As you can see walking up to the wall from the back looks fine but it over laps the same way walking up to the wall from the wall from the front which is a problem. If anyone could help me with this problem that'd be great. Thanks]1

edit: i resolved my issue. It turns out you can use any objects position on the y axis to set its depth with: depth=-y
you might have to adjust it slightly to account for collision masks like this:
depth=-y-32

sentences:
Tilemap collision problem I have a method here that returns true if a collision is detected between the player and tile.

            private bool CheckCollision()
    {
        foreach (CollisionTile tile in map.CollisionTiles)
        {
            if (tile.TileType == "stone" && player.rectangle.Intersects(tile.Rectangle))
            {
                return true;
            }

            if(tile.TileType == "water" && player.rectangle.Intersects(tile.Rectangle))
            {
                return true;
            }
        }
        return false;
    }

The collision detection works fine but when I try to move away from the tile I don't move at all. What could be my problem here?

              if (!CheckCollision())
        {
            player.Update();
        }

this is in my update method.

sentences:
physically based shading, how to combine specular & diffuse parts? After writing 'standard' phong & blinn shaders for a while, I recently started to dabble in physically based shading.
A resource that helped me a lot are these course notes, especially this paper - it explains how to make blinn more shading physically plausible.

I implemted the blinn model propsed in the paper, and I really like how it looks. The most significant change proposed ( imo ) is the inclusion of the fresnel reflectance, and this is also the part that gives me problems. Unfortunately, the author chose to focus on the specular part only, omitting diffuse reflectance. Given e.g. a lambertian diffuse reflection, I just don't know how to combine it with the 'improved' blinn - because just adding diffuse & specular parts does not seem to be right any more.

In some shaders I've seen a floating point 'fresnel term' in range 0 - 1 being used, based on the indices of refraction of the participating media. Schlick's approximation is used every time:

float schlick( in vec3 v0, in vec3 v1, in float n1, in float n2 )
{
    float f0 = ( n1 - n2 ) / ( n1 + n2 );
    f0 *= f0;
    return f0 + ( 1 - f0 ) * pow( dot( v0, v1 ), 5 );
}

Doing it like this, one can then linearly interpolate between diffuse and specular contribution based on the fresnel term, e.g.

float fresnel = schlick( L, H, 1.0002926 /*air*/, 1.5191 /*other material*/ );
vec3 color = mix( diffuseContrib, specularContrib, fresnel );

In the paper, the author states that this approach is incorrect
- because it basically just darkens the specular color whenever L is parallel or nearly parallel to H - and that instead of computing a f0 based on the indices of refraction, you should treat the specular color itself as f0 and have your schlick approximation compute a vec3, like this:

vec3 schlick( in vec3 v0, in vec3 v1, in vec3 spec )
{
    return spec + ( vec3( 1.0 ) - spec ) * pow( dot( v0, v1 ), 5 );
}

This results in the specular color going towards white at glancing angles.

Now my question is, how would I introduce a diffuse component into this? At 90° the specular contribution is fully white, this means all incoming light is reflected, so there can't be a diffuse contribution. For incidence angles < 90°, can I just multiply the whole diffuse part with ( vec3( 1 ) - schlick ), i.e. the proportion of light that isn't reflected?

vec3 diffuseContrib = max( dot( N, L ), 0.0 ) * kDiffuse * ( vec3( 1.0 ) - schlick( L, H, kSpec ) );

Or do I need a completely different approach?

sentences:
How to destroy a clone of an effect attached to an object? I want to use some particle effects into a bonus object that will be destroyed upon contact with the player object. This object as its name suggests will add a certain benefit for the player for a certain amount of time. I was following a tutorial on Youtube. The code from the Tutorial worked fine but there is one problem I was not able to solve: the explosion will not be destroyed after the object is collided with player and after the script is triggered because it seems that it was cloned into the scene. The instantiation created a clone of the effect's prefab I referenced into the script.
After looking into the internet, I tried to affect the instantiation of the effect into a variable called clone and then destroyed it after the bonus is over but the problem was still present. I researched and I really did not obtain any answer.

bonus.cs
//

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

public class bonus : MonoBehaviour {

public float multiplier=2.0f;
public GameObject pickup_effect;
public float duration = 10;
private GameObject clone;

private void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("Player")) StartCoroutine( pickup(other));
}

IEnumerator pickup(Collider player)
{
    Debug.Log("You picked a bonus!");
    //spawn cool effect
    clone = Instantiate(pickup_effect, transform.position, transform.rotation);
    //apply effect yo the player
    // our.score_value += 10;
    player.transform.localScale *= multiplier;
    GetComponent<MeshRenderer>().enabled=false;
    GetComponent<Collider>().enabled = false;

    //wait x amount of seconds

    yield return new WaitForSeconds(duration);

    //remove the effect from theplayer
    player.transform.localScale /= multiplier;

    Destroy(gameObject);
    Destroy(clone,4f);

}

}

//

I tried disabling the "loop" option in the effect's particle system options but it gave the same results.

I disabled the "Play on Awake" option and the effect will not play at all.

The script is added directly to the object that is a simple 3D cube with MeshCollider, Mesh Renderer and Box collider.

The effect I used is a BigExplosionEffect taken from Unity Particle Pack 5.x from the Asset Store.

I would like to know what is exactly wrong? Is it probably related to the effect itself rather than the script? Or is there a far better solution?

sentences:
Unity2D: How to destroy spawned object once it exit out of camera's view? I'm trying to destroy spawned objects once it exit out of camera view automatically/straight away. You see I'm trying to make a flappy brids type of game but things also comes in from the bottom and if they get a really high score then things will be spawned in from above and from the left side. So, so far this is what my game looks like (I'm still working on it). However I'm having problems with deleting spawned objects once it exit out of camera's view, I tried all sorts of things like:

private var hasAppeared : boolean;

function Start ()
 {
hasAppeared = false;
}

function Update()
{

if (GetComponent.<Renderer>().isVisible)
{
    hasAppeared = true;
}

if (hasAppeared)
{
    if (!GetComponent.<Renderer>().isVisible)
        {
            Destroy(gameObject);
        }
    }

}

But with this script, it doesn't destroy the game object quickly enough that and only some of them is being deleted. I also tried this method:

     public void OnBecameInvisible() {
        Destroy(gameObject);
      }

But not all of them is being deleted as well and it also takes a long time for any of my game objects to be destroyed. My last result was this script, it destroys the game object straight away once it exit out of the camera's view (which is what I want) but only these sides works where as the other's don't, I think it destroys my enemies (spawned objects)  before it has even entered the camera's view. How do I get the script to work on this side? This is my script:

void Update ()
{
    DestroyAllEnemy ();
}

public void DestroyAllEnemy()
{
    GameObject[] enemies = GameObject.FindGameObjectsWithTag ("enemy");
    if ((enemies.Length > 0) && (camera != null)) {
        for (int i = (enemies.Length - 1); i >= 0; i--) {
            // just a precaution
            if ((enemies [i] != null) && ((camera.WorldToViewportPoint (enemies [i].transform.position).x > 1.03f) ||
                (enemies [i].transform.position.y < -6f)))
            {
                Destroy (enemies [i]);
            }
        }
    }
}

Thank you :).

sentences:
Unity: GPU Instancing with different textures? I'm making use of Unity's GPU Instancing in my 2D game and it really reduces draw calls significantly when using the same Material and same sprite (texture) on all batched gameObjects.
I'm changing colors using MaterialPropertyBlock and everything works fine.
But is there a way to do that with different sprites (textures) on batched gameObjects' material?
What if I used a Sprite atlas to gather all sprites together, will that make GPU Instancing possible with different sprites?
Material's Shader:
Shader "Unlit/UnlitTransparent"
{
Properties
{
    [NoScaleOffset] _MainTex ("Texture", 2D) = "white" {}
    // "PerRendererData" this hides the property from the Material
    inspector (no performance impact, only hides property)
    [PerRendererData] _BaseColor ("Color", Color) = (1, 1, 1, 1)
}
SubShader
{
    Tags { "Queue"="Transparent" "RenderType"="Transparent"
    "IgnoreProjector"="True" "CanUseSpriteAtlas"="True" }
    ZWrite OFF
    Blend SrcAlpha OneMinusSrcAlpha
    LOD 100

    Pass
    {
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        // make fog work
        //#pragma multi_compile_fog
        #pragma multi_compile_instancing
        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
            UNITY_VERTEX_INPUT_INSTANCE_ID
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
            //UNITY_FOG_COORDS(1)
            float4 vertex : SV_POSITION;
            UNITY_VERTEX_INPUT_INSTANCE_ID
        };

        UNITY_INSTANCING_BUFFER_START(Props)
            UNITY_DEFINE_INSTANCED_PROP(fixed4, _BaseColor)
        UNITY_INSTANCING_BUFFER_END(Props)

        sampler2D _MainTex;
        float4 _MainTex_ST;

        v2f vert (appdata v)
        {
            v2f o;

            UNITY_SETUP_INSTANCE_ID(v);
            UNITY_TRANSFER_INSTANCE_ID(v, o);

            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv = v.uv;
            //UNITY_TRANSFER_FOG(o,o.vertex);
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
            UNITY_SETUP_INSTANCE_ID(i);
            // sample the texture
            fixed4 col = tex2D(_MainTex, i.uv) *
            UNITY_ACCESS_INSTANCED_PROP(Props, _BaseColor);
            // apply fog
            //UNITY_APPLY_FOG(i.fogCoord, col);
            return col;
        }
        ENDCG
    }
}
}

sentences:
Do two balls of different mass bounce different heights? There are two balls and the only difference between them is the mass. Both are dropped from the same height on to the floor (static object with infinite mass), would both balls bounce up to the same height, or would the heavier ball bounce higher as it enters the collision with more momentum?

From my own derivation it would appear that the calculation reduces down to a simple vector reflection about the contact normal, but it doesn't feel right. Can anyone verify this?

EDIT:

To be clearer, I am looking for a code sample of how to resolve a ball collision against a plane using a collision impulse. Does the collision impulse rely on the ball's mass when colliding with an object of infinite mass?

sentences:
Help Understanding Cameras/View Matrices in DirectX11 (C#) So I'm designing a soft game engine in C# on top of the SharpDX API (a C# wrapper for DirectX). As I'm designing the camera, though, I'm running into some issues getting the 3D perspective correct. I've read through a few tutorials and articles, but I can't seem to find what I'm doing explicitly wrong.

This is my current understanding: The world matrix is the identity matrix (of the world...) times the translation matrix of the model, times the rotation matrix of the model, times the scale matrix of the model, which should then give me the transformed location of each vertex in "world space." The view matrix would then be the output matrix of LookAtLH(cameraPositionVec, targetPositionVec, upVec);. Finally, the projection matrix seems to be the output of the PerspectiveFovLH(fov, aspectRatio, nearDist, farDist); So, I then took the transpose of each of these matrices, multiplied world * view * projection and I should be left with the final transformed vertex coordinate.

Here's the code I have so far. I've left the world matrix untouched by just setting the translation to the origin, the rotation of the model to the identity matrix, and the Scale to 1, which should mean I don't have to actually perform any world matrix calculations for the sake of simplicity right now.

// Setup and create the projection matrix.
projectionMatrix = Matrix.PerspectiveFovLH((float)(Math.PI / 4.0f), ((float)GameWindow.WIN_WIDTH / (float)GameWindow.WIN_HEIGHT), 0.1f, 100.0f);

// Initialize the world matrix to the identity matrix.
worldMatrix = Matrix.Identity

...
//camera class
public Camera(Vector3 _position, Vector3 _target, Vector3 _rotation)
{
    position = _position;
    target = _target;
    rotation = _rotation;
}
public Matrix GetViewMatrix()
{
    //convert degrees to radians
    float pitch = rotation.X * 0.0174532925f;
    float yaw = rotation.Y * 0.0174532925f;
    float roll = rotation.Z * 0.0174532925f;

    //get rotation matrix and the relative up vector
    Matrix rotationMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, roll);
    Vector3 up = Vector3.TransformCoordinate(Vector3.UnitY, rotationMatrix);

    return Matrix.LookAtLH(position, target, up);
}

....

//set the view matrix
viewMatrix = camera.GetViewMatrix();

...
//Transpose the matrices
worldMatrix.Transpose();
viewMatrix.Transpose();
projectionMatrix.Transpose();

From there they are fed to the vertex shader, which is below. If I comment out the projectionMatrix multiplication though, the image shows up. If It's not commented out though, nothing renders to the screen, which leads me to believe that may be the issue.

//vertex shader
cbuffer MatrixBuffer
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

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

struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : texCoord0;
};

PixelInputType main(VertexInputType input)
{
    PixelInputType output;

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

    // Calculate the position of the vertex against the world, view, and     projection matrices.
    output.position = mul(input.position, worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix); //<-- If I comment this line, it renders to the screen
    // Store the texture coordinates for the pixel shader.
    output.tex = input.tex;

     return output;
}

I feel like I'm missing something really basic, because I think I'm pretty close. Thanks for any help you can provide.

sentences:
Separating logic/update from render/drawing code in a single thread using sleep I've read that the speed of game objects should not be hindered by FPS but instead should be based on time. How can I seperate the update/draw code to maximize performance without limiting the drawing rate and provide a constant logic update rate based on time?

My current pseudo code is as follows

loop
{
    draw();
    if (ticksElapsed() > 100)
    {
        update();
        ticks+= ticksElapsed();
    }
}

The problem is the drawing code hinders the performance of the update() rate. And it consumes 100% cpu because if sleep is thrown in, it throws off both drawing/logic functions.

I am also using SDL and it doesn't seem to have a vsync option. I've also heard of the terms fixed and variable time-stepping however I'm not sure how that can be done with sleep()

sentences:
Shake a tree on chop I have a top down RTS type of game where the player (God mode style) can click a tree to chop it. I'd like to shake the tree where the base of the tree (where the position marker is) moves the least and the top the most to simulate like it's being hit by an axe so it shows visual feedback. Any ideas on how to accomplish this? Not really sure where to start.

This would be in 3D.

sentences: Most efficient way to check collision For example, I have a player and a map, to check player collision with some block we need to check entire map tiles, but the bigger the map, the slower the framerate. What's most efficient way to check collision?

sentences:
How can I get projected coordinates of vertex on screen I want to check picking for faces and for that I need projected X Y coordinates of my vertexes in -1 to 1 range:
For that I multiply my vertex array with matrices and then get projected triangle coordinates from it and check if mouse is inside of that triangle ,but something goes wrong:
Here is my code

    for (int i = 0; i < m_vertexCount; ++i)
{
    D3DXVec4Transform(&m_Pverts1[i], &m_Pverts[i], &worldmatrix);
    D3DXVec4Transform(&m_Pverts1[i], &m_Pverts[i], &viewmatrix);
    D3DXVec4Transform(&m_Pverts1[i], &m_Pverts[i], &projectionmatrix);
}
z = 0;
for (int i = 0; i < m_faceCount; ++i)
{
    x1 = m_Pverts1[m_verts[z].x - 1].x / m_Pverts1[m_verts[z].x - 1].w;
    y1 = m_Pverts1[m_verts[z].x - 1].y / m_Pverts1[m_verts[z].x - 1].w;
    z1 = m_Pverts1[m_verts[z].x - 1].z / m_Pverts1[m_verts[z].x - 1].w; ++z;
    x2 = m_Pverts1[m_verts[z].x - 1].x / m_Pverts1[m_verts[z].x - 1].w;
    y2 = m_Pverts1[m_verts[z].x - 1].y / m_Pverts1[m_verts[z].x - 1].w;
    z2 = m_Pverts1[m_verts[z].x - 1].z / m_Pverts1[m_verts[z].x - 1].w; ++z;
    x3 = m_Pverts1[m_verts[z].x - 1].x / m_Pverts1[m_verts[z].x - 1].w;
    y3 = m_Pverts1[m_verts[z].x - 1].y / m_Pverts1[m_verts[z].x - 1].w;
    z3 = m_Pverts1[m_verts[z].x - 1].z / m_Pverts1[m_verts[z].x - 1].w; ++z;

    //code .. //
}

Where  m_Pverts is array of vertexes  m_Pverts1 is empty array for transformed vertexes and  m_verts[].x is array of vertex indexes:
x1,y1,z1,x2,y2,z3,x3,y3,z3 must be X Y  projected coordinates of triangle and Z depth:
Other code is checked and works right:

What I am doing wrong ??

sentences:
Compressing 2D level data So, I'm developing a 2D, tile based game and a map maker thingy - all in Java.

The problem is that recently I've been having some memory issues when about 4 maps are loaded. Each one of these maps are composed of 128x128 tiles and have 4 layers (for details and stuff).

I already spent a good amount of time searching for solutions and the best thing I found was run-length enconding (RLE). It seems easy enough to use with static data, but is there a way to use it with data that is constantly changing, without a big drop in performance?

In my maps, supposing I'm compressing the columns, I would have 128 rows, each with some amount of data (hopefully less than it would be without RLE). Whenever I change a tile, that whole row would have to be checked and I'm affraid that would slow down too much the production (and I'm in a somewhat tight schedule).

Well, worst case scenario I work on each map individually, and save them using RLE, but it would be really nice if I could avoind that.

EDIT:
What I'm currently using to store the data for the tiles is a 2D array of HashMaps that use the layer as key and store the id of the tile in that position - like this: private HashMap< Integer, Integer >[][]

sentences:
Why doesn't JavaScript's Math.cos function match this vector tutorial? I'm following this MATHguide lesson on combining vectors and have reached this part:

Next, we need to convert their forces to horizontal and vertical components. Let's use k for Kim's vector and n for Noah's vector.
k = <30, 130°> = <30 cos 130°, 30 sin 130°> = <-19.3, 23.0>.
n = <40, 65°> = <40 cos 65°, 40 sin 65°> = <16.9, 36.3>.

To get the X part of Kim's vector, I run 30 * Math.cos(130), I get -11.018739913640896, which is not -19.3.
To get the Y part of Kim's vector, I run 30 * Math.sin(130) which is -27.903178505602853, which is not the 23.0 listed by the example.
Where did I go wrong?

sentences:
Unity- how to render-to-texture with VR distortion I've also asked the question here http://answers.unity3d.com/questions/1392099/how-to-set-a-render-to-texture-camera-to-be-a-vr-c.html (but it's currently "under moderation")

So, I want to do some post processing effects in VR. I put a camera as a child of the Main Camera and set it to render-to-texture. Then, I take what is rendered, and display it (with my post-proc shader) on a quad in front of the Main Camera (The main camera and the child camera render different layers, so I don't render the same thing twice). (Also worth noting- I know that the depth will be collapsed out of the rendered-to-texture content; this is intentional.) The problem is, in this process, the positional data (that was rendered to texture) gets misaligned.

I've already fixed a problem where I have to manually set camera_project.GetComponent<Camera>().aspect = main_camera.GetComponent<Camera>().aspect; every frame. (Changing/setting the screen size auto sets the aspect ratio of the main camera- it does not automatically set the aspect ratio of the child camera.

So, with just that, everything lines up great and looks fine when it isn't in VR. But, when it is in VR, it appears that maybe some distortion is happening to the main camera that isn't happening to the render-to-texture camera, and thus, the overlay (the post-proc'd content) isn't lining up.

So what can I do to emulate the VR distortion in the child camera? Are there other properties of the Main Camera that are getting auto-set in VR that I can manually copy to the Main Camera? (I also noticed that aspect wasn't listed in the camera documentation [https://docs.unity3d.com/Manual/class-Camera.html] unless you knew to search for it explicitly, so I think it might be likely there is some other property I'm missing?)

sentences:
The camera in a 2D tile based side scroller is moving slower than the player In my 2D tile based side scroller, I want a camera that scrolls in the x direction, but not in the y direction. The world is separated into three zones; one on the left and one on the right where the camera doesn't move, and one in the middle where the camera should move left and right and centered on the player.

The world is a 2D int array where each tile has it's own ID (number). The player's position is in pixel coordinates.

My problem is that when the player moves outside the left zone (and into the middle), the camera always move slower than the player, which means the player disappears of the screen. Since I calculate the camera's position from the player position when the player is in the middle zone, I don't understand why the camera isn't always centered around the player.

My code for calculating the camera's position and drawing the background is as follows (in C#):

int worldWidth = world.GetLength(0) * _TILE_WIDTH;
int resX = camera.Width / TILE_WIDTH;
int resY = camera.Height / TILE_HEIGHT;

Bitmap screenBmp = new Bitmap(camera.Width, camera.Height);
Graphics g = Graphics.FromImage(screenBmp);

// upper left corner of the camera in the world
Vector2D pCamera = new Vector2D(p.X + (p.PlayerSize.Width / 2) - (screenBmp.Width / 2), 0);

int oneMoreX_tile = 0;  // draw one more tile off the screen?

if (p.X + (p.PlayerSize.Width / 2) < 0 + screenBmp.Width / 2) // past the left zone
{
    pCamera.X = 0;
}
else if (p.X + (p.PlayerSize.Width / 2) >= worldWidth - screenBmp.Width / 2) // past the right zone
{
    pCamera.X = worldWidth - screenBmp.Width;
}
else  // between the zones
{
    oneMoreX_tile = 1;
}

int xOffset = (int)pCamera.X % TILE_WIDTH;
int yOffset = (int)pCamera.Y % TILE_HEIGHT;

int startX_tile = (int)pCamera.X / TILE_WIDTH;
int startY_tile = (int)pCamera.Y / TILE_HEIGHT;

for (int i = 0; i < resX + oneMoreX_tile; i++)
{
    for (int j = 0; j < resY; j++)
    {
        int tileValue = world[startX_tile + i, startY_tile + j];

        // tile coord in tileset
        int x = tileValue % tilesetWidth_tile;
        int y = tileValue / tilesetWidth_tile;

        // pixel coord in tileset (top left)
        int x_px = x * TILE_WIDTH;
        int y_px = y * TILE_HEIGHT;

        g.DrawImage(tileset,
            new Rectangle(i * TILE_WIDTH - xOffset, j * TILE_HEIGHT - yOffset, TILE_WIDTH, TILE_HEIGHT),
            new Rectangle(x_px, y_px, TILE_WIDTH, TILE_HEIGHT),
            GraphicsUnit.Pixel);
    }
}

This code runs every time the graphics timer ticks. (I'm using Windows Forms..) I have two timers set at the same interval; one graphics timer and one physics timer. The physics timer just updates the player's position.

Regardless of world length, the player always disappears of the screen at 640 pixels (which is also the width of the screen), and the camera's position is 336 pixels from the left. I have also tried with lower speeds with no success.

Please ask if there's anything more you need to know. Any help would be appreciated.

sentences:
Best way to create defence(withdraw) algorthim libgdx? I have created user body and enemy body. Enemy body uses the steering behavior created by gdx AI. User body have it own control inputprocessor. World doesnt have gravity.

Enemy body arrives the user body and collision happens by linearvelocity.  So enemy body only attacks even if it is getting more damage. I just want to declare a way to withdraw and find a safe place when it get more damage  then again attacks when it get enough distinct.

So What do you suggest for My game ?

I already got some idea as Path finder but i am not sure how to use it.

Which algorithm I need to user ?

sentences: Free AAA RTS engine SDK? I'm currently trying out the various free SDKs out there (Cryengine3, UDK, Source) however all of them are mainly designed for FPS games. I was wondering if there are other AAA 3D engine SDKs that are aimed towards RTS games?

sentences:
"CVar system" - are CVar always looked up or cached? Many famous game such as Quake or Half-Life use CVars to allow easy and flexible game parameter manipulations.

You can simply open up the console and write something like

sv_cheats 1

to enable cheat codes.

CVars are used intensively during the game - if they were set or retrieved by string name lookup there would certainly be a performance hit. Therefore, I'm assuming CVars are somehow cached.

How would this kind of system be implemented? I thought about storing pointers to the real values in a map having the CVar names, and then use the real values in the game.
Is this a viable approach? Do the AAA games have a better one?

Example:

struct Game
{
    std::map<std::string, int*> cVars;
    int volume, sensitivity; // Example game parameters

    Game()
    {
        cVars.emplace("volume", &volume);
        cVars.emplace("sensitivity", &sensitivity);
    }

    void setCVar(std::string mName, int mValue)
    {
        *cVars[mName] = mValue;
    }
};

sentences:
Matrix transforms with SpriteBatch overloading - how do you rotate/zoom around a point? I have a transform matrix which works as intended for game objects I want to be completely controlled by my camera:

_transform = Matrix.Identity *
    Matrix.CreateTranslation(-_position.X, -_position.Y, 0) *
    Matrix.CreateRotationZ(_rotation) *
    Matrix.CreateTranslation(origin.X, origin.Y, 0) *
    Matrix.CreateScale(new Vector3(_zoom, _zoom, _zoom));

I expose this to my drawing and use the following SpriteBatch.Begin() overload:

sb.Begin(SpriteSortMode.Deferred,
    BlendState.AlphaBlend,
    SamplerState.PointClamp,
    DepthStencilState.None,
    RasterizerState.CullCounterClockwise,
    null,
    view.Transform);

This works as expected. No problems.

However, I have an object which controls it's own translation as it's a fake star field. I didn't want to have to generate potentially millions of stars to be drawn in order for it to be translated about, so the star field just loops them back to the opposite side if they past the edge of the screen. Zoom just acts really bizarrely. It's not being zoomed into the middle of the screen like it should. At some high zoom value it just swipes off the screen. I initially was having an issue with the rotation but after reordering via trial and error I was able to use the correct sequence of transforms. Here's what I'm currently doing:

_transformNoTranslation = Matrix.Identity *
    Matrix.CreateTranslation(origin.X, origin.Y, 0) *
    Matrix.CreateRotationZ(_rotation) *
    Matrix.CreateScale(new Vector3(_zoom, _zoom, _zoom)) *
    Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0);

And here's what it looks like:

http://www.youtube.com/watch?v=0lg-V36M7og

How do I get the zoom to work correctly?

As a side question, any ideas as to why the ship jutters at high speeds? I don't plan to ever be at those high speeds during game play so it's not a huge cause for concern. Some kind of precision error with the high translation values?

sentences:
Flash animation or Sprite sheet animation good for Unity mobile games I would like to develop dress-up and cooking kind of games. So it needs lots of animations. Our designers done the animations in the lash. I found the plugins callued GAF and UniSWF to convert flash animation to Unity or We can convert animations into sprite-sheets and animate them in Unity, But i don't know which one is the best way to do animations for mobiles with better performance and lower game size.

Any kind of suggestion is good. Thank you!

sentences:
How do I make a gun alignment to camera matrix in OpenGL GLSL? I am trying to program a FPS game with OpenGL.

I am using 3D eight the OpenGL 3.3 programmable pipeline.

I have a gun and a camera that I loaded.

When I load all of the assets for the game, I put everything int a 4x4 matrix, as it is compatible with the view matrix.

I set the corresponding matrix for the model equal to all the needed variables, then I use another variable that I defined in a header file to draw the actual model...

I did some searching because I do not have the code with me, and the closest I could find is learnopengl’s model loading tutorial as that is the most similar.

What I have tried;
I have tried multiplying the matrix for the gun’s world info, which I will call the model view matrix (such as position and scale) times the view matrix. I have also tried doing the same but multiplying the model view times the inverse of the normal view matrix.

I already set the guns position equal to the camera’a position, but when I run the application and try to move around, the gun still moves away from the camera.

I knew a way of how to fix this in OpenGL 1.1 by using glLoadIdentity, which is now deprecated with the core version of OpenGL 3.*.

When i try to set the two matrices equal, I get different results because the gun doesn’t move at all.

When I move the camera with the inverse of view times gun, it moves away from the camera...

I learned about the inverse matrix thing from here:
https://forums.khronos.org/showthread.php/81932

My matrixes are also set up the same. The gun model view * inverse(view matrix) has worked the best... this link is where I found it.

sentences:
What platform were old TV video games developed on? I am very eager to know how TV video games (which we all used to play in our childhood) were developed and on which platform.

I know how games are developed for mobile devices, Windows PC's and Mac but I'm not getting how (in those days) Contra, Duck Hunt and all those games were developed. As they have high graphics and a large number of stages. So how did they manage to develop games in such a small size environment and with lower configuration platform?

sentences: Why am I getting a down arrow in my Unity scene when using Oculus Rift and how do I get rid of it? In Unity, I have set up a scene to try out in Oculus Rift. When I hit play in Unity, everything works fine until about 5 seconds later when I get an arrow (Assets>OVR>Textures>out.png) that appears in the center of my screen and won't go away. What does this arrow mean and how can I get rid of it? It is obstructing my view of the level that I am trying to view.

sentences:
How to use depth buffer for z-level rendering in roguelikes? Developer of the game explains how z-buffer works in Dwarf Fortress (loosely quoted):

"If you clear the buffer every single frame, it kills the game. You have sort of a depth of field. You say I need about 20000 integers worth of depth. So your first frame is 0 to 20000. And the next frame is 20000 to 40000, you treat everything lower as garbage. So you go 20 to 40, 40 to 60, 60 to 80. You have to clean it if you dealing with 4 byte integer something like every 100000 times. So the problem goes away."

Source: https://youtu.be/A9g1XMr2TTA?t=1628

His description is not completely clear for me. It seems he is using depth range from lowest z-level to highest and updating only one layer per frame?

sentences:
Do I have to keep textures in Android games smaller than 1024^2? I have read tips in books and article that point out, if you are making a game for Android, make sure your textures are =< 1024^2, or you'll not reach all your potential customers.

I have never found a concrete statistic that proves this claim. What are we talking about, here, 5% of Android devices only support 1024? 10%? 80%?

sentences:
GLSL Core Functionality Geometry Shader examples I'm doing some research on geometry shaders and am having problems finding code examples/tutorials that does not use one of the extensions introduced before it was core functionality of OpenGL 3.2.

I'm looking for more modern approaches that doesn't use an extension.

Can anyone point me in the right direction?

I've already read the spec, but am looking for actually code examples.

sentences:
How do I make a flickering engine exhaust animation using only bone animation? I'm trying to replicate the flickering engine exhaust animation in this SketchFab model.  SketchFab doesn't support particle systems, so the animation must be a simple bone animation.

Can someone help me understand how to achieve such an effect?

My best guess is animated opacity, but I don’t know how to replicate it.
My final goal is to use it in a Unity 5 mobile game.

sentences:
How to make a chat lobby in my game? I'm writing my own RTS game in Delphi. Single-player part is almost done and works well and I'm thinking about adding multi-player to it now. There's going to be a lobby where players should be able to chat and organize games. I tried googling for a convenient way to do it, but couldn't find anything related ..

My idea looks like follows:

Players are identified by Names they choose and their IPs
There's main chat area where all players meet
There are rooms, where players may select game options (map, teams, flag colors, etc..).
After everything is settled players exchange IPs and multi-player engine starts.

I want to avoid usage of server-side software. Currently I'm looking into running everything through SQL database where each player commits posts and his state and reads other players posts/states.

Whats the common practice of organizing in-game chat lobby?

sentences:
Unreal Engine 4: Referencing an asset with asset user data instead of a class? I created a subclass of Uassetuserdata, creating a new type of asset. Now I can reference this new class in the user asset data section of my skeletal mesh. I noticed that I could create a blueprint subclass of this new class, blueprint that I can put anywhere in my project and call from the user data section of my mesh.
Now I'm wondering, is it possible to call an asset belonging to my new class and not the class directly in the user data asset section? An asset that wouldn't be a blueprint. I did create a new factory for my new class so that I can spawn assets of it in my project, but I can't call them in the asset user data section of my mesh, only the class itself. I'm pretty sure I saw someone do it once but I can't remember how. Do you have any ideas? Thank you!

sentences:
LWJGL Java 2D collision when lagging I'm using a tile based collision, but when the game is lagging (the lag isn't the problem) the collision fails and the player falls through tiles.

This is the movement/collision detection code of my Player class:

gravity.y = gspeed;

speed.y+=gravity.y;

position.set(position.x + direction.x * speed.x * deltaSeconds, position.y + direction.y * speed.y * deltaSeconds);

for (int i = (int) Math.round(position.x / 32) - 2 * t; i < (int) Math.round(position.x / 32) + 3 * t; i++)
            {
                for (int j = (int) Math.round(position.y / 32); j < (int) Math.round((position.y + height + 64) / 32); j++)
                {
                    checkCollision(i, j, deltaSeconds);
                }
            }

public void checkCollision(int i, int j, float deltaSeconds)
    {
        bbox.setBounds((int) position.x, (int) position.y, (int) width, (int) height);
        Tile t = null;
        t = Map.getTile(i, j);
        if (t != null)
        {
            if (t.isSolid())
            {
                if (t.getTop().intersects(bbox))
                {
                    if (position.y + height < t.y * 32 + 32)
                    {
                        if (speed.y >= 0)
                        {
                            position.y = t.y * 32 - height;
                            speed.y = 0;
                            gravity.y = 0;
                            jumpState = 0;
                        }

                    }

                }
                if (t.getBottom().intersects(bbox))
                {
                    if (position.y < t.y * 32 + 32)
                    {
                        position.y = t.y * 32 + 32;
                        speed.y = 0;
                    }
                }
                else
                {
                    if (t.getLeft().intersects(bbox))
                    {
                        if (position.x + width > t.x * 32)
                        {
                            position.x = t.x * 32 - width;
                            speed.x = 0;
                        }
                    }
                    if (t.getRight().intersects(bbox))
                    {
                        if (position.x < t.x * 32 + 32)
                        {
                            position.x = t.x * 32 + 32;
                            speed.x = 0;
                        }
                    }
                }
            }

        }
    }

Is it possible to fix my code, if yes how? Or is it possible to tell if the game is lagging?

sentences:
C++ Function Parameter Changes Problem I have a problem regarding how the values under a certain parameter doesn't change after being called again.

I have this kind of code, where, an imp (monster) and a character has to go for a battle:

#include <iostream>
using namespace std;

int gems = 0;

float imp (float imphp) {
float implife = imphp - 5.0;
return implife;
};

float character (float charlife) {
float charalives = charlife - 2.0;
return charalives;
};

int main () {
string charactername;
cout << "Hero Life: ";
cout << character(10.0) <<endl;
cout << "Monster Life: ";
cout << imp (10.0) <<endl;

};

My problem or rather a question is if I call the monster function again is that it returns the value as 1.

Code I used to call monster for the second time after the first turns of damage is done:

cout << monster << endl;

what happens there was it sends me a value of 1. how can i make it show the current value after the damage has been taken...? say if the imp takes another damage, how can i make my program show the current value, since if the imp took out 2.0 at first attack, then takes another 2.0, the value for the hp of the character to show is 6.0? Same with the other function, how can i return it to the current value?

sentences:
Xna rotate around world axis? I want to make it so that either the pitch yaw or roll rotates around the world axis and not the local axis, but I'm not sure how, I've got.

Vector2 mouse_change = new Vector2(mouse_previous.X - mouse_new.X, mouse_previous.Y - mouse_new.Y);
camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), mouse_change.X / 800f);
camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), mouse_change.Y / 800f);

Updating every frame, then I've got.

view_matrix = Matrix.Invert(Matrix.CreateFromQuaternion(camera_angles) * Matrix.CreateTranslation(camera_position));
projection_matrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 0.2f, 500f);

The problem is that if I e.g. change the pitch then change the yaw then the yaw changes through the local axis, I need it to turn around the world axis so that it doesn't matter what the yaw is :/.

sentences: How to calculate fps in GLFW? Just letting you guys know before anything I'm a beginner at programming. I am just wondering how I should go about calculating the fps using GLFW?

sentences:
How can I dynamically load the correct sprite from a sprite sheet? I am making a simple card game in unity. The game is based on a standard 52-card pack, with identical backs for unique faces. In my particular game different cards are worth different values and have various special abilities. The game will have 52 cards on the table (on the draw position or in the face-down deck or in someone's hand) at all times, so this number won't change.

I thought that making a Card prefab and instantiating 52 of these manually would be a bad idea. Even doing it in code, I thought, would be a bit OTT, and that I should just instantiate visual cards when they are face-up to the player.

I have a sprite sheet of the 52 cards and the back, which is imported as a Sprite in multiple mode, sliced in to a grid containing all the cards needed to play the game.

The problem I now face is that, through my GameController script I want to generate a shuffled pack of cards, deal some to each player and then show those cards to a player. However, I am not sure of the best way, or even if it's possible, to do this dynamically with the sprite sheets as they are. For instance if I have the following:

private CardRank rank;
private CardSuite suite;
private GameObject visualCard; // the card in the scene

private void Start()
{
    this.rank = CardRank.Ace;
    this.suite = CardSuite.Spades;
}

This class would be instantiated by the game manager. I would have 52 of these in code.

Whenever I have to visually show a card in the scene, I would use a card prefab, which is essentially a game object with a SpriteRenderer on it. I would need to dynamically load the correct sprite for this object from the sprite sheet. Something like this:

SpriteRenderer spriteRenderer = this.visualCard.renderer as SpriteRenderer;
spriteRenderer.sprite = ...

The sliced sprites from the sprite sheet actually have names in the format AS (Ace of Spades), 7H (Seven of Hearts), etc - though this was a manual thing I did myself of course.

I have also tried various alternative solutions, including creating animations, having separate sprites not in a spritesheet and having an array of available sprites in an array with a specific index for each card, but none seem as elegant as trying to load the correct sprite at runtime, as I'm trying to.

So, how do I load a specific sprite from a spritesheet at runtime? I'm open to suggestions, even those that make me think differently about how to approach the problem.

sentences: How could I implement a halo to glow around my spaceship I have a 2D Spaceship sprite and I'm interested to know how I can create like a glow effect that leaves a trail behind the game object when it moves. Later on I am going to implement a dash function on the ship, so this glow trail should be consistent and visible.

sentences:
How can I have cutouts in a texture? I want to be able to have a gameobject that's basically just a black box on top of everything else. Then I want to be able to place other gameobjects which are just gradients on top of that and they should "cut out" of the black texture like this:

How can I achieve this sort of effect?

Please keep in mind that I have pretty much no experience with shaders :)

Here's a video that might help explain what I'm trying to achieve
https://www.youtube.com/watch?v=L1dd4fkVSAM

sentences:
How do you build a rotation matrix from a normalized vector? I'm trying to find the correct way to build a rotation matrix from a unit vector. I have two arbitrary points in space (p1 and p2), and I'm trying to create the vertices for a rectangle to span between them.

From the points, I can get a unit vector easily enough. From there I've been trying to create a rotation matrix that I can apply to a set of hard-coded vertices to get them oriented correctly. The rectangle extends along the X axis, so I'm trying to rotate it's X axis to match the unit vector.

So far I've tried GLM::orientation:

glm::vec3 direction = glm::normalize( glm::vec3( p2 - p1 ) );
glm::mat4 rotation4 = glm::transpose( glm::orientation( direction, glm::vec3( 0, 1, 0 ) ) );
glm::mat3 rotation = glm::mat3( rotate4 );

As well as the manual matrix creation method mentioned in this similar question:

glm::vec3 direction = glm::normalize( glm::vec3( p2 - p1 ) );
glm::vec3 rotationX = direction;
glm::vec3 rotationZ = glm::normalize( glm::cross( direction, glm::vec3(0,1,0) ) );
glm::vec3 rotationY = glm::normalize( glm::cross( rotationZ, direction ) );
glm::mat3 rotation( rotationX, rotationY, rotationZ );

However, in both cases I end up with rectangle rotations that seem fine for axis-aligned rotations, but which veer off in weird directions in all other cases. In both cases, I'm attempting to specify the positive Y axis as up, to keep the rectangle level, but the rotated rectangle always ends up twisted around despite that.

I'm obviously doing this wrong, but I may just not be understanding the problem well enough. If someone could point me in the right direction, I'd appreciate it.

sentences:
Level Modeling Workflows in Maya for Unity I'm wondering what the standard workflow for modeling static levels for Unity (or for that matter, other High-Level engines) is? My somewhat limited knowledge tells me that the best process is modeling the entire static level in Maya, texturing, then baking AO and some static lighting into the scene, then importing the single level asset into unity to add dynamic objects.

Is there another way that I should be doing this that is more efficient in a performance sense or from a workflow point of view?

I know the question is somewhat open ended, but generally i'm asking what the standard workflow for level modeling is.

Thanks!

sentences:
How do I avoid obstacles on a predefined path? I want is a character to walk along a path defined as a waypoint sequence. For example, a soldier patrolling around a castle.

However, I want the soldier to avoid (dynamic) obstacles, without deviating from the path too much.

How can this be done?

sentences:
Stronger Hack-proof MMO Game Comparison: Game Client Based Vs. Via Web Browser I was wondering. I observed most of any MMO that are hack-prone area. Hacks used one-hit kills, stealing accounts, instant level up, aimbots (mostly MMOFPS), and questionable wallers (also in MMOFPS). These hackers might affect the fairness and excitement of the gamers which lead to doubts, abuse kickers (mostly in MMOFPS*, and misunderstandings. Even in MMORPG referred to hacks for instant money for purchase items. I saw these examples via Wikipedia.

This leads me to my question:

Which kind of MMO game platform or model would be best for making MMO games whilst reducing the possibility of hacking?

For example I could make an MMO game for the web browser (by website or via Facebook) or making an MMO game using installers/clients that fetches for patches and graphics that could run only through program via computer. What will help with preventing hacking and how?

In the case of making an installer/client based MMO games, are there anti-hack programs or techniques you can recommend in MMO context?

sentences:
Why does lightmapping take so long compared to real time shadows? I am using Unity 5. As a test, I set the realtime shadow resolution to max and the distance to cover my entire scene with no cascades. As expected, it lagged severely, but I could still move the camera and the shadows updated in real time.

As a second test, I lightmapped the scene using the absolute lowest settings. This took about a minute to complete.

Basically, I can use lightmapping, and it takes much longer to work than real time shadows even though it looks worse. Why does lightmapping take so long to bake in comparison to real time shadows?

sentences:
2D Car Simulation with Throttle Linear Physics I'm trying to make a simulation game for an automatic cruise control system. The system simulates a car on varying inclinations and throttle speeds.

I've coded up to the car physics but these do note make sense.

The dynamics of the simulation are specified as follows:

a = V' - V

T = (k1)V + θ(k2) + ma

V' = (1 - (k1 / m) V) + T - ( k2 / m) * θ

Where

T = throttle position
k1 = viscous friction
V = speed
V' = next speed
θ = angle of incline

k2 = m g sin θ
a = acceleration
m = mass

Notice that the angle of incline in the equation is not chopped up by sin or cos.
Even the equation for acceleration isn't right.

Can anyone correct them or am I misinterpreting the physics?

Source: "scribd.com/doc/105335356/124/INDUSTRIAL-APPLICATIONS"; Page 508. Number 13.2.

sentences:
What would be a good way to scroll a large html canvas (that contains little repetition if any) What would be a good way to scroll the content of a huge html5 canvas so that the scroll is crisp and smooth, and memory consumption (and cpu load or battery consumption) is also reasonable?

any good library that can take care of it for you? Any specific plotting algorithm that will avoid a jumpy feel?

I guess the best way is to pre-plot upwards and downwards of the current viewport, but if the user quickly scrolls a whole lot up, I assume that some algorithms outperform others.

My canvas has very little repetition drawn on it, in case it matters, and the content doesn't change much. Just a very very long canvas element that also contains a lot of text, and needs to smoothly scroll in the browser viewport.

sentences:
Drag Gestures - fractional delta values I have an issue with objects moving roughly twice as far as expected when dragging them.

I am comparing my application to the standard TouchGestureSample sample from MSDN.

For some reason in my application gesture samples have fractional positions and deltas.

Both are using same Microsoft.Xna.Framework.Input.Touch.dll, v4.0.30319.

I am running both apps using standard Windows Phone Emulator.

I am setting my break point immediately after this line of code in a simple Update method:

GestureSample gesture = TouchPanel.ReadGesture();

Typical values in my app:

Delta = {X:-13.56522 Y:4.166667}
Position = {X:184.6956 Y:417.7083}

Typical values in sample app:

Delta = {X:7 Y:16}
Position = {X:497 Y:244}

Have anyone seen this issue? Does anyone have any suggestions?

Thank you.

sentences:
What is a good way to determine if a vector is between two other vectors in 2D? I could operate with the angles, but I do not have the angles calculated yet (and would like to avoid having to do that). It would be possible to calculate and cache the local-coordinate-frame angles, though.

This is a routine that is run on every vertex of every convex polygon within the convex decomposition of every physically simulated object, so it should be as fast as possible.

I've got a corner of a convex polygon, so I have a vector from vertex to vertex-1 and another vector from vertex to vertex+1. It is easy to see that for a convex polygon, the interior of the polygon lies in the direction of the average of these two vectors.

I want to determine given any vector whether it points into that region or outside of it. Can I accomplish this using only cross products and dot products and similar fast operations? I am thinking about eventually offloading these calculations to a vertex shader, but as it changes the number of vertices required depending on an object's velocity, I imagine the logic could get dicey. Either way, before I attempt a vertex or geometry shader implementation I had better get a CPU solution working correctly first.

Here's an example: I want to find if N is between A and B. A points right at -10 (=350) degrees, B is at 15 degrees. So it looks somewhat like the < symbol. Function should return true only if N is between -10 and 15, between 350 and 375, etc. This was just to paint a mental picture, the input to the function are vectors: I want to avoid operating on angles because I do not want to call atan2.

It may help if it is known that A cross B is always positive. This is the case because my polygon is CCW winded and convex.

sentences:
Isometric ball moving in unity 3d. Ball moving in opposite direction I am making a game in unity 3d. It is a 2.5d game which mean it is in isometric. The game is quite simple. Player drags mouse and a trajectory will be shown just like in angry bird and when player release the mouse the ball will move to the direction. However I am having issue here that once mouse is released the ball moves in exact opposite direction. I am not able to understand what the real issue is. My code is as follows:
For Ball:
public class BallScript : MonoBehaviour

{
    public Rigidbody2D rbg;
    public CircleCollider2D col;

    public Vector3 BallPos{
        get {return transform.position;}
    }

    void Awake(){
        rbg = GetComponent<Rigidbody2D>();
        col = GetComponent<CircleCollider2D>();
    }

    public void PushBall(Vector2 force){
        rbg.AddForce(force,ForceMode2D.Impulse);
    }

    //to enable rigidbody so we can use projectile again
    public void ActivateRb(){
        rbg.isKinematic = false;
    }

    public void DeActivateRb(){
        rbg.velocity = Vector3.zero;
        rbg.angularVelocity = 0f;
        rbg.isKinematic = true;
    }
}

The code for my game manager is as follows:
public class Trajectory : MonoBehaviour
{
    [SerializeField] int dotsNumbers;
    [SerializeField] GameObject dotsParent;

    [SerializeField] GameObject DotsPrefab;
    [SerializeField] float dotSpacing;
    Vector2 pos;
    float timeStamp;
    Transform[] dotsList;

    void Start(){
        //hide trajectory in the start
        Hide();

        PrepareDots();
    }

    void PrepareDots(){
        dotsList = new Transform[dotsNumbers];
        for(int i=0;i<dotsNumbers;i++){
            dotsList[i] = Instantiate(DotsPrefab,null).transform;
            dotsList[i].parent = dotsParent.transform;
        }
    }
    public void UpdateDots(Vector3 ballPos,Vector2 forceApplied){
        timeStamp = dotSpacing;
        for(int i=0;i<dotsNumbers;i++){
            pos.x = (ballPos.x + forceApplied.x * timeStamp);
            pos.y = (ballPos.y + forceApplied.y * timeStamp)-(Physics2D.gravity.magnitude * timeStamp * timeStamp)/2f;
            dotsList[i].position = pos;
            timeStamp += dotSpacing;
        }
    }

    public void Show(){
        dotsParent.SetActive(true);
    }
    public void Hide(){
        dotsParent.SetActive(false);
    }
}

Here is the code for gamemanager
// using singleton pattern
Camera cam;
public BallScript ball;
public Trajectory trajectory;
public static GameManagerScript Instance;
void Awake(){
    if(Instance==null){
        Instance = this;
    }
}

[SerializeField] float pushForce = 4f;
bool isDragging = false;

Vector2 startPoint;
Vector2 endPoint;
Vector2 direction;
 Vector2 force;
float distance;

void Start(){
    cam = Camera.main;
    ball.DeActivateRb();
}

void Update(){
    if(Input.GetMouseButtonDown(0)){
        isDragging = true;
        OnDragStart();
    }
    if(Input.GetMouseButtonUp(0)){
        isDragging = false;
        OnDragEnd();
    }
    if(isDragging){
        OnDrag();
    }
}

void OnDragStart(){
    ball.DeActivateRb();
    startPoint = cam.ScreenToWorldPoint(Input.mousePosition);
    trajectory.Show();
}

void OnDrag(){
    endPoint = cam.ScreenToWorldPoint(Input.mousePosition);
    distance = Vector2.Distance(startPoint,endPoint);
    direction = (endPoint-startPoint).normalized;
    force = direction* distance * pushForce;

    trajectory.UpdateDots(ball.BallPos,force);

}

void OnDragEnd(){
    ball.ActivateRb();
    ball.PushBall(force);
    trajectory.Hide();
}

The ball moves in exact opposite direction where I wish to send it by dragging. Is it because of the isometric issue or I am missing something?P.S: have applied negative force as well as in case and have also made change in direction formula
rbg.AddForce(-force,ForceMode2D.Impulse);
direction = (startPoint-endPoint).normalized;

sentences:
Mandelbrot generation using custom HLSL shader in XNA So I made a Mandelbrot generator in C# and I'm learning about HLSL and custom shaders in XNA (For a college course). I was hoping to do the mandelbrot calculations on the graphics card to make them faster. This is the code that I have so far (only part of my .fx file).

// sx, sy is the upper left corner of the mandelbrot coordinate area
// sw,sh is the width and height of the mandelbrot coordinate area.
float sx = -2.5, sy = -1, sw = 3.5, sh = 2;
float width, height; // Size of the quad I'm drawing this to

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    // TODO: add your pixel shader code here.
    float count = 500;
    // Convert from the drawing space to madelbrot space
    float tx = (input.UV.x / width) * sw + sx;
    float ty = (input.UV.y / height) * sh + sy;
    float tsx = tx, tsy = ty;

    // Find the divergence count
    for(float i = 0; i > 500; i++)
    {
        // Get the next location
        tx = tx * tx - ty * ty + tsx;
        ty = 2 * tx * ty + tsy;
        // This is the part I'm having trouble with
        count = (tx * tx + ty * ty <= 4 ? count : min(count, i));
    }
    // Calculate and return a color based on the count obtained
    float factor = count/500;
    return float4(1-factor, 1-factor, 1-factor, 1);
}

I think the issue has to do with having a ternary operation inside of a loop.
The issue is that "factor" always results in having a value of 1, which means count obtains a value of 500. So my looping does nothing. I believe that my code is theoretically correct.

Maybe HLSL doesn't deal with the ternary operator very well? Does anyone have information about how they work or any limitations when using them?

Any comments are welcome.

sentences:
GLSL: gl_ModelViewMatrixTranspose vs. gl_ModelViewMatrix What is the difference between doing these two operations?
Don't the first transform the vector from model space to view space? Then what does the second operation do?

gl_ModelViewMatrix * vec4(vector, 0.0)

gl_ModelViewMatrixTranspose * vec4(vector, 0.0)

sentences:
How can I position a large amount of boxes to prevent overlap efficiently I've been working on an asset to position labels like they do in Diablo or Path of Exile, but I'm having trouble finding an algorithm to position the labels efficiently.

Currently I just boxcast in each of the 4 directions until there is no overlap, compare their distances, and take the smallest value to place it, but this just seems too much hassle and too slow with a large number of labels.

Especially when you look at this video clip from Path of Exile without loot filter.
There's no way they can iterate over that many labels and place them instantly.

I think they keep some kind of array that says "there are X open spots for this label group currently, select the nearest one or any", and update it when a label gets placed.

I know this question has been asked and I know about automatic label placement etc. but I don't think it really applies in this case. At a certain point it doesn't really matter where the labels get positioned, they just need to be positioned around another label as fast as possible without overlap.

Basically, I'm looking for a way to save occupied/unoccupied space around a label and retrieve that value somehow.

sentences:
What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform? I am thinking about giving a go to one of my ancient ideas for a game. The core point of this game would be the possible level of functional customization of the game environment and objects (such as modifying the behavior of a space ship weaponry). For this the game would need to be scriptable. Also I don't aim to commercialize it, it is merely an interesting programming challenge for me.

As I am mostly a .NET guy I will use XNA/C# for the game itself. For the scripting I think about going with Python or Lua. I have previous experience with Python and have nothing against it as a language. Lua on the other hand is almost completely new to me, besides some minor World of Warcraft addons modifications I did here and there, and it looks promising. So here is my question:

What are the pros and cons of Lua vs. Python as a scripting language for XNA/C# platform?

Is one of them considerably easier to use with XNA/C#? Has one of them some specific advantages or disadvantages when used with XNA/C#? Why would you recommend one over the other for XNA/C#?

sentences:
Make timer for game to run for 2min I'm trying to make a game using C++ (in Visual Studio 2015).
I want to make the game run for X minutes and then end.
I have a function play() that calls all other functions required and I need to make play() run for 2min.
I've tried putting play() in loops that run for some time, but none of them work. I am not able to find any other question that addresses the problem I'm facing and so any help would be appreciated.

sentences:
High-performance update of a bitmap grid I need to visualize a fast paced process in .NET in 2D. I am planning to use writeable bitmap 800x40px.
The idea is like this - there are objects which are represented by very basic colours and sizes anything from 1x1 to 4x4. each takes 4x4 "cell" - they all are fixed like a chess board.
The objects move between cells and change size. Most importantly they move independently, so I cant (I can but I would like to not) have a sort of refresh rate.. I need to animate each object state change - like say pixels pouring from cell to cell. the transition time should be around 500ms.
In this period of time the states can change multiple times so I should be able to abort outdated animation, move object "instantly" to new cell and start more recent object animation which could have taken over the "old" cell..
The accuracy should be in 1-2ms intervals.
The host application is WPF .NET Framework

sentences:
Changing color of only one gameobject So i have this script the checks if my mouse cursor is over the block and if it is i want the block to change color

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

public class BasicBlockFunction : MonoBehaviour {

public GameObject Block;
public Color StartingColor;
public Color HighlightColor;
Color color;
Ray ray;
RaycastHit hit;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    MouseOver();
}

void MouseOver()
{
    ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    if (Physics.Raycast(ray, out hit))
    {
        print(hit.collider.name);
        Block.GetComponent<Renderer>().material.color = HighlightColor;
    }
    else
    {
        Block.GetComponent<Renderer>().material.color = StartingColor;
    }

 }

}

I want to change the color only for the gameobject i have my mouse on.

sentences: How can I make a power-up spawn system semi-random? Basically I'm working on a similar game to achtung die kurve (http://curvefever.com). I'm almost done with the game, however I'm not completely fine with the way power up spawning works. As for now, I have setup a timer loop runs the spawn code block every 1 second. I have setup so each spawning period for each power up (total of 11 powers) is between 19.25 - 1.925 seconds. However this is fine, but it's to random I would say. For example it can be times were no power-ups spawn at all and there can be times were 5 power-ups spawn at the same time. I have made alot of games and this problem comes up every time.

sentences: Is there a Box2d b2World::ShiftOrigin function in Libgdx? Is there an equivalent Box2d b2World::ShiftOrigin function in Libgdx? I can't seem to find it.

sentences:
Unity pixel art distorted sprites I have a problem rendering my pixel art sprites properly in Unity.
So far I have one character in a sprite-sheet I made, with frames of size 64x64. The actual sprite is roughly 32x32 but I left room for movement in animations.
I import the sheet following pixel perfection procedures I found on the internet using these settings:

As for the orthographic camera I set its size using this formula:

orthoCameraSize = screenHeight / (2 * 32)

If I zoom on the sprite in scene it looks fine but when in game it gets rendered quite poorly (in game / in scene pics below):

What could be the source of the problem? I applied every good practice advice I could find on the web...
Thanks for your help!!!!

sentences:
How to generate interresting procedural terrain I work on a voxel-like game, and I have finally managed to create some basic terrain generation using simplex noise. Heres what it looks like:

Sure I can generate different kind of terrains (more or less hilly/aggressive), but there wont really be any variation.

At the moment I only know one way to make it more interesting, and that would be to add stone blocks under the grass (I would simply check the above block).

So my questions are: What techniques would I need to use, to generate different kind of terrains, which still kind of blended together at the edges. And how would I go about caves and rivers? And lastly how would I make a better variation of blocks?

If any could lead me in the right directions, I would appreciate it a lot.

Ps. It's not a valid answer to say that I just need to mix a lot of noises, to generate it. How?

sentences:
added a pipeline and now my terrain is pink...how do I fix it? I needed to add a pipeline to my world because an asset required it.  I was following the directions here.

Since adding the pipeline, my terrain is pink.

I found a references that stated the pipelines do not support terrain, there are problems with more than 4 textures (I have 1) etc...but this was a year ago.

Is this fixable or am I at choice between no pipeline or buying pipeline enabled terrain (and hence redoing all of my scenes)?

What is the solution?
Thnx
Matt

sentences: An error comes up in console when trying to enter play mode in unity Hay folks, i pray for everyone's wellbeing. I want to ask a question that whenever i enter playmode in unity, error message is displayed even though there is nothing in the console. This doesn't get fixed even after restarting unity. Any help would be great.

sentences:
Best base resolution for a pixelart project for bigger audience I've been working on Top-down 2D pixel art project for quite some time. When I first started my project, I actually set application surface, display and game window to match 1:1 - with that said, the game performed well and project looked pixel-perfect without tearing or anything... BUT, I'm not making Age of Empires or Sim City clone, where as bigger display you got, as more you see, but as smaller things get. So, I rewrote my resolution script completely to a fixed size...

Now, the thing is:

Images/sprites are mostly between 32x32 and 64x64
I need to figure out a good base resolution for bigger audience (like
Steam, community etc.)

The game can't have infinitely large view, because character shouldn't see too far and at the same time be barely visible on large monitors
With that said, it has to look +/- ok on different display
resolutions, but attain best quality using aspect ratio function, even if that means black borders around the view
Game has a configuration page for different resolutions, but that
will affect only how much the stuff has to stretch etc. and is not currently used from user interface (testing from in-game console only)

The question basically is:

Best - 640x480 VS 800x600?
What base resolution "Hotline Miami" videogame might be considered to
have?
Does the whole resolution concept really matter and I should worry
about user experience with this?

This whole thing a bit reminds me of Fallout 2 with locked "2x scaling on" on high-res, which basically did similarly to what I'm going forward to...

For a better understanding of what I'm trying to say, here's a visual aspect of this (Green line is basically the border of the room, but due to the display resolution, you can see past the border):

BEFORE

AFTER

** The "after" image doesn't use aspect ratio in this picture, but instead shows past the actual supposed viewing frame, this is why you don't see black boxes on sides... this was later on fixed though

sentences:
Frustum Culling with VBOs I have terrain being rendered in my project using VBOs in OpenGL. I would like to apply some Frustum Culling but have no idea how to access each polygon as its drawn to check if it is in view. I think this is where octrees come into play but I have no idea how this is really done. Does anyone know a good tutorial on how to do this specific thing or have some pseudocode for me?

Thanks in advanced!

sentences:
Trouble with LineRenderer with orthographic camera in Unity When a weapon is fired, I want to draw a line for the bullet's trajectory.

I am using a LineRenderer to draw the trajectory with the code below:

    void FixedUpdate () {
        timer += Time.deltaTime;

        if (Input.GetButton ("Fire1") && timer >= timeBetweenBullets && Time.timeScale != 0) {
            Shoot ();
        }

        if (timer >= timeBetweenBullets * effectsDisplayTime) {
            DisableEffects ();
        }
    }

    void DisableEffects () {
        gunLine.enabled = false;
    }

    void Shoot () {
        timer = 0f;

        // Set first point
        gunLine.SetPosition (0, transform.position);

        shootRay.origin = transform.position;
        shootRay.direction = -transform.forward;

        gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    }

I am using an orthographic camera in the scene. The line will show up but at certain rotations the line will partially render or be completely hidden. Oddly, the line will always render in the scene view-- the problem only exists in the game view.

Has anyone had this issue?

sentences:
How to create sprites, programatically without using prefabs? I have different types of images for different sprites. and i am not certain that how much different sprites(images) i will have to show. So, i gotta create the sprites and apply textures programatically at runtime.

Now, I defiantly can't use prefabs because it will restrict me with the number of different sprites i can use. and also, changing texture on one sprite prefab instance in game, will change all the sprites prefab, that's not acceptable in my case.

Is there a way i can create sprites without having to create static prefab ?

where ever i looked for the solution every time i got the same answer "create a prefab", which is what can not be done in my case.

sentences:
Unity3D 3.5 pro - Moving the camera vs setting draw distance I move the camera mostly via right-click + WASD, sometimes with [shift] if I want it to move faster. Occasionally, instead of moving my camera, it alters the draw distance / FOV / some visual aspect of the editing scene that causes trees and other object to disappear when I scroll enough, and eventually even the terrain starts disappearing. It is not m "zooming out". My camera does not move, the width and height of the FOV stays the same (one might say the depth is being altered though). What key am I hitting to cause this to happen, and is it possible to disable it?

side note: "keybinds" is probably the most spot-on tag for this question but it doesn't exist (surprisingly) and I lack the rep to create it.

sentences:
Vive SteamVR Stereo Rendering mirror doesn't reflect lineRenderer lines steadily I'm creating a SteamVR game in Unity. I'm using the Vive SteamVR Stereo Rendering Toolkit to create the mirror effect. I also wrote a script to render three lines between headset, and two controllers, with lineRenderer. The lines are working fine, but in the mirror reflection, I can only see the lines rendered one at the time, as opposed to all three lines visible at the same time. Why is that?

Edit 1:

Add an image of what I see:

In my game, I used three balls to represent the headset, the left controller and the right controller. I see the lines between all three lines constantly (even though you can't see the ball in the headset obviously and the lines between the left/right controllers to the headset are clipped, which is fine...), but I can only see one line at a time in the reflection, either the line between the head and left controller or the line between the head and the right controller. For example, if I move the left controller, the line between the head and the left controller in the reflection is working, while the other disappear in the reflection. Also, the line between the left and right controllers never appear in the reflection.

Edit 2:

Add another image to explain what I want vs what I have now:

sentences: Rendering of a minimized / out of focus directx game is slow I m working on a project that captures the game windows and send it to another node. As long as game is in focus or maximize, the rendering is smooth and steady. When the game is out of focus or minimized, the streaming shows jerky effect. When you maximize the windows, the affect again disappears. Is that an issue of directx game rendering or something else? How this problem can be solved?

sentences: shake / Vibrate a body in box2d? How do you vibrate or cause a shake effect to a body of type static or dynamic or kinematic. I tried applying forces to a dynamic body in the timeStep, which did not work, as well I tried ApplyLinearImpulse many times a sec within the timeStep, which again did not give me the result. So right now Iam experimenting with adding a static circle body as a hinge point to my rectangular body and create a revolute joint between them. May be then applying a force could result in Tension between the 2 bodies? Does anybody know about this? have any ideas please let me know?

sentences:
Resolving collision with multiple objects I already have SAT implemented for collision detection and MTV computation and it works totally fine when my character collides with only one object.

But it's possible that there is a collision with multiple objects at once. How do I handle such cases? How do I evaluate chracter translation using all computed MTVs?

Pseudocode of how my code currently looks like:

// Contains objects collision with which was detected during broadphase
list<collider> overlappingObjects;
// Collider for the character for which I'm trying to solve the collision
collider characterCollider;

response res;
vec3 translation;
for(collider in overlappingObjects){
   // test if they actally collide and put collision information in `res` if they do
   if(testCollision(characterCollider, collider, res)){
       translation += res.mtv;
   }
}

// Moving character out of the collided objects
characterCollider.offset(translation);

This code works incorrectly if overlappingObjects contains more than 1 object.

What is the correct solution for such problem?

sentences:
Rotating a scene around a fixed axis I am looking for a way to move my scene so that when I translate forward/back/left right it moves directly up/down/left/right on the screen.  Currently it does do that until I rotate (by anything other than 360...).  After rotation the up/down/left/right moves in the direction of the rotation.  I need it to move directly up/down/left/right on screen.  I've been racking my brains trying all kinds of different matrix rotations and multiplication but I can't get it.  MOST IMPORTANTLY - I need it to maintain a single rotation axis of 0,0,0 so the centre of rotation is always near the middle of the screen regardless of how far I scroll.  I can easily rotate on the centre of the scene itself and have it translate how I want (translate to co-ord, rotate, translate back, go to position) but I need that axis to remain fixed.  Otherwise the centre of rotation could be somewhere way off-screen.

Fig 1. Shows the starting position of the model(scene).
Fig 2. The modelview is rotated 45deg.
Fig 3. Decrementing the z-value causes the model to move out along z - which I do not want.
Fig 4 I need the model to move straight back (between z and x).

I have tried using sin / cos rule in an attempt to translate the vertices back along the arc between the undesired position (Fig 3) and the desired one (Fig 4) but the math is off and the process is messy.  I just know there has to be a clean/simple solution out there.
I am coding this in Java (JOGL) and passing modelview and projection matrices to a vertex shader.
Also, I am not using deprecated functions (no begin/end/glRotate etc).

Does anyone know of a matrix multiplication that will accomplish this?

sentences:
Why do my Box2D bodies occasionally get stuck and separate forcibly? I'm making a space game with LibGDX and Box2D. I made a video here to illustrate the issue.

Verbal description: When objects collide, they sometimes get stuck together and are then suddenly separated by a strong force.

Both objects have identical body definitions and fixtures:

bod = new BodyDef();
bod.type       = type;
bod.allowSleep = false;

shape = new CircleShape();
shape.setRadius(values[0]);

fix = new FixtureDef();
fix.restitution = 0f;
fix.friction    = 1f;
fix.shape       = shape;
fix.density     = 1f;

worldBod = world.createBody(bod);
worldBod.setTransform(position.x, position.y, 0);
worldBod.createFixture(fix);

Why might this be happening? How can I fix it?

Update: Here is some more info.

The Player class contains a function update(float deltaTime) with the rest listed below

force.x += (directionVector.x * SPEED)*deltaTime;
force.y += (directionVector.y * SPEED)*deltaTime;

//This helps keep the object in control from preventing forces greater then 3
if(force.x >= 3){
    force.x = 3;
}if(force.x <= -3){
    force.x = -3;
}if(force.y >= 3){
    force.y = 3;
}if(force.y <= -3){
    force.y = -3;
}
//This quickly reduces the force back down to 0
force.x *= 0.5;
force.y *= 0.5;

this.getBody().applyForceToCenter(force, true);

In the render part of the main game class I step the world with

gameWorld.step(Gdx.graphics.getDeltaTime(), 6, 6);
//although increasing or decreasing the itterations seems not to help

and Finally the hexagon's are created using the ShapeRenderer pulling the position and

sr.setProjectionMatrix(camera.combined);
sr.begin(ShapeType.Line);
sr.circle(p1.getBody().getPosition().x, p1.getBody().getPosition().y, 1);
sr.circle(barrierPole.getBody().getPosition().x, barrierPole.getBody().getPosition().y, 1);
sr.end();

sentences: Alternative Font loaders in Monogame Framework While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer/sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?

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

sentences:
Why are there no in game time subscription options? Many games employ a monthly subscription to play a game. However, this makes coming back to a game pretty difficult, as you are most likely unsure of whether you will be playing the game for a few months or a few days.

Why are there no games where you subscribe for in game time (or why is it not common practise)? That would allow returning players to either have some game time left when they return, or not feel so bad for buying more game time in the case they end up playing the game for only a couple of days. I believe a monthly subscription could exist alongside an in game time subscription. Currently, this is stopping me from playing a couple of games.

sentences:
Gamma-Correct rendering without floating-point rendertargets When using a gamma-correct pipeline, you have to work with floating-point rendertargets. Otherwise, you will get severe banding due to the insufficient precision of the usual 8-bit-per-channel integer rendertargets.

Is there any way around this? Any good way to implement gamma-correct rendering without using floating-point rendertargets?

This is on desktop PCs using Windows and DirectX.

sentences:
How to write "Hello World" for N64 purely from scratch? As an experiment I want to code a "Hello World" program for N64 using only assembly code, using no headers, tools, helper files, etc.

I just want to write the assembly code bare bones from absolute scratch, assemble it and have it run through a demanding emulator that can show me the output.

I can't find enough info on how to send the correct data to the RSP for video output though. Can anyone offer me a hand here? Not on helping me program, but with information regarding N64's RSP and how to program it to display text, etc.

sentences:
How to use touch screen for movement instead of keyboard narrow keys I wrote this code and run the game on my desktop, now I need to build this game for android and I need to change to touch to move the player, what it should be changed in the following code and what is the necessary steps to build my desktop 2D game to be run on android device, the following is the player code:

#pragma strict

var speed : int = 5;

function Start () {
}

function Update () {

  if(Input.GetAxis("Horizontal") >0){

    if(collided_with != null) {
      if(collided_with.tag== "Right") {
        //collided_with=null;
        return;
      }
    }
    transform.Translate(Vector3(Input.GetAxis("Horizontal")*speed*Time.deltaTime,0,0));
  }

  if(Input.GetAxis("Horizontal") <0) {
    if(collided_with != null) {
      if(collided_with.tag == "Left"){
        // collided_with=null;
        return;
      }
    }
    transform.Translate(Vector3(Input.GetAxis("Horizontal")*speed*Time.deltaTime,0,0));
  }
}

sentences:
How to fix odd artifacts at the edges of textures in DirectX 11? In my DirectX 11 project, when I have textures they have odd artifacts at the edges. I've seen it before and searched online, but I can't find any DirectX examples that I can get to work.

You can see it on the skybox too. I'm assuming this is caused because the texture is too small and it's being expanded. I'm using the sampler state filter D3D11_FILTER_MIN_MAG_MIP_LINEAR. How can I fix this?

sentences:
Increase animation speed according to the swipe speed in unity for Android I have the animation done through Maya and brought the FBX file to unity. Here is my code to calculate the speed of the swipe:

Vector2 speedMeasuredInScreenWidthsPerSecond =(Input.touches[0].deltaPosition / Screen.width) *     Input.touches[0].deltaTime;

Now I wanted to take speedMeasuredInScreenWidthsPerSecond and use it to increase the animation speed accordingly like this:

animation["gmeChaAnimMiddle"].speed=Mathf.Round(speedMeasuredInScreenWidthsPerSecond);

However, this results in an error that I need to convert Vector2 to float.

So how do I overcome it?

sentences:
Get fragment from mouse position I have a painting app for texture artists that I am working on. I am able to paint to a flat canvas that updates the texture of a 3d object in an object viewer. Now I want to be able to paint directly to the 3d model.

One way I can think of is to get the uv coordinate from the mouse position, and use that as the position to paint onto my 2d canvas, which updates the 3d models texture.

Oh and only one object at a time is active, so that should make things a little simpler.

Is this the right approach? If it is then how should I start. Or is there a simpler/better way of painting directly to a 3d model? How does zbrush do it?

sentences:
Project 3D points to a plane, then project their bounding box back to 3D I have a table in 3D space, represented by a plane.

I want to project arbitary points representing an object (cup, toy, etc) onto that table, run 2D principal components analysis to get an oriented bounding box (https://www.sciencedirect.com/topics/computer-science/oriented-bounding-box)

This gives me 2D oriented bounding boxes (defined by 8 corner points) that lie along the table plane. Now, I want to project these points back to 3D somehow so I can get 3D bounding boxes that are aligned with the plane.

The projection from 3D to 2D plane is not invertible.. so how do I do this?

sentences:
Unity is Single Thread by how do WWW with coroutine work Async When I used HttpWebRequest and HttpWebResponse classes for an API calling my game suddenly halt for some seconds but as i used same API calling through WWW with coroutine, it didn't halt.

I heard that unity is single thread but why my game not halt as i used WWW with coroutine? and is i am getting right that  HttpWebRequest and HttpWebResponse are not better than WWW?

sentences:
How to programmatically change sprite sheet sub-sprite name I am trying to change the name of the sub-sprites of a sprite sheet. I have searched and tried everything I can think of and cannot get it to work, which makes me think it can't be done at this point in time.

Let's say I have a sprite sheet that has already been split up into individual sprites inside of Unity.

I am attempting to change the sub-sprite names programmatically.

I tried using

AssetDatabase.RenameAsset (...)

on the sprite sheet asset, which only changes the sprite sheet name and not sub-sprites.

I then thought to obtain a sub-sprite and attempt to change its name using the below code.

            if (AssetDatabase.IsSubAsset (subSprite))
            {
                AssetDatabase.RenameAsset (AssetDatabase.GetAssetPath (subSprite), "newSprite" + i.ToString ());
            }

However, this too only changes the sprite sheet name.

I'm not sure where else I can take this to achieve my desired outcome, apart from programmatically copying the original sprite sheet and using that to create a copy. But even then, I still am unable to alter the sub-sprite names.

I also tried changing subSprite.name, but this just changes the internal name and not the asset name.

Any ideas?

sentences:
How do I maintain the world pitch, roll or yaw of child objects? I've got an application where I'm trying to display an object in 3D, with information provided by real-world accelerometers and inclinometers - sensors that pick up the angle of the equipment, relative to ground. The trouble comes when I want to show this 'world pitch' or 'world roll' on an object that is a child of another. I'd think that there is a trivial solution to the problem, but for the life of me, I can't figure out what it is.

Let's say I've got a robot arm with several pieces - "LowerArm", "Elbow", "UpperArm" and "Hand". "Hand" is the child of the "UpperArm", and "UpperArm" is the child of "Elbow". I'd like to place "Hand" at 0 degree pitch, relative to world-space, no matter how I move the parent objects. If I grab my "LowerArm", and rotate it 90 degrees, the hand should still lay 'flat', relative to the ground; in local coordinate space, it should moved 90 degrees, to compensate.

I want it to remain attached; so it should continue to follow the other parts, in terms of roll and yaw. If I twist the arm, the hand twists with everything else - it just maintains that 0 degree world pitch. Observe the yellow object, in the below example:

How can I do this? I would have thought that there was some kind of trick, with matrices or quaternions, that could resolve it; but I've had no luck, so far. It's hard to figure out what the new 'forward' vector should be.

sentences:
Best way to Draw a cube for 3D Picking on a specific face Currently I am drawing a cube for a game that I am making and the cube draw method is below.  My question is, what is the best way to draw a cube and to be able to easily find the face that the cursor is over?  My draw method works just fine, but I am getting ready to start to add picking (this will be used to mold the cubes into other shaps), and would like to know the best way to find a face of the cube.

public void  Draw() {
    // center point posX, posY, posZ
    float radius = size / 2;

    //top
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(1.0f,0.0f,0.0f); // red
            glVertex3f(posX + radius, posY + radius, posZ - radius);
            glVertex3f(posX - radius, posY + radius, posZ - radius);
            glVertex3f(posX - radius, posY + radius, posZ + radius);
            glVertex3f(posX + radius, posY + radius, posZ + radius);
        }
    glEnd();
    glPopMatrix();

    //bottom
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(1.0f,1.0f,0.0f); // ?? color
            glVertex3f(posX + radius, posY - radius, posZ + radius);
            glVertex3f(posX - radius, posY - radius, posZ + radius);
            glVertex3f(posX - radius, posY - radius, posZ - radius);
            glVertex3f(posX + radius, posY - radius, posZ - radius);
        }
    glEnd();
    glPopMatrix();

    //right side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(1.0f,0.0f,1.0f); // ?? color
            glVertex3f(posX + radius, posY + radius, posZ + radius);
            glVertex3f(posX + radius, posY - radius, posZ + radius);
            glVertex3f(posX + radius, posY - radius, posZ - radius);
            glVertex3f(posX + radius, posY + radius, posZ - radius);
        }
    glEnd();
    glPopMatrix();

    //left side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(0.0f,1.0f,1.0f); // ?? color
            glVertex3f(posX - radius, posY + radius, posZ - radius);
            glVertex3f(posX - radius, posY - radius, posZ - radius);
            glVertex3f(posX - radius, posY - radius, posZ + radius);
            glVertex3f(posX - radius, posY + radius, posZ + radius);
        }
    glEnd();
    glPopMatrix();

    //front side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(0.0f,0.0f,1.0f); // blue
            glVertex3f(posX + radius, posY + radius, posZ + radius);
            glVertex3f(posX - radius, posY + radius, posZ + radius);
            glVertex3f(posX - radius, posY - radius, posZ + radius);
            glVertex3f(posX + radius, posY - radius, posZ + radius);
        }
    glEnd();
    glPopMatrix();

    //back side
    glPushMatrix();
    glBegin(GL_QUADS);
        {
            glColor3f(0.0f,1.0f,0.0f); // green
            glVertex3f(posX + radius, posY - radius, posZ - radius);
            glVertex3f(posX - radius, posY - radius, posZ - radius);
            glVertex3f(posX - radius, posY + radius, posZ - radius);
            glVertex3f(posX + radius, posY + radius, posZ - radius);
        }
    glEnd();
    glPopMatrix();
}

sentences:
cocos3d versus Unity for simple IOS 3D games? Wondering if anyone here happens to have experience in doing some simple 3D based games/apps for IOS, using cocos3d & Unity and could give some pointers....questions I have are:

GENERAL

1) It seems currently cocos3d has the most traction in terms of a free 3D games engine for IOS development?

2) If one wanted to step up from the free IOS games engine, to a commercial one it would seem Unity is a popular choice, however you would then not really be doing apple/objective-c development, but rather unity development and pushing a button to pop out an IOS deployable artifact correct?

FOR MY SPECIFIC REQUIREMENT - If I was interested in doing the following:

develop a relatively simple 3D application for iPhone/iPad
have a small 'world' such as a room with a few basic items in it (table, cupboard)
ability to 'drop' a basket ball in the room and have it bounce around based on a physics engine & perhaps some user input (not sure what, lets say control wind direction)
monitor it and react accordingly - e.g. say if it goes into a net which is in the room then add a point to the scoreboard

At a high level how would one do this using Unity versus using cocos3d, for example:

3) Which would be quicker to develop such a basic iPhone/iPad game/simulation out of Unity/cocos3d?

4) Would 'building your world/room' approach be different? Like in Unity would you build tables/cupboards within a Unity IDE which would make it very quick, whereas with cocos3d would you have to do this programmatically?

5) Would the programming aspect of letting the ball go and monitoring it be different between the two? Or would you roughly in both cases just be setting up world, release ball in certain position, and then engaging physics engine?

6) Any advice/guidance re which tool/approach to use? (Unity versus cocos3d)

7) Re using cocos3d for my requirement, what additional tools would you recommend above/beyond XCode? (e.g. just perhaps some sort of 3D design tool to help model the room and import/save somehow for us in cocos3d)

Basically I'm a hobbyist iOS developer who wants to do some 3d, so the concept of using a free/open-source approach such as cocos3d sounds great as (a) it's free, (b) keep using existing skill set re objective-c etc, BUT the biggest unknown to me is whether by chosing cocos3d would I be giving myself say 20 hours of work to develop a 3d app/animation that could be developed in 1 hour in one of these commercial product (e.g. Unity)?

sentences:
Locking object access with Allegro's threading API 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?

sentences:
MonoGame, sprite to rectangle I'm working with MonoGame in VB2015 - please don't give answers that involve using C#.

Anyway, I found a snippet which I converted to VB for pixel collision. The function below accepts two rectangles, then runs a pixel check on the intersection between the two.

What I can't work out is how to send my two sprites (textures) to the function as rectangles. Or if anyone has a alternative, please let me know.

  Private Shared Function IntersectPixels(rectangleA As Rectangle, dataA As Color(), rectangleB As Rectangle, dataB As Color()) As Boolean
    ' Find the bounds of the rectangle intersection
    Dim top As Integer = Math.Max(rectangleA.Top, rectangleB.Top)
    Dim bottom As Integer = Math.Min(rectangleA.Bottom, rectangleB.Bottom)
    Dim left As Integer = Math.Max(rectangleA.Left, rectangleB.Left)
    Dim right As Integer = Math.Min(rectangleA.Right, rectangleB.Right)

(No, this isn't the whole routine...)

sentences:
How can I write an additive mesh shader that splits the RGB channels while accounting for depth? I'm trying to create a sort of "hologram" effect. So far, what I have is an additive, three-pass shader that uses ColorMask for each pass to separate the RGB channels. The problem is that doing so requires ZWrite to be off (first image) so that each pass doesn't intersect the others (second image). However, doing so means that the model geometry overlaps itself, which I don't want.

I've tried the various methods of taking depth into consideration with transparency (This, for example) but they all cause problems when trying to separate the RGB channels. Is there some way to have each pass take depth into consideration within itself, but not with the other passes?

sentences: GLfloat vs GLfixed vs GLint performance in 2017 Some people claim that floats should be used for rendering vertices in modern graphics cards, because graphics cards are optimized for floating-point arithmetic and therefore, integer calculations are often emulated. I would think that most graphics cards have ALUs, and therefore, an efficient way to process integer vertices. So, are floats actually faster than integers on modern graphics cards?

sentences:
Pokémon character turning / facing: How is it achieved? Movement is already done though You know that when the player playing Pokémon games want to change the facing of the main character, one would simply tap on the directional pad (D-pad) on the Game Boy (Color/Advanced/Advanced SP) or Nintendo DS systems, and the character would just turn towards the general direction the player wants to turn to.

As far as I know, the turning mechanics from Pokémon Gold/Silver/Crystal is also combined with the movement mechanics from Pokémon Red/Blue/Yellow, which the latter (movement mechanics) is successfully implemented in Java, shown below.

Movement mechanic:

package entity;

import level.BaseWorld;
import main.Keys;
import resources.Art;
import screen.BaseScreen;

public class TestEntity extends Entity {

    public Keys keys;
    int facing = 0;
    int turning = 0;
    int xPosition;
    int yPosition;

    int xAccel;
    int yAccel;

    boolean lockWalking;
    boolean lockTurning;
    int turningTick = 4;

    public TestEntity(Keys keys) {
        this.keys = keys;
    }

    @Override
    public void initialize(BaseWorld world) {
    }

    @Override
    public void tick() {
        if (!lockTurning) {
            if (keys.up.isDown) {
                turning = 2;
                lockTurning = true;
            }
            else if (keys.down.isDown) {
                turning = 0;
                lockTurning = true;
            }
            else if (keys.left.isDown) {
                turning = 1;
                lockTurning = true;
            }
            else if (keys.right.isDown) {
                turning = 3;
                lockTurning = true;
            }
        }
        if (!lockWalking && turningTick < 0) {
            if (keys.up.isDown) {
                facing = 2;
                yAccel--;
                lockWalking = true;
            }
            else if (keys.down.isDown) {
                facing = 0;
                yAccel++;
                lockWalking = true;
            }
            else if (keys.left.isDown) {
                facing = 1;
                xAccel--;
                lockWalking = true;
            }
            else if (keys.right.isDown) {
                facing = 3;
                xAccel++;
                lockWalking = true;
            }
            if (turningTick < -5)
                lockTurning = false;
        }
        handleMovement();
        turningTick--;
    }

    @Override
    public void render(BaseScreen screen) {
        screen.blit(Art.player[facing][0], xPosition, yPosition, 16, 16);
    }

    //-----------------------------------
    //Private methods

    private void handleMovement() {
        if (lockTurning) {
            facing = turning;
        }
        if (lockWalking) {
            xPosition += xAccel;
            yPosition += yAccel;
        }
        if (xPosition % 16 == 0 && yPosition % 16 == 0) {
            lockWalking = false;
            xAccel = 0;
            yAccel = 0;
        }
    }
}

The movement mechanics I have implemented as of now DOES NOT contain codes that rely on System.currentTimeMillis() or System.nanoTime(), which means it's not elapsed-time-based. Rather, it relies on current-states via fixed game ticks, which is prominent during the Game Boy era.

Unfortunately, it contains a side effect where if the player were to press multiple keys on the D-pad, it will cause the character to turn while it's moving. I can remove only the turning mechanics from the mixed mechanism above, and would obtain the movement mechanics that were used only in Pokémon Red / Blue, Generation 1 games.

However, I would like to use the movement + turning mechanics used from Pokémon Gold/Silver/Crystal, Generation 2 and above.

Could someone suggest an idea / tip / hint / solution for this problem?

You may also use the codes given above to your likings, just make sure to change stuffs a bit while you're at it.

sentences:
Unity: Change the type of a Texture2D to "Normal map" through script I am making procedural terrains through c# script, and while I achieve to produce a texture, a heightmap and a normalmap to Texture2D, it seems they are not being applied correctly to the material.

the texture (albedo) is applied
the noise map is applied (but as a "default" texture, I think?)
the heightmap is not even selected

The trick I currently use is to also save the Texture2D to files. After generation I manually affect the file normalMap and it goes fine. But you'll understand this is not satisfactory, I want the script to set the normal map correctly.

I suspect this is because the file's texture type is force to normal map. But I cannot see how I can change the type of an in-memory Texture2D through code.

Researches gave nothing fitting my concerns, any help will be appreciated.
Thanks:)

[EDIT]
I tricked by passing a pre-made normal map as parameter, to use instead of the one I generate. Guess what? It works instantly.

sentences:
UDK problem with kismet and unreal code interfacing Couple of questions that I really have looked for the answer to before posting.

I want to create enemies in a game (iOS - tower defense like) I am making them follow a path and do other things like die etc..

I created a simple piece of code to make a place-able enemy in my level but this is the thing I don't know what the best way to continue is. I want to create enemies in code rather than placing in game and therefore I do not know how to assign the kismet path to each one?

My mobile material isn't working even though I made the material have a mobile texture? Works in PC not in mobile preview.

Thanks in advance.
Mike

Class BlobzEnemyGround1 extends BlobzEnemy
placeable;

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    `log("Blobz Enemy Ground 1 spawned!");
}

defaultproperties
{
    bBlockActors=True
    bCollideActors=True

Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
    bEnabled=TRUE
End Object
Components.Add(MyLightEnvironment)

Begin Object Class=StaticMeshComponent Name=PickupMesh
    StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
    Materials(0)=Material'Level1.TestEnemyMat'
    LightEnvironment=MyLightEnvironment
    Scale3D=(X=0.25,Y=0.25,Z=0.5)
End Object
Components.Add(PickupMesh)

Begin Object Class=CylinderComponent Name=CollisionCylinder
    CollisionRadius=32.0
    CollisionHeight=64.0
    BlockNonZeroExtent=true
    BlockZeroExtent=true
    BlockActors=true
    CollideActors=true
End Object
CollisionComponent=CollisionCylinder
Components.Add(CollisionCylinder)
//bSupportedOnMobile=true;

}

sentences: C++ - Lua Preventing malicious lua code Im working on a "game" that uses lua for scripting and i plan on making it very mod-able. However, malicious code can be written without much difficulty in lua... So how can i go about stopping that? I could block certain functions, but that wouldn't be nice for the modders and those who really want to will find another way.

sentences: How to find a valid point if NavMeshObstacle is blocking path? Is there any way to find the closest valid point to my target if a NavMeshObstacle is blocking my agent's path? This point can be any point along the red line in the image above.

sentences: Can networking be platform independent in a libgdx game? LibGDX supports Desktop (Windows, Linux and Mac), Android and web applications. Can i code the network part of an online game without taking care of what kind a of application i'm running? i.e coding the network engine interdependently of the application type.

sentences:
How to detect collisions in AS3? I'm trying to make a simple game, when the ball falls into certain block, you win.

Mechanics: The ball falls through several obstacles, in the end there are two blocks, if the ball touches the left block you win, the next level will contain more blocks and less space between them.

Test the movie (click on the screen to drop the ball):
http://gabrielmeono.com/downloads/Lucky_Hit_Alpha.swf

These are the main variables:

    var winBox:QuickObject;//You win
    var looseBox:QuickObject;//You loose
    var gameBall:QuickObject;//Ball dropped

Question:

How do I trigger a collision function if the ball hits the winBox? (Win message/Next level)

Thanks, here is the full code:

    package  {

    import flash.display.MovieClip;
    import com.actionsnippet.qbox.*;
    import flash.events.MouseEvent;

    [SWF(width = 600, height = 600, frameRate = 60)]

    public class LuckyHit extends MovieClip {

        public var sim:QuickBox2D;
        var winBox:QuickObject;
        var looseBox:QuickObject;
        var gameBall:QuickObject;

        /**
         * Constructor
         */
        public function LuckyHit()
        {
            sim = new QuickBox2D(this);
            //sim.createStageWalls();
            winBox = sim.addBox({x:5,y:600/30, width:300/30, height:10/30, density:0});
            looseBox = sim.addBox({x:15,y:600/30, width:300/30, height:10/30, density:0});

            // make obstacles
            for (var i:int = 0; i<(stage.stageWidth/50); i++){
            //End
                 sim.addCircle({x:1 + i * 1.5, y:16, radius:0.1, density:0});
                 sim.addCircle({x:2 + i * 1.5, y:15, radius:0.1, density:0});

            //Mid End

                  sim.addCircle({x:0 + i * 2, y:14, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:13, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:12, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:11, radius:0.1, density:0});
                  sim.addCircle({x:0 + i * 2, y:10, radius:0.1, density:0});

            //Middle Start
                 sim.addCircle({x:0 + i * 1.5, y:09, radius:0.1, density:0});
                 sim.addCircle({x:1 + i * 1.5, y:08, radius:0.1, density:0});
                 sim.addCircle({x:0 + i * 1.5, y:07, radius:0.1, density:0});
                 sim.addCircle({x:1 + i * 1.5, y:06, radius:0.1, density:0});

            }

            sim.start();

            stage.addEventListener(MouseEvent.CLICK, _clicked);
        }

        /**
         * ..
         * @param e MouseEvent.CLICK
         */

        private function _clicked(e:MouseEvent)
        {
            gameBall = sim.addCircle({x:(mouseX/30), y:(1), radius:0.25, density:5});

        }
    }

}

sentences:
How to read monogame log files on android device I am working on a monogame android project where I want to log some data. First try was something like this:

Log.Info(tag, message);

This works great when debugging in Visual Studio via the Android Device Logging-Window. But when I run the app on my mobile android device I have no idea how to view the log entries. As far as I know the logging happens in the so called CatLog, which can be viewed with some Apps. But unfortunately these apps need root access, which I think cannot be given to them on a "normal" android device.

Is there any way to either view the Logfile on my Android device or is there a better way of adding logging to my project?

Thanks in advance
Nick

sentences:
How to construct the marching cubes tables algorithmically? I want to implement the marching cubes algorithm from scratch, but I'm stuck at the polygon generation phase (building edge loops with correct orientation and triangulating them).
Obviously, I should consider all 2^8 = 256 cases, find out zero-crossing edges (build 12-bit edge masks) and figure out the triangulation in each case.

Could you please give me some ideas on how to correctly construct and triangulate edge loops?

I'd like to avoid considering each MC configuration (out of 15) separately as it seems somewhat tedious and messy to me.

sentences:
LibGdx Camera Movement I just started learning a few things about libGdx and i don't really understand how the camera works because i've created a camera, then set the camera position to viewport.getWorldWidth()/2 and viewport.getWorldHeight()/2 and then i would like to draw a image at 0,0 or where the camera starts drawing but i don't really understand why it's not working.Here's the code:

public class PlayScreen implements Screen {

    private OrthographicCamera cam;
    private Viewport viewport;
    private MainClass mainClass;
    Texture img;

    public PlayScreen(MainClass mainClass){
        this.mainClass = mainClass;
        img = new Texture(Gdx.files.internal("badlogic.jpg"));
        cam = new OrthographicCamera();
        viewport = new StretchViewport(400, 200, cam) ;
        cam.position.set(viewport.getWorldWidth()/2, viewport.getWorldHeight()/2, 0);

    }

    @Override
    public void show() {

    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
            cam.position.x += 100 * delta;
            System.out.println(cam.position.x);
        }

        if(Gdx.input.isKeyPressed(Input.Keys.LEFT)) {
            cam.position.x -= 100 * delta;
            System.out.println(cam.position.x);
        }

        cam.update();
        mainClass.batch.setProjectionMatrix(cam.combined);

        mainClass.batch.begin();
        mainClass.batch.draw(img, 0  , 0); //here i'm not sure what position should it be
        mainClass.batch.end();
    }

The output it's just a blank window, i don't understand where it starts drawing

sentences:
Substance Painter: Jagged edges when painting normals I am painting normals on a normal layer using the Textures tab to make bumps and crevices. But the effect is so jagged. How can I fix this?

INB: Texture Set is already on 4K so it's not a quality issue.

sentences:
Plotting a pseudo 3D globe I would like to plot a small globe where the main character can walk, exactly like Sonic & Knukles Bonus Stage. For those who won't google it, here is a picture.
I am familiar with Raycasting, used in Wolfenstein and other games to "simulate" a 3D perspective in a 2D map.
But I could not figure how to program the globe thing, and I suppose that it was not a real 3D rendering, as Sonic was a 16 bit game.
Any idea on how to do it without any sofisticated 3D engine?

sentences:
How do I add a "pointer" to my UI menu? I'm sure there has to be a simple answer to this, but frankly I cannot find anything about it anywhere on the internet, so I'm asking here. How do I add a pointer like this hand to the side of the currently selected UI button in my game?

I tried using Unity's built in UI system to do this, using the "sprite swap" feature that changes sprites based on whether or not the button is currently selected. I made an image for my "Play" button, and then an image for when the play button was selected that included a pointer as part of the image, but the image would either resize when the button was selected, or the image was moved to the right to accommodate Unity's centering mechanic on the UI. Perhaps this wasn't so wrong, and I'm just not using the UI system correctly.

Does a feature like this have to be hard coded into the UI design?

sentences:
When I shoot from a gun while walking, the bullet is off the center, but when stand still it's fine. (Video Included) I am making a small project in Unity, and whenever I walk with the gun and shoot at the same time, the bullets seem to curve and shoot off 2-3 CMs from the center. When I stand still this doesn't happen.
This is my main Javascript code:
@script RequireComponent(AudioSource);

var projectile : Rigidbody;
var speed = 500;
var ammo = 30;
var fireRate = 0.1;
private var nextFire = 0.0;

function Update() {
    if(Input.GetButton ("Fire1") && Time.time > nextFire) {
        if(ammo != 0) {
            nextFire = Time.time + fireRate;
            var clone = Instantiate(projectile, transform.position, transform.root.rotation);
            clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));
            ammo = ammo - 1;
            audio.Play();
        } else {

        }
    }
}

I assume that these two lines need to be tweaked:
var clone = Instantiate(projectile, transform.position, transform.root.rotation);
clone.velocity = transform.TransformDirection(Vector3 (0, 0, speed));

I just started Unity, and I might have a difficult time understanding some things.
EDIT:
Here is a video - http://www.screenr.com/2pxH
(If there are any more mistakes in my code, feel free to edit it.)

sentences:
Random Functions in Unity Is their a way to execute or call a random function in unity. Something like:-

  void Update(){random(func1(),func2())}

  void func1(){print("func1")}

  void func2(){print("func2")}

sentences:
Is it more efficient detect when audio clip ends with AudioSource.isPlaying or with AudioClip.length? In Unity, I want to trigger an event when an audio clip finishes playing. Would it be more CPU efficient to keep checking if the audio clip is playing with

WaitUntil(() => audioSource.isPlaying == false);

or would it be more efficient to use:
 WaitForSeconds(audioClip.length);
to simply wait a certain amount of time?

How can I run a test in Unity to see which one is more CPU efficient?

sentences:
Examples of interesting implementations of character stats? I've got this BBG going ( http://ninjawars.net ), and the character stats currently are simplistic.  I'm looking to add a few stats to the current 1/2 (strength and maximum hitpoints, essentially).
I've come up with: (strength (unchanged), speed, stamina, and some others that are somewhat interesting wildcard stats).
However, I'm not satisfied with how boring the effects of some of these stats are, because they're very linear.  Better stat, better effects of the stat, but the stats don't interact with each-other, there's no Rock-Paper-Scissors interaction, having more is always better all the time.

So what I'd really like is to see examples of interesting character stats or effects of stats?

Examples that I can think of off hand:

Call of Cthulu's Insanity stat (things get really weird/chaotic if you start losing sanity)

White Wolf stats, to a certain extent (the stats themselves have some basic effects, and all skills effectiveness base themselves off of stats as well)

What are some other ways people have used stats to check out?

sentences:
Should frame rate affect the speed in a game engine? I am writing a 2D game engine for fun. I am able to perform animation using the engine. However, if I change the frame rate (frames per second) the speed of the animation changes.

I have never used any game engine. I want to know whether other game engines handle this issue or not. If not, what is the ideal frame rate for a 2D game?

sentences: Can you use other gamepass ids on your own Roblox game? I'm creating a game on Roblox and I need to know if I can use other user's gamepass ids. And if I can will they work?

sentences:
How do I move a unit one grid-square-width per button press in Unity3D? I'm learning Unity. I'm making a 2D top down Frogger-esque game. I was wondering how you would go about making the player move x pixels per button press.

I have this code to move him, currently with a float for x and y inputs, so he moves slowly:

    Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

    if (movement_vector != Vector2.zero)
    {
        anim.SetBool("isWalking", true);
        anim.SetFloat("input_x", movement_vector.x);
        anim.SetFloat("input_y", movement_vector.y);
    }
    else
    {
        anim.SetBool("isWalking", false);
    }

    rbody.MovePosition(rbody.position + movement_vector * Time.deltaTime);

sentences:
A* Pathfinding Gridless With Circles I found that A* is an algorithm for grid (or tiled) maps. I want to use it or some alternative of it to my game. The problem is that I have no grid. I have canvas and GameObjects could be at position { x: 23.91324512, y: 131.12334253461 }. How would you do this?

And another question, I have element with stepSize (concretely called movementSpeed), and getPosition().getX(), getPosition().getY() AND getRadius() which returns the radius of a circle.

How would you do A* algorithm with radius?

Btw I am implementing it in Java, so maybe some Java snippet would be helpful.

EDIT

As you may suggest me to create a virtual grid, how do I check if I can move to the next node when I have my getRadius() and all the obstacles getRadiuses

sentences:
Texturing curves in blender Im making a tree in blender with the sappling add-on,  i've already textured the leaves, i want to know how to texture the trunk with a bark texture. Im using cycles render.

Thanks in advance. :)

sentences:
How do I create an efficient long, pannable, sprite-animated scene in a Windows Store game? I am creating my first Windows Store application in XAML, and I cannot seem to find a proper example for the requirements I have.

The basic idea of the app is to have a large scrollable canvas which would lazily start animating visible parts of the view as soon as user stops panning over a certain content (with some audio played also):

My original idea was to use a StackPanel to add a bunch of custom controls, each of which would then animate itself once visible (with a short delay), but I have a couple of concerns:

If the entire canvas is ~50 screen widths wide, is it feasible to load all content at the beginning, or do I need to plan doing some lazy loading during scrolling? For example, when I select a certain region in the Bing Travel app, it seems to lazily load tiles as I scroll it towards the end.
Since content is stretched 100% vertically, and these animations are vectorized to be resolution independent, I am not sure if XAML (CompositionTarget) will be able to handle this, or I have to go for DirectX (MonoGame or C++) to get rid of flicker.
Even better, is there an example for Windows 8 which uses a 100% vertically sized GridView with custom animated controls inside?

sentences:
How to handle objects at the edges of spatial partition cells? A lot of games store object positions as floats and have a closed ball for the game area (eg. a rectangle and objects are allowed to have position coordinates on all 4 edges).

However, this becomes problematic when partitioning the game area (eg. gridding/quadtrees). The edge cases would have to be added in so that 2 edges of the game area are included in rectangles that touch them or objects on 2 edges would have to be missed out in the partition.

Is there another solution to this or do games (and other programs this applies to) usually go with one of the above 2?

(One solution is to use integer coordinates, but what if using floats is unavoidable?)

sentences:
breakout game, computing optimal ricochet angle of a ball to get to a certain point perhaps the title isn't clear so here is an explanation with a picture to better express my question

Consider the following breakout clone game

where the game is rigged to change the ricochet angle according to some parameters

Suppose the ball was to hit one of these blue bricks, finding the angle at which the ball should ricochet to go toward any point below the bricks using trigonometry should be trivial and easy.

My question however, is if we have the following setup

How would I got about finding the optimal angle to ricochet from the collision point (circled in red) to get to a certain location (green dot for example)

The path should ricochet off of multiple points to get there, obviously, I'm just not sure how to go about it.

Any math guru who can help me out? Thanks!

sentences:
Dual touch controls turning on one axis I wanted a swift look around functionality to be put in the middle of a room and just look around.
So obviously I imported the standard assets and put the FPS controller in the middle and then dragged in the Dual touch controls and build it to android.
The problem is that it only rotates horizontally and not vertically. I tried playing around with the values a bit but nothing seems to be working.

sentences:
Unity3D Directional lights vs Draw calls I need 2 light sources looking at a different direction as per my design.
This means, I cannot flag one of them as 'not-important'!
I found that because I'm using 2 directional lights, drawcalls are aggrevated.
Can somebody provide me a direction.

With one DL: 7 draw calls. With 2 it goes to 60 odd.
It is the same case if I switch them vice versa.

sentences:
Variable not set before reading it error in GameMaker Studio 2 I am following along with a guide. I'm trying to reference code from an instance in my room, but whenever I try to run the script I get this error:

ERROR in action number 1 of Create Event for object objSmileyFace:
Variable objHealth.(100004, -2147483648) not set before reading it.
at gml_Object_objSmileyFace_Create_0 (line 4) - objHealth.playerHealth = objHealth.playerHealth + 10;
gml_Object_objSmileyFace_Create_0 (line 4)

It says objHealth is not set, which is not true. What am I doing wrong?

sentences:
Panorama from cube map without geometry Is it possible to achieve effect equivalent to looking on the cube textured from cube map from its center, but without creation of its faces (6 quads or 12 triangles)?

Say, one needed a skybox, but without the "box". There is no anything except skybox and there is no need to calculate depth of something - all the points of that skybox are always visible.

sentences:
How do I render to a texture loaded from a PNG file using SDL2 I'm trying to create a simple 2D game using C++ and SDL2.

I thought it would be a good idea to go for a "layered" rendering model.

I would render my background first, then the world, then the constructs (things like building etc.), then the objects (NPC's etc.) and lastly a toggle-able debug-overlay.

Right now I'm just trying to render a background and a debug overlay but I've hit a wall.

I can't seem to be able to render my debug-overlay on top of my background.

I've set blending mode to SDL_BLENDMODE_NONE for the background and SDL_BLENDMODE_BLEND for the debug overlay.

The problem is however, that my background is loaded from a PNG file, but when calling SDL_CreateTextureFromSurface() the texture access is set to SDL_TEXTURE_ACCESS_STATIC. (Which can't be used as a target if I understand correctly).

My question is: How can I circumvent this issue? How can I make my background "drawable"?

EDIT: Grammar

sentences:
Unity Make sprite visible only to shaders I have made a shader for my UI buttons, the sprites should be black and white, so they can be used as a mask when blending. They should allow for the image behind them to pass through the whiter pixels and be blocked by the darker ones.

I want to use this effect for my menu, have a black background and a colored one (like a gradient or a pattern), let the colored one pass only through the buttons and the black one everywhere else.

My shader does just that, but with one problem. I can't hide the colored background from the camera. If I change it's layer it is useless (I guess because it is the child of a canvas), and if I use a regular sprite (non UI) it is just ignored by the camera and the buttons don't pick up the color.

How can I achieve this effect, having the sprite be invisible to the camera but visible to the shaders of the buttons.

sentences:
Get the game state using Multithreading in Java Monkey Engine 3 I’ve been trying out Java Monkey’s multi threading recently via the wiki’s tutorial. Since I just wanted to test a prototype clinet, I made a program which creates some cubes using the ‘Cubes’ library (hub.jmonkeyengine.org/wiki/doku.php/jme3:contributions:cubes), and then serializes it to some byte data (which is what the server would do to the map chunks near a player). The aim is to imitate a chunk being sent from the server, which would occur in a separate thread, as mentioned in the networking tutorial on the wiki (hub.jmonkeyengine.org/wiki/doku.php/jme3:advanced:networking).

Each chunk would have it’s own node to store it, and the chunk would be replaced if the server sent either an update of the chunk, or if the player moved into a new region (which would cause the chunk to be replaced). The code is here. The issue is though, is that I need to recreate an empty chunk before I can read from the bytes, which requires collecting the application settings. As well as this, I cannot modify the game scene within a separate thread (which the function does). The code below is from line 93+.

//...
//(In Update Loop)
if (future.isDone()) {
    //Binds the temporary data to the clone object
    blockTerrainClone = (BlockTerrainControl) future.get();
    future = null;
//...

Callable<BlockTerrainControl> serverInput = new Callable<BlockTerrainControl>() {
    public BlockTerrainControl call() {
        /*Creates a temporary data storage object, then assigns the data.
        I can't mutate the current BlockTerrainControl which is being rendered,
        as this is a seperate thread.*/
        BlockTerrainControl data = new BlockTerrainControl(CubesTestAssets.getSettings(app), new Vector3f());
        CubesSerializer.readFromBytes(data, serializedBlockTerrain);

        //Returns the data
        return data;
    }
};

The multithreading wiki article (near the bottom) does partially cover how to modify the scene and get access to the game state, but not into much detail. Would anyone be able to expand on that section, and explain how I may be able to transfer the blocks from the server to the client in a separate thread (or in this case, make the data transfer from one thread to another)?

If I missed out anything in the question, I'd be happy to add it!

sentences:
Tick() method error when I run it. HELP! Okay so I get this error:

Exception in thread "Thread-2" java.lang.NullPointerException
at basic.game.here.Game.tick(Game.java:71)
at basic.game.here.Game.run(Game.java:54)
at java.lang.Thread.run(Unknown Source)

Here is the code it says the error relates to:

package basic.game.here;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

import basic.game.here.tiles.Ground;

public class Game extends Canvas implements Runnable {

private static final long serialVersionUID = 1L;

public static final int WIDTH = 960, HEIGHT = WIDTH / 12 * 9;

private Thread thread;

private boolean running = false;

private int FPS = 0;

private World world;
private Player player;

public Game(){
    new Window(WIDTH, HEIGHT, "BASIC", this);

    world = new World();

    player = new Player(500, 200);

}

public synchronized void start(){
    thread = new Thread(this);
    running = true;
    thread.start();
}

public synchronized void stop(){
    try{
        thread.join();
        running = false;
    }catch(Exception e){
        e.printStackTrace();
    }
}

public void run() {
    long lastTimeChecked = System.nanoTime();
    int frames = 0;
    while(running){
        tick();
        render();
        try {
            Thread.sleep(6);
        } catch (InterruptedException e){
            e.printStackTrace();
        }
        frames++;
        if(System.nanoTime() - lastTimeChecked >= 1000000000){
            FPS = frames;
            frames = 0;
            lastTimeChecked = System.nanoTime();
    }
}
}

private void tick() {
    player.tick();
}

private void render(){
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null){
        this.createBufferStrategy(3);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    g.setColor(Color.BLUE);
    g.fillRect(0, 0, WIDTH, HEIGHT);

    g.setColor(Color.YELLOW);
    g.setFont(new Font("Dialog", Font.BOLD, 18));
    g.drawString("" + FPS, 5, 20);

    //g.drawString("(" + player.x + ", " + player.y + ")", 5, 40);

    world.render(g);
    player.render(g);

    g.dispose();
    bs.show();
}

public static void main(String[] args){
    new Game();
}

}

Here is the player class because I think it is related to this:

package basic.game.here;

import java.awt.Color;
import java.awt.Graphics;

public class Player {

private int x, y;

public Player(int x, int y){
    this.x = x;
    this.y = y;
}

public void tick(){

}

public void render(Graphics g){
    g.setColor(Color.CYAN);
    g.fillRect(x, y, 16, 16);
}

}

Thanks in advance!

sentences:
Checking game objective status in efficient way on each update call I am creating a 2d mobile game where there are three levels. Each level has 20 objectives. This can increase in the future.

Examples:

Level 1
Current Objective: 2/20
Objective : Collect 1000 coins
Rewards: 100  coins.

Level 1
Current Objective: 20/20
Objective : Kill 100 aliens
Rewards: Shotgun

The question is, when a user is playing a game, how do you check if he has already completed his current objective in efficient way? This is not involving any third party listener like GameCenter, Scoreloop, etc.

I do not want to have a method with zillions of switch/if-else/or any other conditional blocks to be checked in every update call since this will affect the FPS. Some frameworks are not thread-safe. So having a separate thread is not an option either since I am going to port it to some other platforms using some other frameworks.

How do I go about it?

sentences:
Method for creating a next gen MMORPG out of thin air? Update August 2012: thank you all for your answers. I started small as suggested, creating first a Facebook Game about it, the next step will be to port it later on PC for a 3D version, and much later as a MMORPG as I would have build credibility and funding. The upcoming FB game will be done by Blup Blup Game Studio (my studio). Thanks.

Original Question:
Background:
I am documenting since a few months a game design document (GDD)(sci-fi & fantasy MMORPG) all by myself, without any real game design background (I am just a Chartered Accountant (CA and CISA)). For now, it looks more like a proposal document.

The question:
If you would have a series of amazing ideas that would revolutionized MMORPGaming how would you create that company out of thin air? Focus on creating the initial core team that would create the mockup that would be present to capital venture companies for major financing.

You may not be financial expert here but you did a massive amount of games in the past, of various types and platforms. With our different backgrounds we are complementary.

Cheers,

Raistx

P.-S. Edited for a leaner question. Removed elements linked to money as it's not the core question. I know how to get money and convince cap venture CIES, but I need a mockup / high pitch to do so.

sentences:
Why am I not getting an sRGB default framebuffer? I'm trying to make my OpenGL Haskell program gamma correct by making appropriate use of sRGB framebuffers and textures, but I'm running into issues making the default framebuffer sRGB.

Consider the following Haskell program, compiled for 32-bit Windows using GHC and linked against 32-bit freeglut:

import Foreign.Marshal.Alloc(alloca)
import Foreign.Ptr(Ptr)
import Foreign.Storable(Storable, peek)
import Graphics.Rendering.OpenGL.Raw
import qualified Graphics.UI.GLUT as GLUT
import Graphics.UI.GLUT(($=))

main :: IO ()
main = do
    (_progName, _args) <- GLUT.getArgsAndInitialize
    GLUT.initialDisplayMode $= [GLUT.SRGBMode]
    _window <- GLUT.createWindow "sRGB Test"

    -- To prove that I actually have freeglut working correctly.
    -- This will fail at runtime under classic GLUT.
    GLUT.closeCallback $= Just (return ())

    glEnable gl_FRAMEBUFFER_SRGB
    colorEncoding <- allocaOut $ glGetFramebufferAttachmentParameteriv
        gl_FRAMEBUFFER gl_FRONT_LEFT gl_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING
    print colorEncoding

allocaOut :: Storable a => (Ptr a -> IO b) -> IO a
allocaOut f = alloca $ \ptr -> do
    f ptr
    peek ptr

On my desktop (Windows 8 64-bit with a GeForce GTX 760 graphics card) this program outputs 9729, a.k.a. gl_LINEAR, indicating that the default framebuffer is using linear color space, even though I explicitly requested an sRGB window. This is reflected in the rendering results of the actual program I'm trying to write - everything looks washed out because my linear color values aren't being converted to sRGB before being written to the framebuffer.

On the other hand, on my laptop (Windows 7 64-bit with an Intel graphics chip), the program prints 0 (huh?) and I get an sRGB default framebuffer by default whether I request one or not! And on both machines, if I manually create a non-default framebuffer bound to an sRGB texture, the program correctly prints 35904, a.k.a. gl_SRGB.

Why am I getting different results on different hardware? Am I doing something wrong? How can I get an sRGB framebuffer consistently on all hardware and target OSes?

sentences:
How do I do random isometric paths? I'm working on an isometric city generator, and I am looking for a little push in the right direction. I'm looking to randomly generate roads on an isometric plane. I have never done path making before, and I've Googled it and didn't find any articles relating to what I am trying to do.

Basically, my program generates a random isometric city and I am hoping to add roads to that.

sentences:
Is it possible to use an SVG as a texture for a 3d object? I'm using the Vector Graphics plugin for Unity 2019 and am able to drag an SVG into the scene. However, I am not able to drag it onto a 3d object as I am with a PNG. My goal is to make 3d cubes that rotate with a particular icon on each side of the cube.

I came across this related post: SVG textures for 3D game objects in Unity? but I'd like to make sure there haven't been any advancements since 2017 in this area. Also, would it be possible to add an SVG to a material? I can't figure out a way to do it but I am not very experienced with Unity.

sentences:
One index buffer with multiple vertex buffers? I noticed that there's IASetVertexBuffers() to set multiple vertex buffers at once but there's only IASetIndexBuffer() to set one index buffer. So I assume that I can simultaneously only have one index buffer set but I can have multiple vertex buffers set at the same time.

Is that correct?
How do I use index buffer with multiple vertex buffers? I.e. what indices do I provide to use more than one vertex buffer and how do I know what buffer conrete indices refer to?

Or is this used only in the case when instead of interleaved vertex data: (Pos, Normal, Pos, Normal, Pos, Normal) I provide the data in multiple buffers: (Pos, Pos, Pos) (Normal, Normal, Normal) and conrete indices refer to the same vertices in each buffer?

sentences:
Per pixel normal mapping resulting in static on normals starting on Z axis For the past week I've been trying to implement bump mapping in DirectX 11 using the Frank Luna's '3D Game Programming with DirectX 11' book. I got it working until I tried to add a flat 2D plane facing in the -Z axis and the texture appeared distorted. After a while I found out it was the bumped normals that were causing it.

I've used Terathon to calculate tangents after generating a mesh.

My code is as follows:

void AddTangentToVertexArray(const UINT vertexCount, const UINT indexCount, PackedVertex* vertices, const WORD* indices)
    {
        const UINT triangleCount = indexCount/ 3;

        XMVECTOR* tan1 = new XMVECTOR[indexCount* 2];
        XMVECTOR* tan2 = tan1 + indexCount;
        ZeroMemory(tan1, indexCount* sizeof(XMVECTOR) * 2);

        for (UINT a = 0; a < indexCount; a++)
        {
            WORD i1 = indices[(a * 3)];
            WORD i2 = indices[(a * 3)+1];
            WORD i3 = indices[(a * 3)+2];

            const XMFLOAT3& v1 = vertices[i1].vertex;
            const XMFLOAT3& v2 = vertices[i2].vertex;
            const XMFLOAT3& v3 = vertices[i3].vertex;

            const XMFLOAT2& w1 = vertices[i1].uv;
            const XMFLOAT2& w2 = vertices[i2].uv;
            const XMFLOAT2& w3 = vertices[i3].uv;

            FLOAT x1 = v2.x - v1.x;
            FLOAT x2 = v3.x - v1.x;
            FLOAT y1 = v2.y - v1.y;
            FLOAT y2 = v3.y - v1.y;
            FLOAT z1 = v2.z - v1.z;
            FLOAT z2 = v3.z - v1.z;

            FLOAT s1 = w2.x - w1.x;
            FLOAT s2 = w3.x - w1.x;
            FLOAT t1 = w2.y - w1.y;
            FLOAT t2 = w3.y - w1.y;

            FLOAT r = 1.0f / (s1 * t2 - s2 * t1);
            XMVECTOR sdir{ (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
                (t2 * z1 - t1 * z2) * r };
            XMVECTOR tdir{ (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) *r,
                (s1 * z2 - s2 * z1) * r };

            tan1[i1] += sdir;
            tan1[i2] += sdir;
            tan1[i3] += sdir;

            tan2[i1] += tdir;
            tan2[i2] += tdir;
            tan2[i3] += tdir;
        }

        for (UINT a = 0; a < vertexCount; a++)
        {
            const XMVECTOR& n = XMLoadFloat3(&vertices[a].normal);
            const XMVECTOR& t = tan1[a];

            XMStoreFloat4(&vertices[a].tangent, XMVector3Normalize((t - n * XMVector3Dot(n, t))));

            vertices[a].tangent.w = (XMVector3Less(XMVector3Dot(XMVector3Cross(n, t), tan2[a]), XMVECTOR{ 0.0f, 0.0f, 0.0f, 0.0f })) ? -1.0f : 1.0f;
        }

        delete[] tan1;
    }

And I used Frank Luna's implementation to use those tangents to calculate the bitangent but in the the newer version of directX 11

float3 NormalSampleToWorldSpace(float3 normalMapSample, float3 NormalW, float4 TangentW)
{
    float3 NormalT = 2.0f*normalMapSample - 1.0f;
    float3 N = normalize(NormalW);
    float3 T = normalize(TangentW - dot(TangentW, N)*N);
    float3 B = cross(N, T) *TangentW.w;

    float3x3 TBN = float3x3(T, B, N);

    float3 bumpedNormalW = mul(NormalT, TBN);

    return normalize(bumpedNormalW);
}

EDIT: After a couple hours of debugging I've found that changing the T calculation to float3 T = normalize(TangentW - dot(TangentW, N));// *N); seems to have stopped any distortions. If someone can confirm that this isn't going to cause later issues I'm willing to say it's solved.

All surfaces are using the same normal map in the following gifs.

A visual example of what happens to normals facing down and up the Z axis

Here is the same plane but rotated 90 degrees

A visual example of a sphere that isn't affected by the distortion due to what i can only assume is having no normals along the Z axis

My guess is that something is wrong within the tangent calculator as the error persists when the plane is rotated, but I cannot seem to find anything different to the version on Terathon.

If there's anything else that you need to tackle the problem just let me know and I can supply it.

sentences:
How to make the snake bodyParts follow same places and directions as the player on a curved surface? I try to make a game like the classic snake game but on a round ground (Earth). On a plane, the script works well, but when i moved it on a sphere, the bodyparts (prefabs), are not working good as you can see in the picture ( they are going right/left, but they do not sit on the spehre and i tried already to use sphere collider, box collider, rigidbody) and i dont know really how to make it so that they will follow 100% correctly the player. Thanks for help! :/ . Here i put the script for the Player and bodyparts:
using System.Collections;

using System.Collections.Generic;

using UnityEngine; using UnityEngine.UI;

public class PlayerMovementScript : MonoBehaviour {

protected Joystick joystick;
public float speed;
[SerializeField] private float turnFactor;
[SerializeField] private Transform planet;
public List<Transform> bodyParts = new List<Transform>();
public float minDistance = 0.25f;
public int beginSize;
public float rotationSpeed = 50;
public float timeFromLastRetry;
public GameObject bodyprefabs;
public Text currentScore;
public Text scoreText;
public GameObject deadScreen;
private float dis;
private Transform curBodyPart;
private Transform PrevBodyPart;

public bool isAlive;
 void Start()
{
 joystick = FindObjectOfType<Joystick>();
 speed = 3f;
 StartLevel();
}
public void StartLevel()
{
 timeFromLastRetry = Time.deltaTime;
 //deadScreen.SetActive(false);
 for (int i = bodyParts.Count -1; i > beginSize; i++)
 {
     Destroy(bodyParts[i].gameObject);
     bodyParts.Remove(bodyParts[i]);
 }
 bodyParts[0].position = new Vector3(0, 0.5f, 0);
 for (int i = 0; i < beginSize - 1; i++)
 {
     AddBodyPart();
 }
 bodyParts[0].position = new Vector3(0, 0.5f, 0);
 bodyParts[0].rotation = Quaternion.identity;
 currentScore.gameObject.SetActive(true);
 currentScore.text = "Score: 0";
 isAlive = true;
}
void Update()
{
 if (isAlive)
       Move();
 if (Input.GetKey(KeyCode.Q))
     AddBodyPart();
 //RotateAroundPlanet();
 var rb = GetComponent<Rigidbody>();
 //rb.velocity = new Vector3(joystick.Horizontal * 100f, rb.velocity.y, joystick.Vertical * 100f);
}
public void Move()
{
 float curspeed = speed;
 //if (Input.GetKey(KeyCode.W))
 //    curspeed *= 2;
 bodyParts[0].Translate(bodyParts[0].forward * curspeed * Time.smoothDeltaTime, Space.World);
 if (Input.GetAxis("Horizontal") != 0)
     bodyParts[0].Rotate(Vector3.up * rotationSpeed * Time.deltaTime * Input.GetAxis("Horizontal"));
 for (int i = 1; i < bodyParts.Count; i++)
 {
     curBodyPart = bodyParts[i];
     PrevBodyPart = bodyParts[i - 1];
     dis = Vector3.Distance(PrevBodyPart.position, curBodyPart.position);
     Vector3 newpos = PrevBodyPart.position;
     newpos.y = bodyParts[0].position.y;
     float T = Time.deltaTime * dis / minDistance * curspeed;
     if (T > 0.5f)
         T = 0.5f;
     curBodyPart.position = Vector3.Slerp(curBodyPart.position, newpos, T);
     curBodyPart.rotation = Quaternion.Slerp(curBodyPart.rotation, PrevBodyPart.rotation, T);
 }
}
public void AddBodyPart()
{
 Transform newpart = (Instantiate(bodyprefabs, bodyParts[bodyParts.Count - 1].position,
 bodyParts[bodyParts.Count - 1].rotation) as GameObject).transform;
 newpart.SetParent(transform);
 bodyParts.Add(newpart);
 currentScore.text = "Score: " + (bodyParts.Count - beginSize).ToString();
}
public void Die()
{
 isAlive = false;
 scoreText.text = "Your score was: " + (bodyParts.Count - beginSize).ToString();
 currentScore.gameObject.SetActive(false);
 deadScreen.SetActive(true);
}

sentences:
Admob banner not getting remove from superview I am developing one 2d game using cocos2d framework, in this game i am using admob for advertising, in some classes not in all classes but admob banner is visible in every class and after some time game getting crash also.

I am not getting how admob banner is comes in every class in fact i have not declare in Rootviewcontroller class. can any one suggest me how to integrate Admob in cocos2d game, i want Admob banner in particular classes not in every class,
I am using latest google admob sdk, my code is below:

Thanks in advance

`

-(void)AdMob{
NSLog(@"ADMOB");

CGSize winSize = [[CCDirector sharedDirector]winSize];
// Create a view of the standard size at the bottom of the screen.

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-364,
                                           size.height -
                                           GAD_SIZE_728x90.height,
                                           GAD_SIZE_728x90.width,
                                           GAD_SIZE_728x90.height)];

}
else { // It's an iPhone

    bannerView_ = [[GADBannerView alloc]
                  initWithFrame:CGRectMake(size.width/2-160,
                                           size.height -
                                           GAD_SIZE_320x50.height,
                                           GAD_SIZE_320x50.width,
                                           GAD_SIZE_320x50.height)];
}

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    bannerView_.adUnitID =@"a15062384653c9e";
}
else {
    bannerView_.adUnitID =@"a15062392a0aa0a";
}

bannerView_.rootViewController = self;
[[[CCDirector sharedDirector]openGLView]addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];

GADRequest *request = [[GADRequest alloc] init];
request.testing =  [NSArray arrayWithObjects:
                  GAD_SIMULATOR_ID, nil];                              // Simulator

[bannerView_ loadRequest:request];
 }

   //best practice for removing the barnnerView_

-(void)removeSubviews{
 NSArray* subviews = [[CCDirector sharedDirector]openGLView].subviews;
 for (id SUB in subviews){
    [(UIView*)SUB removeFromSuperview];
    [SUB release];
 }
 NSLog(@"remove from view");
  }

    //this makes the refreshTimer count
-(void)targetMethod:(NSTimer *)theTimer{

//INCREASE OF THE TIMER AND SECONDS
elapsedTime++;
seconds++;

//INCREASE OF THE MINUTOS EACH 60 SECONDS
if (seconds>=60) {
    seconds=0; minutes++;
    [self removeSubviews];
    [self AdMob];
  }
NSLog(@"TIME: %02d:%02d", minutes, seconds);
 }

`

sentences:
Cocos2D: Change animation based on joystick direction I'm trying to get my figure to look in the right directions, based on the input of the joystick. So if I tilt left it looks left and the left animation is used, if I used right, it looks right and right animation is used, if up, then up, down, down and so on. I just get animation for front and back. Also if I press up I see the back of the figure correctly, but it won't go back into the original state when I don't press up anymore.

-(void)applyJoystick:(SneakyJoystick *)aJoystick forTimeDelta:(float)
deltaTime {
    CGPoint scaledVelocity = ccpMult(aJoystick.velocity, 128.0f);
    CGPoint oldPosition = [self position];
    CGPoint newPosition =
    ccp(oldPosition.x + scaledVelocity.x * deltaTime,
    oldPosition.y + scaledVelocity.y * deltaTime);
    [self setPosition:newPosition];
    id action = nil;
   int extra = 50;
if ((int) aJoystick.degrees > 180 - extra && aJoystick.degrees < 180 + extra) {
action = [CCAnimate actionWithAnimation:walkingAnimLeft restoreOriginalFrame:NO];

} else if ((int) aJoystick.degrees > 360 - extra && aJoystick.degrees < 360 + extra) {
    action = [CCAnimate actionWithAnimation:walkingAnimRight restoreOriginalFrame:NO];
}

else if ((int) aJoystick.degrees > 90 - extra && aJoystick.degrees < 90 + extra) {
    action = [CCAnimate actionWithAnimation:walkingAnimBack restoreOriginalFrame:NO];

}
 else if ((int) aJoystick.degrees > 270 - extra && aJoystick.degrees < 270 + extra) {
action = [CCAnimate actionWithAnimation:walkingAnimFront restoreOriginalFrame:NO];
}

if (action != nil) {
[self runAction:action];
        }
    }
}

sentences:
Techniques for building out a game idea and mechanics I've been finding that many of my projects fall into the abyss of my "game mechanic tests". That is, they aren't really "games", but rather sandboxes where I try out various things and find some mechanics that would be fun.

Now, I'd like to actually create a game out of some these ideas. Since so many of my "games" end up turning into additional sandboxes when I get distracted by a new idea("whoa, that's cool", and suddenly the whole game completely changes.. twenty times.. sometimes back and forth between several competing ideas), I'd like to actually plan out the mechanics, how they will fit together, and altogether how the game will work as a whole, even though I know I still need to be semi-flexible for when things play-test differently than expected.

This is compared to my usual strategy of, "Let's just get started and then I will build a game out of whatever I create" mindset.

What techniques are used for planning out a game idea (even if just roughly), before actually just jumping in? Is there specific software which helps? How do I go about managing the planning phase in general and keeping things up-to-date if things start to change?

See this great answer on a separate question for the type of actual design I would like to work on for my game, opposed to the programming focus I generally approach things with.

sentences:
NULL REFERENCE EXCEPTION Object reference not set to an instance of an object So I have 3 scripts:

first for my player movementscript
second for my speed powerup speedscript
third for my obstacle box script i

I'm trying to get the component of box script in speed script, to get the function 'added' (which is in box script) into speed script but it keeps giving me nullreferenceexception error

Here are those scripts:

public class box : MonoBehaviour
{

    [SerializeField]
    GameObject effect;

    public int damage = 1;
    [SerializeField]
    float Speed =10f;
    [SerializeField]
    GameObject audioexplosion;

    void Update()
    {

        transform.Translate(Vector2.left * Speed* Time.deltaTime);

    }

    void  OnTriggerEnter2D(Collider2D col)
    {
        if(col.CompareTag("Player"))
        {
            Instantiate(audioexplosion, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);

            movment tmp = col.GetComponent<movment>();

                tmp.health -= damage;
            Destroy(gameObject);
        }
    }
    public void added(float spd)
    {
        Speed += spd;
    }

}

And here is my speed script.

public class speedscript : MonoBehaviour
{
    [SerializeField]
    GameObject effect;
    [SerializeField]
    GameObject speedaudio;
    //[SerializeField]
   public float speed;
    public float add_v = 5;
    private float timeindue;
    //[SerializeField]
 //  public box io;

    void Start()
    {

     //  io= GetComponent<box>();
       // Debug.Log(io);
    }

    void Update()
    {
        transform.Translate(Vector2.left * speed * Time.deltaTime);
    }

    void OnTriggerEnter2D(Collider2D sp)
    {
        if (sp.CompareTag("Player"))
        {
            Instantiate(speedaudio, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);
            box io = GetComponent<box>();
                Debug.Log(io);
                io.added(add_v);

                Destroy(gameObject);
        }
    }
}

sentences:
How to make the background tilemap in Unity3D have a "far away fog effect" filter in a sidescroller game? I would like my background made of the same tiles as my foreground but with a filter which makes it appear further away from the camera.

Making the objects smaller is easy, I just have to decrease the scale of the tilemap.

But I also want it to have a "fog effect". So for example if the sky is blue then the tiles will be as blueish as far they are from the camera.

How could I implement this?

Example for fog effect:

sentences:
How can I get the "SelfActor" in OnBeginActorOverlap? The signature it takes is

void ( AActor* OtherActor )

However, The actor that is handling this event is not involved in the overlap. How can I access the actor that owns this delegate? Assuming I can't store a reference to this elsewhere. Is there another delegate that takes that parameter? Is this reference stored in OtherActor somewhere?

sentences:
How to update rule tile (brush) from Unity's 2D grid tile map palette? I have created a Palette in Unity and created a map using that rule

Now, I want to replace the current rule with another one, without having to draw everything once more. I tried to drag and drop the new rule on the same position in the palette, but the drawn map was not updated.

I am a little anxious about creating a (large) map unless I know of a way to update a brush without having to redraw everything.

sentences: How can I go about testing games on a console I was wondering how I could play a game I've made on a console (PS3). I don't want to sell it or anything I just want to test it for now, also do I still have to do that whole registration thing to do this? Oh, I'm also using Unreal Engine 4 for this.

sentences:
When should vector/list be used? I can understand when to use lists, but I don't understand when it is better to use vectors than using lists in video games: when it is better to have fast random access ?

(And I understand why it's faster to insert/delete in lists because it just removes/adds pointers, but it still has to find the corresponding item...)

sentences: Pseudo-code examples of A*? I'm looking for pseudo-code examples of the A* pathfinding algorithm that actually works. I tried plenty of different ones where it's not really clear how to implement them at all times. Keep in mind that I'm a newbie, so if everything could be detailed, that'd be great.

sentences:
How can I create borders in an open-world game that don't feel artificial? When creating open-world maps, a big issue to take into consideration is how "borders" of sorts are implemented. Obviously, in an open-world game, there shouldn't be invisible-wall borders, as it ruins immersion, and makes the game feel more "artificial".

I've done a little bit of research online and I've found the following methods:

Have the map be an island, surrounded by water that will kill you if you venture out too far.
Have the map be surrounded by mountains that are much too steep to climb over.
A combination of the above; mountains plus a body of water. The Elder Scrolls V: Skyrim does something like this but does have places where paths lead out of the world. (Thanks @Pharap)

These seem like the best methods but I'm wondering if there are any other methods that can be used to create borders in an open world without ruining immersion.

sentences:
I need some help with stopping individual sound effects in OALSimpleAudio I'm trying to find out how to stop a specific sound effect rather than having to stop all of them.

I'm using OALSimpleAudio.

I can't seem to find how to do it. simple google searches result in nothing, which means my searches are crap, it's REALLY easy to do and i'm ... stupid :p, or it isn't possible.

I hope you guys can help me.

In the background i have a humming engine sound, but when the object takes damage, the humming sound is stopped, that's not what i want.

case kStateTakingDamage:
        CCLOG(@"Ship taking damage");
        [self playTakingDamageSound];
        self.characterHealth = self.characterHealth - 1.0f;
        action = [CCActionAnimate actionWithAnimation:damageAnimation];
        [[GameManager sharedGameManager] stopSoundEffect];
        break;

- (void) playSoundEffect: (NSString *) soundEffect {
    [self playSoundEffect: soundEffect andLoop: NO];
}

- (void) playSoundEffect: (NSString *) soundEffect andLoop: (BOOL) loop {
    [[OALSimpleAudio sharedInstance] playEffect:soundEffect loop: loop];
}

- (void) stopSoundEffect {
    [[OALSimpleAudio sharedInstance] stopAllEffects];
}

- (id) isSoundPlaying {
    //TODO: find out how this works ;
}

sentences:
How to create a linear plateform between two points? I have a set of 2D coordinates. Their positions are regular on the X axis, but unpredictable on the Y axis:

I would like to create slim platform between each point in order tu use it as ground for my game, expecting a result like this:

I'm working with Box2D, so I thought about create boxes like this:

float x1, y1, x2, y2; // Coordinates between two points
float centerX, centerY;
float differenceX, differenceY;
float width;
b2BodyDef bodyDef;
b2Body* body;
b2PolygonShape shape;

centerX = (x1 + x2) / 2.0;
centerY = (y1 + y2) / 2.0;
differenceX = x2 - x1;
differenceY = y2 - y1;
width = sqrtf(differenceX * differenceX + differenceY * differenceY);
height = 10.0f

bodyDef.position.Set(centerX, centerY);
bodyDef.angle = -M_PI / 4.0f * width / height
body = world.CreateBody(&bodyDef);
shape.SetAsBox(width, 10.0f);
body->CreateFixture(&box, 0.0f);

But the wrong part of this code seems to be on angle. I cannot find the correct rotation between two points from their coordinates.

Is there a correct math formula to find it?
Or am I simply wrong to use rectangular boxes to trace it, and should I use something else? Like a b2PolygonShape?

sentences:
how to devise a scoring algorithm based on elapsed time and number of moves I want to devise an score algo for my game.
I want to award high scores to players who achieve the goal in minimum time and least number of moves.

I did this but its not going correctly:

var score = ((finishSeconds / moveCount).toFixed(2) * 100).toFixed(0);

sentences:
Tank movement based on track speeds I want a system, where a tank moves and rotates based on the speeds I give him for the two tracks, for example, if I give the left track a speed of 1 and the right one a speed of -1, then I want the tank to stay still and rotate right, while if I give the left track 1 and the right track -0.5, I want it to rotate, but at the same time move forward

Of course the speeds will be between -1 and 1

sentences:
What is the point in using real time? I understand that using real time frame elapses (which should vary between 16-17ms on average) are provided by a lot of frameworks.  GetTimeElapsedSinceLastFrame, and it gives you the wall clock time.

But should we use this information in basic physics simulation?  It looks to me to be a bad idea.

Say there is a slight lag on the machine, for whatever reason (say a virus scanner starts up).  The calculations all jump, and there is no need for this.  Why not use a virtual second and ignore wall clock time?  For gameplay on the level of Commander Keen, shouldn't you always use the virtual second and not real-time?  (Besides stopwatch timing for race games) I don't see a need to use real time and not a fixed 16ms time step.

sentences:
How to "mark" a track/ road? I'm developing a simple racing game, using Unity.
I've created a road simply applying a texture (asphalt) to a terrain .
Is it possible (and how to do) to mark that roard with an invisible marker to identifiy that as a road (so i can make appears bonus, or others similar things) ?
Which is the approach used in a racing game to accomplish that task ?
Please, don't tell me "buy a Roads assets" because i want to understand the basics, the main concept.

Thanks

sentences:
Correct way of texture-mapping a 2D mesh in libgdx this is a question regarding the libGDX framework.

I have managed to UV-map a texture to vertices (in 2D) but have come across a few problems that I think might be caused by incorrect order of vertices.

In the first two pictures, you can see a rendering produced by the code-bits below (without blending enabled). It seems fine at first, but you can clearly notice that the lower triangle seems to have a rough transition. Is there an easy way to prevent this (without writing too much low level stuff) or is this an expected limitation of this approach?

The second problem occurs with the same code but with blending turned on. In the fragment shader, you can see that I adjust the alpha level of each pixel in the region, but with this mesh, it produces a rather weird and distorted image in the right triangle area.

Here's the code:

Shaders

//Vertex shader:
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec4 v_color;
varying vec2 v_texCoords;
void main() {
 v_color = vec4(1, 1, 1, 1);
 v_texCoords = a_texCoord0;
 gl_Position =  u_projTrans * a_position;
}

//Fragment shader:
#ifdef GL_ES
precision mediump float;
#endif
varying vec4 v_color;
varying vec2 v_texCoords;
uniform sampler2D u_texture;
void main() {
 gl_FragColor = v_color * texture2D(u_texture, v_texCoords) + vec4(0, 0, 0, -0.50);
}

Mesh

Mesh m = new Mesh(true, 5, 0,
         new VertexAttribute(Usage.Position, 2, "a_position"), //x,y
         new VertexAttribute(Usage.TextureCoordinates,2,"a_texCoord" + 0)); //u,v
         m.setVertices(new float[]{20f, 360f, 0f,0f, //upper left
                                   60f, 20f, 0f, 1f, //lower left
                                   180f,20f,1f,1f, //lower right
                                   220f, 360f, 1f, 0f, //upper right
                                   20f, 360f, 0f, 0f}); //upper left (closure)

Render

//Gdx.gl.glEnable(GL20.GL_BLEND);
//Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
shaderProgram_mesh.begin();
shaderProgram_mesh.setUniformMatrix("u_projTrans", camera.combined);
texture.bind();
m.render(shaderProgram_mesh, GL20.GL_TRIANGLE_STRIP, 0, 5);
shaderProgram_mesh.end();

sentences:
mat3x4 in webGL shaders I am porting the IQM bone animation format to Javascript and have run into a problem...

The vertex shader is failing to compile and the only error message I get out is 'mat3x4' : syntax error on the first occurance of mat3x4 in the file.  Its the very data-type name itself that is unsupported, it seems.

This happens on all machines I have access to for testing, which have a variety of Intel and ATI cards and run Linux with Firefox.  (Chrome is not available.)

If I change all mat3x4 to, say, mat3 then my shader compiles fine.

does webGL support mat3x4?  (I can find nothing via Google)
how can I work around this?  How can I package the bones into mat4, for example, and keep the code working correctly?

sentences:
Avoid if statements in DirectX 10 shaders? I have heard that if statements should be avoid in shaders, because both parts of the statements will be execute, and than the wrong will be dropped (which harms the performance).

It's still a problem in DirectX 10? Somebody told me, that in it only the right branch will be execute.

For the illustration I have the code:

float y1 = 5; float y2 = 6; float b1 = 2; float b2 = 3;

if(x>0.5){
    x = 10 * y1 + b1;
}else{
    x = 10 * y2 + b2;
}

Is there an other way to make it faster?

If so, how do it?

Both branches looks similar, the only difference is the values of "constants" (y1, y2, b1, b2 are the same for all pixels in Pixel Shader).

sentences:
How can I "publish" an Android game without Google Play? I'm new to development and trying to get a sense for the obstacles to publication

If I need to circumvent the Google Play app store, can I publish a game to a website that people can visit in a mobile browser and download and install like any other app?

How does publishing "around" Google Play work? Are there any particular success stories, best practices or problems I should be aware of?

Apologies if there is an obvious answer. I believe I found the answer at one point, but I don't remember and can't find the link.

edit: Thanks everyone! I really appreciate the help. Definitely answers my questions. Looks like I have some options!

sentences:
Is it more efficient to store my tile grid as a dictionary or an array? I've just started making a video game in AS3, and I'm trying to keep the graphics, sound, and actual game state in three completely different spots and sets of classes.  That being the case, the graphics module will have to repeatedly parse the state module.  The game is divided into levels, and each level is divided up into square spaces (like a board game); thus the graphics module will have to repeatedly parse out a certain cross-section of spaces of the current level.

The player will always show up in the middle of the spaces' overall graphic (the "Grid"), and there will be 4 spaces in every direction from the player's positioin that will be displayed, along with any object each space may contain (such as the player, a monster, etc.).

So right now I'm trying to decide how to store the spaces in each level (all of the level's spaces themselves, not the graphics).  The first thing that came to mind was a 2D Array.  Then I started to use a 2D Vector, then came back to using an Array, like at first; and now I'm wondering whether to use an Array or a Dictionary.

The problem:

Let's say a level looks like this:

xxxxxxxxxxxx
xxxxxxxxxxxx
xxxxPxxxxxxx

x's are blank spaces, P is the space that the player.  As the Grid parses this information, if it's a 2D Array, then it can use the length property of the main Array and the length property of each sub-array to set up its for loops reasonably well.  Furthermore if a space is outside the bounds of the 2D array, then rather than wasting memory trying to form more objects in the code or something, the Grid can just assume the space is blank:

var arr:Array;
var space:Space;

for (var i:int = level.playerX - 4; i <= level.playerX; i++)
{
    arr = level.spaces[i];
    if (arr)
    {
        for (var j:int = level.playerY - 4; j <= level.playerY; j++)
        {
            space = arr[j];
            if (space)
            {
                // find every object inside space and animate accordingly
            }
            else
            {
                // assume the space is blank
            }
        }
    }
    else
    {
        // assume the whole column of spaces is blank
    }
}

Within the player's radius, the Grid must animate any non-existent spaces as blanks.  Therefore the graphical output is as follows:

xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxPxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx
xxxxxxxxx

But now if we have a level that looks more like this:

xxxxxxxxxxxxx
xxxxxxxxx
    Pxxxx
    xxxxx

then using an Array leaves two basic options:

Use null elements within the sub-arrays to get the Grid to animate non-existent spaces that come before the real ones in the sub-array (the sub-array's length can be used for non-existent spaces that come after the real ones).
Make that simple for-looping inside the Grid a whole lot more complex to compensate for rows and columns of spaces starting at variable locations along each axis (and not simply ending at variable locations).

I don't want to use option 2.  I was just going to use option 1 with Arrays, but now the possibility of using Dictionaries instead has come to mind.  At least with Dictionaries, I wouldn't have to just waste memory every time I wanted, let's say, for the first space in a row to begin at postion 5.

Sorry, I know this was lengthy, but I hope I've illustrated the problem.  Which is better - an Array, or a Dictionary?  If a Dictionary is better, should it use sub-Dictionaries or sub-Arrays to establish a 2-dimensional effect?  Thanks!

sentences: Does level streaming in games load directly from the HDD? I wondered if the level streaming loads directly from the HDD. My first thought was if that would not be to slow, or if the chunks are just loaded into RAM and asynchronously processed if appropriate or something I didn't thought of yet.

sentences: Algorithm for random flight of a fly I'm new to game development. What is a good algorithm to model the random flight of a fly? I've been looking at path-finding algorithms, but they don't give any interesting random behaviour.

sentences:
How to decide who wins a race? I'im thinking of building a text-based browser game.
A racing game.like F1 or rally.
 users can set-up a car.
thinks like tyres, fuel, driver,brakes.
every attribute gets a value.

the part where i am stuck is the race.

i think a race exist out of corners, straight parts, hills,...

i have no idea how i can come to a solution who wins the race and what the lap times would be.

idea i have:
a race has for all attributes of a car the best value. the car with the best values of that race, normally wins.

anyone with some idea's?

sentences:
Blender: How to "meshify" an object I made from Bezier curves I made a star shape using Bezier curves, and extruded it (see pic below):

What I want to do is give it a rounder look - not just around the edges by using beveling. I want it to kind of look like this (well, that shape anyway):

How would I go about doing this? Please keep in mind that I am extremely new to Blender.

I thought that I could somehow turn this star into those default shapes that have tonnes of squares which I could pull out, and apply a mirror to it so that the same thing happens on both sides. I really don't know how to do it, and would appreciate your help.

sentences:
Multiple semi-dynamic objects in one VBO I am working on a game that uses opengl 3. The huge geometry is spread over a grid of about 270,000 cells. The geometry in each cell, though not very frequently, can change independently from other cells. Usually most of these cells don't contain any geometry at all.

Until now my approach was to have one vertex buffer object per cell.
Today i discovered that alone generating all these VBOs (without any data in them) results in almost 1GB of main memory usage. That would be equivalent to an overhead of around 3KB per VBO.

As it seems this overhead can not be avoided, i first thought of generating a VBO only when the cell creates its first geometry and deleting it once the cell becomes empty again.
This might work quite well, but it would still be inefficient if the geometry happens to have very few geometry in every cell.

So i searched for a different solution and read, that one approach is to put multiple meshes in a single VBO. The problem with that is, that the mesh of a cell may change its size and require more memory in the VBO than initially. This would require subsequent meshes in the VBO to be shifted.

Now my question is: How do i do that?

Do i have to save the mesh for every cell, so i can rewrite it into the VBO when it needs to be shifted?
Would glMapBuffer help me?
Also: Is there a better, completely different solution?

Thanks in advance!

sentences:
Why is C# method not showing up for button's On Click() I have a C# script called MainMenu.cs

Here it is in its entirety

using UnityEngine;
using UnityEngine.UI;

public class MainMenu : MonoBehaviour
{
    public Button btnPlay;

    // Use this for initialization
    void Start ()
    {
        btnPlay = btnPlay.GetComponent<Button>();
    }

    public void PlayLevel()
    {
        Application.LoadLevel(1);
    }
}

In my hierarchy, i have a Main Camera, a Canvas and EventSystem. Under Canvas i have a Button.  I add the MainMenu script to the Canvas and associate the button with Button i have in canvas.  When i go to the button and associate the MainMenu with its OnClick I am expecting to be able to chose PlayLevel() but it is not there.

Am i missing something obvious here?
(Using Unity 5.0)

sentences:
How do I design very difficult games? I would like to design games with very high difficulty levels. I have read these questions:

How is game difficulty tested/balanced?
What is an optimum failure rate that will keep people coming back to my game?

Yet they focus on general game design and balance, and not on the particular topic of increasingly adding to the difficulty of a game.

I understand that difficulty is different for every game, so I would like to know if there are any general guidelines I could follow to avoid falling into common problems that there may be while designing games and levels on the hard side of the difficulty line, regardless of the genre of the game.

Some sub-questions that come to mind are:

How to ensure 'beatability' while designing insanely hard parts of game?
How to know it is possible to actually beat my game?

For instance, when designing a platformer, I could make a really hard sequence of jumping and dodging. Now, as developer, I know precisely how far the player character can jump, how fast projectiles are moving etc, but how can I ensure that the designed level is actually beatable?

I know that the most obvious answer is to try and play it, but then, the game would be only as hard as how good at playing it the developer is.

Does anybody with actual experience making hard games know of any tricks or guidelines I can use to successfully create a difficult game?

sentences:
How do I scale a Spine animation at runtime? The spine docummentation shows how to scale the skeleton when loading.
Is it a must to reload the skeleton to scale the animation while playing it?

sentences: How do you add a scripting language to a game? Let's say I have a game written in C++. But I want to add some modding or scripting functionality to it. How would one go about adding a scripting functionality to your game?

sentences:
2015 android multiplayer server based Implementation There are a lot of old posts about multiplayer implementations on SE, so i'm looking for an up-to-date answer. What is the best server-client implementation of real-time multiplayer now? I have an Amazon MYSQL Server hosted by digitalOcean, I've made a REST web service that communicates with the Server and Android app, and I have my Android app running receiving and sending data.

I want to add a multiplayer minigame to what I have right now where 2 players would see the same screen and one user would receive location data (which i'm already storing in the server and sending to all devices with the app) from the other and would have an interface to interact with the data they're receiving (like building towers around the location and deploying units). The computer AI would need to be synced between both devices.

The matches would last maybe 3 minutes tops and the location data would have to be streamed constantly as well as the interaction from the other user. The computer AI would be streamed to both.

I've done a lot of research on the topic, and most of my experience was from a bluetooth P2P game I created in 2011 using sockets. So what are the most common implementations today? What are the most common libraries? I'm currently using Android Studio for the app and Notepad++ for the PHP webservice.

EDIT:
I'm fine with answers promoting their own products, but explain how your product is better than Google's Game Services (which appears to be the best choice right now). I'm really looking for a way to implement the multiplayer with the server I'm already using.

sentences:
Minimum number of moves algorithm in Java I'm looking to implement the minimum number of moves algorithm for the java game I'm developing but I can't quite figure it out.
Here's an example picture:

There are also some specifications about this:

The solution in the example above is not unique; other solutions would also be valid as long as the "final character layout (or the positioning of the characters in the nodes)" matches a certain condition (I don't think that's very relevant now so won't go into detail). Also, the nodes aren't actually moved, only it's content.
Adjacent elements cannot be swapped (i.e. in the example above, on the starting side's first swap, 'E' couldn't be swapped with neither 'A' or 'B'; B could be swapped with any character but 'E' and so on.)
The same character can be swapped as many times as one wishes. So, for example, 'B', in the starting side of the picture, could be swapped with 'D'
in the first move (B and D trade places) and then 'B' could be swapped with, let's say, 'E' (so B and E trade places).

So how exactly should I approach this, in order to get the minimum moves? I don't need a full solution, but some pseudo-code or a couple of hints would be greatly appreciated!

sentences:
Spawning random items to drop from the top of the screen I'm wondering how to make specific random objects drop. In my case, from the top of the screen.
I have 16 objects, named recycle_items_0 through recycle_items_15.
IEnumerator CreateRoutine()
{
    while (true)
    {
        yield return new WaitForSeconds(3);
        CreateItems0();
    }
}

private void CreateItems0()
{
   Vector3 pos = Camera.main.ViewportToWorldPoint(new Vector3(UnityEngine.Random.Range(0.0f,1.0f),1.1f,0));
   pos.z = 0.0f;
   Instantiate(recycle_items_0, pos, Quaternion.identity);
}

sentences:
How can I extend btCollisionAlgorithm to enable collision with a voxel terrain? I am using Bullet, and am attempting to make a collision algorithm that generates contact points off of a cube-based terrain along with the appropriate collision response. I also plan to extend this to include non-box shapes too, however that is not vital at the moment. I've found that using a triangle mesh is too much of a RAM hog for large maps.

I have tried the procedure outlined by Byte56 here, however, I have a number of questions regarding implementing this with Bullet:

How do you generate a collision shape for the world? Do you use a custom shape? What do you set m_shapeType to be on it?
Or do you still use a box shape the size of the world?
How do you ensure that contact points are freed?
How exactly do you modify processCollision?

What I've done:

I've created a terrainShapethat extendsbtBoxShape, the only difference being thatm_shapeType = CUSTOM_CONVEX_SHAPE_TYPE`, in order for me to be able to register a new collision algorithm with the dispatcher for objects with only this shape.
I've extended the btRigidBody class in a way similar to Byte56 in his question (see the link in the 2nd paragraph), however checkCollisionWith(CollisionObject * co) returns true if any voxel in the AABB of co is not air.
I've extended the btCollisionAlgorithm class, in a way similar to btCompoundCollisionAlgorithm, with processCollision doing the following:

Check the colliding objects passed as arguments, and determine which is the terrain, and which is the entity.
Clear the manifolds any child algorithms.
Call resultOut->setPersistantManifold(resultOut)
Generate new box shapes and transforms in the AABB occupied by the colliding entity, and then call m_dispatcher->findAlgorithm. Store the shape, transform and found algorithm in a Child Algorithm struct for each voxel within the AABB.
Iterate over all child algorithms, calling proccessCollision.
Iterate over all child algorithms, removing any now outside of the AABB of the colliding entity. (calling ~btCollisionAlgorithm() then m_dispatcher->freeCollisionAlgorithm())
Call resultOut->refreshContactPoints().

What works: processCollision is called whenever the player's AABB intersects with non-air voxels.

What doesn't: the collision response is just plain weird... The player entity starts levitating upwards. If it walks into something, it bounces off violently. Sometimes, it is unable to keep moving on one axis after walking into something. What I suspect is going on is that contact points are not being released after collision response, possibly due to the player entity always being in the world object's AABB. I am curious to see if I am barking up the right tree with respect to processCollision?

sentences:
Unity Blurry on new Windows 4k Computer I just got a Razer 14 Inch 4k with a GTX 1060 and am having some blurry rendering in unity. Also the cursor is tiny... Here is a screen shot:

As you can see, the rendering is really blurry. I came from a mac and did not expect unity to look worse after switching to a computer with a great screen res and graphics card...

Please help!

EDIT:

I am still getting jagged shadows but now I seem to be able to fix it with changing shadow distance in Quality Project Settings:

But then the shadow disappears really quick if i have low shadow distance...

sentences:
How can I implement slow motion for one player in multiplayer? Special attacks in Mortal Kombat Mobile require slow motion i.e. delay in game play.

On multiplayer mode, when the opponent uses special attacks, I don't observe any lag/delay.

When I use special attack, the game goes in slow motion mode for me, however I guess my opponent doesn't experience any delay.

How is this possible? How can I implement something like this? Can my multiplayer mode still be real-time when using a feature like this?

sentences:
enemy View Range , chase player for 3D:
Q1 : I want to make zone range for each enemy in the game , so that when the player in the view range he will be chased .

Q2 :if I want to make enemy walk a little bit around his position ( from -10  to 10 ) for example , i.e as he is searching for some one , can you give me just steps ! thanks

Q3 : How to make enemy moves toward Player if he is being detected ?
Sorry for question , but I am new to this world :)

sentences: How can I fade a game object in and out over a specified duration? I would like to know how I can fade a game object in and out. I would like to achieve this using a C# script. As I am quite new to Unity I've read about coroutines but still haven't fully grasped the concept. I would appreciate some assistance.

sentences:
How can you subscribe to Unity input events, instead of polling for them Been trying for days to figure out if there is a way to subscribe to keyboard/mouse events in unity. Instead of having to poll for them every frame and make my own events.

Right now I poll through the inputs and fire off my own events if a button is pressed. I'd prefer to subscribe directly to Unities input events, but have yet to figure out how.

I have a Unity Answers post that may have some relevant info to my question as well: http://answers.unity3d.com/questions/878485/is-there-a-more-efficient-way-to-make-events-for-k.html

sentences:
Adding Color to button after cloning public GameObject button;

public void Start()
{
       GameObject button1 = Instantiate(button) as GameObject;
       button1.transform.SetParent(canvas.transform, false);
       button1.transform.position = new Vector3(7, 0, 2);
}

I have cloned the button game object now want to add color to that game object how can i do it ?

sentences:
Setting a displacement or offset between Snake segements I have a problem in maths or I do not know. I have drawn few circles that simulates the body of a snake, the head of the snake moves and others should follow.  but the is no offset or displacement between the circles, because the current code sets the previous position of the nodes to the current, when I add few numbers to both x, y axis, the body segments get distorted. How do I set the offsets between the segments?

for ( int i = 0 ; i < nodes.size(); i++ )
{
    if( i == 0 )
    {
        // Do calculations for new position

        //Set position and previous position
        nodes[i].m_PrevPos.x = nodes[i].m_Pos.x;
        nodes[i].m_PrevPos.y = nodes[i].m_Pos.y;

    }
    else
    {
        nodes[i].m_PrevPos.x = nodes[i-1].m_Pos.x;
        nodes[i].m_PrevPos.y = nodes[i-1].m_Pos.y;
        nodes[i].m_Pos.x = nodes[i-1].m_PrevPos.x;
        nodes[i].m_Pos.y = nodes[i-1].m_PrevPos.y;
    }
}

I would like also to check the head's node velocity for example:

 if ( nodes[0].m_Pos.x < 5 )
    {

        nodes[0].m_Vel.y = -2;
        nodes[0].m_Vel.x = 0;

        if(nodes[0].counter--<1)
        {
            nodes[0].m_Vel.y = 0;
            nodes[0].m_Vel.x = -2;
            nodes[0].counter = 5;
        }

    }

sentences:
How to make camera smooth when following player When my character moves through my cameras 'FollowPlayer' script, the background just looks really glitchy and bad Is there anyway to fix this?

This is my script:

using UnityEngine;
using System.Collections;
public class FollowPlayer : MonoBehaviour {
    Transform bar;

    void Start() {
        bar = GameObject.Find("PlayerMovingBar").transform;
    }

    void Update() {
        transform.position = new Vector3(
            bar.position.x, transform.position.y, transform.position.z);
    }
}

sentences:
How can I delete an object when it's not stored in an array? I have a boss appearing in my game, but since it's only one character I didn't put it in an array. Now I'm trying to make disappear if its health is less or equal to 0 but I don't know how to do that. Is there a way to remove the object? I only know how to remove a property of an object.

Here's the boss object:

function Boss1(x, y) {
    this.sprite = boss1Sprite;
    this.x = x;
    this.y = y;
    this.imgWidth = 160;
    this.imgHeight = 224;
    this.frameWidth = this.imgWidth / 4;
    this.frameHeight = this.imgHeight / 4;
    this.health = 1500;
    this.directionMode = 1;
    this.currentFrame = 0;
    this.SPEED = 1;
    this.delta = 1;
    this.updateFrame = function () {
        this.currentFrame += 0.2;
    }
    this.showHealth = function () {
        ctx.fillStyle="red";
        ctx.fillRect(this.x,this.y - 10,(this.health/100)*3.3,5);
        ctx.strokeRect(this.x, this.y-10, (100/100) * 50, 5);
    }
    this.show = function () {
        this.updateFrame();
        this.walkingMode = Math.floor(this.currentFrame) % 4;
        ctx.drawImage(this.sprite, this.walkingMode * this.frameWidth, this.directionMode * this.frameHeight, this.frameWidth, this.frameHeight, this.x, this.y, this.frameWidth, this.frameHeight);
    }
    //target == hero
    //position == this
    this.move = function () {
        this.dx = hero.x - this.x;
        this.dy = hero.y - this.y;
        this.length = Math.sqrt(this.dx * this.dx + this.dy * this.dy);
        if (this.length) {
            this.dx = this.dx / this.length;
            this.dy = this.dy / this.length;
        }
        this.x += this.dx * this.delta * this.SPEED;
        this.y += this.dy * this.delta * this.SPEED;
    }
}

//enemy wave object
function random(min, max) {
    return Math.random() * (max - min) + min;
}
function Enemy(x, y){
    this.sprite = enemySprite;
    this.x = x;
    this.y = y;
    this.imgWidth = 128;
    this.imgHeight = 192;
    this.frameWidth = this.imgWidth / 4 ;
    this.frameHeight = this.imgHeight / 4;
    this.toDelete = false;
    this.dx = random(1, 3);
    this.enemiesHealth = 100;
    this.directionMode = 1;
    this.currentFrame = 0;
    this.updateFrame = function(){
        this.currentFrame += 0.2;
    }
    this.showHealth = function (){
        ctx.fillStyle="red";
        ctx.fillRect(this.x,this.y - 10,(this.enemiesHealth/100)*50,5);
        ctx.strokeRect(this.x, this.y-10, (100/100) * 50, 5);
    }
    this.show = function(){
        this.updateFrame();
        this.walkingMode = Math.floor(this.currentFrame) % 4;
        ctx.drawImage(this.sprite,this.walkingMode * this.frameWidth,
        this.directionMode * this.frameHeight, this.frameWidth, this.frameHeight,
        this.x, this.y, this.frameWidth, this.frameHeight );
    }
    this.move = function(){
        this.x = this.x - this.dx;
    }
    this.deletion = function(){
        this.toDelete = true;
    }
}

//this is when the boss is spawning
//the game loop
function draw() {
    bullets = bullets.filter((bullet) => bullet.x <= viewLimit);
    enemies = enemies.filter((enemy) => enemy.x >= viewLimit1);
    while (enemies.length <= enemiesPerTick && kills <= 5) {
        var enemy = new Enemy(canvas.width, random(0, canvas.height - 60));
        enemies.push(enemy);
    }
    for (var v = 0; v < enemies.length; v++) {
        enemies[v].showHealth();
    }
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    hero.show();
    hero.update();
    hero.showHealth();
    for (var i = 0; i < bullets.length; i++) {
        bullets[i].show();
        bullets[i].move();
    }
    for (var j = 0; j < enemies.length; j++) {
        enemies[j].show();
        enemies[j].move();
    }
    for (var t = 0; t < enemies.length; t++) {
        enemies[t].showHealth();
    }
    collision();
    drawScore();
    if (enemies.length == 0) {
        boss1.show();
        boss1.move();
        boss1.showHealth();
    }

    requestAnimationFrame(draw);
}

console.log(enemies, bullets);
draw();

sentences:
How do you tell OpenGL ES 2.0 to use a texture as the depth buffer? I want to render a scene with an outline post processing effect in OpenGL ES 2.0.

First I render all the opaque objects. Then I use a post processing shader
for silhouette detection that uses the depth buffer as a texture.
 And now I want to render all the objects using alpha blending,
without writing to the depth buffer, but using depth testing with
the values from the depth buffer texture used for silhouette detection.

If I would have rendered the translucent objects before the post processing,
 the post processing would have rendered the outlines of opaque objects over
 them since they don't write to the depth buffer.

How do you tell OpenGL ES 2.0 to use a texture as the depth buffer?

Thank you

sentences:
Determining my playable area/field of view Contrary to what I found searching for the answer, I'm not trying to see whether a character is in view of another character. What I need to find out is the size of the field of view. This is because I'm using Mercury Particle Engine in a 3D space, and while MPE emitters take parameters ranging from (0,0) being the upper left corner of the screen to (graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight) being the lower right corner of the screen, the positioning of enemy ships use Vector3 values, where (0,0,0) would be the exact center of the screen. Since my ships don't move along the Z axis, this isn't a problem. What is a problem, however, is translating their coordinates in 3D space to the correct particle emitter positions when I need to show them exploding. This is what I'm currently using to create the perspective field of view:

projectionMatrix = Matrix.CreatePerspectiveFieldOfView(
  MathHelper.ToRadians(45.0f),
  GraphicsDevice.DisplayMode.AspectRatio,
  1250.0f,
  1450.0f);

And this is how I'm attempting to obtain the X and Y values for the particle emitter from the enemy ship position (however, the positions are not quite right with my math because I have the wrong constants):

x = ((float)graphics.PreferredBackBufferWidth/2) + (((float)graphics.PreferredBackBufferWidth/1700) * enemy[i].position.X);

y = ((float)graphics.PreferredBackBufferHeight / 2) + (((float)graphics.PreferredBackBufferHeight / 1100) * enemy[i].position.Y);

That being said, how do I calculate the proper constants from the information on hand?

sentences:
D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_12_0) ISSUE I'm getting this error when I compile this code.

D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_12_0,
IID_PPV_ARGS(&pDevice)).
Error! No such Interface supported

I've got a rtx 2060 GPU installed in my computer.
All my GPU drivers are up to date.
I've got the windows 10 version 1803(OS Build 17134.590)
I've got visual studio 2017 installed and used to compile my code.

Here is the code I'm trying to compile.
https://github.com/acmarrs/IntroToDXR

What, in the hell is this error man its so stupid.
I've been stuck for over 6 damn hours man.
Any help, much appreciated.

sentences:
How do I slow down my character while running? void Movement()
{
    transform.Translate(Vector3.forward * 10 * Time.deltaTime);

    if(Input.GetKey(KeyCode.S))
    {
        transform.Translate(Vector3.forward * 3 * Time.deltaTime);
    }

    if(Input.GetKeyUp(KeyCode.S))
    {
        transform.Translate(Vector3.forward * 10 * Time.deltaTime);
    }
}

I tried this code but seems to me, it didn't work as I expected it to.

What I expect:

my character moves along at a speed of 10 automatically
when the S key is held, the character slows down to a speed of 3 instead
when the S key is released, the character goes back to their default speed of 10

What I observe:

the character does not slow down when the S key is pressed

How can I fix this?

sentences:
What is the "DirectX for Managed Code Update"? I came upon this site while looking for information about working with DX in managed code and saw that MS released something containing a 'DirectX for Managed Code Update'.
This sounds promising but I can't find much information about it.

Is this an out of date update referring to what was formerly Managed DirectX, or something new*?

If new, has anyone used it? How does it compare to SlimDX?

(*as new as it can be from June last  year)

sentences: Rendering 2d sprites into a 3d world? In opengl how do I render 2d sprites in opengl given that I have a png of the sprite? See images as an example of the effect I'd like to achieve. Also I would like to overlay weapons on the screen like the rifle in the bottom image. Does anyone know how I would achieve the two effects? Any help is greatly achieved.

sentences:
Server Side : How to manage "delay" action/event like attacking? at the moment I'm writing a game server, so I made an event "handler". I mean, if a player send to the server "I move" it fire a function, so I think I'm doing well at the moment.

But there's a problem and I don't know how to handle it. Lets take an example.

When a player want to attack he need to press a key one time, and it will attack automaticly every second, that means the server receive one packet with "I attack" and the server handle it, But I don't know how to make the player attacking every second correctly. It's kinda hard to explain I'm sorry ! So what I'm doing at the moment is, if the server receive from the player "I attack" I start a timer for the player which call a function every second. And I do that for every player but, I think that is not a nice idea. Should it be better to make one big timer ? If yes, which interval should I use ? 100ms or more ?

Well I hope you understood me, I know I didn't explain it well and sorry for that ! Thanks in advance for your help.

sentences:
How to build a C# library for Unity as a pure Visual Studio project The aim is to build a relatively simple (2D) game in Unity with most of the game logic in a non-visual AI. The AI needs a lot of testing and debugging independently of any visuals (which is best done using VS tools), and the API connecting them is one class and a few methods/properties. [A future version might not even use Unity.]

So the question is how to set up a VS solution file to build the AI for testing and debugging while remaining compatible with the Mono build environment used by Unity. Yes, I know it has to be C# 4, but beyond that? At present I'm copying CS files around and that doesn't feel right.

Just to make it crystal clear, the AI has no dependency on Unity and will be built in a project that has VS testing and code analysis but no Unity tools or imports. In future it may be used with a different engine.

sentences:
Food Game using Online Searchs I am thinking of making a simple game with Unity. The aim would be to keep a person healthy by feeding it well balanced food and drinks.

Rather than hard codding every single type of food or drink I can think of I was thinking of letting the player choose any type of food he wants and then screen the internet for it's calorific value, saturated fat, sugars etc ...

This would make the game much more enjoyable than being limited by the foods I can think of.

I was wondering how you would go about doing that ? Could I use an API to extract data from google or wikipedia.

I noticed that when you type "[food] calories" in Google you get a return from the Wikipedia page like this:

Obviously, there is a way of extracting the data from Wikipedia and I could automate the searchs by taking the player's entry as a string and running a search with it.

How would one recommend going about this ? Also, is it safe ?

Thanks

sentences:
Oscillate an object's scale I am able to scale an object using a scaling function I wrote. Internally it builds matrices that are multiplied by each of the vertices to transform them. The parameters I give the scaling function tell it how much to scale the object by as a factor of its current scale.

I want my object's scale to smoothly oscillate between two values, so I have used Sin waves to build my scaling factor, which is:

1 + amplitude * (Mathf.Sin(2 * Mathf.PI * frequency* Time.time) - Mathf.Sin(2 * Mathf.PI * frequency * (Time.time - Time.deltaTime)))

The result looks very close to what I want, but with each oscillation, the object gets slightly smaller than before.

The problem is that my function is written so that it scales the vertices as a factor of its 'current' scale, which is always changing.

sentences:
Unity3d: Get a direction vector parallel to plane I need to send a raycast from my camera which is parallel to the plane (Ground) and in the same direction of its forward vector (Represented by the black color vector)

I cant use world space direction because the global forward vector of the camera points at the same direction no matter how much I rotate it (Since its a VR camera)

I tried to use Vector3.ProjectOnPlane, but not sure how it works.

Can someone help me?

sentences: hey i just wanna ask if its ok to add ww2 weapons, specifically nazi weapons into a game I'm making a ww2 thing and I'm using Nazi weapons and I'm not sure if I have to ask the company to use them or if its ok to just add them without any problem. I really just wanna know if its ok because I've seen many other games add those types of weapons but I have heard of companies making agreements with gun manufacturers.

sentences:
Drawing Farseer Fixtures Is there any way how to draw a Polygon / Fixture from Farseer Physics with XNA?
As I deform these polygons at runtime I can't take any texture from my Content folder, the texture must be generated at runtime too.

sentences:
How does this animation work? This project "Locomotion Skills for Simulated Quadrupeds" creates an animation for the dog model in the program. However if you go into the project's files the dog's skeleton is made of individual obj files for each bone. How were the bones loaded into the program to make the complete animation? It's as if the position of the obj's were attached to... the vector I guess? Can anyone elaborate a little more?

My reasoning for this is because I want to replicate it, create a model (to be animated) out of separate model files. I guess my question is how make one character out of several separate model files? Thanks

sentences:
Most optimal way to load 2D world I am creating a 2D car racing game. (Yes, a Hill Climb Racing clone)

What I am doing right now is load 10% of the map every time the user gets to 7%. For example:

Imagine the map has 10km. (10000m)

When the game starts, the game loads the road from -100m to 1000m.

When the user gets to the 700m (7%) mark, the game deletes 0-500m and loads 1000m to 2000m (10%) (Having loaded from 500m to 2000m).

This will happen every 1000m from now on (1700m, 2700m, 3700m).

I used to create the whole world, and with this new method, I increased my mobile phone fps from 32-34 to stable 60 fps.
BUT, every time the user is in the 700m mark, the game freezes for 0.55-0.60 seconds. (When I load/delete the new road).

Is there a better way (In terms of FPS (Performance)) to load the world?

sentences:
LibGDX Bomberman bomb arraylist iterator error Here is the code of bomb:

private int x, y;
private Texture bTexture;
private boolean bomb_explode;

private Timer timer;
private TimerTask task;
private int timeLeft = 0;

private TileMap map;
public static List<Bomb> bombs = new ArrayList<Bomb>();

public Bomb(TileMap map, int x, int y) {
    this.map = map;
    this.x = x;
    this.y = y;
    bTexture = new Texture("bomb.png");
    bomb_explode = false;
    bombs.add(this);
    createTimer();
}

public void render(SpriteBatch batch, float delta) {
    batch.draw(bTexture, x * Settings.SCALED_TILE_SIZE, y * Settings.SCALED_TILE_SIZE,
        Settings.SCALED_TILE_SIZE, Settings.SCALED_TILE_SIZE);
    if(timeLeft > 1f) {
        bomb_explode = true;
    }
    if(bomb_explode) {
        for(int i = 0; i <= 1; i++) {
            if(x + i <= map.getWidth()) {
                batch.draw(new Texture("flame.png"),
                    ((x + i) * Settings.SCALED_TILE_SIZE), y * Settings.SCALED_TILE_SIZE,
                     Settings.SCALED_TILE_SIZE, Settings.SCALED_TILE_SIZE);
            }
            if(y + i <= map.getHeight()) {
                batch.draw(new Texture("flame.png"), x * Settings.SCALED_TILE_SIZE,
                   ((y + i) * Settings.SCALED_TILE_SIZE), Settings.SCALED_TILE_SIZE,
                   Settings.SCALED_TILE_SIZE);
            }
            if(x - i >= 0) {
                batch.draw(new Texture("flame.png"),
                    ((x - i) * Settings.SCALED_TILE_SIZE), y * Settings.SCALED_TILE_SIZE,
                    Settings.SCALED_TILE_SIZE, Settings.SCALED_TILE_SIZE);
            }
            if(y - i >= 0) {
                batch.draw(new Texture("flame.png"), x * Settings.SCALED_TILE_SIZE,
                ((y - i) * Settings.SCALED_TILE_SIZE), Settings.SCALED_TILE_SIZE,
                Settings.SCALED_TILE_SIZE);
            }
        }
    }

}

public void Boom() {
    bomb_explode = false;
    for(int i = 0; i <= 1; i++) {
        if(map.getTile(x, y).getPlayer() != null) {
            map.getTile(x, y).getPlayer().Die();
        }

        if(x + i <= map.getWidth() && map.getTile(x+i, y).getPlayer() != null) {
            map.getTile(x+i, y).getPlayer().Die();
        }

        if(x - i >= 0 && map.getTile(x-i, y).getPlayer() != null) {
            map.getTile(x-i, y).getPlayer().Die();
        }

        if(y + i <= map.getHeight() && map.getTile(x, y+i).getPlayer() != null) {
            map.getTile(x, y+i).getPlayer().Die();
        }

        if(y - i >= 0 && map.getTile(x, y-i).getPlayer() != null) {
            map.getTile(x, y-i).getPlayer().Die();
        }
    }
    bombs.remove(this);
}

public void createTimer() {
    timeLeft = 0;
    task = new TimerTask() {

        @Override
        public void run() {
            ++timeLeft;
            if(timeLeft > 3) {
                bomb_explode = true;
                Boom();
                clearTimer();
            }
        }
    };

    timer = new Timer();
    timer.schedule(task, 1, 500);
}

public void clearTimer() {
    timer.cancel();
    timer.purge();
    timer = null;
}

In the screen class, I'm rendering the bomb like this :

for(Bomb b : Bomb.bombs) {
    b.render(batch, delta);
}

Here is the error I'm getting:

  Exception in thread "LWJGL Application" java.util.ConcurrentModificationException
  at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
  at java.util.ArrayList$Itr.next(Unknown Source)
  at bomberman.screens.GameScreen.render(GameScreen.java:41)
  at com.badlogic.gdx.Game.render(Game.java:46)
  at bomberman.game.GameObject.render(GameObject.java:23)
  at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:225)
  at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)

How can I fix it?

sentences:
Default movement keybindings for roguelike? I'm developing a text based MUD, but unlike MUDs I'm developing without telnet and making a custom interface.  Think Caves of Qud or Dwarf Fortress.  The game only has 6 directions you can walk.  North, East, South, West, Up, Down.  So cardinal directions plus up and down.  The question is I want to map these directions to the numpad. But often these types of games include intermediate directions northeast, northwest, southeast, southwest so I'm not sure I should really use those keybindings from other games.  I could be wrong.  I don't know of any other games that use only the directions I'm using that also include a custom interface.  My personal feeling is the directions would be bound to the numpad as such, but if there is a kind of de facto standard out there I would prefer that.  I'm planning to add key rebindings, but I'm trying to figure what the default should be.

n = 8
e = 6
w = 4
s = 5
u = 9
d = 7

sentences:
How to access specific child indices (directly, not using tags or searches)? I have a game object whose prefab is structured a very specific way. It is a conveyor belt. I intend to arrange them end-to-end and animate them all at once using a script. Right now I am trying to get the normalized heading vector between two children, TargetStart and TargetEnd (see images below):

You can see that both of these objects are children of the prefab's first child. Because all of these instances will be structured the same, I want to compute the heading for the conveyor belt by accessing the locations of these children by their indices relative to the parent (which sounds like it should be simple and should be more efficient than searching by name or tag). I am anticipating a structure like this (pseudo-code):

// heading = targetEnd's position - targetStart's position
vector3 heading = gameObject.GetChild[0][1].position - gameObject.GetChild[0][0].position;
vector3 direction = heading / heading.magnitude;

How can this be done? I would like to know this so I can access any child I need to for any object by the child's index.

sentences:
How to store an iOS game save file in multiple devices? (Without remote servers) I've been developing an iOS game for iPhone. My game saves the progress as a couple of .plist documents in the device.

I have come to realize that when I install a game in my iPhone, this same game is installed in my iPad. And then it struck me: how would I manage save files? I mean, I'd like the player to be able to continue playing from where they left no matter what device are they using... without using remote servers.

What have you done to address this issue?

sentences:
How to start external AS file playing on frame 2 (instead of frame 1) I am using actionscript 3 and I have used an external actionscript file (.as) for my game.

I would like the external actionscript file to be played at frame 2 (instead of frame 1, as it is an introductory page of the game) on the timeline.

How do I do that? I have been trying and looking for answers for hours, appreciate if you can help on this. Many thanks in advance!

sentences:
Creating a unit selection box in Unity (2D) I've been trying to get my head around how to create a selection box for a selected unit in a 2D top-down type game. When you click on a unit, a small box would appear around that unit based on some sort of box-size.

I do not know/understand how to either calculate the size that box needs to be, draw the box (have an object under the game object that is sized appropriately with the selection box texture?) or how to make the selection box adjust it's size/shape like in this gif: http://i.imgur.com/xY7XW6C.gif

I don't expect anyone here to hand feed me what I need to use, but some idea of how to go about doing this in Unity (starting from the smallest, and most simple thing, like just making the box) would be very much appreciated.

Thanks!

sentences:
How can I make the background of my game move following my player? I'm starting with Libgdx and I would like to make my ParallaxBackground move following my player. I am using a TiledMap along with Scene2d, and have the camera follow the sprite of my player. I'm basing my ParallaxBackground on the example of the following link:

Link here

Best regards

sentences:
2D Camera sizing and movement Apologies if this is a basic question, or been asked a 1,000 times in the past...

I'm new to Unity, and having problems understanding some of the basics to do with 2D cameras (orthographic), and while I've read a lot nothing has made me have that 'ah-ah!' moment yet.

What I'm trying to create is the following (camera position depicted by the box with the pink dashed line) - where the yellow filled boxes are made up of a whole bunch of sprites.

Overtime, the camera need to move left to right, and then bottom to top...

What my issue seems to be is understanding how I can get the camera to display all of the sprites - in other words, resize the camera view to fit the background sprite's height, and know when to stop the camera in order to start moving it up.

What I'd like to understand is how and why to solve this problem - it's the only way I'll learn!

Thanks

Kieron

sentences:
Help setting up money system in game maker I am trying to make a clicker game where one button makes the item and then one button sells the item. My problem is that I don't know how to make the one button stop selling when it reaches 0 items to sell. My code for the selling of the item as of right now looks like this in game maker:

///Sell items
global.money+=global.PC
global.items-=global.PC

It works to subtract per click, but once it reaches 0, it keeps going in to negatives. I am very new to this so forgive my asking probably simple questions.

sentences:
Console-type interface in game I am currently programming a very simple 2d game in C# with XNA.

I was wondering how to implement a console-type interface in a game or graphical software like there is in Skyrim or Counter-strike or some many more games?

These "consoles" can allow you through various command to change many parameters directly in-game.

I find this very interesting for debugging purposes and I was hoping to implement something similar in my program. Is there a particular way to achieve this?

sentences:
Unity 5 Animator will not disable I am making a small FPS in unity 5. I made a cursor animation that I want to play only for a brief moment. I tried to do this using some code:

using System.Collections;

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

public class CrossAnimate : MonoBehaviour {

public GameObject UpCurs;
public GameObject DownCurs;
public GameObject LeftCurs;
public GameObject RightCurs;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButtonDown(0))
    {
        UpCurs.GetComponent<Animator>().enabled = true;
        DownCurs.GetComponent<Animator>().enabled = true;
        LeftCurs.GetComponent<Animator>().enabled = true;
        RightCurs.GetComponent<Animator>().enabled = true;
        WaitingAnim();
    }
}

IEnumerator WaitingAnim()
{
    yield return new WaitForSeconds(0.1f);

    UpCurs.GetComponent<Animator>().enabled = false;
    DownCurs.GetComponent<Animator>().enabled = false;
    LeftCurs.GetComponent<Animator>().enabled = false;
    RightCurs.GetComponent<Animator>().enabled = false;
}

}

All of the four animators on the four gameobjects (UpCurs, DownCurs, etc) are not enabled by default. When clicking the mousebutton they should be enabled so it plays the animation and then after a brief time, they should disable again. The problem is that they don't disable.

Any help would be appreciated!

sentences:
Unity scenemanagement freezes I am very new to Unity, and coding in general.
Anyways, I'm trying to load another scene on click, but when I try to do so in the editor, Unity freezes. Also, it, by chance it seems, worked twice when I newly added the script. Not always when I newly add the script, but twice.

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

public class GameMenu : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

        if (Input.GetMouseButtonDown(0))
        {
            SceneManager.LoadSceneAsync(sceneName: "Wisp1");
        }

    }
}

Can somebody help?

sentences:
Texture mapping artifacts at triangle edge (for thin triangles?) I'm working on generating programmatic textures for 3d models and showing them in WebGL using Threejs. To do this I generate a texture image (PNG) that contains per-triangle textures (a rectangle on the image, that is a rasterization of the 3d triangle), and an associated uv map. To prevent bleeding I generate a 2 pixel border around each triangle's texture rectangle in the resulting PNG. The rest of the texture image is black.
This results in visible artifact lines when rendering:

The texture sampler is set to use NearestFilter for magnification and minification, and the texture's wrapping is ClampToEdge for both S and T, which makes things even more confusing. I've also tried with bigger per-triangle image borders and the problem still persists.

This is the texture I generate:

These lines seem to overlap with thin triangles, which are rasterized to 2 pixels along the shortest axis.

I'm sure there is no physical gap in the model, because it renders fine as a solid, so it must be a texture sampling related thing, which is also confirmed by the fact that the color of the lines is affected by color of the "empty" parts of the texture. If I change those, then the line colors also change. I've also tried offsetting UVs by 0.5 / tex_size and the same thing is rendered.

Any help would be useful.

Thanks!

sentences:
Border around game preview window I'm trying to put my game view and scene view next to each other, but the game window seems to have a border around the actual game view that I can't remove:

In the screenshot above, the game view should be touching the sides. I've tried changing the aspect ratio setting at the top to no avail, increasing the scale works to remove the border but that also zooms in so isn't a correct representation of the game. Does anyone know how I can remove this border?

sentences:
Wierd behaviour upon limiting rotation on Y-axis Okay, this is the code that works for a FPS camera, except it allows the player to flip it over by going under/over -/+90° rotation on Y-axis:

transformation->rotateObjectFromRight(glm::radians(angleX), glm::tvec3<GLfloat>(0.0f, 1.0f, 0.0f));
transformation->rotateObjectFromLeft(glm::radians(angleY), glm::tvec3<GLfloat>(1.0f, 0.0f, 0.0f));

transformation object holds the data required to construct the view matrix, among others, a quaternion representing the rotation.

The functions called will construct the quaternion with the given data and then multiply it with the rotation quaternion either from the left (relative to global axes) or the right (relative to local axes) side.

angleX and angleY are mouse X and Y offsets representing the angles to rotate around.

The first line yaws the camera around local Y-axis, while the second then pitches it around global X-axis, creating the characteristic FPS camera movement.

Okay. So far so good. This is the code that should limit the pitch to never exceed the +/-90 boundaries:

transformation->rotateObjectFromRight(glm::radians(angleX), glm::tvec3<GLfloat>(0.0f, 1.0f, 0.0f));

glm::tvec3<GLfloat> forwardVector = glm::rotate(glm::inverse(transformation->getRotation()), glm::tvec3<GLfloat>(0.0f, 0.0f, 1.0f));
GLfloat pitchAngle = forwardVector.y * 90.0f;
angleY = glm::clamp(angleY, -(pitchAngle + 90.0f), -(pitchAngle - 90.0f));

transformation->rotateObjectFromLeft(glm::radians(angleY), glm::tvec3<GLfloat>(1.0f, 0.0f, 0.0f));

First and the last line are the same. What happens here?

First I get the unit vector that lies on the Z-axis and rotate it so that it represents the forward vector of the camera. I then take the Y component of that vector (ranging from -1 to 1) and multiply it with 90 to get the degrees. Then I clamp the angleY so that current rotation combined with the new one never exceeds the +/-90° boundary.

If the rotation was about to flip the camera overhead, it would change the new rotation angle so the camera looks straight up. Similar thing for underfoot flipping.

However, the camera acts weird. It's fastest at pitch angles close to 0°, but gets progressively slower as the pitch nears +/-90°. If I move my mouse slower, the camera is faster, if I move it faster, it's slower.

It's as though it's discarding the too large/small angleY values instead of clamping them to the appropriate values (but it's not, and I can confirm via the debugger - all the calculated values look alright and are correct).

What could be amiss here to cause such weird movement?

sentences:
Am I going to regret using a color based collision detection system? I'm just getting started build my first game with XNA (I'm experienced with C# but not games).

I'm building a pretty simple top down 2d shooter. I read this tutorial on using a color based collision system and it sounded really cool to me. http://www.xnadevelopment.com/tutorials/theroadnottaken/theroadnottaken.shtml

It means I can quickly make levels just using any graphics program and not have to define my scenery (walls, trees etc) in terms of collision boxes etc right?

However I can see that going down this path means that perhaps the calculation for determining whether fast moving objects like bullets intersect walls etc becomes more difficult potentially because you cant' do basic geometry intersection type calcs.

Is that right? Am I going to regret going in this direction if my game gets more complex over time? Worth just investing in the creation of a level editor to define my scenery in terms of geometry?

Any advice for a noob very much appreciated!

sentences:
Vector3 vs. Vector2 - performance, usage? I'm currently playing around with XNA, and creating a simple 2D platformer. I was thinking of adding multiple layers to make it a little bit of challenge.

In stead of having a Vector2 for my positions, I now use a Vector3, solely to use it's Z as layer depth. However, since you can't use operators between Vector2 and Vector3 for some unknown reason [1], I ended up changing all other Vector2s in my game, such as acceleration, speed and offset, so I can do things like position +=  offset without errors.

I also changed my rotation variable from float to Vector3, and I use the Z value to rotate my textures. I'm planning to use the X and Y to scale-flip my textures, so you get the Super Paper Mario effect.

However, after changing all these Vector2s in Vector3s, I felt a little bad about it. How does this effect the performance of games? I know I shouldn't have to worry about performance in my little platformer game, but I'm just curious about it.

Is there any notable performance between Vector2s and Vector3s, for example when adding or multiplying them, or when calling Normalize, Transform, or Distance?

[1] Just a side question, why are there no operators for calculations between Vector3 and Vector2?

sentences:
OpenGL ES on iOS Books I was wondering if someone has read both the:

iPhone 3D Programming

And

OpenGL ES 2.0

books and have an opinion if one is better than the other?

I'm basically wanting to get into doing 3D graphics on iOS including shaders.

sentences:
Create entity from template in component-based engine For my project I would like to use a component-based entities in C++. My current implementation is split to these parts:

Systems - Contain a map of components of certain class and operate on these. For example PhysicsSystem has a vector of PhysicsComponents.
Components - A component contains some public variables and a maybe a constructor to initialize them.
Entities - An entity for me is just an Id. It is however not stored anywhere, instead only its components are stored in systems in map (where key is entityId and value is pointer to the component).

My problem is creating instances of different objects in my game. I would like to define objects in XML (could be any text file format). For performance reasons this file should be parsed only once when the program is run.

That means I should create some template from it in my ObjectFactory and associate it with a name. Then I would simply call factory.CreateObject("Player") to add new entity to the game.

I am not really sure how to implement this without too much overhead code. Another concern is, that the I don't want my factory to know about the systems themselves. But because my components are stored in the systems and not an Entity object, I will need to use some messaging system to pass new components to their appropriate system.

My question is, how would I implement the object spawning with template for each object type? And how do some engines describe their objects with configuration files?

sentences:
Collision between free player and tilebased map so I'm working on some sort of platformer in javascript where the map is tilebased but the player can move freely.

Now, i have a problem with collision detection/response. It's kind of obvious what I'm trying to do, I don't want the player to walk into walls and fall into the ground so i need collision stuff.

Basic info:

The player is the same size as the tiles
The tiles are 8x8
The map is stored in an array like this: [0, 0, 0, 1, 1, 1, 0, 0, 0]. So if the map was 3x3 there would be a horizontal line in the center.

I feel that the system that I'm using is very inefficient and there are some problems with it:

sides = {};

// The tiles are 8x8 wide so i divide the players position by 8 to get the current tile the players is occupying.
// The player.y * mapWidth + player.x thing gets the tile at that position in the map array
// I use Math.floor instead of round to get the tile to the left of the player
if (map[(Math.round(player.y / 8) * mapWidth) + Math.floor(player.x / 8)] == 1) {
    sides.left = true;
} else {
    sides.left = false;
}

if (sides.left) {
    // Set the players x position to exactly outside the wall.
    player.x = Math.floor((player.x / 8) - 1) * 8;
}

Now this works fine for walls but when you use it on the ground it works but it glitches on corners.

For example if the player half way over an edge it falls through the tile and is pushed to the side.

Is there a better way to do this and if not, how do i fix the ground collision?

sentences:
How to confirm an actor location in a realtime multiplayer game at the exact same time on two devices? I am trying to figure out how to make a game like Pong in multiplayer. I have two devices that run the same simulation. Now I want to make sure that each of them start at the exact same time and send packets from the host to the client that confirm the position of the ball.

I am not sure if this would be the right approach, but how do I make sure that both devices are running the same game?

sentences:
Getting BEPUphysics to draw its entities Isn't there a way, to force BEPUphsyics to show what it is doing?
I am here with my existing XNA project, starting to put in BEPUphysics,
but I am not seeing what it is doing.

Take my model for instance. I think I made a StaticMesh here:

public BEPUphysics.Collidables.StaticMesh PhysicsMesh;
public Space space;
private Hero _hero;

public override void LoadContent()
{
   //...

   space = new Space();
   Vector3[] vertices;
   int[] indices;
   TriangleMesh.GetVerticesAndIndicesFromModel(_model.getCoreModel(), out vertices, out indices);
   PhysicsMesh = new BEPUphysics.Collidables.StaticMesh(vertices, indices, new AffineTransform(new Vector3(0, -40, 0)));

   space.Add(_hero.PhysicsMesh);
   space.ForceUpdater.Gravity = new Vector3(0, -9.81f, 0);
}

That's the only thing I made BEPU-Wise in my game. All other models don't have
physics attached to them.

But, like I said. I see nothing when the game is running. Only my model, not falling, not doing anything.

I would like to see the full thing BEPU is doing in runtime.

sentences: Tron type game AI algorithm Im looking for a tron AI algorithm on snap!/scratch. If not can you help me develop an AI for this game?

sentences:
How can I merge multiple sprite into one sprite or texture using Unity3d? I have an avatar generator where someone can create a custom avatar with layers superimposed.
And in order to reuse this image multiple times, i want to merge all layers in one image.
Is there any way on unity3D to create this image.

I've already coded that :

atlas = new Texture2D (width, height, TextureFormat.RGBA32, false);
foreach (Sprite s in allSprite) {
        atlas.SetPixels (0, 0, atlas.width, atlas.height, s.texture.GetPixels (0, 0, atlas.width, atlas.height));
        atlas.Apply ();
}

My problem is to keep the transparency and not erase old layers where pixels are transparent.
The setPixels method replace old pixels in atlas by new one.
I can't loop over pixels because of the size of the image (1024*1024) and more than 6 layers.

sentences: Is C++ being replaced by C# in industry games? In industry games I mean like Quake, CoD etc.

sentences:
Shader / Reconstructing position from DEPTH in VR through Projection Matrix In Unity you can access the Depth-Buffer in the Pixel Shader.
With that Depth-Buffer and the Nearplane, Farplane, CamToWorldMatrix and FOV you can calculate every pixel position of the objects the camera is seeing.

in VR though I get the wrong positions - because a VR frustum is slightly skewed. (http://doc-ok.org/?p=77)

So now we dont use the variables above to determine the Position -
Now should be using the Projection Matrix.

Unitys "OnRenderImage()" is rendering alternately left and right eye of the VR device. So we "take" the projection matrix from each different eye.
Also the FOV , Near and Far Planes, should be correct.
We have also the screen Resolution. - which is exactly "540x600"

The Big Question here:

How to get that pixel Position with the help of those values.?

This is working for non-VR for those who need this in a computeshader:

Script:

        computeShader.SetTexture(_Kernel, "_DepthTexture", depthRenderTexture);
        computeShader.SetFloat("_CamFOV", camFOV);
        computeShader.SetFloat("_CamAspect", camAspect);
        computeShader.SetFloat("_CamNear", camNear);
        computeShader.SetFloat("_CamFar", camFar);
        computeShader.SetFloat("_ScreenWidth", Camera.main.pixelWidth);
        computeShader.SetFloat("_ScreenHeight", Camera.main.pixelHeight);
        computeShader.SetVector("_CamWorldMatrix0", camWorldMatrix.GetRow(0));
        computeShader.SetVector("_CamWorldMatrix1", camWorldMatrix.GetRow(1));
        computeShader.SetVector("_CamWorldMatrix2", camWorldMatrix.GetRow(2));
        computeShader.SetVector("_CamWorldMatrix3", camWorldMatrix.GetRow(3));
        computeShader.Dispatch(_Kernel, (int)(Camera.main.pixelWidth*Camera.main.pixelHeight)/128, 1, 1);

ComputeShader:

    [numthreads(128, 1, 1)]
    void CSMain(uint3 id : SV_DispatchThreadID)
    {
        if (id.x >= (uint)(_ScreenWidth*_ScreenHeight))
        return;

        int y = id.x / int(_ScreenWidth);
        int x = id.x % int(_ScreenWidth);
        float4 depthInfo = _DepthTexture[uint2(x, y)];

        float depthValue = depthInfo.z * _CamFar;
        // world X and Y components of our target vector
        float tanFov = tan(radians(_CamFOV / 2));
        float screenDimY = tanFov * _CamNear;
        float screenDimX = screenDimY * _CamAspect;
        // normalize screenpos from range 0..1 to range -1..1
        float4 normPos = depthInfo * 2 - 1;
        float screenPosX = screenDimX * normPos.x;
        float screenPosY = screenDimY * normPos.y;
        float screenPosZ = -_CamNear;
        float4 objInEyeSpaceVector;
        objInEyeSpaceVector.xyz = float3(screenPosX, screenPosY, screenPosZ) * depthValue / _CamNear;
        objInEyeSpaceVector.w = 1;
        float4x4 camWorldMat = float4x4(_CamWorldMatrix0, _CamWorldMatrix1, _CamWorldMatrix2, _CamWorldMatrix3);
        float4 objInWorldSpace =  mul(camWorldMat, objInEyeSpaceVector);

}

^
but this has to work now in VR too.

There are already the answers for a unity-shader.
But i Need that as a computeshader

I dont have a v2f vert (appdata v) and a fixed4 frag (v2f i) : SV_Target in the compute shader. In the end of the day, i would like ... Input: Matrixes, floats, everything i Need incl. depth. I have already the current X and Y coordinate of the Screen-Pixel which gets rendered. So... the last line of Code should be: float4 pixelPositionWorld;
Just like in the first example i had.

sentences: GLSL associating multiple uniform samplerBuffers At the moment I'm not sure how my VBO and TBO associate with a specific uniform samplerBuffer in my shader, I have not linked them using the location or the vbo/tbo together. It seems to still work though, but now that I am using multiple samplerBuffers, how do I establish to link between a specific TBO and the uniform. Do I need to use glUniformX?

sentences:
Direct3D & Assimp Texture is inverted weirdly! I'm working on a rendering engine but even on the first mesh is something wrong.
I use assimp for mesh importing!
In the Assimp Viewer it looks correct:

And in my software it looks like this:

Look at the text and you will see it is weirdly mirrored.
I'm using front counter clockwise vertex winding and the texture is flipped on y coordinate - if I don't then it is completely wrong. I already tried disabling front counter clockwise winding but the texture is still inverted!

Does anybody know what else I can try?

sentences:
Design patterns for effects between actors and technology I'm working on my first game, and taking the opportunity to brush up my C++ (I want to make as much of it as portable as I can.)

Whilst working on the technology tree and how it affects actors (spaceships, planets, crew, buildings, etc) I can't find a pattern that decouples these entities enough to feel like a clean approach.

Just as an idea, here's the type of effects these actors can have on one another (and techs too)

An engineer inside a spaceship boosts its shield
A hero in a spaceship in a fleet increases morale
A technology improves spaceships' travel distance
A building in a planet improves its production

The best I can come up with is the Observer pattern, and basically manage it more or less manually (when a crew member enters a spaceship, fire the event; when a new building is built in a planet, fire the event, etc etc.) but it seems to be too tightly coupled to me.

I would love to get some ideas about how to approach this better.

sentences: What is a good tool for producing animated sprites? Has anyone come across a software package that allows you to build animations in a similar way to how you can in Flash (i.e. using techniques such as tweens & bones & easings, etc) and then have the result exported as a sprite sheet?

sentences:
Not sure how to deal with overlapping UI As shown above, that is the issue I am faced with, tbh I am unsure how to fix it, I have tried and its coming to a point where I am drawing blank. I am quite newbie when it comes to this.

So what I have now is multiple canvas each one displaying the name of the part that it is linked to and when the part moves so does the UI with it, the problem I have is that some parts dont move and therefore creating the issue of UI clustering together, so I need to move the UI rather than the parts.

What I have tried is OnTriggerEnter and adding a box collider/rigidbody to the canvas and tried to move the UI when they collided but I couldnt get that to work, probably down to me.

if (gameObject.tag == "car")
    {

        //get the gameObjects name that canvas is attached to
        canvasName.text = gameObject.name;

        newPos = mainCam.ScreenToWorldPoint(this.transform.position);

        //set the position of the UI
        newPos.x = transform.position.x;
        newPos.y = transform.position.y + 7f;
        newPos.z = transform.position.z;

        //canvas position
        if (_canvas != null)
        {
            _canvas.transform.position = newPos;

        }

That is the code that I am using to attach the UI to the part. I was hoping to try something along the lines, but then again I am clueless.

if collision is detected, newPos.y = newPos + 2f; etc...

So any help would be appreciated. Apologies if that was explained bad.

sentences:
Why do we need a fourth coordinate to divide by z? I read the response here:

What does the graphics card do with the fourth element of a vector as the final position?

  "The fourth component is a trick to keep track of perspective
  projection. When you do a perspective projection, you want to divide
  by z: x' = x/z, y' = y/z, but this isn't an operation that can be
  implemented by a 3x3 matrix operating on a vector of x, y, z. The
  trick that has become standard for doing this is to append a fourth
  coordinate, w, and declare that x, y, z will always be divided by w
  after all transformations are applied and before rasterization. "

but I didn't understand why couldn't we divide by z using a 3x3 matrix?

can't we just multiply by

1/z 0 0
0 1/z 0
0 0 1/z

to get [x/z y/z 1]

?

sentences:
Cocos-2D asteroids style movement (iOS) So I have a CCSprite subclass, well call this Spaceship. Spaceship needs to move on a loop, until I say othersise by calling a method. The method should look something like

- (void)moveForeverAtVelocity
{
  // method logic
}

The class Spaceship has two relevant iVars, resetPosition and targetPosition, the target is where we are headed, the reset is where we set to when we've hit our target. If they are both off-screen this creates a permanent looping effect.

So for the logic, I have tried several things, such as

CCMoveTo *move = [CCMoveTo actionWithDuration:2 position:ccp(100, 100)];
CCCallBlockN *repeat = [CCCallBlockN
  actionWithBlock: ^(CCNode *node) {
    [self moveForeverAtVelocity];
}];

[self runAction:[CCSequence actions: move, repeat, nil]];
self.position = self.resetPosition;

recursively calling the moveForeverAtVelocity method.

This is psuedo-code, so its not perfect. I have hard-coded some of the values for the sake of simplicity.

Enough garble: The problem I am having, how can I make a method that loops forever, but can be called and reset at will. I'm running into issues with creating multiple instances of this method. If you can offer any assistance with creating this effect, that would be appreciated.

sentences:
Apply transform.Translate to a specified object in the script In Unity3D, if I place a C # script including transform.Translate on an object "A" in the hierarchy, it animates the translation of this object A.

How in C# can I apply that transform.Translate effect onto another object defined in the script itself?

I want to write a script similar to this:

using UnityEngine;
using System.Collections;

public class Create_Objects : MonoBehaviour {

    public float moveSpeed = 2f;
    public Transform otherObject;

    void Update ()
    {
        if (Input.GetKeyDown (KeyCode.Q))
        {
            GameObject Object1 = new GameObject ("Object1");
        }
        otherObject.Translate (Time.deltaTime * moveSpeed, 0, Time.deltaTime * moveSpeed);
    }
}

But somehow I want that otherObject that I'm translating to refer to the Object1 I created when the user pressed "Q".

Thanks DMGregory for your last code!... and finally, same as before but the objects are created and translated from position of each previous object creates.

What is the new C # code?

sentences:
Initializing Consumable product to an amount on first use I am using Unity's In App Purchase plugin to implement an in game store. In my game every player has fuel. I'd like to use the plugin in order to keep track of the amount of fuel the player has so that just erasing the cache on the phone or something wouldn't effect the regeneration time of fuel (like it would if I use PlayerPrefs).

Right now i have it setup so the fuel amount is saved in PlayerPrefs and when fuel is used, a timestamp is saved in PlayerPrefs. Then it checks every once in a while if enough time has passed since they used it in order to regenerate it.

Instead of doingoing it this way I want to initialize the fuel amount in Unity's in app purchase plugin so that Googles servers will have the amount and then I can use the same idea for regeneration that I already have but nowe the amount will be more safe.

Is there a way to initialize the amount of a consumable product a player has on their first launch of a game?

sentences:
unity Tilt Android Device player Freeze When Die I attached tilt script to my Player to move player x and y Axis. Player have Rigidbody2D and also IsKinematic=true. but the problem when the player can Die i want to stop tilting and player goes down to ground.
here is my tilt Code

public float Speed=20f;
 void Update () {
  if (PlayerControll.instance.isAlive) {
   transform.Translate (Input.acceleration.x * Speed * Time.deltaTime, Input.acceleration.y * Speed * Time.deltaTime, 0);
  } else {
   PlayerControll.instance.PlayerRigidbody.isKinematic = false;
  }

I try to do that using disable tilt script when Player die and Iskinematic=false but the problem is player can freeze to his position not goes down to the ground. I do that so many way but not done so what i do don't know then i post the Question. thanks in advance.

sentences:
Why does the drag fail when I move too fast? I got this code that drags a 2d sphere when i touch the screen:

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

public class Dragstick : MonoBehaviour {

    private Vector3 offset;

    void Update()
    {
        if (Input.touchCount > 0)
        {
            Vector3 touchPosWorld = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
            Vector2 touchPosWorld2D = new Vector2(touchPosWorld.x, touchPosWorld.y);

            RaycastHit2D hitInformation = Physics2D.Raycast(touchPosWorld2D, Camera.main.transform.forward);
            if (hitInformation.collider != null)
            {
                GameObject touchedObject = hitInformation.transform.gameObject;
                switch (touchedObject.tag)
                {
                    case "Player":
                        Debug.Log("Touched Sphere " + touchedObject.transform.name);
                        touchPosWorld.z = 0f;
                        transform.position = touchPosWorld;
                        break;
                }
            }
        }
    }
}

Thing is, if I move my finger too fast, the drag stops and the sphere drops... also it runs kind of slow when i execute it...

Any help about what am I doing wrong? Maybe I'm making things too complex, drag and drop of a sphere should be really easy but functions in unity have changed a lot.

Thanks in advance!

sentences:
What elements make a game machinima-friendly? What types of things should a game have in order to make it machinima-friendly? I imagine that a spectator mode helps, but are there other important elements? Perhaps support for mods?

Are there any example of games that are known for being especially easy to make movies with?

sentences:
Shaky Camera Effect 2D The camera in my game engine can be modified by following a rectangle properties, that can be scaled, moved and even rotated. I need this effect for the shaking of the screen when a zombie attacks a character.

How should I go about implementing this?

sentences:
In DirectX 11, batching primitives for performance, how does this actually work? I don't seem to be able to understand this. Microsoft says that one of the possible optimizations of for a Direct3D 11 if to batch primitives draw calls. For example in order to draw say 300 triangles calling the Draw method each time, you would instead pack and Draw them all at once.

The thing I don't get is how you would actually draw them in different locations and everything, because for example, I need one different world transformation matrix for each one. The only thing that comes to my mind is to calculate everything on the CPU and set the values for each vertex manually, however this approach doesn't seem like it would be a very good code optimization to me.

I feel like I'm missing something but I can't find the answer anywhere. The question is: how would you be able to pack things in a draw call without needing a render state change, and still get objects in different locations?

Note that I am not asking for pieces of code here, I'm primarily looking for a theorical answer to this.

sentences:
Clear reference implementations of MLAA? 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

sentences:
Import updated scripts into unity (Holotoolkit) So I've got the following problem : Developing for the Hololens means that you in most cases need this code in your project : https://github.com/Microsoft/HoloToolkit-Unity
But this code is also updating from time to time. I tried to just replace the old code with the new one which breaks all prefabs in my scenes. So is there a possibility to replace the old HoloToolkitwith the new one without breaking my scenes?

sentences:
SDL2 LogInfo not outputting with different category? So this is probably really simple but I just cannot see it.

I've made my own log class using the SDL_Log functions to output to the console. Only thing is, is that it only outputs using one category type only.

For example. I use this:

Log::getInstance()->info(Log::getInstance()->CAT_APPLICATION, "This outputs fine.");
Log::getInstance()->info(Log::getInstance()->CAT_INPUT, "This doesn't get outputted");

which, in the log class, that uses the following code:

void Log::info(int category, const char* message, ...) { SDL_LogInfo(category, message); }

and:

int CAT_APPLICATION = SDL_LOG_CATEGORY_APPLICATION;
int CAT_INPUT = SDL_LOG_CATEGORY_INPUT;

I've also tried the normal method:

SDL_LogInfo(SDL_LOG_CATEGORY_INPUT, "but this doesn't get outputted either if the app cat is outputted first");

Any ideas on why it's not outputting "CAT_INPUT" but is outputting "CAT_APPLICATION"? And how I could get it outputting all of them?

sentences:
Recorded Voice or Synthesized Speech? I'm interested in adding to my game either recorded human or synthesized speech. I'm interested in what game devs have to say regarding the value of recorded human voice over voice synthesis. Thanks in advance!

Points to consider:

EDIT: First and foremost, the game is meant for kids (i.e. when you see an image of an apple, a voice says "a is for apple") - here it is on Appbrain (currently sans audio...)
I searched the responses for Is it worthwhile recording your own or buying stock sound effects? - I'm basically wondering the same thing but for voice-specific audio.
Do you find value or any benefit in opting for recorded human voice?
What are some good voice synthesis or text-to-speech tools (preferably free)? I'm currently trying out Fruity Loops, which seems to get the job done (I input a phrase and it generates synthesized speech) however some words do not sound as realistic/convincing as others.
The platform is Android (i.e. memory constraints).

sentences:
Orthographic Projection Issue I have a problem with my Ortho Matrix. The engine uses the perspective projection fine but for some reason the Ortho matrix is messed up. (See screenshots below).

Can anyone understand what is happening here?

At the min I am taking the Projection matrix * Transform (Translate, rotate, scale) and passing to the Vertex shader to multiply the Vertices by it.

VIDEO Shows the same scene, rotating on the Y axis.
http://youtu.be/2feiZAIM9Y0

 void Matrix4f::InitOrthoProjTransform(float left, float right, float top, float bottom, float zNear, float zFar)
{
    m[0][0] = 2 / (right - left);
    m[0][1] = 0;
    m[0][2] = 0;
    m[0][3] = 0;

    m[1][0] = 0;
    m[1][1] = 2 / (top - bottom);
    m[1][2] = 0;
    m[1][3] = 0;

    m[2][0] = 0;
    m[2][1] = 0;
    m[2][2] = -1 / (zFar - zNear);
    m[2][3] = 0;

    m[3][0] = -(right + left) / (right - left);
    m[3][1] = -(top + bottom) / (top - bottom);
    m[3][2] = -zNear / (zFar - zNear);
    m[3][3] = 1;
}

This is what happens with Ortho Matrix:

This is the Perspective Matrix:

sentences:
Relational Databases vs XML vs public static finals: Pros and Cons I'm working on a game (single player, metroidvania type, Java) and I'm torn as to how data should be stored. For example, monster stats, dialogues, flavor text for weapons, gear stats... there is all kinds of fixed data that needs to be loaded.

I've tried 3 ways of handling this:

Apache derby database
XML (or JSON or CSV) files
Java classes with a long list of "public static final" Strings/floats

Hands down I love #1 the most, but I wonder if it will affect performance. I hate #2 because it requires a lot more work to organize everything, plus I have to do encryption and remove said encryption when debugging. #3 works fine but feels... unprofessional or sloppy.

I want to hear from someone with experience, since I'm new at this, what are the pros/cons of each, and is there a "best way", for simple single player games?

sentences:
How do I use a PC Dance Pad with Xna? I have a Dance Pad and I want use it in XNA as a controller. It has a USB connection.

Can someone help me?

sentences:
Updating connected states in a "build the pipeline" puzzle game I'm trying to make the pulse system in a "build the pipeline" puzzle game to check if tiles are connected to the starting tile.

There is a weird bug that prevents tiles on the right and tiles on the top of any powered up tile (including starting one) to change state, but it works fine with tiles on the left and bottom.

I tried to log this and it happened that the cycle is going trough these tiles, but their state doesn't change. Here is an example:

Here is the code. If I remove this bit:

 else
              p.GetComponent<piece>().ConnectedToStart = false;

then it is changing the state as it should, but I have no idea how to disable tiles that should be unpowered in any other way. Also, the question is still there - why does it only work for the tiles on the left and bottom?

    public class Puzzle
    {

        public int winValue;
        public int curValue;

        public int width;
        public int height;
        public piece[,] pieces;

    }

        public Puzzle puzzle;

        GameObject[] pieces;
    void Start()
    {
        pieces = GameObject.FindGameObjectsWithTag("Piece");
    }

    void Update()
    {
        CheckForStartConnections();
    }

    public void CheckForStartConnections()
    {

        foreach (var p in pieces)
        {
            if (p.GetComponent<piece>().StartPiece)
                Pulse((int)p.transform.position.x, (int)p.transform.position.y);
            else
              p.GetComponent<piece>().ConnectedToStart = false;
        }
    }

    void Pulse(int w, int h)
    {
        puzzle.pieces[w, h].GetComponent<piece>().ConnectedToStart = true;
        //compares left
        if (w != 0)
            if (puzzle.pieces[w, h].values[3] == 1 && puzzle.pieces[w - 1, h].values[1] == 1)
            {
                if (!puzzle.pieces[w - 1, h].GetComponent<piece>().ConnectedToStart)
                    Pulse((int)puzzle.pieces[w - 1, h].transform.position.x, (int)puzzle.pieces[w - 1, h].transform.position.y);
            }
        //compares bottom
        if (h != 0)
            if (puzzle.pieces[w, h].values[2] == 1 && puzzle.pieces[w, h - 1].values[0] == 1)
            {
                if (!puzzle.pieces[w, h - 1].GetComponent<piece>().ConnectedToStart)
                    Pulse((int)puzzle.pieces[w, h - 1].transform.position.x, (int)puzzle.pieces[w, h - 1].transform.position.y);
            }
        //compares top
        if (h != puzzle.height - 1)
            if ((puzzle.pieces[w, h].values[0] == 1 && puzzle.pieces[w, h + 1].values[2] == 1))
            {
                if (!puzzle.pieces[w, h + 1].GetComponent<piece>().ConnectedToStart)
                {
                    Pulse((int)puzzle.pieces[w, h + 1].transform.position.x, (int)puzzle.pieces[w, h + 1].transform.position.y);
                }
            }
        //compares right
        if (w != puzzle.width - 1)
            if (puzzle.pieces[w, h].values[1] == 1 && puzzle.pieces[w + 1, h].values[3] == 1)
            {
                if (!puzzle.pieces[w + 1, h].GetComponent<piece>().ConnectedToStart)
                {
                    Pulse((int)puzzle.pieces[w + 1, h].transform.position.x, (int)puzzle.pieces[w + 1, h].transform.position.y);
                }
            }
}
```

sentences:
What would make a good cursor movement sound effect? I know specific questions like this are very borderline on acceptable - but I am having massive trouble finding a non-annoying sound effect for moving the cursor in my game.

The game is a Fire Emblem like SRPG and think it would be cool if I could have a little sound each time the cursor ticks in a menu/selection of character/etc. - it should be a non-intrusive sound (keeping in mind I can adjust volume).

What have you guys used for something like this? Going to various free soundclip sites putting in "cursor move" isn't doing much for me.

sentences:
Can I replace the source image of slices by script? I have a Unity2D prefab that uses several slices from a single PNG. (in it sprite renderer, and in its animation clips). If I replace that PNG in the Finder, all slices taken from that PNG are automatically updated, which is great.

But I want to do this by script: just replace the PNG where all slices are taken from, with another PNG. This is so that each of my prefabs instances can all use a different spritesheet PNG source for its slices.

Is this possible in Unity?

sentences:
Multiple colored textures vs Color Overlay Let's say we're using DirectX 9/10/11. In our game we have a character wearing armor.

The armor has 50 different color variations.
So, if armor is red, the first method would load the red texture from file.
The second method would display the 1 base texture, with a red overlay.

Code wise the overlay armor would just contain an extra flag that would specify color.

Is it faster / more efficient to load different textures in? Or, is it faster / more efficient to color the texture on the fly?

I'm not aware if there is some huge overhead for dropping a tint over a texture...

sentences:
Camera math: How to calculate the horizontal and vertical angle from the look at vector I'm using the PerspectiveCamera class in C#/WPF to implement an FPS style camera.

For that, I would need to offset the camera's horizontal and vertical angles every time the mouse is moved. The problem is that PerspectiveCamera doesn't store those angles and only provides a lookat vector.

So, is there a way to calculate those angles from the lookat vector ?

sentences:
How do you map a 3D scene to a stero image pair? I'm a novice.  I'm working in XNA studio with simple models.

How can I turn a 3D image into two images meant for the left and right eyes respectively?

Note: I'm not referring to "magic eye" - I'm wondering how you calculate the left and right images starting from the 3D scene info.

sentences: How do I make sure my tic-tac-toe AI always plays to a draw? I'm working on a little project. The aim is to play Tic-Tac-Toe against an AI, but I require that the game always results in a draw against the AI opponent. How can I implement the AI to ensure that?

sentences:
How do I determine my games minimum hardware/software requirements? With me going it alone in development I only have limited resources at my disposal i.e one pc with which I develop and test the game. so I only know for certain my game works with that setup.

What options have I got in testing the game on the many different hardware/operating system combinations? Its a windows desktop game.

sentences:
Appropriate database schema for heroes' skills in a Tower Defense game? In a Tower Defense game, each hero (or character) has some skills. Each skill has some "chance of appearance" (CoA for short) when attacking enemies and if appeared it has some "hit accuracy" (i.e. hit on enemies) (HA for short) and has effects on the enemies (if hit by the skill) (EoH for short).
Examples:
Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down for 4s and (2) yield 200 damage points.
Skill #2: Frost 2, CoA: 100%, HA: 50%, EoH: (1) make enemy frozen for 8s.
I first tried to breakdown skills into "atomic" effects and come up with tables as below:

All looks good?
But now we want to update Skill #1 a bit to make it more complicated:
Skill #1: Frost 1, CoA: 50%, HA: 100%, EoH: (1) slow enemy down by 40% for 4s and (2) yield 200 damage points. (Please pay attention to the 40% here!)
Or even coming up with more complicated skills:
Skill #3: Frost 3, CoA: 20%, HA: 100%, EoH: (1) frozen enemy for the first 4s then slow enemy down by 50% for next 4s and (2) yield 200 more damage points.
Skill #4: Frost 4, CoA: 10%, attack enemy 3 times continuously, each time: HA: 50%, EoH: (1) frozen enemy for the first 2s then slow enemy down by 50% for next 2s and (2) yield 400 more damage points.
Each effect now has more parameters to be specified -- which makes my current schema not fit anymore. Please help deal with this!

sentences:
Profiling code with threads and script interpreter Basically, how I profile a game that have multithreading and script interpreter? (Lua in my case)

I have no idea of where to look for that.

Also it would be nice to be able to profile code that resemble somehow the release code, my "debug" binary is about 12 times bigger...

EDIT: My game was made with C++, compiled with GCC, runs on Windows and GNU/Linux for now, compiled natively (ie: MingW on Windows, regular GCC on GNU).

sentences:
How to Make Organic Fade to Black in Unity I'm working a retro/old-style video game, and I was wondering whether or not there is a way to create an organic fade-to-black, similar to what is found in the original NES console. I am aware of how to create a traditional fade-to-black screen, but it doesn't really fit the theme of my game. I'm using Unity 2019.4 LTS.
Here’s a example of a character about to exit the area and cause a fade to black:

Here’s what the organic fade looks like at 75% completion:

And here’s what a traditional fade looks like at 75% completion:

sentences:
How to tie a bullet release with a firing animation Lets say you have an animation that you want to happen when firing a bullet.  How would you get the bullet to show up at the end of the animation.  The only thing I can figure out is to know the time length of the animation, and delay setting the bullets position and setting it active until that amount of time has passed.  I was just wondering if this is the best approach, how does everyone else handle this?

EDIT:  I think i'm having trouble wording the question properly.

sentences:
Java vs Javascript for Web-based games With all the recent interest in developing HTML5 apps and games, and I am curious why all the focus is on Javascript, and not on Java.

Minecraft is a great example of what can be accomplished in a browser, and it's written in Java, not JS. I doubt if it is even possible/practical to attempt such a complex project in JS.

Java is clearly a more powerful platform, and it probably runs significantly faster (this is just my guess, though). About the only drawback of Java I can think of is that it runs as a plugin, and with the trend towards plugin-free browsers (e.g. IE10 metro) Java applets may become obsolete in mobile environments. This has already happened with Flash on iOS.

What do you think? Is there a future in developing Java-based Web apps (especially for mobile devices)?

Thanks

sentences:
Synchronize objects' movements moved by coroutine function I'm using Unity version 5.3.5.

I'm having problems to synchronize the movement of three different objects from point A to point B and vice versa. To move the objects I use the following code:

public float time;
public Vector3 endPos;
private Vector3 startPos;

 void Start()
 {
     startPos = transform.position;
 }

 void FixedUpdate()
 {
     if(transform.position == startPos)
     {
         StartCoroutine(Move(gameObject.transform, startPos, endPos, time));
     }
     if(transform.position == endPos)
     {
         StartCoroutine(Move(gameObject.transform, endPos, startPos, time));
     }
  }

 public IEnumerator Move(Transform thisTransform, Vector3 startPosition, Vector3 endPosition, float time)
 {
     float i = 0f;
     float rate = 1/(time);
     while(i < 1)
     {
         i += Time.deltaTime * rate;
         thisTransform.position = Vector3.Lerp(startPosition, endPosition, i);
         yield return null;
     }
 }

As long as all of the objects have the same "time" value, their movements is correctly synchronized regardless the distance that they have to cover. The problems arises when they all have different "time" value. For example, if they have to move backwards and forwards from startPos(0,0,0) and endPos(5,0,0) with the following "time" value:

Object A time = 1 second
Object B time = 2 second
Object C time = 4 second

After 4 second, they should all be again at the same start position. However, what happen is that the fastest object (Object A) has a delay over the other two and this delay increase over time.

How can i fix this problem?

sentences:
Blur offset artifacts I have simple blur shader which I calculate offsets in:

Piece of vertex shader:

output.texCoord1 = input.tex + float2( texelSize * -4.0f, 0.0f );
output.texCoord12 = input.tex + float2( texelSize * -3.0f, 0.0f );
output.texCoord13 = input.tex + float2( texelSize * -2.0f, 0.0f );
output.texCoord14 = input.tex + float2( -texelSize, 0.0f );
output.texCoord15 = input.tex + float2( 0.0f, 0.0f );
output.texCoord16 = input.tex + float2( texelSize, 0.0f );
output.texCoord17 = input.tex + float2( texelSize *  2.0f, 0.0f );
output.texCoord18 = input.tex + float2( texelSize *  3.0f, 0.0f );
output.texCoord19 = input.tex + float2( texelSize *  4.0f, 0.0f );

However with this manner I have artifacts on the sides of the screen:

I know that it occurs because when the offset goes out from the right it takes pixels from the left appropriately.

So my question is: how is the "standard" way to deal with this? I was trying to saturate() all of the values assigned to output.texCoordX, it removes the artifacts in 95%, but it makes my blur much weaker and with strange sharper edges ("roll my log and I will roll yours"?).

sentences:
How to achieve high Level of Detail on 3D models I'm developing a 3D space-based game which allows free movement in all directions and features planets. Currently I am using the Visual Studio content manager to import models (spheres) with 2D textures applied to them. These planets are supposed to be very large, which allows the player to come very close to their surfaces.

From afar, the textures look great. Up close, however, they become very blurred or pixelated (depending on whether I draw them with linear or point clamp).

I understand that I can enable mipmaps for the textures to change the level of detail shown at different draw distances, but obviously this can only be as high resolution as the texture files I provide it. The Visual studio content pipeline only allows Texture2D of size 2048x1024 or less and obviously I don't want to be holding enormous image files in memory for use in game.

Should I produce a set of higher resolution tiles of small sections of the planet's texture, load them on demand and stitch them together? How would this be achieved in XNA?

The effect I'm looking for would be similar to google maps.

It may be that in the future, I will decide that the textures being blurred or pixelated is acceptable, but since this is much a learning process for me, I'd still like to know how it would be solved.

Below is a demonstration of what I mean using a Mercator map of the Earth as an example:

sentences:
Is Kip R. Irvine's claim of Assembly being practical for game development accurate? Kip R. Irvine's book, Assembly Language for x86 Processors, sixth edition, begins by comparing the Assembly language against high-level languages. One of the pros for Assembly, was game development:

  Game programmers are experts at writing code that takes full advantage
  of hardware features in a target system. They use assembly language
  as their tool of choice because it permits direct access to computer
  hardware, and code can be hand optimized for speed.

Whereas a high-level language:

  Produces too much executable code, and may not run efficiently.

This caught my attention. While I do realize that Assembly can optimize your programs, perhaps even significantly, I wonder if, at this point, it is at all practical?

My skepticism comes from:

Assembly seems to be difficult to maintain.
High-level languages aren't so slow.
I'm pretty sure that we have a handful of cutting-edge games based solely on high-level languages.
A particular interest in game development is to make your product cross-platform. I can only think of this as a significant obstacle for anyone using Assembly.
How much is "too much" executable code? I'm not entirely sure how reliable can this measure be.

Even if he meant to use Assembly for specific portions of your game, it still seems (to me) somewhat unpractical.

I'm not particularly advanced in Assembly, so I'm not sure. Are these claims accurate?

sentences:
Mirror Create Player From Client and Change Scene I'm very new to Mirror in Unity but I have a lot of experience in Network-programing.
I'm currently trying to create a Game, where the Player's data is stored on the client, and can join different games (not concurrent) with his/her character. (Likely to Terraria)
So I can't use the automatic Player creation of the default NetworkManager class. After clicking "Join/Host" in our Main-Menu I want to change to the scene the player has played in, Hosting/joining a server and create the player on the server with the specific position...
I have tried now multiple attempts to do this, but none of mine seemed to work.
Am I the even possible to have the players in different scenes with ease?
Where/When should I create the Player so isn't null on the Server?

sentences:
How can I cause the latest touch event to interrupt a prior event in Cocos2D? In Cocos2D for iPhone, I want the latest touch event to interrupt another and ignore the last touch. Let me know if I need to elaborate more, but basically my game consists of a lot of finger dragging, and if the player ever switched fingers, there may be some overlap, and for the way things are setup, it may detect it as a new touch.

I think I have things almost on the right track, but my third touch does not work correctly. For instance:

Touch A begins and held
Touch B begins and held
Touch A let go
Touch A begins and held <-This should
interrupt Touch B

In my delegate I put [glView setMultipleTouchEnabled:YES]; because I believe I need multiple touches enabled.

In my CCLayer class with my added map and sprite I am using targeted touch delegate (i.e. ccTouchBegan NOT ccTouchesBegan, etc)

I am accessing a touch object with touch = [[[event allTouches] allObjects] objectAtIndex:0];, however I don't have much understanding what index is considered the latest touch or even a process to always get the latest touch.

sentences:
How can I hide an object for one eye for the unity oculus rift DK2 platform? I am trying to build a game for my son for the Oculus Rift DK2 to help treat his lazy eye using Unity.

I need objects that:

Appear only to his left eye
Appear only to his right eye
Appear for both eyes.
(this helps force the brain to use both eyes together to form the complete scene)

How can I pull this off?

Thanks!

sentences:
Allowing a secondary market for online content Many games with an online component, allow players to buy various kinds of content. As far as I know, none of them allow a secondary market where players resell purchased content to other players. Presumably this is because the developers think disallowing the secondary market will get them more sales.

However, there seems to be a widely held school of thought regarding Magic: the Gathering (the nonelectronic card game) that the existence of a secondary market actually increases revenue by encouraging people to buy more cards in the hope of being able to resell them. Whether that theory is true or false, the mere fact that many people believe it, should encourage at least some video game developers to try allowing a secondary market.

Given the existence of a reasonably widely held theory that this is a good idea, why is it that no video game developers whatsoever allow a secondary market?

sentences:
Rotation and translation like in GTA 1 OpenGL Okay, so I have a figure in XZ plain. I want to move it forward/backward and rotate at it's own Y axis, then move forward again in the rotation's direction, like the character in GTA 1.

Code so far:

Init:
  spaceship_position = glm::vec3(0,0,0);
  spaceship_rotation = glm::vec3(0,0,0);
  spaceship_scale = glm::vec3(1, 1, 1);

Draw:
  glm::mat4 transform = glm::scale<float>(spaceship_scale) *
                        glm::rotate<float>(spaceship_rotation.x, 1, 0, 0) *
                        glm::rotate<float>(spaceship_rotation.y, 0, 1, 0) *
                        glm::rotate<float>(spaceship_rotation.z, 0, 0, 1) *
                        glm::translate<float>(spaceship_position);
  drawMesh(spaceship, texture, transform);
Update:
   switch (key.keysym.sym) {
   case SDLK_UP:
       spaceship_position.z += 0.1;
       break;
   case SDLK_DOWN:
       spaceship_position.z -= 0.1;
       break;
   case SDLK_LEFT:
       spaceship_rotation.y += 1;
       break;
   case SDLK_RIGHT:
       spaceship_rotation.y -= 1;
       break;
    }

So this only moves on the Z axis, but how can I move the object on both Z and X axis where the object is facing?

sentences:
Error: Cannot create FMOD::Sound instance for resource sharedassets0.resource when splitting application binary in Unity I'm trying to publish an Unity app to the PlayStore. Since the size of the app is over the limit of 100MB, I need to split the binary. So I selected the option Split Application Binary in Unity.

However, when I try to launch this application (either by downloading it on the Playstore or putting the .apk and the .obb directly on my device from my computer), I get the following errors on Android SDK monitor:

01-24 11:38:52.442: E/Unity(25004): Error: Cannot create FMOD::Sound instance for resource
sharedassets0.resource, (File not found. )
01-24 11:38:52.442: E/Unity(25004):
01-24 11:38:52.442: E/Unity(25004): (Filename:  Line: 882)
01-24 11:38:52.442: E/Unity(25004): Function SoundHandle::Instance::~Instance() may only be
called from main thread!
01-24 11:38:52.442: E/Unity(25004):
01-24 11:38:52.442: E/Unity(25004): (Filename:  Line: 25)

The application freezes at the "Made with Unity" splash screen.

This is not happening when I don't use the Split Application Binary option and put the .apk directly on my device from my computer.

I'm using Unity 5.4.0.

sentences:
Simple Game Feasibility: Unity + Turbo Squid + $0 =? I've been coding 2D games exclusively for a while, partly because I have very limited graphics skills, partly because it takes less effort to make something look great, and partly because I have very limited time in which to code.

I have an idea for a very simple 3d kids game that I'd like to build; it would be based around a player roaming a randomly-generated city and looking for a particular building (eg. dollar store, grocery store, bank, etc.)

My question is: Would it be feasible to build this in Unity, using only free models and animation (presumably from Turbo Squid), in a decent time-frame?

In terms of features, this would range in extremes from "generate some random buildings, paths, and select one as the winning building to locate" to adding people to talk to, objects to interact with (water, ladders, keys and locks, ropes, etc.)

I haven't touched 3D modelling for years (I used 3D Studio Max 3.x back in high school), and I don't have 3-4 hours to spend creating, rigging, and animating models. That's really the crux of my doubt. I also don't have cash that I can spend on models/animation.

So to summarize, my main two questions are:

Is it feasible to create a decent-quality game using free stuff from Turbo Squid?
Are many/most/all of the models from TS compatible with Unity?

sentences:
How to only render fragments with Z from 0 to 1 in OpenGL? I have been using OpenGL for a year now, but I just recently found out that OpenGL only clips vertices when the absolute value of the x,y or z coordinate is less than the absolute value of w coordinate. Previously I had assumed that the z coordinate would have to be 0 < z < w to be rendered. Is there any way to clip vertices with z less than 0, without a performance hit?

I am using OpenGL 4.4

sentences: Saving data across same game in multiple devices Is there any library or something that works like iCloud but for different operating systems (Android, IOS, Windows Phone) that allow me to save game data to cloud and open the game data from another device to sync the game progress?

sentences:
Voxel blocks world physic I'm making a game like Minecraft. I have a world made of blocks and I'm trying to implement a basic physic system that applies gravity and checks entities colliding with the blocks of the world.

I tried using Bresenham's algorithm, on player move, to get all blocks between, and then get the first solid and set the player on colliding position. That works well if the player is a point, but if it's a complex AABB and the block too, it becomes difficult.

Is there a simple way to make physic in a voxel world like Minecraft?

sentences:
Move car at same speed I want to move car on each game play run with same speed. At present I was getting each time different velocity. I want to fix that.

Here is game play area on which I was moving car:

At present I was moving car in infinite motion without any kind of control. When it collide with wall, it will its direction based on collision calculation.

Here is my source code that I was using to move car:

void Start ()
 {
     direction = new Vector2 (Random.Range (-1f, 1f), Random.Range (-1f, 1f));
 }

 void FixedUpdate ()
 {

     float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg;
     float targetRot = Mathf.LerpAngle (myRigidbody.rotation, (angle - 90f), 0.1f);
     myRigidbody.MoveRotation (targetRot);

     myRigidbody.velocity = direction * speed;
//        myRigidbody.MovePosition (myRigidbody.position + direction * Time.deltaTime * speed);

     Debug.Log("vel mag: " + myRigidbody.velocity.magnitude);
 }

 void OnCollisionEnter2D (Collision2D other)
 {
     ContactPoint2D contact;
     contact = other.contacts [0];

//        direction = 2 * (Vector3.Dot(direction, Vector3.Normalize(contact.normal))) * Vector3.Normalize(contact.normal) - direction; //Following formula  v' = 2 * (v . n) * n - v

//        direction *= -1;// Dont know why I had to multiply by -1 but it's inversed otherwisae
     Vector2 reflectedVelocity = Vector2.Reflect(direction, contact.normal);
     direction = reflectedVelocity;
 }

At present on each run of car, I was getting different velocity that I have checked via debug statement. So my target is to move car with same speed always.

sentences:
GLSL "varying" interpolation: component-wise? Reference in the spec? Probably a dumb question, but I can't find (or am not understanding) a conclusive answer in the spec or in other questions (e.g., this one).

For smoothly-interpolated varying vec and mat vertex shader outputs / fragment shader inputs, is each element of the vector or matrix interpolated individually?

GL spec sec. 13.5.1 (clipping) describes linear clip-space interpolation of the "output values associated with a vertex."  It also says that those are componentwise for vectors, but doesn't mention matrices.

Similarly, sec. 14.5.1 (rasterizing lines) and sec 14.6 (rasterizing polygons) describe interpolation of an "associated datum f for the fragment".  Is each element of a vector or matrix considered an individual "associated datum" and interpolated independently from the other elements of the vector or matrix?

Secs. 11.1.3.10 (shader outputs) and 15.1 (fragment shader variables) mention interpolation but refer elsewhere for the details.

Similarly, in the GLSL spec, sec. 4.5 (interpolation qualifiers) says that interpolation happens but does not distinguish scalars from multi-component variables.

I am looking for a definitive statement about how vecs and mats are interpolated, if there is one.  Or let me know if there isn't!  Thank you!

(Note: answers can be for any OpenGL version.)

sentences:
How to implement an arbitrary rules engine with interaction Suppose that I have a game that has fairly simple rules, but may have any number of rules modifiers. For boardgames, the classical example would be Cosmic Encounter, but Slay the Spire or any number of games apply. The base rules are easy, but there are too many modifiers to explicitly write conditionals for them all. So how is this done?

(This could also be for any business logic rules engine, but games are where I seem to encounter this more often).

I would think you might be able to do this by having "state" objects and then passing them through a series of modifier objects, but I'm not sure this is the right way of doing it. What is the technique / style for this? What are some good primers/examples?

(I can program well enough, but with my EE degree have only whatever theory I've picked up on the job....).

sentences: Get FVector from Blueprint tick function In my BluePrint Tick function for my character, I have a FVector that always changes, and in my C++ component, I want to get this changing FVector and use it in my C++ Tick function, is that possible to do?

sentences:
Actual use of sparse voxel octrees in a game engine Looking for different ways to speed up my simple voxel system reducing the number of voxels and generated triangles, I stumbled upon these sparse voxel octrees.
Now, I read a lot about it: how do they work, their implementation, pro and cons especially regarding level of detail (that was my research purpose).
I am not an experienced game developer at all, until now I managed to create a simple yet working procedural generation based on chunks, contoured with Marching Cubes. As many other voxel engines, every chunk is formed by a tridimensional array of voxels, where each one has a density value and a position.
Before I even start trying to implement a Voxel Octree, my questions are:

1) How can I "translate" my world generation in order to use the octrees?

2) Should I use an octree for every chunk, or just one octree with "big" bounds containing the whole generated data?

3) Regarding my project, the aim is to create simple spherical world (fairly big, definitely too much without a LOD), are Voxel Octrees even necessary for my purpose?

Forgive my ignorance, I probably don't have the basic knowledge on these topics, but I still wanted to try this cool stuff.
Thanks!

sentences:
What is SpriteStudio? In the game, I've seen asset types for animations that are of SpriteStudio.
I have searched the documentation and cannot find any information on what this is.
I looked at the template project that purportedly covers SpriteStudio, but I don't see anything that really explains how to use it. There are various entities of type "SpriteStudio" that reference assets called SpriteStudio Animations. These assets show their source to be files with a ".ssae" extension. I assume these entities, assets, and resources are purposed to create the 2D animations within the demo.
I don't see how to generate ".ssae" files, nor is there any editor that I could find for the SpriteStudio Animation assets.
Is SpriteStudio separate software? Is it a sub-editor of the Game Studio? How do I create ".ssae" files?

sentences:
What does "ShapeRenderer.ShapeType.Filled", "ShapeRenderer.ShapeType.Line" and "ShapeRenderer.ShapeType.Point" do in libGdx I am creating a game and I wanted to include collision detection when I came across this:
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);

What is this and what does ShapeRenderer.ShapeType.Filled, ShapeRenderer.ShapeType.Line and ShapeRenderer.ShapeType.Point do?
The official documentation has no information about this

sentences:
How to make one material on object with many parts inside? I have a weapon witch have many parts, it also have many materials. Do I really need to make it like that?
It's like about 8 mats! :(

sentences:
Kinect User Silhouette Shader I have this usermap from kinect's depth data (size is 320x280) and i want to display it on my game. The problem, of course it's ugly (first image) and i want to have beautiful effect like in the second image

The usermap is put on a bilboard as a texture2D and i've been thinking i should use fragment shader. I'm wondering what kind of shader techniques i should use so i can possibly make the same effect as shown on second image

Usermap: http://www.azerdev.com/darkmachine/usermap.png

Glowing man: http://www.azerdev.com/darkmachine/silhouette.jpg

sentences:
How can I determine if a cube is adjacent to another cube, and optimize its buffers if so? I'm trying to optimize the rendering of a collection of cubes, (based on an answer I was given to another question I asked). I understand the logic behind occlusion culling, but I'm having trouble with the code.

When I create a cube, I want to determine if that cube is touching another existing cube, and if so I don't want to generate the redundant data in my vertex or index buffers.

I'm planning on making a method that I call from my cube constructor so that everytime I create a cube, these checks are made, and neither occluded face is ever drawn.

How would I go about this?

sentences:
Boat passing under a bridge in a 2D tile based RTS I'm writing a 2D tile based RTS. And I want to add a 'pseudo 3D' feature to it - bridges over the rivers.

I havent't start any coding yet, just trying to think how it fits the collision detection model. A boat passing under the bridge and a unit moving over the bridge will eventually occupy the same cell on the map. How to prement them from colliding?

Is there a common approach to solve such a problem? Or I need to implement a 3D world to do this?

sentences:
How can I draw curves above a mesh surface? I am making an animation of a deformed sphere that represents some aspects of the wave function in a hydrogen atom.  I am starting with an octahedron that i push through a tessellation shader. The tessellation evaluation shader then first deforms the octahedron into something more sphere-like and then applies the deformation stuff.

Now, to further improve the visual impression of the deformation, I would like to place lines on top of the sphere and also deform those, to achieve something resembling level curves.  What would be a good way to achieve this? Generating circles on the cpu side and then sending them to GL and having them deformed separately seems rather odd, but I cannot figure out another way.

If I want to achieve this in one shader run I am also limited to drawing triangles (patches) and making these appear as lines also seems rather unwieldy.

sentences:
How can I draw Polyline and detect its collision with other objects? The idea is to draw trace of moving Actor and if some other Actor intersect it, some function would be called.

I've been searching for solution to this problem in Intersector class, but it seems to me that the only way to do what I want is to implement my polyline as a Polygon and find intersections, but its totally inelegant. I'm sure there should be some smart way to do this.

sentences:
How do I change the game object on a button click? I have a five game objects (ornament1, ornament2, ornament3, ornament4 and ornament5) and  two buttons ("Next" and "Previous"). When I click "Next", the object should change from ornament1 to ornament2. When I click "Next", again, it should change from ornament2to ornament3; when I then click "Previous" it should change from ornament3to ornament2.

I have the "Next" button working, but the "Previous" button is not working. How do I change the game object on a button click?

Here is my code:

if(GUI.Button(new Rect(10, 20, 80, 50), "Ornament1"))
{
    Debug.Log("hhhhhhhhhhhhhhhhhhhhhhh" + countbool);

    if(count==0)
    {
        Debug.Log("hhhhhhhhhhhhhhhhhhhhhhh");
        ornament1.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament1.SetActive(true);
        ornament2.SetActive(false);
        ornament3.SetActive(false);
        ornament4.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 1)
    {
        ornament2.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament2.SetActive(true);
        ornament1.SetActive(false);
        ornament3.SetActive(false);
        ornament4.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 2)
    {
        ornament3.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament3.SetActive(true);
        ornament1.SetActive(false);
        ornament2.SetActive(false);
        ornament4.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 3)
    {
        ornament4.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament4.SetActive(true);
        ornament3.SetActive(false);
        ornament1.SetActive(false);
        ornament2.SetActive(false);
        ornament5.SetActive(false);
        count++;
    }
    else if(count == 4)
    {
        //ornament1.SetActive(true);
        ornament5.transform.position = new Vector3(-0.1428955f, -0.1894745f, 4.108555f);
        ornament5.SetActive(true);
        ornament3.SetActive(false);
        ornament1.SetActive(false);
        ornament2.SetActive(false);
        ornament4.SetActive(false);
        count++;
    }
}

sentences:
Are hidden stats a good idea? I'm thinking of and RPG, FPS or a turn based game (does not really matter), where the player does not know his character(s) exact stats. Of course they exist as random variables of normal distribution inside the game engine. So no visible HP bar, Level, ATK or DEF. You can only determine it's status by it's signs of life (good mood, fatigued, dying, dead, etc...). With regard to casting spells, when your mana is running low, your chance of failing to cast a spell increases (so there is no "zero" point when you need to find the next gas station for refill). To measure your skill you can battle with monsters which has always have fixed (but yet unknown) stats.

The stats would improve as you use them, but each character would have a random talent set so some skills can be improved easier than others.

So my question for the game devs and gamers, is making the true self of your character a mystery a good idea?

UPDATE:

From the answers it seems it depends on heavily the genre of the game.

For RPGs, I thought finding out what's good for your character is fun.  From the responses, it seems it's not so fun because the players usually have an established play style and will try force it from their character for all costs.

The actual game idea I dreamed about is manager like game somewhat similar to the Pokemon game series. The main character has several champions and wanders around the virtual world and battles with others in an arena in a HOMM like fashion. And those champions would have the hidden stats. I didn't mentioned this in the original question because I don't wanted to bias the answers around this particular game concept.

For the feedback to the player (in both cases): There would be ratings similar to the elo ratings that a chess player has. One for the melee hitting, melee blocking, ranged hitting, ranged blocking abilities, and one for the magic abilities.
Hitting the opponent with a sword will increase the melee hitting rating, if the enemy blocks the hit melee hitting decreases. If the opponent hit us with a sword, our melee blocking rating decrease, for successful block it increases, same for the ranged attacks. For the magic skill it's a bit tricky. High magic ability means: easier to cast spells successfully, harder to be affected by cursing spells, and easier to be affected by enchanting spells.

The standard abilities like hit points, toughness, strength, magic power, are estimated from the performance of the champion. These determine the actual damage dealt on successful hit. There would be "standard champions" that has a fixed and known stats, and the other champions' stats can be measured against them to bootstrap the system.

So if the player tries out all aspects of his champions he can find out the skillset his champions have, if the player don't like the skillset he can trade his champions to get the ones with skillset he likes.

UPDATE 2:

So to get straight to point: Would it be fun if I center my game around the concept of getting to know your characters/champions, instead of serving all stats readily to the player?

It would be similar to the football players. The coach will need to see how their players perform in various positions to assign them to position that's the best for them. So he will need to try each one as a goalkeeper, defender or forward. After several matches it will be clear which position is good for them.

sentences: libgdx-using more than one class Hi i am very new to programming and in this community,so im recently studying on how to develop games with libgdx and all the tutorials only have one class and do all the things in that class,but is it possible to use more than one class?(ex:individual class for player, mobs , etc) thanks!

sentences:
How do I get my fish to face the right way? I'm making this 2d collecting game in Unity where you collect fish. However I can't get them to face the direction they are going. I've asked on some Discords and got no answer. Thanks in advance.
Here's is the video of the fish.
And here's the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    public float minY;
    public float maxY;
    public float minX;
    public float maxX;
    public float speed;
    public float maxZ;
    Vector2 targetPosition;

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

    // Update is called once per frame
    void Update()
    {
        if ((Vector2)transform.position != targetPosition)
        {
            transform.right = (Vector2)targetPosition;
            transform.position = Vector2.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime);

        } else {
            targetPosition = GetRandomPosition();
        }
    }

    Vector2 GetRandomPosition()
    {
      float randomX = Random.Range(minX, maxX);
      float randomY = Random.Range(minY, maxY);
      return new Vector2(randomX, randomY);
    }
}

sentences:
How to represent a game character in code? In a previous game I wrote I  had a game character class. This class tracked the location, velocity, and a set of states. Except the states were tied very close to the animation. Each state would have a list of buttons that can transition it other states, and an animation that would go with that state (you could also do per-frame animation state changes, if you wanted to do something like have a very specifically timed punch or something). All of the collision data for the character was done on a per animation-frame basis. This was done for a fighting game, so it seemed necessary at the time to have the animation and collision tied so closely to the character state.

But the programmer in me feels like this is mixing responsibilities. And now I'm making a game engine that I want to be a little bit more generic than that. How do you typically organize the structures relating to the characters, how they're drawn, how they interact with each other and the world, etc?

I realize this is sort of a vague question that depends on the type of game I want to make, but I think seeing how other people handle this would be useful.

(and if it matters, this is all for a 2D game.)

sentences:
Amazon FreeTime Unlimited Monetization So I've recently noticed how great FreeTime Unlimited is for my daughter. There's no ads, no in-app purchases, etc. She can just play the games/apps and I don't have to worry about it.

As a develop I thinking it could an interesting avenue to go down, but there's a few things that I for the life of me can't get Amazon support/forums to answer in any logical manner.

So the idea according to their information is that the apps are highly scrutinized to verify they are child friendly content, which is excellent. Also, you can't use webviews, ads, or in-app purchases.

My question is: How do devs monetize these applications? Clearly they're not just giving away their work for free? The only logical answer I can guess at, is that it uses the Amazon Underground scheme of earning $$ based on the amount of time the user spends in the app/game??

Does anyone have and actual experience or information on this? As I said, I've reached out to multiple people at Amazon, and keep getting the runaround with all of them pointing me to the same useless link.

sentences:
Make square walk by rotating around corners I in the very beginning of making a small game, and I'm having some problems getting the basic movement of my character.

My character is a square that can be moved by rotating around a corner. The user chooses what corner to rotate around by pressing a button. Here is the (malfunctioning) code I've come up with this far(Java and slick2d):

    // square is an org.newdawn.slick.Image and is rendered by calling square.draw()

    @Override
    public void update(GameContainer container, int delta) throws SlickException {
        Input input = container.getInput();
        if (input.isKeyDown(Input.KEY_W))
        {
            square.setCenterOfRotation(0, 0);
            square.setRotation(square.getRotation() + 1);
        }
        else if (input.isKeyDown(Input.KEY_E))
        {
            square.setCenterOfRotation(square.getWidth(), 0);
            square.setRotation(square.getRotation() + 1);
        }
        else if (input.isKeyDown(Input.KEY_S))
        {
            square.setCenterOfRotation(0, square.getHeight());
            square.setRotation(square.getRotation() + 1);
        }
        else if (input.isKeyDown(Input.KEY_D))
        {
            square.setCenterOfRotation(square.getWidth(), square.getHeight());
            square.setRotation(square.getRotation() + 1);
        }
    }

This will rotate the square correctly, but when I switch rotation direction, the square jumps two times its lenght to the side I switched to. I think the problem is that I never really move the square, just rotate it away from its original position. I think this will also make collision detection difficult.

How would I prevent this 'jumping', and how will I later do collision detection on the image? Or asked in another way, how should I be doing the 'rotation walking'?

sentences:
Common way of animating 'motion' for walk cycle animations I've just posted this at the Blender artists' forums before realising I would probably get a better response from a more game development-specific audience, so apologies for cross-posting! It's for the right reasons :)

I'm a programmer trying to animate a character walking for a game project, using Ogre. I've made a very simple walk cycle in Blender and exported it to Ogre, and it plays just fine. By fine, I mean it works, but there's terrible foot sliding. This is because I just animated the walk in-place (at the origin) in Blender, and of course I don't know what "speed of walk" that corresponds to, so when I move the character in-game the motion doesn't necessarily match up with the movement of the feet in the animation.

So my question is: what's the normal approach for this kind of thing? At work we use Maya, and the animators either animate a special 'moveTrans' node that represents the "position" of the character (or have the exporter generate it for them from the movement of the root node), then the game can read this to know how fast the animation moves the character. So in the Maya file, the character will walk forward for one cycle and this extra node will follow along with them by their feet. I've not seen anything like this in open-source land, and there's certainly no provision for that in the Ogre Exporter script. What do you chaps normally do for this?

sentences:
"Painting" elements in html5 canvas I'm making a game in coffeescript (although for the sake of this problem that's probably not all that relevant) and html5's canvas. It's a game that involves a paint cannon, that fires circular particles of paint that can paint elements of the level and the player. The problem is I'm not sure how to accomplish the painting. The diagram below illustrates what I'm trying to accomplish:

Using canvas, the particles are drawn using context.arc(), the players using drawRect.arc() and the floor can be an arbitrary polygon with drawing code as follows:

    @drawingContext.beginPath();

    tV = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[0]))
    @drawingContext.moveTo(tV.x, tV.y)
    for i in [1..@vertices.length - 1]
        v = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[i]))

        @drawingContext.lineTo(v.x, v.y)
    @drawingContext.lineTo(tV.x, tV.y)

    @drawingContext.closePath()
    @drawingContext.stroke()
    @drawingContext.fill()

It would be too intensive to keep track of all the circles that should be painted on to objects and would soon bog down, with potentially 60 clipped circles per second being added to be drawn on top of objects.

The original thought was to stack two canvases on top of each other, so then we could draw the levels once and then when ever necessary just draw the paint splat over them once and forget about it (changing the composition mode to source-atop to get appropriate clipping), and since we're not redrawing it would stay there. However, this won't work on moving objects (like players) (that can also rotate and change size relative to the camera). I'm not sure how to do it, since all objects are made up of solid colour to start with there's no texture data or anything we can modify.

sentences:
Where should complex state logic in an ECS reside? I've been using ECS for a while, at the moment I'm using my own, but it's pretty standard.  Components are data only, Entities pretty much just a Map with some additional metadata and Systems that match combinations of components and contain the logic.

You have combinations of components that result in the more general functionality.  For example Position + Graphics gives me some nice static background image.  Position + Graphics + Physics gives me a entity that can move around etc etc

This question is about the various options for implementing more specific game logic.

But say I want to implement a Door.  It has Position, Graphics and a Collidable Hull but it needs 2 states, open and closed.  When its open it has texture A and its Collidable Hull is disabled, and when its closed it has texture B and its Collidable Hull is enabled.  Lets say the state change should be triggered across some internal channel in the engine.

What are the options for implementing this state change?

Option 1 is to create Door component, with say 2 variables, door state and state change channel. I'd also need a door system that handled the logic to manipulate the components when it receive the open/close message.

Option 2 would be to create a FSM.  The FSM is probably also a component with a corresponding FSM System.  Logic and state would need to reside somewhere, possibly by sub-classing the FSM or having a generic property map in the FSM and static logic functions for the Door defined elsewhere.

There are more exotic alternatives to FSM's i.e. Actions Lists or Behaviour trees, but they are similar to option 2.

What considerations are there for choosing a full component/system over an more generic FSM type solution?  What if I had 100 different game objects with different behaviours? Would you really expect 100 component/system pairs for each one or would you try and create a more generalized solution? Are there any other options?

sentences:
OpenGl indices array I have a class terrain which create a grid of Quads. I do it like this

for(int z=0; z<_length;z++){
            for(int x=0; x<_width;x++){
                vertices.push_back(vec3((float)x*250, 0.f, (float)z*250));
    }
}
for(int z=0; z<(_length-1);++z){
    for(int x=0; x<(_width-1);++x){
        int index = z*_width+x;
        Vertex _vertices[] = {
            Vertex(vertices.at(index),vec3(0, 0, 0)),
            Vertex(vertices.at(index+1),vec3(0, 0, 0)),
            Vertex(vertices.at(index+_width),vec3(0, 0, 0)),
            Vertex(vertices.at(index+1+_width),vec3(0,0,0))
        };

        unsigned short indices[]= {index,index + 1,index +
            _width,index + 1,index +  _width,index +  _width + 1};
        Quad quad(_vertices, 4, indices, 6);
        squares.push_back(quad);
        i++;
    }
}

The vertices and the logic are correct, but the indices aren't, for some reason. here is the output for this code :

But when I change this indices to this :

            unsigned short indices[]= {0,1,2,1,2,3};

It works great :

The problem is I don't understand why this line

        unsigned short indices[]= {index,index + 1,index +
            _width,index + 1,index +  _width,index +  _width + 1};

doesn't work. And if it worked, my grid would consume a lot less ressources. If someone could explain me why it doesn't work, It would be great, thanks you.
In case you need to know how I draw a Quad, here is the code :

class Quad{
public:
    Quad(Vertex *_vertices, int _n, unsigned short * _indices, unsigned short _numIndices){
        for(int i=0; i < _numIndices; i++){
            indices.push_back(_indices[i]);
        }

        for(int i=0; i<_n; i++){
            vec3 v = vec3(_vertices[i].position, _lengthPower);
            position.push_back(v);
        }
        glGenVertexArrays(1, &mVertexArray);
        glBindVertexArray(mVertexArray);

        glGenBuffers(1, &mPositionBuffer);
        glBindBuffer(GL_ARRAY_BUFFER, mPositionBuffer);
        glBufferData(GL_ARRAY_BUFFER, sizeof(vec3)*position.size(), position.data(), GL_STATIC_DRAW);

        glGenBuffers(1, &mIndicesBuffer);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndicesBuffer);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned short)*indices.size(), indices.data(), GL_STATIC_DRAW);

    }

    void draw(){
        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, mPositionBuffer);
        glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndicesBuffer);
        glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, 0);
        glDisableVertexAttribArray(0);

    }
    ~Quad(){

    }
private:

    std::vector<unsigned short> indices;
    std::vector<vec3> position;
    GLuint mVertexArray;
    GLuint mPositionBuffer;
    GLuint mIndicesBuffer;
};

I'm using, OpenGL, glm, glfw etc.

sentences:
collision resolve sphere-aabb and aabb-aabb I am currently working on a basic physics engine which does not consider rotations.
At the moment I work on collision resolving between aabbs and spheres.
Unfortunately I have no idea what a collision between a dynamic aabb and a dynamic sphere looks like.
When a sphere hits a falling aabb from a diagonal direction from above will the aabb be pushed to the sides according to the flight direction of the sphere or only accelerated further downwards?
Also, when the sphere has a certain force, it will not bounce off the aabb but push it in front of itself. I don't know how to deal with this either.

At the moment I have the sphere-sphere collision implemented, which is described here:
http://www.gamasutra.com/view/feature/131424/pool_hall_lessons_fast_accurate_.php?page=3

I guess my solution will be similar, but without caring about the distance between the objects.
Also I guess that the collision resolving of aabb-aabb will be the same as sphere-aabb.

Does anybody have an idea or any experience with collision resolving between aabb-sphere and aabb-aabb?

sentences:
It lags when it collides. Help? :( I am trying (and believing) to make a game of pong. I have got a slightly decent working game. I haven't implemented the scoreboard or AI yet because I want the physics to work first. I am trying to reverse the direction of the ball when it hits either paddle just to make it work cleanly and am having the issue where it changes direction twice, it bounces off the paddle as expected and then goes in the opposite direction to when it hit the paddle -.- If anyone could help me, it would be much appreciated.

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

    public class BallController : MonoBehaviour {

        private float randomNumber;
        private float range;
        private float pointOfContact;
        private float paddleTop;
        private float paddleBottom;
        private float[] limits;
        private int speed;
        private int caseNumber;
        private Vector2 direction;
        private Rigidbody2D ballRigidbody;

        void Start () {
            //Getcomponent finds the rigidbody of the attached object.
            ballRigidbody = GetComponent<Rigidbody2D> ();

            speed = 5;
            caseNumber = Random.Range (0, 2);
            range = PickARange (caseNumber);
            ballDirection (speed, range);
        }

        void FixedUpdate() {

        }

        void OnCollisionEnter2D (Collision2D coll) {
            if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Computer") {
    //          pointOfContact = ballRigidbody.position.y;
    //          print (pointOfContact);

                ballRigidbody.velocity = new Vector2 (ballRigidbody.velocity.x, ballRigidbody.velocity.y * -1);
            }
        }

        void ballDirection (int ballSpeed, float yDirection) {
            randomNumber = (Random.Range (0, 100));

            if (randomNumber < 49) {
                direction = new Vector2(Random.Range (-1.0f, -0.5f), yDirection);
                ballRigidbody.velocity = (direction * ballSpeed);
            } else {
                direction = new Vector2(Random.Range (0.5f, 1.0f), yDirection);
                ballRigidbody.velocity = (direction * ballSpeed);
            }
        }

        float PickARange (int number) {
            switch (number) {
            case(0):
                range = Random.Range (0.5f, 1.0f);
                return range;
            case(1):
                range = Random.Range (-1.0f, -0.5f);
                return range;
            default:
                range = 1.0f;
                return range;
            }
        }
    }

I thought to multiply the whole velocity by -1 but that just caused a loop because of the lag. Even though that's the right way to reverse the direction. I think.

Thanks Peeps!

sentences:
OpenGL Depth Buffer/Coordinate issue with SFML For some reason, my coordinate system in OpenGL is getting all messed up with depth.  When I put something more than 1 unit away from zero (in terms of the Z coordinate), I can't see the object.  Furthermore, it seems as if the GL coordinate (-1, -1, 0) is in the lower left corner no matter what I do (and (1, 1, 0) is upper right).  I've used OpenGL in Java and in C++ with GLUT before and am now trying out SFML, and haven't had these issues before, so maybe someone can tell me what I'm doing wrong?

A minimal example as best I can do:

#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>

#include <iostream>

int main()
{
    sf::ContextSettings settings;
    sf::RenderWindow window(sf::VideoMode(800, 600), "OpenGL Test", sf::Style::Default, sf::ContextSettings(24));

    settings = window.getSettings();

    std::cout << "depth bits:" << settings.depthBits << std::endl;
    std::cout << "stencil bits:" << settings.stencilBits << std::endl;
    std::cout << "antialiasing level:" << settings.antialiasingLevel << std::endl;
    std::cout << "version:" << settings.majorVersion << "." << settings.minorVersion << std::endl;

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);    // Black Background
    glDepthRange(-1, 1000);

    // run the main loop
    bool running = true;
    while (running)
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                // end the program
                running = false;
            }
            else if (event.type == sf::Event::Resized)
            {
                // adjust the viewport when the window is resized
                glViewport(0, 0, event.size.width, event.size.height);
            }
        }
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        glLoadIdentity();

        // Comment this line to fix it!!?
        glTranslatef(-1.5f,0.0f,-6.0f);

        glBegin(GL_TRIANGLES);                      // Drawing Using Triangles
            glVertex3f( 0.0f, 1.0f, 0.0f);              // Top
            glVertex3f(-1.0f,-1.0f, 0.0f);              // Bottom Left
            glVertex3f( 1.0f,-1.0f, 0.0f);              // Bottom Right
        glEnd();                            // Finished Drawing The Triangle

        window.display();
    }

    return 0;
}

Update:
The glDepthRange() call was to make sure that wasn't the source of the problem.  Also I added the following code to the initialization, and I haven't seen any change in behavior:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glViewport(0, 0, 800, 600);

glMatrixMode(GL_MODELVIEW);
...

Also, I'm using the 2.0RC version of SFML, and my OpenGL version is 4.3 (running on an ATI card).

sentences:
How to create soft Icecream like particles with Liquidfun and Corona Currently using the "elastic" flags for particle behavior, which looks decent when it is flowing downwards but when the icecream collects in cup it is too liquidy.  Also this gives it a springy bounce which I am not sure how to take out. I am wondering how I should make it thicker more solid along but to stay a bit elastic? Can I change behavior of particle after it is created?

I have tried with a "spring" flag and "viscous" flag but it looks sort of the same.

Demo Clip

Corona/LiquidFun

  -- Create Particle System
  local particleSystem = physics.newParticleSystem{
    filename = _PRT,
    radius = 1,
    imageRadius = 2
  }

  offset_x = _C.x + 70
  offset_y = _UL.y + 100
  -- Paramaters for red particle faucet

  local particleParams_red =
  {
          flags = { "elastic"},
          linearVelocityY = -10,
          color = { 1, 0, 0.1, 1 },
          x = offset_x,
          x = offset_x + display.contentWidth * 0.15,
          x = offset_x + display.contentWidth * -0.15,
          y = offset_y,
          lifetime = 60.0,
          radius = 5,
  }

sentences:
Why would I lose the D3D device during an HLSL unroll? I have a pixel shader that downsamples a texture from one size to another. The downsample shader uses a nested 'for' loop to traverse the uv coordinates. When the for loop executes more than four times( [unroll(8)] for example ) the graphics device is lost and all hell brakes loose...Here is shader code:

void DownsamplePass_Pixel_Shader( in float4 Position : POSITION0,
           in float4 PositionSS : VPOS, out float4 vEnergy : COLOR0 )
{
    float width = LastMipInfo.x;
    float height = LastMipInfo.y;
    float mip = LastMipInfo.z;
    float mult = LastMipInfo.w;
    float4 vPos = PositionSS;
    float4 vColor = 0;
    int ncPixels = 0;

    // depending on the size of the visibility buffer( texture to downsample )
    //      it may be necessary to sample more than a 2x2 block of pixels( if the size is greater than twice the target )
    //      this is only necessary for the first pass
    if( bFirstDownsamplePass )
    {
        [unroll(8)]
        for( int y = 0; y < mult; ++y )
        {
            [unroll(8)]
            for( int x = 0; x < mult; ++x )
            {
                float2 vCoord = float2( ( vPos.x * 2 * mult ) / width + x * ( 1 / width ), ( vPos.y * 2 * mult ) / height + y * ( 1 / height ) );
                float4 vTexel = tex2Dlod( g_SamplerMip, float4( vCoord, 0, mip ) );
                if( all( vTexel.rgb == 0 ) )
                    continue;

                vColor.rgb += vTexel.rgb * tex2D( g_SamplerMultiplier, vCoord ).rgb;
                ncPixels++;
            }
        }
    }
    else
    {
        float2 vCoords[ 4 ];
        vCoords[ 0 ] = float2( ( vPos.x * 2 ) / width, ( vPos.y * 2 ) / height );
        vCoords[ 1 ] = float2( vCoords[ 0 ].x + ( 1 / width ), vCoords[ 0 ].y );
        vCoords[ 2 ] = float2( vCoords[ 0 ].x, vCoords[ 0 ].y + ( 1 / height ) );
        vCoords[ 3 ] = float2( vCoords[ 1 ].x, vCoords[ 2 ].y );

        // calc average energy
        float4 vColor = 0;
        int ncPixels = 0;
        for( int i = 0; i < 4; ++i )
        {
            float4 vTexel = tex2Dlod( g_SamplerMip, float4( vCoords[ i ], 0, mip ) );
            if( all( vTexel.rgb == 0 ) )
                continue;

            vColor.rgb += vTexel.rgb;

            ncPixels++;
        }
    }

    vEnergy = float4( vColor.rgb / max( ncPixels, 1 ), 1 );
}

I could just define each uv coordinate but I'm interested in knowing why this problem occurs!

sentences:
What sounds need to be transcripted when using Closed Captions? I have no experience with captioning, but we are developing a game and we want to make it as accessible as possible so we thought of 2 levels of subtitles: dialogues and Closed Captions (dialogues + sound effects).
The problem I can think of is what sounds need to be transcripted in Closed Captions? All sounds of the game could clutter the screen with subtitles and distract the player. Too few sounds and the player could miss some details.
For example we could have an electric door which makes some sound when opened or closed, this kind of sound should be transcripted always? Or just the first time it's encountered, and then the user will know that all the similar doors should make the same sound?
And is it too much to put 2 subtitles (one for opening, one for closing)?

sentences:
Can you run a websocket client in EU4 server mode? Is it possible to build a websocket client (eg using blueprints) and then package this into an EU4 server (like suggested here).
If so, would this mean that the EU4 server's websocket client could then connect to a different server app being run using say javascript or golang?

sentences:
FPS games: don't they have unrealistic one-eyed view? What are the causes? I have played many fps games, and noticed that the camera perspective is similar to the 'one eyed view' of the surroundings. It does not feel like bilinear. :/

Is it because of the single flat view of the screen? Or is it the problem that can be fixed by some research?

PS: If you want, try to roam around with only one eye open.

sentences:
Is white the best base color to start with when planning to shade sprites within Unity? I'm looking into prototyping a game in Unity which will consist of solid square sprites / tiles. I figure I can represent different types of objects with different colors for each of the tiles in the game.

I figure that I can import a single square sprite and shade it appropriately in Unity as opposed to imported squares of many different colors.

My experience with adjusting the hue and saturation within Photoshop shows that white is not an easy color to change as things that are white often stay white. My testing in Unity shows that I can change the "color" of a sprite to anything other than white and the sprite is seemingly shaded appropriately, despite what I would have thought given my Photoshop experience.

Since white objects do seem to take on the appropriate color shading when changed within Unity my gut tells me that this is the best base color to begin with, meaning that I can import a single white square sprite and simply adjust the color to represent different objects and object states.

Is a white sprite actually the best color sprite to begin with and why does something like this work in Unity as opposed to adjusting the hue and saturation within Photoshop?

sentences:
Correct order of operations in a platformer game loop I've run into an issue with my Mega Man engine, and the structure of my game loop is making it very difficult to fix. With Rush Jet, or any falling platform, Mega Man needs to stay attached to the platform as it falls. Right now the best I can do (without resorting to workarounds like magic forcefields that pull him down) has it so that he falls for a single frame when the platform first starts falling. But even this requires the falling platform to pull him down during the collision check. Without this extra step, he constantly "jitters" in falling as the platform descends.

The order of events in my game loop is making this happen. It goes like this:

Mega Man and Rush Jet are flying horizontally for a while.
Thinking phase: Player presses down - the platform decides to set its velocity to downward.
Action phase: Platform moves down, player has no awareness of this.
Reaction phase: The two are not colliding, so no "binding force" check can occur.
Next frame, Mega Man falls. A frame later, gravity catches up and he lands on the platform again, resetting his y velocity to 0.

You can see there the basic order of my loop:

Thinking phase, where you analyze collisions from the previous frame, and any other variables, to decide on state transitions and other adjustments.
Action phase - everyone moves according to their velocity.
Reaction phase - collision checks, adjust positions to fix them. This also handles effects like moving platforms, eg. push the player by some amount. The changes to his velocity are applied in the next frame, during the action phase.

I've tried reordering these steps and various other changes, but they all make the whole thing much worse, with all sorts of bugs. If I need to make sweeping changes to my engine to get these things right, I'd rather know what the "proper" way is before wasting any time.

I know one possible solution would be for the movement step to look at who was touching the platform in the previous frame and pull him then, so they actually move together. That seems too complex though, reaching between components like that. My engine code already feels way more complicated than the original game could have been, suggesting that I'm doing something wrong.

So is there a proper sequence of events? There's another question on here about moving things along with a platform, but that doesn't address the order of events issue which causes my problem. Also, if anyone actually knows the way the classic Mega Man games did it, that would obviously be a huge help.

Find as much of my code as you want at https://github.com/Tesserex/C--MegaMan-Engine/tree/master/Mega%20Man. The CollisionComponent and MovementComponent may be the most useful.

sentences:
How does Windows GDI work compared to DirectX/OpenGL? OpenGL and DirectX, if we are talking about graphics, are somehow built into a graphics card and you can access them using appropriate environment and draw some graphics.

After reading wiki, I came to a thought that even though GDI doesn't use hardware directly as DirectX/OpenGL, it still get its access to a graphics card after some manipulations.

What is GDI and how does it work in compare to these two?

sentences:
How to remove white background from an image using LibGdx? I am fairly new to game development.

I am developing an application(Aquarium) for windows which requires me to animate(move) fishes around the screen and user will be able to add new fishes drawn on paper and scanned into the application, I did some research and decided to use LibGDX so when user scans the image coming to the system has White background which needs to be removed I needed to know how to remove that make it transparent in LibGDX.

sentences:
How to design AI Manager I am currently building a AI system for a game. I am familiar with State design pattern and implemented different states for each agent in my game.

Different states are like Running, Attack, Idle, Cover, Support etc.

In this game, I have around 10 agents which have mainly two behaviours - Defender and Attacker.

I made a class AIManager which have reference of all agents in the game. This class decides which agent will do what but I am facing issues in managing this class. There are many rules in the game like -

There will be two teams.
Each team will have 2 defender and 3 attackers.
Attacker will attack attackers and defenders.
Defender only attack to defenders.
At a time only two agents can attack a single agent.
If defender is in cover, it will not go to support state.
If defender is attacking, it will not go to run state.
If attacker is attacking, it can run away on specific condition.
... etc

To make these rules applicable, my AIManager class is totally mess, contains lots of if/else, need to check every possibilities, for loops. I am sure I am not doing right in implementing these game logic because when I need to change some rules or need to add another state, I need to go through all my game logic. This manager code is totally unstable.

I want to know how to tackle this situation, Is there any design pattern which I should follow or any suggestion would be of great help.

sentences:
Character movement relative to cursor position I want my top-down shooter character to move towards the mouse when pressing the up arrow and strafe relative at right angles to it when pressing the left and right arrow keys.

I can't figure out how to do this.

Here is my code (The character is character_mc):

import flash.events.MouseEvent;
//Event Listners
stage.addChild(crosshair_mc);
crosshair_mc.mouseEnabled = false;
crosshair_mc.addEventListener(Event.ENTER_FRAME, fl_CustomMouseCursor);

function fl_CustomMouseCursor(event:Event)
{
    crosshair_mc.x = stage.mouseX;
    crosshair_mc.y = stage.mouseY;
}
Mouse.hide();

stage.addEventListener(MouseEvent.MOUSE_MOVE,facecursor);
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_KeyboardDownHandler);
//Functions
function facecursor(event):void
{
    character_mc.rotation = (180 * Math.atan2(mouseY - character_mc.y,mouseX - character_mc.x))/Math.PI + 90;

}

function fl_KeyboardDownHandler(event:KeyboardEvent):void
{
    trace("Key Code Pressed: " + event.keyCode);
    if (event.keyCode == 38)
    {
        character_mc.y = character_mc.y - 5;
    }
    if (event.keyCode == 40)
    {
        character_mc.y = character_mc.y + 5;
    }
        if (event.keyCode == 39)
    {
        character_mc.x = character_mc.x + 5;
    }
        if (event.keyCode == 37)
    {
        character_mc.x = character_mc.x - 5;
    }

}

I'm new to actionscript, so example code would be helpful.

sentences:
XNA 4.0 Post-Processing Libraries? Are there any free XNA 4.0 post-processing libraries that are easy to hook into projects? I am looking specifically for a glow effect (although anything is great), and I should also mention that I'm using the Reach profile.

EDIT: I should add that I'm not concerned about the Windows phone, because it can't support custom shaders.

sentences:
Terrain (mesh) textures in Unity - blurry? I've created a 3D mesh in blender which will be used as a terrain in Unity. Additionaly, I created a 900x900 texture which I'd like to apply as material to the mesh. However, unlike with the normal Unity terrain, the material is only blurry/unrecognizable, not matter how many times I repeat the texture/what import settings I set for the texture.

Some googling brought up that it may have to do something with the shader, but I tried many with no results.

current result

texture

sentences:
Why specular reflection work only in center of virtual scene? How to calculate this cpecular reflection?

HLSL

void calculateSpecular(
    in float4 Normal,
    in float4 SunLightDir,
    inout float4 Specular
){
        Specular = specularLevel * pow(saturate(dot(reflect(normalize(abs(eyePosition)), Normal), SunLightDir)), specularExponent);
}

/// in pixel shader
float4 Specular = float4(0.f,0.f,0.f,1.f);
calculateSpecular( input.normal, -sunLightDir, Specular );

///sunLightDir it's just camera position + vec3(0,10,0)

/// in vertex shader
output.normal = mul( float4( input.normal, 0.f ) , World );

sentences:
draw fog of war using shaders I am making a RTS game, and I'd like some advice on how to best render fog of wars, given what I'm already doing.

You can imagine this game as being a classic RTS like Age of Empires 2, where the fog of war will basically be handled by a 2D array telling if a given "tile" is explored or not.
The specific things to consider here are :

1) I'm only doing a few draw calls to draw the whole screen, using shaders, and I'm not drawing "tile by tile" in a 2D loop

2) The whole map is much bigger than the screen, and the screen can move every frame or so

In that case, how could I draw the fog of war ? I have no issue maintaining on the CPU-side a 2D array giving the fog of war for each tile, but what would be the best way to actually display it dynamically ?
thanks!

sentences:
Change Time.timeScale during an animation event - Unity I have an animation. A few seconds after this animation starts I set an animation event that is correctly being triggered. This animation event calls a method where I am trying to modify Time.timeScaleand set it to 0.05f.

This event is calling the following method:

public void Slowmotion()
{
    Time.timeScale = 0.05f;
    //Time.fixedDeltaTime = Time.timeScale * 0.02f;
}

But this Slowmotion method is not working.

Any ideas on what may be happening?

sentences:
How should I store game data in a game server? I'm new to game server development. I'm facing this issue:

I want to develop a card game server, but I'm not sure about the solution to hold the game data while playing.

Example:
In a poker game, when a player makes a move, the server will process the request and send it to all other players. But how will the game server know what the current state of the game is to do subsequent actions? Should I save all moves into database and server will look into it to know the current state?

sentences:
Component Class / Renderer Class I found some code I needed online, but I want to understand how it works.
Renderer c = (Renderer)b; What is this (Renderer)b action called so I can Google about it?
It looks like it's trying to get a Renderer instance from b, but isn't b a Component of type Renderer already? Or is this because Renderer is a subclass of Component?
void SetTargetInvisible(GameObject Target)
{
    Component[] a = Target.GetComponentsInChildren(typeof(Renderer));
    foreach (Component b in a)
    {
        Renderer c = (Renderer)b;
        c.enabled = false;
    }
}

Code is from
https://forum.unity.com/threads/how-to-make-all-children-invisible.27259/
Thanks for taking the time!

sentences:
Register Enemies in game development I'm working on a game to learn the basic for game concepts. I end up with the following problem. I got a class called enemy, but now I want different types of enemies. These enemies extend from this class enemy. So I can have different enemies with that share different properties. The problem is that I want to spawn a different enemy each time. But to do this I need to know all the enemies available to choose on randomly.

I have been thinking and I got two approaches to solve this. The first one I end up is to have an enum with different enemies, and get a random value from the enum and spawn that enemy, but for this, I need to hard code all the enemies into the enum. And another one is to have a GameRegister class, that have a register for all available enemies, like when you do modding in Minecraft for example. I can have a registered class to register enemies or objects. And if I want to select a random enemy I know all the enemies available. I think is the best approach because if I want to add more enemies or anything, I only need to register for that class.

I don't have any idea at all to how to implement this pattern, and I didn't find anything on the internet. Can someone give some tips or clarify what I want to do? Because I have the main idea but I get completely lost when I need to design this.

I'm working on Java using libGDX, if is useful for some reason.

sentences:
Any clue to create natural shadow like this? I only use skylight with hdri map for overcast lighting. The corner isn't dark enough compare to other's work. Any clue to achieve this natural falloff soft shadow?
What I want

What I get

My world settings

sentences:
How do I draw 2D textures with Direct3D 11.1? I'm running into trouble trying to figure out the best way to draw textures to the screen using Directx 11.1 (for Metro apps).

In XNA, I used SpriteBatch. Is there something partially comperable?

In the Win8 SDK examples, they used WIC and Bitmap, although it suggests that that is not the best way to draw 2D graphics with the best performance.

sentences:
Basic Box2D collision detection I don't understand how to listen for collisions in Cocos2D/Box2D.  Say I have two dynamic circle bodies.  One is very small and the other is relatively large.  When the small circle collides w/ the large circle I'd like to do something (play a sound for example).  What's the best way to do this?

I'm currently experimenting w/ the TestPoint method.  Something like:

if(largeCircleBody->GetFixtureList()->TestPoint(smallCirclePoint)){
    // collision happened...
    // play sound etc
}

sentences:
Scale object based on another object's position Despite an hour or so of Googling I can't seem to figure out how to calculate the scale factor based on distance. Here's the illustration of my problem.

I've tried manipulating the x values and such, but until now I still cannot figure it out.
Here's the snippet:

Vector3 v3Scale = frontWall.transform.localScale;
frontWall.transform.localScale = new Vector3(v3Pos.x*2.0f , v3Scale.y , v3Scale.z);

Any ideas? Thanks in advance!

UPDATE:

if(getTarget.CompareTag("LeftRightWall") && getTarget.transform.childCount == 1)
        {
            float translate = getTarget.transform.position.x - getTarget.transform.GetChild(0).gameObject.transform.position.x;
            Debug.Log("value :"+translate);
            foreach (GameObject frontWall in GameObject.FindGameObjectsWithTag("FrontWall"))
            {
                Vector3 v3Scale = frontWall.transform.localScale;
                float scaleFactor = translate/frontWall.transform.localScale.x;
                frontWall.transform.localScale = new Vector3(translate , v3Scale.y , v3Scale.z);
            }
            v3Pos.z = getTarget.transform.position.z;
            v3Pos.y = getTarget.transform.position.y;
            getTarget.transform.position = v3Pos;
            getTarget.transform.GetChild(0).gameObject.transform.position = new Vector3(-v3Pos.x, v3Pos.y, v3Pos.z);
        }

The LeftRightWall is the ones that I drag on the picture, with another vertical line as its child. The FrontWall is the horizontal line that is stretched when the LeftRightWall is dragged. Hope its clear enough. Thanks

UPDATE: This is the closest one from what I'm trying to achieve... ((

Here's the code:

float translate = getTarget.transform.position.x - getTarget.transform.GetChild(0).gameObject.transform.position.x;
            Debug.Log("value :"+translate);
            foreach (GameObject frontWall in GameObject.FindGameObjectsWithTag("FrontWall"))
            {
                Vector3 v3Scale = frontWall.transform.localScale;
                frontWall.transform.localScale = new Vector3(translate+v3Pos.x, v3Scale.y , v3Scale.z);
            }

UPDATE:
This is what I'm able to do so far, thanks to the answer below. However I still don't know why the other side of the panel is behaving like that. The scale of horizontal lines also shrinks when I click on the vertical line.

This is the updated code:

ray = mainCamera.ScreenPointToRay(Input.mousePosition);
        float dist;
        plane.Raycast(ray, out dist);
        Vector3 v3Pos = ray.GetPoint(dist);
        if(getTarget.CompareTag("LeftRightWall") && getTarget.transform.childCount == 1)
        {
            float translate = getTarget.transform.localPosition.x - getTarget.transform.GetChild(0).gameObject.transform.position.x;
            Debug.Log("value :"+getTarget.transform.GetChild(0).gameObject.transform.localPosition.x);
            foreach (GameObject frontWall in GameObject.FindGameObjectsWithTag("FrontWall"))
            {
                Vector3 v3Scale = frontWall.transform.localScale;
                float scaleFactor = (translate/v3Scale.x);
                frontWall.transform.localScale = new Vector3(v3Scale.x*scaleFactor, v3Scale.y, v3Scale.z);
            }
            v3Pos.z = getTarget.transform.localPosition.z;
            v3Pos.y = getTarget.transform.localPosition.y;
            getTarget.transform.localPosition = v3Pos;
            getTarget.transform.GetChild(0).gameObject.transform.position = new Vector3(-v3Pos.x, v3Pos.y, v3Pos.z);
        }

sentences:
Unreal Engine 4: How to make blueprints with FBX chunks of DestructibleMesh? Into my project I imported a .FBX file that contains several small pieces. It's a helicopter rotor with about 220 parts. I now want to write blueprints with these pieces but not only with the whole thing.
I already created a DestructibleMesh out of the initial StaticMesh and imported the FBX chunks, so the detail pieces are known to Unreal and I can explode them properly.

During FBX import I also found the option to NOT group the parts into the root object but make a StaticMesh out of EVERY part. Then of course blueprints can be done with all rotor parts but the relative position of the parts to each other is not given anymore and I would have to reorder them from scratch - which is VERY much work in this case.

Does someone have a good solution for that? With the spare parts of the rotor, some gasification tasks should be made. For example exchanging two parts or "repair" something.

Thanks in advance!

sentences:
OnCollisionEnter is called over and over again Currently I'm trying to let the player place a GameObject in the world. You can imagine this like a RTS game where you can place a building you have just build.
My problem now is, in order to avoid that the new GameObject intersects with another I check for collisions. For this my GameObjects have a BoxCollider (MeshCollider did not work) and a non kinematic RigidBody.
The first tests looked promising but now I'm facing a problem I can't quite explain: Sometimes, but not always OnCollisionEnter and OnCollisionExit are called over and over again, even when both objects are not moving. They overlap and stay that way. I had guessed that they always only get called once.
My Unity version is 5.3.0f4.

Further information: Each of my GameObjects have a guid so I can identify. They get generated when the GameOject is created.
The debug output in OnCollisionEnter and Exit look like this:

  OnCollisionEnter from 593b209f-cc63-4d31-9911-34c5f69ac224
  Collided with: 77e05881-2adb-459d-a134-8205cf4e3327
  OnCollisionEnter from 77e05881-2adb-459d-a134-8205cf4e3327!
  Collided with: 593b209f-cc63-4d31-9911-34c5f69ac224
  OnCollisionExit from 593b209f-cc63-4d31-9911-34c5f69ac224!
  OnCollisionExit from 77e05881-2adb-459d-a134-8205cf4e3327!

And then the same output again.

I'm happy for any hints and help. :)

sentences:
Refractive glass shader I have an infinite hexagonal floor, generated by tessellating a point grid in a tessellation shader pair:

Note that this is a flat wireframe - the "shadows" are a lighting trick:

Now, I'd like to make this appear to be thick, refractive glass, but am unsure how to proceed.

The first thing that came to mind is to

set a uniform containing the requested "thickness" of the blocks
When calculating lighting, use Snell's law to calculate the optical path length a ray would take through the hex block, if it were actually as thick as the "thickness" uniform says, and sum the alpha over that length. That would give the transparency, but doesn't handle things like internal reflection / TIR, etc.

I haven't tried that yet, so I'm not sure what the visual result would be.

Ultimately, for this particular level, I'm trying to get that glass, hexagonal floor look used in Tron: Legacy during the disc battle. (See this image for an example.)

Suggestions?

sentences:
How do I find two points at an angle on opposite sides of a circle? With reference to my previous question:

I'm using micklh's answer, which works perfectly. However, it calculates the gradient based on two points, a starting point and an ending point. I want to change that such that I can give it a center point, an angle in degrees, and a length.

If you look at the picture from the other question:

You can sort of discern where the center point is, the x,y of starting/ending locations become the dots based on the length of the gradient.

I assume I would have to:

Take the center location
Apply the angle + length
Gives me my ending x,y
Take the center location
Calculate the reverse angle
Apply the reverse angle + length
Gives me my starting x,y
Plug these starting/ending positions to the answer from the other question.

Am I correct? How would I do those steps?

sentences:
Can you suggest ways to store and track lots of objects in a turn based strategy game? I know just enough about programming to be dangerous, so please be gentle.  I've created and released few simple apps for android and do some powershell scripting at work, but that's about the extent of my programming experience.  I'll be using c# and XNA if that makes a difference.

If I need to keep track of ten thousand to several hundred thousand of the same object with a handful of variables each, what's a good way to handle that in a turn based strategy game?  The game will need to loop through each object on each turn to check a few things.

sentences:
LibGDX - Shader not being applied I've recently encountered a strange problem with my program and I can't seem to fix it. When I try to apply a shader to my SpriteBatch it doesn't change. I've debugged this problem like so:

if (test) {
    System.out.println("Batch shader: " + stage.getBatch().getShader());
    System.out.println("Default shader: " + Assets.getDefaultShader());
    System.out.println("Default batch: " + Assets.SPRITE_BATCH);
    System.out.println("Stage batch: " + stage.getBatch());
}

stage.getBatch().setShader(null);
if (test)
    System.out.println("Batch shader: " + stage.getBatch().getShader()); //Should print null
stage.act();
if (test)
    System.out.println("Batch shader: " + stage.getBatch().getShader());
stage.draw();
if (test)
    System.out.println("Batch shader: " + stage.getBatch().getShader());
test = false;

All of those shaders print the exact same thing, and the batches are also the same (the batches are supposed to be the same). Any ideas why?

sentences: How can I change the splash screen for a standalone game in Unity3D? I want to change the normal Unity splash screen to be customized for my game and every time I change the splash image in the player setting it does not appear. So how can I do that please?

sentences:
How to differentiate landing on top of an object from falling down the side? I am looking for a conceptual solution to my problem. It's a simple platformer-alike game where player can move horizontally during free-fall.

Consider those two cases:

In the first case, from game experience point of view, the player should land on top of the box; and in the other case he hit the left edge, hence the player should fall down.

However, from my code point of view ("real behaviour"), both those collision detection cases are identical. I am not sure how to separate them.

In both cases the vertical velocity is positive (falling down) and the user is moving with some fixed positive horizontal velocity. (moving right)

From a collision-standpoint the two cases are identical, I think. How can I tell whether I should put the player on top of it or let him fall?

sentences:
Lasers in 3D space game I am creating this little 3d space shooter and am somewhat unsure on how to implement the laser beams.

I'm thinking about something along Star Wars and the like where mostly you shoot rather short laser beams but very many of those.

Should I create a "tube" for each of the beams, render them via instancing and give them a better look just with the shader?

How would you go on about this? I was rather perplexed that there was no good tutorial on this matter out there.

sentences:
In Unity, Image to show icon works on one scene but not the other I am trying to show an icon on the UI when the player is looking at an enemy. The raycasting code, etc all works, but on one scene, the icon shows successfully, the other, it doesn't. I have tried copying, recreating, using different Sprites, none of it works.

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

public class CursorAffordance : MonoBehaviour
{
    [SerializeField] private Sprite _combatAffordance;

    private CameraRaycaster _raycaster;

    private Image _image;
    // Use this for initialization
    void Start ()
    {
        _raycaster = FindObjectOfType<CameraRaycaster>();
        _image = FindObjectOfType<Image>();
    }

    // Update is called once per frame
    void LateUpdate () {
        if (Input.GetMouseButton(0))
        {
            print(_raycaster.layerHit);
        }

        switch (_raycaster.layerHit)
        {
            case Layer.Enemy:
                _image.sprite = _combatAffordance;
                _image.enabled = true;
                break;
            default:
                _image.sprite = null;
                _image.enabled = false;
                break;

        }
    }
}

The only thing i can find from debugging is _combatAffordance is somehow null the second run through , and stays null from then on, although in inspetor it still shows my Target sprite.

sentences:
Nuget in Unity with Mac OS I have moved over to Mac for Unity development, and am aware you can still use Windows .dll files in your project. I use NuGet as a secure method of getting specific dlls, and have usually done this on Windows by manually downloading the .nukpg and extracting the .dlls using WinRAR, then putting the dlls in Unity. So far, I have thought of two ways to do this on Mac:

1.) Doing the same thing, but with a WinRAR alternative that can open .nukpg

2.) Using Visual Studio for Mac that has a NuGet interface built in with Unity

Has anyone done this, or found a solution for getting package from NuGet in Unity for Mac?

sentences:
What is the Shannon rule/law when talking about game physics? I've been reading some articles on game physics and came across subjects such as fixed timestep (article). Some of the articles I read mention the "Shannon rule" or "Shannon law" in relation to the length of the timestep. Example quote:

  Your timestep should be at least 1 / 120 seconds or smaller because of the Shannon rule [...]

Here's an answer here on Gamedev that mentions it. Some quick google searches for "Shannon's law" doesn't seem to yield much result except for this wikipedia article but I'm not sure if that's what is being talked about here.

So what is the Shannon rule / Shannon law?

sentences:
2D procedural veins/cumps of weighted ores/rocks I'm evaluating methods for generating "clumps" or "veins" of rocks in a 2D top-down procedural game. Obviously the most common suggestion is to use various types of noise, but I feel like noise (alone) won't achieve what I'm after.

I've used a combination of voronoi and perlin noise because it's easier to generate "regions" of different noise. I can more easily turn these areas into "veins" of rocks or something than I could be using a "heightmap" alone - heightmaps tend to be more swirly/cloud-like.

With a high threshold and some rounding, I can turn this into a mask that works well for veins:

Changing the spacing and scale is as simple as toying with the math/threshold.

The difficulty lies with choosing which "rock" (or "ore") will fill each vein. Primarily, this is thanks to the fact that my rocks are weighted. Veins of rare rocks should not be common.

I currently map the original voronoi cell value to a specific rock, which  forces each vein to be a single type, but can't be weighted. As you can see in picture #1, there's a fairly even distribution of each shaded area.

So either, I need a new way to choose a weighted random rock type for each vein, or I need a new way to place veins.

Minecraft is a good well-known example of what I need, except I work in 2D:

Regularly distributed ore veins
Veins of common ores are found more often and are typically larger veins
Veins of rare ores are harder to find, and are smaller in size

Noise alone just can't seem to produce these values. What else can I try?

sentences:
How to design a character damage system with ECS architecture? I am developing an game with ECS architecture and trying to design a character damage system.
Does the following design fits into ECS conception and will it be extendable in future?

I have an Actor component with health percent attribute and ActorsDamage system.

I also have an inventory system, so actors can use some food to increase their health.

When actors use inventory items, their Lua handlers executes and generates ActorHit event.

ActorDamage system receives this event and increases or decreases the actor's health.

Other game systems link actors' AI system or actors' keyboard control systems can also trigger hit events.

So, is this an appropriate design conception, or is there something I need to correct or improve?

sentences:
How can I manage large numbers of objects in a physics engine? MY friend and I are programming a game and I decided to give the physics engine a try. I was able to get a class working where it would calculate out the total force on a model and apply the correct acceleration, velocity, and position during each time step.

My question is how do I implement this over many objects when the game starts to get big. Is there just one class managing all the physics calculations for each object or do you attach the physics engine class to each object in the game so that they update and manage their own physics?

I've looked through some code and I usually see people putting the velocity, acceleration, and position calculations right on the object itself. But somehow I think I'm getting the wrong interpretation of this and I think on a large scale, this would be very inefficient.

We don't want to use a pre-built physics engine because we want to learn about how this all works.

sentences:
LibGDX Button and Table Layout I want to change the position of the Buttons inside a table, I tried setting their X and Y, or get their position when adding the Buttons on the Table, but it didn't work. It always aligns the button on the center.

Code:

    TextureAtlas ta = new TextureAtlas("Comecar.txt");
    final TextureAtlas.AtlasRegion as = ta.findRegion("comeca");
    final TextureAtlas.AtlasRegion as2 = ta.findRegion("comecaversao2");
    myTexRegionDrawable2 = new TextureRegionDrawable(as2);
    myTexRegionDrawable = new TextureRegionDrawable(as);
    myTexRegionDrawable.setMinHeight(300);
    myTexRegionDrawable.setMinWidth(260);
    myTexRegionDrawable2.setMinHeight(300);
    myTexRegionDrawable2.setMinWidth(260);
    b = new ImageButton(myTexRegionDrawable);
    op = new ImageButton(myTexRegionDrawable2);
    op.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
        }
    });
    b.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            gdxGame.setScreen(new Janela2(gdxGame));
        }
    });
    t = new Table();
    t.add(b);//I tried setting the position here
    t.add(op);
    t.setFillParent(true);
    stage.addActor(t);
    Gdx.input.setInputProcessor(stage);
}

sentences:
Put a coroutine on potentially infinite loop I have several coroutines always running.

I want to put these coroutines on hold as I set the game to pause mode.

Consider the content of these coroutines as follows

while (timeleft > 0)
        {
            if (pause)
            {
                continue;
            }
            ...
            timeleft -= Time.FixedDeltaTime;
            yield return null;
        }

I thought that would be okay to insert the if(pause) clause to have the coroutines to wait while pause is up.

What, insted happens is that (I guess) these infinite loops make unity not responding so that I have to kill the process.

Can I be right in thinking that the system does not like coroutines to be in a potential infinite loop? Or that is just okay and I have to heavily debug somewhere else?

sentences:
IOS very simple 2d engine/api rendering showdown So after taking some time running through a course, I believe I have enough experience with referring back to the course how to make the game I wish to all apart from one thing. How to draw the game on screen, I know how the game would work behind the screen, but don't know how to draw it. I'm looking for an experienced, informed answer based upon certain factors.

To provide some context, the game in question's interface would be very simple:

Grid of lines
Control each cell's content: (text and colour)
Pan and zoom

The game at the minute is based upon an excel spreadsheet as shown to show how simple it is:

My aim to keep this question open to others is to create a pros and cons of each.

I've narrowed down possibilities to this list. These are taken from the apple developer page under the section 'Graphics and Games':

Core Animation
Core Graphics
GLKit
Metal
OpenGL ES
cocoas 2d?
Other Noteworthy

I'm asking for an informed opinion as to which I should choose. This is narrowed down from research, however I assume I will have missed things that may make this task much easier. My problem thus far is that most games assumed I needed sprites but in something this simple I'm assuming I don't.

If it makes any difference, my current knowledge is only swift, high school math and hopeful abundance of learning resources. I've been stuck with this problem for a long time and I would be overjoyed if I could get some experienced advice. Thanks! :)

sentences:
Java - how to reduce iteration loops for enemies I have many places in my code where I'm iterating through the enemies array and it seems to me it could be optimised somehow, but I can't see how it can be done. For example these two loop checks:
private void arc1() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 32 && !e.seen) {
            arc1.setActive(true);
            return;
        }
    arc1.setActive(false);
}

private void arc2() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 24) {
            arc2.setActive(true);
            return;
        }
    arc2.setActive(false);
}

They're both just checking the distance from the player with one having an extra condition and a different distance. Is there a way to combine them into one? I tried doing it but it didn't work correctly.
Will it actually give any benefit performance wise to combine into one in any case? It does look like duplicate code but not sure if there would actually be any performance benefit.

sentences:
How to add a feel of depth? I have several mountain models drawing in the background.
See actual screenshot here:

At the very back, you see those grey mountains. Although they are so much in background, it still doesn't seem "in the background".

How can I add a feel of depth to those mountains? I would like see them as far far away.

This is how it looks now, thanks to DarenW

sentences:
State machine interpreters I wrote my own state machine tool in C and at this point I'm faced with two choices for specifying state machines.

Crafting a little language and writing a interpreter.
Writing a compiler for that language.

I know the advantages/disadvantages of each. I'd like to know what choices game programmers have made for their games. If you've used a state machine in your game in any form, I'd be interested in knowing how you did it.

sentences:
Is it feasible for a Server to send nothing more than a tile-based area to a Client? To start, I have a good amount of background in networking (hardware, routers, ex.) but very little knowledge past the basics of network programming. This may seem like a stupid question, but I want to know what I am getting myself into while fathoming the implementation of multiplayer in my game.

I am creating a tile-based world, which is generated through a simple 2D Array. Let's say something like World[100][100], for simplicity's sake.

Currently, the render method only renders the tiles based on the resolution of the window, plus one tile (for smooth rendering during movement.) No matter how large the world is, (10x10, 1million x 1million) the rendering is flawless in performance.

The gameplay needs nothing more than to know what is in the currently visible (rendered on screen +1) and at the most possibly SOME information of tiles in an area around the player.

So anything more sent by the Server wouldn't be the full tile information.
Ex. Items laying on the ground, ground type, trees, etc. would not be important in the area outside the player's view, but would only be what the Client/Player needs to know about in those tiles. (Ex. Ultima Online's 'incoming names' where players could know a Character [player or monster] was just beyond the tiles in their rendered view.)

I do not know very much about networking, so perhaps as I learn this might answer my question. However, I am curious if this is a feasible solution or if the idea is simply laughable.

The information being sent would be about a 10x15 area of tiles, and each tile holds information about what is on the tile.
More efficiently, everything would be an Object, where the tile holds all the Objects on the tile. Ex. Tile[4][4] holds Sword#23452, Rock2, Tree5, Player3, Monster4.

Empty tiles would send nothing more than terrain type [Grass, Sand, Water] if not already loaded during Initialization/Load. Some tiles would have a handful of objects [Tree2, Sword#924, Gold, Corpse, Rock3].

So I cannot imagine that a tile would have very much information to send to the Client from the Server, since the Client mainly only needs to know the Texture that needs to be loaded and Position to place it on screen. Position being only two integers and Texture being one integer for a list of files to tell the client to render.

At the craziest, the Server would have to send 150 tiles with information of only a handful of Objects OnLOAD, and from then on update only changes to tiles (if any) and any new tiles (10 to 15 everytime a player moves in a direction) and the direction of movement for characters on screen (so the client can simulate smooth movement between tiles).

I assume I am correct in thinking this is an incredibly low amount of information being sent over the internet or between peers, so it should have little problems with performance even over laggy connections? Or am I so ignorant of networking that my mind will be blown when I finally get around to opening up my book on multiplayer networking?

If it is a very low amount of information being sent between Client/Server, would it make more sense to simply load the entire World on Initialization? Or 'Map' if the World is excessively large. And then after LOAD, send only tiles which are updated?

I am still pondering how I should specifically deal with data. The book I am using as reference wants me to have a Linked List, where I add and remove objects, so everything is a bool. "Is there a Character? Is there a Tree?"

I was thinking of a different approach, such as a container which holds objects, and Server logic that sends only what is required to tell the Client what to render. Possibly with objects that hold networking information within itself, which is sent out when called for by the Server.

sentences:
Change texture settings for each object So I'm kinda new to Unity, but I've used it a couple of times before. Here's my issue:

I have two cubes with a random texture applied to them (drag'n'dropped something from the Asset Store). These cubes have different sizes, where one is a square and one is a rectangle. I want to set the tiling size to be different on them (because they are obviously stretched on the rectangle), but when I click on one and change it, the settings changes for both of them.

This is how it looks right now: http://i.imgur.com/JtubBle.png

Is it possible to make these settings unique for each object somehow?

sentences:
Whats the most efficient method for controlling entities? I'm creating a tower defense game and I'm having logistical issues trying to figure out how to best have all of the enitites do their apporiate task.

I have considered just constantly looping through a list of all the game entities calling a onAction() method, but I'm not sure if that is effective.

I have also considered having each entity be a thread, but when I am dealing with hundreds of entities, some of which don't need thread time, I'm back to square one.

Can I get any suggestions on a solid approach? Am I on the correct track with my first idea?

Thanks for any help ~Aedon

sentences: Can a material be created from a gameobject in Unity? I am trying to manually create snowflakes in unity, after I created a snowflake in the unity scene, is it possible to create a material out of it?

sentences:
How can I avoid coupling between units and their environment? Currently in the process of making a game like Dwarf Fortress, so without graphics. I'm mostly thinking about how I want to implement everything. While writing code I keep stumbling on general game implementation problems that are really annoying me. Assume this:
We have a Map class which stores Chunk classes which stores Tile classes which stores Players and Enemys currently on this tile.
class Map {
    public:
        std::vector<std::vector<Chunk>> chunks;
};

class Chunk {
    public:
        std::vector<std::vector<Tile>> tiles;
        std::vector<Player*> player_need_update;
        std::vector<Enemy*> needs_update;
};

class Tile {
    public:
        std::vector<Player*> players;
        std::vector<Enemy*> enemies;
};

Now let's say I want to move() a player to a different Tile. For this I created a needs_update vector storing entities that need to be updated on the game Map. Every game tick we loop all chunks and loop all entities needing an update.
I think (thought) this is a logical way of doing this because we can have a tile that is independent of a chunk that is independent of a map. Same for entities. So let's say we want to move an Entity:
void Entity::move(uint16_t move_x, uint16_t move_y) {
    x += move_x;
    y += move_y;

    changed() // Notify chunk that something changed about us
}

This is already where it is going wrong. To be able to notify the chunk we have moved, we need to know ourselves in which chunk we are Chunk *in_chunk; in class Entity. And this breaks the structure I wanted to achieve (independence across classes).
Another example, suppose we want to attack an Entity on a different Tile. We would need to know there is an entity in the first place, but we would also need to know things about the enemy to then decide whether to attack it or not.
Player::attack(Enemy &enemy /* ?? */) {
    // Attack
}

I think it is wrong to move a player by calling a function in Map:
void Map::movePlayer(Player &player) {
    // Do stuff to move player
}

So, how do you implement basic game structures like this, keeping things logically structured but while still being able to ie. move a player across the map?

sentences:
How to smooth mask texture edges correctly regardless it's size I have a texture intended as a mask. The texture type is GL_R32F (32 bit float) and the data inside is a signed distance field (= value of each texel is distance to nearest mask edge). For test purposes, the mask is just a circle part and is directly drawn in greyscale. The fragment shader handling this texture has following code:

void main() {
 float mask = texture( tex, fragTexCoord).r;
   vec4 res = vec4(1.0,1.0,1.0, 1.0);

   if(mask > 0.0) //test failed, outside of mask
      res = vec4(0.0,0.0,0.0, 0.0);
   //smoothing if there is an edge nearby
   //0 or 1 otherwise
   res.w = smoothstep(0.0, 1.0, -1.0 * mask);
   finalColor = res;
}

however if the mask is drawn too big, its edges appear blurry, because smoothstep afflicts too many fragments. This could be solved by multiplying the mask by some value, however it would stop smoothing if is the mask was drawn too small.
For illustration, on left is the mask(100px), in the middle is its zoomed edge and on right there is zoomed edge of mask if drawn big(600px). How to smooth the edge to appear correct regardless of the size? (=zoomed edges should always look the same, like the middle image)

sentences:
Setting object O2 to have the same geometric relation to P2 as O1 has to P1 I'm trying to place Object O2 with the same relation to P2 that O1 has to P1, like shown in the picture below.

This is a problem that I'm facing trying to implement portals in Unreal Engine 4, where:

O1 is the player camera
P1 is a portal
O2 is a second camera, used to render the scene from the perspective of the other portal
P2 is the portal linked to P1

// Get the player position in relation to this portal and project it in relation to the linked portal
FMatrix NewCameraWorldMatrix = LinkedPortal->GetTransform().ToMatrixWithScale() * GetTransform().ToMatrixWithScale().Inverse() * PlayerCamera->GetComponentTransform().ToMatrixWithScale();
FTransform NewCameraWorldTransform = FTransform(NewCameraWorldMatrix);
PortalCameraAnchor->SetWorldLocationAndRotation(NewCameraWorldTransform.GetTranslation(), NewCameraWorldTransform.GetRotation());

However, the above code is not solving the problem I presented and I can't figure out why.
Any ideas on what may be the issue?
Note: I've wrapped the PortalCamera with an Anchor since the PortalCamera must have a specific relative orientation at all times and using SetWorldLocationAndRotation directly on it would mess up its rotation.
Note: I have these logs (one per portal) which might be useful:
LogTemp: Warning: ---------------------------------------------------------------------------------------
LogTemp: Warning: GetTransform().ToMatrixWithScale().Inverse(): [-1 2.38419e-07 0 -0] [-2.38419e-07 -1 0 0] [0 -0 1 -0] [-1410 1570 -420 1]
LogTemp: Warning: LinkedPortal->GetTransform().ToMatrixWithScale(): [1 0 0 0] [0 1 0 0] [0 0 1 0] [820 -1410 420.238 1]
LogTemp: Warning: PlayerCamera->GetComponentTransform().ToMatrixWithScale(): [0.572059 -0.791792 0.214041 0] [0.810578 0.585631 0 0] [-0.125349 0.173497 0.976825 0] [-372.749 -65.9088 332.374 1]
LogTemp: Warning: NewCameraWorldMatrix: [-0.572059 0.791793 -0.214042 0] [-0.810578 -0.585631 -5.10315e-08 0] [-0.125349 0.173497 0.976825 0] [767.052 3445.01 -144.706 1]
LogTemp: Warning: NewCameraWorldTransform.GetTranslation(): X=767.052 Y=3445.011 Z=-144.706
LogTemp: Warning: NewCameraWorldTransform.GetRotation(): X=-0.095848404 Y=0.048997864 Z=0.885227978 W=0.452530354
LogTemp: Warning: ---------------------------------------------------------------------------------------
LogTemp: Warning: GetTransform().ToMatrixWithScale().Inverse(): [1 -0 0 -0] [-0 1 -0 0] [0 -0 1 -0] [-820 1410 -420.238 1]
LogTemp: Warning: LinkedPortal->GetTransform().ToMatrixWithScale(): [-1 -2.38419e-07 0 0] [2.38419e-07 -1 0 0] [0 0 1 0] [-1410 1570 420 1]
LogTemp: Warning: PlayerCamera->GetComponentTransform().ToMatrixWithScale(): [0.572059 -0.791792 0.214041 0] [0.810578 0.585631 0 0] [-0.125349 0.173497 0.976825 0] [-372.749 -65.9088 332.374 1]
LogTemp: Warning: NewCameraWorldMatrix: [-0.572059 0.791792 -0.214041 0] [-0.810577 -0.585631 5.10314e-08 0] [-0.125349 0.173497 0.976825 0] [767.11 3444.93 -145.171 1]
LogTemp: Warning: NewCameraWorldTransform.GetTranslation(): X=767.110 Y=3444.927 Z=-145.171
LogTemp: Warning: NewCameraWorldTransform.GetRotation(): X=-0.095848396 Y=0.048997886 Z=0.885228097 W=0.452530175
LogTemp: Warning: ---------------------------------------------------------------------------------------

sentences:
Axis Aligned Spatial Division : Divide space into random rectangles? I need a method to divide 3d space into random axis aligned box shapes. For now
I am currently dividing the 2d space for testing purposes. The most immediate approach I came up with was to define a rectangle of size (1, 1) and then recursively split all existing rectangles to two uneven rectangles alternating between axis X and Y.

The problem here is obvious. This approach results in long stretching lines (marked in red)

What I would like is something more organic looking (I included an example)

See, no long straight lines from top to bottom or left to right.

The only constraint is that I may wish to limit the minimal size of the rectangle without affecting the granularity of the sizes. i.e. if the smallest rect is 1 square centimeters than the seconds smallest room should not be 2 square units.

So ideally the algorithm should meet all three following constraints:

Rectangles are not infinitesimally small.
Rect sizes aren't discrete multiplication of the smallest rect size. i.e. if the smallest rect is 3 square unit than larger rects are not constrained to be 6, 9, 12 and so forth square units and instead could be 3.2 or 4.7 for that matter).
The algorithm runs in polynomial time (needs to compute fast).

sentences:
FBX animation works in 3DSMax but not with Assimp I have an FBX file that represent a plane with an animation of the gear opening. In my editor 3DSMax or in the Unity editor, the file and animation seem good, but when I use Open 3D Model(the official viewer of Assimp) or when I call the FBX file simply in an application, to see what the file will look like with the use of Assimp, I got some issues.

The object seems normal at the beginning, but when I try to launch the animation, all my animated elements are going crazy.

Here's what it looks like :

Here's my FBX FILE

Do you have experience something similar ? Does it come from my file or a parameter in Assimp ?

I am beginning to think that there is a problem with how Assimp handles pivot points, looks like objects are rotating using a different pivot point in Unity/open3mod.

sentences:
Why when using Lerp and StartCoroutine to Lerp between -3 and 3 it's not working? private bool alreadyFading = false;

Then
private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Teleporting Object")
        {

            if (!alreadyFading) StartCoroutine(Teleport(-3, 3, 5f));
        }
    }

And
IEnumerator Teleport(float from, float to, float duration)
    {
        alreadyFading = true;

        var timePassed = 0f;
        while (timePassed < duration)
        {
            var factor = timePassed / duration;
            var value = Mathf.Lerp(from, to, factor);

            material.SetFloat("_DissolveAmount", value);

            yield return null;
        }

        material.SetFloat("_DissolveAmount", to);

        alreadyFading = false;
    }

Using a break point it's getting to the Teleport function but it's not changing the values from -3 to 3.
It does nothing to the shader to the property _DissolveAmount.
I want it to change the value from -3 to 3 with duration once not ping pong. but it's not just it's just don't do anything.

sentences:
All GameObjects and Models are Transparent Whenever I create a new game object its completely transparent, with the Mesh Renderer selected.

This is really frustrating as I am new to Unity and Google offers no solutions.

sentences: Getting correct direction of the Car I am building a car racing game using the coordinate system in which I have enemies's cars and the player cars. I want to ask that what is the best way to find the the direction of enemies's cars so that they would facing the player's car and move towards the player's car.

sentences: LibGDX: Easy way to draw partial sprites I am surely overlooking something, but is there an easy to draw for example only half a sprite in LibGDX? I originally thought I could do this with setBounds() but this distorts the sprite.

sentences:
Why do many games have “timeouts”? I noticed that many social games have the concept of "timeouts". In farm games etc. it obviously makes sense (stuff grows, etc.). But I also noticed that angry birds introduced this as well. Individual angry bird games are pretty much stateless, so it doesn't seem to make a lot of sense at first glance (and some users are upset because of this).

What is the purpose of this? Does it bring more money somehow? Does it help retaining the users? Is this a new concept? Does it have any other applications, particularly in non-game realms?

sentences:
Understanding pixel art in Unity 2d I am struggling to understand the basics behind pixel art in Unity.

I understand what a unit is, and that if I draw my sprite with 16x16 pixels, I should set PPU to 16.

Take stardew valley for example, in the image below you can clearly see that the player is not square. The creator of the game said he made everything in 16x16, but then how is there so much detail in the characters? Surely you do not patch several 16x16 squares together to make a character (as you would with a tilemap)?

What is the "common" way of dealing with things that are not square, like the characters in the image. Do you just make  16x32 sprite and set PPU to 16? Wont that make it look a bit weird next to 16x16 sprites?
Do you generally pick one size (i.e 16, 32, 64) And then stick to that for everything in the game?

The visual Issue I've seen is this, where a 32x32 sprite looks very out of place (too sharp) next to a 16x16 sprite.

So I am wondering, how do you mix sizes wihout getting this effect where one image looks much sharper than the other. If I for example wanted a character to be 16x32, or any non-square value, when my tiles are 16x16

sentences:
How to convert an octree to a 3D array I have an octree that I'm planning to use for 3D pathfinding. My plan was to break down the world such that all the leaf nodes of the tree would be of equal dimensions that would create a nice grid and then adapt A* by adding an extra dimension and just run searches on the grid. The image below shows a sample of my leaf nodes to demonstrate what I'm talking about (ignore the spheres, they are for something else).

What I'm not sure about is how do I perform A* on a tree structure. My thought was to convert the tree structure to a 3D array, which would make it really easy to perform A* on, but I'm not sure how I would go about this. I can recursively work my way down the tree and tell which nodes are the leaf nodes, but I don't know how I could necessarily work my way down in an ordered fashion such that I could index nodes into an array properly. How would I go about this? Is it even the right approach; or it there a better approach to performing A* on the tree?

Note: I am aware the space might not actually be open enough to justify full 3D pathfinding, but this is intended to be a demonstration/test of the concept, so I wanted to keep things relatively simple.

sentences:
Unity C# - Change color, or material of specific line segments on Line Renderer We're making a game that plays with a LineRenderer, and we want to give it a different visual feedback relative to the side of the screen that it's on.

We want to change the feedback of the specific line segments that are on the other side (when they past the middle point).

The API lets you map the segments positions, but isn't there a way that you can change the material/color of that specific segment? I just see that you can do it, but only for the whole Line Renderer, not segment-by-segment.

sentences:
How to make score counter independent of framerate I have a score counter, but I've noticed that the lower the framerate is, the slower it counts. How can I make it so it ignores the framerate?

using System.Collections;
using UnityEngine;
using UnityEngine.UI;

public class Score : MonoBehaviour {
    private Text scoreText;
    private static int score;
    private static int finalScore;
    private static bool count;
    public static int scoreMultiplier;

    private void Start() {
        scoreText = GetComponent<Text>();
        count = false;
        scoreMultiplier = 1;
    }

    public static void StartCounting() {
        count = true;
    }

    public static void StopCounting() {
        count = false;
    }

    public static void Reset() {
        count = false;
        score = 0;
    }

    public static IEnumerator MultiplyBy(int scoreMultiplier) {
        Score.scoreMultiplier = scoreMultiplier;
        yield return new WaitForSeconds(6f);
        Score.scoreMultiplier = 1;
    }

    private void Update() {
        if (count) {
            score += scoreMultiplier;
        }

        // Slice the score so the number doesn't get too big
        finalScore = score / 4;

        scoreText.text = finalScore.ToString("00000");
    }
}

Edit: Fixed by adding Time.deltaTime and putting it in FixedUpdate instead of Update

private void FixedUpdate() {
    if (count) {
        score += scorePerSecond * Time.deltaTime * scoreMultiplier;
    }

    finalScore = Convert.ToInt32(score);
    scoreText.text = finalScore.ToString("000000");
}

sentences:
Which image effect is this? This is a screenshot from RE7.
I have once seen the same image effect in Unity, but I don't remember the name:

I'm not talking about AA or DOF here, I mean this grainy / greenish thing, I don't know how to describe it...
At first I thought the name was something like "Anisotrophic filtering", but that didn't bring up anything that looked like it.
Can anybody tell me the name of the effect that I see here?
Edit:
It can be seen in the start screen of this video, too:
https://www.youtube.com/embed/aaN3MNb9ij0?feature=oembed
Both screenshots look pretty similar to me, so I guess it's the same effect?
Edit 2:
The pixels seem to shift into red / blue the closer they get to the edge of the screens.
I have drawn red arrows to region where this effect is very visible to me.
These pixels appear as "shifted" to me.
I think this effect is more visible at the edge of the screen.

Thank you.

sentences:
Constrain parent node transform to child bounds If I have some node rendering tree set up, where a node basically has a draw method to render things, and a transform, represented as a 3x3 matrix, with scale and translation.

Now, I would like to constrain the scale and translation of that node (constrain the transform basically) to the bounds of the child. So if the child is a 300x400 image, I want the root to only scale large enough to see the whole image, not more. So does the translation, that it does not go beyond the image bounds. How can I achieve that? Which sorcery of mathematics must I read about to learn this? Affine transforms or what?

sentences:
A Finite state machine where some states shouldn't be transitioned to even if initial conditions satisfy I've built a Finite State Machine for my player. Currently I have only one, locomotion, but I plan on adding more state machines. At the moment state relationship looks something like this:

The blue colored states are ability states. I don't want those states to trigger even if the condition input.JumpActivated is satisfied.
As there's only two such states at the moment, having the condition be abilityManager.isActive(abilityId) && input.JumpActivated instead of just input.JumpActivated is fine, but it seems... manual. As the game grows and more abilities are added, there is bound to be a case where I'll forget to add the condition and then the ability would be active even if it's not supposed to be. I would like to disallow transitioning to those states, but so far none of the solutions I've come up with have looked elegant to me.
This is what I've tried:

Instead of transitions having one condition, they allow multiple conditions, and base state sets a condition that if the next state is of AbilityState type that it must be active.
Implemented state enabling/disabling and had AbilityManager - a component external to the FSM, enable/disable states. Disabled states are not transitioned to.
Implemented state interceptors, which can be subscribed to and if any of them return true the state is not transitioned to

All of those solutions work, but something feels off. I think that all these solutions hide that the states have special logic tied to them in some obscure class/method away from the actual class they belong to.
How do you, experienced game developers, handle such cases?
EDIT: For more context this is a small slice of how my FSM functions now. This is how a typical state might look:
public abstract class OnGroundState : State<IMotor>
{

    protected override void OnInit()
    {
        base.OnInit();
        RegisterTransition(TransitionScope.UPDATE,
            TransitionType.Change(StateId.JUMP),
            ctx => ctx.Entity.Input.IsJumpJustActivated());

        RegisterTransition(TransitionScope.FIXED_UPDATE,
            TransitionType.Change(StateId.IN_AIR),
            MotorConditions.InAirDefaultCondition);
    }

    protected override void OnFixedUpdate()
    {
       // do some logic on fixed update call
    }

}

As you can see, states generally register transitions which are lambdas evaluated immediately (Update) or in fixed timestep (FixedUpdate), and then if the evaluation is true, state is changed to the next state. The problem with this is that while I can define a default predicate such as
ctx => ctx.NextState is AbilityState abilityState && Entity.AbilityManager.IsActive(abilityState.AbilityId)

and then apply it to whatever transition I am checking, like for example
RegisterTransition(TransitionScope.UPDATE,
            TransitionType.Change(StateId.JUMP),
            ctx => ctx.Entity.Input.IsJumpJustActivated() && AbilityCondition(ctx))

this feels prone to errors. I might forget adding the condition to some state transition and then I'll transition to that state even though I don't have that ability unlocked.

sentences:
2D Collision Resolution getting stuck on walls I've been writing this collision detection system using a tutorial from an article I read and I just cannot for the life of me get it to function 100% correctly. Here's the code for starters:

BoundingBox aBox;
aBox.Convert(a);
BoundingBox bBox;
bBox.Convert(b);

Vector2 aMin = aBox.GetTopLeft();
Vector2 aMax = aBox.GetBotRight();
Vector2 bMin = bBox.GetTopLeft();
Vector2 bMax = bBox.GetBotRight();

Vector2 minDistance;

float left = (bMin.x - aMax.x);
float right = (bMax.x - aMin.x);
float top = (bMin.y - aMax.y);
float bottom = (bMax.y - aMin.y);

// Check for intersection internally
if (left > 0 || right < 0) return;
if (top > 0 || bottom < 0) return;

// Find the minDistance
if (abs(left) < right)
    minDistance.x = left;
else
    minDistance.x = right;

if (abs(top) < bottom)
    minDistance.y = top;
else
    minDistance.y = bottom;

// Null axis with biggest value
if (abs(minDistance.x) < abs(minDistance.y))
    minDistance.y = 0;
else
    minDistance.x = 0;

The problem right now is that the character is fine walking and hugging the top of a block and the bottom of a block, but once he has to walk UP two blocks, he gets stuck in between them. Coincidentally, walking down works perfectly fine. Just wondering if anyone has a solution to this problem, it would be much appreciated!

Here's a gif to better display the problem:

sentences:
How can I export mudbox joints to .fbx? When I export my Mudbox mesh (level 1), with its skeleton selected, to a .fbx and import it into unity, I don't get the bones/joints/skeleton/whatever under my mesh in the hierarchy.

Am I missing something?

sentences:
Is Ruby's garbage collector still as big of a problem to game developement? I am beginner wanting to make a game, and chose to learn Ruby ,since it seems easier to read than most languages.

Reading up on Ruby, I find that Ruby could be used to make small-scale games, but it's garbage collector was a serious problem. The post I read had been closed, so the most recent post was from 2013. In contrast, Ruby 2.0 came out in 2013, and apparently the garbage collector got better. I was wondering if the garbage collector is still a major problem.

To be a little more specific, the game I want to make is going to be 2D, using pixel art. It's a small PvP game using LAN. I want to make 7 character classes, but I can start with less. This game is quite small, but there are a lot of things I want to add as I get more experience, such as a story.

Does the garbage collector still make game development a problem, in Ruby?

sentences:
SDL2 - Inconsistent FPS with VSYNC I'm working on a game using SDL2. Today I noticed the game has some jolty issues when not fullscreened so I made an extremely simplified program that simply moves a square from left to right to see if the result is the same.

I expected the squares movement to be very smooth but instead it's very jolty/laggy (when not fullscreened).

At first I thought it was to do with how I was calculating the time between each frame but after outputting the 'ftime' I can see the time each frame takes ranges from 13 to 30(ish) as opposed to a consistent 16/17.

Here's the code:

#include <iostream>
#include <SDL.h>

const int GAME_WIDTH = 1920;
const int GAME_HEIGHT = 1080;

//frame independent movement variables
double old_time = 0;
double current_time = 0;
double ftime = 0;

#undef main
int main(int argc, char** argv)
{
    SDL_Window* mainWindow;
    SDL_Renderer* mainRenderer;

    SDL_Init(SDL_INIT_EVERYTHING);

    mainWindow = SDL_CreateWindow("MiracleSquare", 50, 50, GAME_WIDTH, GAME_HEIGHT, 0);
    mainRenderer = SDL_CreateRenderer(mainWindow, -1, SDL_RENDERER_PRESENTVSYNC);

    SDL_Rect miracleRect; //creating the SDL square
    miracleRect.x = 0;
    miracleRect.y = 400;
    miracleRect.w = 100;
    miracleRect.h = 100;

    bool running = true;

    while (running)
    {
        old_time = current_time;
        current_time = SDL_GetTicks();
        ftime = current_time - old_time;

        std::cout << ftime << std::endl;

        SDL_Event e; //stops crashing on input
        if (SDL_PollEvent(&e))
        {
            switch (e.type)
            {
            case SDL_KEYDOWN:
                break;
            default:
                break;
            }
        }

        miracleRect.x += (ftime / 1000.0f) * 100.0f;
        if (miracleRect.x> 1920) miracleRect.x = 0;

        SDL_SetRenderDrawColor(mainRenderer, 0, 0, 0, 255);
        SDL_RenderClear(mainRenderer);
        SDL_SetRenderDrawColor(mainRenderer, 255, 255, 255, 255);
        SDL_RenderDrawRect(mainRenderer, &miracleRect);
        SDL_RenderPresent(mainRenderer);
    }

    return 0;
}

Am I doing something wrong? As far as I can tell this should produce a smooth movement.

Any help would be greatly appreciated!

Edit: Since posting this I've figured out it has something to do with my use of dual monitors. If, for example, I have a video playing on chrome on my secondary monitor, the lag issue is very prominent. I'm now looking into if this issue is avoidable, or if I'll just have to ignore it.

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

To note I am fairly new to pygame.

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

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

Thanks for your time!
Ryan

sentences:
What's the name of the rendering problem I describe here? I don't remember how is it called that rendering problem that you have when you get fast movements (a sprite moves fast for example from right to left) and you have half of the image in a position and half in another for a given frame (for example the top left of the sprite moves correctly but the bottom half of the same sprite is lagging back).

In particular I'm using SFML2 but this is kinda a Library-Agnostic question.

And what are the most common methods to fix it?

sentences:
How does one integrate Game Center leaderboards in Monogame? Do anyone know how to integrate a Game Center leaderboards for an iOS game using MonoGame framework?

I have searched high and low yet I haven't gotten any luck of finding articles or tutorials that talks about the topic of Game Centre leaderboard integration. A direct link to where I can learn how to do the implementation will be very much appreciated. Thank you!

sentences:
How to make a 2D sprite slowly vanish as it crosses a line — as if disappearing behind a wall? ...Except there is no wall. Only one of its edges.

Here is what I mean. Notice how the lines "sink" into the center square.

I've been trying to do something very similar, in Unity. My approach is to detect when the lines come into contact with the center square (hexagon, in my case), and first initiate an animation that decreases the width of the lines, precisely timed via math to last exactly as long as needed.

But there's a problem. The animation doesn't play. I've spent the last few hours debugging it, to no avail, and now have finally given up, because the problem is too complex to post here. Too many variables.

Are there any better methods of achieving this?

My own, even if it had worked, wouldn't have been perfect, because the width would've decreased on both sides (of the line running in the middle of the thick squares or hexagons that are to disappear), giving it a strange, swallowing effect, but I'd be satisfied, since it's just a practice project.

So, I'm giving up on this approach. What are easier ways to do this? (Preferably in Unity, but I'll take anything.)

Hasty edit: Keep in mind that my "lines" are not sprites but line renderers, but I'm looking for ways to work on either.

sentences:
Drawing to create game drafts Man, I'm really bad at drawing...
I feel myself really ashamed because I cannot draw even a little nice sword... :(

The problem is, on game development (I will be on the programming part, relax!) I will need to explain some game ideas to game artists, like "I need that city like this" or "that character needs to have that look and feel".

My idea is, I really need some BASIC skills on drawing some draft of what I'm thinking...

I'm bad in pen/paper drawing and photoshop/corel drawing, but I'm convicted to learn photoshop or corel to draft something...

Someone has passed that problem? What you recommend?

sentences:
LibGDX - Managing and starting new levels I have a Manic Miner style game where you need to collect all the items from a screen before you can advance to the next screen.

I have a screen class called "PlayScreen" wich starts out by loading a tiled map called "Level1.tmx", and contains the render and update loop.

public class PlayScreen implements Screen {
    ...
}

This screen is loaded by my main Game class, by calling SetScreen

setScreen(new PlayScreen(this));

So inside my PlayScreen, what is the correct way to restart the game but with a different level? I know I can pass through a new level number to get it to load a new tiled map, but this usually crashes.

Do I need to dispose of the screen and reload it again. I cannot find much information about this. Most LibGDX tutorials only cover a single screen or level, or have a menu screen in between. I just want to switch to the next level or room on demand, but cannot get it working.

Has anyone done this before - can you recommend a good way of doing this?

Regards

James

sentences:
Why my stencil mask doesn't work? I've a very sipmle Unity scene.

It has two objects in it, which is Sprites, and they both use sipmle black boxes as a textures.

Here's two shaders, one should act as a mask, and second as a object, that should be rendered only in pixels, specified by that mask.

Mask shader:

Shader "Unlit/StencilUnlitShader"
{
Properties
{
    _MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
    Tags { "RenderType"="Opaque"
    "Queue" = "Geometry" }

    Pass
    {
        //AlphaTest Greater 0.5 //Only render pixels whose alpha is greater than AlphaValue.
        Stencil{
        Ref 2
        Comp Never//Never - never pass the stencil test, Always - always pass the stencil test
        Pass Replace //write Ref value into the stencil buufer
        }

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
            float4 vertex : SV_POSITION;
        };

        sampler2D _MainTex;
        float4 _MainTex_ST;

        v2f vert (appdata v)
        {
            v2f o;
            o.vertex = UnityObjectToClipPos(v.vertex);
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);
            return o;
        }

        fixed4 frag (v2f i) : SV_Target
        {
            // sample the texture
            fixed4 col = tex2D(_MainTex, i.uv);
            //if (col.a < 0.9) discard; //discard a pixel if it's transparent and don't draw it into a buffer
            return col;
        }
        ENDCG
    }
}
}

Object shader:

Shader "Unlit/GreenUnlitShader"
{
    Properties
    {
        _MainTex("Texture", 2D) = "white" {}
    }
        SubShader
    {
        Tags{ "RenderType" = "Opaque"
              "Queue" = "Geometry+5" //to draw after stencil object
    }

        Pass
        {
        //AlphaTest Less 0.5
        Stencil{
        Ref 1
        Comp Less //Always, Less - if ref value is greater then current value in the stencil buffer
        Pass Keep
        }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"

    struct appdata
    {
        float4 vertex : POSITION;
        float2 uv : TEXCOORD0;
    };

    struct v2f
    {
        float2 uv : TEXCOORD0;
        float4 vertex : SV_POSITION;
    };

    sampler2D _MainTex;
    float4 _MainTex_ST;

    v2f vert(appdata v)
    {
        v2f o;
        o.vertex = UnityObjectToClipPos(v.vertex);
        o.uv = TRANSFORM_TEX(v.uv, _MainTex);
        return o;
    }

    fixed4 frag(v2f i) : SV_Target
    {
        fixed4 col = tex2D(_MainTex, i.uv);//fixed4(0,1,0.5,0.6);
        //if (col.a < 0.9) discard;
        return col;
    }
ENDCG
    }
    }
}

The problem is, this doesn't seem to work, and object doesn't seems to be rendered at all (why it should in the places where mask have it's pixels)

sentences:
Howdo I create differently sized texture atlases for different screen sizes? I am beginning game development and using texture atlases.
I've created textures based on the resolution 1920x1080, so I created a 1024x1024 size Texture Atlas for storing multiple graphics.

If the game is played on a 800x480 size device, the atlas will be very big to load in memory. An atlas of 512x512 would be enough and on devices with 480x320 resolution the game might not even work due to the different texture size.

How can I resize the atlas to save memory? Can I use different texture atlases for different screen sizes?

I just want to know how other game devs do it?

sentences:
Architecture of "doodle jump" type gameplay infinite looping background I am planning make a doodle jump type game, character jumping on platforms. A scrolling or doodle jump like background which ll appear to move when character moves upward and appear moving (just like in doodle jump) so, my thoughts are for this kind of background is

to take a large image i.e of 2048x2048, make 2 planes, set this texture to them, when first image ends other ll move its position on top of first, when second ends first ll move on top of second and so on.
Other approch could be a "Instantiate" and "Destroy" of small images having textures on them according to jumping character position ( which i doubt ll b expensive )

They are my thoughts, I want to go for best approach and would like to listen the best one. Is there any more appropriae way to achieve moveable background, I ll appreciate your suggestions. Thanks.

sentences:
C++ Help with Separating Axis Theorem I am trying to detect collision between two triangles using Separating Axis Theorem however I am unaware what is wrong with my code. The CollisionHelper::isTriangleIntersectingTriangle is called every frame and passes in the vertices of both triangles. It never returns true, however. I've been stuck on this for days now. Any help is appreciated.
glm::vec3 CalcSurfaceNormal(glm::vec3 tri1, glm::vec3 tri2, glm::vec3 tri3)
{
    //Subtracts each coordinate respectively
    glm::vec3 u = tri2 - tri1;
    glm::vec3 v = tri3 - tri1;

    glm::vec3 nrmcross = glm::cross(u, v);
    nrmcross = glm::normalize(nrmcross);
    return nrmcross;
}

bool SATTriangleCheck(glm::vec3 axis, glm::vec3 tri1vert1, glm::vec3 tri1vert2, glm::vec3 tri1vert3, glm::vec3 tri2vert1, glm::vec3 tri2vert2, glm::vec3 tri2vert3)
{
    int t1v1 = glm::dot(axis, tri1vert1);
    int t1v2 = glm::dot(axis, tri1vert2);
    int t1v3 = glm::dot(axis, tri1vert3);
    int t2v1 = glm::dot(axis, tri2vert1);
    int t2v2 = glm::dot(axis, tri2vert2);
    int t2v3 = glm::dot(axis, tri2vert3);

    int t1min = glm::min(t1v1, glm::min(t1v2, t1v3));
    int t1max = glm::max(t1v1, glm::max(t1v2, t1v3));
    int t2min = glm::min(t2v1, glm::min(t2v2, t2v3));
    int t2max = glm::max(t2v1, glm::max(t2v2, t2v3));

    if ((t1min < t2max && t1min > t2min) || (t1max < t2max && t1max > t2min))
            return true;
    if ((t2min < t1max && t2min > t1min) || (t2max < t1max && t2max > t1min))
            return true;

    return false;
}

bool CollisionHelper::isTriangleIntersectingTriangle(glm::vec3 tri1, glm::vec3 tri2, glm::vec3 tri3, glm::vec3 otherTri1, glm::vec3 otherTri2, glm::vec3 otherTri3)
{
    //Triangle surface normals, 2 axes to test
    glm::vec3 tri1FaceNrml = CalcSurfaceNormal(tri1, tri2, tri3);
    glm::vec3 tri2FaceNrml = CalcSurfaceNormal(otherTri1, otherTri2, otherTri3);

    glm::vec3 tri1Edge1 = tri2 - tri1;
    glm::vec3 tri1Edge2 = tri3 - tri1;
    glm::vec3 tri1Edge3 = tri3 - tri2;
    glm::vec3 tri2Edge1 = otherTri2 - otherTri1;
    glm::vec3 tri2Edge2 = otherTri3 - otherTri1;
    glm::vec3 tri2Edge3 = otherTri3 - otherTri2;

    //axes
    //TODO: may need to (un)normalize the cross products
    glm::vec3 axis1 = tri1FaceNrml;
    glm::vec3 axis2 = tri2FaceNrml;
    glm::vec3 axis3 = glm::normalize(glm::cross(tri1Edge1, tri2Edge1));
    glm::vec3 axis4 = glm::normalize(glm::cross(tri1Edge1, tri2Edge2));
    glm::vec3 axis5 = glm::normalize(glm::cross(tri1Edge1, tri2Edge3));
    glm::vec3 axis6 = glm::normalize(glm::cross(tri1Edge2, tri2Edge1));
    glm::vec3 axis7 = glm::normalize(glm::cross(tri1Edge2, tri2Edge2));
    glm::vec3 axis8 = glm::normalize(glm::cross(tri1Edge2, tri2Edge3));
    glm::vec3 axis9 = glm::normalize(glm::cross(tri1Edge3, tri2Edge1));
    glm::vec3 axis10 = glm::normalize(glm::cross(tri1Edge3, tri2Edge2));
    glm::vec3 axis11 = glm::normalize(glm::cross(tri1Edge3, tri2Edge3));

    //Perform SAT
    if (SATTriangleCheck(axis1, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis2, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis3, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis4, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis5, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis6, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis7, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis8, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis9, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis10, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;
    if (SATTriangleCheck(axis11, tri1, tri2, tri3, otherTri1, otherTri2, otherTri3)) return true;

    return false;
}

sentences:
Why are my triangles not being drawn in the color I define? I render a simple mash structure with Tao (don't think this is relevant) using DisplayList.

Following code appears between

int displayList = Gl.glGenLists(1);
Gl.glNewList(displayList, Gl.GL_COMPILE);

and

Gl.glEndList();

Simplified version of the code, with removed unrelevant parts:

Gl.glBegin(Gl.GL_TRIANGLES);

for (int i = 0; i < triangles.Count; i++)
{
    var triangle = triangles[i];

    bool ok = false;
    var normal = triangle.GetNormal(out ok); //get normal of TRIANGLE

  //this method just retrives correct color information here
    var visualData = GetVisualData(visual,
                      visual.RenderSettings, triangle,null, false);

    //Set the color for the vertex here. Color is always the same in THIS case
    Gl.glColor4f(m_colors[visualData.color.R],
                     m_colors[visualData.color.G],
                             m_colors[visualData.color.B],
                                 visualData.transparency);

    //for every vertex in triangle
    for (int vtx = 0; vtx < triangle.Vertices.Length; vtx++)
    {
         var v = triangles[i].Vertices[vtx];
         Vertex3 v3 = v.Coord;
         Gl.glVertex3d(v3.x, v3.y, v3.z); //set vertex
         Gl.glNormal3d(normal.x, normal.y, normal.z);  //set normal

    }

}

Gl.glEnd();

Accoring to documentation if I set the same color for all 3 vertices of the triangle it must have the solid color. But what I get is:

As you see the colors are not uniform across different triangles, but I'm pretty sure that in this loop the color is not changed, it remains static (I even tried to set constant int values as color , but  result is always the same)

Q:

What can be possible reason of this rendering behaviour?

sentences:
C++ Using clock() with IsKeyDown I am trying to replicate the game Asteroids as a class project. I am having trouble measuring the time elapsed while the "W" key is pressed.

This code is supposed to increase the force applied to the spaceship to increase the movement speed incrementally. This is supposed to let the space ship rotate while moving along a 'line' and then force while be slowly applied to the new direction the ship is angled.

I have tried to research this over many hours and I still don't understand the concept. It seems there are a few ways to go about this but neither attempts have been successful.This is for school submission for the first project of the first year, so obviously my code is very basic and not making use optimal use of classes/structs however I would still like to achieve this movement I have been seeking so that I can understand the concept for use in future projects.

I have tried the use of current/previous variables for speed but haven't been able to come up with an equation to accomodate that. I have also attempted the use of a timestep but have been told that is not the correct approach. Any help would be appreciated. You can view the bulk of my program at https://gist.github.com/Rifuli/4762704

sentences:
Can I use Unity remote with a Android emulator instead of Android phone? Unity Remote is good app. It allows to connect with Unity while you are running your project in Play mode from the editor.

But what if I want to test game but I don't have an Android phone? Yes, it happens ¯\_(ツ)_/¯

I have a great Android emulator: Nox APP Player

The emulator doesn't have USB, so it just show me standsrt text Connect device with a USB cable ..... bla bla bla ...Game in the Unity Editor is running...emulator doesn't display the game.

Can I somehow connect this emulator to unity using Unity Remote? Or using something else? How?

sentences:
Run playing game in full-screen on one display, Unity IDE in another I have multiple monitors (*). If the Unity (2018.1) IDE is open and maximized in one of them, is there an easy way to have it use one of the OTHER displays to run the game full-screen whenever I launch 'play' mode? Or alternatively, to undock the "Game" tab from the IDE & turn it into a normal window that can be moved to an adjacent display & maximized?

(*) If it matters, I'm running Windows 10, with the desktop extended across all three. The left and middle (main) displays are connected via DVI, the right display is my laptop (Dell Precision m4800 with Quadro K2100M). All three are 1920x1080.

sentences:
How can I make the text flash? I want to have text that flashes from green to white and back to green over and over until the window is closed? Below is what I have tried but i cant seem to get it to work, please help me.

int main()
{
    sf::RenderWindow window(sf::VideoMode(LAYOUT_WINDOW_WIDTH, LAYOUT_WINDOW_HEIGHT),
        "Tetris 2019 - A New Beginning");

    sf::Font myFont;
    if (!myFont.loadFromFile("cartoon relief.ttf")) {

    }

    window.setFramerateLimit(30);

    sf::Text gameOver;
    gameOver.setFont(myFont);
    gameOver.setFillColor(sf::Color::Green);
    gameOver.setStyle(sf::Text::Regular);
    gameOver.setString("GAME OVER!");
    gameOver.setCharacterSize(65);
    gameOver.setPosition(30, 60);

    //everything below gets copied into the "processSplash" function
    while (window.isOpen())
    {
        sf::Time elapsed_time;
        sf::Clock r;

        sf::Time delta_time = sf::seconds(1);

        sf::Text playAgian;
        playAgian.setFont(myFont);
        playAgian.setFillColor(sf::Color::Green);
        while (window.isOpen && elapsed_time >= delta_time)
        {
            if (elapsed_time == delta_time)
            {
                playAgian.setFillColor(sf::Color::Green);
                elapsed_time == r.restart();
            }
            else
                playAgian.setFillColor(sf::Color::White);
                elapsed_time += r.restart();
        }
        playAgian.setStyle(sf::Text::Regular);
        playAgian.setString("Press ENTER to play agian!");
        playAgian.setCharacterSize(25);
        playAgian.setPosition(80, 235);

        sf::Event event;

        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            if (event.type == sf::Event::KeyPressed
                && event.key.code == sf::Keyboard::Space)

                //close splash screen and start game
            {
                /*processSplash();*/
            }
        }

        window.draw(gameOver);
        window.draw(playAgian);

        window.display();
    }

    return 0;
}

sentences:
Unity 3D - Rotate towards object with random offsets Title is a little confusing, but let me explain:

I want to make the enemies look at the player, and shoot at him, with random precision, meaning that one time the enemy will shoot a little bit to the left of the player, next time a little bit to the right of him, and sometimes exactly at him.

Currently I have this scene:

The turret rotates, and when the green direction spots the player, it shoots a bullet facing the player (the green arrow).

Now I need where the rotation is passed for the Instantiate, to have some random precision, and I don't know how to do it. Here's what I have so far

Vector3 pos = new Vector3(firingPoint.transform.position.x, firingPoint.transform.position.y, firingPoint.transform.position.z);

float playerX = playerObject.transform.position.x;
float playerY = playerObject.transform.position.y;
float playerZ = playerObject.transform.position.z;

float randomX = Random.Range(playerX - 1f, playerX + 1f);
float randomY = Random.Range(playerY - 1f, playerY + 1f);
float randomZ = Random.Range(playerZ - 1f, playerZ + 1f);

Quaternion aimPrecision = Quaternion.LookRotation(new Vector3(randomX, randomY , randomZ));

Instantiate(bulletPrefab, pos, aimPrecision);

How can I do this?

EDIT: Right now, the enemy shoots like this:

but never towards me, or backwards

sentences: How do games make fire and smoke effects? I was wondering around, searching internet about particle system and fire effects but I haven't found any good answers. On some games I have realized that some sort of movie is being shown as the fire, which is pretty good but not for the fires which are close to the viewer. Please let me know how to make realistic fire and smoke effect in a game. Also if you have a good sample code or good description of how to make these kinds of cool fires please note them too.

sentences:
How should I unbind and delete OpenAL buffers? I'm using OpenAL to play sounds. I'm trying to implement a fire-and-forget play function that takes a buffer ID and assigns it to a source from a pool I have previously allocated, and plays it. However, there is a problem with object lifetimes.

In OpenGL, delete functions either automatically unbind things (e.g. textures), or automatically deletes the thing when it eventually is unbound (e.g. shaders) and so it's usually easy to manage deletion. However alDeleteBuffers instead simply fails with AL_INVALID_OPERATION if the buffer is still bound to a source.

Is there an idiomatic way to "delete" OpenAL buffers that allows them to finish playing, and then automatically unbinds and really them? Do I need to tie buffer management more deeply into the source pool (e.g. deleting a buffer requires checking all the allocated sources also)?

Similarly, is there an idiomatic way to unbind (but not delete) buffers when they are finished playing? It would be nice if, when I was looking for a free source, I only needed to see if a buffer was attached at all and not bother checking the source state.

(I'm using C++, although approaches for C are also fine. Approaches assuming a GCd language and using finalizers are probably not applicable.)

sentences:
Cave generation with Perlin worms I'm currently trying to generate a Minecraft like voxel terrain with 3D Simplex Noise and also want to implement caves.

I found the method of Perlin Worms in this thread, which generates really nice results.
However, I have no clue on how to generate it on a chunk by chunk basis.
Is this possible or are there any alternatives that produce a similar worm like cave on a chunk by chunk basis?

Edit: This is the problem which I don't know how to solve.

Edit2: This is the result from combining 2D Ridged Multifractal Noise with a Simplex Noise heightmap. Still needs some tweaking, but this is pretty much the result I wanted. Thanks to Byte56.

sentences:
How to design enemies pattern in non-bullet-hell shmups in Unity? I am making a top down shooter.

Enemies will come in waves and attack in many different patterns (i.e. wave of 10 enemies flying in a elliptic curves, or a huge boss floating and shooting at you, etc.).

I'm thinking of 2 solutions:

Design paths using an animation tool
Hard-code paths

For the first solution, I think it will be faster to create the paths since I will be able to see them in the tool, but is it performant? There will be hundreds of flying patterns in my game.

I've also heard of BulletML, but looks like it's more for bullet-hell shmups, and there's no visual editor to design the patterns easily.

Are there other solutions to design path patterns for non-bullet-hell shmups which I haven't considered?

What are the pros/cons of each solution?

sentences:
Convert gl_TexCoord[0].st to match version #330 I'm currently working on a sfml based library where I'm implementing widgets with shaders. I'm defining an quad with position and texcoord in sfml to make the shader apply to the object like this:

quad[0].position = sf::Vector2f(100, 100);
quad[0].texCoords = sf::Vector2f(0, 0);
quad[1].position = sf::Vector2f(410, 100);
quad[1].texCoords = sf::Vector2f(1, 0);
quad[2].position = sf::Vector2f(410, 410);
quad[2].texCoords = sf::Vector2f(1, 1);
quad[3].position = sf::Vector2f(100, 410);
quad[3].texCoords = sf::Vector2f(0, 1);

This way I'll make gl_TexCoord[0].st ready to use without dividing with resolution to make it in rage [0, 1]. But when I'm adding #version 330 I get a deprection error. Since I'm using OpenGL 3.3, I'm looking to stick with the moder shader methods and to avoid deprecated stuffs.

Here's how my shader looks like and works without version definition:

void main() {
     vec2 pos = gl_TexCoord[0].st; // deprecated since #120
     gl_FragColor = vec4(pos.y, pos.x, 1.0, 1.0); // also deprecated too
 }

sentences:
Spawn scene object not found for 1 I'm getting this error with the new Unity Networking (5.1):

Spawn scene object not found for 1
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

This happens in the client, when it connects to the server: the server is file, while the client fails to load the scene. I guess this error means "I failed to load the (online) scene" (which in fact it is the scene number 1), but I've no clue why it does fail.

The server has a custom player spawning function:

public class NetworkDirector : NetworkManager
{
    public override void OnServerConnect (NetworkConnection conn)
    {
        base.OnServerConnect(conn);

        Transform spawnPoint = FindObjectOfType<SpawnPoints>().getNextSpawnLocation();
        GameObject spawned = FindObjectOfType<InstancedElements>().SpawnObjectFree(playerPrefab,spawnPoint);

        FindObjectOfType<CameraFollow>().SetTarget(spawned);
        NetworkServer.AddPlayerForConnection(conn,spawned,0);
    }
}

sentences:
How can I change the name of my game in Google Play? I have just released my first app game called 'paperplane', now the problem is that there are hunderds of paperplane apps so I dediced the change the name to 'neonplane'. I was not able to change the package name, however i could change the title name which is what I did. I updated the game and waited for google to publish it.

Now it is published it is called neonplane, but here is my problem:

If I look for neonplane I can't find nothing.
If I look for paperplane I find somewhere down the list neonplane with the name neonplane.

Is it somehow possible to fix this.

sentences:
How to Save boolean properly on Playerprefs? I want to make a shop system if I buy the items, the items will be saved on Playerprefs, no need to buy again when I restart or re-open the game, for that I already make it to setInt but I don't know when I call getInt. I tried to call it in the start method with a new int index but it doesn't work.
This my script
for store the itemsType
[System.Serializable]
public class m_ShopItem
{
    public Sprite theIcon;
    public int price;
    public bool isBuyed=false;
}

Then I make it list
public List<m_ShopItem> ShopItemsList = new List<m_ShopItem>();
 [SerializeField] GameObject ShopPanel;
    [SerializeField] Transform theContent;
    GameObject g;
    Button buyBtn;
    public GameObject itemTemplate;

void Awake()
    {
        if (Instance == null)
            Instance = this;
        else
            Destroy(gameObject);

        for (int i = 0; i < ShopItemsList.Count; i++)
        {
            // Create a different PlayerPrefs for each Item in the Shop.
            PlayerPrefs.SetInt("isBuyed" + i, ShopItemsList[i].isBuyed ? 1 : 0);
        }
    }

    private void Start()
    {

        for (int i = 0; i < ShopItemsList.Count; i++)
        {

             g = Instantiate(itemTemplate, theContent);
            g.transform.GetChild(0).GetComponent<Image>().sprite = ShopItemsList[i].theIcon;
            g.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text = ShopItemsList[i].price.ToString();
            buyBtn = g.transform.GetChild(2).GetComponent<Button>();
            ShopItemsList[i].isBuyed = PlayerPrefs.GetInt("isBuyed" + i) == 1 ? true : false;
            if (ShopItemsList[i].isBuyed)
            {
                DisableBuyButton();
            }
            buyBtn.AddEventListener(i, OnShopItemBtnClicked);
            Debug.Log(ShopItemsList[i].isBuyed);
        }
    }
    void OnShopItemBtnClicked(int itemIndex)
    {
        if (m_shopManager.Instance.HasEnoughCoins(ShopItemsList[itemIndex].price))
        {
            m_shopManager.Instance.UseCoins(ShopItemsList[itemIndex].price);
            //purchase Item
            ShopItemsList[itemIndex].isBuyed = true;
            PPlayerPrefs.SetInt("isBuyed" + itemIndex, ShopItemsList[itemIndex].isBuyed ? 1 : 0);

            //disable the button
            buyBtn = theContent.GetChild(itemIndex).GetChild(2).GetComponent<Button>();
            DisableBuyButton();

            //add avatar
            m_Profile.Instance.AddBallType(ShopItemsList[itemIndex].theIcon);
        }
        else
        {
            //NoCoinsAnim.SetTrigger("NoCoins");
            Debug.Log("You don't have enough coins!!");
        }
    }

    void DisableBuyButton()
    {
        buyBtn.interactable = false;
        buyBtn.transform.GetChild(0).GetComponent<Text>().text = "PURCHASED";
    }

but the result is the same I have to rebuy when going to the main menu or restart the game.
Can anyone tell me what's wrong with my script?

sentences: How can I improve or replace my programmer art? Say I'm a programmer who has done his own sprites or 3d models which would fall into programmer-ish kind of art. What steps can I take in order to improve or replace my own art?

sentences:
How to architect collision detection in SFML I have a pretty simple game engine that I'm making for a 2d platformer game. I don't want it to be super advanced, but it does have some basic properties. Most important to this question is a class called Entity. Entities are basically just objects in the game that are drawn to the screen and move around. They all have a square bounding box aroud them. Each different entity inherits from the class Entity (ex. Player and Ground inherit from Entity).

I want a nice, object oriented way to handle collisions between different entities. I'd like to be able to write rules of what happens when two things collide in such a way that I don't have to do a ton of casts or rewrite a lot of code. I was thinking of doing something like

class Entity {
    public:
        void collide(Entity* ent);
}

But I'm not sure how I would go about getting the type of the argument. Any suggestions on what to do?

sentences:
How to fit rectangles in a page? Here's my problem: I need to fit rectangles in a polygon but in "certain way".
I have few rectangular shapes (of different sizes) and I need to put them on a polygon.

My first idea was to always try to put them on the top right of the previously placed shape, and if it is not possible, on the bottom left angle of the previously placed shape. It works but it does not looks great, since it does not take into account the placement of the previously placed shape (sometimes the last placed shape is not the most logical).

From this, I imagine we could have a kind of "navmesh": when a shape is placed, it says that nothing more can be placed here and that it needs to find a better place.

Here is how it should look:

Imagine I have the above case, and I want to add one rectangular shape... it shoud go like this:

... with enough space to welcome a new rectangular shape that could possible fit on the blank space.

So... what I want is to place my shapes on the far top and then on the far left.

Do you guys have any ideas how to do this? Maybe this kind of algorithm already exists and I don't know the name?

Thanks !

sentences:
Minecraft modding - Dealing extra damage from a sword I am making a Minecraft mod, and in my tin sword, when it deals damage to an entity, it randomly deals more damage.

public class ItemTinSword extends ItemSword {

    public ItemTinSword() {
        super(MPPTools.tin);
        this.setUnlocalizedName(MPPToolNames.TIN_SWORD.getUnlocalizedName());
        this.setRegistryName(MPPToolNames.TIN_SWORD.getRegistryName());
    }

    @Override
    public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {

        Random r = new Random();

        target.attackEntityFrom(DamageSource.GENERIC, r.nextInt(4));

        return true;
    }
}

But it does not work, and it always only deals normal 5 damage. (Courtesy: Damage Indicators Mod)

So how should I randomly deal more damage? (I'm using forge, btw)

sentences:
Large Scale GIS in a AAA-Quality Game Engine? (Unreal, Cryengine, Unity, Etc.) I am working on a new simulation project that requires large scale, real-world terrain and imagery (GIS).  By large scale, I mean that I would like to support databases that cover something on the order of 10,000 square miles that include at least height data and satellite imagery.  Using data of this size also means that the engine must be capable of managing the coordinate systems/projections such that some reasonable precision can be maintained.

To my knowledge OpenSceneGraph is the only graphics engine out there that makes this easy (via paged terrain support, osgEarth, etc.)  However, it would be nice to be able to leverage many of the other great features AAA-quality game engines bring to the table.  (OSG is just a graphics engine, really.  I've been using it for over a decade, but I don't want to be fixed only to what I know.)

I've seen many tutorials online for importing small postage-stamp sized bits of terrain into Unreal.  I haven't seen anything on this scale.

Asked here: "Very large terrains in Unreal-4" there is a link to Unreal's "World Composition" feature.  This seems to shift coordinates around and also doesn't seem geared towards using real-world data.

How can I represent real-world terrain data on these scales in a mainstream game engine?

sentences:
Get mesh height at position Me and my friends are creating a simple 3D game in LibGDX and are currently trying to implement simple collision detection with the terrain (ground). For this I thought the best way would be to simply get the y-value (height) of the piece of terrain the player is currently standing on, and limit the player's y-position to that value.

For this I need some way to get the 3 vertices that make up the triangle the player is standing on and then use some type of interpolation (probably barycentric) to get the correct height. The problem is that LibGDX's Model, ModelInstance and ModelData classes only contains a raw vertex array(s) of floats with no built in way to acquire the information we need. So my question is fairly straight forward:

Is there a way to acquire the three vertices that we need to perform this interpolation or Is there another way to acquire the height of the terrain given the coordinates (x, z)?

PS. I know using a heightmap instead of a model could solve this problem, but we'd much rather use LibGDX's built-in systems unless absolutely necessary.

sentences:
DirectX 2D Sprite Texture I am trying to make DirectX display a sprite from a sprite sheet I found on the internet but it doesn't seem to be displaying the texture in the correct position as I am specifying it.

D3DXVECTOR2 scaling = D3DXVECTOR2(1.0,1.0);
D3DXVECTOR2 center = D3DXVECTOR2(64,64);
D3DXMatrixTransformation2D(&mat,NULL,0.0,&scaling,NULL,rot,&position);
sprite->SetTransform(&mat);
sprite->Draw(zombieTexture,&srcRect,NULL,NULL,0xFFFFFFFF);

srcRect is defined as follows:

srcRect.top = 384;
srcRect.bottom = 512;
srcRect.left = 512;
srcRect.right = 640;

which instead of giving this texture:

It gets this one: (ignore the rotation)

What am I doing wrong?

sentences:
Carve river beds into existing 3d procedural generated terrain Ok, I've read many threads around about procedural terrain generation with rivers and roads but they suggest approaches from zero to result.

I'd like to know if exists an algorithm to apply to an existing vertex structure which models it by adding rivers beds like cuts through the slope of a mountain for instance.

This approach should:

not work on heightmaps, since my terrain is not generated with
heightmaps
modify the surface with randomness
according to the heights (river sources should be higher and the flow should descend)
be as realistic as possible (like not too many circular paths)

I have no needs for speedy algorithms. would be enought to have a separated algorithm to modify the surface so that I am not forced to do all the work during the creation of the terrain.

I tagged this question with c# because this project is written in c# using xna4.0 and in the case that someone knows any algorithms in different languages, c# is preferred (ye, this is optimism)

By the way, I'm looking forward to see if someone knows anything that could fit these needs

sentences:
glfw resizing causing image scaling I have a quad rendered that extends from the top left of the window to with width of the window that is also 64 pixels high. When I resize the window, from its initial size, the quad and text scales proportionately bigger or smaller in the same say Photoshop can scale a image. What I'm seeking on a basic level is that regardless of how I resize the window, everything drawn remains the same. From the below image, the right side is the initial size and the left side is what happens when I drag the window to be a smaller size. The red bar and text scales with it. This is how Im handling my resizing:
glfwSetWindowSizeCallback(pWindow, WindowSizeCallback); // initialized after context

void WindowSizeCallback(GLFWwindow* window, int width, int height)
{
    glfwSetWindowSize(window, width, height);
}

sentences: 2D Scrollable View with Matrix of Numbers on Android I would like to implement a 2D, scrollable view which can be scrolled horizontally, vertically or even diagonally (similar to a zoomed image which can be scrolled in any direction, but has bounds). In that scroll view, I would like to have matrix of numbers. Which component(s) should I use for this purpose.

sentences:
How do I decompile Minecraft? I'm trying to get started modding Minecraft. I opened up the minecraft.jar file in Eclipse, but it doesn't contain what I expected.

In this tutorial the presenter decompiles minecraft.jar and finds things like armor and blocks packages, but when I put my minecraft.jar file (from [user]\appdata\roaming\.minecraft) into Eclipse, I only see Apache and Ydggrassil authentication and such.

What am I doing wrong?

sentences:
Order array of points in counter clockwise I happened to see an answer to "Sort array of points in clockwise", could you please elaborate the 4th point of that answer:

sort points relative to their a value, using qsort for instance.

How do I do the above step?

I'm looking for an algorithm to sort list of points in counter-clockwise.

sentences:
Large amounts of strings to be used, but how to store them? This is a question I've been meaning to ask. I have thought about it for a little bit and have a few ideas, but I'm not sure which is most secure, and will give me the most functionality with the most efficiency. For my game (being a story game) I have a plethora of strings that I'm going to need to display. I decided to split up the story into chapters, each chapter being a new scene(This way I could organize the content for the chapter). What I was thinking was that I could write regular text files with the chapter's content, while efficient and practical, this seems highly insecure. Then I thought, why not put it into large string arrays on a separate C# file. Well that's more secure, but it's not really practical and it has less efficiency. So I have found pretty much the two extremes here.

What would be the best way to deal with large amounts of strings in a secure, efficient, and functional way? Think about a happy medium compared to my two extremes.

sentences:
How to send data from compute shader to vertex shader I have some shaders, every shader has the same constant buffer,

//-----------------------
//constant buffer
//---------------------
cbuffer cbPerFrame : register(b0)
{
    float3 gEyePosW;
    float4x4 gView;
    float4x4 gProj;
    float gDim;
    float3 gVoxelOffset;
    float gVoxelSize;
};

I think it's a waste to send these same constant buffer several times, so I want to pack them in one Constant Buffer, and share them to other vertex shaders.

I have tried send constant buffer to compute shader, but they don't work in vertex shader.

Do I need to pack these data in one structured buffer? Is it faster than send constant buffer several times?

Is deferred shading relevant to this problem? Which solution do we usually use to solve this problem?

sentences:
Gfx.WaitForPresent performance issue I am making a 2D mobile game and it runs really well (60 fps) on my phone. However, in some cases the performance goes down drastically to the point where it runs at 20 fps or even less. It happens at random times so I can't pinpoint what is causing this. During the performance decrease Gfx.WaitForPresent appears in my profiler which eats a lot of power. I am aware that this might be because of Vsync being turned on, but I have it disabled, along with shadows, AA and everything else that absolutely kills mobile performance. What else can be the problem? My game relies heavily on good performance for gameplay so this needs to be resolved ASAP.

Edit: I also noticed that the GPU stays at 0 ms which is really odd as well.

sentences:
How to update different constant buffers for different vertices in vertex buffer? Lets say I have vertices and indices for Box and Sphere and I put them into one vertex buffer.
But if I want to use different constant buffers for each of the figures, how would I do that?

As I understand I need to somehow say in VertexShader "Do those calculations for those vertices, and these calculations for these". But to my understanding, shaders don't work that way? Also I can't have two input layouts for each figure (it doesn't even make sense).
I've heard you are not suppose to do it that way these days, better to have different buffers for each figure, but still I want to try it.

sentences:
C# UDP Multiplayer Networking - issue with choppiness and consistency I know I've done this incorrectly, but I don't know what the right way is.

Right now I have two clients that connect to a server. Each tick the players send a packet of information containing their X,Y to the server. The server takes those packets and sends them to the other clients. So it's like this:

EXAMPLE:
Player1: 1:x,y or 1:100,125
Player2 receives that information, and then moves that instance of a NetPlayer based on the ID (1)

When the NetPlayer receives a new position packet from the server, it calls MovePlayerTo(Vector2 _newPosition);

public void MovePlayerTo(Vector2 _newPosition) {
            this.newPosition = _newPosition;
            //OldPacketPosition = newPosition;
            //newPosition = _newPosition
            //LerpFromOldToNew(OldPacketPosition, newPosition);
}

Then, in the NetPlayer.Draw method (called 60 times a second), the Position is set like so:

 Position.X = MathHelper.Lerp(newPosition.X, Position.X, lerpValue);
 Position.Y = MathHelper.Lerp(newPosition.Y, Position.Y, lerpValue);

This has smoothed the player out pretty well, but it still appears as if it's not being drawn as smooth as a local player, even with interpolation. It seems like it's being drawn at 45FPS. If I lower my client tick delay to 200ms, it lerps very quickly between those positions in short bursts. It doesn't actually make the entire movement smooth.

I've tried changing the MovePlayerTo() to set an OldPacketPosition, and NewPacketPosition, and then lerp between the last packet.position and the new one, and it becomes even choppier, no matter what I set my  (float) lerpValue to.

Also I noticed if I jump up and down a bunch, it doesn't show the NetPlayer hitting the ground. He moves smoothly and kinda bounces before he even hits the ground and shoots back up in the jump animation.

I know I'm doing this improperly. I've seen other people set their tick rate to be really low, and the positions aren't super accurate but the movement is still smooth between packets.

EDIT: Changes:

public void SetPreviousPosition()
        {
            PreviousPos = LastNetPosition;
        }

        public void MovePlayer()
        {
            //Next = packetPosition
            //Previous = player's position when it received the packet
            //Lerp(previous, next);
            Position.X = MathHelper.Lerp(PreviousPos.X, NextPos.X, lerpValue);
            Position.Y = MathHelper.Lerp(PreviousPos.Y, NextPos.Y, lerpValue);

        }

So every packet received by the net player, the handler is calling the MovePlayer() with the new packet position, after setting it's last position to it's current position when the packet is received. It looks smooth, but not nearly smooth enough. The local player still is super smooth by comparison.

Do I need to lerp to the new position over a specific duration? Because right now it's just calling the method every time it receives a positional update from the server.

EDIT: 5/21/20

I just tried using my lerp function in a different program and it moves perfectly. I added a list of random X,Y packets and then had it lerp over it's update call so I'm assuming that's why it's smooth. In the multiplayer game, it can't have a list, because it needs to lerp between currentPos and packetPos. So I don't understand why it immediately stops working.

sentences:
Board Game Design in Cocos2d I am going to start a chess like board game. And for that I have reviewed a number of things available.

One is http://www.mapeditor.org/, using which you can create a grid base games.

Another option is geekgameboard for iphone available at http://mooseyard.lighthouseapp.com/projects/23201-geekgameboard

Now I want your expert opinion on what would be better to make a game in cocos2d, using the first option or the second option? Both looks promising to me and give good control over board design.

PS: Sorry for duplicates, I found about the https://gamedev.stackexchange.com/ lately after posting it on stackexchange. So I am just posting it here again as I feel this is a more relevant board.

sentences:
Black Box Functionality Testing Methods that apply to an MMO I've been interesed in a career in Video Game QA for a long time now. I've participated in roughly a dozen+ public/closed betas for different games, everything from FPS, MMO, MOBA and RTS, as well as a lot of early access Indie Games recently.

I'm not some 12 year old kid who thinks playing video games every day will be fun. I know it's tedius work with strict deadlines and a lot of pressure. I enjoy the analytical side of the process and I would like to make this passion a career.

I currently have a few upcoming closed beta weekends scheduled that I'm going to be participating in.

What are some ways I can use these to really improve as a tester?

Anyone in this line of work that would be willing to share some pointers for what type of experience people hiring for a QA job would be looking for, besides the obvious; analytical, attention to detail, communication, etc

Additional information: Feel like I should also mention that I have a lot of programming experience as well. I'm currently a Software Engineering major in my final year, but what I'm really interesting in is QA.

Thank you

EDIT:: I'd like to get this back opened so let me see if I can word this more appropriately.

What are some professional Game Functionality/UX Testing methodologies that I could apply to an upcoming Closed Beta Weekend event for WildStars or Elder Scrolls Online.

I'm looking for information that I could use to provide a thourough evaluation of game aspects that I could then include in a Resume or Testing Profile/Portfolio to show a potential employer "This is how I planned my session out, this is how I executed it and this is what I found."

I hope this is less open ended then my original post.

sentences:
How can multiple clients be out of sync if they use the same RNG seed? I have been working on a client-server architecture to enable LAN play for my open source game, Aigilas. In its current state, players stay synced in all running instances of the game but enemies and particle animations are out of sync.

What I cannot understand is how players are the only entities staying synced. I run the clients in lockstep, requiring the latest input states from each client to be announced before taking a turn in the game world. When the game world is built, I seed the random number generator (RNG) with a seed determined by the server. This seed appears to affect the RNG as expected; each client has the same procedurally generated game world and players start in all clients at the appropriate locations.

Particle animations and AI are chosen based on player positions and the RNG. How is it possible for them to become out of sync when the players are always in sync?  To the best of my observations of both the game screen and the logs, players never go out of sync with respect to their positions. That leads me to believe that the RNG in C# is not acting deterministically across all clients.

The basic workflow for the game's client<->server communications are as follows:

Server starts
Client starts and gets RNG seed from server
Client tells server when keys are pressed/depressed by a user
Once a game has started, server tells all clients the current state of each player's keyboards
Once an update has been received from the server, one turn of the game is simulated
Repeat step 4

If there are any specific questions targeting a specific portion of the code, then I am happy link to the appropriate page on GitHub.

sentences:
Font outline in OpenGL, FTGL I'm using FTGL library to render fonts in my game, but I have completely no idea how to create an outline around text. Achieving a shadow could be easy, because I can simply do it like this:

(pseudo code)

font.render(Color::BLACK, position.x + 1, position.y + 1); // Shadow
font.render(Color::WHITE, position.x, position.y)          // Normal text

But how to create an outline? Unfortunately I haven't found any interesting solutions for it over internet which seemed to me a bit strange, because I thought it's quite popular problem.

Drawing outline with just a bigger font is not a right way, because as I found out, letters just don't match in this case:

So is there any simple way to create an outline for fonts? How do they do it in real games?

Thanks in advance for any answer

sentences:
HTML5 - check if font has loaded At present I load my font for my game in with @font-face

For instance:

@font-face {
    font-family: 'Orbitron';
    src: url('res/orbitron-medium.ttf');
}

and then reference it throughout my JS implementation as such:

ctx.font = "12pt Orbitron";

where ctx is my 2d context from the canvas.

However, I notice a certain lag time while the font is downloaded to the user.  Is there a way I can use a default font until it is loaded in?

Edit -

I'll expand the question, because I hadn't taken the first comment into account.  What would the proper method of handling this be in the case that a user has disabled custom fonts?

sentences:
How is tile offsetting accomplished in 2d side scrollers? The idea is to work with tiles that together make up a larger image, or world so to speak.

but im confused as to what the methods used are to offset the tiles, and whether is a good idea to draw offscreen.

For example

var backgroundScroll = 0
update() {
 backgroundScroll++
}
render() {
graphics.draw( resource: BACKGROUND, screenX: -backgroundScroll, screenY: 0)
}

while there's no tiles seen here for the sake of simplicity,
im simply emphasizing that we are drawing off screen.

As such the question is, how is this background offsetting accomplished, more specifically, without trying to render outside of the screen, as the framework may or may not know how to handle drawing to areas beyond that of the screen.

In essence the game's world will be comprised of an array of tiles

var cells[map_w][map_h]

and each cell is 32 px wide and 32px height

the idea is to scroll the map but cutting corner cells 1px per unit of speed,
but altering the logic so that no negative numbers are entered into the draw function.

I could probably figure something out on my own but i really want to hear how other people are accomplishing this rather popular task

sentences:
Destroying instantiated objects stored in a list not working in Unity I have a GameObject with associated a javascript. I have defined a private variable like this:

    private var objects = new Array();

now in the Update method I instantiate new objects and push each obtained reference into the private array like this

    objects.push(newObjectInstance);

when a certain event occurs (i.e. the user press a button in the GUI) I'd like all the objects to be destroyed. I am doing that like this

    for (var i =0 ;i<objects.length; i++){
        Destory(objects[i]);
    }
    objects.clear();

The problem is that although the objects are removed from the array they remain displayed in the Game. What am I doing wrong?

sentences:
Do I need to create my own or use a commercial server for the features and matchmaking options I want my game to support? So I'm developing an indie turn-based game for iOS and, in coding up a Game Center matchmaking class, I'm starting to question whether Game Center is even the best choice for what I want this game to do.  I need to figure out whether I need to create my own server, invest in a preexisting client or server service, or if I even need to use a server at all.  If I do need to use a ready-made service other than Game Center, which server would accomodate my game's needs best?  I have limited resources and funds.  Here is the list of features I want my game to support, ideally:

Turn-based gameplay (a la "with Friends" and "with Buddies" games)
Smart matchmaking (matching users up with other players of comparable skill/achievements)
Random matchmaking
Facebook matchmaking
Specific username matchmaking
Contact list matchmaking
A way to select what "type" of match you want to challenge an opponent to.  (In random, smart, and Facebook matchmaking, there will be different "wagers" the player can make. [e.g. "I wanna play a random opponent for 1000 points.  Now, I wanna play my Facebook buddy for 1,000,000 points."]  There will be a predetermined range of amounts you can play for.  It won't be customizable.)
Buddies list capability (Game-buddies, as opposed to contacts and Facebook)
A higher concurrent game cap than Game Center offers (which I still can't really find a straight answer on)
Scalability (it should support 2 or 20,000,000 players)
Objective-C compatibility
Flexibility (for all the stuff I haven't thought of yet)

Am I dreaming, here?  Is there even a service that can handle all of these features?  Do I need to invest months in learning a networking language to build my own?  If so, how much would I need to spend on hardware?

I've been looking around all morning and, so far, the only seemingly viable option is SmartFox.  Under "Everything and the kitchen sink" section here, it says they support "virtual world with Zones, Rooms and RoomGroups, create complex game challenges, send invitations, manage buddy lists, create custom permission profiles, oversee the security aspects and tons more."

http://www.smartfoxserver.com/overview/platform

Is there an option that Im just overlooking?  Thanks for any help anyone can provide.  Sorry for the long poast.

One last question:  Does anyone know which server Dice with Buddies uses?  I was experimenting with how many concurrent games I could get going and my ADHD kicked in at about 80 games.  80 concurrent games would be great for my game, but again, I need the other features I mentioned too.  Thanks again.

sentences:
How to generate tile based natural looking map? I have a tile based map which I generate using interpolation of pixels on a reference bitmap into appropriate tiles depending on the color of the pixel.

I'm trying to make the output look natural in which blocks of similar tiles look like they are forming a single entity as in the following image:

While my version only puts static sprites onto aligned cells, the second image  takes forest tiles and smashes them together like a whole single forest.
The same is done for the water area.

Could someone explain or point me somewhere where I can learn how to make the result of the first image look like the second? Thank you

Also, how are the seamless road connections done in the above image?

sentences:
Changing CharacterController's height causes jittering issue in Unity As title said changing height of Character Controller causes jittering issue.

For example when I reduced the height of CharacterController, it seems CharacterController was floating at each frame and it keeps falling to the ground. Opposite situation has same issue, different is collider is actually already passing the ground so it just push up the object by physics engine.

(I saw some similar issue with Terrain, in this case it's worse, it just falling through the terrain)

Anyway someone told that I have to change center of CharacterController too, with foot offset(I don't know what exactly that is), so I tried to change the center of CharacterController when resizing height but it still have same problem, nothing different.

This is the code that I'm using:

void Update() {
    if(Input.GetKeyDown(KeyCode.LeftControl)) {
        isCrouched = !isCrouched;
    }

    float newHeight = isCrouched ? crouchingHeight : originalHeight;
    controller.height = Mathf.Lerp(controller.height, newHeight, Time.deltaTime * smooth);

    Vector3 newCenter = isCrouched ? new Vector3(0, 0.2f, 0) : Vector3.zero;
    controller.center = Vector3.Lerp(controller.center, newCenter, Time.deltaTime * smooth);

    float newCamPos = isCrouched ? origCamPos.y - 0.2f : origCamPos.y;
    Vector3 newPos = new Vector3(cam.localPosition.x, newCamPos, cam.localPosition.z);

    cam.localPosition = Vector3.Lerp(cam.localPosition, newPos, Time.deltaTime * smooth);
}

Is there a way to rid off that jittering issue while changing height of Character Controller? Any advice will very appreciate it.

sentences: Where does my .sav file default to in XNA 4.0 when using the StorageDevice class? I am using the StorageDevice class built into XNA and am looking to delete my save file from the solution in my XNA game.  I never specify where the save file is to save, and can't find the default location on MSDN documentation.  I am developing this game for the pc, and never prompt the user to select a save device. Where can I find the save file so that I may delete it?

sentences:
Reliability and suitability of 3G connection for client-server turn-based non-asynchronous game I am working on an iOS turn-based client-server game and I am concerned with the reliability of the connection and the length of time it takes to establish the connection.

The game is turn-based but is not asynchronous, so both players must finish their game in one sitting. If one side of the connection is lost, the person who loses connection will lose. As such this is a big concern for me.

I see applications like WhatsApp losing connection quite often even with full bar of data and it takes about 2-3 seconds every time I launch or resume the application to establish a connection. Is this the norm and is there any way to keep the connection from disconnecting from the server as long as the player has 3G connection? What are some things that I can do to improve the play experience given this condition?

sentences:
Html5 games, what is the standard dimension to use? I am trying to make html5 games to be played on the browser(not offline apps), and I am trying to support the maximum number of platforms, hence I need to know what dimension should I use for the game canvas so that it works in the most number of places.

Also is there anyway to "scale" a large game to fit in the tiny size of iphone(around 320x356px I think). By "scale" I don't mean to actually resize just the canvas, as because that can mess up the coordinate based calculations, and for a large number of objects, re-positioning based on canvas size can be a real hassle.

sentences:
ASSIMP - Hierarchy Import I'm, trying to wrap my head around assimp to import some files, including fbx/obj etc.

Normally my experience tells me that I start at root node and then recursively load child nodes until I load the entire hierarchy. Assimp seems to have the same thing with each aiNode->mNumChildren so that part is clear to me.

What I struggle to understand is the meaning of each aiNode. As it turns out, each aiNode can be a camera/light/group/mesh/other.

This is where I get confused, if I debunk a node, and it ends up having mNumMeshes = 1 and mNumChildren = 2, that confuses me. It tells me that node is both group and a mesh at the same time. Not to mention if meshes >1 then I have no idea how to interpret it.

On top of that there appear to be extra "dummy" assimp nodes for internal purposes or something like that? They have specific name somehow, what do I do with that?

So far, I filter all meshes/camera/lights into separate arrays and I cross check each aiNode against the camera/light node to find out whether that node is a camera or a light. Groups can be identified by checking whether mNumChildren > 0, but meshes are black magic to me. Not to mention dealing with transforms...

aiCamera is also confusing as it appears to have a Matrix4x4 for position as well as up/lookat/ etc? I'm lost, which matrix/coords do I use, those in aiNode, or aiCamera?

How can I interpret this to re-create a proper hierarchy tree?

sentences: Stopping the texture2D from stretching in RawImage I am working with a RawImage texture which is fully stretched, filling up the entire scene. I am using some code to download images from website and then show them on the RawImage, the code is simple, I use WWW to start a download, use WWW.texture as the Image I want to show in RawImage, I do RawImage.texture = WWW.texture; and then I get the image but the Image is getting scrteched, I don't want to stretch the image but just fill instead, Just like a windows Wallpaper setting. Not to stretch or tile the image but to just fill it. I tried an approach to rotate the image via code but that still leaves some stretching in the image, if I use a portrait image( height is greater than width) I rotate the image from showing in landscape mode(which you can imagine, stretches the image a lot) to portrait mode by using some pixel conversion code, nothing special. Some images are displayed ok, because they fit the native size of the scene but for some stretching occurs. Is it possible to completely remove this stretching? I am surprised Unity doesn't have an option for changing how a texture can be displayed in RawImage. Maybe I am missing something,

sentences:
Line Intersection from parametric equation I'm sure this question has been asked before. However, I'm trying to connect the dots by translating an equation on paper into an actual function. I thought It would be interesting to ask here instead on the Math sites (since it's going to be used for games anyway ).

Let's say we have our vector equation :

 x = s + Lr;

where x is the resulting vector, s our starting point/vector. L our parameter and r our direction vector.

The ( not sure it's called like this, please correct me ) normal equation is :

x.n = c;

If we substitute our vector equation we get:

(s+Lr).n = c.

We now need to isolate L which results in

L = (c - s.n) / (r.n);

L needs to be 0 < L < 1. Meaning it needs to be between 0 and 1.

My question:
I want to know what L is so if I were to substitute L for both vector equation (or two lines) they should give me the same intersection coordinates. That is if they intersect.

But I can't wrap my head around on how to use this for two lines and find the parameter that fits the intersection point.
Could someone with a simple example show how I could translate this to a function/method?

sentences: How do I store level-data in Android? I'm building a game where enemies come in waves. I want to create a file where I can define data about the waves (# of enemies, spawn times, speeds, etc.). I come from a background in iOS and would normally use something like a plist. What would be the best way to do something like this in Java and Android?

sentences:
What is a proper way to handle player inputs based on different states? So, I have two ideas how to do that:

Use enum to define current state and check current state value before running certain method group in Update. Code:

void Update()
{switch(currentState){
    case 1:
        InputGroup1();
        break;
    case 2:
        InputGroup2();
        break;
    <...>
}

And so on. I don't think that this is a good idea because of possible performance drops.
Same concept about current state, but instead of checking it and running method groups, "head" script will check current state and activate corresponding script, disabling others. For me it looks like best way in terms of performance and usability.

And also, is it better to keep all input checks in one giant script/component and call functions you need from it? Essentially creating centralized Input Manager.

sentences:
Lightweight Simple Fast-Object Collision Detection Algorithm/Logic I'm making a game where i need to give my objects collision, but i have many fast small objects and normal collision algorithms (Intersection of shapes and such) do not work, because the position+speed iteration advances the walls and there's never actually an Intersection.

I've reserched on those algorithms for a while but they all seem so unecessary complicated, checking all the wall's lines (being that the wall is a rectangle, 4 lines needed to check for each wall..) and maybe resource-expensive...

So i've started constructing my own (Maybe it already exists but i didnt see it anywhere) collision algorithm based on saving the last position the object was.

Please see the following image:

The idea is demonstrated in frame 1 and 2 of the image. Basicly by checking if there's a wall between the left side of the last rectangle and the right side of the new rectangle, i never skip zones while i check collision, and there's no risk of skipping a wall (so i thought).

This is the (sloppy and half-assed) code of the algorithm:

    private void bounce(GameElement b, Terrain t)
{
    Rectangle tR = t.getRectangle();
    int tRleft = tR.x;
    int tRright = tR.x+tR.width;
    int tRup = tR.y;
    int tRdown = tR.y+tR.height;

    Rectangle bRnow = b.getRectangle();
    int bRnowLeft = bRnow.x;
    int bRnowRight = bRnow.x+bRnow.width;
    int bRnowUp = bRnow.y;
    int bRnowDown = bRnow.y+bRnow.height;

    Rectangle bRlast = b.getRectangleLast();
    int bRlastLeft = bRlast.x;
    int bRlastRight = bRlast.x+bRlast.width;
    int bRlastUp = bRlast.y;
    int bRlastDown = bRlast.y+bRlast.height;

    boolean leftRight = false, rightLeft=false, upDown=false, downUp=false;
    boolean betweenX = false, betweenY = false;

    if(bRnow.x>bRlast.x)leftRight=true;
    if(bRnow.x<bRlast.x)rightLeft=true;
    if(bRnow.y>bRlast.y)upDown=true;
    if(bRnow.y<bRlast.y)downUp=true;

    if(bRlastRight>tRleft && bRlastLeft<tRright) betweenX = true;
    if(bRlastDown>tRup && bRlastUp<tRdown) betweenY=true;

    if(leftRight)
        if((tRleft>bRnowLeft || tRleft>bRlastLeft) && tRleft<bRnowRight && betweenY)
        {
            b.setX(tR.x-bRnow.width - 1);
        }

    if(rightLeft)
        if((tRright<bRnowRight || tRright<bRlastRight) && tRright>bRnowLeft && betweenY)
        {
            b.setX(tR.x+tR.width + 1);
        }

    if(upDown)
        if((tRup>bRnowUp || tRup>bRlastUp) && tRup<bRnowDown && betweenX)
        {
            b.setY(tR.y-bRnow.height - 1);
        }

    if(downUp)
        if((tRdown<bRnowDown || tRdown<bRlastDown) && tRdown>bRnowUp && betweenX)
        {
            b.setY(tR.y+tR.height + 1);
        }
}

Its called bounce because its not really organized atm, i still have to think how to structure the algorithm so it becomes more generalized and pratical (Would appreciate help on that too)

This way of doing collision has one bug at the moment which is seen in image 3 (sorry for drawing circles, they are supposed to be squares) because FAST objects still pass diagonals :/ On the other hand, direct hits on walls are pretty neat.

How could i improve, optimize and organize this algorithm? Or is there any better algorithm and im just thinking too much for nothing?

sentences:
How do I make the 3rd person camera follow the space ship in my Space Shooter game? https://youtu.be/13HgaeZWlIA

I am making a 3D space shooter game using OpenGL and Bullet Physics. I am having a hard time with the 3rd person Camera though. If you take a look at the video above you can see that the camera follows the spaceship rotating on the X axis without a problem and rotating on Z axis also without a problem when the spaceship is is oriented towards the horizon and parallel to the ground. When I roll to the right and move the spaceship up I am totally losing it from the camera. The code for my camera is as follows:
float CalculateHorizontalDistance() {
    if (!mpPlayer) return 0.f;

    return distanceFromPlayer * glm::cos(glm::radians(-UpAngle));
}

float CalculateVerticalDistance() {
    if (!mpPlayer) return 0.f;

    return distanceFromPlayer * glm::sin(glm::radians(-UpAngle));
}

void calculateCameraPosition(float horizDistance, float verticDistance)
{
    if (!mpPlayer) return;

    glm::vec3 playerFront = mpPlayer->GetFront();
    glm::vec3 playerPos = mpPlayer->GetPosition();

    Position = playerPos + ((-playerFront) * distanceFromPlayer);

    UpAngle = 180.f - mpPlayer->GetRoll();
    //RightAngle = -mpPlayer->GetPitch();
    RollAngle =  mpPlayer->GetYaw() - 180.f;

    //float theta = mpPlayer->GetRotationY() + angleAroundPlayer;
    //float offsetX = horizDistance * glm::sin(glm::radians(theta));
    //float offsetZ = horizDistance * glm::cos(glm::radians(theta));

    //Position.x = mpPlayer->GetPosition().x - offsetX;
    //Position.y = mpPlayer->GetPosition().y + verticDistance;
    //Position.z = mpPlayer->GetPosition().z - offsetZ;
}

The above code is used to calculate the position and rotation of the camera. The commented out code was used to calculate the position based on trigonometrical calculations for the x and z sides of the triangle created from the camera position to the player position. This didn't work right because I could never set the camera behind the spaceship, only the position worked well.
On the non-commented out code I use as a camera position the player position - back vector * offset. This works fine for the simple purpose that the camera is always on the back side of the spaceship. I also update pitch and roll which works almost fine and here is where I need help mostly to get this right. I also never update the yaw of the camera.
This is how I get yaw, pitch and roll from Bullet Physics rigid body of the player (spaceship):
btScalar yaw;
btScalar pitch;
btScalar roll;
body->getCenterOfMassTransform().getBasis().getEulerZYX(yaw, pitch, roll, 1);

The following code is how the orientation of the camera is calculated :
void updateCameraVectors()
{
    // Yaw
    glm::quat aroundY = glm::angleAxis(glm::radians(-RightAngle), glm::vec3(0, 1, 0));

    // Pitch
    glm::quat aroundX = glm::angleAxis(glm::radians(UpAngle), glm::vec3(1, 0, 0));

    // Roll
    glm::quat aroundZ = glm::angleAxis(glm::radians(RollAngle), glm::vec3(0, 0, 1));

    Orientation = aroundY * aroundX * aroundZ;

    glm::quat qF = Orientation * glm::quat(0, 0, 0, -1) * glm::conjugate(Orientation);
    Front = { qF.x, qF.y, qF.z };
    Right = glm::normalize(glm::cross(Front, WorldUp));
    Up = glm::normalize(glm::cross(Right, Front));
}

and lastly how the view matrix of the camera is calculated:
glm::mat4 GetViewMatrix()
{
    // You should know the camera move reversely relative to the user input.
    // That's the point of Graphics Camera

    glm::quat reverseOrient = glm::conjugate(Orientation);
    glm::mat4 rot = glm::mat4_cast(reverseOrient);
    glm::mat4 translation = glm::translate(glm::mat4(1.0), -Position);

    return rot * translation;
}

Can someone help me fix the rotational problems that I am facing? I am open to modify also the Camera Class to make it work better with Bullet's quaternions instead of the Euler's angles that I am trying to use. Any code or ideas are very welcomed. Thank you for reading through.

sentences:
2D Procedural resource generation I'm currently building a Mars colonization game and I'm wondering if anyone can point me to resources on how to procedurally create resources and biomes within a 2d game. Much like in a game like Factorio were different resources and such are spread around the map.

Thanks in advance!

sentences:
How to make sure two Tiles not overlap each other? I'm trying to make a Grid who will be easily convertible between 2D and 3D and I'm having a problem with overlapping prefabs in the case of the 3D generation.

The thing is, the DataObjects (Tiles) actualy have inside them the prefab of the thing who must be in that tile, but the prefab is bigger than the Tile.

As you can see in the image, i have 3 Tiles selected, Each Tile have a prefab and all of them have the same kind of prefab, they are in the scene highlighted by the orange borders right now in the image.

Then you could imagine than, if the prefabs are equal between the 3 of them they should all have th same size, and that's exactly the case (i.e. in fact they have the same size) but the thing is they are overlaping each other, have that in consideration when looking at the image.

So the question will be...

How to make sure two Tiles not overlap each other?

Based on a suggestion on working not with scale but pixels with units, I don't exactly how to do that, but searching on google make me try this, which actually doesn't work:

tile.tile_GO.GetComponent<Renderer>().bounds.size = thisPrefab.GetComponent<Renderer>().bounds.size;

It doesn't work because "bounds" is read only.

Do you know a work around to solve this? Is there another way to achieve what I'm looking for?

The idea is stop the overlapping, if you know a way to make one next to the other one, or even leave a gap between them in runtime, it will be also consider a valid answer.

Thanks in advance.

PS: I'm using Unity 2017.1.0f3, scripting in C#.

sentences:
Keeping the meshes "thickness" the same when scaling an object I've been bashing my head for the past couple of weeks trying to find a way to help me accomplish, on first look very easy task. So, I got this one object currently made out of 5 cuboids (2 sides, 1 top, 1 bottom, 1 back), this is just for an example, later on there will be whole range of different set ups. Now, the thing is when the user chooses to scale the whole object this is what should happen:

X scale: top and bottom cuboids should get scaled by a scale factor, sides should get moved so they are positioned just like they were before(in this case at both ends of top and bottom cuboids), back should get scaled so it fits like before(if I simply scale it by a scale factor it will leave gaps  on each side).

Y scale: sides should get scaled by a scale factor, top and bottom cuboid should get moved, and back should also get scaled.

Z scale: sides, top and bottom cuboids should get scaled, back should get moved.

Hope you can help,

EDIT
I am asking you, if any of you have any idea on how to accomplish this scaling.

I have tried whole bunch of things, from scaling all of the object by the same scale factor, to subtracting and adding sizes to get the right size. But nothing I tried worked, if one mesh got scaled correctly then others didn't.

Donwload the example object.

sentences:
MotionBuilder- Actor attached to Mocap moves fluently, but Character using Actor as source jitters and has joints occasionally pop out I'm trying to get a MotionBuilder animation to work in Unity on my custom character.
I've downloaded Motionbuilder FBX mocap files with Actors already attached from http://dancedb.eu/main/performances
The thing is that when I put the Actor as the Input source for my own (Characterized) character model and hit play on MotionBuilder, my model follows the animation 80% correctly but for the other 20% my character jitters and shakes and occasionally even "breaks a limb" when a joint randomly pops out of its place for a second.
Does anyone have suggestions on how to get the animation smoother for my Character?

sentences:
Rotating an object in OpenGL about it's centre Im writing a game for which, one of the models are loaded from an .obj file.

It's a model of a plane, and I want to rotate the propeller. The object file is broken into groups, and the propeller is identified, so that's all good.
I'm writing the game in C++ with OpenGl/GLFW
The drawing function is:

int win_width;
int win_height;
glfwGetWindowSize(&win_width, &win_height);
float win_aspect = (float)win_width / (float)win_height;
glViewport(0, 0, win_width, win_height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90, win_aspect, 1, 100.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 30.0, 0, 0, 0, 0.0, 1.0, 0.0);

glEnable(GL_DEPTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3f(0.0f, 0.0f, 0.0f);
int vertexIndex = 0, normalIndex;
glRotatef(90, 0, 1, 0);
glPushMatrix();
for(int a = 0; a < (int)groups.size(); a++)
{
    if(groups[a].type == "prop")
    {
//Code for rotation
        glPopMatrix();
        glPushMatrix();
        float x,y,z;
        x = y = z = 0;
        int Count = 0;
        for(int k = 0; k < groups[a].faces.size(); k++)
        {
            for(int p = 0; p < groups[a].faces[k].vertices.size(); p++)
            {
                int _index = groups[a].faces[k].vertices[p];
                y += vertices[_index].Dimensions[_y] ;
                z += vertices[_index].Dimensions[_z];
                Count++;
            }
        }
        z /= Count;
        y /= Count;
        glTranslatef(0, -y, -z);
        glRotatef(angle, 1, 0, 0);
        glTranslatef(0, y, z);
    }
    for(int b = 0; b < (int)groups[a].faces.size(); b++)
    {
        glBegin(GL_POLYGON);
        for(int c = 0; c < (int)groups[a].faces[b].vertices.size(); c++)
        {
            vertexIndex = groups[a].faces[b].vertices[c];
            glVertex3d(vertices[vertexIndex].Dimensions[_x], vertices[vertexIndex].Dimensions[_y], vertices[vertexIndex].Dimensions[_z]);
        }
        glEnd();
    }
}
glPopMatrix();
glfwSwapBuffers();

Since I don't know the exact centre of the propeller, that's what the for loop before the rotation is for. It finds the average of the y and z co-ordinates.

After I find it, I translate to -y,-z , rotate it, and then translate back. This makes the propeller spin as I want it to, but it also rotates along the origin >.<
http://people.sc.fsu.edu/~jburkardt/data/obj/cessna.obj <- This is the object file.

groups is a vector of objects and each object has a vector of faces. I'm sure that the vertices and faces are being loaded correctly, since the whole model renders correctly.

sentences:
Real Time Cloud Algorithm I want to know how the algorithm works in this game:
http://www.gametrailers.com/user-movie/cloud-the-game/45068

Especially how the game generates the real time cloud, and be able to merge with other clouds dynamically.

I tried to google some info, but was unable to find the useful information.
Probably because I used to wrong keywords

sentences:
XNA texture stretching at extreme coordinates I was toying around with infinitely scrolling 2D textures using the XNA framework and came across a rather strange observation.

Using the basic draw code:

spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointWrap, null, null);
spriteBatch.Draw(texture, Vector2.Zero, sourceRect, Color.White, 0.0f, Vector2.Zero, 2.0f, SpriteEffects.None, 1.0f);
spriteBatch.End();

with a small 32x32 texture and a sourceRect defined as:

sourceRect = new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height);

I was able to scroll the texture across the window infinitely by changing the X and Y coordinates of the sourceRect.

Playing with different coordinate locations, I noticed that if I made either of the coordinates too large, the texture no longer drew and was instead replaced by either a flat color or alternating bands of color. Tracing the coordinates back down, I found the following at around (0, -16,777,000):

As you can see, the texture in the top half of the image is stretched vertically.

My question is why is this occurring? Certainly I can do things like bind the x/y position to some low multiple of 32 to give the same effect without this occurring, so fixing it isn't an issue, but I'm curious about why this happens. My initial thought was perhaps it was overflowing the coordinate value or some such thing, but looking at a data type size chart, the next closest below is an unsigned short with a range of about 32,000, and above is an unsigned int with a range of around 2,000,000,000 so that isn't likely the cause.

Update 1:
The image above shows the texture stretching vertically near (0, -16,777,000), and the texture stretches horizontally at around (-16,777,000, 0). If I go beyond this point on both axes, the texture is stretched in both directions. This occurs in both the positive and negative directions.

The above positions were noted with a 32x32 texture. With a 16x16 texture, the distortion occurs at the same location. Interestingly, with a 64x64 texture, the distortion occurs in the same location on the x-axis, but is actually farther on the y-axis, more near (0, -17,301,000). It occurs at the same location with a 64x64 texture too, I mistakenly used a 64x66 texture before.

Update 2:
I have repeated the test with a 1024x1024 texture and have found the same results. I looked farther and noticed that it stretches again at double the distance, somewhere near (-33,554,000, -33,554,00), but then doesn't happen again until around 4 times the initial stretching point, near (-67,109,000, -67,109,000).

It seems to occur only at powers of two times that initial value, 16,777,216 * 2^n. The answer below by mh01 suggested to check the MaxTextureRepeat cap of my graphics card (a GeForce GTX 560). According to KluDX this cap has a value of 8192, and it's description indicates that texture coordinates are stored in 32-bit signed integers.

Correction: The stretch points occur at 2^n intervals because my texture sizes are 2^n. Testing with a texture size of 25x33 resulted in the first stretch point appearing near (-13,107,000, -17,301,000). So while it's related to the texture's aspect ratio, it doesn't seem to be directly related to the texture's size.

sentences:
Reset Polygon Collider Runtime (Unity) I've created an animation by using different frames. Then applied polygon collider on that object. Problem is that when frame changes in animation, it does not reset collider. I've searched for resetting polygon collider as sprite gets change. One solution I've found is like following :
Destroying existing collider & Adding new collider to the object.
http://answers.unity3d.com/answers/723811/view.html
I've applied this on the object. But it hangs the game. Is there any another way to reset polygon collider from c#.

sentences:
Load game data via ajax what are The Best practies To load game data that are Stored in a mysql database?

I'm using ajax request. But The async Call is a problem because i can't sync The game level with The data load. And game does Not start because the variable is  not defined. If i use sync Call, The loop wait The result And all the entities are blocked on The screen.

How Can i resolve?

sentences:
Optimizing data structure for my text adventure? In my text adventure I'm making, I store the story data in a hashtable (I'm using unity's javascript/unity script since I'm more comfortable with the syntax than C#).

The problem is, the way I structure the hashtable means that it gets incredibly bloated very quickly (I've used the same structure in all of my text adventures across multiple languages. It quickly grows to nearly 1k lines long) which makes it hard to edit in the future (especially if I need to go back to edit certain parts later on)

Here's the hashtable as it's currently structured:

public static var story = {
    "0":
    {
        "text":"",
        "choices":
        {
            "response1":
            {
                "text":"",
                "nextPart":"1"
            },
            "response2":
            {
                "text":"",
                "nextPart":"2"
            },
            "response3":
            {
                "text":"",
                "nextPart":"3"
            }

       }
    },
    "1":
    {
        "text":"",
        "lastPart":"0"
    },
    "2":
    {
        "text":"",
        "lastPart":"0"
    }
};

If anyone could help me optimize the structure of the hashtable that'll make it so it's more easier for me to edit it in the future, that would be great

Quick information for parts that may not be self-explanatory:

"lastPart" indicates to the hashtable parser that the player has died
and the number refers to the part where they chose the
response/choice.
"nextPart" refers to the part of the story the response leads to.

sentences:
Pygame surface rotation, rect rotation or sprite rotation? i seem to have a conceptual misunderstanding of the surface and rect object in pygame.

I currently observe these objects this way:

Surface

Just the loaded image

rect

the 'hard' representation of the ingame object (sprite). Used for simplifying object moment and collision detection

sprite

rect and surface grouped together

What i want to do is rotate my sprite. The only available method i found for rotation is  pygame.transform.rotate.

How do i rotate the rectangle, or even better, the whole sprite?

Below is the image of how i visualize this problem.

sentences:
How to prevent a duplicated shadow? It's a blob shadow which is built in Unity's standard asset package.

As you see in the figure below, a shadow that is created by the Unity Projector is duplicated at the floor below.

How can I prevent this duplicated shadow?

sentences:
Place tiles along a specific axis / direction I want to be able to place tiles only in the direction I've started "drawing" them.
For an example, if I click and hold on tile at position (0,0), and start dragging to the right, I only want to select or draw on coordinates (1,0), (2,0), (3,0) and so on. However, for the next tile, if I point my mouse at the tile (4,1), I only want (4,0) to be selected, aka, ignore the Y changes because I'm currently placing on the X axis.
What would be a good and clean way to do this?
I've tried doing this but not only does it not work well, my code is very bloated because I'm not good at this logic that requires more math than usual. Here's what I tried (needless to say it's very messy and didn't work properly):
private bool isSelecting;
private Vector3Int selectionDirection = Vector3Int.zero;
public List<Vector3Int> selectedPositions = new List<Vector3Int>();
private SelectDirect selectDirect;

    if (Mouse.current.leftButton.wasPressedThisFrame)
    {
        if (UIManager.IsMouseOverUI()) { return; }

        Vector3Int gridPosition = Map.GetGridPosFromMousePos();

        if (Map.IsInsideMap(gridPosition))
        {
            if (!selectedPositions.Contains(gridPosition)) { selectedPositions.Add(gridPosition); }
            isSelecting = true;
        }
    }

    if (Mouse.current.leftButton.wasReleasedThisFrame)
    {
        isSelecting = false;
        selectedPositions.Clear();
        selectionDirection = Vector3Int.zero;
        selectDirect = SelectDirect.None;
    }

    if (isSelecting)
    {
        if (selectionDirection == Vector3Int.zero && selectedPositions.Count == 2)
        {
            selectionDirection = selectedPositions[1] - selectedPositions[0];

            if (Mathf.Abs(selectionDirection.x) + Mathf.Abs(selectionDirection.y) > 1)
            {
                isSelecting = false;
                selectedPositions.Clear();
                selectionDirection = Vector3Int.zero;
                selectDirect = SelectDirect.None;
                return;
            }

            if (selectionDirection.x == 1) { selectDirect = SelectDirect.Right; }
            else { selectDirect = SelectDirect.Up; }

            Debug.Log(selectDirect);
        }

        Vector3Int gridPosition = Map.GetGridPosFromMousePos();

        if (Map.IsInsideMap(gridPosition))
        {
            switch (selectDirect)
            {
                case SelectDirect.None:
                    if (!selectedPositions.Contains(gridPosition)) { selectedPositions.Add(gridPosition); }
                    break;
                case SelectDirect.Right:
                    if (gridPosition.x - selectedPositions[selectedPositions.Count - 1].x == Mathf.Abs(selectionDirection.x) && !selectedPositions.Contains(gridPosition))
                    {
                        selectedPositions.Add(gridPosition);
                    }
                    break;
                case SelectDirect.Up:
                    if (gridPosition.y - selectedPositions[selectedPositions.Count - 1].y == Mathf.Abs(selectionDirection.y) && !selectedPositions.Contains(gridPosition))
                    {
                        selectedPositions.Add(gridPosition);
                    }
                    break;
            }
        }
    }

sentences: Display Lists in OpenGL I heard that there was a faster method of displaying vertices, rather than recreating the GL_TRIANGLES, each time the scene is drawn. I thought I read somewhere that this method was  obselete. Why would the OpenGL group remove something that was faster? Even if it is obselete, how would I go about implementing this?

sentences:
What causes some computers to have no or slow OpenGL, and how to fix it? I am using Java with JOGL to create OpenGL enhanced 2D graphics.  The graphics operations I use are nothing fancy, and should be supported by almost any recent graphics card.  For example, my game runs great on a Netbook.

I was hoping the game would run on most computers.  It runs fine on my own computers.  However, I found some computers have very slow performance (apparently software fallback, yielding about 2 frames per second).  I ran a LWJGL app on one such computer. It doesn't run at all (it reports something like
org.lwjgl.LWJGLException: Pixel format not accelerated, you can find various forum threads complaining about this but no apparent solutions, except the suggestion that it is a driver problem).  Other OpenGL software does not seem to work, either.  I also found that my Flash version of the game with exactly the same graphical effects performs pretty well full-screen on that same computer.  The computer in question has a recent ATI card but unfortunately I have no access to the driver manager.

The problem appears fairly widespread.  I think it is very unfortunate that OpenGL does not always provide access to graphics features found on most computers.  This makes it less attractive for casual 2D games, which I expect to run on any computer.

Did any of you run into this problem and manage to fix it?  AFAIK, both NVidia and ATI provide OpenGL as part of their standard driver sets, but maybe there are some exceptions?  Is this problem caused by third party drivers not supporting OpenGL, and can the problem be fixed by installing better drivers?  How many other graphics cards are out there without OpenGL drivers?

EDIT: As a final note, I can conclude that OpenGL is just not well supported on Windows machines.  Microsoft seems to have been doing their best to keep it off their platform, for example by deliberately leaving out OpenGL drivers in some Windows driver bundles. Get the vendor drivers, and you get OpenGL; get the standard drivers that Windows downloads for you, and you don't.  This has been causing no end of trouble for others as well. For example, for implementing WebGL, Web browsers use Angle, which is an OpenGL ES emulator for DirectX. So, what we'd really need is something like Angle, only for full OpenGL.

sentences:
How to position a 3D crosshair on an objects face and set its angles **outward** from objects face? What I have right now, is a ray tracer for my cursor on my canvas, when I click on the object, it gets the vector of my selection in the 3D space on the object I had my mouse on.

The ray tracer returns a point which is a Vector3, so I set my crosshairs (line) position to point, only issue is, I need my crosshair to be pointing outward from my object like so: (example)

This is where my issue lies... I need to get the direction of the face that my ray tracer intersected, but I cant figure out how. I can get the direction of the object itself no problem,but I dont want that, I want my crosshair to lie flat on the face that its positioned on.

This is it incorrectly positioned on the side of my model:

So the line thats pointing outward from the cross, should point outward from the face and the cross be flat on the surface I clicked.

This is the code Im using now:

line.position.copy(intersects[0].point);
var mx = new THREE.Matrix4().lookAt(intersects[0].point,new THREE.Vector3(0,0,0), intersects[0].normal);
var qt = new THREE.Quaternion().setFromRotationMatrix(mx);
line.rotation.copy(qt);

Update

I've tried another approach as seen here but Im still haing trouble getting it to flatten out on the mesh:

var mat = intersects[0].object.matrixWorld;
    mat.setPosition(new THREE.Vector3(0, 0, 0));
    var globalNormal = intersects[0].face.normal.clone().applyMatrix4(mat).normalize();
    var lookAtTagret = new THREE.Vector3().addVectors(intersects[0].point.clone(), globalNormal);
    line.lookAt(lookAtTagret);
    var cPos = new THREE.Vector3().addVectors(intersects[0].point, globalNormal.multiplyScalar(0.05))
    line.position.copy(cPos)

sentences:
Understanding the ways to access a Graphics object for drawing in Java I'm making a game in java right now. I've looked around at various tutorials for making Java games and there doesn't seem to be a consistent way to access a Graphics object to draw stuff on the screen.

Three of the different ways have been

Overriding the paintComponent() method in a class that extends JPanel
Using the getGraphics() method to get the graphics object in a class that extends JPanel
Creating a BufferStrategy object and using the getDrawGraphics() method to get the graphics object to draw

All three implementations seem to work, I'm just confused about the difference between them, and in which situations would you use each?

sentences: How are the same items generated with slightly different attributes? Consider games like Destiny.  How do they generate weapons that have the same skins and names, but different attributes?  Two people can have the same weapon or armor piece, but have different attributes on these pieces based on luck or drop rate etc.  How is this accomplished programmatically?

sentences:
Do Gradle 'implementation' replace Unity Jar Resolver dependencies? I have a project with several *Dependencies.xml files which the Unity Jar Resolver resolves fetching the .aar files and storing them on Plugins/Android.

When installing Ironsource, I saw in the documentation that it says to add the dependencies to the mainTemplate.gradle file:

dependencies {
    // Your other dependencies //
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.google.android.gms:play-services-ads-identifier:16.0.0'
    compile 'com.android.support:support-v4:27.1.1'
    **DEPS**
     // Your other dependencies //
     // ... //
     // AdMob's dependency //
    compile 'com.google.android.gms:play-services-ads:17.1.1'
}

Because one of my dependencies that the jar resolver imports is an older version of support-v4 my build fails.

Seeing this new alternative, can I move all the dependencies files to the gradle file and let Gradle auto resolve this problem on the post build process?

Is there any pros/cons that the jar resolver has that Gradle doesn't? For what I know the Jar Resolver uses gradle.

sentences:
Monogame/XNA - How do you resize a Texture2D and then scale it? Problem:
It seems like the Draw() call allows us to use either Destination Rectangle for resizing (5of8) or Scale (6of8/7of8) but not both.

Purpose:
I would like to resize a button from 567x634 to 400x480 and then using scale to further reduce it by 0.8 to 320x400.

sentences:
Network without Server: NAT punchthrought How do i make 2 players connect and play together ?

Assumptions:

1) Game has no server.
2) Player only has 1 computer.
3) Player cannot configure his router or open a port.
4) Player does not want to share his PC for multiplayer.
5) Reasonable delay is allowed: up to 1 hour per packet / player action.
6) Ipv4 internet is used
7) Players can connect to any website.

Solutions I considered but cannot get them to work:
1) Posting in a random forum you don't own. Soon the thread that 10 million players use, approaches 60gb data per hour and gets closed by a moderator. Gameover.

2) Sending Data by Email.
  a) I know no email api.
  b) players will risk their email credentials.

3) Having an external server manage the initial connection.
  a) I know none that are free.
  b) I am not paying money.

More specific :
I am using unity, i am willing to port solutions if you find a free site or solution that works.

sentences:
How to I rotate a triangle by dragging the mouse in libGDX? More specifically, I have rotation working in a way I don't like as follows:

    //Draw the triangle using this draw method
    //batch.draw(texture, x,                            y,                                          originX,                 originY,                                        width,               height,      scaleX, scaleY, rotation, srcX, srcY, srcWidth,   srcHeight, flipX, flipY)
    batch.draw(triangle, 240 - triangle.getWidth() / 2, (float) (400 - triangle.getWidth() * .289), triangle.getWidth() / 2, (float) ((double) triangle.getWidth() * 0.288), triangle.getWidth(), triangle.getHeight(), 1, 1, rotate, 0, 0, triangle.getWidth(), triangle.getHeight(), false, false);

    batch.end();

    //Touch input
    if(Gdx.input.isTouched()){
        Vector3 touchpos = new Vector3();
        touchpos.set(Gdx.input.getX(), Gdx.input.getY(), 0);
        camera.unproject(touchpos);
        rotate = touchpos.x;
    }

This rotates the triangle around the center of the triangle that is at the center of the screen (the 0.289 corresponds to the height of the middle of an equilateral triangle according to its side length).

The rotation will be equal to the touch position on the screen which works great when the finger is dragged. However, what this code does is moves the rotation to the specific location whenever I touch the window with the mouse. What I would like it to do is to rotate the triangle when the mouse is dragged, but only based on its previous rotation, not its absolute rotation. For example, if I click and drag the mouse from the left side of the window to the right, the triangle will rotate accordingly. When I lift the mouse then click and drag it the same way a second time, I don't want it to reset it's position to my 2nd click, I want it to move the amount I dragged my mouse from it's previous rotation.

Can anyone help with this? I've been trying to wrap my head around it for hours. Let me know if you need any clarifications.

sentences: How to select light as sun source I tried to add a sun in the lighting setting. I have a directional light in my scene, but i can't select it as sun source in lighting setting. The light does not appear in the list. Does anyone know what is wrong ?

sentences:
Opengl scrolling world guidance I'm looking for a tutorial about how to implement a horizontally scrolling background with various objects that auto-scrolls as your character/player moves just like various car/motorbikes games.

I'll have images for various obstacles, objects along the path. I'm concerned if I load everything on start of game. /i would want these to be loaded for visible area as the player moves (or appears to move).

Though I'm looking for a tutorial in android and I'm new to opengl, but I welcome any sort of help.

sentences:
Algorithm to modify a color to make it less similar than background I'm creating a demo of 20 balls bouncing each other, with a background filled with a solid color. Color for each ball is chosen randomly with randint(0, 255) for each R, G, B tuple component.

Problem is some balls end up with a color that is very similar to background, making them hard to see. I would like to avoid that, either by rolling another color if the chosen one is too similar (within a given threshold), or by moving it away from the background color.

How to calculate a similarity index to use as a threshold? Or how to transform a color to make it, say, less blue-ish?

Obvious disclaimer: I know nothing about color theory, so I don't know if the above concepts even exists!

I'm coding in python, but I'm looking for concepts and strategies, so pseudo-code is fine (or just the theory).

EDIT:

To clarify a few points:

Each ball have its own random color. I'd like them to remain as random as possible, and to explore as much as possible of the color space (be it RGB or HSV, pygame accepts both formats for defining color)
I'd just like to avoid each color of being "too close" to background. Problem is not just about hue: I'm perfectly OK with a light-blue ball against a dark-blue background (or a "full-blue" against a "white-ish" blue, etc)
For now, I don't care if a ball ends up with a color similar (or even identical) to another ball. Avoiding that is a bonus, but it's a minor issue.
Background color is a constant, single RGB color. For now I'm using "basic" blue (0, 0, 255), but I'm not settled with that. So consider the background to be of an arbitrary color (with arbitrary hue, brightness, saturation, etc).

EDIT2:

TL,DR version: Just give a way to create X random colors so that none "fades in too much" against a background of arbitrary (but single and constant) color

sentences:
Should a mesh consist of triangles or quads? Currently I am a bit puzzled. I am writing my master thesis about procedural mesh and texture generation and for that I am writing a Blender Add-On to generate low poly planets with physical physically based rendering textures.

This blog (http://blog.digitaltutors.com/modeling-with-quads-or-triangles/) says that it's better to use quads instead of triangles and n-gons. The wireframe looks cleaner, subdivides are more logic and having edge loops. Another blog about this topic can be found here http://blog.digitaltutors.com/ngons-triangles-bad/

But I also read this Why do game engines convert models to triangles compared to keeping it as four side polygon which says that in the end everything is converted to triangles. So I would assume that it's better to use triangles from the beginning so that the engine doesn't need to convert quads to triangles.

And now I don't know if it's better to use triangles or quads.

I could think of it this way:

For modeling use quads, because it's easier to manipulate a quad-mesh.
When modeling is done convert to triangles and export the mesh. But I think this is altering the low poly art style.
Use in a Game Engine.

If I read the ngons-triangles-bad blog post it says that there could be render issues with triangles. So why do engines than convert the mesh to triangles?!

Am I missing something important?

Any advice or more info? Thanks!

sentences: SignalR For Multiplayer Game Development I've been working with SignalR for live chat and notifications in .NET platform and was wondering how much is it worth for working on games development? I've made some jQuery browser games and I want to make them multiplayer. Is there any performance issues if I use SignalR for games development? Need some detailed info about it. Thanks.

sentences:
How should I store a Game Database on Android? I'm looking at creating a game for Android and while I have most of the ins and outs worked out, the one thing I'm struggling with is how to store data for the game.

Ultimately, the game will be based off of a lot of pre-defined data and statistics so the obvious choice to me would be something like SQLite, but as I'm pretty new to the realm of Android and Game Development, I'm not 100% certain if this is the right route to follow.

The data will be general pre-defined data as well as player data (along the lines of careers stats - what place finished, etc).

I was wondering if there was a better/best practice solution that wasn't SQLite and that would provide said functionality and if so, could you point me in the right direction?

sentences:
LibGDX viewport touch coordinates transformation I've been trying to get LibGDX's viewport and camera unproject() to work and so far none of the tutorials/answers I've found have worked for me.
I have a game window of 840x480 units with FitViewport. If the screen resolution matches the aspect ratio of the viewport, the coordinates are unprojected correctly. If it doesn't and the viewport inserts black bars, the transformation is incorrect (see below):

I'd like for the shape to be drawn where the cursor is, since the current behavior makes touch input on Android absolutely useless...

Furthermore, on Android the viewport doesn't fill the entire screen and just produces a rectangle on the bottom left quarter of my 1920x1080 px display.

Here's the code that produces this:

public class MainScreen extends ApplicationAdapter implements InputProcessor {
OrthographicCamera camera;
Viewport viewport;
Vector3 worldCoordinates = new Vector3();
Shape shape, background;
public ShapeRenderer sr;

@Override
public void create() {
    worldCoordinates = new Vector3();
    camera = new OrthographicCamera(800,480);
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
    viewport = new FitViewport(800, 480, camera);
    viewport.apply();
    sr = new ShapeRenderer();
    shape = new Shape(this, 20, 20, 0, 0);
    background = new Shape(this, 800, 480, 0, 0, Color.WHITE);
    Gdx.input.setInputProcessor(this);
}

@Override
public void resize(int width, int height) {
    viewport.update(width, height);
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
}

@Override
public void dispose() {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void render() {
    camera.update();

    Gdx.gl.glClearColor(0, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    background.render();
    sr.setProjectionMatrix(camera.combined);

    shape.posX[0] = (int) worldCoordinates.x - shape.sizeX[0] / 2;
    shape.posY[0] = (int) worldCoordinates.y - shape.sizeY[0] / 2;

    shape.render();
}

@Override
public boolean mouseMoved(int screenX, int screenY) {
    worldCoordinates = camera.unproject(new Vector3(screenX, screenY, 0));
    return true;
}

@Override
public boolean keyDown(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyUp(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyTyped(char character) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    return false;
}

@Override
public boolean scrolled(int amount) {
    throw new UnsupportedOperationException("Not supported yet.");
}
}

And the Shape class:

public class Shape extends Element {
public Color background;
ShapeRenderer sr;
public Shape( MainScreen ms, int sizeX, int sizeY, int posX, int posY){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    background = new Color();
    background.set(1, 0.533f, 0, 1);
}
public Shape(MainScreen ms, int sizeX, int sizeY, int posX, int posY, Color background){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    this.background = background;
}

@Override
public void render(){
    sr.begin(ShapeRenderer.ShapeType.Filled);
    sr.setColor(background);
    sr.rect(posX[0],posY[0],sizeX[0],sizeY[0]);
    sr.end();
}
}

I have tried literally every option I could find without any result. Thank you for any help.

sentences:
TileEntitySpecialRenderer only renders from certain angle I'm developing a Minecraft mod with Forge. I've added a tileentity and a custom renderer for it. The problem is: The block is only visible from sertain angles. I've compaed my code to other peoples code and it looks pretty much like them.

The block is opaque and not to be rendered and the renderer is registered normally so the fault must be in the renderer.

Here's the renderer code:

public class TERender extends TileEntitySpecialRenderer
{
    public void renderTileEntityAt(TileEntity tileEntity, double d, double d1, double d2, float f)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)d, (float)d1, (float)d2);
        HeatConductTileEntity TE = (HeatConductTileEntity)tileEntity;
        renderBlock(TE, tileEntity.getWorldObj(), tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord, mod.EMHeatConductor);
        GL11.glPopMatrix();
    }

    public void renderBlock(HeatConductTileEntity tl, World world, int i, int j, int k, Block block)
    {
        Tessellator tessellator = Tessellator.instance;
        GL11.glColor3f(1, 1, 1);
        tessellator.startDrawingQuads();
        tessellator.addVertex(0, 0, 0);
        tessellator.addVertex(1, 0, 0);
        tessellator.addVertex(1, 1, 0);
        tessellator.addVertex(0, 1, 0);
        tessellator.draw();
    }
}

sentences:
What advantages are there to the one-port-per-client approach for a multiplayer server? There are a few older games (Quake III and Hexen II to name a couple) where the server assigns a port per player.

Are there performance advantages to this? I suspect there may be, since Carmack & Co.'s endeavours tend to lean in that direction.

I found this, which doesn't provide many different points of view... unfortunately the Book of Hook (link therein) has been down of late, and I don't know if it will ever become available again. What a waste of valuable oldschool knowledge. (If anyone knows where else this might be available, I would be indebted.)

sentences:
Wrong contineous rotation to car In my 2d game, I want to rotate car face based on collision detected. But at present after 3 to 4 collision its doing continuous rotation only rather than moving straight after collision.

Here is my straight movement related code:

myRigidbody.MovePosition (transform.position + transform.up * Time.deltaTime * GameManager.Instance.VehicleFreeMovingSpeed);

For better collision purpose, I have used Rigidbody position change approach.

Here is my collision time code:

public void OnCollisionEnter2D (Collision2D other)
{
 if (other.gameObject.CompareTag (GameConstants.TAG_BOUNDARY)) {
     ContactPoint2D contact;
     contact = other.contacts [0];
     Vector3 reflectedVelocity = Vector3.Reflect (transform.up, contact.normal);
     direction = reflectedVelocity;
 }
}

if (direction != Vector3.zero && pathGenerator.positionList.Count <= 0) {
        float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg;
        Quaternion targetRot = Quaternion.AngleAxis (angle - 90f, Vector3.forward);
        transform.rotation = Quaternion.Slerp (transform.rotation, targetRot, 0.1f);

        if (Quaternion.Angle (transform.rotation, targetRot) < 5f) {
            transform.rotation = targetRot;
            direction = Vector3.zero;
        }

    }

Rotation get applied within other code so that car was changing its face correctly and that method not affecting here that I have checked by placing debug statement.

Share you side thought for this.

sentences:
How is a normal map applied to a triangle mesh? I'm working on writing my own parser/renderer for the obj file type, and right now I have it working so that I can draw the model correctly and use the vt texture coordinates to apply a texture to the model. The next step that I want to do is apply a normal map to make the surface look smoother, but I'm not completely sure how this is done.
I've applied normal maps to a sphere before, and part of the trouble that I had in implementing that was figuring out how to get a consistent pair of tangent vectors in order to adjust the normal. On a sphere, that's done using spherical coordinates and calculating dp/du and dp/dv, but how is it done in an obj file? It seems like local coordinates, normal coordinates, and texture coordinates are the only thing stored for each vertex, no tangent vectors. I know that the surface can also be smoothed by interpolating the normal vectors defined at each vertex, but the model I'm working with doesn't even have those defined. And I know it should be possible with the model because if I open it in the windows 3d viewer I can see that it smooths out the triangles.
How are the tangent vectors found on a triangle mesh? In case it matters, the specific model that I'm using is one that I downloaded from here.

sentences:
textures in tilemap games: use 2d planes or 3d objects? (example with Dragons of Atlantis) How to create the textures in games such as Dragons of Atlantis?

I was thinking about 2 ways:

using 2d planes to save space and memory, using the color from the 3d
software
adding a very simple mesh and stick a detailed texture onto it in Unity

Is there a preferable way to choose between the two?
The first solution could save some memory, but maybe a bit difficult to change the camera view for example at the end of the game.
As for the second solution, it would be creating a very detailed mesh in the 3d software, paint the texture, cut the texture and add it to a very simple mesh, such as cubes. Could be better, but maybe it would take more work.

What do you think?

Thanks

sentences:
Unity wall jump issue I've got a very annoying problem that I have been stuck on for a few days and I can't figure it out.

It is for a wall jump.

I basically want my wall jump to have a bit of force away from to wall to make it look and feel better than just jumping up straight.

The problem is, when i add a force on the x axis, it does not register when i am also holding the arrow towards the wall. If I am not holding down the walking button, then press jump...then the x force works.

I have a feeling that the horizontal axis force is competing with the opposite force that i want to add to the player when he hits the jump button...

Walking code:

private void ApplyMovement()
{
    if (isGrounded)
    {
        myRigidbody.velocity = new Vector2(movementSpeed * movementInputDirection, myRigidbody.velocity.y);
    }
    else if (!isGrounded && !isWallSliding && movementInputDirection != 0)
    {
        Vector2 forceToAdd = new Vector2(movementForceInAir *  movementInputDirection, 0);
        myRigidbody.AddForce(forceToAdd);

        if (Mathf.Abs(myRigidbody.velocity.x) > movementSpeed)
        {
            myRigidbody.velocity = new Vector2(movementSpeed *  movementInputDirection, myRigidbody.velocity.y);
        }
    }
    else if (!isGrounded && !isWallSliding && movementInputDirection == 0)
    {
        myRigidbody.velocity = new Vector2(myRigidbody.velocity.x * airDragMultiplier, myRigidbody.velocity.y);
    }

    if (isWallSliding)
    {
        if (myRigidbody.velocity.y < -wallSlideSpeed)
        {
            myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, -wallSlideSpeed);
        }
    }
}

Jump code:

private void Jump()
{
    if (canJump && !isWallSliding)
    {
        myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, jumpForce);
        numberOfJumpsLeft--;
    }
    else if ((isWallSliding || isTouchingWall) && !isGrounded && canJump)
    {
        isWallSliding = false;
        numberOfJumpsLeft--;
        Vector2 forceToAdd = new Vector2(wallPushForce * -facingDirection, wallJumpForce *
                                         wallJumpDirection.y);
        myRigidbody.AddForce(forceToAdd, ForceMode2D.Impulse);
    }
}

Where I call The code:

void Update()
{
    CheckInput();
}

private void FixedUpdate()
{
    ApplyMovement();
}

private void CheckInput()
{
    movementInputDirection = CrossPlatformInputManager.GetAxisRaw("Horizontal");

    if (Input.GetButtonDown("Jump"))
    {
        Jump();
    }

    if (Input.GetButtonUp("Jump"))
    {
        myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, myRigidbody.velocity.y * variableJumpHeightMultiplier);
    }
}

Any help would be much appreciated.

Thanks in advance

sentences: Turn-based board game server references? Are there any good references/books to recommend about how to build a turn-base game server? It's something like a chess server for pairing chess players and keep game states. In the past, for example the IGS (for go, weiqi) is a socket based implementation. What are the available contemporary technologies to learn from? Thanks!

sentences:
Unity3D C# Drag object smoothly on it's x axis that's already bouncing In my scene, I have a bouncing ball that collides with a cube. On each collision the ball returns to the same height. How can I get the ball to smoothly move along the x-axis by dragging my finger across the screen, while at the same time having no effect on the y or z values?

The y position is changing every frame depending on the state of the jump, so setting it's y position to transform.position.y in the Update function causes the movement to be jittery if the frame renders when it isn't caught up with the position of the ball.

Also, I set the interpolate value of the rigidbody to interpolate to get a smoother jumping motion, not sure if this is relevant to my problem or not.

Here is where I am at so far with little success. A few mobile games that replicate what I'm trying to achieve in terms of ball movement are Hop, Color Hop, and Splashy!

void Update()
{
    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
    {
        // Control sliding using touch input.
        Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
        transform.Translate(touchDeltaPosition.x * slidingSpeed, 0, 0);
    }
    transform.position = new Vector3 (Mathf.Clamp(transform.position.x, - xPosLimit, xPosLimit), transform.position.y, transform.position.z);
}

sentences:
Quaternion Rotation Weird Rotation I have an fps camera, and i am representing rotation with quaternions.  every frame i grab how much the mouse moved that frame and then i simply do

Quat DeltaQ = Quat::CreateRotationXYZ(MouseYDelta, MouseXDelta, 0);
m_CurrentRotationQ = DeltaQ * m_CurrentRotationQ;

however, everything works until i rotate 90 degrees to the right.  when i do that i cannot rotate up and down.  also, moving the direction i am facing works, however, depending on where i am looking strafing left and right moves me in different directions,  I've tried many things such as reversing order of multiplication, i'm really at a loss.  Any help would be greatly appreciated.

sentences:
Unity5 - Create navmesh for a random generated environment I am following this tutorial to create a game with random generated mazes:

http://catlikecoding.com/unity/tutorials/maze/

I want to add some monsters to roam around the newly created maze. How can I create navmesh for this kind of random generated environment?

sentences:
Fair spawning of players on a 2D grid As new players enter a game, they are given a location on a large grid. The first player is given the location in the center.

Now, how should the second player be placed? Then, the third and so on?

New players should be placed reasonably near some other players, but not so close as to cause bunching.

My current thinking is to trace a clockwise spiral around the first player, gradually moving further and further out from that initial point. But I keep thinking this must have been done before and that a general solution must exist.

This is for a strategy resource game (similar to CoC or Throne Wars etc).

How do I do this?

sentences:
Is there a pattern for writing a turn-based server communicating with n clients over sockets? I'm working on a generic game server that manages games for an arbitrary number of TCP socket-networked clients playing a game. I have a 'design' hacked together with duct-tape that is working, but seems  both fragile and inflexible. Is there a well-established pattern for how to write client/server communication that is robust and flexible? (If not, how would you improve what I have below?)

Roughly I have this:

While setting up a game the server has one thread for each player socket handling synchronous requests from a client and responses from the server.
Once the game is going, however, all threads except for one sleep, and that thread cycles through all players one at a time communicating about their move (in reversed request-response).

Here's a diagram of what I have currently; click for larger/readable version, or 66kB PDF.

Problems:

It requires players to respond exactly in turn with exactly the right message. (I suppose I could let each player respond with random crap and only move on once they give me a valid move.)
It does not allow players to talk to the server unless it's their turn. (I could have the server send them update about other players, but not process an asynchronous request.)

Final requirements:

Performance is not paramount. This will mostly be used for non-realtime games, and mostly for pitting AIs against each other, not twitchy humans.
The game play will always be turn-based (even if at a very high resolution). Each player always gets one move processed before all other players get a turn.

The implementation of the server happens to be in Ruby, if that makes a difference.

sentences:
Why am I running out of memory in D3DPOOL_DEFAULT? When trying to using my company's D3D9 renderer and allocating everything in D3DPOOL_MANAGED I would run out of memory in the 32-bit process space.

I tried using our D3D9Ex renderer and allocating in D3DPOOL_DEFAULT, but that's giving me an error of 0x8876017C (D3DERR_OUTOFVIDEOMEMORY).

I'm unclear on what this means. Is this implying that the driver will not manage anything in D3DPOOL_DEFAULT?

I have 2.5GB of AGP space and 4GB of device memory, and all of my application meshes and textures are only 2.4GB on disk. I'm only using about half of those at any given time. Is there some hidden limit I'm bumping into here?

sentences:
Color spaces: Should colors be converted to linear color before applying premultiplied alpha? For instance, when loading an image that is SRGB, which of these is correct?

Simple premultiply:

Take SRGB color from file and multiply RGB by alpha

or

Convert to linear before premultiply:

Take SRGB color from and convert RGB to Linear
Multiply Linear RGB by alpha
Take Linear RGB and convert back to SRGB

sentences:
How to use model matrix with integer coordinates I'm trying to generate a real-sized planet with WebGL. After researching, I came to the conclusion that the best way to get around 32-bit float precision issues (since GPUs don't support double precision) is to use 64-bit integer coordinates. I would generate these coordinates on the CPU, then send them as integers to the GPU. After that, I would get the position of the vertices relative to the camera by doing:

vertexPosition-cameraPosition

Since the result is small, I can now safely convert to 32-bit floating point and render it. All was good until I realised that since the coordinates are large integers, I can't multiply them by a model matrix if I want to rotate the planet around it's center since the floating point coordinates are no longer relative to the planet's center.

Is it possible to scale the model matrix by a large value, then convert it to integer, multiply by the position, and then divise by that same large value? I know there is a solution but I can't find it.

Thanks

sentences:
FXAA Shader turns image upside-down I'm trying to use an existing FXAA shader for anti-aliasing, which works, but when I try to run it, the filtered image is upside-down (vertically flipped)

[Vertex_Shader]
varying vec4 posPos;
uniform float FXAA_SUBPIX_SHIFT = 1.0/4.0;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in

void main(void)
{
  gl_Position = ftransform();
  gl_TexCoord[0] = gl_MultiTexCoord0;
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  posPos.xy = gl_MultiTexCoord0.xy;
  posPos.zw = gl_MultiTexCoord0.xy -
                  (rcpFrame * (0.5 + FXAA_SUBPIX_SHIFT));
}

[Pixel_Shader]
#version 120
uniform sampler2D tex0; // 0
uniform float vx_offset;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in
uniform float FXAA_SPAN_MAX = 8.0;
uniform float FXAA_REDUCE_MUL = 1.0/8.0;
varying vec4 posPos;

#define FxaaInt2 ivec2
#define FxaaFloat2 vec2
#define FxaaTexLod0(t, p) texture2DLod(t, p, 0.0)
#define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)

vec3 FxaaPixelShader(
  vec4 posPos, // Output of FxaaVertexShader interpolated across screen.
  sampler2D tex, // Input texture.
  vec2 rcpFrame) // Constant {1.0/frameWidth, 1.0/frameHeight}.
{
/*---------------------------------------------------------*/
    #define FXAA_REDUCE_MIN   (1.0/128.0)
    //#define FXAA_REDUCE_MUL   (1.0/8.0)
    //#define FXAA_SPAN_MAX     8.0
/*---------------------------------------------------------*/
    vec3 rgbNW = FxaaTexLod0(tex, posPos.zw).xyz;
    vec3 rgbNE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,0), rcpFrame.xy).xyz;
    vec3 rgbSW = FxaaTexOff(tex, posPos.zw, FxaaInt2(0,1), rcpFrame.xy).xyz;
    vec3 rgbSE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,1), rcpFrame.xy).xyz;
    vec3 rgbM  = FxaaTexLod0(tex, posPos.xy).xyz;
/*---------------------------------------------------------*/
    vec3 luma = vec3(0.299, 0.587, 0.114);
    float lumaNW = dot(rgbNW, luma);
    float lumaNE = dot(rgbNE, luma);
    float lumaSW = dot(rgbSW, luma);
    float lumaSE = dot(rgbSE, luma);
    float lumaM  = dot(rgbM,  luma);
/*---------------------------------------------------------*/
    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
/*---------------------------------------------------------*/
    vec2 dir;
    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));
/*---------------------------------------------------------*/
    float dirReduce = max(
        (lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),
        FXAA_REDUCE_MIN);
    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
    dir = min(FxaaFloat2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),
          max(FxaaFloat2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
          dir * rcpDirMin)) * rcpFrame.xy;
/*--------------------------------------------------------*/
    vec3 rgbA = (1.0/2.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (1.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (2.0/3.0 - 0.5)).xyz);
    vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (0.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (3.0/3.0 - 0.5)).xyz);
    float lumaB = dot(rgbB, luma);
    if((lumaB < lumaMin) || (lumaB > lumaMax)) return rgbA;
    return rgbB; }

vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
  vec4 c = vec4(0.0);
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  c.rgb = FxaaPixelShader(posPos, tex, rcpFrame);
  //c.rgb = 1.0 - texture2D(tex, posPos.xy).rgb;
  c.a = 1.0;
  return c;
}

void main()
{
  vec2 uv = gl_TexCoord[0].st;
  gl_FragColor = PostFX(tex0, uv, 0.0);
}

I'm still new to shaders - how can I modify this shader so the filtered image is displayed the correct way up?

sentences:
Multipurpose buttons As in the title, I am trying to figure out how to use a button for multiple purposes in Unity.
In my specific case for instance, I am currently using the joystick button 0 (the A button) to perform a simple melee attack:
if (Input.GetButtonDown("Fire1") && currentState != PlayerState.attack && currentState != PlayerState.stagger)
//second clause because I do not want to indefinitely attack every frame
{
    StartCoroutine(GetComponent<Player_Melee>().FirstAttack());
}

In the conditions I make sure that I am pressing the right button and determining in which state my player is (the state is then changed in the attack coroutine).
In order to interact with a given object, I created a trigger to check that the player is within range to inspect the object:
if (Input.GetButtonDown("Interact_Alt") && playerInRange)
{
    if (dialogueBox.activeInHierarchy)
    {
        dialogueBox.SetActive(false);
    }
    else
    {
        dialogueBox.SetActive(true);
        dialText.text = dialogue;
    }
}

In the Input manager settings in unity, I set the 'Interact_Alt' button to be the same as the 'Fire1' used in the attack script. The scripts actually work, however whenever I check an object I also perform an attack. How can i make so that when I want to inspect an object I do not attack?
I was considering create a new finite state similarly to the one I use to attack e.g. 'PlayerState.interact', but then I was wondering, how would unity give the priority to which command to use?
Another alternative would be to check if I am in the range of some object when I want to attack and if within range it inspects the object instead, but it seems to me a much more convoluted solutions.
How should I solve this?

sentences:
Can Unity 2D be used to make pixel-art games? I'm looking at the new 2D features introduced in Unity 4.3, and I think I might be missing something.

To me it looks like they are designed for high-res 2D games, where scaling the sprites is ok, but it is unsuitable for pixel-art games.

A pixel-art sprite is designed to be displayed exactly 1:1 pixels on the screen: scaling destroys it (linear up-scaling is an exception, i.e. you may scale it 2x, 3x, 4x etc.).

However I've found no way to "just display it as-is", apparently Unity insists in scaling it to whatever resolution it sees fit: I may control the Camera.size parameter, and the "pixels to units" parameter of the sprite, but I didn't manage to obtain this result.

sentences:
Practice openGL or learn a specific engine? Possible Duplicate:
  Should I use Game Engines to learn to make 3D games?

I am a university student.
I want to work in the game industry.
Now I am thinking about either practicing my openGL skills or learn a complete new game engine during my time in school.
I will do this by developing a smartphone game.
I am debating over using just openGL or using a game engine.
If I learn a game engine, then if the company I want to work for does not use that game engine, then wouldn't it be a waste of time to learn that game engine now instead of solidifying my openGL skills?
So, openGL or game engine?
Thanks.

sentences:
How to correctly draw a line in Unity I'm working on a game which requires me to draw a few lines from a single point that is more formally said

Given point A with coordinates x,y I draw n lines where the i-th line has the coordinates named as xi,yi. Given the LineRenderer capabilities inside Unity3D I was unable to draw more than one line from a particular point with it since it renders only polylines.

I'm currently using the Debug.DrawLine() method which successfully renders the line. I have tried using GL.Begin() as it is shown in the Unity example but I cannot see my lines being drawn.

My question is : are there any other methods for doing this? If not, can you tell me how can I show the line that is being drawn with Debug.DrawLine() inside play mode? I've saw that I could use Gizmos.DrawLine() but I didn't quite understand it's usage.

sentences:
How do I safely change properties on my skybox? Usually in Unity, when your scripts make changes to something at runtime, those changes are not persisted back to design-time.  This is generally considered a good thing.  But for whatever bizarre technical reason, this does not apply to shader properties on materials.  If you change something while the game is running, it stays changed!
Generally the way to get around this is with a MaterialPropertyBlock, which also helps avoid generating a lot of garbage.  But MaterialPropertyBlocks work with Renderers, which leaves out one rather important material: the skybox.
Right now, I have code that says RenderSettings.skybox.SetFloat("_PropName", value);, and it's incredibly aggravating because it always needs to be reset afterwards.  RenderSettings doesn't have a SkyboxRenderer property that I can use in conjunction with a MaterialPropertyBlock, so how can I change shader settings on my skybox and make them not persist after I exit play mode?

sentences: How do I get the number of online players in a Minecraft server from outside the client? I know that the Minecraft client can query the server for number of players and maximum players, even when the server properties has enable-query set to false, but how do I do this outside of the client? I am trying to implement this as part of a mobile (Android) app.

sentences:
Abstracting OpenGL concepts in a OOP language (C# + OpenGL) I have created my own C# binding for OpenGL and in doing so learned a lot about VAOs and VBOs, shaders and everything between them. Now I would like to create a game engine rendering with shader-based OpenGL. Now, I am a little bit confused on what would be the best way to abstract all those buffers and shaders to make them more easily usable. Some questions I have are:

What are the game development implications of treating the OpenGL concepts "VBO", "VAO" and "Shaders" as classes in my engine and how should they interact with each other?

sentences:
Microphone channel not detected in Unity This is very specific to Unity.

A few testers are reporting that their microphone output isn't being detected. The code below works for the vast majority of users, but certain microphones seem to be outputting on the wrong channel (R maybe)?

 AudioClip current_microphone_recording_clip = Microphone.Start(microphone_name, true, 30, 16000);

How can I capture and analyze output from several channels? I don't see any channels parameter for Microphone.Start

sentences:
Confused why draw code is clearing, pico-8 api demo In the API demo when they do the example of how to draw a colour pallette at the top of the screen:
I notice the commands don't work when used inside the draw function. When used inside of draw they showup for a second and disappear. removing the cls() allows them to stay, but I need cls included. What do i need to be doing to get the pallette to stay while using the following within the draw function?

function _draw()
       cls()
       rectfill(1,1,7,7,5)
       for i=0,10 do
          print(i,x,2,i)
          x = x + 6
       end
end

sentences:
In Photon, What happens networked GameObject's ownership when master client disconnects? I'm creating multiplayer game with Photon. When player disconnects, especially master client does, every GameObject instantiated from Master client is gone, so I can prevent with this:

PhotonNetwork.autoCleanUpPlayerObjects = false;

Now GameObjects are still there even Master is gone, but what about their ownership? I needed to destroy some of enemies when they dies, but if master is gone and other player got selected as Master, is he automatically receive ownership of them too?

If not, is there a way to do that automatically? Any advice will very appreciate it!

sentences:
Point line collision reaction I am trying to program point line segment collision detection and reaction.  I am doing this for fun and to learn.

The point moves (it has a velocity, and can be controlled by the user), whilst the lines are strait and stationary.  The lines are not axis aligned.  Everything is in 2D.

It is quite straight forward to work out if a collision has occurred.  For each frame, the point moves from A to B.  AB is a line, and if it crosses the line segment, a collision has occurred (or will occur) and I am able to work out the point of intersection (poi).

The problem I am having is with the reaction.  Ideally I would like the point to be prevented from moving across the line.  In one frame, I can move the point back to the poi (or only alow it to move as far as the poi), and alter the velocity.  The problem I am having with this approach (I think) is that, next frame the user may try to cross the line again.

Although the point is on the poi, the point may not be exactly on the line.  Since it is not axis aligned, I think there is always some subtle rounding issue (A float representation of a point on a line might be rounded to a point that is slightly on one side or the other).  Because of this, next frame the path might not intersect the line (because it can start on the other side and move away from it) and the point is effectively allowed to cross the line.

Firstly, does the analysis sound correct?

Having accepted (maybe) that I cannot always exactly position the point on the line, I tried to move the point away from the line slightly (either along the normal to the line, or along the path vector).  I then get a problem at edges.  Attempting to fix one collision by moving the point away from the line (even slightly) can cause it to cross another line (one shape I am dealing with is a star, with sharp corners).  This can mean that the solution to one collision inadvertently creates another collision, which is ignored.

Again, does this sound correct?

Anyway, whatever I try, I am having difficulty with edges, and the point is occasionally able to penetrate the polygons and cross lines, which is undesirable.  Whilst I can find a lot of information about collision detection on the web (and on this site) I can find precious little information on collision reaction.

Does any one know of any good point line collision reaction tutorials?  Or is my approach too flawed/over complicated?

sentences:
Message Passing b/w “LAN Server Only” and “LAN Client” on Different Scenes in Unity I want to pass message back and forth on client and server which are on different scenes, how can I do that in Unity?**

Following is my Scenario:-
I have 5 scenes-

BaseScene (2) OfflineScene (3) OnlineScene (4) ClientOnline (5)
ServerOnline.

All these scenes have button having text of the names of the scenes.
On Base Scene, I have add empty game object on which i have placed "customNetworkScript" which extends from "NetworkManager" script and also placed "Network Manager HUD" on it. Following is the code which i have placed in "customNetworkScript":-

public class customNetworkScript : NetworkManager {

        public override void OnClientSceneChanged(NetworkConnection conn)
            {
                SceneManager.LoadScene("ClientOnline", LoadSceneMode.Single);
                ClientScene.Ready(conn);
                ClientScene.AddPlayer(conn, 0);
            }

            public override void OnServerSceneChanged(string sceneName)
            {
                SceneManager.LoadScene("ServerOnline", LoadSceneMode.Single);
            }
    }

I have placed "OfflineScene" and "OnlineScene" in the fields, named "Offline Scene" and "Online Scene" in "Network Manager" component. Also have placed an empty prefab in "Spawn Info" in "customNetworkScript" and it has component "Network Identity" on it. Now when i run project, on one instance, I click on "LAN Server only" and on another instance, I click on "LAN Client". And I get my respective scenes on both the instances -> "ServerOnline" appear on instance where I click "LAN Server only" and "ClientOnline" appear on other instance.
What I want is, when i click on "ServerOnline" button, a message string will pass on to "ClientOnline" scene and same happens in backward direction when i click on "ClientOnline" button.

I have tried "Rpc" and "Command" but they only work when I click on "LAN Host" instead of "LAN Server Only".
I have tried very hard but couldn't find anything useful. It will be a great pleasure if someone explain to me in detail along with the code, how can I achieve this.

ThankYou Very Much for Your Time.

sentences:
Changing distance after some time on OnGUI Unity Though I am using IEnumerator to calculate the distance travelled value, the distance is updated very frequently, how can I change that? and why exactly increasing the time in WaitForSeconds function not changing the behaviour?

    void OnGUI ()
    {
        GUI.contentColor = Color.black;
        GUI.Label (new Rect (40, 40, 140, 40), "Speed : " + _speed, "color");
        StartCoroutine (distancetravelled ());
        GUI.Label (new Rect (40, 100, 100, 140), "Dist : " + Mathf.RoundToInt (distance * 1000) + " Kms", "color");

    }

    IEnumerator distancetravelled ()
    {
        timeInHours = (Time.smoothDeltaTime / 60) / 60;
        if(PlayerControl.collision != true)
        distance += _speed * timeInHours;
        yield return new WaitForSeconds (60);
    }

sentences:
How can I spawn monsters at random locations? I made a little 2D shooter game for my iPhone. I want monsters to spawn at random locations.
But I don't have any clue where to start to make them spawn.

I already made the monster image and everything and everything works, but there's only one monster at the start of the game and when it dies he will not spawn again.

sentences:
2d array with empty elements I am working on a game with a number of different grid components. Each grid would be about 15 squares wide by 15 squares tall. Each of the squares may either contain an item or not.

Is there any way to create this array and only include the components that have a value. Example (for a 5x5 array):

[
   [5,3, , ,3],
   [ ,1,0,2,2],
   [ , , , , ],
   [5, , ,2, ],
   [ , , , ,1]
]

Is there any way to do this in JavaScript or should I just add a bunch of NULL values to the array?

A simplified version of this, might be an Xs and Os game. Before the game starts all squares are empty. Over time, some of the grid may have either Xs or Os in specific squares.

sentences: How do I maintain an online users list? In a multiplayer JavaScript game client, is it a good idea to poll the server periodically to refresh online user list, or keep track of joined/left users? Is there a better option?

sentences:
Transformation matrix that maps a window I'm currently learning OpenGL at uni, and they give us questions to help us learn (these are not worth anything), however I'm stuck on this one question and would have to travel over an hour and a half to uni for an answer.

How do I do this question? Please include as many steps as you can, I want to be able to follow exactly how to do this.

Find the transformation that maps a window whose lower left corner is at (1,1)
and upper right corner is at (3,5) onto:

The entire device screen whose dimension is (600, 500)
A viewport that has lower left corner at (100,100) and upper right corner
at (400,400)

Edit: Damn sorry I should have added I am meant to find the matrix, so no code.

sentences: What does a linear transformation preserve? They say an affine transformation preserves points, lines, parallel lines etc. I can see this if I think in terms of translation [Is there any other affine transformation you can give as an example, btw] But, what does a linear transformation preserve? By its definition, it seems like they preserve vector space structure. Geometrically what does that correspond to? For example, some of them preserve angles and distance but not all of them. Some preserve linear independence but I am guessing not all of them. What geometric property all of these linear transformations preserve?

sentences:
Version Not Final, Does Not Represent Actual Game Footage? Just curious about this.  Frequently, a lot of gameplay videos from big studios have small subtitled text at the lower part of the screen, reading something like:

Pre-Alpha Gameplay -- Footage not Final
Game Footage not Final
Pre-Alpha, Game here is not final

Is there some sort of reason they do this?  Is there some sort of legal ramification that they need to go through by adding this?   I have especially seen some gameplay vids whose titles are "Alpha x.x.x", yet still, in the video itself, it always something like "footage not final, game may change".

sentences:
I want to make a moddable game. How does this affect my programming language choice? I have been getting started making some small games in Java, and I am considering learning C# for a bigger project. I would very much like to make a moddable game, but someone told me that I need to stick with Java if I want the game to be moddable, though I don't understand why.

So, what programming language characteristics make a language more suited to moddable games?

sentences:
Animation works, but Unity doesn't realize it I have an animation which plays once, and it played once just fine.  I want to Invoke a method as soon as the animation finishes.  I have been researching and experimenting for over an hour now, but without the result I want.  I try to get the animation from the Animator, but Unity says my animation is not attached.  The thing is, I don't care if it's attached...I just want to know how long it is, not actually do anything with it.  How can I achieve this?  Here is the code which results in the error:

CODE:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(PolygonCollider2D))]
[RequireComponent(typeof(Animator))]
public class Construction : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        Invoke("EnableObstacleState", GetComponent<Animator>().animation.clip.length);
    }

    private void EnableObstacleState()
    {
        GetComponent<PolygonCollider2D>().enabled = true;
    }
}

ERROR:

MissingComponentException: There is no 'Animation' attached to the "Barricade(Clone)" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "Barricade(Clone)". Or your script needs to check if the component is attached before using it.
Construction.Start () (at Assets/Scripts/Construction.cs:11)

sentences:
Regarding BGE (Blender Game Engine), is it possible to generate a single .exe file from multiple files linked together? Would any of you guys or gals know the answer, please?

I know one can generate a .exe (windows executable) file from a single blend file. My question is very simple: Can anyone generate a single .exe file from multiple blender files of a same project?

For instance, say I have a project folder with several subfolders and files from my project game. Each folder has specific elements like scenes, models, textures, etc. They are all linked together to form the final game. Now I want to generate a single .exe file for my game. Is this possible?

Or, rather, should I make an entire game inside a single .blend file? (It seems like a very unlikely arrangement, maybe even impossible, but I rather ask). Or maybe even create a master .blend file from where to link all data and when project is finished pack everything before generating the executable (.exe)?

sentences: How to play animations in Cocos2d-x? I'm new to Cocos2d-x and looking for a good way/tutorial on how to play animations in Cocos2d-x.

sentences:
How can I get the player coordinates in Minecraft I am currently working on a client for Minecraft Java edition and I'm having an issue finding out how I can get my Minecraft character's current coordinates, client side coordinates.

I would just like to know where I can find the file that contains the coordinates, or a way to get the coordinates, without using forge, or anything like that. Just vanilla Minecraft. The Minecraft version I am working with is 1.8.9, but I would like this to work for any version of the game.

sentences:
Creating a space game. Need help with a solution for creating dynamic spiral graphics My friend and I are working on a web based game where we want to have a blackhole-like thing rendered in some form of an engine or 3D program for us to freely manipulate adding more "arms" making it smaller or bigger and playing around with its light.

Here's a picture of our concept of the graphic element:

(smaller black hole:)

(larger black hole:)

We want help to find the best possible solution for this, and possible also some kind on guide to create these elements. So far everything is designed in photoshop but if we want the hole to be dynamic we can't use pictures.

sentences:
How does networking in XNA work? I am quite confused over how networking works in XNA. I'm currently developing a game for Xbox. I want to create a multiplayer environment and read some tutorials about it.

But I'm confused over how packets are transmitted over the network - E.g.; what is the difference between a LocalNetworkGamer, a NetworkGamer and a LocalGamer? Why do I need to iterate over all LocalGamers when reading packets?

I know that's not a typical SE question, but can anyone point to a tutorial that explains how the networking operates as opposed to how to use it?

sentences:
Transfer Codes between OS I'm making a mobile game and had the idea of using transfer codes for taking one account to another device.

Lately, I've seen this function being used in a lot of mobile games, you go to the game settings, issue a transfer code, input it in the new device and the game account is transferred. However it's not clear for me as to how this works? since many games I have seen with this function can't transfer premium currency between different OS, for example. Or some of them, after transferring the game disable the old device from transferring back the same account before certain time has passed.

I have been looking for some information about this system but haven't been able to find out anything. So I was hoping if anyone could point me into the right direction, specially in the point about currency transfer between different OS.

Edit: I'll try to be a little more clear about the issue. I want to have a feature where the user cas generate a code to transfer his account or progress to another device, that's it.

The other question I had was because this kind of systems do exist actually. Mostly on games developed in Asia. They allow you to transfer your progress this way to any other device BUT if you do this from one OS to another normally you can keep your progress intact but not the in-game currency. So I was wondering why

sentences:
Handling packet impersonating in client-server model online game I am designing a server-client model game library/engine.

How do I, and should I even bother to handle frequent update packet possible impersonating?

In my current design anyone could copy a packet from someone else and modify it to execute any non-critical action for another client.

I am currently compressing all datagrams so that adds just a tad of security.

Edit: One way I thought about was to send a unique "key" to the verified client every x_time and then the client has to add that to all of it's update packets until a new key is sent.

Edit2: I should have mentioned that I am not concerned about whether the actions described in the packet are available to the client at the time, this is all checked by the server which I thought was obvious. I am only concerned about someone sending packets for another client.

sentences:
Instantiate works fine in Editor and does not work after building game Here is the situation, In my project everything works fine. After I build the game for windows, the prefab does not instantiate. I don't know which part I missed.
This is how I load the prefab from Resources folder
private void Awake()
{
    areaButtonPrefab = Resources.Load<GameObject>("Prefabs/AreaButton1");
}

And this is how I instantiate prefab for each data in a List
public void SetAreaToUI()
{
    foreach (var j in areaList)
    {
        cloneItem = Instantiate(areaButtonPrefab, originalRect.position, new Quaternion(0, 0, 0, 0), rect);
        TMP_Text text = cloneItem.GetComponentInChildren<TMP_Text>();
        AreaButtonData buttData = cloneItem.GetComponent<AreaButtonData>();
        buttData.area = j;
        text.text = j.areaName;
        cloneItem.SetActive(true);
        cloneItems.Add(cloneItem);
     }
}

sentences:
Facilitator UI on desktop screen for VR Hey and thanks in advance for any help/pointers

The solution is probably straight forward but i am still a little inexperienced (while creating quite a few different VR unity projects mostly study related, i never really build anything so the editor allowed for some shortcuts. see below).

I am currently developing for Windows mixed reality with unity. I am struggling to figure out how to make a (possibly secondary) application window run on the desktop that can be used during facilitated VR-experiences to change settings and generally provide facilitator input to the application while the participant would just perceive the VR world.

Edit:
I have a similar project that is developed with Steam_vr library / Open_VR that works exactly as expected and portrayed by the unity editor; i.e. the desktop will shows the ingame footage + the screenspace overlay UI (which is interactable).Nevertheless quite a few features where implemented with the MixedRealityToolkit so I'd prefer to stick with that. And was wondering if there is a way to achieve the same/similar behavior with it.

Now with MRTK everything works straight forward when running from unity editor just making a canvas screenspace will prevent it from showing in vr while it can still be interacted with. the problem is that the facilitators themselves are a third party and having a build would just make their handling of the solution much easier. Not to mention performance gains from building and cleaning the project(?).

it will probably come down to creating a secondary window that runs on the desktop since my understanding is that uwp with MRTK just runs in the wmr portal rather than a separate app; and that the WMR portal simply copies the Headset render to the desktop. But i am completely blank on how to achieve this and was hoping that someone might have struggled with this before. But i couldn't really find anything. I'd prefer not to have to resolve to Networking, and will attempt to convert to Steam_VR /OpenVR in the meantime..

sentences:
Handling input in a custom ECS engine I've been implementing an Entity Component System into my custom toy engine so I can learn more about it. Currently I have the following problem:

I can't think of a way of implementing input as a system. Currently I just check for key presses in the main loop, like this:

if (glfwGetKey(Window, GLFW_KEY_A) == GLFW_PRESS)
    Camera.Translate(glm::vec2(-5.0f, 0.0f) * static_cast<float>(DeltaTime));

Here I check if key A is pressed, and if it is I move the camera, which isn't a component associated with an entity.

So what I thought is creating an Entity with a Input component associated (this component would have mouse coordinates, keys pressed, etc):

ECS::Entity * InputManager = EntityWorld->create();
InputManager->assign<Input>();

Then, each frame, after polling events, I would update the Entity directly like this:

InputManager->get<Input>()->MousePosition = MousePosition;
InputManager->get<Input>()->MouseWheelDelta = MouseWheelDelta;
....

Then, I'd have an InputSystem, where I can check mouse position, if some key is pressed, etc. But what I don't understand is, if the camera is not a component, how could I make it move now that I handle input through the InputSystem?  If I make the camera a component, how would I implement all the functionality to move it around, and zoom in and out?

Let me know if something it's not clear.

sentences:
Animator from another gameobject keeps disappearing from script on play I am working on a gun script and it worked fine until earlier today when I made a change to the script and it stopped working. I put it back, but for some reason now the animator object attached to the script keeps disappearing.

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

public class RifleShooting : MonoBehaviour
{
    private float NextTimeToFire = 0f;
    private int CurrentAmmo;
    private bool IsReloading = false;

    [Space(10)]
    [Header("Floats")]
    public float Damage = 10.0f;
    public float Range = 100.0f;
    public float ImpactForce = 60f;
    public float FireRate = 15f;
    public float ReloadTime = 1.0f;

    [Space(10)]
    [Header("Others")]
    [Space(5)]

    [Space(10)]
    [Header("Others")]
    [Space(5)]
    public int MaxAmmo = 10;
    public Camera FPSCamera;
    public Animator GunAnimations;
    public ParticleSystem MuzzleFlash;
    public GameObject impactEffect;
    public bool AllowedToShoot = true;
// Start is called before the first frame update
    void Start()
    {
        GunAnimations = GetComponent<Animator>();
        if (CurrentAmmo == -1)
            CurrentAmmo = MaxAmmo;
    }

    private void OnEnable()
    {
       IsReloading = false;
        GunAnimations.SetBool("Reloading", false);
    }
    // Update is called once per frame
    void Update()
    {
        if (IsReloading)
        return;

        if (CurrentAmmo <= 0)
        {
            StartCoroutine(Reload());
            return;
        }

        if (AllowedToShoot == false) return;
        {
            if (Input.GetButton("Fire1") || Input.GetButtonDown("Fire1") && Time.time >= NextTimeToFire)
            {
                NextTimeToFire = Time.time + 1f / FireRate;
                Shoot();
            }
        }
    }

    IEnumerator Reload()
    {
        IsReloading = true;
        Debug.Log("Reloading...");
        GunAnimations.SetBool("Reloading", true);
        GunAnimations.SetBool("IsShooting", false);
        yield return new WaitForSeconds(ReloadTime - .25f);
        GunAnimations.SetBool("Reloading", false);
        yield return new WaitForSeconds(.25f);
        GunAnimations.SetBool("IsShooting", true);
        CurrentAmmo = MaxAmmo;
        IsReloading = false;
    }

    void Shoot()
    {
        //shooting script here
    }
}

Also if it helps here is what I see in the console when I try to fire:

MissingComponentException: There is no 'Animator' attached to the "M4A1" game object, but a script is trying to access it.

sentences:
What makes it hard to protect from hacks/bots in BF3 and Quake Live? After playing these games, asking other players/admins, and reading online I am led to believe that Quake Live and Battlefield 3 are frequented by bots and there are plenty of hacks of various kinds. I'm confused how this is possible, or even easy seeing how many players have access to these kinds of "tools" (sic).

Isn't it possible for the game authors to digitally sign the game executables so that when they run, the server can ensure only the allowed client is sending commands, thus preventing any kind of abuse? I.e. every player command would be signed by a private key, or symmetrically encrypted (not sure which would make more sense).

I understand that players can look at the running executable's behavior (memory etc.), but if games are apparently so easy to hack, shouldn't most apps be hacked as well (e.g. Skype, all DRM running on Windows etc.)?

sentences:
How can a resource manager have dynamic loading/unloading without creating dangling pointers? I have a resource manager that manages the lifetime of resources in memory. A "resource" is something like a texture, mesh, et cetera. I also have an entity class that, the base class for things in my game world, which has pointers to individual resources.

I'm thinking about giving my resource manager a memory quota so it can free and reload resources as it needs to in order to satisfy this quota, and I'm wondering how I could go about this without ending up with dangling pointers in my entity objects.

I'll need the ability to free up a mesh or texture at any time in the resource manager.

I could use shared_ptr in the resource manager and weak_ptr in the entities (as long as I don't expose a shared_ptr out side of the resource manager, I'd still get the ability to free them on demand), but I am more interested in how you would do it without those classes, for example before C++11 existed or before Boost's smart pointer library existed.

sentences:
Client and Server game update speed I am working on a simple two player networked asteroids game using XNA and the Lidgren networking library. For this set up I have a Lidgren server maintaining what I want to be the true state of the game, and the XNA game is the Lidgren client. The client sends key inputs to the server, and the server process the key inputs against game logic, sending back updates. (This seemed like a better idea then sending local positions to the server.) The client also processes the key inputs on its own, so as to not have any visible lag, and then interpolates between the local position and remote position.  Based on what I have been reading this is the correct way to smooth out a networked game. The only thing I don’t get is what value to use as the time deltas.

Currently every message the server sends it also sends a delta-time update with it, which is time between the last update. The client then saves this delta time to use for its local position updates, so they can be using roughly the same time deltas to calculate position updates.

I know the XNA game update gets called 60 times a second, so I set my server to update the game state at the same speed. This will probably only work as long as the game is working on a fixed time step and will probably cause problems if I want to change that in the future. The server sends updates to clients on another thread, which runs at 10 updates per second to cut down on bandwidth.

I do not see noticeable lag in movement and over time if no user input is received the local and remote positions converge on each other as they should.  I am also not currently calculating for any latency as I am trying to go one step at a time.

So my question is should the XNA client be using its current game time to update the local game state and not being using time deltas sent by the server?  If I should be using the clients time delta between updates how do I keep it in-line with how fast the server is updating its game state?

sentences: Unity - Blender models/animations showing gaps As part of a college project, a member of my group has made some simple chests with an open animation. Importing these into Unity though, I instantly noticed there were gaps where the faces should be. After a bit of experimenting, I figured it was because the Normals were facing the wrong way. The outside seemed fixed, but faces were missing when the chest opens during its animation. I'm guessing the inside of the chest will need another layer of faces with the Normals facing the right way...? Though surely this would means having doubles...?

sentences:
Field of view or resolution? I'm new to CG and I'm building a ray tracer.

I don't quite understand how to set camera parameters and film(pixel plane) parameters.

Say I want to get an image of 400x300 resolution. I can set an fov, and then the distance between the film and camera can be calculated.

If that's true, a high resolution and a "reasonable" fov, e.g 80 degree, will result in a large distance. Does that makes the object small on the final image?

And I feel like people like to determine resolution at first, in order to get an expected image size. To avoid distortion of objects(fish eye), the fov cannot be too large.

So how do I get close look of an object on a high resolution image?

I think the rasterization way is different from ray tracing one since I can project an object into NDC(normalized device coordinate) to make it big, but what about ray tracers?

sentences:
Unity - AudioClip lags when played My AudioClip is lagging when I play it in Unity3d. The AudioClip is supposed to play when you left-click inside the game window.

Steps I've tried for fixing it:

Uncompressing the .wav sound file.
Setting the clip variable of an AudioSource to a clip and then playing the sound, but that's a different story.

How the issue occurs: When I start the game, on the first click it plays fine. But then after a few clicks, it starts slowing down and/or lagging.

This is my code:

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

[RequireComponent(typeof(AudioClip))]
[RequireComponent(typeof(AudioSource))]

public class GameProcess : MonoBehaviour {

    public Canvas Game;
    public AudioClip explosion;
    AudioSource beatBox;
    Transform btn;
    Vector3 canvasMin;
    Vector3 canvasMax;
    Vector3 pointerMin;
    Vector3 pointerMax;
    Vector3 pointerPos;

    void Start () {
        btn = Game.transform.FindChild("Pointer");
        canvasMin = Game.GetComponent<Collider>().bounds.min;
        canvasMax = Game.GetComponent<Collider>().bounds.max;
        pointerMin = btn.GetComponent<Collider>().bounds.min;
        pointerMax = btn.GetComponent<Collider>().bounds.max;
        beatBox = GetComponent<AudioSource>();
    }

    void Update () {
        if (Input.GetMouseButton(0))
        {
            beatBox.PlayOneShot(explosion);
        }
        if (!(pointerMin.x <= canvasMin.x) || !(pointerMin.y <= canvasMin.y))
        {
            if(!(pointerMax.x >= canvasMax.x) || !(pointerMax.y >= canvasMax.y))
            {
                btn.transform.position = Input.mousePosition;
            }else
            {
                btn.transform.position.Set(pointerPos.x - 1, pointerPos.y - 1, 0);
            }
        }else
        {
            btn.transform.position.Set(pointerPos.x + 1, pointerPos.y + 1, 0);
        }
    }
}

sentences: Loading files while running game I am curious as to what technique(s) are used to load files in while a game is running. For example, Minecraft will load chunks as you get within a certain range of them. How is this achieved without producing lag? Is multithreading involved?

sentences: How many directional lights in Unity In Unity, how many directional lights can be active at once? 1, 2, 4, or 8? I thought 2, but I have searched and cannot confirm.

sentences:
Unity3D (5.1) NavMesh Agent Error This is my first post in GameDev StackExchange, so please excuse me if I make any mistakes on best practices here (if I do, please refer me so I can learn).

I'm making a prototype where I have 2 types of enemy units: Uninfected and Infected. The Uninfected are to seek out Infected via AI pathfinding. However, I came across an issue when implementing the NavMesh in the scene. If the Player collides with an Uninfected, they go flying backwards. If they hit the walls, the walls collectively get hit. Here's some screenshots.

Example 1:
http://s7.photobucket.com/user/Korudo/media/GameDev/RoboInfect%20Scene%20-%20WallWeirdness1_zpsg0k2wbyk.png.html

Example 2:
http://s7.photobucket.com/user/Korudo/media/GameDev/RoboInfect%20Scene%20-%20WallWeirdness1_zpsg0k2wbyk.png.html

Thanks in advance.

sentences:
Calculate The Proper X and Y Coordinate I have a class called Tile, the constructor takes an integer that represents the tile's
type. You can load a tileset ( via loadTileset() ) which initalizes the fields -

tileset
numOfTiles
tileWidth
tileHeight

My question is, in the constructor, depending on the type variable. How do I figure out the proper x and y cooridates to uses in the getSubimage() method.

So for example, if type is set to the value 2, I'd want to get the x and y position of the upper-left corner of number two.

import java.awt.image.*;
import java.awt.*;
import java.io.*;
import javax.imageio.ImageIO;

public class Tile {

private int type;
private BufferedImage tile;

// tileset attributes
public static BufferedImage tileset;
public static int numOfTiles;

public static int tileWidth;
public static int tileHeight;

// constructor
public Tile(int type) {

    // contruct tile
    this.type = type;
    // ...
    tile = tileset.getSubimage(0, 0, tileWidth, tileHeight);
}

public static void loadTileset(String filename, Dimension tileSize) {

    // load tileset
    try {
        tileset = ImageIO.read(new File(filename));
    }
    catch(Exception e) {
        e.printStackTrace();
    }

    // initalize attributes
    tileWidth  = (int) tileSize.getWidth ();
    tileHeight = (int) tileSize.getHeight();

    numOfTiles = (tileset.getWidth() / tileWidth) * (tileset.getHeight() / tileHeight);
}
}

sentences:
How to make a game without OOP? I am currenty studying game development and practicing making games.

I use a lot of OOP in my games. For example, each missile that is shot is an instance of a Missile object, and added to a list of Missile objects. Each tank in the game is a Tank object. Etc.

The entire design of the program is based on this. For instance, having a list of Missile objects allows me every frame to move the missiles, draw them, etc. And having an instance of a Tank object for every tank allows me to check for each tank if it collides with something, etc.

It's hard for me to imagine how a game (which is more complex than Pac-Man) could be programmed in a non-OO language. (With no disrespect to non-OO programmers of course). Not only in terms of how long it will take, but mostly in terms of how a game could be designed this way.

I can't imagine designing a game without using object oriented programming, because my entire understanding of how to design a game-program is based on OOP.

I would like ask: Today, are there any games that aren't programmed using OOP, in a similiar fashion to what I described above? Are there any 'professionl' games that don't use OOP as a major factor in the development process?

If so, could you give me an idea of how, for example, collision detection between a tank and N number of missiles could be implemented, without OOP?

sentences:
How can the player select his weapon among many? I'm working on the prototype of my game, I want one of the options to have a very large amount of weapons. I have searched for tutorials, but I have only found weapons changes where the weapons have already been loaded in the scene from the inspector, like this https://youtu.be/Dn_BUIVdAPg where they are only activated and deactivated.
But I want a game like dofus where there are hundreds of weapons, I think I have a data file of the weapons and so, I can load the correct model of the weapon.
How can I get the model loaded?

I have read other tutorials regarding the AssetBundle, but I think that is when you need to download the models from a server for example, but I just want to load them from the same project.

sorry for the bad english

sentences: Using IPAD's as controllers for a Unity game We are making a Multiplayer game using Unity. The actual game would be run from a PC projected on a screen and the players would be using their respective Ipad as a controller to play the game. I am not sure how difficult this would be to achieve inside Unity but I am assuming that all the game data inside Unity would need to be fed and retrieved from some kind of a server. How would this be possible with Unity because each Ipad would have a separate Unity build and also a separate build for the PC from where the actual game would be running.

sentences:
Sending entities to connecting player When a player connects to a game, he needs to be sent all the entities currently on the map. This is done by creating entities one by one. Three ways of implementing this come into my mind. Which one them is the best?

1) Implement sending entities in the game engine: Game engine listens to "connected" event from a player object and send all the entities to the player when this happens.

2) Implement sending entities in the entity class: Entity listens to "player connected" event from the game engine and when this happens, it sends itself to the connecting player.

3) Implement sending entities in the player class: When a player connects, it gets list of entities from the game engine and sends each of them to itself.

sentences:
Unity: How to apply bloom to only some objects in the scene? In my game I want to apply bloom, from the standard assets, to only a few objects in the scene. To do that, I set up 2 cameras at the same position and orientation, one with the bloom component and the other without. Then I put the blooming objects on a "Bloom" layer, set the blooming camera to only render objects on this layer, and the main camera to render everything else.

Then I noticed that, if the main camera has a depth lower than the bloom camera, then the bloom camera will apply bloom to everything in the scene. I guess that's because the bloom effect works on everything rendered up to the point the script is executed.

So I made sure that the bloom camera has the lowest depth and clears with a solid color. Main camera does not clear. However, now I lose the illuminated pixels around the blooming objects. I guess they are overwritten by the main camera, since the blooming camera probably did not give them any depth.

Here's a simple scene to illustrate the problem:

Currently the game looks like this:

If I swap the configuration of the 2 cameras (Main camera: lower depth, clear with solid color; Bloom camera: higher depth, don't clear), the game looks like this (exaggerated for demonstration):

What I want is the yellow object to look like that in the last image, and the purple object to look like that in the second last image. How?

Because of company policies, I am limited to Unity 5.4.1f1, and cannot use anything not made by Unity in the Asset Store.

sentences:
Applying Transformation Matrices to VBOs in OpenGL So I've recently tried to add Vertex Buffer Object Matrix transformation to an OpenGL engine I'm working on. I could go about this by applying the matrix to a copy of each vertex individually, but this would take a lot of CPU resources, so I am trying to implement transformation natively using OpenGL. This code works:

    /// <summary>
    /// Sets up the required OpenGL settings so as to create the necessary environment for the models to work (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public static void Setup(Size viewPort, ref Matrix4 camera) {
        GL.MatrixMode(MatrixMode.Projection);
        GL.PushMatrix();
        if (!(viewPort.Width == 0 || viewPort.Height == 0)) {
            Matrix4 matrix;
            Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver3F, (float) viewPort.Width / viewPort.Height, 0.01F, long.MaxValue, out matrix);
            GL.LoadMatrix(ref matrix);
        }
        GL.MatrixMode(MatrixMode.Modelview);
        GL.PushMatrix();
        Camera = camera;
        GL.LoadMatrix(ref Camera);
        GL.Enable(EnableCap.DepthTest);
        GL.Enable(EnableCap.Lighting);
    }

    /// <summary>
    /// Renders the model (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public override void Render() {
        if (IsVisible) {
            /*Matrix4 matrix = Matrix4.CreateTranslation(location);
            GL.MultMatrix(ref matrix);*/
            if (Cull)
                GL.Enable(EnableCap.CullFace);
            else
                GL.Disable(EnableCap.CullFace);
            texture.Bind();
            if (DataBuffer == 0) {
                GL.GenBuffers(1, out DataBuffer);
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
            } else {
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                if (UpdateFrame) {
                    GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
                    UpdateFrame = false;
                }
            }
            IndexBuffer.Bind();
            GL.VertexPointer(3, VertexPointerType.Float, Vertex.SizeOfVertex, IntPtr.Zero);
            GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.SizeOfVertex, TexturePointer);
            GL.NormalPointer(NormalPointerType.Float, Vertex.SizeOfVertex, NormalPointer);
            GL.DrawElements(BeginMode.Triangles, IndexBuffer.Count, IndexBuffer.Format, IntPtr.Zero);
            GL.Disable(EnableCap.CullFace);
            //GL.LoadMatrix(ref Camera);
        }
    }

    /// <summary>
    /// Resets the OpenGL settings set by calling Setup().
    /// </summary>
    public static void Reset() {
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();
    }

First Setup() is called to set up the projection matrix, then several meshes are rendered using the Render() method, then Reset() is called at the end to restore the matrices before I swap the buffers to the window.

However, when I comment out the commented lines in order to apply a simple translation matrix, I only get flickers all over the window. I tried using GL.Push() and GL.Pop() at the beginning and end of the Render() method, but to no avail. I also tried using GL.LoadIdentity() first and GL.MatrixMode(MatrixMode.Projection), but still no success.

Can anyone be kind enough to point out the mistake in my code please?

sentences:
problem loading Collada DAE model using Assimp in OepnGL 4.4 I am loading a model in my OpenGL application using Assimp library like this :

bool CGameObject::LoadModelFromFile(char* sZFilePath)
{
std::string fn = sZFilePath;
std::string td = "\\";
std::string mfn = _getcwd(NULL, 0) + td + fn;
Assimp::Importer importer;
const aiScene* scene = importer.ReadFile(mfn,
    aiProcess_CalcTangentSpace      |
    aiProcess_Triangulate           |
    aiProcess_JoinIdenticalVertices |
    aiProcess_SortByPType);

if (!scene) {
    return false;
}

const int iVertexTotalSize = sizeof(aiVector3D) * 2 + sizeof(aiVector2D);
int iTotalVertices = 0;

for(UINT i = 0; i < scene->mNumMeshes; i++) {
    aiMesh* mesh = scene->mMeshes[i];
    int iMeshFaces = mesh->mNumFaces;
    for (UINT f = 0; f <iMeshFaces; f++) {
        const aiFace* face = &mesh->mFaces[f];
        for (UINT k = 0; k < 3; k++) {
            aiVector3D pos = mesh->mVertices[face->mIndices[k]];
            Model.vertices.push_back(pos.x);
            Model.vertices.push_back(pos.y);
            Model.vertices.push_back(pos.z);
        }
    }
}

// VAO
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);

// VBO
glGenBuffers(1, &m_vbo);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
glBufferData(GL_ARRAY_BUFFER, this->Model.vertices.size() * sizeof(GLfloat), &this->Model.vertices[0], GL_STATIC_DRAW);
glVertexAttribPointer((GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);

// unbind buffers
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);

// return success when everything is loaded
return true;
}

and then render it like this :

for (GameObject::iterator i = GameObjects.begin(); i != GameObjects.end(); ++i)
{
    CGameObject* pObj = *i;
    glUniformMatrix4fv(MatrixID, 1, GL_FALSE, GetMVPMatrix(pObj->position));

    glBindVertexArray(pObj->m_vao);
    glVertexAttrib3f((GLuint)1, 1.0, 0.0, 0.0); // set constant color attribute
    glDrawArrays(GL_TRIANGLES, 0, pObj->Model.vertices.size());

}
.
.
.

// function used to set MVP matrix
GLfloat* GetMVPMatrix(glm::vec3 position)
{
glm::mat4 Model = glm::translate(mat4(1.0), position);
glm::mat4 MVP3 = Projection * View * Model;
return &MVP3[0][0];
}

I created and exported my model using Blender. if I use OBJ format then it is rendered correctly :

but with DAE format it is like this :

My model has 5 meshes and debugging in Visual Studio shows that all 5 meshes are loaded.

Loading the DAE file in assimp_viewer shows the model file has been exported correctly :

Where am i doing it wrong ?

sentences:
Orbital mechanics: orbit as a function of time. Universal variable formulation? I am trying to model a two dimensional orbit for a two body Kepler problem but have gotten stuck when introducing the time variable.

For a satellite with known semi major axis (a), eccentricity (e), and true anomaly (theta), I have:

r = a*(1-e**2)/(1+e*cos(theta))

How can I calculate theta as a function of time using the Wiki suggested  Universal variable formulation method?  I have no idea how to implement (am using Python but any algorithm advice much appreciated!)

Alternatively, how do I calculate r as a function of time?

Note: All other orbital elements and masses are available. Also I am trying to come up with a general solution for elliptical, hyperbolic and parabolic orbits.

Cheers!

sentences:
OpenGL - Understanding the relationship between Model, View and World Matrix I am having a bit of trouble understanding how these matrixes work and how to set them up in relation to one another to get a proper system running.

In my understanding the Model Matrix is the matrix of a object, for example a cube or a sphere, there will be many of these in the application/game.

The World Matrix is the matrix which defines the origin of the 3D world. the starting point.

And the View Matrix is the "camera" everything gets translated with this to make sure you have the illusion of an actual camera when in fact everything is moving instead of this matrix?

I am a bit lost here. So I was hoping someone here could help me understand this properly.

Does every modelMatrix get translated/multiplied with the world matrix and the worldMatrix then with the viewMatrix? Or does every modelMatrix get translated/multiplied with the viewMatrix and then that with the worldMatrix?

How do all these matrixes relate and how do you set up a world with multiple objects and a "camera"?

EDIT:

Thanks a lot for the feedback already. I did some googling aswel and I think I do understand it a bit better now, however would it be possible to get some pseudo code advice?

projectionMatrix = Matrix;
makePerspective(45, width, height, 0.1, 1000.0, projectionMatrix);

modelMatrix = Matrix;
identity(modelMatrix);
translate(modelMatrix, [0.0, 0.0, -10.0]);  // move back 10 on z axis

viewMatrix = Matrix;
identity(viewMatrix);
// do some translation based on input with viewMatrix;

Do I multiply or translate the viewMatrix with the modelMatrix or the other way around? and what then? I currently have a draw method up in such a way that it only needs 2 matrixes for arguments to draw.

Here is my draw method:

draw(matrix1 matrix2) {

            bindBuffer(ARRAY_BUFFER, cubeVertexPositionBuffer);
            vertexAttribPointer(shaderProgram.getShaderProgram().vertexPositionAttribute, cubeVertexPositionBuffer.itemSize, FLOAT, false, 0, 0);

            bindBuffer(ARRAY_BUFFER, cubeVertexColorBuffer);
            vertexAttribPointer(shaderProgram.getShaderProgram().vertexColorAttribute, cubeVertexColorBuffer.itemSize, FLOAT, false, 0, 0);

            bindBuffer(ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);

            setMatrixUniforms(shaderProgram, matrix1, matrix2);

            drawElements(TRIANGLES, cubeVertexIndexBuffer.numItems, UNSIGNED_SHORT, 0);

}

What are those matrixes suppose to be?
Thanks a lot in advance again guys.

sentences:
In Game Maker Studio, why does the image rotation have to be performed every step? I'm a software developer who's trying to get into game development casually on the side. I picked up Game Maker Studio a while ago on a Steam Sale, and I'm finally getting into using it, especially after hearing that games like Undertale and Hotline Miami were products of said studio. I'm going through Shaun Spalding's Game Maker tutorials to familiarize myself with some of Game Maker's features and GML's coding syntax.

Following this tutorial, I rolled my eyes a little when he said to put the image_angle = direction; in the step event for my object rather than the creation event to rotate my object's sprite. "Why would you want to set a variable to the same value every frame when you could just set it once upon creation?" I thought to myself in my apparent naivety. But lo and behold, when running my project, the images aren't rotated if the image_angle = direction; is in the create event, and not the step event. Why? If image_angle is a member of my bullet object, shouldn't I be able to set it once upon creation? Or does it somehow reset on every frame?

sentences:
Texture rebind on android cause potential memory leak? After context lost, I have to rebind all my textures. I want to it the correct way, so I check each handle for availability. It's done by calling unloadFromVram(), and then loadToVram()

first unload:

public final void unloadFromVram()
{
    GLContextState.forgetTexture(handle); // invalidate cache

    if (glIsTexture(handle)) // check whether handle is still a texture instance.
    {
        glDeleteTexture(handle); // delete handle if it is a texture instance.
        handle = GL_NONE;
    }
}

upload again:

public final void loadToVram()
{
    handle = glGenTexture();

    GLESContextState.activateTextureInSlot(0, handle); // GL.glActiveTexture(glSlot) and GL.glBindTexture(GL.GL_TEXTURE_2D, texture);

    if (owner.isCompressed())
    {
        glCompressedTexImage2D(GL_TEXTURE_2D, 0, format, textureData.getWidth(), textureData.getHeight(), 0, textureData.bytes);
    }
    else
    {
        glTexImage2D(GL_TEXTURE_2D, 0, format,textureData.getWidth(), textureData.getHeight(), 0, format, type, textureData.bytes);
    }
}

What have I investigated:

After doing so, most of my textures appears black or have invalid content (perhaps from other textures, or content which was bound to this handle before suspend).
If glIsTexture(handle) fails, and the handle has not to be deleted - the texture behaves just fine.
If I comment the whole check and deletion in unloadFromVram() - everything works just fine.

I suppose, if I won't delete bound handle - it will cause a memory leak, due to texture's data is still in memory, so I have to avoid it. What do I have to do with this?

sentences: RTS game engine for iOS/iPhone Anyone know any free or non-free RTS engine that can be used for iOS game development?

sentences:
Converting from different handedness coordinate systems I am currently porting a demo from XNA to DirectX which, as I understand it, both have coordinate systems with different handednesses.

What are the things I need to bare in mind when converting between the two? I understand not everything needs to be changed.

Also I notice that many of the 3D maths functions in some of the direct3D libraries have right handed and left handed alternatives. Would it be better to just use these?

sentences:
How do I combine matrix transformation with non-uniform screen scaling in Flash? I'm using a Flash transformation matrix for affine transformation.

I have a rectangular image being rotated and scaled (in 2D). There are two sets of scaling variables, ScreenScaleX and ScreenScaleY, and ScaleX and ScaleY, as well as a counter-clockwise rotation angle, theta. ScreenScaleX and ScreenScaleY are the scaling factors of the window; they should be applied in directions of the original X and Y axes after rotating the image. ScaleX and ScaleY should be applied in the new X and Y directions after rotating the image.

For example: if theta is 90 degrees, ScreenScaleX and ScreenScaleY will still stretch in the direction of the original X/Y axes, but now ScaleY will stretch in the screen's X direction, and ScaleX will stretch in the screen's Y direction.

I think I can accomplish this with some combination of scaling, rotation, and skewing, but I'm struggling to figure out what the matrix would look like. How would I construct a matrix from these variables in order to perform this transformation?

sentences:
Why Can't I duck reverb on the mix bus in Unity? i'm surprised there is so little documentation on this issue. But i'm trying to duck the audio on all the mix buses in Unity so that you can clearly hear the VO of the game.

Now it works great except that I have some reverb zones in the game and any sound that plays in these reverb zones, the actual reverb itself is NOT DUCKED.

So the VO is accompanied with a huge wall of wishy washy muddy noise.

Anyone deal with this before? How can we deal with this?

sentences:
How can I store and read dialogue? How can I store dialogue so that it could be read for a kinetic (linear) Visual Novel type of game in XNA/MonoGame?

I'm currently using a .txt file, but I noticed that I can't read from a specific line using the System.IO.StreamReader class.

sentences:
Scene Graph: Does anybody have a real world example? I'm trying to wrap my head around how scene graphs work, and how to apply that to my game, in the context of all my game objects, including assets, cameras, units, shaders, etc.

All I can find are massively simplified examples that include planets and rotations. What I'd like is a real world example of a well written scene graph, preferably in C++ and if possible with some form of graphical representation of at least a part of the graph.

Additional information:
I am writing a real time strategy game using C++ and DirectX 11. Any other pointers for advice would be massively helpful. Wrapping my head around a scene graph and how that would relate to design patterns like data locality etc, and how to encapsulate it all in a standardised system is proving very difficult for me. I am extremely, extremely confused.

sentences:
Collision detection - player gets stuck in platform when jumping So I'm having some problems with my collision detection with my platformer. Take the image below as an example.

When I'm running right I am unable to go through the platform, but when I hold my right key and jump, I end up going through the object as shown in the image, below is the code im using:

if(shapePlatform.intersects(player.getCollisionShape())){

     Vector2f vectorSide = new Vector2f(shapePlatform.getCenter()[0] - player.getCollisionShape().getCenter()[0],
             shapePlatform.getCenter()[1] - player.getCollisionShape().getCenter()[1]);
            player.setVerticleSpeed(0f);

            player.setJumping(false);
            if(vectorSide.x > 0 && !(vectorSide.y > 0)){
                 player.getPosition().set(player.getPosition().x-3, player.getPosition().y);

            }else if(vectorSide.y > 0){
                player.getPosition().set(player.getPosition().x, player.getPosition().y);

            }else if(vectorSide.x < 0 && !(vectorSide.y > 0)){
                 player.getPosition().set(player.getPosition().x+3, player.getPosition().y);
            }

}

I'm basically getting the difference between the centre of the player and the centre of the colliding platform to determine which side the player is colliding with. When my player jumps and walks right on the platform he goes right through. The same can also be observed when I jump on the actual platform, should I be resetting the players y in this situation?

sentences:
What is Vulkan and how does it differ from OpenGL? Khronos Group (the standards body behind OpenGL) has just announced Vulkan:

  Vulkan is the new generation, open standard API for high-efficiency access to graphics and compute on modern GPUs. This ground-up design, previously referred to as the Next Generation OpenGL Initiative, provides applications direct control over GPU acceleration for maximized performance and predictability.

Their page is quite marketese/jargon-heavy, as is the press release… In simple terms, what does Vulkan mean to game developers? (Gabe Newell is quoted as being strongly in favour, without further explanation.)

What exactly is Vulkan's relationship to OpenGL? Its previous name "glNext" (short for "Next Generation OpenGL Initiative") makes it sound like a replacement.

Update: The Vulkan 1.0 spec was released on 16-02-2016.

sentences:
Procedual terrain generation and biomes/predetermined variation So I already have some (currently 2D possibly 3D later) simplex noise generation going, and with some experimenting I can make a map for plains, hills, mountains, etc

The problem now is I want to combine those together to create a larger more interesting map. For each "pixel" in the height map I provide/generate a biome type which has a bunch of parameters to define how the height value is calculated etc. i.e. I want to be able to say mountains here, river through there, flood plains next to it, etc and have them blend together.

The problem is this leaves nasty borders since between them even the simplex input values change suddenly (due to the x/z scaling being different, perhaps not the best way?). I considered just doing like a post process to smooth out the height values along the borders, but this would still leave often steep (and uninteresting near constant gradient) slopes since I could have a valley one side and a mountain peek the other side.

I am sure there must be a better fairly standard way to do this, but have not found much searching around, at least for this sort of noise function (midpoint displacement can be seeded with initial values at a low resolution, but doesn't seem viable if not generating the entire map at once)

double getHeight(int x, int z, Biome biome)
{
    double nx = x;
    double nz = z;
    nx *= biome.xzNoiseScale();//e.g. 1/64
    ny *= biome.xzNoiseScale();
    double noise = fbm(nx, nz, biome.noiseOctaves(), biome.noiseLacunarity(), biome.noiseGain());
    return biome.baseHeight() + noise * biome.heightVariation();
}

double fbm(double x, double z, int octaves, double lacunarity, double gain)
{
    double amp = 1;
    double freq = 1;
    double sum = 0;
    for (int i = 0; i < octaves; ++i)
    {
        sum += amp * noise(x * freq, y * freq);
        amp *= gain;
        freq *= lacunarity;
    }
    return sum;
}

sentences:
View Full File Name in Project View Unity Is there any way to view the full name of a file in Unity Project view without having to click on it?

This picture sums up my frustration:

sentences:
How to continuously create objects in front of the camera when moving forward? I have created a scene in Unity3D that's filled with spheres. I want to be able to move forward forever and still be passing through the spheres.

I was thinking I'd keep the player in one spot and move the spheres. Maybe destroy the previous bunch of spheres and create a new bunch in random coordinates? I really don't have idea how to start.

sentences:
How to convert .max files to .egg on linux I am very new to 3d graphics and game engines and panda3d and python. I followed few panda3d tutorials and now I want to test them with few new models. High majority of 3d models in the internet are in .max format.

Is there a way to convert these models to a format that can be used with panda3d. (.egg or .bam, I think). I am using linux. Thank you

sentences:
Unity Dropdown Stays Stuck Open As can be seen in the following video:

https://youtu.be/zb3uMUqub00

The dropdown stays stuck open when Unity launches the game. This happens even with a non-modified dropdown that is plopped as a new UI object inside the canvas.

I tried a blank project, and the issue does not reproduce. I tried in a blank project, and the dropdown works. I tried researching a solution, but not too sure how to find one with this problem. Maybe someone here will have an idea or two.

The repo can be downloaded at https://github.com/DenisLabrecque/Warglobe if desired.

sentences:
Random/Procedural vs. Previously Made Level Generation What the advantages/disadvantages of using random/procedural generation vs. pre-made levels?

There seems to be few that I can think of, other than the fact that items may be a problem to distribute in randomly generated terrain, and that the generated terrain may look weird.

The downside to previously made levels is that I would need to make a level editor, though. I cannot decide what is better to use.

Could answers include code/examples of both procedural and premade generation, as well as the pros/cons?

sentences:
Why does PIX suggest my frames are rendering out of order? When my application goes into a fullscreen state my movement is not smooth. It seems like frames are not rendered in the correct order, doing something like: 1, 3, 2, 4, 6, 5, ...
making the movement flicker.

For my PIX test, I draw really a low number of primitives (1140 triangle exactly) inside six vertex / index buffers. I clearly see a difference in the GPU frame "ordering" in PIX. Here is the result when in windowed mode:

PIX screenshot1 http://www.s33m3.be/PIX/PIX2.png

You can see that the GPU time needed for the frame is nearly in sync with the CPU time needed to generate it.

But in the fullscreen state here is what I got (same scene, without camera movement):

PIX screenshot2 http://www.s33m3.be/PIX/PIX.png

You can see that each GPU frame processing is split into at least two parts, and the GPU doesn't wait the end of a frame before starting another one.

What could cause this?

sentences:
Can a local multiplayer iOS game display differently for each device? I've seen games which display different data for two devices, but not more than two.

If possible, can it be accomplished using GameKit?

EDIT:
More specifically, I was thinking local multiplayer via bluetooth or wi-fi on an iOS device. Most games I've seen display the same screen synchronized across all of the devices.

I understand games that network across the internet do this, often using a server, but I haven't seen any examples of a 3+ device local multiplayer iOS game. I just want to make sure it wasn't some kind of limitation.

sentences:
Non-Grid Based Movement in a Tile Map I'm making a dungeon game, and I'm doing input. When I move left or down until the code stops the player, I can no longer move any way except opposite the way I moved. Let's say I moved all the way left. The canmovethere() method stops the player from moving anymore. The player is now "stuck" in the wall; I can't move it up or down, only right. This also happens for moving down, but not up or right.

Here's the code:

public class PlayerInputProcessor {
   private PlayerCharacter player;
   private Dungeon dungeon;

   private final int NORTH = 0, SOUTH = 1, WEST = 2, EAST = 3;

   public PlayerInputProcessor(PlayerCharacter player, Dungeon dungeon) {
   this.player = player;
      this.dungeon = dungeon;
   }

   public void HandleInput() {
      if(Gdx.input.isKeyPressed(Keys.UP)) {
         if(canmovethere(player.getGridPos(), NORTH)) {
            player.setVectorPosY(player.getVectorPosY() + 3);
         }
      }
      if(Gdx.input.isKeyPressed(Keys.DOWN)) {
         if(canmovethere(player.getGridPos(), SOUTH)) {
            player.setVectorPosY(player.getVectorPosY() - 3);
         }
      }
      if(Gdx.input.isKeyPressed(Keys.RIGHT)) {
         if(canmovethere(player.getGridPos(), EAST)) {
            player.setVectorPosX(player.getVectorPosX() + 3);
         }
      }
      if(Gdx.input.isKeyPressed(Keys.LEFT)) {
         if(canmovethere(player.getGridPos(), WEST)) {
            player.setVectorPosX(player.getVectorPosX() - 3);
         }
      }
      System.out.println("Grid Pos " + player.getGridPos());

      player.setGridPos(new GridPoint2((int) player.getVectorPosX() / player.getWidth(),
         (int) player.getVectorPosY() / player.getHight()));

      if(dungeon.getTile(player.getGridPos()) instanceof FloorTile) {
         System.out.println("On A Floor Tile");
      }
   }

   private Boolean canmovethere(GridPoint2 newpos, int die) {
      GridPoint2 nextpos = new GridPoint2();

      if(die == NORTH) {
         nextpos.x = newpos.x;
         nextpos.y = (newpos.y + 1);
         if(dungeon.getTile(nextpos).isPassable()) {
            return true;
         }
      }
      if(die == SOUTH) {
         nextpos.x = newpos.x;
         nextpos.y = (newpos.y);
         if(dungeon.getTile(nextpos).isPassable()) {
            return true;
         }
      }
      if(die == EAST) {
         nextpos.x = newpos.x + 1;
         nextpos.y = newpos.y;
            if(dungeon.getTile(nextpos).isPassable()) {
               return true;
            }
      }
      if(die == WEST) {
         nextpos.x = (newpos.x + player.getWidth() / player.getWidth()) - 1;
         nextpos.y = newpos.y;
         if(dungeon.getTile(nextpos).isPassable()) {
            return true;
         }
      }
      return false;
   }
}

sentences:
moving in the wrong direction Solution:

To move a unit forward:

forward = Quaternion(0,0,0,1)
rotation.normalize() # ocassionally
...
pos += ((rotation * forward) * rotation.conjugated()).xyz().normalized() * speed

I think the trouble stemmed from how the Euclid math library was doing Quaternion*Vector3 multiplication, although I can't see it.

I have a vec3 position, a quaternion for rotation and a speed.

I compute the player position like this:

rot *= Quaternion().rotate_euler(0.,roll_speed,pitch_speed)
rot.normalize()
pos += rot.conjugated() * Vector3(0.,0.,-speed)

However, printing the pos to console, I can see that I only ever seem to travel on the x-axis.

When I draw the scene using the rot quaternion to rotate my camera, it shows a proper orientation.

What am I doing wrong?

Here's an example:

You start off with rotation being an identity quaternion: w=1,x=0,y=0,z=0
You move forward; the code correctly decrements the Z
You then pitch right over to face the other way; if you spin only 175deg it'll go in right direction; you have to spin past 180deg.  It doesn't matter which direction you spin in, up or down, though
Your quaternion can then be something like: w=0.1,x=0.1,y=0,z=0
And moving forward, you actually move backward?!

(I am using the euclid Python module, but its the same as every other conjulate)

The code can be tried online at http://williame.github.com/ludum_dare_24_evolution/
The only key that adjusts the speed is W and S.  The arrow keys only adjust the pitch/roll.

At first you can fly ok, but after a bit of weaving around you end up getting sucked towards one of the sides.  The code is https://github.com/williame/ludum_dare_24_evolution/blob/cbacf61a7159d2c83a2187af5f2015b2dde28687/tiny1web.py#L102

sentences:
Matching game difficulty I'm currently making a matching game where the player is given a color or image type and the player has to click on all of the matching colors of images as fast as possible. My problem is how would I go about making a difficulty curve instead of just randomly generating what the next situation will be.

There's a link down below to show the first version of the game I made a while ago. As you can see the new scenario is chosen randomly and one scenario can be harder than the other with no thought of progression. What I want this time is for the game to progress over-time. So, the more of these "scenarios" a player does the more difficult it will get.

https://www.youtube.com/watch?v=sa2mtpv7RzA

sentences: How to manage collision between balls in Game Maker 2 (Drag and Drop) Hey there I'm using Game Maker 2 Drag and Drop for a project, I made a game like Break Out and when the ball collides with the wall it doesn't bounce, in Game Maker Studio we had Bounce Action but in GMS2 is deleted, can anyone help me about this issue?

sentences:
Change emission level of a set of vertices within a mesh ok so here is the problem I need to solve.

I have a known set of vertices that I need to "animate" the emission level of. Currently I have a vertex definition setup and RGB color data for each vertex. and I can animate that. but obviously that doesn't effect the lighting.

what would be ideal I think is if I could take the basic effect class and apply it to just a few vertices at a time but so far I cant find a way to use it on anything less than a mesh.

Update

Thanks to Evan I think the way to go is to get each of these indices and create a mesh that will overlay the existing model. This would make it easier to control transparency as well as the emission.

The question I have is lets say these indices do not make up a full triangle? Maybe after I find all of the vertices I also find that they don't divide out to 3.

I guess what I need now is what would a good way to pull this mesh apart be?

sentences:
Transform.Rotate micro stutter? Hey all I have a quick question.

I am new and obviously still learning the basics of programming/scripting. However I am confused by the result of a simple script.

The goal is to have a Start Menu with a 3d background.The camera is attached to an Empty Object, which has a script that is meant to constantly rotate.

My confusion, is whether I am live testing in Unity, or a built executable. When the empty object is rotating, it will have a pause or a few milliseconds, and then continue with its rotation. Almost like a planned micro stutter. Regardless of where it is in its cycle. How can I make the rotation as perfectly smooth as possible?

Below is the script for rotating the empty object that the camera is attached to.

public class cameraAnchor : MonoBehaviour {

public float speed = 5f;

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

    //rotate camera anchor around y axis
    transform.Rotate(Vector3.down, speed * Time.deltaTime);
}

}

sentences:
Water effect using DuDv Map weird look I'm trying to apply a DuDv Map effect (distortions) on my water.

My texture is 512x512 in size.

I'm using the following code:

(Vertex Shader)

out vec2 texCoord0;

void main()...
{

texCoord0 = vec2(position.x / 2.0 + 0.5, position.y / 2.0 + 0.5) * 6.0;
}

(Fragment Shader)

in vec2 texCoord0;

void main()
{
    ...

        vec3 ndc = (clipSpace.xyz / clipSpace.w)/ 2.0 + 0.5;

    vec2 reflectTexCoords = vec2(ndc.x, -ndc.y);
    vec2 refractTexCoords = vec2(ndc.x, ndc.y);

    vec2 distorsion1 = (texture(dudvMap, vec2(texCoord0.x, texCoord0.y)).rg * 2.0 - 1.0) * waveStrength; // waveStrength = 0.02;

    refractTexCoords += distorsion1;

    reflectTexCoords += distorsion1;

    vec4 reflectColor = texture(reflectionTexture, reflectTexCoords);
    vec4 refractionColor = texture(refractionTexture, refractTexCoords);

      outColor = mix(reflectColor, refractionColor, 0.5);
}

As you can see when I add my distortion to my reflection and refraction texture coordinates, it seems that something is wrong and can't figure what, because I get this effect:

Do any of you have any idea how can I fix this? Thanks for your time!

sentences:
Non-object-oriented game tutorials I've been tasked with writing an essay extolling the virtues of object oriented programming and creating an accompanying game to demonstrate them.

My initial idea is to find a tutorial for a simple game written in a programming language which does not follow the OOP paradigm (or written in an OOP language but not in an OOP way) and recreate it in an OOP way using either C# or Java (haven't yet decided). This would then allow me to make concrete comparisons between the two.

The game doesn't have to be anything complex; Tetris, Pong, etc. that sort of thing. The problem I've had so far is finding a suitable tutorial, any suggestions?

sentences:
Reading text from file changes the text? I'm currently trying to load a simple text file and filter it by a certain string. In the text file I'm using a new line for each value and sometimes use a "--" to make things easier to read for me when viewing the .txt-file.

Now, when I load the file and split it by new lines I end up with a list of substrings, each representing a value I need. Plus, all the "seperators" I put into the file.

My goal is to clean the list from all the seperators and basically just remove them from the list. However, RemoveAll does not work and I found out that the strings containing "--" are not really "--", but something else, because using string.Equals("--") fails on them.

Somewhere when reading the data or splitting it, something happened to those parts, but I can't figure out what's happening.

Here's the code:
void Awake() {

    _fileLines = new List<string>();

    TextAsset txt = Resources.Load<TextAsset>("SubjectPages/test");
    _fileLines = new List<string>();
    _fileLines = txt.text.Split(new string[] { "\n" }, System.StringSplitOptions.None).ToList<string>();

    _fileLines.RemoveAll(x => ((string)x) == "");
    _fileLines.RemoveAll(x => ((string)x) == "--");

    for (int i = 0; i < _fileLines.Count; i++) {
        Debug.Log(_fileLines[i] + " | " + (_fileLines[i].Equals("--")) + " | " + (_fileLines[i] == "--"));
    }
}

Removing empty lines with RemoveAll seems to work fine.

sentences:
Lidgren peer to peer I am currently integrating Lidgren into my Unity game. I need to move away from the built in networking capability in Unity because of the style of game I am making, basically MMO, I will have far too much information routing through the server just to get from one peer to another.

With Lidgren I am hoping that the peers that need to send information to each other can connect and send messages while maintaining the server connection.

My question is that if I have say 2 people already connected to each other with NetPeer and a third connects to one of them, will all three automatically be connected to each other as peers, or do i have to connect the third to both other players manually?

sentences:
Sampler referencing in HLSL - Sampler parameter must come from a literal expression The following method works fine when referencing a sampler in HLSL

    float3 P = lightScreenPos;
sampler ShadowSampler = DPFrontShadowSampler;
float depth;

if (alpha >= 0.5f)
{
    // Reference the correct sampler
    ShadowSampler = DPFrontShadowSampler;

    // Front hemisphere 'P0'
    P.z = P.z + 1.0;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;

    // Rescale viewport to be [0, 1] (texture coordinate space)
    P.x = 0.5f * P.x + 0.5f;
    P.y = -0.5f * P.y + 0.5f;

    depth = tex2D(ShadowSampler, P.xy).x;
    depth = 1.0 - depth;
}
else
{
    // Reference the correct sampler
    ShadowSampler = DPBackShadowSampler;

    // Back hemisphere 'P1'
    P.z = 1.0 - P.z;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;

    // Rescale viewport to be [0, 1] (texture coordinate space)
    P.x = 0.5f * P.x + 0.5f;
    P.y = -0.5f * P.y + 0.5f;

    depth = tex2D(ShadowSampler, P.xy).x;
    depth = 1.0 - depth;
}

// [Standard Depth Calculation]
float mydepth = P.z;
shadow = depth + Bias.x < mydepth ? 0.0f : 1.0f;

If I try and do anything with the sampler reference outside the if statement then I get the following error:

Sampler parameter must come from a literal expression

This code demonstrates that

    float3 P = lightScreenPos;
sampler ShadowSampler = DPFrontShadowSampler;

if (alpha >= 0.5f)
{
    // Reference the correct sampler
    ShadowSampler = DPFrontShadowSampler;

    // Front hemisphere 'P0'
    P.z = P.z + 1.0;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;
}
else
{
    // Reference the correct sampler
    ShadowSampler = DPBackShadowSampler;

    // Back hemisphere 'P1'
    P.z = 1.0 - P.z;
    P.x = P.x / P.z;
    P.y = P.y / P.z;
    P.z = lightLength / LightAttenuation.z;
}

// Rescale viewport to be [0, 1] (texture coordinate space)
P.x = 0.5f * P.x + 0.5f;
P.y = -0.5f * P.y + 0.5f;

// [Standard Depth Calculation]
float depth = tex2D(ShadowSampler, P.xy).x;
depth = 1.0 - depth;
float mydepth = P.z;
shadow = depth + Bias.x < mydepth ? 0.0f : 1.0f;

How can I reference the sampler in this manner without triggering the error?

sentences:
Places to Test Player Interest In Storyline I am working on an iPad game, and have a few different intro story lines. I would like to get gamer feedback on the intros.

What websites or techniques have others used to get such feedback?

sentences:
How to sample a texture with specified LOD in SM 2.0? That is my question, in SM 3.0 there is the HLSL intrasic function tex2Dlod to pick a color on a texture2d at specified coords and specified level-of-detail.

But after long search on the web, I don't find equivalent in SM 2.0 (ps_4_0_level_9_3)...

sentences:
How to approach debugging of java.lang.NullPointerException in android build of unity app? We are getting an obscure java.lang.NullPointerException when building a Unity app for android.  There's not much information here that I can trace back to our code. Does anyone have advice about how to approach debug this?

All I have to go on at the moment are logCat logs:

Uncaught exception thrown by finalizer
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
    at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:891)
    at bitter.jnibridge.JNIBridge.disableInterfaceProxy(Unknown Source:0)
    at bitter.jnibridge.JNIBridge.delete(Native Method)
    at bitter.jnibridge.JNIBridge$a.finalize(Unknown Source:15)
    at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:250)
    at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:237)
    at java.lang.Daemons$Daemon.run(Daemons.java:103)
    at java.lang.Thread.run(Thread.java:764)

(Unity version : 2018.1.0b10)

sentences:
How to compose a matrix to perform isometric (dimetric) projection of a world coordinate? I have a 2D unit vector containing a world coordinate (the player's direction), and I want to convert that to screen coordinates (classic isometric tiles).

I'm aware I can achieve this by rotating around the relevant axis but I want to see and understand how to do this using a purely matrix approach? Partly because I'm learning 'modern OpenGL' (v2+) and partly because I will want to use this same technique for other things so need a solid understanding and my math ability is a little lacking.

If needed my screen's coordinate system has it's origin at top left with +x & +y pointing right and down respectively. Also, my vertex positions are converted to the NDC range in my vertex shader if that's relevant.

Language is C++ with no supporting libraries.

sentences: How can I use Jung, GraphStream or JGraphT with LibGDX? All libraries I found (JUNG, JGRAPHT, GraphStream) use Swing when I use libGDX. How you can use them with LibGDX

sentences:
I know that my super simple multiplayer setup is probably not a good idea, but why? I'm making a simple little MOBA just for fun. I was making everything single-player then I realized "oh crap I should probably add multiplayer, huh."

I've never done anything with networking before, so learning how to integrate Lidgren into my game was fun and awesome. The thing is, I pretty much know the way I'm doing things is wrong, because it's not robust enough for mainstream games to use, as far as I know, but what's wrong with it?

What I'm doing is, basically, whenever a player does an action, it sends a message to the server saying "hey, I just did this thing." The server and the client are both running the same simulation. The server then sends a message to all other clients telling them that that guy did that thing.

For the most part, except in a few cases, when a player does a thing, the client assumes it's cool and goes ahead with it on its own. So when you right-click somewhere to move there, that player's client just starts moving his guy there, and then sends a message to the server telling it about it.

So basically:

Player 1 casts a spell to make him move 100% faster for six seconds
Player 1's local client adds that buff to his Unit object
Player 1's client sends a message to the server saying "hey I just cast this spell"
The server makes sure he really did have enough mana to cast that spell, and if so, adds that buff to the server's copy of that Unit object
The server sends a message to all other clients saying "hey this guy just cast this spell"
Every other client receives the message and goes "ah okay cool," and adds that buff to their local Unit object for that player

I've been skimming through stuff to see how big games do multiplayer, and it's kind of confusing for someone who's just starting to dabble in this stuff, but it looks like the Source engine sends a packet containing all of the changes to everything in the world every tick? Again, totally new to this stuff, but can you really push that much data that frequently?

Sorry if this is a bit rambly, but basically, I was wondering why my simpler system isn't the right way to go, because if it was, other games would use it, right?

sentences:
How to stop switching between paths to a moving target? I've noticed after implementing A* pathfinding into my game, that there is exploitable/unrealistic behavior that goes on when the player moves between two nodes that alter the path of the AI trying to reach them. I have made a few images to demonstrate this problem.

This image above shows how the pathfinding in my game would behave if the player stood on the opposite side of a wall than my AI. If the player doesn't move it will take this single path to reach them. Assume that the red icon is the AI (enemy) and the blue icon is the target (player).

Now, if the player in this image above moves along the white arrows up and down, and the AI is constantly finding the optimal path to the player (ignore the performance costs of doing that), then the AI will also get stuck moving up and down because the optimal path will constantly shift between going above the wall and going under the wall. Is there a way to modify a standard A* implementation to remedy this? I will include my pathfinding code for clarity, but it's pretty much a standard top down implementation. The "Node" object is a node on my grid, and the grid is an object that holds a list of nodes, with a few functions to find a node from a world point.

public class Pathfinding : MonoBehaviour
{

public Transform seeker, target;
AstarGrid grid;

void Awake()
{
    grid = GetComponent<AstarGrid>();
}

public List<Node> FindPath(Vector3 startPos, Vector3 targetPos)
{
    Node startNode = grid.NodeFromWorldPoint(startPos);
    Node targetNode = grid.NodeFromWorldPoint(targetPos);

    List<Node> openSet = new List<Node>();
    HashSet<Node> closedSet = new HashSet<Node>();
    openSet.Add(startNode);

    while (openSet.Count > 0)
    {
        Node node = openSet[0];
        for (int i = 1; i < openSet.Count; i++)
        {
            if (openSet[i].fCost < node.fCost || openSet[i].fCost == node.fCost)
            {
                if (openSet[i].hCost < node.hCost)
                    node = openSet[i];
            }
        }

        openSet.Remove(node);
        closedSet.Add(node);

        if (node == targetNode)
        {

            return RetracePath(startNode, targetNode);
        }

        foreach (Node neighbour in grid.GetNeighbours(node))
        {
            if (!neighbour.walkable || closedSet.Contains(neighbour))
            {
                continue;
            }

            int newCostToNeighbour = node.gCost + GetDistance(node, neighbour);
            if (newCostToNeighbour < neighbour.gCost || !openSet.Contains(neighbour))
            {
                neighbour.gCost = newCostToNeighbour;
                neighbour.hCost = GetDistance(neighbour, targetNode);
                neighbour.parent = node;

                if (!openSet.Contains(neighbour))
                    openSet.Add(neighbour);
            }
        }
    }
    return null;
}

sentences:
Find meeting point of 2 objects in 2D, knowing (constant) speed and slope I have a gun which fires a projectile that has to hit an enemy. The problem is that the gun has to be automatic, i.e. - choose the angle in which it has to shoot, so that the projectile hits the enemy dead in the center.

It's been a looooong time since school, and my physics skills are a bit rusty, but they're there. I've been thinking to somehow apply the v = d/t formula to find the time needed for the projectile or enemy to reach a certain point. But the problem is that I can't find a common point for both the projectile and enemy trajectories. Yes, I can find a certain point for the projectile, and another for the enemy, but I would need lots of tries to find one where the two points coincide, which is stupid. There has to be a way to link them together but I can't figure it out.

I prepared some drawings and samples:

A simple version of my Flash game, dumbed down to the basics, just some shapes:

http://axonnsd.org/W/P001/MathSandBox.swf - click the mouse anywhere to fire a projectile.

Or, here is an image which describes my problem:

So... who has any ideas about how to find x3/y3, thus leading me to find the angle in which the weapon has to tilt in order to fire a projectile to meet the enemy?

EDIT

I think it would be clearer if I also mention that I know: the speed of both Enemy and Projectile and the Enemy travels on a straight vertical line.

sentences: Does XNA 4.0 for Windows Phone 7 require Visual Studio 2010? I have a copy of Visual Studio 2008 Pro. The Windows Phone Developments tools which include XNA 4 continuously fail to install on my machine. I am wondering if it was due to having 2008 vs 2010. Any ideas?

sentences:
Game Maker - Selecting tiles in an isometric grid I have implemented an isometric grid with rotation in 2 directions in Game Maker. I did this by first calculating the points of the grid in 3D space and then converting them to 2D points through equations I derived from rotation matrices. I use a single object to draw the grid, and would like to be able to click on a tile to select it.

Here are the equations I use to convert the initial 3D points (x, y, z) to isometric 2D points (iso_x, iso_y), where b and a are the angles I'm rotating the grid by:

iso_x = cos_b * x - sin_b * y
iso_y = cos_a * sin_b * x + cos_a * cos_b * y + sin_a * z

I attempted to rework the equations to calculate the tile from mouse coordinates, but I've run into the problem where I have 2 knowns (mouse_x, mouse_y) and 3 unknowns (x, y, z), which will make implementing height difficult.

So I guess I'm looking for suggestions on how to do tile picking better, especially when it comes to choosing tiles with height. If you need extra information, I will try to provide it.

I want to keep the rotations, so moving to sprite-based tiles probably won't work because the shape of the tiles will change as the grid rotates.

sentences:
Not able to upload to Oculus Store I am building for Quest and signing the package with V2. I am also creating store-based Android Manifest file. Unfortunately the upload stops at 2nd step where I receive the error -
"The APK was signed with the V1 signature system, previously marked with V2 and signed again with V1. Such APKs are considered corrupted and cannot be installed."
Here is my Android Manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.VR.VRCube"
android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<application>
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
<activity android:screenOrientation="landscape"
     android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
     android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
     android:launchMode="singleTask"
     android:resizeableActivity="false">
</activity>
</application>
<uses-sdk android:minSdkVersion="21"/>
<uses-feature android:glEsVersion="0x00030001" />
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1" />
</manifest>

sentences:
LineRenderer sorting order - lines always in front of everything I have 3 cameras and 3 canvases.

Back Camera: depth = -5, Back Canvas: Sorting layer - BackLayer,
Camera: depth = 0, Middle Canvas: Sorting layer - MiddleLayer,
Camera: depth = 10, Front Canvas: Sorting layer - FrontLayer,

Orders in canvases are also set (for SpriteRenderers, images, ui etc.)

Back is for a background image and stars, middle for mountains and front for the UI. Everything is working perfectly with one exception:

No matter where I draw lines with a LineRenderer - they're always at the front of everything (each canvas).

The one situation where the line moves deeper is when I set it's points Z to some huge values like 30000 and then - they're just behind everything.

My goal is to place these lines along with the background image and stars on the BackLayer or BackCanvas.

What I've already tried:

Setting LineRenderer sorting layer and it's order from the code. I read somewhere on Unity forums that lineRenderer has to have a special material for this to work but I tried most of them - not working.
I also tried setting their positions manually, from the inspector, from the code, incrementally in the Update() method - they're always in front or complately hidden (with huge numbers mentioned above).
I tried assigning them to different canvases (back, middle, front) as children  didn't work too.

On Unity forums I also read a post which says that we shouldn't use sorting layers with linerenderer and use only Z positions.

If someone has any experience with this, I would be grateful. I really have no idea if I'm doing something wrong or what.

sentences:
How should a player object to communicate with a map object? I'm writing my first game (in Javascript / Node over WebSockets) and am running into a bit of chicken and egg problem, and am afraid how I'm doing it right now won't scale once the game gets more complex.

Here is how the game is architected. It's a tiled strategy game. When a user connects, a new Game object is created:

// width and height of the board / map
function Game(width, height) {
  this.map = new Map(width, height);
  this.player = new Player();
  // ...
}

game = new Game(100,100);

What's reasonable way for 2-way communication between a player object (or any object), and the map?

For example, if a player wants to move left, first I must check that there is no obstacle in his way, then, once this condition is true, his position must be updated, and he loses a stamina point, so both the map and the player objects are updated depending on conditions that most objects both meet (in the simplest case, where there is no interaction with other objects).

One way I can think, is to have a global GAME object, so that the map can access GAME.player and the player can access GAME.map, but this doesn't seem elegant (and will cause me a headache once I have multiple rooms with separate games running on the same node instance).

sentences:
Can frame buffer objects in openGL ES have different kinds of attachments? This question is with regards to the QT openGL app presented in this repository
https://github.com/PRBonn/semantic_suma
I am trying to run this application on NVIDIA AGX Xavier, however, I am getting errors with respect to frame buffer object attachments. I observe that whenever any framebuffer object is attached to 2 different types of attachments (for example renderbuffer object and texture), I am getting GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error. I observe that if a texture is being attached to any framebuffer object which already is attached to renderbuffer object then this error is seen. This can be checked with glGetError().
Could someone please suggest any workaround for this issue. I am a newbie to OpenGL so please excuse me for this question.

sentences:
Connect camera class to game I've been following a tutorial on making a free camera for a 3D model. What the camera class does is allow the player to move and rotate in respects to the model's current position using the right thumbstick of an XBox360 controller.

Here is the code:

http://pastebin.com/xb4eznMi

Can someone explain to me how to connect this to my model in my Game class?

sentences:
One Android app, dynamic load several Unity games I'm a newbie in this unity world, exciting about everything in it.

Days ago I came up with this idea:

One day someone finds this android app, naming "Blahblah Game Engine" or anything else. This app has to be very small, containing only some simple activity and Unity runtime, without further resources related to any specific game.
He installs it and sees an android activity, maybe a webview, showing a list of unity games the server currently hosting, produced by the very same Blahblah company.
Then he clicks on one and this "Blahblah Game Engine" loads the game build via network, starts an Unity activity, without prompting an installing dialog.
He can exit the current game whenever he likes, returns to the previous game list, and plays another, all working well in one app's lifetime.

In a word, the user experience is very much like how we play games on www.kongregate.com with pc browsers: light-weight app, mutiple games in one list, all loads via network, playing right away and installing-less.

Any game that listed in this app should not be installed as a standalone android app, it should be part of the "Blahblah Game Engine", stored as a file inside data folder of "Blahblah Game Engine", run as an activity of "Blahblah Game Engine".

Is it possible with Unity 5, both technically and legally? If I were to start this "Blahblah Game Engine" project, should I choose Unity 5 personal or pro licence?

sentences:
Line-Rectangle Collision Detection and Response I've looked through Google and none of the solutions seem to pinpoint my idea. Ultimately, I want to create a level editor where I can draw lines and have them exported to a file for my engine to read. I'm having trouble getting path-rectangle to work. I'm using this in the context of a platformer, so I'm also interested in knowing which direction and distance the collision came from so I can resolve it. Which is the best algorithm for doing this? I'm only concerned about axis aligned rectangles.

EDIT: My character is represented as a rectangle and the level is represented by lines. The tools really do not matter as I'm looking for the mathematics behind it, not necessarily an implementation.

sentences:
How do I make a cube move by rolling? I am learning jMonkeyEngine by making some small games with it. I have a simple rectangular cube that I want the player to be able to roll around the game world.

When he presses the arrow keys, the cube should make a roll in the direction of the key press. (So, for instance, pressing the right arrow key makes the cube roll 1 WU to the right.)

The problem isn't how to move the cube (I can do that with the move() method), but with how to make this rotation effect so it doesn’t look like the cube is moving to the destination, but is actually rolling.

The rolling effect should be like the cube in Bloxorz. (Here's a gameplay video.)

UPDATE

After I got some good help below, I have come up with a test solution, which I want to share with you.

Box box1 = new Box(1,1,1);
Geometry boxGeom = new Geometry("Box", box1);
Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat1.setColor("Color", ColorRGBA.Blue);
boxGeom.setMaterial(mat1);

//attach the cube to the pivot node
pivot = new Node("pivot");
pivot.setLocalTranslation(0.0f, 0.0f, 0.0f);
rootNode.attachChild(pivot); // put this node in the scene

pivot.attachChild(boxGeom);

//Translate the box so the pivot node is at the bottom right edge of the box
boxGeom.move(-1.0f, 1.0f, 0.0f);

And then rotate it like this.

@Override
public void simpleUpdate(float tpf) {
    //rotate along z-axis
    pivot.rotate(0.0f, 0.0f, -0.001f);
}

sentences:
Coordinates from 3DS Max to XNA 3.5 My problem is this. I have a simple box made in 3DS Max 2009, the Box is 10x10x10. I've tried to load it on XNA and traslate the camera for 15 units, but I can seem to find the values needed to see the box properly. Can anyone point me to a good resource where I can find some good introduction to XNA coordinate system and how is a simple box made in 3DS Max imported properly

Best regards,
David

sentences:
Device model detection and comparation doesn't work I need to detect device model, and if it is Galaxy Ace GT-S5830i, print it out. But it never print's it (it doesn't get through condition).

My code:

public String mDeviceModel = android.os.Build.MODEL;

System.out.println(mDeviceModel); //this prints my GT-S5830i

if (mDeviceModel == "GT-S5830i") //compiler don't get thru this cond.
    System.out.println("GALAXY ACE S5830i"); //never printed

I can't get what's wrong here.

sentences:
Vulkan: Unable to render using multiple view ports I have been trying to enable multiple viewports in my Vulkan Pipeline but have been unsucsessfull. I used this code sample as a reference point. The problem is that when I attempt to draw two side by side (splitscreen) views of a scene I am unsuccessful.

Pipeline Initialisation

// Viewport state
VkPipelineViewportStateCreateInfo viewport_state = initializers::PipelineViewportStateCreateInfo(CameraComponent::GetCameraCount(), CameraComponent::GetCameraCount());

// Dynamic shader stages
std::vector<VkDynamicState> dynamic_states = {
    VK_DYNAMIC_STATE_VIEWPORT,
    VK_DYNAMIC_STATE_SCISSOR,
    VK_DYNAMIC_STATE_LINE_WIDTH,
};
VkPipelineDynamicStateCreateInfo dynamic_states_info = initializers::PipelineDynamicStateCreateInfo(dynamic_states);

(Using the debuger shows that CameraComponent::GetCameraCount() is 2)

Command Buffer

vkCmdSetViewport(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetViewports());
vkCmdSetScissor(cmd, 0, CameraComponent::GetCameraCount(), CameraComponent::GetScissors());

(Here CameraComponent::GetCameraCount() is 2 aswell as the viewport and scissor methods returning valid data)

When Using Nvidia NSight we can see that both Scissors and Viewports are detected

As well as there position data existing within the gpu

But when it comes to the result, all that is visible is half of the screen.

When I flip the cameras around within the code, the second half is rendered instead showing that the first camera is being rendered but not the second one.

sentences:
fish tank water distortion Shader for unity I am working on unity and trying to make a fish tank water distortion Shader effect with the following requirement:

1.its a 2D top down prospective.

2.every object under/in the fish tank has to be distorted, game objects might pass trough/under the fish tank (distortion) and game object might pass over the fish tank (no distortion) as well.

3.the fish tank does not follow the main camera.

I try to search online and most of the solution I get is to apply the shader to an object or to the main camera which will not meet requirement 3 or 2, can someone give me an ideal on what is the best way to deal with this ? I am working on a mobile game so the solution has to be light weighted on processing power. Many thanks !

sentences:
How to set the force applied to RigidBody2D depending on the time user holds touch on screen? I trying to make an object jump from 1 point to another point. How far it jumps depends on how long the player holds the touch anywhere on the screen. It jumps when player releases his touch.

At the code below,I able to detect the moment player release his finger.

if (Input.touchCount > 0) {
    Touch touch = Input.GetTouch(0);

    // Handle finger movements based on touch phase.
    switch (touch.phase) {
        // Finger start touching the screen
        case TouchPhase.Began:
            print("Start tapping");
            break;

        // Finger leaving the screen
        case TouchPhase.Ended:
            //when finger release, the object jump
            float rightForce = Time.deltaTime * 10000 / 2;
            float jumpForce = Time.deltaTime * 30000 / 2;
            box2D.AddForce(new Vector2(rightForce, jumpForce), ForceMode2D.Force);
            break;
    }
}

As you can see I able to get the Time.deltaTime which is I assume is how long the player hold the screen.

What I want to do is calculate the rightForce and jumpForce added to the object depending on the Time user hold the touch.

float rightForce = Time.deltaTime * 10000 / 2;
float jumpForce = Time.deltaTime * 30000 / 2;

Because if I use the 2 line of code above, the result will be almost the same everytime.

So what is the correct way to determine the rightForce and jumpForce depending the time user hold touch?

sentences:
tvOS game launch image shows on simulator but not on device I’ve set up a launch image in XCode and it does show up in the simulator, but on the Apple TV it just displays a blurry gray background. The image is the correct size and doesn’t have any transparency.

I have tried full clean and delete the app from the device – neither has worked.

sentences:
Unity creating 3d clothes for game character I am trying to make a system where players can change out their clothes with others if they like, and even layer up clothes such as covering a shirt with a jacket, then an armored vest. I have ran into a problem with the body parts of the player clipping through the clothes.

For more information on what I tried and what others have told me refer to:

https://blenderartists.org/t/trying-to-get-changeable-clothes-to-work/1171090

The best solution I like the most is:

"If you can get away with hiding parts of the skin (like the armpits), then do so.

You can also load mask textures onto your body to clip fragments/pixels in the shader, depending on the state of the clothing, so that your armpits are only invisible when wearing a hoodie, not when wearing a tank top.

Otherwise, the best technique I’ve found to eliminate body/clothing clipping, on a body with autoweights, is to use a vertex weight proximity to blend between data transfer weights (from body, for tight sections) and autoweights (for loose sections)."

The problem is I have no Idea how to implement this in blender and unity.

Any help is appreciated.

sentences:
Why in the dialogue system it's showing in the conversation only 2 sentences and not the whole 3 sentences? The first script the manager is attached to new empty gameobject:
I want the conversation to start automatic when running the game so i'm calling the method TriggerDialogue in the manager:

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

public class DialogueManager : MonoBehaviour
{
    public DialogueTrigger dialoguetrigger;

    private Queue<string> sentences;

    // Use this for initialization
    void Start ()
    {
        sentences = new Queue<string>();

        dialoguetrigger.TriggerDialogue();
        DisplayNextSentence();
    }

    public void StartDialogue(Dialogue dialogue)
    {
        Debug.Log("Starting conversation with " + dialogue.name);

        sentences.Clear();

        foreach(string sentence in dialogue.sentences)
        {
            sentences.Enqueue(sentence);
        }

        DisplayNextSentence();
    }

    public void DisplayNextSentence()
    {
        if (sentences.Count == 0)
        {
            EndDialogue();
            return;
        }

        string sentence = sentences.Dequeue();
        Debug.Log(sentence);
    }

    void EndDialogue()
    {
        Debug.Log("End of conversation.");
    }
}

Next the DialogueTrigger:

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

public class DialogueTrigger : MonoBehaviour
{
    public Dialogue dialogue;

    public void TriggerDialogue()
    {
        FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
    }
}

Last the Dialogue:

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

[System.Serializable]
public class Dialogue
{
    public string name;

    [TextArea(3, 10)]
    public string[] sentences;
}

In the editor I filled the all 3 TextAreas each one with a sentence.

Hello world

Hi everyone

I have woke up

When running the game it's showing only to the Hi everyone it's not showing the I have woke up.
And it also not showing the "End of conversation." in the log.

sentences:
Fullscreen FPS slowdown in Linux I've got a homemade game engine that supports both Windows and Linux using Win32 and Xlib, respectively. By default, the engine will create the window and then switch it into fullscreen mode. When running in Linux, the main game loop updates with a very low framerate (2-7 FPS) that slowly keeps ticking downwards. If I alt-tab out and then alt-tab back in, the game will shoot up to and stay at a consistent 60 FPS.

Since my time since last tick (dt) keeps increasing during this time, my thought is it has something to do with the game not being properly registered as "fullscreen" when it's initially opened, leading the CPU scheduler to not give it full priority. That being said, that's entirely speculation. Does anyone have any idea what the cause of this could be? I can provide code samples if requested.

System info:
Linux Mint 17 Cinnamon 64-bit
Intel Core i7 @ 3.40GHz x 4
8GB DDR3 RAM
Nvidia GeForce GTX 680 with proprietary driver

Edit
My update loop is as follows:

while (gameIsRunning) {
    auto currentTime = std::chrono::steady_clock::now();
    auto dt = std::chrono::duration<float>{currentTime - lastFrame};
    if (dt >= engine->getFrameInterval()) { // getFrameInterval returns (1 / the target framerate) in seconds; in this case, 1/60s
        if (dt >= engine->getFrameInterval() * 2) {
            lastFrame = currentTime;
        } else {
            lastFrame += std::chrono::duration_cast<decltype(currentTime - lastFrame)>(engine->getFrameInterval());
        }

        // input, update, draw...
    }
}

After fooling around with it a bit, this creates a situation where the framerate will jump back up to 60FPS, tick down until it hits about 30FPS, and then jump back up to near 60FPS before ticking down again.

sentences:
How can I test if my rotated rectangle intersects a corner? I have a square, tile-based collision map. To check if one of my (square) entities is colliding, I get the vertices of the 4 corners, and test those 4 points against my collision map. If none of those points are intersecting, I know I'm good to move to the new position.

I'd like to allow entities to rotate. I can still calculate the 4 corners of the square, but once you factor in rotation, those 4 corners alone don't seem to be enough information to determine if the entity is trying to move to a valid state.

For example:

In the picture below, black is unwalkable terrain, and red is the player's hitbox. The left scenario is allowed because the 4 corners of the red square are not in the black terrain.

The right scenario would also be (incorrectly) allowed, because the player, cleverly turned at a 45* angle, has its corners in valid spaces, even if it is (quite literally) cutting the corner.

How can I detect scenarios similar to the situation on the right?

sentences: What kind of databases are usually used in an MMORPG? Do people write their own DB for some reason?

sentences:
What are Textures in games development? At any time, a game will likely have many objects rendering textures.
So what is a texture? an image for example?

sentences:
How can I estimate the difficulty of user-generated content in my puzzle game? I'm making a puzzle game where one player makes a puzzle, and other players attempt to solve the puzzle the first player made.  The puzzles are a grid of squares that may contain different kinds of traps.  There's a wide variety including the following:

Traps that do initial damage, but don't fire again when you step on them again
Traps that do initial damage, and continue to fire every time you step on them again
Traps that do initial damage, and then do damage over time, but who's effect can be stopped with an antidote
Traps that do initial damage, and damage over time, but who's effects can not be stopped

In addition to all these traps, I have walls, keys, locks, and blank tiles as well.

I'm currently showing the players attempting to solve the puzzle a "difficulty" rating that I got by taking all traps that deal damage divided by all tiles total.  It seems accurate with small puzzles (4x4, 5x5), but when you scale it up (20x20, 25x25), you get deceptively low ratings for extremely difficult puzzles because of the sheer size of the puzzle.

This has led me to try to find a better solution for a difficulty rating.  Things I've considered:

Figuring out a "damage per tile" average by taking the damage all the tiles do divided by all eligible tiles a player can walk on (factor out walls), but with this approach, I can't figure out how to factor DoT (Damage over Time) tiles into it.  For instance, after 10 tiles, I can give an average amount of damage a player will take with regular traps, but how do I give them an average with a DoT trap? They could activate it on the first tile or the last, and the damage numbers are significantly different.
Figuring out a "difficulty score per tile" and trying to factor that into a rating.  All tiles are currently given a "cost" (the amount it costs the player to use them when creating the puzzle), and that number roughly correlates to how much difficulty the tile adds.  I was thinking about using that number to get a difficulty rating, but I'm unsure how I'd use it correctly.
Trying random solutions and seeing how long it takes a bot to solve it.  I don't think this is a good solution for a number of reasons.  It could be solved on the first try by sheer luck, and hide how difficult the puzzle is.  Plus, with keys and locks, backtracking is required, and I think the computing time to run these simulations would be cost prohibitive.
Ditch difficulty ratings all together.  If I can't figure out an intuitive way to show the player how difficult a puzzle is at a glance, I might just have to remove it.

I realize some of this might be hard to visualize, so here are some pictures of a puzzle and it will hopefully help you see what I mean:

The user starts at the star and makes their way to the exit.  This is a view with all the tiles visible, and when the user attempted to solve it, a lot of the tiles you see in that picture would be hidden from them until they were "activated" (by the user stepping on them).

sentences:
How does Unity Inspector handle values changing during play without any thread-locks? First of all, I'm a Java coder. Usually, when you write a game, you run it on thread different than the UI one like:

// pseudocode starts
new Thread(new Runnable(){
    @Override
    public void run()
        while(someVolatileBoolean){
            input();
            physics();
            graphics();
        }
    }
}

and then you declare some sort of listener for the input which usually works on application/UI thread so you need to mark it as volatile, atomic or perform a basic synchro using the synchronized keyword (depending on the situation).

Let's take a simple Unity script:

public class SomeMovementScript : MonoBehaviour {

    public Vector3 speed = new Vector3(0.1f, 0, 0);

    void Update () {
        this.transform.Translate(speed * Time.deltaTime);
    }
}

If we then play the game, the object starts to move with speed 0.1f.

Now, when the game is playing, we can change the speed variable through the inspector:

I thought from the UI coder point of view: I'm changing a variable, which is being read each frame by the game thread. How does this happen, that I don't get some sort of ConcurrentModificationException if there's no visible synchronization at all. The variable is public, not being cached in any way.

I know that this question should be asked on SO, but I thought that GD has more users specialized in Unity and it's mechanics.

I came up with immutability. Variable is considered thread-safe if it's state can't change. As components are immutable, and classes like Vector2/3/4 are immutable - it would work. But... You can make your own class [Serializable], mark their fields as public and the class is not thread-safe - but it is visible through the inspector.

How does Unity Inspector perform these real-time updates with all the classes you can think of?

sentences:
How to avoid game starting before start button is clicked? I've made a game with a Title Screen (Canvas), and a Start Button attached to the Title Screen. Points, GameOver, Restart, and even the Start Button sort of works, but it's possible to play the game before the user presses start.

Is there a way to make the GameObjects only appear after the button is clicked? I've tried to move and change the "public void StartGame()", but I can't get it right.

This is my first game ever, so hope the code provided is relevant.

Enemy.cs

 void Start()
{
        enemyRb = GetComponent<Rigidbody>();
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        player = GameObject.Find("Player");
}

GameManager.cs

 public void StartGame()
{
    powerup.transform.rotation);
    score = 0;
    UpdateScore(0);
    isGameActive = true;
    titleScreen.gameObject.SetActive(false);
}

void Update()
{
    enemyCount = FindObjectsOfType<Enemy>().Length;

    if (enemyCount == 0)
    {
        roundNumber++;
        SpawnEnemyIntruders(roundNumber);
        Instantiate(powerup, GenerateSpawnPosition(), powerup.transform.rotation);
    }
}

void SpawnEnemyIntruders(int enemiesToSpawn)

{
  for (int i = 0; i < enemiesToSpawn; i++)
  {
      int enemyIndex = Random.Range(0, enemies.Length);
      Instantiate(enemies[enemyIndex], GenerateSpawnPosition(), enemies[enemyIndex].gameObject.transform.rotation);
  }
}
public void GameOver()
{
    restartButton.gameObject.SetActive(true);
    gameOverText.gameObject.SetActive(true);
    isGameActive = false;
}

PlayerController.cs

    void Start()
{
    playerRb = GetComponent<Rigidbody>();
    playerAudio = GetComponent<AudioSource>();
}

StartButton.cs

    void Start()
{
    button = GetComponent<Button>();
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
    button.onClick.AddListener(StartThis);
}

sentences:
Calculate the displacement of device in unity I'm making a 3D game in unity where the object should move forward and backward as the android device moves/accelerates in the Z axes. ie. When the player moves the devise in the direction of the +ve Z axis, the object should move forward, and when the player moves the devise in the direction of the -ve Z axis, the object should move backward.

This game is a multiplayer game, and the players will move in a large football field.

My idea to do this is using the accelerometer to calculate the acceleration of the device, then integrate the data of acceleration to get the device speed in the Z axis. and use the speed to move the device.

Using this equation

  V2=V1 + ΔA . ΔT
  Where
  V2 : final velocity.
  V1 : initial velocity.
  ΔA : difference between the initial and final acceleration.
  ΔT : difference between the initial and final time.

At first I tried to use kinematic equations to calculate the final speed, but I realized then that it can be only used when acceleration is constant. So a friend of me who studies physics differentiated this equation for me to use it when acceleration is variable.

I know that there will be some error in calculating the accurate displacement, and that the error will increase after the integration of acceleration, but this small percentage of error is okay for my application; I thought at first in using GPS instead of accelerometer but I found that GPS accuracy will be less than the sensors.

I know also that the error will be incredibly high after some time, so I reset the values of acceleration and velocity every 10 seconds. I'm also using a low-pass filter to reduce the noise of the sensor.

public class scriptMove : MonoBehaviour
{
    const float kFilteringFactor = 0.1f;

    public Vector3 A1;
    public Vector3 A2;
    public Vector3 A2ramping; // for the low-pass filter
    public Vector3 V1;
    public Vector3 V2;

    public int SpeedFactor=1000; //this factor is for increasing acceleration to move in unity world

    void resetAll()
    {
        Input.gyro.enabled = true;
        A2 = Vector3.zero;
        V1 = Vector3.zero;
        V2 = Vector3.zero;
        A2ramping = Vector3.zero;
    }
    // Use this for initialization
    void Start()
    {
        InvokeRepeating("resetAll", 0, 10);
    }

    //http://stackoverflow.com/a/1736623
    Vector3 ramping(Vector3 A)
    {
        A2ramping = A * kFilteringFactor + A2ramping * (1.0f - kFilteringFactor);
        return A - A2ramping;
    }

    void getAcceleration(float deltaTime)
    {
        Input.gyro.enabled = true;

        A1 = A2;
        A2 = ramping(Input.gyro.userAcceleration) * SpeedFactor;

        V2 = V1 + (A2 - A1) * deltaTime;

        V1 = V2;
    }

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

        getAcceleration(Time.deltaTime);

        float distance = -1f;
        Vector3 newPos = transform.position;

        transform.Translate(Vector3.forward * Time.deltaTime * V2.z * distance);
    }
}

The problem:

My code doesn't work always as expected when I move with the device;

Sometimes when I move forward (in the +ve Z axis of the device) the object moves forward also, but sometimes it doesn't move at all.
Sometimes when I'm still in my position the object moves alone by itself.
Sometimes when I move forward and suddenly stop, the object does not stop.

My questions:

Are those strange behaviors because of the accuracy of the device, or is there something I'm missing in my code.
If I'm missing something in my code, What is it?
I searched a lot about methods to get the most accurate position of the device, and I found that I can integrate GPS with accelerometer, how can I do this with my code in unity?

sentences:
What is a good algorithm for fractal-based procedural city layout? Background

I run a minecraft server where I'm going to design a starter city of fairly large scale. I have a series of things, like rule signs and mob cages, I would like to put in buildings there. The city itself will be extremely large and spread out, preferably up to 1000 by 1000 blocks in size.

The buildings themselves will be have cube or rectangular footprints that are based on a certain base cube, like all multiples of 3 blocks. The streets and distance between the buildings will be preferably 5-11 blocks wide, depending on the importance of the street.

When I begin the plan for the city, I will know exactly how big I want the buildings to be and how many there will be.

The Problem

The problem is designing the layout for the city. Obviously with something of such a scale, and me coming from a programming background rather than an urban planner background, it's quite challenging to even begin to wrap my head around the problem.

The problem specifically is that I want the city to look as natural as possible. Of course this would be fairly easy to build on a simple grid pattern, but I want to avoid a grid, or anything that looks like a grid, as much as possible.

The Question

What algorithms might I be able to pursue to be able to help me design it using code? I was thinking that it would look most natural if I used fractals in some way, as minecraft uses fractals already in its terrain generation, and a city seems to grow in a fractal pattern naturally.

I think it's similar in some ways to a tetris playing algorithm, so if anybody has solutions that exist down that direction then it would help also. I'm picturing something where I'll be able to define the shapes that I want to use, and the software then iterates until it finds the most "optimal" solution for even distribution of buildings.
Does something already exist to help me solve this problem using python, preferably in a visual way using pygame?

Naturally this also has interesting implications for city generation in general in game design, so I'm very excited to see what the best solution is.

edit
To be clear, I'm just looking for the layout at this point as the buildings will be designed and built in game.

sentences:
Quaternion angle calculation I'm working on a programming project, in this project I'm receiving an angle as a quaternion value, I partially understand how they work but I don't find any math to get the values I need.
What I would need is the angle between a fictional line/vector going to the the quaternion point from the origin (yes I know what you are thinking, but I couldn't think of a better explanation) and the "earth" a plane that is perpendicular to the gravitational vector, in this case one of your planes of reference.
Also I would need to get the rotation of the line/vector, this time the rotation should be according to the plane perpendicular to itself.
If possible all angles should be described as an angle between -180° and 180° (that's were my troubles are from.

In this picture γ complementary angle of the first questing and R is the secondary angle.
Angles

PS: This is the last formula I tried to use.

sentences:
How to load values into a script from a file? I have a prefab of a "generic unit;" each one has a script with some public variables: name, health, and attack.

Currently, I am manually making copies of that prefab and editing their names, health and damage values in the inspector. This seems unwise to me.

I would rather be able to make a simple file for each unit type, containing its important information, like this:

name = "Archer"
health = 3
attack = 1

And so on. Then, I would like to be able to turn that into actual GameObjects in Unity, presumably by instantiating the prefab and filling in its values with values from the file.

I could then make a script that runs when the game begins and iterates through, making all the objects I need.

However, I do not know the proper way to go about doing this. Is there some way to read files and slot values into variables of a script?

To be clear, I would like to be able to tell Unity to make an Archer, then have it read the Archer file, look up its values for health and attack, then instantiate a copy of the Generic Unit prefab and slot the values that it read into the public variables of a script component of the newly-created game object.

sentences:
How can I build an array of coordinates of a truncated icosahedron's faces? I can easily get a list of coordinates of all the vertices—the Wikipedia page has formulae and this page has a list of them, but that doesn't tell me which ones are part of which face.

What I'd like is to create an array of 32 faces, and for each one have:

The 3-coordinate of the center of the face
The rotation of the face about the center point
Whether it's a pentagon or a hexagon

How can I generate that data?

sentences:
Circle-line segment collision resolution I'm trying to make a side-scrolling game using this method and I'm having some trouble getting it to behave right. The collision shapes consist of multiple connected line segments and I'm checking them one at a time in order from first to last, so in one direction the collisions are resolved in the wrong order and the circle can't move over the connection point.

Is there a way of fixing this that isn't a hack, or should I try preventing the collision from happening in the first place instead?

ETA: The circle is moved straight up if the overlapping line segment is below and not too steep (approx. 50 degrees maximum) to enable it to move on slopes without resistance. In all other cases, the minimum displacement vector is used to resolve the collision.

sentences:
LibGDX - change actor's texture Is there a way to change actor texture without creating a new object?

I want to change my ImageButton texture when resize() is called, and for example for screen > 800px, ImageButton have bigger texture, and if screen <= 800px, ImageButton have smaller texture?

Now when I'm increasing my window size, ImageButton is scaling up but quality is bad so I want to load bigger texture.

Thank you for help.

sentences:
Infinite sidescrolling terrain in Unity I am trying to create a horizontal line at the center of the screen that goes infinitely. I could make the line short and move it with the camera but the shape of my line actually changes as you progress. I am using a line renderer and I am not sure what is the best way to achieve this?

Secondly, the camera keeps moving to the right so I would like those parts of the line that are not visible anymore to get destroyed. I am also not sure how to achieve this since this is one big line I assume?

sentences:
How can check a collision between 2 non-axis aligned boxes? I'm making a simple and easy game and I need to detect the collision between 2 boxes. It only needs to return trueor false, no physics involved.

I started working and couldn't find an algorithm that would check the collision for turned squares.

Here I visualized the problem.

As you can see squares 1, 2 and 3 would return true because they collide with the green squares. 4 would return false because it isn't colliding.

I do have all the squares of both colors in separate array lists.

Does anybody know a library or algorithm for this problem? Thanks in advance.

sentences:
AS3/Flash Develop - Radial Gravity (character on planet simulation) I am trying to create a program where a character shape will be constantly drawn towards the centre of a planet shape. I have taken on previous advice into using physics equations to generate the desired effect yet I think I am missing some and therefore it does not work (I am only using v^2=u^2+2as). Am I over complicating things? All I need is for the player object to be constantly drawn towards the centre of the planet object; there will be no need for other planet objects to come into play and affect the player's gravity.

edit: To clarify, my question should have been "where did I go wrong?". I have now since solved the problem with the answers posted below, which were present because I wasn't going about trying to achieve what I wanted the right way. I didn't calculate the actual direction to move in as expected, and so the character could not move in the expected direction.

Here is my Main.as:

package
{
import flash.display.InteractiveObject;
import flash.display.Sprite;
import flash.events.Event;
import Math
import flash.display.Bitmap;
import flash.display.DisplayObject;
import flash.events.KeyboardEvent;
import flash.text.TextField;
import flash.text.TextFormat;
import flash.utils.*;

/**
 * ...
 * @author Me
 */
public class Main extends Sprite
{
    public var planet1:Planet;
    public var character1:Character;
    public var initialXVelocity:Number = 0;
    public var initialYVelocity:Number = 0;
    public var finalXVelocity:Number;
    public var finalYVelocity:Number;
    public const gravitationalAcceleration:Number = 3;
    public var xDistance:Number;
    public var yDistance:Number;

    public function Main()
    {
        if (stage) init();
        else addEventListener(Event.ADDED_TO_STAGE, init);
    }

    private function init(e:Event = null):void
    {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point
        planet1 = new Planet;
        character1 = new Character;

        //place entites in position to test note: planet 1 is 100*100 pixels, character 1 is 10*10 pixels
        planet1.x = 350;
        planet1.y = 250;
        character1.y = 100; //295
        character1.x = 396; //395
        addChild(planet1);
        addChild(character1);

        //Make sure character has gravity applied constantly
        setInterval(playerMove, 1000);

    }

    public function playerMove():void
    {
        //Calculate the distance between the character and the planet in terms of x and y coordinate
        xDistance = (character1.x + 5) - (planet1.x + 50);
        yDistance = (character1.y + 5) - (planet1.y + 50);

        //Make sure this distance is a positive value
        if (xDistance < 0) {
            xDistance = -xDistance;
        }

        if (yDistance < 0) {
            yDistance = -yDistance;
        }

        //Calculate velocity using physics equation v^2=(u^2)+2as
        finalXVelocity = Math.sqrt((initialXVelocity * initialXVelocity) + (2 * gravitationalAcceleration) * xDistance);
        finalYVelocity = Math.sqrt((initialYVelocity * initialYVelocity) + (2 * gravitationalAcceleration) * yDistance);
        /*trace(initialXVelocity);
        trace(gravitationalAcceleration);
        trace(xDistance);
        trace(finalXVelocity);
        trace(initialYVelocity);
        trace(gravitationalAcceleration);
        trace(yDistance);
        trace(finalYVelocity);*/

        //Make sure the character is moving towards the centre of the planet at all times by reversing the appropriate velocity once it passes the axis of the centre of the planet
        if (planet1.x < character1.x) {
            finalXVelocity = -finalXVelocity;
        }

        if (planet1.y < character1.y) {
            finalYVelocity = -finalYVelocity;
        }

        //Update the current velocity before new velocity is calculated
        initialXVelocity = finalXVelocity;
        initialYVelocity = finalYVelocity;

        //Send the character into the correct direction
        character1.x += finalXVelocity;
        character1.y += finalYVelocity;
    }

}

}

sentences:
SDF - indexing the folding space I had been repetitively watching this part of the video just trying to understand his point:

  you can optionally use the return value as cell index ... as random
  seed to introduce some variation ...

at the near end of the video he stress that:

  don't use for loop ... anything can be achieved by repeating space ...
  I will make an operator to repeat an interval ... give it additional
  values like the first and the last cell index ... start by -2 and end
  at +2 then you get 5 objects ...

How can we achieve like what he say? Do we use clamp() to do that? Something like:

float a = clamp(pMod1(pos.x,2),start_value, end_value);

It is brilliant that everything he present is just like magic to me.

Update01

I dig deeper into SDF research and reading more codes from shadertoy, and discovered this interesting capsule code:

float sdCapsule( float3 p, float3 a, float3 b, float r ) {
    float3 pa = p - a,
    ba = b - a;
    float h = clamp( dot(pa, ba) / dot(ba , ba), 0.0, 1.0 );
    return length( pa - ba * h ) - r;
}

Basically, length(x)-r will get sphere, for x as the origin of the sphere and r is radius of the sphere. so the sdCapsule to some extend, is a variation of sphere, with the clamp(). That means my speculation might be correct. However, I still not sure what that clamp() do and how to adapt it to my use.

sentences:
Unity3d: Delay between animation cycles trying to create simple 360 rotation animation on 2d object but can't understand delay between animation cycles, please check youtube video with issue:
https://www.youtube.com/watch?v=JlLJLHvnkgo

sentences:
Multithreaded design for a game server I would like to start developing my own game. Basically, the game has a "world" that players can travel around and modify. Think of it as a much more realistic version of Minecraft or an open world MMO.

I have thought of two possible ways of designing the server, both with problems.

The first is a single threaded design where one thread handles all the game mechanics and player interactions. The problem with this is that it cannot fully utilize a processor, and if one player does actions that cause lag, all players will experience that lag.

My next idea was that there is a separate thread for each player that renders the terrain around the player, handles physics, NPC interaction, etc. With this approach the CPU could be fully utilized and one player causing lag wouldn't affect others. However, the problem is keeping the different threads in sync. The entire server must be on the same "clock," (same day/night cycle, certain things take a certain amount of time, etc.), i.e., the different threads must be synchronized. However, this raises the problem that if one player's thread is lagging behind, the only way to synchronize the other threads would be to also cause them to lag, and this would eliminate one of the big advantages of a multithreaded game server, not to mention that keeping everything in sync can become extremely complicated.

So my question is, what would be the best way to design the game server using a multithreaded design where the server is kept in sync and one player causing lag won't affect others? Or is this even possible without dropping a significant amount of game ticks?

sentences:
Fully dynamic KD-Tree vs. Quadtree? Working on my game, I'm at the point where I need to track all of the units in the world so that I can do nearest-neighbor checks for combat. This is an RTS-like game, with potentially thousands of small automated units moving around.

I've been looking into KD-Trees and Quadtrees (especially Point Quadtrees). I'm still trying to learn the details of how they work, but so far Point Quadtrees are making the most sense to me. However, I'm getting the impression that KD-Trees are quicker to search, which is important with the number of points I'll have in the tree.

On the other hand, in my case, I'm going to be tracking a massive number of units that are always moving. From frame to frame, their positions will always be different. Quadtrees are apparently faster to rebalance than KD-Trees, but I don't know if that is applicable when you are rebalancing every point in the tree.

I'm wondering if it would be better in this case to just scrap the tree each frame and rebuild it from scratch, rather than try to rebalance every single point in the tree? If a Quadtree is quicker to rebalance, does that also mean it is quicker to build from scratch? If so, that might be more important for performance than the KD-Tree's search speed, depending on how much of a burden it is to create the tree, but I don't know...

sentences:
Event type and SDL_QUIT are incompatible I'm following the Lazy Foo SDL2 tutorials, and I've run into a problem when trying to poll for events. While I'm polling for the events, the event type and SDL_QUIT throw an error saying the operand types are incompatible when trying to see if they're equal.
SDL_Event e;

while (!quit)
{
    // Handle vents on queue
    while (SDL_PollEvent(&e) > 0)
    {
        // User requests quit
        if (e.type == SDL_Quit)
        {
            quit = true;
        }
    }
}

I double-checked and everything is linked correctly, and I've tried other scenarios and it always says the same thing. Does anyone have any ideas about what could be going wrong?

sentences:
Isn't it redundant to implement both lights and shadows? Most games come up with their lighting implementation and their shadow implementation. Due to deferred shading, we are able to simulate lights independent from the scene geometry. But realistic shadows are still a big challenge in game development. They would have to overlap with each other, have soft edges and are calculated in real time to support dynamic scenes.

There is a presentation where the author, Chun-Fu Chao, mentions this about lights and shadows in game development.

  1000 lights without shadow is easy, but 100 lights with shadow is impossible, now.

I wonder where is the problem, at all? I understand that shadow maps and shadow volumes have their problems, though they are very popular. From my understanding, shadows are just the absence of light. So if we use a very dark ambient color, and use deferred shading for handling all light source with easy, wouldn't that result in shadows for free?

sentences:
How to render a field of view of over 180 degrees? In most 3D renderings, a view frustum is used.
This has the problem, that things get stretched out towards the edges.
At "normal" fov (field of view) of about 60 degrees, the effect is not very noticeable, unless compared side by side (example) but at a higher fov of something like 120 degrees it's really noticeable by making things near the edge look way larger/closer (example).
A fov of anything near or over 180 degrees breaks the rendering completely.
So far, I couldn't find anything on how to render in such a way that fixes this or even how it's called.
The ultimate goal would be to be able to render up to 360 degrees (ignoring the hardware needed, to display it) without any distortion, relative to other parts of the image.
So, how would I approach rendering that? Is there already some open source software, I can take a look at?

sentences:
How to blend textures with different size optimally? I am trying to create a 2D lighting map.

For each light source I have an Color[,] with size less than whole map and a coordinate of center. There can be many light sources and they can intersect (2 or more, so I can't just sum it).

I need to blend all light colors for every map pixel, not override.

Is there a better approach other than to loop over every light for each map pixel, get colors and mix them?

sentences:
improving speed of 2d ball collision I am making a game which has many balls bouncing around the screen (around 200-300 balls in a small area). One thing I am trying to do is improve the performance of the collision detection and resolution.

What I've tried to do so far is to maintain a large number of ArrayLists. I split the screen up into a grid and for each cell I keep an ArrayList containing each ball that is currently inside that particular grid square. Whenever I update the positions of the balls, I also update which list they belong to.

When checking for collisions, I have a separate ArrayList which contains all the balls. I iterate through this list, and for each ball:

find out what grid square it is in
check for collisions with all the balls in adjacent grid squares

I've tested this approach and it doesn't seem any different to just iterating over a list of all the bubbles twice.

Does anyone have some suggestions on how I can improve things? For instance, with my current algorithm I am handling collisions twice but I'm unsure how I can work around it.

sentences:
Timer breaks after changing scenes I am using this script below to move an animation in unity with no root-motion. It simply walks across the terrain.

I have timer attached also so the animation doesn't start to walk for 60 seconds. This works fine in the scene when played…but when I navigate into this scene from another home scene the timer delay doesn't work as I guess it has been triggered already and has already reached the 60 second mark? I have tried using DontDestroyOnLoad but this just recreates the animation in the home scene also.

I'm trying to keep the code as simple as possible and maybe add to the code below to fix it:

void Update ()
{
    if (Time.time > 60)
    {
        transform.Translate (0, 0, Time.deltaTime);
    }
}

sentences:
Changing direction after collision In the first tutorial for GameMaker (catch the clown), I want to set the direction of the clown after the collision with the wall.

I want to do it by pressing the wall object with the mouse (before the collision, to set the angle parameter). For example by pressing only once the wall object it would change the clown's direction after collision by 45 degrees, twice by 90 degrees, and so on.

How can I do that?

sentences: hosting a windows game on a linux server there! I am currently working on a game on Unreal 4, and although im still in early production(barely any code written, mostly visual assets at this point), i want to ask this now, so that i know how to organize my work schedule. If the game it self is running on windows, can the games multiplayer server be on a linux machine? If possible will there be any complications during coding or setup that i need to look into? would very much apreciate any help. :)

sentences:
How can a desktop Java game be distributed without a Java runtime dependency? Is it possible to turn a Java application into a standalone package that runs "out of the box"? The end user should not be required to install any Java JRE, nor should the installer contain a JRE and install it for the user.

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

How can this be done?

sentences:
Finding the endpoint of a named bone in Irrlicht I'm making a tank game that will have multiple tanks.  I want to be able to define the weapon placements using bones that I can add right inside the modelling program (Blender to be exact).

All tanks will have a bone called Body and a bone called Turret, and then names like Cannon0 and PickupGun for where the shots will be fired from that are attached to the Turret bone.  Is there some way to find the absolute end position of a bone that I choose by name?

sentences:
Dynamic body in Box2D with fixed position I need to fix the dynamic body position so that it would not rotate and would not move even if there are other forces, collisions and so on. Let me first explain why I need this.

I have a dynamic body which is the game character. There are non-moving objects that the game character should land on and get some energy as long the character is in contact with those bodies. As these bodies are non-moving it would be natural to make them Static or Kinematic. But in my case I cannot do that, as far as there is another Kinematic body with which all the game items should be collided and on EndCollision event those items should be removed. But in Box2D static and kinematic bodies don't collided with each other. So I have to make my game item on which the character should land Dynamic but still should be sure that it will not move. How should I do this?

sentences:
Is my skill tree possible, balanced, or even a good idea? Like most people, I have an idea for a game. I have a particular concept I want to create with a particular set of mechanics I want to implement.

What I need help with is the underlaying player statistics, how they effect what the player can do, and how I can enable a player endless expansion down a particular path that improves only a small sub-set of those statistics.

The entire game will be turn based. The concept is to explore and learn about the world you're in. Books, scripts, notes-on-napkins will lead you to secrets and dungeons. There are no quests to do this for you. You have to read, study and venture forth.

The base stats will decide how effective you are in combat as well as other areas of exploration and general existence in the world.

It could be important to mention that combat in my system isn't realtime or even in the control of the player. The player decides to enter a dangerous area of the map and the computer decides if they get into combat. The computer also rolls some dice and applies modifiers based stats, and finally decides who is the winner. You may die, you may be able to flee. I haven't decided yet.

At this moment in time, I'm considering the following (classic) player stats:

Strength
Stamina
Intelligence
Wisdom
Agility
Intuition

I'm considering the following three class types:

Combat
Magic
Stealth

Class types have two base statistics behind them:

Combat: Strength and Stamina
Magic: Intelligence and Wisdom
Stealth: Agility and Intuition

Somewhat obvious, I guess. Moving further into the mechanics, I had the following progression system in mind:

Levels 1-50 are about learning the game and its mechanics
Advancing to level 50 is fast and is also the cap
After level 50, you gain Guild Wars 2 style "Mastery" points which allow you to enhance specialisations
The end-game is about horizontal progression and mastering your class type, but more importantly, it's about lore and finding it

The idea behind Specialisations is you invest Mastery into them and they force your character down a particular path: combat, magic, or stealth. They also lock you out of the other paths, so you can't mix and match. You have to think about what it is you want to do and whether you can do it based on your understanding of the area you're going into.

The idea behind locking a player down a particular path (which can be unlocked and reassigned, but with research, effort and work) is I want to make it difficult for players to simply construct a "super character" that can take on everything and everyone. Think about how easy it is to become a super mage in Skyrim that can blow everything up... boring!

I want a world in which a very powerful mage is useless against certain monsters simply because of the magic resistance and shear strength that monster has: it forces the player to respec' and rethink before walking into any situation.

To summarise, my thoughts so far are:

Base stats effect everything the player does
Equipment can effect the base stats as well as potions and the other classic stuff
Specialisations effect only two stats and lock out other specialisations
Mastery points go on and on, but the "leveling" curve gets harder and harder quit quickly
Mastery and leveling up a particular specialisation enables the player enter new parts of the world (which is massive, by the way) and continue exploring, but not without first researching what's there (and respeccing as a result)

Am I looking at a dead end here, or is this possible? I'm brand new to game development and really enjoy the mechanics behind games. Am I describing a classic setup here, perhaps? Or something close to one?

I would welcome and greatly appreciate all feedback. I'd even welcome a preexisting system I can copy/paste into my world and just use ;-)

Thanks again.

EDIT: Thanks for the great replies and questions. I think I'm getting this a bit backwards and will, instead, focus on my location and movment, then overlay combat when the time comes :-)

sentences:
Collision detection with XNA and TiledLib I recently started learning XNA and after getting annoyed with creating individuals rectangles each time I wanted to add something I went with TiledLib so I could more easily create levels using the Tiled map editor. My problem is, though, I have no idea how to check for collision using TiledLib. There is very little documentation on it and where people have solved the problem it seems like the code they provide is outdated.

For those who do not know TiledLib: https://bitbucket.org/nickgravelyn/tiledlib

I'm using mostly the code that comes in the demo (such as Map.cs/MapProcessor.cs) because I don't know too much how it works, but it does the job.

I've heard to detect for collision I should use a seperate layer that contains all the tiles I want to collide with, but aside from updating the map to accomdate that I don't know how to actually check for that in my code and make those tiles collide with things. Also, attempting to add a layer to my tile map and then running my game provides this error:

Error   1   Building content threw ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at PlatformerContentPipeline.MapProcessor.Process(MapContent input, ContentProcessorContext context) in e:\Platformer\Platformer\PlatformerContentPipeline\MapProcessor.cs:line 94
   at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
   at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings)   e:\Platformer\Platformer\Platformer\PlatformerContent\level1.tmx    Platformer

I'm at a loss at what to do. If anyone could help me with this, or perhaps let me know of a more updated and more well documented 2D engine for C#/XNA, that would be great.

sentences:
Java Thread.sleep() VS Get last and current time I am creating a simple game using Java. I'm not using any game library. I just want to know if it is okay to call Thread.sleep(40) before calling repaint().

public void run() {
    while(isGameRunning) {
        try {
            Thread.sleep(40);
            repaint();
        }
        catch(Exception e) {
        }
    }
}

or should I use:

private long last_time = System.nanoTime();
private double ns = 1000000000/25D;
private double delta = 0;
@Override
public void run() {
    while(Universe.IsGameRunning) {
        long time  = System.nanoTime();
        delta += (int)(time - last_time)/ns;
        last_time = time;
        System.out.println(delta);
        if(delta>=1) {
            repaint();
            delta--;
        }
    }
}

The code below has more CPU and RAM usage than the first one. Can you explain to me how 'Delta Timing' actually works?

sentences:
SDL (or OpenGL), HTML5, Gecko and vector movies I'm writing a platform game which uses SDL for the main graphics code. There is a chance that I may be using OpenGL for the rendering at a later stage, so answers could relate to either.

I'm needing a good method to include vector animations (such as a starting video) within the game.

Being a platform game, I would prefer to limit the dependents and size of the data. This rules out using Theora as the resulting vector animations would be needlessly lossy and overly large compared to the rest of the content. Flash sounds like an OK option, however it is finicky to embed (or even use) on non-windows platforms, and requires significant amounts of dependencies.

My idea is to use HTML5 animations, rendered by Gecko (the embeddable Firefox rendering engine) or WebKit (the Chrome rendering engine) in SDL, or rendered to an OpenGL surface in SDL. Quite simply - is this feasable? Are there any other examples as to how I should embed it? Is there a better (read: smaller and simpler) solution?

sentences:
Simulation of ball movement in a 3d landscape. The easiest way? I have a landscape(generated via Perlin noise) and a ball. I want the ball to move along the geodesic(implementation of basic physics: gravitation, friction). I thought to do raycast around the ball to the landscape, choose the lowest point and move the ball to this point, but it won't work in every case and it won't allow the ball to jump (with inertia). So, what is the best way/algorithm to implement such feature?

P.S. I don't want to use any libraries.

Thanks.

sentences:
Custom Update Function -OR- Multiple TimeScales I'm trying to create some interesting variations on timescales in my game.  In essence, I'd like at least two, probably three or four separate timescales.

The player - the player timescale is likely to be the game/scene timescale always.
Mobs - mob timescales can be altered (slower primarily, but also faster possibly) depending on cast spells or other effects in the
game.
Environment - like mobs, the environment may be slowed or sped up depending on some game effects that occur.  This would control things
like traps, torches, etc.

I'm thinking about things such as a Slow Time spell that might slow most mobs, but maybe not others (bool flag), something like a time elemental or something of that nature.  I'd also like to possibly slow environmental time so the player may have a single-use item that would allow them to move easily navigate traps (but not have guaranteed success if they still don't see the pattern or such).

Having controller scripts that are added to all objects that listen for calls to change a multiplier on Time.deltaTime could be an option, but it's clunky, would have to be in all of the scripts, would have to be accounted for in many areas (movement, combat, possibly related effects), and is just not an ideal option.

Inversely, the same effect (a lich for example casting slow on a player) could require opposing things.  If I had global settings that contained a multiplier for player/mob/object that were impacted by an effect, I could still always use a multiplier with Time.deltaTime, but I still think it would be clunky.

Has anyone done this?  Are there any good ideas?  I've searched a bit, but didn't find anything terribly useful.

I've considered custom Update() classes, though I'm not entirely sure how to implement them.  Maybe extend the FixedUpdate() class that's built in to take other things into account?  I know that Time.timeScale is inherently for the current scene, but could I make instances of Time that are used by different scripts FixedUpdate()?  Am I overthinking this?  I feel like this shouldn't be quite so difficult.

sentences:
How to randomly spawn obstacles for infinite runner? I am trying to create randomly generated path properly? Think of flappy bird (its not really) but my code/algorithm is all wrong. If I make BarMax, BarMin too large, then player can cheat cos in centre there will always be space. Make it too small and pipes are spawned randomly and sometimes very close to each other (unlike flappy). So my player sometimes could run into a situation where its impossible to move past two pipes. My adjacent pipes are really close together as well unlike flappy birds big gap between pipes.

So this is what i dont want to happen.  I have also thought about spawning sets of pre-configured pipes but then i thought they might run into this impossible situation at some point too. I had my level set-up like this  So when a bar touches the looper, it spawns again - code is above.

int numBGPanels = 35;

float BarsMax = 1.5f; float BarsMin = -1.5f;

float widthOfBGObject = 1; float offset = 0.75f; Vector3 pos;

void Start() {
    StartBarsPosition(); }

void OnTriggerEnter2D(Collider2D collider) {

    if(collider.tag == "Bars") {       // this is not getting called cos theres no collider attached atm
        pos = collider.transform.position;
        pos.x += widthOfBGObject * numBGPanels * offset;

        pos.y = Random.Range(BarsMin, BarsMax);
        collider.transform.position = pos;

    }

}

void StartBarsPosition() {
    GameObject[] bars = GameObject.FindGameObjectsWithTag("Bars");

    foreach(GameObject bar in bars) {
        Vector3 initialpos = bar.transform.position;
        initialpos.y = Random.Range(BarsMin, BarsMax);
        bar.transform.position = initialpos;
    }

}

sentences:
Frame Buffer Object (FBO) is not working. What is the right way to use? I am trying to use FBO but i am living some problems. I will show you my steps but first i will show my running screen ,so we can compare them. Like before fbo after fbo.

My running screen and Draw() function code:

glClearColor(0.5,0.5,0.5,1.0);
glLoadIdentity();
glTranslatef(0.0,0.0,-3.0);
glRotatef(0,0.0,1.0,0.0);
glUniform3f(glGetUniformLocation(mainShader->getProgramId(),"lightPos"),0,1,2);
mainShader->useShader();
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    scene->draw(mainShader->getProgramId());
mainShader->delShader();

After I tried to add FBO :

Create FBO texture function:

unsigned int createTexture(int w,int h,bool isDepth=false)
{
    unsigned int textureId;
    glGenTextures(1,&textureId);
    glBindTexture(GL_TEXTURE_2D,textureId);
    glTexImage2D(GL_TEXTURE_2D,0,(!isDepth ? GL_RGBA8 : GL_DEPTH_COMPONENT),w,h,0,isDepth ? GL_DEPTH_COMPONENT : GL_RGBA,GL_FLOAT,NULL);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);

    int i;
    i=glGetError();
    if(i!=0)
    {
        std::cout << "Error happened while loading the texture: " << i << std::endl;
    }
    glBindTexture(GL_TEXTURE_2D,0);
    return textureId;
}

Init() function :

void init()
{
    glClearColor(0,0,0,1);
    glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        gluPerspective(50,640.0/480.0,1,1000);
    glMatrixMode(GL_MODELVIEW);
    glEnable(GL_DEPTH_TEST);
    mainShader=new shader("vertex.vs","fragment.frag");
    quadRenderShader=new shader("quadRender.vs","quadRender.frag");
    scene=new meshLoader("test.blend");

    renderTexture=createTexture(640,480);
    depthTexture=createTexture(640,480,true);
    glGenFramebuffers(1,&FBO);
    glBindFramebuffer(GL_FRAMEBUFFER,FBO);
    //GL_COLOR_ATTACHMENT0
    //GL_DEPTH_ATTACHMENT
    glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,renderTexture,0);

    glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D,depthTexture,0);

    int i=glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if(i!=GL_FRAMEBUFFER_COMPLETE)
    {
        std::cout << "Framebuffer is not OK, status=" << i << std::endl;
    }
    glBindFramebuffer(GL_FRAMEBUFFER,0);

}

And Draw() function:

void display()
{
    //rendering to texture...
    glClearColor(0.5,0.5,0.5,1.0);
    glLoadIdentity();
    glTranslatef(0.0,0.0,-3.0);
    glRotatef(0,0.0,1.0,0.0);
    glUniform3f(glGetUniformLocation(mainShader->getProgramId(),"lightPos"),0,1,2);
    mainShader->useShader();
    glBindFramebuffer(GL_FRAMEBUFFER,FBO);
        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
        scene->draw(mainShader->getProgramId());
    glBindFramebuffer(GL_FRAMEBUFFER,0);
    mainShader->delShader();

    glClearColor(0.0,0.0,0.0,1.0);
    //render texture to screen
    glLoadIdentity();
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    quadRenderShader->useShader();
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D,depthTexture);
    glUniform1i(glGetUniformLocation(quadRenderShader->getProgramId(),"texture"),0);
    quad->draw(quadRenderShader->getProgramId());
    quadRenderShader->delShader();

}

and Result only drawing last setup color (glClearColor) so black :

Result should be like in tutorial :

Note: I know tutorial monkey is purple but it is not problem.

sentences:
Realtime local reflections of particle system I'm finding my way around CryEngine 3 (through Steam) and want to create a simple effect where a fire on shore is reflected in a body of water.

For testing purposes, I've made the water dead calm...

(Note Dx11 on 2nd line of debug info)

As you can see, the terrain is reflected properly, but the flame particles aren't reflected. It's my understanding that this should be possible.

NB: I've created an appropriate cubemap for the water environment, although I don't believe it comes into play here.

I've seen a number of posts saying Glossiness > 50 (or 50%) and a light specular color are required. I've got 100% and white...

And for completeness, the water volume properties...

Can someone please tell me what I need to enable to get this working? Thanks.

sentences:
Directory.CreateDirectory() created a folder with name that was supposed to be a file i am experiencing some problem here , i have a path :

"/folder/folderagain/file.xml"

i tried to use Directory.CreateDirectory() to create all folder (in case one of them is missing) and then reuse the path to create a file in another place inside the script. But instead a folder named "file.xml" was created by Directory.CreateDirectory() and my script got blocked from creating the file .

I managed to solve this problem by creating 2 different path , one of them end with file.xml and the other does not. But is there any better way to do it ? can i tell Directory.CreateDirectory() to create only folder ??

look at screenshot below , there's System.UnautorizedAccessException error because my script trying to create file named "keymap.xml" but a folder with the exact name already exist so it thrown that error .

sentences:
How can I integrate IK into a hierarchical editing environment? I have a situation where I'm trying to push the output of an IK solver back into a user editable joint hierarchy (which stores components as it's primary source), and I'm not sure how to go about it.

My IK solver returns three world space transforms representing the position and orientation of a chain of joints (0,1,2).

A:
I need to turn this into a hierarchy so that transform 2 is local to transform 1, and transform 1 is local to transform 0. Now I have local transforms for each joint.

B:
Further: I need to decompose each joint's new local matrix into source Translation, Rotation and Scale.

Can anyone give me some tips for each step? I have some ideas, but I'm worried that to do B I need to particularly careful with A.

Edit:

For example if I get my world matrices like this:

M4 world_mats[3] = IK_solve( ikparams );

And then convert them to local like this:

M4 local_mats[3] = GenerateLocalChain( world_mats );

And then extract components:

Scale     s[];
Rotation  r[];
Translate t[];

foreach ( matrix in local_mats )
    Decompose( matrix, s, r, t );

How can I implement the Decompose() function to match matrices created inGenerateLocalChain()?

sentences: How to test a turn-based ios Game Center game with 2 devices? This might well be a very dumb question, but here goes anyway, I'm planning my turn-based ios game center game, obviously I know I'll need 2 iDevices to test it on, but how would I test the online turn-based play between the devices? As I'm to understand it, if the 2 devices are local (i'e close to each other) they automatically revert to a local communication method? is it possible to force them to communicate online so I can test that part of the project?

sentences:
What is glViewport for and why it is not necessary sometimes? I develop my game most of time under ArchLinux. I have decided to try it on the Ubuntu 16.04 recently. The situation I came across was really strange:

No glGetError()s at all.
No errors, warnings, anything bad in the gl debug output.
All assertions that I made for all bad situations did not trigger.
glClear successfully cleared the buffers I specified, but:
glDraw* did not draw anything.

Luckily I have found a solution which was to set glViewport. However, I don't quite understand, why is it necessary for drawing in Ubuntu but not necessary in ArchLinux? The also difference is between graphics adaptors: on archlinux I use NVIDIA 1060, on Ubuntu I use integrated HD Graphics P530 (Skylake GT 2).

If it is important, I use SDL2 with opengl 4.4.

sentences:
Direct3D: should I use MIXED_VERTEXPROCESSING? Yesterday on Youtube I watched a video tutorial about creating Direct3D stuff. On that tutorial there was a part about VERTEXPROCESSING compatibility with older video cards. The guy said that the compatibility can be checked by this code:

D3DDISPLAYMODE         d3ddm;
D3DPRESENT_PARAMETERS  d3dp;
D3DCAPS9               d3dc;
int VP;

d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dc);
if (d3dc.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT)
    VP = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
    VP = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

//and then:
d3d->CreateDevice(D3DADAPTER_DEFAULT,
                  D3DDEVTYPE_HAL,
                  dxhwnd,
                  VP,
                  &d3dp,
                  &d3ddev);

But hey OpenGL does this stuff automatically so there must be a way to achieve that easier. So today I found that this can be done by D3DCREATE_MIXED_VERTEXPROCESSING. But on some forums I have read that some (most older) video cards can have problems with this mode. So is there any reason why should I or shouldn't use Mixed Vertex Processing instead of using them both but with D3DDEVCAPS?

sentences:
What is the practical use of IBOs / degenerate vertex in OpenGL? Vertices in 3D models CAN get cut in the process of optimizing 3D geometry, (degenerate vertices) by 3D graphics software (Blender, ...) when exporting because they aren't needed when reusing a vertex for multiple triangles.
(In the current case 3D data is exported from Blender as .ply and read by a simple application that displays the 3D model)

Every vertex has a few attributes like position, color, normal, tangent,...
But the data for each vertex that is cut through the vertex sharing is lost and is missing in the vertex shader.

Modern shader techniques like Bump or Normal mapping require normals/tangents per vertex which are also cut.

To use complex shader techniques IBOs must not be used? Or is there a way to use IBOs and retain the data per vertex that was origionally lost?

sentences:
Pathfinding and collision avoidance on mobile Currently I'm developing a Diablo like game for mobile platform(iphone5+).

A simple A* search will find the path, but collision avoidance still needs to be taken into consideration.

There will be about 50 monsters active at the same time, so performance is very important.

I found some methods that might work.

NavMesh + RVO

The recast/detour library works well on the pathfinding part, but its crowd simulation quickly reach the limit(more than 5ms for 30 agents).

Another library RVO2 seems fine(less than 2ms for 50 agents), but the library has some license issues.
Flow Fields + Physics Engine

Many RTS games use this method, but it seems that a physics engine is required to resolve  collisions. If many agents don't share a common goal, this method might cost more than traditional A* pathfinding.
Steering Behaviors + Physics Engine

Steering Behaviors includes many concepts, I think simple avoidance behavior might work(just turn left/right if there is something in front) , but the method still requires a physics engine to work together.

I'm still not sure which one to use, maybe there exists other pathfinding and collision avoidance methods.

P.S. Halo:Spartan Strike uses Havok AI(based on RVO?), but I didn't see many enemies in that game,
so I wonder whether the first method(NavMesh + RVO) will works well on mobile platform.

sentences:
Unity: how to apply programmatical changes to the Terrain SplatPrototype? I have a script to which I add a Terrain object (I drag and drop the terrain in the public Terrain field).

The Terrain is already setup in Unity to have 2 PaintTextures: 1 is a Square (set up with a tile size so that it forms a checkered pattern) and the 2nd one is a grass image:

Also the Target Strength of the first PaintTexture is lowered so that the checkered pattern also reveals some of the grass underneath.

Now I want, at run time, to change the Tile Size of the first PaintTexture, i.e. have more or less checkers depending on various run time conditions. I've looked through Unity's documentation and I've seen you have the Terrain.terrainData.SplatPrototype array which allows you to change this. Also there's a RefreshPrototypes() method on the terrainData object and a Flush() method on the Terrain object. So I made a script like this:

public class AStarTerrain : MonoBehaviour {

    public int aStarCellColumns, aStarCellRows;

    public GameObject aStarCellHighlightPrefab;
    public GameObject aStarPathMarkerPrefab;
    public GameObject utilityRobotPrefab;
    public Terrain aStarTerrain;

    void Start () {
            //I've also tried NOT drag and dropping the Terrain on the public field
            //and instead just using the commented line below, but I get the same results
        //aStarTerrain = this.GetComponents<Terrain>()[0];
        Debug.Log ("Got terrain "+aStarTerrain.name);

        SplatPrototype[] splatPrototypes = aStarTerrain.terrainData.splatPrototypes;
        Debug.Log("Terrain has "+splatPrototypes.Length+" splat prototypes");
        SplatPrototype aStarCellSplat = splatPrototypes[0];
        Debug.Log("Re-tyling splat prototype "+aStarCellSplat.texture.name);
        aStarCellSplat.tileSize = new Vector2(2000,2000);
        Debug.Log("Tyling is now "+aStarCellSplat.tileSize.x+"/"+aStarCellSplat.tileSize.y);
        aStarTerrain.terrainData.RefreshPrototypes();
        aStarTerrain.Flush();
    }

//...

Problem is, nothing gets changed, the checker map is not re-tiled. The console outputs correctly tell me that I've got the Terrain object with the right name, that it has the right number of splat prototypes and that I'm modifying the tileSize on the SplatPrototype object corresponding to the right texture. It also tells me the value has changed. But nothing gets updated in the actual graphical view.

So please, what am I missing?

sentences: Any good book on lighting in video games? Lighting plays a fundamental role into videogames. A videogame without a good ilumination is flat and without life. I'm looking for a book that explains how must be iluminated a scene and what factors are involved in the creation of convincing worlds.

sentences:
How should one component "trigger" another one in a component system? In my game I have a MoveComponent and a ClimbComponent.

Some characters can only move around on one level, others are able to climb to the next floor.

My intention is to have characters randomly be able to climb if the are about to bounce into a wall.

How would I manage this? Should the ClimbComponent be added dynamically and also be removed again, or should random characters always have the ClimbComponent and it would be activated and deactivated dynamically?

sentences:
How to pass arguments with BungeeCord/Bukkit plugin messaging I am trying to send a plugin message from Bukkit, to BungeeCord, but can not figure out how to send arguments.
Here is the code from the Bukkit plugin, which sends the message:

  ByteArrayDataOutput out = ByteStreams.newDataOutput();
  out.writeUTF("BungeeCord"); out.writeUTF("Argument");

  // If you don't care about the player // Player player =
  // Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
  // Else, specify them
  Player plr =  Bukkit.getPlayerExact("spacegeek224");

  plr.sendPluginMessage(p, "BungeeCord",
  out.toByteArray());

Here is the code in the main class of my BungeeCord plugin:

@Override
    public void onEnable() {
        this.getProxy();
        ProxyServer.getInstance().getPluginManager().registerListener(this, new ChannelListener());

        this.getProxy();
        ProxyServer.getInstance().registerChannel("Return");
    }

And finally, here is the code for the ChannelListener:

package net.spacegeek224.metro.util;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.plugin.Listener;
import net.md_5.bungee.event.EventHandler;

public class ChannelListener implements Listener {

    @EventHandler
    public void onPluginMessage(PluginMessageEvent e) {
        if (e.getTag().equalsIgnoreCase("BungeeCord")) {
            DataInputStream in = new DataInputStream(new ByteArrayInputStream(e.getData()));
            try {
                String channel = in.readUTF(); // channel we delivered
                if(channel.equals("BungeeCord")){
                   ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()).create());

                } else {
                    ProxyServer.getInstance().broadcast(new ComponentBuilder(e.getReceiver().toString()+":"+channel).create());

                }
            } catch (IOException e1) {
                e1.printStackTrace();
            }

        }
    }

    public void sendToBukkit(String channel, String message, ServerInfo server) {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(stream);
        try {
            out.writeUTF(channel);
            out.writeUTF(message);
        } catch (IOException e) {
            e.printStackTrace();
        }
        server.sendData("Return", stream.toByteArray());

    }
}

I have tried many things, including Google, and looking at what other methods are available, but have come up with nothing.

sentences:
UNET spawn dynamically generated object unity Spawning works when all clients are connected, but if a client connects after I spawn all my prefabs there are errors.  I spawn the object before changing its Rigidbody's velocity, which seems to cause the problem. I spawn objects, change them, then the other client joins, and the errors come. these are the errors:

Failed to spawn server object, assetId=953c1c6ecbb84304280d1334ef5dae0b netId=26

I also make changes to variables on other scripts.

All objects have network identities, network transforms, and are spawnable prefabs.

sentences:
Rotating an object while moving I have an object the is a perfect circle.  The object is moving left, right and jumping with collision detection.  What I am trying to do now is rotate the object while it is moving, so it looks like rolling.

This is the code that I have so far:

key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space);

//1  right, -1 left
var move = key_right - key_left;
hsp = move * walkspd;
vsp = vsp + grv;

if(place_meeting(x, y + 1, oWall)) && (key_jump)
{
    vsp = -7;
}

//horizontal collisions
if (place_meeting(x + hsp, y, oWall))
{
    while (!place_meeting(x + sign(hsp), y, oWall))
    {
        x = x + sign(hsp);
    }
    hsp = 0;
}
x = x + hsp;

//vertical collisions
if (place_meeting(x , y + vsp, oWall))
{
    while (!place_meeting(x, y+ sign(vsp), oWall))
    {
        y = y + sign(vsp);
    }
    vsp = 0;
}

sentences:
How to implement scripted events? I'm building a game in C++ (using SDL) for a college project, I'm trying to figure out how to script events that happens when a player does something, or some time passes etc.

I have a and idea of how to do it but I don't want to go against how it's commonly done.

Right now I have a class called Obj from where enemies, items and the player are child classes, my idea is to add 3 public variables to it like this:

class Obj{
    int eventDeath,eventTouch,eventTalk,eventMeet;
}

Then I could create an Obj with eventDeath=1 and when it died it would fire event(1). event() would be something like this:

void event(int n){
   switch(n){
   case 1:
      dialog("I'm dying");
      break;
   }
}

I could also add invisible "Obj" in specific places for when a player walks over a certain place. I don't know if this is a good idea but I can't think of other means to do it. How is it commonly done? Also how do I keep track of events that already happened?

sentences:
Creating fake 3D character for 2D isometric game. Characters in my 2D isometric game are composed of several sprites corresponding to particular body parts (head, torso, upper arm, lower arm, etc.) which let me extensively customize my characters in-game and do skeletal animations.

I would like to avoid creating animations in all eight directions and since I cannot use 3D models - there are many reasons for that and please do not suggest using 3D - I'm looking for a way to fake 3D so the character could be freely rotated in all directions, but use only one animation.

I imagine that this fake 3D could be achieved by an algorithm which would change body parts locations (x, y), their scale (xscale, yscale) and drawing order. How would I go about it?

Should I add to every sprite a fake z variable? What then? Are there any known examples of something similar?

Throw me some ideas

sentences:
Need help in getting sequential impulse method working i have made a very very simple physics system based on sequential impulse method - with single contacts only and no angular rotation at all. Contact points are calculated using separating axis theorem.

Unfortunatly with small gravity my test-simulation is stable, but with increasing gravity it gets more and more unstable. My player and my moving elevator just goes crazy...

The solver is basically the same as box2d, but without any angular rotation at all - so no need for clipped contact points.

It does the following:

Integrating the external forces (gravity, player input)
Calculating all contact points using SAT for each unique body pair.
Solving movement iteratively by applying impulses so it just touches the surface (restitution is set to zero)
Integrating the new velocity to get a new position
Re-calculate contact distances
Solving position errors iteratively by applying impulses to the position by using baumgarte stabilization method

All the solver code is nearly a port of box2d Box2D/Dynamics/b2ContactSolver.cpp.
Even the coefficients are set to the same values and the world uses meters as units.

Does someone know this stuff and could help me to learn this properly please?
Since months i am fighting with this kind of physics programming and has always issues :-(
Unfortunatly i dont have any algebra knowledge, even though i understand the most of it.

Here is the short code in a javascript environment:
http://jsbin.com/xoqiquxoyo/1/

sentences:
Translating ChainShape to world coordinates according to touch drag input I'm trying to draw a ChainShape according to touch screen coordinates, however the coordinates are slightly off from my touch coordinates. I translate the chain drawn on the screen to world coordinates but don't think I've done it correctly.

I tried setting the shape's position to the first vertex but it positions it even further from the original touch coordinates. Can someone please help me understand where I'm going wrong?

public class Play implements Screen {
    private static final float TIMESTEP = 1 / 60f;
    private static final int VELOCITYITERATIONS = 8, POSITIONITERATIONS = 3;

    private Box2DDebugRenderer debugRenderer;
    private OrthographicCamera camera;
    private PolygonSpriteBatch batch;
    private World world;

    private List<Float> chain_verts = new ArrayList<Float>();
    private float[] chain;

    @Override
    public void show() {
        world = new World(new Vector2(0f, -9.81f), true);
        debugRenderer = new Box2DDebugRenderer();
        camera = new OrthographicCamera();
        batch  = new PolygonSpriteBatch();

        InputProcessor input_0 = new GestureDetector(new Gesture() {
        }) {
            @Override
            public boolean touchUp(float x, float y, int pointer, int button) {
                if (chain_verts.size() != 0) {
                    chain = new float[chain_verts.size()];
                }

                for (int i = 0; i < chain_verts.size(); i++) {
                    chain[i] = chain_verts.get(i);
                    System.out.print(chain[i] + " ");
                }

                ChainShape chainShape = new ChainShape();
                chainShape.createChain(chain);

                Vector3 mouse = new Vector3();
                camera.unproject(mouse.set(Gdx.input.getX(), Gdx.input.getY(), 0));

                BodyDef bodyDef = new BodyDef();
                bodyDef.type = BodyType.StaticBody;
                bodyDef.position.set(mouse.x , mouse.y);

                FixtureDef fixtureDef = new FixtureDef();
                fixtureDef.shape = chainShape;

                world.createBody(bodyDef).createFixture(fixtureDef);

                chain_verts.clear();
                chainShape.dispose();

                return super.touchUp(x, y, pointer, button);
            }

            @Override
            public boolean touchDragged(float x, float y, int pointer) {
                chain_verts.add(x);
                chain_verts.add(Gdx.graphics.getHeight()-y);
                return super.touchDragged(x, y, pointer);
            }
        };

        Gdx.input.setInputProcessor(input_0);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        world.step(TIMESTEP, VELOCITYITERATIONS, POSITIONITERATIONS);

        camera.position.set(0, 20, 0);
        camera.update();

        batch.setProjectionMatrix(camera.combined);

        debugRenderer.render(world, camera.combined);
    }

    @Override
    public void resize(int width, int height) {
        camera.viewportWidth = 1200;
        camera.viewportHeight = 800;
    }

    @Override
    public void pause() {}

    @Override
    public void resume() {}

    @Override
    public void hide() {
        dispose();
    }

    @Override
    public void dispose() {
        batch.dispose();
        world.dispose();
        debugRenderer.dispose();
    }
}

sentences: gazing and lip syncing in Unity 5.2 Is it possible to achieve gazing or lip syncing in Unity 5.2 at all, similar to Locomotion done through MecAnim?

sentences: Where the fxc.exe is located in Windows SDK? I'm using Windows SDK under Windows 8 with Visual Studio 2013. Where I can find fxc? I do not use old Directx SDK.

sentences:
JBox2D applyLinearImpulse doesn't work So i have this line of code:

if(input.isKeyDown(Input.KEY_W)&&canJump())
    {
        body.applyLinearImpulse(new Vec2(0, 30), cam.screenToWorld(body.getPosition()));
        System.out.println("I can jump!");
    }

My problem is that the console display I can jump! but the body doesn't do that. Can you explain to me if i do something wrong?

Some more code.
This function creates my 'hero' the one supposed to jump.

private Body setDynamic(float width, float height, float x, float y)
{
    PolygonShape shape = new PolygonShape();
    shape.setAsBox(width/2, height/2);

    BodyDef bd = new BodyDef();
    bd.allowSleep = true;
    bd.position = new Vec2(cam.screenToWorld(new Vec2(x + width / 2, y + height / 2)));
    bd.type = BodyType.DYNAMIC;
    bd.userData = new BodyInfo(width, height);

    Body body = world.createBody(bd);
    body.createFixture(shape, 10);

    return body;
}

And this is the main update loop:

if(input.isKeyDown(Input.KEY_A))
    {
        body.setLinearVelocity(new Vec2(-10*delta, body.getLinearVelocity().y));
    }
    else if (input.isKeyDown(Input.KEY_D))
    {
        body.setLinearVelocity(new Vec2(10*delta, body.getLinearVelocity().y));
    }
    else
    {
        body.setLinearVelocity(new Vec2(0, body.getLinearVelocity().y));
    }

    if(input.isKeyDown(Input.KEY_W)&&canJump())
    {
        body.applyLinearImpulse(new Vec2(0, 30), body.getPosition());
        System.out.println("I can jump!");
    }
    world.step(delta * 0.001f, 10, 5);

}

sentences:
How to make a top down shooter? I want to know is with XNA 4.0 (and C#) How do I exactly make a top down shooter? I have been looking for ages, but have been unable to find out how.

If someone could tell me how to get started with it or possibly link me to a good easy to understand tutorial that would be fantastic!

sentences:
How to properly delete unwanted models I am implementing bullets into my game, and each bullet has a lifetime. Whenever the bullet has existed for a set amount of time or collides with an object, the bullet should be deleted. I implemented the timer properly and whenever the bullet reaches the end of its life, it gets deleted. The problem occurs whenever I shoot another bullet. This instantly causes a crash with the code:
Exception thrown at 0x044765D7 (nvoglv32.dll) in gravityGame.exe: 0xC0000005: Access violation reading location 0x00000000.
After some research, I've found that this usually means that I am trying to render something that is a nullptr. My thinking is that I am not deleting the previous bullet properly and this affects the new one. A single bullet object is created on startup, and every new bullet is copied using the following line of code:
std::shared_ptr<Bullet> bullet = std::make_shared<Bullet>(*std::dynamic_pointer_cast<Bullet>(modelsLoaded.at(i)));
The reason for the dynamic pointer cast is because it is in a vector of its base class that it inherits from. Whenever the bullet needs to get deleted, it is erased from the bullets vector using bullets.erase(bullets.begin()+index); and the object it is pointing to should go out of scope, there is nothing else pointing to it. I feel like somehow having that object getting deleted has an adverse effect on the other bullets in the vector, but I do not know how. A new object is created and all the data from the original bullet gets copied over. How could deleting a copy of an object mess with the other copied objects? The functions to create, and render the models are below.
Generate Model Function
    //binds id
    glGenBuffers(1, &VBO);
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &EBO);
    glGenTextures(1, &texture);
    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, verticesSizeTexture * 8 * sizeof(float), verticesTexture, GL_STATIC_DRAW);
    // position attribute
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    // color attribute
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indicesSizeTexture * 4, indicesTexture, GL_STATIC_DRAW);
    //texture
    glBindTexture(GL_TEXTURE_2D, texture);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
    glEnableVertexAttribArray(2);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);

Rendering Function
    unsigned int transformLoc = glGetUniformLocation(shader->ID, "location");
    glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(trans));

    glBindTexture(GL_TEXTURE_2D, texture);
    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLES, indicesSizeTexture, GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);

Destructor
glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO);
glDeleteBuffers(1, &EBO);

Update
After removing the contents of the destructor, the problem goes away. However, I would like to have some sort of destructor to allow for the proper freeing of memory.

sentences:
Real-Time Strategy Gameplay I am working on building a HTML5 RTS game, and my current state is that I am building the Campaign mode of the game, and want to define the gameplay (The Scoring, Unit Behaviors/Attributes).

I am searching for links/articles/books about how to define the gameplay, for me this:

The scoring
Figuring out levels of control (in any RTS game, there is units, individuals and squads)
Unit action/attributes/properties
point timing (how long it will take to play?)
Achievements
..etc

I want to see how they usually define these areas in RTS games, I expect to see general document discussing this concept that I can use to build the gameplay.

Any idea? Is my question clear or I need to provide more details?

sentences:
glGenArrays - This functionality is not available Whenever I call glGenVertexArrays(), I get the following exception:

  Exception in thread "main" java.lang.IllegalStateException: This functionality is not available.
      at org.lwjgl.system.Checks.checkFunctionality(Checks.java:36)
      at org.lwjgl.opengl.GL30.getInstance(GL30.java:651)
      at org.lwjgl.opengl.GL30.nglGenVertexArrays(GL30.java:3101)
      at org.lwjgl.opengl.GL30.glGenVertexArrays(GL30.java:3128)
      at me.package.name.ClassName.methodName(ClassName.java:ANY_LINE_NUMBER)

The operating system is OS X Yosemite 10.10.2, Java 7. I think that this problem is OS X specific.

Immediate mode drawing does work.

I am using LWJGL 3.

sentences: Enabling virtualization on a PC I was designing games in unity with some friends but none of us have a mac so none of us can download the apple sdk.  To use the sdk, we will have to run a virtual machine with osx on it.  Virtualization is disabled on most PCs by default and I was wondering if there was any way to change that without rebooting into the bios.  If not, how would I change it in the bios?  Thanks for your help.

sentences:
Handling collision with 2D surfaces and player sprite What's the best way of representing surfaces in a 2d top down racing game? I'd like paved and dirt surfaces in my game to have different friction properties. Would you break up the map into a grid and simply check where in the grid the car is to determine the friction? Or is there a better way of managing it?

The roads and dirt are not self contained all or nothing tiles either, so I'd have to handle a grid section that contained some road and some dirt.

sentences:
Unity - SpriteRenderer. Trying to make sprite from code using Texture2d.whitetexture I have been trying to write a method that fills a rectangle with a color. I've tried it as a new 2D and 3D project just in case, but this gives the same results.

Basically, i want the script to make a new GameObject, give it a SpriteRenderer component and then fill the given rectangle with the given color.

I have tried to work from the Unity docs and other sources of info, but no matter how much I look around, this now looks correct to me but doesnt work.

The result (as pictured) shows the new object with the sprite renderer and even shows the right size (there are blue 'corner' icons in the scene view I can see but no sprite or rectangle of any kind.

using UnityEngine;

public class GameBoard : MonoBehaviour
{
    const ushort cellCount_x = 10;
    const ushort cellCount_y = 24; // only 20 will be visible to player
    const ushort cellsize = 50;

    GameObject testBlock;
    SpriteRenderer testBlockRen;

    private void Start()
    {
        testBlock = new GameObject();
        testBlockRen = testBlock.AddComponent<SpriteRenderer>();
        testBlockRen.sprite = CreateRectSprite(new Rect(0, 0, cellsize, cellsize), Color.red);
    }

    Sprite CreateRectSprite(Rect rect, Color color)
    {
        Texture2D tex = Texture2D.whiteTexture;
        tex.SetPixel(0, 0, color);
        tex.Resize((int)rect.width, (int)rect.height);
        Sprite sprite = Sprite.Create(tex, rect, Vector2.zero);
        return sprite;
    }
}

By the way: I have made sure the camera 'z' is less than 0 (it's -10). And the camera is centred where the sprite is supposed to appear.

Note: I can get a sprite to render fine if I create a texture in gimp and then use Resources.Load() . But I am trying to create the sprite using no source texture whatsoever (other than Texture2d.whitetexture)

sentences:
smallest distance randomly generated objects For a project in gamemaker, I'm making a galaxy with several planets in it (about 30), which have random placements (there is a minimum distance between them).
After the planet generating, i'm trying to figure out how to calculate the two closest planets for each individual planet, so I can make trade routes between them.
So, each planet has two planets that are closest to it, and I'm trying to make an array in which the coordinates of that planet and the two closest planets are.

I'm using the following code:

///trade route making
var a1;
var a2;
var R1;
var dist;

//what each kolom is
global.traderoutes[0,0]="x1";
global.traderoutes[1,0]="y1";
global.traderoutes[2,0]="x2";
global.traderoutes[3,0]="y2";

//global.traderoutes coordinates length, +1 everytime a set is added
global.R1=1;

for (i=1;i=global.TT;i+=1){

  global.a1=100000000; //a1 and a2 are values to check against, larger than any distance could possibly be.
  global.a2=100000000;
for (j=1+i;j=global.TT;j+=1){
    dist=point_distance(global.planetinfo[1,i],global.planetinfo[2,i],global.planetinfo[1,j],global.planetinfo[2,j]);
    if (dist<=global.a1){
       global.traderoutes[0,R1]=global.planetinfo[1,i];
       global.traderoutes[1,R1]=global.planetinfo[2,i];
       global.traderoutes[2,R1]=global.planetinfo[1,j];
       global.traderoutes[3,R1]=global.planetinfo[2,j];

       global.a1=dist;
       global.R1+=1;
    }
    else if (dist<=global.a2){
       global.traderoutes[0,R1]=global.planetinfo[1,i];
       global.traderoutes[1,R1]=global.planetinfo[2,i];
       global.traderoutes[2,R1]=global.planetinfo[1,j];
       global.traderoutes[3,R1]=global.planetinfo[2,j];

       global.a2=dist;
       global.R1+=1;
    }
}
}

global.TT is the length of the planetinfo array, where all the coordinates for each planet are stored in the first (xcoordinate) and second(ycoordinate) column.

However, it doesn't work. global.traderoutes always comes out empty, it doesn't create any new rows beside the 0th one, where "x1, y1,x2,y2" are written above each kolomn.
Can anyone see a mistake I made in the code? Any help would be greatly appreciated.

sentences:
Need help transforming DirectX 9 skybox hlsl shader to DirectX 11 I am in the middle of implementing a skybox to my game. I have been following this tutorial http://rbwhitaker.wikidot.com/skyboxes-2. I am using MonoGame as a framework and in order to support both Windows and Windows 8 metro I need to compile the shader with pixel and vertex shader 4.

compile vs_4_0_level_9_1
compile ps_4_0_level_9_1

However some of the hlsl syntax has been updated with DX10 and DX11.

I need to update this hlsl code:

float4x4 World;
float4x4 View;
float4x4 Projection;

float3 CameraPosition;

Texture SkyBoxTexture;
samplerCUBE SkyBoxSampler = sampler_state
{
   texture = <SkyBoxTexture>;
   magfilter = LINEAR;
   minfilter = LINEAR;
   mipfilter = LINEAR;
   AddressU = Mirror;
   AddressV = Mirror;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float3 TextureCoordinate : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    float4 VertexPosition = mul(input.Position, World);
    output.TextureCoordinate = VertexPosition - CameraPosition;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return texCUBE(SkyBoxSampler, normalize(input.TextureCoordinate));
}

technique Skybox
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

I quess I need to change Texture into TextureCube, change sampler, swap texCUBE() with TextureCube.Sample() and change PixelShader return semantic to SV_Target0.

I'm very new in shader languages and any help is appreciated!

sentences:
Object orientated design for RPG character creation This question may not be helpful to some but I'll ask anyway. I've hit a bit of a object orientated design issue. Making a RPG and the user gets to choose their own class i.e warrior/rogue/etc.

Sample:

int main()
{
    CharacterP *cPntr = new CharacterP // creates base pointer
    cPntr->createClass(cPntr, "Warrior"); // creates a new Warrior object which cPntr is now
                                           //pointing to.

    cPntr->printCharacterName();  //will print the warriors print name function

    return 0;
};

class CharacterP
{
    void createClass(CharacterP* &samp, string choice)
    {
        if (choice == "Warrior")
            samp = new Warrior;
         // other classes go here...... i.e Rogue, Mage
    }

    virtual void printCharacterName() //I don't want this function here
                                      //as this function will never be used, however it is
                                      //needed as the type of pointer for cPntr is CharacterP
                                      //which is the base of warrior.
    {
        std:: cout << "i don't want this function here, although it is required;
    }

};

class Warrior : public CharacterP
{
    virtual void printCharacterName()
    {
        std::cout << "you printed warrior";
    }
};

The main problem is the way I've designed this: If I want to use a Warrior function, I also have to define it into the base class CharacterP. When i start branching this out and adding more classes i.e Mage/rogue its going to be a maintenance nightmare as the base class would have a lot of functions that won't be used at all.

Questions:

Why does this happen?

Why does the base class also need to have the same function even though the derived function is virtual?

What is a more efficient way of doing what i am doing? (giving the user
the ability to create any classes they want i.e Warrior,Warrior,Mage/Rogue,Mage,Mage) maybe a way to create a warrior object with its own pointer which can be repeated so 3 warrior objects are created and can be used at runtime.

sentences:
Batch/Combine multiple Graphics.DrawProcedural-Calls in Unity I have multiple calls to Graphics.DrawProcedural in my Unity-project.
E.g. I'm drawing 1000 procedural geometries that share the same material and get their positions/meshes from a ComputeBuffer.

At some place in my code I'm doing something like this

foreach(ProceduralGeometry pG in proceduralGeometries)
{
    pG.Draw();
}

Where draw sets the Materials buffer accordingly and calls Graphics.DrawProcedural.

Is there anything I can do to batch all these geometries together? Currently I perform over 1000 DrawCalls (seen in the frame inspector) which happen to be very expensive performancewise.

Thanks in advance!

sentences:
interace between C and Lua function with 3D vector arguments I have C++ function (which runs some physical simulation inside my game engine) which looks like this:

void doSomePhysics( int nIters, Vec3d pos, Vec3d vel ){ /*... don't care ...*/ }

I want call this function from a lua script likes this:

doSomePhysics( 100, {1.0,-2.0,3.0}, {-8.0,7.0,-6.0} )

I'm trying to figure out how to make lua interface to this function.

I would like to do several general helper functions for passing 2D,3D and 4D vectors and matrices since I will heavily use them.

Here is sketch what I'm currently trying to do (But I know it is not correct):

void lua_getVec3(lua_State *L, Vec3d& vec ){
    // universal helper function to get Vec3 function argument from Lua to C++ function
    luaL_checktype(L, 1, LUA_TTABLE);
    lua_settop(L, 1);
    int a_size = lua_rawlen(L, 1);
    lua_rawgeti(L, 1, 1); vec.x = lua_tonumber(L, -1);
    lua_rawgeti(L, 2, 2); vec.y = lua_tonumber(L, -2);
    lua_rawgeti(L, 3, 3); vec.z = lua_tonumber(L, -3);
    lua_pop(L, 3);
}

int l_doSomePhysics(lua_State* L){
    // lua interface for doSomePhysics
    Vec3d pos,vel;
    int n = lua_tointeger(L, 1);
    lua_getVec3(L, pos );
    lua_getVec3(L, vel );
    doSomePhysics(n,pos,vel);
    lua_pushnumber(state, 123);
    return 1;
}

I read several short tutorials 1 2 3 but it seems horribly complicated, confusing and error-prone ... I'm completely lost in stack indexes (what is my current position in the stack?, what is correct relative index? etc.). I'm reluctant to believe the most famous game scripting language needs sooooo much boiler-plate code and so much pain for interfacing every little function.

EDIT: answer is here

sentences:
Resizing the window moves and stretches the texture I have a basic screen with 3 TextureRegions rendered on the screen rendered with this code(Ignore the hardcoded numbers, bad decision I know will be replaced later):

Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 225);
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 150);
batch.draw(btnIdle, (Gdx.graphics.getWidth() / 2) - (169 / 2), 75);
batch.end();

and it renders like this:

But if I resize the window it becomes like this:

Why does the texture become like that when the window is resized and what are the solutions?

P.S. I am aware of this question and it does not solve my problem

sentences:
Typical collision detection I would like to know how is the typical collision detection of most games. For example, you control a character which can move in 2 dimensional directions (except up and down). Now lets asume he walks into a wall, most of the games depending on character angle and the BB normal face will only stop the player in one axis, but will continue moving in the other along the wall axis. How is that done?

I've only managed to stop the character from going through the wall by seting the position to the last one in the past frame if the new position colllisions the bounding box. But this just makes the player stop sharply and unrealisticly.

sentences:
why is my (from example) shader appearing as black? I have the following (very simple) shader:

#pragma kernel CSMain
RWTexture2D<float4> Result;

[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
    Result[id.xy] = float4(1,0,0,1);
}

Here is the dispatcher code:

using UnityEngine;
using System.Collections;

public class SkyShaderDispatcher : MonoBehaviour {

    public ComputeShader shader;
    public RenderTexture output;
    void Start(){
//      RenderTexture output = new RenderTexture(256,256,24);
//      output.enableRandomWrite = true;
//      output.Create();

    }
    void Update(){
        RunShader();
    }
    void RunShader()
    {
        int kernelHandle = shader.FindKernel("CSMain");
        shader.SetTexture(kernelHandle, "Result", output);
        shader.Dispatch(kernelHandle, 256/8, 256/8, 1);
    }
}

which is the default red shader (it makes the texture red).
However, when I put the texture in a material and give that to an object, then that results in the object being black. Anyone seeing what I'm doing wrong?

As the shader is the default example right now it should work suggesting that maybe something is wrong with the texture?

Edit:
Trying to fit the same code on a skybox also fails. I have changed the dispatcher code into:

using UnityEngine;
using System.Collections;

public class launchClouds : MonoBehaviour {

    public ComputeShader shader;
    private RenderTexture output;
    void Start(){

    }
    void Update(){
        RunShader();
    }

    void RunShader()
    {
        int kernelHandle = shader.FindKernel("CSMain");
        RenderTexture output = new RenderTexture(256,256,24);
        output.enableRandomWrite = true;
        output.Create();
        Material mat = gameObject.GetComponent<Skybox>().material;
        mat.SetTexture("_FrontTex",output);
        mat.SetTexture("_BackTex",output);
        mat.SetTexture("_LeftTex",output);
        mat.SetTexture("_RightTex",output);
        mat.SetTexture("_UpTex",output);
        mat.SetTexture("_DownTex",output);
        shader.SetTexture(kernelHandle,
                          "Result", output);
        shader.Dispatch(kernelHandle, 256/8, 256/8, 1);
    }
}

but that turns the sky black rather then making the sky red. This is using unity 5 32 bits with DirectX11.

sentences:
Have body resume constant velocity after collision I want to have a body move at a constant velocity, but react to collisions.

My example game is a train, I want it to move at 1 meter a second. If an obstacle appears on the tracks, I want it to react by smashing through it (which will normally slow it down). But when the obstacle is cleared, I want the train to accelerate back to 1 m/s and continue on.

It seems like the applyLinearImpulse() and applyLinearForce() methods are the place to start, but those are one-shot methods.

Thanks

sentences:
Minecraft - How do I check if someone has a clear inventory How do I check if a player has a clear inventory?
I'm making a PvP arena plugin but I need it so when someone types /pvp join, it checks if they have a clear inventory. If they do have a clear inventory, it lets them join, if they don't, it asks them to.

I tried this but it's not reliable as there are more slots:

if(p.getInventory().getArmorContents() == null
    && p.getInventory().getItemInHand() == null
    && p.getInventory().getItemInHand() == null) {

Then I tried this but it did not work:

if (p.getInventory().getContents().length == 0) {

sentences:
How do I transform from local points to world when using a scroll view? I'm using a scroll view to store my game character icons (basically an RPG). The movement system for the characters is tile based, but in game hazards could be located anywhere. So I need to detect if a certain tile will interset with a hazard if a character moves into it. To do this I can calculate the corners of the tile using the co-ordinate system of the scroll view. I thought I could turn these into world co-ordinates then query to see if the collider attached to the hazard contains the point (the collider could be rotated so I can't just do the math myself).

When I try to convert the co-ordinates into world co-ordinates though the numbers I get just don't match up. For example, the lower left corner of the tile a character will move into is at (-1250.0, -938.0). If I convert that to world co-ordinates I get (-28.7, -49.8). The actual position for the hazard I'm testing against has a world position of (-8.0, -1.5, 93.4) though and the test tile should be right on top of it.

I'm using code like this to try to get the world co-ordinates:

  Vector2 charPosition5 = travellingCharacter.owningGameObject.GetComponent<RectTransform>().transform.TransformPoint(travellingCharacter.GetComponent<RectTransform>().anchorMax);
  Vector2 charPosition6 = travellingCharacter.GetComponent<RectTransform>().transform.TransformPoint(travellingCharacter.owningGameObject.GetComponent<RectTransform>().anchorMin);

Can someone tell me what values I should be feeding in or what other function I should be using please?

sentences:
Progress bar in Super Hexagon using OpenGL ES 2 (Android) I'm wondering how the progress bar in Super Hexagon was made.  (see image, top left) Actually I am not very sure how to implement a progress bar at all using OpenGL ES 2 on Android, but I am asking specifically about the one used in Super Hexagon because it seems to me less straightforward / obvious than others: the bar changes its colour during game play.

I think one possibility is to use the built-in Android progress bar. I can see from some Stackoverflow questions that you can change the default blue colour to whatever you want, but I'm not sure whether you can update it during the game play.

The other possibility I can think of for implementing a progress bar is to have a small texture that starts with a scale of 0 and that you keep scaling until it reaches the maximum size, representing 100%. But this suffers from the same problem as before: you'll not be able to update the colour of the texture during run-time. It's fixed.

So what's the best way to approach this problem?

*I'm assuming he didn't use a particular library, although if he did, it would be interesting to know. I'm interested in a pure OpenGL ES 2 + Android solution.

sentences:
Game upgrade launch : Cross-platform release timing I just finished doing a major upgrade for a old mobile title, that haven't seen an update in over a year. Lots of new content, things are looking nice.

Sadly, these days it takes an average of 12 days to get the update through the iTunes approval tube, but less than 2 hours to throw it live right away on Google Play.

If i put the version up now, i can hit the autumn vacation period on android at least, and iOS people will have to wait till their version has been approved.

But I hear from other studios that they wait and launch both updates at the same time, to reach a socalled "synergy effect", since (as I understand it) attention to the update spills over to the mirrored platform.

But... I am simply skeptical on this. Is this effect really so strong, that you would postpone launches for weeks ? And googling for a bit, I'm having a hard time finding any numbers that can back this strategy up.

To put it more direct :
Is holding back a app launch till all platforms are in sync really "worth it" ?

Ofcouse I will hold back my PR-horses till the upgrade is ready for both platforms, but is it really that bad to do a "premature" launch of an app on one platform ?

If anyone can back this strategy up with more than just a gut feeling (numbers and charts are always great) I am all ears. I'm not doing anything to my app untill I have some solid intel on these upgrade strategies.

PS: I am aware the same method is being used on initial app launch, where in a way it makes more sense to me. If you have any data on how strong the benefit of this strategy is there, I'm all ears too.

sentences:
Need help with a complex 3d scene (using Ogre and bullet) In my setup there is a box with a hole on one side, and a freely movable "stick" (or bar, tube). This stick can be inserted/moved through the hole into the box. This hole is exactly as wide as the diameter of the stick.

In reality, when you would now hold the end of the stick in your hand and move the hand left/right or up/down, the other end of the stick, which is inside the box, would move into the opposite direction of your hand movement (because the stick is affixed at the pivot point where it is entering the box through the hole).

(I hope you understand what I mean so far.)

Now I need to simulate such a setup in a 3d program. I have already successfully developed an Ogre3d framework for this application, including bullet. But what I don't know is how I can implement in my program what I have described above. This application must include two more features:

The scene camera is attached to the end of the stick that is inserted into the box. So when the user would move the mouse (to control "his" end of the stick outside the box), then the camera attached to the stick would move in the opposite direction, as described above.
The stick has some length, and the user can push it further into the box, or pull it closer to him again. That means of course that the max. radius on which the end of the stick inside the box can move depends on how far the stick is pushed into the box. Thus, the more the stick is pushed into the box, the larger the max. radius of this end of the stick with the camera will be.

I understand this is maybe quite a complex thing, so I don't expect any real source code here. I already have the Ogre and bullet part as said up and running, as well as a camera attached to the stick. This works fine. What I don't know though is how I can simulate the setup described above. Especially the requirement that the stick is affixed at the position of the hole on the box, where it is inserted into the box.

Any ideas how I could approach to implement the described setup?

sentences:
How to write a unit test in Unity? is there a tutorial and patterns to write unit tests in Unity ?

Should we use the classical c# way and test the code or should we test the interactions in UI ? If so how?

sentences:
Is it possible to record video, depth map and 6D pose of any games? I'm not a game developer, but a researcher working on improving video quality in various contexts. For my current problem, I need to collect videos which have both RGB data as well as depth data. Video can be monocular or stereo. However, if there is egomotion, I'll need the camera pose (rotation and translation) as well. Is there any way to record all these information in any kind of games? Games can be on any platform: PC games, mobile games or VR games.
In short, I want to record gameplay but with additional information such as depth map and camera pose.

sentences:
How to detect collision between two directed object? I'm currently writing a game which is like Battle City game. But right now I'm facing a trouble involved to checking collision between two objects. This is the code that I wrote:

//-------------------------------------------------------------------------------------------
//  check collision between a tank and another object
//
bool GameController::checkTankMeetsObject(Tank tank, GameObject ob)
{
    int obX = ob.getCoord().getX();
    int obY = ob.getCoord().getY();

    // calculate area of obstacle: bottom left (X1, Y1), top right (X2, Y2)
    int obX1 = obX - SQUARESIZE / 2;
    int obX2 = obX + SQUARESIZE / 2;
    int obY1 = obY - SQUARESIZE / 2;
    int obY2 = obY + SQUARESIZE / 2;

    int tankX = tank.getCoord().getX();
    int tankY = tank.getCoord().getY();

    switch (tank.getDir())
    {
    case UP:
        if ((tankX < obX2 + SQUARESIZE / 2 && tankX > obX1 - SQUARESIZE / 2) &&
            (tankY + SQUARESIZE / 2 > obY1 && tankY + SQUARESIZE / 2 < obY2))
            return true;
        break;

    case DOWN:
        if ((tankX < obX2 + SQUARESIZE / 2 && tankX > obX1 - SQUARESIZE / 2) &&
            (tankY - SQUARESIZE / 2 > obY1 && tankY - SQUARESIZE / 2 < obY2))
            return true;
        break;

    case LEFT:
        if ((tankX - SQUARESIZE / 2 < obX2 && tankX - SQUARESIZE / 2 > obX1) &&
            (tankY > obY1 - SQUARESIZE / 2 && tankY < obY2 + SQUARESIZE / 2))
            return true;
        break;

    case RIGHT:
        if ((tankX + SQUARESIZE / 2 < obX2 && tankX + SQUARESIZE / 2 > obX1) &&
            (tankY > obY1 - SQUARESIZE / 2 && tankY < obY2 + SQUARESIZE / 2))
            return true;
        break;
    }

    return false;
}

This code does well with normal circumstance, but in special ones like which I describe below, it doesn't work.

The white squares are obstacles and the grey square is the tank. Current direction of the tank is RIGHT. In this situation, I can not move the tank RIGHT or LEFT, only direction I can go is DOWN. Is there any solution to optimize my code?

sentences:
How many OpenGL programs should I use to render multiple objects? My scene has multiple objects in it. (Let's say 3 cubes, 1 cylinder, 8 spheres.) I assume I should create a vertex shader for each. How many programs should I have?

Alternatives:

One program per object
One program for all cubes and another for all spheres (assuming they use the same shaders)
One large program for everything

What is the correct approach?

sentences:
Problem when texturing triangles using glVertexPointer() I'm having a problem for displaying a single quad, here is how i do :

//note: this code is only for 2 triangles, while on picture there is 4 triangles
float tex_coord[] =
{
   0.0, 0.0, //3
   0.0, 1.0, //2
   1.0, 1.0, //0
   1.0, 1.0, //0
   1.0, 0.0, //1
   0.0, 0.0  //3
};

int indexes[] =
{
    3, 2, 0, 0, 1, 3
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

sentences:
Rotate bone on 1 axis to look at another object - Unity 3D I'm new to game development and I'm trying to create a basic 3D Tower Defence game as my first project. I've created a basic turret in Blender and I'm now trying to rotate 2 different bones to make the turret follow the enemy. The first bone (which I have working) rotates the turret to face the direction of the enemy. The second which I can't get right needs to rotate the gun at the top of the turret to look down at the enemy. I need it to keep facing the same direction as the rest of the turret and don't want it to tilt to either side. So it needs to move on 1 axis only.

I have tried various things, including examples from the Internet but I can't figure it out. So far I've managed to get it to look down at its base, up at the sky and spin like a wheel. Basically everything except where it's supposed to be looking.

Here is the code I have at the moment:

if (enemiesInRange.Count > 0)
    {
        //Rotate Platform //#### This section works fine
        Transform platform = transform.root.Find("Armature/BaseBone/PlatformBone");

        Quaternion targetRotation; //Final rotation (I.e. facing the enemy)

        Vector3 turretPosition = platform.position; //Store the turrets current position
        turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

        Vector3 targetPosition = enemyManager.activeEnemies[enemiesInRange[0]].transform.position;

        targetRotation = Quaternion.LookRotation(targetPosition - turretPosition);

        float rotateSpeed = 2.0f * Time.deltaTime;
        platform.transform.rotation = Quaternion.Lerp(platform.transform.rotation, targetRotation, rotateSpeed);

        //Rotate GunBox //####TO DO: This part is not working
        Transform gunBox = transform.root.FindChild("Armature/BaseBone/PlatformBone/LowerArmBone/UpperArmBone/GunBoxBone");
        Vector3 gunBoxPosition = gunBox.position;

        float angle = Vector3.Angle(gunBoxPosition, targetPosition);

        gunBox.RotateAround(gunBox.position, Vector3.left, angle);

        Debug.Log(angle);

    }

Here's a picture of the turret to give you an idea what I'm working with. You can see in the screenshot that the bone's default X rotation is roughly -50.

Enemies walk through the trench around the turret. The PlatformBone rotates everything from the silver platform upwards.

I also don't understand why the line below makes the turret rotate instead of tilting it. I would expect to rotate the turret around the Y axis to keep it flat on the floor and face another direction. Yet I seem to have to do the opposite (If I select the PlatformBone its Y axis is facing up as expected):

turretPosition.y = 0; //0 the Y axis to stop the turret tilting up or down

sentences:
How to save game state in C in Allegro? I'm developing my 1st board-game (go-game) in C with Allegro 5, for a course project. Part of my goal is to make a gamesave of the current gamestate. Let's say for 2 players if we exit the game, and log in the game, we want to reload the previous gamestate such that the position of the stones by 2 players to be preserved in their positions. How can I achieve this?
I will appreciate any related reference, tutorial, or a git reference I can learn more about saving the states of the game.

P.S. I checked the old questions about saving game state, but there are guides only for other languages/libraries not in C/Allegro.

sentences:
How do I make educational games engaging not boring? We make educational games for school students, age 7-18; we can't have any violence or blood in them.

I have scoured Google Play and YouTube for good examples of educational games.

So far I found this math game. The cannon fires at number-enemies, to score, the player should bring their values to exactly zero.
As levels advance, the bigger numbers occur - 10, 20, 30, etc.

Why is it hard to make educational games that are not boring? It seems violence is what attracts most young people nowadays!
One big exception could be puzzles.

sentences:
What is an OO way for my input layer to act upon objects? I'm building a top-down RPG specifically to practice Object Oriented thinking and design. I am keeping in mind coupling, single-responsibility, and so forth. One design issue that's been bugging me is how to ultimately have objects talk while maintaining the loosest coupling possible. As an example, I'm designing the input class now, which will be made up of two layers, like so:

The conundrum is that I don't know how to bridge that gap between Input and HeroActor, which is initialized from the PlayState class, which is also where the hero.update() method is called. Let's say Keyboard has just executed

public void keyPressed(KeyEvent e) {
    switch(e.getKeyCode()) {
        //Some cases

        case KeyEvent.VK_UP:
            //Assume InputEvent.INPUT1 is a defined enumeration in InputEvent
            inputHandler.passInput(InputEvent.INPUT1);
            break;

        //Some more cases
    }
}

I've basically landed here:

public class Input {

    public void passInput(InputEvent e) {
        switch(e) {
            //Some cases

            case InputEvent.INPUT1:
                ????????????????????

            //Some more cases
        }
    }

}

My ideas have been:

Pass a reference to the instance of HeroActor to the Input object, then have Input directly call the moveUp() method on the HeroActor instance.

case InputEvent.INPUT1:
    actor.moveUp();

My instinct tells me this is bad OO design as it tightly couples the two classes.
Make the instance of HeroActor global and basically do the same as above. Even worse OO design.
Write a registerInput(Input inputHandler) function in the Actor class, like so:

public class HeroActor extends Actor {

    //Existing fields and methods

    private Input inputHandler;

    public void registerInput(Input inputHandler) {
        this.inputHandler = inputHandler;
    }

Still, then the HeroActor would have to poll the inputHandler every frame to find out if any actions have applied to it.

I'm in the same situation trying to figure out how to write the collision engine without passing it specific references to the player's HeroActor instance or the dozens of EnemyActor instances in the PlayState constructor.

Any help would be greatly appreciated. My request is not for specific code, but rather common techniques for handling the many objects in a game without ending up with a god object. I've seen some material suggesting an Observer pattern being applied for things like the input layer above, but before I go too far, I'd like some feedback from the community since I've got so many different answers among all of my Googling today.

sentences:
How to create a joint, where the rotation of one object is relative to the other? I would like to create a top down view scene, with one rectangle (top) is on top of an other (base). There is a joint, where these two objects are connected.
The one on the top should be able to freely rotate, but if the base rotates, its rotation should be changed as well, because it should behave as if it is on top of it. If the joint is at the center of both objects, then the top one should rotate like this:
Δ top rotation = Δ time * ( top angular velocity + base angular velocity )

If the joint is not at the center of the objects, then it is more complicated than that. How is it possible to define a joint like that in Box2D?
This is a testbed example with the joint. Notice, that the top one is not rotating:
#include "test.h"

class RelJoint : public Test
{

    b2Body* base;
    b2Body* top;
    b2RevoluteJoint* m_joint;

public:

    RelJoint() {

        m_world->SetGravity(b2Vec2(0.0f, 0.0f));

        {

            b2PolygonShape shape;
            shape.SetAsBox(1.f, 0.5f, b2Vec2(0.0f, 0.0f), 0.0f);

            b2BodyDef bd;
            bd.type = b2_dynamicBody;
            b2Body* body = m_world->CreateBody(&bd);
            body->CreateFixture(&shape, 5.0f);

            body->SetAngularDamping(1.f);

            base = body;
        }

        {

            b2PolygonShape shape;
            shape.SetAsBox(0.5f, 0.25f, b2Vec2(0.0f, 0.0f), 0.0f);

            b2BodyDef bd;
            bd.type = b2_dynamicBody;
            b2Body* body = m_world->CreateBody(&bd);
            body->CreateFixture(&shape, 5.0f);

            top = body;
        }

        b2RevoluteJointDef revoluteJointDef;
        revoluteJointDef.bodyA = base;
        revoluteJointDef.bodyB = top;
        revoluteJointDef.collideConnected = false;

        revoluteJointDef.localAnchorA.Set(0, 0);
        revoluteJointDef.localAnchorB.Set(0, 0);

        m_joint = (b2RevoluteJoint*)m_world->CreateJoint(&revoluteJointDef);

    }

    void Step(Settings& settings) override {
        base->ApplyTorque(3.f, true);

        Test::Step(settings);
    }

    static Test* Create()
    {
        return new RelJoint;
    }

};

static int testIndex = RegisterTest("Joints", "Relative", RelJoint::Create);

I tried to combine b2RevoluteJointDef with b2FrictionJointDef. It looks promising, but unfortunately if I apply torque to the top body only, the base starts to rotate too, which I would like to avoid.

sentences:
How UV channels work in Unity? So this Graph Shader is using UV0 channel:

As far as I know, UV layout in a 3d model file (e.g. fbx) is stored inside the model itself, is that right?

But the picture above implies that a model can contain multiple UV channels inside of itself. Is that true?

sentences:
Why does adding a value to list makes list not editable in unity inspector I am adding elements from the first list to another similar list, but it makes first not editable in the Unity Inspector. Whenever I try to change values from the inspector it makes them again 0. While If I comment list.Add() I can change values in the inspector.

[Serializable]
public class Characterz
{
  public string Name;
  public int Age;
  public float Gold;
}

public class Actor: MonoBehaviour
{
     public List<Characterz> kings=  new List<Characterz>();

    public List<Characterz> Actors = new List<Characterz>();

     void Start()
     {
        for (int y = 0; y < 30; y++)
         {
             Actors.Add(new Characterz());
             if (y < 4)
             {

                 //I need to comment following line to change Actors
                // list value in editor
                 kings.Add(Actors[y]);
             }

         }
      }

}

sentences:
How can i make fade in/out of the alpha color of a material from black to none black? This is script is attached to a black plane.
I have a plane and i added to it a material and the plane is in black.
When running the game the alpha color of the plane material is changing slowly.

The script is working it's getting slowly from dark black to none black.
But i want to make some changes:

It's not my script i took it from the youtube and did some changes the first one converted from js to c# second added the fade bool variable.

First of all i don't see any meaning setting the variable timer to 10 at the top. Any ideas what is the point ?
Second is how can i check when the alpha color value is high enough to do some stuff:

Enabled true the fpc again. Once it's not black again the fpc is still enabled false.
If i want when the alpha color value reached it's max to make automatic fade back to black Now i'm using manual fade bool variable but i wonder how to do it automatic fade in/out.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public float timer = 10.0f;
    public FirstPersonController fpc;
    public bool fade = true;

// Use this for initialization
void Start()
{
    Color tempcolor = GetComponent<Renderer>().material.color;
    tempcolor.a = 1f;
    GetComponent<Renderer>().material.color = tempcolor;

    fpc.enabled = false;
}

// Update is called once per frame
void Update()
{
    timer = Time.deltaTime;

    if (timer >= 0)
    {
        Color tempcolor = GetComponent<Renderer>().material.color;
        if (fade == true)
        {
            tempcolor.a -= 0.1f * Time.deltaTime;
        }
        else
        {
            tempcolor.a += 0.1f * Time.deltaTime;
        }
        GetComponent<Renderer>().material.color = tempcolor;
    }
}

}

sentences:
How to handle forward/backward movement in an oblique top-down view I'm making a pseudo-2D top-down game, where my assets are actually 3d but I use an orthographic projection to introduce more depth.

I saw a picture of how the game "Enter the Gungeon" was actually made in unity 3d.

When I tried doing something likes this I put the camera in orthographic view and after some adjusting I got it to look kind of like this.

The problem is that movement in the z-axis (away / toward the viewpoint, or up and down on the screen) feels very slow because of the whole orthographic thing. You can notice this when moving a player for example.

When I simply increased the speed of the player in the z-axis it felt pretty normal, but I am wondering if that would introduce some unforeseen consequences?

I couldn't find any guides, posts or videos about this. How should I solve this movement problem?

sentences:
How do I debug two android devices simultaneously in Eclipse? I have a multiplayer game which should be tested on two devices at the same time, if possible, with debugging.

Can eclipse do this?  If so, how?

sentences:
Should I continue studying OpenGL or just switch to DirectX to  give me a better chance of landing a job in the game industry? I've been learning graphics programming for some time now using OpenGL and Linux. I'm pretty familiar with most of the concepts, but I would really like to further my knowledge and eventually pursue a career in game development, especially game engine development.

So far it seems to me that the majority of game studios make games for Windows using DirectX.

Edit: I know that the OpenGL vs DirectX question has been asked here before, but I haven't found an answer in the perspective I want.

Edit 2: After reading all the responses/comments I've decided to continue diving deeper into graphics with OpenGL/GLSL, but I'll try to play around with DX as well, just to have a basic understanding of the API.
I'd like to thank everyone for the answers and insight you've given me.

sentences:
Is ActionScript 3 used by Serious Indie Developers? This question is for dedicated independent game developers:

My dream is to be a game developer. I am a senior in high school who has taken Computer Science for all four years. I have used Java the whole time, but last year I started using PHP and ActionScript 3 (with Flixel). I also used Game Maker for a brief period. I apologize for this, I wanted to get that out of the way and clarify the fact that I have experience of some kind with game development.

I am stuck at the moment because I don't quite know what language to use to develop games at a professional level. I am seriously interested in becoming a dedicated game developer, but this issue is really bothering me. I would like to know what the best option would be for my case, based on your experiences. Any advice is appreciated.

Things to consider:

I am only interested in making 2D games (I am not worried about 3D support)
It would be ideal to use something that can be ported to multiple platforms (so as not to run into this problem later)
I can't seem to figure out what the industry likes to use

So far, this is what I have:

I can't decide if it would be wise to stick with ActionScript 3, or move to C++
I know Flash would be for browser games, but what if I want to make a downloadable game, like Plants Vs. Zombies or Super Crate Box? Would Flash be a smart choice for standalone games, or did they use something else?

Thank you for reading this, as I would like to stop worrying about this and make some games! Also, I hope this wasn't all over the place :)

tl;dr Should I move ahead with AS3 or use something else i.e. C++

sentences:
Unity / How can i prevent my model from blinking when it doesnt have normals? Somehow the light which is shining on a moving model is making it "blink" (its like getting very dark and then very lit again.

The model has no normals. (unity import settings: normals: none)

Is there a way to prevent the blinking?

sentences:
Copyright of concept? There is a game that I really like to play when I was young. But there are some features that are not implemented that would be cool.

How can I find copyright database from games editor ?

sentences:
Rendering text with SDL2 and OpenGL I've been trying to have text rendering in my OpenGL scene using SDL2. The tutorial I came across is this one Rendering text

I followed the same code, and I get text rendering fine. However the issue I'm having is that there is obviously a "conflict" between the OpenGL rendering and the SDL_Renderer used in the code. When I run my scene the text displays but everything else keeps flickering. The following gif shows the issue:

Any idea on how to overcome this while still just using SDL2 and OpenGL, not another library or anything.

Thanks

sentences:
Isometric tiles on wrong positions if the mouse points at a negative world coordinate I am using this approach:
http://clintbellanger.net/articles/isometric_math/
Basically, you can calculate the iso coordinates based on the screen coordinates.
What I am doing is, getting the actual world position the mouse is pointing at using get_mouse_global_position() and convert this position to isometric values.
Then I translate those coordinates back to world space coordinates to actually display the sprite.
Problem is, that when the world coordinates come from a negative position, the tiles get offset by almost an entire tile amount.
Here is the relevant code.
The get_coord() function returns the actual world position of the tile used to display the Sprite
func get_coord(pos : Vector2):
    var t = Vector2()
    var e = screen_to_iso(pos)
    t = iso_to_screen(e)
    print(pos)
    print(e)
    print(t)
    return t
    pass
var buildings

func screen_to_iso(pos :Vector2):
    var flipx = 0
    var flipy = 0
    var t = Vector2()
    var x_size = size/2
    var y_size = size/4
    t.x = int((pos.x/x_size) + (pos.y/y_size))/2
    t.y = int((pos.y/y_size) - (pos.x/x_size))/2
    return t
    pass

func iso_to_screen(pos : Vector2):
    var t = Vector2()
    var x_size = size/2
    var y_size = size/4
    t = Vector2((pos.x-pos.y)*x_size, (pos.x+pos.y)*y_size)
    return t
    pass

I can't seem to figure out a way

sentences:
How do I apply collision to a turtle I cannot figure out how to apply collision to a turtle. I am in need of help for collision with pen lines and turtles. I want the two to hit and restart the game but I can't get collision on either.

import turtle
import pygame

wn = turtle.Screen()
wn.bgcolor("black")

#Draw border
mypen = turtle.Turtle()
mypen.penup()
mypen.pencolor('white')
mypen.setposition(-300,-300)
mypen.pendown()
mypen.pensize(3)
for side in range (4):
    mypen.forward(600)
    mypen.left(90)
mypen.hideturtle()

#Create player 1
player = turtle.Turtle()
player.setposition(240,240)
player.setheading(180)
player.color("red")
player.shape("classic")

player.speed(0)

#Create player 2
player2 = turtle.Turtle()
player2.setposition(-240,-240)
player2.color("aqua")
player2.shape("triangle")

player2.speed(0)

#Set speed variable
speed = 3

#Define functions
def turnleft():
    player.left(30)

def turnright():
    player.right(30)

def increasespeed():
    global speed
    speed += 3

#Set keyboard bindings for p1ayer 1

turtle.listen()
turtle.onkey(turnleft,"Left")
turtle.onkey(turnright,"Right")

#Define player 2 functions

def turnleft():
    player2.left(30)

def turnright():
    player2.right(30)

def increasespeed():
    global speed
    speed += 3

#Set keyboard bindings for player 2
turtle.listen()
turtle.onkey(turnleft,"a")
turtle.onkey(turnright,"d")

#turtle.onkey(increasespeed,"Up")

while True:
    player.forward(speed)
    player2.forward(speed)

    #Bouandary
    if player.xcor() > 300 or player.xcor() < -300:
        player.right(100)
    #Boundary
    if player.ycor() > 300 or player.ycor() < -300:
        player.right(100)
    #Bouandary2
    if player2.xcor() > 300 or player2.xcor() < -300:
        player2.right(100)
    #Boundary2
    if player2.ycor() > 300 or player2.ycor() < -300:
        player2.right(100)

sentences:
Changing game object type: reinstantiating the object, or switching an object state I work on a strategy game, where the player occasionally has to transform ordinary citizens into the so called "leaders". Leaders are temporary units, which the player can control directly, in order to interact with the other citizens. After some time, the leader gets transformed back to a normal citizen.

My question is if I should stick to the classical OOP approach of keeping citizens and leaders in two separate classes, whereas the leader class extends the citizen class, and every time when I need a leader, I simply re-instantiate the current citizen instance.

I personally dislike this approach, however. I already have a state machine implemented, and am more likely to keep only the citizen class (or rather, human class). Rather, I'd like to keep the citizen/leader separation into two different states. When I need one or the other type, I simply switch the current state.

sentences:
How do I get my mouse-based input system to work on Android? I am developing the ball breaker game in unity and right now my game work with mouse click button. but i want my game work in android. so what changes i want to do in this code? So when i set the arrow and its jump ball and hit the brick.
Here is the code with image :-

BallController.cs

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

public class BallController : MonoBehaviour {

    public enum ballState {
        aim,
        fire,
        wait,
        endShot
    }

    public ballState currentBallState;

    public Rigidbody2D ball;
    private Vector2 mouseStartPosition;
    private Vector2 mouseEndPosition;
    private float ballVelocityX;
    private float ballVelocityY;
    public float constantSpeed;
    public GameObject arrow;

    // Use this for initialization
    void Start () {
        currentBallState = ballState.aim;

    }

    // Update is called once per frame
    void Update () {
        switch (currentBallState) {
        case ballState.aim:
            if (Input.GetMouseButtonDown (0)) {
                MouseClicked ();
            }
            if (Input.GetMouseButton (0)) {
                MouseDragged ();

            }
            if (Input.GetMouseButtonUp (0)) {
                ReleaseMouse ();
            }
             break;

        case ballState.fire:

            break;

        case ballState.wait:

            break;

        case ballState.endShot:

            break;
        default:
            break;

        }

    }

    public void MouseClicked(){
        mouseStartPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Debug.Log (mouseStartPosition);
        //didClick = true;
    }

    public void MouseDragged(){
    //  didDrag = true;
        //Move the Arrow
        arrow.SetActive(true);
        Vector2 tempMousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        float diffX = mouseStartPosition.x - tempMousePosition.x;
        float diffY = mouseStartPosition.y - tempMousePosition.y;
        if (diffY <= 0) {
            diffY = .01f;

        }
        float theta = Mathf.Rad2Deg * Mathf.Atan (diffX / diffY);
        arrow.transform.rotation = Quaternion.Euler (0f, 0f, -theta);
    }
    public void ReleaseMouse(){
        arrow.SetActive (false);
        mouseEndPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        ballVelocityX = (mouseStartPosition.x - mouseEndPosition.x);
        ballVelocityY = (mouseStartPosition.y - mouseEndPosition.y);
        Vector2 tempVelocity = new Vector2 (ballVelocityX, ballVelocityY).normalized;
        ball.velocity = constantSpeed * tempVelocity;
        if (ball.velocity == Vector2.zero) {
            return;
        }
        currentBallState = ballState.fire;

    }

}

sentences:
Does 64-bit translation and transformation slow down the engine significantly? So, how does one go with rendering world space calculated in 64-bit? How can that even work? GPUs can use Double Precision, but significantly slower than FP32.
How can one achieve world space coordinates using 64-bits and then render it on consumer GPUs?

e.g.: Star Citizen and No Man's Sky claim 64-bit world coordinates.

sentences:
Can you develop a game in XNA only on Windows for the Xbox 360? I'm going to start developing a game for the Xbox 360, its a small homebrew development and I don't have an Xbox 360 yet. Is it possible for me to develop the entire game targeting the XNA framework on Windows, and lastly "Create Copy of Project for Xbox 360" and have it work flawlessly?

What are the issues I would run into? Why do you recommend targeting and deploying to the Xbox 360 during development? and do I really need an Xbox 360 during development?

I'm also planning on using the superbly built Torque X game engine. Would this work well on my PC alone as well? And then transition over to the Xbox 360 without changing much code?

sentences:
How to not render what is behind object? I am working on a 3d project using openGL. I am looking for a way to optimize my renderings.
Is there a way to tell if an object is behind another object and thus not visible to not waste time rendering it ?
I am already working on a frustrum culling implementation to not display what is not visible because out of the viewing frustrum, but I didn't find a way to know if an object in located behind another object.
Can any of you help me about this, please ?

sentences:
How can I support the creation and rendering of both interior and exterior environments? Say I already have a renderer that can support outdoor terrain and environment rendering. How would I go about adding support for interior environments (for example, like World of Warcraft's dungeons) to my game?

I'm interested both in how I should fit the interiors into my content creation process (for example, I thought about leaving holes in the terrain mesh into which I can "paste" the interior dungeon mesh at runtime) and how to render them (it seems like I'd want a different rendering flow other than a blended texture rendering phase that terrain uses).

sentences:
Switching between VR and Desktop (VR Controllers are not tracked in Unity Build) I am developing a VR App in Unity3D for HTC Vive Pro (Wireless) everything works well with VR in the usual way. (SteamVR Plugin 2.5.0 (SDK 1.8.19))

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

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

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

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

sentences:
Using an SDL_Renderer within a texture wrapper class in SDL2 I have a CTexture class which needs a renderer to create and show textures. I don't know the scope I should put the renderer in. I´ve got it to work as a global variable, but I don't know if it´s a good way.

CTexture instances will be created within other classes, so it seems to be a mess to pass the renderer as an argument.

What do you think I should do?

sentences:
Hero made of parts 2d rotation I have a problem with rotation of my hero in 2D space.  The hero is made of body parts such as: head, arms etc.  Every part is a separate sprite. When I want to rotate the hero, I have to rotate all of its parts.
I know the hero position, and I save the parts positions as:
head = (heroPosition.x+20, heroPosition.y+20)

In other words I know the positions of all parts while the hero was not rotated.  After rotation I know only the hero position and the rotation angle(Grades).
How can I calculate the new position for each part?

sentences:
Outsourcing iPhone Game Development I'm looking for good sources to outsource virtually every aspect of an iPhone game:

Writing
Graphics
Programming

I have a good amount of programming experience so putting everything together should not be a problem.

What are some reputable sources for outsourcing this kind of development?
Is it feasible to approach game development from this angle?

sentences:
Default Controller Mapping? It seems like different controllers have their buttons mapped differently. I was wondering if there was some sort of standard. X is the first button, then A, then B, then Y. I looked and couldn't find any standards anywhere.

EDIT: I'm specifically talking about controllers used with computers. Usually with 2 joysticks, a hat, 4 letter buttons, 2 triggers, and 2 bumpers.

sentences:
Examples about how to tie AI actions to animations? I wrote a simple test AI for a character; and all that it should do is to be idle while a parameter is below threshold; otherwise it should perform actions based on other parameters.

So for example

if X< 0.5 --> Idle state
else
   if A > 0.3 --> go to point A and perform action A
   else if  0 < A < 0.3 --> go to point B and perform action B

I do have the code for the AI state machine in place; but now I am stuck about how to build the animator that goes with this AI.
I did use the standard AI 3rd person prefab in Unity; and it moves correctly, since the controller script has the logic for moving already integrated; but how do I make the entry for action A and B?

Do I add the animations in the blend tree of the animator, and then from the AI script I call the animator play function for a specific animation? Do I set parameters for such animations so when the variable X and A change; the blend tree read them directly and transition automagically?

All that I can find around is just the usual AI examples for FPS; which use the same patrol-chase-investigate sequence; but they are mostly moving or chasing; not necessarily executing different animations.

Any suggestion would be more than welcome

sentences:
How to store renderer vertex / index data in scene graph objects? I have a SceneNode class which contains a Mesh instance. The Mesh class stores client side information such as vertex and index arrays (before they're uploaded to the GPU). I also have an abstracted Renderer class, for GL and D3D, which render the SceneNodes. However, I'm not sure where I should store the API specific variables, e.g. GLuint via glGenBuffers for GL, and an ID3D11Buffer for D3D.

The few options I've considered are:

Create a derived Mesh class for each API, e.g. GLMesh / D3DMesh
Create a derived MeshData class for each API, which is stored in the main Mesh class
Store a map of Mesh to API variables in each renderer, e.g. perform a lookup of Mesh to GLuint / ID3D11Buffer for each object that is rendered (variables would have to be generated after the scene had been updated, but before rendering).
Separate the logic of rendering from scenes, by visiting the SceneGraph after update, and generating a RenderGraph of all renderable nodes in the scene.

What's the recommended way of doing this?

sentences:
Godot :How does the VisibilityEnabler work? Visibility Enabler

I'm confused about the use of the Visibility enabler node in godot. I've read the documentation and tried it out both stand-alone and as a child without success.

I set the parent to print a String during its _process function. Despite adding the enabler it continued to print despite being off screen.

How do I set it up so that It actually disables anything?

sentences:
Unity3D - Change player input axes on trigger Hope someone can help me with this, it seems like it should be a simple problem but that only makes it more frustrating!

I have a simple game where you roll a ball around by applying force to the horizontal and vertical axes. What I want to happen is, on a trigger, the axes switch from say the X and Y, to the X and Z, changing the way the player controls without changing the input buttons... The script I use to move the player is below:

{
  float moveHorizontal = Input.GetAxis ("Horizontal");
  float moveVertical = Input.GetAxis ("Vertical");

  Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
  rb.AddForce (movement * speed);
}

(Where rb is the player ball object) - I'm thinking I'm going to have to change the way the player is controlled as I can't any reference to a 3rd axis in the Input.GetAxis documentation... any help with this would be great!

Thanks!

sentences:
LIBGDX: Translate grid drawn with ShapeRenderer with an OrthographicCamera I am trying to draw a grid for my "world" that may or may not extend beyond the screen. What I would like to do right now is draw the entire world (which is relatively small) and then use the orthographic camera to translate the view to where the player is inside the "world." Currently I'm just trying to translate the "world" by 100 on the x and y axis to test. What am I doing wrong? Can I use the Shaperenderer with the OrthographicCamera?

public class WorldRenderer implements Disposable{

    private static WorldRenderer worldRenderer;
    private Color gridLineColor = Color.LIGHT_GRAY;
    private OrthographicCamera camera;

    private int worldX;
    private int worldY;

    public WorldRenderer(WorldController worldController) {

        init();

    }

    public void init() {

        worldRenderer = this;
        camera = new OrthographicCamera();

        worldX = 0;
        worldY = 0;

    }

    public void render() {

        //Set the background color to white.
        Gdx.gl.glClearColor(255, 255, 255, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        renderBackground();

    }

    public void renderBackground() {

        ShapeRenderer renderer = new ShapeRenderer();

        //Draw vertical lines.
        for(int i=0;i<=Constants.WORLD_WIDTH * Constants.GRID_WIDTH;i+=Constants.GRID_WIDTH) {

            renderer.begin(ShapeType.Line);
            renderer.setColor(gridLineColor);
            renderer.line(i, 0, i, Constants.WINDOW_HEIGHT);
            renderer.end();

        }

        //Draw horizontal lines.
        for(int i=0;i<=Constants.WORLD_HEIGHT *          Constants.GRID_HEIGHT;i+=Constants.GRID_HEIGHT) {

            renderer.begin(ShapeType.Line);
            renderer.setColor(gridLineColor);
            renderer.line(0, i, Constants.WINDOW_WIDTH, i);
            renderer.end();

        }

        camera.translate(100, 100);

    }

}

sentences:
OpenGL: How to map point inside frustrum to normal device coordinates (NDC)? I read this article http://www.songho.ca/opengl/gl_projectionmatrix.html.
It's explain how calculate projection matrix coefficients.
But I completely can't understand how author perform mapping from frustrum to NDC.

Why x_n perpendicular to x_p? I can't imagine it. Maybe someone can explain it? Or share useful source.

sentences:
How to get object or its index from mouse coordinates? Basically, I have a NumPy array of rectangles that store their colour and position.
I want to be able to compare my mouse position and clicked on the rectangle's position and get the index or the object itself from the array.
Do I have to iterate through every square in the array and compare item's coordinates?
The structure looks like:
Cube[Face][Horizontal-Line][Square] = np.array([colour, coordinates])
What's the most efficient way to do it? I'm thinking of using colliderect() method, but I don't know how to implement it.

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

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

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

EDIT: Here's an illustration: (pic)

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

sentences:
How to flush changes in PlayerSettings inside Editor I have a script which works only in the Editor. The script makes changes inside PlayerSettings. However, the changes made are flushed to the hard drive just after something in Unity is saved for example any scene.

We have a script which increments the build version. The described issue sometimes leads to the wrong version committed to Git as the changes a flushed to the disk later.

How can I flush the changes of PlayerSettings from the code?

sentences:
Making a new instantiated prefab as a child for existing GameObject I've been searched about how to make these fruit to move as the basket movement if it collided with it, and I've been found that if I want to perform this I've to let these fruit to be a child to the basket game object .. for example :

banana.transform.parent = basket.transform;

banana and basket each of them of type "GameObject" ...

BUT unfortunately this way didn't work !! and I don't know why ??

So now I need to know if it is possible to destroy the banana if a collision with the basket happened and instantiate a new banana in the basket as a child at run time ?!!

I need to try this stupid way because I've tried all the other ways and nothing worked :(

sentences:
When does it make sense to use Index Buffers? The concept of Index buffers is that certain vertices are shared across faces, hence can be reused to save space of duplicated verticies. A vertex is usually more than 12 bytes (depending on the number of attributes, ie. 3* 32-bit floats), while an index could be stored in as little as 1 to 4 bytes (depending on max number of vertices).

  Example: A cube consisting of 6 quad-faces without using an index buffer would
  require 6 * 4 * 12 = 288 bytes But as it only has 8 unique vertices,
  it could be stored using an index buffer with 4 * 6 indices = 8 * 12 + 4 * 6 = 120 bytes

However for non-shared vertices the space used by the Index Buffer is effectively wasted - because these vertices could've been drawn without an index buffer (if correct ordering in the vertex buffer is given). Considering only the vertex position as attribute, this trade-off would make sense for most meshes - but meshes in the real-world tend to have also other attributes like normals, texture-coordinates etc. Even if a vertex position is shared across faces, it is rare that all other attributes are also shared - hence the vertex needs to be duplicated in the vertex buffer.

  Example: A cube with normals has 8 unique vertices, but each of its 6 faces
  having a different normal vector. So 48 unique vertices are required,
  if one vertex is 24 bytes this results in = 8 * 6 * 24 = 1152 bytes
  Using an index buffer the same size is needed plus at least 48 bytes
  to store the indices = 1200 bytes

Not only would a vertex buffer without index buffer need less memory, it would probably be more cache-friendly as well (as the memory accessed is continous memory).

I try to find out in which scenarios I should use an index buffer instead of a plain vertex buffer, but I failed to find any real-world examples where it would make sense to use an index buffer at all.

My question is: Are there any cases in modern graphics-programming where using an index buffer will actually bring a benefit (ie. is there any advantage which I overlooked)?

sentences:
What is the best way to close dialogs in a platform game controlled by keyboard only I'm developing a flash puzzle platform game in my free time and I got stuck on deciding how to implement a feature. The game will be controlled by keyboard only, no mouse available.

My game will have Dialog boxes, used for story telling, announcing events, tutorial hints etc. I'd really prefer not to dedicate a large portion of the screen allowing the player to play while the dialog is displayed.

So my approach is to pop up the dialog and pause the game until the player closes the dialog. That's because the game has a small resolution (640 x 320) and some of the dialogs are pretty large (up to 5 lines text, talker's thumbnail etc).

EDIT : Another major reason I want to pause the game, is that I want to be 100% sure the player will not miss a dialog. Also, I want her to read it in a certain level area, before visiting another area of the level, or doing something that will advance the plot.

The thing Is that I can't find a way to make this work right. After testing the game with a few friends, I'm not satisfied from the feedback I get.

If I force them to close the dialog with one specific key (ACTION), I see people keep hitting keys randomly (e.g FIRE or JUMP key), while they know that it's closed with ACTION, like they did that 2 minutes before. They eventually get to close the dialog, but I can see they get a bit frustrated. I don't think they adopt the control as fast as I'd expect.

If I let them close the dialog with ANY key, they find themselves closing the dialog by mistake. Some of the dialogs are popping out while they're not expecting it.

So I'm starting to think that the 'Pause for dialog - close it to Resume' might be a bad idea in the first place. Do you think it is ? Or is it OK to have the dialog pause, but I just have to find the way to do it right ? Maybe the problem is not the controls, but something else, like say, I should not pop out the dialogs unexpectedly ?

Do you have any example of some game doing that right ?

sentences: Are GPU physics implementations branchless? I've implemented MPR on the CPU and in pixel shaders (long story!) and there seems to be unavoidable conditional loops both to find the starting portal as well as to find the final solution.  I know that there is middleware that runs physics on the GPU though. Have they found ways to make MPR or GJK more GPU friendly, such as going branchless? Is it proprietary or published knowledge? Thanks!

sentences:
SpriteBatch.Draw with scale or rotation trigger a new batch? I recently read that any transformation changes will cause a new batch to be triggered.

So, if I have 10 Sprites and each has a different rotation or scale will there be 10 batches sent up?

Or is this somehow limited to SpriteBatch.Begin, where a Matrix is used?

I'm not clear on how the Begin/End relate to scale/rotation in draw calls or if they do at all in terms of how many batches are created.

I appreciate any info on this topic...

sentences:
How can I fill the interior of a closed loop on a tile map? In my game the player can dynamically modify terrain.  The map is stored within a 2D array of prefabricated 3D objects.  This is working well for now.  The player modifies terrain by selecting what sort of tile they'd like to create (like cliff going up or down), and then clicking individual tiles, or "painting" over multiple by holding down mouse button and scrolling.

I don't want the player to have to manually click every tile they want to rise or fall in elevation.  The most elegant solution I can conceive, is for the player to "paint" a loop of cliff tiles, which is then filled in automatically when the loop closes.  Imagine, perhaps, someone drawing a line using MS Paint or Photoshop, until that line closes into a shape which then autofills.

Let's say the player wants a plateau, and so they select cliff going up, and then click and drag the desired shape.  Upon closing the loop, when the last cliff tile is created beside the first cliff tile, witchcraft is invoked which fills the inside.

I have no idea how this can be done, never mind elegantly or optimally.  There are obvious possible solutions (find the average vector of all tiles in the loop, and then dijkstra algorithm from the average until the space is filled with the correct elevation), but these assume the shape generated is blobby or boxy.  An irregular shape where the mid point falls outside of the shape is possible and would probably ruin that solution!

How can I fill the inside of a closed loop? I'd like a theoretical solution I can go away and implement in C#.  At this point it seems like there is probably conceptual overlap between raster graphics and procedural maps!

sentences:
How often to SendData() in my peer-ro-peer XNA game? Currently I call

myLocalNetworkGamer.SendData(myPacketWriter, ...)

every Update(). 60 times a second sounds too much. Is there an inbuilt way to only send less often? How often should network players update their position?

UPDATE It is a real time shooter. Also does XNA backlog the updates if the other peer is not receiving them fast enough or are packets dropped in this case?

sentences:
Replacing all objects in scene with another object I have around 100 objects (prefab A) in my scene, all in different positions.

Is it possible to replace all of these objects with another object (prefab B), so that the prefab B objects are placed in the same position as the prefab A objects were?

I want this done in the editor, not in game.

sentences:
Text width phaser.js Does phaser have any function that returns the width of the text or if not, how can I center text inside rectangle I've drawn?

Thanks!

sentences:
Arrive steering behavior I bought a book called Programming game AI by example and I am trying to implement the arrive steering behavior. The problem I am having is that my objects oscillate around the target position; after oscillating less and less for awhile they finally come to a stop at the target position. Does anyone have any idea why this oscillating behavior occur? Since the examples accompanying the book are written in C++ I had to rewrite the code into C#. Below is the relevant parts of the steering behavior:

private enum Deceleration
{
    Fast = 1,
    Normal = 2,
    Slow = 3
}

public MovingEntity Entity { get; private set; }

public Vector2 SteeringForce { get; private set; }

public Vector2 Target { get; set; }

public Vector2 Calculate()
{
    SteeringForce.Zero();

    SteeringForce = SumForces();

    SteeringForce.Truncate(Entity.MaxForce);

    return SteeringForce;
}

private Vector2 SumForces()
{
    Vector2 force = new Vector2();

    if (Activated(BehaviorTypes.Arrive))
    {
        force += Arrive(Target, Deceleration.Slow);

        if (!AccumulateForce(force))
            return SteeringForce;
    }

    return SteeringForce;
}

private Vector2 Arrive(Vector2 target, Deceleration deceleration)
{
    Vector2 toTarget = target - Entity.Position;

    double distance = toTarget.Length();

    if (distance > 0)
    {
        //because Deceleration is enumerated as an int, this value is required
        //to provide fine tweaking of the deceleration..
        double decelerationTweaker = 0.3;

        double speed = distance / ((double)deceleration * decelerationTweaker);

        speed = Math.Min(speed, Entity.MaxSpeed);

        Vector2 desiredVelocity = toTarget * speed / distance;

        return desiredVelocity - Entity.Velocity;
    }

    return new Vector2();
}

private bool AccumulateForce(Vector2 forceToAdd)
{
    double magnitudeRemaining = Entity.MaxForce - SteeringForce.Length();

    if (magnitudeRemaining <= 0)
        return false;

    double magnitudeToAdd = forceToAdd.Length();

    if (magnitudeToAdd > magnitudeRemaining)
        magnitudeToAdd = magnitudeRemaining;

    SteeringForce += Vector2.NormalizeRet(forceToAdd) * magnitudeToAdd;

    return true;
}

This is the update method of my objects:

public void Update(double deltaTime)
{
    Vector2 steeringForce = Steering.Calculate();

    Vector2 acceleration = steeringForce / Mass;

    Velocity = Velocity + acceleration * deltaTime;

    Velocity.Truncate(MaxSpeed);

    Position = Position + Velocity * deltaTime;
}

If you want to see the problem with your own eyes you can download a minimal example here.

Thanks in advance.

sentences: Moving IK target with Unity's New Input System I'm currently converting our 2D game from the old input system to the new input system in the hopes of making it available to more people in the future. Currently I am using the mouse position to aim a flashlight by moving the IK target of that arm to the mouse position by getting the vector of the mouse cursor and converting it using screentoworldpoint. My question is, how can I implement a similar function using the new input system with a joystick? Currently I am getting a vector2 from the joystick which ranges from (-1,-1) to (1,1) depending on the position and angle of the joystick. I would like to have the same code for both inputs so I don't have to use an if else statement and determine what input is being used but if that is unavoidable I understand. I would just like to know the best way to go about aiming an IK target using a joystick with the new input system.

sentences:
How do I force a game object to move along projectile trajectory, like in Angry Birds? I am a new Android game developer. I want to force my game object to move in a projectile trajectory, like in Angry Birds.Related example here
and my example You can see an example in the image.

I used jbox2d to write a little bit of code, but I don't know how to make it work. How do I force movement along a projectile trajectory?

My code is below:

    private static class ProjectileEquation {

        public float gravity;
        public Vector2 startVelocity = new Vector2();
        public Vector2 startPoint = new Vector2();

        public float yogx(float t) {
            return startPoint.x + t * startVelocity.x;
        }

        public float yogy(float t) {

            float u = (float) -4.97741939970554;
            float v = (float) 30.88079;
            float tt = 1/6f;
            float n = (u+v)/2*tt;

            return startPoint.y + n * t *startVelocity.y + 0.5f *(n*n+n)
                * t * t * gravity;
        }
    }

    private static class Controller {
        public float power = -66f;
        public float angle = 585f;
    }
}

 public float P2M(float xPixels) {
    return xPixels * metersPerPixel;
}

public float M2P(float xMetres) {
    return xMetres * pixelsPerMeter;
}

public float MaxHeight(){

     if (projectileEquation.startVelocity.y > 0){

            return projectileEquation.startPoint.y;
     }
        return projectileEquation.startPoint.y;
        }

public void Update() {
    projectileEquation.startVelocity.set(controller.power,controller.power);
    projectileEquation.startVelocity.rotate(controller.angle);
     //     bd = bodies;

}

    @Override
    protected void onDraw(Canvas c) {
        super.onDraw(c);

        MaxHeight();

        Update();

        float t = 0f;
        x = c.getWidth()/2;
        y = c.getHeight()-20;

        float timeSeparation = this.timeSeparation;

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

            float x = this.x +  projectileEquation.yogx(t);
            float y = this.y +  -projectileEquation.yogy(t);

            t += timeSeparation;

            if(A) {
                c.drawBitmap(bmp, x, y, null);
            }else if(B) {

                float bX = M2P(body.getPosition().x);
                float by = c.getHeight() - M2P(body.getPosition().y);
                body.setActive(true);

                c.drawCircle(bX, by, M2P(body.m_fixtureList.m_shape.m_radius), circlePaint);
            }
        }
    }

public class jbox2d {

    public float targetFps = 30.0f;
    public float timeStep = (1.0f / targetFps);
    private int interations = 2;
    public Body body;
    private World world;
    private BodyDef bodydef;

    public void Create(){

        Vec2 gravity = new Vec2(0,-10f);
        boolean doSleep = true;
        world = new World(gravity, doSleep);
    }

    public void addboll() {

        bodydef = new BodyDef();
        bodydef.type = BodyType.DYNAMIC;
        bodydef.allowSleep = true;

        bodydef.position.set(8.24f,10f);

        body = world.createBody(bodydef);
        body.setActive(false);
        float tt = 0f;

        Vec2 stx = new Vec2();
        Vec2 sty =new Vec2();

        for (int it = 0; it < 20; it++) {

            stx = M2P(projectileEquation.startVelocity.x);
            sty = M2P(projectileEquation.startVelocity.y);

            stx = M2P(projectileEquation.yogx(tt));
            sty = -M2P(projectileEquation.yogy(tt));

            body.setLinearVelocity(new Vec2(stx,sty));
            body.applyLinearImpulse(body.getLinearVelocity(), body.getWorldCenter());

            tt += timeSeparation;
        }

        CircleShape circle = new CircleShape();
        circle.m_radius = (float).42;

        FixtureDef fixturedef = new FixtureDef();
        fixturedef.density = 1.0f;
        fixturedef.restitution  = 0.9f;
        fixturedef.friction = 0.2f;
        fixturedef.shape = circle;
        body.createFixture(fixturedef);

    }

    public void update(){
        world.step(timeStep, interations, interations);
    }
}

sentences:
Translate camera position toward camera orientation I have a camera position (Vec3) and camera horizontal/vertical angle. Now I want to translate my camera position toward the current camera orientation - what is the best way to do that? I am sure it's simple but the logic escapes me.

(I am using GLM math lib btw)

sentences:
Statemachine to behaviour tree? Background
I was able to convert simple statemachines like this...

Into a BT looking like this (Notation describtion)...
root
  sequence  #After another
    playAnimation name:idle
    sequence
      walks? # Breaks current sequence if false
      playAnimation name:walk
    sequence
      runs?
      playAnimation name:run

Goal
But how do we convert more complex multi-layered animation states into a behaviour tree ? How would such a BT look like ? The difficult parts here are transistions between the different states, something i couldnt solve in an BT.

Question
Is it possible to convert every statemachine into a behaviour tree ?
What does the theory says and how does it look like in practice ?

sentences:
How to assign separate controller axes to Player1, Player2? I need to have two players moving in a level for a school project and my player controller is already set up for using axis inputs (as opposed to discreet buttons) for directional input. I already know I can assign custom key inputs from the inspector if I just declare a public variable (initialization optional because there is a drop-down list in the inspector):

public KeyCode jumpInput = KeyCode.Space;

How can I assign custom directional axis inputs from the inspector? I already have alternative horizontal and vertical axes defined in my preferences, I just need to know how to assign them.

Been putting this project together for 36 CONTIGUOUS hours and I am ready to put it (and myself) to bed. Thank you in advance for your time.

EDIT: My confusion was coming from (beyond being awake too long) thinking that I needed a special data type (like KeyCode) for an Axis, and couldn't find it in the reference. But I didn't consider making a public string and plugging that into the input. This way, I just need to know what I named the new axes and use that for the public string.

sentences:
Swapping limbs between meshes I'm trying to achieve what was done in the game impossible creatures. I will have a skeleton to which I will apply different meshes to i.e. torso mesh, leg mesh, etc. I would also like these meshes to be skinned together at the joints so that it looks like an animal and not like a robot.

Any ideas as to how I go about achieving this?

sentences:
Is it possible to mod a game to use a scripting language like Lua? So my questions are:

Is it possible to mod a game to use a scripting language?
How would I go about doing so?

I really like Arma 2 but like many games it does not have much in terms of capabilities beyond using server commands in scripts. That makes it pretty limited.

Personally I would like to add the ability to use a different language than Arma 2's scripting language; possibly Lua.

How could I make Arma 2 use Lua? Is there a way?

I remember from when I just a teenager and into modding Halo PC some people had created scripting mods for that game. How did they do that? I hope this question isn't too general or difficult to answer.

sentences:
MonoGame EffectPass.Apply() doesn't work Currently I'm doing the following:

spriteBatch.Begin(effect: effect);

// Draw stuff normally

effect.Parameters["flag"].SetValue(true);
effect.CurrentTechnique.Passes[0].Apply();

// Draw stuff with flag

effect.Parameters["flag"].SetValue(false);
effect.CurrentTechnique.Passes[0].Apply();

// Draw stuff normally

But this doesn't work. The flag stays false even after I apply the changes.

sentences:
How to deal with raw values and percentages? What is the standard practice for dealing with attribute modifiers in games where units have attributes, such as RTSs, MOBAs and RPGs? Specifically, in which order are "buffs" given to the unit?

Suppose the case where unit X has 10 blah-points (BP). It obtains two modifiers that add +10% blah-points, and another one that adds 30 blah-points. Finally, a enemy unit applies a -40% blah-points modifier. What is the usual way of processing this, for player familiarity's sake?

Aggregate by grouped type

  (10+30)*(1.0+0.1-0.4) = 28

Obtention order

  (10*(1.1)+30)*(0.6) = 24.6

Aggregate iteratively by type

  (10+30)*1.1*0.6 = 26.4

Some other way?

sentences:
GLSL - Signed Distance Field vs normal Loop I am fairly new in GLSL and only recently discover Signed Distance Field. I am trying to figure out how SDF can perform so well when you use mod() function to repeat but badly when you use for loop function.
I got a feeling that in for loop function, the ray marching is repeat as many times as the loop itself, but when using mod(), it only perform once. Can somebody explain in more detail how this works?

UPDATE1:

This is the mod() function:

float map( vec3 p )
{
    p.x=mod(p.x+3.0,6.0)-3.0;
    p.y=mod(p.y+3.0,6.0)-3.0;
    p.z=mod(p.z+3.0,6.0)-3.0;
    return box( p, vec3(1.,1.,1.) );
}

and Here is the for() loop function:

float map( vec3 p )
{
    p.yz = rotate(p.yz, mouse.y*10.);

    float b = box( p, vec3(1.,1.,1.) );
    float aa = b;

    for(int i=0; i<5; i++)
    {
    float off = float(i);
    vec3 q = p+off*.5;
    q.xz = rotate(q.xz, -mouse.x*off*12.);
    float c = box( q, vec3(off,1.,1.) );
    aa = fOpUnionRound(aa,c,.5);
    }
    return aa;
}

sentences:
Smart terrain generation to avoid unconnected tiles To make this clear from the get go;

I'm not looking for HOW To randomly generate a terrain (I know I can use Perlins noise for that).

I'm looking for an algorithm that can help with the terrain generation.

Example;

Me and my friend are working on a flash game to be use as advertisement for an upcoming game (And to see if theres actually interest for the base game).

And I've been working on randomly making terrains, however!
When i generate the map, i have no idea how to make it so it connects properly.

The map is isometric and tilebased and after its been generated we're going to litter chest/traps and other gameplay elements on the map. However, theres no reason to put an item on a piece of that map thats not connected to the rest of the map.. Or worse yet, spawn a player on a tile thats unconnected to anything.

Does anyone know of a algorithm that helps with stuff like this?

Thanks in advance people.

~Etarnalazure

EDIT

What I'm looking for is an algorithm that makes sure theres no unconnected tiles,
thus no items or players may by accident get seperated from the rest of the walk-able tiles.

Hopefully this clears up what i mean.

sentences:
using blender to generate a 3D skybox Is it possible for me to use Blender to generate a 3D skybox?

The concept is fairly simple: I create a scene that I want to display on the skybox (mountains, clouds, water, etc). Then, couldn't Blender render it from the origin, calculating the images that would be placed on the six sides of the skybox?

Is there a way of doing this? It'd be a very easy way of making one's own skyboxes...

sentences:
How can I create my own sky maps? What are the methods/tools for generating realistic skies with clouds and atmospheric shading?

FOSS alternatives and spherical projections get extra points.

sentences:
lerp vector2 to target vector2 at constant rate I am struggling to figure out how to lerp one vector2 to a target vector2 at a constant rate. I can do it as a percentage of the total x, y distance like so:

lerp(start, current, target, pctSpeed) {
  return current + pctSpeed * (target - start);
}

calling it as such:

speed = .02

// game loop
Update(timestamp) {
  x = lerp(startX, x, targetX, speed)
  y = lerp(startY, y, targetY, speed)
  resultingVector2 = {x: x, y: y}
}

which correctly lerps x and y by 2% of the distance between the start and target vector2 each frame. How do you do this at a constant rate, i.e instead of 2% a value of 2 or .2 or 3, etc. Thanks

sentences: Where can I find the sprite base grid? There's been many times where I've seen people use this tile grid. It's the one with the base pink background with deep purple bands around each section. Is this available online or will I have to make it myself?

sentences:
Get angle in radians given a point on a circle I'm working on a dial that rotates around a circle.

This dial should lets you mousemove anywhere in a circle to adjust the position of the dial to a point on the circle with the same angle as the click. For example, from the dial above if you clicked the spot shown in pink below I'd move the dial above that point but on the circle.

I know how to get the position of a point on a circle given a radius and an angle (in radians). That's this formula:

x = Cos(angle) * radius + CenterX;
y = Sin(angle) * radius + CenterY;

However, I am looking to do somewhat of the opposite -- I've got a click point, which I want to turn into a point on a circle (where the control knob goes). I'm trying to use this point (and a given radius) to figure out the angle in radians for it, so that I can place the control knob on the circle at the same angle.

Is there a handy formula I can use to accomplish this?

sentences:
XNA flip SpriteBatch on click Is there any way to make a SpriteBatch flip when its clicked, something like Android Animation?

I know that spriteBatch.Draw() have SpriteEffects, but it literally flip it and I want to flip it like an animation.

sentences:
Love2D how to zoom out map? I've set up a basic map with Tiled, imported it with STI library (https://github.com/karai17/Simple-Tiled-Implementation) and everything looks in place.

How can i get a zoom-out feature now? I can kinda zoom in using scalex and scaley and i tried the same procedure to zoom out.

However, if i set i.e. scalex = 0.5, scaley = 0.5 the map actually scales in size but it only fit 1/4 the screen size, and the remaining 3/4 are just black space.

sentences:
How to implement a shotgun in a game? Pistols and machine guns are easy - you can just have bullets flying in a certain direction, so I already implemented that. A shotgun, on the other hand, does damage to anything in a certain area that looks like a cone. How should I implement that? I have a couple suggestions here, but I could use some advice:

Split a bullet in multiple little bullets, that do less damage by themselves, but fly in a similar direction (a closer enemy is more likely to be hit)
Not use bullets - just have a particle effect of a shotgun shot and calculate how much damage enemies get based on position/orientation etc.
Have a big invisible bullet (a cube for example) that damages things, as well as a particle effect that will make it look like it's actually a shotgun shot.

Thanks in advance!

sentences:
How to handle pathfinding on a non-grid/non-node terrain map I'm not sure if this is even  path-finding. All I have is a 3D map that has hills, etc. I'd like the enemy to flock an object, but also walk around other objects. These blocking objects may be added after the path is calculated, which would cause a re-calculation of the path.

What algorithm am I looking at here?

sentences:
BRDF Incorrect specular highlights I'm currently attempting to implement BRDF lighting, and am hitting a bit of a snag with my specular term - the specular highlights aren't rendering correctly.

To make things simple, I'm using a single directional light rendering down the Z axis only, and manually specify the gloss/specularity of each of the following spheres.

Glossyness increases left to right, and Specularity increases bottom to top. Notice how the highlights seem shifted nearly 90 degrees upwards:

Calculating the specular BRDF

I use the generic Fresnel Shlick eq:

For the NDF, I use the GGX Trowbridge-Reitz eq:

And for the Geometric Shadowing function, I use the Smith / Shlick-Beckmann eq:

vec3 BRDF_Specular(vec3 F0, vec3 1minusF0, vec3 WorldPos, vec3 Normal)
{
    vec3 LightDirection         = vec3(0, 0, -1);
    vec3 ViewDirection          = normalize(EyePos - WorldPos);
    vec3 HalfVec                = normalize(LightDirection + ViewDirection);
    float NdotL                 = clamp(dot(Normal, LightDirection), 0.0, 1.0);
    float NdotV                 = clamp(dot(Normal, ViewDirection), 0.0, 1.0);
    float NdotH                 = clamp(dot(Normal, HalfVec), 0.0, 1.0);
    float VdotH                 = clamp(dot(ViewDirection, HalfVec), 0.0, 1.0);

    float Roughness             = max(1.0f - Gloss, 0.0); // Turn into roughness
    float Roughness_2           = (Roughness * Roughness);
    float NdotH_2               = NdotH * NdotH;

    /*  Normal Distribution Function
        GGX (Trowbridge-Reitz) */
    float D0                    = (NdotH_2 * (a_2 - 1.0f) + 1.0f);
    float D                     = a_2 / (M_PI * (D0 * D0));

    /*  Fresnel
        Shlick  */
    vec3 Fs                     = F0 + 1minusF0 * pow(1.0 - VdotH, 5.0);

    /*  Geometric Shadowing
        Smith / Shlick-Beckmann */
    float k                     = a_2 / sqrt(2.0 / M_PI);
    float GV                    = NdotV / (NdotV * (1.0 - k) + k);
    float GL                    = NdotL / (NdotL * (1.0 - k) + k);
    float G                     = GV * GL;

    vec3 brdfspec               = vec3(max(( Fs * D * G ) / (4.0f * NdotL * NdotV), 0.0));
    return brdfspec;
}

I've been following so many different resources and mimicked many other implementations, and even reducing it down to this basic level I'm still having this issue. I don't know why I'm not getting proper results

I'm using a deferred renderer, I derive the World position of each fragment from the depth buffer, and store my normals in viewspace.
I don't use a "Metalness" map, but instead use a single rgb specular map, hense why my Fresnel calculation uses Vec3's instead of floats.

sentences:
In Unreal, what are the differences between C++'s float and FFloat32? I have been trying to learn some deeper aspects of UE4 and while reading many examples codes and also the source base of the engine, I noticed that sometimes people (and the very source code) use the standard C++ float primitive, but sometimes use UE4's custom implementation FFloat32.

Then I got curious: when programming a game with Unreal, what are the differences between using those 2 options and possibly what are the main cases when one should drop the standard C++ primitive in favor of the engine's implementation?

sentences:
Bukkit shoot tnt & help with vectors I want to shoot a piece of tnt from the players face and then let it explode when it hits the target block.

        if (cmd.getName().equalsIgnoreCase("cannon")) {
        if(!perrmissionCheck(sender, "Needs.cannon", "cannon")){
            return true;
        }
        if (!(sender instanceof Player)){
            sender.sendMessage(nameC+"You must be a player to preform this command.");
            return true;
        }
        Block block = ((Player) sender).getTargetBlock(null, 50);
        Location location = ((Player) sender).getLocation();
        //float power = 4;
        //if (args.length == 1){
            //power = Float.parseFloat(args[0]);
        //}
        sender.sendMessage(name+"BOOM!");
        double x = block.getX();
        double y = block.getY();
        double z = block.getZ();
        TNTPrimed tnt = (TNTPrimed) ((Player)sender).getWorld().spawn(location, TNTPrimed.class);
        Vector v = new Vector(x, y, z);
        tnt.setVelocity(v);
        //block.getWorld().createExplosion(location, power);
        //block.getWorld().spawn(tntLoc, TNTPrimed.class);
        return true;
    }

This kinda just ramdomly throws the tnt and then exploads i want to get where the player is looking and then shoot it that way if someone could also describe how the args work for new Vector(arg0, arg1, arg2) i would appreciate it...

Thanks any help is great

EDIT
I relize this is really old but i wanted to share how I did it,

    int v = 2;

    if (args.length > 1){
        v = Integer.parseInt(args[0]);
    }

    final Vector direction = user.getEyeLocation().getDirection().multiply(v);

    TNTPrimed tnt = user.getWorld().spawn(user.getEyeLocation().add(direction.getX(), direction.getY(), direction.getZ()), TNTPrimed.class);

    tnt.setVelocity(direction);

    user.sendMessage(name + "Boom!");
    plugin.inGameMsg.msgAdmins(plugin.chatDark_AQUA + user.getName() + plugin.chatGray + " used cannon command!");
    return true;

this sends the tnt right where the player is looking

sentences:
Puzzle design in Adventure games Creating interesting, original, logical, thoughtful puzzles is an art.

What techniques and methods do you use to create good puzzles?

Do you write storyline before designing puzzles or combine these 2 processes?

sentences:
Do I still owe Epic royalties if I am not enrolled in the Unreal Engine subscription? I have just started using Unreal Engine 4 and I have had a very good experience, though I have left the subscription now.

I've made an Android game with it and I am planning to release it, but I have some doubts about the license. Suppose I post my game on my own website for, say, $%, will I still have to give 5% of my income to Epic? How will they come to know that the game is made in Unreal Engine?

I am very confused in taking this step and I'm not really understanding what they mean by "5% gross revenue."

sentences:
Understanding ticksPerSecond and duration with skeletal animations That's my first question here so i hope to do all correctly. From various weeks i started surfing the net about Skeletal animation aiming to add a simple animation controller into my small game engine. After following a video tutorial by ThinMatrix, i successfully added skeletal animation into my engine (i used Assimp to load a .dae file from Blender with one animation in it). Once finished all the base stuff i started thinking about how to change animations speed by a factor (like x2 x3 etc...) and here i found some problems. As i think i understand every animation is measured by a duration field (in ticks) that, as i suppose, should be at least something like 25fps (to obtain some kind of smooth animation) times animation's length in seconds. Then for every animation there is also another field called ticksPerSecond that (as the name says) is the amount of ticks in every second.

Into my engine i've a data structure called Animator that contains an array of Animation objects and for each one it has a ticks_per_second and duration array. The following code shows how i took data from assimp.

animator->ticks_per_second[animation_index] = scene->mAnimations[animation_index]->mTicksPerSecond != 0 ?
    scene->mAnimations[animation_index]->mTicksPerSecond : 25.f;
animator->duration[animation_index] = scene->mAnimations[animation_index]->mDuration;

If i print the two variables i get this result:

DEBUG: ticks per sec: 1.000000
DEBUG: total ticks: 0.833333

So here is my question: Why do these variables take on these values?
I am trying to explain it to myself and the idea I found is that if ticks is equal to 1 the animation would go at the same mainloop's frame rate but, at the end, I am not sure about it and I would appreciate your help.

sentences:
Unity 2017.3.of3 Raycast2D randomly misses objects 2d up down platformer.  Character has 2 Rays(one left one right) going down, when either Ray's hit distance hits between -1 and 1 it should call a function which will change character direction from down to up.  Works 1, 2, 3, 4, sometimes 6, sometimes into the teens times then character goes through the obstacle got placing character over an obstacle and hitting play with no changes gave a different amount of time before falling through the obstacle.  I have tried changing the Time.time in fixedUpdate, placed movement in last update, varying degrees of success, I will post the current version of code, but it has gone through several revisions any ideas accepted.  thanks

[RequireComponent (typeof (BoxCollider2D))]
public class YowiController : MonoBehaviour {

  BoxCollider2D yowiCollider;
  Vector2 rayDir, leftRay, rightRay, rayOrigin;

  public AudioSource jumpSound;

  bool jump;
  bool bounce;

  public float upTime;
  float looseTime;

  float bounceCount = 0;
  float gravity = 3f;
  float bounceHeight = 5f;
  float movementSpeed = 2f;
  float bounceTime = .03f;

  void Start () {
    yowiCollider = GetComponent<BoxCollider2D> ();
    rayDir = new Vector2 (0, -1);
    jump = false;
    bounce = false;
  }

  void Update () {
  }

  private void LateUpdate () {
    movement ();
  }

  void movement () {
    drawRays ();
    if (Input.GetKey (KeyCode.RightArrow)) {
      transform.Translate (Vector2.right * Time.deltaTime * movementSpeed);
    }
    if (Input.GetKey (KeyCode.LeftArrow)) {
      transform.Translate (Vector2.left * Time.deltaTime * movementSpeed);
    }
    if (!bounce) {
      transform.Translate (Vector2.down * Time.deltaTime * gravity);
      gravity += .02f;
    } else {
      Bounce ();
    }
  }

  void Bounce () {
    transform.Translate (Vector2.up * Time.deltaTime * bounceHeight);
    looseTime = bounceTime / 2;
    if (upTime < looseTime) {
      bounceHeight += .01f;
      looseTime--;
    } else {
      bounceHeight -= .01f;
    }
  }

  void drawRays () {
    Bounds bounds = yowiCollider.bounds;
    leftRay = new Vector2 (bounds.min.x, bounds.min.y);
    rightRay = new Vector2 (bounds.max.x, bounds.min.y);
    RaycastHit2D leftHit = Physics2D.Raycast (leftRay, rayDir * -1, .05f, 1 << 9);
    RaycastHit2D rightHit = Physics2D.Raycast (rightRay, rayDir * -1, .05f, 1 << 9);
    if (leftHit || rightHit) {
      RayHit (leftHit, rightHit);
    }
  }

  void RayHit (RaycastHit2D leftHit, RaycastHit2D rightHit) {
    if ((leftHit.distance < 1.1f) && (leftHit.distance > -1.1f)) {
      bounce = true;
      StartCoroutine (Bouncing ());
    } else if (rightHit.distance < 1.1f && rightHit.distance > -1.1f) {
      bounce = true;
      StartCoroutine (Bouncing ());
    } else {
      print ("No Joy");
    }
  }

  IEnumerator Bouncing () {
    yield return new WaitForSeconds (bounceTime);
    bounce = false;
  }
}

sentences:
Calculating price increases in a virtual economy I'm trying to design a method to have price increase depending on the number of items bought from shops in my game.

I'm fairly new to coding and I am struggling to figure out how to program the increase in price when buying multiple items.

Currently the price increase is a percentage increase based on the quantity of items in store, however if I buy 5 items, all 5 items will be charged the same. How can I get it so each item is charged at a different price?

I also need a reasonable inflation system, right now my code just determines a price increase based on the percentage of items remaining, but it's very simple and easy to exploit.
It looks like this:

30 - 2 = 28

1 - (28 / 30) = 0.07  0.93

1 + 0.07 = 1.07

10 * 1.07 = 10.7

Rounded up

Price = 11

I'd like to make this more complex also.

sentences:
UV mapping: Untextured faces? Im currently trying to texture a (transparent) cylinder. I want the texture image to wrap sideways around the cylinder but not the top and bottom faces, they are supposed to just stay untextured (so transparent, in this case).

So what I did (in Blender) is UV unwrap only the side faces and leaving the top and bottom faces as they are.

However, this method doesn't seem to work very well, because when I import the .obj in Unity the top and bottom faces are mapped to a "random" place in the texture and therefore have color.

My current workaround is to map the top/bottom faces to areas in my texture that are transparent, however, this only works when textures have a transparent place, which isn't always the case.

sentences:
3d world vertex translation to go to 2d screen coords My technical english is a little rusty so to avoid misunderstands please be patient with me :)
I will try to be brief and clear

Situation:
- I have a 2d sprite character on the screen
- I've just start learning how to draw 3d primitives and work with the cameras
- I'm working on a 2d isometric environment
- I made a 3d isometric triangle which I want to center in character
- I'm trying to do something similar to a flashlight

Problem:
- The triangle is not centered on character (probably because of the scales between 2d and 3d workspace)
-the triangle speed does not match the character speed.

Code:

player vision

        playerVision = new VertexPositionColor[3];

        playerVision[0].Position = new Vector3(-15f, -30f, 0f);
        playerVision[0].Color = Color.Transparent;
        playerVision[1].Position = new Vector3(0f, 0f, 0f);
        playerVision[1].Color = new Color(70, 102, 25, 20);
        playerVision[2].Position = new Vector3(15f, -30f, 0f);
        playerVision[2].Color = Color.Transparent;

-

private void SetUpCamera()
{
    // isometric angle is 35º , for 50y = -107z
    viewMatrix = Matrix.CreateLookAt(new Vector3(0, -107, 50), new Vector3(0, 0, 0), new Vector3(0, 1, 0));

    // TODO: use viewport for whole window or just the draw area ?
    projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GameInterface.vpWholeWindow.AspectRatio, 1.0f, 300.0f);
}

private void drawPlayerVision(GameTime gameTime, SpriteBatch spriteBatch, Vector2 playerDrawPos)
{
    // 50 is related with the camera position in the axis
    // TODO: this probably is incorrect since it should be a module of the distance? btw points
    Vector2 playerPos = playerDrawPos / 50;

    effect.CurrentTechnique = effect.Techniques["ColoredNoShading"];

    effect.Parameters["xView"].SetValue(viewMatrix);
    effect.Parameters["xProjection"].SetValue(projectionMatrix);

    // rotating like a radar
    Matrix worldMatrix = Matrix.CreateRotationZ(3 * visionAngle);

    // moving to the character
    worldMatrix *= Matrix.CreateTranslation(new Vector3(playerPos.X, playerPos.Y, 0));

    effect.Parameters["xWorld"].SetValue(worldMatrix);
    //effect.Parameters["xWorld"].SetValue(Matrix.Identity);

    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
         pass.Apply();
         Game.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, playerVision, 0, 1, VertexPositionColor.VertexDeclaration);
    }
}

if you need more details please ask me
I've been trying to figure out  all by myself so its a little hard for me :)

Thank you for your assistance

sentences: Android Cocos2DX using C++ in Eclipse Helios Windows XP I have used Eclipse Helios 3.6.1 for Java development. I wanted to start C++ development in the same IDE so I installed Autotools Support For CDT, C/C++ Development Tools, C/C++ Library API Documentation Hover Help plugins.I have included #include "cocos2d.h" in my HelloWorldScene.h file now when writing the below statement cocos2d::CCSprite * ccSprite; I am not getting auto completion bar(template proposals) on writing like coco and pressing Ctrl + Space from my keyboard. What can be the problem?This might help you solve my problem. Please check here. This is what I got after clicking Right Click Project -> Index -> Search for Unresolved Index. But I have added all includes check here. I think this is causing problem in Content Assist. What should I do in this case? Inclusion seems proper.

sentences: On Android, why would you handle expansion files yourself instead of using Google Play? Why aren't all Android games using Google Play's ability to serve their expansion files? Why some are handling it themselves inside their apps?

sentences:
Having trouble running OpenGL on MSVC I'm using the  OpenGL Programming Guide, 8th Edition with MSVC 2013 but I can't get the triangles.cpp file to run.

These are the errors popping up:
http://puu.sh/jAokn/c07420cf46.png

sentences:
Fullscreen triangle SV_POSITION and deferred shading So I'm trying deferred shading in DirectX11.

I am using the following method (used in the FXAA shader and described here: http://www.altdev.co/2011/08/08/interesting-vertex-shader-trick/) to render a fullscreen triangle for my deferred shading pass.

FullscreenTriangleVSOut main(uint VertexID: SV_VertexID)
{
    FullscreenTriangleVSOut output;

    output.mTexcoord = float2((VertexID << 1) & 2, VertexID & 2);
    output.mPosition = float4(output.mTexcoord * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);

    return output;
}

And then in the pixel shader, I want a proper texture coordinate to sample my diffuse, normal, position textures from the GBuffer.

In GLSL, I simply do:

ivec2 texcoord = ivec2(textureSize(unifDiffuseTexture) * (gl_FragCoord.xy / UnifAmbientPass.mScreenSize));

But for some reason, in HLSL my SV_POSITION is always (0.5, 0.5). I looked in visual studio 2013 and debugged the pixel shader at various pixels, and yes at all places the SV_POSITION is (0.5, 0.5). Why is this?

sentences:
Finding break in voxel grid (3D array) I am working at dynamic voxel engine in Unity (something like Space Engineers) where player can create object from voxels, push them, damage and split in to other object.

I store all data in 3D array, 1 mean voxel, 0 mean empty node.

So I looking for solution to break object (array). For example when I remove enough voxels object should split in to two.

00000000            00000    0000
01110110   ====>    01110    0110
01110110            01110    0110
00000000            00000    0000

In 2D example it should split like that.

I try to use BFS search but it not fast enough ;(. It works fine for small grids like 5x5x5, when I creat 5x5x50 grid it works few seconds before break arrays.

My algorithm:
1) First find empty node
2) When you find empty node start BFS from that node, collect all not empty nodes, when you cant find not empty node finish.

If break exist it will collect only one part of array so it find break, if there is no break it will return whole array.

The problem is speed of it ;/ How to make it faster?

sentences:
How to align 2 IMUs' quaternions? Suppose I have 2 IMUs that output 2 quaternions.

I place one IMU on my left hand and another one on my right hand.

I put both my hands flat on the table and point it forward to the same direction. What I expect is that they should give very similar quaternion. But it turns out that the IMUs reading differs about 10-20 degrees around the Y axis when plotted in Unity3D.

This means I cannot just apply the quaternion to the hand model inside Unity directly. I need to know the exact offset of this 10-20 degrees error in order to make the hand model point in the same direction.

How do I figure out this offset automatically? Or is there another way that I can align both IMUs? How do people deal with this IMU problem?

PS. Putting the IMU on the hand is just an example. I can put them both directly on the table near each other and they still give slightly different quaternions.

sentences:
Having trouble with grouping in 3D Studio Max I'm using 3D Studio Max 2012. I've got a simple mesh and several other polygons and I want to group everything all together. But the option is greyed out, I can't actually select 'Group' under the menus.

I've tried exploding and collapsing the mesh but nothing seems to work.

How can I group them together, what things can I do to try to diagnose the problem?

EDIT:
My object hierarchy looks weird:

scene root:
 . object 1
model:
 - object 2 ... 99

sentences:
creating model mesh and face explosions on Panda3d and Blender I'm quite new to Panda3d and Python (1 year) and I've been trying for longer than 4 months to find out how to create a simple mesh explosion in Panda3d.
I've created lots of different explosions using Blender and they all look good and work fine in Blender but when I export them through .x or .egg files the animation is always blank. I know Panda3d normally uses armature to do animations but with a mesh explosion on a space ship or box or any static object it does not have armature and maybe this is why it never really exports the visual effect...
I've been trying so long now just to explode anything on Panda3d but cannot work out how to go about this. It's really getting me down as the particle effects panel is great for things like smoke and fire, etc but I want to see the actual mesh and faces explode into pieces, so I can continue working and learning how to create and develop games.
I've looked into everything on the web and Blender and Pand3d but can't find anyone or anything that has had this problem or solution.
I've got demo code but I'm not sure how to upload the models I've created. Do I need to include them here as it's not the code that is the problem but the .egg files and Blender...
The models I've created have separate animation files and I've tried animation files within the .egg. I've got other animated models to work so I know it's not that, like I said I've tried everything and all the different export settings and combinations to get my ship to explode.

sentences:
Collision Detection doesnt work because some things move more than 1px at a time I'm writing a 2d scrolling game in javascript using canvas and since I'm limited to setInterval running at minimum once every ms, I need to have some objects moving at greater than 1 pixel a second. I have this for collision detection between objects:

// ** oversee collisions
collisionsInterval = setInterval(function() {

    // outter object
    for(i = 0; i < objectsToCollision.length; i++) {

        // inner object
        for(j = 0; j < objectsToCollision.length; j++) {

            // dont compare an object to itself
            if(i==j) continue;

            // check if they touch on x axis
            if(Math.abs(objectsToCollision[i].centerX - objectsToCollision[j].centerX) <= (objectsToCollision[i].halfWidth + objectsToCollision[j].halfWidth)) {

                // check if they touch on y axis
                if(Math.abs(objectsToCollision[i].centerY - objectsToCollision[j].centerY) <= (objectsToCollision[i].halfHeight + objectsToCollision[j].halfHeight)) {

                    // a collision was detected, do something useful
                    alert();

                }

            }

        }

    }
}, 1);

The problem is, since it wont alert() when two things are about to touch because my objects move at more than 1px at a time. The problem is, some objects might move 3px at a time, some might move at 8px at a time, and I also have gravity occurring so in the Y direction especially the velocity of my objects will really vary.

In my code above objectsToCollision is an array which contains all the objects I'm checking for collisions with. I've modelled what I've done so far after this https://gamedev.stackexchange.com/a/587 but it doesn't discuss how to solve the problem I'm experiencing!

sentences:
Raycasting on Z in 2D I'm making an isometric game in Unity. So far I have managed to render a diamond shaped board, with tiles that are aligned on the x and y axis (and the camera looks down the Z axis).

I am spawning game objects for each tile with their own polygon collider and sprite renderer. I hope this is the correct way. They appear in front of each other naturally as you would expect them to in an isometric view.

I want to make a raycast from the player and forward on the z axis, to hit the sprite right under him. As you can imagine, I run in to problems when I do that, I imagine it's because they are all on the same 0.0f on the Z axis.

So my question is, does the raycast care about when a sprite is rendered in front of another, when it calculates what to hit, or is it just the physics engine handling this? And if so, how can I get around this? I guess I can translate the player coordinates to the board, but I just want to know how this works anyway.

sentences:
Why is there high performance hit with many meshes? I am currently reading upon Geometry Instancing, as I want to render a lot of animatable objects on the screen.

However I have come to a more fundamental question first: Why do I even need to use it?

Consider this setup:

A plane as the base of the game world
On top of that a lot of tiles, which can be destructable with the use of a Physics Engine.
A camera which you can control with WASD + mouse for direction.

Now I do understand that there definately must be a performance hit at some point. I thought it would occur when sending all object data (vertices) to the GPU.

However the performance hit remains to be there, at every single frame it renders, what is actually happening in the background? Considering nothing at my scene is changing at all, it even happens when I do not move the camera at all.

I have no clue what exactly is going on and would definately want to read up more about it before starting to fix an issue that I do not understand, thus making the fix also harder to understand. I do know however that the fix (Geometry Instancing) works by sending the vertex data only once per multiple of objects based on that same vertex. So somehow it would have to do with the amount of vertices, yet I don't see what is going on?

Also: I am using the Ogre3D engine, so any specific answers/tips to that engine would also be welcome.

Regards.

sentences:
Why use Time.deltaTime in Lerping functions? To my understanding, a Lerp function interpolates between two values (a and b) using a third value (t) between 0 and 1. At t = 0, the value a is returned, at t = 1, the value b is returned. At 0.5 the value halfway between a and b is returned.

(The following picture is a smoothstep, usually a cubic interpolation)

I have been browsing the forums and on this answer I found the following line of code: transform.rotation = Quaternion.Slerp(transform.rotation, _lookRotation, Time.deltaTime);

I thought to myself, "what a fool, he has no idea" but since it had 40+ upvotes I gave it a try and sure enough, it worked!

float t = Time.deltaTime;
transform.rotation = Quaternion.Slerp(transform.rotation, toRotation, t);
Debug.Log(t);

I got random values between 0.01 and 0.02 for t. Shouldn't the function interpolate accordingly? Why do these values stack? What is it about lerp that I do not understand?

sentences: What considerations should I be aware of when placing an Unreal project under source control? I want to give it a try to creating a git repository from my UE4 project and uploading it to Github.com but I wonder what special considerations should I have to avoid posting sensitive information like my developer key/certificate, or avoid adding large binaries files, or temporary/intermediate files.

sentences:
Position of an object relative to another in a 2D plane I have two objects, A and B, each of them has a set of coordinates (x,y). How do I understand where is A in relation to B's position?

If I where to just check each coordinates I could do it like this:

B(x:5,y:5), A(x:4,y:5);
x = 5-4 = 1;
y = 5-5 = 0;
A it's on the left

B(x:5,y:5), A(x:6,y:5);
x = 5-6 = -1;
y = 5-5 = 0;
A it's on the right

B(x:5,y:5), A(x:5,y:6);
x = 5-5 = 0;
y = 5-6 = -1;
A it's on top of B

B(x:5,y:5), A(x:6,y:5);
x = 5-5 = 0;
y = 5-4 = 1;
A it's under B

But I was wondering, since I'm using a standard Vector2 data structure (from LibGDX), with the ability to normalize, compute distances, etc.. If I could do it using those methods instead of subtracting the coordinates each time.

If it can help, I need to know the position of A relative to B because A is supposed to push B, so if A it's on B's left, B needs to move right, etc...

sentences:
Follow behavior with randomization factor I'm trying to make enemy follow player as in picture below, the code below is code for following player with steering behavior ( i'm not sure it steering works tho but it does follow player ), how would i code something like in the picture below to make the following more randomized but still going in direction of where player is.

Vector2f velocity,steering,desiredVel;
velocity = new Vector2f(player.getX() - getX(), player.getY() - getY());
velocity.normalise();
velocity.scale( maxVelocity);

// unsure what to do with random numbers yet
Random rand = new Random();
int randy = (rand.nextInt(101) -50);
int randx = (rand.nextInt(101)-50);

desiredVel = new Vector2f(player.getX() - getX() +randx, player.getY() - getY() +randy);
desiredVel.normalise();
desiredVel.scale( maxVelocity);

steering = desiredVel.sub(velocity);

steering = truncate(steering,maxForce);

steering.scale(1 / mass);

velocity = truncate(velocity.add(steering) ,maxSpeed);
this.velocity = velocity;

position.add(velocity);

sentences:
How to change particle graphics emitted by FlxEmitter? I'm working with Flixel and attempting to emit "custom" FlxParticles from a FlxEmitter.  However, my main issue is that I typically get the default Flixel image emitted instead of my custom graphic.

If I modify the FlxParticle constructor in the Flixel source code like so:

public function FlxParticle()
{
    super();
    lifespan = 0;
    friction = 500;
    makeGraphic(4, 4, 0xFFFFFFFF);
}

I can get a custom particle (a 4 x 4 white square) to emit from my FlxEmitter.

However, if I write my own class that extends FlxParticle like so:

public class EffectParticle extends FlxParticle
{
    public function EffectParticle()
    {
        super();
        makeGraphic(4, 4, 0xFFFFFFFF);
    }
}

That class won't work - I will get the default Flixel image instead of my tiny white square.  I similar thing happens if I just call "makeGraphic()" on a FlxParticle variable.

Why does this happen, and other than modifying Flixel's source code or loading in custom graphic (from an embedded image), how can I create my custom particles?

sentences:
How do I make a fiery particle system? I added a particle system to the flame-emitting object in my Unity scene. But it's just little white balls, and I can't figure out how to make it fiery.

Anyone?

Everything I see on the internet involves buying some asset pack that somebody put together. Does Unity really not have any built in flames stuff?

sentences:
Rotate an object smoothly by 90 degrees on key press in unity3D [I saw few similar question on stackexchange but none is solving the purpose.]

I want to rotate a 3D object by 90 degrees on different axis on respective inputs. For example if 'a' is pressed, the object should rotate left by 90 degrees. transform.Rotate(0,90,0); is working but it is not rotating the object smoothly.

I am new to C# and js so cannot manually code but I tried the codes given in this answer at Rotate an object smoothly on the Y axis in Unity. The below code works but it it has two problems -
code:

void Update () {
SwingOpen();
}

void SwingOpen()
{
    Quaternion newRotation = Quaternion.AngleAxis(90, Vector3.up);
    transform.rotation= Quaternion.Slerp(transform.rotation, newRotation, .05f);
}

Problem 1: The above code rotates object without any keyboard inputs.
I added the condition if (Input.GetKeyDown (KeyCode.RightArrow)) but now the object rotates partially on every keyboard input. I want to rotate it by 90 degrees on a single key press.

Problem 2: It will never actually rotate the object by 90 deg. It will always be tending towards 90 deg. I want exact 90 deg rotation to allow multiple 90 deg rotations for 'n' number if inputs.

How can I solve this? Please help. Please let me know if the question isn't clear enough.

[EDIT]

I applied the below script but it is giving me some totally unexpected output

Code:

public float speed = 1;
private int xtimesHit = 0;
private int ytimesHit = 0;
private int ztimesHit = 0;

void Update () {
    if( Input.GetKeyDown( KeyCode.RightArrow ) ){
        ztimesHit--;
    }
    if( Input.GetKeyDown( KeyCode.LeftArrow ) ){
        ztimesHit++;
    }

    if( Input.GetKeyDown( "a" ) ){
        ytimesHit++;
    }
    if( Input.GetKeyDown( "d" ) ){
        ytimesHit--;
    }

    if( Input.GetKeyDown( "w" ) ){
        xtimesHit++;
    }
    if( Input.GetKeyDown( "s") ){
        xtimesHit--;
    }

    this.transform.rotation = Quaternion.Lerp(this.transform.rotation, Quaternion.Euler(xtimesHit*90,ytimesHit*90,ztimesHit*90), Time.deltaTime*speed);

}

On running this script
If I press rightarrow once followed by 's' the object rotates on 'z' axis and 'x' axis  correctly but there after if I press arrowkeys or 'a/s' in both the cases the object rotates on y axis. I dont understand why this is happening.

I want it to rotate w.r.t. the world axis always.

sentences:
Sprite draw-order in libgdx From other frameworks I know methods for easy ordering sprites within a spritebatch (to determine if a sprite has to be drawn in front or behind another sprite). For example in MonoGame/XNA this is called Sprite.depth or Pyglet has its OrderedGroups.

But I cannot find anything like that in libgdx. I've read that libgdx' scene2d has something like that but I don't want to use that as I use a entity system (ashley) and want to keep rendering separeted from the other logic.

What is the appropriate way to set the draw-order of libgdx sprites?

sentences:
What is the correct way to make an Installed Build? I am trying to use the Automation tool, following the documentation.

To create an Installed Build:
Run the Installed Build Script by invoking the AutomationTool with the
following command line, replacing [PLATFORM] with either Win64 or Mac.
BuildGraph -target="Make Installed Build [PLATFORM]"
-script=Engine/Build/InstalledEngineBuild.xml -clean

However, I am getting this error.

ERROR: Target 'Make Installed Build [Win64]' is not in graph

I am not sure what I should put as the platform.
I searched the config file, but don't see any specified platforms.

sentences:
Is a custom coordinate system possible in Unity Is it possible to create a custom coordinate system (i.e the one using double for coordinates or the one dividing the world into 'chunks' of safe size) not constrained by the floating point precision limitations in Unity, and make systems using the built-in coordinate system use that one instead somehow?

Thanks!

sentences:
How to find and modify specific entity or gameobject in Hybrid ECS? I am rotating 3 cubes in Unity with Hybrid ECS and the code goes like this :

public class RoatateECS : MonoBehaviour {
    public float moveSpeed = 10f;
}

class RotateSystem : ComponentSystem {

struct RoadComponets {
    public Transform transform;
    public RoatateECS rotateECS;
}
protected override void OnUpdate() {
    foreach(var e in GetEntities<RoadComponets>()) {
           e.transform.Rotate(0f, e.rotateECS.moveSpeed, 0f);
        }

    }
}

Inside OnUpdate all three cubes are rotating, I want to rotate the second cube in the opposite direction but how would I find a specific cube and modify it ?

sentences:
How can I fix problems caused by "ForceMode2D.Force"? I'm making a 2D platformer with Unity. I used transform.position for movement but it caused some problems like vibration, so I decided to use AddForce.ForceMode2D.Force instead. Since this uses mass for moving the player, it makes the player either so heavy and hard to control (even when the mass is 1) or so quick and fast.  I tried changing the mass and speed but I haven't found the setting that makes a smooth movement. Also, the jumping has a problem. The player will be suspended in the air for a few seconds after the jumping. I'm just looking for a way  to make AddForcesmoother and solve these problems.
Here's my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    [SerializeField] private float jumpSpeed;

    public float maxSpeed = 5f;
    public float maxAcceleration = 50f;
    public float maxDeceleration = 100f;

    [SerializeField] private LayerMask ground;
    private PlayerActionControls playerActionControls;
    private Rigidbody2D rb;
    private PolygonCollider2D pol;
    private Animator animator;
    private Vector2 movementInput;

    private void Awake()
    {
        playerActionControls = new PlayerActionControls();
        rb = GetComponent<Rigidbody2D>();
        pol = GetComponent<PolygonCollider2D>();
        animator = GetComponent<Animator>();
    }

    private void OnEnable()
    {

        playerActionControls.Enable();

    }

    private void OnDisable()
    {

        playerActionControls.Disable();
    }

    void Start()
    {
        playerActionControls.Land.Jump.performed += ctx => Jump(ctx.ReadValue<float>());

    }

    private void Jump(float val)
    {
        if (val == 1 && IsGrounded())
        {
            rb.AddForce(new Vector2(0, jumpSpeed), ForceMode2D.Impulse);

        }
    }
    private bool IsGrounded()
    {

        Vector2 topLeftPoint = transform.position;
        topLeftPoint.x -= pol.bounds.extents.x;
        topLeftPoint.y += pol.bounds.extents.y;

        Vector2 bottomRightPoint = transform.position;
        bottomRightPoint.x += pol.bounds.extents.x;
        bottomRightPoint.y -= pol.bounds.extents.y;

        return Physics2D.OverlapArea(topLeftPoint, bottomRightPoint, ground);
    }
    void FixedUpdate()
    {

     Vector2 movementInput = playerActionControls.Land.Move.ReadValue<Vector2>();

     movementInput = Vector2.ClampMagnitude(movementInput, 1f);
     Vector2 desiredVelocity = movementInput * maxSpeed;
     AccelerateTo(desiredVelocity);

    var scale = transform.localScale;
    if(scale.x * rb.velocity.x < 0) {
        scale.x *= -1;
        transform.localScale = scale;
    }

    void AccelerateTo(Vector2 DesiredVelocity) {

    var deltaV = desiredVelocity - rb.velocity;
    var acceleration = deltaV / Time.deltaTime;

    float limit = maxAcceleration;
    if (Vector3.Dot(rb.velocity, desiredVelocity) <= 0f)
        limit = maxDeceleration;
    acceleration = Vector2.ClampMagnitude(acceleration, limit);

    Vector2 force = rb.mass * acceleration;
    rb.AddForce(force);
   }
 }
}

sentences:
How can I add a button that opens a pop-up? I have developed a game with a libGDX game engine. I want to create a button on the game screen and add a popup to this button. How can I do this?
My current code:
public class GameScreen extends BaseScreen implements ShowDictionaryEvent
{
    private Preview preview;
    public GameController gameController;
    public Dial dial;
    private BoardView boardView;
    public DialAnimationContainer dialAnimationContainer;
    private LevelEndView levelEndView;

    private Rocket rocket;
    private BombDialog bombDialog;
    public AlertDialog bombBlastDialog;

    public ExtraWordsButton extraWordsButton;

    private ImageButton shuffleButton;
    private BoardOverlay boardOverlay;
    private Feedback feedback;

    private DictionaryDialog dictionaryDialog;
    private BonusWordsIncompleteDialog bonusWordsIncompleteDialog;
    private BonusWordsCompleteDialog bonusWordsCompleteDialog;
    public SideComboDisplay sideComboDisplay;

    private Smoke smoke;
    private Ufo ufo;
    public boolean offeredBoosterInThisLevel;
    public int nextBoosterType;
    private Label goldPackBubbleLabel;

    private RemoveAdsDialog removeAdsDialog;
    public Image comboLight;;
    public CameraShaker cameraShaker;

    private DelayAction comboLightDelay;
    private SequenceAction comboLightSequence;
    private RunnableAction comboLightRunnableAction;
    public int tempComboReward;

    public GameScreen(KelimeGame wordConnectGame) {
        super(wordConnectGame);
    }

    @Override
    public void show() {

        super.show();

        setTopPanel();
        topPanel.setY(stage.getHeight());

        topPanel.topComboDisplay.setGameScreen(this);

        dialAnimationContainer = new DialAnimationContainer(KelimeGame.resourceManager);
        dialAnimationContainer.setVisible(false);
        stage.addActor(dialAnimationContainer);

        cameraShaker = new CameraShaker();

        gameController = new GameController();
        gameController.setGameScreen(this);

    }
}

sentences:
Java how to color text without using JNI? I am working on a small text-based game in Java.  I am trying to understand the concept of how to color the output without needing to use JNI. C++ has the ability to modify the console directly and also make system calls but as far as I can tell JAVA doesn't because of its ability to be system independent.

Is this possible or should I look at using a JFrame and the paint object?

sentences:
Determine which button is at specific coordinates I am implementing a weapon wheel in Unity and I have most of it all worked out, but am struggling with one issue:
My weapon wheel looks a bit like this one (example only):

And mine is for something else, not weapons.. but that doesn't matter.
There is no mouse involved.. the idea is to spin the wheel left and right until you've selected the item you want.. the selected one would be the one in the top most position (the example above is the bottom most position, it seems).. Anyway, I have it moving left and right just fine.. the problem now is trying to figure out which button (yes, they are implemented as UI buttons) is currently in the selected position.
My initial thoughts are

To calculate the center X, Y pair of the "selected" location and store those..

When user hits action button to select, then iterate through the 8 buttons I have in that weapon wheel and..

Calculate the current X and Y of each button in the loop

If the button overlaps the "selected" location, then invoke that button's click()

This is proving to be a real pain in the neck though.. for example, I have found that the button transform's positon is always 0,0 until you show the UI at least once.. so I have to use Update() instead of Start().. In addition, trying to calculate the overlap means needing to add width of button to current X and height to current Y and getting pixel width does not seem to be an easy task.
Is there some simpler way to do this? How can I have a "selected" button on my weapon wheel without too much fuss like this? And if this really is the only way, then please let me know how I can get the pixel width and height of buttons.

sentences:
Originating direction of shots in an FPS problem Recently I have been asked on the interview about a maybe simple task to solve a problem.

We have a player, that looks in some direction, and a shooter, who already is shooting the player. I must find out whether the shots come from the left or right in the same way Counter Strike does when you get hit: the game shows from which direction and it looks like a red half-circle.

I know the vectors of players and enemies position. I tried different answers f.e. to build a line from the player see's and solve a linear system equation or rotate the player vector and then find out the angle of scalar product, but he says there's a better way to do it. I don't need the answer to this particular question, but a 'way' to find out the answer. F.e. any books related to this problems, some similar problems, etc.

sentences: Desura sales experiences Does anyone know of (or have) an experience selling an indie title through Desura? How does it compare with other typical indie game distribution avenues?

sentences: Game development equivalent of Movie Director Is there a job in game development that is equivalent to being a movie director?

sentences:
What is the term for the level progression paradigm in Bejeweled? Looking at the various level progression paradigms for my puzzle game, I decided to rule out the common ones such as 3-star per level, linear campaign-like story, etc. I like the idea of Bejeweled's classic mode where the player simply keeps on going.

What exactly is this paradigm called? I can't find any write-ups on it so I can't quite tell what its structure is like. Is it infinite? Does the difficultly increase with each level in some shape, way or form (more likely to get "No moves")?

sentences:
When would you use an octree in a voxel Engine? I've been reading about Octrees, and I understand how they work (or at least I think I do). However, I can't figure out why you would use octrees instead of a simple multidimensional array.

In my project, I use chunks in my world. Every chunk is made up of 16x16x16 voxels. If I need to access a voxel, I just use the notation myChunk[x][y][z]. If I need to check neighboring voxels, I can use the same notation. I've already implemented frustum culling, face merging, and hidden surface determination. With these optimizations and this simple multidimensional array, I can render about 500 chunks at 80 fps. So, in which situation would I use octrees in this kind of Voxel Engine? Or is it useless?

I can see the purpose of octrees if I would implement LOD into my voxel engine (which I'm not planning to do). Is my lack of experience in Game Development blinding me on something?

sentences:
Unity C# - Rotate smoothly an object towards the direction given by input I am trying to rotate an object towards the direction given by de direction of the input. For example, if I am pressing 'up' of the directional pad, the player should rotate pointing that direction.

I've tried using Euler angles, and when I press the direction, I call a coroutine that sums the eulerAngle.y of the object till it gets the angle of the direction, but it doesn't work. I don't know if there is another approach to use.

Here is the code for the coroutine. It starts if a certain key is pressed and if a flag is not activated:

 IEnumerator rotateTowards(float angle)
 {
    rotating = true;
    Debug.Log("Rotating the mono...");
    Debug.Log("Your angle: " +transform.eulerAngles.y);
    float turningTime = 0.8f;
    //float thisAngle = this.transform.eulerAngles.y;
    Vector3 thisAngle = this.transform.eulerAngles;

    if(thisAngle.y < angle)
    {
        while(thisAngle.y < angle)
        {
            thisAngle.y += turningTime * Time.deltaTime;
            this.transform.eulerAngles = thisAngle;
        }
    }

    if(thisAngle.y > angle)
    {
        while(thisAngle.y > angle)
        {
            thisAngle.y -= turningTime * Time.deltaTime;
            this.transform.eulerAngles = thisAngle;
        }
    }

    this.transform.eulerAngles = thisAngle;
    rotating = false;
    yield return null;
 }

Thanks in advance.

sentences:
Will the inclusion of LGBT characters in my game detract from possible sales? As we all know, the inclusion of LGBT characters has been a mighty controversial topic in recent film and literature (Beauty and the Beast probably being the premier example). Some love it with every fiber of their being, while others absolutely detest the very thought of it. Now, keep in mind that I am not here to start a political firestorm nor am I here to preach my own personal beliefs regarding this, I'm simply asking the question: will the inclusion of LGBT characters decrease potential sales?

In our game, a pseudo-'90s JRPG, one of our main story writers added two consuls (of a civilization with heavy Roman influence, but with different laws), both female, married. Originally hailing from an area in which LGBT relationships are looked down upon, I was quick to note that it may be too much controversy, but it truly depends on where you live—for him it was almost completely normal.

As I see it, we have three choices.

We can keep the characters just as they are.
We can keep the characters, but only imply their relationship.
We can alter the relationship entirely, changing one to a male.

Right now, our main goal is to satisfy the general public while still strongly appealing to those who actually played JRPG's such as Dragon Quest or Final Fantasy back in the day. Which of these three options should we choose to best enhance our sales, or, if it's not up there, what is the wisest way to go about doing this? I am looking for facts and data if possible and/or applicable.

EDIT: Our target audience is Everyone! Like we said, we’re aiming to satisfy the general public while still appealing to those who played JRPG’s back in the ‘90s.

EDIT II: Wow. Every almost answer here contained a wealth of information, and I'd like to formally thank all that contributed. I will be using the information from just about all of these answers, and I'm sure may others facing this issue may as well.

EDIT III: If you have comments that aren’t answers or you’d like to further discuss this, please refer to the official chat room as opposed to commenting. Thanks!

sentences: Anyone know the frames per second that IOS apps run? Anyone know the frame rate that iphones, ipads, and even android mobiles run?

sentences:
Handling lost graphics device XNA 4.0 in winforms I'm trying to put in a new feature into my level editor. Part of the feature is to bring up a form when a user places a new tile onto the map, but once the form is brought up the XNA embedded screen throws up a big red X.  I think this is due to the embedded screen losing focus to the form and then crashing.

This is where the form is initialized

 public Form1()
   {
    InitializeComponent();

    //Node Editor

    tileDisplay1.OnInitialize += new EventHandler(tileDisplay1_OnInitialize);
    tileDisplay1.OnDraw += new EventHandler(tileDisplay1_OnDraw);

    Microsoft.Xna.Framework.Input.Keys[] allKeys = (Microsoft.Xna.Framework.Input.Keys[])
     Enum.GetValues(typeof(Microsoft.Xna.Framework.Input.Keys));

    foreach (var key in allKeys)
    KeyboardInput.AddKey(key);

     KeyboardInput.KeyRelease += new KeyHandler(KeyboardInput_KeyRelease);
     MouseInput.MouseMove += new MouseMoveHandler(MouseInput_MouseMove);
     MouseInput.MouseDown += new MouseClickHandler(MouseInput_MouseDown);
     MouseInput.MouseUp += new MouseClickHandler(MouseInput_MouseUp);

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

     saveFileDialog1.Filter = "Map File|*.map";

     Mouse.WindowHandle = tileDisplay1.Handle;

   }

This is where the draw event is fired off

void tileDisplay1_OnDraw(object sender, EventArgs e)
        {
            Logic();
            Render();

            KeyboardInput.Update();
            MouseInput.Update();

            foreach (var actor in Actor.Actors)
                actor.Update();
        }

This is where the form is being called

     private void Logic()
    {
               if (colIndex == 8 && AssociateBox.SelectedIndex == 0)
                {
                    currentCollisionLayer.SetCellIndex(collideCellX, collideCellY,form.spawnNumber.ToString());

                    if(form.spawnNumber == "12")
                    {
                       camdetails.ShowDialog();
                    }
                }
    }

sentences: UNITY: How do I use SetTile() with a tile asset/ scriptable tile? How do I use Tilemap.SetTile() with a tile asset? I want to use it for scriptable tiles in the 2d-extras package, such as rule tiles, weighted random tiles, and animated tiles. How would I 1. get inspector reference of this scriptable tile, and then 2. use SetTile() with it? Thanks for your attention.

sentences: LWJGL Collision Detection I cannot find LWJGL collision detection with a camera and walls. Like making it to where you can not walk through walls and other different shaped rectangular prisms and cubes. How do I set up LWJGL collision?

sentences:
Why aren't linked lists more common data structures for enemies? I was recently listen to a talk that Jonathan Blow gave, you can find it here.  In the talk, he was talking about what data structures he (and he seemed to imply many others) use, and why.  Which is to say that he simply used arrays to store data, and use the naive approach to find data in it, meaning iterate through the array until you found what you wanted, assuming it wasn't in a performance critical place in the code.  He gave the example of loading data from a wad file in doom, which while fast, still took that naive approach (at least according to the talk, I haven't looked at the source code since I have not a clue to where I should begin).  The reason he gave for this was because while it may be slightly slower to do things the naive way, it's not much, and in many cases, not noticeable, so it's better to optomize how much work you can get done in your lifetime, than to make things a millisecond faster, again, assuming it's not in your physics engine or something like that.

All this seems well and good, except I have one question, why not linked lists rather than arrays?  Sure, if you had to make your own linked list class, I would be on board, but in c++ anyway, assuming your using STL, you only need to declare the type as a list, rather than as a vector, and use iterators to loop over it, rather than looping an index.

The advantages of using a linked list though seem much greater, for example, if you can be guaranteed that nothing is going to be removed from it while your iterating, you don't need to have locks around it, because adding data doesn't have the possibility of moving everything (or is that a bad assumption).  Also, in general, moving data is slow, although this could potentially be avoided if you know the size of your data by reserving the space.

Another advantage is when you do remove data, you just tell the list to remove it, and it just needs to change a few pointers, and call a destructor, which can be done pretty quickly.  But to remove something from an array/vector, you have to either shift everything back one, or possibly add a flag saying that it has been deleted.  (Or, another possibility if you don't care about the order of the data, is move the data at the end index, to the data in the now deleted position).  Either way, this seems like it is a lot of extra, unneeded work, or potentially too slow.

I did take a look around and found this, which claimed that a lot of older developers didn't want to use STL because it wasn't mature enough.  Also, older games AFAIK, used C rather than C++, which also doesn't have STL.  And I could see a case there for using arrays rather than linked lists, because you would have to make your own (which while simple enough to do, could potentially lead to many more errors).

I also read that it's a bad idea to create iterators in Java (due to the garbage collector), but that idea seems moot in languages such as C++, where there isn't a garbage collector, and I would imagine that linked list iterators are pretty lightweight (admittedly probably not as lightweight as vector iterators though).  Or is this also a bad assumption, and it's better/faster just to use an index in your loop, and increase that.

sentences: Unity Capture And Display Live Camera Feed I want to display the video using the device camera on specific part of the screen on iOS, android and Editor. I was able to find the WebCamTexture which display the camera video on the Quad (3D Object). Now I want to record the video and save it on the disk. Is there are way to do that ? Or is there a better way to do that using unity or through plugin ?

sentences:
Dealing with more complex entities in an ECS architecture Preamble: I'm working on a level editor for my engine, which uses an ECS architecture. I have around a dozen component types so far, mostly dealing with graphics, like lighting components, model, and other mesh related things like skeleton and collider components.

My engine only supports 1 of each component type per entity, and systems can deal with optional components as well.

Today I realized I was uncertain on how I should tie-together the building block components used for basic entities into a more complex one.

For example, let's say I want to make a torch / flaming stick, using the components found in a model entity and a lighting entity.
If the model's origin is in the center of the shaft, then the light and fire would appear at the center of the model.
Further, if I wanted a weird torch with fire on one end of the stick and smoke on the other, they would both need different offsets before rendering.

Do I need to create a system just for torch's, adjusting all the components to fit the model? This doesn't sound like it scales well to different models needing 'decorations'.

Should I instead be creating an attachment component, with its own offset variables? What dictates which components of an entity use the offset? Should I be making attachment types for every component type that could need an offset?
Or rather should most components just have a spatial offset as another parameter the user can control?

Anyone know any commonly used solutions?

sentences:
Should I use Coroutines to change variables in inspector smoothly? I want to change the aperture of the depth of field in the camera smoothly by using Mathf.SmoothDamp and a Coroutine, however, since I'm new to game development, I don't know if this is the right way to do it. Any suggestions?

Code:

using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityStandardAssets.ImageEffects;

public class GameStartController : MonoBehaviour {
    public Button startButton;
    public GameObject cubeSpawner;

    // Use this for initialization
    private void Start() {
        startButton = startButton.GetComponent<Button>();
    }

    public void StartGame() {
        EnableCubeSpawner();
        SpawnStartingCubes();
        HideStartMenu();
        StartCoroutine("FocusCamera");
        PlayBackgroundMusic();
    }

    // Enables the cube spawner, so it can start spawning cubes
    private void EnableCubeSpawner() {
        cubeSpawner.SetActive(true);
    }

    private void SpawnStartingCubes() {
        cubeSpawner.GetComponent<CubeSpawner>().GenerateStartingCubes();
    }

    private void PlayBackgroundMusic() {
        var audio = GameObject.FindWithTag("Audio").GetComponent<AudioController>();
        audio.PlayBackgroundMusic();
    }

    private void HideStartMenu() {
        startButton.transform.parent.GetComponent<CanvasGroup>().interactable = false;
        startButton.transform.parent.GetComponent<CanvasGroup>().alpha = 0f;
    }

    private IEnumerator FocusCamera() {
        var camera = GameObject.FindWithTag("MainCamera").GetComponent<Camera>();
        var velocity = 0f;

        while (Mathf.Abs(camera.GetComponent<DepthOfField>().aperture) > 0.001f) {
            Debug.Log(Mathf.Abs(camera.GetComponent<DepthOfField>().aperture));

            camera.GetComponent<DepthOfField>().aperture = Mathf.SmoothDamp(camera.GetComponent<DepthOfField>().aperture, 0f, ref velocity, 0.3f);
            yield return null;
        }

        camera.GetComponent<DepthOfField>().aperture = 0f;
    }
}

sentences: How to Simulate Height in a Tiled Top-Down Game How can I simulate height in a top-down tiled 2D game? One way I thought was to make tiles which are supposed to be higher brighter, but I was wondering if there was a standard or better implementation.

sentences:
Job prospects for game QA/testers I'm currently a (happily employed) automated software tester that's curious about game testing/QA. Do game companies hire dedicated testers for pay? If yes, then what are the job prospects like? If no, then how does becoming a game tester work (volunteers? mixed roles? crowdsourcing?). Obviously game companies have full-time devs, artists, designers, managers, etc. but what does QA look like?

NOTE: I'm curious about how QA works in a game dev setting, but I'm not really looking for job tips or "Do this if you want to get into game QA".

sentences:
Show 3d object on device live camera in Unity3d for iOS Possible Duplicate:
  How to add render able Texture in Unity 3d for iOS

How render a 3d or 2d(.jpg or .png )object at device live camera in Unity3d, and this 3d object shouldn't stuck with camera. It has to show at specific point, like we can set any object in game scene at particular location.

sentences:
Detecting Units on a Grid I am making a little turn based strategy game in pygame, that uses a grid system as the main map to hold all the characters and the map layout. (Similar to Fire Emblem, or Advance Wars)

I am trying to determine a way to quickly and efficiently (i.e. without too much of a slow down) check if there are any characters within a given range of the currently selected character.

So to illustrate:

O = currently selected character
X = squares within range

Range of 1:

    X
  X O X
    X

Range of 2:

     X
   X X X
 X X O X X
   X X X
     X

Range of 3:

      X
    X X X
  X X X X X
X X X O X X X
  X X X X X
    X X X
      X

Now I have to tell the user who is in range, and I have to let the user choose who to attack if there are multiple enemies in range.

If I have a 5x5 grid, filled with " " for empty and numbers for the characters:

[ ][ ][ ][ ][4]
[ ][1][ ][ ][ ]
[ ][ ][ ][ ][ ]
[ ][ ][2][3][ ]
[ ][ ][ ][ ][ ]

Depending on which character the user selects, I would like to show the user which other characters are in range. So if they all had a range of 3:

1 can hit 2
2 can hit 1 or 3
3 can hit 2
4 cannot hit anyone.

So, How do I quickly and/or efficiently run though my grid and tell the user where the enemies are?

PS- As a bonus, if someone could give an answer that could also work for a minimum distance type range, I would give them a pat on the back and a high five, should they ever travel to Canada and we ever meet in life.

For example:
Range of 3 to 5: (- is out of range)

          X
        X X X
      X X X X X
    X X X - X X X
  X X X - - - X X X
X X X - - O - - X X X
  X X X - - - X X X
    X X X - X X X
      X X X X X
        X X X
          X

sentences:
How can I instantiate objects with gaps between all objects? When instantiate each a new object I want it to be with the same gaps from also the other instantiated objects.

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

public class GenerateStairsUnits : MonoBehaviour
{
    [Header("Stairs Units Prefab")]
    public GameObject stairsUnitsPrefab;
    [Space(5)]
    [Header("Settings")]
    [Range(1, 20)]
    public int numberOfUnits = 1;
    public static GameObject Unit;
    public int gap = 10;

    private int oldNumberOfUnits = 0;
    private List<GameObject> units = new List<GameObject>();
    private GameObject unitsParent;

    // Use this for initialization
    void Start ()
    {
        oldNumberOfUnits = numberOfUnits;

        unitsParent = GameObject.Find("Stairs Units");
        for (int i = 0; i < numberOfUnits; i++)
        {
            Unit = Instantiate(stairsUnitsPrefab, unitsParent.transform);
            Unit.name = "Stairs " + i.ToString();
            Unit.transform.localPosition = new Vector3(gap, 0, gap);
            units.Add(Unit);
            Unit.AddComponent<MoveObjects>();
        }
    }

    private void Update()
    {
        if (numberOfUnits < oldNumberOfUnits)
        {
            Destroy(units[units.Count - 1]);
            units.RemoveAt(units.Count - 1);

            oldNumberOfUnits = numberOfUnits;
        }
        else
        {
            for (int i = oldNumberOfUnits; i < numberOfUnits; i++)
            {
                Unit = Instantiate(stairsUnitsPrefab, unitsParent.transform);
                Unit.name = "Stairs " + i.ToString();
                Unit.transform.localPosition = new Vector3(gap, 0, gap);
                units.Add(Unit);
                Unit.AddComponent<MoveObjects>();
            }

            oldNumberOfUnits = numberOfUnits;
        }
    }
}

I tried in both places to add a localPosition with gap/s:

Unit.transform.localPosition = new Vector3(gap, 0, gap);

But they are still all at same position.

sentences:
In HLSL, what is the difference between "static const" and "#define" for constants? So far I've been declaring all my constant variables as static const in my HLSL code, yet virtually every single shader example I've come across uses #define instead.

I know the reasons I would I use static const in C++ over the preprocessor and I just carried it into HLSL as well. However, I'm curious if there are any side effects or pros/cons to this, besides the standard C++ "static const versus #define" arguments.

sentences:
Picking targets for homing missles I'm developing 2.5D space shooter (3D objects, 2D gameplay). I'm searching for a way to pick targets for homing missiles.

There are two types of missiles: active-radar-guided and heatseekers. The first ones are relatively simple to implement: I search for a target once and then store it in the missile's navigation code. If object is destroyed or escapes missile's triangle of view, I seek for another target. Searching for target is costly, because I have to iterate through all game objects and eliminate ones behind the rocket or out of its "radar range". However, that happens rarely - only after launch and when missile loses the target from sight, so I guess it will be acceptable.

Now imagine heatseeker missile. Situation is different here - I have to make decision about flight direction on every frame - gather information about nearby heat sources, create some kind of heatmap, find hottest direction and navigate rocket towards it. This may degrade performance - especially if I have multiple missiles on scene and this is very likely scenario.

I thought of using collider as first-degree sieve to keep track of potential targets. This collider would have to be quite big but it would narrow down count of potential targets to 10-20 and I guess that should be acceptable for processing. However, I'm falling into problem of multiple colliders: I use one for regular collisions and I wouldn't want the other one to interfere. Also, I'm not sure what is the performance penalty for having a couple of big colliders on scene.

How can I solve the problem of picking target for missile every frame such that it won't have big impact on overall performance? Are the colliders correct path to follow? Or should I rely more on coding than on built-in features?

sentences:
How does this math behind converting angles to vectors work? I calculated the vectors of my yaw and pitch successfully. Even tho it works fine, I can't seem to understand how the math works exactly.

Could someone (graphically / demonstratively) explain me this with a picture so I can better derive the math?

Vector3d CSMath::AngleToDirection(Vector3d angle) {
// Convert angle to radians
angle.x = (angle.x) * 3.14159265 / 180;
angle.y = (angle.y) * 3.14159265 / 180;

float sinYaw = sin(angle.y);
float cosYaw = cos(angle.y);

float sinPitch = sin(angle.x);
float cosPitch = cos(angle.x);

Vector3d direction;
direction.x = cosPitch * cosYaw;
direction.y = cosPitch * sinYaw;
direction.z = -sinPitch;

return direction;
}

I'd be really grateful! Thanks guys.

sentences:
Extending control remapping script to work with mouse buttons I have created a default key map for my game, however I have also included an option in the settings where the player can change the key bindings.

My issue is if the player clicks on the button for shooting, which is defaults to mouse0, or aim on mouse1, then click on another key, they can never go back to mouse0 or mouse1.

I am unsure of how to include all the mouse buttons/scroll wheel into the viable buttons the player can choose from.

Here is the part of my code that deals with the changing of the keys:

private void OnGUI()
{
    if(curKey != null)
    {
        Event e = Event.current;
        if (e.isKey)
        {
            keyBinds[curKey.name] = e.keyCode;
            curKey.transform.GetChild(0).GetComponent<Text>().text = e.keyCode.ToString();
            curKey.GetComponent<Image>().color = normal;
            curKey = null;
        }
    }
}

sentences:
Stencil based mask with alpha I'm trying to create a fog effect like civ 5:

I tried creating a StencilSet shader that receives a mask and sets the stencil buffer to 1. I would render the following on every unexplored tile using this shader. White is full alpha, black is 0 alpha, gray is in between.

Then I created a StencilUse shader that would display the cloud as one big texture, but will test that stencil value is 1. This way the cloud will only be shown on top of the unexplored tiles (+ a bit of overlap outside the tile, per the mask sprite).

This is what I got:

The problem is that I can't produce the fading effects towards the end of the cloud. It's either fully visible or not visible at all. How would I be able to use the grey areas when determining the alpha value of the cloud?

Any ideas?
(I'm using Unity)

sentences:
Make health bar follow the player not the camera I wrote a script to create small bars of life & mana on top of the character.

So far it's following him and everything ok, but the problem is that it has a delay, for example the player arrives first and then the bars arrive shortly afterward.

How can I keep the bars it fixed to the player?

using UnityEngine;
using UnityEngine.UI;

public partial class UIMiniHealthMana : MonoBehaviour
{
     public GameObject panel;
     public Slider healthSlider;
     public Slider manaSlider;

     void Update()
     {

         Player player = Utils.ClientLocalPlayer();
         panel.SetActive(player != null); // hide while not in the game world
         if (!player) return;

         healthSlider.value = player.HealthPercent();

         manaSlider.value = player.ManaPercent();

     }

}

Example of the error:

sentences:
Input.GetKeyDown need to press button more than once to work So in Unity3D I'm checking for Input.GetKeyDown(KeyCode.E) for stuff like pickups and opening doors. Sometimes it doesn't work the first time I press it and I must press the key E like 2-4 times, and then it works. What could be the possible reason for this to occur?

As a further note, Input.GetKeyDown() is being called from OnTriggerStay()

sentences:
What kind of design or structure should I use to implement movement between an over-world map and a menu system? I'm making a simple text-based RPG, where the player is the owner of five creatures that battle other teams for loot, experience and glory. I am using Python, and a curses emulator. I have a static ASCII over-world map. My character, represented by a glyph, can move about this static map. There are locations all over the map that the character can visit, that break down into two categories:

Towns, which are a series of menus that will allow the player to buy equipment for his team, hire new recruits or do other things.
Arenas, where the player's team will have a "battle" interface with actions he can perform, messages about the fight, etc. Later, I may include an ASCII representation of the fight; but for now, just screens of information, with action prompts, will be displayed.

What kind of design or structure should I use to implement movement between an over-world map and a menu system?

Right now, the game goes through a master loop that waits for keyboard input, and then moves the player about the screen. Upon keyboard input, the player  coordinates are checked against a list of location objects, and if the player coordinates match a locations coordinates, then... I am not sure.

I'm not sure if I should call a separate function, to initiate either a menu or combat mode, or if I should create some kind of new GameMode object that contains a method for drawing the screen and printing the necessary info. If I go that way, I am not sure how to pass my players team data into this object.

My main concern is passing around the program flow into all of these objects. Should I be calling straight functions for different parts of my game, and objects to represent "things" within my game? I was reading about the MVC pattern, and how this kind of problem might benefit from decoupling the GUI from the game logic and user input, but I have no idea how this applies to my game.

sentences:
Modifying an array of quaternions I have written the following function to inter-change 2 specific elements of an array of quaternions:

private void ChangeRotations(Quaternion[] rotationsArray)
{
    Quaternion bone1Rot = rotationsArray [(int)Bone1ID];
    Quaternion bone2Rot = rotationsArray [(int)Bone2ID];

    Quaternion temp = bone1Rot;
    bone1Rot = bone2Rot;
    bone2Rot = temp;
}

But when I use Debug.Log to see if this has taken effect, I realize that the 2 array elements are unchanged.

What am I doing wrong here?

sentences:
Basic 3D Collision detection in XNA 4.0 I have a problem with detecting collision between 2 models using BoundingSpheres in XNA 4.0. The code I'm using i very simple:

private bool IsCollision(Model model1, Matrix world1, Model model2, Matrix world2)
{
for (int meshIndex1 = 0; meshIndex1 < model1.Meshes.Count; meshIndex1++)
{
    BoundingSphere sphere1 = model1.Meshes[meshIndex1].BoundingSphere;
    sphere1 = sphere1.Transform(world1);

    for (int meshIndex2 = 0; meshIndex2 < model2.Meshes.Count; meshIndex2++)
    {
        BoundingSphere sphere2 = model2.Meshes[meshIndex2].BoundingSphere;
        sphere2 = sphere2.Transform(world2);

        if (sphere1.Intersects(sphere2))
            return true;
    }
}
return false;

}

The problem I'm getting is that when I call this method from the Update method, the program behaves as if this method always returns true value (which of course is not correct). The code for calling is very simple (although this is only the test code):

 if (IsCollision(model1, worldModel1, model2, worldModel2))
                {
                    Window.Title = "Intersects";
                }

What is causing this?

The way Im drawing the scene is to load the number of elements and their coordinates from a file like this (it is called from Update method):

OpenFileDialog Otvaranje = new OpenFileDialog();
        if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.L))
            {
                this.GraphicsDevice.Clear(Color.CornflowerBlue);
                Otvaranje.ShowDialog();
                try
                {
                    using (StreamReader sr = new StreamReader(Otvaranje.FileName))
                    {
                        String linija;
                        while ((linija = sr.ReadLine()) != null)
                        {
                            red = linija.Split(',');
                            model = red[0];
                            x = red[1];
                            y = red[2];
                            z = red[3];
                            elementi.Add(Convert.ToInt32(model));
                            podatci.Add(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSinglez)));
                            sfere.Add(new BoundingSphere(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)), 1f));

                        }
                    }

And then in the Update() method I had the following code (this was my first attempt):

if(sfere.Count != 0){
for(int i = 1; i<sfere.Count; i++)
{
 if(sfere[0].Intersects(sfere[i])) Window.Title = "Intersects";
}
}

This code never returned that collision is true because the bounding boxes are moving when the box moves, and I don't know why. The code that moves the box is this:

if (Microsoft.Xna.Framework.Input.ButtonState.Pressed == Mouse.GetState().LeftButton)
                {
                    worldKutija = Matrix.CreateTranslation(new Vector3(0.01f, 0f, 0f)) * worldKutija;
                }

So if the model is set to be the box it is drawn into the worldKutija, and all other models are drawn into world matrix so they would not move with the box model. So why are their BoundingSpheres moving? After this started happening I tried the code I posted in the original question, and got the problems I was talking about

sentences:
Is it possible to get vertices after Primitive Assembly step (after face culling)? I would like to check which vertices will be rendered from direction A (with face culling enabled) and render it from another direction to visualize face culling effect.

I have found information that using Transform Feedback I can received data from vertex or geometry shader. My question is if is it possible to get data from primitive assembly step and use it to render scene from another direction or should I calculate by myself which faces should not be rendered?

Any help and information would be greatly appreciated

sentences:
How to get the attack animation cycle all the way through after one KeyEvent without twitching? (Java awt) So I figured by myself (supposedly) how to make the attack animation cycle all the way through after pressing a key without needing to keep it pressed. But now it doesn't always start at the same frame index and sometimes doesn´t even complete the animation (as you will see, sometimes it does). Heres a gif of what's going on.

These go in the constructor

    aR = new Animation(50, Assets.aRight);
    aL = new Animation(50, Assets.aLeft);
    aF = new Animation(50, Assets.aFront);
    aB = new Animation(50, Assets.aBack);

I use this timer to keep track of the cooldown and also set the flag (timerFlag) that indicates the start of the attack animation to true.

    attackTimer += System.currentTimeMillis() - lastAttackTimer;
    lastAttackTimer = System.currentTimeMillis();
    if(attackTimer < attackCooldown){
        timerFlag = false;
        return;
    }

    if(!handler.getKeyManager().attack)
        return;

    timerFlag = true;

(after a little bit of code attackTimer is set to 0)

To decide what the game will render I use an int (stillLock) that saves the last direction the player faced and I have a second static flag that indicates that the animation started. (I even reset the index every time it starts just to make sure *sadface)

else if(timerFlag&&!animCd){

        switch (stillLock){
        case 1:      //to attack
            animCd = true;
            timerFlag = false;
            aL.setIndex(0);
            return aL.getCurrentFrame();
        case 2:
            animCd = true;
            timerFlag = false;
            aR.setIndex(0);
            return aR.getCurrentFrame();
        case 3:
            animCd = true;
            timerFlag = false;
            aB.setIndex(0);
            return aB.getCurrentFrame();
        case 4:
            animCd = true;
            timerFlag = false;
            aF.setIndex(0);
            return aF.getCurrentFrame();
        }
    }
    else if(animCd){
        switch (stillLock){
        case 1:         //to finish attack animation
            aL.tick();
            return aL.getCurrentFrame();
        case 2:
            aR.tick();
            return aR.getCurrentFrame();
        case 3:
            aB.tick();
            return aB.getCurrentFrame();
        case 4:
            aF.tick();
            return aF.getCurrentFrame();
        }

And this is the Animation class where the magic happens

public class Animation {

private int speed, index;
private long lastTime, timer;
private BufferedImage[] frames;

public Animation(int speed, BufferedImage[] frames){
    this.speed = speed;
    this.frames = frames;
    index = 0;
    lastTime = System.currentTimeMillis();
    timer = 0;
}

public void tick(){
    timer += System.currentTimeMillis() - lastTime;
    lastTime = System.currentTimeMillis();

    if(timer > speed){
        index++;
        timer = 0;
        if(index >= frames.length){
                index = 0;
                Player.animCd = false;
        }
    }
}

public BufferedImage getCurrentFrame(){
    return frames[index];
}

public void setSpeed(int speed){
    this.speed = speed;
}

public void setIndex(int index){
    this.index = index;
}

}

And finally it renders like this.

public void render(Graphics g)
{
    g.drawImage(getCurrentAnimationFrame(), (int) (x - handler.getGameCamera().getxOffset()),
            (int) (y - handler.getGameCamera().getyOffset()), width, height, null);
}

I'm trully sorry for the code dump, I swear I worked hard narrowing it down only to the important stuff and being specific. Hope you can help me, I've been stuck with this for weeks... :)

sentences:
How do I keep 1v1 player positions consistent over UDP on Kryonet? I have a server which is simple:

When two connections comes in, it opens a game room, pass their connections to it and runs a thread with a gameloop. (Everything is running on Kryonet)

So... I made the movement, it works on TCP and UDP, but it has to be done via UDP, cause it will be a real-time game, there is no place for a lag. After switching updating positions to UDP, as we all know, some of the packets are lost. Sometimes the server is loosing some packets and it doesn't send them to the second client - that's why the opponent seems to move by 2x, not by x (it happens only sometimes).

My question is: How this kind of things should be implemented? How everything should be handled, I mean - sending states (walking, running), positions etc that there is no visible lagg? Should I send the packets more often? I heard once, that the server should also save player's positions and send it back to him and his opponent (to avoid cheating and laggs). I know how to implement these things, but I don't know how should it look like in a real-time fighting game.

If there is any experienced programmer, that could give me an advice, I would be grateful.

sentences:
How can I make 2D fog like in Graveyard Keeper? I really like Graveyard Keeper's fog effect but I can't work out how to make it.

It's 2D, and made in Unity. The characters all seem to be 'under' the fog, but the tops of tall trees and buildings poke out. It looks like this:

The developer has given a bit of information about how it's made on Gamasutra:

http://www.gamasutra.com/blogs/SvyatoslavCherkasov/20181023/329151/Graveyard_Keeper_How_the_graphics_effects_are_made.php

  "As you see, the tops of houses and trees are seen from the fog. In fact, this effect is really easy to make. The fog consists of a great deal of horizontal clouds spread across all the picture. As a result the upper part of all the sprites is covered with a fewer amount of fog sprites:"

I used the information from this article, and one of the developer's tweets that included this picture:

I attempted to recreate it this fog effect. When the character moves up or down the screen, it flickers as it crosses each fog sprite:

What have I missed?

All of the sprites are on the default sorting layer and have sorting order 0.

The project, in Graphics Settings -> Camera Settings has the custom axis and sort axis (0,1,0). The tree and character are on the same z position, and the fog is spread out over several z positions:

sentences:
How can one access the depth buffer for Unreal Tournament 2004? I'm looking for a way of getting depth buffer data for a virtual 3D sensor.

Currently the method used is raycasting (implemented in UnrealScript), but I want to use the depth buffer data instead for faster output of the sensor in FPS.

One complete frame of data takes many seconds to generate currently, which is bad for my application which must parse this 3D depth data and also control a vehicle with it.

I'd like to get the data from D3D but don't know if it's possible.

sentences:
Unusual black squares in transparency effect after wake from sleep I've encountered unusual black squares in semi transparent textures for a while now, usually in processes that were resumed after the computer woke from sleep. For example I've seen the effect in the Battle.net launcher by Blizzard frequently, on different machines.
But now I often encounter the effect in Unity in Play mode if I let the computer go to sleep. Restarting the scene fixes the display problem.

My 2 questions are:

What is that effect?
What do I need to do to prevent the effect from reaching my users?

In this screenshot there are 3 semi transparent particle effects on top of one semi transparent billboard, and at the bottom we see a part of an opaque sphere. The black squares seem to only affect a single one of the particle effects, and disappear if the effect is disabled, and reappear if it's re-enabled.

And here is the same effect in the Blizzard launcher:

sentences:
How should I store grid-based character inventories in the database? I used to encode the whole inventory data into binary but I'm thinking of doing something different now.

The inventory has a 64 slots in an 8×8 grid. Large items like weapons fill up 6 to 8 slots in a vertical rectangle, while potions take 1 slot.

How would you store this data in a database?

sentences:
Unity ScrollRect many objects perfomance issue I have scrollrect setup and over 1000 objects to scroll through. Currently i'm Instantiating all the 1000 objects at once and notice fps drop. I'm using 2d mask and disbale pixel perfect. Both gave a perfomance boost, but i still Think the bottleneck is that i have 1000 objects already created on the scene. Instead create what is visible to the eye.

What can i do? I've looked into pools. But i dont know how i should use it in my case. Since the inventory is dynamic.

public void ShowInventory(PlayerObject player)
{
    for (int i = 0; i < inventory.GetContainerSize; i++)
    {
        Item item = inventory.GetContainer[i];
        Button itemButton = Instantiate(buttonPrefab, content);
        itemButton.GetComponent<InventorySlot>().SetInventorySlot(player, item, item.amount);
    }
}

sentences:
Java Slick2d particles error When i run the game particles crash the game, im not sure what am i doing wrong because the program doesnt tell me. But i know particles are causing this , if i remove the code in update code at bottom, the runnable jar works fine.

Particle class : http://pastebin.com/ATLN6qzR

Particle manager : http://pastebin.com/vAk1nwmi

Slick 2d docmentation : http://www.slick2d.org/javadoc/

It says error is here where the for starts

public void update(int delta){

    for (Particle o: particleList) {
        if(o.emitter.completed() == true){
            particleList.remove(o);
        }
        else{
            o.system.update(delta);
        }

    }
}

sentences:
Create Render Target View [138][140] need to Bind the back buffer to the render target view DirectX 11 This is the error

D3D11 ERROR: ID3D11Device::CreateRenderTargetView: A RenderTargetView cannot be created of a Resource that did not specify the RENDER_TARGET BindFlag. [ STATE_CREATION ERROR #138: CREATERENDERTARGETVIEW_INVALIDRESOURCE]
D3D11 ERROR: ID3D11Device::CreateRenderTargetView: Returning E_INVALIDARG, meaning invalid parameters were passed. [ STATE_CREATION ERROR #140: CREATERENDERTARGETVIEW_INVALIDARG_RETURN]

So as i see here i need to set the BindFlag of the backBuffer to D3D11_BIND_RENDER_TARGET, but in all the tutorial i saw nobody is doing it, they all create the render target view by using this code

hr=m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&m_backBuffer));
if (FAILED(hr)) MessageBox(0, L"Failed get buffer", 0, 0);
hr=m_device->CreateRenderTargetView(m_backBuffer, NULL, &m_renderTargetView);
if (FAILED(hr)) MessageBox(0, L"Failed to create rendertargetview", 0, 0);

And nobody, nowhere is doing as the msdn site says, that the render target view must be created with this specific flag: D3D11_BIND_RENDER_TARGET

So I tried doing it by myself.

I created a texture2d desc like this for the back buffer:

D3D11_TEXTURE2D_DESC backBufferDescription;
    backBufferDescription.BindFlags = D3D11_BIND_RENDER_TARGET;
    backBufferDescription.ArraySize = 1;
    backBufferDescription.CPUAccessFlags = 0;
    backBufferDescription.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    backBufferDescription.Height = 600;
    backBufferDescription.Width = 800;
    backBufferDescription.MipLevels = 1;
    backBufferDescription.MiscFlags = 0;
    backBufferDescription.SampleDesc.Quality = 0;
    backBufferDescription.SampleDesc.Count = 1;
    backBufferDescription.Usage = D3D11_USAGE_DEFAULT;
    m_device->CreateTexture2D(&backBufferDescription, NULL, &m_backBuffer);
    if (FAILED(hr))
        MessageBox(0, L"Fallito back buffer desc", 0, 0);

And it doesn't work the same.

Help please

sentences:
Understanding Quake I Timer Here is a snippet of code from Quake I.
    LARGE_INTEGER   PerformanceFreq;
    unsigned int    lowpart, highpart;
    OSVERSIONINFO   vinfo;

    if (!QueryPerformanceFrequency (&PerformanceFreq))
        Sys_Error ("No hardware timer available");

    // get 32 out of the 64 time bits such that we have around 1 microsecond resolution
    lowpart = (unsigned int)PerformanceFreq.LowPart;
    highpart = (unsigned int)PerformanceFreq.HighPart;
    lowshift = 0;

    while (highpart || (lowpart > 2000000.0))
    {
        lowshift++;
        lowpart >>= 1;
        lowpart |= (highpart & 1) << 31;
        highpart >>= 1;
    }

The comment indicates that they are reducing the 64 bit PerformanceFreq to 32 bits and that the resolution is about 1 microsecond (the default resolution of QueryPerformanceFrequency is 1 second).
I understand what the code is doing generally, but I don't know what (lowpart > 2000000.0) is meant to be doing or why it's there. I think it's related to ensuring the resolution is about 1 microsecond.
When I run this code through the debugger the lowpart is shifted 3 times meaning that the resolution is actually 1s / 2^3 - 0.125s or 125 milliseconds and not 1 microsecond. The documentation for QueryPerformanceFrequency says that the result is hardware dependent so I don't see how a constant value 200000.0 could work unless you were making an assumption for the result based on modern hardware of the time.
Is this code wrong about the resolution or am I missing something?

sentences:
Is there a name for this kind of composited sprite animation technique? Character avatars composed of different sprites for each component (arms, legs, head) connected together through a series of joints seem to be trending lately. For example,  Scrolls, Candy Crush (in the cutscenes) and the iOS Agricola game.

This system allows the characters to have movements without having to author each frame on a sprite and can look much smoother.

For example, see how the characters seem to breathe in this video? I've checked the game files, they are indeed composed of static parts, linked together through some kind of skeleton.

What is this technique called?

sentences:
Why is Camera turning with different speed than Player with same code in different scripts? (with unity) I want to integrate a running character in my game, so I downloaded an animation via Mixamo. The player is running and if I attach the camera directly to the Player, it's shaking the camera and the game is not playable. Therefor I made a different script for the camera. In there, the camera is always following the player but turns (like the player) via
float h = PlayerMovement.horizontalSpeed * Input.GetAxis("Mouse X");
transform.Rotate(0, h * Time.deltaTime * 60, 0);

(for the camera) and
float h = horizontalSpeed * Input.GetAxis("Mouse X");
transform.Rotate(0, h * Time.deltaTime * 60, 0);

for the player. (horizontalSpeed is a constant) But after a few seconds I'm running in a completely different way then I look. Why is that and how can I solve this?
I tried different animations - nothing worked.
Update: If there is no rigidbody and no collider attached to it it works fine. But I need them.

sentences:
How to make it so when my player dies, the game will restart? when ever my player dies, he will be sent to the Menu State and when he plays again, he can start from the same place where he left off which results in an endless death. what I want is that when my game shows the Menu State, the game always resets.

How do I do that?

My Game Class

import java.awt.Graphics;
import java.awt.image.BufferStrategy;

public class Game implements Runnable {

private Display display;
private int width,
            height;
public String title;

private boolean running = false;
private Thread thread;

private BufferStrategy bs;
private Graphics g;

//States
public State gameState;
public MenuState menuState;
public SplashScreen splashscreen;

//Input
private KeyManager keyManager;
private MouseManager mouseManager;

//Camera
private GameCamera gameCamera;

//Handler
private Handler handler;

public Game(String title, int width, int height){
    this.width = width;
    this.height = height;
    this.title = title;
    keyManager = new KeyManager();
    mouseManager = new MouseManager();
    }
    //HERE IS MY INIT() METHOD

    private void init(){
    display = new Display(title, width, height);
    display.getFrame().addKeyListener(keyManager);
    display.getFrame().addMouseListener(mouseManager);
    display.getFrame().addMouseMotionListener(mouseManager);
    display.getCanvas().addMouseListener(mouseManager);
    display.getCanvas().addMouseMotionListener(mouseManager);
    Assets.init();

    handler = new Handler(this);
    gameCamera = new GameCamera(handler, 0, 0);

    gameState = new GameState(handler);
    menuState = new MenuState(handler);
    splashscreen = new SplashScreen(handler);
    State.setState(splashscreen);
}

private void tick(){
    keyManager.tick();

    if(State.getState() != null);
        State.getState().tick();
}

private void render(){
    bs = display.getCanvas().getBufferStrategy();
    if(bs == null){
        display.getCanvas().createBufferStrategy(3);
        return;
    }
    g = bs.getDrawGraphics();
    //Clear Screen
    g.clearRect(0, 0, width, height);
    //Draw Here!

    if(State.getState() != null);
        State.getState().render(g);

    //End Drawing!
    bs.show();
    g.dispose();
}

public void run(){

    init();

    int fps = 1000;
    double timePerTick = 1000000000 / fps;
    double delta = 0;
    long now;
    long lastTime = System.nanoTime();
    long timer = 0;
    int ticks = 0;

    while(running){
        now = System.nanoTime();
        delta += (now - lastTime) / timePerTick;
        timer += now - lastTime;
        lastTime = now;

        if(delta >= 1){
            tick();
            render();
            ticks++;
            delta--;
        }

        if(timer >= 1000000000){
            System.out.println("Ticks and Frames: " + ticks);
            ticks = 0;
            timer = 0;
        }

    }

    stop();

}

public KeyManager getKeyManager(){
    return keyManager;
}

public MouseManager getMouseManager(){
    return mouseManager;
}

public GameCamera getGameCamera(){
    return gameCamera;
}

public int getWidth(){
    return width;
}

public int getHeight(){
    return height;
}

public synchronized void start(){
    if(running)
        return;
    running = true;
    thread = new Thread(this);
    thread.start();
}

public synchronized void stop(){
    if(!running)
        return;
    running = false;
    try {
        thread.join();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
}

My GameState

import java.awt.Graphics;

public class GameState extends State {

private Player player;
private World world;

public GameState(Handler handler){
    super(handler);
    world = new World(handler, "res/worlds/world1.txt");
    handler.setWorld(world);
    player = new Player(handler, 200, 200);
}

@Override
public void tick() {
    world.tick();
    player.tick();

    if(handler.getMouseManager().isRightPressed())
        System.exit(0);
}

@Override
public void render(Graphics g) {
    world.render(g);
    player.render(g);
}
}

sentences:
Is it possible to use absolute input device like a pointer or VR headset for peeking(looking) in non VR FPS or 3rd person games? Assume I have a VR headset, which has absolute orientation as output and this orientation is input to a game.
In VR Games, your character looks wherever you look by using your headset's absolute orientation(right?) Everything is OK for VR games
Coming to the point for non VR games;
Normally, when you tilt a joystick to a direction and hold it at that position, your character always turns relative to the direction until you released your finger. For example if you tilt the joystick to rightest and hold it at there, your character starts rotationg around itself to the right until you release joystick.
Can I do the VR rotating thing with a standart game controller joystick? Do games (or game engines) allow this type of control? I mean when I tilt my stick to rightest position, my character peeks to rightest, but when I release the stick, character peeks to default(front).  If it is possible, could you give name of games that suppport this control type? What is the technical name for this control type and maybe some resources or keywords for my research?

sentences:
How to handle collision detection So the way that I am doing the movement for my game is that you can left click a unit (which is just a rectangle object), and then it is selected. While it is selected, you can right click and that will be the unit's destination.

This is the process input method:

    public void ProcessInput(Vector2 mouseLoc)
    {
        // SO, I have to take this mouse location, which is the location on the screen
        // And convert it to a "world" coordinate

        Vector2 distance = new Vector2(mouseLoc.X - position.X, mouseLoc.Y - position.Y);

        if (distance.Length() < speed)
        {
            position = mouseLoc;
            isMoving = false;
        }
        else
        {
            distance.Normalize();
            Vector2 toMove = new Vector2((int)(distance.X * speed), (int)(distance.Y * speed));
            position += toMove;
            bounds = new BoundingSphere(new Vector3(position, 0), radius);
        }
    }

I have a basic Wall class that is essentially just another rectangle object but with different properties like textures and what not.

This is my check collision method with the wall:

    public Boolean checkCollision(Wall wall)
    {
        if (wall.Bounds.Intersects(this.bounds))
        {
            Vector2 direction = new Vector2((position.X - destination.X) * -1,
            (position.Y - destination.Y) * -1);
            direction.Normalize();
            position += direction * 5;
            destination = position;
            return true;
        }
        return false;
    }

The problem is that the unit just kinda gets stuck in the wall when it hits it. I'm wondering what is the best way to fix this problem. I know that I have to move the unit out of that spot, but I'm not sure how to.

Any thoughts on how to handle this are appreciated.

sentences:
How does delta compression reduce the amount of data sent over the network? Many games use the technique of delta compression in order to lower the data load sent. I fail to understand how this technique actually lowers the data load?

For example, let's say I want to send a position. Without delta compression I send a vector3 with the exact position of the entity, for instance (30, 2, 19). With delta compression I send a vector3 with smaller numbers (0.2, 0.1, 0.04).

I don't understand how it lowers the data load if both of the messages are vector3 - 32 bit for each float - 32 * 3 = 96 bits!

I know you can convert each float to a byte and then convert it back from a byte  to float but it causes precision errors which are visible.

sentences:
Why do we get artifacts on objects rendered using depth node + depth render camera on Android? I've encountered and error I can't seem to find online. I get it on all the water shaders I test, and any thing else that I have a depth node + depth render script on the camera for.

I'll share a bit more information about what we're doing in the game.

This artifact changes as we pinch-zoom on Android. So I wonder if the Render Depth script doesn't like that we are changing the zoom/depth for some reason? Maybe it has something to do with how we are handling out cameras movement in Unity?
It is adding more depth information somehow, because the shader is reacting to the artifact. Depending on where the line cuts, the other details will warp to meet it.
This problem doesn't show on all phones. Mostly Android, newer versions, but wasn't showing up on an older S5.

Some other things I've tried within the shader are different shader models 2.5 & 3.0.

Any suggestions on tests I can do, or ideas on what might be the issue?

Here are the nodes I use for the opacity / depth

Currently we've got the controls on one camera, and the depth script on another.
Update, I've found someone talking about a similar sounding problem, but I'm not sure how to do this myself.

Thread here -- https://forum.unity.com/threads/depth-texture-not-working-on-some-devices.319568/

"If I set my RenderTexture Depth format to 16 bits instead of 24 bits it's working!" -- How do I do this? Can I edit my Camera script to do this?

The Camera script seems simple, but I'm not sure how to make it render 16bits instead of 24 bits to test this out.

// Toony Colors Pro+Mobile 2
// (c) 2014-2018 Jean Moreno

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

// Makes the Camera render a depth texture.
// This is needed for some water shaders that use depth-based effects such as edge intersection.

[ExecuteInEditMode, RequireComponent(typeof(Camera))]
public class TCP2_CameraDepth : MonoBehaviour
{
 public bool RenderDepth = true;

 void OnEnable()
 {
  SetCameraDepth();
 }

 void OnValidate()
 {
  SetCameraDepth();
 }

 void SetCameraDepth()
 {
  var cam = this.GetComponent<Camera>();
  if (RenderDepth)
   cam.depthTextureMode |= DepthTextureMode.Depth;
  else
   cam.depthTextureMode &= ~DepthTextureMode.Depth;
 }
}

Thanks!

sentences:
I try to make a Unity Curved Shader with shadow Effect? I try to make a curved shader with shadow effect I got a existing curved shader in github and it has no shadow effect i try to modify it but i couldn't find any appropriate solution.

The shaderor helping script link: https://gist.github.com/g0ody/5550039

Curved.shader:

Shader "Platogo/Curved" {
    Properties {
    _MainTex ("Base (RGB)", 2D) = "white" {}
    _QOffset ("Offset", Vector) = (0,0,0,0)
    _Dist ("Distance", Float) = 100.0
  }
    SubShader {
        Tags { "RenderType"="Opaque" }
        Pass
        {
            Lighting Off

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        sampler2D _MainTex;
        float4 _QOffset;
        float _Dist;
        uniform float4 _MainTex_ST;

        struct v2f {
    float4 pos : SV_POSITION;
    float2 uv : TEXCOORD0;
        };

        v2f vert (appdata_base v)
        {
    v2f o;
    float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
    float zOff = vPos.z/_Dist;
    vPos += _QOffset*zOff*zOff;
    o.pos = mul (UNITY_MATRIX_P, vPos);
    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
    return o;
        }

        half4 frag (v2f i) : COLOR
        {
          return tex2D(_MainTex, i.uv);
        }
        ENDCG
    }
}
FallBack "Mobil/Unlit"

}

CurvedAlpha.shader

Shader "Platogo/CurvedAlpha" {
  Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
        _QOffset ("Offset", Vector) = (0,0,0,0)
        _Dist ("Distance", Float) = 100.0
        _Alpha ("Alpha", Range(0.0,1.0)) = 1.0
    }
    SubShader {
        Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
        LOD 100

    ZWrite On
    Blend SrcAlpha OneMinusSrcAlpha

    Pass
    {
        Lighting Off

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        sampler2D _MainTex;
        float4 _QOffset;
        float _Dist;
        float _Alpha;
        uniform float4 _MainTex_ST;

        struct v2f {
            float4 pos : SV_POSITION;
            float2 uv : TEXCOORD0;
        };

        v2f vert (appdata_base v)
        {
            v2f o;
            float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
            float zOff = vPos.z/_Dist;
            vPos += _QOffset*zOff*zOff;
            o.pos = mul (UNITY_MATRIX_P, vPos);
            o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
            return o;
        }

        half4 frag (v2f i) : COLOR
        {
            return tex2D(_MainTex, i.uv) * float4(1,1,1,_Alpha);
        }
        ENDCG
    }
}

FallBack "Platogo/Unlit Texture Alpha"
}

sentences:
Stepping from Point out on Archimedes Spiral for Length along Arc I wasn’t sure whether to put this question in mathematics or programming?

My question has two parts with the second part dependent on the first.
I’m looking to use Archimedes spirals in some game code I’m writing.

I figured that there is possibly a unary Archimedes spiral from which all other achimedes spirals can be derived.  (Hopefully the use of ‘unary’ is correct here?)  That is a unary Archimedes spiral is one where the spiral spirals one radian outwards for every radian of angle starting at centre.

So my first question is:  Is that true?  Can every Archimedes spiral be derived from a ‘unary Archimedes spiral’  like I’ve described?

By derived I mean by the use of simple multiplication and division to transform from the unary Archimedes spiral to any Achimedes spiral with a different rate of out-spiral.

eg.  spiral20RadiansOutPerRadian = unaryspiral * 20

If that is the case then could someone possibly help me also with this second question?

I’m looking to step a measured arc length outwards (and inwards) from a point that is out on a measured Archimedes spiral.  So not from the zero or centre point but from somewhere out on the spiral.  The begin point out on the spiral is represented by a measured radius from zero (or centre).

I’m looking to find:  r' = f(r , arclen)

where r is the initial radius, arclen is the length stepping outwards along the arc (negative to step inwards) and the resultant r' is the new radius at that stepped to point.

My process for deriving from the unit spiral would hopefully then be:

Programmer sets a value for delta_radius which is per radian of angle.
Programmer sets a value for start_radius.
Programmer sets a value for step_length which is the length to step around arc.

The unary_step_length is worked out by dividing step_length by delta_radius.
The unary_start_radius is worked out by dividing start_radius by delta_radius.

We call achimedes() function with the two unary values and it returns unary_end_radius.

The actual end_radius is worked out by multiplying unary_end_radius by delta_radius.
The delta_angle is worked by subtracting unary_end_radius from the unary_start_radius.

My second question is:  Could somebody please help me to write this achimedes() function (if the answer to question 1 is yes)?

I’m looking to have function be of the form:

unary_end_radius = archimedes(unary_start_radius , unary_step_length)

where the unary_delta_radius is understood to be 1 radian.

sentences:
Designing client-server to mitigate hosting advantage? My game will be client-server, and I'd like to prevent the hosting player from enjoying the usual benefits you'd associate with playing on a server.  For example, the advantage of the server running ahead of time compared to clients.

Are there simple ways of mitigating host advantage?  Or do I have to make something complicated?  My naive solution would be having the host run a "ghost" state, and a client state, on the same map.

The ghost state is an authoritative server simulation, it doesn't render the simulation which remains invisible, but does run ahead of time making calculations and decisions as usual.  The host also plays a client on the same map, in which their input is regarded as any other client across the network, and like any other client is required to wait for the server simulation to make and transmit outputs.  And so the host doesn't enjoy an advantage because they aren't playing the simulation which is making executive decisions on the game state ahead of client time.

Has this solution been done by any other games, or is there a better way of handling the problem?

sentences:
'perfect' platformer base Xna When a player touches a ground peice in a game, he seems to sink through the ground then slowly rise back up, and when he has risen back up, he is very jittery.

 if (touchingTheGround())
 {
     player.velocity.Y -= 2;
     touchground = false;
 }

the collision method sets the variable touchground to true if the player touches a ground peice, and if i dont set it to false, the collision detection wont work at all. i set the players velocity to move 2 up because when he's not touching a platform, his velocity.Y += 1. How do i achieve a way so that the player

Does not sink in the ground before moving up
Stops jittering when its position is higher than the ground its touching

sentences:
How come the 3d graphics and animations of MMORPGs are usually worse than non-online 3d games? I have noticed that in general it seems like the 3d graphics and animations for MMOs and MMORPGs seem not as seductive and polished as the graphics for normal, non-online 3d games.

How come this is the case?

or
Is my judgement inaccurate?

If my judgement is inaccurate please provide examples of MMORPGs that render 3d graphics and animations that are superior to normal, non-online 3d games.

sentences: How does one optimize an HTML5 Canvas and JavaScript web application for Mobile Safari? I've created an HTML5 Canvas and JS game that runs great on a desktop or laptop in Chrome (30fps), but on mobile Safari I only get around 8 fps. Are there any simple tips or tricks to increase the framerate?

sentences:
When I start running, it won't stop when I let go of shift. Why? Following is my code, and after I let go of shift the image speed goes back to normal but not the variable I created called movespeed. What should I add or change to fix it?

//Run with left shift
if (keyboard_check(vk_lshift))
{
     movespeed = 5;
     image_speed = 0.14;
}

sentences: Is there a way to normalize for both ways in Unity? I have a building, built in blender, that has been imported to Unity. And I flipped every necessary piece and calculated the normals inside in blender. However, since I made the rooms inside the building with just a single cube, it's only visible from one side like they're not visible until I go the way around. Is there a way to solve this?

sentences:
How to have an AI controlled GameObject naively avoid another one? I have an idea of an AI controlled game which the gameobject will follow a path but it will change its path if I put another gameobject in front of it. For instance, if the moving game object is moving horizontally, and I put a static game object on its path, I want it to turn and continue its progression vertically just before it hits it.

How can I achieve this?

sentences:
With what projection matrix should I render a portal to a texture? I'm using OpenGL. I have problem with my engine's portal implementation. To create the first portal I do:

create a virtual camera with the position of the second portal and the correct orientation
render whole scene from virtual camera to the texture using FBO
render the first portal using the texture created before.

The problem: The virtual camera is rendering to the texture with the main projection view, so when I use this texture to render the first portal, everything is rescaled. The virtual camera should only render some part of the view to prevent scaling.

The problem could perhaps be solved by changing the virtual camera's projection matrix, but I don't know how to calculate such a matrix.

Here's how it looks:

This picture shows one portal (the texture is a little bit deformed on bottom and top, but that's not important now) and some other objects. The second portal is behind the camera, and the camera is in the middle between the two portals.

We can clearly see that the portal texture is rescaled down to the portal size. As I said before, I think the virtual camera should have another projection matrix, but how do I calculate it? Or is there a better way?

sentences:
Java game design question (graphical objects) I'm beginner in game development, in Java and here on this site too and I have a game design question. Please comment my idea:

I have a main loop which call update and draw method. I want to use an ArrayList which stores graphical objects, they have coordinate and image or text to draw and my game objects extends this class. In update, I can choose which objects should be put in the array and in draw method I'll display the elements of array on the screen. I'm using a buffer and draw first there.  Here is a simple (not full) code, only the logic:

public class GamePanel extends JPanel implements KeyListener
{
   ArrayList<graphicalObjects> graphArray = new ArrayList<graphicalObjects>();

   public void update()
   {
      //change the game scene, update the graphArray, process input etc.
   }

   public void draw()
   {
      //draws every element of graphArray to a JPanel
   }

   public static main(String[] args)
   {
      while(true)
      {
          update();
          draw();
      }
   }
}

My questions:

Should have I use interface or abstract class for graphicalObjects? graphicalObjects class and the ArrayList really needs or there is some better solution?
How to draw objects? They draw themself with their own method or in the draw method I have to draw manually based on graphicalObjects variables (x,y coordinates, image etc.)?
If this conception is wrong, please suggest another one!

sentences:
How to categorize textures into atlases I am going to use texture atlasing for the first time in my games, and at first it seemed like a great idea to split textures into atlases by categorizing them by terrain themes e.g ForestTextures, WinterTextures etc.

But that could cause a problem when for example a flower has to use transparency shader and other models use a diffuse shader. So those cannot be atlased into the same texture. Thus, would atlasing textures into themes as mentioned before and then splitting them by shader like ForestDiffuse and ForestTransparent be good? Or is there a better way to categorize and build them?

sentences:
Libgdx, tiled map - how to reload layer? In the simple platform game I'm making, when player collects coin, its cell is set to null. Is it possible to recover all cells from layer "coins" after player dies? I have tried multiple things but none of them worked :/

Here is part of code responsible for collecting coins:

for (Rectangle coins : coins) {
        TiledMapTileLayer layer_coins = (TiledMapTileLayer)map.getLayers().get("coins");
        if(dotRect.overlaps(coins)){
            layer_coins.setCell((int)coins.x, (int)coins.y, null);
            coinsN++;
            Sounds.playCoin();
        }
    }

But when player dies and re-spawns, there are no coins if he collected them before. I tried reloading the map - it works fine, but loading after every death is unacceptable - it takes a lot of time.

EDIT: Now I have another problem, with loading TiledMapTile to put into cell...

TiledMapTile coinTile;

public void show() {
    TextureRegion mapTexture1Region = new TextureRegion(mapTexture1, 32, 0, 16, 16);
    coinTile.setTextureRegion(mapTexture1Region);
}

It gives me NullPointerException, and I have no idea why :/

sentences:
Pygame Fullsreen Display Issue Code:

import pygame
pygame.init()
#
def Main(display,colors):
    clock =pygame.time.Clock()
    #
    surface = pygame.Surface(surface_resolution) # Create main surface
    surface.fill(colors["RED"])
    pygame.draw.rect(surface,colors["GREEN"],pygame.Rect((0,0),(110,110)))
    pygame.draw.rect(surface,colors["BLUE"],pygame.Rect((10,10),(100,100)))
    #
    while True:
        clock.tick(60)
        #
        for event in pygame.event.get(): # Main event loop
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE: # Exit game with Escape key
                    pygame.quit()
                    return
        #
        display.fill(colors["WHITE"]) # Fill the display white
        display.blit(surface,(display.get_size()[0]/2-surface.get_size()[0]/2,display.get_size()[1]/2-surface.get_size()[1]/2)) # Blit main surface on center of display
        #
        pygame.display.flip()
#
if __name__ in "__main__":
    global resolution
    global surface_resolution
    resolution =         (1920,1080) # Resolution of the display
    surface_resolution = (1536,864)  # Resolution actually seen
    #
    #
    display = pygame.display.set_mode(resolution,pygame.FULLSCREEN) # Create fullscreen display
    #
    colors = {                 # Defign colors
        "WHITE":(255,255,255),
        "RED"  :(255,0,0),
        "GREEN":(0,255,0),
        "BLUE" :(0,0,255),
        "BLACK":(0,0,0)
    }
    #
    Main(display,colors) # Run main loop

I have been experimenting with various resolutions in fullscreen Pygame. My new computers native resolution is 1920x1080 as apposed to my old computers resolution of 1366x768, so I started to test resolutions higher than 1366x768. However, when I run pygame with my native resolution, the highest resolution that fits my monitor is 1536x864 with the rest of the primary display off the screen.

This code creates a red surface with a 110x110 rectangle in the upper left corner and blits it to the center of the display. When I set the surfaces size to anything higher than 1536x864, parts of the 110x110 rectangle are cut off, and when I set the display and the surface size to 1366x768, Pygame stretches the display to fill my moniter.

The pygame display docs say that:

  When requesting fullscreen display modes, sometimes an exact match for the requested resolution cannot be made. In these situations pygame will select the closest compatible match. The returned surface will still always match the requested resolution.

However, when I run the following code to get all the available fullscreen resolutions, I see that 1920x1080 is an available resolution.

>>> for mode in pygame.display.list_modes():
        print(mode)
(1920, 1080)
(1680, 1050)
(1600, 900)
(1440, 900)
(1400, 1050)
(1366, 768)
(1360, 768)
(1280, 1024)
(1280, 960)
(1280, 800)
(1280, 768)
(1280, 720)
(1280, 600)
(1152, 864)
(1024, 768)
(800, 600)
(640, 480)
(640, 400)
(512, 384)
(400, 300)
(320, 240)
(320, 200)
>>>

My question is why does this happen, and how can I stop Pygame from stretching the display in this manner? I feel like I'm completely missing the point with this, but I couldn't find anything about this anywhere else.

sentences:
Unity - how to put a target under a character's feet that follows ground model contours? In my current projects, one of the power-ups needs to place a target marker centered on the position of the player triggering it - the actual design for this is TBC, but will be a circle with a radius of 10 units.

The ground for the playing arena is a model, and not flat. Assuming that I use a texture to show this target area, how can I have this texture render following the contours of the ground?

Alternatively, any other approach to solving this would be appreciated.

Thank!

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

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

  }

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

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

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

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

sentences:
DXGI - Frame rate drops from ~8000 FPS to ~1500 FPS when switching to full screen mode I've created a simple app with a DirectX11 device and swap chain (IDXGISwapChain). All it does is clear the screen with a color and call Present(0, 0) on the swap chain. The app handles full screen/windowed mode transition by itself (I passed DXGI_MWA_NO_WINDOW_CHANGES) to the IDXGIFactory object. After switching from windowed mode to full screen, the VS graphics profiler shows a drop in the frame rate, from ~8000 FPS (window mode) to ~1500 FPS (full screen mode). I think I'm resizing my buffers properly (in response to WM_SIZE), I'm not getting any warnings about presentation inefficiencies in the debug window. The mode used to create the swap chain is obtained by enumerating the supported modes of the output device and selecting the proper resolution info. Isn't full screen mode supposed to be more efficient (as I understand, it can simply do a flip instead of a bit blit).
The code is here in case you want to take a look.

sentences:
Directx displaying selectable text I am new to direct x and following this tutorial : brayzarsoft (part 14) I was able to display text. However, using this method the text is rendered to a texture.

When you look at games that have chat/consoles, you can select/copy/paste the text. How do they achieve this effect? Is it by using the winapi or do they code the whole system to be able to do this with texture?

sentences:
physics engine without time steps I'm looking for physics engines that doesn't use time steps. I don't think time steps are reliable, and I don't like how without tweaking the engine a bullet going too fast can pass through a wall without colliding it. Moreover I suspect they do a lot of unnecessary computations.

I thought of a physics engine concept where all the movements are represented by forces and movement beginning time. In such an environment as long as no event occur the engine would not do any computation.

I imagine the following:

I shoot a bullet in space, an object is created representing its physics properties.
The engine compare the bullet trajectory with other's to find if it's gonna collide with an other object.
It finds a collision, in 3 seconds.
An callback is programmed to trigger in 3s to process the collision.
In the meantime if no other event occur (like shooting an other bullet, changing an object trajectory, etc...) no other computation is done.

Does such an engine exists?
Is there a name to this technique?
Have you ever tried using this approach?

sentences:
How do you fully publish a game under your name, under 18? This has been a week of stress in trying to get things done correctly. It's all tied with keeping things legal and making sure I don't lose out on benefits of any kid. I have just recently finished up a game and now adding the final touches into it so I can make some sort of income.

I am incredibly sorry if I asked this on the wrong site. I felt that this is still relative to game development because it is the final step of developing your game: preparing yourself for distribution. If there is a better site to ask, or if some one has experience in this field please notify me.

Problems I am having:

I do not own a company, but just about every service I am trying to make use of is asking for a company name:

I do not know where I can find straight facts about owning, buying, or even keeping up with a name.
I am using my full name to publish my works because I read that in similar words, every one was born with a trade-mark known as their name.
I can not afford a company in the first place, I read some where that this can cost from 150 and higher. I have no income like said before and the only way I can think about making money as of this time is through my games which apparently requires me to already have at least a couple hundred dollars or more.

I don't know the most efficient and cheapest way to acquire a Tax ID

I don't know where I can read up on this subject, and apparently I am finding that I need an actual company name again - and I'm not entirely sure I can just use my name.
I'm not sure if there is an age limit on this, and as I currently stand I don't even have a documented signature.
This also costs a couple hundred dollars as I have read and I have no money.

I have no a clue what steps I should be taking for any of this.

I just want to publish games I make without feeling like I'm losing my hard worked time.
I want to be able to publish games without feeling I did something illegal.
I'd like to be able to have advertisers host on my game so I can make little revenue from people who can't afford buying full games.

Edit - In Detail:

I am currently trying to publish games to the google play store for android entertainment applications.
I am trying to use the advertisement service known as "mopub" : http://www.mopub.com/.
This is more like a linker than a direct advertiser that way you can get more benefits of multiple advertisers through your game.
I am living in the U.S

I don't want to quit making games because of issues like so. I can't publish my games right now if I don't have a legal representative name or a way to make money and not have others steal my rights of owner ship to the games I create.

sentences:
Pause in Seconds and resume in unity I want to pause  15 seconds then resume without any input when an object is collision other object
this is my code but not working.
Thank you

 void Start(){
    Eifftower = GameObject.FindGameObjectWithTag ("eiffeldespration");
    Eifftower.renderer.enabled = false;
    Time.timeScale = 1;
}

IEnumerator wait() {
    yield return new WaitForSeconds(15f);
    Eifftower.renderer.enabled = false;
    Time.timeScale = 1;
    Debug.Log("test");
}

void OnTriggerEnter2D(Collider2D collisionObject){
            //remove the game object
            if (collisionObject.tag == "Franch" ) {
            Eifftower.renderer.enabled = true;
            Time.timeScale = 1;
            StartCoroutine(test1());
            }
    }

sentences:
Manage vertical levels rendering I've been working on a semi-professionnal project for more than one year.
The game is in 3D with a TopView camera.
In this game, the player will be in very vertical spaces, with lots of ladder and stairs.

The actual problem is that I need to show only what is at the actual height of the player.

I have made a shader that 'cut' the objects above a given height.

The problem is that my mesh are open above this height, and we just see nothing inside.

If you have any idea on how to make something to fill an open mesh or any other system that will do the job, i'll be very pleased to read you :)

This is what I have

This is what I aim to (black above top of walls)

sentences:
Python/Kivy game for steam I'm developing a game in Python with Kivy as the gui. I've heard a few programs mentioned that compile python files to .exe's. However, I cant seem to find any that mention compiling .py and .kv files.

I wish to eventually publish my game to Steam Direct but i would like to know if my current approach to coding the game will hinder me doing so.

My actual question is, is there a way to compile a Python game with Kivy to an .exe file?

sentences:
Unity - Depth texture is too pixelated I am trying to combine two cameras together: Background camera, Foreground camera.

I created 3 cameras in my project, 2 for the background and foreground and one for the foreground depth.

I then created a simple shader that combine the first two cameras (they render to render texture as well as the foreground depth), the problem I am having is that because the depth buffer is too pixelated the result looks funny and you clearly see the lines around the foreground (players in my case).

I created a depth camera with these properties:

Notice the Output Texture, I have set the Render texture to:

This is the result depth texture (zoomed so you can see the pixels):

Any idea how I can create that effect maybe using something different then the depth buffer? or can I improve the depth quality? what can I do to reach a good final result?

sentences:
Canvas animation drops to 30fps every 3-4 seconds Ok! I solved the problem.

Chapter One - Multiple Canvases

I started to make pong utilizing requestAnimationFrame and I noticed that the ball was stuttering and slowing down every 3-4 seconds.  So I implemented a crude FPS function to write the current fps to the screen and realized that the slow down was accompanied by an fps drop to 30fps. I thought it had something to do with my collision detection function, but it was not the case.

MarkR noticed that I had two canvases drawing and updating the player/ball separately, he suggested that I combine the two canvases into one. This produced better performance and now I could only see the slow-down/stuttering every 15~ seconds.  The problem was, the stuttering was still happening.

Chapter Two - Vsync, Chrome Developer Tools

In comes Dreta!  Dreta said that the fps was dropping to 30fps because canvas is trying to Vsync.  I had no idea what he was talking about, so I asked Mr. Google and found a really good explanation of how Vsync/double-buffering/triple-buffering works. It's a medium read, but it it definitely worth checking out if you want to learn more about how your graphics card/monitor works.

He also told me that I can look at the fps of the game in Chrome by using the Developer Tool(which can be accessed by right-clicking -> inspect element -> Timeline tab and clicking on the black circle at the bottom-- the circle will turn red when recording).  You can also look at the memory usage and I noticed that it was periodically shooting up to 4mbs of memory used.  Dreta suggested it was a memory leak--

Chapter Three - Memory Leaks

To locate a memory leak, use the following process: Found at microsoft site (http://msdn.microsoft.com/en-us/library/ms859415.aspx)
Find the memory leak – Detect the presence of a memory leak in the system, given a particular reproducible sequence. You should be able to identify a specific process, but demonstrating an overall increase in committed system memory can qualify a memory leak as well.

Isolate the memory leak – Determine the exact location in the source code where the un–freed allocation occurs. This can be a lengthy and tedious process, requiring specific tools, trial–and–error, and teamwork with the original author of the code.

Fix the memory leak – After the first two steps are completed, this is easy. Fixing the memory leak usually involves adding some code to free the memory in the questionable code path.

Dreta suggested that I use heap profiling to find memory leaks. I personally have not read up on it yet, but here's a link to chrome's explanation of heap profiling developers.google.com/chrome-developer-tools/docs/heap-profiling.

He said:

  Each time you update the player, you're creating a function. You probably want to change the Player class from:

this.update = function() {
$("#c").mousemove(function(event) {
  tempY = event.pageY;
});
this.y = tempY;
}

which creates a function every 16ms I update the player

  to:

var that = this;

$("#c").mousemove(function(event) {
  that.y = event.pageY;
});

This helped optimize the game further.

Chapter Four - I'm stupid, yeah... Chrome Tabs + Memory

I remembered that there was an issue with chrome with multiple tabs open, and I decided to quit out of and restart chrome anew. Behold! Constant 60fps and 1-2.5 mb memory usage(where it was 2-4mb memory usage before).

Moral of the story... close down all tabs and restart chrome before determining the problem, and use heap profiling to locate memory leaks.

Thank you everyone for your help!
I really do appreciate it.

Here's the code on github. Please let me know if you find more stupid mistakes or you have general tips on working with canvas/programming.

Feel free to email me yangsunwoo@gmail.com

sentences:
Unity: how to mimic the lighting of a mesh as seen in the editor view I have a camera which shows a "bird's eye view" of a procedurally generated mesh like so:

Currently in the editor view (right), the terrain looks exactly as I would like it to. However, in game (left) I haven't been able to get it to appear as I would like:

I was using a directional light above, which was causing the effect where the centre of the mesh appears "shiny". So I looked around at some forum posts and questions on here and decided to try using ambient lighting instead by altering the settings in Window>Rendering>Light Settings, but this is the result:

This is the material I'm using (EDIT: I'm using a particle shader as the colouration of my mesh is based on altering Mesh.colors. ):

I have tried fiddling around with different material types but I couldn't get better results. My question is: how do I set up my game to use the same lighting that's being used in the editor?

Thanks in advance

EDIT: Camera settings at runtime as requested:

EDIT 2: Just to update; I have still not managed to fully solve this problem. I ended up using some different colours for my heightmap and tweaking the Metallic and Smoothness properties of the material, and the shininess and non-even lighting is somewhat diminished, but it does still exist.

If you watch at about 20 seconds into this video, when the mesh is dully coloured, the "circular" lighting effect is still present, which shadows being cast from the centre outwards, and the middle appearing almost blurred and the edges sharp.

Later in the video you can see a colourful version of the mesh, where these undesirable lighting effects are barely noticeable (note that I don't always want it to be be in bright colours, hence this is still an issue).

I feel like there should be a very simple solution to this. Why can I not get the lighting conditions that I see in the editor in the game view?

I am very happy to keep updating here with further progress/clarifications, and would love to hear any suggestions anyone has.

sentences:
ToonRamp Shader + Normal Maps: How to keep strict lighting bands? I'm trying to achieve a shading similar to the one on this image:

Image 1: https://imgur.com/a/eTTvSCD

To get something similar to this I wrote a toon ramp shader (similar to the one in the Standard Assets) with normal maps. The shader works, and without a normal map you can see the lighting bands strictly defined, with visible seams separating them (Image 2). But once you add a normal map, the toon bands won' t have well defined seams anymore, and will blend smoothly all across the mesh (Image 3).

Image 2 & 3: https://imgur.com/a/SI3BxED

This is my current shader:

Shader "Custom/ToonRampWithNormals"
{
    Properties
    {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _BumpMap("Bumpmap", 2D) = "bump" {}
        _Ramp("Toon Ramp", 2D) = "white" {}
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Ramp

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        sampler2D _Ramp;

        half4 LightingRamp(SurfaceOutput s, half3 lightDir, half atten)
        {
            half NdotL = dot(s.Normal, lightDir);
            half diff = NdotL * 0.5 + 0.5;
            half3 ramp = tex2D(_Ramp, float2(diff,diff)).rgb;
            half4 c;
            c.rgb = s.Albedo * _LightColor0.rgb * ramp * atten;
            c.a = s.Alpha;
            return c;
        }

        struct Input
        {
            float2 uv_MainTex;
            float2 uv_BumpMap;
        };

        sampler2D _MainTex;
        sampler2D _BumpMap;
        half _Glossiness;
        fixed4 _Color;

        UNITY_INSTANCING_BUFFER_START(Props)
            // put more per-instance properties here
        UNITY_INSTANCING_BUFFER_END(Props)

        void surf (Input IN, inout SurfaceOutput o)
        {
            // Albedo comes from a texture tinted by color
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;
            o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

So, what have I done wrong? How can I have well defined lighting bands and have normal mapping?

If you can think of a better way to achieve something similar to the reference or have any thoughts about it please share, any contribution is much appreciated.

sentences: How do I prevent modders from creating malicious code? Let's say I have both a game and a modding system for it. The modding system loads DLL files containing custom features and allows mod creators to override certain functions to change game mechanics. This is all well and good until some mod creator decides to put a keylogger or a virus in one of those DLL files. What can be done to prevent this problem? Is there any way to allow a high level of customisability in a modding system while still maintaining a strong level of security for the end user?

sentences:
How can I mod a Minecraft slime to be about the size of a full block? I want to make the slime's size roughly the size of a full block,
I have tried some values but I'm not sure if any of those I tried fit the idea I have.
What would you recommend for the size of the slime which roughly matches or matches a block's size?

sentences:
Render 3d object to 2d surface (embedded system) i am working on an embedded system of a sort, and in some free time i would like to test its drawing capabilities.

System in question is ARM Cortex M3 microcontroller attached to EasyMX Stellaris board. And i have a small 320x240 TFT screen :)

Now, i have some free time each day and i want to create rotating cube.
Micro C PRO for ARM doesnt have 3d drawing capabilities, which means it must be done in software.

From the book Introduction to 3D Game Programming with DirectX 10 i know matrix algebra for transformations but that is cool when you have DirectX to set camera right.

I gues i could make 2d object to rotate, but how would i go with 3d one?

Any ideas and examples are welcome. Although i would prefer advices. I'd like to understand this.

sentences:
Where do the buffer values come from when rendering? In the textbook I am reading, it talks about fragment tests that are performed when rendering.

All of these tests involve comparing the current fragment x value (x can be alpha, color, etc.) with a corresponding buffer value, and doing something in case the test passes. The test is usually a comparison between those two values (for example, >=, <=, etc.).

What I cannot understand is where do these buffer values come from in the first place?

Are these previous values? If so, what do the current values have to do with previously calculated values?

I don't even know what to search in google for this topic. Sorry if it is a total starter question. I am currently reading about rendering for the first time

sentences:
How to correctly draw a 2D polygon in Unity I'm trying to draw a 2D polygon using GL.Line; however I'm not getting a polygon but separated lines instead. In the example below, I would expect a rectangle formed by the spheres:

My code is the following:

void OnPostRender( )
 {
     GL.PushMatrix ( );
     mat.SetPass ( 0 );
     GL.LoadOrtho( );

     GL.Begin( GL.LINES );
     GL.Color( Color.white );

     for ( int i = 0; i < spheres.Length; i++ )
     {
         currentVector = Camera.main.WorldToViewportPoint ( spheres[i].transform.position );
         GL.Vertex3 ( currentVector.x, currentVector.y , 0  );
     }

     GL.End();
     GL.PopMatrix();
 }

Also, I found this tutorial/example but is not exactly what i'm looking for, since in the example, all have the same origin point.

I'm asumming that the correct way of achieving what I want, would be to call the Gl.Vertex3 method once for each of the 2 points that form each line:

From A to B (GL.Vertex3 call 2 times)
From B to C (GL.Vertex3 call 2 times)
From C to D (GL.Vertex3 call 2 times)
From D to A (GL.Vertex3 call 2 times)

Is this the right way of doing this?

Thanks in advance.

sentences:
Gdx.input.setInputProcessor(stage) doesn't work I have an image and I want to make clickable this image. I have already done this a lot of times, but this time doesn't work. Probably because the image is from a class which extends Image:

public class BitmapFontGenerale extends Image
{

BitmapFont bitmapFont;
String scritta;
private float x;
private float y;

public BitmapFontGenerale(BitmapFont bitmapFont1, String string, float scale)
{
    bitmapFont = bitmapFont1;
    bitmapFont.setColor(Color.BLACK);
    bitmapFont.getData().setScale(scale);
    scritta = string;
}

@Override
public void draw(Batch batch, float parentAlpha)
{
    bitmapFont.draw(batch,scritta,x,y);
}

public void setX(float x)
{
    this.x = x;
}

public void setY(float y)
{
    this.y = y;
}

public float getX()
{
    return x;
}

public float getY()
{
    return y;
}

}

This is the code which I used to set the input:

image.addListener(new ClickListener()
{
    @Override
    public void clicked (InputEvent event, float x, float y)
    {
       Gdx.app.log("CLICKED ", "CLICKED");
    }
});
stage.add(image);
Gdx.input.setInputProcessor(stage);

This code works if image is from Image class and not if it's from a class which extends Image. Note: I need to extend Image class. What's the problem?

sentences:
How can I generate isometric sprite sheets from 3D animations? I want to generate sprite-sheets for an isometric projection of various 3d assets purchased from the Unity3D asset store. I'd preferably also render the normal maps. I am a programmer, but new to 3D modeling software (Blender, etc.)

I found two tools for this; SpriteForge and SpriteWorks, but neither supports enough formats to be worth their cost.

There must be an efficient way of isometrically rendering various animations of a 3d assets in Blender—but I don't know how. How can I do this?

sentences:
running GL ES 2.0 code under Linux ( no Android no iOS ) I need to code OpenGL ES 2.0 bits and i would like to do this and run the programs on my desktop for practical reasons.

Now, i already have tried the official GLES SDK from ATI for my videocard but it not even runs the examples that comes with the SDK itself, i'm not looking for performance here, even a software based rendering pipeline could be enough, i just need full support for GLES 2.0 and GLSL to code and run GL stuff.

There is a reliable solution for this under Ubuntu Linux ?

sentences:
What's the easiest way to fill my 3d enviornment with temporary graphics? Currently I am starting a 3D game with C# but I don't have a designer yet nor any images or anything or any money to invest on it.

I would like to develop it using some sort of placeholder or whatever to fill the graphics so I can make at least the basics of it and later simply switch for the real thing.

Should the place holders be actual sample images or can I use for example a ball to represent a body (what will be the impact of it later when I switch to the actual body it self)?

sentences: In pygame, is there no graphicsContext.translate() method? I am new to pygame. I was searching on the internet and the pygame documentation for the functions which can translate, rotate, scale the entire graphics Context, but I couldn't find them. I know that I can apply transformations on individual surfaces using functions that are present in pygame.transform module, but I couldn't find the functions that will apply transformations to the graphics context itself. Are these functions in a different module or they don't exist?

sentences:
iOS paralleling of game tasks (Client) What good practice in paralleling of rendering, main game logic and networking on iPhone/iPad? If I program on Windows I use threading and IOCP, but I am new to iOS. So what patterns, io async libraries or something like kernel queues you choose when program complex mobile games? I need your advices on how do not stuck on waiting of server's answer and show animation at the same time? How must be organized main loop of client of the game? My interest first of deals with C++ approach and Marmalade SDK, but I'll be happy to any solutions!

So, for game logic, rendering, networking, user input and audio:

What paralleling mechanisms do you use? Pure threading or some library?
How does your waiting logic for server's answer work? I guess that animation, rendering and game logic still play and not wait server.
Any know how, links, post mortems from client-server iPad/iPhone games?

sentences:
LibGDX RPG walking animation I've been trying to nail down a walking animation with libGDX.  I'm making an RPG with the character that can move up, down, left, and right.  I have this movement in a spritesheet.  I've been following a youtube tutorial called Java Tiled Map Game which can be found here: http://www.youtube.com/watch?v=qik60F5I6J4

He does a better job then some of explaining what the code does but he glosses over the part where he gets his character to do a walking animation (by which I mean he doesn't show it at all).

I then moved to the tutorial found here: http://obviam.net/index.php/getting-started-in-android-game-development-with-libgdx-tutorial-part-2-animation/

But this tutorial tells exactly what needs to be done in regular words and then just gives a block of code.  I already know what I need to do in regular words but I'm not trying to learn english but programming which is a completely different language.  I'm sure I could copy and paste that code and edit it to do what I need but I wouldn't understand HOW it works only THAT it works.  I want to know the how of it all.  I'm new to libGDX and this is my first RPG game.  I really want learn how to do it myself instead of relying on others.

My question is simply this:  Do you know of a tutorial which shows and (more importantly) explains how to do a simple walking animation?  I'm hoping you can supply one for me.

sentences:
Spell design and comunication with Player Im trying to design Spell class that can modify almost anything, Player, Units, other spells, etc. I figured out two ways of doing it, but none of this seems proper for me. Thats mainly because of Player class that got a lot of parameters and setting spell is a bit troublesome.

First is:

Spell interface that Im adding to each class of spell, which have method: execute.

Pros:

dont have to pass a lot of parameters, just call proper function of target class of a spell
To use spell just pick spell Player.GetSpell("Fireball").Execute(targets)
Big flexibility

Cons:

A LOT OF CLASSES, like 30 or more. One for each spell type
Each spell need to be wrote manually

Creating spell

class Fireball : SpellBase, ISpell
{
    public void Execute(Player caster, List<Object> target)
    {
        caster.Mana -= ManaCost;

        foreach (var o in target)
        {
            if (o.GetType() == typeof(Player))
            {
                var p = (Player)o;
                p.Health -= 10;
                Console.WriteLine("Player: {0} recieved 10 dmg, now has {1}",
                    p.Name, p.Health);
            }
            else if (o.GetType() == typeof(Spell))
            {
                var s = (Spell)o;
                s.Cooldown += 1;
                Console.WriteLine("Unit: {0} recieved 10 dmg, now has {1}",
                    s.Name, s.Health);
            }
        }
    }
}

Construction

spells.Add(new Fireball());

Executing

spells.First().Execute(caster, enemy);

Second approach:

Write one or few classes that can have different functionality depending on parameters set in constructor.

Pros:

few classes
loading parameters from file or data base

Cons:

setting a lot of parameters for different classes(spells and player really dont have much common fields)
One gigantic method, to handle spell execution

Creating spell

class Spell:SpellBase
    {
        public SpellData Data { get; set; }

        public Spell(SpellData param)
        {
            Data = param;
        }
    }

Construction

 spells.Add(new Frostball(params));
                {
                    HealthMod = -10
                });

Executing

public void CastSpell(Player caster, List<Object> enemy)
        {
            Caster.Mana -= ManaCost;

            foreach (var o in enemy)
            {
                if (o.GetType() == typeof(Player))
                {
                    var p = (Player)o;
                    p.Health += spell.Data.HealthMod;
                    //p.Defence += spell.Data.DefenceMod;
                    //and a lot of atributes and dependencies
                    //.
                    //.
                    //..........
                }
                else if (o.GetType() == typeof(Spell))
                {
                    var s = (Unit)o;
                    s.Cooldown += spell.Data.CooldownMod;
                    //s.Defence += spell.Data.DefenceMod;
                    //and a lot of atributes
                    //.
                    //.
                    //..........
                }
            }
        }

So... I need flexibility a lot. Im not saying its not possible to make it with second way but it will make one big Method with a lot of ifs, which I want to avoid, and i know that with time complexity of this will overwhelm me. Also setting parameters of all spells easily from DB would be nice.

Which one approach do you suggest? Maybe change sth or even you have ideas for whole different way of doing this? Please help me :)

Designin's hard...
Sorry for english.

sentences:
Where can I modify the default damage system on UDK I want to make a custom damage system on my game but I can't find the function that handles it...

I looked on Actor.uc but the only thing I've found is the event TakeDamage, but there's nothing on it that actually deals the damage.

Thanks in advance.

sentences:
Geometry shader-generated tile mesh isn't any faster than CPU-generated version For practice, I'm writing a Rogue-like. In order to speed up tile rendering I have a dynamic Mesh/MeshBuilder that collects all the vertices of the visible tiles' quads (4 vertices per tile: position, color, UV; and 6 indicies) CPU-side and emits a single draw call of the large tiled triangle mesh. At 600 FPS/0.0017 ms this is fast enough for my purposes.
I recently decided to practice with the various rendering pipeline stages and thought that this would be a great candidate for the geometry stage and have the GPU generate the tiles for me, passing in only a single vertex/index pair per tile.
There are as many as 2000 tiles visible per frame, yet it was no faster than the CPU version despite passing one quarter the amount of vertices and one sixth the indicies across to the GPU.
It's my understanding that it is a best practice to minimize the amount of data passed between the CPU and GPU, and hand off work to the GPU that it is better suited to do.
Am I wrong in this understanding?
It seems like the geometry shader isn't that useful if offloading work to it doesn't have a benefit?
What can be achieved with the geometry shader that other techniques can't do?

sentences:
A star pathfinding and discrete/smooth positions The A* (A-star) algorithm usually represents a path on a grid.

Once a path has been found, however, the path looks blocky and is not suited if you move your units with floating point datatypes.

Here is an image describing the problem. The whites tiles represent the path found by A*. The black line path  is the path I want, the red line path is the one I don't.

One solution would be to select a corner when the path turns, and switch/keep side when the path turns the other way. Seems like the most logical and cleanest way to do this.

sentences:
Inifinite scrolling draggable background for a 2D editor I need to create something like blender's Node Editor for my 2D editor. Now I am not sure how to create the background so it is static infinite and draggable simillar to blender.

I need to make it so it doesn't wreck my GPU and that its infinite and can be zoomed in and out without a problem

Can anyone give me tips on where to start?

sentences: Javascript injection problems to beat my game! HELP So I have a web application game that runs completely on the client side and just returns the score back to the server to list the highest scorer. Now I have noticed that I can easily manipulate the scores via accessing the variables from the console and injecting my own value! This SUCKS! I am a total noob in this kinda development and have absolutely no clue how I can stop this apart from obfuscating the code and praying to god that the hacker doesn't figure out which variable is he supposed to use! Now I was hoping there are better ways to stop the hacker to gain access of my variables. Could someone help me out with this issue!?

sentences: Making large scale changes to an economy in a social game Are there any examples or case studies of social games, specifically on Facebook, where the developer has made drastic changes to the economy?  I'm specifically interested in examples where the old economy was based off of purchasing items with Facebook credits then moving to a new model where the same inventory or similar inventory is sold with a soft currency.  The closest comparisons I've been able to find so far are looking at iOS games that have gone from purchase models to freemium models, but haven't found a comparable scenario in a social game besides larger scale MMO's.

sentences:
Tilemaps are loading differently each time Tilemap data is stored in a 2D array.
It is saved using the following code

void Chunk::save_to_file() {

    // FILENAME
    std::string filename = std::to_string(chunk_seed);

    std::fstream file;
    file.open(filename + ".chunk", std::ios::out);

    for (int i = 0; i < Constants::BIOMESIZE; i++) {
        for (int j = 0; j < Constants::BIOMESIZE; j++) {
            file << std::to_string(chunk[i][j]);
            file << ",";
        }
    }

    file.close();

}

And it is loaded using the following code

void Chunk::load_from_file() {
    // FILENAME
    // The chunk will be located at hash(chunk_x, chunk_y) ^ seed = chunk_seed
    std::string filename = std::to_string(chunk_seed);
    // Data within file
    std::string data;

    std::fstream file;
    file.open(filename + ".chunk", std::ios::in);
    file >> data;
    file.close();

    std::vector<std::string> tokens = split(data, ',');

    for (unsigned int i = 0; i < Constants::BIOMESIZE; i++) {
        for (unsigned int j = 0; j < Constants::BIOMESIZE; j++) {
            chunk[i][j] = std::stoi(tokens[i + j * Constants::BIOMESIZE]);
        }
    }
}

Tilemaps are loaded using the loading function when the program is started up and displayed.
Tilemaps are saved using the saving function when the program is exited.
They do not display the same way each time.
I have pinpointed that the problem is in the saving function.
This is because I commented out the saving part and when I was only loading the same files it worked and had the same output each time.
It appears as though the saving function rotates the tilemap by 180 degrees each time I save it.
How can this be fixed?

sentences:
CanDraw in large hierarchical scene with rotation I've been assigned to write small simulation visualization, that contains thousands of cubes (I know you heard that before). Now I'm working on optimization of stuff that takes place there, but suddenly I came across a brain teaser (maybe my math foo is to weak).

Scene is arranged in hierarchy, each cube can contain another cubes and so on (cubes always must be contained in parent cube, position is relative to parent cube (including transformation except scale). Now we added ability to rotate cubes and all hell broke lose. We use simple culling of objects that shouldn't be drawn this look like this (Warning C#):

    public bool CanDraw(ICamera camera, Vector3d offset)
    {
        Vector3d pos = _translation + offset;

        _inFrustum = camera.SphereInFrustum(pos, _radius);

        if (_inFrustum == InFrustum.Partial && Children != null)
            foreach (IDrawable item in Children)
                item.CanDraw(camera, pos);

        return _inFrustum != InFrustum.No;
    }

InFrustum enum can be Yes, No, Partial.

Now the problem that we get is when parent cube is rotated for example by 45 deg around Z axis and is partially visible all children are tested, but rotation is not included this results in child cubes not being drawn... further more if child cube is drawn, but is rotated problem is starting to get worse.

Do any of you how to solve this without moving test draw code into rendering loop (after transformations are made to see if point 0,0,0 is in frustum?

I imagine that I would have to rotate pos using offset as axis origin and parent rotation (how?), but still that parent object (offset and rotation) might be already rotated by it's parent.

I must do those checks, cause scene contains around 300k+ boxes and drawing all of them ends up in <0.1 FPS on machines that it's used.

sentences:
Making my character jump How do I fix my code?

At the moment my character goes up for as long as you hold the up key.  I want a more jump like effect where the character will drop back down when it reaches a certain height.  I want the character to only be able to jump again once it's fallen back down.

Below is my code so far.

var canvas = document.getElementById("mainCanvas");
var context = canvas.getContext("2d");

var keys = [];

var width = 500, height = 400, speed = 4;

var score = 0;

var player = {
        x: 40,
        y: 350,
        width: 20,
        height: 20,
        gravity: 20,
        weight: 1
    };

window.addEventListener("keydown", function(e){
        keys[e.keyCode] = true;
    }, false);

window.addEventListener("keyup", function(e){
        delete keys[e.keyCode];
    }, false);

function game(){
    update();
    render();
}

function update(){
    if(keys[38]) player.y-=speed;

    if(speed < player.gravity) player.y+=player.weight;

    if(player.x < 0) player.x = 0;
    if(player.y < 0) player.y = 0;
    if(player.x >= width - player.width) player.x = width - player.width;
    if(player.y >= height - player.height) player.y = height - player.height;
}

function render(){
    context.clearRect(0,0,width,height);

    context.fillStyle = "blue";
    context.fillRect(player.x, player.y, player.width, player.height);

    setInterval(function(){
            game();
        }, 1000/60)
}

sentences:
How to get the rotation matrix to transform between two 3d cartesian coordinate systems? I'd like to know how to get the rotation matrix for the transformation from one cartesian coordinate system (X, Y, Z) to another one (X', Y', Z').

Both systems are defined with three orthogonal vectors as one would expect. No scaling or translation occurs. I'm using OpenSceneGraph and it offers a Matrix convenience class, if it makes finding the matrix easier:

  http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00403.html.

sentences:
How do I handle user input with good class structure/architecture for an Android game? How do I handle user input having "good" class structure and following normal game architecture*?(see below). At first I didn't think this question was Android specific, although, after seeing a great response in C++ I would appreciate some insight on this question using Android architecture.

Current way I handle input for my Android Game:

Created controller class that takes X,Y screen events and X,Y
character position and returns an int that represents a direction the
character should move.

Call the controller method in the game's
update.

Send that direction value to my character update.

Character's update calls move (which is also passed this value).

Basic switch statement determines the direction my character moves.

Getters and setters for the position of the character.(should
I have them for this direction also)

Is there a better way of handling input? This doesn't feel like the best way. Where does input fit in with class structure and game architecture?
I'm going to accept the C++ answer but I would really like to see a Java answer for Android in the future. :D

sentences:
AndEngine Font Issue I am learning AndEngine. I am displaying Hello world using this code:

public class myactivity extends SimpleBaseGameActivity
{

 private final int CAMERA_WIDTH = 320;
 private final int CAMERA_HEIGHT = 480;

 private Camera  m_Camera;
 private Scene  m_Scene;

 private Font  font;
 private Text  text;

 @Override
 public EngineOptions onCreateEngineOptions()
 {
  m_Camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
  EngineOptions en = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(
    CAMERA_WIDTH, CAMERA_HEIGHT), m_Camera);

  return en;
 }

 @Override
 protected void onCreateResources()
 {
    //determine the density
 WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
 Display display = windowManager.getDefaultDisplay();
 DisplayMetrics displayMetrics = new DisplayMetrics();
 display.getMetrics(displayMetrics);
 int density = (int)(displayMetrics.density);

 //scale desired size 25 by density
     int fontSize = (int) (25 * density);
  font = FontFactory.createFromAsset(this.getFontManager(), this.getTextureManager(), 1024, 1024, this.getAssets(),
    "times.ttf", fontSize, true, android.graphics.Color.BLACK);
  font.load();

//Texture fontTexture = new BitmapTextureAtlas(1024, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
//font = new Font(fontTexture, Typeface.create(Typeface.DEFAULT, Typeface.NORMAL), fontSize, true, Color.WHITE);
//mEngine.getTextureManager().loadTexture(fontTexture);
//mEngine.getFontManager().loadFont(font);

 }

 @Override
 protected Scene onCreateScene()
 {
  m_Scene = new Scene();
  m_Scene.setBackground(new Background(Color.WHITE));

  text = new Text(0, 0, font, "Hello Android", this.getVertexBufferObjectManager());
  m_Scene.attachChild(text);

  text.setPosition(CAMERA_WIDTH/2 - (text.getWidth()/2), CAMERA_HEIGHT/2 - (text.getHeight()/2));
  return m_Scene;
 }

}

It is displaying the font like this:

As you can see that pixels are stretching and font is looking ugly with too much pixelation. How do I display proper font text with no pixelation or add anti-aliasing to the font?

sentences:
How can i use StartCoroutine to set the speed for each scaling step of the walls? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WallsTest : MonoBehaviour
{
    // using a GameObject rather than a transform
    public GameObject prefab;
    public Vector3 wallsStartPosition;
    public float width = 0;
    public float height = 1;
    public float length = 2;
    public Camera wallsCamera;

    void Start()
    {
        wallsCamera.transform.position = new Vector3(wallsStartPosition.x, wallsStartPosition.y + 100, wallsStartPosition.z - 235);

        StartCoroutine(BuildWalls());
    }

    IEnumerator BuildWalls()
    {
        for (int i = -2; i < 2; i++)
        {
            GameObject go = Instantiate(prefab);
            go.transform.parent = transform;
            Vector3 scale = Vector3.one;
            Vector3 adjustedPosition = wallsStartPosition;

            float sign = Mathf.Sign(i);
            if ((i * sign) % 2 == 0)
            {
                adjustedPosition.x += (length * sign) / 2;
                yield return new WaitForSeconds(0.1f);
                scale.x = width;
                scale.y = height;
                scale.z *= length + width;
            }
            else
            {
                adjustedPosition.z += (length * sign) / 2;
                scale.x *= length + width;
                scale.y = height;
                scale.z = width;
            }

            adjustedPosition.y += height / 2;
            go.transform.localScale = scale;
            go.transform.localPosition = adjustedPosition;
        }
    }
}

What it does now it's creating two walls at once it's just waiting 0.1 millisecond before creating them.

But instead i want it to show the scaling of the walls how they scaling and moving same for the else part for the adjustedPosition.z and not only the adjustedPosition.x

The problem is it's just waiting until it's placing the walls at once. I want to see the walls being building step by step like it's placing cube after cube.

sentences:
Show/hide soft-keyboard on demand I'm writing simple chat-app using Unity. The problem with Unity's default implementation of soft-keyboard visibility is that it hides itself when i'm clicking outside of keyboard panel. What i want is that keyboard stays always shown until i explicitly tells otherwise.

For a couple of days i tried to find similar questions but none of them helped me. I have very little experience in "native" android development (i.e. Java). So far i managed to create simple native plugin for Unity. I tried to manually open keyboard with this code:

imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);

The result was fine, except the keyboard had InputType set to TYPE_CLASS_NUMBER. For my app i needed TYPE_CLASS_TEXT. So i tried to research how to set InputType and stumbled on fact that this property can only be changed inside EditText object. As i'm writing my app in Unity, i had no way of finding my InputField's inside native code. So i tried to create EditText inside my native plugin. I followed the logic that if i create custom EditText, place it inside main layout and set visibility to NONE or make background transparent, then i can set focus to that element and be fine:

FrameLayout myLayout = activity.findViewById(android.R.id.content);
focusedText = new EditText(context);
focusedText.setFocusable(true);
focusedText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL);
myLayout.addView(focusedText);
focusedText.setFocusableInTouchMode(true);
focusedText.requestFocus();
focusedText.setBackgroundColor(activity.getResources().getColor(android.R.color.transparent));
imm.showSoftInput(focusedText, InputMethodManager.SHOW_FORCED);

The end result was a mess. Soft keyboard behaviour became undesirable. In order for keyboard to show, i first needed to select InputField, then i would see transparent EditText be created in the middle of my layout with all input characters visible. Even if all worked fine, it still looks like a wacky hack.

Does anyone stumbled across similar issues?

sentences:
Making dialogue different with each playthrough I'm making a little demo game where roughly half of the NPCs in a little town have a profession, as well as a personality. I'm trying to have the game procedurally create dialogue,
so when an NPC is talking about what they do, they describe it with some personality.

So for example, I may have a farmer who's an over achiever. He may have dialogue like this: "I farm from sun up to sun down. And I have the most cows around!"
In another incarnation, a brainiac farmer may say, "Hi, my farm has exactly five cows, and is run very efficiently."

In the demo, the town will be procedurally generated, with a small number of townsfolk (around ten or twelve). Some will be peasants, others will be farmers. One or two will be merchants/shopkeepers. When the player talks to some of these folk, the NPC may greet the player and say something about what they do. Or they may describe themselves, as well as something about their town. On occasion, the NPC will also say something about their family.

I have thought of using a templating system, where it would fill in some of the dialogue. But I would like the sentences to vary with each playthough.
I have also thought of using parts of speech so as to create sentences. The problem with using parts of speech (at least with using NLTK) is that I need some form of grammar to string them all together,
and this is mainly meant for a small demo. Another option is to use a natural language generator (NLG), but that's getting into the realm of advanced AI. And I would like to steer away from that.

So should I use a templating system for the dialogue (I have tried using Rant, but I got into some really complicated syntax with that)? Or, should I use a dialogue system that uses parts of speech, and strings them together with some kind of grammar?

For what it's worth, I'm restricting the NPCs to a group of personalities. Also, some of what they say is based upon their stats. So if their intelligence is low, yet their charisma is high, maybe they'll be a xenophobe, or an over achiever.

sentences:
3D Level Navigation Map for a 2D Mobile Game I am currently making a game in which I want to create a level screen map. The Map doesn’t have to do anything with the game logic and stuff but I just want to add it to include a bit of richness.
The Map I am planning to add will be a 3D map. I just want to know how I can use a 3D map for usage in a 2D game. What is the best approach to get started with? I have tried iTween’s Tweening stuff to Animate and control camera over a spline curve but I am not sure what can be the best approach for it?
The Map will be just a set of levels/point in which the initial need to clear before you go to the next.

sentences:
How to keep AI goalkeeper inside their bounds I'm making a soccer-themed top-down 2D endless game, but I have a problem with the goalkeeper AI.
My game looks like this:

As you can see, the goalKeeper is moving out of bounds.
I have tried to clamp them with
transform.Translate(Mathf.Clamp(target.transform.position.x,-1,1),0,0)

...but I think this for clamping the speed, not the area boundaries. What should I do instead?

What I want is to have two kinds of goalkeeper:

Active Goalkeeper (Call them GKA)
This goalkeeper should chase the player, but only within the bounds of the goal area.

Stationary Goalkeeper (Call them just GK)
This goalkeeper should just stand in the middle of the goal, like in the first animation. But before the player reaches them I want this goal keeper to move forward slightly, to pretend it's defending the goal.

Here is my goalkeeper script:
if (gameObject.CompareTag("GK"))
    {
        anim.SetBool("GKRun", false);
        gkballInRange = Physics2D.OverlapCircle(transform.position, gkballRange, playerMask);
        float distancePlayer = Vector2.Distance(target.position, transform.position);

        if (gkballInRange)
        {
            transform.Translate(0, -.3f * Time.deltaTime, 0);
            if (distancePlayer <= gkballRange)
            {
                if (theBall.isOver)
                {
                    anim.SetBool("GkC", true);
                    anim.SetBool("GKRun", false);
                    transform.Translate(0, 0, 0);
                }
                else
                {
                    //Animation
                    anim.SetBool("GKRun", true);
                    transform.Translate(target.transform.position.x * speed * Time.deltaTime, 0, 0);
                }
            }

        }

    }

and this one is GKA script:
if (gameObject.CompareTag("GKA"))
    {

        //Animation
        gkballInRange = Physics2D.OverlapCircle(transform.position, gkballRange, playerMask);
        float distancePlayer = Vector2.Distance(target.position, transform.position);

        if (gkballInRange)
        {
            transform.Translate((target.position.x * Time.deltaTime), 0, 0);

            if (distancePlayer <= gkballRange)
            {

                if (theBall.isOver)
                {
                    anim.SetBool("GkC", true);
                    anim.SetBool("GKRun", false);
                    transform.Translate(0, 0, 0);
                }
                else
                {
                    anim.SetBool("GKRun", true);
                    transform.Translate(0, -speed * Time.deltaTime, 0);
                }
            }
        }
    }

sentences:
Delta times and frame lag in the game loop Let's say we have a standard gameloop like this, in pseudocode:

while (true) {
    dt = GetDeltaTime();
    Update(dt);
    Render();
}

Here Update(dt) either uses a true variable timestep, or it determines how many cycles of a fixed timestep physics loop to execute based on dt.

Now say we have the common case where we have mostly constant framerate except for infrequent single-frame hiccups, so let's say we have dt values like

1/60, 1/60, 1/60, 1/6, 1/60, 1/60, ...

By the time our GetDeltaTime() detects the larger timestep in the fourth frame, we have already rendered and presented the fourth frame! So one frame will already have been rendered with a wrong (too small) timestep no matter what we do.

So if we now use the larger dt=1/6 to render the fifth frame, my understanding is that we artificially create a second frame where a wrong timestep is used, this time a too large one. I wonder if this problem is acknowledged anywhere. Wouldn't it be better, say, to use the averaged dt over the previous few frames to combat this?

Here are some pictures to illustrate what I mean. I use the example of an object moving along a fixed axis with a constant speed, and using a variable timestepping scheme. The problem is essentially the same with fixed timesteps, though.

The plots have time on the x-axis, and the object position on the y-axis.

Let's say the object moving at 1 unit/s, and framerate is 1 Hz. This is the ideal situation.

Now let's say we have a frame where the time interval is 2 instead of 1. With a classical dt-based scheme, we get this:

So we have one frame where the velocity is perceived too low, and one where it is perceived too high and which corrects for the velocity in the previous frame.

What if we instead, say, always use a constant (or very slowly changing) dt? We get this:

The perceived velocity seems smoother using this approach to me. Of course, the object position is now not the "true" one, but I think humans perceive abrupt changes in velocity more clearly than such small positional offsets. Thoughts?

UPDATE:

At least Ogre can do this: http://ogre.sourcearchive.com/documentation/1.6.4.dfsg1-1/classOgre_1_1Root_1f045bf046a75d65e6ddc71f4ebe0b2c.html So I guess I just got downvoted for people not understanding my question, which is rather frustrating.

sentences:
Isometric View of "Voxel-Style" Terrain Suppose you have an arrangement of data for a terrain set up like this: terrain[layer][cart-x][cart-y]. Each location (ex. terrain[0][0][0] for the top left corner of the lowest layer) in the array simply stores -1 for air, 0 for water or 1 for dirt. How should I loop over this data to produce a "camera?" For example, given a focal point, world, and screen size, iterate over only the visible blocks and call the block-render function.

I have some semi-working Javascript, but I have several issues;

How can I find the minimal number of tiles to draw so that the screen edges are covered, while keeping the position centered on screen? I've gotten this done but it's messy.

When the layer depth varies, how do I properly account for that as far as offsets are concerned? Currently, I can make an offset calculation for a depth. But it doesn't carry to other depths. Like say, you are viewing an area where there is terrain at layer 15. The camera is offset by a certain amount to restore the focal point to center. But if you move to an area where the height is only 14, then you'll start to see a drop off toward one edge. This also happens when there is something much lower on the "forward" side.

How do I prevent drawing blocks that are completely obscured? This one is very important and should be seen as the priority of these, but I don't think I can move on to it yet.

Here's what I've made so far:

View working (hacky) example on Codepen

(Showing only what I think are the important parts here)

function screenPos(x,y,z)
{
  var op = {
    x: (x-y)*th,
    y: ((x+y)*th/2)-(z*td)
  };
  return op;
}

function drawTerrain(position, world, ctx, minElev, maxElev) {
  minElev = (minElev===undefined? position.z : minElev);
  maxElev = (maxElev===undefined? position.z+1 : maxElev);

  var cen = {
        a: position.x + position.y,
        b: position.x - position.y
      },

      max = { //Use testSize instead of canvas size so we can see overdraw
        a: Math.floor(testSize.y/th),
        b: Math.floor(testSize.x/ts)
      },

      startPos = {
        x: ((cen.a - max.a) + (cen.b - max.b))/2,
        y: ((cen.a - max.a) - (cen.b - max.b))/2
      },

      offset = screenPos(startPos.x, startPos.y);

  //account for testSize offset
  offset.x-=50;
  offset.y-=50;

  //regular offsets
  offset.y += th/2;
  offset.y -= (th)*minElev;

  ctx.textAlign = "center";
  ctx.textBaseline = "middle";

  for(var z = minElev-1; z < maxElev; z++) {
    for(var a = cen.a - max.a -1; a < cen.a + max.a +3; a++) {
      for(var b = cen.b - max.b -1; b < cen.b + max.b+2; b++) {
        if ((b&1) != (a&1)) continue;

        var x = (a+b)/2,
            y = (a-b)/2;

        drawTile(x, y, z, offset, world, ctx);

        i++;
      }
    }
  }
}

Some thoughts on possible solutions:  I think that at least one step of conversion between x/y and a/b could be removed here, as it's gotten all convoluted while trying to make things work. There are lots of things like that, I realize. The Codepen page shows exactly how thrown-together the current solution is. The only thing I'm interested in is fixing and optimizing the main loop and any methods/data necessary to drive it.

P.S. I didn't feel the need to include the drawTile function on this page as it has very little conditional logic, only basic stuff, and calls to the same screenPos function. That said, you can see it at the Codepen Example

sentences:
Adjust postion only in X axis I have two game objects named A and B, just as follows:

I want to move object B to this virtual line without any rotation so that the destination is B' . What I have are transformation of object A and B. I'm brand new to Unity3D and its APIs, so I don't know how should I get this done.

sentences:
GLSL: #define vs const What is the difference between #define NAME VALUE and const int NAME = VALUE in GLSL 410 core?

As far as I can see, they both create a constant integer.

sentences:
XNA Advanced font rendering (outline, shadows, etc) I am looking for a tool that will output spritefonts for XNA consumption that have an outline effect. I know that this can be done by rendering the text multiple times, but I'd like to take care of it in the content pipeline.

The options that I was able to find reference to were hosted at sites that are now offline. I know Nuclex has a vector font option, but again, I'd like to stick with sprite fonts and handle the rendering at compile time.

If anyone can link to an archived copy of those free tools, it would be appreciated.

sentences:
After using Unity's Destroy() function, I see the Prefab Clones are now called "New Game Object" is this a problem? I use a prefab to generate several gameobjects which I then get rid of with the Destroy() function.

I noticed the clones, when destroyed are replaced with "New Game Object".  Because of the nature of the game there would be thousands of these created throughout the course of the game.

Is this expected behavior, or is there something I'm perhaps doing wrong where the Destroy isn't really getting rid of it completely?

sentences:
How to implement the seek steering behavior in Unity3d? Following this tutorial: Understanding Steering Behaviors: Seek, I tried to add seek and steering behavior to my Unity prototype but it's not working this is my script. The cube does not steer it just follows the target.

public GameObject target;

    float maxForce = 15;
    float maxSpeed = 30;
    float maxVelocity = 200;
    float mass = 15;

    Vector3 velocity;

    void Start() {
        velocity = Vector3.zero;
    }

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

        var desiredVelocity = target.transform.position - transform.position;
        desiredVelocity = desiredVelocity.normalized * maxVelocity * Time.deltaTime;

        var steering = desiredVelocity - velocity;
        steering = Vector3.ClampMagnitude(steering, maxForce);
        steering = steering / mass;

        velocity = Vector3.ClampMagnitude(velocity + steering, maxSpeed);
        transform.position += velocity * Time.deltaTime;

    }

What could be the problem??

sentences:
DX 11 Specular Highlights in Deferred Renderer I am currently implementing a deferred renderer in DX11.1.  Right now I am having a problem that I can't seem to crack with specular highlights when I have multiple light sources.

I keep a vector of lights for each scene and the last light rendered has proper spec, but all lights before it are "bad".  I think the problem is caused by an improper blend state setting, but I'm not sure.  Currently my blend state when rendering lights is

blendDesc.RenderTarget[0].SrcBlend       = D3D11_BLEND_ONE;
blendDesc.RenderTarget[0].DestBlend      = D3D11_BLEND_INV_SRC_ALPHA;
blendDesc.RenderTarget[0].SrcBlendAlpha  = D3D11_BLEND_ONE;
blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_DEST_ALPHA;

blendDesc.RenderTarget[0].BlendOp = blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;

blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;

In my G buffer generation I write specular to the G buffer's color map's alpha channel.
 In hlsl...

output.color.a = _specEm.Sample(linearClamp, input.texcoord).a;

Then in the light accumulator

float4 diffuse = _diffuse.Sample(pointClamp, input.texcoord);

// Lighting calculations for diffuse and normal, all good
// ...

float speci = diffuse.a;
float specularLight = speci * pow(saturate(dot(reflectionVector, directionToCamera)), specp);

return float4(diffuseLight.rgb, specularLight);

In this scene there are two lights, the first image shows the specular highlight created by the second light rendered

The second image is of the first light rendered in this scene where you can see the spec "badness" (a dim highlight with a darker spot in the middle), in it you can also see the position of the other light

Never mind the light on the boxes, they aren't fully interacting with light at the moment.

Its worth noting that more lights in the scene will have the same effect, all will have the "bad" spec and the last one will have the "good" spec.

I suspect that I am missing something fundamental about how blend states work and losing some of the color that I am writing into the alpha channel, but if anyone out there can see the problem and suggest a fix, I would appreciate it.

sentences:
Movement / aiming algorithm in 2d / tiled based game I'm trying to create simple 2D / tiled base game in JavaScript. Entities are able to move by any number of pixels, but only in one direction at once (can't go in diagonal way). AI for enemies is simple 'zombie movement' (if you see target - go to him).

Currently I've got problem with my shooting mechanism. In my code I've got statement which say something like this:

if (distance_to_target <= weapon_range) {
    shoot_in_current_direction();
}

As you can see on example below my problem exist when target is in range in diagonal way.
Red rectangle is 'shooter', blue rectangle is 'target', black dots are 'bullets' and black arc line is a weapon range.

My question is: how to implement restrictions which allow to shoot only if target is in good direction, but not exactly on that same x/y coordinate (allow for some margin)? Should I implement more intelligent movement algorithm (i.e A*)?

To be clear... I'm not looking for ready code but rather for some algorithm help.

sentences:
Unity3D WWW get HTML displayed in browser I currently have in a web page, on a localhost server, some information that I want to use in Unity. My problem is that this information are stored in some js variables.

I tried to use the WWW class in a coroutine, but I only get the html source code. Is there a way to get the value of this variables inside Unity Editor ?

Thanks !

sentences:
How to use the unreal "automation spec" with the "automation driver" and latent actions? I would like to be able to create an automated test for Unreal that will load a specific map/level and then use the automation driver, which as I understand it, is a way of faking user input, to do things on that level.
My goal is simply to load my "main menu" level and then exit out of it.
My problem is this:
The documentation shows you how to use the automation driver with the automation spec style of automated test. But none of the automation spec tests in the UE4 source do anything with assets (or anything resembling a latent action, as with the other style of tests). Most of the automation spec tests are more akin to unit tests that have no dependency on data, or AutomationDriver.spec.cpp, which has its own hard coded test UI made using SAutomationDriverSpecSuite
There seem to be no examples at all for using the automation driver with the "simple" or "complex" tests (IMPLEMENT_SIMPLE_AUTOMATION_TEST / IMPLEMENT_COMPLEX_AUTOMATION_TEST), and the automation driver documentation just states that it can be pretty tricky unless you're using it in conjunction with an automation spec

sentences:
Transform a Screen Delta I have a delta in screen coordinates that I want to transform to a 3d delta in world space.

The delta is in this case a movement across the (x,y) coordinates in screen space on the near projection plane for a known z in the 3d space. The goal is to move an object in 3d space horizontally and vertically.

How would I do this?

I guess it has something to do with getting rid of the translation component in the world-view-projection matrix, as the delta is only influenced by the scaling and rotation part of the matrices.

I tried the naive approach by setting the translation component in the world-view-projection matrix to 0, but that did not work.

The only working solution i found so far is to unproject the (0,0,z) coordinate of the object to world space and then unproject the delta (x,y,z) to world space. The result of these 2 un-projections is then substracted to get the delta in world space.

sentences:
how to create a curve movement of slider in unity I am trying to create a curved (not circular) movement of slider. Here is my demo images for reference:

I have watched some tutorial but those are for circle images. I want to make this movement along the arrow images below car. Also if this can be done with just images without using slider that will be ok too. I just this done the simpler and easy way.

sentences:
Checking whether moving object has reached target position So I have a fast-moving object in my game, let's say a bullet. At each iteration of the main loop I update the object's position based on the delta time value dt and draw it at the new position.

I also check whether the object's new position is close to a target position. In that case the object will be removed:

S....|...|....|....|......|...|....|....|...|..T..|X

The object starts from location S, moving towards target position T. Each dot . represents one ms time. The vertical bars | represent a game loop iteration, in which I check whether the object has reached its target destination. At X the object will be removed.

Since these checks (ie. game loop iterations) might take place before or after the 100% exact target position (even if only a few pixels off), I perform this check with a distance between a line segment from the last position to the current position, and whether the target position is on that line. This approach works well.

There is one issue though: Since the check in which I recognize that the target has been reached happens after the real position of the target, the object moves a little bit further than desired. That's becoming more severe when the object is moving very fast.

Now my question: Is there kind of a "best practice" how to deal with this issue? I assume this is a common problem in game development.

PS: The only solution I could think of is to re-position the object to the real target position as soon as the check succeeds. However, that can look a bit like a "jump" back, which does not look great.

sentences:
Unity - Mesh Deforms terribly while mixing animations I have a simple game I'm working on to help me learn unity3d. In my Start() function, I've used the following code to set up my animations.

        walkAnimation = animation["Walk"];
        walkAnimation.layer = 1;
        walkAnimation.blendMode = AnimationBlendMode.Additive;
        walkAnimation.enabled = true;
        walkAnimation.wrapMode = WrapMode.Loop;

        walkBackwardsAnimation = animation["WalkBackwards"];
        walkBackwardsAnimation.layer = 0;
        walkBackwardsAnimation.blendMode = AnimationBlendMode.Additive;
        walkBackwardsAnimation.enabled = true;
        walkBackwardsAnimation.wrapMode = WrapMode.Loop;

        TurnLeftAnimation = animation["TurnLeft"];
        TurnLeftAnimation.layer = 1;
        TurnLeftAnimation.blendMode = AnimationBlendMode.Additive;
        TurnLeftAnimation.enabled = true;
        TurnLeftAnimation.wrapMode = WrapMode.Loop;

        TurnRightAnimation = animation["TurnRight"];
        TurnRightAnimation.layer = 1;
        TurnRightAnimation.blendMode = AnimationBlendMode.Additive;
        TurnRightAnimation.enabled = true;
        TurnRightAnimation.wrapMode = WrapMode.Loop;

Each of them are declared before start like this

public AnimationState walkAnimation;

and I call them depending on the values of the control's axis, like such;

if(Mathf.Abs(Input.GetAxis("Rotate Player")) > 0){
                if (Input.GetAxis("Rotate Player") > 0){
                    animation.CrossFade(TurnRightAnimation.name, 0.2f);
                }

The problem is, The animations don't play, and when I turn while moving my character deforms gruesomely, his arms rise above his head and into his body, other parts grow, etc

I've been battling with mixing animations for the last two weeks, but I'm determined to get it right. If you know anything about this problem please don't hesitate to tell me what it might be. I created the model myself as well, all animations are on a single mesh, and I've tried to make the different animations affect different bones.

sentences:
iOS Sprite Kit - Blend Mode Effect This question builds upon the following question: How can I achieve a good fire effect with alpha blending and particles?

I want to achieve the visual effect of using SKBlendModeAdd on a black layer, but adding it to another (random) color background.

In the question posted above, it is explained how to do this: either by using an extra texture from which the alpha layer is removed or by using alpha premultiplication.

I've tried implementing both, but to no avail.

This probably has to do with the following:

  A particle is a textured and colored node whose contents are blended into the framebuffer. Although there is no visible class representing particles added by the emitter node, you can think of a particle as having properties like any other object.

From Apple's Documentation

My guess is that because it's a framebuffer, the workaround solutions do not work for Sprite-Kit.

So how would I go about implementing this with SKTexture or SKSpriteNode ?

See below an example of the difference in colours between dark and light backgrounds. I would like to get the exact same colours on the light background as I get on the dark background (because on the dark background it actually looks like fire).

sentences:
Issue with Button component When I add a Button component, it looks like this:

Normally, it should look like this:

How can I fix this issue?

sentences:
How to wire finite state machine into component-based architecture? State machines seem to cause harmful dependencies in component-based architectures.

How, specifically, is communication handled between a state machine and the components that carry out state-related behavior?

Where I'm at:

I'm new to component-based architectures.
I'm making a fighting game, although I don't think that should matter. I envision my state machine being used to toggle states like "crouching", "dashing", "blocking", etc.
I've found this state-management technique to be the most natural system for a component-based architecture, but it conflicts with techniques I've read about:
Dynamic Game Object Component System for Mutable Behavior Characters It suggests that all components activate/deactivate themselves by continually checking a condition for activation.
I think that actions like "running" or "walking" make sense as states, which is in disagreement with the accepted response here: https://gamedev.stackexchange.com/a/7934
I've found this useful, but ambiguous: How to implement behavior in a component-based game architecture? It suggests having a separate component that contains nothing but a state machine. But, this necessitates some kind of coupling between the state machine component and nearly all the other components. I don't understand how this coupling should be handled. These are some guesses:

A. Components depend on state machine:
Components receive reference to state machine component's getState(), which returns an enumeration constant. Components update themselves regularly and check this as needed.

B. State machine depends on components:
The state machine component receives references to all the components it's monitoring. It queries their getState() methods to see where they're at.

C. Some abstraction between them
Use an event hub? Command pattern?

D. Separate state objects that reference components
State Pattern is used. Separate state objects are created, which activate/deactivate a set of components. State machine switches between state objects.
I'm looking at components as implementations of aspects. They do everything that's needed internally to make that aspect happen. It seems like components should function on their own, without relying on other components. I know some dependencies are necessary, but state machines seem to want to control all of my components.

sentences:
Accessing a UI Image that is a child of a GameObject? I'm sure there is a very simple solution to this issue. I am creating a UI for a 2D RPG in Unity.

I have a Canvas with a two GameObjects:

DialogManager & MenuManager

The Dialog Manager has a child "DialogBox" which is a UI Image.

And the Menu Manager has three children for each part of the menu, so: three UI Images.

How the heck do I access these UI Images in a script attached to a different gameObject? Since they're technically not gameObjects, I can't just use the old gameObject.Find(). I've seen some things about Transforms and Children, but I just can't wrap my head around it.

sentences:
Saving total play time could be fine? I'm making a game that needs to save total played time into file (using JSON) for comparing & resolving data conflicts between local and cloud. I will override outdated one.

Currently, I'm just adding Time.realtimeSinceStartup, but is that okay? What if the time is really, really big and couldn't be handled in Unity anymore? Could that eventually happen?

If so, what are some alternatives?

sentences:
How can I access a method via a string in Unity? I myself am new to unity and I would like to know how it is possible to access a method via a string, something like this:
public string PlayerPrefsName;

public GameObject Button;

public string GadgetForSkin;

private void Start()
{
    GadgetChanged = PlayerPrefs.GetInt(PlayerPrefsName);
    if (GadgetChanged == 0)
    {
        Button.SetActive(false);
    }
    GadgetForSkin = "GadgetForSkin" + GadgetChanged;
}

public void GadgetChecker()
{
    GadgetForSkin();
}

public void GadgetForSkin1()
{

}

If it's not possible, how can I achieve something similar?

sentences:
Finding a path with minimal number of turns on a grid? There is a path, generated by my implementation of A*, where diagonals aren't allowed, and the heuristics is the Manhattan distance.

Is there a way to always or nearly always find a path with the least amount of turns? Even if it's a bit longer, and even if it costs more computationally.

Or is there a way to algorithmically "fix" a path later? Like on the image below, cut those long detours and replace them with those blue parts.

My current version is far from optimal, both length-wise, and both turn-wise.
I also tried multiplying the heuristic value of a tile, if:

it isn't going in the same direction as the line made from the previous 2 tiles. But that didn't help either.

sentences:
Is it possible to change the position of a Farseer joint tie point? When I create a revolute joint in Farseer, then there is always a tie point in the center of each of the two bodies. Is it possible to change the position of a tie point?

For example:

I created a revolute joint but I want to change the tie point of the Windmillsail1 body. Is it possible to change the position of the point to the lower edge of the Windmillsail1 body? I marked the position of the lower edge with a red arrow.

My code:

Body Windmillsail1, Windmillball;
RevoluteJoint RevJointA,
List<Vertices> list = new List<Vertices>();
Vector2 _origin;
float _scale;

uint[] data = new uint[WindmillsailSprite.Width * WindmillsailSprite.Height];
WindmillsailSprite.GetData(data);
Vertices textureVertices = PolygonTools.CreatePolygon(data, WindmillsailSprite.Width, false);
Vector2 centroid = -textureVertices.GetCentroid();
textureVertices.Translate(ref centroid);
_origin = -centroid;
textureVertices = SimplifyTools.ReduceByDistance(textureVertices, 4f);
list = Triangulate.ConvexPartition(textureVertices, TriangulationAlgorithm.Bayazit);
_scale = 1f;
Vector2 vertScale = new Vector2(ConvertUnits.ToSimUnits(1)) * _scale;
foreach (Vertices vertices in list)
{
  vertices.Scale(ref vertScale);
}

Windmillsail1 = BodyFactory.CreateCompoundPolygon(world, list, 1.0f, BodyType.Dynamic);
Windmillsail1.BodyType = BodyType.Dynamic;
Windmillsail1.Mass = 10;
Windmillsail1.IsSensor = true;
Windmillsail1.Position = new Vector2(1.45f, 4.05f);
Windmillsail1.Rotation = MathHelper.ToRadians(0);
Windmillsail1.CollisionCategories = Category.Cat10;

Windmillball = BodyFactory.CreateCircle(world, 0.25f, 1.0f);
Windmillball.BodyType = BodyType.Static;
Windmillball.Position = new Vector2(1.63f, 4.64f);

RevJointA = JointFactory.CreateRevoluteJoint(world, Windmillsail1, Windmillball, new Vector2(0f, 0f));
RevJointA.MotorSpeed = MathHelper.PiOver4;
RevJointA.MotorImpulse = 100;
RevJointA.MotorEnabled = true;
RevJointA.MaxMotorTorque = 100;

spriteBatch.Draw(WindmillsailSprite, ConvertUnits.ToDisplayUnits(this.Windmillsail1.Position), null, Color.White, this.Windmillsail1.Rotation, _origin, 1.0f, SpriteEffects.None, 0f);

sentences:
Frame Dependency vs Time Dependency Just today, I was dealing with this very topic in class, and I had a hard time following through the lectures. Could someone explain to me what it means for something to be frame dependent, in layman's terms? As far as I know, it's not Unity-specific. I suppose this applies to every game, regardless of its engine.

An elaborate answer would do really good for me, as I'm a student, and I'm gonna be doing projects on this. Thanks!

sentences:
Sparse voxel octree for 3d pathfinding and Manhattan distance I've been learning about using sparse voxel octree for 3d pathfinding based on Daniel Brewer's chapter in Game AI and his talk at GDC 2015.
One aspect that I'm really confused about is exactly what is considered to be a neightbor of a cell in the tree, and whether using Manhattan distance is alright or not. Let's assume that all the cells are of the same size and consider some cell C. How many neightbors will it have - 6, one for each side of the cube, or 27-1=26, all the cubes "touching" our chosen cell at least in one vertex?
It seems the former 6, but I don't see how that doesn't cause problems if we calculate distances between centers of the cells - it induces a manhattan norm, and there's lots of situations where that fails. I have some intuition why it might not be an issue if you do some type of "post processing" on the found path, but it could simply fail quite badly in finding a good path.
Brewer has mentioned using Manhattan distance throughout the talk as well to allow for easier computations, but: 1, it seems like a very problematic thing to me and 2, it seems to me like Manhattan distance is already being used when moving across neightboring cells of same size, which I would assume where the bulk of the expensive computation happens.
//
EDIT: Adding some examples of where it seems to me that Manhattan distance fails:

Green path corresponds to the good paths, red to the wrong paths. Technically the the green paths should be drawn in jagged way, as on the grid you can only move vertically/horizontally, but you can imagine that if we zoomed really close to them, that is really what they look like - it's just not visible from this distance.
sI -> eI is an example of the general issue with something like Dijsktra's - the red path has the same length as the green path in Manhattan distance and could get chosen. It would probably work fine with A* if we use something like euclidean distance for the Heuristic, since it will greedily go as close to the obstacle as possible.
sI -> eII shows the same problem, but fails with A* too.
I can imagine that both of the above are not huge issues - the pathfinding finds a general path which is good enough - when it comes to the agent actually following the path, they could for example set its next "target" as the furthest point on the path it can travel to directly (check a raycast/spherecast), or even do a few raycast checks along the line between the last point it can reach directly and the next one - the blue line in the image. We would set the local "target" to be a point on the blue line that is furthest away from the reachable point.
sII -> eIII doesn't seem like something that can be fixed like I described in the paragraph above. A* will simply find the wrong red path.

sentences:
Collision detection on a 2D hexagonal grid I'm making a casual grid-based 2D iPhone game using Cocos2D. The grid is a "staggered" hex-like grid consisting of uniformly sized and spaced discs. It looks something like this:

I've stored the grid in a 2D array. Also, I have a concept of "surrounding" grid cells. Namely the six grid cells surrounding a particular cell (except those on the boundries which can have less than six).

Anyways, I'm testing some collision detection and it's not working out as well as I had planned. Here's how I currently do collision detection for a moving disc that's approaching the stationary group of discs:

Calculate ij-coordinates of grid cell closest to moving cell using moving cell's xy-position
Get list of surrounding grid cells using ij-coordinates
Examine the surrounding cells. If they're all empty then no collision
If we have some non-empty surrounding cells then compare the distance between the disc centers to some minimum distance required for a collision
If there's a collision then place the moving disc in grid cell ij

So this works but not too well. I've considered a potentially simpler brute force approach where I just compare the moving disc to all stationary discs at each step of the game loop. This is probably feasible in terms of performance since the stationary disc count is 300 max. If not then some space-partitioning data structure could be used, however that feels too complex.

What are some common approaches and best practices to collision detection in a game like this?

Edit - More info: This current implementation has a few bugs like discs will sometimes stick over an occupied grid slot. Also it's too difficult to get discs into small spaces. These are all fixable. I asked here just to learn about alternative approaches.

sentences:
Unity 3D - Rotate (smoothly) towards a target I wanted to know if there is a method on which I can rotate an object with an angle given (a float to be precise), I use trigonometry to calculate the angle between the two objects in a (x, z) plane perspective (using y as the height coordinates).

This is the code I use to calculate the angle, but I want to know if a float would be anough data (then pass a Vector3 with that angle calculation as the Y parameter, since I want to rotate the Y axis).

//Makes the player heads to the direction the ball is...
public float headOnBall()
{
    Vector3 playerPos = this.transform.position;
    Vector3 ballPos = ball.transform.position;

    float angle;
    float x = (playerPos.x - ballPos.x);
    float z = (playerPos.z - ballPos.z);

    if(playerPos.z < ballPos.z || playerPos.x < ballPos.x && playerPos.z < ballPos.z)
    {
        angle = (Mathf.Atan2(z, x) + (Mathf.PI * 2)) * Mathf.Rad2Deg;
    }
    else
    {
        angle = Mathf.Atan2(z, x) * Mathf.Rad2Deg;
    }

    return angle;
}

Thanks in advance.

sentences:
Reusing tilemap segments I'm wondering how I can incorporate reusable tilemap segments in my workflow.

For example: I construct a room out of my tile palette, and I want to reuse this room in multiple places.

Is there some way to "prefab" a section of a tilemap? I haven't found such a thing.

Or perhaps I should just prefab the whole tilemap, and use multiple tilemap objects within one grid? Won't that introduce significant overhead?

What if I want to prefab a section of a tilemap with some additional, non-tilemap objects?

sentences: Can I publish a game with a name similar to a videogame developer? I'm currently developing a game and hoping to sell it in the future. Right now I'm about to make a facebook page and release a trailer, and I realised my game has a similar name to an already existing game developer, "lucid games", and in their website they call themselves just "lucid" which is what I was expecting to call my videogame (lucid). But also it's a British studio, and I'm from Ecuador. So I was wondering if this could be an issue?

sentences:
Should I develop with mouse in mind if I plan on targetting more than PC? Pretty simple question but I am not sure of the answer.

Should I develop user controls that use the mouse, or ignore the mouse completely and use only button controls.

An example would be:

  Clicking on an item to pick up vs. Moving close to the item and
  pressing a button to pick it up.

What are your opinions on this, especially if you want to target more platforms than just PC?

sentences:
Pass information between states in slick 2d? I am making simple game in java using Slick 2d. My question is how many ways of passing information between states are available in Slick 2d. I am having a Hero class that holds all the hero stats and carry them between states using Singleton pattern- aka creating a single instance of the object and accessible from everywhere . Are there any possible solutions and workarounds ? Some XML-alike solutions ? Is there DB option ? Is it worth the effort ?

[Edit] Put it simple I want instance of my class hero to be accessible from every state. For example my hero goes to the market and buys some armor.  That should change his stas in all states. My question was if there is another way to do that like storing the hero stats not in a class but a XML or data base.

sentences:
Body inside other body after collision I'm using bullet to create a 2D topdown game. In my physics proof of concept, I can walk around and push a box. However, if I walk too fast the character goes through the box, instead of colliding with it. See gif:

This seems like a common thing to me. However, I cannot find other people having the same problem, so that's why I'm asking a question directly. I'm using a DiscreteDynamicsWorld with two rigid bodies which I step through at 60Hz.

Why does this happen?
Is there a way to tune bullet to support higher speeds and prevent this issue?

Help is very much appreciated.

Edit

Regarding the question about how I setup collision shapes:

btConvexHullShape shape;
shape.addPoint({-size, size, 0.0f});
shape.addPoint({size, size, 0.0f});
shape.addPoint({size, -size, 0.0f});
shape.addPoint({-size, -size, 0.0f});

sentences:
Google Play 3rd Party Payment Allowed? Does Google allow 3rd party payment solutions to be enabled in developers' apps (i.e., Paypal, carrier/SMS payment), especially in countries where Google Checkout isn't present? Or does this violate any policy of theirs?

Please reference the policy in your answer if you can, and thanks in advance to all who answer.

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

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

Edit to add a bit more information as Savlon suggested:

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

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

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

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

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

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

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

Hope everything is clearer now.

Cheers

sentences:
Shader that draws just vertex points The game I am developing is in unity and I want to make a shader which can be put on a mesh that only 'draws' color on each vertex point. I am not proficient with shaders, and out of all my searching I have come up empty handed; I unfortunately don't even know how to look up this question (I seem to only find results about point clouds, which only serves to confuse and scare me more ;P).

Any help or if you can point me in the right direction on what to search, I would be very much greatful.

sentences:
How to access an animation properties from the animator? I'd like to change the property speed of an animation from the animator. For example, I'd like the player to be able to reload faster with upgrades. So I have a basic reload animation on the gun animator, and I would like to change its speed depending on the reload speed level the player has. But I can't find how to change this property in C#.

Here is what I have so far :

void Start() {
    gunAnim = gun.GetComponent<Animator> ();
}

void Update() {
    if (Input.GetKeyDown (KeyCode.R)) {
        gunAnim.Play("reload");
        reloadSound.Play();
    }
}

sentences:
How to predict where the soccer ball should be intercepted by an AI player after being kicked? This question has been asked many times before, but most of the answers give solution to the problem where ball (target) is assumed to be moving at a constant velocity.
In my scenario, I'm making a football game. When I kick the ball into a direction by applying some force to the ball's rigidbody, I want a second AI player to find the point in the ball's path where he can intercept the ball. Now this ball can keep slowing down per frame, it does not keep moving with a constant speed.
I have attached an image for visualisation.

I know the ball's position, ball's current velocity, AI player's position, AI player's constant speed. How do I find such a point, where AI player can intercept the ball?
I am able to calculate such a point with the current velocity of the ball, but that point is not accurate, and changes as ball's current velocity changes per frame, as the ball can keep slowing down after every frame. This makes the AI player act kind of like a homing missile. Instead, I want the AI player to predict a point and just run to it.
Here's the C# (Unity) Code I have till now:
public Vector3 CalculateIntercept()
{
     Vector3 pos = Ball.GetInstance().transform.position;
     Vector3 dir = Ball.GetInstance().GetVelocity();
     dir.y = transform.position.y;

     float dist = (pos - transform.position).magnitude;
     return pos + (dist / 6.17f) * dir; //6.17 is the AI player's constant speed.
}

There's no drag on the ball, but there is a physics material with friction. I suppose to solve this, I might need to account for acceleration maybe.
Please help me figure this out. Thanks!

sentences:
Networking Pong Clone I have the fundamentals of TCP sockets, UDP communication etc, but can't find much on how to apply these to a real time game environment.

I have a Pong clone, with 4 players, and need to synchronise the paddle positions between the three clients and the server (the server is the fourth player). Currently I use UDP to send real time updates (paddle movements), and TCP for setting up the game lobby etc.

Is it a BAD THING to be spamming out huge amounts of UDP traffic? Should I look into something like DCCP for its congestion features? Or is this not really a problem with a small scale project like this?

When should synchronise messages be sent between client/server? Currently the server is spamming out UDP packets with the current game state as fast as it can manage, and clients are spamming out their paddle position back to the server as fast as they can.
Is this the best way to do it? Is there some sort of delay I should add so messages are sent once every X milliseconds, or should I only be sending out messages as events happen? (eg paddle velocity changed due to user input)

Would it be better to make clients communicate their paddle positions with each other peer to peer?

I am asking these questions within the context of Pong but am also interested in how these problems would be overcome in other games, or generalised solutions.

sentences:
What is the "Unity" way to approach tech design for a 2D game like this? So I come from C++ land where I've always done every little thing myself. Now I'm getting into Unity and C# and I'm ironically overwhelmed with the domain. I'm starting off with this simple little 2D game and I'm wondering... if someone can point me to the correct tools that would lead to a successful implementation of this game. Here is a quick mock up I did in paint:

These are the parts of Unity I've investigated:

Tilemap
Canvas
GridLayout
Prefabs
GameObjects (these seem fundamental to Unity, heh).

After researching these topics, and playing around a bit, here are my initial questions:
How do you approach Canvases in Unity? I could see this being split into 5 separate Canvases, one for each local body of UI. Or 1 Canvas for the game board, and 1 canvas that contains a single overlay with all of the other UI components. But then how do those components typically get positioned? Is it common practice to place by absolute coordinates?
I guess I'm getting hung up on.. how do I place my canvas for the game board in that position relative to all the other UI elements? I'm a C++ application developer so if I'm doing UI at all I'm used to layout systems. I'm not sure how common that is in this ecosystem.
Should I even use TileMap for this? It doesn't seem like I need that kind of power. My grid is finite and fits on screen. My gut reaction is that I should just instantiate a bunch of colored squares at first. But I'm not really sure the best approach to that either. GridLayout on a canvas? Absolute coords? TileMap?
What other tools should I be looking at? By tools I mean Unity concepts I didn't mention above. My initial thought is to just have a backing data structure that holds all the data for the grid, and then I just render... prefabs? based on that data? Maybe I just want someone to tell me I'm on the right track or "no you're doing it totally wrong use this other thing", heh.

sentences:
Making AI follow player in pacman game with grid I have an AI that I want to navigate a maze in order to follow the player. I thought of creating a large grid with the help of FloatRects, so I do it like this:

private List<FloatRect> grid;
//...
for(int y = 0; y < screenHeight; y += 16)
{
    for(int x = 0; x < screenWidth; x += 16)
    {
        grid.Add(new FloatRect(x, y, 16, 16));
    }
}

making each rectangle 16x16. Now I want to make the AI find the path that crosses the least amount of rectangles in order to cross the player, while avoiding walls. How do I approach this?

sentences:
InputLayout handling Where are you supposed to store InputLayout?

Suppose i have some basic structure like.

class Mesh
{
   List<MeshPart> MeshParts
}

class MeshPart
{
   Effect Effect;
   VertexBufferBinding VertexBuffer;
   ...
}

Where should I store input layout?

It's a connection between vertex buffer and specific pass, i can live with just 1 pass but I still have diffferent techniques so i need at least an array with some connection to effecttechniques, but I would appreciate something not crazy like dictionary. I could also create wrapper for Effect and EffectTechnique, but there must be some normal solution.

sentences:
Counting shader animation "iterations" I'm writing a shader that animates "pinching" an image and releasing it. It's similar to this shader on shadertoy.

One issue I have is that my shader should only "animate" once - meaning the image should appear to "pinch", then "unpinch", but then stop. Like this example, it'll keep going since the animation ia time-driven.

Since the shader is called for each pixel I don't see any easy way to track how many "animation iterations" there have been for the entire image.

I can handle animation via a Unity Update method, where I can easily control when to stop, but I'd rather do this entirely in-shader if at all possible.

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 uv = fragCoord.xy / iResolution.xy;

    vec2 center = vec2( .5 );
    vec2 dir = normalize( center - uv );
    float d = length( center - uv );
    float factor = .5 * sin( iTime );
    float f = exp( factor * ( d - .5 ) ) - 1.;
    if( d > .5 ) f = 0.;

    fragColor = texture( iChannel0, uv + f * dir );
}

sentences:
Unity 2D map and walkable collisions I have a 2d player who can only walk on black area. There is a red collider so player can't walk past it.

Player has capsule collider.

The problem is player can't walk toward the edge with his feets becasue of the it's collider. But player would probably want to walk toward the edge.

Here is a sketch I've made.

Is there a way to tweak this ?

sentences:
A reference to a Blueprint Game Mode I am new to Unreal Engine with a very basic knowledge of working with the blueprints and code together. I am having trouble with making a reference of my Blueprint Game Mode in the code.

The question is that I have a Game Mode Blueprint (BP_GameMode) and I need to make a reference of it in a class Flag something like this:

BP_GameMode* TheGameMode = Cast<BP_GameMode>(GetWorld()->GetAuthGameMode());

Can anyone tell me how to do this?

Also, can I execute a custom event in my BP_GameMode like this?

TheGameMode->IncreamentScore(Amount);

sentences:
How to programatically retarget animations from one skeleton to another? I'm trying to write code to transfer animations that were designed for one skeleton to look correct on another skeleton. The source animations consist only of rotations except for translations on the root (they're the mocap animations from the CMU motion capture database). Many 3D applications (eg Maya) have this facility built-in, but I'm trying to write a (very simple) version of it for my game.

I've done some work on bone mapping, and because the skeletons are hierarchically similar (bipeds), I can do 1:1 bone mapping for everything but the spine (can work on that later). The problem, however, is that the base skeleton/bind poses are different, and the bones are different scales (shorter/longer), so if I just copy the rotation straight over it looks very strange.

I've attempted a number of things similar to lorancou's solution below to no avail (ie multiplying each frame in the animation by a bone-specific multiplier). If anyone has any resources on stuff like this (papers, source code, etc), that would be really helpful.

sentences:
Surprisingly, in SpriteKit game engine, "deltaTime" is not frame time? In Apple's cocos-like 2D enginer, SpriteKit, they have what they call a custom field:

testField = SKFieldNode.customField{
      (position: vector_float3, velocity: vector_float3,
      mass: Float, charge: Float, deltaTime: TimeInterval) in

            print("deltaTime \(deltaTime)")
            return vector_float3(0,0,0)
        }
addChild(testField)

the values printed out are simply the cumulative time, not the frame delta time!

Interestingly the documentation is ambiguous or just wrong:

https://developer.apple.com/documentation/spritekit/skfieldforceevaluator

notce there it uses the argument name "time", however
however, the documentation-writer wrote "time that has passed since the last time the simulation was executed" (ie, the usual frame time you'd expect), and
each Apple code fragment I've dug up uses "deltaTime" as the argument name, and the author treats it as a normal frame time like you'd expect in any game engine setting

I've tried it on as many devices/OS as at hand - has anyone found the definitive resolution of this?  Is it really meant to be (fairly uselessly) time rather than deltaTime?

Question, Does anyone definitively know if the value returns cumulative time, or, delta time?

(If the former it would appear that the doco is completely wrong.)

Question, In the so-called "deltaTime" argument of Apple's spriteKit, what is returned?

sentences:
Designing PHP RPG game: Should I use multiple classes for each type of item or a single table? I'm making a text-based role playing game written in PHP.

I have a hard time figuring out how to handle items in game - there will be a few types of objects (weapon, machine, tool, building etc) each of these types will have its own stats, attributes etc, and items itself.

My initial plan was to make a interface and abstract class called Object

interface IObject
{

   public function takeObject() {};
   public function dropObject() {};
   public function examineObject() {};
   // etc
}

abstract class WeaponObject implements IObject
{
   // Some generic properties valid for this type of objects
   public $name = "";
   public $weight = 0;
   public $damage = 0;

   // etc
}

and then make another class for each item that extends the base Object

e.g

class HuntingBow extends WeaponObject
{
   //
}

But there's a problem I think. There's going to be a lot of objects in the game - and that means a lot of classes, and composer need to load them all. So I think that performance may decrease significantly?

My second idea was to make a generic table called objects

In which I would store every item. But setting up object attributes, handling stats, etc, would be a nightmare.

Is the first idea the best way to approach the problem? Is there a better way of doing thins that I don't about?

sentences:
How to stop all character movement when jumping against the side of a platform? My Sprite is Moving against a platform.

I have a script and an unusual one (that's what one of the member said.) My isGrounded isn't using any rayCasting. I didn't have any problem with it but when I created a platform and jump against it:

My character would fall down slowly.
If I try to move against the platform, I would be able to move and it would appear as if the character was flying.

So question is, how can I stop all my movements, jumping everything, when I collide like this with a platform?

My Code is:

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

public class pScript : MonoBehaviour {
    public Rigidbody2D rb;
    [SerializeField]
    public Transform[] Points;
    [SerializeField]
    public float radius;
    [SerializeField]
    public LayerMask layer;
    public bool jump;
    public bool isgrounded = false;
    [SerializeField]
    public float MoveSpeed;
    [SerializeField ]
    public float jumpHigh;
    public bool facingRight;
    public Animator animator;
    public Object CallfPanel;
    public Object CallfText;
    public float Move = 8f;
    public Vector3 Dir;
    public Vector3 tart;
    // Use this for initialization
    void Start () {
        rb = GetComponent<Rigidbody2D> ();
        animator = GetComponent<Animator> ();
        CallfPanel = GameObject.Find ("Panel");
        CallfText = GameObject.Find ("Text");
    }

    // Update is called once per frame
    void Update () {
        RaycastHit hit;
        Debug.DrawRay (transform.position, Vector3.right, Color.white, Move);
        tart = new Vector3 (200, 300, transform.position.z);
        Dir = Vector3.right;
        if (jump == true) {
            if (Physics.Raycast (tart, Dir, out hit, Move)) {
                jump = false;
            }
        }

        float horizontal = Input.GetAxis ("Horizontal");
        animator.SetFloat ("speed", Mathf.Abs (horizontal));

        isgrounded = isGrounded ();
        rb.velocity = new Vector2 (horizontal * MoveSpeed, rb.velocity.y);
        if (Input.GetKeyDown (KeyCode.Space)) {
            jump = true;
        }
        if (isgrounded && jump == true) {
            isgrounded = false;
            rb.velocity = new Vector2 (0, jumpHigh);
        }
        if (isgrounded == false) {
            jump = false;
        }
        changeDirections ();
    }
    private bool isGrounded(){

        if (rb.velocity.y <= 0) {
            foreach (Transform points in Points) {
                Collider2D[] collider = Physics2D.OverlapCircleAll (points.position, radius, layer);
                for (int i = 0; i < collider.Length; i++) {
                    if (collider [i].gameObject != gameObject) {
                        return true;
                    }

                }

            }

        }return false;
    }
    public void changeDirections(){
        float horizontal = Input.GetAxis("Horizontal");
        Vector3 theScale = transform.localScale;
        if (theScale.x == 1) {
            facingRight = true;
        } else {
            facingRight = false;
        }

        if (horizontal > 0 && !facingRight || horizontal < 0 && facingRight) {
            theScale.x *= -1;
            transform.localScale = theScale;
        }
}
    public void showTextDuration(){
        float lifetime = 4.0f;
        Destroy (CallfPanel, lifetime);

}
}

sentences:
Correctly get size from Canvas UI element on Unity Normally when anchors are on the same position, we can use .sizeDelta or .rect.width/height from RectTransform, but if the anchor are stretched, both of them returns negative values:

Which in reality is not 5 in size at all:

There are already SetSizeWithCurrentAnchor but how to get other's RectTransform's absolute size?

sentences:
How can I rotate a cylinder so the top points at specific transform? I have a GameObject (goA) with a LineRenderer that has a single line drawn, on which I'd like to place cylinders so the top of the cylinder points to each end of the straight line that the cylinder sits on, (similar to a cylindrical bead on a straight piece of string, or a Candlestick chart).

The cylinder GameObject (goB) is a child of the goA which the LineRenderer is sat on (goB.transform.parent == goA.transform).

goA is not rotated itself, and the Line drawn could be any angle relative to the GameObject, and it would be a bit of a hassle to refactor so that the Line is always vertical and instead rotate goA, and it seems this should be an easily solvable problem!

I'm attempting to use either LookRotation or LookAt on the cylinder but for whatever reason all permutations I can think of simply are not working.

Thanks for any advice!

sentences:
What parts of a GPL game engine must be released? I'm hoping I can clarify this issue.

Note, a similar question has been asked here, but it doesn't really give a specific enough answer that I can comprehend at this point! :- How does one escape the GPL?

I plan to use a game engine that has been released under GPL to develop a MMOG, and I plan to distribute the client for free. I'm concerned that when it comes time to release my game, I'm going to have to release the entire source code under GPL, which opens my game to risk of abuse, where someone can learn how to potentially hack my game client and give them an unfair advantage etc.

If I understand GPL, I only need to distribute code that I've edited directly. In the case of Java, I can extend the available classes, do to what I need them to do, rather than go back and make edits in the classes themselves. If i'm using the original code in this way, do I just need to point out that the code is available from the engine developers

Does extending a class constitute 'editing the source?'

sentences:
what can be done to improve the ultimate insane real time strategy game AI? I had this chat with a friend of mine about whether an AI can be created or not that could beat any human without resource cheating in a real time strategy game. An AI that would play almost perfectly. The AI of today's games have many areas that can be improved, most of them rely on resource cheating, a better early base developement because of that, and attacking in waves.

Still, the question is what would need to be done to improve on this to obtain the ultimate AI. Also, if you have any example of a game where a certain feature was used it would be great.

Edit: There is little clarification i can provide for those who haven't read the title or the few paragraphs describing the problem. This is about real time strategy games and the ultimate AI. That means Strarcraft, Warcraft, Generals, Red Alert, Age of Empires, AI War etc. Games that have more than one difficulty level, but the focus here is on the ultimate challenge.

tenpn has a fantastic post filled with great resources. Thank you, tenpn! I wish more people would contribute in that direction.

sentences:
Putting each animation on a thread I'm trying to make my game as friendly to multi-core as possible. as such, i'm putting each animation on a new thread. I was hoping someone could check out my proof of concept code in java;

an example of usage is as follows:

    ThreadedAnimation ta = new ThreadedAnimation();
    Thread tat = new Thread(ta);
    tat.start();
    ta.getCurrentFrame();

where the threadedAnimation class is as follows:

public class ThreadedAnimation implements Runnable{
boolean init = false, toFinish = false, toStop = false; //synchronized info
short[] delay; //delay in ms
Image[] frames; //array for the frames
public Image currentFrame = null; //for pulling the frame
int currentFrameNumber = 0; // simmillar representation. to go barebones, I would just return the int and not the number.

public ThreadedAnimation(short[] del, Image[] fram){
    if(del.length == fram.length){
        currentFrame = fram[0];
    }else{
        System.out.println("bad animation detected");
    }
}
public ThreadedAnimation(){
    delay = null;
    frames = null;
}

@Override
public void run() {
    if(init){
        while(!toFinish && !toStop){
            currentFrameNumber = 0;
            while(!toStop && !(currentFrameNumber> frames.length)){

                long currentTime = System.currentTimeMillis();
                while((System.currentTimeMillis()-currentTime) < delay[currentFrameNumber]){// The reason I don't put TrySleep(delay[i]) is because the thread is interrupted every time we try and get the image.
                    TrySleep(10);
                }
                currentFrameNumber++;
                currentFrame = frames[currentFrameNumber];
            }

        }

    }
}

private void TrySleep(int i) {
    try {
        Thread.sleep(i);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

}
public synchronized void  finish(){
    toFinish = true;

}

public synchronized void stop(){ //stops animation where it stands and kills
    toStop= true;

}

public synchronized Image getCurrentFrame(){
    return currentFrame;
}

}

sentences:
Pygame - Change sprite collision Rect I'm making a platformer in Pygame. One of the sprites I'm using is a flag, and I want to detect if the player collides with the flagpole (just like in Super Mario Bros). The problem is that the image is wider than the flagpole, because of the flag itself. I build the Rect for every sprite based on their image, just like so:

def initialize_rect(self, pos, correction = 0):
    self.rect = self.image.get_rect(topleft = pos)

Doing this, a collision is detected when the player touches the leftmost part of the image, which is a long way from the pole, so it looks terribly wrong.

I'm trying to figure out a way to change the collision box of the sprite, but nothing I try seems to work properly. I've tried the Rect.inflate() method, but that yielded no success. It shrinks the Rect from right to left, and if I then try to change the location of the Rect, the image changes its position too.

I could just make another sprite to detect collisions and somehow link it to the flag, but that would force me to change my design.

Is there a way to change the collision boxes of sprites directly in Pygame?

sentences:
How can I display triangle faces (not quads) in Cinema4D? I started to learn Cinema 4D. I've noticed it's really easy to use for motion graphics, but I want to use it for modeling for games/realtime 3d engines.

Before I used 3dsmax and it was easy to estimate how a model would look/behave in a 3d engine. The two main things I did was displaying Polygon triangles and displaying the Polygon Count.

I've found the Total Polygons tick in HUD settings in Cinema 4D, but I can't find any display mode that will show triangles.

Is there there a way to display triangle faces/not quads in Cinema4D ? If so how ?

There is a Triangulate function, but I'd rather not Triangulate/Untriangulate all the time, especially since it's converting back and forth between the two doesn't always produce the same result.

I imagine I'm asking for old school techniques, but I plan to use these to make low poly models for web(canvas/webGL) and mobile.

sentences:
Pokemon Artificial Intelligence I'm working on a thesis about programming an AI combat system for Pokemon (To be implemented in Showdown!). However, I would like to include historical information about the existing implementations of Pokemon AI. This information would offer valuable context to my thesis.

I have been scouring the internet for some sort of algorithm that explains how the AI Trainers make their choices, but have found nothing promising. I realize the fan-games have implemented some more interesting AI systems for their trainers, these would be interesting to see as well.

What I am looking for is examples of the methods used for Pokemon Battle AI decision making used in Pokemon videogames, whether from main series by Nintendo or the many fan-games out there. I realize most of these pose no challenge to an experienced player, but I don't mind, I only wish to compile historical information on previous Pokemon AI attempts.

sentences: pre-load new scene in unity async but don't show it I have a top down dungeon crawler in 3D where I show one room at a time. Each room is it's own unity scene. Each room has an exit point that when clicked I fade the screen, load a new scene and then fade in the screen. What I'd like to do, but not sure how, is to pre-load the next possible scenes (note the S, there will be 2 but could be more. 2 because it's the next room or the previous if the player decides to go back) while in one scene. I know the scenes that are possible to get to, but how can I pre-load but not show them and because there is more than 2, I assume if they go in one direction, there is a pre-loaded one that I need to unload. Overall I want to do this to make a faster/smoother transition between rooms, but I want the one room at a time for artistic style.

sentences:
Is there a benefit to applying forces to my camera? I have implemented a camera system and a rudimentary physics system. I now have a decision to make regarding steering the camera:

Option 1 - Update the camera movement directly.

eg. position (0, 0, 0) + Key 'W' => position (0, 0, 1)

Option 2 - Apply a force to the camera and let my physic's integration sort it out.

eg. position (0, 0, 0) + Key 'W' + force (0, 0, 0.2) => ...?

How should I implement camera movement?

sentences:
MVC How To Handle Animations? I am working on a turn based game that utilizes the model, view, controller design pattern to separate logic from input from rendering. I am still a little new to the pattern, but from my understanding I have laid out the following MVC system.

The model(s) comprise a set of pawns with game flow and interaction logic. Pawns/models know how to interact with each other and the model world, but only when signaled to do so via function calls. (i.e. pawn.move(startLocation, endLocation) or pawn.attack(enemyPawn))

The view(s) make up everything that is viewable by the player. This includes menus, visual representations of the pawns/models, and any user interface components like cursors and buttons. The view(s) query the model for data to draw visual representations of pawns. The view(s) also can dispatch user interface events to any observers interested in these events.

The controller(s) handle all transition and input logic. When an interesting user interface or input events occur, the controller decides what the model should do and signals the model to do it. The controller also handles swapping out of views when necessary.

I know there are many ways to implement MVC and I am open to suggestions if something seems off with this design, but the real problem I am having is how to handle animations in the view. Say the user commands a pawn to move 5 spaces North and 1 space West. I want an animation to show this over several seconds. How would I handle something like that?

sentences:
Unity 4 - Some Rigidbodies Won't Fall Asleep I'm having this problem in the free edition of Unity 4.1 where rigidbodies aren't falling asleep (and yes, I've tried playing with the sleepVelocity and sleepAngularVelocity values!). I've read the docs at http://docs.unity3d.com/Documentation/Components/RigidbodySleeping.html but cannot figure out the problem.
Here is a screenshot demonstrating my problem:
Rigidbody Sleep Diagram http://uberlethal.com/random/rigidbody_sleeping.png
I wrote a script that is attached to the rigidbodies in question, which sets the material color to red if the rigidbody is currently asleep or green if it is awake. The screenshot was taken when all objects were at rest. As you can see, not all of the gameobjects are sleeping. Each piece of debris you see on screen is its own gameobject with a rigidbody and collider.
The Unity docs I linked to above state the following:

Rigidbodies automatically wake up when:

another rigidbody collides with the sleeping rigidbody
when adding forces.

Perhaps some clarification on the above might help solve this issue: If two rigidbodies are touching when they fall to "rest", will they never stay asleep? Put another way, would they just keep interrupting each other's sleep? As for the "adding forces" part, do sleeping rigidbodies awake only when forces are added directly to them, or when any force is added to any object (this is important because I am using a rigidbody character controller which moves via AddForce() calls)
I have tried manually sleeping objects myself with undesired results. What usually happens when I do this is that some objects will remain suspended in the air.
Let me know if you need other details - I have tried a great deal of things.

sentences:
C# and Unity - Learning to Develop a game by developing the game I want to develop So I am pretty new to C#, I have some python and javascript experience, but nothing substantial.

I have read a lot about C# and Unity and I know they are the tools I want to use.

My question is: Should I be reading books about C# or should I just start hacking in unity and piecing the game together part by part?

Right now I am going through the book, HeadFirst C#, and it is very good, but I taught myself web design and javascript by just creating and hacking until I got the results I wanted then looked at other code to see ways they did it and improved my code.

The issue is that with the browser I got immediate results and it was all under one roof, where developing games is a completely different monster. I am just wondering if my time would be better spent buying a book that uses C# to teach you unity, and doing that instead, or if the time spent in HeadFirst book is going to be valuable.

Thanks a ton, I am having difficulties using my time, and I just want to maximize it as I don't have a lot of free time.

Edit: Hopefully this isn't to broad? If it is, I will delete and go elsewhere just let me know. Thanks.

sentences:
HDRP Decals, how to fix streching decals Is there a quick way to fix strenched decals when they don't quite perpend. to the normals in it's entirety?

What I do now is to get the normal of the surface and rotate decal accordingly, but with extreme angled corners it gets streched as a result.

sentences:
ContentManager in XNA cant find any XML Im making a game in XNA 4 and this is the first time I'm using the Content loader to initialize a simple class with a XML file, but no matter how many guide I follow, or how simple or complicated is my XML File the ContentManager cant find the file; the Debug keep telling me: "A first chance exception of type 'Microsoft.Xna.Framework.Content.ContentLoadException' occurred in Microsoft.Xna.Framework.dll".
I'm really confuse because I can load SpriteFonts and Texture2D without a problem ...

I create the following XML (the most basic Xna XML):

    <?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="System.String">Hello</Asset>
</XnaContent>

and I try to load it in the LoadContent method in my main class like this:

System.String hello = Content.Load<System.String>("NewXmlFile");

There is something I'm doing wrong? I really appreciate your help

sentences:
OpenGL: Filtering/antialising textures in a 2D game I'm working on a 2D game using OpenGL 1.5 that uses rather large textures. I'm seeing aliasing effects and am wondering how to tackle those.

I'm finding lots of material about antialiasing in 3D games, but I don't see how most of that applies to 2D games - e.g. antisoptric filtering seems to make no sense, FSAA doesn't sound like the best bet either.

I suppose this means texture filtering is my best option?

Right now I'm using bilinear filtering, I think:

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

From what I've read, I'd have to use mipmaps to use trilinear filtering, which would drive memory usage up, so I'd rather not.

I know the final sizes of all the textures when they are loaded, so can't I somehow size them correctly at that point? (Using some form of texture filtering).

sentences:
Best way to traverse triangles in a mesh I'm implementing non-projective decals. As described in many places (ie: lengyel in the gpg2) I first need to detect all triangles that lie within some sort of frustum.

Besides obvious brute-force solutions (ie: checking each triangle), what are better ways to generally search triangles in a mesh?
One solution i can think of is, for each mesh, keep some parallel data structure better suited for searching. are there any well know algo/solutions?

sentences:
Non-perfect maze generation algorithm I want to generate a maze with the following properties:

The maze is non-perfect. Means it has loops and multiple ways to reach the exit.
The maze should be random. The algorithm should output different mazes for different input parameters
The maze doesn't have to be braided. Means dead-ends are allowed and appreciated.

I just can't find the right resources on google. The closest i found was this description of the different types of algorithms: http://www.astrolog.org/labyrnth/algrithm.htm. All other algorithms were for perfect mazes.

Can anyone give me a website where i can look this up or maybe an algorithm directly?

sentences:
Rendering after interpolating, renders inside/outside other objects So, we're working out our interpolated render-coordinates during our render call and it's doing a fantastic job of smoothing everything out.  All is great and collision detection is working to a perfectly acceptable level (for simple CD - ie, player hits other object, looses a life, starts over...).

However, how do we deal with situations that require 'collision and resolution'?  The classic example, of course, being our player character colliding with a solid object (usually a platform or the ground) and then being 'resolved' to bring the 2 entities out of collision.... here is what I mean:

Even if we say something simple like 'just don't interpolate vertically when touching a platform' - that wouldn't seem a very clean solution because we need to think about slopes where the player is moving both left/right as well as up/down.

What is the easiest and cleanest way to protect ourselves from this happening?

sentences: Why has it become commonplace for NPCs to have one weapon per class instead of variants? For instance, in Half-Life 2 you have Civil Protection, Combine Soldier and Combine Elite. Each class has a weapon. Is there a shift away from this at all, where the NPCs are matched with the player in the sense that the weapon they choose to use is based upon their advantage, while still maintaining some sense of competitiveness? Is there a reason this became the norm? Does it have to do with all the variables and complications that can arise from doing that?

sentences:
How do I edit a Texture2D at run-time to visually indicate connected tiles? I'm making a 2D sandbox game in C# and MonoGame, and I have a couple of tile sprites. These tile are loaded in-game as Texture2Ds. I want to have blocks visually connect to adjacent blocks.

An example:

This is how a tile would look if it was connected to another tile to its right side:

Here's if all of its sides were connected:

If none of its sides were connected at all:

I think you see the idea. Starbound and Terraria do a similar thing.

I don't want to have like 10 different textures for each block for every combination of every side, as that needlessly takes up space.

What can I do in the code to edit my existing sprites to look like this? Am I just better off going with 10 different textures? Or maybe there's something better I've missed?

sentences:
Unity's Quaternion.Lerp slows down when target is directly behind turret Software: Unity v5.2.1f1 Personal

I am trying to achieve the effect of a turret in Unity. For this I have a turret consisting of 3 parts as well as a target. The problem is that whenever the target my turret is targeting has a z of < 0, the lerp speed is extremely slow. However, the further away the target is from x=0 (both positive and negative), the faster it will move. This effect only occurs when my target has a transform.position.z of < 0. When z > 0 the transform.position.x has no effect on the lerp speed. My setup is as follows:

The 3 turret parts are the base, turret and barrel.

The base is nothing more than a block for the turret to rest on.
The turret is a block holding the barrel in place with base as his parent. The turret rotates around its y-axis to always face the target. The barrel has turret as his parent. The barrel rotates around its x-axis to always face the target. See the picture below for the end result.

Base: Blue; Turret: Red; Barrel: Green;

The turret has the following code:

public class turretRotation : MonoBehaviour {

    public Transform target;

    void Update()
    {
        Vector3 relativePosition = target.position - transform.position;
        relativePosition.y = 0;
        Quaternion rotation = Quaternion.LookRotation(relativePosition, new Vector3(0, 1, 0));
        transform.localRotation = Quaternion.Lerp(transform.localRotation, rotation, Time.deltaTime);
    }
}

The barrel has the following code:

public class barrelRotation : MonoBehaviour {

    public Transform target;
    public float speed = 1;
    Vector3 relPos;
    Quaternion rot;

    void Update () {
        // Position of target relative to my position
        relPos = (target.position - transform.position).normalized;

        rot = Quaternion.LookRotation(relPos, new Vector3(0,1,0));

        // Lerping localRotatiot > rot with speed: Time.deltaTime * speed (set to 1 by default)
        transform.localRotation = Quaternion.Lerp(transform.localRotation, rot, Time.deltaTime *  speed);

        // Resetting y- and z-EulerAngles to 0; This way only the x-EulerAngle will be affected.
        // The y rotation is inherited from the parent (turret_turret)
        transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, 0, 0);
    }
}

In this picture the Lerp is working as intended; Note target.transform.z > 0

In this picture the target has a z = -5 and x = 0; pay particular attention to the Lerp speed

It eventually gets there, but it takes a very long time. For some reason, the further away the target is from x=0, the faster the Lerp speed. Note: Still slower than intended

In this picture the target has a z = -5 and x = -10

So for some reason when target.transform.z has a negative value, the higher the distance from target.transform.x to x=0 the higher the Lerp speed.

I've done a fair bit of searching and came across a post on answers.unity.com describing a similair problem; Unfortunately, no reply.
http://answers.unity3d.com/questions/1084067/lerp-problem-when-target-is-behind.html

So my question is: "Why is this happening and more importantly, how can I fix this?"

Any help would be much appreciated!

sentences:
How can I match the delta rotations of two objects? Here is the code I'm starting from:

func orientation_follow(state, current_basis : Basis, target_basis : Basis):
    var delta : Basis = target_basis * current_basis.inverse();

    var q = Quat(delta);
    var axis = Vector3(q.x, q.y, q.z);

    if (axis.length_squared() > 0.0001):  # bullet fuzzyzero() is < FLT_EPSILON (1E-5)
        axis = axis.normalized();
        var angle = 2.0 * acos(q.w);
        state.set_angular_velocity(axis * (angle / (state.get_step())));
    else:
        state.set_angular_velocity(Vector3(0,0,0));

The basis is the direction in which each vector of the object has been rotated. That is inverted and multiplied by the basis of the target object (in this case, the player's motion controller) to get the delta rotation from the object to the controller. That delta gets converted to a quaternion, from which its axis is derived and normalized before multiplying the arccosine of the quaternion's z coefficient by 2 to get the angle and finding the product of the angle and that axis (divided by delta time, which I suppose smooths the rotation a bit), setting the angular velocity per how RigidBody objects are meant to be interacted with in Godot.

At least, that's what I think is going on.

The problem is, every time you pick up an object, it essentially snaps to the rotation of the controller, because the function is interpolating the rotation of the object to the rotation of the controller every frame. So if you're trying to turn something upside-down, you have to turn your controller all the way around, instead of picking it up, putting it down partially rotated, then using your other controller to complete the rotation.

What I would like to do is get the difference in rotation in the controller between the last frame and the current frame, then apply that difference to the held object each frame, but nothing I've tried over the last few hours seems to work. The end goal is for an object to keep its rotation when initially picked up, but to rotate the same amount as the controller while held, rather than immediately snapping to the orientation as the controller as soon as it gets picked up.

sentences:
Scripting: Loading all scripts at runtime vs loading scripts when needed I'm using Boo as a scripting language in my C#/.NET game via the in memory compiler with it and I really love it, however I'm having trouble deciding when I should load my scripts.

This is my first time using a scripting language with a game and my first time implementing one into anything.

Currently I load scripts as needed - this works well. However I end up with a lot of assemblies loaded(one per file currently, as I'm just loading each when it is needed) and realized as my game expands this could turn into a large number of assemblies - is this bad? I guess I could get around this by managing appdomains and loading/unloading after scripts haven't been used for a long time. I currently don't use any appdomains for my scripts at all so I end up with a lot of appdomains due to them getting recompiled while working on them.

Loading all scripts at the same time would be a big overhead when loading as my loading times are quite fast right now, rather big memory usage due to them all being loaded at the same time, and if I want to dynamically recompile scripts when they're changed while the game is running I have to recompile all of them. Currently I can just recompile them one file at a time. The benefits of this is that I obviously have a lot less assemblies loaded.

I guess my real question is having a lot of small assemblies loaded in C# a bad thing compared to one large assembly, and compiling scripts during gameplay vs a big loading screen?

sentences: How to adjust Unity banner ads for IOS? I'm using Device Simulator from the package manager to test on mobile devices. I'm using a banner ad at the top center with the code Advertisement.Banner.SetPosition (BannerPosition.TOP_CENTER); For andoid devices I can see it but on IOS devices it is blocked by its top notches or the safe area the Device Simulator calls it. Is there a way to reposition the y axis to fit on IOS devices? Thanks

sentences:
GLSL Editor and Debugger for MacOSX with ES2 support is there a GLSL editor for the mac? I need it for iOS OpenGLES2 shader.

How do you best debug shader?

Regards

sentences:
Camera concept in OpenFL I'm starting a project using Haxe and OpenFL. I defined a big level in Flash, when I try to scroll the level in the game I have a really bad performance.

I think that moving all the objects is really expensive in terms of processing, how can I improve this?

sentences:
How to make players be creative in a game, if the game cannot evaluate it? I am working on a prototype game with several funny/visual effects that the player can trigger. The player can be quite creative in the way to use or combine these effects but it seems impossible to make detect/evaluate this creativity by the computer.

So, from a game design perspective, I wonder what could be the features to drive the players to be creative (experiment various combinations).

For the moment i think about "Draw something" where the result is evaluated by other players. I think about levels designed by "Little Big Planet" players but this aspect is out of the core game. I think also about "Minecraft" but I do not understand really how this game encourages the people to be creative (except of the open world).

Please tell me if you have any ideas, articles or references that could help me coping with this problem.

sentences:
MonoGame renders texture in an almost compressed looking way I was working on a game in MonoGame, which I have been doing for quite some time now. As I was implementing UI, I was noticing some sort of weird scanlines. Investigating further, to my surprise my whole scene was covered in it!

Notice how the texture when zoomed in has almost a JPEG squared compressed feel too it. I have no idea what is causing this.

We were using a RenderTargetTexture instead of the backbuffer, so figured I try it without, but the same happens. I checked if we were doing any weird Matrix transformations, we did not, in fact, I disabled them just to test it out. After that I thought "half pixel offset" (even though it should not really apply anymore post DX9), but also that did not solve a thing. Last but not least I thought maybe a MipMapping issue, but that would be weird since the exact same thing happens with the normal backbuffer.

My Question: Does anyone here recognize this "effect", and have any clue what might be causing it?

I'm basically just rendering a 1920x1080 image to a 1920x1080 backbuffer, but I can assure its not the image. When I for example draw a cursor and make it follow the mouse, the points where pixels "go missing", even the cursor texture deforms.

Might not be as clear in this picture, but notice how both the cursor and the orange curve basically "skip" a row of pixels, when I move the cursor to another location, it turns back to normal.

sentences:
User extendable content with Contentmanager I developed a towerdefense game that uses xml-Files for almost everything, (creeps, levels, towers, upgrades). Those Xml-files define properties like textures, sounds and values like hitpoints.

My goal is to give the user the power to add and modify those things, which will be some kind of editor in the future probably.
For now it shall be notepad...

So this makes using the ContentManager impossible i guess, since it needs to compile the data into those xnb Files.

I dont have a problem to use XmlSerializer, but how does it work for textures or sounds? Do i need to write my own code for loading the texture into vram etc?

Do i need to reinvent the wheel here and write my own ContentManger or can I make use of an existing feature?

I found a few "similiar" questions but none really gave me an answer.

sentences:
Windows Form code not executing? Ok, I've got a weird one here.  I'm trying to make a basic tile engine using a windows form, but some of my code is just...not happening.  I'll post the chunks in question.

private void MapEditor_Load(object sender, EventArgs e)
    {
        LoadImageList();
        FixScrollBarScales();
        cboCodeValues.Items.Clear();
        cboCodeValues.Items.Add("ENEMY");
        cboCodeValues.Items.Add("CHEST");
        cboCodeValues.Items.Add("NPC");

        for (int x = 0; x < 100; x++)
            cboMapNumber.Items.Add(x.ToString().PadLeft(3, '0'));

        cboMapNumber.SelectedIndex = 0;
        TileMap.EditorMode = true;
        backgroundToolStripMenuItem.Checked = true;
    }

This should be called when the form loads, right?  The code dives into LoadImageList(), which contains:

private void LoadImageList()
    {
        string filepath = Application.StartupPath + @"\Content\Textures\IndoorTileSet.png";
        Bitmap tileSheet = new Bitmap(filepath);
        int tilecount = 0;
        for(int y = 0; y < tileSheet.Height / TileMap.TileHeight; y++)
        {
            for(int x = 0; x < tileSheet.Width / TileMap.TileWidth; x++)
            {
                Bitmap newBitmap = tileSheet.Clone(new System.Drawing.Rectangle(x * TileMap.TileWidth, y * TileMap.TileHeight,
                    TileMap.TileWidth, TileMap.TileHeight), System.Drawing.Imaging.PixelFormat.DontCare);
                imgListTiles.Images.Add(newBitmap);
                string itemName = "";
                if(tilecount == 0)
                    itemName = "Empty";
                if(tilecount == 1)
                    itemName = "Floor";
                listTiles.Items.Add(new ListViewItem(itemName, tilecount++));
            }
        }
    }

The bitmap loads correctly, but then the entire MapEditor_Load method just stops working.  tileCount seems to be a local variable in the debugger, and its value is 0, but the debugger never executes the breakpoint on the line which it is assigned.  I have absolutely no idea why it would do this, and it's driving me nuts.  Any help?
Oh, I put the bitmap load in a try/catch block just to see if it was handling an exception in a weird way, but I had no luck.  It's not throwing an exception.  I began having this problem immediately after replacing my IndoorTileSet with an updated version.

sentences:
Animation is delayed after few play attemps even though all transition times' are zero I am trying to play animation forward and backward when player press the same button again and again. I have a straight line and I want to convert it to 8 while moving it. I want to play animation backward or forward from the exact frame where I pressed the button again.

When I pressed the button, animation starts playing and moving and If I pressed the button again in the middle of animation it is played backward from the exact frame. However, after a few try my animation starts playing with a delay or it stops playing completely.

I am sending speedMultiplier parameter to make the speed -1 to play backward my animation.

This is the video of the problem

private Animator eightAnimator;
private bool isLine;
private bool isMoving;
private bool becomingEight;
private bool becomingLine;

private Vector3 nextPosition;
private Vector3 startPosition;

// Start is called before the first frame update
void Start()
{
    isMoving = false;
    isLine = false;
    becomingEight = false;
    becomingLine = false;
    eightAnimator = GetComponent<Animator>();

    startPosition = this.transform.position;
}

// Update is called once per frame
void Update()
{
    if(Input.GetKeyDown(KeyCode.M))
    {
        eightAnimator.SetBool("isMoving", true);

        if (isLine)
        {
            isMoving = true;
            isLine = false;
            becomingEight = true;
            becomingLine = false;
            nextPosition = new Vector3(this.transform.position.x + 6, this.transform.position.y, this.transform.position.z);
            eightAnimator.SetFloat("speedMultiplier", 1f);

        } else
        {
            isMoving = true;
            isLine = true;
            becomingLine = true;
            becomingEight = false;
            eightAnimator.SetFloat("speedMultiplier", -1f);
        }

    }

    if(becomingEight)
    {
        this.transform.position = Vector3.MoveTowards(this.transform.position, nextPosition, Time.deltaTime * 10);

        if (Vector3.Distance(nextPosition, this.transform.position) < 0.01f)
        {
            isMoving = false;
            becomingEight = false;
            eightAnimator.SetBool("isMoving", false);
        }
    }

    if(becomingLine)
    {
        this.transform.position = Vector3.MoveTowards(this.transform.position, startPosition, Time.deltaTime * 10);

        if (Vector3.Distance(this.transform.position, startPosition) < 0.01f)
        {
            isMoving = false;
            isLine = true;
            becomingLine = false;
            eightAnimator.SetBool("isMoving", false);
        }
    }

}

I am adding here unity package, video, screen shot and my simple code.

So how can I play my animation when I pressed the button with the exact frame and exact time without delay

This is the project unitypackage file

sentences: How do i draw a ray in unity So i am trying to scrap together something for vr in which the locomotion is about the player holding the direction where he wants to go to(basically planning what he is going to do)while holding down the button a ray is beeing drawn and when the player lets go the character moves until he reaches the end of the ray i tried looking up something but couldnt find anything regarding something like this

sentences:
How to define type-specific scripts when using a 'type object' programming pattern? I am in the process of creating a game engine written in C++, using the C/C++ SQLite interface to achieve a 'type object' pattern. The process is largely similar to what is outlined here (Thank you Bob Nystrom for the great resource!).

I have a generally defined Entity class that when a new object is created, data is taken from a SQLite database and then is pushed back into a pointer vector, which is then iterated through, calling update() for each object. All the ints, floats, strings are loaded in fine, but the script() member of Entity is proving an issue. It's not much fun having a bunch of stationary objects laying around my gameworld.

The only solutions I've come up with so far are:

Create a monolithic EntityScript class with member functions encompassing all game AI and then calling the corresponding script when iterating through the Entity vector. (Not ideal)
Create bindings between C++ and a scripting language.

This would seem to get the job done, but it feels like implementing this (given the potential memory overhead) and learning a new language is overkill for a small team (2-3 people) that know the entirety of the existing game engine.

Can you suggest any possible alternatives? My ideal situation would be that to add content to the game, one would simply add a script file to the appropriate directory and append the SQLite database with all the object data. All that is required is to have a variety of integers and floats passed between both the engine and the script file.

sentences:
Camera and enemy behaviour in AS3 platformer beginner in AS3 here. I am working on a platformer game based on the code of a provided example exercise. I have the following problem:

I have an enemy who shoots bullets. The enemy is the parent, and the bullet are the child. When I move to the next scene (level), the bullets are still there, but invisible, even using the removeEventListener to shut down the bullet hit check.

Here is the code of the child "disparoEnemigo_mov":

addEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
function fl_MoveEnemyShot(event: Event) {
try {
    if (enemy_shot.y < 300) {
        if (enemy_shot.hitTestObject(Object(this.parent).mario)) {

            variablesGlobales.variables().vidas -= 1;
            Object(root).texto.text =
variablesGlobales.variables().vidas.toString();
            trace("vidas: " + variablesGlobales.variables().vidas);
            if (variablesGlobales.variables().vidas < 1) {
                MovieClip(this.parent).gotoAndStop(2);
            }
            this.parent.removeChild(this);
            removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        } else {
            enemy_shot.y += 3;
        }
    } else {
        trace("LLEGADA");
        removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
        this.parent.removeChild(this);
    }
} catch (error: Error) {
    removeEventListener(Event.ENTER_FRAME, fl_MoveEnemyShot);
}
}

import flash.events.Event;
import flash.media.SoundMixer;

addEventListener(Event.ENTER_FRAME, fl_EnterFrameHandler);

function fl_EnterFrameHandler(event: Event): void {
try{
if (this.hitTestObject(Object(this.parent).mario)) {

    SoundMixer.stopAll();
    var sound:gameOver = new gameOver();
    sound.play();
    Object(this.parent).mario.y=1000;
    Object(this.parent).mario.x-=15;
    trace("Mario dies");
    var cartel:StageLose = new StageLose();
    stage.addChild(cartel);
    cartel.x = -85;
    Object(this.parent).mario.y = 1000;
    }
}catch(error: Error){
removeEventListener (Event.ENTER_FRAME, fl_EnterFrameHandler);
}
}

And this is the code of the parent, "enemigo_mov":

var leftPressed: Boolean = true;
var rightPressed: Boolean = false;
stage.addEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
function fl_MoveEnemy(event: Event) {
try{
if (leftPressed) {
    enemy1.x -= 0;
    if (enemy1.x < -120) {
        leftPressed = false;
        rightPressed = true;
    }
} else if (rightPressed) {
    enemy1.x += 1;
    if (enemy1.x > 120) {
        rightPressed = false;
        leftPressed = true;
    }
}
var number: Number = Math.random();
if (number < 0.05){// &&
variablesGlobales.variables().coleccionEnemigos.indexOf(this) != -1) {
    trace("creation");
    var disparo: disparoEnemigo_mov = new disparoEnemigo_mov();
    this.parent.addChild(disparo);
    disparo.x=enemy1.x +115;
    disparo.y=enemy1.y +115;

    //disparo.z=50;
    trace(disparo.x + " " + disparo.y);
    }

}catch(error:Error){
removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy);
}
}

In both codes, "mario" is the player character.

What I need to do is to stop the bullet creation of ""disparoEnemigo_mov" when we move to the next scene. Shouldn't the "removeEventListener(Event.ENTER_FRAME, fl_MoveEnemy)" line stop the bullets to check if there is any collision with the player?

Any help or resource will be helpful. Thank you so much!

sentences:
Writing a server for a multiplayer game I've been looking on the internet, but I can't really find any good answers to all my questions..

I started to think about writing a little multiplayer game on my own and after thinking and thinking and thinking about how I should begin I came to the conclusion, that implementing the network communication part at first wouldn't be a bad idea since the testing part becomes "easier".

So my first question is:

Is there any library that would make my life easier if I wanted to write the server part in C++?

I just don't know how one would implement the communication between server and client. Imagine a game that is made up of blocks (like minecraft if you want) but the client should only receive a tiny part of that map. So my question at this one is: Would you send raw byte data? Or would you use more abstract formats like XML? Let us assume that this should work with "many" clients as well..

And here is another thing..

Would one use either a single thread that collects all connections and sends requests to specific worker threads or would you create a new thread for every single connection that is established to the server?

sentences:
Cubemaps turn black OpenGL GLSL Java LWJGL Recently I tried to add cubemaps to my 3D-rendering engine. The objects with a cubemap now turn completely black.
This is how I load my cubemap:

public static int loadCubeMap(String filename)
{
    int id = GL11.glGenTextures();

    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, id);

    for(int i = 0; i < CUBEMAP_NAMES.length; i++)
    {
        TextureData data = decodeTextureFile(CUBEMAPS_LOCATION + filename + "/" + CUBEMAP_NAMES[i]);
        GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, data.getBuffer());
    }
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    return id;
}

TextureData class only contains: int width, height and a ByteBuffer buffer

private static TextureData decodeTextureFile(String fileName)
{
    int width = 0;
    int height = 0;
    ByteBuffer buffer = null;
    try
    {
        FileInputStream in = new FileInputStream(TEXTURES_LOCATION + fileName + ".png");
        PNGDecoder decoder = new PNGDecoder(in);
        width = decoder.getWidth();
        height = decoder.getHeight();
        buffer = ByteBuffer.allocateDirect(4 * width * height);
        decoder.decode(buffer, width * 4, Format.RGBA);
        buffer.flip();
        in.close();
    } catch (Exception e)
    {
        e.printStackTrace();
    }
    return new TextureData(width, height, buffer);
}

This is how I load the cubemap to the samplerCube cubemap[i] in the fragment shader:

public void loadCubeMap(int id, CubeMap cubemap, int cubemapid)
{
    if(cubemap != null)
    {
        super.loadTexture(location_cubemaps[cubemapid], cubemap.id, id, GL13.GL_TEXTURE_CUBE_MAP);
        super.loadFloat(location_cubemap_intensity[id], cubemap.intensity);
    }else
    {
        super.loadFloat(location_cubemap_intensity[id], 0.0f);
    }
}

in super class:

protected void loadTexture(int location, int texture, int i, int texturetype)
{
    loadInt(location, i+1);
    GL13.glActiveTexture(GL13.GL_TEXTURE0 + i);
    GL11.glBindTexture(texturetype, texture);
}

And this is my fragment shader:

#version 400 core

  in vec4 color;
  in vec2 texCoord0;
  in vec3 surface_normal;
  in vec3 to_light_vector;
  in vec3 world_position_out;
  out vec4 out_Color;

  uniform sampler2D sampler0;

  uniform samplerCube cubemap[3];

  uniform vec3 lightColor;

  uniform float cubemap_intensity[3];

  uniform int hasTexture;

  void main(void)
   {
      vec3 unitNormal = normalize(surface_normal);
   vec3 unitLight  = normalize(to_light_vector);

   float nDot1 = dot(unitNormal, unitLight);
   float brightness = max(nDot1, 0.02);

   vec3 diffuse = color.xyz * brightness * lightColor * color.xyz;
   vec4 textureColor = texture(sampler0, texCoord0.xy);
   if(textureColor.a < 0.5)
       discard;
   vec4 shadedTextureColor = brightness * vec4(lightColor, 1) * textureColor;
    vec4 coloredShadedTexture = mix(vec4(diffuse, 1), shadedTextureColor, textureColor.a * hasTexture);

   vec4 reflectionColor = texture(cubemap[0], world_position_out);
   vec4 refractionColor;
   vec4 cubemapColor;

   out_Color = reflectionColor;
  }

sentences:
How to compile a Rasterizer Stage HLSL file How can I compile the below HLSL file.
Im using
fxc "RS.hlsl" /Od /Zi /E "RS" /Fo "C:\dir\RS.cso"
I am getting error
error X3501: 'RS': entrypoint not found
compilation failed; no code produced
#define RS \
"RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT | " \
"DENY_HULL_SHADER_ROOT_ACCESS | " \
"DENY_GEOMETRY_SHADER_ROOT_ACCESS), " \
"DescriptorTable(CBV(b0), visibility = SHADER_VISIBILITY_VERTEX), " \
"CBV(b1, visibility = SHADER_VISIBILITY_VERTEX), " \
"CBV(b2, visibility = SHADER_VISIBILITY_VERTEX), " \
"CBV(b0, visibility = SHADER_VISIBILITY_DOMAIN), " \
"CBV(b1, visibility = SHADER_VISIBILITY_DOMAIN), " \
"DescriptorTable(SRV(t0), visibility = SHADER_VISIBILITY_DOMAIN), " \
"CBV(b1, visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t0), visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t1), visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t2), visibility = SHADER_VISIBILITY_PIXEL), " \
"DescriptorTable(SRV(t3), visibility = SHADER_VISIBILITY_PIXEL), " \
"StaticSampler(s0, filter=FILTER_ANISOTROPIC)"

sentences:
What is the approach of creating an image puzzle game with libgdx I would like to create a game which consists of taking a random image, slicing it up into some number of pieces (according to a selected difficulty) and letting the player solve the puzzle.

I've googled this, but didn't find anything relevant that would at least help me understand how this kind of games are to be approached. I did come across this article Custom Sprite Batcher in LibGDX, but it is not complete and is rather confusing to me for now.

Any suggestions are much appreciated.
Thanks.

sentences:
Is there a game oriented graphics or image editor? I remember looking a few times over the years for an alternative to Photoshop for editing images. I've tried using Gimp too, and that's also not quite sufficient. There are some problems that have only been solvable by breaking out into an asset compiling stage. For example, none of the graphics packages come with premultiplied alpha options, and none come boxed with previews of what the image will look like once it's been compressed for hardware. I've never come across a package that lets you modify the diffuse, specular, ambient and normal maps all at the same time with the same tools.

Is there an image manipulation package out there that can satisfy things like this, allow for textures that have more than just 4 channels, export with preview to final format, maybe even rendering them in some coherent way?

items on the wishlist include:

batch conversion
scriptable pixel shader/transform
view diffuse+alpha over a background / allow alpha2coverage preview
render depth mapping via height or normal map
show mip-maps and allow editing them

sentences:
Problems with texture orientation in space I am currently drawing texture in 3D space and have some problems with it's orientation.

I'd like me textures always to be oriented with front face to user.

My desirable result looks like

Note, that text size stay without changes when we rotating world and stay oriented with front face to user.

Now I can draw text in 3D space, but it is not oriented  with front but rotating with world.

Such results I got with following shaders:

Vertex Shader

uniform vec3 Position;

void main()
{
    gl_Position = vec4(Position, 1.0);
}

Geometry Shader

layout(points) in;
layout(triangle_strip, max_vertices = 4) out;

out vec2 fsTextureCoordinates;

uniform mat4 projectionMatrix;
uniform mat4 modelViewMatrix;
uniform sampler2D og_texture0;
uniform float og_highResolutionSnapScale;
uniform vec2 u_originScale;

void main()
{
    vec2 halfSize = vec2(textureSize(og_texture0, 0)) * 0.5 * og_highResolutionSnapScale;
    vec4 center = gl_in[0].gl_Position;
    center.xy += (u_originScale * halfSize);

    vec4 v0 = vec4(center.xy - halfSize, center.z, 1.0);
    vec4 v1 = vec4(center.xy + vec2(halfSize.x, -halfSize.y), center.z, 1.0);
    vec4 v2 = vec4(center.xy + vec2(-halfSize.x, halfSize.y), center.z, 1.0);
    vec4 v3 = vec4(center.xy + halfSize, center.z, 1.0);

    gl_Position =  projectionMatrix * modelViewMatrix   * v0;
    fsTextureCoordinates = vec2(0.0, 0.0);
    EmitVertex();

    gl_Position =  projectionMatrix * modelViewMatrix   * v1;
    fsTextureCoordinates = vec2(1.0, 0.0);
    EmitVertex();

    gl_Position =  projectionMatrix * modelViewMatrix   * v2;
    fsTextureCoordinates = vec2(0.0, 1.0);
    EmitVertex();

    gl_Position =  projectionMatrix * modelViewMatrix  * v3;
    fsTextureCoordinates = vec2(1.0, 1.0);
    EmitVertex();
}

Fragment Shader

in vec2 fsTextureCoordinates;

out vec4 fragmentColor;

uniform sampler2D og_texture0;
uniform vec3 u_color;

void main()
{
    vec4 color = texture(og_texture0, fsTextureCoordinates);

    if (color.a == 0.0)
    {
        discard;
    }
    fragmentColor = vec4(color.rgb * u_color.rgb, color.a);
}

Any ideas how to get my desirable result?

EDIT 1:

I make edit in my geometry shader and got part of lable drawn on screen at corner. But it is not rotating.

..........

    vec4 centerProjected = projectionMatrix * modelViewMatrix * center;
    centerProjected /= centerProjected.w;

    vec4 v0 = vec4(centerProjected.xy - halfSize, 0.0, 1.0);
    vec4 v1 = vec4(centerProjected.xy + vec2(halfSize.x, -halfSize.y), 0.0, 1.0);
    vec4 v2 = vec4(centerProjected.xy + vec2(-halfSize.x, halfSize.y), 0.0, 1.0);
    vec4 v3 = vec4(centerProjected.xy + halfSize, 0.0, 1.0);

    gl_Position =  og_viewportOrthographicMatrix * v0;

..........

sentences:
Does interleaving in VBOs speed up performance when using VAOs You usually get a speed up when you use interleaved VBOs instead of using multiple VBOs. Is this also valid when using VAOs?

Because it's much more convenient to have a VBO for the positions, and one for the normals etc. And you can use one VBO in multiple VAOs.

sentences:
Performance problems with quadtree for dynamic objects I´ve implemented a quadtree spatial partitioning to my game engine as I wanted to try it and see how it affects the performance checks. The results were great (instead of hundreds collision checks only for cursor I was suddenly having just about 10%), however I faced performance problems (not caused by the number of collision checks but by the spatial structure itself [or my implementation]) :

1. At first I was inserting items every frame and at the end of the frame the quadtree was cleared and so on. I realised this slowed down the performance more than 2-3 times.

2. Of cource the next step was to try to make the quadtree dynamic by not clearing it but by checking the moving objects from the quadtree. However this process is also not trivial as I can have a multiple nodes containing the same object (if it doesnt fit to any of the children I "broadcast" and check neighbour nodes so it can be visible in more than 1 node) and I ended up by digging through the entire quadtree again.

How did you solve these problems with the quadtrees? I´ve read that some of the engines use multiple spatial structures to divide work for static/dynamic objects, I would use quadtree for static structure but what would be suitable for dynamic? Also I think I "hurt" myself when I want to make as generic solution as possible so I dont have to change the spatial structures of my game engine no matter what type of game I´m creating with it at the time.

sentences:
Understanding CGPoints in SpriteKit I am planning to place three cards on a view which I add to the background. However I wanted to combine two of the cards and replace the first card position with the new card position. Is there any way I can do this?

I am trying to read the selected node position by:

CGPoint position = CGPointMake([self nodeAtPoint:touchLocation].position.x, [self nodeAtPoint:touchLocation].position.y);

However what I read is (0,0).

What happened?

sentences:
C++ OOP Implementation of a game I've been recently trying to get into Object Oriented Programming by porting a game I've made in C to C++. The problem is, even though my implementation works, I don't know if is the best approach.

The game is a tower defense, which contain 3 main elements: Tiles, Enemies and Towers. Each of the three elements have a "engine" class, which manipulates and allocates the individual objects. For example:

Tiles:

Class Tile
{
  private:
  int  posX, posY;
  bool visible;

  public:
  void DrawItself();

};

Class TileEngine
{
  private:
  Tile tileArray[m][n];

  public:
  int GetTileXPosition(int m, int n);
  int GetTileYPosition(int m, int n);
  void DrawArray();
};

Enemies:

Class Enemy
{
  private:
  int  posX, posY;
  bool health;

  public:
  void DrawItself();
  void MoveItself();

};

Class EnemyEngine
{
  private:
  Enemy enemyArray[m][n]

  public:
  void DrawArray();
  void MoveArray();
};

TileEngine and EnemyEngine are then instantiated on a Game class, and their public methods are then called on a loop:

Loop()
{
  TileEngine TileEngine;
  EnemyEngine EnemyEngine;
  /*FPS controlling routine omitted*/
  while(1)
  {
    EnemyEngine.Movement();

    TileEngine.DrawArray();
    EnemyEngine.DrawArray()
  }

}

The problem is that the EnemyEngine.Movement() method requires information from the TileArray, of which it doesn't have access. My temporary solution has been giving the EnemyEngine class a pointer to the TileEngine class:

void Loop()
{
  TileEngine TileEngine;
  EnemyEngine EnemyEngine;

  EnemyEngine.pTileEngine = &TileEngine;

  while(1)
  {
    /*...*/
  }

}

But doesn't that defeat the purpose of object oriented programming?
Is there a better approach to get information between the "engine" classes? Or is the Element -> ElementEngine -> Gameloop implementation flawed altogether?

sentences:
How do I create a prefabs when a button is clicked(Unity) So I want to be able to spawn prefabs when a button is pressed
Shop script -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shop : MonoBehaviour
{
    public static string Item01;
    public static string Item02;
    public static string Item03;
    public static string Item04;

    public static int ShopNum;
    // Update is called once per frame
    void Update()
    {
        if(ShopNum == 1) {
            Item01 = "Cannon";
            Item02 = "Tower";
            Item03 = "army Camp";
            Item04 = "Baracks";
        }
        if(ShopNum == 2) {
            Item01 = "Archer";
            Item02 = "Barbarian";
            Item03 = "Goblin";
            Item04 = "Wizard";
        }
    }
}

And then my Shop Access script -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Shop01Access : MonoBehaviour
{
    public GameObject ShopInventory;
    public GameObject Item01Text;
    public GameObject Item02Text;
    public GameObject Item03Text;
    public GameObject Item04Text;
    public GameObject ItemCompletion;
    public GameObject CompleteText;

    void OnTriggerEnter() {
        ShopInventory.SetActive(true);
        Screen.lockCursor = false;
        Shop.ShopNum = 1;
        Item01Text.GetComponent<Text>().text = "" + Shop.Item01;
        Item02Text.GetComponent<Text>().text = "" + Shop.Item02;
        Item03Text.GetComponent<Text>().text = "" + Shop.Item03;
        Item04Text.GetComponent<Text>().text = "" + Shop.Item04;
    }

    public void Item01(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item01 + "?";
    }
    public void Item02(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item02 + "?";
    }
    public void Item03(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item03 + "?";
    }
    public void Item04(){
        ItemCompletion.SetActive(true);
        CompleteText.GetComponent<Text>().text = "Are you sure you want to buy" + Shop.Item04 + "?";
    }

    public void Cancel(){
        ItemCompletion.SetActive(false);

    }
}

How could I spawn a cannon when button item01 is pressed into my 3d scene

sentences:
Java simple dust cleaner game simulator I am working on a dust cleaner simulator on Java, in this case the shape of the cleaner is a circular ball.
The program is quite simple, the user puts in the width and length of the "room" and coordinates x and y.
What I want to do and cannot is create a series of commands, each represented by a character. There are three commands that I want to implement:

char 'A' = Move forward 1 meter

char 'L' = Turn left 90 degrees

char 'R' = Turn right 90 degrees

Example of user input AALA, in this case the expected output is that the machine moves 2 meters and then turns left 90 degrees and then moves 1 meter again. Hope I am clear.
As you can see in the code, I have tried to create an array of chars but I don't know what the next step should be...
The code:
public class Cleaner extends JPanel {
/* int lx = 1, ly = 1;
int x = 200, y = 250;

*/
int x, y;
int width = 52, height = 50; // width and height of the "dust sucker"
int lx , ly;

// an array of chars
char[] charArray ={ 'A', 'L', 'R'};

java.util.Timer move; // making the instance of Timer class from the util package
static JFrame frame;

Cleaner()
{

    frame = new JFrame ("Cleaner started!"); // passing attributes to our fame
    frame.setSize (400, 400); // setting size of the starting window
    frame.setVisible (true);

    setForeground(Color.black); // setting color

    move = new java.util.Timer();

    move.scheduleAtFixedRate(new TimerTask()
    {

        public void run()
        {
            if(x<0)
                lx = 1;
            if(x>=getWidth()-45)
                lx = -1; // -1 sets boundry for the dusk sucker
            if(y<0)
                ly = 1;
            if(y>=getHeight()-45)
                ly = -1; // -1 sets boundry for the dusk sucker

            x+=lx; // to make the machine move
            y+=ly;

            repaint();
        }

    }, 0, 5// speed of the machine
            );

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

}

public void paint (Graphics g)
{
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.fillOval(x, y, width, height);
}

public static void main (String[] args)
{
    // lx value

    String lxValue =
             JOptionPane.showInputDialog( "Enter lx" );
    // ly value
    String lyValue =
              JOptionPane.showInputDialog( "Enter ly" );

    String xValue =
             JOptionPane.showInputDialog( "Enter x value" );
    // ly value
    String yValue =
              JOptionPane.showInputDialog( "Enter y value" );

     // convert String inputs to int values
      int firstInput = Integer.parseInt( lxValue );
      int secondInput = Integer.parseInt( lyValue );
      int thirdInput = Integer.parseInt( xValue );
      int forthInput = Integer.parseInt( yValue );

         Cleaner cleaner = new Cleaner();

            frame.add(cleaner);
      cleaner.lx = firstInput;
      cleaner.ly = secondInput;
      cleaner.x = thirdInput;
      cleaner.y = forthInput;

}

}

All help is appreciated!

sentences:
How do I raycast for a spherical harmonic shader using the iOS GPU? I am beginning an Spherical Harmonics shader project for an iOS app I am writing. I have begun by reading this excellent in-depth paper on the subject.

The paper describes a scene pre-processing step that involves ray-casting (one bounce, shadow feeler). Can someone describe how ray-casting can be performed using GLSL on iOS?

sentences:
Should an actor know its position (or map should know it) In a tile-based game (in this case MMO), should an actor (e.g., player) know its position, or should only the map know its position?

If an actor is placed on a grid map, it is placed on a specific position (x, y) and assigned to a cell in the map. Now, should I also store the actor's position inside the actor's data structure? It would allow to check the actor's position easily (just check it's data) but at the same time, I duplicate the same information in two places which is bad and could introduce a whole spectrum of bugs (e.g., if those two pieces of data are inconsistent)

sentences:
Synchronize running code over the network Unity I want my code to run/perform the same on different Unity clients. I don't know if this is hard to achieve.
Here hare my problems:

The enemies movement:
I have a pathfinding that should always give the same results on server and on clients. Because I use the same pathfinding algorithm on server and client, and the position the algorithm chooses is synchronized with a network transform. But it does not give the same results on client and on server.

Bullets make enemies die over all clients:
I have a script with OnTriggerEnter2D(Collider2D collision) that never gets called at the same moment on clients and server. The clients might miss touching a bullet on an enemy on server but not on a client. So in server enemies died and on client they have not. How to synchronize OnTriggerEnter2D() ?

I will update the question to improve it with more examples when I find them.

sentences:
Unity-UI not scaling correctly on android My UI appears extremely small when i build and launch my game on my android device. Im working with unity 4.6. I've tried changing the UI scale mode of my canvas to all 3 types. Scale with screen size option and constant physical size option makes it too big. Constant pixel size makes it too small.
With constant pixel size this is what it looks like on my mobile:

I could increase the scale factor but then it looks like this on PC. Also, I don't think it would look right on a tablet then.

sentences:
ParticleEffectPool.obtain() not resetting particles I want to use ParticleEffectPools in libGDX but I'm running into an odd issue where the effects don't seem to be reset when obtained by the pool. The code below looks for an existing ParticleEffectPool for the named effect, creates one if necessary, and then obtains a particle effect for the newly created Actor. The particle effect should be reset in the obtain function (if you look at the source it does so). What happens is the first effect works as expected but every subsequent one flashes very briefly on the screen as if its run out of duration.

public class ParticleEffectActor extends Actor {

    private static final Map<String, ParticleEffectPool> ParticlePools = new HashMap<>();
    private final PooledEffect effect;

    public ParticleEffectActor(String effectName, float rotation) {
        if(!ParticlePools.containsKey(effectName)) {
            ParticleEffect particleEffect = new ParticleEffect();
            particleEffect.load(Gdx.files.internal("resources/particles/" + effectName + ".p"), Images.Atlas);
            ParticlePools.put(effectName, new ParticleEffectPool(particleEffect, 10, 50));
        }

        this.effect = ParticlePools.get(effectName).obtain();

        rotation -= 90f;
        for(ParticleEmitter emitter : effect.getEmitters()) {
            emitter.reset();
            ParticleEmitter.ScaledNumericValue angle = emitter.getAngle();
            angle.setLow(rotation - 35, rotation + 35);
            angle.setHigh(rotation - 35, rotation + 35);
        }
    }

    @Override
    public void draw (SpriteBatch batch, float parentAlpha) {
        effect.draw(batch);
    }

    @Override
    public void act (float delta) {
        super.act(delta);
        effect.setPosition(getX(), getY());
        effect.update(delta);
    }

    @Override
    public boolean remove() {
        effect.free();
        return super.remove();
    }
}

sentences: Moving a tiled map in a jframe I rendered a tiled map, with the help of slick2d, in my JFrame in Java. I can move my main character, but it is just that the character itself moves. I would like to do it that, if the player moves, the map moves and the player himself stays in middle of the frame. Do you have any suggestions on how to do that ?

sentences:
Workaround to losing the OpenGL context when Android pauses? The Android documentation says:

  There are situations where the EGL
  rendering context will be lost. This
  typically happens when device wakes up
  after going to sleep. When the EGL
  context is lost, all OpenGL resources
  (such as textures) that are associated
  with that context will be
  automatically deleted. In order to
  keep rendering correctly, a renderer
  must recreate any lost resources that
  it still needs. The
  onSurfaceCreated(GL10, EGLConfig)
  method is a convenient place to do
  this.

But having to reload all the textures in the OpenGL context is both a pain and hurts the game experience for the user when reentering the app after a pause. I know that "Angry Birds" somehow avoids this, I'm looking for suggestions on how to accomplish the same?

I'm working with the Android NDK r5 (CrystaX version.) I did find this possible hack to the problem but I'm trying to avoid building an entire custom SDK version.

sentences:
Find angle (slope) of collision plane? I have implemented a collision and response system based on the famous "Improved Collision detection and Response" paper. However I'm having an issue with objects sliding backwards on slopes. I believe I could circumvent this issue if I understood how to find the angle of the plane of which my object is colliding with. Take the below screenshot as an example of the situation:

I know the following data:

Position of player object (the ellipsoid at the bottom of the ramp)
Vertices of the collision triangle
Normal of the collision triangle
Intersection point between player object and collision triangle
Penetration distance between player object and collision triangle

How can I use this information to determine the angle of the collision triangle?

sentences:
Unity Extending Game Object best practice What is best practice when wanting to add to GameObject class?

I would like all GameObject to be able to change color IF they have a renderer.
Ive tried using a helper class that takes a GameObject and lerps the color value but if i want it to have an update method it must inherit MonoBehaviour, and if it does inherit it then i cant instanciate that helper class.

Now im thinking about creating a new class that manages a GameObject and inherits from Monobehavoiur. It would have one GameObject as a member that it can manipulate. But then i would have to instanciate it from somewhere.

Hmmm unity has its logic but i havent found it yet. Is it clear what i am having problems with? Otherwise please ask.

sentences:
When to use pygame.sprite.GroupSingle? I'm doing a game in which i have a ball which is controlled by the keyboard and the goal is to get is out of a maze without touching the walls.

I've added my ball sprite to GroupSprite

vehicle = pygame.sprite.GroupSingle(Vehicle(70,470))

since at the time, i thought that was the right way of doing it. However, i found that all the interaction always goes with the sprite directlly not with the GroupSingle. So I end with constantly accessing the sprite throug the GroupSingle.sprite:

vehicle.sprite.desired_speed_up_down

Is there a reason why i shouldn't just remove 'GroupSingle' and define:

vehicle = Vehicle(70,470)

sentences:
Render character in bounding box i'm rendering an attack animation with the following code:

currentFrame = attackAnimation[3].getKeyFrame(stateTime, false); //3 : left, 2: right
batch.draw(currentFrame, getX(), getY());

This renders the CurrentFrame on the x and y position of the character. This works fine for the right animation as you can see here:

but when i apply the same code for left for example it doesn't draw the character on the correct place and like "pushes himself away" from the bottom left corner and leaving the bounding box.

What am I doing wrong or what am I not seeing?

setGameObject(new Sprite(txtIdle[2]));
setSize(getWidth(), getHeight());
setOrigin(getWidth() /2.0f, getHeight() /2.0f);
setPosition(500, 500);

this code sets an idle image and the size of the bounding box (and the sprite)

sentences:
InvalidOperationException in build only, when trying to select object in a dynamically loaded scene using Linq Here is the relevant code:

private void Awake()
{
    StartCoroutine(LoadScenes());
}

private IEnumerator LoadScenes()
{
    this.sceneLoad1 = SceneManager.LoadSceneAsync(Scene1, LoadSceneMode.Additive);

    while (!this.sceneLoad.isDone)
    {
        Debug.Log("Loading scene 1...");
        yield return null;
    }

    this.sceneLoad2 = SceneManager.LoadSceneAsync(Scene2, LoadSceneMode.Additive);

    while (!this.sceneLoad.isDone)
    {
        Debug.Log("Loading scene 2...");
        yield return null;
    }
}

private void Start()
{
    SceneManager.GetSceneByName(Scene1)
                .GetRootGameObjects()
                .Where(root => root.GetComponent<God>() != null)
                .Select(root => root.GetComponent<God>())
                .Single()
                .SpreadGospel();
}

(Scene1 and Scene2 are const strings.)

The program works fine when running in the Unity editor. However, when I make a development build, I see the follow error message:

    InvalidOperationException: Operation is not valid due to the current state of the object
  at System.Linq.Enumerable.Single[God] (IEnumerable`1 source) [0x00057] in /Users/builduser/buildslave/mono/build/mcs/class/System.Core/System.Linq/Enumerable.cs:1968
  at MySolution.GodInitializer.SpreadGospel () [0x00001] in D:\repos\MySolution\SourceCode\SourceCode\GodInitializer.cs:100
  at MySolution.GodInitializer.Start () [0x00012] in D:\repos\MySolution\SourceCode\SourceCode\GodInitializer.cs:77

... which indicates that the scene wasn't fully loaded before I tried to access the God singleton.

What changes should I make to fix the problem?

sentences: Unity Google VR SDK Main Camera showing Game Objects Behind Left and Right Cameras I'm trying to get a basic VR app up and running on iOS with the Unity Google VR SDK and I've run into a strange issue where my game objects are appearing behind the left and right camera views in cardboard view. In the HeadsetDemo app that is provided along with the SDK, there's just a black background but in my app that background is the default grey-blue skybox color and renders any game objects that I have in my scene. Does anyone know how to hide game objects from that main camera?

sentences: How realistic are procedural textures in sandbox? I'm working with Unreal and want to make a Minecraft-Style Block-Sandbox with HD-textures. Since at that resolution the repetitive pattern becomes too noticable, I'd like the game to generate the textures on the fly, based on coordinates, so the blocks have a seamless appearance, and distance to player, so further away blocks have a lower resolution. I'd love something between Rust and Grounded, Quality-wise, so it will include PBR, SSS, and height maps. I've got a fairly powerful PC, but since the CPU will have to constantly generate textures, which all would have to be stored inside the RAM, I was wondering how realistic something like that would be in the first place. And how I could save resources, things like reducing the quality in the shadows or so on. Thanks in advance.

sentences:
Is a recursive game object update better than a linear one? I have a tree of gameobjects, so every node contains a list of children.
In update function:
Is it better to do recursive or linear walking through game objects.

update() {
    update self;
    foreach child call update;//recursive call
}

or

array of children = root.getAllChildrenRecursive
foreach child in array of children call update; //linear walking through gameobjects.

sentences:
Difference between two perspective projection representations When researching perspective projections on the web, I've come across two different representations. One is unrelated to OpenGL and the other is strictly associated with it.

What is the relation of these two projections? Both are called the same but the matrices are quite different. The first one seems to project unto the xy plane (z=0), the OpenGL one to the z=near plane.

sentences:
What legal matters do I need to consider when releasing an MMO? Let's say I've finished programming an indie MMO game similiar to Tibia. I've got:

a stable server application ready to launch;
a tested, bug-free, working client application ready to play;
the game's official website (ready to host), with a payment system and freely downloadable game client.

No matter how impossible it sounds, let's also assume none of these break copyright laws.

My game divides accounts into free and premium groups. Premium accounts can access all game features, requiring server authorisation to work properly. Let's say that the "premium account" can be bought on the website for a fixed monthly rate. Free accounts can play for free, but with limited access. This is what the mentioned payment system will be for. If I've correctly understood, this is the freemium model.

I'm completely novice to business entity issues, so
in short: what steps, in legal terms, do I have to take from here so my game can legally earn me money? For example, is there something like verification that the game gives the user what it actually offers when paying on its website?

If relevant, I live in Europe.

sentences:
Texture is black when manually building mipmap I am trying to manually build a mipmap from a series of images. For the sake of brevity, let's assume the file containing the images I want (from 256x256 to 32x32) have paths file_1...4.

What I do to load the texture is:

GLuint textureID;
glGenTextures(1,&textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 4);

for i from 1 to 4
    unsigned char* image =  stbi_load_from_file(file_i, &width, &height, &comp, 3);
    glTexImage2D(GL_TEXTURE_2D, (i-1), GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
    stbi_free_image(image);

When I go and try to use this created texture in a render all I got is a black result. Using singularly each texture works properly, so I excluded they're malformed. What can it be?

sentences:
Tile based game data structure I've been working on a top down 2d game and the character moves freely around the map, like zelda link to the past.

How would you model the data structure for such a game in order to implement pathfinding, astar, etc.

As far I understood one could go with this approach:

Tile {
 sprite,
 walkable,
 position,
}

Board {
  width
  height
  tiles: Tile[]
}

In a board of 5x5 there will be a sprite rendered for each tile. But here comes the problem:

The player is at position (+1,+1). Now it moves to the right side (+2,+1). This will mean that the player is moved immediately from one tile to another. So, we could make the player move pixel by pixel. How would you translate this back to the grid position?

If player moves pixel by pixel (using floating point instead of integers) and is at position (1.5,1),doest it means we need a separated data to store player position and later on round its current position (1.5, 1) to find its current cell in the grid?

I'm kind lost in this subject, i would love if you could share some thoughts on it, articles, videos, books, etc.

Thanks!

sentences:
Models keep turning white - Unity 5.3.5p1 I'm using Unit 5.3.5p1 but for some reason my models randomly turn white after I build an exe to run outside the editor.

The textures work perfectly fine within the editor, but as soon as I build and run outside - they sometimes show with appropriate colour, but many times do not and end up blank white.

Does anyone know what might be causing this in general? I've downloaded the latest unity shaders and replaced all current shaders. Currently I'm using the Standard shader only, and it is 100% unmodified.

sentences:
Object orbiting a 3d sphere I'm developing in libgdx java/android but not using any high-level environment like Unity.

I have a sphere at [0,0,0], with a PerspectiveCamera looking at it. Through the main game loop I have managed to have the camera orbiting the sphere in different directions. However, what I want to do is have a stationary camera and have 3 objects orbiting the sphere on their own accord, and their own orbital plane. Have been looking all day and struggled to get this working.

Eventually, I want to link the camera to always be above one of the orbitting objects, but that's at a later stage.

I also want to be able to have these objects orbitting on their own "forwards" direction, but able to change their direction over time. Say, from their top-down view, they each have a heading 0-359 degrees.

Anyone lend a hand with this? I've tried using 2D X/Y maps transposing onto mercator projections and then converted to spherical coordinates; I've tried Vector3 and setFromSpherical(); I've tried looking at Quaternions, and just got lost.

It's a relatively simple thing I'm trying to do, multiple orbiting objects around a sphere (radius 3, origin [0,0,0]), but just getting my initial approach wrong.

EDIT:

After talking the situation through, I have two options:  I either keep track of the orbiting objects with theta/phi as to their position around the sphere, or just calculate the amount by which to rotate based on the object's direction (0-359). On further talks with DMGregory, the latter option would introduce orbital instability/divergence with roudning errors so I have decided to change my requirement to the following:

Keep track of the object's position based on 2x360 degree values for  azimuth and polar, called theta and phi. The two coordinates are used to locate the object at any point in orbit around the sphere, but I need to be able to still "move" the orbital object "forwards" and thus change theta/phi accordingly, allowing the direction to still be changed.

Many thanks,

sentences: Pixel Art size for different resolutions What size I should make the UI elements (mostly buttons). How do pixel graphics look good on all resolutions? How would I get to know what size I need the buttons or other pixel graphics overall?

sentences:
Spriterenderer on top of canvases I have two canvases. One with a background image and one with all overlaying elements like texts and such.

The background canvas has an order of 0, the overlay canvas of 1.

Now, I'd like to create an animating sprite on top of those canvases but I can't for the life of me get the sprite on top of the other images.

I can see the sprite being on top on the stage, but when I switch to gameview, it's gone! There are no scripts attached to the sprite. Only an animator(Which works fine when I play it).

Note:

My canvases have a render mode of
Screen space - Overlay.
I've set the spriterenderer on
Sorting Layer 9, order 300. Although
it's  the only sprite out there.
layer 1 or order 1 didn't do anything
different, though.
The other elements in the canvases are either UI texts or Images
All the elements in the canvases are on either BackgroundLayer or OverlayLayer
The canvases themselves are on the UI layer

sentences:
Why do I get a jitter/stutter when moving and following a target? I am using the script below to move a transform to quickly follow a target (the player), and come to a stop close to the player.
When I move the player around, the transform is following the player, keeping the 1.5 distance.
To ensure the transform can keep up with the player, I set the moveSpeed to 5, But when I do that, the transform jitters/stutters when moving.
If I set the moveSpeed to 1 for example, the transform will move smoothly but will not keep up with the player - the player has to stop moving and wait for it to catch up. But increasing the speed makes the stutter return.
Why is this stutter happening, and how can I make the movement smooth?
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class Follow : MonoBehaviour
{
    public Transform targetToFollow;
    public Text text;
    public Text text1;
    public float lookAtRotationSpeed;
    public float moveSpeed;

    private float minMoveSpeed = 0f;
    private Vector3 originPos;

    // Start is called before the first frame update
    void Start()
    {
        originPos = targetToFollow.position;
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 lTargetDir = targetToFollow.position - transform.position;
        lTargetDir.y = 0.0f;
        transform.rotation = Quaternion.RotateTowards(transform.rotation,
            Quaternion.LookRotation(lTargetDir), Time.time * lookAtRotationSpeed);

        var distance = Vector3.Distance(transform.position, targetToFollow.position);

        text.text = "Transform Distance From Target " + distance.ToString();

        float ms = moveSpeed;

        if (distance > 5f)
        {
            ms = moveSpeed + 0.5f;
        }
        else if (distance < 1.5f)
        {
            ms = Mathf.Max(minMoveSpeed, ms - 0.3f);
        }
        else
        {
            //transform.position = Vector3.MoveTowards(transform.position, targetToFollow.position, Time.deltaTime * ms);
        }

        if (distance < 0.5f && originPos == targetToFollow.position)
        {
            ms = 0f;
        }

        if (distance > 1.5f)
            transform.position = Vector3.MoveTowards(transform.position, targetToFollow.position, Time.deltaTime * ms);

        originPos = targetToFollow.position;
    }
}

sentences:
Would a company take a game pitch seriously if they were pitched a fully finished game? Let's say hypothetically that I had a fully realized and functioning game using a well known IP (a character from Nintendo or from another company, for instance), where the game is finished and wouldn't have any development time, would they entertain the idea to release it?

It would be made with their characters so I would have no right to it (in the case of money) but would they entertain the idea if they found it good and fresh.?

I have seen answers to this question saying a definite no for they were presented an idea of a game and not a completed product. And I know most people would want compensation for there time, but if it's already done and bug tested, play tested and polished, would they entertain the idea if they found they wouldn't have much to do on their end and I would not seek any rights to the design?

sentences:
Best way to store game-wide variables I have an options screen for things like difficulty, resolution, full-screen, etc., but I'm struggling to find the "best" way to store/obtain these variables at run-time.

Currently, I've implemented a Constants class which contains all the GameOption enums, but how do I choose a default for all of these options? Also, how do I get the currently selected enum?

Regarding the resolution, specifically, I've decided to store the values, but I'm unsure of how to get the default, or currently stored, values. Any direction would be great; thanks! :)

namespace V1.test.RPG
{
  public class GameOptions
  {
    public enum Difficulty { EASY, MEDIUM, HARD }
    public enum Sound { ON, QUIET, OFF }
    public enum Music { ON, QUIET, OFF }
    public enum ResolutionWidth
    {
        SMALL      = 1280,
        MEDIUM     = 1366,
        LARGE      = 1920,
        WIDESCREEN = 2560
    }
    public enum ResolutionHeight
    {
        SMALL      = 800,
        MEDIUM     = 768,
        LARGE      = 1080,
        WIDESCREEN = 1080
    }
    public Boolean fullScreen = false;
  }
}

NB: I asked over at SO and they pointed me to this place. There is a comment there but I'd like to hear different ways of doing it / the most used ways.

sentences:
How can I randomly generate arbitrary "rules" for a creative card game My friends and I in school play this interesting card game, which we call 'the game without rules' (ironically, of course). The game is like this: in the beginning of a school year, we start with one rule: you have to lay a card that is higher. Everything else is not allowed and the one who is the first to have no more cards, wins.

When only one person remains with cards, the game ends. At that point, the winner can define a new rule, such as "on a seven, you have to play a lower card instead of a higher card". This makes the game harder and harder as we play on. Every time a person breaks a rule, he/she is given an extra card.

Now my idea was to make a computer program out of this and let them create new rules, so that would be pretty funny to see what combinations they come up with. Every time a 'computer' defines a new rule, they don't tell the others, so they have to figure out by trial and error.

Well at this point I am stuck. How can I let the computer define new rules and can someone write an example for me? And in what language should I do it?

sentences:
Collision, triggering, and range detection in an RTS. What are the optimal solutions for unit spatial awareness? I've finally ran into the problem of multiple triggers and collisions within my 2D RTS. Up till now I've been using unities sphere colliders as a way of simulating spatial awareness. To trigger when objects have entered and exited a specific area around a unit or building so that they can be appropriately targeted.

This became a performance problem when I started having hundreds of colldiers overlapping each other. Since the units are aware of projectiles as well as other units/buildings, this becomes very expensive very fast. I've found that I can only manage to have a couple hundred projectiles and about 100 colliders within close proximity of each other before the game slows to a crawl just from PhysX. (hundreds of projectiles entering and exiting 100 collliders all the time)

I did some research and found spatial partitioning mentioned all over the place. Is this a solution to the problem I am currently presented with? Are there other solutions for objects to have spatial awareness of potentially hundreds of other objects at a time without bringing my CPU to it's knees?

sentences:
How can I make diamonds disappear after collision in LIBGDX I'm creating a Java game similar to Mario Bros. I'm using Tiled Map Editor to put diamonds inside my game, so my character can collect these diamonds. But, I have a problem. I can't make the diamonds disappear after collision.

This is my code that I've used to remove the diamonds:

public TiledMapTileLayer.Cell getCell(){
    TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(8);
    return layer.getCell((int) (body.getPosition().x * MainGame.PPM / 64),
            (int) (body.getPosition().y * MainGame.PPM / 64))
}

This is my code that I have used for collision:

  if ("HARRY".equals(f1.getUserData()) && "COINS".equals(f2.getUserData())) {
        System.out.println("coins");
        if (f2.getUserData() instanceof Treasure) {
            System.out.println("Works");
            treasure.getCell().setTile(null);
  }

this if-statement doesn't work ( if (f2.getUserData() instanceof Treasure) )
If I use the code without this statement, just the first diamond that I've put it inside Tiled Map disappeared.

Can anyone help me please?

sentences:
Using a Compute Shader in Unity to convert a texture to a float array I have a fairly simple requirement for a compute shader (DirectCompute through Unity). I have a 128x128 texture and I'd like to turn the red channel of that texture into a 1d array of floats. I need to do this very often so just doing a cpu-side for loop over each texel won't cut it.

Initialization:

    m_outputBuffer = new ComputeBuffer(m_renderTexture.width * m_renderTexture.height, sizeof(float));
    m_kernelIndex = m_computeShader.FindKernel("CSMain");

Here is the C# method:

/// <summary>
/// This method converts the red channel of the given RenderTexture to a
/// one dimensional array of floats of size width * height.
/// </summary>
private float[] ConvertToFloatArray(RenderTexture renderTexture)
{
    m_computeShader.SetTexture(m_kernelIndex, INPUT_TEXTURE, renderTexture);

    float[] result = new float[renderTexture.width * renderTexture.height];

    m_outputBuffer.SetData(result);
    m_computeShader.SetBuffer(m_kernelIndex, OUTPUT_BUFFER, m_outputBuffer);

    m_computeShader.Dispatch(m_kernelIndex, renderTexture.width / 8, renderTexture.height / 8, 1);

    m_outputBuffer.GetData(result);

    return result;
}

and the entire compute shader:

// Each #kernel tells which function to compile; you can have many kernels
#pragma kernel CSMain

// Create a RenderTexture with enableRandomWrite flag and set it
// with cs.SetTexture
Texture2D<float4> InputTexture;
RWBuffer<float> OutputBuffer;

[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
    OutputBuffer[id.x * id.y] = InputTexture[id.xy].r;
}

the C# method returns an array of the expected size, and it usually sort-of-corresponds to what I expect. However, even if my input texture is uniformly red, there'll still be some zeroes.

sentences:
Trouble with SAT style vector projection in C#/XNA Simply put I'm having a hard time working out how to work with XNA's Vector2 types while maintaining spatial considerations. I'm working with separating axis theorem and trying to project vectors onto an arbitrary axis to check if those projections overlap, but the severe lack of XNA-specific help online combined with pseudo code everywhere that omits key parts of the algorithm, googling has left me little help.

I'm aware of HOW to project a vector, but the way that I know of doing it involves the two vectors starting from the same point. Particularly here:

http://www.metanetsoftware.com/technique/tutorialA.html

So let's say I have a simple rectangle, and I store each of its corners in a list of Vector2s. How would I go about projecting that onto an arbitrary axis? The crux of my problem is that taking the dot product of say, a vector2 of (1, 0) and a vector2 of (50, 50) won't get me the dot product I'm looking for.. or will it? Because that (50, 50) won't be the vector of the polygon's vertex but from whatever XNA calculates. It's getting the calculation from the right starting point that's throwing me off.

I'm sorry if this is unclear, but my brain is fried from trying to think about this. I need a better understanding of how XNA calculates Vector2s as actual vectors and not just as random points.

sentences:
How can I make a rectangle to an irregular shape? I used masking for breaking an image into the below pattern. Now that it's broken into different pieces I need to make a rectangle of each piece. I need to drag the broken pieces and adjust to the correct position so I can reconstruct the image. To drag and put at the right position I need to make the pieces rectangles but I am not getting the idea of how to make rectangles out of these irregular shapes. How can I make rectangles for manipulating these pieces?

This is a follow up to my previous question.

sentences:
XBOX + Xna != DirectX? I'm a bit confused. The question is: when I'm developing a XNA game for Xbox (or Windows), is it possible to use DirectX (to make use of the GPU)? Or is everything getting calculated by the CPU?

A quick Google search didn't gave any results of combining those two...

sentences:
How to remove or disable an extension asset in Unity 2020 I've been running Unity 2020.1 on Ubuntu 19.04 without any problems for a while now. Today, I installed the VSCode extension asset and now Unity just crashes during startup. I choose my project from Unity Hub, the splash screen and progress bar pops up, and then everything just shuts down.
I've already submitted a crash report but I'd rather just revert the extension entirely so I can get working again. I've tried deleting the files from disk but Unity just downloads them again during startup.
How can I either remove or disable the VSCode extension completely without starting Unity?

sentences:
How can I modify the GUI of a default Unity window? How can I modify the GUI of a default Unity window?
E.g. I am trying to modify the Animation window. Here is what I am trying to do for the beginning:
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(Animation))]
public class AnimationExtended : Editor
{
    public override void OnInspectorGUI()
    {

    }
}

I would expect the code above to hide the content of the Animation window completely, but it does not. Why?
Here is what I mean by the Animation window.

Question which made me want to add a custom feature to the Animation tab.

sentences:
SharpDX / DirectX: How to render text to a transparent BitmapRenderTarget? I'm trying to render text to a BitmapRenderTarget, cleared with transparent color.

My TextBox is drawn on its own SharpDX.Direct2D1.BitmapRenderTarget, which I create in this way:

var bitmapRenderTarget = new SharpDX.Direct2D1.BitmapRenderTarget(renderTarget,
    SharpDX.Direct2D1.CompatibleRenderTargetOptions.None, null, null, null);

As you can see, I don't change the pixel format of BitmapRenderTarget. The pixel format of underlying SharpDX.Direct2D1.RenderTarget, on which I draw my TextBox through DrawBitmap method, is defined in the following code:

renderTargetProperties = new SharpDX.Direct2D1.RenderTargetProperties()
{
    PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown,
    SharpDX.Direct2D1.AlphaMode.Premultiplied)
};

Here is the code, that produces visual results:

// In the case 1: opaque white background
bitmapRenderTarget.Clear(SharpDX.Color.White);
...

// In the case 2: white background with 50% transparency
bitmapRenderTarget.Clear(new SharpDX.Color4(1f, 1f, 1f, 0.5f));
...

// In the case 3: fully transparent background
bitmapRenderTarget.Clear(SharpDX.Color.Transparent);
...

// The color of textBrush in all these cases is the same solid Black.
bitmapRenderTarget.DrawTextLayout(vector, textLayout, textBrush, ...);

The results:

As you can see, alpha value of the text color is somehow bound to the one in the clear color. The black line around the text is cursor, and it is drawn as it should.

How to fix this issue?

sentences:
Unity - Bullet spawns in wrong position in client I am making a multiplayer game with prefab shooting, but unfortunately the prefab  sometimes spawns in the wrong position when I shoot from a client. The bullet tends to spawn in a location where the player was a few miliseconds ago, making that the bullet sometimes spawns inside of the player which killing the player in the process.

For shooting, I currently have this code setup to instantiate the bullet

void Update() {
    if (Input.GetMouseButtonDown(0)) {
        float angle = GetComponentInChildren<Weapon>().angle;
        CmdShootBullet(angle);
        rigidbody.AddForce(Quaternion.AngleAxis(angle + 180, Vector3.forward) * Vector3.right * (bulletPrefab.GetComponent<Bullet>().force / 7.5f));
    }
}

[Command]
void CmdShootBullet (float angle) {
    GameObject bullet = Instantiate(bulletPrefab, firePoint.position, Quaternion.identity);
    Bullet bulletScript = bullet.GetComponent<Bullet>();
    bulletScript.shotBy = gameObject;
    bullet.GetComponent<Rigidbody>().AddForce(Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.right * bulletScript.force);
    NetworkServer.Spawn(bullet);
}

And this is the setup for the location of the player and the gun. The top one is the player, the bottom is the gun.

My guess is that it has to do with lag, that the player position does not update soon enough, so how would I make it that the bullet spawns in the position of the player in the client rather than the position of the player in the host?

sentences:
Calculating vertex normals in OpenGL C++ Does anyone knows a simple solution for calculating vertex normals? I've been looking for this on the internet but i cant find a simple solution, for example, if I have some vertices like this:

GLfloat vertices[] =
{
 0.5f,  0.5f, 0.0f,  // Top Right
 0.5f, -0.5f, 0.0f,  // Bottom Right
-0.5f, -0.5f, 0.0f,  // Bottom Left
-0.5f,  0.5f, 0.0f   // Top Left
};

sentences:
Creating the concept of Time So I've reached the point in my exploration of gaming where I'd like to implement the concept of time into my little demo I've been building.

What are some common methodologies for creating the concept of time passing within a game?

My thoughts so far:

My game loop tends to spend a fair amount of time sitting around waiting for user input so any time system will likely need to be run in a separate thread.

What I've currently done is create a BackgroundWorker passing in a method that contains a loop triggering every second. This is working fine and I can output information to the console from here, etc. Inside this loop I have a DateTime object that is incremented by 1 minute for every realtime second. (the game begins in the year 01/01/01)

Is this a standard way of achieving this result or are there more tried and tested methods?

I'm also curious about how to go about performing time based actions (reducing player energy, moving entities around the game board, life/death etc).

Thanks for any pointers or advice. I've searched around, however I'm not familiar enough with the terms and so my searches are yielding little result on this one.

sentences:
Constructing a building in the "Past" scene, and finding a different version of it in the "Future" scene I am trying to create a game where one scene would be the "Past" and one scene would be the "Future". The player can travel through a portal to move between the past and future scenes.
In the past scene, the player makes a wooden house and in the future scene it will be turned into something else.
There can be multiple instances of these buildings in different places in the scene.
So far, I've tried...

Using DontDestroyOnLoad to carry the object through from the past to future when loading between scenes.

Using singletons to avoid duplicating the object multiple times when loading back and forth.
But that has a problem: using singletons causes restricts me to just one instance of the building per scene, and I want to have several.

The reason why I wouldn't want to unload the old object when the scene unloads is because I wanted the player to be able to build in any area available within the scene. Something like the Fallout 4 building mechanics, where you can build in certain areas and keep those buildings, but I want it to become a different prefab in the future scene.
How can I implement a feature like this?

sentences:
Speed after an angled collision? I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle.

Physics paramaters:

Player Physics :
    radius : 15,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass : 2
    damping : 0.96101

Ball Physics :
    radius : 8,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass: 1,
    damping : 0.9902

Gif image(angled): haxball gif angled

Player speed on start: Vx: 5, Vy: 0

Ball speed on start: Vx: 0, Vy: 0

Player speed on collision: Vx: 3.4189778846153844, Vy: -0.9240480769230772

Ball speed on collision: Vx: 2.7721442307692317, Vy: 1.8480961538461544

The formula i use(this formula can calculate the speed when there is no angle):
Formula image: Formula image

V1 = (m1*u1*k1 + m2*u2*k2 + m2*C1*C2*(u2*k2 - u1*k1)) /(m1 + m2)
V2 = (m1*u1*k1 + m2*u2*k2 + m1*C1*C2*(u1*k1 - u2*k2)) /(m1 + m2)

C1 and C2 bounce coefficient of player and ball.

How can i do?

sentences:
Design constraints for games that the elderly (65+) get engaged with I'm a newbie in game design and gaming in general (Tetris, board games, this sort of things). But have observed that the elderly got very much engaged with bubble shooter and solitaires (quite different approaches). I've tried to look for something similar, and have tried to initiate some in these games, but nope, the shooter is always preferred.

Does anybody know of general criteria, design constraints, or (even better) concrete examples of games that the elderly like to play, apart from these two?

Note: agreed, not correctly tagged, but can't find something that fit, nor can I propose new ones.

sentences:
Set up UnityEvent in script with string method name? I'm making a game that I'd like to be data driven. I've got a designer that can make levels using unity and saving them as a unity scene. What we're doing is exporting those levels as XML and loading them from a website into a single scene. This allows for rapid prototyping on devices; the designer does not need to wait for me to push builds out or push his own out.

Many of the scripts on the prefabs we're loading use UnityEvents, so I can allow my designer to trigger anything he wants in a given script. It gives him more freedom to design and stops my scripts from being too specific.

Currently, I'm reducing these UnityEvents down to the object they are referencing and the function they are calling and storing them as string attributes in the XML. However, I'm unsure how to convert from the string function name into an actual function pointer for the UnityEvent, nor do I know how to set up a UnityEvent the way the inspector allows me to. See here you can attach an object and select a function to trigger, then simply call Invoke() on the UnityEvent, but the only documentation I can find on UnityEvent scripting only allows you to add listeners with methods within the script.

Here I am getting the Type from a string and the MethodInfo from a string, but am unsure of how to set up the UnityEvent with this information

Type type = Type.GetType("ScriptName");
MethodInfo theMethod = type.GetMethod("FunctionName");
UnityEvent myEvent = new UnityEvent();
myEvent.AddListener(); //Reference to Method goes here
//reference to the script goes where?

sentences:
How to change transform.position code to Rigidbody.AddForce? Vector2 vec = new Vector2(horizontal, vertical);
        vec = Vector2.ClampMagnitude(vec, 1);

        Vector3 camF = cam.transform.forward;
        Vector3 camR = cam.transform.right;

        camF.y = 0;
        camR.y = 0;
        camF = camF.normalized;
        camR = camR.normalized;

        transform.position += (camF * vec.y + camR * vec.x) * Time.deltaTime * MoveSpeed;

That's how i do my movement, but i need to change it to Rigidbody.AddForce 'cause the way that i use right now makes my character doesn't collide with objects perfectly.

Note: What i mean with "perfectly" is, if you walk to the corner of walls, you can pass through it and that's the thing that i want to prevent.

sentences:
Change shadervalues for different Meshes in Three.js Hey I am writing a Shader for Three.js.

My goal is to have multiple objects with the same shader and each object should have a color set on the object that is then given to the shader. The goal is to have multiple "units" (think of an RTS game) each with the team color.

I red through a couple of documentation pages and am not really sure how to handle that. I looked into https://threejs.org/docs/#api/materials/ShaderMaterial.

I have tried:

changing a uniform but from my limited knowledge and trial and
error I came to the conclusion that I can not change a uniform value
during a drawcycle.
change the uniform in onBeforeRender which gave me an error that v
was not defined

I am not sure how to go on now. In the ShaderMaterial Documentation is written:

  You're recommended to update custom Uniform values depending on object and camera in Object3D.onBeforeRender because Material can be shared among meshes, matrixWorld of Scene and Camera are updated in WebGLRenderer.render, and some effects(ex:VREffect) render a scene with private their own cameras.

So did I just change the values wrong and it actually works with a uniform that changes? In this Github issue someone wanted to draw meshes in different colors and got suggested to create different materials for each mesh (https://github.com/mrdoob/three.js/issues/1532). But that would kill the idea of having one shader per unit regardless of the team.

sentences:
Camera rotation - First Person Camera using GLM I've just switched from deprecated opengl functions to using shaders and GLM math library and i'm having a few problems setting up my camera rotations (first person camera). I'll show what i've got setup so far.

I'm setting up my ViewMatrix using the glm::lookAt function which takes an eye position, target and up vector

// arbitrary pos and target values
pos = glm::vec3(0.0f, 0.0f, 10.0f);
target = glm::vec3(0.0f, 0.0f, 0.0f);
up = glm::vec3(0.0f, 1.0f, 0.0f);

m_view = glm::lookAt(pos, target, up);

i'm using glm::perspective for my projection and the model matrix is just identity

m_projection = glm::perspective(m_fov, m_aspectRatio, m_near, m_far);

model = glm::mat4(1.0);

I send the MVP matrix to my shader to multiply the vertex position

glm::mat4 MVP = camera->getProjection() * camera->getView() * model;
// in shader
gl_Position = MVP * vec4(vertexPos, 1.0);

My camera class has standard rotate and translate functions which call glm::rotate and glm::translate respectively

void camera::rotate(float amount, glm::vec3 axis)
{
    m_view = glm::rotate(m_view, amount, axis);
}
void camera::translate(glm::vec3 dir)
{
    m_view = glm::translate(m_view, dir);
}

and i usually just use the mouse delta position as the amount for rotation

Now normally in my previous opengl applications i'd just setup the yaw and pitch angles and have a sin and cos to change the direction vector using (gluLookAt) but i'd like to be able to do this using GLM and matrices.

So at the moment i have my camera set 10 units away from the origin facing that direction. I can see my geometry fine, it renders perfectly. When i use my rotation function...

camera->rotate(mouseDeltaX, glm::vec3(0, 1, 0));

What i want is for me to look to the right and left (like i would with manipulating the lookAt vector with gluLookAt) but what's happening is
It just rotates the model i'm looking at around the origin, like im just doing a full circle around it. Because i've translated my view matrix, shouldn't i need to translate it to the centre, do the rotation then translate back away for it to be rotating around the origin? Also, i've tried using the rotate function around the x axis to get pitch working, but as soon as i rotate the model about 90 degrees, it starts to roll instead of pitch (gimbal lock?).

Thanks for your help guys,

and if i've not explained it well, basically i'm trying to get a first person camera working with matrix multiplication and rotating my view matrix is just rotating the model around the origin.

sentences:
Rotating a Quad around it center How can you rotate a quad around its center?

This is what I am trying to do but it is not working:

    GL11.glTranslatef(x-getWidth()/2, y-getHeight()/2, 0);
    GL11.glRotatef(30, 0.0f, 0.0f, 1.0f);
    GL11.glTranslatef(x+getWidth()/2, y+getHeight()/2, 0);
        DRAW

my main problem is that it renders it off the screen..

draw code:

    GL11.glBegin(GL11.GL_QUADS);
    {
        GL11.glTexCoord2f(0, 0);
        GL11.glVertex2f(0, 0);
        GL11.glTexCoord2f(0, getTexture().getHeight());
        GL11.glVertex2f(0, height);
        GL11.glTexCoord2f(getTexture().getWidth(), getTexture().getHeight());
        GL11.glVertex2f(width,height);
        GL11.glTexCoord2f(getTexture().getWidth(), 0);
        GL11.glVertex2f(width,0);
    }
    GL11.glEnd();

sentences:
World position into local position I want to understand how I can convert world position of an object into local position. Especially how to deal with a rotation of objects.
I'm testing transform.InverseTransform(...) methods. When parent and child has 0 rotation, this methods easily convert world into local position. I don't know how to deal with a situation, when one of the objects has not zero rotation.
In the example below my parent object has (0,0,10) position and (0,0,0) rotation. Child position (0,0,0) and rotation (90,0,0).
        Debug.Log (string.Format ("World position: {0}\nLocalPosition: {1}\nInverseTransformPoint: {2}\nInverseTransformVector: {3}\nInverseTransformDirection: {4}\nTransformPoint: {5}\nTransformVector: {6}\nTransformDirection: {7}",
        transform.position.ToString (),
        transform.localPosition.ToString (),
        transform.InverseTransformPoint (transform.position).ToString (),
        transform.InverseTransformVector (transform.position).ToString (),
        transform.InverseTransformDirection (transform.position).ToString (),
        transform.TransformPoint (transform.localPosition).ToString (),
        transform.TransformVector (transform.localPosition).ToString (),
        transform.TransformDirection (transform.localPosition).ToString ()));

The example debug result:
World position: (-1.0, -0.7, 10.0)
LocalPosition: (-1.0, -0.7, 0.0)
InverseTransformPoint: (0.0, 0.0, 0.0)
InverseTransformVector: (-1.0, 10.0, 0.7)
InverseTransformDirection: (-1.0, 10.0, 0.7)
TransformPoint: (-2.1, -0.7, 9.3)
TransformVector: (-1.0, 0.0, -0.7)
TransformDirection: (-1.0, 0.0, -0.7)

What should I add to transform.InverseTransformPoint (transform.position) to get transform.localPosition?

sentences:
Why does applying force to a game object apply force to children, as well? I have a script on my player to move.  I do not have root motion applied because, root motion does not work perfectly so I'm manually adding velocity to the player.

The player is holding a ball and the ball is a child of the player.  However, when I apply force to the player it seems to apply force to the ball so he stops holding it and it is just floating around instead.

My player and my ball both have rigidBodies and I'm applying force like this.

    var velocityX = horizontal * HorizontalSpeed * Time.deltaTime;
    var velocityZ = vertical * VerticalSpeed * Time.deltaTime;

    rigidBody.velocity = new Vector3(velocityX, 0f, velocityZ);

I know as a hack I can apply a late update to the ball, but I'd rather understand what is going on.

Can anyone help me figure this out?

sentences:
XNA 2D Camera, zoom into player My 2D camera follows the character fine without any zooming. However, when I tried adding a zoom feature using the Matrix.CreateScale(), the camera no longer follows the character properly.

public class Camera
{
    private Matrix transform;

    public Matrix Transform
    {
        get { return transform; }
        set { value = transform; }
    }

    public Viewport view;
    public  Vector2 center;
    float zoom;
    float rotation;
    public float Zoom{
        get{return zoom;}
        set { value = zoom; }
    }

    public Camera(Viewport newView)
    {
        view = newView;
        zoom = 2;
        rotation = 0;
    }

    public void Update(Vector2 position, int xOffset, int yOffset)
    {

        if (position.X < view.Width / 2)
            center.X = view.Width / 2;
        else if (position.X > xOffset - (view.Width / 2))
            center.X = xOffset - (view.Width / 2);
        else center.X = position.X;

        if (position.Y < view.Height / 2)
            center.Y = view.Height / 2;
        else if (position.Y > yOffset - (view.Height / 2))
            center.Y = yOffset - (view.Height / 2);
        else center.Y = position.Y;

        transform = Matrix.CreateTranslation(
            new Vector3(-center.X + (view.Width / 2), -center.Y + (view.Height / 2), 0)) *
            Matrix.CreateScale(Zoom, Zoom, 1.0f) * Matrix.CreateRotationZ(rotation) *
            Matrix.CreateTranslation(-center.X + (view.Width / 2), -center.Y + (view.Height / 2), 0);

    }
}

The camera is updated with:

camera.Update(character.Position, map.Width, map.Height);

With the width and height of the tilemap and the characters current position.
If I change the zoom factor how do i keep the player still in the center w/ the camera following?

sentences:
What features should a 2D graphics library have? I am making a 2D graphics library in Python designed to make 2D easy and fast. Internally it uses OpenGL. The library does cover a bit more then a graphics library, it also includes windowing and sound (and all necessary features to get working, like texture loading).

I've got a good beginning working with good performance, and I'd like to expand and refine my feature set.

Now I'm wondering, what features should a 2D graphics library have? After some brainstorming I made a little list:

Fast sprite class for displaying rotated, scaled, colored and translated textures
Sprite batching
Drawing geometry: lines, polygons, circles, etc
Alpha with blending modes on all of the above
Easy texture loading (from file and memory)
Texture regions (and texture atlases)
Blitting texture(regions) into other textures
Particle systems
Off-screen rendering surfaces (FBO's?)

But I feel I have only scratched the surface of features. What am I missing?

One thing you must keep in mind that all of this in Python with C extensions. Any work in the library is fast, any work the user must do is relatively much slower. In addition to that Python calls are quite expensive, so the library largely benefits from batching.

(In case anyone cares, the library in question is pygrafix and can be found here: http://github.com/nightcracker/pygrafix)

sentences:
How do I know what button was clicked? (Unity) I have a prefabbed button (UI.Button) which I'm instantiating ten times:

public void LayoutButtons() {

    GameObject newCanvas = Instantiate (canvas) as GameObject;

    for (int i = 0; i < 10; i++) {
        buttons[i] = Instantiate(button, new Vector2((i * 100.0F)-500, -100), Quaternion.identity) as GameObject;
        buttons[i].transform.SetParent(newCanvas.transform, false);
        buttons[i].GetComponentInChildren<Text>().text = "Button " + i;
    }
}

However, I'm now stuck when trying to figure out which button was clicked. The Unity onClick seems to only allow zero or one parameters. I've tried using public void onClick(Button button) with button.getComponentInChildren<Text>().text but I get ArgumentException: failed to convert parameters

All I want to do is print out the clicked button's text. How can I do this?

sentences:
Unity Canvas blocking objects in Editor I think I am missing something really basic here..., I'm creating a 2D game in unity, and the UI Canvas (with the setting "Screen Space - Overlay") is blocking exactly a quarter of my workspace. I can not select any objects on the top right part of the screen.

Is there any fix to this?, or do I have to move the camera down half of the screen?

Thanks

sentences:
GLSL Shader compiles, but source is empty I'm trying to compile a GLSL shader, to which I use the following code.

Initialization

SDL_Window* boringInitStuff(){
    SDL_Init(SDL_INIT_VIDEO);
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 1 );
    SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );

    Uint32 windowFlags = SDL_WINDOW_OPENGL;
    SDL_Window* sdlWindow = SDL_CreateWindow("Boooring", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 400, 400, windowFlags);

    SDL_GL_CreateContext(sdlWindow);

    glewExperimental = GL_TRUE;
    glewInit();

    return sdlWindow;
}

File parser

void readFile(std::string path, std::string& data){
    std::ifstream f(path.c_str(), std::ios::binary);
    data.assign((std::istreambuf_iterator<char>(f)),
                (std::istreambuf_iterator<char>()));
}

Main

int main(int argv, char** args) {
    SDL_Window* sdlWindow = boringInitStuff();

    std::string buffer;
    readFile("./compile_test.vert", buffer);
    const char* cBuffer = buffer.c_str();

    GLuint shaderID = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(shaderID, 1, &cBuffer, nullptr);
    glCompileShader(shaderID);

    while(!SDL_QuitRequested()){
        SDL_GL_SwapWindow(sdlWindow);
    }

    return 0;
}

But when I try to inspect the source code in gDEBugger, the source code is gone. Linking of course doesn't work aswell. The weird thing is, that the compilation error checking works.
EDIT: When I copy & paste the main part into another opengl project, it works.

sentences:
Calculate the rest length of a box2d distance joint Given the length of a distance joint along with its frequency and the mass of the bodies involved, is it possible to determine the final rest length?
I'm only interested in the vertical axis if that makes the formula simpler.

E.g. Imagine the simple case of a dynamic body of mass=1 sitting vertically atop another similar body and attached via a distance joint with length=1 and frequency=1 and gravity=10.
What would the rest length be? I.e. What would the final distance be between those two bodies?

I'm currently just trial and error fudging the frequency values I need in my game but I really need a formula to compute this as every time I change the masses, I have to re-fudge everything.

Thanks.

sentences:
How does ads actually make you money when you upload a Game? I am an independent game developer and I have made my own game. I want to upload it on the Play store and I understand that you need to pay $25. But there's something I don't understand in terms earning money. I have look on websites and some websites say for every 1000 views on an ad, you get $0.10 but on another, it says every view you get $0.10.

I don't understand the system of earning money when it comes to putting ads in your game. I understand its a bit of a stupid question but it will help when i upload my game for real.

sentences:
How to diagnose the problem when the input assembler and the vertex shader look correrct, but the Output Merger is wrong? I'm porting some OpenGL code to Direct X 11.  I ended up with nothing being drawn on the screen. I reverted to a simple program, which I am writing about here.

I'm now trying to use the Graphics Tools in Visual Studio to diagnose a very simple "Hello Triangle" program.  In my program, I am drawing simple geometry and using a basic shader.  The shader just outputs a constant color.

float4 ps_main(VS_OUTPUT Input) : SV_TARGET
{
    return float4(0.2f, 0.2f, 0.2f, 1.0f);
}

However, the Output Merger shows nothing.

(LOOK CLOSELY)

When I click on the output merger, I see a green alpha checkerboard.

What I would like to know ultimately, is what I'm doing wrong. (Why is the output merger basically blank?)  Additionally, I'd like to learn some skill in reading outputs like this:

This is the contents of basic.hlsl

cbuffer cbTransform : register( b0 )
{
    matrix matWorldViewProj;
};

struct VS_INPUT
{
    float3 Position     : POSITION0;
    float2 TexCoord     : TEXCOORD0;
    float3 Normal       : NORMAL;
    float4 Color        : TEXCOORD1;
};

struct VS_OUTPUT
{
    float4 Position     : SV_POSITION;
    float2 TexCoord     : TEXCOORD0;
    float3 Normal       : NORMAL;
    float4 Color        : COLOR0;
};

VS_OUTPUT vs_main( VS_INPUT Input )
{
    VS_OUTPUT Output;
    Output.Position = mul(float4(Input.Position,1), matWorldViewProj);
    Output.TexCoord = Input.TexCoord;
    Output.Normal = mul(Input.Normal, (float3x3)matWorldViewProj);
    Output.Color = Input.Color;
    return( Output );
}

float4 ps_main(VS_OUTPUT Input) : SV_TARGET
{
    return float4(0.2f, 0.2f, 0.2f, 1.0f);
}

Here's what matWorldViewProj looks like:

sentences:
How to edit WoW models with Blender? My situation is following, I am into role play, mostly me and my friends are using World of Warcraft. Since I am a bit into Blender too, I would like to try to edit some models(armor and weapon) for private use only(!). Problem is - I have no idea how to import and export them.

So far I have found only this forums.runicgames, but it looks very outdated, and I am not sure if it will work with Warlords of Dreanor extension.

How would I go about exporting the models from WoW and importing them into Blender?

sentences:
Converting time of day into a smooth day/night variable? I'm trying to make a smooth day/night cycle for a game project that I've been working on. I've already set up a clock that adds deltaTime to seconds, wraps seconds to gameMinutes, etc. The issue that I'm having is that I want a signed normalized float to represent day (+1) and night (-1), and I'm not exactly sure what the most effective way of doing that is.

Here's my time class in pseudocode:

class GameTime {

    float snDayNight; //signed normalized

    float seconds;
    int gameMinutes;
    int gameHours;
    int gameDays;
    int gameMonths;

    //Omitted consts used for wrapping (SEC_PER_MIN, HR_PER_DAY, etc.)..

    //Per-frame update..
    public void Update(){
        seconds += Timer.GetDeltaTime();
        WrapTimeValues (); //Wraps sec to min, min to hr, etc.
        UpdateDayNightCycle ();
    }

    private void UpdateDayNightCycle(){
        //?????
    }

    //...//
}

So, my GameTime has been tested and seems to be working fine; when the value in seconds is >= the value of SEC_PER_MIN it adds another minute and stores the leftover fraction of a second. It then goes on to check minutes, hours, days, etc.

I've been a little bit stuck at UpdateDayNightCycle() though. I want to be able to convert my time into a smooth decimal value where -1 represents absolute night and 1 represents absolute day. I've normalized values between 0~1 and -1~1 before, but I've never tried to use a normalized value to represent a repeating/periodic value like night~day before..

I tried drawing a simple graph where time of day is on the x-axis and daynight value is on the y-axis. What I get is essentially a graph of a triangle wave. Sadly my math skills are a little bit underdeveloped and even after looking into formulas for triangle waves, I've been having trouble implementing it in my code..

So, am I even on the right track? How can I smoothly convert my game world's time into a single decimal value between -1 and 1?

sentences:
Fast Forward Drawing using ACEdrawingView i am using this :
    https://github.com/acerbetti/ACEDrawingView
i want to  implemented one Functionality in which i want Fast drawing by clicking on a Button. i am drawing points on screen. i have got success For drawing small amount of points But when i try to draw with more points & draw them with Zero Delay then my app crashes .How can i draw for more points or say more data .!!

-(void)playVideoForDict1:(NSMutableArray*)playvideo widMul:(float)widMul1 heimul:(float)heiMul1 whichValue:(int)thisValue
{

widMul = widMul1;
heiMul = heiMul1;

[NSObject cancelPreviousPerformRequestsWithTarget:self];

for(int i = 0; i<[playvideo count]; i++)
{

    NSDictionary *dict1 = [[NSDictionary alloc] init];
    dict1  = [playvideo objectAtIndex:i];

for(int i=0; i<[playvideo count]; i++)
{

    self.currentTool = nil;

    NSDictionary *dict1 = [[NSDictionary alloc] init];
    dict1  = [playvideo objectAtIndex:i];

    if ([dict1 count]==4)
    {

        self.drawTool = ACEDrawingToolTypePen;
        self.currentTool = [self toolWithCurrentSettings];
        [self.pathArray addObject:self.currentTool];
        NSDictionary *colorDic = [dict1 objectForKey:@"colore"];
        if ([[dict1 objectForKey:@"lineWidth"] floatValue]==1) {
            self.lineWidth = 5;
        }else if ([[dict1 objectForKey:@"lineWidth"] floatValue]==2) {
            self.lineWidth = 10;
        }else if ([[dict1 objectForKey:@"lineWidth"] floatValue]==3) {
            self.lineWidth = 15;
        }else if ([[dict1 objectForKey:@"lineWidth"] floatValue]==4) {
            self.lineWidth = 30;
        }

        if ([[CCDirector sharedDirector] winSize].width==768)
        {
            self.lineWidth *=2;
        }
        self.currentTool.lineWidth = self.lineWidth;

        self.currentTool.lineColor = [UIColor colorWithRed:[[colorDic objectForKey:@"r"] floatValue] green:[[colorDic objectForKey:@"g"] floatValue] blue:[[colorDic objectForKey:@"b"] floatValue] alpha:1];

        self.currentTool.lineAlpha = 1;

        [self.currentTool setInitialPoint:currentPoint];

        currentPointArray = [dict1 objectForKey:@"points"];

        for (int i = 2; i<[currentPointArray count]; i++)
        {
            currentPoint = CGPointMake([[[currentPointArray objectAtIndex:i] objectForKey:@"x"] floatValue]*widMul, [[[currentPointArray objectAtIndex:i] objectForKey:@"y"] floatValue]*heiMul);

            previousPoint2 = CGPointMake([[[currentPointArray objectAtIndex:i-2] objectForKey:@"x"] floatValue]*widMul, [[[currentPointArray objectAtIndex:i-2] objectForKey:@"y"] floatValue]*heiMul);
            previousPoint1 = CGPointMake([[[currentPointArray objectAtIndex:i-1] objectForKey:@"x"] floatValue]*widMul, [[[currentPointArray objectAtIndex:i-1] objectForKey:@"y"] floatValue]*heiMul);
            if ([self.currentTool isKindOfClass:[ACEDrawingPenTool class]]) {
                CGRect bounds = [(ACEDrawingPenTool*)self.currentTool addPathPreviousPreviousPoint:previousPoint2 withPreviousPoint:previousPoint1 withCurrentPoint:currentPoint];
                CGRect drawBox = bounds;
                drawBox.origin.x -= self.lineWidth * 1.0;
                drawBox.origin.y -= self.lineWidth * 1.0;
                drawBox.size.width += self.lineWidth * 2.0;
                drawBox.size.height += self.lineWidth * 2.0;
                [self setNeedsDisplayInRect:drawBox];
            }
            else
            {
                [self.currentTool moveFromPoint:previousPoint1 toPoint:currentPoint];
                [self setNeedsDisplay];
            }

        }

         [self updateCacheImage:false];
    }

    else
    {
        NSNumber *check = [dict1 objectForKey:@"undo"];
        if ([check intValue]==1)
        {
            [self.pathArray removeLastObject];
        }
        else
        {
            [self.pathArray removeAllObjects];
        }
    }
    [self updateCacheImage:true];

}

}

i am stuck with this . please Help on this .. How can i achieve this .

sentences:
How can I resolve collisions a little better? I'm currently developing a physics engine and I'm not sure the best way to go about resolving my problem. I have a little box, that I can move around with in my scene.

When I'm resolving collisions, I take in the two bodies that are colliding, determine what both of their normal forces are and apply it to them (I also multiple it by a small number, if I don't I can't continue to walk around the scene).

Anyways, while I'm resolving the collision I do this:

a.Position -= a.Velocity;
b.Position -= b.Velocity;

I know this isn't a very good way to resolve the collision, but I'm just not sure how to do it correctly.

How should I go about resolve collision correctly?

Also, here is the whole method I use to resolve collision at the moment:

    private void ResolveCollision(Body a, Body b)
    {
        // Calculate normals forces (N = M * G)
        Vector2 normalForceA = this.CalculateNormalForce(a);
        Vector2 normalForceB = this.CalculateNormalForce(b);

        // Resolve collision, which is super buggy and obviously a bad idea.
        a.Position -= a.Velocity;
        b.Position -= b.Velocity;

        // Apply normal forces
        a.ApplyForce(-normalForceA * 11);
        b.ApplyForce(-normalForceB * 11);
    }

EDIT:

This is for a 2D game.

EDIT

Here is a video of what's going on when I applied TomTsagk's answer.

The video is here

sentences:
Viewport.Unproject - Checking if a model intersects a large sprite Let's say I have a sprite, drawn like this:

spriteBatch.Draw(levelCannons[i].texture, levelCannons[i].position, null, alpha, levelCannons[i].rotation, Vector2.Zero, scale, SpriteEffects.None, 0);

Picture levelCannon as being a laser beam that goes across the entire screen. I need to see if my 3d model intersects with the screen space inhabited by the sprite. I managed to dig up Viewport.Unproject, but that seems to only be useful when dealing with a single point in 2d space, rather than an area. What can I do in my case?

sentences: How to implement glDrawElementsBaseVertex in OpenGL ES 3.0 I want to convert simple OpenGL project to Android native using OpenGL ES3.0, one of the functions which is not implemented is glDrawElementsBaseVertex, I have one VBO which contains many entries inside and known each offset and size, so how can I implement this function by glDrawElements method or is there another way?

sentences: Is it necessary to call SDL_Quit() at the end of the game? Is it necessary to call SDL_Quit() at the end of the game? Doesn't C/C++ handle all the variables destruction and memory freeing at the end of a program?

sentences:
Post-Processing effects not visible with LWRP in Unity3D I'm are running into an issue when setting up Post-Processing effects for the new Lightweight render pipeline.

Post-processing effects are visible in scene and Game view, but not in Play mode.

The project is using single pass rendering for VR
We are using the LWRP 3.0.0 and the Post-Processing package 2.1.2 (both are up to date)
It seems like the Post processing volume and layer settings are working fine, as the effects are visible in scene and game view

We tried :

Tweaking the quality and graphics settings
Creating a new camera and setting the post processing settings again
Removing all additional cameras in the scene
Setting the exiting UI Canvas in the scene to Screen Space (Camera) instead of Screen Space (Overlay)

sentences: Can I use models of real cars with logos removed to avoid copyright infringement? My friends and I have recently started making a video game. We were going to make it an open world simulator, but can't figure out if using real cars with the real logos is copyright infringement. How can we stay on the right side of the law here?

sentences:
Converting DirectX 9 code to DirectX 10 Preface:

I purchased Programming an RTS in DirectX recently, and I know the code uses DirectX 9, but it has fantastic reviews and is apparently one of the best books you can get on beginning DirectX.

Question:

To my understanding, DirectX is just a means of displaying graphics to the scene. I will still have to code any games in C++ using game logic code, input, etc. Was I naive in thinking I could read the book with the MSDN tutorial site open for DirectX 10, and convert all of the samples to DirectX 10, or is that gonna be extremely difficult for me to do?
Also, is DirectX 9 still relevant, or would it really behoove me to go about converting to DX 10?

Thanks!

sentences:
How do I make a quake-style camera tilt in Unity? I want to make a retro-styled game with a modern look to it, and to do so I wish to make a quake-styled camera tilt. By that I mean when moving sideways the FPS Camera tilts a little bit, and the returns to default when letting go of the key. I have little to no scripting knowledge.

https://www.youtube.com/watch?v=scSea_v7JHA

Notice how in the video when moving to the side the camera tilts a little-bit.

sentences:
Libgdx can't read .ttf file when running Android configuration Firstly, I am aware that a similar question was asked some time ago that went unanswered. Currently, it has multiple upvotes but no answer.

The error

com.badlogic.gdx.utils.GdxRuntimeException: Error reading file: data/font/font1.ttf (Internal)
...
Caused by: java.io.FileNotFoundException: font/font1.ttf

occurs when I use the class FreeTypeFontGenerator provided by Libgdx as a extension to use freetype fonts(link). This is the line in my project that caused error:

FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("font/font1.ttf"));

I can be fairly certain that my path to the .ttf is correct, as the desktop configuration runs perfectly, showing the font as desired.

My guess: I didn't include the freetype extension when creating this libgdx project. When following the tutorial to include it (that is, adding the freetype dependencies in build.gradle), something somehow went wrong. But even this is not convincing enough.

build.gradle:

project(":desktop") {
    apply plugin: "java"

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
        compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"

    }
}

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"

    }
}

sentences:
What happens to OpenGL buffer data that isn't used? I have a vertex struct that has 5 glm::vec3 but some of my objects only use 2 or 3 of those members. So I have two questions :

1.) What happens to the large buffer I create, even though I don't use all the data.

Struct Vertex {
          glm::vec3 pos, color, UV, normal, tangent
              };
std::vector<Vertex> vertices; // will store the vertex data
glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), vertices.data(), GL_STATIC_DRAW);

That creates a buffer that is larger than needs to be. Is the additional buffer data not send?

2.) If I send empty data to the buffers, is it causing any performance issues?

glVertexPointer(2, 3 , GL_FLOAT, GL_FALSE, size of(Vertex), reinterpret_cast<GLvoid*>(Offsetof(Vertex, unusedData));

Thanks for the information!

sentences:
Super mario bros "rounded" tile collision detection I'm working on a Mario bros clone with SDL and C++ (purely for educational porpuses / and for fun)
I got collision detection working by using AABB collision detection and resolving one axis at a time:

Check collision with X-axis first
Move entity if not collision is detected
Check collision with the Y-axis.
Move entity if not collision is detected

This is working great!
However, one thing that I really like about the original Mario bros is that tiles have some kind of "rounded" feel to them. I think this helps make the map feel more organic, see how Mario moves left when jumping on a corner in the original SNES game:

I thought of using a circle collider for mario instead of an AABB.
This would make Mario "fall" off the tiles if you step too close to the edges. But perhaps someone knows a better approach. I've been thinking about collision detection for longer than I'd like to admit.
I'd love to know if someone has a clean aproach to accomplish what the GIF shows.

sentences:
Unity - Raycast not hitting to BoxCollider2D objects I'm working on 2D and I have a Quad as background.

And some wall sprites over this quad :

I'm instantiating wall prefab sprites over quad when user click to somewhere. But I don't want to instantiate a wall over another wall, so I'm sending a ray from camera to click point and if hit object is a wall object I won't instantiate.

Here my code :

RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        Physics.Raycast(ray, out hit,Mathf.Infinity);
        // If it hits ground, not another objects (like walls)
        if(hit.transform.name == "GroundQuad")
             Instantiate (wall, Input.mousePosition, Quaternion.identity)

But it's still creating wall objects. Tried Debug.Log() to print hitted object's name to console and moved pointer all over game screen, it's always GroundQuad. So ray not hitting to wall objects.

Can you tell me what is I'm missing? Is it a problem with Layer Collision Matrix ?

sentences:
Move a point to another, along an elipse according to this picture, I want to move my yellow object, smoothly to the red one. And I want to have an eliptic trajectory in relation to my center point.

So for now I'm having this code:

yellowPoint.position = Vector3.SmoothDamp(yellowPoint.position, redPoint.position, ref currentVelocity, dampingMove);

How can I change it to add the elipse, depending on a third center point ?
the itinial code can change of course.

Thanks you !

sentences: XNA GameDefaults Class Settings Are items such as the GameDifficulty enum, game settings, and other things in the GameDefaults class used for a lot? If so, is there a way to edit them or anything of the sorts?

sentences:
Quaternion rotation problems I want to rotate my model and I have X and Y rotations. Here is my code:

D3DXQUATERNION q, qrotation;

D3DXQuaternionRotationAxis(&q, &D3DXVECTOR3(1.0f, 0.0f, 0.0f), m_matrixRotX*0.0174532925f);
qrotation = q;

D3DXQuaternionRotationAxis(&q, &D3DXVECTOR3(0.0f, 1.0f, 0.0f), m_matrixRotY*0.0174532925f);
qrotation *= q;

D3DXMatrixRotationQuaternion(&worldMatrix, &qrotation);

But I get the same gimbal lock. What is the problem?

EDIT 1: OK, but how can I rotate my object if I have X Y and Z rotations?

EDIT 2: Here is all my code:

m_matrixRotY += (float)m_mouseStateX;
m_matrixRotX += (float)m_mouseStateY;
if (m_matrixRotY >= 360.0f)m_matrixRotY = 0.0f;
if (m_matrixRotX >= 360.0f)m_matrixRotX = 0.0f;

D3DXQuaternionRotationYawPitchRoll(&qrotation, m_matrixRotY*0.0174532925f, m_matrixRotX*0.0174532925f, 0.0f);

D3DXMatrixRotationQuaternion(&worldMatrix, &qrotation);

I want to rotate my object in world static XYZ axis (world orientation not
 local orientation).
Each frame I get mouse x y states and add them to total rotation. Is it wrong that I am counting total rotation and then creating the quaternion from it?

NOTE: m_mouseStateX = current_mouse_state - previous_mouse_state

sentences:
Unity - On Custom Editor Update Event The following code is a snippet of how I'm auto-updating an object whenever a setting changes in the inspector window (for a scriptable object). It's currently not working, but It will work if I put the two lines Editor editor... and editor.OnIns... inside the using block. I'm confused on why this is.
    public void DrawSettingsEditor(Object settings, System.Action onSettingsUpdate)
    {
        Editor editor = CreateEditor(settings);
        editor.OnInspectorGUI();

        using (var check = new EditorGUI.ChangeCheckScope())
        {
            if (check.changed)
            {
                onSettingsUpdate();
            }
        }
    }

See https://pastebin.com/d0NumWZv for all the code for this class.

sentences:
Why doesn't my Pygame game scroll properly? When I am clicking the arrow keys, in order to scroll my ground and my lucky block, I cant just press the key and it keeps on going scroll. So I need to press the key every second to get a kinda smooth scroll.

from os import environ
environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
import config
import spriteSheetLoader as sSL

# Some standard setup variables
scr = config.SCREEN_SIZES[:]
capt = config.CAPTION
clock = pygame.time.Clock()

# load image
sheet = pygame.image.load('img/tiles.png')
sheet = pygame.transform.scale2x(sheet)
tiles = {
    "brown-broken-wall": sSL.loadTileInfo(0, 0),
    "brown-wall": sSL.loadTileInfo(0, 1),
    "lucky-block": sSL.loadTileInfo(0, 24)
}
ground = []
tiles_pos = []
setted = False

pygame.init()

# Setting up our window
win = pygame.display.set_mode((scr[0], scr[1]))
pygame.display.set_caption(capt)

def setup_ground():
    for i in range(15, 22):
        for j in range(0, 50):
            ground.append([j * 32, i * 32, tiles["brown-broken-wall"]])
    tiles_pos.append([14*32, 10*32, tiles["lucky-block"]])
    tiles_pos.extend(ground)

def draw():
    global setted

    win.fill((62, 152, 255))
    if not setted:
        setup_ground()
        setted = True
    for i in tiles_pos:
        win.blit(sheet, (i[0], i[1]), (i[2][0], i[2][1], 32, 32))

    pygame.display.update()

while True:
    clock.tick(40)
    keys = pygame.key.get_pressed()

    draw()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()
        elif keys[pygame.K_RIGHT]:
            for i in tiles_pos:
                i[0] -= 15
        elif keys[pygame.K_LEFT]:
            for i in tiles_pos:
                i[0] += 15

sentences:
2D engine design/architecture: transformations Hello! I'm working on this hobby little 2D engine in JavaScript because I want to learn how all this things are implemented and architectured in general. Internet is full of resources but most things are mathematical or theoretical stuff, there is very little about implementation or architecture for small 2D engines like the one I'm working in. So, this is my context and at the end are some questions I hope you can help me with:

I have a Body object that has different properties like (pseudo-code):

Body {
    angle: float
    scale: float
    acceleration: 2d vector
    velocity: 2d vector
    position: 2d vector
    update: function()
}

A Body object also has a Model object, which has (pseudo-code):

Model {
    points: Array of [x, y] points
    fillColor: string (hex)
    transform: function(rotate, scale, translate)
}

The transform function receives Angle, Scale and Translate, and returns a new transformed instance of the model.

On every frame I will update the Body object to represent the current state: adding accelerator vector to velocity, velocity to location (and some similar stuff to update the angle and scale if required):

Body {
    update() {
        this.velocity.add(this.acceleration)
        this.location.add(this.velocity)
        this.acceleration.reset()
    }
}

Once the Body object is updated I must do a world-transform of the model so that I can start doing physics related stuff (like collision detection/resolving, interaction forces between bodies, etc).
After that I will do a view-transform, to transform the world-objects into the "perspective" of some other object.

At the moment this is my solution is based in keeing three instances of the Model object withing the Body object, like this:

Body {
    model: the original *Model* with no transformations
    model_world: result of *Model.transform(body.angle, body.scale, body.location)*
    model_view: the result of transforming **model_world** instance with viewport properties
}

Questions:

Do you think there is a better way to handle model transformations? Like maybe one the do not require the Body object to mantain the three instances of the three transformations itself, perhaps.
Can you please give me some suggestions on how to better organize this functionality for a simple 2D engine?

Thank you very much in advance!

sentences:
glVertexAttribPointer alters completely different shader program My program contains two shader programs in it. The following code is for preparing one of the shader program's attributes:

int positionHandle2 = glGetAttribLocation(programAColorUTranslate, "vPosition");
glEnableVertexAttribArray(positionHandle2);
glVertexAttribPointer(positionHandle2, 2, GL_FLOAT, GL_TRUE, 2 * sizeof(float), 0);
translateHandleAColorUTranslate = glGetUniformLocation(programAColorUTranslate, "vTranslate");

int aColorHandle = glGetAttribLocation(programAColorUTranslate, "aColor");
glEnableVertexAttribArray(aColorHandle);
/*glVertexAttribPointer(aColorHandle, 3, GL_FLOAT, GL_TRUE, 5 * sizeof(float), 0);*/

At this point, the program works fine, except that the vertices drawn by the above shader program are not colored, since the line above is commented out. However, if I uncomment the line above (and change the stride of position handle to 5 * sizeof(float)) to try to add colors to the above shader program's vertices, random shapes appear in my program. Supposedly, the above line should only alter triangles rendered by one of the shader programs, not both. However, every single vertex in my program is being rendered incorrectly after uncommenting the about line, to the point that the program becomes unrecognizable from before.

sentences:
Most efficient way to draw vertex with OpenGL I am writing an OpenGL 3D game.  There will be tons of triangles for terrain and objects in use.

I am studying from the OpenGL official guide and the first presented method is to call a function glVertex after the glBegin for each vertex you want to draw.

However this method sounds quite antique and inefficient when you have to draw thousands of triangles. I guess there are methods to store in the graphic card memory the information that does not change at every frame so that when you render each frame that information is already there. While for more "unstable" information probably you have to send new vertex data every frame and so a different tecnique might be more efficient.

Coming to my question: I would like a clear explanation of the most modern and efficient OpenGL functions and tecniques used to send vertex information to the hardware and to give instruction to render.

What are the best ways and OpenGL tools to send the order to render vertex data that seldom changes during the frames (i think of terrain and objects) and what it the best way to send vertex data that changes a lot during frames?

sentences:
D3D/DXGI handle fullscreen transition I have a D3D11 application, and I want to add proper fullscreen suport.
Now I can let DXGI switch my window to fullscreen for me, and I'm under the impression that DXGI will take care of everything needed to make the swap chain flip front and backbuffer instead of blitting them.

However, letting DXGI perform the swich seems unreliable with a multi monitor setup - secondary screens stay entirely black after the switch a great deal of the time, with no apparent reason or pattern to it.

It can take a few times switching back and forth before I get the fullscreen window and the rest of the desktop being shown on the other screens.

Apparently I'm not alone with this, Battlefield 3 and WoW seem to have similar issues for a lot of people.

Now, the actual question: I guess since even those AAA game dev companies can't get this to work, my biggest hope would be to somehow perform the switch to fullscreen myself.

Is there anything I can do to elevate my window/swapchain into proper, buffer-flipping fullscreen mode?

sentences: GraphicsAdapter lacks a definition for CheckDeviceMultiSampleType The MSDN is really confusing about this, with all their different versions of XNA jumbled together for my google results. All I want to do is find out, in XNA 4.0, what antialiasing modes are supported by the display adapter. Supposedly, this involves calling GraphicsAdapter.CheckDeviceMultiSampleType(), but that function isn't defined. What should I be using in its place?

sentences:
PHP and Javascript/HTML5 Collaboration I've recently been working on a fairly complicated game. I've stored information with local storage, but that allows the player to edit it, and does not transfer from computer to computer. The two scripts run on a single server, and I use the following to ping the php server:

function initiateLoginSequence() {
    var isnewplayer=prompt("Hello! Are you new?(Y/N)");
    if(isnewplayer.equalsIgnoreCase("N")) {
        var username = prompt("Enter username.");
        var password = prompt("Enter Password.");
        //parsing code goes here later.
    } else {
        var username = prompt("Enter a username. This will be used for future logins.");
        var password = prompt("Enter a password. This will be used for future logins.","*");
        var req = new XMLHttpRequest();
        req.open('POST', 'http://69.144.34.106/Scores.php', true);
        req.send("returning=false"+"&name="+username+"&pw="+password+"&level="+lvl+"&save=true");
        req.send();
    }
}

I then process the results with this:

<?php
   $returning=_POST["returning"];
   $save=_POST["save"]
   $password=_POST["pw"];
   $username=_POST["name"];
   $score=_POST["lvl"];
   $connection=mysql_connect("localhost:3306","****","*****");
   if($returning=="false" && $save=="true") {
     mysql_select_db("userdata",$connection);
     $sqlcmd = "CREATE TABLE ".$username."(
     Username varchar(".$username.")
     Password varchar(".$password.")
     Score varchar(".$score.")
     )";
     mysql_query($sqlcmd);
   } else if($save==false) {
     $sqlcmd="SELECT * FROM userdata"
     $result = mysql_query($sqlcmd);
     while($row=mysql_fetch_array($result)) {
        if($row['Username']==$username && $row['Password']) {
            echo row['Score'];
        }
     }
   } else if($save==true) {
     $sqlcmd="SELECT * FROM userdata"
     $result = mysql_query($sqlcmd);
     while($row=mysql_fetch_array($result)) {
        row['Username']=$username
        row['Password']=$Password
        row['Score']=$Score
     }
   }
?>

But after creating the mysql database, nothing is populated. So my basic question is, Am I doing this right? If not, what am I missing?

sentences:
ray-casting, floor-casting part fails I'm currently working on a ray-casting engine in Java and I can't figure out what's wrong with my code.

For the learning and theory I use:

The permadi tutorial: ( https://permadi.com/1996/05/ray-casting-tutorial-12/ )
When I started having problems with floor-casting I found this: ( https://www.allegro.cc/forums/thread/374305 )

I was happy becaues my implementation was 90% the same as the second code snippet on the linked Allegro.cc page. I added the x and y calculation to my code and I tried, but it didn't work. I tried exactly the same solution from the page but it didn't work.

The interesting fact that my code seems to "work" sometimes and sometimes not.

Furthermore, if I start walking then the floor moves to the wrong direction, sometimes backward for example.

In the beginning of implementing the engine I used the example code from the permadi tutorial too to correct my misunderstandings and so and it worked out well so far.

In this implementation 60° = planewidth. Every other degree is based upon this. Even the toRad function uses ANGLE180 (planeWidth*3) for the calculation.

I think I may not understand something in the math or I don't know, I just couldn't find where the error is.

I looked for the solution on other sites as well but it didn't help.

(Sorry if my english was bad.)

int x,y;
double floorPointDistance;
for(int i = floorCastingStartPixel; i < planeHeight; i++) {
floorPointDistance = ( ( PLAYERHEIGHT * playerPaneDist ) / ( (planeHeight>>1) - i ) ) / (Math.sin(((double)toRad(angle+rayAngle))));

// almost good
x = (int) Math.abs( (-floorPointDistance * sinTable[rayAngle]) + (playerX) ) % 64;
y = (int) Math.abs( (floorPointDistance * cosTable[rayAngle]) + (playerY) ) % 64;

screenBuffer.setRGB(raysCasted, i, Texture.floor.texture.getRGB(x,y));
}

Something very strange is happenning here:

But now it seems to be fine...mostly:

UPDATE

Success!!!!

I just "ruin" the equations a little bit and it's got better.
I corrected the wrong floor-move direction by removing the "-" from the x equation. And I noticed the floor was very rotated, rotated into each other (you can see that "anomaly" in the previous pictures), I removed the cos part from the distance formula and it's got better.

int floorCastingStartPixel = planeHeight>>1;
int x,y;
for (int i=floorCastingStartPixel; i<=planeHeight-1; i++) {
distance = (float) (((float)PLAYERHEIGHT / (i-(planeHeight>>1)) )* playerPaneDist );

x = ( (int) (distance * (cosTable[rayAngle])) ) + playerX;
y = ( (int) (distance * (sinTable[rayAngle])) ) + playerY;

screenBuffer.setRGB(raysCasted, i, addFogEffect(Texture.floor.texture.getRGB(x&63,y&63),distance));
}

The current state:

I did the ceil-casting by "reversing" the for loop (loop variable = 0 and incrementing till it's planeHeight>>1).

UPDATE #2

I just realized that my ceiling don't move correctly...not always.

UPDATE #3

Tried other texture, now seems to move ok, so it could have been just seom optical effect.

And...I noticed thath the floor and ceiling has a little hyperbolic(?) curve. And I just realized that it's like the fisheye-effect.

You have to do fish-eye correction on the floor and ceil distance too!!!!

sentences:
Is it possible to overlay EditText box on a GLSurfaceView on Android? I am trying to add a "PlayerName" box on top of a opengl menu background, is this possible?  I've tried various layouts, but they don't seem to allow an EditText box to appear on top

What is the typical way of doing something like this?  Do I need to manually render the text and handle input or is there a better way?  It seems like it should be possible to show the EditText on top of the GLSurfaceView somehow.

sentences:
Access alpha value of opengl texture pixels I'm trying to get the alpha values of each pixel of an image that I'm loading onto a texture so i can use it to check for per pixel collision.
I have a texture class:

struct GLTexture {
    std::string filePath = "";
    GLuint id;
    int width;
    int height;
    std::vector<std::vector<int>> alphaPixels;
};

When i bind the texture i want to do something like this:

//Generate the openGL texture object
glGenTextures(1, &(texture.id));

//Bind the texture object
glBindTexture(GL_TEXTURE_2D, texture.id);
//Upload the pixels to the texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &(out[0]));

for(int i = 0; i < width; i++)
{
    for(int j =0; j<height; j++)
    {
        alphaPixels[i][j] = getAlpha(GL_TEXTURE_2D); ///<something like this line but i don't know how to access to alpha value
    }
}

How can i get the alpha value of each pixel of the image? Is this even a feasible thing to do or is there a better way to do this?

sentences:
What's the term for this illustration style common in MMOs/RPGs? Often I was asked for the "style", but I am not sure how to describe it. I just say "mix of anime and realism". But what is it actually called, a style like this example:

It's popular and you see it in most of all mmo/rpgs. I know that it's called "stylized" in 3D-Texturing. But how would you call that typical style like in the link above (not meaning the clothes or what it expresses do be, its about the illustration and character style. Like anime, Fortnite (as it has very unique style) and so on)

sentences:
Oscillating an object left and right based on it's current orientation I'm currently implementing a fire animation in HTML5 Canvas using the phone's accelerometer.

Regardless of the phones orientation, the triangles for the fire move upward. So you can spin your phone around to what ever degree you wish, and the triangles will move towards the sky.

My issue is trying to implement an oscillation left and right for these triangles. Before I had the accelerometer hooked up, I just applied an oscillation to the x axis and everything worked fine. Now however because the triangles are moving in what ever direction up is, I need to somehow apply the oscillation to both axis depending on what the orientation of the phone is.

Could anyone help me out?

I'm using JS for this.

Thanks.

sentences:
Additive scene loading to UNet I have a main scene where my player is loading as I start or join the server. On some player action, I want to load additive scenes in to my main scene. It is loading fine on the client, but not across the network. My other clients are unable to watch it.

I checked different links, and found a forum post and a Unity Suggestions page. It seems, to me, that this "Additive scene loading to UNet" feature is not available in Unity.

If additive scene loading in UNet is not available, then what are the alternatives?

I am able to load scene through [ClientRpc]. Is this the correct way to do this?

[ClientRpc]
public void RpcLoadLevelAcrossNetwork()
{
    SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
}

sentences: Rendering an Assimp Scene object in XNA without DirectX or OpenGL Is there any site that explains how to render an imported Assimp Scene object in XNA/MonoGame using only the Frameworks available in those libraries? I realize that would be at the Vertex/Matrix level but that is what I am trying to learn. The site would preferably start with the basics of rendering a mesh from the Scene object and then move on to Materials or Textures. A bonus would be if it could include information about Animating from the Scene object.

sentences:
How do I inverse level progression and make new stats? I'm trying to make something like Vampire: Dark Ages in RPG Maker MV, but the problem is that I need new stats and a reverse level progression, as long as you start at 12nd generation (like the "level 1" in the rest of the games) and the next "level" is 11st generation.
It should have this stats:

Strenght

Dexterity

Resistance

Charisma

Manipulation

Appearence

Perception

Intelligence

Wits

This would only change by "buying abilities" with Job Points, and they determinate most of actions in the game. The only that would change would be the "Vitae Points", that act as Magic Points or Mana Points. When you have higher generation (low level), you have less Vitae/Blood points than if you have lower generation (high level).
How can I make this work? There's some plugin for this?

sentences:
How to code camera for layered map in unity For a current unity project I need a layered map like in Dwarf Fortress. The game will take place in a 3D city enviroment and the camera should be 'snapped' to layers. So there will be (for example) a cave layer, ground layer and floor 1 - 3 layer. The player should be able to navigate the camera up and down with a keypress. So if the player is looking currently at the ground layer and press + the camera should snip to floor 1 layer. All layers below the current level will be blurred and all levels above wont be visible (or at least faded out very strong)

My question now is: Is the layer system of unity useful for such a scenario, or is it better to implement an own data structure? I know about the ability of ignoring layers for rendering and raycasting but can the system be extended to support the features described above?

sentences:
How to make natural-looking paths with A* on a grid? I've been reading this:
http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html

But there are some things I don't understand, for example the article says to use something like this for pathfinding with diagonal movement:

function heuristic(node) =
    dx = abs(node.x - goal.x)
    dy = abs(node.y - goal.y)
    return D * max(dx, dy)

I don't know how do set D to get a natural looking path like in the article, I set D to the lowest cost between adjacent squares like it said, and I don't know what they meant by the stuff about the heuristic should be 4*D, that does not seem to change any thing.

This is my heuristic function and move function:

def heuristic(self, node, goal):
    D = 5
    dx = abs(node.x - goal.x)
    dy = abs(node.y - goal.y)
    return D * max(dx, dy)

def move_cost(self, current, node):
   cross = abs(current.x - node.x) == 1 and abs(current.y - node.y) == 1
   return 7 if cross else 5

Result:

The smooth sailing path we want to happen:

The rest of my code: http://pastebin.com/TL2cEkeX

Update

This is the best solution I have found so far:

def heuristic(node, start, goal):
    dx1 = node.x - goal.x
    dy1 = node.y - goal.y
    dx2 = start.x - goal.x
    dy2 = start.y - goal.y
    cross = abs(dx1*dy2 - dx2*dy1)

    dx3 = abs(dx1)
    dy3 = abs(dy1)

    return 5 + (cross*0.01) * (dx3+dy3) + (sqrt(2)-2) * min(dx3, dy3)

def move_cost(current, node):
    cross = abs(current.x - node.x) == 1 and abs(current.y - node.y) == 1
    return 7 if cross else 5

It produces the desired path from the second pic, but does not handle obstacles very well (tends to crawl on walls) and fails to produce optimal paths sometimes on longer distances.

What are some tweaks and optimizations I can apply to improve it?

sentences:
Unwanted continuous rotation with Quaternion I am probably missing something simple but ... this is how I'm calculating the world matrix of my object:

glm::translate(glm::mat4(1.f), mPosition) * glm::mat4_cast(mOrientation) * glm::scale(glm::mat4(1.f), mScale);

where mOrientation is a glm::quat type and it is set to identity via:

mOrientation(glm::vec3(0.0f, 0.0f, 0.0f))

What's strange is that my object keeps rotating over the Y-axis (world space) and to prove that it isn't my loop, I changed my world matrix calculation to:

glm::translate(glm::mat4(1.f), mPosition) * glm::rotate(glm::mat4(), 45.0f, glm::vec3(0.0f, 1.0f, 0.0f)) * glm::scale(glm::mat4(1.f), mScale);

And my object is static and is indeed rotated 45 degrees on the Y-axis. The key difference is that with Quaternion, it KEEPS rotating. What am I missing?

sentences:
Term for a game that used to cost money but is now a public license What is the term for that?
A game that used to cost money but is so old that it is now available for free (though not always open-sourced).

Also, does anyone know where I can find a list of such games?

sentences:
Can an unmodifiable 3D map be one large model or many small models? Unmodifiable meaning that any ingame actions have no result on the terrain.
Like in Source games.

Question: Should I export one large model of the map, or should I split it into smaller chunks? If so, how?

sentences:
Method for spawning enemies according to player score and game time I'm making a top-down shooter and want to scale the difficulty of the game according to what the score is and how much time has Passed. Along with this, I want to spawn enemies in different patterns and increase the intervals at which these enemies are shown. I'm going for a similar effect to Geometry wars. However, I can think of a to do this other than have multiple if-else statments, e.g. :

        if (score > 1000) {
    //spawn x amount if enemies
        }
        else if (score > 10000) {
    //spawn x amount of enemy type 1 & 2
        }
        else if (score > 15000) {
       //spawn x amount of enemy type 1 & 2 & 3
        }
        else if (score > 25000) {
       //spawn x amount of enemy type 1 & 2 & 3
       //create patterns with enemies
        }
       ...etc

What would be a better method of spawning enemies as I have described?

sentences:
How to create "broken glass" animation? I have started making a 3D game in Unity5 that consists in avoiding obstacles. It is very easy but I want to add a collision effect when I collide on the wall.

I would like to slice the screen into many parts (random pieces is better) that are falling down from screen with gravity.

An example of what I mean:

How can I do this?
I've tried using a lot of different images (shapes) but I'm sure that is not the best way...

Thanks for any suggestions.

sentences:
Memory Leak in SharpDX one Thing I found out: Windows 7 produces a memory leak while using certain methods to access rendertargets. Why doesn't Windows 8 leak at this method?

public class Game : SharpDX.Toolkit.Game {
    GraphicsDeviceManager gdm;
    RenderTarget2D target;
    public Game() {
        gdm = new GraphicsDeviceManager(this);
    }
    protected override void LoadContent() {
        target = RenderTarget2D.New(GraphicsDevice, 1000, 1000, PixelFormat.R8G8B8A8.UNorm);
        base.LoadContent();
    }
    private Color GetColor(int x, int y) {
        using (Image image = target.GetDataAsImage()) {
            PixelBuffer buffer = image.PixelBuffer[0];
            Color color = buffer.GetPixel<Color>(x, y);
            buffer = null;
            return color;
        }
    }
    protected override void Update(GameTime gameTime) {
        GetColor(5, 5);
        base.Update(gameTime);
    }
}

The memory consumption with this on Windows 8 is around 25 MB, Windows 7 uses up full memory.
Any idea why Windows 8 handles memory/graphics in another way than Windows 7 (and how to fix it)?
For clarification if it was a memory leak:

The drop is caused by closing the application.

sentences:
Does animation have internal "update"-cycle where I can make calculations between steps? I am new to Unity and not game developer at all, so sorry if this question might be stupid. I have an animation in my project. Is there some points where Unity calculates/recalculates the next position of animated character? Is there some function like for example "OnAnimationSample()"? I want to make calculations between theese points. I didn't found anything in the documentation and hope that someone more experienced than me know some way to tackle, although the task is quite peculiar.
I am programming a simulation environment for robots. There is a need to take screenshots at certain events happening by means of raycasting (gathering img data for CNN). The robot has various physical specification like for example speed. I don't want the environment depends on speed of the robot, so I am planning to make calculations and screenshots constatly for example in between two animation "milestones". That will slow fps and overall game down, but I don't mind since I need only right data at right step. For example suppose there are exist such points in the Unity, when before taking any movement the Unity calculates the next state of the object being animated. I want to stuff my calculation and such, that next animation step won't start until all is done.
I hope that explained not so tricky. Say if the explanation is obscure I will try my best again.

sentences:
how to recieve a trigger with collider or recieve a trigger with collider in unity i know if your object has a Collider you can sense another Collider with OnCollisionEnter function or... and you can sense another collider with trigger with OncollsionEnter function and...
but i want to sense other object with trigger even with collider or even with trigger. i cant sense otherobjects that have triggers. for example i have bullet that as i dont want to collider have any physics i turned it to trigger but how can make a charcter to sense it?

Thank you for helping

sentences:
Entity System creating Components Over every entity system I see implemented in C++, or even in Java/C# (e.g. the Artemis framework). I see components not allocated via a new operator (or something similar, e.g. std::make_shared). For example:

entity.addComponent(new Position(32, 4, 5));
entity2.addComponent(new Position(5, 6, 7));
// those two position components that were just created
// may/may not be together in memory

// or even:
// how can you avoid using new here? (in the implementation)
entity.addComponent<Position>(32, 4, 5);

Doesn't this harm performance, as there would be cache misses (since new can allocate data anywhere from the heap)? How would you implement a system in such a way that the components of each type are allocated contiguously in memory, so you avoid cache misses? I mainly want to know how one would do so in C++.

sentences:
Reconciling external events with the game loop Is there any way I can program (in Java or Python, but open to other solutions) some game logic based on events, timed and sent by player input, without dealing with it inside the game loop, by having a game state that has a number of scripts listening for events, and those scripts can themselves fire events that change the game states and by consequence the scripts listening for events? An example bellow

class BombScript {

    private GameObject bombReference;

    void bombDefused() {
        // change the script listening for events
        bombReference.destroy();
    }

    void bombExplode() {
        // launch some events, change the script listening for events
        stopListeningForEvent("bombDefused");
        bombReference.destroy();
        sendEvent("bombExplode", bombReference);
    }

    void bombPlanted() {
        // if somehow the server receives a defuse command
        onEvent("bombDefused").execute(bombDefused);

        // else, if 6 seconds pass without an "bombDefused" event
        onTimeout(6).execute(bombExplode);
    }
}

I'm having trouble imagining a concrete implementation for that, specifically the timed based "if/else"

sentences: Declaring another alpha or beta testing after a game app for Android (APK file) is uploaded and already published in Google Play Store This question is related about alpha or beta release in Google Play Store. . Let's say my app (APK file) was uploaded in alpha/beta testing. If one of the testers satisfied or quick fixes on the bugs, then I'm gonna go promote to production, which means publishing an app. Now, let's say I wanna go for another alpha or beta testing for the next version before updating new version in production. I have to test it; let's say testing for the leaderboard or achievements created from the Game Services at Google Play Developers Console, adding Google Play Games plugins for Unity to the app, and then uploading the new APK version for the next beta release before updating new version in production. Is it possible or not?

sentences:
How do you stop OgreBullet Capsule from falling over? I've just started implementing bullet into my Ogre project. I followed the install instructions here: http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1

And the rest if the tutorial here:
http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2

I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.

I need a way to fix the capsule to always stay upright, but I have no idea how

Below is the code I'm using.

(part of) Header File

OgreBulletDynamics::DynamicsWorld *mWorld;   // OgreBullet World
OgreBulletCollisions::DebugDrawer *debugDrawer;
std::deque<OgreBulletDynamics::RigidBody *>         mBodies;
std::deque<OgreBulletCollisions::CollisionShape *>  mShapes;

OgreBulletCollisions::CollisionShape *character;
OgreBulletDynamics::RigidBody *characterBody;
Ogre::SceneNode *charNode;

Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;

main file

bool MinimalOgre::go(void)
{
    ...

     mCamera = mSceneMgr->createCamera("PlayerCam");
     mCamera->setPosition(Vector3(0,0,0));
     mCamera->lookAt(Vector3(0,0,300));
     mCamera->setNearClipDistance(5);
     mCameraMan = new OgreBites::SdkCameraMan(mCamera);

    OgreBulletCollisions::CollisionShape *Shape;
    Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance)
    OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
            "BasePlane",
            mWorld);
    defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
    // push the created objects to the deques
    mShapes.push_back(Shape);
    mBodies.push_back(defaultPlaneBody);

    character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0));

    charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    charNode->attachObject(mCamera);
    charNode->setPosition(mCamera->getPosition());

    characterBody = new OgreBulletDynamics::RigidBody("character", mWorld);
    characterBody->setShape(   charNode,
                    character,
                    0.0f,         // dynamic body restitution
                    10.0f,         // dynamic body friction
                    10.0f,          // dynamic bodymass
                    Vector3(0,0,0),
                    Quaternion(0, 0, 1, 0));

    mShapes.push_back(character);
    mBodies.push_back(characterBody);

    ...
}

sentences:
Refactoring out asynchronous webrequests to an interface I have a Unity project with UnityWebRequest calls in it. They are all working correctly, but I'd like to refactor them out (they are implemented pretty badly at the moment).

The way I would like to do this is with a WebRequestSender class that implements an IWebRequest interface. Each call would return a WebResult object that I can use.

public class WebResult
{
    public long ResponseCode { get; set; }
    public bool IsError { get; set; }
    public string Value { get; set; }

    public static WebResult Success(long responseCode, string value)
    {
        return new WebResult
        {
            IsError = false,
            ResponseCode = responseCode,
            Value = value
        };
    }

    public static WebResult Failure(long responseCode)
    {
        return new WebResult
        {
            IsError = true,
            ResponseCode = responseCode,
        };
    }
}

I'm having trouble understanding how to implement the interface, as these calls are asynchronous.

Ideally, in the script when I need to make a call, I would have one line, like so:

WebRequest.Login(form) and that would return the result. I'm not sure what I have to add for it to wait for the call, or however it is executed.

public interface IWebRequest
{
    WebResult Register(WWWForm form);
}

Do I need to alter the return object so it allows for asynchronous calls? Or do I have to change the implementation/the call of the implementation?

As for my implementation, it doesn't work. The return statement on the Register function isn't called (even if it was, I'm not sure the return object would be populated?)  Sample below:

public class WebRequestSender : MonoBehaviour, IWebRequest
{
    private const string REGISTER_URL = "http://localhost:51044/api/Users/Register";

    private WebResult webResult;

    public WebResult Register(WWWForm form)
    {
        StartCoroutine(MakeWebCall(REGISTER_URL, form, (UnityWebRequest webRequest) => RegisterDelegate(webRequest)));

        return webResult;
    }

    private void RegisterDelegate(UnityWebRequest webRequest)
    {
        if (webRequest.isHttpError || webRequest.isNetworkError)
        {
            webResult = WebResult.Failure(webRequest.responseCode);
        }
        else
        {
            webResult = WebResult.Success(webRequest.responseCode, webRequest.downloadHandler.text);
        }
    }

    private IEnumerator MakeWebCall(string url, WWWForm form, Action<UnityWebRequest> finishDelegate)
    {
        using (UnityWebRequest www = UnityWebRequest.Post(url, form))
        {
            yield return www.SendWebRequest();
            finishDelegate(www);
        }
    }
}

sentences:
How do I make "weaponsclash" = animations adapating to parameters Meaning: how do I build my animations/system so that I can have swords blocking each other?
I honestly believe this is the hardest part of a game: I need animations to interact with each other. If a monster uses attack 1 on hero 2, then both NPCs have to play a different animation based on,

A, How big these NPCs are. I need them to be able to be scaled (monsters can grow, but when it jumps on a small player, it still has to look just as fitting as with other sizes)
B, Speed of the monster when it runs up for the attack.
C, Countless other things I suppose.

How do I achieve this? KI, Pathfinding... all that is meaningless unless I can build a believable combat system.

sentences:
How do I generate terrain like that of Scorched Earth? I'm a web developer and I am keen to start writing my own games.

For familiarity, I've chosen JavaScript and canvas element for now.

I want to generate some terrain like that in Scorched Earth.

My first attempt made me realise I couldn't just randomise the y value; there had to be some sanity in the peaks and troughs.

I have Googled around a bit, but either I can't find something simple enough for me or I am using the wrong keywords.

Can you please show me what sort of algorithm I would use to generate something in the example, keeping in mind that I am completely new to games programming (since making Breakout in 2003 with Visual Basic anyway)?

sentences:
Skybox: OpenGL texCUBE vs a textured cube In OpenGL, the typical way that I've seen to set up a skybox using cubemapping is to create a cube in camera space, prepare a cubemap sampler with the appropriate six-sided texture, and then in the pixel shader use the camera space direction of the pixel as the input to texCUBE.
What I'm wondering is, if instead of this, I set up the same cube, but then simply textured each face of the cube with the appropriate face of the cubemap texture, and then rendered the cube with a standard shader, would it achieve the same visual effect?

sentences:
How to make a Sprite be displayed always behind everything else? What I am in need to achieve is to have a Sprite always facing the camera identically to what happens with any simple game UI object, but instead of always displayed above everything else, it should be always displayed behind everything else.

How can I achieve that in Unity using C#?

Regarding the always-behind rendering, I tried setting the Sprite's "Order in Layer" to 0 or to negative values, with no success. I also tried setting all game objects to a greater value than the sprite's:

    go.GetComponent<Renderer>().sortingLayerName = "Test";
    go.GetComponent<Renderer>().sortingOrder = 1;

That did not work as well.

What would be the correct way of making a sprite to be always displayed behind everything else (other sprites, GUI and 3D meshes) - preferably not having to resort to shaders, if possible?

PS:regarding the effect of the Sprite always facing the camera as in a game UI, I suppose it will be only a matter of updating its rotation towards the camera - but I would be happy to find out if other approaches are avialable/more suited to the task.

sentences: Physic of an arrow in flight What are the formulas which represent the horizontal and vertical displacement of an arrow in flight (as well as it angle)? I would like to make sure that I take into consideration the arrow's fluid dynamics and center of gravity.

sentences:
How do I align textures properly with an exploding sprite / breakable body? I'm working on a game based on Box2D and Starling which includes breakable bodies - bodies/objects that when hit with sufficient force break apart (into smaller pieces).
I've managed the physics part but I'm stuck on the graphics.

Using the old non-Stage3D  Flash APIs I would do something like this to draw the resulting pieces of the breakable body (after the impact):

       var m:Matrix = new Matrix();
        m.tx=- texture.width*0.5;
        m.ty=- texture.height*0.5;

        this.graphics.lineStyle(1);
        this.graphics.beginBitmapFill(texture, m, true, true);
        this.graphics.moveTo(verticesVec[0].x, verticesVec[0].y);
        for (var i:int=1; i<verticesVec.length; i++) {
            this.graphics.lineTo(verticesVec[i].x, verticesVec[i].y);
        }
        this.graphics.lineTo(verticesVec[0].x, verticesVec[0].y);
        this.graphics.endFill();

The verticesVec contains the vertices of the piece I want to draw.
In Starling I've managed to draw the pieces using a fragment shader like so:

      fill = new Fill();
      fill.material.fragmentShader = new TextureVertexColorFragmentShader();
      //fill.material.textures[0] = Assets.getTexture("Box");
      fill.addVertex(verticesVec[0].x,  verticesVec[0].y,0x000000);

      for (var i:int=1; i<verticesVec.length; i++) {
               fill.addVertex(verticesVec[i].x,  verticesVec[i].y,0x000000 );
      }

     fill.addVertex(verticesVec[0].x, verticesVec[0].y,0x000000 );

But I can't figure out how to manipulate the texture so it fits my pieces.
When I try adding a texture it ends up stretched/rotated, etc.

I'm kind of new to shaders and I would really appreciate a push in the right direction.

sentences:
How do I create a 3D model based on 2D drawings? I'm a programmer. I have a great draftsman, but I don't know how to take his drawings to 3D.

My gut feeling is to have him draw different view angles, then work based on those, adding each dimension to the model turn. But really I'm just guessing here.

How do I do this methodically and correctly?

sentences:
Does Apple allow different versions of the same game on the App Store tailored for different regions? We are currently in negotiations with a Chinese company to give them the right to re-sell our game in the Asia region.

Now for the Android version they want to sell it trough their website because they want to utilize China specific payment systems. This can be easily achieved by adding an activation system to the app and generating keys for the users who paid.

My problem is with the iOS version. As far as I know there is no way to install an app on iOS outside the app store environment without having a jailbroken phone. Can I just give them the archive of the app from XCode and have them upload it trough their own app store account? Will this cause a problem with Apple that basically the same app will be on the store twice with a different bundle ID?

sentences:
Testing Live Ads Before Publishing Admob I am testing ads with the test device method and test ads are showing perfectly but when I try to load live ads they won't load.

I have implemented the OnAdFailedToLoad which tells me that ads are not loading, this only happens when I try to load live ad but in the test ad everything works fine.

Does this happens all the time? we can't see live ads without publishing the game first? or there are no ads available at the moment if so when do the get available or they even get available for new users. How can I make sure that I will get live ads after publishing the on Google Play Store.

I don't know I am just confuse about this thing, I am using Unity 3D and building for Android.

I have searched on internet but everybody says that ads might not available at the moment I am just curious why are ads not available its been two days and I haven't seen any ad when are the ads going to be available. Thanks for reading this.

sentences: Calculating time until a ball fall How exactly can I calculate time until a ball fall if I know initial and final x and y position of a ball, gravity, delta time, initial dx and dy of a ball and its speed calculated from the formula sqrt(dx ** 2 + dy ** 2)?

sentences:
What does glMultiDraw* do? I'm having trouble understanding exactly what glMultiDraw* does, and when it should be used.

Is it to be used if I have one VBO with multiple objects in it or do I use it with many VBO's?

It would be great if someone could give a real example of how to use this is a VAO/VBO as all the stuff I've found on google just explain what the function does rather that how to use it practically.

sentences:
Why has my refractive water shader become reflective So I was making a water shader in unity and well it looked fine in the scene view but as soon as I went into the game view the refraction texture basically flipped up 180 degrees and made it look like the water was reflective. The problem with this is that it breaks the transparency of the shader.

Scene View (how it should look):

Game View (how it does look):

Shader: (I can't post more than 2 images)

Part of the shader:

float4 Lerp2=lerp(Tex2D2,float4( 0.0, 0.0, 0.0, 0.0 ),_Refraction.xxxx);
float4 Subtract0=Lerp2 - _RefractionCorrection.xxxx;
float4 Add2=((IN.screenPos.xy/IN.screenPos.w).xyxy) + Subtract0;
float4 Tex2D0=tex2D(_GrabTexture,Add2.xy);

sentences:
Can I directly pass a Boost ptr_vector list to glBufferData? I have a data structure like this:

typedef struct vertex_ {
float x;
float y;
float z;
float s;
float t;
}vertex;

Then I add to a list called: boost::ptr_vector<vector> vertices;

Is there a way to use vertices to provide the parameters for glBufferData?

sentences:
How to integrate Tiled maps and collision detection with pygame? I have been using pygame to make a simple rpg pokemon style game. To create maps I have used the Tiled map editor and then loading them into pygame using pytmx.

I have heard that you can add object layers in Tiled to your map, and then use this information for collision detection within your game engine (in this case pygame). Unfortunately, while I know how to load the tmx file into my pygame game, I have no idea how to use the object layers for collision detection.

Can anyone provide a minimal example on how to do this? The documentation that I have come across for Tiled appears to be quite minimal and still an active work in progress. As a result I have not been able to find information on using Tiled and object layers for collision detection in pygame.

sentences:
How do I prevent receiving data from the network from dropping rendering frames in a multiplayer game? I'm building an HTML5 massively multiplayer online game. I've been working on this project for awhile, but am having some trouble sorting through a couple of performance issues.

Since this is a multiplayer game, information is sent to and received from the network. When a client needs to know about new entities on the screen, the server must stream this data.

Unfortunately, one big problem I'm having right now is that sometimes either a) a lot of data needs to be streamed or b) lots of small pieces of data are streamed in a short amount of time. Both scenarios currently cause the client to drop rendering frames as the client spends its time receiving packets and processing the data.

What is the best way to prevent the networking data from causing frame rate problems? I am particularly interested in approaches to this kind of system that minimize frame drop issues, though suggestions tailored to my specific situation are welcome.

Update: To elaborate on the type of information sent in my particular case, my client does minimal interpolation and receives updates anytime the state of an entity changes on the server. The client also receives large packets with the entire state of an entity the first time the client needs to know about that entity.

sentences:
Different shader programs but same buffer drawing I've setup 3 different instances of the same shader code (e.g. I've compiled the code into 3 separate programs)

For each program, I've gone through the whole route of something like this:

//Setup
gl.useProgram(program);
const buffer = gl.createBuffer();
const location = gl.getAttribLocation(program, aName);

//Upload (each uses the buffer/location it created in Setup
gl.useProgram(program);
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
gl.bufferData(gl.ARRAY_BUFFER, data, usagePattern);
gl.vertexAttribPointer(location, nComponents, dataType, false, 0, 0);
gl.enableVertexAttribArray(location);

//Draw
gl.useProgram(program);
gl.vertexAttribPointer(location, 2, gl.FLOAT, false, 0, 0);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);

However, no matter what I pass into data - e.g. different sized quads, all three are the same size.

Notably, changes to other uniforms/attributes like matrices and color do change per object

How do I change this so that the changes to data per instance will be drawn properly?

(I realize if they actually use the same shader I should maybe keep a reference to one program and use some sort of buffer pool- but I'm not there yet, just getting started with WebGL)

sentences:
How come these 2 lines of code are causing a memory leak? I'm confused, I commented these 2 lines out resulting in no memory leaks, and when I added them again it's leaking.

However I can't understand why it's actually leaking?

This is the 2 lines of code one of them or both are leaking :

m_surface = TTF_RenderText_Solid(m_font, m_text.c_str(), m_color_fg);
m_texture = SDL_CreateTextureFromSurface(renderer, m_surface);

And here is the declaration of the 2 variables :

SDL_Surface* m_surface = nullptr;
SDL_Texture* m_texture = nullptr;

 I'm not sure what else is needed to figure out why it's leaking.

sentences:
Profiling unity games on Android devices I would like to profile our Unity mobile game on Android devices in a way similar to profiling Unity games on iOS with Instruments.

I am aware of how to do this using Unity's profiler, I would however like to use a third party profiler for the following reasons:

to validate Unity's profiling data
to have more visibility into how the app is running, including Unity's functions, etc.
the largest lag spikes cause unity's profiler to run out of samples. I'm however very interested in precisely these spikes
I'd like to have profile data for longer periods than unity records for
I'd like to do analysis over time (not just detailed data for each frame, but also aggregated over a time span)

Essentially I'd like as much visibility as possible to make Android on-device profiling as comprehensive as possible. As close to Instruments on iOS as possible.

So far I've tried with DDMS, but could only get visibility into Andoid OS functions and seeminly nothing in the actual apk - at least nothing I recognised. I tried with mono2x and il2cpp, with all debug features that I'm aware of in build and player settings enabled.

The game is developed with Unity 5,4 with Mono2x.

All help is appreciated. I've listed my intents above, so even if profiling on device is not possible in this way on Andoid, alternate solutions to the listed intents are still very appreciated. Thanks!

sentences:
Source code of Minecraft servers? Is there any way to get the source code of Minecraft servers? I tried decompiling but I get very obfuscated arguments, classes, and methods.

If the answer is no, how did services like Bukkit and Spigot create their 'servers'?

sentences:
is there a way to alternate between two state machines? I'm programming an enemy on Unity that has two state machines, one controlling the "normal" behaviour of the enemy (that consists in three states: idle, patrol and chase) and another one controlling the battle behaviour of the enemy (that consists in three more states: attack, dodge and run away). I'm doing these state machines by using enums, like the following code
public enum StateMachines { NORMAL, BATTLE }
public enum NormalStates { IDLE, PATROL, CHASE }
public enum BattleStates { ATTACK, DODGE, RUNAWAY }

I want to loop between the Normal and Battle state machines but I have one problem that is they always get executed at the same time. Is there a way I can alternate between state machines through code in a single script (by conditions)? Thank you!

sentences:
How do we make online games deterministic? I am trying to understand how networking in games work as I am trying to make an online game myself. I can't grasp how it is possible to synchronize the players, in order to make the game deterministic. I found an article saying this:

  in order to ensure that the game plays out identically on all machines it is necessary to wait until all player’s commands for that turn are received before simulating that turn. This means that each player in the game has latency equal to the most lagged player.

This makes sense and I also came to the same conclusion after hours of drawing graphs with various scenarios. However, there are some games where one player can have 500ms delay, and another player could have 40ms delay. In this case, how is the game deterministic ?

Lets name players with 40ms, 500ms delay: Player40, Player500

Lets say that Player40, shoots Player500 with an instant laser shot at T1 = 0ms. Exactly 40ms after the Player40 actually clicked with his mouse to shoot (so T2 = 40ms), The "laser shooting event" registered on the server and returned "ok, you can execute laser shoot" to Player40. So, the shot is being applied on Player40's machine and on his screen he sees that he killed Player500, and the corpse is lying on (x1,y1,z1).

Meanwhile, what happened on Player500's machine, was that Player500 was running straight. A few moments later he sees a laser a few feet behind him, he dies even though the laser didn't hit him, and his corpse is lying on (x2,y2,z2).

Since this scenario never happens in some games, does this mean that those games are deterministic ? How is something like this possible, without forcing all players to get a delay equal to the delay of the most lagging player ?

sentences:
Does this constitute as copyright infringement? Say there is a card game, and it has cards that arc out, and has certain types of memberships with certain features such as premium members being allowed to chat, or use private game rooms etc. If I, from scratch created a card game (for example, Hearts) that had similar arced cards, and had similar basic and premium memberships, but used all my own, graphics, sound, and theme, would this constitute as copyright infringement? Where is the line drawn for this sort of thing?

Thanks

sentences:
Can I make a Flash version of an actual game? Possible Duplicate:
  Legal issues for a “fangame” of a commercial franchise?

For example, some of you may have seen Portal: The Flash Version. I was wondering what the legal background on this kind of stuff is, for example what legal things I'm supposed to say, give credit to the original's creators and all.

Obviously, I'm presuming that I'm not allowed to make money off of it, but I just want to know what restrictions there are of making a free Flash version.

For example, would I be allowed to make a Yu-Gi-Oh! game based off the Power Of Chaos series? And if so, would I be allowed to use the Yu-Gi-Oh name or would I have to call it something else?

sentences:
How to make player rotate towards mouse I'm making a top down shooter with Three.js and Box2d. I'm displaying all of the graphics in 3d, but all of the physics are done in 2d, so it's sort of like super smash bros in a way.

Anyway, how can I make the player (a simple cube) rotate towards the mouse position? I've tried googling around, but I can't find much.

sentences: Are square or hex grids better for pathfinding? Is there any significant difference between using a square or hexagonal grid for the area searched by a path finding algorithm. In other words, is square or hexagonal better, and if so why.

sentences:
Problem with Assimp 3D model loader In my game I have model loading functions for Assimp model loading library. I can load the model and render it, but the model displays incorrectly. The models load in as if they were using a seperate projection matrix. I have looked over my code over and over again, but I probably keep on missing the obvious reason why this is happening.

Here is an image of my game:

It's simply a 6 sided cube, but it's off big time!

Here are my code snippets for rendering the cube to the screen:

void C_MediaLoader::display(void)
{
    float tmp;

    glTranslatef(0,0,0);
    // rotate it around the y axis
    glRotatef(angle,0.f,0.f,1.f);
    glColor4f(1,1,1,1);

    // scale the whole asset to fit into our view frustum
    tmp = scene_max.x-scene_min.x;
    tmp = aisgl_max(scene_max.y - scene_min.y,tmp);
    tmp = aisgl_max(scene_max.z - scene_min.z,tmp);
    tmp = (1.f / tmp);
    glScalef(tmp/5, tmp/5, tmp/5);

    // center the model
    //glTranslatef( -scene_center.x, -scene_center.y, -scene_center.z );
    // if the display list has not been made yet, create a new one and
    // fill it with scene contents
    if(scene_list == 0) {
        scene_list = glGenLists(1);
        glNewList(scene_list, GL_COMPILE);
            // now begin at the root node of the imported data and traverse
            // the scenegraph by multiplying subsequent local transforms
            // together on GL's matrix stack.
        recursive_render(scene, scene->mRootNode);
        glEndList();
    }
    glCallList(scene_list);
}

void C_MediaLoader::recursive_render (const struct aiScene *sc, const struct aiNode* nd)
{
    unsigned int i;
    unsigned int n = 0, t;
    struct aiMatrix4x4 m = nd->mTransformation;

    // update transform
    aiTransposeMatrix4(&m);
    glPushMatrix();
    glMultMatrixf((float*)&m);

    // draw all meshes assigned to this node
    for (; n < nd->mNumMeshes; ++n) {
        const struct aiMesh* mesh = scene->mMeshes[nd->mMeshes[n]];

        apply_material(sc->mMaterials[mesh->mMaterialIndex]);

        if(mesh->mNormals == NULL) {
            glDisable(GL_LIGHTING);
        } else {
            glEnable(GL_LIGHTING);
        }

        for (t = 0; t < mesh->mNumFaces; ++t) {
            const struct aiFace* face = &mesh->mFaces[t];
            GLenum face_mode;

            switch(face->mNumIndices) {
                case 1: face_mode = GL_POINTS; break;
                case 2: face_mode = GL_LINES; break;
                case 3: face_mode = GL_TRIANGLES; break;
                default: face_mode = GL_POLYGON; break;
            }

            glBegin(face_mode);

            for(i = 0; i < face->mNumIndices; i++) {
                int index = face->mIndices[i];

                if(mesh->mColors[0] != NULL)
                    glColor4fv((GLfloat*)&mesh->mColors[0][index]);

                if(mesh->mNormals != NULL)
                    glNormal3fv(&mesh->mNormals[index].x);

                glVertex3fv(&mesh->mVertices[index].x);
            }

            glEnd();
        }
    }
    // draw all children
    for (n = 0; n < nd->mNumChildren; ++n) {
        recursive_render(sc, nd->mChildren[n]);
    }
    glPopMatrix();
}

Sorry there is so much code to look through, but I really cannot find the problem, and I would love to have help.

sentences:
Why does collision only work when keys are being pressed? My player object containing a rigidbody that is controlled using Input, is not colliding with an enemy unless keys are pressed. When no keys are pressed, the enemy simply goes through the player without collision. I'm using Unity 5.6.1f1.

I figured the problem is in the Patrol class because when I don't attach the script to the enemy object the collision appears to take place fine.
But I don't know what I'm doing wrong in this script because I seems to do it's task well. I wrote this script to make the enemy object move between points in patrolPoints which are just some empty's in the game world.

So, I would like to know if I'm doing it right or is there another way to do it.

Patrol.cs

public class Patrol : MonoBehaviour {
    public Transform[] patrolPoints;
    public float speed;
    private int currentPoint;
    private bool forward;

    // Use this for initialization
    void Start () {
        transform.position = patrolPoints [0].position;
        currentPoint = 0;
        forward = true;
    }

    // Update is called once per frame
    void Update () {
        if (transform.position == patrolPoints [currentPoint].position) {
            if (currentPoint < patrolPoints.Length - 1 && forward) {
                currentPoint++;
            } else {
                currentPoint--;
                forward = false;
            }

            if (currentPoint == 0)
                forward = true;
        }

        transform.position = Vector3.MoveTowards (transform.position,
            patrolPoints [currentPoint].position, speed * Time.deltaTime);
    }
}

sentences:
Can't understand these UV texture coordinates (range is NOT 0.0 to 1.0) I am trying to draw a simple 3D object generated by Google SketchUp 8 Pro onto my WebGL app, the model is a simple cylinder.

I opened the exported file and copied the vertices positions, indices, normals and texture coordinates into a .json file in order to be able to use it on javascript. Everything seems to work fine, except for the texture coordinates which have some pretty big values, like 46.331676 and also negative values. Now I don't know if I am wrong, but isn't 2D texture coordinates supposed to be in a range from 0.0 to 1.0 only?

Well, drawing the model using these texture coordinates gives me a totally weird look, and I can only get to see the texture properly when I am very close (not really me, the cam) to the model, as if the texture has been insanely reduced in it's size and repeated infinitely across the model's faces. (yeah, I am using GL_REPEAT on that texture wrap thing)

What I noticed is that if I get all these coordinates and divide them by 10 or 100 I get a much "normal" look, but still not in the 0.0 to 1.0 range.

Here's my json file: http://pastebin.com/Aa4wvGvv

Here are my GLSL Shaders: http://pastebin.com/DR4K37T9

And here is the .X file exported by SketchUp: http://pastebin.com/hmYAJZWE

I've also tried to draw this model using XNA, but still not working. Using this HLSL shaders: http://pastebin.com/RBgVFq08

I tried exporting the same model to different formats, collada, fbx, and x. All those yields the same thing.

sentences:
Betatesting an android game. Best practices? Our game is in our final stage prior to be released. I would like at this stage to add some beta testers to let them hunt bugs, etc... Is there any good platform/site to achieve this? I have noticed there's a site called betalizer but they still are in beta.

Could anyone suggest how to find beta testers for a little-medium size android game without spending a lot of bucks or any platform that could help on it?

Thanks in advance.

sentences:
Are native code obfuscations needed to prevent piracy of Android games? Is the copyright protection and enforcement of Android apps written in Java sufficient or should I be relying on a native implementation to use machine code obfuscating techniques in order to prevent piracy of my game?

Please provide an answer with supporting examples of games which use either technique.

sentences:
What's the difference between Mathf.Lerp and Mathf.SmoothDamp I want to smoothly go from one value to a new one (moving a slider or changing color). I tried using both functions and they all basically give the same result. What is the difference between them and which one should I use?

How I used SmoothDamp:

    // Show the HUD
private IEnumerator ShowHUD() {
    var HUDCanvasGroup = GameObject.FindWithTag("HUD").GetComponent<CanvasGroup>();
    var alphaValue = 1f;
    var velocity = 0f;
    var time = 0.30f;

    yield return new WaitForSeconds(1.5f);

    // Gradually fade in the canvas
    while (!Mathf.Approximately(HUDCanvasGroup.alpha, alphaValue)) {
        HUDCanvasGroup.alpha = Mathf.SmoothDamp(HUDCanvasGroup.alpha, alphaValue, ref velocity, time);
        yield return null;
    }

    HUDCanvasGroup.alpha = 1; // Since float is not accurate, manually set the alpha to 1 after
    HUDCanvasGroup.interactable = true;

    var blur = GameObject.FindWithTag("BlurryCamera").GetComponent<BlurOptimized>();
    blur.enabled = true;
}

How I used Lerp:

public static IEnumerator Dim() {
    while (t < 1) {
        t += Time.deltaTime / 0.4f;
        dimRend.material.color = Color.Lerp(undimColor, dimColor, t);
        yield return null;
    }
}

sentences:
Stopping Animations For Player In Java Using Slick2D I have a problem with stopping animations for a player in Slick2D. I have tried many solutions to the problem and have looked up a couple of resources but I am still stumped by the fact that it is not working. Here's the code I have for my class:

public SpriteSheet playerSS = null;
protected InputHandler inputHandler;
public float playerX, playerY = 250f;
private Animation sprite, runningAnimationLEFT, runningAnimationRIGHT, runningAnimationUP, runningAnimationDOWN;
private int duration = 200;

public Game (int stateID) {

}

@Override
public int getID() {
    return Main.game; //GAMESTATE = 1
}

@Override
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
    playerSS = new SpriteSheet("res/player_sprite_sheet.png", 50, 75);

    // ANIMATIONS
    runningAnimationDOWN = new Animation();
    runningAnimationDOWN.setAutoUpdate(true);
    runningAnimationDOWN.addFrame(playerSS.getSprite(1, 0), duration);
    runningAnimationDOWN.addFrame(playerSS.getSprite(0, 0), duration);
    runningAnimationDOWN.addFrame(playerSS.getSprite(2, 0), duration);

    runningAnimationLEFT = new Animation();
    runningAnimationLEFT.setAutoUpdate(true);
    runningAnimationLEFT.addFrame(playerSS.getSprite(1, 1), duration);
    runningAnimationLEFT.addFrame(playerSS.getSprite(0, 1), duration);
    runningAnimationLEFT.addFrame(playerSS.getSprite(2, 1), duration);

    runningAnimationRIGHT = new Animation();
    runningAnimationRIGHT.setAutoUpdate(true);
    runningAnimationRIGHT.addFrame(playerSS.getSprite(1, 2), duration);
    runningAnimationRIGHT.addFrame(playerSS.getSprite(0, 2), duration);
    runningAnimationRIGHT.addFrame(playerSS.getSprite(2, 2), duration);

    runningAnimationUP = new Animation();
    runningAnimationUP.setAutoUpdate(true);
    runningAnimationUP.addFrame(playerSS.getSprite(1, 3), duration);
    runningAnimationUP.addFrame(playerSS.getSprite(0, 3), duration);
    runningAnimationUP.addFrame(playerSS.getSprite(2, 3), duration);

    sprite = runningAnimationDOWN;
}

@Override
public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int delta) throws SlickException {
    inputHandler.updateKeyboardRelay(gameContainer);
    if (inputHandler.keyUP) {
        sprite = runningAnimationUP;
        sprite.update(delta);
        playerY -= delta * 0.1f;
    } else {
        // Stopping Animation goes here.
    }
    if (inputHandler.keyDOWN) {
        sprite = runningAnimationDOWN;
        sprite.update(delta);
        playerY += delta * 0.1f;
    } else {
        // Stopping Animation goes here.

    }
    if (inputHandler.keyLEFT) {
        sprite = runningAnimationLEFT;
        sprite.update(delta);
        playerX -= delta * 0.1f;
    } else {
        // Stopping Animation goes here.

    }
    if (inputHandler.keyRIGHT) {
        sprite = runningAnimationRIGHT;
        sprite.update(delta);
        playerX += delta * 0.1f;
    } else {
        // Stopping Animation goes here.

    }
}

@Override
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
    sprite.draw(playerX, playerY);
}

How would I go about stopping the animation from playing over and over again once the movement key is lifted? i.e. If someone presses the 'W' key the player does an animation going upwards, but if the user stops using the 'W' key how would I make it so that the animation stops playing as well?

sentences:
Why players who join late can't see other people data? I want to show the name of the players above their head but I have a problem where people joining late doesn't get other players' name.
For example:

Player 1 joins to the server with the name Peter.
Player 2 joins to the server with the name Josh.
Peter (Player 1) sees Josh's name perfectly, but when Josh joins Peter's name is not synchronized correctly.

My sync code looks something like this:
[SyncVar] private string NAME;
public override void OnStartClient(){
    if(networkPlayerData is null)
    {
        networkPlayerData = BTNetworkController.Controller.playerData;
        NAME = BTNetworkController.Controller.playerData.Name;
    }
    SendPlayerNameToServer(NAME);
}
[Command]
private void SendPlayerNameToServer(string name)
{
    RpcSetPlayerName(name);
}

[ClientRpc]
void RpcSetPlayerName(string name)
{

    gameObject.GetComponentInChildren<TMP_Text>().text = name;
}

So my question is how can I sync data to newly joined players and refresh player names accordingly.

sentences:
How to improve my maxscript random blood generation code? The idea was simple. Draw basic blood drop meshes. Shuffle them with random generator to get final drop's. Export and render them in game as other meshes.

The problem is that it's not looks like a blood drop, but a rocks.

What is the best way to improve this? Redraw basic drops? Apply some modifier to final drop mesh? But what modifier? How to smooth borders in final drop mesh? I am totally stuck with this. The improvment must be codeable in MAXSCRIPT, not a manual correction of mesh, because I am a programmer not 3D modeller.

The generator final result screenshot.

Final blood drop:

P.S. For those who would like to test generator manually here it goes the prooflink. Works nice at 2010 version.

sentences:
What is the line between a serious game and an application with points? Gamification has become a buzz word lately and is being applied to everything from applications to meetings.  In many cases it is being done as an afterthought and sort of game-washing.

What are the key differences between something having real game dynamics and simply being a superficial gamification layer?  Where is the line between a serious game and an application with points?

sentences:
How do I make a character follow behind another? I'm creating a game in C++ using OpenGL. I want to add a character into my game who, after meeting the main player, follows the player around. The follower should position themselves directly behind the player, moving when the player does to stay in the correct position:

How can I accomplish this?

sentences:
Grouping units in world space I figure that I intend to generate, for group orders, one optimal path, and then use a flocking algorithm to "glue" the units together as they all follow this one optimal path. However, a naive implementation would fail if, for example, the units were ordered from two distinct locations- two optimal paths would have to be computed. So for a group of units, I need to group them into subgroups which can all share the same optimal path.

At the moment, what I'm thinking is to pick an arbitrary unit in the group, and then pick all units in a certain, relatively small radius. Then for every unit in that radius, I increase the radius.

Are there any existing algorithms for grouping units into subgroups?

sentences: Capturing small details in textures without making a huge map Ex. Nuts and bolts on a cabinet. Said items are tiny relative to the cabinet, and on a texture map looks like an indistinguishable dot. Is it worth it to separate these tiny details into a mesh of their own? Obvious cons are increasing poly count and draw calls, disregarding how much of an increase that would be. Is there a generally accepted way of going about this?

sentences:
Unity3D smooth movement with joypad button press First off, I'm sorry this is such a silly question, but for the life of me I can't seem to get it to work. And I've just spent the last hour trying to do so.

All I want to do is have my camera move up, in a smooth fashion, when I press the shoulder button on my joypad. I have it so that when I press the button, it jumps up. Not in a smooth movement.

The code I have is as follows:

    float _maxY = 0.0f;
    if (Input.GetKeyDown(KeyCode.Joystick1Button5))
   {
      _maxY++;
      transform.Translate(0, _maxY, 0);
   }

This is found within my update function. I've been looking for the answer to this for hours now, but can't find anything. Can anyone please help me?

sentences:
How to add a collision function to a game Ive tried a few things but i cant get a working function  if player collides with object set speed to 0( stop moving)

ive tried to use the function under  "game over " and change the things to make speedx=0 and speedy=0 but i couldnt format it correctly.

https://www.w3schools.com/graphics/game_obstacles.asp

my  code:

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

use the arrow keys on you keyboard to move the red square.

https://jsfiddle.net/tmanrocks999/e6w9br2s/178/

I expect when the player hits the obstacle for them to stop moving. but at the moment they go through it/ i have 1 && that prevents it from going past the x location of obstacle but that doesn't work right

sentences:
How to make a TCP Client Server in java over multiple Networks So I am trying to write server code for my game, and I am kinda running in a wall. I have seen oracles example for a server and client, but how do I allow it to connect to computers outside my network? Pretty much I'm trying to do the following

Client presses a key to move 1 unit to the left, the server receives the Client's input, checks if any modification is made, if there is send Client back to where they started.

The problem I have is how do I connect a Server and Client on separate internet connections?

sentences:
Is precomputed pathfinding still relevant? Context

Old Lucas Arts (ScummVM era) point and click graphic adventure games used precomputed pathfinding. Here's a rough outline of the technique.

Step 1

The floor in each room was divided into what they called "walk boxes", which were pretty much equivalent to nodes in a navigation mesh, but limited to trapezoid shapes. E.g:

 ______ _____ _________ _____
\   A  |  B  |    C    |  D   \
 \_____|     |         |_______\
       |_____|         |
             |_________|

Step 2

An offline algorithm (e.g. Dijkstra or A*) would calculate the shortest path between each and every pair of nodes, and store the first step of the path in a 2D matrix, indexed in each dimension by the starting and ending node used. E.g. using the walk boxes above:

      ___ ___ ___ ___
     | A | B | C | D | <- Start Node
  ___|___|___|___|___|
 | A | A | A | B | C |  ---
 |___|___|___|___|___|     |
 | B | B | B | B | C |     |
 |___|___|___|___|___|     |-- Next node in shortest path
 | C | B | C | C | C |     |   from Start to End
 |___|___|___|___|___|     |
 | D | B | C | D | D |  ---
 |___|___|___|___|___|
   ^
   |
End Node

As you may guess, the memory requirements increase quickly as the number of nodes increase (N^2). Since a short would usually be large enough to store each entry in the matrix, with a complex map of 300 nodes that would result in storing an extra:

300^2 * sizeof(short) = 176 kilobytes

Step 3

On the other hand, calculating the shortest path between two nodes was extremely fast and trivial, just a series of lookups into the matrix. Something like:

// Find shortest path from Start to End
Path = {Start}
Current = Start
WHILE Current != End
    Current = LookUp[Current, End]
    Path.Add(Current)
ENDWHILE

Applying this simple algorithm to find the shortest path from C to A returns:

1) Path = { C }, Current = C
2) Path = { C, B }, Current = B
3) Path = { C, B, A }, Current = A, Exit

Question

I'm suspecting that with today's powerful hardware, coupled with the memory requirements of doing this for every level, any benefits this technique once had are now outweighted by simply performing an A* at runtime.

I've also heard that nowadays memory lookups might even be slower than general computation, which is why creating sine and cosine look up tables is not as popular anymore.

But I must admit I'm not yet too knowledgeable on these matters of low-level hardware efficiency though, so I'm taking this chance to ask the opinion of those more familiar with the subject.

On my engine I also needed the ability to dynamically add and remove nodes to the graph at runtime (see this) so the precomputed route only made things more complicated, so I scrapped it (not to mention my runtime A* solution was already running perfectly). Still, I was left wondering...

Bottom line, is this technique still relevant nowadays in any scenario?

sentences:
How can I standardize ping? I hear pros playing Fortnite that have 20-50 ping complain that they cannot perform as well as pros with 0 ping due to wall taking, etc. It's easy to think that a 20ms ping difference is negligible but it is not in competitive situations.

It seems to me that it should be possible to standardize a lobby's ping to the current maximum player's ping at any given moment. Obviously in a competitive game like Fortnite, the worst ping a pro player can have is generally 50-60 ping.

This solution would involve psuedo latency. For example, in competitive Fortnite, if the worst ping among the players is 50, then all players will be forced to also have 50 ping by inducing an artificial server response delay. This would allow no single player to have an advantage based on internet connection.

How could I implement a feature like this, to provide a level playing field?

sentences:
Designing the Update system (read very basic game engine) for an XNA game I am trying to determine the best way to implement the "update" system or engine for a simple XNA game.

Description of situation

I have a few classes, lets call them:

Player [will be an array/list/collection of 1-4 local players]
Enemy [will consist of all enemy characters in the given "zone"]
Future [not implemented, may not be implemented for this game, but may be needed in future]
Future

I'm trying to decide what the best way to manage this will be, I'm going back and forth between a couple options.

First Approach

In the Update() method of my game, write code like this:

void Update(GameTime gameTime)
{
    var ctlInput = GetControllerInput();
    for(int i = 0; i < 4; i++)
    {
        if(Player[i] != null) { Player[i].Update(gameTime, ctlInput); }
    }

    for(int i = 0; i < Enemy.Count; i++)
    {
        Enemy[i].Update(gameTime, Player);
    }
}

In this version, I would add "FrameStatus" fields to the Player class, which would look like bool IsShooting and Vector2 TargetedLocation etc. This also means that each class would be responsible for knowing how to update itself in the game world.

In my eyes, the advantages of this approach are:

No new classes.
Classes become self-documenting
Easy to extend and add additional properties

but the disadvantages are:

Order of code in Game.Update is very important
Tight coupling of Player and Enemy classes

Second Approach

Implement a type of UpdateManager class, which accepts the user input, and it alone updates the Player and Enemy classes. This would relegate the Player and Enemy classes to simply dumb-data classes, and they wouldn't necessarily have any game logic in them at all.

void Update(GameTime gameTime)
{
    var ctlInput = GetcontrollerInput();
    updateManager.Update(gameTime, ctlInput);
}

The advantages of this approach, in my eyes, are:

Keeps code away from Game.Update()
Doesn't require Player and Enemy classes to know about each other at all

Disadvantages as I see it:

Adds a new class to my game
The new class, will have a lot of code as time goes on and more types of objects enter the game world

Actual Question

Of the pro/cons I've come up with for my two approaches,

do you think I've missed any, what are they?
which makes you lean for or against an approach, why?

Which approach would you take, and also why would you go that route? Would you elect for a third option? What would that option look like?

sentences:
How to choose how to store data? Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
  - Chinese Proverb

I could ask what kind of data storage I should use for my actual project, but I want to learn to fish, so I don't need to ask for a fish each time I begin a new project.

So, until I used two methods to store data on my non-game project: XML files, and relational databases. I know that there is also other kind of database, of the NoSQL kind. However I wouldn't know if there is more choice available to me, or how to choose in the first place, aside arbitrary picking one.

So the question is the following: How should I choose the kind of data storage for a game project?

And I would be interested on the following criterion when choosing:

The size of the project.
The platform targeted by the game, as well as the development platform used.
The complexity of the data structure.
Added Portability of data amongst many project.
Added2 Silmutaneous use of the data amongst different project. (i.e. User data)
Added How often should the data be accessed
Added Multiple type of data for a same application
Added2 Configuration with multiple data storage.
Any other point you think is of interest when deciding what to use.

EDIT I know about Would it be better to use XML/JSON/Text or a database to store game content?, but thought it didn't address exactly my point. Now if I am wrong, I would gladely be shown the error in my ways.

EDIT2 Added some more points that I would consider relevant. Furthermore, I would be interested to hear what other options are available, aside flat file storage and relational database. What about non-relational database, for example? When it is relevant to use such a database over the formerly mentioned other options?

sentences:
Entity system and rendering types I would like to implement entity system in my game and I've got some question about entity system and rendering.

Currently, my renderer got two types of elements:

Current design

Mesh   : A default renderable with a Material, a Geometry and a Transformable
Sprite : A type of mesh with some methods like "flip" and "setRect" methods and a rect member (With an imposed geometry, a quad)

This objects inherit from "Spacial" class.

Questions:

How can I handle this two types in an entity system?
I'm thinking about using "MeshComponent" and "SpriteComponent", but if I do that, an entity could have a Mesh and a Sprite at the same type, it's look stupid, right?

I thought the idea to have a parent "rendering" component : "RenderableComponent" for "MeshComponent" and "SpriteComponent" but it will be difficult to handle "cast" in the game (ex: did I need to ask entity->getComponent or SpineComponent, …)

Thanks a lot for reading me!

My entity system work like that:

---------------------------------------------------------------------------
Entity* entity = world->createEntity();

MeshComponent* mesh = entity->addComponent<MeshComponent>(material);
mesh->loadFromFile("monkey.obj");

PhysicComponent* physic = entity->addComponent<PhysicComponent>();
physic->setMass(5.4f);
physic->setVelocity( 0.5f, 2.f );
---------------------------------------------------------------------------
class RenderingSystem
{
    private:
        Scene scene;
    public:
        void onEntityAdded( Entity* entity )
        {
            scene.addMesh( entity->getComponent<MeshComponent>() );
        }
}

class PhysicSystem
{
    private:
        World world;
    public:
        void onEntityAdded( Entity* entity )
        {
            world.addBody( entity->getComponent<PhysicComponent>()->getBody() );
        }

        void process( Entity* entity )
        {
            PhysicComponent* physic = entity->getComponent<PhysicComponent>();
        }
}

---------------------------------------------------------------------------

sentences:
Is it possible to control what script is active on what sprite/object in Unity? I have 2 objects, and I have a script which makes the player change their characteristics. I applied the script to both, and as you'd expect, pressing X button does the color, size, translation change effect on both objects at the same time.

Now how can I give the player the choice thanks to a key input, to be able to choose which item to apply the script to?

I am trying to make it work like a toggle..

if (toggle == 1) { // player can only change color of item 1 }

else if (toggle == 0) { //player can only change color of item 2 }

So what's the syntax to be able to select if a script is enabled or not on 2 different sprites?

sentences:
Technique to find a mesh intersecting with a primitive solid without using colliders? For what it's worth I'm using Unity3d, but I believe the problem is more general.

There are hundreds if not thousands of meshes with hundreds of vertices each.
There is one sphere that can be intersecting any of those meshes and is constantly moving.

Are AABB colliders approximating the mesh's volume the best way to go about this? Or is there a more specific technique that can be used here?

(A limitation I have is that my colliders need to be rotated, so they're each stored in a game object, so the number of game objects becomes absurdly large for my meshes(tens of thousands) which is slowing down my game.)

I have a couple of properties unique to my situation I believe might allow me to ditch colliders:

I don't care about the meshes colliding with each other. Just the one sphere.
I only need to know that the intersection exists, I don't care about the point of the intersection or any other metadata. Just a boolean of the intersection occuring and what mesh it happened with.
I don't need to know the exact moment/frame when the intersection occurs. If I can find out an intersection occurred within 100-200ms/20-30 frames of it happening it'll be fine.

sentences:
How to draw text with characters rendered in reverse order in a Godot game? I need to have some text showing up in my Godot game in a way that each character overlaps the character directly to its right, like so:
     -- ---    -- --
   /  /     \ |  |  |
  /  /       \|  |  |
 /  /  /---\  \  |   ----
/  /  /  \  \  \ |       |
-- --     -- -- - -------

Using a BMFont (.fnt) in a Label node with the values of xadvance specified in the font smaller than the characters width I get this:
     -- ---    -- --
   /  /     \ |  |  |
  /  /       \|  |  |
 /  /  /---\  |  |   ----
/  /  /  \  \ |  |       |
-- --     -- -- - -------

What approach can I use to still be able to use my .fnt font and also store the text with the characters in their natural order, as it would be stored for using with a normal Label or Button control? Which would help for language localization purposes.

sentences:
Incorrect frustum culling with center/half-size AABB I'm trying to implement an axis-aligned bounding box with center/half-size instead of min/max. And I have some problems when it comes to create a method to detect if the aabb is visible or not.

I try to do the same as on this website at "Method 5": http://fgiesen.wordpress.com/2010/10/17/view-frustum-culling/. I'm trying to implement this formula:

  return dot3(center + extent * signFlip, plane) > -plane.w;

But it doesn't work at all and I don't find what's going wrong. Objects in my scene seems to appear and disappear in a strange way, sometimes appears when I'm not watching them or disappears when frustum faces them (I look at draw calls to determine if the isVisible test returns true or false).

Here is my code:

The Axis-aligned bounding box

public sealed class AxisAlignedBox
{
    public Vector3 Center;
    public Vector3 HalfSize;
}

The method in the frustum that tests if the aabb is visible or not:

public bool Intersects(AxisAlignedBox aabb)
    {
        Vector3 v;
        float d;

        Vector3.Multiply(ref aabb.HalfSize, ref _signPlane[0], out v);
        Vector3.Add(ref aabb.Center, ref v, out v);
        Vector3.Dot(ref v, ref _planes[0].Normal, out d);
        if (d > -_planes[0].D) return true;

        Vector3.Multiply(ref aabb.HalfSize, ref _signPlane[1], out v);
        Vector3.Add(ref aabb.Center, ref v, out v);
        Vector3.Dot(ref v, ref _planes[1].Normal, out d);
        if (d > -_planes[1].D) return true;

        Vector3.Multiply(ref aabb.HalfSize, ref _signPlane[2], out v);
        Vector3.Add(ref aabb.Center, ref v, out v);
        Vector3.Dot(ref v, ref _planes[2].Normal, out d);
        if (d > -_planes[2].D) return true;

        Vector3.Multiply(ref aabb.HalfSize, ref _signPlane[3], out v);
        Vector3.Add(ref aabb.Center, ref v, out v);
        Vector3.Dot(ref v, ref _planes[3].Normal, out d);
        if (d > -_planes[3].D) return true;

        Vector3.Multiply(ref aabb.HalfSize, ref _signPlane[4], out v);
        Vector3.Add(ref aabb.Center, ref v, out v);
        Vector3.Dot(ref v, ref _planes[4].Normal, out d);
        if (d > -_planes[4].D) return true;

        Vector3.Multiply(ref aabb.HalfSize, ref _signPlane[5], out v);
        Vector3.Add(ref aabb.Center, ref v, out v);
        Vector3.Dot(ref v, ref _planes[5].Normal, out d);
        if (d > -_planes[5].D) return true;

        return false;
    }

_signPlane is an array of Vector3 using the following formula and applied for each plane once per frame when the frustum is updated:

        public static void Sign(ref Vector3 v, out Vector3 result)
    {
        result.X = Math.Sign(v.X);
        result.Y = Math.Sign(v.Y);
        result.Z = Math.Sign(v.Z);
    }

sentences:
Trying to implement Camera I'm trying to implement a Camera class in order to walk and look on the world as follow:

#ifndef _CAMERA_H_
#define _CAMERA_H_

#include <glm\glm.hpp>

class Camera
{
public:
    Camera();
    ~Camera();

    void Update(const glm::vec2& newXY);
    //if by = 0.0 it means, it will use the const Class speed to scale it
    void MoveForward(const float by = 0.0f);
    void MoveBackword(const float by = 0.0f);
    void MoveLef(const float by = 0.0f);
    void MoveRight(const float by = 0.0f);
    void MoveUp(const float by = 0.0f);
    void MoveDown(const float by = 0.0f);
    void Speed(const float speed = 0.0f);

    glm::vec3& GetCurrentPosition();
    glm::vec3& GetCurrentDirection();
    glm::mat4 GetWorldToView() const;
private:
    glm::vec3 position, viewDirection, strafeDir;
    glm::vec2 oldYX;

    float speed;
    const glm::vec3 up;
};

#endif

#include "Camera.h"
#include <glm\gtx\transform.hpp>

Camera::Camera()
    :up(0.0f, 1.0f, 0.0), viewDirection(0.0f, 0.0f, -1.0f),
    speed(0.1f)
{
}

Camera::~Camera()
{
}

void Camera::Update(const glm::vec2& newXY)
{
    glm::vec2 delta = newXY - oldYX;
    auto length = glm::length(delta);
    if (glm::length(delta) < 50.f)
    {
        strafeDir = glm::cross(viewDirection, up);
        glm::mat4 rotation = glm::rotate(-delta.x * speed, up) *
            glm::rotate(-delta.y * speed, strafeDir);

        viewDirection = glm::mat3(rotation) * viewDirection;
    }

    oldYX = newXY;
}

void Camera::Speed(const float speed)
{
    this->speed = speed;
}

void Camera::MoveForward(const float by)
{
    float s = by == 0.0f ? speed : by;

    position += s * viewDirection;
}
void Camera::MoveBackword(const float by)
{
    float s = by == 0.0f ? speed : by;

    position += -s * viewDirection;
}
void Camera::MoveLef(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * strafeDir;
}
void Camera::MoveRight(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * strafeDir;
}
void Camera::MoveUp(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += s * up;
}
void Camera::MoveDown(const float by )
{
    float s = by == 0.0f ? speed : by;
    position += -s * up;
}

glm::vec3& Camera::GetCurrentPosition()
{
    return position;
}
glm::vec3& Camera::GetCurrentDirection()
{
    return viewDirection;
}

glm::mat4 Camera::GetWorldToView() const
{
    return glm::lookAt(position, position + viewDirection, up);
}

and I update and render as follow :

void Game::OnUpdate()
{
    glLoadIdentity();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glUniformMatrix4fv(program->GetUniformLocation("modelToViewWorld"), 1, GL_FALSE, &cam.GetWorldToView()[0][0]);

}

void Game::OnRender()
{

    model->Draw();

}

Which the Vertix shader is:

#version 410

layout (location = 0) in vec3 inVertex;
layout (location = 1) in vec2 inTexture;
layout (location = 2) in vec3 inNormal;

uniform mat4 modelToViewWorld;

void main()
{
        gl_Position    = vec4(mat3(modelToViewWorld) * inVertex, 1);

}

But in result the model itslef is moving/rotating instead of moving the camera around the model. What am I doing wrong here?

sentences:
Camera to the right from the character I'm trying to create a camera like in Fortnite or Gears of War. It's focus must be to the right side from the character:

But when I rotate the camera, the character slightly shivers. Lerping and multiplying by Time.deltatTime doesn't help.

This is my code:

    using UnityEngine;

    [RequireComponent(typeof(Camera))]

    public class ThirdPersonCamera : MonoBehaviour
    {
        [Header("Sensitivity")]
        [SerializeField] private float xSensitivity;
        [SerializeField] private float ySensitivity;

    [Header("Limit angles")]
    [SerializeField] private float upLimit;
    [SerializeField] private float downLimit;

    [Header("Positioning")]
    [SerializeField] private Vector3 offset;
    [SerializeField] private float maxDistanceFromPlayer;
    [SerializeField] private Transform player;

    private float rotationAboutX;
    private float rotationAboutY;

    // Start is called before the first frame update
    void Start()
    {
        rotationAboutX = transform.localEulerAngles.x;
        rotationAboutY = transform.localEulerAngles.y;
    }

    void Update()
    {
        rotationAboutX -= Input.GetAxis("Mouse Y") * ySensitivity;
        rotationAboutY += Input.GetAxis("Mouse X") * xSensitivity;

        rotationAboutX = Mathf.Clamp(rotationAboutX, downLimit, upLimit);
    }

    // Adjust camera position.
    void LateUpdate()
    {
        Vector3 direction = new Vector3(0.0f, 0.0f, -maxDistanceFromPlayer);
        Quaternion rotation = Quaternion.Euler(rotationAboutX, rotationAboutY, 0);
        // Point to look at in the runitme.
        Vector3 focus = player.position + transform.TransformDirection(offset);

        // Rotate vector according to mouse inputs.
        transform.position = focus + rotation * direction;

        transform.LookAt(focus);
    }
}

It shivers only if offset is not zero. Otherwise it's ok.

sentences:
What to pass to scripting I am using Java and libgdx to create a game and have decided to go a data driven approaching with Jython for this refactoring (just picked up Jython, have used Java for a while). The game is a turn/tile based game where each ability will store prototype values and references to other scripts to actually execute the mechanics. I am hardcoding basic mechanics such as changing health, moving units between tiles, placing (de)buffs on units/tiles, and turn order. Everything else will be handled in softcode like deciding where to actually deal damage for aoe, how much damage to deal, what the buff behavior is, etc. I understand ideally I would script the entire game, except for things like rendering and I/O. But this is a solo project, and I don't really care.

Previously in development I hardcoded all the abilities. When an ability was casted it would call a function with the targeted tile and the entire gameboard. The function would then find the proper locations/objects on the gameboard and manipulate their state directly. However, I recognize this is terrible design. I figure some sort of API system would be better. But I am unsure how to design it.

API gives references to the objects on gameboard and gamestate variables directly. Scripts can manipulate the objects. Seems straightforward, but unsafe with possible illegal operations like moving a piece to a location that does not exist. Scripts could also be written to error check, but that seems counter productive to the idea of scripting.
APIs only give values of objects and gamestates. This may cause the script to need many variables that are normally grouped into one object, or to reconstruct the object. Also API could pass a purely data object. API calls are then also used back to the hardcode to manipulate the object. Safer as hardcode could easier contain illegal operation checking and debugging. But I guess I should learn debugging in Jython also. Also seems like a high memory overhead and extra API calls.
A mix of 1 and 2. The APIs give scripts references to the objects directly, but the scripts can only get data out of the objects. Any manipulation must be done through an API call. So scripts could use getHealth(), but not setHealth(var). I have no idea of this is even possible. I like this solution the best, but it seems a little convoluted.

sentences:
How to implement mutable functionality at runtime? I am making a game in which the player character can gain traits that change how their character behaves in my world model or add functionality to it. For example, the character might gain the "feather" trait that changes how fall damage is calculated or the "strong" trait that means the player can now pick up items that were previously just part of the scenery.

I have been hard coding traits in their relevant classes and switching a boolean to change behavior when they come into play, but it is getting rather unmanageable as my trait list grows.(I am also missing out on a lot of the emergence I was hoping to get) There must be a more scalable and decoupled way of doing this.

How would you code such a feature where code behavior changes or expands at runtime? If you are not inclined to do my work for me, which programming patterns would you use to achieve this kind of behavior?

sentences:
How can I make a character crouch? I tried to make a crouch system. In my script I changed .height and .center properties of collider in CharacterController component. But there are some problems. First, once I press "crouch button" collider is changing its height and center position but when I release the key the collider isn't returning to its previous state. Secondly, if I change its height and position by hand when collider is under a block, it's just stuck. How can I fix this problem?

Here's my script:

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

[RequireComponent(typeof(CharacterController))]
public class PlayerController : MonoBehaviour {

    public float moveSpeed;
    public float jumpForce;
    public CharacterController controller;
    public GameObject myCamera;

    private Vector3 moveDirection = Vector3.zero;
    public float gravityScale;

    public Animator anim;

    // Use this for initialization
    void Start () {
        transform.tag = "Player";
        controller = GetComponent<CharacterController>();
    }

    // Update is called once per frame
    void Update () {
        Vector3 forwardDirection = new Vector3 (myCamera.transform.forward.x, 0, myCamera.transform.forward.z);
        Vector3 sideDirection = new Vector3(myCamera.transform.right.x, 0, myCamera.transform.right.z);
        forwardDirection.Normalize ();
        sideDirection.Normalize ();
        forwardDirection = forwardDirection * Input.GetAxis("Vertical");
        sideDirection = sideDirection * Input.GetAxis("Horizontal");
        Vector3 directFinal = forwardDirection + sideDirection;

        if (directFinal.sqrMagnitude > 1)
        {
            directFinal.Normalize ();
        }

        if (controller.isGrounded)
        {
            moveDirection = new Vector3(directFinal.x, 0, directFinal.z);
            moveDirection *= moveSpeed;
            if (Input.GetButtonDown("Jump"))
            {
                moveDirection.y = jumpForce;
            }

            if(Input.GetButtonDown("Crouch"))
            {
                controller.height = 1f;
                controller.center = new Vector3(0f, -0.5f, 0f);
                moveSpeed = 3f;
            }
        }
        moveDirection.y = moveDirection.y + (Physics.gravity.y * gravityScale * Time.deltaTime);
        controller.Move(moveDirection * Time.deltaTime);

        anim.SetBool("isGrounded", controller.isGrounded);
        anim.SetFloat("Speed", (Mathf.Abs(Input.GetAxis("Vertical")) + Mathf.Abs(Input.GetAxis("Horizontal"))));
    }
}

Thanks for any help!

sentences:
Problem making shooting follows an actor/object At first I created an actor to be a projectile, he acts with a simple projectile. When generated it goes straight, anyway...

To do this, I added the Projectile Movement component.

It turns out that I wish this projectile did not go straight ahead simply, I would like it to be generated when it came to a minion.

Then my problems began, because being simply an actor, it seems that he can not move with the Simple Move to Actor/Location function.

I created 3 sockets:

One for each shot/projectile I was going to test.

Shooter Blueprint:

The Event Atirar causes the 3 shots/projectiles I created to be generated (TiroActor, TiroCharacter and TiroPawn).

TiroActor Blueprint:

TiroCharacter Blueprint:

TiroPawn Blueprint:

I wish that when they were generated, they would go towards the only existing minion in the game, but this does not happen:

The Tiro Actor goes straight, and nothing makes it stop (I activated the "call in editor" option for the Event Andar, but it does not match).

The Tiro Character falls to the ground and does nothing, but corresponds when I call the Event Andar manually:

The Tiro Pawn is not even generated...

I modified the "Auto Posses AI" option of Tiro Character and Tiro Pawn to Placed in World or Spawned.

I removed the gravity of all the components of the Tiro Character, but even so when generated it falls to the ground.

I would like to know how to make an object (be it actor, pawn or character) when it is generated follow the target (in this case a minion) until it collides with it.

EDIT 1 (complement)

If it was difficult to understand, I'd like to know how to do something like an AA from a Clash of Clans archer, even a champion AA that attacks from a distance, whether from Dota or LOL.

The projectile of the Dota/LOL tower would be a good example. A guided missile too...

sentences:
How minecraft manages interactable blocks (Chest)? I am wondering, how does minecraft handle blocks like chest?

I guess normal blocks are ids in simple array, but how does it store and references blocks with special behaviour?

sentences:
How do I determine which card is underneath the currently-dragged card in a card game? I'm developing a card game. My custom control works great, but I need help to solve this:

When I move a card (my custom control) over another card I need to know which card is underneath. Once I know that, I'll be able to put in logic for game rules.

EDIT

I'd like to have some event in cardcontrol like: OnOtherCardControlOver() but I have some difficulty to figure it out.

sentences:
What should I use (controls, methods) to make a 2D tile based map editor? I'm making a 2d game where each tile is a square and it's viewed at straight angle, no skewing, no rotation, it's pretty simple.

Two weeks ago I tried using DataGridView, but as the number of rows and columns increased, it became frustratingly slow, then I read how it should've happened to me earlier, because this control is not supposed to work with large number of cells, and I have at least 7500 cells in my smallest level, which made it unbearable to use.

This is what I expect from my new editor:
Most importantly, tile type. Tile images or their color codes are fine (seeing map as it is in-game is cool, but the faster, the better).

Secondly, all tile parameters (in text, preferrably editable in a popup or sidebar).

I'm using my own format, so I'm most probably not going to use third party product. Besides, I'm trying to learn how to do it myself.

sentences:
collideWith Call Back Method In my class, I extend Sprite class. I override one of the method collideWith(). But my problem was that when current sprite collide with other sprite it does not call the call back method collideWith(). Here is my implementation.

@Override
public boolean collidesWith(IShape pOtherShape) {
    System.out.println("collide with called");
    return true;
}

Any member please help me.

sentences:
How to draw a polygon with picture in libgdx? I'm working around a simple rectangle game, It just split the rectangle in to a lot of polygon debris. I use Pixmap and Texture to draw the edges of each polygon.

...
 for (GraphEdge e: _edges) {
    pixmap.drawLine((int) e.x1, (int) e.y1, (int) e.x2, (int) e.y2);
 }
...
@Override//In an actor class
public void draw(Batch batch, float parentAlpha) {
    region = new TextureRegion(new Texture(pixmap));
    region.setRegionWidth((int)width+1);
    region.setRegionHeight((int)height+1);
    batch.draw(region, this.getX(), this.getY());
}

it works well,but I want to add some pictures to adjust those polygons to make it looks better than some tedious lines, how should I implement it?

sentences:
Get all supported resolutions for a monitor I've been receiving complaints from users that my game doesn't support the 16:10 aspect ratio.
Currently I list everything in Screen.resolutions in a dropdown and allow the user to pick from that. I have since come to the understanding that the first element is not necessarily the native resolution of the monitor.
I've found the Display class but this appears to only give the native resolution, not all scaled resolutions. E.g. if the monitor is 1920x1080 then I need a list of 1600x900, 1280x720, 640x360 etc.
I thought about just multiplying by some scale factor but then I'm afraid I'll get something obscure like 885x497.8. And if I have a pre determined list of resolutions for a specific aspect ratio, how do I support obscure aspect ratios like widescreen for example.

sentences:
2d side scroller slope physics and collisions In old 2d games such as double dragon, streets of rage etc. where the player could move “up and down” on the y-axis to give an illusion of depth (as opposed to something like Mario) how were slopes and stairs handled along different points on the y-axis to give the appearance of still moving in a straight line?

For instance in the above picture would you set collision masks where the green lines are? Then imagine the characters are the red and blue lines respectively, how would you handle them in effect being moved “down” by gravity when in fact there isn’t really any gravity? For the top line I assumed when it hit the green line, rather then stopping or bouncing back on the x-axis you’d just nudge them down and continue the x movement?

I understand how this could be completed in 3D but I’m perplexed how this would’ve been achieved in purely 2d environments. Or maybe I’m imagining slopes/stairs in these old games...

I’m working in SpriteKit, so any ideas specific to that would be great but just understanding how this was accomplished theoretically in the first instance would be great.

Thanks

edit - after some thinking I don't think my 'collision' theory would work going down the slope for the blue line as it wouldn't be colliding unless it came off it's "straight" path, and also the problem would be reversed when going 'up' the slope.

so for instance in the above image where the characters are moving up the slope the other way I'm curious how this would have been handled? My thoughts now are, would the darker grey area with the "1" on it, actually be an entire entity itself or a collision mask? You'd then work out based on the characters "Y entry" point on to it (either at the top or the bottom) and based on their direction, where their 'Y' point should then be?

sentences:
How do I calculate the position of a vehicle moving between tiles, over time? I'm working on a small multiplayer game where players can create cities, and these cities will be placed on what's called the "world map." The world map is basically a giant coordinate plane made up of tiles, and the server will load the "world map" in chunks from the database relative to a player's position on the world map.

Now, I want players to be able to send planes from their city to another spot/tile anywhere on the world map. Say for instance player who owns City 1 at position 10,10, wants to create an oil_well at position 70,30. I want a plane to fly from the departure point to arrival point, and client that loads the chunk will see that plane flying across the map.

How can I make the server calculate where the plane is? I have the following information:

departure_time, origin_x, origin_y, arrival_x, arrival_y, speed. speed is the time in seconds that a plane can cross a tile on the world map.

I also have distance, which is simply calculated as (distance formula):

var distance = Math.sqrt(Math.pow( data.arrival_x - data.origin_x , 2) + Math.pow( data.arrival_y - data.origin_y , 2));

Again, how can I calculate the current position of a moving plane on this world map? Because the plane can fly at many different angles, depending on the angle of departure point → arrival point.

sentences:
what should the size of a flash game in Facebook be I'm developing a flash game and i want to put it in Facebook
,My question is the Proper maximum  size for it.
500 KB
1 MB ??

sentences:
Generating geometry when using VBO Currently I am working on a project in which I generate geometry based on the players movement. A glorified very long trail, composed of quads.

I am doing this by storing a STD::Vector, and removing the oldest verticies once enough exist, and then calling glDrawArrays.

I am interested in switching to a shader based model, usually examples I see the VBO is generated at start and then that's basically it. What is the best route to go about creating geometry in real time, using shader / VBO approach

sentences:
Unity, VRChat SDK3, Udon Graph (bug?) I'm trying to create a VRChat world in Unity, using VRchat World SDK3.
But I'm getting a strange behavior in Udon Graph assets (as shown by the arrows in the screenshot).
Steps I took:

I've installed the appropriate Unity version (2018-04-20f1) via the hub,
Then proceeded to importing VRChat SDK 3 (VRCSDK3-WORLD-2020.12.09.04.44_Public.unitypackage),
Then on the project tab, I navigated to the "Udon" folder, created a subfolder and inside it I created a Udon Graph Program Asset.
Finally, I opened Udon Graph and I added a public GameObject variable.

The result was as seen in the image seen bellow: the GameObject variable displays a buggy text (the text self (GameObject) shows up twice, superimposed on top of itself - as indicated by the arrows in the attached screenshot).

sentences:
UV Tiling & Offset input values from World Position - incorrect behavior? I'm using ShaderGraph in 2020.1.0f1. I have some shader experience, but it's all been handwriting shaders. I have experience with node-based things of this nature by way of Substance Designer. I'm working on a shader that should allow for seamless visibility between quads by changing the UV offset of a noise pattern based on the world position of the quad.
That said, I'm running into two things. This short (0:05) video shows how I'm expecting this to work - as the X/Y values of the UV Offset are changed, the continuous flow of the noise is smooth.
https://youtu.be/YAd9BtAWVRM
So, I add a position node and a split node, feed the world position into the split, and feed R/G from the split to X/Y of the Vector2 node. That does two things: it makes the preview boxes 3D (becomes a sphere instead of a quad), and "expands" the apparent tiling:

I'm guessing this is because the value from the split is a Vector1 rather than a float, though it seems odd that there's no implicit conversion, or that Vector1 values applied to UV Offset would change the actual appearance.
So, is this due to it being a Vector1 rather than a float? If so, is there a node that can convert from Vector1 to float? Am I going about this the wrong way entirely?

sentences:
Level data for Mario or similar platform game It has become a widespread to implement a Mario-clone to practise writing platform games or in order to demonstrate how a game engine works.

For that reason I expected it to be easy to find level data for Mario.

Are the levels of Mario in a ready to use format available?

Note: Edited to narrow the scope of the question.

sentences:
Use Unity Handles for interaction in the scene view I want to give an object with a specific script arrows to do special functions in the scene view. I have gotten Unity to render the arrows but I have no idea how to actually handle mouse events. The docs appear to say that I should be able to identify what receives a mouse down event by calling HandleUtility.nearestControl however when clicking on different arrows in the scene view I get the same ControlId (which i'm guessing is the gameobject itself). How are you supposed to know/deal with mouse events properly?

Code:

[CustomEditor(typeof(Script))]
class SceneGui : UnityEditor.Editor
{
    void OnSceneGUI()
    {
        if (Event.current.type == EventType.Repaint)
        {
            Transform transform = ((Script)target).transform;
            {
                Vector3 pos = transform.position + Vector3.left * 2;
                Handles.color = Color.yellow;
                Handles.ArrowHandleCap(3000, pos, Quaternion.LookRotation(Vector3.left),
                    2, EventType.Repaint);
            }

            {
                Vector3 pos = transform.position + Vector3.right * 2;
                Handles.color = Color.red;
                Handles.ArrowHandleCap(3001, pos, Quaternion.LookRotation(Vector3.right),
                    2, EventType.Repaint);
            }

            {
                Vector3 pos = transform.position + Vector3.forward * 2;
                Handles.color = Color.blue;
                Handles.ArrowHandleCap(3002, pos, Quaternion.LookRotation(Vector3.forward),
                    2, EventType.Repaint);
            }

            {
                Vector3 pos = transform.position + Vector3.back * 2;
                Handles.color = Color.cyan;
                Handles.ArrowHandleCap(3003, pos, Quaternion.LookRotation(Vector3.back),
                    2, EventType.Repaint);
            }
        }
        else if (Event.current.type == EventType.mouseDown)
        {
            Debug.Log(HandleUtility.nearestControl);
        }
    }
}

sentences:
Unity animation tool doesn't save changes I'm trying to create an animation inside Unity using the animator tool, however the record tool isn't recording my changes and I'm struggling to get this to create animations.

I have created an example here:
https://i.gyazo.com/91f88b3531b4fb3ffd4100d40f06bdcf.mp4

I have tried recreating the animation file, but no matter what I do it refuses to record the element?

Any information would be appreciated, as it appears unity may be bugged.

When applying an update between tweened keypoints the fields for X Y Z are red and do not apply changes

sentences:
Can't find sibling node, keeps giving "null instance" I'm trying to set it up so that there are three buttons but only one can be toggled at a time. So when one button gets toggled it makes sure that the other two are not toggled.

The code is trying to set the toggled status however since it can't find the node I'm at a loss.

var vec = Vector2(0,1000)
var ori = Vector2(0,0)
func _ready():
    pass

func _on_Ally1_Button_toggled(button_pressed):
    if button_pressed:
        set_position(ori)
        $Player_Button.set_pressed(false)
    else:
        set_position(vec)

This is what the tree looks like.

The Player_Ally1_ui is trying to access Player_Button but as stated it can't seem to find it and just returns null.

Any help is greatly appreciated, thank you in advance.

sentences:
What are the valid DepthBuffer Texture formats in DirectX 11? And which are also valid for a staging resource? I am trying to read the contents of the depth buffer into main memory so that my CPU side code can do Some Stuff™ with it.

I am attempting to do this by creating a staging resource which can be read by the CPU, which I will copy the contents of the depth buffer into before reading it. I keep encountering errors however, because of, I believe, incompatibilities between the resource format and the view formats.

Threads like these lead me to believe it is possible in DX11 to access the depth buffer as a resource, and that I can create a resource with a typeless format and have it interpreted in the view as another, but I cannot get it to work.

What are the valid formats for the resource to be used as the depth buffer?
Which of these are also valid for a CPU accessible staging resource?

sentences:
Why am I having these weird framerate issues with OpenGL on Windows? I'm using OpenGL on windows (have been for a while now), and I've come across a strange issue.

Once every so often, the rate at which frames are presented on the screen drops to roughly 10 fps. However, my framerate counter stays at the usual framerate (2000fps in the menu, 300fps in game).

My framerate counter is based on the time between draw calls, so the graphics card is definitly rendering 2000 frames a second.

What is the problem? How can I fix it?

EDIT: I forgot to mention, this only happens when running in windowed mode.

sentences:
Best technique for drawing isometric tiles I'm thinking about making a simple isometric game with HTML5 Canvas, and wondering what's the fastest way to render the tiles.

Since the tiles are diamond shaped, but drawImage draws rectangles, I have to leave out the corners (the black parts in the following):

I think that leaves me with three options:

Use Image objects with alpha channels (.png). I'm afraid this might kill performance.
Use a clipping path.  If the renderer is optimized this could be pretty fast.
Prerender square tiles, like this:

I'd have the black square as one actual tile in memory, and I'd draw such a tile for the green field, and all fields next to it, or above and below. The diagonal (blue) fields would be make up of the corners of the rectangular tiles. This would avoid clipping or alpha channels, but I would have to prerender all possible combinations of tiles, and it seems like overkill.

What's the best or fastest way to do isometric tiles? What do other games, like FarmVille, use?

sentences:
Store game events data with XML I am new in the game development and now I am at the stage when you need to fill the game content. I want to create the events that occur with the player (like in FTL). Now I make these events with the help of hardcoding, but I understand that this is a very bad style. I know there is another way, use data in XML files. Here is an example:

 <event name="SIMPLE_EVENT">
  <text>Event text</text>
  <battle name="MONSTERS_WEAK"/>
 </event>

This event show a dialog window and start battle with a random weak monster. I understand how to make this XML files, but I not so experienced with C# to write code that will convert data from XML to my C# classes. How to convert this xml to C# methods invocation? Something like: ShowDialogWindow("Event text"); StartBattle("MONSTERS_WEAK"); Another example is:

<event name="ADD_FUEL">
 <text>Adding fuel</text>
 <item_modify>
     <item type="fuel" min="2" max="2"/>
 </item_modify>
</event>

This event show dialog too and add some fuel to the player.

I think its a some deserialization task? Anyway similar as FTL I need one class to represent all events in the game, using different XML data. I ask some advice with this, maybe tutorials, pattens or examples? Or maybe another solution of my task?

sentences:
Wandering motion in Unity I am trying to come up with a smooth wandering motion for my game-object using Unity. What I currently doing is rotate the object by some random angle calculated every 1.5 second delay. But I am aiming getting a smooth rotation whenever it transitions to a different randomly generated angle.

Below is my script attached to my character.

 void Update () {
     if (canWander && (currTime + delay < Time.time)){
        changeAngle();
        currTime = Time.time;
     }
     if(canWander){
        Wander();
     }
}

private void changeAngle(){
    float prevPosY = transform.position.y;
    Vector3 waypoint = Random.insideUnitSphere + new Vector3(10,prevPosY,10);  //waypoints are generated based on random unit sphere + ( bounds of the plane they are on )
    Vector3 relative = transform.InverseTransformPoint (waypoint);
    float angle = Mathf.Atan2 (relative.x, relative.z) * Mathf.Rad2Deg;
    transform.Rotate (0, angle, 0);
}

private void Wander(){
    transform.position += transform.forward * Time.deltaTime * acceleration;
    if (acceleration < maxSpeed) {
        acceleration += 0.5f;
    }
}

So the character wanders with newly generated random angles every time but its not a smooth transition. It suddenly transitions to the new angle and it does not feel realistic at all. What could I possibly change with my current code to make it more smooth and realistic?

sentences:
Rendering fancy particles? I'm making a tower-defense game for Windows (not phone) in XNA.

I've seen this video of another tower-defense game for Windows Phone that uses particle effects, which I really like. They change color, glow and density as they move away from the explosion. Really cool stuff!

http://www.youtube.com/watch?v=YhPr4A4LRPQ&hd=1

I would like a similar result (particle-wise) to the stuff in the video, however, I don't know where to start. I suppose I need to do linelist hardware instancing to achieve the result, and then update every particle position on the CPU.

Or is there a better alternative? Post your suggestions. That'd be great, thanks.

Edit It's the explosion particle effect that I want to implement. Not the particle effects that the projectiles leave when they fire.

sentences:
Why is overlapping a possibility? I have three dynamic Rigidbody2D's, two of them paddles and the other a ball - this ball is also a trigger. If I used OnCollisionEnter before, I understand that the physics engine calculates the collision that should happen based on the position and velocity of the ball and paddle. This created the so called lag problem I had where seemingly two collision results happened. However, now I am using OnTriggerEnter and have a couple questions related to the problem I'm having.

When the ball is level with the paddle on the x-axis and you move up to hit it, the paddle is able to go through the ball but the collision happens from where the ball hit the paddle originally. Why is this? Also, if I print the x position of the ball, the position should be 7.175 but instead it's 7.19996, is there a way to get the actual point of collision? Is this linked to the first question?

Thanks!

sentences:
Scene Graph in Separate Thread I develop my own game engine for fun (but not profit).  I have rendering in one thread and my scene graph updates (velocity, etc.) in another.  When it's time to render, the render thread adds the visible nodes to a new linear buffer and traverses them.

In more detail, my scene graph is triple-buffered.  Each node in my scene graph has three copies of its relative and absolute transformation matrices (4x4).  At any given time, one copy is written to by the scene graph thread, one copy is read by the renderer, and a third exists so that the reader or writer can move on to the next without waiting on the other.  This prevents writing to something while it's being rendered and from rendering a half-updated scene graph.  Somehow I've also got a fourth copy of each matrix for the user to work with so as to not conflict with the update thread.  This seems to perform well by avoiding having to synchronize all the time.

However, this is a mess.

These are my ultimate goals for the system:

Rendering and scene graph updating stay in separate threads.
Minimize how much these threads have to wait on one another.
Don't render a scene that's been halfway updated by the update thread.  This is particularly noticeable if the camera is moving fast and sometimes it's rendered before or after an update.
Reduced memory usage.  I have way too many matrices per Node.  I'm also considering moving to vectors for position/rotation/scale due to increased floating point drift with matrices.
Ability to handle tens of thousands of Nodes.  The current system does this reasonably well.

I also hope to incorporate Bullet (the physics engine) and networking in the future, neither of which I've given much thought.

What are some approaches for accomplishing a better scene graph?

sentences:
OpenGL Fast-Object Instancing Error I have some code that loops through a set of objects and renders instances of those objects. The list of objects that needs to be rendered is stored as a std::map>, where an object of class MeshResource contains the vertices and indices with the actual data, and an object of classMeshRenderer defines the point in space the mesh is to be rendered at.

My rendering code is as follows:

glDisable(GL_BLEND);
    glEnable(GL_CULL_FACE);
    glDepthMask(GL_TRUE);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);

    for (std::map<MeshResource*, std::vector<MeshRenderer*> >::iterator it = renderables.begin(); it != renderables.end(); it++)
    {
        it->first->setupBeforeRendering();
        cout << "<";
        for (unsigned long i =0; i < it->second.size(); i++)
        {
            //Pass in an identity matrix to the vertex shader- used here only for debugging purposes; the real code correctly inputs any matrix.
            uniformizeModelMatrix(Matrix4::IDENTITY);
            /**
             * StartHere fix rendering problem.
             * Ruled out:
             *  Vertex buffers correctly.
             *  Index buffers correctly.
             *  Matrices correct?
             */
            it->first->render();
        }
        it->first->cleanupAfterRendering();
    }

    geometryPassShader->disable();
    glDepthMask(GL_FALSE);
    glDisable(GL_CULL_FACE);
    glDisable(GL_DEPTH_TEST);

The function in MeshResource that handles setting up the uniforms is as follows:

void MeshResource::setupBeforeRendering()
{
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glEnableVertexAttribArray(2);
    glEnableVertexAttribArray(3);
    glEnableVertexAttribArray(4);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, iboID);
    glBindBuffer(GL_ARRAY_BUFFER, vboID);

    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0); // Vertex position
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 12); // Vertex normal
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 24); // UV layer 0
    glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 32); // Vertex color
    glVertexAttribPointer(4, 1, GL_UNSIGNED_SHORT, GL_FALSE, sizeof(Vertex), (const GLvoid*) 44); //Material index
}

The code that renders the object is this:

void MeshResource::render()
{
    glDrawElements(GL_TRIANGLES, geometry->numIndices, GL_UNSIGNED_SHORT, 0);
}

And the code that cleans up is this:

void MeshResource::cleanupAfterRendering()
{
    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(2);
    glDisableVertexAttribArray(3);
    glDisableVertexAttribArray(4);
}

The end result of this is that I get a black screen, although the end of my rendering pipeline after the rendering code (essentially just drawing axes and lines on the screen) works properly, so I'm fairly sure it's not an issue with the passing of uniforms. If, however, I change the code slightly so that the rendering code calls the setup immediately before rendering, like so:

void MeshResource::render()
{
    setupBeforeRendering();
    glDrawElements(GL_TRIANGLES, geometry->numIndices, GL_UNSIGNED_SHORT, 0);
}

The program works as desired. I don't want to have to do this, though, as my aim is to set up vertex, material, etc. data once per object type and then render each instance updating only the transformation information.

The uniformizeModelMatrix works as follows:

void RenderManager::uniformizeModelMatrix(Matrix4 matrix)
{
    glBindBuffer(GL_UNIFORM_BUFFER, globalMatrixUBOID);
    glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(Matrix4), matrix.ptr());
    glBindBuffer(GL_UNIFORM_BUFFER, 0);
}

sentences:
Why does my sprite player move faster when I move the mouse? I'm trying to develop a simple game made with Pygame (Python library).

I have a sprite object which's the player and I move it using arrow keys. If I don't move the mouse, the sprite moves normally, but when I move the mouse, the sprite moves faster (like x2 or x3). The player object is inside the charsGroup var.

I've run the game in W7 and in Ubuntu. Same thing happens in both OS.

I have more entities which move like NPCs and bullets but they don't get affected, just the player. Given this, I think that the problem maybe has a direct connection with the player moving system (arrow keys).

Here is the update() method of the player object:

def update(self):

    for event in pygame.event.get():
        key = pygame.key.get_pressed()
        mouseX, mouseY = pygame.mouse.get_pos()
        if event.type == pygame.MOUSEBUTTONDOWN:
            self.bulletsGroup.add(Bullet(pygame.image.load("bullet.png"),
                                          self.rect.x + (self.image.get_width()/2),
                                           self.rect.y + (self.image.get_height()/2),
                                            mouseX, mouseY, 50, 50))

        if key[pygame.K_RIGHT]:
            if not self.checkCollision():
                self.rect.x += 10
            else:
                self.rect.x -= 10
        if key[pygame.K_LEFT]:
            if not self.checkCollision():
                self.rect.x -= 10
            else:
                self.rect.x += 10
        if key[pygame.K_UP]:
            if not self.checkCollision():
                self.rect.y -= 10
            else:
                self.rect.y += 10
        if key[pygame.K_DOWN]:
            if not self.checkCollision():
                self.rect.y += 10
            else:
                self.rect.y -= 10

And here is the while loop:

while True:

    if PLAYER.healthBase <= 0:
        GAMEOVER = True

    if not GAMEOVER:
        mapTilesGroup.draw(SCREEN)
        charsGroup.update()
        charsGroup.draw(SCREEN)
        npcsGroup.update()
        npcsGroup.draw(SCREEN)
        drawBullets()

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()

    if GAMEOVER:
        myfont = pygame.font.SysFont("monospace", 30)
        label = myfont.render("GAME OVER!", 1, (255, 255, 0))
        SCREEN.blit(label, (400, 300))

    freq.tick(0)

    pygame.display.flip()

I don't know what more you can  need to help me, but anything you need (more info or code) just ask for it!

sentences:
How can I create color fonts to be used in Unity? I've been searching, downloaded a couple programs that lets you convert images into fonts, but none let you obtain the color. They all switch them to black and white.

While searching the internet, I found a few colored fonts. Yet, almost all games have their own fonts that are colorful.

How do they do it? Did they just opt to program the font with coded position and sizes?

I'd just like to make my own true type or open type font (ttf or otf) from some images I created. And the images aren't even that colorful, just fill and stroke color.

sentences:
How to get depth buffer from PUBG? I have no any experience in game development, I'm doing some research on machine learning tasks and for my project I need to know how to get depth buffer. I tried to google but haven't found relevant materials except the software Reshade where it says that they forbid accessing PUBG depth buffer because of cheating.

So if anyone can point me in the direction of how to access depth buffer will be much appreciated!

sentences:
C# XNA - Sky Sphere Question I have been banging my head against the wall trying to get a sky sphere to work appropriately in XNA 4.0. I have the sphere loading correctly, and even textured, but i would like something a little more dynamic that can support a day/night cycle.

My issue is that, while i know a good amount of C# and XNA, i know next to nothing about HLSL. (I could make an ambient light shader if my life depended on it...) I also have not been able to find a tutorial on how to build a sky sphere like this. Of course i don't expect to be able to make an amazing one right off the bat, i would like to start small, with a dynamic coloring sky i'll work out the clouds and sun later.

My first question:
Does anyone know of any good tutorial sites that could help me get a decent grasp around HLSL?

Second:
Does anyone have a good example of or know where to find one of a gradient sky using XNA and C#?

sentences:
Unreal Engine 4 -- Casting I am currently developing my first classes in Unreal Engine 4. Coming from using UScript extensively, I'm getting a little bit confused by how typecasting works in pure C++. More specifically, class/object casting.

I am currently putting together a switch statement in MyCustomGameMode which calls upon MyCustomPlayerController for MyCustomPlayerControllerVariable.

The function in question that I am overriding is this one: virtual UClass* GetDefaultPawnClassForController(AController* InController);

Currently I'm trying to call the variable with the following line of code, which I know is incorrect, but I'm not sure why:

Cast<MyCustomPlayerController>(InController).MyCustomPlayerControllerVariable

I am interested in casting the "InController" to MyCustomPlayerController but Cast<MyCustomPlayerController>(InController) doesn't seem to work, what am I doing wrong here?

sentences:
Swept AABB vs Line Segment 2D I've really exhausted as much as Google has to give, I've spent a solid week googling every combination of words for an "AABBvsLine sweep", downloaded countless collision demos, dissected SAT intersection examples and an AABBvsAABB sweep trying to figure out how to approach this. I've not found a single thing covering this specific pairing.

Can anyone shed any light on how to get the hit time of a swept AABB vs a Line segment in 2D? I'm still getting familiar with the SAT but I do know how to implement it to a degree, I'm just not sure how to extract the hit time from the velocity in the non axis aligned separating axes for the sweep.

I really would appreciate anything at the moment, some code or even some helpful links, I'm at my wits end!

sentences:
How does Against The Wall create an infinite wall? There is a game called Against The Wall, developed by Michael P. Consoli. It's a fantastic game, as I've always been stumped at how the game creates an infinitely spanning wall.

In the game, you can fall forever, and the wall will keep spanning. I can fall as long as I like, and still be able to climb back to where I was before. The game is developed in Unity.

How can a game do this without crashing, or creating some kind of memory overload?

sentences:
Minimizing amount of comparisons for collisions? In my 'Terraria' based game I am having lag issues. The cause of the lag is as follows:

Every update loop through all the tiles in the world:
If the rectangle that was passed as an arg intersects with the current tiles rectangle return true. If not go to the next tile.
If the rectangle that was passed as an arg doesn't intersect with any of the tiles rectangles then return false.

My solution is to only check collisions for the tiles that are on the screen.
At the moment my code renders all of the tiles regardless of the position. I know that this is a very lag-filled approach and I have no idea at all what the maths is to only get the tiles the player can see. If it helps the world is stored in a hash map that is initialised like this:

public Map<Integer, Tile> world = new HashMap<Integer, Tile>();
// numeric id = key , tile = value

I have tried looping through the tiles in 2 ways:

public boolean checkCollision(Rectangle argRect)
{
    for(int i = 0; i < world.size(); i++){
        Tile tile = world.get(i);
        Rectangle tileRect = new Rectangle(tile.rect);

        if(tileRect.intersects(argRect)){
            return true;}
    }
    return false;
}

And:

public boolean checkCollision(Rectangle argRect)
{
    for (Entry<Integer, Tile> entry : world.entrySet()) {
          Object key = entry.getKey();
          Tile tile =  world.get(key);
          Rectangle tileRect = new Rectangle(tile.rect);
          if(tileRect.intersects(argRect)){return true;}
    }
    return false;
}

Could I pass the players position to this method and have it only loop through tiles in the area? Would this approach have to loop through the tiles to see which ones are in the area?

sentences:
How to handle runtime exceptions that occur on a loading process delegated to newly spawned thread I am looking to multi-thread the resource allocation routines (i.e world loading) in my game so that they can occur in the background whilst rendering a loading screen etc... The problem is, I used to have code like this (pseudo)

void foo()
{
    ...
    try
    {
        mWorld = world.create(...)
    } catch(EntityNotFoundException e)
    {
        ...
    }
}

However, now that the world is being loaded on another thread, I need to register a listener that will recieve notification when the world is ready. The problem is that if an exception occurs inside of the newly created thread, I cannot surround it in a try-catch like I have here. How is this problem solved?

I am thinking of having the loading thread interface with a handler that looks like this:

public interface IInitializationMonitor<T> extends IInitializationProgressMonitor
{
void begin();
void completed(T item);
void failed(Throwable error);
}

The problem being that error would need to be tested against multiple times with instanceof, or rethrown inside of a try block. I am curious if there is a more elegant solution...

Thanks.

sentences:
Architecture to draw many different objects in OpenGL I have some objects that I want to draw. I am not sure how I can create my architecture in a way where I can draw everything as fast as possible.

As example:

class MyObject
{
  float[] vertices;
  float[] colors;
  float[] textures;

  public MyObject()
  {
    //fill every buffer with data
  }

  public void Draw()
  {
    //set shader
    //set shader uniforms etc.

    //foreach buffer
    BindBuffer();
    VertexAttribPointer();

    DrawArrays();
  }
}

In this way, I can draw every object like myObject.Draw after it is constructed. The problem would be, that if I have 5000 objects, I have 5000 draw calls. I need to set the shader every time even if I loop over the 5000 objects because I don't know if they use the same shaders.

Another way:

class MyObject
{
  bool needsToBeChanged;

  public MyObject()
  {
    //set my edge points
    needsToBeChanged = true;
  }

  void ChangeMyObject() //e.g. I changed the height of my object
  {
    needsToBeChanged = true;
  }
}

class GLWindow
{
  float[] vertices;
  float[] colors;
  float[] textures;

  GameLoop()
  {
    foreach(MyObject myObj in allMyObjects)
    {
      if(myObj.needsToBeChanged)
      {
        //get objects points for drawing it and set the global buffers up

        myObj.needsToBeChanged = false;
      }
    }

    DrawArrays(); //draw only once (because every data is in the buffer)
  }
}

Only 1 draw call for everything. I guess this will be faster than first method. The problem on this code is the big buffer that contains everything. Let's imagine we have inherited from MyObject and want to draw objects in different shapes. Now the Loop gets more complicated. You may have to split it because you need another shader for example for text. Now you have 2 arrays... And with other changes the Loop becomes more and more complicated and harder to maintain.

What solutions (beside the both) are available for this kind of problem? Can I use the first way or is there a better way where I can reduce the draw calls? How is it solved in other applications?

sentences:
Shadow mapping too slow and ugly! As many of you are, I am working on a game.

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

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

Its too slow and too ugly to look at!

So what do people do?

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

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

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

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

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

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

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

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

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

sentences:
ConsumeStructuredBuffer, what am I doing wrong? I'm trying to implement the 3rd exercise in chapter 12 of Introduction to 3D Game Programming with DirectX 11, that is:

Implement a Compute Shader to calculate the length of 64 vectors.

Previous exercises ask you to do the same with typed buffers and regular structured buffers and I had no problems with them.

For what I've read, [Consume|Append]StructuredBuffers are bound to the pipeline using UnorderedAccessViews (as long as they use the D3D11_BUFFER_UAV_FLAG_APPEND, and the buffers have both D3D11_BIND_SHADER_RESOURCE and D3D11_BIND_UNORDERED_ACCESS bind flags).

Problem is: my AppendStructuredBuffer works, since I can append data to it and retrieve it from the application to write to a results file, but the ConsumeStructuredBuffer always returns zeroed data. Data is in the buffer, since if I change the UAV to a ShaderResourceView and to a StructuredBuffer in the HLSL side it works.

I don't know what I am missing:

Should I initialize the ConsumeStructuredBuffer on the GPU, or can I do it when I create the buffer (as I amb currently doing)?.
Is it OK to bind the buffer with a UAV as described above? Do I need to bind it as a ShaderResourceView somehow?
Maybe I am missing some step?

This is the declaration of buffers in the Compute Shader:

struct Data
{
    float3 v;
};

struct Result
{
    float l;
};

ConsumeStructuredBuffer<Data> gInput;
AppendStructuredBuffer<Result> gOutput;

And here the creation of the buffer and UAV for input data:

D3D11_BUFFER_DESC inputDesc;
inputDesc.Usage = D3D11_USAGE_DEFAULT;
inputDesc.ByteWidth = sizeof(Data) * mNumElements;
inputDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
inputDesc.CPUAccessFlags = 0;
inputDesc.StructureByteStride = sizeof(Data);
inputDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;

D3D11_SUBRESOURCE_DATA vinitData;
vinitData.pSysMem = &data[0];

HR(md3dDevice->CreateBuffer(&inputDesc, &vinitData, &mInputBuffer));

D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc;
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
uavDesc.Buffer.FirstElement = 0;
uavDesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_APPEND;
uavDesc.Buffer.NumElements = mNumElements;

md3dDevice->CreateUnorderedAccessView(mInputBuffer, &uavDesc, &mInputUAV);

Initial data is an array of Data structs, which contain a XMFLOAT3 with random data.

I bind the UAV to the shader using the Effects framework:

ID3DX11EffectUnorderedAccessViewVariable* Input = mFX->GetVariableByName("gInput")->AsUnorderedAccessView();

Input->SetUnorderedAccessView(uav); // uav is mInputUAV

Any ideas?

Thank you.

sentences:
What is the difference between getWidth and getBackBufferWidth in LibGDX? In regards to gdx.graphics, what is the difference between using getWidth and getHeight, and using getBackBufferWidth and getBackBufferHeight?

I am learning LibGDX and Java. I programmed formerly in pygame.
To my knowledge, getBackBuffer means the width and height of the actual window. Is that true?

sentences:
What is the difference between OpenGL, SDL, DirectX, GLFW, GLUE? I have not work with graphics yet but I'd like to know its concepts at some high level overview.

I was told that OpenGL and DirectX are somehow programmed into my graphics card, and I can use GLFW, SDL etc. to get access to those and manipulate them, by creating kind of different graphics objects.

Analogy:

OpenGL - programming language

SDL - framework

Please, correct me politely.

sentences:
Time based events separate from the game loop How can set up time elapsed based events separate from the game loop?

I want the character to heal over real time rather than per cycle of the game loop.  How might i do that?

sentences:
State machines and map transitions I've implemented a [basic] FSM in my game and it currently does its job very well. Recently I have come across a "problem" that I need to show a "Loading map. Please wait..." screen for as long the map is being loaded asynchronously. How do people usually do this? Is it considered a State?

For instance, these are the current states (in order):
IntroState (splash) -> LoadingState (loads textures, sounds...) -> PlayingState (optionally goes to PausedState)

The above LoadingState shows some kind of a progress bar while the assets are being loaded in another thread. Another information that might be important is that states operate the machine, for example, when the LoadingState finishes loading all the assets, it tells the machine to go to the playing state. The PlayingState has a Map object. For reference, see here: https://github.com/YvesHenri/Chico/tree/master/Game/Includes/Core/Engine/State

My current approach (which is not yet commited to github) is to make the Map object a "LoadingObservable" and the PlayingState a "LoadingListener" (observer pattern), so that inside the load call it will notify all of its listeners and theyre responsible of telling the FSM to go to the next or to go back to the previous state in the queue. Is this how people usually do that? Are there any easier/better ways to do that?

If this sounds a bit confusing please feel free to ask. Also, I'm always open for criticisms, if you have any, on my code.

sentences:
Maintaining Consistent Scale (2D games) How do people making 2D games maintain a consistent scale for everything in their game?

Say I'm coding an RPG. A house needs to be proportionally bigger than a person; an item, smaller. Everything from enemies to locations to people.

Is there a technique to doing this -- like picking a single item like the player sprite and scaling everything relative to that?

sentences: How does UVW texture mapping work? I'm trying to understand the mathematical theory behind UVW mapping. Can anyone explain me how UVW mapping works? Or at least provide me a pointer?

sentences:
How to work with two layers or more in cocos2d? I want to make a game in cocos2d. I don't know too much about it.

My question is related to communication between two layers or more. For instance, let's say I want a layer with a scrolling road and another on top with scrolling clouds.

Is there anything built-in cocos2d for doing that, or any reference link?

sentences:
Should game objects draw themselves? Assuming you have classes like Player, Enemy, Map and Tile.

The first approach to structuring rendering code would be to give each a render() method and let it draw itself:

void render(){
   player.draw();
   enemy.draw();
   // etc.
}

But considering the Model-View-Controller perspective, that feels wrong... Another idea would be to make a Renderer class, but then I wonder how you give the Renderer information what to draw.

Which one should I choose and why?

sentences:
What is the fastest way to know if the current coordinate in screen-space is odd or even in GLSL/GLES2 frag shader? I want to make a post-effect where every second column of pixels is colored differently, and I want to implement this as a GLSL fragment shader on GLES2. The question is what is the most effective way to know if a fragment is indeed odd or even in the x direction?

My current ideas revolve around the following three approaches:

1. Integer bit-wise operator

//Pseudo code
bool even_w=((int)(viewport_pixels_width*screenspace_x))&1>0;

2. Sinus

//Pseudo code
float evenness_w=(sin(viewport_pixels_width*screenspace_x*M_PI)+1.0)*0.5;

3. Texture

//Pseudo code
bool even_w = lookupFromMyRepeating2x1CheckerTexture(viewport_pixels_width*screenspace_x);

All ideas and feedback are welcome!

sentences:
Unity create Animated Tilemap? Im trying to create an Animated Waterfall Tilemap from a tutorial video.

In his video when the author right clicks he can see a Animated Tile > under CREATE option.

But In my case its not there !! Please see picture below.

sentences:
How much is 2D geometry used in 3D? I'm studying 2D geometry with eventual goal to study 3D geometry for building games - very much looking forward to 3D!!
Looking up on how to calculate hypotenuse of a right triangle in 3D I read that the the same 2D Pythagorean theorem can also be used in 3D right triangle to calculate the hypotenuse.
So now I'm curious on how much of the 2D geometry I'm learning right now will be reusable when I get to 3D?
By "how much" I mean

Do devs throw away their 2D knowledge in 3D and use a whole new sets of formulas/theorems?
Or almost all or at least 90% of 2D knowledge is reused in 3D?

sentences:
Stop a rotating object at a specified angle? I'm working in JavaScript with HTML5 and the canvas. I have an object which is rotating at a certain speed, and I need the object's rotation to slow down gradually and the front of the object to stop at a specified angle. (I'm using radians, not degrees.) I have a variable to keep track of the angle which the object is facing, as it rotates.

How would I go about getting the object to come to rest, facing the direction I want it to?

sentences:
Integrate LibRocket With SDL And OpenGL I been currently involved in a game project and we reach the point we're want to added the GUI for menus and other stuff but the time that we maybe spent developing our own system could cost us a bit of time, and this is a part of the system that we don't want to lose too much time.

So, we're reading about some UI Libraries like GUIchan, CEGUI and recently LibRocket which apparently is very flexible and useful, so my question is if Librocket could be integrate with a project develop in SDL/OpenGL in C++? and if you know where to find information about that, because we're unable to find something like that.

sentences:
Is there a 3d animation software that prioritizes working with code rather than GUI? All of the 3D animating softwares I've faced are centered around using GUI to work: windows, menus, mouse clicks, mouse adjustments, keyboard shortcuts. As a programmer, I find that limiting. In order to have full control over an animation, it'd be interesting to use code. For example, say you wanted to animate a magic sword which color depended on speed. Without programming, that's not possible at all.

Thus I ask: is there a 3D animation softwares that target coding, not GUI work?

sentences:
How do I keep a PHP server running forever? I'm making a web game RTS, it's mostly create units, manage resources, attack with army, and level up factories. I have created the basics of the game using Javascript, PHP, and MySQL databases. I use the database to store player credentials and stats, and PHP as a server-side logic (like retrieve the right player and attack with X units). On the client side I use HTML/CSS and javascript.

My problem is that I need to keep adding resources based on the factories level (ex. 10 gold every min, when mine-factory = lvl.1). The only answers that I have found, is to modify the PHP file to run an infinite loop and keep connecting to the database to add those resources 24/7. I think the server also needs to handle attack travel (when units arrive at the enemy castle and the fight is over) and some other logic, but I don't have physical access to the server, and keep connecting to the database to add resources doesn't seem a good idea. I'm willing to make a server using other languages, or use other way to store data that keeps changing, so I can avoid multiple connections to the database. If you know a better way to do it, or something that can put me on tracks I will appreciate it.

sentences:
Need to combine a color, mask, and sprite layer in a shader My task: to display a sprite using different team colors. I have a sprte graphic, part of which has to be displayed as a team color. The color isn't 'flat', i.e. it shades from brighter to darker. I can't "pre-build" the graphics because there are just too many, so I have to generate them at runtime. I've decided to use a shader, and supply it with a texture consisting of the team color, a texture consisting of a mask (black=no color, white=full color, gray=progressively dimmed color), and the sprite grapic, with the areas where the team color shows being transparent.

So here's my shader code:

// Effect attempts to merge a color layer, a mask layer, and a sprite layer
// to produce a complete sprite

sampler UnitSampler : register(s0); // the unit
sampler MaskSampler : register(s1); // the mask
sampler ColorSampler : register(s2);    // the color

float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 tex1 = tex2D(ColorSampler, texCoord);    // get the color
    float4 tex2 = tex2D(MaskSampler, texCoord); // get the mask
    float4 tex3 = tex2D(UnitSampler,texCoord);  // get the unit
    float4 tex4 = tex1 * tex2.r * tex3; // color * mask * unit

    return tex4;
}

My problem is the calculations involving tex1 through tex4. I don't really understand how the manipulations work, so I'm just thrashing around, producing lots of different incorrect effects. So given tex1 through tex3, what calcs do I do in order to take the color (tex1), mask it (tex2), and apply the result to the unit if it's not zero?

And would I be better off to make the mask just on/off (white/black) and put the color shading in the unit graphic?

sentences: Is it possible to show vertex information in tables in VS2012 like in PIX? In PIX I was able to watch the objects' vertex data at different stages in tables, like before vertex shader, between vertex and pixel shaders, and so on. Can you see this in Visual Studio 2012 graphics debugger? I mean, you can see the data as a list of sorts, but it's impossible to get a good overview of that if you have more than like 3 vertices.

sentences:
I cannot update a shader constant via a constant buffer in DirectX 11 I've tried everything I can think of, but I cannot get a constant buffer to update a variable in my shader in DirectX 11. I followed the examples on msdn. I read and re-read the articles on constant buffers. I even followed the nearly identical thread on this site. But for some reason I simply cannot get this to work. Can someone point me in the right direction?

Here's the relevant code:

//my data variable to keep everything together
struct VS_CONSTANT_BUFFER
{
    D3DXMATRIX mWorldViewProj;
    D3DXVECTOR4 vSomeVectorThatMayBeNeededByASpecificShader;
    float fSomeFloatThatMayBeNeededByASpecificShader;
    float fTime;
    float fSomeFloatThatMayBeNeededByASpecificShader2;
    float fSomeFloatThatMayBeNeededByASpecificShader3;
};
    //I initialize my data variable
    D3DXMATRIX identity;
D3DXMatrixIdentity( &identity );
m_ConstantBufferContents.mWorldViewProj = identity;
m_ConstantBufferContents.vSomeVectorThatMayBeNeededByASpecificShader = D3DXVECTOR4(1,2,3,4);
m_ConstantBufferContents.fSomeFloatThatMayBeNeededByASpecificShader = 3.0f;
m_ConstantBufferContents.fTime = 1.0f;
m_ConstantBufferContents.fSomeFloatThatMayBeNeededByASpecificShader2 = 2.0f;
m_ConstantBufferContents.fSomeFloatThatMayBeNeededByASpecificShader3 = 4.0f;

// Fill in a buffer description.
D3D11_BUFFER_DESC cbDesc;
cbDesc.ByteWidth = sizeof( VS_CONSTANT_BUFFER );
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
cbDesc.MiscFlags = 0;
cbDesc.StructureByteStride = 0;

// Fill in the subresource data.
D3D11_SUBRESOURCE_DATA InitData;
InitData.pSysMem = &m_ConstantBufferContents;
InitData.SysMemPitch = 0;
InitData.SysMemSlicePitch = 0;

// Create the buffer.
HRESULT hr = pDevice->CreateBuffer( &cbDesc, &InitData, &m_ConstantBuffer );

    //from my update function, I update the contents of my buffer like so

m_ConstantBufferContents.mWorldViewProj = view;
// Set the buffer.
pDeviceContext->UpdateSubresource( m_ConstantBuffer, 0, 0, &m_ConstantBufferContents, 0, 0 );
pDeviceContext->VSSetConstantBuffers( 0, 1, &m_ConstantBuffer );

    //And this is how I attempt to use it in my shader
    //--------------------------------------------------------------------------------------
    // Constant Buffers
    //--------------------------------------------------------------------------------------
    cbuffer cbPerObject : register( b0 )
    {
       matrix  g_mWorldViewProjection  : packoffset( c0 );
       matrix  g_mWorld                : packoffset( c4 );
       float4  g_MaterialAmbientColor  : packoffset( c8 );
       float4  g_MaterialDiffuseColor  : packoffset( c9 );
    }

I'm sure it's something simple and stupid that I've overlooked, but I cannot seem to find the problem myself. Any ideas?

Goishin

sentences: Why are transform values in inspector different from animation tab? I’m trying to make animation in timeline. But transform values in animation tab and inspector are different from each other. It causes problem when ı try to rotate player. It doesn’t rotate the way I want.

sentences:
How to limit and direct player's view in VR? We are making a VR game where the player will look at the world through the eyes of his character who sometimes moves on his own, so the player is only observer.

The character will rotate his body on his own and we need to change the orientation of player's camera to look where the character looks. For example, the girl takes his hand and leads her way. It would be very unrealistic if the player's head will be turned 180 from his body and he will walk backwards.

It'll allow us to avoid exhausting head rotations. Is it a good idea to guide his view by force by limiting camera euler angles relative to the direction of the body?

sentences:
Special Texture Stretching without deformation I am trying to achieve a special texture stretching effect in my shader.
Here is how I define my uv before sampling my texture, nothing really special.

// uv_ST contains the tiling and offset values
uv.xy = uv.xy * uv_ST.xy + uv_ST.zw

This gives the standard tiling/stretching and offset behaviour when you tile/stretche a clamped texture as you can see in the image below. First is normal, second is offset and last is stretching.

But I want to avoid the deformation behaviour when stretching, I want to keep margins when stretching my texture or simply cut it in the middle and stretching it. Here is an illustration below.

How could I do that inside my shader when defining my uvs before sampling the texture ?

sentences:
Can a user / a game developer get their credit back in dollars? If yes, at what cost? You can find every information about how to give money to facebook, but when it comes to take it back…

If I give credits to a user, can he get it back in dollars?

If a user gives me credits, can I turn it into dollars?

If so, how much does it cost?

sentences:
How to make an object that has no rigidbody2d component smoothly fall on the ground in Unty2d? I have two character in my game: enemy and main character. Enemy can throw different objects into the main character. For this moment i am doing this action in such way:

void FixedUpdate(){
    if (CanMove){
        transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);
    }
}

public void StartMove(bool canMove){
    CanMove = canMove;
    TargetPlayer = GameObject.FindGameObjectWithTag(Tag).transform;
    rigidbody2D.gravityScale = 0;
}

This script is attached to the prefab of the object that will be thrown into main character by the enemy. This script is working, but in this case the object that was thrown will follow  by main character all the time, because of this line of code:
transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);

To my mind this is not good, because i want to give my player the opportunity to escape from the object that was thrown at him. For example run away. When the object reaches the player position (and the player is on the new position) - he will simply fall onto the ground. I did this, but this wasn't looking nice, because when the object was reaching his position, he was hanging in the air. Can anyone give me an advice how to make this process more good-looking?

Edit:
I need to make good-looking movement of the object, that was thrown by the enemy into main character. Every frame i am moving the instantiated object to the current player position. So the player can't escape from that object, because he always knows current player position. I think that this is not good idea, and i want to give to player an opportunity to run away from that object. In this case i am saving the position of the player into variable, and then every frame i am moving the instantiated object to that position. So when the player run away, the object, that was thrown doesn't know anything about new position of my player. But this is looking not good, because when the object is reaches its destination position he hangs in the air((

Edit # 2:
I was thinking about destroying that object anyway, but to my mind this will not look good: the object is moving and suddenly disappears from screen(. May there is some ways how to make him smoothly fall onto the ground? The problem is in that this instantiated object has no Rigidbody2d component attached to it, so it will never fall down by itself.

sentences:
How to save an arbitrarily large image to a file in XNA? I have built a level editor for an XNA-based Megaman clone I am working on and one of the features I would like to implement is the ability to save a full-resolution map of the entire level (like this one). My problem is that the levels can be arbitrarily large and XNA has a texture size limit of 4028x4028. I don't need to use the texture for anything in the editor itself, only to save it to disk.

I have stored the image data in an array using game.GraphicsDevice.GetBackBufferData, but I am having trouble finding a way to store this to disk in a readable format (preferably PNG). Everything I've found online says to use the Texture2D.SetData and Texture2D.SaveAsPng methods, but those calls are restricted to the 4028x4028 max texture size.

Any suggestions?

Note: I do realize that the example map I linked above was likely created by hand and while I could certainly output multiple full-resolution images of each screen and put them together by hand in Photoshop, I would like the process to be available directly in the editor if possible.

sentences:
bullet raycast vehicle - understanding coordinate system Bullet world space coordinate system is the same as opengl world coordinate system. I have noticed that raycast vehicle has the following function:

virtual void btRaycastVehicle::setCoordinateSystem(int rightIndex,
                                                   int upIndex,
                                                   int forwardIndex)

How does that function work ?

By default raycast vehicle has the following parametets:

forward vector: [0, 1, 0]
forward axis: 1
right axis: 0
up axis: 2

Does it mean that y axis is swapped with z axis ?

After calling:

raycastVehicle.setCoordinateSystem(0,1,2);

I get the following parameters:

forward vector: [0, 0, 1]
forward axis: 2
right axis: 0
up axis: 1

which makes more sense to me but I'm still confused why a default setup is other (not compatible with world coordinate system) and how to interpret it.

sentences:
AndEngine rotate all connected bodies I have created below hexagon structure in Andengine with box2D physics extension. I want to rotate whole structure with respect to center when other ball collides with the structure using physics.

I tried weld joint and revolute joint with the bodies but it is not performing proper motion as required. All bodies are attached with weld joint and vertices have revolute joint with center body which is static like,

RevoluteJointDef revoluteJointDef1 = new RevoluteJointDef();
revoluteJointDef1.initialize(centerB, movingBody[i], centerB.getWorldCenter());
revoluteJointDef1.enableMotor = true;
revoluteJointDef1.motorSpeed = 0;
revoluteJointDef1.maxMotorTorque = 1f;
this.mPhysicsWorld.createJoint(revoluteJointDef1);

I had refered these links:
box2d manual
and box2d joints tutorial

Is there any other way to perform smooth rotation of whole structure?
Thanks.

sentences:
How to sort entities order by nearest entity distance? I have created a comparator class called DistanceSquaredComparator and implements it with Comparator<Entity>. Then in the override compare method, I get the distance square of each nearby position to owner position, then get the signum int value to return. Now the problem is I don't know if this is the efficient way of sorting the array by nearest distance.
Entity owner

@Override
public int compare(Entity o1, Entity o2) {
    Vector2 ownerPosition = Mapper.transform.get(owner);
    Vector2 nearby1 = Mapper.transform.get(o1).position;
    Vector2 nearby2 = Mapper.transform.get(o2).position;
    return (int) Math.signum(nearby2.dst2(ownerPosition) - nearby1.dst2(ownerPosition));
}

// usage

DistanceSquaredComparator comparator = new DistanceSquredComparator();
ImmutableArray<Entity> players = ...
ImmutableArray<Entity> enemies = ...
Array<Entity> sortedEnemies = ...
... // fill sortedEnemies

for(Entity player: players) {
    comparator.setOwner(player);
    sortedEnemies.sort(comparator);
}

In the image below, green circle is the observer while the red circle is the observables.

sentences:
Using AdMob with Games that use Open GLES Can anyone help me integrating Admob to my game. I've used the badlogic framework by MarioZencher ... and My game is like the SuperJumper. I am unable to use AdMob after a lot of my attempts. I am new to android dev...please help me..I went thru a number of tutorials but not getting adds displayed ...

I did the following...

get the libraries and placed them properly
My main.xml looks like this

android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>

My Activity class onCreate method:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

RelativeLayout layout = new RelativeLayout(this);
adView = new AdView(this, AdSize.BANNER, "a1518637fe542a2");
AdRequest request = new AdRequest();
request.addTestDevice(AdRequest.TEST_EMULATOR);
request.addTestDevice("D77E32324019F80A2CECEAAAAAAAAA");
adView.loadAd(request);
      layout.addView(glView);
      RelativeLayout.LayoutParams adParams =
              new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                              RelativeLayout.LayoutParams.WRAP_CONTENT);
      adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      adParams.addRule(RelativeLayout.CENTER_IN_PARENT);
      layout.addView(adView, adParams);
      setContentView(layout);

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);
glView = new GLSurfaceView(this);
glView.setRenderer(this);
//setContentView(glView);

glGraphics = new GLGraphics(glView);
fileIO = new AndroidFileIO(getAssets());
audio = new AndroidAudio(this);
input = new AndroidInput(this, glView, 1, 1);
PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");

}
My Manifest file looks like this ....

    <activity android:name="com.google.ads.AdActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|smallestScreenSize"/>

</application>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-sdk android:minSdkVersion="7" />

When I first decided to use the XML for admob purpose ..it showed no changes..it even didn't log the device id in Logcat...

Later when I wrote code in the Main Activity class.. and run ...
Application crashed ... with 7 errors evry time ...

The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.

The android:configChanges value of the com.google.ads.AdActivity must include uiMode.

The android:configChanges value of the com.google.ads.AdActivity must include screenSize.

The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.

You must have AdActivity declared in AndroidManifest.xml with configChanges.

You must have INTERNET and ACCESS_NETWORK_STATE permissions in AndroidManifest.xml.

Please help me by telling what wrong is there with the code?
Can I write code only in xml files without changing the Activity class ...
I will be very grateful to anyone providing support.

sentences:
Import a 3D animation into an android game I want to import a skinned and animated character model built with bender into an android game. The animations can be: idle, walk, run ...etc

I've seen a related question but it's only about importing a static model: https://stackoverflow.com/questions/204363/is-there-a-way-to-import-a-3d-model-into-android

But I don't see how to import a set of animation with tweened frames.

Any ideas, resources or tutorials about how this can be achieved ?

 Edit:
After some further searching I've found this library that claim to provide model loaders for md5 files.
http://code.google.com/p/libgdx/

Edit2 (2011 12 16):
I tested libgdx mentionned above And it actually works well for now, I can render a walking animation from md5 models with a good framerate, but the model loading time is quite long. For a large amount of models and frames, I think switching to binary formats will become necessary.

sentences:
How do I set something when 2 or more touches are pressed? I currently have a working controller with left and right but I want to set the velocity of the character to 0/Stop when 2 or more touches are detected. This is my current working code but I want to make the player stop when 2 touches are detected.

void TouchMove(){

    if(Input.touchCount > 0){

        Touch touch = Input.GetTouch(0);

        float middle = Screen.width / 2;

        if(touch.position.x < middle && touch.phase == TouchPhase.Began) {
            MoveLeft();
        }
        else if (touch.position.x > middle && touch.phase == TouchPhase.Began) {
            MoveRight();
        }

    }
    else {
        SetVelocityZero();
    }
}`

This is how my game looks like

sentences:
3-hit combo system plays first attack animation every time So the new input system is out, and we're using it for our game. The next hurdle I'm trying to get over is implementing a melee combo  ( E->-E->E). Not 100% sure how to get the new system to execute something like that. Right now my trigger isn't resetting. Images of the animator graph at the bottom

public class PlayerController : MonoBehaviour
{
    Rigidbody2D _rigidbody;
    SpriteRenderer _renderer;
    Animator _animator;
    public float fallMultiplier = 2.5f;
    public float lowJumpMultiplier = 2f;

    PlayerInputActions inputActions;
    Vector2 movementInput;
    public bool inInteractionZone;
    public int attackCount = 0;
    public float attackTimeout = 0.5f;

    bool touchingWall;
    private void Awake()
    {
        HRHEventHub.OnPlayerDeath += HRHEventHub_OnPlayerDeath;
        inputActions = new PlayerInputActions();
        inputActions.Player.Move.performed += ctx => movementInput = ctx.ReadValue<Vector2>();
        inputActions.Player.Interact.performed += InteractPressed;
    }

    private void InteractPressed(InputAction.CallbackContext obj)
    {
        //TODO add attack timeout
        //Check if we are inside a interaction zone
        if (inInteractionZone)
        {
            //TODO implement
            return;
        }
        if (attackCount == 0 && _grounded)
        {

            attackCount++;
            _animator.SetTrigger("Attack");
            //_animator.SetBool("ATK1", true);
        }
        else
        if (attackCount == 1 && _grounded)
        {
            attackCount++;
            _animator.ResetTrigger("Attack");
            _animator.SetTrigger("Attack");

        }
        else
        if (attackCount == 2 && _grounded)
        {
            attackCount = 0;
            _animator.ResetTrigger("Attack");
            _animator.SetTrigger("Attack");

        }

    }

}

sentences:
Generating nav meshes from tile based map (2D) I'm working on a pathfinder for a MMORPG game, it's not mine; I'm RE it, now I need to create a pathfinder for monsters. But I figured that the client uses tiles for it's pathfinder (for players). Inside map files, there is a set of walkable and not walkable tiles. (Every coord XY is one tile). Now I wan't to implement the server side path finder, but the problem with these tiles is performance, some maps are 500x500 (250000 tiles). I need to reduce the number of tiles, so I guess I should convert them into navigations meshes, either triangles or bigger squares or rectangles. Is there a tool or an example code to do that?
Thanks

sentences:
What record stores the inventory in a Skyrim savegame file? For The Elder Scrolls V: Skyrim, I'm looking for a way to read the player's inventory without having to go into the game to do it.

I've scoured the pages from the UESP wiki on save file format but I couldn't find where the player's inventory is, even after writing a crude REFR change form reader. The wiki has a lot of information on many structures, but none are clearly identified as the player's inventory.

So, does anyone know where the inventory (RefID and count) is in the savegame file?

sentences:
OpenGL multiple viewports with 3d-2d viewing I am trying to draw two viewports, the one on top having a 3D stuff into it, and the other at bottom with a 2D stuff fed into it. However, whatever 2D stuff i draw in the bottom viewport is not rendered to the screen. Below is the piece of my code.

    void display() {

    //first viewport of height h/8
    glViewport(0, 0, width, height / 8);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    /*glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();*/
    gluOrtho2D(-2.0, 2.0, -2.0, 2.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(0.0f, 1.0f, 1.0f);
    glRectf(-1.0, 1.0, 1.0, -1.0);
    glFlush();

    //second viewport of height 7h/8
    glViewport(0, 2*height / 8, width, 7 * (height / 8));
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    aspect = (double)8 * width / ((double)height * 7);
    gluPerspective(fieldofview, aspect, nearPlane, farPlane);
    // setup viewing matrix
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluLookAt(0.0f, 20.0f, 10.0f,
        0.0f, 0.0f, 0.0f,
        0.0f, 0.0f, 1.0f);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glPushMatrix();
    draw_model(objs[0]); // draw the plane
    draw_model(objs[1]); // draw the first diamond
    glPopMatrix();

    glPushMatrix();
    glRotatef(angle, 0.0f, 0.0f, 1.0f);
    glTranslatef(moving_position.x, moving_position.y, moving_position.z);
    draw_model(objs[2]); // draw the second diamond
    glPopMatrix();
    glutSwapBuffers();
    move(8);
    // set up menus
}

void reshape(int x, int y) {
    width = x;
    height = y;
    if (height == 0)        // not divided by zero
        height = 1;
}

void main(int argc, char* argv[]) {
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(position_x, position_y);
    glutInitWindowSize(width, height);
    winId = glutCreateWindow("Mesh Viewer");
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);       // display function
    init();
    glutMainLoop();
}

Below is my output, with no rectangle in 1st viewport:

Moreover, can I apply some background color to the second viewport without using the glScissor?

sentences:
OpenGL multiple mesh management I've been working on coding a new 3D engine in Java. For the moment at least I'm sticking to openGL...

Currently I'm reworking how meshes get transformed and then drawn. ATM each mesh created has its own VBO and IBO along with its own draw method so if I wanted to draw multiple meshes it would look like this:

mesh1 = MeshLoader.loadMesh("cube.obj");
mesh2 = MeshLoader.loadMesh("pyramid.obj");

mesh1.addToBuffers(); //adds vertex and index data to vbo and ibo
mesh2.addToBuffers();

mesh1.draw();
mesh2.draw();

The draw method defined in class Mesh enables vertex attribute arrays, binds the bufffers, and then draws elements based on the ibo.

Then I send my projection matrix (transformation and perspective) as a uniform to the vertex shader.

QUESTION:

Games are made of many many meshes and each has to be identified so that transformation can be applied. I want to be able to apply transformations (translate, rotate, scale) directly to a given mesh, independent of the other meshes. In other words I want to move mesh1 and only mesh1 5 units to the right (on its own axis) without it affecting mesh2.
How do I do all this without making a million draw calls to the gpu?

Any advice appreciated.

sentences: Slide to reveal in AndEngine I was designing the game in that i want to cover the scene with black layer and i want user to see it when he slide the image. Is there any functionality in AndEngine for something like slide to unlock.

sentences:
Raycast a ray to the tip of another ray I'm using unity to raycast a line from the center of my camera viewport to a world position (yellow line).

I also want to cast a ray from the center of my character to this same point (blue line).

I have tried two methods to get this to work, however neither has worked.

The two methods are the following:

        if (Input.GetKey (KeyCode.Mouse0)) { //if left click is held down

        Ray crosshairPoint = viewCamera.ViewportPointToRay (new Vector3(0.5f, 0.5f, 0.0f));
        Vector3 crosshairEnd = (crosshairPoint.origin + crosshairPoint.direction * 15);
        Debug.DrawRay (crosshairPoint.origin, crosshairPoint.direction * 20, Color.yellow, Time.deltaTime, false);
        Vector3 intersect = crosshairPoint.GetPoint (20);
        Debug.DrawRay (Vector3.zero, intersect, Color.red, Time.deltaTime, false);

        Debug.DrawRay(_charFace.position, intersect, Color.cyan, Time.deltaTime, false);

    }

The red line being drawn is a line from the origin, which has no problem intersecting my camera ray line. The one from my character just refuses to point at the given point.

The second method is the same as above, but using vector math (origin + direction * distance) to get the same point.

Any ideas why the ray from my character won't point the right way, but one from the origin would? Something to do with world vs. local coordinates?

Thanks]1

sentences:
Character jumping but not returning to ground platform game AS3 I am making a platform game where the main character moves right and left and jumps however my character jumps and does not return to the ground but stays on top of the stage.My characters movie-clip symbol is called 'naruto' and my ground symbol is called 'ground'.

Here is my code:

import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.Stage;

naruto.gotoAndStop("stance");
var rightPressed:Boolean = new Boolean(false);
var leftPressed:Boolean = new Boolean(false);
var upPressed:Boolean = new Boolean(false);
var downPressed:Boolean = new Boolean(false);
var narutoSpeed:Number = 10;
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP,keyUpHandler);
stage.addEventListener(Event.ENTER_FRAME,gameLoop);

function keyDownHandler(keyEvent:KeyboardEvent):void
{
    if (keyEvent.keyCode == Keyboard.RIGHT)
    {
    rightPressed = true;
    }
    else if(keyEvent.keyCode == Keyboard.LEFT)
    {
    leftPressed = true;
    }
    else if(keyEvent.keyCode == Keyboard.UP)
    {
    upPressed = true;
    }else if(keyEvent.keyCode == Keyboard.DOWN)
    {
    downPressed = true;
    }

}
function keyUpHandler(keyEvent:KeyboardEvent):void
{
    if (keyEvent.keyCode == Keyboard.RIGHT)
    {
    rightPressed = false;
        naruto.gotoAndStop("standright")
    }
    else if(keyEvent.keyCode == Keyboard.LEFT)
    {
    leftPressed = false;
    naruto.gotoAndStop("standleft")
    }
    else if(keyEvent.keyCode == Keyboard.UP)
    {
    upPressed = false;
    naruto.gotoAndStop("stance")
    }else if(keyEvent.keyCode == Keyboard.DOWN)
    {
    downPressed = false;
    naruto.gotoAndStop("stance")
    }

}

function gameLoop(loopEvent: Event): void {
    //If the right key is pressed, and the left key is NOT pressed
    if (rightPressed && !leftPressed) {
        naruto.x += narutoSpeed;
        naruto.gotoAndStop("right");
    }

    if(leftPressed && !rightPressed) {
        naruto.x -= narutoSpeed;
        naruto.gotoAndStop("left");

    }
var jumpHeight =0;
var defaultJumpSpeed = 20;
var jumpSpeed = 20;

if(upPressed && naruto.hitTestObject(ground))
{
    trace("HELLO!");
naruto.y -= jumpSpeed;
jumpSpeed-= 4;
}

if(upPressed)
{
    trace("HELLO!");
jumpHeight++;
naruto.y -= jumpSpeed;
if(jumpHeight>10)
jumpSpeed -= 4;
}

if(naruto.hitTestObject(ground))
{
    trace("HELLO!");
jumpHeight =0;
jumpSpeed = defaultJumpSpeed;
}
    }

Here is the link for my work: https://www.mediafire.com/?8d5opy49fuqmup5

Here is the problem:

sentences: Using a Windows forms Textbox control in an XNA game What I want to do is this: Use a standard Textbox control in an XNA game. This will be the only control used, and the game is designed in xna alone. I (for some reason) cannot get the game to "see" the System.Drawing assembly in the program. I have added the needed reference, but still nothing.

sentences:
Projection Matrix Causes Clip Cuttoff Problem I'm trying to setup my renderer and I'm configuring the matrices. I currently have a View Matrix and a Projection Matrix which I then multiply and send to the shader(there's no need for model matrix since I'm just testing).

The problem is I just can't seem to get the projection matrix right. My model of a sphere appers cut in half in the center of the screen, I can move it around but once the Z value for the transform in the matrix goes beyond 1(Vulkan's max value for NDC) the model cuts off.

This is the code for the view matrix:

ViewMatrix(3, 0) = CamPos.X;
ViewMatrix(3, 1) = -CamPos.Y;
ViewMatrix(3, 2) = CamPos.Z;

The numbers on the left are the rows and those on the right the columns. Matrices are row-major. And my renderer's coordinate system is left handed.

This is the code for the projection matrix:

auto f = 1 / tan_half_fov;

_Matrix(0, 0) = f / _AspectRatio;
_Matrix(1, 1) = -f;
_Matrix(2, 2) = _Far / (_Near - _Far);
_Matrix(2, 3) = -1;
_Matrix(3, 2) = (_Near * _Far) / (_Near - _Far);

The matrix is just an identity matrix and the every frame it gets set those values. tan_half_fov is 0.41421356, since it's tan(45 deg / 2). _Near is 1, and _Far is 500.

The vertex shader:

void main()
{
    gl_Position = inData.Pos * vec4(inPos, 1.0);
}

inPos is the vertex data input for vertex position and inData.Pos is the ViewProjection matrix.

The matrix multiplication code is working alright, I tested it. When sending to the shader just the view matrix the sphere appears all flat on the screen and moves around correctly. I am using Vulkan.

Any help is appreciated!

sentences:
Intermediate AI for Java games I want to know how to create good AI for a Java game,  I'm still learning the language and I'm not an expert.
I can do static AI but wanna know about  writing an AI that follows the player and considers how to reach him via pathfinding.

sentences:
Rectangle in object-layer has wrong coordinates in game I extended the SuperKoalio LibGDX Example about an Tiled Object Layer in the Tiled Level-Editor and draw a rectangle on this layer.
Now I would like to draw this rectangle in my game using the ShapeRenderer debugRenderer from the above SuperKoalio Example.

So, I changed the renderDebug method from example:

private void renderDebug () {
    Gdx.graphics.getGL20().glLineWidth(1.5F);

    // I think something is wrong with this:
    debugRenderer.setProjectionMatrix(camera.combined);

    debugRenderer.begin(ShapeType.Line);

    //Removed the rendering of the rectangles around ground and player

    // I added the object layer "objects" in the level1.tmx map
    // And this code:
    MapLayer objectLayer = map.getLayers().get("objects");
    debugRenderer.setColor(Color.RED);
    Rectangle rect;
    for(MapObject mo : objectLayer.getObjects()) {
        rect = ((RectangleMapObject) mo).getRectangle();
        debugRenderer.rect(rect.x, rect.y, rect.width, rect.height);
    }

    debugRenderer.end();
}

Running this looks like:

The rectangle is missing in game and I can't figure out why.
Removing the setting of the ProjectionMatrix camera.combined makes the rectangle visible but it doesn't stick on the map and scrolls with the player. The position is a little wrong, too.

You can find my gist with modified example here.

How do I render this rectangle correctly? Thanks in advance!

sentences:
Beginning on animations I am clueless with regards to animations. I have a simple rendering engine that renders models, sprites, skyboxes and whatnot; but everything is simply static with no animations whatsoever. With my engine written in C++ and OpenGL I will have to learn how to implement animations accordingly; but any OpenGL book or tutorial I look for doesn't explain animations. It's probably one of those topics which being so complex requires its own book or something.

Does anyone know any great resources to explain how I can programme animations? I'm not interested in learning how to design them, rather just the technical side of it, you know: bones and all. I would also welcome tips as to the general concept of modern animations in OpenGL. If it also means much, I use assimp as my model loader. Suffice it to say, how does a programmer animate a model to 'run' or 'jump'?

sentences:
How can I make an actor fire a bullet on touch? I created a Jet and a Bullet, and when Jet is touched, the Bullet is fired.

Now I want to know how can I make the Jet fire again when touched after it has fired the first shot?

public class MyGdxGame implements ApplicationListener{

    private Texture bulletTexture;
    private Texture jetTexture;
    private Stage stage;
    private JetActor jetActor;
    private BulletActor bulletActor;

    int counter=0;
    float jetX = 700,jetY = 150;
    float bulletX = jetX-10, bulletY = jetY +43;
    boolean started;

    public class JetActor extends Actor{

        public JetActor() {
            setBounds(jetX, jetY, jetTexture.getWidth(), jetTexture.getHeight());
            this.addListener(new InputListener(){
                public boolean touchDown(InputEvent event, float x, float y, int pointer, int buttons){
                    stage.addActor(bulletActor);
                    System.out.println(counter);
                    counter++;
                    started = true;
                    return true;
                }
            });

        }

        @Override
        public void draw(Batch batch, float parentAlpha) {
            batch.draw(jetTexture, jetX, jetY, jetTexture.getWidth(), jetTexture.getHeight());
        }
    }

    public class BulletActor extends Actor{
        @Override
        public void act(float delta) {
        }

        @Override
        public void draw(Batch batch, float parentAlpha) {
            batch.draw(bulletTexture,bulletX,bulletY,bulletTexture.getWidth(), bulletTexture.getHeight());
        }
    }

    @Override
    public void create() {
        bulletTexture = new Texture("C:\\Users\\User\\Documents\\LibGdxMainProjects\\SampleGame1\\android\\assets\\bullet.png");
        jetTexture = new Texture("C:\\Users\\User\\Documents\\LibGdxMainProjects\\SampleGame1\\android\\assets\\jet.png");
        stage = new Stage();
        jetActor = new JetActor();
        bulletActor = new BulletActor();
        stage.addActor(jetActor);
        Gdx.input.setInputProcessor(stage);
    }

    @Override
    public void dispose() {
    }

    @Override
    public void render() {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if(started){
            bulletX -=5;
        }
        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

    @Override
    public void resize ( int width, int height){
    }

    @Override
    public void pause () {
    }

    @Override
    public void resume () {

    }
}

sentences:
High Performance Vector Graphics Solutions I'm looking for a high performance vector graphics library I can use in my games.

I'm thinking along the lines of vector graphics such as those that can be made with SVG.

I'll consider any language at the moment (but must run on Windows).
A solution that takes advantage of GPU hardware would be great.

Thanks in advance.

sentences:
How to use default framebuffer's depth/stencil when rendering to a texture? Is it possible to use the default framebuffer depth buffer when rendering to a texture (instead of using a depth texture)?

The Idea is to continue to render part of the scene normally but on a separate texture so I can later apply a post-processing effect without having to incur the cost of having another stencil/depth buffer. Ho can I do that?

sentences:
How do I test if a circle and concave polygon intersect? I have a polygon (sometimes convex, but often concave), and a bunch of circles with different radii. How can I find out if a circle is intersecting/overlapping with the polygon?

I could split my concave polygon into convex pieces. Would that help?

sentences:
Multiple overlapping rectangles I have a collision method where the parameters for the method are the rectangle of the player and a list with the rectangles of the tiles.

I work with booleans like bLeft, bRight,... and this creates a problem if my player collides with two tiles at the same time, then one tile may say True while the other says false.

This is my collision method (NOTE: Very buggy and incomplete collision detection, this is because the reason above)

public override void Collision(Rectangle collisionRect, List<Rectangle> tileCollision)
{

    foreach (Rectangle rect in tileCollision)
    {
        if (collisionRect.Intersects(rect))
        {

            rect2 = Rectangle.Intersect(rect, collisionRect);

            collision = true;
            stopping = true;
            walking = false;

            if (collisionRect.X < rect.X && !(collisionRect.Y <= rect.Y - 50))
            {
                bLeft = true;
            }

            if (collisionRect.X > rect.X && !(collisionRect.Y <= rect.Y - 50))
            {
                bRight = true;
            }

            if (collisionRect.Y <= rect.Y - 50)
            {
                bUp = true;
            }

            if (collisionRect.Y >= rect.Y + rect.Height)
            {
                bDown = true;
            }

            if (bLeft && !bRight && !bUp && !bDown)
            {
                fallingTest = false;
                stopping = true;

                if (left)
                {
                    stopping = false;
                    fallingTest = false;
                }
            }

            if (bRight && !bLeft && !bUp && !bDown)
            {
                fallingTest = false;
                stopping = true;

                if (right)
                {
                    stopping = false;
                    fallingTest = false;
                }
            }

            if (bUp)
            {
                ground = true;
                fallingTest = true;
                stopping = false;

                if (moving)
                {
                    walking = true;
                }

                if (bLeft && bUp)
                {
                    stopping = true;

                    if (left)
                    {
                        stopping = false;
                    }
                }

                if (bRight)
                {
                    stopping = true;

                    if (right)
                    {
                        stopping = false;
                    }
                }
            }

            if (bDown && !bRight && !bLeft && !bUp)
            {
                stopping = true;
                fallingTest = false;

                if (moving)
                {
                    walking = true;
                }
            }
        }

        if (!(tileCollision.Any(c => collisionRect.Intersects(c))))
        {
            collision = false;
            fallingTest = false;
            stopping = false;

            ground = false;

            if (moving)
            {
                walking = true;
            }
        }
    }
}

So I basically need a line of code that counts the colliderboxes that the player collides with at the moment of collision. I tried doing this by adding 1 to the variable collisionBoxes but this results in doing +1 each frame (because this collision method is called in  Update)

I also use rect2 for visual overlapping of the player collision box and the tile collision box, but when the player touches more than one tile, then the rect2 only shows on one tile. This is because I use the foreach but I tried using a list to store the overlapping rectangles in but it didn't work.

One more question, should I use all these booleans? Because I don't know how to handle them if more than one block touches the player (all the tiles are checking for the booleans, resulting in bugs).

sentences:
Instantiate and launch prefab that's overlapping player? I’m very new to Unity and C#. I’m trying to create my first game and I have now invested about 15+ hours trying to find solutions to this issue...I’m stumped!

My player sprite (blue square) needs to launch a prefab sprite (red circle) of similar size ‘appearing’ to originate from itself. Here is a GIF of what I have so far...I don’t want the blue cube to collide and go flying.

After clicking and dragging on Player (drag-to-aim) via OnMouseDrag to set the target vector, I’m trying to Instantiate a prefab sprite (Dynamic RigidBody2D, CircleCollider2D) using the Player sprite’s position (a Dynamic RigidBody2D, BoxCollider2D) and have it APPEAR to be originating from inside the Player object. Launch is triggered via function called in OnMouseUp. Both objects should immediately come under control of Physics to collide with the environment which will include other moving RigidBody2D objects later. Targeting should allow 360 degrees to include straight into an obstacle allowing rebound effect.

Here is some excerpts of my code:

using System.Collections;
using UnityEngine;

public class Teleportation_Grenade : MonoBehaviour {

/*
    This script is attached to Player and requires_
    projectile prefab.

    tested with thrust set between 100 and 200.
*/

    public float thrust;
    public Transform prefab;
    public LineRenderer playerShotLine;

    private Vector2 playerToMouse;
    private Vector2 targetVector;

//...

    void OnMouseDrag()

    {
        Vector3 mouseWorldPoint = Camera.main.ScreenToWorldPoint (Input.mousePosition);
        Vector2 playerToMouse = mouseWorldPoint - transform.position;
        mouseWorldPoint.z = 0f;

        playerShotLine.SetPosition (0, transform.position);
        playerShotLine.SetPosition (1, mouseWorldPoint);
        playerShotLine.sortingOrder = 3;

        //opposite direction of line renderer
        targetVector = -playerToMouse;

    }

    void OnMouseUp()

    {
        SpawnPrefab ();
    }

    void SpawnPrefab()

    {
        Instantiate(prefab, new Vector3(transform.position.x, transform.position.y, 0), Quaternion.identity);

        prefab.GetComponent<Rigidbody2D> ().AddForce (targetVector * thrust, ForceMode2D.Impulse);
    }
}

This is only one of many, many iterations. It's the gist of it though. I appreciate any insight from the community.

sentences:
How can I solve this SAT direct corner intersection edge case? I have a working SAT implementation, but I am running into a problem where direct collisions at a corner do not work for tiled surfaces. That is, it clips on the surface when going in a certain direction because it gets hung up on one of the tiles, and so, for example, if I walk across a floor while holding both down and left, the player will stop when meeting the next shape because the player will be colliding with the right side rather than with the top of the floor tile.

This illustration shows what I mean:

The top block will translate right first and then up.

I have checked here and here which are helpful, but this does not address what I should do in a situation where I don't have a tile-based world. My usage of the term "tile" before isn't really accurate since what I'm doing here is manually placing square obstacles next to each other, not assigning them spots on a grid.

What can I do to fix this?

sentences: Can running unity of a system with nvidia graphics card speed up the simulation? I have a nvidia GTX 1080 graphics card in my computer, I don't know if unity by default makes use of GPU. Does having a GPU helps to speed up unity simulations.

sentences:
How do you get the best rendering performance in a 2D Java Game? I have seen a lot of tutorials, and they develop games with 2 different ways:

The first one is using a virtual image (BufferedImage) and filling it's pixels. And displaying virtual picture.

private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
private int[] colors = new int[6 * 6 * 6];

Second one is using lots of real images. And displaying they.

SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png"));

    //PLAYER SPRITES PROVIDED BY: AddFact
    player = sheet.crop(width * 4, 0, width, height);

    dirt = sheet.crop(width, 0, width, height);
    grass = sheet.crop(width * 2, 0, width, height);
    stone = sheet.crop(width * 3, 0, width, height);
    tree = sheet.crop(0, 0, width, height);

First Question: Which one has the best performance ?

Second Question: How should we load maps? With images or with text files ? Which one is good to chose ?

Sorry for my english. I hope I can explain to you :) Thanks for helping, have a nice day ^^

sentences:
Is my StatisticManager idea overkill? I'm writing a shmup and I'm working on implementing things like level design and achievements. I have a trigger system that I've implemented which allows me to do basic things and can assist the basic level workflow. However, as it is, this isn't really flexible enough to recognize some other things, such as:

Determine when an enemy is killed vs. removed from the game
Not taking damage during some period of time
Killing enemies using a particular weapon
Killing enemies in a particular order

Whereas the triggers I have available now basically poll for information, these need to look through a series of events to understand whether the condition is met. So I've conceived a StatisticManager class which would be able to take and store all these events, and provide queries so that new triggers could be written to test for these things. For example, a trigger might ask for an ordered list of enemies killed during some time period, and then determine whether a particular sequence of kills is met.

The design raises a lot of concerns, though, such as determining when to discard / archive data, and how to get statistical data from previous game sessions. Certainly efficiency is a concern.

So my question is: Does my StatisticManager idea seem appropriate for my needs? What other designs should I consider?

sentences:
Unit conversion for physics I'm doing the physics for a 2D game which visuals are represented in openGl. Gravity is 9,8 m/s^2, how do i convert that to my screen size? OpenGl sets width to -1 to 1, and does aspect ratio of the screens real width and height to get height's size(normaly from -3 to 3, due is a smartphone game).

I know i have to convert meters to my screen size units, but what are those units and how do I convert meters to them? For example, lets say I want my screen to represent 20 meters, what are the maths?

9,8 m/s^2 * x screenUnits/m = y screenUnits/s^2

Those screen units are pixels? It doesn't make much sense cos OpenGl scales from -1 to 1 independend of the amount of pixels represented by that size. I want this to work the same on various smartphones.

Thanks in advance.

sentences:
RPG - storing player data Given the following tree structure, where each player logged in can have data for current and completed levels, quests per level, NPCs per quest, and multiple tasks per NPC... I'm trying to figure out the best way to store the current and completed data per player.

I asked the question before, albeit with too much detail. It was requested that I generalize the question... So if you'd like more context, see here:

https://stackoverflow.com/questions/23587430/rpg-storing-player-data-for-semi-complex-tree-structure

Some information about my RPG structure:

Levels, Quests per Level, and Tasks per NPC are completed in chronological order.
NPC dialog and task dialog data is stored in a js object in a npc_dialog_1.js file in the following structure:

var dialog = {
quests : {
    questName : {
        NPCName: {
            TaskName:  {
                 "english" :
                  [
                      "Hello, here is some dialog",
                  ],//more items per task
            }, //more tasks per NPC
        }, //more NPCs per quest
    }, //more quests options per "quests"
}, //more options in dialog besides "quests" if I want
};

I am storing each dialog object in a separate npc_dialog_n.js file per map, that     I'm retrieving with requireJS. This will reduce clutter in a single npc_dialog file.
NPCs per Quest, however, can be started in any order... this is trying to mimic a GTA-style quest queue, as the game follows a general linear progression, yet for each quest you can talk to multiple NPCs and start, pause, and resume the NPC's tasks at any point.

Since the player can start, pause, and resume tasks per any NPC at a given time, I'm trying to figure out the best way to store the current and completed data per player.

mfirdaus recommended the following DB table with M:M relationship b/t user & npc... yet this would add up quickly as each player can have multiple NPCs per quest, and multiple tasks started per NPC... Any way around this set up?

My current db schema:

Thank you

sentences:
Setting 4 different enemy spawn zones off screen This is my first game, so I really appreciate all the help.

I want to create four enemy spawn zones for enemies and this areas are off screen. The enemies are coming from left, right, up and down, and their destination is a sprite on the center of the screen. And there are 4 types of enemies (only thing that changes is color).

Current code I have only makes the enemies come from the right direction into the screen. I don't really know the reason of this, I am really new to game making and some of this methods.

Relevant code I have for enemies if the following:

private void createEnemies() {
    listP.add(regionA);
    listP.add(regionV);
    listP.add(regionAm);
    listP.add(regionR);
    Random ran = new Random();
    int z = ran.nextInt(3 - 0 + 1) + 0;
    Sprite ship = loadSprite(100, 100, listP.get(z));
    attachChild(ship);
    Enemies enemy = new Enemies(ship);

}

 @Override
protected void onManagedUpdate(float pSecondsElapsed)   {
    listP.add(regionA);
    listP.add(regionV);
    listP.add(regionAm);
    listP.add(regionR);
    Random ran = new Random();
    int z = ran.nextInt(3 - 0 + 1) + 0;
    super.onManagedUpdate(pSecondsElapsed);
    timeEnemies +=  pSecondsElapsed;        //  Acumulates time
    if  (timeEnemies>TIME_LIMIT)    {   //  Time has completed
        timeEnemies =   0;
        Sprite spriteEnemy  =   loadsprite(GameControl.CAMARA_WIDTH+listP.get(z).getWidth(),
                (float)(Math.random()*GameControl.CAMARA_HEIGHT-listP.get(z).getHeight())   +
                        listP.get(z).getHeight(),listP.get(z));

        Enemigos newEnemy = new Enemies(spriteEnemy);
        //newEnemy.mover(0,10);
        listEnemies.add(newEenemy); //  Adds it to the scene
        attachChild(newEnemy.getEnemySprite()); //  adds to list

    }

    //  Updates enemies and checks if any has gone offscreen
    for (int    i=listEnemies.size()-1; i>=0;   i--)    {
        Enemies enemy   =   listEnemies.get(i);
        enemy.getEnemySprite().setPosition(GameControl.CAMARA_WIDTH,0); // <-- Was experimenting with this code, but doesn't really help now
        enemy.mover(-10,0);
        if  (enemy.getEnemySprite().getX()<-enemy.getEnemySprite().getWidth())  {
            detachChild(enemy.getEnemySprite());        //  Eliminates from scene
            listEnemies.remove(enemy);                                                                  //  Eliminates from the list
        }
        //  Checks collision with center sprite

        if  (spriteCenter.collidesWith(enemy.getEnemySprite())) {
            detachChild(enemy.getEmemySprite());

        }
    }
}

Enemies class:

public class Enemies {

private Sprite sprite;

public Enemies(Sprite sprite) {

    this.sprite = sprite;
}

public Sprite getEnemySprite() {
    return sprite;
}

public void setSprite(Sprite sprite) {
    this.sprite = sprite;
}

public void mover(int dx, int dy) {

    sprite.setPosition( sprite.getX()+dx, sprite.getY()+dy );
}

}

sentences:
transformations of matrices I'm in the process of reading up on 3d matrices and trying to following this powerpoint and had a few questions as to how to exactly determine the type of transformation from a matrix.

If I have a matrix such as...

a 0 0
0 b 0
0 0 1

or

1 0 a
0 1 b
0 0 1

...would these be considered a translation by (a, b) vector?

Or a matrix such as...

cos(a) -sin(a)   0
sin(a)  cos(a)   0
  0        0     1

... would this be considered rotation about Z-axis through the angle a?

Is there a better way to visualize these?

sentences:
How to correctly Dispose a SourceVoice once its finished i am starting to play a sound with XAudio2 and SourceVoice and once its finished, it should be correctly disposed to not have any leaks.

i was expecting it to be something like this:

        sourceVoice.Start();
        sourceVoice.StreamEnd += delegate
            {
                if (!sourceVoice.IsDisposed)
                {
                    sourceVoice.DestroyVoice();
                    sourceVoice.Dispose();
                }
            };

but that crashes with a read access violation in native code deep in XAudio2.dll which i cant debug.

sentences:
Calculate normal angle in screen space I'm working on adding billboarded sprites to a game engine, but the engine allows for walking on curved terrain, like spheres. In order to look like the player is walking on the terrain, I want to start with the billboard, then rotate it around its origin (bottom centre) so that its up vector matches the screenspace normal of the terrain.

Here's a diagram of the general idea:

The billboarding works fine - passed the camera's rotation matrix to the sprite, and the poly quad's 0,0,0 is at the bottom centre of the canvas.

How can I get the angle between the normal and screenspace up?

I think it's a matter of projecting the normal with the MVP matrix, to get it as a 2D screenspace vector to calculate the angle from. But I'm not having much luck attempting to implement it.

The sprites take their positioning from the centre of the tiles, along with the normal. I'd also like to move the sprites down in the rotated axis, so that they cover the tile they're standing on.

Any other methods are welcome too.

sentences:
Why is integer value not updating as a text? I have a space shooter game and I am trying to create a shield power for the player ship. My mechanic for shield is working. When I press the shield power button(P), the shield power decreases from 100 to 0 at a certain pace.

Problem is that I am trying to draw this shield power value on screen but it's just showing the starting shield power value(which is 100) and not showing the decrease in shield power value when I press the shield button.

What am I missing?

Here's the relevant code:
Game.cpp

if (keyboard->IsKeyPressed('P'))
{
    if (player_->shield == true)
        player_->shield = false;
    else
        player_->shield = true;
}

if (player_->shield && player_->shieldPower > 0)
{
    if (keyboard->IsKeyPressed(VK_SPACE))
    {
        XMVECTOR playerForward = player_->GetForwardVector();
        XMVECTOR bulletPosition = player_->GetPosition() + playerForward * 10.0f;
        SpawnBullet(bulletPosition, playerForward);
    }

    player_->shieldActive = true;
    if (GetTickCount() - player_->time > 100)
    {
        player_->time = GetTickCount();
        player_->shieldPower--;
        if (player_->shieldPower <= 40)
        {
            player_->shieldPowerLow = true;
        }
        else
        {
            player_->shieldPowerLow = false;
        }
    }
}
else
    player_->shieldActive = false;

TextClass.cpp

void TextClass::OnRender(System *system)
{
Graphics *graphics = system->GetGraphics();
FontEngine *fontEngine = graphics->GetFontEngine();
Player *player = new Player();

Game *game = system->GetGame();
game->RenderEverything(system->GetGraphics());

std::stringstream buffer;
buffer << player->shieldPower;

fontEngine->DrawText(buffer.str().c_str(), 50, 100, 0xffffffff,
FontEngine::FONT_TYPE_SMALL);
}

Player.h

class Player
{
public:

int shootDelay;
int time;
int shieldPower;
bool shield;
bool shieldActive;
bool fullShield;
bool shieldPowerLow;
bool shoot;
}

Player.cpp

Player::Player() :
shootDelay(500),
shieldPower(100),
fullShield(true),
shieldPowerLow(false),
shield(false),
shieldActive(false),
shoot(false)
{
}

sentences:
Perspective projection I'm studying Perspective projection in a computer graphics course and i'm really confused about a detail. The study material says there are 3 cases:

Case 1: View plane parallel to the xy plane and Projection reference point (0,0,0)
Case 2: View plane coincident to the xy plane and Projection reference point (0,0,z)
Case 3: View plane parallel to the xy plane and Projection reference point (0,0,z)

In all these cases seems that all the objects to which we apply the perspective transform have a negative z. So my question is: Why all z are negative? Is it related to the previous step (so the camera transform?)?

sentences:
How can I test if a point lies between two parallel lines? In the game I'm designing there is a blast that shoots out from an origin point towards the direction of the mouse. The width of this blast is always going to be the same.

Along the bottom of the screen (what's currently) squares move about which should be effected by the blast that the player controls.

Currently I am trying to work out a way to discover if the corners of these squares are within the blast's two bounding lines. I thought the best way to do this would be to rotate the corners of the square around an origin point as if the blast were completely horizontal and see if the Y values of the corners were less than or equal to the width of the blast which would mean that they lie within the effected region, but I can't work out

sentences:
How does copyright on sources work If I want to create a game in which I use sources from another game that has copyright is illegal. But what if I use screenshots from a 3D game to make another 2D game (something like a questionnaire)? Or what if I use the 3D models from the first game, render them with a program like cinema4D or blender in 2D and use them in the 2D game? And if it is illegal please explain me why and what laws of copyright would apply in that case.

I know that observing how a game works or any software for that matter and then reverse engineering it is legal so doing the same thing with resources from a game is legal. That's why I wanted to make clear my question is not related to reverse engineering.

sentences: How to activate Xbox controller vibrations in Unity? Is there any way to toggle the XBOX controller vibrations in Unity ? I came across Handheld.Vibrate() but it seems like it's not meant for controllers.

sentences:
Is it possible to have concurrent collision detection where every entity acts at exactly the same time? There are many algorithms that can be used for collision detection. In many cases we check for an overlap in coordinates of an entity.

If we make a triangle a,b and c. We have 2 entities at a and b heading for a collision at c but each of them are moving at exactly the same time, what kind of algorithm could work?

It seems more like a chess game where you would have to predict every move that the other entity would have to make, if they swerve to the left to avoid a collision will they also run the chance to collide. Is it possible or is it too complex? Would it work for thousands and millions of entities in the same search space?

sentences:
What functional language is most suited to create games with? I have had my eye on functional programming languages for a while, but am hesitating to actually get into them. But I think it's about time I at least starting glancing that direction to make sure I'm ready for anything.

I've seen talk of Haskell, F#, Scala, and so on. But I have no clue the differences between the languages and their communities, nor do I particularly care; except in the context of game development.

So, from a game development standpoint, which functional programming language has the most features suited for game programming? For example, are there any functional game development libraries/engines/frameworks or graphics engines for functional languages? Is there a language that handles certain data structures which are commonly used in game development better?

Bottom line: what functional programming language is best for functional game programming, and why?

I believe/hope this question will declare a clear best language therefore I haven't marked it CW despite its subjective tendency.

sentences:
Raycast algorithm fails to collide with diagonal walls in specific locations I'm having a problem with my ray-cast algorithm in a 2D tile-based universe. I feel the situation would be best explained with a picture, so here it is:

The ray, represented by the blue line, is passing "through" the wall to hit its target when the wall passes through a point where the quantized line moves diagonally and the wall is perpendicular to it. The raycast function is as such:

def raycast(pos, direction, level):
    dx, dy = direction
    t=0
    x, y = pos
    obj=None
    while not obj and t < 5000:
        t+=1
        x+=dx
        y+=dy
        obj=level.get_at((round(x),round(y)),True)
        pass
    return obj

Is there a simple, efficient way to eliminate this kind of edge case?

sentences:
Load individual sprite from a sprite sheet and make it a FlxSprite I'm using flixel and flixer power tools which contains a FlxButtonPlus class that allows me to load 2 FlxSprite as each button state, the problem is that FlxSprite requires a Class a its source but I would like to have a single spritesheet for all my buttons and call each one from there, rather than having a bunch of pngs for every button and every state.

Any idea on how to do that?

sentences:
Python/PyGame mixer.music playback of OGG file has intermittent clicking sound - how to proceed? I have a class within my python + pygame game that handles sound - it worked well until I tried use pygame.mixer.music to switch between streaming .ogg music files. The class switches between them on the pause event.

The issue I'm having is that the music will play, and even switch between tracks fine, but about half the time I'm getting a quiet, regular clicking noise over the sound track. I've checked, and the pygame mixer is set to the same bitrate as my .ogg files. I've tried playing with number of channels and tracks, all to no avail. I'm not sure what the root cause of the clicking is - whether I've chosen a poor file encoding / bitrate, or just not initialized/called pygame mixer correctly.

Here is the problimatic code:

class SoundMgr():

def __init__(self):
       pygame.mixer.init(22050, -8, 4, 4096)
       self.musicFilename = ""
       self.musicPos = 0
       self.musicVolume = .35
       self.musicMuteVolume = .1

def playMusicTrack(self, which):
    pygame.mixer.music.load("data/music/" + which + ".ogg")
    pygame.mixer.music.set_volume(self.musicVolume)
    pygame.mixer.music.play(-1)
    self.musicFilename = which

def dampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + "b.ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicMuteVolume)

def undampenMusic(self):
    mark = pygame.mixer.music.get_pos() * 0.001
    self.musicPos += mark
    pygame.mixer.music.load("data/music/" + self.musicFilename + ".ogg")
    pygame.mixer.music.play(-1, self.musicPos)
    pygame.mixer.music.set_volume(self.musicVolume)        </code>

When I call dampenMusic / undampenMusic the track plays correctly, but about half the time it has a clicking sound over it. The other half of the time it plays perfectly. I've tested, and I can't discover any pattern to when it will / won't have the static.

The clicking noise is about 2 times a second, and is about 50% the volume of the track.

Anyone who is more experienced with pygame / sound encoding able to give me any tips?

sentences:
Spawn prefabs from list one by one when trigger is touched I am trying to spawn one gameobject from a list of gameobjects each time I touch the trigger with the controller.

But when I do this, all the game objects from the list spawn together at the same time. I couldn't figure out how to solve this problem and make them spawn one at a time instead, where the next touch spawns the next object in the list, and so on.

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

public class Trigger : MonoBehaviour
{

    public Transform spawnPoint;
    //public GameObject Prefab;
    public List<GameObject> items = new List<GameObject>();

    void OnTriggerEnter(Collider other)
    {
        //GameObject Prefab = new GameObject("prefab");

        for (int i = 0; i < items.Count; i++)
        {
            Instantiate(items[i], spawnPoint.position, spawnPoint.rotation);
            Debug.Log("Hello World" +i);
        }

    }

}

sentences:
Rendering an Isometric Tile-based Map I'm coding an isometric game in c++ with SDL.  My question is this:
At the moment, every cycle the game redraws the entire map layer by layer, inserting actors and cursors and so on at the appropriate time.  Would it be substantially faster (or better for some other reason) to instead have a big surface for each level generated at the beginning, and blit each layer all together instead of drawing it tile by tile.

Thanks for any responses!

sentences:
minecraft mapping from tibia OTBM file I am new to minecraft modding but i program for a living and it looks quite simple to get around. I have this fantasy and a quick internet search shows im not the only one. For those of you who do not know tibia is an MMORPG first released in 1997. It is a 2d tile based game and i would like to see it in 3D. since it is a tile based game it fits nicely with the minecraft architecture. Tibia is a close sourced game but there is TibiaOT which is developed by the community and the map file format is OTBM (open tibia binary map). This is a set of 15 2D grids where each grid represents a floor or the height of the grid, the file comes with two more files with monster spawns and default item locations like chests.

There is a tibia texture pack for minecraft called "Tibian texture pack", so we got the materials covered.

all in all we have the following: a native tibia map and a minecraft texture pack

people have been building tibia maps manually for years now, it seems stupid because we have a binary file for the real map. what we need is a way to map the OTBM file to a minecraft map. i am looking for tools and any other tips a on how to digest the files into a minecraft map file. an explanation of minecraft map file format would also be very helpful.

sentences:
Play games services leaderboard does not work all the time I am trying to login into play services. I got it working. But there were duplicate game objects created. So I added do not destroy on load and now the play services work the first time I access it.

But when I go to play game scene, end the game and come back to main menu, I can not seem to load the leaderboards.

public class PlayServices : MonoBehaviour {

public static PlayServices services;

private void Awake()
{
    if(services != null)
    {
        Destroy(gameObject);
    }
    else
    {
        services = this;
        DontDestroyOnLoad(gameObject);
    }
}

// Use this for initialization
private void Start () {
    PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();

    PlayGamesPlatform.InitializeInstance(config);
    // recommended for debugging:
    PlayGamesPlatform.DebugLogEnabled = true;
    // Activate the Google Play Games platform
    PlayGamesPlatform.Activate();
    SignIn();
}

sentences: What game engines can publish to Android and iOS? I am about to start on a project which, at a minimum, will release to Android and iOS. Are there any game engines, other than Unity, which can publish to both? I fear that Unity might contain more overhead then we need, for what is essentially a 2D game.

sentences:
How can I switch between scenarios in a text game? I am making a text-based adventure game. How should I go about changing to another scene if the player wants to e.g. go to the house or walk down the road?

I am using Objective C, but C will work also. Here is my code so far:

printf("Welcome to Kingdom Quest! This is a text game.\nYou will be shown what is going on ");
printf("and it is up to you to decide what to do. Use words like get, go and pick up.\nDo not use any upper case letters.");

printf("\n\nYou are in a feild and it is almost nighttime. You are facing north. The only thing you have is an empty ruksak.");
printf("\nWhere do you want to go");
printf("\n>");

while (true) {

char string[256];
fgets(string, 255, stdin);

if (strcmp(string, "go north\n") == 0 || (strcmp(string, "go n\n") == 0))
{
    printf("There is a rusty old sword on the ground.");
    printf("\n>");
}
else if (strcmp(string, "get sword\n") == 0 || (strcmp(string, "pick up sword\n") == 0))
{
    printf("Sword taken.");
    printf("\n>");
}
else if (strcmp(string, "go south\n") == 0 || (strcmp(string, "go s\n") == 0))
{
    printf("Nothing is this way.");
    printf("\n>");
}
else if (strcmp(string, "go east\n") == 0 || (strcmp(string, "go e\n") == 0))
{
    printf("There is a dirt road here.");
    printf("\n>");
}
else if (strcmp(string, "go west\n") == 0 ||  (strcmp(string, "go w\n") == 0))
{
    printf("There is a small mountain up ahead, with a house on top of it.");
    printf("\n>");

}
else
{
    printf("What?");
    printf("\n>");
}

sentences:
Segmenting an MMO market I've been considering a segmented market for an MMO:

There is a different market for each in-game level (Level 1 players can only buy/sell items from the Level 1 market)
If a player levels up with items still in the market, they remain there, but can be removed if the player wishes.
The levelled market is the only way to trade items between players.

A few things I expect to happen:

The market won't be completely segmented.  If the Level 2 market's price for X is higher, then I'll just keep it to sell (and vice versa).
However, despite the above, there will still be X sold, as buying/selling makes it easier for the player to level up.
Therefore, there will be an inflation curve, where gold will be worth less and less on each level.
Inflation over time will occur faster at level 20 than at level 1.

Are my assumptions above correct?

sentences:
Fixed background on a SurfaceView I'm currently working on a top-down twin-stick shooter for Android. I've got my player moving around and shooting, but I'm looking to add a large Bitmap background which is larger than the device screen.

I'm looking for a way to position the background at 0,0 in 'world' co-ordinates, and have the view able to pan across the background with the player. I've tried using SurfaceHolder.Callbacks, but these do not seem to play nicely with my SurfaceView class. The view currently follows the player while keeping it centred, until it reaches an edge, where it will stop and the player will continue until he hits a wall.

My current thoughts are to store an offset from view co-ordinates to world co-ordinates in the update loop, and draw the bitmap using these offsets in the draw loop. Is there a more efficient way to do this, or a different way to think about it?

sentences:
Civilization 6 add City States in World Builder There are instructions to access the Civ 6 Worldbuilder in civfanatics forums.

The TZ mod method allows starting with a custom map, but there are no generated city states.

How can I add city states to the map / mod so the game does not crash on the first turn?

sentences:
Loading Bitmap by name in Android Currently, I'm loading images as follows:

sampleimage= BitmapFactory.decodeResource(context.getResources(), R.drawable.sampleimage);

This automatically chooses the correct image from the drawable-hdpi, drawable-mdpi or drawable-ldpi folders.

How can I load the bitmap using the image name as the string "sampleimage.png"?

sentences:
Unity + Oculus Rift - Setting field of view or rendering part of display I need to render a small portion of the display to a texture.

I found a script to simulate a scissor rect by modifying the projection matrix - Unity 5 doesn't seem to provide any out-of-the-box scissor functionality. However, modifying the matrix in this way causes my scene to render monoscopic.

Suggestions? There used to be an OVRCameraController class that provided a SetVerticalFOV() method, but that appears to have been removed from the SDK.

sentences:
ERROR : Destroying assets is not permitted to avoid data loss I want my gameObject named lvl_01 to destroy when I click left or right arrow key but it's keep showing this error "Destroying assets is not permitted to avoid data loss" instead of destroying that gameObject, Can anybody please tell me what is going wrong around here.

using UnityEngine;
using System.Collections;

public class Level_01Text : MonoBehaviour {
public GameObject lvl_01;
// Use this for initialization
void Start () {
    Instantiate (lvl_01);
}

// Update is called once per frame
void Update () {
    if((Input.GetKey(KeyCode.RightArrow)) || (Input.GetKey(KeyCode.LeftArrow)))
    {
        Destroy (lvl_01);
        Debug.Log ("Something is seriously going wrong around here");
    }
}

}

sentences:
Detect obstacles in path on a tile-based map I'm creating a 2d game with a tile-based map, but smooth movement. I currently use A* in combination with some other tricks for pathfinding, and one issue what I've been dealing with is getting the units to move smoothly despite tile-based pathfinding.

My solution at the moment is the use raycasting to determine if there is an obstacle between a unit and its target. If there is, it uses A*. Otherwise, it just sets its next move directly as the coordinates of its target. In the case that it uses A*, I also use raycasting to determine which point in the path the unit should move to next, by finding the nearest point in the path that is not obstructed from the units current location, and setting that as the next move. This is necessary so the unit doesn't have to move in a jerky fashion based on the tile-based path that the A* found.

Raycasting is faster than A* every time, but it still has some overhead with a large number of units since it checks every point on the line in small increments. (More so since I'm doing double raycasting each time to account for the size bounds of the unit)

My question is: Is there a better algorithm than raycasting to determine if there is an obstacle between two points (independent of the tiles structure) on a tile-based map? My thought is that there is some way to take advantage of the tiled nature of the map.

sentences:
Fast, simple procedural 2d island generation I need to generate tile data for an island based rpg, my goal is have something that looks like this (mountains not required):

For the past few days I have been trying to figure out a satisfactory way to generate tile data that will give me varied and natural islands, such as in the example above.

I've tried using Unity's Mathf.PerlinNoise but the results are far too random, and I can't see a way to get it to generate a single island.

Using LibNoise I was able to get slightly better results, although the generation seems to be significantly slower and perhaps better suited to 3d terrain. Similarly however, I can't see a way to set the Octaves/Frequency/etc, so that I get a nice single island each time.

While there are a fair amount of resources online for perlin/noise in general, it mostly seems to be aimed at 3d terrain and height, where I simply have a 2d array of int for my tile data, that maps to either water, sand or grass and needs to be generated in such a way that sand/grass are grouped together logically to form an island.

Any help would be greatly appreciated!

sentences:
Gradient Input in Game view I want to develop a little tool to help visualize fireworks before using them in a show in Unity where the user can set several parameters and gets a preview of the firework effect in a preview window. To allow the user to customize color over time like I can currently statically do in the visual effects graph, I wanted to add a Gradient input field to my UI.
After fiddling around with manually trying to make things work, I stumbled upon the new UIElements / UI Toolkit and following this Medium post was able to render a simple text UI in a Panel Renderer. However the Gradient Field I added won't show up (which is quite reasonable because in the UI Builder it said something about "Editor only").
Just to make sure, the box on the left is what I mean:

I was strolling around in the Asset Store for a while but couldn't find anything like what I was looking for (just shaders and stuff to apply a gradient to UI elements amongst other things). Other searches led to tutorials on how to completely custom build a single color selection tool which both seemed like a larger effort and didn't allow creating a full gradient.
The question is: Is there some sort of library, package or tool I could use to add an input like that to my "game"? Or am I taking a completely wrong approach with this?

sentences:
Is HTML5/WebGL performance unreliable on low-end Android tablets and phones? I've developed a couple of WebGL games, and am trying them out on Android.  I found that they run very slowly on my tablet, however.  For example, a game with 10 sprites or so runs as 5fps.  I tried Chrome and CocoonJS, but they are comparably slow.  I also tried other games, and even games with only 5 or so moving sprites are this slow. This seems inconsistent with reports from others, such as this benchmark.  Typically, when people talk about HTML5 game performance, they mention well-known and higher-end phones and tables.  While my 7" tablet is cheap (I believe it's a relabeled Allwinner tablet, apparently with the Mali 400 GPU), I found it generally has a good gaming performance.  All the games I tried run smoothly. I also developed an OpenGL ES 2 demo (in Java) with 200 shaded 3D objects, and it ran at 60fps.

My suspicion is that the WebGL engines have unacceptably limited support for many low-end and white-label devices (for example, relying on software fallback for no apparent reason), which means there may be a large section of gamers you will not reach when you choose this as your platform. I've heard rumors about inconsistent performance of HTML5 and WebGL on different devices, but no clear picture emerges.

I would like to hear if any of you have had similar experiences with HTML5 or WebGL, or whether I can find information about the percentage of devices I can expect to have decent performance.

EDIT: As a "thorough" way to prove my point, I've started on a WebGL implementation of my own, to see if I can do any better than CocoonJS.  Results are promising so far. On said tablet I can draw like 10,000 sprites at 60fps, all updated and drawn in JS through a WebGL compatible API. Check out the APK here.  So, I guess that proves that the existing WebGL implementations are really doing something wrong.  I'm now in the process of making my games playable in my framework.

sentences:
"lerp" returning value (Shader)? I don't understand the lerp example in this code :

if(dot(WorldNormalVector(IN, o.Normal), _SnowDirection.xyz)>=lerp(1,-1,_Snow))
                o.Albedo = _SnowColor.rgb;
            else

(Snow is in the range 0..1)

The article says :
We then compare the dot value with a lerp - if our Snow level is 0 (no snow) this returns 1 and if the Snow level is 1 it will return -1 (the entire rock is covered).  It's quite normal to only vary the snow level between 0..0.5 when we use this shader so that we only have snow on surfaces that actually face the snow direction.

Why does it return 1 (with Snow at 0) and -1 (with Snow at 1) ?

(source: http://unitygems.com/noobs-guide-shaders-2/ )

Thanks

sentences:
Sphere intersection Stuck I have two spheres that are bounded by spheres for collision detection. I do not want them to intersect. My intersection works. But it gets stuck. Once the function returns true, I cannot get it out. I tried

collideBool = ObjectOne.Intersect(ObjectTwo);

if(collide == true)
{
    leftright = leftright;
    updown = updown;
}
else
{
if(GetAsyncKeyState(VK_RIGHT))
leftright -= dt;
if(GetAsyncKeyState(VK_LEFT))
leftright += dt;
if(GetAsyncKeyState(VK_DOWN))
updown += dt;
if(GetAsyncKeyState(VK_UP))
updown -= dt;
}

collide = false;

My sphere gets stuck. What is a way around this?

sentences:
Limit a scrollbar's OnValueChanged to full step intervals only So I have done some research on the matter but I can't find anything.

I created a UI scrollbar and asigned 10 steps to it.Then I noticed that the values of the scrollbar does not change in reference of the handle's steps but in reference of the pointer's position(like a slider).That seriously slows down the performance since it has a lot more to process "onValueChanged" and it is unnecessary for what I am trying to achieve.

The values of the steps should go step 1: 0.1(1),step 2: 0.2(2) etc.I need to get these values and nothing in between or the step that the handle is currently on.

How can I do that ?

sentences:
How to efficiently keep the player from moving outside the gameobject he is colliding with? I am developing a game with Unity 2017.
The game mechanics are as follow:

Classic top-down RPG;
Movements are: UP, DOWN, LEFT and RIGHT;
Player evolves in a 16*16 map;
He can dig in the direction he wants to make his way through the map one tile at a time;

At first I was using a very classical approach using tilemaps, RigidBody2D and BoxCollider2D on tiles and the player GameObjects.

Collision detections went fine and my tilemap looked pretty much like that (red being the walls and white the empty spaces):

The problem with this approach is that I have to keep in memory the state of 256 tiles in a List<Vector2f> and to create the 256 expected GameObjects representing either my walls (which a totally black), or my floor (the empty space).

Creating a black GameObject with its own BoxCollider2D for each of the tile seems a little bit overkill. And this brings me to the second iteration of my game: to keep in memory only the tiles the player digged.

What I would like to achieve efficiently, is to let the player evolve as long as he is colliding with an underlying tile, but stop moving as soon as he doesn't.

This is ok:

This isn't, and player should be placed to previous state.

I could take advantage of OnTriggerEnter2d and handle custom collision and response, but I have the feeling that something more simple and more optimized may exists somehwhere in the wild!

Thanks to any help provided!

sentences:
Vertices in index buffer not rendered I'm beginning with the 3D rendering in Monogame and i'm facing not a real issue because i already find a way to bypass it but more of a question.
I'm rendering a simple cube with 8 vertices like that:

_vertices[0] = new VertexPositionColor(new Vector3(-1, 1, -1), Color.Red);
_vertices[1] = new VertexPositionColor(new Vector3(-1, -1, -1), Color.Red);
_vertices[2] = new VertexPositionColor(new Vector3(1, -1, -1), Color.Red);
_vertices[3] = new VertexPositionColor(new Vector3(1, 1, -1), Color.Red);
_vertices[4] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Green);
_vertices[5] = new VertexPositionColor(new Vector3(-1, -1, 1), Color.Green);
_vertices[6] = new VertexPositionColor(new Vector3(1, -1, 1), Color.Green);
_vertices[7] = new VertexPositionColor(new Vector3(1, 1, 1), Color.Green);

But i'm also using an index buffer to draw each triangle for each faces and this is where my issue is. When i'm doing the following:

_indices = new int[] // 6 faces, each containing 2 triangles of 3 vertices
{
           0, 1, 2, 0, 2, 3, // front
           3, 2, 6, 3, 6, 7,
           4, 0, 3, 4, 3, 7,
           1, 5, 6, 1, 6, 2,
           4, 5, 1, 4, 1, 0,
           4, 7, 6, 4, 6, 5 // back
};

The render is perfect and every edge is rendered as you can see on this gif:

https://imgur.com/h7Kn4uH

But when i changed the order inside the index buffer of the back part, like the following:

_indices = new int[] // 6 faces, each containing 2 triangles of 3 vertices
{
           0, 1, 2, 0, 2, 3, // front
           3, 2, 6, 3, 6, 7,
           4, 0, 3, 4, 3, 7,
           1, 5, 6, 1, 6, 2,
           4, 5, 1, 4, 1, 0,
           4, 6, 7, 4, 5, 6 // back, update is here
};

The only thing that was updated is the order of the last column and the result is the following:

https://imgur.com/aCR3QXc

Why does the render is not done on the second case when the only change made is the order of two vertices ?
I know that I can do a rasterize state to render each side of a triangle but one solution is working without it, so i'd like to avoid using it.

Thanks!

sentences:
Selecting/Hiding is broken for Perspective but works for Orphographics views. Why? I'm learning Unreal4. Got a problem with selecting, focusing and hiding objects.

Focusing Issue: Focusing have to be done separatly for perspective view and ortho view. Why it is so?

Example: If I select an object in perspective view and focus on it (key F) everything works only for perspective view, but at the same time in ortho view no focusing occurs. So inorder to focus on the object in the ortho plales too I have repeat the whole process again: find object in orpho plane, select it, click F and only then focusing happens in all ortho view planes.

In perspective view "Show only selected" does not work, but works in ortho views
The same issue with "Show all actors".

Please, I need help. Thnaks.
P.S. Damn, it looks like I'm in some kind of a mode (for the lack of a better word). I mean in my clicking around, i've clicked ON some mode and now this selection\hiding thing works buggy...

sentences:
Handmade Terrain vs. Terrain Engine in Unity? I'm planning a game right now, to be made in Unity, and I'm trying to decide how I'll approach the basic level construction. Essentially, my game takes place on an island in an infinite ocean, very similar to Wuhu Island:

My question concerns all the stuff heightmaps can't handle. To use Wuhu Island as an example, note the lighthouse cliff, and the nearby similarly jutting-out cliff. The volcano itself is also empty, and there are some tunnels through it on the other side.

I was thinking I would just model the entire island myself in Cinema 4D, but as I read more about the terrain system, it seems Unity has special optimized rendering systems in place for terrain objects. Would I be shooting myself in the foot performance-wise if I just built my island entirely by hand? This will be for mobile, so the little stuff might well count. Am I even approaching this question correctly - if not, how would you best go about creating (something very close to) Wuhu Island as a level in Unity? Is there any reason for me to not do it as one mesh? I have effectively zero experience with 3D game dev - only rendered 3D video/stills for other applications, so this is a learning process.

sentences:
database design help for game / user levels / progress Sorry this got long and all prose-y. I'm creating my first truly gamified web app and could use some help thinking about how to structure the data.

The Set-up

Users need to accomplish tasks in each of several categories before they can move up a level. I've got my Users, Tasks, and Categories tables, and a UserTasks table which joins the three. ("User 3 has added Task 42 in Category 8. Now they've completed it.") That's all fine and working wonderfully.

The Challenge

I'm not sure of the best way to track the progress in the individual categories toward each level. The "business" rules are:

You have to achieve a certain number of points in each category to move up.
If you get the number of points needed in Cat 8, but still have other work to do to complete the level, any new Cat 8 points count toward your overall score, but don't "roll over" into the next level.
The number of Categories is small (five currently) and unlikely to change often, but by no means absolutely fixed.
The number of points needed to level-up will vary per level, probably by a formula, or perhaps a lookup table.

So the challenge is to track each user's progress toward the next level in each category. I've thought of a few potential approaches:

Possible Solutions

Add a column to the users table for each category and reset them all to zero each time a user levels-up.
Have a separate UserProgress table with a row for each category for each user and the number of points they have. (Basically a Many-to-Many version of #1.)
Add a userLevel column to the UserTasks table and use that to derive their progress with some kind of SUM statement.

Their current level will be a simple int in the User table.

Pros & Cons

(1) seems like by far the most straightforward, but it's also the least flexible. Perhaps I could use a naming convention based on the category ids to help overcome some of that. (With code like "select cats; for each cat, get the value from Users.progress_{cat.id}.") It's also the one where I lose the most data -- I won't know which points counted toward leveling up. I don't have a need in mind for that, so maybe I don't care about that.

(2) seems complicated: every time I add or subtract a user or a category, I have to maintain the other table. I foresee synchronization challenges.

(3) Is somewhere in between -- cleaner than #2, but less intuitive than #1. In order to find out where a user is, I'd have mildly complex SQL like:

SELECT categoryId, SUM(points) from UserTasks WHERE userId={user.id} & countsTowardLevel={user.level} groupBy categoryId

Hmm... that doesn't seem so bad. I think I'm talking myself into #3 here, but would love any input, advice or other ideas.

P.S. Sorry for the cross-post. I wrote this up on SO and then remembered that there was a game dev-focused one. Curious to see if I get different answers one place than the other....

sentences:
What's the fastest way to copy a texture to another texture in OpenGL? Here's the options I've found:

glBlitFramebuffer: Create framebuffers for the textures, bind textures as GL_READ_FRAMEBUFER and GL_DRAW_FRAMEBUFFER, call glBlitFramebuffer().
glCopyTexImage2D: My research so far says this method is probably slow.
Shaders: Make a framebuffer and render target, render the source texture to the dest texture.

sentences:
SelectBox in LibGDX doesn't display and freezes the program after a click I am currently trying to apply an overlay with LibGDX over my 3D ModelBatch. Everything works fine except for the SelectBox. Once instanciated, it shows up on my screen I can click on it once but then it freezes. The drop-down list is not displayed and the clicks are no longer registered by my application. However, if my second click is under the standard position of the list, that is where it should be drawn when it drops down, an item is selected but then any third click will just return the list to the original selected item and no click is registered by my application anymore. I am running the application on Desktop.

Using break points in the SelectBox.class I was able to notice that the third and other next clicks are registered by the SelectBox.class as part of the list in the Listener responsible for selecting an item.

selectBox = new SelectBox<Object>(skin);
selectBox.setItems(array);
selectBox.setSelected("Custom");
stage.addActor(selectBox);

array in this case is an instance of Object[] containing only Strings. This is the only part of code I have related to the selectBox.

I have tried using an array of String[] at first but then switched to Object as suggested on a LibGDX forum.

I am currently using the latest Nightly Build of 2014/04/11 as I also need TextArea which is not yet in the stable release. However, I have tried the stable release 0.9.9 and it doesn't work either.

Am I using the right code to declare my SelectBox, or what could I do to make the SelectBox behave properly that is display its list when clicked and return to a normal state after an item is selected?

sentences:
ways to make a physics engine Hey so i've been looking into real time physics engines, which led me to the crazyLaggoa multiphysics engine by thiaga costa, and brought up the question of:

What are some possible ways, ideas that have or have not already been done to make a real time physics engine? How about non-real time?

I know the Lagoa engine uses meshes and a crapload of particles... and then there's the rigid body way of going about things.....
Also i'm only at 2d level in creating games right now so any 2d physics ideas would be great too!

sentences:
SDL 2.0 filtering mouse events I have a simple 2-D breakout clone. It works fine, except for one bug.

If I move mouse over game window, it will get input from mouse(mouse movement), and event queue will instantly be flooded with this input. For example, if player pressed left arrow, but moved his mouse over a window before, he will have to wait enough frames for mouse events to get processed.
Is there a way to ignore mouse event? At least these movement ones. Everything is okay when mouse doesn't move, but after it moves it's terrible.

I'm using SDL 2.0, programming on Debian-based linux. Using C++.

Code for handling events looks like this(requested):

void gameEngine::HandleEvents()
{
    if( SDL_PollEvent(&gameEvent) != 0 )
    {
        HandleEngineEvents();
        gameLevel.HandleEvents(gameEvent);
    }
}

HandleEngineEvents() :

void gameEngine::HandleEngineEvents()
{
    if( gameEvent.type == SDL_QUIT)
    {
        running = false;
    }
    else if( gameEvent.type == SDL_KEYDOWN && gameEvent.key.repeat == 0 )
    {
        if( gameEvent.key.keysym.sym == SDLK_ESCAPE )
        {
            running = false;
        }
    }
}

Level::HandleEvents() :

void Level::HandleEvents(SDL_Event& gameEvent)
{
    player.HandleEvents(gameEvent);
}

Player::HandleEvents() :

void Player::HandleEvents(SDL_Event& gameEvent)
{
    if(gameEvent.type == SDL_KEYDOWN && gameEvent.key.repeat == 0)
    {
        switch(gameEvent.key.keysym.sym)
        {
        case SDLK_RIGHT:
             velocity += 1;
            break;
        case SDLK_LEFT:
            velocity -= 1;
            break;
        default:
            break;
        }
    }
    else if(gameEvent.type == SDL_KEYUP && gameEvent.key.repeat == 0)
    {
        switch(gameEvent.key.keysym.sym)
        {
        case SDLK_RIGHT:
             velocity -= 1;
            break;
        case SDLK_LEFT:
            velocity += 1;
            break;
        default:
            break;
        }
    }
}

sentences:
Does every Windows Phone 8 device have one of a fixed set of resolutions? Does every Windows Phone have one of the following 4 resolutions?
800x480, 1280x768, 1280x720, 1920x1080 pixels

Or is it possible that some devices only have a resolution of 1280x719 or 1279x720 pixel?

I use this code to determine the resolution of the device:

Resolution = new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

But if I use the 720p and 1080p emulators, then I have the following results:

Resolution = Width:1279 Height:720

Why is the resolution width 1279 pixel and not 1280 pixel wide?

I get the same results with this code:

width = GraphicsDevice.PresentationParameters.BackBufferWidth;
height = GraphicsDevice.PresentationParameters.BackBufferHeight;

Is there a difference between GraphicsDevice.PresentationParameters.BackBufferWidth and GraphicsDevice.Viewport.Width? Which one should I use to determine the resolution of a Windows Phone device?

sentences:
Unity new Input system lists actions and compare them to current input I have a scriptable object called Move that had a list with keycodes (for example to make a Hadouken) easy to use and compare with the current input made it with the old system, but with the new input system I don't know how to make a list of actions (actions that are in my Input Action Asset not new ones) and compare that with the current inputs (and also I do not have any idea how to make buffering inputs like the last input repeats 3 frames).
I already tried and not worked (InputMa is my InputActionAsset generated class):
-InputActions[]
-InputMa[]
-InputMa.PlayerActions
-InputActionReferences[] this seems the correct option, but I don't know how to get the reference from the current input.

sentences:
Bringing islands close together programmatically I generate island/continent maps and I want to make a grand archipelago of sorts where all these islands are located. The problem is that I don't know a smart way to place the islands programmatically so that the keep a minimum distance from each other. Sure, I can create a quadtree but then how do I place it? Placing it on top of another island and move it away in a random direction? I'm attaching a photo of what I want to do, easily done in Paint .NET from 6 individual maps.

The scale I'm talking about would be placing about 3-10 continents, each with a resolution of 4Kx4K upwards. (I'll only allow reflections and translations in placement, to preserve some 4-/8- connectivity pixel work that I've done for the maps)

What I'm NOT looking for:
 - a global minimum solution ( all islands as close together as possible)
 - using a heavyweight physics/maths library or tons of code
 - a super-simplistic solution either (e.g. calculate OBBs and use those to resolve collisions)

sentences:
Connecting to external computer with lidgren I'm new to networking and thought i'd muck around a bit with lidgren before i start implementing it in my games, so i made a little client/server chat program that works fine on localhost and lan. I can connect other computers on my subnet and chat, but when it comes to connecting a friends computer not connected on my home network it becomes a bit tricky. I set up UPnP and port forwarding on the server application and i connect the client directly using my external IP address, but the problem seems to come from connecting my client with my external IP address as they never actually connect.

        Network.config = new NetPeerConfiguration("SKGCHAT");
        Network.config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);
        Network.client = new NetClient(Network.config);
        Network.client.Start();
        Network.outMsg = Network.client.CreateMessage();
        Network.outMsg.Write("password");
        Network.client.Connect("121.217.195.105", 14242, Network.outMsg); //doesnt work
        //Network.client.Connect("192.168.0.14", 14242, Network.outMsg); works
        //Network.client.DiscoverLocalPeers(14242); works

This is the client initialisation

        Network.config = new NetPeerConfiguration("SKGCHAT");
        Network.config.Port = 14242;
        Network.config.EnableUPnP = true;
        Network.config.EnableMessageType(NetIncomingMessageType.DiscoveryRequest);
        Network.config.EnableMessageType(NetIncomingMessageType.ConnectionApproval);
        Network.server = new NetServer(Network.config);
        Network.server.Start();
        Network.server.UPnP.ForwardPort(14242, "SKG Chat bb");

and this is the server initialisation

This following code should display a message to the server if it even receives the clients connection attempt but when run, no connection attempts are received.

 case NetIncomingMessageType.ConnectionApproval: //wan
                    string message = incMsg.ReadString();
                    outMsg = server.CreateMessage();
                    outMsg.Write("You've been received");
                    server.SendUnconnectedMessage(outMsg, incMsg.SenderEndPoint);
                    if (message == "password")
                    {
                        incMsg.SenderConnection.Approve();
                        finalMsg = "New Connection";
                        readDiag = true;
                    }
                    else
                    {
                        incMsg.SenderConnection.Deny();
                        finalMsg = "Connection denied";
                        readDiag = true;
                    }
                    break;

I honestly am lost when it comes to networking and have no clue why it isnt connecting. Any help would be greatly appreciated.

sentences:
Detecting key press only once in Libgdx Have a question on keyboard inputs. Currently I am using this method to read my input, Gdx.input.isKeyPressed(Input.Keys.A), it is working fine. But I do realized at times there are multiple instances of A being pressed when I only press once. And I understand that the method had to be placed in the render() method for it to work. Is the problem due to the refreshing?

My question is, how can I only detect 1 instance of "A", when A is pressed for once.

sentences:
Libgdx: Aligning buttons inside dialog I have the following dialog, semi circle shape. I want to position  buttons in it.

        dialog.button(closeButton, false);
        dialog.getContentTable().add(buttonS);
        dialog.getContentTable().add(button);
        dialog.getContentTable().add(hwTo);

The only way I am able to move a button is by using for a example

    dialog.getContentTable().add(hwTo).pad(300);

But I don't want to pad anything, since it affects other buttons, I tried align, button.setPosition and whatnot, nothing works.

I was told to remove the table and ise Custom WidgetGroup. I removed the table, still having the same problem, nothing works except padding.

sentences:
Unity find position within range of object Say you have a gameobject that is at a certain position(this could be your player).

Now say that you have a melee NPC that has to be within a certain range to hit the Player.

Now you would do something like this to find out where the player is:

var targetPosition = target.transform.position;

Say that the range of the NPC is 4 meaning he can be 4 units away from the player before he can start attacking him.

My question is how would you subtract that to get a position that is within range?

And am i doing this type of thing correctly? or is there a better way of doing it?  :)

Any help would be appriciated a lot!

sentences:
Frenet frame and application I have just been reviewing Frenet Frame math. It is an interesting geometrical issue.

I know that common applications are:

camera movement along a curve
tube and ribbons surface

Can someone suggest other interesting applications?

sentences: Best way to do "cutscenes" I'm curious about the best way to display cutscenes in canvas. When I say cutscene I mean something like a static image fading from one to the other. Would it be best to use a timeout for a certain amount of seconds then go to the next image? Alternatively, would it be better to somehow use the main loop and increment a counter? If anyone has a method they use, post an answer! :D

sentences:
Why can't I put a source image in my Image component? I can't put an image here as source image, and I have trouble figuring out why.

What did I miss?

sentences:
Movement of an object based on thrust and gravity force in 2d scrolling game, need help I want to make a box "fly" so while user press D it's add thrust then on A it decrese untill 0, W and S control the direction of my box.

I have problems after I add the gravity to update correctly my X and Y position.
My actual code is like this: (I'm using gamemaker but it's same as other languages, came execute 60 frames per second)

frametime = delta_time / 1000000;
spd = sqrt(power(velx ,2)+power(vely ,2));
tempgy = g * frametime ;
//tempay = ((thrust / m) * 32) * frametime; // or my box procede diagonally offcurse
tempax = ((thrust / m) * 32) * frametime;
y -= (vely + tempgy/2   + tempay/2 ) * frametime ;
x += (velx + tempax/2  ) * frametime ;
vely += tempgy + tempay;
velx += tempax  ;

m is mass of object = 500

g = 9.81

32 it's pixel per meter

So, basically I calculate the acceleration on gravity, and need to apply acceleration to x and y based on direction if I not understand wrong. So for the X component of thrust I have to multiply sin(degtorad(dir)) and for the Y must multiply cos(degtorad(dir)), but I have to apply the sin and cos only on acceleration?

I think I am doing it wrong because if I use g=0 and just using thrust my box act not as intended (ex: If I try to do a loop and stop accelerating my box will not follow the loop direction but continue on straight line)

Sorry for the stupid question but I really not know how to fix it. I see lot of tutorials with vectors but it's not supported here so can't use them. Thank you and best regards.

sentences: Why is there grey haze that appears when game is simulated in viewport, and how do I fix it? For some reason when the game runs in the regular viewport (not it's own) a grey haze slowly appears. This never used to happen. The level architecture (code) changed recently and then this started happening. However, none of the assets or visual build configurations were changed. This problem does not occur when the game is running in a separate viewport, but the fact is it wasn't an issue in the default viewport before. Does anyone know what is causing this and how to fix/prevent it?

sentences:
How to perform a fast ray cylinder intersection test? I need an algorithm in c++ to get the intersection point of a line if there is an intersection. My cylinder is defined by a 3d vector center point, a float height and radius. I don't need to take rotation into consideration at all so I don't need any rotation parameters.
The only one found similar to my needs was this: https://github.com/iceman201/RayTracing/blob/master/Ray%20tracing/Cylinder.cpp
but after implementing it gave me wrong results. All the other ones I found used weird arguments that weren't even close to my desire. So I am pretty stuck now.

sentences:
Third person camera xna I'm trying to create a third person camera in my XNA game. I'm able to move the model I have and the camera at the same time, although the camera is not "following" the model. The model moves faster than the camera. Ultimately, I want the camera to rotate with the model with the left and right keys, and move the model with forward and back.

This is in my update method

    if (keyState.IsKeyDown(Keys.D))
        {
            camera.Rotation = MathHelper.WrapAngle(camera.Rotation - (rotateScale * elapsed));
        }

        if (keyState.IsKeyDown(Keys.A))
        {
            camera.Rotation = MathHelper.WrapAngle(camera.Rotation + (rotateScale * elapsed));
        }

        if (keyState.IsKeyDown(Keys.W))
        {
            camera.MoveForward(moveScale * elapsed);
            player.Position += new Vector3(0.1f, 0f, 0f);
        }

        if (keyState.IsKeyDown(Keys.S))
        {
            camera.MoveForward(-moveScale * elapsed);
            player.Position += new Vector3(-0.1f, 0f, 0f);
        }

player is the model I'm using. Currently the A and D keys don't do anything with the model.

    public class Camera
{
    private Vector3 position = Vector3.Zero;
    private Vector3 lookAt;
    private Vector3 baseCameraReference = new Vector3(0, 0, 1);

    private bool needViewResync = true;

    private float rotation;

    public Matrix Projection { get; protected set; }
    private Matrix cachedViewMatrix;

    public Vector3 Position
    {
        get
        {
            return position;
        }

        set
        {
            position = value;
            UpdateLookAt();
        }
    }

    public float Rotation
    {
        get
        {
            return rotation;
        }

        set
        {
            rotation = value;
            UpdateLookAt();
        }
    }

    public Matrix View
    {
        get
        {
            if (needViewResync)
                cachedViewMatrix = Matrix.CreateLookAt(Position, lookAt, Vector3.Up);

            return cachedViewMatrix;
        }
    }

    public Camera(Vector3 position, float rotation, float aspectRatio, float nearClip, float farClip)
    {
        Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, nearClip, farClip);
        MoveTo(position, rotation);

    }

    private void UpdateLookAt()
    {
        Matrix rotationMatrix = Matrix.CreateRotationY(rotation);

        Vector3 lookAtOffset = Vector3.Transform(baseCameraReference, rotationMatrix);
        lookAt = position + lookAtOffset;
        needViewResync = true;
    }

    private void MoveTo(Vector3 position, float rotation)
    {
        this.position = position;
        this.rotation = rotation;
        UpdateLookAt();
    }

    public Vector3 PreviewMove(float scale)
    {
        Matrix rotate = Matrix.CreateRotationY(rotation);
        Vector3 forward = new Vector3(0, 0, scale);
        forward = Vector3.Transform(forward, rotate);
        return (position + forward);
    }

    public void MoveForward(float scale)
    {
        MoveTo(PreviewMove(scale), rotation);
    }
}

I also want to offset the camera for obvious reason, but changing the values in the variable baseCameraReference doesn't change what I want it to

sentences:
Possible to open Hammer directly from shortcut? I want to open Hammer(for CS:GO) directly from windows shortcut, without the SDK-launch menu. Is this possible? I've only been able to open the SDK launcher from a shortcut.

And, is it possible to open a map directly as well? So, 1 shortcut that opens Hammer, with a specific map inside of Hammer?

If there exist a launch option for this, then I can use that!

sentences:
Draw user interface in OpenGL using web technologies I am developing a desktop game in C++ and OpenGL. Frameworks I use are GLM and SFML. Since today I used the console window for debug messages. But I want to get rid of that and display debug information right into the render window.

Since I also want to implement a generic way to realize user interface, I decided to use web technologies for that. Note that the user interface will be only a two dimensional overlay on the rendered three dimensional scene. I consider using the webkit browser engine but that might be overkill since I do not need page loading and networking but only HTML and CSS rendering (and maybe JS execution). Because the user interface and debug messages will change every few frames, this is performance related.

How to render fullscreen webpages (with a transparent background) over my OpenGL scene? I would like a cross-platform solution.

sentences:
How can I design an effective some sort of sequence system? I am making a story driven game right now, and I want to create a system that will allow me to code sequences easily without creating a mess from the project.
What I mean by sequences is for something like a Scene, for example, since it's story driven, the player begin in a room, which then a character walk in, display a dialogue, then walks away, does a few things, a couple of sounds and effects are played, etc.

I was wondering how I could structure a system like that, that will allow me to have hundreds of this sequences without making a big mess of my project, also, these are going to be must like scripted, is it better to keep most of the scripts in a fewer class files or it's a good idea to spread them more? (to more class files)

I hope you can understand exactly what I meant and thank you in advance.

(I am making this in C# in Unity but I am not looking for specific code, just theory how to construct such system effectively)

sentences: Can I count all the allocated textures in D3D11? Is it somehow possible to get the count of all texture objects on a device?

sentences:
Multisampled Texture i have some doubts with multisampled textures.

In fragment shader, how to pass multiple samples?

We use glTexImage2DMultisample instead of glTeximage2D. so, how to upload texture data?

I want to use default FBO for this.

sentences:
Quantity of dropped/spawned items in container I'm having trouble figuring out how to spawn more than one item in to a container with a weight limit. What I'm having trouble with is the understanding, rather than what statements to write;

My items are composed of weight, type and foundIn, among other things. My containers are items, with some minor changes. foundIn is an array of strings which match "container" items, and should be either "world", "container-name", or empty ([]). "container" items follow a similar structure, with slight deviance.

Whenever I want to drop an item, I get a pool of items in a foundIn location, make a Math.random check against the commonRate, and if that item is a type = "container", I try to fill the container.

Here is where I have my problem; I can not figure out how to decide if multiple items of the same type should be dropped inside the container, and if so, how many. If I can figure this out, I can have monsters carry their own drops, instead of having to write a whole monster drop-table with levels and oddities.

The following is my code. The last method, dropItem, glues the displayed methods together.

placeExists(place) {
    return this._itemPlaces.indexOf(place) > -1;
}

getItemsOfType(arrayOfTypes, inList) {
    if (!Array.isArray(arrayOfTypes)) throw new Error('Index must be string');
    let pool = this.list;
    if (inList) pool = inList;

    return pool.map((item => {
        if (arrayOfTypes.indexOf(item.type) > -1) {
            return item;
        }
    }));

}

populateContainer(container, pool) {
    let chance = Math.random();
    pool = pool.map(item => {
        let canBeFound = item.foundIn.indexOf(container.name) > -1
                || item.foundIn.indexOf('world') > -1;
        if (item.commonRate >= chance && canBeFound) return item;
    });

    this.getItemsOfType(container.availableTypePool, pool).some(item => {
        if (container.capacity.freeSpace <= 0) return true;
        if (item.commonRate >= Math.random()
                && item.weight <= container.capacity.freeSpace) {
            container.addItem(item);
        }
    });

    return container;
}

getItemsOfPlace(place) {
    return this._LIST.map(item => {
        if (item.isFoundIn(place)) {
            return item;
        }
    })
}

dropItem(fromPlace) {
    if (this.placeExists(fromPlace)) return [];
    let foundItem = [];

    let pool = this.getItemsOfPlace(fromPlace);
    pool.some(item => {
        let chance = Math.random();
        if (chance > item.commonRate) {
            if (item.type == 'container')
                foundItem.push(this.populateContainer(item, pool));
            else
                foundItem.push(item);
            return true;
        }
    });

    return foundItem;
}

// container abstracted method of adding an item

container.addItem = (item = new Item()) {
    if (item instanceof Item === false) throw Error('item needs to be of type Item');
    if (item.type == 'container') throw Error('Yo dawg, I heard you like containers...');

    this._contained.push(item.code);
    this.carryingWeight = +item.weight;
}

How do I decide if I should drop multiple items, and how do I randomly select that amount?

Note that this.list and this._LIST are the same list. For some reason, WebStorm seems to lose track of one or the other when inside certain callbacks, so I switch to avoid losing autocomplete. For reference, this.list is get list() { return this._LIST }, and is obtained from extending a custom List class.

sentences:
XNA HLSL Shader Glow I have googled this to death, and I still don't quite understand it.

I'm trying to create a glow effect in XNA using HLSL. A long time ago I was able to do it the way most people suggest which is by sampling the pixels from a texture, however I've always been curious about how you can make it more advanced so that you could do things like set the glow distance and stuff. If I recall from back when I was creating something like this in a similar project, there was always a limit as to how much I could sample before the computer couldn't handle it, hence limiting the glow distance. I wanted to know if there was a more sophisticated way of doing it, one that would have no glow distance limit? And I'm not referring to lighting ground textures either, the idea I have in my head is to have a set of vertices that all join together to create a LineList (for this example lets say they create a cube), so you have very thin lines creating a shape, and then you can set a glow on this object that has no limit to its distance, kinda like how Photoshop works I guess.

Thanks

sentences:
How to get plane rotation by known normal vector I have a FPP quaternion Camera and Plane with known normal vector.

I want to find the orientation of this Plane so I can replace it to the Camera orientation to put the camera forward vector to a plane's normal vector.

First method I tried, I don't understand RotationAxis and RotationAngle. I built a rotation matrix and applied it to the camera but it didn't behave as I wanted.
The second method I tried  is with method called "from_one_vector_to_another". I don't understand what the "from" vector is in my example; is it the camera's forward vector?

Here is my pseudo code:

Vector3 vector_from = camera->getForwardVector();
Vector3 vector_to = triangle->faceNormal;

Quat cameraQuaternion = camera->getOrientation();

Quat q = vector_from.getRotationTo(vector_to);//The method `getRotationTo` is from Ogre.
camera->setOrientation(cameraQuaternion * q);

Camera does not change their orientation as I expected; it changes its orientation just a little bit.

EDIT:

Maybe I have something wrong with my code:

//Quat xrot = axisToQuat(Vector3(1, 0, 0), vertical);  // disabled for now
Quat yrot = axisToQuat(Vector3(0, 1, 0), horizontal);
rot = rot * yrot;

position += velocity;

Matrix lookAt = Matrix::createLookAt
        (
            Vector3(position.x, position.y, position.z),
            Vector3(position.x, position.y, position.z-1),
            Vector3(0,1,0)
        );

view = rot.toMatrix() * lookAt;

I am only rotating the quaternion. Should I rotate lookAt Matrix too?

sentences: How to do moving Rorschach using Perlin noise in c# without shaders? I want to be able to make a moving Rorschach using Perlin noise like in this question but I know nothing about shaders. Is there a way to do it in just c#?

sentences:
How to make wall tiles overlap floor tiles a bit in Unity3D? Currently my tiles are very strictly placed, there are wall tiles, and floor tiles, and they don't overlap at all.

What I want to achieve is to have my walls overlap my floors a bit.

So their inner edges doesn't have to be a stright line, but a free shape, with "transparent holes" which show the floor below. Resulting in a much better feeling.

My current approach is to have multiple layers. One for the floor and wall (single) tiles), and one above this, which will have the overlapping, decorative parts of the walls.

But this methods feels slow and clunky:

For one wall tile I have to place 9 tiles/tileparts to make it look nice. (the tile itself plus the neighbours).

It would be better to place just one tile which got overlapping parts

sentences:
How do I build a matrix to translate one set of points to another? I've got 3 points in space that define a triangle. I've also got a vertex buffer made up of three vertices, that also represent a triangle that I will refer to as a "model".

How can I can I find the matrix M that will transform vertex in my buffer to those 3 points in space ?

For example, let's say my three points A, B, C are at locations:

A.x = 10, A.y = 16, A.z = 8
B.x = 12, B.y = 11, B.z = 1
C.x = 19, C.y = 12, C.z = 3

given these coordinates how can I build a matrix that will translate and rotate my model such that both triangles have the exact same world space ? That is, I want the first vertex in my triangle model to have the same coordinates as A, the second to have the same coordinates as B, and same goes for C.

nb: I'm using instanced rendering so I can't just give each vertex the same position as my 3 points. I have a set of three points defining a triangle, and only three vertices in my vertex buffer.

sentences:
Sound activated particlesystem I am trying to make a particle system that is activated by sound. Like emitting on the beat resizing on the beat and such things.  I found some nice tutorials on how to make things like Windowsmediaplayer visualsynths but they dont really help me to convert it to a particle system.

Anysuggestions how i could do this ?

sentences:
GameObject.Find() can't find object after loading the scene I have 2 scenes in my project, MainMenu and Game.

MainMenu scene contains 2 buttons, 'Hide Black' and 'Hide White'. Game scene contains 2 panels, 'Black' and 'White'. When the user clicks any of button from main menu, I wanna hide the corresponding panel in Game scene and also load the scene. This is the script for the same.
using UnityEngine;
using UnityEngine.SceneManagement;

public class MainMenu : MonoBehaviour {
    public void HideBlack() {
        SceneManager.LoadScene(1);
        GameObject black = GameObject.Find("Black");
        black.SetActive(false);
    }

    public void HideWhite() {
        SceneManager.LoadScene(1);
        GameObject white = GameObject.Find("White");
        white.SetActive(false);
    }
}

But it turns out that GameObject.Find can't find the panels in my Game scene. I looked my forums for help but I find them confusing. What's going on here?
EDIT - This is not from my actual project. I created these scenes just to explain the problem better. I must use 2 scenes in my actual project as I have 3D objects in Game scenes.

sentences:
importing animations in Blender, weird rotations/locations This is for the Blender 2.6 API.

There are two problems:

1. When I import a single animation frame from my animation file to Blender, all bones look fine.
But when I import multiple (all of the frames), just the first one looks right, seems like newer frames are affected by older ones, so you get slightly off positions/rotations.

This is true when both assigning PoseBone.matrix and PoseBone.matrix_basis.

bone_index = 0

# for each frame:
for frame_index in range(frame_count):
    # for each pose bone: add a key
    for bone_name in bone_names: # "bone_names" - a list of bone names I got earlier
        pose.bones[bone_name].matrix = animation_matrices[frame_index][bone_index] # "animation_matrices" - a nested list of matrices generated from reading a file

        # create the 'keys' for the Action from the poses
        pose.bones[bone_name].keyframe_insert('location', frame = frame_index+1)
        pose.bones[bone_name].keyframe_insert('rotation_euler', frame = frame_index+1)
        pose.bones[bone_name].keyframe_insert('scale', frame = frame_index+1)

        bone_index += 1

    bone_index = 0

Again, it seems like previous frames are affecting latter ones, because if I import a single frame from the middle of the animation, it looks fine.

2. I can't assign armature-space animation matrices read from a file to a skeleton with hierarchy (parenting).

In Blender 2.4 you could just assign them to PoseBone.poseMatrix and bones would deform perfectly whether the bones had a hierarchy or none at all.

In Blender 2.6, there's PoseBone.matrix_basis and PoseBone.matrix. While matrix_basis is relative to parent bone, matrix isn't, the API says it's in object space. So it should have worked, but doesn't. So I guess we need to calculate a local space matrix from our armature-space animation matrices from the files.
So I tried multiplying it ( PoseBone.matrix ) with PoseBone.parent.matrix.inverted() in both possible orders with no luck, still weird deformations.

sentences:
Generate a random number of enemies to appear on screen I am currently trying to create 2d shmups. I am trying to:

Generate a random number of enemies to appear on screen
Whatever number is generated will then be added to my List (the list is used to keep track of enemies). to load that number of textures.
I would also like to keep a collection of Vectors to determine the positions the enemies will spawn randomly.

This is what I have done so far:

 List <Enemies> enemies = new List<Enemies>();
 Random rnd = new Random();
 int numberOfEnemies = rnd.Next(1,5); // I would like to generate between 1 and 5.
 if (enemies.count < numberOfEnemies){
     enemies.Add(new Enemy(Content.Load<Texture2D>("alienship");// one of the vectors from the collection of vectors will go here
 }

sentences: Hearthstone suggest a card algorithm Does anyone have an insight of the suggest a card algorithm in hearthstone deckbuilding? I would like to try to see it that same suggestion can be applied in MtG, having for example to choose your total mana and get suggestions for color, colorless and enchantments/artifacts/sorceries/instants.

sentences:
How do I generate surface normals? I have quite a few debug drawing methods in my engine that can generate geometry useful for debugging, like spheres and cubes.

At the moment I do not generate any normals for these shapes. Is there a general purpose method of generating face normals and per vertex normals for an arbitrary mesh? (I'd imagine you would need face normals to generate per vertex normals?)

sentences:
How to seperate gui input from world input? I have a GUI interface and a player that hase code to detect when the mouse is pressed.
When i mess with my GUI buttons the code for the player also fires off; an undesired behavior.  The code in the player is meant for mining or using his current item not meant for buttons.
Some people have suggested using _unhandled_input and mouse filters, but i havent gotten either of those to work.  Im just wondering what the common thing to do in the situation?

sentences:
Unity - how to check if object is fully covered by another objects (2d) I am creating an educational game for kids , and in one of the levels player must to paint animals , like in color book, so I created scene where 2 object , already colorful lion and white lion (white is above) and script, which is instantiating circle sprite masks in players touch position , how can I check if white lion is fully covered by masks and not visiable .

P. S. If you have better idea for painting (like painting with brush) and checking , please say.

sentences:
How do i draw sprite on fixture position? b2BodyDef bd;
    bd.position.Set(1700 / sfdd::SCALE, 150 / sfdd::SCALE);
    bd.type = b2_dynamicBody;
    b2PolygonShape squareShape;
    squareShape.SetAsBox(70 / sfdd::SCALE, 13 / sfdd::SCALE);
    m_body1 = m_world->CreateBody(&bd);
    m_body1->CreateFixture(&squareShape, 100);
    squareShape.SetAsBox(38 / sfdd::SCALE, 16 / sfdd::SCALE,b2Vec2(-54/sfdd::SCALE,-30/sfdd::SCALE),90*DEGTORAD);
    m_body1->CreateFixture(&squareShape, 20);

    squareShape.SetAsBox(30 / sfdd::SCALE, 10 / sfdd::SCALE, b2Vec2(60 / sfdd::SCALE, -20 / sfdd::SCALE), 90 * DEGTORAD);
    m_body1->CreateFixture(&squareShape, 100);

sentences:
Getting error when I Send a message to the RaycastHit object I have created a shooting game, here when I am shooting I have a c# script for damage for enemies.I have Used Raycast to Shoot enemies.if the RaycastHit becomes an enemy, it will be deducted it's health.It works properly.But the thing is, If I shoot objects except enemies it causes an error.
I have provided some details about that.this is the script,

public class DamageSMG : MonoBehaviour
{
    public int DamageAmount = 5;
    public float TargetDistance;
    public float AllowedRange = 50;
    public RaycastHit Shot;
    public int Firing;
    void Update()
    {
        if(Input.GetButton("Fire1")){
            if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward),out Shot))
            {
                TargetDistance = Shot.distance;
                if (TargetDistance < AllowedRange)
                {
                    if (Firing == 0)
                    {
                        Deduct();
                    }
                }
            }
        }
    }
    public void Deduct()
    {
        Firing = 1;
        Shot.transform.SendMessage("DeductPoints", DamageAmount);
        StartCoroutine(Wait());

    }
    IEnumerator Wait()
    {
        yield return new WaitForSeconds(0.1f);
        Firing = 0;
    }
}

I am using an machine gun.therefore I have created Script to fire coutinously with 0.1sec break.When I press Fire1 button, The RayCastHit Object is received a message where the method called DeductPoints with the DamageAmount.As this Script my enemies are deduct point 5 by 5 every hit.Then Destroy the object.The Enemy script is this.

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

public class EnemyScript : MonoBehaviour
{
    public int EnemyHealth = 20;
    void DeductPoints(int DamageAmount)
    {
        EnemyHealth -= DamageAmount;
    }

    // Update is called once per frame
    void Update()
    {
        if (EnemyHealth <= 0)
        {
            Destroy(gameObject);
            GlobalScore.GlobalScorecount += 1;
        }

    }

}

But my problem is when I shoot objects except Enemies(Ex: walls),The console gives an error.The error is like this
SendMessage DeductPoints has no receiver
How can I solve this error or is there any other way of Deducting enemy health with raycast?
I can play the game with this error in UnityEngine.but it is not possible to Build the game.Please help me to Solve this..

sentences:
Xna, after mouse click cpu usage goes 100% Hi i have following code and it is enough just if i click on blue window then cpu goes to 100% for like at least one minute even with my i7 4 cores. I just check even with empty project and is the same !!!

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    private Texture2D cursorTex;
    private Vector2 cursorPos;
    GraphicsDevice device;

    float xPosition;
    float yPosition;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);

        Content.RootDirectory = "Content";

    }

    protected override void Initialize()
    {
        Viewport vp = GraphicsDevice.Viewport;

        xPosition = vp.X + (vp.Width / 2);
        yPosition = vp.Y + (vp.Height / 2);
        device = graphics.GraphicsDevice;
        base.Initialize();
    }

    protected override void LoadContent()
    {

        spriteBatch = new SpriteBatch(GraphicsDevice);
        cursorTex = Content.Load<Texture2D>("strzalka");
    }

    protected override void UnloadContent()
    {
        // TODO: Unload any non ContentManager content here
    }

    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {

        GraphicsDevice.Clear(Color.CornflowerBlue);

        spriteBatch.Begin();
        spriteBatch.Draw(cursorTex, cursorPos, Color.White);
        spriteBatch.End();
        base.Draw(gameTime);
    }
}

sentences:
Plane is not affected by the light source I'm going through a problem and I don't have a reasonable explanation for why this occurs. Basically, I have 3D scene in which there is a light source and simple plane and cube (i.e. .obj models) modeled and exported from Blender. The result with the cube is as follows:

The light source is located at (0,2,0) represented as a while cube and the result of the reflected light on the cube is expected. However when I import the plane model, the result is as follows:

The bottom of the plane should be dark if we are looking from the below of the plane but this is not the case. What things can cause this kind of behavior? Note: the code is identical for both cases.  I use OpenGL and Shaders 3.3 in Windows 10. The API is GLFW.

The plane model is

# Blender v2.78 (sub 0) OBJ File: ''
# www.blender.org
mtllib plane.mtl
o Plane
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
vn 0.0000 1.0000 0.0000
usemtl None
s off
f 1//1 2//1 4//1 3//1

whereas the cube model is

# Blender v2.78 (sub 0) OBJ File: ''
# www.blender.org
mtllib cube.mtl
o Cube
v 0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -0.499999
v 0.499999 0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
usemtl Material
s off
f 1//1 2//1 3//1 4//1
f 5//2 8//2 7//2 6//2
f 1//3 5//3 6//3 2//3
f 2//4 6//4 7//4 3//4
f 3//5 7//5 8//5 4//5
f 5//6 1//6 4//6 8//6

I use assimp library to import models in my application. The fragment shader is

#version 330 core
out vec4 FragColor;

uniform vec3 objectColor;
uniform vec3 lightColor;
uniform vec3 lightPos;

in vec3 Normal;
in vec3 FragPos;

void main()
{
    float ambientStrength = 0.1;
    vec3 ambient = ambientStrength * lightColor;

    vec3 norm = normalize(Normal);
    vec3 lightDir = normalize(lightPos - FragPos);
    float diff = max(dot(norm,lightDir), 0.0);
    vec3 diffuse = diff * lightColor;

    vec3 result = (ambient + diffuse) * objectColor;
    FragColor = vec4(result, 1.0);
}

sentences:
Weird behavior with XNA SpriteBatch.Draw origin I have a texture with 256x256 pixels.

Consider this piece of code:

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

        spriteBatch.Begin();
        spriteBatch.Draw(texture, new Rectangle(0, 0, 100, 100), null, Color.White);
        spriteBatch.End();

        base.Draw(gameTime);
    }

If I run this, the texture appears (predictably) at the top-left corner of the window with the correct size (100x100).

If I do this instead (XNA 4.0-only):

spriteBatch.Draw(texture, new Rectangle(0, 0, 100, 100), null, Color.White, 0, new Vector2(0, 0), SpriteEffects.None, 0);

Everything is still as expected. However, as soon as I change the origin parameter, the position gets weird.

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

        spriteBatch.Begin();
        spriteBatch.Draw(texture, new Rectangle(0, 0, 100, 100), null, Color.White, 0, new Vector2(128, 128), SpriteEffects.None, 0);
        spriteBatch.End();

        base.Draw(gameTime);
    }

In this last example, only 1/4 of the texture is visible.

In other words, the origin parameter not only changes the origin of the rotation, but also the destination rectangle. In other words, the Top/Left coordinates of the rectangle are not the Top/Left coordinates of the drawn sprite, but rather the coordinates of the Origin.X/Origin.Y texture pixel.

If the target position was just a Vector2, I'd understand (and fully support) this behavior, but with a destination rectangle it just seems odd, especially since the documentation does not seem to mention this fact (although to be honest, the documentation barely says anything at all).

A StackOverflow answer even suggests that a destination rectangle with rotation doesn't make much sense, but XNA offers it anyway.

What is the reason for this behavior?

sentences:
Securing HTTP requests to online game server I'm pretty new at making online games. Right now I'm trying to make an iPhone game. Each player has a profile in my server.

I want to avoid username/password for authentication. Currently, as it stands, when my game is installed it also generates an unique key string and safeguards it in the device. When the player runs the games and needs to perform an action, the action request is sent to the server - along with the key to validate the action.

This is done with an HTTP request, and is working fine.

The thing is, I'm not sure about the security implications behind this. Suppose that a seasoned cracker manages to discover their own key string (if it is stored somewhere in the device I imagine it is always possible to crack), and also identifies the HTTP request schema. They could technically create their own program, use the key string, and send requests to my server and effectively automate several tasks.

For example, let's say that you discover that your key string is 12345, and you also realize that the HTTP requests are like this

http://www.example.com/getcoins.php?key={KEY}

Well, now you're capable of making a nice program automating

http://www.example.com/getcoins.php?key=12345

So then I considered doing something like cookies. As if, the player authenticates using the key string and then the server returns some "session ID" which is stored in the device. The session ID must be used to validate actions. But I'd imagine this would cause the same issue: the cracker just discovers the session ID and off they go.

sentences:
Unable to save player data in a binary file within Update() method I'm trying to save player life within a binary file in Application.persistenceDataPath. I've written a method to store the player life:

  public void SaveLife()
     {
         BinaryFormatter bf = new BinaryFormatter ();
         FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
         PlayerData data = new PlayerData ();
         data.savedLife = life;
         bf.Serialize (file, data);
         file.Close ();
     }

The problem is that when the SaveLife() is called OnApplicationQuit it works. Instead, if I call it within an Update() method of a class, it doesn't work.

The Update() method is called when a certain event is triggered:

void Update()
{
    if (life < 20)
    {
        if (//certain event is triggered)
        {
            SaveLife();
        }

        lifeTimer -= Time.deltaTime;
        if (lifeTimer <= 0)
        {
            ResetLife ();
        }
    }

}

The container class for the data is

[Serializable]
 class PlayerData
 {
     public int savedLife;
 }

What could be the problem?

sentences:
Issue implementing wall jump in Unity I'm having troubles implementing a satisfying wall jump in Unity.
I managed to detect collision with a wall, but when I press the jump button, the result is alway weird or very weak. I think this have to do with the 2D physic in Unity, but I have no idead how to handle it correctly.

Here's my code with the concerned parts:

public void Move(float move, bool crouch, bool jump)
{
    // If the input is moving the player right and the player is facing left...
    if (move > 0 && !facingRight)
        // ... flip the player.
        Flip();
    // Otherwise if the input is moving the player left and the player is facing right...
    else if (move < 0 && facingRight)
        // ... flip the player.
        Flip();

    if (jump)
    {
        if (!grounded && walled)
        {
            StartCoroutine(WallJumpRoutine());
        }
    }
}

void Flip()
{
    // Switch the way the player is labelled as facing.
    facingRight = !facingRight;

    // Multiply the player's x local scale by -1.
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

IEnumerator WallJumpRoutine()
{
    Vector2 wallJumpVector = new Vector2(jumpForce*10, 20f);

    GetComponent<Rigidbody2D>().AddForce(wallJumpVector, ForceMode2D.Impulse);
    yield return null;
}

To be more precise, the result I'm getting is either my player being moved a tiny bit (despite using the same force as my regular jump, which is working fine) or my player being moved a good distance but at very high speed (this is when I'm using ForceMode2D.Impulse).

Any help?

sentences:
How to make a game from the ground up I've been using unity to make 2d indie type games for a while now. However, i've tried to branch into different genres and unity cant do some of the things that i want it to do(although it is still very good).

I really want to make a game from scratch were i have complete control over what happens, although i wouldn't have the slightest clue were to start.

tldr what resources do you need to build a game from the ground floor. or more or less. what resources/software/libraries did most well made indies such as super meat boy, braid or limbo use.

sentences:
libGDX upload z-axis of sprite to graphics card Background:
I want to obtain each fragments position via vertex interpolation to then calculate the light vector for phong shading (L = [Fragment pos] - [light source pos]).

Problem:

At the moment I am using libGDX's com.badlogic.gdx.graphics.g2d.Sprites to upload my 2d sprites via the batch to the graphics card. However they only transport the x and y information for each vertex ( I think in the shader z is 0). I also want to upload the z axis of the sprite for use with normal map based pixel shading (calculate the vector of the incoming light).

Should I use a com.badlogic.gdx.graphics.Mesh for that or can I extend the Sprite class and somehow put the z axis in the vertices float[] array? If I should do that, how do I do this?

sentences:
Unity using raw mocap data without actually moving the character I play around with animations and unitys raw motion capture data asset pack. My problem is as followed:

I have an idle, walkforward and a runforward animation and play them based on the keyboard input. But i realized when i move my character backwards (using a movement script) but still playing the walkforward animation the character basically moves backward and forward at the same time.

So how can i play the animation but without actually effecting the position of the character?

Thank you

sentences:
Help implementing virtual d-pad Short Version:

I am trying to move a player around on a tilemap, keeping it centered on its tile, while smoothly controlling it with SneakyInput virtual Joystick. My movement is jumpy and hard to control. What's a good way to implement this?

Long Version:

I'm trying to get a tilemap based RPG "layer" working on top of cocos2d-iphone. I'm using SneakyInput as the input right now, but I've run into a bit of a snag.

Initially, I followed Steffen Itterheim's book and Ray Wenderlich's tutorial, and I got jumpy movement working. My player now moves from tile to tile, without any animation whatsoever.

So, I took it a step further. I changed my player.position to a CCMoveTo action. Combined with CCfollow, my player moves pretty smoothly. Here's the problem, though: Between each CCMoveTo, the movement stops, so there's a bit of a jumpiness introduced between movements.

To deal with that, I changed my CCmoveTo into a CCMoveBy, and instead of running it once, I decided to have it CCRepeatForever. My plan was to stop the repeating action whenever the player changed directions or released the d-pad.

However, when the movement stops, the player is not necessarily centered along the tiles, as it should be. To correctly position the player, I use a CCMoveTo and get the closest position that would put the player back into the proper position. This reintroduces an earlier problem of jumpiness between actions.

What is the correct way to implement a smooth joystick while smoothly animating the player and keeping it on the "grid" of tiles?

Edit:

It turns out that this was caused by a "Bug Fix" in the cocos2d engine.

sentences:
How do I correctly project a point behind the camera? I am making a 3D game in which I put an exclamation marker above points of interest.

In order to find out where in the 2D screen should I put my marker, I am manually projecting the 3D point where the marker should be.

It looks like this:

Looks pretty good. When the marker is outside of the screen, I simply clip the coordinates so they fit into the screen. It looks like this:

So far the idea is going pretty well. However, when the points of interest are behind the camera, the resulting X,Y coordinates are inverted (as in positive/negative), and I get the marker to appear on the opposite corner of the screen, like this:

(The projected-then-clamped point is the tip of the marker. Don't mind the rotation of the marker)

It makes sense, since the coordinates behind the frustum are inverted in X and Y. So what I'm doing is to invert the coordinates when they are behind the camera. However, I still don't know what is exactly the condition when the coordinates should be inverted.

This is currently what my projection code looks like (in C# with SharpDX):

    public override PointF ProjectPosition(float viewportWidth, float viewportHeight, float y)
    {
        var projectionMatrix = Matrix.PerspectiveFovRH(GetCalibratedFOV(Camera.FOV, viewportWidth, viewportHeight), viewportWidth / viewportHeight, Camera.Near, Camera.Far);
        var viewMatrix = Matrix.LookAtRH(new Vector3(Camera.PositionX, Camera.PositionY, Camera.PositionZ), new Vector3(Camera.LookAtX, Camera.LookAtY, Camera.LookAtZ), Vector3.UnitY);
        var worldMatrix = Matrix.RotationY(Rotation) * Matrix.Scaling(Scaling) * Matrix.Translation(PositionX, PositionY, PositionZ);
        var worldViewProjectionMatrix = worldMatrix * viewMatrix * projectionMatrix;

        Vector4 targetVector = new Vector4(0, y, 0, 1);
        Vector4 projectedVector = Vector4.Transform(targetVector, worldViewProjectionMatrix);

        float screenX = (((projectedVector.X / projectedVector.W) + 1.0f) / 2.0f) * viewportWidth;
        float screenY = ((1.0f - (projectedVector.Y / projectedVector.W)) / 2.0f) * viewportHeight;
        float screenZ = projectedVector.Z / projectedVector.W;

        // Invert X and Y when behind the camera
        if (projectedVector.Z < 0 ||
            projectedVector.W < 0)
        {
            screenX = -screenX;
            screenY = -screenY;
        }

        return new PointF(screenX, screenY);
    }

As you can see, my current idea is to invert the coordinates when either the Z or W coordinates are negative. It works -most- of the time, but there are still some very specific camera locations where it doesn't work. In particular this point shows one coordinate working and the other one not (the correct location should be the bottom right):

I have tried inverting when:

Z is negative (this is what makes most sense to me)
W is negative (I don't understand the meaning of a negative W value)
Either Z or W is negative (what's currently working most of the time)
Z and W are of different sign, a.k.a.: Z / W < 0 (makes sense to me. doesn't work though)

But have still not found a consistent way with which all my points are correctly projected.

Any ideas?

sentences:
Fix Unity Line Renderer for pointer drawing a jaggy line I think I'm using the standard Oculus setup from the SDK using the OVRCameraRig. I've also got a LaserPointer.

But inside VR on my Rift the line looks like this.

Any idea what I'm doing wrong? It used to be straight. Now it's not. I don't know what I changed.

sentences: Is there any quick and easy way to make all bodies visible with Farseer physics engine for XNA? I just want to be able to see all my bodies on the screen for debugging purposes and i cant think of an easy way, for example i have make some edge fixtures with curved arcs attached and i just want to see what they look like!

sentences:
Predicted trajectory becomes less accurate in a side-on collision In my 2D billiards game, I have it so that when the user clicks and drags with their mouse, a Physics2D.CircleCast is projected from the cueball to wherever the mouse is. If the circle happens to hit the red ball, a line is rendered from the red ball's position to the direction of the normal of the collision. So it's supposed to predict where the red ball will go when it gets hit by the cueball.

If you look at the first gif below, you'll see that it works if the red ball gets hit at its center (or close to it). The red ball ends up moving more or less along the predicted line.

However, if you look at this second gif, you'll see that if the red ball gets hit closer to its edge, the predicted line is much less accurate.

Why is this and how can I fix it?

This is the prediction code I use:

 if (Input.GetMouseButton(0) && cueBall)
 {
        Vector2 mousePos = cam.ScreenToWorldPoint(Input.mousePosition);
        var direction = (mousePos - (Vector2)cueBall.position).normalized;
        var hit = Physics2D.CircleCast(cueBall.position, _radius, direction, Mathf.Infinity);

        if (hit)
        {
            _lineMain.Draw(cueBall.position, hit.point);
            _ghostBall.SetPosition(hit.point - (direction * _radius));
            _lineTarget.Draw(hit.point, hit.point - hit.normal); //This is the predicted trajectory.
        }
 }

sentences:
Collision detection in games in 3D - edge to edge cross product I am having trouble understanding why, in a game collision detection, separating axis determination requires checking for the cross product of edges of the two polytopes as additional potential separating axes. In 2D the process is much more intuitive, in that it only checks the edges normals as potential separating axes.

I have been thinking about this very hard but I cannot visualize this at all, nor can I find a good motivating example or explanation.

sentences:
Cross-Sections of 3D Rendered Objects I am currently trying to look into techniques that allow the calculation of arbitrary cross-sections of a 3D object or rendered volume. However, I have been unable to find much on the topic. I know of some software packages, such as the SolidWorks CAD package, that employ such techniques; as seen here:

Does anyone know of any available methods, techniques, algorithms, or tutorials that aim to achieve this result? Also, in terms of the theory of this technique and the concept of calculating it on the fly; how performant is such a technique likely to be?

sentences: missing editor version 5.5.1f1 on this machine. Select another version from the list unity missing editor version 5.5.1f1 on this machine. Select another version from the list unity am new to unity please help someone thanks

sentences:
My SDL Game executable cannot run outside codeblocks After compiling and running SDL programs successfully inside CodeBlocks, when I run them outside CodeBlocks (by clicking .exe file) my program does not run. Instead, it says that libstdc++6.dll is missing from computer.

I have all the SDL dlls, but why is this error happening?

sentences:
Ideas for 2D Water Simulation I am looking for any input on simulating water in 2D, against a rather large (call it) blocked/not blocked array (viewed from the side). I have come up with the following ideas:

Cell Automata

Do a massively parralel simulation on the CPU, using cell automata. With rules as simple as:

If there is a cell open to the bottom move to it.
Check the left and right cells, choose a random one out of the two and move to it.

Pros

Simple to implement.
Meaningful/deterministic in a multiplayer system.

Cons

Probably really slow.
Not convincing.

Fluid Dynamics on the GPU

Perform a rough approximation of fluid dynamics on the GPU against a texture like the following:

+------+-----+-----+-------+
|R     |G    |B    |A      |
+------+-----+-----+-------+
|vX    |vY   |NULL |Density|
+------+-----+-----+-------+

Pros

Probably really fast.
Could be quite convincing.
A further pixel shader could render it directly.

Cons

Difficult to implement.
Difficult to tweak.
I can't allocate a single texture the size of my level.

I could overlap the grid areas, but this would add further complexity.

Particles

Use particles to simulate the water. During rendering using additive blending and then apply a multiplication function to the alpha channel to give the water crisp edges.

Pros

Will probably look nice.
Easy to implement.
Easy to render.
Meaningful in a multiplayer system, although would require quite a bit of bandwidth to transfer.

Cons

Inter-particle effects will probably be slow (neighborhood lookup).
Could lead to water 'leaking' through solid spaces (because the solid space is small, e.g. 1px).
Could lead to strange holes in the water depending on the particle size.
Both of the above could be mitigated by allowing particles to drift closer together than their real size, however would cause problems with the inter-particle and particle/landscape performance.

Any further ideas?

Note: This is an approximation, I am not looking for physically correct water here - just something that 'is good enough' (bonus points for quick and dirty). The game is multiplayer, so unfortunately the whole level needs to be simulated continuously.

sentences:
What does "kTriangles/s" mean in hardware graphics benchmark reports? I've looked around and found several sites offering benchmarking statistics for mobile platforms and I've been seeing the unit of measure as "kTriangles/s". Originally I misread this, missing the 'k'; does this translate to "thousand(s) of triangles/s", e.g.:

8902 kTriangles/s = 8,902,000 triangles/s

(I'm pretty sure that my interpretation is correct, but I hope someone can confirm this for me)

sentences:
Can I generate character with several layers? Newbie question: I wonder if it is possible in terms of performance to generate characters in several layers in phaser (and in general). And overall if it is a good idea/practice in terms of pro/cons.

For instance, one character would be the sum of the following layers (from top to bottom)

Hairs
Face
Head
hands and forearms
clothes and shoes
arms, legs, neck and feet

I suppose that I will have to realize most of the animations for every layers and it will not be possible to change the layer orders during an animation, but by combining all these layers, I could generate more combinations, hence more characters.

sentences:
How do I make instances of enemies spawn after every three keypress movements? I am making a game, where two zombies will spawn after every three moves my character makes. The problem is that I have no idea how to do this.

I have my character moving correctly, in each key press event, so I want the game to count each time one of these events are triggered, and perform the action after every third trigger. Perhaps I need a global variable/counter that can count these events?

How do I make instances of enemies spawn after every three keypress movements?

sentences:
OpenGL - Debug version runs faster than Release version My Visual Studio 2019, 64-bit version of Tetris using OpenGL runs significantly faster, 3X, in Debug mode than in Release mode.
The image above shows the board.  Each cycle of the rendering or game loop redraws everything, viz., the light blue background, the grid, the individual game pieces (one shown) with the latest one added moving every 300 ms, and the text score display.  I have moved all the repetitive code out of the loop, e.g., that which sets the location in shaders for uniform constants.
The Release mode loop cycle time ranges from 0.05 to 1390.0 ms while that of the Debug mode ranges from 0.05 to 350.0 ms.
Any thoughts on what I might investigate?
Thanks.

sentences:
Problems with gravity and box colliders in Unity 3D I have a game character that can jump or roll in order to avoid obstacles. He is able to roll while on the ground and he can also roll while he is in the air after jumping. Everything was working fine when I made him roll. I want to make it so that when he rolls while he's in the air after jumping, he would fall at a faster pace than if he was just falling normally. So I did this in my c# script:
IEnumerator IncGravAcc()
{
    Physics.gravity = new Vector3(0, -50f, 0);
    yield return new WaitForSeconds(2f);
    Physics.gravity = new Vector3(0, -9.8f, 0);
}

I call this coroutine in the function that runs when the down arrow is clicked. Everything is working fine. When he rolls while in the air, he falls at a faster than normal rate. However he doesn't land properly and he just falls right through the platform like it's not even there. Here's a video to show what I mean:
https://youtu.be/sirc4L3MnqM
I have a box collider, not set to isTrigger, on the player (you can see it, the green box, right underneath him in the video) and the player's also a rigidbody. The platforms don't have rigidbodies on them but they do have box colliders set to trigger. You can see the platform's box collider in the relation to player's box collider in the picture provided (the platform's box collider is the larger one of course)
How do I get it so that the character doesn't fall through? Please let me know if there's anything else you need to know about the project. Thank you for helping me!

sentences:
In Unity3D, how do I move the camera with the mouse without spinning it on its axis when looking down/up? I'm currently trying to recreate how Space Engineers work with their first-person acmera in Unity 3D. I'm currently stuck on how to make sure the camera doesn't spin around its axis when looking downwards or upwards, like a sphere. I've looked through several available online snippets for assistance however they all use quaternion to rotate their camera around an axis; this isn't what I want.

Any advice or examples? I'm new to Unity3D by the way so I'd appreciate a basic overview of how it works before the "scientific" language.

This is what currently happens when I look up or down and move left/right:

What I want to happen wherever I look up/down or not at all:

My current code:

using UnityEngine;
using System.Collections;

[AddComponentMenu("Camera-Control/Mouse Look")]
public class MouseLook : MonoBehaviour
{

    public float rotationspeed = 6f;

    private float x, y = 0;

    void Update()
    {
        x += Input.GetAxis("Mouse X") * rotationspeed;
        y += -Input.GetAxis("Mouse Y") * rotationspeed;

        transform.eulerAngles = new Vector3(y, x);
    }

}

Inspector:

sentences:
What online games would let me practice AI development? I am working on a project experimenting with Artificial Intelligence design methodologies for online world avatars. Online world here is quite open to interpretation; Second Life is just as applicable as Counter Strike, for example. To carry out these experiments, I must first develop an intelligent agent for the world in question. However, I am honestly quite stuck as to which game I could use for this.

My preference was to develop an intelligent "bot" to play an MMORPG, but the legal restrictions of such games prevent me. Likewise with most FPS games the use of an intelligent agent in place of a human player is considered cheating.

The alternative, of course, is to create an NPC bot; an intelligent agent that populates the world alongside the player(s) rather than replacing a particular player. However, I'm struggling to find a game that would enable me to create an intelligent opponent either.

I suppose the main requirements would be a game allows a third party program to use the function calls usually utilised by players and read feedback on the state of the world.

Quake III and Unreal Tournament have been suggested before, but they have already been the subject of work on this research project.

Short of writing my own online game from scratch, what games would allow me, through middleware, an API, or otherwise, to create either an artificially intelligent player or a bot?

sentences:
How to wait until other script is ready? I have two scripts, first is AsteroidSpawner script that literally spawns object named Asteroid, and second is HUD that control all UI related stuffs.

There are some labels in UI, so I used onready to get those nodes:

extends CanvasLayer

class_name HUD

onready var asteroids_label = $Control/RightContainer/AsteroidCountLabel

func set_asteroids_label(value: float):
    asteroids_label.text = "Asteroids: " + str(value)
    pass

However, when I try to access HUD script, with setasteroidlabel, it gives me null error:

var spawned_asteroids: Array = []
onready var hud: HUD = get_tree().get_root().find_node("HUD", true, false)

func _ready():
    spawn_asteroids()

func spawn_asteroids():
    ... spawn asteroid ...

    spawned_asteroids.push_back(asteroid_instance)

    hud.set_asteroids_label(spawned_asteroids.size()) # UPDATE HUD

  Invalid set index 'text' (on base: 'Nil') with value of type 'String'

I guess that HUD is not ready, but AsteroidSpawner script try to accessing it, wasn't it? Then how should I wait until HUD is loaded?

sentences:
How can I create JSON sprite sheet data from a regular sprite sheet? I want to use some art from OpenGameArt for my game. The piece I want to use is a sprite sheet containing a bunch of sprite tiles compiled into a single PNG:

I want to create a JSON file with the names and coordinates for each tile. Doing this manually would probably take took long.

I've tried TexturePacker but it seems that it only accepts separate image files which it compiles into a single image. It doesn't have an option to load precompiled sprite sheets; then select and name each tile inside of it.

How could I accomplish this?

sentences:
What is morph target animation? I've been using Adobe Flash and its keyframe-based animation for some years.
I recently about heard morph-targets animation from Wikipedia.

It seems that the morph target animation is also keyframe-based.
What are the differences between Flash's animation and morph target animation?

sentences:
Game Development at iOS, Android and PC with OpenGL ES I'm beginning iOS apps development, and my aim is to make games to launch on App Store.
But I want to know if it's possible to program a game on Xcode with OpenGL ES (C++ game logic), integrate it on iOS with ObjC, and with that same game code (OpenGL ES + C++), implement it for Android with Java and to PC.

I have great interest to publish the same game on App Store, Google Play and specially Steam, and intent to build my personal 2D engine/API when I have more experience on graphic programming.

Do you know where can I find material to learn this?

sentences:
Character controller going down slopes When I go down slopes with character controller, if the speed is too high, the character just flies off the slope and lands at the bottom. I want my character to "stick" to the slope rather then just jump of it. I came up with code to do so, but it didn't turn out as I planned. Now the character just slides on the slope when I stop pressing the arrows (not staying at its place on the slope).

Physics.Raycast (transform.position, Vector3.down, out hit);
transform.position = transform.position
                     + new Vector3(0f, distance - hit.distance, 0f);

Thanks for the help, i couldn't figure this out all day.

sentences:
Creating an asset library accessible from all classes The idea of what I'm trying to do is to create a class that will automatically pull in all of the assets needed using the ConstructorHelpers and store them in a library with IDs. Then from there, any class that includes the asset library should be able to access the library and the objects within.

So far I have created an empty C++ class and added all of the backend needed, and I've used the GameModeBase to instatiate the class as a static variable, however I can't include the asset library elsewhere and use it.

I have thought about creating an actor class and just plopping it into the world, but I really don't like the idea of that and would prefer something more robust.

I've tried searching for a way to do it online, but I can't seem to find it, does anyone know of a solution?

Below is the code I am using to create a singleton class and it will not compile, giving me an LNK2001 error

unresolved external symbol "private: static class AssetLibrary* AssetLibrary::Instance"

.h

static class UE4Testing_API AssetLibrary {
public:
    static AssetLibrary* GetInstance();

private:
    static AssetLibrary* Instance;

    AssetLibrary();
    ~AssetLibrary();
};

.cpp

AssetLibrary* AssetLibrary::GetInstance() {
    if(!Instance) {
        Instance = new AssetLibrary();
    }

    return AssetLibrary::Instance;
}

AssetLibrary::AssetLibrary() {

}

AssetLibrary::~AssetLibrary() {
    delete Instance;
}

Regards,

sentences:
How to make multiple AI surround a player I am working on a top-down RPG game and I have come across a problem. I am working on an AI system to allow the enemy AI to surround the player. I've been trying to keep my implementation really simple, however, I've been running into problems.

Here is what it currently looks like:

X represents the player and Y represents the friendly AI. There are 42 waypoints in total that the enemy can potentially occupy.

However, if any of the waypoints of the player object encounters an obstacle, or if another friendly AI is too close, it will disable those waypoints:

This poses a big problem because I do not have all 42 waypoints. From the looks of it, I might need something more dynamic in my case.

Are there any alternative ways to allow a large number of AI to surround the player or its allies?

sentences:
Revisitability of Game Elements In some games, when you miss a pickup, you can never get it again unless you restart the game, and those pickups count in your collection. (therefore, you must restart the game to finish the collection, if you made any mistakes).

In Pokémon, you have only one Master Ball, limited supply of Ethers and legendary Pokémon appear once per game. Trading fixes all of those problems.

For a more radical perfectionist, they demanded all dialogs, background music, and even items to be revisitable. Some games, like Naruto Ninja Council, satisfied all of those needs.

Is it always a good practice to make things revisitable? Even cutscenes and music? When is it not a good practice to do so?

sentences:
Gravity independent of game updates per second Edit

Just for clarification, my sprite's 'movement' isn't the problem. If I set my Time variable to 4 seconds, then it will cross the screen in exactly 4 seconds regardless of logic updates rate per second, rendering rate per second or screen resolution.  So I am pretty sure I'm scaling the sprite's movement correctly.  What I'm pretty sure I'm not doing correctly, is scaling acceleration.

Original Question

I'm trying to implement gravity in my 2d platformer and am having a few problems understanding how to keep it consistent when I change my updates per second.

Here's what I have.

My Gameloop overview

Currently, my gameloop renders at the maximum rate allowed by device and the updates are 'clamped' to an upper limit (At the moment, 60 per second). I am working on the assumption that most of the time, my game will have no problem hitting this, even if the actual rendering dips. Thus I am doing all of my calculations based Delta Time derived from this fixed 'ticksPerSecond' value.

I don't know for sure that this will remain at 60, I may decide at some point during the development to lower this upper limit.

My Gravity - variable declaration and initial values

At the moment, I have:

float spriteYTime=7f;                //This is the (initial) amount in seconds that this sprite will take to move from the top of the screen to the bottom.
float fallAccel=.5;                  //This is the value that will subtracted from he sprite's fall speed (To make it fall ever faster)
float terminalVelocity=1.5f;         //Cap speed at this rate (1.5 seconds)

my sprite's position is worked out on dt as follows:

//Delta time
float ticksPerSecond = 60;
float dt = 1f/ticksPerSecond;
//Velocity
spriteYVel = 1/spriteYTime;
//Update position
spriteYReal = spriteYReal + (spriteYVel * dt);
//Convert to screen coordinates (will be drawn at this Y coordinate)
spriteyScreen=(int) (furmanYReal*height);

My Gravity - code

    //If my sprite's state is 'f' (meaning falling) then apply gravity
    if(sprite.getState('f')==true){
    //Calculate new position
    spriteYReal = spriteYReal + (spriteYVel * dt);
    //Convert to screen coordinates
    sprite.yScreen=(int) (spriteYReal*r.height);
    //Reduce time by fallAccel amount & update velocity value based on new time value (So sprite falls slightly faster this frame compared to the last
    spriteYTime-=fallAccel;
    spriteYVel = 1/spriteYTime;
    //Check that speed isn't faster than terminal velocity
         if (spriteYTime<spriteVelocity)
            spriteYTime=spriteVelocity;
    }

The problem

Now, this does work, but if I change my ticksPerSecond value, it goes wrong (it falls at different rates).

I know that 'Earth Normal' gravity is approximately 9.8 meters per second per second, but this is measured 'per second' whereas I (think) I need to work with 'per frame'. This is where I'm getting confused.

So, take this example:

If set my initial Time value to 4 seconds, then if it remained constant at this speed, it would take 4 seconds to reach the bottom, if I changed my ticksPerSecond, because the time value is worked out using delta, it would still take 4 seconds but if I apply 'fallAccel" to the Time value (i.e. subract it), it goes wrong when I change the ticksPerSecond value - why?

How can I get this to fall at the same rate regardless of the value of 'ticksPerSecond' - any help in understanding this would be appreciated.

sentences:
How do I get Input Positive Button value in Runtime? In Unity in InputManager I assigned R Button to "Restart" name.

Now that property (Restart) has another property with a key "Positive Button" and string value "R".

In the game I can show notice to user: "click R for Restart!"

But what if user will change that key in the start config window? For example   from R to T button.

Now the game should display notice: "click T for Restart!"

Question: How do I get changed Positive Button value by name "Restart" via script in Runtime? Is it possible?

p.s. in Editor I can do this:

SerializedObject inputManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]);
SerializedProperty axisArray = inputManager.FindProperty("m_Axes");

for (int i = 0; i < axisArray.arraySize; ++i) {
    var axis = axisArray.GetArrayElementAtIndex(i);
    var axisName = axis.FindPropertyRelative("m_Name").stringValue;
    if (axisName == "Restart") {
        restartButtonValue = axis.FindPropertyRelative("positiveButton").stringValue;
        break;
    }
}

But it allows to use it only in the Editor. Because it uses UnityEditor.dll

sentences: How to access Maya Bonus Tools 2012 in Maya 2014 I have been trying to use the paint geometry tool for Maya 2014 but it isnt showing up. I downloaded Bonus Tools 2012 and installed it. Where can I find this tool in Maya 2014?

sentences:
Ray tracing - BRDF using Cornell measured spectral data I wrote a ray tracer that implements various BRDF models (Oren Nayar, Lamber, Torrance Sparrow and so on).
Now I'm trying to implement a BRDF from measured data.
I choose the Cornell database data available here:

http://www.graphics.cornell.edu/online/measurements/reflectance/spraypaints/index.html

I want to use them because there's a representation of the data as spectrum with 31 sample (my ray tracer use spectral data for light calculation and then convert them to CIE XYZ and then RGB values for the final image rendering).

Which is the correct way to use this data?
Which sample technique must be used?

sentences:
Separating Axis Theorem Duplicate Axis I am building a physics game engine from the ground up and currently stumped with my SAT implementation. The situation I am having is in regard to Edge cases, if I remove all parallel / duplicate Axis from the possible 15, I run the risk of removing an edge case as seen in the attached photo.

Hoping you guys can give me some pointers, Thanks!
edit: I should state that the way I have my SAT implemented is I have 0-5 cases being the Face contact and 6 - 14 being Edge cases. When I dont remove parallel cases, situations such as the picture below get treated as an edge case

edit: Probably shouldve added this in the beginning but here is the code where I am establishing my Axes to test.
The GetAxisFromEdge function simply takes two vectors and crosses them
The RemoveParralels function loops through the established axis and removes them if there exists a duplicate.
The FixAxes function is something of a patch to fix a greater problem where I needed the axis to face in the direction of one object for uniformity.
std::vector<glm::vec3> AxesToTest;

        glm::vec3 Obj1Edge1, Obj1Edge2, Obj1Edge3, Obj2Edge1, Obj2Edge2, Obj2Edge3;

        Obj1Edge1 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[0]);
        Obj1Edge2 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[2]);
        Obj1Edge3 = glm::normalize(this->Objects[x]->TransformedPhysMesh[1] - this->Objects[x]->TransformedPhysMesh[5]);

        Obj2Edge1 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[0]);
        Obj2Edge2 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[2]);
        Obj2Edge3 = glm::normalize(this->Objects[y]->TransformedPhysMesh[1] - this->Objects[y]->TransformedPhysMesh[5]);

        AxesToTest.push_back(this->Objects[x]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[x]->TransformedNormals[2]);

        AxesToTest.push_back(this->Objects[y]->TransformedNormals[0]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[1]);
        AxesToTest.push_back(this->Objects[y]->TransformedNormals[2]);

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge1, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge2, Obj2Edge3)));

        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge1)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge2)));
        AxesToTest.push_back(glm::normalize(GetAxisFromEdges(Obj1Edge3, Obj2Edge3)));

        glm::vec3 toCenter = this->Objects[x]->Position - this->Objects[y]->Position;

        RemoveParallels(AxesToTest);
        //FixAxes(AxesToTest, toCenter);

sentences:
Screen-space shadows? Is there such a thing as screen-space shadows? I know that most shadow projection comes from rendering the world from the viewpoint of the light source, projecting the shadows onto a large square texture laying on the ground, and then rendering the scene again using data from that texture to shade things.

But what if that texture wasn't square? Ultimately, the scene is going to be projected into the screen, and using the viewport you can calculate the trapezoid-shaped block of the world that you know is going to be visible.

What if you then did all of your light projection onto that shape instead? Is there a way to make the math work? Seems to me that the end result would allow everything on the screen to always be shadowed (rather than shadows disappearing when too far from the camera), and would automatically give more shadow detail closer to the camera.

Seems like someone would have already tried this, so what am I missing?

sentences: For 2D tiled maps is all object and NPC data loaded into memory when the map is loaded? I'm creating a text RPG in Java, but I think this applies for a GUI as well with regard to the data structure. Each Level is a tiled map. Each Tile object has an (X,Y) coordinate, and references to adjacent tiles, but my question is with regard to storing object and NPC data on that Tile object. Depending on the size of the map I'm loading, this seems like a lot to load, but if that is the commonly accepted practice then I'll go with it.

sentences:
How do I implement flat shading in GLSL? I'm working with GLSL and trying to implement flat shading on a 3D model (rather than smooth shading). To illustrate what I mean, here are two screenshots of cubes in Blender. Here's one with flat shading.

And here's the same cube with smooth shading.

I understand the theory behind this kind of shading. Each face on the cube (six total) has a normal facing away from the surface. Each vertex (eight total) has a normal computed by summing together face normals, then normalizing to unit length. This results in each vertex normal pointing directly away from the center of the cube.

Smooth shading can be implemented in basically two ways. In the first, color is computed per-vertex (using light direction and normal), then fragment color is interpolated among all vertices. In the second, normals themselves are interpolated, then color is computed per-fragment (using the same lighting calculations).

Here are my current GLSL shaders to implement the first option (there's no specular lighting yet, but it gets the idea across with ambient and diffuse). Vertex shader first.

in vec3 vPosition;
in vec3 vNormal;

out vec4 fColor;

uniform mat4 mvp;
uniform vec3 aColor;
uniform vec3 lDirection;
uniform vec3 lColor;

void main()
{
    gl_Position = mvp * vec4(vPosition, 1);

    vec4 ambient = vec4(aColor, 1);
    vec4 diffuse = vec4(max(dot(lDirection, -vNormal), 0) * lColor, 1);

    fColor = ambient + diffuse;
}

Then fragment.

in vec4 fColor;

void main()
{
    gl_FragColor = fColor;
}

So that works fine for smoothed shading, with fragment values interpolated among vertices. I'll also point out that I'm using buffers and index arrays for rendering.

For flat shading, each fragment on a face should instead use the same normal (such that every pixel on the surface has the same final color after lighting calculations). The problem is that I can't pass data to shaders per-face, but only per-vertex. Given this, I can think of three solutions.

Pass four vertices per face, with each vertex storing the face normal. This would still technically be smooth shading, but done in such a way that every interpolated pixel will use the same color (making if effectively flat). This approach seems wrong because it would basically ruin my vertex buffer, since I'd have to pass 24 vertices (four per face) despite the cube only containing eight unique vertices.
Use GLSL's flat mode (there's a flat keyword in GLSL). Using this approach, each fragment would only pull from a single "provoking vertex" rather than interpolating from all vertices on the face. This feels wrong because that I wouldn't actually be using the correct face normal. I also haven't been able to figure out the proper syntax for this style anyway. For the record, I'm aware of glShadeModel, but it's apparently deprecated.
Average vertex normals per fragment rather than interpolating them. To me, this feels like exactly the correct solution, since every pixel on a face would use the same normal, with that normal computed by summing and normalizing vertex normals (similar to how vertex normals are computed from face normals to begin with).

From those options, #3 clearly feels like the correct solution, but I haven't had any luck in figuring out how. So that's my question.

How can I tell the fragment shader to use a normal averaged among all vertices, rather than interpolated?

sentences:
How should I start playing with 3D? One of my hobbies (aside programming, of course) is 3d modeling (completely amateur, using 3ds MAX) and I'd like to mix programming with 3d modeling (what a marriage!). So I've read a little about it and figured I'd have to have good notions on geometry, math, point spacial position (which I do, from my 3d modeling experience), but I don't know how to use API's for it, so I've 'simulated' simple 3d with some simple programs I've made (first a spinning cube, then a more complex Labyrinth (or maze, if you will)).

NOTE: I have no intentions on harming anyone's computers. If you don't trust it, use a VM or something.
Once you run it, I'd appreciate if you commented here stating that the EXE's are safe. Thank you.

Here are some questions:
1) What would be a nice 3d development tool for a .NET programmer like me?
2) Is there a way of using 3d models made in 3DS Max ? (I intend on modeling characters)
3) What knowledge should I have in order to render it, and move it around ?
4) Which API should I use ?

The development environment would be nice if it:

Had the possibility to import existing 3D models exported by 3DS MAX (not a must, but a plus)
Had the ability to create 3d models programmatically (a must)
Possibly has a tool for materials and textures (that would be a huge plus)
Is Well known (high availability of tutorials, questions in S.O., forums..)

And it would be really nice if I could use C# all the way :)

EDIT
For the ones that asked if I want to do something more UI-guided, just to mess around with some models, and not learn about how to create a game-engine, I say no, that's not the case.

If you download my Labyrinth little game, you'll notice that I've basically MADE a simple renderer from scratch using DrawPolygon on bitmaps created via code. So that's a clue that what I want is to learn, and that I somehow like the idea of mixing images and codes together, along with some user interaction.

Imagine that I have a model, say the weighted companion cube, and I want to make a full-screen, or windowed lil' program that spins it (much like the crappy spinning cube I've made a while before the other one), setting the position, the position and angle of the camera, velocity, a simple ambient (say a simple monocolor box (which would be a room) drawn maybe through code (not an imported model)) and editing it with simple user interaction (say pressing left or right on the keyboard changes direction, or pressing '+' would make it faster), all that without using a wizard or something, but coding.

Now for those that didn't quite get my intentions in here, I hope this example makes it clearer of how powerful and customizable I hope it should be. If there are any more questions, let me know!

EDIT
I'm going to start with UNITY, and I've noticed there's a pro version, is the free version enough to do what I want ? (not counting on the 1 month free pro account)
As for XNA, does the same scenario apply as well ?
Please leave a comment!

sentences:
Duplicating Images in SFML I was wondering how one would go about duplicating the same sprite in SFML, instead of having to create new sprites every time I would want have another sprite of the same image. Just some basic thought process or pseudo-code is what I'm looking for.

Thanks.

sentences:
Cannot pick up an object in Unity game I have a PickupTarget object in front of my FirstPersonCharacter which is used for 'holding' picked up object. Somehow, it doesn't work; when I click on the object (Axe) it just stays on the ground.

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

public class PickUp : MonoBehaviour {

    public Transform target;

    void Update () {

    }

    void onMouseDown() {
        this.transform.position = target.position;
        this.transform.parent = GameObject.Find ("FirstPersonCharacter").transform;
    }

    void onMouseUp() {
        this.transform.parent = null;
    }
}

I have added PickupTarget as a target of script in Axe object:

This is the structure of my Axe object.

sentences:
Write to one channel of R16G16 texture on Xbox I was going to draw my shadow map into one channel of a 16 bit texture and then draw a different shadow map into another channel of the same texture.

I realized that this might not be possible to do efficiently since my targetted hardware (Xbox) does not support blending R16G16 formats. (Although the HDRBlendable might make it possible if I need a blendable format to do this.)

Is it possible to mask one channel of a R16G16 texture on the Xbox? How do I do that?

sentences: How do I take a screenshot and blur it? I want to take a screenshot of the game when it's running, blur it and draw it on the screen. Could you help me with taking a screenshot and blurring it?

sentences:
Unity3D: Sudden lighting change in a scene Sorry if this is a duplicate question, but I have no idea what this would be considered.

Hello, I have recently been creating an FPS game, but while researching some things on the internet, the lighting changes within only one scene. I actually want to keep this change, but I am not sure what changed to make it look like this.

It unusually changed from this:

To this:

I want to keep the new one, but have this same lighting effect on a different scene, however, I am not sure what can cause this change. I have searched high and low for anything that could've changed, but I couldn't find anything. Any help is greatly appreciated. Thanks!

sentences:
Unity3D, How do I press one key and then cant press another key while the one is pressed? I am making a horror game, and I want to press a key to look up while I am idle, that i've done but if I press the W key it stands in idle but floating forward. How can I disable the W key while I press the F key to look up ?
Everything works fine I can press F and the LookUp Animation is being played and if KeyUp on F the Animation goes back to Idle.
My problem is if I am in LookUp Animation when I press F, I can also press W to go forward but its floating not walking. I want to deactivate this function so I can just press F when I am Idle.

Thanks for help.

my Script:

public float speed = 10f;
public Rigidbody rgb;
public Animator anim;
bool walk = false;

// Use this for initialization
void Start ()
{
    rgb.GetComponent<Rigidbody> ();
    anim = GetComponent<Animator> ();
}

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

    float move = Input.GetAxis ("Vertical");
    anim.SetFloat ("Speed", move);

    if (Input.GetKey (KeyCode.W) | walk == true)
    {
        rgb.transform.position -= new Vector3(0, 0, 1) * speed * Time.deltaTime;
        Debug.Log("Walking");
    }
    else
    {
        walk = false;
        Debug.Log("Idle");
    }

    if (Input.GetKey (KeyCode.F))
    {
        anim.SetBool("LookUpIdle", true);
        rgb.transform.position = transform.position;
    }
    else
    {
        anim.SetBool("LookUpIdle", false);
    }

}

}

sentences:
How to manage Areas/Levels in an RPG? I'm working on an RPG and I'm trying to figure out how to manage the different levels/areas in the game. Currently I create a new state (source file) for every area, defining its unique aspects. My concern is that as the game grows the number of class files will become unmanageable with all the towns, houses, shops, dungeons, etc.  that I need to keep track of.

I would also prefer to separate my levels from the source code because non-programmer members of the team will be creating levels, and I would like the engine to be as free from game specific code as possible.

I'm thinking of creating a class that provides all the functions that will be the same between all the levels/areas with a unique member variable that can be used to look up level specifics from data. This way I only need to define level/area once in the code, but can create multiple instances each with its own unique aspects provided by data.

Is this a good way to go about solving the issue? Is there a better way to handle a growing number of levels?

sentences:
What would be a good sport game for a beginner/intermediate game dev to make for practice? I'm interested in making a sport game for practice, but giving it some fun twists sort of like nintendo does, (super strikers charged, mario golf.)  I'm planning on using unity, but since I am by no means an expert I'm trying to figure out a sport that will be reasonably easy to create.  I'm aware that its not going to be easy, but, for instance I'm not going to make a game like madden, which would have a ton of difficult stuff like play calls which involve predetermined paths and intelligence on both sides, in general way to difficult.  What would be a good sport to try a stylized version of?
I'm aware that this is a subjective question, but it isn't a question where any answer is as good as another, so I think it's allowed according to the guideline, but correct me if I'm wrong I guess.

sentences:
unity - What's the color of empty UV? Assume I have a model and I don't map the UV for this model and I just apply a texture for the model. I see that Unity will apply a single color to the model, something like this (I took the img from this topic):

I guess the default pixel color it uses maybe at UV (0, 0) or UV (1, 1), but after I test it, I see that my guess is wrong, the colors doesn't match.

color 1: the color of the model when I apply the texture to a non-UV model

color 2: the color of pixel at UV (0, 0) of the texture (color = myTexture2D.GetPixelBilinear(0.0f, 0.0f);)

I see color 1 is lighter than color 2.

So how get get the color from the texture that matches color 1?

Edit
I have tried another test:

Here is the texture (4 pixels with 4 different colors):

And I got this color when I apply this texture to a non-UV mapping model:

It seems like they use an algorithm to make the non-UV color (like blend some colors of the texture together)

sentences:
Dynamically save an assetbundle during run time I'm wondering if it is possible to dynamically save / amend a current asset bundle during the running of my Unity application.

I've been looking into this for a few hours, but can't find anything about how to do this. I know you can download / stream assets from a server at run time, but I'm interesting in knowing if it's possible to do the same but in the opposite direction.

Has anyone ever attempted this before? Is there any good examples of how this could be done?

sentences:
XNA - Strange Texture Rendering Issue Using XNA BasicEffect I have been reading and working through Riemers 3D XNA tutorials to expand my knowledge of XNA from 2D into 3D. Unfortunately I am having rendering issues that I am unable to solve and I need a point in the right direction.

I am not expecting the Models to look identical to Blender but there is some serious discoloring from the texture files once rendering through XNA. The Character model is using completely incorrect colors (Red where Grey should be) and the Cube is rendering a strange pattern where a flat color should be drawn.

My sampling mode is set to PointClamp.

The Character model that I created has a 32 by 32 pixel texture that has been UV mapped to the model in blender. The model was then exported to .FBX. For the Cube Model a 64 by 64 pixel texture is used.

foreach (ModelMesh mesh in samuraiModel.Meshes)
{
    foreach (BasicEffect effect in mesh.Effects)
    {
        effect.Projection = Projection;
        effect.View = View;
        effect.World = World;
    }
    mesh.Draw();
}

Does this look like it is caused by a mistake I made while UV Mapping or Creating Materials in Blender?
Is this a problem with using the default XNA BasicEffect?
Or something completely different that i have not considered?

Thank You!

sentences:
GameObject that should have a fixed speed keeps accelerating I'm using a coroutine to make a GameObject move from a random point A to a random point B. The GameObject should move along this trajectory at fixed intervals and at a constant speed.

However, each time my coroutine that executes the movement is called, the GameObject is a little bit faster.

private IEnumerator movement () {

        // Initialize position and rotation
        float distanceX = endTransform.position.x - startTransform.position.x;
        float distanceZ = endTransform.position.z - startTransform.position.z;
        float angleAroundY = 90.0f - Mathf.Rad2Deg*(Mathf.Atan2 (distanceZ, distanceX));

        this.gameObject.transform.position = startTransform.position;
        this.gameObject.transform.rotation = startTransform.rotation * Quaternion.Euler (90.0f, angleAroundY, 0.0f);

        // Move from point A to point B
        while (this.gameObject.transform != endTransform.transform) {
            float step = speed * Time.fixedDeltaTime;
            this.gameObject.transform.position = Vector3.MoveTowards (this.gameObject.transform.position, endTransform.transform.position, step);
            yield return null;
        }
        yield return null;
    }

I checked and the step variable is constant.

sentences:
Two reflective surfaces facing each other in openGL How do I render 2 reflective surfaces, Example a mirror, face each other? To render a single surface I would use a cube map by rendering from the object on six directions.

But to render 2 surfaces it is becoming a paradox on which one to render first! Can anyone gimme a spark?

https://learnopengl.com/#!Advanced-OpenGL/Cubemaps

I used this tutorial

sentences:
Constraining an orthographic camera to an isometric world I am using Unity3D, and I am building an isometric world by rotating a plane on the Y axis by 4.205 units.

I am using an orthographic camera. I want to constrain the camera so that the viewport never shows the area outside of the world (in green).

How can I calculate the corner points of my rotated plane in screen coordinates, represented by green?
How do I stop the camera from scrolling to prevent it from showing the area outside the world, represented by gray?

sentences:
How do you make lights affect 2D sprites in a 3D environment using Unity's URP render pipeline? I'm using Unity, URP and have 2d sprites characters in a 3D environment. I want 2D sprites to be affected by lights/shadows like the rest of the environment.

-I know if I use a 2D renderer I can use 2D lights but then I lose the projected shadows from both 3D objects and 2D Sprites.
-If I use the standard render pipeline i can make it work but I don't want to miss on all the tools that URP brings to the table.

In summary, is it possible to use 2D lights or any light that affects 2D sprites in URP ?

Thanks!

sentences:
How do I draw video frames onto the screen permanently using XNA? I have an app that plays back a video and draws the video onto the screen at a moving position. When I run the app, the video moves around the screen as it plays. Here is my Draw method...

    protected override void Draw(GameTime gameTime)
    {
        Texture2D videoTexture = null;

        if (player.State != MediaState.Stopped)
            videoTexture = player.GetTexture();

        if (videoTexture != null)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(
                    videoTexture,
                    new Rectangle(x++, 0, 400, 300),  /* Where X is a class member */
                    Color.White);
            spriteBatch.End();
        }

        base.Draw(gameTime);
    }

The video moves horizontally acros the screen. This is not exactly as I expected since I have no lines of code that clear the screen. My question is why does it not leave a trail behind?

Also, how would I make it leave a trail behind?

sentences:
Share content FROM Facebook, not to it Regarding Unity 2018.x:

The Facebook SDK provides a way to get log-in information from a user's FB account, and allows information or an image from an app to be shared TO Facebook. Is it possible to link / access / reference or in any  other way make use of a specific image on Facebook within my Unity app?

Ideally, I would like to be able to access the image upon target recognition and, even better, store the image for subsequent display within the app. Finally, even more ideally ideally, this would not be the FB profile picture.

All suggestions and links welcome.

sentences:
How can I handle a transition into building interiors? I am trying some stuff on Unreal Engine to make something approching games like Commandos series.
But for now, I'm stuck with something I can't figure how it is done :
How are building interior handled ?

Here's a screenshot to illustrate what I say :

When you enter a building, everything become black, except the building's interior. The interior is isolated, there is no "communication" between the interior and the exterior, and between linked interiors. For exemple if you shoot with a weapon and there is an enemy outside just behind the door, he can't hear you.

Sometimes biggest buildings are divided in many parts, and each floor are a different "section" that are isolated from each other (you have a transition and can't communicate between). Here is an image that explain it well : Commandos 2 interior

Teleport : I first thinked that you were teleported to a different portion of the map, or a different small map, but it is unlikely. If you look at a window, you are at the same time outside (you can see your character outside at the window) and inside (you character is leaning out the window). Teleport would cause many sync issue.

Section toggle : Then, I thinked that the interior is already handled in the exterior map, but completely hidden, and when you enter it, it "deactivate" the exterior by hidding everything outside and displaying interior. Again, this is unlikely since map are full 3D (you can rotate 360°) and exterior are 2D.

How can I create this kind of transition?

I've specified that I am on Unreal, but I'm more searching the theorical way rather than Unreal specifics.

sentences:
Separation of world state and animation in a turn based game How do you handle the separation of animation from the world state within a turn based game? I'm working on a 2D grid based game currently. The below code is simplified to better explain.

When an actor moves, I want to pause the flow of turns while the creature animates and moves to the new position. Otherwise, the screen could lag significantly behind the world state, which would cause weird visual appearance. I also want to have animations that don't block the flow of the game - a particle effect could unfold over multiple turns without affecting gameplay.

What I've done is introduce two types of animations, which I call blocking animations and non-blocking animations. When the player wants to move, the code that gets executed is

class Actor {
    void move(PositionInfo oldPosition, PositionInfo newPosition) {
        if(isValidMove(oldPosition, newPosition) {
             getGame().pushBlockingAnimation(new MoveAnimation(this, oldPosition, newPosition, ....));
             player.setPosition(newPosition);
        }
    }
}

Then the main update loop does:

class Game {
    void update(float dt) {
        updateNonBlockingAnimations(dt); //Effects like particle explosions, damage numbers, etc. Things that don't block the flow of turns.
        if(!mBlockingAnimations.empty()) {
            mBlockingAnimations.get(0).update(dt);
        } else {
             //.. handle the next turn. This is where new animations will be enqueued..//
        }
        cleanUpAnimations(); // remove finished animations
    }
}

...where the animation updates the screen position of the Actor.

One other idea I am implementing is to have a concurrent blocking animation, where multiple blocking animations would be updated simultaneously, but the next turn wouldn't happen until all of them were done.

Does this seem like a sane way to do things? Does anyone have any suggestions, or even references to how other similar games do such a thing.

sentences:
CPU usage, game loop and sleep() I've read about this topic on numerous discussion sites, but I can't seem to find a clear definitive (up-to-date) answer, and hopefully this will me some more insight:

I've read the excellent game loop time article on Fix your timestep!, but it dosn't take any consideration of the CPU usage, so it will run at 100%. My question then, is it BAD to run at 100% CPU in your game loop?

If no, why? for example what about gaming on battery-driven devices like laptops? what about computer temperatures/fans/etc, and other windows applications?
If yes, why dosn't the article mention it, because surely that would impact it significantly? what is the best way to fix this on desktops/PC - is there only the unreliable sleep()? How would it affect the game loop suggested by the article?

sentences:
Help to Code Bowling Like Feature in Unity for Mobile I need Code or Guidelines for Touch Feature. When We Drag ball back and Send it Forward.
I am Making feature like bowling, and I need Player to add force while dragging back and also curve the path of the Ball
Anybody, Please Help

sentences:
How do I flip upside down fonts in FTGL I just use FTGL to use it in my app. I want to use the version FTBufferFont to render font but it renders in the wrong way. The font(texture?buffer?) is flipped in the wrong axis.

I want to use this kind of orthographic settings:

void enable2D(int w, int h)
{
    winWidth = w;
    winHeight = h;

    glViewport(0, 0, w, h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //I don't even want to swap the 3rd and 4th param
    //because I like to retain the top-left as the origin
    glOrtho(0, w, h, 0, 0, +1);
    glMatrixMode(GL_MODELVIEW);
}

I render the font like this:

//No pushing and popping of matrices
//No translation

font.Render("Hello World!", -1, position, spacing, FTGL::RenderMode::RENDER_FRONT);

On the other forums, they said, just scaled it down to -1, but it wont work in mine. Example:

font is above the screen

I can't see relevant problem like in mine in google so I decide to ask this here again.

How can I invert texture's v-coordinate without modifying its source code ? (assume its read only)

sentences:
Did Street Fighter II Employ Machine Learning? As a kid hanging out in my local arcade, me and my friends used to swear up and down that our computerized sf2 opponents would learn our strategies.

I wonder if anyone here might know whether that was the case. It feels as if it couldn't have been as simple as a finite state machine, because the opponent's tactics were definitely different depending on how early in the session you'd encounter them. And as each fight went on, it was as if old tactics would stop working. Brilliant games :)

anyways, I know it's a relatively open ended question. I had so many great memories playing that game, and it would be interesting to know whether the AI was that sophisticated, or otherwise what techniques it may have used so I can potentially use similar techniques in my own game designs.

sentences:
Is there a way to limit the size of the D3DPOOL_MANAGED pool? I have over 2GB of textures that I need to put in D3D9's D3DPOOL_MANAGED pool.

D3D9 charges the system copy of anything in the D3DPOOL_MANAGED to my process space. I'm working on a 32-bit system so I have less than 1.7GB of available process space.

Is there a way to limit the size of the pool D3D9 stores in my process, that is to tell it to keep anything else it needs to cache on disk?

sentences:
Instantiate prefab as a type that inherits from MonoBehaviour I have a CeilingTile class. In this class, I have an InstantiateCeilingLamp() method, which instantiates from a CeilingLamp prefab.

Here is the code:

protected void InstantiateCeilingLamp()
{
    Object ceilingLampPrefab = AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject));

    CeilingLamp ceilingLamp =
        Instantiate(ceilingLampPrefab, this.transform.position, Quaternion.identity)
            as CeilingLamp;

    if (ceilingLamp == null)
    {
        Debug.Log("Failed to instantiate the ceiling lamp.");
        return;
    }

    ceilingLamp.transform.SetParent(this.transform);
}

prefabPath is a const string defined within the class.

Stepping through my code using the debugger, I can see that ceilingLampPrefab is non-null after executing AssetDatabase.LoadAssetAtPath(prefabPath, typeof(GameObject));.

However, Instantiate(...) as CeilingLamp; returns null, because the instantiated prefab cannot be cast to the type CeilingLamp, which inherits from MonoBehaviour.

How should I modify my code in order to instantiate a prefab as a type that inherits from MonoBehaviour?

sentences:
How to make physics of motion on an inclined surface There is the following platform:

And a coin above it:

And the following code using arcade physics:

gravity: { y: 100, x: 10 }, - in config

function preload ()
{
this.load.image('platform', 'assets/platform.png');
this.load.image('star', 'assets/star.png');
}

function create ()
{
platforms = this.physics.add.staticGroup();

platforms.create(400, 568, 'platform');

player = this.physics.add.sprite(100, 450, 'star');

player.setCollideWorldBounds(true);
}

The code is approximate, a coin above the platform, sprites in png format. But the coin falls and does not roll, but moves horizontally, after which it falls again. How to make it "roll"?

UPD: Will it help me? https://github.com/photonstorm/phaser-examples/blob/master/examples/arcade%20physics/circle%20body.js
And how to be with the platform?

sentences:
Collision2d Unity To Change Another Scripts Int Value I am looking to decrease the value stored in my script "progress" which takes 1 away from a value curHealth, when the Player sprite to which this script "collision", is attacked/ touching the Enemy 2d box collider.
The decreasing of the value doesn't happen when the two objects touch. Both the Player and the Enemy have 2dbox colliders and other shape 2d colliders.

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

public class collision : MonoBehaviour {

    public progress Progress = GameObject.FindGameObjectWithTag("HealthBar").GetComponent<progress>();

    void OnCollisionStay2d(Collision2D coll){
        if (coll.gameObject.name == "Enemy") {

            Progress.curHealth -= 1;

            }
        }

}

sentences:
Model gets distorted when rotating the camera I'm currently developing my own 3d graphics engine and I'm having a hard time figuring out why my 3D models gets distorted when rotating the camera around.

This is my projection matrix. I'm following the OpenGL's Model.

def get_projection_mat(aspect_ratio, camera):
    fov = camera.fov
    z_near = camera.z_near
    z_far = camera.z_far
    top = math.tan(fov * 0.5) * z_near
    bottom = -top
    right = top * aspect_ratio
    left = -right
    projection_mat = np.identity(4, dtype=float)
    projection_mat[0, 0] = 2 * z_near / (right - left)
    projection_mat[0, 2] = (right + left) / (right - left)
    projection_mat[1, 1] = 2 * z_near / (top - bottom)
    projection_mat[1, 2] = (top + bottom) / (top - bottom)
    projection_mat[2, 2] = -(z_far + z_near) / (z_far - z_near)
    projection_mat[2, 3] = -2 * z_far * z_near / (z_far - z_near)
    projection_mat[3, 2] = -1
    projection_mat[3, 3] = 0

    return projection_mat

This is my view matrix:

def camera_matrix(self):
    camera_matrix = np.identity(4, dtype=float)
    camera_matrix[:3, 0] = self.left[:]
    camera_matrix[:3, 1] = self.up[:]
    camera_matrix[:3, 2] = self.forward[:]
    camera_matrix[:3, 3] = self.pos[:]

    return camera_matrix

This is how I get the ViewProjection matrix:

    projection_mat = get_projection_mat(self.aspect_ratio, self.camera)
    view_mat = self.camera.camera_matrix()
    view_mat = np.linalg.inv(view_mat)
    self.view_projection_mat = np.dot(projection_mat, view_mat)

And, finally, this is the ViewProjectionModel matrix:

    view_projection_model_mat = np.dot(model.transform_mat.T, self.view_projection_mat)

This is the method that I use to rotate the camera:

def rotate(self, yaw, pitch, degress=True):
    rotation_mat_y = helper.rotate_matrix_y(yaw, degrees)
    rotation_mat_x = helper.rotate_matrix_x(pitch, degrees)
    rotation_mat = np.dot(rotation_mat_y, rotation_mat_x)
    self.forward = np.dot(np.insert(self.forward, 3, 1), rotation_mat)
    self.forward = helper.normalized((self.forward / self.forward[3])[:3])
    self.up = np.dot(np.insert(self.up, 3, 1), rotation_mat)
    self.up = helper.normalized((self.up / self.up[3])[:3])
    self.left = np.dot(np.insert(self.left, 3, 1), rotation_mat)
    self.left = helper.normalized((self.left / self.left[3])[:3])

A video demo, showing the problem

To summarize, the order of multiplication is ProjectionMat X ViewMat x ModelMat x ModelFaces.
If it isn't clear by now, I'm using Python for this project.
Any help would be greatly appreciated.

With best regards,
João Pedro

EDIT: Like this?

    directions, r = np.linalg.qr(np.array([self.forward, self.up, self.left]))
    self.forward = directions[0]
    self.up = directions[1]
    self.left = directions[2]

sentences:
How do teams prevent overwriting work in source files? It occurred to me the possibility that while, for example the game engine, is being worked on simultaneously by multiple people how is overwriting prevented?

Let's say developer one is working on Audio.cpp and developer two is also working on Audio.cpp, how is this generally managed in large teams to combat overwriting? (In other words to stop developer two from opening the file until developer one is finished)

sentences:
How to use This Keyword and using iterators to call class methods? I've been over this for a long time, I can't seem to understand what is wrong, is the use of the this keyword right? I want to add the instance of the class that is being created to the vector 'allEntities' in the constructor, or am I not using the iterators right? I'm very new to c++ and programming in general so all help is appreciated.

GameObject.h

class GameObject {

public:
    GameObject(const char* texturesheet, SDL_Renderer* ren, int x, int y, int _maxHp, int _currentHp, int _strength);
    ~GameObject();

    static std::vector<GameObject> allEntities;

    void update();
    void Render();
    void movement(const char* coord, bool positive);
    int getMaxHp();
    void addMaxHp(int change);
    int getCurrentHp();
    void setCurrentHp(int change);
    int getStrength();
    void changeStrength(int change);
    void attack(GameObject &other);
    int getX() { return x; };
    int getY() { return y; };
    void setDirectionFacing(char direction) { directionFacing = direction; };
    char getDirectionFacing() { return directionFacing; };
private:

    int x;
    int y;
    int strength;
    int maxHp;
    int currentHp;
    char directionFacing;

    SDL_Texture* objectTexture;
    SDL_Rect srcRect, destRect;
    SDL_Renderer* renderer;

};

GameObject.cpp

GameObject::GameObject(const char* texturesheet, SDL_Renderer* ren, int xx, int yy, int _maxHp, int _currentHp, int _strength)
{
    allEntities.push_back(*this);
    renderer = ren;
    objectTexture = textureCreator::loadTexture(texturesheet, ren);
    GameObject::maxHp = _maxHp;
    GameObject::currentHp = _currentHp;
    changeStrength(_strength);
    x = xx;
    y = yy;
}
GameObject::~GameObject()
{

}

void GameObject::update()
{

    srcRect.h = 48;
    srcRect.w = 48;
    srcRect.x = 0;
    srcRect.y = 0;

    destRect.x = x;
    destRect.y = y;
    destRect.w = srcRect.w * 1.5;
    destRect.h = srcRect.h * 1.5;
}

void GameObject::movement(const char* coord, bool positive)
{

    if (coord == "x" && positive == true)
    {
        y -= 4;
        setDirectionFacing('w');
        std::cout << 'w' << std::endl;
    };
    if (coord == "x" && positive == false)
    {
        y += 4;
        setDirectionFacing('s');
        std::cout << 's' << std::endl;
    };
    if (coord == "y" && positive == true)
    {
        x += 4;
        setDirectionFacing('d');
        std::cout << 'd' << std::endl;
    };
    if (coord == "y" && positive == false)
    {
        x -= 4;
        setDirectionFacing('a');
        std::cout << 'a' << std::endl;

    };

}

void GameObject::Render()
{
    SDL_RenderCopy(renderer, objectTexture, &srcRect, &destRect);
}

int GameObject::getCurrentHp() { return currentHp; };

int GameObject::getMaxHp() { return maxHp; };

void GameObject::setCurrentHp(int change) { currentHp += change; };

void GameObject::addMaxHp(int change) { maxHp += change; };

int GameObject::getStrength() { return strength; }

void GameObject::changeStrength(int change) { strength += change; }

void GameObject::attack(GameObject &other)
{

}

game.cpp

GameObject* player;
player = new GameObject("player.png", renderer, 10 , 10, 10,  10, 2);
    for (std::vector<GameObject>::iterator it = GameObject::allEntities.begin(); it != GameObject::allEntities.end(); it++) {
        int hp = it->getCurrentHp();
        std::cout << hp << std::endl;
    }

I expect to print out the hp value which is 10, but instead it prints 0 instead.

Also I need this vector so when the player attacks, it checks every entity and sees if it is in the area of the attack in a for loop, is there any better way to do this?

sentences:
OpenGL Maximal amount of debug string reached I was trying to check my current openGL code in gDEBugger, everything works fine.
But, I get these messages

Debug String: >>>>>>>>> 1
Debug String: >>>>>>>>> 2
Debug String: >>>>>>>>> 3
...
Debug String: >>>>>>>>> 497
Debug String: Maximal amount of debug string reached (500 strings).
              Additional debug strings will be ignored

What are these messages, everything in my code runs fine. But its troubling to see these debug strings.

sentences:
How to kill a fired bullet sprite after certain amount of time in Phaser? The bullet should be killed after it was shot from the player, and after a certain amount of time.

function create() {
    bullets = game.add.group();
    bullets.enableBody = true;
    bullets.physicsBodyType = Phaser.Physics.ARCADE;
    game.physics.enable(bullets, Phaser.Physics.ARCADE);
    timer = game.time.create(false);

    for (var i = 0; i < 100; i++) {
        bullet = bullets.create(0, 0, 'bullet');
        bullet.exists = false;
        bullet.visible = false;
        bullet.checkWorldBounds = true;
        bullet.events.onOutOfBounds.add(resetBullet, this);
    }
}

function update() {
    if (game.input.activePointer.isDown) {
        fire();
    }
}

function fire() {
    if (game.time.now > bulletTime) {
        bullet = bullets.getFirstExists(false);

        if (bullet) {
            bullet.reset(player.x, player.y);
            game.physics.arcade.moveToPointer(bullet, 300);
            bulletTime = game.time.now + 150;
            timer.add(1000, resetBullet, this);
            timer.start();
        }
    }
}

function resetBullet(bullet) {
    bullet.kill();
}

As you can see I already tried adding a timer into the fire function which calls the resetBullet function after one second. But my game crashes one second after fire() was called:

Uncaught TypeError: Cannot read property 'kill' of undefined

Does anyone know how to achieve the kill of the sprite?

sentences: Debug.Assert Behavior in Unity Is this normal behaviour that Unity continues to run after a condition in a Debug.Assert statement was NOT met when I launch the game within the Editor? I can see the assertion in the console output, but still would expect it to stop the game. Development build and Script Debugging are turned on in my player settings.

sentences:
java Game: Rendering issue! Hi I am making a java game in were you can build land. At the moment you can build but not destroy. So I want to be able to destroy. I have an array of the tiles. I think I might need to do something like remove the tile that the mouse is hovering on form he arraylist so how can I do this? I don't think you need my code to explain to me because I only want to know how to remove the Tile that the mouse is hovering over. Please help me.

EDIT** MY array is a arraylist kind of arraylist and I have an arraylist for each block.

sentences:
Sampling from Normal Map and Diffuse Map in Pixel Shader I'm having some issue changing a basic lighting shader to take a normal texture and a diffuse texture for a model and then using the normal texture for lighting.
The code is very simple and i can't see where i have gone wrong at all, am i not allowed to sample two textures with the same sampler?
This is the output i am getting:

Using the two textures:

THe basic shader code is:

Texture2D shaderTexture : register(t0);
Texture2D heightNormalTexture : register(t1);

    float4 PS(VOUT pIn) : SV_Target
{
    float4 diffuseColour = shaderTexture.Sample(SampleType, pIn.texCoord);
    float4 normal = heightNormalTexture.Sample(SampleType, pIn.texCoord);

    float3 litColour = float3(0.0f, 0.0f, 0.0f);

    for(int i = 0; i < 3; i++)
    {
        SurfaceInfo sInfo = {pIn.posW, normal.xyz, diffuseColour, pIn.spec};
        [branch] switch(gLight[i].type)
        {
            case 0: //Parallel
            {
                litColour += ParallelLight(sInfo, gLight[i], gEyePosW);//
                break;
            }
            case 1: //Point
            {
                litColour += PointLight(sInfo, gLight[i], gEyePosW);
                break;
            }
            case 2: //Spotlight
            {
                //litColour += SpotLight(sInfo, gLight[i], gEyePosW);
                break;
            }
        }
    }
    return float4(litColour, diffuseColour.a);
}

The lighting code seems to work just fine when i pass in the normals as part of the vertex buffer, but goes this odd mash-up of diffuse and normal when i try to use the normals from a texture. From what i can tell i am setting the texture right in C++.

    ID3D11ShaderResourceView *pixelShaderTextures[2];
pixelShaderTextures[0] = m_textureManager.GetTextureResourceView(std::string("TestHeightMapNormal"));
pixelShaderTextures[1] = m_textureManager.GetTextureResourceView(std::string("TestTexture"));

context->PSSetShaderResources(0, 2, pixelShaderTextures);

If you guys have any help/advice for me to resolve this, that would be great.

sentences:
btRigidBody world transform and scale issue When I create a collision shape for rigid body (in this case box) I use vertices positions and scale from the opengl matrix, the code looks this way:

glm::vec3 boxDim = getBoxDim(verticesPositions, scale);
collisionShape_.reset(new btBoxShape(btVector3(boxDim.x, boxDim.y, boxDim.z)));

When a simulation step is done I need to update opengl matrix for the object. I calculate a new model matrix this way:

btTransform transform = rigidBody->getWorldTransform();
float openglMatrix[16];
transform.getOpenGLMatrix(openglMatrix);

glm::mat4 newModelMatrix = glm::make_mat4(openglMatrix);
newModelMatrix = glm::scale(newModelMatrix, glTransform.getScale());

My code works but I wonder if there is any possibility to have already scale in the transform returned by getWorldTransform. Then I can ommit this line of the code:

newModelMatrix = glm::scale(newModelMatrix, glTransform.getScale());

sentences:
Dropping through a platform in Clickteam Fusion 2.5 I am using Clickteam Multimedia Fusion 2.5. Currently, I have a rudimentary platformer game, with the following setup:

player object is set as a physics platform, with the physics engine added to make it all work
the floor is a quick backdrop, with the obstacle type of obstacle
the only platform in the game is also a quick backdrop, with the obstacle type of platform

The way the game is setup, the player object can jump through the platform.

WHAT I WOULD LIKE TO DO

Is there a default, built-in way for the player object to be able to drop down through the platform? To be more specific, is there a default key press or a default combination of keys which would allow the player object to drop down through the platform?

I guess I could add it all in via the Event Editor, but I was wondering if there's a built-in way which handles it all.

sentences:
Hide an image once all enemies in a zone are defeated In my game there are several buildings that a main character has to free from enemies. I put a kind of a logo above all those have-to-be-released buildings, indicating that a certain building is not free and it has to be released.

What I want to achieve is that when I kill all of the enemies near a certain building, the logo above that building has to disappear, indicating means that the building was released.

I don't know how to detect this condition of "all nearby enemies defeated" in my script — how can I do that, and hide the image when the condition is met?

sentences:
As an indie game developer, how can I have (quality) music/sound done? Besides the story itself, a game needs code, graphics and music/sound effect. I can program and I knew a few graphics designers in the web app era. However, I don't know whether to find music and sound freelancers/professionals/partners.

So how's music/sound typically done? Do you finish a game and hand it to some musicians? Seek help via Facebook? Call the secondary school music teacher? .. Please advise. Thanks!

EDIT:

I'd like to rephrase the question a bit to clarify the objective. Let's start with example. Say, there is designer which have finish a great UI concept design, and ask: "how can I find programmers to transform this design into an app?"

It won't help him much by telling where github is and how much great codes can be learned from... He needs the judgement of what are good code, in addition to how to use the code, and most importantly, the ability to modify/enhance the code to fit his need.

As a programmer, all I know a game needs some good music. The question is not about where to find music. The question is how to find musician who knows music, the music which fits my game. It's similar to the design is looking for a programmer who can turn Photoshop into .app rather and programming books and code samples.

Simply put, where did you find your game's musician? ;-)

p.s. I found my graphics designer on deviantart.com Where is the deviant music.com? XD

sentences:
Task vs Thread with execution queue My game server will have to respond to requests very often, so I consider threading a good option.

But should I use Task class from .NET or have several threads that would execute requests which I would store in a queue (linked list). Which way would be faster?

sentences:
Detecting End of Animation So I am making a death animation for a game. enemy1 is a UIImageView, and what I'm doing is when an integer is less than or equal to zero, it calls this deathAnimation which only happens once. What I want to do is use a CGPointMake right when the animation is finished being called. Note that before the deathAnimation is called, there is another animation that is constantly being called 30 times a second. I'm not using anything like cocos2d.

if (enemy1health <= 0) {
    [self slime1DeathAnimation];
    //How can i detect the end of this animation
}

This is how the animation is done:

-(void)slime1DeathAnimation{
    enemy1.animationImages = [[NSArray alloc] initWithObjects:
                              [UIImage imageNamed:@"Slime Death 1.png"],
                              [UIImage imageNamed:@"Slime Death 2.png"],
                              [UIImage imageNamed:@"Slime Death 3.png"],
                              [UIImage imageNamed:@"Slime Death 4.png"],
                              [UIImage imageNamed:@"Slime Death 5.png"],
                              nil];
    enemy1.animationDuration = 0.5;
    enemy1.animationRepeatCount = 1;
    [enemy1 startAnimating];
}

If you need more code just ask

sentences:
Predicting Enemy Movement Well I have a simple 2D game where all positions are defined by and X and Y coordinate.

There are objects moving at a constant velocity. And a turret fires a bullet at the X and Y coordinates of the object. By the time the bullet goes to the desired area, the object has already moved.

So i need to adjust the X and Y target positions for the turret to shoot at taking into account the bullet speed and object speed.

Here's an image showing the problem.

sentences: Does a patch of simplex noise sum up to zero? Just for interest, when sampling simplex noise in any given dimension, would the sum of all samples run towards zero?

sentences: Vertex with too many connections in Maya After some mesh editing in Maya I got one vertex with a lot of connections. Please help, how can I fix it? Don't even know how to google it.

sentences:
How do mobile games implement time gates unhackably? Is it possible in offline games? I'm thinking about porting my game to Google Play, and it would be free to play with time gates which are skippable if you watch an ad.

What are the ways of implementing an unhackable time gating?

Is it possible without internet connection? If yes, how?
If no, is there a way to implement it without custom backend, using Google Play's services?

Or should I care about this at all? Because...

It doesn't affect other players...
Most of the audience couldn't do it anyway, and if the game stays small, hacks couldn't really spread.
Then maybe I should just let them hack those time gates, it's a marginal revenue loss.

What do you think?

sentences:
Unsticking game objects I have used
void OnCollisionEnter(Collision collision) {
    collision.gameObject.transform.parent = gameObject.transform;
}

To stick two players together when they connect.
Basically after they have collided the second game object is still stuck to the original object and i need that not to be the case.
How do i make the game object not stuck when they come apart ?

sentences:
How can I draw a small bitmap on a larger bitmap at a particular position? (Canvas / SurfaceView) I'm building a game that requires additive blending of colours for certain bitmaps.
Say I have 4 different types object, there are maybe ten of each type on the screen with each type having a distinct colour.
If these objects overlap I want to perform additive blending on the overlapping portions.
After doing some research on the subject I came across this thread about drawing and additive blending.
It has lots of useful information, but it's not using bitmaps.
Then I found another thread about blending pixels from two bitmaps which is also helpful, but is based on same sized bitmaps.

So my solutions to solve this problem is to create four temporary bitmaps, one for each object type / colour, with each of these bitmaps being the same size as the device screen. I want to draw all objects of each colour onto the relevant bitmap, so all the blue objects on one bitmap, all the orange objects on another and so on.
Then when all for bitmaps are ready I'll perform additive blending on the four bitmaps of the same size as per the link above. then draw the result on the canvas.

My only problem is I'm not sure how to position the smaller bitmaps correctly on the larger one. Can anyone advise me on how I might proceed with this?

sentences:
How important do you find exception safety to be in your C++ code? Every time I consider making my code strongly exception safe, I justify not doing it because it would be so time consuming. Consider this relatively simple snippet:

Level::Entity* entity = new Level::Entity();
entity->id = GetNextId();
entity->AddComponent(new Component::Position(x, y));
entity->AddComponent(new Component::Movement());
entity->AddComponent(new Component::Render());
allEntities.push_back(entity); // std::vector
entityById[entity->id] = entity; // std::map
return entity;

To implement a basic exception guarantee, I could use a scoped pointer on the new calls. This would prevent memory leaks if any of the calls were to throw an exception.

However, let's say I want to implement a strong exception guarantee. At the least, I would need to implement a shared pointer for my containers (I'm not using Boost), a nothrow Entity::Swap for adding the components atomically, and some sort of idiom for atomically adding to both the Vector and Map. Not only would these be time consuming to implement, but they would be expensive since it involves a lot more copying than the exception unsafe solution.

Ultimately, it feels to me like that time spent doing all of that wouldn't be justified just so that the a simple CreateEntity function is strongly exception safe. I probably just want the game to display an error and close at that point anyway.

How far do you take this in your own game projects? Is it generally acceptable to write exception unsafe code for a program that can just crash when there is an exception?

sentences:
How can I attach a model to the bone of another model? I am trying to attach one animated model to one of the bones of another animated model in an XNA game.

I've found a few questions/forum posts/articles online which explain how to attach a weapon model to the bone of another model (which is analogous to what I'm trying to achieve), but they don't seem to work for me.

So as an example: I want to attach Model A to a specific bone in Model B.

Question 1.
As I understand it, I need to calculate the transforms which are applied to the bone on Model B and apply these same transforms to every bone in Model A. Is this right?

Question 2.
This is my code for calculating the Transforms on a specific bone.

private Matrix GetTransformPaths(ModelBone bone)
{
    Matrix result = Matrix.Identity;
    while (bone != null)
    {
        result = result * bone.Transform;
        bone = bone.Parent;
    }
    return result;
}

The maths of Matrices is almost entirely lost on me, but my understanding is that the above will work its way up the bone structure to the root bone and my end result will be the transform of the original bone relative to the model.

Is this right?

Question 3.
Assuming that this is correct I then expect that I should either apply this to each bone in Model A, or in my Draw() method:

private void DrawModel(SceneModel model, GameTime gametime)
{
    foreach (var component in model.Components)
    {
        Matrix[] transforms = new Matrix[component.Model.Bones.Count];
        component.Model.CopyAbsoluteBoneTransformsTo(transforms);

        Matrix parenttransform = Matrix.Identity;
        if (!string.IsNullOrEmpty(component.ParentBone))
            parenttransform = GetTransformPaths(model.GetBone(component.ParentBone));

        component.Player.Update(gametime.ElapsedGameTime, true, Matrix.Identity);

        Matrix[] bones = component.Player.GetSkinTransforms();

        foreach (SkinnedEffect effect in mesh.Effects)
        {
            effect.SetBoneTransforms(bones);

            effect.EnableDefaultLighting();
            effect.World = transforms[mesh.ParentBone.Index]
                * Matrix.CreateRotationY(MathHelper.ToRadians(model.Angle))
                * Matrix.CreateTranslation(model.Position)
                * parenttransform;
            effect.View = getView();
            effect.Projection = getProjection();
            effect.Alpha = model.Opacity;
        }
    }
    mesh.Draw();
}

I feel as though I have tried every conceivable way of incorporating the parenttransform value into the draw method. The above is my most recent attempt.
Is what I'm trying to do correct? And if so, is there a reason it doesn't work?

The above Draw method seems to transpose the models x/z position - but even at these wrong positions, they do not account for the animation of Model B at all.

Note: As will be evident from the code my "model" is comprised of a list of "components". It is these "components" that correspond to a single "Microsoft.Xna.Framework.Graphics.Model"

sentences:
Function call to AndroidJabaObject to an instance of com.prime31.PlayGameServicesPlugin causes the application to stop responding Using Prime31 PlayGameServices attempting to call 'authenticate' causes the game to stop responding very soon after.

There isn't much I can show as there's literally no logs showing up in logcat.

Is there any way I can debug this?

I did notice 'enableDebugPrints' on the AndroidJavaObject was 'false' and I don't know how to set it to true, which might help with prints?

I've tried catching an exception but that hasn't worked.

sentences:
Java BufferStrategy Flickering I was watching a tutorial on using a BufferStrategy in Java and I wanted to test a very simple example. The issue is that it flickers intensely and it seems as if a piece of the starting oval stays on the screen. I know that the loop is a very bad practice but I just wanted to very simply test the BufferStrategy.

import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferStrategy;

public class Game extends JFrame {
    private Canvas canvas = new Canvas();

    public Game() {
        setBounds(0, 0, 1280, 720);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLocationRelativeTo(null);

        add(canvas);

        setVisible(true);

        canvas.createBufferStrategy(3);
        BufferStrategy bufferStrategy = canvas.getBufferStrategy();

        int x = 0;
        int i = 0;

        while(true) {
            i++;

            if(i == 10) {
                i = 0;
                x++;
            }

            bufferStrategy = canvas.getBufferStrategy();
            Graphics g = bufferStrategy.getDrawGraphics();
            super.paint(g);
            g.setColor(Color.RED);
            g.fillOval(x, 200, 50, 100);
            g.dispose();
            bufferStrategy.show();
        }
    }

    public static void main(String[] args) {
        new Game();
    }

}

sentences:
Where does XNA 4.0 takes memory from to perform operations? I found this question which talks around the question I'm interested in. In particular I focused on the line where the guys says that GraphicsDevice object is literally a representation of the underlying graphics card.

Now, can I assume that XNA automatically uses the memory directly from the underlying graphics card (to perform the most expensive calculations like updates and drawing)?

If so, is everything (like thread management) already optimized or there are way to configure the device depending my various cases? If not, do I have to tell the GraphicsDevice object whether to use or not the GPU memory rather than the CPU?

sentences:
libgdx game not disposing My game does not exit entirely even after calling dispose() method. It loads a black screen when I launch it for the second time and works well if I kill the game manually and restart it.

I get an error that says buffer not allocated with newUnsafeByteBuffer or already disposed when I try to dispose off the SpriteBatch object. This is were I suspect the problem to be. But not able to fix it entirely. Please help!

Here is how I have built it (I have put the sample code here just to show you guys that there are no visible loop backs in dispose function, please correct me if I'm wrong)-
In game screen,

public void dispose() {
  AssetLoader.dispose();
  render.dispose();
  Gdx.app.exit(); }

Under class AssetLoader-

public void dispose(){
  Texture.dispose();
  sound.dispose();
}

Under game render class -

public void dispose(){
  spritebatch.dispose(); //throws an error when I GameScreen.dispose is called
  font.dispose();
  shaperender.dispose();
}

I believe that my spritebatch isn't disposing which is causing the black screen but I cannot find a way to dispose it off successfully. Any help would be greatly appreciated.

sentences:
I have my mouse coords converted to world coords. Now how do I detect objects with it? (C++, OpenGL, FreeGlut) I found a way to convert my mouse coordinates to world coordinates that I can easily understand but now I need to know how to use it to check if the mouse is currently over any of my rendered objects.

Here is my mouse click code that converts the mouse coordinates to screen coordinates when the left mouse button is clicked.

code:

void mouseClick( int button, int state, int x, int y ){

//if any mouse button was pressed
if (button == GLUT_LEFT && state == GLUT_DOWN) {

GLint viewport[4]; //hold the viewport info
    GLdouble modelview[16]; //hold the modelview info
    GLdouble projection[16]; //hold the projection matrix info
    GLfloat winX, winY, winZ; //hold screen x,y,z coordinates
    GLdouble worldX, worldY, worldZ; //hold world x,y,z coordinates

    glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); //get the modelview info
    glGetDoublev( GL_PROJECTION_MATRIX, projection ); //get the projection matrix info
    glGetIntegerv( GL_VIEWPORT, viewport ); //get the viewport info

winX = (float)x;
winY = (float)viewport[3] - (float)y;

//get the world coordinates from the screen coordinates
    gluUnProject( winX, winY, 0.0, modelview, projection, viewport, &worldX, &worldY, &worldZ);
    gluUnProject( winX, winY, 1.0, modelview, projection, viewport, &worldX, &worldY, &worldZ);

}
}

I've tested it to make sure that the coordinates are converting successfully, and it works fine!!!

As for the near and far planes I did double check that their coordinates are the same as defined in my glorthro.

sentences:
Entity System with C++ I'm working on a game engine using the Entity System and I have some questions.

How I see Entity System :

Components : A class with attributs, set and get.

Sprite
Physicbody
SpaceShip
...

System : A class with a list of components. (Component logic)

EntityManager
Renderer
Input
Camera
...

Entity : Just a empty class with a list of components.

What I've done :

Currently, I've got a program who allow me to do that :

// Create a new entity/
Entity* entity = game.createEntity();

// Add some components.
entity->addComponent( new TransformableComponent() )
            ->setPosition( 15, 50 )
            ->setRotation( 90 )
        ->addComponent( new PhysicComponent() )
            ->setMass( 70 )
        ->addComponent( new SpriteComponent() )
            ->setTexture( "name.png" )
            ->addToSystem( new RendererSystem() );

My questions

Did the system stock a list of components or a list of entities ?
In the case where I stock a list of entities, I need to get the component of this entities on each frame, that's probably heavy isn't it ?
Did the system stock a list of components or a list of entities ?
In the case where I stock a list of entities, I need to get the component of this entities on each frame, that's probably heavy isn't it ?

sentences: Why are Monogame models tied to effects? When I load a model in Monogame using ContentManager, the model contains effects on each mesh (mesh.Effects). This is confusing to me since models seem to be directly tied to their rendering, rather than existing as standalone 3D models. Further, this makes applying custom effects more difficult in code, since I have loop through each ModelMeshPart and assign effects. The comparison to 2D would be a Texture2D containing its own SpriteBatch settings, which wouldn't make sense. Why are models tied to effects, and how can I separate them?

sentences:
In a 2D tile engine, how do I figure out which tiles are culled and which to draw? I'm trying to make a simple 2d tile engine here, and I've got a problem with getting a proper cells from a tile grid map when I'm trying to cull off tiles which aren't needed to be drawn.

I've got a tile which is 16 by 16 pixels and
 a tilemap represented as a grid of 0, 1 etc

For example

{1,1,1,1}
{1,1,1,1}
{1,1,1,1}
{1,1,1,1}

Then I translate it to a Tile[,] matrix like this

public void SetMap(Int32[,] tileCodes, int sizeX, int sizeY, TileTextures tileTextures) {
        //A simple check that sizes are equal
        if (sizeX == mapBounds.width && sizeY == mapBounds.height) {
            for (Int32 i = 0; i < mapBounds.width; i++) {
                for (Int32 j = 0; j < mapBounds.height; j++) {
                    if ((TileType) tileCodes[j, i] != 0)
                        map[j, i] = new Tile(new Vector2(i, j), (TileType) tileCodes[j, i], tileTextures.GetTexture((TileType) tileCodes[j, i]));
                }
            }
        } else
            Console.WriteLine("Map.SetMap: Unable to set map of diffent size than defined one");
    }

So it's basically tile grid now (tile[x,y]), but I can't figure out, which tile I should draw. I've already got a vissible area as a rectangle (va):

public void Draw(SpriteBatch spriteBatch) {
        // How to get positions in tile[x,y]?
        int startX = va.area.Left/ 16;
        int endX = va.area.Right/16;
        int startY = va.area.Top/16;
        int endY = va.area.Bottom/16;

        for (Int32 i = startX; i < endX; i++) {
            for (Int32 j = startY; j < endY; j++) {
                Tile tile = map[i, j];
                tile.Draw(spriteBatch);
            }
        }
}

Any ideas?

sentences:
2D Camera in LWJGL 3 I am trying to implement a simple 2D camera in LWJGL3.

The camera has an orthographic projection and can move in 2D space.

This is run once at game start-up:

GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glLoadIdentity();
GL11.glOrtho(0, graphics.window().width(), graphics.window().height(), 0, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glLoadIdentity();

This is run as part of the draw loop:

GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
GL11.glTranslatef(-position.x(), -position.y(), 0f);

// Draw stuff

GL11.glPopMatrix();

Everything looks fine until I move the view, after which everything seems to be closer to the top left (0, 0) than it should be. It seems to be off by a scalar of the window size - the factor is greater in x than y.

How have I misunderstood the OpenGL commands?

sentences:
Wrapping each script with classes causes errors The goal here is to change variables from another script. Thing is that they must be in classes, so for example I wrapped this code (which is from PadControl.js):

#pragma strict

public var ball : GameObject;
public var moveSpeed : float = 10;
public var rotationSpeed : float = 10;

function Update () {
    var padMove : float = Input.GetAxis("Horizontal");
    var padRotate : float = Input.GetAxis("Vertical");

    this.transform.position.x += padMove * moveSpeed * Time.deltaTime;
    this.transform.rotation.y += padRotate * rotationSpeed * Time.deltaTime;
}

function OnCollisionEnter(col : Collision){
    if(col.gameObject.name == "Ball"){
//      Debug.Log("SAY SOMETHING");
    }
}

like so:

#pragma strict

public class PadControl{
    public var ball : GameObject;
    public var moveSpeed : float = 10;
    public var rotationSpeed : float = 10;

    function Update () {
        var padMove : float = Input.GetAxis("Horizontal");
        var padRotate : float = Input.GetAxis("Vertical");

        this.transform.position.x += padMove * moveSpeed * Time.deltaTime;
        this.transform.rotation.y += padRotate * rotationSpeed * Time.deltaTime;
    }

    function OnCollisionEnter(col : Collision){
        if(col.gameObject.name == "Ball"){
    //      Debug.Log("SAY SOMETHING");
        }
    }
}

As stated in this tutorial coming from Unity's website (https://unity3d.com/learn/tutorials/modules/intermediate/scripting/statics)

But when I do it, this is the error:

  Assets/PadControl.js(12,22): BCE0019: 'transform' is not a member of 'PadControl'.
  Assets/PadControl.js(13,22): BCE0019: 'transform' is not a member of 'PadControl'.

And I really don't know what's actually going on and what should I do. Any suggestions?

sentences:
How to put labels at a specific point on any resolution I am working on a project in Unity 4.6.1 and I put the label at the top:

But when I put the Scene in full view this happened:

I made a Development Build and when I select my resolution (1366x768) the label goes behind the buttons. Is there any way to put the label at a specific point no matter what resolution?

sentences:
Unity - Instantiate GameObject from client on Network I am building a game where a weapon shoots prefab bullets. I am trying to make this a multiplayer game, so the bullets need to be spawned into the Network.

What happens right now is that if I shoot a bullet from a host, the bullet is shot, but doesn't appear on the client screen. If I shoot the bullet from the client, the bullet doesn't appear on either screen. In fact, the function CmdShoot() isn't even called, as the Debug.Log("Hello") is not called. Here is the current code:

public class Gun : MonoBehaviour
{

    private GameObject bulletPrefab;

    void Update()
    {
        if (Input.GetMouseButtonDown(0)) {
            owner.GetComponent<PlayerSetup>().CmdShoot(bulletPrefab, transform.position, owner.name, GetComponentInParent<Weapon>().angle);
        }
    }
}

public class PlayerSetup : NetworkBehaviour
{

    void Start ()
    {
        // Disable components if not local player
    }

    [Command]
    public void CmdShoot(GameObject bulletPrefab, Vector3 position, string playerName, float angle)
    {
        Debug.Log("Hello");
        GameObject bullet = Instantiate(bulletPrefab, position, Quaternion.identity);
        bullet.name = "bullet: " + playerName;
        bullet.GetComponent<Rigidbody>().AddForce(Quaternion.AngleAxis(angle, Vector3.forward) * Vector3.right * bulletPrefab.GetComponent<Bullet>().force);
        Destroy(bullet, 10f);
        NetworkServer.Spawn(bullet);
    }
}

Edit:

This piece of code doesn't work either, gives the same result. No error, but the function is also not called. The Input is detected though:

    void Update() {
        if (Input.GetMouseButtonDown(0)) {
            CmdShoot();
        }
    }

    [Command]
    void CmdShoot()
    {
        Debug.Log("Shoot");
        GameObject bullet = Instantiate(gunComponent.bulletPrefab, gun.position, Quaternion.identity);
        bullet.name = "bullet: " + transform.name;
        bullet.GetComponent<Rigidbody>().AddForce(Quaternion.AngleAxis(GetComponentInChildren<Weapon>().angle, Vector3.forward) * Vector3.right * gunComponent.bulletPrefab.GetComponent<Bullet>().force);
        Destroy(bullet, 10f);
        NetworkServer.Spawn(bullet);
    }

```

sentences:
How to create a vertex array from any shape in JBox2D? I have a code, that add a vertex array to a shape, my code is:

PolygonDef shape = new PolygonDef();
for (int i=0; i<vertices.size(); i++) {
    Vec2 v = vertices.get(i);
    shape.addVertex(new Vec2(v.x/RATIO,v.y/RATIO));
}

But its very strange because not working good on any of my polygon creator tool.

So with a triangle, it work good:

    ArrayList<Vec2> vertices = new ArrayList<Vec2>();

    vertices.add(new Vec2(0,-size.height/2));
    vertices.add(new Vec2(size.width/2,size.height/2));
    vertices.add(new Vec2(-size.width/2,size.height/2));

but with a bigger polygon of 50 to 60 vertices it's not working.

How I can create a usable vertex array from a shape? I have a greyscaled image with black and white colors... How can use this shape (image) to define my vertex array good?

And in box2D with the addVertex how I can add this points to make a normal usable polygon? (counter clockwise?)

sentences:
Which version of Quake 2 source code do I need to compile to work with version 3.20 map packs? I'm a big fan of Quake 2 game. Recently I've decided to spend some of my free time for digging into the Quake 2 src code. There are 2 versions of the full game code 3.19 and 3.21 (including the game exe as well as the game dll).
As regards to the Q2 Mission Packs the src files for both The Reckoning and Ground Zero are rather of verions 3.20 as the filename suggests (xatrixsrc320.exe and roguesrc320.exe)
My question is WHICH version of the game exec do I have to compile to use with the mission pack dlls? Is it better to use the 3.21 exe together with 3.20 of the xatrix & rogue dlls, or maybe the older 3.19 would be more appropriate?

sentences:
Where to update Player health text graphics? (C++) I am trying to update the text rendered on the screen after the health of a player changes. The problem I am having is deciding where to update this.
The player and health graphics are separate objects.

Currently,my code is organized like this:
The main c++ has vectors:

vector< Players>
vector< Renderables>

"Renderables" is anything that can be rendered. It has a member function render() which is called for every object in the vector.  A "Text" class inherits from it. It contains the string that is displayed on screen. "Text" has its own render function, and calls its member function getString() inside its render function.

The question is where do I update this string once the player's health has changed?

My current solution is actually to have a "PlayerHealth" subclass of "Text", which holds a pointer to the player.  That way "PlayerHealth"can just redefine getString() as player->health converted to a string, and using "Text"'s render function. But I've been told this wasn't a very good method and was wondering what other approaches there were to this problem.

Thank you for your time

sentences:
When mapping the surface of a sphere with tiles, how might you deal with polar distortion? It's easy to deal with the way locations interact on a clean Cartesian grid.  It's just vanilla math.  And you can kind of ignore the geometry of the sphere's surface for a bunch of it if you want to just truncate the poles or something.  But I keep coming up with ideas for games where the polar space matters.  Geo-coded ARGs and global roguelikes and stuff.

I want square(ish?) locations -- reasonably representable by square tiles of the same size across the globe, anyway.

This has to be a solved problem, right?

What are the solutions?

ETA:

At the equator -- and assuming that your square locations are reasonably small, it's close enough to true that you can get away with having one square in the rows north and south of the most equatorial row.  And you could probably get away with that by just hand-waving the difference up to like 45-degrees or so.  But eventually, you need to have fewer squares in a pole-ward circumferential row.  If I reduce the length of the row by one and offset the squares by 1/2 then they're just like hexes  and it's relatively easy to do the coding to keep track of the connections.  But as you get pole-ward, it gets more and more extreme.

Projecting the surface of the world onto the surface of a cube is tempting.  But I figured there must be more elegant solutions already in use.

If I did the cube thing (not dissecting it further through geodesy) Are there any pros and cons related to placing the pole at the center of a face or at the vertex of three sides?

sentences:
Camera roll has no effect Consider my following (abstracted) C# w/ SharpDX code:

class Game
{
    Camera _camera = new Camera();

    private void Window_KeyDown(object sender, KeyEventArgs e)
    {
        // Roll
        if (e.KeyCode == Keys.Home)
        {
            _camera.TurnRoll(-0.05f);
        }
        else if (e.KeyCode == Keys.End)
        {
            _camera.TurnRoll(0.05f);
        }
        // Other rotation / movement works...
    }
}

class Camera
{
    private Vector3 _position;
    private Vector3 _rotation;
    private Vector3 _right;
    private Vector3 _up;
    private Vector3 _forward;
    private Matrix  _view;

    public Camera()
    {
        _right = Vector3.Right;
        _up = Vector3.Up;
        _forward = Vector3.ForwardLH;
        UpdateViewMatrix();
    }

    public void TurnRoll(float roll)
    {
        // Relative rotation
        _rotation.Z += roll;
        UpdateViewMatrix();
    }

    private void UpdateViewMatrix()
    {
        Matrix cameraRotationMatrix = Matrix.RotationYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z);
        Vector3 cameraTarget = Vector3.TransformCoordinate(Vector3.ForwardLH, cameraRotationMatrix);
        cameraTarget = cameraTarget.Normalize();
        cameraTarget += _position;

        // I bet the problem lies in and/or after this line
        Matrix rotateYTempMatrix = Matrix.RotationY(_rotation.Y);

        _right   = Vector3.TransformCoordinate(Vector3.Right,     rotateYTempMatrix);
        _up      = Vector3.TransformCoordinate(Vector3.Up,        rotateYTempMatrix);
        _forward = Vector3.TransformCoordinate(Vector3.ForwardLH, rotateYTempMatrix);

        _view = Matrix.LookAtLH(_position, cameraTarget, _up);
    }
}

My problem: Even when pressing the Home and End keys, the camera roll visibly stays untouched. I have trouble correcting my UpdateViewMatrix function, and I bet that the error is in there. I'm a bit lost with the maths here and my tries to use another rotation matrix to update the _up vector all failed or created other problems.

Can anybody clear my math mind up and help me correct this method?

EDIT: Solved with the help of winged's answer below. I edited the code to be

private void UpdateViewMatrix()
{
    Matrix rotation = Matrix.RotationYawPitchRoll(_rotation.Y, _rotation.X, _rotation.Z);

    _forward = Vector3.TransformCoordinate(Vector3.ForwardLH, rotation);
    _forward += _position;

    _up = Vector3.TransformCoordinate(Vector3.Up, rotation);

    _view = Matrix.LookAtLH(_position, _forward, _up);
}

However, this is still not completely correct. The camera rolls now, which solves this question. But if it is rolled and I try to yaw it, the yaw happens like as if the camera is non-rolled and moves along the default Y-axis :/. Especially when looking downwards 90 degrees this causes something like gimble-lock to happen (or IS it gimble lock?) because rolling and yawing the camera has the same effect then.

EDIT2: I completely replaced my rotation with quaternions. I don't know why people think these are "harder" or at least "different" to understand. This solution works perfectly.

public void Turn(Vector3 turning)
{
    // Relative rotation
    Quaternion delta = Quaternion.RotationYawPitchRoll(-turning.Y, -turning.X, -turning.Z);
    _rotation = delta * _rotation;
    _rotation.Normalize();
    UpdateViewMatrix();
}

public void TurnRoll(float roll)
{
    Turn(new Vector3(0, 0, roll));
}

private void UpdateViewMatrix()
{
    Matrix view = Matrix.RotationQuaternion(_rotation);
    Matrix translation = Matrix.Translation(-_position.X, -_position.Y, -_position.Z);
    _view = translation * view;
}

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

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

sentences:
Can I include a public domain book in my game? Just for fun, I want to include a bookshelf in my game with a real book (or few) that you can actually read.

Would I run into any legal trouble if I included an out of print book in the public domain, such as Pride and Prejudice or Alice in Wonderland?

sentences:
Assembling a party of adventurers Ok, so my little dungeon runner game has its functioning adventurer characters as objects, but unfortunately I'm having trouble figuring how to let the player assemble a party of four of them like I originally intended. I suspect I will need to have a room/menu before the "dungeon" room proper where the player selects which four adventurers will be assigned to an object array that will be used in the subsequent dungeon, but I'm having difficulty finding specifics on how to properly do that in Game Maker Studio 2. Does anyone else have any experience doing this or similar they'd like to share?

EDIT: Teammates don't need to have any AI beyond following behind the "leader"; in fact, the player only controls the head of the party, which they will be able to cycle out with another member in party order during the dungeon run with the press of a single key. I might have only the character the player is controlling take damage as well, but either way each party member has their own individual HP tracks that renders them unusable when it goes below '0'.

sentences:
Drawing the same mesh or drawing the same material? I was wondering. Suppose I have a 1000 grass meshes. They all have the same material, but I create them separately, because they look slightly different, because they have different heights.

Does my GPU speed up if I only draw one mesh over and over again? Or is only the material switching and uniform setting the main problem?

So: Should I consider going to only one mesh a 1000 times, or is it ok to have a lot of different meshes with only the same material?

sentences: Phaser Tiled map importing How can I be sure that the tileset used in making a Tiled map remains as a multiple of 2, since this is a requirement of phaser when loading JSON tiled maps? I have tileset images which I got for free and they are not exactly up to phaser specs to be used.

sentences:
Collision detection with non-rectangular images I'm creating a game and I need to detect collisions between a character and some parts of the environment. Since my character's frames are taken from a sprite sheet with a transparent background, I'm wondering how I should go about detecting collisions between a wall and my character only if the colliding parts are non-transparent in both images.

I thought about checking only if part of the rectangle the character is in touches the rectangle a tile is in and comparing the alpha channels, but then I have another choice to make... Either I test every single pixel against every single pixel in the other image and if one is true, I detect a collision. That would be terribly ineficient.

The other option would be to keep a x,y position of the leftmost, rightmost, etc. non-transparent pixel of each image and compare those instead. The problem with this one might be that, for instance, the character's hand could be above a tile (so it would be in a transparent zone of the tile) but a pixel that is not the rightmost could touch part of the tile without being detected. Another problem would be that in different frames, the rightmost, leftmost, etc. pixels might not be at the same position.

Should I not bother with that and just check the collisions on the rectangles? It would be simpler, but I'm afraid people.will feel that there are collisions sometimes that shouldn't happen.

sentences:
how to switch cameras with one button? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class cameraswitch : MonoBehaviour {
 public Camera cam1;
 public Camera cam2;

void Start () {
    cam1.enabled = true;
    cam2.enabled = false;
    Button Button = gameObject.GetComponent<Button>();
    Button.onClick.AddListener(baz);
}

void baz () {
    cam1.enabled = false;
    cam2.enabled = true;
}
}

this is my code . how to switch between the cameras with one button . and Thank You.

sentences:
Why are huge polygon amounts bad? It is always said that the polygon amount of a single modell must be as little as possible when it comes to realtime simulations such as computer games. (Or at least lower than when rendering a movie)
I am fully aware that this must be done in order to save performance. But aside from that information i cannot find why huge polygon amounts must be avoided.

(In Short: I know that polygons eat performance. I want to know why they eat performance)

So my question would be:
What happens when a frame is rendered? The polygons are surely somehow processed in the graphicard. What happens there?.
If possible i would like to have some links to sites containig this information.

sentences: In Unity, how do I make text/annotations appear when I mouse over GameObjects in playmode? How do I make text appear when I mouse over GameObjects in-game? What is the Unity jargon for this? I'm assuming it's 'annotations'.

sentences:
How to have a gradient blur in objects on Unity? This is related to a previous question I've asked here:
How to blur entire scene but a specific spot in Unity?

At the time I managed to solve my problem with a "hard" cutoff on the blurred and non-blurred objects. But now I need to have the same effect, but with some sort of "transition" between them, like the objects still being blurred at the edges of the circle "mask" I'm using and getting "non-blurred" as they get closer to the center.

As it is a mobile game, performance is really important, so is there any way of doing that without destroying my fps?

Thanks for your attention.

sentences:
AddListener will not listen to onClick event Based on this question on the Unity forum, I've made this code to instantiate a button and add an onClick event.

// Setting some other component properties right of the prefab.

shopTurretItem.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(() => {
    UnityEngine.Debug.Log("Click");
});

Instantiate(shopTurretItem, transform);

The variabele shopTurretItem is my prefab type of UnityEngine.GameObject.

The problem is that the log Click will never be shown. If I add breakpoints on the first code line, the compiler will stop the code. If I place it into the closure, it'll never be hit if I click on that button.

This is the inspector of my prefab shopTurretItem.

What's wrong with this code?

sentences:
Why don't we assign a class for each gameobject type in unity? I used to create games from scratch with C++. There, people would create a "class Bullet", and add functionality to that class so that we can instantiate objects of class Bullet at runtime.

However, in Unity (which I'm new to), we need to create a Bullet GameObject in the editor, and then assign "class BulletBehaviourA : MonoBehaviour" to the Bullet GameObject. I don't really grasp this logic. Why don't we have a class for the Bullet in Unity?

sentences:
Can a loading screen be implemented using one thread only? If so, how? I have seen guides on how to implement a loading screen using more than one thread. But sure it must be possible to do so with one thread, since older (even 2D) games that run on single-threaded machines had loading screens as well.

So, how do you do it?

sentences:
Game speed cubic growth Is it possible, using delta in my update method to increase a game speed variable exponentially on cubic growth (the blue line below)

My maths isn't great so I'm not sure how the formula would be put into practice using a float gameSpeed and delta in an update method -(void) update:(ccTime)delta I think I would also need a value to control the speed of the growth too?

sentences:
How can I improve my touch slide mechanic to be more smooth and fluid? I have the following C# code, but it leaves me with two problems:

void FixedUpdate()
{
    if (Input.touchCount == 1)
    {
        this.transform.Translate(Input.touches[0].deltaPosition.x * 0.009f, 0, 0);
    }
}

Firstly, the gameobject (which is a sphere in my case), has a tendency to leave the ground and fly into the air. Additionally, it is not as smooth and snappy but fluid as I would like it to be.

If you look at some of the following gameplay videos, you will see the kind of movement I am looking for.

"Splashy!" Gameplay
"Sky Ball" Gameplay
"Balls Race" Gameplay

More specifically, from actually playing each of the above games, there is a certain "ratio" that seems to be operating in regards to each swipe gesture and the actual movement of the ball. That is, the ball does not go exactly where the finger goes, for it is slightly ahead, if that makes sense. What I mean is, the device is only so wide, yet for that width, the ball can always reach it's required destination on either end of the horizontal axis. This must mean that for every pixel the finger moves, the ball moves a little bit more to fit that pixel density of the screen. In other words, in the case of "Splashy!", it's clear that even if the finger moves the entire distance across the screen, the ball moves more than double that distance.

By "smooth", "fluid", and "snappy", I mean that the swiping gesture is very responsive. It moves where you want it to and does not over or undershoot. Additionally, the "snappy" effect is present when you stop swiping. The ball seems to "snap" into it's end position.

My question, then, is what is the best way to improve my script as to achieve the polished mechanic I am looking for, as is depicted in the above videos? Also, how can I keep the sphere on the ground without constraining any axes on the rigidbody? I am using Unity3D with C#.

I would appreciate any help you could provide. Thank you.

sentences:
Inventory Table efficiency 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.

sentences:
Retractable object in unity I'm trying to get the physics of a retractable object in unity,
So I will be able to "launch" an elastic cable (similar to rope physics) out of an object (e.g. A gun),
And the cable will gradually/exponentially "roll back" into the object.
A good reference would be Batman's grapple gun.
I thought of utilizing it using a spring joint, but I can't really get the exact mechanics I'm trying to achieve.
Any ideas?
Thank you in advance.

sentences:
Unity Rigidbody sitting on top of another Rigidbody does not move with the Rigidbody its sitting on I have a mesh with a rigid body that moves back and forth like a platform. Other rigidbodies fall onto the upper surface of this cube. The problem I have is that when the platform rigid body moves the other rigid bodies stay in the position they landed in, they do not move with the cube. Everything else physics wise works.

I have tried adding a physicsmaterial to both the platform and the rigidbodies falling onto the platform but this made no difference.

I do no want to tether them to each other because I want them to fall off when they are pushed by other objects.

The platform is moved back and forth using the RigidBody.MovePosition function.

sentences:
Where to look for team mates? Where is a good place to look for people interested in creating games online? I'll be using XNA.

I'm going to start the project later this week, but I'm definitely commited to it. I'd like to find people who won't hit it and quit it after a month.

sentences:
How can I make expanding bullet pattern shapes? I want to make a series of expanding bullet patterns that form shapes such as squares, triangles, etc. An example of what I'm after can be seen in the following video where when the stars are collected the bullets explode in the shape of an expanding star:

https://youtu.be/7JGcuTWYdvU?t=2m41s

sentences:
How do you handle large triangles with frustum? I am rendering the Sponza scene ato test my frustum implementation.

My current approach is simply, test if the vertices of the triangle are within the frustum (angle between the camera looking direction and the position od the vertex relative to the camera).

If any of the vertices are visible then the trianlge is considered to be visible.

The issue is that the sponza scene has some really large triangles, thus with my approach it is possible to be looking directly at a triangle and see nothing if all 3 vertices are outside the camera frustum.

sentences:
Reducing the number of edges in a pathfinder I've worked out an algorithm for pathfinding in a quite free-form terrain (not constrained to grids), with the limitation that it doesn't allow the moving character to rotate. I'll use it for AABBs so that's not a problem, and I'll assume AABBs below.

However, one of the steps consists of creating a graph in which the path is to be found, and that's where the problem is: it seems to me that the number of graph edges to construct is going to be O(V²) where V is the number of vertices. Yet when looking at a typical graph, it is apparent that many of these edges do not need any consideration at all. So the question is if there is a way to reduce the number of edges.

The algorithm goes like this. The input is a traveler, a series of boxes (the maze) and a destination point:

http://www.formauri.es/personal/pgimeno/temp/rect4572.png

(in this example, the reference point of the traveler is at the bottom right of the rectangle because I made a mistake estimating the MDs by hand; sorry about that)

Calculate the Minkowski difference of the traveler and each box in the maze: http://www.formauri.es/personal/pgimeno/temp/rect4574.png - this reduces the problem to having a point crossing that maze, simplifying analysis.
Create the graph:

2.1. Each vertex is a corner of one of the boxes in the Minkowski difference.
2.2. For each pair of vertices, there is an edge iff the line between them does not have any point inside one of the boxes. In other words, if there is a direct line of sight between them.

Result: http://www.formauri.es/personal/pgimeno/temp/rect4758.png (done by hand - I may have forgotten edges)
Run a pathfinding algorithm on that graph. http://www.formauri.es/personal/pgimeno/temp/rect4776.png

The path found is directly usable in the original map: http://www.formauri.es/personal/pgimeno/temp/rect5158.png

The problem is step 2.2. Is it possible to reduce the number of edges?

I'm not aware of any pitfalls in the algorithm, but if you see one, please let me know as well.

sentences:
How to change color of text in canvas in phaser.js? I want to change the text color in my game that is build in phaser.js. But i have no idea how to do this, because i am not a coder.

Can somebody help me to change the color of my game text?

My Game is http://games.eyebraingym.com/slotreading/

I want to change the color on the canvas where the heading is 'Slot Reading'.

sentences:
How to Further My Game Dev Studies Away from Technology? I'm a college student, and I have a really boring class every Tuesday that's 2 hours and 45 minutes long. It's an interesting situation... attendance is required and checked, and electronic devices aren't allowed, but discussion isn't required and the lectures don't really matter to the exams. So I sit there in the back of the room either dozing off, doing Sudoku, doodling on my paper, pen-spinning, or trying to secretly use my phone without getting caught. I find myself wishing I could use the time productively.

Just like when one sits down with paper and crayons and can't think of anything to draw, I find myself wanting to do something to further my game development skills (e.g. work on the design of a game) but as I sit there with a pen and paper and the professor droning on, nothing comes to mind.

Help me get through this tedious class! What are some things I could think through or work on, or how can I figure out things to think/work on? Or even things I could print out in advance and read or solve during class. Remember the constraint is that I have no access to technology...

And I'm not sure a book would be appropriate. Though now that I think of it, I should probably just read game dev books from the library. Why didn't I think of that before? Anyway I still want to hear suggestions! What would you do with this time, if you were in this situation?

sentences:
Help understanding radar sweep effect in shader code Several days ago I asked about this question: How to construct a propeller clock in Unity? But I don't understand how the answer works.
I have 0 knowledge about shaders, so I picked up a tutorial to understand the math functions, but that still didn't helping much in understanding the code.
I cut off part of the code to check the effect on an image, and I want to understand why the code has this effect.

What is the range of values for the parameters i.uv.y or i.uv.x?

Next I discarded part of the code, simplifying the fragment shader to just:
fixed4 frag (v2f i) : SV_Target
{
    // Simulate the strip of LEDs spinning around very fast.
    float headAngle = _Time.y ;

    // Compute the angle of the pixel we're rendering.
    float angle = atan2(i.uv.y, i.uv.x);

    float difference = frac( angle / (2.0f * 3.141592653589f));

    return difference;
}

And I rendered this on a plane:

According to the documentation, atan2 gives an angle value in between -pi and pi. So the range of angle / (2.0f * 3.141592653589f)) is in between -0.5 and 0.5.
I tested with frac(0.3), frac(0.25), which is the same as return 0.3 or return 0.25 since frac preserves only the decimal number. But why I couldn't generate the same gradient image as the one above? Instead, the plane is all one shade of grey, no matter what number I use.

Next I tried the code float difference = frac(headAngle) and got an image which is constantly varying between dark and bright images like these:

Putting this together:

From the 1st picture, I have an image with a gradient that's dark in the 1st quadrant and bright in the 4th quadrant.

From the 2nd & 3rd pictures, I have all four quadrants at the same brightness, constantly varying between them.

What I don't understand is how the sum of these two pieces of code works. If I combine them like this:
float difference = frac(headAngle + angle / (2.0f * 3.141592653589f));

Shouldn't I get a gradient that stays in one place, like the 1st image, but just changes in brightness like in images 2 & 3?
Instead I get a A brightness gradient that is sweeping in a circle around the plane:

...and I don't understand why.

sentences:
Is it a bad idea to store all textures in linear color-space? I am wondering about the performance behind color-space conversions for textures during reading.
If a project decides to go with a linear workflow, as in, when doing any sort of color manipulation, like lighting, they operate on within the linear color-space, is there any good reason to not store all texture assets in the linear color-space?
My understanding is that when loading textures which are stored in sRGB, the GPU can do the conversion to linear for you very quickly. Is that cost completely negligible? Why not just store all the textures in that form?
The only reason I can think against this is that you may want to store the textures in a color-space that looks like the one you intend to display to (if you're going to display to sRGB then you should store the textures in sRGB). In that case, why not master the texture as sRGB but then store them on disk already converted to linear colorspace?

sentences:
How can I implement the traffic(+drawing) functionality in the game? I am a beginner game developer. Games such as "Cities: Skyline", "Simcity", "Citybounds", and "Traffic lanes 3" directly build roads and show simulations of cars moving over them. I have no knowledge to make these things. I can use Unity, construct2. How can I express things like roads, lanes, intersections, snapping, traffic simulations, path finding, driver AI,  traffic lights, even wheels on the road?

Road drawing

Traffic simulating

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

sentences:
XNA - How to move skinned model and merge animations After you helped me to resolve my loadContent problem I've wrote some code and made 3D model with animation. Because XNA 4.0 doesn't support .fbx with multiple animations I've generated 3 models with different animations:
1. Start animation ( when you press arrow for the first time)
2. walk animation ( when you still hold it)
3. stop animation ( when button is up)

And here comes my question. How to apply those 3 models to work with arrows.
Now I'm using to render animations (http://xbox.create.msdn.com/en-us/education/catalog/sample/skinned_model )

 protected override void LoadContent()
    {
        // Load the model.
        currentModel = Content.Load<Model>("end_R");

        // Look up our custom skinning information.
        SkinningData skinningData = currentModel.Tag as SkinningData;

        if (skinningData == null)
            throw new InvalidOperationException
                ("This model does not contain a SkinningData tag.");

        // Create an animation player, and start decoding an animation clip.
        animationPlayer = new AnimationPlayer(skinningData);

        AnimationClip clip = skinningData.AnimationClips["end_R"];

        animationPlayer.StartClip(clip);
    }

file with model and animation's name is identical.

I have also second question :) How to get model position from or how to move this model? Now it's connected with camera coordinates but I'd rather prefer the model to have it's own coordinates and transform it independently from camera.

sentences:
How can I move an object diagonally on Windows Phone? I want to pull a sprite from point A(vector2) to point B(vector2) in my Windows Phone XNA game. GestureType.HorizontalDrag moves it horizontally and GestureType.VerticalDrag moves it vertically, how can I move the sprite diagonally?

The player should be able to pull the sprite in every direction if he touches the sprite with his finger. The sprite can't be moved if the player's finger isn't on the sprite.

How can I do that? How can I move an object diagonally on Windows Phone?

sentences:
VBO and gl*Pointer management practises? I'm aware it's not a simple yes/no question and for the moment I can't tell if it can be simply answered, or is it a topic for a long discussion which is not suitable for our Q&A format.

I want to do some VBO management in order to reduce calls to GL.

I have 4 VBOs for all meshes:

one for static draws
one for dynamic draws
one for stream draws
one for indices

I want these four to handle my whole scene - this is going to reduce calls to glBindBuffer.

My mesh object consists respectively of static part, dynamic part and stream part, each of the part is specified by vertex specificator that is created at runtime, just by pushing back attribute objects containing size/type/offset to a member vector.

Based on the vertex specificators you can fill the parts with interleaved data, you don't have to do this for all the parts though. As I read here, separating vertex parts with different usage modes is good as it allows you to update all the dynamic/stream data at once without ever touching the static data. For example, doing particle simulation I may not be necessarily interested in streaming texture coordinates - changing vertex positions may be enough.

What's going to happen next:

sort all mesh objects by the vertex specificator of its static part
upload all the meshes' static parts' vertex data in obtained order to the static VBO
sort all mesh objects by the vertex specificator of its dynamic part
upload all the meshes' dynamic parts' vertex data in obtained order to the dynamic VBO

... and so on.

In short, static/dynamic/stream chunks (each in one of the 3 VBO's to which it belongs) with the same vertex types will be next to each other, and this is going to reduce calls to glVertexAttribPointer. Here I will need to smartly organize meshes that may want to use various parts, and then implement kind of lazy binds, probably if mesh needs to call glPointer for two different VBOs (separate static and stream parts for example), check if one of them is not already bound and call corresponding glPointer first.

Of course, each of the big batch obtained that way will then be sorted inside on the level of draw calls to reduce switches of shaders, textures and so on.

In short, this is my idea:

Although such a case may be uncommon, it's just to illustrate what should my mesh organizer be able to deal with.

Well, now it's only a plan and I haven't yet implemented it but..

How do the modern, high performance engines do their VBO and gl*Pointer state management? Is there something wrong with my concept, or am I totally misguided? Google results for VBO management and similiar tend to give me topics where people are asking for help because their programs crash, or just usage examples that tell nothing about optimizing my rendering procedures on VBO level but just "avoid redundant calls to GL", or some actual one-line tips (like glBufferData with NULL). So what I've described above is what I've concluded myself using those informations and I'm not sure if I am even on the right path.

Could somebody show me some good and actually proven practises managing VBOs in big 3D scenes, or maybe guide me a bit if I am actually reasoning right ?

sentences:
Get local coords from global coords I need to get local coords from global coords. I did not find ready-made examples.

Please help me how to do it on the example image. Thank you!

UPDATED:

Here's the method in the java, created thanks to your help! It works for me :) Thank you!

public static double[] getLocalFromGlobal(int pointX, int pointY, int localX, int localY, float angle) {
    float px = pointX - localX;
    float py = pointY - localY;

    double cos = Math.cos((Math.PI / 180) * angle);
    double sin = Math.sin((Math.PI / 180) * angle);

    double finalX = (px * cos) + (py * sin);
    double finalY = -(px * sin) + (py * cos);
    return new double[]{finalX, finalY};
}

sentences:
How do you handle entity parent-child relationship in Ashley ECS? In the below code example, is a parent-child relationship of an entities. Now every child should follow its parent position, and the child could be re-positioned anywhere.

Entity character; // character is a parent
Entity weapon; // weapon is a child of character

Entity gun; // gun is a parent
Entity bullet; // bullet is a parent
Entity bulletShadow; // shadow is a child of bullet

My own solution is to have an OwnershipComponent which has a Entity owner attribute, but there's a doubt in my mind that the components should only have a data. An Entity is a collection of data, if I  pass this data to components this could lead to over-killing of iteration. So I've changed my mind to use its attribute int flags, this could now be use as an id to reference to child-parent relationship.

public class OwnershipComponent implements {
    public int ownerId;
}

// Entity Manager class

public void create() {
    Entity character = createCharacter();
    createWeapon(0, 0, character.flags);
}

public void createWeapon(float x, float y, int ownerId) {
    Entity weapon = engine.createEntity();
    weapon.flags = // generated unique ID from the weapon category

    OwnershipComponent ownership = engine.createComponent(OwnershipComponent);
    ownership.ownerId = ownerId;

    weapon.add(ownership);
}

public Entity getEntityById(int id) {
    return ...
}

I could access now the parent entity by id and transform its child position relatively.

// Ownership System

public void processEntity(Entity entity, float deltaTime) {
    OwnershipComponent ownership = Mapper.ownership.get(entity);
    Entity parent = EntityManager.getEntityById(ownership.ownerId);
}

sentences:
Finding the shorter turning direction towards a target I'm trying to implement a type of movement where the object gradually faces the target. The problem I've run into is figuring out which turning direction is faster. The following code works until the object's orientation crosses the -PI or PI threshold, at which point it will start turning into the opposite direction

void moveToPoint(sf::Vector2f destination) {
    if (destination == position) return;

    auto distance = distanceBetweenPoints(position, destination);
    auto direction = angleBetweenPoints(position, destination);

    /// Decides whether incrementing or decrementing orientation is faster
    /// the next line is the problem
    if (atan2(sin(direction - rotation), cos(direction - rotation)) > 0 ) {
        /// Increment rotation
        rotation += rotation_speed;
    } else {
        /// Decrement rotation
        rotation -= rotation_speed;
    }

    if (distance < movement_speed) {
        position = destination;
    } else {
        position.x = position.x + movement_speed*cos(rotation);
        position.y = position.y + movement_speed*sin(rotation);
    }
    updateGraphics();
}

'rotation' and 'rotation_speed' are implemented as custom data type for radians which cannot have values lower than -PI and greater than PI. Any excess or deficit "wraps around". For example, -3.2 becomes ~3.08.

sentences: LibGDX - Show a minimap I've started to develop a small roguelike game in LibGDX. I've also made a minimap class, which creates and updates the minimap as the player explores the dungeon, by using a Pixmap. The minimap class has an OrthographicCamera (currently unused), which will be used for centering the minimap on the player. The minimap is currently rendered with it's own SpriteBatch. Now I'd like to put the minimap on the upper right corner, and clip it, because it is so big, that it'd obscure the half of the screen. I'm not really sure how to do this clipping part. I assume I should use the ScissorStack class, but the LibGDX wiki is a bit uninformative for me.

sentences:
Make a light only affect one object I'm wondering if it's possible to make a light source only affect one object? I know that it's possible to use layers and culling mask, but then I would need one layer for every single object which is not possible.

Is there a way for example that I could make only children or siblings be affected by a light source? Or other solution?

Have a nice day!

Update #1:

sentences:
Animation reset in libgdx i have an issue that i hope it's easy to resolve.
I'm playing various animations in my libgdx-created game.

For a particular animation, i need that to play in loop mode but only if a particular condition is true. Simple this far.

What i need is to "reset" the animation (i mean restart from sprite n°1) when the condition become true again after the animation stopped.
I know that i can simply dispose the actual animation and create another one every time the condition is true, but this seems a complicated way to resolve this..

How do i change the value of the index used by that animation? Is it possible?
Do i have to create a class that extends the Animation class from libgdx library?

sentences:
How can I avoid texture stretching when adding high-resolution support via a mod? I am currently working on recreating the game engine for an old game (Sacred) using the original game assets I reversed-engineered the formats of.

The game had a fixed 1024x720 resolution, and I'm planning to support higher resolutions. How can I support them without having to stretch textures? I am hoping for results like D2MultiRes mod (Diablo 2) or G3 widescreen mod (Infinity Engine games) achieved.

sentences:
Canvas Drag and Drop children within parent I have a working drag and drop script for gameobjects within a canvas panel.
I would like to prevent the panels children from being dragged outside of the panel.
I have a somewhat working (although very ugly) way to do this but it fails when the children of the panel are various different sizes they tend to come off the panels edges slightly depending on how large they are.
Here is my drag and drop script that is attached to the children of the panel:
public class DragAndDrop : MonoBehaviour
 {

     private bool isDragging;

     public void OnMouseDown()
     {
         isDragging = true;
         PlayerController.Instance.currentObject = gameObject;
         GameObject sceneController = GameObject.Find("SceneController");
         sceneController.GetComponent<SceneController>().enableEditor();
     }

     public void OnMouseUp()
     {
         isDragging = false;
     }

     void Update()
     {
         if (isDragging)
         {
             Vector2 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;

             transform.Translate(mousePosition);

         } else
         {
             if (transform.position.x <= -3f)
             {
                 transform.position = new Vector3(-3f, transform.position.y, transform.position.z);
             }
             if (transform.position.x >= 3f)
             {
                 transform.position = new Vector3(3f, transform.position.y, transform.position.z);
             }

             if (transform.position.y <= -4.5f)
             {
                 transform.position = new Vector3(transform.position.x, -4.5f, transform.position.z);
             }
             if (transform.position.y >= 3f)
             {
                 transform.position = new Vector3(transform.position.x, 3f, transform.position.z);
             }
         }
     }
 }

Any help would be greatly appreciated, thanks for your time!

sentences:
How do I letterbox a C#/Monogame viewport within a resizeable window? I am making a 2d game with xna/monogame. I want the main view area to always show 15x15 tiles, or 480x480px.

I've got something that sort of works, following this guide. It expands the view range if you make the window smaller. However, it works somewhat properly if you expand it. It works as intended if the window is maximized.

I want the range of what is rendered to be no larger than 480px x 480px regardless of the the window's size, but I'd like the sprites to appear bigger if the window resolution is set larger (and conversely).

sentences:
How do I pause and unpause gameobjects on is own in the scene without pressing keys in unity3d I can't get my gameobject to pause or unpause in the scene in Unity3d.
I need the game to pause for a couple of seconds maybe longer than unpause
 by itself. Here is my script :

using UnityEngine;
using System.Collections;

public class hu : MonoBehaviour {
GameObject[] pauseObjects;
public bool isPaused;
 void Start () {

 pauseObjects = GameObject.FindGameObjectsWithTag("Player");

 }

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

  {
   if(Time.timeScale == 1)
   {
    Time.timeScale = 7f;

   } else if (Time.timeScale == 8f){

    Time.timeScale = 1;

   }
 }
}
}

sentences:
Which input event is suitable for this game? I am trying to clone this game:

http://www.ferryhalim.com/orisinal/g3/bells.htm

As i am using libgdx, so the game is both for Android and PC. I was wondering which input event would fit in nicely. SA you can see, bunny moves in accordance with the position of cursor. There is no cursor in android so i will have to do something different. Any help would be appreciated. Thanks in advance.

sentences:
Javascript game to Phonegap for android game? me and a friend of mine are in the process of building a javascrip/HTML5 game and I'm running into a few questions about the process of using converting it to an android game. I plan on using Phone gap as it appears to be fairly simple and does what I'm looking for it to do. I've done a little research, but there is still a few questions I have about the whole process.

Can I run the app offline? I want to be able to post the app to app store and allow people to download and play offline. Given the fact there will be no server requests can I make the game function offline?
As I make the game for the computer I'm relying on the keyboard as input to move around. Obviously, once I port it to mobile this won't be practical. What is the easiest way to go about doing this? I'm considering simply changing the game to have a click on screen which moves the character to that location or even a simple movement pad in the corner of the screen. Would these on screen clicks change correctly over to mobile.
Lastly, what is the easiest way to handle save data. On the computer side I plan to use HTML5 local storage to store game data. Does this convert to mobile or is there a better way?

I appreciate any help in this matter.

sentences:
Unity seperation of prefabs with two dimensional terrain generation I have the following function:

public void Spawn ()
        {

                GameObject g = ((GameObject)Instantiate (hills [Random.Range (0, hills.Length)], new Vector3 (0.0f, transform.position.y, transform.position.z), Quaternion.identity));
                g.transform.position = new Vector3 ((subs [subs.Count - 1].transform.position.x + (g.renderer.bounds.size.x) + (subs [subs.Count - 1].renderer.bounds.size.x) / 2), transform.position.y, transform.position.z);
                g.transform.parent = this.transform;
                NonLoopingScrollScript nls = (NonLoopingScrollScript)g.GetComponent ("NonLoopingScrollScript");
                nls.Setup (movSpeed, 0.0f);
                subs.Add (g);

        }

Which is being used to spawn terrain, the way this works is I have an array(hills) which is composed of a bunch of prefabs which together will make up terrain in the background of the game. This function is what actually instantiates the next prefab when it is needed, this prefab is then added to a list (subs). My problem is simply the spacing between the prefabs as I would like there to be no space, yet sometimes the objects overlap or there is a gap between the prefabs.

Explanation of code: In the first line I instantiate a random prefab with the argument:

hills [Random.Range (0, hills.Length)]

The next argument is where I am having trouble, what I am currently doing is setting the x value of the new prefab to the x value of the transform plus half the x width of both the previous prefab, and the new prefab. This is the issue as the spacing is not as desired. Then i simply set the y and z value to that of the spawner object and the rest of the code is irrelevent, save for where at the end of the function I then add the new gameobject to the end of the list.

I hope this was clear, if not please do not hesitate to ask questions.

Edit: The seperation of the prefabs works fine when there is only one type of prefab, but when I have several it doesn't. Here is an image of what I mean:

sentences:
How does one write to another process's OpenGL/DirectX context? I want to write a short of chat client that display the messages in-game (OpenGL/DirectX), but I really don't know how to handle this.

It is easy to write my client in my graphic context... but what about the other game-apps context?.

My primary target is Windows and Win 7, then mac, then Linux. But I would be happy to solve it for Windows.

By the way, it should try to be the most compatible with different DX versions and OGL versions.

sentences:
I try to recreate a plasma gun from halo into my fps game this is my code:
public class WeaponTest : MonoBehaviour
{
    public float weaponHeat;
    public float weaponOverHeat = 100f;
    public bool weaponIsOverHeat;

    // Start is called before the first frame update
    void Start()
    {
        //weaponHeat at the start was 0
        weaponHeat = 0;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetButton("Fire1") && !weaponIsOverHeat)
        {
            if (weaponHeat < weaponOverHeat)
            {
                Weapon_Shoot();
                weaponHeat = IsHeating();
            }
        }
    }

    float IsHeating()
    {
        weaponHeat += Random.Range(5f, 10f);
        return weaponHeat;
    }

    void Weapon_Shoot()
    {
        RaycastHit hit;
        if (Physics.Raycast(playerCam.transform.position, playerCam.transform.forward, out hit, range))
        {
            // code for damaging the enemy
        }
    }
}

the shoot method was function exactly like what is want but I need the cooldown method I already try a few them but it not work exactly like I want. the I idea was went the left mouse was click the weapon heat will increase and when the left mouse was not been click the weapon heat will decrease until it reach 0. I hope you can help me solve this problem

sentences:
How do I run code for a period of time and then return to normal behavior? i wanna run a code for my special power for five seconds only and then return to my normal working. when that power activates i am changing my player's material and i wanna return to my old material after those five secs are over. this is the code i tried:

void Start () {

        transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
    }

    void Update () {

        if (condition) {
            for (int t1 = 0; t1 < 5; t1 += (int)Time.deltaTime) {
                transform.GetComponent<Renderer> ().material = mats [0];
            }
            transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
        }
    }

this code breaks the game i think because unity is freezing when the condition is being met.

sentences:
Is it worth learning XNA now? Possible Duplicate:
  What is the future of XNA in Windows 8 or how will manged games be developed in Windows 8?

It's no secret XNA's future is uncertain. Windows 8 only supports XNA desktop applications and not metro style apps. A number of 'rumors' are going around concerning Microsoft no longer supporting XNA after 4.0.

Despite this, do you believe it's worth picking up XNA now?

sentences:
MonoGame sprites not consistently drawing Please don't mark this as a duplicate of my previous question which was asked anonymously. this is a reattempt because i cannot edit the first attempt.

What I have so far is:
- randomly generated tile set with items on SOME tiles
- one creature spawner that spawns up to 5 creatures which can be controlled by the player
- the ability for creatures to pick up items and bring them back to the spawn and store them for later use

What I am noticing is when i launch the game, it doesnt always show all the sprites. Sometimes the spawner is missing, or the creatures, or the GUI. ANd when things DO appear, if i tell the creatures to pick up anything, other items on the ground randomly appear and disappear. even the spawn sometimes disappears! what I do notice is that when i have multiple creatures, some will disappear when crossing invisible lines but not all of them. i forced two creatures to go east at the same speed and time, and one vanished and the other didnt.

If you have any ideas as to what might be causing this, please let me know. if you have any questions, i'll try to edit to appease you.

thanks for reading!

I have my draw method like this:

GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here

spriteBatch.Begin(SpriteSortMode.BackToFront,
          null, null, null, null, null,
          camera.GetTransformation());

worldEntity.Draw(spriteBatch);

guiManager.DrawGUI(spriteBatch);

spriteBatch.End();

base.Draw(gameTime);

for the world entity...
its draw method systematically goes through each tile in the world and calls its draw method.
the tile draws itself using

Vector2 topLeftOfSprite = new Vector2(this.X, this.Y);
Color tintColor = Color.White;
spriteBatch.Draw(tileTexture, topLeftOfSprite, tintColor);

and then proceeds to call the draw method of any items on it.

creatures and items have very similar draw methods.

the gui also draws itself in a similar fashion.

what i DO notice is that ive NEVER seen ground tiles vanish, only the items on them or creatures in the world. Could it be their Z isn't set appropriately?

sentences: JMonkey scrolling 3D text I need to make a scrolling 3D text, which is not a gui. I have a 3d box display over which I should render a long scrolling text. I can render and move text, but how do I cut/make invisible the part that goes out of the display area?

sentences:
Find shortest path (quickly) on the surface of a 3d model? Imagine this scenario:
we have a 3d model, for instance a doughnut, apple or an orange (possibly something more complex). There's an insect (let's say an ant) on the surface of that food item. Now that ant wishes to reach a certain specific coordinate embedded on the surface of the 3d object in the shortest time possible (using the shortest path, ignoring physics).

Now the ant AI could use Dijkstra on the original mesh but that might be low-res so the ant will zig-zag on the surface, outlining the shapes of blocky faces. You could split the faces but the angular nature of the edges, making up the structure of the mesh will continue to drive the ant to more in ziggy-zaggy like manner (imagine a rougelike with very small squares, you can still only move in 8 directions at any given point).

What we did is split the edges (of the model) to evenly-sized pieces and embedded "navigation vertices" between these pieces, we then connected the vertices of each edge with vertices of other edges sharing a face with it (4 other edges because faces are triangular). This works pretty well cause it means the any can travel freely between faces, ignoring their shape almost completely (unless they are very small and were not split).

We also have the ant "pulled" (dragged even) by an imaginary ant that is a few steps ahead to completely eliminate the more rigid areas in the path (think sharp corners). Sounds great right?

But this is not terribly fast. Any advice about that is appreciated.

sentences:
Switching from OpenGL ES 1.0 to 2.0 I have been developing an Android app using OpenGL 1.0 for quite some time using a naive approach to rendering, basically making a call to glColor4f(...) and glDrawArrays(...) with FloatBuffers each frame.  I am hitting a point where graphics is becoming a huge bottleneck as I add more UI elements and the number of draw calls increases.

So I'm now looking for the best way to group all of these calls into one (or two or three) draw calls.  It looks like the cleanest, most efficient and canonical way to do this is to use VBO objects, available from OpenGL ES 2.0 on.  However, this would require a HUGE refactoring on my part to switch my whole graphics backend from ES 1.0 to ES 2.0.  I am not sure if this is a good decision, or if there are acceptable ways to group my drawing calls in 1.0 that would work fine for relatively simple 2D data (squares, rounded rectangle TRIANGLE_FANs, etc.), or if it really might be worth biting the bullet and making the switch.  I might also mention that I have a HEAVY reliance on translation and scaling that is so convenient with the fixed pipeline of ES 1.0.

Looking around, I am surprised to find almost NO people in my position, talking about the tradeoffs and complexity at hand for such a switch.  Any thought?

sentences:
Finding the Dimension of OBJ objects I am having a Three OBJ file , Cone , Sphere and Cube. How can i find the dimension of these objects , so that i can use it in my collision detection class.

i.e How can i find Radius , Length of Cube and Radius and Height of cone.
Or is there any better way for collision detection , I have Hundreds of random particle in my game which may or maynot collide with these objects.

sentences:
How does Minecraft compute lighting for it's non-block objects? I was wondering how the creator of Minecraft went about lighting the objects (player and pickaxe) based on the lighting level around the player. I have implemented the ability to light the blocks around the player but I can't really think of anyway to implement with objects. Also, when I the player moves and the lighting values change will I have to rebuild it's vertexbuffers? Or is there some other way?

Any ideas?

sentences:
Deciding when to switch focus between UI elements I've been coding a simple logic game recently and there is a UI decision that has been bothering me.

Since certain blocks of logic are going to be used across many levels (e.g. logic to reverse the input queue) I decided to add a template feature, allowing the user to name and save blocks of logic.

As it stands, I simply have a text field in which to enter the template name. While the game is primarily played with the mouse, some keys are used as controls (w, a, s, d, space, delete). This creates the requirement of deciding when to take focus away from the text field. Some decisions are obvious (e.g. when the user presses the New Template button and the template is created) but others, not so much. For example, the user clicks the text field, then decides not to create a template.

While one option is to simply pop up a dialog and remove the text field from the main UI altogether, I was trying to avoid this. Does anyone have any thoughts on what would be a good trigger for taking focus away from the text field? Or do you think I should just drop the field and go with the dialog?

sentences:
Why is it Important to have render targets with the same bit size? I am currently thinking of what type of GBuffer I'll need for deferred shading, hence I tried also to document myself online about the most common ones and their format.

Most of the GBuffer that I've seen used the same bit size for each render target, leading also often to unused channels. However, as first guess for my GBuffer, on paper, I need two 24 bit targets and two 32 ones or three 24 and one 32.

I understand that having the same "size" each attachment can be aligned better, but practically speaking is it better to waste channels (or reserve them for future use) and having all the RTs of the same size or I should use just what needed? In the former case, why it is such advantage, will the 24 bit ones be padded to 32 anyway?

sentences: What is the value of gameTime.ElapsedGameTime.TotalSeconds? I was wondering what is exactly the value of gameTime.ElapsedGameTime.TotalSeconds in a second? Please explain it to me completely and as great as you can.

sentences:
Unity profiler spikes with vsync vs smooth no vsync I'm trying to profile my game, this is a webgl game, and the browser forces vsync.

My problem is, when I disable vsync in unity I get a pretty smooth profiler, while with vsync I get huge spikes.

I cant tell if this is an editor issue or this spikes exist in the webgl version as well (I do have stuttering when playing in the browser, but cant tell if these spikes are the same ones)

I don't display the WaitForTargetFPS in profiler as it is not interesing.

no vsync:

with vsync:

Any ideas friends?

sentences:
How to prevent corner slipping with a shortest axis collision solver Currently I use AABB's to represent objects in my game engine, I resolve collisions between them by finding the shallowest axis, but this leads to a problem if an object is approaching another in a way that their corners would collide at a fast velocity, they will slip past each other and resolve on the wrong axis because one penetrated too deeply, for example:

We can see that the red square is approaching the green rectangle. They intersect and the solver sees that the smallest intersection is on the Y axis

Thus they sepparate on the Y axis, and the red square flies by the green rectangle, when it should have stopped on the left edge

I'm currently at a loss on how to solve this, any sugestions or fixes would be greatly appreciated!

sentences:
Generating 'Specially' shaped rooms for a Dungeon I've made a fairly simple dungeon generator but now I want to expand on it so that I can procedurally generate a dungeon with irregular shaped rooms. I don't just want any old crazy shapes popping up though, I want to be able to have room types that follow a certain pattern but ultimately have random sizes. I just don't have a clue how to generate rooms that aren't just square.

I have an idea of how to merge squares together to make rooms comprised of other rooms, but I'm more interested in how to get hexagon and octagon shaped rooms, or doughnut-like rooms.
My code for generating square rooms is:

    public static char[,] GetSquareRoom(int width, int height)
    {
        char[,] roomLayout_Square;

        roomLayout_Square = new char[width, height];

        for (int x = 0; x < roomLayout_Square.GetLength(0); x++)
            for (int y = 0; y < roomLayout_Square.GetLength(1); y++)
                if (x == 0 || y == 0 || x == width - 1 || y == height - 1)
                    roomLayout_Square[x, y] = '#';
                else
                    roomLayout_Square[x, y] = '.';

        return roomLayout_Square;
    }

I would like to create more functions like this that will accept a few variables so I can create specific variations of these room-types, so I can input specific number and randomly generated values alike.

:)

sentences:
Should cooldown be time or tick based? In the past I've done cooldowns as a specific time in ms, but I was thinking isn't having tick based cooldowns better. This would be more accurate and efficent(not sure).

The bad side I can think about is that if the tick rate is increased, it would affect the game logic. While having a base update rate and a multiplier(that can be applied to everything that is tied to tick rate) would probably fix this, I am not sure if this is a good approach.

sentences:
How can I factor momentum into my space sim? I am trying my hand at creating a simple 2d physics engine right now, and I'm running into some problems figuring out how to incorporate momentum into movement of a spaceship.

If I am moving in a given direction at a certain velocity, I am able to currently update the position of my ship easily (Position += Direction * Velocity).  However, if the ship rotates at all, and I recalculate the direction (based on the new angle the ship is facing), and accelerate in that direction, how can I take momentum into account to alter the "line" that the ship travels?  Currently the ship changes direction instantaneously and continues at its current velocity in that new direction when I press the thrust button.  I want it to be a more gradual turning motion so as to give the impression that the ship itself has some mass.

If there is already a nice post on this topic I apologize, but nothing came up in my searches.  Let me know if any more information is needed, but I'm hoping someone can easily tell me how I can throw mass * velocity into my game loop update.

sentences:
Android: Make game look the same on all devices I'm trying to get my android application to look the same on all screen devices. I assume I have to do something regarding the density, I just can't figure it out. And while I have seen very similar questions to this I'm not getting clear answers or I'm just not understanding things resulting in inconsistent results.

So how do I get, for example, my game to look exactly the same on a Samsung Galaxy 7 as on an LG tablet?

Side note: I have looked into scaling the Canvas but can't quite figure out how to do this correctly.

Example

package com.haas.ryan.example;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

/**
 * Created by Ryan on 8/4/2017.
 */

public class Drawing extends SurfaceView implements SurfaceHolder.Callback {
    private Rect rect;

    public Drawing(Context context) {
        super(context);
        getHolder().addCallback(this);
        rect = new Rect(100, 100, 500, 500);
    }

    public void surfaceCreated(SurfaceHolder sh) {
        Canvas canvas = sh.lockCanvas();
        draw(canvas);
        sh.unlockCanvasAndPost(canvas);
    }

    public void surfaceDestroyed(SurfaceHolder sh) {}
    public void surfaceChanged(SurfaceHolder sh, int format, int w, int h) {}

    public void draw(Canvas canvas) {
        super.draw(canvas);
        System.out.println("call");
        Paint p = new Paint();
        p.setColor(Color.RED);

        canvas.drawRect(rect, p);
        invalidate();
    }
}

Device 1 Screenshot

Device 2 Screenshot

While it's a lot harder to tell on the emulator (my bad I chose 2 phones, should'be chosen a tablet) you can see that the rectangles don't take up the same amount of relative space. In fact on the larger screen the rectangle is actually smaller.

sentences:
GLM: Euler Angles to Quaternion I hope you know GL Mathematics (GLM) because I've got a problem, I can not break:

I have a set of Euler Angles and I need to perform smooth interpolation between them. The best way is converting them to Quaternions and applying SLERP alrogirthm.

The issue I have is how to initialize glm::quaternion with Euler Angles, please?

I read GLM Documentation over and over, but I can not find appropriate Quaternion constructor signature, that would take three Euler Angles. The closest one I found is
angleAxis() function, taking angle value and an axis for that angle. Note, please, what I am looking for si a way, how to parse RotX, RotY, RotZ.

For your information, this is the above metnioned angleAxis() function signature:

detail::tquat< valType > angleAxis (valType const &angle, valType const &x, valType const &y, valType const &z)

sentences: What does cache mean? I'm kinda new to the programming scene. I'm still a high school student but I want to be a game designer so I'm studying independently before I graduate to get an edge. The issue with this is that although I have learned some programming, I can't follow all of the technical terms that get thrown around on the game dev forums. One of the terms that gets used a lot is cache, and I'm wondering what that means. Outside of programming it means a secret stash of something you don't want others to know about, which could be referring to things like AI, login info or, something like that. I would like a more specific answer if anyone would be willing to give the time.

sentences:
Game Design Patterns ( think GOF ) literature? Possible Duplicate:
  What are some programming design patterns that are useful in game development?

Is there any literature on game design patterns? I'm taking a software design class and would like to learn how some of these design patterns would apply to game development.

sentences:
Best way to use Raknet from C#? I am trying to learn Raknet with C# and I found it extremely confusing.

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

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

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

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

The following information would also be very helpful:

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

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

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

sentences:
How to move a line of sprites in a sine wave? So, I'm spawning a horizontal line of enemies that I would like to have move in a nice wave.  Currently I tried:

 Enemy.position.X += Enemy.velocity.X;
 Enemy.position.Y += -(float)Math.Cos(Enemy.position.X / 200) * 5;

This...kind of works.  But the wave is not a true wave.  The top and bottom of one pass are not the same (e.g. 5 for the top, and -5 for the bottom (I don't mean literal points, I just meant that it's not symmetrical)).

Is there a better way to do this?  I would like the whole line to move in a wave, so it looks fluid.  By that, I mean that it should look like each enemy is "following" the one in front of it.  The code I posted does have this fluidity to it, but like I said, it's not a perfect wave.

Any ideas?

Thanks in advance.

sentences:
HDR bloom techniques using post processing in Unity3D I've seen many posts on how to accomplish HDR bloom effects in Unity3D using its (now legacy) Bloom component as part of the standard assets package.

I'm trying to replicate it using the new post processing package, but I can't seem to get it to work.

I have an an emissive material that's emitting at a value far >1 sitting at 10:

Bloom is set in a Post Processing Profile, and the threshold is >1:

Finally, HDR is enabled on my camera, along with a deferred rendering path.

Yet this doesn't work. I only see the bloom effect if I set my bloom threshold <1, after which all my materials bloom. It's as if HDR is not actually enabled. Anyone know why?

sentences:
How is background of 2.5d games developed When I say 2.5d games, I mean like this:

Bloodstained Ritual of the Night DEMO gameplay

My question is, I know the characters and platforms are 3d but are the backgrounds all 3d as well? Even if its not interacted on in any way? Like for example, at 10:45, did the developer(s) make models of the cannons at the background? Or 48:30, did they model the houses?

For context, I'm starting a hobby project game in 2.5d and I'm trying to get an idea on how I would develop the backgrounds.

sentences:
graphical interface when using assembly language I want to learn a framework to use in assembly. I know that's not possible without learning the framework in C first. So I'm thinking of learning SDL in C and then teach myself how to interpret the program and run it as assembly language code. Then I will have a window and some graphics routines to display the game while using assembly to code everything in. I need to spend some time learning SDL and then some more time learning how to code all those statements using assembly while calling C functions and knowing what registers returned calls use and what they leave etc.

My question is, is this a good way to go or is there something better to get a graphical window display using assembly language?

sentences:
How do I consolidate the differences between iOS and Android update loops? I'm currently working on moving some Android-ndk code to the iPhone.

From looking at some samples it seems that the main loop is handled for you and all you've got to do is override the render method on the view to handle the rendering. Then add a selector to handle the update methods. The render method itself looks like it's attached to the windows refresh.

But in android I've got my own game loop that controls the rendering and updates using C++ time.h. Is it possible to implement the same here bypassing Apple's loop? I'd really like the keep the structures of the code similar.

sentences: Is there any different between these 2 command? I came across this question on stackoverflow https://stackoverflow.com/questions/17147553/int-num-new-int-what-happens-when-this-line-executes . Wonder if there is any difference for sprite and spriteRender in unity between both of these commands sprite y=new sprite() and sprite y; or SpriteRenderer x=new SpriteRenderer() and SpriteRenderer x;? I tested in unity, both commands also generate the same option to attach game object, so do both have the same meaning as well?

sentences:
Enable SteamVR hand collision for when holding objects Just getting started on a game project with SteamVR in Unity. I've run into an issue with the collisions though. The hands and the objects that can be held collide with everything in the scene as they should. But when an object is picked up, the hand and the object stop colliding with everything.

How would I go about fixing this? I could leave it as is, but if an object is let go of inside another, it gets flung out of the object it was inside.

The other odd behavior happens after you let an item go. The hand that was holding it continues to not collide with anything until you move the hand away. After that it'll collide with everything normally again.

sentences:
how to set volume of sound depending on the impulse a body receives in Libgdx / Box2d? I am trying to set the volume of a bouncing sound of a ball depending on how hard the ball hits something. so the harder the ball hits a wall or a ground the more loud the bounce sound.
I couldn't find anyway to get the impulse of a body other than the postSolve(Contact contact, ContactImpulse impulse)  method inContactListner class.
But i then realized that unlike the beginContact(Contact contact) method, postSolve(Contact contact, ContactImpulse impulse)  gets called repeatedly until the contact ends. so it repeatedly plays the bouncing sound making it sound stalked and buggy.
I cant use the beginContact(Contact contact) method because there is no way to get the impulse that the ball is receiving from this method. I tried to to use the velocity of the ball instead of impulse inside beginContact(Contact contact)but that didnt yield good results and found it very complicated as i had to consider both horizontal and vertical speeds.
so my question is how can I make the sound play only once if i am using the postSolve(Contact contact, ContactImpulse impulse)  method or is there any other solution to achieve what i am trying to do here?

sentences: What makes a path finding heuristic Monotonic vs. Non-monotonic? I am currently working on an algorithm that solves a path through the maze. So far I have implemented a Manhattan and Pythagorean Heuristic. I was wondering what makes a heuristic monotonic and how would one go about making a heuristic non-monotonic.

sentences: Does the Facebook app need to be installed to use Facebook for Game Developers? I just learned about Facebook for Game Developers. I would like to know if I need to have the Facebook app installed in my phone to use Facebook for Game Developers (like I need to install Google play games services in android).

sentences:
Why should I always consider creating and using object pools instead of instantiating the new object on the fly? I have read about this pattern several times (from a best-practices perspective):

  Memory Allocation: Instead of instantiating the new object on the fly, always consider creating and using object pools. It will help to less memory fragmentation and make the garbage collector work less.

However, I don’t know what it actually means. How can I implement it?

For example, I can instantiate a GameObject using the Instantiate method of Unity?

Instantiate(prefab, new Vector3(2.0F, 0, 0), Quaternion.identity);

Is this use discouraged? What else can it mean?

sentences:
Predicted target location I'm having an issue with calculating the predicted linear angle a projectile needs to move in to intersect a moving enemy ship for my 2D game.

I've tried following the document here, but what I've have come up with is simply awful.

protected Vector2 GetPredictedPosition(float angleToEnemy, ShipCompartment origin, ShipCompartment target)
{
    // Below obviously won't compile (document wants a Vector, not sure how to get that from a single float?)
    Vector2 velocity = target.Thrust - 25f; // Closing velocity (25 is example projectile velocity)
    Vector2 distance = target.Position - origin.Position; // Range to close
    double time = distance.Length() / velocity.Length(); // Time

    // Garbage code, doesn't compile, this method is incorrect
    return target.Position + (target.Thrust * time);
}

I would be grateful if the community can help point out how this is done correctly.

EDIT

Here is my (working) method following the advice given:

protected Vector2 GetPredictedPosition(ShipCompartment origin, ShipCompartment target, Ship enemyShip, Ship firingShip)
{
    Vector2 targetVelocity = enemyShip.Direction * enemyShip.Thrust;
    Vector2 projectileVelocity = firingShip.Direction * 25f;

    Vector2 velocity = targetVelocity - projectileVelocity; // Closing velocity
    Vector2 distance = target.Position - origin.Position; // Range to close
    double time = distance.Length() / velocity.Length(); // Time

    return target.Position + new Vector2(Convert.ToSingle(targetVelocity.X * time), Convert.ToSingle(targetVelocity.Y * time));
}

sentences:
Smooth input handling in Java I am writing a Java game.

My problem is to get a really smooth input. If I hit the key W the character has to go forwards, but if I hit A and release the W key, the character doesn't go left ways :( .

It isn't smooth. Which ways are given in common game developing for a smooth input?

My current source code
(Input.java): http://pastebin.com/9Z9qtXik
(MainLoop.handlingInputs): http://pastebin.com/Vx8BzSpL

sentences:
XNA C# Adding objects to List in another class Hi all i started creating this XNA/C# version of Space invaders to get better at xna since i've only been using it for about 4 days.

I've managed fine till now..

So my problem is adding my Bullets to a List in another class.
So i've tried working out the solution for about 3 hours now and i hope you guys can help me.

In the Player.cs class i've got a method FireBullet() wich should create a new Bullet.cs class and add it to the list in Game1.cs (it does not do this when you debug) in theory this should work(i think).

Linking all the corresponding classes will take too much room so i've uploaded it to github

https://github.com/Breinss/Space-Invaders-XNA-C-

says C in title ran out of character ment to be C# ^^

Thanks in advanced!

sentences: Unity Method count exceed the limit of 64K I just got an issue related to a 64k method in Unity so that's why I'm unable to build my project. It shows method limitation exceed the limit of 64k method count. So can anyone here help me out to resolve this issue?

sentences:
How to design programatically a game map like Risk? I'm making a quiz-game based on map territories with a system similar to the Risk game (except there are no tanks but tickets).

The map isn't the world but a custom map that I designed and I'll finish in the future, I just made the logic links among territories.

There are 10 territories who represent 10 different matters. The game I'm developing is for Android (Java), but I'm writing a prototype of the map in C# with Visual Studio to see if the idea of the map is good.

Now, I'm not asking for C# code to use in my app, I'm asking for a programming strategy I should use to implement my map in Code.

I wrote the class Zone to define each territory. I also wrote the class GameMap which implements 10 different Zones.

In the game logic, it's expected that just as risk, to attack 1 territory, you must have one near it. How can I implement at best this concept, of near and far territories in a dynamic and not long-static way?

The final result of what I want would be: I decide which territory attack in order to my owned territories. How can I proceed being as much as dynamic as I can and not write really long and in-efficient code?

EDIT: I'm no more looking for C# help. I'm directly implementing the map in Java and Javascript in both Client and Server sides.

sentences:
LWJGL: loading textures of various types I googled around a bit and nobody seems to have asked this question.

I have images in multiple color formats (all of them are PNGs).  Most of them are ARGB but my bitmap fonts are gray scale, and I would like them to stay that way.  All I want to do is find out what format BufferedImage uses to store my pixel data and then use that information with glTexImage2D.  Java, in all its wisdom, seems to be determined to hide that information from me at all costs...

I also need to know how BufferedImage aligns its pixel data in both of these formats (glTexImage2D cares).

Could someone please tell me how to:

Determine the pixel format of my BufferedImage.  If it is ARGB32, I'm going to have to reorder the bytes and use GL_RGBA.  If it's grayscale, I will be using GL_INTENSITY.
Extract the actual bytes from the image.  I have seen a few examples on the web that use BufferedImage.getRaster().getDataBuffer().  This is nonsensical.  Why are there different types of buffers like DataBufferInt?  Because of Java's strong typing, I need DataBufferByte.  If this is the only way, could somebody give me specific directions to use the different type of buffers with glTexImage2D?
Figure out how the aforementioned image data is aligned.  I will use this information with glPixelStorei.

In addition, I come from C and C++ programming.  In C this was 100 lines of simple libPNG and GL calls.  Should I expect more trouble like this in the future?

sentences:
Why Unity Navmesh codes should be executed first? I'm trying to calculate path using NavMesh.CalculatePath and use rigidbody alongside with it,
how ever if character does not stick to navmesh baked area the calculatePath codes will not work.
I also found that if my path finding codes does not run first the path finding will not work either.
for example:
void Update {   //path finding in this script will work
  PathFinding();
  GetDistance();

}

void Update {   //path finding in this script will NOT work
  GetDistance();
  PathFinding();

}

any help regarding to solving the problem or understanding how Unity navmesh system works will appreciated.

sentences:
Correct way to calculate Perspective Matrix I have seen at least 3 different ways to calculate the perspective matrix and I'm confused as to which one I should be using and what the differences are?

OpenGL says to do it this way:

f = cotangent(fov * 0.5)

f / aspect, 0, 0, 0
0, f, 0, 0
0, 0, (far + near)/(near - far), (2 * far * near)/(near - far)
0, 0, -1, 0

glm does it this way:

range = tan(fov * 0.5) * near;
left = -range * aspect;
right = range * aspect;
bottom = -range;
top = range;

(2 * near) / (right - left), 0, 0, 0
0, (2 * near) / (top - bottom), 0, 0
0, 0, (far + near) / (far - near), -1
0, 0, (2 * far * near) / (far - near), 0

sentences:
Retrieve the original prefab from a game object How would one proceed to retrieve the original prefab used for instantiating an object?

In the editor these two functions work :

        Debug.Log(PrefabUtility.GetPrefabParent(gameObject));
        Debug.Log(PrefabUtility.GetPrefabObject(gameObject));

But I need something that works in the release version.

I have objects that can be transported between scenes ands I need to save their data and original prefab to be able to instantiate them outside of the scene they have been originally instantiated.

ie:

Game designers create new prefabs.
Game designers create objects from prefabs and place them in scenes (50 to 150 scenes).
Game is played and objects are moved across scenes.
Game is saved and infos about objects which have moved are saved in the save streams (files or network).

This is where I got stuck. Currently, to palliate to the shortcomings, we're saving the name of the prefab in the prefab. But each time a prefab is moved, renamed or duplicated the string must be changed too, sometimes the objects created from the prefab keep the original name (game designer might have edited the prefabPath field).

Maybe there is a better way to achieve proper save games without having to access to the original prefab/name. But currently we keep the saves segmented on a per level basis (easier and safer to save/load to files and transfer the save games to/from servers)

sentences:
Video recording and editing for game promo video I would like to screen record a beta of an RPG I've created. The format will be narration over video with the ability to edit. It's an indie game I'm marketing, so the video quality and narration need to be semi-professional.

I'm curious as to which video production packages are of good enough quality to accomplish this without breaking the bank (free is the best!). If there are no good packages, then separate software recommendations for screen recording, editing, and narration would be helpful!

Notes:

I have a Mac
I would rather do video recording first, then narration later with an overlay
I've used Quicktime in the past, not sure if there was something better
This video is for my Kickstarter campaign

sentences:
Why is the sprite so offset from the physics body? I'm trying to make a sprite object that has physics, but once the game runs the physics body is drawn at an unknown offset from the sprite, which varies based on the size of the sprites texture.

Physics Sprite class:

public class PhysicsSprite extends Sprite {
World world;
public Body body;

public PhysicsSprite(Texture texture, World PhysicsWorld, float x, float y){
    super(texture);
    this.world = PhysicsWorld;
    setPosition(x,y);
    setOrigin(getX(),getY());
    InitializeBody();
}

private void InitializeBody(){
    BodyDef bd = new BodyDef();
    bd.position.set((getX())/GameMain.PPM,(getX())/GameMain.PPM);
    bd.type = BodyDef.BodyType.DynamicBody;

    body = world.createBody(bd);

    PolygonShape shape = new PolygonShape();
    shape.setAsBox(getWidth()/2f/GameMain.PPM,getHeight()/2f/GameMain.PPM);

    FixtureDef fd = new FixtureDef();
    fd.density = 1;
    fd.shape = shape;
    Fixture fixture = body.createFixture(fd);

    System.out.println(body);
}

private void updateSprite(){
    setPosition(body.getPosition().x*GameMain.PPM,body.getPosition().y*GameMain.PPM);
    setRotation((float)Math.toDegrees((double) body.getAngle()));
}

@Override
public void draw(Batch batch){
    updateSprite();
    super.draw(batch);
}
}

physics world/rendering scene class:

public class TestLevel implements Screen {
World world = new World(new Vector2(0f,0f),true);

OrthographicCamera camera = new OrthographicCamera(GameMain.WIDTH/GameMain.PPM, GameMain.HEIGHT/GameMain.PPM);
Box2DDebugRenderer debugR = new Box2DDebugRenderer();
PhysicsSprite s;
GameMain game;
SpriteBatch batch;

public TestLevel(GameMain g){
    game = g;
    batch = g.batch;
    s = new PhysicsSprite(new Texture("badlogic.jpg"),world,300,500);
}
@Override
public void show() {

}

@Override
public void render(float delta) {

    Gdx.gl.glClearColor(.4f,0.4f,.4f,1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.begin();
    s.draw(batch);
    batch.end();

    debugR.render(world,camera.combined);
    world.step(Gdx.graphics.getDeltaTime(),6,2);
}

@Override
public void resize(int width, int height) {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {

}
}

I've followed this tutorial and he mentions the sprite being offset but nothing occurs to him like whats happening here. I've tried to find someone with a similar issue but failed. Can someone help me out?

sentences:
Invalid coordinates returned by glutMouseFunc() I am using GLUT's glutMouseFunc() function to retrieve the coordinates of mouse clicks.  I want to move the object on that coordinate to another coordinate.  But when I click on the object the coordinates returned by glutMouseFunc() are different than the original.

windowWidth=1250;
windowHeight=1000;

void onMouse(int button, int state, int x, int y);

int main(int argc, char** argv) {

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE);
    glutInitWindowSize(1250, 1000);
    glutCreateWindow("OpenGL - First window demo");
    // ...
    glutMouseFunc(onMouse);
    // ...
    glutMainLoop();
    return 0;
}

void onMouse(int button, int state, int x, int y) {
    flag++;
    if (state != GLUT_DOWN && button!=GLUT_LEFT_BUTTON)
        return;

    GLbyte color[4];
    GLfloat depth;
    GLuint index;

    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_INT, &index);

    printf("Clicked on pixel %d, %d, color %02hhx%02hhx%02hhx%02hhx, depth %f, stencil index %u\n", x, y, color[0], color[1], color[2], color[3], depth, index);
    move();
}

Inside my render function i have set the window coordinates to 0,0 using glortho

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, windowWidth, windowHeight, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

If my object is at (550, 900), onMouse() reports it as (556, 650) while if I click on an object which is at position (375, 475) the onMouse() returns (376, 342).

Basically there is a huge difference between the value of y axis returned by the function.

How can i get the correct screen coordinates?

sentences:
Ball bouncing with box2d in libgdx I just started using Box2d and libgdx. I followed this tutorial, https://github.com/libgdx/libgdx/wiki/Box2d
And a ball would bounce if I run the following code I took from the tutorial.

// ...omit the rest of code
World world = new World(new Vector2(0, -10), true);
BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyType.DynamicBody;
bodyDef.position.set(100, 300);
Body body = world.createBody(bodyDef);
CircleShape circle = new CircleShape();
circle.setRadius(6f);
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = circle;
fixtureDef.density = 0.5f;
fixtureDef.friction = 0.4f;
fixtureDef.restitution = 0.6f; // Make it bounce a little bit
Fixture fixture = body.createFixture(fixtureDef);
circle.dispose();
// ...omit the rest of code

I'm wondering how I can make the ball bounce like a basketball or volleyball? It's like the ball movement is in a space, move so slowly. I changed some properties such as density or friction, but it seems box2d doesn't care of air friction, so nothing changed at all. Could you tell me how I can make the ball movement to be a basketball or such stuff?

sentences:
Anchor a health bar to a character/enemy I have a game I'm working on where the player can see the health bars of the player's avatar and other creatures in the game.  I want this health bar to always follow the character/creature around.  However, I can't figure out how to do this.  I thought having the position change when the respective object moved would do the trick, but apparently, it doesn't.  When watching the health bar's transform, however, it shows that it is moving with it's respective object but I don't see it on the game screen.  Can anyone explain how I go about accomplishing this?  Here's the Dropbox link to the project.

HealthBar Script

public class EnemyHealthBar:MonoBehaviour{
    public Texture2D healthBar;
    public Texture2D health;
    public Rect healthBarPosition;
    public Rect healthPosition;
    public GameObject monster;

    void Start(){
    }
    void Update(){
        transform.position = new Vector3(monster.transform.position.x, monster.transform.position.y, monster.transform.position.z);
        Debug.Log(transform.position);
    }
    void OnGUI(){
        GUI.DrawTexture(healthBarPosition, healthBar);
    }
}

Video of what's currently happening

Dropbox Link

sentences:
Spine, Dragonbones or Live2D for interactive 2D animation? I'm planning to make a game with some interactive 2D animation. For example, when the player holds mouse button, the character gradually pulls his bow, and releases it when the player releases mouse button. I think skeletal animation works better than frame-by-frame sprites for this purpose, right?
I googled for a while and it seems there are several tools can do that, like Spine, Dragonbones and Live2D. But I have no idea what's the difference and which one I should choose. Could you share your advice/experience on it? Also do they have API for Unity?
I'm have a bit programming experience with Unity, but I know nothing about 2D animation, so please bear with me if this question makes no sense.

sentences:
Unity UI circular clickable area I'm building some somewhat involved UI stuff using the Shapes vector package.
I need to be able to detect clicks on a circle, but also need to be able to click on things right next to that circle in all directions (it's a large circle).
I can limit the detected clicks to within the circle by simply using a square and checking distance of click from center of circle. But this still obscures clickable things behind the square but outside of the circle (in the corners of the square).
How can I detect those?
Thanks!

sentences:
Determine the bullet / particle reflection off of a circle in node js using SAT lib functions I can see how the calculation should occur from other examples such as: How to bounce a 2d point particle off of a circular edge.

But I could use some help with the specifics for my inputs given during a game loop that is progressing / moving the bullet each game loop tick, and then detecting and handling collisions.

I've tried to mock up an example nodejs script using the SAT lib
http://requirebin.com/?gist=4a5c208dc39d3c3be262abb05fa791a3
.. with the console logs tracing a few variables, including the output target vector.

My question essentially lies in understanding how I can use the SAT vector functions like dot() or reflect() to produce the reflection?

https://github.com/jriecken/sat-js#classes

Even pseudo code would help me understand what exactly the operation needed to determine the reflection point (not just the angle, but the bullets new target vector) given my inputs of a bullet x,y position colliding with and a circular wall.

sentences:
How to sync towers and enemies in Tower Defense? I'm going to build a tower defense (like) game.

In a heavy tower defense, it takes time to processing.

So, if i set a time interval, it costs interval+processing time so it's not fair.

If i make a processing unit run every 100ms and process all things, it'll be fair but it costs more. And this is not good for flying weapon(like bombs).

Any another way or just use 100ms process unit?

sentences:
Sound plays several times upon collision Upon collision, my sound effect plays several times. How can I fix this?

public Sprite charAlive, charDead;
public AudioClip popAudio;

void  OnCollisionEnter2D (Collision2D col ){

    if (col.gameObject.name == "dirtWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        AudioSource.PlayClipAtPoint(popAudio, transform.position);
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "gooWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "grassWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
}

IEnumerator Dead() {
//      AudioSource.PlayClipAtPoint(popAudio, transform.position); // PLAYS SEVERAL TIMES
//      AudioSource.mute(popAudio);
    yield return new WaitForSeconds(3/2);
            Application.LoadLevel ("untitled");
    // LOAD LEVEL RESETS EVERYTHING, MAKE LOAD CHAR INSTEAD?
}

sentences:
3D tilt angle for an arrow in archery game How can I calculate the angle of rotation/tilt of an arrow in 3D?

When I say angle I mean the angle the arrow takes when it flies through the projectile path.

I am using logic given in the below link to calculate the location in the 3D space

http://babek.info/libertybasicfiles/lbnews/nl130/proj3d.htm

and also OpenGL for rendering

sentences: How to create glowing line with andengine? today I have played this game and still wondering about this effect: when I touch the target, some lines will appear (as those yellow lines in the image). How could I create this effect in andengine. In more detail, I want to create effect lines like that, I have no clue about methods they used.

sentences:
How can I structure my ASCII terrain object? So I have this object which represents a simple ASCII "overworld". Note the code is broken, but it's for demonstration purposes...

var TerrainObj = {
    w: { name: 'water', glyph: 'w' },
    g: { name: 'ground', glyph: 'g' },

    terrain: [[w, w, w, w],
              [w, g, g, w],
              [w, g, w, w],
              [g, g, w, w]],

    generate_display: function(terrain) {
        ...
        Code that returns an array the same as terrain but containing
        the glyphs from the objects in terrain
        ...
    }
}

So as you can see, the object contains the data for different types of terrain cell, the overworld itself, and a method to covert the terrain info into an array of glyphs for printing to the screen. But of course the problem with this code is that in the terrain array, there will be an reference error to each object.

I want to be able to write out the terrain array without using more than a one-letter name, because presumably to get this to work I'd have to do something like

terrain: function() {
    var map = [[this.w, this.w, this.w, ...],
               ...
               ...
               ];
}

So is there a nicer way I can produce my "semantic" terrain layer that references objects but without me having to write lengthy references to them in my array declaration?

sentences: Unity: cg fragment shader processing array of points I need to write a fragment shader which would somehow be aware of N points that are in the scene and darken pixels based on their world coord distance to the points. I'm looking for a method that would be still suitable for mobile devices. I image I could pass the points as a texture but i'm stuck in figuring out how to effectively evaluate if a pixel is close enough to any of the N points (I know how to do this for 1 point, but for N without a loop?). Any ideas if this is doable in a performance efficient manner? All ideas are welcome. Thanks!

sentences:
Shadowmapping with multiple light sources I am using shadow-mapping to add shadows to my world.
Currently, I use one lightsource, which means I have to draw my world twice: once in the lightview, once in the camera view.
I want to add more light sources to the world, I want at least 2 sources, maybe 3 or 4.
My world geometry is large, roughly 1M triangles, so drawing them comes at a large cost.
Are there any shortcuts I can take to avoid drawing the geometry for every light source?
Would it be possible to write to multiple depth textures in a single pass? E.g. pass several lightview matrices to a vertex shader and somehow write several framebuffers in one go?
I am using OpenGL core profile.
What I've tried: I looked at Multiple Render Targets, but it seems that every attached buffer will share the same vertex transformation, which would not help in my situation: every light view has a different transformation.

sentences:
Why can't I swap fixtures on collision in Box2D? I'm trying to swap the fixtures associated with a body after colliding with a specific obstacle.

I can listen to the collision event by extending b2ContactListener. I tested it with a trace and it's working. My listener function in the main game class calls a Player method that makes the swap. But it's just not working.

The body is stored in public var _body:b2Body; in the Player class.

The method I'm calling goes like this:

public function changeFixture():void {
    var newShape:b2CircleShape = new b2CircleShape(1);
    var myFixtureDef:b2FixtureDef = new b2FixtureDef();
    // Here I set density, friction, restitution, etc... Not important now...
    myFixtureDef.shape = newShape;

    _body.DestroyFixture(_oldFixture);
    _body.CreateFixture(myFixtureDef);

    // I know the method is called because this works
    trace('Yay! I'm working!');
}

What might be wrong?

sentences:
I'm rotating an object on two axes, so why does it keep twisting around the third axis? I see questions come up quite often that have this underlying issue, but they're all caught up in the particulars of a given feature or tool. Here's an attempt to create a canonical answer we can refer users to when this comes up - with lots of animated examples! :)

Let's say we're making a first-person camera. The basic idea is it should yaw to look left & right, and pitch to look up & down. So we write a bit of code like this (using Unity as an example):

void Update() {
    float speed = lookSpeed * Time.deltaTime;

    // Yaw around the y axis using the player's horizontal input.
    transform.Rotate(0f, Input.GetAxis("Horizontal") * speed, 0f);

    // Pitch around the x axis using the player's vertical input.
    transform.Rotate(-Input.GetAxis("Vertical") * speed,  0f, 0f);
}

or maybe

// Construct a quaternion or a matrix representing incremental camera rotation.
Quaternion rotation = Quaternion.Euler(
                        -Input.GetAxis("Vertical") * speed,
                         Input.GetAxis("Horizontal") * speed,
                         0);

// Fold this change into the camera's current rotation.
transform.rotation *= rotation;

And it mostly works, but over time the view starts to get crooked. The camera seems to be turning on its roll axis (z) even though we only told it to rotate on the x and y!

This can also happen if we're trying to manipulate an object in front of the camera - say it's a globe we want to turn to look around:

The same problem - after a while the North pole starts to wander away to the left or right. We're giving input on two axes but we're getting this confusing rotation on a third. And it happens whether we apply all our rotations around the object's local axes or the world's global axes.

In many engines you'll also see this in the inspector - rotate the object in the world, and suddenly numbers change on an axis we didn't even touch!

So, is this an engine bug? How do we tell the program we don't want it adding extra rotation?

Does it have something to do with Euler angles? Should I use Quaternions or Rotation Matrices or Basis Vectors instead?

sentences:
Unity animations not playing where they are suppose to be Hello to all those Unity Developers out there, I am having a big issue with my game, what I am trying to do is to make a cutscene but when I change camera it just goes in a completely different spot.
There are no scripting errors and the only thing that I have on the camera (Blender model) is an animator component that plays the animation when the DCT (Drone, Camera, Thing) flies into the room.
Should I try to not equip the camera with the DCT model or should I remove the animator component?

sentences:
What would it take to program a game engine like the build engine My favorite games of all time are thanks to Ken Silverman's BUILD engine, The engine that brought us DukeNukem 3D, Shadow warrior and Blood. I've read a few articles on the build engine however I haven't found any good ones that go in depth. Ive been programming in C for 3 and a bit years now and am reading through many books every day, so I believe I have minimal skills needed to take on this task.

I was wondering what it would take to make my own "Build engine". What sort of mathematics do I need to learn/know, What books would you recommend, what sort of programming do I need to know (I.E low level programming with bitwise operators or any thing else). My current goal is not to make a game like Duke nukem 3D but to merely make a engine that supports things like sloped walls, translucency, wall and floor sprites etc.

sentences:
C++ property system interface for game editors (reflection system) I have designed an reusable game engine for an project, and their functionality is like this:

Is a completely scripted game engine instead of the usual scripting languages as Lua or Python, this uses Runtime-Compiled C++, and an modified version of Cistron (an component-based programming framework).to be compatible with Runtime-Compiled C++ and so on.

Using the typical GameObject and Component classes of the Component-based design pattern, is serializable via JSON, BSON or Binary useful for selecting which objects will be loaded the next time.

The main problem: We want to use our custom GameObjects and their components properties in our level editor, before used hardcoded functions to access GameObject base class virtual functions from the derived ones, if do you want to modify an property specifically from that class you need inside into the code, this situation happens too with the derived classes of Component class, in little projects there's no problem but for larger projects becomes tedious, lengthy and error-prone.

I've researched a lot to find a solution without luck, i tried with  the Ogitor's property system (since our engine is Ogre-based) but we find it inappropiate for the component-based design and it's limited only for the Ogre classes and can lead to performance overhead, and we tried some code we find in the Internet we tested it and worked a little but we considered the macro and lambda abuse too horrible take a look (some code omitted):

   IWE_IMPLEMENT_PROP_BEGIN(CBaseEntity)
     IWE_PROP_LEVEL_BEGIN("Editor");
       IWE_PROP_INT_S("Id", "Internal id", m_nEntID, [](int n) {}, true);
            IWE_PROP_LEVEL_END();
            IWE_PROP_LEVEL_BEGIN("Entity");
              IWE_PROP_STRING_S("Mesh", "Mesh used for this entity",
         m_pModelName, [pInst](const std::string& sModelName) {
           pInst->m_stackMemUndoType.push(ENT_MEM_MESH); pInst->m_stackMemUndoStr.push(pInst->getModelName());
           pInst->setModel(sModelName, false); pInst->saveState();
         }, false);
       IWE_PROP_VECTOR3_S("Position", m_vecPosition,
  [pInst](float fX, float fY, float fZ) {
    pInst->m_stackMemUndoType.push(ENT_MEM_POSITION); pInst->m_stackMemUndoVec3.push(pInst->getPosition()); pInst->saveState();
    pInst->m_vecPosition.Get()[0] = fX; pInst->m_vecPosition.Get()[1] = fY; pInst->m_vecPosition.Get()[2] = fZ;
    pInst->setPosition(pInst->m_vecPosition);
  }, false);
       IWE_PROP_QUATERNION_S("Orientation (Quat)", m_quatOrientation,
  [pInst](float fW, float fX, float fY, float fZ) {
    pInst->m_stackMemUndoType.push(ENT_MEM_ROTATE); pInst->m_stackMemUndoQuat.push(pInst->getOrientation()); pInst->saveState();
    pInst->m_quatOrientation.Get()[0] = fW; pInst->m_quatOrientation.Get()[1] = fX; pInst->m_quatOrientation.Get()[2] = fY; pInst->m_quatOrientation.Get()[3] = fZ;
    pInst->setOrientation(pInst->m_quatOrientation);
  }, false);

     IWE_PROP_LEVEL_END();
    IWE_IMPLEMENT_PROP_END()

We are finding an simplified way to this, without leading confusing the programmers, (will be released to the public) i find ways to achieve this but they are only available for the common scripting as Lua or editors using C#. also too portable, we can write "wrappers" for different GUI toolkits as Qt or GTK, also i'm thinking to using Boost.Wave to get additional macro functionality without creating my own compiler.

The properties designed to use in the editor they are removed in the game since the save file contains their data and loads it using an simple 'load' function to reduce unnecessary code bloat may will be useful if some GameObject property wants to be hidden instead.

In summary, there's a way to implement an reflection(property) system for a level editor based in properties from derived classes?

Also we can use C++11 and Boost (restricted only to Wave and PropertyTree)

sentences:
libGDX game crashes on Android without any mention of crash in logs No mention of any issue in process logs, an application just turns off during loading assets (~3% of all assets loaded). It works fine on desktop.

Only thing that seems related in global logs is this:

09-01 15:15:25.261 824-22928/? W/ActivityManager: Force removing ActivityRecord{911979f u0 xxx.xxx.xxx/.AndroidLauncher t664}: app died, no saved state

I suspect there might not be enough of memory, but why there is nothing in logs? I tried limiting JVM memory on PC to 512MB and it runs fine. But I am not entirely sure if this limit covers also native memory. Could that be the reason why it runs with limit set and yet crashes on a mobile device with 2GB memory?

sentences:
What are the performance implications of multiple windows with indivdual OpenGL contexts? For an engine I'm developing I've decided to allow users to set up multiple windows showing differing views of the same "world."  This is being developed using OpenGL (hopefully aiming for 3.2 core eventually if that affects the ansmer) and SDL 1.3.  The basic structure I've got set up is:

class Window {
    SDL_Window *sdl_window;
    SDL_GLContext context;

    Window(...) {
        sdl_window = SDL_CreateWindow(...);

        // Rest of the setup of world etc.
    }

    gl_init() {
        context = SDL_GL_CreateContext(sdl_window);

        // Set up initial OpenGL settings.
    }

    render() {
        SDL_GL_MakeCurrent(sdl_window, context);

        // Rendering the world.

        SDL_GL_SwapWindow(sdl_window);
    }
}

This all compiles and runs fine with the rest of the demo code I've developed so far, simply showing a pair of slightly offset views.  However, there's no really performance heavy stuff implemented yet.

Is this the correct approach to use?
Are there any major performance implications with switching the context twice (or more) a frame? (other than the expected double (or more) rendering occurring).

For example, does switching contexts force a flush of the graphics memory to the system RAM or something equally frame-rate killing?

Is there an alternative method  that would allow setting up two different viewpoints and rendering them in one pass?
If this is the best way to do it is there a way of sharing data between contexts?  I'm thinking once I switch to VBO's over display lists, if the views overlap in some way they should be sharing VBO's for that portion.

sentences:
adventure game architecture I would like to make an adventure type game functioning similarly to machinarium or broken sword. The only way I can think of doing this is to draw an image as a background on a canvas and use some animated sprites that moves around and responds to touches on the screen.

But having a runnable that keeps re-drawing the canvas seems like a waste of memory to me, especially when it comes to larger images like the background.

I'm pretty new to game development and canvas animations and I was wondering if anyone could point me in the right direction? What would be good training for an adventure type game?

sentences:
How to detect speed on collision The problem with OnCollisionEnter2d is that it only gets called when there is a collision but what I wanted is to get the current speed of object at the moment of impact until the object stops moving. So that I if the object stops moving after impact I will call another function.

void OnCollisionEnter2d(Collision2D collision){
   Debug.Log(speed); //problem this will only give the speed at the moment of impact
   if(speed <= 0){
     blah blah
   }
}

I also tried putting speed variable on the Update()

void Update(){
     var currentVelocity = player_rb.velocity;
     speed = currentVelocity.magnitude;
}

sentences:
Detect mouse click on a bezier curve's neighborhood I'm developing a game in HTML5 and JavaScript using Canvas API for drawing graphics. I want to detect if the user has clicked on a bezier curve which has the line width of 20 pixels (something like this one on the picture). I need to validate if the user has clicked on the area drawn by the curve (red and black).

I implemented such an algorithm for lines, but could not adapt it to quadratic and cubic bezier curves. So I need an algorithm that will compare the position of a point relative to a bezier curve which has the form of

$$ B(t) = P_0 (1-t)^2 + P_1 (1-t)t + P_2t^2$$

for quadratic bezier curves or

$$ B(t) = P_0 (1-t)^3 + 3P_1 (1-t)t + 3P_2(1-t)t^2 + P_3t^3$$

for cubic bezier curves, and check if it is in the neighborhood of the bezier curve's path, I mean on the black drawn area.

[Red: Bezier curve's path; Black: Bezier curve's drawn area]

sentences:
How can I display only the new state of the grid? I am making a console based snake game. I am able to move the snake using grids that show up successively on the console. I want to animate the snake using always the same grid.

    static void Main(string[] args)
    {
        char[,] board = new char[17, 17];
        int count = 5;
        for (int i = 0; i <= 16;             {
            for (int j = 0; j <= 16; j++)
            {
                board[i, j] = '.';
            }
        }
        while (count < 11)
        {
            board[8, count] = '*';
            board[8, count + 1] = '*';
            board[8, count + 2] = '*';
            board[8, count + 3] = '*';
            board[8, count + 4] = '*';
            board[8, count + 5] = '*';
            board[8, count + 6] = '*';

            for (int i = 0; i <= 16; i++)
            {
                for (int j = 0; j <= 16; j++)
                {
                    Console.Write(board[i, j]);
                }
                Console.WriteLine();
            }
            count++;
        }
    }

sentences:
Distance per mesh in HLSL directx I'm subdividing a sphere so when distance gets greater, the sphere is subdivided less to save memory.

The sphere changes to another sphere when the distance is 10. My problem is that only one triangle gets rendered at a time in the geometry shader. This makes the rest of the sphere the different and causes holes and cracks. like the image below

How can I render all the triangles at one time?

my geometry function code is

 [maxvertexcount(50)]
void GS(triangle VertexOut gin[3], inout TriangleStream<GeoOut> stream)
{

if(distance(gin[0]) < 10.0f)
{
VertexOut v[15];
Subdivide2(gin, v);
OutputSubdivision2(v,stream);

}
else if(distance(gin[0]) >= 10)
{
VertexOut v[6];
Subdivide(gin, v);
OutputSubdivision(v,stream);

}
}

sentences: How to Change default Mouse pointer on emulator in Android? I want to change default mouse pointer in Android emulator. I want to change it for my game to use different type of cursor.I am using AndEngine for my game development. Is there nay way to change default mouse cursor for my Application. Thanks in Advance

sentences:
Collision with 2 of the same objects I'm looking to make a button that is activated by two of the same objects, but the code I'm using doesn't recognize the second object as a different instance. Not the best explanation but here's the code:

if place_meeting(x,y,obj_cube) && place_meeting(x,y,obj_cube)

So the game sees this as just one obj_cube and the button is pressed even if there is only one cube on the button. I've tried using variables but I might be doing it wrong.

sentences:
Is it possible with DirectX11 to have pixel shader output an integer rather than float4? I am trying to implement object picking via a shaders.  My intent is to create a texture2d that I would write out ID values describing individual objects.

Following drawing the objects, I would query back the pixel value at the focus point and read out the ID of the object.

I've created my texture2d as follows:

// Create a very tiny selection texture.
// This will record the color ID as unique identifier of a selectable object.
D3D11_TEXTURE2D_DESC desc;
desc.Width = 1;
desc.Height = 1;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_R32_UINT;  // 16 bit integer, hold up to 65536 possible unique IDs.
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_STAGING; // We will write via GPU and read to CPU!
desc.BindFlags = D3D11_BIND_RENDER_TARGET;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
desc.MiscFlags = 0;

HRESULT result = m_deviceResources->GetD3DDevice()->CreateTexture2D(&desc, 0, &m_colorRenderTarget);
if (FAILED(result)) {
    OutputDebugString(L"PickRenderer: Unable to create Texture2D");
}

Is it possible to then to make a pixel shader that would write out an R32 integer value, rather than the float values for RGBA?  If so, how would I best do this?

My pixel shader currently writes float RGB values out as follows:

// A constant buffer that stores the model transform.
cbuffer ModelConstantBuffer : register(b0)
{
    float4x4    modelToWorld;
    float3      color;  // Instead use unsigned int32 here if possible?
};

// Per-vertex data used as input to the vertex shader.
struct PixelShaderInput
{
    min16float4 pos     : POSITION;
};

// Can this use a different return value for uint?
min16float4 main(PixelShaderInput IN) : SV_TARGET
{
    return min16float4(color, 1.f);
}

Thanks, I've been trying to find an answer to this, but it seems very unusual to write out non-float values if it is possible.

sentences:
Getting one-point-collision object to conform to uneven terrain while keeping constant distance covered This is probably best described by image:

I have a character. For floor collision, it uses a single point (the red X). When the character moves, it conforms to the terrain; note how the blue line (its movment per frame) is the same length regardless of the slope.

I have the top three situations working fine. The issue is the bottom one, where the character is crossing over a change in slope. I handle the single-slope case just by rotating the impending movement vector, but obviously that won't work here.

My first instinct was to do something like this:

Measure length to next vertex along first slope.
Subtract length from impending movement vector.
Position impending movement vector at vertex; rotate to match second slope and get resulting position.
Put character at result position.

The problem is that it doesn't seem like this will chain very well if the character has to cross over three or more segments at once (maybe it's moving very fast over round-like terrain).

So basically at this point I'm looking to see if there's an easier solution I'm missing.

sentences:
How does a single non-artistic programmer make a game? I'd like to try my hand at making games. In making some simple ones, I realised I can't do art!

I've tried to find others to help: Most existing teams wouldn't want me because of my limited experience (I'm in high school) and I've been unable to find an available local artist with an appropriate skillset.

How do you guys do it? Do I have to wait until college to see if I like working in games? Is there a way to get free art so I can start messing around on my own? Or am I just having bad luck or looking in the wrong places for others interested?

sentences:
How can you merge the geometries of cloned objects in Three.JS? So I'm testing the best non-voxel way to display a lot of objects at once and so I found how to merge geometries.

Now, I can easily merge most geometries, but I can't seem to merge the geometries of cloned objects.

I've noticed that by simply using cloned objects, I can nearly get the same performance I get when merging geometries.

Is there a way to combine these two things for even better performance?

Here is a sample of my code, with the broken methods commented out.

var testGeo = new THREE.BoxGeometry( 1, 1, 1 );
var testMat = new THREE.MeshLambertMaterial( {color: 0xffff00  });
var testMesh = new THREE.Mesh( testGeo, testMat );
testMesh.position.set(1, 5, 1);
testMesh.castShadow = true;
testMesh.receiveShadow = true;
scene.add( testMesh );

//Testing with 900 objects.
var iterLength = 30;
for(var i = 0; i< iterLength; i++) {
    for(var j = 0; j< iterLength; j++) {

        var testGeo2 = new THREE.BoxGeometry( 1, 1, 1 );
        var testMat2 = new THREE.MeshLambertMaterial( {color: 0xffff00  });
        var testMesh2 = new THREE.Mesh( testGeo2, testMat2 );
        testMesh2.position.set(i, 2, j);
        testMesh2.castShadow = true;
        testMesh2.receiveShadow = true;

        //Clone Test (This won't work)
        /*
        var testMesh2 = testMesh.clone();
        testMesh2.position.set(i, 2, j);
        */

        //Reference Material/Geo test. (This also doesn't work)
        /*
        var testMesh2 = new THREE.Mesh( testGeo, testMat );
        testMesh2.position.set(i, 2, j);
        testMesh2.castShadow = true;
        testMesh2.receiveShadow = true;
        */

        //Merge.
        testMesh2.updateMatrix();
        testGeo.merge(testMesh2.geometry, testMesh2.matrix);
    }
}

sentences: Integrating the Steamworks API achievements into your game I'm coding a game in Visual Studio 2015 and am wondering how to go about adding steam achievements to it using the Steamworks API, do I need to have my game on steam before hand or if not what's the process of adding achievements?

sentences:
Techniques to mitigate microstuttering when the FPS is above 60fps and vsync is off The problem with first person shooters is that your input is important, and coupling it with VSync ruins it.
The following frames per second data when rendering with OpenGL shows:

60-100 fps: annoying jitter
140 fps: minor jitter, but certainly noticeable
200 fps: very minor small jitter sometimes
260 fps: either generally fine or very very small
300+ fps: perfectly fine

The problem is other games I play that use similar rendering algorithms only stutter in the range of 60-100fps, whereas my range is 60-250fps (albeit it gets better when you get into the 200 range but you can still notice it if paying attention).
At first I thought my game loop may have been wrong, but after going through it in great detail it is working just fine (and vsync works perfectly smooth with it too, if it was broken this would be an issue the update rate and the vsync monitor refresh rate are not divisible by each other).
60 - 100 fps is 62.5 - 10ms
100 - 250 fps is 10 - 4ms
Not being able to go above 4ms would be pretty constraining!
Because I'm using C# (note: I have zero GC, it doesn't run), I don't know if this means I'm somehow running into higher variability with the VM than I would when I did stuff in C++. I don't know if being in the 4-10ms range means that sometimes it will spike.
Now I did profile this, and this is what I've seen:

Ignoring the green line, the blue line is the uncapped version and orange is vsync. Since the vsync line has massive variability but seems to render fine, whereas the blue one has spikes but are all generally below the vsync line (and definitely not greater than the spikes from vsync), I don't understand whether I'm actually seeing those blue spikes and it's because of some kind of intermediate frame tear or not. It doesn't look like a frame tear to me, it just looks like a frame is lost and I lurch forward a bit more than normal like I was lagging online.
So the question is... what can I do to diagnose this issue? Or is this normal?
I was thinking of rendering to a framebuffer and just drawing that every 1/60 seconds in an attempt to smooth things out and emulate vsync but this comes with it's own drawbacks. Problem is... my back is against the wall and I'm worried I'll be doing potentially stupid and wasteful stuff.
EDIT 1: Ticker code that does what I do
(int, double) timerFunc()
{
    long currentTime = GetCurrentTime();

    accumulation += currentTime - lastTimeSeen;
    lastTimeSeen = currentTime;

    // If it returns 1.27, then we have to run 1 tick, and interpolate at t = 0.27
    double tickFraction = accumulation / timePerGametick;

    int ticksToRun = floor(tickFraction);
    double fraction = tickFraction - ticksToRun;

    if (ticksToRun > 0)
        accumulation -= (ticksToRun * timePerGametick);

    return (ticksToRun, fraction);
}

EDIT 2: Game loop and basic logic (uses timerFunc data from above)
void update(int ticksToRun) {
    for i in ticksToRun {
        foreach plane in planes that should move {
            plane.Tick();
        }

        foreach entity in entities {
            entity.Tick();
        }
    }
}

// interpolation will be in [0.0, 1.0)
void render(double interpolation) {
    foreach plane in planes {
        planeDelta = (plane.current - plane.prev);
        planeInterpolated = plane.prev + (planeDelta * interpolation);
        render(planeInterpolated);
    }

    foreach entity in entities {
        entityDelta = (entity.current - entity.prev);
        entityInterpolated = entity.prev + (entityDelta * interpolation);
        render(entityInterpolated);
    }

    swapBuffers();
}

void gameLoop() {
    while (true) {
        (int ticksToRun, double fraction) = timerFunc();

        pollInput();

        if (ticksToRun > 0)
            update(ticksToRun);

        render(fraction);
    }
}

sentences: Problems with recursive backtracking algorithm for a 3D maze The algorithm really shines when craving process get's stuck (only visited nodes around), then it backtracks and creates alternative routes for the maze. That's kind of the point of a maze, that there are different paths and you can take wrong or right one. When I add extra dimensions (3rd one) to the algorithm to create a 3D maze, it almost never gets stuck because there are so much directions now to go and for most it's just one way path. I wonder if there is some trick to fix this or maybe I need different algorithm?

sentences:
How can AI compute movement in 2D games I know how to create a basic AI for a game, where the AI simple creates units that only march forward. The AI only decides when to create a new unit, taking into account a number of considerations.

But now, I'm working on a game where the user controls a spaceship that can move in any of 8 directions (up, down, left, right, and any of the 4 diagonals).

The user is battling another spaceship that moves in the same way. The spaceships can shoot missiles. The missiles fly in the direction the shooting-spaceship is facing.

I need to program the AI, but have no idea how to make such an AI. Could you give me some general direction on how to make an AI that computes it's movements on the screen?

I have some very general idea, I would also like to know if this is somehow a decent direction:

The AI ship always tries to get inside a specific radius from the user's ship. Once it does, it moves up, down, left, or right to a point where it will be able to hit it's opponent. Then it shoots a missile in the direction of the user's ship.

Is this a decent direction? Any ideas or places where I can get started learning these things? My main concern is how the AI will compute it's movements.\

EDIT: Both the enemy ship and the player's ship can face any direction.

Thanks

sentences:
Why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix? I'm working on a 2D game engine project, and I want to implement matrices for my transformations. I'm going to use the GLM library.

Since my game is only 2D, I figured I only need a 3x3 matrix to combine the translation, rotation and scale operations. However, glm::translation is only overloaded to return a 4x4 matrix, and never a 3x3.

I thought a translation could be performed by using a 3x3 matrix; why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix?

sentences:
Image speeds up while moving and or rotating instead of constant speed I'm having a problem with rotating/moving an image. I've set one of my images to rotate on it's z-axis buy updating the angle, but when I run my game, the image starts slowly starts to rotate from a stationary position as if to build up momentum. Once it reaches a certain speed, it begins to slow down to almost a stop, then repeats the process over. Furthermore, when it starts to rotate, it's rotating clockwise. But halfway before it stops, it's now rotating counter-clockwise.

If I were to only update it's x or y position or both, the image will move slow, then speed up to the desired speed, instead of moving at the desired speed at start.

Lastly, if I were to rotate AND move the image, the image shakes erratically while rotating. My suspicion is that I'm calculating something wrong.

Within Shader

uniform mat4 projection;
uniform mat4 view;
uniform mat4 model;
....
gl_Position = projection * view * model * vec4(position, 1.0);

init()

        projection = glm::ortho(LEFT, RIGHT, BOTTOM, TOP, ORTHO_NEAR, ORTHO_FAR);

        mSprite.init("res/texture/foo.png", 1.0f);
        mSprite.setPosition(mPosition);
        mSprite.setRotation(rot, glm::vec3(0, 0, 1));

        glm::vec3 pos(1.5, 0.5, 0.0);
        mSprite2.init("res/texture/bar.png", 1.0f);
        mSprite2.setPosition(pos);
        mSprite2.setRotation(0.0f, glm::vec3(0, 1, 0));

update()

        mPosition.x += 0.000005f;
        mPosition.y += 0.000005f;
        mSprite.setPosition(mPosition);

        rot += 0.0005f;
        mSprite.setRotation(rot, glm::vec3(0, 0, 1));

render()

        mShader->start();
        mShader->LoadProjectionMatrix(projection);
        mSprite.draw(mShader, view);
        mSprite2.draw(mShader, view);
        mShader->stop();

draw(Shader* shader, glm::mat4& view) (mSprite)

        shader->LoadViewMatrix(view);
        shader->LoadTransformMatrix(mModel);
        shader->connectTexture(mTexture.id);
        // Draw image...

    void setPosition(glm::vec3 position)
    {
        mModel = glm::translate(mModel, position);
    }

    void setRotation(GLfloat angle, glm::vec3 axis)
    {
        mModel = glm::rotate(mModel, angle, axis);
    }

sentences:
How can I get the borderSize/s of a plane? public Texture2D gridImage;
public GameObject floor;

    private int borderSize;

    private void Start()
    {

        GenerateGrid();
    }

    void GenerateGrid()
    {
        Color gridColor = Color.cyan;
        Color borderColor = Color.black;
        Collider floorCollider = floor.GetComponent<Collider>();
        MeshRenderer floorRenderer = floor.GetComponent<MeshRenderer>();
        floorRenderer.material.mainTexture = gridImage;
        floorRenderer.material.mainTextureScale = new Vector2(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        floorRenderer.material.mainTextureOffset = new Vector2(.5f, .5f);

        Vector3 foorSize = new Vector3(floorCollider.bounds.size.x, floorCollider.bounds.size.z);
        for (int x = 0; x < gridImage.width; x++)
        {
            for (int y = 0; y < gridImage.height; y++)
            {
                if (x < borderSize || x > gridImage.width - borderSize || y < borderSize || y > gridImage.height - borderSize)
                {
                    gridImage.SetPixel(x, y, new Color(borderColor.r, borderColor.g, borderColor.b, 50));
                }
                else gridImage.SetPixel(x, y, new Color(gridColor.r, gridColor.g, gridColor.b, 50));
            }
            gridImage.Apply();
        }
    }

In the end I want to create something like this on a 3D Plane UI :

sentences:
Unity3d webplayer failed to download data file When testing my game web builds on localhost, I get the error "Failed to download data file". The game data file is correctly placed, and the page loads fine, it just wont download the plugin, or prompt me to do so.

I tried the following things:
Add MIME Types to IIS 7.5:

Open IIS Manager
Double click "MIME Types" in the IIS section.
Click Add on the right side "Actions" menu.
File name extension: = .unity3d
MIME type: application/unity3d
click ok
Restart the server (right side "Actions" menu)

That didn't work for me specifically because it turned out I was using IIS Express, so I did the following:

If Windows 7, browse to 'C:\Users\\Documents\IISExpress\config\' and open the file: ApplicationHost.config.

Search for 'staticContent' and add the following before the closing tag:

However, again, it didn't work..

sentences:
Unable to Render to multiple rendertargets I am trying to implement a simple deferred rendering engine in openGL and i have a little problem with the GBuffer. I cant get it to render to more than one texture at a single time, which is the one attached to GL_COLOR_ATTACHMENT0.

GBuffer initialization code:

    glGenFramebuffers(1,&m_FBO);
glBindFramebuffer(GL_FRAMEBUFFER,m_FBO);
//create Gbuffers
glEnable(GL_TEXTURE_2D);
//create diffusemap
glGenTextures(1,&m_Textures[GBUFFER_DIFFUSE_24]);
glBindTexture(GL_TEXTURE_2D,m_Textures[GBUFFER_DIFFUSE_24]);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,m_Width,m_Height,0,GL_RGB,GL_UNSIGNED_BYTE,0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,m_Textures[GBUFFER_DIFFUSE_24],0);
if(!glIsTexture(m_Textures[GBUFFER_DIFFUSE_24]))
    return false;
//create normalmap
glGenTextures(1,&m_Textures[GBUFFER_NORMAL24_MATID8]);
glBindTexture(GL_TEXTURE_2D,m_Textures[GBUFFER_NORMAL24_MATID8]);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB32F,m_Width,m_Height,0,GL_RGB,GL_FLOAT,NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT1,GL_TEXTURE_2D,m_Textures[GBUFFER_NORMAL24_MATID8],0);
if(!glIsTexture(m_Textures[GBUFFER_NORMAL24_MATID8]))
    return false;
//create depthmap
glGenTextures(1,&m_Textures[GBUFFER_DEPTH32]);
glBindTexture(GL_TEXTURE_2D,m_Textures[GBUFFER_DEPTH32]);
glTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH24_STENCIL8,m_Width,m_Height,0,GL_DEPTH_STENCIL,GL_UNSIGNED_INT_24_8,0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_STENCIL_ATTACHMENT,GL_TEXTURE_2D,m_Textures[GBUFFER_DEPTH32],0);
if(!glIsTexture(m_Textures[GBUFFER_DEPTH32]))
    return false;
GLenum drawBuffers[] = {GL_COLOR_ATTACHMENT0,
                        GL_COLOR_ATTACHMENT1};
glDrawBuffers(2,drawBuffers);
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

if(status != GL_FRAMEBUFFER_COMPLETE)
{
    printf("FBO error!!, status: 0x%x\n",status);
    return false;
}
glBindFramebuffer(GL_FRAMEBUFFER,0);

And then before i render all geometry i do this:

            glClearColor(0.2f,0.6f,0.3f,0);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER,m_FBO);
    GLenum drawBuffers[] = {GL_COLOR_ATTACHMENT0,
                            GL_COLOR_ATTACHMENT1};
    glDrawBuffers(2,drawBuffers);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT| GL_STENCIL_BUFFER_BIT);

And then after i rendered all of it i blit it to the normal framebuffer:

            RenderGeometry();
    glBindFramebuffer(GL_FRAMEBUFFER,0);
    glClearColor(0.0f,0.0f,0.0f,0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT| GL_STENCIL_BUFFER_BIT);
    glBindFramebuffer(GL_READ_FRAMEBUFFER,m_GBuffer->GetHandle());
    glReadBuffer(GL_COLOR_ATTACHMENT0);
    glBlitFramebuffer(0,0,1280,720,
        0,0,640,370,GL_COLOR_BUFFER_BIT,GL_LINEAR);

    glReadBuffer(GL_COLOR_ATTACHMENT1);
    glBlitFramebuffer(0,0,1280,720,
        640,370,640,370,GL_COLOR_BUFFER_BIT,GL_LINEAR);
    glfwSwapBuffers(m_Window);

And my fragment shader code is:

    #version 430

    in vec2 Tex;
    in vec3 Normal;

    uniform sampler2D   tex1;
    uniform bool        UseTexture;

    layout(location = 0) out vec3 FragmentColor;
    layout(location = 1) out vec3 FragmentNormal;

    void main()
    {
FragmentNormal.xyz = normalize(Normal);
if(UseTexture)
{
    FragmentColor = texture(tex1,Tex).rgb; //diffuse color
}
else
{
    FragmentColor = vec3(1,1,1);
}
    }

And the result is:

It should be two rectangles drawn to the screen one containing the diffuse color and one containing the screen normals. However i am only getting one.

sentences:
Fixed timestep game loop, why interpolation This is a very standard way of doing a fixed timestep game loop, where you just accumulate time from the previous frame and consume it in discrete steps with the physics engine:
    while ( accumulator >= dt )
    {
        previousState = currentState;
        integrate( currentState, t, dt );
        t += dt;
        accumulator -= dt;
    }

A lot of articles suggest that with the residual lag we should do an interpolation between the previous update and the current one, BUT it does not make any sense to me!
If you have residual lag it means that you still have some time to catch and you should EXTRAPOLATE the current state. Why would you ever do an interpolation with the previous state?

sentences:
What is closing and separating velocity in Ian Millington's game physics book? I'm working on a physics engine in C++ and chose Ian Millington's Physics Engine Development book as a guide and reference to help me out understand physics concepts and how to implement them.
Yesterday I was reading through the Hard Constraints chapter, particularly the simple collision resolution section and came across an explanation of a physics formula that I couldn't fully comprehend. Millington says "The closing velocity is the total speed at which two objects are moving together" and it is calculated with the following formula:
$$V_c= \dot{P}_a\cdot(\widehat{P_b-P_a})+\dot{P}_b\cdot(\widehat{P_a-P_b})$$
Where \$V_c\$ is the closing velocity, \$P_a\$ and \$P_b\$ are object \$a\$ and \$b\$ respectively. Also he further discusses another formula called the separating velocity which is written as follows:
$$V_s=(\dot{P}_a-\dot{P}_b)\cdot(\widehat{P_a-P_b})$$
Where \$V_s\$ is the separating velocity. Now I don't really understand what these formulas actually are or what they represent in the physics world. I also have trouble wrapping my head around why we need these formulas to perform collision resolution since he used the separating velocity formula to resolve the velocity upon collision and why we need the dot product. It would be really helpful if someone can provide visual explanation that would significantly help me understand what's going on.

sentences:
Animation "Offset" in Unity 2D animation I was playing around with Unity and its 2D Animator. When I press a Button now (to play for example the walk left Animation) it takes about 1 sec to begin the animation and same when I release the button to stop it. It's the same problem with every other animation.

Here's my Player Movement Controller:

using System.Collections;
using UnityEngine;

public class Player_Movement : MonoBehaviour {

public float speed = 10;
float old_pos;
float old_height;

void Start()
{
    old_pos = transform.position.x;
    old_height = transform.position.y;
}

void FixedUpdate()
{

    float h = Input.GetAxisRaw("Horizontal");
    float v = Input.GetAxisRaw("Vertical");

    Vector2 dir = new Vector2(h, v);
    GetComponent<Rigidbody2D>().velocity = dir.normalized * speed;

    GetComponent<Animator>().SetBool("isWalkingLeft", (h < 0));

    GetComponent<Animator>().SetBool("isWalkingRight", (h > 0));
  }
}

The problem also occurs when I switch directions and the animation should instantly switch over.

sentences:
Category/genre name for games like: Ogame, Kings of Chaos, and Bitefight.? I'm searching for a category name for games like: Ogame, Kings of Chaos, and Bitefight.

When I learned about those, they were just called browser games, but today where we have the technology to create every genre of games in the browser, I miss a box to put these: 'only text, pictures and no fancy animation-games' into.

Do they actually have a name, leading to my Google-Fu being miserable?

sentences:
Help on transition from one position to another I'm pretty sure I'm over thinking stuff, but I can't seem to figure this out. I want to move the object from one location to another. Here's what I got. I searched this up earlier here, and I found something similar, but I wasn't able to make it work. Any help would be appreciated, thanks.

//the current position of the object is at 400, 300
Vector2 nextPosition = new Vector(100, 200);
Vector2 difference = nextPosition - position;

difference.Normalize();

position += difference * 5;

sentences:
Increase sound tempo in Unity when new player joins in Kinect game I'm using Unity to create a Windows-build game with Kinect.

I have some drum beats, which can either be used as single sound effect or be edited to be a piece of continuous music. I want these drum beats to be the background sound of my game.

I want the drum beats to go at a constant pace, but when new users join, the beats go faster without changing its pitch.

Can I achieve this Unity with either plugin or code? Or do I need to use stuff like Max/MSP to run with Unity at the same time?

sentences:
What advantage do OpenGL, SFML and SDL have over software rendering? I started watching the Handmade Hero stream, where Casey Muratori creates a game engine without using frameworks or such.
Yesterday I got to the part where he showed how an image is drawn onto the screen. As far as I understood it he just allocated some memory as big as the size of the screen he wants to draw to. And then he created a bitmap which he passed to the buffer memory he allocated and drew it to the screen using a os specific function.

This seems quite straight forward. I used GameMaker, changed to Love2D, worked a little bit with Sprite Kit but I was always wondering what was really happening beneath this sometimes confusing layers.

Given that, why even bother using graphics libraries (OpenGL, SFML, SDL, …) when all you have to do is simply allocate some buffer, pass a bitmap and draw it to the screen?

If you then want to draw distinct things to you screen you just write them to your bitmap which then gets passed into the buffer. I'm quite new to programming, but this seems quite simple to me. Please correct me if I'm wrong.

sentences:
Is it worth to implement game mechanics/rules separately from the main code? Not sure whether it fits the scope of this community, or should go to Stackoverflow instead.

Let's suppose that I want my game be easily extendable in its core, i.e. I want that a lot of people, even without decent programming knowledge, would be able to not only tweak existing rules, but even add totally new game mechanics into it. I'm not good programmer myself, but I'm ready to learn, I'm just need some directions and assurance it can be done.

What I've thought about is whether it's possible/feasible to somehow implement game mechanics separately from the main utility code? I mean, for tabletop games we have those rulebooks which don't contain actual algorithms of all actions, but rather describe some protocols and limits, referencing context of each such item heavily. Is it possible to do something similar for PC game, like, describe all the rules in some very high-level, easily readable (and changeable) by a human programming language, which is then "consumed" and parsed by the utility code into a working instance of game mechanics?

That really seems like I need to write my own language and a compiler for it )) Which I won't be able to do, of course. But may be there is an easier approach to the problem?

FYI: my language of choice for the utility code will be Python 3.x

sentences:
How can I notify my AI systems that a target has died? I am currently building a game focusing on AI for my university and this is my first time writing such a complex AI system.

Naturally, I ran into a little logic problem: In the game, the AI uses a hierarchical finite state machine and certain states have a pointer to a character as target for their logic (e.g. attack state has a target character to attack). Additionally, multiple characters might target this one character at the same time.

Now if that character dies, how should I go about telling the AI that the target is no longer valid? I can't just delete the character object, since that would result in invalid pointers and access violations, of course.

I thought about using an event system, where the characters are notified about the death, but how would I know, when all characters removed their reference, changed their state etc. and I could finally delete the object?

Would I have to resort to using smart pointers here? Or is there another good solution?

sentences:
Help me please to choose proper path-finding algorithm I am new to game development and just want to ask for advice. I need to know which path-finding algoritm will be suitable for my scenario:

Units - any shape. But in most cases rectangles of different sizes.
I have random generated maze and destination point or area.
Because of different maze borders not all unit can fit and move to the end.

How to find path from unit to destination area and check that shape can move to this area?

sentences:
How can I animate a portion of the textures on a model? I have a model to which I have attached multiple textures. Both textures are currently static, but if I want to move (or slide) the texture which is on the top (in UV space), is that possible?

Maybe by moving the texture coordinates or something?

sentences:
What can I do to make sure that I have the energy to work on my game while working full-time? I work as a software engineer 40+ hours a week and I find that between balancing my personal life and family responsibilities that I have literally no energy to work on game development.

What can I do to make more time for my hobby without burning myself out in front of the computer? I am sure there must be someone here successfully developing a game while working as a programmer on the side.

sentences:
Fastest way to look up an entity with a set of components? I'm currently trying to implement an ECS system, but I've sort of ran into a problem trying to fetch all of my entities that have a specific set of components. I currently have a Dictionary that maps a component name to a list of Guids (entities), so I have no problem fetching a list of entities if I were to query for just one component. But if I were to query entities for more than one component (e.g. all entities that have Render and Transform component), I run into a problem where it's no longer a constant time lookup.

I could probably loop through the entities to see if they contain that set of component names (they are stored in a dictionary that maps Guid to a list of strings), but I was thinking that there could be a faster way of doing this?

sentences:
FormatMessage not working for HRESULTs returned by Direct3D 11 I am using Windows 7 x64 and Visual Studio 17 (v15.9.7).

Say I try to create a swap chain using IDXGIFactory2::CreateSwapChainForHwnd and pass in DXGI_SCALING_NONE. I will get the following message in debug output (if I have enabled Direct3D debugging):

DXGI ERROR: IDXGIFactory::CreateSwapChain: DXGI_SCALING_NONE is only supported on Win8 and beyond. DXGI_SWAP_CHAIN_DESC{ SwapChainType = ..._HWND, BufferDesc = DXGI_MODE_DESC1{Width = 816, Height = 488, RefreshRate = DXGI_RATIONAL{ Numerator = 0, Denominator = 1 }, Format = B8G8R8A8_UNORM, ScanlineOrdering = ..._UNSPECIFIED, Scaling = ..._UNSPECIFIED, Stereo = FALSE }, SampleDesc = DXGI_SAMPLE_DESC{ Count = 1, Quality = 0 }, BufferUsage = 0x20, BufferCount = 2, OutputWindow = 0x0000000000290738, Scaling = ..._NONE, Windowed = TRUE, SwapEffect = ..._FLIP_SEQUENTIAL, AlphaMode = ..._UNSPECIFIED, Flags = 0x0 } [ MISCELLANEOUS ERROR #175: ]

The function returns 0x887a0001 in form of a HRESULT. If I put @err,hr in the watch window, I get a nice error message there:

ERROR_MOD_NOT_FOUND : The specified module could not be found.

However, if I pass this HRESULT to FormatMessage, it just puts NULL in the output and returns 0. @err,hr helpfully informs me that the new error is ERROR_MR_MID_NOT_FOUND : The system cannot find message text for message number 0x%1 in the message file for %2.

My questions are:

Why is FormatMessage not giving me right error string (the one starting with ERROR_MOD_NOT_FOUND...)?
Where is Visual Studio getting these pretty error strings from?
Can I get them too? Who do I pay?

PS. I am using the Windows 10 SDK version of DX11, not the older DirectX SDK version. Thus, I can't really link to dxerr.lib either.

This is the code that is used to print the error message:

LPTSTR error_text = NULL;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
              FORMAT_MESSAGE_ALLOCATE_BUFFER |
              FORMAT_MESSAGE_IGNORE_INSERTS,
              NULL,
              hr,
              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
              (LPTSTR)&error_text, 0,
              NULL);

sentences:
Hardcode per-instance properties into the shader in unity I am using one of the packages from the asset store and using its Polyline feature for wire rendering. There are thousands of wires and its taking much fps/Batch counts. The reason of the lack of support for static batching. Now there is a workaround suggested by the author of the package.

if you don't use polylines for anything other than that, and all your
shaders use the same properties, you could hardcode all per-instance
properties into the shader

Due to a lack of shader knowledge(I am developing the knowledge currently and it will take time) I am unable to hard code the above properties: I tried and here is the current scenario:
#define int _ScaleMode = 1
#define half4 _Color = (0,0,0,0)
#define float4 _PointStart = (0,0,0,0)
#define float4 _PointEnd = (0,0,0,0)
#define half _Thickness = 0.5
#define int _ThicknessSpace = 1
#define half _DashSize = 1
#define half _DashOffset =1
#define int _Alignment =1

HOw do i correctly hard code above values?

sentences:
How can I implement a renderer that can draw many kinds of primitives? This is somewhat linked to a question I previously asked concerning the drawing of indexed primitives.

My problem was that I was only drawing one cube when I wanted to draw many. I was told that the problem was that I was overwriting the vertex and index buffers with each new instantiation of Cube and that instead I should create one at the origin and then draw many, passing through a transformation matrix to the shader that makes it appear in different places. This worked beautifully.

I now have a new problem though: how would I draw many different types of primitives?

Here is my code from the previous question:

Cube::Cube(D3DXCOLOR colour, D3DXVECTOR3 min, D3DXVECTOR3 max)
{
// create eight vertices to represent the corners of the cube
VERTEX OurVertices[] =
{
    {D3DXVECTOR3(min.x, max.y, max.z), colour},
    {D3DXVECTOR3(min.x, max.y, min.z), colour},
    {D3DXVECTOR3(min.x, min.y, max.z), colour},
    {min, colour},
    {max, colour},
    {D3DXVECTOR3(max.x, max.y, min.z), colour},
    {D3DXVECTOR3(max.x, min.y, max.z), colour},
    {D3DXVECTOR3(max.x, min.y, min.z), colour},
};

// create the vertex buffer
D3D10_BUFFER_DESC bd;
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(VERTEX) * 8;
bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;

device->CreateBuffer(&bd, NULL, &pBuffer);

void* pVoid;    // the void pointer

pBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the vertex buffer
memcpy(pVoid, OurVertices, sizeof(OurVertices));    // copy the vertices to the buffer
pBuffer->Unmap();

// create the index buffer out of DWORDs
DWORD OurIndices[] =
{
    0, 1, 2,    // side 1
    2, 1, 3,
    4, 0, 6,    // side 2
    6, 0, 2,
    7, 5, 6,    // side 3
    6, 5, 4,
    3, 1, 7,    // side 4
    7, 1, 5,
    4, 5, 0,    // side 5
    0, 5, 1,
    3, 7, 2,    // side 6
    2, 7, 6,
};

// create the index buffer
// D3D10_BUFFER_DESC bd;    // redefinition
bd.Usage = D3D10_USAGE_DYNAMIC;
bd.ByteWidth = sizeof(DWORD) * 36;
bd.BindFlags = D3D10_BIND_INDEX_BUFFER;
bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
bd.MiscFlags = 0;

device->CreateBuffer(&bd, NULL, &iBuffer);

iBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the index buffer
memcpy(pVoid, OurIndices, sizeof(OurIndices));    // copy the indices to the buffer
iBuffer->Unmap();

//this is simply a single call to the update method that sets up the scale, rotation
//and translation matrices, in case the cubes are static and you don't want to have to
//call update every frame
Update(D3DXVECTOR3(1, 1, 1), D3DXVECTOR3(0, 0, 0), D3DXVECTOR3(0, 0, 0));
}

Clearly if I duplicated and modified the code to be a different object or shape, the last shape to be initialized would overwrite the vertex buffer, wouldn't it?

Do I use multiple vertex buffers? Do I append the new vertex buffer to the old one and use the appropriate indices to draw them? Can I do either? Both?

sentences:
Common way to store model transformations I ask myself what's the best way to store the transformations in a model class.
What I came up with is to store the translation and scaling in a Vector3 and the rotation in a Matrix4.

On each update (frame) I multiply the 3 matrices (first build a Translation and Scaling Matrix) to get the world matrix. In this way I have no accumulated error.

world = translation * scaling * rotation

Another way would be to store the rotation in a quaternion but then I would have a high cost to convert to a matrix every time step. If I lerp the model I convert the rotation matrix to quaternion and then back to matrix.

For speed optimization I have a global dirty flag and one for each transformation so that I only do a matrix multiplication if necessary.

if (isDirty) {
    world = translation
    if (isScaled) {
        world *= scaling
    }
    if (isRotated) {
        world *= rotation
    }
}

Is this a common way or is it more common to have only one Matrix4 for all transformations?
And is it better to store the rotation only as quaternion? For info: Currently I'm building a CSS3D engine in Javascript but these questions are relevant for every 3D engine.

sentences:
Pseudocode for calculating per vertex normals for a trianglestrip mesh I have a terrain that is defined as a trianglestrip mesh. Now I'm trying to calculate the normals of each vertex but I've realised that my normal way of calculating vertex normals only works with triangle meshes. I'm finding it hard to wrap around my head how to get the triangles from trianglestrip to calculate the normal in code. I can imagine it but just can't understand how that translates into code.

Can someone help me with some pseudocode or anything of that matter that demonstrates how I could cycle an array that contains indices used in a trianglestrip to calculate the normals?

EDIT:

I ended up finding this answer on stackoverflow and it looked like a very efficient and easy way to generate normals from a heightmap: https://stackoverflow.com/questions/49640250/calculate-normals-from-heightmap/49640606?noredirect=1#

The question defines the point and it's neighbours as follows for clarity. O being the vertex we're calculating a normal for:

  T
L O R
  B

Having translated it to my own cordinate system (right handed because of opengl), I ended up with the calculation of a normal of a vertex as:

Vec3 normal = Normalize(Vec3((R-L)/2, 1.0f, (B-T)/2));

I implemented that. Here's the constructor for a terrain in my code (fair warning, I am writing my own engine with its own math library. You should be able to infer the meanings of some things by their names though):

Terrain :: Terrain(unsigned int size)
{
    unsigned int xSegments = size;
    unsigned int ySegments = size;

    srand(time(NULL));
    m_NoiseMap = CreateScope<NoiseMap>(xSegments + 1, ySegments + 1);
    m_NoiseMap->GenerateNoise(rand() % 9999, 25, 0.015, 0.52, Vec2(0.4), 4);

    float dX = (float)size  / xSegments;
    float dY = (float)size / ySegments;

    auto heightMap = *m_NoiseMap;

    for (unsigned int y = 0; y <= ySegments; ++y)
    {
        for (unsigned int x = 0; x <= xSegments; ++x)
        {
            auto height = heightMap[x][y];
            auto position = Vec3(dX * x * 2.0f - 1.0f, height, dY * y * 2.0f - 1.0f);

            Positions.push_back(position);
            UV.push_back(Vec2(dX * x, 1.0f - y * dY));

            float heightR, heightL, heightU, heightD = height;

            if (y > 0)
                heightU = heightMap[x][y - 1];

            if (x > 0)
                heightL = heightMap[x - 1][y];

            if ( y < ySegments)
                heightD = heightMap[x][y + 1];

            if (x < xSegments)
                heightR = heightMap[x + 1][y];

            Normals.push_back(Normalize(Vec3((heightR - heightL)  / 2, 1.0f, (heightD - heightU) / 2)));
        }
    }

    bool oddRow = false;

    for (int y = 0; y < ySegments; ++y)
    {
        if (!oddRow)
        {
            for (int x = 0; x <= xSegments; ++x)
            {
                Indices.push_back(y       * (xSegments + 1) + x);
                Indices.push_back((y + 1) * (xSegments + 1) + x);
            }
        }
        else
        {
            for (int x = xSegments; x >= 0; --x)
            {
                Indices.push_back((y + 1) * (xSegments + 1) + x);
                Indices.push_back(y       * (xSegments + 1) + x);
            }
        }
        oddRow = !oddRow;
    }

    Topology = TRIANGLE_STRIP;
    Finalize();
}

Unfortunately, when I do this, I get this as the result once I'm done lighting the mesh:

Which just looks random if you ask me. I've set the normal to be flat in the shader as I'm trying to make low poly terrain and do not need smooth shading. Anyone have any clues where I'm going wrong?

Thank you

sentences:
How could I give a lifespan to my MMO characters? A problem I've encountered in some MMO games, is that players congregate around the endgame content, meaning that when a new player joins they are basically playing a solo game until they reach a high enough level to join the other players.

To combat that, I'm considering giving the player characters a finite lifespan. For example making it so that after X hours of gameplay, or once they reach level X, they start losing power instead of gaining it. Then they are encouraged to reincarnate, starting again from level 1 and only carrying over some small subset of their abilities.

My hope is that this will make the early game content (probably randomly generated, to keep it interesting) more useful, and more busy.

My questions is:

How could I implement this to make it appealing to the players?

sentences: RTS Pathfinding without collision between units Options Ever since I made my units move to a certain location a problem has popped up that of course if I try to make two or more units go to the same place they fight for the same spot. Am I just being stupid and unity already has a way around this or do I need to do something specific? I have looked into flow field path finding but no way on how to implement it. I dont want to have to use a ready made script but some pointers and other options are more than welcome.

sentences: Why won't my ball bounce? (Unity, 3D) I'm trying to do a very simple ball bouncing setup in Unity. I have a sphere with a sphere collider and a plane below it was a rectangular mesh on it, isTrigger set to false for both, and they both have a physics material with bounciness of 1. I have the ball start a couple units above the plane, gravity pulls it down, but instead of bouncing it stops right at the collider for the plane, then (weirdly) slowly falls through the collider. Once it falls through the bottom it starts falling normally again. The collider is already really thick (I've been trying to fix this by changing collider types and making them way bigger than needed). I just have no clue what's going on and feel like I'm missing something obvious.

sentences:
Resolving bounding box collision detection I'm working on a simple collision detection and resolution method for a 2d tile-based bounding box system. Collision appears to work correctly, but I'm having issues with resolving a collision after it has happened.

Essentially what I'm attempting to do is very similar to this approach. The problem I'm experiencing is that because objects can be traveling with both horizontal and vertical velocity, my resolution code causes the object to jump incorrectly.

I've drawn the following annotation to explain my issue. In this example, because my object has both horizontal and vertical velocity, my object (which is heading upwards and collides with the bottom of a tile) has it's position altered twice:

To correctly adjust it's vertical position to be beneath the tile.
To incorrectly adjust it's horizontal position to be to the left of the tile.

Below is my collision/resolution code in full:

function intersects(x1, y1, w1, h1, x2, y2, w2, h2)
{
    w2 += x2;
    w1 += x1;
    if (x2 > w1 || x1 > w2) return false;
    h2 += y2;
    h1 += y1;
    if (y2 > h1 || y1 > h2) return false;
    return true;
}

for(var y = 0; y < this.game.level.tiles.length; y++)
{
    for(var x = 0; x < this.game.level.tiles[y].length; x++)
    {
        var tile = this.game.level.getTile(x, y);
        if(tile)
        {

            if(
                this.velocity.x > 0 &&
                intersects(this.position.x+dx+this.size.w, this.position.y+dy, 1, this.size.h, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.x = ((x*tileSize)-this.size.w);
                hitSomething = true;
                break;
            }
            else if(
                this.velocity.x < 0 &&
                intersects(this.position.x+dx, this.position.y+dy, 1, this.size.h, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.x = ((x*tileSize)+tileSize);
                hitSomething = true;
                break;
            }
            if(
                this.velocity.y > 0 &&
                intersects(this.position.x+dx, this.position.y+dy+this.size.h, this.size.w, 1, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.y = ((y*tileSize)-this.size.h);
                hitSomething = true;
                break;
            }
            else if(
                this.velocity.y < 0 &&
                intersects(this.position.x+dx, this.position.y+dy, this.size.w, 1, x*tileSize, y*tileSize, tileSize, tileSize)
            )
            {
                this.position.y = ((y*tileSize)+tileSize);
                hitSomething = true;
                break;
            }
        }
    }
}

if(hitSomething)
{
    this.velocity.x = this.velocity.y = 0;
    dx = dy = 0;

    this.setJumping(false);
}

sentences:
Is it OK to release the source code for your own Xbox Live indie game? Between not being sure how to phrase my question for Google and not being a lawyer, I thought it might be easier to ask you guys. Specifically, I want to know if it's OK to sell an Xbox Live indie game while simultaneously distributing the source code and other assets via GitHub or something.

Edit: The Communist Duck asked "why not?" One reason I can think of is that Microsoft has a small stake in a game's sales. They are hosting the demo/full game, they might be dedicating an advertising slot to the game in their "latest" section, etc. It's true they get a cut of each sale, but they get nothing if everyone just goes and downloads the free version.

Anyway, it's not a matter of what is reasonable and logical, it's a matter of what the terms and conditions allow. I'm going to read through them regardless, but I was hoping someone already knew.

sentences:
Get average tile color In my 2D game I have TileSet class that loads the texture and creates Rectangle[] array which stores each tile coordinates. Pretty basic stuff. Now I'd like to also calculate and store the average color of each tile. How do I do that in XNA/C#?

My goal is to tint the tile with the color based on its value when highlighted. Or maybe there is some other way to achieve similar effect?

sentences:
How to avoid gimbal lock I am trying to write code with rotates an object.

I implemented it as:

Rotation about X-axis is given by the amount of change in y coordinates of a mouse and
Rotation about Y-axis is given by the amount of change in x coordinates of a mouse.

This method is simple and work fine until on the the axis coincides with Z-axis, in short a gimble lock occurs.

How can I utilize the rotation arount Z-axis to avoid gimbal lock.

sentences:
ScriptableObject referencing a gameobject in scene What I'm using for the scriptableobjects that requires a reference of a gameobject in scene is for scheduling events like for moving. Meaning a scriptableobjects should have a gameobject or waypoint for an npc to go to.

Is there a workaround to scriptableobject to have reference of a gameobject in scene? Or are there any better ways to do this?

sentences:
How can I create a 2D sprite shadow like in "Alto's Odyssey"? I've seen that the game "Alto's Odyssey" has a very nice way of projecting shadows on the ground the player is sliding on:

How could i replicate that?
Would I use some shader magic, or by projecting a 3D mesh/image on the ground plane?

sentences:
Unity how to save the number of successive wins? I'm making a trivia game on Unity, everything works fine and now I'm trying to save and retrieve the stats of a game. I have listed most of the stats (score, highscore, points) but now I would like to add the best series of consecutive correct answers, and I don't know how I can exactly set this value.

In theory I know that during the game when a correct answer is given, a counter is triggered to record the number of consecutive correct answers and it stops at the wrong answer. Then at the next triggered series the method checks if the new count is the best. But, as I'm a beginner, I don't know how I can save this kind of streak.

Could you help me please?

In order to understand the context:

public class ansButtonScript : MonoBehaviour {

public Text txt;
public Sprite im_basic, im_corr, im_wrong;

#region Pts&Score
    public int points = 1;
    string _allPts = "totalPts";
    static int totalPts;
    static int score = 0;
    string _score = "score";
    static int hiscore = 0;
    string _hiScore = "hiScore";
#endregion

public AudioClip sound_win, sound_loose;
public GameObject correctTxt, wrongTxt;

#region Cache Refs
public GameObject _canvas, _barInt;
private qManager _qManagerCanvas;
private progBarScript _progBarInt;
private countdownScript _barCountdown;
#endregion

public void Start()
{
    totalPts = PlayerPrefs.GetInt(_allPts);

    _qManagerCanvas = _canvas.GetComponent<qManager>();
    _progBarInt = _barInt.GetComponent<progBarScript>();
    _barCountdown = _barInt.GetComponent<countdownScript>();
}

public void updateTxt(string str_text)
{
    txt.text=str_text;
    GetComponent<Image>().sprite = im_basic;
}

public void SelectButton()
{
    if(_qManagerCanvas.canPlay)
    {
        _progBarInt.barTimeStop();
        _qManagerCanvas.canPlay = false;
        string reponse = _qManagerCanvas.reponse;

        if(transform.Find("Text").GetComponent<Text>().text == reponse)
        {
            //good answer
            GetComponent<AudioSource>().PlayOneShot(sound_win);     //SFX Win
            vraiTxt.SetActive(true);                                //animation Correct
            updateTrue();                                           //the answer is shown
            StartCoroutine(addPoints());
            StartCoroutine(next_question());                        //new question
        }
        else
        {
            //wrong answer
            GetComponent<AudioSource>().PlayOneShot(sound_loose);
            fauxTxt.SetActive(true);
            updateFalse();                                      //the answer isn't shown
            StartCoroutine(next_question());                    //new question
            _barCountdown.ResetTimer();
        }
    }
}

IEnumerator addPoints()
{
    yield return new WaitForSeconds(2.2f);
    playerStats.UpMoney += points;
    score++;                                    //set the nb of correct answers
    saveAllPts();                               //save the nb of points
    PlayerPrefs.SetInt(_score, score);          //save the nb of corr answers
    SaveBestScore();                            //save best score
}

IEnumerator next_question()
{
    yield return new WaitForSeconds(3f);
    _qManagerCanvas.tirage();
    _barCountdown.ResetTimer();
    correctTxt.SetActive(false);
    wrongTxt.SetActive(false);
}

public void updateTrue()
{
    GetComponent<Image>().sprite = im_corr;
}
public void updateFalse()
{
    GetComponent<Image>().sprite = im_wrong;
}

public void SaveBestScore()
{
    if (score > PlayerPrefs.GetInt(_hiScore))
    {
        PlayerPrefs.SetInt(_hiScore, score);
    }
}

public void saveAllPts()
{
    totalPts += points;
    PlayerPrefs.SetInt(_allPts, totalPts);
}
}

sentences:
Why does the kinematic body move in opposite direction after I interpolate its movement, and how do I fix it? I have added some basic movement and some manual interpolation to a cube that is a kinematic body in Godot.
extends KinematicBody

var speed : int = 10
var slowdown_buffer = 0.2
var movement = Vector3(0,0,0)
func _ready():
    pass

func interpolate():
    if movement.x > 0:
            movement.x -= slowdown_buffer
    elif movement.x < 0:
        movement.x += slowdown_buffer
    else:
        movement.x = 0.0
func _physics_process(delta):
    if Input.is_action_pressed("left"):
        movement.x = -speed
    elif Input.is_action_pressed("right"):
        movement.x = speed
    else:
        interpolate()

    move_and_slide(movement)

The problem is that when I move the cube using A and D, after the cube stops after the interpolation, it starts moving in the opposite direction with a non-increasing speed.
How can I fix this?

sentences:
Procedural sketch / painting shader So after some google searching apparently I don't even know what this technique is specifically called:

I'm trying to figure out how to create an effect in unity that 'paints' a 2d asset on screen.

By paint, I mean animates brush strokes, eventually 'revealing' the final image. (Start with outlines, then colors)

What is the conventional name for a technique like this, and where would I get started going about creating this kind of effect?

I am not talking about a shader / filter that simply adds a 'painted' or 'hand drawn' effect to an image, but one that simulates actually 'painting' it.

sentences:
Unity: When attaching my custom camera script camera shakes when player starts to move fast Here is my player code.

Rigidbody rb;

Vector3 currMovement;
public float jumpSpeed = 10;
public float moveSpeed = 10;
public float rotSpeed = 180;

float distToGround;

public float posSmoothTime = 0.5f;
float currPos;
float targetPos;
float posVel;

public float rotSmoothTime = 0.5f;
float currRot;
float targetRot;
float rotVel;

void Start()
{
    rb = GetComponent<Rigidbody>();
    distToGround = GetComponent<Collider>().bounds.extents.y;
}

bool isGrounded() { return Physics.Raycast(transform.position, Vector3.down, distToGround + 0.1f); }

void Update()
{
    Move();
}

void Move()
{
    // Rotation smoothing.
    targetRot = Input.GetAxisRaw("Horizontal") * rotSpeed * Time.smoothDeltaTime;

    if (targetRot > 360)
        targetRot -= 360;
    if (targetRot < 0)
        targetRot += 360;
    currRot = Mathf.SmoothDampAngle(currRot, targetRot, ref rotVel, rotSmoothTime * Time.smoothDeltaTime);

    transform.eulerAngles += new Vector3(0, currRot, 0);

    // Movement smoothing.
    targetPos = Input.GetAxisRaw("Vertical") * moveSpeed;

    currPos = Mathf.SmoothDamp(currPos, targetPos, ref posVel, posSmoothTime * Time.smoothDeltaTime);
    currMovement = new Vector3(0, 0, currPos);
    currMovement = transform.rotation * currMovement;

    if (isGrounded())
    {
        if (Input.GetButtonDown("Jump"))
            rb.velocity += Vector3.up * jumpSpeed;
    }

    rb.position += currMovement * Time.smoothDeltaTime;
}

I have a Rigidbody attached to my player. I think the problem is with my camera script. Here is my camera script.

public Transform player;
Quaternion targetLook;
Vector3 targetMove;
public float smoothLook = 0.5f;
public float smoothMove = 0.5f;
public float distFromPlayer = 5, heightFromPlayer = 3;
Vector3 moveVel;

void LateUpdate()
{
    CameraMove();
}

void CameraMove()
{
    targetMove = player.position + (player.rotation * new Vector3(0, heightFromPlayer, -distFromPlayer));
    transform.position = Vector3.SmoothDamp(transform.position, targetMove, ref moveVel, smoothMove);

    targetLook = Quaternion.LookRotation(player.position - transform.position);
    transform.rotation = Quaternion.Slerp(transform.rotation, targetLook, smoothLook);
}

}

The player is not an parent of my camera. When I parent the player to my camera the shake stops. But I want a custom smooth camera movement with my custom scirpt, so I can't make the player a parent of the camera.

sentences:
Help with transform.lookat and camera? Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
transform.LookAt(mousePos);

This will actually make the camera follow the mouse, but it goes crazy, the camera seems to spin in circles rapidly : here is actually a gif of what is happening. https://gyazo.com/952da6c28e644b7b0e6500a597b6804e/preview Could anyone help me figure how how to fix it?

sentences:
Large resolution differences I want to develop a game on multiple devices such as PC, Android or IOS.
Want it to be in 1080p, but that means a massive scale down for the smartphones.

I know how to do that, just render everything on a 1080p rendertarget and then render it on the screen smaller.

But what should I do so that the scalling down doesn't look bad and blury?
I can't do it vector based or anything because the sprites simply need a specific size.
Should I make the sprites power of two size to get some nice mipmapping? And which other settings can I do?

Or should I rather go with a lower resolution but then having a little bit worse look PC version? The performance seems not to be a problem for me, so would be sad not using 1080p because of other problems.

sentences:
How to get tilemap transparency color working with TiledLib's Demo implementation? So the problem I'm having is that when using Nick Gravelyn's tiledlib pipeline for reading and drawing tmx maps in XNA, the transparency color I set in Tiled's editor will work in the editor, but when I draw it the color that's supposed to become transparent still draws.

The closest things to a solution that I've found are -

1) Change my sprite batch's BlendState to NonPremultiplied (found this in a buried Tweet).

2) Get the pixels that are supposed to be transparent at some point then Set them all to transparent.

Solution 1 didn't work for me, and solution 2 seems hacky and not a very good way to approach this particular problem, especially since it looks like the custom pipeline processor reads in the transparent color and sets it to the color key for transparency according to the code, just something is going wrong somewhere.  At least that's what it looks like the code is doing.

TileSetContent.cs
    if (imageNode.Attributes["trans"] != null)
        {
            string color = imageNode.Attributes["trans"].Value;
            string r = color.Substring(0, 2);
            string g = color.Substring(2, 2);
            string b = color.Substring(4, 2);
            this.ColorKey = new Color((byte)Convert.ToInt32(r, 16), (byte)Convert.ToInt32(g, 16), (byte)Convert.ToInt32(b, 16));
        }
        ...

TiledHelpers.cs
    // build the asset as an external reference
            OpaqueDataDictionary data = new OpaqueDataDictionary();
            data.Add("GenerateMipMaps", false);
            data.Add("ResizetoPowerOfTwo", false);
            data.Add("TextureFormat", TextureProcessorOutputFormat.Color);
            data.Add("ColorKeyEnabled", tileSet.ColorKey.HasValue);
            data.Add("ColorKeyColor", tileSet.ColorKey.HasValue ? tileSet.ColorKey.Value : Microsoft.Xna.Framework.Color.Magenta);
            tileSet.Texture = context.BuildAsset<Texture2DContent, Texture2DContent>(
                new ExternalReference<Texture2DContent>(path), null, data, null, asset);
       ...

I can share more code as well if it helps to understand my problem.  Thank you.

sentences:
Unity PNG sequence animation changing position in animation We are making frame by frame animation and we have a canvas size for animation. Attack animation is changing position in canvas. In Unity after the attack animation is completed it teleports back to the initial position.
I tried setting animation event and updating parent position but it does not work. It teleports to nonsense locations like player is looking at +x but it teleports to -x. Anybody have solution for this? Since it is not rigged, root motion is not working.
I tried to put animation event at the last frame and put this script to the character controller which is a child object of empty parent object:
public void animationFinished(){
 animation_finished = true;
}

 void LateUpdate () {
 if(animation_finished ) {

     transform.parent.position = transform.position;
     transform.localPosition = Vector3.zero;
 }
}

I have 25 PNG as frames of animations. From idle animation I go to attack animation. Idle is stable as a position, but attack animation is changing position in canvas for example animation canvas is 1920x1080 canvas size and animation starts from the left size to right size. I can't move the character with a script because it has its own timing that I can't set up with script. So I am trying to get the last frame position and pass it to idle animation at that position but instead of that without code it teleports back to the initial position after attack is completed.
This is a similar topic, but the solution did not work.

sentences:
Desaturate texture using mask in OpenGL 2 I have a very large texture i am using as background and i want to apply a filter to a small part of it, the "small part" is defined by the alpha layer of another texture i have (which is still RGB8888), i am not sure what's the best approach to do this. I'd like to keep the same (very simple) shader i am already using for other sprites, which is similar to the basic one, i.e.:

precision mediump float;
uniform sampler2D uTexture;
varying vec2 vTexPos;
void main() {
  gl_FragColor = texture2D(uTexture, vTexPos);
}

So, i have some questions

How can i apply my filter only to "masked" region and avoid drawing others?
Do i have any performance loss if i draw the big texture again once loaded to just apply it to a small portion of the screen?
Can i map a second texture to the shader and use something like "if uTexture2 != null" -> apply as mask? Will this give me any performance gain compared to using a second shader?
Both textures are premultiplied, how should i handle alpha masking?

What id like to do is something like this (original, mask, result):

My environment is Android 4.0, im using GLES20.

sentences: Render TIny.x bones in Direcx 9 I would like to render the bones of the Tiny.x animated mesh.  I know there are 35 bones, and I know their names, but I'm having trouble with each bone's matrix.  Do I need to convert the matrix with d3dxvec3transformcoord function, or can I use the .m41,.m42,.m43 on the vertex buffer ?

sentences:
How do I get pygame to work on intel processor? I downloaded Python 3.4 64 bit IDE and pygame but whenever I tried installing pygame it would say "Not supported on Intel".
So are there version of pygame available for Intel processor or are there any other ways to install pygame on an Intel processor?????

sentences:
Changing transform of ParticleSystem makes it not play? Unity 2018.2.9f1, only 1 script, there is no other code. The scene is very simple (I just started).

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the TapEffect's GameObject X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }

    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Here is a screenshot of the TapEffect Particle, default particle.

This is a view of the Player GameObject selected.

sentences: Unity - Fading mesh particles Is there any ways to fade mesh particles like color over lifetime method with addictive shader. I have little to no understandings of shader coding, and fade rendering issue kicks in even with vertex color shader. Any idea guys?

sentences:
Preventing the mouse from breaking keyboard navigation in UI? I am trying to achieve the following, a behavior like Windows Explorer where mouse and keyboard play nice together.

Here's a GIF along explanations:

first I click one of the folders using the mouse
second I click the background area, folder is not focused but still selected
third I move to the next folder below using the keyboard

To sum it up, mouse and keyboard play well together.

Now in Unity it's an entirely different story, here is a fairly simple menu created using the actions in Hierarchy context menu, nothing special:

Here's what happens:

I click one of the buttons using the mouse
I move down to the next button using the keyboard
I click in the blank area, button loses focus
I try to move down to the next button using the keyboard, nothing happens

I have tried a couple of things like disabling Raycast target on images, disabling background panels or making them opaque but without success.

How can one make Unity UI behave like Windows Explorer's one ?

(where clicking in the blank area with the mouse does not break keyboard navigation)

sentences:
UI Button Click Animation We have animation states for Normal, Highlighted, Pressed and Disabled. How to set animation when a button is clicked?(after button released not pressed)?

Thanks in advance

sentences:
Separating game logic and rendering logic in separate static libraries I'm trying to write a game in C++ using OpenGL. I've tried to separate my game logic and my rendering logic as much as possible, and up until now, this has worked for me. I haven't written a lot of code, and right now, I'm getting to the point where I have all my separate parts, and I'm trying to put them together.

In order to keep game and rendering logic separated, I've written them both in separate static libraries (So I have a libCore and a libRendering. There's also a third static library that contains code that is shared between the two libraries (Things like utility methods for reading files, custom exceptions, ...), this library is called libShared. Both of my libraries (libCore and libRendering) are first linked against libShared and then the game executable is linked against libCore and libRendering.

I've been using an entity-component-system (Which is part of libCore) to keep track of all my entities, now I'd like to introduce a RenderingComponent which contains all the data necessary for actually rendering an object (Things like VAO's, VBO's, Textures, Normal Maps, ...).

The problem is, that doing this would bring part of the rendering code into the game logic code. And I'm wondering what the best course of action would be here.

Should I move the ECS into libShared?

Should I just create a single libEngine that I can link my game against, instead of 3 different libraries?

Do you have any other solutions?

Note: I do realize that separation of game and rendering logic has been discussed before, my question is specifically about the architecture of the various libraries I have layed out in this question, and other peoples' opionions on it.

To clarify what I mean, here's what my CMakeLists.txt looks like (They're actually separate files, but I'll keep them together for simplicity's sake).

...

add_library(Shared ${SHARED_HEADER_FILES} ${SHARED_SOURCE_FILES})

...

add_library(Rendering ${RENDERING_HEADER_FILES} ${RENDERING_SOURCE_FILES})
target_link_libraries(Rendering Shared ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLFW_LIBRARY})

...

add_library(Core ${CORE_HEADER_FILES} ${CORE_SOURCE_FILES})
target_link_libraries(Core Shared ${LUA_LIBRARIES})

...

add_executable(Game ${GAME_HEADER_FILES} ${GAME_SOURCE_FILES} src/main.cpp)
target_link_libraries(Game Core Rendering)

Second Note: If this is better suited for Code Review or Software Engineering StackExchange, I'll happily move my question over there.

sentences:
Getting the height of Keyboard on Android Hi I need to know the height of my keyboard so I can move up some textfield I have in my app. I'm using cocos2D-X but the app don't recognize the keyboardWillShow method.

Thanks

sentences:
Unity hangs when saving prefab asset For game saving purposes, I'm keeping track of references to ScriptableObjects through a lookup table, so that I can serialize/deserialize using the SO's position in that table. I have a lot of individual SOs that I want to be able to serialize, so I wrote an editor script to populate that table automatically. The table exists in a MonoBehaviour on a prefab.
Originally, I wasn't saving the prefab, because in the inspector it looked like the changes were successfully applying. However, those were showing in-memory changes; when you open the asset, the changes don't exist. The problem is, when I added the line to save the asset (PrefabUtility.SavePrefabAsset) Unity started hanging at the end of every import while showing that it was importing SO Lookup Table. I feel like I'm missing something obvious here, but Google hasn't been any help. What's wrong with my code?
Here's the editor script. Every time assets finish loading, it adds any ScriptableObjects that aren't in the lookup table and exist in one of the specified directories, and removes any that were deleted from or moved out of those directories.
public class SOLookupTableAutoPopulator : AssetPostprocessor
{
    const string SO_LOOKUP_TABLE_PATH = "Assets/Prefabs/SO Lookup Table.prefab";

    // every ScriptableObject in these directories is automatically added to the lookup table prefab
    static readonly string[] DIRECTORIES_TO_TRACK = new string[]
    {
        "Assets/ScriptableObjects/ExampleDirectory1",
        "Assets/ScriptableObjects/ExampleDirectory2"
    };

    static void OnPostprocessAllAssets (string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        var lutPrefab = AssetDatabase.LoadAssetAtPath(SO_LOOKUP_TABLE_PATH, typeof(GameObject)) as GameObject;
        var soLookupTable = lutPrefab.GetComponent<SOLookupTable>();

        // remove first in case asset moved between two tracked directories
        foreach (var path in pathsInTrackedDirectories(deletedAssets.Concat(movedFromAssetPaths)))
        {
            soLookupTable.LookUpTable.RemoveAll(o => o.Path == path);
        }

        var toAdd = pathsInTrackedDirectories(importedAssets.Concat(movedAssets))
            .Where(p => AssetDatabase.GetMainAssetTypeAtPath(p).IsSubclassOf(typeof(ScriptableObject)));

        foreach (var path in toAdd)
        {
            if (!soLookupTable.LookUpTable.Any(o => o.Path == path))
                soLookupTable.LookUpTable.Add(new ScriptableObjectPathTuple(path));
        }

        PrefabUtility.SavePrefabAsset(lutPrefab);
    }

    static IEnumerable<string> pathsInTrackedDirectories (IEnumerable<string> pathList)
    {
        return pathList.Where(p => DIRECTORIES_TO_TRACK.Any(d => p.StartsWith(d)));
    }
}

The lookup table looks like this:
public class SOLookupTable : MonoBehaviour
{
    public List<ScriptableObjectPathTuple> LookUpTable;

    public int GetID (ScriptableObject so)
    {
        return LookUpTable.FindIndex(o => o.Asset == so);
    }

    public ScriptableObject GetSO (int id)
    {
        return LookUpTable[id].Asset;
    }
}

And here's the class that the lookup table contains. I track the path in addition to the asset itself for the deletion phase of OnPostprocessAllAssets - you can't retrieve an asset from a path that points to a deleted asset.
[Serializable]
public class ScriptableObjectPathTuple
{
    public ScriptableObject Asset;
    public string Path;

    public ScriptableObjectPathTuple (string path)
    {
        Path = path;
        Asset = AssetDatabase.LoadAssetAtPath(path, typeof(ScriptableObject)) as ScriptableObject;
    }
}

sentences:
Unity Script and game not syncing after player respawn I have a health system for my player that looks like this:

public int fallBoundary = -10;
public int Health;
public int numOfHearts;

public Image[] hearts;
public Sprite fullHeart;
public Sprite emptyHeart;

void Update() {
    if(Health > numOfHearts) //Health script works, why does heart display not?
    {
        Health = numOfHearts;
    }

    for (int i = 0; i < hearts.Length; i++) {
        if (i < Health) {
            hearts[i].sprite = fullHeart;
        } else {
            hearts[i].sprite = emptyHeart;
        }

        if (i < numOfHearts) {
            hearts[i].enabled = true;
        } else {
            hearts[i].enabled = false;
        }
    }
}

Unfortunately, after respawn, the hearts do not sync anymore. My debugging showed, that the elements of hearts still did their job, resetted and got replaced correctly. However, in my game, nothing changes after the respawn (should reset to full health and change if player gets damaged). For the respawn, I am loading my prefab, which I also checked (everything is there). To avoid confusion: my hearts never reset to 0, but stay at 1.

Player Prefab that loads during respawn

Hearts after respawn

sentences:
Find position in arc depending on the direction of the agent So what I am trying to do is to find a random point on the (green") arc around the enemy:

Sorry for  the bad drawing but

Red (no go)
Green ( Points the allied can go to)

I know that unity has the following function:
Radius = 5;
_randomDirection = (Random.insideUnitCircle * _target.position).normalized;
Vector3 finalPosition = _target + _randomDirection + Radius;

However, this is for a full circle. How can I achieve the closest half circle?

sentences: Always operate at Time.timeScale = 1? How do I make a specific script always operate at Time.timeScale = 1 no matter what? I want it to override even when another script calls Time.timeScale = 0 for example.

sentences:
D3D11InfoQueue Isn't filtering out messages I have followed the Coordinator's code advice from this page on how to query and filter the messages in the debug layer but it doesn't seem to be working. You can see from the following code that I try to filter out 2 messages but they still keep zinging by in debug output. Does anyone know how to do this correctly? Here is the code:
void CDebugLayer::CreateD3DDebugLayer(void)
{
    if(SUCCEEDED(s_pApplication->m_spEngine->GetD3DObj()->m_spD3DDevice.Get()->QueryInterface( __uuidof(ID3D11Debug), (void**)s_spD3DDebug.GetAddressOf())))
    {
      if(SUCCEEDED(s_spD3DDebug.Get()->QueryInterface( __uuidof(ID3D11InfoQueue), (void**)s_spD3DInfoQueue.GetAddressOf())))
      {
         #ifdef _DEBUG
             s_spD3DInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true);
             s_spD3DInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR, true);
             //s_spD3DInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING, true);
             //s_spD3DInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_INFO, true);
             //s_spD3DInfoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_MESSAGE, true);
         #endif

         D3D11_MESSAGE_ID stHide [] =
         {
             D3D11_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS,
             D3D11_MESSAGE_ID_OFFERRELEASE_NOT_SUPPORTED
             // Add more message IDs here as needed
         };

         D3D11_INFO_QUEUE_FILTER stFilter;
         memset(&stFilter, 0, sizeof(stFilter));
         stFilter.DenyList.NumIDs  = _countof(stHide);
         stFilter.DenyList.pIDList = stHide;
         HRESULT hr = s_spD3DInfoQueue->AddStorageFilterEntries(&stFilter);
         assert(hr == S_OK);

         D3D11_INFO_QUEUE_FILTER stFilter2;
         memset(&stFilter2, 0, sizeof(stFilter2));
         SIZE_T ByteLength;

         // Perform debug tracking to confirm what is being stored
         uiNumMsgs = s_spD3DInfoQueue->GetNumMessagesAllowedByStorageFilter(); // = 7
         hr = s_spD3DInfoQueue->GetStorageFilter(&stFilter2, &ByteLength);
         assert(hr == S_OK);
         uiNumMsgs = s_spD3DInfoQueue->GetNumMessagesDeniedByStorageFilter();  // = 0

         //Pass copy to Application then store in CEngine for global engine access
         s_pApplication->m_spEngine->SetDebug(s_spD3DDebug.Get());
      }
    }
} // CreateD3DDebugLayer

EDIT
This is the error message I'm trying to filter out:
D3D11 INFO: ID3D11DeviceContext::OfferResources: OfferResources is not supported on operating systems older than Windows 8.  It is valid to call OfferResources, and an offerred resource must still be acquired with ReclaimResources before using it, however there is no benefit to calling OfferResources on this operating system besides testing the code path for Windows 8. [ EXECUTION INFO #3146071: OFFERRELEASE_NOT_SUPPORTED]
Caused by:
ID2D1DeviceContext->EndDraw()

on Windows 7 Sp1 x64. Using Windows SDK 8.1.

sentences:
Unity3D: 'Physics' does not contain a definition for 'Raycast' I'm a complete beginner in Unity 3D, and I'm following a video training. In the video the instructor uses the following code to open a door using raycast:

using UnityEngine;
using System.Collections;

public class HelloRaycasting : MonoBehaviour {

    bool doorClosed = true;

    // Use this for initialization
    void Start () {

    }

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

        Vector3 backward = new Vector3 ( 0, 0, -1);
        Vector3 origin = this.gameObject.transform.position;

        if (Physics.Raycast( origin, backward, 1f) && doorClosed) {
            doorClosed = false;
            GameObject.Find ("Left_Quad").transform.Translate ( new Vector3(-.8f, 0, 0));
            GameObject.Find ("Right_Quad").transform.Translate ( new Vector3(.8f, 0, 0));
        }
    }
}

It works just fine for him. But when I try to run this on my computer I get this error:

  Assets/HelloRaycasting.cs(20,29): error CS0117: 'Physics' does not
  contain a definition for 'Raycast'

In the end I'm not able to access none of the properties and methods of the Physics class.

I'm using Unity 5.3.2f1 (64-bit). What am I doing wrong?

sentences:
Is there a way to export all the images of my tweening effect in Flash? i'm using Flash to create the animation of my character in 2D (i'm just beginning). Is it possible to make a tween effect of a character, and then automatically export all the images/frames?

So far, it's a bit fastidious : i create my tweening effect, then i put a keyframe for each frame i want to copy and paste, then i select the movieclips and shapes and copy and paste them into another flash document, i position those clips at the exact same location as the previous image, then i erase the previous image and export the image... For 30 frames! Is there any faster way?

Thanks

sentences:
Units, Layers, and Isometric Ordering I'm currently using LibGDX and Tiled map editor to render isometric maps. I'm having a two related difficulties.

The first issue is, when do I render units that will end up changing position often and to which layer? At first I thought that I would render units with a wall layer so that walls behind of and in front of the unit are drawn correctly. However, the problem with this is that if a unit (i.e. a character) steps in front of say an object in some sort of top-level decoration layer, part of that object will be drawn on top of the unit.

The second issue is how to deal with layers that have static objects that units will often be stepping in front of or behind. Let's say you have a decoration layer where you will place trees. The problem with this layer is that depending on where some objects are placed in the layer, they will overlap inconsistently. For example, the following:

I know this is related to painter's algorithm, but I'm using LibGDX's tile map renderer so the extent to which I have control over drawing the map is rendering different layers at a time and switching out cells/tiles in a layer.

sentences:
Calculate the direction, From Outer Polygon Point to Inner Polygon inside Point I was able to find the co-ordinates of inner Polygon using this trick.

Need the co-ordinates of innerPolygon

But, I have some problem in getting the direction from Outer Polygon Point to Inner Polygon inside Point? See this image, I need to make sure that the direction should be from inner to outer.

sentences:
Fill all unallocated space with texture I have a system of bunkers underground, and I need to fill all the free space where there are no buildings - with earth. Yes, I can manually add a ground texture to the plane, but I have procedural level generation.
I thought there might be some kind of filter on the camera that I don't know about. Or maybe there are some other solutions?

sentences:
Finding the Balance - Income vs Expenditure I'm working on a game idea that uses an in-game currency, and basic business (income/outcome).

Basically, a certain type of building will generate 'income' per seconds until it hits a certain capacity (per building).

There are many different types of buildings, each with their own 'rate', 'income' and 'capacity', as well as 'cost to purchase building' in the first place.

I want to know if there is a good tactic, or strategy on how to balance this out? I don't want to make the purchasing of the buildings too easy - so the user has to only wait a few seconds ... thats pointless.

And on top of that - each building can be upgraded, which basically increases the 'rate', 'amount' and 'capacity' - with each upgrade increasingly getting more expensive - however this is relative as the user is now getting more cash flow.

Thanks.

sentences:
How are lights rendered as geometry in deferred shading? So my problem is that: At the last stage of implementing this I had problem with this sentence, " the lights in the scene are rendered as geometry". What does this mean?
Why do I store depth info for the model in an earlier stage?
What is texture projection ?

I had try to read many tutorials, but every time I end up coming here because I find what I need.

sentences:
C99: Dynamic dispatch in math library depending on SIMD Say I am developing a Math library and I want it to be such that it will detect whether or not user's machine support SSE (and which version) and based on that, different functions will be called. I can think of three ways to implement that:

Have global function pointers in the library and let user call mathInit() i their source. When they do, figure out the hardware details and assign the function pointers to different functions.
Same, except instead of having global function pointers, put them in a struct which is returned by mathInit(). This way, user will have to call math.vec3Add(...) or similar.
Same as 1, but instead of having global pointers, make mathInit() a macro so that the function pointers will have local scope in user's main() function (and require mathInit() to be called from main()).

Is any of these methods preferable? Is there some other, better way?

sentences:
How can I reflect a point about a line in Unity? I am drawing a line using the line renderer in the following way:

public class MyLineRenderer : MonoBehaviour {
LineRenderer lineRenderer;

public Vector3 p0, p1;

// Use this for initialization
void Start () {
  lineRenderer = gameObject.GetComponent<LineRenderer>();
  lineRenderer.positionCount = 2;

  lineRenderer.SetPosition(0, p0);
  lineRenderer.SetPosition(1, p1);

}

}

From the image below, the line P0P1 is known and so is point A. How can a point B, which is the reflection of A about the line P0P1 be found?

sentences: SMR shadow fade by script? I want to make fade for my player shadow. I don't know if it's possible or not. In my skinned mesh render there is "Cast shadows" with four options "Off, On, Two sides, and Shadows Only". How to do it by a script ?

sentences:
Unity - Syncing/Downloading/overwriting files to a local folder accessed by the game when offline? I currently have a game/application (PC/Standalone only) made in Unity which features a multitude of buttons which all link to external webpages which open up in the user's browser window.
Recently my client expressed an interest in having an offline version, where all the online content is available locally offline, as their users regularly go offsite to areas without an internet connection and the buttons are then useless.
I have done a new version which has all the webpages, PDFs and videos saved off as local files and placed in a folder within the build folder, the buttons now use the following script to read the files from there instead -

public class URLOpener_OFFLINE : MonoBehaviour {

    public void relativeURL(string url)
    {
        Application.OpenURL(url);
    }
}

This works perfectly on a basic level.
However my client has expressed an interest in being able to update the offline content without having to make a new build each time or manually go and update the folder content.

So basically what I need is to be able to store all the offline files somewhere online, which can be overwritten as and when is needed.
Then I need some way of syncing the game with this online location (when the user is online), to pull down the latest files into the offline folder and overwrite the files in there, so the latest offline files are included when they go offsite to an area without internet.

Is this possible at all?  I am more than happy to pay for a plugin or service that would provide this sort of feature.

I already have a plugin for translated languages which essentially does this (https://www.assetstore.unity3d.com/en/#!/content/14884) - changes to the online spreadsheet containing all the text is pulled down when the game syncs.  But this is obviously a bit different to downloading actual files and placing them in a specific folder.

Any help or advice would be appreciated.

Many thanks in advance

sentences:
The tile cursor is not on the same tile I selected Here is the image, when I select the tile I want to paint, it paints in the correct box where I want it to be but the white cursor should also be in the same box but it is 2 units to the left? This really  makes it difficult to paint the tiles. I'm a beginner in unity and can't seem to fix this problem :(
Thank you for your help!

sentences:
What type of legal entity do I need for my game company in the USA? I'm the leader of a group of 4 of us that are contributing to a game and it has come to my attention that we will eventually need some kind of official title or something along those lines. We've agreed on a name, and we've already got a domain name and several back-end resources that I've set up under the brand as well.

I'm curious as to the steps needed to be taken to make it "official" and protect my assets. Is this something I'm best off worrying about closer to release?

I've looked at this post, and I was also taking a look at this page. However, I want some straight answers from people who may have been down similar roads in the past.

sentences:
Three points to normal notation (interpret the math) From: Euclidian Space: Planes, I see the formula:

  Convert Three points to normal notation

  N = (p1-p0) × (p2 - p0)

  d = -N • p0^2

  where:

  N = normal to plane (not necessarily unit length) d = perpendicular
  distance of plane from origin. p0,p1 and p2 = vertex points x = cross
  product

When calculating the distance to the origin from the plane (d)...
A) how is the p0 squared?
B) how do I resolve the dot product of the vector (-N dot p0^2) to scalar distance?

sentences:
Why don't game developers change game stories after launch? Game developers have shown willing to remove and add game features, change art assets and remake parts of their games in following updates, but why don't they ever change the plot? Some times parts are added to the story, but only as attachments, never revisions.

Why is plot thought as a feature beyond editing, even if it would enhance player experience just as much as any graphical update or gameplay tweak?

P.S.: I would like to ask for a game-narrative/writing/story tag, and they are just as important part of game development as game mechanics.

P.S.²: This is as broad a question as why not to release source code. Therefore I think it is not too broad for answering.

sentences:
Rigidbody not working properly I have two objects: a player and a wall.
The player is passing through the long side of the wall but it collided with the short side of the wall.
I want the player to collide with whole wall.

Here is the code:

sentences:
Understanding the ModelView Matrix I want to analyze the each component of my 4*4 ModelView Matrix.

I came to know that the starting 3*3 of ModelView Matrix stores rotation.

If i want my object to have no rotation with respect to camera so My ModelView Matrix looks like this

How to change my ModelView Matrix if i want to have NO Translation or Scaling ? Can anyone explain the Maths behind this

sentences:
How to use quaternion on another referential I'm new on Three.js and despite a mechanical background, I can't find how quaternion works: it's like it always refers on local part referential and not the global one.

I've illustrated it here : http://jsfiddle.net/ehsktuj2/13/

function applyRotation(){
    var redRotationQuaternion = new THREE.Quaternion();
    redRotationQuaternion.setFromAxisAngle( new THREE.Vector3( 0, 1, 0 ), control.rotationSpeedRedY );
    applyQuaternion(_cubeRed, redRotationQuaternion);

    var greenRotationQuaternion = new THREE.Quaternion();
    greenRotationQuaternion.setFromAxisAngle( new THREE.Vector3( 0, 0, 1 ), control.rotationSpeedGreenZ );
    applyQuaternion(_cubeGreen, greenRotationQuaternion);
}

function applyQuaternion(cube, quaternion){
    var cubeQuaternion = cube.quaternion;
    cubeQuaternion.multiplyQuaternions(quaternion, cubeQuaternion);
    cubeQuaternion.normalize();
}

The rotation quaternion of the green box is via the vector (0,0,1) but it's not in the global referential, it's the one of the projected referential of the green cube.

How can I project the quaternion back on the global referential? So that the green cube rotates via the (0,0,1) vector of the scene?

sentences:
LibGDX camera position shifted on movement I'm programming a game with LibGDX and Box2D and I want my camera to follow my player. But as I zoom in (because Box2Ds metric system, using camera.zoom = x) the camera is shifted when the player moves (the camera follows the player):

Shifted View

Normal View

That only happens when the player moves, so there can't be a problem with the coordinates. My Question is how to remove this shifting as the player moves.

Here's some of my code:

Render Loop (excerpt):

@Override
public void render(float delta) {
    //set the camera position to player's position
    cam.position.set(player_body.getWorldCenter().x, player_body.getWorldCenter().y, 0);
    cam.update();

    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    world.clearForces();

    handleInput();

    Gdx.gl.glClearColor(.05f, .05f, .05f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(cam.combined);

    debugRenderer.render(world, cam.combined);

}

Make the player move:

if (Gdx.input.isKeyPressed(Keys.W)) {
    player_body.setLinearVelocity(transX, transY);
    player.setMoving(true);
}

sentences:
How to decide which GameObject should handle the collision? In any collision, there are two GameObjects involved right? What I want to know is, How do I decide which object should contain my OnCollision*?

As an example, let's suppose I have a Player object and a Spike object. My first thought is to put a script on the player that contains some code like this:

OnCollisionEnter(Collision coll) {
    if (coll.gameObject.compareTag("Spike")) {
        Destroy(gameObject);
    }
}

Of course, the exact same functionality can be achieved by instead having a script on the Spike object that contains code like this:

OnCollisionEnter(Collision coll) {
    if (coll.gameObject.compareTag("Player")) {
        Destroy(coll.gameObject);
    }
}

Whilst both are valid, it made more sense to me to have the script on the Player because, in this case, when the collision happens, an action is being performed on the Player.

However, what's making me doubt this is that in future you may want to add more objects that will kill the Player on collision, such as an Enemy, Lava, Laser Beam, etc. These objects will likely have different tags. So then the script on the Player would become:

OnCollisionEnter(Collision coll) {
    GameObject other = coll.gameObject;
    if (other.compareTag("Spike") || other.compareTag("Lava") || other.compareTag("Enemy")) {
        Destroy(gameObject);
    }
}

Whereas, in the case where the script was on the Spike, all you would have to do is add that same script to all the other objects that can kill the Player and name the script something like KillPlayerOnContact.

Also, if you have a a collision between the Player and an Enemy, then you likely want to perform an action on both. So in that case, which object should handle the collision? Or should both handle the collision and perform different actions?

I have never built a game of any reasonable size before and I'm wondering if the code can become messy and difficult to maintain as it grows if you get this sort of thing wrong in the beginning. Or maybe all ways are valid and it doesn't really matter?

Any insight is much appreciated! Thank you for your time :)

sentences:
How do I draw an animated object in OpenGL ES? I have a VBO, which I initialise like this (just an example):

- (void)setupVBOs {

    GLuint vertexBuffer;
    glGenBuffers(1, &vertexBuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);

    GLuint indexBuffer;
    glGenBuffers(1, &indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(Indices), Indices, GL_STATIC_DRAW);

}

As you can see, I'm  using GL_STATIC_DRAW, which is good for visually unchanging objects (not including translations and such).

How do I draw animated objects though? I mean things that might be changed by user interaction. This video is a good example. It is obvious OpenGL is being used, as the vertices are manipulated by gestures.

How is it done? by changing the x y z coordinates on every touch? Are they using GL_DYNAMIC_DRAW? Is this hard?

sentences:
Choosing a draw call when not reusing vertex data Up until now I've always used glDrawElements, and have my vertex and index buffers bound. From what I've read, glDrawElements is generally the way to go, and it works fine. However, I'm starting a new project and am questioning whether this is still the best fit.

For the current project, I'm recomposing a 2D scene from scratch every frame. The player's character runs around, and I only draw the part of the world that is visible, generating 2D quads from the map tiles and building the vertex/index buffers.

Given that (from my understanding) glDrawElements works best when you upload your VBOs and make multiple draw calls against them, wouldn't it be better to use something else in this case, such as glDrawArrays? I've generally read that glDrawArrays is slower, but given that I'm having to push the vertex data every frame anyway, that might not be true here.

I don't want to switch draw calls and assume I made the right choice when I could in fact be using it improperly to begin with, invalidating any performance improvements I see.

sentences:
Handling Latency in Multiplayer Shoot-em-ups I had an idea for an architecture, and I was wondering if anyone has implemented something like this or has used AWS or some other service to help?

I thought about using NodeJS + SocketIO to handle a server side for this cooperative shmup (think Raiden or Galaga) we are just starting to work on. We started to think about latency issues.

The solution I came up with was to spin-up/down servers at the mid-point of the 2 users playing with some epsilon value (say 300miles or something). Perhaps the server would allow up to 50 users to play simultaneously and after that it would deny requests, which would then spring up another server. This should cause latency to be about equal for the 2 users playing. Furthermore, if we are matching making users then we always pair the 2 closest users together.

I suppose there are other factors to consider like user skill level, but I think right now we are most concerned about latency since it directly affects gameplay. Actually our game does require fairly precise timing. Also we want users to be able to see each other shoot since cool animations happen when they are in sync with each other.

I suppose this is similar to how a fighting game might operate in terms of timing/precision.

Ideas? Thoughts? How have others approached this problem? Where can I start looking for examples?

sentences:
Getting the number of fragments which passed the depth test In "modern" environments, the "NV Occlusion Query" extension provides a method to get the number of fragments which passed the depth test. However, on the iPad / iPhone using OpenGL ES, the extension is not available.

What is the most performant approach to implement a similar behaviour in the fragment shader?

Some of my ideas:

Render the object completely in white, then count all the colors together using a two-pass shader where first a vertical line is rendered and for each fragment the shader computes the sum over the whole row. Then, a single vertex is rendered whose fragment sums all the partial sums of the first pass. Doesn't seem to be very efficient.
Render the object completely in white over a black background. Downsample recursively, abusing the hardware linear interpolation between textures until being at a reasonably small resolution. This leads to fragments which have a greyscale level depending on the number of white pixels where in their corresponding region. Is this even accurate enough?
Use mipmaps and simply read the pixel on the 1x1 level. Again the question of accuracy and if it is even possible using non-power-of-two textures.

The problem wit these approaches is, that the pipeline gets stalled which results in major performance issues. Therefore, I'm looking for a more performant way to accomplish my goal.

Using the EXT_OCCLUSION_QUERY_BOOLEAN extension

Apple introduced EXT_OCCLUSION_QUERY_BOOLEAN in iOS 5.0 for iPad 2.

"4.1.6  Occlusion Queries

Occlusion queries use query objects to track the number of fragments or
samples that pass the depth test. An occlusion query can be started and
finished by calling BeginQueryEXT and EndQueryEXT, respectively, with a
target of ANY_SAMPLES_PASSED_EXT or ANY_SAMPLES_PASSED_CONSERVATIVE_EXT.

When an occlusion query is started with the target
ANY_SAMPLES_PASSED_EXT, the samples-boolean state maintained by the GL is
set to FALSE. While that occlusion query is active, the samples-boolean
state is set to TRUE if any fragment or sample passes the depth test. When
the occlusion query finishes, the samples-boolean state of FALSE or TRUE is
written to the corresponding query object as the query result value, and
the query result for that object is marked as available. If the target of
the query is ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, an implementation may
choose to use a less precise version of the test which can additionally set
the samples-boolean state to TRUE in some other implementation dependent
cases."

The first sentence hints on a behavior which is exactly what I'm looking for: getting the number of pixels which passed the depth test in an asynchronous manner without much performance loss. However, the rest of the document describes only how to get boolean results.

Is it possible to exploit this extension to get the pixel count? Does the hardware support it so that there may be hidden API to get access to the pixel count?

Other extensions which could be exploitable would be debugging features like the number of times the fragment shader was invoked (PSInvocations in DirectX - not sure if something simila is available in OpenGL ES). However, this would also result in a pipeline stall.

sentences:
How can you extract orientation from a transformation matrix? I have a 4x4 transformation matrix M, and I want to find out the shape of a sphere when transformed by M. (Sphere is at the origin and has radius 1.)

I know I can find the center by just multiplying M by (0,0,0,1).

However, the radius becomes a problem as M can squash and rotate the sphere.  How can I find out the new radius(es) of the resulting ellipsoid?  Is there any way to find out the orientation?

More specifically, I need to know the size of the bounding sphere which would enclose the transformed sphere.  In other words, what is the maximum of |M*V - M*(0,0,0,1)|, where V is a unit vector (a point on the original sphere).

sentences:
Kryonet - Open a server locally only On the game I'm working on I wanted the singleplayer mode to use an integrated server to make adding more players via networking easier. The way I have it right now is I open a server and connects the client to my local address which works fine. But the problem is that if I play the game Singleplayer I don't want to leave anything exposed to the internet while only playing locally. Is there any way to limit the "range" of the server to only let communication happen via LAN?

Thanks in advance!

EDIT: I am using kryonet for networking. The game is written with LibGDX.

sentences:
HLSL Textured Light: outputs only a specific part of the texture (new problem) Problem 1

I am trying to create a spotlight that instead of giving the circle within the spotlight a simple color, applies a texture to it. However, where the texture is supposed to be is only a black circle: image.

Solution: the position I used for my texture wasnt correct.

old and faulty code:

float4 TexturedSpotlightPixelShader(VertexShaderOutput input, float2 TextureCoordinate : TEXCOORD0) : COLOR0
{
    //I left out all the other code in the shader, full code is at the bottom of the thread
    color = tex2D(SpotlightTextureSampler, TextureCoordinate);
}

better code that solved my 'black problem (but created a new one):

float4 TexturedSpotlightPixelShader(VertexShaderOutput input) : COLOR0
{
    //I left out all the other code in the shader, full code is at the bottom of the thread
    color = tex2D(SpotlightTextureSampler, input.Position);
}

where at that point input.Position was set to the worldPosition in the vertexshader (which turned out was the reason for problem 2)

Problem 2

My spotlight now applies the texture, however the texture is repeated multiple times in miniature, as such: image

Solution:
I added these lines in the vertex shader:

input.Position3D.w = 1.0f;
output.Position = mul(viewPosition, Projection);

and by adding/changing these lines in the pixelshader:

float2 TextureCoordinates;
TextureCoordinates.x =  input.Position.x / input.Position.w / 2.0f + 0.5f;
TextureCoordinates.y = -input.Position.y / input.Position.w / 2.0f + 0.5f;
color += tex2D(SpotlightTextureSampler, TextureCoordinates);

however, there was still a third problem.

Problem 3

The third and probably (I hope :P) the last problem, my spotlight now only shows a part of my texture and manually resizing the image (in the image file, not in my code) doesnt change what part of the texture is shown, as such: image

Solution:
In my vertexshader I used the 2D positions (viewmatrix multiplied with the projection matrix) where I should have used a viewmatrix not based from my camera but from my spotlights point of view (and a projection matrix also for my spotlight's point of view)

My new code:

float4x4 View2, Projection2;

VertexShaderOutput SimpleVertexShader(VertexShaderInput input)
{
//left out a lot of code here
output.Position = mul(mul(worldPosition, View2), Projection2);
}

Full Code

Link to the shader code and the link to the xna/c# code.

sentences:
Face culling all faces that cannot be seen I'm working on a simple 3d game using the Processing Java environment. I want to optimise my code so I can draw many many 'objects' (the world is made up of many different shaped objects that live inside the volume of a cube) without the framerate dropping. How can I detect which faces cannot be seen and stop drawing them? I have tried this code:

pgl = (PJOGL) beginPGL();
gl = pgl.gl.getGL2ES2();
gl.glEnable(GL.GL_CULL_FACE);
gl.glCullFace(GL.GL_BACK);

which does do backface culling but it is not all that I want. I want to stop rendering any face that the camera cannot see, i.e. inside faces etc.

The code used to draw the objects (just a simple cube for testing) is as follows:

    noFill();
    noStroke();
    noSmooth();
    push();
    lights();
    translate(this.x * this.size, this.y * this.size, this.z * this.size);
    beginShape(QUADS);
    texture(this.texture_image);
    vertex(-this.size / 2, -this.size / 2, this.size / 2, 0, 0);
    vertex( this.size / 2, -this.size / 2, this.size / 2, this.size / 2, 0);
    vertex( this.size / 2, this.size / 2, this.size / 2, this.size / 2, this.size / 2);
    vertex(-this.size / 2, this.size / 2, this.size / 2, 0, this.size / 2);

    // -Z "back" face
    vertex( this.size / 2, -this.size / 2, -this.size / 2, 0, 0);
    vertex(-this.size / 2, -this.size / 2, -this.size / 2, this.size / 2, 0);
    vertex(-this.size / 2, this.size / 2, -this.size / 2, this.size / 2, this.size / 2);
    vertex( this.size / 2, this.size / 2, -this.size / 2, 0, this.size / 2);

    // +Y "bottom" face
    vertex(-this.size / 2, this.size / 2, this.size / 2, 0, 0);
    vertex( this.size / 2, this.size / 2, this.size / 2, this.size / 2, 0);
    vertex( this.size / 2, this.size / 2, -this.size / 2, this.size / 2, this.size / 2);
    vertex(-this.size / 2, this.size / 2, -this.size / 2, 0, this.size / 2);

    // -Y "top" face
    vertex(-this.size / 2, -this.size / 2, -this.size / 2, 0, 0);
    vertex( this.size / 2, -this.size / 2, -this.size / 2, this.size / 2, 0);
    vertex( this.size / 2, -this.size / 2, this.size / 2, this.size / 2, this.size / 2);
    vertex(-this.size / 2, -this.size / 2, this.size / 2, 0, this.size / 2);

    // +X "right" face
    vertex( this.size / 2, -this.size / 2, this.size / 2, 0, 0);
    vertex( this.size / 2, -this.size / 2, -this.size / 2, this.size / 2, 0);
    vertex( this.size / 2, this.size / 2, -this.size / 2, this.size / 2, this.size / 2);
    vertex( this.size / 2, this.size / 2, this.size / 2, 0, this.size / 2);

    // -X "left" face
    vertex(-this.size / 2, -this.size / 2, -this.size / 2, 0, 0);
    vertex(-this.size / 2, -this.size / 2, this.size / 2, this.size / 2, 0);
    vertex(-this.size / 2, this.size / 2, this.size / 2, this.size / 2, this.size / 2);
    vertex(-this.size / 2, this.size / 2, -this.size / 2, 0, this.size / 2);

    endShape();
    pop();

Sorry for the long code.

Thanks in advance.

sentences:
Relative Position/Rotation calculation I have 2 objects each with a 3x3 Matrix (Orientation) and a Vector3 (Translation). Both are relative to world coordinates.

How do I calculate the position and orientation of object B in relation to object A?

I'm using the JVector, JMatrix that are a part of the Jitter3D physics library. (http://code.google.com/p/jitterphysics/)

Any help would be greatly appreciated!

sentences:
How do I use unpackHalf2x16? I'm trying to use (un)packHalf2x16, without success so far. I'm drawing with:

glVertexAttribIPointer(0, 2, GL_UNSIGNED_INT, 0, 0);
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glDrawArrays(GL_POINTS, 0, n_points);
glDisableVertexAttribArray(0);

and on the shader

#version 330 core
#extension GL_ARB_shading_language_packing : require
in uvec2 A0;
// (...)
vec4 t = vec4(unpackHalf2x16(A0.x), unpackHalf2x16(A0.y));

But nothing gets drawn. I'm pretty sure buffer's content is right, and if I use vec4 t = vec4(0); I can see it's working properly.
How is this packing / unpacking thing supposed to work? I can't find any example.

sentences:
Mixing Perspective and Orthographic Projections? I'm going to start with some background, so jump to my question at the bottom for the TLDR version.

Problem:

In a Japanese 4gamer article (english translation via Chev on Polycount) explaining some of the technology and design behind Guilty Gear Xrd (a highly-stylized, 2.5D, toon-shaded fighting game) they detail some of the challenges concerning the game's development. One of the challenges had to do with the use of an orthographic 2D collision detection system on top of 3D character models that were rendered in perspective. In short, rendering character models through a perspective projection would naturally result in the characters looking wider towards the edges of the camera. As such, at various points on the screen the visual representation of the characters would fail to accurately represent their 'hitboxes' and 'hurtboxes'.

Example 1: Models using perspective projection.

The character model for Player 2 (orange) more closely matches his collision data because of his location towards the center of the screen.

Example 2: Models using orthographic projection.

Using an orthographic projection, characters are accurately aligned with their collision data regardless of position. However, the desired visual effects of perspective are lost.

Their Solution:

The developers at Arc System Works solved this issues by creating a 'partial perspective' projection - a non-uniform mixture of perspective and orthographic (maybe parallel is more accurate) projections. On the horizontal axis, the camera's projection is said to be a '70% orthographic and 30% perspective' hybrid. On the vertical axis, the projection remains 100% perspective.

Example 3: Models using 'hybrid' projection.

Mixing perspective and orthographic horizontally allowed them to preserve collision alignment and visual spacing (an important aspect in competitive fighting games). At the same time, the 'fully perspective' projection on the vertical axis allowed them to achieve extra visual depth when the characters jump.

My Question:

How would one go about achieving this kind of non-uniform, semi-perspective, semi-parallel camera projection?

When I think about this, I can imagine a camera frustum with a wide vertical FoV and a somewhat more narrow (but not necessarily parallel) horizontal FoV. Is this the correct interpretation of what they're describing, or am I visualizing it incorrectly?

Typically how would you generate a projection/modelview matrix like this? Is there a way to ask libraries like OpenGL and Direct3D for non-uniform matrices like these, or is there some way to combine an orthographic matrix and a perspective matrix in a non-uniform way through matrix math?

sentences: How do I efficiently determine what objects are visible to a camera? I want to call the rendering methods of only the game objects that are visible. How can I efficiently determine which objects or tiles are within the camera's rendered region?

sentences:
Converting hexagon grid coordinate system I have been building a RTS game based on a hexagon grid in JavaScript and I stumbled across a problem regarding the coordinate system. I have been trying to implement an A-star system to find paths, but it seems that a horizontal hex grid could cause some problems so far when it comes to odd and even.

It was made horizontal as it is the way it is rendered to make all graphics not overlapping improperly.

So now to my question after some digging on the web. How do you convert between horizontal and 60 degrees coords?

I have tried this code, but it's not good enough, and I'm stuck at what I'm missing for my two functions GetWorldXpos and GetWorldYpos.

function DrawHex(context, hexagonData, isEven, x, y)
{
    var heightValue;

    heightValue =  GetIntNoDecimals(hexagonData.heightValue); //parseInt(hexagonData.heightValue, 10);

     //sets up so if the height of sea-levels is achived it should be equal level
    heightValue = CheckForLakeLevel(heightValue);

     //Gets color code depengin on height
     var colorCode = GetColorCode(heightValue, hexagonData.heightValue);

    if(isEven){
        //creates and draws object
        var hex = new HexagonObj(GetLargeMapXpos(x), GetLargeMapYpos(y), GetWorldXpos(x + 1, y), GetWorldYpos(x, y));
        hex.Draw(context, 0.99, lmapData.spaceing, colorCode, (heightValue), 0);

        //Adds data for usage how to draw other worl dependent objects
        lmapHeightData.push(new LargeGridData(GetLargeMapXpos(x), GetLargeMapYpos(y), GetWorldXpos(x, y), GetWorldYpos(x, y), heightValue));
    }
    else
    {
        //creates and draws object
        var hex = new HexagonObj(GetLargeMapXpos(x), GetLargeMapYpos(y) + lmapData.spaceing, GetWorldXpos(x, y), GetWorldYpos(x, y));
        hex.Draw(context, 0.99, lmapData.spaceing, colorCode, (heightValue), 0);

        lmapHeightData.push(new LargeGridData(GetLargeMapXpos(x), GetLargeMapYpos(y) + lmapData.spaceing, GetWorldXpos(x, y), GetWorldYpos(x, y), heightValue));
    }
}

//Gets what is the coordinate to be drawn on screen
function GetLargeMapXpos(x)
{
    var lgX = ((lmapData.posX + lmapData.spaceing) * x) + lmapData.areaPosX + lmapData.correctionX;
    return lgX;
}

//Gets what is the coordinate to be drawn on screen
function GetLargeMapYpos(y)
{
    return (lmapData.posY * y) + lmapData.areaPosY + lmapData.correctionY;
}

//Gets what is the coordinate for current hexagon
function GetWorldXpos(x, y)
{
    return (x + lmapData.cameraPosX) - ((y + lmapData.cameraPosY) * 2);
}

//Gets what is the coordinate for current hexagon
function GetWorldYpos(x, y)
{
    return y + lmapData.cameraPosY + (x + lmapData.cameraPosX);
}

Any suggestions?

sentences:
Recording the gameplay in the game itself? I'm presently working on a 3D car racing game for the iOS platform. I had to implement a replay system and then record that replay in a video file to upload it to YouTube.

I'm only having issues with the recording part, the rest is done. What I'm doing is using the glReadPixels() command of OpenGL ES 1.1 to capture the framebuffer content and creating a video from these frames during runtime (using AVFoundation framework).

The problem I'm facing is that I have to call glReadPixels() in each update which is very slow . It decreases the FPS from around 30 to only 2-3...
Is there any alternative to the glReadPixels() command?
Or did anyone create a replay system and recorded to video?

sentences:
What are good puzzle game interface design principles? I'm building a prototype puzzle game at the moment. I'm just curious as to the principles behind building graphic interfaces within games.
At the minute I'm looking at designing the graphics for an interface in something like Illustrator. I'm looking at one graphic (650 x 650 px) that incorporates the play area (400 x 550 px) as a blank square, with a nice border on the right hand side (vertically down the screen) and a border along the bottom too. I'm leaving a "blank" rectangle on the vertical border to incorporate a timer into it, and three "blank" squares along the bottom to incorporate icons to represent lives or power-ups or something, which I'll design later and animate later.
Is this an acceptable/sensible approach?

sentences:
How to give a Jerk Effect when the player is moving left of right float amttomove = Input.GetAxis("Horizontal") * playerspeed * Time.deltaTime;
            transform.Translate (Vector3.right * amttomove);

Currently, I have above script in Update function to move the object to left or right.But this movement is way smoother.To give it more realistic feel, I want it to have a slight jerk when it stops moving to left or right and not just stop right there and then.

What exactly needs to be done to have that effect?

sentences:
Voxel Game - High Memory and CPU Usage I am currently developing a voxel game and I had recently noticed that the game from startup is at around 2GB of memory. Currently I am rendering 14 x 14 chunks as shown:

I did a profile on the game and I noticed that the function call glfwSwapBuffers(...) takes 9,964 m/s to run (76.4%) and as the program's life continued it kept growing. The next function is glDrawElements() which takes 849 m/s to run (8.49%). I am unsure what is causing the bottleneck.

Going back to the high memory usage issue there are two things that seem to be causing high memory. As explained in this thread here: Voxel Game - Lag when camera is inside of the terrain
I generate the terrain once and since I posted that question, I create a mesh for each chunk made up of the visible vertices. After that I send each chunk entity to my renderer and it is drawn from these two blocks of code.

    for(Chunk[] chunks1D: chunks)
    {
        for(Chunk chunk: chunks1D)
        {
            //Model matrix
            Matrix4f modelViewMatrix = transformation.getModelViewMatrix(chunk.getEntity(), viewMatrix);
            shader.setUniform("modelViewMatrix", modelViewMatrix);
            //Render mesh
            shader.setMaterialUniform(chunk.getEntity().getMesh().getMaterial());
            chunk.getEntity().render();
        }
    }

which calls this

public Matrix4f getModelViewMatrix(Entity entity, Matrix4f viewMatrix)
{
    Vector3f rotation = entity.getRotation();
    Vector3f position = entity.getPosition();
    float scale = entity.getScale();
    modelMatrix.identity().translate(position).
        rotateX((float)Math.toRadians(-rotation.x)).
        rotateY((float)Math.toRadians(-rotation.y)).
        rotateZ((float)Math.toRadians(-rotation.z)).
        scale(scale);
    //Copy view matrix
    Matrix4f currentView = new Matrix4f(viewMatrix);
    modelViewMatrix = currentView.mul(modelMatrix);
    return modelViewMatrix;
}

and this

public void render()
{

    //Bind the VAO
    glBindVertexArray(vaoID);
    glEnableVertexAttribArray(0); //Vertex Data
    glEnableVertexAttribArray(1); //Colour data
    glEnableVertexAttribArray(2); //Normal data

    //Draw the vertices: mode: Triangles, count, type: integers, offset
    glDrawElements(GL_TRIANGLES, numVertices, GL_UNSIGNED_INT, 0);

    //Restore state
    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(2);
    glBindVertexArray(0);

}

From the profile I found two sources of high memory, one for Matrix4f which is due to the getModelViewMatrix(...) function (the memory usage grows over the programs lifespan) and another for float and float[] from the genChunkMesh(...) function as shown in my other thread (Voxel Game - Lag when camera is inside of the terrain) which is called once when a chunk is loaded. It seems as if for both cases that Matrix4f, float[] and float instances are being created by they are never released from memory. :/ I have tried looking everywhere for a solution but I can't find one... I feel my game is optimised well enough for what is being rendered and these problems shouldn't be occurring.

tldr: Simple voxel terrain gen requires high amounts of CPU and the culprit is glfwSwapBuffers which takes 9,694 m/s to run (grows over time). High memory usage also from Matrix4f, float and float[] (floats of which seem to be retained from chunk mesh generation) objects causing the game to use ~2Gb of memory from startup (14 x 14 chunks) each chunk contains its own mesh (containing a VAO which has all of the chunks visible vertices, normals and colours) and two 3D int arrays one for the chunk's blocks and one for the chunk's visible blocks (16 * 16 * 128) each storing the block ID at that location.

sentences:
How do I make a game object appear on the other side when it leaves the screen? I'm doing an assignment for a course and what's required is to include a moving asteroid in the game that starts moving in a random direction and when the asteroid leaves the bottom of the game window it should re-appear at the top of the game window
,so I wrote the script for warping and I applied it to the asteroid and a ship in my game ,then built it to WebGl game. the warping worked fine in the editor for both the ship and the asteroid, while it only worked for the ship in the built game, and I can't figure out what's wrong

this is the script

(ScreenUtils gives the borders of the screen)

float Radius;

void Start () {
    Radius = GetComponent<CircleCollider2D>().radius;
}
void OnBecameInvisible()
{
    // Make the ship wrap
    Vector3 position = transform.position;
    if (position.x - Radius >= ScreenUtils.ScreenRight || position.x + Radius <= ScreenUtils.ScreenLeft)
    {
        position.x *= -1;

    }
    if (position.y -Radius >= ScreenUtils.ScreenTop || position.y + Radius <= ScreenUtils.ScreenBottom)
    {
        position.y *= -1;
    }
    transform.position = position;
}

sentences:
Finding vectors with two points We're are trying to get the direction of a projectile but we can't find out how

For example:

[1,1] will go SE

[1,-1] will go NE

[-1,-1] will go NW

and [-1,1] will go SW

we need an equation of some sort that will take the player pos and the mouse pos and find which direction the projectile needs to go.

Here is where we are plugging in the vectors:

def update(self):

    self.rect.x += self.vector[0]
    self.rect.y += self.vector[1]

Then we are blitting the projectile at the rects coords.

sentences:
android game: how to approach mutliplayer I'm making a single player game that is near completion, and I am already starting to think about giving the game multiplayer.  The multiplayer would basically be finding someone to play against, likely in a waiting room or just have a match-making function, and then having a pokemon style battle between the people in real time.  I think it would be relatively simple as I'm just sending information about each attack(move chosen and damage) and what it did back and forth, but I'm not sure what resources to consult for this.  I am very new to Android/Java development and really just learning as I go.

I have heard a bit about Skiller, but I'm still unfamiliar with using other SDK's and how easy it may be.  Does anyone have any suggestions as to what SDK's or methods for accomplishing this.  I currently have no money to spend on software development, but I'd like to get started on learning how to do this.

sentences:
How do I prevent identity spoofing in a multiplayer game? I'm thinking about clients spoofing IP addresses, tricking other clients that they are the server; that sort of stuff. (I don't know much about this, so if this is completely wrong, please correct me.)

What should I do to prevent this? Because it is a real-time game, if I were to use encryption, I would use something fast and secure like RC4. Should I encrypt packet data with a key, that the server gives to the client?

If it makes any difference, I'm using UDP.

sentences:
Which Unreal Engine 4 project files can I ignore in source control? I want to put an Unreal Engine 4 project under source control with git. (I know the editor has Perforce and Subversion support, but I don't care for those.)

What folder and files do I include in the repository and which can I ignore?

The way I see it, the following is needed: Config, Content, Source, *.sln, *.uproject

Things that I can ignore: Binaries, DerivedDataCache, Intermediate, Saved, *.suo, *.sdf, *.opensdf

Is this correct?

sentences:
Making games on Structure programming language c or c++ I am learning structured programming language C.  I know about data type, control statements, loops, arrays, strings, functions, pointers, structures and STL.

My question is, if I want to make game in C/C++:

Which topics should I learn?
Do I need to learn more topics mentioned above?
Do I need OOP in C++?
Is this possible without advance C++ graphics programming?
What are the advantages of OOP C++ and graphics programming?
Is there anything I need more than C/C++?

sentences:
UE4 BlendSpace is not working as intended I am trying to set up a rifle aiming blendspace in UE4. I downloaded animations from Mixamo, added root bone and retargeted them to UE4. Then I set up the BS, but the legs of the character are behaving weirdly, they are twitching, going through each other. The animations work fine on their own, but behave that way in the BS, especially in the transition areas. Here is the video:
Video
Here is my BS:

Here is how I am setting Speed and Direction variables used in the BS:

Can someone please help me with this? I am new to UE4. How do I fix this and get a smooth Animation Blend Space?

sentences:
Proper opengl learning curve + tools My first post here, so at first i would like to say HI to everyone!

Had a course of computer graphics at my uni and got interested with opengl. Unfortunatelly we used it with java + jogl + some funky frameworks from our lecturers which provided us with all texturing etc. Now i want to switch to c++, because as i noticed all the tutorials are written in it.

My question is about additional libraries. Google told me that "OpenGL SuperBible V Comprehensive Tutorial and Reference" by Richard S. Wright will be helpful for the learning process and in the book they use GLEW + GLtools. Are those proper tools or should i start with something else? Maybe some other books? [yes i used search for online courses and books here, but maybe you have some tested and up to date positions]

sentences: How can I express Logarithmic and Arithmetic spirals as segmented cubic bezier curves? I am creating cubic bezier curves using this code from another question I asked. I would like to know how I can express Logarithmic and Arithmetic spirals as segmented cubic bezier curves.

sentences:
How to skip the sky in lighting shaders? I recently implemented a sky in my deferred rendered game. It is a procedurally calculated sphere with a texture applied to it. Unfortunately all lighting shaders (light sources, ambient occlusion) are applied to that sky dome geometry as well.

Therefore the sky is completely dark without a huge light source in the level. And if there is one, the edges between triangles of that sphere are darkened by the ambient occlusion shader.

My quick and dirty fix was to read the depth texture to determine whether the lighting effect should be applied or not. For example, the view distance is 1000.0f and every pixel with a depth higher than 900.0f isn't shaded anymore. That works partly since every pixel of the sky is between 900.0f and 1000.0f.

But there are some issues with this approach. For example level geometry further away than 900.0f isn't shaded, too. Moreover the depth values come from projecting the scene on a plane, the screen. That means that the distance to the sky, which is equally in all directions from the players world position, differs over the image. Sky seen on the sides of the screen is nearer than sky pixels seen in the center of the screen. That effect varies with the field of view setting. The issue with that is that for every field of view setting I would need different depth thresholds for shading.

Is there a common way to not, or differently, shade some pixels of the image? In my case, I would need to not shader sky pixels. If I could determine which pixel is from the sky, I could store that in a buffer and read from that in lighting shaders to skip those pixels. But I have no idea how to approach this.

sentences:
How to make collisions occur between objects using the same script? Well what I’m trying to do is have cars travelling on the road. The cars have a trigger at the front and a hitbox at the back of the cars. What I want to happen is when the trigger hits the hitbox it compares the Variables for speed of the two cars in the collision, i.e. the make the car at the back slow down or equal the speed of the car in the front. However, what I am having trouble with is referencing the speed of both cars and comparing them. This is due to them both being prefabs using the same script. Which I’m learning means that I’m just referencing the same script and not the actual values of the individual car. But how could I get round this? Is it possible to have collisions occurring between objects using the same script?

    private void OnTriggerStay2D(Collider2D collision)
    {
        Debug.Log("TriggerStay");

        GameObject collidedParent = collision.gameObject.transform.parent.gameObject; // get parent transform and then its gameobject
        Traffic Col_speed = collidedParent.GetComponent<Traffic>();

        if (speed > Col_speed.speed)
        {
            Accelerate = false;
            ApplyBreak = true;
        }
        else if (speed < Col_speed.speed)
        {
            Accelerate = false;
            ApplyBreak = false;
            speed = Col_speed.speed;
        }

        if (transform.position.y > collision.transform.position.y)
        {
            turn = turn + 1;
            Debug.Log(this.gameObject.name + "someMessage");

        }
        if (transform.position.y < collision.transform.position.y)
        {
            turn = turn - 1;
            Col_speed.turn = 0;
            Debug.Log(this.gameObject.name + "someMessage");

        }
    }
    private void OnTriggerExit2D(Collider2D collision)
    {
        turn = 0;
        Accelerate = true;
        ApplyBreak = false;
    }

}

sentences:
How to make a "GUI In Game"? My game is very GUI based, the way how it works is that I have a GUI class, which contains the basic GUI elements, a parent GUI object, and a copy of the main game's class object. The game starts out with the main GUI, which is the main menu, then when it wants to it takes something like the in game GUI, creates a object with the main menu's copy of the game and then the main menu object itself using this as the parent GUI. So when the in game GUI wants to, it can call back for the parent GUI to be used again.

Here is where the issue lays, the in game GUI needs to be a GUI, but also needs to contain this such as the level it's playing, the player, and all those things. How is this done?

Should I have approached my GUI based system differently? Because I can't somehow figure out of I would implement such a GUI without errors. How do you approach this? Or how would you approach this?

sentences:
XNA Seeing through heightmap problem I've recently started learning how to program in 3D with XNA and I've been trying to implement a Terrain3D class(a very simple height map). I've managed to draw a simple terrain, but I'm getting a weird bug where I can see through the terrain. This bug happens when I'm looking through a hill from the map. Here is a picture of what happens:

I was wondering if this is a common mistake for starters and if any of you ever experienced the same problem and could tell me what I'm doing wrong. If it's not such an obvious problem, here is my Draw method:

public override void Draw()
{
    Parent.Engine.SpriteBatch.Begin(SpriteBlendMode.None,
        SpriteSortMode.Immediate, SaveStateMode.SaveState);

    Camera3D cam = (Camera3D)Parent.Engine.Services.GetService(typeof(Camera3D));
    if (cam == null)
        throw new Exception("Camera3D couldn't be found. Drawing a 3D terrain requires a 3D camera.");

    float triangleCount = indices.Length / 3f;

    basicEffect.Begin();

    basicEffect.World = worldMatrix;
    basicEffect.View = cam.ViewMatrix;
    basicEffect.Projection = cam.ProjectionMatrix;
    basicEffect.VertexColorEnabled = true;

    Parent.Engine.GraphicsDevice.VertexDeclaration = new VertexDeclaration(
        Parent.Engine.GraphicsDevice,
        VertexPositionColor.VertexElements);

    foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
    {
        pass.Begin();
        Parent.Engine.GraphicsDevice.Vertices[0].SetSource(vertexBuffer, 0,
            VertexPositionColor.SizeInBytes);
        Parent.Engine.GraphicsDevice.Indices = indexBuffer;
        Parent.Engine.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,
            0, 0, vertices.Length, 0, (int)triangleCount);
        pass.End();
    }

    basicEffect.End();

    Parent.Engine.SpriteBatch.End();
}

Parent is just a property holding the screen that the component belongs to. Engine is a property of that parent screen holding the engine that it belongs to.

If I should post more code(like the initialization code), then just leave a comment and I will.

sentences:
My script to play the intro scene the first time the player hits play from the main menu wont work The script I am using determines if it is the players first time hitting the play button and if it is it will load the intro scene, but if they have played before it will take them strait to the game scene.
The problem is that it just takes them strait to the game scene.

public class SeenBefore : MonoBehaviour
{
    public string SceneName;

    AsyncOperation preload;

// Start is called before the first frame update
    void Start()
    {
        preload = SceneManager.LoadSceneAsync(SceneName);
        preload.allowSceneActivation = false;
    }

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

    }

    public void before()
    {
        if (PlayerPrefs.HasKey("HasSeenIntro"))
        {
        preload.allowSceneActivation = true;
        }
        else
        {
            PlayerPrefs.SetInt("HasSeenIntro", 1);
            SceneManager.LoadScene("Intro");

        }
    }
}

sentences:
Animation Change Delay When Landing On Ground I am working on a 2d platformer-like game in Unity. My problem is that when my player character jumps and lands back on the ground, there is a slight delay at times when transitioning to the player idle animation. This is not due to exit time. Instead, upon researching this topic, I found that my real problem lies in the Unity physics loop(FixedUpdate).

FixedUpdate, as the name implies, is called a fixed amount of times, not every frame. My animator relies on a Jumping boolean to tell it whether or not to be in the jumping animation. In my code, the Jumping boolean is set to false when the player lands on the ground. This is handled by OnCollisionEnter2D, which runs on FixedUpdate.

This is were I think my problem lies:

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Ground"))
    {
        _isOnGround = true;
        _animator.SetBool("Jumping", false);
    }
}

I need to know whether or not the player is colliding with the ground, So I setup a tag. I need to find a way to constantly check whether or not I am colliding with the ground, So that I do not see an animation transition delay.

Any Ideas of how I could accomplish this?

sentences:
How to track/identify amorphous blobs in 2D or 3D space In doing HTML/DOM work, you are working with concrete nodes which you can visibly touch and have a defined shape and boundary.

What I'm wondering though is like with a cloud like structure, or like a viscious fluid that is spraying like a geyser into the air and has big droplets of water, or maybe even like ocean waves.

A cloud doesn't have a clear boundary, it is more like a blend from one state to the next. But in your game you might say "hey there is a cloud right there" or "I just walked into a cloud". I don't see how the game can do that, how it identified something without a concrete, discrete ID! Likewise, an ocean wave doesn't have a clear boundary the same way a machine or a human being has a "boundary". A wave blends into the main water, and splashes away stuff, and is evaporating and all kinds of stuff. But you can still say in your game "there is a wave over there".

The question is, how that wave or that cloud is actually identified in the game. I would've thought initially to just create a "wave object" or a "cloud object", and have it move through the water or move through the sky. And maybe add some sort of sensor like stuff to it so it seemed like it was more amorphous than it's discrete representation under the hood.

But the thing is, a cloud or more generally a blob can subdivide/split/merge with others/etc. So it's so-called discrete identity is very... fluid. There's not really a centralized identity, there's just these blobs that come and go and change shape and stuff.

So I'm wondering how these sorts of things are treated in games that handle more advanced use cases. I'm new to quad-/octrees but maybe they are used somehow here. It seems like object motion tracking might have some insight but I'm not sure and most stuff I've seen is on clearly distinct objects like moving cars or people rather than clouds or waves or "blobs".

I am wondering because it's so far unclear to me how one might "iterate" through "a list of blobs". What counts as an "identity". (Not talking about things like FPS caring about individual pieces of glass or droplets of water, but maybe a puzzle game about blobs or something, or some scientific game). The blobs can merge and split and divide and such, then I wonder how often we are tracking their changes in shape. Or maybe there's ways to be notified when a "major event" occurs. I don't know.

Basically I'm wondering where I could look to learn more about how to handle amorphous "structures" in 2D or 3D worlds that are changing regularly like described. I am not sure if (so to speak) these blobs are given "unique IDs" and treated like database records, or if they are less structured (or if they can be this structured in some way).

sentences:
Using Box2d to model rotating turret I would like to model a rotating "turret" on top of a tank-like object in 2D from the side view like pictured here:

tank with turret http://uofitorn.net/static/images/tankwithbox2dturret.png

Notice the faint outline of a gun protruding to the upper left courtesy of libgdx's debug renderer (the actual gun sprite is not being rendered).

How do I best implement this using Box2d?  Should I use two bodies?  If so, how?  Or one body with two fixtures?

I tried using two bodies connected by a Revolute Joint, but the turret "gun" does not maintain a constant angle but instead rotates down until it is vertical and then just hangs there.

Or should I not model the turret aspect of the tank in box2d at all?

sentences:
Dirt compression from vehicle tires So I kinda have this working but its not correct because it just averages, so I wanted to know if anyone here has any ideas.

I'm trying to simulate loose dirt compression under the tires of a vehicle to reduce the potential bumpiness of 'chunky' terrain. Currently how I do this is that I have a bounding box shape around my tires, set a little lower so they intersect with the terrain.

Each frame, I (currently) average all of the heights of each point in the terrain that are within the box bounds of that tire, and then set them all to that average. Clearly this won't work in most cases because, for example, if i'm on a hill, the terrain will deform way too much.

One way I thought was to have a max and min amount the points could raise and lower but that still doesn't seem to work properly and sometimes looks more like steps than smooth dirt.

I wanna say that there is probably a bit more to this that what i'm currently doing but I am not sure where to look. Could anyone here shed some light on this subject? Would I benefit any by maybe looking up some smoothing algorith or something similar?

sentences:
Better streaming economy algorithm? Does anyone here have experience making games with streaming economies? I am working on a game and am looking for a better way to handle the economy.  I feel like there must be a better algorithm than what I am using.

Background:

ResourceBin objects contain resources
Settlement objects contain ResourceBin objects
Settlement objects have three queues of Building objects in arrays (Low, Medium, and High priorities)
Building objects have a nextTick() method that accepts a ResourceBin and modifies it

Right now on every tick the Settlement class will loop through all of the Building arrays starting with High and working towards Low.  On each Building object it calls the nextTick() method and passes its ResourceBin.  After making sure that the transforms won't cause any Resource to become negative, the nextTick() method modifies the ResourceBin and exits. If any of its transformations would cause a Resource to become negative it just exits.

The issue with this is that the entire system depends heavily on the order in which the buildings are processed.  I also can't have it proportionally affect the resource transformations if you are low on resources (like what is done in Total Annihilation).

Does anyone know how other games implement streaming economies?  Is there a better way to do this?

Also let me know in the comments if a code example would be useful. I can pastebin one if need be.

sentences:
Is there any way to convert .unr file? I'd like to examine a Harry Potter game for study purposes.
All of resources are fine except map file.
The maps are in a .unr file format. I know it is unreal map file.

Is there any way to convert .unr file to .fbx, .obj, or pskx formats?
I want to open map file to 3ds max or blender.

sentences:
Cost of Using Virtual Methods to Query Properties? Let's say you're making a tile-based roll-playing game, and you're obsessed with OOP.

You have an abstract base class Tile which will be inherited from by many derived classes, like Grass Sand and Water

The base class declares virtual methods for querying properties of derived classes, such as isCollidable() and isFlammable()

class Tile{
public:
 virtual constexpr bool isCollidable() = 0;
 virtual constexpr bool isFlammable() = 0;
};

class Grass:
public Tile{
public:
 constexpr bool isCollidable(){
  return false;
 }
 constexpr bool isFlammable(){
  return true;
 }
};

class Sand:
public Tile{
public:
 constexpr bool isCollidable(){
  return false;
 }
 constexpr bool isFlammable(){
  return false;
 }
};

class Water:
public Tile{
public:
 constexpr bool isCollidable(){
  return true;
 }
 constexpr bool isFlammable(){
  return false;
 }
};

When you want a new type of Tile you just create a new class, inherit from it, and implement it's virtual methods. Adversely, when you want a new property, you've to add is methods to all the classes.

My question is, what is the cost of using polymorphism in this way? Is this an inappropriate use of polymorphism? If so, What are some alternatives to this while maintaining nice, pretty OOP?

sentences:
Why would this scaling matrix have no effect? To draw a simple model using the DirectXTk, I'm doing the following.  It all works perfectly, draws correct, and so on.  Except changing the scaling factor makes NO difference, and I can't figure out why.

_MissileScale = 5.0f;
XMMATRIX GetWorldMatrix()
{
    XMMATRIX translation = XMMatrixTranslationFromVector(XMLoadFloat4(&_Position));
    XMMATRIX rotation    = XMMatrixRotationRollPitchYaw(_RotationX, _RotationY, _RotationZ);
    XMMATRIX scaling     = XMMatrixScaling(_MissileScale, _MissileScale, _MissileScale);

    return scaling * rotation * translation;
}

Then when I draw it, I ask for that matrix.  The rotation and translation work, but not the scaling.

        XMMATRIX mView = pCamera->GetViewMatrix();
        XMMATRIX mProj = pCamera->GetProjMatrix();
        XMMATRIX mWorld = pMissile->GetWorldMatrix();

        _ptrMissileModel->UpdateEffects([pCamera](IEffect* effect)
        {
            XMFLOAT3 ambientLightColor(0.5f, 0.5f, 0.5f);
            auto lights = dynamic_cast<IEffectLights*>(effect);
            if (lights)
            {
                lights->SetLightingEnabled(true);
                lights->SetPerPixelLighting(true);
                lights->SetLightEnabled(0, true);
                lights->SetAmbientLightColor(XMLoadFloat3(&ambientLightColor));
                lights->SetLightDiffuseColor(0, Colors::White);
                lights->SetLightDirection(0, pCamera->GetWorldAhead());
                lights->SetLightEnabled(1, true);
                lights->SetLightEnabled(2, true);
            }
        });

Any thoughts?  Of all the linear transformations you'd think scaling would be the hardest to get wrong!  I've tried the two "flailing" attempts of reversing my order of multiplication and of transposing the matrix before handing it off to the shader, neither helped (both broke the rendering as you'd expect).

sentences:
Tilesets - how to make the pink color appear transparent recently I searched for some free to use Tilesets on the internet. And wherever I found a sheet of sprites there is this pink color in the background. i know that all the spots having that color should be transparent later on but how do I do that? And has it any other special use or effect on the tile data?
An example of those sheets can be found here:
http://opengameart.org/content/rpg-indoor-tileset-expansion-1

sentences:
UI looks different between editor and in game I am very confused about Unity's UI system.

This is how my inventory menu looks in the Editor:

And this is the view in game:

Settings

Can someone please explain why this happens?

sentences:
How can I implement an asset update/download in a libgdx application? I am building a game based on libGdx and I want to be able to check for and download updated assets at some point before the player starts playing. The game is being built for PC and for Android.

I haven't been able to find much on downloading assets. It seems libGdx assumes all assets will be packaged with the game or already on "external" storage and available for the AssetManager.

So far, the best option I've found is setting up updating code prior to starting the libGdx application.

How can I have my assets download while the libGdx application is running? Possibly to allow some interaction while waiting, or progressive asset downloads allowing limited game play. My goal is to allow for dynamic updates to assets, and to allow users to get into the game quicker. Especially new players, I don't want them waiting on a download screen before they see anything of the actual game.

sentences:
Shadows moving with camera. I'm using MJP's Cascade Shadow Map code and I'm having major issues with the shadows moving with the camera. Here a video to demonstrate what's going on. Also, is there a way to fix the dueling frustum issue? It's annoying seeing them pop in and out of corners of the screen.

Video of the shadows

c# and shader code

sentences:
2d Tile Movement and Camera Let's imagine we have a 60x60 grid (where a Tile is 64x64px). Within the viewport there should be 10 tiles. The player object is 32x32px.

To have smooth movement, I have to take delta time in consideration; and do something like:

this.player.x += 5 * dt;

To calculate viewports:

vX = parseInt(this.player.x); - Math.floor(0.5 * 10);
  if (vX < 0) vX = 0;
  if (vX+10 > 40) vX = 60 - 10;

  vY = parseInt(this.player.y); - Math.floor(0.5 * 10);
  if (vY < 0) vY = 0;
  if (vY+10 > 40) vY = 60 - 10;

And to render position of player:

this.context.rect((this.player.x - vX) * 64, (this.player.y - vY) * 64, 32, 32);

However I cannot get the math right.

How can I determine which tiles that should be rendered based on Canvas coordinates, in context to where the Player "actually" is on the tile grid. Basically I want to achieve this: https://stackoverflow.com/questions/11464550/html5-creating-a-viewport-for-canvas

But with smooth movement (and not jumping to one tile at a time).

sentences:
How would you go about applying curvature to the rendering of a flat surface? I want to draw a 2D planet surface. I have a set of tiles, which by themselves are flat if you draw them. Now I want to apply something to the drawing process, which makes it look curved the more you go to the edges of the screen (kind of like this). Does anyone have an idea how you could do that?

If its relevant, Im using the LibGDX framework for Java.

sentences:
SDL2 taskbar icon notification (blinking / flashing orange)? In steam when you get a message, or in CS:GO when you find a match the taskbar icon flashes orange and your taskbar becomes unhidden if that's how you have it setup.

In SDL2 you can set a window icon fairly easily, but is there a way to notify the user such as bringing "up" the taskbar?

sentences:
Spawning prefab when other prefab appears Im trying to make a bottle spawn when it is broken.

This is the code that makes that:

public class romperobjetos : MonoBehaviour {

public GameObject BrokenBottle;
public float breakVelocity = 5f;
public GameObject NoBrokenBottle;
public bool rompible = false;
public Vector3 oldPosition;
public Quaternion oldRotation;
public bool botellarota = false;

public void Start()
{

}

// Use this for initialization
public  void Update()
{
    Debug.Log(NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude);
    if (NoBrokenBottle.GetComponent<Rigidbody>().velocity.magnitude > breakVelocity)
    {
        rompible = true;
    }
    else
    {
        rompible = false;
    }

}
public void OnTriggerEnter(Collider other)
{
    if ((other.gameObject.name == "Plane") && (rompible))
    {
        oldPosition = NoBrokenBottle.transform.position;
        oldRotation = NoBrokenBottle.transform.rotation;
        Debug.Log("vamos bien");
        BreakBox();
    }
}
public void BreakBox()
{
    Instantiate(BrokenBottle, oldPosition, oldRotation);
    Debug.Log("se rompe");

        NoBrokenBottle.SetActive(false);
        botellarota = !botellarota;
}

}

The broken bottle prefab has a boolean variable that is true when it appears, but the unbroken bottle doesn't instantiate. This is the script for the spawn:

public class SpawnBotellas : MonoBehaviour {

public Transform[] spawnPoints;
public GameObject[] whatToSpawnPrefab;
public GameObject[] whatToSpawnClone;
public bool botella1rota = false;
// Use this for initialization
void SpawnAlgo()
{
    whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(0, 0, 0));
}
 void Update()
{
    //botella1
    if (GameObject.Find("alidobas blanco roto").GetComponent<alidobasrota>().alidobasblanco)
    {
        Debug.Log("asdkj");
      //  whatToSpawnClone[0] = Instantiate(whatToSpawnPrefab[0], spawnPoints[0].transform.position, Quaternion.Euler(90, 0, 0)) as GameObject;
    }

Sorry for my bad English and thanks.

sentences:
How to create button prompts for interactable objects in Unity? I have a class of objects tagged as interactables that my player can interact with when within range.

When my player is near them, I want to display a button prompt at the bottom of the screen, along with a description of the type of interaction possible (for example, "inspect", "use", etc.).

I want to account for the possibility that the player might be within range of two or more of them at once, and thus allow him to toggle through them, displaying their button prompts in turn.

If my player interacts with something which generates a text box or other modal, I want the button prompt to disappear, but to return when the text box or modal is closed.

Any advice on how to go about achieving this?

I've done it in the past in different engines, but I have always been unhappy with how convoluted my method was. I'd like to hear how others might tackle this. Given how common this kind of thing is in games, I'm surprised I haven't found a good tutorial on it yet.

You can be as general or as specific as you'd like in your answer.

sentences:
Redistributing sprites in procedural generation according to player movement I am making space arcade with procedurally generated background consisted of nebulas and stars sprites, which spawn on Awake() in certain borders around player.

Mobile phones have limited capacity so I want to redistribute sprites along the player's movement. E.G. if player reaches an empty area where is no sprites, I want sprites which farthest relatively to player to move in front of player. So player couldn't ever see an empty area. Notice that player can move in any direction in 2D space, not only up.

sentences:
pygame performance issues I'm trying to make a tactics game using python and the infamous pygame library. I use threading for networking and pathfinding. The game uses a p2p lockstep architecture, with one of the players acting as a host. The server starts 2 threads (send / receive) for every connected player. All the connected clients also start 4 threads during their lifetime, 2 for networking, one for the main game loop and a new temporary thread for each pathfinding request.

My problem is that the program uses a lot of CPU and memory, even for very small maps, even when not blitting any sprites with transparency or running any pathfinding algorithms the program is slow and CPU intensive.

The map in my game is built out of tiles, which are 96x96 pixel pygame surfaces, which map sprite images are blitted to

# draw the map
for element in self.atlas.all_objects:
   try:
       self.map_surf.blit(self.map_sprites[element.sprite], element.rect)
   except:
       pass

The map, along with any units are finally blitted to the screen, simply

self.screen.blit(self.map_surf, self.map_surf_rect)

A very small map surface, with 8x8 tiles will make my CPU (amd 8 core 3.10ghz) run at 25%, with 70mb memory used per client (the cpu-fan goes crazy). The frame rate is still normal at this point.

A slightly larger map, 16x16 tiles shows a drop in frame rate, down from the desired 60 to around 48.

A map of what I'd want to be small/normal size for a real game, 40x40 tiles, brings the fps down to 12 and uses a surprising 215mb memory (all the spritesheets combined are 22mb, and I'm only using a basic green tile for testing), with the same CPU utilization as before.

On the same 40x40 map, replacing the image sprites with blank 1x1 pygame.Surface objects results in a frame rate of 27 (it's set to 60)

My basic question is this: Is the problem likely to be in my code, or is pygame itself horribly inefficient? If the latter, is there anything short of learning to code c++ that can replace pygame for these purposes?

If the problem is more likely to be in my code, how can I find out what it is?

EDIT:
I profiled my code, and here are some of the highest numbers

map size 40 x 40 tiles:

4606119 function calls (4606113 primitive calls) in 145.974 seconds

ncalls  tottime  percall  cumtime  percall filename:lineno(function)

127128    0.225    0.000    0.225    0.000 vec2d.py:18(__len__)
218530    1.406    0.000    1.406    0.000 geometrical.py:64(__init__)
253534    0.544    0.000    0.544    0.000 vec2d.py:21(__getitem__)
1400934    2.309    0.000    2.309    0.000 {method 'append' of 'list' objects}
4626   20.189    0.004   20.189    0.004 {method 'fill' of 'pygame.Surface' objects}
2086545   64.417    0.000   64.435    0.000 {method 'blit' of 'pygame.Surface' objects}
1289   10.843    0.008   95.724    0.074 bullet_client.py:714(draw)

So it appears a lot of time is spent appending items to lists, but I'm sure not what kind of other, more efficient method of organizing my game there is. As expected however, blitting pygame surfaces trumps the other functions by a huge factor, as shown by the cumtime (whatever that is).

So I guess the question is the same, can pygame be replaced by something, or might there be a more shallow problem in my code still?

sentences:
Collision detection between draggable object and world objects? I have a game I'm making in Javascript that will involve combining items by dragging and dropping them onto each other. Think Alchemy or similar.

So far, so good, but I hit a snag while trying to figure out how I can detect collisions between the two entities! I have a (really) basic bounding box test -

function isColliding(a, b) {
    if (a.x + a.width < b.x || a.x > b.x + b.width || a.y + a.height < b.y || a.y > b.y + b.height) {
        return false;
    } else {
        return true;
    }
}

The trouble I'm having is that in practice, this is fine for detecting the mouse colliding with an object to pick it up, but I'm stuck on how I can, after I've grabbed an object, test to see if that object I have grabbed is colliding with any of the multiple other objects that exist in the window. I tried doing -

Core.objectCollision = function() {
    if (Core.Mouse.isHolding != null) {
        for (i in Core.Objects) {
            if (isColliding(Core.Mouse.isHolding, Core.Objects[i])) {
                console.log("Colliding with world object!");
            }
        }
    }
}

This function is inside my update loop, but of course the object I'm holding is within my Core.Objects array too, so technically collides with itself.

I really think I'm missing something obvious, but a lot of my searches for help have been returning how to simply detect collision between two already known items, however I need it so any item I grab can be tested against any other item in the view.

Please also note I'm trying to avoid libraries for the time being, I'd rather learn the functionality myself.
Thanks for any help!

sentences:
Why doesn't this ContentLoader project (VS2010 e) recognize Microsoft.Build.dll? I am working with an XNA content loader sample. In the references for the project (VS 2010 Express) there are:

Microsoft.Build
Microsoft.Build.Framework

//as well as the standard XNA framework and graphics references

To emulate this project, I am trying to first add a reference to Microsoft.Build.dll. But Visual Studio warns me that it cannot load the .dll. I looked at MSDN and the document referenced Microsoft.Build.Evaluation. This is suppose to be available in the Microsoft.Build.dll and then I'll have access to the Project class.

Has anyone had any experience with this?

sentences:
Passing data to objects and sub-systems I am currently creating a game in C++ using SDL. Many game objects and sub-systems require the use of variables such as an SDL_Renderer for drawing to the screen and delta time for updating positions and there may be more added in the future (such as a TextureManager object). In this case the code for a game object might look something like this:

void Update(float deltaTime)
{
    // ...
}

void Render(SDL_Renderer* renderer)
{
    // ...
}

However, if another variable was added as a parameter, any subclasses would have to be updated and other systems made consistent with the new parameter.

Another way of passing data around would be to have one "storage class/structure" to store these variables and pass that instead. For example:

struct Data
{
    SDL_Renderer* renderer;
    float deltaTime;
    TextureManager textureManager;
};

My question is: what a good way of passing around data in a game engine? The first example would be bothersome to update if any changes were made to the parameters and would make adding more classes difficult. What about the second example? Would it be good design to have objects depend on a single class? Are there any other design patterns for passing around data without causing dependency issues?

sentences:
How can i put a skybox on a new layer with a new camera and then move the skybox? I want to create a moving start effect. For example the space station is moving around the star or moving to the star. But instead moving the space station i think it will be better to make effect of the skybox moving.

I have in the Hierarchy a RigiBbodyFPSController and a child MainCamera.
Now i added a new Camera to the Hierarchy.

Now how do i make the rest  ? Moving the new camera and the skybox to new layer and move the skybox ? Or it's more logic to say to move the new camera that the skybox is with in it in the new layer.

Not sure if my idea is logic or if there are a better ways to do it.
The general idea is to make movement effect like the space station is moving around the star or to the star. Star i mean the skybox.

The skybox is on the right.
I can't see the skybox in the scene view i see it only when running the game in the game view.

This is a screenshot when the game is running then i can see the skybox in scene view and game view:

sentences:
Video feedback effect with recursive RenderTextures in Unity 2018.3 I have a project where I'm playing with a video feedback effect by rendering a camera to a RenderTexture and pointing the camera at a quad displaying that RenderTexture.

This works great normally, but when trying out HDRP, LWRP, (and upgrading materials) or upgrading the entire project to 2018.3, the RenderTexture just stops working and shows black. I also tried with a completely new project and just had a camera, a quad, and a cube. That also didn't work.

Is there any obvious reason this wouldn't be working? I spent a while trying out various settings but couldn't find anything that had any effect, so I really don't even know where to start.

sentences:
Error in plane transformation I have a bunch of coplanar points, who sit on plane P. I want to translate the plane to Q with the points upon. Here is what I do:

I take three points from P, say a, b, c. Their centroid is denoted by c(a,b,c).

I pick the local origin as O = c(a,b,c) and local XYZ as:

x = normalize(Oa);
v = normalize(Ob);
z = x.crossProduct(v);
y = x.crossProduct(z);

I apply the same method to their global coordinates on Q, which are d, e, f.

O_ = c(d,e,f);
x_ = normalize(Od);
v_ = normalize(Oe);
z_ = x_.crossProduct(v_);
y_ = x_.crossproduct(z_);

Then, I use the transformation matrix as follows:

Matrix input = [x,y,z];
Matrix output = [x_,y_,z_];
Matrix T = output.multiply(input.transpose());

After this step, I multiply the coordinates of a point p that sit in plane P with matrix T. Of course, before that, I take the vector difference p - O.
The result should be the transformed point minus target origin (q - O_).

Hence, for each p in P, I transform p to its place in Q, which is denoted by q using the following computation:

q = T.multiply(p.subtract(O)).add(O_);

But what I get is, the reflection of the points through an imaginary (I don't know which) axis.

Am I missing some step? Is there a wrong computation?

sentences: How to display a GUI text at run time in unity? I'd like to display a GUI text at run time in my game for a second, so I want to know if it's possible to add or remove a GUI label to the scene at run time?

sentences:
GLES2 rendering performance for different iPad generations I'm using C++/GLES2 for iPad only (no iPhone). The only device I own is an iPad2 and I do not plan to support iPad 1.

Can anyone help me understand realistic goals/limits on iPad 2/3/4 in terms of polygon count, etc?

sentences:
How should I implement an Observer patter in the following example I am wondering how I implement an observer pattern in the following example. I am mostly wondering what should be in charge of subscribing.

The Example

A factory produces cars (Observable), they drive from A to B. Once at B the car has finished.  The scoreboard increases by +1 (Observer).

The Solution?

Option A.) The factory spawns a car, it then calls a method to subscribe the car to the scoreboard

observableCar.FinishedEvent += observerScoreboard.HandleEvent;

Option B.) Should the cars on being created register / tell the the scoreboard to subscribe itself to it the cars finishedEvent()

this.FinishedEvent += observerScoreboard.HandleEvent;

Option C.) The scoreboard is subscribed to a 'carSpawned' event on the factory. On recieving this event it then subscribes itself to the cars finishedEvent(). It then unsubscribes.

Option D.) I am missing something fundamental about the observer pattern, do more homework

I'm thinking its something more akin to option C? I'm not sure.

Thanks very much

Jim

sentences:
Best way to generate pieces in match-3 games, and then tracking them? I've been working on a match-3 style game in Actionscript using Flixel, and so far, I've been able to build the core mechanics of the game, including board generation, piece generation, piece swapping and movement, and checking algorithms.

However, I am now running into issues with clearing out pieces and letting the above pieces fall down and generating new pieces.

The reason I'm running into these issues is that when all of the pieces are generated, the pertinent values (position, sprite ID, and sprite object) are pushed into an array that helps me track everything, all the time. When pieces are moved, I swap the values of the corresponding arrays and life goes on.

And that array is the core of my problem: if a row in the middle of the board clears out, ideally, all of the pieces above the cleared pieces should fall down to take their place and new pieces are generated at the top and also fall into place. Except if I try to do that now, all the pieces can fall down, but then I'd have to bump all of their values into the right arrays (oh god my head) and then generate new pieces and fit THOSE into the correct place in the array.

Am I overthinking this? Or is there a far better way to track these pieces?

Thanks guys!

sentences:
How should a one-man team do game audio? Most game development (game design, art, programming, etc.) can be done by one person with relatively little equipment:
A game designer needs a pencil and paper, an artist Photoshop or Paint, a programmer a laptop and compiler.

Sound is different: External noises are a big problem, sound effects can't be made with instruments, and small mistakes easily produce disaster.

I can see how large companies with big studios and budgets do this.
How can I do this as a one-man indie?

Should I synthesize everything? Record sounds and buy some crazy program for editing them?

sentences:
How can I find a free or cheap redistributable font supporting runic characters? I've been looking around for a font to include in my game which supports rune characters, specifically this Unicode block.

All the sites I go to don't demonstrate what Unicode characters that font contains, so I cannot gauge their usefulness for me.

I've been using the Segoe UI Symbol font, but it is only available on Win 7 & 8, and as far as I can tell, costs far too much to redistribute as part of a game.

Anyone know where I can go to find a font with my requirements?

sentences:
Converting ARGB surface to NV12 surface I'm trying to use NVENC to encode some frames that I'm capturing from a game. I've hooked EndScene() and I can get the data from the backbuffer, which is in ARGB format.

Unfortunately, NVENC only supports NV12 buffers ("resources") as input. I checked the SDK demo source and I've found that they create their NV12 surfaces using the fourcc code like so:

IDirectXVideoProcessorService * directx_services;
DXVA2CreateVideoService(d3ddev, IID_PPV_ARGS(&directx_services));
directx_services->CreateSurface(desc.Width, desc.Height, 0, (D3DFORMAT)MAKEFOURCC('N', 'V', '1', '2'), D3DPOOL_DEFAULT, 0, DXVA2_VideoProcessorRenderTarget, &NV12_surface[0], NULL);

This works. The problem now is that i need to convert my ARGB buffer into NV12. StretchRect() does not work, and CheckDeviceFormatConversion() returns D3DERR_NOTAVAILABLE, so it doesn't seem like this is possible using high-level API's.

One idea I had was to copy the backbuffer to a texture surface, and then use that texture as an input to a pixel shader when doing some dummy draw operation, and then inside the shader i can do some math to do the conversion from ARGB to NV12. But then i would have NV12 formatted data inside an ARGB render target again. Would i be able to "cast" that to a NV12 buffer, or just use it as an input to my encoder even though the format technically doesn't match, but the data does?

Any ideas?

sentences:
Cannot implicitly convert type 'T' to 'UnityEngine.Vector3' I'm trying to use C# generics on a method in order to send a Vector3 (position) as a parameter. I can print the value correctly but can't store it on a local variable. I also can't access its x, y or z attributes separately.

I'm implementing a state machine. My intention is to use generics for allowing sending different parameters to the different states. The value will be sent to an "Enter" method which will be called once on each state every time that state is set to active or current.
So for example: the player will be on the DefaultState->something happens->change state to HeroTeleportingState while sending it it's new position

This is my Enter method on the HeroTeleportingState class:

void IState.Enter<T>(T newPosition)
{
    //The following line prints the correct value
    Debug.Log("move this hero to " + newPosition);

    //The following lines don't work
    //pos = newPosition
    //pos.x = newPosition.x;
}

The method call is just something like: currentlyRunningState.Enter(Vector3.one);

pos = newPosition gives me the following error on Visual studio (I'm paraphrasing cause my visual studio is in spanish):

  Cannot implicitly convert type 'T' to 'UnityEngine.Vector3'

And pos.x = newPosition.x gives me something like:

  'T' does not contain a definition for 'x' and no extension method 'x' accepting a first argument of type 'T' could be found

EDIT: IState interface:

public interface IState
{
    void Enter<T>(T value);

    void Execute();

    void Exit();
}

sentences:
Why does my depth test fail on Nvidia cards? I sent a test version of my in-development game to some friends, and they found out that the Depth Test in OpenGL does not work on Nvidia cards. I'm using LWJGL.

I use my own matrices and send them to the shader, and at the start of evey game loop I use

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); // clear the display

On an Nvidia card, you can see mountains through other mountains and stuff. On my Radeon HD 6650M it works perfectly fine. Any ideas?

I don't have anything special in the shaders—just some basic lighting calculations. I dont touch the gl_FragDepth.

Here's a screenshot (with placeholder textures):

I use these calculations for the Projection Matrix:

public Matrix4f getProjectionMatrix() {
    // Setup projection matrix
    Matrix4f projectionMatrix = new Matrix4f();
    float fieldOfView = 40.0f;
    float aspectRatio = (float)Display.getWidth() / (float)Display.getHeight();
    float near_plane = 0.1f;
    float far_plane = 1000f;

    float y_scale = coTangent((float) Math.toRadians(fieldOfView / 2f));
    float x_scale = y_scale / aspectRatio;
    float frustum_length = far_plane - near_plane;

    projectionMatrix.m00 = x_scale;
    projectionMatrix.m11 = y_scale;
    projectionMatrix.m22 = -((far_plane + near_plane) / frustum_length);
    projectionMatrix.m23 = -1;
    projectionMatrix.m32 = -((2 * near_plane * far_plane) / frustum_length);
    projectionMatrix.m33 = 0;
    return projectionMatrix;
}

sentences:
Should my game states be JPanels? I'm thinking about making a StateManager for my game. I want to know how to design it; that is, how to use a stack to push and pop states onto, and draw them to the screen.

For example, should each State be a JPanel? I want to make a Menu, preferably using JButtons if possible. I don't want to add them directly to the main panel because I don't want to have to constantly add and remove those buttons. Also, not all my states are going to be drawable, since I might have a state that contains a MouseListener to detect clicks.

Right now, I have an empty State class. My Menu class extends from that. My state stack is of the type State. Another design question: if in my Menu I click the "Play" button, should I just say something like StateManager.push(new PlayState()) from the Menu class?

sentences:
Unity3D: Making heavy calculation on separate thread So, I've created a program with Kinect as its input. As you know, Kinect will send the data 30 frame per second.

I have a model that will mimic Kinect's input motion, so on Update() I read the motion from Kinect.

The problem is, on Update(), I've done a heavy computational algorithm. It makes the system lag and freezing. I've tried to do the calculation every 60 frames instead of each frame, but the system still got lag.

void Update(){
        ...
        //GET DATA FROM KINECT
        frame = new SkeletonRecorded();
        frame.root.rotation = skeletons[kinect2SensorID, playerID].root.rotation;
            ...
        frame.rightShoulder.position = skeletons[kinect2SensorID, playerID].rightShoulder.position;
        frames.Add(frame);
        if (frames.Count >= 60) {
            //CALLING THE CALCULATION METHOD (Here is the heavy part begin)
            comparatorClass.GetSkeletonData(frames);
            frames.Clear();
        }

}

The above code is just small parts of the Update() method (I cut it short for convenience). So, how should I call the GetSkeletonData() method without making the interface lag?

sentences:
Government or NGO grants for game development I live in the United States, and I was curious whether or not any governmental grants or NGOs (Non-Governmental Organizations) support game developers via grants or other funding options for games that are not directly developed for commercial gain.

After a quick googling, the only examples I could find were the NEA media arts grant which is restricted to games that can be claimed to be art (arguably all of them), and the ESA Foundation which focus on games for learning but are restricted to giving funding to non-profit organizations.

Are there any other institutions that accept applications for games from individuals? Perhaps similar to Y-Combinator where you have to present a short video of yourself, and a working prototype of your game along with background of the team you will be using to develop it? I'd also like to know whether or not there are institutions that would like to promote a certain cause or aspect through game development by providing developers with resources to pursue this? (Similar to this DOE project)

sentences:
How do one NPC follow a succession of target points? I have a project that contains 1 NPC (AI) and 2 target points. In the project I can make the NPC follow any of the 2 target points, but I can not get it to follow target point 1 and then target point 2, and that is what I would like to do, so that I can make a path.

What I would like to know:

tp1 = target point 1 and tp2 = target point 2

What I can do:

In creating the variable that sets the target, I checked the box: instance editable. As you can see in the image, I can set the target in the level editor.

Blueprint of the NPC:

When I went to do the programming for him to follow the other target point (tp2) after reaching the first one (tp1), I did not get it in any way. No results appear with my search, which for me does not make any sense, because in the level editor I can easily.

Looking at the level editor / Looking at the blueprint:

I also tried using the Get All Actor of Class, but without success.

Link from where I also looked for help:

https://docs.unrealengine.com/en-us/Gameplay/HowTo/FindingActors/Blueprints

EDIT 1 (Attempt based on ColdSteel's answer)

I created a variable of type array of actor called varHelp:

As you can see, I added 2 elements to this array, but I can not edit any of the 2.

I researched a way to change this, until I got to this link:

https://answers.unrealengine.com/questions/813065/editing-this-value-in-a-class-default-object-not-a.html?sort=oldest

Unfortunately it caused an error in the code, causing me to give up for now and look for another way to solve my main problem.

Although I created 2 elements in the array, none of the elements appears in the level editor:

But I can create new elements and define them as the desired target points:

However at the time of defining them in the construction script I again error in some detail:

EDIT 2 (Another attempt, based on Stephen's answer)

With the help of Stephen I discovered how to promote a variable (right click button):

New blueprint:

But I still have not got the expected result, see below an explanation of what happens:

Red code (Simple Move) => The NPC moves toward target point 2, without first passing target point 1.

Blue code (AI MoveTo) => Nothing happens.

EDIT 3 (Attempt made thanks to the progress I made with the answers of ColdSteel and Stephen)

This time I managed to get the NPC to do the correct path, but it is not dynamic since the NPC does not go directly from target point 1 to target point 2.

New blueprint:

I know the loop executes all at once, so the value registered in the function to move the NPC was always the last.

With the creation of two Boolean variables, I was able to "circumvent the operation of the loop".

With the delay I assure you that it will allow NPC time to arrive at target point 1, only to go to target point 2.

I know that what I did is far from ideal, to have an idea I would have much more problems if there were more target points.

EDIT 4

Now I can get the NPC to go to target point 2 immediately after reaching target point 1.

I added a collision box to target point 1:

Changes in the blueprint:

Important to inform, that such a loop was not accused as infinite, since I added a collision box only to target point 1.

Now I have to know how to make a code for any amount of target points.

EDIT 5 (Finally I did it!)

For this I used the "Do N" and added an integer variable that will serve as counter.

Blueprint:

Basically, every time the NPC collides with a target point that has collision box, the loop with the "Do N" will be reset, but with the help of the integer variable that serves as a counter, the subsequent target point will be set correctly.

I do not know if this form I found is the most effective and functional. Please feel free to comment and correct me.

sentences:
Choosing an engine for a new game Right now, I'm planning a new FPS single-player Half-Life 2/Call of Duty: Black Ops/Crysis 2-like, and I'm trying to determine what game engine should I use. Right now, my team is me, as a programmer, and only one models/textures artist, so each model takes us a lot of time.

I thought about:

Source Engine - because it has a lot of existing content I can use to write my game much more quickly. The main disadvantage of Source is that it lacks in the graphics area (especially in vegetation).
Unity - the ability to use C#, which is my favourite programming language. It is perfect when it comes to graphics, but it doesn't have so much existing content like Source.  Plus, it is cross platform.

I also thought about some open source game engines, but most of them (Ogre3D, for example) lacks in development speed and some graphics capabilities.

If there was some model/textures/sound repository (not necessarily free, but also not really expensive), I'd use Unity.

UDK is not an option, as it doesn't give me access to native code and I'll need to use some libraries wrriten in C++.

Are there any more advantages/disadvantages to each engine? Feel free to suggest new  game engines. Also, in your opinion, what game engine should I use? Do you know some content repository I can use?

sentences:
How do I procedurally animate a cell eating another cell? The entities in my game are soft-body, amorphous cells. I'd like to create an animation where enemies are engulfed by the player's cell.  That is, I want to generate a "cell eating another cell"-effect. See this video for the type of motion I want: https://www.youtube.com/watch?v=iO_vOFFf1uQ

I'm considering using fluid dynamics to achieve this, but I'm lost as to where to start. I'm working in Unity2D, and Fluvio doesn't seem to provide what I need.  Does anyone have advice on the best way for me to proceed?

sentences:
Quad tree vs Grid based collision detection I'm making a 4 player co-op r-type game, and I'm about to implement the collision detection code. I've read a lot of articles and stuff about how to handle collision detection, but I'm having a hard time figuring out what to go with.
It seems the quad tree is the most common way to go, but in some resources they mention the grid based solution. For having used a grid for detections in a previous game, I'm comfortable with that, but is it actually better than a quad tree ?
I'm not sure which offers best performance, and I've also ran a little benchmark, there is not much difference between both solutions.

Is one better than the other ? or more elegant ? I'm really not sure which one I should use.

Any advice is welcome.
Thanks.

sentences:
Do "write once run anywhere" engines require platform specific code for multiplayer? I've been investigating the myriad selection of mobile game dev engines that allow compilation of your code onto multiple target platforms, but, something I can't seem to figure out is if multi-platform "write it once" development is possible when you bring multiplayer into the equation.

I've looked at Unity and Monkey mostly, so far, but aside from seeing threads on the Monkey forum such as "I've developed such and such networking library for Monkey"... I can't find a definitive answer. That example is one of many that causes me concern.

Is it the case that if you used a cross platform engine, you'd have to write platform specific code for the networking portion of your game/app? (Even if the rest of the game did work on your target platforms with no/minimal platform-specific "jiggery".

I'm not talking about cross-platform multiplayer, but I do presume that'd be a happy by-product of a write-once-deploy-anywhere (within reason) networking solution.

sentences:
How can I ensure a radius variable doesn't get reduced below 0? For some reason when I'm using the mouse to change the radius in the Update, the minimum radius is -1 even if I set the range in the top of the script to be 0,50 and even if I check that the xradius is be 0 or higher it's still getting to -1.

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

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;

    public bool circle = true;
    [Range(0, 50)]
    public float xradius = 15;
    [Range(0, 50)]
    public float yradius = 15;
    LineRenderer line;

    public float drawSpeed = 0.3f;

    void Start()
    {
        line = gameObject.GetComponent<LineRenderer>();

        line.positionCount = (segments + 1);
        line.useWorldSpace = false;
    }

    private void Update()
    {
        if (xradius >= 0)
        {
            if (Input.GetAxis("Mouse X") < 0)
            {
                xradius = xradius + 1;
                CreatePoints();
            }
            if (Input.GetAxis("Mouse X") > 0)
            {
                xradius = xradius - 1;
                CreatePoints();
            }
        }
    }

    private void CreatePoints()
    {
        if (circle == true)
            yradius = xradius;

        float x;
        float z;

        float change = 2 * (float)Math.PI / segments;
        float angle = change;

        for (int i = 0; i < (segments + 1); i++)
        {
            x = Mathf.Sin(angle) * xradius;
            z = Mathf.Cos(angle) * yradius;

            line.SetPosition((int)i, new Vector3(x, 0.5f, z));

            angle += change;
        }
    }
}

In the Update I did:

if (xradius >= 0)

But yet when using the mouse for the minimum radius it set both xradius and yradius in the sliders to -1 not sure how can it be -1 if I set the range in both xradius and yradius to be 0,50

You can see in the screenshot in the Inspector in the right both Xradius and Yradius are -1

sentences:
How can I fix sprite vibrating randomly which is moving towards the mouse while using camera.position set to the sprite as the center? So, when I use

camera.position.x = player.x;
camera.position.y = player.y;

to set the center of camera to my sprite, the code doesn't work as intended to. It's slightly hard to explain so i made this video(https://youtu.be/afCamx_wB_4) in which I show how it should work and the difference/problem when using camera.position

The code related to this is:

function setup() {
  createCanvas(displayWidth,displayHeight);
  level = new Level;
  player = createSprite(100,100,10,10);
  edge = createEdgeSprites();
  player.speed = 5;
}

function draw() {
  background(255);
  level.play();
  player.rotation = Math.atan2(mouseY-player.y, mouseX-player.x) * 180/PI;
  drawSprites();
}

player.collide(edge); //this part is from level.play()
var run = mouseX - player.x;
var rise = mouseY - player.y;
var length = sqrt((rise*rise) + (run*run));
var unitX = run / length;
var unitY = rise / length;
player.x += unitX * player.speed;
player.y += unitY * player.speed;

Also if you notice, when using camera.position, the vibration happens at specific distance of the sprite from the mouse, and the patter is that the distance is 0 right at the center of the canvas and keeps increasing as you move away from the center.

sentences:
How to handle interaction with the map in a 2D-RPG-typed TileMap? Sorry if this is a long post, but I'd like to explain the context before asking my question ^^"

I'm currently working on my "first" game (the more advance one, at least). It'll be a 2D-ARPG where the player will be able to interact with the map, by doing things like chopping tree, farming, mining, etc...

As it is my first game, I didn't really know where to go so I started by implementing basics functionalities, and i added more while the game took shape.

With that in mind, the first thing I did is implementing a TileMapReader that take JSON files generated by Tiled, and render it on screen. I've kept the structure Tiled use (github.com/bjorn/tiled/wiki/JSON-Map-Format) in order to store the tiles : The Map have a list of Layer, and each Layer as a list of "gid", corresponding to a Tile in the Tile Set. I generate my map directly from the Tile Set, without creating a Tile Object ... So my map really is just a bunch of Integers, corresponding to a Tile id. I generate then the display by pasting the right piece of the Tile Set at the right place on the map.

After that, I start implementing a Camera that could be move around the Map, and then a Player character who can move around too. Currently, the player is an instance of a "Body" class that is store with a x;y location in a field on the Map Object, and is display on a specific empty Layer like any other Tiles (except the sprites come from other external pictures, and not the Tile Set). I linked the control and the Camera to the character, and here I go ! Walking-in-forest simulator 2016 !

So now, I want to start implementing interaction like collision and so. The problem is that I really can't decide how to do this.
The two first thing I'd like to add to the game are interactions with the trees : collisions and chopping.

Since the beginning, trees are just collections of tiles on different Layers, like the rest of the map. But I think I have to make them as Object entity, just like my "Body" ...

To do so, I've thought of servals ways :

I could parse my Map Tile by Tile, and store my tree-tile's position in order to create my tree, but I find it way to difficult since I don't really know wish Tiles in the Tile Set are the tree-tiles, so I don't know theirs gid. Moreover, a tree is composed of servals Tiles, placed on servals Layers. So it'll be a pain to locate a single tree correctly on the map. Finally, the problems multiplies themselves if I add other entity like water or rocks ...
Another idea was to create another Map in which I store all the entity as Objects (and use the tile map for ground and water only). But if I do that, would the Tile Map really be useful ? wouldn't it be better to just randomly-generate a Map entity-full directly ? And since I want to add farming in the future, grass tiles would be passed on the Object-Map too, right ? So the Tile Map will become completely obsolete ...

I decided to go with the second one, but here again, I had to pick a way to store this second Map.
I wanted to go with a Tree-like Graph in which I would separate different sections of the map (like each node is 1/2 of it's parent node, and the last Nodes are the different entity with their positions). That would help a lot for the collision's detection, but I think it still really complicate to implement ...

So here my questions : is my approach on this player-world interactions correct ? since it is my first "big" game, I really would like to know if I'm doing it right or not ... and if not, how can I handle this interactions properly ?

I'm posting these here, hopping that there is a simple answer to it (even "just do it" would do ^^ (even if some explanation would be really nice)) and that this post will not be be closed for being too broad ^^"

sentences:
Does XNA/MonoGame have a text caching mechanism, or has an open source one been implemented? I'm playing around with MonoGame, and I've noticed the SpriteFont class draws static text very inefficiently. Each time the text is drawn the spacing is recalculated. This isn't a big deal on my quad core PC, but on mobile applications it might be a problem.

Before I go and program some text which caches the arrangement of its letters in an array and then feeds that array to the SpriteBatch, I would like to make sure there isn't something available to do this already, either in MonoGame itself or a class someone has implemented and made available for general use.

sentences:
Making sprites move in oppsite direction of vector I have a sprite that moves from the bottom left of the screen to the top right. What I want to know is how would i make it turn around and go in the opposite direction, and continue this loop.

I tried negating  the direction of the vector but that doesnt work.

This what i have right now:

public void create() {
    // Game Initialization
    v = new Vector2(Gdx.graphics.getWidth() - 0, Gdx.graphics.getHeight() - 0);
    v.nor();
    v.scl(100);

    spriteBatch = new SpriteBatch();
    bug = new Sprite(new Texture("EnemyBug.png"));
    bug.setSize(50, 85);
    bug.setOrigin(0,0);//Gdx.graphics.getHeight() / 5, Gdx.graphics.getHeight() / 5);
    bug.setPosition(1,1);//Gdx.graphics.getWidth() - 50, Gdx.graphics.getHeight() - 50);
    bug.rotate(v.angle());

    rotDeg = 5;
}

@Override
public void render() {
    // Game Loop

    Gdx.gl.glClearColor(0.7f, 0.7f, 0.2f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    spriteBatch.begin();

    if(bug.getX() >= (int)(Gdx.graphics.getWidth() - 100) && bug.getY() >= (int)(Gdx.graphics.getHeight() - 100)){
        turn = !turn;
    }
    else if(bug.getX() <= 50 && bug.getY() <= 50){
        turn = !turn;
    }

    if(!turn){
        bug.translate(v.x * Gdx.graphics.getDeltaTime(), v.y * Gdx.graphics.getDeltaTime());
    }
    else{
        bug.translate(-(v.x * Gdx.graphics.getDeltaTime()), -(v.y * Gdx.graphics.getDeltaTime()));
    }

    bug.translate(v.x * Gdx.graphics.getDeltaTime(), v.y * Gdx.graphics.getDeltaTime());
    bug.draw(spriteBatch);
    spriteBatch.end();
}

sentences:
Peer to Peer world download I am creating a multiplayer JavaScript game with a PHP central server. Each user will be able to move around in a 3D world, with other users and NPCs. It came to my attention that SQL is not going to handle all the requests being made in a reasonable time. So I cut down on SQL requests being made as often, using RAM when I can, but each user that logs into my world, or switches worlds requires a lot of data to be filtered from the server (So the client does not get any information it should not have, and so I don't have to distribute the entire world for every logon) and then uploaded to the client. So I had an idea: What if I can get the World data from the users near to the player(In the 3D world), like a BitTorrent? How to resolve syncing issues? What are my options to prevent Hacking? My ideas were: check with more than one user, get a hash from a server(will probably have syncing problems), have bots who request worlds from clients: then checks with server to see if they are being honest, how ever they all seem to have their problems, and am not sure which one(s) I should incorporate, or if there is a better way I could get correct world data from peers, with minimal server interaction.

Note: Peer to Peer is only used to get the world, block/world updates are still handled between the server and each client

sentences:
Why does the Unity manual add "Quaternion.identity" to an instantiated object? In Unity's documentation you can find an example usage of Instantiate:

https://docs.unity3d.com/ScriptReference/Object.Instantiate.html

using UnityEngine;

public class InstantiateExample : MonoBehaviour
{
    public GameObject prefab;

    void Start()
    {
        for (int i = 0; i < 10; i++)
            Instantiate(prefab, new Vector3(i * 2.0f, 0, 0), Quaternion.identity);
    }
}

Why do they add the "Quaternion.identity" instead of leaving it blank? Wouldn't the engine instantiate the object with the original object's rotation anyway?

sentences:
What are the accessibility implications of requiring a button press or time-out on a game over screen? For simple games, is there a de-facto standard that game over screens time out after a few seconds before, or require some sort of input in order to, transition back to the main menu?

Time-out pros:

Accessibility. Mobility-impaired users may have difficulty pushing the buttons so the game should advance for them.

Time-out cons:

Accessibility. Vision-impaired users may have difficulty seeing any post-game information displayed within the allotted time.
Tweaking the time-out so it's not too long as to be annoying if the user happens to game over a lot. Also: "Don't make QA mad"

Input pros:

Accessibility. Vision-impaired users may take as long as needed to see any post-game information displayed on screen.
Makes time-outs skippable.

Input cons:

Accessibility. Motor-impaired users may have difficulty pushing buttons.

I remember reading a Microsoft article about certain best practice design decisions regarding accessibility a long time ago but can't recall the specifics.

sentences:
Initial direction of intersection between two moving vehicles? Possible Duplicate:
  Predicting enemy position in order to have an object lead its target

I'm working with a bit of projectile prediction for my AI and I'm looking for some ideas, any input?

If a blue vehicle is moving in a direction at a constant speed of X m/s and a stationary orange vehicle has a rocket that travels Y m/s, which initial direction would the orange vehicle have to fire the rocket for it to hit the blue vehicle at the earliest time in the future?

Thanks for reading!

sentences:
How to simulate timed attacks in browser-based games? In my MMORTS browser-based game, I want that all attacks be performed 7 minutes later after the player does it.

So, when the player clicks on attack button, a countdown becomes visible to both the attacker and the defender.

Showing countdown and handling its events isn't my question. In fact, my Q is how can I implement this countdown in server side and database.

I haven't any idea about managing this situation. Any helps is highly appreciated...

sentences:
Adapting pen & paper RPG rule system for use in a video game I want to make a browser based RPG. I am considering to use an existing pen & paper rule system (like FATE or GURPS) instead of developing my own rule system from scratch.

What pitfalls should I be aware of when adapting a pen&paper system for use in a video game?

sentences:
How to create seamless and coherent voxel terrain using simplex noise 2D? I'm using the simplex noise 2d plugin for unreal engine 4, which can also be understood by most programmers.
I have already implemented chunk generation and dual-chunk noise elevation.
However, each chunk has a unique heightmap and this results in jagged voxel terrains.
Pseudo code:

//Chunk.cpp
for(int chunkWidth = 0; chunkWidth <= 10; chunkWidth++){
   for(int chunkHeight = 0; chunkHeight <= 10; chunkHeight++){
      noiseX = ((chunkWidth / 10) - 0.5) * Frequency;
      noiseY = ((chunkHeight / 10) - 0.5) * Frequency;
      Elevation = SimplexNoise2D(noiseX, noiseY) * 100;
      ChunkLoc = getActorLocation(self);
      SpawnMeshAtLoc(ChunkLoc.x + chunkWidth, ChunkLoc.y + chunkHeight, Elevation);
   }
}

I have another variable available: chunk2DCoord(2D vector coordinate for each chunk)

sentences:
Path tables or real time searching for AI? What is the more common practice in commercial games; path lookup tables or real time searches?

I've read that in many games path lookup tables are pre-calculated and baked into each map, so to speak, then steering behaviour is used to handle dynamic obstacles.

or is it better practice to use optimised hierarchical A* searches? I understand the pro's and cons of each, I'm just curious as to what is most often used in the industry.

sentences:
Loading a web page in unity Hello I need to open a page in unity and save some of it's contents but I have absolutely no idea how I should do it.

Thanks for help.

sentences:
How do network applications get around firewalls? Forgive me if this comes off as naive; I've only a cursory understanding of network communications.

My work has a public and very restrictive network - (they appear to block everything that isn't approved) - and yet I've seen people accessing many games (World of Warcraft for example).  I don't imagine that the network admins made any explicit exceptions for these applications - but when I tried to develop a networked prototype with services like 'Photon Server' or 'Adobe's RTMFP' they all fail from the office due to the network restrictions (can't establish connection).

Is there some kind of work around that applications like WoW employ that distinguish them from an anonymous networked app I've built myself?  (Some kind of fallback channel maybe?)

I appreciate that there might not be enough information here for an answer, but any insights would be welcome.

Thank you!

sentences:
How does an FPS like Overwatch have client time run ahead of the server? In watching the GDC talk about Overwatch netcode, it mentions that the client is always ahead of the server, that the "current tick" on the server is behind that of the client.
From their explanation this makes sense. If the client is ahead of the server, then by the time the client messages arrive at the server, the server will have caught up and can handle them when it wants them.
But how does this get setup to begin with? The client connects to the server, the server starts a game... does the client jump ahead of it's own accord? (Server says "game is starting, I'm at tick 0", and the client is like "okay, well, based on my ping I'm going to be tick 20 then")

If the server is in charge of what's going on in the game, how does the client even know what's going on in that future tick? I would assume constant extrapolation of game events from the last server update would be bad. Having the client in the past to allow it to interpolate between server updates would make a lot more sense to me.

Or am I wrong in assuming that client and server tick times need to remain in sync, and it is instead more loosely based on server updates and the number of client events that happened since that update was received, rather than the client actually caring about what tick they're on compared to the server?

It's the time/tick synchronization, despite one or the other having to be in the past, that I can't wrap my head around...

sentences:
Should I avoid constructors/destructors in C++ when using custom allocators? I'm currently building my first 2D game engine and have reached a point where some large-scale tests have shown that some form of custom memory management would be beneficial (object pools).

So I created an object pool but got stuck on the problem of calling the constructor and destructor of the objects allocated from that pool.

So I read this:
http://www.scs.stanford.edu/~dm/home/papers/c++-new.html

This seems to be a common problem when using custom allocators and there seems to be no nice solution to it within C++. I've also read on some other place that one should avoid "new" like the plague when creating a game engine. So, if that's the case, should I avoid constructors and destructors altogether? Should I fall back to a Init/Shutdown mechanism for my objects?

Appreciate any advice.

EDIT:
Besides the correct answer below, one solution to the problem (also mentioned by mikosz) that also allows the use of non-default constructors can be found here: http://anki3d.org/cpp-allocators-for-games/

sentences:
OOP in cocos2d for ios I have been pulling my hair out trying to make an object in cocos 2d that is a CCSprite (with an image) and a CCLabelBMFont.

I tried making a CCNode object and I tried making a custom CCSprite object but none of it worked!

Can someone show me how to do this?

Thanks.

sentences:
SDL Multiple keyboard support I am making a game with multiplayer split screen mode using SDL. Basically, I like the idea of having each player plug in his own keyboard to the PC, set custom controls via options and being able to play it with controls that he likes.

However, there's a problem. This code gets the keyboard event:

SDL_Event event;
SDL_PollEvent(&event);

SDL_Event has member SDL_KeyboardEvent key, which has member Uint8 which. In short:

event.key.which;

According to this, it should represent keyboard device index, however, I've tried connecting three keyboards to my PC and press the buttons at the same time and the result wasn't satisfying: they all had same keyboard indexes. Is there a solution to this? Or am I missing something?

sentences:
Shader - Realtime texture masking The first thing that comes in mind is masking using RGBA values. With this you can obtain this kind of textures and this kind of results.

But with this, you can only store up to 4 masks inside a texture and blend between maximum 4 textures.

I am wondering if there's a way to store more than 4 masks inside a texture and being able to blend more than 4 textures using this mask texture. The aim would be to store as much as possible masking data inside a texture.

Is it possible ? How ?

sentences:
Sprite won't change with direction I am making a top down Pacman game. I have two sprites: one for facing up and one for facing left.

When I press W, the sprite showing is still the one for when Pacman is moving left, but I want to see the up sprite instead.

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

public class pacman : MonoBehaviour
{
    public int speed;
    Vector2 dest;
    public Transform[] points;
    // Start is called before the first frame update
    void Start()
    {
        dest = transform.position;
        speed = 25;

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        //Vector2 p = Vector2.MoveTowards(transform.position, dest, speed);
       // GetComponent<Rigidbody2D>().MovePosition(p);

        // Check for Input if not moving
        if (Input.GetKey("w"))
            transform.position = Vector3.MoveTowards(transform.position, points[0].position, speed * Time.deltaTime);

        gameObject.GetComponent<SpriteRenderer>().sprite = GameObject.Find("up").GetComponent<SpriteRenderer>().sprite;

        if (Input.GetKey("d"))
            transform.position = Vector3.MoveTowards(transform.position, points[2].position, speed * Time.deltaTime);

        if (Input.GetKey("s"))
            transform.position = Vector3.MoveTowards(transform.position, points[1].position, speed * Time.deltaTime);

        if (Input.GetKey("a"))
            transform.position = Vector3.MoveTowards(transform.position, points[3].position, speed * Time.deltaTime);

        gameObject.GetComponent<SpriteRenderer>().sprite = GameObject.Find("left").GetComponent<SpriteRenderer>().sprite;
    }
}

sentences:
Why do separate loops run faster than one loop that does multiple things? My game had some lag, so I tried to improve the performance.

I found that if I write my loops separately like this:

for (...){
    for (...){
        // Do operation A
        // (Fill int[][] with 1s)
    }
}

for (...){
    for (...){
        // Do operation B
        // (Work with Sprite Renderers & Spritebatch)
    }
}

for (...){
    for (...){
        // Do operation C
        // (Work with Shape Renderers with alpha)
    }
}

then the result runs a whole lot faster than if I try to do all the operations in one loop:

for (...){
    for (...){
        // Do operation A
        // Do operation B
        // Do operation C
    }
}

Can anyone explain this?

I'm running this game on Android OS!

sentences:
Calculate quaternion rotations between two values I have a quaternion Q1:
X: -0.023995593190193176
Y: -0.4076451063156128
Z: 0.04357096180319786
W: 0.9117847681045532

and I have a keyframe value Q2 which is based on Q1:
X:  0.176469
Y: -0.368251
Z: 0.479782
W: 0.776569

Now my question is how can I get the correct keyframe values if there would be no extra start values ? I mean if Q1 is 1,0,0,0 (w,x,y,z). (no extra start values) So basically I need to rotate my object to the same pose but from the default values (1,0,0,0) start not from Q1.

sentences:
Emscripten code and three.js I would like, if it's possible, to use Emscripten code generated from C/C++ with the Javascript library three.js. For example, from emscripten code I want to pass rendering information to the three.js that will be showed in the browser.

So, can someone give me an idea of how to do that?

sentences:
Why does my character move diagonally? So i've been trying to make the player face towards the direction i pressed. That part works just fine but when I try to move the player it moves diagonally instead of left/right. Any clues?

 if (Input.GetKey(KeyCode.RightArrow))
             {
                 //moves the player
                 rb2d.velocity = new Vector3(2.5f, 0, 0);
                 transform.Translate(rb2d.velocity * Time.deltaTime);

                 //flips the player right
                 if (human.flipY == true)
                 {
                     human.transform.rotation = Quaternion.Euler(0, 0, 270);
                 }
                 else
                 {
                     transform.rotation = Quaternion.Euler(0, 0, -270);
                 }

sentences:
Are the Minecraft animations hardcoded into the game? I would like to know how the animation system works in minecraft. I get a feeling that all the mobs are hardcoded into the game. Did notch really sit there and create the matrices for all the animation bones by hand?

I like recreating games for fun, so I would like to know how he did this. Also, if he truly does hardcode them... is there a better way?

sentences:
Create a white background for the texture and then blend using GLSL I have a transparent png texture and I'd like to create a white background and then blend this on top of that. Is this possible using just GLSL? I can't multiply, add or mix colors because I don't want to overlay the color white. I want it to be in the background of the texture.

I can achieve what I want by creating 2 objects with the exact same dimensions and position, set the color of the object behind to white and the object in the front to the transparent texture. But this seems less than ideal to me.

Any suggestions will be much appreciated!

sentences:
Should I store local forward/right/up vector or calculate when necessary? I'm working on an object picking and translation/rotation/scale gizmos system in my engine where you select objects and perform transformations on them in a 3d editor-like fashion (e.g. Blender)

In my transform struct, I'm storing the position, rotation angle, rotation axis and a uniform scale value. When transforming my objects, I build the TRS matrix which forms my ModelToWorld matrix. All good.

Now I want to add the notion of local vs world translation. i.e. you select an object, and you can either move it along its local x axis, or the global x axis.

The global movement is easy I just add directly to my position vector. But for the local one, I have to build a local forward/right/up vector. e.g.

v3 GlobalUp = V3(0, 1, 0);
v3 LocalUp = m4_Rotate(Rotation->Angle, Rotation->Axis) * GlobalUp;

And then I translate my position by that amount:

Selection->Transform.Position += LocalUp;

I'm kind of torn whether I should store these local up/forward/right vectors in my transform (which means I have to calculate them once every frame in my update function, but every use of them after that point needs no calculation) or only when needed (no need to calculate every frame, but I have to call a function to do the calculation every time I need one, I could still keep the value in a local variable in my usage area if I'm using it more than once)

I'm not sure what approach to go with but I'm leaning towards calculating them as needed.

Are there any other pros/cons to each approach? or is this one of those things where there's no 'absolute right' way to do it?

Any advice is appreciated!

sentences: What is the purpose for multiple windows in games? A lot of game development APIs recently got support for multiple windows (such as SDL 2, and GLFW 3). But why did they add that feature? I've never seen a game in my life use multiple windows (with the exceptions of a launcher, or a messagebox). Is there something I'm missing here? Is there an actual game development purpose to it? I'm very confused of why they did that.

sentences:
How does code translate to graphics? I know this is kind of a basic question, but I'm trying to create my own game from scratch and really don't understand this. How does the code of a videogame program certain pixels to be certain colors and then move them in agreement with the player's movement?

For example, in a 2D platformer, how does the code program the on-screen visuals of the world that the player is in? And then, how does it move a certain object matching the speed of the player and then eventually have it go off screen?

Thanks in advance!!

sentences:
Conversation tree and question locking/unlocking I have been having issues with managing a conversation tree. I am using PAWN as a scripting language (I have no other options, unfortunately) and I use MySQL databases to store user and game data.

My current issue is storing game conversation trees using SQL. Currently, I have the following table:

TABLE NAME: dialogue
ID: global ID of conversation option
Prompt: question or sentence shown on player's screen
Answer: NPC's answer
[some other stuff related to conditions and mood checks, etc.]

Now, my problem is the following. Suppose I greet the NPC, this would be something like this:

ID: 1
Prompt: Hello there.
Answer: Hi, how's it going?

I want my conversation tree to progress after the player greets the NPC. This is not problematic, I simply use an additional SQL table for that:

TABLE NAME: dialoge_unlock_lock
ID: global ID of dialogue element
Unlocks: option this element unlocks
Locks: option this element locks.

My problem is the following: suppose I greeted the NPC, this would unlock 5 conversation options for the player to choose from (they would have IDs 2-6 for this NPC, and perhaps 241-245 for another NPC). I choose question #2, this would unlock question #8 and lock question #7.

How could I check what questions the player has locked in the current dialogue tree? In this example, I don't want the player to just see question #8, but I want him to see every question that is currently available to him (that is, questions 2-6 & 8).

I have been sitting on this for days and I can't figure out a way to do it. This pretty much sums up my attempts, any help would be greatly appreciated.

sentences:
XMMATRIX XMMatrixRotationY wants the angle in radians or degrees? DirectX The documentation is totally unclear about it.
And also what does" Angles are measured clockwise when looking along the rotation axis toward the origin" mean? Are they measured clockwise looking from where?
Documentation:
https://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.matrix.xmmatrixrotationy(v=vs.85).aspx

sentences: Is there a better way of determining direction to turn? You have an entity A that you want to turn towards another entity B.  One way to determine the direction to turn is to compute the cross-product of the direction vector of A with the vector from AB.  If the value of z is positive, then you turn right.  If the value of z is negative, you turn left.  Is this the only way of determining which way to turn?

sentences:
Android Virtual Pet Gameloop Hello I'm looking for a bit of advice in which way is the best to proceed creating my applications 'gameloop' - It doesn't want to be a game loop in the truest sense since I'm not really rendering any graphics just displaying some animated gifs.

My goal is to have a task that runs every 30 minutes that decrements pet variables

Example Method
passTime { <pets health> = <pets health> - 1; <pets hunger> = <pets hunger> -1; <pets exp> = <pets exp> + 5; } et

c.  I was wondering the best way to go about this? AsyncTask will be of no use since this ideally wants to be running even when the app isn't.

I would rather use an IntentService subclass rather than a Service subclass but I can't seem to get the IntentService to run through a pendingIntent via the AlarmManager.

So I'm asking advice on the best way to proceed from the ground up with this. Thank you!

sentences:
Simultaneous game states I think I understand the basic idea behind a Finite State Machine-based game loop. But I'm trying to write a little game in which the same object can simultaneously be in multiple, independent states. At least that's what I want to do.

To give you an idea: Robot may be in FleeState and FireLaserState at the same time, besides in each of them individually at any time.

Would something like this be possible using the FSM pattern? Or ought I to look elsewhere?

After all, does the whole idea make sense?

Pasted from my comment below: A little clarification of why I'd like states to be kept separate:  I want the player to have the ability to program simple state changes before a game... say "if (health_is_way_too_low) flee". But then I want multiple such rules to be active simultaneously in order to keep the game interesting, and cannot know beforehand which other states may be active.

sentences:
Add inertia to Pawn movement I've just started to learn Unreal Engine 4.26.2 while developing an Atari Pong clone.
This is how I have implemented the Paddle's movement (but this implementation doesn't accelerate or has inertia):
// Called to bind functionality to input
void APaddle::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    // Respond every frame to the values of our movement.
    InputComponent->BindAxis(TEXT("MovePaddle"), this, &APaddle::Move_ZAxis);
}

void APaddle::Move_ZAxis(float AxisValue)
{
    CurrentVelocity.Z = FMath::Clamp(AxisValue, -1.0f, 1.0f) * 100.0f;
}

But I want to do two things:

While the user is pressing the key the paddle movement will accelerate.

When the user release the key the Paddle won't stop immediately; instead, it will slowing down until it stops.

Is there anything done with Physics that I can use here or do I have to implement it by myself?
By the way, I'm not English and I don't know if inertia is the right word here.

sentences:
How to get enemy to follow character using angles? (atan2) I have an enemy and a character to control. I want to get the enemy to follow the character in a straight line. I already found the angle in which the enemy needs to travel.

double angle = Math.atan2(y, x) * 180 / Math.PI;

Now, let's say it return 73.0. What do I do with that number? And what if it's a negative angle.

BTW, I'm using dx(dynamic x) and dy(dynamic y) to control movement.

sentences:
A* in 2D game. corner pathfinding issue the issue I'm having will be best described with pictures more so than with code, so lets have a look if you will.

So all the mobs followed the player and started attacking him, but as soon as 4 spots to the E, S, W, N were taken, mobs 1 and 2 are no longer able to find the path.

When mob from E/S/W/N spot dies they can of course find a way to the player.

My question therefore is what is the way to implement this so that mobs can get to the player when only corners are free?

Diagonal movement is not allowed and  i'm using Euclidean distance.
I've read this How do I avoid pathfinding characters getting stuck in corners? and other questions, but they dont quite cover what I need here. I'm sorry if this isnt specific enough, happy to clarify.

sentences:
How can I stop Substance's runtime texture caching? Procedural textures with the Substance Engine seem to update very quickly if you turn off caching, modify one exposed variable at a time, modify it frequently, and even then only after you've attempted to modify it 2 or 3 times.

However, I want basically the opposite. For example, units have a "blood" variable that generates blood differently on them as they take damage, as well as a "battle wear" variable that generates scratches and dents, but doesn't revert when they heal.

So to force a variable not to cache, I have to set it to some dummy value, then back to normal, then call RebuildTexturesImmediately.

How can I tell Substance not to cache a variable at runtime, so I can change it once and have the texture regenerate quickly?

sentences:
Is it ok to remake a 2D game into first person and then releasing it for free? I saw a video online where someone made a first person version of flappy bird, so I was wondering...

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

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

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

sentences:
difference between an engine and a library I'd like to know the difference between a library and an engine. I've searched some information and if I'm not wrong, an engine gives you more options and makes work easier than a library.

An engine can help you for example handling user input or handling collisions but I don't know how. I mean I've been using SFML and it has a function that detects collision between two rectangles. You can handle user input too.

How does an engine work? In what ways handling collisions for example is easier with an engine than with a library?

sentences:
Draw multiple times same object but translated and rotated I want to draw lots of spheres in different locations and orientations with Opengl4 and JOGL. As the vertexes and colours are the same for all of them, I have just one array for vertexes and another for colours. For the positions and orientations, I have another big matrix where I have all data for all spheres.

In principle, drawing one with glDrawArrays is not a problem but for severals, I have read that I should use glDrawArraysInstanced instead. My problem is that I am a bit confused about how to apply each transformation for my particles. How should I introduce this array into the shader? Should I send the matrix model after doing the transformations in the cpu or should I send the positions and orientations and transform them inside the shader? How do I connect the data to the shader? How should the shader look like?

sentences:
Optimize algorithm: finding all possible moves for a turn based game I am working on the ai for a turn based game. To illustrate my problem this are the simplified rules of the game:

The game takes place on a tiled map with obstacles (black quads) like this:

The player has several tokens (like the two colored dots in the example picture)
The player can move all his tokens in his turn
the tokens move in a straight line until they hit an obstacle, the border of the map or another token
each token could move two times in each turn.
the player can move his tokens in any order he likes

The AI needs a list of all possible turns it could make of one game state. My first attempt was to recursively go through all tokens and move them in any possible direction and order. that works of course but the problem is that with just four tokens there are several millions of possible turns (if each token could move two times). Most of the outcomes of these turns are the same (the tokens end in the same place). In the example above the tokens could move like this:

No matter in which order the four move actions (A,B,C,D) are made, the end positions of the tokens are the same. I am only interested in the possible end turn situations. So I implemented a transposition table in the turn generation algorithm to negate all of the equal turns. That works and in the end I have only several hundred of possible turns with four tokens rather than several millions.
The problem is that the algorithm takes too much time because it has to calculate every possible turn. Does anybody has a hint how to prune the turn generation  tree? Or any other idea how to calculate only the different possible turn outcomes?

Note: In the real game the map is slightly bigger (30-40 free cells) and there are up to 6 tokens.

sentences:
ScriptableObjects events execution order? Given the code:
[CreateAssetMenu(fileName = "newGameManagerInstance", menuName = "Game/Game Manager Instance")]
public class GameManagerSO : ScriptableObject
{
    private GameManager instance;

    public GameManager Instance { get { return instance; } set { instance = value; } }

    private void Awake()
    {
        Debug.Log("1");
    }

    private void OnEnable()
    {
        Debug.Log("2");
    }

    private void OnDisable()
    {
        Debug.Log("3");
    }

    private void OnDestroy()
    {
        Debug.Log("4");
    }
}

I have two questions:

Why the output in console when I enter play mode is "3" and then "2"? Shouldn't OnDisable be executed after OnEnable?

I'm using this scriptable object to hold an object reference only (I don't have the need to serialize the object, it's just a handy way I found to pass that reference through scenes without committing to singletons); can I code all initialization code for the object in OnEnable method? Can I assume it will always execute before any MonoBehaviour read it?

Also

sentences:
How can I draw lines in editor between waypoints when creating the waypoints? public List<Vector3> destinations = new List<Vector3>();
    public int numberOfDestionations;
    public float moveSpeed = 5f;
    public bool loop = false;
    public bool moveBack = false;
    public Text textCounter;

    private Coroutine movementCoroutine;
    private bool pause = false;
    private bool coroutineRunning = false;
    private Vector3 startPosition;
    private int countDestionations;

    private void Start()
    {
        for (int i = 0; i < numberOfDestionations; i++)
        {
            destinations.Add(new Vector3(UnityEngine.Random.Range(-300, 25), -1f, 0));//25, -1f, 0);
            if(i > 0)
            {
                Gizmos.DrawLine(destinations[i], destinations[i + 1]);
            }
        }

I'm trying to use gizmos but getting exception :
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

On line 33 :
Gizmos.DrawLine(destinations[i], destinations[i + 1]);

I want that while it's creating the vectors draw lines from the current created vector destination and the next one. A line from index 0 to index 1 to index 2 and so on. So when running the game I will see a net of all the lines connected between the vectors destinations.

sentences:
LWJGL Wait for key press in a single method Currently I am implementing the possibility in my game to change the keyboard configuration.
Therefor, I have a menu in which is a button for each action the player can do. If the player clicks on one of these buttons, the game should wait until the player hits a key on the keyboard.

But this is my problem. I have no idea how to wait for a keypress.
I tried to do something like:

while(!Keyboard.next()){}
// Now there should be events. Just get the key of the last event.

But it did not work and ended with an infinite loop.
The problem is, it has to work in a single method, as it is the onClick method of the button.

Does somebody know a way to handle this problem correctly?
And how is this done usually? (I have seen such functionality in some games)

sentences:
Rotate around an axis function for euler angles representation For a 3d game i need a function to rotate an euler representation around an arbitary axis by an angle.
For example an object is rotated with euler angles (0,90,0). Now the object should be rotated by 100 degrees around the axis (0,1,0). The resulting angle will be (0,190,0) using rotation order YXZ.
In this case I can add the angle to the euler value of the axis, however for an arbitary axis this will not work.
Problem with Quaternions & Rotation matrices:
With these representations the resulting rotations will always be smaller that 180 for each axis. I need the rotation to be lerped afterwards for example from (0,0,0) to (0,720,0).
Basically I am searching for a way to display euler angles like most of the 3D editors. When you rotate an object around any arbitary axis rotation might be larger than 360 in the editor, like (420,720,15).

sentences:
Observer pattern payloads Does anyone know what Nystrom meant in this excerpt from http://gameprogrammingpatterns.com/observer.html?

I created an example implementation of the observer pattern in c++ from my medal system.

I am wanting to pass my KillType enum to onNotify without muddling up the base Observer/Subject classes with that level of specifics.

My Medals class needs to know specifics about what type of kill it was so it can award the appropriate medal (ex. Headshot).

Does anyone know of a way to use templates to do this? Or what is a good way to get that level of detail from PlayerState to Medals?

The first thing I thought of was to use polymorphism and an Event class with a bunch of subclasses for each type. But that seems really class heavy to me to just pass some variables around.

Runnable Example

sentences:
Using CNN's in Unity via Tensorflow and TensorFlowSharp I have a project that tracks hands made in python, shown here: https://github.com/timctho/convolutional-pose-machines-tensorflow

I want to effectively import this into Unity. I have generates the .bytes file from the model, but have no idea how to do anything further than this. If anyone has worked with ML-Agents or TensorflowSharp in Unity and/or would be willing to have a look, this would be great. The image-processing stuff would be done probably in a C# file beforehand, I just want to know how to run the network.

Thanks.

sentences:
D3DXLoadSurfaceFromResource failed to load bitmap image I'm working on a small DX9 game project for learning purpose. I'm current dealing with resources manager file (*.rc) which I'm not used to (I have only worked with direct file until now).
If I use D3DXLoadSurfaceFromFile, it worked fine, the image was drawn on windows. When I changed to D3DXLoadSurfaceFromResource, I think it can not load the image, only a black screen & the Hresult that it returns is S_FALSE.
This is the create surface function :
bool Surface::CreateSurface()
{
    if (FAILED(m_Device->CreateOffscreenPlainSurface(
        m_Width,
        m_Height,
        D3DFMT_X8R8G8B8,
        D3DPOOL_DEFAULT,
        &m_Surface,
        NULL
    )))
        return false;

    if (FAILED(D3DXLoadSurfaceFromResource(
        m_Surface,
        NULL,
        NULL,
        GetModuleHandle(NULL),
        MAKEINTRESOURCE(m_RsSymbol),
        NULL,
        D3DX_DEFAULT,
        0,
        NULL
    )))
        return false; // S_FALSE and return false while debug
    return true;
}

This the render function :
void GWindow::Render()
{
    Surface Hello_Brown(146, 146, m_lpD3DV, IDB_SAMPLE); // IDB_SAMPLP will be assigned to m_RsSymbol
    LPDIRECT3DSURFACE9 backbuffer;
    if (NULL == m_lpD3DV)
        return;

    m_lpD3DV->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 255), 1.0f, 0);

    m_lpD3DV->GetBackBuffer(
        0,
        0,
        D3DBACKBUFFER_TYPE_MONO,
        &backbuffer
    );

    m_lpD3DV->StretchRect(
        Hello_Brown.GetSurface(),
        NULL,
        backbuffer,
        NULL,
        D3DTEXF_NONE
    );

    m_lpD3DV->Present(NULL, NULL, NULL, NULL);
}

Where I am wrong and how do I fix it?
Resource file : link
I linked the file above, because it too long to post here.

sentences:
Professional game design documents Possible Duplicate:
  How should I structure a design document?

I'm planning to apply for a game designer position at a big company. But the problem is, according to my CV, I'm not fit for being a game designer. (I'm a programmer).

But, I don't like this and still would like to try my chances. Even though I'm a programmer, I have lots of ideas which I can put on paper in any detail depth imaginable. (It's not like "bro, I have this cool game idea in which you fly a spaceship and you see these scary monsters just like in ....", I can really make it professional).

To be able to achieve this, I want to send a game design with my application, written in proper way, that will make it easy for them to accept me.

Question is, what is the proper format for game design documents? Is there a template? What is the detail level? Where can I find a final game design document for a released professional game?

sentences:
How to attract modders to your game? I am developing a game, but as I am working on it alone, the amount of content I can create is very limited. Because of that I want my game to be modded, for this purpose I am planning to create a complete modding API which would be exposed for lua scripting. I would also create tutorials to get people started. And the "Original" game would also be a "mod"(similar to Warcraft III maps) .

My question is: What can a developer do to encourage modding of its game?

PS: my game is a sandbox-ish multiplayer survival(most things are procedural).

sentences:
Should I worry about variable time step for simple mobile 2d game After going through some articles on framerate independent game design, i found that its not an easy task to implement in variable time steps(it is difficult compared to fixed frame rate, and considering my lack of understanding of variable time steps), I came across this answer.

According to this answer "option 1" [ its this if you dont want to open the link - Do nothing. Attempt to update and render at a certain interval, e.g. 60 times per second. If it falls behind, let it and don't worry. The games will slow down into jerky slow motion if the CPU can't keep up with your game. This option won't work at all for real-time multi-user games, but is fine for single player games and has been used successfully in many games.]

encourages me to not go for framerate independent design.

sentences:
Tile-based maps in AS3 I want to make a tile-based platformer in AS3.

I want my game to read an external maps file (in xml or json or somethimg similar) to draw a tile-based map.

I've seen loads of tutorials for this in AS2 and other languages, and the few I've found in AS3 are either incomplete or filled with extra unnecessary features. I just want to be able to draw a basic map from sprites in Flash.

Any links or information to point me in the right direction would be appreciated.

sentences:
Center image in Steam page I am struggling to Center my image in my game's Steam page.

[img][center] --> Error

[center][img] --> Just prints a text "center" before and after the image :(.

How would a mere mortal center the image on Steam?

sentences: Do I need a UPC barcode to sell my game? Is it necessary to register a Universal Product Code for a video game intended for sale offline? What about online?

sentences:
Faking a 3D object to decrease number of polygons I'm making a game in unity and I'm building a fence in blender but I want it to be as low poly as possible. My original design was too high poly so I thought, what if I could simply use a cube with some cleverly arranged textures. Like so:

You can see the edges are all looking good but the inside sections are not, i.e there's nothing there... so does anyone know if it's possible to fake those faces that would make it look as though it were a complete mesh. Here's what I'm tring to achieve:

sentences:
Oriented Bounding Box - How to? I've been trying to write my own collision code, less because I want to, more because I want to understand its working.

To do this, i've been working off of the popular collision book i'm sure you've all heard of: Morgan Kaufmann Real Time Collision.

I'm on the subject of Oriented Bounding Boxes. These are boxes that can have an orientaiton applied to them.
If it matters, i'm doing my code in 2D. It seems easy enough to just cut out an axis from the books calculations.

Here is the OBB they define:

// Region R = { x | x = c+r*u[0]+s*u[1]+t*u[2] }, |r|<=e[0], |s|<=e[1], |t|<=e[2]
struct OBB {
    Point c;     // OBB Center Point
    Vector u[3]; // Local x-, y-, and z-axes
    Vector e     // Positive halfwidth extents of OBB along each axis
};

The confusing one is the Vector array, u.

Point c is the center 3 axis position of the box.
Vector e is the width, height, and length of the box.
Vector u[3] baffles me. My best guess is that it is the center-point of each of the 3 sides (with the reflected 3 finishing the box)

How does rotation work into this? Is the Vector u[3] taking the roation in somehow? How?

sentences:
How to synchronize damage with attack animation in a RTS game? I have been working on a RTS game in unity and did damage deal through code and a timer but it does not fit with the animations quet well. The damage is dealt in the beginning of the animation and about 4 attacks it fits perfectly and after more 4 attacks the damage is dealt delayed after the animation.

My big question is if hitboxes would be a good answer to solve this problem or is it to preformance heavy?

sentences: How to destroy particles system after its work is over How can i stop particle system after player get destroyed

sentences:
Box2D Platform body not moving player body along with it I am creating a game using Box2D (Javascript implementation) - and I added the ability to have a static platform, that is moved along an axis as a function of a sine.

My problem is when the player lands on the platform, as the platform moves along the X axis - the player is not moved along with it, as you visually would expect.

The player can land on the object, and if it hits the side of the object, it does colide with it and is pushed.

This image might explain better than I did:
After jumping on to the red platform the player character will fall off as the platform moves to the right

UPDATE:
Here is a live demo showing the problem:
http://onedayitwillmake.com/ChuClone/slideexample.php

sentences:
Difference between 2 quaternions I need to patch an animation during LateUpdate.

I'm rotating the "chest" bone according to the mouse delta. This is to mimic aiming a pistol.

During this aiming, the "neck" bone should stay relatively still.
As changing the chest bone's location rotation yaw automatically changes the "neck" bone's local yaw rotation, I store the chest bone's rotation BEFORE I apply a new rotation to it. Then I calculate the difference between the old and the new rotation.
Then I apply this rotation yaw difference to the neck bone.

The inspector gives me nice values to work with.
When I inspect the rotation values by script, I get reprensations that I can not easily work with.

Here is an example:

While the Inspector shows "15.4", the localEulerAngle shows "344.6".

If I use "344.6", the neck rotation goes Berzerk of course.

How should this be solved?

For completeness, here is the entire void:

private void pHandle_LateUpdate_Aim()
{
    Vector3 nOldChestRotation = Chest.localRotation.eulerAngles;

    // Fade old input before capturing new, so we don't dull the freshest data.
    float yawBlend = Mathf.Pow(1.0f - Aim_yawInputFalloff, referenceFramerate * Time.deltaTime);
    // A Lerp toward zero is just the same as a multiplication by the blend factor.
    Chest_yawRate *= yawBlend;
    // Accelerate by mouse movement over the past frame.
    // (May need adjustment for display resolution).
    Chest_yawRate += Input.GetAxis("Mouse X");

    float yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    float offCenterYaw = Chest_currentYaw - Chest_yawCenter;

    float fDesiredChestYaw = Chest_currentYaw + yawDelta;
    float fHeroRotation = 0f;

    if (fDesiredChestYaw > Chest_rotateRange)
    {
        fHeroRotation = fDesiredChestYaw - Chest_rotateRange;
        //we don't rotate the chest beyond the allowed "Chest_rotateRange", so simply act like the user didn't move the mouse
        Chest_yawRate = 0;
        yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    }
    else if (fDesiredChestYaw < -Chest_rotateRange)
    {
        fHeroRotation = (Chest_rotateRange + fDesiredChestYaw);
        Chest_yawRate = 0;
        yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    }

    // If we're moving away from the center, slow down as we approach the edge.
    if (yawDelta * offCenterYaw > 0)
    {
        float extremityYaw = offCenterYaw / Aim_yawMaxRange;
        yawDelta *= 1.0f - extremityYaw * extremityYaw;
    }

    this.transform.Rotate(0, fHeroRotation, 0);

    // Ensure we never overshoot the allowed range.
    Chest_currentYaw = Mathf.Clamp(Chest_currentYaw + yawDelta,
                              Chest_yawCenter - Aim_yawMaxRange,
                              Chest_yawCenter + Aim_yawMaxRange);

    Vector3 nNewChestRotation = new Vector3(Chest.localEulerAngles.x, Chest_currentYaw, Chest.localEulerAngles.z);
    Chest.localRotation = Quaternion.Euler(nNewChestRotation);

    float fChestRotationDifference = nNewChestRotation.y - nOldChestRotation.y;

    //the neck should not rotate with the chest. So I first counter-rotate it against the new chest rotation, then rotate it a little towards the chest rotation
    Neck.transform.localRotation = Quaternion.Euler(0, Aim_NeckYaw - fChestRotationDifference + (fChestRotationDifference * 0.5f), 0);

}

sentences:
Optimizing large number of ModelRenderable cubes with ARCore? I am creating an ARCore Android app that involves rendering up to thousands of cubes, of course using a Node and ModelRenderable object for each. Understandably, I'm unable to do that without running into memory issues, so I'm looking for ways to optimize. Ideas I've had so far are:

Removing all of the cubes that had no empty space around them since they would be invisible.
Investigating into some sort of culling (which I don't know much about) to not render the sides of the cubes that are invisible. I don't know if ARCore will already do this.
Hiding all of the cubes that are hidden behind other cubes. I don't yet understand the math behind this.
Grouping cubes of the same type into larger cubes. In one example, there might be 16x16x16 rendered on the screen. Each cube is an individual unit with its own type. So in relation to my grouping idea, I would take all the cubes that have the same type would be replaced with one larger cube or cuboid.

I've tried removing all of the cubes that have no empty space around them, as those will not be visible. Long term, however, this will be insufficient.

I don't have a lot of code to show that's related as this question is more looking for ideas to write code, but basically I'll be having a very large number of:

// Where position is a Vector3 and material is a Material object.
ModelRenderable cube = ShapeFactory.makeCube(new Vector3(CUBE_WIDTH, CUBE_WIDTH, CUBE_WIDTH), position, material);
Node node = new Node();
node.setRenderable(cube);

I'm not creating a new material every time, I generate those at startup.

I understand there are lots of questions already answered about this kind of optimization, but I haven't been able to find much about the implementation of things such as culling and hiding blocked cubes in the context of ARCore. Would I be better off using Unity?

If anyone has advice or ideas, I'd love to hear them.

sentences:
Are there established conventions for naming "directions" (width,height) in 3D? I want to create a 3D game world where the players can modify the environment. I would like to bring it to the point where a power-user could even create "game objects" inside the application using some kind of very simple 3D modeling UI. So I decided to write this UI first, as I can then use it to create the game content. I spent some time in the last two months trying to learn Blender, and decided that this was a total overkill for what I want to create.

Anyway, I have the classes representing the 3D "concepts" mostly worked out, but I have problems with the "unwrapping" code, that is, mapping the graphic primitives, triangles and rectangles, to a texture file.

The 3 points representing a triangle are in 3D, but I need to work in 2D for the texture mapping. How should I best choose which of the 3 points to use as the "origin" of that triangle in the texture file, and how do I define some "reliable" concept of width and height that make sense, when I am in 3D?

I can think of several methods, but if one is most commonly used, I would like to know, so that my code also make sense to other people.

[EDIT] It seems I did a very bad job of explaining what I want. I understand how unwrapping works. I sweated blood going through a Blender unwrapping tutorial. But now I'm trying to write code that can automatically create a basic unwrapping of simple objects (boxes, wedges, pyramids, ... and composition thereof). My idea was to group primitives that are 1) in the same plane, and 2) touch each other in (flat) "boxes" and map those boxes to the first free spot on the texture file that is big enough (under the assumption that all primitives have the same scale). Far from optimal, but good enough to get going. Later, the user could have refined the unwrapping as necessary, for example, by mapping several "boxes" to the same coordinates, if they look the same. The box would have a width and a height, and the unwrapping would map the "origin" of the box (say top left corner) to the coordinate in the texture file where it should be mapped.

But, for me, width is the length is along the X axis, and height is the length along the Y axis. So how do I decide what is the width and the length when the box is in the X-Z plane, instead of the X-Y plane, for example? And which vertices is the "top left" when all vertices have the same "Y" or "X" coordinate (but vary in Z)? Unlike the real world, there is no "obvious" "up and down", "left and right" ... in computer 3D. Anything can be in any direction. Things don't "fall down" because there is no down.

Hopefully I now made clear my problem. How can I consistently define "top", "left", "width", and "height" when I am in 3D, instead of in 2D, and when a primitive might, for example look like an horizontal line from user point of view because it stretches in Z (which traditionally "comes out of the monitor") instead of Y?

My code can only make sense if I can define all concepts clearly, and unequivocally. I first need a way of defining those concepts that always apply, for any 3 points in 3D space. Only then can I look at any piece of my code, and decide whether it is correct or not. What I cannot define clearly, I cannot program correctly.

What I really want to know is what I asked in the title. I only talked about unwrapping to explain why I need to know this.

sentences:
DragonBones import question Most DragonBones tutorials I've found seem to have you importing separate files at the start of a project, but the example projects use a single PNG texture containing all the parts of the final armature, along with an accompanying JSON file that says how to chop up the texture to get at each part.

How would you create this pair of files?

sentences: Unity UI, how to hide on play I have created a menu on Unity using the built in UI components,I can't create this on a seperate scene because I used the toggle button, which basically when you click it, it spawns a specific object (I have 4 of these toggle buttons). I have completed making the menu on the my current scene. My problem is that when I start on runtime,  the menu appears in front of the first person character controller, and when I move the mouse to click the toggle, the camera controller follows the mouse movement. How do I fix this? Also when I click all of the toggle buttons, I want the UI to dissapear, so it isn't shown when I am playing the game because atm when I click the toggle buttons, the actual buttons stay on the screen whilst I am navigating around the scene, is there any way to make this invisible?

sentences:
SDL & Image quality on iOS We are just finishing a mobile game for Android and iOS.
The image quality on iOS is subpar, and we are trying to understand why.
We are currently having two problems: the background, which is a gradient, is shown using few colors and the grandient's steps are very visible, and the fonts are pixelated.
I think both issues are clearly visible in this screenshot from the simulator (zoom in if needed):

The simulator is running an iPhone Xs with Graphics Quality Override set to High Quality.
I have disabled “Compressing PNG files”, but the result is the same. This issue is not always so visible, or, at least, not on all devices. On a smaller iPhone (e.g., 7, so 4.7"), there are no noticeable issues with the image quality and the font pixelation is minimal.
We are probably going to disable support for iPad because of this.
Do you have any hints on what we can do?
Thanks!

sentences:
Where can I get correct pitch parameter for SDL_RenderReadPixels function in SDL2? I have a texture created with SDL_TEXTUREACCESS_TARGET access and I want to get all its pixels with SDL_RenderReadPixels() function. One of the function parameters is pitch and I don't really know where can I can get it.

Texture is created with dimensions of a previously created surface, but function call with surface->pitch as pitch parameter generates EXC_BAD_ACCESS.

Texture and surface dimensions are 800x600, and surface->pitch returns 3200, which is strange for me, because I thought that pitch is the width of the texture in memory and expected surface->pitch to be something like 1024.

sentences:
Traffic system in isometric game I would like to create a traffic system in my tile-based isometric game and I would like to ask for some good approaches because I don't have a clue how to begin.

Right now I have a tilemap and keep its data in an 2d array. I have...
1. tile objects (with properties like index, tile type etc.)
2. building objects (with properties like origin, size etc.).

I´ve already implemented a A* algorithm which allows me to find the best/shortest path from one tile to another but now I have to realize the movement from start to end tile with features like stackable cars.

I though about setting up a property for my tile object which tells me if a tile contains a car but right now two cars fits on one tile in my game on each lane so this approach might be not the best solution.

Edit: i´ve added an image with lanes drawn on my tilemap. Having lane objects might be a good idea but I need to connect them to the tile objects somehow.

Have anyone implemented a traffic system in a tile-based game or have any ideas how to realize that and would share his/her knowledge with me? Would be great!

Thanks a lot!

sentences:
How to playlay multiple Particle Systems when colliding with multiple obstacles using object pooling? I have two types of particle, one for each player:

Player 1 (Red Particle)
Player 2 (Blue Particle)

When player 1 collides with an obstacle then I want to play the red particle system, and when player 2 collides with an obstacle then I want to play the blue particle system.

Code:

TouchControll.cs

 public GameObject PlayersPartical;

  void OnTriggerEnter2D(Collider2D other)  //here my player collided with obstacle
    {
        foreach (Transform child in transform)
        {
            if (child.tag == "point")
            {

                //GameObject partical = Instantiate(twopartical[Random.Range(0,1)], transform.position, transform.rotation);
                //ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                //heal.Play();
                GameObject partical = Instantiate(PlayersPartical, transform.position, transform.rotation);
                ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                heal.Play();

                ObjectPooler.Instance.SpawnFromPool("redandbluepartical", transform.position, Quaternion.identity);
            }
        }
     }

ObjectPooler.cs

    public static ObjectPooler Instance;

    public void Awake()
    {
        Instance = this;
    }

    [System.Serializable]
    public class Pool
    {
        public string tag;
        public GameObject prefab1;
        public GameObject prefab2;
        public int size;
    }

    public List<Pool> pools;

    public Dictionary<string, Queue<GameObject>> pooldictionary;//which gameobject you should be pool

    void Start () {

        pooldictionary = new Dictionary<string, Queue<GameObject>>();

        foreach(Pool pool in pools) //add a pool in list
        {
            Queue<GameObject> objectpool = new Queue<GameObject>();

            for(int i=0;i<pool.size;i++)
            {
                GameObject obj =  Instantiate(pool.prefab1);
                GameObject obj1 = Instantiate(pool.prefab2);
                obj.SetActive(false);
                obj1.SetActive(false);

                //objectpool.Enqueue(obj);
            }

            pooldictionary.Add(pool.tag, objectpool);
        }
    }

   public GameObject SpawnFromPool(string tag,Vector3 position,Quaternion rotation)  //two tag red and blue partical
    {
        if(!pooldictionary.ContainsKey(tag))
        {
            Debug.Log("doesnot exist" + tag);
            return null;
        }

        GameObject objecttospawn =  pooldictionary[tag].Dequeue();

        //here how to call my trigger

        objecttospawn.SetActive(true);
        objecttospawn.transform.position = position; //pos
        objecttospawn.transform.rotation = rotation; //rotation

        pooldictionary[tag].Enqueue(objecttospawn);
        return objecttospawn;
    }

Image1:

Image2:

How do I call these particles?

sentences: In OpenGL, how can I discover the depth range of a depth buffer? I am doing a GL multi-pass rendering app for iOS. The first pass renders to a depth buffer texture. The second pass uses the values in the depth buffer to control the application of a fragment shader. I want to rescale the values in the depth buffer to something useful but before I can do that I need to know the depth value range of the depth buffer values. How do I do this?

sentences:
How do I write a game server with single-threaded networking? I want to write a game server with one thread for clients message handling and use something like epoll to accept network messages. All I/O and database access will be processed in a thread pool and they are asynchronous and non-blocking.

Given such a scheme, how should I handle other events/messages (physics, game logic, etc)? Can I implement methods to handle these messages as a blocking interface in the main thread?

What simple, popular servers exist (using Cocos*d/Unity as client) that I could look at for an example of this?

sentences:
Estimating costs in a GOAP system I'm currently developing a GOAP system in Java. An explanation of GOAP can be found at http://web.media.mit.edu/~jorkin/goap.html. Essentially, it's using A* to plot between Actions that mutate the world state.

To provide a fair chance for all Actions and Goals to execute, I'm using a heuristic function to estimate the cost of doing something. What is the best way to estimate this cost so that it is comparable to all the other costs?

As an example, estimating the cost of running away from an enemy versus attacking it - how should the cost be calculated to be comparable?

sentences:
How can I get sensor data on iPhone onto a Windows PC? For use as a steering wheel I am making a Unity game. I want to be able to allow the phone to be used as a steering wheel, as input into the PC game.

Technically, How can I achieve this? Can this be done through bluetooth?

Thanks

sentences:
Cocos2dx- how to box2d cannot move through each other? player box2d

auto playerbody = PhysicsBody::createBox(sp->getContentSize());
        playerbody->setGravityEnable(false);
        //playerbody->setDynamic(false);
        sp->setPhysicsBody(playerbody);

item box2d

auto ItemBody = PhysicsBody::createBox(item->getContentSize());
            ItemBody ->setGravityEnable(false);
            ItemBody ->setDynamic(false);
            item->setPhysicsBody(ItemBody );

When moving, these 2 boxes can go through each other.How does this not happen?
sorry my bad english. many thank

sentences:
Serialize classes based on Generics. Is it different? I have a certain ScriptableObject.

public class Biome : ScriptableObject { ... }

If I write the following in a component:

public List<Biome> list1;

This is what appears in the inspector:

So far so good. But if I try to make my list more generic, like this:

public class DistributedList<T>
{
    public List<T> items;
}

[System.Serializable]
public class BiomeList : DistributedList<Biome> { }

This is what I get on the inspector:

All I can seem to be able to add now is just a name, not the Object itself.

Why is this?

sentences:
Why is this MeshRenderer null? The following line fails in my class:

MeshRenderer nRenderer = _Sphere.AddComponent<MeshRenderer>();

This is the entire class. All works except the mentioned line.

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

public class SphereMaker : MonoBehaviour
{
    private GameObject _Sphere;

    void Start()
    {
        _Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        _Sphere.AddComponent<MeshFilter>();

        MeshRenderer nRenderer = _Sphere.AddComponent<MeshRenderer>();
        Material nMat = new Material(Shader.Find("Universal Render Pipeline/Lit"));//I'm using the URP

        if (nMat == null)
        {
            Debug.LogError("no mat!!\n");
        }
        nMat.color = Color.red;

        nRenderer.material = nMat;

        float fSize = 0.4f;

        _Sphere.transform.localScale = new Vector3(fSize, fSize, fSize);
        _Sphere.transform.position = new Vector3(0, 0, 0);

    }
}

Does anybody see what I'm doing wrong?

Thank you!

sentences:
Giving values to uniform in OpenGL First thing is that I know how to give values to uniforms in OpenGL. Second thing is that it is a question related to optimization and performance.

The habit for changing the uniforms, we preferred is like this:

//Consider that we have shaders having 'aValue' as uniform

//During initialization
GLint loc = glGetUniformLocation(program, "aValue");

//During a loop or when required to change uniform's value
if (loc != -1)
{
   glUniform1f(loc, 0.75);
}

But what if it is like this:

//'program' is a global variable

//Can be anywhere but not after destructing 'program'
void updateUniformf( const char* name, float value )
{
    glUniform1f(glGetUniformLocation(program, name), value);
}

//During a loop or when required to change uniform's value
updateUniformf("aValue", 0.75);

How much would such approach decreases the performance? Or would this approach even affects the performance? It will be appreciable to have some measurements or practical example rather than all theories. Of course, I need to know reasons as well.

Thanks for answering this question!

sentences:
Algorithm to draw particles in correct order? For a game I'm making as a hobbyist project, I need to be able to draw smoke on the screen. I am doing this by setting up a particle system. The problem is I need all the particles drawn in order from farthest to nearest to the camera (because the particles do have a bit of transparency, and the entire texture transparency increases over time in the particles) and I cannot figure out a way to successfully do it. Here is the code that draws each of the particles, along with the code that that is supposed to determine what order to draw them in so that it draws them from furthest from the camera to nearest to it:

    void drawSmoke( Camera cam ) {

      int drawOrder [50];

    bool particleChecked [50] = {false};

    for ( int a = 0; a < 50; a++ ) {

    int furthest;
    float furthestDistance = 0;

        for( int check = 0; check < 50; check++){

                if ( !particleChecked [check] ) {

                float aSquared = ( cam.getPosition().x - smokeParticles[check].position.x ) * ( cam.getPosition().x - smokeParticles[check].position.x );
                float bSquared = ( cam.getPosition().z - smokeParticles[check].position.z ) * ( cam.getPosition().z - smokeParticles[check].position.z );
                float cSquared = aSquared + bSquared;

                float distanceFromCamera = sqrt ( cSquared );

                        if ( distanceFromCamera > furthestDistance ) {
                        furthest = check;
                        furthestDistance = distanceFromCamera;
                        }

                }

        }

        drawOrder [a] = furthest;

    }

GLuint transformLocation = glGetUniformLocation ( particleProgram, "transform" );
GLuint alphaLocation = glGetUniformLocation ( particleProgram, "alpha" );

for( int particle = 0; particle < 50; particle++ ) {
glm::mat4 model;
glm::mat4 view;
glm::mat4 projection;

int particleToDraw = drawOrder [particle];

model = glm::translate( model, glm::vec3 ( smokeParticles [particleToDraw].position.x, smokeParticles [particleToDraw].position.y + 10.0f, smokeParticles [particleToDraw].position.z ) );
model = glm::scale(model, glm::vec3 ( smokeParticles [particleToDraw].scaleFactor ) );
glm::vec3 diff = glm::normalize ( smokeParticles[particleToDraw].position - cam.getPosition() );
float angle = atan2 ( -diff.x, -diff.z );
model = glm::rotate ( model, smokeParticles[particleToDraw].rotation , glm::rotate ( glm::vec3(0.0f, 0.0f, 1.0f), angle, glm::vec3(0.0f, 1.0f, 0.0f) ) );

//rotating particle to face camera
model = glm::rotate(model, angle, glm::vec3(0.0f, 1.0f, 0.0f));

view = glm::lookAt(cam.getPosition(), cam.getTarget(), glm::vec3(0.0f, 1.0f, 0.0f));

projection = glm::perspective( 45.0f, (float)800/(float)600, 0.1f, 5000.0f );

glm::mat4 transform = projection * view * model;

glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, smokeTexture );
glUseProgram( particleProgram );
glUniformMatrix4fv( transformLocation, 1, false, glm::value_ptr(transform) );
glUniform1f( alphaLocation, smokeParticles[particleToDraw].alpha );
glBindVertexArray( smokeVAO );
glDrawArrays( GL_TRIANGLES, 0, 6 );
glBindVertexArray(0);
    }

What it looks like is on each frame every element of drawOrder is the same value. But I cannot figure out why. How can I fix this?

sentences:
Potion effect never wears out I am writing a mod for Minecraft (in Java, duh) and want to apply a random potion effect like this:
    private static Effect[] poss_effects = new Effect[]{
        Effects.SPEED,
        Effects.SLOWNESS,
        Effects.HASTE,
        Effects.MINING_FATIGUE,
        Effects.STRENGTH,
        Effects.INSTANT_HEALTH,
        Effects.INSTANT_DAMAGE,
        Effects.JUMP_BOOST,
        Effects.NAUSEA,
        Effects.REGENERATION,
        Effects.RESISTANCE,
        Effects.FIRE_RESISTANCE,
        Effects.WATER_BREATHING,
        Effects.INVISIBILITY,
        Effects.BLINDNESS,
        Effects.NIGHT_VISION,
        Effects.HUNGER,
        Effects.WEAKNESS,
        Effects.POISON,
        Effects.WITHER,
        Effects.HEALTH_BOOST,
        Effects.ABSORPTION,
        Effects.SATURATION,
        Effects.GLOWING,
        Effects.LEVITATION,
        Effects.LUCK,
        Effects.UNLUCK,
        Effects.SLOW_FALLING,
        Effects.CONDUIT_POWER,
        Effects.DOLPHINS_GRACE,
        Effects.BAD_OMEN,
        Effects.HERO_OF_THE_VILLAGE
    };

    private long prev_milli = System.currentTimeMillis();

    @Override
    public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
        if (System.currentTimeMillis() - this.prev_milli >= 60000) {
            Effect to_apply = poss_effects[(int) (Math.random() * poss_effects.length)];
            int duration = (int) (Math.random() * 15 * 20);
            int amplifier = (int) (Math.random() * 2);
            playerIn.addPotionEffect(new EffectInstance(to_apply, duration, amplifier));
            this.prev_milli = System.currentTimeMillis();
        }
        return super.onItemRightClick(worldIn, playerIn, handIn);
    }

However, when the timer ticks down to zero on the potion effect, the effect stays there with the timer at 0:00. The first time I right-click it, I get two potion effects: one that works properly and only lasts for the given amount of time and one that has the problem described previously. All subsequent right-clicks produce the latter.
When I do this:
    @Override
    public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) {
        target.addPotionEffect(new EffectInstance(Effects.WITHER, 60, 2));
        target.setHeadRotation((float) (Math.random() * 360), (int) (Math.random() * 180 - 90));

        return super.hitEntity(stack, target, attacker);
    }

the effect applies normally and runs out normally every time I hit an entity.
What's wrong?

sentences:
How do you register two or more keys properly? I am experimenting with KeyListeners and I thought about how do I register two or more keys, this is my code so far:
package engine.listeners;

import engine.Frame;
import engine.KeyCodes;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.HashSet;
import javax.swing.*;

public class Key extends KeyAdapter implements KeyCodes, ActionListener {

    private static HashSet<Integer> keyMap = new HashSet<>();
    private Timer tm;

    public Key() {
        tm = new Timer(0, this);
        tm.start();
    }

    @Override
    public void keyPressed(KeyEvent e) {
        if (!keyMap.contains(e.getKeyCode())) keyMap.add(e.getKeyCode());
    }

    @Override
    public void keyReleased(KeyEvent e) {
        keyMap.remove(e.getKeyCode());
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        int x = Frame.moveMe.getX();
        int y = Frame.moveMe.getY();
        if (keyMap.contains(arrowLeft)) Frame.moveMe.setXY(--x, y);
        if (keyMap.contains(arrowUp)) Frame.moveMe.setXY(x, --y);
        if (keyMap.contains(arrowRight)) Frame.moveMe.setXY(++x, y);
        if (keyMap.contains(arrowDown)) Frame.moveMe.setXY(x, ++y);
    }
}

Right here, it's doing 2 registered keys properly, for example arrow left and arrow top goes diagonal left top.
But one thing I noticed, sometimes when I registered 3 or more keys, it's not working properly for example: arrow left, arrow right, and arrow up should just go up, but what happened is it ignored the key 'right', and so it continues going diagonal top left.
Is there a way to improve this? or should I implement another type of listener that is not buggy as KeyListener?

sentences:
Unity calculate the size of a text box before text gets drawn so it can lerp to the next size Im trying to make a dialog box image that lerps to the next size.

In order to do that I need to calculate the size of the image before the text gets drawn.

My idea is to use the legacy GUI stuff like guiStyle.CalcSize to get the width and guiStyle.CalcHeight to get the height. then im setting the image's layout elements min values = to the GUI sizes.

the width is set to the longest string in the array of "lines"

the problem is that while the image does scale it doesn't do so correctly. perhaps my approach is wrong and there's an easier way?

private void Update()
{
    lineText = dialogueRunner.dialogText;
    drawnText = dialogueUI.lineText.text;

    //Debug.Log(prefferedValues);

    numberOfCharactersInLine = dialogueRunner.dialogText.Length;

    lineTextWithNewLine = NewLineAfterNChar(lineText, 18);

    string[] lines = lineTextWithNewLine.Split(new[] { "\n" }, StringSplitOptions.None);
    for (int i = 0; i < lines.Length; i++)
    {
        longest = lines.OrderByDescending(s => s.Length).First();

        prefferedValues = textMesh.GetPreferredValues(longest);

        Debug.Log(longest.Length);
    }

    //scale isnt correct
    layoutElement.minWidth = size.x;
    layoutElement.minHeight = size.y;

}

void OnGUI()
{
    guiContent = new GUIContent(longest);

    guiStyle = GUI.skin.box;
    guiStyle.alignment = TextAnchor.UpperLeft;
    guiStyle.wordWrap = true;

    //------
    boxSize = new Rect(Screen.width / 2, Screen.height / 1, txtBGRect.sizeDelta.x, txtBGRect.sizeDelta.y);
    boxSize.center = new Vector2(Screen.width / 2, Screen.height / 2);

    // // Compute how large the button needs to be.
    size.x = guiStyle.CalcSize(guiContent).x;
    width = size.x / 1;
    size.y = guiStyle.CalcHeight(guiContent, width);
    height = size.y;

    GUI.Box(boxSize, longest); //this draws the box

}

//Pass it a string and it will insert a line break after every n characters at end of words.

public static string NewLineAfterNChar(string inputText, int lineLength)
{
    string[] stringSplit = inputText.Split(' ');//Split string into array seperatly "word1" "word2" "word3" etc...
    int charCounter = 0;
    string finalString = "";

    for (int i = 0; i < stringSplit.Length; i++)// iterates per word count
    {
        finalString += stringSplit[i] + " ";// "word1 "  "word2 " "word3 "
        charCounter += stringSplit[i].Length;

        if (charCounter > lineLength)//after n characters
        {
            finalString += "\n";
            charCounter = 0;
        }

    }
    return finalString;
}

sentences:
Why does adding LIBGDX "fadeIn" action to a table in a group make the whole stage fade in? I'm trying to "fadeIn" a store "screen" which is really just an invisible group. I set the group to visible=true, set the alpha to 0 and then do a "fadeIn" on the group. The problem is that the whole stage goes black (my clear screen color) and then fades back in.

storeGroup.addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

I even went as far as to make the Table within my StoreGroup accessible and adding the action to that, but the result is the same.

storeGroup.getTable().addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

Essentially I just want my store group to fade in over whatever is currently displaying, but the fade in seems to apply to every other actor in my Stage, not JUST the one I'm adding it to.

Any help would be greatly appreciated, I've been working on this all morning and can't figure out why the "fadeIn" is applying to everything.

sentences:
OpenGL Array Texture generates black texture I am creating a game using OpenGL that has many textured cubes. I am trying to use an Array Texture to load multiple textures from one file. I tried to setup my texture atlas; however, all that renders is a black texture. I'm not sure what exactly I am doing wrong.

Here is the texture loading code:

    // Load image
    stbi_set_flip_vertically_on_load(true);
    unsigned char *data = stbi_load(path, &width, &height, &nrChannels, 0);
    // Generate texture object
    glActiveTexture(GL_TEXTURE0);
    glGenTextures(1, &textureId);

    glBindTexture(GL_TEXTURE_2D_ARRAY, textureId);

    // Actually load texture
    if (data) {
        glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, width, height, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
        //glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
    } else {
        std::cout << "Failed to load " << path << " texture" << std::endl;
    }

    // set texture filtering parameters
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    // Free memory
    stbi_image_free(data);

Here is my fragment shader

#version 330 core
out vec4 FragColor;

in vec2 TexCoord;

uniform sampler2DArray my_sampler;

void main()
{
    FragColor = texture(my_sampler, vec3(0, 0, 1)) * vec4(1.0f);
}

Here is my texture file:

Does anyone know how I can solve my issue?

sentences:
Mobile Game Development: Supporting Multiple Screen Resolution for iOS Questions

When designing the graphics of the game (e.g. for iPhone): What is the resolution I should base it upon? Is it the smaller resolution (iPhone4 screen resolution) so that I could scale it bigger to bigger resolution devices later on or the bigger resolution (iPhone6+) so that I could scale it smaller for smaller resolution devices later on? Which solution would be the best to implement that will not distort the graphics?
I am creating a game now (endless runner type game) and I am using parallax backgrounds. What will be the best option in supporting multiple resolutions? Scale it so that it will look the same on every device but it might distort the image or reduces the viewing area of the game when scaled. Alternatively let the other parts of the background be seen on larger resolution devices making the graphics stay as it is but let users using larger resolution devices see objects that might not be seen on smaller devices. I am talking about the next part of the parallax background.

My question pertains to iPhone devices (iPhone 4/4s, iPhone 5, iPhone 5s, iPhone 5c, iPhone 6, iPhone 6 Plus) for now.

sentences:
Libgdx texture bleeding in tile map So I am making a game in Libgdx using an isometric tiled map but when I set the texture filtering of the tiles to linear, black lines show up between all the tiles. This is caused because each tile blends with the tiles next to it.

I know many people have asked this before and the common answer seems to be add padding. I have padding but that doesn't help because then the tiles start blending with the clear pixels instead. That just turns the lines a different color.

Another option people say is to copy the pixels on the edge of each tile for padding, but unfortunately that only works for non-isometric maps. However when I use the tilemap preprocessor it works fine even with filtering, but the tilemap preprocessor causes many other issues so I don't want to do that.

How can I fix this? Somehow the tiledmap preprocessor does it fine but I'm not sure what that actually does other than adding padding. Any help is greatly appreciated!

sentences:
OpenGL Render Queue Design I am currently designing the rendering system for a 2D game built in C++ and OpenGL, and am unsure about how to go about implementing a sorting procedure to maximise efficiency and minimize OpenGL texture changes. Currently my system looks something like this:

void Renderer::draw(Sprite sprite)
{
    for (Batch b : m_batches) {
        if (sprite.getTexture() = b.getTexture() && b.enoughRoom(sprite)) {
            b.submit(sprite);
            return;
        }
    }

    m_batches.push_back(Batch(default_size, sprite.getTexture());
    m_batches.top().submit(sprite);
}

void Renderer::display()
{
    for (Batch b : m_batches) {
        b.draw();
    }
}

However, this feels like a pretty naive implementation, and what worries me is that every time I submit a sprite into a batch using b.submit(sprite), I am calling glSubBufferData(); (So say for drawing 2000 sprites, thats 2000 calls to glSubBufferData per frame which feels very slow).

What I feel would be better is to only call glSubBufferData once with all of the vertex data that would go into that buffer. How would I go about doing this? I though about giving the Renderer class a RenderQueue vector, which when sprites are submitted are pushed back into the queue, but how would I go about sorting this vector and then splitting it up into all of the different Batches, while keeping in mind that a Batch size cannot exceed a limit? (As in, I don't want too many vertices in a single VBO).

EDIT: Also, I understand that it would be very easy to implement this if I used simply one texture atlas, however I would not like that limitation and would prefer to implement a system that allows for 2 or 3 different atlases.

sentences:
How to assign game objects to a script without dragging and dropping into inspector? So I have a script for getting into a car which, when mouse down is detected on the given game object it will teleport the player to the car, turn of the player's controller,  and switch the player camera to the car camera.

The problem is I don't want to have to drag and drop the car game object, the player game object, and both cameras into the inspector for it to work.

Instead I would like it to have the script assign all those game objects based on the player who clicked on the car. Those game objects being the car the player, and the two cameras(one parented to the player and the other parented to the car). I have no clue how to go about this so I appreciate any help all the more.

Here is a picture of the inspector with the player script:

Also here is my C# code:

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

public class GetInCar : MonoBehaviour {
    public GameObject player;
    public GameObject car;
    public Camera CarCam;
    public Camera PlayerCam;

    void Start ()
    {
    }

    void OnMouseDown ()
    {
        if (Input.GetKey (KeyCode.Mouse0))
        {
            player.transform.position = car.transform.position;
            print("MovedToCar");
            GameObject.Find ("Player").GetComponent<CharacterController> ().enabled = false;
            PlayerCam.enabled = false;
            CarCam.enabled = true;
        }
    }
}

sentences:
How to resolve duplicate data in Entity Systems? Whilst working on examples and upgrades for my C++ Entity System, something randomly caught the attention of my mind, by surprise: duplicate data. What I'm referring to is how an entity system that uses other libraries (e.g. Ogre3D, SFML, etc.), which already store some information about your entities, handles storing information in custom components.

The Problem:

Say you have two define component types, called: Position component (which holds the location of an Entity) and Velocitycomponent (which holds how fast an Entity is moving, and the direction it is moving toward). And of course, you have a Movement system, which moves entities with a Position and Velocity component attached to it. Now... here comes the tricky part, how would you store the Position component effectively/efficiently, so that you do not duplicate data? By duplication of data, this is what I mean (this is a simple example): a Sprite object typically has it's own x/y position (take for example, SFML's Sprite class), therefore if I had a Position component with it's own x/y values, then I would be duplicating data, would I not? I thought about using pointers/references* in a Position component, but that doesn't really work out if I want to save entities to files.

*Yes, I do know that sizeof(float) == sizeof(float*), but sizeof(vec2/3) != sizeof(vec2/3*). This doesn't really seem much of a problem at first: but what if I had bigger objects to store, such as:

A Mesh:

How would I store a Mesh effectively in a component? I was thinking of just storing a string to where the mesh data was located, but then I thought, what if it's not in a file? How do I resolve that? I also thought to store the raw data in the component, but if I use a 3rd party graphics library (such as Ogre3D or Irrlicht), then I require to actually create the Mesh data via another object.

So, the summed up question is: what's the best way to reduce duplicate data, using an Entity System design, in your game?

Would I have to re-make everything from scratch so that it just "fits" in my entity-system?  I'd prefer not to do that, especially if I decide to change the design  pattern that I use to make games.

sentences:
Tile based map and collision; getting stuck I'm trying to make my character move around a tile map with collisions. Everything works fine except for one thing. I show you a picture with the problem:

http://i.stack.imgur.com/ZWI7x.jpg

That is, when I reach a tile above then I can not move anywhere. If you come from the left, I can not move either up or down. If you reach the bottom, I can move to the left but not right. And when you reach the right I can move in any direction.

Honestly I have no idea what may be failing. I think it has to do with if (...), because if I change the order,  the addresses where I can move change :/

Here I leave some code:

boolean collision = false;

if(Keyboard.isKeyDown(Keyboard.KEY_UP)) {
    for(int i = 0; i < map.GetNumLayers(); i++) {
        if(UpTile(map, i) > 128) {
            collision = true;
        }
    }

    if(!collision) AddPos(0.0f, -vel);
}
if(Keyboard.isKeyDown(Keyboard.KEY_LEFT)) {
    for(int i = 0; i < map.GetNumLayers(); i++) {
        if(LeftTile(map, i) > 128) {
            collision = true;
        }
    }

    if(!collision) AddPos(-vel, 0.0f);
}
if(Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
    for(int i = 0; i < map.GetNumLayers(); i++) {
        if(DownTile(map, i) > 128) {
            collision = true;
        }
    }

    if(!collision) AddPos(0.0f, vel);
}
if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) {
    for(int i = 0; i < map.GetNumLayers(); i++) {
        if(RightTile(map, i) > 128) {
            collision = true;
        }
    }

    if(!collision) AddPos(vel, 0.0f);
}

public int UpTile(Map map, int layer) {
    return map.GetValue(layer, (int) (x/size), (int) (y/size));
}

public int LeftTile(Map map, int layer) {
    return map.GetValue(0, (int) (x/size), (int) (y/size));
}

public int DownTile(Map map, int layer) {
    return map.GetValue(layer, (int) (x/size), (int) (y/size + 1));
}

public int RightTile(Map map, int layer) {
    return map.GetValue(layer, (int) (x/size + 1), (int) (y/size));
}

public int GetValue(int layer, int x, int y) {
    return array[layer][y][x];
}

The map is an array with 3 componentes: [LAYER][Y][X]. So, in RightTile by example, with GetValue, I'm getting the value from the array in the position [layer][y/size][x/size + 1], x/size + 1 because I want to get the kind of tile that is to my right (same with the others). size = 64, that is the width and height of each tile.

Thanks >.<

sentences:
Need to programatically muffle game sounds So I work on a multiplayer game that is set in space. There are essentially two environments for players to be in: inside a sealed space station (where there is air and thus sounds) and outside the station in the vacuum of space (where there is no air and no sound to hear).

For a while now, we've had it so that you cannot hear any of our game's sound effects while floating in a space with no air, and while that might be realistic, it's not very fun when the game is completely silent sans background music.

I'd much rather find some way to dynamically distort the sounds on the fly before they are played so that they seem to be muffled or dampened. I have no sort of background in making sounds or doing much of anything with them and all my searches have amounted to nothing; mostly finding things about sound editing programs.

The project is made in a C based language for game programming that is really obscure called Dream Maker or Byond. I can't seem to find any built-in features that are able to solve this problem for me. Any help would be much appreciated.

sentences: Why does the keyboard continue to control disabled buttons? Having the whole panel with all its children including buttons disabled by simple gameObject.SetActive(false) doesn't prevent the buttons from interacting (navigation and clicks) with the keyboard. What could be the reason?

sentences:
Andengine. Put bullet to pool, when it leaves screen i'm creating a bullet with physics body. Bullet class (extends Sprite class) has die() method, which unregister physics connector, hide sprite and put it in pool

public void die() {
    Log.d("bulletDie", "See you in hell!");
    if (this.isVisible()) {
        this.setVisible(false);

        mPhysicsWorld.unregisterPhysicsConnector(physicsConnector);

        physicsConnector.setUpdatePosition(false);

        body.setActive(false);

        this.setIgnoreUpdate(true);

        bulletsPool.recyclePoolItem(this);
    }

}

in onUpdate method of PhysicsConnector i executes die method, when sprite leaves screen

physicsConnector = new PhysicsConnector(this,body,true,false)
    {
        @Override
        public void onUpdate(final float pSecondsElapsed) {

            super.onUpdate(pSecondsElapsed);

            if (!camera.isRectangularShapeVisible(_bullet)) {
                Log.d("bulletDie","Dead?");
                _bullet.die();
            }

        }
    };

it works as i expected, but _bullet.die() executes TWICE.
what i`m doing wrong and is it right way to hide sprites?

here is full code of Bullet class (it is inner class of class that represents player)

private class Bullet extends Sprite implements PhysicsConstants {
    private final Body body;

    private final PhysicsConnector physicsConnector;

    private final Bullet _bullet;

    private int id;

    public Bullet(float x, float y, ITextureRegion texture, VertexBufferObjectManager vertexBufferObjectManager) {
        super(x,y,texture,vertexBufferObjectManager);

        _bullet = this;

        id = bulletId++;

        body = PhysicsFactory.createCircleBody(mPhysicsWorld, this, BodyDef.BodyType.DynamicBody, bulletFixture);

        physicsConnector = new PhysicsConnector(this,body,true,false)
        {
            @Override
            public void onUpdate(final float pSecondsElapsed) {

                super.onUpdate(pSecondsElapsed);

                if (!camera.isRectangularShapeVisible(_bullet)) {
                    Log.d("bulletDie","Dead?");
                    Log.d("bulletDie",id+"");
                    _bullet.die();
                }

            }
        };

        mPhysicsWorld.registerPhysicsConnector(physicsConnector);

        $this.getParent().attachChild(this);
    }

    public void reset() {

        final float angle = canon.getRotation();

        final float x = (float) ((Math.cos(MathUtils.degToRad(angle))*radius) + centerX) / PIXEL_TO_METER_RATIO_DEFAULT;
        final float y = (float) ((Math.sin(MathUtils.degToRad(angle))*radius) + centerY) / PIXEL_TO_METER_RATIO_DEFAULT;

        this.setVisible(true);
        this.setIgnoreUpdate(false);

        body.setActive(true);
        mPhysicsWorld.registerPhysicsConnector(physicsConnector);
        body.setTransform(new Vector2(x,y),0);

    }

    public Body getBody() {
        return body;
    }

    public void setLinearVelocity(Vector2 velocity) {
        body.setLinearVelocity(velocity);
    }

    public void die() {
        Log.d("bulletDie", "See you in hell!");
        if (this.isVisible()) {
            this.setVisible(false);

            mPhysicsWorld.unregisterPhysicsConnector(physicsConnector);

            physicsConnector.setUpdatePosition(false);

            body.setActive(false);

            this.setIgnoreUpdate(true);

            bulletsPool.recyclePoolItem(this);
        }

    }

}

sentences:
Coordinate transformation in voxel ray-tracing? I am implementing voxelization. I can't understand the coordinate transformation through shader.

I have read some papers and code, the first step in the geometry shader is project the triangle along its dominant axis.

What's the difference between this method and using projection matrix?

In usual ways, we transform data from local space,world space, view space,
then to projection space.

Does project the triangle means we transform from view space to projection space ?
What should we get after these process, in the end of pixel shader?

sentences:
XNA Tile Location from Screen Location Possible Duplicate:
  XNA Tile from Screen Location

I have a tile based game that is in a semi-isometric view created by a transformation. The tiles are created by a Texture2d rendered on a 3d surface.

My map Image: http://balancedcms.com/Capture.PNG

I am using the following code for my transformation:

View = Matrix.CreateLookAt(new Vector3(0, -1.1f, 1.6f), new Vector3(0, 0, 0), new Vector3(0, 53, 0));
Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi - 2.4f, 4.0f / 3.0f, 1, 500);

quadEffect = new BasicEffect(device);

quadEffect.World = Matrix.Identity;
quadEffect.View = View;
quadEffect.Projection = Projection;
quadEffect.TextureEnabled = true;

quad = new Quad(new Vector3(0, 0, 0), Vector3.Backward, Vector3.Up, 3, 3);

My problem comes along when I attempt to get the current tile that I am hovering the mouse over. I have a mouse X and Y however I can't seem to figure out how to transform these screen coordinates into a tile X and Y. The tiles are 128px by 128px; however, after the camera transformation they are smaller on the top and larger on the bottom(to create the isometric view)

I've tried transforming the mouse X and Y with the same projection matrix. However, this didn't work. I think it is due to the view matrix not being taken into account... sample below:

Vector3.Transform(new Vector3(Mouse.GetState().X, Mouse.GetState().Y, 0), Projection);

This image may provide more information... is also shows the hours I've put into figuring this out: http://balancedcms.com/1111.png

sentences:
Object oriented approach to debug mode I'd like to introduce a way to turn off/on debug messages and in-game tooling (tweak menus, for example) without non-game related branches, e.g:

if(DEBUG_MODE) {
    // show tweak menu

    // some message
    console.log("In this function");
}

Is there a more reusable approach to this problem?

sentences:
What is the most efficient way to find hit point of BOX and internal Ray? most efficient AABB vs Ray collision algorithms
I found this topic on AABB ray test. Some of them could find hit point of external Ray and BOX.
I did my version for both external and internal ray, but it seem not working for internal ray.
What's the problem on my solution? Or any good algo for this use case?
   bool hit(thread Ray& ray, float2 range_t, thread HitRecord& record) const constant {

        float tmin = range_t.x;
        float tmax = range_t.y;

        float3 normal = float3(0);

        for (auto i : {0, 1, 2}) {

            auto min_bound = (mini[i] - ray.origin[i])/ray.direction[i];
            auto max_bound = (maxi[i] - ray.origin[i])/ray.direction[i];

            auto ts = min(max_bound, min_bound);
            auto te = max(max_bound, min_bound);

            tmin = max(ts, tmin);
            tmax = min(te, tmax);

            if (tmax < tmin) { return false; }
            //if (tmax <= tmin || tmax < 0) { return false; }
            //if (tmax <= tmin || tmax < 0 || tmin < 0) { return false; }

            if (ts >= tmin) {
                //tmin = ts;
                normal = float3(0);
                normal[i] = abs(min_bound) < abs(max_bound)? -1:1;
            }
        }

        record.t = tmin;
        record.n = normal;

        if (tmin < 0) {
            record.t = tmax;
        }

        return true;
    }

```

sentences:
How can I prevent a GameObject within a ScrollView from moving? I have a ScrollView.  It has children, most of which I want to scroll, but some of which I want to remain still.  Think of something along the lines of a spreadsheet where the title rows/columns don't move.

I have somewhat succeeded, as the GameObjects I want to stay in their place do, but they are fighting the ScrollView to move.  It forces them to jitter every time I scroll.  Here is my current code:

private Vector3 originalPosition = Vector3.zero;

private IEnumerator Start()
{
    yield return new WaitWhile(() => transform.position == Vector3.zero);
    originalPosition = transform.position;
}

private void OnGUI()
{
    if (originalPosition == Vector3.zero)
    {
        return;
    }
    transform.position = originalPosition;
}

What is causing it to jitter?  And how can I fix it?

(The reason I am waiting to start updating is because my GameObject originally thinks its position is (0, 0, 0)...not sure why.  Maybe its related?)

sentences:
Bullet physics C# script Is imparting force on rigidbody objects I have recently made the simplest gun and bullet script that I could and it works amazingly, except for one problem that I've found. When I attach it to a game object with a rigid body the force of the bullets move the object back with quit a bit of force.

But what I can't seem to figure out is why the bullets are imparting force on the object at all. The bullets do not have a rigid body component. The way my guns work is with two scripts, one which acts as a simple spawning point when a key down event is given and what ever object you give it to spawn.

The second script is applied to the bullet itself which causes the bullet to have motion through transform.Translate with a speed variable. The best example I can give of this is when I attached two guns to the default unity jet and when I fired, it had enough force to move the jet back against its thrust speed.

I really would appreciate any help with this so I can move on with my project. I will provide the code bellow for the two scripts.

Thank you

public class Shoot : MonoBehaviour {
  public GameObject bullet;

  void Update () {
    if (Input.GetKey (KeyCode.Mouse0))
      Instantiate(bullet, transform.position, transform.rotation);
  }
}

public class MoveBullet : MonoBehaviour {

  public float speed = 1f;

  void Update () {
    transform.Translate (0, 0, speed);
  }
}

sentences:
How does one calculate color intensity? How do I calculate color intensity if I have a image sample of RGB?

The sample is of a float3 of red, green, blue. I'm trying to do a bilateral blur and have to not change the image if the color intensity is the same so it will preserve edges.

 float4 BilateralFiltering(VertexOut input) : SV_Target
{

 const float pixel = 0.01f;

     float4 centralColor;
     float gaussianWeightTotal;
     float4 sum;
     float4 sampleColor;
     float distanceFromCentralColor;
     float gaussianWeight;
     float distanceNormalizationFactor = 1.0;
     centralColor = gDiffuseMap.Sample(samAnisotropic, input.Tex.xy + float2(0,0));
     gaussianWeightTotal = 0.18;
     sum = centralColor * 0.18;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     return sum / gaussianWeightTotal;

     }

sentences:
How to chain actions/animations together and delay their execution? I'm trying to build a simple game with a number of screens - 'TitleScreen', 'LoadingScreen', 'PlayScreen', 'HighScoreScreen' - each of which has it's own draw & update logic methods, sprites, other useful fields, etc. This works well for me as a game dev beginner, and it runs.

However, on my 'PlayScreen' I want to run some animations before the player gets control - dropping in some artwork, playing some sound effects, generally prettifying things a little. However, I'm not sure what the best way to chain animations / sound effects / other timed general events is.

I could make an intermediary screen, 'PrePlayScreen', which simply has all of this hardcoded like so:

Update(){
     Animation anim1 = new Animation(.....);
     Animation anim2 = new Animation(.....);
     anim1.Run();
     if(anim1.State == AnimationState.Complete)
          anim2.Run();
     if(anim2.State == AnimationState.Complete)
          // Load 'PlayScreen' screen
}

But this doesn't seem so great - surely their must be a better way? I then thought, 'Hey - an AnimationManager! That'd be awesome!'. But then that creeping OOP panic set in as I thought about it some more.

If I create the Animation in my Screen, then add it to the AnimationManager (which may or may not be a GameComponent hooked up to Update/Draw), how can I get 'back' to it? To signal commands like start / end / repeat? I'd still need to keep a reference to the object in my Screen so that I could still communicate with it once it's buried in the bosom of a List in my AnimationManager. This seems bad.

I've also tried using events - call 'Update' on all the animations in the PlayScreen update loop, but crucially all of the animations have a bool flag ('Active') which determines whether they should begin. The first animation has this set to 'true', all others 'false'. On completion the first animation raises an event, which sets animation 2's bool flag to true (and so it then runs). Once animation 2 is complete another 'anim complete' event is raised, and the screen state changes.

Considering the game I'm making is basically as simple as it gets I know I'm overthinking this... it's just the paradigm shift from web -> game development is making me break out in a serious case of the stupids.

sentences:
How to unit test XNA Game object I'm doing a hobby game project using Visual Studio 2015 and XNA, via the MonoGame implementation. I wanted to do some unit testing, as I recently discovered this feature in Visual Studio, and want to get a feel for how it can be used.

The problem is, I can't get it to work with the XNA Game object, or anything derived from it.

This is a simple instantiation test I made:

[TestMethod()]
public void MyTest()
{
    try
    {
        MyObject Test = new MyObject();
    }
    catch
    {
        // Fail the test if any exception occurs in the constructor.
        Assert.Fail();
    }
}

Whenever I use my own object in place of MyObject, the test passes.  When I use MyGame (derived from Game and with my own properties/methods), the test fails.  I've tested the same object in the debugger, and it doesn't throw an exception.

Any idea what I'm doing wrong, or is the Game class just incompatible with Visual Studio unit testing?

sentences:
Using Event Driven Programming in games, when is it beneficial? I am doing a refresher on ActionScript 3.

Other than using rudimentary tools like, Event.ENTER_FRAME and using events to receive input from the user's mouse and keyboard, I find that I rarely use events and prefer to use public functions.

I am starting to reconsider this approach. From what I have learned thus far, the event system works this way:

Each dispatcher can listen to itself during the target phase. Each display object on the stage, can listen to it's children before the target phase, during Capture or after the target phase, during bubbling.

I would like to see an example of good use of the Event class for
game programming. Have you used Event driven programming in a game
and have a good example you could share?
A lot of times I want to pass a message to a 'sibling' so I could
have their methods listen to the stage or the parent object. Is that
the best way to communicate between objects that are not parents of
the dispatcher they want to listen to?
I would like to know if events are better performance wise than public functions.
Are there cases where using events can result in superior performance than avoiding events and sticking to function calls?

sentences:
How calculate a new node after cutting a node into an octree I'm working on a small XNA game, voxel-based like minecraft.
I've recently faced a problem in how to delete a node (cube) from an octree and re-calculate the new octree afterward.

I have already tried searching for implementations of the algorithm on the net, but without success.

This is the function I tried:

    /* ****************** */
    /* RemoveCubeFromNode */
    /* ****************** */
    #region RemoveCubeFromNode
    // Remove a node from an Octree
    private BoundingBox[] RemoveCubeFromNode(BoundingBox cubeToDelete, BoundingBox cubeParent )
    {
        // ......
        // split the cube from parent
        // return the two new BoundingBoxes
    }
    #endregion

Here are the pictures that represent what should be my functionality:
Knowing that my function should always return 2 new cubes (boundingBox) or 1 only.

In red is the cube to remove

In brown and blue are the two new cubes calculated

A thousand thanks in advance to whoever can help me... this algorithm is driving me crazy, and I can not stop thinking that someone else must have had this problem too.

The way about how i calculate my octree from my world

First I initialize an integer array with 3 dimensions.
Where each integer value corresponds to a structure id.
0 - no structure (empty)
1 - land
2 - [water]  etc ...
`

public void generateMatriceWorld()
{
     int[][][] matrice = null;
     int widthMap = 1024; int lengthMap = 1024; int heightMap = 64;
     matrice = new int[widthMap][][];
     for (int i = 0; i < widthMap; i++)
     {
        matrice[i] = new int[lengthMap][];
        for (int j = 0; j < lengthMap; j++)
        {
          matrice[i][j] = new int[heightMap];
        }
     }

     //randoom put value Inside my world

`

After that i use the method where I divide my world => 8 blocks by 8 blocks  if more than one floor, and 4 if one floor. And this until the blocks structure curently cutted get the same structure .

sentences:
Unity strange clones behavior I am setting up a grid of tiles (2d sprites) in Unity with this code:

public class Grid : MonoBehaviour {

public GameObject slot;
public int gridW = 9;
public int gridH = 9;

private GameObject [,] grid = new GameObject[9, 9];

void Awake(){

    for(int y=0; y<gridW; y++)
    {
        for(int x=0; x<gridH; x++)
        {
            GameObject gridSlot = (GameObject)Instantiate(slot, new Vector3(x, y, 0), Quaternion.identity);
            gridSlot.transform.parent = transform;
            grid[x,y]=gridSlot;
        }
    }

}

I then would like to have printed on the console the x,y coordinates of an individual tile when clicked on it. This is the script attached to the tile prefab:

public class Tile : MonoBehaviour {

void Start () {

}

void Update () {

    if(Input.GetMouseButtonDown(0))
        Debug.Log(transform.position.x + " " + transform.position.y);
}

Yet when I click on a tile I get printed the coordinates for ALL of the tiles on the grid. Why is this happening? Is there something very basic I am missing...?

Thanks!

sentences:
DirectXTK Model : How to draw with custom vertex & pixel shader? Here is the code I use to render a .cmo (from .fbx) mesh :

void Render()
{
    assert(g_d3dDevice);
    assert(g_d3dDeviceContext);

    Clear(Colors::LimeGreen, 1.0f, 0);

    //g_d3dDeviceContext->VSSetShader(g_d3d_GEOM_VertexShader, nullptr, 0);
    //g_d3dDeviceContext->VSSetConstantBuffers(0, 3, g_d3dConstantBuffers);

    g_d3dDeviceContext->RSSetState(g_d3dRasterizerState);
    g_d3dDeviceContext->RSSetViewports(1, &g_Viewport);

    //g_d3dDeviceContext->PSSetShader(g_d3d_GEOM_PixelShader, nullptr, 0);
    //g_d3dDeviceContext->PSSetShaderResources(0, 1, &g_SkyboxShaderRessourceView);

    g_d3dDeviceContext->OMSetRenderTargets(1, &g_d3dRenderTargetView, g_d3dDepthStencilView);
    g_d3dDeviceContext->OMSetDepthStencilState(g_d3dDepthStencilState, 1);

    // Draw ship
    std::unique_ptr<CommonStates> states(new CommonStates(g_d3dDevice));
    DGSLEffectFactory fx(g_d3dDevice);
    auto testMesh = Model::CreateFromCMO(g_d3dDevice, L"media/meshes/space-frigate/space_frigate_6.cmo", fx, false);
    testMesh->Draw(g_d3dDeviceContext, *states, g_WorldMatrix, g_ViewMatrix, g_ProjectionMatrix);

    Present(g_EnableVSync);
}

What puzzles me :

How do I use my own vertex / pixel shaders instead of the auto-generated ones ? Notice I commented the line where I set the shaders and it works just as well...
What is the CommonStates object and what is it used for ? It doesn't seem to do anything even when adding i.e. states->Wireframe();
Why is an DGSLEffectFactory required and what is it used for ?
Why does the Z-test fail in the 2nd image ?

All in all : should I write my own mesh loader instead to rely on custom vertex / pixel shaders ?

sentences:
What is the relationship between glVertexAttribPointer index and GLSL location? I've been getting some strange results when trying to implement a normals buffer for the purpose of rendering lighting.  It seems to be related to the indexes for glEnableVertexAttribArray, glVertexAttribPointer and the location value in the vertex shader.
Take a look at the following code for example:

  gl.glEnableVertexAttribArray(1);
  gl.glEnableVertexAttribArray(0);

  //bind vertex data - why does the index have to be 1?
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[VERTICES_IDX]); //the vertex data
  gl.glVertexAttribPointer(1,3,GL4.GL_FLOAT, false,  0,0);

  // Select the VBO, GPU memory data, to use for colors
  // - why doe the index have to be 0??
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[COLOR_IDX]);
  gl.glVertexAttribPointer(0, 3, GL4.GL_FLOAT, false, 0, 0);

  //bind IBO
  gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, vboHandles[2]);

Where do the values for the indexes used in the above functions come from?  If I were to switch them and make the color buffer 1 and the vertex buffer 0, nothing renders.  It seems logical to me that the vertices should be applied first and then the colors?  My confusion is compounded when I try to pass the data to a shader.  I thought the location value in the shader program referred to the index in glVertexAttribPointer but that doesn't seem to be the case.  In fact it looks like location is being completely ignored (targeting GLSL 430).
Have a look at this:

From the shader:

layout (location=0) in vec3 vertexPosition;
layout (location=1) in vec3 vertexNormal;

The Java code:

//with glEnableVertexAttribArray 0 and 1 enabled all of the cubes render but they
//are individually lighted - ie the shading doesn't propagate over the whole scene,
//only over each cube.
//if i rem 1, the scene looks lighted properly.  So only 1 vertex array enabled
//and it still works?
  gl.glEnableVertexAttribArray(0);
  gl.glEnableVertexAttribArray(1);
  //gl.glEnableVertexAttribArray(2);

  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[VERTICES_IDX]);
  //with the index set to 5 (doesn't relate to any other index) the scene still
  //renders...
  gl.glVertexAttribPointer(5,3,GL4.GL_FLOAT, false,  0,0);

  //normals
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[3]);
  gl.glVertexAttribPointer(1, 3, GL4.GL_FLOAT, false, 0, 0);

      // Select the VBO, GPU memory data, to use for colors
  //almost strangest of all.  If I remove colors the program crashes.  I don't
  //even use this buffer..
  gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboHandles[COLOR_IDX]);
  gl.glVertexAttribPointer(0, 3, GL4.GL_FLOAT, false, 0, 0);

  //bind IBO
  gl.glBindBuffer(GL4.GL_ELEMENT_ARRAY_BUFFER, vboHandles[2]);

There is obviously something fundamental here that I am not understanding.  I would think that by setting the glVertexAttribPointer index for the vertices to 5 it would
unlink from the shader in variable as its location is 0.  I need to know what is going on here especially now that I am implementing lighting.
So, what is the relationship between the glVertexAttribPointer index and the shader location value?  Also, why does the index have to be certain value (eg 0 for color, 1 for vertex)?

sentences:
Off-Screen Image processing with SharpDX I need help with a image processing task... I'm using SharpDX which I am very new to. I have a device3D, device3DContext... I have a Texture2D for off-screen rendering... I have a RenderTargetView...

Here is what I cannot figure out... I need to create a Quad aligned to the target dimensions... based on a TriangleStrip... I need to load an image onto said Quad... I need to be able to apply a Pixel Shader to it...

Here is my prototype so far...

public event Action OnInitialized;

    public ImageProcessor()
    {

    }

    public void Initialize(System.Drawing.Size size)
    {
        try
        {

            var bestAdapter = DisplayAdapters.GetBestAdapter(SharpDX.Direct3D.FeatureLevel.Level_10_0);

            using (
                var device = new SharpDX.Direct3D11.Device(bestAdapter,
                    SharpDX.Direct3D11.DeviceCreationFlags.BgraSupport, bestAdapter.FeatureLevel()))
            {
                Device = device.QueryInterface<SharpDX.Direct3D11.Device1>();
            }

            using (var dxgiDevice = Device.QueryInterface<SharpDX.DXGI.Device>())
            {
                GPUDescription = dxgiDevice.Adapter.Description.Description;
            }

            DeviceContext = AddDisposable(Device.ImmediateContext.QueryInterface<SharpDX.Direct3D11.DeviceContext1>());

            var colorFormat = SharpDX.DXGI.Format.R8G8B8A8_UNorm;

            var bufferDescription = new SharpDX.Direct3D11.Texture2DDescription()
            {
                ArraySize = 1,
                BindFlags = SharpDX.Direct3D11.BindFlags.RenderTarget | SharpDX.Direct3D11.BindFlags.ShaderResource,
                CpuAccessFlags = SharpDX.Direct3D11.CpuAccessFlags.None,
                Format = colorFormat,
                Height = size.Height,
                Width = size.Width,
                MipLevels = 1,
                OptionFlags = SharpDX.Direct3D11.ResourceOptionFlags.None,
                SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
                Usage = SharpDX.Direct3D11.ResourceUsage.Default
            };

            Target = new SharpDX.Direct3D11.Texture2D(Device, bufferDescription);

            RenderTargetView = new SharpDX.Direct3D11.RenderTargetView(Device, Target);

            OnInitialized?.Invoke(this);

        }
        catch (SharpDX.SharpDXException ex)
        {

            var desc = ex.ResultCode;
        }
    }

    public System.Drawing.Image ProcessImage(string filename)
    {

        Device.ImmediateContext.ClearRenderTargetView(RenderTargetView, SharpDX.Color.Gray);

        Target = TextureLoader.CreateTexture2DFromFile(Device, filename);

        Device.ImmediateContext.Flush();

        var memoryStream = new MemoryStream();

        CopyTexture.ToImage(DeviceContext, Target, memoryStream);
        memoryStream?.Flush();

        var processedImage = System.Drawing.Image.FromStream(memoryStream);
        memoryStream?.Dispose();

        return processedImage;
    }

    private SharpDX.Direct3D11.Device1 Device;
    private SharpDX.Direct3D11.DeviceContext1 DeviceContext;

    private SharpDX.Direct3D11.Texture2D Target;
    private SharpDX.Direct3D11.RenderTargetView RenderTargetView;

    public string GPUDescription = string.Empty;

Please explain code in detail...

I've asked a similar question and someone provided a HLSL file which didn't require vertices however, I have no idea how to apply it... So I figured I'd provide the code and ask for more detailed help.

sentences:
How do I export Physique animations without breaking them? I've been trying to export a simple footstep animation that I made in 3ds Max, but it either fails to export or is broken (imports into unity missing a few frames, or appears to have imported but won't play) every single time.

I've tried .fbx and .3ds, but neither works. I'd rather not use the Skin modifier, because it would require starting from scratch and learning a new system. Any ideas?

sentences:
Dropping multiple objects using an array in Actionscript? I'm trying to get these fireBalls to drop more often, I'm not sure if I'm using Math.random correctly.

Also, for some reason I'm getting a null reference because I think the fireBalls array waits for one to leave the stage before dropping another one?

This is the relevant code:

var sun:Sun=new Sun
var fireBalls:Array=new Array()
var left:Boolean;

function onEnterFrame(event:Event){
    if (left) {
        sun.x = sun.x - 15;
    }else{
        sun.x = sun.x + 15;
    }
    if (fireBalls.length>0&&fireBalls[0].y>stage.stageHeight){ // Fireballs exit stage
        removeChild(fireBalls[0]);
        fireBalls.shift();
    }
    for (var j:int=0; j<fireBalls.length; j++){
        fireBalls[j].y=fireBalls[j].y+15;
        if (fireBalls[j].y>stage.stageHeight-fireBall.width/2){
        }
    }
    if (Math.random()<.2){ // Fireballs shooting from Sun
        var fireBall:FireBall=new FireBall;
        fireBall.x=sun.x;
        addChild(fireBall);
        fireBalls.push(fireBall);
    }
}

sentences: Importing FBX model with updated textures into unity creating duplicate textures when using "Extract Textures" I am trying to figure out the best way to update models, textures and materials. I have a city model (city.fbx) that comes into unity with baked textures and materials from C4D. I bring it in to unity, extract the textures into a local folder called  "Textures" and extract the materials into a local folder called "Materials". Everything is remapped automatically by Unity. Let's say I then update the model using a file syncing program which replaces city.fbx with the same model, but with updated textures. In this case, the textures have been updated to green, where as before they were blue textures. when I extract the textures into the local "Textures" folder, unity creates duplicate textures instead of replacing the old ones. So we now have buildingtexture (the old blue texture) & buildingtexture 1 (a new green texture) - what is the  correct way to import the updated model so as to avoid this?

sentences:
Efficient path-finding in free space I've got a game situated in space, and I'd like to issue movement orders, which requires pathfinding. Now, it's my understanding that A* and such mostly apply to trees, and not empty space which does not have pathfinding nodes. I have some obstacles, which are currently expressed as fixed AABBs- that is, there is no unbounded "terrain" obstacle. In addition, I expect most obstacles to be reasonably approximable as cubes or spheres.

So I've been thinking of applying a much simpler pathfinding algorithm- that is, simply cast a ray from the current position to the target position, and then I can get a list of obstacles using spatial partitioning relatively quickly. What I'm not so sure about is how to determine the part where the ordered unit manoeuvres around the obstacles.

What I've been thinking so far is that I will simply use potential fields- that is, all units will feel a strong repulsive force away from each other and a moderate force towards the desired point. This also has the advantage that to issue group orders, I can simply order a mid-level force towards another entity. But this obviously won't achieve the optimal solution.

Will potential fields achieve a reasonable approximation given my parameters, or do I need another solution?

sentences:
How can I render a semi transparent model with OpenGL correctly? I'm using OpenGL ES 2 and I want to render a simple model with some level of transparency. I'm just starting out with shaders, and I wrote a simple diffuse shader for the model without any issues but I don't know how to add transparency to it. I tried to set my fragment shader's output (gl_FragColor) to a non opaque alpha value but the results weren't too great. It sort of works, but it looks like certain model triangles are only rendered based on the camera position... It's really hard to describe what's wrong so please watch this short video I recorded:

http://www.youtube.com/watch?v=s0JqA0rZabE

I thought this was a depth testing issue so I tried playing around with enabling/disabling depth testing and back face culling. Enabling back face culling changes the output slightly but the problem in the video is still there. Enabling/disabling depth testing doesn't seem to do anything.

Could anyone explain what I'm seeing and how I can add some simple transparency to my model with the shader? I'm not looking for advanced order independent transparency implementations.

edit:

Vertex Shader:
// color varying for fragment shader
varying mediump vec3 LightIntensity;
varying highp vec3 VertexInModelSpace;

void main()
{
    //
    vec4 LightPosition = vec4(0.0, 0.0, 0.0, 1.0);
    vec3 LightColor = vec3(1.0, 1.0, 1.0);
    vec3 DiffuseColor = vec3(1.0, 0.25, 0.0);

    // find the vector from the given vertex to the light source
    vec4 vertexInWorldSpace = gl_ModelViewMatrix * vec4(gl_Vertex);
    vec3 normalInWorldSpace = normalize(gl_NormalMatrix * gl_Normal);
    vec3 lightDirn = normalize(vec3(LightPosition-vertexInWorldSpace));

    // save vertexInWorldSpace
    VertexInModelSpace = vec3(gl_Vertex);

    // calculate light intensity
    LightIntensity = LightColor * DiffuseColor * max(dot(lightDirn,normalInWorldSpace),0.0);

    // calculate projected vertex position
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

}

Fragment Shader:
// varying to define color
varying vec3 LightIntensity;
varying vec3 VertexInModelSpace;

void main()
{
    gl_FragColor = vec4(LightIntensity,0.5);
}

sentences:
How to change application surface size without changing view size? (GMS2) I am working on a pixel art project in GameMaker 2 with native resolution 428x240. In order to enable "subpixel" rending, I am trying to increase the resolution of my application_surface, but keep my view at its native resolution.

I am trying to increase the resolution of my application_surface by two, but keep my view at the native resolution. I have tried a few different things, but no matter what I do, I can't get it to work consistently.

Here is what I tried most recently:

surface_resize(application_surface, native_width * 2, native_height * 2);
camera_set_view_size(view_camera[0], native_width, native_height);

This works, but when I change rooms, the view resets to the size of the application surface, resulting in something like this:

It seems like every time you change rooms, the view size gets reset to the size of the application surface.

I tried iterating through all rooms and setting their view size to my native resolution on launch, but it doesn't seem to help.

How can I prevent the view from changing sizes on room change? I want to lock it at my native resolution.

sentences:
Finding average input value over time in seconds I'd like to find the average input value from a controller over the last n seconds (say the last 0.1 seconds) and do this every frame.

I can see how to do this for the past n frames by storing a list of values for the last n frames and averaging that total every frame, but I want to account for a variable frame rate as the resulting output is driving a character controller and should feel precise and consistent. I tried storing a list of value pairs containing the input value and delta time value for every frame, then counting back through the list of delta time values until they sum to n seconds, then using the total of those input values to work out the average, but it seems a bit clunky and means I have to guess how big the list should be to store enough values, is there a better way?

sentences:
What's the difference between Canvas and WebGL? I'm thinking about using CAAT as a part of a HTML5 game engine. One of it's features is the ability to render to Canvas and WebGL without changing anything in the client code. That is a good thing, but I haven't found precisely: what are the differences between those two technologies?

I would specially like to know the differences of Canvas and WebGL in the following regards:

Framerate
Desktop browser support
Mobile browser support
Futureproofability (TM)

sentences:
Webgl page heap size increasing in each page load then crash I am getting aw snap or sometime not enough memory problem when I reload my webgl page. I have a webgl project which is empty (just a camera + light), developed in unity3d. I am reloading it, and profile its memory.

As you can see that its load 1.2MB in the first load than 1281 MB in second then 1574 then 2160 and then get crash. I am amazed that why it is happening?

  Another source of memory-related problems is the IndexedDB filesystem
  used by Unity. Any time you cache an asset bundle or use any
  filesystem-related methods, they are stored in a virtual filesystem
  backed by IndexedDB.

  What you might not realize is that this virtual filesystem is loaded
  into and persisted in memory as soon as your Unity application starts.
  This means that if you are using the default Unity caching mechanism
  for Asset Bundles, you are adding the size of all of those bundles to
  the memory requirements for your game, even if they are not being
  loaded.

but the problem is I didn't load anything from this build yet.

Even when I try to refresh my empty project several time in chrome I get this error:

For Mozilla, there is an error log which states failed to asynchronously prepare wasm: out of memory

sentences:
I cant Instantiate a particle system for the duration of a subroutine I have a sub routine that lowers the timescale to 0.3 for 2 seconds. while in those two seconds i would like to spawn a trail of particles that follow the player.

I can get the particles working if I attach them to the player in the editor but I'm having trouble spawning them at the start of the time slow down.
The slow down subroutine works fine its just the particles that i cant spawn.

Thanks, any help is appreciated.

public GameObject particles;
public Transform playerParticles;
// Start is called before the first frame update
void Start()
{
    slowDownActivateNoise = GetComponent<AudioSource>();
}

void Update()
{
    if (hasCollided)
    {
        if (!activated)
        {
            StartCoroutine("SlowDownActive");
        }
    }
}

public IEnumerator SlowDownActive()
{

    Debug.Log("subroutine Start");
    activated = true;
    Instantiate(particles, playerParticles.position, playerParticles.rotation);

    Time.timeScale = 0.3f;
    GetComponent<Collider>().enabled = false;

    yield return new WaitForSeconds(2);

    GetComponent<Collider>().enabled = true;
    Time.timeScale = 1.0f;
    hasCollided = false;
    activated = false;
    Debug.Log("subroutine end");

}

sentences:
3D Coulomb Friction - Use Collision Impulse To Calculate Friction Force? I've been using this document to learn how to implement a very basic physics engine. The section on Coulomb Friction on page 55-56 (marked as pages 43-44) confuses me.

It observes that the friction force can be calculated using the collision impulse (jr). This seems strange. Envision an object falling very quickly onto a plane with a slight incline. The object is rotating in the opposite direction it would if it were rolling down the incline. When the object makes contact, it will have a small velocity along the tangent, but a huge normal impulse (jr). This will result a very large change in velocity along the tangent (t hat) opposite to the direction of motion. This will push the object up along the surface (bad!) with a notable amount force. My implementation confirms this.

Can someone explain to me how this all fits together? I'm very confused.

P.S. I don't think trying to provide an example of my implementation here is relevant, either the effect I'm explaining cannot occur (in which case there is a bug, which I can find myself), or I'm misunderstanding the equations, in which case the implementation is inherently broken

sentences:
Crafting recipes: storage and quering Consider the following situation. In a game you can perform crafting: i.e. create new items from existing ones (like in Minecraft). I have following game entities (simplified):

item: Atomic part.
recipe: A list of items resulting in other list of items.

What would be best structure to store all the recipes in the game? I consider using SQLite database for storing it. However game is not a general type application, so, would it be better to use XML + in-memory structures for storing it?

A database has some major advantages to me, it's much more "DRYer" in my opinion. You also can query it. But I doubt if direct database performance is sufficient for smooth gameplay. On the other hand you can use say, XML to store all of the recipes and use in-memory storage and query it with LINQ. If finally it all results in in-memory structures then database seems to have much overhead, since it's used just as a storage. Or is it still better to use DB?

Solution:

For now I've decided to stick with XML as storage for recipes. The major advantage of XML for me is that the final solution is more portable to other platforms since XML is more widely available.

sentences:
What is the most efficient way to render a 2D scene objects? What is the most efficient way to render scene objects according to the current position of the camera (which will follow the player position)?

A friend told me that since processors are powerful these days, it is okay to set up everything virtually and then just update the surface according to what is inside the camera position, after a loop inside the sprites filtering only what should be rendered by the GPU.

But seems to me that this is taking more processing power from the CPU. Why process objects that aren’t visible by the player? What if I need to target mobile devices? What if I want to make my game available in a raspberry pi or very old computers?

sentences:
Spherical harmonics lighting evaluation The following is taken from my current understanding of spherical harmonics. There may be errors involved which solve my question if they're resolved, so please notify me if I misunderstood something.

Evaluating reflected diffuse indirect illumination at a surface point is done by computing the integral (simplified rendering equation) in the last line of

(stolen from here).

An important property of functions in SH representation is that the integral in the last line boils down to a dot product between the vectors containing the SH coefficients for projected functions L(x,omega_i) and max(N_x dot omega_i,0).

For example, for each surface point in our target image that we wish to compute indirect illumination on, L(x,omega_i) is available in a precomputed vector of a 4 elements (for 2 bands SH approximation) containing spherical harmonics coefficients. It's not really important where it came from, just that it's available at this point.

From my understanding, to actually evaluate the lighting at a surface point [x] is to project the function max(N_x dot omega_i,0) into spherical harmonics, and dot it with the coefficient vector of the incoming radiance (and then, multiply it by the stuff in front of the integral, surface albedo / pi).
The first 4 coefficients (2 bands) for max(N_x dot omega_i,0) projected into SH basis are known, they are:

c_0 = 0.88622692545...

c_1 = -1.02332670795 * n_y

c_2 = 1.02332670795 * n_z

c_3 = -1.02332670795 * n_x

So the irradiance at that surface point with normal n would just be

E = dot(L_sh,n_sh)

where L_sh is the coefficient vector for the incoming radiance, and n_sh the coefficient vector for the cosine lobe that we just calculated. Specifically, L_sh is the same max(...) function projected into SH basis [with the normal from which the light originated], just scaled a little by the color its transporting.

The above actually looks fine and seems to produce somewhat correct lighting (hard to judge without ground truth reference). What's confusing me now, is that I've come across several sources (for example here, page 17), which, in the final step, when evaluating the lighting, don't actually use the coefficients from above to project max(N_x dot omega_i,0) into SH basis, but instead calculate n_sh as

n_sh0 =  0.282094792f

n_sh1 = -0.488602512f * -n_y

n_sh2 = 0.488602512f * -n_z

n_sh3 = -0.488602512f * -n_x

These four coefficients are actually just the spherical harmonics basis function coefficients parametrized in cartesian coordinates (here they are for spherical coordinates).

What's up with that? Why aren't they projecting the max(...) function into SH basis instead? Am I misunderstanding something? Unfortunately, the usual sources (gritty details and stupid SH tricks) don't seem to go into details of this either.

sentences:
Unity Remote 4 on Galaxy S5 won't connect to Unity 5 I'm having some trouble connecting Unity Remote 4 to Unity 5. I'm using a Samsung Galaxy S5. I've searched a bit and the other solutions with other phones aren't working for me.

What I've tried so far:

I installed the Android SDK by using Android Studio. I'm not sure if that's part of the problem but either way. I installed the Google USB Driver, the 5.0 (API 21) and 5.1 (API 22) SDKs. My phone is running on Android 5.0. All the SDK tools (Platform tools and build tools) are installed. I set USB Debugging, Stay Awake and Allow Mock Locations in the Developer Options on my phone. I set the Android SDK path in Unity (Program Files/Android/android-sdk) I set, in the Unity Editor Settings, Device to Any Android Device. I made sure my computer sees my phone, which it does. And I tried to open Unity first then the Unity Remote and Unity Remote first then Unity Engine. And set Android as my Platform in Build Settings. And I've tried plugging my phone in a USB 2.0 and a USB 3.0.

All that and each time I press the play button nothing happens in the phone. I have no idea what I'm doing wrong. I tried using Unity 4 and Unity 5.

If my OS is a factor, I'm using Windows 7 Ultimate, 64-bit.

If the following information is needed:

Hardware Version: G900P.04

Model number: SM-G900P

Android version: 5.0

Kernal version: 3.4.0

If any other information is needed I will provide it. Anyone have a solution to my problem? Thank you.

sentences:
OpenSceneGraph, multiple instances of a model Im working on my first project using OpenSceneGraph. The project is a model flight simulator for one of my university courses,

I want to be able to load airplanes (consisting of multiple models) and then depending on what plane the user/users choose a new airplane (entity) is created that a user controls.

A loaded airplane will have the following structure. Main body and then the rudders/propellers translated using translation nodes to there right positions. There also needs to be a translation node for each of the rudders/propellers used to rotate the rudders depending on player input.

My problem is i dont know how i should structure it so that i dont need to load the whole model once for every instance of the same type of airplane or store the model parts of the airplanes multiple time.

The only thing that needs to be hard copied is the translation nodes so that the different instances of the same airplane can have rudders and things modified separetely from other planes.

If the planes would consist of only one model i would just create a entity class containing a translation node and add the model to that node so that all entities share the same model, but now the planes are more complex so i dont know how i should do it.

So if someone could give me a hint or a suggestion for further read i would appreciate it.

I hope someone understood what i was trying to describe.

Thanks for answers

sentences:
Should I bother with SDL_WaitEvent? When I wrote my first application in SDL, it looked like this:
while (!quit)
{
    SDL_PollEvent(&event);

    switch (event)
    {
         // ...
    }
}

But then one time I left my app running while I went to do something else, and when I came back my laptop was boiling hot. I checked the system monitor and one of my cores was maxed out by my program! So I did some research, and now my loop looks like this:
while (!quit)
{
    SDL_WaitEvent(&event);

    switch (event)
    {
         // ...
    }
}

Great, so now my program doesn't max the CPU. But now I need to introduce rendering, and the problem is, currently this loop runs one iteration per event. If input and other events don't occur, my program won't render the next frame, no matter where the rendering code goes in the loop. So that's no good.
I could have threads, but that seems like a lot of extra complexity when I could just do:
while (!quit)
{
    SDL_PollEvent(&event);

    switch (event)
    {
         // ...
    }

    SDL_Delay(10)
}

This won't melt the CPU, and I can render at about 100 frames per second.
My questions are:

Which approach "should" I use? I don't see any reason to not just use (3).

What's the point of SDL_WaitEvent, if you can't use it the moment you want to do anything other than handle events in your game loop?

I assume SDL_WaitEvent does something like approach (3) under the hood, so even though ostensibly approach (3) should introduce more latency, in practice it won't. Is this correct? How low should the integer passed to SDL_Delay be to get a responsive app?

sentences:
Unity WebGL Build: Why it shows only Empty Folder? i'm trying to built my game, made in Unity 2018.3, and i'm trying to built it in WebGL, but the problem is this: built was succeeded, but the Folder is still Empty, and here is the problem occured:

This was never happened to me before. anybody know how to fix it?

sentences:
How to check for collisions in "diagonal" tiles? I want to create a tiled map in the following scheme:

The player should be able to walk on the blue line (street). Now, what is the best way to solve collision detection in this case? For example, in the case of tiles C1 and C2: If I make them walkable, then the player could also move in on those black parts of the tiles that should not be walkable.

On the other hand, if I make both C1 and C2 blocked, then the player would not be able to walk on these tiles (and therefore on the street) at all.

Any best practices?
Thanks.

sentences:
What sort of things can cause a whole system to appear to hang for 100s-1000s of milliseconds? I am working on a Windows game and while rendering, some computers will experience intermittent pauses ("hitches" for lack of a better term). When profiled they appear in seemingly random places in the code. Eventually I noticed that it wasn't just my process that was affected, but (seemingly) every process on the system. All of the threads in my application hitch at once. The CPU utilization drops during these hitches and it appears as if most processes make no progress.

This leads me to believe this may be an Operating System or Driver issue, but it only occurs while playing the game (and only on some systems). What sort of operations might the operating system be doing that would require the kernel to pause all user threads and block. Some kind of I/O? At first I thought of paging but my impression is that would only affect a single process, no?

Some systems in use: Windows, DirectX (3d), nVidia cards (unknown if replicates on ATI), using overlapped io for streaming

sentences:
How do I enfroce efficiency concerning thread granularity? Lately, I've been thinking of ways to use multi-threading to improve the speed of different parts of a game engine. What confuses me is the appropriate granularity of threads, especially when dealing with single-instruction-multiple-data (SIMD) tasks.

Let's use line-of-sight detection as an example.  Each AI actor must be able to detect objects of interest around them and mark them.  There are three basic ways to go about this with multithreading:

Don't use threading at all.
Create a thread for each actor.
Create a thread for each actor-object combination.

Option 1 is obviously going to be the least efficient method.  However, choosing between the next two options is more difficult.  Only using one thread per actor is still running through every object in series instead of in parallel.  However, are CPU's able to create and join threads in the granularity posed in Option 3 efficiently?  It seems like that many calls to the OS could be really slow, and varying enormously between different hardware.

sentences:
Is it sensible to run a Socket.IO setImmediate loop for each connected player? Instead of a game loop, I want something different: My game does not have much action going on; just moving users over a tile map with correct timers in between.

Since I am using Socket.IO, I want to run a "mini game loop" inside the io.sockets.on("connected"-part of my script. I am thinking to run a setImmediate checking a few variables to know what to do with the player.

The way I understand socket.IO, it would create this setImmediate function for each client that joins the server. (Because it runs inside the "connected" event handler.)

Let's say 1000 players join the game. If what I fear is true, this approach seems bad. Have I misunderstood setImmediate?

sentences:
Problem with Rotation - C#/XNA I have a projecile(Hook) and the tail of the projectile(yellow balls)

TailProjectile class draws a ball at the exact position of the projectile(hook) and let it there until the projectile ends

I'd like to draw the ball at the start of the hook(red circle) because by now it draws at the projectile image position(blue point)

How can I do it independent of the rotation of the hook?

This is how I calculate the rotation of the projectile

distanceY = endPosition.Y - initialPosition.Y;
        distanceX = endPosition.X - initialPosition.X;

        if (distanceX < 0)
            animation.SprtEffects = SpriteEffects.FlipVertically;
        animation.Rotation = (float)Math.Atan2(distanceY, distanceX);

Then I pass the projectile to the tail and draw the ball

        if (hasTail)
            tail.Update(gameTime,  position , animation.Rotation,animation.SprtEffects);

And at the TailProjectile update class :

  public void Update(GameTime gameTime,Vector2 p,float rotation,SpriteEffects sprtEffect)
    {
        if (Vector2.Distance(animations[animations.Count - 1].Position, p) > distanceBetween)
        {
            Animation tempAnimation = new Animation();
            tempAnimation.LoadContent(content, image, "", p);
            tempAnimation.Rotation = rotation;
            tempAnimation.SprtEffects = sprtEffect;
            tempAnimation.DrawColor = color;
            animations.Add(tempAnimation);
        }

And the Animation Draw:

spriteBatch.Draw(image, position + origin, sourcRect, drawColor * alpha, rotation, origin, scale, sprtEffects, 0.0f);

Edit: Using rotation matrix solve half of the problem :

My problem now is how can I calculate it for angles higher than 90º ? (third picture of the image)

 double xO, yO;
        xO = originpoint.X * Math.Cos(rotation) - originpoint.Y * Math.Sin(rotation);
        yO = originpoint.X * Math.Sin(rotation) + originpoint.Y * Math.Cos(rotation);
        initialAnimation.Position = new Vector2((float)xO + initialAnimation.Position.X, (float)yO + initialAnimation.Position.Y);

sentences: Unity post processing Bloom lags on mobile I made my (first) game today and noticed, that it looked kind of boring, so I decided to add some bloom to my camera and it was looking waaay better. The only problem was the performance, it dropped down from constant 60 fps to like 20-30, I looked it up in the profiler to be sure and yep, it was the post-processing, I saw mobile games which had post-processing including bloom, but these games never lagged on my phone. My phone has pretty good specs for a phone (Samsung Galaxy M20) so how do I make my post-processing performant, are there some special settings I have to make or is it just my phone?

sentences:
How do I get hardware accelerated graphics and shaders in PyGame? I have created several simple games with PyGame, but until now, I have focused on mechanics rather than graphics. The graphics in my games have been extremely rudimentary, consisting of basic shapes on black backgrounds.

I've recently decided to change that and create a 2D graphics engine supporting proper texturing, some animation, and most importantly: lighting. While researching these, especially the last, I've started doubting whether PyGame is the right tool for this. Many tutorials concering implementation of lighting, shadows, et cetera recommend using techniques such as GPU shaders and pixel-level manipulation.

Looking at the documentation of PyGame, I don't see anything that would let me implement such things with any degree of efficiency. I can access bitmaps directly with PixelArray, but doing any significant processing this way seems like it would be a performance nightmare.

How can I get hardware accelerated graphics, vertex and pixel shaders when making a game with PyGame?

sentences:
Entity/Component Systems in C++, How do I discover types and construct components? I'm working on an entity component system in C++ that I hope to follow the style of Artemis (http://piemaster.net/2011/07/entity-component-artemis/) in that components are mostly data bags and it's the Systems that contain the logic. I'm hoping to take advantage of the data-centric-ness of this approach and build some nice content tools.

However, one hump I'm coming across is how to take some identifier string or GUID from a data file and use that to construct component for an Entity. Obviously I could just have one big parse function:

Component* ParseComponentType(const std::string &typeName)
{
    if (typeName == "RenderComponent") {
        return new RenderComponent();
    }

    else if (typeName == "TransformComponent") {
        return new TransformComponent();
    }

    else {
        return NULL:
    }
}

But that's really ugly. I intend to be adding and modifying components frequently, and hopefully building some sort of ScriptedComponentComponent, such that you could implement a component and system in Lua for the purposes of prototyping. I'd like to be able to write a class inheriting from some BaseComponent class, maybe toss in a couple of macros to make everything work, and then have the class available for instantiation at runtime.

In C# and Java this would be pretty straightforward, since you get nice reflection APIs to look up classes and constructors. But, I'm doing this in C++ because I want to increase my proficiency in that language.

So How is this accomplished in C++? I've read about enabling RTTI, but it seems most people are wary about that, especially in a situation where I only need it for a subset of object types. If a custom RTTI system is what I need there, where can I go to start learning to write one?

sentences:
Changing sprite tint over time in Unity. Sprites affected by "light" Recently I was playing "Altos Adventure" on mobile.

I was curious how I could implement an effect similar to their game background.

The sprites tint over time to match the time of a day. It's blue in the morning, orange in the evening. Sky color is changing and also mountains tint.

I believe it is possible to change solid color sprite and it seems like mountains have only one color individually. Maybe they use other half transparent sprites to change the tint of the entire scene? Like half transparent curtain. But it doesn't explain the smooth transition between colors during the time.

Any ideas how I can do the same with Unity and Photoshop? I am also interested in mountain fading effect which appears during rain or snowfall.

See the background behaviour lighting effect  in more detail in this video

Screenshots with different tints of background:

sentences:
How can I get my player's character to slide along a rail? I am creating a snowboarding game and would like my player to be able to jump on a rail and move along it if it lands on it.

I have no idea how to approach this. I have already tried using ray casts and waypoints but nothing works. I need to make sure the player moves along the rail, from any point that the player jumps onto it: e.g. if they land in the middle of the rail they keep following its curve from that point. The rails are not straight and have curves on them.

How can I get my player to be able to jump on a curved rail like this, and start sliding from the point they jumped onto it?

sentences:
What are spline input keys? There isn't a really adequate explanation of these anywhere on the internet, so I thought I'd ask this question here.

What are spline input keys in Unreal?
How are they represented in Unreal?

Also:

FindInputKeyClosestToWorldLocation returns a float.

What is this return value?
Why is it a float?

sentences:
Issues with 2D raycasting lighting under limitations of HLSL 3.0 pixel shader I've been writing my own HLSL pixel shader for dynamic lighting using raycasting. Unfortunately, since I'm using this out of XNA, I can only use up to ps_3_0. As you can see, the limitations difference between 3 and 4 are drastic, especially in instruction slots and temp registers:

Specifically, I'm running out of instruction slots. This limitation is preventing me from having accurate rays. (As in the amount of pixels the ray's position increases by from the light source has to be a lot less than I want)

Here's what it looks like.
And here's the relevant part of the code:

//Cast rays (Point Light)
float4 CastRays(float2 texCoord: TEXCOORD0) : COLOR0
{
    float dir;
    float2 move;
    float2 rayPos;

    float2 pixelPos = float2(texCoord.x * width, texCoord.y * height);

    float dist = distance(pixelPos, lightPos);

    if (sqrt(dist) <= lightSize)
    {
        rayPos = lightPos;
        dir = atan2(lightPos.y - pixelPos.y, lightPos.x - pixelPos.x);
        move = float2(cos(dir), sin(dir)) * rayLength;
        for (int ii = 0; ii < clamp(dist / rayLength, 0, 7); ii++)
        {
            if (tex2D(s0, float2(rayPos.x / width, rayPos.y / height)).a > 0)
            {
                return black;
            }
            rayPos -= move;
        }
    }
    else
    return black;

    float light = 1 - clamp((float)abs(sqrt(dist)) / lightSize, 0.0, 1.0);
    return lightColor * light;
}

The limitation variable I've put in place is rayLength. The larger this number, the less accurate the rays are. I can give more specific examples of what this looks like if anybody wants.

I'm very new to the concept of raycasting, and fairly new to HLSL. Is there any way I can make this work under the limitations and/or increase the limits?

Thank you.

sentences:
How do I swap two objects in C# (specifically Mono) without triggering GC? I have two array lists. that I want to swap each frame. My question is, does the variable 'temp' need to be a member variable to avoid triggering GC, assuming this method is called on dozens of objects each frame? I'm not creating a new object, just a new reference to an object.

public void LateUpdate(){
    ArrayList<int> temp = previousFrameCollisions;
    previousFrameCollisions = currentFrameCollisions;
    currentFrameCollisions = temp;
    currentFrameCollisions.clear();
}

I've been told there's no reason to make a primitive into a member variable just to avoid GC, so my best guess is that this also applies to object references.

sentences:
How to handle data for a competitive multiplayer games I am kinda new to Multiplayer Games and I am really wondering how I should handle my data

Should each player send and update their data to the database (server) everytime one of their essential variables changes (like health or ingame currencies), or should they save the data as long as the game is running and then update the data all at once at the end of, lets say, each round?

I was thinking about using Firebase and Unity and here's a scenario:

Let's say 2 players connect to a game. Then one of them gets damage and the other one gets gold. Does the data change get sent to the FireBase Database immediatly or should I just update everything when the round ends/they disconnect?

sentences:
What happen if I try to run OpenGL 4.4 code on an unsupported graphic card? I'm learning OpenGL because I'd like to build my own engine.
I'd like to know what happens if I try to run OpenGL 4.4 code (the latest version at the moment of writing) on an unsupported graphic card ? (I mean for example a graphic card that support up to 4.1 OpenGL). Does it fails even to start ? or, it start but fails to render ?

Thank you very much.

sentences:
Max Row and Col for Animating Sprite in Andengine I want to animate a Sprite in Andengine , I have used the following

this.mSnapdragonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this,"arrow.png", 10, 10);

As show above in code its array is 10x10 that means I have 100 images to be animated, here is the image (I had individual image and joined it online so I created image below):

My issue is if I place this code and image it show black patch instead of animated image, i hv tried with 2x3, 4x2 animated sprite that is > working fine . Is my issue because of 10x10 ? what is the max row and col I can place to animate a Sprite in Above Code

Here is my output :

sentences:
license for old vehicle/track If I want to develop an android racing game set in the 1940-1950, with the real track of that period (that differs from the actual one), both closed and street circuit, and the real car of that period (F1 car), do I have to pay a license to use its name and aspect?

If so, how much it would be cost?

sentences:
When should I acquire game objects with dependency injection, find-with-tag, or singletons? This is sort of a best practice/efficiency kind of question, and I haven't really seen any other question talking about these three things together.

Essentially, Dependency Injection, Find with Tag (like the Unity function), and Singletons are all ways of acquiring globally required game objects (like for instance, a sound manager or the player object).

For each, in which case does it make sense to use one over another? (I'm aware it's quite an open question, but I am looking for aspects which typify the situations in which you might use one over another).

Why is each better or worse for doing the job of acquiring a globally required object?

Are there any other methods of doing this not mentioned here?

sentences:
How do I fix this "java.lang.ClassNotFoundException" error? I received my first crash report via the Google Developer Console, yesterday, and I'm completely lost.

This is my error message:

  java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.UnityPlayerNativeActivity" on path: DexPathList[[zip file "/mnt/asec/com.JamaludineDolley.NinjaBallDash-1/pkg.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib, /vendor/lib]]

How do I fix this java.lang.ClassNotFoundException error?

sentences:
Fps shoots up when sdl2 window is not on top I am learning sdl2 with C++ from Lazy Foo Productions' tutorials. I am using a 5 year old retina mac book pro and xcode.

When reading this entry on calculating frame rate I noticed that when runing the application it would tend to 60 fps and the cpu and energy impact were very low, 2% and Low respectively, but when placing another window over it the fps would shoot up to 5000 along with cpu and energy impact, to 93% and High respectively.

Why is this happening? Is it because sdl2 just stops rendering all together when it is not on top of other windows? Or is it because the OS stops it from rendering?

sentences:
Calculate aim angle dead zone range In my top down 2D shooter game the player has a shoulder mounted gun which rotates and aims automatically at enemies - that part is all working fine. Since the player can rotate as well, the gun is constantly updating it's angle to keep aim on the enemy.
But this causes a problem where the gun aims at the player's own head...! It doesn't have any practical consequences in the game, but obviously looks weird and unrealistic. So I need to create a 'dead zone' angle range where the gun cannot aim. It will have to aim as best it can at an enemy up to just before it aims at the player's head.
It seems tough to calculate since there are two angles in play. The dead zone will have to update itself as the player turns.

EDIT: This is what I had so far but I can't update the angle range since it then wouldn't work with the min max:
private float normaliseAngle(float angle) {
    return angle - (float) Math.floor(angle / 360f) * 360f;
}

private float clampAngle(float aimAngle) {
    float tempAngle = normaliseAngle(aimAngle);
    return (float) Math.min(Math.max(tempAngle, 45), 315);
}

This gives a dead zone between 315 and 45.

sentences:
Investigation stage before starting a game I was thinking about how to organize the stage about getting informed about whatever game is needed to develop, what would others do.

For example, if I wanted to develop a game about car racing, I should figure out all the factors during the race, from the car factor to the pilots, etc., environmental factors like weather, circuit conditions, etc.

How does one manage this stage?

Thanks.

sentences:
tile based 2d level editor Possible Duplicate:
  Tools for creating 2d tile based maps

I am Indie Game developer and  I am looking for a tile based 2d level editor. I also would like to know the free ones as well as paid ones, which you feel as the best.

sentences:
center location on scanners sweep I want to center location on a place where someone uses their scanners sweep. I know this is possible with the defilers ability dark swarm but i wonder if it is possible with scanner sweep from ComSat Station. There is a unit that is called scanner sweep so maybe it is possible. I tried it with many triggers but none of them seem to work.

Does anybody have an idea how a trigger that would move the location to the scan would look like?

It doesn't matter which player scans I just want the location to move with each scan.

sentences:
Local to World coordinates in 2D and back I'm getting back into hobby game programming after a long 4-year hiatus from college and I find that my understanding of coordinate systems is somewhat lacking.

I'm trying my skills at creating a simple skeletal animation system but I'm having a hard time wrapping my head around converting local coordinates (of say, a joint) to world coordinates, particularly when it comes to rotated sprites.

I'm trying to create a test app in XNA and accomplish this using their built-in matrix class.  Can anyone assist me in either linking a resource or helping me understand the operations I'd need to do to convert any point that is Scaled/Rotated/Translated from a local to a world coordinate and back?

sentences:
Reading data disks in Xbox360 homebrew I heard that X360 homebrews are not allowed to be started from DVDs; however, they can be downloaded from PC or via live and started.

The question is: it is disabled to access DVD drive at all?

I want to access data tracks, without using any (theoretically prohibited) media APIs for playbacks; also I don't want to run from disk (which is prohibited by Microsoft).

sentences: Unity Default Shader Greyed Out I created a pland in Unity 3D and then tried to alter the material.  I looked at it's material component, but all the options are greyed out!  how do I fix this problem?

sentences:
How much to bake user input in a client-server? Assume a client-server game where there server manages all state and the clients are simply rendering / input.

How much should I bake user input from the client before sending it off to the server?

Does it make sense to send "jump" or "space keydown"?

I'm inclined to bake the input as much as possible.  Am I setting myself up for pain later?

sentences:
How would I apply force to a bullet in 2D? I wrote the code below in order to try to get a bullet to fire at a specific angle for my top-down shooter. However when I press space the bullet just spawns in front of the game object despite it having a bullet speed. I made sure that my bullet prefab has a rigidbody and I am calling to it in my script.

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

public class FireAway : MonoBehaviour
{
private Vector3 mouse_pos;
private Vector3 object_pos;
private float angle;
private float bulletSpeed = 1;
public GameObject ammo;
private Rigidbody2D rb2D;

void Start()
{
    rb2D = ammo.GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void FixedUpdate()
{
    // Point the cannon at the mouse.
    mouse_pos = Input.mousePosition;
    mouse_pos.z = 0.0f;
    object_pos = Camera.main.WorldToScreenPoint(transform.position);
    mouse_pos.x = mouse_pos.x - object_pos.x;
    mouse_pos.y = mouse_pos.y - object_pos.y;
    angle = Mathf.Atan2(mouse_pos.y, mouse_pos.x) * Mathf.Rad2Deg - 90;
    Vector3 rotationVector = new Vector3(0, 0, angle);
    transform.rotation = Quaternion.Euler(rotationVector);

    if (Input.GetKeyDown("space"))
    {

        GameObject BulletPlayer = (GameObject)Instantiate(ammo,
transform.position, transform.rotation);
        //bullet.transform.LookAt(mouse_pos);
       rb2D.AddForce(BulletPlayer.transform.forward * bulletSpeed);
    }
}
}

sentences:
Unity 5 Camera Functions Usage Error How to use functions like ScreenToRayPoint() in Camera class?

I have used this code:

Ray ray = camera.ScreenPointToRay(Input.mousePosition);

and it says

  Component.camera is obsolete, instead using GetComponent()

Then I tried these:

Camera cam = GetComponent<Camera>();

Ray ray = cam.ScreenToRayPoint(Input.mousePosition);

and it says

  Camera doesn't contain a definition of ScreenPointToRay and no extension method 'ScreenPointToRay' accepting a first argument of type 'Camera' could be found.

sentences:
Pathfinding and BSP with Box2D I'm looking into implementing AI in my 2D side-scrolling platformer, and I'm looking into using algorithms such as A*. For many kinds of pathfinding, we need some sort of grid or systems of nodes or polygon areas. My problem is that I am using Box2d for physics and I am not sure how best to create a structure that my AI can use besides placing individual nodes manually (something I really want to avoid) and using some sort of steering behavior.

My level design is tile-based with each tile being about half of the height/width of my main character. The tiles are not all square (some are sloped). I'd like to have a system that can see what the terrain looks like for pathfinding and also keep track of the positions of other actors such as enemies. I'd like to avoid directly placing any nodes into my level design except for possible endpoints or goals.

This question is related: How do you do AI path following within a 2d physics engine like farseer/box2d?, but it doesn't specify what kind of structure I could use instead of a list of nodes. I'm looking for some kind of grid or type of BSP that I can query for algorithms like A*.

EDIT: I am looking for a data structure that meets the following requirements:

Can be searched by algorithms like A*
Can keep track of objects that move around
Can keep track of objects of different shapes and sizes
Does not require me to manually create paths or place nodes

When I first load my level, I have a 2D array (actually just a width, height, and string of ints), but this doesn't allow me to track objects that move not to mention other shortcomings.

sentences: Serialize classes in unity c# Is there some best practices to serialize objects to file on mobile devices in Unity using C#. I've tried to search it myself, but found only this link. However, it looks like here they are trying to cache AssetBundles. I'm new to Unity, but I have some experience in iOS (swift) development. Here we have opportunity to cache some objects(variables) in local storage, to avoid overusing network. So I wanted to create some static class (for example Storage), which caches variables to file permanently and return them by some key.

sentences:
How to render a texture partly transparent? Good Morning StackOverflow, I'm having a bit of a problem right now as I can't seem to find a way to render part of a texture transparently with openGL.

Here is my setting : I have a quad, representing a wall, covered with this texture (converted to PNG for uploading purposes). Obviously, I want the wall to be opaque, except for the panes of glass. There is another plane behind the wall which is supposed to show a landscape. I want to see the landscape from behind the window. Each texture is a TGA with alpha channel.

The "landscape" is rendered first, then the wall. I thought it would be sufficient to achieve this effect but apparently it's not the case. The part of the window supposed to be transparent is black and the landscape only appears when I move past the wall.

I tried to fiddle with GLBlendFunc() after having enabled it but it doesn't seem to do the trick.

Am i forgetting an important step ?

Thank you :)

sentences:
How to seamlessly handle multiple procedural 2D levels in Unity3D? I have a dungeon generating algorithm, but I would like to generate X levels, which are all connected somehow.

I have a few approaches, but all of them has problems and questions, and I wonder how i.e. Diablo II handles them so seamlessly.

1. Approach: Upon leaving a level, generate the next one on the fly.

This would be the easiest, but would result in a relatively long loading screen everytime the player enters a new level.
So generating the levels should be at the beginning of a new game, thus the next level will just have to be loaded, which is much faster. In theory not even a loading screen is necessary.

2. Approach: Generate every level at the beginning of a new game and store them.

Okay, now levels just have to be loaded, which could be done under half a second. No loading screen is necessary, maybe just a fade out-fade in.
How do I store them?

Make custom files (i.e. scriptable objects) for them, or is there a simpler way?

3. Approach: Generate and load every level at the beginning.

Zero loading time, because everything is already generated and loaded into the tilemap.
But how do I guarantee that levels don't collide, and the player can't see level Y from level X if there are lots of levels?
And wouldn't it affect the performance? Because everything is loaded all the time. Yes, renderers, rigidbodies, scripts, etc can be turned off, improving the performance a lot... but still... this seems wrong.

What is the best way to solve this problem?

sentences:
Handling accelerate in different devices I am adding tilt controls to my game. The sensor values I get are different in different android devices which results in random behavior.

Anyone knows how can I tackle this situation?

I tried normalizing acceleration but it is still the same.

sentences:
Why I have to press the button twice to deactivate the GameObject for the first time? game engine:unity3d

scripting language: unityscript

code:

   var setmenu:GameObject;

  var settings_menu:boolean;

   function Start()        {

   settings_menu=false;

  }
   function settingButtonClick(){

  if(settings_menu==false)
  {
  setmenu.SetActive(true);
    settings_menu=true;

  }
         else
  {
  setmenu.SetActive(false);
   settings_menu=false;
   }
 }

The problem is I have to click the UI button twice to SetActive to become false for the 1st time.
But after that when I again  activate and then press to deactivate it works fine with single click.

sentences: moving glDepthMask into a shader Can a fragment shader make per-fragment decisions on whether the fragment updates the depth buffer or not, even if the fragment is not discarded and the color is written?

sentences:
How can I track how "well-lit" a player is so that I can determine if my AI can see him or her? I want to see how well-lit the player character is in an environment so that my AI can react (or not) to the player when he or she is visible.

Currently I am doing this by reading back the color data of the final render target and computing the brightness of the player's region. It seems expensive and taxing, so I was wondering if there is a better way to approach this?

sentences:
What is a good method for collision detection, where I check a collision, instead of all collisions The collision system for my game currently works fine; it lets me test a collision with an entity or specified rectangle, but that's not enough. I use to use Game Maker, and it had collision events that were simple. What I want to do is not check collision with everything, but check for a collision with everything.

Using the former method would probably be really expensive, checking all other objects, per object, per frame. What is a good method for collision detection, where if I am colliding with something, I get it's class, and can decide what to do with it?

sentences:
Why use random numbers when it comes to rewards and stats? Many games use random numbers for things like attack damage, gold loot, or monster type being spawned. It is obvious that random numbers allow you to generate content to make games more re-playable, but I am talking about specific things. For example: In DOTA, when you kill a monster you get a random amount of gold in between x and y where x and y never change. When you attack anything you have a chance to do damage within a range such as 52-60. How would making the gold drops static change the game?

I feel like the random numbers enhance the game-play, but I am having trouble understanding why. Does anyone know any reasons why random numbers can make game-play better when used with things like damage or loot? I'm hoping for answers that don't attribute it to luck being a good thing.

sentences:
Anyone have a game UI recommendation? Possible Duplicate:
  What C++ GUI library can you suggest?

I am creating a simple 2 dimensional GUI for an RPG game. It will be pretty simple and will contain a few windows a chat box. Does anyone have any suggestions for UI code to use?

sentences:
What is Google Play Services Multiplayer? This question might be off-topic, i don't know where should i ask it.

What's the difference between Google Play Real-Time Multiplayer, Google Play Turn-Based Multiplayer and sockets?

sentences:
How do I get the 3d coordinates of my model Instance? [LibGDX] I want to get the 3d coordinates (as a Vector3) from my model Instances.
with the following code I can only get the original coordinates, but in the render method, my model is rotating around the Y-axis (and moving at the same time) and I want to get its coordinates each frame.
I'm using a little class created by @Xoppa :

public static class GameObject extends ModelInstance {
    public Vector3 center = new Vector3();
    public Vector3 dimensions = new Vector3();
    public float radius;

    public BoundingBox bounds = new BoundingBox();

    public GameObject (Model model, String rootNode, boolean mergeTransform) {
        super(model, rootNode, mergeTransform);
        calculateBoundingBox(bounds);
        bounds.getCenter(center);
        bounds.getDimensions(dimensions);
        radius = dimensions.len() / 2f;
    }
}

and here's my code:

public void render(float delta) {
    super.render(delta);
    if (loading && manager.update()) {
        doneLoading();
    }

    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    batch.begin();
    backgroundSprite.draw(batch);
    batch.end();

    for(GameObject instance : instances){
        instance.transform.rotate(new Vector3(0, 1, 0), 0.5f);
        float x = instance.bounds.getCenterX();
        float y = instance.bounds.getCenterY();
        float z = instance.bounds.getCenterZ();
        System.out.println(x+" "+y+" "+z);
        if(isVisible(cam, instance)){
            modelBatch.begin(cam);
            modelBatch.render(instance, environment);
            modelBatch.end();
        }
    }
}

Please help, there's no function "getPosition" or sth like that, it's all about Matrix4 and I have never had a math course about it. I'm stuck.

sentences:
Having trouble with btGeometryUtil::isPointInsidePlanes I'm in the process of parsing a BSP file to create btConvexHullShape objects for each brush. I've seen a few examples of how to do this on Github and they all use the getVerticesFromPlaneEquations function. This function in turn uses isPointInsidePlanes. The problem I'm having is that isPointInsidePlanes returns false for every potentialVertex, leaving me with an empty verticesOut array.

I'm looking at the code for isPointInsidePlanes, and it seems like it is checking the vertex against ALL planes in the brush which I find confusing.

For example if the brush is a simple rectangular prism, you wouldn't expect the point that results from the intersection of 3 planes to be inside all 6 planes, right? Shouldn't it only be checked against the 3 planes that intersected to locate it?

Now this file hasn't changed in 9 years, so either I'm doing something very wrong or nobody uses this function. I'm going to assume I'm wrong for the time being.

TL;DR: Why does isPointInsidePlanes check the point against every plane equation and not just the 3 that intersect to create it? Should I not even be using the getVerticesFromPlaneEquations function and instead be using something else?

EDIT: Added link to code

Here is a link to the relevant source file:
https://github.com/bulletphysics/bullet3/blob/master/src/LinearMath/btGeometryUtil.cpp

Specifically, on line 175, the planeEquations array is passed to isPointInsidePlanes which then compares the point against every plane in the array.

sentences: Which version of AndEngine (gles1 or gles2) should I learn? I m new to Game Development. I've chosen AndEngine, but there are 2 versions: gles1 and gles2. I tried sample code from both and found that gles2 code is not run on an emulator, but required an actual device. And in gles2 there are also BaseGameActivity and SimpleBaseGameActivity. I'm a little confused. Which is best?

sentences:
How to handle hitboxes/hurtboxes in animations? I'm curious how I should go about structuring hitboxes and hurtboxes for my actors. For context, I'm developing a game engine in OpenGL, using C# and OpenTK. I have developed a working skeletal animation system, which loads animations using Assimp, and then passes BoneIDs, BoneWeights, and Transform matrices to the Vertex shader, which calculates all vertex deforms appropriately for the current animation keyframe (or current interpolation between keyframes).

Is there a set standard for calculating collision in animations? I'd prefer to continue using Assimp, which means using standard, recognizable animation formats that my engine can load in, so I'd rather not store any collision data in the animation files, unless there is a precedent for this or room for metadata or something.

My current thoughts: One option would be to calculate the hitboxes and hurtboxes upon loading an animation, and have a mapping that determines which meshes are hitboxes and which are hurtboxes. The second option would be to create a new file format where I store my hitboxes and hurtboxes in a way that is similar to animation files (minus bone weights, since I'll just be transforming the scale/position of axis-aligned rectangles), where I can determine keyframes for hitboxes and hurtboxes, then interpolate based off of these to get the current collision box for each frame. I could combine the two options by automatically generating these files from the animations, then editing them manually until they are reasonable.

Am I on the right track, or are there smarter ways of going about this? I don't want to reinvent the wheel if there are better options available.

sentences:
Points inside a Polygon, failing for shapes with 0,0 I've been using an algorithm (http://wiki.unity3d.com/index.php/PolyContainsPoint) to tell me if a point is inside a polygon... in fact a few variants (here and here) but they all come back the same. Shapes with (0,0) vertices fail.

Here's the function:

private bool IsPointInPolygon(Vector2[] polyPoints, Vector2 p)
{
    int j = polyPoints.Length-1;
    bool inside = false;
    for (int i = 0; i < polyPoints.Length; j = i++) {
        if ( ((polyPoints[i].y <= p.y && p.y < polyPoints[j].y) || (polyPoints[j].y <= p.y && p.y < polyPoints[i].y)) &&
            (p.x < (polyPoints[j].x - polyPoints[i].x) * (p.y - polyPoints[i].y) / (polyPoints[j].y - polyPoints[i].y) + polyPoints[i].x))
            inside = !inside;
    }
    return inside;
}

And here's the testing output for a number of 'cloned' squares being translated around the original square (original shown in black in the diagram) - Notice all the squares with the 0,0 fail. Why is this? I don't really know what the algorithm is doing but have tried a few with exactly the same result..

Vector origin (0.0, 0.0) to Vector destination (1.0, 0.0)
distance: (1.0, 0.0)
New Shape 1 0
New Shape 2 0
New Shape 2 1
New Shape 1 1
PASS

Vector origin (0.0, 0.0) to Vector destination (1.0, 1.0)
distance: (1.0, 1.0)
New Shape 1 1
New Shape 2 1
New Shape 2 2
New Shape 1 2
PASS

Vector origin (0.0, 0.0) to Vector destination (0.0, 1.0)
distance: (0.0, 1.0)
New Shape 0 1
New Shape 1 1
New Shape 1 2
New Shape 0 2
PASS

Vector origin (1.0, 0.0) to Vector destination (0.0, 0.0)
distance: (-1.0, 0.0)
New Shape -1 0
New Shape 0 0
New Shape 0 1
New Shape -1 1
FAIL

Vector origin (1.0, 0.0) to Vector destination (1.0, 1.0)
distance: (0.0, 1.0)
New Shape 0 1
New Shape 1 1
New Shape 1 2
New Shape 0 2
PASS

Vector origin (1.0, 0.0) to Vector destination (0.0, 1.0)
distance: (-1.0, 1.0)
New Shape -1 1
New Shape 0 1
New Shape 0 2
New Shape -1 2
PASS

Vector origin (1.0, 1.0) to Vector destination (0.0, 0.0)
distance: (-1.0, -1.0)
New Shape -1 -1
New Shape 0 -1
New Shape 0 0
New Shape -1 0
FAIL

Vector origin (1.0, 1.0) to Vector destination (1.0, 0.0)
distance: (0.0, -1.0)
New Shape 0 -1
New Shape 1 -1
New Shape 1 0
New Shape 0 0
FAIL

Vector origin (1.0, 1.0) to Vector destination (0.0, 1.0)
distance: (-1.0, 0.0)
New Shape -1 0
New Shape 0 0
New Shape 0 1
New Shape -1 1
FAIL

Vector origin (0.0, 1.0) to Vector destination (0.0, 0.0)
distance: (0.0, -1.0)
New Shape 0 -1
New Shape 1 -1
New Shape 1 0
New Shape 0 0
FAIL

Vector origin (0.0, 1.0) to Vector destination (1.0, 0.0)
distance: (1.0, -1.0)
New Shape 1 -1
New Shape 2 -1
New Shape 2 0
New Shape 1 0
PASS

Vector origin (0.0, 1.0) to Vector destination (1.0, 1.0)
distance: (1.0, 0.0)
New Shape 1 0
New Shape 2 0
New Shape 2 1
New Shape 1 1
PASS

sentences:
Can a Component.gameObject be null in Unity? Can a Component.gameObject be null in Unity? If it can what can cause it to be null?

The context for the question is a NullReferenceException I got from the users, which specifies only method, but not line in which it occurred.

So, I suspect that there may were conditions which cause Component.gameObject to be null.

sentences:
In Unity, does a reference delegate clear out when its parent GameObject is destroyed? If I have a GameObject with a component like some:

class SomeComponent : MonoBehaviour
{
    System.Action DoStuff;
}

class SomeOtherComponentInAnotherGameObject
{
    public GameObject ObjectWithThatComponent;
    void Start()
    {
        ObjectWithThatComponent.GetComponent<SomeComponent>().DoStuff += SomeFunc;

        Destroy(ObjectWithThatComponent);

        // is there still a reference to SomeComponent somewhere?
    }
}

I'm getting some odd behaviour/random crashing when deleting this stuff but I'm not sure if it's being caused by these delegates.

sentences:
Unity: Running code on the "Create Other" menu? Right now I am trying to create a TextMesh GameObject from code.

The graphics primitives are accessible through PrimitiveTypes, I'm thinking there must be something similar, and if not, I could at least run whatever static function is bound to the menu - if only I knew the name.

The more general question is "how one get at all the other items on the "Create Other" without using the menu itself?"

sentences:
Why is there a discrepancy between these two transform.up vectors? I was trying to implement a feature which required transform.up, the result didn't match the green axis gizmo displayed in the editor so I assumed it was being put off by the rotation of the object despite expecting the gizmo to adapt to that. I then modified the prefab such that everything was now child to an empty object and the secondary objects were child to that instead of the rotating model, and wrote a script that simply copies the transform so that it tracks. This still didn't show the values expected from what the gizmo in the editor showed. I then did a Debug.LogError in the track script and this time the result was as expected.

Why is transform.up showing the value expected from the local y-axis gizmo but when passing a reference to the original script and checking tracked.transform.up gives off results?

To reproduce in a simpler environment I set up a simple test scene.

Simple default cube with the hierarchy structure shown in the screenshot.
The transform values are as follows:

parent zeroed
x:0, y:-90, z:0 for cube
x:0, y:-90, z:90 for TrackPoint

Scripts are as follows:

test.cs - attached to trackpoint

private void Update()
{
    Debug.LogError(transform.up);
}

Track.cs - attached to tracker

public Transform transformToTrack;

private void Update()
{
    transform.position = transformToTrack.position;
    transform.rotation = transformToTrack.rotation;
    Debug.LogError(transform.up);
}

byref.cs - attached to cube

public GameObject refObj;

private void Update()
{
    Debug.LogError(refObj.transform.up);
}

When run, if you clear the console then click pause you'll see that one of them differs from the others. I don't understand why. My project and this sample scene differ in which it is that is giving unexpected results but the results are inconsistent with what I would expect.

But wouldn't they all give the same result?

sentences:
DirectX 11, support for Font drawing I have recently started to work with DirectX 11 and 12, I am using Microsoft Visual Studio Community Edition. I am under a 64-bit machine. I am currently rendering a frame with background and a window using Windows C++ API and DirectX 11.1.
I was thinking about drawing text, but I thought about using custom Fonts, so I will have original Font file, not some graphic file e.g. *bmp or some other format. I have read about: SpriteBatch[1] and SpriteFont[2], which can be used via DirectX Tool Kit (https://github.com/microsoft/DirectXTK).
I tried:
std::unique_ptr< SpriteFont> font(new SpriteFont(device, L"text.spritefont"));
std::unique_ptr<SpriteBatch> spriteBatch(new SpriteBatch(context));
spriteBatch->Begin();
font->DrawString(spriteBatch.get(), L"Hello, ", XMFLOAT2(200,200));
spriteBatch->End();

But, I am running into some issues with the Begin() function, that seems to have mandatory parameters. I did try: Begin(SpriteSortMode:: SpriteSortMode_Deferred, nullptr, nullptr, nullptr); But, I keep experiencing the same errors in Visual Studio regarding overloading and params.
I know that DirectX 9 had D3DXFont, https://drunkenhyena.com/cgi-bin/view_cpp_article.pl?chapter=3;article=17 , I also found this: http://download.nvidia.com/developer/GPU_Gems/CD_Image/Natural_Effects/Water_Simulation/d3dfont.cpp
I also found the DXUT for Direct3D 11, https://github.com/walbourn/directx-sdk-samples/tree/master/DXUT -- but seems this is no longer active.
[1] https://github.com/microsoft/DirectXTK/wiki/SpriteBatch
[2] https://github.com/microsoft/DirectXTK/wiki/SpriteFont
EDIT #1:
With DirectX 9, I can do the following:
 HRESULT hr=D3DXCreateFont(
                     device,           //D3D Device
                     22,               //Font height
                     0,                //Font width
                     FW_NORMAL,        //Font Weight
                     1,                //MipLevels
                     false,            //Italic
                     DEFAULT_CHARSET,  //CharSet
                     OUT_DEFAULT_PRECIS, //OutputPrecision
                     ANTIALIASED_QUALITY, //Quality
                     DEFAULT_PITCH|FF_DONTCARE,//PitchAndFamily
                     "Arial",          //pFacename,
                     &font);           //ppFont

But, unfortunately this does not exist in DirectX 10, 11, or 12.

Questions:

Is using these new recommendations (SpriteBatch, SpriteFont & DirectXDTK) by Microsoft, in any way, linking the stuff I build with XNA?
Is it possible to use Font file, custom one? Or, do I have to create graphic font? (What is more recommended generally speaking)?

A book recommended writing your own Font drawer class, it uses:

ID3D11VertexShader
ID3D11PixelShader
ID3D11InputLayout
ID3D11Buffer
ID3D11ShaderResourceView
ID3DX11CreateShaderResourceViewFromFile
ID3D11SamplerState
D311_MAPPED_SUBRESOURCE
D311_MAP_WRITE_DISCARD

EDIT #2: WHY DO I HAVE TO CAST,
Microsoft::WRL::ComPtr

sentences:
Programming and drawing to deal with different screen sizes and resolutions I started making an XNA game years ago and picked it up recently.

I'm looking later to convert it to use Monogame so that it can be deployed on various mobile devices and OS, though I have a sinking feeling that a lot of the sprites and code will be broken by the changing screen sizes when I move outside of the emulator.

The game is currently hard coded to to 800x480 and the level placements and sprite sizes were all done to fit that at the time.

So question:

What do I need to ensure this works and displays properly on a variety of screens and devices?

sentences:
How to make non-standard sized zones for a procedurally generated 2d map? I am making a procedurally generated map with different zones (plains, forest, village, etc) and am currently just designing each one as a square zone. However, I think it'd be neat if the zones were more randomly distributed so that they could be irregular sizes. I'm not sure how to do that in a good way. (Any given tile needs to know what zone it belongs to quickly and deterministically based on its x, y, and random seed for the world)
Are there existing algorithms for this?

sentences:
Maintain performance and precision with a large vertex buffer? I have a world with 100s of simple objects on screen at once. Most objects don't have more than 40-50 vertices. The vertex coordinates for these objects are very large (planetary scale), so I use the 'floating origin' method to draw my data (actual coordinates are close to the origin and then you apply a translation out to where you want the object).

Based on the user's position, these objects are dynamically created and destroyed. Other than that, the objects are static. With my previous implementation, I was drawing these objects separately, and the result was significant slow down (I'm targeting mobile devices)... since the total number of triangles on screen is sort of trivial (even though there are many objects), I assume that the slow down is because of the multiple draw calls.

So I tried packing my objects into a single buffer to draw them all with a single call. This works, but I also use a 'floating origin' transform to position the geometry. The final transform matrix is calculated with the CPU to maintain precision and then sent to my vertex shader. The problem is applying the floating origin fix is CPU intensive:

If I use a single floating origin for the vertex buffer:

(good) only need to calculate one transform matrix
(bad) I need to perform an offset subtraction on every vertex in the buffer. The upper limits of scene complexity reaches 50k+ vertices, so this is expensive.

If I use multiple objects:

(sorta good) only need to compute as many matrices as there are objects (this is still really expensive though, since there are a ton of objects)
(bad) I need to pass the shader a large array of matrix uniforms

I feel like I'm stuck. Are there any other ways to maintain precision I could use? Or maybe a better way to use the floating origin method? The problem is basically "how do I draw a ton of simple geometry with really large numerical coordinates with OpenGL ES 2?"... I'd appreciate any advice.

EDIT

Just some clarification on the offset. The vertex should always be a valid float. The maximum distance a vertex can be from the origin is the maximum radius of the earth +/- few thousand meters. Assume 1 unit = 1 meter. The distances are never so large that they can't be represented by floats at all.

The objects themselves are things you find in a map on the surface of the earth: buildings/roads/etc. So relative to the coordinates being used, the objects are very small.

I'm not confident on the floating origin stuff, but here's my take...

When you calculate the MVP on the CPU where your vertex is offset, you're getting something you calculate with double precision that goes from an offset vertex position (say its 10.1,10.2,10.3) to the normalized opengl coordinates (I think thats +/- 1 in xy and 0-1 in z... I don't remember right now). You then pass the shader a vertex thats close to the origin, so no huge loss in precision, and a transform matrix that was calculated with double precision.

That's way better than sending the shader a vertex with much larger values since you lose a bunch of precision right away.

sentences:
How to change the player character size in monogame? So I made a new project,
Loaded up the player sprite(16x16)
but the player is too small(as compared to the level)
How should I fix this?
Here the code which loads the sprites and the levels(I am using monogame extended)
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonoGame.Extended;
using MonoGame.Extended.Tiled;
using MonoGame.Extended.Tiled.Renderers;
using MonoGame.Extended.ViewportAdapters;

namespace Dungeon
{
    public class Game1 : Game
    {
        private GraphicsDeviceManager _graphics;
        private SpriteBatch _spriteBatch;
        private TiledMap map;
        private TiledMapRenderer mapRenderer;
        private OrthographicCamera cam;
        private Texture2D player;
        private Vector2 playerPos;
        private InputManager manager;
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IsMouseVisible = true;
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            manager = new InputManager();
            playerPos = new Vector2(0,0);
            mapRenderer = new TiledMapRenderer(GraphicsDevice);
            var viewportAdapter = new BoxingViewportAdapter(Window,GraphicsDevice,800,400);
            cam = new OrthographicCamera(viewportAdapter);
            base.Initialize();
        }

        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            map = Content.Load<TiledMap>("Dungeon");
            mapRenderer.LoadMap(map);
            player = Content.Load<Texture2D>("player");
            // TODO: use this.Content to load your game content here
        }

        protected override void Update(GameTime gameTime)
        {

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            mapRenderer.Update(gameTime);
            // TODO: Add your update logic here

            float move = 2;

                playerPos =manager.moveVertical(playerPos,move);
            playerPos = manager.moveHorizontal(playerPos,move);

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            mapRenderer.Draw();
            var transformMatrix = cam.GetViewMatrix();

            _spriteBatch.Begin(transformMatrix:transformMatrix);
            _spriteBatch.Draw(player,playerPos,Color.White);
            _spriteBatch.End();
            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
    }
}

and the InputManager(You won't need it probably but just in case)
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using System;

public class InputManager
{
    Vector2 position;
    public InputManager()
    {
        position = new Vector2(0,0);
    }

    public Vector2 moveVertical(Vector2 pos,float move)
    {
        var keyboardState = Keyboard.GetState();
        if(keyboardState.IsKeyDown(Keys.D))
        {
            position.X += move;
        }
        if (keyboardState.IsKeyDown(Keys.A))
        {
            position.X -= move;
        }
        return position;
    }
    public Vector2 moveHorizontal(Vector2 pos, float move)
    {
        var keyboardState = Keyboard.GetState();
        if (keyboardState.IsKeyDown(Keys.S))
        {
            position.Y += move;
        }
        if (keyboardState.IsKeyDown(Keys.W))
        {
            position.Y -= move;
        }
        return position;
    }
}

sentences:
Delay command execution over sockets I've been trying to fix the game loop in a real time (tick delay) MUD. I realized using Thread.Sleep would seem clunky when the user spammed commands through their choice of client (Zmud, etc) e.g. east;south;southwest would wait three move ticks and then output everything from the past couple rooms.

The game loop basically calls a Flush and Fill method for each socket during each tick (50ms)

private void DoLoop()
{
    Stopwatch stopWatch = new Stopwatch();
    stopWatch.Start();
    while (running)
    {
        // for each socket, flush and fill
        ConnectionMonitor.Update();

        stopWatch.Stop();
        WaitIfNeeded(stopWatch.ElapsedMilliseconds);
        stopWatch.Reset();
    }
}

The Fill method fires the command events, but as mentioned before, they currently block using Thread.Sleep.

I tried adding a "ready" flag to the state object that attempts to execute the command along with a queue of spammed commands, but it ends up executing one command and queuing up the rest i.e. each subsequent command executes something that got queued up that should've been executed before. I must be missing something about the timer.

private readonly Queue<SpammedCommand> queuedCommands = new Queue<SpammedCommand>();
private bool ready = true;

private void TryExecuteCommand(string input)
{
    var commandContext = CommandContext.Create(input);
    var player = Server.Current.Database.Get<Player>(Session.Player.Key);
    var commandInfo = Server.Current.CommandLookup
        .FindCommand(commandContext.CommandName, player.IsAdmin);

    if (commandInfo != null)
    {
        if (!ready)
        {
            // queue command
            queuedCommands.Enqueue(new SpammedCommand()
                {
                    Context = commandContext,
                    Info = commandInfo
                });
            return;
        }

        if (queuedCommands.Count > 0)
        {
            // queue the incoming command
            queuedCommands.Enqueue(new SpammedCommand()
                {
                    Context = commandContext,
                    Info = commandInfo,
                });

            // dequeue and execute
            var command = queuedCommands.Dequeue();
            command.Info.Command.Execute(Session, command.Context);
            setTimeout(command.Info.TickLength);
            return;
        }
        commandInfo.Command.Execute(Session, commandContext);
        setTimeout(commandInfo.TickLength);
    }
    else
    {
        Session.WriteLine("Command not recognized");
    }
}

Finally, setTimeout was supposed to set the execution delay (TickLength) for that command, and makeReady just sets the ready flag on the state object to true.

private void setTimeout(TickDelay tickDelay)
{
    ready = false;
    var t = new System.Timers.Timer()
        {
            Interval = (long) tickDelay,
            AutoReset = false,
        };

    t.Elapsed += makeReady;
    t.Start(); // fire this in tickDelay ms
}

// MAKE READYYYYY!!!!
private void makeReady(object sender, System.Timers.ElapsedEventArgs e)
{
    ready = true;
}

Am I missing something about the System.Timers.Timer created in setTimeout? How can I execute (and output) spammed commands per TickLength without using Thread.Sleep?

sentences:
Algorithm for creating tree-like network structures I'm trying to procedurally model tree-like network structures with the following properties:

A root with variable number of nodes
A variable depth of nodes
When graphically laid out, edges or nodes must never intersect or overlap

I don't have a background in maths or programming, so I am not sure that I am using the correct terminology. Maybe a picture would better explain what I am after:

I know my way around Ruby pretty well, so I think I should be able to implement a basic algorithm that generates these models. Any pointers or recommendations?

sentences:
How can I move an object towards another along a straight line How can I move an object (like a cube) towards another object?

Let's say that we have a red cube in the center of a floor, and a blue cube in another location, there aren't objects between this two, so the movement is along a line.

How can I move the blue cube towards the red one?

sentences:
Is there a way to get relative center of a Rect object in pygame? Now, suppose I always want to draw a circle at the center of a rect object, now, the problem is:

For example, if I do

pygame.draw.circle(Surface, BLUE, Surface.rect.center, radius, width=3)

This will and does fail because Surface.rect.center is actually the coordinates of the center of the Rect object relative to the (0,0) point -top left corner- of the display screen, not relative to the (0,0) point of the Rect object. However, the draw() function works relative to the Surface coordinate axis.

As far as here, those are my knowledge and I just think so, might be wrong in some aspects, if so, please let me know.

So, I can solve this simply by replacing Surface.rect.center, with:

(Surface.rect.width // 2, Surface.rect.height // 2)

However, I wonder, is there a way to get that center coordinate of the Rect object relative to its (0,0) point(origin) ?

sentences:
Can I get world-space z-near-plane vertices from projection matrix + z-near distance? I'm trying to port ShaderToy VR shaders to WebXR (the new browser API for AR/VR devices).
ShaderToy VR shaders expect two extra parameters: ray origin (view translation) and ray direction (unit vector from ray origin to each pixel). I could easily calculate this ray direction if I had fovX + fovY + distance to projection plane.
The problem: WebXR does not expose FOVs and instead just provides us with a projection matrix (apparently some devices might need more complex projection matrices with shear, roll, etc.) WebXR also exposes zNear and zFar, but that's all the frustum info available if I'm not mistaken.
Is there any way to obtain the zNear plane corners in world-space with this information?

sentences:
How can I compute a "steepness" value for height map cells? Here's a question related to height map generation. From a 2D height map I want to produce a second map, I guess you can call it sort of a derivative map, which shows the "steepness" of all the discrete values of the map. I plan to use it to quickly determine what kinds of objects can be placed on different locations.

In practice you would have many areas where rise/run is a fractional value, since many places do not have 45 degree angle slopes. But running through the pixels of the height map in any direction, the value differences are all integer values.

So what I planned to do in order to represent smooth slopes of varying degrees is, iterate through the pixels row by row, and find the lengths of all the distances where height does not change, and for every change in height, divide that by the length of the distance. Do the same thing column by column and then average the two results for each pixel. I do have to wonder how accurate this is in situations where a lower elevation is surrounded by two walls/plateaus since the rise/run is technically infinity, as it represents a completely vertical climb.

Is this a reasonable way for calculating steepness? I haven't found any resources on how to produce a 2D array of steepness values from height maps, just things on topographic (real-life maps) with the basic rise/run formula.

sentences:
"Create Test Script in current folder" button is grayed out in Unity I thoroughly read the Unity Test Runner documentation.

It is said in the documentation that the button may be disabled only if the creation of the script will lead to an error.

  This option is disabled if adding a test script would result in a compilation error.

But I do not understand this. How could a creation of the script possibly lead to an error?

I will be grateful for any help provided.

I found here a little bit more info, but it did not help me out.

sentences:
Objective-c Cocos2d moving a sprite I hope someone knows how to do the following with cocos2d:

I want a sprite to move but not in a single line by using

[cocosGuy runAction: [CCMoveTo actionWithDuration:1 position:location]];

What I want is the sprite to do some kind of movements that I preestablish. For example in some point i want the sprirte to move for instance up and then down but in a curve. Do I have to do this with flash like this documents says?

http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:animation

Does animation in this page means moving sprites or what?

thanks

sentences:
Render a sphere when the user clicks on the screen with libgdx I’m really new to Libgdx, and decided to try out some codes to familiarise myself with it. I’m trying to write a program such that a sphere is rendered at the position of the user’s click.

Here’s my code:

package com.mygdx.game;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.g3d.Environment;
import com.badlogic.gdx.graphics.g3d.Model;
import com.badlogic.gdx.graphics.g3d.ModelBatch;
import com.badlogic.gdx.graphics.g3d.ModelInstance;
import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
import com.badlogic.gdx.graphics.g3d.Material;
import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.graphics.FPSLogger;

public class Render implements ApplicationListener {
    public Environment environment;
    public PerspectiveCamera cam;
    public CameraInputController camController;
    public ModelBatch modelBatch;
    private FPSLogger fps;

    public Model model;

    @Override
    public void create() {
        Gdx.graphics.setContinuousRendering(false);

        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.Specular, 0.4f, 0.4f, 0.4f, 0.6f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, 0f, 0f, -1f));

        modelBatch = new ModelBatch();

        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(0f, 0f, 10f);
        cam.lookAt(0,0,0);
        cam.near = 1f;
        cam.far = 300f;
        cam.update();

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createSphere(1f, 1f, 1f, 30, 30,
                new Material(), Usage.Position | Usage.Normal)
        camController = new CameraInputController(cam);
        Gdx.input.setInputProcessor(camController);
        fps = new FPSLogger();
    }

    @Override
    public void render() {

        if (Gdx.input.justTouched()){
            ModelInstance Instance = new ModelInstance (model);
             Instance.transform.setToTranslation(Gdx.input.getX(),Gdx.input.getY(), 0);
            DataBase.array.add(Instance);
            Gdx.graphics.requestRendering();
        }
        camController.update();

        Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

        modelBatch.begin(cam);
        for (ModelInstance instance: DataBase.array) {
            modelBatch.render(instance, environment);
        }
        modelBatch.end();

        //fps.log();
    }

    @Override
    public void dispose() {
        modelBatch.dispose();
        model.dispose();
    }

    @Override
    public void resize(int width, int height) {
    }

    @Override
    public void pause() {
    }

    @Override
    public void resume() {
    }
}

The DataBase.array is simply an ArrayList.

What am I doing wrong? Any help would be really appreciated; thanks!

sentences:
Making game constants/tables available to game logic classes/routines in a modular manner Suppose I have a game where there are several predefined constants and charts (a XP chart, cost of goods and so on). Those could be defined at runtime, or load from files at start-up. The question is how should those logic routines access the constants and charts?

For example, I could try using global variables, but that cause all classes relying on the variables to  be tightly coupled with them.

sentences:
Social Network Gaming on Windows, Linux and OS X I'm working on mobile platforms as Android, IOS... Many users of Moblox ask us a windows and an OS X version.
There is no difficulties to provide these versions, because we are developing on OS X C++ code but we miss global scores and social network part (facebook, twitter). Is there any library to implement these functions on Desktops plaforms ?

On mobile platforms, we have many SDK to provide theses functions as OpenFeint, ScoreLoop, Plus+. We have used cocoslive and uploaded scores with libcurl but it's very limited.

sentences:
confusion in animating a sprite sheet using craftyjs can anyone help me with this : http://jsfiddle.net/B5UsC/15/

you can see that the sprite animation is not rendering correctly and i am guessing that i am not using the exact width of the sprite ,i tried to change the width but also didn't work out

THE CODE :

// initialize the sprite
Crafty.sprite(52,123,"http://i.imgur.com/bkYVEe5.png", {
              Ryu: [0,0]
          });

// initialize the component
Crafty.c("RyuAnimation", {
              init: function () {
                  this.requires("SpriteAnimation,Keyboard")
                .addComponent("Ryu")
                .reel('idle', 1000, 0, 0, 9);
                this.animate('idle', -1);

              }

// creating the player
player = Crafty.e("2D,DOM,Canvas,RyuAnimation")
                    .attr({ x: 15, y: ch - 123, w: 52, h: 123 })
                    .start(3);

i am pretty sure the missing element is hidden somewhere in this code :

Crafty.sprite(52,123,"http://i.imgur.com/bkYVEe5.png", {
              Ryu: [0,0]
          });

but help me in figure out the real problem behind this confusion because i have no idea why this error in rendering is occurred

sentences:
How can I add a delay to my enemy spawning in Greenfoot? How can I add a delay between spawning my enemies in Greenfoot? I'm doing it from a class that is neither a world nor an actor, its made totally by me. I need to it spawn 3 enemies, 3 times, with a 1-second delay between each time. Here's what I've got now.

void attack()
{
    long beginTime = System.nanoTime();
    int i = 0;
    while(i < 3)
    {
        if ((System.nanoTime()-beginTime)/1000000000>1f)
        {
            for (int j = 0; j < 3; j++)
            {
                world.spawnEnemy();
            }
            i++;
        beginTime = System.nanoTime();
        }
    }
}

It's based off of this answer to this question. However, it does not at all give me the desired results. Instead, it entirely pauses everything else in the game (all of the actors, probably the world too, but I'm not sure) until the makeshift timer ends 1 second into it, and then spawns all 3 waves (all 9 enemies) at once.

sentences:
Augmented reality on Mobile platform - iOS Is there a way that we can control the iOS device camera to an extent what colors it sees, what shapes it sees ? etc

I'm speaking about the ability to read information before the image is captured.

Consider my question as: Possibility of making an augmented reality game on iOS phones.

I dont find relevant help for my query in internet/iOS developer site. Hence posting here.

sentences:
What version of Java should I target for applets? I recently deployed an applet that seems to require Java 6 Update 24. I assume the reason for this requirement is the matching JDK version I used to create the applet (I am new to Java).

The fact that my applet requires a Java download/update for users who already have some version of Java installed is a big concern for me; the applets I'm creating slip into a web comic, so it's very disruptive. Having used the most recent version of Java, it seems as though I am able to assume that most of the readers I get will have to update Java to continue reading/playing.

Is there a best practice concerning which version of Java to use to make the process of using an applet easy for end-users? Any reading material on this would be very helpful. Should I be using an older version of Java if I don't require new features? I am using Slick for 2D games.

sentences:
Unpacking UE4 .pak's? Is there any way to properly unpack/repack resources of UDK-based games (.pak files)? .
From what I've tried already, gildor.org's viewer seems to skip/ignore these .pak's (also, UDK, which is UE3 though, wont read renamed .pak->.uassets).

sentences:
Developing addons for xbox one controller I want to develop an addon that plugs to the bottom of the controller for the xbox one. Can I legally make addons to the xbox one controllers without Microsoft's blessing?

If so, has anyone done anything like this? Cursory search looks like it has not been done.

sentences:
Why is my program "not responding" when I run it? I'm trying to learn to code with python and while using pygame, I came across this: every time I run the window it says "not responding".

Specifically, it happens when I click to drag the window; the title changes to "not responding" and I do not know what to do.

Here is all of my code:

import pygame
pygame.init()

win = pygame.display.set_mode((500, 500))
pygame.display.set_caption("Game Test")

sentences:
Datastructure for infinite 2D map I started a 2D Tilegame programmed with libgdx which needs potentially infinite tiles. That means when the player arrives the border of the map it should be possible to generate even more tiles. So a simple 2D Array is not the best datastructure for that purpose.
A better solution I found here in the comments from dlras2:
A way to store potentially infinite 2D map data?

it seems like he put 2D arrays in 2D arrays and that again and again, that reduces a lot of memory compared to one array for all tiles:

The problem is that I dont know before how many times the arrays will be encapsulated so it should be easily possible to wrap a new Array around if it is needed.

dlras2 also posted his code in C#, but I dont understand anything from it. Do you have an idea how to implement such a datastructure of recursive Arrays in Java? Or how to translate the whole C# code into Java? I hope the other stuff like putting tiles in the right array I'll solve by my selve.

sentences:
Primitives LINESTRIP Closing to the first point? I'm doing a exercise form the Frank Luna book. It ask to draw a LineStrip that looks like the red line in the picture.
I'm using

 md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP);

I'm getting the line that is yellow,blue and black and it is looping.
How can I make it look like the red line?

My vertex that has the points:

 Vertex vertices[] =
{
    { XMFLOAT3(-5.0f, 2.0f, 0.0f) },
    { XMFLOAT3(-4.0f, -2.0f, 0.0f)    },
    { XMFLOAT3(-3.0f, 2.0f,0.0f)      },
    { XMFLOAT3(-2.0f, -2.0f, 0.0f)  },
    { XMFLOAT3(-1.0f, 2.0f, 0.0f) },
    { XMFLOAT3(0.0f, -2.0f, 0.0f)  }

};
 My indices code is:

UINT indices[] = {

    0,1,2,3,4,5

sentences:
3Ds Max is exporting model with more normals than vertices I made a simple teapot with the "Create Standard Primitives" option and exported it as a collada file, ended up with this:

< float_array id="Teapot001-POSITION-array" count="1590">

< float_array id="Teapot001-Normal0-array" count="9216">

For what I know there should be only one normal per vertex, am I wrong? What am I supposed to do with that much normals? Just put them on the normal buffer all at once normally?

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

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

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

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

sentences:
Do I lose any functionality using Visual Studio for Unity 3d? MonoDevelop has always had a strange tendency to stop functioning in basic ways ... autocompletion, copy/paste-clipboard, error detecting, and other silly things.

I routinely fix this by running clean / rebuild all, then restarting MonoDevelop. But this is time-consuming. I've read that Monodevelop has issues...

If I switch to Visual Studio will I lose anything at all that I rely on with Monodevelop's integration to unity? Or will I in fact gain?

sentences:
Generate random starting points at same distance between them Is there an algorithm to generate random 2D points that are at the same distance between each other? Useful for starting points. Check map:

Don't be picky, I know in the image points are not at the same distance, lol, but you get the idea.

sentences:
How to manage dependencies between tile map and units I have a 2D tile-based strategy in the works.  I'm wandering how to handle the relationship between the map and the units on the map.

Given a tile coordinate I'll need to be able to get the unit standing on it, if any.  At the same time, if given a unit I'll want to be able to get the unit's coordinate.

I've seen two solutions to this.  The first solution would be to have units store a coordinate and the map store unit references in its tiles.  This creates a cyclic dependency between the map and units.  I'd need to make sure that the map an any unit are kept in sync if the unit moves.

The second solution would be to only have the units keep track of their coordinates.  To tell if a tile contains a unit and to get that unit, I'd loop through the whole set of units unit I find one with matching coordinates.  That get rids of the cyclic dependency, but it looses the O(1) property the first solution had for looking up units from the map.  This may add up as I want to be able to scan the map regularly for things such as path finding, determining movement range, and finding valid targets for a given unit.

I also can't just store the units in the map (or can I?).  Units are associated with "armies", either player or AI.  An army should be able to easily access and iterate over all of its units.

Since this appears to be a common issue in strategy games, are there any other patterns besides the two I described for managing unit/map relationships?

sentences:
View Frustum Alternative I am working on a simulation project that requires me to have entities walking around in a 3D world. I have all that working, matrix transformations, etc. I'm at the point where I need what is essentially a view frustum, so I can give each entity a visible area. However, when looking over the calculations required to do it, it seems like a perspective frustum is only required to be able to project it onto a 2D screen. Is there another, easier to code solution, that would function better, such as an orthogonal perspective? Could I just define a shape mathematically and test wether the coordinates of the objects are inside or out? I am not really a 3D coder (and I am doing this all from scratch, not using an engine or anything), so I would like the simplest solution possible for my needs.

Thank you!

sentences:
Animator.Play() only works the first time I am creating a game in Unity 3d that is using an animation to move an object. For some reason the animation only works the first time it is accessed and from then on it acts as if it is not being called even though I have debugged and I see that it is being called. Here is the code I use to call the animation:

if (anim == null)
{
    foreach (Transform component in myObject.transform)
    {
        anim = components.GetComponent<Animator>();
    }
}
anim.Play("Flip-Forward");
anim.enabled = true;

As you can see I have an animator connected to myObject that I access in order to plan an animation. "Flip-Forward" is one of the animations I have created.

sentences: If I want to create a top-down 2D game should I rotate the camera? Do I have to rotate the camera to top-down view if I want to crate a top-down 2D game or just disable gravity?

sentences: How can I create a contrail effect for a spaceship in motion? I am curious how I could create an effect similar to the ship's tail in the following picture:

sentences:
Design of a turn-based game where actions have side-effects I am writing a computer version of the game Dominion. It is a turn-based card game where action cards, treasure cards, and victory point cards are accumulated into a player's personal deck. I have the class structure pretty well developed, and I am starting to design the game logic. I'm using python, and I may add a simple GUI with pygame later.

The turn sequence of the players is governed by a very simple state machine. Turns pass clockwise, and a player can't exit the game before it is over. The play of a single turn is also a state machine; in general, players pass through an "action phase", a "buy phase", and a "clean-up phase" (in that order). Based on the answer to the question How to implement turn-based game engine?, the state machine is a standard technique for this situation.

My problem is that during a player's action phase, she can use an action card that has side effects, either on herself, or on one or more of the other players. For example, one action card allows a player to take a second turn immediately following the conclusion of the current turn. Another action card causes all other players to discard two cards from their hands. Yet another action card does nothing for the current turn, but allows a player to draw extra cards on her next turn. To make things even more complicated, there are frequently new expansions to the game that add new cards. It seems to me that hard-coding the results of every action card into the game's state machine would be both ugly and unadaptable. The answer to Turn-based Strategy Loop does not go into a level of detail that addresses designs to solve this problem.

What kind of programming model should I use to encompass the fact that the general pattern for taking turns can be modified by actions that take place within the turn? Should the game object keep track of the effects of every action card? Or, if the cards should implement their own effects (e.g. by implementing an interface), what setup is required to give them enough power? I have thought up a few solutions to this problem, but I am wondering if there is a standard way to solve it. Specifically, I'd like to know what object/class/whatever is responsible for keeping track of the actions that every player must do as a consequence of an action card being played, and also how that relates to temporary changes in the normal sequence of the turn state machine.

sentences:
why is GetComponent returning null? As you can see in the attached image below and the code, I have added a class that implements the interface ICameraControl attached to a GameObject.

When I call var controller = GetComponent<ICameraControl>();, I get nothing returned (null), as in this example:

public class KeyboardHandler : MonoBehaviour
{
    private void Start()
    {
        var controller = GetComponent<ICameraControl>();
        if (null == controller)
            print("no ICameraControl found!");
    }
}

And the output is like this in the unity console:

  no ICameraControl found! UnityEngine.MonoBehaviour:print(Object)
  Assets.Player.KeyboardHandler:Start() (at
  Assets/Player/KeyboardHandler.cs:18)

Here's the Camera Position Handler attached to my game object:

Here's the interface implementation:

public class CameraPositionHandler : MonoBehaviour, ICameraControl
{
    private GameObject mainCamera;
    private Quaternion homePosition;

    private void Start()
    {
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera");
        homePosition = mainCamera.transform.rotation;
    }

    private void LateUpdate() { }
}

Any ideas what I am doing wrong?

Much appreciated :)
Matt

Edit:  The keyboard script is on my player object (at bottom of the picture of the player object).  And the Camera Position Handler is on the Camera Arm object.  The Player object and Camera Arm objects are at the same level.

sentences:
Texturing spherical terrain, seemingly arbitrary distortion I'm using this algorithm to find texture coordinates on a sphere:
Wikipedia UV Coordinates

I get the famous seam due to the wrong interpolation, but I also get odd distortions on certain points on the sphere. A picture follows where you can see like five starshaped distortions.

What could cause this?

sentences:
Ball Physics : Bounce height altered by elasticity of ball and bounce surface I have created a bouncing ball simulator using XNA and I am happy with my use of gravity, acceleration, change of direction and friction/spin.

However, I am now at a stage where I would like to define my ball as being made of a different material, subsequently meaning that the "bounce height" will be different depending on the elasticity of the material.

Ultimately, I will also want differing types of bounce surfaces as well.  This will mean that I could have bounces as varied as:

Rubber ball on concrete.
Ping-pong ball on wood.
Concrete ball on mud.
Etc., etc.

My question is; How should I alter my bounce height depending on the material(s)?

I have found some information about Young's Modulus of Elasticity but I would be grateful if someone could advise as to how I use this (or another) value as a ratio in my "bounce" calculation.

Thanks in advance and please let me know if you would like to know anything else.

sentences:
How to loop over a part of an ogg vorbis stream? I'm successfully streaming ogg vorbis data to openAL with the Java library JOrbis, but now I want to loop over a part of this stream, e.g from 30" to 1'30".

I thought that at the end of the loop, I could redecode from the beginning of the file, skip the unwanted part, and then keep streaming until the end of the loop, and restart again. But I'm not really convinced by this method, as for example, if I want to loop over 4' and 4'30", I'll need to decode each loop 4 minutes of ogg data for nothing.

Another way would be to put all the loop in memory, but it won't be streaming anymore and I want to avoid this.

So is there a way to reach a point in an ogg vorbis stream without decoding the previous data every time ? Does ogg contains a kind of index that can be used, or is it possible to make one by decoding the whole file once before ?

Thanks

(ps: I could't give this question the right tags as I haven't yet 150 rep)

sentences:
Terrain and Path Architecture I am trying to figure out how to not break the SOLID principles with a collection of classes I am writing.

Currently, I have two stacks of classes that cater for editing and rendering Terrain and Paths.

Terrain -> TerrainChunk -> TerrainTile

Path -> PathChunk -> PathTile

The top level Terrain object exposes methods to add and remove Tiles which are then partitioned into Chunk objects forming part of a partitioned scene graph.

The Chunk objects themselves contain an array of Tiles and if something causes the tile or chunk to become dirty (terrain height is altered or a tile is added/removed) then the chunk “re-draws” itself which is as simple as looping through the tiles and calling Render().

The implementation of both the Terrain and Path stack of classes are largely the same (adding, removing, partitioning into chunks etc) with only the Render() method really doing anything different, i.e.: rendering a simple path or a single terrain tile.

I am quite happy with this setup so far which has proven to be extensible enough for my needs to date. This is working as expected and (surprisingly) I haven't butchered my code enough to worry about breaking any of the SOLID principles. Yet.

However, the need has arisen for the TerrainTile to know about the PathTile and also the PathTile needs  to know about the TerrainTile.

The reason I believe this is true is that I would like to be able to “cut away” the terrain where the path is and also add “tunnels” to the path though the terrain. In order to do this, both terrain and path need to know about each other to determine where the terrain should be drawn or cut away and which paths should have "tunnels" added to them.

Ideally, I would like to implement something similar to this capture from Theme Parkitect although the principle is most likely the same in any other simulation game with terraforming.

I’m not sure how to create the relationships between the two classes however without breaking at least 3 of the SOLID principles.

I could certainly go right at it and brute force this into my current implementation but that’s not very nice and would go against the lean and sane implementation I have strived for thus far.

Can anyone offer up any suggestions as to how I might inform one stack about the changes in another without introducing dependencies or hacking my code to pieces?

Perhaps I am barking up the wrong tree and the approach I have in mind isn't entirely suited for the job, in which case, are there any alternative options I could explore?

Note that I am not asking here about how to create either the terrain or the path tiles themselves but simply, how can I inform each of the appropriate parties of changes to each other without creating cyclical dependencies on each class.

If it matters, I am using Unity and C# but really this problem is both platform and language agnostic.

sentences:
Simulating circular motion with gravitational forces in Unity2D I am currently messing around with a game where you control a black hole and use its gravity to fling planets at targets. I have the gravity calculations working pretty well when the planets start out stationary but I want to take it a step further and have the planets start out in circular orbit around the black hole.

Ideally what I want to do is place a planet, provide it with an orbital period, and have it orbit my black hole object in uniform circular motion. To do this I am following these steps:

Use the objects initial distance from the black hole (\$r\$) and the given orbital period (\$T\$) to calculate the standard gravitational parameter of the system (\$\mu\$) via the equation \$\mu = \frac{4\pi^2r^3}{T^2}\$
Find the tangential velocity of the circular motion via the equation \$v = \sqrt{\frac{\mu}{r}}\$
Assign the object an initial velocity with a magnitude of \$v\$ and a direction perpendicular to the vector between the black hole and the object
Every time the Update() function is called, apply a force to the object in the direction of the black hole that represents its gravitational pull \$F=\frac{\mu m}{r^2}\$ where \$m\$ is the mass of the object.

All of these equations came from the Wikipedia page on circular orbit.

When I do all of this I get planets that do orbit the black hole, but their orbits are elliptical and rather unstable while I want them to be perfectly circular. Here is my GravitationalForce script, which I attach to the planet object and provide the black hole object as otherBody.

public class GravitationalForce : MonoBehaviour
{
    public GameObject otherBody;

    public float orbital_period = 2;

    float grav_param;

    Rigidbody2D rigidbody2d;
    Rigidbody2D rigidbody2d_other;
    // Start is called before the first frame update
    void Start()
    {
        // get rigid bodies of this object and the object it is attracted to
        rigidbody2d = GetComponent<Rigidbody2D>();
        rigidbody2d_other = otherBody.GetComponent<Rigidbody2D>();

        // calculate the grav_param for this object
        Vector2 position_this = rigidbody2d.position;
        Vector2 position_other = rigidbody2d_other.position;

        Vector2 dist_vector = position_this - position_other;
        float dist = dist_vector.magnitude;

        grav_param = (4*Mathf.Pow(Mathf.PI, 2)*Mathf.Pow(dist, 3))/(Mathf.Pow(orbital_period, 2));

        // calculate and assign the initial velocity
        Vector2 dist_vector_rotated = new Vector2(-dist_vector.y, dist_vector.x);
        dist_vector_rotated.Normalize();

        Vector2 velocity_vector = dist_vector_rotated * (Mathf.Sqrt(grav_param/dist));

        rigidbody2d.velocity = velocity_vector;
    }

    // Update is called once per frame
    void Update()
    {
        // calculate gravitational force
        Vector2 position_this = rigidbody2d.position;
        Vector2 position_other = rigidbody2d_other.position;

        float dist = Vector2.Distance(position_this, position_other);

        float force_magnitude = (grav_param * rigidbody2d.mass)/(Mathf.Pow(dist, 2));

        float theta = Mathf.Atan2(position_other.y - position_this.y, position_other.x - position_this.x);

        Vector2 force_vector = new Vector2(force_magnitude*Mathf.Cos(theta), force_magnitude*Mathf.Sin(theta));

        rigidbody2d.AddForce(force_vector);
    }
}

Any ideas on why my orbits are unstable and elliptical instead of stable and circular? My only thought is that circular orbit is a very sensitive state and rounding errors in the physics engine or floating point number weirdness might be causing it to deviate from the circular path. If that is the problem, is there any easy fix to that and if not, what could the problem be?

Thanks!

sentences:
How can i make all the scene dark/night and spot a light on specific place/area in the scene? I want to light the area of the 5 spheres. All the rest to be dark.
What i have in the Hierarchy is Directional Light.
I'm not sure if i need other lights objects and what to do to make it dark/night environment and how to spot a light on the specific area.

sentences:
I keep getting this error when I run my game so far I have a tags script:

public class Tags {
    //Tags
    public static string PLAYER_TAG = "Player";
    public static string PLATFORM_TAG = "Platform";

    //Player Animation Tags
    public static string ANIMATION_IDLE = "idle";
    public static string WALK = "walk";
    public static string ANIMATION_RUN = "run";
    public static string ANIMATION_JUMP = "jump";
    public static string ANIMATION_JUMP_FALL = "jumpFall";
    public static string ANIMATION_LEDGE_FALL = "ledgeFall";
    public static string ANIMATION_JUMP_LAND = "jumpLand";

}
 Then I have my player animation script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAnimation : MonoBehaviour {

    [SerializeField]
    private Animation anim;

    void Awake () {
        anim = GetComponent<Animation>();
    }

    public void DidJump () {
        anim.Play(Tags.ANIMATION_JUMP);
        anim.PlayQueued(Tags.ANIMATION_JUMP_FALL);
    }

    public void DidLand()
    {
        anim.Stop(Tags.ANIMATION_JUMP_FALL);
        anim.Stop(Tags.ANIMATION_JUMP_LAND);
        anim.Blend(Tags.ANIMATION_JUMP_LAND, 0);
        anim.CrossFade(Tags.ANIMATION_RUN);
    }

    public void PlayerRun()
    {
        anim.Play(Tags.ANIMATION_RUN);
    }
}

When I run the game, the player doesn't run like he's supposed to and I get this error:

NullReferenceException: Object reference not set to an instance of an object
PlayerMovement+<StartGame>c__Iterator0.MoveNext () (at Assets/Scripts/Player Scripts/PlayerMovement.cs:83)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

What am I doing wrong here?

sentences:
How can I make a custom mesh class in Unity? I'm doing something in Unity where I need to specify the position and orientation of vertices with two Vector4s, and they're not just position and normal vectors. I've already written my custom shader and now I need to make mesh objects that can be fed into it.
So how do I make my custom mesh? Should I inherit from the mesh class? Will I still be able to use the normal mesh filter and mesh renderer components or should I replace those too? I am comfortable coding the data structure for my new mesh, the question is interfacing with the Unity rendering pipeline and sending the data to my shader in the right way.

sentences:
"Following" Object is acting Strangely? So I recently designed an enemy that will follow the player when he comes within a certain distance of the object. However, there are times when the player comes in range, only for the "follower" enemy to seemingly reverse before following, or almost kind of circle the player on the way towards him.

I can't quite put my finger on why this is happening, so I have attached my code. I hope someone can give me some advice on how to improve this:

    public class Follower : MonoBehaviour
{
// spawn position and other info of Follower
private Vector3 pos1 = new Vector3(-7f, 0.5f, -7f);
public float speed = 1.0f;
public int Range;
public GameObject target;
private Vector3 targetTran;
private Vector3 diffVec;
private float diffMag;

void Awake()
{
    transform.position = pos1;
    sourceCollFol = GetComponent<AudioSource>();
}
void Start ()
{
    target = GameObject.FindWithTag("Player");
    targetTran = target.transform.position;
}
void Update ()
{
    pos1 = transform.position;
    targetTran = target.transform.position;
    diffVec = (targetTran - pos1);
    diffMag = diffVec.sqrMagnitude;
    // check for range between Player and Follower Enemy
    if ( diffMag < Range)
    {
        transform.LookAt(targetTran);
        diffVec.Normalize();
        transform.Translate(diffVec.x * speed * Time.deltaTime, 0f, diffVec.z * speed * Time.deltaTime);
    }
}
}

sentences:
Calculating impulse with multiple collision points In my amateur 2D rigid body physics engine for a game I react on collisions between two bodies with an impulse j (formula 11) as explained here.
To calculate this impulse I need one contact point P between the two colliding bodies and the perpendicular normal n of the edge the contact point of A is colliding with.

(source: myphysicslab.com)
That works wonderful. At least as far as I don't have multiple contact points. But what to do if this is not the case?
Should I calculate an impulse for each of the contact points or is there a way to reduce multiple contact points to a single one if this is a correct solution?
As an example I have following two situations, where two bodies collide. The x denotes the center of mass and the tips of each triangle pointing down an vertice of A that is colliding with the edge underneath:
    _____________________                        _____________________
   |                     |                      |                     |
A  |          x          |                   A  |                     |
   |    _____________    |                      |         x  ______   |
    \  /             \  /                       |           /      \  /
     \/               \/                        |    __    /        \/
    _____________________                        \  /  \  / ___________
   |                     |                        \/    \/ /           |
B  |          x          |                   B   _________/    x       |
   |_____________________|                      |______________________|

In the left situation its intuitively pretty clear that I can reduce the two collision points to one exactly in the middle between both since the this would be collinear to both centers of mass. Also as normal n the perpendicular vector of the edge both vertices are colliding with can be chosen.
But what to do in the right situation?

sentences:
Time critical events based on framerate Problem Description

Basically, I've made a "programming game" in which I've made my own scripting language. It is a completely standard Lunar Lander game, though instead of directly controlling the lander using keyboard input, it instead fires a sequence of commands you have provided through the scripting language I made. This all works, and I've hit a critical problem.

So essentially, using the scripting language, you specify something like After 5 seconds, activate thrust for 10 seconds, and then after 2 seconds, rotate the lander for 4 seconds. The goal is then to chain together a sequence of commands which will get you to land the lander safely.

Of course, this comes with one problem. If you repeat the sequence of commands, each command will have to be fired at exactly the same spot in the level, that is, after x amount of seconds, but also with the lander being in the exact same spot. If you did not use timer-based movement, sure you could indicate that a command should activate after 5 seconds, but the lander moving at 60 FPS would have moved way further than a lander moving at 30 FPS.

Why of course, I thought I would simple just make the lander use timer-based movement so it is independent of FPS (I am using the very standard approach of taking the amount of time passed last frame, and multiplying it to a constant move speed). Then I would count seconds using the system clock. So the after x amount of seconds, the lander would be in the same spot in the level when the command activates.

Unfortunately, this approach do not work. Every time I run a sequence of commands, they will be activated with, sometimes very slight, variations, making it impossible to actually get a consistent and reliable path for the lander.

My Question

So my question is, am I tackling this problem a completely wrong way? What exactly do you do when it is absolutely critical that timed events defined by the user will activate at exactly the same time and spot in a level? I seem to be quite stuck with this question.

sentences:
Draw/"rasterize" irregular circle onto a 2D grid I'm using the midpoint circle algorithm to choose cells on a 2D grid which outline a circle. However, I need to incorporate some random noise so that I get an irregular circle, and this method won't work anymore given how it works. Another stack exchange answer describes an equation (the "pink noise" example) I'd like to try but I'm not sure on the best approach to implement it.

I can replicate the equation via code, but I'll need to start choosing grid cells/coordinates differently and I'm not sure the best solution.

How can I "rasterize" an irregular circle like this?

sentences:
Inverted left & right stick axes in SDL2 I've faced a weird problem with SDL2.

case SDL_CONTROLLERAXISMOTION:
    switch (e->caxis.axis)
    {
    /* LEFT && RIGHT Stick Movement */
    case SDL_CONTROLLER_AXIS_LEFTY:
        puts("Y");
        break;
    /* UP && DOWN Stick Movement */
    case SDL_CONTROLLER_AXIS_LEFTX:
        puts("X");
        break;
    }
    break;

Using my Xbox 360 Controller on Windows 10, I just the move the left stick forward and backward which is in the y-axis logically. But it prints X instead.

There's no problem with my controller since it works as it should be with all other games.

I've also used some gamepad tools for debugging and the results are the true y and x axes directions.

What did I miss? It's the same with the right stick too.

sentences:
Handling actions in component based multiplayer game Please stay with me as I explain my question.

I'm creating a multiplayer game. My design pattern follows broadly thoughts described in the post here.

The idea is that each actor whether be it a (local) player or a npc does what a GameAction attached to this actor tells it to do. These GameActions are obtained by reacting to a received GameEvent. This enables only sending GameEvents through network and each client logic will obtain own GameActions for e.g. moving local copies of remote players themselves and also getting sanity checks from time to time.

How should these actions be composed then? Who takes responsibility stopping actions?

My problem right now is that if a LocalInputHandler produces on keyDown() a CHARACTER_INPUT event it will be delivered to and consumed by a parent node the local player is living in. The parent node obtains a CHARACTER_MOVE GameAction and attaches it to the specific local player. On update() the player/character excecutes the GameAction. It moves, by itself. Like a small script interpreter. Isn't that awesome? No it isn't because if I didn't release the button (aka holding it) no new CHARACTER_INPUT will be emitted and the player excecuted it's action and nothing happens.

To solve this problem I came up with 6 classifications or types of GameActions:

Unstoppable - loops forever, can only be stopped by itself
OneTimeLooper - loops until getting stopped, always finishes task before getting interrupted
Looper - loops until getting stopped, can be interrupted any time
OneTimer - performs action only once and can't be interrupted while doing it
WeakWorker - Performs action once but can always be interrupted
Stopper - AntiAction: interrupts all types except unstoppables. Is a OneTimer

This would lead having a CHARACTER_MOVE action be a OneTimeLooper. It moves the attached actor until a CHARACTER_MOVE_STOP action tells it to do, being created because of an event originating from a keyUp() call.

But this solution smells bad to me, because then each Character/Actor/Player has to have more than one GameAction it can hold to. A Stopper must have access to it's counterpart to know if it is allowed to stop. Also shouldn't higher order classes like parent nodes have the power to stop an GameAction since they also created them?
Why not give LocalInputHandler power? How to change input style if you have a menu opened on top of the screen representing everything that happens in your world?

Clarifications and optional text:

LocalInputHandler and localPlayer are coupled by handing over LocalInputHandler the ID (represented by UUIDs, which I'm still not sure using because they are so big for networking applications) of localPlayer in construction. Each InputHandler whether be it a remote or ai InputHandler will only now by ID which actor they are handling and will refer to this ID when creating a CHARACTER_INPUT event by writing recepient = actorID into the event. The message of this event is a int[] keymap which holds information about which key is held down. keymap is a member variable of a InputHandler It could be a boolean[] but for now it's an int[] array. Parentnode of an actor takes these informations (recepientID and keymap) and packs a CHARACTER_MOVE GameAction into the event passing it down to the actor for consumption. In this process the keymap is being copied by calling .copy()on keymap because this will prevent opening a channel of direct communication from the InputHandler to the GameAction by not letting it just copy a reference but the array as a whole.

sentences: Can you use a sprite with uneven dimensions in Unity 2D? I'm new to game development as a whole, so forgive me if this is an idiotic question in itself, but I want to use a sprite sheet where the entire sprite sheet's dimensions are 104x144, and the dimensions of an individual "pose" of the sprite is 26x36. If I can use this sprite, and I'm asking if I can, what Pixels Per Unit would I put? Again, I have absolutely no idea how this works, and I'm probably being a huge idiot about this entire thing.

sentences:
collision detection and normals from rigidbody Until now I've been developing my player character using a Character Controller, but have since decided to switch to rigidbody due to the controller's limitations. In order for my movement code to run as expected I need to know when the player is colliding with anything, and the normal of the surface it's colliding with. This is easy with a Character Controller, but is there a simple way to do it with a rigidbody?

Here is a stripped down version of the script I'm using for collisions.

 // Used in other scripts (Necessary)
    public GameObject ground = null;
    public Vector3 groundNormal;
    public bool onGround;

    // Used internally
    public bool isColliding;
    public float slopeLimit;

    // Character Controller
    public CharacterController controller;

    void Start()
    {
        controller = GetComponent<CharacterController>();
    }

    void Update()
    {
        // Check if the player is colliding with anything (Character Controller)
        if (controller.collisionFlags == CollisionFlags.None)
        {
            isColliding = false;
        }
        else
        {
            isColliding = true;
        }

        // Check if the player is standing on the ground
        if (isColliding && groundNormal != Vector3.zero)
        {
            onGround = true;
        }
        else
        {
            onGround = false;
        }
    }

    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        // Check for floor
        if (Vector3.Angle(transform.up, hit.normal) <= slopeLimit)
        {
            // Store floor object data
            ground = hit.gameObject;
            // Store ground surface normal
            groundNormal = Vector3.Normalize(hit.normal);
        }
        else
        {
            // reset variables
            ground = null;
            groundNormal = Vector3.zero;
        }
    }

slopeLimit is a static value. Additionally, getting the ground object isn't actually necessary atm, but I plan on using it later.

Edit:
Currently I'm using controller.collisionFlags to detect when the player is colliding with something and haven't been able to find a similar alternative. Setting the isColliding bool to true using Rigidbody.OnCollisionStay would be simple, but setting it to false without use of another void function seems difficult. is that possible at all?

sentences: Can SpriteBatch be used to fill a polygon with a texture? I basically need to fill a texture into a polygon using the SpriteBatch. I've done some research but couldn't find anything useful except polygon triangulation method, which works well only with convex polygons (without diving into super math which is definitely not something I'm pretty good at). Are there any solutions for filling in a polygon in a basic way? I of course need something dynamic (I'll have a map editor that you can define polygons, and the game will render them (and collision detection will also use them but that's off topic), basically I can't accept solutions like "pre-calculated" bitmaps or anything like that. I need to draw a polygon with the segments provided, to the screen, using the SpriteBatch.

sentences:
Increment grid by rotation I'm currently working on a grid for snapping objects side by side. My current script is working fine, but only for game objects which haven't been rotated.

Here is an example video of the problem:

https://vid.me/jN6D

The cube at the right has a rotation of Vector3.zero, the left one has been rotated on the Y axis.

As you can see snapping works perfectly for the right one, but at 0:15 you can see that the snapping doesn't work well for the rotated cube, that's because I've currently no idea how I can add the rotation in my current script.

Here is a snippet of the most important part of code I'm currently using to calculate the grid:

Vector3 pivotToPoint = hit.point - nearestGameObject.transform.position;

float positionX = nearestGameObject.transform.position.x +
                  Mathf.Round(pivotToPoint.x / nearestGameObject.transform.renderer.bounds.size.x) *
                  nearestGameObject.transform.renderer.bounds.size.x;

float positionZ = nearestGameObject.transform.position.z +
                  Mathf.Round(pivotToPoint.z / nearestGameObject.transform.renderer.bounds.size.z) *
                  nearestGameObject.transform.renderer.bounds.size.z;

Vector3 origin = new Vector3(positionX, 0, positionZ) + Vector3.up * 100;

if (Physics.Raycast(origin, Vector3.down, out hit, Mathf.Infinity, layerMask)) {
    previewGameObject.transform.position = new Vector3(positionX, hit.point.y, positionZ);

    previewGameObject.transform.rotation = nearestGameObject.transform.rotation;
}

Maybe some of you guys have an idea how to solve this, it's driving me crazy.

p.s. Here is some guy with a similar problem, but I'm very lost when in comes to adding the solution into my code.

sentences:
Timers: check in game loop, or run independently? Specifically talking in the context of JavaScript game development.
For example, I can use the language specific timeout mechanism:
// Timeout is not tied to game loop at all, tied to language specific timer loop
setTimeout(() => player.age += 1, 1000);

Or I can create some custom game timer
game.createFixedDelayTimer(() => player.age += 1, 1000);

// In update loop
let lastTimerCheckTime = Date.now();
function update(game) {
  checkTimers(game, lastTimerCheckTime); // Fire timer if specified delay has passed.
  lastTimerCheckTime = Date.now();
}

The disadvantage to approach 2 is that the checks are less granular... but maybe it's still desirable so that game behavior is deterministic?

sentences:
Finding specific coordinates on a rotating line I'm currently working on a mobile game which mainly consists of a rotating line and a ball. The line rotates 0.500 degrees clockwise around its center every frame. The ball is at first positioned in the centre of the line. When the user touches the screen, the ball should move along the line and when the user stops touching the screen the ball should move in the opposite direction.

I have the line rotation, and the coordinates of the line(top-left corner).

I need to find the position of the ball if the ball moves along the line at a speed of 5.

sentences:
How do I create this underwater effect with Cocos2D? http://vimeo.com/2461697

Hi everyone, I'm trying to create an effect like this, the underwater effect (water distortion). I've looked around and I've seen references to "water caustics" but I'm not sure how to create this in Cocos2d or if it's done with obj-c only.

Thanks.

sentences:
Custom sampling points for anti-aliasing I'm trying to write an anti-aliasing shader in HLSL, but I can't find any way to rasterize at a custom point. (in between pixels on the screen, but not orderly like supersampling)

Is there any way to do this completely in HLSL, or would it require external c++ code?

Currently I am creating a 2nd camera to rasterize my geometry on a screen of 1x1 at this point, and editing it from there, but it feels like this isn't the best way to do this.

sentences:
Progression in a Sandbox Game (to xp or not to xp) I'd like to know the strengths and weaknesses of different progression methods through a game (or a part of a game), where they're suited best, and where they should never appear. I have several subsystems a player can progress through in a project I'm working on and I'd like to be able to work out if any of them would benefit from tallying xp. [Not sure why this is on hold, I'm asking about the concrete merits of things not simply asking everyone for their favourite??]

At the moment the player's character becomes more powerful by equipping better and better gear as they progress through randgen levels however they like, but are given clear indication that going in a particular direction will increase difficulty and the quality of items. I'm not sure in what circumstances I would add in xp for fighting monsters, or which I'd have the monsters drop good gear, or parts to make good gear out of. On top of that I have a magic system and a crafting system that I'm considering progressing though with xp but I wouldn't want to implement it if the side effects don't suit the rest of the game.

As far as I know games usually progress in the following ways, often in combination:

Level by Level: Like in old school Mario, you go through a sequence of levels which become more difficult and require you to master the basic techniques of game play.
Power by Power: You gain new abilities which makes it possible to access more and more difficult content. Metroid comes to mind for this.
Xp Growth: Your stats increase every level so you can fight the harder mobs in further content. You may or may not be able to choose where your stats go.
Xp Talent Tree: You get points to put into learning new skills, often from increasingly better pools of skills.
Item by Item: Equipment determines what content can be accessed next, either because the item unlocks something (including methods of transportation), or it increases player abilities such that they can survive certain areas. The distinct thing about items is that they can be removed from a player at pretty much any time. A grappling hook that can't be removed is a Power, not an Item.
Quest by Quest: Like Level by Level, only what triggers the newer content isn't getting to the end of a stage, it's the completing the requirements of a quest (explicitly stated or not). Zelda would be an example of a game that does both LbyL and QbyQ. Each dungeon is a level and between levels you have to do a bunch of little quests to unlock the next level.
Score: You just rack up points like in pinball, it doesn't really have an effect on the game.

If you have a clear idea of the underlying purpose of these or others, I'd like to hear it! At the moment I only know that these systems exist, but only vaguely what they're for.

As an aside, I'm also interested in your thoughts on how to display progression to a player. When is it best to give them numbers, if ever? Are visual/demonstrable displays preferred for certain things? What is the function of doing it one way or another?

sentences: How to draw a plane equivalent to a given btStaticPlaneShape using OpenGL With all other shapes in bullet, you can easily get the transform from the MotionState which holds the origin, the scale, and the rotation. There seems to be no way to get the same information about a btStaticPlaneShape. How can I get this information, so that I can build a rectangle with 4 vertices that will act as a representation in OpenGL?

sentences:
Make a child sprite match the layer ordering of its parent I have my project settings set up to order the sprites' visual layering based on their y position.
If I add a sword as a child to my character, the sword won't have the same order as the parent so things can look like
Sword --> enemy--> player

instead of
enemy --> sword --> player

(because I want the sword to be in front of the character)
I thought of setting the pivot point of the sword sprite so when nested inside the parent sprite, it would be around the same height as the player's pivot point so they would have the same order. I feel like this wouldn't be the best solution because when I will animate the sword to attack, I wont be able to rotate it around the position I want.....unless I make it the child of an empty object?
How can I solve this issue?

sentences:
OpenGLHow to fit a texture to a curved plane with GL_CLAMP I'm trying to fit a texture on a curved plane made from some triangles  with GL_CLAMP, because GL_CLAMP_TO_EDGE is not available in my OpenGL version, but the texture (512 x 512 pixels) appears so small when render:
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); // If the u,v coordinates overflow the range 0,1 the image is repeated
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // The magnification function ("linear" produces better results)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); //The minifying function

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE,  GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);

I load the texture like this:
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECR );
glTexImage2D(GL_TEXTURE_2D, 0, 4, infoheader.biWidth, infoheader.biHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, l_texture);
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, infoheader.biWidth, infoheader.biHeight, GL_RGBA, GL_UNSIGNED_BYTE, l_texture);

sentences:
How do I wrap textures inside shader GLSL? I'm trying out GLSL and one of the problems I'm facing is wrapping a random texture sampler in the shader. Searching for answers on the web first, this leads me to using these:

glTexParameter()
GL_TEXTURE_WRAP_S GL_REPEAT
GL_TEXTURE_WRAP_T GL_REPEAT

I'm not sure where to put this or how to use it. I'm using a custom engine for this shader and I would assume I could wrap the texture in the shader.

My main concern on this is my final output render having left and bottom artifacts. I got some previous advise it has to do with wrapping a random texture that is used for noise if that helps in my case.

sentences:
Is there any way to change the layering of objects in Actionscript 3 without altering the run order? I'm making a simple platformer in Adobe Animate, and I need the player to be layered in front of the stage because of a gimmick in the game. Unfortunately, whenever I change the layering order, it also seems to change the order that AS3 runs the instances.

Is there any way to change the layering order without affecting the instance order, or vice-versa?

I'm only just starting with programming, so please bear in mind that I probably won't understand many of the technical terms.

Thanks in advance!

sentences:
Textures on top of other textures when using VBOs I'm currently making a cube style game. With chunks being drawn with VBOs. I'd like to know if there is a way to create an overlay texture on top of the existing texture without the need to rebuild the VBO. This is required to show activity in a cube (think of Minecraft when destroying a block and the little cracks start spreading).

I believe these are called "decals" but I've not found how to use them with VBOs. So how do I draw decals on OpenGL VBO drawn cubes?

sentences:
Facebook Canvas (web) Game for Desktop & Mobile Browsers as the title suggests - I am about to develop a game for FB canvas.
Will the game support mobile and desktop or do I have to create two different project/game setups for this?

thanks

sentences:
How can I shoot an arrow if I know the shot power and target? I am trying to shoot an arrow at a target with a 100% success rate.  Given the initial force applied to the arrow, the gravity, the location of the archer, and the location of the target, how can I do this in Unity?

I have read How can I find a projectile's launch angle?, and it contains the equation I am using:

However, this is only accurate when I am at the maximum distance from the object given its power.  (Above the maximum distance means that the arrow cannot reach the target.)  The closer I move to the target, the less accurate the arrow shot becomes, as it travels past the target.  The angle is increased resulting in the arrow traveling a shorter distance as I'd expect, but it is not increased by enough.

The script spawns an arrow (a simple sphere) and launches it towards a target.  It fires once per second, but the closer to the target the archer is, the more inaccurate the arrow is.  The case of the archer being too far from the arrow is not handled, but that is not my concern right now.

using UnityEngine;
using System.Collections;

public class Archer : MonoBehaviour
{
    public GameObject arrow; //Simple 3D Sphere
    public GameObject target; //Simple 3D Cube
    public float power = 25.0f;
    public Vector3 aim;

    private void Start()
    {
        StartCoroutine(ShootArrows());
    }

    private IEnumerator ShootArrows()
    {
        while (true)
        {
            yield return new WaitForSeconds(1.0f);
            Vector3 spawnPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);
            GameObject arrowInstance = Instantiate(arrow, spawnPosition, Quaternion.identity) as GameObject;
            arrowInstance.GetComponent<Rigidbody>().AddForce(Aim() * power, ForceMode.VelocityChange);
        }
    }

    private Vector3 Aim()
    {
        float xAim = target.transform.position.x - transform.position.x;
        float yAim = Mathf.Rad2Deg * Mathf.Atan(((Mathf.Pow(power, 2) + Mathf.Sqrt((Mathf.Pow(power, 4) - (-Physics.gravity.y) * (-Physics.gravity.y * Mathf.Pow(HorizontalDistance(), 2) + 2 * VerticalDistance() * Mathf.Pow(power, 2))))) / -Physics.gravity.y * HorizontalDistance()));
        float zAim = target.transform.position.z - transform.position.z;
        Vector3 aim = new Vector3(xAim, yAim, zAim).normalized;
        return aim;
    }

    private float HorizontalDistance()
    {
        float xDistance = target.transform.position.x - transform.position.x;
        float zDistance = target.transform.position.z - transform.position.z;
        float distance = Mathf.Sqrt(Mathf.Pow(xDistance, 2) + Mathf.Pow(zDistance, 2));
        return distance;
    }

    private float VerticalDistance()
    {
        return Mathf.Abs(target.transform.position.y - transform.position.y);
    }
}

My best guess is that I am using the equation correctly, but I am plugging the angle into Unity wrong.  Why is my script giving me inaccurate results?

sentences:
How do I rotate the Camera around the player by Keypress in Unity? I want to rotate the camera around the player by pressing E and Q but it doesnt rotates around the player. I tried RotateAround but didnt worked.

Code:

public Transform player;
public float smoothSpeed = 0.125f;
public float rotateSpeed;
public Vector3 offset;
private Vector3 velocity = Vector3.zero;

void LateUpdate ()
{
    transform.position = Vector3.SmoothDamp(transform.position, player.position + offset, ref velocity, smoothSpeed * Time.deltaTime);
}

void Update()
{
    if(Input.GetKey (KeyCode.E))
    {
        transform.RotateAround(player.position, Vector3.up, rotateSpeed * Time.deltaTime);
    }

    if(Input.GetKey (KeyCode.Q))
    {
        transform.RotateAround(player.position, -Vector3.up, rotateSpeed * Time.deltaTime);
    }
}

}

sentences:
How to march tiles together like in Terraria? I've been trying to get tile marching to work like in Terraria, and I got something to work. I don't think it's actually very good way of doing this, so I'm wondering what would be really the main way of doing this.

Here's a picture of what I want to accomplish:

As you can see, this really does the thing that I want, but it's so horrible looking and it'd be a pain to extend for different types of tiles.

Here is my code for this. I coded this as a test, so my full game would use tile classes etc.

for x, tile in enumerate(row):
    if tile:
        try:
            air = row[x + 1]
        except Exception:
            pass
        else:
            if not air:
                if not LEVEL[y - 1][x]:
                    tile = 3
                else:
                    tile = 6
        air = row[x - 1]
        if not air:
            if not LEVEL[y - 1][x]:
                if tile == 3:
                    tile = 5
                else:
                    tile = 4
            else:
                if tile == 6:
                    tile = 8
                else:
                    tile = 7
        LEVEL[y][x] = tile
for y, row in enumerate(LEVEL):
    for x, tile in enumerate(row):
        if LEVEL[y - 1][x] in (6, 3, 14):
            try:
            pos = LEVEL[y][x + 1]
        except Exception as e:
            print(e)
        else:
            if pos in (2, 3):
                LEVEL[y][x] = 11
    if LEVEL[y - 1][x] in (7, 4, 15):
        pos = LEVEL[y][x - 1]
        if pos in (2, 4):
            LEVEL[y][x] = 12
    if LEVEL[y - 1][x] in (5, 8):
        if LEVEL[y][x] == 1:
            LEVEL[y][x] = 13
    if LEVEL[y][x] == 6:
        if LEVEL[y][x - 1] in (2, 4):
            LEVEL[y][x] = 14
    if LEVEL[y][x] == 7:
        try:
            tile = LEVEL[y][x + 1]
        except Exception as e:
            print(e)
        if tile in (2, 3):
            LEVEL[y][x] = 15

The basic idea behind this is just to look for some air and dirt, and set the tiles image from those.

Basically then when I'm drawing this I just take the value at a coord and blit the corresponding image to the screen.

So how would I go about making this as readable and easily extendable as possible? Does anyone know how Terraria handles this?

sentences:
Tiled based pathfinding in a 1- or 2-dimensional array As far as I know all tile based map editors export a JSON object containing one dimensional arrays. While most pathfinding libraries/tutorials are only provided for two dimensional arrays.

Also if for example I would like to do pathfinding in this one dimensional array and this array is huge i'm geussing this would cause performance issues.

So why is it that most tile based map editors output a one dimensional and how should I handle those regarding pathfinding?

example tile editor:

http://elias-schuett.de/git/Online-Tile-Map-Editor/#

Just google pathfinding to find all the two dimensional patfhfinding tutorials

sentences:
MissingComponentException: There is no 'TextMesh' attached to the "Can" game object, but a script is trying to access it When I run my program I keep getting: MissingComponentException: There is no 'TextMesh' attached to the "Can" game object, but a script is trying to access it.Even though I have attached it as you can see:

In the script I am trying to edit the text of the Text Mesh like this¨:

private int count;
public TextMesh countText;

// Use this for initialization
void Start () {

    count = 0;
    counterText = gameObject.GetComponent<TextMesh>();
    counterText.text = "Count: " + count.ToString();

}

What I want is to count the cans that have been shot, so what I do next is:

  void OnCollisionEnter(Collider other)
{
    if (other.gameObject.CompareTag("Can"))
    {
        other.gameObject.SetActive(false);
        count = count + 1;
        counterText.text = "Count: " + count.ToString();
    }
}

sentences:
OnInspectorGUI Custom properties are not displayed in the right order I basically made a lot of research and wasn´t able to find any solution.
So my problem: I´ve made some variables disappear/appear depending on an enum with a custom editor script. But if they appear they do not appear at the position where the normal editor variables would appear

override public void OnInspectorGUI()
{
    base.OnInspectorGUI();
    GunCard myScript = target as GunCard;

    EditorGUI.indentLevel++;

    switch (myScript.aimingControlType)
    {
        case AimingControlType.Manual:
            myScript.hasAimAssistance = EditorGUILayout.Toggle("Has aim assistance", myScript.hasAimAssistance);
            break;
        case AimingControlType.AutoTargeting:
            myScript.targetPreference = (TargetTypes)EditorGUILayout.EnumPopup("Target preference", myScript.targetPreference);
            myScript.requiresLineOfSight = EditorGUILayout.Toggle("Requires line of sight", myScript.requiresLineOfSight);
            myScript.requiresPossibleTargetOnScreen = EditorGUILayout.Toggle("requires possible target on screen", myScript.requiresPossibleTargetOnScreen);
            break;
    }
    EditorGUI.indentLevel--;
}

Here is where they appear:

That are the raw variables in the scriptable object

[Header("Aiming Controls")]
public AimingControlType aimingControlType;

[HideInInspector] public bool hasAimAssistance;
[HideInInspector] public bool requiresLineOfSight;                //TODO: implement -> requires 180
[HideInInspector] public bool requiresPossibleTargetOnScreen;     //TODO: implement -> requires 180
[HideInInspector] public TargetTypes targetPreference;
[HideInInspector] public bool isAutoShootWhenAimOnTarget;

I know I´m basically adding new variables to the inspector in my editor Script but it would be really useful to order them. Is there a way to do that?

P.S sorry for the funny typo in the picture :)

sentences:
16-bit PNGs in Slick2D I'm working on a project and I'm using some 3rd party sprites just to get it off the ground; recently I've come into a hitch. Slick2D doesn't seem to want to load my images. That is, it will warn me that images are the wrong bit-depth. All the images are in 16-bit PNG form (PNG is required for transparency). Is there any way I can disable the warning (being the bad guy programmer (the console print for each individual load REALLY SLOWS DOWN the image)) or is there another solution?

I was thinking about converting all images (using imagemagick) to .gif (with an alpha channel). Would there be any loss in quality between formats?

EDIT: I tried using imagemagick but some of the sprites use pure black so I can't do that without wrecking the image.

EDIT2: using "identify" on any of the images show them as being 8-bit.. but Slick2D won't load them. What the hell? D:

EDIT3: Issue solved (ish). If you are googling this then just disable the java png loader from slick by sticking this somewhere in your code (like the main method):

System.setProperty("org.newdawn.slick.pngloader", "false");

sentences:
Correct way to handle A* no pathing? I'm developing a little game for fun and I wrote a pathfinding system based on the A* algorithm. What is the best or correct way to deal with unavailable paths?

A* by default will go through every node on the grid until it either finds the target node or it has exhausted all of them. This can become problematic if certain areas are cut off into "islands" and A* tries to find a path there.

The obvious solution might be to flood fill regions and check in advance, but the problem is that I plan for my world to be a bit dynamic - new areas might appear, some areas which are accessable at one point might not be later, etc.

Another solution I've read about is that I can limit the amount of nodes it's allowed to search before it gives up, but this sounds a bit hacky and something I'd like to avoid if possible if there are better ways, because it means that there could be a very long and complex path to the target but it'll still not find it just because of this limit.

So how should I do it? I appreciate any help here, fellow devs!

sentences: When should I use auto-managed buffers in LWJGL 3? LWJGL3 has two methods of creating buffers that I know of: Auto-managed buffers that clean up the buffers automatically using the MemoryStack class, and manually managed buffers that must be manually cleaned, are are created with the MemoryUtil class. What I am wondering is should I always use MemoryStack, or are there certain times when one method would be more efficient than the other?

sentences:
How can I use a Seekbar as a brightness slider? I am using the GLSurfaceView Renderer. I want changes to a seek bar's progress to increase the brightness of a GLSurfaceView proportionally.

How do I apply a color matrix to a GLSurface view? Is there a better way?

sentences:
Direct3d Techniques and Windows 8 Under Windows 8, what is the alternative to this code:

technique11 Light0Tex
{
    pass P0
    {
        ...

technique11 Light1Tex
{
    pass P0
    {
        ...

And:

Light1Tech    = mFX->GetTechniqueByName("Light1");

...

Light1Tech->GetPassByIndex(p)->Apply(0, md3dImmediateContext);

sentences:
How to rotate an object so it stands correctly (back always facing the camera) I have the following scene:

And I have two 3D vectors, the camera position, and the focus position. The focus vector is always behind the monster. I know how to rotate the camera around the focus with the help of my mouse, but the monster is always facing the same direction, and I'd like to change that!

I'd like it to work almost as in World of Warcraft; while I'm standing still I can move the camera around freely, but as soon as I move, the monster should change the direction according to the camera.position >>> focus vector. Also, I need to make it move in that direction, I guess I could have a 2D vector called speed, which I should change accordingly (it would look like a rotating radius of a circle I guess).

How do I do this?

For reference, I'm working in Three.js, and this is the code with which I rotate the camera:

onDocumentMouseDown = function(event)
{
    event.preventDefault();

    game.isMouseDown = true;

    game.onMouseDownTheta = game.theta;
    game.onMouseDownPhi = game.phi;
    game.onMouseDownPosition.x = event.clientX;
    game.onMouseDownPosition.y = event.clientY;
}

onDocumentMouseMove = function(event)
{
    event.preventDefault();

    if (game.isMouseDown)
    {
        game.theta = -((event.clientX - game.onMouseDownPosition.x) * 0.5) + game.onMouseDownTheta;
        game.phi = ((event.clientY - game.onMouseDownPosition.y) * 0.5) + game.onMouseDownPhi;
        game.phi = Math.min(160, Math.max(20, game.phi));

        game.cameraBuff.x = game.radious * Math.sin(game.theta * Math.PI / 360 ) * Math.cos( game.phi * Math.PI / 360 );
        game.cameraBuff.y = game.radious * Math.sin(game.phi * Math.PI / 360 );
        game.cameraBuff.z = game.radious * Math.cos(game.theta * Math.PI / 360 ) * Math.cos( game.phi * Math.PI / 360 );
    }
}

And at render time I do this:

self.camera.position.x += self.cameraBuff.x;
self.camera.position.y += self.cameraBuff.y;
self.camera.position.z += self.cameraBuff.z;

self.camera.lookAt(self.focus);
self.renderer.render(self.scene, self.camera);

self.camera.position.x -= self.cameraBuff.x;
self.camera.position.y -= self.cameraBuff.y;
self.camera.position.z -= self.cameraBuff.z;

sentences:
How can I protect my save data from casual hacking? What options are there for saving game data in a secure manner? I'm interested in solutions specifically tailored for C++.

I'm looking for something that is fast and easy to use. I'm only concerned about storing simple information such as

Which levels are and are not unlocked
The user's score for each level

I'm curious again to know what's out there to use, any good libraries to use that give me nice, secure game data files that the average player can't mess with.

I just found this here which looks very nice, but it would be great to get some opinions on potential other libraries/options out there.

sentences: How does "Cut the Rope" do such realistic animation? "Cut the Rope" is so smooth and real life like, while some apps are very "bitmap" like.  How does "Cut the Rope" do such realistic animation?

sentences: Why are Mac versions of games larger in filesize than Windows versions? I have browsed many games mainly on itch.io and many developers offer a Mac version of their game along with the Windows version. The Mac version of all those games is significantly larger in file size than the Windows version. Why is that?

sentences:
Multiple lights shadows I'm trying to achieve multiple lights shadows. Currently my program works using only 1 spotlight as a light source that produces shadows. Well... I want to involve multiple lights to give a more realistic effect to my scene.

However, I'm facing a scenario which is a little bit unclear for me:

The steps I follow to create shadows is

a) Create FBO

b) Render scene from light's perspective using a depth texture attached to my FBO

c) Render the scene normally, using my texture from my FBO as a shadowmap texture in order to be able to sample it and creating finally shadows.
The steps I follow to create multiple shadows is

a) Create FBO1 and FBO2

b) Render scene from 1st light's perspective using a depth texture attached to my FBO1

c) Render the scene normally, using my texture from my FBO1 as a shadowmap texture in order to be able to sample it and creating finally shadows.

d) Render scene from 2nd light's perspective using a depth texture attached to my FBO2

e) Render the scene normally, using my texture from my FBO2 as a shadowmap texture in order to be able to sample it and creating finally shadows.

Now, the step 1) is pretty clear, works fine. When I manage to implement step 2), something happens: the shadows rendered will be the shadows of my last light (depending the order I call rendering methods). So in this case I get shadows only from my 2nd light.

If I reverse the order of calls (this order: a -> d -> e -> b -> c) and render first in my second FBO and then in my first FBO I get the shadows from my first light source. So basically I conclude: my shadows are not working simultaneously.

Is this the correct approach? (I've seen a solution which uses in fragment shader an array of shadowMaps, an array of lightSpace coordinates so this involves multiple uniforms... what do you think about this?)

Thanks

sentences:
How to move objects across a canvas with consistent speed on different screen resolutions? I am making a rhythm game in Unity. I have been using Transform.Translate for moving images on a canvas as the music notes. However, I cannot consistently use this method on different screen widths. The notes move the same amount each frame.
I want to use interpolation for my music notes. I want to have the notes reach the center of the canvas at the same time despite the width of the screen. How can I write such a script?

sentences:
Turning on Vertex Attribute Divisor With Instanced Rendering Renders Nothing When I render with glDrawArraysInstanced with the vertex attribute divisor set to zero, the triangle appears as expected. But when the divisor is set to any value other than zero, the triangle disappears. This is the code I am using to render:

static const u32 NUM_TRIANGLES = 1;
struct Vertex
{
    f32 x;
    f32 y;
 };
 static const Vertex g_triangles[NUM_TRIANGLES*3] =
 {
    {0.125f, 0.125f},{-0.125f,0.125f},{-0.125f,-0.125f},
 };
 glGenVertexArrays(1, &g_vao);
 glBindVertexArray(g_vao);

 glGenBuffers(1, &g_vbo);
 glBindBuffer(GL_ARRAY_BUFFER, g_vbo);
 glBufferData(GL_ARRAY_BUFFER, sizeof(g_triangles), nullptr,
             GL_DYNAMIC_DRAW);
 glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(g_triangles),
                reinterpret_cast<const void*>(&g_triangles));
 glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0,
                       reinterpret_cast<void*>(0));
 glEnableVertexAttribArray(0);
 glVertexAttribDivisor(0, 1); // Setting this to 0 renders the triangle

 // This is the draw call
 glDrawArraysInstanced(GL_TRIANGLES, 0, 3, NUM_TRIANGLES);

Here are my shaders:

#version 420 core
layout (location = 0) in vec2 v;
void main()
{
    gl_Position = vec4(v, 0.0f, 1.0f);
}

#version 420 core
out vec4 out_color;
void main()
{
    out_color = vec4(1.0f,0.0f,0.0f,1.0f);
}

My problem is similar to
OpenGL 2D instancing: glDrawArraysInstanced with a divisor renders nothing, but that question wasn't resolved.

sentences:
TCP vs. Reliable UDP? Sending Reliable Packets in Fast-paced Multiplayer Games? I'm currently working on a networking framework for Unity3D in order to simplify making multiplayer games. I'm using UDP for any kind of synchronisation and unimportant data.

My question is: how do I send reliable packets such as RPCs or object instantiation?
Should I use TCP for that or should I go about writing my own reliable protocol on top of UDP?

Thanks in advance!

sentences:
Gamemaker's xprevious is the same value as x... Same thing happens for the y variabbles So I'm making a tower defense game but for some reason the enemies (which are following a path) have the same xprevious value as their x value. The same is true for their y variables. This also happens when the enemy is not on a path. I double checked that I'm not modifying the x and y previous variables anywhere. Is this a bug in GameMaker?

Thanks,
Philip

sentences:
Are all referenced sprites loaded into memory for each object? I'm trying to understand how Unity works behind the scenes.  Let's say I have a GameObject that has a large number of sprites attached to it in an array (think a deck of cards).  Each GameObject represents 1 card.

For simplicity, each card has all the sprites for all the card faces.  So it has 52 sprites + 1 for the card back (all in a sprite sheet of course).

If I have all 52 cards placed in the world.  Does this mean I have 53*52=2756 sprites, or is there only one instance of each sprite that's being displayed (ie does it only use the resources of 52 active sprites)?

I guess what i'm asking is if I have a bunch of sprites attached to a GameObject, are they all instantiated when the object is created, or are they only created when they are actually attached to the sprite renderer?

Would it be more efficient to only attach the current cards value sprite (ie just the back and the face for the cards value)?

sentences:
Trying to make a 2D Spring 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?

sentences:
How can I prevent pinching and jagged edges when deforming joints in 3ds Max? I've rigged and skinned a character, but no matter how or how much I blend the weights, it doesn't look good:

Why does the weight map look pixelated? I don't get it. I've never been able to get past this point when animating. I don't think it's a model resolution issue, since as you can see in the picture, the model is quite detailed.

How can I prevent the indicated problems?

Here are some reference images of my wireframe and weight maps:

EDIT

After recreating a model entirely to try and have another go at this, Ive found that my new model is repeating the previous outcome. Here are some images

enter image description here

sentences:
How do "procedural" and "random" generation differ? To my understanding, everything that isn't directly created by a human is called "procedural". Procedural generation systems have different complexities and may consist of various algorithmic processes, some of which may be "random".

Some games explicitly refer to their systems as "random", while others call them "procedural", as if indicating a distinct difference.

Is there such a distinct difference? Where do you draw the line?

For example, here are contrasting examples of RPG loot generation:

Type A: Loot generation is ultimately left to chance, but it's based on a large intial factor of deterministic, specifically encoded knowledge.

Boss characters drop loot, which type is determined by the boss' characteristics (e.g. species, character class, elemental affinity, …) and additionally influenced by the player's play-style, to create more enjoyable gameplay: For example, more likely drop a fire-damage sword to a player who prefers fire-based melee attacks, along with gold.

Type B: Loot generation is almost completely random, based on minimal explicit knowledge.

Bosses have a randomised loot table (e.g. 1 legendary, 2 epics, 5 blues). If the roll is right to drop a legendary, random attributes are generated for that legendary, which may be high in value. Stuff like character attributes, player behaviour and such don't matter.

Both designs qualify as procedural by the initial definition, since their output is automatic, but Type A is significantly more sophisticated in crafting player experience.

Must an algorithm seem as if a person had designed its output by hand, to qualify as "procedural" rather than "random"?

sentences:
What are the typical day-to-day tasks of an entry level games programmer? What I would like to know is: What are the daily duties of a graduate programmer in the games industry workplace? Is it mostly coding, analysing, designing, or what?

Thank you.

P.S. I am in my second year of University at the moment and am working towards specialising in games programming, specifically gameplay, tools or UI programming.

sentences:
Why do loot drops contain (mostly) useless items? I was thinking about this and couldn't figure this out.  In Diablo you kill enemies and they drop random things.  But usually the drops are worthless to you relative to what you already have equipped.  Why bother building a drop system that gives you crappy drops?  Maybe I'm not communicating my question well so I'll provide an alternative implementation:

Instead of frequently dropping crappy items and rarely dropping good items, why not only rarely drop good items?

I guess that crappy items adds to the addictive-ness somehow, but I don't understand why.  Why is dropping crappy items part of the design?  What does that add?

Edit: FWIW, I have been referring to Diablo 2 as my reference, not D3.  But it's still interesting to see answers explaining why D2 was more addictive.

sentences: Why is my mouse disappearing at runtime? I'm using Unity 5.3.5f1 and every time I play my game in the editor, my mouse disappears. I really need to test some of my parameters in the inspector but I can't because the mouse is gone. How can I fix this, and if possible, make it permanent?

sentences: Is programming skill required for game development? I do not know how to program. Can I contribute in any way to game development?

sentences:
How can I simulate a "Hot Swap" betwen Audio Clips? I have a Unity project with 3 separate looping Audio Clips and a single Audio Source. Based on certain events, I swap between which of them are playing.

This works fine, but whenever I swap between Audio Clips, the AudioSource stops playing, and must be restarted... which means it starts over from the beginning.

As the Audio Clips are the same length, how should I handle the logic to pickup where the previous Clip last left off? Neither Unity's AudioClip nor AudioSource classes seem to have either a "PlayFromTime()" or "GetPercentPlayed()" method that would facilitate using a single Audio Source.

What's the expected way to handle such a scenario? Simultaneously "play" from 3 AudioSources at once, muting 2 of them and leaving the last the only one that is actually heard?

sentences:
Button onClick in a menu prefab doesn't work I don't seem to be able to make a reference to a Button inside a menu prefab.
My menu prefab consists of a panel and the panel has 4 buttons.
I added
public GameObject prefabMenu;

in my code and drag and dropped the prefab in the Unity Editor to it.
When my scene is starting (Start() method) I instantiate this prefab into a GameObject like this:
panelMenu = Instantiate(prefabMenu, canvas.transform);

after that I try to refer one of the buttons with this line and set an onClick listener:
btnResume = panelMenu.transform.Find("BtnResume").GetComponent<Button>();
btnResume.onClick.AddListener(() => Log.I("Working"));

The log method however doesn't not get called when I click on the button (I checked and the btnResume is not null).
I appreciate any help on this. Thank you.

sentences:
How does Unity's QualitySettings.masterTextureLimit work? I'm trying to get to the bottom of how masterTextureLimit works, but my results have been inconsistent so far.

I created a massive sprite (8192x8192), and I'd like to resize it at runtime to save performance. The idea is to start with large sprites and then resize based on the monitor's resolution. Here's what happens at different settings:

Texture import size 8192, masterTextureLimit 0, mipmaps off: ~2ms
Texture import size 8192, masterTextureLimit 0, mipmaps on: ~1.5ms
Texture import size 8192, masterTextureLimit 1, mipmaps on: ~1.5ms
Texture import size 4096, masterTextureLimit 0, mipmaps off: ~0.9ms
Texture import size 4096, masterTextureLimit 0, mipmaps on: ~0.9ms
Texture import size 4096, masterTextureLimit 1, mipmaps on: ~0.83ms

Looking at these results, I have a couple of questions:

If masterTextureLimit is supposed to halve the texture resolution, why did it not affect performance while setting texture size to 4096 did?
Why did turning mipmaps on improve performance at 8192 texture size but not at 4096? My camera is orthographic, and it's only 1 unit away from the sprite.

sentences: How to get our music into games? As a fairly unknown independent band, what is the best way to get our music into computer games? I'm not so much thinking about licensing issues, but more about what channels are available and how to get noticed by game devs that could be interested in our type of music.

sentences:
Implementing Turn based Combat Using Node js I am creating a browser game that allows players to fight monsters using Nodejs, Socket.io and Express. However I can't seem to figure out how to implement the turns of combat.

My train of thought and workflow is as follows:

The player declares an attack on a monster (Client makes a Post request.) -
Working
The server get's the player's stats as well as the monster's. - Working
The player selects his action and attacks, then it's the monster's turn and so on. - Can't figure this out

How would such a functionality be implemented?

sentences:
Why do mobile games have delays for certain actions? Many phone games restrict the number of actions you can take in a given amount of time. I don't get what is the purpose of this limitation. Is it only to force the player to buy additional turns? Some games don't even allow this for some turn "kinds" (like action A can be played again by spending real money while action B cannot be played again by spending money).

Another possible reason would be to limit the bandwidth usage to their server and make it more predictable over time, but I can't see phone games using so much data.

sentences:
Is it a legal thing to do to sell fabricated accounts of your game? For example, say I create an online mass multiplayer game with in-game purchasing system and with randomness factors as well (the point is that game accounts have actual value and there is a somehow proportional relationship with playing time plus the luck of the player and the account's value) and the game appears to become popular.

Is it legal to, for example, insert cheated accounts into the database (without even spend a second of legitimate playing) and sell those accounts with extremely high price?

sentences:
Is there any reason to use a "canvas" based approach to GUI in isometric games? When designing game engine GUI systems, I know a lot of game engines (notably Unity and Unreal) use a sort of "canvas" system. However, in an isometric game where the camera is already orthographic, this seems like it might be overkill. Everything is already dictated in terms of pixels, as is the case in an isometric game; I feel that there would be little need for such a "canvas", which seems to be the bridge between world space coordinates and screen space coordinates.

With the orthographic view, world space is more seamlessly joined with screen space, so wouldn't it be simpler to get the position of the camera, define a set of points (i.e. top-left, top-right, center, etc.) on a plane that is directly in front of the camera and render controls directly in front of the camera? Would there be any downsides to this method, or am I missing the point entirely?

sentences:
LibGDX How do I create a Shop? My game is fully working but now I want to make a shop so that the player can buy boosts or other useful stuff for the money the player has collected.

What is the best way of doing this kind of shops:

*The collected coins you have saved goes up/down in value when you buy something

*The item activates if bought.

Is this possible in libGDX and how can I start?

sentences:
Rotation Continuity help First the issue im having: Basically its the fact that the angles of a circle aren't continuous, they rise from 0 to 2pi then immediately fall back to 0.

I want to make a game where the player controls a tank and ive got a tank drive working but i want to implement a "Directional Drive" where the player can push a joy stick(XBOX360) in a certain direction and the tank will move forward and turn towards this direction.
heres the code i have to do that:

if (Math.Abs(controllerCOORD.Y) > Deadzone || Math.Abs(controllerCOORD.X) > Deadzone)
        {
            decimal intended_angle = (decimal)Math.Atan2(controllerCOORD.X, controllerCOORD.Y);

            double correction = (double)Decimal.Round((intended_angle - (decimal)this.BaseAngle_Rad), 1, MidpointRounding.AwayFromZero);

            this.BaseAngle_Rad += (correction / demultiplier_rot);

            this._x_pos += ((float)Math.Sin(this.BaseAngle_Rad) * multiplier_pos); //x component vector of movement
            this._y_pos -= ((float)Math.Cos(this.BaseAngle_Rad) * multiplier_pos); //y component vector of movement
        }

Unfortunately with this code, when the player pushed the joystick downwards(0,1), the angle it calculates approches pi from the right side and negative pi from the left side causing it to make a full turn in the wrong direction instead of like a few degrees in the correct direction.

How do i make the rotation continuous all the way around?
Ive already found these two questions on here but neither is helping me:

360+ degree rotation skips back to 0 degrees when using Math.Atan2(y, x)

Turning a sprite such that it rotates in the direction that's most efficient

Thanks

sentences:
Gradle generated LibGDX project does not work in NetBeans I have to do rework of Worms (game) and I've chosen LibGDX. So, I've installed Gradle and generated a new project in LibGDX app - as they have in the documentation. But when I'm trying to load it as a project in NetBeans, it does not work. NetBeans sees it as a pure folder, not a project folder. I've also tried to manually create a project and paste there just the main that was generated and as expected, I've got errors with the imports (it does not know those imports).

What do I have to do? Thanks for any advices.

sentences:
How to Sort Shoebox frames by order? I ve been playing with ShoeBox lately and when trying to make a frame sheet i see that they don't appear alphabetically (frame_1 , frame_2 , etc). But they appear by best fitting. In Texture-Packer you can sort it by name but i cant see that option in ShoeBox.

How can i do this?
Thanks in advance

sentences:
Sprites with same position rendered in different places on screen In LibGDX I have few sprites that all have set position (0,0). So in theory they all should render in one place on top of each other but what ends up happening is that all the sprites are being rendered in different spot on screen. For all sprites objects all I do is:

Sprite sprite = new Sprite(new Texture("texture.png"));
sprite.setOriginCenter();
sprite.setScale(1/PPM);

And then when rendering it:

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

And here is what I get:

rocket sprite is in completely different place than fire sprite and some other sprites I couldn't even find. I marked "real" 0,0 point with yellow circle.
So why are does sprites in different spots? I've heard that it could be because of scaling but since I am setting sprite's origin to center it shouldn't be a problem, right?

sentences:
How do I make collision detection more effective? In the game I am developing, there are 220 circles that are not moving. One of the circles is moving and in every update, it iterates through an ArrayList that contains all the circles and check if it collides with them and if it does, then its velocity is set to 0.

Sometimes, it works perfectly. However,most of the time, when the moving circle collides with another circle, it stops late sometimes when the ball is already inside the other circle. How can I deal with this?

I am using LibGDX with Java.

sentences:
Another way of writing 2D arrays on Game Maker Studio? I'm making a map in an array, something like this :

mapa[23,26]=4;mapa[25,28]=3;mapa[21,28]=3;mapa[22,30]=3;mapa[24,30]=0;
mapa[22,27]=5;mapa[23,27]=0;mapa[24,27]=0;
mapa[22,28]=1;mapa[23,28]=0;mapa[24,28]=0;
mapa[22,29]=0;mapa[23,29]=0;mapa[24,29]=0;
mapa[23,33]=0; mapa[23,32]=0; mapa[23,31]=0;mapa[23,30]=0;

This is tedious. In other languages 2d arrays can be written like :

int[][] myArray = {  {0, 1, 2, 3},
                     {3, 2, 1, 0},
                     {3, 5, 6, 1},
                     {3, 8, 3, 4}  };

Can I write in Game Maker Studio 2Darrays like this?

sentences:
Positioning 2D (non-UI system) game objects As an old Flash dev I'm slightly confused about how you position game objects on the screen in Unity since game objects have no width or height (only a scale).

Let's say I have a container gameobject that has several child game objects with sprite renderers representing tiles on them. If I set the container to x0, y0, the whole tile layout will extend from the screen center upwards and to the right.

What are the commonly used ways to position the game object so that it would be centered on the screen? I could calculate the width/height of my container but that would still not be very useful because the x/y coordinates work in a different scale than pixel (right?). E.g. my test screen is 640x1024 and to center my container (while running in the editor) I'd have to set x/y to -4.5. How does that make any sense?

Of course Unity's UI system would be a solution but I don't want to create the playfield with the UI system.

sentences:
Google leaderboards, up to a maximum of 70? I see in the doc that the limit for the number of leaderboards on Google Play Services is 70. However, I am able to create more than 70 leaderboards and they are all working when I test my app. Is this limit still up to date? Does this mean that if I publish my game some of the leaderboards will be deactivated or something?
Thank you in advance if you know the answer. I just want to make sure of what I can expect for when I publish my game.

sentences:
How to use the Object parameter in UInputComponent.BindAction? What is the purpose of the Object parameter here?

UInputComponent.BindAction(..., UserClass* Object, ...)

What information should I pass here?

sentences:
Representing a world in memory I'm attempting to write a chunk based map system for a game, where as the player moves around chunks are loaded/unloaded, so that the program doesn't run out of memory by having the whole map in memory.

I have this part mostly working, however I've hit a wall regarding how to represent the contents of each chunk in memory because of my so far limited understanding of OOP languages.

The design I have currently has a ChunkManager class that uses a .NET List type to store instances of Chunk classes. The "chunks" consist of "blocks". It's similar to a Minecraft style game.

Inside the Chunk classes, I have some information such as the chunk's X/Y coordinate etc, and I also have a three dimensional array of Block objects. (Three dimensional because I need XYZ values)

Here's the problem:

The Block class has some basic properties, and I had planned on making different types of blocks inherit from this "base" class. So for example, I would have "StoneBlock", "WaterBlock" etc.

So because I have blocks of many different types, I don't know how I would create an array with different object types in each cell.

This is how I currently have the three dimensional array declared in my Chunk class:

private Block[][][] ArrayOfBlocks;

But obviously this will only accept Block objects, not any of the other classes that inherit from Block.

How would I go about creating this? Or am I doing it completely wrong and there's a better way?

sentences:
Understanding Screen Position Node in Unity Shader Graph I'm struggling to understand what exactly the Screen Position node outputs in Unity's Shader Graph.
I'm using the screen position with scene depth to calculate the distance between two objects.
Every tutorial I saw (like Brackey's forcefield one) is using the alpha channel of the Screen Position output:

I read that the Screen Position node outputs the mesh vertex screen positions.

Does it means the 2D position on the screen projection?
Or the vertex 3D position from the eye space?
And more importantly, what is exactly the apha channel of this output? (I have the feeling this is related to the "clip space W component" in the documentation)

sentences:
Why is it difficult to port games from consoles to PC? PC ports of console games often come out a month or two later. Why is this?

Games are written in languages that compile on PCs too, so the game logic should compile without issue. What's holding them back then? Is it rendering code or what?

sentences:
Texture Not Rendering in C++ SDL OpenGL(glut) I don't understand why my texture("texture.bmp"), is not showing on the screen. Please help me.

The whole drawing function:

///HERE EVERYTHING IS BEING RENDERED
void Main::display(){

    int startTime = GetTickCount();

    ///BACKGROUND COLOR
    glClearColor(0.3f, 0.3f, 2.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    ///LOAD THE IDENTITY MATRIX FOR THE DRAWING
    glLoadIdentity();

    ///SO EVERYTHING HAS THE CORRECT SIZE
    glTranslatef(0.0f, 0.0f, -5.0f);

    ///CAMERA MOVEMENT
    glTranslatef(cameraX, 0.0f, 0.0f);

    ///THE SUN
    glBegin(GL_QUADS);
        glColor3f(1.0f,1.0f,0.0f);

        glVertex2f(-3.0f, 2.0f); // The bottom left corner
        glVertex2f(-3.0f, 2.5f); // The top left corner
        glVertex2f(-2.5f, 2.5f); // The top right corner
        glVertex2f(-2.5f, 2.0f); // The bottom right corner
    glEnd();

    ///THE GROUND
    glBegin(GL_QUADS);
        glColor3f(0.5f,2.0f,0.5f);

        glVertex2f(-20.0f,-4.0f);
        glVertex2f(-20.0f,-1.0f);
        glVertex2f(130.0f,-1.0f);
        glVertex2f(130.0f,-4.0f);

        glColor3f(0.0f,1.0f,0.0f);

        for(float i = 0.0f ; i < 100.0f ; i += 5.0f){
            glVertex2f(i,-1.0f);
            glVertex2f(i,ranFloat[static_cast<int>(i-4.0f)]);
            glVertex2f(i+1.0f,ranFloat[static_cast<int>(i-4.0f)]);
            glVertex2f(i+1.0f,-1.0f);
        }
    glEnd();

    ///THE GRASS
    glBegin(GL_QUADS);
        glColor3f(0.0f,0.5f,0.0f);

        glVertex2f(-20.0f,-1.2f);
        glVertex2f(-20.0f,-1.0f);
        glVertex2f(130.0f,-1.0f);
        glVertex2f(130.0f,-1.2f);
    glEnd();

    ///THE PLAYER
    glTranslatef(playerX,playerY,0.0f);
    glBegin(GL_QUADS);
        glColor3f(1.0f,0.0f,0.0f);

        glVertex2f(-3.0f,-1.0f);
        glVertex2f(-3.0f,0.0f);
        glVertex2f(-2.8f,0.0f);
        glVertex2f(-2.8f,-1.0f);
    glEnd();

    ///TEXTUREEEEEEEEEEEEEEEEEEEEEE
    glBindTexture(GL_TEXTURE_2D,texture);
    glEnable(GL_TEXTURE_2D);

    int X = 0;
    int Y = 0;
    int Width = 1;
    int Height = 1;

    glBegin(GL_QUADS);
        glTexCoord2f(0, 0); glVertex3f(X, Y, 0);
        glTexCoord2f(0, 1); glVertex3f(X + Width, Y, 0);
        glTexCoord2f(1, 1); glVertex3f(X + Width, Y + Height, 0);
        glTexCoord2f(1, 0); glVertex3f(X, Y + Height, 0);
    glEnd();
    glDisable(GL_TEXTURE_2D);

    ///CLOUDS
    glBegin(GL_QUADS);
        glColor3f(1.0f,1.0f,1.0f);
        for(float i = 0.0f ; i < 100.0f ; i += 5.0f){
            glVertex2f(i,3.0f);
            glVertex2f(i,4.0f);
            glVertex2f(i+4.0f,3.0f);
            glVertex2f(i+4.0f,4.0f);
        }
    glEnd();

    if(Input::flying){
        Input::returnFly(0.007f);
    }

    elapsedMS = GetTickCount() - startTime; // Time since start of loop
    //std::cout << "FPS: " << elapsedMS << std::endl;

    ///THE ACTUAL MOVEMENT
    playerY += playerFly;//*elapsedMS;
    playerX += cameraSpeed*-1;//*elapsedMS;
    cameraX += cameraSpeed;//*elapsedMS;

    ///SWAP THE BUFFERS FOR SMOOTH RENDERING
    glutSwapBuffers();
  }

The rest of my code has nothing to do with the texture loading. The loading is not the problem, because I didn't get any errors.

sentences:
Need material for character anatomy in a 2D game. Spartan Like, See Picture I'm creating my art for an 2d based IOS game. I know some basic anatomy as you can see by the picture but I have no idea how I will make draw the pics for animation of the character walking, attacking with his sword and protecting himself with shield.

Is there any anatomy reference for 2d game out there, book or anything else?

for your information, I did try to find but all of stuff I found are very amateur and incomplete

The picture was my attempt of creating a example of the character walking, which I'm not happy with

please help, thanks

Update:

Since I am in a hurry I decided I would copy the anatomy from other 2d games, it is not that clean but at least I wanna be able to start it. The question is still open.

sentences:
Artefacts when drawing textures I am working on a level-based android game. The level is constructed of many blocks, all drawn with the same texture. Until now I didn't have any problems with drawing the different textures next to each other. However, when I draw a translucent rectangle over the level (in order to show a pause screen on top of it for example), I get artefacts on the places where the textures overlap. To be more clear I included a screenshot that clearly shows my issue: the regions where the textures of the different level blocks overlap do not have the same transparency as the rest of the rectangle.

As you can see, only when drawing the translucent rectangle on top of the level, the overlap is visible.

sentences:
Need some help implementing VBO's with Frustum Culling i'm currently developing my first 3D game for a school project, the game world is completely inspired by minecraft (world completely made out of cubes). I'm currently seeking to improve the performance trying to implement vertex buffer objects but i'm stuck, i already have this methods implemented: Frustum culling, only drawing exposed faces and distance culling but i have the following doubts:

I currently have about 2^24 cubes in my world, divided in 1024 chunks of 16*16*64 cubes, right now i'm doing immediate mode rendering, which works well with frustum culling, if i implement one VBO per chunk, do i have to update that VBO each time i move the camera (to update the frustum)? is there a performance hit with this?
Can i dynamically change the size of each VBO? of do i have to make each one the biggest possible size (the chunk completely filled with objects)?.
Would i have to keep each visited chunk in memory or could i efficiently remove that VBO and recreated it when needed?.

sentences:
Ignore UI elements when clicking to move I have a click to move character that uses a Nav Mesh Agent and I want to ignore clicks that are made on UI elements. For example, I don't want clicking around in my inventory to move my player to the target under the inventory. The relevant part of the move script is very simple.

if (Input.GetMouseButton(0) && !playerHealth.isDead)
{
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;

    if (Physics.Raycast(ray, out hit))
    {
        navMeshAgent.destination = hit.point;
    }
}

I would think that this is a common question raised among beginner developers or that it would be covered in beginner courses, but I can't seem to find the info I'm looking for when Googling around, so I'll ask it here.

So how do I get my Nav Mesh Agent to ignore clicks made on a particular UI element? How about ignoring clicks made to any and all UI elements? Thanks.

sentences: Finding if a point is inside of a mesh (Point-in-polyhedron) How can I find if a point (Vector3) is inside of a mesh? Would this work for both concave and convex objects? I read somewhere that if you raycast in both directions of every axis (X, -X, Y, -Y, Z, -Z), take the count of the hits, and if it is even it is outside, if it is odd it is inside. I tried this and it didn't work.

sentences:
Physics movement prediction is way off I'm making a simple, non-networked game. There are two players and a ball. In implementing the AI for the second player, I've run into a huge problem predicting where the ball will hit the ground. Either I've made a mistake in the physics engine or in implementing the prediction itself. I wrote the physics engine, and while it works visually as I expect it to, I won't rule it out as a suspect. First I'd like to make sure I haven't made a mistake in the prediction code. Here's what I have found so far:

I print the predicted time to impact and the accumulated time in each frame. The time predicted for impact is way off.

tti: 0.678233
total time: 0
.
.
tti: 0.0108339
total time: 0.94969
[ball] ground collision

The code for predicting is in two functions.

double nextBallCollisionWithGround(Ball *ball, double groundHeight) {
    double timeToImpact = quadraticSolver(kGravity, ball->velocity().y, ball->position().y - ball->radius() - groundHeight);
    std::cout << " tti: " << timeToImpact << endl;
    double groundPos = -3.;
    if (timeToImpact > 0) {
        groundPos = ball->velocity().x * timeToImpact + ball->position().x;
    }
    return groundPos;
}

double quadraticSolver(double a, double b, double c) {
    double ans = -1.;
    double det = (b*b) - (4.*a*c);
    double t1, t2;
    if (det > 0.) {
        t1 = (-b + sqrt(det)) / (2. * a);
        t2 = (-b - sqrt(det)) / (2. * a);
        if (t1 > 0.)
            ans = t1;
        if (t2 > 0.)
            ans = t2;
    }
    return ans;
}

If there's no problem in these functions, I can include the relevant parts of the physics engine to see if the problem is there.

sentences:
Keep running CGRectIntersect Method - Objective C I have two UIImageViews. mainSprite, and enemy1. And I have a method that makes enemy1 start moving towards mainSprite. So here's that method.

-(void)enemy1Aggro{
if (CGRectIntersectsRect(mainSprite.frame, enemy1Aggro.frame)) {
    if (mainSprite.center.x > enemy1.center.x) {
        enemy1.center = CGPointMake(enemy1.center.x+2, enemy1.center.y);
    }
    if (mainSprite.center.x < enemy1.center.x) {
        enemy1.center = CGPointMake(enemy1.center.x-2, enemy1.center.y);
    }
    if (mainSprite.center.y > enemy1.center.y) {
        enemy1.center = CGPointMake(enemy1.center.x, enemy1.center.y+2);
    }
    if (mainSprite.center.y < enemy1.center.y) {
        enemy1.center = CGPointMake(enemy1.center.x, enemy1.center.y-2);
    }
}

}
This works because I'm calling it on an IBAction that is a button that gets held down. But the problem is that when that button stops being pressed, this method stops running. So what I need is a way to have this method keep on running. Maybe a for loop? I'm not using anything like cocos2d, and I'm not using CoreGraphics. If you need to see any more of my code just ask.

Thanks :)

sentences:
Tweaking and Settings - Runtime variable modification and persistence Most companies have an editor, or a variable control system for tweaking stuff in games, but are there any middleware solutions to this problem? I've written two such systems in the past myself, and worked with five, maybe six different ones, but none of them were off the shelf.

Each of these home grown solutions had problems, ranging from having to keep looking up values, to not being able to save the current state of the variables.

Are there any mature Config/Runtime-variable control libraries/apps?

I generally code in C++, but I would think that a mature settings/variables editor would probably be socket based (and therefore language agnostic to some extent) as all current development hardware apart from Nintendo stuff provides a mechanism to talk to servers. The code implementation would also need to be quite simple (I do like the hot_var/TweakableConstants article shared by Oskar, but it's not a package)

sentences: How can I run my XNA demo straight from a CD? I was told by a company that better than putting an installer on a CD would be allowing the user to run the demo directly from the CD. Is this even possible when the demo might require things such as the XNA framework to run? Are they actually wrong and an installer is in fact necessary for the dependencies?

sentences:
Domain warping with Perlin noise I'm trying to achieve the effect from https://www.iquilezles.org/www/articles/warp/warp.htm

with no success. Here is the experiment http://jsfiddle.net/fro5y0jm/15/ with canvas. Any ideas?

sentences:
Are buffers in OpenGL associated with GLSL programs? I have two different shader programs in my OpenGL code.

1- renders simple font using freetype
2- simple shader which draw primitive shapes.

I sent both of them some data using buffers, I understood that they are stored on server side, but are they associated with different programs? or any program can use any buffer data by just using         gBindBuffer(); ?

sentences:
expand section of a texture 2D (zoom) I have a texture2d loaded and wish at a certain moment to make a sort of zoom on the texture2d.

As you can see in the image i would like to expand my red square to the resolution of the black square. The aspect ratio is the same.

update

if it isn't clear, the question is how can i make that zoom?

sentences:
Shading a 2D visibility mesh to act like a light? I have a visibility mesh made by raycasting:

https://my.mixtape.moe/omjlgr.webm

Right now, I'm using a shader to color the mesh white and fall off with distance and radius (the texCoord in this case is the same as the current vertex position):

uniform vec2 lightPosition;
uniform vec4 lightColor;
uniform float lightRadius;

void main()
{
    float distance = gl_TexCoord[0].xy - lightPosition;

    float lightPower = 1 - length(distance) / lightRadius;

    gl_FragColor = lightColor * lightPower;
}

However, as you can see, this light is all white. What I want to happen, is to shade the sprites themselves fullbright. Right now, to apply an ambient light color, I set the color of every tile to the color.

So if I have an ambient color of (70, 70, 70), and a light of (255, 255, 255), I want the center of the light to have a fullbright sprite (as if you set the color if it to white), and the tiles at the very edge of the light and further to be the ambient color. To explain further, if my map is fullbright (e.g. ambient color pure white), white lights wouldn't be visible.

How would I change my shader / add another shader to accomplish this effect?

sentences:
Entity component system implementation choices // Ex.1
    for (Component& component : m_components)
    {
        UpdateComponent(component, dt);
    }
// Ex.2
    for (Component& component : m_components)
    {
        component.Update(dt);
    }

Assume that:

UpdateComponent() and the class method Component::Update() have identical logic.
Component::Update() is not a virtual function.
m_compoents is a container that uses a contiguous memory block (e.g. std::vector).

From the caching perspective, is there any performance difference between the 2 examples?

sentences:
Multiple weapons for android game I am trying to make a 3D game for android using the Rajawali engine to render the 3D graphics and blender for designing my models(exporting as .md2), and I want my character to be able to change weapons, armor, helm, etc.

Rendering every possible animation would be too much: if I had 10 different weapons, 10 armor and 10 helm, I would have to create 1000 animations with every possible equipment and if I add boots to list it would be even worse.

I read somewhere you can use bones for this; but in Android, I only get the object itself to work with.

Does anyone has an idea how i can solve this? If I make the weapon a different object how do I parent it to my models in my game?

sentences:
How to code Time Stop or Bullet Time in a game? I am developing a single-player RPG platformer in XNA 4.0. I would like to add an ability that would make the time "stop" or slow down, and have only the player character move at the original speed(similar to the Time Stop spell from the Baldur's Gate series).
I am not looking for an exact implementation, rather some general ideas and design-patterns.

EDIT:
Thanks all for the great input. I have come up with the following solution

    public void Update(GameTime gameTime)
        {

            GameTime newGameTime = new GameTime(gameTime.TotalGameTime,
 new TimeSpan(gameTime.ElapsedGameTime.Ticks / DESIRED_TIME_MODIFIER));
            gameTime = newGameTime;

or something along these lines. This way I can set a different time for the player component and different for the rest. It certainly is not universal enough to work for a game where warping time like this would be a central element, but I hope it should work for this case. I kinda dislike the fact that it litters the main Update loop, but it certainly is the easiest way to implement it.
I guess that is essentialy the same as tesselode suggested, so I'm going to give him the green tick :)

sentences:
A name that describes this type of turn-based battle system I am thinking of a turn-based battle system that follows this workflow:

While True
  Get next character
  Determine character's action
  Execute action
  Check Battle Status
end

This is a straightforward battle system: there's a queue of battle characters, and on each iteration, it grabs the character at the front of the queue and has it perform an action. Once the action is performed, it gets pushed to the back of the queue.

Everyone gets an equal opportunity to perform an action and it simply rotates through all the participants.

When the loop breaks, end-battle processing occurs (eg: victory, defeat, escape, etc)

Is there a name for this particular type of turn-based battle system?

sentences:
Box2D collision between dynamic body I'm implementing Box2D for my 2d top down LIBGDX game and i have some struggle with two dynamic body.
Currently, my two bodies are created that way :

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyType.DynamicBody;
    bodyDef.position.set(this.x, this.y);
    this.body = world.createBody(bodyDef);
    PolygonShape collider = new PolygonShape();
    collider.setAsBox(16, 16);
    FixtureDef fDef = new FixtureDef();
    fDef.density = 0f;
    fDef.friction = 0f;
    fDef.restitution = 0f;
    fDef.shape = collider;
    body.createFixture(fDef);
    body.setUserData(this);
    collider.dispose();

So basicly, no rotation, no friction and no restitution. Also, my world have a gravity of 0 (since it's a 2d top down game, i don't that want them to fall). When player 1 collide with player 2, player 2 is moved backward like it was push but i don't want that. I want it to stay where he is, blocking the path to player 1 but he can also move.

Is there a way to do that ?
I have looked for some tips like catching collision with the contact listener but i don't know what to do in the preSolve method.

I'd like some help, thanks !

sentences:
How to make the Steam overlay work with WPF? I have developed a game using C#+WPF and the game is currently on Steam (private branch until release). However Steam's overlay isn't working with WPF. Sometimes it tries to appear in the popups of comboboxs.

I've tried several options, the best so far was to render a black screen using SharpGL under my application :

<sharpGL:OpenGLControl
            Name="openGLControl"
            DrawFPS="False" RenderContextType="FBO" FrameRate="14"/>
<Grid Name="gridContainingMyApplication">

</Grid>

But as you can imagine this decreases the performance of the application and some effects can appear delayed (mouseover for example).

It was not a major concern until now but since we are planning on adding multiplayer we would like to find a way to make Steam's overlay work.

I know that WPF isn't the best option to create games but in our case we thought it would be. We've created a simulation game and since we have a lot of tables/stats/etc. we thought WPF was great, and excepting this overlay issue WPF seems perfect for us.

Is there a way to make Steam's overlay work with WPF ?

Thank you,

sentences:
SFML Animation class as a strategy or an inheritance everybody.
I need to add animations to my game.
And I have a question.

I found AnimatedSprite class on SFML Github which is an inheritance, but in my project, I am using a lot of elements made with strategy pattern,
for example movement behavior, jumping behavior, fighting behavior, etc.
I just try to avoid inheritance because it makes class inflexible.

But this time in contrast to other classes Animation class has a lot of methods
that can be used at runtime. I mean Play(), Stop(), Pause(), and more.
If I use this as a strategy I would have to give access to this object.

What do you think?
Maybe I just need to use another design pattern?

sentences: How can I change width of sprite Dynamically? I want to change width of sprite dynamically but i can't perform it.!! Here i want to change only my white sprite i want to use these type of facility in my game in using AndEngine I want to display life of player

sentences:
Taxes and Approximate revenue? I'm heading out from the prototype stage and towards my early/alpha stage.

In this transition period I've been interested in getting an estimate of what the revenue will be so I've come up with this in Excel.

I've considered taxes in general, VAT and fee transactions from Stripe and PayPal.

I'm from Europe.

This is my first game and I know no-one in the field so I don't really have an answer.

Is the following a reasonable assumption?

Itch.io Cut           10 %
VAT Transactions      25 %

With this as an example result:

Money Earned       +1,000 €
VAT Transactions   -  250 €
                   --------
SubTotal           +  750 €

Itch.io Cut        -   75 €
                   --------
My Final Revenue   +  675 €

Here is my question on itch.io, and here it is to my reddit question.

sentences:
How can I add levels in my game? I want to add an easy and a hard level to this code:
#include<SFML/Graphics.hpp>
#include<iostream>
#include "menu.h"
using namespace std;
using namespace sf;

int pagenumber;

int main() {
    while(true)
    {
    RenderWindow window(sf::VideoMode(600, 600), "suduko");

    menu Menu(600, 600);
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
            if (event.type == sf::Event::KeyReleased) {
                if (event.key.code == sf::Keyboard::Up) {
                    Menu.moveUp();
                    break;
                }
                if (event.key.code == sf::Keyboard::Down) {
                    Menu.moveDown();
                    break;
                }

                //the num of the page
                if (event.key.code == sf::Keyboard::Return) //enter
                {
                    if (Menu.mainMenuPressed() == 0)
                    {
                        window.close();
                        pagenumber = 0;
                    }
                    if (Menu.mainMenuPressed() == 1)
                    {
                        window.close();
                        pagenumber = 1;

                    }

                    if (Menu.mainMenuPressed() == 2)
                    {
                        window.close();
                        pagenumber = 2;
                    }
                }
            }
            window.clear();
            Menu.draw(window);
            window.display();
        }

        if (pagenumber == 0)
        {
        //play

            sf::RenderWindow window_play(VideoMode(300, 300), "play", sf::Style::Close);
            while (window_play.isOpen())
            {
                sf::Event event;
                while (window_play.pollEvent(event))
                {
                    sf::Event event;
                    while (window_play.pollEvent(event))
                    {
                        if (event.type == sf::Event::Closed)
                            window_play.close();
                    }

                }

            }
        }

        if (pagenumber == 1)
        {

            //option

            sf::RenderWindow window_play(VideoMode(300, 300), "Options", sf::Style::Close);
            while (window_play.isOpen())
            {
                sf::Event event;
                while (window_play.pollEvent(event))
                {
                    sf::Event event;
                    while (window_play.pollEvent(event))
                    {
                        if (event.type == sf::Event::Closed)
                            window_play.close();
                    }

                }

            }
        }
        }

        if (pagenumber == 2)
        {

            //exit
            break;
        }

    }
    return 0;
}

Is there any kind of help ?

sentences:
What are good, simple action games/action RPGs to emulate? There is standard advice for game development to start off emulating simple games you know and build up from there. Which makes me wonder. What are good examples of action games or action RPGs that are very simple to begin with to try and emulate? What is necessary and what is superfluous?

Please link to the game's site (or Wikipedia page if it's defunct) if you can, and only one game per answer please.

sentences:
Changing the duration of motion state transitions in Animator Controller Anyone around who is experienced with Unity animation states and the Animation Controller? I wonder is it possible in Unity to change the duration of time it takes between motion transitions in the Animator Controller?

To give an example let's say I have a human character that has an initial state of Grounded and in this state I have several motions like idle, running forward/backward and strafe left/right. When I now have the character in idle and I move left/right to go into strafe motion, the duration of the transition from idle to strafe left/right takes too long and I want it to be faster. I only want that transition between the motion states to be faster but not the actual animation itself. I think there should be a way to do this but I can't find any options for changing the duration between motions.

I'm aware that the duration between states can be changed by selecting a transition connection between states but what I'm talking about here are the motions inside a state.

sentences:
Libgdx how to add popup interaction I am looking for someone to point me in the right direction. I am working in libgdx.  I have a game where a player will approach an object on a map and then interact with it. On interaction a new screen should come up, that then has separate interaction.

Think, lockpicking. if you walk to a door, a minigame would popup with the lock on the screen.  All background art and action halts while this happens.

I was considering using an Object that triggers a Looped event that you can't escape until the condition is met EG:  while(!Finished){lockpick()} then creating a render() inside lockpick()... is this a terrible idea? Should I just dump out to a different screen, and reload my game screen from saved settings?  I really don't know the best way to handle this...

sentences:
Throttling MonoGame actions (explosions, sounds, etc) I'm trying to find a way to deal with throttling/managing actions that need to happen on a regular (regulated) basis.

Right now, if I want to throttle an "action" in MonoGame I need to setup a "timer".

Let's say I want to spawn a bunch of explosions during the update loop, but I don't want to spam them.  I would setup a variable to track the countdown to the next time I can spawn an explosion, and another variable for the time between:

public override void Update(GameTime gameTime)
{
    // ExplosionTimer is a class variable, defaulted to 0
    // ExplosionTimerMax is a class variable set to something like 1000 milliseconds
    ExplosionTimer += elapsedGameTime;

    if (ExplosionTimer >= ExplosionTimerMax)
    {
        // Perform actions
        ExplosionSound.Play();
        SpawnExplosion();

        // Reset the timer
        ExplosionTimer = 0;
    }

    // Other update code
    ...
}

This is pretty easy to setup and straightforward, but is there a better way?  If I need to setup 5 different timers, that means I need to define 10 variables, increment them all, run checks for their state, and reset them if needed.

sentences:
Why does my character stop a little before landing on the ground? I made a little game with side-scrolling and a box (the player) jumping across the level. The simple physics are almost done, but I have two problem with the way things behave:

On landing, the box takes a little time to reach the floor
When the box hit a roof, there is always a little space between it and the object.

Here is my collision code (in the player's Step Event):

myGravity = 0.5;
if (vspeed > 10)  vspeed = 10;

speedAir = abs(vspeed+1);

//ON_FLOOR = !(place_free(x, y + speedAir));
ON_AIR = place_free(x, y + speedAir);

FREE_RIGHT = place_free(x + speedScreen, y);
FREE_UP = place_free(x, y - speedAir);

KEY_UP = keyboard_check(vk_up);
KEY_LEFT = keyboard_check(vk_left);
KEY_RIGHT = keyboard_check(vk_right);
KEY_FIRE = keyboard_check(vk_space);

/* JUMP */
if ON_AIR
{
    gravity = myGravity;
    gravity_direction = 270;

    if !(FREE_UP)
    {
        vspeed = 0;
    }
}

else // if ON_FLOOR
{
    gravity = 0;
    gravity_direction = 270;
    vspeed = 0;

    // JUMP
    if KEY_UP & FREE_UP
    {
        vspeed = -10;
    }
}

/* LATERAL */
if (FREE_RIGHT)
{
    x += speedScreen; // screen side-scrolling
}

How can I do this correctly?

sentences:
How do I simulate vehicle movement in a non-gravity environment (e.g., space)? As a series of small experiments, I've began to tinker with game development, specifically using SpriteKit and Swift. I'm looking to simulate a body moving through a non-gravity environment, specifically space.

My vehicle starts in the middle of the screen and begins to travel horizontal with a constant force vector of (100, 0). When the user touches a new location, I would like for the vehicle to alter course and head to the location of the touch. In addition, I would like to simulate the vehicle "turning" in space. You can imagine that the turn wouldn't be immediate but would resemble something like a car drifting around a corner. This is such an example. I've got a crude version of it working, but there are weird quirks that I'm beginning to wonder if I'm approaching this correctly.

This is what I have so far:

Vehicle construction:

ship = SKShapeNode(rectOfSize: CGSizeMake(40, 20))
ship.fillColor = UIColor.redColor()
ship.strokeColor = UIColor.clearColor()
ship.position = getMiddle()

ship.physicsBody = SKPhysicsBody(rectangleOfSize: ship.frame.size)
ship.physicsBody?.affectedByGravity = false
ship.physicsBody?.velocity = CGVectorMake(Constants.VELOCITY, 0)
ship.physicsBody?.applyForce(CGVectorMake(Constants.VELOCITY, 0))
ship.physicsBody?.dynamic = true

self.addChild(ship)

When the user touches, I simply record the touch location as touchLoc.

In update:

if needUpdate {
    let shipLoc = ship.position

    // Find deltas
    let dx = shipLoc.x - touchLoc.x
    let dy = shipLoc.y - touchLoc.y

    // How much does the ship need to rotate?
    let angle = atan2(dy, dx) + CGFloat(M_PI)
    let rotate = SKAction.rotateToAngle(angle, duration: 0.1, shortestUnitArc: true)
    ship.runAction(rotate)

    /*
     * The deltas are used to create the new velocity vector, if the delta values are too
     * low, it could cause slow down in the ship velocity, so try to "normalize" the deltas
     * into something more similar to the starting velocity so the ship maintains a good speed
     */
    let len = sqrt(pow(dx, 2) + pow(dy, 2))
    let normalFactor = Constants.VELOCITY / len
    let ndx = dx * normalFactor
    let ndy = dy * normalFactor

    // Our enhanced vector
    let toVector = CGVectorMake(-ndx, -ndy)

    let curVelocity = ship.physicsBody!.velocity
    var newX = curVelocity.dx
    var newY = curVelocity.dy

    /*
     * This section is used to simulate the "drifting turn". Instead of turning sharply, add
     * some fudge factor (TURN_DELAY = 1) to make the turn gradual
     */
    if curVelocity.dx > toVector.dx {
        newX -= Constants.TURN_DELAY
    } else {
        newX += Constants.TURN_DELAY
    }

    if curVelocity.dy > toVector.dy {
        newY -= Constants.TURN_DELAY
    } else {
        newY += Constants.TURN_DELAY
    }

    // Set the new velocity vector
    ship.physicsBody?.velocity = CGVectorMake(newX, newY)

    /*
     * Kind of convoluted, but this is to check to see if the ship is within a specified range of the
     * touch location (UPDATE_PADDING = 3). If the ship is, stop trying to run this update function (at least
     * until the next touch) because the ship will constantly try to target the touch location
     */
    if (-UPDATE_PADDING ... UPDATE_PADDING ~= (shipLoc.x - touchLoc.x)) &&
       (-UPDATE_PADDING ... UPDATE_PADDING ~= (shipLoc.y - touchLoc.y)) {
        print("Stopping. Touched \(touchLoc.x), \(touchLoc.y). Ship: \(shipLoc.x), \(shipLoc.y)")
        needUpdate = false
    }
}

Here is a quick video demonstrating how it currently works. As you can see, as the touches happen closer to the vehicle weird things happen. This leads me to believe I'm going about this all wrong. Any advice, suggestions, or resources would be greatly appreciated. Thanks.

sentences:
How to change pixel color of Texture with Fragment Shader I want to change the pixel color of a texture. I don't know where to start and what to add. Really need help, I only find useless snippets in the internet.

My current Code:

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
...
GLES20.glAttachShader(riGraphicTools.sp_SolidColor, vertexShader);
GLES20.glAttachShader(riGraphicTools.sp_SolidColor, fragmentShader);
GLES20.glLinkProgram(riGraphicTools.sp_SolidColor);

vertexShader = riGraphicTools.loadShader(GLES20.GL_VERTEX_SHADER, riGraphicTools.vs_Image);
fragmentShader = riGraphicTools.loadShader(GLES20.GL_FRAGMENT_SHADER, riGraphicTools.test_Image);

riGraphicTools.sp_Image = GLES20.glCreateProgram();
GLES20.glAttachShader(riGraphicTools.sp_Image, fragmentShader);
...
}

The riGraphicTools Class:

public class riGraphicTools {

public static final String test_Image =
        "precision mediump float;" +
        "varying vec2 v_texCoord;" +
        "uniform sampler2D s_texture;" +
        "void main() {" +
        "  gl_FragColor = texture2D( s_texture, v_texCoord );" +
        "}";

public static final String vs_Image =
    "uniform mat4 uMVPMatrix;" +
    "attribute vec4 vPosition;" +
    "attribute vec2 a_texCoord;" +
    "varying vec2 v_texCoord;" +
    "void main() {" +
    "  gl_Position = uMVPMatrix * vPosition;" +
    "  v_texCoord = a_texCoord;" +
    "}";
}

sentences:
Get modified key with SDL2 If I poll keyboard events with SDL2 all I get is the pressed key and the modifiers. But I am using Neo and have some keys like Esc and arrow keys on a different layer which means that e.g. Mod4+i is the same as the left arrow key.

How can I get the modified key from SDL2?

The same problem occurs to me when I want to handle special chars which are located on different keys on different keyboard layouts (/ for example has a dedicated key on US layout while on German layout it is located at Shift+7).

I already found the text input mode, but this seams rather unfitting as one gets a string instead of a single key.

Edit: formatting

Edit 2: I just found another problem .. SDL doesn't recognize Mod4 so when pressing Mod4 plus another key, the mod field is still 0. Other modifiers like Shift work.

sentences:
What does the "random element" do in Cellular Automata I'm reading this post on TutsPlus regarding procedural level generation using cellular automata. My question arises in this code snippet:

float chanceToStartAlive = 0.45f;

public boolean[][] initialiseMap(boolean[][] map){
    for(int x=0; x<width; x++){
        for(int y=0; y<height; y++){
            if(random() < chanceToStartAlive){
                map[x][y] = true;
            }
        }
    }
    return map;
}

In the first line, the author declares a float that represents 45%. This makes sense. However, the role of this is unclear to me. In this line:

if(random() < chanceToStartAlive)

A random number is being generated, and being tested if it's less than 0.45f. Since it is an inequality, this expression can either return true or false correct?

How exactly is this percentage affecting this loop?

Thank you!

sentences:
Efficient way to implement a lot of singletons I just came upon programming patterns and learned about singleton. I'm in the process of creating my first game and it contains several managers:

I wanted to implement singleton on each of the managers,but the only way I can think is copy pasting the singleton pattern on each awake method script attached to each manager.
Is there a more efficient way to do it rather than pasting the pattern on each awake method?

sentences:
Why doesn't this 2d physics calculation yield the desired jump height? I found a formula for gravity and jumping in this article: http://error454.com/2013/10/23/platformer-physics-101-and-the-3-fundamental-equations-of-platformers/

I implemented this formula and proceeded to do some test calculations, but they yield incorrect results. I expected the outcome to be 4, but the test resulted in 3.8. What am I doing wrong? How do I get the number 4?

float deltaTime = 1f / 50f;

float maxJumpHeight = 4;
float timeToApex = 0.44f;
float gravity = (2 * maxJumpHeight) / (timeToApex * timeToApex);

float jumpHeight = 4;
float jumpVelocity = (float)Math.Sqrt(2 * gravity * jumpHeight);

float velocity = -jumpVelocity;
float position = 0;

while (velocity < 0)
{
    velocity += gravity * deltaTime;
    position += velocity * deltaTime;
    Console.WriteLine("Position = {0}", position);
}

sentences: Does compressing data before transfer make a game run faster? I want to make my game as fast as possible as it is real time and fast paced. I have already decided to encrypt my data here and I was wondering whether compressing it would be faster for the client and the server? Also I was wondering if it is better to encrypt data before or after compression.

sentences:
How do I check if animation is of Animation Type "Humanoid"? One can set the Rig / Animation type of an animation to "Generic", "Humanoid", etc.

How could I check by script if an animation rig has been set to type "Humanoid"?

sentences:
Algorithm for creating mesh from 2D image silhouette I'm looking for an algorithm that can take a 2D image, approximate it's shape and then generate a low poly mesh. Basically, the same what Unity does with sprites when you select tight mesh instead of a rect mesh.

I'd be very thankful for any links that would put me on track to begin my research. Thanks!

sentences:
Unity facebook sdk 'Didn't find class "com.facebook.FacebookContentProvider"' any more fixes / workarounds for this? How to replicate this error...

Create a new Unity project.

Import the facebook sdk unitypackage

Set your App Id for facebook via Facebook\Edit Settings

Using Assets\External dependency manager\Android, press 'Resolve dependencies', then press 'delete resolved libraries' (otherwise the build will fail at the gradle stage)

Build and run.

When the app tries to run I immediately get the error message on my phone 'app has stopped working'
and see this error in the logs ...
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/base.apk"],nativeLibraryDirectories=[/data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/lib/arm64, /data/app/com.SandwichGeneration.MakeASquare--nLEHpzOYlwW6XKmGzPfIw==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]

Suggested fixes I've tried from here

I've tried different combinations of old or new facebook sdks and old or new versions of Unity.

I've tried building from a few different machines to different Android devices.

I've deleted the external dependency manager included with the facebook sdk and used this one instead. In order to get this one to resolve I had to set a 'Custom Gradle Properties Template'in the player setting under publishing settings.

I've set a Custom Proguard file'in the player setting under publishing settings, and I added the following two lines to the file..
-keep class com.facebook.internal.* {*;}
-keep class com.facebook.* {*;}

So I've tried all the suggested fixes and various combinations thereof. I dont know what more I can do. Can anyone suggest anything else to try?

sentences:
Diversified Game Object List Recently I started creating a game in java to hone my rusty java (I work primarily with cpp) and because I thought it to be a neat idea. To better illustrate the problem, let me explain a part of the game. The details aside, the game is in essence a dungeon builder and the problem pertains to the blocks you place down to create the maze adventurers have to travel through. Each block is a corridor and on each wall/floor/ceiling of a block you can place objects such as traps etc. However, while finishing up the game engine I realized I still lacked a list for blocks/objects that are special. Blocks or items that need a special animation (some extend spikes, some shoot fire, some contain a chest with inventory, etc). They're hard to bring together in one class and as we all know they can't be together in one list with different classes unless we want code-bloating. So my question is, what is the most efficient way to make collection of diversified game objects and how do other games do it?

Presently I have the following methods thought out.

I reduce all objects to instances of one class. They all fit in one list. However, to induce special methods I need a long list of methods that each do something else. Frankly, this method is inefficient, unpleasant and unpractical to work with.
I reduce all object to instances of one class. They all fit in one list. However, they each have an ID of a special action. If the need arises the ID gets compared with another list that's much shorter in length and uses generics or reflection to store the different effect. If it needs a special action it simply activates the effect (such as fire plume) on the given vector. The problem with this is that it does not allow for direct manipulation of the object such as a block that moves out to squash adventurers. Or if it could, it would be messy code, unnecessary throughput of code etc. I'd rather avoid it.
I make a list of the base class/interface and add the different child classes to it. Each child class can thus have a different implementation. However, to access it, I need to know to use reflection and for that I need to know the initial class, which, in many cases, I don't since I want a dynamic system. The result is that I need to store the child class name in the 'block' parent class and then when the need arises, use that name to reflect the new class. Once again, it is inefficient and far too slow.
I create a list of the block class and access it every time a generic block needs to be checked. However, if a creature/person walks over a tile it checks if the child class name in the block class is empty. If not, convert it to that class and execute the special function. This seems the best option as it gives the least code-bloating, is the most efficient, etc. However, it still needs to reflect and convert every time a creature goes onto a special block.
I create an event driven list in which each block instance has his own special event that links to a certain animation. This is very tedious, very inefficient and because it is so detached it is once again difficult to animate the basic block.
I use generics. Sadly, this causes far too much code-bloating and the accessing of the classes themselves gets difficult and messy.
I create a huge switch method and each block instance has a number. The number corresponds with the correct animation in the switch it needs to execute. I don't think I need to say why I don't want to do this.

And there are a few more, but each of them is still as inefficient as the next. Furthermore, every time I look around this site or another people say "use a base interface/class in a list" however they never say what the most efficient way is to get the class out of the list again. Am I missing something obvious? How should I tackle this?

sentences:
How to get the fingerID (Touch) that is pressing a specific UI button. (Unity) I want to displace a button along with the screen position that is pressing on it.

However, having multiple touches at the same time results in wanky behaviour.

So I want to limit the button's movement to the touch that started it.

I'm aware of the PointerEventData.pointerId but I couldn't figure out how to use it.

sentences:
Change GUI in Java game I'm making a 2D Server/Client game, I have very little to no problems with the server but now I want to work on the client side code.
I'm thinking about using a JFrame and all the other GUI classes/methods.
My question is how do I change the GUI and all things that are displayed.
For example if the user opens the client I want him to login or register, if they logged in I want the client to display the game. Do I just display the new elements and delete the old or is there a other solution? I don't want to use 2 frames.

sentences:
How to determine the cost of new units Suppose I design a game such as Battle of Wesnoth, where there are many races, each of which with many types of units.
Is there any rule-of-thumb for determining how much each unit should cost?

One obvious rule is that weaker units should be cheaper, otherwise no-one would like to buy them. But how much cheaper should they be?

As an example from the above link, is there any formula by which I could decide that "vampire bat" (based on its HP and damage properties) should cost 13 while "blood bat" should cost 21?
Or is it just a guess that is validated by extensive playtesting?

EDIT: To make the question more focused, let's assume for simplicity that the units in Wesnoth differ by only two stats: health points ($h$) and damage points ($d$), and all their other stats are equal. Is there a way to calculate a formula to determine the cost as a function of $h$ and $d$?

sentences:
Do I need to update my DirectX SDK in order to fix a crash with D3D10_CREATE_DEVICE_DEBUG? I am currently using the DirectX June 2010 SDK. Everything was working fine with my installation until recently. Unfortunately I'm not sure what changed or when, but now when I create a device with D3D10CreateDevice1(), it always crashes with a memory error if the device is created with the D3D10_CREATE_DEVICE_DEBUG flag. Even reverting to old code which used to work causes this error.
Additionally, PIX always crashes every time I use it with my game.
I did some searching and found a lead that I may need to update my SDK installation. This page also indicates that I need to "install the updated SDK Debug Layers".
How do I do this? I have no idea how to install the "Debug Layers"...
Additionally, is it a mistake for me to be using the June 2010 SDK? Apparently DirectX is now included with the Windows 8 SDK, which I haven't been using because I've no interest in Windows 8 development. Is this foolish? Is there any downside to me using the Windows 8 SDK just for Windows 7 DirectX development using Visual Studio 2010?

sentences:
Unity3d iOS build restarts when regaining focus from browser I have an app made in Unity3d for android and iOS. In it, the user has the ability to link their accounts with Facebook and Twitter. For Facebook I use their Unity plugin, for Twitter, I open an external browser page that lets them accept or decline Twitter integration that then redirects to a php page the calls the app URI to return focus to Unity.

On Android this all works perfectly using an Intent in the Manifest. In IOS I'm running into issues though and I don't really know my way around XCode.

I'm using the newest version, XCode 7 Beta 2. The App runs as expected but for both the Facebook and Twitter authentications, upon returning focus to the App from the Browser, it completely restarts the App as if just launched rather then returning from a suspended state.

In the Unity build I have "Run in Background" selected. I setup the URL Scheme in XCode. Its a pretty basic app so I don't think its being closed due to Memory usage.

Any ideas or any settings I can change in XCode that might be preventing it from resuming?

*Note, if I just hit Home and send the App to the background it will properly resume, its only when called by the URI from the browser that it seems to completely restart.

sentences:
Unity HDRP draw order doesn't change when asset is set to higher priority? I don't like the way that light got baked into part of my mesh.
It might make sense for me to try to blacken that area of the lightmap in Photoshop, but first I tried to just hide it with a probuilder object that uses an unlit black material:

I changed the priority of this object from 0 to 1, higher than any object in this scene, or at least the floor object, but it does not draw over the floor in Game View. I tried using a higher number and setting it beneath the floor instead of intersecting it, but it is just being rendered the usual way. Also note that I have a UI Canvas component being drawn in ScreenSpace, in case that has anything to do with it.
How can I get this object to render in front of the floor while it is intersecting the two front faces, like in the picture?

sentences:
Player ranking using Elo with more than two players I would like to use Elo to track player rankings between matches of a certain game, however the game can be played with up to four players in a match. I have seen games like Carcassonne use Elo with more than two players playing, but I am not familiar with Elo beyond a 1-1 matchup.
From the wikipedia article the two-player equations I would like to extend are:

Ea = 1/(1 + 10(Rb - Ra) / 400)
Eb = 1/(1 + 10(Ra - Rb) / 400)
Rxnew = Rxold + 32 * (W – Ex), where W=1 if X wins and W=0 if X loses.

How would the computation for Ex and W change given more than two players?

sentences:
How to rotate a 3D character on top of a plane with an isometric picture on it How to calculate the angles of the 3d charater so that it fits into the isometric environment projektet on a 2d plane?
Also, how do you calculate the rotation of my character?
What I want to achieve:

Describing the scenario:

sentences:
Does it make sense to do more calculations in the fragment shader if there are more vertices than pixels? I'm very new to graphics programming, and as I understand it vertex shaders are called per vertex and fragment shaders are per pixel (ignoring anti-aliasing). When it comes to optimization all sources I refer to say that calculations that could be done in either shaders should be done in the vertex shader, and it makes sense: 5*8 done 3 times is way better than 5*8 done 300'000 (640×480 for example).

And that's fine for this scale but the question almost poses itself: what happens when the amount of vertices exceeds the resolution. Here's a practical example: a typical AAA game could have upto 3'000'000 polys rendering on the screen, for the sake of simplicity let's say it's a very detailed triangle strip, that would give it exactly 3'000'002 vertices; while a full HD screen has 1920*1080 ≈ 2'000'000 pixels. As you can tell a difference of a million operation could be a substantial performance increase.

Is my thought process sound, or does my ignorance of some details leave something to be desired?

sentences: Farseer: Only allow the collision one time with the object I have there serveral platforms. I would like to allow the player to collide only one time with the object! Hope you can help me

sentences:
rendering a spritebatch to a temporary buffer and then offset that to the main screen I've been trying to figure out how to do this but I have a bunch of screens, each with their own Draw method. However, I'd like to render all sprites offset by the screen position without altering their locations before I do the drawing.

So, if I render a sprite on a screen at 0,0 but the screen itself is offset to 50,50 it still renders to a window position of 0,0 instead of to the window position of 50,50.

I've been thinking about rendering each screen to their own texture and then rendering that texture to the main spriteBatch - but reading another question you could lose a lot of information such as alpha transparency

Any help will be appreciated to get me on the right path. Thanks.

Update: Also I'd prefer it to be recursive so that screens within screens are also offset appropriately.

sentences:
Offscreen arrow indicator appears only when the user go near to the object I have placed four gameobject at different place.And I have a player and have applied movement to it through keyboard control.I have added script for arrow indication towords this gameobject.But the problem is that,the arrow appeaar only when the user go near to the gameoobject.I need the arrows to appear on the screen so that the user initially know where the gameobject is placed on the scene.

Here is the code for onscreen arrow.I have attached this script to each gameobject

public Texture2D icon; //The icon. Preferably an arrow pointing upwards.
public float iconSize = 50f;
[HideInInspector]
public GUIStyle arrow; //GUIStyle to make the box around the icon invisible. Public so that everything has the default stats.
Vector2 indRange;
float scaleRes = Screen.width/200; //The width of the screen divided by 500. Will make the GUI automatically
//scale with varying resolutions.
Camera cam;
public bool visible = false; //Whether or not the object is visible in the camera.

void Start () {
    visible = GetComponent<SpriteRenderer> ().isVisible;

    cam = Camera.main; //Don't use Camera.main in a looping method, its very slow, as Camera.main actually
    //does a GameObject.Find for an object tagged with MainCamera.

    indRange.x = Screen.width - (Screen.width / 6);
    indRange.y = Screen.height - (Screen.height / 7);
    indRange /= 2f;

    arrow.normal.textColor = new Vector4 (0, 0, 0, 0); //Makes the box around the icon invisible.

}

void OnGUI () {
    if (visible) {
        Vector3 dir = transform.position - cam.transform.position;
        dir = Vector3.Normalize (dir);
        dir.y *= -1f;

        Vector2 indPos = new Vector2 (indRange.x * dir.x, indRange.y * dir.y);
        indPos = new Vector2 ((Screen.width / 2) + indPos.x,
            (Screen.height / 2) + indPos.y);

        Vector3 pdir = transform.position - cam.ScreenToWorldPoint(new Vector3(indPos.x, indPos.y,
            transform.position.z));
        pdir = Vector3.Normalize(pdir);

        float angle = Mathf.Atan2(pdir.x, pdir.y) * Mathf.Rad2Deg;

        GUIUtility.RotateAroundPivot(angle, indPos); //Rotates the GUI. Only rotates GUI drawn after the rotate is called, not before.
        GUI.Box (new Rect (indPos.x, indPos.y, scaleRes * iconSize, scaleRes * iconSize), icon,arrow);
        GUIUtility.RotateAroundPivot(0, indPos); //Rotates GUI back to the default so that GUI drawn after is not rotated.
    }
}

public void OnBecameInvisible() {
    visible = false;
}
//Turns off the indicator if object is onscreen.
public void OnBecameVisible() {
    visible = true;
}

}

How can I make the arrows to appear on the edges of the screen

sentences:
How can i make my game GUI look nicer? Im currently developing my first little android game. Its a casual game, which people can play when they are waiting for the bus or something like that.

All the other games in the playstores are looking very simple and still beautifull or addicting. So how can i improve my UI ? Are there any guidelines ?

The gallery contains several images of my GUI. Some are the same, but with other colors. Thats because i have an ingame shop, where the user can unlock new color themes.

Open Imgur Gallery

sentences:
Problem with texture's quality in Unity .

After setting a texture to GameObject, it looks bad.  Some pixels can be seen and colors are distorted. The image itself is in good quality but after importing it to Unity, it looks ugly.

Screenshot explanations:

left, image attached to the GUITexture GameObject
middle, image before importing to Unity
right, after importing (shown in inspector)

sentences:
How is displacement tessellation done? I'm curious because I was thinking that displacement mapping is done in the shader file only inside the domain shader. Am I correct or is it both implemented in the rendering section of the mesh and shader? So, if I make a cube for an example, I would have to read out the displacement map file then tell what vertices get positioned inside the render or only in the shader file? I'm a bit stuck on that concept.

These are the snap shots done inside the game editor of a plane. I believe the issue lies within the texture but you can always correct me.

This texture was created for the box inside 3DS Max and the UV Mapped, then baked the image.

When I load a sphere, not so much crazy gaps but it's still hasty.

sentences:
Question on parallelizing ECS Systems Learning & Implementing an ECS system for my game, I'm wondering how I am supposed to parallelize the systems on multiple threads. Different systems can't run at the same time (unless they operate on completely different set of components), so I guess the most common option is to run each system sequentially and parallelize the iteration they do on components, in a parallel_for fashion. The problem with this is that parallel_for assumes each iteration is self contained, which is not always true. In case an entity needs to access the component of another entity, and maybe modify it (very common in gameplay programming), we cannot really run a parallel_for as often we don't know what entities will want to access (through the system) what other entities.
How is this handled in ECS?

sentences: Any open source game engines for Android? Is there any open source android gaming engine ?

sentences:
What are some cool examples of procedural pixel shader effects? What are some good examples of procedural or screen-space pixel shader effects? No code is necessary; I'm just looking for inspiration.

In particular, I'm looking for effects that are not dependent on geometry or the rest of the scene (so they would look okay rendered alone on a quad) and are not based on image processing (they don't require a "base image," though they can incorporate textures). Multi-pass or single-pass is fine. Screenshots or videos would be ideal, but ideas work too.

Here are a few examples of what I'm looking for (all from the RenderMonkey samples):
alt text http://public.blu.livefilestore.com/y1pXcNg_0EPZVzwu1T84a4Yek373x8062rhrNCA7UcftTjCkeiY-5uAuJiBYY29x2E53p5MO-uMA8FmEquvxsPCkA/effect1.jpg?psid=1alt text http://public.blu.livefilestore.com/y1p_5Lx7BdjFyFRBkbcc0WakAT7Q-99fVcFOxmTXBbG4VtoFzC0UfAj51eSnE7ZOD84EYL2Y51HhMS2nWsohhn1mQ/effect2.jpg?psid=1
alt text http://public.blu.livefilestore.com/y1p_5Lx7BdjFyE3KhYtHe-Cdg7XuXcJ9Ou-GKzED-kZnzACyB5ypA6NSCfsYfuKa0h3ztoDRwwq9qBddX2OfG0fhg/effect3.jpg?psid=1alt text http://nv3wrg.blu.livefilestore.com/y1p1iHFwf-wytDo8HlTJca8RfckA-iTKgvLiJm0t9iz3S35YgeEnt99NMjKDgotxa3Bv90wAhOYLabzx2Sd3LoEH2Hs76WR1vFM/effect5.jpg?psid=1

I'm aware of this question; I'm not asking for a source of actual shader implementations but instead for some inspirational ideas -- and the ones at the NVIDIA Shader Library mostly require a scene or are image processing effects.

sentences:
Multiplace instances of an object in Game Maker with a variable changing I want to do a level selection menu in GameMaker. There's one button for each level. Clicking on the button 1 take you to level 1, button 2 take you to level 2 and so on.

But if I duplicate the first button, all of the buttons will get you to level 1. Is it possible for multiple instances of the same object to have different variables?

sentences:
How to design Client-server hybrid hit detection with projectile weapons? Hybrid hit detection here refers to a architecture where client sends a hit claim to server and server verifies it with a tolerable error limit to confirm the hit or deny it.

This technique may work well with hit scan or instant hit weapons because you only have to check it for one frame/tick.
But in case its a physics projectile I.e where an actual projectile flies to the target like a real bullet,  the hit is the result of flight over more than one frames and varying physics state. As such verifying the hit could be very cumbersome and resource intensive.

So how would  one go for server client hybrid approach in this scenario?

sentences:
How to generate portal zones? I'm developing a portal-based scene manager. Basically all it does is to check the portals against the camera frustum, and render their associated portal zones accordingly.
Is there any way my editor can generate portal zones automatically with the user having to set the portals themselves only? For example, the Max Payne 1/2 engine ("Max-FX") only required to set the portal quads, unlike the C4 engine where you also have to explicitly set the portal zones.

sentences:
Sniper aim prediction I'm trying to make a sniper aim prediction for an Unreal Engine 4 game. I've found this interesting question Projectile Aim Prediction with Acceleration, and I tried to implement in C++ what DMGregory said. The result I got isn't bad at all, but I've some doubts about something in his explanation.
First, what does he mean with v_T? Should I calculate it as FVector v_T = targetVelocity - myVelocity; or as FVector v_T = targetVelocity - myPosition;? The vectors myVelocity and myPosition are respectively the velocity and the position of the shooter (me).
Then, I noticed that the sniper projectile trajectory doesn't seem to be a perfect parabola, so I avoided the v_p calculation, and I've simply calculated the predicted target position as

FVector predictedTargetPosition = targetPosition + targetVelocity * deltaTime + targetAcceleration * deltaTime * deltaTime * .5f;

where the 3 vectors targetPosition, targetVelocity and targetAcceleration are relative to the game world axis.  After that, I simply added to the Z component of the predictedTargetPosition the following amount:

recalculatedTargetPosition.Z += fabs(bulletAcceleration.Z) * deltaTime * deltaTime * .5f;

in order to compensate the loss of height of the projectile in time.

What do you think about it?

Thanks in advance.

sentences: Where can I get people to test my game? I've just finished making the core aspects of my HTML5 game. I have a server and all that, but is there a site where I can find people that would test my game? I figured that getting my friends to do it wouldn't be a good option because they are probably biased, so I need people that I never met before, complete strangers. Also, would the people at gamedev forums be willing to do that? Would it be considered as advertising?

sentences:
Generating Normal map from a Image with a given Albedo map I am working on a research problem part of which involves generating normal map from a given image of a rusted object. I searched the internet for techniques to achieve the above and apparently crazybump is mentioned a lot. I tried it but it didn't produce the desirable effects. Also I am looking for a method which draws inspiration from an existing research paper not some closed source software. I turned my attention to the technique described in the this paper. Results from this technique are satisfactory for normal objects because of bias in the training data but it doesn't work very well in the case of rusted objects.
After this I focussed my attention on generating Albedo map (the above problem would become more solvable if Albedo map is obtained). Fortunately I am able to generate pretty good albedo maps for images of rusted objects. I used this paper's approach to generate Albedo maps. Now I want to know a good technique to get Normal map given an image and it's corresponding Albedo map. To give you an idea of what kind of images I am working with I am attaching a sample.

Links to research material would be really appreciated. Thanks!

sentences:
Animation, Interpolation, & Structure I have been working on animation in my small game engine recently and I am implementing some interpolation to be used with skeletal animations. I know how to do interpolation but I am not sure where to put the equation that I get out of it.

Do I save an equation for each channel of every bone in the data structure? Maybe something along the lines of:

struct Channel
{
    std::string boneName;
    std::vector<KeyFrame> keyframes;

    // These equations will be used to find the position/rotation/scale of
    // the bone at t time.
    std::vector<float> rotEqX, rotEqY, rotEqZ;
    std::vector<float> translateEqX, translateEqY, translateEqZ;
    std::vector<float> scaleEqX, scaleEqY, scaleEqZ;
};

Do I just calculate the equation every time I want to update the animation? (Seems a little inefficient?)

sentences:
Browser sandbox for object interaction testing I’m looking for a sandbox where I can upload/import STL or OBJ files (rigid bodies that I can export from a CAD software) for quick interaction testing with gravity and contact.

The idea is lowest friction possible for import/upload so that the time between file export from CAD software to testing of joints and such will be as quick as possible. So things like creating a sandbox template in Unity and then building the game every time would be out of the question.

Any ideas?

sentences:
Example of Data Oriented Design I can't seem to find a nice explanation of the Data Oriented Design for a generic zombie game (it's just an example, pretty common example).

Could you make an example of the Data Oriented Design on creating a generic zombie class? Is the following good?

Zombie list class:

class ZombieList {
    GLuint vbo; // generic zombie vertex model
    std::vector<color>;    // object default color
    std::vector<texture>;  // objects textures
    std::vector<vector3D>; // objects positions
public:
    unsigned int create(); // return object id
    void move(unsigned int objId, vector3D offset);
    void rotate(unsigned int objId, float angle);
    void setColor(unsigned int objId, color c);
    void setPosition(unsigned int objId, color c);
    void setTexture(unsigned int, unsigned int);
    ...
    void update(Player*); // move towards player, attack if near
}

Example:

Player p;

Zombielist zl;
unsigned int first = zl.create();
zl.setPosition(first, vector3D(50, 50));
zl.setTexture(first, texture("zombie1.png"));
...

while (running) { // main loop
    ...
    zl.update(&p);
    zl.draw(); // draw every zombie
}

Or would creating a generic World container that contains every action from bite(zombieId, playerId) to moveTo(playerId, vector) to createPlayer() to shoot(playerId, vector) to face(radians)/face(vector); and contains:

std::vector<zombie>
std::vector<player>
...
std::vector<mapchunk>
...
std::vector<vbobufferid> player_run_animation;
...

be a good example?

Whats the proper way to organize a game with DOD?

sentences:
Transforming quaternion between coordinate systems Working in DirectX (with DirectXMath objects): If I have the rotation of an object relative to some coordinate space as quaternion Q, and I have a transformation matrix tx from that coordinate space to world space, how do I find the rotation of my object in world space?

My thinking, which has proven inaccurate, was:
Use XMMatrixDecompose on tx to get the orientation that is the rotation difference between world space and my local coordinate space (qLocalToWorld), invert it to get the rotation of the local coordinate system relative to the world (qWorldToLocal) and combine it with my local rotation Q.

XMVECTOR scale, qLocalToWorld, translation;
XMMatrixDecompose(&scale, &qLocalToWorld, &translation, tx);
auto qWorldToLocal = XMQuaternionInverse(qLocalToWorld);
auto worldOrientation = q * qWorldToLocal;

I figured for e.g. that if the local coordinate system was rotated 90 degrees with respect to the world, and my object was 5 degrees with respect to local, this would yield the 90 + 5 = 95 in world space. But I was wrong :(

I'd appreciate help in understanding the right way to do this. Thanks in advance!

sentences:
Sprite sheet resolutions and Tile Maps I am making a game using Cocos2d-x and want to support multiple mobile phone resolutions and sizes.

Right now I have made my game sprite sheets set on a resolution of iPad Retina's resolution of 2048X1536 and then will use Tiled Map editor to design my game levels.

My question is on what basis do I scale my sprite sheets for different resolutions suppose iPhone etc so that my Tiled Map's design does not get effected when used in the game ?

sentences:
Unity ads displaying only unity products i just implemented unity ads on my project and now its only showing a single unity product each times. Can anyone suggest why? Thanks..

Here is some screenshot of the ad
1:
(https://i.stack.imgur.com/oG9vm.jpg)
2:
(https://i.stack.imgur.com/ZrS7x.jpg)

Can anyone tell me if this is even a real ad or just for testing?

sentences:
XNA significant loss in fps by just adding a few hundred thousand more triangles? I've got a minecraftish game that's running nice and smooth with a total of 9.3 million triangles, about 50-70fps average.  Then if I try to render 9.9 million triangles I get hell and it drops to < 1 fps.  I'm drawing them exactly the same way, it's definitely the drawing as I have a vertex buffer for each chunk, then I run through them all, check if they're in sight and if they are I draw them.  It works fine at high fps until I have just those few extra triangles which destroy the FPS.

Edit: Added drawing code:

First I loop through all the chunks.  I check if they're visible and if they are I mark them as visible then draw them.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.DrawThis)
                continue;

            if (!player.ViewFrustrum.Intersects(chunk.Bounding))
            {
                chunk.IsInSight = false;
                continue;
            }
            chunk.IsInSight = true;

            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.VertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.IndexBuffer;

            ChunkShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.VertexBuffer.VertexCount, 0, chunk.IndexBuffer.IndexCount / 3);
        }

Then after that I draw all the transparent parts of the chunk (so they don't conflict with other chunks).  I already made clear if they're visible above so I just check if that bool is true.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.IsInSight || !chunk.DrawThisTransparent)
                continue;
            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.TransparentVertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.TransparentIndexBuffer;

            ChunkTransparencyShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkTransparencyShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.TransparentVertexBuffer.VertexCount, 0, chunk.TransparentIndexBuffer.IndexCount / 3);
        }

With 3721 chunks loaded it runs fine with them all being drawn at the same time.  With 3844 chunks being loaded it runs fine unless you view all of them.  Now that's only just over 100 more chunks yet it's dropping from 60fps to < 1 fps.

sentences:
Wrong Second position of LineRenderer I'm drawing some kind of bullet trace effect with LineRenderer in my 2D Game Project with Unity. At some position, setting position of LineRender result weird:

In the above screenshot, you can see two types of lines are exists. Pure red lines are result of Debug.DrawRay which is only renders in Scene view, not actual game play, and another lines which has yellow to red gradient are actual line renders I want to draw.

I used exactly same code for rendering both two, Debug.DrawRay() and LineRenderer.SetPosition(), but as you can see only DrawRay works as I expected and LineRenderers are cutted and pointing wrong direction.

Here's the code I'm trying:

void Fire() {
    Vector3 shootDirection = m_ShootPoint.right;

    RaycastHit2D hit = Physics2D.Raycast(m_ShootPoint.position, shootDirection, m_Range);
    Debug.DrawRay(m_ShootPoint.position, shootDirection.normalized * m_Range, Color.red, 20);

    // On Hit, set end position where it hits
    if (hit) {
        CreateBulletTrace(m_ShootPoint.position, hit.point);
    }
    // Otherwise, render straight until it's range
    else {
        CreateBulletTrace(m_ShootPoint.position, shootDirection.normalized * m_Range);
    }
}

void CreateBulletTrace(Vector3 startPos, Vector3 endPos) {
    GameObject bulletTraceObj = Instantiate(m_BulletTraceLineRendererPrefab);
    LineRenderer bulletTraceLineRenderer = bulletTraceObj.GetComponent<LineRenderer>();
    bulletTraceLineRenderer.useWorldSpace = true;

    bulletTraceLineRenderer.SetPosition(0, startPos);
    bulletTraceLineRenderer.SetPosition(1, endPos);

    // Destroy(bulletTraceObj, 0.1f);
}

Note that LineRenderer checked use world space to true. What am I missing?

Using Unity 2019.1.0f2.

sentences:
C# invoke stops unity I'm making a game where in needs to randomly generate objects on a plane, so I setup a code to spawn Food, but whenever I run the code Unity uses up all my computers memory and 40% cpu.  I have a fairly good computer and have no issue with anything else in the project.  The code has worked when I called it in FixedUpdate but as soon as I try and call it in an invoke it just breaks everything.  I have only started working with unity for less than 24 hours so I don't really know what could be wrong, since I didn't get any errors or warnings.

using System.Collections;
using UnityEngine;

public class SpawnFood : MonoBehaviour
{
public Rigidbody Food;
public float x;
public float y;
public float z;
public Vector3 pos;
public float spawnTime;

void FixedUpdate()
{
    Start:
    Invoke("FoodSpawn", spawnTime);
    goto Start;
}

void FoodSpawn()
{
    x = (UnityEngine.Random.Range(-110f, 110f));
    z = (UnityEngine.Random.Range(0.50f, 0.51f));
    y = (UnityEngine.Random.Range(-50f, 51f));
    Vector3 pos = new Vector3(x, z, y);
    Instantiate(Food, pos, Quaternion.identity);
}

}

sentences:
android game using bullet and libgdx i'm developing a android project for school and i'm currently using libgdx for rendering. It performs quite well, but it lacks a 3d physics library. So i searched and found that Bullet physics engine was ported to android through NDK (c++). Did anyone try to connect this two libs together?

I've never used a physics engine/library before (i've mainly developed 2d games so i've made one my self) and wanted to ask if any one had any previous experiences with implementing bullet and libgdx? To be more precise i need to simulate a jump and implement physics like: wind/drag, friction, lift, gravity; during the jump.

Does bullet calculate the gravity and other forces by it self (if so can i implement other forces easily?) or can i control which element gets updated (mainly re transformed) and when? How does collision detection work (is there some kind of collision world/collection)? Can i handle collision detection on my own or does bullet take care of this as well?

Thanks for the reply's!

sentences: Inverse of perspective matrix, for what? I dont understand for what i need the inverse of the perspective Matrix in Computer Graphics and how do i calculate it?Maybe someone has an explanation for me.

sentences:
creating levelup stats based on curves I'm creating a simple level-up system and I'm looking to base the stats gain on curves so I can tweak them easier, I know it's a math function, but I have no idea what to search for.

I need to create this curve and get the value every x increment.

the engine I'm using is Ren'py and the language python. if you can tell me the terms to search for, I might be able to find something on the topic.

sentences:
Monogame - Problem with lighting 3d mesh I am having an issue with lighting my 3d icosphere. For some reason,the lighting appears to be coming from the correct direction  (+X, -Y, -Z) but it also appears to be coming from (-X,+Y,+Z) and I have no idea why. I am not very well versed in 3D in Monogame yet, can anyone point me in the right direction of what is going on here?

EDIT:

The code for the shader

VertexToPixel ColoredVS(float4 inPos : POSITION, float3 inNormal : NORMAL, float4 inColor : COLOR)
{
    VertexToPixel Output = (VertexToPixel)0;
    float4x4 preViewProjection = mul(View, Projection);
    float4x4 preWorldViewProjection = mul(World, preViewProjection);

    Output.Position = mul(inPos, preWorldViewProjection);
    Output.Color = inColor;

    float3 Normal = normalize(mul(normalize(inNormal), World));
    Output.LightingFactor = 1;
    if (xEnableLighting)
        Output.LightingFactor = dot(Normal, -xLightDirection);

    return Output;
}

PixelToFrame ColoredPS(VertexToPixel PSIn)
{
    PixelToFrame Output = (PixelToFrame)0;

    Output.Color = PSIn.Color;
    Output.Color.rgb *= saturate(PSIn.LightingFactor) + xAmbient;

    return Output;
}

And this is for calculating normals

            for (int i = 0; i < Vertices.Length; i++)
                Vertices[i].Normal = new Vector3(0, 0, 0);

            for (int i = 0; i < Indices.Length; i += 3)
            {
                Vector3 p1 = Vertices[Indices[i]].Position;
                Vector3 p2 = Vertices[Indices[i + 1]].Position;
                Vector3 p3 = Vertices[Indices[i + 2]].Position;

                Vector3 v1 = p2 - p1;
                Vector3 v2 = p3 - p1;
                Vector3 normal = Vector3.Cross(v1, v2);

                normal.Normalize();

                Vertices[Indices[i]].Normal += normal;
                Vertices[Indices[i + 1]].Normal += normal;
                Vertices[Indices[i + 2]].Normal += normal;
            }

            for (int i = 0; i < Vertices.Length; i++)
                Vertices[i].Normal.Normalize();

sentences: Why did the old 3D games have "jittery" graphics? I've been playing "MediEvil", lately, and it got me wondering: what causes some of the old 3D games to have "flowing" graphics, when moving? It's present in games like "Final Fantasy VII", "MediEvil", and I remember "Dungeon Keeper 2" having the same thing in zoom mode. However, examples like "Quake 2" didn't have this "issue", and it's just as old. The resolution doesn't seem to be the problem, everything is rendered perfectly fine when you stand still. Is the game refreshing slowly, or is it something to do with buffering?

sentences:
Changing animation speed at runtime Is there a way in Unity to change the animation speed of an animation managed by an animator controller (Mecanim)?

I'd like to do that at runtime so that I can speedup and slow down an animation based on conditions in code.

sentences:
Video playback in games - formats & decoding What free / non-restrictive open-source solutions (not GPL) are available for decoding game videos?

The requirements are simple:

a relatively easy to use C API
encoded files must be quite small
there must be an application that converts videos from any format (whatever codec is installed on Windows or equivalent amount of internally decoded formats)
decoding has to happen fairly quickly
bonus points go to file formats that are popular / actively supported and
developed

sentences:
Spot the difference game design help I'm thinking of making a spot the difference game. But immediately I stumbled over a problem. I'm thinking of storing a "difference area" in the form of a x,y coordinate. However, because on a smartphone it will be difficult selecting the exact pixel at that location, I need a way of checking if the "area" is within the "touch area". I hope that makes sense. I've attached an image to help you understand

In this example the "difference point" is located at -180,-140. A user could touch anything within 5 pixels of that and that will be marked as a correct answer. So touching -177, -147 would also be correct. How can I check if the touch-coordinates are within a 5 pixels radius of the correct "difference point"?

sentences:
Keyboard and Mouse callbacks in GLUT I'm using OpenGL via GLUT in Ubuntu.

While writing text in a text editor, the first keystroke is printed immediately.
But if we keep pressing the key, it waits for a moment and then prints a trail of that character.

This is to reduce the sensitivity while typing.

With GLUT, function callbacks for keyboard behave like that.

glutKeyboardFunc( keyboard );
glutKeyboardUpFunc( keyboard_up );

Now if we keep pressing a key, there is a considerable delay between the first and the second call of keyboard ( and keyboard_up) function. But in real gaming, this not should be the case.

Question 1: How to solve the problem?

Question 2: keyboard_up gets called even if I press and hold a key. Why so? I think it is supposed to get called only when I release it. Moreover, this also suffers from the above jerk problem.

Question 3: For glutMouseFunc( mouse ), the mouse function gets called whenever we press or release a mouse button. I want this too to get called repeatedly if I press and hold my mouse button, and that too without jerk. How to do so?

sentences:
most efficient way to create a grid system in unity I'm creating a little tower defence game to get myself acquainted with unity.

At first I was going to emulate a grid system by capturing touches / mouse clicks and rounding the coordinates to the nearest whole numbers. This is very low cost and works well for placing things, however I'm a bit of an AI geek and I've decided to make a more tangible grid so that the agents can run searches on it for pathfinding.

For this I'll need a grid of nodes and for those nodes to have a bit of information attached. Would it be a much better idea to do this entirely in code? Or could I get away with placing actual cubes in a big grid on the map?

This would certainly be easy as then I could ray cast against them - but I've tried this and rendering that many cubes slows down the game a lot!

I suppose my question is - is it unnecessarily expensive to have a load of cubes set up like this, but not rendered? Or should the cost of having a load of cube shaped collision volumes be only marginally more expensive than emulating this in code? (if at all...)

Also as a side question - should I be able to render say, 200 cubes and have a smooth game? Am I missing some instancing options? I presumed things would be automatically instanced.

sentences:
How to make TMXTiledMap responsive? I've been struggling with Cocos2d-x (C++) and finally I got to the point I feel more or less comfortable with that.

My game is a 2D car-based one, with a straight infinite map where I've finally been able to add some random obstacles. There are only 3 positions the car can be at, and everything is working fine.

The point is that I've recently noticed that it is not responsive, and tried to make it responsive by adding a line like these one to the AppDelegate.cpp:

glview->setDesignResolutionSize(1024.0, 600.0, kResolutionFixedWidth);

I've tried to use kResolutionFixedWidth, kResolutionFixedHeight and all others 5 variables you can put there, but I only got black lines along the screen and every single screen breakdown you can imagine -.-'

I can figure out I need to resize my TMXTiledMap manually because of the nature of tiles (I did it with Tiled), but I don't know how to face this problem.

Note that I'm currently developing for a 1024x600 Android device but I would want to support at least the most common resolutions for both tablets and smartphones.

Thanks in advance to anyone who can help me in some way.

sentences:
Which platform and what strategies can I use There's this game, that I've been wanting to make for quite some time. It's a project that I've started and had to abandon in the middle a couple of times. However, this time I'm determined to finish it. I want to make a RPG (tile based) game, I'm okay with having it be 2D but am considering something in the middle of 2D and 3D. I would also like the game to be at least partially multilayer if not an MMO. I'm not a bad programmer, so I can work my way through any problems I might come across, I just don't have any experience making games, so I'm interested in any technologies I can use that I might not yet be aware of, or what type of architecture I can implement and what strategies I can use to make a decent (and secure game).

I made this game (2D tile based and partially multiplayer) before using MySql, PHP and JavaScript/Ajax. But now I would like it to be a bit more advanced with fluid graphics, and multiplayer where user's (or at least friends) can explore the maps together.

My first thought was to use Flash, PHP and MySql. Where Flash calls to a php file that returns an xml object with coordinates and etc., but I'm not sure how fast or efficient this will be.

With all that said, I'm wondering if anyone has any suggestions to what other technologies are out there that I can use. I would prefer that the game is browser based, but if it has to be run on the desktop I would like it to be at least cross-platform. I am familiar with HTML, JavaScript/jQuery, PHP, Flash, C#, WPF/XAML already and would prefer a combination of what I already know, but I don't mind learning something new either.

Any helpful links on this are appreciated as well.

Thanks in advance!

sentences:
What values to construct "Projection Matrix" from? I am curious to what standard values I should use to create a camera's projection matrix, as well as if certain measurements need to be taken if I want to represent a very small world or a very big world and make it feel natural.

What values (field-of-view, nearplane, farplane) to construct a projection matrix should be used if:

1 unit to represent 1 meter?
1 unit to represent 1 cm?
1 unit to represent 100 meter?

sentences:
Saving and retrieving high-score data in XNA 4.0 I made a game in XNA 4.0 and now I need to save the points in a database or in a file (or in something else). My goal is to store and retrieve the highest score if I choose that option in the main menu. What I found on the internet is not complete, or whatever, useless for me.

What techniques can I use with XNA to save and load data?

sentences: Money Every Minute System? I'm making a 2D sandbox tycoon in UE4. I haven't started the money system yet, but I was wondering how I could make a money system that gives you a certain amount of money per real-life minute. Then, I want to connect this system up to some text so that the digits go up by whatever amount each minute.

sentences:
Does SFML render it's graphics using OpenGL internally? By that, I mean that SFML has an abstraction for OpenGL? Sort of like SDL's blit functions, but using OpenGL internally?

"Yes SFML uses OpenGL for all the graphical stuff. "

Received this comment in an earlier question, which sort of baffled me since I find nothing about it.

sentences:
Weapon RPS - circular list; troubles keeping circular list balanced when expanding I've got a idea for a game in the works, and I'm trying to figure out how to sort 17 weapons into a circular list where each weapon beats the 8 below it but loses to the 8 above it. Currently, I only have an RPS-5 figured out where each beats the 2 below it but loses to the 2 above it:

bow
daggers
magical orb
gun
glaive

I then set out to try to expand it into an RPS-7, starting by adding one weapon and creating a placeholder spot to find the most appropriate weapon for. I came up with "spear", which I determined beats "magical orb" and "glaive" but loses to "bow", "daggers", and "gun". What with "gun" being smack between the two things that "spear" beats though, where do I put the placeholder spot? I'm assuming if it's even possible without giving up on my well thought reasons for why what beats what I'll need more than 1 placeholder spot to find an appropriate weapon for.

Is it at all possible to place the placeholder spots such that "spear" ends up above "magical orb" and "glaive" while still being below "bow", "daggers", and "gun"? Or will I have to either alter an interaction or see if I can create a perfectly imbalanced RPS?

If this question would benefit from additional tags, please let me know.

sentences:
Why isn't this physics code scaling velocities separately? I'm working my way through this book and I'm trying to work this code out:

var squaredVelocity = this.velocity.x*this.velocity.x
                    + this.velocity.z*this.velocity.z;

if (squaredVelocity > Player.SPEED*Player.SPEED) {
   var scalar = Player.SPEED / Math.sqrt(squaredVelocity);
   this.velocity.x *= scalar;
   this.velocity.z *= scalar;
}

The book doesn't explain it. I've been staring at it for an hour. I can see exactly what it does (in the technical sense), but what's its purpose?

I understand bits: The scalar variable is always a fraction, so multiplying the velocity by it scales back that velocity.

Is this code for limiting speed? Then why are the x and y velocities added together? Shouldn't the X and Y be scaled independently?

Do I need to know this stuff for a career in video games? I understand that all this math is educational, but will I still have to do this sort of thing in an engine like Physijs?

sentences:
How will the velocities of two moving objects change once they collide? I'm making a small game where things can fly around and collide. Things like boxes and so on. For each object, I have an array of all forces acting upon it, I have it's mass, it's position and it's velocity in both directions (a 2D vector). I know how to detect collision between them, but I just don't know how to react.

I used to calculate their orientation towards each other, it they were on top one another, I would just negate their y speed (v.y = -v.y), and if they were next to each other on the x axis I would negate their x speed (v.x = -v.x).

Now, this isn't very realistic, so, how do I do it? All objects are rectangles represented by [x, y, w, h] vectors.

Objects can't rotate.

sentences:
Speed of procedural geometries I'm evaluating solutions for creating a VR videogame that should run on cellphones. The assets will be streamed from our servers and that could be a problem on limited capabilities devices.

Since the geometries are not going to be too complex (mostly boxes and wardrobes) I was thinking about procedurally generating them.

Is generating geometries procedurally usually faster or slower than just streaming a bunch of vertex data?

sentences: What is this tracking circle called as? I don't know what the circle in the image below used for changing directions and movements of a character is called. Can anyone provide me anything related to it? I want to include it in my game.

sentences:
Gradually reduce speed Basically I am working on following application of android version
Party Games: Drinking Wheel

For this I want to rotate wheel and want to stop wheel at specific point. But I want this with gradually decreasing speed. For example at start I have speed of 10 then at stop time it at 0. So wheel stop smoothly.

At presently I have working code but it stop suddenly.

registerEntityModifier(new RotationModifier(desireTime, 359f,
            desireRotation, new IEntityModifierListener() {

                @Override
                public void onModifierStarted(IModifier<IEntity> pModifier,
                        IEntity pItem) {
                }

                @Override
                public void onModifierFinished(
                        IModifier<IEntity> pModifier, IEntity pItem) {

                    mPointer.stopRotation();
                    showWindowAfterSomeTime(randomSegment);
                }
            }, EaseLinear.getInstance()));

I want some help in this. Thanks for your time.

sentences:
Given a 3d goal point and a turn rate in radius, find max speed to reach goal I'm working on a 3d space sim with AI agents flying ships through space. I am trying to get them to follow a waypoint path nicely, which involves figuring out how fast they can be travelling and still manage to pass through the waypoint.

Given a point in 3d space and an an agent that only travels forwards and has a given turning rate in radians / second and an acceleration rate, how can I find the maximum speed the ai can travel and still manage to face the point before overshooting it?

Can any math wizards lend a hand?

public class AIPilot { //relevant fields from my class
   float turnRate_radians;
   float acceleration;
   Transform transform;

  public float FindMaxSpeedToFace(Vector3 goal) {
    //trying to fill the body of this method
  }
}

sentences:
How should the actual game interface with the menu system I'm using the Game State Management (GSM) concept in my prototype and I like it very much. One of the screen has a "Game" embeded in it, where all the "good stuff" happens. The menu launching the game works fine, but I'm not sure how I should allow the game to request a screen from the ScreenManager. I'm not talking about a menu screen, but about something contextual to the game.

For clarity's sake, let's say that when I click on a game element (a rendered model for example) I want a screen that asks me what color I want that model to be drawn next. Right now, my game knows that model is "targeted" with the mouse (I use a Ray picking approach).

I looked at the Role-Playing sample to see how they did this, but when their GameScreen handles the keys, to open the inventory for example, it's never contextual to what's actually happening in the GameScreen.

Ideas welcomed!

Edit: The game must also be able to get a feedback or something from the "contextual screen" to get the new model color, for example.

sentences:
Super formula on shader I'm using Shader-toy to experiment and try to learn a bit the shader science.
As exercise I wan to replicate some of the wikipedia math plots. I've started with a Super Formula.

What I want to achieve is this:

(taken from this wikipedia image)

This image shows the parameter of the super formula thing:

a=b=1,
m=3,
n1=5,
n2=18 and
n3=18

I've looked for a similar example, simplified it and try to reproduce my curve.

In shader-toy this is my code:

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    // Variables to be fed into the formula
    float a = 1.0;
    float b = 1.0;
    float m = 3.;
    float n1 = 5.0;
    float n2 = 18.;
    float n3 = 18.;

    vec2 uv = fragCoord.xy / iResolution.xy;

    // translation
    vec2 sf = uv - 0.5;

    // r of the current point
    float pr = sqrt(sf.x*sf.x + sf.y*sf.y);
    // Angle (Phi) of the current point
    float f = atan(sf.y/sf.x);

    // The formula itself. Division by 10.0 added to scale the result down a bit.
    float r = pow((pow(abs(cos(f*m/4.0)/a),n2) + pow(abs(sin(f*m/4.0)/b), n3)), -(1.0/n1)) / 10.;

    // Output with coloring by relative radius
    fragColor = (pr <= r) ?
        vec4(1., 0., 0., 1.0) :
        vec4(0.1, 0.1, 0.1, 1.0);
}

But I'm achieving a different shape:

What am I doing wrong?

sentences:
Background color gradient with SDL I want to create a menu for a game using a color gradient as the background. Is there a way to create a gradient background instead of using an image for it (since I don't know what size the window will be, using an image is no option).

Please note: I need to achieve this using only the C standard library and the SDL, no other library and no C++.

sentences:
Pointer deleted by object manager on next frame I have a class named GameManager, which job is to manage GameObject allocation and deallocations. The thing is, every GameObject can interact with each other, so there's a possibility that a pointer to another GameObject in a GameObject's script becomes deleted by manager the next frame. (Something like a missile, the missile's target may be already destroyed by another object)

I can't use shared pointer because there are times where a GameObject should be removed, but can't be removed because a GameObject won't release. What is a good design pattern to tackle this problem? Or should GameObject check for null each time?

sentences:
What makes a game look "good"? I am working on a 3D space game using OpenGL and C++ and I am planning to focus on giving the game modern, eye-catching graphics, but the more I think of it the more I realise I don't really know what makes graphics "good". Sure, I can go and play some well known AAA games and bask in the amazingly put together graphics, but I don't really know how the graphics looks good. (this is why I consider games to be an art!)

This is what I can think of now:

High quality textures
High quality models
A good lighting model
Bumpmapping + specularity mapping
High quality UI, if applicable
A wealth of not-overdone posteffects

I'm asking here in the hope of an experienced game developer who has produced games and know how they work inside and out can explain some techniques that warrant a game's graphics to look "good", and some not-well-known quirky tips. That'd be awesome.

Thanks!

sentences:
Unity, Player isnt following along the waypoints I have a player with a Rigidbody, I want it to follow along the Waypoints, I have a script for it I tested it first on a Cube, everything worked fine, but on my character it just moves Towards the first waypoint then stays on the first waypoint instead of going ahead. Even if I comment out the LookAt Code section its not working. It could maybe cause the Y position of the waypoints that my player is stuttering, I changed it now. It is now moving along but stuttering much.

Here is a picture of the problem:

Here is my code:

public GameObject[] waypoints;

public float grindSpeed;
public float turnSpeed;

public int currentWaypoint;

private Animator anim;
private Rigidbody rb;

public bool isGrinding = false;

void Start()
{
    anim = GetComponent<Animator>();
    rb = GetComponent<Rigidbody>();
}

void Update()
{
    MoveAlongWaypoints();

    if(isGrinding)
        anim.SetBool ("isOnGrinding", true);
    else if(!isGrinding)
        anim.SetBool("isOnGrinding", false);
}

void MoveAlongWaypoints()
{
    if(isGrinding)
    {
        //TRANSLATE
        transform.position = Vector3.MoveTowards(transform.position, waypoints[currentWaypoint].transform.position, grindSpeed * Time.deltaTime);
        //ROTATE
        var rotation = Quaternion.LookRotation(waypoints[currentWaypoint].transform.position - transform.position);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, turnSpeed * Time.deltaTime);

        if(transform.position == waypoints[currentWaypoint].transform.position)
        {
            currentWaypoint++;
        }
    }
}

void OnTriggerEnter(Collider other)
{
    if(other.gameObject.tag == "GrindWayPoint")
    {
        Debug.Log ("Waypoint!!");
        isGrinding = true;
    }
}

sentences:
How to create video from camera? I have a 3d scene and a camera; I want to create video file from camera pre-set movements.
If it is possible, running application by command line (without needed to "show" at video, my camera) .

Is it possible in Unity ?

If yes what's the best approach ?

Thanks

sentences:
Roulette Table Ball Movement Creation I am developing following type of game Roulette Royale.

I am basically ready with wheel and number table. When user move wheel table then ball also move on that table and stop at particular number and reply to number table with that number.

Right now I only used RotationModifier and there is no position change at present only ball rotate and stop at randomly selected number. This thing work well.

But I want ball start its movement from out side the wheel and slowly move inside in to the wheel. It perform rotation as well as smoothly move towards the center of the wheel. This functionality I don't able to conceptualise how to create?

I think there is no need to put any code snippet here because I need only concept how to perform this task. Thanks in advance efforts you take for me.

sentences:
Why is Unity3D on OSX ignoring my XBox 360 controller? I'm using a fork of the Tattie Bogle driver that has a signed kext. The System Settings panel shows all inputs correctly.

One axis is configured in Unity3D 5 like this:

Still, I don't see any input when the game is running. I also cannot configure Positive/Negative Buttons for any input in the Input Manager panel - clicking the input line edit and entering a keyboard key works fine, but pressing a controller button does nothing.

What am I missing here?

sentences:
Can Unity support / use textures that are not square? I have been told by another highly skilled Unity artist that Unity cannot efficiently handle non square images. Since that doesn't sound right to me, I wanted to get a second or third confirmation to that claim.

Having worked in the game development industry for almost 15 years, I have always understood that best practice was keeping in powers of two, but that if the UV map called for it, a 1024x512 map was acceptable, rather than using a 1024x1024 map with 1024x512 pixels of wasted UV space. Granted, that was best practice on game engines other than Unity.

Can anyone confirm that in Unity's case, it is better (best practice) to have a 1024x1024 image containing UV islands occupying 1024x512 pixels, rather than using a 1024x512 image map to exactly accommodate the UVs?

Which platforms can use non-square images and which ones cannot with the Unity engine? I am particularly interested in whether or not this limitation affects PC builds.

sentences:
What elements are indispensable to players of a tactical strategy game? Tactical strategy games typically involve area capture/control, unit building, terrain effects, various specialized unit types. Some will include resource gathering / management, unit customization / advancement, experience benefits for units, tech / research trees, and commander powers.

Many are turn based to allow careful planning, while others are real time. Some have movement and targeting restricted by a grid, while others calculate rate of speed and distance - and in the case of 3d or pseudo-3d arcs of fire in vertical elevation. A few have side quests, a plot / story line - possibly branching, and an overall theme or genre of some type (sci-fi, fantasy, modern, etc). User interface elements are also critical to consider.

Of these elements, and any additional elements not listed that can be thought of, which are the most indispensable? Which elements make or break a game, and keep you coming back or drive you away? Please provide only the top three answers with supporting explanations and references, if available. Should platform impact the answer, please assume a game developed for both mobile devices and computers.

sentences:
2D Collision detection on server side Has anyone have experience implementing collision detection on server side? I am writing a top down 2D multiplayer game. All the players are constantly moving. I want to implement collision detection on the server side so at any time the server will know which player collide with which player and broadcast the result.

The problem is if I use brutal force collision detection to detect collision of every player the resource consumption on the server will be huge (my game updates 60 times a second).  I only have experience detecting collisions on client side where I can use broad-phase collision detection such as spatial partitioning. But I have thought about that on server side the server has to know the state of every player so detecting collisions only in a small area doesnt make much sense. So do I have other more efficient algorithm for collision detection on server side?

Here is how I do this:

I pick a moving sprite from the sprite array
do a spatial hashing for it and get some nearby sprites
based on the above method, I loop through the entire sprite array
and pick one by one to get some nearby sprites
I put all the results into a big array and it will store all the
    sprite for collision detection.

Because I need to send out state information to every moving sprite/entity I have to loop through the entire entity list to do spatial hashing for each one.

UPDATED:

I have get answers from gamedev.net forum. What I thought I should be doing was wrong. I don't need to compute all nearby entities for all the entities in one go. All I need to do is loop through the entity list and when I need to send out the nearby bucket list for an entity I do a spatial partitioning for that specific entity. I don't need to do this on every frame. In fact maybe I just need to do it 5 or 10 times per second.

sentences:
SDL_UpdateTexture is slow I am raytracing on the CPU and I need to display my renders to the screen in realtime. I chose SDL 2 as it seems to be made for low level stuff.

I made this basic test which fills the screen from left to right, one column of pixel per frame. It works as expected, but runs very slowly (~10 fps):

int resolutionX = 1920, resolutionY = 1080;

if (SDL_Init(SDL_INIT_VIDEO) != 0)
    return EXIT_FAILURE;

SDL_Window *window = SDL_CreateWindow("Hello World!", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, resolutionX, resolutionY, SDL_WINDOW_SHOWN);
SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
PixelBuffer *framebuffer = createPixelBuffer(resolutionX, resolutionY);
SDL_Texture *framebufferTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING, framebuffer->width, framebuffer->height);

for (int x = 0; x < resolutionX; x++)
{
    for (int y = 0; y < resolutionY; y++)
        setPixel(framebuffer, x, y, 0x123456FF);

    SDL_UpdateTexture(framebufferTexture, NULL, framebuffer->pixels, framebuffer->pitch);
    SDL_RenderCopy(renderer, framebufferTexture, NULL, NULL);
    SDL_RenderPresent(renderer);
}

SDL_DestroyTexture(framebufferTexture);
destroyPixelBuffer(framebuffer);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();

I found SDL_UpdateTexture to be the slowdown.

I heard of SDL_LockTexture but I don't think I should be using it for write-only operations.
EDIT : SDL_LockTexture is in fact exactly made for write-only operations.

Am I using this function in a wrong way ? Is there any other way to display my renders in real time ?

sentences:
How do you calculate game map changes, over time, when the user is not online? With a game like "Farmville", there is both processing during gameplay, and when the user is offline (plants are always growing, for example). Many of the game maps elements depend on time.

Is there a trick to make this scale?  How can you possibly calculate 1 million users maps being modified every couple of seconds? Some of these games alert you, when things have changed, so it is not like they calculate everything when you login to the system.

How do you calculate game map changes, over time, when the user is not online?

sentences:
glTextImage2D with GL_UNSIGNED_BYTE giving weird results while with GL_FLOAT just works, driver bug? Update: OK, not being able to see the textures loaded by FreeImage was just one of the common mistakes when using modern OpenGL. My texture loading code did not set GL_TEXTURE_WRAP_S/T and GL_TEXTURE_MIN/MAG_FILTER, and didn't have any mipmaps either: Textures "don't work" when I don't specify any texture parameters. Is this a driver bug or intended behavior?

May then the random colors I'm getting with the testing code be caused by the texture being too small? Maybe If I hardcode a 64x64 red square I will get same results in both cases. It is still weird that with float it works at 2x2 size.

I hit a wall trying to rewrite old sprite rendering code based on SDL to use modern OpenGL directly.

I'm loading images using FreeImage library and I already confirmed that the pixel data in memory is as expected. But at rendering I was getting no textures. So I harcoded a 2x2 image as a single dimensional array to pass to glTexImage2D and found something weird. When using float, result is as expected but when using char or uint8_t I get random colors.

Test code with floats:

        float pixels [] = {1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
                           1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f};

        glGenTextures(1, &mRedSquareTex);
        glBindTexture(GL_TEXTURE_2D, mRedSquareTex);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_FLOAT, pixels);

Test code with uint8_t:

        uint8_t pixels [] = {255, 0, 0, 255, 0, 0,
                             255, 0, 0, 255, 0, 0};

        glGenTextures(1, &mRedSquareTex);
        glBindTexture(GL_TEXTURE_2D, mRedSquareTex);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, pixels);

I think that if I walk pixel by pixel the data I'm loading using FreeImage and write them to a float array, I can finally see the textures loaded from disk. But It would be nice to just be able to use them as they are. As I'm not sure about the channels ordering of images loaded with FreeImage I'm avoiding the alpha channel for now, until I confirm the channels order, but in theory, as long as I avoid the alpha channel, I must be able to see the texture drawn, maybe with the wrong colors.

Shaders don't do anything special yet. The Vertex Shader just pass the textures coordinates as they are and the Fragment Shader just call texture().

I'm testing this in a machine with a NVidia GT 640, driver version 340.93, Ubuntu 14.04 64 bits.

sentences:
How to disable touch in Quintus? I'm  trying to build card game using the Quintus game engine. I have objects called Card. I can touch and drag it in the screen but I want just to touch and drag it one time but I can't figure out how to disable the touch after I dragged the card and I try to Google it but no luck.

My code:

Q.Sprite.extend("Card", {

init: function(p){

    this._super(p,{
        asset: "Queen_OF_Hearts.png",
        x: Q.el.width / 2,
        y: Q.el.height - 120
    });

   this.on("drag");
   this.on("touchEnd");
},

drag: function(touch) {
   this.p.dragging = true;
   this.p.x = touch.origX + touch.dx;
   this.p.y = touch.origY + touch.dy;
 },

touchEnd: function(touch) {
   this.p.dragging = false;
   // put a line on the screen if the card pass it put the card in the new position if not put the card in the orginal(old) postion
   if(touch.origY + touch.dy > Q.el.height - 200) { //define the line that the card should pass if the amount of draged > the screen line in Q.el.height - 200
       // put the card in the same old postion if is not pass the line
       this.p.x = touch.origX;
       this.p.y = touch.origY;

    } else {
        // put the card if it pass the line in the new postion
        this.p.x = Q.el.width / 2;
        this.p.y = Q.el.height - 280;

    }
}
});

so in the else statement in the touchEnd I'm trying to do some thing like that

this.p.touch = false;

but is not working.

sentences:
What does SlerpUnclamped do? Unity has a Slerp method:

public static Vector3 Slerp(Vector3 a, Vector3 b, float t);

Where it returns an interpolated position between a and b by the percentage of t.  So if t = 0.5, and a = Vector3.zero, and b = Vector3.one, it returns a Vector3 of (0.5, 0.5, 0.5).

But what does SlerpUnclamped do?

public static Vector3 SlerpUnclamped(Vector3 a, Vector3 b, float t);

t is not clamped between 0 and 1.  So what what is t relative to?  How do you use this method?

sentences:
How can I store spell & items using a std::vector implementation? I'm following along with a book from GameInstitute right now, and it's asking me to:

  Allow the player to buy and carry healing potions and potions of
  fireball. You can add an Item array (after you define the item class)
  to the Player class for storing them, or use a std::vector to store
  them.

I think I would like to use the std::vector implementation, because that seems to confuse me less than making an item class, but I am unsure how to do so. I've heard from many people that vectors are great ways to store dynamic values (such as items, weapons, etc), but I've not seen it used.

sentences:
Should my platformer have collectibles? By collectibles, I mean objects that you collect mainly for the sake of collecting them, not to power up. Think coins in Super Mario or bandages in Super Meat Boy.

I've seen a few platformers that do not have any collectibles and it's the platforming itself which is challenging (my platformer itself is challenging), but I think adding collectibles will add extra challenge and re-playability, especially if some of the collectibles are really well hidden. Tradition would dictate that you should have collectibles, as it's a way for players to gain extra lives or even gain points, but that would not be the only reason to have collectibles.

I'm not interested in making features for feature sake. I'm purely wanting an opinion on whether collectibles should be included in a game and what should the collectibles do when you collect enough? Is a simple +1 life fine? Should there be some cool object you get? Possibly should collecting really change something hectic, like collect 100 coins and your character is invincible?

How do I decide if my platformer should have collectibles?

Closed. While I disagree with the closing as according to the FAQ What should be asked game design (level design, gameplay, mechanics, etc). I got some nice pros and cons from everyone. I have updated the question slightly to be more specific.

sentences:
Algorithm to make entities closely follow one another? I have a group of entities that I want to follow a leader very closely. A good example would be how the player's soldiers move in Cannon Fodder.

Any suggestions for achieving movement like this?

sentences:
Creating a custom Editor Window using a Multi Column Header Hey there I'm trying to use the MultiColumnHeader to create a tool to view materials in the scene, inspired by the light explorer. The problems I'm facing are two fold. First I can't figure out how to place the content of the  MultiColumnHeader in a scrollable view and secondly I can't figure out how to give the rows a different background color that alternates like in the light explorer. This is my OnGUI code:
 void OnGUI()
    {
        windowVisibleRect.width = position.width;
        windowVisibleRect.height = position.height;
        // draw the column headers
        var headerRect = windowVisibleRect;
        headerRect.height = columnHeader.height;

        float xScroll = scrollPos.x;

        columnHeader.OnGUI(headerRect, xScroll);

        // draw the column's contents
        for (int i = 0; i < columns.Length; i++)
        {
            // calculate column content rect
            var contentRect = columnHeader.GetColumnRect(i);
            contentRect.x -= xScroll;
            contentRect.y = contentRect.yMax;
            contentRect.yMax = windowVisibleRect.yMax;
            Rect rowRect = new Rect(contentRect.x, contentRect.y, windowVisibleRect.width,20);
            for (int j = 0; j < analyzerList.Count; j++)
            {

                Rect MatcellRect = columnHeader.GetCellRect(0, rowRect);
                Rect ShaderCellRect = columnHeader.GetCellRect(1, rowRect);
                Rect GameObjectsRect = columnHeader.GetCellRect(2, rowRect);
                rowRect.y += 25;
                EditorGUI.ObjectField(MatcellRect, GUIContent.none, analyzerList[j].mat, typeof(Material), false);
                EditorGUI.ObjectField(ShaderCellRect, GUIContent.none, analyzerList[j].shader, typeof(Shader), false);

                analyzerList[j].ShowGameObject = EditorGUI.Foldout(GameObjectsRect,analyzerList[j].ShowGameObject, "Show " + analyzerList[j].gameObjects.Count + " GameObjects");
                if (analyzerList[j].ShowGameObject)
                {
                    foreach (GameObject go in analyzerList[j].gameObjects)
                    {
                        GameObjectsRect.y += GameObjectsRect.height;
                        EditorGUI.ObjectField(GameObjectsRect, GUIContent.none, go, typeof(Material), false);

                        rowRect.y += GameObjectsRect.height;
                    }
                }

            }
        }

    }

If a Editor GUI guru could explain to me how to do it like I'm a child that would be great :). I don't do custom GUI stuff and most of this is beyond me.
As per requested I'm uploading two example images. One from unity and one I randomly found from the net. Note that I do not need the "stacking"(I dont know how to call them) headers from the second example. I do how ever require a vertical and horizontal scrollbar like in the second example.

And finally just for reference this is what my code does so far

sentences:
How to calculate 2D viewport coordinates in a shader? In Unity, I use the following shader to calculate 2D viewport coordinates :

Shader "Foo"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            struct vertInput {
                float4 pos : POSITION;
            };

            struct vertOutput {
                float4 pos : SV_POSITION;
                float4 uv : TEXCOORD0;
            };

            vertOutput vert (vertInput input)
            {
                vertOutput o;
                o.pos = mul(UNITY_MATRIX_MVP, input.pos);
                o.uv = mul(UNITY_MATRIX_MVP, input.pos);
                return o;
            }

            fixed4 frag (vertOutput output) : SV_Target
            {
                float2 viewport = output.uv.xy / output.uv.z;
                return float4(sin(viewport.x*10.0), sin(viewport.y*10.0), 0.0, 1.0);
            }
            ENDCG
        }
    }
}

At first, it seems to work great. Here is results :

However if I move camera very close to the surface, the following unexpected glitch occurs :

sentences:
Mapping a C++ struct to an HLSL cbuffer Out of curiosity (and peace of the mind...) I wondered how DirectX decides which attribute from a struct corresponds to the right variable inside an HLSL cbuffer-register(x) (apart from the order/type they are declared with).

My main concern is my structs not only have member variables but 2 constructors each. So how can I be sure the constructors are not at the beginning of my struct definition (memory wise - C++ question I guess) so my variables would overflow after my cbuffer ? Additionnaly, can I only rely on declare-order/type matching ?

Is there a more precise/explicit way than doing :

struct foo {
    int a;
    int b;
    int c;

    foo () {}
    foo (int a, int b, int c) : a{a}, b{b}, c{c} {}
}

D3D11_BUFFER_DESC constantBufferDesc;
...
constantBufferDesc.ByteWidth = sizeof(foo) + (16 - sizeof(foo) % 16);
hr = g_d3dDevice->CreateBuffer(...);
g_d3dDeviceContext->VSSetConstantBuffers(0, 1, &fooBuffer);
g_d3dDeviceContext->UpdateSubresource(&fooBuffer, 0, nullptr, &foo, 0, 0);

With HLSL :

cbuffer foo: register(b0) {
    // constructor here ?
    int a;
    // constructor here ?
    int b;
    int c;
    // constructor here ?
}

I am aware this is more a C++ question - Thanks for your insight.

sentences:
Maintaining/Updating Large Amount of Player States I am developing a fighting game to practice my skills in Java and I would like to know what would be the best approach for figuring out how to easily expand the amount of states a player can have without fiddling with a large amount of code. With a small amount of states such as, inAir, isHurt, isRunning, I can hard code all the conditions I need. Things like 'jumping' can only occur when '!inAir', etc. However, for my project there are a large amount of states I do not know how to organize. Here is a small diagram I redrew:

My approach is to make an enumeration called State and do a switch case between them. I am not sure if this is a good way of doing this and I am trying to learn a better method if there are any.

sentences:
How to use styles in Monogame.Extended.GUI? So i was looking at the Monogame.Extended.GUI Project and used this instructions to set it up in a .net Core Project. So far everythings works fine. I followed the example of the demo and created a button like this

var button = new Button();
button.Content = "Button1";
button.BackgroundColor = Color.Transparent;

var demoScreen = new Screen
{
   Content = new StackPanel
   {
        Orientation = Orientation.Vertical,
        VerticalAlignment = VerticalAlignment.Centre,
        HorizontalAlignment = HorizontalAlignment.Centre,
        Items = { button }
   }
};

Now i want to give this Button a style, for example disable any mouse interactions like hover or mouse presses. The button has a HoverStyle and a PressedStyle property but i don't know how to use it.

   button.Hoverstyle = ???

sentences: Deferred lighting and projective texturing? Is posible to use this technique with deferred lighting?

sentences:
Why does PIX crash while creating render target views in my D3D11 application? I'm trying to use PIX to debug my Direct3D11 application. PIX crashes and gives the following stack trace:

Frame 000001 ........PRE: <this=0x054338e0>IDXGISwapChain::GetBuffer(0, IID_ID3D11Texture2D, 0x00B3E0F0)
Frame 000001 ........POST: <S_OK><this=0x054338e0> IDXGISwapChain::GetBuffer(0, IID_ID3D11Texture2D, 0x00B3E0F0)
Frame 000001 ........PRE: <this=0x05433978>ID3D10Texture2D::Map(11788512, Unknown D3D10_MAP, 1843764804, 0x00B3EA08)
Frame 000001 ........POST: <E_INVALIDARG><this=0x05433978> ID3D10Texture2D::Map(11788512, Unknown D3D10_MAP, 1843764804, 0x00B3EA08)
Frame 000001 ........PRE: <this=0x054b70d0>ID3D11Device::CreateRenderTargetView(0x05433978, NULL, 0x00B3E0F4)
Frame 000001 ........POST: <E_INVALIDARG><this=0x054b70d0> ID3D11Device::CreateRenderTargetView(0x05433978, NULL, 0x00B3E0F4)

What can I do to get around this problem so that I can debug my application?

sentences: Open GL ES 2.0 with Android I was wondering if someone could recommended a book that covers both android game developement and OpenGL ES 2.0. I have found some books with OpenGL 1.0, but I have heard that the syntax for OpenGL es 2.0 is totally different.

sentences:
How to get smoother transition between the surface normals rotation of player in Unity I kinda have a problem that my player is snapping onto the other surface while I wanna move a ramp up. I want to have it rotate smooth to the normals of the ramp. How can I change the code below to a smoother rotation function of the player?

Code:

void NormalsOfGround()
{
    //RAYCASTS THE NORMALS ON THE GROUND THAT THE PLAYER MOVES ALONG SURFACE
    Debug.DrawRay(rayCastNormal.transform.position, -transform.up, Color.blue, 2.5f);
    Ray ray = new Ray (transform.position, -transform.up);
    RaycastHit hit;
    if(Physics.Raycast(ray, out hit, 2.5f, GroundLayer) == true)
    {
        transform.rotation = Quaternion.FromToRotation (transform.up, hit.normal) * transform.rotation;
    }
}

sentences:
Unity: OnTriggerEnter2D does not get called when using Raycast In a previous post I talked about creating wires (using Bézier curve) using LineRenderer. I am using a PolygonCollider2D to wrap the wire (see below):

GameObject wire = new GameObject ();
LineRenderer lineRenderer = wire.AddComponent<LineRenderer> ();
PolygonCollider2D wireCollider = wire.AddComponent<PolygonCollider2D> ();

After drawing the curve and attaching the collider (as described in previous post), I added a new component to my gameObject (a WireController):

WireController wireController = wire.AddComponent<WireController> ();

The WireController currently has only one method:

void OnTriggerEnter2D(Collider2D other) {
    Debug.Log ("I'm hit!");
}

I use a Physics2D.Raycast to check if my mouse pointer is at any point interacting with the wire:

void CastRay() {
    Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction, 100);

    if (hit) {
        Debug.Log (hit.collider.gameObject.name);
    }
}

If I call CastRay() inside a Update() loop, if (hit) returns true (if the mouse pointer is over the gameObject, in this case, the wire), but the OnTriggerEnter2D method never gets called.

A few observations:

collider.isTrigger = true;
The WireController is attached to the newly created gameObject (it's visible in the Unity editor at runtime)

Any help is much appreciated!

sentences:
Easing equations with moving end points Usually easing equations have 4 parameters:

time
duration
begin point
end point

For example:

public static float EaseOutQuad(float currTime, float begin, float end, float duration)
{
    currTime /= duration;

    return -end * currTime * (currTime - 2f) + begin;
}

Now afaik begin and end point are fixed values.
In my game I have an object oscillating between 2 points on its local X axis. I'm interpolating its position using easing equations, but I would like to be able to modify the end point dynamically avoiding discontinous or abrupt changes.

Is it possible to do this using easing equations or something similar?
Any suggestion?

sentences:
Time based movement Vs Frame rate based movement? I'm new to Game programmming and SDL, and I have been following Lazyfoo's SDL tutorials. My question is related to time based motion and frame rate based motion, basically which is better or appropriate depending on situations?. Could you give me an example where each of these methods are used?.

Another question I have is that, in lazyfoo's two Motion tutorials (FPS based and time based) The time based method showed a much smoother animation while the Frame rate based one was a little hiccupy, meaning you could clearly see the gap between the previous location of the dot and its current position when you compare the two programs.

As beginner which method should I stick to?(all I want is smooth animations).

sentences:
Approach on how to split game assets into split archives With a custom binary file format for archives that is structured similiar to Valve's VPK files I have a Game.index.gcf which holds information about all files and where exactly they are stored. I can split up and say, that the /Assets/Maps and /Assets/Scripts folders should be stored in Game.000.gcf while the bigger /Assets/Music folder could be split up into Game.001.gcf and Game.002.gcf. This should boost performance but only if done right. Moreover with updates I could say, just update this particular split archive and not the entire archive (when storing everything in one really huge a file).

As of yet, I don't know how to write such an adaptive algorithm which automatically decides the best way to split all archives and files. What aspects should I keep in mind and what should I be aware of when creating these? Do you have any suggestions?

sentences:
Android Action_Move when moving between specific screen areas OK so I know how to iterate through the different pointers that are currently touching the screen so I know what the coordinates are of these pointers using the following:

Code snippet

case MotionEvent.ACTION_MOVE:{

    //Count through all the pointers currently touching the screen
    for(int index=0; index<event.getPointerCount(); index++) {

     //Is finger on the left button? If so, then go (or continue going) left
    if (event.getY(index) > renderer.leftButton("top") && event.getX(index)<renderer.leftButton("right")){
                renderer.setSpritewState('l', true);
                renderer.setSpriteState('r', false);}

 //Or is finger on the right button? If so, then go (or continue going) right
            else if (event.getY(index)>renderer.rightButton("top") && event.getX(index)>renderer.rightButton("left") && event.getX(index)<renderer.rightButton("right")){
                renderer.setSpriteState('l', false);
                renderer.setSpriteState('r', true);}
            }
            break;

}

However, this is constantly triggering one of the two conditions I guess as it's picking up minute movement of the finger/s. And, more importantly, if there is a finger on each 'button' - the sprite goes a bit crazy as each condition fights with the other and constantly flags the sprite to move left and then right etc.

What I'm really after is this something like this:

So, if a finger moves within a specified area, nothing happens as it's counter-productive.  But if a finger moves from one area to another, then the action is triggered.

I'm guessing the code for this would need to save the old position of each of the fingers to compare to the new positions, but I'm not really sure how to go about this.  Help would be appreciated.  Thanks.

sentences:
How to handle (0,0) in 2D game quad tree? I am not sure how to handle situation when out objects (player) is in center (0,0) point of game which is crossing of four quads. How to handle that case?
This image shows problem:

Red rectangle is player BoundingBox, he is at center, he not fully contain in any quad but he partially belongs to four quads, so we should get content of those 4 green quads or whole pranet quad?

sentences:
How to find a free patch of area in a tiled map? I've been trying to formulate the question and try to find some information on Google, but didn't managed to, so here it is...
We've got a nice tropic-themed game that is about to be released soon, that uses a tile map and an A* pathfinding is utilized and everything works flawlessly.

Until when it comes to the point where I need to somehow find unoccupied patch of area on the map that matches certain criteria, so that I can guide the player to place their just bought map objects on.

The map is 200x200 tiled map and it holds instances of each tile that determine two things - if it is occupied and if it is a water or a ground tile. These are already used for the A* pathfinding algorithm that I've put into the game.

Let's say the player buys a water-placible map object from the store and the map object occupies 5x5 tiles for instance. I need to guide the player to a free patch of water tiles where they can place that map object.

Any guidance and/or reference to such algorithms will be highly appreciated :) Thanks

EDIT: It turns out that I need to find such a patch as close as possible to given point (centre of viewport for instance). This will improve user experience

sentences:
Animating from json file in pygame? I have got a json file and I am trying to load the single sprites from that file
but I gives this error after a few loops and also the animation is not smooth(gets stuck)
error:
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    screen.blit(image, (0, 50))
TypeError: argument 1 must be pygame.Surface, not None

This is the json file I am using:
{
  "textureAtlas": {
    "texture": "Run (32x32).png",
    "regionWidth": 32,
    "regionHeight": 32
  },
  "cycles": {
    "animation0": {
      "frames": [0,1,2,3,4,5,6,7,8,9,10,11]
    }
  }
}

The script for the animation:
import json

pygame.init()

clock=pygame.time.Clock()
c=0
def lcAnim(sfile):
    global c
    with open(sfile) as f:
        data=json.load(f)
        img=pygame.image.load(data['textureAtlas']['texture'])

        while c<len(data['cycles']['animation0']['frames']):
            img.set_clip(pygame.Rect(data['cycles']['animation0']['frames'][c-1]*32,0,32,32))  # Locate the sprite you want
            draw_me = img.subsurface(img.get_clip())  # Extract the sprite you want
            c =c+1
            print(c)
            return draw_me
    c=0

and the main script:
import pygame
import lcanim #name of the animation script
(width,height)=(300,200)
clock=pygame.time.Clock()
screen=pygame.display.set_mode((width,height))
pygame.display.flip()
running=True

while running:

    image = lcanim.lcAnim('run.sf') #name of json file
    for event in pygame.event.get():
        if event.type==pygame.QUIT:

            running=False

        screen.blit(image, (0, 50))
        #screen.blit(alimg,(-10,10))
        pygame.display.update()
        screen.fill((255,255,255))
    clock.tick(10)
pygame.quit()

Here's a video showing the problem:
https://youtu.be/8IeaqVCxvms
(sorry other video sharing services were not working)

sentences:
Monogame render between constraints I have, in MonoGame, a project for which I require the game to not use the full screen depending on the resolution. The game elements etc all behave as they should (So they bounce off for example between 25% and 75% of the screen, instead of the edges). Yet I'm trying to draw a background between these two constraints, and it doesn't work.

To draw the background I am using the following code

spriteBatch.Draw(Background, new Rectangle(leftEdge,0,rightEdge,top),Color.White);

Yet when running the game, the image starts at "LeftEdge" but goes beyond "rightEdge". How would I go about scaling the image appropriately in this scenario?

sentences:
How can I select an audio output device in directshow I was wondering how I can select the output device for audio in directshow. I am able to get available audio output devices in directshow. But how can I make one of these to be audio output device. Its always going for the default audio device. I want to be able to output audio on my choice of device. I have been struggling through google but couldn't find anything useful. All I could get was this link but it doesn't really solve my problem.

Any help will be really helpful for me.

sentences:
Matinee movement track on multiple actors I have some different actors (all spheres) that i want to move along a path (circular) and they also need to roll when they are moving, so i tried this using matinees movement track and attached all spheres to one parent (the first sphere), but all the the other spheres move relative to the first one so if i rotate the childs will rotate on the axis of the parent and not around there own axis. and also they wont follow a path.

would this be possible using matinee? or what would be the best way to achieve this?

i thought of making a parent in the middle of the circular path and rotate around that axis but then the wont roll when moving, so maybe i should make a rolling animation separately. which will triggered when they move?

the spheres will not constantly move, what i want to make is sort of a 3d gallery where the focus is on one sphere and if you want to see the next one, roll that sphere toward you and the other one away towards the background.

sentences:
How to combine Actor.setPosition and Actor.hit? Why after using Actor.setPosition, input coordinates in Actor.hit come with a shift in the values specified in setPosition?

Create scene:

public class MyActor extends Actor {
...
    int width = 70;
    int height = 70;

    public MyActor(Texture img, int x, int y, int realX, int realY) {
...
        sprite = new Sprite(img, x, y, width, height);
        this.setPosition(realX, realY);

Standard search Actor:

public class GameScreen implements Screen, InputProcessor {

    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        Vector2 coord = stage.screenToStageCoordinates(new Vector2((float)screenX,(float)screenY));
        Gdx.app.log("touchDown", "" + coord.x +","+ coord.y);

        selectedActor = (MyActor)stage.hit(coord.x,coord.y,false);

...

public class MyActor extends Actor {

    @Override
    public Actor hit(float x, float y, boolean touchable) {
        if(!touchable)
            Gdx.app.log("Actor.hit:", "" + x +":"+ y);
        return x < getX()|| x >= getX() + width || y < getY()||  y >= getY() + height ? null : this;

But come the distorted values.

Coordinates Click:  touchDown: 26.25,81.250015.

MyActor in the values obtained from the offset, the multiple of 70:

Actor.hit: -43.75:11.250015
Actor.hit: -43.75:81.250015
Actor.hit: 26.25:11.250015
Actor.hit: 26.25:81.250015

Why? How to fix?

UPDATE

public class MyStage extends Stage {
...
    @Override
    public Actor hit(float x, float y, boolean touchable) {

        return super.hit(x,y,touchable);

sentences:
LibGDX render sprites in tiled-map format ( convert texture to sprite ) I am creating a game in which till now I have used textures to create A 2D tiled game.
I have created a matrix which converts the touch co-ordinates into a array index number and according to that index number, a specific tile gets selected. The problem is that I want to emulate the same behaviour for sprites instead of textures. But I get stuck on what could possibly be given as the co-ordinates for the sprite position? I want to just use Sprites instead of using textures as Sprites are easier to animate. No matter which values I give, the screen remains white and sometimes a different tile's texture gets rendered at a different position. What am I doing wrong?

//      Function returns the position of tile touched
int getPos(int screenX, int screenY) {
    x = screenX / (int)xSize;
    y = screenY / (int)ySize;
    y = Squares_Y - 1 - y;
    int result = y * Squares_X + x;
    return result;
}

// Previous Render function
public void render(float delta) {
    batch.begin();
    Tile current=initial_layout;
    if(current.topLink != null)
    {
        for (int Pos=0; Pos<Squares_X; Pos++) {
            for (int ypos=0; ypos<Squares_Y; ypos++) {
                batch.draw(bg_texture, Pos * xSize, ypos * ySize, xSize, ySize);
                if(current!= null)
                {
                    batch.draw(current.getTexture(), Pos * xSize, ypos * ySize, xSize, ySize);
                    current=current.topLink;
                }
            }
        }
    }
    if(Gdx.input.justTouched()){
        if(win == false)
        {
            int x =Gdx.input.getX();
            int y =Gdx.input.getY();
            touchDown(getPos(x, y));
        }
        else{
            System.out.print("\nLevel Completed !! : " + utils.level);
            game.dispose();
        }
    }
    batch.end();
}

// New Render Function
public void render() {
    batch.begin();
    Tile current=initial_layout;
    if(current.topLink != null)
    {
        for (int Pos=0; Pos<Squares_X; Pos++) {
            for (int ypos=0; ypos<Squares_Y; ypos++) {
                batch.draw(bg_texture, Pos * xSize, ypos * ySize, xSize, ySize);
                if(current!= null)
                {
                    spriteBatch.begin();
                    texture = current.getTexture();
                    sprite = new Sprite(texture,(int)xSize,(int)ySize);
                    sprite.setPosition(Pos * xSize, ypos * ySize);
//                  batch.draw(current.getTexture(), Pos * xSize, ypos * ySize, xSize, ySize);
                    sprite.draw(spriteBatch);
                    current=current.topLink;
                    spriteBatch.end();
                }
            }
        }
    }
    if(Gdx.input.justTouched()){
        if(win == false)
        {
            int x =Gdx.input.getX();
            int y =Gdx.input.getY();
            touchDown(getPos(x, y));
        }
        else{
            System.out.print("\nGame WON for Level : "+utils.level);
            game.dispose();
        }
    }
    batch.end();
}

sentences:
Unreal engine project not responding to key binding changes I'm getting started with learning Unreal development, and I've created a new project based off the FPS C++ template.

I've changed the key mappings inside the DefaultInput.ini, rebuilt the Visual Studio solution, and rebuilt the project in the Unreal editor, but none of my changes are taking effect.

What step am I missing?

sentences:
How to customize player script with different abilities in each scene? I'm making a game with Unity. I wanted the player script to not have some features in some scenes but couldn't remove them from the script because I needed them for other scenes.
So far, I just unpacked those player prefabs, created new scripts for each of them and removed the lines that I didn't want to have. I know this was not the best idea but I don't know any other way. One of its problems is that it makes managing the scripts hard and confusing.
Is there a way that I can change them without creating new ones? Since I'm going to switch to the new Input system, I want to avoid the possible problems and headaches around these scripts. I also did this (creating a new script) for pause menu script as well. I provided two examples below to make the situation more clear.
Example A) The player can use a shotgun in one of the scenes and I chose to not let him to use the knife in there. So I created a new script for that player and copied and pasted the original script (which had the melee attack ability) and then removed those lines from the new script.
Example B) Pause menu can disable the health bar game object whenever the escape button is pressed. But for one of the levels, I don't want to use the health bar, so I pasted the code in a new pause menu script and removed the line that disables the bar.

sentences:
Calculating the angular direction from velocity I'm trying to calculate the angular direction of a projectile, knowing it's X and Y velocity I can find the magnitude of its movement, but I'm having a hard time wrapping my mind around getting the angular direction (in radians) that it is moving...

I assume there is a tan or a sin involved, but I'm a bit clueless otherwise...

sentences:
Are spritesheets worth it? Is a zip a good alternative? I was wondering if spritesheets are worth it.
I am making a game with pixi.js and was thinking about optimization, beginning with asset loading. I currently have an arraya of all files and use PIXI.loader, but I know this is not good because it will make a web request for all files which takes long, so I should figure out a way to load them in one web request. The first thing I thought of was a spritesheet but then I thought "what if I just zipped everything and loaded it with something like JSZip?" I knew it was possible already (from this project that loads pixi textures from a zip) and listed what I think are potentials good and bad things:
Zip good points:

Compression meaning faster loading of assets
Compression meaning smaller build size when making a build with electron

Zip bad points:

Requires loading a separate library meaning increased loading time and using more RAM
Requires decompressing in-memory meaning increased loading time

Spritesheet good points:

Doesn't has the headers of all individual image files
Is much used so it is a proven technique

Spritesheet bad points:

No compression (or at least not comparable to zipping)
More than one network call due to phone limitations preventing sometimes files over 2024x2024px making it necessary to split spritesheets
Empty holes as all images are not the same size and there is almost always a bit of space left in the spritesheet, meaning useless pixels that are still transfered over the network

I am not a very experienced developper, so I have a few questions:

Did I miss a point above?
Are spritesheets generally worth it?
Which technique of both is more worth it? I could do both but I want to focus on one first and leave the other in a nice to have list.

sentences:
How to shade a texture two different colors? To give an example of what I'm asking about, I'll use Saints Row 3 since I've been playing that lately.  In that game you can customize your looks and your car's appearance a lot.  Your coat can have a primary color and a trim color.  Your car can have a primary color and a stripe color, etc.

Is there just a single coat texture that is being shaded two different colors somehow or are they overlaying a transparent second texture for the trim/stripes that gets shaded differently?

If it's just one texture I'd like to know how it's done.

If it's two different textures it seems like it's a waste of space.  The second texture would be the same size as the first one but mostly transparent if you just wanted to lay it on top of the first one.  Or are they just carefully positioning a second, smaller texture so that it aligns properly with the first one?

sentences:
How would I make my position interpolation stop once the destination is reached? I would like to implement tile-based grid movement and I've heard that linear interpolation comes handy in the implementation process. I've tried to use it but I'm not sure how to make it stop once the target position is reached. I can't find a way to check that on the interpolation. Here's the code I'm using:

function movePlayer(deltaTime) {
    if buttonUp then
       velocity.add(0, speed);
    if buttonRight then
       velocity.add(speed, 0);
    if buttonSouth then
       velocity.sub(0, speed);
    if buttonLeft then
       velocity.sub(speed, 0);

    velocity.scl(deltaTime);

    if (targetPosition.isZero()) {
        targetPosition.add(getNextPosition());
    }

    position.lerp(targetPosition, speed * deltaTime);

    float distance = position.dst(targetPosition);
    if (allowMovement && distance < 0.1f) {
        position = targetPosition;
        allowMovement = false;
        targetPosition.set(0, 0);
    }
}

sentences:
Is there a term for an incorrect interpretation of game memory? In Prince of Persia, using cheats in certain rooms can access "secret" rooms with strange graphics, like in this video. This effect is caused by the game referencing parts of memory which are invalid or containing garbage. For games running on MS-DOS with little bounds checking and no virtualisation, such memory access doesn't result in a crash, but in the game trying to interpret it as a valid and relevant memory instead.

If the data doesn't cause any other crash (e.g. divide by zero), the game might interpret the memory as an entirely new location in the game (room, level), possibly even with new graphics (with "random" pixels) or enemies.

I would like to know how this effect of misintepreting incorrect parts of memory as valid game locations is called.

The affected games that I know about:

Prince of Persia, using cheats or modified rooms to enter undefined rooms with weird tiles or enemies.
Commander Keen 4, saving with the viewport near the level edge displays garbage graphics after subsequent load.
Dangerous Dave, entering a non-existing warp zone displays parts of other levels or weird tiles.

I am also curious about other games where this can be found.

sentences: Lighting, shader and GI is messing up the materials in Unity3D Hello Guys I am not very sound with Unity3D Lightmapping. Currently I have a set of low poly items in my scene. Textures on my models are getting washed out. They totally look absurd. here is a picture of expected (Right) vs current result (left)

sentences:
Unity3d: Rotating a sphere so point lines up with the camera I'm trying to make a world map in Unity that contains a rotating globe with landing sites on the perimeter.  What I want is that when a player clicks on the landing site the globe rotates so that the landing site is centered.  I've been trying to find the right way to use the Quaternion class but not much luck.

Here is my latest attempt which doesn't work.  The landing sites are parented to the globe but the camera and globe are separate.

        void Update()
    {
        if (_selectedLandingSite != null)
        {
            var rotation = Quaternion.FromToRotation(_selectedLandingSite.transform.localPosition, MainPlanet.transform.forward);

            var trans = Game.Game.Instance.MainCamera.gameObject.transform;
            var lookDirection = new Vector3(trans.position.x, trans.position.y, trans.position.z);
            lookDirection = rotation * lookDirection;

            var _lookRotation = Quaternion.LookRotation(_selectedLandingSite.transform.localPosition);

            //rotate us over time according to speed until we are in the required rotation
            MainPlanet.transform.rotation = Quaternion.Slerp(transform.rotation, _lookRotation, Time.deltaTime * 1);

            //MainPlanet.transform.rotation =
            //  Quaternion.RotateTowards(MainPlanet.transform.rotation, _targetRotation, 1);
        }
    }

sentences:
World position reconstruction from depth fails when viewport size does not match window size I'm facing very strange issue. My code for world pos reconstruction works correctly when the viewport size is equal to window size (or framebuffer size in other words). Below is the part for reconstruction to view space, later I multiply the result by inversed view matrix:

vec3 posFromDepth(in vec2 Tex, in float depth) {
    vec3 pos = vec3(Tex, depth) * 2.0 - 1.0; // clip-space position

    float z = -projection[3][2] / (pos.z + projection[2][2]);
    float x = pos.x * halfTanFovX * -z;
    float y = pos.y * halfTanFovY * -z;

    return vec3(x, y, z);
}

When I change the viewport light and shadow calculations seems to be incorrect. The shadows for example instead of being "glued" to the object, floats a little bit along with camera movement.

When I switched my deferred renderer to use world pos stored in G-buffer then everything was calculated right. Is there some transformation of texture coordinates which I'm missing? I tried pass fullscreen quad coords in vertex attributes and compute using below formula:

gl_FragCoord.xy * texelSize

but the results were the same.

I'm searching for the issue more than week and slowly running out of ideas what could be wrong. Maybe you'll come up with something useful.

sentences:
Picking game entities What is the preferred methods for doing so, performance-wise?

For example I want to pick certain objects in an area around a given point.

What I have thought off so far is using invisible objects as extended hit detectors. Like creating a circle or square then have collision responses to them.

Or maybe just pass the entire object list and iterate on it, then using a distance/angle based condition.

sentences: Does the older Xbox 360 Elite support XNA 4? Can I develop an XNA 4.0 game for the older Xbox 360 Elite? Or would I need a newer Slim model?

sentences: Keyboard input vs character movement encapsulation In our game created with c++ and sdl we are having difficulty delegating how the main character should be controlled.  We have a keyboard class and a sprite class for the main character, but are unsure if the main character should have an instance of the keyboard class or if keyboard input should be done through the game loop.  If you need anymore information I would be happy to provide it, thanks in advance for any help.

sentences:
Algorithm for finding edge vertex points on a tilemap I have a 2d tilemap array contains 1 or 0. 0 corresponds empty tile, 1 corresponds solid tile. If tile is 1 I draw a texture.
I have to find edge vertices and coordinates that 1's grouped.
I couldn't find a way to implement this algorithm. Is there a algorithm or approach I could use?
Red dots are the vertices I want their coordinates.

sentences: File writing or scriptable object editing in unity webgl I am using a scriptable object for saving data. I know that scriptable objects are unchangeable means we can't change and save data after runtime but is there any workaround available to update it? Or write any config file (editable for user to change it) on webgl Platform. It seems that file writing permission is not available at unity Webgl.

sentences:
How to show your game vision? I am developing a game and have a clear vision of how it works, what key features it has and how it should look alike.

But when it comes to introduce the designer I feel a little bit lost. I have no graphics talent so I try to pitch it with mockups and text.

But I guess there are better ways or methods to get it on paper - how would they look like?

sentences:
Create vector based on length, angle and origin vector I have been trying to come up with a function that allows me to take in an origin vector, angle, and a length I want to be between the old and new vector, but I can't wrap my head around it.

The function requires the angle input to be a 3D vector that is normalized and needs to look something like this.

glm::vec3 CreateAngledVector(glm::vec3 origin, glm::vec3 angle, float length)
{
    angle = glm::normalize(angle);

    ...
}

If anyone has any suggestions on how I can achieve this, I'd be happy to hear them.

Edit
I've managed to make it so I can create angles on a 2D plane on all 3 dimension but I can't figure out how to rotate it on two planes at the same time.

glm::vec3 CreateAngledVector(glm::vec3 start, glm::vec3 axis, float angle, float length)
{
    axis = glm::normalize(axis);

    glm::vec3 output = axis;
    output = glm::rotate(output, (angle*DEG2RAD) * axis.z, glm::vec3(1.0f, 0.0f, 0.0f));
    output = glm::rotate(output, (angle*DEG2RAD) * axis.x, glm::vec3(0.0f, 1.0f, 0.0f));
    output = glm::rotate(output, (angle*DEG2RAD) * axis.y, glm::vec3(0.0f, 0.0f, 1.0f));

    output *= length;
    output += start;
    return output;
}

Using this function I can create circles using the following.

int loops = 180;
float angle_part = 360.0f / loops;
glm::vec3 axis = glm::vec3(1.0f, 0.0f, 0.0f);
for (int i = 0; i < loops; i++)
{
    glm::vec3 new_vector = CreateAngledVector(l1.position, axis, angle_part*i, 1.0f) ;
    ...
}

The state before the function works fine creating angled vectors on a 2d plane (end goal is to make circles) but when I attempt to turn the axis of the function to go into 3D such as glm::vec3 axis = glm::vec3(1.0f, 1.0f, 0.0f); It breaks the function (see example)

axis = glm::vec3(0.0f, 1.0f, 0.0f)

axis = glm::vec3(0.0f, 0.0f, 1.0f)

"Broken one" axis = glm::vec3(1.0f, 1.0f, 0.0f)

sentences:
how to calculate intersection time and place of multiple moving arcs I have rocks orbiting moons, moons orbiting planets, planets orbiting suns, and suns orbiting black holes, and the current system could have many many layers of orbitage.

the position of any object is a function of time and relative to the object it orbits.
(so far so good).

now I want to know for a given 2 objects(A,B), a start time and a speed, how can I work out the when and where to go. I can work out where A and B is given a time.
so i just need.

1: direction to travel in from A to B(remember B is moving(not in a straight line))
2: Time to get to b in a straight line.

travel must be in a straight line with the shortest possible distance.

as an extension to this question, how will i know if its better to wait, EG is it faster to stay on object A and wait for a hour when the objects may be closer, than to set off from A to B at the start.

Cheers, it hurt my brain.

sentences:
Unity: UNetWeaver warning: SyncVar set from within property function. This will not set dirty flags. How to? I was trying out the new Unity networking and I added the SyncVar attribute to one of my variables to be synced. I also have a property to get/set the variable and update the visuals when set. I set the "hook" variable in the SyncVar so the property is used and visuals are updated properly (or that was the idea, since it gives an error :P)

[SyncVar(hook = "set_Tapped")]
private bool _tapped;
public bool Tapped
{
    get { return _tapped; }
    set { _tapped = value; UpdateRotation(); }
}

Now however I get an error in the console:

UNetWeaver warning: SyncVar [_tapped] set from within property function [System.Void Card::set_Tapped(System.Boolean)]. This will not set dirty flags.

How should this be handled? I could just make a set method myself (not using properties), but is there a better/nicer way?

Thanks!

sentences:
Diamond Square Algorithm - How to fix horrible diamond shaped artefacts and spikes? I was attempting to follow this article explaining the implementation of a wrapping version of the diamond square algorithm.

I tried running it with dimensions of 128x128 and a "feature size" of 16, like in the article, but the resultant terrain is this monstrosity:

I read through past questions on this topic and am aware that there can be some issues with somewhat noticeable diamond or square shaped artifacts when using this algorithm, but this is definitely beyond that.

Here is my code:

private float GetHeightAtPoint(int x, int z)
{
    if (x < 0) { x = width + x; }
    if (z < 0) { z = height + z; }

    return fractal[(x % (width - 1)) + (z % (height - 1)) * width];
}

private void SetHeightAtPoint(int x, int z, float value)
{
    if (x < 0) { x = width + x; }
    if (z < 0) { z = height + z; }

    fractal[(x % (width - 1)) + (z % (height - 1)) * width] = value;
}

private void SquareStep(int x, int z, int size, float value)
{
    int halfSize = size / 2;

    float a = GetHeightAtPoint(x - halfSize, z - halfSize);
    float b = GetHeightAtPoint(x + halfSize, z - halfSize);
    float c = GetHeightAtPoint(x - halfSize, z + halfSize);
    float d = GetHeightAtPoint(x + halfSize, z + halfSize);

    float meanHeight = (a + b + c + d) / 4.0f;
    float adjustedHeight = meanHeight + value;

    SetHeightAtPoint(x, z, adjustedHeight);
}

private void DiamondStep(int x, int z, int size, float value)
{
    int halfSize = size / 2;

    float a = GetHeightAtPoint(x - halfSize, z - halfSize);
    float b = GetHeightAtPoint(x + halfSize, z - halfSize);
    float c = GetHeightAtPoint(x - halfSize, z + halfSize);
    float d = GetHeightAtPoint(x + halfSize, z + halfSize);

    float meanHeight = (a + b + c + d) / 4.0f;
    float adjustedHeight = meanHeight + value;

    SetHeightAtPoint(x, z, adjustedHeight);
}

private void DiamondSquare(int stepSize, float scale)
{
    int halfStep = stepSize / 2;
    for (int z = halfStep; z < height + halfStep; z += stepSize)
    {
        for (int x = halfStep; x < width + halfStep; x += stepSize)
        {
            SquareStep(x, z, stepSize, Random.Range(-1.0f, 1.0f) * scale);
        }
    }

    for (int z = 0; z < height; z += stepSize)
    {
        for (int x = 0; x < width; x += stepSize)
        {
            DiamondStep(x + halfStep, z, stepSize, Random.Range(-1.0f, 1.0f) * scale);
            DiamondStep(x, z + halfStep, stepSize, Random.Range(-1.0f, 1.0f) * scale);
        }
    }
}

/*
 * Generate a fractal map using diamond square algorithm and store in fractal[]
 */
private void GenerateFractal(int featureSize)
{
    fractal = new float[width * height];

    for (int z = 0; z < height; z += featureSize)
    {
        for (int x = 0; x < height; x += featureSize)
        {
            SetHeightAtPoint(x, z, Random.Range(0.0f, maxHeight));
        }
    }

    int sampleSize = featureSize;
    float randomScale = 1.0f;

    while (sampleSize > 1)
    {
        DiamondSquare(sampleSize, randomScale);

        sampleSize = sampleSize / 2;
        randomScale = randomScale / 2.0f;
    }
}

Could anyone give me any guidance here? One thing that was a bit suspect was that I had to make slightly different wrapping array access functions in order to make this run as I was getting negative values. You can see that my functions have the if statements checking for negatives, whereas the original implementation does not.

Thanks in advance

sentences:
Optimizing texture fetches with higher mip levels Let's say I have some shader program in DirectX or OpenGL rendering a full screen quad. And in a pixel/fragment shader I sample some huge textures at random texture coordinates. That is one same texture coordinate for all texture samplings in one shader invocation, but it is various among different shader invocations. These fetch operations produce performance drop, I even think that due to the size of the textures the GPU texture cache is not big enough and is used not efficiently.

Now I have a theoretical question: can I optimize the performance by using some low-resolution like 32x32 mask textures, which are built by mipmapping the large textures, and if a value in a mask texture at given texture coordinate at some higher mip level is not appropriate, then I don't need to perform texture fetches at full-size level 0? Something like this in HLSL (GLSL code is pretty similar, but there is no [branch] attribute):

float2 tc = calculateTexCoordinates();
bool performHeavyComputations = testValue(largeMipmappedTexture.SampleLevel(sampler, tc, 5));

float result = 0;

[branch]
if (performHeavyComputations)
{
    result += largeMipmappedTexture.SampleLevel(sampler, tc, 0);
}

About 50% of texels at mip level 5 will not pass the test. And so a lot of shader invocations should not sample the full-size textures.

But I am introducing branching in the code. May this branching hurt the performance even worse than sampling the full-size texture even if that is not needed? Different GPUs may behave differently, some may not even support branching, will they perform two fetches instead of one?

I can test this code on some machines, but my question is theoretical.

And can you suggest another optimizations, if this won't work properly ?

sentences:
What's the fastest collision detection (Game Maker) I want to build a simulator using Game Maker in which there are many (up to hundreds) of obj_Cell, each has a radius of 10, (they don't have sprites, they just draw a circle with radius 10).

Each step, I want the cells to check around itself for obj_A to see if any obj_A is "touching" it, (has a distance less than 10 from the cell). However, since I have so many obj_Cell and so many obj_A, the most straight forward code (below) will have to be executed tens of thousands of times (number of obj_A * number of obj_Cell)

//In obj_Cell:
(with obj_A)
{
   if distance_to_object(other)<=10
   {
      //do stuff
   }
}

Is there any possible way to make this faster?

sentences:
Platform jumping problems with AABB collisions See the diagram first:

When my AABB physics engine resolves an intersection, it does so by finding the axis where the penetration is smaller, then "push out" the entity on that axis.

Considering the "jumping moving left" example:

If velocityX is bigger than velocityY, AABB pushes the entity out on the Y axis, effectively stopping the jump (result: the player stops in mid-air).
If velocityX is smaller than velocitY (not shown in diagram), the program works as intended, because AABB pushes the entity out on the X axis.

How can I solve this problem?

Source code:

public void Update()
{
    Position += Velocity;
    Velocity += World.Gravity;

    List<SSSPBody> toCheck = World.SpatialHash.GetNearbyItems(this);

    for (int i = 0; i < toCheck.Count; i++)
    {
        SSSPBody body = toCheck[i];
        body.Test.Color = Color.White;

        if (body != this && body.Static)
        {
            float left = (body.CornerMin.X - CornerMax.X);
            float right = (body.CornerMax.X - CornerMin.X);
            float top = (body.CornerMin.Y - CornerMax.Y);
            float bottom = (body.CornerMax.Y - CornerMin.Y);

            if (SSSPUtils.AABBIsOverlapping(this, body))
            {
                body.Test.Color = Color.Yellow;

                Vector2 overlapVector = SSSPUtils.AABBGetOverlapVector(left, right, top, bottom);

                Position += overlapVector;
            }

            if (SSSPUtils.AABBIsCollidingTop(this, body))
            {
                if ((Position.X >= body.CornerMin.X && Position.X <= body.CornerMax.X) &&
                    (Position.Y + Height/2f == body.Position.Y - body.Height/2f))
                {
                    body.Test.Color = Color.Red;
                    Velocity = new Vector2(Velocity.X, 0);

                }
            }
        }
    }
}

public static bool AABBIsOverlapping(SSSPBody mBody1, SSSPBody mBody2)
{
    if(mBody1.CornerMax.X <= mBody2.CornerMin.X || mBody1.CornerMin.X >= mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y <= mBody2.CornerMin.Y || mBody1.CornerMin.Y >= mBody2.CornerMax.Y)
        return false;

    return true;
}
public static bool AABBIsColliding(SSSPBody mBody1, SSSPBody mBody2)
{
    if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y)
        return false;

    return true;
}
public static bool AABBIsCollidingTop(SSSPBody mBody1, SSSPBody mBody2)
{
    if (mBody1.CornerMax.X < mBody2.CornerMin.X || mBody1.CornerMin.X > mBody2.CornerMax.X)
        return false;
    if (mBody1.CornerMax.Y < mBody2.CornerMin.Y || mBody1.CornerMin.Y > mBody2.CornerMax.Y)
        return false;

    if(mBody1.CornerMax.Y == mBody2.CornerMin.Y)
        return true;

    return false;
}
public static Vector2 AABBGetOverlapVector(float mLeft, float mRight, float mTop, float mBottom)
{
    Vector2 result = new Vector2(0, 0);

    if ((mLeft > 0 || mRight < 0) || (mTop > 0 || mBottom < 0))
        return result;

    if (Math.Abs(mLeft) < mRight)
        result.X = mLeft;
    else
        result.X = mRight;

    if (Math.Abs(mTop) < mBottom)
        result.Y = mTop;
    else
        result.Y = mBottom;

    if (Math.Abs(result.X) < Math.Abs(result.Y))
        result.Y = 0;
    else
        result.X = 0;

    return result;
}

sentences:
WebGL - Open URL in new tab? How to open URL in new tab for WebGL?

Tried Application.OpenURL("url"). But it's opens a tab in same window

Thanks

sentences:
How do you disable frame skips in a game, in SFML preferably by frame skip off i mean that the game should just slow down if the fps drops, just like in terraria, i got this code currently and want to implement it to it:
static class Globals
{
    static public Time dt = new Time();
    static public Vector2f Friction
    {
        get
        {
            return new Vector2f(2 * dt.AsSeconds(), 0);
        }
    }
}

class Player
{
        private void StartMoving(int _direction)
    {
        moving = true;
        direction = _direction;
        heldfor =  1;
        Move(direction);
    }
    public void Move(int _direction)
    {
        if(!moving)
        {
            StartMoving(_direction);
            return;
        }
        if(direction == _direction)
        {
            if(heldfor < heldforlimit) heldfor++;
            Velocity += new Vector2f(((speed * (heldfor / 10f)) * direction) * Globals.dt.AsSeconds(), 0);
        }
        else
        {

            direction = _direction;
            heldfor /= 2;
            Velocity = new Vector2f(Velocity.X / 1.5f, Velocity.Y);
            if (heldfor < heldforlimit) heldfor++;
            Velocity += new Vector2f(((speed * (heldfor / 10f)) * direction) * Globals.dt.AsSeconds(), 0);
        }

    }
    public void StopMoving()
    {
        moving = false;
        heldfor = 1;
    }

    public void Update(Time dt)
    {
        if(!moving)
        {
            if(Math.Abs(Velocity.X) - Globals.Friction.X < 0)
            {
                Velocity.X = 0;
            }
            else
            {   // i really should make this direction independent and apply direction at end of the update
                Velocity.X = Velocity.X > 0 ? Velocity.X - Globals.Friction.X : Velocity.X + Globals.Friction.X;
            }
            if (Math.Abs(Velocity.X) <= velocitySnapX) Velocity.X = 0;
            if (Math.Abs(Velocity.Y) <= velocitySnapY) Velocity.Y = 0;
        }
        if (Math.Abs(Velocity.X) > XMaxvel) Velocity.X = XMaxvel * direction;
        if (Math.Abs(Velocity.Y) > YMaxvel) Velocity.Y = YMaxvel * direction;
        Position += Velocity;
    }
}

class Program
{
    Player player = new Player();
    while(game.isrunning) // this is made up as the genuine code is too messy
    {
                    if (Keyboard.IsKeyPressed(Keyboard.Key.Right))
            {
                player.Move(1);
            }
            if (Keyboard.IsKeyPressed(Keyboard.Key.Left))
            {
                player.Move(-1);
            }
            window.Clear(Color.White);
            window.Draw(player);
            player.Update(Globals.dt);
            window.DispatchEvents();
            window.Display();
            window.SetView(mainview);
            Globals.dt = deltaclock.Restart();
    }
}

sentences:
Are there alternatives to multiple buffering? I'm learning about game programming. So far, my sources lead me to believe that multiple buffering is the best technique for redrawing in OpenGL.

Are there other redrawing techniques? What are their advantages/disadvantages?

I'm not sure about terminology yet, but googling as best as I can hasn't yielded much result yet. Does anyone have any experience with redrawing techniques besides multiple buffering?

sentences:
How do I know the data has arrived at server without requesting every frame of the game? I have a game where I have to get data from the server but the problem is I don't know when the data will become available on server. So I decided to use co-routine and hit server at after specific time or on every frame. But certainly this is not the right, scale able and efficient approach.

Now my question is that how do I know that data has arrived at server so that I can use this data to run my game. Or how should I direct the back-end team to design the server in an efficient way that it responds efficiently.

Our back-end team currently uses REST Web services with JSON with Python. And they want to push data to my unity player without my frequent requests.

sentences:
Loading content into an Winforms/XNA Editor's content project So i am bulding a game editor/engine basically for teh lulz but i have encountered a problem i cannot seem to fix, i cannot load any new content through the Winforms UI during runtime.

I tried using the File.Copy method in .Net to copy the files to the content folder but this does not seem to work as the file needs to be added to the content project in order for my ContentManager object to read it.

Any thoughts on how to fix this?

sentences:
In some games, we just let the main() loop be the Player object or Table object? I was thinking that let's say if there is a game of Blackjack or MasterMind, then we should have a class called Dealer or ComputerPal, which is how the computer interact with us (as a dealer for Blackjack or as the person giving hints for MasterMind).

And then there should be a Player object, and the way to play one game is

aPlayer.playGame

but I noticed that a book was just using the main() loop to act as the player (or as the Controller of the game), calling the Dealer methods to dealer the cards, ask for player's action, etc...

1) Is this just a lazy way to model all the proper objects?

2) If more objects are to be added, who should call the aDealer.dealCards and then ask for aPlayer.askForAction?  (because it is strange to let the Player handle all the logical steps).  Should there be a Table object that handle all these logic and then to play one round of game, use aTable.playGame?  What is a good object design for such game?

sentences:
How to perform some custom math between the model matrix and the projection matrix? I'm trying to write a shader in Unity that will perform some custom math after the model*view matrix is applied but before the projection matrix is applied.
First off, I'm not sure whether I should be using a surface shader or an unlit shader. My impression is that a surface shader can do everything I need it to and the outcome will look better with less effort, is that right?
I'm thinking that what I can do is manually apply the model and view matrices in the vertex shader, and then I have to tell it somehow to only apply the projection matrix in the rasterization step. Any idea how to go about this, or a different way to achieve the same result?

sentences:
Unity assembly files missing from "Temp/bin/Debug" I'm trying to use VS Code on a Mac with Unity and C#. When I try to open a Unity project in VS Code, it can't load Assembly.dll* files from few locations which are defined by default in .csproj files; "Temp\bin\Debug\".

When I check the *Temp\bin\Debug* paths, while Unity is running, they are empty; they doe not contain the assembly files, where I assume they should. The files are in "Library/ScriptAssemblies". Moving them is not an option, because I would have to do that manually every time I change sth. in any script file. Changing the path in the .csproj files is also not a good idea, because those files get rewritten every time you open a project in Unity.

This issue causes lot of problems in the editor:

  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'
  [INFORMATION:OmniSharp#MSBuild] Update project: Assembly-CSharp-Editor-firstpass
  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'
  [INFORMATION:OmniSharp#MSBuild] Update project: Assembly-CSharp-Editor
  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-Editor-firstpass.dll'
  [WARNING:OmniSharp#MSBuild] Unable to resolve assembly '/[...]/Temp/bin/Debug/Assembly-CSharp-firstpass.dll'

All type references coming from my custom scripts and the UnityEngine namespace are missing, and highlighted as errors:

However, intellisense seems to be working fine for UnityEngine types:

I tried to reinstall MonoDevelop it a few times, including a brew and downloadable package. MonoDevelop seems to be installed properly:

  $ mono --version
   Mono JIT compiler version 4.6.2 (mono-4.6.0-branch/ac9e222 Wed Dec 14 17:02:09 EST 2016)
   Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           normal
    SIGSEGV:       altstack
    Notification:  kqueue
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug
    LLVM:          yes(3.6.0svn-mono-master/8b1520c)
    GC:            sgen

.NET works as well:

  $ dotnet --version
  1.0.0-preview2-1-003177

How do I fix this?

sentences:
Complex Models using bounding boxes in xna 4 I'm new to XNA, and have just started looking into collision detection.
I've managed to get a bounding sphere around my first person camera object and i want to check the collision between that and the walls of my cube.
e.g.

this is a cube i have built in Maya and it is 1 combined mesh.
What i want to do i check my bounding sphere against the inside of the walls. and also allow the myself to enter in and out of the holes in the sides and th top.
My first thought would be using each vertex to test against collision but i have no idea how to do this, since this is the first time attempting.
Can anyone point me in the right direction?

sentences:
How to interpolate colors around the spectrum of hues? I wanted to generate a 7 segment display whose color brightness varies with time, this can be done by just using linear relationship.
Color activeColour2 = new Color(1, DateTime.Now.Millisecond*0.001f, DateTime.Now.Millisecond*0.001f);

So in 1 complete second, it produce color in the range of (1,0,0) to (1,1,1) as in the code below:
using System;
using UnityEngine;

public class ClockDigit2 : MonoBehaviour
{
    static readonly bool[,] SEGMENT_IS_ACTIVE = new bool[,] {

        {true,  true,  true,  true,  true,  true,  false}, // 0
        {false, true,  true,  false, false, false, false}, // 1
        {true,  true,  false, true,  true,  false, true }, // 2
        {true,  true,  true,  true,  false, false, true }, // 3
        {false, true,  true,  false, false, true,  true }, // 4
        {true,  false, true,  true,  false, true,  true }, // 5
        {true,  false, true,  true,  true,  true,  true }, // 6
        {true,  true,  true,  false, false, false, false}, // 7
        {true,  true,  true,  true,  true,  true,  true }, // 8
        {true,  true,  true,  true,  false, true,  true }  // 9
    };

    public Color32 inactiveColour = Color.black;

    public SpriteRenderer[] segments = new SpriteRenderer[7];

    public void Display(int number)
    {
        Color activeColour2 = new Color(1, DateTime.Now.Millisecond*0.001f, DateTime.Now.Millisecond*0.001f);
        var digit = number % 10;
        if (digit < 0) digit *= -1;

        for (int i = 0; i < 7; i++)
        {
            if (SEGMENT_IS_ACTIVE[digit, i])
            {
                segments[i].color = activeColour2;
            }
            else
            {
                segments[i].color = inactiveColour;
            }
        }

    }

    void Update()
    {
        Display(DateTime.Now.Second);
    }
}

However, now I want to interpolate through all the colors in the circle above over 1 second.
I don't know how to express this as a formula for R, G, and B. The RGB value is not linear relationship: as you spin the selected color in the chart, you can notice the RGBA components vary together in a nonlinear form.
I considered using Lagrangian interpolation. However, this will not be accurate or might fail greatly because if you take a reference point at the circle and assume in 1sec, it made a complete revolution, you will notice there is a certain period of time where the RGB value is constant along the path: either 0 and 1.
So is there any method to get a formula that perfectly fits the color chart with respect to time?

sentences:
How not to break licence laws? I have an idea for a game. Also I have almost everything worked out considering coding.

What interests me the most is how can I know if that game can be published.

As it would be for iOS and android, these markets are of the geratest interest for me.

I found on apples store something similair to what I would make and it's published by some big game developer. How can I be sure I am not breaking any laws when publishing the game? Can I make a game like board game 'Risk'?

I don't have any knowledge considering licencing. This game would be avaliable for free, with an option to donate, so money isn't my objective (but it won't hurt) [:

sentences:
How to set to fullscreen in GLFW3? In the version 2.7 everything was pretty simple:

glfwOpenWindow(Width, Height, 8, 8, 8, 8, 24, 0, isFullscr ? GLFW_FULLSCREEN : GLFW_WINDOW);

But in version 3.x there is no place where i can specify how my my window should be and by default its windowed:

glfwCreateWindow(width, height, m_windowName.c_str(), nullptr, nullptr);

How can i change my window to fullscreen mode?

sentences:
What events invalidate the Unity machine identification? I bought a new solid state drive, cloned the old one to the new using CloneDrive, removed the old drive and booted. Everything went well, but when I tried to start Unity I got this popup:

I am currently just toying around with the free version anyway, so this is no problem to me, but I guess it could be quite troublesome when someone would be in the middle of an actual project with the paid version.

It seems like replacing your hard drive invalidates your Unity license. What other changes to the PC hardware can cause this to happen?

I do not want to know how Unity detects hardware changes, I want to know which kind of hardware changes need to be avoided to prevent Unity from causing trouble which might lead to disruption of a project schedule.

sentences:
How do I Animate a character in Unity3D (Animator)? first of all, I am new to Programming and Unity, but I want to create a simple game with Unity3D. I am using the StandardAssets (character) where all animations are included, but I dont get how to change animation state.

In the beginning I used this simple c# script to move the player:

    //move the player
    //A/D / LEFT /RIGHT
    transform.Translate (Vector3.right * Input.GetAxis("Horizontal") * speed * Time.deltaTime);
    //FORWARD/BACKWARDS
    transform.Translate (Vector3.forward * Input.GetAxis ("Vertical") * speed * Time.deltaTime);

But then I was only able to move the player around without any animations.

In the "Animator I am using the standard Controller "ThirdPersonAnimatorController".
But how can I interact with the Controller/Animator? The Condition to change from Idle to Walk is CharStateMove = 1.
But How can I change this value? I thought of something like "CharStateMove++;"

Or is there a more easier way to animate a character? Because I dont want to spent the whole time on animate the character. A very simple Animation would be enaught for me...

sentences:
Libgdx game rendering works only after app resume I've encountered a strange problem while trying to develop my game.
I deployed the game to my Honor5C and when I open it, a red screen appears, because (I think) only these 2 standard lines of code are functioning properly:

Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

But every other sprite is NOT being rendered. The thing is, if I go back to the phone's main menu, without closing the app, and then I pop it back up again, everything works fine. Here's my render method:

public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    cam.update();

    world.step(1f/60f, 6, 2);

    batch.begin();
    batch.setProjectionMatrix(cam.combined);
    bgSprite.draw(batch);

    platformSprite.draw(batch);

    idleSprite1.setPosition((playerBody.getPosition().x * PIXELS_TO_METERS) -
            idleSprite1.getWidth() / 2, (playerBody.getPosition().y * PIXELS_TO_METERS) -
            idleSprite1.getHeight() / 2);

    idleSprite1.draw(batch);

    batch.end();
}

What could it be? I've found absolutely nothing googling the issue for an hour straight now. Thank you all.

EDIT @ Charanor

No static variables are being used.
Here's the initialization for the variables used in the render method:

batch = new SpriteBatch();

    background = new Texture(Gdx.files.internal("data/bg.jpg"));
    bgSprite = new Sprite(background);
    bgSprite.setPosition(-683f, -384f);

    platform = new Texture(Gdx.files.internal("data/platform.jpg"));
    platformSprite = new Sprite(platform);
    platformSprite.setPosition(-50f, -100f);

    idle1 = new Texture(Gdx.files.internal("data/Idle.png"));
    idleSprite1 = new Sprite(idle1);
    idleSprite1.setPosition(-70f, 0);

    cam = new OrthographicCamera();
    cam.position.set(0,0,0);

    viewport = new StretchViewport(1366f, 768f, cam);
    viewport.apply();

EDIT 2: I've discovered the game still keeps not working if, after launching it, you press the android "back" button and then pop the game back up . The red screen stays. It appears the only way to make it work is to launch the app, press the android button that lets you see what applications are active and switch back to the game from there. It's getting ridiculous.

EDIT 3: I've done some more testing and here's what I found: if you deselect the app and reselect it again either with the recent apps button or the home button we know it works. But, if you press the android back button (it goes back to the phone main menu) after the game is already working fine, and then reopen it, the problem comes back and the screen goes back to full red!

sentences:
Isometric Mouse Camera Panning I am building an isometric game environemnt and i want to be able to pan the camera around the map by holding the right mouse button, can someone talk me through the logic for this please, i have made an attempt and tried a number ways. I can get the camera to move correctly the first time but when i click and hold the second time the camera resets itself, thanks in advance for any help

import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.Timer;

public class CameraMovementTest extends JPanel{

private Timer timer;
private int DELAY = 10;
private  CustomMouseListener mouseListener;
private int positionX = 0, positionY = 0;

public CameraMovementTest() {

    mouseListener  = new CustomMouseListener();
    this.addMouseListener(mouseListener);
    this.addMouseMotionListener(mouseListener);
    this.setSize(500,500);
    this.setVisible(true);

    //Swing Timer
    timer = new Timer(DELAY, new ActionListener(){
        @Override
        public void actionPerformed(ActionEvent arg0) {
            update();
            repaint();
            validate();
        }
    });
    timer.start();
}

private void update() {
    if(mouseListener!=null){
        positionX = mouseListener.getX();
        positionY = mouseListener.getY();
    }
}

@Override
public void paint(Graphics g) {
    super.paint(g);
    g.fillRect( positionX,  positionY, 300,300);
}

public class CustomMouseListener implements MouseListener, MouseMotionListener {
    private int positionX = 0, positionY = 0;
    private int mouseClickX, mouseClickY;

    @Override
    public void mousePressed(MouseEvent evt) {

        if(SwingUtilities.isRightMouseButton(evt)) {

            mouseClickX = evt.getX();
            mouseClickY = evt.getY();
        }
    }
    @Override
    public void mouseDragged(MouseEvent evt) {
        if(SwingUtilities.isRightMouseButton(evt)) {
            positionX = mouseClickX - evt.getX();
            positionY = mouseClickY - evt.getY();
        }
    }
    @Override
    public void mouseMoved(MouseEvent arg0) {}
    @Override
    public void mouseClicked(MouseEvent arg0) { }
    @Override
    public void mouseEntered(MouseEvent arg0) { }
    @Override
    public void mouseExited(MouseEvent arg0) {}

    @Override
    public void mouseReleased(MouseEvent arg0) {}
    public int getX(){
        return positionX;
    }
    public int getY(){
        return positionY;
    }
}

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        @Override
        public void run() {
            JFrame f = new JFrame();
            f.setVisible(true);
            f.setSize(new Dimension(500,500));
            f.setContentPane(new CameraMovementTest());
        }
    });
}

}

sentences:
Tilemap-based level editor wishlist I'll be likely writing one this year. It will end up having unique design so things turn out on its own anyway.

Though, what an experienced level designer would want from a level editor? Requirements? Key features? Things that could be worth the time spent into implementing them?

sentences:
Why when drawing a circle using linerenderer the circle is not complete? using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;
    [Range(0, 50)]
    public float xradius = 5;
    [Range(0, 50)]
    public float yradius = 5;
    LineRenderer line;

    void Start()
    {
        line = gameObject.GetComponent<LineRenderer>();

        line.positionCount = (segments + 1);
        line.useWorldSpace = false;

    }

    private void Update()
    {
        CreatePoints();
    }

    void CreatePoints()
    {
        float x;
        float y;
        float z;

        float angle = 20f;

        for (int i = 0; i < (segments + 1); i++)
        {
            x = Mathf.Sin(Mathf.Deg2Rad * angle) * xradius;
            z = Mathf.Cos(Mathf.Deg2Rad * angle) * yradius;

            line.SetPosition(i, new Vector3(x, 0, z));

            angle += (360f / segments);
        }
    }
}

In the screenshot in the left of the circle there is a gap the circle is not perfect completed.

sentences:
How can one add a level to an already published ios/android unity3D game on a daily basis? How can one add a level to an already published iOS/Android Unity3D game on a daily/weekly basis?

I know this probably isn't feasible but it won't harm if I just made sure of it. Our game requires to allow access to just one level a day/week. You may access levels that were released on previous days and play to your heart's content but all players will get access to a new level every day/week. I know this may sound crazy but the concept requires it so just roll with me.

Is there anyway to achieve this for iOS/Android games built with Unity? Of course, we could package a whole game with 10 levels and allow access to each level after a set time, but the game will need to talk to a back-end CMS all the time to allow login and verification of users, make sure they aren't cheating, etc, etc, over proper security and https (proper anti-cheat solutions are a must and that's why maybe HTML5 route is better).

We are now moving towards doing all this in HTML5 and completely bypass Unity, but was hoping to find a solution with Unity because 3D is better than 2D depending on the situation, and some levels could be 3D while others 2D. Patching/updating everyday to upload new levels won't go down well with anyone, the app stores or the users.

sentences: Maintain speed, in 3D game, after collision in Unity I am making a simple breakout game. I have added bounce physics to the ball and to the bricks. When the ball collides with the bricks, the speed of ball slows down. I want ball to maintain its speed to what I set it to intially.

sentences:
Marketing games for the android - what are the best sites to contact for reviews/advertising? WE are in final dev stages of our latest game and want to release it for the android market.
What are the best sites to contact for reviews/advertising that specifically target the android users???

sentences: How to determine the amount of idel time left in main thread for Unity before next frame? Hi I'm trying to improve a thread tool and would like to make a function which use the idle time before the next frame. So how can I determine  the time left?

sentences:
Handling User Input Based on the Current Game State currently i'm developing a 2D game in my spare time and i'm confused on how to handle the input from the player.

Currently my game uses the state design pattern, each game state is a different object such as Inventory, Playing, Paused etc. All of these states implement an interface called State that have a Render and Input method that is called on whatever the "Current state" is in the game engine.

So my question is would you use multiple key listeners or key bindings, one for each state since the input the player will do differs dramatically between the different game states or would you use one key listener or keybinding somehow? Is there a best practice for this?

Thanks.

sentences:
Can't create "hero walking" animation I'm creating a Fez-based HTML5 Canvas game and animating my hero image using sprite sheets. The problem is that I can't create the animation of the hero walking, don't matter how much I try, the output is a weird animation that looks like the hero is just shaking its legs. Can someone help me? You don't need to create the sprite sheet for me if you don't want, just show me what's the correct leg position. I'll post the game link in a comment because I can't post more than two links.

Note that the "hero's legs" are compound by 3 pixels each, that are 2x up scaled.

Here is the sprite sheet:

the walking animation is compound by the 6 first frames.

EDIT: If you fall in the demonstration, open the console, type localStorage.x = localStorage.y = 0; and then reload the page immediately to return to the starting point.

sentences:
Adding Libxml2 to an Android project under Cocos2D-X I am having problems porting Libxml2. I like it because it works under windows like a charm with <libxml/parser.h>. When I reference the libraries I just cannot find the right path to them, their own references are broken and I don't know how to fiddle with Android.mk

What is the procedure?

sentences:
Overlap transparent particles without blending? (Unity) I'm trying to create a continuous output of light from an object (like the exhaust of a space ship), and I thought I'd use particles to achieve this. But I'm running into a problem with alpha blending.

I'd like to decrease the particle system's alpha over time, but because there's such a high density of particles, they end up evaluating to a solid color for most of the system's duration.

This blog post basically shows what I'm trying to achieve: https://mispy.me/unity-alpha-blending-overlap/

The idea is to use a stencil test to make sure pixels in a sprite/particle aren't gone if they're overlapping another sprite/particle.

Pass
{
    Stencil
    {
        Ref 2
        Comp NotEqual
        Pass Replace
    }
}

Then the author adds an alpha cutoff to make sure transparent pixels on an underlying sprite don't prevent new pixels from being written.

half4 frag (v2f i) : COLOR
{
    half4 color = tex2D(_MainTex, i.uv);
    if (color.a < 0.3)
        discard;
    return color;
}

But this solution requires you to eliminate soft edges, so I'm thinking it wouldn't look good in a particle system. The author also hinted at an alternate solution involving ZTest, but I can't visualize what that would be.

sentences:
Learning how to make imposters manually in Unity - how to render an object to a texture not what camera sees? I am trying to learn the most performant way to make an imposter in Unity manually - not using pre-fabricated solutions.

My first guess is that it should be achieved by using RenderTexture and a second camera and then taking different "snapshots" of different angles of the objec. If there are better alternatives in terms of performance (even if more difficult to implement), I would love to hear about.

In case that is the only path, then I have learned how to render from a camera to a texture via script, but I still couldn't figure it out how do the following, which is what I need to do first: how to render-to-texture a specific object without the background of the camera (i.e. with rest of texture being transparent) in a performant manner?

Pointers, suggestions or at least link recommendation will be great.

Thanks in advance.

sentences:
Unity animation skips first loop I have my player's animation controller managing two simple states: idle-walk.
States are switched via bools and everything works fine aside from the fact that the idle state doesn't render the first run of the animation loop.

To make it more clear when I start the game, in the animator I see the idle animation properly starting immediately (the azure bar loads immediately) but the player gets actually animated only after the first run of the animation, and the same goes when exiting the walk animation back to idle.

This is the animation structure, that very first idle cycle run in the controller but the player actually stands still...

Here's the function that move the player and set relative bools for animation switching:

public void MovePlayer(float horizontalInput)
{

    bool onEdge = playerTransform.position.x <= -2.5f || playerTransform.position.x >= 2.5f;
    float animSpeed = Mathf.Clamp(Mathf.Abs(horizontalInput) * 1f, 0.5f, 1f);
    anim.SetFloat("movingSpeed", animSpeed);

    if(horizontalInput < -0.2f && !onEdge)
        anim.SetBool("movingL", true);
    else if (horizontalInput > 0.2f && !onEdge)
        anim.SetBool("movingR", true);
    else
    {
        anim.SetBool("movingL", false);
        anim.SetBool("movingR", false);
    }

    nextPosX = Mathf.Clamp(playerTransform.position.x + (horizontalInput * playerSpeed * Time.deltaTime), -2.5f, 2.5f);

    playerTransform.position = new Vector2(nextPosX, 0);
}

The movingL/R bools are set true when the horizontal input pass a certain threshold and are set to false (back to idle) under that threshold. Hope this is clear enough...

sentences:
Can I mention other games' titles, characters, maps, weapons etc. in my game? Let's say I was about to make a quiz game where the questions are like this:

When was Fallout 4 released?
What is your first pickaxe in Minecraft?
Who do you have to kill as the last boss in Skyrim?

And let's pretend I have 1000 of these questions, from 1000 games.
What are the chances some of those 1000 could sue me, remove my game from the internet, pay them a fee etc.? Even if it becomes very popular.

Taking it one step further, could I buy their games, take in game screenshots personally, then use those as pictures in my own game?

Does it make a difference if it's a free-to-play or a game that has to be bought?

sentences:
What is the easiest and shortest way to draw a 2d line in c/c++? I am fairly new to c/c++ but I do have experiance with directx and opengl with java and c#. My goal is to create a 2d game in c with under 2 pages of code. Most of what I have seen requires 3 pages of code to just get a window running.

I would like to know the shortest code to get a window running where I can draw lines. I believe this can be done in less lines with opengl versus directx. Is there maybe an api or framework i can use to shorten it more?

Also, it would be nice if the solution were cross platform compatible.

sentences:
Unity project not communicating with my iPhone 11? Connecting to my iPhone 11 with a cool FaceTracking project called FaceCapOSCReceiverExample https://github.com/hizzlehoff/FaceCapOSCReceiverExample works excellent on my laptop, but not on my PC (Windows 10 and ubuntu dual boot. I am using Windows 10 for this project).
On my PC the only AntiVirus/firewall I have is Windows Defender. On the Inbound and Outbound rules, I deleted everything that had the word 'Unity' in it. I then added custom rules, allowing everything, for the program paths of Unity Hub and all Unity Editor installations.
But no luck. The program won't communicate with my iPhone.
I even tried turning the firewall completely off and re-launching Unity as admin. No luck.
I then manually installed the latest drivers for my network adapters (I have both "Killer E2400 Gigabit Ethernet Controller" and "Qualcomm QCA9377 802.11ac Wireless Adapter" in Device Manager).  No luck!
I also connected my PC to a personal hotspot from my iPhone. This was a tethered (purely USB) connection that I had running. But, while the tethered Internet worked great on my PC, it still didn't make the Unity project communicate with my iPhone! ;O;
I then added a rule to my firewall where I created a TCP port number 60001 and set it so private and public could connect. (I'm very newbie about ports) Then I entered that as the Port number within the Unity project. Still no connection was made...
I have no idea what to try from here! Like I said, it works great on my laptop, but my laptop is too dang laggy to use with it, so I would really love to get it running on my PC.

sentences: Making organic 2D tilemaps for tile based games So I have always wondered how one makes a nice (not so squarish) 2d tile map, is it possible?  all games now days I think use textured polygons...but my game engine (and engine) doesn't support that to my knowledge.  But it does support nice TMX files generated by mapeditor.org's Tiled Map Editor.  Though in my game I want nice twisting and turning caverns to traverse ... I was wondering some ideas on such a process... is it in the art style? The type of tile engine? both? So what are some common techniques?

sentences:
Algorithm to verify if a shape is inside another I have a rectangular canvas and I need to verify whether a shape is totally inside that canvas or not. The shape can be lines, ellipses, arcs, rectangles and arbitrary polygons.

Does anyone know a lib with this kind of algorithm, preferably in java?

I searched and found just Slick2D, but it has a bug exactly on the method that verify if shape contains another shape.

Just to exemplifly, in the figure only shapes 2, 4, 5, and 7 are inside the canvas.

sentences:
Managing draw calls for customized materials when targeting mobile I want to know how to minimize draw calls when rendering multiple customized characters onscreen, presumably with 3-4 materials apiece. Is there a better way to achieve custom color configurations than instancing/duplicating materials? Am I overthinking the problem?

Our game is a frenetic, goofy arena fighter, made in Unity. We plan to publish on mobile, first. I am tasked with creating an art pipeline which allows for customizable additions and color changes to the player's avatar. I'm trying to look ahead to when this character creator will be a part of the game and consider the performance implications of this kind of system. A character creator could potentially serve us in the generation of random NPCs at launch, and will feature heavily when we move to multiplayer.

My concern is with the number of draw calls on mobile. Currently, we have a bunch of identical characters, all creating instances of the main material on spawn to differentiate by random color. Since draw calls are directly linked to the number of materials onscreen, this process concerns me. Before complicating the issue with variations in mesh and texture on a per-object basis, having 1 material per character already limits us to a certain number of NPCs onscreen.

I delivered a material solution which allows changing one color to differentiate from other characters. Now the director is asking about the feasibility of breaking each character into multiple materials to allow for player customization. With 4 materials per character (1 shared), draw calls would increase geometrically per spawn. I've heard mobile platforms tend to be limited to about 20-120 draw calls between low and high end devices. That would make for 5-35 characters allowed onscreen at once, assuming we could get the environment down to  around 5 draw calls.

I would be especially interested in any material masking techniques people are aware of. Having a need for around 4 customizable aspects would seem to point towards using some sort of RGBA texturing and masking solution, but I have no idea how to make Unity do that.

sentences: How do I make a custom tileset for Flixel that supports autotiling? I've been Googling this problem for a while now. I'm currently porting one of my Java games to Flixel, and I want to use the original 16x16 tileset I made. In the original game I implemented my own autotiling system, but I would prefer to use Flixel's autotiling system. However, I cannot determine how to lay out my tileset, or how to tell Flixel to use it. I have two different types of tiles, and I want both types to autotile to connect with tiles of the same type but not tiles of the other type, if possible.

sentences: Tools/methods for creating demo videos of iPhone/iPod Touch games? I'd like to create a simple demo video of a game for iPhone and iPod Touch.  What tools do people use for this?  Ideally I can capture the device's screen... as opposed to the simulator.  Also the game uses tilt controls... hence capturing the device's screen helps put actual game play into the demo video.

sentences:
Network interpolation wont work for local player im currently developing a little duengon crawler. It should have lan multiplayer and it works great but i think im sending to much packets. Should i send packets over network, when a player moves in delta time? But thats not my question.... Sometimes it lags when more than 2 players are online. So i thought interpolation would be a great idea. But im not sure if i did that right, because it isnt much more fluently when the player moves :/ Heres what i did :

    positionFromInput.set(posX, posY);

    differenzX = positionFromInput.x-position.x;
    differenzY = positionFromInput.y-position.y;

    position.x += differenzX/10;
    position.y += differenzY/10;

I thought this would be right ... but it wont work what i did i missed ?

>>>UPDATE<<<

I think it only wont work for the local player because , if theres another player, his position is sended to the host, right after that the other player is drawn correctly with interpolation...

Heres how i move my local player :

public void update(){

            state = 0;

           if(Gdx.input.isKeyPressed(Keys.A) && moveDirections[0]){
               position.x -= Gdx.graphics.getDeltaTime() * 200f;

               state = 1;

           }
           if(Gdx.input.isKeyPressed(Keys.D) && moveDirections[1]){
               position.x += Gdx.graphics.getDeltaTime() * 200f;

               state = 2;
               //System.out.println(currentState);
           }
           if(Gdx.input.isKeyPressed(Keys.W) && moveDirections[2]){
               position.y += Gdx.graphics.getDeltaTime() * 200f;

               state = 3;
               //System.out.println(currentState);
           }
           if(Gdx.input.isKeyPressed(Keys.S) && moveDirections[3]){
               position.y -= Gdx.graphics.getDeltaTime() * 200f;

               state = 4;

           }

}

This is being called in an Launcher, which is called in the render method.

Class Launcher{

.
.
.

public void update(){

    gameScreen.player.update();

    // other stuff like updating packets
    .
    .
    .

}

.
.
.

}

And this is called in the render thread :

@Override
public void render(float delta) {

.
.
.

launcher.update();

.
.
.

}

Thats not all, i also need to draw my player :

public void draw( final float posX, final float posY,  OrthographicCamera camera){

    interpolate(posX, posY);

      camera.position.set(position.x/Box2dVars.UNIT,position.y/Box2dVars.UNIT,0);
    camera.update();

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    batch.draw(currentFrame, position.x/Box2dVars.UNIT, position.y/Box2dVars.UNIT, playerWidth/Box2dVars.UNIT, playerHeight/Box2dVars.UNIT);
    batch.end();

}

The interpolate() is just the interpolation....

private void interpolate(float posX, float posY){

    interpolatePosition.set(posX, posY);

    differenzX = interpolatePosition.x-position.x;
    differenzY = interpolatePosition.y-position.y;

    position.x += differenzX/10;
    position.y += differenzY/10;

}

To draw the player it is also gonna called in the render thread :

@Override
public void render(float delta) {

.
.
.

launcher.update();

.
.
.

player.draw(launcher.getPlayerX(),launcher.getPlayerY());

.
.
.

}

sentences:
Is it feasible to create a blockchain to use as a market place game mechanic without extreme inflation? After watching a fascinating video about block chains, the narrator brought up the idea of using block chains in video games. The example he used was in an MMO type of situation where the player used a sword to defeat a dragon and then the sword became known as Dragon Slayer and its stats would go up and the value of it would increase as well. The player would then sell it to another player who used it to defeat some other powerful monster and it gained more stats and its name changed again. Obviously, it needs to be fine tuned a lot more before it is a feasible idea considering if a sword is owned by say 1000 players then, its description couldn't hold that much information and would need to be limited.

I am thinking of using the block chains similar to the above example except bring it to more of a market place type of mechanic. The player maybe goes through dungeons to defeat monsters. The deeper you go the higher the value of your weapon goes up (stats and gold value) and the higher dungeon you get to the more powerful weapon you will need.

As I think about this concept more I find myself wondering how I could avoid extreme inflation of the in game currency. I'd like to get away from micro-transactions but, I know that is a big tool in helping keep inflation down. (i.e. a second currency). What are some other key ways to keep inflation down in a fast growing in-game economy?

I guess the main thing I see happening is that the balance between the skills earned vs. value earned on a weapon need to be extremely similar so that combat farming doesn't occur in the lower levels but also so that players don't just hold onto the same weapon the whole time they play the game either.

I guess that could be part of the solution but, maybe there are more concrete answers out there that may prevent extreme inflation of in game currencies.

sentences:
Unity directional light for a day night cycle on a hex sphere So I am trying to create a Day Night cycle on a sphere but it doesn't work the way I want it to.
As the model is hex tiled, you see the edges of the hex tiles also lit up like below. I am using a directional light source for the same.

I don't want the above effect. I want it to ignore the edges and just be a straight line instead. Something like below

Is there a way inside Unity that I could achieve this effect just using the lights?

sentences:
Unity Visual Effect: Play() has no effect I am making my first visual effects, and I make effect, when my ship is flying. So I am want to play it only when the ship is actually moving. I would suppose it's easy, you call Play(), it will play. You play Stop() it will stop. But when I call play, nothing happens.
public void Update()
{
    _ship.Rotate(Input.GetAxis("Horizontal"));

    var move = Input.GetAxis("Vertical");
    _ship.Move(move);
    if (move > 0)
    {
        FlyEffect.Play();
        FlyEffect.SetVector3("Velocity", new Vector3(0, -_ship.Speed * move, 0));
    }
    else
    {
        FlyEffect.Stop();
    }
}

When I let in Initial Event Name OnPlay, it is playing as it should be. But nothing from the script... What I am missing here?

sentences:
LibGDX: How to make an object falls with random speed I'm trying to make an object (ball) fall into position Y and when the ball collides with the base. The sprite changes and along with the change I want the speed of the fall to change according to the sprite

public void create () {
    circleBall = new Circle();
    rectangleBase = new Rectangle();
    ball = new Texture("ball.png");
}

public void render () {
    spriteBatch.begin();
    fallBall();
    rand();
    spriteBatch.end();
}

void fallBall(){
    fallSpeed++;
    if(posYBall > 0){
        posYBall -= fallSpeed * 2 / 2;
    }
}

void rand(){
    int rand1 = random.nextInt(15 - 1) + 1;
    int rand2 = random.nextInt(10 - 1) + 1;
    int rand3 = random.nextInt((55 - 35) + 1) + 35;
    collisionBallBase(rand1, rand2, rand3);
}

void collisionBallBase(int rand1, int rand2, int rand3){
    if(Intersector.overlaps(circleBall, rectangleBase)){
        if(rand1 <= 5){
            ball = new Texture("ball.png");
        }else if(rand1 <= 10){
            ball = new Texture("ballb.png");
        }else{
            ball = new Texture("ballc.png");
        }

        if(rand2 >= 5){
            ballDirection = 4;
        }else{
            ballDirection = -4;
        }
        fallSpeed = -rand3;
    }
}

sentences:
Java enum pairs / "subenum" or what exactly? I have an RPG-style Item class and I stored the type of the item in enum (itemType.sword). I want to store subtype too (itemSubtype.long), but I want to express the relation between two data type (sword can be long, short etc. but shield can't be long or short, only round, tower etc). I know this is wrong source code but similar what I want:

enum type
{
    sword;
}

//not valid code!
enum swordSubtype extends type.sword
{
    short,
    long
}

Question: How can I define this connection between two data type (or more exactly: two value of the data types), what is the most simple and standard way?

Array-like data with all valid (itemType,itemSubtype) enum pairs or (itemType,itemSubtype[]) so more subtype for one type, it would be the best. OK but how can I construct this simplest way?
Special enum with "subenum" set or second level enum or anything else if it does exists
2 dimensional "canBePairs" array, itemType and itemSubtype dimensions with all type and subtype and boolean elements, "true" means itemType (first dimension) and itemSubtype (second dimension) are okay, "false" means not okay
Other better idea

Thank you very much!

sentences:
How do you find the "best" color palette for a game? If I want to make a 3D game, and I want all my textures to be 8 bit, to save RAM, that is 256 indexed colors, including "transparent", how do I choose the colors?

Is there any recommended pre-defined palette? (Link?)

The end-rendering would use full colors, based on lighting, ...

sentences:
Monogame resizing GraphicsDeviceControl in WindowsForms? I'm currently working on a custom Map editor using Windows Forms.

I have a class inheriting from GraphicsDeviceControl (called MapDisplay) that I'm using so that I may use spritebatch to draw the map onto the form. I have this map display control inside of a split panel on my form, and it adjusts its size depending on the size of the map that's loaded. Currently I use mapDisplay.Width and mapDisplay.Height to change it's size, then use mapDisplay.Invalidate() so it redraws.

The problem comes when the width or height of the map display gets above a certain amount, it goes blue and stops working. How do I stop this from happening?

Cheers!

sentences:
How do I deal with abstracting collision handling code between entities with differing collision components? I'm using a component based entity design with Components that hold the data and Systems that act on entities based on the components they have. Entities are registered to all systems as they are created. If the entity has the list of components the system requires then it'll add it to the system's list to be processed on Update.

Lets say I have a BoundingBoxCollisionComponent a BoundingCircleCollisionComponent and an EdgeListCollisionComponent.

I have various entities that each have one of these components. For example a player entity could have the BoundingBoxCollisionComponent, a bullet entity could have a BoundingCircleCollisionComponent and a gameworld entity could have an EdgeListCollisionComponent.

Note that my player, bullet and gameworld names aren't types, they're just templates that define components that they all have along with default values for those components.

Any collision handling class(es) need to overcome the following issues, that I can't figure out how best to overcome.

Obviously the collision detection code is different depending on the exact CollisionComponent that 2 entities have. How can I effectively create classes to handle checking 2 entities for a collision, given that I could add other collision components in the future?
In the scenario above I wouldn't want to check each Bullet for a collision with every other Bullet. Once the entity is created from the bullet template all notion of it being a bullet disappears, so How can I manage what entities should be checked against what others? Do I need to have an EntityTypeComponent which would have Bullet, Player... so I can define in a class somewhere what collides with what, or maybe I could do it at entity creation time (when I know what template is used to create the entity)?

sentences:
Level/Asset design for performance Unity I am a big fan of modular assets.
Currently I am designing a 3d game for mobile and I don't know how I should create my levels to get the most out of the device.

Should I...

create lots of "small" (1x1x1 meter) assets and build my level using them
or create one geometry for the entire level?

What about textures?
Should "all" objects share one highres texture and only display their part using the right UV settings (like say in minecraft)or should I create an individual texture for each object?

sentences:
Creating a Player object in a physics engine I have a working physics environment using Farseer - but how do I create a player object that can walk around?

My current attempt involves applying forces to a rectangular body whenever keys are pressed.

This... works... to some degree. The player box moves around and such, after significant angle damping doesn't flip over much either. But I want a smooth moving simple player that can walk around and climb slopes but not walls and stuff like that. As it currently stands, the player object can climb any slope no matter how steep due to continue sideways force being applied. The player also does not stop quickly, but rather slides heavily due to low friction - and raising the player body's friction value doesn't help all that much.

I just don't know how to do a standard player object without making it move around in ridiculous ways due to the physics engine being a full physics engine.

sentences:
Bodies are colliding but refusing to rotate in Box2D I'm running box2d in C++ and hooking it up to C# via p/invoke. All physics stuff occurs in C++.

My problem is that bodes know when they are colliding and do so with great precision. However if I have two boxes which are 10x10 units, one located at the origin and is static while another is set 30 units in the sky 4 units across and is dynamic, when the dynamic box falls and hits the static one it stops falling but doesn't turn and slide off the edge.

Here's a screenshot of what I mean:

The box on top is as far to the left as it possibly can be, any further left and it will fall past the box on the bottom. There is barely a pixel overlap that's keeping the top box there. As you can see it's not rotating to fall off.

This also happens (again only the lowest most box is static, the rest fell down a distance to get there),

Any ideas what I'm doing wrong?

My code for creating boxes is as such:

extern "C"
int CreateBox(b2Vec2 dim, b2Vec2 pos, bool dynamic, int worldid)
{
    dim.x /= 100.0f;
    dim.y /= 100.0f;
    pos.x /= 100.0f;
    pos.y /= 100.0f;

    World &g = GetWorld(worldid);
    b2BodyDef bodef;

    bodef.type = b2_staticBody;
    if(dynamic)
    {
        bodef.type = b2_dynamicBody;
    }
    bodef.position = pos;
    bodef.angle = 0;
    b2Body* pBody = g.m_pWorld->CreateBody(&bodef);

    b2PolygonShape groundBox;
    b2Vec2 center = b2Vec2(-dim.x / 2.0f, -dim.y / 2.0f);
    groundBox.SetAsBox(dim.x / 2.0f, dim.y / 2.0f, center, 0);
    for(int i = 0; i < b2_maxPolygonVertices; i++)
    {
        b2Vec2 vert = groundBox.m_vertices[i];
        vert.x += dim.x / 2.0f;
        vert.y += dim.y / 2.0f;
        groundBox.m_vertices[i] = vert;
    }

    b2FixtureDef fixtureDef;
    fixtureDef.shape = &groundBox;
    pBody->CreateFixture(&fixtureDef);
    //fixtureDef.density = 10;

    pBody->SetUserData((void*)++g.m_actorid);

    g.m_bodies.push_back(pBody);

    if(dynamic)
    {
     //   pBody->SetAngularVelocity(0.5f);
    }

    return g.m_actorid;
}

and I create the boxes in C# like so:

m_worldid = CreateWorld(ToB2(new Vector2(0, -1.8f)));

m_boxID1 = CreateBox(ToB2(new Vector2(50, 50)), ToB2(new Vector2(-51,300)), true, m_worldid);
m_boxID2 = CreateBox(ToB2(new Vector2(50, 50)), ToB2(new Vector2(0,0)), false, m_worldid);

Using the box ids I grab positions and rotations from the C++ code (and the get functions take into account that I've /= 100 the dimensions), it all works fine on that front, code here for those interested:

extern "C"
ActorTransform BodyTransform(int bodyid, int worldid)
{
    World &g = GetWorld(worldid);

    for(int i = 0; i < g.m_bodies.size(); i++)
    {
        if( (int)g.m_bodies[i]->GetUserData() == bodyid)
        {
            ActorTransform c;
            c.Position = g.m_bodies[i]->GetPosition();
            c.Rotation = g.m_bodies[i]->GetAngle();
            c.Position *= 100.0f;

            return c;
        }
    }
}

Another interesting thing to note is if I set an angular velocity on the box it actually is physically represented on screen and it can cause the box to fall off, setting rotatens on bodes also seems to work.

Actually continuing on from setting angular velocities. I found that if I set an angular velocity just once the velocity doesn't go away, even after it lands on the static box it continues to rotate as if it were a motor or something. I'm guessing this has something to do with my core problem since bodies aren't meant to maintain an angular velocity that was set on them just once..

so any ideas?

sentences:
Textures rotated 90 degrees when importing a .glb file I have a simple box, textured with bricks, in Blender:

I export this scene as glTF 2.0 and import into Godot. Here's the result:

As you can see, the bricks are rotated 90 degrees for some reason. Why, and how can I make it right?

sentences:
How to include a new file js in a project cocos2d js? I'm trying to include a new js file containing a new scene on a cocos2d js project, but every time try occurs the following error:

  Uncaught ReferenceError: GameScene is not defined.

I included my file in jsList and in appList:

"jsList"        : ["src/game_scene.js"],
    "appFiles"      : ["src/game_scene.js"]

The code of my scene looks normal:

var GameScene = cc.Scene.extend({
    onEnter:function(){
        this._super();

        var gameLayer = new GameLayer();
        this.addChild(gameLayer);
    }
});

The code on app.js to call my scene looks good too:

var gameScene = new GameScene();
cc.Director.runScene(gameScene);

What should I do?

sentences:
Tower Defence game scoring system I am in the process of developing my first game on android mobile platform, it’s a tower defence game and I am currently busy designing the scoring system.

At the end of the stage when the user has defeated all the waves of enemies I want to take his score and somehow calculate a rating out of 3 Stars.

What will the best way be to calculate a score?
When should I increment the score during gameplay for example when an enemy dies?
And how do I calculate if the score is worth 1-3 Stars at the end of the stage?

Basically I want help or any ideas on how the formula should look like and how to calculate if the user scored a 1.. 2... or 3 Stars.

My variables in game :

Every enemy has a value:   Example $5

The stage has a number of life’s before you are defeated: Example 20

Each stage starts with money that you buy your towers with: Example $120

Each towers costs money:  Example $30
A stage can consist of 1 or more waves of enemies.

Any help or ideas would be appreciated as I am new to game development….

sentences: Best 3rd Party DRM Solutions What are the best 3rd party DRM solutions available from a user experience, development integration, and security perspective?

sentences:
What are efficient strategies to support alternate spritesheets in Unity Context

Let's suppose a classic card game, designed in Unity (say the latest release as of now, so 2018.2.16). Visible cards are GameObjects with SpriteRenderers (probably a Card prefab). One or several script objects are responsible of instantiating card objects as required, and inform each card of its current value; the card then does whatever is needed to display the correct image. Now, here is the twist: we would like to offer alternate sets of images for the cards (let say 10 designs); these alternate images would be included in the application itself (that is, on-demand content is outside the scope of this question).

Stating the obvious

This is clearly a case for spritesheets. So at design time, pictures of each card of a set (52 regular faces, 2 jokers and card's back) are layout in a single image file (that is, one image file per card-set design). So we have 10 spritesheets, each containing 55 sprites, and only one spritesheet (and therefore only one version of each of those 55 sprites) is to be in use at any given time. We want to avoid having unused images in RAM and/or on the GPU. Therefore, only the currently selected spritesheet should actually be loaded.

Question

So the question is: how to efficiently load, manage and use sprites in such situation?

Envisioned strategies

My first intuition would be to go for something along the line of Resources.loadAll<Sprite>("CardSets/CardSetName"). That is, each card set would be split in 55 sprites, stored in a directory specific to that card set. However, many sources, including some official documentation from Unity, discuss Resources as an old and undesirable subsystem, and recommend moving away from it. So let's consider other options...

Suppose I am very patient and would not bother manually linking (or scripting in the editor...) every single sprites of every card sets, that is all 55 * 10 sprites, to some GameObject(s) inside the editor... Would it be reasonable? Would spritesheets for non-selected card sets be loaded in RAM and/or on GPU from the moment we open the scene, or only the spritesheet of the currently selected spritesheet? What if each card set is associated with a specific prefab instead, and I only instantiate the prefab corresponding to the currently selected card set?

Alternatively, assuming that all spritesheets is packed using exactly the same layout, would it be possible/make sense to reuse the sprite objects themselves, and instead swap their texture image? Would that be any better? How would one get access to these textures without having all textures be preloaded at scene creation, and yet avoid Resources.loadAll()?

At last, what about sprite atlas? They seem a very good candidate for this problem, but the same questions goes as for texture replacements: how would one get access to these textures without having all textures be preloaded at scene creation, and yet avoid Resources.loadAll()?

And there might also be other strategies I am not aware of...

Question (again)

Now, this is a lot of subquestions, and I don't expect answers to all of these. Simply put, what would be a correct and efficient strategy to load, manage and use sprites in this example situation, based on current Unity's technology?

Note 1: I know that this question is similar to How can I dynamically load the correct sprite from a sprite sheet? . I however think that is is significantly different in that 1) Unity's technology has evolved a lot since 2014 (official recommendations are now to avoid Resources.LoadAll(), and Sprite Atlas have been recently added) and 2) that other question considered only one card set, so it doesn't posed the extra issue of reducing memory usage.

Note 2: I am not really making a card game; this is only an example that make it easier to explain and present the core concepts that I want to clarify here (that is, proper strategies regarding management of alternate spritesheets). Please do not suggest that I draw text labels instead of having several sprites, that is not an applicable solution.

sentences:
How can randomly paired players fairly select a map? I'm developing a website for a board game that revolving around user-created boards.  Matches are currently created by selecting two people who have been waiting in a queue the longest and creating a match for them.  We will later implement matchmaking with specific users.

What is an appropriate way to select a map when a match is created with two random people?

Should one player be allowed to pick the map?
Should a random map be selected?
Maybe the players should rank a collection of popular boards by preference, then select the one with the highest average rating?

sentences: How necessary are shader coders? I know that gameplay mechanics programmers, either directly working with source or with scripting are needed, however there are so many shaders written already that I would imagine you could find anything to meet the visual effects you are looking for, is this a fair assumption?

sentences:
How to stop my particle systems from being frustum culled Please could somebody advise on whether it is possible to control the culling of particle systems in Unity? I am referring to the entire system, not individual particles.
In my use-case, I am modifying the vertex transformation to get the "distant object effect".
When the camera thinks it is not viewing something it will cull it (frustum culling).
For most game objects you can get around this by inflating the size of the bounds to make the camera think it is within its frustum and therefore not get culled. However, particle systems are not a single object, they are many particles and I can’t see a way of manipulating the total bounds of the system.
Any ideas?

sentences:
How do I avoid lag when dynamically loading a map chunk? I have a procedural 2d game which extends in all directions, on the surface similar to Terraria. When a player moves their camera close to the edge of the currently loaded terrain, I trigger an expand event, which loads new chunks of terrain. Each chunk is an N×N section of tiles. When I do this I get a stutter of about 1 second due to the cost of procedurally generating the new tile set.

How can I avoid that delay?

Currently, all new chunks are loaded in the same iteration of the update loop (bad I know). My current idea is to create a queue to store the chunks and only render 1 chunk per game update.

sentences:
Phaser / PIXI: World size vs. Stage size I am using Phaser to build a zoomable / pannable 2D map with the intended functionality being that the home camera position is always in the middle of the World coordinates. I have a problem where my Stage (Phaser.Stage) size is slightly smaller than my explicitly-set World coordinates, and it appears that my groups (Phaser.Group) within my world (Phaser.World) are the same size as the Stage (less than my world size).

From http://docs.phaser.io/Phaser.World.html:

  By default a world is created the same size as your Stage.

I am aware that Stage comes from PIXI and is used for rendering:

  A Stage represents the root of the display tree. Everything connected
  to the stage is rendered.

From http://docs.phaser.io/Phaser.Stage.html

  The Stage controls root level display objects upon which everything is
  displayed. It also handles browser visibility handling and the pausing
  due to loss of focus.

I have learned from the html5gamedevs.com forums that Camera (Phaser.Camera) does not have zoom capabilities (or multiple cameras) built-in at the time of writing this question (Phaser v2.1.1 | Pixi.js v1.6.1). Based on my experimentation so far, I believe that the camera translation (x, y) works by translating the world coordinates. However, I'm still running into some escaping issues regarding a camera offset with my zoom system.

I have not yet found any examples online (including the official Phaser examples) of working directly with the Stage (Phaser.Stage), or how the stage dimensions play into the World, Camera, and Groups.

What is the relationship between the Stage and the World in Phaser?

sentences:
Is RPC Safe and what is security layer of RPC? We're creating a MMO and I wonder is RPC safe or not ? Isn't RPC easily hackable by injecting to client and what is the security layer of RPC on Unreal Engine ?

For example; a player is walking and sending that information (new position, rotation etc) to other players, can't that player change movement speed or position with injecting ? What is validating; is that movement is valid or it was a hack ?

I checked on Google but didn't get answer for my questions.

Thanks o/

sentences:
Save slider value and load it? I'm trying to save a slider value and load it when I run again the game. but here is not working. yes, I can change the value and save it but not load it.

    public Slider Brightness;
    public float bri,briv; // only briv value I saving it.

    // Use this for initialization
    void Start () {
        PlayerPrefs.GetFloat("briv");
        Brightness.value = briv;
        }

    void Update() {
            briv = bri;
            bri = Brightness.value;

    if (Input.GetKeyDown(KeyCode.S)) {
        PlayerPrefs.SetFloat("briv",briv);
        Debug.Log ("save");
    }

        } // end update

sentences:
Reading and writing an anti-aliased texture in Direct3D9 I'm slightly confused about textures versus surfaces in Direct3D9. Now, it seems fairly simple that you can only read from a texture and only write to a surface, and when you create a texture then you can get surfaces to set as render targets from it.

What I don't quite get is the CreateTexture function. It's CreateRenderTarget equivalent for a surface which is only rendered to and never read has the options of anti-aliasing parameters, whereas CreateTexture doesn't, even though you can explicitly use it to create render targets.

Does that mean that it is impossible to create an intermediate texture for e.g. shadow mapping which has anti-aliasing?

sentences:
Distinguish between HTC Vive controller grip buttons in Unity In Unity, I can check for grip button presses via the SteamVR API like so:

if(controller.GetPressDown(SteamVR_Controller.ButtonMask.Grip)) { ... }

This results in either true or false so I can only check if any grip button was pressed but not specifically which one.

For Unity's Input API the documentation states [1]:

  The grip trigger differs between platforms:

  The HTC Vive controllers each have two grip buttons but both map to
  the same axis. The value for these buttons is 0.0 when not pressed and
  1.0 when pressed (intermediate values between 0.0 and 1.0 are not possible).

Source: https://docs.unity3d.com/Manual/OpenVRControllers.html

In this case it is again not possible to differ between the two grip buttons.

Is there any way in Unity to check which one of the grip buttons of a HTC Vive controller is pressed?

sentences: Manage a large number of independent actors in real-time I am working on a large scale real-time strategy game - ideally with thousands of units active at once - but I am having trouble managing all of the units at once without it becoming astonishingly slow. The problem is that it takes a while to update the positions and states of everything each time step. Do you know any design patterns/methodologies/tips for mitigating this?

sentences:
How to set speed of circular motion Edit 2 - clarification

Just to clarify, the issue I have at the moment is how I specify a time (in seconds) for a complete revolution to occur.  My delta is fixed and is 1/ticks per second (1/60).  As you can see with my linear sprite movement, I have a 'time' variable which is where I specify (in seconds) how long the sprite should take to travel the length (or height) of the screen. I'm looking at how I do this for circular movement.

Edit 1 - Results from suggestions

See at end of question.

Background

When moving my sprites along a straight path, I'm using delta so I can get the same rate of relative motion on all devices like so:

spriteGridX = 240/480;  //I start out with a virtual 'Grid' so I can scale position to all resolutions etc so 240/480 would place the sprite at the center of the screen (X)

spriteScreenX = spriteGridX * width;  //Scale to physical screen where width is the width of the current devices screen (viewport)

spriteXTime = 8f; //8 being the amount of time in seconds that this sprite will take to traverse the entire width of the screen

spriteXVel = 1/spriteXTime; //Velocity that will be used to move the sprite along the virtual grid position

So, when I need to move the sprite, I simply do the following:

spriteXGrid+= (spriteXVel * Delta) //+= for right -=for left. I'm using a fixed delta time
spriteScreenX = spriteGridX * width; //And again, convert to usable screen position for current device
drawsprite(spriteScreenX, SpriteScreenY); //Draw the sprite (drawSprite is just a method I've written to draw openGL quads and it takes the screen X and Y as coordinates - spriteScreenY not shown here but essentially same as X with height instead of width.

Now, I need to have a sprite move along a circular path. So far, I have a test up and running which directly acts on the 'screen' coordinates of the sprite directly like so:

Java Code

int rad = 25;
float angle = 50;

spriteScreenX-=Math.round(rad*Math.cos(angle));
spriteScreenY+=Math.round(rad*Math.sin(angle));
angle+=.1;

The Problem

Now, the above does work, but the sprite completes it's circular path way too quickly (it's doing approximately 1 revolution per second).

So my question is:

Am I doing this correctly and if so..........
How do I slow this down?  I won't particularly need to keep changing the speed, I just want to be able to set it initially.

Would really appreciate some pointers.

Edit 1

When I put the following the code above I get the following result:

If I put the following:

spriteScreenX-=Math.round(rad*Math.cos(angle*Math.PI/180*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*Math.PI/180*delta));
angle+=.1;

Or:

spriteScreenX-=Math.round(rad*Math.cos(angle*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*delta));
angle+=.1;

Something like this happens:

sentences: rough texturing on edges of mechanical parts How do major studios fake the effect of "wear & tear" on the edges of guns and other things? I've always wondered this, but today it got to the point where I figured, why not just ask you guys. I"ve tried painting a greyscale mask, where the edges show a rough concretelike texture (Painted white and use lerp in ue4) but for some reason I feel like There is something im missing. Then, today I noticed sometihng playing BO3 - the edges seemed to have some more specularity on guns. Is this my answer? What process would you go through to show roughed edges? What goes into that effect?

sentences: Where is the Mclip matrix & how do I set it? According to this article, the Mclip matrix will be used, but I didn't find any function in Directx11 to set this matrix. How do I set it?

sentences:
C++ Saving and Loading From Text File In my C++ program I am trying to develop a simple saving and loading function for my game. I can easily get the save function on it, but the loading part of it really stumps me.

What I need is to load the numbers on the file (line by line) and insert them into different variables for my player. I'm just not able to figure that out. I've even looked all around the inter webs.

Here is the code for the player save and load functions:

void Player::Save()
{
    std::ofstream savePlayerFile;
    savePlayerFile.open("Save/playerSave.dat", std::ofstream::trunc);

    savePlayerFile << x << "\n" << y << "\n" << prevX << "\n" << prevY << "\n" << health << "\n" <<
    health  << "\n" <<  mana  << "\n" <<  gold  << "\n" <<  level  << "\n" <<  maxHealth << "\n" <<
    maxMana << "\n" << strength << "\n" << defense;

    savePlayerFile.close();
}

void Player::Load()
{
    std::ifstream loadPlayerFile;
    loadPlayerFile.open("Save/playerSave.dat", std::ofstream::in);

    /*std::string line;
    while(std::getline(loadPlayerFile, line))
    {
        std::istringstream iss(line);
        */
    loadPlayerFile >> ( x && "\n" && y && "\n" && prevX && "\n" && prevY && "\n" && health && "\n" &&
    health && "\n" && mana && "\n" && gold && "\n" && level && "\n" && maxHealth && "\n" &&
    maxMana && "\n" && strength && "\n" && defense);
}

sentences:
Geometry shader wireframe not rendering correctly GLSL/OpenGL/C++ Im trying to make a tool for skinning 3D models, and as part of that, I need to show faces wireframed, making use of the geometry shader stage.

Im following the approach suggested here and here. My problem however, is that it ends up looking like this:

Where some of the lines get thicker when the faces are oriented in a specific way. This is my geometry shader: (The vertex shader just passes vertices, so theres no need to show it)

#version 400

layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;

noperspective out vec3 gDist;

void main()
{
//800,600=window size(make uniform later)
vec2 p0 = vec2(800,600) * gl_in[0].gl_Position.xy/gl_in[0].gl_Position.w;
vec2 p1 = vec2(800,600) * gl_in[1].gl_Position.xy/gl_in[0].gl_Position.w;
vec2 p2 = vec2(800,600) * gl_in[2].gl_Position.xy/gl_in[0].gl_Position.w;

vec2 v0=p2-p1;
vec2 v1=p2-p0;
vec2 v2=p1-p2;
float area = abs(v1.x*v2.y - v1.y * v2.x);

gDist = vec3(area/length(v0),0,0);
gl_Position = gl_in[0].gl_Position;
EmitVertex();

gDist = vec3(0,area/length(v1),0);
gl_Position = gl_in[1].gl_Position;
EmitVertex();

gDist = vec3(0,0,area/length(v2));
gl_Position = gl_in[2].gl_Position;
EmitVertex();

EndPrimitive();
}

and frag shader:

#version 400

noperspective in vec3 gDist;

const vec4 wire_color = vec4(0.0,0.5,0.0,1);
const vec4 fill_color = vec4(1,1,1,0);

void main()
{
float d = min(gDist[0],min(gDist[1],gDist[2]));
float i = exp2(-2*d*d);

gl_FragColor = i * wire_color + (1.0 - i) * fill_color;
}

So what am I doing wrong here? I feel like im missing something. Is anyone familiar with this?

sentences:
How can I maneuver an AI pirate ship for a sea battle? I'm trying to picture in my head what would be required to make an AI controlled enemy do the following in a top down pirate sailing game:

Approach the player ship
Bring player in line with port / starboard guns
Keep guns trained on player
Be able to manoeuvre around obstacles
Not cheat acceleration to achieve the above

When I first started thinking about the idea it was quite simple, but the more I think about it, the more complex the requirements become; with the major problem being the AI calculating perfectly the curve required to come up along side the player, or to better yet, make a pass along their bow / stern before coming along side without needing to let them quickly speed up / slow down to achieve this.

sentences:
How does hidden surface removal work? Lately, I've been learning some OpenGL for fun, and I've been thinking about hidden surface removal.

Say you have a high poly count static scene, with nothing that moves, no bones, physics, etc. Just static models to be drawn. I was thinking that you could put all the faces in the scene into a quad/octree. And with the camera position, and dimensions of the view frustum, you could traverse the tree to construct an index buffer of all the faces that are within the view frustum (facing towards you of course). You could then update the index buffer with glBufferSubData(), and draw with glDrawElements(), and you would do this every frame, and if my limited understanding is correct, this should theoretically draw only the faces you see, right?

So is this a good/valid way to do occulusion culling? If not, how else can you do it?

sentences:
Sanity checks vs file sizes In your game assets do you make room for explicit sanity checks, or do you have some generally expected bounds which you assert?

I've been thinking about how we compress data and thought that it's much better to have the former, and less of the latter. If your data can exceed your normal valid ranges, but if it does it's an error, then surely that implies you're not compressing the data well enough?

What do you do to find out if your data is compressed as far as it can be, and what do you use to ensure your data isn't corrupted and ensure it's an official release?

EDIT

I'm not interested in sanity checking the file size, but instead, how you manage your sanity checks and whether you arrange the excess size caused by the opportunity to do sanity checks by using explicit extra data, or through allowing the data enough file space (data member size) to be out of valid range and thus able to be checked merely by looking at the asset in memory after loading.

EDIT

QUOTE:
"runtime performance is valued very highly while maximal compression is merely a nice thing to have"

yes, but we're still having issues with our media being slower than decompression algorithms, especially with situations where programmers and data desginers have not considered the footprint of their data layouts and are unnecessarily creating assets that have redundant storage capacity.

I must assume that there are very few people who consider the importance of bandwidth outside of those working on platforms that are strictly bound by their data throughput rate or storage capacity.

sentences: Personal Custom Card Game I had the idea, to make a custom card game based off an Anime i like. I was wondering if it would be legal to have such printed out (using a custom card/board game service) for personal use. I would only play it with friends and not make any money off of it.

sentences:
How to calculate the reachable space of the end effector in an IK chain? I have an array of points in a 2d worldspace and I want to calculate which points are reachable by the end effector of a limb controlled with a CCDIK chain (with rotation limits applied).

It's a limb with 2 hinges (upper arm & lower arm)
The upper & lower arm have a fixed length
The 2 hinges have fixed rotation limits
This needs to be recalculated every update (continuously) as the limb is attached to a moving body
I work in Unity using C#

Crude Illustration of the problem:

My idea sofar is to create a polygon collider along the outer edges of the reachable space, and then look if the points are within the bounds of that collider. But I have no idea if this is the smartest solution, or if so, how to achieve this.

How could I solve this issue?

sentences:
How to develop a concept to receive funding? I have a game concept which I wish to develop but don't have the funding to begin it.

What should I do?

sentences:
Is a mesh OK to use for grass if there will be 1000's of them across the terrain? Am creating a low poly game in Unity 3D for PC.  The terrain is made in Blender, so it's a fixed size, but quite large for the player to explore.  I want to add things such as grass and flowers, but am not sure the best practices are for creating those types of assets.

Is using a mesh for small clumps of grass the wrong way to do this if there will be 1000's of them?

I will likely be using the occlusion culling system Unity provides, but I'm not sure if I still need to look at doing things such as grass in a different way for performance sake.

sentences: How to get an ESRB rating for my game? What does it take to get an ESRB rating for my game?

sentences:
Creating a retro-style palette swapping effect in OpenGL I'm working on a Megaman-like game where I need to change the color of certain pixels at runtime. For reference: in Megaman when you change your selected weapon then main character's palette changes to reflect the selected weapon. Not all of the sprite's colors change, only certain ones do.

This kind of effect was common and quite easy to do on the NES since the programmer had access to the palette and the logical mapping between pixels and palette indices. On modern hardware, though, this is a bit more challenging because the concept of palettes is not the same.

All of my textures are 32-bit and do not use palettes.

There are two ways I know of to achieve the effect I want, but I'm curious if there are better ways to achieve this effect easily. The two options I know of are:

Use a shader and write some GLSL to perform the "palette swapping" behavior.
If shaders are not available (say, because the graphics card doesn't support them) then it is possible to clone the "original" textures and generate different versions with the color changes pre-applied.

Ideally I would like to use a shader since it seems straightforward and requires little additional work opposed to the duplicated-texture method. I worry that duplicating textures just to change a color in them is wasting VRAM -- should I not worry about that?

Edit: I ended up using the accepted answer's technique and here is my shader for reference.

uniform sampler2D texture;
uniform sampler2D colorTable;
uniform float paletteIndex;

void main()
{
        vec2 pos = gl_TexCoord[0].xy;
        vec4 color = texture2D(texture, pos);
        vec2 index = vec2(color.r + paletteIndex, 0);
        vec4 indexedColor = texture2D(colorTable, index);
        gl_FragColor = indexedColor;
}

Both textures are 32-bit, one texture is used as lookup table containing several palettes which are all the same size (in my case 6 colors). I use the source pixel's red channel as an index to the color table. This worked like a charm for achieving Megaman-like palette swapping!

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

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

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

My shader files are listed below:

Vertex shader:

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

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

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

PixelInputType LightVertexShader(VertexInputType input)
{
PixelInputType output;

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

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

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

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

return output;
}

Pixel Shader:

Texture2D shaderTexture;
SamplerState SampleType;

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

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

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

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

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

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

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

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

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

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

return color;
}

sentences:
How can I maintain saved game backward compatibility? I have a complex sim game I want to add save game functionality to. I'll be updating it with new features continually after release.

How can I make sure my updates don't break existing save games? What sort of architecture should I follow to make this possible?

sentences: How to develop XBox 360 games? I understand that I can learn XNA as a hobbyist, but for top games like Fifa for example how are they witten?

sentences:
How can I simulate a limited (256) color palette in OpenGL? On Twitter, I found this screenshot of a game in development:

The image on top seems to be without any color limitation. But the two other pictures at the bottom have a 256 color palette.

I want to achieve a similar effect in my game (I am using OpenGL). How can I do so?

sentences:
What is the Basic Game Screen/Scene Life Cycle? Question

What is the standard or basic game screen/scene life cycle used in most games?

What is Screen/Scene?

The term screen or scene refers to the current displayed entity holder where game entities or objects are placed. I personally call it scene because the term screen for me is the hardware screen, but I have read that others call it screen as denoted by Screen Manager classes (I call it Scene Manager).

Understanding Scene Management and Game Scene Life Cycle

Here is my current understanding of a simple scene management and game scene life cycle:

Assuming, we have 4 screens/scenes in a basic game:

Splash Scene - used to display the company logo, the game logo and loading of most of the game resources used by the menu scene and loading scene.
Menu Scene - used to display menus and buttons, referred to as the "main menu" and the gateway to other scenes especially the game scene (sometimes there are settings scene, help scene and about scene).
Loading Scene - used to display a progress bar or anything related that indicates the loading and unloading of the game scene.
Game Scene - used to display the game logic and implementation of the game itself.

  start application ---(load splash scene contents)---> splash scene ---(load menu scene and loading scene contents and unload splash
  scene contents)---> menu scene ("start game" pressed) --->
  loading scene ---(load game scene contents)---> game scene ("return to main menu" pressed) ---> loading scene ---(unload
  game scene contents)---> menu scene

Start Application
Load Splash Scene Contents
Show Splash Scene
Load Menu Scene and Loading Scene Contents
Hide Splash Scene
Show Menu Scene
Unload Splash Scene Contents
"Start Game" Button Pressed
Hide Menu Scene
Show Loading Scene
Load Game Scene Contents
Hide Loading Scene
Show Game Scene
THE GAME IMPLEMENTATION
"Return to Main Menu" Button Pressed
Hide Game Scene
Show Loading Scene
Unload Game Scene Contents
Hide Loading Scene
Show Menu Scene

Is this the right way to do it in most cases? I know that the screen/scene life cycle varies depending on the game you are creating. I just want to know if this is the right way to do it or am I doing things the wrong way?

sentences:
Is JavaScript viable for serious multiplatform 2D game development? Ever since I was a little kid, my dream has been to develop games. Well, now that I am older, more mature, and have some programming experience, I would like to start. However, I would like to turn this into a career.

I would like to develop strategy games like "Stronghold" and "Age of Empires".

The problem is that my language of choice is JavaScript.

sentences:
Is it ok to use polymorphism as a way of "interfacing" with objects in a scene? I'm designing a class that holds values representing a 3D scene. This includes lights, cameras, meshes, materials, etc.

The way how I'm setting it up is that each "thing" has a name. A camera has a name, a light has a name, etc. But they also have an "interface" to access the object via pointer instead of having to name it each time something needs to be changed.

For example:

Light *light = scene.getLight("light2");
light->setBrightness(2.0f);

The problems is what Light is. Ideally, it's "proper C++" where it's a pointer directly to the internal object. However, these classes are closely tied to how the scene class works, which makes maintainability a mess. It's seems much easier to just have private implementations that do all the dirty work and only let the user receive pointers to an interface.

What I want to do is make Light an interface (struct with virtual functions, no data, no non-virtual functions except empty constructor) and implement the internal details as a private class inside the scene class. While this makes it more maintainable, it comes at the cost of using polymorphism where I'm not dealing with more than one implementation.

Any thoughts or ideas are helpful.

sentences:
How can I make my camera follow the player movement in a different position Basically my camera follows the character rotation and position, although the position of it its pretty uncomfortable to use, this is what I needed:

But this is what the I get:

I used a code that someone suggested me yesterday to use, I got a bit creative with it and changed some stuff to get other camera positions, but no matter how much I tweak the values the camera never gets the position that I need:

void LateUpdate()
{
    transform.position = player.transform.position - (player.transform.up * -10) + (player.transform.forward * -15);
    transform.LookAt(player.transform);

}

I have no idea how I can make it show less of the player back

sentences: POST & push for turn-based network? Can you create a viable two player turn-based networking implementation using only REST API for outbound and push for inbound data? If a game is comprised of, on average, 30 moves, is it a bad idea to just send 15 push notifications to each user? If hosting expense is less than income for each DAU, is this perfectly acceptable, or an abuse of what push is intended for?  ...Why or why not?

sentences:
Most efficient way to capture OpenGL ES content of iPhone screen I'd like to efficiently capture a "screenshot" of my OpenGL ES iPhone game.  I put screenshot in quotes because I really want to move the screen contents into a pixel buffer that I can eventually use to create a mov file using AVFoundation.

Currently I'm taking the screenshot with this method from Apple.  The resulting image is great... however capturing the image causes a small stutter in my game.  Looks like the call to glReadPixels causes the stutter.

How can I capture the screen's contents more efficiently?  Perhaps I can improve the efficiency of the call to glReadPixels?  Or perhaps I can populate a CMSampleBuffer or CVPixelBuffer without calling glReadPixels?

Perhaps the OpenGL ES data could be accessed directly somehow w/o having to copy the data into a buffer via glReadPixels.

Edit #1:  Perhaps a "Frame Buffer Object" could be useful?  Or "rendering directly to a texture"?

sentences:
Why should every light source have its own ambient light? I'm currently learning how to use OpenGl, and I'm following a tutorial on learnOpenGL. I'm at the lightning chapter, and it has introduced basic lightning, ambient and diffuse with specular highlight. Phong shading essentially.
I'm confused about the ambient term. I understand that the ambient light is basically a light that comes from nowhere in particular, and it just fills the scene you're in with a soft light. And it's used to fake Global Illumination in renderers that do not compute it, so that the stuff that's not in the direct view of a light source is not completely black but it has some generic lightning on it.
So going by the definition, before actually trying to implement a renderer myself, and by using other engines like UE4, I always just assumed that ambient light would be a separate thing from say a point light or a directional light. I thought it would be a parameter independent of other stuff that would basically just light the scene.
But in the tutorial, at least for the basic lightning part, the ambient is actually part of the light "object" itself. Essentially every light source has its own ambient light.
This seems counterintuitive to me. Why does every light need an ambient part too? Wouldn't make more sense to have a "separate" ambient light object that provides the ambient light itself?
Also, if my light has a radius of say 100 units, then outside of that radius nothing will receive any direct light, obviously, but also no ambient and will be completely dark. Isn't the point of ambient light exactly not to have scenes without direct light go completely dark?
Most importantly I'm wondering if this implementation approach is the standard used in modern game engines, or if it's maybe a simplification in the tutorial. (For example I don't remember seeing a parameter for ambient light in the light objects themselves in UE4)
Links for context:
https://learnopengl.com/Lighting/Basic-Lighting
https://learnopengl.com/Lighting/Light-casters

sentences:
How can SDL tell what Xbox360 controller is what player? I init my controllers like this:

if (SDL_WasInit(SDL_INIT_GAMECONTROLLER) == 1)
    return;
SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER);

int nJoysticks = SDL_NumJoysticks();
numGamepads = 0;
for (int i = 0; i < nJoysticks; i++)
    if (SDL_IsGameController(i))
        numGamepads++;

if (numGamepads > 0)
{
    for (int i = 0; i < numGamepads; i++)
    {
        SDL_GameController* pad = SDL_GameControllerOpen(i);
        if (SDL_GameControllerGetAttached(pad) == 1)
            joysticks.push_back(pad);
        else
            cout << "SDL_GetError() = " << SDL_GetError() << endl;
    }
    SDL_GameControllerEventState(SDL_ENABLE);
}

and I poll events like this:

SDL_Event sdl_Event;
while (SDL_PollEvent(&sdl_Event))
{
    switch (sdl_Event.type)
    {
    case SDL_CONTROLLERDEVICEADDED:
        cout << "DEVICEADDED cdevice.which = " << sdl_Event.cdevice.which << endl;
        break;
    case SDL_CONTROLLERBUTTONDOWN:
        cout << "BUTTONDOWN cdevice.which = "<< sdl_Event.cdevice.which << endl;
        HandleGamepadButtonsDown(sdl_Event);
        break;
    case SDL_CONTROLLERBUTTONUP:
        HandleGamepadButtonsUp(sdl_Event);
        break;
    case SDL_CONTROLLERAXISMOTION:
        HandleGamepadAxis(sdl_Event);
        break;
    case SDL_QUIT:
        _quit = true;
        break;
    default:
        break;
    }
}

With this I have currently two Xbox 360 controllers connected. On these pads there is a LED indicating if it is player 1, 2, 3, or 4.

When I run this my poll loop prints out this when I press a button on this controller:

When I hit a button on the controller with the player 2 LED it prints:

So that is wrong. How can I from inside the code find out what controller corresponds to the controller with the right LED light on?

Also, when I first start it then it prints:

So the controllers are 0 and 1 when I add them but 1 and 2 when I run the game.

sentences:
Directional light and finding relevant shadow casters Right now when culling the models to render for the directional light shadow map pass I just do a view frustrum culling using the main camera. At some angles, the objects will be outside the view but still obviously should cast shadows.

My question is, how do you cull/gather all the relevant shadow casters for a directional light?

sentences:
Calculating damage with damage mitigation/amplification curve/function Let's say instance A is attacking instance B for N damage. I want to calculate the ideally expected damage if those instances have damage mitigation/amplification depending on target's current HP.

Instance B has an ability that it will take less damage as its HP gets lower. It could be like a (half of) sin curve, or maybe some complex function. So the formula look something like this:

$$damage = damage_{raw} \cdot ({1 \over 4} + {3 \over 4} \cdot \sin ({\pi \over 2} \cdot {hp \over hp_{max}}))$$

B will have 75% damage mitigation at 0% HP and 0% at 100% HP.

What I want to here is to chop the damage into infinite pieces and apply each to B so B can fully utilize its ability, and get the value after the process.

Also I'd like know how I'll calculate it when A has a similar ability that also changes the damage, like, increasing damage if the target has lower HP. Also there can be a case both of the instances have a variety of damage changers.

I think it's related to calculus but I have no knowledge about it.

sentences:
How would one draw many objects using the same VBO I'm kind of stuck with this question for some time now, maybe because I don't know exactly what to search for, it might be a term I have not heard of yet as most tutorials ends after drawing one object to the screen using a VBO.

Being a newbie to OpenGL as well as GLSL I do know at least a few things, one being that you always want to send as little information as you can from CPU -> GPU and by as few times as possible (better to send all data at once, instead of many small packages per frame). Knowing this tells me that there must be a better way to draw many of the same object, say a teapot, than looping over transformations then "glDrawArrays" and then repeating that step over and over.

It should be possible to send some kind of array containing the number of teapots you want to draw and all the positions/transformation-matrix you want for them.

I know I could possibly put multiple teapots into the same VBO with all the vertex data offset, but that would double the vertex-data and make it less flexible, seems like a bad solution to me.

So what is the right solution to drawing many of the same VBO at different transformations with a single or as few draw calls as possible?

sentences:
Viewport / Camera Calculation in 2D Game we have a 2D game with some sprites and tiles and some kind of camera/viewport, that "moves" around the scene. so far so good, if we wouldn't had some special behaviour for your camera/viewport translation.

normally you could stick the camera to your player figure and center it, resulting in a very cheap, undergraduate, translation equation, like :

vec_translation -/+= speed (depending in what keys are pressed. WASD as default.)

buuuuuuuuuut, we want our player figure be able to actually reach the bounds, when the viewport/camera has reached a maximum translation.

we came up with the following solution (only keys a and d are the shown here, the rest is just adaption of calculation or maybe YOUR super-cool and elegant solution :) ):

if(keys[A])
{
    playerX -= speed;

    if(playerScreenX <= width / 2 && tx < 0)
    {
        playerScreenX = width / 2;
        tx += speed;
    }
    else if(playerScreenX <= width / 2 && (tx) >= 0)
    {
        playerScreenX -= speed;
        tx = 0;

        if(playerScreenX < 0) playerScreenX = 0;
    }
    else if(playerScreenX >= width / 2 && (tx) < 0)
    {
        playerScreenX -= speed;
    }
}
if(keys[D])
{
    playerX += speed;

    if(playerScreenX >= width / 2 && (-tx + width) < sceneWidth)
    {
        playerScreenX = width / 2;
        tx -= speed;
    }
    if(playerScreenX >= width / 2 && (-tx + width) >= sceneWidth)
    {
        playerScreenX += speed;
        tx = -(sceneWidth - width);
        if(playerScreenX >= width - player.width) playerScreenX = width - player.width;
    }
    if(playerScreenX <= width / 2 && (-tx + width) < sceneWidth)
    {
        playerScreenX += speed;
    }
}

i think the code is rather self explaining:

keys is a flag container for currently active keys, playerX/-Y is the position of the player according to world origin, tx/ty are the translation components vital to background / npc / item offset calculation, playerOnScreenX/-Y is the actual position of the player figure (sprite) on screen and width/height are the dimensions of the camera/viewport.

this all looks quite nice and works well, but there is a very small and nasty calculation error, which in turn sums up to some visible effect.

let's consider following piece of code:

if(playerScreenX <= width / 2 && tx < 0)
{
    playerScreenX = width / 2;
    tx += speed;
}

it can be translated into plain english as : if the x position of your player figure on screen is less or equal the half of your display / camera / viewport size AND there is enough space left LEFT of your viewport/camera then set players x position on screen to width half, increase translation (because we subtract the translation from something we want to move). easy, right?! doing this will create a small delta between playerX and playerScreenX.

after so much talking, my question appears now here at the bottom of this document:

how do I stick the calculation of my player-on-screen to the actual position of the player AND having a viewport that is not always centered aroung the players figure?

here is a small test-case in processing:

http://pastebin.com/bFaTauaa

thank you for reading until now and thank you in advance for probably answering my question.

sentences:
Unit testing graphics What is the standard (if there is one) method which professional games developers use to unit test (or closest equivalent) graphics output?

I am developing with Corona SDK and I would like to test the visual output of my game code. I don't believe it is reasonable to pre-generate screenshots, scene definitions or some such for comparison at the end of a test, I would like to know if there is a good testing mechanism for graphics in general.

sentences:
Sending a Tilemap Layer over a socket connection (GMS2/GML) I'm working on a multiplayer game in GameMaker Studio 2 using sockets and built-in networking functions. I have a server that can receive and send messages to and from clients.

What I'm trying to do is take the map data (on the server) and send it to the clients, so that I can create a map on the server and have it automatically sent to clients upon entering the game. This map will be a Tilemap Layer.

Does anyone have any ides on how to serialize a GameMaker Studio 2 Tilemap to a data type that can be sent over sockets?

sentences:
Roguelike Map Structure I'm working on a roguelike and would like to know how to structure my map data. I suppose this question could also be extended to any sort of top down 2d game. Anyways! My game will contain object types like terrain, doors, switches, monsters, and items. How should the objects be stored within a map?

Some ideas I've gathered online:

The map is a 2d array. Each cell in the array can store multiple references to objects occupying it.
The map contains several layers of 2d arrays, and each layer stores references to objects of a specific type.
Like 1. but only store static terrain information in the 2d array. The rest of the objects are dynamic and stored in lists for each type.

sentences:
How to prevent the "Too awesome to use" syndrome? When you give the player a rare but powerful item which can only be used once but is never really required to proceed, most players will not use it at all, because they are waiting for the perfect moment. But even when this moment comes, they will still be reluctant to use it, because there might be an even better moment later. So they keep hoarding it for a moment which will never come.

In the end, they will carry the item around until it is outclassed by other, more readily available resources, or even until the very end of the game. That means that such one-shot items don't provide any gameplay-value at all. They are simply too awesome to use.

What can you do to encourage the player to make use of their one-shot items and not hoard them?

sentences:
3D Model Loading in DirectX 11 At the moment I am trying to implement fbx model loading in my DirectX 11 code. This is old code I had create for use with DirectX 9 and I'm simply trying to bring it back up to date.

Since I first create the code, the SDK version I used was 2012.2, not autodesk have released 2014.1. With that, I have managed to update all of my code bar one issue; my sdk seems to be missing all of the .lib and .dll files I need.

In my old code I needed add the following dependency:

  fbxsdk-2012.2-mdd.lib

I thought it would be a case of changing it to:

  fbxsdk-2014.1-mdd.lib

But this doesn't work. I've spent all weekend trying to find a solution to this, but can't. Does anyone know what I need to do in order to genereate these dll and .lib files?

I've downloaded all of the different SDK options from autodesk, I've searched for the 2012.2 version of the SDK, but got nothing. Failing that; can anyone recommend a good library. or way to implement 3D model loading into my project?

I've tried looking at AssImp but found it a nuisance to work with. So I would like to avoid if possible.

sentences:
Basic billiards game: Can't detect collision between cuestick and cueball I have a basic Unity project on GitHub.

Basically, I have a Cuestick that aims and shoots using the mouse. You can rotate around the cueball with your mouse and when you're ready to shoot, you can hold down the right mouse button and move the mouse forward. The game came follows the cuetip.

However, the collision between the cuestick and cueball is wonky. The cuestick protrudes through the ball and only pushes the ball forward only a little bit.

I've created rigid bodies and colliders for both cuestick and cueball. I've set the cuestick's rigid body to kinematic (if it's unchecked, the poolstick will barely dent the ball). I've tried using OnCollisionEnter and a Debug.Log statement to no avail.

Any help would greatly be appreciated. You can find my scripts in /GameLogic (they're F# sharp scripts whose binaries get compiled and outputted into the /assets folder).

sentences:
How do I make a turn based game for two players who play with different devices on iOS? I only have experience in physics-based games in cocos2d.

I want to develop a turn-based game in Cocoa Touch (iOS). Two players will play this game on different devices which connect via Bluetooth or Game Center.

I'd like to know how to synchronise two devices through a Bluetooth connection.

Please tell me of any blog tutorial, guide, or sample code which will help.

sentences:
Render texture seems to ignore camera background type I'm currently trying to pull a fog of war for an rts game, and planned it like this. (Unity 2020.2.7, URP 10.3.1)

Use units field of view to generate a texture of what is seen (alpha 0).
Create other render texture to generate fog (alpha > 0  && alpha < 1) by not clearing camera buffer.
Use the mask made between the two textures to cut the fog of war (alpha 1).

Now i'm currently stuck at the 2nd step. Please check the image

As you can see, the camera is doing what I want, but the render texture somehow clears the buffer, which  just gives me the "Use units field of view to generate a texture of what is seen (alpha 0)." part again.
This whole buffer thing has been hard to understand, i'm not sure if this implementation is right or not.
I would be really thankful for any pointers given! :D
Cheers guys!

sentences:
How do I go from a simple html5 tic tac toe game to an online 2 player game? I've been working on an online 2 player Tic Tac Toe solution for blackberries. both old and new. And so far I have html5 code that has a 3 x 3 layout that switches between x and o for the game mechanics. I believe I'm still missing a check for win function but my question is about the server side of this game. I'm not sure how to go about learning what exactly I want. how do you take what I have now, and make this into a functioning online game?

I've been told WAMP is a good solution, as well as IIS. and its all really over my head, so i'm hoping to get a little more clarity as far as what I should focus on to bring this game to life.

sentences:
Managing Unity Scenes during refactoring? Most of my Unity project code is in a visual studio project, and I use Unity for UI/Rendering/wiring things together.

I renamed some fields in an object and suddenly the game, when run in unity, became unrunnably buggy. It turned out that a field I had set in the unity frontend had been unset when I renamed it.

What's a good way to avoid these sorts of problems when working with unity? I was using version control and could have reverted to an old build in the worst case, but I couldn't find any human-readable Unity Scene files that could have just shown me what I changed.

sentences:
My player sprite get stuck to walls while moving along Hello,

My player sprite is moving along the wall (not even diagonal, just straight down) and get randomly blocked in the corner of some walls. By blocked, I mean that the Y movement is stopped.
If I move him away from the wall, he might not be blocked again by the same wall and get blocked at some other walls, always at a corner.

The walls are all the same sprite and are of the same size.

I use 2D Box Colliders for the walls. The player sprite has a Box Collider 2D and a RigidBody 2D. I am not using any physics codes, I would just like to make it work with the built-in Unity physics.

I move the player by adjusting the velocity of the rigidbody according to Input:

RigidBody2D rb = GetComponent<Rigidbody2D>();
float horizontal = Input.GetAxisRaw ("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector2 movement = new Vector2(horizontal, vertical).normalized *speed * Time.deltaTime;
this.rb.velocity = movement;

The player is set like this:

Do you have any idea why it behaves like this and how I could fix it?

Thanks for your help.

sentences:
How To Blit an Image onto Only Opaque Parts of a Surface? I want to blit an image onto the parts of a surface that aren't transparent. I was wondering if there were a quick way to do this in Pygame. I want to be able to add effects to stuff.

I know that I could use set_at and get_at to do it, but that would be too slow.

sentences:
Handling Multiple Items Interaction (in a 2-Players Game) Back Story

I'm working on a 2-Players 2D game that players play multiple rounds ,until one win.

In each round, each player choose some items (1 or more) for his/her car ( e.g. shield, anti-shield, power-up, speed, ... ) and their chosen items are hidden for opponent. when both player get ready, they just sit and see what happen to their cars which move toward each other (each round).

Problem

As I said, there are multiple items (read "magics") with different effect in my game. Each Item's effect may differ depends on item which it interact with. each item have some positive effect and some cost.

  For instance, If player 1 uses "speed" item, his car may cause more damage to opponent's car ,whereas if opponent had used a "truck-bumper", this "speed" would cause player 1 to get more damage instead!

After writing all the rules and effects of each item on a paper, I need your helps to find a good and structural way to handle them in code (except many nested if-else ).

Finally

I need some kind of structure or coding style for converting these rules to code and determining the net result of items interaction in each round according to items relations.

sentences:
Authoritative Server for single player but with leaderboard I made a Fps single player, timed survival with a leaderboard ( a bit like devil daggers and others).
I know would like to create a server that will prevent cheats such as avoiding collision or altering the timer.

My issue is I don't know the theory on how should my server behave. Should it run an instance of the game per player which will handle the collision and other stuff for that player ? is this viable

Any advice ?

sentences:
Creating a newspaper that effects the game's economy? I am writing a game in Objective C/cocos2d where a newspaper is a central part of what controls or rather effects the game's world economy as well as what a city might do (such as increase X, reduce Y)

The newspaper is a bit like a "Chance card" in Monopoly, it has an effect on something.

My question is, what is the best way to do write a newspaper that has both a random and specific effect within the game.

Would the best strategy be to write out all the things a newspaper can affect, a PLIST of headlines (with placeholders).

I think Tiny Tower uses a PLIST of events and it randomly picks an event, but I'm not sure how it actually parses it because certain events do different things.

But then how do I parse all the scenarios that a newspaper can deliver?  A big switch statement seems very long and complicated to do.

I am wondering if there is a simpler way to handle this kind of thing.

Related to this is that there might be no news that day and I'm not sure what the newspaper should display, should it just display the last headline?

So, in summary.

1) A newspaper generates a headline, it affects different things, such as the world economy, prices, how city reacts

2) I need the newspaper to generate headlines (although there may be days when there are no headlines at all), but I am not sure how to parse it without using a big-ass switch statement.

Thanks in advance.

sentences:
Integrating Bullet3 into a C++ project - Linking to libraries I've been following the BulletQuickstart guide and I get as far as generating the vs2010 solution and converting to newer. I've also been following this very good answer from a few years ago and have included the src folder into my project.

The only thing that remains is to link the libraries after building the bullet solution but I'm not entirely sure which ones are the correct ones to use. I've tried:

Linking against Bullet3Collision.lib, Bullet3Dynamics.lib and LinearMath.lib
Linking against BulletCollision.lib, BulletDynamics.lib and LinearMath.lib
Same as the above options, but with original filenames i.e. BulletCollision_vs2010_debug etc.

In every instance I get the usual errors when not linking properly:

 unresolved external symbol "void * __cdecl btAlignedAllocInternal.......

I have already checked the Additional Library Directories and Additional Dependencies

The small code I have calling some bullet stuff is:

#pragma once

#include "btBulletDynamicsCommon.h"
#include <stdio.h>

class BTPhysics
{
public:
    BTPhysics();
    ~BTPhysics();

    void Init();

private:
    btDefaultCollisionConfiguration* m_pCollisionConfiguration;
    btCollisionDispatcher* m_pDispatcher;
    btBroadphaseInterface* m_pOverlappingPairCache;
    btSequentialImpulseConstraintSolver* m_pSolver;
    btDiscreteDynamicsWorld* m_pDynamicsWorld;
};

Am I supposed to grab the library files from somewhere else other than the bin directory after building the bullet3 solution?

sentences:
How to Divide Responsibilities Between a Two-Man Group? A partner and I are in the midst of creating a (not so) simple game via C++ and SFML (2D). We have both created some simple games (not together) and would like to start work on a more serious, larger project that challenges our abilities to program, interact with large code as well as working together without getting in each other's way.

The problem is the getting in each other's way- well, not yet at least.

We had our first group session today (us two working on the project, one to-be tester and a friend of ours) and wrote down some ideas. It's going to be a birds-eye perspective zelda-like (from SNES) game with a streamlined map and quasi-linear gameplay like Gothic (open world, but you'll likely get yourself killed if you wander around too much).

Needless to say, I'm not sure if we're aiming too high for the moment, but our biggest concern is the division of responsibilities. Our first impulse was to work on aspects of the game that had nothing in relation to the other (I would work on the menu, he would work on the map, for example).

Our next impulse was to work on closely-related things in a list-manner. (First the menu, then a map, then the character, then the monster, etc) so we can, piece-by-piece, see our code coming to life in an orderly fashion.

We haven't picked a VCS yet, but I'm thinking it's going to be Mercurial for the simple reason that I have heard good things of it (neither of us have yet to use a VCS).

Question:  What would be the proper way to divy up the responsibilities between the two of us? How should we start, how should we continue and how do we do it together with maximum efficiency? Any other tips would be greatly appreciated!

sentences:
OpenGL lighting with dynamic geometry I'm currently thinking hard about how to implement lighting in my game. The geometry is quite dynamic (fixed 3D grid with custom geometry in each cell) and needs some light to get more depth and in general look nicer.

A scene in my game always contains sunlight and local light sources like lamps (point lights). One can move underground, so sunlight must be able to illuminate as far as it can get.

Here's a render of a typical situation: The lamp is positioned behind the wall to the top, and in the hollow cube there's a hole in the back, so that light can shine through.

(I don't want soft shadows, this is just for illustration)

While spending the whole day searching through Google, I stumbled on some keywords like deferred rendering, forward rendering, ambient occlusion, screen space ambient occlusion etc. Some articles/tutorials even refer to "normal shading", but to be honest I don't really have an idea to even do simple shading.

OpenGL of course has a fixed lighting pipeline with 8 possible light sources. However they just illuminate all vertices without checking for occluding geometry.

I'd be very thankful if someone could give me some pointers into the right direction. I don't need complete solutions or similar, just good sources with information understandable for someone with nearly no lighting experience (preferably with OpenGL).

sentences:
How can I render "two-sided" clouds like in Minecraft? The clouds in Minecraft are semi-transparent and are rendered on both sides.  If you fly into the cloud you can see inside of the cloud.
If I render clouds the inside faces would be visible on the outside.
How can I prevent that?
Z-Ordering the faces and render near to far with depth test on?
There must be a better, easier way.
Could the accum or stencil buffers be used somehow?

UPDATE : I think the crucial point everyone is forgetting is that these clouds and semi-transparent and "blended" into the scene as each face is rendered.  If two faces are rendered on top of each other the "white" texture will double up which is undesired.  The faces also seem to have slight lighting variations which would rule out using a stencil.

UPDATE2: Just another note.  Each cloud is 12x12x4 blocks (roughly).  Larger clouds are just a group of the base clouds stuck together.

Here's showing clouds from above. They are translucent and the chunks below can be seen.

And here's the view from inside them.

sentences:
touch.phase == TouchPhase.Canceled not worked i m tired to handle and solve issues related to multitouch. i m use maximume 5 touch simultaneously but when two touches are down on two object and i moved my fingures then that both touches fired TouchPhase.Ended event but not fired TouchedPhase.Canceled.

I want to fired TouchPhase.Canceled when i my fingures out of those objects.

if (touch.phase == TouchPhase.Began) { hitObject.GetComponent ().TouchDown (hitObject); }

if (touch.phase == TouchPhase.Ended) { hitObject.GetComponent ().TouchExit (hitObject); }

if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Stationary) { hitObject.GetComponent ().TouchStay (hitObject); }

if (touch.phase == TouchPhase.Canceled) { print ("Touched canceled...."); hitObject.GetComponent ().TouchExit (hitObject); }

sentences:
Unity3D: Facebook login into the game + Verification on Server Side I don't need to know the specific code required for that, but I want to understand at high level how can I implement that and what SDKs I have to use to achieve that.

Facebook PHP SDKs: Ok If I want to perform login with Facebook into my web page.
Unity3D's Facebook SDK: Ok If I want to perform login inside my App without a server (apart Facebook's servers of course).

What I want to achieve is:

User login into facebook from the App (just once, and eventually the option to log out on request of user, or to relog if login data expires)
Login is verified by my Server (actually a user should really have a facebook account)
Do not embed stuff like Facebook App ID in my App source code.

My server will store some data for each user and to identify users I need to be able to use some unique data provided by Facebook like session token etc. Of course the session token may change so I need anyway to be able to identify the user (to avoid losing memorized data).

sentences:
OpenGL Planet Generation - Simple Matrix Issue (Planet “Spins” With Mouse) I originally asked this question on StackOverflow & was directed here by a commenter.

Im currently working on a OpenGL planet rendering. I'm using the Tessellation pipeline. So far things are going very well bar one issue. It's at the stage where I've been banging my head off it for ages and feel like progress isnt happening.

First of all here is a gif of what I'm dealing with. Essentially my problem is that whenever the mouse is moved the planet rotates as if its "looking" at where the camera is pointing.

There are some graphical issues but they are due to me simply repeating the same heightmap across the whole cubemap. Since it doesnt match up on the sides there are clear seams.

Below is my evaluation shader:

void main(void) {
    vec4 p0 = gl_in[0].gl_Position;
    vec4 p1 = gl_in[1].gl_Position;
    vec4 p2 = gl_in[2].gl_Position;
    vec3 p = gl_TessCoord.xyz;

    Normal_FS_in = mat3(transpose(inverse((MV)))) * (p0*p.x + (p1*p.y) + p2*p.z).xyz;

    float displacment = texture(tex1, Normal_FS_in).r * 800;
    gl_Position = MVP*(p0*p.x + (p1*p.y) + p2*p.z) + (vec4(vec3(displacment,displacment,0) * normalize(Normal_FS_in),1));
}

Its pretty simple. The shader calculates a normal for the output vertex. This is then used to grab a displacement value from the heightmap which is a cube map. Then GL_Position is calculated. What I've been trying to work out is if my problem lies in the shaders or in the rest of the package.

My attempts have largely been tinkering. I've moved all normal related stuff into the evaluation shader rather then calculating it in the vertex shader and passing them through to the control and evaluation shaders.

The issue only occurs when the mouse is moved.

Any suggestions would be fantastic - hopefully all I'll need is a pointed in the right direction.

Edit - Doing the inverse transpose of the modelview matrix OR view matrix yields the result in the gif. Using the model matrix leads to distortion of the normals when the camera is moved, such that the terrain bends about the place.

sentences:
How to convert depth values into Unity's distance I am new in Unity and now only studying for my work project. I need help with computing real distances from depth values. Can't figure it out.
My shader is:
Shader "Custom/MyDepthShader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}

    }
    SubShader
    {
        // No culling or depth
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert // compile function vert as vertex shader
            #pragma fragment frag // compile function frag as fragment shader

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;
            sampler2D _CameraDepthTexture;

            fixed4 frag (v2f i) : SV_Target
            {
                float depth = tex2D(_CameraDepthTexture, i.uv).r;
                depth = Linear01Depth(depth);
                depth = depth * _ProjectionParams.z;
                return depth;
            }
            ENDCG
        }
    }
}

I Blit then these values from renderTexture to texture2D and use function GetPixel(i,j). Knowing, that a cube is at 1.5 units distance from camera I can't get this value from depth texture. Thank you for your help.
Now I suspect that I have got distance values, but they are biased by 0.5 for some reason... Can anyone explain this as well?
I found how to get distances from depth texture, so basically I can answer this question, but there is still unexplained bias in measurements.

sentences:
How do i writing timing function for lightning flash in C++? I need to write a horror scene with lightning flash. Unfortunately I am new to both C++ and OpenGL and I am looking for efficient way to mimic lightning timing in C++/OpenGL?

I don't need graphical implementation, just algorithmic implementation.

as such, the function should return a float representing lighting intensity and the delay of lightning flash should be random (5 seconds followed by 10 seconds then 3 seconds.. etc)

I hope I made everything clear!

sentences:
How do some games save without creating data files? I downloaded a game called Brain Exercise with Dr.Kawashima. It contains only one executable and no data files. However, it's still possible to save the game!

Where does the save data go?

sentences:
Get BP FollowCamera Rotation and Location I'm accessing my FollowCamera https://imgur.com/a/vbFagxg from my BluePrintCharacter class in my C++ code, with this following line :

FollowCamera = GetOwner()->FindComponentByClass<UCameraComponent>();
FVector WorldLocationV = FollowCamera->GetWorldLocation();

But when I run my game, I get this error : GetWorldLocation is not a member of UCameraComponent

Why is this, and how can I get GetWorldLocation from FollowCamera in C++?

In BluePrint this seems to work fine : http://i.imgur.com/8m9TWUW.png

sentences:
First Person Shooter vertical mouse aim I've just started writing a 3D First Person Shooter in Java, and I'm having a bit of trouble with tracking the mouse movements and moving the camera accordingly. I'm implementing typical FPS movement, in that the mouse stays at the center of the screen.

Moving the mouse left and right (horizontal movement) is fine - each time the mouse is moved, I get it's position on the screen. I then use atan2 to get the angle I need to rotate around the y axis to get to this position, and apply the rotation accordingly.

My problem is when I try to change the pitch of the view (i.e. rotating around the x axis - essentially looking up and down). I can get the y coordinate of the mouse, and the y coordinate of the center of the screen, but how do I calculate how much I need to rotate around the x axis to get to that point?

Thanks in advance!

sentences:
Rotate Object in world space - Raytracing I’m programming a C raytracing project.
I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it.
For each object I have its position (x, y, z) in the world space and its 3d normalized orientation vector.
For the moment I do nothing more than applying once of the three following functions on the 3d normalized orientation vector. I don’t know if I’m doing it right. Rotation doesn't work well.
For example I want to rotate my object left with the j key and right with the l key (x_rotation), up with the i key and down with the k key (y_rotation). I'm not sure how to use the z axis.
I'm starting to despair, can you please help me ?
I will be very grateful for your help :)
t_vec x_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x;
    res.y = vec.y * cos(alpha) - vec.z * sin(alpha);
    res.z = vec.y * sin(alpha) + vec.z * cos(alpha);
    return (res);
}

t_vec y_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.z * sin(alpha) + vec.x * cos(alpha);
    res.y = vec.y;
    res.z = vec.z * cos(alpha) - vec.x * sin(alpha);
    return (res);
}

t_vec z_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x * cos(alpha) - vec.y * sin(alpha);
    res.y = vec.x * sin(alpha) + vec.y * cos(alpha);
    res.z = vec.z;
    return (res);
}

sentences:
Unexpected scaling of UI elements after build [Unity Web] I have an unusual scaling of UI Elements after my build in unity for WebGL

Game in Unity Engine:

Game in Itch.io:

Has anyone seen this kind of behaviour? any suggestions on what I should look into?
Happy to provide more info on the matter.

Thanks!

sentences:
Reusing a render target to create multiple Texture2D's (XNA) i want to be able to loop through a hole bunch of textures, and render them on an object. I then want the rendered image to be placed onto a texture2D.

The point? well hopefully i will end up with an array of Texture2D's containing a model with multiple skins.

Here's my code:

        for (byte i = 1; i < allBlockIso.Count(); i++)
        {
            DisplayBox.SetValue(i);
            GraphicsDevice.SetRenderTarget(cubeTarget);
            GraphicsDevice.Clear(Color.Transparent);
            DrawIsoCube();
            GraphicsDevice.SetRenderTarget(null);
            allBlockIso[i] = (Texture2D)cubeTarget;
        }

DisplayBox.SetValue is a function which goes through and sets the texture. This is working! DrawIsoCube() draws the cube (the test model) and this is working too.
The problem is definitely something to do with the unreusability of the render target.

Pretty simple yet it's not working. It appears that whatever the last image being rendered is, is shown in every image of the allBlockIso array.

Anyone know a fix?
Cheers.

P.S. sorry if this wan't explained well. I'm not very good at explaining :P

sentences:
How to restrict movement of Leap Motion hand object I have a "Hand" GameObject controlled by a Leap Motion Controller. The Hand despite having RigidBody and Box Collider just seemingly moves with no regards to physics (transform translate movement I suppose). So it clips through other Rigidbody objects.
I'm trying to pseudo-introduce physics to it. I created a second GameObject "HandClone" (with Rigidbody and Box Collider) that copies the first Hand position but moves with actual physics. HandClone script:
   private void FixedUpdate()
    {
        rb.MovePosition(targetTransform.position);
        rb.MoveRotation(targetTransform.rotation);
    }

Now HandClone goes where Hand goes, and HandClone is successfully bumping into other objects.
However, when HandClone gets stopped by something, Hand still keeps moving past HandClone and clips into the other objects, like before.
Now I am thinking that the way to solve this is to constrict Hand's movements to the bounds of HandClone so that finally Hand will stop clipping through objects. But how can this be achieved, would that even work, and is there a better way? Will movement streamed from Leap Motion Controller even respond to scripts like that?
__
Edit: I've now decided to hide Hand and place HandClone where Hand was.
But my script for HandClone to copy Hand's movements is making HandClone fly all over the place. Here's the script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class clone1 : MonoBehaviour
{
    private Rigidbody rb;
    public GameObject target;
    void Start()
    {
        rb = this.GetComponent<Rigidbody>();
    }

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

    }
    private void FixedUpdate()
    {
        Vector3 newRotation = new Vector3(target.transform.eulerAngles.x + 8.5f, target.transform.eulerAngles.y - 172.78f, target.transform.eulerAngles.z - 94.02f);
        rb.MoveRotation(Quaternion.Euler(newRotation));
    }
}

The reason why I am adding those float numbers is because when the game isn't playing, those numbers are what make HandClone sit in the correct position, so I thought it would help with alignment in playmode. But HandClone is just flying everywhere regardless. Any advice with making the HandClone stay attached to the avatar's wrist would help.

sentences:
How to program 3D translate widget like in blender? Im struggling to achieve the translation widget in my own render engine. Funny enough I thought that widgets are easy, but boy was I wrong...

What I want to implement:

Where I am having problems:

When my object's transform is nested (child) and I want to implement a local translation widget the mouseinput coordinates might become inverted, depending on the current orientation of the object. Example: rotate parent 180° (facing back to camera) and dragging the x axis in left mouse direction results in right motion. Expected: dragging the x axis in right mouse direction results in right motion no matter how the object is rotated.

The motion becomes slow when I approach near perpendicular angles with the selected axis.

My implementation is based on: https://www.codeproject.com/Articles/35139/Interactive-Techniques-in-Three-dimensional-Scenes

I somehow think that I should use something else instead of the virtual planes at initial hitpoint of the raycast.

What's the best approach to implement a translation widget with local coordinates and mouse inputs for drag? I am using pure sharpdx for rendering and bulletsharp for the mouse picking / raytesting.

sentences:
3D Huge mesh rendering I am writing a program, that as input, I have a huge (10^6 elements) 3d mesh (with hexagonal shaped elements), and I want to realtime render it, but not as real-time as a game. It just can show the scene and rotate, zoom and pan. The most important point is, I don't need any special lighting nor any shadows. Also, the objects to render are static, and they do not move. My object hasn't any textures.

I've read about ray tracing methods, but I don't know if there is any good libraries for this purpose, or I have to implement everything by myself.

Thanks a lot.

sentences:
Terrain Navmesh build, rebuild smaller pieces of the bigger navmesh terrain. UNITY when the area is very big and AI characters are required to walk a larger distance, it would be beneficial to have the large navmesh ready for finding a path.

when we change the height of the terrain in runtime small areas of the terrain should be updated.
so the buildnavmesh method is  kind of an overkill.
and the localnavmesh builder as a large type would be inefficient.
how do we dynamically change a small part of a larger navmesh?
advice or help would be highly appreciated.

sentences:
What caused rotation in exported blender model to jMonkey? (OGRE) First off, I am very new to jMonkeyEngine 3 and still learning. Not exactly sure what could be causing my snowman to have already been rotated before import. I created him in blender and it was facing forward. The up axis was Z and the forward axis was Y.

For some reason when it is imported into jMonkey I got it pre-rotated which is not what I wanted nor what I coded. I just imported like this tutorial says to do in the book.

Exported as ORGE > Converted to .j3o > Imported with code.

snowMan = assetManager.loadModel("Models/Snowman/snowman.j3o");
Material matVC = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
matVC.setBoolean("VertexColor", true);
snowMan.setMaterial(matVC);
rootNode.attachChild(snowMan);

What should I look at doing to try and remedy this? Not even sure where to start. Could it be messed up in blender? The way I exported? jMonkey?

Update #1: I think it has to do with either the exporter or something I did in blender... not sure what though. Pretty sure it is not the fault of jMonkey.

Now it looks like this.

sentences:
Is using Game in libGDX for more than just switching screens a bad practice? I'm the process of refactoring the prototype of my game to use multiple screens using the Game - Screens model.
I found some information (I think in more than one place) that the Game class should be used only to switch screens.
I've checked some libGDX demos and they indeed follow that pattern.

Initially I wanted to do it the same way, but then I found more and more problems with this approach. AssetManager is the best example I think. Since there is only one instance of it and I would like to use it in more than on screen why not use the Game object to store it? Same thing with Viewport for example or Camera, if I'm happy with just one. What about single instances of my own classes, that I need throughout the whole game, why not to use Game for that?

I know that there are different ways to achieve what I wrote above. I can use static methods like here or create my own class to store all the needed objects and pass its instance between screens, but since I'm already passing instance of Game, what's the point?

To summarize: is using Game to anything else than to switch screens a bad practice? If so, why?

sentences:
Memory dataflow for uniform variables? When a texture (2D) is supplied to a shader as a 'uniform' input, it is first uploaded to OpenGL using glTexImage2D() and then using glUniform1i() it is associated to shader uniform.

eg code :

Texture data

glTexImage2D(): is used to transfer texture data to the server side

glGetUniformLocation(): is used to access shader uniform handle

glUniform1i(): associates the data pointed by texture unit to the shader 'uniform'

but when we pass matrix (eg matrix4x4) to a shader as a 'uniform' input, when don't use any specific function to upload it to OpenGL.

(we just used to glUniform..() to associate the data with the shader input which we also used in the case of texture data)

Matrix data

glGetUniformLocation(): to access shader uniform handle

glUniformMatrix4fv(): to associate matrix data to the shader uniform input.

Where does the matrix data live in each step in the process of passing it to a shader as a uniform input?

Does matrix data always live on client side/ CPU accessible memory and fetched every frame by server side?
If it is uploaded to OpenGL:

which step/function call uploads the data?
where does the data live in OpenGL memory?
how its memory location is pointed?

sentences:
With a Texture Atlas that has 128x128 tiles, how can I use that in Unity3D? So I've got a working texture atlas that has tiles fitting 128x128. However, I can't quite figure out how to use them. I know it's probably got something to do with

    TileRenderer.material.SetTextureScale("_MainTex", new Vector2(0.25f, 0.25f));
    TileRenderer.material.SetTextureOffset("_MainTex", new Vector2(0 * 0.25f,0));

but I'm not sure where to take it from there. Can anyone offer some advice? The size of the image is 1024x128 if that helps, which I think it might.

sentences:
Creating a top-down spaceship I'm creating a top-down 2D space game in LIBGDX for android.

When spaceship is going forward it will look like this:

when it goes upward I want to change it's direction with a nice animation so it seems like a real spaceship. A between frame would be like this:

I have rendered the spaceship in different Z axis degrees from ship0 to ship90. Calculating rotation on XY plane wouldn't be so hard, but I don't know how to calculate the rotation on Z axis so I can choose the right sprite to use.

sentences:
Day and Night mode according to user's real local time How do I make it so the texture of my plane is a black sky when it's night according to player's local time (say from 10 PM to 5 AM it's going to be black, and from 6 AM to 9 AM it's going to be a blue sky)?

Blue sky texture name is "bluesky"
Black sky texture name is "blacksky"

Thanks.

sentences:
How do you compute the tangent space vectors with normals given in the mesh? Suppose you are given a mesh with normals for each vertex. These normals might not correspond to the face normals, as the artist could have tweaked them. In this case, how would you go about computing the tangent and binormal vectors for the vertex?

The best algorithm I can think of, and the one that looks to be used by assimp, is to take all the faces in a given smoothing group and compute the tangent and binormal per face. Once that is done, project them into the plane determined by the normal and average over all the faces in the smoothing group.

I am uncertain as to whether this algorithm works exactly as needed. For example, does the projection operator preserve the angle between the tangent and binormal?

Another issue I have is that the assimp implementation of the algorithm does not seem to use the smoothing groups specified in the mesh. They instead seem to calculate the smoothing groups manually using nearby vertices. What is the advantage of doing this?

Finally, is this the ideal algorithm? Some other things I have found (such as this) seem to suggest that it is not, but they do not go into any more details.

EDIT:

So I checked out the MikkTSpace algorithm that was suggested in the comments, and while it answers my question of what the industry standard method for generating tangent spaces is, I do not fully understand why the algorithm works.

As described in the paper, the algorithm works by collecting triangles into groups and then averaging the tangent spaces for each individual triangle in the group. I ran into two problems understanding this: first and once again, why discard the smoothing groups specified in the mesh? It seems wasteful to discard information that is already given to you about how the mesh is supposed to appear.

Secondly, how do the groups even work? The paper specifies that two triangles are considered to be in a group if the share two vertices, two texture coordinates, and two normals. The first two requirements make sense to me, but the third does not. Suppose you are approximating a sphere by something like an icosahedron. In this case there will be no vertex normals shared by any two vertices, so each individual triangle is going to have its own tangent space. This seems counterintuitive.

sentences:
Determine terrain color based on slope and height with many types of terrain I've got a specific problem. Take this as a challenge, if you will.
I have a 3D mesh representing a cliffy terrain. It's constructed from a simple height map.
The goal is to determine what type of terrain (in practice, what color) to use for any point on the map, given a height and a slope and a constant configuration. Both height and slope are between 0 and 1.
The configuration looks something like this:
const vec3 WATER_COLOR = vec3(0.0, 0.0, 1.0);
const vec3 SAND_COLOR = vec3(0.76, 0.7, 0.3);
const vec3 GRASS_COLOR = vec3(0.208, 0.624, 0.004);
const vec3 CLIFF_COLOR = vec3(0.435, 0.384, 0.380);
const vec3 SNOW_COLOR = vec3(0.894, 0.953, 1.0);

const float WATER_MAX_HEIGHT = 0.1;
const float SAND_MAX_HEIGHT = 0.15;
const float GRASS_MAX_HEIGHT = 0.5;
const float SNOW_MIN_HEIGHT = 0.9;

const float SAND_MAX_SLOPE = 0.25;
const float GRASS_MAX_SLOPE = 0.50;
const float SNOW_MAX_SLOPE = 0.75;

const float BLEND_FACTOR = 0.1; // Or whatever

I then need a function that takes a height and a slope to produce a color:
vec3 terrain_color(float slope, float height) {
    // Somehow determine the terrain color
}

I've tried to visualize the kind of function I want like this:

Where the x-axis is slope and the y-axis is height. So close to water, the terrain should be sand, but only if the slope is below SAND_MAX_SLOPE and very high up it should be snow, as long as the slope is below SNOW_MAX_SLOPE. The terrain defaults to the cliff color if nothing else fits.
It's easy to just compare the height and slope with the configuration values, but I would like to blend the colors smoothly together, except for the water, resulting in something similar to this:

A higher BLEND_FACTOR should result in more blurring/blending.
Closest thing I've got so far is the following (inspired by Sebastian Lague's similar shader):
const float HEIGHT_FADE_POWER = 16.0;
vec3 terrain_color(float slope, float height) {
    if (height <= WATER_MAX_HEIGHT) {
        return WATER_COLOR;
    }

    float sand_grow_height_fraction = smoothstep(0.0, SAND_MAX_HEIGHT, height);
    float sand_blend_height = SAND_MAX_SLOPE * (1.0 - BLEND_FACTOR);
    float sand_weight = 1.0 - saturate((slope - sand_blend_height) / (SAND_MAX_SLOPE - sand_blend_height));
    sand_weight *= 1.0 - pow(sand_grow_height_fraction, HEIGHT_FADE_POWER);

    float grass_grow_height_fraction = smoothstep(SAND_MAX_HEIGHT, GRASS_MAX_HEIGHT, height);
    float grass_blend_height = GRASS_MAX_SLOPE * (1.0 - BLEND_FACTOR);
    float grass_weight = 1.0 - saturate((slope - grass_blend_height) / (GRASS_MAX_SLOPE - grass_blend_height));
    grass_weight *= 1.0 - pow(grass_grow_height_fraction, HEIGHT_FADE_POWER) - sand_weight;

    float cliff_weight = 1.0 - grass_weight - sand_weight;

    return sand_weight * SAND_COLOR + grass_weight * GRASS_COLOR + cliff_weight * CLIFF_COLOR;
}

Which produces the following when I map it on a plane:

Which is not quite what I want and it's also missing snow.
I have considered simply using the above image as a texture but I would like a computational way to achieve the same thing. I can't really figure out how to do this while getting the blending right. Besides I may want to replace the colors with a texture eventually.
Bonus points for having a different blend factor for each terrain type.

sentences:
Gamepad API For Multiple Pad Types I'm a C++ newbie working on adding gamepad support to Moai as a learning exercise and because I'd like to be able to use a gamepad with it. I'm starting by implementing the Xbox 360 gamepad via XInput and that's going pretty well. Eventually I'd also like to support the PS3 gamepad.

This has got me thinking: the 360 and PS3 pads are mostly similar. They have the same number of buttons in more or less the same places that do more or less the same things (e.g., the right trigger on the 360 pad is an analog trigger, so is the R2 trigger on the PS3 pad). From the standpoint of creating an API to support both pads the main difference is the labeling applied to each button.

The PS3 square button is in the same place as the 360 X button, triangle matches Y, circle matches B, and X matches A. Some comparison images:

When creating the API to work with gamepads I see a couple ways to approach it:

Use the 360 naming conventions exclusively.
Use the PS3 naming conventions exclusively.
Come up with something in between.

I'd like to go with option #3 and could devise my own solution easy enough but don't want to reinvent the wheel unnecessarily.

Is there some standard naming convention used for a gamepad API that supports both 360 and PS3 (and possibly other, similar) gamepads? Is this even really an issue -- should I just create an API, document it and call it good?

sentences:
Dealing with binary data and endianness When distributing my game, I am going to compile all the resources and level data into a single binary package file, which is loaded from by the game.  Do I have to worry about my machine being a different endian-ness than the end-user's, or are discrepancies here obsolete?

If this is going to be a problem, what is the best way to circumvent or solve it?

sentences:
Parallelizing creation of geometry chunks in minecraft-like game In my game I separate creation of chunks into two stages. The first is where I generate the heightmap using simplex noise and the 2nd is when I create the actual vertex buffers. I do it like this so that when creating the geometry I can always look at neighboring chunks so I can do decide things like visibility of faces.

Right now I'm working on loading chunks in the background. My first attempt was to create a simple job queue and just push all of the jobs for stage 1 first followed by all the jobs for stage 2. The problem then becomes a thread trying to start a job for the 2nd stage before all the necessary 1st stage jobs are done.

I suppose I could just have another worker thread that waits for all the 1st stage jobs to finish but that seems less than ideal. It also means I can't do anything clever like starting a stage 2 chunk job after that chunk and all surrounding chunks have gone through stage 1 instead of just waiting for all pending chunks to have gone through stage 1.

What is the correct system to use when dealing with dependencies of this kind?

sentences:
Is using camera and viewport in Libgdx always necessary? I understand that camera and viewport are important to keep virtual measurement units and handle different aspect ratios and resolutions when building games with worlds bigger than the screen (e.g. side-scrollers / map based games).

I am not sure whether it is the proper way to go for a simple game that fits on the screen entirely - like a puzzle or card game for example.

Is it still better to use camera and viewport in this case, or is it more simple, effective (and hence better) to use directly screen absolute coordinates for these types of games?

Or to put it in other way - what are the advantages to use camera and viewport for games that fit on the screen entirely?

sentences:
How is this particular HLSL condition treated with respect to compile- or run-time evaluation? Let's say I have this very simple pixel shader (cbuffers and other stuff omitted)

float4 PS(VertexOut pin, uniform bool useLighting) : SV_Target {
    float4 retColor = gDiffuseMap.Sample( sampler0, pin.Tex );
if (useLighting) {
    retColor = retColor * float4(gAmbientLight, 1.0f);
}
    return retColor;
}

and two techniques such as

technique11 TexTech {
    pass P0 {
        SetVertexShader( CompileShader( vs_4_0, VS()));
        SetGeometryShader(NULL);
        SetPixelShader(CompileShader( ps_4_0, PS(false)));
    }
}

technique11 TexLitTech {
    pass P0 {
        SetVertexShader( CompileShader(vs_4_0, VS()));
        SetGeometryShader(NULL);
        SetPixelShader(CompileShader(ps_4_0, PS(true)));
    }
}

The way I understand it, the useLighting condition is evaluated during compile-time and each technique will have its own version of the pixel shader function without any branching. That means the useLighting condition wouldn't have any runtime penalties. Is that correct? So it's kind of like C preprocessing?

Why can the pin variable just be left out like that in the CompileShader call? It makes sense, of course, I'm just wondering if this is some special HLSL or Effect Framework syntax?

sentences:
Orthographic Zooming with 0,0 at top/left I'm trying to implement zooming on my 2D game. Since it's using orthographic projection, I thought it would be easy to implement zooming. After looking around the internet, I found a bunch of explanations and samples on how to do this if (0,0) is the center of the screen with the orthographic projection. The problem is, my ortho projection has (0,0) at the top-left (similar to XNA/Monogame, and a couple others). I could not find any examples about how to implement zooming to the center of the screen when the center is not (0,0).

And help/links/code examples would be greatly appreciated.

sentences:
OpenGL 3.0+ framebuffer to texture/images I need a way to capture what is rendered on screen, i have read about glReadPixels but it looks really slow.

Can you suggest a more efficient or just an alternative way for just copying what is rendered by OpenGL 3.0+ to the local RAM and in general to output this in a image or in a data stream?

How i can achieve the same goal with OpenGL ES 2.0 ?

EDIT:

i just forgot: with this OpenGL functions how i can be sure that

I'm actually reading a complete frame, meaning that there is no overlapping between 2 frames or any nasty side effect
I'm actually reading the frame that comes right next to the previous one so i do not lose frames

sentences:
Clearing just the object, not the whole canvas, leaving an uwanted trail I'm working on a platform game via poo.

I heard is more efficient to clear just the object you're drawing instead of clearing the whole canvas. So I'm working on this, and all goes well when the player's velocity player.Xvel has an integer value.

But when I use a floating point value for the velocity, then my object leaves a banded trail behind it, like a barcode of stripes and gaps.

Can you help me identify what's causing this artifact?

var canvas = {};
canvas.obj = document.getElementById('canvas');
canvas.ctx = canvas.obj.getContext('2d');
canvas.width = canvas.obj.width;
canvas.height = canvas.obj.height;

var Object = function() {
  this.draw = function() {
    switch (this.fill) {
      case true:
        canvas.ctx.fillStyle = this.color;
        canvas.ctx.fillRect(this.x, this.y, this.width, this.height);
        break;
      case false:
        canvas.ctx.strokeStyle = this.color;
        canvas.ctx.strokeRect(this.x, this.y, this.width, this.height);
        break;
      default:
        console.log('draw err');
    }
  };
  this.clear = function() {

    var prevCoords = {};
    prevCoords.x = this.x - this.xVel;
    prevCoords.y = this.y - this.yVel;
    // lineWidth:fix
    canvas.ctx.clearRect(prevCoords.x, prevCoords.y, this.width, this.height);
  };
};

var player = new Object();
var game = {};

player.width = 10;
player.height = 50;
player.x = 200;
player.y = 150;
player.xVel = 0.9; // try to change this to integer/float value then run
player.yVel = 0;
player.color = 'white';
player.fill = true;
player.movement = function() {
  this.x += this.xVel;
  this.y += this.yVel;
};

game.key = [];
game.fps = 15;
game.obj = setInterval(function() {
  player.clear();
  player.draw();
  player.movement();

}, 1000 / game.fps);
body {
  background: rgb(110, 110, 110);
  color: rgb(230, 230, 230);
}

canvas {
  background: rgb(60, 60, 60);
}
<canvas id="canvas" width="460" height="360"></canvas>
<form action="">
  <label>Game:</label>
  <input type="button" value="run" onclick="" />
  <input type="button" value="stop" onclick="clearInterval(game.obj);console.log('end');" />
</form>

sentences:
Find References In Scene of scriptable object unity asset shows incorrect results I'm trying to work out why my game is loading a large sprite atlas that I don't think it should be. The snapshot view of the profiler shows that the atlas is loaded. The references pane shows that it's loaded through a scriptable asset object. That object does indeed reference the sprites in the atlas - but I don't think the object is referenced in the scene at the moment. The game boots to this scene, so the atlas should not be loaded.

I've replicated this profiling on both the editor and on android, so it's not an editor-only thing.

When I right-click on the scriptable object in the project view, while the game is running, and Find References In Scene, it shows a few game objects. None of these objects seem to reference the scriptable object. None even have monobehaviours with fields for this type of scriptable object. Some are new-UI button objects, that have Canvas Renderer, Image and Button scripts only. None of which could be referencing this scriptable object.

Has anyone seen this behaviour before? What's going on?

sentences:
Networking and movement in MMORPG's UNITY I'm programming a dedicated server in C# using BeamServer2 DLL's.
At first I wanted to be able to see other players move on our already made Omuni map.
This I did by just sending your position to the server each frame.
This worked out and I was able to play with a few friends but the movement wasn't laggfree.
So I started trying to add movement smoothing and also some security so they can't just send a false position to the server without the server stopping it from reaching the other clients.

What I than did, I made a masterClient that has a movementController on the remotePlayer.
When a client wants to move he moves localy and sends a message to the server with hes direction to move. The server than takes hes speed and sends it to the masterClient.
The masterClient than moves the remotePlayer just like the remotePlayer moves himself.
When he stopes moving he sends a message with hes position in it. The masterclient than checkes if the position that he has come to is as close as the position he has from the client, if it is realistic according to the ping of the client the server puts him on the client's position.

This works, but I still have a lagg problem and I'm not sure how to fix this.
I must make movement smoothing on the client but I found out myself that I can just lerp (x/2,y/2,z/2) to the position and put him on the real position next frame, I failed at that and I will try again soon. Even if that is added I'm not sure if the lagg is fixed.

Any other techniques, suggestions, questions, ... ?
Thanks, Diede.

sentences:
How can I mock Google Play purchases? I would like to know what best practices should I do for testing the functionality when a user buy an item/power-ups via Google Play and purchased with real money?

For example, basically, creating a simple test of purchasing and saving an item stored in the inventory during the game using a game money. (e.g. Gil from Final Fantasy series or Zenny from Tron Bonne for the PlayStation 1) I know how to make money purchase update only via game money when I'm programming in Unity3D or Eclipse w/ LibGDX library.

Now, let say I have to create a program that checks the user if actually purchase a power-up items using real money. Next, the system needs to check for online status. If connected, it will simply go to the Google Play dialog and asks the user if he/she wanted to proceed purchasing of items. If yes and the credit card balance is sufficient, then goes back to the game app and check if the boolean returns true, then item that the user is bought will be saved.

Another example is that the amount of real money will be calculated via programming and if insufficient, the user asks to add more real money value by purchasing it via Google Play. If return true, then, the real money value will be reloaded.

This concept is basically needed for game developers. However, is there a safe way to test the real money purchase test stuff without using a credit card value or something before the actual publishing of the game app in Google Play along with this feature? Is there a tutorial, start-up guide, recommendation or something for this? Please, I would like to know how will I start. Thank you.

sentences:
What Java library/framework for a game with Baldur's Gate like grapics? I really would like to create my own small rpg. It could probably look as simple like baldurs gate. So without fancy 3D stuff.

As language I want to use java (or scala, I thinking about it - the good thing is that all java libs would work with scala too, and there are a lot of java game libs) and I'm not sure what lib/framework should I choose. I thought about LWJGL or Slick2D. Because I wont use that much 3D, Slick2D would be the better choice? Or doesn't matter? Any ideas or suggestions? Thank you

sentences:
Networking for Real Time Strategy games I'm developing a real time strategy game for a computer science course I'm taking. One of the harder aspects of it seems to be client-server networking and synchronization. I've read up on this topic (including 1500 archers), but I've decided to take a client-server approach as opposed to other models (over LAN, for instance).

This real time strategy game comes with some problems. Thankfully, every action the player takes is deterministic. However, there are events that happen on scheduled intervals. For instance, the game is made up of tiles, and when a player takes a tile, the 'energy level', a value on that tile, should grow by one every second after it's taken. This is a very quick explanation that should justify my use case.

Right now I'm doing thin clients, which just send packets to the server and wait for a response. However, there are several problems.

When games between players develop into endgame, there are often over 50 events per second (due to the scheduled events, explained earlier, piling up), and synchronization errors start to show up then. My biggest problem is that even a small deviation in state between clients could mean different decisions the clients take, which snowball into entirely separate games. Another problem (which isn't as important right now) is that there is latency and one has to wait a few milliseconds, even seconds after they make their move to see the result.

I'm wondering what strategies and algorithms I could use to make this easier, faster, and more enjoyable for the end-user. This is especially interesting given the high amount of events per second, along with several players per game.

TL;DR making an RTS with >50 events per second, how do I synchronize clients?

sentences:
How to remap world space to screen space? I am noob to game development, and while using a simple graphics library in Python to make a 2D game, I noticed that the coordinate system of the library had its upper left corner as (0,0), whereas conventionally (at least in math) the lower left corner is set as (0,0).

I want to keep the world space in my physics calculations, but want to map the world space coordinates into the screen space. Furthermore, I want the world space sizes to be a scale of 10 larger than the screen space sizes.

In terms of programming methodology, how should I go about doing this in the most modular fashion?

sentences:
What causes player box/world geometry glitches in old games? I'm looking to understand and find the terminology for what causes - or allows - players to interfere with geometry in old games.  Famously, ID's Quake3 gave birth to a whole community of people breaking the physics by jumping, sliding, getting stuck and launching themselves off points in geometry.

Some months ago (though I'd be darned if I can find it again!) I saw a conference held by Bungie's Vic DeLeon and a colleague in which Vic briefly discussed the issues he ran into while attempting to wrap 'collision' objects (please correct my terminology) around environment objects so that players could appear as though they were walking on organic surfaces, while not clipping through them or appear to be walking on air at certain points, due to complexities in the modeling.

My aim is to compose a case study essay for University in which I can tackle this issue in games, drawing on early exploits and how techniques have changed to address such exploits and to aid in the gameplay itself.  I have 3 current day example of where exploits still exist, however specifically targeting ID Software clearly shows they've massively improved their techniques between Q3 and Q4.

So in summary, with your help please, I'd like to gain a slightly better understanding of this issue as a whole (its terminology mainly) so I can use terms and ask the right questions within the right contexts.  In practical application, I know what it is, I know how to do it, but I don't have the benefit of level design knowledge yet and its technical widgety knick-knack terms =)

sentences:
How do I efficiently choose the terrain chunks to render based on the player position? Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered.

The problem is that if I add all the terrains of the array to the list (let's call it toRenderList), my computer explodes because of the number of terrains.

What I've tried to achieve it's to add to the list ONLY the terrains that are into a certain range. This is what I've done:

private static Terrain[][] terrains;
private List<Terrain> toRenderList;
private static final int NUMBER_CHUNKS = 3; //Number of terrains that are added to the list.

public void update(Player player){
    if(player.hasChangedTerrainPosition()){
        toRenderList.clear();
        for(int x = player.getTerrainPosition()[0]-NUMBER_CHUNKS;
            x == player.getTerrainPosition()[0]+NUMBER_CHUNKS; x++){
            for(int y = player.getTerrainPosition()[1]-NUMBER_CHUNKS;
                y == player.getTerrainPosition()[1]+NUMBER_CHUNKS; y++){
                terrainList.add(terrains[x][y]);
                System.out.println("Terrain "+x+","+y+" added!");
            }
        }
    }
}

Just to clarify, the method player.getTerrainPosition returns a int[] with the current terrain coords in where the player is standing. The method player.hasChangedTerrainPosition returns true if the player has changed of  terrain.

The problem of this method is that for example if the player is in the position [0,0] it pops an error of ArrayIndexOutOfBounds because of a negative number.

I don't know if I've been specific. This is more basic Java than GamePrograming, but any help will be appreciated. Thanks!

sentences:
Physics for movement in a topdown 2d game? I'm implementing player movement for a simple topdown game, how would I handle more "advanced" concepts in physics to make my player movement feel more natural?
Right now I have something like this:

void update(double delta) {
    dx = dy = 0;

    if (left) {
        dx -= 1;
    }
    if (right) {
        dx += 1;
    }
    if (up) {
        dy -= 1;
    }
    if (down) {
        dy += 1;
    }

    if (dx != 0 || dy != 0) {
        x += dx * delta;
        y += dy * delta;
    }
}

How would I go about implementing things like friction, acceleration, drag, and so on?

sentences:
Any technical references for game-oriented icons and symbols? To make localizing easier, I'm using icons to show in-game information like achievements and bonuses. Coming up with good designs isn't easy, especially when it has to be integrated into the rest of the game's art style.

Can I do better than looking at some random selection of existing games?

Are there any reference books or sites that cover game graphics specifically?

I'm looking for more theory and best-practices rather than pre-made graphics.

sentences:
Unity low level network API I was trying out Unity Network LLAPI, I am following the this tutorial. I wrote everything the same, my server starts well and good with no errors.

When my client tries to add host

int hostId = NetworkTransport.AddHost(topology, port);

like this, it crashes with this error

Cannot open socket on ip {*} and port {12000}; check please your network, most probably port has been already occupied
UnityEngine.Networking.NetworkTransport:AddHost(HostTopology, Int32, String)
Client:Connect() (at path/to/game/files/Client.cs:35)
UnityEngine.EventSystems.EventSystem:Update()

Now if I change port on client side it says Wrong IP or Port.

I tried looking but didn't find much. Don't know what is wrong. Also I'm on Linux

sentences:
Image rendering with additional space around it When I try to display an image that is 400 pixels wide and 800 pixels high, it is not displayed this way. Instead it is diplayed like this: Instead it is displayed like this

You can see at the bottom and a few pixels right to the phone some thin white lines, I did not add this manually and it is not part of the picture, the picture is perfectly cropped around the phone.

When in my fragment shader I add + vec4(1, 1, 1, .5) it shows the area that the phone should have covered. Image

Code for creation of an object that holds info about the image:

GuiTexture phone = new GuiTexture(loader.loadTexture("phone_cropped"), Display.getWidth() / 2, Display.getHeight() / 2, 2, 400, 800);

The loadTexture method:

public int loadTexture(String fileName) {
    Texture texture = null;
    try {
        texture = TextureLoader.getTexture("PNG", new FileInputStream("res/" + fileName + ".png"));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    int textureID = texture.getTextureID();
    textures.add(textureID);
    return textureID;
}

The line that calls the render class to render the image

guiRenderer.render(guis);

The transformation matrices that the image is multiplied by:

float width = gui.getWidth() / 2;
        float height = gui.getHeight() / 2;

        Matrix4f modelMatrix = new Matrix4f();
        modelMatrix.m00 = 2.0f / (float) Display.getWidth();
        modelMatrix.m11 = 2.0f / (float) Display.getHeight();
        modelMatrix.m30 = -1;
        modelMatrix.m31 = 1;

        shader.loadModel(modelMatrix);

        Matrix4f transformationMatrix = Maths.createTransformationMatrix(
                new Vector2f(
                           gui.getxPos(),
                        - (gui.getyPos())
                ), gui.getRotation()
                ,new Vector2f(
                        width,
                        height
                )
        );

        shader.loadTransformation(transformationMatrix);

Vertex shader code:

gl_Position = modelMatrix * transformationMatrix * vec4(position, 0.0, 1.0);
textureCoords = vec2((position.x+1.0)/2.0, 1 - (position.y+1.0)/2.0);

This does not happen to all images, when I load in an image that is square and I try to display it with width 400 and height 800 it works perfectly. Image

With different images it yields different extra space.

All images are .png. The phone image is 1009x2057 pixels. I also tried to use a phone that was 2048 pixels high (1006x2048) since this is a power of 2, that still yields a white line on the side but does look better: image

The square (3rd image) that was elongated to look like a rectangle and does display correctly is 256 x 256 pixels.

All displayed images have a slight rotation because without rotation the little white thin lines don't always show up, the rotation did not change anything about the images.

To load images I use slick utils TextureLoader class.

sentences:
How to do one-way collision? I would like to know how can I do one way collision. It's the collision common in mario's games and many platforms. I try to do an code but I cannot post because it's part of a paid game.
Basically I have two rectangles like this:

struct Rect {
  int x, y; // positions in the world
  int w, h; // width and height
};

The rect A moves and the rect B is fixed with the world.
Someone has a idea of how to do this?

sentences:
Units issue when exporting from 3DS Max to XNA I am working on a XNA game where we have defined that 1 XNA unit equals to 1 meter. Then, I set meters as system unit in 3DS Max and set to meters the units in the FBX exporter. However, when I export my models, they are much bigger in the game. Am I missing something? What should I do to avoid problems with my units?

Investigating the FBX file, I noticed that I it has two values called UnitScaleFactor and OriginalUnitScaleFactor. They both are 100 when I export the files... And if I manually change UnitScaleFactor to 1, it works fine :S

sentences: C++ SFML Performance I have recently started a project using SFML in C++. So far I haven't done much but I noticed an issue. Inside of the while(window.is_open()) loop I made a tick counter that increments every itteration through the loop, then I displayed the value with a sf::text object. I noticed that when I was in the starting resolution (~600 x ~400), It ran about 1000 - 1500 tick per second, but whenever I maximize, or even just increase the window size at all for that matter, the tick rate drops to around 250-500 per second. Is there anything I can do to elimante this, and possible any other performance issues I may encounter?

sentences:
Selling Android apps from Android-Market-unsupported countries I am in Latvia (which the Android market doesn't support as a country for selling apps from), and I am thinking about the best way of monetizing my app. So far I've come up with these options:

Pretend I am from a supported country. Get a bank account there, etc.
Use PayPal for in-app purchases. The player gets, say, the first 10 levels for free, but is then asked to pay 0.99$ for the rest of the game. Downside: Players might not feel comfortable entering PayPal details into an app. Android market might not like it either.
Making the app free and earning money through advertising. Let's do some calculation here: Say I get 1M free downloads, each user during his playtime would see 10 banners, so 10m / 1000 * 0.3 is about 33k$ if we use AdMob with their 0.3$ per 1000 impressions. On the other hand, if we use PayPal and in-app purchases, we need a >3% conversion rate to beat this..

What should I do?

Edit: From what I just read all over the net, it looks like advertisers will change their eCPM price a lot without telling you. Using in-app PayPal purchases at least allow you to monitor the cash flow.

sentences:
Has Silverlight got a future in the online Game world? We have spent several months planning, testing and developing a new game. We have been trialing a host of Platforms (Java Applet, Desktop Via XNA, Flash etc) and Silverlight was pretty much our prefered choice.

However, the more we get into the game the more problems we face, mainly down to the communication with a server. HTTP Polling is slow and in-efficent yet the socket functionality that is now available in SL4 is only really useful for a Intranet enviroment - Unless we are missing something.

Anyone have any opinions or experiance with this and the future of SL for Online Browser based games.

sentences:
Lighting shadow casting sprites with box2Dlights I currently have something like this using box2Dlights

Ideally, I would like objects casting shadows to be lit, so the object is lit but there is still a shadow cast around it. Right now the object is covered by shadow. I am aware of the soft and softnesslength settings in box2dlights but this is not really what I'm looking for. Softness seems to light up a certain radius from the player rather than just lighting objects. It ends up kind of weird looking:

So for example in the above picture, I would want the entire grey box to be lit, and none of the area to the left/right/behind it to be lit.

Any thoughts would be appreciated. Thanks

sentences:
Using Unity as a front-end GUI for a non-unity application? I'm working on a game right now that is 2D, and grid based, and for a variety of reasons have decided making it in Unity wouldn't be worth the hassle I'd have fighting the engine.

That said, I want to possibly add in VR support at some point, and Unity seems the easiest way to make that happen.
Right now, the game is structured so that part of the code takes in a grid from the game-core, and that grid tells it what sprite(s) to stick in each spot on said grid.

My thought was that it might be possible to replace the "take grid array, render sprite-grid" portion of my game with a Unity front-end. For example, perhaps this would be like a board game sitting on a table, and rather than a 2D grid, the "sprites" would be simple models on the grid-board, with the user looking down at it in VR.

Is this a thing that is possible? Essentially, all I would need is for my Unity program to take inputs, and send trigger signals to the game-core, then receive an updated grid-array and respond accordingly. I've not been able to find any information on this kind of thing, interfacing Unity with an external program in this way. The game is turn based, so 2-3 updates per second would be the absolute max I'd need, performance-wise, and the game core could run on a potato.

In specific: can Unity send triggers to and receive a data array from an external binary (written in c#), and how would I do this?

I really hope this is possible.

sentences:
When updating app from Google Play will the app data be deleted? My question is pretty simple.

I developed a game, uploaded it on the store. In order to keep player level record and UI prefs it writes an ini file.

When the next update is up on the store and the users will update will they lose their progress? Will the file be deleted?

Thanks

sentences:
What freeware frameworks and tools to choose if I want to build a game like Farmville or Club Penguin? Say I like to experiment with multiplayer games and I do not want to reinvent the wheel and build yet another game server. I don’t mind configuring and writing wrappers and adapters (both in c++ and java) for the server.
What server does Farmville use? Is it Java or C based?
What isometric flash engine do they use?  What other examples can I look into to learn the subject?
Thanks.

sentences:
How to Render an xml tile grid in java So i decided to write my games data files in xml since a lot of people recommend it security wise for an online game, but how exactly does one render an xml tile grid in java?

format will be as follows:

<Data>
   <Tile X="1" Y="1" Value="12"></Tile>
</Data>

sentences:
Rendering Texture Quad to Screen or FBO (OpenGL ES) I need to render the texture on the iOS device's screen or a render-to-texture frame buffer object. But it does not show any texture. It's all black.

(I am loading texture with image myself for testing purpose)

//Load texture data

UIImage *image=[UIImage imageNamed:@"textureImage.png"];

    GLuint width = FRAME_WIDTH;
    GLuint height = FRAME_HEIGHT;

    //Create context
    void *imageData = malloc(height * width * 4);
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextRef context = CGBitmapContextCreate(imageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
    CGColorSpaceRelease(colorSpace);

    //Prepare image
    CGContextClearRect(context, CGRectMake(0, 0, width, height));
    CGContextDrawImage(context, CGRectMake(0, 0, width, height), image.CGImage);

    glGenTextures(1, &texture);
    glBindTexture(GL_TEXTURE_2D, texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

Simple Texture Quad drawing code mentioned here

//Bind Texture, Bind render-to-texture FBO and then draw the quad

const float quadPositions[] = {  1.0,  1.0, 0.0,
                                -1.0,  1.0, 0.0,
                                -1.0, -1.0, 0.0,
                                -1.0, -1.0, 0.0,
                                 1.0, -1.0, 0.0,
                                 1.0,  1.0, 0.0 };
const float quadTexcoords[] = { 1.0, 1.0,
                                0.0, 1.0,
                                0.0, 0.0,
                                0.0, 0.0,
                                1.0, 0.0,
                                1.0, 1.0 };

// stop using VBO
glBindBuffer(GL_ARRAY_BUFFER, 0);

// setup buffer offsets
glVertexAttribPointer(ATTRIB_VERTEX, 3, GL_FLOAT, GL_FALSE, 3*sizeof(float), quadPositions);
glVertexAttribPointer(ATTRIB_TEXCOORD0, 2, GL_FLOAT, GL_FALSE, 2*sizeof(float), quadTexcoords);

// ensure the proper arrays are enabled
glEnableVertexAttribArray(ATTRIB_VERTEX);
glEnableVertexAttribArray(ATTRIB_TEXCOORD0);

//Bind Texture and render-to-texture FBO.
glBindTexture(GL_TEXTURE_2D, GLid);

//Actually wanted to render it to render-to-texture FBO, but now testing directly on default FBO.
//glBindFramebuffer(GL_FRAMEBUFFER, textureFBO[pixelBuffernum]);

// draw
glDrawArrays(GL_TRIANGLES, 0, 2*3);

What am I doing wrong in this code?

P.S. I'm not familiar with shaders yet, so it is difficult for me to make use of them right now.

sentences:
How to vectorize a raster image edges into SVG paths? I'm having a lot of trouble figuring out how to convert a 2D list of points into an SVG Path representing a political map border. I have completed all parts of a 2D terrain generator, including climate simulation, rivers, lakes, rainfall, temperature, biomes, and finally territories. This last part is where the problem lies. The entire script is written in Python.

I have a list of territories, which are represented as dicts with several properties. One of which is Color, used as an ID and to output a pretty map. Another is a list of Pixels, list of Borders, and list of Neighbors. Pixels refers to all points in the territory. Territories can be thought of a polygons. They have Border pixels, which are defined as any outside (meaning not part of the Pixels list) pixel not belonging to this territory (whether it be a River, Ocean, or Unowned pixel). I also keep a list of neighboring territories.

Now, I can't store an array of ~3000 coordinates in a database efficiently when I only really need the border. I aim to draw only the world map with the borders of each territory drawn in a layer above. So I need to convert the border to an SVG Path string.

The Borders list is unordered when the generator finishes. For each border pixel, I go clockwise around the pixel and look for another, and progressively create a SVG Path string. I can't seem to efficiently parse the borders without getting stuck. Another problem is that there may be "lakes" in the middle of the Territory, and Borders are added around those as well. These don't have to be included in the path string.

Territories can also wrap around horizontally (like Google Maps for instance), splitting the territory in two.

So the final result of my algorithm would ideally be an LIST of SVG Paths, each representing individual parts of the territory polygons.

But, how do I do this efficiently? Is there another way to efficiently store a list of potentially thousands of coordinates representing the shape of the territory?

Each white line that sticks out from the coastline is a river. You can also see a lake in the middle of the lower green territory.

PS: I was unsure of a title, if a mod would like to change it.

sentences:
Retrieving an array of images from Firebase Storage As title says I'm trying to get all images on firebase storage and save them to an array which later on i will be using to load them into the scene. i can manage downloading on image so far but I'm unsure of how to make them into an array.
This is the code I'm using now to download one image by name and assigning it into a texture variable
        storage = FirebaseStorage.DefaultInstance;
        storageRef = storage.GetReferenceFromUrl(_url);

        storageRef.Child(_resourceName).GetBytesAsync(1024* 1024).ContinueWithOnMainThread(task =>
        {
            if (task.IsCompleted)
            {
                Texture2D texture = new Texture2D(1, 1);
                byte[] fileContent = task.Result;

                texture.LoadImage(fileContent);
                Debug.Log(texture.name.ToString());
                selectedText = texture;
            }
            if (task.IsFaulted)
            {
                Debug.Log("faulted DOWNLOAD");
            }

        });

now through that i want to replace my current function which loads all images through the inspector.
 if (LevelSystemManager.Instance.CurrentLevel < source.Length)
        {
            selectedText = source[LevelSystemManager.Instance.CurrentLevel];
        }

Source being the array i use from the inspector to load those images into the game scene which then are selected into the selectedTex Texture2D and loaded based on the level, so 0 element in array == level0 , 1 == level 1 etc. etc.
So i was wondering if i have a couple of folders inside firebase with 10 to 20 images each how can i make that source array pull from that folder? And as a result remove the need to have them in the game and of course not setting them through the inspector.

sentences:
libgdx - how to make enemies not overlap I'm currently making a roguelike shooter in libgdx to get a better understanding of the library but I recently just stumped onto a problem where enemies would overlap each other while tracking the player's movements. The code I use to calculate the angle for the enemy to take is simple trigonometry. After moving the player around the screen a for a little bit, the enemies' paths intersect to the point where it just looks like a single mesh of textures following the player. Here's the code:

// track player
radians = MathUtils.atan2((player.getY() + player.getHeight() / 2) - (y + enemy.getRegionHeight() / 2),
        (player.getX() + player.getWidth() / 2) - (x + enemy.getRegionWidth() / 2));
dx = MathUtils.cos(radians) * speed;
dy = MathUtils.sin(radians) * speed;

An solution that allows the enemies to recalculate their angle would be much appreciated.

sentences:
Finding the on-screen height of straight walls in raycasting rendering I have an issue to find the correct height of walls to make them straight in raycasting rendering.

This is how I calculate the height of the wall which is h_seen:

dist_w = sqrt(pow((w->cam->position.x - w->cam->rays[i].endPoint.x), 2) + pow((w->cam->position.y - w->cam->rays[i].endPoint.y), 2));
distortion = dist_w * tCos(w->cam->fov / 2 - (i * w->cam->fov / WIN_W));
if (distortion)
    h_seen = dist_c * wall_h / distortion;
//printf("h_seen = %f\n", h_seen);
y = cam_h - (h_seen / 2) - 1;

This is a screenshot of the problem  I have fisheye effect, if i use depth directly

    if (l == 0)
    {
        raytravel.y = w->cam->rays[i].endPoint.y - w->cam->position.y;
        raytravel.x = w->cam->rays[i].endPoint.x - w->cam->position.x;
        depth = raytravel.x * dir.x + raytravel.y * dir.y;
        h_seen = dist_c * wall_h / depth;
        y = cam_h - (h_seen / 2) - 1;
        if (hit == 1)
            while (++y < (cam_h + (h_seen / 2)))
                put_pixel_img(w, WIN_W - i + WIDTH_MM, y + 150, 0xff0000);
    }

// Direction of each ray inside the while loop

if ((hit = intersection(w, l, &dir)))
        w->cam->rays[i].endpoint = w->cam->intersection;
else
    {
        w->cam->rays[i].endpoint.x = w->cam->position.x + w->cam->raylength * tcos((w->cam->angle + w->cam->fov / 2) - (i * (w->cam->fov / limit)));
        w->cam->rays[i].endpoint.y = w->cam->position.y + w->cam->raylength * tsin((w->cam->angle + w->cam->fov / 2) - (i * (w->cam->fov / limit))); // limit is just the screen width
    }

sentences:
rotating an array of images in 90 degree-java In my java game,I have a stickSprite in vertical position.I want to rotate this stick in 90 degrees.so that it can hit the floor,once I press a key.
I used a an array of stick sprites to create a large stick.Why I am doing this because I want to increase the stick length differently at different times.

I am using this method to rotate the stick image:

public Image rotateImage(Image src, float angle) {

    int sw = src.getWidth();
    int sh = src.getHeight();
    int[] srcData = new int[sw * sh];

    src.getRGB(srcData, 0, sw, 0, 0, sw, sh);
    int[] dstData = new int[sw * sh];

    double rads = angle * Math.PI / 180.f;
    float sa = (float) Math.sin(rads);
    float ca = (float) Math.cos(rads);
    int isa = (int) (256 * sa);
    int ica = (int) (256 * ca);

    int my = -(sh >> 1);
    for (int i = 0; i < sh; i++) {
        int wpos = i * sw;

        int xacc = my * isa - (sw >> 1) * ica + ((sw >> 1) << 8);
        int yacc = my * ica + (sw >> 1) * isa + ((sh >> 1) << 8);

        for (int j = 0; j < sw; j++) {
            int srcx = (xacc >> 8);
            int srcy = (yacc >> 8);

            if (srcx < 0)
                srcx = 0;
            if (srcy < 0)
                srcy = 0;
            if (srcx > sw - 1)
                srcx = sw - 1;
            if (srcy > sh - 1)
                srcy = sh - 1;

            dstData[wpos++] = srcData[srcx + srcy * sw];

            xacc += ica;
            yacc -= isa;
        }
        my++;
    }

    return Image.createRGBImage(dstData, sw, sh, true);
}

and rotating the single stick(that is not an element of the array.Stick array elements are placed above this base stick.)like this.It worked well.

private void RotateBaseStick() {

    if (smashBool &&angleValue<90) {
        angleValue = angleValue + stickMovingSpeed;
        rotatedImage = rotateImage(stickImage, angleValue);
        stickSprite.setImage(rotatedImage, rotatedImage.getWidth(),
                rotatedImage.getHeight());

    }
    if (angleValue >= 90) {
        smashBool = false;
    }

    }

I am wondering how can I rotate the entire stickArray efficiently to make the feel of a long single stick hitting the ground?
Please help me.

sentences:
24-Bit Colordepth not enough? I noticed that in very soft gradients, the 24-Bit colordepth is not enough as you can see the transitions of the color. This pops out the most in dark scenes or night skies.

Why doesn't anybody change the colordepth to two bytes per channel? I know that would be alot of work and a lot of hardware would have to be repalced, but I find it a bit annoying. I really don't think that the technology of the hardware isn't mature enough.

So why is no one doing that?

Here's a picture of "The War Z" where you can see what I mean:

sentences: How important is music to mobile phone (smart PDA) games? Specifically iPhone/iTouch, Droids, and the new Windows Phone 7? I don't know how to quantify this, or if any research has been done. I am wondering how important the music is to the gaming and what % of games come with music at all, if good music at that.

sentences:
How do I compute the angle between a pixel on an irregular curve and a circle colliding with it? I'm building a custom physics engine to accompany a level-editor. This image shows how the level-editor outputs levels:

Now, some explanation is in order. The curve is defined by the red points. After they are connected in threes by circles (yellow lines show these circles), a system connects them in a 'streamlined' way - as shown by the blue lines. This makes the curves flow seamlessly.

Now, these curves are 'irregular,' so to say. For the accompanying physics engine - how do I detect the angle made between a pixel on the curve and a colliding circle (per-pixel collision check)?

sentences:
How to gradually decrease opacity of model? I have been searching for this matter for a long time and slowly I begin to think that this option is not available in XNA for Windows Phone.

I am trying to get a 3D-Model to be drawn at 50% opactity/transparency.

The most promising piece I found is following:

//1. Set the alpha blend mode for the graphics device with:

graphics.GraphicsDevice.RenderState.AlphaBlendEnable = true;
graphics.GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha; // source rgb * source alpha
graphics.GraphicsDevice.RenderState.AlphaSourceBlend = Blend.One; // don't modify source alpha
graphics.GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha; // dest rgb * (255 - source alpha)
graphics.GraphicsDevice.RenderState.AlphaDestinationBlend = Blend.InverseSourceAlpha; // dest alpha * (255 - source alpha)
graphics.GraphicsDevice.RenderState.BlendFunction = BlendFunction.Add; // add source and dest results

//2. Set the alpha value in the BasicEffect for the model:
effect.Alpha = 0.5f; // Creates a 50% translucent object.

But GraphicsDevice.RenderState.AlphaBlendEnable isn't even available in XNA for Windows Phone.

So is there any way to achieve that effect?

sentences:
Sea is higher than land when importing large real world terrain I am trying to import some real world terrain into Unity with the help of Global Mapper. The data I am using is download from CGIAR SRTM(http://srtm.csi.cgiar.org/,http://srtm.csi.cgiar.org/srtmdata/). The land part works well but I am having trouble with the sea part.

This is a larger view of that weird thing in the first image. This strange is actually the sea. This is happening because I am using the gradient shader. Lokks like:

The sea is represented with white, but when Unity reading the .raw file, the white means the highest part. Does anyone know how to deal with problems like this? Thanks very march.

sentences:
Calculating the vector to catch a falling object I have two objects in a three dimensional world. One is a ballistic projectile: that is, it is free-falling with some known gravitational acceleration. The other is a catcher that travels with constant velocity and is not subject to gravity. I want to calculate the vector that the catcher must travel along in order to intercept and catch the falling projectile (or the position of intercept between the catcher and the projectile).

By my reckoning, the problem can be formulated into equations like this:

Intercept position = Catcher start position + Catcher velocity * Intercept time

Intercept position = Projectile start position + Projectile start velocity * time + 1/2 * Gravitational acceleration * Intercept time^2

...where all the named variables except intercept time are three-dimensional vectors. Within those equations, I know:

The catcher and projectile start positions
The projectile's current velocity
The projectile's gravitational acceleration
The magnitude of the catcher's velocity.

I don't know, and could solve the problem by finding out any one of:

The direction of the catcher's velocity
The intercept position
the intercept time

...but I have really struggled to make any headway finding a solution to these equations. Can anyone help me out? Is there something missing from/incorrect about my approach here?

sentences:
Outputting Unity commandline build log to console? I'm using Blue Ocean to do a Unity3D build through command lines (https://docs.unity3d.com/Manual/CommandLineArguments.html).

I currently have a stage in blue ocean which runs the build command in a 'Windows Batch Script' outputting the log to a text file on the computer.

is there a way to also output that same logging text to the blue ocean build output? Right now all I see is the batch command.

One way to accomplish this would be if the build output was sent to the console instead of just the logfile passed in the argument.

sentences:
Unity not importing pivot points? To start things off, I begin with the following set of procedures:

Begin with a model in 3DS Max, which I will refer to as Cube.
Confirm that Cube's pivot point is exactly in the center of it, which it is.
Export Cube in FBX format.
Import Cube into Unity 3D.
Drag an instance of Cube into the Scene.

At this point, I notice that the instantiated Cube's pivot point seems to only be centered on the Cube's local X and Y axes, when it should also be centered on the Z axis.

In the project I am working on, I'll be instantiating Cubes and modifying their positions and rotations within a script. Because of this, it's most convenient to have the pivot point centered on all three axes.

Am I doing something wrong, or is there a way I could export/import the Cube properly so that its pivot point persists?

sentences:
Browser game - small models with tileable textures vs one big model and one big texture I am few years behind in terms of browser capabilities. I plan to combine 3D with pixel art, and I am going to use Unity to make a browser based game.

I have made a stage that is one model and has around 1k poly's. Then I made a large 2048x2048 texture for it. Lots of that texture is tileable, I'd say that I could fit unrepeated parts on a 256x256 texture while the rest is just repeated content. This looks like a huge waste when I just tile it manually in photoshop on a big texture file and I feel like I am doing something "dirty".

But when I would split that one model into 100 models and tile them separately with 32x32 textures, that would make more sense, but would increase model count from 1 to 100.

What is the correct way to do this? Lots of models with tiled textures, or screw it and make one big model with one large texture? Or maybe performance now is so great I don't even need to care and just do whatever?

Thanks

sentences: What exactly is the difference between Unreal Development Kit and Uunreal Engine 4? I want to start learning game development and I would obviously come across this tool. So every where I went people mentioned Unreal Engine 4 to be a viable choice, I've tried a bit of Unity and now I want to try Unreal. Only issue I came across UDK and UE4, I downloaded UDK which turns out to be different from tutorials and I can't seem to find any info on that and besides I could only run the software once because after the first time it starts a game, I re-installed UDK I still get the issue, but anyways that's a different topic, what I want to know is whether UDK and UE4 are different and if they are, where do i get UE4, becauuse when I down UE4 (from - https://www.unrealengine.com/dashboard), it downloads a game launcher and no development tool. In case they are same, why is my version of UDK different fr

sentences:
How can I keep the drawn lines instead deleting them? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DrawLines : MonoBehaviour
{
    private Transform startMarker, endMarker;
    public GameObject[] waypoints;
    private float speed = 2f;
    private float startTime = 0f;
    private float journeyLength = 1f;
    private int currentStartPoint = 0;
    private LineRenderer lineRenderer;

    public void StartInit()
    {
        currentStartPoint = 0;
        SetPoints();
        lineRenderer = GetComponent<LineRenderer>();
        lineRenderer.startWidth = 0.2f;
        lineRenderer.endWidth = 0.2f;
    }
    void SetPoints()
    {
        startMarker = waypoints[currentStartPoint].transform;
        endMarker = waypoints[currentStartPoint + 1].transform;
        startTime = Time.time;
        journeyLength = Vector3.Distance(startMarker.position, endMarker.position);
    }
    void Update()
    {
        if (waypoints.Length > 0)
        {
            float distCovered = (Time.time - startTime) * speed;
            float fracJourney = distCovered / journeyLength;
            Vector3 startPosition = startMarker.position;
            Vector3 endPosition = Vector3.Lerp(startMarker.position, endMarker.position, fracJourney);
            lineRenderer.SetPosition(0, startPosition);
            lineRenderer.SetPosition(1, endPosition);
            if (fracJourney >= 1f)
            {
                if (currentStartPoint + 2 < waypoints.Length)
                {
                    currentStartPoint++;
                    SetPoints();
                }
                else
                {
                    //if finished, disable lineRenderer and this script
                    lineRenderer.enabled = false;
                    this.enabled = false;
                }
            }
        }
    }
}

Each time it's drawing a line between two waypoints but then the line is deleted and then it's drawing a new line between the next two waypoints.

Instead I want it to draw one line between all the waypoints. And to keep the line in the end not to delete it.

sentences:
HLSL mipmapping not working I want to implement a mipmap filter in my 3D game, so that textures which are located far away are using a lower resolution than the original.
For the shader I'm using hlsl version 4_0_level_9_1 or 4_0 depends on which one I will get this running.
I have tried this:

texture Texture;
sampler diffuseSampler = sampler_state
{
    Texture = (Texture);
    MAGFILTER = ANISOTROPIC;
    MINFILTER = ANISOTROPIC;
    MIPFILTER = ANISOTROPIC;
    AddressU = Wrap;
    AddressV = Wrap;
};
[...]
Color PixelShaderFunctionTex(VertexShaderOutputTex input)
{
    return tex2Dlod(diffuseSampler, float4(input.TexCoord, 0.0, 0.0));
}

in vs_4_0 it still uses the full-res texture.
And in vs_4_0_level_9_1 it won't even compile: "texlod not supported on this target"

I could manually generate the downscaled textures, but there must be a way to only input one texture and let hlsl do the rest.

In short:
How to apply the mipmap filter in hlsl?

sentences:
Walk to mouse click position in Java I am very new to programming, and trying to get my player to walk to the mouse click position. I currently have this script, which "teleports" my character to the clicked position:

private void getInput() {
    xMove = 0;
    yMove = 0;

    float tempX = handler.getMouseManager().getMouseX();
    float tempY = handler.getMouseManager().getMouseY();
    float diffX = tempX - x;
    float diffY = tempY - y;

    if (handler.getMouseManager().leftPressed) {
        x = tempX;
        y = tempY;
    }
}

The first thing that came to my mind was to use the following script, for moving to a click which is to the right:

if (handler.getMouseManager().leftPressed) {
    if(diffX>0) {
        for(float counter = 0; counter = diffX; counter++)
            xMove = speed;
    }
}

However, this doesn't work. How would I go about making my player walk to the mouse click position?

sentences:
Monogames Most efficient way of checking intersections between multiple objects I've created a top-down shooter with multiple objects such as enemy AI (tanks), walls, power-ups etc.

At first I was able to create about 300 AI units which aims to move the player character, checks for collision and shoot a bullet. This bullet also checks for collision on each frame until it encounters an intersection to be destroyed.

I wasn't long after I encountered massive performance issues. I immediately identified that the main performance drop was caused by the collision detection.

Each object's bounds is represented by a rectangle. If this rectangle intersects with any other rectangle the collision event is raised.

I'm currently unsuccessful in deciding what to do to reduce performance, but still maintain all the characters' capabilities. I want to check if the player or AI will collide with any object before it moves to the given location. I also want to check when the bullet collides with any other object.

I'm currently flagging all my objects by using different interfaces. I then created a Dictionary>> (GroupedObjects) Dictionary that filters the objects into different flags where the first type represents the interfaces the object inherited and the second type identifies the object's type. For e.g. I check only the Hostile tanks of type AITank for collision with the bullet. GroupObjects[Hostile][AITank].

I've read that I need to create trees where collision is only checked with all the objects in the current tree.

After a few benchmarks I identified that checking collision between 1 million rectangles uses 38ms on the CPU and checking the distance from a fixed point to 1 million other points take 136ms.

QUESTION

With the benchmarks above in mind, how would I group objects by their range (for e.g. within the screen size) if calculating the distance takes more processing than checking the intersection with a rectangle representing the screen?
What will be the most efficient way to check for collision between objects, meaning the player checks for collision AND the AI tank checks for collision since both of them can't move through the walls? Keep in mind that the AI isn't static and moves on each frame. Also, object A checks for collision between itself and object B and object B checks for collision between itself and object A.
I created an object called CollisionMap that contains points, that represent collision, generated by an image with a specified colour as collision. These points need to be updated every time an object moves and an other object needs to check for collision with this object's CollisionMap (that can contain hundreds of points). I've created this CollisionMap to represent shapes that isn't rectangular or circular so that colliding object will treat each intersection according the shape of the shape. Does this sound possible to process if you have hundreds of objects with hundreds of points representing collision?

I'm new to game dev and I have no idea on what's the most efficient way to check for collision between multiple objects. And for all the algorithms (AABB, Rays) I've seen: it's only for one object or it's still too inefficient...

P.S. I know I typed allot, but I'm trying to explain my problem so that I don't get referenced back to sources I already examined and show what I've tried.

Thanks in advance!

sentences:
glGenBuffers fails with 0x0, win7, glew I try to run a simple renderer on my win7 machine but it dies at the first glGenBuffers call.
The computer has an Intel HD3000 card, with the latest driver (OpenGL 3.0 support).
I use glew 1.10 (self compiled with mingw).
The linker command is:

g++ -LC:\Program Files\Microsoft SDKs\Windows\v7.1\Lib -Lc:\opt\glew-1.10.0\lib -LC:\opt\SDL-1.2.15\lib\x86 -o pysicsdemo.exe src\main.o src\Box.o -lOpenGL32 -lglu32 -lSDLmain -lSDL -lglew32.dll

And the result is 0x0. Most probably glew can't load the extension, but why?

sentences:
Box2d topdown racing game - killing "residual" forces I'm making top-down race game in GM:S with Box2D, the car is controled in unusual way: player sets direction and engine's speed, and the car uses them: turns to the desired direction and reaches speed. But the question is about the "residual" speed after the turn. Here is what I mean:

I make rotation by applying torque and move with applying force. I don't have tyres, it's just one plain object.
So how can I get rid of this momentum? I'm working in GM:S, but I'd like to hear any solution, I can adapt it easily.

Movement code:

var ad = angle_difference(phy_rotation, desiredDir);
physics_apply_torque((angleTorque) * -sign(ad)); // rotate the car

dx = lengthdir_x(spd, -phy_rotation);
dy = lengthdir_y(spd, -phy_rotation);

physics_apply_force(phy_position_x, phy_position_y, dx, dy);  // move the car

sentences:
How to store each rendered frame as image in libgdx for debugging I have a libgdx screen's render method where I am executing lots of for loops and drawing various shapes on screen in thoese loops. Also I am manupulating (x,y) of each shape at runtime to acheive a smooth animation.Everything was ok until,

Issue: Recently I had added few more shape's at some positions in my screen. Due to some mess up, I am getting flicker, and some shapes are getting drawn out of my game world.

I tried to debug my code many times but there are too many loops and shapes so I am unable to pin point the exact loop or frame where shapes are getting drawn out of my game world.

Need Input on following approach to debug:

So I was thinking to save each frame of my render method as an image locally. Is it possible? Please provide suggestions or sample code to acheive it.

I will hook up some debug variables in my loops to calculate exact frame where things are getting messed up. That I will take care of.  Please advice on above question.

Thanks in advance.

sentences:
Slick 2D Image move along with shape I am trying to move my image along with the shape so I can make the collider with the shape (some kind of space shooter) but my image does not move along with the circle I make for it. It dissapears to the next spawned circle instead of completing it's track towards the bottom of the screen (I want to make a vertical linear move from top to bottom but everytime another circle+image spawns, the previous circle goes down but the image spawns to the next circle and so on)

update method:

    timePassed+=delta;
    if(timePassed>700){
        timePassed=0;
        RandomInt = random.nextInt(400);
        gigis.add(new Circle(200+RandomInt,0,40));
        gigiSkin.add(new Image("img/gegi.png"));
    }

    for(Circle c: gigis){
        c.setCenterY(c.getCenterY()+(delta/6f));
        gigiY= c.getCenterY()+(delta/6f);
    }

    for(Circle c: bullets){
        c.setCenterY(c.getCenterY()-(delta/1.25f));
        projY = c.getCenterY()-(delta/1.5f);
    }

render method:

    for(Circle c: bullets){
        g.draw(c);
    }
    for(Image skin: bulletSkin){
        skin.draw(projX,projY,80,80);
    }

    g.setColor(Color.red);
    for(Circle c: gigis){
        g.draw(c);
    }
    for(Image skin: gigiSkin){
        skin.draw(200+RandomInt,gigiY,80,80);
    }
}

sentences:
How to perform alpha blending on saved raw argb videos(a image and a video will also work) using direct3d9 , direct3d10 or direct3d11? I'm trying to perform alpha blending on videos using direct3d11. I've wrote the code snippet below to achieve this. I've tried to read the video file out2.argb frame by frame and store it in the rawData. Later, I passed that rawData to CreateTexture2D but pTexture remained null after the execution of the API. So I tried passing NULL to the CreateTexture2D and passing rawData to the UpdateSubresource but again the pTexture remained NULL.

HRESULT result;
    FILE * fp = NULL;
    int size = 1280 * 720 * 4 ;
    void * rawData = NULL;
    D3D11_TEXTURE2D_DESC desc;
    desc.Width = 1280;
    desc.Height = 720;
    desc.MipLevels = 0;
    desc.ArraySize = 1;
    desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    desc.SampleDesc.Count = 1;
    desc.Usage = D3D11_USAGE_DYNAMIC;
    desc.BindFlags = D3D11_BIND_SHADER_RESOURCE| D3D11_BIND_RENDER_TARGET;
    desc.CPUAccessFlags = 0;
    desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;

    D3D11_SHADER_RESOURCE_VIEW_DESC shader;
    shader.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    shader.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
    shader.Texture2D.MipLevels = -1 ;
    shader.Texture2D.MostDetailedMip = 0;

    fp = fopen("../Engine/Data/out2.argb", "rb");
    rawData = malloc(size);

    D3D11_SUBRESOURCE_DATA data;
    data.SysMemPitch = 1280 * 4;
    data.SysMemSlicePitch = 1280 * 720 * 4;

    if (NULL == rawData)
        return -1;
    int row_pitch = (1280 * 4) * sizeof(unsigned char);
    if (fp)
    {
        /*while (!feof(fp))
        {*/
            fread(rawData, size,1, fp);
            //D3D11_SUBRESOURCE_DATA *sSubData = new D3D11_SUBRESOURCE_DATA[1];
            //for (int i = 0; i < 1; i++) {
            //  sSubData[i].pSysMem = rawData;
            //  sSubData[i].SysMemPitch = (UINT)(1280 * 4);
            //  sSubData[i].SysMemSlicePitch = /*(UINT)(1280 * 720 * 4)*/0;
            //}

            //data.pSysMem = rawData;
            // GOT FRAME
            device->CreateTexture2D(&desc, NULL, &pTexture);
            deviceContext->UpdateSubresource(pTexture, 0, NULL, rawData, row_pitch , 0);
            result = device->CreateShaderResourceView(pTexture, &shader, &m_texture);
            if (FAILED(result))
            {
                return false;
            }

    /*  }*/

        fclose(fp);
        fp = NULL;
        free(rawData);
        return true;
```

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

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

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

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

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

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

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

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

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

sentences:
How does Megatexture work? I've been thinking about developing a small engine not only to develop small experimental games, but also to serve as a base to test various rendering techniques and things like that. Right now I've been thinking a lot about how to handle textures and stumbled on megatexture, but this is something that is a bit puzzling. There is a lot of talk of it being better than the traditional approach to having a bunch of textures around and loading them as needed, but how does megatexture avoid this, I've read around that they use streaming and you can just stream bits and pieces of it as opposed to loading each texture individually, but how does that offer better performance, and isn't that just another form of tilling?

How do we sample such a texture when in a shader, do we stream part of it into memory then work on it. I've seen the latest videos of Rage and the texture do look great, but is that just the result of great artists or does the tech come into play.

To sum up, how does it work, why is it great and how could I do something similar.

sentences:
Unity GUITexture or GUIText not showing up Currently I've got a little 2.5D platformer with the camera tracking the player. Now when I go to insert a GUITexture or GUIText game object into the scene, it comes up absolutely fine in the Editor view, but when I go to play it there's absolutely nothing to be seen!

At first I thought it may have been a script I was using on the GUI, but I've tried it out with a completely bland GUITexture object that has no interaction with the rest of the game and I still get the same effect. I'm wondering if my camera is messing it up somehow, but I assumed that all GUI objects are drawn to screen space and just stay with the camera.

I've been really stuck for the past few hours so if any one could offer some insight, I'd be very, very grateful!

~Ray

sentences: PN TRIANGLES is Bezier Triangles right? JUst wondering the term pn triangles is the same thing as saying bezier triangle patch??/

sentences:
LibGDX and Sound Priorities According to a post I found, the setPriority of a Sound in LibGDX is not only a hint, but does nothing on desktop, and I can confirm this.

I really need priorities for sounds in my desktop game.

The first thing that comes to mind is to roll some kind of simple "sound system" with, say, a PriorityQueue, but I'm not quite sure of how I would implement it exactly, and I'd like to re-use code as much as possible... has anyone here perhaps rolled one that I could use?

sentences:
How would I access my list from Update function? The DFT function below works fine but I want to use the list, generated from that function, in the Update function.

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

public class FFT : MonoBehaviour
{
    public ArrayList amp = new ArrayList();
    public ArrayList freq = new ArrayList();

    void DFT()
    {
        float[]  X = {1, 2, 3};
        float[]  Y = {2, 3, 5};
        float  N = X.Length;

        for(int k = 0; k < N; k++)
        {
            float re = 0;
            float im = 0;

            for(int n = 0; n < N; n++)
            {
                float phi = (2 * Mathf.PI * k * n) / N;
                re += X[n] * Mathf.Cos(phi) + Y[n] * Mathf.Sin(phi);
                im += Y[n] * Mathf.Cos(phi) - X[n] * Mathf.Sin(phi);
            }

            var  freqq = k;
            var  ampp = Mathf.Sqrt(re*re + im*im);
            var  phasse = Mathf.Atan2(re, im);
            phase.Add(phasse);

            amp.Add(ampp);
            freq.Add(freqq);

        }
    }
}

I want to use the lists elements in another function (for example in Update)

void Update()
{
    for(var i = 0; i < 2; ++i)
    {
        var x = amp[i] * Mathf.Cos(freq[i]);
        var y = amp[i] * Mathf.Sin(freq[i]);

        var pos = new Vector3(x, y, 0);

        //Debug.Log(pos);
    }
}

The problem is that amp[i] and freq[i] doesn't work in another function.

sentences:
Confused by scaling, units, and more Ok, so I've already waded through a bunch of questions around this, and it's just making me even more confused.

Let's say I am trying to model a card table in a 2d game.  Behind (beneath) the table is a quad with a floor texture.  The "table" is a sprite that is just an oval (using basic shapes at this stage until I have real artwork).

I've read plenty of questions on how to scale to different device resolutions.  And, that is certainly one way to do it (bit seems like a lot of work).  I've also read posts about changing the size of the orthographic camera to match the device (this seems easier).  But i'm left not quite understanding what the frame of reference is.

Let's say I design the game to work in 16:9 at HD resolution (1920x1080).  I size the "floor" to fill the entire space (and maybe extend a little beyond).  I size the "table" to fit within a smaller portion of that space.

If you have a fixed scene (ie, not a scroller), and you want the contents to fill the entire viewport, what is the best way to go about this?  Scaling the objects, scaling the camera?

As far as units, what's the best choice?  1 PPU?  What rule of thumb do you use when choosing PPU?  What are the reasons to choose different PPU's?

I think i'm missing the forest for the trees.  I understand so many of the basic concepts from reading so many questions, I just don't know how to put them together and when to choose which method.

sentences:
Calculate target angle to a certain Vector I'm developing a 3D game in LWJGL.
I have a player class and a monster class and I need the monster class to chase the player when the player is within a certain distance.
For that I have the monster directional vector (let's call it monDirVector) and the directional vector that points from the monster to the player (let's call it dirToPlayer)

So the way my monster class works is that it increments its current rotation to match a target angle (this way I can simulate the walking + turning animation). Given this I need to calculate the target angle so that the monDirVector overlaps the dirToPlayer making the monster walk right towards the player.

How would I go about this?

Here's a diagram for better understanding of what I need.

I pretty much need to get the cº angle and assign it as the target angle for the monster.
The aº is the monster current rotation and the bº is the angle between the two vectors. Both of these are known.
Please notice that the monster can be oriented any way and the player can be in any quadrant relative to the monster. This stands for a problem because I can't simply subtract the angle towards the player to the current rotation of the monster.

I would really apreciate if someone helped me.

sentences:
Should I be concerned about assets being accessed by dumping VRAM? I have heard many people tell me that a user can dump the VRAM on their GPU and get all the images in my game. Including all "Streamed" images. This includes most of my Menu graphics.

How would a user dump their VRAM and get the images? Is there software that does it?

Do I need to be concerned that this is possible and should I protect my game from it?

sentences:
Is there an isometric 2d game that doesn't use tilemapping? Is there an isometric 2d game that doesn't use tilemapping?

I want to do this in tilemap but the client doesn't want to use it (since it's easier to design maps without using tiles).

I've tried to research for some time and everything's done using tilemapping.

sentences:
Applying "zoom to the exact point" transformations to screen positions I´ve implemented zooming of orthographic camera (just scaling it with its speed value):

viewMatrix = glm::scale(viewMatrix, glm::vec3(_cameraScale, _cameraScale, 1.0f));

And then applied these transformations (also translation by camera position) to the destination point (actually a cursor position vector) so I got its world positions:

void Camera::applyTransformationsToPoint(glm::vec3& pos) {

    pos += _cameraPosition;

    pos /= _cameraScale;
}

It worked fine, i was getting the right world position with diferent scales.
However, this was done with normal scaling - to the origin of the matrix so basically when i scaled the matrix the whole camera moved to its origin and it looked a little bit weird. SO i have decided to imlement zoom to the middle of the screen feature. So basically what I do is (in pseudocode):

translate(screenWidth/2,screenHeight/2);
scaleTranslatedMatrix();
translate(-screenWidth/2,-screenHeight/2);

It works fine but the code above for transformation of screen coordinations to the world is now not working properly(im not getting the right world positions), any suggestions how to correct it? Thanks.

Edit1:
This is how I apply the scaling (if anyone wondered):

void Camera::zoomOut(float dt) {

    _cameraScale -= _scaleSpeed * dt;

    if (_cameraScale < 0.4f) {

        _cameraScale = 0.4f;
    }
}

According to the first answer edit:
As I have 4x4 matrix and using a vec3 for my point representation, i have to use temporary vec4 to perform the multiplication, however, it is not working correctly (even without scaling and just translating the view matrix) - for inverse matrix im using GLM library.

glm::vec3 Camera::applyTransformationsToPoint(glm::vec3 pos) {

    glm::vec4 tmpVec(pos.x, pos.y, pos.z, 1.0f);
    tmpVec = tmpVec * glm::inverse(viewMatrix);

    return glm::vec3(tmpVec.x,tmpVec.y,tmpVec.z);
}

sentences:
Move 2d tank with independently controlled treads I have made a tank object that knows its position, speed, rotation, and a double value ranging from 1.0 to -1.0 for each tread. I want it to move base on those values. For example, if the value for the left tread is 1.0 and the value for the right tread is 0.5 the tank should follow a clockwise circular path. However, the closest I have come is when the left tread turns forward (positive) and/or the right tread turns backward (negative), the tank spins CCW and moves down the screen, while the reverse is true if the left tread turns backward and/or the right tread turns forward.

This is my code for moving the tank, where lts is the left tread speed and rts is the right tread speed:

rotation += speed * (rts / 12);
rotation -= speed * (lts / 12);
location.x += speed * (Math.cos(rts / 12) * 14.5);
location.x -= speed * (Math.cos(lts / 12) * 14.5);
location.y -= speed * (Math.sin(rts / 12) * 14.5);
location.y += speed * (Math.sin(lts / 12) * 14.5);

sentences:
Quaternions - how to limit axis? Is there any possibility to limit quaternions to move only in x & y axis (like in Eulers- yaw and pitch, without rolling)? I's there any equation or something similar to do this?
Some example:
Movement should behave like this: http://360.art.pl/experimental/1/
But when I build my player on quaternions it have no limits and I don't know how to fix it http://360.art.pl/experimental/2/

sentences: How would I use an object from another animation in Unity? So I have two different .blend files with two different animations. Let's call my aiming with a gun animation animation A, and my other .blend file with idle, run, and jump animations animation B. If I wanted to play the aiming clip from animation A with the Animation B animator, it just looks like my character wants to shake hands, since the gun doesn't appear in the animation. The aiming animation works if I play animation A with animation A's animator. How would I use the gun object from animation A when playing animation A in animation B's animator?  Here is an image of what the animation looks like in the import settings (what i want) and in the actual game (what is happening which I don't want.) The top image is what I want and the bottom image is what is happening. Thanks in advance.

sentences:
Vertical Text - Bitmap Font Libgdx How can I achieve this kind of rotation or vertical text using Bitmap Font?

I already used Matrix but didn't get the result same as above.

sentences:
Separation algorithm in flock simulation? I'm using box2d (the c++ one).

I found a method for an arriving behavior (on http://www.red3d.com/cwr/steer/gdc99/ ), which works well, problem is, the bodies are bumping into each other and it results in an ugly shaking effect.

How do you make sure bodies keep away from each other after I applied the arriving behavior ? Or the other way around ?

I'm wondering if it might be a better idea to completely remove the arriving behavior to implement the separate algorithm.

edit: even setting a low restitution results in shaking

sentences: Where can I find some "must see" game development portfolios? I am trying to put together a website/portfolio and it would be great to see what others have done.

sentences:
Gathering Stats from a StarCraft 2 game One of the maps I've played, nicknamed SotiS (DoTA in SC2) has the ability to maintain stats, which are sent back to their own server.

Does anybody know how this is done?

sentences:
Animation import: What am i doing wrong? I need some help with an Animation that i want to import with Humanoid type (made in Blender).
Essentially i made an animation in blender with IK/FK (Rigify, with a bone for the sword, and IK to the hand). This is the preview in blender: https://i.gyazo.com/4f197c5e0ff1b291b45399fb4325ffc9.mp4
And this is when i import and set the animation with humanoid (activated the mask on the sword bone, parented with the root bone): https://i.gyazo.com/b042c29895be8e3db93edaa22e2a3665.mp4
In Blender i keyed IK and FK swith with the slider of Rigify, so i can move the hand without sliding. What i'm doing wrong? This is the Blender Rig (Rigify) with the sword bone https://i.gyazo.com/00a1f9f523e67c0371b7f00e48c58ae9.mp4

sentences:
Loading a stream/asset on Android MonoGame without ContentManager In the game I am developing, I have created a serializable class that generates a .map file for saving and loading levels. In XNA, this works great using the following code:

FileStream fileStream = new FileStream(filePath,
                FileMode.OpenOrCreate);
BinaryFormatter formatter = new BinaryFormatter();
MapInfo data = (MapInfo)formatter.Deserialize(fileStream);

Unfortunately, in android it appears that the filePath ends up at the device's root (argument being passed in as "Content/maps").
After some research, I came across this page from xamarin that explains how to properly load assets from the asset folder. However, this action takes place in a separate namespace from my main activity, and so far have not found a way to access the Assets.Open() function.

any other ways to load that asset?

UPDATE:
After playing around some more, I ended up trying to pass the Assets property of the main activity down through function calls, loading the file this way:

Stream fileStream = androidGame.Assets.Open(filePath);
BinaryFormatter formatter = new BinaryFormatter();
MapInfo data = (MapInfo)formatter.Deserialize(fileStream);

SADLY, the file still does not load. Looking at the variables in debug shows the correct address for the activity contained in the variable androidGame, but says Open is an "Unknown member"

UPDATE WITH WORKING SOLUTION:

In case anyone comes across file loading issues in Monogame Android, this is what I ended up doing:

First, make sure you copy/reference your files in the correct dir of your android build. This should appear somewhere under Assets/Content/yourfile.file or subfolder.

Then, check the properties of the file and select "AndroidAsset" for build options and "Copy if newer" for output.

Finally, open the stream using the Assets property of your main activity. This can be accessed using your Microsoft.Xna.Framework.Game class in this way:

Stream fileStream = Game.Activity.Assets.Open(path);

Turns out my issue was not the stream itself, but the deserialization which could not open a .dll in android (overlooked that one...). I ended up switching to XML serialization, since the binary serialization is build dependent

sentences:
Rotating an object towards a target on the Y axis I am attempting to rotate a 3D object on its Y-axis towards a target it is looking at. I have always struggled with rotations so I would like to try to avoid using Unity's built in functions, i.e transform.LookAt() in order to get used to using rotations. Gotta master the basics first, right?

Vector3 currentOrientation = transform.rotation.eulerAngles;
Vector3 directionVector3 = transform.position - target.transform.position;
float angle = Mathf.Atan2(directionVector3.z, directionVector3.x) * Mathf.Rad2Deg;
currentOrientation.y =angle;
transform.rotation = Quaternion.Euler(currentOrientation);

However when I do run this, the character is not looking in the correct direction at all!

Here is a screen shot with the character's parameters

The target object belongs in a hierarchy, where it's position in world space is (150,0,500)

Does atan2 somehow behave differently in 3D space vs 2D space? I ask because I've made 2D games where I would just use atan2(y,x) for a character's rotation.

sentences:
How should a circuit or power system (like redstone in Minecraft) be implemented I want to implement a power-system like the redstone system in minecraft.

I have n power sources and m cables. If I disconnect the power source or a cable the circuit should turn off.

How do I avoid circles?
If each cable with the status "on" powers the nearby cables I can create infinite circles where there is no power source involved (see image). Plus site is that it runs in T=m

I could send power burst through the graph starting at every power source and in each update call I turn every cable off. Problem is it runs in T=n*m.

Is there a best practice? In Minecraft the redstone system was very slow so I think I overlooked something.

EDIT: The system should work without a distance based decay.

sentences:
3D collision-detection middleware (I've split this question into two. For 2D, see: 2D collision-detection middleware)

Are there any recommendable middleware available for 3D collision detection?

I believe I've heard Bullet has a pretty good 3D collision detection that can be used without the physics engine. I'd like to hear if people have any experiences on Bullet or other libraries for 3D collision detection specifically.

sentences:
How to get smooth movement in a low resolution game? I am using monogame to make a simple platformer with a fairly low resolution.

Right now I am struggling to get smooth movement like in the mario games. In those games despite having the low resolution mario can still slowly accelerate from standing still and the movement looks smooth. How did they achieve this?

My current solution performs all of the game's physics and movement in floats and when it comes to drawing the x and y coordinate of the player it is rounded to an int. This results in very jagged looking movement.

Is there any way to improve this so that the movement is smooth and still has acceleration? I was thinking about scaling up all of my assets by 4 and working at a higher resolution but then the player would be able to walk between pixels (as 1 pixel in the assets would be represented by 4 pixels on the screen).

Any help would be much appreciate.

Here is an awful video of my character's movement:https://www.youtube.com/watch?v=riWk8op2VyY

sentences:
Best way of approach? Mob moving around a section of tiles Think the beginning stages of Metroid, where there would be a turtle-like mob that would move around a section of tiles, normally 1-3 in a line.

What would be the best approach to accomplish this sort of AI?

It seems so simple but its giving me headache.

The solution I've found have been to have a fixed distance for it to move, and changing directions once the distance has been met. This isn't that OOP though.

Another would be have a rectangle made of the section of tiles, and when the bounds of the mob no longer contains the line of rectangle, change directions. This is proving to be harder to implement and only works for rectangular sections, not for abstract "tetris" like sections of tiles.

sentences:
Rotating point around another point I can't manage to rotate point around another point.

I did some searching around google and found algorithm that should work and it kinda does but it also moves the point I am rotating closer to pivot point.

Here is whole class where the problem is

public class Player {

float rotation;
Vector2 position;
Vector2 center;

public Player() {
    position = new Vector2(Core.WIDTH / 2 - 10, Core.HEIGHT - 50 - 10);
    center = new Vector2(Core.WIDTH / 2, Core.HEIGHT / 2);
    rotation = 0;
}

public void turnRight() {
    rotation += 0.001;

    position.x = (float) (Math.cos(rotation) * (position.x - center.x) - Math.sin(rotation) * (position.y - center.y) + center.x);
    position.y = (float) (Math.sin(rotation) * (position.x - center.x) + Math.cos(rotation) * (position.y - center.y) + center.y);
}

public void render(ShapeRenderer sr) {
    sr.circle(position.x, position.y, 20);
}

}

sentences:
best way to destroy an gameobject in unity MissingReferenceException: The object of type 'GameObject' has been
  destroyed but you are still trying to access it. Your script should
  either check if it is null or you should not destroy the object.
  grid.objGridSize () (at Assets/scripts/grid.cs:119) grid.hit
  (System.String hitObjString) (at Assets/scripts/grid.cs:109)
  grid.Update () (at Assets/scripts/grid.cs:80)

I'm getting this error and strange results after finding a gameobject, storing it in a new GameObject variable and then destroying it:

void Update () {
    if(Input.GetButtonDown("Fire1")){ // detect left mouse click

        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        Debug.Log("clicked");

        if(Physics.Raycast(ray, out hitObj)){
            if(hitObj.collider != null){

                // send a message to the object that got hit
                hit(hitObj.collider.gameObject.name);
            }
        }
    }
}
public void hit(String hitObjString){

    Debug.Log("I got hit: "+name);

    GameObject hitTile = GameObject.Find(hitObjString);

    if( hitTile.tag == "tile"){

        Destroy(hitTile);
    }
}

sentences:
Non deterministic dice rolls Are there any algorithms out there for non deterministic dice rolls?

For example, I'd like to make a small mini-game: Liars dice. But the biggest issue here is dice rolling. When the cups are turned the result of the dice should be determined by the game rather than physics (if I were using unity for example). How can I ensure that the model behind it provides random results acute to an actual dice role?

sentences:
2d Raycast detection doesn't work I want to check if the position I generated has another object or not.
I do this by using Raycast:

private void RandomOBS()
{
    Vector3 pos = new Vector3(UnityEngine.Random.Range(-8f, 8f), UnityEngine.Random.Range(-4f, 4f), 0);

    while (Physics2D.Raycast(pos, pos).collider)
      pos = new Vector3(UnityEngine.Random.Range(-8f, 8f), UnityEngine.Random.Range(-4f, 4f), 0);
}

The code above doesn't work at all. I tested it with if statement and for some reason it cannot check that position.

private void RandomOBS()
{
    Vector3 pos = new Vector3(UnityEngine.Random.Range(-8f, 8f), UnityEngine.Random.Range(-4f, 4f), 0);

    while (Physics2D.Raycast(transform.position, transform.position).collider)
      pos = new Vector3(UnityEngine.Random.Range(-8f, 8f), UnityEngine.Random.Range(-4f, 4f), 0);
}

However when you check the transform.position instead of the pos, it works? How and why? All the game objects have the correct colliders & stuff.

sentences:
Does destroying object at List element make it null? I'm using a list in Unity and I'm adding objects to it as they are collected through the game. But they will then be used and destroyed. My first question is do I use Destroy(), or should I just use List.Remove()? I'm not sure what happens to an object once it is removed from a list and not used anymore. Does garbage collection get it? My other question is, when I check the list (I will always be checking the first index), if that object was just destroyed or removed, will that element now be null? I've tried reading about this but it's hard to find an exact answer. Thanks for the help.

For reference, here is the code that I came up with based on my current assumptions about lists:

public List<BasePickUp> pickUpQueue = new List<BasePickUp>();
public bool pickUpActive = false;

void Update ()
{
    if (pickUpQueue[0] != null && !pickUpActive)
    {
        pickUpActive = true;
        pickUpQueue[0].ActivatePickUp();
    }
}

Edit: I have been playing with the if statement conditions, and even if I change pickUpActive to true, it somehow still manages to get inside the if statement to the breakpoint there. How is that possible? The condition says pickUpActive must be false, and yet it blows right by it. When I set the first condition to pickUpQueue != null, I get an error for index out of range once, when it is set to check the first element, as it is in the above code, I get an index out of range every frame. I finally changed it to pickUpQueue.Count != 0, and that finally kept it from getting into the if statement. If anyone can help me understand what is going on with my bool, and to understand exactly how to handle this list, I would greatly appreciate it! Thanks!

sentences:
Automated animation retargeting I am currently developing a video game using my own game engine I develop at the same time. While making a good progress in the past months, I am currently stuck. I assume I only miss a minor thing, but I need another pair of eyes and I really hope you can help me!

I wrote a converter which reads FBX files (using the official FBX SDK 2017.0.1) and converts them into my own custom file format. I am able to read meshes, texture and material information, the skeleton and all animation stacks. In my game (engine) I am able to display the textured meshes and animate them with any of the read animation stacks.

However, there is one problem for me. I bought meshes for NPC characters from a 3D artist and I also bought a huge animation pack from another artist. The character meshes include the perfectly textured and rigged mesh with all joints and the animation pack contains a rigged dummy mesh with all joints and animations.

I want to be able to use any animation from the animation pack on any mesh from the character artist.

My first step was to write a joint mapper. When reading the files I know which joint has which type. So, I am able to map the joints from the character mesh to the animation mesh and vice versa. The skeletons of both meshes are pretty similar and the mapping is going to work out.

In the FBX samples the animation calculation for a given vertex is:

Inv(Mesh_GlobalPosition * Mesh_GeometryTransform) * Joint_GlobalPosition * Inv(Joint_TransformLinkMatrix) * Joint_TransformMatrix * Mesh_GeometryTransform

Since Mesh_GeometryTransform is the identity matrix for all files I have bought, I can remove it from the term above. The result is:

Inv(Mesh_GlobalPosition) * Joint_GlobalPosition * Inv(Joint_TransformLinkMatrix) * Joint_TransformMatrix

Joint_GlobalPosition is the transformation in Bone Space and the only matrix that is time-dependent in this equation. Inv(Joint_TransformLinkMatrix) * Joint_TransformMatrix is used to transform the World Space to the Bone Space, as I understood. Finally, Inv(Mesh_GlobalPosition) is used to transform the result back to World Space.

If I understood something wrong, please correct me!!!

The joints which are used for the animation mesh are in a different space than the joints from the character mesh, because they come from different artists. I believe the missing part is to map between the joint spaces of both meshes. However, I do not know where to enter the mapping and I also don't know which spaces do I need to map? Object Space? Bone Space?

I'd appreciate any kind of help and will reward a useable solution with credits in my game!

sentences:
Game AI move towards player while avoiding an obstacle I'm trying to move enemy towards player, while enemy also tries to avoid an obstacle if it's in its path. Here's a simple illustration of what I want to do:

What I've tried:

Making circular collision around the obstacle. It works but that
makes the enemy impossible to hit.
I think going with an A* pathfinding algorithm might be a bit overkill
especially since it's designed for multiple obstacles, where in my
case there is only the mouse and wall collision concerned.
Moving the enemy towards the player, while also moving away from the
obstacle at a slower speed. This works better because you can
actually hit the enemy, but also slows down enemy if obstacle if it's
in its path.

My questions:

Is there a better way to go about doing this?
Anything you would've done differently with my code to either improve or optimize?

Here's the code I have currently in my game logic and a fully-working example on jsFiddle.

// Calculate vector between player and target
var toPlayerX = playerPosX - enemyPosX;
var toPlayerY = playerPosY - enemyPosY;

// Calculate vector between mouse and target
var toMouseX = mousePosX - enemyPosX;
var toMouseY = mousePosY - enemyPosY;

// Calculate distance between player and enemy, mouse and enemy
var toPlayerLength = Math.sqrt(toPlayerX * toPlayerX + toPlayerY * toPlayerY);
var toMouseLength = Math.sqrt(toMouseX * toMouseX + toMouseY * toMouseY);

// Normalize vector player
toPlayerX = toPlayerX / toPlayerLength;
toPlayerY = toPlayerY / toPlayerLength;

// Normalize vector mouse
toMouseX = toMouseX / toMouseLength;
toMouseY = toMouseY / toMouseLength;

// Move enemy torwards player
enemyPosX += toPlayerX * speed;
enemyPosY += toPlayerY * speed;

// Move enemy away from obstacle (a bit slower than towards player)
enemyPosX -= toMouseX * (speed * 0.4);
enemyPosY -= toMouseY * (speed * 0.4);

sentences: I installed Linux Build Support, but I need an archive to build, how can I get this? I`m building a game for Mac, Windows and Linux, I builded the Windows and Mac game, but in Linux, says that need a x86_64 archive, like the image shows, what do I do?

sentences:
What features should a moddable game have to make it easy to mod? One of the objectives I have for a tactical RPG I'm making is moddability. My hope is that anything can be replaced with custom code.

For example: you can replace the combat system I did with, say, rules from other systems, like the combat system in tabeltop RPGs like d20 or Pathfinder (with enough perseverance, coding the whole thing), and just let the game use that, even though I'm not really sure how to go about designing my game to support that.

I don't have much experience with mods, save for trying out a few in Oblivion and Skyrim (*ahem* caliente, ENB mods, etc.).

So, to modders out there, what are the features that's there in easy-to-mod games that you like, that make you think "wow if this didn't exist, making my mod would have been almost impossible". Stuff that just isn't there in games where you have a bad modding experience?

To start off, here are my initial thoughts:

I'm thinking of adding a Lua interpreter in my game, giving various objects in the game script access.
Resources will be saved in text format (in JSON). For example, behaviour trees will be serialized in JSON text files that can be edited. An in-game visual editor will also be provided.
A mod manager for the game will likely be good also (like BOSS in Oblivion).
The idea of "mod packages" for easy distribution.

sentences: My game got stolen, what do I do? I recently released my first game on the Google Play Store (yay!), and a few days later I found my game had been reuploaded to two different shady-looking sites (Softonic and Fibonapps). Needless to say, I did not give either of these sites permission to distribute my game. It is a paid app, so if people download it from these other sites I'm effectively losing money. I sent an email to both about two weeks ago asking them to remove it, I've gotten no response and the listings are still up. How do I proceed from here?

sentences:
Ball Physics : Smoothing the final bounces as the ball comes to rest I've come against another issue in my little bouncing ball game.

My ball is bouncing around fine except for the last moments when it is about to come to rest.  The movement of the ball is smooth for the main part but, towards the end, the ball jerks for a while as it settles on the bottom of the screen.

I can understand why this is happening but I can't seem to smooth it.

I'd be grateful for any advice that can be offered.

My update code is:

public void Update()
    {
        // Apply gravity if we're not already on the ground
        if(Position.Y < GraphicsViewport.Height - Texture.Height)
        {
            Velocity += Physics.Gravity.Force;
        }
        Velocity *= Physics.Air.Resistance;
        Position += Velocity;

        if (Position.X < 0 || Position.X > GraphicsViewport.Width - Texture.Width)
        {
            // We've hit a vertical (side) boundary
            // Apply friction
            Velocity *= Physics.Surfaces.Concrete;

            // Invert velocity
            Velocity.X = -Velocity.X;
            Position.X = Position.X + Velocity.X;
        }

        if (Position.Y < 0 || Position.Y > GraphicsViewport.Height - Texture.Height)
        {
            // We've hit a horizontal boundary
            // Apply friction
            Velocity *= Physics.Surfaces.Grass;

            // Invert Velocity
            Velocity.Y = -Velocity.Y;
            Position.Y = Position.Y + Velocity.Y;
        }
    }

Perhaps I should also point out that Gravity, Resistance Grass and Concrete are all of the type Vector2.

sentences:
My mesh has holes in it. How do I make those invisible faces show? I have a mesh. A perfectly normal mesh, without any artefacts at all.

However, when I import it into Unity, there are holes in it.

After going through my UV mapping and normals, they are all mapped, have no faces with the normals going the wrong way (facing inwards) and have non-transparent textures over each mapped UV face.

Oddly enough, this mesh hasn't been split, despite its poly count and is one whole object, but yet - It has missing polygons. Is there any way to get Unity to recognise these faces?

Also, it is worth noting that these holes happen to be all the tris faces on this model, and are all (mostly) along the UV seames.

Question

How do I make the invisible faces show? What's going on?

sentences:
What should a game have in order to keep humans playing it? In many entertainment professions there suggestions, loose rules, or general frameworks one follows that appeal to humans in one way or another.  For instance, many movies and books follow the monomyth.

In video games I find many types of games that attract people in different ways.  Some are addicted to facebook gem matching games.  Others can't get enough of FPS games.

Once in awhile, though, you find a game that seems to transcend stereotypes and appeals almost immediately to everyone that plays it.  For instance, Plants Versus Zombies seems to have a very, very large demographic of players.  There are other games similar in reach.

I'm curious what books, blogs, etc there are that explore these game types and styles, and tries to suss out one or more popular frameworks/styles that satisfy people, while keeping them coming back for more.

sentences:
Tool for editing sprites contour pixel alpha value I have seen that most games uses sprites that have a transparent contour, that is, the pixels that belongs to the contour of the object in the WxW sprite image is below 255. It is not perfectly opaque, so that when you render it on screen, you avoid aliasing effects.

Is there a tool that automatically loads N .png sprites and process them in order to make their contours semi-transparent?

sentences:
Difference between a normal function and coroutine without yeilding anything I just came across a coroutine in my project, which does few calculation, which could have been done using normal function.There is no loop in that coroutine and contains yield return null; in the last line. Is there any specific reason to use coroutine rather than normal function?

void Init(){
RenderObject();

}

IEnumerator Init(){
RenderObject();
yield return null;
}

EDIT:

Inside the RenderObject function, they are calling another coroutine which has two yield instructions yield return true; and yield return new WaitUntil(() => based on certain condition, calling to server takes place primarily.

sentences:
Multiplayer object interpolation Currently I'm participating in a multiplayer game project as a network developer. Unfortunately, however, I'm facing an interpolation problem which makes game objects look like they are 'jumping/teleporting' sometimes. Images don't look smooth compared to the server even if the client runs at 60 frames per second.

Things about the architecture:

Based on client/server model. server sends regular transform updates at every 33 milliseconds (30fps).
Client receives and stores position updates in a queue. then, plays them from 1 second behind using interpolation between each update.
Before processing the next packet, client calculates the sent time between current and next packet to find out how many milliseconds this interpolation should take. at every frame, it deducts the delta time from the interpolation time. so, if interpolation time reaches a number equal or less than zero, it iterates to the next packet (if the value is less than zero, it means that there is a time fragment. so the client also considers that time fragment for interpolation of the jumped packet at the same frame.)
Client doesn't deal with rigidbody; only position and rotation.

I'm using Unity3D's LERP method from the Vector3 class. Using SLERP didn't solve the problem.

Any ideas? Everything looks great on paper.

sentences:
Bird flight simulation (physics) I tried to search something about bird-like animal flight simulation but it looks like everything is spammed with flappy bird 2D questions.

I want to have in my 3D game bird-like animals with realistic flight, for example we have a scene where player attacked by predator birds and he must attack them with gun. When I say bird-like, I mean that animal has wings.

As I understand I need to apply force to bird object to compensate gravity force, but if I do this strictly, it looks very unnatural. So could someone provide good description or maybe links to good articles about such simulation for 3D game?

sentences:
Section cut through (solid) geometry I'm looking for image based (screen space) technique to render section cuts through arbitrary (solid) geometry. I found and studied image based CSG (Kirsch 05 / OpenCSG) but I found it to be perhaps a bit of a overkill for my case, where all I need is a section plane cut.

Above is a naive implementation using a discard in the fragment shader, but that obviously is not even half-way there as I need to close the gaps. Does anyone know of a technique/hack I could use?

sentences:
How to randomly calculate the necessary velocity changes to reach a x,y,z target? I am working on creating a mini vector graphics ping pong table, as described in this previous post: Trying to use 3D vectors for a 2D ping pong game

Currently, the stage I am at, I am trying to make it so that when the ball exceeds the X bounds of the table, it will reflect backwards and at a new target: a random x,y,z position on the opponent's side of the table.

Trying to use this post as a starting point:
How can I launch a GameObject at a target if I am given everything except for its launch angle?
I have attempted to adapt some of that example code in my program, but I am not quite getting the desired results.

** updated code **

update: function(paceFactor) {
  this.ball.pos3D.x += this.ball.vel.x * paceFactor;
  this.ball.pos3D.y += this.ball.vel.y * paceFactor;
  this.ball.pos3D.z += this.ball.vel.z * paceFactor;
  this.ball.vel.y += this.gravity * paceFactor;

  if (!this.stop && Math.abs(this.ball.pos3D.x) > 15) {
    this.stop = true; // for testing to prevent velocity from getting changed due to bad values returned from velocityForNextTarget()
    var modifier = this.ball.pos3D.x < 0 ? 1 : -1;
    var velocity = this.velocityForNextTarget(modifier);
    this.ball.vel.x += velocity.x;
    this.ball.vel.y += velocity.y;
    this.ball.vel.z += velocity.z;
  }

  if (this.ball.pos3D.y >= 0) {
    this.ball.vel.y *= -1;
    this.ball.pos3D.y -= this.ball.pos3D.y;
  }

  this.convert3Dto2D();
},

velocityForNextTarget: function(modifier) {
  var targetX = 5 * modifier;
  var targetY = 0;
  var targetZ = 0;

  var deltaX = this.ball.pos3D.x - targetX;
  var deltaY = this.ball.pos3D.y - targetY;
  var deltaZ = this.ball.pos3D.z - targetZ;

  var sqrMagnitude = (deltaX * deltaX) + (deltaY * deltaY) + (deltaZ * deltaZ);
  var speed = Math.sqrt((this.ball.pos3D.x * this.ball.pos3D.x) + (this.ball.pos3D.y * this.ball.pos3D.y) + (this.ball.pos3D.z * this.ball.pos3D.z));

  var gSquared = this.gravity * this.gravity;
  var b = speed * speed + (deltaY * this.gravity);
  var discriminant = (b * b) - (gSquared * sqrMagnitude);

  var discRoot = Math.sqrt(discriminant);

  var t = Math.sqrt((b - discRoot) * 2 / gSquared);

  return {
    x: deltaX / t * t / 2,
    y: deltaY / t - this.gravity * t / 2,
    z: deltaZ / t * t / 2,
  };
},

So what I am trying to do is make it so that when the ball reaches the location of a player, it will target the center of the opponent's side of the table, and the ball will move there, and right now this code is making the ball rapidly jump off the screen as soon as it hits the x bounds, and I am not sure what I am doing wrong with the math in velocityForNextTarget()...

I should also mention that gravity is just a constant that I am only adding to my Y velocity so far.  I am not sure if that's "right" ?

sentences:
How can I blend meshes together where they intersect? In a lot of my scenes I have things like this:

and this:

All the places I've circled are places where a prefab overlaps with another one or with the terrain.

Is there any way to make those lines softer/more natural and blend together more?

When I can, I try and hide the lines with trees or other items, but that doesn't work in every case.

I wonder if I can solve this with something like the soft particles effect. Soft particles in Unity help blur the line between a particle system and a rendered mesh. This keeps you from having jarring hard cut offs and straight lines in something that's supposed to be amorphous. (That's as far as my understanding goes) Can I use something like this to blend my prefabs together?

sentences:
What's the 'proper' way to get unit vectors? My apologies if I've misunderstood the term 'unit vector' or misapplied it in concept, but I think that is the term for an object's heading when expressed as [x, y] when x and y are a value between -1 and 1; so if an object were moving 'south' on a computer screen, it would have a unit vector of

[0, 1]

...right?

Anyway, I've been using this concept to move my objects and rotate their images (when needed), but I think the math I'm using to determine the unit vector is... suboptimal.

def set_heading(self, goal):
    """Uses a 'goal' (x, y) to set the object's heading.
    Returns list of 0s and 1s for 'straight' headings.
    Diagonal headings are + and/or - math.sqrt(2)/2.
    """
    vals = [a - b for a, b in zip(goal, self.pos)]
    self.heading = [i / abs(i) if i != 0 else 0 for i in vals]
    if 0 not in self.heading:
        self.heading = [i * (sqrt(2)/2) for i in self.heading]

(If you're not familiar with Python ternary syntax, the second line contains i / abs(i) if i != 0 else 0 which is Python's way of saying x if Condition else y as opposed to the usual Condition? x : else y syntax in other languages. Basically I'm just trying to avoid dividing by zero!)

So as you can see, this method of doing this sort of 'locks' the object into eight directions; if a 0 is not present in the heading, the method assumes that we're traveling diagonally and so multiplies the values by sqrt(2) / 2 to ensure that the object doesn't travel faster than it should when moving diagonally.  In this way I can move the object by simply adding the result of the unit vector times its speed to its current x and y coordinates.

def move(self):
    """Moves the object by changing self.pos."""
    self.pos = [a + (b * self.speed) for a, b in zip(self.pos, self.heading)]

I can't help but feel like the method for getting the unit vector (if that's what it's correctly called) is sophomoric. Especially since it is locked into eight directions - it's fine for the little project I'm working with currently, but I'm not sure of the right method for getting a more precise unit vector. What is the correct method for doing so - and is it more or less performant than the weirdness I have come up with independently?

sentences:
Unity: How to cut a line (or curve) at a specific point and animate it? What would be a good approach to cut a line (or curve) at a specific point (let's say we use the mouse pointer to detect the position of the cut).

The curves you see in the image above, are Bezier curve generated using the LineRenderer and have a PolygonCollider2D attached that covers the entire curve (taking the width set to the LineRenderer into consideration).

Imagine a game like Cut the Rope or Fruit Ninja, where you use the mouse pointer to cut the wires. I already implemented the cut detection algorithm, so I know the point where my wire needs to be cut. I would like to know how can I snap the wire in two and add some sort of animation.

sentences:
Why does the object not move correctly when I press the right mouse button? 2D Game in UNITY C#

I have an object BULLET .

After pressing the left mouse on my object (BULLET), the script allows me to rotate object according to the mouse's direction, in four directions  :

-up right

-down right

-down left

-up left

I would like to add a movement so that the object starts moving in face direction after pressing the right mouse button.

I did it, but the object doesn't move freely in face direction and doesn't bounce off the walls, it just follows the mouse.

But I just want to fire my bullet.

I don't want the object to follow the mouse, just fire in face direction.

You know, like an arrow from a bow.

I press the left mouse button and I start rotate the object - THEN I press the right mouse button and the object flies without stopping in face direction, and began to bounce off the walls.

I show what's wrong on video (link below):
enter link description here

This is my code:

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

    public class TestFollow : MonoBehaviour {

    private Transform _bullet;
    private Vector2 _screenSize;
    private float _interval = 10;
    public Sprite sp1,sp2;
    SpriteRenderer sr;
    bool mouseClicked = false;
    public float moveSpeed = 10f;
    public float speed;
    bool rightClicked = false;

    // Use this for initialization

    void Start ()
    {
        sr = gameObject.GetComponent<SpriteRenderer> ();

        if (sr.sprite == null) // if the sprite on spriteRenderer is null then
            sr.sprite = sp1; // set the sprite to sprite1

        _bullet = transform;
        _screenSize = new Vector2(Screen.width, Screen.height);

    }

    public void Update ()
{

    transform.position = Vector2.Lerp (transform.position, Camera.main.ScreenToWorldPoint (Input.mousePosition), moveSpeed);

    Vector3 difference = Camera.main.ScreenToWorldPoint (Input.mousePosition) - transform.position;
    difference.Normalize ();

    {
        if (Input.GetMouseButtonDown (0)) {
            Debug.Log ("Left Mouse Button was pressed");
            moveSpeed = 0f;
            if (sr.sprite == sp1) { // if the spriteRenderer sprite = sprite1 then change to sprite2
                sr.sprite = sp2;

            }
            mouseClicked = true; //register that the mouse has been clicked and the sprite is changed to sprite2
        }
    }

    if (mouseClicked) {        //checks if sprite has already been changed

        // Check for every 10 frames, reduce _interval if you want to check more often.
        if (Time.frameCount % _interval == 0) {
            // Use debug to learn mouse position, you can disable this if you want.
            Debug.Log (Input.mousePosition);

            // Mouse on Top Right screen
            _bullet.localEulerAngles = Vector3.zero;

            // Mouse on Bottom Right, else Mouse on Bottom Left else Mouse on Top Left
            if (Input.mousePosition.x > _screenSize.x / 2 && Input.mousePosition.y < _screenSize.y / 2)
                _bullet.Rotate (Vector3.forward, -90, Space.Self);
            else if (Input.mousePosition.x < _screenSize.x / 2 && Input.mousePosition.y < _screenSize.y / 2)
                _bullet.Rotate (Vector3.forward, -180, Space.Self);
            else if (Input.mousePosition.x < _screenSize.x / 2 && Input.mousePosition.y > _screenSize.y / 2)
                _bullet.Rotate (Vector3.forward, 90, Space.Self);
        }
    }

    {

        if (Input.GetMouseButton(1)) {
            Debug.Log ("Pressed secondary button.");
            rightClicked = true;
        }
        if(rightClicked)
            _bullet.transform.position += (transform.right + _bullet.transform.up).normalized * speed * Time.deltaTime;

    }
    }
}

PS. I'm sorry if I shouldn't post here, but I'm in a little depression. I'm working on this code for a few days and I can't change anything.

PS 2. sorry for my English. Not English-speaking country.

sentences:
Tetris - Smooth piece drop (c++) So I have coded simple tetris games on the past but I have never done one where the pieces drop smoothly, like for instance Super Tetris 3 on the SNES.I am planning to learn SDL and for such I want to code a Tetris on it.

My questions are two, as follow :

Can you give me some hints as to how to code this?
How hard is to code this compared to make the pieces fall in the easy way?

sentences:
vertex is bending inwards I am trying to draw a picket fence, but the center of the picket vertex looks bent in the middle,

why is the picket bending inwards to the left?

// draw fence pickets
float a;
for (a=-25; a<=25; a+=0.256) {

    glBegin(GL_POLYGON);
    glColor3f(  1,  1,  1 );
    glVertex3f( a,       25, 0 );
    glVertex3f( a+0.128, 25, 0 );
    glVertex3f( a,       25, 1 );
    glVertex3f( a+0.128, 25, 1 );
    glEnd();

}

sentences:
GetContactList stops reporting collisions on welded bodies I have some strange problem with my game which uses Box2D as physics engine and I'm out of ideas on what I can do to solve it.

My game is a class assignment where I need to build a simple game where the main character moves in a 2D environment while square blocks comes from below him. Each time a collision occurs, that block is attached to the character using a weld joint, when three blocks of the same colors are together, they annihilate themselves(an effect similar to Bejeweled). I'm using a recursive function to iterate through all the attached blocks of a given block to see if there are enough blocks for them to be deleted.

I'm using GetContactList function to iterate through the list of contacts to see which blocks are adjacent to each other. The results are quite disappointing, the blocks only get annihilated in few cases. After a lot of debugging, I found the issue, but I still don't know how to solve.

My issue is: after some time, GetContactList STOPS returning contacts (return NULL) to blocks that were already attached for some time. I spent some time reading the Box2D manual as well as some tutorials and still didn't find any clue of what is happening.

Below there's some simplified version of the code that I wrote.

for(int a = 0; a < blocksList.size(); a++)
{
   blocksList[a].BuildConnections();
}

And on BuildConnections

b2ContactEdge* edge = body->GetContactList();
while(edge != NULL)
{
   if (long_check_to_see_if_there's_a_block_nearby)
   {
       // add itself to the list to be anihilated
       globalList.push_back(this);
       //if there's, call BuildConnections again on the adjacent block
       adjacentBody->GetUserData()->BuildConnections;
   }
   edge = edge->next;
}

I know that there's another issue related to circular inclusions, but I fairly sure that this problem isn't causing the problem with the collisions.

You can download my entire code from this page if you'd like http://code.google.com/p/fellz/source/list

sentences: Snapping of irregular images in iphone puzzle app I am working on puzzle app in which i need to snap irregular shapes as they come in contact of one another as i am new to game development so i dont have any idea how to achieve this functionality in my app.Any suggestion would be highly appreciated.

sentences:
Help deciding data structure for spatial partitioning, using only value-types in c# I simply want to implement some sort of grid where I can sort units in an RTS into cells, and then for each unit check to avoid other units and attack other units, in 2d.

My map grid is currently 10 000 x 10 000 cells, with 20+ thousand units. To be specific, my grid is sparse but the units move together in very dense groups of about 300 each (like an ancient army type of formation). So cells will either be extremely dense, or completely empty, no in-between really.

My issue in deciding is that I am using Unity job's system and burst compiler. If you do not know, jobs is a multithreading system, and burst is an LLVM based compiler outputting very fast assembly. The limitations of these systems is you can only use value types. So no classes.

I have looked at using a MultiHashmap, but from what I read this can be very slow because I need to run a hash function for every unit. Then when I want to iterate al units in a cell, this is much slower than iterating an array. Especially, because I will also be checking the 8 neighbour cells for each unit as well. That's a lot of hashing being done. Finally, I have to clear the map every frame. The advantage here is Unity provides a container NativeMultiHashMap which is thread-safe, so I can build and query it in parallel.

I have looked into quad-trees. But quad-tree does not seem suited to multithreading, especially without using references. So if I did this, it would most likely be single threaded.

My question is, are my above statements correct in thought? Is there a faster way to organize my data? If I go with a hashmap, how can I query it most efficiently?

sentences:
Is there any specific reasons to include clearly inferior options in a game? Games contain inferior options
A lot of games that I have played contain some optimal options and some clearly inferior ones. Sometimes, like in Heroes of Might&Magic IV, it could happen due to the limited time the developers had to balance it (e.g. Academy benefits so much more from choosing Gold Golems and then Genies rather than Magi and Naga that there is no reason to go the second way).
Sometimes it happens for no apparent reason
However, it often happens that the developers clearly had enough time to polish the game, didn't go bankrupt after its release etc., but it is still full of "trap" options that sound cool, but are actually inferior to something always available in the same situation, or almost always available in similar situations.
There are just so many examples of such, almost every game has something like that. For example, Age of Wonders I began a successful series thga, but a lot of abilities to be chosen for the heroes are clearly underperforming, and a lot of units have clearly better alternatives on the same levels in the same factions.
It is important that while some very overpowered stuff often gets nerfed (like it also happened in AoW I), the obviously underpowered choices often stay as they are (as it also happened there).
So, I ask: Why do game developers create clearly inferior options in their games and don't rebalance them? Is it intentional? If it can be avoided -- how?

sentences:
Allegro 5 al_draw_text skips characters I'm using Allegro 5.0.8 al_draw_text to draw text on a bitmap (backbuffer). However, I've noticed that the first character of the string is always skipped. Moreover, whenever the same character appears in the string, it is skipped again.

For example:

font = al_load_font(path.c_str(), 100, 0);
std::string str = "01230450678";
al_draw_text(font, color, 100, 100, 0, str.c_str());

Will print "12345678", skipping all occurrences of '0'

I've tried several TTF fonts, which work with other graphic software. I've noticed that this sometimes may or may not happen with the same font, depending only on the text size on screen (font size)

Edit:
I've formatted the code and added the arguments I've used to load the font.

Edit2:
Here is a complete code to replicate this using Allegro 5.0.8.

This code should print "0123045670890", but, instead, it renders the following image:
(Note: I didn't cleared the memory because the error appears before program finishes)

//---------------------------------------------------------------------------

#include <string>

#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_opengl.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_primitives.h>
//---------------------------------------------------------------------------

using namespace std;

//---------------------------------------------------------------------------

int main(int argc, char * argv[])
{
    al_init();
    al_install_keyboard();
    al_init_image_addon();
    al_init_primitives_addon();
    al_init_font_addon();
    al_init_ttf_addon();

    al_set_new_display_flags(ALLEGRO_OPENGL);
    ALLEGRO_DISPLAY * mainWindow= al_create_display(1200, 1000);

    ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
    string file = al_path_cstr(path, '/');
    file = file + "arial.ttf";
    ALLEGRO_FONT * font = al_load_font(file.c_str(), 50, 0);

    al_set_target_bitmap(al_get_backbuffer(mainWindow));
    al_draw_filled_rectangle(0, 0, 1200, 1000, al_map_rgb(0,0,0));

    al_draw_text(font, al_map_rgb(255,0,0), 50, 50, 0, "0123045670890");

    al_save_bitmap("d:\\teste.bmp", al_get_backbuffer(mainWindow));

    al_flip_display();

    al_rest(5.0);

    return 0;
}

sentences:
NavmeshAgent not to turn back Imagine the blue part of this picture is streets and navmesh.
the red object is a car with navmeshAgent.
the green circles are the colliders set as triggered and they are the destination of the car.
when the game starts the car will choose one of them and go to that , after reach that it will choose another one randomly so it means the car will go through all of this forever.
now the problem is sometimes when car reach's one them and choose another since it will choose the closer path to next destination sometimes it will have to turn back which its not realistic and doesn't make sense.

as you can see in this example when reach that point since the middle one is closer from where the car is triggered it will turn back and the red arrow is wrong path ,  instead it should go through the green arrow and that's the correct path.
how can i do something to not to turn back instead find another way?

sentences:
Applying velocity to parent that ignores children's mass not working I am making a VR data visualisation app in Unity and I have a parent with many children (just some primitive cubes) that I can toss around the scene by just setting the parent's rigidbody to the same velocity as my tracked VR controller.
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity(); // how I ref the controller velocity in SteamVR
rb.velocity = controllerVelocity * 2f; // the 2f is just to speed up the velocity

The above code works fine, but the problem is I think the scale of the children objects, which can be adjusted by the player, is affecting the velocity the parent moves at. Or maybe just when the children are very large...the controller velocity is comparatively too slow? Basically I need this to not be the case; I want the parent's rigidbody to move at roughly the same velocity no matter the children's scales/masses.
So to achieve that I thought to use Rigidbody.AddForce but it doesn't seem to be making any difference i.e. larger children are still moving slower. Here is what I have so far:
Rigidbody rb = GetComponent<Rigidbody>();
Vector3 controllerVelocity = Player.instance.rightHand.GetTrackedObjectVelocity();
rb.AddForce(controllerVelocity  * 2f, ForceMode.VelocityChange);

I also tried ForceMode.Acceleration but then nothing moved at all? Am I using AddForce incorrectly? Or do I just need a scaling multiplier based on the size of the children? Any help is welcome.

sentences:
Minecraft modding: onLanded and item type/positioning? My question is about programming Minecraft mods. So i added a block to my Mod. Now I want, that when you drop a sugar on it, that it waits some time and then, if the sugar is still there, it will consume the sugar and spawn an item that i made for my mod. But I don't know how to test wether the item is sugar. I use the event onLanded with an

@Override
public void onLanded(World worldIn, Entity entityIn)
{
    if(entityIn instanceof EntityItem && !worldIn.isRemote)
    {

    }
}                                                                                }

but I don't know where to specify the item and where to get the position of the block.

I hope anyone can help me and sorry for my bad english I'm not a native speaker. Thank you in advance Nova

sentences:
Unity3d texture size different than original png image While selecting a png image as a texture for a material in Unity, it shows different size (bigger) than the actual file size, why is this so?
how can I reduce its effective size to make it perform better without loosing much detail.

Size in windows explorer (825 kb)

and this is same image in Unity texture select window (1.3 MB)

sentences:
Dragging text element into Text variable unity 4.6 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.

sentences:
Smoothly moving an orbiting object back into orbit I have an object that orbits the player's sprite with code that looks like this:

x = player.x + sin(_float) * _radius;
y = player.y + cos(_float) * _radius;
_float += 0.01;

An event can trigger the object to fly away from the player to chase a target. After it hits the target, I would like the object to glide back toward the player and smoothly return to an orbiting path around the player.

Everything I've tried thus far just ends up making it snap to a position abruptly or completely fly away, never to return again.

EDIT: I ended up with a solution that sets the objects velocity to the sin/cos orbit instead of directly setting the x and y coordinates. Thanks for the ideas!

sentences:
Photon Realtime, StripKeysWithNullValues cause heavy GC Alloc In our current project, we use Photon room properties to sync entities. and i noticed some heavy GC Allocs while deep profiling the game and it always ends down to this method.

Have anyone faced this issue before ? or attempted to fix it ? here is the source code of that method.

/// <summary>
        /// This removes all key-value pairs that have a null-reference as value.
        /// Photon properties are removed by setting their value to null.
        /// Changes the original passed IDictionary!
        /// </summary>
        /// <param name="original">The IDictionary to strip of keys with null-values.</param>
        public static void StripKeysWithNullValues(this IDictionary original)
        {
            object[] keys = new object[original.Count];
            original.Keys.CopyTo(keys, 0);

            for (int index = 0; index < keys.Length; index++)
            {
                var key = keys[index];
                if (original[key] == null)
                {
                    original.Remove(key);
                }
            }
        }

sentences:
Attach component of other Object to a variable within Unity Inspector This question might sound a bit stupid and I'm sure there is a simple solution for this .. I'm just not finding it:

Actually all I want to do is attach the MeshRenderer Component of this Object

to a variable of a script on another Object like

Problem: As soon as you click on the Capsule Object ofcourse the Inspector changes to this Object and I cannot drag in a component to the previous selected Object anymore.

I know there are a lot alternatives like linkin only the GameObject e.g. as MeshObject and later in code refer to MeshObject.GetComponent<MeshRenderer> but I wondered if this can be done directly, too.

sentences:
Change flag if mousepress while on loop I have this program that starts a loop when the key is pressed

The problem is that when i start the loop, i want to be able to stop it halfway with my mousepress.

The problem is that it doesn't register my mousepress until my loop is done.

How do I stop it halfway if the mouse was pressed in my loop? I tried  a flag, if(mousePressed) but the flag doesnt change until the loop is done

sentences:
Algo for given an amount of XP, find a character's level In a RPG context, what are the ways to quickly find a character's level, given his XP? There are two cases which I am looking at:

For when a formula is defined, like in the case of D&D, which is N = N*(N-1)*500, where N is the desired level.
When no formula is defined, each level has an amount of XP require which is defined by a table.

I guess the easiest way is to do a for loop and subtracting the XP required for that level from the character's XP pool, till he reaches a point where you can't attain the next level. What other ways are there to, given a character's XP, to find his level?

Edit: The language is PHP

sentences:
Making the camera look at the player while keeping another object in view I'm working on a sorta football game where I need my player to always be at the center of the camera view while keeping the ball into view, without any vertical movement. The idea would be for the camera to act like the picture below.

What I came up with was the following code that I'm using in a LateUpdate. I'm computing a directional vector between the player and the ball and placing my camera behind the player using that data, and then I look at my player.

Vector3 ballPosition = ballTransform.position;
Vector3 playerPosition = playerTransform.position;

ballPosition.y = 0.0f;
playerPosition.y = 0.0f;

Vector3 directionVector = (ballPosition - playerPosition).normalized;
directionVector.y = 0.0f;

Vector3 newPosition = playerTransform.position - directionVector * 12.0f;
newPosition.y = 9.0f;

transform.position = newPosition;

transform.LookAt(playerTransform.position);

The code itself is working, but the camera movement is a bit nauseous, and when I'm trying to smooth it I end up with the ball leaving the camera field most of the time. Plus when I get too close from the ball I end up with some really quick camera movements which makes the whole thing kinda hard to follow. I tried to use a totally different technique by working with a Cinemachine Camera, but there doesn't seem to be an easy way to achieve such a view.

Does anyone have an idea of how to achieve such a thing?

sentences:
Why doesn't my material show up on my imported model (Unity / Blender) UPDATE :

The material does work on smaller objects like a simple sphere, but not on my big arena model, which is actually imported from blender, any suggestions?

UPDATE :

Tried to export as .fbx, but doesn't change anything.

I've imported this material pack : https://www.assetstore.unity3d.com/en/#!/content/13004

I tried to apply it to my mesh, but only weird things happen, I can't see the texture at all. So I tried to apply this material in the "shader calibration scene" and that worked without any problem, even updating to the standard shader worked fine. So I tried to fix it with the following things :

Rebaking lighting
Restarting Unity
Tweaking the material settings
Tweaking quality settings in Unity
Building the project

All these things couldn't fix it, but it should most likely be related to my project settings, since this material is working in another project (shader calibration)

Here are my quality settings :

I'm not sure, which information is needed to answer the question, but I can provide it if you ask for it.

Update with Object properties :

sentences:
How do i make an idle-styled counter in Javascript & HTML I just started making a basic game in HTML, CSS, Javascript, and JQuery, but I want to have the money add up after a certain amount of time (if you have ever played an idle game, you'd know what i mean) but i cant figure this out.

If anyone could help me out, i would appreciate that.

<!DOCTYPE html>

    <link rel='stylesheet' href='style.css' />

Copper Coins: 0

sentences:
How to run DirectX10 on non-compatible hardware? I'm going to be away for a little bit, bringing my netbook with me to do some basic DirectX10 stuff.

How can I run DX10 on DX9.0c hardware?

sentences: How to load sprites manually from a file in unity? We're making a game, in which the User can apply their own textures to the game in order to make their own rooms. Is there a way to make a prefab with sprites, scripts, colliders, etc during runtime? With a script or something?

sentences:
Can't change anchor position and TextureRect size I'm making UI, and want to set anchor to middle of the image, but changing anchor from Layout -> Anchors Only or setting Anchor value directly doesn't work. The value was updated, but anchor point not moved at all. Is it bug or is there are something that I missed?

Here's the node tree:

CanvasLayer

Control

TextureRect <- Anchor is not moving at all

Using Godot 3.1.1.

Also I can't find how to resize texture rect. I can set the min-size, but change size doesn't work, the value immediately set back to original size. How to change the texture rect size?

sentences:
What to do to UV coordinates, when swapping Z/Y coordinates (axis) of the geometry? In my Maxscript exporter I have the ability to flip the Z/Y axis by simply swapping the Z and Y co-ordinates.

When swapping the axis this way, what is the correct thing to do to the UV coordinates? (e.g. do I need to swap the U or V, or invert one or both?)

Thanks!

sentences:
Unity: finding force vector to separate colliders in OnTriggerStay events In Unity, I have Trigger Colliders, and catch the OnTriggerStay(Collider other) events.

Once two Colliders are touching, how do I get the Force vector to make them want to separate again?

In the example below, I have a Sphere and a Box Collider touching. The OnTriggerStay is being called for the Sphere.

I cannot use the center positions of the transforms to get a direction, as that would not give me a very good force vector:

And I do not think I can use the Collider.ClosestPointOnBounds to figure out the Box touch position, because the point I look from (center of Sphere), could be inside the Box Collider itself, which I understand will just return me back the center of the Sphere again. I would not be able to resolve any force vector from that.

sentences:
Dealing with "jumping" sprites: badly centered? Thing is, I've used darkFunction Editor as a way to get all the spriteCoordinates off a spriteSheet for each individual sprite, and parse the .xml it generates inside my game.
It all works fine, except when the sprites are all similarly sized, but when a sprite changes from a small sprite into a big one, such as here:

When from walking from some direction, to attacking, it starts "jumping", appearing glitchy, because it's not staying in the same correct position, only doing so for the right attacking sprite, due to the drawing being made from the lower left part of the rectangle.

I think someone experienced will immediately recognize the problem I mean, if not, when I return home soon, I will shoot a little youtube video demonstrating the issue!

So the question is: what possible solutions are there? I've thought that some sort of individual frame "offset" system might be the answer, or perhaps splitting, in this case, the sprite in 2: the sword, and the character itself, and draw sword according to character's facing, but that might be overly complex.
Another speculation would be that there might be some sort of method in LibGdx, the library I'm using, that allows me to change the drawing center (which I looked for and didn't find), so I could choose from where the drawing starts.

sentences:
What's the name of the "Candy Crush" style of game? I'm currently creating an engine trying to auto-play games with a chess board, and I'm writing a report about it now.

However, I found it hard to properly describe it -- for the games like Candy Crush, which has a game board, filled with "candies," and a few rules.. is there a formal classification for it?

Is "board-game" a proper name? What about "rectangle-tile game", or "chessboard-based game?"

sentences:
libgdx ScissorStack problem Im making a user interface using libgdx
I created a Window class & a Textfield class, that both use clipping.
I use the ScissorStack class of libgdx for clipping.

The Textfield is drawn inside the window class.

Window draw method :

ScissorStack.calculateScissors(camera, batch.getTransformMatrix(), clipBounds, scissors);
ScissorStack.pushScissors(scissors);

//Draw textflied

ScissorStack.popScissors();

Textfield draw method:

clipBounds.setPosition(
            700,
            200
            );

//Draw textfield image

ScissorStack.calculateScissors(camera, batch.getTransformMatrix(), clipBounds, scissors);
ScissorStack.pushScissors(scissors);

//Draw text

ScissorStack.popScissors();

The current problem is on the Textfield class with this code :

clipBounds.setPosition(
            700,
            200
            );

If I remove this code I don't get error.

This is the error :

Exception in thread "LWJGL Application" java.lang.IllegalStateException: Array is empty.
at com.badlogic.gdx.utils.Array.pop(Array.java:292)
at com.badlogic.gdx.scenes.scene2d.utils.ScissorStack.popScissors(ScissorStack.java:77)

I noticed that if I change the value of clipBounds, something I got the error, and sometimes, with some values, I dont get the error.

sentences:
How would I abstract a newtork layer for a Java messaging system, and is it worth it? I'm currently working on an online Java game.I am not an experienced game programmer, having only worked with web applications, so far. Currently, I am building the messaging system between the client and the server, and I came across a big "what if".

Currently, the messaging system uses a custom solution and Java NIO with sockets, but it got me wondering: what if it fails? What if I have to change it all to some other system?

I decided that I should abstract the network layer of my engine, and if someday I need to change it, I'll swap the adapter. Then came two more problems; how would I abstract a network layer, and of course, is it worth the trouble? Will it be a waste of time?

sentences:
Libgdx FPS drop drawing alot of text i'm drawing text above monster head and it's fine. But when there is to many monsters and their name gets render every second cause fps go down. When i disable the font drawing, then the fps is fine. Any idéa how to tackle this perfomence issue?

Thanks.

sentences:
Object automatic create new with old every time when load / save game.? My problem with this DontDestroyOnLoad(cube.gameObject); When I load my player position its create new object with default and saved position respectively. I have a screen shot for better understand.

First scene without save

Second scene with save game.

Here is my code.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine.SceneManagement;
using System.Collections.Generic;

public class Player : MonoBehaviour {

public static float speed;
//public static Player control;
public float moveSpeed = 10f;
public float turnSpeed = 50f;
public Transform cube;
public float x, y, z,x1 ,y1, z1;
public int s;

//public static List<Game> savedGames = new List<Game>();
public static Player Instance;
// Use this for initialization

// Update is called once per frame

void OnTriggerEnter(Collider other) {

    if(other.tag == "Player1"){
        DontDestroyOnLoad(cube.gameObject);
        //DontDestroyOnLoad (other.gameObject);
    }
}

void Awake ()
{

    if (Instance == null) {
        DontDestroyOnLoad (this.gameObject);

    } else {
        DestroyObject(gameObject);
    }
}

public void Start () {
    speed = 50f;
}

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

    if(Input.GetKey(KeyCode.W))
        transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.S))
        transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.A))
        transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.D))
        transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);

    }

public  void Save(){

    //Player.savedGames.Add ();
    BinaryFormatter bf = new BinaryFormatter ();
    FileStream fs = File.Create ("D:/playerinfo3.txt");

    playerData pd = new playerData ();
    PlayerPrefs.SetInt ("currentscenesave",SceneManager.GetActiveScene().buildIndex);

    PlayerPrefs.SetFloat ("cubeposx",cube.position.x);
    PlayerPrefs.SetFloat ("cubeposy",cube.position.y);
    PlayerPrefs.SetFloat ("cubeposz",cube.position.z);
    PlayerPrefs.SetFloat ("cuberotx",cube.eulerAngles.x);
    PlayerPrefs.SetFloat ("cuberoty",cube.eulerAngles.y);
    PlayerPrefs.SetFloat ("cuberotz",cube.eulerAngles.z);

    pd.x = PlayerPrefs.GetFloat ("cubeposx");
    pd.y = PlayerPrefs.GetFloat ("cubeposy");
    pd.z = PlayerPrefs.GetFloat ("cubeposz");
    pd.x1 = PlayerPrefs.GetFloat ("cuberotx");
    pd.y1 = PlayerPrefs.GetFloat ("cuberoty");
    pd.z1 = PlayerPrefs.GetFloat ("cuberotz");
    pd.s = PlayerPrefs.GetInt ("currentscenesave");

    SceneManager.LoadScene (pd.s);
    bf.Serialize (fs,pd);
    fs.Close ();

}

  public void Load(){
    //transform.position = new Vector3 (PlayerPrefs.GetFloat ("cubeposx"), PlayerPrefs.GetFloat ("cubeposy"), PlayerPrefs.GetFloat ("cubeposz"));
    if(File.Exists("D:/playerinfo3.txt"))
    {

        BinaryFormatter bf = new BinaryFormatter ();
        FileStream fs = File.Open ("D:/playerinfo3.txt",FileMode.Open);
        playerData pd = (playerData)bf.Deserialize (fs);
        pd.x  = PlayerPrefs.GetFloat ("cubeposx");
        pd.y = PlayerPrefs.GetFloat ("cubeposy");
        pd.z = PlayerPrefs.GetFloat ("cubeposz");
        pd.x1 = PlayerPrefs.GetFloat ("cuberotx");
        pd.y1 = PlayerPrefs.GetFloat ("cuberoty");
        pd.z1 = PlayerPrefs.GetFloat ("cuberotz");
        fs.Close ();
        SceneManager.LoadScene (PlayerPrefs.GetInt ("currentscenesave"));
        cube.position = new Vector3 (pd.x,pd.y,pd.z);
        cube.rotation = Quaternion.Euler (pd.x1,pd.y1,pd.z1);

        Debug.Log ("currentscenesave"+ " "+ pd.s);
        Debug.Log ("currentscenesave"+ " "+ pd.x);
        Debug.Log ("currentscenesave"+ " "+ pd.y);
        Debug.Log ("currentscenesave"+ " "+ pd.z);
    }

  }

  [Serializable]
  class playerData{

    public float x, y, z;
    public float x1, y1, z1;
    public int s;

 }

}

sentences:
Assign player currentLocation based on array coordinates I wanted to incorporate changing location in an rpg, so I began by creating a class Location and assign every Location to a multi-dimensonal array, like so:

WorldMap[0, 0] = new Location("Majula");

I created two int variables named LocationY and LocationX set to the starting location. Now I got a command handler, when I type "Move South", I update the position with this dead simple code:

LocationY++;

Mind you, this is just for testing purposes, I just like to break a game into many small components that gets added as I get, or know better.

Now when I want to get my current location, I call it like this:

Console.WriteLine("He then headed south, until he arrived at {0}", WorldMap[PlayerLocationY, PlayerLocationX].Name);

That's cool and all, and it works, but I don't like typing too much if I can avoid it, so I wanted to change the call of WorldMap[PlayerLocationY, PlayerLocationX].Name to something more readable like currentLocation.Name.

So I tried this bit of code:

Location currentLocation = WorldMap[PlayerLocationY, PlayerLocationX];

Obviously, I get a NullReferenceException... I'm completely clueless, and I'm sure I'll probably say to myself "duh" when I'll get an answer.

And yeah, still learning, Console still rocks my socks!

sentences:
Generate platforms and move them with same speed I'm building an infinite runner and have to generate pillars on which the player jumps. There's a minimum and maximum value for how much gap can exist between two pillars. In addition to this, i want the pillars to move to the left with increasing velocity. All pillars need to have same velocity.
So, i made a pillarHolder object which would have velocity that increases with time. The instantiated pillars would be made children of this pillarHolder. Code is:

 if ((Vector3.Distance (go.transform.position,transform.position)<25f)) {

                t=rand.Next(13,35);
                t=t/10;
                //Debug.Log(t);
                tempx+=t;

                pos=new Vector2(tempx,-2.22f);

                go=Instantiate(pillar,pos,Quaternion.identity) as GameObject;
                go.GetComponent<Transform>().parent=holder;
            }
holder.GetComponent<Rigidbody2D> ().velocity=new Vector2(-10f,0);

The problem is, the pillarHolder keeps moving in the negative x direction and after a while, the pillars are not positioned properly. The gap between them exceeds the maxGap.
I tried to solve the problem by resetting the pillarHolder's position once it went beyond position.x=-20f. But when it's position resets, child objects are reset too.

Any help please?

sentences:
How do I get the mouse position relative to the window, not the whole screen? I am developing an XNA game. I run it in window mode.

I need to handle mouse events, but when I use the Mouse class from Xna.Framework.Input.Mouse, I get the the mouse position on the whole screen.

I use this code:

MouseState state = Mouse.getState();
Point position   = new Point(state.X,state.Y);

Rectangle hitbox = new Rectangle(180, 410, 14, 14);

if (area.Contains(mousePosition))
{
    //fire event
}

How do I detect the mouse position within the current game window?

sentences:
Gameobject not destroyed OnCollisionEnter I have this GameObject with the tag coin I am trying to destroy when the player collides with it using this code located in a player script attached to the player

    public void OnCollisionEnter(Collision col){
        var hit = col.gameObject;
        if(hit.tag == "Coin"){
            Destroy(hit.gameObject);
        }
    }

However upon collision nothing is happening

sentences:
How does Halo draw projectiles? I am trying to draw projectiles and doing billboarding.  A projectile consists of a bill-boarded "particle" and a "tracer".  When I billboard a projectile, it cannot be seen when the player's viewing direction is parallel to the projectile axis.

How does Halo or other games solve this problem, so that projectiles can be seen from behind.

sentences:
Autonomous robot - moving from 1 object to the next object This question falls in line with my last question: Unity 3D - create autonomous moving robot in house + first person camera movement

What I have

I have a 3D model of a house; a first-person camera with movement through the house; a robot that autonomously moves.

What I want

I want the autonomously moving robot to search the house for certain objects. I have placed 4 guns (same model) in the house.

This is the code I have now. This works for 1 gun; not multiple game objects:

using UnityEngine;
using System.Collections;

public class MoveTo : MonoBehaviour {

public Transform goal;

void Start () {
    NavMeshAgent agent = GetComponent<NavMeshAgent>();
    agent.destination = goal.position;
  }
}

What I want - extra

If possible, I want it to communicate with the person navigating the "game" with the first-person camera. For example, if it finds a gun, I want it to say to the person "playing" the game: I found a gun. If it finds the next one: I found 2 guns; I found 3 guns; etc etc.

For that, I used the following code for the player:

using UnityEngine;
using System.Collections;

public class UGV : MonoBehaviour {

    public Player player; //assign this variable in the inspector, or using another method

    public void CallMethodBInPlayer(){
        if(player != null){
            player.MethodB();
        }
    }

    public void MethodA(){
        //do something (Robot)
    }
}

And the same for the robot (but changed accordingly).

I will be honest with you that I have very little understanding of programming or Unity. I want you to know I've been looking for an answer for many hours but even though the idea might be too complicated for me just yet, I still hope you can (and want) to help me :)

sentences:
How do Nethack frontends work? I have been trying to learn about GUI frontends for Nethack, but I have been unable to determine how do they get the game information (map, inventory, player info, enemy locations, etc) from Nethack? As in, is there some API that allows these frontends to query these information? If so, how are they used?
I have looked up everywhere but unable to find any documentation that describes how to do so.

sentences:
Radiosity using a hemisphere I'm working on a radiosity processor. I'm projecting scene geometry onto a hemisphere at a high order of tessellation during a visibility pass onto a 1024x1024 render target. The problem is that the edges of certain triangles are not being rendered to the item buffer( render target )...so when I test certain edges( or pixels during pixel shader ) for visibility during a reconstruction pass, visible edges are not identified and as a result the pixel for that edge is discarded.

One solution was to increase the resolution of the item buffer( up to 4096x4096 )...this helped and more edges were visible, however, this was not fullproof.

How do I increase visibility?

Here is a screenshot of a scene after radiosity is applied: the seams are edges along a triangle face that were not visible due to the resolution of the item buffer...

fixed the problem by sampling the item buffer w/8 points:

code to convert world space position into normalized device coordinates for uv lookup of item buffer:

// position lookup for item buffer
    Output.Pos3 = mul( Input.Position, mWV );
// projection is handled by normalizing the viewspace position( as i'm rendering to a hemisphere )
    Output.Pos3.xyz = normalize( Output.Pos3.xyz );

// convert to normalized device coordinates( [ -1, 1 ], [ -1, 1 ] -> [ 0, 1 ], [ 0, 1 ] )
    Output.Pos3.xy *= float2( 0.5, -0.5 );
    Output.Pos3.xy += float2( 0.5, 0.5 );

sentences:
Scaling window contents in Pyglet? I'm trying to scale a window's contents so that every pixel displays at a multiple of it's normal size.
Basically I want to achieve larger pixels without scaling each and every individual sprite.
This question is very similar to this one, however that only scales a single sprite. How should I go about this?

sentences:
Platformer Crouching problems I'm trying to implement a crouching system to my 2D platformer. The problem is, I don't want the character to be able to do anything else except jumping when it's crouching. I have many functions but I think posting the movement function here would be enough. When I gain velocity and then press crouch, I skid across the platform, and stop.
First, my crouch function:
private enum State { idle, running, jumping, falling, crouching}

    void Update()
{
    //crouch
    if(Input.GetButton("Crouch"))
        {
        animator.SetInteger("state", 4);
        Crouch();
        }
    else
    {
    boxCol.size = new Vector2(0.5454721f, 1.8065f);
    }
}

 void Crouch()
{
    boxCol.size = new Vector2 (0.6933689f,1.44953f);

}

And here is my movement function. I tried to fix it by adding the if condition on top of it, but when I run and crouch, it slides a lot before stopping. What can I do to fix that? The character already has a physics material with zero friction. I know I can make the velocity zero if the player is crouching but that would just kill the gameplay. I need to add a smooth stopper. I'm not sure how to make a decelerating script and use it in my case.
public void Move()
{
     if(animator.GetInteger("state") != 4)
     {
            float x = Input.GetAxis("Horizontal");
            float moveBy = x * speed;
            rb.velocity = new Vector2(moveBy, rb.velocity.y);
                if (x > 0f)
                {
                transform.localScale = new Vector2(1, 1);
                isRight = 1;
                isLeft = 0;

                }
                else if (x < 0f)
                {
                transform.localScale = new Vector2(-1, 1);
                isLeft = 1;
                isRight = 0;
                }

    }
}

sentences:
Movement with box2d using libgdx I am pretty new to using physics engine and would like to know what is best practice for movement of playercharacters.

Currently I have a class called Hero that has a CircleShape and when the user presses left/right/up/down it gets an linear impulse in the appropiate direction. All this works fine. The problem happens when the player does not produce any input, the shape is going further in the last direction for a long time, but I would like it if the shape stops faster.
The players sees the world top down, so the worlds gravity is set to (0;0).

Maybe the whole idea of using impulses to move the character around is flawed, I would just like to know what works.

sentences:
How to implement cheat proof trading system in a game? I want to make a game where you can trade items you find from the world, the world would be static, so the master server would always know exactly how much items of X there are etc.

What should i take into account when building such a system?

I want to avoid people being able to cheat and filling the game with free items, but at the same time i want it to be as less server dependant as possible, as i cant afford buying thousands of servers just to run their games on them constantly, even if i had the money, i would prefer not make people to rely on my servers so they can be playing it at any time they want at anywhere, but if they want to ensure the validity of the objects he is going to buy from someone, he would have to connect to the master server if he wants to ensure the objects validity.

But how could i know which objects are genuine and which are fake? So i thought i would give each object in the world an unique ID which cannot be guessed. But then again, wouldnt i have to somehow prove that i collected those items with valid actions? And how could i possibly do that without making the server to run my game from the beginning? And how could i prevent someone trading the same item twice etc.

So i thought i could use a Bitcoin system, but i dont know much about it and im not sure would this be an option since there would be a lot of trading, and a lot more "coins" to trade, so the amount of history information might be too much to handle, not to mention i want to prevent people from cheating in any way, for example you cant trade stuff from the other side of the world and magically teleport the items there (assuming you dont own a teleport atm), you would have to move the items across the world, which would take some time. Also im not very excited about the fact that Bitcoins generation will use intense amounts of CPU power, and im not sure would there be enough Bitcoins for everyone to use; everyone should have equal chance of getting items without depending how fast CPU they have, and im not sure how it would work with fractions of items (like 0.1 of money etc).

Any thoughts and ideas appreciated.

sentences: How to know when user has stopped dragging How can we know when user has stopped dragging fingers over screen if user has not removed finger from screen but stopped dragging ?

sentences:
Grab reference to static members or functions that has custom attribute attached I am trying to create a custom attribute that I can attach to either variables or functions, such that I could grab all references somewhere else in code.

Example

[Attribute1]                        //custom attribute
public static int speed = 1;        //dummy variable
[Attribute1]                        //custom attribute
public static int acceleration = 1; //dummy variable
[Attribute2]                        //custom attribute
public static int count = 1;        //dummy variable

[Attribute3]
public static void DummyFunction() {...}

and from somewhere else, be able to do something along the lines of

var allAttributeReferences = GetAllAttributes("Attribute1");
allAttributeReferences[0] = 10;

var allAttributeReferences2 = GetAllAttributes("Attribute2");
foreach (var reference in allAttributeReferences2)
{
    reference = 0;
}

var allAttributeReferences3 = GetAllAttributes("Attribute3")[0];
allAttributeReferences3(); //Assume it is a function, and invoke function.

Is this even remotely possible? Could someone point me in the right direction?

sentences:
Spritesheet per pixel collision XNA So basically I'm using this:

 public bool IntersectPixels(Rectangle rectangleA, Color[] dataA,Rectangle rectangleB, Color[] dataB)
    {
        int top = Math.Max(rectangleA.Top, rectangleB.Top);
        int bottom = Math.Min(rectangleA.Bottom, rectangleB.Bottom);
        int left = Math.Max(rectangleA.Left, rectangleB.Left);
        int right = Math.Min(rectangleA.Right, rectangleB.Right);
        for (int y = top; y < bottom; y++)
        {
            for (int x = left; x < right; x++)
            {
                Color colorA = dataA[(x - rectangleA.Left) + (y - rectangleA.Top) * rectangleA.Width];
                Color colorB = dataB[(x - rectangleB.Left) + (y - rectangleB.Top) * rectangleB.Width];
                if (colorA.A != 0 && colorB.A != 0)
                {
                    return true;
                }
            }
        }
        return false;
    }

In order to detect collision, but I'm unable to figure out how to use it with animated sprites.

This is my animation update method:

public void AnimUpdate(GameTime gameTime)
    {
        if (!animPaused)
        {
            animTimer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            if (animTimer > animInterval)
            {
                currentFrame++;
                animTimer = 0f;
            }
            if (currentFrame > endFrame || endFrame <= currentFrame || currentFrame < startFrame)
            {
                currentFrame = startFrame;
            }
            objRect = new Rectangle(currentFrame * TextureWidth, frameRow * TextureHeight, TextureWidth, TextureHeight);
            origin = new Vector2(objRect.Width / 2, objRect.Height / 2);
        }
    }

Which works with multiple rows and columns.

and how I call the intersect:

    public bool IntersectPixels(Obj me, Vector2 pos, Obj o)
{
Rectangle collisionRect = new Rectangle(me.objRect.X, me.objRect.Y, me.objRect.Width, me.objRect.Height);
                    collisionRect.X += (int)pos.X;
                    collisionRect.Y += (int)pos.Y;
if (IntersectPixels(collisionRect, me.TextureData, o.objRect, o.TextureData))
{
    return true;
}
return false;

}

Now my guess is that I have to update the textureData everytime the frame changes, no?
If so then I already tried it and miserably failed doing so

Any hints, advices?

If you need to see any more of my code just let me know and I'll update the question.

Updated almost functional collisionRect:

collisionRect = new Rectangle((int)me.Position.X, (int)me.Position.Y, me.Texture.Width / (int)((me.frameCount - 1) * me.TextureWidth), me.Texture.Height);

What it does now is "move" the block up 50%, shouldn't be too hard to figure out.

Update:

Alright, so here's a functional collision rectangle(besides the height issue)

collisionRect = new Rectangle((int)me.Position.X, (int)me.Position.Y, me.TextureWidth / (int)me.frameCount - 1, me.TextureHeight);

Now the problem is that it's still not getting the correct color values of the animated sprite.

So it detects properly but the color values are always:

R:0 G:0 B:0 A:0

↑↑↑ disregard that, it's not true after all.

For some reason now the collision area height is only 1 pixel..

sentences: How would I find the SDK folder for Android Studio so I can build my Unity project? So I've been trying to build my unity project for android, but my problem is that I don't know how to find the Android SDK. I have the old developer bundle installed, when it was still the one with eclipse, but this version is not supported by Unity. So, I installed the latest version of Android Studio, the new official Android IDE, but the SDK folder is not in the same place as the rest of the program. How would I find the SDK folder for Android Studio so I can build my Unity project?

sentences: Rotate LWJGL 2 Vector4f by an angle around an axis There is a method in LWJGL 2 to get the rotation Matrix around an axis with a certain angle- Matrix4f.rotate(angle, axis, dest, src). Is there a similar way to rotate a Vector4f around a Vector3f or Vector4f? What can I do to rotate around 2 axes? I am implementing an FPS Camera

sentences:
Where do I store project data in Unity? In Unity the PhysicsManager has project data. It exists across scenes but its data is unique to each project. If it make my own CustomManager, where/how to I store its data so that it's associated with the project, not a particular scene.

Most of the examples show storing data in properties in components on GameObjects but the PhysicsManager is not a component of a GameObject as far as I can tell. I want my custom manager to do whatever PhysicsManager is doing to store its data.

Any examples, pointers, links to articles?

sentences:
How can I use one method and also switch between a coroutine and the main method? Now I'm using two methods, one as StartCoroutine and one not.

What I want to do is to have just one method and when I set the StartCoroutine variable to true or false when the game is running I want it to switch between the coroutine and the main. Is there a simple way to do it with one method and not two, if not, how do I achieve this?

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

public class Grid : MonoBehaviour
{
    public GameObject gridBlock;

    public int worldWidth = 10;
    public int worldHeight = 10;
    public bool StartCoroutine = false;

    public float spawnSpeed = 0;

    void Start()
    {
        if (StartCoroutine)
        {
            StartCoroutine(GenerateGridSC());
        }
        else
        {
            GenerateGrid();
        }
    }

    private void GenerateGrid()
    {
        for (int x = 0; x < worldWidth; x++)
        {
            for (int z = 0; z < worldHeight; z++)
            {
                GameObject block = Instantiate(gridBlock, Vector3.zero, gridBlock.transform.rotation) as GameObject;
                block.transform.parent = transform;
                block.transform.name = "Block";
                block.transform.tag = "Block";
                block.transform.localPosition = new Vector3(x, 0, z);
            }
        }
    }

    IEnumerator GenerateGridSC()
    {
        for (int x = 0; x < worldWidth; x++)
        {
            yield return new WaitForSeconds(spawnSpeed);

            for (int z = 0; z < worldHeight; z++)
            {
                yield return new WaitForSeconds(spawnSpeed);

                GameObject block = Instantiate(gridBlock, Vector3.zero, gridBlock.transform.rotation) as GameObject;
                block.transform.parent = transform;
                block.transform.name = "Block";
                block.transform.tag = "Block";
                block.transform.localPosition = new Vector3(x, 0, z);
            }
        }
    }
}

sentences:
player movements aren't working python #from pygame.locals import
import pygame
import math
from time import sleep
import display_world

# class Player(pygame.sprite.Sprite):
class Player():
    x = 10
    y = 500
    speed = 10

    # stores if the player is jumping
    isjump = 0

    # force(v) up and mass m.
    v = 8
    m = 2

    def moveRight(self):
        self.x = self.x + self.speed
        # moving right

    def moveLeft(self):
        self.x = self.x - self.speed
            #moving left

    def jump(self):
        self.isjump = 1

    # Jumping
    def update(self):
        if self.isjump:
            # Calculate force(F).
            if self.v > 0:
                F = (0.5 * self.m * (self.v*self.v))
            else: F = -(0.5 * self.m * (self.v*self.v))

        # Change position
            self.y = self.y + self.y

        # Change velocity
            self.v = self.v - 1

        # If ground is reached
        if self.y >= 500:
            self.y = 500
            self.isjump = 0
            self.v = 8

class App:
    windowWidth = 800
    windowHeight = 600
    player = 0

    def __init(self):
        self._running = True
        self._display_surf = None
        self.image_surf = None
        self.player = ()

    def on_init(self):
        pygame.init()
        self.display_surf = pygame.display.set_mode((self.windowWidth, self. windowHeight), pygame.HWSURFACE)

        pygame.display.set_caption('MY FIRST GAME')
        self.running = True
        self._image_surf = pygame.image.load('small_mario.png').convert()

    def on_event(self, event):
        if event.type == QUIT:
            self._running = False

    def on_loop(self):
        pass

    def on_render(self):
        self._display_surf.fill((0,0,0))
        self._display_surf.blit(self._image_surf, (self.x, self.y))
        self.player.updatepygame.display.flip()
        sleep(0.03)

    def on_cleanup(self):
        pygame.quit()

    def on_execute(self):
        if self.on_init() == False:
            self._running = False

        while(self._running):
            pygame.event.pump()
            keys = pygame.key.get_pressed()

            if (keys[K_RIGHT]):
                self.player.moveRight()

            if (keys[K_LEFT]):
                self.player.moveRight

            if (keys[K_UP]):
                self.player.jump()

            if (keys[K_ESCAPE]):
                self._running = False

            self.on_loop()
            self.on_render()
        self.on_cleanup()

sentences:
Command Shell text adventure - input methods for scrolling through text (lua) I'm writing a simple text-based adventure in lua. The intent is the user clicks on the game.exe and it loads up the command prompt or whatever command shell they have and they play the game there.

A problem I'm having is I often want to display a small amount of text at a time so the ui isn't overflowing with chunks of words. So I'm requiring the user to input something, preferably enter, to scroll through to the next bit of text.

i.e.

print("I want you to go to the park for a bit to start out.")
io.read()
print("After a few minutes I'll contact you, can you do that? (yes/no)")
confirm=io.read()

I've been using a blank io.read() which will ask for user input and allow them to type characters and require them to hit enter, but not save what they wrote if anything. The intent is for the user not to write anything though and just hit enter, and only to write when they are given choices in brackets as seen in the second half. I feel like this is confusing and unintuitive, I was wondering if there was a simple better method. I see there are better languages for writing text based adventures, but I want to just stick to lua atm. If there is advice from another language, I can try and translate it over although you'd probably have a better idea of how. Examples are appreciated if there is a lua solution.  Ideally I'd want to prevent input outside of pressing enter to scroll through text, or a timer so the next bit of text displays with some delay if that's possible for a simple windows shell like command prompt.

sentences:
Gamemaker multiplayer using 39dll I am making a gamemaker multiplayer game using 39dll's tcp sockets. As I want to host the server (and my javascript knowledge is a lot better), I use node.js for the server. I have already got gamemaker to connect to the server and send data, but now I have a problem with receiving data. After reading a lot, it seems that I need to do that like so: sock=tcpaccept(global.tcpConnection,1);. If sock is a negative number, the creation of the 'listening' interface failed. It returns me the number -10022. I can not find much information about it, so if anyone knows why this problem occurs and how to fix it would be very nice.

I am just making a normal gamemaker 8.1 game, no HTML5 game (I'd rather script that myself, not with gamemaker as I am really disliking it).

My server code:

var net = require('net');
var server = net.createServer(function(socket){
    console.log('connection made');
    socket.on('data', function(d){
        console.log(d.toString());
        socket.write(d.toString());
    });
    socket.on('error', function(e){console.log(e)});
    socket.on('close', function(){console.log('Socket closed');});
    socket.write('hhhaaannbikbkm');
}).listen(process.env.VCAP_APP_PORT||8080);

GML code (in the game start event):

dllinit(0,true,true);
global.username = get_string("Gebruikersnaam:","");
global.serverip = get_string("Server IP:","127.0.0.1");
global.serverport = get_integer('port', 8080);

global.tcpConnection = tcpconnect(global.serverip, global.serverport, 1);
setformat(2, '<!SEP!>');
if(!tcpconnected(global.tcpConnection)){
    show_message("Connection failed");
    game_end();
} else {
    setnagle(global.tcpConnection,1);
    clearbuffer();
    writestring(global.username, false);
    sendmessage(global.tcpConnection, 1, 1);
    while(true){
        var sock, size, cnt;
        sock=tcpaccept(global.tcpConnection,1);
        show_message(sock);
        //if (sock <=0) break;
        setsync(sock,0);//block untill new package
        size = receivemessage(sock, 0);
        show_message(size);
        //setsync(sock,1);//unblock socket
        cnt = readstring(0, '<!SEP!>');
        if(cnt!=''){
            show_message(cnt);
            clearbuffer();
            writestring(cnt, false);
            sendmessage(global.tcpConnection, 1, 1);
        }
    }
}

sentences:
2D Tile-based Collision Detection I've been planning an indie game project for a while now. I'll summarise it for you so I can get right to the question.

It's done entirely using the latest version of XNA through Visual Studio. Hoping to put it on 360 and PC, but am only really looking for a PC-oriented solution at this stage.

It's a 2D side-scrolling shooter (think Metroidvania-style, or even Terraria). It will eventually include an in-game map editor with maps being tile-based (16x16). There will be upwards and downwards scrolling. I'm hoping to implement tile layers in the dev map editor (reason for a dev map editor is it's going to be heavily leaning towards a content-focus, so there will be a lot of maps).

Physical tiles will be very simple with only two major types. Block tiles, which are just a solid tile, and angled tiles, which are tiles with an incline that characters can walk on. I'm strongly considering abandoning angled tiles entirely, but not sure yet.

The character/NPC movement will be simple. Moving side-to-side, jumping, falling, flying (with appropriate items/situations), teleporting. All very static, no dynamic physics necessary. Only basic gravity. When a character steps off the edge of a tile, it falls. When it jumps and a tile is above it, it stops short and falls back down. When it reaches a protruding tile/wall, it can't move further unless it jumps over or flies. All the basic stuff.

Projectiles can be affected by gravity as well, and some situations may arise where a projectile may be manipulated mid-flight, but nothing requiring heavy physics. Some projectiles will move characters as well (think a simple "pushing" mechanic).

So here's the question: I'm at the stage where I'm starting to work on movement and collision-detection but I just can't set myself on a way to go about them. I need ways to determine when character, tiles, and projectiles collide. Given what I've said about the style I'm going for and the tile-based system I'm using, can I get some recommendations+links to some tried and true collision detection methods others have used in similar situations, and maybe an example of a game using a similar approach? What I need more than anything else is inspiration.

And just a quick note, I have several years of experience as a programmer, so I'm not a total newbie :)

sentences:
2D physics on game object made up of components Say you want to let your users create a 2D airship (side view) made up of components. One component could be a floating balloon, another could be a storage room, etc.

And say you want this airship to have physics applied to it as a whole, with each component playing a part in this. For example, balloons would take away from its down force and other compartments would apply down force to it.

At the same time, the whole airship works as a whole (or at least the only physical separation would be between floater components and the others, which apply weight), so physics are applied to it as if it was one body.

Now, how can this be managed? How can I customize a game object via a script, giving it different components with different weights, and have it behave like it was a single premade object?

I'm sorry if the question is simple, but I'm only getting started with unity. Thank you very much!

TL;DR: Customizable airship gameobject with different components that have different weights. How to make it behave as a single physics entity and manage its different components?

sentences:
Camera Rolling when Implementing Pitch and Yaw I am implementing a camera in opengl for an android game and am having problems getting the pitch/yaw/roll of the camera correct. I have read many tutorials on quaternions and have implemented a basic camera based on this link.

Everything works well except for when I pitch and yaw I get unwanted roll. I have read things that say I need to apply the pitch/yaw rotation together to prevent this, and other things that said not to track individual changes to angles, but I'm not sure what they mean or how to extend this implementation to mine. I am new to this type of math so any help would be appreciated.

My goal is to have a camera that can rotate similar to how a space ship would rotate - I want the camera to be able to rotate 360 degrees in all directions and turn upside-down - which is why I was rotating the upVector too.

Any suggestions on what I can do to not have the camera roll when rotating around the y and y axes?

Thanks!

Here is the code that translates user input into two angles, and rotates the lookVector, upVector, and rightVector of the camera. My problem is the camera is also rolling when I just pitch and yaw.

// Java
// Camera uses a position vector, lookAt vector, and upVector
// eventually calls Matrix.setLookAtM()

Camera c = mRenderer.theCamera;

// PVector is a class that implements a 3 dimensional vector

float thetaX = getTouchChange(...); // set by the user touching the screen
float thetaY = getTouchChange(...); // set by the user touching the screen

// I keep 3 vectors in the camera class, one points up, one points right,
// and the 3rd is the point I am looking at

///////////////////////////////////////////////
// Pitch - rotate the up and look around right
///////////////////////////////////////////////
// get up and look vectors
PVector lookVector = PVector.sub(c.getLookAtPoint(), c.getLocation());
PVector otherVector = c.getUpDirection();
// get axis
PVector rAxis = c.getRightDirection();
rAxis.normalize();
// rotate look
PVector rotated = Quaternion.rotateVector(lookVector, rAxis, thetaY);
// Add back camera location to convert vector to actual look points
rotated.add(mRenderer.theCamera.getLocation());
c.setLookAtPoint(rotated);
// rotate up
rotated = Quaternion.rotateVector(otherVector, rAxis, thetaY);
rotated.normalize();
c.setUpDirection(rotated);

///////////////////////////////////////////////
// Yaw - rotate the look and right around up
///////////////////////////////////////////////
// get up and look vectors
lookVector = PVector.sub(c.getLookAtPoint(), c.getLocation());
otherVector = c.getRightDirection();
// get axis
rAxis = c.getUpDirection();
rAxis.normalize();
// rotate look
rotated = Quaternion.rotateVector(lookVector, rAxis, thetaX);
// Add back camera location to convert vector to actual look points
rotated.add(mRenderer.theCamera.getLocation());
c.setLookAtPoint(rotated);
// rotate right
rotated = Quaternion.rotateVector(otherVector, rAxis, thetaX);
rotated.normalize();
c.setRightDirection(rotated);

In my rendering code I update the camera orientation by calling the following

// called in onSurfaceChanged
Matrix.frustumM(m3DProjectionMatrix, 0, -screenRatio, screenRatio, -1, 1, 1, 70);

// called in onDrawFrame
Matrix.setLookAtM(m3DViewMatrix, 0,
    theCamera.getLocation().x, theCamera.getLocation().y, theCamera.getLocation().z,
    theCamera.getLookAtPoint().x, theCamera.getLookAtPoint().y, theCamera.getLookAtPoint().z,
    theCamera.getUpDirection().x, theCamera.getUpDirection().y, theCamera.getUpDirection().z);

Matrix.multiplyMM(m3DMVPMatrix, 0, m3DProjectionMatrix, 0, m3DViewMatrix, 0);

// m3DMVPMatrix is eventually passed to the shader along with the shape data

sentences:
How to make an object move outside the map and appear on the other side with a tilemap? I have a tilemap where a character moves from tile to tile. I'm trying to make it possible for the character to move outside the screen and reappear on the other side, just like the tunnel in Pacman.

The movement works like following:

Look for which arrow key is being pressed.
Check if the tile where the user wants to go to is walkable. If not, go back to 1.
If walkable, set it as target and start moving towards the tile.
When arrived to the target, go back to 1.

The problem I have is that there're no tiles outside the screen. I've tried to set the target to the tile on the other side of the map if the target doesn't exist, but then the character would move across the whole screen.

I've tried a couple other solutions that either don't work or require lots of additional code in many different files.

Does anyone know a good solution or recommend another approach?

I'm programming in Python with Pygame but know other languages in general. Here's MVCE code for my class:

import pygame
import math

TILE_SIZE = (16, 16)

class Player(pygame.sprite.Sprite):

    def __init__(self, pos, size):
        super().__init__()
        self.rect = pygame.Rect(pos, size)  # Rectangle representing the character's pos.
        self.image = pygame.Surface(size)
        self.position = pos  # In order to have the position in float precision, (x, y).
        self.speed = 80  # Pixels per second
        self.tile_index = (pos[1] // TILE_SIZE[1], pos[0] // TILE_SIZE[0])  # (Row, column).
        self.moving = False
        self.target = self.rect

    def handle_events(self, level):
        key = pygame.key.get_pressed()
        if key[pygame.K_w] or key[pygame.K_UP]:
            self.set_target(level, y_offset=-1)
        elif key[pygame.K_s] or key[pygame.K_DOWN]:
            self.set_target(level, y_offset=1)
        elif key[pygame.K_a] or key[pygame.K_LEFT]:
            self.set_target(level, x_offset=-1)
        elif key[pygame.K_d] or key[pygame.K_RIGHT]:
            self.set_target(level, x_offset=1)

    def set_target(self, level, x_offset=0, y_offset=0):
        tile = level.get_tile(self.tile_index, x_offset, y_offset)
        if tile.is_walkable:
            self.target = tile.rect
            self.moving = True

    def move(self, dt):
        distance_x = self.target.x - self.rect.x
        distance_y = self.target.y - self.rect.y
        # Make sure the player move at 'speed * dt' or distance, depending on the smallest.
        x = math.copysign(min(abs(distance_x), self.speed * dt), distance_x)
        y = math.copysign(min(abs(distance_y), self.speed * dt), distance_y)
        self.position = (self.position[0] + x, self.position[1] + y)
        self.rect.topleft = self.position

    def stop_if_arrived(self):
        if self.rect.contains(self.target):
            self.moving = False
            self.tile_index = self.target.y // TILE_SIZE[1], self.target.x // TILE_SIZE[0]

    def update(self, level, dt, *ignore):
        if not self.moving:
            self.handle_events(level)
        else:
            self.move(dt)
            self.stop_if_arrived()

sentences:
C++ read access violation when deleting object In my game, I've created (likely a very bad) Entity Manager that handles all entities in my game. It will assign random ID's to these entities and then add them to a map:

player = new Player(entityManager);
player->SetPosition(S2D::Vector2(50, 250));
entityManager->AddEntity(player);

//Adds entites to a list and assigns a random ID to them
void EntityManager::AddEntity(Entity* entity)
{
    int ID = rand();
    for(int i = 0; i < IDS.size(); i++)
    {
        if(IDS[i] == ID)
        {
            ID = rand();
            i = 0;
        }
        else
        {
            break;
        }
    }

    entity->SetID(ID);
    entities.insert(pair<int, Entity*>(ID, entity));
}

Each of these entities has a Update and Render function that is ran by the Entity Manager through it's Update and Render functions which are called by the Game Loop:

void EntityManager::Update(float deltaTime)
{
    if(!entities.empty())
    {
        //Removes entities that need to be deleted
        for(int i = 0; i < toDeleteEntities.size(); i++)
        {
            RemoveEntity(toDeleteEntities[i]);
            toDeleteEntities.erase(toDeleteEntities.begin() + i);
        }

    //Runs the Update function of all entities and adds Entites that need to be deleted to a list
        for(const auto entity : entities)
        {
            if(entity.second->ShouldDestroy())
            {
                toDeleteEntities.push_back(entity.second);
            }

            entity.second->Update(deltaTime);
        }
    }
}

void EntityManager::Render()
{
    if(!entities.empty())
    {
        for(const auto entity : entities)
        {
            entity.second->Render();
        }
    }
}

As well as looping through each entity, the Update function also loops through a vector called "toDeleteEntities" which contains entities that are to be deleted. Each Entity has a boolean called "Destroy" and if it's set to true, the Update function in the Entity Manager will add that entity to the vector.

//Runs the Update function of all entities and adds Entites that need to be deleted to a list
    for(const auto entity : entities)
    {
        if(entity.second->ShouldDestroy())
        {
            toDeleteEntities.push_back(entity.second);
        }

        entity.second->Update(deltaTime);
    }

Then before that for loop, the Update function will run this for loop that will remove each entity from the "toDeleteEntities" vector and then pass it onto another function that will delete it:

//Removes entities that need to be deleted
    for(int i = 0; i < toDeleteEntities.size(); i++)
    {
        RemoveEntity(toDeleteEntities[i]);
        toDeleteEntities.erase(toDeleteEntities.begin() + i);
    }

That delete function is this:

//Removes an Entity from the Game
void EntityManager::RemoveEntity(Entity* entity)
{
    if(entity->GetID() == -572662307)
    {
        return;
    }

    entities.erase(entity->GetID());
    delete entity;
}

The if Statement is there because of a previous error I had where I believe the for loop would pass the same entity to the delete function twice resulting in it trying to delete a already deleted object. I know it would be better to fix the error but truthfully it's easier to just do that XD.

Anyway hopefully that's enough context, if you need anymore then just ask. So all of this seems to work correctly somewhat with this Gem entity I have, it runs correctly and gets deleted without problems. But I've noticed when I attempt to add new entities and try and delete them, I get this _Pnext error:

And I just can't figure out why. It seems to be coming from this loop here in the xutility class:

Does anyone know why this error is happening?

EDIT
Screenshot of the Call Stack:

sentences:
how to predict where a ball will land? For a game of table tennis, the goal is that when the player hits the ball, the opponent (the computer) will move to the position where the ball will land in order to hit it back to the player.

Said another way, given a ball in 3D space with an XYZ vector for its velocity, how can I calculate an XYZ velocity vector that will result in the position of the computer player being approximately where the ball will land?

For my coordinate system is, Y is up/down, Z is left and right of the table, and X is forward backward (toward or away from the table)...  So, I know I can simply just set the player's z velocity to match the ball's z velocity to match the direction, but I need to know how to find the appropriate X velocity so that the player will move backward / forward depending on how fast the ball is traveling + taking into account the height of the ball + gravity, etc.

UPDATE

Seeing that the initial ball height is different than the table and the floor, I did some research and learned that the quadratic formula was the best way to solve this problem...

serveToTable = (-ball.vel.y + Math.sqrt((ball.vel.y * ball.vel.y) - (4 * (gravity * 0.5) * (tableY - ball.pos.y)))) / gravity;
tableToFloor = (-ball.vel.y + Math.sqrt((ball.vel.y * ball.vel.y) - (4 * (gravity * 0.5) * (floorY - ball.pos.y)))) / gravity;
duration = serveToTable + tableToFloor;
player.pos.x = ball.pos.x + (ball.vel.x * duration);
player.pos.z = ball.pos.z + (ball.vel.z * duration);

This, kind of works..  But it seems the player will go to the ball 2-4 times and then miss the ball.  Sometimes by quite a lot.

sentences:
Unity how to have a ghost 3d game object I want to have a 3d game object (player) who converts to ghost.

That means that the user must not collide with other players, but must not pass walls, trees, and must take care about terrain height levels (I mean, I can't put it as kinematic and remove the collider because the Vector3.MoveTowards which moves the player will ignore the height dimension and will pass the mountains, etc)

My was thinking about tagging the players and in some way try to skip the collider between them.

Any idea? Thanks

sentences:
in/out keywords in GLSL I don't really understand how to use the in / out keywords in GLSL, and google is being uncharacteristically unhelpful.

What exactly do they do? How would I use them if, for example, I want to pass a varying variable set per vertex to the fragment shader?

Literally every tutorial I find uses the varying / attribute keywords and that's not helpful.

sentences:
XNA 3D Unable to Position Bounding Sphere I have a collision method that seems like it would work, and it does, but the bounding sphere is always at 0, 0, 0. How do I fix this? Any more code and or details are available upon request.
BoundingSphere CreateBoundingSphereForModel(Model model, Matrix worldMatrix)
{
    Matrix[] boneTransforms = new Matrix[this.model.Bones.Count];
    this.model.CopyAbsoluteBoneTransformsTo(boneTransforms);

    BoundingSphere boundingSphere = new BoundingSphere();
    BoundingSphere meshSphere;

    for (int i = 0; i < model.Meshes.Count; i++)
    {
        meshSphere = model.Meshes[i].BoundingSphere.Transform(boneTransforms[i]);
        boundingSphere = BoundingSphere.CreateMerged(boundingSphere, meshSphere);
}
return boundingSphere.Transform(worldMatrix);
}

bool IsCollision2(Model model1, Matrix world1, Model model2, Matrix world2)
{
    BoundingSphere bs1 = CreateBoundingSphereForModel(model1, world1);
    BoundingSphere bs2 = CreateBoundingSphereForModel(model2, world2);

if (bs1.Intersects(bs2))
    return true;

return false;
}

private bool checkPlayerCollision(Model model1, Matrix world1)
{
    //Make player location matrix
    Vector3 playloc = new Vector3(X, Y, Z);
    //Make ship1 matrix
    Matrix ship1WorldMatrix = Matrix.CreateTranslation(ship1loc) * Matrix.CreateScale(0.1f);
//Make ship2 matrix
Matrix ship2WorldMatrix = Matrix.CreateTranslation(ship2loc) * Matrix.CreateScale(0.1f);
//Check for collision with ship1
if (IsCollision2(model1, world1, model, ship1WorldMatrix)) return true;
//Check for collision with ship2
if (IsCollision2(model1, world1, model, ship2WorldMatrix)) return true;
return false;
}

sentences:
Problem with 2d rotation in OpenGL I have a function to perform sprite rotation :

void Sprite::rotateSprite(float angle){
    //Making an array of vertices - 6 for 2 triangles

    Vector2<gamePos> halfDims(_rect.w / 2, _rect.h /2);

    Vector2<gamePos> bl(-halfDims.x,-halfDims.y);
    Vector2<gamePos> tl(-halfDims.x,halfDims.y);
    Vector2<gamePos> br(halfDims.x,-halfDims.y);
    Vector2<gamePos> tr(halfDims.x,halfDims.y);

    bl = rotatePoint(bl,angle) + halfDims;
    br = rotatePoint(br,angle) + halfDims;
    tl = rotatePoint(tl,angle) + halfDims;
    tr = rotatePoint(tr,angle) + halfDims;

    /**
        1st triangle
    **/

    //Top right
    _dataPointer.vertices[0].setPosition(_rect.x+tr.x,_rect.y+tr.y);

    //Top left
    _dataPointer.vertices[1].setPosition(_rect.x+tl.x,_rect.y+tl.y);

    //Bottom left
    _dataPointer.vertices[2].setPosition(_rect.x+bl.x,_rect.y+bl.y);

    /**
        2nd triangle
    **/

    //Bottom left
    _dataPointer.vertices[3].setPosition(_rect.x+bl.x,_rect.y+bl.y);

    //Bottom right
    _dataPointer.vertices[4].setPosition(_rect.x+br.x,_rect.y+br.y);

    //Top right
    _dataPointer.vertices[5].setPosition(_rect.x+tr.x,_rect.y+tr.y);
}

Vector2<gamePos> Sprite::rotatePoint(Vector2<gamePos> pos, float& angle){

    Vector2<gamePos> newv;

    newv.x = pos.x * cos(angle) - pos.y * sin(angle);
    newv.y = pos.y * cos(angle) + pos.x * sin(angle);

    return newv;
}

And the result is

Am i doing something wrong ? It happens also when i put small angle (even if i put here angle 1 )

Thanks for help.

sentences:
Why would an ambient occlusion (AO) shader's performance be dependent on light direction? One of my favourite games recently implemented ambient occlusion as a graphics feature, which appears to perform very well in most circumstances - except during sunrise and sunset. As someone who is getting into shader programming, I'm intrigued by this.

My understanding of AO is that you precompute the diffuse shading for a range of incident vectors, then use that information to produce a correct shadowing scale for real-time use by enumerating over all the lights and computing how their position in relation to the object compares to each of the incident vectors, essentially interpolating across the closest values. Since the occlusion is pre-computed against a model, taking complex shapes and self-occlusion into account, you don't need to raytrace and the performance is much better.

So here's where I get lost - since the diffuse map is precomputed, and you're just comparing light positions to those maps for all objects within the screen space, why would performance suffer for cases where the ambient light (the sun) is close to the horizon? It seems like this shouldn't matter - surely the performance of such a shader scales against vertices, not the angle of the light?

The game uses the latest version of Unity (they just bumped up a minor release) but I don't know if they use the built-in Unity SSAO shader. Performance hit is major - 28fps at 1440p during "day" hours, dropping to 12-14fps during sunrise/set. This only occurs when AO is enabled.

I'm not interested in finding a solution - I'm sure they'll fix it sooner or later - I'd just like to get a better idea of how AO performance scales, what its pain-points are, and why this kind of behaviour might appear.

sentences:
Why does my game not update unless I'm moving the mouse? I'm pretty confused by what's happening. Now that I've finally put something moving on my screen, I notice it doesn't update unless I move the mouse, or press a key, or trigger other events.

Using PIX, the "Frame: #" counter only goes up when I fire these events. This is all that happens in my game loop:

while(GetMessage(&msg, NULL, 0, 0) > 0 && m_isRunning)
{
        TranslateMessage(&msg);
        DispatchMessage(&msg);

        m_gameGraphics->BeginRender();
        m_gameGraphics->EndRender();
}

BeginRender clears the screen, and EndRender presents to the swap chain. I thought maybe it was a problem with WndProc, but comparing it to other DirectX 11 game WndProcs, I don't see any major differences. I'm pretty confused, never seen this problem before, and I have no idea what causes it. I'm just hoping maybe someone will have some insight on why this might be happening.

sentences:
What is a game mechanic? I am trying to understand exactly what defines a game mechanic, and whether it is the same as a gameplay mechanic. There are many different sources online that try to define this but they appear to be quite inconsistent. Two that go into quite a bit of depth are below:
https://en.wikipedia.org/wiki/Game_mechanics (game context)

https://badgeville.com/wiki/Game_Mechanics (gamification context)

I understand the concepts of objectives, challenges and rules in a game, but exactly how do game mechanics tie into these? For example, are game mechanics simply abstract ways of motivating users (eg. points, achievements, discovery etc)? Or are they more practical aspects of a game such as a cover system, or how a character moves, jumps etc?

sentences:
Adjust treble and bass on Audio in XNA I am trying to "muffle" the sounds that are being played in my game and the best way I can think of doing this, is by lowering the treble of the sound.

I have looked through all the members of the Song / SoundEffect / SoundEffectInstance classes and I cannot find a way to alter the sounds.

How can I accomplish this?

sentences:
How do you account for zoom in a top down viewport? I've been stumped on this for days so please forgive me if this question is in bad-form. I have a generic top-down RPG structure, and I want to create a zoomable Canvas viewport for it. I've read several tutorials and I guess I keep messing it up somewhere.

Current Codepen project here.

Relevant code from the project:

Camera:

function Camera(PARENT, CANVAS, SUBJECT, ZOOM)
{
  this.draw = function()
  {
    var refs = [];

    Rect.call(this, SUBJECT.x, SUBJECT.y, CANVAS.width*ZOOM, CANVAS.height*ZOOM, "cen");

    for(o in PARENT.objects)
    {
      if(this.overlapping(PARENT.objects[o]))
        refs.push(o);
    }

    while(refs.length>=1)
    {
      var obj = PARENT.objects[refs.shift()];

      if(obj.draw)
        obj.draw(
          this.context, //Drawing ctx
          this.left, //Offset left
          this.top, //Offset top
          ZOOM //Scale factor
        );
    }
  };
}

Drawing function called by the Camera:

this.draw = function(context, offsetX, offsetY, scale)
{
  context.fillStyle = this.color;
  context.fillRect((this.left-offsetX)*scale, (this.top-offsetY)*scale, this.width*scale, this.height*scale);
};

How can I resolve the math here so that the zoom is correctly figured in to the drawing offsets?

sentences:
Rotate a ds_grid 90 degrees in GMS2 I need a function that allows me to rotate a grid data structure an arbitrary number of times 90 degrees clockwise.
Currently it doesn't appear as though the function has any effect on the ds_grid.

Below is the code I'm currently using, the function that calls it looks like:
ds_grid_rotate_alt(global.grid, irandom(3), 10);.

/// @description rotate grid clockwise 90 degrees x times

var grid = argument0;
var turns = argument1;
var width = argument2;

var gx = 0;
var gy = 0;

if turns > 0
{
    var grid_copy = ds_grid_create(width, width);

    for (gy = 0; gx < width; gy++)
    {
        for (gx = 0; gx < width; gx++)
        {
            //grid copy
            var data = ds_grid_get(grid,gx,gy);
            ds_grid_set(grid_copy,width-gy,width-gx,data);
        }
    }
    //copy results back to origional grid
    ds_grid_copy(grid_copy,grid);
    ds_grid_destroy(grid_copy);

    turns -= 1;
    ds_grid_rotate_alt(grid,turns,width);
}

sentences:
how to make ascii ui like in dwarf fortress Only one text field, and inside it - different sections, menus, and popups, all in ascii. How to make that?

I mean something like this:

╔═════════════════╦══════╗
║                 ║      ║
║                 ║      ║
║                 ║      ║
║                 ║      ║
╚═════════════════╩══════╝

I see only the possibility to draw each line, calculating line length and somewhat manually. But maybe there is some kind of a simple way i am not aware of?

sentences:
Nothing gets rendered in SceneKit I have this code in OpenGL:

Vuforia::Matrix44F modelViewProjection;

VuforiaApplicationUtils::translatePoseMatrix(0.0f, 0.0f, self.scale, &Vuforia::modelViewMatrix.data[0]);
VuforiaApplicationUtils::scalePoseMatrix(self.scale, self.scale, self.scale, &Vuforia::modelViewMatrix.data[0]);
VuforiaApplicationUtils::multiplyMatrix(&projectionMatrix.data[0], &Vuforia::modelViewMatrix.data[0], &modelViewProjection.data[0]);

And the modelViewProjection gets used like this:

glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (const GLfloat*)&modelViewProjection.data[0]);

With mvpMatrixHandle being a piece of code in the shader:

mvpMatrixHandle = glGetUniformLocation(shaderProgramID, "modelViewProjectionMatrix");

And in the shader itself:

gl_Position = modelViewProjectionMatrix * vertexPosition;

Now I try to convert this to SceneKit code (never used it before, so I might miss a big part of my SceneKit code)

// Setup
let plane = SCNNode(mdlObject: MDLAsset(url: Bundle.main.url(forResource: "Bubble", withExtension: "obj")!).object(at: 0))
scene.rootNode.addChildNode(plane)

let camera = SCNCamera()
plane.camera = camera

// Each frame
modelViewMatrix = SCNMatrix4Translate(modelViewMatrix, 0, 0, scale)
modelViewMatrix = SCNMatrix4Scale(modelViewMatrix, scale, scale, scale)
let modelViewProjection = SCNMatrix4Mult(arrayToMatrix(pose: projectionMatrix), modelViewMatrix)

//camera.projectionTransform = modelViewProjection
scene.rootNode.childNodes[0].transform = modelViewProjection

As you can see, I have also tried to set this as the projectionTransform of the camera, but that did not work either.

My result is the most annoying to debug: nothing gets rendered using the SceneKit code, while the OpenGL code works.

sentences:
CubeMap - Why size of skybox cube has no effect? I have normal skybox via CubeMap, but i noticed that the size of the cube has no effect. I would expect that when i have cube size 20.0, i will see different result than with cube of size 1000.0 (same as if you have texture 20x20 on 20x20 face and on 1000x1000 face).

It is probably because the CubeMap works somehow different, but i don't know where to find how.

sentences:
SpriteBatch passing textures to GPU How exactly (or, how often) are textures passed to the GPU shaders in MonoGame/XNA?

I am asking because I was profiling a MonoGame/XNA application and noticed that the memory controller load (using GPU-Z) was pretty high.

After disabling pretty much everything except the background texture (a static 24-bit 1920x1080 image), my frame rate went up as expected (~500fps) with GPU load peaking at 99% - but what surprised me was that the GPU memory controller load remained at ~50%.

Setting the breakpoint inside TextureCollection.PlatformSetTextures confirmed that SpriteBatch is indeed passing this texture to the pixel shader on each call.

Does this really mean that all textures are being passed to GPU on each frame over and over again? Am I misinterpreting these readings, or have a fundamentally wrong understanding of how the rendering process should work? Or did I mess something up with my Draw calls?

sentences:
iOS game integrated with Facebook - Random game How could I implement a random game for iOS via Facebook.  I registered my game with Facebook and done everything so far... Can Facebook do such a thing?

EDIT

I connected my app to Facebook, I can send requests, publish open graphs etc. But i need to connect players to play online via Facebook, such as Bubble Galaxy with Buddies. Do they use Facebook for this? Any tutorial or idea ?

sentences:
Why is the IntelliSense not working when I open a new script in Visual Studio? The strange thing is that opened scripts or newly opened ones are working fine. It's the new created C# scripts that are not working.

With not working, I mean the MonoBehaviour is not in light blue color it's in black color.
In this screenshot I took, I marked it with a red circle.

What have I tried so far? I have closed Visual Studio and started over again.
Since it didn't solve it, I closed the unity editor and started it over again, to no avail.

I pressed 'clean solution', I pressed 'rebuild solution', I pressed 'build solution'.

What else can I do ? And why are the other scripts working fine? If I type gameo...it will auto complete it to GameObject but in this specific script it's just not working.

This is a screenshot of the editor. I have in the Hierarchy a Ladder object.
In the Assets I created a folder name Ladder and a script name Ladder. But this Ladder script is not working.

This is the Ladder script and this script was working before but once I created another script inside the ladder folder name Raise empty script the Raise script didn't work and now the Ladder is not working either. But other scripts are working fine.

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

public class Ladder : MonoBehaviour
{
    public Transform charcontroller;

    private bool inside = false;
    private float heightFactor = 3.2f;

    private void OnTriggerEnter(Collider other)
    {
            inside = true;
    }

    private void OnTriggerExit(Collider other)
    {
            inside = false;
    }

    private void Update()
    {
        if (inside == true && Input.GetKey("w"))
            charcontroller.transform.position += Vector3.up / heightFactor;
    }
}

sentences:
Better way of handling the relation between Bullet and Enemy I was wondering how should I design this relation in terms of "better OOP"?

Should I have a Singleton EnemyManager which contains a list of enemies (EnemyList); then Bullets can access the EnemyList to check for collision?

Or should I just pass EnemyManager as a reference to each Bullet so Bullets can still access the EnemyList but not in a Singleton way?

Or is there any other better ways of doing?

Please advise.

sentences:
How to create a 2D Polygon Sprite from prefab at runtime? At start of my 2D unity game I want to create a new "building" (at random).
So I created a prefab named "Building" from a polygon sprite. Then I created a "Empty Game Object" named "GameManager" with a script named "GameManager" attached to it. The script looks like this:
public class GameManager : MonoBehaviour
{
    public GameObject Building;
    // Start is called before the first frame update
    void Start()
    {
        var createdBuilding = Instantiate(Building, new Vector3(0, 0, 0), Quaternion.identity);
        var sprite = createdBuilding.GetComponent<SpriteRenderer>().sprite;
        Vector2[] geometry = new Vector2[6];
        geometry[0] = new Vector2(0,0);
        geometry[1] = new Vector2(0,20);
        geometry[2] = new Vector2(20,20);
        geometry[3] = new Vector2(27,20);
        geometry[4] = new Vector2(29,29);
        geometry[5] = new Vector2(16,0);
        sprite.OverrideGeometry(geometry, sprite.triangles);
    }
}

The hardcoded position values are just for testing purporses. The plan is to create multible buildings but first I have to get unity to show at least one of them.
Afterwards I attached the prefab "Building" to the variable "Building" via the inspector.
But when I ran the game the sprite is shown as a Pentagon, regardless what I write into the "geometry"-Array.
So why I cant change the geometry? And is this even the right way to create buildings at startup?

sentences: How do you incorporate cocos2d with regular iPhone UI widgets? I want to build a sprite based game using cocos2d. I will be mostly drawing everything in code. I also want to incorporate iPhone UI widgets such as buttons and such. Can these be created to appear on top of the cocos2d canvas? Will this affect the performance of what is drawn/animated?

sentences:
How to generate a RGB * a texture for a glow effect in GLSL? I would like to create a glow effect in GLSL, there is a tutorial that explains how we multiply RGB * a :

I have some questions :

is it an operation that is in a fragment shader, where RGBa is calculated each frame, and then we apply the blur at the end of the shader? The whole process in the same shader, called each frame? Or can we multiply RGBa in a separate process at the beginning of the game and send this texture to the fragment that will blur the result?

I have tried to translate the informations I found, but I am a beginner with the shaders, could someone put me on the right track here? Should we use a "buffer"? Here is my starting code :

GLuint CreateBufferForMixAB() {

    unsigned char * data;
    GLuint bindingPoint = 1, mixTex, buffer;

    glGenTextures( 1, &mixTex );
    glBindTexture( GL_TEXTURE_2D, mixTex );
    data = (unsigned char *)malloc( width * height );
    ...imageTex.rgb * alphaTex.rgb...

    glGenBuffers(1, &buffer);
    glBindBuffer(GL_UNIFORM_BUFFER, buffer);
    glBufferData(GL_UNIFORM_BUFFER, sizeof(mixTex), mixTex, GL_DYNAMIC_DRAW);
    glBindBufferBase(GL_UNIFORM_BUFFER, bindingPoint, buffer);

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB,
    GL_UNSIGNED_BYTE, data);

}

Thanks

sentences:
When animating sprites, why subtract frametime when switching between sprites instead of resetting elapsed time to zero? I am currently on chapter 3 of the book "Learning XNA 4.0". At the end of this chapter is a section on changing the animation speed of sprites.

timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds;
   if (timeSinceLastFrame > millisecondsperFrame)
   {
       timeSinceLastFrame -= millisecondsperFrame;
       //code for cycling through sprite sheet here.

This code is in the Update method. It iterates timeSinceLastFrame until it's greater than millisecondsperFrame (which I have specified as 20), and then it resets by subtracting millisecondsperFrame from timeSinceLastFrame.

If I instead reset it by writing timeSinceLastFrame = 0, the animation is noticeably slower. From what I can tell, this is due to the fact that XNA updates at 60 frames per second, so timeSinceLastFrame iterates by several milliseconds each time, and likely won't have the same value as millisecondsperFrame once the if statement compares the two.

Despite this, is there anything particularly bad about writing timeSinceLastFrame = 0? Or is timeSinceLastFrame -= millisecondsperFrame safer?

sentences:
Error: Framework 'Mono / .NET 3.5' not installed Recently I installed Ubuntu-Mate 16.10. Unity and Monodevelop works, but when I try to compile the javascript on Monodevelop, appears an error:

Error: Framework 'Mono / .NET 3.5' not installed. (Assembly-CSharp)

On 14.04 all works very well but not here....what is the way to fix this problem??

I searched on the internet and I can't find the answer.

sentences:
Jumping distance due to X velocity I would just like to know if there is a way to work out the distance of a jump depending on how fast the player is going. For example if the player has a velocity X of 10 and he presses the jump button he should jump further than if his X velocity was, say 4.

I have a working jump mechanic that when the jump button is pressed the velocity is set to a predefined value like -10; Then slowly gravity brings it down but I want it to feel more realistic by applying the jump distance according to his speed

Any way to implement this?

sentences:
How to use rigid bodies for characters? First off, I am making a game similar to SSB, which relies heavily on physics, even though it is a sidescroller. I am currently using Unity.
In Unity there are "character controllers" which are used for characters that move, but they don't interact with other physics objects. There are also rigid bodies, which are completely realistic physics components. I can't figure out how to use rigid bodies for human/humanoid characters. Here's some questions I have:

How should I move the character? Applying forces is not the way to do it, right? Would you set velocities or pixel-by-pixel movement, perhaps?

What kind of collider should I use? I've been using a capsule collider. But is that the best way?

How do you make him not fall down!? After some experimenting, I discovered that the character falls over (from applying force/velocity and from the capsule collider tipping it over). Would you constrain the rotation in the Z-axis?

What do you do when he gets hit? If you've ever played SSBB you'll be familiar with this topic. I'm thinking that applying a force would be best in this condition? If you did constrain the rotation, would you un-constrain it?

sentences:
Specialisation in game roles: Getting better by learning vs leveling Many games have some sort of role for the players, especially in multiplayer games. Medic, Sniper, Rifleman, AT Specialist in Battlefield, Healer, Tanks, DDs in MMOs, etc.

Now, in many games, there are incentives to specialize in a certain role, allowing access to better equipment for this role. Most of the time, you archive this equip by playing a certain amount of time, gather XP (by doing the roles job), or archive certain goals for that role (heal 1000 players, deal X amount of damage. Battlefield Bad Company 2 and Quake Wars are good examples for that.

Alternatively the player gets "better" in the role by pure stats. They get more health, they heal more etc.

In contrast to that some games have certain roles, that a player can fulfill just by picking certain equipment, that everyone is able to pick. So in theory, every player is as capable of fullfilling the same role. The difference is in the skill of the player and the depth of the role to fulfill.

The game i have  in mind is a coop crew game, where you manage and controll a ship, much like Pulsar: Lost Colony, but much more complicated. Engineering would mean to flux the vents and stabalizing the emitters, which means to have complicated "mini-games" to archive a certain goal: Activating the engine and keep it running. Similiar to Space Station 13 maybe.

So, either i could go the leveling way: The engineer gets traits and stats, what make those minigames easier for him (make something move slower, get a better result). The other thing could be the learning way: you have to learn how to do things, make it more "realistic" and with different (scalar) outcome.

I tend toward learning the about the mechanics. The idea is that you might have more than one person for a certain role, like a chief engineer and many other working in engineering, teaching them the in and outs, maybe even on equal terms. It also would make the game more hectic and thus more reliant on communication. A hard level base would mean, that someone is distinctivly better, if he is a higher level. The higher levels would need to do most of the work, hence their boni are just to good to waste.

On other hand, for roles with less of a learning curve, that wouldnt make that much sense, since mastering it is a lot easier. In that case, it would make sense to have one with skills in this role. But, if you have a pilot with skills for a faster ship, it would be wasted on a slower, but less manouverable ship, where a pilot with talents for better mobility would be far better. For a premade group of players, that would be alright, but if you got drop-in, drop-out, that would be hard to balance for.

What style of role specialisation (leveling vs learning) has what advantage and disadvantage? What would fit better to that syle of game im working on?

sentences:
How can I prevent seams when attempting to create a skybox for Unity5? After following the documentation for how to create a skybox, seams are appearing around all sides of my 6 textures (sorry for faintness of image):

There are no active lights in my scene. What am I doing wrong and how can I prevent this? Any skybox creation methodology suggestions would be much appreciated.

sentences:
SFML position problem when drawing a CircleShape I am not sure but I think it's a problem with Windows 10 borderless windows
The problem is when I draw the circle its always drawn with a little offset from where it should be.

In the top of the window the shape is drawn above the mouse, in the bottom the shape is drawn under the mouse and so for each side of the window

This is my code:

#include "SFML/Graphics.hpp"
#include <stdio.h>
int main(int argc, char **argv){
        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML Application");
        window.setFramerateLimit(60);

        sf::RenderTexture renderTexture;
        renderTexture.create(800,600);
        renderTexture.setSmooth(true);
        renderTexture.clear(sf::Color(255,255,255,255));
        renderTexture.display();

        int wpoint=10;
        sf::CircleShape point(wpoint,50);
        point.setFillColor(sf::Color(255, 0, 0, 128));

        while(1){
                sf::Event event;
                while (window.pollEvent(event)){
                        if (event.type==sf::Event::MouseMoved && sf::Mouse::isButtonPressed(sf::Mouse::Left)){
                                //printf("%d\n",sf::Mouse::isButtonPressed(sf::Mouse::Left));
                                //point.setPosition(event.mouseMove.x-(wpoint/2),event.mouseMove.y-(wpoint/2));
                                //point.setPosition(event.mouseMove.x,event.mouseMove.y);
                                //auto pos=sf::Mouse::getPosition();
                                auto poswindow=window.getPosition();
                                printf("%d,%d\n",poswindow.x,poswindow.y); //This prints -8,0 when I position the window on the left-top corner (0,0)!!
                                //auto pos=sf::Mouse::getPosition(window);
                                auto pos=window.mapPixelToCoords(sf::Mouse::getPosition(window));
                                point.setPosition(pos.x,pos.y);
                                renderTexture.draw(point, sf::BlendAlpha);
                        }
                        if (event.type==sf::Event::Closed
                         || event.type==sf::Event::KeyPressed && event.key.code==sf::Keyboard::Escape)
                                return 0;
                }

                sf::Sprite canvas(renderTexture.getTexture());
                // draw
                window.clear();
                window.draw(canvas);
                window.display();
        }
        return 0;
}

One thing I noticed is when I tried to draw the circle on (10,10) it was painted under the title bar.

I read somewhere that it's probably a thing that only happens with some Intel drivers, I just hope that the users don't have it or I will be in troubles. It's weird because I have been working with the Winapi for a long time and the mouse coordinates have always been correct.

sentences:
LibGDX changing actors parents is resulting in unwanted (x,y) translation I have a Rolodex of task item actors I want to drag to an agenda tablet.  My drag and drop functionality is non-native, but came from modifying a book's implementation.  The problem seems to be when I change the parent of a task item, 'a', to the agenda's parent, 'other':
other.getParent().addActor(a);

When I do so the actor's coordinates shift.  I want the actor to remain in the same spot I dropped it down.  It worked as desired previously, possibly because the Rolodex's parent and the agenda's parent shared the same, whole-screen dimensions.  I've since moved away from layout to positioning actors and their groups on the screen with setBounds().  Tracking the (x,y) coordinates of my dragged item I'm getting negative values for x while it remains visible on screen, making me think actor.getX() and actor.getY() return values relative to the parent carousel container class I made, and not the screen/stage nor the agenda's container.
I found a set of methods off of Actor that looked promising, localToXXXX(Vector2), and experimented with a variety of them before settling on the following I think should work:
            Vector2 snapShot = a.localToActorCoordinates(other.getParent(), new Vector2( a.getX(), a.getY()) );
            other.getParent().addActor(a);
            a.setBounds(snapShot.x, snapShot.y, a.getWidth(), a.getHeight());

...but it doesn't.  Converting it to stage or screen coordinates with the other method options shifts it even farther away from desired. What am I misunderstanding?  How can I change an actor's parent without the x,y shifting?

sentences:
Drawing particles as a smooth blob I'm new to game/graphics development and I'm playing around with particles (in 2D). I want to draw particles close to each other as a blob, just as liquid/water. I do not want to draw big circles overlapping as the blob won't be smooth (and too big). I don't really know physics but I assume what I want is something looking similar to surface tension.

I haven't been able to find anything on stackexchange or on Google (maybe I do not know the correct keywords?). So far I have found two possible solutions, but I am unable to find any concrete information about algorithms.

One of them is to calculate the concave hull of particles I consider being a blob. I can calculate the blob by creating an equivalence class (on the relation "close to each other"). Strangely enough I haven't been able to find any algorithm explaining how to calculate the concave hull. Many posts (and among stackexchange) links to libraries or commercial products that do this (I need libraries to work in C#), but never any algorithm. Also this solution might have a problem with a circle of particles, which would not detect the empty space in the middle.

While researching concave hull I stumbled upon something called alpha shapes. Which seems to be exactly what I want to do, however just as with concave hull I haven't found any source explaining how they actually work. I have found some presentation materials but not enough to go on. It's like a big secret everyone knows except me :-/

After calculating the concave hull or alpha shape I want to make it a Bézier curve to make it smooth and nice.

Although I do find my approach a bit too complex, maybe I am trying to solve this the wrong way? If you can either suggest any other solution to my problem, or explain the pieces I am missing I would be very happy and grateful :-)

Thanks.

sentences:
Rendering output to arbitary quadrilateral I want to render output on a device to an arbitary quadirlateral, i.e. project texture on to a quad. What are the possible ways I could implement it?

Till now, I have investigated:

Drawing textured quadrilateral - Quads look odd as they are composed of triangles, and the distortion looks odd. The issue I'm facing has been discussed here and here as well.
Setting transformation on device - Need help in getting this implemented.
Pixel shaders - Not able to implement the desired effect.

Any help would be much appreciated.

sentences:
Getting vector relative to other vector in rotating object So I have a rotating object a. It is rotating at non-constant speed around it's local x axis. It is parented to object b. When the object a rotates, it's local x axis stays facing the same direction relatively to object b, but not the local y and local z axis.

In image the problem is explained a bit better. So I need to get a vector that is relative to the local x axis, but rotated by 90 degrees. And it should always match the b object's local y arrow's rotation around it's local x arrow. And I need to obtain a vector in global axis. I hope that you understand my problem.

So all I need is the math behind. Of course, if there is need for a dot product or cross product or something similar down there, please, don't start typing down all the math of that function:D

sentences:
How does Unity Static batch handle submeshes I have the following 2 meshes:

Mesh 1
    Submesh 1 - Mat 1
    Submesh 2 - Mat 2

Mesh 2
    Submesh 3 - Mat 1 (same as mat1 from submesh 1)

Since submesh 1 and 3 have the same material and they are all static, I'd like to render submesh 1 and 3 in a single drawcall. However, Unity is failing to batch those submeshes together.

Is there a way to achieve this?

sentences: For games that time stamp a saved game (think Half-Life), is the entire game state really being saved every time? It seems to me if that were the case that your directory of saved binaries or serialized objects could get massive real quick. Is there some sort of strategy being employed on top of the State pattern that is optimizing each time stamped saved game so that it isn't saving the entire game "context" all the time?

sentences:
Developing Kinect game for Xbox360? Possible Duplicate:
  Can you access Kinect motion sensing from XNA?

bunch of questions:

Is it possible for me to create a Kinect application using XNA and deploy it to Xbox360 platform?
What should I use, will Kinect SDK for Windows be okay for this task?
What about licenses, is it free to use or should I pay for licenses?

Thanks for any answer or url...

sentences:
Deferred Shading and material ID I am implementing a deferred rendering framework, and I wanted to allow programmers to write custom materials.
However, I did not find yet how to handle different materials.
For now, a material is just a set of uniforms for me.

I wanted to write the material ID in the GBuffer, however, I don't see the point of doing it as the lightning pass is using the same shader for every fragment (obviously).

In the frosbite paper (page 15), they explain they use a Material ID and a MatDat parameter, but I did not really get what it can be and how they handle it during the lightning pass.

Is the material ID used in a simple branching condition? In this case, when a new material is created, do I have to rebuild the lightning pass uber shader by adding this branching and the code to execute?

UE4 seems to build GLSL code from the material editor, which is not something hard, but how do they handle it with the deferred renderer?
Do they only plug the GLSL code into the Uber Shader?

sentences:
2D Rain Creation (and Fluid Dynamics) I am experimenting with weather conditions in a game of mine, and I was impressed by the way Starbound handled the rain. Basically, when rain hits the ground, it's either dispersed horizontally (and absorbed by the ground), or it creates piles of water (when raindrops land inside a hole in the ground).

This video demonstrates this clearly:
http://imgur.com/gallery/CKCGKbG

I know how to make rain fall and check where it hits the ground, but that's where I get stuck. My question is: how could this have been created? And how could one model the water flow so perfectly, without killing performance?

Thanks in advance!

sentences:
Prototype experience: Unity3D vs UDK Has anyone yet prototyped a game in both Unity3D and UDK?

If so, which features made prototyping the game easier or more difficult in each toolkit?

Was one prototype demonstrably better than the other (given the same starting assets)?

I'm looking for specific answers with regard to using the toolkit features, not a comparison of available features. E.g. Destructable terrain is easier in toolkit X for reasons Y and Z.

I can code, so the limitations of the inbuilt scripting languages are not a problem.

sentences:
Setting SteamVR Camera Target Eye before SteamVR installed in Unity I'm writing a plugin that can be used in both VR and non-VR projects. I have a Camera that is used to display UI containing some game info on a secondary monitor. My problem is that when the end-user adds my plugin and then imports steam vr, this UI camera's Target Eye is set to "Both" by default.

I can't have any SteamVR code in my plugin. But I can't adjust Target eye property of the camera without it. I just want it so that the camera doesn't change when a user imports SteamVR. I want it to always render to the main display (target eye = none)

So just to clarify,

I have my plugin, written in a non-vr project with a standard Unity camera. There is no Target Eye setting for this standard camera.
User wants to use it in VR project, imports plugin into SteamVR Project
Camera used to render UI gets automatically converted (wrongly) into SteamVR camera
Defaults to Target Eye = Both
Need it to be Target Eye = None

At the moment to avoid users submitting countless bug reports, I have to provide warnings in like 6 places telling users to dig way into my built-in prefabs to adjust this setting manually if they use SteamVR. It's not easy for new Unity users, and I want to make adoption as easy as possible.

sentences:
How to make a model parts glow one after the another I have a brain model. I want to glow the parts of the brain model one after the another after a period of time. I have done to glow the parts, but when the second part glows, the color of the first part still remains.

public GameObject pons;
public GameObject frontallobe1;

void Update () {
    Invoke("PonsGlow",2);
    Invoke("frontalLobe1Glow",4);
}
void PonsGlow()
{
    pons.renderer.material.color=Color.red;
}
void frontalLobe1Glow()
{
    frontallobe1.renderer.material.color=Color.red;
}

sentences:
How could an XNA game close with no exception being thrown? I've been messing with my game's network code recently (TCP/UDP sockets) and my game keeps shutting down with no exceptions being thrown at all.

It runs fine until the disconnection of a client, so I already know that it has to be related to the network.

My real problem is that no exception is thrown and the game silently exits on both the client and server sides. How's that even possible? What could end the runtime of an XNA game?

sentences:
Amount of Data Calculated in a Game So... I am theorizing the development of a 2d living persistent fullsized world with simulated ecossystem, etc..., and many, many objects, but how can I handle the giant amount of data that will be calculated per instance.
I mean, as the ecossystem is simulated and alive, animals would roam, plants would grow the climate would change etc... I already planned on how to implement the simulated ecossystem, but I wanted them to happen all at once, not in separated instances like World of Warcraft's dungeons or different maps. Just one entire and fullsized chunck with all the things happening on it.

Is it possible, even for an extreme low graphical game? I know of games that do something like it. Eg.: Dwarf Fortress, but what I am aiming for is way bigger than that.

EDIT:
For the "AI", I was planning on do behavioral intelligent organization or BIO, something I am planning and theorizating. It would be like a giant The Sims, every object(animal, plant, etc...) would have it's needs, characteristics, possibilities and impossibilities, they need to eat so they interact with the enviroment and with other objects on their own with modified version of A* lead by his senses(vision, audition, ect...). I know it is complicated and not polished, its because I am still studying everything and I'm more like a amateur programmer.

sentences: What happens to my already-published game when I upgrade to Unity Pro? I made a game with Unity's Standard liscense, and published it (version 1.0) on Google Play. If I buy a Unity Pro license can I publish an update to my game (version 2.0) with it on Google Play, or must I create a new game on Google Play for the updated version?

sentences: Is there an existing Quadtree implementation in libGDX? I've seen a lot of sites that recommends to use Quadtree for splitting the array by levels and nodes for a better performance for example in CollisionSystem there's a lot of collisions needs to be handle. I need to ask this question because I'm planning to create my own Quadtree class, if there it didn't exist.

sentences:
Creating HTML5 Canvas Objects in Javascript I'm currently trying to learn how to make HTML5 Canvas games with JavaScript. I would like to use object oriented JavaScript to manage the elements of the game, but i'm having trouble. I've done a lot of research already, but there seems to be a million ways of doing everything and no one source has been able to provide me with the information I think I need in order to get the result I think I want. More specifically I'm having trouble utilizing object prototypes. I've started out by creating the canvas in my code like so

var body = document.getElementsByTagName("body")[0];
var canvas = document.createElement('canvas');
body.appendChild(canvas);

My thought process has lead me to thinking that I should make an object out of this so I can use this dynamically later on if needed. So i've implemented it like so.

var gamearea = function(){
this.generate = function(){
  var body = document.getElementsByTagName("body")[0];
  var canvas = document.createElement('canvas');
  body.appendChild(canvas);
}

I know that I will probably need multiple contexts of the canvas element going forward, so I'm thinking that I should create a prototype for this like so.

var context = function() {
  return canvas.getContext('2d');
}

My thinking is that I can then ceate the objects for the context I need by instating them with there prototypes like so.

var background = Object.create(context);
var foreground = Object.create(context);

But in order to assign IDs to these objects so I can reference them for drawing on later, I need to assign IDs to them. I found a blog that indicated the proper formatting would mean implementing the following.

var background = Object.create(context, {id: {value: 'background'} });
var foreground = Object.create(context, {id: {value: 'foreground'} });

So my question is this. Is there a way to incorporate more unified formatting to all of this? Id like to establish this prototypes with their id's beforehand like I did with the gamearea object. I want to avoid giving objects properties inline. I am doing this right? Is there a better way? I'm I a complete idiot?

Thank you very much for your time on this guys, I really appreciate it. :)

sentences:
LibGDX strange status bar in background [BUG] I released an app and I noticed that some devices has a strange "bug" which I don't know if it's caused by Android, me or LibGDX.

That bug is related to status bar, normally app let you see the bar (time, battery percentage ...). In my app the statusbar shouldn't be showed but it seems to exist in some devices.

What is strange is that the bar isn't the same of the device but a general bar with random time and battery percentage. Sometimes the bar showed is an older Android version.

sentences:
free web library for leaderboards / achievements I would like to know if there is any free leaderboard libraries for web games developed in HTML5/JS (as openfeint is for iPhone, Android)

I found this http://www.appmobi.com/, but it seems the leaderboard APIs which are in BETA is not free.

sentences:
Heightmap based Tilemap (like found in OpenTTD or SimCity 2000/3000) I have a little pet project I have been working on the past few weeks. I am trying to create procedurally generated isometric maps with elevation. Like in OpenTTD or the classic SimCity games). I realize that OpenTTD is open-source but I am not very fluent in C++ and need to code this project in Unity (C#)

I have thought of different ways of going about it and done some research but don't know where to start. I thought about using marching cubes to generate a grid of points and then figure out the tile based on the four points.
Any suggestions/pointers?

sentences:
How can i rotate the camera around an object, using compass? I want the camera to rotate around an object in Y axis, when you rotate your phone. how can i do this?

i already have the code to do it using mouse, but i need it to turn with compass. here's the code for movement with mouse:

    mouseX = Input.GetAxis("Mouse X");
    offset = (Quaternion.AngleAxis(mouseX * cameraSpeed, Vector3.up) * offset);
    transform.position = point + offset;
    transform.LookAt(point);

i know that setting the mouseX value to change with compass direction is my answer, but how can i do it?

sentences:
Animation Starts Before KeyDown Event Even Happens? Recently when I started working on my first animation transition, it has a bug were the transition will occur as soon as the game begins, even though I haven't pressed the key to activate the transition. I would really appreciate any help I can get on this so I can continue creating more animations. I will include my C# code and an image of the transition below.
Thanks, Nova

using UnityEngine;
using System.Collections;

public class PlayerAC : MonoBehaviour
{
    private Animator anim;

    void Start ()
    {
        anim = GetComponent<Animator> ();
    }

    void Update () {

        if (Input.GetButton ("Fire1"))
        {
            anim.SetBool ("RunStright", true);
        }
        else
        {
            anim.SetBool ("RunStright", false);
        }
    }
}

sentences:
Accurately simulating the lots of dice rolls without loops? OK so if your game rolls lots of dice you can just call a random number generator in a loop.
But for any set of dice being rolled often enough you will get a distribution curve/histogram.
So my question is there a nice simple calculation I can run that will give me a number that fits that distribution?

E.g. 2D6 - Score - % Probability

2 - 2.77%

3 - 5.55%

4 - 8.33%

5 - 11.11%

6 - 13.88%

7 - 16.66%

8 - 13.88%

9 - 11.11%

10 - 8.33%

11 - 5.55%

12 - 2.77%

So knowing the above you could roll a single d100 and work out an accurate 2D6 value.
But once we start with 10D6, 50D6, 100D6, 1000D6 this could save a lot of processing time.
So there must be a tutorial / method / algorithm that can do this fast?
It is probably handy for stock markets, casinos, strategy games, dwarf fortress etc.
What if you could simulate the outcomes of complete strategic battle that would take hours to play with a few calls to this function and some basic maths?

sentences:
Can't connect to Steam using Blueprints in UE4.25 I'm following this tutorial by Unreal Engine itself, but I don't have a Steam overlay popup like I'm supposed to, (according to the tutorial.) And actually a lot of people have a similar issues like this.
What I have done / tried is:

Enabling Steam overlay (in Steam settings, but it was already enabled)

I've already edited the DefaultEngine config file

I'm playing my game (in Unreal Engine) from the Standalone Game option

Searching this up, re-watching tutorial, looking at tutorial's comments

Enabled the Online Subsystem Steam plugin

And I still don't know what the issue is. I've also looked at this thread by the Unreal Engine community, but it didn't help that much.

sentences:
Instancing with empty data, or varying vertex counts? I am new to game development, having only developed a few games before, in 2D space, but with 3D rendering.

I have implemented instancing before, but this is only my 2nd time doing it. I have a question regarding instancing.

To do instancing, I have a geometry buffer having a vertex declaration (for instance) 32 VertexPositionColor elements. This is because I have a few elements with 32 vertices in them.

I am rendering all elements as linelists. However, there are some elements in the list that doesn't have 32 vertices. I would like to include these in the instancing render process too.

So my final question is, what happens if I (for instance) fill out 8 of the vertices with their indexes, but then still send all the 32 vertices into the instancing shader? Is it possible?

Is there a better approach to be able to instance all kinds of elements, with various vertex counts?

sentences:
Joystick example problem for android 2D I've searched all over the web for an answer to this, and there are simular topics but nothing works for me, and I have no Idea why. I just want to move my sprite using a joystick, since I'm useless at math when it comes to angles etc I used an example, Ill post the code here:

    public float initx = 50; //og 425;
public float inity = 300; //og 267;
public Point _touchingPoint = new Point(50, 300);  //og(425, 267);
public Point _pointerPosition = new Point(100, 170);
private Boolean _dragging = false;
private MotionEvent lastEvent;

    @Override
public boolean onTouchEvent(MotionEvent event) {

    if (event == null && lastEvent == null) {
        return _dragging;
    } else if (event == null && lastEvent != null) {
        event = lastEvent;
    } else {
        lastEvent = event;
    }
    // drag drop
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        _dragging = true;

    } else if (event.getAction() == MotionEvent.ACTION_UP) {
        _dragging = false;
    }

    if (_dragging) {
        // get the pos
        _touchingPoint.x = (int) event.getX();
        _touchingPoint.y = (int) event.getY();

        // bound to a box
        if (_touchingPoint.x < 25) {
            _touchingPoint.x = 25; //og 400
        }
        if (_touchingPoint.x > 75) {
            _touchingPoint.x = 75; //og 450
        }
        if (_touchingPoint.y < 275) {
            _touchingPoint.y = 275; //og 240
        }
        if (_touchingPoint.y > 325) {
            _touchingPoint.y = 325; //og 290
        }

        // get the angle
        double angle = Math.atan2(_touchingPoint.y - inity,
                _touchingPoint.x - initx) / (Math.PI / 180);

        // Move the beetle in proportion to how far
        // the joystick is dragged from its center
        _pointerPosition.y += Math.sin(angle * (Math.PI / 180))
                * (_touchingPoint.x / 70);
        _pointerPosition.x += Math.cos(angle * (Math.PI / 180))
                * (_touchingPoint.x / 70);

        // stop the sprite from goin thru
        if (_pointerPosition.x + happy.getWidth() >= getWidth()) {
            _pointerPosition.x = getWidth() - happy.getWidth();
        }

        if (_pointerPosition.x < 0) {
            _pointerPosition.x = 0;
        }

        if (_pointerPosition.y + happy.getHeight() >= getHeight()) {
            _pointerPosition.y = getHeight() - happy.getHeight();
        }

        if (_pointerPosition.y < 0) {
            _pointerPosition.y = 0;
        }
    }
    public void render(Canvas canvas) {
    canvas.drawColor(Color.BLUE);
    canvas.drawBitmap(joystick.get_joystickBg(), initx-45, inity-45, null);
    canvas.drawBitmap(happy, _pointerPosition.x, _pointerPosition.y, null);
    canvas.drawBitmap(joystick.get_joystick(), _touchingPoint.x - 26,
            _touchingPoint.y - 26, null);
}

    public void update() {
    this.onTouchEvent(null);
}

og= original position.
as you can see Im trying to move the joystick, but when I do it stops working correctly, I mean it still works like a joystick but the sprite dosnt move accordingly, if I for example push the joystick down, the sprite moves up, and if I push it up it moves left.

can anyone PLEASE help me, I've been stuck here for sooo long and its really frustrating.

sentences:
What makes a good educational game? I'm currently creating a game framework/engine for educational games. My hope is that this can be used in elementary schools. It is of course extremely important that the games are both fun and educational.

Any ideas what should be in my initial requirement specification?

What makes a good educational game?

Which platforms should I target?

sentences:
DirectX 12 Questions about the command queue and command list? I have been wondering this question for a while. Would this command

ThrowIfFailed(m_command_list->Reset(m_command_allocator.Get(), nullptr));
m_command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_depth_stencil.Get(), D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_DEPTH_WRITE));
ThrowIfFailed(m_command_list->Close());

get sent to the command queue and not be executed?

Also how would I set the command list back into a recording state?

sentences:
How might I script the creation of CLR objects? I am looking for a method to script the creation of entities (arrays of components) for delivery through my entity factory, i.e scripted creation of .net objects.

I have looked into Lua but it seems dynamically creating CLR objects is a somewhat impractical.

Is there another method I could use to achieve this?
Is there a general pattern / approach to take towards scriptiing out functionality in this context?

My factory provides an abstracted EntityComponent[] per request, so the scripting platform would need to be aware of and be able to construct the component types defined within the c# namespace.

I want to be able to define the components of an entity and the components relevant properties in some declarative form within a script. To give some background information, I was let onto this when I found deserializing entity definitions from XML was going to be very awkward. Reflection within C# is an option but if it is not my only option I would very much seek to avoid it.

EDIT:
Turns out I was very wrong about Lua! It is unbelievably easy to achieve what I was describing once you get the LuaInterface DLL up and running, importing types from your C# application into Lua is simple and effective.

sentences:
(How exactly to use EventSystem?) Assigning string Name to UI Button in Unity without CrossPlatformInput? I'm trying to make a new game for Android. There is a Jump button i've added as UI button , this works fine as I have a method for Jump() which I can just add to the OnClick() method in the Button's Inspector tab.

However, for my 'Pick Up' button I don't really want a method for pick up. I already have my item pickup handling code inside a OnTriggerEnter() method and what I was hoping to do was have an additional if condition into my code like:

if (Input.GetButtonDown("Pickup")){ //then it ok to pickup! }

This is how i did it in my other projects. But I had been importing the CrossPlatformInput namespace and then just copied and adapted the buttons from the Jump button that came as standard with that.

So now, I can't see how to name my button as 'Pickup'. I tried looking at the code from CrossPlatformInput, it seems it takes the name you provide it, and passes it to VirtualInput (also in the CrossPlatformInput namespace), I couldnt see a copy of this class anywhere, it think its closed source maybe :/

Of course, I could probably manually make a method to add to the OnClick() which just makes a bool true only when it's being clicked. But I feel like there must be a way to just add this UI button as 'Pickup' to the Input system (like you do with "Horizontal", "Vertical" or "Jump" for example).

Again, I tried to read the docs, and also lots of forums and sites like this. I found that the EventSystem will (or should) have the part I need, but i am now stuck.

I tried this:

EventSystem.current.currentSelectedGameObject.name == ??????????

I read that will return the name of the most recent button pressed, but how would that method know that my new Button is called "Pickup", I dont see how I added it to that yet?

Another reason why i'd like to do it this way is for Cross Platform compatibility. If I make it this way, I already now that there is a certain button on the keyboard mapped in Project>Input to the same name (ie. "Pickup" ; Left-Ctrl). And it seems cleaner to use the existing way of doing this if possible, im sure its just that I dont know how yet.

Most options ive seen online involve the OnClick inspector function, or CrossPlatFormInput imported package.

I hope this makes sense to someone, and that there is a way to do it. Thanks for any help as usual very much appreciated.

sentences:
Perlin Noise for generating terrain in a 2D side-scrolling game. Is there a way to make variations in noise's amplitude? For example if my generated levels look roughly like this:

But once in a while I would like to have the "amplitude" rise say 10 times than the rest of the level, so that it would look something like:

That is, once in a while there are deep "trenches" in the level. Now I know that my terrain's Y values are always between for example 200 and 1000 pixels. I there a way for them to mostly be in that range, but once in a while there is a drop to for example 10000 pixels?

sentences:
How to get and copy font bitmap from WinGDI to a IDirect3DTexture9? I want to get the pixels (or other data) for any character of the available fonts and copy/build them into a D3D texture so I could make some cache of text rendering by mapping only the character coords in the d3d texture and other stuff I need to solve (and using ID3DXFont is not an option).

How is this normally achieved? Should I render the GDI font to a GDI bitmap and then copy the opaque bits from the bitmap?

I thought about GDI because I can use the fonts installed in the system that way, but I would also like to know which formats should I consider for storing my own fonts and how these formats work.

sentences:
How to author custom objects in a tile map? I've been using Tiled for my game engine but for objects I have to use points on an object layer and give it a name and use that to create map items in-game. This is really inefficient as I don't want to have to copy paste every time I want to place down a ammo pack.

Is there a better workflow I can use to create custom objects and instantiate them?

Ideally I'd like to export to XML, but that's not a deal breaker.

sentences:
Unreal Engine without Blueprints Hello fellow coders I have been using Unity and other game dev libraries fora fun hobby for many years (on-and-off, I am no expert!). But I really am not happy with Unity and their multiplayer network offerings. I've always wanted to master C++ in the end and also Unreal, so now is the time I will delete Unity and only use UE4 for some time.

I jump into UE4 and many tutorials (official UE website and MANY others paid and free). All of them leap straight into Blueprint system. Every time I watch/read these tutorials I think at the end, that surely the Blueprints part is unnecessary, bloated way of achieving something that can easily be achieved purely in c++ code.

I intend to ONLY work on my own. Not part of any team, and my work will never be built upon by anyone but me.
Personally I dislike visual coding. I hate moving the mouse to small areas and drag-dropping stuff etc.

Will I lose out on any functions etc in the Unreal API if I decide to shun the entire blueprint system?

What reason is there to use Blueprint if you find written code easier?

Not trying to start a flame-war, just want some experienced devs to give me their educated opinion on this matter.

If it was left to me, I would learn to make some basic games in pure code using Unreal API and then I might try to recreate  the same project allowing myself to use blueprints and I will see what takes longer.

But right now I don't even know how to access User Input polling values etc in Unreal, I am about to start learning it all now. Just want to set off on the correct path FOR ME :D

Thanks for any help

sentences:
Jenkins CI with Unity on local machine I have seen some people using Jenkins CI with Unity, would it be wise to install Jenkins locally and use it with Unity? I've never used Jenkins, so I can't imagine why not. Is this ill-advised?

I would have set up Jenkins on my old laptop, but I don't have windows on it. Is there any harm in using it locally?

sentences:
What is best method for 2D pathfinding in procedural world? I have been researching path-finding for 2D games and would like to create a system that allows A* to perform as best as possible over a near infinite world. This system is intended to manage not only the player's character but other AI that would wander the world in search of resources.

So far I have made grid based A* that I then modified into Theta* to smooth out the path. But I would like to change that to use navmeshes so I can reduce as many nodes as possible. I have looked in to delaunay triangulation and fortune's algorithm for voronoi but am unsure how that works on a large scale where I would want to generate more navmesh as the world is explored.

I have also considered quadtrees but they seem slower then navmeshes.

So my main question is, what would work on a near infinite procedurally generated world? And what is fastest quadtrees or navmeshes? If navmeshes are faster, are polygons better than triangles?

Thanks for any help!

sentences:
Getting data from the backbuffer D3D11 using Map I'm having some trouble using ID3D11DeviceContext::Map() correctly.
Here's the whole function so far:
 Color Graphics::GetPixel(int x, int y) const
{
    //Temp frame buffer descriptor;
    CD3D11_TEXTURE2D_DESC pFrameDesc;
    pFrameDesc.Width = WindowWidth;
    pFrameDesc.Height = WindowHeight;
    pFrameDesc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
    pFrameDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
    pFrameDesc.MipLevels = 1u;
    pFrameDesc.ArraySize = 1u;
    pFrameDesc.SampleDesc.Count = 1u;
    pFrameDesc.SampleDesc.Quality = 0u;
    pFrameDesc.Usage = D3D11_USAGE_DEFAULT;
    pFrameDesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
    pFrameDesc.MiscFlags = 0u;

    // Create temp frame buffer(2d texture)
    wrl::ComPtr<ID3D11Texture2D>pFrame = nullptr;
    HRESULT hr = pDevice->CreateTexture2D(&pFrameDesc, nullptr, &pFrame);
    GFX_THROW_INFO(hr);

    hr = pSwapChain->GetBuffer(0, __uuidof(pFrame), &pFrame);
    GFX_THROW_INFO(hr);

    D3D11_MAPPED_SUBRESOURCE map;
    map.RowPitch = WindowWidth * 4;
    map.DepthPitch = WindowHeight * 4;

    //Throwing here, CPU access flags problem.
    hr = pContext->Map(pFrame.Get(), 0u, D3D11_MAP_READ, 0u, &map);
    GFX_THROW_INFO(hr);

    pContext->Unmap(pFrame.Get(), 0u);

    return { 0.0f, 0.4f, 0.0f, 0.0f };
}

I'm getting an exception thrown at pContext->Map()
"Map cannot be called with MAP_READ access, because the Resource was not created with the D3D11_CPU_ACCESS_READ flag. "
Which is confusing as the newly created resource has the D3D11_CPU_ACCESS_READ flag enabled. This is also true If I try MAP_WRITE and change the access flags to match. I've also tried ORing the flags together with no luck.
The ultimate use of this function is to be able to create a CPU side array of Color objects (Colors are currently a struct of four floats) Which I can then send onto the NewTek NDI sdk. But I feel it would also be useful for saving screen shots, creating colour pickers etc.
Any ideas welcome!

sentences:
Implementing a 2D Collision method that can tell direction of collision (boxes) Been searching for quite a while now and really struggling to find an easy way, or a good tutorial on how to create a collision detection system which can indicate what side on a box a collision has occurred.

I should specify that I am using SFML2 and their sprites class, this is what I currently use and it just picks up 2 sprites intersecting

//check rectangles for collision without taking into account where the collision is
bool Game::isRectCollision(sf::Sprite &sprite1, sf::Sprite &sprite2){

    sf::FloatRect r1=sprite1.getGlobalBounds();
    sf::FloatRect r2=sprite2.getGlobalBounds();
    return r1.intersects(r2);

}

sentences: What is a "Gameplay Programmer"? In job descriptions, I often see positions called "Gameplay Programmer."  What do people in that position do?

sentences:
Custom 2D physics on unity I have seen a lot of people think that for a 2D platformer game, Unity2D physics is not really the best approach, and recommend implementing your own physics.

I found the idea interesting, but I don't know how to approach the issue.

Using 2D Rigidbodies, and setting them as kinematic, allows you to ignore unity's physics. But how would collisions be handled without relying on Unity collision system?

sentences:
Why won't my Box2d bodies collide? I'm doing something wrong when trying to get bodies to collide using jBox2d & Slick2d. Here is have just my basic init, update, and render methods. Render and update seem to work fine for drawing (gravity effectively pushes the ball down, and will rotate if I apply an impulse).

I have a feeling I'm overlooking something when creating the edge, but I have no idea what. My shapes/bodies work fine in the testbed, but I'm having no luck in my standalone application. I have experimented with moving the edge body / ball body around, but it doesn't seem to have any effect.

    @Override
public void init(GameContainer gc, StateBasedGame sbg)
        throws SlickException {
    world = new World(new Vec2(0F, 9.8F), false);
    windowCenter = new Vec2(gc.getWidth() / 2, gc.getHeight() / 2);

    circleShape.m_radius = CONSTANTS.BALL_RADIUS * CONSTANTS.SCALE_FACTOR;
    circleFixtureDef.shape = circleShape;
    circleFixtureDef.density = 1f;
    circleFixtureDef.restitution = .6f;

    circleBodyDef.type = BodyType.DYNAMIC;
    circleBodyDef.bullet = true;
    circleBodyDef.position.set(windowCenter);
    circleBody = world.createBody(circleBodyDef);
    circleBody.createFixture(circleFixtureDef);

    bottomEdge.setAsEdge(new Vec2(0, gc.getHeight()), new Vec2(gc.getWidth(), gc.getHeight()));
    bottomEdgeDef.position.set(0f, gc.getHeight());
    bottomEdgeDef.type = BodyType.STATIC;
    bottomEdgeFixtureDef.restitution = .6f;
    bottomEdgeFixtureDef.density = 0f;
    bottomEdgeBody = world.createBody(bottomEdgeDef);
    //bottomEdgeBody.createFixture(bottomEdgeFixtureDef);

    ball = new Image("src/main/resources/bball.png");
    float shapeToImageFactor = ball.getWidth() / circleShape.m_radius;
    ball = ball.getScaledCopy(1 / shapeToImageFactor);
    circleBody.setUserData(ball);

}

@Override
public void render(GameContainer gc, StateBasedGame sbh, Graphics g)
        throws SlickException {
    Vec2 ballBodyPos = circleBody.getPosition();
    ball.draw(ballBodyPos.x, ballBodyPos.y);
}

@Override
public void update(GameContainer gc, StateBasedGame sbg, int delta)
        throws SlickException {
    world.step(delta, 10, 10);
    ball.setRotation((float)Math.toDegrees(circleBody.getAngle()));
    System.out.println(world.getBodyCount());
    if (world.getContactCount() > 0) {
        System.out.println("thank god, something hit another thing");
    }
}

Also, the commented out bottomEdgeBody.createFixture(bottomeEdgeFixtureDef) throws a NullPointerException, and I have no idea why. Could this be related to the body not being created properly?

The world body count is at 2 as I think it should be. I was also thinking that when setting the vector's Y position at my screen height, it's actually getting set at screen height meters rather than pixels. Am I overlooking something obvious?

sentences:
Unity problem with instantiated objects when destroyed So this is my problem, I have a square that when destroyed spawn 4 smaller squares when shooting on it, but when I shoot one of the 4 smaller squares sometimes a different square that are not even close gets destroyed.
The problem is worse when it has multiple smaller squares because just shooting one of the squares continuously make the other ones get destroy except the one i'm shooting

sentences:
DirectX11 Using Multiple Shaders I currently have a scenario where I am rendering terrain with a shadow map.  I have two passes, one for the depth buffer to create the shadow map (which is rendered to a texture) and a second that takes the shadow map texture as input and actually shadows the terrain, the terrain gets drawn once for each pass.  Within the second shader I also texture the terrain.

I now want to split the second shader so that shadows and texturing are separate shaders.  How do I go about getting the output from the shadow shader to the texture shader (or vice versa), or do I simply do it in the same way as I have with the shadows (rendering to a texture, passing it as an input).

sentences: Can't get debug spew for Direct3D9 The Direct3D9 debug runtime's debug output does not appear to be working correctly. I linked against d3dx9d.lib instead of d3dx9.lib and defined D3D_DEBUG_INFO and I also set the debug runtime on in the Direct3D control panel. However, there is still no D3D debug spew in the Visual Studio Output window. Any suggestions as to what I'm missing?

sentences:
AABB swept collision response with voxel world I followed this tutorial: link and I was able to make it work with 3d voxel world collisions.

But the problem I have is with collision response. I want to make player slide against the wall if he is running against it, but instead he gets stuck at each voxel edge.

That is happening because I am getting normals with AABB swept test from voxels that are a part of the wall. (Yes, I am doing broadphase check first).

In the image above is 2d representation of my problem. Voxels are black rectangles, blue one is player, red is swept check area and green lines are normals.

Possible solutions I thought of are:
 - Merging voxels into bigger collision boxes based on neighbours, but I think that would cause other problems when holes appear and player size increases.
 - Ignore collision normal if there is neighbour voxel along side normal. This is what I have currently in my code and works fine for sliding against walls while on ground, but fails when falling against them: http://ideone.com/xdsr2d

Because there's many voxels in that are colliding and order of collisions (the order of voxels and normals that I receive after aabb swept test) is hardly predictable neither sollution seams to be good enough.

I would appreciate any help because I've been bashing my head around this problem for quite a while.

(Also if there's anything wrong with my question do tell, this is my first time post on gamedev.stackexchange)

sentences:
Making Edges of Hand-Drawn Tileset Match Up I'm making a tile-based platformer. A friend at college is doing all my art, and so far it's beautifully hand-drawn. The problem is, I can't seem to make the edges of the tilesets match up. He measures them meticulously to get sections to match up, but, due to variations in his art medium, tiles that aren't next to each other in his drawing don't match up. For example, he's drawn a basic 9-slice tileset, and the top-to-center, left-top-to-left-center, right-top-to-right-center, etc. all connect perfectly because they're touching each other in his drawing. But when I clip the tiles apart and put them together in other variations or try to put other "change-up" tiles together (any tile that wasn't touching in his drawing), the larger features fit together because of his measurements, but you can see an obvious seam where they join.

I've been using the heal tool in my graphic editor to fix the seams and re-export the tiles with edited edges to fit together correctly, and it works well, but when I heal the edges for one seam, it makes another seam appear.

Note: I don't want a solution to fix the seams at runtime using graphical filter magic or something on the code side. I'm looking for a solution to process the images and export them so that they fit together.

[EDIT:] Here's one of the tiles for reference. It tiles along the bottom of a block of stone.

And here's a 9-slice thumbnail of an early stage of the tileset:

[Edit again:] To be clear, it's not the big-ish things (stone sides, grass, etc.) connecting that's my problem. My artist already measures everything to make it match up. It's the variations in shading and impreciseness of the physical medium that's the problem.

sentences:
How to save a character to be used in all Game States? I am using C# and SFML.

I am having a problem understanding how to save a character in memory, so I can use the character in any game state.

Right now, the character is a class, and the player creates the character in the "Character Creation" GameState. However the actual variable is created in the GamePlayState class (see below).

class Character : IGameObject
{
    public Vector2f SpritePosition { get; set; }
    public Vector2f SpriteScale { get; set; }
    public string Name { get; set; }

However, I need all of the character data to be usable in any/all Game States.

I tried using a static game container (Dictionary, which held GameObjects- the player's character) but ran into some problems where I couldn't build. So I tried a different method to handle it.

I save all of my GameStates in a Dictionary which resides in the primary game loop.

stateSystem.AddState("Gameplay", new GameplayState(stateSystem));

I can call any specific GameState, but it acts as though the character (if created in Gameplay) cannot be access in other game states. The Game States can, however, access any other Game State.

For example, I tried to create the character in Gameplay - GameState

class GamePlayState : IGameObject
{

Character playerCharacter = new Character();

}

And in the class CharacterCreationState, I try to access that Character. It says "IGameObject does not contain a definition for playerCharacter".

Variable = stateSystem["Gameplay"].playerCharacter.variable;

I even created a function in my StateSYstem class which gets gameobjects.

        public IGameObject getGameObject(string stateID)
    {
        return _stateStore[stateID];
    }

This works to get the correct IGameObject, which would be the Gameplay State.

class GamePlayState : IGameObject
{

Character playerCharacter = new Character();

}

But once i have that IGameObject (the GamePlay Game State) I cannot grab the playerCharacter to manipulate it.

Perhaps I am just tired, but I am having a hard time figuring out how to do this without making the Character playerCharacter a global variable, creating in the main game loop.

sentences:
Using movie names in a game I am working out a concept of a game where I want to refer to movies. However, I am unsure if I can just refer to the real movie titles in the game or if I should change them slightly so that it becomes a parody of the movie for liablility / copyright reasons.

I know it is a bit on the risky side when you are using brands etc, but can I be held acountable for indirect damage to the sales of their movie?

Does this change when I use an API from a website (f.e. imdb / TheMovieDatabase)?

sentences:
Creating an Android port of old PC games I have seen some decent ports to Android of old PC games.

The graphics and game engines are the same, and all that seems to have been changed was the key mapping, and adding touch-screen events.

I want to play around with learning how to do this, but I have done a lot of searching online, and haven't been able to find a general overview of how to begin.

What would I to do, or at least, where can I learn how, to take an old, existing PC game, and port it to Android, only changing the key-mappings, and add touch-screen support?

From what I have seen, a native app is created to launch the game, and then from that point, you're just playing the original game.

And I'm not referring to playing games through emulators.  This is something that would be able to be downloaded from the Google App store.  And I would first get rights to do so, of course, unless it was, or has been released as, an open-source game.

sentences:
How to make a more accurate lap time? get_timer() LIMITATION? In the room there are 22 cars. All cars have a different speed.

The cars are numbered from 1 to 22 with the help of the variable carNumber.

CODE - obj_Car / Set car speed (Create Event):

velocity=10-((carNumber-1)*0.01);

Here's how there is a difference in car placement near the end of the lap:

However, even with this difference, the times of many cars are repeated:

The detection of lap time looks like this.

CODE - obj_Car / Time lap (Collision with obj_Finish) :

other.orderLapTime[car]=get_timer()-other.discount;

Discount = this is the exact time when the room starts (cars already start running).

CODE - obj_Finish / Set discount (Create Event):

discount=get_timer();

The display is made with a modifier (multi, to simulate actual track times).

CODE - obj_Finish / Draw time lap (Draw Event):

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i]*obj_Seth.multi/1000000,1,3));

Even taking the multiplication and increasing the number of decimal places, there are still many repeated times:

Some inconsistencies including. Cars with slower speeds marking faster times.

I could slow down the base speed (10) to solve such a problem, but I already think in the long run. The races can't take so long. In addition I intend to give the player the option to set the speed with which the race takes place (a multiplier, more frames, etc).

It could also increase the difference between the speeds (0.01 to 0.05), but I would like a general resolution, so that I can notice through the lap time, if only by one thousandth (0.001).

EDIT 1 - Attempts made based on answers and comments from Bálint and TomTsagk:

That is what I tried to do.

CODE - obj_Car / lap time (Step Event):

unit+=velocity/60*0.001;

Below the results...

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,3));

Respective code:

draw_text(1500,100+(20*(i)),string_format(orderLapTime[i],1,5));

The speed difference between the cars is 0.01.

sentences:
(Pacman) Loading 151 dots (picturebox) in form. What's the easy way? I'm making pacman clone for school project and I'm having a bit of a struggle with loading dots into the map. I want to put 151 dots (picturebox) onto a map to a specific location, so that later on I could check if there is collision between Pacman and dots using function intersectWith.

I feel like this isn't really the most friendly way of doing it, but currently I don't have any other idea.

So, how does one put many picturebox on a form (if there is a way), and put them in array where I could check for intersection.

This is just some brief, probably wrong code, how I'm imagining this to work:

for(int i = 0; i < 151; ++i)
{
    dot[i] = Resources.dot;
    drawingArea.Load(dot[i]);
}

Thank you all!

sentences:
Directional lights (not) rotating with camera (opposite problem) I am trying to implement a shader for directional lights correctly, but I am bit confused as to why it works when it shouldn't and vice versa.

People usually encounter problem with lights changing direction with camera. This is corrected by multiplying normals with model(view) matrix.

But my problem is opposite.

When I don't multiply normals with model(view) matrix then it works and when I try to use (supposedly) correct version it is having that "lights rotating with camera" problem.

Any ideas?

Working vertex shader:

#version 330
layout (location = 0) in vec3 position;
layout (location = 1) in vec2 texCoord;
layout (location = 2) in vec3 normal;

out vec2 texCoord0;
out vec3 normal0;

uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;

void main()
{
    normal0 = normal;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

Fragment shader:

#version 330
in vec2 texCoord0;
in vec3 normal0;
out vec4 outColor;

struct BaseLight
{
    vec3 color;
    float intensity;
};

struct DirectionalLight
{
    BaseLight base;
    vec3 direction;
};

uniform vec3 baseColor;
uniform vec3 ambientLight;
uniform sampler2D sampler;
uniform DirectionalLight directionalLight;

vec4 calcLight(BaseLight base, vec3 direction, vec3 normal)
{
    float diffuseFactor = dot(normal, -direction);

    vec4 diffuseColor = vec4(0,0,0,0);

    if(diffuseFactor > 0)
    {
        diffuseColor = vec4(base.color, 1.0) * base.intensity * diffuseFactor;
    }

    return diffuseColor;
}

vec4 calcDirectionalLight(DirectionalLight directionalLight, vec3 normal)
{
    return calcLight(directionalLight.base, -directionalLight.direction, normal);
}

void main()
{
    vec4 totalLight = vec4(ambientLight,1);
    vec3 normal = normalize(normal0);
    totalLight += calcDirectionalLight(directionalLight, normal);
    outColor = texture(sampler, texCoord0.xy) * vec4(baseColor, 1) * totalLight;
}

Draw method:

glBindBuffer(GL_ARRAY_BUFFER, vbo);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);

glVertexAttribPointer(0, 3, GL_FLOAT, false, Vertex::SIZE* 4, 0);
glVertexAttribPointer(1, 2, GL_FLOAT, false, Vertex::SIZE * 4, (const GLvoid*)12);
glVertexAttribPointer(2, 3, GL_FLOAT, false, Vertex::SIZE * 4, (const GLvoid*)20);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
glDrawElements(GL_TRIANGLES, size, GL_UNSIGNED_INT, 0);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);

Matices:

ViewTranslate = glm::mat4(1.0f);
 cam->control(windowHandle, 0.01, 0.3, true, &ViewTranslate);
 cam->updateCamera(&ViewTranslate);

glm::mat4 Projection =
    glm::perspective(70.0f, 800.0f / 600.0f, 0.1f, 10000.0f);
glm::mat4 view = glm::lookAt(
    glm::vec3(0, 0, 1),
    glm::vec3(0.0f, 0.0f, 0.0f),
    glm::vec3(0.0f, 1.0f, 0.0f)
    );

shader->bind();
shader->setUniform("model", glm::value_ptr(ViewTranslate));
shader->setUniform("view", glm::value_ptr(view));
shader->setUniform("proj", glm::value_ptr(Projection));
shader->setUniform("ambientLight", ambientLight);

Not working shader code:

void main()
{
    normal0 = (model * vec4(normal, 0.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (model * view * vec4(normal, 0.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (model * view * vec4(normal, 1.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

or

void main()
{
    normal0 = (transpose(inverse(model * view)) * vec4(normal, 1.0)).xzy;
    gl_Position = proj * view * model*  vec4(position, 1.0);
    texCoord0 = texCoord;
}

...

Any ideas how I should do this correctly?

sentences:
GJK algorithm in case of circle and polygon? I wonder if it's possible to modify GJK so I can use it to detect collision between circle and n points polygon.
I implemented for polygon and polygon before, and I tried modifying the support function (to get furthest point of a circle), but apparently, this results in infinite loop.
Is this possible to do? do I need to change other thing than the support function? (because I don't see any)

sentences:
Unity. C# help with arrays and letter placement Think about this like "Guess the word" game: W _ _ _ _

I have a word that i separate in index - letters like this:

public static string[] splitWord;
word = "WORLD";

string[] splitWord = new string[word.Length];
for(int i = 0; i < splitWord.Length; i++)
    {
        splitWord[i] = word[i].ToString();
    }

This way when i print the splitWord variable

for(int i = 0; i < splitWord.Length;i++)
    {
         print(splitWord[i] + " " + i);
    }

i get this;

 W 0
 o 1
 r 2
 l 3
 d 4

In my Ui i have letters, when i choose one i check if the letter is in the word, this part is done.

public static void SetWord (string letter)
{
    if (GameController.word.Contains (letter)) {
        word.text += letter; ------>setting the word NOT in order
    } else {
        Debug.Log("Letter is not in the word");
    }

}

What i´m having problems with is to place the letter in the correct place of the word.
What i want to do is, based on this:

 W 0
 o 1
 r 2
 l 3
 d 4

Is to check "ok this letter is on the word, what index in the Word does this letter has?, place the letter in the correct place". That is the idea. but because im pretty new to code in general i m having problems with this.
The idea is to convert that array of stings into a hole string and use Insert() to place the letter in the correct spot.

Any ideas?

Thanks in advance for the help.

sentences:
Quite conflicted on advice given to "learn programming" for game development I have been reading a few sources online that talk about learning programming with the end goal of game development in mind. I have heard many people saying that starting with Unity is the best way to go but others stating that C++ is what you need to get started with in order to be a game developer.

But as far as I'm concerned, this leaves me in quite a dilemma. Am I right in thinking that if I'm not overly fussed about making little indie games at the moment and just want to get stuck in with learning how to program, is C++ the right choice?

I have begun my journey with C++ and I am really enjoying it. I think it is the time further down the line that I am confused about. I am quite unsure on where to turn and what direction to go down to try and do this game development thing.

My end goal isn't necessarily working on an indie game project, I'd much rather aim to work at a gaming company which in my mind is a bit more realistic.

Thank you in advance.

sentences:
Computing pixel's screen position in a vertex shader: right or wrong? I am building a deferred rendering engine and I have a question. The article I took the sample code from suggested computing screen position of the pixel as follows:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition = output.Position;
}

PixelShaderFunction()
{
    input.ScreenPosition.xy /= input.ScreenPosition.w;
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

The question is what if I compute the position in the vertex shader (which should optimize the performance as VSF is launched significantly less number of times than PSF) would I get the per-vertex lighting insted. Here is how I want to do this:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition.xy = output.Position / output.Position.w;
}

PixelShaderFunction()
{
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

What exactly happens with the data I pass from VS to PS? How exactly is it interpolated? Will it give me the right per-pixel result in this case? I tried launching the game both ways and saw no visual difference. Is my assumption right?

Thanks.

P.S. I am optimizing the point light shader, so I actually pass a sphere geometry into the VS.

Solution:

struct PSInput
{
    float2 vPos : VPOS;
};

PixelShaderFunction(PSInput input)
{
    float2 ScrPos = input.vPos*halfPixel*2;

        //The correct Screen Space Texture Coordinates.
    float2 TexCoord = ScrPos + halfPixel;

    //Bonus: getting the world position.
    ScrPos = ScrPos*2 - 1;
    ScrPos = float2(ScrPos.x, -ScrPos.y);

    float4 position;
    position.xy = ScrPos;
    position.z = depthVal; // Read from the depth map.
    position.w = 1.0f;

    position = mul(position, InvertViewProjection);
    position /= position.w;
}

sentences:
How do I configure the clipping region when drawing with XNA's SpriteBatch? I have a SpriteBatch that is set to draw to a RenderTarget2D that is 500 pixels larger in both height and width. Whenever I draw to a point outside of the physical screen dimensions, it will not draw the object.

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

sentences:
How can I architecture the cards and boards of this board game? I want to create a board game (at least it's structure and engine, not the graphics), and since It's the first time I do this I don't know where to start.

It's a turn based strategy card game where cards that act differently, some are placed and moved on the board, some are placed but don't move, and some are played from the hand but not placed on the board.

Well, I don't know how to translate this to code. I thought that I should have a interface for the Cards, but since there are various types of cards that act very differently it doesn't make sense . Then I thought that there should be a class for each Player which stores which of his cards are played, which are left etc.. Something like this:

public Class Player
{
 private List<Card> PlayableCards;
 private List<Card> OutOfGameCards;
}

But there's a fixed amount of cards of each type, so its useless to have a List<T> (besides as I said I don't think I'll have a Card class).
Then How should I approach this? Having the cards as individual variables? It doesn't sound right.

The next thing is the Board, it's formed by 8x8 squares where the cards are placed. How do I identify each placed card with a card in the code?

Maybe something like this:

public Class GameBoard
{
 private Square[][] SquareGrid;
}

If I do it this way its easy to separate each square and access it by it's position (SquareGrid[3][4]=3x4). But do I store which card is in each Square? Or do I store in which square is each card? After that there's a "special zone" outside this board and everything gets more messy.

sentences:
Where should I cast new bullets? Should I

Cast new bullets from my Weapon class, which would test a flag when its updated that tells if mouse left is down, which is set by Input class
Cast new bullets from my Input class, which would call Weapon Cast()

And why?

sentences:
Fixed-Timestep still updating too fast I'm trying to figure out if I'm approaching my simple fixed-timestep implementation correctly, following examples such as: Gaffer (without RK4), and DeWitters

Currently, I have a game object which contains position and velocity data members, with position calculated by

 position = position + (velocity * dt)

However, unless the velocity is set to a value of two decimal places, the update makes the position change in an instant (e.g. Velocity = 0.05 works, but this does not seem logical; to me Velocity should be >0?; even a value of 0.5 makes the update appear instant). Therefore, I have come to the conclusion that I have implemented by game loop incorrectly.

Note, I'm using SDL and C++, however the following is all Psuedocode:

bool quit = false;
World world;

Uint32 frameTime = SDL_GetTicks();
double accumulator = 0.0;
const double dt = 1.0 / 60.0;
int fCount = 0;
while(!quit){
    fCount = 0;
    double newTime = SDL_GetTicks();
    double nextFrameTime = newTime - frameTime;

    if(nextFrameTime > 0.25)
        nextFrameTime = 0.25;

    frameTime = nextFrameTime;  //Line of error, should be frameTime = newTime
    accumulator += nextFrameTime;

    while(accumulator >= dt){
        world.Update(dt);  //A simple counter revealed Update being called 15-16 times during this loop
        accumulator -= dt;
        fCount++;
    }
    //fCount is equal to 15 when dt = 1.0/ 60.0, fCount = 8/9 when dt = 1.0/30.0
    double interpol = accumulator / dt;
    world.Render(interpol);
}

If there isn't any apparent issue with this code then perhaps I have messed up my position/physics calculations based on Update(dt).

Any help is appreciated

sentences:
jQuery - calculate map polygon Width and Height Let's say I have this map:

<map name="diffmap1" id="diffmap1" class="myMap">
<area shape="poly" coords="152,347,253,292,264,307,167,358" class="diff diff1">
<area shape="poly" coords="93,244,164,215,171,233,97,264" class="diff diff2">
</map>

and jquery:

$('.diff').click(function(e){
//code here
});

How can I calculate the maximum height and width of each polygon?

LE: https://www.dropbox.com/s/erplo5fwtp284oh/qwe.jpg

sentences: How to import fbx into XNA? I am developing basic XNA car game. I used 3D fbx car models to represent car objects. I drag and drop all tga and fbx files into content and I succesfully showed car in my game by using some basic codes. But the problem is when I move the car around the components move around irrelevant because some components of fbx model have different X, Y, Z directions according to world. I tried a lot of fbx models but all of it same. Also the colors have not shown on game. What is the solution of this broblem. How can I equal all component axes to game world axes to move around together? Why I can not see the colors of components?

sentences:
Voxel engine/vertexes: how to add more and more different textures during game runtime and change some of the blocks' faces? It's difficult to ask this, but I'll try. The thing is: I asked before somethings about creating ramps and blocks with vertexes. [I'm using C#/XNA.]

Explanation: now I got a chunk that has blocks wherever I want, that automatically change "stairs" into ramps. And I love it and I thank all the people that helped me out! But I don't know how to texture it appropriately.

I could add a Texture Atlas and set the coordinates of each texture (I found the example at a project called "TechCraft Engine"), but I'd like to create separate PNG files for each texture, 'cause I'll use transparency later and I'd like that textures can be loaded during game runtime.

I'm newbie in programming, but I'm searching for solutions. All that I got for now is that I have a custom effect (FX file) created that changes colors for each time of the day. But it only has a slot for one texture file loaded. And I still can't implement it because of that.

I can't add more texture samplers to the effect 'cause it can't be done at game runtime (or can it?)

I'm using the VertexBuffers and IndexBuffers, with TriangleList primitive. For now, I can only draw with colors, without textures.

Later in my game I would like that custom textures could be added and placed on some of the block's faces. A example for this can be found in The Sims 3. There you can add textures to the game and paint the walls and objects with it. It's something like that I'd like to create, but with a loader while playing.

My question is: should I create a VertexBuffer and a IndexBuffer for each texture and separate the vertexes with each texture between them, creating a List of VertexBuffer and IndexBuffer for placing each?... Then I could draw all the vertexes of one texture at a time, change the effect's texture parameter with a different one (call the pass technique again), and set the graphics device again with the next VertexBuffer and IndexBuffer of the list, for drawing it with the TriangleList primitive.

I'd repeat it for each texture loaded. Does it work or is there any other way to do it?

Should I forget about runtime loading for now, for finding a easier solution?

I'm pretty messed with this, do you have any suggestions? Any information will help. Thank you!

sentences:
Optimizing the economy of a resource management game I am an amateur game designer. I am designing a resource management game involving real money. This is my first time designing such a game. I explain the design and mechanics below. I need feedback from experienced game designers regarding:
i) The sustainability of the core economic loop of this game,
ii) Concrete suggestions to de-risk or fine-tune it (if you can think of any)

My game is about digging up treasure. Treasure is real $$$ players can cash out. The objective of the game is to make as much money as possible.
Players utilize digging machines (excavators) to unearth treasure. The attributes of these digging machines are:

Digging prowess: Most machines are mediocre diggers. I.e. they unearth small treasure. A few rare machines can dig up really big treasure. And then there are other types in between these two extremes.
Scarcity: Only a finite number of machines are available in this game world.
Transparency: Machines' visual design varies in accordance to their digging prowess. I.e. players can easily spot which machine is better than the rest.

Main mechanics:
When a new player joins this game, they utilize real $$$ to buy one or multiple such machines. Once bought, each machine can either be:

Stored away (unused), or

Put to work. Note that when a machine accumulates 1 hour of digging time, it unearths treasure. The amount unearthed is always proportional to the machine's digging prowess.

Putting machines to work has an upside and a downside:

Upside: Machines that are put to work unearth treasure (actual $$$ players can claim).

Downside: Working machines can be forcefully bought by another player (for the machine's current value + 5% profit). No permission is needed. This permanently increases the value of the machine. Which means, if you want to snatch it back, you pay a further 5% increment on top of everything.

Storing machines away has an upside and a downside:

Upside: Nobody can forcefully buy them from the player.

Downside: They don't help the player earn anything.

How do we finance the treasure-finds?
There is a pool of money in the back-end that finances each and every treasure-finding. We finance this pool in two ways:

The first time a digging machine is bought, 90% of the proceeds are routed to this pool (10% are pocketed by the game developer).

I earlier mentioned that whenever a machine is forcefully bought, a 5% profit is paid by the buyer to the unwitting seller. We route 10% of that profit to the treasure pool, 10% to the game developer, and 80% to the unwitting seller of the machine.

It would be great to get feedback from experienced game designers regarding the economic viability of the game's core loop. How do we:

Make it sustainable?
What are the economic risks?
How can they be quantified?
Are there any risk-minimization tactics we can bake in?

sentences:
Drawing a dynamic indicator for a field of view My goal is to draw a dynamic indicator for a cube, which represents the field of view. The ideal indicator would look the same as in Metal Gear Solid(the blue ones):

From what I have gathered, I need an angle and a length for the indicator as such for a 50° FoV:

Now my issue is what method should I use to draw the indicator? A procedural mesh or is there a less demanding way of doing this?

sentences:
How to minimize the repetitive creation of component in libgdx ashley? The below example is creation of character Entity. My problem is do I always need to call these engine.createComponent(...class) to create a component? Or should I wrap these to another class that handles the creation of entities?

PooledEngine engine = new PooledEngine();

...

CharacterComponent character = engine.createComponent(CharacterComponent.class);
TextureComponent texture = engine.createComponent(TextureComponent.class);
SizeComponent size = engine.createComponent(SizeComponent.class);
TransformComponent transform = engine.createComponent(TransformComponent.class);
PhysicsComponent physics = engine.createComponent(PhysicsComponent.class);

Entity entity = engine.createEntity();
entity.flag = Constants.CHARACTER;

entity.add(character);
entity.add(texture);
entity.add(size);
entity.add(transform);
entity.add(physics);

engine.addEntity(entity);

sentences:
What are some easy to use 3D painting programs? I'm looking for an (easy to use) "3D painting" program, a program that lets me load up a UV-mapped mesh, some textures and lets me 'paint' with those different textures.

Exactly like all those terrain painting programs (Unity 3D has one integrated for example) but for a generic mesh, not just a height map.

Cheap is better of course but ease to use is the most important.

Script support is a big plus though.

sentences:
Unhandled exception at 0x0FE62707 (sfml-system-d-2.dll) So, turned on my pc today thinking I we're gonna continue making my game but got denied by this error.

Have no idea how to fix it and why it's there at all, I haven't touched my project properties in days.

I start my game, he console pops up and just when I can see my games window blink it crashes and gives me this error :

  Unhandled exception at 0x0FE62707 (sfml-system-d-2.dll) in SFML_Game.exe: 0xC0000005: Access violation reading location 0xCCCCCCD8.

It crahes at the 2nd line of SFML code it goes trough, which is :

sf::RenderWindow window(sf::VideoMode(1200, 840), "SFML - Box2D Engine 1.0");

And the first line being this :

sf::Clock deltaClock;

sentences:
Animation is too fast I have an animation of a bullet but it seems to be going much faster than i was expecting.

I currently set it to 0.5 pixels per second yet it seems to be moving way over hundreads of pixels per second.

Not quite sure where my logic is going wrong:

This is inside my gameLoop which im using to calculate it:

var deltaTime = (new Date().getTime() - started) / 1000; // divide to get seconds
var position = deltaTime * bulletVelocity; //bulletVelocity is 0.5

var vectorX = destinationX - startX;
var vectorY = destinationY - startY;
var distance = Math.sqrt(vectorX * vectorX + vectorY * vectorY);

var x = startX + (vectorX * position);
var y = startY + (vectorY * position);

if (x < destinationX && y < destinationY) {
    ctx2.drawImage(pulse, x, y); //draw the sprite on canvas
}

Have i got my logic wrong here i cannot work out why its moving so fast.

sentences:
Is it ok to commit to git while my Unity project is still open? I tend to have big commits and it is related to me being tool lazy to close Rider and Unity, commit changes and then start both programms back up to make changes and repeat. I just assumed that this is the correct way of doing it, but is this even the case?

Thanks in advance!

sentences:
Suggestions to start a cross-platform project I have a big project in my head, it should be cross-platform (Win, Max and Linux), online (Client - Server) and with 3D graphics. I would like some suggestions to start with the right things.

Currently I'm a PHP/MySQL coder, I used to code in C and Pascal on DOS ages (Borland Times ;)), my C knowlegde need a refresh but it's ok.

I guess C++ it's the right language. What platform and what i should use to code? I can choose from all three platforms. My idea was to use Visual Studio 2010 C++, but i'm not sure if it support Native code.

What kind of libraries should i use? I guessed OpenSSL for the login, OpenGL for graphics part. For the Audio or the GUI?  Any other suggestions are well accepted.

I know it's a "BIG DEAL" but I have no rush and it'll be a free-time project, only for my pleasure.

Thank you in advance.

sentences:
How can I clean up excessive player-created rubble? In my latest game I'm making, you can slice a 2D object arbitrarily, demonstrated in this gif:

You can continuously cut it into hundreds or thousands of pieces. This doesn't create a lot of lag, because they're always in a sleeping physics state, but there's a problem when you cause them to move.

I'm not really sure how to deal with making it so there's not so much rubble from cutting something apart. I don't really want to delete them after a certain amount of time; I don't like how, if you go back to something you cut up after a while, it randomly disappeared.

How can I clean up excessive player-created rubble?

sentences:
If SpriteBatch.Draw's SourceRectangle is null does a rectangle still get created? If you use the following SpriteBatch.Draw overload, does a Rectangle get created for the texture?

spriteBatch.Draw(texture, textureRectangle, null, Color.White, 0f, textureOrigin, SpriteEffects.None, 1f);

If so how would you access the Rectangle?

sentences: 2-D character not falling to the ground I am very new to Game Development and I am making a game with a simple Ragdoll which has a body, a head, and 2 limbs(hands). The head and the limbs are hinged to the body and I have kept the Ragdoll above a cube to be used as the ground on which the Ragdoll falls. Till now, I haven't added any scripts for movement or anything, I just want my Ragdoll to fall on the cube below it properly. But when I click play, the Ragdoll just starts to float above its original position. When I move it through the editor away from the cube(ground), it does fall down. It's like the cube is opposing the downward acceleration of the Ragdoll. The Ragdoll won't land on the cube. All the bodies have Rigid body and collider scripts. The Ragdoll also doesn't disassemble, it manages to keep itself together. Can someone please tell me what I am doing wrong. I researched about this but I have found no solution. I am using the free version of Unity.

sentences:
Unity sprite with higher sorting layer not firing its OnMouseDown function I have 2 objects, both have a Box collider 2D.

The first object is on the Level1 Sorting Layer and has a Tile script attached to it.

The second object is on the Level0 Sorting Layer and doesn't have any scripts.

The Tile script code is as follows:

void OnMouseDown()
{
    Debug.Log(Input.mousePosition.ToString());
}

Whenever I click the top tile, nothing prints in the console unless I click on the red area like I show in the image below (red area = [first box collider] minus [the two box colliders intersection area]).

Why this happens ? Why doesn't the OnMouseDown() function fire up simply when you click on its collider, since the top tile is on a higher sorting layer than the bottom tile. How does this work ? Doesn't sorting layer affect the 2D box collider ? (If I change the Z-axis of the top tile to -1, while keeping the bottom tile to 0, it works as expected.)

sentences: How can I rotate a Texture2D into / out of the screen? I am drawing a Texture2D onto the screen and have the need to rotate the texture forward, in a 3D way.  I'm using the SpriteBatch Draw() method and it only allows limited 2D rotation around the Z axis.  From tons of research online I have boiled down the solution to passing either an effect or matrix to SpriteBatch's Begin() method; however, after many hours of trial and error I haven't come up with anything working.

sentences:
How to sync random incidents over network? In my Photon powered game, I have a shotgun weapon and when a player fires a bullet, I call an RPC on other clients and it's bullets get direction from a random function, Random.Range, and on different clients it acts differently.

How can I sync this so in every client, the bullets behave the same, i.e. in this case they would have same directions?

I tried setting the same seed via Random.Seed but it didn't help.

sentences:
Particle Turbulence Effect in Babylon.js Is there any way to implement a turbulence effect in a babylon.js Particle System? I know that its possible to use physics engines on mesh objects, but I've not seen any discussion of using them on a babylon particle system.
Might there be a way to bake a particle system as a .vdb and import it if real-time simulation is not an option?

sentences:
How can I create a world map like Mario 3's? I want to create a world map similar to the type that Mario 3 on NES uses

where Mario can walk between levels (nodes?) by pressing up, down, left and right on the controller, and Mario can only pass through a level when it has been cleared.

What I have so far is a list of level nodes:

std::vector<SLevelNode*> NodeList;

struct SLevelNode
{
    CVector2D Position;
    CVector2D Size;
    CVector2D Origin;

    int ID;
    int Type;

    SLevelNode* pNeighbourNode[4];
};

The level node contains stuff like position, the type of level node (ground level, water level, castle level and so on). It also contain a neighbor node array, which in my case is 4, since I want the player to, eventually, be able to walk from a level node in all four directions. A level node might only have two ways of travel though, left and right for example.

Besides the level node, I also have a path piece, which is a piece of road between the level nodes:

struct SPathPiece
{
    CVector2D Position;
    CVector2D Size;
    CVector2D Origin;

    int Type;

    float Rotation;
};

The type variable is either a horizontal piece, a curve piece, a bridge piece and so on.

So far my character can walk between the level nodes by dragging a 2D vector between them, that the player traverse with. I want, however, the player to start walking from a level node, walk through the road pieces (between the nodes) and end up at the goal level node.
I'm not sure how to make the level nodes "know about" the road pieces that is placed between the start node and the goal node. Have a list of path pieces in each level node?

I have though about using A* and make a path finding map but it feels like it's over-complicates things.

I would like some help on how to achieve this.

sentences: VR Camera and Hands height Using the Oculus Rift S, I just added OVRCameraRig and LocalAvatar or OVRPlayerController and when I press play I feel like I'm not as high as I want in my vision and hands, I change the position of Y of objets to make it more higher, but it affects to everything, my guardian setup floor goes more high too and it does not match with my floor. What can I do to solve this? What should I change or modify?

sentences:
Why are 2D game tiles often lit from the top left? I have been in to game programming for some time now, and recently ventured out in to trying to create my own pixel art. So I have learned the basics of lighting and shading etc. and noticed that several games will light their tiles from the top left. Such as Super Metroid and Axiom Verge highlighted in red here:

I assume because there is no distinct light source, one was chosen and consistently applied everywhere where possible?

Why does it tend to be the top left, is it to do with westerners reading left to right, top to bottom perhaps?

And bonus question, what is the reason behind the opposite side shading shown in the blue circle in Axiom Verge?

sentences:
The name 'txt' does not exist in the current context I am getting the error The name 'txt' does not exist in the current context and I am unsure why this is happening. I am very new to programming in C# so sorry if the answer is obvious. I am trying to make my ammo count change on screen and have been told to use txt.GetComponent<UnityEngine.UI.Text>().text = ammo.ToString(); but that gives me the error and I am unsure why. This code is supposed to spawn in bullets for my gun but that part of the script is not important. The problem is that error. If you could tell me what the problem is that would be greatly appreciated.
Here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;

public class PL : MonoBehaviour
{
    public GameObject bulletPrefab;

    public Camera playerCamera;

    private Coroutine hasCourutineRunYet = null;

    public int ammo = 165; // 65 enemies in total, needs tons of ammo
    public GameObject axe;

    public Text Ammmo;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (hasCourutineRunYet == null)
            {
                hasCourutineRunYet = StartCoroutine(BulletShot());
            }
        }

        if (ammo == 0)
        {
            GameObject.Find("wp_shotgun").SetActive(false);
            axe.SetActive(true);
        }

        txt.GetComponent<UnityEngine.UI.Text>().text = ammo.ToString();
    }

    IEnumerator BulletShot()
    {
        GameObject bulletObject = Instantiate(bulletPrefab);
        bulletObject.transform.position = playerCamera.transform.position + playerCamera.transform.forward;
        bulletObject.transform.forward = playerCamera.transform.forward;
        yield return new WaitForSeconds(1.0f);
        hasCourutineRunYet = null;
        ammo--;
    }
}

sentences:
Tween animation with Universal Tween Engine LIbGDX Let me preface by saying that I'm new to libgdx...

I have an animation that I'm currently drawing to the screen using:

game.batch.draw(flyAnimation2.getKeyFrame(elapsedTime, true), 200,200,0, 0, 124, 90, 1.0f, 1.0f, 90);

Where flyAnimation2 is:
   Animation flyAnimation2;

This works correctly.  I now want to use UniversalTweenEngine to tween it from one side of the screen to the other.

I can't find any decent documentation on how to achieve this affect using an Animation.  Any help would be appreciated!!

sentences:
To what extent it is legal to declare support of third party commercial products' assets? Is it legal to say that MyGame supports other (specific) games' textures, sounds and models?

I'd like to get involved into an open source game project and implement support for Quake's weapon models (for example), but the owners of the project don't know about the legal aspect of it, so I'm asking here.

sentences:
isometric background that covers the viewport The technique I use now is a loop with an innerloop that draws images on a canvas element, but it looks like a rotated square.

This is a nice example that covers the whole viewport.

I have read something vague about clickthrough maps? What kind of techniques are there that are most efficient with mobile devices and javascript?

Edit

I other words, howto create a grid, in HTML5 that looks like the picture above, where you can place elements on. ( in the picture, it is the garden ) If it's not isometric, what is it and can it be created in html5. What I use now, creates a repititive background.

function draw() {

    c.clearRect(0, 0, canvas.width, canvas.height);

    for (var row = 0; row < 10; row++) {
        for (var col = 0; col < 10; col++) {

            var tilePositionX = (row - col) * tile.height;

            // Center the grid horizontally
            tilePositionX += (canvas.width / 2) - (tile.width / 2);

            var tilePositionY = (row + col) * (tile.height / 2);

            if (tileMap[row] != null && tileMap[row][col] != null) {
                tilePositionY -= tileMap[row][col].height - tile.height;
                tilePositionX -= (tileMap[row][col].width / 2) - (tile.width / 2);

                if (!(tileMap[row][col] instanceof BuildingPortion)) {
                    c.drawImage(tileMap[row][col].texture, Math.round(tilePositionX), Math.round(tilePositionY), tileMap[row][col].width, tileMap[row][col].height);
                }
            } else {
                c.drawImage(tile, Math.round(tilePositionX), Math.round(tilePositionY), tile.width, tile.height);
            }
        }
    }
}
}

thanks

sentences:
What are some alternative options for saving level data for a game like Hurtworld? For a multiplayer building/crafting game like Hurtworld (where the player can build structures on the map), what are some alternative options or example data structures for saving the world data on the server?

Level data including:

Grid of squares that foundations can be built on, with a flag to indicate whether the square is empty or already has a foundation
Walls etc which have been built on the foundations, and multiple floors above
Windows/doors which can be built on window frames/door frames
Furniture/machines which can be placed on foundations/floors
Other dynamic world data such as trees, animals, chests with items, etc

I feel like it's too much data to store in a database. Am I wrong?

If it can be stored in a database, how can I get my head around the data structure I would need to set up? Is there some simplified example?

Can each square in the world grid be represented by 1 row in the database? And should there be a new row for each structure built on a square, with that row referencing the square/structure that it was built on?

sentences: Server Client position information exchanging I am doing small game in xna client/server, there can be 50f per seconds, but i don't belive that each client has to sent 50 mesagges about only their position, and then get back from server, regular ping is 50ms so even if 20 messages per second then success, so how it is made that everyone see immediately that someone else changed its position?

sentences:
Game (X-Plane) boot/startup time / performance I use X-Plane for my question but it also concerns probably every other flight-simulator or simulation game in general. When developing a plugin what bothers me most is the startup-time of the application to test my plugin functionality so I was wondering how I can improve the startup speed of the simulator.

First I removed all additional scenery and reduced the loaded files to a minimum which gave me a startup time of 34 seconds which is quite fast already.
To improve the time even further I thought it would make sense to run the whole application from memory and I installed ubuntu 64-bit and created a 2GB tempfs filesystem in memory (ram-disk).

When starting x-plane from this memory file system it still takes 30 seconds. Can anyone explain what the application does during startup which needs so much processing time?

I assume that the graphic bitmaps for the object and the environment are compressed on disk and therefore they have to be decompressed in memory first before they can be used in opengl. This would explain the time spent on startup.

If it is true that the bitmaps need to be decompressed first would it be possible to improve the time by using multiple cores? If the application is multithreaded and there are four cores would the time be divided by four or does this processing happen on the GPU?

Any explanation which helps me to better understand the startup-process of a computer game is really appreciated because I'm interested in improving the overall performance of the system and therefore I need a better understanding of the bottlenecks (RAM, CPU, GPU, Disks (SSD/Raid), OS, libraries, ...).

sentences:
How to Create a New Instance of a Game Object Alright, please don't scald me here haha. I'm very new to XNA, C#, and game development as a whole. I have done web-design, but that is my main experience with programming. It is a Space Invaders type-ish game.

In the code below I have a Meteor class. In this class I want to create a meteor in a random location (on the X-axis) and then have it fall. I don't care much about it doing damage - yet.

I can always get one meteor created, and falling, yet when I press 'M' to create another instance of the class it isn't creating another meteor. I could very possibly be going about this entirely wrong...please forgive me if I am.

  class Meteor
   {

    private Random randomNumber = new Random();
    private Rectangle position;
    private int fallSpeed;
    private double damage;
    private int x, y = 0;
    private int WIDTH, HEIGHT;

    // List to hold meteors created (holds instance of Meteor class)
    List<Meteor> meteors = new List<Meteor>();

    // Texture for the meteor

    private Texture2D meteor;

    /// <summary>
    /// Create the meteor and each meteor's properties
    /// </summary>
    public Meteor()
    {
        HEIGHT = randomNumber.Next(0, 60);
        WIDTH = HEIGHT;
        fallSpeed = randomNumber.Next(0, 10);
        damage = fallSpeed * 2;
        x = randomNumber.Next(0, 600); // Randomly generates where meteor will spawn on X axis
    }

    public void createMeteor()
    {
        meteors.Add(new Meteor());
    }

    /// <summary>
    /// Load content (graphics) relating to the meteor
    /// </summary>
    public void LoadContent(ContentManager Content)
    {
        // Load meteor texture
        meteor = Content.Load<Texture2D>("Sprites/meteor");
    }

    /// <summary>
    /// Update the meteors position
    /// </summary>
    public void Update()
    {
        //Update position of metoer (falling)
        y++;

        // Testing purposes mostly...I want meteors to be created when I press 'M'
        if (Keyboard.GetState().IsKeyDown(Keys.M))
        {
            createMeteor();
        }
    }

    /// <summary>
    /// Draw the metoer (and it's new position).
    /// </summary>
    public void Draw(SpriteBatch spriteBatch)
    {
        position = new Rectangle(x, y, HEIGHT, WIDTH);
        spriteBatch.Draw(meteor, position, Color.White);

    }

    // So I can get the damage
    public double getDamage() { return damage; }
}
}

sentences:
Sprite and Physics components or sub-components? I'm taking my first dive into creating a very simple entity framework. The key concepts (classes) are:

Entity (has 0+ components, can return components by type)
SpriteEntity (everything you need to draw on screen, including lighting info)
PhysicsEntity (velocity, acceleration, collision detection)

I started out with physics notions in my sprite component, and then later removed them to a sub-component. The separation of concerns makes sense; a sprite is enough information to draw anything (X, Y, width, height, lighting, etc.) and physics piggybacks (uses the parent sprite to get X/Y/W/H) while adding physics notions of velocity and collisions.

The problem is that I would like collisions to be on an entity level -- meaning "no matter what your representation is (be it sprites, text, or something else), collide against this entity." So I refactored and redirected collision handling from entities to sprite.physics, while mapping and returning the right entity on physics collisions.

The problem is that writing code like this.GetComponent<SpriteComponent>().physics is a violation of abstraction. Which made me think (this is the TLDR): should I keep physics as a separate component from sprites, or a sub-component, or something else? How should I share data and separate concerns?

sentences: Getting the rightmost point of gameobject How do i determin the point on a gameobject that is most to the right (highest x value).

sentences:
How to add a ramp in a flash game? I am a huge novice and this isn't really a programming question, but here I go, say I want to make a game that involves rolling up a ramp like this one:

to move upwards, similar to how it would work in an old Sonic the Hedgehog game or something, how would I go about doing that, where could I find a good recourse to learn this?

sentences:
Isometric Building Placement I have my isometric world represented by isometric tiles. If I were to allow the player to place buildings on any of the tiles how would I get this funcitonality to work?

I was thinking if I could add a MouseListener to the images?

sentences: Asteroids Ship Movement I have read source code of asteroids game. I want to know why when updating the ship's position in X, and Y Axis, we must write it in sin and cosine of the current angle. Is it angular velocity ? why we can't use linear velocity and update the position by a linear velocity?

sentences:
How do I lerp between values that loop (such as hue or rotation)? View Demo

I'm trying to make the joint rotate smoothly around the center of the canvas, toward the angle of mouse pointer. What I have works, but I want it to animate the shortest distance possible to get to the mouse angle. The problem occurs when the value loops around at the horizontal line (3.14 and -3.14). Mouseover that area to see how the direction switches and it takes the long way back around.

Relevant Code

// ease the current angle to the target angle
joint.angle += ( joint.targetAngle - joint.angle ) * 0.1;

// get angle from joint to mouse
var dx = e.clientX - joint.x,
    dy = e.clientY - joint.y;
joint.targetAngle = Math.atan2( dy, dx );

How can I make it rotate the shortest distance, even "across the gap"?

sentences:
Unity Texture Problem http://www.gfycat.com/FlawedLimpingGrizzlybear
http://www.gfycat.com/UnawareQuerulousHawk

Every texture and shader has the same problem. It seems like the problem has nothing to do with either.

Tried all the things my friends suggested I should, reimported everything, restarted my machine, nothing seems to work.

sentences:
Gesture Recognition Strategies Working with the Wii I often find it necessary to recognize simple gestures, so far I've been able to mainly look at magnitude of acceleration in order to recognize the gestures called out for in our game design documents, but I'd like to create a more robust system that allows "recording" of example gestures and recognition of complex gestures.

What strategies have you used in the past? Why did they work? Why didn't they work? What would you do differently?

sentences:
samplerCubeShadow and texture offset I use sampler2DShadow when accessing a single shadow map. I create PCF in this way:

result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(-1,-1));
result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(-1,1));
result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(1,1));
result += textureProjOffset(ShadowSampler, ShadowCoord, ivec2(1,-1));
result = result * 0.25;

For a cube map I use samplerCubeShadow:

result = texture(ShadowCubeSampler, vec4(normalize(position), depth));

How to adopt above PCF when accessing  a cube map ?

sentences: Playing a video in AR using Vuforia and Unity 5 I am trying to play a video in augmented reality using Vuforia and Unity5. I followed a few videos but I am still not able to play it. Can anybody help? I get the "error texture icon" instead of the play icon.

sentences:
Can I use fonts under C:\Windows\Fonts for text in my game? I'm using Unreal Engine and their UMG system which comes with only one font by default ("Roboto").

The engine allows importing new fonts so I'm wondering whether I can use the fonts already available with Windows 10 under C:\Windows\Fonts. I know I can't redistribute these fonts but does merely including text (which uses the font) in a game and distributing the game count as distributing the font? I mean it's not like the TTF file is being given away with the game in its raw form.

I've read these two related questions but I'm still not 100% sure so I thought I'd ask this forum.

Main menu fonts and logos are all I care about right now, so I could just create these as images in Photoshop and bring them into the engine (that sounds perfectly safe, right?)

All in all, I never imagined getting a nice looking font for one's game could be so time-consuming!

sentences:
onClickListeners not working correctly (conflicting) In my pause dialog, the exit is working correctly, but the resume isn't, if I press resume 3 times, the third time it's going to exit.

ImageButton btnPlayOn = UIFactory.createButton(txtrPlayOn);
btnPlayOn.setSize(40, 40);
btnPlayOn.setPosition(75, 75, Align.center);
dialogP.addActor(btnPlayOn);

ImageButton btnEndGame = UIFactory.createButton(txtrEndGame);
btnEndGame.setSize(40, 40);
btnEndGame.setPosition(75, 55, Align.center);
dialogP.addActor(btnEndGame);

btnPlayOn.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("resuumeeeeeeee");

            }
        });

        btnEndGame.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("exiiiiiiiiit");

            }
        });

I think I know why, it's because both buttons have the same x so the listener is getting confused. Anyhow I don't know how to fix it.

sentences:
Is it possible to use Java as a scripting language? Is it possible to use Java as a scripting language for a C++ engine/game?

I understand that you need to make a binding to the interpreter, but I haven't seen any around.

sentences:
AS3: Using singletons for sound managers Is it necessarily a bad thing to use a singleton for a sound manager?

I am having a really tough time determining whether or not I should go ahead and use a singleton (which is easy/it works) or if I am shooting myself in the foot by deviating away from good OOP principles (since a singleton is basically a glorified single-instance global variable of sorts).

sentences: How to get elapsed time of keypress? I need to be able to determine how long a key has been held down with high accuracy. For example if they key tapped really fast it could report a time that is less than the time for each update frame.

sentences:
How to edit key-value pairs (like a Dictionary) in Unity's inspector? I have a spell system I am creating, the principle is as follows:

Each spell is an autonomous prefab. It contains a script with some properties (base damage, duration...) that can be modified in the inspector.
I have a Spell enum listing all possible spells in the code, which is used in the game logic
When I want to cast a spell, I need to be able to get this spell's prefab to instantiate it and read its informations
Each actor (be it players or enemies) needs to have a list of possible animations for the spells

The problems with how I am trying to implement are:

For listing each actor's animations I could use a Dictionary<Spell, Animation>, but dictionaries aren't supported by the inspector which makes it hard to easily edit multiple actors type.
I need some way to easily access a spell prefab from the corresponding enum. Here too I could use a dictionary but I can only reference to prefabs in the inspector, not in code, meaning I wouldn't be able to fill this dictionary

I am looking for a way to easily associate my spells enums to the corresponding prefabs and animations

sentences:
Get Closest point between a Box 3D and a Point I have a point A (x, y, z),
and a Box: Center (x, y, z), Size (Width, Height)

How to get the closest point in the box from the point A ?

In Unity I can create a bound, and I can find the non-rotated position like that:

Bounds bounds = _mesh.bounds;
Vector3 closestPoint = bounds.ClosestPoint(pointA);

But then If the bound is rotated, the result is not correct.
So I have 2 options:

Find the way to rotate my closestPoint from the pivot.
Find the math formula myleft.

If someone can help ! thanks.

EDIT: here a video:
the red point is the one find with bound.ClosestPoint
the yellow point is the one find with:

Vector3 closestPointInverse = _currentTarget.InverseTransformPoint(closestPoint);

https://youtu.be/RMRRtSaJv8w

I have also tryed to do my own rotateFromPivot function:

public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
    {
        return Quaternion.Euler(angles) * (point - pivot) + pivot;
    }

When I use it, I get the same result with the InverseTransformPoint method.

sentences:
How to send an int array and struct via ENet? I've been using the ENet library for networking and so far it's been working ok. I have established a connection between my client and server. On the client side all it does is send all user input to the server. On the server side I have an array int map[24][24] that stores all of the map tiles. I also have a struct for each player. After I get all of the user input, do all the calculations, and update the map, how would I send the map back to the client? Right now the function I've been using supports sending chars. Would I convert my int array and struct objects to char and send them? How should I accomplish this, also should I send the map and player structs in one packet, or send each in a separate packet? This is my first to experimenting with multiplayer so I apologize if this is a simple mistake or stupid question.

This is my function for sending packets:

void send_packet(int channel, char pack[11]) {
    ENetPacket *packet = enet_packet_create(pack, strlen (pack) + 1, ENET_PACKET_FLAG_RELIABLE);
    enet_peer_send(peer, channel, packet);
    enet_host_flush(host);
}

sentences:
How can I stop my collision detection from registering multiple times per frame? I am working on a side-scroller shooter right now. Everything is working fine along with the collision detection however, my problem is that the collision triggers my health deduction code multiple times per bullet. Here is the code where the bullet hits a turret. Supposedly doing 5.0 damage but instead it randomly does a lot more damage since the collision runs multiple times with just one bullet. How could I prevent this?

void TurretCollision()
{
 int BulletNo = 0;
        int MissileNo = 0;

for (BulletNo = 0; BulletNo < MAX_BULLETS; BulletNo++)
{
    if (Turret[1] == true)
    {
        //cout << TurretH[1];
        if ((BulletX[BulletNo] >= 103 && BulletX[BulletNo] <= 103.09) && (BulletY[BulletNo] <= -38 && BulletY[BulletNo] >= -45))
        {
            BulletActive[BulletNo] = false;
            TurretTrial = TurretTrial - 5.0;

            if (TurretTrial <= 0.0)
            {
                Turret[1] = false;
            }
        }
    }

}

}

sentences:
Questions about Jrpg NPC events (Unity C#) So, I'm trying to wrap my head around something. I've got my basic quest system up and running for my rpg style game.

Right now I'm taking a look at NPC events and triggers that as I see it have two distinct styles

The classic floor panel trigger that rpg maker uses or
have a listener class for quest active / event active

My questions are thusly what's the best way to go about activating the event and what's a good way to define the event? Like set movement patterns etc would it be feasible in json? Or should I use scriptable objects?

sentences:
Playing different particle effects in Unity on the same ParticleSystem The question really sums it up: What is the best way to use one particle system for playing different particle effects?

The scenario: GameObject is picked up and it starts playing a simple indicator particle effect. If the GameObject is placed on a special platform it will play another particle effect.

I have very little experience with particle systems - how would you do this?

sentences:
Unity3d Rigidbodies overlap even at low speeds I have an issue that I can't solve. There are many questions relating to similar issues and they come down to "change some settings" and "object is travelling too fast". My problem doesn't seem to equate to either of these.

I am running through the basic tutorial for the Breakout Game and have added some of my own tweaks to the code, my issue is that even at low speed my ball overlaps with the bricks, rather than bouncing off them.

I have read various related questions but nothing seems to fix this for me.

Things I've done:

Set Project Settings >> Physics2d >> Maximum penetration For Overlap = 0.0001
Set Ball RigidBody Collision detection to "Continuous Dynamic" .
Set Brick RigidBody Collision Detection to "Continuous"
Forced a speed limit on the ball of 25 15. Which I think is not fast at all, as most the given solutions are talking about situations arising when the offending object is travelling at much higher speeds.
Bricks are standard rigidbody cubes and ball is a standard rigidbody sphere.
According to this answer I have also set the rigidbody interpolation to "interpolation" for both ball and bricks. But this seems processor expensive and doesn't solve the issue.
As well as set the Project Settings >> Physics >> Solver Iteration Count to 25. This does seem to have helped somewhat (ball no longer gets "stuck" inside brick wireframes, but still overlaps).

Below are some screenshots of my issue and my code.

The only aspect that I can't fully account for is that I've added an acceleration function so when ball is launched it accelerates over a course of several seconds to it's max speed. It's start speed is 8 (although the force applied is actually 1000 when launched, ignore that figure), and the max speed is set to 25 15. I don't know enough to say if this is somehow "breaking" rigidbody overlap detection but it seems pretty silly if so. See line 63 below:

Ball Source Code:

using UnityEngine;
using System.Collections;

public class Ball : MonoBehaviour {

    public float initialVelocity = 500f;
    public float accelerationSpeed = 5f;
    public float MaximumSpeed = 15f;
    private Rigidbody rb;
    private bool ballInPlay = false;

    void Awake () {
        rb = gameObject.GetComponent<Rigidbody>();
    }

    void Update () {
        if (Input.GetButtonDown("Fire1") && ballInPlay == false)
        {
            transform.parent = null;
            rb.isKinematic = false;
            rb.AddForce(new Vector3(initialVelocity,initialVelocity,0));
            ballInPlay = true;
        }
    }

    void FixedUpdate ()
    {
        /***
         * Gradually increase ball speed
         ***/
        if (ballInPlay == true && rb.velocity.magnitude < MaximumSpeed)
        {
            speedUp();
            Debug.Log("Ball Speed is "+rb.velocity.magnitude);
        }

        /***
         Clamp to maximum speed
         ***/
        if (ballInPlay == true && rb.velocity.magnitude > MaximumSpeed)
        {
            rb.velocity = rb.velocity.normalized * MaximumSpeed;
        }

    }

   //     rb.velocity.magnitude

    void speedUp()
    {
        /***
         This is line 63:
         ***/
        rb.AddForce(rb.velocity.normalized * accelerationSpeed,ForceMode.Acceleration);
    }

}

Why are the rigidbodies not detecting and preventing overlap?

sentences:
Check if all gameobjects are destroyed I am making a shooting game, where I have a countdown as I destroy enemies. I want to implement logic when all the game objects are destroyed within the given time, and the countdown reaches zero.

How do I do that?

sentences:
Bevel outline algorithm in 2D I'm writing a program that creates animated blobs in 2D, to simulate cells. In order to beautify these objects, I'd like to give them a 3D look by adding a bevel-effect. How can this be achieved?

Program as it looks now (the blobs are animated, move, change shape etc):

And this could be a potential desired outcome:

I underscore that I'm not using anything else than GDI+, so I'll have to write the implementation myself. Virtually every graphics program has some kind of beveling filter, but I've looked high and low online to find examples of such code.

Edit:

I was testing a few theories, and this one could work. However, it's not my most optimal solution (even though Gaussian blurs can be made linear using separable kernels) and I have another in the working. Anyway, this could be a first attempt at a fast beveling algorithm:

The result in the picture I created above is the direct outcome of the steps of the algorithm, but I suspect it might run too slow for 25fps.

sentences: How can I get Unity to do letterbox/pillarbox to maintain aspect ratio? I'd like my game to have the same aspect ratio at all cost, including keeping all UI elements fixed in the same place. I'm totally ok with losing screen space in the interest of fixing the aspect ratio.

sentences:
Real-time multiplayer game server development I'm an Android developer, and I want to start developing a real-time multiplayer game, like Pocket Legends.

Would this type of server be good for a real-time multiplayer action game - http://systembash.com/content/a-simple-java-udp-server-and-udp-client/?

I'm absolutly new to server development, so it would be great if you explaind even more about this stuff ...

sentences:
How to display height information in tilemap I want to create a hexagonal tilemap and show regions of different height in the same screen. What ways can you think about to indicate which height a tile is on. (current, lower, higher?)

Several tilemap games avoid this by having special mountain tiles, but that allows for ~2 heights and I would like for more differentiation.

Another approach is to just draw the tiles of current height, but this does look very strange if the map is very bumpy (lot's of holes).

I have not found a nice way to whiten or blacken tiles that are lower or higher than the current viewpoint.
Any ideas?

sentences:
How to get local point inside a body where mouse click occurred in box2d? I need to find out the point inside a body, lets say a rectangular object, where the mouse was clicked on. I'm makin a game where the force will be applied depending on where the mouse was clicked on the body. Any ideas?

Will body.GetLocalPoint(b2vec2) work?  I tried by passing the mouse coordinates when the click occurred when inside the body but if the body's position is (400,300) in world coordinates then for trace(body.GetLocalPoint(new b2vec2(mouseX,mouseY)).x); I get some value between 380 to 406 or something (eg. 401.6666666). I thought getLocalPoint will give something like x=-10 when clicked to the left of the centre of body or x=15 etc when clicked to the right.

Language is As3 btw.

sentences:
What is the correct way to draw layered Sprites in modern OpenGL? So what do I mean by layered sprites? Layered Sprites are Sprites that consist of multiple layers, e.g. you have sprite sheets for the basic Body, the Head, Clothes, Weapons, etc.

Well now I wanted to know how you would draw this in the most efficient way; right now the idea is to use vertex buffer objects (VBOs), but I heard that it is expensive to change the textures in a VBO...

So what would be the correct way to draw them? My idea right now would be to draw the Map tiles first (with a texture atlas), then I would draw all the basic bodys, then the heads, then clothes, and then the weapons. Would that be the best way or is there a more efficient way?

I also thought of using vertex arrays instead of VBOs, but as far as I know they are deprecated...

sentences:
How to obtain "gravity" and "initial impulse" given "desired time to reach max height" and "desired max height"? I'm developing a 2d fighting game, using time steps based on frames ie, each call to Update() of the game represents a frame so, no variable time at all.

My jump physics code doesn't need to consider delta time, since each Update() corresponds exactly to the next frame step. Here how it looks:

double gravity = 0.78;
double initialImpulse = -17.5;

Vector2 actualPosition;
double actualVerticalVelocity;

InitializeJump() {
    actualVerticalVelocity = initialImpulse;
}

Update() {
    actualPosition.Y += actualVerticalVelocity;

    actualVerticalVelocity += gravity;
}

It works great and results in a smooth arc. However, it's hard to determine the values for "gravity" and "initialImpulse" that will generate the jump that I want.

Do you know if it's possible to calculate the "gravity" and "initialImpulse", if the only known variable is the "desired time to reach max height" (in frames) and "desired max height"?

This question should lead to the answer I'm looking for, but its current answer does not fit my needs.

UPDATE:

As @MickLH figured me out, I was using an inefficient Euler integration. Here is the correct Update() code:

Update() {
    actualVerticalVelocity += gravity / 2;

    actualPosition.Y += actualVerticalVelocity;

    actualVerticalVelocity += gravity / 2;
}

Only the very first step of the Update() will change and will move the object by initialVelocity plus the half of the gravity, instead of the full gravity. Each step after the first will add the full gravity to the current velocity.

sentences:
C++ Game Library for SVG Based Game I'm looking into building a cross-platform opensource 2D RPG style game engine for ChaiScript.

I want to be able to do all of the graphics with SVG and need joystick input. I also need the libraries I use to be opensource and compatible with the BSD license.

I'm familiar with allegro, ClanLib, and SDL. As far as I can tell, none of these libraries have built in or obvious integration for SVG. Also, I'm aware of the previous conversations on this site regarding Qt for SVG game development.

I'm hoping to avoid Qt because of the size and complexity of making it a requirement. Also, Qt does not seem to have joystick input support, which would require that SDL or some other library also be used.

So my question can be summed up as this:

What is the best way to get SVG and joystick support in a 2D C++ library while minimizing dependencies as much as possible (preferably avoiding Qt altogether)?

sentences:
Is OpenGL appropriate for 2D games? I have been teaching myself the OpenGL library for a while now, and want to start making a game. However, for an easier introduction, I want to start with something 2D, such as a top down Pokemon-style game.

Is this a good plan, or is OpenGL made specifically for 3D?

sentences:
Suggestion for C++ reinforcement learning library to control flocking algorithm I am looking to use reinforcement learning to adaptively modify the weights involved in a flocking algorithm (i.e. 'boids').

Searching google revealed several libraries, but I don't know anything about any of them.

I am far from being an expert in reinforcement learning, though I have perused Sutton and Barto's classic book on the subject, so I understand some of the concepts.

A little background, in case it helps.  I have a few steering behaviours (seperation, alignment, cohesion, forward, and wall avoidance), which each generate a 'force' vector and compete to tell the agent(s) where to move.  Each force vector is combined in, basically, a weighted sum.  I would like to 'learn' these weights adaptively so as to cause e.g. more/less clustering, reduce/increase the flock's speed, etc.

Can anyone recommend a good library to use?

I would also need some kind of linear classifier, or something, to interface the learning with the (float valued) weights for each of the flocking steering behaviours.  So a library that provides a one-stop solution for this problem would be good?

sentences:
reuse texture between quad objects This question is specific to unity:

I want to spawn multiple blocks, each representing a letter. There will be more than one copy of an alphabet.

I have a big texture which contains all the letters in it. I use a prefab to Instance all the Blocks(quads) during Awake(). At runtime, I'd like to assign a texture to these quads (identifying the letter). My code looks like this:

    void Update () {
            // if there is no active block, spawn it
            if (activeBlock == null) {
                this.getNextBlock (ref this.activeBlock);
    }
    protected Block getNextBlock(ref Block block){
            block = this.deQueueBlock ();
            char letter = LetterMgr.Instance.getNextLetter();
            // based on the letter, index into texture
            // and assign the texture + indices to this block ?
    }

How can I reuse this one big texture and index into each letter amidst all these blocks (quads) ? I will be rendering this on a mobile, so will need to squeeze all the performance I can.
Details:

256 x 256 per letter
8 columns x 4 rows
Total Texture Size: 2048 x 2048
Total number of blocks: ~100

PS: Each of the letters will be moving and will eventually come to rest. So I will have some (around 6-7) actively moving blocks and others will be stationary.

sentences:
Unity3d seamless level loading I've read that application.loadLeveAdditiveAsync is a pro only feature. I'm looking for an asset that can do something similar. I would like to load assets based on the camera/player position. Ideally, it would be great to dispense with scenes entirely and just load information based on some distance value. This asset seems to be doing just that: https://www.assetstore.unity3d.com/en/#!/content/8015 however I'm not sure if the author is active anymore, and recent customers are complaining about a serious bug.

Any recommendations about assets that allow for seamless, open world style transitions between scenes would be great. (using Unity 3D 5, basic version, and writing in c#).

sentences:
How to use the Windows Phone SDK Namespaces in my Unity project? I'm developing a game with Unity and using C# as the language for the scripts.
I want to use the Device Vibration in my Microsoft Phone which is easily available for Windows Phone Development in Visual Studio using the following:

using Windows.Phone.Devices.Notification;

And then calling the following method:

VibrationDevice testVibrationDevice = VibrationDevice.GetDefault();
testVibrationDevice.Vibrate(TimeSpan.FromSeconds(3));

The above works perfectly when I'm building a Windows Phone App from visual Studio. However i totally need to integrate the above functionality in my Unity game.

Any suggestions, workarounds, tips or even hacks would be really helpful. Thanks in advance.

sentences:
How does this point2LineDist() method works? I was browsing Wolf3D JS port and bump into that method :

/**
 * @description calculates distance between a point (x, y) and a line.
 * @memberOf Wolf.Math
 * @param {number} x X coord of point
 * @param {number} y Y coord of point
 * @param {number} a Line angle in degrees
 * @returns {number} Distance
 */
function point2LineDist(x, y, a) {
    return Math.abs( (x * SinTable[a] - y * CosTable[a]) >> 0);
}

I think I understand what it does. It gives shortest distance (green on picture) between a line (from angle) and a (x, y) point.

What is not clear to me is how it works.
I know a little bit of trigonometry, but I am not able to figure out which trigonometry identity or formula it use. The binary shift is (I think) a quick way to convert a float to an int.

sentences:
Avoid rolling whith quaternion I'm using a Look At function (idem as nasskov answer on this post) to orient a model:

osg::Quat result = quatLookAt(normalize(velocity));

It works but may let the model to roll. How I can avoid this ?

I'm thinking of decomposing the rotation into two quaternions (Pitch&Yaw) but not succeeded so far.

The solution:

inline osg::Vec3
VectorFront()
{
  return osg::Vec3(0, 1, 0);
}

inline osg::Vec3
VectorUp()
{
  return osg::Vec3(0, 0, 1);
}

inline osg::Quat
quatLookAt(const osg::Vec3& dir, const osg::Vec3& up)
{
  if (dir.length2() == 0.0f) {
    assert(false && "Zero length direction in quatLookAt(const osg::Vec3& "
                         "dir, const osg::Vec3& up)");
    return osg::Quat();
  }

  if (up != dir) {
    const osg::Vec3 v = dir + up * -(up * dir);
    osg::Quat       q;
    q.makeRotate(VectorFront(), v);
    osg::Quat r;
    r.makeRotate(v, dir);
    return q * r;// * q
  }

  osg::Quat q;
  q.makeRotate(VectorFront(), dir);
  return q;
}

// ...

const osg::Quat q = quatLookAt(new_forward, VectorUp());

sentences:
How can I find a bounding box for a bezier curve I am using the code from the question Adding functionality to make individual anchor points of bezier continuous or non-continuous to create bezier curves (I added a line renderer).

How can I find the center of the curve for multiple cubic Bézier segments, where the centre of a bounding box is the centre of the curve (as in the image below)?

sentences:
How can I handle ball interaction with lanes in a pinball game? In a pinball game, how can I handle collision or constraints on the ball for convincing movement on those highway rails/tracks?

I assume using physics and a mesh collider would not work, even when the poly count is really high the ball still bashes into all those faces instead of hugging a smooth, round wall. I could constrain the ball to a spline but I foresee problems with the balls speed and proper physics.

I'm wondering if it is possible to tell the ball that mesh corners below a certain degree should be treated as round. Perhaps only when coming from a certain angle?

sentences:
Changing color of a moving image without lowering the fps I just added an option to my game that makes it so that all the enemies will have a random color for their clothes instead of the regular blue. I use this code to draw rectangles over the shirt of the enemy.

BufferedImage image = new BufferedImage(z.getWidth(), z.getHeight(),
    BufferedImage.TYPE_4BYTE_ABGR);
try{
    image = ImageIO.read(new File("C:\\Program Files (x86)\\ZombieGame\\
        Zombie.png"));
}catch (IOException ex) {
}
int j, k, red, green, blue;
    for(j = 0; j < z.getWidth(); j++){
        for(k = 0; k < z.getHeight(); k++){
            Color c = new Color(image.getRGB(j, k));
            red = c.getRed();
            green = c.getGreen();
            blue = c.getBlue();
            if(red == 0 && green == 0 && blue == 178){
                g2d.setColor(Color.red);
                Rectangle r = new Rectangle(j,k, 1, 1);
                Path2D.Double rect = new Path2D.Double(r, at);
                g2d.fill(rect);
            }
        }
    }

The thing is that when I apply this the game will run twice as slow (before I added this code I got a solid 80 fps but as fast as I added it I got around 30 fps). Is there a better way in which I could change the color of specific parts of the image without lowering the fps drastically?

sentences:
How can I make my tiles fall smoothly? I'm working on a Tile-Based game and I can't figure out how to make my tiles fall down smoothly like in candy crush. All column tiles fall-down at the same time. And spawn new like how many tile place if null.
What I want:

Update [25.12.2015]
But the my code works like this:

Update [26.12.2015]
Hello Again,
World Scale (x,y)
World Scale OLD: (10,10)
World Scale NEW: (10,11)
Y=11 Tiles type = Empty
Now, when i click the random place like (5,7),above all blocks down to :
block.transform.pozition += new Vector3(0,-1,0);
It's working. But again, when i click same place (5,7) not working...
I changed Y scale 10 to 11. Because, when i clicked tile, the tile will return to Y=11 position and fall down, how many tile place null.
When Tiles state "fallling down", the space between two blocks distance not more "0.01".
I do not know how to do. But I approached. I need to more improve this.
Thanks...
Pseudo-code:
When I click the (4,7) coord, the tiles,
tile(4,8) is smooth down the coord(4,7)
tile(4,9) is smooth down the coord(4,8)
tile(4,9) is generate new tile.

What I have (Code not working properly :( ):
World.Height = 10
World.Widht = 10
Tile X and Y {get, protected set}

public void ColumnDown(int x , int yStart)
{
    if (IsColumnFull(x)) return;

    for (int y = yStart; y < World.Height; y++)
    {
        //Yeni tile spawnla
        if (y + 1 >= World.Height) continue;

        Tile tile = World.GetTileAt(x, y);
        Tile tile2 = World.GetTileAt(x, y + 1);

        GameObject go_Tile = GameObject.Find("Tile-(" + x + "," + y + ")");
        GameObject go_Tile2 = GameObject.Find("Tile-(" + x + "," + (y + 1) + ")");

        if (tile != null)
        {
            if (go_Tile == null && go_Tile2 == null)
            {
                Debug.Log("go_Tile NULL");
                continue;
            }

            tile2 = tile;
            go_Tile2.transform.position += new Vector3(0, -1, 0);
            go_Tile.name = "Tile-(" + x + "," + (y + 1) + ")";
            go_Tile2.name = "Tile-(" + x + "," + (y) + ")";
        }
    }
}

sentences:
Unreal Engine - How can I add blur effect at my Camera in iOS I have requirement to add blur effect at my camera in specific point , it work just fine in pc but when I deploy in my phone it remove the effect

According to documentation

  To turn off Depth of Field, set "Scale" to zero, this is suggested as
  default to improve performance.

  Mobile Depth of Field is currently not compatible with PC. There is no
  way to currently visualize on the desktop version what the mobile
  settings will look like except using an unsupported "-FeatureLevelES2"
  launch flag when starting the editor, or using the "Mobile Preview"
  option from the "Play" button drop down menu.

But when I run in my mobile this effect disappear

any one know the reason

here is my Camera setting

sentences:
Unity 2D sprite animation keep in sync after setting inactive I am creating a 2D sprite-based game and the tile map contains many animated background tiles (such as water). The map contains many areas that can be transitioned between in a Zelda style (camera scrolls to new area). After scrolling, I set the previous area to inactive. Setting the area to inactive pauses the animations (which is what I want), but when I reenter a previous area the animations start from where they left off. Therefore, any animated tiles adjacent to each other between screens are out of sync and cause an obvious seam. I would like for all the background tile animations to run on the same time value even after they've been paused. The animations use an Animator Controller attached to each animated tile GameObject with an Animation that changes the sprite from an atlas.

Another idea I had would be to have a separate class modify my texture atlas (maybe using setpixel) to update the tiles to their next frame of animation (since I want all tile animations to be in sync and run at the same speed), but I'm not sure how updating the texture will affect performance.

I would like to hear people's ideas for any solutions to this problem.

sentences:
Observing particular Port for measuring network game performance How can I check/inspect the performance of some network application via observing the port it used, I want to test the performance of my network game.

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

sentences:
Implementing a delay timer into triggered method I have a shoot method that is used as a mouseDown() Trigger on my player. I am wanting to introduce a delayTimer but am unsure of how to do this within the method due to the trigger.

public void Shoot(){
    if (BulletsManager.bullets > 0 && facingRight == true) {
        playShotgunSound();
        Instantiate (Bullet, firePoint2.position, firePoint2.rotation);
        BulletsManager.SubtractPoints (bulletsToSubtract);
        facingLeft = false;
        facingRight = true;
    }

        if (BulletsManager.bullets > 0 && facingLeft == true) {
        playShotgunSound();
        Instantiate (Enemy, firePoint2.position, firePoint2.rotation);
        BulletsManager.SubtractPoints (bulletsToSubtract);
        facingLeft = true;
        facingRight = false;
    }
}

Could anybody advise as to how I'd implement it within this code?

sentences:
Array of script class references in inspector I'm trying to remove the Reflection part of one of my scripts so it works in WebGL, however I am having some trouble.

Basically I need a way to store references to classes in an Inspector array so that I can then use AddComponent() to add them to an object I spawn.

The code I'm using uses arrays to hold different types of AI modules and then chooses a random set of modules and add them to an base enemy prefab. Previously I was using Reflection to create the array and add the modules but that doesn't seem to work in WebGL. Currently the modules are Monobehaviours but it is possible for me to make them normal classes.

sentences:
How should a team share/store game content during development? Other than Dropbox, what out there has been especially useful for storing and sharing game content like images during development (similar feature set to Dropbox like working offline, automatic syncing and support for windows/osx)?

We are looking into hosting our own SharePoint server but it seems to be really focused on documents... Maybe Box.net would work?

EDIT

For code, we are using Git.

To be more precise, I was looking for an easy, automatic way for content produced by artists/audio engineers to be available to everyone.  Features like approvals of assets don't hurt either.  Following the answer linked by Tetrad, Alienbrain looked pretty interesting but..is way out of our budget (may be something to invest in in the future).

What ended up doing...

We were going to go with Box.net but downloading the sync apps for desktop use required us to wait to be contacted by them for some reason.  We did not have much time to wait so we ended up going with Dropbox Teams.  Box.net has a nice feature set but we never really felt held back without them.

Thanks for the help :).

sentences:
Problems with instaling SFML I've followed the instructions on installing SFML on the website to the letter. But, I get this when I try to build the sample program on the same page using Code::Blocks.

C:\Users\nic\Desktop\sfmltest.o:sfmltest.cxx|| undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'|

...

||=== Build failed: 20 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

I get 20 error messages, which are all similar to the one given above. SFML worked like a charm on my ubuntu 14.04 amd64 install, but it simply does not work on Windows. I am using SFML 2.1 (the GCC 4.7 TDM (SJLJ) - 64 bits package as the other ones did not work) on a Windows 7 x64 installation with MinGW (gcc 4.8.1). How can I make SFML work on Windows?

edit: I'm not sure if I have to copy-paste all the SFML dlls to the working directory. Should I do this?

edit2: c/ping the dlls does not help.

sentences:
Dot product not working as expected Recently I am learning dot product,

While below code works from Unity's documentation,
http://docs.unity3d.com/ScriptReference/Vector3.Dot.html

 public Transform other;
    void Update() {
        if (other) {
            Vector3 forward = transform.TransformDirection(Vector3.forward);
            Vector3 toOther = other.position - transform.position;
         var dot = (Vector3.Dot(forward, toOther);
         Debug.Log(dot);

        }
    }

But it doesn't work when I change direction of "other".It keeps giving same value no matter how much I rotate other unlike when I rotate transform,it does change values.

For example,
transform is at 0 0 0 and other is at 0 0 10 both has 0 rotation so facing straight in Z axis.

The desiire out put I get is negative.

Now suppose I change rotation of transform to 180 then the output gets positive as expected.

I undo the rotation of trasnform and rotate other to 180 i.e., facing transform, then the output doesn't get change and show negative value only.Which is not correct as other is facing player..

Why is that the case? I am not able to get around it.

sentences: Add a sound to all the buttons in a project Is there an option on the texture_button or something like that where you can specify a sound to be played on button-press. I have created a global sound_manager but for the button presses, I have to manually code it everywhere the script has a button_pressed signal. Or some kind of logic that when a button is pressed anywhere in the project, sound_manager plays a particular sound.

sentences:
How to program destructibles? I'm thinking about programming a 2d simulation of a spaceship that takes damage depending on where the projectile came from (e.g. from behind - engine, from the front - lasers, sides - hull, etc.). When a given part is below a certain durability factor it explodes into physics simulated particles. What is a good way of storing such particles (ship built out of parts, parts built out of particles, e.g. 6px triangles) taking into consideration the following:

different parts have different shapes,
it might be needed to add more parts in the future,
possibility of avoiding a pixel-perfect projectile-to-part collision detection,
the spaceship should be affected by physics but particles shouldn't unless exploding.

sentences:
How can I ease the work of getting pixel coordinates from a spritesheet? When it comes to spritesheets they're usually easier to use, and they're very efficient memory-wise, but the problem that I'm always having is getting the actual position of a sprite from a sheet. Usually, I have to throw in some aproximated values and modify them several times until I get it right.

My question: is there a tool which can basically show you the coordinates of the mouse relative to the image you have opened? Or is there a simpler method of getting the exact rectangle that the sprite is contained in?

sentences:
Gaussian blur spritesheet/texture atlas without clipping edges I'm trying to apply a Gaussian blur to a shadow to soften them a bit. I can apply the blur fine, but the problem is that I end up with this:

Instead of this:

Which isn't great. The image is part of a spritesheet with a single pixel gutter around each frame.

I don't want to have to go back and add gutters big enough to accommodate the blur to every single frame of every spritesheet. Additionally because of the way the sprites have to be sorted I can't render all the shadows to a render target and then blur the entire target. I can achieve the effect I want with a sprite as a single image instead of as a spritesheet. I do that by creating the triangles 20% bigger than they need to be and then sampling the texture outside the bounds when the UV addressing is set to clamp. That doesn't work with a spritesheet though because then it just starts sampling the frames on either side of the current frame.

Is there a way to achieve what I want with a shader or other trickery? I really don't want to have to alter every spritesheet.

sentences:
2D Tile Engine Architecture I'm been working on a 2D tile game (sidescroller perspective) and I decided to rework my tile engine. Right now I store a new tile instance per block in the world (so there are like 1000 TileStone instances in memory). My plan was to change the current tile engine so that I store only a small object which tells the renderer a stone tile should be drawn there. The TileStone, TileDirt classes only store the block properties like hardness, texture and so on.

With this design I ran into a bit of a problem, some tiles, for example, a chest tile should be able to store custom data like the contents of the chest, or for instance a windmill block which needs to update all of its logic every update tick.

What would be a good way of implementing a tile engine, that meets these requirements?

Programming language: Java, Library: LibGDX

Thanks in advance
-ProRed

sentences:
How do C# and UnityScript differ in Unity development? Other than the obvious language differences, how do UnityScript and C# differ when developing games in Unity3D?

Is there a noticable performance difference?
Is the UnityScript code packaged as-is? If yes, does this help the game's moddability?
Is it possible to use libraries developed for one language while developing in the other one?
Can the two languages be mixed in the same Unity project; coding some parts in C# and others in UnityScript?

sentences:
GLSL: Noise via texture I am trying to access a texture in a fragment shader to overlay this texture over a certain area.

varying vec4 v_color;
varying vec2 v_texCoord0;

uniform sampler2D u_sampler2D;
uniform vec4 u_oldcolor;
uniform vec4 u_newcolor;
uniform vec3 u_noise;

void main(){

    vec4 color = texture2D( u_sampler2D , v_texCoord0 ) ;
    float threshold = 0.005f;
    if(color.r <= (u_oldcolor.r + threshold) && color.g <= (u_oldcolor.g + threshold) && color.b <= (u_oldcolor.b + threshold)
    && color.r >= (u_oldcolor.r - threshold) && color.g >= (u_oldcolor.g - threshold) && color.b >= (u_oldcolor.b - threshold)){
        color.rgb = u_newcolor.rgb + vec3(v_texCoord0, 0.1);
    }

    gl_FragColor = color ;

}

For every pixel the shader checks for a certain color and replaces it with a new color+v_texCoord0.

Now I am want to bring in a third component: a noise texture to make it look like this:

I searched the web for a solution but I could not find anything helpful.

My questions:
1.Is this even possible to accomplish via a shader?
2.How to access the texture ?

I hope that my questions are clear and proper for this forum :) .

sentences: How to make text hyperlink in AndEngine Currently to open the link i am using button sprite. But now i want to link a text to website. Is there any way to do this in AndEngine?

sentences:
Rendering three-dimentional array of tiles (as a tilemap) I'm trying to create 2d game engine in C++ using SDL2 (actually some code was migrated from SFML). I want to have a flexible multilayer tilemap that can store different types of tiles. My current version of this kind of map uses three-dimensional array of pointers to base class of tiles ("tilemap").

First of all - is it even a good approach?

I'm using pointers to make tiles polymorphic (eg. ground tile (tile_basic) has it's act number and texture id, but chest tile (tile_chest) has also a list of items in it). However scanning trough this array every time when I'm rendering my map would take a lot of time. So I'm scanning trough three-dimensional array of sprites (drawable objects) which is generated from the tilemap every time when new sprites are meant to be shown on the screen.

std::vector<std::vector<std::vector<mg::CompactSprite> > > sprites;

The first two dimensions are quite constant, they depend on the size of the application window. When moving the camera sprites move up to their size (width, heght) and when they are about to exceed this limit, their coordinates reset (x, or y, depending on which direction the camera is moving), getting it into simple words - I'm using modulo.

The problem is that this is terribly slow (~43ms with 23x18 map with only few layered tiles; using SDL2, similar results with SFML). I know I could render the whole visible area to the one image and just move that image and then render only new areas, but then I won't be able to make animated tiles without listing their coordinates, checking if they are in the visible area and then rerendering them which sounds bit overcomplicated, and I'm not quite sure if it'll really boost the rendering process.

So is there any better way to do this? Or I should change my approach?

sentences:
Can I used a NES USB controller with XInput? I'm doing a project to graduate from my game design degree and I have to recreate two levels from MegaMan(1987).
I saw that there are usb nes controllers out there that are used for emulators on PC.  Before I purchase them and try out programming my game with them, I'd like to confirm that I can use them with Xinput.

If anyone knows if this is possible, please let me know!

Thank you!

sentences:
2D Platformer - Methods to Implement a Whip Weapon I hope posting here isn't a faux pax, if it is please feel free to direct me to the correct location. Or, if there is a thread that already covered this I would love to be pointed in its direction.

I've tried looking in quite a few different forums and I can't seem to find very much information about this. What I'm looking to do is implement a whip weapon for a character that's similar to that of Castlevania 4's whip.

I have no idea where to start. I'm really just looking for any information. Things like how to program it, the idea of how it was done in the game, really just anything to help me figure out how to make a whip like Castlevania 4.

I would appreciate any help. Thank you.

sentences:
Unity: Built-In Shader Transformation Explanation Resource I'm working on some of my first shaders and taking a look at the variables included by cginc I see this  list of transformation matrices:

I've watched some beginner talks and I understand what the first one does but pretty much every other one I'm not sure what it does or how to apply it. Does anyone know of a good resource for explaining these transformations?

sentences: Unsure where to right click to delete Unreal C++ class Trying to delete a c++ class (this should not be this difficult!) and I have deleted the .h, .cpp, and binaries.  Next everybody says "now, right click on your .uproject file and select Generate Visual Studio files."  Where do i right click it?  I can't find the file in Visual Studio, and it doesn't give the option to generate the files in my file browser.  Sorry about the noob question, but I 've google searched to no avail.  thnx.

sentences:
Response to form triggers creation of zero or more duplicate scenes I've got two scenes, one with room 1 and one with room 2.

In room 1 I've got one table with two 3D assets on top of it. This room also has a door that connects to room 2 through a door but it's closed.

Once going near the 3D assets a dialog pops up saying to click "E". This pops up a 2D form one needs to fill.

Only after filling both forms I'm able to go into room 2.

Now what I would like to do is, depending on the response in the form, one or more duplicate room 2 scenes should be created and dynamically added to the scene. If with scenes isn't possible, what's the way to do such thing?

Know about SceneManager.CreateScene but this creates an empty scene, not exactly what I want to.

sentences: Adaptive vs progressive mesh Is there any distinction between these two? I couldn't find anything in google under "Adaptive vs progressive mesh", but googling them both separately gives results as if they were likely the same.

sentences:
How to make a fun slot machine? We currently have a simple slot machine in our online virtual world game.

You set the amount you want to bet (in virtual money) and pull the lever, and depending on the 3 figures (there's only one line) you get a reward, a free round, lose some more money, or most of the time, get nothing at all. You can instantly pull the lever again. The previous bet will be maintained.

At the moment this slot machine isn't really fun to play. The chances of winning something are pretty low (though when you win, you can win a lot). When you pull the lever, the result is determined (though not shown) immediately, so there's also no way influence the outcome of the wheels.

How can it be made more fun?

sentences:
How do I make a game tick method? I've seen in some other simple 2D games that a "tick" method is used to sync game logic and graphics rendering.  My main reason for using this is due to my collision detection malfunctioning, since the player entity will completely pass through solid objects unless I tap the controls almost pixel-by-pixel to collide the rectangles.

I figure a tick method will slow the games rapid updating enough to pick up these slight collision detections.

How do I create such a method? I've tried the code you can see below, however, it is causing the entire game to freeze:

The update method:

 @Override
    public void update(float deltaTime) {
        List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
            long lastTime = 0;
            long currentTime = 0;

        if (state == GameState.Ready) {
            updateReady(touchEvents);
        }
        while (state == GameState.Running) {
                lastTime = currentTime;
                currentTime = System.currentTimeMillis();
                deltaTime = currentTime - lastTime;

                player.update(touchEvents, deltaTime);
                repaint(deltaTime);
        }
        if (state == GameState.Paused) {
            updatePaused(touchEvents);
        }
        if (state == GameState.GameOver) {
            updateGameOver(touchEvents);
        }
    }

The repaint method, which is updated while the regular paint method does nothing.  I've tried the while loop with both, doesn't seem to stop freezing:

public void repaint(float deltaTime) {
        Graphics g = game.getGraphics();

        if(deltaTime >= 60) {
            g.drawRect(0, 0, 805, 485, color.black);
            map.loadMap(getXScroll(), getYScroll(), g, game);
            map.loadEntities(getXScroll(), getYScroll(), g, game, map);
            g.drawImage(Assets.bitSoldier, 448, 256);
            g.drawImage(Assets.dpad, 0, 280);

            // Secondly, draw the UI above the game elements.
            if (state == GameState.Ready)
                drawReadyUI();
            if (state == GameState.Running)
                drawRunningUI();
            if (state == GameState.Paused)
                drawPausedUI();
            if (state == GameState.GameOver)
                drawGameOverUI();
        }
    }

sentences: How is the Unreal rendering pipeline implimented? I know this seems like a very broad question, but i am just interested in getting to know how the Unreal engine's rendering pipeline looks like, specially how it handles meterials, different types of lighting, and post processing. I know that Unreal4 uses differred shading, but how does it handle things like translucency, reflections, etc. I do not have access to the source code, that's why I asked this question here. You could even direct me to the source of the rendering part if available.

sentences:
OpenGL ES 2 - glSwapBuffers? this is what i do to blit FBO onto screen in ViewController:

[m_Context presentRenderbuffer:GL_RENDERBUFFER];

but i need something like glSwapBuffers, so that i can call it somewhere from the engine code ( which is cpp ) - to refresh the screen in special cases - is this available for iOS / how can i implement it - if i can at all..

sentences:
Accessing a C++-based optimization library in FlashPunk Some time ago I launched my FlashPunk primer, an adaption of Asteroids, which mainly served as a basis for trying out a simple optimization algorithm.

Now I'm planning to take this concept a level further and program a version of Lunar Lander. This would require to incorporate a sophisticated external C++-based numerical optimization library into my Flash Punk code.

When looking for a solution I came across the Crossbridge compiler. If I got it correctly, it would allow for writing native C++, accessing flash functions via the AS3 header and have it compiled to a *.swf-file.

Would that mean I have to give up FlashPunk and write the whole piece in C++/AS3?

sentences:
Unity3D - leaving and then returning to a scene Effectively, I need to know how to run a mini game and then return to a scene. I know about

DontDestroyOnLoad (this);

but that works for game objects only and doesn’t do what I need - also because it carries the objects over into the next scene. In my game you play as a computer. When you hack into a computer remotely, you have to go into a sort of mini game where you must traverse the computer for data, experience and end up ‘owning’ the computer, having destroyed its security systems. My problem is that this requires being in a different scene, where the hacking 'minigame' is played out, then return. So I could just make a new scene, fine. But when I have to return to the old scene, it has to kick off from the exact point where I left to hack the computer, as if no time had past and with nothing being different. I am stuck on how to do this, because as far as I know there is no way to write a scenes data to a binary file and the read from it when loading the scene again - and persistent data was the only solution I could think of. Any help is appreciated.

Summary

How to play the scene, load a different scene, finish that minigame and then continue from where you were in the original scene

sentences:
How do I structure AI that uses both Behavior Trees and Pathfinding? Architecturally, what are the best practices for how these two concepts interact with each other?

For instance, say I have an asteroids like game where the AI player must dodge floating asteroids while at the same time collecting powerups. If we want him to perform well we can't just have two separate behaviors for dodge and collect, he should consider everything on the screen.

Should the behaviors in the tree modify the weights of the pathfinding graph nodes (assuming using a graph based approach here)? Is A* like path finding even the best approach for this scenario?

sentences:
Adaptive AI (Artifical Intelligence) I was thinking to make my arcade game match the players strength in the hard level mode. Like checking the score and if the human player's score is above computer's for certain number of units then the computer player would automatically increase the speed of its reactions, just like a human companion who gets more determined to fight back.

Does this sound a good idea to you? Are there other ways to approach this, so to make a game, like air hockey for a crude example, permanently challenging for anybody?

EDIT:
I agree with the answers below. I believe that most people like to win about 70% time over the computer in order to be motivated. Hence an adaptive intelligence must not be become too superior to the player and depending on human player's concentration and some random elements in the game (good 'old' quantum RND), the outcome should be always uncertain.

A nice thing about this is that such a system could handle week and strong players and would adjust to the human's learing curve.

sentences:
How to check if NPCs are on ground or not? I'm using Unity Engine. I see the common way to check if player is on ground is shooting a Raycast:

How to solve the ground check problem?

How to check if grounded with rigidbody

I have a simple scene with Unity's terrain  for ground (Game Object > 3D Object > Terrain). Imagine you have a lot of NPCs (like GTA), is it possible to check a character on ground without Raycast? Do you have to run loop to ray cast check each NPC?

sentences: How to code simple Goomba-like AI for 3D Platformer? I'm making a 3D Platformer and have an enemy similar to a Goomba in terms of AI. How do I get the enemy to walk around and then follow the player when they're in range?

sentences:
How to read ARGB pixel data from SDL2 surface and store them in an array? I've been trying for hours now to figure out why this piece of code is giving me seg fault, but can't figure out why.
 void pixel::Texture::LoadTexture(const char* filepath)
 {
    SDL_Surface* image = IMG_Load(filepath);
    SDL_Surface* formattedImage = SDL_ConvertSurfaceFormat(image, SDL_PIXELFORMAT_ARGB8888, 0);

    textureBuffer = new Uint32[formattedImage->pitch * formattedImage->h];

    width = formattedImage->w;
    height = formattedImage->h;
    pitch = formattedImage->pitch;

    SDL_LockSurface(formattedImage);

    Uint32* pixels = (Uint32*)formattedImage->pixels;

    int bpp = formattedImage->format->BytesPerPixel;

    for(int y = 0; y < height; y++)
        for(int x = 0; x < width; x++)
            textureBuffer[(formattedImage->pitch * y) + (x * bpp)] = pixels[(formattedImage->pitch * y) + (x * bpp)];

    SDL_UnlockSurface(formattedImage);

    SDL_FreeSurface(image);
    SDL_FreeSurface(formattedImage);
 }

Essentially, what I'm doing is I have an array of unsigned 32 bit integers called the texture buffer. All I do is load an image into a surface then convert it's pixel format to ARGB then start reading each pixel and storing it inside my texture buffer array but for some reason the pixels array gets an out of bounds error at some point in runtime and I can't figure out exactly why.

sentences:
XNA - Getting pixel shade texcoords? I'm still new to shaders and I'm trying to create a glow a shader. I understand how it all works and I don't think I'll have too much trouble with the rest of it, but I'm stuck at one point in particular which is getting the texcoords of the render target into my pixel shader.

Right now I'm setting the rendertarget, saving it to the texture, passing it to the shader. Then I'm going to do tex2D(texture, coords) but I don't know HOW to get the coordinates into my pixel shader. I've created float2 TexCoord : TEXCOORD0; for my vertex shader output but I don't know how to assign the coordinates as it reaches the pixel shader. Everything else (color,pos, normal) is just automatically passed in through the vertex shader and I'm assuming I don't need to change the format of that to include texcoords and it's something within the actual shader itself I need to add?

Thanks.

sentences:
Position of the prefabs not randomizing So, I'm currently working on a game.
The objects are treated as prefabs, so every time it is instantiated, the position of the object must randomize.
public ObjectDisplay SpawnObject()
{
    Vector3 randomPosition = new Vector3(Random.Range(-2.5f, 2.5f), 7f);

    GameObject obj = Instantiate(objPrefab, randomPosition, Quaternion.identity, objCanvas);
    ObjectDisplay objDisplay = obj.GetComponent<ObjectDisplay>();

    return objDisplay;
}

The randomPosition is what is supposed to be changing the positions, but what happens is that the prefabs would continue to spawn from the middle of the screen. I've tried changing the position values but that didn't do much.
The code is seemingly fine, but it doesn't function the way it is supposed to. Any ideas?

sentences:
simplest way of making a sphere roll in a realistic way rather than just moving a sphere across a plane, I want to make it roll like a ball. What is the simplest way of doing this? I assume it will have something to do with the circumference of the ball and rotating + moving it at a calculated rate.

What is the relevant maths here?

sentences:
How to get tile rotation from TiledSharp and convert it to XNA/MonoGame I am currently working on a game using XNA and Tiled. I use Tiled to create my maps and load them using TiledSharp. Some of my maps have tiles that are rotated by using one or more of the left rotate, right rotate, horizontal flip, vertical flip options in combination.

In the tiled documentation, it shows there are certain ways to find out if an object is horizontally, vertically, or diagonally flipped. TiledSharp tells me this information. However, I don't know what to do if a tile is diagonally flipped. How many degrees should I rotate the tile (in multiples of 90 degrees)?

sentences:
Is It Better To Generate A Pre-Generated Map or A Randomly Generated Map When Using Tile Properties? So I am contemplating whether or not to add a Pre-Generated Map or a randomly generated map into my game. But I also need to add Tile properties into the map (i.e. so that water tiles aren't being walked on by the player, etc.). Which way is better, to add tile properties to an existing image file or to add tile properties to a randomly generated map?

I want to make it so that I can add Tile properties to a pre-generated map as I already have one ready to go, but is it even possible to add tile properties to a pre-generated map?

I am using Java and the Slick2D gaming engine.

sentences:
How to properly handle collision in a component-based game? Trying to wrap my head around the ways to properly handle collision in a game designed around components.

I see many examples have some sort of PhysicsComponent that gets added to the entity's list of components but the actual implementation is confusing me.

For this to work, the PhysicsComponent would need access to the world around it. This doesn't make intuitive sense to me. Shouldn't a component be unaware of not only its container (the entity), but its container's container (the world)?

To me, it sounds like the level or scene should maintain a list of these entities and every game update, loop through the entities to determine which collide.

My question is firstly, whether or not this is good design, and secondly, how to determine which entities can collide. I suppose solid entities could implement an empty IRigidBody interface so the level could determine which entities in the list support collision. But is this breaking the component design?

Instead, should they contain an empty RigidBody component? This may actually be better because it may not always be empty and this approach is more future-proof. The only problem with this is the complexity. The scene would have to loop through not only every entity, but also every entity's components to determine if it had this RigidBody component.

Thirdly, when they do collide both entities should be informed somehow and I am unsure on how to accomplish this either.

Let's say that both entities contained a HealthComponent and when they collided both their healths would be decreased by some arbitrary value, 5. I suppose it would be the scene's responsibility to handle this when it detects a collision between two entities?

But then is the scene responsible for too much? I could see this possibly getting out of hand and becoming unwieldy when the scene is responsible for many things entities should not (?) have access to.

Edit: Question updated with more details.

sentences:
How do I efficiently render the tiles of a tile map? I've been working on a game, and I've been using Python with Pyglet to create it. I had an issue on how I could do effective tile based rendering. I tried cocos2d, however the API is very efficient and doesn't support maps which are larger than 1000x1000 tiles. I did some further research, and found you could make it so when you triggered an update, only sprites on the edge of the screen would update, however it is still buggy (it's not fully working).

Here is my code, and here's some relevant rendering code:

self.camera[0]-=amount
for a in range(self.window.height//self.block_size):
    self.sprites[(self.camera[0]//self.block_size)-1][a+(self.camera[1]//self.block_size)].batch = render
    self.sprites[self.window.width//self.block_size+(self.camera[0]//self.block_size)+1][a+(self.camera[1]//self.block_size)].batch = None

What approach should I use to render maps larger than 1000x1000 tiles?

sentences:
Switching from Arcade to P2 physics in Phaser so i just started using phaser for test

i've followed the tutorial in the phaser website  (making-your-first-phaser-game) everything is clear no problem .

but since i've making a pool game i need rotation on collision so i've switched to P2 ... suddenly everything moves and collides!

here is the live code

http://199.26.84.223/

i have 2 groups

sides ( sides of table ) and  balls

1 - i want sides to be immovable so i 've added

side.body.immovable = true;

to each object like in arcade ... it doesn't work ... how can i make objects immovable in p2 ?

    game.physics.startSystem(Phaser.Physics.P2JS);

    sides = game.add.physicsGroup(Phaser.Physics.P2JS);
    side = sides.create(0,0 , 'sideA');
    side.body.immovable = true;

2 - i dont want my player to collide with red balls only with white ball

so in arcade we had to define each collision otherwise they wouldn't collide

game.physics.arcade.collide(player , wball );

but here there is no defining everything collides with everything !

how can i make exception in ocllision so my player wouldn't collides with anything other then white ball (Wball) ?

3 - what happend to overlap ? or collide call back functions ? i need to add some holes to my table and make the balls dissapir on collide or overlap ... in the arcade i had it like this

game.physics.arcade.overlap( balls , holes ,  killBall  , null, this);
function killBall  ( b , h  ){ b.kill() ; }

sentences:
Unity3D Multiplayer Networking I am making a multiplayer game using Unity3D, similar to SecondLife (but focusing on a particular gameplay task). Users will be able to register/login directly in the game and their character will be spawned.
So far, I have made the back-end Rest-ful API to manage users. I am able to use login and register from the unity itself ( Using REST Calls e.g. www.myDomain.com/api/login ) but how do I spawn the characters accordingly?

Also, currently I am making a token based authentication system for the API ( much like Facebook, Twitter) as the API itself is state-less. Should I be storing the tokens in playerprefs?

I have gone through this tutorial but it doesn't seem to solve my problem.
Any kind of direction will help. Thank you.

sentences:
Deforming a lip mesh to match face-tracking points I'm creating a lipstick filter. I have a basic mesh for the lip shape ( 140 vertices ) which I am able to render on screen.
I need the mesh since I have my own lighting system, and hence need the normal info. Plus I don't want to create a model at runtime since if I load an obj file I have the flexibility of rendering high quality meshes.
The problem that I am now facing is that when a user is going to use it, their face will be moving around in the video frame, and I will be getting the lips' positions accordingly. Hence at each frame the mesh will be rendered differently ( in one frame he might be smiling, the other he might be frowning etc), in different places in the screen.
How can I set the OpenGL vertices to match the positions of the tracked feature points, and interpolate the rest? I have only 20-ish detection landmark points for each of the upper and lower lip.

sentences:
Unity 5.3.5 - Blurry UI text after switching canvasses - until text is refreshed by turning visibility off/on or changing resolution I have multiple scenes in my project where the canvas are switched between, each canvas having UI text included on it.

The project was originally created in version 5.0 and I have just updated to version 5.3.5 and I am now encountering the following issue -

The canvas that is active when the scene first loads displays all UI text just fine, but as soon as I switch to another canvas with the exact same text on, the text on the new canvas is blurred. As soon as I turn the text object off/on (via a button click) it appears to refresh it and it all displays fine again.  It is also rectified by changing the display resolution in the editor play window.

It appears as though unless it has a 'refresh' through clicking something else, or is on screen when the scene first loads, it appears blurry.

The font is 'Open Sans Bold' and I am switching canvasses via a raycast script.

I have read issues of text blurriness in 5.3, but most instances appear to be down to the size of the text being in odd numbers which mine isn't.

Screenshots attached. The settings shown are the same for all canvasses and text.

Any help would be appreciated.

Thanks in advance

sentences:
Is it possible to batch draw sprites that use different textures without using an atlas? I've implemented a sprite batch class that uses a sampler array so that I can select a texture to use based on the gl_PrimitiveID. The idea was to be able to draw sprites that use different textures in a single draw call. I've managed to get it to compile the shaders and run, but the sampler indexing part does not seem to work, although I did not get any OpenGL error. I've done a bit of research and found out that it doesn't seem possible to index into a sampler array with an index that is not a compile-time constant or uniform variable.

Am I doing something wrong or is building a texture atlas the only way to draw sprites that use different textures at once?

sentences:
Turn .obj files in to .mdl for Gmod want to import models that i made in to garrys mod but i cant figure out how to convert them in to .mdl files. I dont have any moding experience with the source engine. I tried to find a program to convert them but with no luck.
My models are textured (.png files for the textures and the .mtl for the mapsing)
Any wany to do it?

sentences:
How do I draw a scrolling background? How can I draw background tile in my 2D side-scrolling game? Is that loop logical for OpenGL es? My tile 2400x480. Also I want to use parallax scrolling for my game.

batcher.beginBatch(Assets.background);
for(int i=0; i<100; i++)
    batcher.drawSprite(0+2400*i, 240, 2400, 480, Assets.backgroundRegion);

batcher.endBatch();

UPDATE

And thats my onDrawFrame.I'm sending deltaTime for fps control.

public void onDrawFrame(GL10 gl) {
    GLGameState state = null;

    synchronized(stateChanged) {
        state = this.state;
    }

    if(state == GLGameState.Running) {
        float deltaTime = (System.nanoTime()-startTime) / 1000000000.0f;
        startTime = System.nanoTime();

        screen.update(deltaTime);
        screen.present(deltaTime);
    }

    if(state == GLGameState.Paused) {
        screen.pause();
        synchronized(stateChanged) {
            this.state = GLGameState.Idle;
            stateChanged.notifyAll();
        }
    }

    if(state == GLGameState.Finished) {
        screen.pause();
        screen.dispose();
        synchronized(stateChanged) {
            this.state = GLGameState.Idle;
            stateChanged.notifyAll();
        }
    }
}

sentences:
Computer generated 2d graphics for games - how to get started I've seen a lot of nice 2d games recently, like Geometry wars that have really nice computer generated graphics.

I would like to know how is it done so game looks really nice even if it is composed only from really primitive graphic objects. All those lights, glowing particles, transformations etc.

Do you have any tips, info, books, articles that would uncover some details about creating graphics this way?

And what about development for all the mobile platforms, any good frameworks for this kind of work?

sentences:
Is it possible to use DirectX in pure C program? I want to try something simple with Direct Sound. Just want to know if it's possible.

Or maybe I need some other API?

sentences:
SharpDx how to detect if Mouse Button is pressed? I'm wondering how it's possible to detect if a mousebutton is pressed or released.

var di = new DirectInput();
_mouse = new Mouse(di);
_mouse.Acquire();
_mouseState = _mouse.GetCurrentState()

All I can access is now the X Y and Z Axis of the Mouse and the Boolean array Buttons.
Any Ideas?

sentences:
How to flatten the collider for a tilemap? I am relatively new to game development, and am working on a simple 2D platformer. I have created a tilemap and painted some tiles for the character to walk on.. but he is getting stuck. Yes, I know this is a common question and I did find some answers (including this one: Player gets stuck on edges between TilemapCollider2D tiles), but none seem relevant for me. The thing is my tiles are not flat.. they have pointy edges due to grass.. see the image below:

As you can see, the edge is not flat. I have overcome the problem of getting stuck by changing the "Edge Radius" to what you see in the above screenshot and that works, but the character now looks like he is floating slightly above the ground. Is there any way I can just tell Unity to ignore the jagged grass and make the collider flat and move the edge of it down a bit? That way it would fix the issue and also have the added bonus of looking like some of the grass is behind him and some in front..

sentences:
Problems implementing a screen space shadow ray tracing shader Here I previously asked for the possibility of ray tracing shadows in screen space in a deferred shader. Several problems were pointed out. One of the most important problem is that only visible objects can cast shadows and objects between the camera and the shadow caster can interfere. Still I thought it'd be a fun experiment.

The idea is to calculate the view coordinates of pixels and cast a ray to the light. The ray is then traced pixel by pixel to the light and its depth is compared with the depth at the pixel. If a pixel is in front of the ray, a shadow is casted at the original pixel.

At first I thought that I could use the DDA algorithm in 2D to calculate the distance 't' (in p = o + t d, where o origin, d direction) to the next pixel and use it in the 3D ray equation to find the ray's z coordinate at that pixel's position.
For the 2D ray, I would use the projected and biased 3D ray direction and origin. The idea was that 't' would be the same in both 2D and 3D equations. Unfortunately, this is not the case since the projection matrix is 4D. Thus, some tweak needs to be done to make this work this way.

I would like to ask if someone knows of a way to do what I described above, i.e. from a 2D ray in texture coordinate space to get the 3D ray in screen space.

I did implement a simple version of the idea which you can see in the following video: video here

Shadows may seem a bit pixelated, but that's mostly because of the size of the step in 't' I chose.

And here is the shader:

#version 330 core

uniform sampler2D DepthMap;

uniform vec2 projAB;
uniform mat4 projectionMatrix;

const vec3 light_p = vec3(-30.0, 30.0, -10.0);

noperspective in vec2 pass_TexCoord;
smooth in vec3 viewRay;

layout(location = 0) out float out_AO;

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

void main(void){
    vec3 origin = CalcPosition();
    if(origin.z &lt -60) discard;
    vec2 pixOrigin = pass_TexCoord; //tex coords
    vec3 dir = normalize(light_p - origin);

    vec2 texel_size = vec2(1.0 / 600.0);

    float t = 0.1;
    ivec2 pixIndex = ivec2(pixOrigin / texel_size);
    out_AO = 1.0;
    while(true){
        vec3 ray = origin + t * dir;
        vec4 temp = projectionMatrix * vec4(ray, 1.0);
        vec2 texCoord = (temp.xy / temp.w) * 0.5 + 0.5;
        ivec2 newIndex = ivec2(texCoord / texel_size);
        if(newIndex != pixIndex){
            float depth = texture(DepthMap, texCoord).r;
            float linearDepth = projAB.y / (depth - projAB.x);
            if(linearDepth &gt ray.z + 0.1){
                out_AO = 0.2;
                break;
            }
            pixIndex = newIndex;
        }
        t += 0.5;
        if(texCoord.x &lt 0 || texCoord.x &gt 1.0 || texCoord.y &lt 0 || texCoord.y &gt 1.0) break;
    }
}

As you can see, here I just increment 't' by some arbitrary factor, calculate the 3D ray and project it to get the pixel coordinates, which is not really optimal. Hopefully, I would like to optimize the code as much as possible and compare it with shadow mapping and how it scales with the number of lights.

PS: Keep in mind that I reconstruct position from depth by interpolating rays through a full screen quad.

sentences:
How can I move a 3d object to a known Cartesian point on the surface of a sphere? I'm trying to figure out how to move an object from one Cartesian point to another located on the surface of a 3D sphere. So that the object will follow the spherical coordinate system (Theta and Phi)

I've a function that converts a Cartesian to Spherical but how can I make it work on the surface of a sphere just like we are using the equation of a line y=mx+b when moving from one point to another on a flat surface?

I'm going to use it to move an object from its point to a selected point somewhere else on the sphere so that the object will move in a straight line but following the curvature.

sentences:
Build a handshake server for a multiplayer game I'm making a multiplayer mode for a game I developed, and it works over UDP.
What I need now is a server to let a player know another player, and send each one the other's IP.
I own a VPS that I'm currently using to host a few websites, so I guess I can use it for this purpose too.

I would choose Python as a language to build it.  But I don't know where to start...
Should I make it on HTTP or TCP?
Is there any library I can use to simplify the work?
Or any example of something similar?

Any help will be appreciated.

sentences:
How can I prevent picking up health items when I'm already at max health? This is what I have so far..

public class Per10HealthCollect :MonoBehavior

    void OnTriggerEnter(Collider other)
    {
        if (GlobalHealth.healthValue >= 91)
        {
            GlobalHealth.healthValue = 100;
        }
        else
        {
            GlobalHealth.healthValue += 10;
        }
        GetComponent< CapsuleCollider>().Enabled = false;
        this.gameObject.SetActive(false);
    }
}

sentences:
How to make sure user is running the newest version of mmo client? In typical mmorpg game, you have a launcher and a client. You first run the launcher to update the client, then you run the client. In every mmo I tried if you run a client without updating first (if update is available), it automatically closes and (usually) starts launcher.

My question is, how can you check if user has the proper version of client? I though about server asking client about its md5 however it's so easy to cheat. I think that there is no safe way of handling it yet every mmorpg I know uses such a system.

So how do mmorpg games handle this problem? To make sure that the client is at the newest version?

sentences:
Using a Wii remote as main controller? I would like to use a Wii remote to control my player in my 3D game.

So far I have the arrow keys and mouse to move and look but I want the Wii d-pad to move and accelerometer data to look around.

I have downloaded Unity-Wiimote-1.1 and the demo works fine. In my game I have imported the Unity package for the Wii remote but I'm not sure what script goes where, attached to what, how to call particular functions. They are mostly C# scripts.

There is no documentation with the Unity-Wiimote-1.1 and as I'm a newbie, I'm clueless on what to do.

Or is there a simpler method to getting the Wii remote to be the main controller?

sentences:
boolean operations on meshes given a set of vertices and triangles for each mesh. Does anyone know of an algorithm, or a place to start looking( I tried google first but haven't found a good place to get started) to perform boolean operations on said meshes and get a set of vertices and triangle for the resulting mesh? Of particular interest are subtraction and union.

Example pictures: http://www.rhino3d.com/4/help/Commands/Booleans.htm

sentences: Developing Cartography for Simulated Land Navigation or Orienteering Request to know what the best approach for developing a simulated Large 1:75,000 or 1:50,000 scaled map using GODOT or another game engine. My goal would be to create a 3D world that allows the player to view a 2D map which is similar to real world USGS/NGA style maps using UTM/MGRS for land based navigation. Later I would add tools such as the Cammenga 6605-01-196-6971 Compass and a Maptools style protractor. I have spend hours searching for examples of GODOT developed games using maps similar to approaches used in Arma 3 and Firewatch. I would greatly appreciate any advice on techniques used with GODOT or other game engines to create a mapping system for players. Thank You!

sentences:
When using IK the player head is looking at down the ground instead looking at the object target up what can be the problem? This script is attached to the player :
using UnityEngine;
using System;
using System.Collections;

[RequireComponent(typeof(Animator))]

public class CharController : MonoBehaviour
{

    protected Animator animator;
    public bool ikActive = false;
    public Transform lookObj = null;
    public float lookWeight = 2f;

    void Start()
    {
        animator = GetComponent<Animator>();
    }

    //a callback for calculating IK
    void OnAnimatorIK()
    {

        if (animator)
        {

            //if the IK is active, set the position and rotation directly to the goal.
            if (ikActive)
            {
                // Set the look target position, if one has been assigned
                if (lookObj != null)
                {
                    animator.SetLookAtWeight(lookWeight);
                    animator.SetLookAtPosition(lookObj.position);
                }

            }

            //if the IK is not active, set the position and rotation of the hand and head back to the original position
            else
            {
                animator.SetLookAtWeight(0);
            }
        }
    }
}

When the lookObj is a sphere or a cube it's working fine but if the lookObj for example is a big spacecraft now the player head will look to the ground down and not to the spacecraft up :

The problem is that the center of the spacecraft is at the bottom this is a screenshot when it's showing the spacecraft at regular when it's in Pivot mode :

Now when I click on the Center button now the center of the object is at the bottom :

Is there any way to fix it maybe eve fix it ?

sentences:
Where should I place my reaction code in Per-Pixel Collision Detection? I have this collision detection code:

public bool PerPixelCollision(Player player, Game1 dog)
{
    Matrix atob = player.Transform * Matrix.Invert(dog.Transform);

    Vector2 stepX = Vector2.TransformNormal(Vector2.UnitX, atob);
    Vector2 stepY = Vector2.TransformNormal(Vector2.UnitY, atob);

    Vector2 iBPos = Vector2.Transform(Vector2.Zero, atob);

    for(int deltax = 0; deltax < player.playerTexture.Width; deltax++)
    {
        Vector2 bpos = iBPos;
        for (int deltay = 0; deltay < player.playerTexture.Height; deltay++)
        {
            int bx = (int)bpos.X;
            int by = (int)bpos.Y;

            if (bx >= 0 && bx < dog.dogTexture.Width && by >= 0 && by < dog.dogTexture.Height)
            {
                if (player.TextureData[deltax + deltay * player.playerTexture.Width].A > 150 && dog.TextureData[bx + by * dog.Texture.Width].A > 150)
                {
                    return true;
                }
            }
            bpos += stepY;
        }
        iBPos += stepX;
    }
    return false;
}

What I want to know is where to put in the code where something happens. For example, I want to put in player.playerPosition.X -= 200 just as a test, but I don't know where to put it. I tried putting it under the return true and above it, but under it, it said unreachable code, and above it nothing happened. I also tried putting it by                bpos += stepY; but that didn't work either. Where do I put the code?

sentences:
How should I store loaded world chunks in RAM (For my game similar to Minecraft)? I am trying to replicate a chunk loading system, in C, for my own minecraft like game, though I don't know how. Once chunks are loaded, are they placed in an array, or are there a bunch of variables for each loaded chunk?
In my game, once I load chunks using fread, what should I use to store them? My problem for a two dimensional array for storing chunks, is that the loaded chunks might be separate and not start at zero. Are there any suggestions for storing loaded chunks?

I have a code fragment, solely so you guys will not yell at me for not including code:

    char ChunkFilePath[strlen(CurrentWorld)+32];
    sprintf(ChunkFilePath, "%s/ChunkData/%ld %ld", CurrentWorld, X, Z);
    FILE *ChunkFile;
    if ((ChunkFile = fopen(ChunkFilePath, "r"))) {
        //chunk file exists, Read Chunk file to ???
    }
    if ((ChunkFile = fopen(ChunkFilePath, "w")) == NULL) {
        fputs("Error Loading Chunk (File Not Found)", stderr);
        return;
    }
        /*Chunk does not exist, but any other errors would have been caught
        at this point, so Generate chunk, write generated results to ???*/

Note: The game I am trying to make is purely for my personal use, not for any commercial use.

  Edit:

The problem is just an array will not work. Suppose there is a player at 1000000 and another one at -1000000 They would only render 6 chunks around them, but if they shared an array, all the 2000000 blocks worth of chunks that aren't loaded would be taking up memory. I would refer to chunks like LoadedChunk[1000]. How can I handle that?

sentences:
LWJGL 3.0.0 glMapBuffer I am currently working on a project and usually in C++ I use the function.
ByteBuffer glMapBuffer(int target, int access)

usage:

FloatBuffer buffer = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY).order(
    ByteOrder.nativeOrder()).asFloatBuffer();

But in java (lwjgl 3.0.0) this function returns null, because of this reason it throws a NullPointerException.

Anyone any idea how to use this function in java?

There are several functions:

glMapBuffer(int target, int access)
glMapBuffer(int target, int access, ByteBuffer old_buffer)
glMapBuffer(int target, int access, long length, ByteBuffer old_buffer)

I hope this is specific enough, thank you for your help :D

sentences:
libGDX: Why doesn't Gdx.input.isKeyJustPressed() work? I'm trying to use the method Gdx.input.isKeyJustPressed() to check if the Android BACK button was just pressed. I don't want to use the Gdx.input.isKeyPressed method to avoid multiple calls. Here is my code:

public void handleInput() {
    if(Gdx.input.isKeyJustPressed(Input.Keys.BACK)) {
         // show previous screen...
    }
}

public void update(float dt) {
    handleInput();
}

But unfortunately this doesn't work. Any ideas?

sentences:
Place tile values over 'chunk' boundries My game has a 'chunk' engine similar to Minecraft's but in 2 dimensions.
Each chunk is a square of 32 by 32 tiles.

What I want to do is generate a defined shape across multiple chunks without breaking the shape.

This is made difficult by the fact that chunks are generated one chunk at a time in unknown intervals of time, so I cannot place a structure after the amount of chunks it needs to fit in are generated, as the player might move into the area before that time.

Another problem is that I cannot simply tile the shape uniformly because the shape needs to be exactly one tile above the surface, which is a heightmap generated using simplex noise, so it is not flat.

Is there any way I can generate this structure from one point of origin placed at random intervals over a heightmap that is known?

Example of what I want:

Grey Lines - chunk bounds

White Tiles - structure generation

Blue Tiles - known 1D heightmap

How can this be done?

sentences:
Animated textures for models; How to write a shader? Was watching some Rocket League and notice there was animated decals and wheels.

.

I would like to implement something similar to the effects in the image above.

How would I go about writing a Unity Shader to do the wheel effect?

I don't know much about Shaders, but can I edit the standard Unity Shader to do the animation effect?

sentences:
Bones Animation - Matrices and calculations We are 'on final' when it comes to finishing the project, but just before implementing the animation system.

Our Client decided to choose "Bones Animation" - which is that I should export each  Transformation Matrix ( matrix4x4 rotation+translation ) for every frame and for every bone that this animated object has.

Objects in our game are animated with 3DS Max Physique Modifier, so we will have bones / weighting data per vertex. But I will simplify things here just to get a bit of light on this subject.

I would like to split this post into 2 points, where :

Exporting bones matrices for every frame

treats about the correct method of exporting the bones positions for later animation purposes, where i have to 'move' and 'rotate' every vertex influenced by this bone to bone position at frame X.

Calculating final vertex position

treats about proper matrices operations to calculate new vertex position according to bone transformation in frame X.

1. EXPORTING BONES MATRICES FOR EVERY FRAME

Do I understand correctly that while exporting the animated object I should:

  Grab BONE transformation matrix at frame 0 and Invert this matrix
  Grab BONE transformation matrix at FRAMEx
  Multiply 1 * 2 to get the transformation offset of the BONE at FRAMEx

[pseudocode]
// Animation export

// For each frame, export bone transformation offset
for(int iFrame = 0; iFrame < vFrames.size(); iFrame++)
{
    // For every bone in the object
    for(int iBone = 0; iBone < vBones.size(); iBone++)
    {
        // Grab transformation matrix for this bone at frame 0 and inverse it
        Matrix3 matBoneMatrixAtStart = pNode->GetObjectTMAfterWSM( 0 );
        matBoneMatrixAtStart.Inverse();

        // Grab transformation matrix for this bone at frame iFrame
        Matrix3 matBoneMatrixAtCurrentFrame = pNode->GetObjectTMAfterWSM( iFrame );

        // Multiply Inversed Transformation Matrix of this bone at frame 0 - with
        //  current frame transformation matrix
        Matrix3 matBoneTransformationOffset = matBoneMatrixAtStart
                                              * matBoneMatrixAtCurrentFrame ;

        // Save matBoneTransformationOffset - vertex will be multiplied by this
        //  matrix for animation purposes
        fwrite(.....)
    }

}
[/pseudocode]

Will that be enough ? Or there is something I am missing here?

2. CALCULATING NEW VERTICES POSITIONS ( FINAL VERTEX POSITION AT FRAME X)

Later on, when rendering, object vertices are going to be multiplied by exported bone transformation matrix for actual animation frame, and then multiplied by
 this whole model transformation matrix to place the object in correct position inside the level :

[pseudocode]

Update()
{
    // The model transformation matrix describing the position of
    //  the model in the level
    matModelTransformationMatrix

    // Calculate new vertex position according to it's bone transformation offset
    NewVertexPosition = (OriginalVertexPosition * matBoneTransformationOffset[iFrame])
                           * matModelTransformationMatrix;

    // Increment the frame for testing purposes
    iFrame++;
}

[/pseudocode]

Am I thinking correct here? So, Having bone transformation offset for frame X, multiplying every vertex affected by this bone by this offset should result in a vertex transformed exactly as this bone right?

sentences:
How to select random points within grid meeting min/max distance requirements from each other? I have a 2D grid map that is relatively large. I'd like to pick some semi-random points all over it (say N points). The rule I want to ensure here, though, is that any selected points are at least M distance from every other selected point but no more than L distance from at least one other point.

Is there a fairly elegant way of doing this without having every new point's distance calculated for every existing point (being less computationally expensive as well)?

I imagine the rules could be met by something like partitioning the map out into rectangular segments and just kind of flood-fill randomly from one inner segment outwards, but I'm having a little trouble visualizing that where my L, M, and N values are randomly chosen (L is of course greater than or equal to M, but not entirely sure what the rules will be for M or N or even the size of the map).

The reason for this whole thing is a procedural waypoint system that I can then build a 2D dungeon crawler type map by using a path finding system to create tiles from waypoint to waypoint essentially.

If this is too vague or any other issues, just let me know and I'll happily try to explain further.

Edit: To give some hard numbers as an example, say the full grid is 2,000 by 1,000 total possible points. Assume you want 5,000 total waypoints spread fairly randomly across the map. Each of the 4,000 points need to be (euclidean distance) greater than 20 from every other point and less than 30 away from at least one other point.

sentences:
To scene graph or not to scene graph? I've been struggling with a decision regarding whether or not to implement a scene graph in my game. I have some use cases that call for such a tool, but I haven't been able to get through some of the implementation details.

Some background: I'm writing a space shooter type game targeted at mobile platform (Android, primarily) and my code is almost entirely C++. I'm not using any middleware; the rendering and physics engines in particular are my own creations. My physics engine updates locations of objects based on forces and impulses. I have no animation system as of yet but may visit this at some point (which may or may not have anything to do with this discussion).

First, I'll describe a good use case. I would like to have a boss that is made up of several discrete parts, each of which can be damaged / destroyed independently. For example, I might have a boss that has an arm that can receive damage independently of the rest of the boss entity. When the arm is destroyed, a fire particle effect located at the bosses' shoulder could indicate that the arm is now destroyed.

As it is, I have decided to try solving such problems with constraints in my physics engine to keep such compound objects together. One such constraint provides 0 degrees of freedom and is essentially a transformation matrix. This is really an attempt to circumvent a problem that ultimately turned me off of scene graphs in the first place, described below.

The primary reason I turned away from use of a scene graph is because I could not find an efficient way to keep nested objects (objects that inherit a transformation from their parent) in both the physics world and the rendering scene. The physics world needs objects to be in world-space (or at least the same space) while the rendering scene needs objects in parent-space. Tracking locations in both spaces might help (and be inevitable) but raises its own concerns, not the least of which relates to performance.

However, given use cases like the one described above, I think that being able to 'work' in parent space will become very important, and trying to force my physics engine to maintain these relationships through the use of constraints is going to become problematic.

Given the use case and predicament described above, should I use a graph structure to pass transformations from one object to another? If so, how should my physics engine calculate new locations and perform intersection tests for objects in different spaces?

sentences:
uniform z slices in clip-space 1) Context
I'm using a regular OpenGL perspective projection matrix created with GLM (glm::perspective) and taking the inverse (glm::inverse) to transform clip-space back into view space (and world space ultimately). Now with z-values at the near and far plane it's easy to choose the x,y,z,w components of the clip-space cube corners and get the world space point of the frustum volume.

2) Question
Now, I want to harness the fact that clip space is a cube and generate a grid over the frustum. for x,y this works with the regular inverse projection matrix. For z, if I take uniform subdivisions of the range [-1.0, 1.0] with w=1.0, the view space z values will not be linear. I haven't got enough sleep recently to convince myself to do the math. What would be an inverse projection matrix to do this?

sentences: Stop detecting Input in Unity? How can I stop detecting input from the user in Unity? I want to achieve the following: "do not detect Input.GetMouseButtonDown" In C#?

sentences:
Mobile game: Optimization only working on some devices / Render big texture causes stuttering after level load I'm currently optimizing the rendering of the background of my mobile game. The background consists basically of many colored dots. Since the background is static I'm able ro render the whole background into a 1024x1024 texture (render to texture), so the colored dots don't have to rendered in realtime (especially the blending is gpu intensive).

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

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

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

Consider that mobile devices have a frame cap of 60.

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

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

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

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

sentences:
How can I run a shader over the entire screen without interfering with other running programs? How can I run a shader over the entire screen without interfering with other running programs? Specifically, I'd like to adjust the screen output with usability tweaks for my severely colorblind nephew. He has trouble playing certain games.
I'd like to avoid hooking into DirectX, and just run a shader over the entire screen. Is this something I can do in Windows without draining an unreasonable amount of resources?
I can use whatever language or tool is most practical for this, but I'm most comfortable with Java and HLSL.

sentences:
Does Unity load the texture data of all the sprites in a sprite array property? using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

    public Sprite[] mySprites;

}

From the editor, you can put sprites in the array property.

I want to put several large sprites there, like, 20 huge ones. However, only one of the 20 will be used by a SpriteRenderer at any given moment (I just have them in an array so I can switch easily in the future).

My concern is performance: does having an array containing 20 "Sprite" references imply that Unity will load the texture data of all 20 sprites? Or will Unity only load the data for the sprite that will be used by SpriteRenderer smartly?

sentences:
Sounds make Andengine Scene junky I have a GameScene which has a character (animated sprite), AutoParallaxBackground background with quite large textures and no more than 3 other items attached to the scene at a time, previous 3 items are dispose()-ed accordingly, background music and item sounds. Background music is instantiated with MusicFactory, Sounds are played on SoundPool. In between switching these scene we are loading resources asynchronously, reading the streams and instantiation is done in AsyncTask and the loading textures to the hardware is done on UpdateThread/GLThread. If I turn off the background music, this starts to happen totally random.

I'm experiencing scene junking on at first flow: MenuScene -> 1st Stage (GameScene). After a while lag does not happen, rather than occasionally or random. Junk is happening when aforementioned 3 items are attached on the Scene and a sound is played along, note that background music is playing at the same time.

Detaching previous 3 items is "optimized" to reduce GC calling almost perfectly. When the lag occurs GC_EXPLICIT is showed in the logcat.

What I have tried:

Playing the sounds and music on different thread, IntentService, dedicated Service.
Reduced calls to mScene.detachChild(child) and other scene methods to avoid iterations over children of the scene.
Detaching IEntitys with matcher to avoid iteration.
Inspected sound files' integrity with ffmpeg for possible errors

Could .dispose(), unloading the textures from hardware or detachChild() causing this junk?

Could be marked object for GC from the async tasks be causing this?

What else could be contributing to this issue?

sentences:
Is Godot's NavMesh viable for dynamic pathfinding (e.g. avoiding moving enemies)? I am a novice (read: low-budget) designer looking at moving from Pygame to a real engine, and between Unity and Godot it looks like the latter has a much better 2D engine [1, 2, 3]. I would be happy to support Godot's open-source model except that, as far as I can tell, its built-in navigation mesh is purely static--i.e. it can't update its path to account for dynamic obstacles [4, 5]--while Unity's pathfinding system can [6].

So my question is: Am I "stuck" with Unity? Or is there functionality that I haven't yet been able to find? Or, alternatively, is GDScript significantly faster than Python such that basic algorithms like fixed-grid A* would do the job?

Edit: By "stuck" with Unity I don't mean that it's a bad option or that there aren't good options; I mean, 'if I need good pathfinding, do I have to give up on Godot and use what would otherwise be a second-choice engine?'

sentences:
How to position two objects relative to each other I am trying to make a modular vehicle editor similar to Kerbal Space Program. The user selects an initial vehicle part which is spawned in the center of the "work area". To add another part to the initial one, the user clicks and drags a part from a list onto the "work area" and then drags that part towards the initial one. When a node on the new part is close enough to a node on the initial part, the new part snaps onto the initial one. The user can then click to confirm the connection or drag it somewhere else. For a visual example.

The spawning of the parts I have no problem with.

For moving the parts in the environment I have an invisible plane that is parallel to the camera and rotates to always face the camera. I then draw a ray from the mouse to the plane and update the parts position to the location where the ray hits the plane.

When the new part is in the correct position I will add I make it the child object of the part I want to connect it to.

The problem occurs with positioning the new part relative to the part I want to attach it to. I'd like to make it like Kerbal Space Program where when the connecting node of the new part is within range of the connecting node of the part I'm attaching to, the new part's position snaps to the part I'm attaching to.

sentences:
P2P synchronization: can a player update fields of other players? I know that synchronization is a huge topic, so I have minimized the problem to this example case.

Let's say, Alice and Bob are playing a P2P game, fighting against each other. If Alice hits Bob, how should I do the network component to make Bob's HP decrease?

I can think of two approaches:

Alice perform a Bob.HP--, then send Bob's reduced HP to Bob.
Alice send a "I just hit Bob" signal to Bob. Bob checks it, and reduce its own HP, then send his new HP to everyone including Alice.

I think the second approach is better because I don't think a player in a P2P game should be able to modify other players' private fields. Otherwise cheating would be too easy, right?

My philosophy is that in a P2P game especially, a player's attributes and all attributes of its belonging objects should only be updated by the player himself. However, I can't prove that this is right. Could someone give me some evidence? Thanks :)

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

sentences:
Implementing Power-Ups in a game I'm making an Arkanoid or Brick Breaker game, but I got confused when I wanted to implement power-ups. The idea is that when you destroy a brick, a powerup-block falls down, and if you catch it you'll get the powerup.  -for example:

Wider Paddle (change dimensions of the quad)
Change ball speed (variable)
Ball goes through blocks (no reflection on hittest)
Shoot lasers from the paddle (change in input handling)

Now I pretty much know how to affect the code to achieve these effects, however not in a clean, flexible way. I have my ie my ball and paddle hard-coded in java (GameObjects), and my Levels/BlockTypes in xml.

One terrible way to do it is to have like a flag telling which powerup is active, and by that alter the code with loads of if- statements.

Could anyone help me with how this is done?

sentences: How should I approach AI for Spades game? I was hoping some one could point me in the right direction about what type of AI you would use for a Spades game? For instance, would you create a behavioral tree or would you implement some other type of AI concept. I'm fairly new to AI which is why I'm hoping to get some AI vets to chime in.

sentences:
What's the most efficient way to create underground layers of procedural terrain? Background information

I am in the process of making a game engine so I have complete, explicit control over everything, anything is an option. I desire to make procedurally generated 3D terrain. It's mostly coming along quite well actually.

I am however, having a difficult time finding any good information on how exactly destructible terrain can be done optimally. I think the mesh deformations could be done at run-time and written to disk but the issue I encounter there is the desire to have ore and similar resources under the ground. I've had the idea to layer additional maps for each unit length of depth but that just seems like it'd have a heavier impact on performance than I'd like.

I know it's of course possible to do that but how to do it efficiently is what I'm interested in here. Perhaps I'm just using bad keywords when I search for information but I'm not turning up much of anything of use on this topic.

I've gone beyond just Perlin Noise for the generation as well using various other algorithms for layers such as vegetation, ground cover like small rocks, etc. By generating the texture maps using the techniques I'm sure we're all familiar with.

A lot of the ideas I've been coming up with would work I suppose but I don't like the obvious impact of performance my ideas have been so far.

Eventually of course I'd have a layer of solid indestructible bedrock but I can't figure out a way better than having a texture map for each layer down per unit length. So if I had a depth of 60 units before hitting the layer of solid bedrock that would mean 60 texture maps. I don't like that at all. Surely there is a better way. I've seen a lot of games not render or even generate the underground at all during initial creation of the game world and do that at run-time but I can't figure out how ore and similar resources could be generated in varying depth layers effectively on initial creation of the world. If the map is color coding by resource it wouldn't exactly work to also color code the height as you would with a height map. It must be one or the other.

Question

The problem I'm having now is underground. What would be the best way to implement underground layers in a performance friendly way that doesn't involve an excessive number of textures used?

sentences:
Deferred lighting and point light volumes I'm doing deferred point light shadow mapping and I am drawing my point lights using light volumes. Normally I access the position/diffuse texture/normals using this in the fragment shaders:

vec2 texcoord = gl_FragCoord.xy / UnifPointLightPass.mScreenSize;

vec3 worldPos = texture(unifPositionTexture, texcoord).xyz;
vec3 normal   = texture(unifNormalTexture, texcoord).xyz;
vec3 diffuse  = texture(unifDiffuseTexture, texcoord).xyz;

When doing directional lights, I just draw a fullscreen-rectangle, but when doing point lights I use light volumes - drawing a 3d sphere from the cameras point of view to limit the amount of fragments processed.

Does light volumes change the way I get the texcoord?

sentences:
what function creates rotation effect in three.js? which part of the code is responsible for the rotation in this example? Is it the camera or the scene itself?

http://threejs.org/examples/#canvas_camera_orthographic

sentences:
How can I record my vector graphics game without  blurring the graphics? A lot of people asked for a trailer for my game, because screenshots do not do it justice. I have tested PlayClaw, Fraps, CamStudio, VirtualDub, and some other minor tools; none have produced a viable result. My game uses vector graphics and is designed to run at 60fps, so lossy compression of a regular screen capture video destroys the graphical appeal.

How can I record gameplay without blurring my graphics and slowing down the framerate?

sentences:
elements of list are changing their values I'm making an app that's similar to an alarm, the user enters time and days, for days I'm using toggles,and storing the values of toggles states in a list which is stored in a list that contain all the inputs of the type days, then the user could edit any of his inputs, his old input are supposed to be shown there , but the problem is even when I'm storing them, old values are changing when I add new elements,(that's when currentToggle is changing) so when he press edit values aren't the same as he entered them

I think it has something to do with nested lists but I can't figure out how, ( assigning hours and minutes is perfectly working and both are normal lists)

the confirm method is for when the user confirm his choice, and there's edit button that open a panel ,its values are the same as the user entered them before

the index gives the number of the selected group of input, dayholder is the gameobject that contains all the toggles , and that's the part of the code that's related to what I've said

Toggle[] toggles;
List<bool> currentToggle = new List<bool>();
List <List<bool>> daysAll = new List<List<bool>>();

void Start () {
    toggles = dayHolder.GetComponentsInChildren<Toggle>();
}
public void confirm()
{

    checkON();
    daysAll.Add(currentToggle);
}
 public void editBut()
{
    GameObject panelC = EventSystem.current.currentSelectedGameObject.gameObject.transform.parent.gameObject;
    int index = panelC.transform.parent.gameObject.transform.GetSiblingIndex();
    assignDays(index);
}
void assignDays(int index)
{
    for (int i = 0; i < daysAll[index].Count; i++)
    {
        if (daysAll[index][i] == true)
            toggles[i].isOn = true;
    }
}
public void checkON()
{
    currentToggle.RemoveAll(item => item != null);
    for (int i = 0; i < toggles.Length; i++)
    {
        if (toggles[i].isOn)
            currentToggle.Add(true);
        else
            currentToggle.Add(false);
    }

}

sentences:
Canting of track in a racing game I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the canting of the track at each point.

My problem is that I don't know how to calculate the correct canting / slope of the curve, in such a way that it would be optimal or at least visually nice for a car to 'slant in the corner'.

My idea was to use the direction of the 2nd derivatives of the curve, however while this approach looks fine for most of the track, there are points in which the 2nd derivative makes sharp 'twists' / very quick 180 degree flips. I also read about 'knots' of bsplines, but I don't know if such 'twist' in 2nd derivatives is a knot or knots are something else.

Can you tell me that using a BSpline:
1. How could I calculate a visually nice canting of a track for a racing game?
2. Is it possible to do this by using some simple calculations of centripetal force / gravity?
3. Is it possible to do this by using 1st, 2nd and 3rd derivatives of the BSpline curve?

I am not looking for the 'physically correct' canting angle for the track, I would just like to create something which is visually pleasing in a simple game.

I am using a framework which has a built-in class for BSpline, including support for 1st, 2nd and 3rd derivatives of the curve.

sentences:
Game over pop-up like Flappy Bird How can I make a game over pop-up like Flappy Bird in cocos2d-iphone 3?

I tried to add a new Scene, but it adds a new screen on the game, I just want a rectangle with some buttons inside it. I also search how to add multiple scene, but didn't find an example doing it.

sentences:
A.I. dependencies based on components I'm working on a turn based game in Unity. I need to perform field/grid analysis(2D grid) when i'm iterating trough each unit "entity". The A.I. should be able to plan ahead and therefor needs to consider the components each unit have. Not every unit will have the same ability. These abilities are defined as components.

I want to make it flexible in the sense that I can plug in new abilities and my A.I. will take it into consideration.

While user control is somewhat implemented, A.I. hasn't even been written. So I'm open to any suggestion.

Q : What is a way for the A.I. system to collect all abilities of one unit and make decisions depending on each component?

edit:
I know there is the "null" checking method to see if the gameobject contains a component. But this is highly inflexible because you are hard coding a stack of if else. Something I want to prevent.

sentences:
Collisions on complex map 2D I'm currently thinking about collision and map system that I want to use in my next game and I'm kind of puzzled. Maps are going to be somewhat complex with lots of irregularities and thus tiling is out of question.

I thought about an editor where you'd draw rectangles on the map that would represent areas that are collidable with and then saving such "collision map" with only black/white gfx. Or maybe should I save exact rectangles data with their x/y/width/height into some text file and go from there?

What would you recommend? Thanks.

sentences:
Cinematographic camera manipulation techniques for a 2D adventure game I'm coding a subsystem to manipulate camera for our 2D adventure game.

I plan to support panning and zooming. Also, perhaps, rotation (but current scenario does not call for that). We also support parallax scrolling, if that matters.

To better understand what means of expression my level-designer would need to design best experience for the player in cutscenes, I'm looking for a good documentation on relevant cinematographic camera manipulation techniques. (Yes, of course, I plan to have a discussion with my level-designers as well.)

Maybe there is a good basic guide for a camera manipulation in a 2d-animation movie or something like that — what techniques are there, and when to use what.

Or maybe there is some relevant document that is written from the game-development point of view?

Any advice welcome.

sentences: How to model chess knight movement in GameMaker? I am making a chess game in GameMaker, and I have the basic movement down for all of the other pieces except for the knight. I am using a system where I have an if statement that checks if the mouse is in a location that it can move too, then if it moves the piece there. For example, the rook code is (mouse_y div 64) *64 == y || (mouse_x div 64) * 64 == x. What would be an expression that would work for knights? Would this strategy even work for knights?

sentences:
Select specific tile in Tilemap I am following this video tutorial on how to implement drag-to-select behavior like in an RTS. The only difference is, I'm using a tilemap.
The selection area is a square which I can drag to make it as big as I want, like in any top down RTS.
CodeMonkey in his video uses Physics2D.OverlapAreaAll to get a list of all colliders in the selected area. I want to use this to specifically see which "vegetation" tiles I've selected. However, no matter which vegetation tile I select, or how many, I always get one result - the vegetation tilemap itself.
You can clearly see from this picture that every grass tile and every tree tile have a collider around them, which is why this works, but how can I get exactly those that I selected?

Other than vegetation from the tilemap, I also want this to work with GameObjects that have Box2DColliders on them, and that works out of the box. I also made those MonoBehaviors inherit an interface called ISelectable, so I can only add to the selected list entities that have that inherit that interface. I tried to do the same with vegetation like so public class Vegetation : Tile, ISelectable but it doesn't work.
What am I missing? Can this even work on a specific tile basis?

sentences: Error on running exe, build using SharpDX I have developed a windows application to read gamepad using SharpDx (XInput) and C# (VS 2008). The application is running smoothly in my development environment. But when i move to some other machine (Windows 7), its giving me error "Unable to load dll 'xinput1_3.dll' ". My question is is it mandatory to have directx runtime environment in clint machine also to run the exe ?  Because i was thinking it will make use of dll "XInput9_1_0.dll" which is a part of windows 7.

sentences:
BSPs, Octrees and modern graphics hardware I have read a lot of literature on BSPs, Octrees and like. Problem is that it is all old literature from software rendering time. Nobody describes how it is implemented today. So here is my idea how to do it and my question.

Let's say that I use some partitioning algorithm, it does not matter which one. I subdivide my level mesh into multiple partitions and store it in RAM. Should I simply create vertex buffers for each node so I can render my scene faster or what?

How do you do it, is there any better way today?

Thank you

sentences:
Can I run old projects after updating Unity? Today I decided to upgrade unity from 5.0.0 to 5.5.0.

But before updating it, I wanted to know: Can I run/build my projects made in Unity 5.0.0 in Unity 5.5.0?

sentences:
No MODS button in Windows Minecraft when selecting Forge profile I have installed a Minecraft launcher in Windows that supports Minecraft 1.14. I have installed Forge 1.14.4-forge-28.0.13. I have created the mods folder and placed a mod jar in it which is Xaeros_Minimap_1.17.4_Forge_1.14.4.

I have selected the Forge profile in the launcher. When running the launcher, I have to remove JVM option -XX:+CMSIncrementalMode in order to run it (also when running the regular profile). I have Java 11 installed.

But after launching, there is no MOD button in the menu. What could be the problem?

sentences:
Joystick like controls in unity for mobiles How can i achieve joystick like controls on mobile?

For example i have a 2D platform game where character should keep on moving right when swiped right and held and vice versa, just like a real joystick.

I'm beginner in unity so don't know where to start. Are there any assets in the store from which i can create these controls?

sentences:
How do I get the size of a Plane in pixels and set it multiplied by some factor to be the size of a Sphere? I am doing an attempt to make a 3D snake game, as an experiment but I am still a beginner. I have a Sphere that I wish to dynamically resize to be, let's say, the 20th part of the width of this Plane. How can I do this? I thought to find the size of the Plane first. I also thought to use Screen.width and Screen.height because in my actual project the Plane is almost the size of the screen, but from what I found the Transform class does not have a way to resize it to a specific dimension in pixels.

Using the code below I do not get this work, but I also see that the Sphere becomes a black circle because of the only instruction in the Start method.

Existing code

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

// Attached to the Plane
public class SphereResizer : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        // what should I put here?
        GameObject.Find("Sphere").transform.localScale = new Vector3(1f, 1f);
    }

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

Screenshots

Download the example

Here is the GitHub repository.

Thank you.

sentences:
Unity "Text Mesh Pro UGUI" component rewrites my text! Make it stop? I'm having this terribly annoying problem where my text is being overwritten by Unity. This Happens regardless of whether I am using tags or not.

Here is what I want to appear (more or less, I don't think this example is using the tag):

And here is what happens when I try to include a monospace tag:

Since you might not see it here, the text I inputed is

<mspace=64px>A</mspace>

This works FINE for regular TMP objects, which the other 3 are (and are using). I am trying to implement dropdown (and left, and up, and right) menus.

You can see that Unity overwrites it as "Option A", like it has a clue what I'm doing. What can I do?

sentences:
What's the "appLinkUrl" parameter in the "AppInvite" method for? I'm trying to figure out what should I assign the appLinkUrl parameter of FB.Mobile.AppInvite method. In documentation it says:

  The AppLink URL to identify your app and also used for deep-linking

Should i pass my Play Store link to it?

Thanks in advance.

The documentation page for FB.Mobile.AppInvite: https://developers.facebook.com/docs/unity/reference/current/FB.Mobile.AppInvite

sentences:
Expected numbers for user engagement I run a free-to-play online game that involves collecting creatures and simply clicking on a button to give them a small amount of EXP. The idea is to do this for other people and they're likely to return the favour and help you make your own progress.

The initial tutorial guides you through the basic idea until you've successfully obtained a full Party of 6 before leaving you to your own devices, to make your own objectives and stuff.

I've noticed that players who make it through the tutorial tend to stay quite engaged with the game, but I also found these numbers:

25% of users join but never complete the first step of the tutorial, that is they never hatch their very first Egg.
A further 25% of users drop out of the game before finishing the tutorial, so having hatched only 1-5 Eggs.
Barely 50% of registered users actually complete the tutorial.

The problem is that I've never run this kind of game before. This is my first real project, but it's been going for several years now. I don't have any kind of baseline on what numbers to expect.

I can only imagine reasons right now, such as it being quite jarring to people that, in order to make progress, they have to help others make their progress and hope they return the favour.

So we have about half our users leaving before the tutorial is complete. Is this kind of thing normal? Am I worrying too much about this?

sentences:
How can I export models from 3DX Max into XNA? I am looking for a way to import my 3D models (including materials and shaders) from 3D Studio Max to XNA.

For example, if I have a model with diffuse, bump, reflection textures and values (through Max's basic shader), I want to be able to present it in real-time using the XNA framework.

I thought about doing it like this:

3D Studio Max -> ASCII FBX export.
Parse FBX and extract bump/reflection/et cetera textures.
Set up a custom HLSL shader and pass the relevant parameters to it.

Is this the correct way to do it?

sentences:
How do I calculate the points of a brush from a Source engine VMF? I'm trying to render the brushes from a Source engine .vmf file in C++, using OpenGL.

The .vmf stores solid brushes as a series of planes which I would like to use to calculate the points for each brush. I'm pretty sure this would be done exactly the same as for all Quake engine based .map files as well.

Basically each point of the brush is the point where 3 planes intersect. I found a similar question to mine on stackoverflow and the explanation is to get the unit normals for the 3 planes, then use equation 8 on this page mathworld.wolfram.com/Plane-PlaneIntersection.html. My problem is that I have no idea how to implement that

Here's some code for a single 6 sided cube shaped brush:

"plane" "(0 0 256) (0 256 256) (256 256 256)"
"plane" "(0 256 0) (0 0 0) (256 0 0)"
"plane" "(0 0 0) (0 256 0) (0 256 256)"
"plane" "(256 256 0) (256 0 0) (256 0 256)"
"plane" "(0 256 0) (256 256 0) (256 256 256)"
"plane" "(256 0 0) (0 0 0) (0 0 256)"

I really have no idea where to start.

sentences:
How to enable treat warnings as errors in Unreal Engine 4.24? I've had little luck googling and it takes about an hour to build the engine (which I have to do if I'm to test if it works), so guessing is a bit time consuming.
I've seen advice to add the '/WX' flag to *.target.cs, as well to one of the functions in VCToolChain.cs, but I wasn't able to make it work.
Has anyone here enabled this and knows how it works? I don't think it matters, but I've been using VS2017.

sentences:
Client/Server state synchronization for RTS How can I perform state synchronization using client/server networking in an RTS similar to Starcraft 2 and Planetary Annihilation?
I'm assuming the server has to do some sort of rewinding time to apply the updates received by each of the clients. But for an RTS game, that sounds like a lot of separate copies of the game world. How do you resolve interactions between units belonging to different players who have different latencies?
For the clients, do they need to use their latency (RTT) in order to know how far behind the server they are, to apply future updates that arrive from the server at the right time?
How do you keep time in sync when latency could fluctuate and server updates may not arrive at fixed intervals?

sentences:
How can I move and rotate an object in an “infinity” or “figure 8” trajectory? I know that the easiest way to move an object with the figure 8 trajectory is:

x = cos(t);
y = sin(2*t) / 2;

but I just don't know how to rotate it, lets says with a new variable r as rotation, how do I merge it into the above formula ?
can anyone please advise me on what is the simplest and cheapest way/formula to move and rotate the figure 8 trajectory ?

ref:How can I move an object in an "infinity" or "figure 8" trajectory?

sentences:
Unity2D: Repeating of code makes game lag (Spawnning script) does anyone knows how to shorten down this script and that I can edit the amount of enemies I want to spawn in, so that I don't have to keep on copying and pasting the same method below again and again, my code is also making my game a bit laggy. Which isn't a good sign. This is my code:

    public bool fromTop = false;

public GameObject enemy1;
public float enemy1Time = 2f;

public GameObject enemy2;
public float enemy2Time = 2f;

public GameObject enemy3;
public float enemy3Time = 2f;

public GameObject enemy4;
public float enemy4Time = 2f;

// Variable to know how fast we should create new enemies

void Start() {
    InvokeRepeating ("Enemy1", enemy1Time, enemy1Time);
    InvokeRepeating ("Enemy2", enemy2Time, enemy2Time);
    InvokeRepeating ("Enemy3", enemy3Time, enemy3Time);
    InvokeRepeating ("Enemy4", enemy4Time, enemy4Time);
}

void Enemy1() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy1, spawnPoint, Quaternion.identity);
}
void Enemy2() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy2, spawnPoint, Quaternion.identity);
}
void Enemy3() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy3, spawnPoint, Quaternion.identity);
}
void Enemy4() {
    Vector2 spawnPoint = new Vector2 (transform.position.x, transform.position.y);

    if (fromTop)
    {
        float x1 = transform.position.x - GetComponent<Renderer> ().bounds.size.x / 2;
        float x2 = transform.position.x + GetComponent<Renderer> ().bounds.size.x / 2;

        // Randomly pick a x point within the spawn object
        spawnPoint.x = Random.Range (x1, x2);
    }
    else
    {
        float y1 = transform.position.y - GetComponent<Renderer> ().bounds.size.y / 2;
        float y2 = transform.position.y + GetComponent<Renderer> ().bounds.size.y / 2;

        // Randomly pick a y point within the spawn object
        spawnPoint.y = Random.Range (y1, y2);
    }
    Instantiate (enemy4, spawnPoint, Quaternion.identity);
}

Please and Thank you. :)

sentences: .PNG tiles to .PNG map I was wondering how I can get my 110+ .png map tiles conveniently into a 1:1 pixel ratio size map .png. I've been scrolling through Google and forums for the free ware game that I am modding, but the app I'm using recognizes only .png files, and I want more than 1% of the map. If you guys know of a program I would be very appreciative.

sentences:
How to detect if I click on an object (2D) using Raycast? I need to know this for a little popup I made in my game, I want to avoid using OnMouseDown because I have multiple cameras so I was wondering how I'd be able to detect a mouse click event on an object using Raycasting, as I can't figure it out :/

Thank you!

sentences:
Is learning OpenGL 2.1 useless today? I'm new to 3D OpenGL/DirectX world and I found out that OpenGL 4.1 and GLSL specifications were just released today.

A friend of mine gave me the Red Book for OGL v2.1 but, as far as I've read, 3.x and 4.x differ a lot from 2.x and a lot of things are deprecated now.

Can I use the book to start learning the basics of 3D and CG or is it better to find a newer copy?

sentences:
Are there any good blogs or articles on the business of indie games? Interested in both successes and failures (and semi-successes).

Maybe this might be better at OnStartups but I think the game market is quite a bit different than the business market that's prevalent there (i.e. selling something that's fun instead of selling something that's useful)

sentences:
Parts of 3D model disappear during animation I'm trying to properly play an animation done in Blender 2.8 inside my OpenGL application. When the animation is running, it happens that at some particular frames, some parts of the 3D model "disappear", by "disappear" I mean that they obviously get relocated at some incorrect position and rotation in the 3D scene.

The model is an FBX file.
Has anyone got an idea about what could be the possible reasons for that?
Maybe some wrong settings in Blender?

Thanks in advance!

sentences:
Is there a concept of "pasted on theme" in video games? I've prototyped an idea and so far it's quite fun to play. However, it's still abstract and uses placeholder art. I've been thinking about a theme/story to add to the game, but I don't want to make it too obvious it was added almost as an afterthought.
There's a concept of "pasted on theme" within the board game community which basically refers to a game which is easy to reskin without redesigning some of the mechanics. I was wondering how big of an issue this is with video games (indie games in particular of course) and anything else I could do about a story for my game.

sentences:
Vector normalization gives very imprecise results When I normalize vectors I receive very strange results. The lengths of the normalized vectors range from 1.0 to almost 1.5. The functions are all written by me, but I just can't find a mistake in my algorithm. When I normalize I just divide all components of the vector by the vector's length.

public double length(){
    return Math.sqrt(x*x + y*y);
}

public void normalize(){
    if(length() > 0){
        x /= length();
        y /= length();
    }
}

Is this supposed to happen? I mean I can see the length ranging from 0.9 to 1.1 at worst, but this is just overwhelming.

Cheers

sentences: Where can I find fonts for my game? Where can I find fonts (preferably free, but a reasonable fee is acceptable) that I can use in my for-pay/commericial game?

sentences:
A script isn't showing in the Content Browser Just to set the tone, I'm very new to game development.

I'm currently taking an online video course for Unreal Engine 4 that required me to create a C++ script. After I created the script and it compiled it did not appear in the Content Browser where it should be. I received the following text boxes:

and

sentences:
How to rotate to look at target I have found other questions like this, but none seem to quite cover the situation I have.

I am using DirectX 11

I have an object that has:

Position (vector)
Rotation (quaternion)
View angle (pitch, roll, yaw)

The view angle needs to be added to the rotation in order to know the true view rotation. You can think of view a head, and rotation as body.

I want to be able to turn the head so that it looks at a given point in space (vector)

The head needs to move slowly so I need to workout what way to turn and then move the head in that direction in small amounts. (pitch, yaw, roll) units

I have attempted to get this working but I don't even seem to be able to get close to what I need.

Thanks in advance.

sentences:
How can I repeat only a portion of an image in Javascript? So I'm trying to repeat a portion of my spritesheet as a background. So far, I have attempted this:

var canvas = $("#board")[0],
    ctx = canvas.getContext("2d"),
    sprite = new Image();
    sprite.src = "spritesheet.png";
sprite.onload = function(){
    ctx.fillStyle = ctx.createPattern(spriteBg, "repeat");
    ctx.fillRect(0, 25, 500, 500);
}

As you can see, it repeat the whole image, not just a part of it, and I just can't figure out how to do that last part.

sentences: Camera not following ragdoll in unity I have made a ragdoll and attached (as child object) the main camera to it, but the camera doesn't follow the ragdoll. Why is this happening? And how do I fix this?

sentences: How can I preserve momentum during a jump, but cancel it when a character lands? I am attempting to code a run key for my platform game in Game Maker. I'm attempting to keep my momentum when I jump, but yet stop moving at a run speed as soon as I hit the ground if Shift has been let go during the jump. How do I go about coding this?

sentences:
Make part of albedo transparent I have a shader which creates a circle inside of a plane mesh. I would like to get get rid of the parts around the circle, which are the r and b parts of the ALBEDO but I can't seem to figure out how to do it.
The only thing I've managed to find is ALPHA but that changes the transparency of the entire shader and not just parts of it.
shader_type spatial;

float circle(vec2 position, float radius, float feather)
{
    return smoothstep(radius, radius + feather, length(position - vec2(0.5)));
}

void fragment() {
    ALBEDO = vec3(0, circle(UV - vec2(0), 0.5, 0.005), 0);
}

Which currently looks like:

sentences:
Using Bluetooth in a Unity3D Game Apart from using a plug in or other third party device, is there anyway Unity can support bluetooth communication between two devices?

All of the links I have found seem to relate to third party options which I want to try and avoid.

sentences:
2d engine/library for android in C# I'm looking for a good 2d engine or library (that supports physics) for Android. I have a restriction - language should be C#.
It's not a requirement to use Mono Droid, but it seems that it is an only way.

What can you suggest?

sentences:
What's the appropriate way to define configuration settings of game objects for a proper code accessed via C++? I defined a lot of configuration and settings of certain types of enemy characters inside header via #define similar to the following.

// --- RULES ---
#define MAX_INC_ATTACK_POINT 50
#define MIN_INC_ATTACK_POINT 0
#define MAX_DEF_PERCENT 0.1f
#define MIN_DEF_PERCENT 0.0f

#define PUNCH_ATTACK_POINT 12
#define PUNCHHARD_ATTACK_POINT 15
#define KICK_ATTACK_POINT 12
#define KICKHARD_ATTACK_POINT 15
#define COMBO06_03_ATTACK_POINT 20
#define COMBO06_04_ATTACK_POINT 5
#define COMBO06_04_01_ATTACK_POINT 15

#define START_MAX_HP 100
#define START_INCATTACK_POINT 0
#define START_DEF_PERCENT 0.0f
#define MAX_ULTIMATE 100

Anyway, c++ experts tend to not recommend to use global states or global variables at all (if necessary). There're some thoughts about global variables here and here.

Now I want to know what's the proper way to define these kind of values to be accessed via its own specific classes later?
Is that a bad design choice if I use like I did it currently?

sentences:
How to expose a child node’s texture from the parent in Godot I built a simple scene that I instanciate at will.  Simply a KinematicBody2D as root, containing a Sprite and a CollisionShape2D.  There is a script linked to the root node that basically expose a few properties to describe an orbit and make it move in orbit around its parent.  The point being to make a very basic solar system simulation or anything that requires a node to move around another in a circular fashion.

The movement work fine and I’ve been playing around my scene tree, instancing a bunch and watching them move around as moons of planets, etc.  But the texture is all the same.  If I make children editable, I can go change the texture of the sprite, but I’d like to expose that property from the root node so I can access it directly from the editor.

I tried adding an exposed property with a setter and a getter to assign and retrieve the texture, but it seems to crash Godot completely with this code:

export(Texture) onready var texture setget texture_set, texture_get

func texture_set(newtexture):
    $"Sprite".texture = newtexture

func texture_get():
    return $"Sprite".texture

Is there a solution for that?  Or simply another way?

sentences:
How can I insert a prefab instance programmatically inside the Canvas, in the bottom-left corner of the Canvas? I am trying to create the Snake game in Unity, based on this video tutorial. I have also viewed this tutorial.

I have created the new project with the 3D template and manually added the Canvas. I created a prefab from an Image which loads a texture from the Assets. I have this code:

using UnityEngine;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
    public GameObject whiteCellPrefab;
    int N = 30, M = 20, size = 16;

    // Start is called before the first frame update
    void Start()
    {
        Transform p = GameObject.Find("Canvas").transform;
        for (int i = 1; i <= N; ++i)
        {
            for (int j = 1; j <= M; ++j)
            {
                GameObject g = Instantiate(whiteCellPrefab, p);
                g.transform.localPosition = new Vector3(i * size, j * size);
            }
        }
    }

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

    }
}

If I manually add a prefab instance to the Canvas, it is positioned as I want: in the bottom-left corner. But the script above, attached to the Main Camera object, creates the Image objects starting from the center point of the Canvas towards the top-right corner of the Canvas.

In the example shown here, I also added a new prefab instance to the Canvas in the Unity editor. It is positioned correctly even when play testing but the ones added with the script are shown somewhere else.

Screenshots

Download my example

I tried to explain all the steps involved in my problem above, but here is the repo with my problem.

Thank you.

sentences:
Converting a Flash animation to Silverlight I recently had an animated logo done in Flash for Deen Games. I need to display in all my Silverlight games. The problem is, the logo is about ~8 seconds long (205 frames); if I export all the images as even JPEGs, the result is almost 3.5MB of content (more than the game itself).

I tried exporting as various formats (PNG, JPG, GIF, etc.) but nothing is small enough. What are my options? How can I incorporate these into my game without blowing up the file size?

There's always the option of "recreate it in-game with animation/rotation/etc. as it is now) but that's tons of work and I'd rather avoid that.

And no, just a static image is not good enough!

Edit: Exporting as a movie (AVI, MPEG) won't work since XNA doesn't support movies at this time.

sentences:
How can teams collaborate on Unity 3D projects? With a friend of mine, we are planning to develop a small game to get the hang of game development and teamwork. But since Unity 3D barely supports version control (or at least the free version lacks of it) we have no idea how to efficiently manage teamwork. Sharing tasks in a small project is also seems like a challange for us.

I would also appreciate any advice that could be useful for beginner indie developers related to teamwork. :)

sentences:
Crowd funded DLC. Is this a viable option for covering the development costs of DLC? I have had this idea floating around in my head for a while now but I am not sure if it will work.

I was looking at the idea of DLC and thought what about if we made some DLC crowdfunded in order to incentivise the players to provide money to cover for the development of it.

Basically the modal I am pondering is this:
DLC is announced and a trailer is shown.
Next the announcement states that a crowdfunding campaign for the development of it has start and people are free to donate money as a backer. Backers get special rewards such as early access, their name included in the credits, etc.
Once the campaign is fully funded development starts immediately and a release date is announced.
Once the DLC is finished and ready for release, it is available for free because all costs have been covered.

The other version is to start development on the DLC right away and run the campaign at the same time.
If enough people back the project, in addition to the backer rewards, the DLC is released for free.

I am not so sure that this a good idea or not so this is why I am asking.

sentences:
Box2dMapObjectParser isometric map - bodies have wrong position and size I'm using Box2dMapObjectParser to load Tiled objects layer onto my IsometricTiledMapRenderer'ed TiledMap.
It works OK with a UnitScale of 1 but the position is wrong and some shapes have weird rotation and size.

Map in Tiled:

Map in game:

I've found another similar question but the answer is unfortunately far from being clear, at least to me.

Relevant code:

mParser.load(mWorld, mMap);
mRenderer = new IsometricTiledMapRenderer(mMap, mParser.getUnitScale());

Notice the 'Ellipse' is not drawn at all, the Rectangle is way off and Polygons/Polylines are just not positioned right.

Did anyone experience the same issue and/or have any idea how to fix this?

sentences:
How much to pay for artwork in an indie game? I am an indie developer and I need some detailed artwork. How much is reasonable to pay an artist for say 20 character designs? I know it depends on the artist's skills, etc, but I am wondering what to expect so that I can budget it.

Edit:

Let's say cartoon-ish art (Example - not necessarily in that level of detail but that kind of cartoony-art style). No 3-d modelling - The art will be used as still images in game and for promotional reasons. I'd provide a base sprite design for them to expand on and detail.

Also, some numbers would be nice - I like numbers. Even a range is helpful.

Like: expect to spend $x2 ~ $x1 for top-notch and $y2 ~ $y1 for decent quality.

I understand I can ask at some indie-help site but, if an artist says something like $1000 for 20 designs, I wouldn't have any idea if it's reasonable / good deal / bad idea etc.

sentences:
Cardboard VR Mode rendering black in Unity I've searched around and seen this problem is quite common, but none of the fixes I've read have resolved the issue: If VR Mode is enabled in the GvrViewerMain prefab, the scene will render as just a black screen.

I've set the Graphics API to OpenGLES2, I've disabled Multithreaded Rendering, I've disabled direct render, yet this continues to be an issue.

This happens both within unity itself and if it is built and run to my phone. Has anybody encountered this problem/do you know of any further steps to take to resolve the issue?

sentences:
switching scenes in libgdx? I'm writing a little something in libgdx to learn more about the platform. Currently, I have a simple generated world consists of tiles, which are just blocks of texture drawn to the screen. It's a simple setup, but I'm wondering how would I go about switching to a different "scene". For instance, just imagine a player, walking around in a grass field, enters a cave, and bam, he is in the cave. The world behind him has transitioned from a grass field to a cave (essentially, from one generated world to another).

I'm not very sure how libgdx handles scenes, so if anyone can share some tips, I'd appreciate it.

NOTE: I know this is a very broad question; right now I'm not asking for a specific solution but rather some tips to help me approach the idea I'm going after.

sentences:
Z-Value of clip-space position is always 1.0 I render a lot of quads on the screen into z direction (20 x 2000). I want to get the depth value in a final render target. But it looks like z is always 1.0f. I checked the result with the OpenGL debugger. Any advice?

Vertex shader:

#version 410

layout(row_major) uniform UView
{
    mat4 m_View;
    mat4 m_Projection;
};

layout(row_major) uniform UModelMatrix
{
    mat4 m_ModelMatrix;
};

layout(location=0) in vec2 VertexPosition;

out vec3 PSVSPosition;

void main(void)
{
    vec4 VSPosition = m_View * m_ModelMatrix * vec4(VertexPosition.xy, 0.0f, 1.0f);

    PSVSPosition = VSPosition.xyz;

    gl_Position = m_Projection * VSPosition;
}

Fragment shader:

#version 410

layout(row_major) uniform USettings
{
   mat4  m_ProjectionMatrix;
};

layout(location = 0) out vec4 PSColor;

in vec3 PSVSPosition;

void main(void)
{
    // Calculate depth
    vec4 CSPosition = m_ProjectionMatrix * vec4(PSVSPosition, 1.0f);

    CSPosition.xyz /= CSPosition.w;

    PSColor = vec4(vec3(CSPosition.z * 0.5f + 0.5f), 1.0f);
}

Result:

Closer result:

view-space position result:

clip-space position result:

sentences:
Transforming Normals in Bump Maps Question

I have a noise texture (perlin noise, to be precise) with its value in the alpha channel and the normal components in rgb.  I now wish to, on the fly, apply some function to the alpha part of the texture.  Is there an easy way to calculate the new normal?

My thoughts are that if we know the form of f, then

∂f/∂x = df/da * ∂a/∂x

Now, we want to know ∂f/∂x as from this we can calculate the x component of the normal, we know df/da as we know the form of f(a) and ∂a/∂x is encoded in the normal that we are given in the first place.

Context:

I am creating a procedural rock shader and want some "cracks".  To do this I need to take my lumpy perlin noise and apply some function to it.  At the moment the function is:

f(x) = 1 - 5.5 * abs(noise);

This makes it more sharp (noise runs from -1 to 1).

Here is the basic noise:

And here it is after my transformation:

Here are the normals for the first noise:

What are the normals for the second?  You may notice that the given normals are very "steep"  This is because the bump map they are computed from goes to +-1 several times per unit area.  I thus also need to know the answer to this question so that I can scale down the noise and keep the normals correct.

sentences:
In tactical combat games, why does shooting end your turn? I was wondering about this particular game mechanic in tactical combat games, like XCOM2, where you have two actions, which may be:

move+move
reload+move
move+reload
move+attack

...but not attack+move, because when attacking, it ends your turn.

If I compare this to tabletop D&D 5e, with its move+attack actions, it shouldn't be that different, but this restriction seems to make things completely different.

What is the game design purpose for this kind of restriction?

sentences:
If I don't use PrefabUtility class, how can I save my changed prefabs and build without exception? I'm designing a racing game for my graduation project.
I used PrefabUtility.SaveAsPrefabAsset to save my color change on the car prefabs, I finished the codes and it work well in Unity, but when I want to build my project,the Unity give me a error:The name 'PrefabUtility' does not exist in the current context.
I want to know can I not use PrefabUtility or UnityEditor to save my changed prefabs in assets directory, or are there someways to solve this problem?

sentences:
Calculate smooth transition between local space angles I'm trying to calculate direction of moving character (to rotate it's animation).
I have something like this:

Character can have 4 cardinal directions. The rotation is calculated from the current cardinal direction.
So for example For north we have -90 degrees from N to W and 90 degrees from N to E.
From E to N we have -90 degrees and from E to S we have 90 degrees.

The problem occurs when character is switching directions.It happens at about half the distance between cardinal directions. At this point current rotation is switching from negative to positive number (or other way around), and there is noticeable hitch. When for example going from E to N, it switches to N direction but it was at about -45 degrees which in N space it places for a frame or two between N and W directions.

Why do I calculate angles in cardinal direction space ? Animations are prepared for strafing or moving backward (or any other angle) and I need to assume that the direction of animation is 0 degrees and calculate from here.

Is there way to smoothly change angle between cardinal directions ?

For now I tried to lerping between them when switching (which improved overall look but is far from smooth transition), tried to  track from which direction the switch is coming, but it didn't really improved anything.

FVector Right = Character->GetActorRightVector();
FVector Forward = Character->GetActorForwardVector();
FTransform Transform = Character->GetTransform();
FVector CurrentAcceleration = CMC->GetCurrentAcceleration();
FVector CurrentVelocity = CMC->Velocity;

FVector AccelerationDirection = CurrentAcceleration.GetSafeNormal2D();
FVector VelocityDirection = CurrentVelocity.GetSafeNormal2D();

FVector LocalAcceleration = Transform.InverseTransformVectorNoScale(AccelerationDirection);
FVector LocalVelocity = Transform.InverseTransformVectorNoScale(VelocityDirection);

float DeltaTime = Output.AnimInstanceProxy->GetDeltaSeconds();

float Atan2Angle = FMath::Atan2(LocalVelocity.Y, LocalVelocity.X);
const int32 ChildIndex = FMath::RoundToInt((Atan2Angle * 2 / PI) + 4) % 4;

float VelAngle = FMath::RadiansToDegrees(VelQuat.GetAngle());
float OldOrient = CurrentOrient;

EFCardinalDirection Dir = static_cast<EFCardinalDirection>(ChildIndex);
EFCardinalDirection OldDir = static_cast<EFCardinalDirection>(OldDirection);

float DirDot = 0;
//main switch wihin which I determine from where calculate angle.
switch (Dir)
{
case EFCardinalDirection::N:
{
    FQuat ForwardQuat = FQuat::FindBetween(Forward, CurrentVelocity);
    float OrientN = FRotator(ForwardQuat).Yaw;
    CurrentOrient = OrientN;// FMath::FInterpConstantTo(OldOrient, OrientN, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::E:
{
    FQuat LeftQuat = FQuat::FindBetween(Right, CurrentVelocity);
    float OrientE = FRotator(LeftQuat).Yaw;
    CurrentOrient = OrientE;// FMath::FInterpConstantTo(OldOrient, OrientE, DeltaTime, 300.0f);
    break;
}
case EFCardinalDirection::S:
{
    FQuat BackQuat = FQuat::FindBetween(Forward*(-1), CurrentVelocity);
    float OrientS = FRotator(BackQuat).Yaw;
    CurrentOrient = OrientS;
    break;
}
case EFCardinalDirection::W:
{
    FQuat RightQuat = FQuat::FindBetween(Right*(-1), CurrentVelocity);
    float OrientW = FRotator(RightQuat).Yaw;
    CurrentOrient = OrientW;// FMath::FInterpConstantTo(OldOrient, OrientW, DeltaTime, 300.0f);
    break;
}
default:
    break;
}

sentences:
GLSL Bokeh using Quads and Textures I'm trying to create a depth of field effect with bokeh sprites in GLSL. Specifically, what i would like to do is, for each pixel:

See if the pixel is out of the focal range
If it is, draw a quad and apply a texture to provide a bokeh sprite.

This kind of implementation is seen in the Unreal Engine and by Matt Pettineo, however, both implementations are in DX11 and I'm using OpenGL.

I'm a bit stuck on the drawing a quad and applying a texture bit. Does anyone know how I can do this, or provide any relevant links as to how I can do this?

Thanks

sentences:
Best way to detect if vec3 is between vec3(x) and vec3(y) in glsl As titled

I am sampling from a texture and if the color is somehow gray [vec3(.8), vec3(.9)] and an uniform is 1 I need to substitute that color with another one

I am not a glsl veteran but I am pretty sure there is a more elegant and compact (without mentioning faster) way than this:

vec3 textureColor = texture(texture0, oUV);

if(settings.w == 1 && textureColor.r > .8 && textureColor.r < .9
                    && textureColor.g > .8 && textureColor.g < .9
                    && textureColor.b > .8 && textureColor.b < .9)

sentences:
UnassignedReferenceException : The variable player of FollowPlayer has not being assigned My current task is to make the camera follow the moving cube in a stable way where the camera won't get locked in the center of the object so it won't get dizzy once the cube starts to collide or fall down.

I have done the parenting right, I have named the cube as the player and then selected it as the Transform reference in the new component that I have created for the camera to follow.

But it just says:

  UnassignedReferenceException : The variable player of FollowPlayer has not being assigned.

and I am unable to get the right results. What should I do ?

Here is the C# script that I wrote:

using UnityEngine;

public class FollowPlayer : MonoBehaviour {
    public Transform player;
    public Vector3 offset;

    void Update() {
        transform.position = player.position + offset;
    }
}

My scene setup looks like this:

So I have un-parented the main camera from the player and it works perfectly fine but I still get the error, Have any ideas why?

sentences:
How to extract the texture from an image onto a mesh? (preamble: I think this fits either here or SO with computer vision tag, I chose gamedev because I think you guys are probably really good with textures and meshes, but tell me if my decision was wrong.)

I want to accomplish the following: Given an image with an object, a 3D mesh very similar to that object, and rendering parameters that render that mesh to the exact location of this object. I want to "extract" the original texture from the image onto the mesh. (So in a later step, I could re-render the mesh from another viewpoint (of course some of the texture would be invisible/black)). My mesh has uv-coordinates for each triangle so I guess I could either "store the texture on the mesh" somehow, or directly backmap it to a 2D texture map.

So I guess what I want to do is kind of texture backmapping/remapping, kind of the inverse of what is done in game-dev when texturing objects. I was having a lot of trouble finding any useful information on Google about what I want to do, so I thought I'd ask here. Maybe I haven't found the right word for it yet. I think there's probably quite a lot of "stuff" involved because pixel in the original image won't exactly correspond to a location on the mesh.

sentences:
How can I convert a 2D bitmap (Used for terrain) to a 2D polygon mesh for collision? So I'm making an artillery type game, sort of similar to Worms with all the usual stuff like destructible terrain etc... and while I could use per-pixel collision that doesn't give me collision normals or anything like that. Converting it all to a mesh would also mean I could use an existing physics library, which would be better than anything I can make by myself.

I've seen people mention doing this by using Marching Squares to get contours in the bitmap, but I can't find anything which mentions how to turn these into a mesh (Unless it refers to a 3D mesh with contour lines defining different heights, which is NOT what I want). At the moment I can get a basic Marching Squares contour which looks something like this (Where the grid-like lines in the background would be the Marching Squares 'cells'):

That needs to be interpolated to get a smoother, more accurate result but that's the general idea. I had a couple ideas for how to turn this into a mesh, but many of them wouldn't work in certain cases, and the one which I thought would work perfectly has turned out to be very slow and I've not even finished it yet! Ideally I'd like whatever I end up using to be fast enough to do every frame for cases such as rapidly-firing weapons, or digging tools.

I'm thinking there must be some kind of existing algorithm/technique for turning something like this into a mesh, but I can't seem to find anything. I've looked at some things like Delaunay Triangulation, but as far as I can tell that won't correctly handle concave shapes like the above example, and also wouldn't account for holes within the terrain.

I'll go through the technique I came up with for comparison and I guess I'll see if anyone has a better idea. First of all interpolate the Marching Squares contour lines, creating vertices from the line ends, and getting vertices where lines cross cell edges (Important). Then, for each cell containing vertices create polygons by using 2 vertices, and a cell corner as the 3rd vertex (Probably the closest corner).

Do this for each cell and I think you should have a mesh which accurately represents the original bitmap (Though there will only be polygons at the edges of the bitmap, and large filled in areas in between will be empty). The only problem with this is that it involves lopping through every pixel once for the initial Marching Squares, then looping through every cell (image height + 1 x image width + 1) at least twice, which ends up being really slow for any decently sized image...

sentences: What do I need to consider before making any class singleton? I am sure most of my classes like for rendering text, sprite, shapes are not going to need more than one instance. Is it adequate to consider only this fact that its only going to need one instance? Should i also consider other things?

sentences:
Activate object that have button component? I'm trying to activate the array object that have button component.

 public GameObject[] weapon_carry_pistol = new GameObject[3];
 public int p1_carry,activeObjects;

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

  p1_carry =  weapon_carry_pistol[0].GetComponentsInChildren<Button>().Length; // 6 objects

        for (int i = 0; i < activeObjects; i++)
    {
        weapon_carry_pistol[0].GetComponentsInChildren<Button>()[i].enabled = true;
    }

}

This script do activate the button component but not the whole game object. If I change "Button" to "GameObject" I get error //.GetComponent requires that the requested component 'GameObject' derives from MonoBehaviour or Component or is an interface.//

sentences:
Can I my iOS-based editor save .plist files that my Mac game can read? I want to make an editor on iOS which will record touch positions into a file. That file (in the .plist format) will eventually be used for positions in my Mac connect-the-dots game.

Can I save one .plist file to my Mac from an iOS app?

sentences:
XNA: How do I match Spritebatch View/Projection Matrices with BasicEffect Matrices? I'm rendering a bunch of 2D content using SpriteBatches to a default XNA viewport. A simple 2D camera is used to move around the scene, which generates a transformation matrix passed to each SpriteBatch.Begin()-call.

I want to draw custom polygons on top of my SpriteBatches, which I'm doing via DrawIndexedPrimitives (straightforward, as well). I'm using a BasicEffect to shade them.

How can I best match up the SpriteBatch's implicit view and projection matrices with the BasicEffect's matrices? Currently, I create the matrices for the Effect from scratch, using the Viewport's properties. How can I get around this? Can I access the Viewport's matrices and pass them into the BasicEffect?

So far, Google has come up empty on this.

sentences:
When to use class/objects for graphics I am fairly new to game development, but I have a good programming background with object oriented programming.

But with games, I do not know when I should use an object (or class) for an entity on the screen or whether I should just draw the images straight to the screen.

I think that for any graphic objects that need interacting with (say the player or certain environment objects) would need their own class and just decoration (the image that make up the background) could be drawn straight to the screen.

So, my question is: when do I use an object or class for my graphics?

If it makes any difference, I am using LibGDX.

sentences:
Tilemap collision in Pure ECS? I'm currently making a 2D topdown dungeon crawler using pure ECS and Data Oriented Design. So I only use structs of arrays for all my components. I have now added tilemap generation, but was wondering what option to pick for tile collision. Should I add the tile collisionbox as an entity or somehow include it in my CollisionSystem?

I am already using collision boxes to check collision for entities. But In my mind, doing so for every tile against every entity might get pretty laggy.

I currently store my terrain data in a linked graph like this:

struct Tile{
    struct Tile* up;
    struct Tile* right;
    struct Tile* down;
    struct Tile* left;

    Position pos;
    bool walkable;
};

I am not using chunks.

sentences: Unreal Engine 5 Installation failed (MD-DL) I am getting an error while installing early access Unreal Engine 5 (error code: MD-DL). This is something about a manifest file. I am unsure about that. What is it about? I have deleted the previous download and tried it again, but popping the same message before initiating the download.

sentences:
How to animate fluid filling down a pipe of any shape? I am working on a project where I want to model a simple flow of fluids around a circuit of pipe. I thought a simple way to do this would be to create an irregular shaped loading bar, then animating the shape as it filled up.

I have found answers for how to create regular loading bars that are rectangle shaped, as well as some for circular loading bars.

But what if want some arbitrary "circuit" of pipes, kind of like one long windey loading bar.

sentences:
Retro-game development - how did 8-bit computers store large level maps and build a screen from them? Not sure whether this would be better in the retro-computing exchange, but I'm trying in game development first.
During the 80s I played a lot of what would now be called "arcade adventures" on the BBC Micro; games like Citadel, Camelot, Jet Set Willy, etc.
Jet Set Willy could support 64 rooms, Citadel had over 100.

Presumably, some form of encoding was used to compress the maps to fit in the limited storage space that these machines had, but does anyone have any information on how these games actually managed to cram screen layout and object types and locations into this limited space, then decode these into a tilemap and game objects?

sentences:
How "fake" do invented names of a football game have to be in order to avoid copyright infringement? I know that real player names cannot be used in videogames unless the authorization (generally very expensive) has been given by the holders of the rights (players, teams etc.)

as explained here and here.
There is a discussion here about possible sources that can be consulted in order to figure out whether you are infringing any copyright issue, but it does not say anything specific about my problem (at least as far as I understood it, given my poor comprehension and expertise on the matter).

my question is very simple: is there any rule that determines the amount of difference (in characters, sound, length, phonological features, whatever) from a real name to a fictitious (or fake) name in order for the latter to be considered really fake?

For example, if I created a football videogame in which there is a strong offensive midfielder that has Cristiano Ronaldo's features (with respect to characteristics, statistics etc. not physical appearance) how could I call this player to avoid copyright infringement?

Cristian Ronald?
Cristo Romaldi?
Christiano Ronnaldo?

there was a famous release of ISS PRO (football game) employing fake names - here's the list - that were very similar to real ones.

Is there a specific rule/law that says which is good and which is not?

sentences:
How do I create 2D water with dynamic waves? New Super Mario Bros has really cool 2D water that I'd like to learn how to create.

Here's a video showing it. An illustrative part:

Things hitting the water create waves. There are also constant "background" waves. You can get a good look at the constant waves just after 00:50 in the video, when the camera isn't moving.

I assume the splash effects work as in the first part of this tutorial.

However, in NSMB the water also has constant waves on the surface, and the splashes look very different. Another difference is that in the tutorial, if you create a splash, it first creates a deep "hole" in the water at the origin of the splash. In new super mario bros this hole is absent or much smaller. I am referring to the splashes that the player creates when jumping in and out of the water.

How do I create a water surface with constant waves and splashes?

I am programming in XNA. I've tried this myself, but I couldn't really get the background sine waves to work well together with the dynamic waves.

I am not asking how the developers of New Super Mario Bros did this exactly—just interested in how to recreate an effect like it.

sentences:
RPG movement holding down button I've been writing a simple top down mini RPG in python.

My problem is that when I move the player I have to repeatedly tap the arrow key. Each time I tap the key the player moves 5 PX in the direction of the key I press, but if I hold down the key he doesn't keep moving, he just moves the first 5 PX.

My moving code looks like this:

# event loop
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        elif event.type == pygame.KEYDOWN:          # check for key presses
            if event.key == pygame.K_LEFT:        # left arrow turns left
                x = x + -x_speed
            elif event.key == pygame.K_RIGHT:     # right arrow turns right
                x = x + x_speed
            elif event.key == pygame.K_UP:        # up arrow goes up
                y = y + -y_speed
            elif event.key == pygame.K_DOWN:     # down arrow goes down
                y = y + y_speed

And farther up I define the x_speed ect.

How do I make it keep moving when I hold down the key?

sentences:
My player won't move My player sprite won't move if I use the A/D keys or the arrow keys. If I try to use them then the sprite will stretch and won't move at all. But if I try to jump before I press the A/D or left/right arrow keys then it will jump. If I press the A/D or left/right arrow keys then it will stretch again and I have to reload the game to jump again.
This is my code.
Create Event:
hsp = 1;
vsp = 0;
grv = 0.5;
walksp = 4;

Step Event:
// get player input
key_left = keyboard_check(vk_left) || keyboard_check(ord("A"));
key_right = keyboard_check(vk_right) || keyboard_check(ord("D"));
key_jump = keyboard_check_pressed(vk_up) || keyboard_check(ord("W"));

//calculate movement
var move = key_right - key_left;

hsp = move * walksp;

vsp = vsp + grv;

if (place_meeting(x,y+1,oWall)) && (key_jump)
{
    vsp = -7;
}

//horizontal collision
if (place_meeting (x+hsp,y,oWall))
{
    while (!place_meeting(x+sign(hsp),y,oWall))
    {
        x = x + sign(hsp);
    }
    hsp = 0;
}
x = x + hsp;

//vertical collision
if (place_meeting (x,y+vsp,oWall))
{
    while (!place_meeting(x,y+sign(vsp),oWall))
    {
        y = y + sign(vsp);
    }
    vsp = 0;
}
y = y + vsp;

//animation

if (!place_meeting(x,y+1,oWall))
{
    sprite_index = sPlayerA;
    image_speed = 1.5;
}
else
{
    image_speed = 1;
    if (hsp == 0)
    {
        sprite_index = sPlayer;
    }
    else
    {
        sprite_index = sPlayerR;
    }
}

if (hsp != 0) image_xscale = sign(hsp);

I don't know why this is happening.

sentences:
Why are these unity UI buttons only responding to the top half? I'm instantiating UI objects with buttons on them into a scrollrect.  For some reason, all of the buttons will ignore their bottom half with the exception of the last prefab instantiated.  Below is a gif to show the problem. I have it set to turn red when the button is highlighted.  When the mouse isn't in a highlight position clicking will do nothing so I know it's not just a highlighting issue.

Here is the code that I'm using to instantiate the scene.

    //Instantiate the parent UI
    MyLoadGUI = (GameObject)Instantiate(LoadGUI);

    //Get the RectTransform of the scroll rect so I can add each level to the right thing.
    RectTransform[] rt = MyLoadGUI.GetComponentsInChildren<RectTransform>();
    RectTransform myRt = new RectTransform();
    for (int i = 0; i < rt.Length; i++)
    {
        if (rt[i].name == "Scroll Panel")
        {
            myRt = rt[i];
            break;
        }

    }
    //We're going to make 6 fake levels
    int levelCount = 6;
    int levelSize = 88; //How tall the levels are

    int height = Mathf.Max(levelSize * levelCount, 252);

    myRt.sizeDelta = new Vector2(myRt.sizeDelta.x, height);
    myRt.anchoredPosition = new Vector2(myRt.anchoredPosition.x, -height);

    for (int i = 0; i < levelCount; i++)
    {
        GameObject lsl = (GameObject)Instantiate(LoadSingleGUI);
        RectTransform rect = lsl.GetComponent<RectTransform>();
        rect.SetParent(myRt, false);
        rect.anchoredPosition = new Vector2(0, -37 - (i * levelSize));

        //Fill in fake details.  Doesn't run anything related to the button.
        lsl.GetComponent<LoadLevelBar>().BuildRandom();
    }

So, nothing that should be affecting the button that I can see.  I thought that the button was getting resized, but when checking in the scene the button is stretched all the way across the prefab.  Any ideas why the button isn't working properly?

sentences:
Unity "Update" method with lots of objects with logic In my game I'm working on in Unity, I want to have energy and machines (i.e ore processing machines, smelting (think Minecraft modded)), but I was thinking about performance.  The player could have quite a few of these machines in their base, all of them could be doing something and could be off screen, so this could effect performance as each machine will have logic to handle whatever it needs to do, and lots of them could be running at the same time.

Machine example;  Let's say we have a machine that crushes stone.  Player puts it into the machine slot, machine then starts crushing it if it has enough energy, and after X seconds, it outputs the crushed stone.  Player could keep the machine UI open and watch the progress (i.e progress bar), or be far away from it.

Should these machines be running constantly in Update, if not, what would be a better way to do this?

sentences:
Component-based game object systems in practice Let's see history of success. Which popular games (and game engines) were built using component-based game object system? Each answer should contain:

Game Title (one per answer)
Author / Company
Year
Development time (optional)
Link to postmortem (optional)
Links to docs/source code (optional)

sentences:
How do I create a closed beta on the App Store? After months of hard work, much to my surprise I'm about to unlock the "feature complete" and "production ready" achievements with the game I'm working on, so it's time to ask my colleagues and Facebook acquaintances if they'd like to help me by playtesting the game.

This is going to be my first game, and I'm wondering if I can somehow upload it as a "closed beta" to the App Store and generate a couple of keys/tokens, so I could hand these to my playtesters? This way they wouldn't have to install unsigned developer versions, so they'd also be testing the real installation process, and of course paying customers wouldn't even be seeing the product until I make it public.

Is this how a closed-beta testing goes at all?

sentences:
Map scrolling around the world I am developing an TBS (turn based strategy) game. I have created a simple canvas renderer to render hexagonial map. I already implemented scrolling on the map. My current problem is that I want to make it like in the civilizations games that you can scroll around the world. But I am kind of stuck on how to implement that. I had the idea of checking if a tile was rendered and if there is still space to the left render next sibling and so on, but this would turn out into long loops. My map array (2d) holds all the tiles and every tile has a member which holds all the siblings. How would you solve this?

This is a screenshot from the example. You can check it out on http://civ.minerjs.com. The code is also available to browse on the site using developer tools. Thanks for reading!

sentences:
Custom VertexDeclaration for Color, Texture, Normal What is the best way to create a VertexDeclaration, that makes it able to render a Shape consisting of vertices and also be able to store a color for the shape (in case the texture can't be rendered - or in case we want color instead of a texture) - instead of having both a VertexPositionNormalTexture and a VertexPositionColor struct in the same class/struct.

I'm trying this approach:

public interface IShape : IVertexType { }

public struct ShapeFace
{
    public int Count { get; set; }
    public Color Color { get; set; }
    public Vector3 Position { get; set; }
    public Vector2 TextureCoordinates { get; set; }
    public Vector3 Normal { get; set; }
    public Vector3[] Vertices { get; set; }

    // Perhaps I need this?
    // public int[] Indexs { get; set; }
}

public struct Shape : IShape
{
    public ShapeFace[] Faces { get; set; }

    /* Need to implement VertexDeclaration here */
}

How do I implement the VertexDeclaration to understand what I want to do?

A shape contains faces, each face can have it's own texture OR color, normal mapping, texture coordinates, etc.

Example A cube has 6 faces, each face needs 2 triangles, each triangle has 3 points. 6 * 2 * 3 = 36 vertices. This way I can create a cube with 6 faces instead of 36 vertices, and render it in color or with a texture.

I really want to simplify it so that I can create some kind of struct that works this way.

sentences:
Unity: Smart approach needed: Enemy AI detection of firearm discharge If the player fires his firearm within a certain hearing range of an Enemy Bot, the Enemy AI should be alerted to his position. My initial solution to the problem was the following: Everytime the player fires a shot, find all Enemy AI Game Objects and trigger a function that checks wether the player is within hearing range or not.

The problem is some weapons have a firerate of up to 20 shots per second. And if there are 25 enemies in the scene it means that, while shooting, I will be asking for GameObject.FindGameObjectsWithTag(Enemy); and accessing a function within 500 times every second. This is not very performance friendly.

I cannot think of a better way to do this. Is there?

sentences:
If I release code under GPLv3, can I specify what parts of users' code can be released under a new license? I have a few questions about what users of my engine could copyright in their own project. The way the engine would work would be that it would be a standalone program in Java that would load all of the scripts/assets/data from a folder that the game takes place in. The code could be written in Python or compiled to Java.

Onto my questions, the code that they write would access some parts of my engine through Jython, and so I assume those would have to be released under the GPL. But what about the rest of the game other than the code? Like could they copyright their own art?

I guess what I really want is that modifications of the code of the engine must be released under the GPL, but projects created using my engine can be released under any copyright, as long as they obey they distribute the engine itself under the GPL.

sentences:
Can Neural Network play tic tac toe? Is this have any common sense? I'm thinking about theoretical possibility of playing tic tac toe by neural net. Is this have any common sense? Let's consider tic tac toe which contains 3 rows and 3 cols (it's 9 cells). Ok, then the input vector is contains of all our cells: [0..8], where 0 - is: "O", 1 - is: "X" and 2 - is empty cell.

But what we have for the target vector? On every NN's step we need to know some target and make our distance to target shorter. But the target of this game is only win (or maybe draw), I don't understand how we can make shorter our distance to win. Is any suggestions?

My goal is to learn more about neural networks in games that's why I consider such easy game. Maybe it's not the best choice for the NN and I need to consider some other game? :)

sentences:
Loading Screen And Coroutines Unity When I want to load another scene and show my loading screen to the user - my loading screen is a game object holding a canvas, I use coroutines, but when I type something like this: LoadingScreen.Show ();
        Application.LoadLevel ("PlayerMenu");

Loading screen is shown less than a second, so I wanted to use coroutines, I typed this:

IEnumerator LoadLevel(string levelName) {
    LoadingScreen.Show ();
    yield return new WaitForSeconds (2f);
    Application.LoadLevel (levelName);
}

The problem when calling the coroutine is that my LoadingScreen.Show() code is not executed, so basically I'm just waiting 2 seconds looking at the background of my current scene and then it goes to another scene, I'm confused here as to what is going on, shouldn't my LoadingScreen.Show() code be executed and then I would see the loading screen and wait 2 seconds and the next scene will appear. Anyone has an idea?

sentences:
Cocos2D: Box2D body that is movable by one type of object but not another I'm in the process of creating a simple platform game using Cocos2D 2.0 and Box2D. I'm trying to create a kind of crate object that cannot be moved by the player, but that can be moved by an elephant object. When the player runs up to the crate, it should stop him dead in his tracks (as if he is running into a static Box2D body). If the elephant runs into it it should get knocked out of the way (as if the elephant was running into a dynamic Box2D body of much smaller mass/density). I can't use collision bitmask because of course I want collision to occur in both cases, I just want that collision to result in different things depending on which type of object is hitting the crate.

Anyone have a hint as to how to make this work?

Thanks in advance!

sentences:
Constraining camera bounds within bounds based on Unity UI object dimensions I have a perspective camera which has bounds which I wish to constrain within larger bounds.  All the bounds are calculated in world space.

The code for containing the camera within the constraining bounds is straightforward:

        var camRect = this.cameraComponent.GetCameraWorldRect();
        var correction = Vector3.zero;

        if (camRect.xMin < constrainingRect.xMin)
        {
            correction.x += Mathf.Abs(constrainingRect.xMin - camRect.xMin);
        }

        if (camRect.xMax > constrainingRect.xMax)
        {
            correction.x -= Mathf.Abs(constrainingRect.xMax - camRect.xMax);
        }

        if (camRect.yMin < constrainingRect.yMin)
        {
            correction.y += Mathf.Abs(constrainingRect.yMin - camRect.yMin);
        }

        if (camRect.yMax > constrainingRect.yMax)
        {
            correction.y -= Mathf.Abs(constrainingRect.yMax - camRect.yMax);
        }

        this.cameraComponent.transform.position += correction;

This can be visualized as:

The problem I am facing is that I have a UI object that is covering the right hand side of the screen and I am uncertain how to correctly calculate the width of the UI object so that the constrained camera bounds can take it into account.

The camera that is drawing the UI object is configured as follows:

The camera that is being constrained is configured as follows:

Apart from the layer, the parameters which affect the rendering of the objects for each camera configuration are the same.

The UI object has the following configuration with a Canvas Renderer:

This is how I am currently attempting to calculate to width of the UI object but given that the UI is being rendered using a perspective camera I wasn't too certain that ScreenToWorldPosition was correct.

    private float CalculateMenuWidth()
    {
        // Generate padding to account for the side menu
        var canvas = LevelEditor.Instance.Menu.GetComponentInParent<Canvas>();
        var menuRect = LevelEditor.Instance.Menu.GetComponent<RectTransform>();
        var menuRectMax = menuRect.rect.max * canvas.scaleFactor;
        var menuRectMin = menuRect.rect.min * canvas.scaleFactor;

        if (this.cameraComponent.orthographic)
        {
            return Mathf.Abs(this.cameraComponent.ScreenToWorldPoint(menuRectMax).x - this.cameraComponent.ScreenToWorldPoint(menuRectMin).x);
        }

        // Perspective camera requires distance for ScreenToWorldPoint
        var distance = Mathf.Abs(this.cameraComponent.transform.position.z);

        return Mathf.Abs(this.cameraComponent.ScreenToWorldPoint(new Vector3(menuRectMax.x, 0f, distance)).x - this.cameraComponent.ScreenToWorldPoint(new Vector3(menuRectMin.x, 0f, distance)).x);
    }

However, the size of menu returned by the method above appears to be too large.

How can I correctly calculate the width of the UI object so it appears that the camera constraints do not allow the camera to travel past the UI object?

EDIT: I've added a link to a Unity project which is the minimal working example for reproducing the issue.

https://www.dropbox.com/s/mq36mfqz5wvvsch/CameraConstraintGUIIssue.zip

The camera can be controlled with WASD to translate and the Shift key will speed up the movement.

The camera is constrained inside the checkerboard.  An offset is created so that the camera should stop moving to the right once the right edge of the checkerboard is adjacent to the left edge of the menu.  Unfortunately, I can't seem to calculate the size of the menu correctly so this occurs.

The code for constraining the camera and calculating the menu size is in EditorCamera.cs.

Edit2:

The constraint from KingDolphin

The constraint I am attempting to calculate (quoted from above, An offset is created so that the camera should stop moving to the right once the right edge of the checkerboard is adjacent to the left edge of the menu.):

sentences:
What is a "Projectile"? I don't know what a Projectile os.

I'm not sure whether a Projectile is a spawn point which spawn a number of object or a number of multiple objects.

I'm referring to this website.

How do I use Projectiles and what does it mean?

sentences:
How do I avoid pathfinding characters getting stuck in corners? I used A* pathfinding to return a list of Tiles to get from an enemy to the player. After that, I wasn't sure how to actually move the enemy.

What I ended up doing was get the first Tile in the path. Then, check all 8 directions from the enemy's current tile. If the path tile is in the enemy tile's adjacent bottom square, move like this. If it's the right square, do that, etc. When the tile of the enemy is the same as that tile in the path, remove it from the path, and repeat for the next one.

This works, except my character sometimes gets caught around corners. This is because it thinks it should be moving horizontally (the next tile in the path is above it) when it's actually more of a diagonal movement to actually get to it.

I need to know two things:

Is there a better way I should do the movement after calculating the tiles in the path?
What are some ways to deal with the corners and diagonals? I was thinking perhaps some sort of random movement, but it's kind of janky. In the end, don't care how silly it is as long as the enemy doesn't get stuck!

Really new to all of this, so would appreciate some advice!

sentences:
Finding next experience level using the square root? I recently asked this question on how to calculate a level based on experience:

Algorithm for dynamically calculating a level based on experience points?

I am using the following calculation to determine the players level:

decimal experience = 1829;
decimal rawLevel = (decimal)(.06 * Math.Sqrt(experience));
decimal level = Math.Floor(rawLevel);

For my test, 1829 experience points equates to 2.56600857364117M, which I floor to level 2.

My question is, how can I figure out how many points it would take to get to the next level based off of the calculation above?

I know the next level is 3, so I would need to figure out how many points equate to level 3 so that I can find the difference.  What formula would I use, given the constant .06 above?

Update: Solution:

int experience = 150777;
decimal rawLevel = (decimal)(.06 * Math.Sqrt(experience));
decimal level = Math.Floor(rawLevel);
decimal nextPoints = (decimal)Math.Pow((double)(level + 1) / 0.06, 2);

sentences:
Android multi screen rendering Is it possible on Android to render specifically / only, to the connected Monitor/TV on the hdmi port?

If so, is it possible to use OpenGL ES to render a different scene on the monitor and on the device's screen?

I would like the tablet to become more of an input device when it is connected with a monitor/tv and my game to be rendered just to this screen. If nothing is connected, then the device's screen should be used.

Ideally I would render a small interface (with buttons and text only) on the android tablet and the game itself on the monitor.
Can this be done? How?

sentences:
How to pass PNG image data directly to SDL? Well passing just external PNG to SDL is very easy with the SDL_image library. I have a class that does just that. The code looks like the following:

SDL_Surface* Texture::LoadImg(const char *filename) {
    SDL_Surface* Image = IMG_Load(filename);
    if (Image == NULL ) {
        printf("Unable to load picture%s\n",SDL_GetError());
        return NULL;
    }
    return Image;
}

Later on I can just call it with

//some code
SDL_Texture* Texture = SDL_CreateTextureFromSurface(Renderer,LoadImg(filename));
//some code

But I don't have just a PNG file. I have a binary file that consist of many PNG files inside. Basically I combine binary(PNG) files into one larger file. Later on I just open that binary file and load pictures into memory from one single file. So now I have an array of vectors or pointers or any other types (depending how you read the binary file). Now I need to pass this from memory into SDL or SDL_image to load it as texture. How would I pass already loaded PNG (binary) data into SDL to use as an SDL_Texture?

sentences:
Displaying Images Correctly So, I've been working on several smaller game project in past few months, and I've got the hang of game dev in java. Now I'm trying to optimize game performance. Is it ok to simply use g.drawImage();to display sprites and other images?

Note that I'm trying not to use any external libraries.

sentences: How can I scale/zoom to a point in canvas in the game? I am using html5 canvas to build a MMO game. When I scale my background by default it scales to (0, 0) which is the top left corner of the background. If I have other sprites on the screen they all will look like they are shifting to the bottom right a little bit. Suppose my sprite(player) is at (x,y) of the map and it is placed center on the canvas.How can I make the background scale or zoom to (x,y) instead of (0,0)? Its world position is (x,y) but its screen position is always (canvas.width / 2, canvas.height / 2). I think in this way the sprites around my player wouldn't shift their position to unexpected places. But I don't know how to do this.

sentences:
C++ formatted serialization I've decided it's time to implement serialization in my simple engine but this has caused me many headaches for the past couple of days/weeks. My engine uses an entity/component based approach similar to what is described in the T=Machine blog.

To keep it simple, my first goal was to implement serialization of entities. Since I'm going to use Lua for scripting, I thought it would be nice to serialize entities into Lua tables. Unfortunately, I find the information that is available on serialization in C++ is rather scarce. After many days of thinking I found one approach which is working for my implementation and is described here.

In essence, I have an EntityManager class from which I request new entities. This class holds entity as well as pointers of type BaseComponent from which all components derive. Because I store components as base pointers, I couldn't use a friend class for serialization, but had to make the BaseComponent inherit from a Serializable class, which has pure virtual serialization methods.

So, this is not that bad, I just have to inherit from the Serializable class and implement the serialization method. To support deserialization though, I have to do a few tricks according to the last link. That is, I have to include a static object inside each component whose sole purpose is to populate a map from component names to constructors. Here is a generic example (and please ignore any possible errors),

/* Base.h */
struct Base: public Serializeable{
    static std::map&ltstd::string, std::function&ltBase*(void)&gt &gt deriveds;
    virtual ~Base(void){}
};

/* Derived.h */
template&ltclass T&gt
struct add_map_entry{
    explicit add_map_entry(std::string name){
        Base::deriveds[name] = [](void) -> Base* {
            return new T;
        };
    }
}

class Derived: public Base{
public:
    int x;
    int y;
    Derived(void){
        std::cout &lt&lt "Derived created" &lt&lt std::endl;
    }
    void serialize(std::ostream&);
    static add_map_entry&ltDerived&gt adder_;
};

Then in the implementation file I also have to initialize the static map of the base class as well as the static object of each derived class.

I find this quite a mess and although it could probably be improved with the use of macros, I can't help to wonder if there are better ways. How do you handle this kind of formatted serialization?

PS: Please don't recommend changing to a more flexible programming language :) !

sentences:
How is the environment moved in endless runner games like Tiny Wings I've always wondered how the background scene is scrolled endlessly as the main player is moving (usually to the right). With Tiny Wings I suspect that it's somehow drawn dynamically because when investigated a little deeper, one can see that the hills can easily be drawn. All in all it's just some parabola shaped curves, some texture and mini sprites on them. In Cocos2D the hills themselves could be drawn by a very convenient class called CCRenderTexture. Of course this will involve some maths too, but that shouldn't be a problem. But how about a scene that I want to be composed of images but not easily drawable shapes?

Is this even done in practice?
Is it possible to dynamically customize the same images so that they look a bit different the next time they appear on the screen again?
How is smooth transition achieved between different images?
And finally how are the images swapped one after another?

For this game I'm going to be using Cocos2D V3.

sentences:
2D Collision Box Clipping There is this strange issue with the collision in a game I am making. When the player is slightly lower than a block it is colliding with from the side, the player ends up clipping to the top of the block rather than sliding along the side of it down. Do you have an idea how to fix it?

If that description didn't help you at all you can reproduce it here (goes to the website with the game on it). (Use WASD/Space/Arrow Keys to move) To reproduce, stand on the single block and hold the right move button. You will fall off the edge, hit the side of the block, and get clipped to the top of it. You are meant to fall onto the block below instead.
(The words and colors are debug info)

The code below is what handles the collision detection. If you need the rest of the code, you can view the source of the page linked above.

this.doCollision = function() {
var tx = Math.floor(this.x),
    ty = Math.floor(this.y),
    nx = this.x % 1,
    ny = this.y % 1,
    cell = this.cell = levelStorage.currentLevel.getTileAtPosition(tx, ty),
    cellRight = this.cellRight = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty),
    cellDown = this.cellDown = levelStorage.currentLevel.getTileAtPosition(tx, ty + 1),
    cellDiag = this.cellDiag = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty + 1);

if(this.vy > 0) { // Ground collision
// The !cell checks return if the cell exists or not (null)
  if((cellDown && !cell) || (!cellRight && cellDiag && nx)) {
    this.y = ty;
    this.vy = 0;
    this.falling = false;
    this.jumping = false;
    ny = 0
  }
}else
if(this.vy < 0) { // Ceiling collision
  if((!cellDown && cell) || (cellRight && !cellDiag && nx)) {
    this.y = ty + 1;
    this.vy = 0;
    cell = this.cell = cellDown;
    cellRight = this.cellRight = cellDiag;
    ny = 0;
  }
}
if(this.vx > 0) { // Right collision
  if((cellRight && !cell) || (!cellDown && cellDiag && ny)) {
    this.x = tx;
    this.vx = 0;
    nx = 0;
  }
}else
if(this.vx < 0) { // Left collision
  if((!cellRight && cell) || (cellDown && !cellDiag && ny)) {
    this.x = tx + 1;
    this.vx = 0;
    cell = this.cell = cellRight;
    cellDown = this.cellDown = cellDiag;
    nx = 0;
  }
}
this.falling = !(cellDown || (nx && cellDiag)); // If player isn't on ground
}
}

Thanks for the help!

EDIT: I should note this also happens with the bottom of blocks as well. The same principles apply as clipping to the top, except you clip to the bottom instead.

sentences:
Interpolating Matrices Apologies if I am missing something very obvious (likely!) but is there anything wrong with interpolating between two matrices by:

    float d = (float)(targetTime.Ticks - keyframe_start.ticks) / (float)(keyframe_end.ticks - keyframe_start.ticks);
    return ((keyframe_start.Transform * (1 - d)) + (keyframe_end.Transform * d));

As in my app, when I try an use this to interpolate between two keyframes, the model begins to 'shrink' - the severity based on how far between the two keyframes the target time is; its worst when the transform split is ~50/50.

sentences: Changing the culling mode in the HLSL effect I'm writing a cel-shading effect in HLSL and Direct3D 11, and I need to be able to flip the culling mode on the outline pass of the effect.  I know you do this in XNA by setting CullMode to CW or CCW inside the pass definition, but is that how you do it in D3D11/SlimDX?

sentences:
In Android, is it possible to get the first version of the app the user installed from the Play store? I have an app currently in alpha, and I am thinking of moving to beta soon.
Once I do this step, I want to re-initialize local files as the game changed quite a bit (local scores, etc.), and display a "Thank you for testing the alpha-version"-message and whatnot.

To do this, I would like to check whether the first time the user installed my app from the app-store was during the alpha, i.e. whether the version corresponds to one of the version of alpha.
I found that it is possible to get the time the app was first installed, but haven't found a way to retrieve the version.

Short story long: is there a way to get the version of the app the user installed it for the first time?

P.S.
If possible, I would like to achieve this in Unity

sentences:
How to check a value from the last frame, while using events in Unity What I am trying to do is check if a value has changed from the last frame, while using events. Typically I could use threading to my advantage and have a check at the bottom of Update() to see if a value that is typically changed higher up in Update() was changed or not.

However, I am programming with Events, and I don't rely on Update() in several classes to change data. When an event is published, it makes method calls to all methods subscribing to that event. CameraUpButton() is called by the event manager, not by Update(). ClearUp() is called from Update().

I want to see how long an event has been constantly published for, essentially seeing how long the up button has been held. Checking how long it has been held is the easy part, clearing it once the button is no longer held is the hard part since I do not know how to see when an event stopped publishing (I don't know if that is even possible?). So I'm resorting to making some logic to figure it out for me.

In this case:

 private int up;
 private void CameraUpButton()
 {
     up++;
     Vector3 cameraPos = Camera.main.transform.position;
     cameraPos.y += 0.01f;
     Camera.main.transform.position = cameraPos;
 }

 private void ClearUp()
 {
     some logic to determine
     if up has changed since the last frame
 }

Edit: I can make a Input.GetButtonUp("") event, however I want to see if this can be solved without relying on an event triggered by the button coming up. I would prefer if it can be solved without that reliance.

sentences: How do I use Ogre with CodeBlocks? I want to start writing games using ogre in combination with the CodeBlocks compiler but am struggling with the installation. I got the latest version of the compiler as well as the ogre engine from their respective websites. I have installed the compiler but cannot find my way in the integration of ogre though I read their installation guide, which I found confusing.I need clear step by step guide please.

sentences:
Why do I need offset on my camera? So I've been away from Unity and game development in general for a bit, so I'm working through Unity's UFO Tutorial and had a question about the camera set up. I don't understand why you need the offset for it? It follows the Player object directly it seems, and they use a Vector3? But it's a 2D game, so why not just use a Vector2? I was experimenting with the code just to see if I could figure it out, so I removed the offset variable completely but then when I ran the game it just showed a blank space in the game view. Any body who can help me understand this?

public class CompleteCameraController : MonoBehaviour
{
    public GameObject player; //Public variable to store a reference to the player game object
    private Vector3 offset; //Private variable to store the offset distance between the player and camera

    // Use this for initialization
    void Start ()
    {
        //Calculate and store the offset value by getting the distance between
        // the player's position and camera's position.
        offset = transform.position - player.transform.position;
    }

    // LateUpdate is called after Update each frame
    void LateUpdate ()
    {
        // Set the position of the camera's transform to be the same as
        // the player's, but offset by the calculated offset distance.
        transform.position = player.transform.position + offset;
    }
}

sentences:
How can I load a scene when starting a new game if the loading scene have a Main Camera? The problem is that if I turn the camera on enabled in the editor it will show part of the scene mixed with the main menu scene. And if the loading scene main camera is enabled off I will get error Display 1 No cameras rendering.

I have two scenes in the Hierarchy.
The first is Main Menu. The main menu have a camera.

Now I did that when I click on the button START A NEW GAME
It will load another scene:

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

public class NewGame : MonoBehaviour
{
    public void StartNewGame(int SceneIndex)
    {
        SceneManager.LoadScene(SceneIndex);
    }
}

In this screenshot you can see in the Inspector I'm calling the method StartNewGame and the index 1. Index 1 present the second scene that should be load: The Space Station

Now in the scene: The Space Station I have also a MainCamera under Player. The MainCamera is turned off in the editor. And I need somehow to switch between the Main Menu scene camera and the The Space Station scene camera.

If I will turn on the MainCamera in the inspector I will see some objects of the first scene and the second scene and then the game will start without the main menu and the player will fall down.

If I start the game when the MainCamera is turned off I will the Main Menu but then when I click on START A NEW GAME it will show me the message Display 1 No cameras rendering.

The last screenshot is of the Build Settings: Edit > Build Settings...
I added the two scenes to the build. The first scene at index 0 is the Main Menu the second scene at index 1 is The Space Station:

sentences:
How does Lua work as a scripting language in games? I'm a little hazy on what exactly Lua is and how a game that is programmed in C++ would use it. I'm asking primarily about how it is compiled and run.

For instance when you use a program written in C++ which uses Lua scripts: does the code in Lua just call to functions in the main program written in C++ and act as a uncompiled class waiting to be compiled and added to the memory heap of the C++ program?

Or does it act like a bash script in Linux where it just executes programs completely separate from the main program?

sentences:
What is FOVx in this diagram? a beginner game developer here. I have recently taken upon learning about 3D game development and I am stuck on a simple matrix problem.

The image is found from this article: http://www.codinglabs.net/article_world_view_projection_matrix.aspx
I am trying to represent this matrix in my code but I am not sure what precisely is meant by FOVx and FOVy. What is the difference and how would I represent this in my perspective matrix? I am not using any 3D api.

sentences:
multiplayer networking with physics I'm curious how multiplayer networking with physics is implemented in racing games.
We have a physical world with multiple fast-moving vehicles controlled by different people.
Let's say that vehicles have weapons and can shoot each other (Twisted Metal, Vigilante v8)

I'm anxious about hits and collisions.
Authoritative server or a better alternative?

sentences:
Distort a quad with a World Matrix Is it possible to distort a quad multiplying its vertices by a specific world matrix? See the picture to understand what kind of distortion I need:

Please note, that the quad is in 3d space and I particularly need it's VERTICES to be distorted and NOT to rotate a perspective camera. The quad is laying on a plane with Z=0, all of the quad's vertices have their Z components equal to 0 and they should have their Z component equal to 0 after the transformation.

I know that it can quite easily be done by moving the vertices in a vertex shader, but the reason why I need to distort the quad using a World matrix is because I am rendering hundreds of such quads with a single draw call. Some of them need to be distorted and some dont. So I need a uniform vertex shader for every case and before doing branching in the shader I would like to know if such distortion can be done with a World matrix.

sentences:
How to set "near" value properly? Usually, the camera's near value is set to sth like 0.1f. However, this (assuming 1.0f = 1 metre) makes everything that's closer than 10 cm from the camera invisible. On the other hand, when working with big open terrains too small near value results in this (yes, that's a sandy coast and water :P):

instead of this:

(Apparently, when the difference in distance between too objects is too small, you get artifacts. Something to do with precision, I guess, and apparently the precision is dependent on the near camera value.)

My question is - is it possible to set near value to something like 0.001f and not get the above artifacts?

sentences:
Server hosting and costs I'm developing a game that will require renting a server. The server will be used to host scores, clans, friends(on/off), match making, lobby, and chat. The game/match will be hosted by each player (to lower the cost). How much would a server like this cost? Any hosting recommendation? How much would it cost if the server hosts the games/matches too?

I want to know a base price (imagine a card game or turn based RPG, even though my game is real time).

sentences:
Luminance increase in SDL We have managed to create grayscale picture using the following snippet of codes in SDL. What we need to do now is how to first convert into YUV or YCrCb for it be able to set the luminance value and thereafter back into RGB?

const unsigned int gray = (component1 + component2 + component3) / 3;

const int gray_rgb = SDL_MapRGB(original->format, gray, gray, gray);

sentences:
What economic books would you suggest for learning about economic valuation of goods and simulations thereof? I'm looking to create an economic model for a game based on goods created procedurally.

Every natural resource and produced good would be procedurally generated, with certain goods being assigned certain uses.

  Fakesium might be used for the
  production of Weapon A and produced
  from Fakesium factories which use
  Dilithium and Widgets as reagents,
  where Widgets are also the product of Foo
  and Bar

The problem is not creating the resources and their various production utlities - but getting the game's AI empires and merchants to (Addendum: somewhat) correctly value the goods according to their scarcity, utility and production costs.

I need to create a simulation of goods which allows the various game factions to assign a common value denominator (credits) to each resource, depending on how much its worth to that empire.

I see the simulation being something like: "I have a high requirement for Weapon A. Since I don't have much of Fakesium, which is needed for Weapon A - I must have a high demand for Fakesium. If I can acquire Fakesium, devalue it. If not, increase its value - and also increase demand for Dilithium and Widgets too."

This is very naive - because it may be much much cheaper for the empire to simply purchase Dilithium and Widgets directly rather than purchasing Fakesium, for example. Another example is two resources might allow the creation of Weapon A (Fakesium and Lieron), so we'd need to consider that. I've been scratching my head over the problem and it keeps growing.

By the time the player joins the world, I'd expect enough iterations of this process to have occurred that prices would have largely normalised - and would then only trigger rarely to compensate for major changes (eg. if the player blows up the world's only Foo mine!)

Could anyone suggest resources (books, largely) which outline this style of modelling, preferably in the context of simulations? Since this problem would never occur outside fantasy worlds, I figured this is probably the most likely place to find people who have encountered similar problems and I'm sure there's people who know of good places for Games Developers to start looking at less specific economic theory too.

Additionally, does anyone know of any developers with blogs whose games or research applications perform similar modelling?

EDIT: I think I should underline that I'm not looking for optimal solutions. I'm looking to make the actors impulsive - making rudimentary decisions based on fuzzy inputs about what they care about or don't. I'm aiming to understand the problem area better not derive answers. All the textbooks I've found seem to be about real-world economics or how to solve complex theoretical problems, neither of which are terribly relevant to the actor's decision making.

sentences:
How to create more vertexes from within a shader in OpenGL? when rendering voxels in octrees, the only information necessary is the current octree-level, -position and colour/texture.
But one has to send eight vertices to the rendering pipeline in order to render a complete cube and still needs colour/texture.

Is there a better way?

Since geometry-shaders wont be wide-spread for quite some time the "emit_vertex"-method in the geometry-pass wont suffice (or am i wrong? i don't think mesa currently supports geometry-shaders).
Also, afaik, backface-culling is done before the geometry-pass, so that would lead to additional overhead.

My current idea is to send 'dummy vertices' and have the actual drawing data in between but that really shouldn't be the solution.

kind regards

sentences: Unity store data in database Is it possible to store assets used in a Unity game (2D or 3D) in the database? I think it is less efficient but want to have single source of truth and maybe have the game contact the database everytime it loads to get the new updates.

sentences: IOS/Android Game programming I am somewhat new to the whole game programming thing. I was wondering if I could develop a game for IOS and Android with using openGLES. if so how can I run the code on the devices and what are some good resources to continue learning from. I am only targeting mobile devices so information for PC/Mac is irrelevant to me. Thank you for your help :)

sentences:
Is it more efficient to use an A* algorithm or a line system drawn in pathfinding in C#? I was recently introduced to the A* algorithm when I asked a friend about making AI/NPC's in video games move to certain points and it sounded very interesting. I am building an FPS and it has AI that must be able to move to certain points, so the A* algorithm sounds very appealing to me.

However, as I went through the Half-Life 2: Episode 1 Developer Commentary, I found another solution that the workers at Valve have been using: a line system. I couldn't find a screenshot and alas, I couldn't find the developer node to show the system. :(

Basically, there's a whole system drawn on the level map for AI to move along. If there happens to be an enemy that shows up in a certain section that might not be on the AI's line of sight, then the AI can break out of the line and attack said enemy.

I'm building the game in C# (XNA) and I wanted to know if it would be better to use the algorithm, the line system or even both to achieve pathfinding?

sentences:
Modular building technique with angles? (A roof) Ive been spending a bit of time lately studying the modular buildings of many games and reading/viewing several tutorials about it as well, but almost every example I see uses a plain square building that does not have any angled roof or similar.

In all my applications (CS6, Blender/Max, UDK) I adhere to the same grid spacing and I get pretty good results, but trying to make modular angled pieces is confusing me as I'm not sure the best way to approach it.

Below is some shots of my template sheet and workflow I have been doing. Should I do the roof separately or is it possible for me to keep it in the same texture sheet?

The main issue is below. I have made a couple modular roof pieces but when i try to use them, i end up needing to model multiple other parts to fill gaps based on what roof shape i want. I then model those 'filler' pieces and now i have that much less space left in my texture sheet and those pieces are usually not that reusable for anything else. This is where im not sure how to proceed.

If anyone has any links to documents or papers talking about this or advice, I would greatly appreciate it! =-)

My main roof pieces with the gaps

My power of 2 texture sheet, with 16x16 grid squares.

The texture sheet loaded into blender on a 16x16 plane and starting to separate and extrude.

sentences:
Unity3D - different object with the same mesh imported from Blender I would like to instantiate different objects (i.e. poker chips with different values) that actually share the same mesh imported from blender. To this end I have copied the assets and changed the texture but all the assets automatically switch to the last texture I choose as they are actually the same entity.
What am i doing wrong?

sentences:
Unity Quality Reduction only reduces my player sprite quality I created a small map in tiled then imported it into Unity. A small sprite character is controlled by the player to roam about the map. I am experimenting with this for University and wanted to see the effect reducing the graphics quality had on the game and machine. So I created an executable and before playing I chose a lower quality setting. However, choosing a lower setting results in only the character becoming more pixelated, the map graphics is completely unaffected.

I assume this is to do with Tiled?

How could I reduce the quality of the map in Unity? Or does it have to be done in tiled?

**EDIT

The map was imported via Tiled2Unity.

sentences:
Why is there a huge update-delay in my client/server code? I'm working on my Java game with Libgdx and having trouble with the network code. I can create a server, make multiple clients connect to it, but there is a huge delay between the player's input and the movement.

This is basically how it should work:

SERVER:     (Launch and listen to connection.)
CLIENT: I want to connect
SERVER:     OK, here is the map and all other data
CLIENT: I pressed "D"
SERVER:     OK, I move this player, here is your position
CLIENT: I received my position

On the 2 last steps, when I pressed an input, the server gets it correctly and updates the position and immediately sends the position to the player, but here is my problem:

Server log (the numbers are X- and Y-coordinates):

Sat Sep 20 18:49:16 CEST 2014 : Send 2356.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2358.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2360.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2362.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2364.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Send 2366.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2368.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2370.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2372.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2374.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2376.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2378.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Send 2380.0 1376.0

Client log:

Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:16 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:17 CEST 2014 : Receive : 2336.0 1376.0

As you can see, the player receives the data at the wrong moment. Here is when the client start to receive

Sat Sep 20 18:49:18 CEST 2014 : Receive : 2336.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2338.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2340.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2342.0 1376.0
Sat Sep 20 18:49:18 CEST 2014 : Receive : 2344.0 1376.0

As you can see, there is almost a 2 seconds of delay (something like 1.6 / 1.7s).

This is how I send/receive data:

Sending:

synchronized(this.gestionPlayers) {
   for(GestionPlayer gp : this.gestionPlayers) {
        if(this.serializablePlayer.size() > 0)
            gp.sendPlayer(this.serializablePlayer);
    }
}

sendPlayer function:

try {
    this.objectOut.writeObject(sp);
    this.objectOut.reset();
} catch (IOException e) {
    this.actif = false;
    e.printStackTrace();
}

Receiving:

Vector<SerializablePlayer> p =
    (Vector<SerializablePlayer>) this.objIn.readObject();
this.map.addNewPlayers(p);
this.map.multiplayerRender();

SerializablePlayer contains the player's ID and coordinates.

If you need more information, just ask. This is the last step in my multiplayer game and I'd be happy if you could help me! :)

sentences:
Is a 10 meg 2048x2048 bitmap too big a size texture to use in an OpenGL game? This is a speed question, I have a texture, which is 2048 per 2048, the texture is designed to run in big resolutions (1920x1080 for example).

The problem is, that the texture have a size of 10MB in bitmap, is too heavy, I don't know if that's a good size for load it in gl and use it in a game...

Is there any problem to use a 10MB texture in an OpenGL Game?

sentences:
websockets authentication security Im doing a online game havingclient, js html5, and server, nodejs with websockets.
I've read some blogs about websockets security, and its limitations, but no real implementation or example.

Could JWT tokens in the messages sent to the server, be a good option? Meaning when the clients connect to the server, it gets a token and passes it around on every message? And use wss instead of ws.

Thanks in advance!

sentences:
Leaderboard setup for Android I am totally new for this setup. I am trying to implement google Leaderboard. I followed the step by step process showed in "This Link". i opened windows -> Google play games -> setup -> Android setup. In Android setup i named the class name and copy and paste the xml code from play store account

This Picture Shows this

then i  clicked setup button. i got two popup boxes, Shows below,

in console i got messages

Note: All my software's are updated version only. first i used jdk 64bit. now i uninstalled 64bit and i installed jdk 32 bit. still i got the same problem

Anybody Please help.

Edit 2:
   using This video now i fixed the error JAVA_HOME not set.

then in unity i tried to do the same. Now it displays another message shown below

sentences:
Is a Computer Graphics book being outdated a problem? Me and my friends decided to make a game engine as a graduation project and this summer we are dedicating ourselves to really get into the knowledge we need before actually starting the project.
We are starting by watching the UC San Diego CG course(s) (there is an advanced course now) and also read the Essential Mathematics for Games and Interactive Applications 3rd Edition book (we are a bit undecided about the book so if you have any comments about it we will greatly appreciate them).
Our problem mainly is that while googling for CG books, answers on this community and even on other sites seem to always suggest outdated books (like Computer Graphics C Version 2nd Edition).
Now, I personally don't think a book being outdated is necessarily bad, but it could be. Depends on how differently things in the 2020 are being done and as a beginner I am obviously ignorant of that aspect.
Is a book being outdated a problem?

sentences: How can I convert THREE JS Texture to WebGL texture I am a C++ OpenGL programmer trying my hands on Web Developement. I have created Three JS Render Target and rendered my scene to it. The output is correct. Now I have a need to convert output of Render Target i.e THREE.Texture, to WebGLTexture. I don't want to use doElement.toDataURL() or something like that.

sentences: Is there a way to use the UnityEngine.UI with SteamVR and the Vive? I recently got into developing VR games using the Vive as my standard platform. Now I would like to design some UnityEngine.UI elements that would be interactable via the built in pointer scripts that come with the SteamVR module from the Unity Asset Store.  However, I can't seem to find any kind of built in method for allowing interaction between the pointers and buttons, scroll bars, etc.  I have also been unable to write anything myself that would do the trick, it's almost as if the Unity UI is just not designed to interact in a VR environment at all.  Does anyone have a method for using the UnityEngine.UI in a VR environment?  If so, can you please point me in the right direction?

sentences:
Make game for iPhone only From the beginning of development on my game I was hoping to release it as a universal app, but the gameplay simply doesn't work as well on the iPad. Also, it was designed to work on the iPhone screen, and the (even slight) difference in width to height ratio gives iPhone users an advantage over iPad users by seeing more of the path ahead. Not to mention it doesn't look quite right on the larger screen.

Hypothetically, if my game becomes a top seller, would it be a bad idea to have it only an iPhone app? Would it make it far less likely for my app to become viral? My app would still work on the iPad like any other iPhone app, and I plan on eventually releasing an update that supports both iPad and iPhone.

sentences:
Help finding coordinate for left of screen in this frustum I have a frustum with l=-2, r=2, n=0.5, f=10, corresponding to left, right, near, far respectively. I also define top and bottom too.

I've set the camera eye up at (0, 0, -2.5), looking directly at (0, 0, 0) with up (0, 1, 0).

Suppose I want to position an object centred at z=-1. I want to find the x coordinate so that under this frustum it appears exactly centred on the left edge of the screen.

I set up the following diagram to help me:

                       +z
                       |
            \          |          /
     -x<_____\_________|_________/______>x
              \____x___|-1      /
               \       |       /
                \      |      /
                 \_|l|_|     /
                  \    |    /     |near dist=n=0.5
                   \   |   /      |
                    \  |  /       |
                     \a| /        |
                      \|/         |
                       |-2.5
                       |
                       -z

So to find x I can use simple trig. Since tan a = |l|/n and tan a=x/1.5 then the formula for x is x=|l|/n*1.5=2/0.5*1.5=6, where |.| is the absolute value.

But when I use this x value to draw an object left of the centre, it does not appear centred at the edge of the screen. I can see the object but it's not on the edge. Moreover, if I increase n then the gap between the object and the left edge increases. What am I doing wrong?

UPDATE

Empirically I have discovered that if I compute x=|l|/n*2.5 then my object is correctly centred on the left edge of the device screen, and works for any n value I choose. Not sure why 2.5 works...

SOLUTION

Not really worthy of an answer, but I found in some legacy code that the renderer was set up to transalte the z forward by 1 unit, so this was undoing my -1 z value, hence why multiplying by 2.5 worked and not 1.5.

Despite this annoying fact, I'm now confident I fully understand how the frustum fits into OpenGL.

sentences:
I want camera to be positioned on the player also x axis should move continuosly by .05f in unity 2d I am creating an 2d platformer and I am newbie to Unity; any help will be highly appreciated. I want the camera to be positioned on the player and also the X axis should move continuously by .05f. And if player is not moving or stuck somewhere and if player is behind camera player (because X axis is automatically moving by .05f)  then player should die.
Is it doable? I am using Cinemachine and any script logic will be appreciated.

sentences:
How can shader code duplication be reduced in Unity? In our current Unity project we have a few shaders that are basically just supersets of another shader. For example, we have a shader that performs lighting calculates with diffuse, normal, specular, and gloss maps, and a shader that performs lighting calculations with a diffuse, normal, specular, gloss, and glow map. The first is a subset of the second, but for performance reasons we've decided to separate them. This leaves us with heaps of duplicated code.

On top of this, I need to add stencil buffer operations to some of these materials, which is about 3 lines, but from what I can see, requires the entire shader file to be copied again.

How can we reduce this code duplication? In an object orientated language we'd used inheritence and polymorphism. What can we do here?

sentences:
CATiledLayer drawing delay I am developing an iphone app.
It has following page structure,
1.List of game levels in a UITableView
2.Game page

I use "UIViewAnimationTransitionFlipFromRight" between pages

Game page has 3 views, One is a scrollView in that my game grid is drawn.
Game grid is a sub class of UIView ,that added to Scrollview.
To support zooming i use CATiledLayer to draw the grid(20*20).

MY problem is GameGrid shows white or last played puzzles grid contents for a few seconds and then refresh(flashing) to the new content.

My GameGrid class as follows

`

 @implementation GameGrid

+(Class)layerClass
{
 return [CATiledLayer class];
}

 - (id)initWithFrame:(CGRect)frame {
        if ((self = [super initWithFrame:frame])) {
           CATiledLayer *tempTiledLayer = (CATiledLayer*)self.layer;
           tempTiledLayer.levelsOfDetail = 5;
           tempTiledLayer.levelsOfDetailBias = 2;
              self.opaque=YES;
           }
             return self;
}

-(void)drawRect:(CGRect)r
{
 //empty
}

-(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context
{
 // here i am drawing grid
// filling rect
 // lines
// string etc..
}

sentences:
How to draw only visible tiles? I have a big map with isometric tiles(3d camera), how can i draw only visible tiles ?

Whats the best way to do that ? space partitionning (octrees etc...)?

sentences:
Spider physics to patrol on platform smoothly when changing direction I have a 3 tile wide platform. I want my spider to hang from the ceiling and patrol this platform left and right.
I have dx property for velocity. I want a physics code that shows how to achieve this.
I tried this but it is too harsh:
  if (dx < 0 &&
      !base.isSolid(-16, -1)) {
    dx *= -1;
  } else if (!base.isSolid(16, -1)) {
    dx *= -1;
  }

What I want spider is to slow down on edges change direction and speed up.

sentences: Motion capture for indie developers? Several years ago motion capturing was only possible for big name studios due to cost.  Now it seems that it is moving into the realm of indie developers due to lowering costs and better technology.  I've researched it a bit and seen two major options:  IPISoft and iClone which both cost several hundred dollars and use fairly cheap hardware(Kinect or PS3 eye).  I was wondering if anyone could recommend any other alternatives?

sentences:
Background made with procedural shapes I would like to know how to make a background like Super Hexagon managed to do: a hexagon in the middle and equally sized trapezoids.

There's a screenshot below & the here is the effect in motion.

How can this be done? Can I use a big sprite or procedural meshes?

sentences:
with XNA 4.0, How can I combine 2 models to make one? I want to animate Model1 (an aicraft) and I want an object, Model2 (a sphere), to follow it in translation and rotation, as it is a part of this aircraft.

With the following code (I use one or two tutorials to write it) everything seems good when you just change just one angle at the time. The sphere gently follows the aircraft, but if you change more than one angle at the same time, everything goes wrong.

I wonder if it's not a gimbal lock problem? But I use quaternions? Or maybe I haven't understood all this stuff?

My code is below:

protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

    // Command input to airplane
        float yokeUpDown = 0.0f;
        float yokeRightLeft = 0.0f;
        float RollRotation = 0.01f;

      //make quaternion rotation matrix of airplane
        Quaternion additionalAircraftRotation = Quaternion.CreateFromAxisAngle(new Vector3(0, 0, 1), yokeUpDown) * Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), yokeRightLeft) *Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), RollRotation);

    //increase or decrease aircraft rotation
        spacecraftRotation = spacecraftRotation * additionalAircraftRotation;

    // make vector3 sphere angle rotation
        sphereAngle.X = sphereAngle.X + yokeUpDown;
        sphereAngle.Y = sphereAngle.Y + yokeRightLeft;
        sphereAngle.Z = sphereAngle.Z + RollRotation;

    // make rotation quaternion for sphere
        Quaternion additionalSphereRotation = Quaternion.CreateFromAxisAngle(new Vector3(0, 0, 1), sphereAngle.X) * Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), sphereAngle.Y) * Quaternion.CreateFromAxisAngle(new Vector3(1,0, 0), sphereAngle.Z);

    //relative position of the sphere to the aircraft
        Vector3 translationSphere = new Vector3(-distance_Aircraft_Sphere, 0,0);

        translationSphere = Vector3.Transform(translationSphere, additionalSphereRotation);

        sphereposition = aircraftposition + translationSphere;

        // “VectorToAdd” = direction of the airplane
        Vector3 rotatedAircraftVector = Vector3.Transform(vectorToAdd, spacecraftRotation);

        aircraftposition += moveSpeedAircraft * rotatedAircraftVector;

        sphereposition += moveSpeedAircraft * rotatedAircraftVector;

}
enter code here

sentences:
How to remove jitter from motion input? I am writing a Minecraft mod that supports input from the Razer Hydra. It is a pair of motion controllers (one for each hand) that provide incredibly accurate position and rotation information.

For the purpose of this question, rotating the right controller on the Y-axis cause the player's character to look left or right (yaw), and rotating on the X-axis makes the player look up and down (pitch).

The input from the controller is mapped directly to the character's heading. If the controller is rotated 30 degrees left, the character turns 30 degrees to the left.

The problem is that the input "jitters". If I try to hold the controller perfectly still, the character's heading moves erratically within a very small cone (maybe 1 degree).

This is probably due to my shaky hands, as the controller's data is seemingly exact.

I tried filtering input by averaging data from the last X frames, but this makes input seem buttery.

My question is: How can I filter the rotational data to remove jitter without loosing precision?

sentences:
Spot Light color fade in Unity 3d I have a scene where many spot lights are focused on the screen. All have red color and same intensity. What I want is that the red Color(0,0,0,1) value should increase and decrease in a fading effect over a period of time. I thought of using Color.Lerp() but can not achieve it. What currently I am doing is attaching this script to all the instances of the SpotLight.

void Update()
{
 if(Time.time()%120==0)
   transform.light.color=new Color(Random.Range(0,255),0,0,1);
}

I know I am missing something big here. Help is appreciated. Thanks in advance.

sentences:
How do I follow this glsl1.2 + lights + shadows tutorial? I am following this great tutorial but I have many questions.

Let's see if I understand the basic idea.

1. I must create the same number of FBOs that lights (maximum 8).
2. I must create the same number of depth textures (shadow maps) that FBOs.
3. For every FBO I must perform offscreen render (render to texture, drawing the scene from the point of view of each of the lights, maximum 8 times).

Is this correct or can I use just a texture with multiple FBOs, or fbo with various textures or how?

Assuming you use the idea above, how should the final render of the scene?

glUseProgram(programa);
  glUniformli(shadowM0,4);
  glActivateTexture(GL_TEXTURE4);
  glBindTexture(GL_TEXTURE_2D,depthT0);
  //Draw Escene?

  glUniformli(shadowM1,5);
  glActivateTexture(GL_TEXTURE5);
  glBindTexture(GL_TEXTURE_2D,depthT1);
  //Draw Escene?

  glUniformli(shadowM2,6);
  glActivateTexture(GL_TEXTURE6);
  glBindTexture(GL_TEXTURE_2D,depthT2);
  //Draw Escene?

  ...
glUseProgram(0);

Is this okay? I think not, because it uses a lot of resources and the scene would have to be drawn up to 7 times. (One per light source and shadow mapping).

Well but then how should the render scene with multiple light sources and shadows?

sentences:
Box2d pathfinding using raytracing / predicted collisions I have a Box2d/Cocos2d iOS game with enemies that attempt to follow the player (to attack). I'm working on improving the pathfinding logic so that the enemies won't crash into objects in the world.

Using raytracing, I know when there's an obstacle between an enemy and the player. I know when the enemy can't see the player.

I'm attempting to find a good way for the enemy to navigate around the obstacle, no matter what direction it's facing.

Right now, I start with the angle between the enemy and the obstacle. I gradually increment the angle, looking for any on-obstructed path that will allow the enemy to travel further than the obstacle's distance. This seems to work well so far, but it doesn't take into account the size of the enemy.

For example, if I have a 32px-squared enemy, the raytrace may find a clear path that would involve the edges of the ship hitting an obstacle.

Is there a way I can run a raytrace, predict collisions for something with a known width? Or is there a better way for my enemies to navigate around an obstacle.

sentences:
How to move Character according to Camera's look direction? Vector3 newPosition = new Vector3(-horizontal, 0.0f, -vertical);
    transform.LookAt(newPosition + transform.position);
    transform.Translate(newPosition * MoveSpeed * Time.deltaTime, Space.World);

I'm developing 3d mobile game, you can look around with hold&sliding the right side of the screen and move with virtual joystick.

Goal;

Moving character to camera's lookDirection

Issue is;

When i push joystick up, character moves to the same direction (world related)

And I'm not good at coding that's why i can't solve the problem myself, i would be glad if you help me

sentences:
XNA - Obtaining depth from the scene's render target? Possible Duplicate:
  Depth buffer and render target

I'm currently rendering my scene to a render target so it can be used for rendering methods such as post processing and order independent transparency.

rtScene = new RenderTarget2D(
            GraphicsDevice,
            GraphicsDevice.PresentationParameters.BackBufferWidth,
            GraphicsDevice.PresentationParameters.BackBufferHeight,
            false,
            SurfaceFormat.Rgba64,
            DepthFormat.Depth24Stencil8,        // Requires a depth format for objects to be drawn correctly (e.g. wireframe model surrounding model)
            0,
            RenderTargetUsage.PreserveContents
            );

I am required to use RenderTargetUsage.PreserveContents so that the same render target can be rendered to multiple times, once for each of the draw methods below.

DrawBackground
DrawDeferred
DrawForward
DrawTransparent

The problem is that DrawTransparent requires a copy of the scene's depth as a texture.

Is there any way to obtain this from the scene render target above (rtScene)?

I can't have more than one render target with RenderTargetUsage.PreserveContents as this causes problems on hardware such as the XBOX 360, so rendering the depth to a separate render target at the same time as I render the scene isn't possible as far as I can tell.

Would I be able to get around this problem by "Ping-Ponging" two render targets (using the more compatible RenderTargetUsage.DiscardContents) and using the result for the depth texture?

sentences:
What is cutoff when calculating speed in this equation? I saw a twitter post mention the following as way to make movement frame-rate independent:
changeRate = 1 - exp(-2.0 * PI * cutoff / fps)
speed -= speed * changeRate

What is cutoff?  And is fps a constant or the actual fps?
As someone unfamiliar with game development, I'm probably doing all these wrong, but the equation above is the green ball:
https://codesandbox.io/s/gallant-davinci-f7o19?file=/src/index.ts

sentences:
How to make an object covers a specific distance before moving in other direction for same distance? Suppose there is a small tile and I want an object to move on x axis on that tile back and forth.
How can I make that object in that specific tile.
My code is :
 Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
    rb = GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{
    rb.velocity = new Vector2(-3f, 0);
}

As of now object moves left but I want it to start moving right and not go of the tile.

sentences:
Libgdx: scrolling background for preview screen Good day, I have been coding for quite a while now and I'm at a certain point where I am having difficulties on solving something. I've been creating a preview screen which contains the following:

reads .txt file and stores them in an array which will be displayed on the screen.
the text will have an animation which will be moving upwards like a Star Wars type of intro.
the background of the screen will also move upwards.

The problems that I have encountered are the following:

my text did not fit on the screen, but I did try to change the font and the font size and also did change the spacing in the .txt file.
the text always starts in the middle of the screen which it should start at the bottom of the screen.
the background is buggy, tried to debug it but still can find a solution for a parallaxbackground(scrolling background)

and here is the code.

public class PreviewScreen implements Screen {

    private static DugManMainClass game;
    private SpriteBatch batch;
    private OrthographicCamera camera;
    private Texture tx1 = Assets.bgmenu;
    private BitmapFont font = Assets.menufont2;
    private final static List<String> lines = new ArrayList<String>();
    private static int time = 0;
    private float temp = 0;
    private Sprite s;

    public PreviewScreen(DugManMainClass game) {

        this.game = game;

        //reads .txt file and stores them in an array

        try
        {
            BufferedReader br = new BufferedReader(new InputStreamReader(Gdx.files.internal("previewtext.txt").read()));
            String line = "";
            while ((line = br.readLine()) != null) {
                lines.add(line);
            }
            br.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public void render(float delta) {

        float w = s.getHeight();

        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        //temp is a timer which will do the animation effect for the text and background
        temp += Gdx.graphics.getDeltaTime();

        while(temp>1.0f/60.0f)
        {
            PreviewScreen.tick();
            temp -=1.0f/60.0f;

            //here is my problem for the background

            s.setU(temp+1f);
            s.setU2(temp+1f);

        }

        batch.setProjectionMatrix(camera.combined);
        batch.begin();
        s.draw(batch);

// i commented this out because i waited to draw my sprite which is the background text(parallaxbackground)
//      batch.draw(s, 0, -(temp / 10 % w));
//      batch.draw(s, 0, -(temp / 10 % w) + w);

        int yo = time / 4;

        //this is where the the text problem is
        for (int y = 0; y <= 420 / 12; y++)
        {
            int yl = yo / 12 + 420 / 12 - y;
            if (yl >= 0 && yl < lines.size())
            {
                font.draw(batch,lines.get(yl), (800 - 30 * 12) / 2,  y * 12 + yo % 12);
            }
        }

        batch.end();

    }

    @Override
    public void resize(int width, int height) {}

    @Override
    public void show() {

        batch = new SpriteBatch();

        float w = 800;
        float h = 420;

        camera = new OrthographicCamera();
        camera.setToOrtho(false, w, h);

        tx1.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);

        s = new Sprite(tx1);
        s.setPosition(0, 0);

        Assets.bgsound3.play(1f);

    }

    @Override
    public void dispose() {
        Assets.dispose();
    }

    public static void tick() {
        time++;

        if (Gdx.input.isKeyPressed(Keys.ENTER) || Gdx.input.isTouched()) {
            game.setScreen(new MainMenuScreen(game));
            Assets.bgsound3.stop();
        }

        if (time / 4 > lines.size() * 10 + 250) {

            game.setScreen(new MainMenuScreen(game));
            Assets.bgsound3.stop();
        }
    }

}

sentences:
Achieve anisotropic filtering I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#.

How do i set up anisotropic filtering in my shader?

Currently i try that in the shader:

Texture2D tex;
sampler textureSampler = sampler_state
{
  Texture = (tex);
  MipFilter = Anisotropic;
  MagFilter = Anisotropic;
  MinFilter = Anisotropic;
  MaxAnisotropy = 16;
};

float4 PShader(float4 position : SV_POSITION, float4 color:COLOR, float2 tex0 : TEXCOORD0) : SV_TARGET
{
  float4 textureColor;
  textureColor = tex.Sample(textureSampler, tex0) * color;

  return textureColor;
}

I get my object, textured, but it is not filtered anisotropic. I can write everything in the Parameters, even invalid things and i don't get any errors. The result is the same, objects without applied anisotropic filtering.

Do i have to set that in the shader? Can i do that also with SamplerState? I tested that but i didn't get a result too.

Some steps what i have to set would be helpful.

Edit:

Here the current result. You can see the blurred planes of the cube in the middle:

As comparison the same scene in OpenGL with 16x anisotropic filtering. The planes of the cube are not blurred:

Second Edit:

Based on the idea, that in OpenGL the anisotropic filtering is a texture environment variable, maybe i have set some settings in the texture wrong?

Texture2D texture = (Texture2D)Texture2D.FromFile("Test.png");
ShaderResourceView tSRV = new ShaderResourceView(device, texture);
device.ImmediateContext.PixelShader.SetShaderResource(0, tSRV);

sentences:
Large game project, local variables I'm hoping that some experienced programmers can give me their point of view. I'm writing a large game in Windows with dx11. So far, I've got global objects of the class that interfaces with dx11, the class holding the position of the camera, the terrain data class, and a few other classes. In future, if I kept going with this way, I'd also have objects for all the game data, and so on.

I'm thinking it might be best to rejig the code to only have local variables, because generally this is regarded as a Good Thing, but mainly because I personally have come to prefer using them. Here's some rough c++-ish pseudo-code of how I imagine local variables would be implemented:

WinMain()
{
  cDirectX dx;
  cCamera cam;
  cTerrain terrain;
  ...
  while (msg.message != WM_QUIT)
  {
    ...
    gameLoop(dx, cam, terrain, ...)
  }
}

void gameLoop(cDirectX &dx, cCamera &cam, cTerrain &terrain, ...)
{
  ...
  renderTerrain(dx, terrain);
  ...
}

Is this (very roughly!) a good way to organise such a project? I suppose WinMain is the only function where the locals can be instantiated?

The only disadvantage I can see is that top level function calls (by which I mean, functions like gameLoop(), functions at the bottom of the call stack) will have very long lists of arguments. Perhaps this doesn't matter.

Thanks, Paul

sentences:
Doesn't Unity5 support Expression Bodied Properties? I wrote the following line in Unity5 using C#:

private static float Width => 0.015f;

Unity complained about the following issue:

Unexpected symbol `=>' in class, struct, or interface member declaration

Doesn't Unity5 support Expression Bodied Properties(a new feature in C# 6.0)?

I am really lost here...

sentences:
Story dialogues: user controlled or script driven? I'm currently working on the animations that present the story.

Right now my animations are scripted. They allow me to dictate the pace of the scene. My dialogue bubbles expire on a simple "time per char" system or scripted time where needed.

I was wondering that maybe i should let the user control the flow with a click for each major frame. This gives him the time he needs to read and process the dialogue.

But that breaks the flow.
For example: when i want to create agitation, dialogues are really fast, barely readable etc.. Important stuff on the other hand is slow.

So my question is, what would your approach and why? Generally speaking. What do users prefer in these cases?

Platform is phones, scenes are presented in the same env as game engine, with characters only walking and talking.

sentences: What happens in pre production of a game? I see a lot of games in "pre-production" and was just wondering what actually happens in this stage. Is it just planning or does a prototype get made or what?

sentences:
How do I move from mainstream to indie development? I'm a game programmer for a AAA-level developer and publisher—which I know falls into the 'nice problem to have' category. However, I'm becoming disenchanted with the direction of both the company and the AAA-portion of the industry as a whole.

I want to do something fundamentally different.

It seems the market has never been better for smaller-scale projects, and I'd love to jump into that (and I've done small demos for Android and have started digging into iOS), but I obviously can't put anything out while I'm working for the company. I'm concerned that I shouldn't even do substantial development in my spare time on anything I'd eventually like to release on my own.

At the same time, I'm leery of leaving my job, for hopefully-obvious reasons, especially without a specific plan in place.

Has anyone out there got experience with 'going indie' out of a mainstream job? Do you have specific suggestions as to a best approach and what to specifically think about or be careful of?

sentences:
Recursive backtracking sometimes missing a tile? I have a basic recursive backtracking algorithm for a maze. It pretty much works but occasionally leaves some tiles in the corners untouched. This is the recursive function:

void GenerateMaze(Coordinate tilePos)
    {
        Debug.Log("MazeGen");
        tileMap[tilePos.x, tilePos.y].visited = true;
        Shuffle<Coordinate>(directions);
        foreach(Coordinate d in directions)
        {
            if (tilePos.x + d.x >= 0 &&
            tilePos.x + d.x < mapWidth &&
            tilePos.y + d.y >= 0 &&
            tilePos.y + d.y < mapHeight)
            {
                if (!tileMap[tilePos.x + d.x, tilePos.y + d.y].visited)
                {
                    Carve(tilePos, d);
                    GenerateMaze(new Coordinate(tilePos.x + d.x, tilePos.y + d.y));
                }
            }
        }
    }

This is how the Carve method looks like:

private void Carve(Coordinate position, Coordinate direction)
    {
        if (direction.Equals(new Coordinate(-1, 0)))
        {
            tileMap[position.x, position.y].west = true;
            tileMap[position.x + direction.x, position.y + direction.y].east = true;
        }
        else if (direction.Equals(new Coordinate(1, 0)))
        {
            tileMap[position.x, position.y].east = true;
            tileMap[position.x + direction.x, position.y + direction.y].west = true;
        }
        else if (direction.Equals(new Coordinate(0, -1)))
        {
            tileMap[position.x, position.y].south = true;
            tileMap[position.x + direction.x, position.y + direction.y].north = true;
        }
        else if (direction.Equals(new Coordinate(0, 1)))
        {
            tileMap[position.x, position.y].north = true;
            tileMap[position.x + direction.x, position.y + direction.y].south = true;
        }
    }

I'm betting on a typo or stupid mistake somewhere but I cannot find it. In my last result tileMap[4,4] stayed untouched without any walls. But the algorithm does backtrack as I often end up with dead ends. It does not happen often and up till now only on the sides.

Below is an example where two tiles on the bottom right have not been carved in too.

Here is another one without walls, this time 3 unconnected tiles in another corner of the maze.

Anyone can find whats wrong?

sentences:
How to make a model impressive I am importing a model from 3DS Max 2011 which has been rendered by 3rd party renderer Vray. I believe that fbx does not support Vray information.

So, my questions are:
. What others ways are there to make the model impressive?
. What are my other options?

Also please note that I am very new to the world of XNA, so please elaborate the suggestion.

sentences:
Script causes scene to load very slowly So I have this script (pasting the entire thing in it's current state) :

using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Events;
using ooparts.dungen;
using UnityEngine.UI;

    public class RoomMapManager : MonoBehaviour
    {
        public Map mapPrefap;
        private Map mapInstance;

        public int MapSizeX;
        public int MapSizeZ;
        public int MaxRooms;
        public int MinRoomSize;
        public int MaxRoomSize;
        public Image coverPanel;
        public int TileSizeFactor = 1;
        public static int TileSize;
        private UnityAction mapGenerationListener;
        private void Awake()
        {
            //  mapGenerationListener = new UnityAction(FadeCover);
        }
        private void OnEnable()
        {
            // EventManager.StartListening("GenerationComplete", mapGenerationListener);
        }
        private void OnDisable()
        {
            // EventManager.StopListening("GenerationComplete", mapGenerationListener);
        }
        void FadeCover()
        {
            Time.timeScale = 1;
            coverPanel.color = new Color(0, 0, 0, 0);
            coverPanel.raycastTarget = false;
        }
        void Start()
        {
            //TileSize = TileSizeFactor;
            //BeginGame();
        }

        void Update()
        {
            if (Input.GetKeyDown(KeyCode.R))
            {
                RestartGame();
            }
        }

        private void BeginGame()
        {
            mapInstance = Instantiate(mapPrefap);
            mapInstance.RoomCount = MaxRooms;
            mapInstance.MapSize = new IntVector2(MapSizeX, MapSizeZ);
            mapInstance.RoomSize.Min = MinRoomSize;
            mapInstance.RoomSize.Max = MaxRoomSize;
            TileSize = TileSizeFactor;
            //coverPanel.color = new Color(0, 0, 0, 1);
            //coverPanel.raycastTarget = false;
            //Time.timeScale = 0;
            mapInstance.Generate();
        }

        private void RestartGame()
        {
            EventManager.TriggerEvent("GameRestarted");
            StopAllCoroutines();
            for (int i = 0; i < mapInstance._rooms.Count; i++)
            {
                foreach (GameObject g in mapInstance._rooms[i].Monsters)
                {
                    Destroy(g);
                }
            }
            Destroy(mapInstance.gameObject);

            //BeginGame();
            SceneManager.LoadScene("Prototype2");
        }
    }

Notice how Awake, OnEnable and Start do nothing. When this script is attachet as a component to a gameObject the scene where this gameObject is loads very slowly. I mean it takes like 30s to 1 min for it to load even in the editor. THe behaviour is the same when I build the project both to PC and Android. When I start the scene itself from the editor there is no delay. I have no idea what might be causing this.

sentences:
resizing directx control so that more of my object's environment is visible I'm very new in 3D. I have a DirectX control which I want to be able to resize. A 3D object is shown in the control. On resize, I would like that object to stay the same size, only more of its environments should be visible. As I understand, I only need to change the FOV for this, and I tried to deduce how from the second image here http://msdn.microsoft.com/en-us/library/windows/desktop/bb206341(v=vs.85).aspx.

My "solution" is:

    float newFov = (float)(2 * Math.Atan((height / prevHeight) * Math.Tan(fov / 2)));
    projection = Matrix.PerspectiveFovLH(fov, width / height, zNear, zFar);

(fov is the vertical fov here before the resize, height is the control's NEW height, width is its NEW width)

Problem is, this is not working, if I change the control's width only it looks OK (but then FOV really doesn't change, only aspect ratio), but if I change the height too my object is scaled. I'm starting to think that something in my thinking is fundamentally wrong. I would appreciate any help from you 3D gurus out there.

sentences:
Anti-cheat Javascript for browser/HTML5 game I'm planning on venturing on making a single player action rpg in js/html5, and I'd like to prevent cheating. I don't need 100% protection, since it's not going to be a multiplayer game, but I want some level of protection.

So what strategies you suggest beyond minify and obfuscation?

I wouldn't bother to make some server side simple checking, but I don't want to go the Diablo 3 path keeping all my game state changes on the server side.

Since it's going to be a rpg of sorts I came up with the idea of making a stats inspector that checks abrupt changes in their values, but I'm not sure how it consistent and trusty it can be.

What about variables and functions escopes? Working on smaller escopes whenever possible is safer, but it's worth the effort?

Is there anyway for the javascript to self inspect it's text, like in a checksum?

There are browser specific solutions? I wouldn't bother to restrain it for Chrome only in the early builds.

sentences:
How do I make an AI that stays at a distance from the player act correctly when cornered? I am working on a few different AIs for a tile-based game. I'm trying to figure out one where that tries to keep a certain distance from the player. So if distance becomes small, move away.

The whole game is in a pretty small are so it can't just forever move away. The movement is 4 directional.

How do I make the AI keep going at a distance, and once caught in a corner or close to a side of the room, to ignore the rule and just try to go around the player to the other side of the room?

sentences: How can I separate gameview from UI most efficiently in Unity? Let me provide an image to illustrate what I mean. It is from a game called Runescape.

sentences:
Melee Range trigger collider does not detect object with Player tag In my 2D game, I have a Player which has:

a BoxCollider2D with isTrigger=false
a dynamic Rigidbody2D
a Player script

...tagged as "Player" and in the "Player" Layer.
Also I have an Enemy in the scene which has:

a BoxCollider2D with isTrigger=true
an EnemyMelee script

... tagged as "Enemy" and in the "Enemy" Layer.
The Enemy has its own collider because when to handle taking damage or changing colors when shot by the Player's bullets.
The Enemy has an empty child game object following it where it goes, called MeleeRange and it has:

a BoxCollider2D with isTrigger=true
a kinematic Rigidbody2D
an EnemyMeleeAttack script

...tagged as "MeleeRange" and in the "MeleeRange" Layer.
What I want is: When Player is inside of the MeleeRange area, the EnemyMeleeAttack script will detect this and call the Coroutine from the EnemyMelee script.
I want my Enemy to trigger its "attackMove" animation and attack my Player every 1.5 seconds. It has an exit time to the idle animation, and because the Player is still in the MeleeRange collision area, the attack will start again and return to idle again.
The problem is: MeleeRange simply cannot see the Player tag in the area. I put Debug.Log if it detects the player but nothing happened.
EnemyMeleeAttack script:
public class EnemyMeleeAttack : MonoBehaviour {
    public EnemyMelee enemyMeleeScript;

    void OnTriggerEnter2D(Collider2D coll)
    {
        if(coll.tag == "Player")
        {
        Debug.Log("MeleeRange Collision Reached!");
        enemyMeleeScript.anim.SetBool("isRunningBool", false);
        enemyMeleeScript.StartCoroutine(enemyMelee.attackStance());
        }
    }
}

EnemyMelee script:
public class EnemyMelee : Enemy {
    #region Variables
    public bool inRange;
    #endregion

    #region Attack
    public float attackTime;
    public float timeBetweenAttacks;
    #endregion

    #region Movement with AI
    public bool isRunningBool;
    public AIPath aipathScript;
    //public EnemyMeleeAttack emeleeattackScript;
    #endregion

    public override void Start()
    {
        base.Start();
        anim = gameObject.GetComponent<Animator>();
        aipathScript = gameObject.GetComponent<AIPath>();
        aipathScript.OnTargetReached();
    }

    private void FixedUpdate()
    {
        //Code for if Enemy dies, disable all functions attached to Enemy.
        if (health <= 0)
        {
            GetComponent<AIPath>().enabled = false;
            StopCoroutine(attackStance());
        }

        DamageColorUpdate();

        //Reference from A*Pathfinding for following player and running animations when following occurs.
        if (aipathScript.reachedEndOfPath == false)
        {
            anim.SetBool("isRunningBool", true);
            inRange = false;
        }
        else
        {
            anim.SetBool("isRunningBool", false);
            inRange = true;
            //StartCoroutine(attackStance());
        }
    }

    public IEnumerator attackStance()
    {
        if (Time.time >= attackTime)
        {
            anim.SetBool("isRunningBool", false);
            player.GetComponent<Player>().TakeDamage(damage);
            attackTime = Time.time + timeBetweenAttacks;
            anim.SetTrigger("attackMove");

            yield return null;
        }
    }
}

sentences:
changescene after timeline Is there a way to change the scene after playing a timeline with the new timeline system?

I have 3 scenes in my project. The first scene is where a player interacts with an object to trigger a change to the second scene. The second scene then plays my timeline. When the timeline finished playing I want to change to the 3rd scene.

How can I trigger the scene change at the end of that timeline?

sentences:
Collider inside collider in MRTK VR: Move the brain via controller while being able to click the spheres I faced a similar issue in 3d unity,
Collider inside another collider: Move the brain via mouse while being able the click the spheres
There is a box collider on the brain and individual sphere colliders on the spheres.
One of the suggestions was setting up a layer mask with the mouse, which worked surprisingly well. Now I would like to be able to accomplish the same in MRTK with Windows Mixed Reality Controllers. I need to know how to set up a similar layer mask for the pointers in MRTK so that clicks are only registered on the spheres but the brain can be rotated by click and drag.

sentences:
Why should I separate objects from rendering? Disclamer: I know what an entity system pattern is and I'm not using it.

I've read a lot about separating object and rendering. About the fact that the game logic should be independent from the underlying rendering engine. That's all fine and dandy and it makes perfect sense, but it causes a lot of other pains too:

need for synchronization between the logic object and the rendering object (the one that keeps the state of the animation, the sprites etc)
need to open the logic object to the public in order for the rendering object to read the actual state of the logic object (often leading the logic object to easily transform in a dumb getter and setter object)

This doesn't sound like a good solution to me. On the other hand it's very intuitive to imagine an object as its 3d (or 2d) representation and also very easy to maintain (and possibly much more encapsulated as well).

Is there a way to maintain graphic representation and game logic coupled together (avoiding synchronization issues) but abstract away the rendering engine? Or is there a way to separate game logic and rendering that doesn't cause the above drawbacks?

(possibly with examples, I'm not very good at understanding abstract talks)

sentences:
Raycasting from an object to the center of the screen (crosshair) without clipping through objects Am trying to learn about Raycasting, and I thought I would start with something simple, and that was a laser that would come out of an object (think laser pointer in your hand) and always go to the crosshair.

Using ViewportToWorldPoint I found it easy to cast a ray from the center of the camera, but this had an issue as you can see in this GIF below.

The line would clip through because the ray was coming from the center, not off to the side where the laser pointer would be.

Am not sure how to solve this.

void Update(){
    Vector3 ray = Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 0f));

    line.SetPosition(0, transform.position);

    RaycastHit hit;

    if(Physics.Raycast(ray, Camera.main.transform.forward, out hit, raylength)){
        if(hit.collider != null){
            line.SetPosition(1, hit.point);
        }
    } else {
        Vector3 pos = line.GetPosition(0);
        line.SetPosition(1, ray + (Camera.main.transform.forward * raylength));
    }
}

The closest thing I could find that I am trying to replicate for this exercise is the No Man's Sky mining tool

sentences:
How can I resolve component types in a way that supports adding new types relatively easily? I am trying to build an Entity Component System for an interactive application developed using C++ and OpenGL. My question is quite simple. In my GameObject class I have a collection of Components. I can add and retrieve components.

class GameObject: public Object
{
public:
    GameObject(std::string objectName);
    ~GameObject(void);
    Component * AddComponent(std::string name);
    Component * AddComponent(Component componentType);
    Component * GetComponent (std::string TypeName);
    Component * GetComponent (<Component Type Here>);
private:
    std::map<std::string,Component*> m_components;

};

I will have a collection of components that inherit from the base Components class. So if I have a meshRenderer component and would like to do the following

GameObject * warship  = new GameObject("myLovelyWarship");
MeshRenderer * meshRenderer =  warship->AddComponent(MeshRenderer);

or possibly

MeshRenderer * meshRenderer =  warship->AddComponent("MeshRenderer");

I  could be make a Component Factory like this:

 class ComponentFactory
 {
 public:
     static Component * CreateComponent(const std::string &compTyp)
     {
         if(compTyp == "MeshRenderer")
             return new MeshRenderer;
         if(compTyp == "Collider")
             return new Collider;
         return NULL;
     }
 };

However, I feel like I should not have to keep updating the Component Factory every time I want to create a new custom Component but it is an option. Is there a more proper way to add and retrieve these components? Is standard templates another solution?

sentences:
Determine Mesh Vertex Index Given Another Mesh Index Please bare with me as I explain what I am trying to accomplish :P

Each 'X' below represents a mesh vertex:

For my Unity3d GameObject (G1); the mesh vertices are stored in a C# List object in the following order. *Note the mesh index 'A'. This is a value I know - in this case A=16 (mesh index 16).

I have another GameObject (G2) whose shape is the same (a simple rectangle) but the mesh vertices are ordered differently.*Note the mesh index 'B'. This is a value I dont know and I want to find this value (mesh index) - in this case B=17 (mesh index 17).

As you can see the mesh arrangement is pretty much the same except rotated 90 degrees. If I know the 'mesh vertex index' of A how can I find the 'mesh vertex index' of B?

Whats an algorithm that can calculate the mesh index of B? My attempt is not working at all:

uint A     = 16;
uint nCols = 6;
uint nRows = 4;

// Technically both B and A sit on Row 3, Column 5 so if I can find A's row and column maybe I am there?
uint aCol = 16 / nCols;        // nup not right
uint aRow = (16 % nCols) - 1;  // gives 3

// Once I've calculated aCol and aRow its easy
uint B    = (aRow * nRows) + aCol;  // ie, (3 * 4) + 5 = 17

sentences:
Vertex data from a buffer I'm using a geometry shader to generate polygons for my voxel terrain (marching cubes).  The data is output into a buffer using the method shown in the article I link to below.

http://msdn.microsoft.com/en-us/library/bb205122%28v=vs.85%29.aspx

Is there any way to somehow extract the vertex data from the buffer, sort of like the inverse operation of this?

struct Vertex
{
    float x, y, z;
    float tu, tv;
}

Vertex[] data = new[] // this is what I want to get
{
    ...
};

DataStream stream = new DataStream(bufferSize, true, true);
stream.Write(data);
stream.Position = 0;
buffer = new Buffer(device, stream, description);

sentences:
2D: Scaling a character with multiple RigidBody2Ds? So, this example is in the Godot Engine, but other engines porbably have this kind of problem, too:

I have a character with multiple RigidBody2Ds, that also has a bone skeleton for animation over them. Now, the problem is, that Godot's physics engine handles the transforms of the bodies, so they won't scale properly. If you scale the children (CollisionShape2Ds and Sprites) the positions will be off. Is anybody aware of a proper way to work around this? Being able to scale these kind of characters would be awesome.

Thanks for all your answers.
Greetings, Footurist

sentences: FPS camera up and down control I am new to Unity. Now I am working with FPS camera. While pressing a key down arrow I want my camera to go down and again it come back to normal position. I am not getting any idea how to do it. Anyone, please help.

sentences: How to draw 2D pixel data with OpenGL I am fairly new to OpenGL. I have a 2D game in SDL2 that uses currently works by creating a SDL_Surface from the pixel data, copying it into a SDL_Texture, and rendering it to the screen with SDL_Renderer. But rather than using SDL to render the pixels, I'd like to switch to OpenGL. The reason I'd like to switch is because I need to render some lines on top of the pixel data and SDL_RenderDrawLine() just doesn't have all the features I need (like line thickness or glScissor). At first, I attempted to switch to OpenGL by using glDrawPixels() and I was happy with the results. However, I found out that glDrawPixels() does not seem to be available in OpenGL-ES (mobile devices). I have looked through some tutorials, but they all use shaders and other fancy stuff that I don't think I really need. Is there a simple way (like glDrawPixels()) to just draw pixel data to the screen for a 2D game? The pixel data is in the format GL_UNSIGNED_BYTE and it contains everything that I want to draw on the screen (except for several 2D line segments that I plan on using GL to render on top).

sentences:
Moving a continue condition into the for loop produced something NOT logically equivalent? I'm setting up a hex grid. The column/row system I use puts 0, 0 as the top left corner, and increasing columns (x) moves to the right but also vertically upwards. So columns run straight up and down, but rows run to the right but slanted upwards a bit.

This code...

for (j = 0; j < bd*2-1; j += 1) // bd is "board dimension", in my case 9
{
  for (i = 0; i < bd*2-1 and i < j+bd; i += 1)
  {
    if (i <= j-bd)
      continue;

    scr_ini_hex(i, j, bxo + i*hs, byo + j*hh - i*vs); // bxo and byo are arbitrary board x/y origins where the first cell is drawn, hs, hh, and vs are the gaps between cells in horizontal and vertical directions.
  }
}

produced this:

which is exactly what I want, a large hexagon with 9 smaller hexagons on each side.

So I thought I would be sophisticated and move that continue condition into the for loop. I wrote this...

for (j = 0; j < bd*2-1; j += 1)
{
  for (i = 0; i < bd*2-1 and i < j+bd and i > j-bd; i += 1) // added "i > j-bd", basically migrated the condition into this inner loop
  {
    //if (i <= j-bd)
      //continue;

    scr_ini_hex(i, j, bxo + i*hs, byo + j*hh - i*vs);
  }
}

and it produced this:

What went wrong here? I thought they were logically equivalent (except negating the condition, because the continue code was like a do until, but the for condition is like a do while).

sentences:
Get different result on different devices (same resolution) after setVelocity I'm dying with physics , i've tried to use setVelocity however i got slightly different value from different devices.

I've tested on iPhone 5 (on simulator)
and iPhone 6 (real device)
The Director::getInstance()->getOpenGLView()->getFrameSize() returns both devices is 640x1136 pixels

But i see they have different result after the animation , its about 2-5 pixels.
I really don't know why.

I'm making a multiple player game so i need exactly same coordinates of objects on every devices.
Does cocos physics return randomly result?

After deep digging, i realize that even i set specific velocity for one object in same device will return different result.

So i don't think this is about the devices, Chipmunk returns different result with the same input parameter!

sentences:
How to make a rigidbody come to rest faster I'm trying to move around a 3D rigidbody in Unity 2018.1.0f2 Personal. I am using a C# script with the basic vector3 and velocity stuff from a YouTube video:

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

public class Player : MonoBehaviour {
    [SerializeField]
    private Rigidbody playerBody;

    private Vector3 inputVector;

    private float xMovement;
    private float zMovement;

    [SerializeField]
    private float playerSpeed;

    private float maxSpeed;

    // Use this for initialization
    void Start () {
        playerBody = GetComponent<Rigidbody>();
        playerSpeed = 1;

    }

    // Update is called once per frame
    void Update () {
        xMovement = Input.GetAxisRaw("Horizontal")* playerSpeed;
        zMovement = Input.GetAxisRaw("Vertical") * playerSpeed;

        inputVector = new Vector3(xMovement, playerBody.velocity.y, zMovement);
        playerBody.velocity = inputVector;
    }
}

It works great with a cube I put it on, except for this: if I move the rigidbody and then stop, it takes a long time for it rotate from go only one of the edges or corners just touching the ground (screenshot of what I mean, another screenshot) to resting flat. How can I make it fall back to stability faster?

sentences:
Loop through a loaded .x file's vertices I need to compute the "gravity center" of a mesh, some kind of barycenter, and then find the farest vertices to compute a bounding sphere.

Here is what I have for the moment:

D3DXVECTOR3 result(0,0,0);
int num = mesh -> GetNumVertices();
LPDIRECT3DVERTEXBUFFER9 vertexBuffer;
mesh -> GetVertexBuffer((*vertexBuffer));
void* rawData;
vertexBuffer -> Lock(0, mesh->GetNumBytesPerVertex() * mesh->GetNumVertices(), &rawData, D3DLOCK_READONLY);
D3DVERTEXELEMENT9 decl;//[MAXD3DDECLLENGTH];
UINT numElements;
mesh -> GetDeclaration();
mesh -> GetFVF();

Apparently I need to cast the rawdata pointer, but I don't know what to do next...

sentences:
Cube Translation Looks All Wrong I'm making a very simple cube in OpenTK and it seemed to be going fine until I tried to move it around. Moving it along the X Axis seems to elongate the cube, not the result I hoped for.

My Vertex Shader

#version 330

in vec3 vPosition;
in  vec3 vColor;
out vec4 color;
uniform mat4 modelview;
void
main()
{
    gl_Position = modelview * vec4(vPosition, 1.0);
    color = vec4( vColor, 1.0);
}

My Fragment Shader

#version 330

in vec4 color;
out vec4 outputColor;

void
main()
{
    outputColor = color;
}

How I make modelview

    Matrix4 c = Matrix4.LookAt(Game.camera.Position, new Vector3(Game.camera.X + 1f, 0, Game.camera.Z + 0f), new Vector3(0, 1, 0)) * Matrix4.CreatePerspectiveFieldOfView(
    (float)(0.5 * Math.PI),
    (float)1366 / 768,
    0.1f,
    1000.0f); * Matrix4.CreateTranslation(Origin);
GL.UniformMatrix4(Game.uniform_mview, false, ref c);

What I'm doing here is adding 0.01 to Origin.X while moving the camera the opposite direction.

Does anyone know why it produces this result? Thanks in advance for your help.

EDIT: Multiplied matrices by perspective * view * model

This weird line seems to blink in and out as I move the camera around.

EDIT 2: Matrix Printout

(0, 0.9999995, 0.001019571, 0.001019367)
(0, 0.001019367, -1.0002, -0.9999995)
(0.5622255, 0, 0, 0)
(1207.66, -0.9999995, 980.9957, 980.9995)

sentences:
Best practices with Vertices in Open GL What is the best practice in regards to storing vertex data in Open GL?  I.e:

struct VertexColored {
    public:
        GLfloat position[];
        GLfloat normal[];

        byte colours[];
}

class Terrian  {
    private:
        GLuint vbo_vertices;
        GLuint vbo_normals;
        GLuint vbo_colors;
        GLuint ibo_elements;

        VertexColored vertices[];
}

or having them stored seperatly in the required class like:

class Terrian  {
    private:
        GLfloat vertices[];
        GLfloat normals[];
        GLfloat colors[];

        GLuint vbo_vertices;
        GLuint vbo_normals;
        GLuint vbo_colors;
        GLuint ibo_elements;
}

sentences:
OpenGL: Move camera regardless of rotation For a 2D board game I'd like to move and rotate an orthogonal camera in coordinates given in a reference system (window space), but simply can't get it to work.

The idea is that the user can drag the camera over a surface, rotate and scale it. Rotation and scaling should always be around the center of the current viewport.

The camera is set up as:

gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-width/2, width/2, -height/2, height/2, nearPlane, farPlane);

where width and height are equal to the viewport's width and height, so that 1 unit is one pixel when no zoom is applied.

Since these transformations usually mean (scaling and) translating the world, then rotating it, the implementation is:

gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();

gl.glRotatef(rotation, 0, 0, 1); // e.g. 45°
gl.glTranslatef(x, y, 0); // e.g. +10 for 10px right, -2 for 2px down
gl.glScalef(zoomFactor, zoomFactor, zoomFactor); // e.g. scale by 1.5

That however has the nasty side effect that translations are transformed as well, that is applied in world coordinates. If I rotate around 90° and translate again, X and Y axis are swapped.

If I reorder the transformations so they read

gl.glTranslatef(x, y, 0);
gl.glScalef(zoomFactor, zoomFactor, zoomFactor);
gl.glRotatef(rotation, 0, 0, 1);

the translation will be applied correctly (in reference space, so translation along x always visually moves the camera sideways) but rotation and scaling are now performed around origin.

It shouldn't be too hard, so what is it I'm missing?

sentences:
Do you actually use diagrams to model games? I mean mostly UML but any method that works is viable. So - do you actually model your games with UML/other diagrams or different methods? I had a subject at my university about modelling with UML and it seemed like more effort than actual benefit but I realise that might be only because I've never created a huge complex IT system. So is it worth the while and what types of diagrams/methods are usually* the best?

*Of course, many times concrete tools need be chosen to concrete problems but maybe there are some patterns.

Edit: I forgot one important thing - do you create diagrams before or after implementing stuff? What I mean is - when one designs and implements something one usually changes mind or something unexpected comes up and one has to make changes, sometimes major ones - and doing them in already complex diagrams seems equally hopeless as in the code itself.

sentences:
Simplest format for video I've been dwelling with a question lately,

I can generate screenshots with my library, but i found that i would like to be able to record video from a game.

Since video is just(well-simply enough, yeah) a collection of images, i guess i could easily write "screenshots" into a single file.

I know that makes sense, but the end result won't be understood by any video application around.
That's where the question pumps in,

What is the simplest file format that i can write to, that a video editing application will be able to understand and convert to a format of choice later?

As a bonus: What if i want to add the sound too? What do you think?

Thanks for the help.

sentences:
Why is the camera tilting around the z axis when I only specified x and y? My goal is to program a camera to point towards the mouse cursor. I attached the following script to the Main Camera.

using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour {

    public float sensitivity;

    // Update is called once per frame
    void Update () {
        transform.Rotate (Input.GetAxis ("Mouse Y") * -1 * sensitivity, Input.GetAxis ("Mouse X") * sensitivity, 0);
    }
}

I "told" the camera to rotate around the x and y axes. Whenever it does this, the camera tilts sideways. When I checked the rotation of Main Camera, I saw that the z rotation had changed. Why is it rotating around the z axis when I left it at 0?

sentences:
How can I render 3D dots at object vertex positions? What is the best way to put a dot on a vertex?

I have a model (a plane for example) consisting of a few thousand vertices. I want to draw a red dot at every vertex's 3D position, just like 3ds Max's vertex selection mode, for example).

I've tried drawing a small line on each vertex location which works fine with few vertices, but it causes performance problems when I have large objects with many vertices. I've also tried doing this with a shader, but I can't get this to work (I want to highlight the selected vertices). I've thought about drawing a small 3D cube at every vertex location, but this seems terribly inefficient.

How can I accomplish this in a way that will scale to large scenes?

sentences:
How do you do tile-based movement in Phaser? I'm looking to make 2D game that is very similar in movement to Pokemon Red or Blue (player must move a full tile in any direction, the ground moves smoothly beneath the player as they walk). I've got my hands on Tiled in order to make my maps, and I've got a player sprite that I can display over the map, but I can't seem to find a way to restrict the player to moving the way I want.

I feel like there should be some parameter for Arcade physics to make the movement the way I want, but I'm not finding it. Abandoning Arcade physics and manually changing the X/Y of the player with a loop kinda works, but can be very slow and laggy, making me think I'd need to look into the Time and Tween parts of Phaser to actually implement it correctly.

So did I miss something with Arcade Physics to do this? Or do I need a really good tutorial on Tween to manually code this myself?

sentences:
2D game background art and assets, sketch / drawing size and resolution for a 1080P PC Console game? I am a new game developer, working on a 2D platformer game.

I am working with my friends who can make sketches on paper and import them to Photoshop to paint, as none of us have worked on an actual game before we have no idea as to what scale /dimension to use while sketching (the background image for eg.).

I have always been a programmer and have only worked with blocks as placeholders while learning. So I have no idea how to communicate with the artists on what resolution or scale they should use or what type of assets I want.

My Required result is:

I want a game which should look good on a 1080p screen.
I want a 16:9 ratio for the game, with black bars at the bottom and top like
movies.
It should be scalable to fit all resolution screens(I am targeting
PC and console (future)release for the game).
You can imagine Guacameele as a reference for the art style.

My Specific questions are:

How should I communicate the technical aspects of the art to the artists for
character sprites / background images and items?
Is sketching out an image and taking a photograph and importing to photoshop
a good way to work on the assets? If not what should be done?
Should all the assets be of the same size, as I want a 1080p game and
suppose if the background is 1xsize should the character be 1/6xsize or the
same size as the background asset and scaled down in Unity(I am using unity
for development)?
What is the correct way of working with sprites in such a case, which image
format should I use, some other tools I should be using or some guide or
guidelines that everyone follows will be helpful.

Thanks !

sentences:
Is there a fully featured OBB class for Ogre3D? Is there a fully featured OBB (Oriented Bounding Box) class for Ogre3D?

I don't think there is one by default but I am looking for an alternative which has all the features of the AxisAlignedBox class.

sentences:
Unity block chunk generation pattern I am trying to do something like Minecraft game in Unity. Currently I am trying to generate a chunk of blocks, given dimensions. I can successfully create a chunk of N x 0 x 0 sized chunk, but due to lack of logic, I have no idea on how to make triangles and vertices match for other blocks.

Basically, what I mean is, I can generate something like this:

But can't do this:

My Block vertices and Triangles:

Vector3[] cVerts = {
        new Vector3 (0, 0, 0), //0
        new Vector3 (1, 0, 0), //1
        new Vector3 (1, 1, 0), //2
        new Vector3 (0, 1, 0), //3
        new Vector3 (0, 1, 1), //4
        new Vector3 (1, 1, 1), //5
        new Vector3 (1, 0, 1), //6
        new Vector3 (0, 0, 1), //7
    };
int[] cTris = {
        0, 2, 1, //face front
        0, 3, 2,
        2, 3, 4, //face top
        2, 4, 5,
        1, 2, 5, //face right
        1, 5, 6,
        0, 7, 4, //face left
        0, 4, 3,
        5, 4, 7, //face back
        5, 7, 6,
        0, 6, 7, //face bottom
        0, 1, 6
    };

Chunk creation method:

     void CreateChunk(){
        ...
        for (int x = 0; x < 100; x++)
        {
           for(int y = 0; y < 10; y++){
               for (int z = 0; z < 1; z++)
               {
                  AddBlockAtPosition(new VectorInt(x, y, z), "Grass");
               }
           }
        }

        ChunkMesh.vertices = CurrentChunkVerts.ToArray();
        ChunkMesh.triangles = CurrentChunkTris.ToArray();

        //ChunkMesh.uv = uvs.ToArray();
        ChunkMesh.RecalculateNormals();
   }

AddBlockAtPosition() method:

    void AddBlockAtPosition(VectorInt pos, string name)
    {
       int x = pos.x, y = pos.y, z = pos.z;

       //create separate cube data
       CubeMesh cube = new CubeMesh(vertices.ToArray(), triangles.ToArray(), uvs.ToArray());
       //I use MoveCube() to change each Block's vertex and triangle numbers, so they will "match" in a Chunk mesh, when they become part of it.
       cube.MoveCube(new Vector3(x, y, z), (x + y + z) * 8);
       //cube.MoveUV(new Vector2(x + y + z, x + y + z));

       CurrentChunkVerts.AddRange(cube.Vertices());
       CurrentChunkTris.AddRange(cube.Triangles());
       //CurrentChunkUV.AddRange(cube.UVs());
    }

And most importantly, that's where my problems are, MoveCube();

Class Cube{
    private Vector3[] vertices;
    private int[] triangles;
    ...
    public void MoveCube(Vector3 direction, int n)
    {
        for(int i=0; i<vertices.Length; i++)
        {
            vertices[i] += direction;
        }
        for (int i = 0; i < triangles.Length; i++)
        {
            triangles[i] = triangles[i] + n;
        }
    }
}

I know that I am not the first to re-create minecraft, I have found this tutorial https://www.blockstory.net/node/56

But for me as a beginner, some "simple" parts like these I have problems with are skipped. And other tutorials just generalize the idea, which isn't enough for me.

sentences:
What is the best PBR real time Fresnel function? I'm working on a physically-based renderer, and I've come to a sort of crossroads regarding the Fresnel factor. I'm having trouble finding the best way to represent it. I know that Schlick's Fresnel approximation is based off IOR, but IORs can go up to 38.6 for a meta-material, and 4.05 for a natural element, which will make representing these in a 0-1 image difficult and confusing. I also noticed that no one really uses IOR maps.

I also read a paper on Unreal's PBR integration, and I discovered that they initially wanted to use a F0 of 0.4, for non-metals. What would be the F0 for metals, in this case, and isn't the static value of 0.4 worth the limitations for that tiny bit of memory? I believe the F0 tends to the base color, as it becomes more metallic, but I'd like confirmation.

Finally, there's reflectivity or specular, as is used in modern PBR equations. Is there a standard for this, in regard to getting an F0? It seems arbitrary; is it a float value up to that directly maps to F0?

I am not sure if there are any real reasons to not combine specular color and base color, as Unreal has done this, before. I can't think of a single real reason, even for more stylized implementations.

What is the best PBR real time Fresnel function?

sentences:
How to detect if an object is upright? I have a cartoon car and it has a skid sound with the car skids. But when the car flips over the skid sound plays endlessly and its really annoying. I have a basic script that is meant to detect when the car is upright and only play the skid sound with the car is upright. Here is the code:

This script is on the car itself:

public bool IsUpright () {
        Vector3 rotationInEuler = transform.rotation.eulerAngles;

        float tiltX = Mathf.Abs(rotationInEuler.x);
        float tiltZ = Mathf.Abs(rotationInEuler.z);

        if(tiltX < uprightThreshold && tiltZ < uprightThreshold){
            return true;
        }else{
            return false;
        }
    }

This script is on a skid sound prefab:

void Update () {
        if(motor.IsUpright()){
            if(motor.IsMoving()){
                transform.GetComponent<WheelCollider>().GetGroundHit(out tireHit);
                currentFrictionValue = Mathf.Abs(tireHit.sidewaysSlip);

                if(skidAt <= currentFrictionValue && skidWait <= 0){
                    Instantiate(skidSound, tireHit.point, Quaternion.identity);
                    skidWait = 1;
                }
                skidWait -= Time.deltaTime * skidEmission;
            }
        }
    }

When the IsUpright bool (first script) is printed to the console it keeps flickering between true and false and it isn't detecting when the car is upright. By the way the uprightThreshold from the first script has a value of 40. I have also check in the inspector and the rotation of the car on both the x and z axis are not constant at 0, it is flickering up and down between about 1 and -1, but unfortunately unity doesn't support having negative rotation values, so rather it goes to 359, which is mucking up the system. Could someone show me how to fix this? Thanks in advance.

sentences:
game button animation lag with Photon Friends, I am making games using photon. But I could not do the delay animation as described in this link.
The action appears to be late on the player according to the ping. Can you give an ideas about this?

sentences:
How to deal with animated doors in isometric tiles I've got a tricky issue I'm not sure how to tackle best:
I have an animated tile of a door. When it's closed it should be sorted one way, but when it's openend it will need to be sorted a different way, as it belonging to a different(neighbouring tile).

Here's the door closed:

and the door opened:

I imagine it would be possible to override the sorting system for such tiles and adjust the sorting based on the frame, but it feels a bit hacky.

Has anyone encountered a similar scenario ? Any elegant solutions ?

sentences:
How to do topdown collisions properly? I'm trying to achieve grid/tile based collisions like "a link to the past"; here is an article showing it off (sliding off the corners and such). I'm currently using this type of collision test. It's based on deepnight's implementation of tile collisions but modified a bit, you have your positionX/Y in the world, TileX/Y is the tile equivalent (my tiles are 16/16), and XRatio/YRatio which is how much into a tile are you so whenever you're moving into a tile you can clip into it for a certain amount which is nice for making it seem like the player is above stuff and to have more control over it but I'm really looking for someone to show me how I'd go about implementing this kind of collision testing properly I've been having so many problems (Getting stuck in 1 pixel in the corners, Snapping on one side while the other u don't, getting stuck in general/not being able to move when holding diagonals etc) If you could "Explain Like I'm 5" that'd be awesome I'd really like to learn this stuff properly.
TL:DR - Trying to achieve Topdown collision detection like a link to the past/stardew (Slide off corners of tiles) and being bug free (Not getting stuck / snapping)

sentences:
How do I make so when user moves the camera it doesn't go beyond the scene borders in Unity3D? How do i make so when i move my camera, it doesn't go beyond the border of the canvas while playing. This is the script i use to make the camera move:

        if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved)
    {
        Vector2 touchDeltaPosition = Input.GetTouch (0).deltaPosition;
        transform.Translate (+touchDeltaPosition.x * speed, +touchDeltaPosition.y * speed, 0);
    }

sentences:
Fading in textures at a constant rate over a controlled duration I'm trying to fade textures onto the screen using SDL2.

I've tried some different methods I've looked up, but I always encounter the same problem. It seems that the fading takes longer and longer as Alpha gets higher and higher, meaning that the very end of the fade takes the longest amount of time, and thus the fade takes an unreasonably long amount of time. I want the image to fade in at the same rate, and not dramatically slow down when the image gets more and more opaque.

The code that was causing the issue described above has been deleted, and I'm working on an entirely new system to hopefully avoid the problem. However, it doesn't work at all. Any advice would be awesome!

My NEW code:

for (float alpha = 0; alpha <= SDL_ALPHA_OPAQUE; alpha += fadeSpeed * elapsedTime) {
        if (SDL_SetTextureAlphaMod(spriteTex, alpha) == -1) cout << "ERROR" << endl;
        SDL_RenderCopy(renderer, spriteTex, NULL, &destRect);
        math::present();
        cout << "ALPHA: " << alpha << endl;
    }

sentences:
Rendering a ID3D11Texture2D into a SkImage (SkiaSharp/Avalonia) I'm currently trying to create an interop layer to render my render target texture into a Skia SkImage. This is being done to facilitate rendering from my graphics API into Avalonia.
I've managed to piece together enough code to get everything running without any errors (at least, none that I can see), but when I draw the SkImage I see nothing but a black image.
Of course, these things are easier to describe with code:
private EglPlatformOpenGlInterface _platform;
private AngleWin32EglDisplay _angleDisplay;
private readonly int[] _glTexHandle = new int[1];

IDrawingContextImpl context // <-- From Avalonia

_platform = (EglPlatformOpenGlInterface)platform;
_angleDisplay = (AngleWin32EglDisplay)_platform.Display;

IntPtr d3dDevicePtr = _angleDisplay.GetDirect3DDevice();

// Device5 is from SharpDX.
_d3dDevice = new Device5(d3dDevicePtr);

// Texture.GetSharedHandle() is the shared handle of my render target.
_eglTarget = _d3dDevice.OpenSharedResource<Texture2D>(_target.Texture.GetSharedHandle());

// WrapDirect3D11Texture calls eglCreatePbufferFromClientBuffer.
_glSurface = _angleDisplay.WrapDirect3D11Texture(_platform, _eglTarget.NativePointer);

using (_platform.PrimaryEglContext.MakeCurrent())
{
   _platform.PrimaryEglContext.GlInterface.GenTextures(1, _glTexHandle);
}

var fbInfo = new GRGlTextureInfo(GlConsts.GL_TEXTURE_2D, (uint)_glTexHandle[0], GlConsts.GL_RGBA8);
_backendTarget = new GRBackendTexture(_target.Width, _target.Height, false, fbInfo);

using (_platform.PrimaryEglContext.MakeCurrent())
{
   // Here's where we find the gl surface to our texture object apparently.
   _platform.PrimaryEglContext.GlInterface.BindTexture(GlConsts.GL_TEXTURE_2D, _glTexHandle[0]);

   EglBindTexImage(_angleDisplay.Handle, _glSurface.DangerousGetHandle(), EglConsts.EGL_BACK_BUFFER);

   _platform.PrimaryEglContext.GlInterface.BindTexture(GlConsts.GL_TEXTURE_2D, 0);
}

// context is a GRContext
_skiaSurface = SKImage.FromTexture(context, _backendTarget, GRSurfaceOrigin.BottomLeft, SKColorType.Rgba8888, SKAlphaType.Premul);

// This clears my render target (obviously). I should be seeing this when I draw the image right?
_target.Clear(GorgonColor.CornFlowerBlue);

canvas.DrawImage(_skiaSurface, new SKPoint(320, 240));

So, as far as I can tell, this should be working. But as I said before, it's only showing me a black image. It's supposed to be cornflower blue.  I've tried calling Flush on the ID3D11DeviceContext, but  I'm still getting the black image.
Anyone have any idea what I could be doing wrong?

sentences:
How to convert screen space into 3D world space? I am trying to make a 3D model to look at the mouse position. Currently I have this code:

MouseState mouseState = Mouse.GetState();

Matrix world = Matrix.CreateTranslation(0, 0, 0);

Vector3 source = new Vector3((float) mouseState.X, 1f, (float) mouseState.Y);
Vector3 mousePoint = GraphicsDevice.Viewport.Unproject(source, this.game.Camera.Projection, this.game.Camera.View, world);

System.Console.Out.WriteLine("x: " + mousePoint.X + ", Y: " + mousePoint.Y + ", Z: " + mousePoint.Z);

I get output such as this in the console:

x: 0.1787011, Y: 999.7204, Z: 299.7723
x: 0.08917224, Y: 999.8602, Z: 299.8862
x: 0.05908892, Y: 999.9069, Z: 299.9241
x: 0.04422692, Y: 999.9302, Z: 299.9431
x: 0.03303542, Y: 999.9477, Z: 299.9573
x: 0.03109217, Y: 999.9508, Z: 299.9598
x: 0.02930491, Y: 999.9535, Z: 299.9621
x: 0.02770578, Y: 999.9559, Z: 299.9641
x: 0.0263205, Y: 999.9581, Z: 299.9659

The player is positioned at Vector3.Zero. The camera is positioned at new Vector3(0.0f, 1000.0f, 300.0f).

I would like to get output such as X: -300, Y: 0, Z: -300 when moving the mouse to screen top left and when moving the mouse to screen center where the model is located I want to have X: 0, Y: 0, Z: 0. So I want the world coordinates of the mouse so that I can make the player rotate towards the mouse.

Basically I want to map mouse X into world X, mouse Y to world Z and the world Y coordinate can be 0 at all times.

sentences:
Assigning script to multiple objects So I have multiple gameobjects that needs to be interactable and I've put them all in one gameobject container. But the thing is I still have to attach the script into each of the gameobjects that needs to be interactable for it to work and that seems kinda iffy when a scenario comes that I have to add more gameObjects.
Is it possible to just put the script in the container object? I tried this on my container object and I'm pretty sure I'm doing something wrong.
public GameObject spriteHandler;
GameObject sprite1;
GameObject sprite2;
GameObject sprite3;
private void Start()
{
    sprite1 = spriteHandler.transform.GetChild(0).gameObject;
    sprite2 = spriteHandler.transform.GetChild(1).gameObject;
    sprite3 = spriteHandler.transform.GetChild(2).gameObject;
}
void OnMouseDown()
{
    Debug.Log("Clicked");

}

sentences:
Can I use a shader with 2 different textures in Cocos2D (x)? We are evaluating a variety of different graphic engines for use in our game and we want to be able to use 2 different textures for many of our sprite maps. One sprite map would be the standard RGBA values and the other sprite map would contain normal data for these sprites. To be clear, these are not 3D models. The normal map would just help the flat 2D sprites better react to lighting.

I've done this exact thing in OpenGL ES 2.0 and I imagine the shader code would work in Cocos2D, but I'm wondering how I go about doing this in Cocos2D? I know you can assign shaders to sprites, but how would I specify a secondary texture?

sentences:
How can I generate a view or projection matrix for OpenGL 3.+ I'm transitioning from OpenGL 2 to OpenGL 3.+ and to GLSL 1.5. I'm trying to avoid using the deprecated features.

My question how do we now generate the view or projection matrix. I was using the matrix stack to calculate the projection matrix for me;

GLfloat ptr[16];
gluPerspective(...);
glGetFloatv(GL_MODELVIEW_MATRIX, ptr);
//then pass ptr via a uniform to the shader

But obviously the matrix stack is deprecated. So this approach is not the best an option going forward.

I have the 'Red Book', 7th ed, which covers 3.0 & 3.1 and it still uses the deprecated matrix functions in it's examples.

I could write some utility-code myself to generate the matrices. But I don't want to re-invent this particular wheel, especially when this functionality is required for every 3D graphics program.

What is the accepted way to generate world,view & projection matrices for OpenGL? Is there an emerging 'standard' library for this? Or is there some other hidden (to me) functionality in OpenGL/GLSL which I have overlooked?

sentences:
How can I get my first-person character in Unity to move to a ledge with an animation? I'm trying to get this to happen:
The character walks up to a large crate, the player presses a button, and an animation starts playing where the character climbs up on to the crate. (all in first person view).

So far I tried this with normal "First Person Controller" Prefab in Unity.

My code so far:

function OnTriggerStay(other : Collider){
    if(other.tag == "GrabZone"){
        if(Input.GetKeyDown("e")){
            animation.Play("JumpToLedge");
        }
    }
}

However when i use this on The FPC it will always play from the position the animation is created on.

I also tried to create an empty game object, placing the FPC in there. Gives same effect.

I also tried just animating the graphics of the FPC alone. This seems to work but since the Character Controller itself is not animated that stays onthe ground. So the whole FPC wont work anymore.

Is there anyway i could let this animation play on the local position the player is on at that time?

Or can you think of any other logical solution for a grab and climb?

sentences:
Understanding constant acceleration in terms of game physics simulation There are various integration methods that can be used for games. I am trying to write a simple physics engine deciding between semi-implicit Euler and Verlet variants.

What I don't understand is where most information says that they work well for constant acceleration. Say more than one force acts on a body, and acceleration is calculated using force/mass. Velocity and position are derived from this. This means that the acceleration is not constant surely?

Am I incorrect in my understanding that applying a force in one step, and a different force at another step, is variable acceleration? Is it simply that the error amount is small enough to be ignored. So semi-implicit Euler, with fixed time-step but variable acceleration, for example, will be a good approximation?

I'm very confused, I've read so many different things. I'd appreciate any insights. Thanks!

sentences:
3D line segment AABB collision, with hit normal? I'm embarrassed I can't find this, but I'm wanting to detect intersection with a 3D line segment (not an infinite ray) with a 3D AABB, the AABB being defined as two Vec3f's which represent the Min and Max extents.  So the AABB can be arbitrarily-sized.  I also need the surface normal of the AABB, if there was a hit.

From looking at similar algorithms I at least know it seems good to calculate the inverse direction of the line beforehand, at least, if you're needing to check against multiple AABBs per frame.

I have

struct AABB
{
    VEC3F min;
    VEC3F max;
};

// a and b representing start/end points of the line segment
// returns true if intersects, also fills out "normal" if true
bool LineIntersectsAABB(const VEC3F& a, const VEC3F& b,
    const VEC3F& inv_dir, const AABB& aabb,
    VEC3F* normal);

The implementations I've found either do not find the hit normal, and/or they're intended for boxes/cubes where the three dimensions of the box are always equal length, which doesn't work for me.  Implementations seem to vary greatly, which is confusing for me (since I'm still trying to learn it), and, considering that I need the hit normal, I'd imagine that that may rule out certain implementations.

sentences:
Interpolation Jitter I am trying to interpolate players in a multiplayer game like so:

var lastTime = now - (1000 / config.serverUpdateRate);
for (var i = 0; i < players.length; ++i) {
    tmpObj = players[i];
    var total = tmpObj.t2 - tmpObj.t1;
    var fraction = lastTime - tmpObj.t1;
    var ratio = fraction / total;
    tmpObj.x = UTILS.lerp(tmpObj.x1, tmpObj.x2, ratio);
    tmpObj.y = UTILS.lerp(tmpObj.y1, tmpObj.y2, ratio);
}

The server update rate is the frequency with which the server send the player positions. The x2 is the newest position and x1 is the position from the previous update.

Now this works fine on my localhost and on an empty server. But as soon as the game server has around 60 people on it, it begins to stutter. I am assuming that this is because the positions are coming in at an inconsistent rate. How can I adjust for that in my interpolation?

You can see the issue in action here: http://moomoo.io

I have tried to simply interpolate without lerping, but the movement felt too floaty. Also client prediction is not an option in this case

sentences:
Axis Aligned Bilboards in shader Hi I need to implement following effect using vertex shaders.
Basically its a shader for particle laser beam that rotates to particle along its own y axis till its "best" visible (Roughly).

My idea was:

Take  "y" axis of particle model (its a rectangle) and transform it
to view space ("vy").
Calculate the vector orthogonal to "vy" and eye vector ("w"), to get the
direction on the screen which "x" of partilce should be oriented.
Change particle vertices model coordinates using "w" instead of x.

sentences:
How to Enable canvas with Event during a animation clip I want to enable a canvas while an animation clip is playing, I used animation Event and call the following script to enable the canvas, but the editor does not recognize any game object.

How a canvas can be enabled?

public void SetActiveTrue(GameObject game_object)
{
    game_object.SetActive(true);
}

sentences:
How to load scene after a set delay? I have tried using IEnumerator and Invoke("method",delay_in_seconds).
My first scene is just an image with my studio name on it. I have script that will load the next scene ("Main Menu") 3 seconds after the first scene is loaded.
For this, I tried using IEnumerator and Invoke with 3 seconds delay before calling Application.LoadLevel.

However, on the device, game is launched, unity splash screen is displayed and "Main Menu" scene appears. it looks like the image scene loads while  unity splash screen is displayed and by the time unity screen is completed, the image scene has done executing.

Is there any way to ensure a scene stays on screen before loading the next scene? I could add a button that player should tap to start game. But I don't want to do that.

sentences:
How do I test for intersection of a ray and part of a capped cone / cone frustum? The formulas to calculate the intersection between a ray and a capped cone / cone frustum are already widely known (see http://lousodrome.net/blog/light/2017/01/03/intersection-of-a-ray-and-a-cone/ or How do I test for intersection between a ray and a cone?)
However, I have to test for the intersection between a ray and part of a capped cone.
That means instead of having a surface doing a full revolution, it's just one quarter of it, for example.

The aforementioned formulas can handle a capped cone, but they are not suitable to determine the "revolution intersection angle".
What would be the best way to solve this problem?

My idea is to first take the standard formula to intersect with the full cone and then use the parametric representation of the cone (see https://de.wikipedia.org/wiki/Kegel_(Geometrie)#Analytische_Beschreibung parametric representation is only on the German page), solve a linear equation system and then applying the inverse trigonometric functions to get the t parameter...
I'm also thinking about some inequality tricks or applying the tangent function, but had no luck so far...

sentences:
c++ opengl unproject not working first of all, sorry for the bad english.

I need to convert my mouse coordinates to world coordinates,
I'm trying to use the glm unproject method.
1280x720 is the size of the window, It's hard coded just for the test.
The View and Projection are my matrices, they're fine and are not related to the problem (or so I guess).

EDIT: Success. The solution is:

int x,y;
glfwGetMousePos(&x, &y);

GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);

y = viewport[3] - y;
float depth;
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);

mousePos = glm::unProject(vec3(x, y, depth), View, Projection, vec4(viewport[0], viewport[1], viewport[2], viewport[3]));

This method seem to have worked.

sentences:
Sprites: Are there any tools to scale sprites individually without using Photoshop/GIMP? I am using TexturePacker as tool to pack my 2D sprites, it is good but it doesn't provide the possibility to scale individual sprites to a specific scale.

I am wondering whether there is any good tool or command line to scale the files in the original folder without having to use TexturePacker.

What I am trying to do is to fix some scaling errors that the illustrator that produced the files did without having to re-scale/fix things using Photoshop that is more time expensive.

sentences:
How can I convert an image from raw data in Android without any munging? I have raw image data (may be .png, .jpg, ...) and I want it converted in Android without changing its pixel depth (bpp). In particular, when I load a grayscale (8 bpp) image that I want to use as alpha (glTexImage() with GL_ALPHA), it converts it to 16 bpp (presumably 5_6_5).

While I do have a plan B (actually, I'm probably on plan 'E' by now, this is really becoming annoying) I would really like to discover an easy way to do this using what is readily available in the API.

So far, I'm using BitmapFactory.decodeByteArray().

While I'm at it. I'm doing this from a native environment via JNI (passing the buffer in from C, and a new buffer back to C from Java). Any portable solution in C/C++ would be preferable, but I don't want to introduce anything that might break in future versions of Android, etc.

sentences:
Coding different states in Adventure Games I'm planning out an adventure game, and can't figure out what's the right way to implement the behaviour of a level depending on state of story progression.

My single-player game features a huge world where the player has to interact with people in a town at various points in the game. However, depending on story progression, different things would be presented to the player, for e.g. the Guild Leader will change locations from the town square to various locations around the city; Doors would only unlock at certain times of the day after finishing a particular routine; Different cut-screen/trigger events happen only after a particular milestone has been reached.

I naively thought of using a switch{} statement initially to decide what the NPC should say or which he could be found at, and making quest objectives interact-able only after checking a global game_state variable's condition. But I realised I would quickly run into a lot of different game states and switch-cases in order to change the behaviour of an object. That switch statement would also be massively hard to debug, and I guess it might also be hard to use in a level editor.

So I thought, instead of having a single object with multiple states, maybe I should have multiple instances of the same object, with a single state. That way, if I use something like a level editor, I can put an instance of the NPC at all the different locations he could ever appear at, and also an instance for each conversation state he has. But that means there'll be a lot of inactive, invisible game objects floating around the level, which might be trouble for memory, or simply hard to see in a level editor, i don't know.

Or simply, make an identical, but separate level for each game state. This feels the cleanest and bug-free way to do things, but it feels like massive manual work making sure each version of the level is really identical to each other.

All my methods feel so inefficient, so to recap my question, is there a better or standardised way to implement behaviour of a level depending on state of story progression?

PS: I don't have a level editor yet - thinking of using something like JME SDK or making my own.

sentences:
How can I get Unity to tell me the battery status of my OS X laptop? How do I get battery status on an OS X laptop in Unity?

This is un-Googlable: I keep finding either mobile stuff (iOS or Android) or people complaining about laptop battery life.

sentences:
Slick2D: constructor vs. init method What is the difference between the constructor of a BasicGameState and the init method?  It appears that they are both called at the same time when the BasicGameState is registered in StateBasedGame, so what makes them different?

A follow up question to this is how do I run a method only when a state becomes active?  Initially I thought the init method was only called when a new state becomes active, but this is not true.  Note that I'd like to call this method only once at the beginning of the new state, so putting it in the update method seems like the wrong place.

sentences:
Render Queue Sorting, HOW? Recently I'm trying to implement a render queue sorting system, i.e., ordering my renderable objects in an array in such a way that the overhead of OpenGL state changes are minumum. After some googling, the most ideal one (to me) is to generate an integer key value for each renderable object, and the sorting is based on that value. Once done sorting, objects that have similar rendering states (same shader, texture, distance, etc.) will be close to each other, so we can just loop through the object array and submit the draw calls for rendering.

Here's a detailed explanation: Order your graphics draw calls around!

My problem is, how do I loop through the renderable object's array to submit their draw calls for actual rendering? Do I need to keep track of the current OpenGL states manually?

What have come to my mind is:

(for each renderable object)
{
    if(objects[i].getShader() != m_currentShader)
    {
        m_currentShader = objects[i].getShader();
        m_currentShader.bind();
    }

    if(objects[i].getTexture() != m_currentTexture)
    {
        m_currentTexture = objects[i].getTexture();
        m_currentTexture.bind();
    }

    // ... and so on

    object[i].getMesh().draw();
}

Seems not so performance-friendly to me, but I can't find any further explanation on how to submit the actual draw calls form the object's array either on the article I've provided or other sites I can find. Perhaps there's something I have missed?

sentences: rigidbody cube falls off the ground Inspite  my ground and cube contains colliders as i apply rigidbody it falls down....use gravity

sentences:
A*Pathfinding lose target after spawning from script? I have been using A*Path finding to enable object tracking. It works fine if I have both objects on the scene at the same time.

However, if I were to use a script to spawn the seeking object instead, it will only track the first path to the object and not repath again.

I am using the default AI Follow script and a prefab variable as the object to be tracked (which is an empty child game object to a moving character).

Code :

import Pathfinding;

//var tankTurret : Transform;
var tankBody : Transform;
//var tankCompass: Transform;
var turnSpeed : float = 10.0;

var targetPosition : Vector3;
var seeker : Seeker;
var controller : CharacterController;
var path : Path;
var speed : float = 100;
var nextWaypointDistance : float = 3.0;
private var currentWaypoint : int = 0;

function Start()
{
    //targetPosition = GameObject.FindWithTag("GTO").transform.position;
    GetNewPath();
}

function GetNewPath()
{
    Debug.Log("GETTING NEW PATH!");
    seeker.StartPath(transform.position,targetPosition,OnPathComplete);
}

function OnPathComplete(newPath : Path)
{
    if(!GetNewPath.error)
    {
        path = newPath;
        currentWaypoint = 0;
    }
}
function FixedUpdate()
{
    if(path==null)
    {
        return;
//          Debug.Log("NO PATH!?");
    }
    /*if(currentWaypoint >= path.vectorPath.Length)
    {
        return;
    }*/

    var dir : Vector3 = (path.vectorPath[currentWaypoint]-transform.position).normalized;

    controller.SimpleMove(dir);

    //tankCompass.LookAt(path.vectorPath[currentWaypoint]);
    //tankBody.rotation = Quaternion.Lerp(tankBody.rotation, tankCompass.rotation, Time.deltaTime*turnSpeed);

    if(Vector3.Distance (transform.position,path.vectorPath[currentWaypoint]) < nextWaypointDistance)
    {
        currentWaypoint++;
    }

}

Any help will be greatly appreciated.

sentences:
XMMATRIX performance Dears,
I am facing a performance problem when I try to access cell 42 and 43 in XMMATRIX define in DirectXMath.h. The frames dropped by 100 FPS.

Here is my code:

for (int index = 0; index < m_CopyOfCascadeConfig.m_nCascadeLevels; ++index)
    {
        XMMATRIX mShadowTexture = m_matShadowProj[index] * dxmatTextureScale * dxmatTextureTranslation;

        XMStoreFloat4x4(&mShadowTextureFlt, mShadowTexture);

        // This is the line that cause the performance drop
        pcbAllShadowConstants->m_vCascadeOffset[index] =
            XMVectorSet(mShadowTextureFlt._41, mShadowTextureFlt._42, mShadowTextureFlt._43, 0.0);
}

I also tried to use the folowing but no hope:

pcbAllShadowConstants->m_vCascadeOffset[index] = mShadowTexture.r[3];

Any suggestes will be appreciated.

sentences: How do I combine two HTML levels? If I have two levels that I have made separate in HTML5 how may I combine them so one comes after another?.

sentences:
How to compare different states of my game? (rpg) I'm working on a rpg, the battle system. I want to compare different scenario with each other.

For example, what if I play move A then move B ? or two times move A ? or ...?

I'm using a tree-structure to generate all possible scenario that can happen during the battle. There is no movement involved, I'm using a battle-system as in FF7, only skill choice matters. 4vs4 units

Trick is, the battle is turn based but not static. There is an Action Point bar for each unit (filling at different speed based on the unit's stats) and the unit with the most Ap (only if > 100) can play. If no unit is > 100, a "turn" will happend and all unit will gain some AP based on their speed. If no unit can play, a new turn will happen...until a unit is > 100 ap.

Each skills takes a different amount a AP to use. At turns 0 for example, we may have a unit with 140 AP that will play two times in a row for 2 actions of 20 AP each. Then other units at 100 AP may play.

It means that when I'm running a simulation of all possible outcome of a battle for my AI, I will have states (node in the tree), that will have a number a turns very different from other and from nodes at the same depth.

I dont know how to compare these nodes at all.

I was using Hp at first, but it is not enought. To prove it, consider the example: 1 vs 1 match. Unit A (opponent of AI) has only 1 move, a small attack that requieres 20 ap. Unit B (AI) has two moves : a small attack that takes 40 ap (and overall hit for very low damage compared to the opponent attack) and a second move that does nothing but consume 20 ap and that move can only be used during the 1st turn.

I will then have to compare two states :

•State 1 : AI use its attack . Opponent his attack. Units are at 60/80 ap respectively. 20 game turns passes and they are now at 80/100 ap. Opponent use his attack. 20 game turs passes and they are at 100/100 again and we are at turn 40.

•State 2 : AI use his move that does nothing. Opponent his attack. Units are at 80/80 ap. 20 games turns passes, they are now at 100/100 and we are at turns 20.

If I compare only HP, In state 1, AI will have an overall score a lower than in state 2 since it got attacked twice in state 1 and 1 times only in state 2.

If I only compare by Hp difference between AI & its opponenent, I would choose state 2 since AI lost less Hp than in state 1.

Running the simulation after state 1 and 2 will continue to show the same difference since after that point, both unit can only use one attack.

In the end, it makes my AI choose a stupid move because she thinks she is less likely to loose selecting it. Granted both move will eventually result in the defeat of the AI since its main attack is weak but I'd like my AI to nonetheless select as its first move, her attack skill and not a skill that does nothing.

I've tried weithing the overall gradient of score between the root state and the state I'm simulating by the number of turns but it does not work in all cases (it greatly depends on the number of turns and the difference between the root).

I was thinking of adding Ap ratio to my evaluation of states but in that example, we can see that in State 1 & 2, units are at the same AP anyway so it doesnt provide extra informations.

Anyone got ideas on how to compares my states from different turns ?

sentences:
coloring box2d body in LibGDX I want to color polygon of box2d in LibGDX. Found below useful class for that.

http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html

But, it is not coloring the body instead making colored shapes. I want colored bodies having all the property like gravity, restitution etc. In brief, I want to make colored ball and surface.And i don't want to attach sprite on bodies. Want just fill color in bodies.

Need some guidance????

sentences:
Transparency problem, phong model It's the first time I'm trying to implement the Phong lighting model. I'm pretty sure everything is working fine.

I was experimenting using different materials, meaning I played with Kd,Ks,Ka and Ns values when I came across this problem.

Whenever I use a material with alpha value less than one I get this weird result :

At first I thought it has to do with the normals of the model since they are all supposed to point away from the model but it doesn't seem to be the case.

Any ideas?

sentences:
How can I run and jump at the same time? I'm having some trouble with the game I started.
http://testing.fyrastudio.com/lab/tweetOlympics/v0.002/
The thing is that i have an athlete running and he must jump at the same time. A race with obstacles.

I have him running (with pressing the letter Q repeateadly). I also have him jumping (with letter P)
But the thing is that when he runs and jumps at the same time, he seems to be jumping at the same place, instead of going forward with the jump... any ideas how can I fix this??

This is the code I'm using for running and jumping on a continuos loop.

//if accelearing and the last time that he accelerated was less than X seconds ago, hes running an accelaring
     if (athlete.accelerating && timeCurrent - athlete.last_acceleration > athlete.delay_acceleration) {
      athlete.accelerating = false;
      athlete.last_acceleration = timeCurrent;
      athlete.running = true;
     }
     if (!athlete.accelerating && timeCurrent - athlete.last_acceleration > athlete.delay_acceleration) {
      athlete.decelerating = true;
     }
     if(athlete.decelerating && timeCurrent - athlete.last_deceleration > athlete.delay_deceleration){
      if(athlete.speed >= 1){
       //athlete starts to decelarate
       athlete.last_deceleration = timeCurrent;
       athlete.decelerate();
      }else {
       athlete.running = false;
      }
     }
     if (athlete.running) {
      athlete.position += athlete.speed;
     }
     if (athlete.jumping) {
      if (athlete.jump_height < 1) {
       athlete.jump_height = 1;
      }else {
       if (athlete.jump_height >= athlete.jump_max_height) {
            athlete.jump_height = athlete.jump_max_height;
            athlete.jumping = false;
       }else {
            athlete.jump_height = athlete.jump_height * athlete.jump_speed;
       }
      }

     }
     if (!athlete.jumping) {

      if(athlete.jump_height > 1){
       athlete.jump_height = athlete.jump_height * 0.9;
      }else {
       athlete.jump_height = 1;
      }
     }

     athlete.scaleX = athlete.scaleY = athlete.jump_height;
     athlete.x = athlete.position;

Thanks!

sentences: How can I play a video in a Godot game? I'd like to know if and how it is possible for me to play a video in my Godot game. Specifically I'd like to know what video file format I need to use and what code I have to write to play that video back fullscreen.

sentences:
Unable to wire UI Text object to C# Script I have created UI text object

And then created Text field in behavior class:
using UnityEngine.UI;

public class Explorer : MonoBehaviour
{
    public Material mat;
    public Text text;

...

void FixedUpdate () {
    ...
    text.text = string.Format("x {0}", scale);

If I just run it, it says
Object reference not set to an instance of an object

at runtime.
If I try to drag ZoomText to Text slot, it doesn't allow me:

If I first drag ZoomText from Hierarchy to Project

then it allows me to set Text slot, but still gives
Object reference not set to an instance of an object

at runtime.
If I am trying to set text field by Find
private void Start()
{
    text = (Text) GameObject.Find("ZoomText");
}

it gives me
Cannot convert type 'UnityEngine.GameObject' to 'UnityEngine.UI.Text'

What I am doing wrong? Suspect may be incorrect types, but how to know correct ones?

sentences:
Why isn't particle hair more popular in games? Blender 2.80 introduced EEVEE, a new realtime renderer, and after interacting with it for a while I was impressed by how well it handles particle hair in terms of performance and visuals. It even manages to reflect light through SSR.

Sphere with 200 parent hair particles, 50 child particles per parent

Blender isn't a game and they probably have different concerns and priorities regarding the performance of the application, so this might be a good reason not to see this being implemented in games right now but still, seeing how well EEVEE manages it and also knowing that games have user-customizable graphic settings, I don't understand why we're still using planes with textures and other techniques like that as our best effort for realtime graphics in games.

Of course having one million strands makes even Blender struggle to keep a reasonable framerate, but a game probably wouldn't need such a dense hair to look convincing and could cheat by having baked hair textures on the scalp in case gaps become visible close-up.

A friend of mine has said Nvidia HairWorks accomplishes just this, but looking at some screenshots I doubt that's the case (if it is, then maybe the technology has evolved a lot lately and nvidia has some catch up to do? I don't know but from what I've seen it doesn't look that good).

So, why isn't particle hair more popular in games?

sentences:
translation and rotating at the same time and waiting before animation? I am having difficulties here. I want to move my character with the buttons and I want the character to rotate wherever he is going.

Also I want to play an animation when there is no keys pressed. I am able to do that but I want the animation to play after 10 seconds of no key being pressed, and only once. Than after a movement that resets and again after 10 seconds of no key the animation plays. (The animation works but it happens right after I stop pressing a key and continuously.)

IEnumerator Test()
{
    yield return new WaitForSeconds(10.0f);
}

void Update()
{
    if (Input.GetKey(KeyCode.W))
    {
        counter += Time.deltaTime;
        transform.Translate((Vector3.forward) * moveSpeed * Time.deltaTime);
        Debug.Log("Pressing W key");
    }
    if (Input.GetKey(KeyCode.S))
    {
        counter += Time.deltaTime;
        transform.Translate((Vector3.back) * moveSpeed * Time.deltaTime);
        Debug.Log("Pressing s key");
    }
    if (Input.GetKey(KeyCode.A))
    {
        counter += Time.deltaTime;
        transform.Rotate(Vector3.down * rotateSpeed);
        Debug.Log("Pressing a key");
    }
    if (Input.GetKey(KeyCode.D))
    {
        counter += Time.deltaTime;
        transform.Rotate(Vector3.up * rotateSpeed);
        Debug.Log("pressed D");
    }
    if (!Input.GetMouseButton(1))
    {
        moveSpeed = 20;
    }

    if (!Input.anyKey)
    {
        if (counter >= 2)
        {
            StartCoroutine(Test());
            anim.Play("Animation");
            counter = 0;
            Debug.Log("A key or mouse click has been detected");
        }
    }
}

sentences: How to handle gun position while running and aiming in an FPS In an FPS, when a character runs, from the view of another character, the gun moves, and similarly when the character aims down sight.  Are the views from the third person and from the first person actually showing the same gun position?  I feel like it would be tricky to that happen and have it look natural from both perspectives.

sentences:
Character appearance synchronization in open world multiplayer game I am working on a multiplayer open world game where you can equip handhelds and armor pieces. In my architecture, there are clients and an authoritative server. Every equipable item is crafted by a user. They can be different in shape, so it's important that I synchronize shape information. This is expensive data to send (basically an outline plus some more info). Together with this, I also want to synchronize any equipment event that occurs, so when a user meets another user, they can see each other's gear.

The easiest solution I've found is to force-send gear on equipment, but it will use bandwidth even when two players are far away.

This feels like a problem that has been solved a thousand times, so I don't want to reinvent the wheel. Do you know of any best practice/known strategy that suits my situation?

sentences:
Blending issue with framebuffer I'm trying to get some particles to work properly - they should blend among themselves but not with the background color. For this I'm using additive blending, textures with premultipled alpha and set the color as (r*a, g*a, b*a, 0) on textures I want to add up.
I'm using the blend mode: glBlendFunc(GL11.GL_ONE, GL_ONE_MINUS_SRC_ALPHA); for everything.

I found out that what I want to do can be achieved by rendering and additively blending the particles in a framebuffer and then render that framebuffer on top of the background with standard alpha blending. In theory I think this should work..however i'm still getting the same result as I did before which is very bright particles at bright areas of the background.

So what I'm doing is simply:
1)Render the background as usual with color (r*a,g*a,b*a,a)

2)Bind my fbo

3)Use GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glClearColor(0f, 0f, 0f, 0.0f);

4)Render all the particles with color as (r*a,g*a,b*a,0)

5)Unbind the fbo and render it on top of the bg with (1,1,1,1) color.

Why doesn't this work?

sentences:
How can I make sprites from multiple images using SDL2? Using SDL2 in C++ I can load textures with out problem however, I have sprites that are from about 15 different png's that I was hoping I could load them all up and for loop through them. However, when I try this it looks like the image is still .

I am hoping that I wouldn’t have to photo shop them into one image and shift/pan through that considering I have about 3K of images to go through.

can some one provide an example of how this could be done cleanly?

I have been working on this for a while for a bit and yes, this is probably a coding mistake as I am learning C++ still and know that for me to learn is to take up a project.

int main ( int argc, char *argv[] )
{

    SDL_Init(SDL_INIT_EVERYTHING);
    Window = SDL_CreateWindow("NEW WINDOW",100,100,300,300,SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
    renderer = SDL_CreateRenderer(Window,-1,SDL_RENDERER_ACCELERATED);

    if (Window == NULL)
    {
        std::cout << "Window Couldn't be Created!\n";
    }

    struct imagebatch
    {
        const char *image;
    };

    imagebatch foto;

    //  A for loop is needed here to loop through Healer0.png Healer1.png to Healer15.png
    foto.image = "DData/towners/healer/healer/Healer0.png";
    HealerTexture = IMG_LoadTexture(renderer,foto.image);

    //loads an image;
    //HealerTexture = IMG_LoadTexture(renderer,"DData/towners/healer/healer/Healer0.png");

    //defines the rect of this image;
    SDL_Rect HealerRect;
    HealerRect.x = 0;
    HealerRect.y = 0;
    HealerRect.w = 90;
    HealerRect.h = 90;

    while (!quit)
    {
        while( SDL_PollEvent( &event ) != 0 )
        {
            //User requests quit
            if( event.type == SDL_QUIT )
            {
                quit = true;
            }
        }
        SDL_RenderClear(renderer);

        //Blit everything here.
        SDL_RenderCopy(renderer,HealerTexture,NULL,&HealerRect);

        SDL_RenderPresent(renderer);
    }
    close();

    return 0;
}

Full code is here: http://pastebin.com/H5fD6cfX

sentences:
How to deal with "Scrooge McDucks" in my fixed-currency-amount game? I'm currently working on a very small scale MMO game planned to support approximately hundred players per server, but we're having trouble with our economical model.

For various reasons we have decided to go with a fixed-currency-amount system; meaning that there is only a certain amount of "gold" that can ever exist in the game at the same time. In this early play-testing version (9 players) that amount is 9000 gold but we are planing to have around 1 million gold per server (100 players).

A brief example how this system works:

At a certain point in time this is how the gold amounts may look in the game.

| Max Gold | Bank | Shopkeeper | Player A | Player B |
| 100      | 90   | 0          | 5        | 5        |

Player A sells 2 gold worth of loot to the Shopkeeper.
The Shopkeeper has 0 gold and so he "borrows" 2 gold from the bank (only NPCs can).
Player A sells 3 gold worth of loot to Player B.
Player B pays from their wallet.
Player A buys a sword for 5 gold from the Shopkeeper.
Player A pays from their wallet.
Now we have:

| Max Gold | Bank | Shopkeeper | Player A | Player B |
| 100      | 88   | 5          | 5        | 2        |

Repeat the above loot-and-sell step a few times and you may end up here:

| Max Gold | Bank | Shopkeeper | Player A | Player B |
| 100      | 0    | 27         | 59       | 14       |

Player A tries to sell a 30-gold item to the shopkeeper, but cannot because the Shopkeeper only has 27 gold and cannot borrow from the (now empty) bank.
Player A have to lower their selling price, trade wares in return, or wait until the Shopkeeper gains money in other ways.

This system is working fine – for the most part. Recently one of our testers did something that completely broke our system; they sold, traded, and haggled their way into owning about 60% of the total currency amount available in the game then refused to use it (becoming the RPG equivalent of Scrooge McDuck). This caused a big problem because suddenly approximately 5500 gold out of our 9000 total was unusable.

Of course in the release of the game one player owning 60% of all money is unlikely, but 60 players each owning 1% of all money can cause the same effect. We have considered deleting old characters and returning their money to the "bank" but decided against it since if a player comes back and his character is deleted I would imagine they would be quite sad (especially if it was super rich!).

So on to the actual question; how can we avoid this happening and how can we limit the damages caused by this?

sentences:
Vector field collision avoidance I'm developing a simple "Geometry Wars" like game: 2D world and multiple enemy spaceships. The enemies should be able to pursue the player and avoid collisions between them at the same time. I've implemented a vector field algorithm based on this one. When two ships are too near between them, a force that slightly modifies the direction of the ship is created.

This works like a charm, the enemies pursue the player and no collision exits, but this happens sometimes:

This is because in one frame they "collide" and the path is modified, but, in the next frame they are not colliding and the path is not altered. This two states in loop cause that shaking.

Do you have any idea to solve this?

PS: if I didn't make myself clear, please ask me, english is not my first language

sentences:
Alternative in-game dev console implementations I'm developing a dev console for my game. Currently I have a simple parser which is basically a regex which accepts words with dashes and dots (ie. list, 1.0, list -i) or simplistic arrays and maps (ie. [1,2,3], [x:1.0, y:2.0]). I plan on making an AST parser later on but for now this works well enough.

When these tokens get parsed first token in parsed line is the command token which is used to invoke a registered command. Commands are classes which implement a ConsoleCommand interface which looks like this (basic command pattern):

interface ConsoleCommand {
    val description: String
    val instructions: String
    fun execute(args: Array<Any>): String
}

This works, but I'm not quite satisfied since to actually register any console commands I must do so where I can access the entity. For example if I want to register the player as an interactable console command I must do so either in a custom system only created for the specific console command, or add console specific code into existing systems, basically polluting my codebase with console specific code.

My question here is what are alternative dev console implementations? Is there a way to implement a console which wouldn't affect the rest of the codebase?

I have an inkling of an idea where the console could be some sort of an observer and it itself would register onto entities and stuff, but I don't see a way of implementing that without having the entities implement some sort of special observable interface so that they can actually be observed, as well as the fact that observers usually don't manipulate the entities themselves....

sentences:
Unreal Engine: Third person example project and multiplayer I was fiddling around with multiplayer stuff in Unreal Engine. I looked into events that run only on server, multicasting events, replication of variables...

But there is something that I dont quite understand: When I load the Third Person example proyect, and enable more than one player, I can see the position and movements of the players being replicated on all clients.

While I understand that the position and the rotation of the players being replicated successfully (since the replication option is enabled in the pawn's blueprint option), I don't really understand why the animations are being replicated. I don't see any reference in the blueprint making animations replicated over the network.

Are pawn animations implicitly replicated on clients when replicating the actor's position? Am I missing some option/configuration I'm missing?

sentences:
How do I calculate a vertex's position on the CPU? I'm creating light processor and I need light position and vertex position after translating, rotating and scaling (to calculate distance between them to check if light is affecting my vertex somehow).

But my question is how to properly multiply my position in Vector3 with transformation matrix to get real vertex position in the world?

To calculate it in GLSL I just simply use something like this:

vec4 vertexInWorldPosition = transformMatrix * vec4(vertexPosition,1.0);

But how properly do that with my vertex (Stored in Vector3) and Matrix4 in C++ code? Do I need to multiply each row or column by my original vertexPosition stored to Vector4? I have no idea what to do.

sentences:
Unexpected Behavior - Calling method on MonoBehaviour before Start() is called I'm implementing object-pooling, though that's not the issue, and a bit confused about the order of operations between Monobehaviours. In the InitGame() method of MyGameManager, I call SpawnEnemy() on the EnemyManager singleton. What I would expect to happen (but is not happening) is for the Awake() method in EnemyManager to be called, then the EnemyManager-> Start() method, and then and only then, would SpawnEnemy() be called.
What actually happens is that EnemyManager Awake() is called, then MyGameManager calls SpawnEnemy(), and when that's done, EnemyManager's Start() method is called last.

The docs say,

  Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.

I'm guessing that while my EnemyManager is Active, it is not Enabled, and thus it's Start() method is not called until after the call to SpawnEnemy(). I found it surprising that a method can be called on an object before Start() is called on that object.

I can work around this situation by simply including the line gameObject.SetActive(false); in my EnemyManager's Awake() method, and thus the SpawnEnemy() method will find and spawn an object from the pool, but it would be helpful to have a deeper understanding of when Start() is actually called. I've read the docs and whatever I could find, but don't feel like I fully understand.

Here is the Manager Singleton designed to easily create XxxxManager classes:

using UnityEngine;

public class Manager<T> : MonoBehaviour where T : MonoBehaviour
{
    private static T _sharedInstance = null;

    public static T sharedInstance
    {
        get
        {
            if (_sharedInstance == null)
            {
                _sharedInstance = Object.FindObjectOfType<T>();
                if (_sharedInstance == null)
                {
                    Debug.Log("Can't find " + typeof(T));
                }
            }
            return _sharedInstance;
        }
    }

    public virtual void Awake()
    {
        // ...
    }
 }

An EnemyManager class:

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

public class EnemyManager : Manager<EnemyManager>
{
    static private List<EnemyManager> enemyControllers;

    public EnemyManager SpawnEnemy(Vector3 location)
    {

        foreach (EnemyManager controller in enemyControllers)
        {
            if (controller.gameObject.activeSelf == false)
            {
                controller.gameObject.transform.position = location;

                // object available
                controller.gameObject.SetActive(true);
                return controller;
            }
        }

        Debug.Log("Not enough enemies available in pool.");
        return null;
    }

    public override void Awake()
    {
        if (enemyControllers == null)
        {
            enemyControllers = new List<EnemyManager>();
        }

        enemyControllers.Add(this);

        // If we SetActive(false) here, we DO get the desired behavior
        gameObject.SetActive(false); // <-----

        base.Awake();
    }

    protected void Start()
    {
        // wake up and disable self
        // If we SetActive(false) here, we do NOT get the desired behavior
        gameObject.SetActive(false);  // <-----
    }
}

And I'm using these classes in MyGameManager:

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

public class MyGameManager : Manager<MyGameManager> {

    private EnemyManager enemyManager;

    public override void Awake()
    {
        enemyManager = EnemyManager.sharedInstance;
        base.Awake();
    }

    private void Start()
    {
        InitGame();
    }

    void InitGame()
    {
        enemyManager.SpawnEnemy(new Vector3(0, 0, 0));
    }
}

sentences:
How can I measure the weight in Farseer? I have two different objects(star and rectangle) and I want to measure the entire weight that lies on the balance. How can I do that? Is it possible to know the entire weight that presses on the balance?

The rectangle is lying on the star, it is not possible to lie the rectangle on the balance.
You can see the balance in this picture:

sentences: Finding enemy object in player's forward direction within a range I would like to know the way by which I can find enemy objects tagged with "player" in a forward direction within a range say 3 units from the player.

sentences:
DX11: Alpha blending not working with textured quads A bit novice on directx11.
I am rendering some textured quads out of PNG files (with alpha transparency) and get some inconsistency with my alpha blending. I have a background changing color constantly and you can see transparency is there , since in the transparent bits of the texture you can see the background colour below.

However , when it comes to having one texture on top of another it seems to skip the one below and use the background colour instead!

I can provide some code but I don't exactly know where to problem might sprawl from yet.

Any ideas?
Thanks!

sentences:
How to detect collision only in non-transparent texture? I am developing a game using libGDX. I am trying to detect the collision between bee and tube. I am using the following code to detect the collision.

if(player.getBounds().overlaps(boundsBot)){

}

player is a bee and boundsBot is Rectangle of tube. Since there is some transparency in bee image, this returns true even if it doesn't seem to collide. I understand the reason why this is returning true.

I read this solutions. I understood the theoretical concept to the solve the problem but I couldn't achieve it using libGDX.

Here is what I tried,

if(Intersector.intersectRectangles(player.getBounds(), boundsBot, rectangle)) {
    //Gets the intersected rectangle
    System.out.println("Rectangle Bottom: " + rectangle);

    //Converting texture to pixmap
    Texture texture = player.getTexture().getTexture();
    if (!texture.getTextureData().isPrepared()) {
        texture.getTextureData().prepare();
    }
    Pixmap pixmap = texture.getTextureData().consumePixmap();

    //Trying to find transparency.....
    System.out.println("Format: "  + pixmap.getGLFormat());
}

How can I solve this issue?

Thank You!

sentences:
How to build a hidden 3D snapping grid effect? Looking to build a 3D grid similar to the image below taken from Google Blocks.

Seems like it consists of these main components:

A set of spheres that can go transparent.
A stencil that follows the controller's location.
When stencil overlaps with spheres, they show up, otherwise, alpha fades to zero.

Any advise on how to approach building this?

sentences:
How do I test if an AABB and concave polygon intersect? The player's collider is an axis-aligned bounding box in my 2D platformer, but the environment can be different shapes. I already have collision-detection that prevents the player from going through colliders, but I don't have anything for getting the player out of concave polygons if he ends up inside one by for example flipping the collider when changing direction from/to left/right.

SAT doesn't work on concave polygons, so I need an algorithm that can tell me if an AABB and any polygon intersects and give me the minimum translation vector to push the shapes apart. (The velocity of the objects will not need to be considered).

BTW the game is written in C# with the MonoGame framework if that's of any relevance.

sentences:
How To Destroy/Deactivate one enemy without affecting other enemies of the same type? In my game, you jump on zombies'heads to squash them.

Currently I'm only able to have one zombie in my game. When I add another (duplicate or drag from prefab), then run the game, I can squash one enemy but when I try to jump on the second zombie's head it says "Coroutine couldn't be started because the game object "Zombie (1)" is inactive".

Here's the player's stompbox script code & below that the ZombieController script code:

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

public class StompEnemy : MonoBehaviour {

    private Rigidbody2D playerRigidbody;
    public ZombieController zombieController;

    public float bounceForce;
    // a bounce force of 12 is wonderful (set in unity's inspector)

    // Use this for initialization
    void Start () {
        playerRigidbody = transform.parent.GetComponent<Rigidbody2D>();
        zombieController = FindObjectOfType<ZombieController>();
    }

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

    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if(other.tag == "Zombie")
        {
            zombieController.Stomped();
            playerRigidbody.velocity = new Vector2(playerRigidbody.velocity.x, bounceForce);
        }
    }

}

Now here's the ZombieController script code:

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

public class ZombieController : MonoBehaviour {

    Animator zombieAnimator;
    Rigidbody2D myRigidBody;
    [SerializeField] float moveSpeed = 1f;

    public bool isAlive = true;

    // Use this for initialization
    void Start () {
        zombieAnimator = GetComponent<Animator>();
        myRigidBody = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void Update () {
        if (!isAlive) { return; }
        if (isFacingRight())
        {
            myRigidBody.velocity = new Vector2(moveSpeed, 0f);
        }
        else
        {
            myRigidBody.velocity = new Vector2(-moveSpeed, 0f);
        }
    }

    bool isFacingRight()
    {
        return transform.localScale.x > 0;
        // if it's positive he's facing right, and if negative, facing left.
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        transform.localScale = new Vector2(-(Mathf.Sign(myRigidBody.velocity.x)), 1f);
    }

    public void Stomped()
    {
        isAlive = false;
        transform.localScale = new Vector2(-(Mathf.Sign(myRigidBody.velocity.x)), 1f);
        zombieAnimator.SetBool("Squash", true);
        if (isFacingRight())
        {
            myRigidBody.velocity = new Vector2(Mathf.Epsilon, 0f);
        }
        else if (!isFacingRight())
        {
            myRigidBody.velocity = new Vector2(-Mathf.Epsilon, 0f);
        }
        gameObject.layer = 11;
        StartCoroutine(WaitXSecond());
    }

    public IEnumerator WaitXSecond()
    {
        yield return new WaitForSeconds(2f);
        gameObject.SetActive(false);
        zombieAnimator.SetBool("Squash", false);
    }

}

How do I implement multiple zombies using the same script attached to each one?

When I've tried having three zombies I'd jump on the first one's head and another zombie would die (show the squashed animation, then disappear after two seconds) and the remaining zombies would no longer be jump-on-head-able, displaying the coroutine error above.

sentences:
Unity-How can I enlarge the sprite to avoid the movement of the character when the pivot change? Changing the pivot to custom on all of the sprites is not a viable option for me
Video showing the problem:
https://youtu.be/YpAdamkbhFA

sentences:
Unity 5.6.0f3 Inspector Tooltips are off in macOS, is me or everyone the same? Running latest version (5.6.0f3) in macOS, my tooltips are always misalign to the left of my screen, is me or anyone else also experience the same? And, it is still misalign even after I reset the layout setting to factory default.

Here are the screenshots http://imgur.com/a/dR0Pv

Update: Filed a bug report.

sentences:
Get Text dimmensions on CCTextFieldTTF Hi I want to know the width of the text inside the CCTextFieldTTF but I can't find a way to do it, I want this width so I can move a CCLabelTTF in that position so it can be like a cursor for the CCTextFieldTTF

Thanks

sentences:
Why is Unity UI Image color not being animated? Animation is changing the color of an UI Image but the color only changes only in the inspector but not Game/Scene view.

In this video I demonstrate the problem clearly.

sentences:
Starting Couroutine in newly activated gameObject I'm working on a UI system that animates an element's properties using coroutines. Every element that should be animated has a component called AnimatedUIElement which provides the function Enter().
The function Enter() is basically starting coroutines depending on the chosen animation settings, but only after calling Enable(), which sets the gameObject active with gameObject.SetActive(true);, updates its component references and makes the element interactable.
AnimatedUIElement also defines an Exit() function acting similar, but disabling the element after the animation.

public class AnimatedUIElement : MonoBehaviour {
    private CanvasGroup canvasGroup;
    // ...

    public void Enter() {
        // ...
        TriggerEntry();
    }

    private void TriggerEntry() {
        PlayChildrenEntry(); // Calls Enter() on all animated Children
        Enable();
        StartCoroutine(SomeAnimation(...));
    }

    private void Enable() {
        gameObject.SetActive(true);
        Init();
        canvasGroup.interactable = true;
        canvasGroup.blocksRaycasts = true;
    }

    private void Init() {
        canvasGroup = GetComponent<CanvasGroup>();
        // ...
    }

    private IEnumerator SomeAnimation(...) { ... }

    public void Exit() {
        // Similar to Enter, but disabling the element
    }
}

Now I want to open the options panel by clicking a button in the game's UI. The panel is inactive (unticked) in the beginning, while the AnimatedUIElement component is enabled.

UI Hierarchy: Options Button calls Enter() on Options Panel.

The desired setup in the Button Component calling OptionsPanel.Enter() and MainPanel.Exit()

But clicking the button throws the following exception:

Coroutine couldn't be started because the the game object 'Main Menu Button' is inactive!
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AnimatedUIElement:AnimatePosition(Vector2, Vector2, Single, AnimationCurve) (at Assets/Animated UI Elements/AnimatedUIElement.cs:265)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:93)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
AnimatedUIElement:PlayChildrenEntry(Transform) (at Assets/Animated UI Elements/AnimatedUIElement.cs:219)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:79)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
UnityEngine.EventSystems.EventSystem:Update()

In this stack trace you can see that the Options Panel did not start coroutines as no animation was defined in its component, but called Enter() on its children, which are animated.

Using debug logs I found out that, while Init() is called immediately after Enter(), Awake() is called after the coroutines (which happen later in the program flow) throw errors. This makes it seem like the object is not available instantly after calling setActive(true).

Is there an explanation and possibly a fix for this behavior?

sentences:
How to rotate a 3D instance using an HLSL shader I'm experimenting a little with HLSL shaders. I have the following code for a vertex shader, it is used to render a few instances of a 3D model. Let's say I want to rotate these instances on their Y axis, and I want to do it inside the shader, is it possible? I cannot find any documentation about this.

Here it is my code:

UPDATE: I modified the code so that now the shader receives a rotation parameter instanceRotation (in radians) and use the instanceRotation.y to create a matrix to rotate the object instance around the y axis. It looks like it works, I'll leave it here in case anybody needs it.

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

//////////////
// TYPEDEFS //
//////////////
struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
    float3 instancePosition : TEXCOORD1;
    float3 instanceRotation : TEXCOORD2;

};

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

////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType LightVertexShader(VertexInputType input)
{
PixelInputType output;

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

matrix <float, 4, 4> translation =
{
    1.0f, 0.0f, 0.0f, 0.0f,
    0.0f, 1.0f, 0.0f, 0.0f,
    0.0f, 0.0f, 1.0f, 0.0f,
    input.instancePosition.x, input.instancePosition.y, input.instancePosition.z, 1.0f

};

matrix <float, 4, 4> rotationAroundY = {
               cos(input.instanceRotation.y), 0.0f, -sin(input.instanceRotation.y), 0.0f,
               0.0f, 1.0f, 0.0f, 0.0f,
               sin(input.instanceRotation.y), 0.0f, cos(input.instanceRotation.y), 0.0f,
               0.0f, 0.0f, 0.0f, 1.0f
                           };

matrix <float, 4, 4> composition;

//i compose together the rotation around y and the translation, the order is important!
composition = mul(rotationAroundY,translation);
//i apply the transformation to the vertex input.position
output.position = mul(input.position,composition);

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

// Store the texture coordinates for the pixel shader.
output.tex = input.tex;

// Calculate the normal vector against the world matrix only.
output.normal = mul(input.normal, (float3x3)worldMatrix);

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

return output;

}

sentences:
How to modify A* so that it takes into account the number of movement point left? Context : turn based game, grid system

Let this graph here :

(A)-2-(B)-1-(C)
 |    /|   /
 1  2  2  1
 | /   |/
(D)-1-(E)

My unit is at A and wants to go at C. He currently has 1 point left, therefore he cannot go onto tile B until next turn.

A*star could say that the best path is A-B-C and say that the next move is go to B. But my unit cannot. It should've gone to D, as it would move closer to C and use all of its remaining movement point.

Right now, I have done a workaround in which I give a set of tiles to ignore, these tiles are neighbouring tiles that cannot be access given a number of movement point left. This works OK because my tiles either cost 1 or 2 MP, and my units have a maximum of 2 MP.

I would like something that is more general.

I have currently thought of something. I will now stop adding tiles to the frontier for which the cost so far is superior to my current movement point left. Once the frontier is empty, I iterate over all the already seen tiles and select the one with the best heuristic and get the path from there. Would that work?

sentences:
Libgdx Platform collision problem I am trying to come up with a collision function where all the cases are made.

If the player (Who's hit box is a circle) collides with a platform (hit box is a rectangle) from the right the platform will push the player back.
If the player collides with the platform for the top the player will stand on the platform.
If the platform is to the left of the player the player cant move to the left.

I am not asking how to tell if they are colliding or not but which side of the platform they are collide with where each platform is it's own object.

Can someone help me make this function?

sentences: How to Programm A Dialog box with a typewriter effect in Java? Im am very new to java and programming so I might be a bit annoying to work with but please bear with me :D So As the title says I'm trying to figure out how to properly program a working dialog box with typing text animation for a game I'm working on. I've seen some posts about swing timers but Im having trouble properly understanding them. If anybody has an idea please share it!

sentences:
Looking for literature about graphics pipeline optimization I am looking for some books, articles or tutorials about graphics architecture and graphics pipeline optimizations. It shouldn't be too old (2008 or newer) - the newer, the better.

I have found something in [Optimising the Graphics Pipeline, NVIDIA, Koji Ashida] - too old, [Real-time rendering, Akenine Moller], [OpenGL Bindless Extensions, NVIDIA, Jeff Bolz], [Efficient multifragment effects on graphics processing units, Louis Frederic Bavoil] and some internet discussions. But there is not too much information and I want to read more.

It should contain something about application, driver, memory and shader units communication and data transfers. About vertices and attributes. Also pre and post T&L cache (if they still exist in nowadays architectures) etc. I don't need anything about textures, frame buffers and rasterization.

It can also be about OpenGL (not about DirecX) and optimizing extensions (not old extensions like VBOs, but newer like vertex_buffer_unified_memory).

sentences:
Combat System - Class Objects as Package and Listener So I've been trying to map out a combat system and I have an idea I'm laying out that I'm looking for a sanity check on, as well as suggestions.

The idea is that all things that can do damage (weapons, spells, environmental traps, monsters that deal damage sans weapon) will have a CombatTalker() object attached that will contain information about the amount of damage and damage types (fire, frost, physical, magical, etc.), modifiers that it might have, and any special effects (apply DoT, blind, slow, etc.).

Everything that can take damage will have a CombatListener() object that takes that information and transmogrifies it with the receivers resistances and any special properties it may have.

The CombatTalker() will create a CombatPackage() from a collection class any time there is a collision, and send it to the CombatListener() on the collided objects, supposing it has one.  The CombatPackage() is basically the raw data about the damage and effects.  The CombatTalker() is a wrapper of sorts that generates the CombatPackage() based on the weapon (or whatever) base damage, then the specific details of that individual weapon, and sends it (like a network packet) to the CombatListener().  The CombatListener() unwraps the package, and in reverse applies the resistances then applies any relevant damage and effects.

I know some of that was slightly repetitive, but I was trying to outline the idea completely, which apparently took two paragraphs.

I know this might be slightly complex, but the creatures and players and weapons and spells can change over time, so there isn't just a pool of static data that can be attached to the item.  It needs to be able to read stats from JSON, apply specific information about the damage and send it.  The same goes on the other side in reverse.

Is there a reason that this is "too complex"?  Am I considerably overthinking it, or is this a reasonable method for a combat system?

Thanks!

sentences:
Can't drag image onto scene First time trying Unity and I'm having trouble with importing assets.

border_horizontal.png is fine, but I can't drag border_vertical.png onto my scene. It also doesn't have an arrow next to it in the asset menu. What is going on here?

sentences:
Playing an animation in Godot I have been working on making a platformer in Godot but can't seem to get a walk cycle to play when I press left or right.

extends KinematicBody2D

export (int) var run_speed = 300
export (int) var jump_speed = -400
export (int) var gravity = 1000

var velocity = Vector2()
var jumping = false

func get_input():
    velocity.x = 0
    var right = Input.is_action_pressed('ui_right')
    var left = Input.is_action_pressed('ui_left')
    var jump = Input.is_action_just_pressed('ui_select')

    if jump and is_on_floor():
        jumping = true
        velocity.y = jump_speed
    if right:
        velocity.x += run_speed
    if left:
        velocity.x -= run_speed

    if left or right and jumping != false:
       get_node("AnimationPlayer").play('walkcyc')

    if left or right and jumping != true:
        $AnimatedSprite.animation = 'run'
        $AnimatedSprite.flip_h = velocity.x < 0

    if is_on_floor() and velocity.x == 0 or velocity.y == 0:
        $AnimatedSprite.animation = 'stand'
        $AnimatedSprite.flip_v = false
        $AnimatedSprite.flip_h = velocity.x < 0

    if jumping != false:
        $AnimatedSprite.animation = 'jump'
        $AnimatedSprite.flip_v = false
        $AnimatedSprite.flip_h = velocity.x < 0

func _physics_process(delta):
    get_input()
    velocity.y += gravity * delta
    if jumping and is_on_floor():
        jumping = false
    velocity = move_and_slide(velocity, Vector2(0, -1))

sentences:
Why is this stored velocity changing? public void OnGamePause()
{
    Debug.Log("OnGamePause in PauseController");

    if (rb != null)
    {
        velocity = rb.velocity;
        angularVelocity = rb.angularVelocity;
        Debug.Log("Pause vel. = " + velocity + "Avel. = " + angularVelocity);
        rb.Sleep();
        Paused = true;
    }
}

public void OnGameResume()
{
    Debug.Log("OnGameResume in PauseController");

    if (rb != null)
    {
        Debug.Log("Resume vel. = " + velocity + "Avel. = " + angularVelocity);
        rb.velocity = velocity;
        rb.angularVelocity = angularVelocity;

        rb.WakeUp();
        Paused = false;
    }
}

Can anyone give me any idea what might be changing velocity?

sentences:
Moving a top-down camera while keeping its height constant I'm currently writing the script for the player to explore the plane below. The camera view is set to be slightly rotated as to look down. And I have set the code to make the camera move.

This is the code, and everything is set in the update method.

        if (Input.GetKey("w"))
        {
            transform.Translate(Vector3.forward * panSpeed * Time.deltaTime);   // , Space.World if want to avoid camera going down
        }
        if (Input.GetKey("s"))
        {
            transform.Translate(Vector3.back * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("d"))
        {
            transform.Translate(Vector3.right * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("a"))
        {
            transform.Translate(Vector3.left * panSpeed * Time.deltaTime);
        }

The problem is that everytime that the camera goes forward, it goes straight down. And I don't want it to do that. I want to keep the "height" from the plane below to be the same as in the picture below. I want the camera to move along the red axis.

I know of the existence of Space.World in order to achieve this, but the problem is that if I do that, whenever I rotate, now the controllers are all screwed up, because if I rotate to the right for example. Now Forward (W) moves the camera to the left, Right (D), moves the camera forward, etc etc.

So basically what I need is 1: to make the camera keep the distance to the plane below while moving (not going down). and 2. To make it possible that even with rotations, the controllers are kept, and not having this weird behavior, when forward is not longer forward.

Any ideas how to achieve this?

sentences:
Cant write/read to/from external storage with LibGDX My create method looks like this:

@Override
public void create () {
    batch = new SpriteBatch();

    FileHandle file = Gdx.files.external("file.txt");
    file.writeString("My god, it's full of stars", false);
}

I allso included:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

The Exception i get is this:

02-13 14:45:51.858 12439-12466/com.snowdevs.tweetiebirds E/AndroidRuntime: FATAL EXCEPTION: GLThread 1120
Process: com.snowdevs.tweetiebirds, PID: 12439
com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: file.txt (External)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:353)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: file.txt (External)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:330)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: java.io.FileNotFoundException: /storage/emulated/0/file.txt: open failed: EACCES (Permission denied)
   at libcore.io.IoBridge.open(IoBridge.java:452)
   at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:322)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
   at libcore.io.Posix.open(Native Method)
   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
   at libcore.io.IoBridge.open(IoBridge.java:438)
   at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:322)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

I use a Nexus 5 with Android 6 Marshmallow for testing.
I searched and found that Android 6 uses runtime permissions but the LibGDX guys says that it works even on Android 6... Is there a fix With or Without runtime permissions?

sentences:
How to check if a variable is an integer? I'm going through my C++ book and have currently made a working Guess The Number game.

The game generates a random number based on current time, has the user input their guess, and then tells them whether it was too high, too low, or the correct number.

The game functions fine if you enter a number, but returns 'Too High' if you enter something that is not a number (such as a letter or punctuation). Not only does it return 'too high', but it also continually returns it.

I was wondering what I could do to check if the guess, as input by the user, is an integer and if it is not, to return 'Not a number. Guess again.'

Here is the code.

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
    srand(time(0)); // seed the random number generator
    int theNumber = rand() % 100 + 1; // random number between 1 and 100
    int tries = 0, guess;

    cout << "\tWelcome to Guess My Number!\n\n";

    do
    {
        cout << "Enter a guess: ";
        cin >> guess;
        ++tries;

        if (guess > theNumber)
                cout << "Too high!\n\n";

        if (guess < theNumber)
                cout << "Too low!\n\n";

    } while (guess != theNumber);

    cout << "\nThat's it! You got it in " << tries << " guesses!\n";
    cout << "\nPress Enter to exit.\n";

    cin.ignore(cin.rdbuf()->in_avail() + 1);
    return 0;
}

sentences:
Unity 2D Graphics Optimization For Mobile Devices I want some advices on how to create graphical assets for mobile devices so that the game will have a good performance and not lag on mobile devices.

I had 3 issues with my games and that is they all lag after playing a little while, some lag more some less but they all lag, I think the problem is in the graphical assets. Some of the games were simple as flappy bird with a couple of images in the project but the game was lagging after playing it for a minute or two.

Now my question is, how to create graphical assets, do I need to export them on 16bit or 32bit and what is the difference, which options should I set in unity, compressed, true color, 16 bit?

And are there some other options that I can check or uncheck in unity so that the graphics will perform better on my game?

When I pack my assets in a sprite sheet, should I put them on larger sprite sheets for example 2048x2048(which is one of the options for max size in unity) or should I pack them on smaller sprite sheets?

Does a sprite sheet have to be to the power of two e.g 1024x1024 or 512x512 or I can pack my assets until they fit and the size does not matter for example the sprite sheet can be 640x410 or something like that, not on the power of two?

Does it make a difference when there is free space in a sprite sheet does that affect graphic performance or do I need to squeeze the sprites closer to each other so that there will be no empty space in the sprite sheet?

Please answer the question that I'm asking, last time I posted the same question people started asking me about the game, did I do this or that and my question then went off topic and got closed, the game is not the question, the question is everything that I mentioned above or if you have something to add that will help me.

If you can help me about this then please answer, and again please don't ask about the game and did I do this or that in the game. I hope that my question is clear, and that it is not off topic.

sentences:
Collision detection - make sure the player touches the object exactly I know this is really something I should be able to figure out on my own, but a solution is evading me.

Okay, here are a few relevant parts of my code.

bool Game::Col(int x1,int y1,int w1,int h1, int x2, int y2,int w2,int h2)
{
    if(x1 > x2 + w2 || y1 > y2 + h2 || x2 > x1 + w1 || y2 > y1 + h1)
    {
        return false;
    }
    return true;
}

That's my collision detecting algorithm. Simple, for rectangles only.

        int bX = (player.getX() - 64) / 32;
        int bY = (player.getY() - 64) / 32;
        int tX = (player.getX() + 64) / 32;
        int tY = (player.getY() + 64) / 32;

        for(int a=bX;a<tX;a++)
        {
            for(int b=bY;b<tY;b++)
            {
                if(Col(player.getX(), player.getY(), 32, 32, a * 32, b * 32, 32, 32) && blocks[a][b] == 1)
                {
                    player.setX(oldX);
                    player.setY(oldY);
                    goto loopExit;
                }
            }
        }

        loopExit:

Here is my collision detection. This is performed right after the player x/y is manipulated(5 pixels in whatever direction every 1/60th of a second). Blocks is just a 2d array for my tile map. I know the way I have collision detection right now is not too optimized, but it took a few seconds to implement and is reasonably fast.

But the player can only get within 5 pixels of an object now. How do I solve that?

sentences:
Using Quaternions: What can I do with them? (without the maths) I am a Game Developer and did not study Mathematics. So I only want to use Quaternions as a tool. And to be able to work with 3D rotation, it's necessary to use Quaternions (Or Matrixes, but let's stay at Quaternions here in this Question). I think it's important for many developers to use them. That's why I want to share my knowledge and hopefully fill the holes I have. Now....

So as far as I understood:

A Quaternion can describe 2 things:

The current orientation of a 3d Object.
The rotation transformation a Object could do. (rotationChange)

You can do with a Quaternion:

Multiplications:

Quaternion endOrientation = Quaternion rotationChange * Quaternion currentOrientation;

So for example: My 3D Object is turned 90° to left - and my rotation I multiply is a rotation 180° to right, in the end my 3D Object 90° is turned to right.
Quaternion rotationChange = Quaternion endRotation * Quaternion.Inverse(startRotation);

With this you get a rotationChange, which can be applied to another Orientation.
Vector3 endPostion =  Quaternion rotationChange * Vector3 currentPosition;

So for example: My 3D Object is on Position (0,0,0) and my rotation I multiply is a rotation 180° to right, my endposition is something like (0,-50,0) . Inside that Quaternion there is a Axis - and a rotation around that axis. You turn your point around that axis Y Degrees.
Vector3 rotatedOffsetVector = Quaternion rotationChange * Vector3 currentOffsetVector  ;

For example: My start direction is showing UP - (0,1,0), and my rotation I multiply is a rotation 180° to right, my end direction is showing down. (0,-1,0)

Blending (Lerp and Slerp):

Quaternion currentOrientation = Quaternion.Slerp(startOrientation, endOrientation , interpolator)

if the interpolator is 1 : currentOrientation = endOrientation

if the interpolator is 0 : currentOrientation = startOrientation

Slerp interpolates more precise, Lerp interpolates more performant.

My Question(s):

Is everything I explained until now correct?

Is that "all"  you can do with Quaternions?
(obv. not)

What else can you do with them?

What are the Dot product and the Cross product between 2 Quaternions good for?

Edit:

Updated Question with some answers

sentences:
How to use Tiled Editor to recreate a 2D map? Alright, to familiarize ourselves with the Tiled Editor, the teacher asked us to replicate a tile-based map of a 2D platformer.

He gave us pretty much these two things:

1.) A selection of maps to copy from (Choose one map to copy)

2.) A folder with subfolders that contains 16x16 images on each subfolder (tiles)

Naturally, I started by importing the images from the folders by clicking on each folder, and importing each collection, which takes a long amount of time..(also considering the tiles for the other maps are mixed in here as well)

I used the png image as a transparent backdrop to help me place the tiles, then started placing tiles, which again, took a lot of time...

More than halfway there, I realized the width I set the map when I created it wasn't enough and tried to change the option under properties but it was grayed out. I also tried creating a new map and copying and pasting from my original one but that one doesn't seem to work either.

Is there a way to speed up the process a little bit? or salvage the tmx file?
Considering that he might ask us to create more maps later on, I'd like to be a bit informed...

I've also looked up the possibility of importing the image itself, slicing it to the desired tile size and removing duplicate tiles. This way I can simply import the map png and have the software only create tiles that are used in the level.

Can this be done?

sentences:
2D Smooth Turning in a Tile-Based Game I am working on a 2D top-view grid-based game. A ball that rolls on the grid made up of different tiles. The tiles interact with the ball in a variety of ways.

I am having difficulty cleanly implementing the turning tile. The image below represents a single tile in the grid, which turns the ball by a right angle.

If the ball rolls in from the bottom, it smoothly changes direction and rolls to the right. If it rolls in from the right, it is turned smoothly to the bottom. If the ball rolls in from top or left, its trajectory remains unchanged by the tile.

The tile shouldn't change the magnitude of the velocity of the ball - only change its direction.

The ball has Velocity and Position vectors, and the tile has Position and Dimension vectors.

I have already implemented this, but the code is messy and buggy. What is an elegant way to achieve this, preferably by modification of the ball's Velocity vector by a formula?

sentences:
Reused Avatar moves mesh I have a humanoid avatar and it's animation controller.
I also have two different human meshes, they're quite similar.
When I use the generic avatar and it's controller in the animator the meshes
shot out into the sky and perform their animation correctly.
The animations run normal they just move in weird directions and don't stay in their original locations.
How to fix it so the mesh doesn't move far away and retain original position?

sentences:
How do I check on non-transparent pixels in a bitmapdata? I'm still working on my window cleaning game from one of my previous questions

I marked a contribution as my answer, but after all this time I can't get it to work and I have to many questions about this so I decided to ask some more about it. As a sequel on my mentioned previous question, my question to you is:

How can I check whether or not a bitmapData contains non transparent pixels?
Subquestion: Is this possible when the masked image is a movieclip? Shouldn't I use graphics instead?

Information
I have: A dirtywindow movieclip on the bottom layer and a clean window movieclip on layer 2(mc1) on the layer above.

To hide the top layer(the dirty window) I assign a mask to it.

Code

// this creates a mask that hides the movieclip on top
var mask_mc:MovieClip = new MovieClip();
addChild(mask_mc)

//assign the mask to the movieclip it should 'cover'
mc1.mask = mask_mc;

With a brush(cursor) the player wipes of the dirt ( actualy setting the fill from the mask to transparent so the clean window appears)

//add event listeners for the 'brush'
brush_mc.addEventListener(MouseEvent.MOUSE_DOWN,brushDown);
brush_mc.addEventListener(MouseEvent.MOUSE_UP,brushUp);

//function to drag the brush over the mask
function brushDown(dragging:MouseEvent):void{
    dragging.currentTarget.startDrag();
    MovieClip(dragging.currentTarget).addEventListener(Event.ENTER_FRAME,erase) ;
    mask_mc.graphics.moveTo(brush_mc.x,brush_mc.y);
}

//function to stop dragging the brush over the mask
function brushUp(dragging:MouseEvent):void{
    dragging.currentTarget.stopDrag();
    MovieClip(dragging.currentTarget).removeEventListener(Event.ENTER_FRAME,erase);
}

//fill the mask with transparant pixels so the movieclip turns visible
function erase(e:Event):void{
    with(mask_mc.graphics){
        beginFill(0x000000);
        drawRect(brush_mc.x,brush_mc.y,brush_mc.width,brush_mc.height);
        endFill();
    }

}

sentences:
Defining tileset for Tiled Terrain Brush — incorrect tiles selected at transitions I'm using TilEd (https://mapeditor.org) to make maps, and so far have used the programs Terrain feature to create water/paths etc no problem.

I'm trying to create trees now, and I've been at it a whole day and cannot figure out what I'm doing wrong. Have tried countless variations of sizes but here's what i'm currently using:

Tileset:

Now here's the terrain setup, types TREES and GRASS

Here's what it looks like in the map editor, close, but issues:

Any tips on how to define the terrain in TilEd? Or maybe a link to a working trees terrain pattern so I can compare?

sentences:
How do I get an xbox 360 controller to rumble? I am interfacing with the controller using the windows HID API. It seems that its output report length, as provided by the HID driver, is 0, which means I can't send it anything (e.g. make the rumble work). I've also noticed that the input report doesn't include the state of the big "X" button. Am I wrong about this? Is there a workaround, a better API, a workable filter driver that doesn't involve making .infs, etc...?

As I need to support an arbitrary number of controllers (keyboards, mice, and anything for that matter), xinput isn't an option. Installing drivers is also not an option, unless it can be done silently without breaking the device for every other application.

sentences:
Behavior Tree with interrupted sequence I'm reading up on Behavior Trees and would like to know how a good implementation for a scenario where the conditions can change or where a selector with a higher priority interrupts the current one.
To keep it simple I will use only tree "states".

FLEE
IDLE (/DECIDE NEXT POSITION)
WALK

WALK is running as long as the player has a target position. IDLE is running when player reached position or if player has no position.
Now to my question. FLEE should always interrupt the other nodes. How is this achieved in a good way?
I know this can be done in a lot of different ways so I just want to know how you would solve it.
(Sorry for no fancy node graphic. I'm on my mobile)

sentences: LibGdx Scalling sprites on Android I have a sprite that is a few buttons but need them in the center of the screen for all android devices. I tried setting it's location to the center of the screen by dividing the orthogonal camera by 2, but it doesn't help. Any simple way to fix this?

sentences:
Extracting individual components of a vector in the Source Shader Editor I'm using the Source Shader editor and would like to mask a vector output to one or two values, yet there is no existing mask node, as far as I can see.

What HLSL code should I use to output what I need? The input would be in the format "x y z". Any help would be greatly appreciated

sentences:
How to combine the camera that follows the player and the camera shake effect in Unity? I need to combine both camera that follows the player and the camera shake effect in the same moment. The problem is in that, if I make the shake effect for the camera, then the camera doesn't follow the player and if I make the camera follow the player, then the shake effect doesn't appear. The basic idea of my script is next:`

Vector3 originalPos;
GameObject targetPlayer;
bool canShake;
void OnEnable()
 {
     originalPos = camTransform.localPosition;
 }

 void Update()
 {
         // Camera shakes
     if (CanShake)
     {
         transform.localPosition = originalPos + Random.insideUnitSphere * shakeAmount;
     }
         // Camera follows the player
     else
     {
         transform.position = new Vector3(targetPlayer.transform.position.x, transform.position.y, transform.position.z;
     }
 }

Does anyone have ideas how to combine these two things (camera shake effect and camera that follows the player) at the same moment?

sentences:
How does one achieve a 'shimmering' effect similiar to the ones from the Pokemon games? I have an assignment to make a game in C++ using Winapi. As such I've decided to recreate pieces of the Pokemon games. I'm pretty well underway with the project, but there's one effect I would like to achieve that I don't really know how to achieve.

It can first be seen just before the game's title screen. (Pictured below)

As you can see, the logo sort of 'shimmers' from left to right a few times.

A similiar effect can be seen inside of combat when a pokemon's stats are altered. (Pictured below)

The effects I am talking about are the reddish shimmer appearing on the wolf (Poochyena), and the blue 'waves' appearing on the beaver (Bibarel).

I would like to know if there is a generalized method of applying such effects, as I aspire to have more than one Pokemon in the project, and I would therefore want a method that works on all cases. If the effect cannot be effectively achieved using winapi, then I am open to suggestions of other libraries, etc, to use.

sentences:
The best way to store and protect game data I'm writing a sandbox-type game and i'm looking for a good way to store game data. I tryed Lua and plain text files, but the have a big minus - player can edit them his self!

So how do I protect data from player? Thank you!

sentences:
Identifying connected lines drawn free-hand by a user I have a series of 'images' described by a mixture of connected lines and curves. Users will draw on the screen, free hand, and my goal is to break their drawing down into a series of lines and curves that can be matched with the 'images' in my set.

For the sake of simplicity, let's assume this is occurring on a touch screen. These lines will be connected. Each time the user's finger moves, the dx and dy is recorded. The drawing is considered complete and analyzed when the user's finger leaves the screen.

I'm having trouble figuring out a good way to break the user's drawing down into lines. Is there any well known approach to this problem, a C++ library that solves it, or any good articles/technical papers on how to achieve this?

sentences:
Throwing a grabbed object I'm trying to throw the carried object in the direction of the first person controller, but unable to make it. I could make the carried object drop, but the same time i need to instantiate velocity to the carried object, so that i could forward. I'm building up a bowling game and trying to make the ball behave like the same when the player throws the ball. It should hit the alley and move forward to hit the pins. Below is what so far I've tried.

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

public class pickupobject : MonoBehaviour {
    GameObject mainCamera;
    //public GameObject empty;
    bool carrying;
   public GameObject carriedObject;
   // Camera cam;
    public float distances;
    public float smooth;
    float speed = 1000f;

    // Use this for initialization
    void Start()
    {
        //cam = GameObject.Find("MainCamera").GetComponent<Camera>();
        mainCamera = GameObject.FindWithTag("MainCamera");
    }

    // Update is called once per frame
    void Update () {
        if (carrying)
        {
            carry(carriedObject);
            CheckDrop();
        }
        else
        {
            pickup();
        }

    }

    private void pickup()
    {
        if(Input.GetKeyDown(KeyCode.E))
        {
            int x = Screen.width / 2;
            int y = Screen.height / 2;
            Ray ray = mainCamera.GetComponent<Camera>().ScreenPointToRay(new Vector3(x, y));
            RaycastHit hit;
            if(Physics.Raycast(ray, out hit))
            {
                pickupable p = hit.collider.GetComponent<pickupable>();
                if(p!=null)
                {
                    carrying = true;
                    carriedObject = p.gameObject;
                }
            }
        }
    }

    void carry(GameObject o)
    {
        o.GetComponent<Rigidbody>().isKinematic = true;
        o.transform.position =  mainCamera.transform.position + mainCamera.transform.forward * distances;

    }

    //void ThrowBall()
    //{
    //    GameObject go = (GameObject)Instantiate(carriedObject,transform.forward, Quaternion.identity);
    //    pickupable to = go.GetComponent<pickupable>();
    //    to.Throw(carriedObject.transform.forward * speed);
    //}

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

    void Drop()
    {
        carrying = false;
        // carriedObject = Instantiate(carriedObject, new Vector3(transform.position.x, transform.position.y, transform.position.z), transform.rotation);
        carriedObject.GetComponent<Rigidbody>().isKinematic = false;
        gameObject.GetComponent<Rigidbody>().AddForce(carriedObject.transform.forward * 100);
       // carriedObject.GetComponent<Rigidbody>().AddForce(0,0,1f);
        //carriedObject.gameObject.GetComponent<Rigidbody>().isKinematic = false;
        carriedObject = null;

    }
}

Thanks in advance!

sentences:
How do I handle game objects with two depths? I want to be able to do what you see in the image, but with a single wall. The player should be able to walk on either side of the same object. That is, the same wall is below the hero when I go down from it, and it's above the hero if I come from above it.

It's like two depths in the same wall, so its not just a matter of drawing it before or after. I could cut the object in two, but that would be the easy (and maybe computationally expensive) solution. How should I do this?

sentences:
Bounding box of a rotated rectangle (2d) I can see this has been asked before in various ways. I am struggling to work it out though hence asking again.

2d sprite that moves and rotates. I'm looking to contain it in a bounding box as it appears that is the most efficient way to do collision detection.

I had no problems getting it to work without rotation but that is simple! Now the sprite rotates I can't seem to find the right way of writing the code.

To create a bounding box for the sprite, my understanding is I need to work out the 4 corners of the sprite after rotation and use these to work out the width + height of the correctly sized bounding box.

I've used the article here - http://msdn.microsoft.com/en-us/library/dd162943(v=vs.85).aspx - specifically the formula:

x' = (x * cos A) - (y * sin A)
y' = (x * sin A) + (y * cos A)

The code I'm currently using:

x1 = (positionX * Math.cos(rotation)) - (positionY * Math.sin(rotation));
y1 = (positionX * Math.sin(rotation)) + (positionY * Math.cos(rotation));

x2 = (positionX+width/2 * Math.cos(rotation)) - (positionY+height/2 * Math.sin(rotation));
y2 = (positionX+width/2 * Math.sin(rotation)) + (positionY+height/2 * Math.cos(rotation));

positionX and positionY is the current top left hand corner position of the sprite.

rotation is the radians the sprite has been rotated by (and rotation is from the centre).

width and height are of the sprite.

I thought the code above would give me the co-ordinates of the top left and top right corners of the rectangle, rotated appropriately. However, on my canvas, I'm drawing a line from x1,y1 to x2,y2 and it doesn't follow the sprite at all!

Any suggestions? Sorry for the long post!

Cheers!

sentences:
Particles placed in the middle of the screen (OpenGL ES 2 / Android) It seems like each of my particles is placed at (0, 0, 0) even though I'm setting different positions for each of them (debugger also confirms this). It must be something really silly that I'm missing. My intention is to paint 250 particles at random positions on the screen. Here's my code:

@Override
public void onDrawFrame(GL10 gl) {
    if(time++ == MAXTIME) {
        time = 0;
    }

    //my own helper methods
    GLUtils.sendBufferData(a_Position, 3, position);
    GLUtils.sendBufferData(a_Velocity, 3, velocity);
    GLUtils.sendBufferData(a_Offset, 1, offset);

    Matrix.setIdentityM(mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, camera.getViewMatrix(), 0, mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, camera.getProjectionMatrix(), 0, mMVPMatrix, 0);

    GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);

    GLES20.glUniform1f(u_Time, time);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);
    GLES20.glUniform1i(u_Texture, 0);

    GLES20.glDrawArrays(GLES20.GL_POINTS, 0, particlesCount); //particlesCount = 250
}

@Override
protected void initData() {
    float[] positions = new float[3 * count];
    float[] velocities = new float[3 * count];
    float[] offsets = new float[count];

    int index = 0;

    for(int i = 0; i < count; i++) {
        offsets[i] = MathUtils.random() * 60 + 20;

        positions[index] = MathUtils.random() * 2 - 1;
        velocities[index] = -0.025f;
        index++;

        positions[index] = MathUtils.random() * 2 - 1;
        velocities[index] = -0.035f;
        index++;

        positions[index] = 0;
        velocities[index] = 0;
        index++;
    }
    //my own helper method
    texture = GLUtils.loadTexture(mContext, R.drawable.snowflake);

    position = ByteBuffer.allocateDirect(positions.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    velocity = ByteBuffer.allocateDirect(velocities.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
    offset = ByteBuffer.allocateDirect(offsets.length * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();

    position.put(positions).position(0);
    velocity.put(velocities).position(0);
    offset.put(offsets).position(0);
}

private static final String vertexShader() {
    return "" +
            "uniform mat4 u_MVPMatrix;\n" +
            "uniform float u_Lifetime;\n" +
            "uniform float u_CurrentTime;\n" +
            "\n" +
            "attribute vec4 a_Position;\n" +
            "attribute vec3 a_Velocity;\n" +
            "attribute float a_Offset;\n" +
            "\n" +
            "void main() {\n" +
            "    gl_PointSize = 10.0;\n" +
            "    gl_Position = u_MVPMatrix * a_Position;\n" +
            "}";
}

private static final String fragmentShader() {
    return "precision mediump float;\n" +
            "\n" +
            "uniform sampler2D u_Texture;\n" +
            "\n" +
            "void main() {\n" +
            "    gl_FragColor = texture2D(u_Texture, gl_PointCoord);\n" +
            "}";
}

Note: I deliberately deleted some lines from the vertex shader since I don't think they are relevant in this case.

Edit: It may be that gl_PointCoord is always set to 0. I'm looking into this now.

sentences:
C++ OpenGL More textured objects equals less FPS So I'm creating a game engine with many features, last time I focused on textures.

When I finished implementing some new code (Made by myself) I created new Entity with texture, and it was working really nice.

But If I create 2 or more textured objects game starts lagging..

1 Cube without texture = > 60 FPS
1 Cube with texture = > 60 FPS
2 Cubes without texture =  > 60 FPS
2 Cubes with texture = 40-50 FPS
10 Cubes without texture = > 60 FPS
10 Cubes with texture = 20 FPS
100 Cubes without Texture = > 60 FPS
100 Cubes with Texture = < 1 FPS
10000 Cubes without Texture = > 60 FPS

I'm using GLSL sampler2D, texture UV from VBO, here is my renderer code:

bool textured = false;

if(entity->hasComponent("MaterialComponent"))
{
    MaterialComponent *materialComponent = (MaterialComponent*) entity->getComponent("MaterialComponent");

    if(materialComponent->material != NULL && materialComponent->material->texture != NULL) textured = true;
}

if(component->cullFaces)
{
    glEnable(GL_CULL_FACE);
    glCullFace(GL_BACK);
}

if(textured) glEnable(GL_TEXTURE_2D);

glBindVertexArray(component->model->vaoID);
glEnableVertexAttribArray(0);
if(textured) glEnableVertexAttribArray(1);
glEnableVertexAttribArray(2);

//glDrawElements(GL_TRIANGLES, component->model->getVertexCount(), GL_UNSIGNED_INT, 0);

if(textured)
{
    MaterialComponent *materialComponent = (MaterialComponent*) entity->getComponent("MaterialComponent");

    if(materialComponent->material->texture->textureID == 0) glGenTextures(1, &materialComponent->material->texture->textureID);

    glBindTexture(GL_TEXTURE_2D, materialComponent->material->texture->textureID);

    SDL_Surface *surface = IMG_Load(materialComponent->material->texture->textureFile->getPath().c_str());

    if(!surface) Error::throwError("Cannot load texture file!");

    S32 colorMode = GL_RGB;

    if(surface->format->BytesPerPixel == 4) colorMode = GL_RGBA;

    glTexImage2D(GL_TEXTURE_2D, 0, colorMode, surface->w, surface->h, 0, colorMode, GL_UNSIGNED_BYTE, surface->pixels);

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
   // glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
   // glGenerateMipmap(GL_TEXTURE_2D);

    glActiveTexture(GL_TEXTURE0);

    glUniform1i(baseShader->loc_sampler, 0);

    SDL_FreeSurface(surface);
}

glDrawElements(GL_TRIANGLES, component->model->getVertexCount(), GL_UNSIGNED_INT, 0);

if(textured)
{
    //glBindTexture(GL_TEXTURE_2D, 0);
    glDisable(GL_TEXTURE_2D);
}

glDisableVertexAttribArray(0);
if(textured) glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);
glBindVertexArray(0);

if(textured) glDisable(GL_TEXTURE_2D);

if(component->cullFaces)
{
    glDisable(GL_CULL_FACE);
}

So I can create new TextureAsset for each cube or I can use one TextureAsset for each cube, it makes no difference about FPS.

I'm creating new TextureAsset like this:

TextureAsset *textureAsset = new TextureAsset(new FilePath("PATH_TO_TEXTURE"));

Then putting it inside Entity' MaterialComponent:

MaterialComponent *materialC = (MaterialComponent*) cube1->getComponent("MaterialComponent");

materialC->materialAsset->texture = textureAsset;

I think there is something bad inside my renderer method, it happens only if there is more than 1 textured object. Maybe I have to clean-up texture in different way?

I'm using SDL2, SDL2_image and GLEW.

If you need more code - just tell me.

sentences:
Easy way to edit vertex attributes I'm trying to edit large amounts of vertex attributes in my models for my game. The main attributes I really care about are strength (so wind can interact with them) and a couple of other things so the interaction with wind looks decent.

However, I'm not quite sure how do edit them easily. Of course I could manually write all of them, but that would be ridiculous. My first thought was to use a format in Blender that I could just export vertex colours and use the value as the attribute value.

Here's a picture for example (red = leaves, very windy, strength = 0.1; green = wood, strength = 0.7)

I don't really see any problems with this other than the fact I don't know of any formats, but I'm sure I can find some.

Is is there any way (or any program that can do this easier)? Or is the way of just colouring them the best way to go.

sentences:
How to improve load times of audio files without loosing too much quality for HTML5 game? I'm creating an HTML5 game. We have high fidelity composed music, in the format of wavs and mp3s— some ogg. Game engine we are using is melon JS.

The wav files are generally 3x time size of mp3s, but even loading the mp3s is by far the slowest asset to load on the web game.

I've tried compressing file mp3s at http://www.mp3smaller.com/, @ mp3 Bitrate 32Kbps which resulted in 89% reduction in file size. This significantly improves load time of the game, but it's as though we lost 89% of the quality.

Any recommendations for lossless (or close to) compression services/techniques with significant file downsize but little quality loss?

In images, I know we can take a .png and save as .jpg at lower fidelity, saving about 70-80% in space...but to the eye, it's impossible to tell.

sentences:
Why can't UObject derived objects call BlueprintFunctionLibrary functions? My question is a very simple one.

Why can't UObject derived classes (direct inheritance) call functions from Blueprint Function Libraries?

__

Edit:

My question relates to Blueprints only.

An Object derived Blueprint seems to be incapable of calling functions from an editor-created BlueprintFunctionLibrary

sentences:
Island Generation Library Can anyone recommend a tile map generator (written in Java is a plus), where one can control some land types? For example: islands, large continents, singe large continent, archipelago, etc.

I've been reading through many posts on the subject, it almost seems like many are just rolling their own. Before creating my own, I'm wondering if there's already an open source implementation that I might not be finding.

If not, it seems like using Perlin Noise is a popular choice.

Some articles I've been reading:

http://simblob.blogspot.com/2010/01/simple-map-generation.html

Generate islands/continents with simplex noise

https://sites.google.com/site/minecraftlandgenerator/

sentences:
Gap in parallaxing background loop The bug here is that my background kind of offset a bit itself from where it should draw and so I have this line. I have some troubles understanding why I get this bug when I set a speed that is different then 1,2,4,8,16,...

In main class I set the speed depending on the player speed

 bgSpeed = -(int)playerMoveSpeed.X / 10;

and here's my background class

class ParallaxingBackground
    {
        Texture2D texture;
        Vector2[] positions;
        public int Speed { get; set;}

        public void Initialize(ContentManager content, String texturePath, int screenWidth, int speed)
        {
            texture = content.Load<Texture2D>(texturePath);
            this.Speed = speed;
            positions = new Vector2[screenWidth / texture.Width + 2];
            for (int i = 0; i < positions.Length; i++)
            {
                positions[i] = new Vector2(i * texture.Width, 0);
            }
        }
        public void Update() {
            for (int i = 0; i < positions.Length; i++)
            {
                positions[i].X += Speed;
                if (Speed <= 0)
                {
                    if (positions[i].X <= -texture.Width)
                    {
                        positions[i].X = texture.Width * (positions.Length - 1);
                    }
                }
                else
                {
                    if (positions[i].X >= texture.Width*(positions.Length - 1))
                    {
                        positions[i].X = -texture.Width;
                    }
                }
            }
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            for (int i = 0; i < positions.Length; i++)
            {
                spriteBatch.Draw(texture, positions[i], Color.White);
            }
        }

    }

sentences:
How do I build games with scripted actors? The idea

I have an idea for a game. A few games, actually, that can built on top of the same general design.

There is a game world that the player and the other actors exist in. The player can get information from the world about his surroundings. The player can also interact with the world, picking up an object for example.
Now, I would like the same thing to be possible for other, scripted actors. They are the player's competition. Instead of navigating the world and performing actions based on human input, a script should decide what they do.

An example

I want to do this using a 2d world eventually, so I might as well give the example I want to build:

There is a 2d world with objects of various sizes and shapes. Every actor has their own field of view. They get information from the world about the objects in their field of view. For the player, this information is displayed on the screen of the user. The player navigates the world by user input.

Scripted actors navigate the world in a scripted way. They walk in a general direction, they follow a wall or things like that. Their scripts should be able to get the information about the objects in their field of view and act on it. If an other actor is detected in their field of view, they should walk in that direction for example.

All of this should happen in pretty much real-time.

The information gotten from the world (showed to the player, and given to the scripted actors) in this case would be something like a collection of "what", "where", and "in what orientation".

The question

My question is: how I can program this effectively and efficiently?

I am thinking to build this with C and Lua. C++ is also an option.
I would store the game state and display the graphics using C.
The part that I don't know how to handle is the interaction between C and Lua.
Not programming-wise, but design-wise. The interaction between the world and the scripted actors.

Should C provide the Lua actors with information, and then have the Lua actors call C functions that change their direction, move a step forward, etc? Will this work in real-time?

I realize that this question is broad, but I think it's not unreasonable. There are obviously ways to do this and I would like to know some.

sentences:
What would be the benefit of placing all of a room's textures on an object outside of the camera's view? Pokémon XD: Gale of Darkness does an odd thing with textures. As described in this video, all textures for a room are placed on an object outside of the camera's view:

  This kind of caught me off-guard. I wasn't really expecting anything to be on the other side of this room, but when I turned the camera around, it was all the textures that were inside this room plastered into one spot. Now I can't explain this whatsoever; I've never seen this in any other game that I've covered. But what's really odd is that this isn't an isolated case, this happens periodically throughout Pokémon XD. Now it's not in every room and city, but from time to time, you will see its textures on some type of object in an area that's off-camera.

What would be the benefit of doing this? The scene is shown to the player all at once after loading, so I'm not seeing how it would help with loading times or anything.

sentences:
Adding terrain features to a perlin noise heightmap I'm currently using Perlin Noise to generate heightmaps and model moisture levels as well as tree density to create terrain (in the form of 2D tilemaps - think dwarf fortress).

How can I generate things like caves, or other landmarks like massive boulders or buildings?

I don't want to model these features (i.e. I don't care about the inside of the cave), I just want the game to be able to say 'there is a cave here' when you're at the x,y position of the cave, and importantly, follow rules about where caves might be (e.g. side of a mountain / rocky areas).

I also want to be able to generate this in a procedural way, similar to perlin noise, so that with any 'seed', the same landmarks will always appear.

I'm struggling to think of a way to create these features, and have them always reappear with the same seed. Does anyone have any ideas? :)

sentences:
How can I prevent seams from showing up on objects using lower mipmap levels? Disclaimer: kindly right click on the images and open them separately so that they're at full size, as there are fine details which don't show up otherwise. Thank you.

I made a simple Blender model, it's a cylinder with the top cap removed:

I've exported the UVs:

Then imported them into Photoshop, and painted the inner area in yellow and the outer area in red. I made sure I cover well the UV lines:

I then save the image and load it as texture on the model in Blender. Actually, I just reload it as the image where the UVs are exported, and change the viewport view mode to textured. When I look at the mesh up-close, there's yellow everywhere, everything seems fine:

However, if I start zooming out, I start seeing red (literally and metaphorically) where the texture edges are:

And the more I zoom, the more I see it:

Same thing happends in Unity, though the effect seems less pronounced. Up close is fine and yellow:

Zoom out and you see red at the seams:

Now, obviously, for this simple example a workaround is to spread the yellow well outside the UV margins, and its fine from all distances. However this is an issue when you try making a complex texture that should tile seamlessly at the edges. In this situation I either make a few lines of pixels overlap (in which case it looks bad from upclose and ok from far away), or I leave them seamless and then I have those seams when seeing it from far away.

So my question is, is there something I'm missing, or some extra thing I must do to have my texture look seamless from all distances?

sentences:
How do I calculate hex coordinates from a ring and index? I am trying to implement field of view (FOV) in a hex grid. I am using the cube coordinate system from here. Then, I am using shadow casting to find FOV as from here.

I have a system like in the image, below. The numbers at the corners are coordinates. The numbers in the center are formatted as [Ring index],[Hex Index].

I need to used both ring index and hex index to calculate angles used for shadow casting. I spent several days on it, but I still cannot find a way to make these two sets of numbers convertible.

How do I calculate hex coordinates from a ring and index?

sentences:
Unity 2D Diablo style movement I've made a totally new scene for a 2D mobile game. I placed a sprite on the center of the screen and attached the following script onto it (this is basically a diablo-style click-to-move control script, the sprite follows the pointer when it is clicked):

using UnityEngine;

public class Movement : MonoBehaviour
{
private float _moveSpeed = 5;
private Vector3 _targetPosition;
private float _targetDistance;

void Update()
{
    _targetDistance = Vector3.Distance(_targetPosition, transform.position);

    if (_targetDistance < 1)
    {
        _moveSpeed = 0;
    }
    else if (_targetDistance > 1)
    {
        _moveSpeed = 5;
    }

    if (Input.GetMouseButton(0))
    {
        Plane playerPlane = new Plane(Vector3.up, transform.position);
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        float hitdist = 0.0f;

        if (playerPlane.Raycast(ray, out hitdist))
        {
            _targetPosition = ray.GetPoint(hitdist);
        }
    }

    if (_targetDistance > 1)
    {
        transform.position += (_targetPosition - transform.position).normalized * _moveSpeed * Time.deltaTime;
    }
}
}

Normally this script doesn't work unless I rotate the main camera by 90 degrees (axis: X) and rotate the sprite also by 90 degrees (axis: X).

How should I modify the script to make it work without rotating the camera and all the sprites I place on the scene?

Thank you in advance!

sentences: How do I stop a monster from dropping a quest item once the related quest is finished? I'm trying to make a quest. When the quest is activated (switch is on), monsters should drop a certain quest item. After the quest is finished (switch is off), those monsters should stop dropping the quest item. How can I do this?

sentences:
body_entered signal won't emit when rigidbody collided to rigidbody I have multiple rigidbody object floating away in the space. When they hit each other, they push away each. I want to destroy object if they hit something, but connect body_entered signal won't invoked when they impact each other:

func _ready():
    connect("body_entered", self, "destroy")

func destroy(body):
    print("HIT!")
    queue_free()

How do I check Rigidbody hit something?

sentences:
How can I draw multiple lines connected via "nodes" with SlimDX? I currently read out XML data with the following scheme: Position x,y,z

I try to add one new Vertex for each position node and add it to a Vertex array.

Then I try to render this list of vertices so I get all those lines connected to represent a "path" through space.
(Space is 3D)

What I tried so far:

    [STAThread]
    static void Main()
    {
        var form = new RenderForm("SlimDX - MiniTri Direct3D9 Sample");
        var device = new Device(new Direct3D(), 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters()
        {
            BackBufferWidth = form.ClientSize.Width,
            BackBufferHeight = form.ClientSize.Height

        });
        form.Height = 900;
        form.Width = 900;

        LineVertex[] waypoints = new LineVertex[1024];

        XmlDocument paths = new XmlDocument();
        paths.Load("data.xml");
        XmlNode rootNode = paths.DocumentElement;

        int index = 0;
        foreach (XmlNode waypoint in rootNode)
        {
            foreach (XmlNode position in waypoint)
            {
                Console.WriteLine(position.ChildNodes[0].InnerText);
                float b = 1000.0f;
                float x, y, z;

                x = (float.Parse(position.ChildNodes[0].InnerText) / (b * b));
                y = (float.Parse(position.ChildNodes[1].InnerText) / (b * b);
                z = (float.Parse(position.ChildNodes[2].InnerText) / (b * b));

                Console.WriteLine(x.ToString() + " / " + y.ToString() + " / " + z.ToString());

                if (index % 2 > 0)
                    waypoints[index].Color = Color.Yellow.ToArgb();
                else
                    waypoints[index].Color = Color.Red.ToArgb();
                waypoints[index].Position = new Vector3(x, y, 0.0f);
            }
        }

        MessagePump.Run(form, () =>
        {
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.CornflowerBlue.ToArgb(), 0f, 1);
            // Since we don't have any lights in our scene, our lines won't receive
            // any light and will therefore be black...
            // ...but we want them golden as an asinus aureus, so let's disable lighting.
            device.SetRenderState(RenderState.Lighting, true);
            device.BeginScene();

            // Our struct was meant to describe a position and a color,
            // let's tell the device about it.
            device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;

            // In this particular case SlimDX does not need the
            // vertex stride, it will be automatically calculated.
            device.DrawUserPrimitives(PrimitiveType.LineList, 0, waypoints.Length / 2, waypoints);

            device.EndScene();
            device.Present();

        });

        foreach (var item in ObjectTable.Objects)
            item.Dispose();
    }
}

But this does not work, and I am sure it is the complete wrong approach!

EDIT: So far one solution worked out, but not very well.
And I also need the Vertices to be changeable at runtime, so I locked at the documentation and samples, they always use VertexBuffer() to make it possible to dynamically change the Vertices by using a DataStream as Input for the VertexBuffer.

A question still open to me is, since I am used to "Update(Time time)" formats the procedural still of DX/OpenGL oftens confuses me.
So I assume that MessagePump.Run() represents the drawing call that's repeated each frame.
So if some values before the drawing call change like a Vertex, that's put into the datastream, I can instantly see the updated result on the screen.
Is that assumption right?

sentences:
AABB Collision Detection Confusion I am trying to understand and implement AABB collision to learn simple 2D game physics. I'm following a tutorial and its method is a bit different to other websites. It uses the center of the object and its "half-size" to determine collision. This is its code:

public bool Overlaps(AABB other)
{
    if ( Mathf.Abs(center.x - other.center.x) > halfSize.x + other.halfSize.x ) return false;
    if ( Mathf.Abs(center.y - other.center.y) > halfSize.y + other.halfSize.y ) return false;
    return true;
}

And this is the seemingly more popular option:

if (rect1.x < rect2.x + rect2.width &&
   rect1.x + rect1.width > rect2.x &&
   rect1.y < rect2.y + rect2.height &&
   rect1.y + rect1.height > rect2.y) {
    // collision detected!
}

Which one is more efficient? And for the first option, would I define the center and half-size like this:

AABB = new AABB(new Vector2(Width / 2, Height / 2), new Vector2(Width / 2, Height / 2));

Center and half-size method source: https://gamedevelopment.tutsplus.com/tutorials/basic-2d-platformer-physics-part-1--cms-25799

Position and width/height source: https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection

sentences:
2 cameras that each player sees through a different one Im very new to Networking in Unity 5.
Im trying to bring the finished basis for my 2 player, 1 vs 1, turn-based game I made for local multiplayer (both players on same computer) to an online matchmaking system.

In the game currently (for local), there are 3 cameras.
2 centered on separate canvases for selecting attacks for each player.

that once p1 chooses his attacks and presses continue, the camera is deactivated and the 2nd camera for p2's attacks is activated.
Once p2 presses to continue the 2nd cam is also deactivated

and the 3rd cam is put on, this camera is set on the battle arena and plays out in turns the moves picked by the 2 players through a turn-determining system.

What I want to do for the online is have both canvas cameras activated at the same time and each player to be assigned to a different camera.
So is there a good way i should do this? NetworkView on one of the cams?
Hope I explained the premise enough :P

sentences:
Monster's AI in an Action-RPG I'm developing an action rpg with some University colleagues. We've gotton to the monsters' AI design and we would like to implement a sort of "utility-based AI" so we have a "thinker" that assigns a numeric value on all the monster's decisions and we choose the highest (or the most appropriate, depending on monster's iq) and assign it in the monster's collection of decisions (like a goal-driven design pattern) .

One solution we found is to write a mathematical formula for each decision, with all the important parameters for evaluation (so for a spell-decision we might have mp,distance from player, player's hp etc). This formula also has coefficients representing some of monster's behaviour (in this way we can alterate formulas by changing coefficients).

I've also read how "fuzzy logic" works; I was fascinated by it and by the many ways of expansion it has. I was wondering how we could use this technique to give our AI more semplicity, as in create evaluations with fuzzy rules such as
IF player_far AND mp_high AND hp_high THEN very_Desiderable
(for a spell having an high casting-time and consume high mp) and then 'defuzz' it. In this way it's also simple to create a monster behaviour by creating ad-hoc rules for every monster's IQ category.

But is it correct using fuzzy logic in a game with many parameters like an rpg? Is there a way of merging these two techniques?
Are there better AI design techniques for evaluating monster's chooses?

sentences:
AndEngine Foreground Sprite I'm developing an Android game and have some troubles: I want to add some foreground sprites, that must obstruct my player.
Se the following example: Its a screenshot from "Shinobi 3". We can see the player, the enemy, the background and two foreground trees, that hide the player's arm and part of the enemy.
I'm using AndEngine GLES2 Anchor Center and I am trying to add a new layer to my scene.
Sprite Forest = new Sprite(getWidth() * 0.5f, textureHeightForest * 0.5f + 100, ResourcesManager.getInstance().foreground_forest_region, vbom);
Entity foregroundLayer = new Entity();
foregroundLayer.attachChild(hillFurthest);
attachChild(foregroundLayer);

But it still shows behind my player sprite. I am trying to find something in HUD-class (it's always shown in the foreground), but got no results. Can anyone help please?

sentences:
OpenGL specification error? Follow up for my previous question, whose answer lead to another question:

As the OpenGL specification documentation states,
in glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices), indices "Specifies a pointer to the location where the indices are stored."

So why does calling gl::glDrawElements(gl::GL_TRIANGLES, IndexBuffer.size(), gl::GL_UNSIGNED_INT, (void*)(0)); work, but calling gl::glDrawElements(gl::GL_TRIANGLES, IndexBuffer.size(), gl::GL_UNSIGNED_INT, &(IndexBuffer.at(0))); doesn't ?

sentences:
Maya - Single Model with different animation I am newbie in Maya and would like to clarify some implementations in Animation. I know how to create simple animations in Maya. These animations are exported to Unity3D (as .fbx with controllers) to use in my application.

I want to know whether it's possible to attach different animations to one model. For example, let's say, I have an arrow mark model and I want to show different animations for the model like moving left, moving right, moving up, moving down, etc. So that, when I export, I'll get one model - Arrow.fbx and different controllers - LeftAnimController, RightAnimController, etc.

Is that achievable? Or I need to create different Arrow mark model with it's own controllers.

Any help will be appreciated.
Thank you.

sentences:
OpenGL: Attempt to allocate a texture too big for the current hardware I'm getting the following error:

  java.io.IOException: Attempt to allocate a texture to big for the current hardware
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:320)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:254)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:200)
    at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
    at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)

The image I'm trying to use is 128x128.

System.out.println(GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE));

I get: 32.

32??!! My graphics card is AMD Radeon HD 7970M with 2048 MB GDDR5 RAM, I can run all the latest games in 1080p and 60fps with no problem, and those textures sure as hell doesn't look like they are 32x32 pixels to me!

How can I fix this?

--

Edit: Here's the chaos code I use to init OpenGL:

Display.setDisplayMode(new DisplayMode(500,500));
Display.create();
if (!GLContext.getCapabilities().OpenGL11) {
    throw new Exception("OpenGL 1.1 not supported.");
}
Display.setTitle("Game");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLU.gluPerspective(45, 1, 0.1f, 5000);

Mouse.setGrabbed(true);

glMatrixMode(GL_MODELVIEW);

glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glClearColor(0, 0, 0, 0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_POLYGON_OFFSET_FILL);

glShadeModel(GL_SMOOTH);

Display is a LWJGL thing, it makes the OpenGL context and the window.

Anyway, I don't think there's anything in the init code that can help me but you never know...

sentences:
Mesh rendering performance optimisation I'm working on a libgdx implementation of mesh terrain and running into some performance issues.

The terrain is represented by a number of mesh tiles, each mesh is made of vertices laid onto a 2D plane.

The implementation of the meshes is done via libgdx Mesh, each of which is cached after its initial generation. I use GL3.0 and therefore the vertices are handled via VertexBufferObjectWithVAO which as I understand it should allow GPU caching. Meshes are indexed.

Aiming to optimise performance, I have tried to increase the number of vertices in each mesh (while keeping the same overall amount of vertices) but weirdly the performance gets worse rather than improving.

Question 1: any possible reasons why given the same total number of vertices the scenario with lower amount of meshes (#3 below) is slower than the scenarios with higher number of meshes?

Question 2: based on the OPENGL pipeline summarised below is it correct to assume that VBOs are being transferred to the GPU once and then drawn via GPU memory reference?

Performance comparison

1,600 meshes * 3,042 vert (4.8M vertices) -> 131 FPS
625 meshes * 11,250 vert (4.5M vertices) -> 132 FPS
100 meshes * 45,000 vert (4.5M vertices) -> 113 FPS

Hardware Details

GTX660 2GB
Memory Utilisation during test 70% in all scenarios. Vertex allocation memory impact seems to be negligible compared to textures.

OPENGL pipeline

From API TRACE, this is the frame life-cycle in summary

mesh generation (one off)

glGenBuffers()
glGenVertexArrays()

render (every frame)

glClear(GL_COLOR_BUFFER_BIT)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glUseProgram(...)
glUniformMatrix4fv(...)
glUniform1f(...)
glActiveTexture(...)
glBindTexture(...)
...
glBindVertexArray(...)
glBindBuffer(...)
glDrawElements(...)
[for each mesh]

*edited to clarify that I have tried to group the vertices into less amount of meshes to reduce number of draw calls

**edited to provide more data and streamline questions.

sentences:
first person character controller error I have opened new scene, deleted camera and imported first person character controller from Standard assets.
I placed plane on scene and put first person character controller on plane.

I got this error:

  Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/RigidbodyFirstPersonController.cs(3,27): error CS0234: The type or namespace name CrossPlatformInput' does not exist in the namespaceUnityStandardAssets'. Are you missing an assembly reference?

How to fix it?

sentences:
Efficient way to avoid shadow "streaks" beyond bounds of shadow map BACKGROUND INFO:

Using MonoGame.

To maximize shadow resolution, I've got a shadow map that covers only the area closest to the camera. (I am aware of Cascading shadow maps, but for now, I am willing to simply lose shadows far away, in exchange for higher resolution near the camera.)

Specifically, I am rendering shadows of tree billboards, that are then cast on to a ground terrain.

First version worked great except for one issue. If a shadow is drawn that touches an edge of the shadow map, then that final row (or column) of pixels is REPEATED by the "Clamp" setting of the sampler. Result is a shadow "streak" that continues from the edge of map into the distance on the ground.

To eliminate those streaks, give full illumination when "outside" of shadow map,
I added test to my lookup function to return full illumination (1.0) if UV outside of valid range:

if (texCoord.x < 0 || texCoord.x > 1 || texCoord.y < 0 || texCoord.y > 1)
    return 1.0f;

... followed by the code that looks up in shadow map, returns an illumination in range 0..1.

This works.

I have two questions about this:

Is there a more efficient way to test these 4 conditions, or to avoid the need to test?
Is there an efficient way to solve this when the shadow map is created?
The sampler is set to "clamp", so if the first and last row and column of map were all "untouched" (held the default depth value or illumination value, depending on the shadowing technique), then I would not need to do any special tests when using the map; "clamp" would retrieve an edge pixel, so if those all were "untouched" by shadows, I would get the desired result.

2.b. It just occurred to me that one solution to (2) is to write the default value back into the four edge rows/columns. [after all shadows are rendered]  What is an efficient way to do that?

sentences:
How to get object to lose less velocity as its speed increases I'm developing a game in Flash and I need a little help. It can be considered a math problem.

My object is flying with speed X and my object can collide with stones. When it collides with a stone, I need my object to break the stone and continue, but with less velocity.
It's easy to hard-code it and write something like: myVelocity -= 10;, but my main problem is that I want it to lose less velocity the higher the initial velocity is.

For example: If the velocity is 300 I want it to lose 10 and if it was 200 I want it to lose 20.

Can this be done with some kind of formula?

sentences: Unity Editor wont open When attempting to open an old project or create and open a new project unity won't open. The hub will open and when you choose a project it will close and then nothing will happen. Also when a new project it will state the unity version for the new project as unknown. I have tried uninstalling, deleting all the files under the registry editor, and also removing the files from the appdata and reinstalling and it doesn't appear to fix it. Does anyone have any suggestions on how I can fix this?

sentences:
Saving settings when exiting the application I created a static class CustomPlayerPrefs, it has a WriteToDisk() method that writes the saves to disk.
For saving I am using Application.quiting event:
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
static void Init()
{
    Application.quitting += WriteToDisk;
}

But on android it never works. I know that applications are not closed but paused, but it doesn't even work when I restart the device or force the application to stop.
How to fix this or how to make it better?
Need IOS and Android support.

sentences:
How to load background image in sprite class in libgdx? How can I insert a background image in sprite class?
here is my code..Thank's and advance

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Sprite implements ApplicationListener {
// Constant rows and columns of the sprite sheet
private static final int FRAME_COLS = 5, FRAME_ROWS = 1;
// Objects used
Animation<TextureRegion> walkAnimation; // Must declare frame type (TextureRegion)
Texture walkSheet;
SpriteBatch spriteBatch;

// A variable for tracking elapsed time for the animation
float stateTime;

@Override
public void create() {
    // Load the sprite sheet as a
    walkSheet = new Texture(Gdx.files.internal("cat2.png"));
    // Use the split utility method to create a 2D array of TextureRegions. This is
    // possible because this sprite sheet contains frames of equal size and they are
    // all aligned.
    TextureRegion[][] tmp = TextureRegion.split(walkSheet,
            walkSheet.getWidth() / FRAME_COLS,
            walkSheet.getHeight() / FRAME_ROWS);

    // Place the regions into a 1D array in the correct order, starting from the top
    // left, going across first. The Animation constructor requires a 1D array.

    TextureRegion[] walkFrames = new TextureRegion[FRAME_COLS * FRAME_ROWS];
    int index = 0;
    for (int i = 0; i < FRAME_ROWS; i++) {
        for (int j = 0; j < FRAME_COLS; j++) {
            walkFrames[index++] = tmp[i][j];
        }
    }
    // Initialize the Animation with the frame interval and array of frames
    walkAnimation = new Animation<TextureRegion>(0.075f, walkFrames);

    // Instantiate a SpriteBatch for drawing and reset the elapsed animation
    // time to 0
    spriteBatch = new SpriteBatch();
    stateTime = 0f;
}

@Override
public void resize(int width, int height) {

}
@Override
public void render() {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear screen
    stateTime += Gdx.graphics.getDeltaTime(); // Accumulate elapsed animation time

    // Get current frame of animation for the current stateTime
    TextureRegion currentFrame = walkAnimation.getKeyFrame(stateTime, true);
    spriteBatch.begin();
    spriteBatch.draw(currentFrame, 50, 50); // Draw current frame at (50, 50)
    spriteBatch.end();

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void dispose() { // SpriteBatches and Textures must always be disposed
    spriteBatch.dispose();
    walkSheet.dispose();
}

}

sentences:
OpenGL - white edges on cubes In a minecraft-like game I'm making, I get white edges on my cubes:

It is much more noticeable in darker textures. The textures are being setup like this:
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

Any help?

sentences:
How can I start a new row when instantiating UI elements in a grid? using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class SavedGamesSlots : MonoBehaviour
{
    public GameObject saveSlotPrefab;
    public float gap;

    private Transform slots;
    private string[] imagesToLoad;

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

        imagesToLoad = Directory.GetFiles(Application.dataPath + "/screenshots", "*.png");
        //slots = GameObject.Find("Slots").transform;
        slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

        for (int i = 0; i < imagesToLoad.Length; i++)
        {
            var go = Instantiate(saveSlotPrefab);
            go.transform.SetParent(slots);

            Texture2D thisTexture = new Texture2D(100, 100); //NOW INSIDE THE FOR LOOP
            string fileName = imagesToLoad[i];
            byte[] bytes = File.ReadAllBytes(fileName);
            thisTexture.LoadImage(bytes);
            thisTexture.name = fileName;
            GameObject ChildGameObject = go.transform.GetChild(1).gameObject;
            ChildGameObject.GetComponent<RawImage>().texture = thisTexture;
            var raw = go.GetComponent<RectTransform>();

            if (counter == 3)
            {
                raw.anchoredPosition = new Vector3(1 , 0.3f, 0);
                counter = 0;
            }
            else
            {
                raw.anchoredPosition = new Vector3(1 + counter * gap, 6, 0);
            }

            counter++;
        }
    }

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

    }
}

Now it's creating a line of 3 objects but then when it's filled with 3 objects in a line I want it to move one step down and start a new line of 3 and so on.
The problem is I can't make it automatic move one step down with the right gap on the Y and start a new line.
I'm doing the new line with this :
raw.anchoredPosition = new Vector3(1 , 0.3f, 0);

but the result is that the fourth object is too much down :

And it should be like this :

sentences:
How does Blizzard manage to support Mac OS and Windows in their games? I've always thought that using Direct X for Windows was the most powerful, easy and modern method to create games with modern graphics, nowadays. Knowing that it's only Windows, I thinks it's pretty difficult to make something similar on other platforms; Mac OS, to be exact. However, Blizzard somehow managed to deliver Starcraft 2 for Mac OS, and Diablo 3 will be available for Mac, too.

So what I'm interested in is information about:

what technologies are they using for their game engines?
are they using one engine for both games (Starcraft 2 and Diablo 3), or do they develop custom engines for each game?
what are they paying, in terms of time and money, for Mac OS support?

sentences:
Client-side login and password save I'm wondering what would be the best way to store password and login in the client. Many people complain that they need to re-enter this every time they log in and they want me to make a way to save it. But how to save it? Saving it as plain text in game folder wouldn't be clever, but neither would encrypting it help so much. It would still be easy to decrypt the data.

How would you do that?

Best regards!

sentences:
LibGDX - button change image on hover over time As we all know, LibGDX has a TextButtonclass which has a TextButtonStyle and ButtonStyle. The style has some parameters:

up - an image which is shown normally as a button background
down - shown when the button is being 'pressed'
over - on hover

My question is:
Is there any way to implement the 'hovering' / changing the background image IN TIME? So for example it takes 2 seconds and it's smooth?

I tried with actions and tween engine, but honestly, I really have no idea how I should implement this. Maybe some alpha operations?

If you have any ideas, I would be grateful :)

sentences:
Position sprite at center of screen I am trying to get a sprite to position itself at the center of the screen but nothing seems to be working for me.
I'm trying

Viewport viewport = graphics.GraphicsDevice.Viewport;
logoPosition = new Vector2((viewport.Width - towerImage.Width) / 2,
                           (viewport.Height - towerImage.Height) / 2);

and

spriteBatch.Draw(towerImage, centre, null, Color.White, 0, baseOrigin, 1.0f, SpriteEffects.None, 0);

This is my first time using XNA and I don't really have a clue what I'm doing.

sentences:
How do you technically represent a procedurally-generated map in the scene? I've always wanted to create the type of map generator they use in Kingdoms and castles. Basically you provide a seed, and it generates land/water/trees/resources. Their maps are also completely flat (except water seems to be 1-2 positions down, which I assume would make it easier.

However I do not know where to look for guidance for this type of system, I am wondering if anyone can explain the logic of how that type of system works, or even better, point me to a tutorial that could get me started.

While there are tutorials on perlin noise and the like, I never really understood how to connect it to a proper tile, and what properties that tile should have, does it need colliders? is each tile a gameobject? If not, how do I create tiles with trees/rocks that I can gather? and so on.

sentences:
Experience embedding javascript I'm looking into scripting languages to embed in my game.

I've always assumed Lua was the best choice, but I've read some recent news about embedding V8 as was considering using it instead.

My question is two fold:

Does anyone with experience embedding v8 (or another javascript engine) recommend it?

How does it compare with embedding Lua?

I like that v8 has a c++ embedding API.  However Lua API has had lots of time to be refined (newer isn't always better and all that).

Note: At this point I'm not too concerned with which is better language or which library has better performance.  I'm only asking about ease of embedding.

sentences:
How do I set the gravity of a plane world As you can see in the image, the character is set to move on a ground plane, however that causes an issue with Box2d's gravitational pull.
The player can go sideways, upwards and downwards on the plane.
Is there any way I can use gravity in this case?

sentences:
What am I supposed to pass shaders to? I don't think I fully understand how rendering shaders work. I get that you give a shader to an object/sprite when drawing it, and it applies the shader to it. But I don't think I'm doing it right.

For example, I wrote a shader for when the player is underwater. It makes the player sway side to side, but the problem is I'm not sure how to tell when I can use it. Do I loop through all the water blocks, and If the player intersects, run the shader on the player? This brings up the problem where all of the player would wave instead of just the part of him below the water.

I'm not sure what else I could do, and I apologize if this sounds confusing, I'm very confused myself and am not sure how to explain it. Do I run the shader on the water and somehow get it to run on all the pixels intersecting the water? What do I do? Also, just to make sure, I am using 2D.

sentences:
Vector3 Array serialization ReorderableList I've been working on a ReorderableList, but it's given me quite the headache. I've come to the point where I want to define a "drawElementCallback" -callback, which looks like this:

list.drawElementCallback = (rect, index, active, focused) => {
    EditorGUI.PropertyField(rect, list.serializedProperty.GetArrayElementAtIndex(index), GUIContent.none);
};

What it's supposed to draw is one Vector3 object from an array of Vector3 objects. I get this property like this: ("property" is a SerializedProperty that contains the property that I need)

SerializedProperty locationsProperty = property.FindPropertyRelative("locations");

The array is declared as follows:

public Vector3[] locations;

Inside a container class that is marked as "Serializable".

The problem I kept getting with different code is that the ReorderableList shows all the Vectors correctly but it doesn't allow me to reorder any of the items, nor delete them (I can add new Vector3 objects and change them as expected).

With this code, I wanted to fix that issue. However, now I keep getting the following error:

"InvalidOperationException: The operation is not possible when moved past all properties (Next returned false)"

I wanted to make a reorderable list because it seemed easy, but I can't figure out the problem and I honestly wish I hadn't started working on it. It's taken up most of the past 3 days.

If anyone knows how to fix this, I would be very grateful.

To clarify, this code shows the array properly:

list.drawElementCallback = (rect, index, active, focused) => {
    SerializedProperty item = locationsProperty.GetArrayElementAtIndex(index);

    EditorGUI.BeginChangeCheck();
    item.vector3Value = EditorGUI.Vector3Field(rect, string.Empty, item.vector3Value);
};

But doesn't allow me to remove or reorder items. I thought I should show the code to demonstrate that there are indeed array items.

sentences: Two game object efficient and fast on-off switch I have two game-object, on GUI button click i am toggle between them but the problem is one game-object which is small contains less vertx etc., is loading fast while the other which heavy taking time. How do i efficiently and quickly load it ? I don't want to show loading window i want to load that game-object quickly?

sentences:
Flipped camera with Google VR I just imported latest Google VR SDK into Unity and made a simple scene that has only Main Camera, plane, and single zombie just standing there with T-Pose.

In Main Camera, I added GvrPointerPhysicsRayer component, and it has GvrReticlePointer as child object.

Running in Unity Editor seems fine but when I build and run, whole world is just flipped.

I can't find any related issues about this anywhere, and struggle with this almost a day.

Why camera flipped and how do I fix it? What am I missing?

Using Unity 2019.1.0f2 and gvr-unity-sdk@1.200. Any advice will very appreciate it.

P.S. I saw the warning message in project settings - default orientation:

  Virtual Reality Support is enabled. Upon entering VR mode, landscape left orientation will be the default orientation unless only landscape right is available.

This message never disappear whatever default orientation selected.

sentences:
Smoothing edges on procedural terrain Using perlin noise to create a procedural island for a tile-based game. My map is stored in a 2d array, with each tile having a type (deep water, shallow water, beach, grass, forest, hill, mountain).

What would be the most efficient way to go through my map, after it's generated, and smooth out the edges of the terrain? Using a tileset, we run into issues with a 1x1 tile that sticks out by itself.

sentences:
Calculating the correct roll from a bone transform matrix Read this forum topic for more info: http://blenderartists.org/forum/showthread.php?260602-transform-matrix-to-bone-%28head-tail-roll%29-bug

I'm trying to get my Blender3d modeller importer to create correct bones from my file's transform matrices.

The Blender Python API doesn't have a way to do this (anymore!), so people had to dig the Blender C source to find out how Blender does it and port that. Here's a Python port of the needed functions, not by me (I don't know C):

def vec_roll_to_mat3(vec, roll):
    target = mathutils.Vector((0,1,0))
    nor = vec.normalized()
    axis = target.cross(nor)
    if axis.dot(axis) > 0.0000000001: # this seems to be the problem for some bones, no idea how to fix
        axis.normalize()
        theta = target.angle(nor)
        bMatrix = mathutils.Matrix.Rotation(theta, 3, axis)
    else:
        updown = 1 if target.dot(nor) > 0 else -1
        bMatrix = mathutils.Matrix.Scale(updown, 3)
    rMatrix = mathutils.Matrix.Rotation(roll, 3, nor)
    mat = rMatrix * bMatrix
    return mat

def mat3_to_vec_roll(mat):
    vec = mat.col[1]
    vecmat = vec_roll_to_mat3(mat.col[1], 0)
    vecmatinv = vecmat.inverted()
    rollmat = vecmatinv * mat
    roll = math.atan2(rollmat[0][2], rollmat[2][2])
    return vec, roll

How to use them:

pos = mymatrix.to_translation()
axis, roll = mat3_to_vec_roll(mymatrix.to_3x3())

bone = armature.edit_bones.new('name')
bone.head = pos
bone.tail = pos + axis
bone.roll = roll

Sadly, it seems even the Blender C code is buggy and doesn't take into account cases when the bone is parallel to (0,1,0). So such bones can get assigned wrong (by 180 degrees) rolls and mess up animations.

Does anyone have better code for generating roll which takes into account such cases?

The old Blender 2.4 API generated correct ones. Its C code can be found here: http://svn.blender.org/svnroot/bf-blender/branches/blender-2.47/source/blender/blenkernel/intern/armature.c
I'm no C coder myself, again.

sentences:
Are there ways to limit players other than a conventional currency system or a resource system? I'm making a 2D strategy game. I want to create something unlike the current resource management type games I regularly see tagged as strategy.
My goals are:

To force the player to think about their decisions
To allow for experimentation easily and without sacrificing previous progress
To allow for multiple ways of solving problems presented in the game
To eliminate grinding simply because it won't work in whatever system I use

In effect, I want some way to limit the player and force them to make hard decisions, without using a commonly used currency or resource/crafting system, to cut down on grinding.
However, I'm actually having a little trouble implementing this sort of idea alongside the idea of progression.
My original idea was to introduce a cap on how many of each type of item a player could have at any one time. In effect, this introduces some elements of an open-ended puzzle game. However, this limits progression:

If the number of items the player can have increases over time, this means that each individual item's significance decreases over time. This has the effect of making decisions easier over the course of the game. Not what I want.
If the items get more powerful over time, then items acquired near the start of the game have no viability later on. I would like items to be at least partially viable at any stage of the game, to increase variety and make the game less linear. It turns the game into replacing old with new.
Only increasing the variety of items over the course of the game is a sure-fire way to lose players early if they believe they are not making progress.

My implementation is workable, but simply not good enough for my personal standards and goals.
Is there a better way to let limits, choice and progression go hand in hand?
I use the word "item" here not just to refer to items in game, but other things such as spells, moves, buildings, etc. that a player could acquire  and use in the game.

sentences: How to create life-like sprites from photo or video capture like was done for games like Mortal Kombat 1? I know they digitized actors but how can I get those same results? How to take a photo or video of someone and digitize it for a 2D game? Digitized sprites were used in several video games through the 90s but fell out of favor when textured 3D graphics became more common.  What technology is used today for creating MK1 realism?

sentences:
Blinn, Normal maps & Fresnel? So something came up today when I was going over my Blinn shader. As I've been taught, the half-angle vector is calculated in the fragment shader, and is equal to normalize(lightDir + viewDir). This seems to work fine.

When adding a normal map, this still seems to works, except I use tangent space vectors and dot the half-angle with the normal from the normal map.

But here's what I don't understand: when using normal maps, shouldn't the light & view directions be re-computed for each fragment? Seeing as the interpolation between the vectors is no longer linear, lightDir and viewDir can't possibly be correct anymore?

Somehow I feel like the per-pixel normal should play a part in calculating the view/light directions. Am I missing something?

This came up when working on a fresnel effect which also uses the half-angle vector. Without any changes to the half-angle vector, the fresnel effect can't possibly know anything about the normal map, which seems wrong (and actually looks wrong).

Here's the fresnel calculation:

 // Fresnel (Schlick approximation)
 float base = 1 - dot(viewDir, halfAngle);
 float exp = pow(base, 5);
 float fresnel = exp + fZero * (1.0 - exp);

Given that neither viewDir nor halfAngle incorporate the normals from the normal map, the fresnel effect is computed based on interpolated normals and looks "blocky". Maybe this isn't a problem for the Blinn computation, but I thought it might be too.

sentences:
Is it safe to run multiple XNA ContentManager instances on multiple threads? My XNA project currently uses one ContentManager instance, and one dedicated background thread for loading all content.

I wonder, would it be safe to have multiple ContentManager instances, each in it's own dedicated thread, loading different content at the same time?

I'm prompted to ask this question because this article makes the following statement:

  If there are two textures created at the same time on different
  threads, they will clobber the other and you will end up with some
  garbage in the textures.

I think that what the author is saying here, is that if I access one ContentManager simultaneously on two threads, I'll get garbage. But what if I have separate ContentManager instances for each thread?

If no-one knows the answer already from experience, I'll go ahead and try it and see what happens.

sentences:
Is there is a way to mask sprites in Spriter? I am very new to Spriter. I want a sprite to be only displayed when it is above particular sprite.

How can achieve this?

sentences: Does it make sense for a view matrix to have a scale? When building a view matrix from an SRT matrix multiply, examples (here and here) only ever compose it with a R and T. Does it make sense to have the S component be anything other than the identity? What does it mean to scale the view matrix anyway?

sentences:
What projection is this? Could someone tell me what this projection is called?

It's as if you are looking at an object from directly above it and then smear it up and left equally. Only the one dimension seems to be true scale while the other two are skewed.

I'm not finding many games that uses this style, but some of the Ultima Series seemed to or at least something similar:

sentences:
openGL Vertex Projection does not work as expected I try to render a simple grid using glBegin(GL_LINES).
I have a class Camera, which provides values like this:

float farPlane = 100.0f;
float nearPlane= 0.1f;

float screenRatio = 1,42857; //width/height = 1000/700
float frustum = 70.0f;

glm::vec3 position = glm::vec3(3.0f, 3.0f, 3.0f);

glm::vec3 UP = glm::vec3(0.0f, 1.0f, 0.0f);
glm::mat4 view = glm::lookAt(position, position - glm::normalize(position), UP); // makes the lookAt vector always point towards (0, 0, 0)
glm::mat4 projection = glm::perspective(frustum, screenRatio, nearPlane, farPlane);

using the view and projection matrices, i transform every vertex from my Grid model and render it.

glm::mat4 viewProjectionMatrix = Graphic::camera->getViewProjectionMatrix(); // returns Camera::projection * Camera::view
glBegin(GL_LINES);
for (unsigned int i = 0; i < vertexNum; ++i) {
    glColor3f(vertexArray[i].normal.x, vertexArray[i].normal.y, vertexArray[i].normal.z); // normal vector is used for color in this case
    glm::vec4 translatedPosition(viewProjectionMatrix*gridTransformationMatrix*(glm::vec4(vertexArray[i].position, 1.0f)));
    glVertex3f(translatedPosition.x, translatedPosition.y, translatedPosition.z);
}
glEnd();

but this is what i see when i move the camera along the line: (0,0,0) + u*(1,1,1)
http://i.imgur.com/PrcDcLs.gifv
(you can see the camera cooridnates in the console)

sentences:
How to take into consideration the effect of initial rotation of a ball hitting & reflecting off a surface Hey all, I am trying to take into consideration the effect of inertia of the initial rotation of a ball, hitting a surface, into the exit velocity vector of the ball.

My current theory is this:

Assume Ball initial rotation is Ri
Calculate an exit Velocity vector
without any consideration for the
ball's initial rotation, call this
Ve
Rotate Ve by an angle proportionate to Ri [while limiting the rotation, so ball new vector does not point into surface]. Call this new vector rVe
Calculate exit rotation of ball, by calculating it as a portion of max ball rotation speed, bas on angle between rVe & Vi using dot product of these two vectors

Does this sound right to you? Am I missing something here? Is there an easier way to do this?

sentences: Change localScale.x in Unity without creating a new Vector3 Is it possible to change localScale.x in Unity without creating a new Vector3?

sentences:
How to centralize stat/feat/equipment related changes in an RPG? I have a game with an RPG system where derived stats, like HP,armor, etc depend on a variety of components: armor, stats and feats. I'm running into an issue where the code to change derived metrics gets spread throughout the game - some is in the inventory module, another in stats module, another in buffs module.

How can I centralize and ensure accuracy of all my stat/equipment related changes to the character?

I thought that I can just create a "mega method" within the character class that would recalculate everything any time I change anything within the formula, but I don't know if this recalculate everything is a good practice, or if there are potential pitfalls with this approach down the road.

One of the complications with the complete rebuild that I see is that I will have to keep track of the player's HP and properly restore it after rebuild is complete.

sentences:
How can I cull non-visible isometric tiles? I have a problem which I am struggling to solve. I have a large map of around 100x100 tiles which form an isometric map. The user is able to move the map around by dragging the mouse. I am trying to optimize my game only to draw the visible tiles.

So far my code is like this. It appears to be ok in the x direction, but as soon as one tile goes completely above the top of the screen, the entire column disappears. I am not sure how to detect that all of the tiles in a particular column are outside the visible region.

    double maxTilesX = widthOfScreen/ halfTileWidth + 4;
    double maxTilesY = heightOfScreen/ halfTileHeight + 4;

    int rowStart = Math.max(0,( -xOffset / halfTileWidth)) ;
    int colStart = Math.max(0,( -yOffset / halfTileHeight));

    rowEnd = (int) Math.min(mapSize, rowStart + maxTilesX);
    colEnd = (int) Math.min(mapSize, colStart + maxTilesY);

EDIT - I think I have solved my problem, but perhaps not in a very efficient way. I have taken the center of the screen coordinates, determined which tile this corresponds to by converting the coordinates into cartesian format. I then update the entire box around the screen.

sentences:
SDL2 jagged/staircase edges I am using SDL2 and SDL2 Image to render png images.

When I rotate the textures, they turn out very ugly, like this:

This is the code responsible for the rotation and alpha mod.

SDL_Rect srcRect;
SDL_Rect destRect;
srcRect.x = width * currentFrame;
srcRect.y = height * currentRow;
srcRect.w = destRect.w = width;
srcRect.h = destRect.h = height;
destRect.x = x;
destRect.y = y;

SDL_SetTextureAlphaMod(m_textureMap[id], alpha);
SDL_RenderCopyEx(pRenderer, m_textureMap[id], &srcRect, &destRect, 10.0, 0, flip);

Do I need to set a blendmode too?

sentences:
Remove background from sprite sheet after splitting I am using libgdx to implement a Parallax background. Now I need to show some animated object over the background. I downloaded a sprite sheet(with images of objects on white background), and split it using TextureRegion.split() method. But when I draw the objects to screen, white background is shown along with the object as in this image:

I tried using batch.enableBlending() but it didn't work. Is there any way to resolve this issue? Or should I code only using individual sprites with transparent background? Here is a brief code snippet :

public class Animator extends Actor{
        int FRAME_COLS = 3, FRAME_ROWS = 3;

        Animation<TextureRegion> eagleAnimation;
        Texture eagleSheet;
        float stateTime;

        Animator(Texture sheet) {
            eagleSheet = sheet;
            TextureRegion[][] tmp = TextureRegion.split(eagleSheet, eagleSheet.getWidth()/FRAME_COLS,
                    eagleSheet.getHeight()/FRAME_ROWS);
            TextureRegion[] eagleFrames = new TextureRegion[FRAME_COLS*FRAME_ROWS];

            int index = 0;
            for(int i = 0; i < FRAME_ROWS; i++) {
                for(int j = 0; j < FRAME_COLS; j++) {
                    eagleFrames[index++] = tmp[i][j];
                }
            }

            eagleAnimation = new Animation<TextureRegion>(0.09f, eagleFrames);
            stateTime = 0f;
        }

        @Override
        public void draw(Batch batch, float parentAlpha) {
            stateTime += Gdx.graphics.getDeltaTime();

            TextureRegion currentFrame = eagleAnimation.getKeyFrame(stateTime, true);
            batch.enableBlending(); // doesn't work
            batch.draw(currentFrame, 250, 250, 264, 264);

        }

    }

This is where I call above class from :

    public class GameScreen implements Screen {

        MyGdxGame game;

        Texture eagleSheet;
        OrthographicCamera camera;
        Array<Texture> layers;
        Stage stage;

        public GameScreen(MyGdxGame game) {
            this.game = game;
            stage = new Stage(new ScreenViewport());
            camera = (OrthographicCamera) stage.getViewport().getCamera();

            layers = new Array<Texture>();

            for(int i = 1 ; i <= 6; i++) {
                layers.add(new Texture(Gdx.files.internal("parallax/img" + i + ".png")));
            }
            ParallaxBackground parallaxBackground = new ParallaxBackground(layers);
            parallaxBackground.setSpeed(1);
            parallaxBackground.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
            stage.addActor(parallaxBackground);

            eagleSheet = new Texture(Gdx.files.internal("eagle.png"));
            Animator animator = new Animator(eagleSheet);
            animator.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
            stage.addActor(animator);

        }

        @Override
        public void render (float delta) {
            Gdx.gl.glClearColor(1, 0, 0, 1);
            Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

            stage.act();
            stage.draw();

        }

        @Override
        public void dispose () {
            stage.dispose();
        }

        @Override
        public void show() {}

        @Override
        public void hide(){}

        @Override
        public void resume(){}

        @Override
        public void resize(int x, int y){}

        @Override
        public void pause(){}

    }

sentences:
How to render the sprites for a 2D soft body physics system This is not a question as to how to achieve soft body physics, but rather if I have a mass-spring system how to modify a sprite with that information.
I am using unity so I dont have access to vector based graphics.

sentences:
SpriteBatch being drawn outside of Stage? Currently working on my first game, though running into some problems with libgx and screen aspect ratio.

What I have is a Stage which contains things like menu buttons etc, and the rest of the game is pretty much sprites being drawn with via SpriteBatch. To avoid having multiple SpriteBatches and cameras, I have re-used the ones that are created when Stage is created.

    stage = new Stage(WIDTH, HEIGHT, true); // keep aspect ratio
    batch = stage.getSpriteBatch();
    camera = (OrthographicCamera) stage.getCamera();
    // move camera so 'active' screen is centred
    stage.getCamera().translate(-stage.getGutterWidth(), -stage.getGutterHeight(), 0);

Anything that is Stage/Actor related is drawn fine - all goes within the aspect ratio adjusted boundaries.

The problem I'm having is anything that drawn via SpriteBatch, seems to ignore this viewport that is defined by Stage and can be visible outside of the Stage area.

batch.begin();
...
sirWuffles.draw(batch);
...
batch.end();

For example, in the above, if Sir Wuffles is generated outside of the defined WIDTH/HEIGHT it might still appear in the "gutters" of the screen.

Tried to explain it in the below screenshot. It's an exaggerated screen ratio to make the gutters large. I've also covered most of the gutter area in the blue/cyan rectangle so they are very obvious.

Does anyone know what is happening? and how to fix it?

Currently, my "fix" is to use ShapeRenderer to draw rectangles that correspond to the gutters on top of the sprites...

sentences:
What are some tried-and-true combat models? I'm thinking about starting a text-based RPG game using Javascript (Similar to a text adventure, but with a much more refined item/fighting system). I've had some experience with playing RPG games, but before I begin, I want to find out what some good "combat models" are. When I say combat model, I mean a tried-and-true system of how a player's strength and weapons affects his attack, defense, etc. There are a few points I'd like to hear some more about:

How would I create a good attack for a player including weapons and traits?
What about defense?

Thanks, Elliot Bonneville

sentences:
How to rotate a sprite using multi-touch with AndEngine? I am new to Android game development. I am using AndEngine GLES-2. I have created a box with a sprite. This box is now draggable by using the code below. It works fine.

But I want multi-touch on this: I want to rotate the sprite with two fingers on that box, and to keep it draggable.

I've no idea how do do that, which way should I go?

final float centerX = (CAMERA_WIDTH - this.mBox.getWidth()) / 2;
final float centerY = (CAMERA_HEIGHT - this.mBox.getHeight()) / 2;

Box = new Sprite(centerX, centerY, this.mBox, this.getVertexBufferObjectManager()) {

    public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {

        this.setPosition(pSceneTouchEvent.getX() - this.getWidth()/ 2, pSceneTouchEvent.getY() - this.getHeight() / 2);

        float pValueX = pSceneTouchEvent.getX();
        float pValueY = CAMERA_HEIGHT-pSceneTouchEvent.getY();

        float  dx = pValueX -  gun.getX();
        float  dy = pValueY -  gun.getY();

        double  Radius = Math.atan2(dy,dx);
        double Angle = Radius * 360 ;

        Box.setRotation((float)Math.toDegrees(Angle));
        return true;
    }

sentences:
How to create realistic 2d lighting using colour temperature I'm looking for a lighting algorithm that produces realistic lights expressed in kelvins, from about 2500k to 6500k. What I'm confused about is how to make the lights properly interact with the colors of game objects.

If a whole level is fully lit (overcast daylight) then it would seem that I should use just the color of the object. But what if I'm in a closed room with no windows, and there is an incandescent bulb shining light in the room? How would that light properly light up the objects in the room?

There does not seem to be an obvious solution to the problem. And simply mixing the color of the light with the colors of the object, seems an inaccurate approach.

sentences: Stencil buffer mask calculation I dont understand how exactly stencil buffer works in openGL. One aspect that confuses me is why do we use a bit operator there in glStencilFunc. Some text say that is is used to achieve multiple stencil planes but I am not sure how that can be done. Can anybody please explain the whole procedure of stencil buffer calculation during the rendering cycle. Thank you.

sentences:
Which DirectX Version to use for a low poly game? Which DirectX Version (10, 11 or 12) is recommended to use, if you want to have a low-poly game with shaders, shadow and aliasing. But not normal or height maps. Moreover my question is, because once we upgraded from directx 9 to 11 now, the GPU usage for the game was like duplicated. I can not even play it with CPU at all. It means directx 11 has higher usage even then 9.

If using Directx10, could it help to decrease the gpu usage? (Which was caused by directx upgrade)

sentences:
How can I verify that a Steam key is legit? I am developing a game that has online multiplayer. It will be available on Steam.

However, I do not want to use Steam authentication to use the online capabilities. I will use my own account system, so you must register with your email and password.

Which brings me to the next problem: how can I verify if this newly created account is a legit owner of the game in Steam? I can ask the player to provide their license key, but how could I verify that this key is valid? Does the Steam web API have a way to check if a key is valid, regardless of having been used to redeem the product or not?

sentences:
ecs network synchronization I'm working on implementing combat into my isometric rpg game which uses an ecs architecture. When synchronizing the actions of the different clients, is it preferable to serialize and synchronize raw components, actions or a mix of both.
For example, an action might be "entity X attacks entity Y", whereas the components approach would need to send stuff more like raw component state (which animation to play, frame, sound, etc). I currently use an action-based approach for movements, and that works very well locally, but implementing combat this way seems more difficult as systems become more complex and components are added down the road, and I want to be as aware as I can about possible friction now.

sentences:
In Unity, how do I correctly implement the singleton pattern? I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating and validating a singleton.

Is there a correct, or rather, preferred approach to this?

The two main examples I have encountered are:

First

public class GameManager
{
    private static GameManager _instance;

    public static GameManager Instance
    {
        get
        {
            if(_instance == null)
            {
                _instance = GameObject.FindObjectOfType<GameManager>();
            }

            return _instance;
        }
    }

    void Awake()
    {
        DontDestroyOnLoad(gameObject);
    }
}

Second

public class GameManager
{
    private static GameManager _instance;

    public static GameManager Instance
    {
        get
        {
            if(_instance == null)
            {
                instance = new GameObject("Game Manager");
                instance.AddComponent<GameManager>();
            }

            return _instance;
        }
    }

    void Awake()
    {
        _instance = this;
    }
}

The main difference I can see between the two is:

The first approach will attempt to navigate the game object stack to find an instance of the GameManager which even though this only happens (or should only happen) once seems like it could be very unoptimised as scenes grow in size during development.

Also, the first approach marks the object to not be deleted when the application changes scene, which ensures that the object is persisted between scenes. The second approach doesn't appear to adhere to this.

The second approach seems odd as in the case where the instance is null in the getter, it will create a new GameObject and assign a GameManger component to it. However, this cannot run without first having this GameManager component already attached to an object in the scene, so this is causing me some confusion.

Are there any other approaches that would be recommended, or a hybrid of the two above? There are plenty of videos and tutorials regarding singletons but they all differ so much it is hard to drawn any comparisons between the two and thus, a conclusion as to which one is the best/preferred approach.

sentences:
Pause on scrolling backgrounds I have a typical parallax backgrounds. They are scrolling by

public float Speed=0f;

void Update ()
{
    renderer.material.mainTextureOffset = new Vector2 (Time.time*Speed,0);
}

I have a character. OnKeyDown he starts to move: Speed of background sets to 0.4f for example. OnKeyUp a character stops by setting the speed of background 0f.
The problem is: when backgrounds stop to scroll, they return to its start position. They must just to pause the position. How to do?

sentences:
Rendering mountains around a tile layer When making a 2D Pokémon game, I just faked elevation by putting mountain tiles underneath the land. Now my tiles are 3D models, so I'm using layer properties to define their elevation. What I don't know though is how to generate a 'mountain' around them.

The tilemap is kinda' like this:

Layer 1: Layer 2: Layer 3:
....     \\\\     \\\\
....     \..\     \\.\
....     \..\     \\\\
....     \\\\     \\\\

Layer 2 has y-offset set to 1, and Layer 3 has y-offset set to 2. All they do right now is float in the air. What I'm trying to do is render a mountain around them.

sentences:
Why is the "back" key acting like it is pressed twice? I want to show toast message when the user presses the back button.
I am handling button using this code, which is in my Update function:

if (Input.GetKeyUp(KeyCode.Escape)) {
  print ("UPUP");
  ToastHelper.ShowToast ("Back", false);
  //Application.Quit();
}

ToastHelper is plugin here.

The issue is that the toast message shows up twice, so it seems like the back key is acting like it was pressed twice. I only want it to execute once.

sentences:
Should larger Unity Projects use Visual Studio I've worked with several engines and I'm most comfortable with a mature engine, world editor and C++ codebase.

I'm now looking at Unity as a side-project and have mostly been working in Javascript.

Has anyone done a large scale project with Unity and does it require Visual Studio or is sticking to the Javascript approach best?

Are there any big pitfalls with large scale Unity projects or with working with Visual Studio?

Most the stuff I've seen has been focused at smaller Indies or people with little experience.

I should have phrased this as an external IDE, Visual Studio is just my IDE of choice

sentences:
Static variable not holding its value I am creating a real time multiplayer game in Unity 3d. When a game ends I set a static boolean value called "waitingToEndGame" to true. In Update() it waits a few seconds before moving to a new scene like this:

if (waitingToEndGame)
{
    waitTime += Time.deltaTime;
    if (waitTime >= 5f)
    {
        showGameScores = false;
        waitingToEndGame = false;
        if (type == "Multiplayer") MultiplayerController.Instance.LeaveGame();
        GameObject levelManager = GameObject.Find("Level Manager");
        levelManager.GetComponent<LevelManager>().LoadLevel("MainMenu");
    }
    DisableAllMovingObjects();
}

My problem is that even though I am setting the boolean value to true it acts as if it doesn't change and it doesn't make it into the code above to move to the main menu. I even had debug statements printing here as well and they seem to just suddenly stop.

sentences:
Would studying psychology give an advantage to a game designer? I've recently read The Art of Game Design and am currently reading Why Reality is Broken and am wanting to learn more about the psychology behind game design. I'm a computer science student but I'm intrigued by the subject and have thought about minoring in psychology.

For the veteran game design people out there, would academically studying psychology give a huge advantage to a game designer? There is one class in particular called Sensation and Perception that gets into what goes on in the nervous system when we are stimulated through our five senses and how these stimulations creates certain perceptions.

So, basically is this over doing it for someone who wants to create games/become a game designer?

What originally caught my interest in this subject was reading about how zynga hired a psychologist to help design the mechanics for farmville.

sentences:
Was C++ designed for speed, and is it better to not use high level features when teaming with inexperienced programmers? I have read some optimisation guide for C++, and it seems it requires more knowledge to have a fast C++ code, than using C++ without the high level features of C++ (classes, templates, inheritance, etc.).

C++ is a powerful language, and will be the one used in game programming for a long time, and is still fast because it is a C subset, but as John Carmack said, it has to be used correctly: when dealing with programmers who can't guess alone how to make fast C++ code, isn't it a good idea to force them not to use high level features which can me more delicate to optimise ?

I know compilers do a very good job at optimizing the code they are being given, but they can't change it, or do they compilers that feature some sort of warnings that encourages a good use of OOP, or can compilers automatically optimize OOP code even if it is a slow one ?

EDIT:
I'm not bashing C++ high level features bere, I'm just talking about some of the very high level stuff like multiple inheritance and abstract classes.
Classes are awesome when just compared to struct's, but multiple inheritance is not that much a universal solution to all software problems.

sentences:
How do I access a variable from my code in Godot's editor? In Godot, I have a node with a variable that I often need to tweak for balancing purposes. It would be a lot easier to manage if I could modify it inside the editor instead of the code.

How would I go about doing this?

sentences: What is the best online game framework for Python? I want create online game with Python. Is there any framework or library to make it easier? I would like it if the framework provided things like character attributes, such as health.

sentences:
How much assembly is really used in modern game code? On average, how often is assembly used in modern game code?

Specifically on platforms that already have good C++ compilers, like x86, PPC, or ARM--because I assume games on embedded systems make extensive use of assembly.

sentences:
How to get a consistent behavior for a rigid body hooked platform? Consider this platform made of RigidBody2D and PinJoint2D objects:

PinJoint2D setup is:

Softness = 0
Bias = 0.9

When I set the mass of the platform with high value, the structure starts to shake like this:

Why is this happening and how to fix that?

sentences:
Alpha Blending performance on IOS I've got few questions without responses about my game development, can you help me? Here is the questions:

In my game when a large object appear on the screen, the GPU go to his limits, my framerate become very slow. How can I handle that? (I'm working on mobile). (
Currently, I'm sorting object from back to front)
I've read some stuff about batching (How to draw efficiently large number of objects with alpha blending?), how can I handle batching when my game need to draw my scene from back to front with alpha blending?
What is faster: Add a condition to test pixel transparency in fragment shader or enable Alpha blending? (I've got colors around my sprites without alpha blending or condition)

Thanks!

sentences:
Particle system prefab not instantiated I am trying to instantiate my fire particle system during runtime like this:

GameObject fire, firePrefab;

void Start()
{
    ...
    firePrefab = Resources.Load("FirePrefab") as GameObject;
}

void FixedUpdate()
{
   if (Input.GetKeyDown(KeyCode.V))
   {
       fire = Instantiate(firePrefab, transform.GetChild(3).position, transform.GetChild(3).rotation);
       Destroy(fire, 5.0f);
   }
}

My FirePrefab is just a regular particle system, and the model the above script is attached to looks like this:

  Model

    Default

    Camera

    DroneFire

However, my fire prefab isn't instantiated anywhere when I run the game.

sentences: Drag Object to Collide Unity Please help, I am developing a 2D game for a school project and I want to drag the apple to the think box then when it collides, the apple will go back to the original position then it will add 1 point to the score. I'm just new to Unity. So please help

sentences:
Changing balls direction in Pong I'm making a Pong game to get started with game-developement but
I've run into a problem that i can't figure out.

When trying to change the balls direction it doesn't change. This is the relevant code:

function moveBall(){
    this.speed = 2.5;
    this.direction = 2;
    if(this.direction == 1){
        ball.X +=this.speed;
    }
    else if(this.direction == 2){
        ball.X -=this.speed;
    }
}

function collision(){
    if(ball.X == 500){
        moveBall.direction = 2;
    }
    if(ball.X == 300){
        moveBall.direction = 1;
    }
}

Why doesn't it work? I've tried many different ways, and none of them seem to work.
The moveBall.direction changes though, since it alerts the new direction once it reaches the defined ball.X position.

If someone could help me I would deeply appreciate it.
I've included a JSFiddle link.

http://jsfiddle.net/hustlerinc/y4wp3/

sentences:
Most effective approach when creating % chance of something When dealing with % chance in a game what are the most effective ways to achieve this? When I use random.random()[python] or Math.random()[javascript] and use an if/elif/else conditional it seems like the things with a very low chance of happening, happened far more often than they should have.

For example, a python game I worked on used something like this:

qaul_eq = random.random()
if qual_eq <= .5:
   quality = common
elif qual_eq <= .75:
   quality = uncommon
elif qual_eq <=.9:
   quality = rare
elif qual_eq <=.97:
   quality = epic
else:
   quality = legendary

Javascript DEMO

There is a 2% chance that quality will be legendary yet when printed 20 times every time it is run at least 1 item in almost every test run is legendary. In my python game it isn't uncommon for 2 or 3 of the items to be legendary. I'd chalk it up to good luck if not for the large amount of test runs I have conducted.

sentences:
How to smoothly display opponents in realtime multiplayer game I'm implementing a small-scale multiplayer racing game. As of right now, the client sends updates to the opponents on a fixed interval (or as fast as possible), containing location on the map etc. Each client will then reposition that opponent on that location.

Obviously, this will not run smoothly due to network lag. The vehicles will jump between each location.

One solution for this would be to include the speed and direction with each update-package, and then keep the vehicle running as that until next update, and then animate a movement to the new position. Repeat.

This only works if the player drives predictably, e.g not reversing after update etc. It is not important that the sync is exact, but should be pretty close to the reality location-wise.

How to smoothly show opponents in a realtime multiplayer game?

sentences:
Collision detection with PyGame I have been making a 2d platformer using Python with PyGame. It has all be going good, but I have stumbled accross many problems with collision detection. Here they are:

You can't go through objects that have the exact space for you to go through
You can go through the ceiling (very weird)

The code I have is very big and I think that, since it involves multiple classes, I should post it on GitHub, so here is the link to my repository: https://github.com/pta2002/SuperBros.

But just for reference, here is my colliion detection method:

def detectCollisions(self, x1, y1, w1, h1, x2, y2, w2, h2):

    if x2 + w2 >= x1 >= x2 and y2 + h2 >= y1 >= y2:
        return 1

    elif x2 + w2 >= x1 + w1 >= x2 and y2 + h2 >= y1 >= y2:
        return 2

    elif x2 + w2 >= x1 >= x2 and y2 + h2 >= y1 + h1 >= y2:
        return 3

    elif x2 + w2 >= x1 + w1 >= x2 and y2 + h2 >= y1 + h1 >= y2:
        return 4

    else:
        return 0

and here is my update method:

def update(self, gravity, block_list):
    if self.velocity < 0:
        self.falling = True

    collision = 0
    blockX, blockY = 0, 0
    self.canMoveRight = True
    self.canMoveLeft = True

    for block in block_list:
        collision = self.detectCollisions(self.x, self.y, self.width, self.height,
         block.x, block.y, block.width, block.height)

        if not collision == 0:
            blockX = block.x
            blockY = block.y
            break

    if not collision == 0:
        if self.falling:
            self.falling = False
            self.onGround = True
            self.velocity = 0
            self.y = block.y - self.height
        else:
            if collision == 2:
                self.canMoveRight = False

            if collision == 1:
                self.canMoveLeft = False
    else:
        self.falling = True
        self.onGround = False

    if not self.onGround:
        self.velocity += gravity

    self.y -= self.velocity
    if (self.canMoveRight and self.xvel > 0) or (self.canMoveLeft and self.xvel < 0):
        self.x += self.xvel

    if self.jumping:
        if self.onGround:
            self.velocity = 8
            self.onGround = False

    if self.cur_image >= self.num_images - 1:
        self.cur_image = 0
    else:
        self.cur_image += 1

sentences:
Moving Objects Relatively With Their Parent Object [Gamemaker] I have an object type, oFur, instances of which are generated in a random distribution over the sprite area of a parent object, oFurArea.

However, I would like the oFurArea to change its image_xscale and image_yscale dynamically, as well as its y position. This is easy to do, but I would also like all of the oFur instances to move with their parent (i.e. change their own 'y' values), whilst maintaining their relative positions on the parent object.

Either I'm having a brain-fart, or I cannot work out how to do this. Any help would be appreciated.

sentences:
How to animate an arc from the middle in both directions I have been able to make an arc that animates from one end to another using the following coroutine:

 IEnumerator AnimateArc(float duration)
{
    float waitDur = duration / pts;

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

        float x = center.x + radius * Mathf.Cos(ang * Mathf.Deg2Rad);
        float y = center.y + radius * Mathf.Sin(ang * Mathf.Deg2Rad);
        arcLineRend.positionCount = i + 1;

        arcLineRend.SetPosition(i, new Vector2(x, y));

        ang += (float)totalAngle / pts;

        yield return new WaitForSeconds(waitDur);

    }
}

How can I animate this arc from the middle in both directions

at a constant speed
with an ease (animates slightly faster in the middle and slows down towards the end)

sentences:
Framerate-independent game loops and discrete tasks When writing good framerate-independent game code, you take some sort of deltaTime parameter in your main render() function and then scale your calculations based on that -- this is essential for things like physics engines.

However, in my game there are often discrete tasks -- the AI system might add components representing a "task" to the agents that should be removed (finished) after x seconds have passed. To make a contrived example, if a task/component takes 60ms to process, and the game is running at 60fps (16.6ms/frame), then the first three frames will run, bringing the "work done" on that task to 50ms, and then one last frame will do 10ms of work, but then the remaining 6.6ms will be "lost", because the AI system won't run and schedule new work until the next frame.

Ideally, I'd like to not lose the "loose change" of ms that occurs at the end of tasks.

How do people normally deal with this? I can think of a few options:

Ignore it -- the shortest tasks will probably never be less than 100ms anyway, generally more in the 1-5 second range. It's not multiplayer, and provided the game can maintain 60 fps (which it probably can), the experience should be the same for all players.
"Carry" the remainder over to the next frame. In the example above, give the agents 23.2ms of time to "spend" in the next frame.
Amp up the framerate. At 60fps, the most time you can possibly waste is 16.6ms, but at 200fps you can lose at most 5ms. (Currently my logic loop and render loop are coupled and capped at 60fps, but I can easily change that.)

sentences:
Create ROI tools for analysis I want to create some ROI tools on my game for personal analysis.

Let's say that I have 3 different level of special powers with a recursive cost and certain bonus. So, I want to see when certain level will start have income.

1st example: 1000 coins for 10 uses. Bonus: +10% on farming speed. 2000 coins for 10 uses. Bonus: +20% on farming speed. Etc

In this example, I know exactly what the bonus will do. I have the price of the farming per unit and I can calculate the income per use for each power level. So, I can tweak the numbers using the ROI tool to make the effect better.

2nd example: 1000 coins for 3 power ups on a weapon. Bonus: +1 attack power, +5% chance to destroy the weapon. 2000 coins for 3 power ups on a weapon. Bonus: +2 attacking power, 10% chance to destroy the weapon.

3rd example: 1000 coins per use. Bonus: 30% heal, 5% chance to get injured. 2000 coins per use. Bonus: 50% heal, 10% chance to get injured.

As you can see, the first example is simple to calculate the income vs cost. However, the second and third example don't have an exact effect and both of them have a probability to either good or bad effect. How do you work on this type of ROI? How do you calculate the pros of each level?

sentences:
Adding text to gameobject I'm trying to create a falling word game like z-type (code here). I have created 3 game objects and I want the words to be added as text to these game objects something like a health bar is added to enemies etc. This is the word spawner script that spawns the word on screen.

public GameObject wordPrefab;
public Transform wordCanvas;

public WordDisplay SpawnWord()
{
    Vector3 randomPosition = new Vector3(Random.Range(-2.0f, 2.0f), 7.0f, 0);
    GameObject wordObj = Instantiate(wordPrefab,randomPosition, Quaternion.identity, wordCanvas);
    WordDisplay wordDisplay = wordObj.GetComponent<WordDisplay>();
    return wordDisplay;
}

Right now the words are spawned at a random x position and y position of 7.0. Instead of this how can I assign the words to the gameobjects that I have created.

Edit

I have created a spawner that spawns 3 enemies at the top of the screen and they start falling down to the bottom. Here is the script attached to the enemy game objects:

public float fallSpeed = 1.0f;
public GameObject wordPrefab;
private Transform parent;

public WordDisplay SpawnWord()
{
    Vector3 randomPosition = new Vector3(Random.Range(-2.0f, 2.0f), 7.0f, 0);
    GameObject wordObj = Instantiate(wordPrefab, randomPosition, Quaternion.identity, parent);
    WordDisplay wordDisplay = wordObj.GetComponent<WordDisplay>();
    return wordDisplay;
}

// Update is called once per frame
void Update () {
    transform.Translate(0, -fallSpeed * Time.deltaTime, 0);
}

I have also removed the SpawnWord() method from the wordspawner script. However the words don't spawn along with the enemy gameobjects. There is one more script called the WordTimer. Not sure where to add this code. This is from the original code that's on github.

public WordManager wordManager;
public float delay = 1.5f;
private float nextWord = 0f;

void Update()
{
    if (Time.time >= nextWord)
    {
        wordManager.AddWord();
        nextWord = Time.time + delay;
        delay *= 0.95f;
    }
}

sentences:
Shader - Convert vector into scalar I am trying to convert a half3 as a simple half but I am facing an issue. As for an example half3(1, 0, 0) give me white but half3(0, 1, 0) gives me black.

How can I convert properly a half3 to a simple black and white half value

Thank you.

sentences:
How to make the button rollover by a keyboardEvent I'm designing a game calculator . My problem is how to link between the keyboard event and the button. **When I click no.2 button on my Keyboard the button doesn't roolover .
I want the exact button roolover wen I use the keyboard .

Note

every button have it's instance name
ex:
the button of number one : one_mc

my code is

switch (event.keyCode)
    {
    case 97 :
     res[1].appendText("1");
    break;
    case 98 :
     res[1].appendText("2");
    break;
    case 99 :
     res[1].appendText("3");
    break;
    case 100 :
     res[1].appendText("4");
    break;
    case 101 :
     res[1].appendText("5");
    break;
    case 102 :
     res[1].appendText("6");
    break;
    case 103 :
     res[1].appendText("7");
    break;
    case 104 :
     res[1].appendText("8");
    break;
    case 105 :
     res[1].appendText("9");
    break;
    case 96 :
     res[1].appendText("0");
    break;
    case 8 :
      res[1].replaceText(res[1].text.length-1,res[1].text.length,'');
    break;
    }

sentences:
Why does editing the client's memory in some MMOs allow them to cheat? Why editing the memory of the game client works? Why so many "Hack protection" tools coming with the clients?

If I were to design a client-server game, everything would happen at the server (the simulation of the game world) and clients would be only passive consumers receiving status updates of the part of the world near their characters, sending only some information like keystrokes or move/action commands. Maybe I missing something here, but with that design, any hack like raising my STR by 200 in the client memory (if the value is present at all), just won't have any effect.

The only explanation I can think is that games in which memory editing works let parts of the simulation run in the client and the server then just synchronize all the clients periodically. I can understand that design for Real Time Strategy games with a fixed number of players once a match is configured, but, why in MMORPGs? Is it a strategy to reduce server load?

sentences:
Making an auto patcher I'm currently in the last phases of an original release for my upcoming risk game - I'm looking at making a patching system to autopatch the game.

My current concept for it is-

1: Player opens the game

2: Game checks valid serial key

3: If valid, game checks latest version

4: If newer, game prompts opening of auto patcher

5: If opened, patcher downloads version list, with all version

6: Patcher loops through list to find all newer patches and downloads all version files with links to patch data

7: Patcher checks with the website for each file, checking if downloading all patches is smaller than downloading the latest version of the file: if smaller, downloads patches; if bigger, downloads latest file

8: If smaller patch file, patcher incrementally alters file with each patch applied by each small patch file, from oldest to newest. If larger, patcher simple overwrites the file

9: Patcher asks exit/launch game so players can enjoy the game

Does this sounds like a sane way to do the patcher or will it come back and bite me later on?

sentences:
Calculating coordinates of a point I struggle to find coordinates of point B in the picture below. I know the positions of A and C, the length of arm c and angle beta

I need it to make a gun next to the player point to the direction of a cursor. And the gun will rotate with the player. I think there must be a simple way to do it, but I'm missing it somehow. Could you point me to the right direction?

sentences:
Design patterns for rules systems? As a quick fun project, I tried writing a solitaire game. But when getting to writing up the rules systems, I felt dirty, because my code felt completely unstructured and inextensible, mainly because my game logic was complete spaghetti code.

I've run into this problem before, and always feel awkward when writing this part of my program, so I was wondering, are there any tried and tested best practices when it comes to defining rules in a game?

sentences:
Does glScissor affect stencil and depth buffer operations? I know glScissor() affects glColorMask() and glDepthMask(), but does it affect the stencil and depth buffers?

For example:

glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glEnable(GL_STENCIL_TEST);

glScissor(X,Y,W,H);

// Is this color mask set only for the scissor area?
glColorMask(TRUE,TRUE,TRUE,TRUE);
// Does this stencil function only work within the scissor area?
glstencilfunc(GL_ALWAYS);
// Does the stencil function only work within scissor area?
glstencilop(GL_KEEP,GL_KEEP,GL_KEEP);
// Is this depth  mask set only for the scissor area?
glDepthMask(GL_TRUE);
// Does this depth function only work within the scissor area?
glDepthFunc(GL_ALWAYS);

sentences:
Player hitting bottom of tile when beside it? So my player checks if it is colliding with tiles, and it works pretty good. However, when the player is against a wall, moving upwards and sideways, it detects it as hitting the bottom of the wall since the player checks for up and down collision first. How do I prevent this? Maybe there is another collision method I could use? Thanks in advance

Here's the collision code:
player.checkCollision = function (obj) {

            const top = obj.y - this.h;
            const bottom = obj.y + obj.h;

            const left = obj.x - this.w;
            const right = obj.x + obj.w;

            if (this.x > left && this.x < right) {

                if (this.y >= top && this.y - this.vel.y <= top) {

                    this.y = top;
                    this.vel.y = 0;

                    return 1;

                }
                if (this.y <= bottom && this.y - this.vel.y >= bottom) {

                    this.y = bottom;
                    this.vel.y = 0;

                    return 1;

                }

            }
            if (this.y > top && this.y < bottom) {

                if (this.x >= left && this.x - this.vel.x <= left) {

                    this.x = left;
                    this.vel.x = 0;

                    return 1;

                }
                if (this.x <= right && this.x - this.vel.x >= right) {

                    this.x = right;
                    this.vel.x = 0;

                    return 1;

                }

            }

            return 0;

        }

sentences:
Handling AI with ECS in a turn based roguelike I am trying to implement the Entity Component System pattern to use in a roguelike game. Right now, I have 3 systems. Input, AI, and Action. The input system basically is just a system used by the player to get input from the keyboard. The AI system is for the NPCs. The action system processes anything with an Action component, which is used to describe either a move, an attack, an item usage, basically anything that advances the game time.

However, I am having trouble with implementing the correct behaviors. It is clear that the player should have a turn, getting his input. If the input is invalid, he repeats his turn, again and again until he makes a turn that passes time. Then the enemies should get their move from the AI system, and initiate it. So what the behavior should be like is this:

while(!input.passesTime())
    input.getInput()
    draw()
action.do(Player)
for all Entities with AI
    AI.think(Entity)
    action.do(Entity)
draw()

Notice how everything is intertwined and doesn't really make sense as a single (or multiple) system. How can I design this better? Note especially that I need to update the screen everytime, even with invalid inputs since they may write something out (e.g. "Nothing interesting happens").

After some thinking it seems clear that the renderer should also be a system, but this doesn't really clear up the requirements.

sentences:
Monogame - Sprite sheet animation I have a sprite sheet that contains a character walk cycle, and I have made a player class that allows the player to move and cycle through the walk animation, however the animation only works whilst walking to the right. I use the arrow keys to move up, down, left and right, meaning when I press any key, my player moves in the correct direction, but only performs the animation of walking to the right.

The current animation that works, has been called like this in the LoadContent() function:

spritesheet = Content.Load<Texture2D>("sprites2");

player = new Player(spritesheet, new Rectangle(0, 96, 32, 48),
new Vector2(100, 100), 4);

This does its job, as it calls each 4 sprites to complete the walking animation to the right, and new Rectangle(0,96,32,48) is the location cut out from the sprite sheet. However I need (for example) new Rectangle(30, 101, 65, 52) to be used also, which will correctly animate my character when the left arrow key has been pressed.

My question is, how would I get another location of the sprite sheet loaded, and then actually work when I press the correct key?

This is a very difficult question to ask and I very much apologize if it was difficult to understand. Accepting all edits to my question, and thank you in advanced.

sentences:
XNA 4.0 - Car game dashboard lights I'm making a car game and doing the dashboard part. I'm trying to do the dashboard lights, i've did this changing the dashboard texture, overwriting the texture with the light image over it, example:

Texture2D dashboardTexture;
Texture2D parkingBrakeLightTexture;
Model carModel;

//when the light needs to turn on:

PutTextureOverDashboardTexture(parkingBrakeLightTexture);

//on Draw method I change the texture of dashboard mesh:

effect.Texture = dashboardTexture;
effect...

This is alright, but the lights will suffer influence from the external light if I EnableDefaultLighting() in the effect, then the dashboard lights will almost don't appear depending on what direction the car is, and of course that should not happen.
So how can I make the lights of dashboard appear? I need to use another alternative? Or can I still utilize this method?

sentences:
Texture artifacts depending on texture size I get some strange artifacting with textures depending on their size. I run OpenGL 3.3 with an GTX 580 so it should definitely support non power of two textures. I've narrowed down the problem specifically to the texture's size, I've tried checking if transparency had anything to do with it, color channels etc.

As you can see, the 512x512 and 300x300 textures look just fine but the 437x437 is all distorted. What could be the cause of this and how can it be fixed? I could of course just stick to power of two textures which seem to work fine but since this is an personal educational project I really want to understand what's going on.

sentences:
Using multiple shaders I'm currently studying opengl shaders but I can't figure out something: how to apply different shaders to the objects, for example, a teapot rendered using toon shader and another one in the same scene using a very reflective surface and other distorted from a noise function, like in this video

http://www.youtube.com/watch?v=1ogg4ZfdBqU

Another one is applying a bloom shader in a scene and a motion blur shader afterwards. How to achieve those effects when you can only have one vertex shader and one fragment shader? Is there any trick such as using more than one shader program?

sentences:
Only 1 side is rendered I'm trying to get my .blend object into Unity but for some reason I see it differently in Unity than in Blender.

I was trying to solve the problem and someone said that I have to go to the edit mode, then mesh, then change the normals but that is not working for me.

Here is what I mean:

sentences:
Rotate a particle system Languages / Libraries in use: C++, OpenGL, GLUT
Okay, here's the deal.
I've got a particle system which shoots out alpha blended textures to produce a flame. The system only keeps track of very basic things such as, time alive, life, xyz and spread.
The direction in which the flames are currently moving in is purely based on other things which are going on in my code ( I assume ).
My goal however, is to attach the flame to the camera (DONE) and have the flame pointing in the direction my camera is facing (NOT WORKING).
I've tried glRotate for both x,y,z and I can't get it to work properly.
I'm currently using gluLookAt to move the camera, and get the flame to follow the XYZ of the camera by calling glTranslatef(camX, camY - offset, camZ);
Any suggestions on how I can rotate the direction of the flame with the camera would be greatly appreciated.
Heres an image of what I've got: http://i.imgur.com/YhV4w.png

Notes: Crosshair depicts where camera is facing
if I turn the camera, flame doesn't follow the crosshair
Also asked here: https://stackoverflow.com/questions/9560396/rotate-a-particle-system
but was referred here

sentences:
How do I tile a specific region of a sprite? I have a sprite that I use as a sprite sheet, where regions of the image represent various UI elements (window corner, border, background, etc.).

I want to use a certain region of that sprite as a texture that I can tile over a larger destination rectangle.

Setting the SamplerState to LinearWrap and then calling SpriteBatch.Draw with destination rect and source rect ends up stretching that region of the image, not tiling it.

All the examples I've seen that implement tiling use the entire sprite - I only want to use a region of it, and tile that region.

Is there any way to do this?

Edit for clarity:

Here's an example spritesheet

where I want that colored region. I have a rectangle that represents a window border, that is larger than the region in the source image.

Here's what I want to end up with

Here's the code I've been using.

spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null);
spriteBatch.Draw(sourceTexture, windowTopBorderRect, sourceTextureRegionRect, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);

And what I get is the image stretched across the window border rectangle, instead of tiling the source region within that rectangle.

sentences:
Preventing Excessive Movement Speed in Visual Studio I just decided to give coding a go, and I am using C# in Visual Studio 2017. After some online tutorials, I tried to make a Windows Form App with simple movement. The only problem I have is that if you hold down a key for around a second, the player suddenly moves super quickly in that direction.

private void inGameKeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.A)
        {
            MoveSpeedX -= 3;
        }

        if (e.KeyCode == Keys.D)
        {
            MoveSpeedX += 3;
        }

        if (e.KeyCode == Keys.W)
        {
            MoveSpeedY -= 3;
        }

        if (e.KeyCode == Keys.S)
        {
            MoveSpeedY += 3;
        }
    }

The movement code. How can I fix this issue? Any help would be appreciated! :D

P.S. If you could also show me a way for more efficient movement, that would be greatly appreciated as well! :D

sentences:
Pathfinding with multiple random paths in a Tower Defense game I thought about random pathfinding for my Tower Defense game. A* would not work for my puposes, because I specifically need random pathfinding.

Imagine a map with routes, a starting point and a destination. I have multiple routes, which all lead from the starting point to the destination, one way or another. It could look like this:

Color description: red - starting point; black - destination; grey - route; white - free space
(The numbers are used in the text as a reference to some tiles)

I first thought about just calculating the next waypoint randomly, when an entity passes a tile. But that would not work. When an entity passes tile 1 it either can go up or down. When it comes to 2 it can either go down/up (relative to it´s position) or right.
If it goes down/up it would go to tile 1, which means that it goes backwards. Bad...

I would really like to make it dynamic, but I can´t figure out what I can do now. Anyone with ideas or experience in this?

sentences:
How to fix overly blurred texture / image in unity? so, I'm not sure what caused this, let image below do the explanation :

How to fix the overly blurred texture in unity? It's so frustrating, since I can't get it right, because when I tried it in LibGDX, the image looks good (Well, it's not exactly a same image, but similar).

They both screenshot from android device (Samsung Galaxy Note 3 Neo)

Thanks

P.S. It's a pixel art

Edit, here's the screenshot of my relevant inspector window

And here's the alpha ingame screenshot

sentences: Scoping my first project So I'm writing my first game which is a RTS and one of my main ideas for it is multiplayer deception however I'm finding it hard to control the scope of my project. Yes im thinking pretty small but because a key element of the game is multiplayer I'm wondering if its a good idea for a first game I know APIs such as appwarp exist and allow easier multiplayer integration but is this realistic for a first game or is it a better idea to go single player?

sentences:
In Unity, is there a way to Set a new MeshRenderer? Here is what I want to do in Unity for a given GameObject go = new GameObject(). I want to create a MeshRenderer, change its properties and only in the end set it as the component of go. For instance:

MeshRenderer newmeshrenderer;
(...) //do stuff with newmeshrenderer
go.AddComponent<MeshRenderer>() = newmeshrenderer;
(or)
go.GetComponent<MeshRenderer>(newmeshrenderer);

But both way fail. What is the correct way of setting a MeshRenderer previously created to be the MeshRenderer of an object?

sentences:
Multiplayer FPS server side performance This is related to MMO Performance except that question is about bandwidth. This is about cpu load.

I put together a simple FPS using node.js and webGL. It's extremely simple, a lot like the BuddyMaze clone of MIDI Maze. There's very little going on, everyone moves in two dimensions (no height), shoots simple projectiles, and runs into walls.

Right now, if I make multiple connections to the server where every player shoots rapidly while spinning in circles, I can get about 15 - 20 players in the game before the server maxes out a core and slows way down. And this is when running at 30 fps on the server. At 10 fps, I get about 25 - 30 connections. This is pretty bad, since the game is going to have a lot more to do soon and I'll need to fit more players for this to be a feasible endeavor.

My brother just pointed out some stats about his coworker's TF2 server. His server is lower specs than ours, yet it runs TF2, obviously a much more complex game, at a whopping 500 ticks per second, with 36 users per core. Also, we currently consume much more bandwidth than they do, but we haven't been trying to lower that much yet.

How is this possible? What sort of tricks are there to increase server performance to this magnitude? Some things that I know of include:

Lowering framerate on the server, and interpolate positions on the client. I got some benefit, but clearly the TF2 server doesn't even bother with this.
Doing expensive things like collision detection on the client, and verify it infrequently on the server. I haven't moved this over just yet, I will tonight. Even so I don't expect such an enormous gain.
Break the playing field into regions (quad trees) to minimize calculations. Haven't had an opportunity for this yet.
I've considered the unfortunate possibility that node.js is just way slower than whatever TF2 is using, and may not be suited for this kind of high intensity task.
Is it all in the server configuration magic?

So what are the other tricks of the industry to do only the minimum required on the server but still have a flawless game experience? There's a big conflict between "defer to client to save cpu time" and "don't trust the client", so maybe it helps to know where the line is drawn in various situations?

Update

Profiling really is the only mantra I've ever found that's absolutely infallible. I quickly wrapped some timing functions around my code (thanks, FP!) and discovered what I never expected: the act of broadcasting the data to clients accounts for nearly all of the execution time. Specifically, around 90% of it. Further testing showed that this time is dependent on both the number of clients and the size of the data, but more so the latter. On a 20 user load, I cut my broadcast time 90%, from 24ms down to just over 2ms by sending only "{}" instead of the full data. But with only 5 users, broadcasting takes around 0.5 ms. So I clearly need to do some optimization here.

The first most obvious improvement is line of sight checking. This would decrease both the number of people who care about data, and also the amount of data sent to interested parties. Are there other tricks in this realm I can try, which focus on minimizing the cost of my broadcast operation?

sentences:
SpriteKit - How to jump to specific position? I'm would like to achieve something like Object A will jump to position A in parabolic way. For example:

I am able to make the object jump but i do not know how to calculate to make the object jump to the precise location.

sentences:
Generating island terrains with Simplex Noise (C#/XNA) I've got one little question: Is there any code or sample which shows how the simplex noise works? I cannot find anything about it... How should I implement it, without the knowledge how the algorithm works?...

The other question is: Is the simplex noise a good algorithm for island generation? I need huge islands (really huge), with different layers (sand, gras, stone) and clearly visible height-differences, which have soft-edges, so you can go out/into water without jumping over uneven surfaces.

sentences:
What makes a computer opponent feel alive? Are there any recommended blogs or whitepapers that talk about making the AI in an RPG game feel more real? (Specifically in turn based combat.)

I know something must be out there, but I am only finding papers that talk about algorithms  behind the AI. I am looking more along the lines of "this is what makes a computer opponent feel alive". Taking risks, going easy, retreating, etc....

So many awesome answers, and I wish I could accept several of them. Thanks everyone!

sentences:
Handling non-automatable, repetitive, game tasks A problem I'm currently having with a project of mine is deciding how to handle repetitive, but important, in-game tasks.

As an example (Though there will be many other instances of this), earlier in the game, the player must smelt and shape iron without modern tools.
After iron ore has been smelted, it must be shaped into tools, this requires manual labor.

So how are some ways I could handle the shaping process (A repetitive, time consuming, task)?

Having the player sit in a GUI until the shaping process is complete is obviously not a great idea.

I don't want to make the process instant and simply rely on the speed of the smelting process to cull production, as the player could just utilize a huge number of furnaces to bypass that.

For other reasons, it would be incredibly difficult and time consuming to create a short mini-game for each of these situations.

Is there an easy way to solve this?

sentences:
What is the clearest way to present several numbers in a very limited space? I'm building a mobile incremental game and as, is typical for the genre, I've got a ton of changing values to show to the user. They serve both as a way to show them their progress, but also to help them make better decisions as the game goes on.

I have five values I want to show, the amount of "Harvesters" and "Salesmen" the user has, and then how many resources they're adding or removing from the resource pool, along with the net result. Say if you're harvesting 10 resources a second, and you're selling 2, you're netting +8/s.

In the following images, blurred to focus on the area in question, you can see the different styles I've tried out. This is the first style, where everything is shown to the player, but is exceptionally busy:

The second style is just the net change, but is missing the quantities of the two types of workers (ie 10 harvesters and 5 salesmen)

Finally the third style is a mix of verbosity and information, but does not show the net difference (ie +123/s).

I'm a fan of the first style because it shows the player everything, and as the programmer I'm happy to look at piles of numbers that represent the fruits of my labour, but the player might not want to see all of that. I've considered adding a toggle setting that goes between the styles if you press it, but I'm hoping there's some sort of happy medium here.

The highlighted parts of the image is all the space I have, but I can incorporate icons if it would help.

My question is between the three of these (or some totally different style), how can I convey the same amount of information clearly and cleanly?

sentences:
Level editing using a 2D map for a 3D game We're trying to make a level editor for a 3D game that involves walking around outdoor environments. In many ways a heightmap satisfies the game's needs, but it also falls short in several ways, so we're considering various enhancements to the heightmap concept, but it's proving difficult to find a simple solution to this problem.

For a start, a heightmap has great difficulty with sharp edges. As long as everything is smooth a heightmap looks wonderful, but it becomes jagged around vertical cliffs, along the edges of roads, and anywhere the resolution of the heightmap becomes relevant. The obvious solution to these issues is to add a layer of vector drawing on top of the heightmap, so we can preciously define the curves of vertical cliffs and roads, and use this to insert specialized polygons into the terrain's mesh. A vertical cliff can even be a simple gap in the terrain mesh that can be filled by another mesh which allows us to render the cliff face however we like, bypassing the limitations that heighmaps usually have.

Another issue with heightmaps is the difficulty of drawing smooth slopes by hand. For the purposes of the game, terrain should either by a gentle slope or a vertical cliff, so there is no ambiguity over whether the player can traverse through it. We could scan the heightmap to detect overly steep slopes and show an error message, but what we really want to do is give the user drawing tools that will only draw acceptable slopes. But how can this be done?

Perhaps the traditional raster heightmap is causing more problems than it is solving, so an entirely different kind of heightmap is called for. Perhaps instead of adding a vector drawing layer, the whole heightmap was done as a vector image and represented as a set of polygons with each polygon having a certain elevation. This way we get smooth curves automatically, and creating meshes for vertical cliffs and flat land is trivial, but representing slopes in the editor and rendering them becomes a challenge.

We've considered a blending tool that would draw polygons on a second layer, and wherever these blend-polygons appear the underlying terrain polygons would smoothly merge together. Polygons that have shared edges would from a slope perpendicular to those edges at an angle that makes the slope walkable. Unfortunately working out the geometry of the resulting mesh is difficult, and it means that cliffs are the default for every change in elevation.

Since it seems more natural for the user to draw lines to block the player's passage rather than drawing the places where the player can traverse, another approach is to have the user draw the cliff lines in another layer just as with the raster heightmap, but now those cliff lines would act to stop the terrain from smoothing itself into pure rolling hills. Imagine each polygon of the heightmap as a pillar of sand with vertical sides, and when a mesh is formed from the map the sand flows out of its pillars, forming smooth slopes in every direction except where it encounters a cliff line and is forced to flow around. Everywhere except the cliffs need to be a gentle enough slope to walk up, so when there is a gap in a cliff the sand needs to flow through and spread out on the other side. We have some ideas about how this might be done, but it's still a major challenge to implement.

Finally, we could just use a grid with sloped blocks to represent slopes. Editing would be easy, generating the mesh would be easy, all the problems would be solved, but being confined to a grid would surely sacrifice the freedom we'd hoped to have. We don't want to be constrained to being axis aligned unless no other solution is practical.

Ultimately the question is: are there practical ways to implement any of the approaches we're considering, or are we coming at this from entirely the wrong direction?

sentences:
Detect Sprites, they are in Shape or Not which random draw in Cocos2d I have searched a lot on the web and found some helpful links but none solve my question.

Link 1 Link 2

I have written some code, to draw lines with Touch methods, but I still have questions. Here is what I need help understanding.

1 -> Line has been cleared after draw complete (this might go in ccTouchesEnded method /  UIPangesture state End.)
//I am not sure how to draw custom shapes with UIPanGesture or Touch methods.

2 -> Is there any difference between capturing the whole game scenario for collision as like scheduleUpdate method and how do I find out if objects are colliding (these are randomly moving sprites and they have random shapes)?

3 -> How to Check whether a User drawn shape is closed or open (a convex shape or not)?

4 -> How to check random moving sprites inside drawn shape or outside?

Here I have some code, but I am not sure whether it's useful or not.

//This code is in init method

linePoints = [[NSMutableArray alloc]init];
// create a simple rendertexture node and clear it with the color white
rtx = [CCRenderTexture renderTextureWithWidth:winSize.width height:winSize.height];
rtx.position = CGPointMake(winSize.width/2, winSize.height/2);
[self addChild:rtx z:6 tag:101];

brush = [[CCSprite spriteWithFile:@"Line1.png"] retain];
brush.scale = 5.0f;

Draw line by touch move method.

 -(void) ccTouchesMoved:(NSSet *)touchess withEvent:(UIEvent *)event
    {
        UITouch *touchMyMinge = [touchess anyObject];
        CGPoint start = [self convertTouchToNodeSpace:touchMyMinge];
        CGPoint end = [touchMyMinge previousLocationInView:touchMyMinge.view];
        end = [[CCDirector sharedDirector]convertToGL:end];
        end = [self convertToNodeSpace:end];

        NSValue *value= [NSValue valueWithCGPoint:start];
        [linePoints addObject:value ];

        [rtx begin];
        float distance = ccpDistance(start, end);

        for (int i = 0; i < distance; i++)
        {
            float difx = end.x - start.x;
            float dify = end.y - start.y;
            float delta = (float)i / distance;
            [brush setPosition:ccp(start.x + (difx * delta), start.y + (dify * delta))];
            [brush visit];
        }
        [rtx end];
    }

I have attached two screen shots for more clarification.

Please help me about on my technical query.

sentences:
How to achieve programming experience with PS3 or Xbox360? Possible Duplicate:
  How to get PS3/Xbox 360 experience without having access to Dev kits?

Is there a way to achieve programming experience with PS3 or Xbox360 systems without the development kit that only are selling to great videogame companies ?

There are a lot of game companies that request experience with these systems and I don't know how to achieve this.

sentences:
What are real world uses of secondary key bindings? I'm currently wondering if there's really a reasonable use that would justify making the effort of implementing secondary key bindings?

If you don't know what they are: They allow multiple controls (keys, mouse clicks, ..) to be mapped to the same action (running forward, opening a chest, ..).

sentences:
Engaging ways to include party members in a fast-paced action RPG Imagine a dynamic action RPG, where you constantly need to use your reflex to avoid bullets and fight against hordes of enemies. What would be a best way to incorporate other team members? I can think of several ways but all have disadvantages:

Giving them orders manually is out of questions when there's so much going around that you need all your attention just to make sure your main is not hit by any incoming attack
Using a dynamic pause like in classic cRPG such as Baldur's Gate makes the game slower and interrupts action that ideally should be quick, dynamic and engaging
Making them autonomous is difficult to balance. If they're too weak or ineffective, then the player will constantly gets annoyed at them, that they can't get anything right and die constantly. If they are too efficient then they can ruin the game because player could just sit back and watch them defeat all the enemies. If they just pretend to engage the enemy to left the action to the player this can happen

Most action RPGs seem aware of these difficulties and prefer to have a single character for the player to run and control. This simplify things greatly but I don't want to lose the party, for plot related purposes, banters, interactions etc. What would be a good way to have the best of both words? How can I best include side characters in a fast and dynamic gameplay?

sentences:
Changing Light Intensity value I have this code for creating a light:

            GameObject lightGameObject = new GameObject ("Light1");
            lightGameObject.AddComponent (typeof(Light));
            lightGameObject.light.color = Color.white;

            lightGameObject.light.intensity = 0.5f;

I want to change the light's intensity to 0.5f but when I run the game, the intensity's still at 1.

sentences:
LibGDX Bounding system with tiledMap, 3D model player and ortho cam Begins explaining my achieve: as I said in my last question, I am tryna makin' a 2D game with 3D player as Factorium. For hours I am tryna to make a kinda of bounding system:
1)Camera will follow player untill the left border of the screen will reach the left edge of the map
2)If left edge has been reached, only player keep walking towards left
3)Once player come back, camera will follow player again only when it will have reached the right distance
These steps for each side

First image: left edge of the map still not reached, so camera keep following player constraints it at its center.
Second image: camera reached it, but layer kept waling, then begins come back
Thirds image: distance between player and left edge is at lest as half camera viewport, so camera begins follow player again.
Of course, I tried something...
/**
 * Using tile map proeprties
 * @param translateCords how much player has to be moved
 * @return if the player can me moved
 e.g. if the camera will not be over the map's edge
 * after have been moved
 */
private boolean canPlayerMove(Vector3 translateCords) {
    Vector3 playerPos = this.entityPlayer.getPosition();
    Vector3 futurePos = playerPos.add(translateCords.x, translateCords.y, 0);

    TiledMapTileLayer.Cell cell = ((TiledMapTileLayer)this.tiledMap.getLayers().get(0)).getCell((int)futurePos.x, (int)futurePos.y);
    return cell.getTile().getProperties().containsKey("blocked");
 }

This for move camera
     /**
 * @param translateCords how much camera has to be moved
 * @param camPos current camera position
 * @return if the camera can me moved
 e.g. if the camera will not be over the map's edge
 * after have been moved
 */
private boolean canCameraMove(Vector2 translateCords, Vector3 camPos){
    if( (translateCords.x < 0 && camPos.x - this.viewportWCam >= 0) ||
        (translateCords.x > 0 && camPos.x + this.viewportWCam <= this.widthWorld) ||
        (translateCords.y < 0 && camPos.y - this.viewportHCam >= 0) ||
        (translateCords.y > 0 && camPos.y + this.viewportHCam <= this.heightWorld)) {
        return true;
    }
    return false;
}

I tried a lots of other stuff...

sentences:
Why does SDL_RenderCopy result in a blank screen? I'm trying to render a texture(picture), but SDL_RenderCopy keeps the window's background black.

Here's the relevant code:

SDL_Rect rect; rect.x = 0, rect.y = 0;
while(!quit)
{
    SDL_RenderCopy(g_renderer, g_texture, NULL, &rect);
    SDL_RenderPresent(g_renderer);
    // Window stays dark although i've rendered via RenderCopy
    SDL_Delay(500);

    while(SDL_PollEvent(&event) != 0)
    {
        if(event.type == SDL_QUIT)
            quit = true;

        else if (event.type == SDL_KEYDOWN)
            move_picture(event.key.keysym.sym, rect);
    }
}

If I change the SDL_RenderCopy function call to:

SDL_RenderCopy(g_renderer, g_texture, NULL, NULL);

The picture is visible in the center of the window, but its not the result I'm looking for, as I would want the image to render to the position I set to my rectangle.

After a couple of searches I've found that this is a known behavior.
I've tried changing the way I'm loading a texture from CreateTextureFromSurface to IMG_LoadSurface, but the rendering still doesn't work.

sentences:
IDirect3DDevice9Ex and D3DPOOL_MANAGED? So I wanted to switch to IDirect3DDevice9Ex, purely for the SetFrameLatency function, as fullscreen vsynced D3D seemed to produce noticable input lag.

But then it tells me 'ha ha ha! now you can't use D3DPOOL_MANAGED!':

Direct3D9: (ERROR) :D3DPOOL_MANAGED is not valid with IDirect3DDevice9Ex

Is this really as unpleasant as it looks (when you're relying quite heavily on managed resources) - or is there a simple solution?

If it really does mean manual management of everything (reloading all static textures, VBs, and IBs on a device reset), is it worth the hassle, will IDirect3DDevice9Ex bring enough benefit to make it worth writing a new resource manager?

Starting to think I must be doing something wrong, due to this:

Direct3D9: (ERROR) :Lock is not supported for textures allocated with POOL_DEFAULT unless they are marked D3DUSAGE_DYNAMIC.

So if I put my (static) textures in POOL_DEFAULT, they need flagging as D3DUSAGE_DYNAMIC, just because I lock them once to load the data in?

sentences: Moving an object in a circular path I want to move one object (dot) in a circular path. How should I change the X and Y coordinates to accomplish this?

sentences:
Fast(er(est)) fullscreen/scene collision detection technique ("selection buffer") My vertex format has a float4 Flags element used to pass miscellaneous data to shaders.
Each mouse-collidable object that is rendered has a unique ObjectID that is written to an ObjectID-rendertarget which can be CPU-sampled to index the hovered object. The remaining render targets are geometry/lighting data.

I've found this has advantages:

I set (Flags.x = ObjectID) upon object creation so the vertex buffer only needs an initial upload and updates only when new ObjectID's (that will be rendered) are created. Everything else is per-object/instance. Essentially, "no" overhead added by using a Flags component for ObjectID.
I'm semi-certain that, since I have to render everything anyway, outputting one additional color to one additional rendertarget is already cheaper than ANY clever bounding/container collision testing algorithm. Currently, I copy the entire ObjectID-rendertarget back to the CPU, but even that could be further optimized.
The depth buffer (that I'm using anyway) automatically ensures that the pixel I sample is the ObjectID of the top-most, visible, mouse-collidable, object. I don't have to check if the mouse position/ray is within the bounds of anything, intersects with anything, visibilities, nothing. All of that is already sorted out by rendering the scene properly.
Rendering the interface components first and reusing the ObjectID depth-buffer to render the world, reduces the fill-volume for the 3D scene; drastically, if a lot of interface is visible.

I've found only one disadvantage:

Since I render the interface first, if the camera has moved (the world hasn't been rendered yet), the WorldCoordinate available during Update() is incorrect. If the camera hasn't changed, the coordinate is correct. Immediately after rendering to the geometry buffers, but before any cursor-dependent shaders are invoked, I update the CPU-buffer and WorldCoordinate. The CPU-buffer is only updated when necessary and, at most, once per-frame. The "second sample" is during the following Update() and just re-reads the (wrong if the camera has moved) value from the byte array. Still, no significant overhead and this is basically just a slight annoyance because I'm just debugging the value anyway. Currently, when the WorldCoordinate is usefully-used (during render), it is correct.

Overall, I've got pixel-perfect, anything-on-the-screen, mouse-collision detection, with zero* additional overhead beyond standard rendering.
*Minimal and/or approximately-fixed, regardless of screen/scene complexity

Why is this method not popular and/or tutorialized?
-I assume most new-ish games post-process geometry buffers but I found nothing similar to this and just worked my way through the issues as they came up. To me, it appears as though I've got collision detection working for all of the objects/classes that I haven't even written yet. All of the "tech" involved here is obvious and easy, so I feel like I must be missing something; a future problem that I can't think of yet.

-Comments/critiques of the "algorithm" are welcome. Best answers would point out critical flaw(s) and, for bonus points, work-arounds.

-If this has been done before, is there an accepted best-practice? Links to similars would be ok.

sentences:
Dividing sprites and checking for empty ones So I have a sprite. I would like to divide this sprite into 5x5 sprites. Now what I am confused with is how I can go through each of these sprites and check if a sprite is completely empty/no pixels then remove that sprite

This is my code for dividing the sprite

public class TextureDivider : MonoBehaviour {

     public Texture2D source;

     // Use this for initialization
     void Start () {

         GameObject spritesRoot = GameObject.Find("SpritesRoot");

         for(int i = 0; i < 8; i++)
         {
             for(int j = 0; j < 8; j++)
             {
                 Sprite newSprite = Sprite.Create(source, new Rect(i*128, j*128, 128, 128), new Vector2(0.5f, 0.5f));
                 GameObject n = new GameObject();
                 SpriteRenderer sr = n.AddComponent<SpriteRenderer>();
                 sr.sprite = newSprite;
                 n.transform.position = new Vector3(i*2, j*2 , 0);
                 n.transform.parent = spritesRoot.transform;
             }
         }
     }
 }

sentences:
Simulated Economic Factors Based on Supply and Demand in MMO Resource Trading Game I'm working on a gam (naturally), and the primary activity for the player is to buy and sell commodities at various marketplaces.

Each commodity has the following properties:

Base Price: if all things were otherwise equal, this would be the measure of value for the commodity
Supply Factor: when a player sells one unit of this commodity in a market, the "supply" goes up by this factor
Demand Factor: when a player purchases one unit of this commodity in a market, the "demand" goes up by this factor.

Within each market, the commodities are given the following local properties:
Local Supply
Local Demand

To keep things "simple", I have these values generated randomly with the equivalent of a 3d6, so Supply and Demand can be anywhere from 3-18.

The price for one unit of a commodity in a particular market is calculated like so:

Price = BasePrice * (LocalDemand+DemandFactor*UnitsDemanded) / (LocalSupply+SupplyFactor*UnitsSupplied)

In this way, player purchases will drive the price up, and player sales will drive the price down.

Now comes the problem, and I'll use a concrete example as it is not entirely obvious from just looking at the formula.

We have commodity X with a base price of 100, and local demand and local supply both of 10, and a supply and demand factor each of 1.

So, desiring to purchase a single unit, I calculate the price:

Price = 100 * (10+1*0) / (10+1*0) = 100

And I purchase the unit, which drives up the price to:

Price = 100 * (10+1*1) / (10+1*0) = 110

And if the player then sells the commodity at that price, he immediately profits 10.

This is no good.

So, my first pass at this solution is to calculate the price based on what the supply or demand WILL BE after the purchase is over, which works after a fashion, but consider that in the example above, the purchase of 1 unit will be 110, whereas the purchase of 10 units will have a unit price of:

(100 * (10+1*10) / (10+1*0)) = 200 (total of 2000 to buy 10 units)

So, naturally this is unfair, and so the player would get the best price for purchasing one unit at a time.

And I don't want the player to have to do that, so I want to calculate the price one unit at a time.

This in itself is relatively easy, just loop through the units I want to purchase, and add it up.

Unfortunately, it doesn't exactly take care of the fractional units.

I might not have mentioned that you can own fractional units of commodities. You can.

Another thing to compound the issue is that the "currency" is simply another commodity, which can itself have supply, demand, supply factor, demand factor, sales, purchases, and so on.

So purchasing is a two step problem.

First, for a particular number of units of a commodity, determine the "value" of them in a way that ensure that buying and then immediately selling is a losing proposition.

Second, for a particular "value", determine the number of units that would need to be "sold" in order to make up that value.

Another wrinkle: it should not be advantageous to purchase fractional units.  The price for buying half a unit, and then buying another half a unit should not be better or worse than buying one whole unit at one time.

sentences:
How to use HD and SD sprites in Unity addressables I am able to load sprites using Unity addressables. But how can I use SD or HD variants of a sprite based on my device resolution?
Previously I was using LIBGDX, and it has ResolutionFileResolver to handle this scenario.

sentences:
LibGDX: Draw a pie chart? I'm new to LibGDX, my goal is to render a 3D pie chart, my idea is to draw a Cylinder and somehow define slices that can have different material and transformations.

I can render a cylinder already but I'm not sure how to do the slicing part.

sentences:
Integer vs String for "type" data in data-driven games I've been developing a few mobile games, in which those games fetch their data from a server-database.

I'm used to storing "type" values as an integer identifier, and an enum in the client to identify the data coming from the server.

I'm under the impression that games like MMOs or PC games that get patches model their data to identify "types" as integers.

As an example: On the database table:

Monsters Table: MonsterId(int), Name(string), MonsterType(int)

On the client-sided code:

typedef enum {
    MonsterTypeGround = 1,
    MonsterTypeAquatic = 2,
    MonsterTypeAmphibious = 3,
    MonsterTypeAerial = 4
}MonsterType;

Is there an objectively correct answer on what to use (int vs string) for these types of data?

Do I have the correct impression that MMO's usually use integers for this, or it highly depends on the developers as well?

sentences:
XNA: SpriteFont question I need some help with the SpriteFont. I want a different font for my game, other than Kootenay. So, I edit the SpriteFont xml, i.e:

<FontName>Kootenay</FontName>

or

<FontName>Arial</FontName>

No problem with Windows fonts, or other XNA redistributable fonts pack. However, I want to use other fonts, that I downloaded and installed already, they are TTF or OTF, both supported by XNA.
My problem is, I cant use them, I got this error:

  The font family "all the fonts i tried" could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font.

So, checking at the windows fonts folder, I check the properties and details of the fonts, I try all the names they have, and but never works. Maybe I need some kind of importing or installing in order to use them, I dont know, and I hope you guys can help me, thanks!

sentences:
Draw LineRenderer gradually, rather than all at once I'm drawing a line with a LineRenderer. It works, but now I would like it the line to be drawn gradually, instead of appearing all at once.
How can I modify my code to achieve this?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LineController : MonoBehaviour
{

    private LineRenderer Ir;
    private Transform [] points;

    private void Awake(){

        Ir = GetComponent <LineRenderer>();
    }

    public void SetUpLine (Transform[] points){
        Ir.positionCount = points.Length;
        this.points = points;
    }

    private void Update (){
        for (int i = 0; i < points.Length; i++) {
            Ir.SetPosition(i, points[i].position);
            Debug.Log (points[i].position);
        }

    }
}

sentences:
How can I guarantee a solvable Fifteen Puzzle shuffle? I am making a 15 Puzzle game in C# that allows the user to enter a custom row and column value up to a maximum of a 10 x 10 puzzle. I am having problems with the shuffle method.

I want to make it so the puzzle is always solvable by first creating a winning puzzle then shuffling the empty space. The problem is it is too inefficient to call every click event each time. I need a way to invoke the click event of a button adjacent to the empty space but not diagonal. I also use an invisible static button for the empty spot. The PuzzlePiece class inherits from Button. I am not too sure how to do this.

Here is what I have:

private void shuffleBoard()
    {
        //5 is just for test purposes
        for (int i = 0; i < 5; i++)
        {
            foreach (Control item in this.Controls)
            {
                if (item is PuzzlePiece)
                {
                    ((PuzzlePiece)item).PerformClick();
                }
            }
        }
    }

 void PuzzlePiece_Click(object sender, EventArgs e)
    {
        PuzzlePiece piece = (PuzzlePiece)sender;

        if (piece.Right == puzzleForm.emptyPiece.Left && piece.Top == puzzleForm.emptyPiece.Top)
        {
            movePiece(piece);
        }
        else if (piece.Left == puzzleForm.emptyPiece.Right && piece.Top == puzzleForm.emptyPiece.Top)
        {
            movePiece(piece);
        }
        else if (piece.Top == puzzleForm.emptyPiece.Bottom && piece.Left == puzzleForm.emptyPiece.Left)
        {
            movePiece(piece);
        }
        else if (piece.Bottom == puzzleForm.emptyPiece.Top && piece.Left == puzzleForm.emptyPiece.Left)
        {
            movePiece(piece);
        }
    }

sentences:
Basic Character Controller Not Working Properly in Unity I've been trying to setup a simple mouse camera which I had all the code working fine, except when I move with wasd and move my mouse to turn the camera simultaneously the input freezes up and gets stuck repeatedly inputting whatever the last input was. I've tested the simplest way to replicate the issue and it doesn't even need a camera for the issue to come up. If anyone would like to test and try to replicate the issue these are the steps its super fast and simple.

create new project(basic PC 3D project)

create a plane, and a cube

Add a basic character controller script to the cube (this time I used the official Unity code to be sure it's not an issue with code)

and that's it, that's actually all that was needed to create the issue for me. And to explain to anyone who may want to test it the issue is as follows: when you use wasd keys normally, everything works fine and the controls are responsive. However if you hold down one of the wasd keys while also moving your mouse (just wiggling the mouse should suffice) suddenly things will lock up and the cube will keep moving for a bit even after you let go of the respective wasd keys. In general if you hold a direction while simultaneously wiggling the mouse for a longer period of time, it will extend the amount of time the cube keeps moving after you let go of the direction. And this was done on Unity version 2020.1.16f1
If anyone has any idea what the issue may be its really appreciated.

sentences:
What is the most efficient way to work with lip sync/facial expressions in XNA? I've been searching for an answer forever, but I haven't found one. What options are there for lip sync/facial expressions in video games made with XNA? I have a few models for a game I'm building, and I would like to know if it would be better to set up an animation for every dialogue, but that would be very time-consuming and the whole collection of files would result in a massive-sized program.

I was thinking about an automated lip-sync system, but I wouldn't know where to start! Any thoughts?

sentences:
Importing z-brush cube to 3ds max causes shadow issues I have created cube model in z-brush then I exported it to .obj format. Seems vertex count is the same as in 3ds max as in z-brush.

In all my viewports I see cube, but in perspective I see not a cube but some like "extra shadows" on the each side of cube, like cube has not plane sides.

When I render it it also has not plane sides and some ugly shadows. How can I fix it, maybe I should know some tricks about it.

sentences:
How do I make a resolution independent system? I'm blanking on this one. I can anchor stuff on edges of course, that would make my UI resolution independent...until it changes so much that the graphics are too small. How do I scale appropriately whenever needed? How do I keep my graphics at the right proportion while scaling? I don't want them stretched if the resolution has a different proportion like 16:10 as opposed to whatever else.

Is there a true and tested approach to this? Video players show black borders because of this problem, is this not properly solvable?

sentences: Selecting all GameObjects in Unity I want to rotate all my GameObjects by 90 degrees. To do that I need to select all my GameObjects, how can I do so?

sentences:
C & SDL: Unexpected Behaviour with Renderer I'm creating a clone of the memory testing game SIMON. My program is simply four differently colored squares that light up one at a time in a random order. I wrote some code that lights up one square, dims it, waits 250ms and then lights up the next in the sequence. Rinse and repeat until the sequence is complete.

My problem is that everytime it lights up a square, it's lighting up all of the previous lit ones as well, instead one at a time. I hope I'm explaining that clearly.

Below is my code. I know it's silly code, but I plan to come back and find a better way to do it.

SDL_SetRenderDrawColor(renderer, 255, 255, 0, 255);
SDL_RenderFillRect(renderer, &squareTwo);
SDL_RenderPresent(renderer);

SDL_Delay(250);

SDL_SetRenderDrawColor(renderer, 50, 50, 0, 255);
SDL_RenderFillRect(renderer, &squareTwo);
SDL_RenderPresent(renderer);

SDL_Delay(250);

SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
SDL_RenderFillRect(renderer, &squareThree);
SDL_RenderPresent(renderer);

SDL_Delay(250);

SDL_SetRenderDrawColor(renderer, 50, 0, 0, 255);
SDL_RenderFillRect(renderer, &squareThree);
SDL_RenderPresent(renderer);

SDL_Delay(250);

SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
SDL_RenderFillRect(renderer, &squareThree);
SDL_RenderPresent(renderer);

SDL_Delay(250);

SDL_SetRenderDrawColor(renderer, 50, 0, 0, 255);
SDL_RenderFillRect(renderer, &squareThree);
SDL_RenderPresent(renderer);

SDL_Delay(250);

SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
SDL_RenderFillRect(renderer, &squareFour);
SDL_RenderPresent(renderer);

SDL_Delay(250);

SDL_SetRenderDrawColor(renderer, 0, 0, 50, 255);
SDL_RenderFillRect(renderer, &squareFour);
SDL_RenderPresent(renderer);

With the above code, I was hoping only one square will be lit up at once. Instead the first one lights up, and dims. And then the first and second square light up at the same time.

And to make this even stranger, I ran it on my work computer and it works like expected (both systems it was tested on are Linux, if that matters)! Maybe I changed something by accident after last testing it, but I really just don't recall that. Very strange.

Would anyone have any ideas or clues for me on this one?

sentences:
Calculating camera frustum planes using existing matrix I'm trying to get basic frustum culling against an AABB working, and I'm having a bit of trouble figuring out how to extract the frustum planes from my camera's transform matrix. All the example code I've found expects position, look, and up vectors, as you'd pass to gluLookAt. My camera matrix can be transformed by a parent and other bits of code, so those vectors never exist anywhere that I could use them.

I've looked at code for gluLookAt and tried to graft the inverse of that on top of the Lighthouse3D example for creating the Frustum planes. It's really close to correct, but I have objects flickering in and out of existence still, so something's not quite right. All of the related code is here, so I'm hoping this will be an easy find for somebody.

struct Frustum {
  enum {
    TOP,
    BOTTOM,
    LEFT,
    RIGHT,
    NEAR,
    FAR
  };

  Frustum(hsMatrix44 cam, float znear, float zfar, float angle, float aspect) {
    float nw, nh, fw, fh, tang;
    tang = (float)tan(angle * 0.5);
    nh = znear * tang;
    nw = nh * aspect;
    fh = zfar  * tang;
    fw = fh * angle;

    hsVector3 dir,nc,fc,X,Y,Z,P,U;
    hsVector3 ntl,ntr,nbl,nbr,ftl,ftr,fbl,fbr;

    Z.X = -cam(2,0);
    Z.Y = -cam(2,1);
    Z.Z = -cam(2,2);
    U.X = cam(1,0);
    U.Y = cam(1,1);
    U.Z = cam(1,2);
    X = U.crossP(Z);
    X = X * (1.f/X.magnitude());
    Y = Z.crossP(X);
    hsMatrix44 icam = cam.inverse();
    P.X = icam(0,3);
    P.Y = icam(1,3);
    P.Z = icam(2,3);
    nc = P - Z * znear;
    fc = P - Z * zfar;

    ntl = nc + Y * nh - X * nw;
    ntr = nc + Y * nh + X * nw;
    nbl = nc - Y * nh - X * nw;
    nbr = nc - Y * nh + X * nw;
    ftl = fc + Y * fh - X * fw;
    ftr = fc + Y * fh + X * fw;
    fbl = fc - Y * fh - X * fw;
    fbr = fc - Y * fh + X * fw;

    planes[TOP] = planeFromPoints(ntr, ntl, ftl);
    planes[BOTTOM] = planeFromPoints(nbl, nbr, fbr);
    planes[LEFT] = planeFromPoints(ntl, nbl, fbl);
    planes[RIGHT] = planeFromPoints(nbr, ntr, fbr);
    planes[NEAR] = planeFromPoints(ntl, ntr, nbr);
    planes[FAR] = planeFromPoints(ftr, ftl, fbl);
  }

  bool checkBox(const hsBounds3Ext& box) {
    for(int i = 0; i < 6; ++i) {
      float d0, d1;
      d0 = planes[i].W + planes[i].N.dotP(box.getMins());
      d1 = planes[i].W + planes[i].N.dotP(box.getMaxs());
      if((d0 < 0.f) && (d1 < 0.f))
        return false;
    }
    return true;
  }

  hsPlane3 planes[6];
};

hsPlane3 planeFromPoints(hsVector3 a, hsVector3 b, hsVector3 c) {
  hsPlane3 p;
  hsVector3 tmp0, tmp1;
  tmp0 = a - b;
  tmp1 = c - b;
  p.N = tmp1.crossP(tmp0);
  p.N = p.N * (1.f/p.N.magnitude());
  p.W = -(p.N.dotP(b));
  return p;
}

sentences:
Why can't I add a float4 read from a Texture2D.Sample in the Vertex Shader? These lines work (compile fine):

float4 offset = HeightMap.Sample(HeightSampler, input.Texcoord);
input.Position.xyzw += float4(0, 1, 0, 0);

These do not (any use of offset together with input/output Position causes the error):

float4 offset = HeightMap.Sample(HeightSampler, input.Texcoord);
input.Position.xyzw += offset;

No matter what I try to do to use the offset values to change the positions it breaks:

float4 offset = HeightMap.Sample(HeightSampler, input.Texcoord);
matrix<float, 4, 4> offs = {
    1, 0, 0, 0,
    0, 1, 0, 0,
    0, 0, 1, 0,
    offset.x, offset.y, offset.z, 1
};

output.Position = input.Position;
output.Position = mul(output.Position, offs);

Debug output:

(32,9): error X4532: cannot map expression to vs_5_0 instruction set
(62,19): There was an error compiling expression
(49): Error compiling effect hr=S_OK (0x00000000)

Anyone have an idea why?

sentences:
What kinds of conflict-resolution can be fun beyond combat in an RPG? As someone who grew up on the single-digit Final Fantasy games and AD&D, there are few ways of solving an rpg problem as fun as a fight. Different streams of accomplishment (object acquisition/crafting, skill trees, puzzles, player strategies, team combination/synergies, etc) all go into a few minutes of frenetic action, allowing for the feeling of accomplishment and progress via stat increases as the game progresses.

That said, we tend to characterize rpg players as murderhobos for good reason. When you incentivize killing things, it's not long before all problems start looking like something to hit with your sword. And when you're able to steal anything not nailed down, why not do it?

While other kinds of conflict-resolution can be fun when in their element (farm/ Civ/Sim games for the sense of building something, spy/ninja/assassin games for deftness and exploiting situations, social games for roleplaying a character or out-thinking the other guy), they're often not fun outside their very narrow venue. And because we're limited to conversation with a computer (at least in single-player games), social games can't even explore the whole of their venue.

I'm racking my brain trying to figure out how to properly gamify the societal ideals of don't-kill, don't-steal in such a way that attacking or stealing becomes a conscious choice, not just a default means of action...but at the same time keep the same diversity of fun-inputs that fighting/stealing games have. Most games just code in consequences: the town guards are sent after you and/or some faction is less willing to deal with you. But this feels unnatural, and only invites further gaming of the system, producing better murderhobos at the end.

My reason for doing so? The main theme of my game is a heavily philosophical one(think a halfway-understandable Xenosaga) on how morality might play out in the post-post apocalypse. While killing and stealing would be a part of that, I feel that our natural tendency as gamers wouldn't allow this question to play out 'fairly'.

Any idea on how to put killing and stealing on a truly equal playing field with other forms of conflict resolution?

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

Thanks!

Pickupobject.cs

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

public class pickupobject : MonoBehaviour
{
    GameObject mainCamera;

    bool carrying;

    public GameObject carriedObject;

    public float distances;

    public float smooth;

    float speed = 1000f;

    new Camera camera;

    // Use this for initialization
    void Start()
    {

        mainCamera = GameObject.FindWithTag("MainCamera");

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

        camera.enabled = false;

    }

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

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

        }
        else
        {
            pickup();
        }

    }

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

            int x = Screen.width / 2;

            int y = Screen.height / 2;

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

            RaycastHit hit;

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

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

                    carriedObject = p.gameObject;

                    //camera.enabled = true;

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

                    //carriedObject.AddComponent<MovingBall>();

                }
            }
        }
    }

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

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

    }

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

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

    //}
    void ThrowBall()
    {

        mainCamera.SetActive(false);

        camera.enabled = true;

       // carriedObject.AddComponent<CameraController>();

        camera.gameObject.AddComponent<CameraController>();

        carriedObject.AddComponent<MovingBall>();

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

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

     }

}

CameraController.cs

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

public class CameraController : MonoBehaviour {

   public GameObject icosphere;

    public GameObject abc;
    Vector3 offset;

    // Use this for initialization

    void Start () {

        icosphere = GameObject.FindWithTag("purpleball");

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

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

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

sentences:
Avoiding singletons for puzzle system Say for instance I have a puzzle with 3 switches that need to be in some configuration (say all on) in one room, that opens a door in another, with a load screen separating, so I can't link the switches directly to the door. My first thought was to create a singleton that stored the state of each "solution element" which in this case is the switches, but could be a correctly turned knob, ect. then a given "Puzzle Gate" like a locked door would check the required solution elements to decide it's own state, but I'm hesitant to use singletons for all of the commonly given reasons.

What alternatives do I have to singletons that would give me the same or similar control?

sentences: How do I use the Minecraft Coder Pack on Linux I downloaded the Minecraft coder pack to mod the game and decompile it, but how do I use it on Linux. Some sources seem to give specific directions, but they are not clear and they involve executing the .bat files. My Ubuntu does not recognize .bat file. How do I decompile a class file from changing a Minecraft version jar file to a zip and unzipping it? How do I decompile one of those class files using Minecraft coder pack? I have been wondering what at least some of the Minecraft source code looks like.

sentences:
When would a GPU need to write data to a vertex (or other) buffer? I'm trying to understand why, when and how a GPU would need to write data to some buffer inside its own Video Ram.

In Direct3D 11, there are two flags that concern this, which are D3D11_USAGE_DEFAULT and D3D11_USAGE_IMMUTABLE. The former gives the ability to read and write, the latter only the ability to read.

So, apart from the resources that imply actual rendering to, like back buffers or textures set to use in a render-to-texture scenario, is there any other case where one would prefer to use DEFAULT over IMMUTABLE? How would you get the GPU to change this data? (I guess from a shader?) Why is it not the default one the one that gives you read only access?

sentences:
Different revenue models between developers and publishers? I am working at a small game studio developing games for iOS and Android. We do the full journey here, from idea to finished product and we have funding to do so. However, with the smartphone market being a bit of a lottery for small developers we are looking into getting into a publisher deal.

What I am wondering now is what kind of different deals one could look at. From what I have gathered from reading a number of articles a common model it is that the publisher pay for the development cost and once the game is released the developer gets about 20% of the revenue. What I am wondering is if there are any other common models used between developers and publishers?

sentences:
Sphere collision response I have simple mechanism for testing of two balls colliding:

private static boolean isColliding(float firstBallX, float firstBallY, double firstBallRadius, float secondBallX, float secondBallY, double secondBallRadius) {
       final double a = firstBallRadius + secondBallRadius;
       final double dx = firstBallX - secondBallX;
       final double dy = firstBallY - secondBallY;
       return a * a > (dx * dx + dy * dy);
   }

And it works great. One of the balls is moving and the other (second one) is static.
I have two questions.

When a collision occurs, how do I change the movement of the first ball (the moving) one to its logical path? I suppose I should change the direction somehow, but cannot figure out how...?

The other question is how do I tell the static ball, after the collision move? And what is its path, direction and staff...?

Thanks in advance.

sentences: How to change Unity's display settings/resolution? Unity displays in poor quality on my computer (the software itself), I was wondering how to change resolution/display settings?

sentences:
Stretch line on bow using touch I have drawn a line on sprite representing the string of a bow. I want to stretch it with finger touch input, using onTouch. I have added a Physics body but I don't understand how to stretch the line.

It's a bow and arrow demo:

Here is the code I use:

protected Scene onCreateScene() {
        this.mEngine.registerUpdateHandler(new FPSLogger());
        mScene = new Scene();
        mScene.setBackground(new Background(0.3f, 0.8f, 0.9f));
        float centerX = CAMERA_WIDTH/2;
        float centerY = CAMERA_HEIGHT/2;

        Sprite sprite = new Sprite(centerX,centerY,this.regionBow, this.getVertexBufferObjectManager());
        mScene.attachChild(sprite);

        PhysicsWorld physicsWorld = new PhysicsWorld(new Vector2(0, 300), false);
        Line line = new Line(99, 10, 99, 240, 4, getVertexBufferObjectManager());
        line.setColor(0f,0f,0f);

        FixtureDef lineFixtureDef = PhysicsFactory.createFixtureDef(1, 4f, 0.5f);
        Body body = PhysicsFactory.createLineBody(physicsWorld, line, lineFixtureDef);
        mScene.getLastChild().attachChild(line);

        PhysicsConnector physicsConnector = new PhysicsConnector(sprite, body, true, true);
        physicsWorld.registerPhysicsConnector(physicsConnector);

        mScene.setOnAreaTouchListener(new IOnAreaTouchListener() {
            @Override
            public boolean onAreaTouched(TouchEvent pSceneTouchEvent, ITouchArea pTouchArea, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                return false;
            }
        });

        return this.mScene;
    }

sentences:
How do I change the sprite used for an object, while the game's running? Engine Used: Gamemaker Studio

I want to be able to swap between two armors on the player character. They've each got their own unique animation / general sprite stuff. How do I "equip" the second armor while the game is running? Is there even a way?

Do I need to destroy the object, and instead replace it with a different object that just has a different sprite?

sentences:
Why the AnchorPoint doesn't affect the `CCLayer` Positioning? I think there is a difference between the CCLayer and CCNode behavior when I change their AnchorPoint.

I will describe what I mean and please somebody explain it.

Scenario:
I start with CCNode

CCNode *node = ...;
node.setContentSize(ccp(W,H));
// 1.
node.setAnchorPoint(ccp(0,0));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placed at (X,Y).
// 2.
node.setAnchorPoint(ccp(1,1));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placeed at (X-W,Y-H).
//In other word, this line will move the (W,H)-point of the node to (X,Y)

In addition to the Positioning, all actions (like Rotating, Scaling) are based on this anchor point.

This policy is fair enough and you won't get confused when moving a scaled node (setScale(X)) to some position because the node's position ( and not node's contents!) will not change in the screen after any actions.

( PS: We knew that rotating/scaling a node will rotate/scale internal node contents)

Let's continue with CCLayer:

CCLayer *layer= ...;
layer.setContentSize(ccp(W,H));
// 1.
layer.setAnchorPoint(ccp(0,0));
layer.setPosition(ccp(X,Y); // This line will move the layer in a way that its (0,0)-point will be placed at (X,Y)
// 2.
layer.setAnchorPoint(ccp(1,1));
layer.setPosition(ccp(X,Y); // Unfortunately, This line will move the layer in a way that its (0,0)-point will be placeed at (X,Y).

Although CCLayer also use the anchor point for scaling, rotating and ... purposes, It does NOT use its anchor point for positioning!!!

Question >>>>  WHY? and How can I have the same CCNode-like setPosition() behaviour for CCLayer?

PS: I've also tried ->ignoreAnchorPointForPosition(true) but it didn't help.

(@cocos2d-x version is 2.2.3)

sentences:
How to match font size with screen resolution? So I'm working on a game using LibGDX, and I have a problem.

To make my game fit most resolutions, I created a base asset for each aspect ratio, for example, a main menu background image, I made it in 800X600 for 4:3, 1280X720 for 16:9 etc.

Now I am trying to incorporate TextButtons into the game, for the options; My problem is that I can't figure out which font sizes match with which screen resolutions. Is there a way to figure this out, or do I have to go one by one through each of the resolutions I have and just manually match the text to the resolution?

sentences:
How can I calculate force and acceleration? I have problem of calculating the movement of the object.

At the moment, I have a vectors calculated from the center of the screen minus the position of the object.

direction vector = centerScreen - positionObject

To calculate the new position of the object

position(new) = position(t) + directionVector * delta

The delta is the time frame rate.

Does anyone know how can I modify the above formula to calculate forces and acceleration? I want to have an object pulling other objects towards it.

sentences:
Customising character appearance though textures At the moment I am contemplating adding character customisation to my game, however I am unsure what approaches are available when it comes to using textures/decals to add facial features (like facial hair, hairstyle, scars/blemishes etc).

The character in question is stylised with a cel shader like effect.

So what are some approaches to take? Should I be using shaders to blend textures together by having the normal diffuse texture and then a mask texture to add facial hair or are there better more efficient results to achieve what I want?

Would another possibility be to use a shader and then bake the resultant blended texture to a new diffuse texture and use that?

To clarify, the customisation will be through textures only and not through adding/changing meshes

sentences:
Can I export a model and texture from a terrain file built in Unity3D? I am mostly familiar with building my level maps within unity, and have become quite use to its inbuilt terrain creator, in both generating my terrain, and spraying a texture on to it.

I am making a game using MonoGame XNA, and would like to use a terrain map I built with Unity. I would have to recover the file, however, and have not been able to find anything to support being able to, in the first place.

Can I export my terrain file with its texture, in any way, to use in XNA MonoGame?

sentences:
Effectively implementing a game view using java I am writing a 2d game in java. The game mechanics are similar to the Pokémon game boy advance series e.g. fire red, ruby, diamond and so on.

I need a way to draw a huge map maybe 5000 by 5000 pixels and then load individual in game sprites to across the entirety of the map, like rendering a scene. Game sprites would be things like terrain objects, trees, rocks, bushes, also houses, castles, NPC's and so on. But i also need to implement some kind of camera view class that focuses on the player. the camera view class needs to follow the characters movements throughout the game map but it also needs to clip the rest of the map away from the user's field of view, so that the user can only see the arbitrary proximity adjacent to the player's sprite. The proximity's range could be something like 500 pixels in every direction around the player’s sprite. On top of this, i need to implement an independent resolution for the game world so that the game view will be uniform on all screen sizes and screen resolutions.

I know that this does sound like a handful and may fall under the category of multiple questions, but the questions are all related and any advice would be very much appreciated. I don’t need a full source code listing but maybe some pointers to effective java API classes that could make doing what i need to do a lot simpler. Also any algorithmic/ design advice would greatly benefit me as well.

example of what i am trying to do in source code form below

package myPackage;

/**
 * The Purpose of GameView is to: Render a scene using Scene class, Create a
 * clipping pane using CameraView class, and finally instantiate a coordinate
 * grid using Path class.
 *
 * Once all of these things have been done, GameView class should then be
 * instantiated and used jointly with its helper classes. CameraView should be
 * used as the main drawing image. CameraView is the the window to the game
 * world.Scene passes data constantly to CameraView so that the entire map flows
 * smoothly. Path uses the x and y coordinates from camera view to construct
 * cells for path finding algorithms.
 */

public class GameView {

    // Scene is a helper class to game view. it renders the entire map to memory
    // for the camera view.
    Scene scene;

    // Camera View is a helper class to game view. It clips the Scene into a
    // small image that follows the players coordinates.
    CameraView Camera;

    // Path is a helper class to game view. It observes and calculates the
    // coordinates of camera view and divides them into Grids/Cells for Path
    // finding.
    Path path;

    // this represents the player and has a getSprite() method that will return
    // the current frame column row combination of the passed sprite sheet.
    Sprite player;
}

sentences:
Raypicking / raytracing in OpenGL Alright, so before you down vote saying that OpenGL doesn't support rays for rendering, please read:

So I want to detect a quad in opengl 1.1( I don't want to use opengl 3.0). I wanted to detect it using OpenGL, but that doesn't seem possible.

But basically I have one choice, which is kind of "hacky". I create custom matrices and store the transformed vertices somewhere, then do a simple collision test.

What is the common way of doing ray-tracing in legacy OpenGL?

sentences:
Is there a standard way to rig a humanoid? I am using some placeholder humanoid models for my game, which will be replaced later.  I am concerned that when I replace them, they will not work with my animations, due to different rigging.
Is there a standard rigging that artists use for humanoids?  Such as, is there always a the same number of body parts attached in the same hierarchy, or does this vary based on the artist/studio?  If there is a standard, what is it?  If there isn't how can I ensure that my animations and models play nice?

I use Unity, if it's relevant.
Disclaimer:  I am not an artist, and I have no idea what I am talking about.  Please feel free to ask for clarification.

sentences:
Points around a circumference C# Im trying to get a list of vectors that go around a circle, but i keep getting the circle to go around several times. I want one circel and the dots to be placed along its circumference. I want the first dot to start at 0 and the last dot to end just before 360. Also i need to be able to calculate the spacing by the ammount of points.

  List<Vector2> pointsInPath = new List<Vector2>();
    private int ammountOfPoints = 5;
    private int blobbSize = 200;
    private Vector2 topLeft = new Vector2(100, 100);
    private Vector2 blobbCenter;
    private int endAngle = 50;
    private int angleIncrementation;
    public Blobb()
    {
        blobbCenter = new Vector2(blobbSize / 2, blobbSize / 2) + topLeft;
        angleIncrementation = endAngle / ammountOfPoints;

        for (int i = 0; i < ammountOfPoints; i++)
        {
            pointsInPath.Add(getPointByAngle(i * angleIncrementation, 100, blobbCenter));
          //  pointsInPath.Add(getPointByAngle(i * angleIncrementation, blobbSize / 2, blobbCenter));
        }
    }

    private Vector2 getPointByAngle(float angle, float distance, Vector2 centre)
    {
        return new Vector2((float)(distance * Math.Cos(angle) ), (float)(distance * Math.Sin(angle))) + centre ;
    }

sentences: For a 2D XNA game, should I use the built in Vector2 or Vector3 or port my own class from ActionScript? I use a lot of 2D vectors in my Flash games - basically all velocities, positions etc I store in this way. My Vector2D class has lots of built in functions for rotation, dotproduct, projectOnto etc. The native Vector2 class doesn't seem to have half of this stuff, but it is used in a lot of places. The Vector3 has all this stuff, but has an extra dimension I don't need. So should I use either of the built in ones or port my AS3 class? Or should I try to extend Vector2 and add the extra functionality I need. Could that cause any problems?

sentences:
What are the code structures for storyline based game? I am curious about how storyline-based games are written.

For example: if the character done Event A, then he meets an NPC and result in Event B.

On the other hand: if the character didn't do Event A, then he meets an NPC and result in Event C.

From the code structure that I've thought up, the NPC should be an object of a class, and there should be a status variable that mark if character have done Event A or not.
However, what if there's thousand of similar type of Event as Event A? How'd I handle huge, complex storyline game in coding?

I just want to know exactly how the trick was done to keep in check of what Events have happened.

Another thing that I'm curious about is how Event is kept in. An object? or just a function?

For example:
Event A might have some flashy effect played in non-fmv ,while maybe Event B is an fmv, and Event C might be a battle.

and there may be variety of them. Therefore, how would I handle variety of Events with a consistence method? or maybe, at the very least, contain them in a consistence way (function? or Object?) I just want to know how the trick was done.

sentences:
How to change the color of an invalid texture? In openGL, when I don't bind a texture, or I bind a texture that was loaded incorrectly, any calls to texture2D/texelFetch in the shader will return vec4(0, 0, 0, 1), is there a way to change this to return vec4(1, 1, 1, 1) instead?

Initially I looked for a way to test if the sampler2D was valid, and when I couldn't find that I tried using glColor4f, but that doesn't seem to work either--although that could be the amdgpu driver, it seems to have some trouble with the old pipeline calls generally.

Is there someway to change what this default return color is?

sentences:
Unity error "must have a body because it is not marked abstract, extern, or partial" I'm trying to setup a system where I pickup an object drop it into a zone, and then the object is destroyed.

So far I have:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class TriggerZone2 : MonoBehaviour {
    public Text MyText;
    private int score;
    public bool CompareTag(string Player);

    // Use this for initialization
    void Start () {
        MyText.text = "";
    }

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

    void OnTriggerEnter(Collider coll) {
        score = score + 1;

        if (other.CompareTag ("Player")) {
            Destroy (other.gameObject);
        }
    }
}

Everything works up until I try to destroy the game object. The console keeps saying

  Assets/Scripts/TriggerZone2.cs(11,21): error CS0501: `TriggerZone2.CompareTag(string)' must have a body because it is not marked abstract, extern, or partial.

I've looked up quite a few threads, but I'm still not sure what it wants me to do with it. How do I fix this?

sentences:
How are the positions of skinned mesh vertices with multiple weighted parents stored? I'm trying to wrap my head around the basics of skinning and skeletal animation.  I understand not every skeletal animation implementation works exactly the same, but I'm just trying to understand the generally accepted practice.

I'm not sure if I used the correct terminology for my question, but my issue is this - if I have a vertex with a single bone as a parent, I can just store the local coordinates to the parent.

So if my parent bone is at any random location and the vertex is located exactly where the parent bone is, I would store it's x,y location as 0,0.  If it were to move the vertex down the length of the bone parallel to it, regardless of the parent bone's angle and location, the local x value for the vertex would increase and the y would stay the same.  This makes sense, and the math to get from any arbitrary point in world space to that local position to it's parent is also very straightforward.  This position local to the parent also seems like the ideal way to store the vertex information for any given vertex with a single parent bone.

My question is if the vertex has multiple weighted parents, what xy location is stored?  Would I need to store the relative coordinates to each parent for each vertex, or is there some way to store a single coordinate that represents it's weighted position relative to all parents?  And if the math isn't simple enough to be explained here, what is the math required to get this multi-weighted relative coordinate called so I can go find more information?

sentences: see inside but not light from outside I have a top down view of the interior of a house. I want to put a cover on the top so light from outside can't come in and I get more realistic lighting inside but transparent so I can still see inside. No clue how to achieve this in Unity. Any help would be appreciated. Ideally I'd just be able to use Unity's built in cube to make this.

sentences:
What is the fastest algorithm to check if two cubes intersect (where the cubes are not axis aligned)? I am looking for an algorithm to check if two cubes intersect. One can check if each of the 6 faces of cube A are intersected by each of 12 edges of cube B, but that is 72 checks. I've heard there is a paper from 1997 or so, describing a method that uses just 15 intersection checks, but I can't find it. Can you please share the name of the paper, describing it or describe it in your words.

This question deals with axis aligned cubes which is not really useful.
https://stackoverflow.com/questions/5009526/overlapping-cubes

sentences:
How do the Box2d and Bullet physics simulations work internally? I've seen box2d and bullet ported into JavaScript, but neither of them attracted me, except for the source code. It all seemed quite simple, once I looked inside.

What are they doing within each of those libraries to get nice physics simulation? I can not find any explanation.

sentences:
How to be two while creating game assets A friend and I are developing our first game, he as a graphic artist and I as a developer.
I'm confident with his drawing art and he his confident with my development skills, but the discussion comes when we are designing other art assets togethert, such as sound, music, screenplay, gameplay...

We often argue on subjective matters, such as "It would be better if there are more narratives" or "In my mind the music is too peaceful".

How would you recommend to collaborate on these art work?

sentences:
How to open box item animation? I want make 2d open box animation. Like cs-go open keys or other random box.
I need the basics of implementation it and i want get more information about it. Thanks.

Upd:
Steps.
I have array of elements.

I press to button and shuffle array.

I get random element from array by weight.

All elements in array have images.

So , after i press button all images start move with some accelerate to left or right. 6 images move to left. And what is next ? I need get random items images while acceleration is not end ? Or what ? I need logic example.

My example realization(I don't know working it or not): I need add to array new items while acceleration is enable or what ?
Or after i get random item by weight, i need sort array and past it item to last position and add other random items to this array. And after all i need loop to this array to last item. And when loop in last position i show it item in screen ?

I really don't understand how it working.. D:

sentences:
Strange anomalies when using WinForms with XNA I haven't seen any questions related to my issue, and this leads me to believe I'm missing something minor, however;

The Problem

I'm creating a game that is effectively launched from a windows form. Consider the following code.

static void Main(string[] args) {
        main = new TestGame(); // The Game class.
        menu = new Menu(main); // The form.

        while (true) {
            if (menu.ShowDialog() == DialogResult.OK) {
                if (menu.ShouldStartGame) {
                    main.RunGame( /* Some params */ );
                } else {
                    ExitGame();
                    break;
                }
            }
        }
    }

This loop works fine. My issue lies in the form itself. Firstly, DialogResult does not trigger at all. When the result from menu.ShowDialog() is printed, its result is "Cancel" which is not the option set for the button (OK.) As well as this, picture boxes, the form background colour and other such controls do not work properly. And the form appears to have a UI style from Windows versions before or during XP. Is this a known issue or am I missing something?

sentences:
Using "friend" classes in game development Typically in C++ game development speed is valued over encapsulation, you therefore see a ton of publicly accessible class members which really shouldn't be public.

I seem to find in most cases that only a very select few clases really need to known the inner workings of another classes to the point of modifying or reading their private data.

Creating public getters/setters for this private data exposes things which really shouldn't be modified willy-nilly.

Would a compromise here be to use friend classes? or is there some drawback to friend classes I'm not seeing.

sentences:
How do I avoid Race Conditions in UnrealScript? I'm trying to create a pseudo turn based battle system in the Unreal Engine (think Final Fantasy style).

I'm trying to avoid the Enemies and the players attacking while another animation is in progress. I thought the most simple solution is to have a flag somewhere that the player controllers check before starting an animation, and set it to a value before they start, and then reset it when they've finished.

However, I could see this leading to race conditions if two controllers (AI or player) try to access the variable at the same time, then both start their animations.

If I was writing this in Java I'd obviously use synchronized methods, but I haven't come across anything like that in UnrealScript. Is there another way to avoid this? Its probably not the end of the world, as its a pretty unlikely occurance, but I'd like to try and avoid it completely if possible.

sentences:
RPG Game Graphics Help/Review I've been working on an simple RPG game and I'm having troubles figuring out how my graphics should look.

I'm wondering if any of you could give some advice on how they are/could be more pleasing to the eye.

Here is a couple of screen shots of the game itself:

Any suggetions/comments!

Thanks!

Sorry, I'm unable to post more pictures, because of my repution :(

Edit:
 After some working on the look of the game here is where I got to...

sentences:
Should I be using spritesheets, because of or despite of my vast number of images? I am developing a 2D game, and I have a lot of sprites. I used 3D animations and models to render into 2D, to give them that "Fallout" or "Diablo" look to them. It is also easier than drawing by hand, lol.

I have already had to cut the framerate down to 15fps, which was the lowest I could lower without making them have a choppy look to them. However, it was sad due to how incredibly smooth 24 frames looked.

There are two reasons I did this:

1) Cut down on HDD space. The fewer the images, the smaller my total game will be.

2) Cut down on RAM consumption. The fewer images to load, the more likely I am to avoid issues bloating my RAM limitation.

However, if there was a way to compress the images in both HDD space and RAM, I would do so. I have tested it before, and most do not receive any change in quality when giving from RGBA8888 to RGBA5555 and only a little hit when converting to RGBA4444 in my TexturePacker program. I do not do this currently, because SFML seems to use the same amount of memory regardless of which type of .PNG image it is. I looked into researching how to load it differently, but failed to find anything on the subject.

I have read a lot about how to handle 2D video games. The consensus is overwhelming: Pack your Sprites into a Bigger Texture for great performance! So I pack my tiny sprites into a much larger spritesheet using TexturePacker.

However, I plan to have 10-15 animations per character, 5 directions to move, and 15-40 frames per animation (probably an average of 24). With 15 animations, 5 directions, and an average of 24 frames per animation; That is 1800 individual frames per character.
If packed in a sprite sheet, that is only 75 images instead. (One sprite sheet per Animation, per Direction. 15 * 5)

For the one huge boss character in the game, I cannot use a spritesheet and have to program a way to simply load in one image at a time. I do not know if I can do this for performance yet.

For the characters, I already pack them in a spritesheet. For a single character walking about, this seems to work most of the time, although sometimes it stalls. However, I attribute that to my ill conceived code that swaps out textures instead of preloading all textures for that character.

If I were to preload the textures, it makes sense for sprite sheets. I would only imagine it's a bad idea to preload 1800 tiny images for each character.

However, I imagine streaming them into and out of memory one at a time would be extremely fast, so I would only need to have a single image in memory at one time. Wouldn't this mean that at any given moment I would only have each character consume a few KB instead of 45+MB?

I imagine this would kill my performance, as streaming would need to be incredibly fast (15 images going into and out of memory and rendering, per second) and although the images would be very small- it might be a better idea to load character spritesheets into memory instead. But I will have to code a single-image stream-like render system for my larger boss character anyway.

I have been experimenting, but it is not a simple process. Especially given the fact I am working on other parts of the game engine that do not deal with graphics right now.

sentences:
C# Console Snake Game, sort of fps problem I have about 200 lines of code, really simple oop.

When I load the console game (snake), I don't see it running smooth, like fps problems in in games, but I don't understand why, because my files are a lot lighter and demand less resources than heavy games.

Thanks.

Linking my files to Pastebin

Main file: http://pastebin.com/60aeEBRa

SnakeObject.cs: http://pastebin.com/z0MPwNSA

Utilities.cs: http://pastebin.com/7jLDKUQ9

FoodObject.cs: http://pastebin.com/w1HuBQK4

RocksObject.cs: http://pastebin.com/QYcNbSad

Much thanks for your help.

I'm welcoming tips.

Thanks

sentences:
Small 3D Scene Graph I'm looking for a 3D graphics library (not a complete game engine). Preferred a scene graph. Something small (unlike jME, XNA or Unity), that I can easily expand and change.

Preferred features:

Cross Platform
Wrriten in Java/Scala (JOGL or LWJGL), C# (preferred OpenTK), Python or JavaScript/WebGL.
Support for OpenGL is a must. Direct3D is optional.
Some material system
Full support for some model format with full animation support (preferred COLLADA)
Level of Detail (LOD) support
Lighting support
Shaders, GUI, Input and Terrain/Water support are also preferred, but not required

Thanks!

sentences:
Possibly a more efficient way to structure my game's map? I need a little help with structuring my map. I want to make it efficient but I'm not sure if there's a better way to do this:

public class Map
{
    Chunk[][] Chunks;
    Object[] Objects;
}

public class Chunk
{
    public int[][] Tiles;
    public List<int> Objects;
}

This is the current structure of my map. I basically load and unload chunks if the player is too far from them. Every chunk has the same size, and has a list of objects. For each integer in the list of integers in a chunk, the corresponding Object will be updated in the parent map.

This way, I can handle collision detection without comparing two objects that are far apart: I only compare objects to other objects that are in the same chunk, or neighboring  chunks.

However, I'm wondering if there is a better way to structure my map. Faster runtime. Less processing. More efficient.

This may seem like an opinion based question but for those who perceive it that way, the question is how can I improve my map to make it more efficient?

sentences:
2D physics rotation w/ XNA I'm creating a simple game with space ships made of blocks that are all the same size.  After having looked at this: Calculating the rotational force of a 2D sprite I have created the following code for applying a force

public void AddForceAtBlock(Vector2 force, Block block)
    {
        float mass = 1F*blocks.Count;
        this.velocity.X += force.X/mass;
        this.velocity.Y += force.Y/mass;
        Vector2 momentArm = GetGameWorldCoordinates(block) - centerOfMass;
        Vector2 parallelComponent = momentArm * (Vector2.Dot(force, momentArm) / Vector2.Dot(momentArm, momentArm));
        Vector2 angularForce = force - parallelComponent;
        Vector2 torque = angularForce * momentArm.Length();
        float momentOfInertia = 10000F*blocks.Count;
        float angularAcceleration = torque.Length()/momentOfInertia;
        this.rotationalVelocity += angularAcceleration;
    }

However this code is unable to create negative rotational acceleration so I think I did it wrong.  Will someone point out to me what's wrong here?

All blocks are 50 units wide, this is the output for a 3 block ship like so: TST where T are thrusters and S is a dull forceless block.  Floats are slightly imprecise as is shown in the debug log but it shouldn't matter for videogames.

Right Thruster
Stop 1: force = (0, 0.951147) momentArm = (50,0) parallelComponent = (0,0) torque= (0, 47.55) angularAcceleration = 0.001585 centerOfMass = (0,0)

Left Thruster
Stop 2: force = (0, 0.951147) momentArm = (-50, 0) parallelComponent = (-8.315191E-08, 7.269371E-15) torque = (4.157595E-06, 47.55735) angularAcceleration = 0.001585245 centerOfMass = (0,0)

As you can see the equation seems to be working but it fails to make the right thruster's angular acceleration negative.

sentences:
Box2d jetski on water At the moment I am trying to code a 2d game in java, where a jetski is riding on water. If you press on the screen the jetski should dive down and jump back up on release. How do I have to do this in Box2d? My idea was to put a rectangular body as the water and an other one as the jetski. Since I am new to box2d I don't really know how I should bring this into code.
I hope one of you can help.

sentences:
understanding spatial hash function behaviour and Knuth for int64 I implemented open-indexing sparse 2D spatial HashMap, and I'm quite satisified with performance ( ~30-70 CPU cycles to get object at particular location for size ~16 Milion objects ).

However, I don't understand behaviour of hashFunction. Just by trial and error I found out that best performing for my case is slightly modified  Knuth's hash function:

return i * 2654435761 >> 8;
( original Knuth's hash function is return i * 2654435761 >> 16; )

with this hash function I get no more than 1-2 buckets maped to the same hash (when capacity is sufficient) ... the histogram looks like:

689780 without collision (buckets mapped to same hash)
358791 with 1 colision
5 with 3 collisions

but I have no idea why, and why it is performing better with >>8 than >>16), and if this behaviour is general or somehow specific for my settings

I also tried other hash functions which are used as pseudo random generators .. some are here:

inline ULONG hashFunc( ULONG i ) {
// see http://stackoverflow.com/questions/664014/what-integer-hash-function-are-good-that-accepts-an-integer-hash-key
//return  ( ( 2166136261UL ^ i ) * 16777619 );              // VERY BAD
//return  ( 2166136261UL ^ (i * 16777619) );                // VERY BAD
//return ((i >> 16)^i);                                     // NOT WORKING
//return ( i * 2654435761 >> 16 );                          // Knuth's multiplicative method // GOOD
return ( i * 2654435761 >> 8 );                             // GOOD, even better than Knuth for map size 2^16 ( 65536 fields )
//return ( i * 2654435761 >> 16 ) ^ i;                      // REASONABLY GOOD but worse than pure Knuth
//i = ((i >> 16) ^ i) * 0x45d9f3b; i = ((i >> 16) ^ i) * 0x45d9f3b; return  ((i >> 16) ^ i);                                        // REASONABLY GOOD but worse than pure Knuth
//i = ((i >> 16) ^ i) * 0x45d9f3b; return  ((i >> 16) ^ i); // LESS GOOD
//i = ((i >> 16) ^ i) * 0x3335b369; i = ((i >> 16) ^ i) * 0x3335b369; return  ((i >> 16) ^ i);                                        // LESS GOOD
};

all are performing worse than Knuth or modified Knuth. ( Just empirical observation, no idea why )

The questions:

Do you have experience that some other hash function performs better for such job ?
Do you understand the behaviour?
Do you know how to properly make analogy to Knuth 32bit for 64bit integer ( because if I understand it correctly, the 32bit golden ratio multiplicator is prime number, I'm not sure If it is easy to get multiplicator with such property for 64bit )

some details for explanation:

I have to say that I use the hash function somewhat differently than is common:

First I discretize double x,y to uint16 ix,iy
Then I compute bucket index as uint32 bucket = (iy<<16)+ix;
Then I compute the uint hash = hashFunc()&mask where mask = capacity -1 and capacity is power of 2 ( &mask is basically modulo capacity  ). I know that many people recommend use prime-number capacity for hashmap, but I find it tricky to find proper prime number during resize-ing, and also & is faster than modulo.

My hashmap is open-indexing, and it is able to realize if the object is in particular particular grid tile (ix,iy = bucket ) without actually dereferencing the object pointer, which I think gives it speed advantage.

each memory field of the hashmap stores not only pointer to the object TYPE* object but also the bucket index uint32 bucket to which the object belong and number of objects uint n with the same hash. The bucket index is used to check if object belong to particular (ix,iy) position or if it was mapped to that hash by chance (when there are collisions). I do not store hash since I think it is faster compute it on the fly than use more memory.

( you can see code here ( HashMap | HashMap2D | test_HashMap2D) If you are interested

sentences:
Rendering Unity across multiple monitors At the moment I am trying to get unity to run across 2 monitors. I've done some research and know that this is, strictly, possible. There is a workaround where you basically have to fluff your window size in order to get unity to render across both monitors.

What I've done is create a new custom screen resolution that takes in the width of both of my monitors, as seen in the following image, its the 3840 x 1080:

How ever, when I go to run my unity game exe that size isn't available. All I get is the following:

My custom size should be at the very bottom, but isn't. Is there something I haven't done, or missed, that will get unity to take in my custom screen size when it comes to running my game through its exe?

Oddly enough, inside the unity editor, my custom screen size is picked up and I can have it set to that in my game window:

Is there something that I have forgotten to do when I build and run the game from the file menu? Has someone ever beaten this issue before?

sentences:
jquery ondrag map load only what has not been viewed When a person mouse down, moves the mouse, and mouses up the system gets the different in the mouse down coord and the mouse up coords and loads in the new map items. However, the problem is it loads them every time so I want a way to track what has been loaded without too much work on checking or storing checks.

Most promising. Came up with while typing this. Section the screen into 250x250 sectors and check if that sector has been loaded.
Keep track of each corner of the screen and see if there is an area of those that have not loaded.
Keep a record of the corners of the screen. When mouse up coords are greater then load the different. Problem is if they are at coord 10,000 then it will load from -10k to 10k positive and that is a lot of items to load.
Check every item on the page to see if it is loaded. If I do this I might as well reload the whole page.

If anyone has some suggestions; feel free to pass them on.

sentences:
Rotate an object on itself, from one random Quaternion to another I have a situation:
I have a 3D object in the world. let's say a sphere.
I have 2 random directionnal vector: vector A, and vectorB:

My question is: How to I rotate over time my object, from A to B ?
The vector A is important: I don't want to simply rotate the forward of the object from current forward to B.

I know I can use the function vector3 C = Vector3.SmoothDamp(...) in unity to lerp between my 2 vectors A & B.

but then ok, I have vector3 C, how do I apply the rotationof my object to C ?
if don't want to do:
gameObject.transform.forward = C;

I want something like:
gameObject.transform.rotation = SomeQuaternion(C, initial rotation A).
or something.

Thank you for help !

PS: I don't want to parent / unparent gameObject or something like that, i want the math answer, using Quaternion.

sentences:
How i can sign and/or group a specific set of vertices in a 3D file container like OBJ ? - in Blender I would like to export a 3D model with each part having a name or a label if you will.

For example i would like to export a model of an human body and name each part in specifics vertex groups like: left hand, right hand, right foot, head, ears, ... and you got the idea; so i can have a single 3D model that i can explode in various parts if needed.

If there is a better technique about how to mark vertex groups in a 3D file please share your solution. As 3D editor i use Blender.

sentences:
Re-create 2D side-on wave effect from Worms game I'm trying to recreate the waves/water effect from Worms ( see here http://youtu.be/S6lrRqst9Z4?t=31s ) From what I understand its not actually a sprite, its procedurally generated by something like a sin wave.

Has anyone created something like this before? or any idea how I would go about it?

sentences:
How can I remove Magic Pink from an image at runtime using GraphicsDevice? In XNA 4.0, I want to load all my textures at runtime, which means I will not be able to take advantage of the content processor. (This is fine because it would allow people to change graphics and other elements without having to have XNA installed to compile them into .xnb)

Suppose that I can't (or don't want to) use premultiplied alpha on my images, and instead rely on the classic magic pink (255, 0, 255) method:

How can I turn it into a Texture2D object and convert the pink to be transparent using GraphicsDevice? It is trivial to iterate the data with GetData() and SetData(), but this uses the processor, rather than the graphics card.

sentences:
Why would I add components in code? Watching a Unreal Course, and the instructor is creating a default pawn c++ class.  He is adding all the components with code, but this seems really inefficient to me.  Why can't you add components in the engine like you can with blueprint classes?  Also, I know you can convert c++ classes to Blueprint classes and still code using attached c++ components, is there a downside to doing this?
my main questions are these:
What is better about adding components in code?
What is the difference between creating a blueprint class and creating a c++ class but converting it into a blueprint?
What are the benefits of each?  thnx.

sentences:
Simplest way to render image over top of another with another image used as mask in OpenGL? The effect I'm looking for is to have a single large background image that is always visible (at full alpha) and then show a second image (what I call a light map or specular map) that is partially shown over the top based on a third image (which is effectively a mask).

The effect is similar to this effect except instead of simply darkening or lightening the background image using the third image it needs to mask the second without effecting the first at all.

The third image is the only one that moves therefore hard baking the third images alpha into the second image isn't an option.

If my explanation isn't clear I'll provide visual examples when I have more time.

I'd prefer not to go down a shader route as I haven't taught myself this area yet so unless I have too I'd rather try to achieve this with simple alpha blending.
Happy to use a shader approach.

Cheers.

Additional

These third images are obviously light sources being cast onto the first image showing the specular information from the second image to simulate the light 'shining' off the objects in the first image. The solution I implement will need to allow two light sources to potentially overlap so my current thoughts are that the alpha values of the two images will need to be combined (Added?) to produce a final image which masks the second image?

Don't worry about things like coloured lights. For this technique the lights are all considered white.

sentences:
Collision response using the Minimum Translation Vector I am trying to use the Minimum Translation Vector (MTV) returned from the SAT algorithm for simple collision response. Please see the example below.

By separating the colliding boxes by moving the black box along the MTV, the box is now colliding with the other green box below. Moving the black box along the MTV for the collision with this new box then brings the box back to colliding with the first box, and an infinite cycle of trying to separate the boxes begins.
Am I missing something, or is collision response not possible using the MTV?

sentences:
Adding a video to a Level in a Portal 2 Mod I'm currently working on my Portal 2 mod and I'd like to add a video to be displayed on a projector like the Dollar$ and SENSE video at the end of Portal 1. Currently what I have is a simple recreation of a room in The Fall chapter of Portal 2, and I want to have a video displayed on the projection screen.

If anyone could give me instructions, or point me a link on how to do this that would be great.

sentences:
Is it unethical to make a game AI that is secretly non-competitive? In several games the AI is designed to give the player an easy time without their knowledge. This can be having a 0% chance to hit the first time you appear, enemy letting you sneak up on them by not turning around, or the lowering of difficulty when the player is hurt or has restarted several times.

I would be offended if at the end of a board game or sport I was told that a human had not tried their hardest.

Does the same ethics exist for an AI?

edit
As in the title, my main concern was keeping the handicap hidden from the player, for example, when playing a shooter it is reasonable to expect the player knows the AI has an artificial reaction time and poor aim but my question was about games that hide things such as enemies not using the best weapon or lowering their difficulty when the player is inured.

sentences:
Determine animation frame from interval I have an array of sprites that are displayed in-order to make an animation. There is code in an update loop that has access to a value 'time' indicating how far along the animation is. Time is a float between 0 and 1 inclusive. It uses this value to calculate which frame to display.

update(time) {
  frames // An array of animation frames
  current_frame_index = time / animation_length
  display_frame(frame[current_frame_index])
}

This works if you assume that each frame is displayed for the same amount of time.

I would like to enhance this by allowing frames to have arbitrarily defined durations. So if I have a set of frames and durations:

name           duration

frame_one      0.2
frame_two      1.1
frame_three    1.0
frame_four     0.75
frame_five     1.4

and a value indicating the animation's progress, how can I determine which frame to display?

Thanks!

sentences:
How can I control ads frequency? This question was already asked a while ago, and I wanted to check the present situation:

Can I control ads frequency from the dashboard? (e.g. frequency
capping in Admob)
Can I control ads frequency through Unity IAP API?
If not, does that mean that I need to implement all that "frequency
control" functionality manually?

sentences:
Current library situation Allright so I've been doing some searches, here what I got:

SDL: It is a standard, very mature but very old. (I got posts of late 2009 where they were still waiting for the 1.3 to come up...we are still waiting 3 years later). Also it seems abandoned and old style (it's around from the '98). And also it's made in C (for this there's no downside nor upside. Someone prefers C over C++ nowadays for some reason and C can run on C++ but not viceversa).
SFML: It's a new born in the libraries. It's not very mature and lack of a lot of documentation. It was buggy till 1.6 but now the 2.0 is quitely good (it's the one I've tried). It has a lot of things built in (even the possibility to easily use OpenGL). It's in C++ and has the OOP paradigm.
Allegro: I haven't heard much about it. It gives me the idea of a toy, but it's not an opinion I count on. It is C based (like SFML) but doesn't have that large community (like SFML).

I'm considering only cross platform libraries. Now I'd like to make few questions about this situation:

Is SDL falling apart?
Why isn't SDL being update to the so awaited 1.3 (which will, they say, support iPhone and phones) in 3 years?
Is SFML gonna take SDL place?
Why people say that SFML is more abstract then SDL? It seems pretty much the same to me. You have likely all the configurations you want on both.
Allegro had a troubled story. It was only for DOS, then it was ported for other platforms etc... Is it really cross platform?
How stable is Allegro?

Thanks.

sentences:
Artificial Intelligence - when to update pathfind? Right now I have a pathfind algorithm A* so I'm already using it to move the player around.
My problem comes to the NPC'S. They find the path to the player but if the player change the position they have to find a new path all the time? or there's something I can do to avoid so many calculations?

Example
I have an enemy 5 units of distance from the player.
He moves to 4 units of distance based in the path he already found and then search the path again? or does he make half of the path until he search for a new path?

I imagine making that for 5 or more enemies may make the game slow? (I never tested it before)
Any toughs?

sentences: How to convert game object world position to hex grid cell coordinates? I have a hex grid and a game object, let's say it's the player. What I want to do is know on which cell the player is on based on his world position, this would be easy on a simple grid but on a hex grid it's giving me a headache.

sentences:
Flash Origin Problem with Movie Clips I'm working on a game that uses Flash for the user interface. I'm running into an odd issue with the origin of a library movie clip. Here are the steps to reproduce:

Create a new MovieClip and construct a single rectangle with both a fill and a stroke.
Set position of rectangle to (0,0) and notice that the origin is at the center of the border stroke surrounding the rectangle.
Change position of rectangle accordingly so that the origin is truly the top left (so if the stroke surrounding the rectangle was set to 10, adjust the position of the rectangle to 5,5.
Enable 9 slice for movie clip so that when you scale the rectangle it doesn't scale or distort the stroke surrounding the rectangle.
Drag an instance of the movie clip to the stage and use the free transform tool to scale it to the width of the stage. It should visibly be as wide as the stage.
Run the flash file and verify that the width during execution is not as wide as it was in design view.

So in a nutshell it seems that when you use the free transform tool, it distorts the origin even though 9 slice is enabled and it shouldn't (I would think). I understand that Flash denotes the center of a stroke to be the starting point and not the edge, which is why I adjusted the origin accordingly while editing the movie clip.

What I really need here is pixel perfect positioning for vector based components. I should be able to drag and drop a library movieclip that provides a window with a fancy border around it and scale it to whatever size I need, and place it where I need it to be without any odd positioning problems.

Here are some screenshots of the problem:

( i.imgur.com/8WU2F.png ) is a shot of my window with 9 slice enabled. You can see that the origin is correct being the top left of the window graphic.

( i.imgur.com/ciK8l.png ) is a shot of my window after using free transform to scale it to the width of the stage. It's pretty much perfect in design view

( i.imgur.com/QFUiJ.png ) is a shot of the flash application running. Notice that the window is no longer the width of the stage? I don't get it. It makes it very difficult to position because in order to get this to look right while executing, I have to make the window wider than the stage in design mode.

Any help is greatly appreciated. I'm sure it's something silly. This is pretty much bread and butter stuff that's been around since the early days of flash.

sentences:
Replace black color by transparent color XNA I'm actually trying to replace black color of my texture by a transparent one.

How can I do to remove the black pixels, should I use a AlphaTestEffect, or can I use the BasicEffect?

Thank you.

sentences:
Box collider pushes me out of it's area slowly, I can pass through it if moving quickly I am new to Unity. I Setup a character in unity2D with a rigidbody. I had the scale off my sprites set to 100 pixels per unit. At this scale, my rigidbody character stood on top of platforms and could not pass through walls containing box colliders. I decided, that to make things easier, I would change all sprites to 1 pixel per unit. After doing so, I scaled everything (variables, sizes, etc.) by 100. I confirmed that the box colliders on both the caharcters, floor, and walls, are all in the same places, relatively. The box colliders on the floors still work, but the wall box colliders behave differently. When I walk into a wall, the wall slowly pushes me in a direction (depending on whether or not my character has walked through half the wall or not). The wall should be stopping my motion completely.

The code is very simple, but this is what I use to move:

if (Input.GetKey (KeyCode.D)) {
        transform.Translate (Vector2.right*moveOffset*Time.deltaTime);
        transform.localScale = new Vector3(1,1,1);
        anim.SetBool("moving",true);
    }

Do note that the moveOffset variable, was scaled by 100 after the change. Thanks in advanced!

sentences:
Split the camera into sections? I have a layout for my game similar to this:

Where the light gray area is reserved for HUD elements and the dark gray area is reserved for the actual game. One function I want to offer in the dark gray area is the ability to zoom and move around, which works independently from the light gray area, meaning that no matter how far I zoom in/out or how far I move, the light gray area remains unaffected.

How can I do this without always taking the offset center into account? How can I completely separate the game play part and the HUD?

sentences:
What would be the best way to find an open space in a level? I'm working on a 2D game where you use paint to add tiles to a level and right now I'm working to add warp tiles. I have it set up so certain direction-oriented paints use two points (a start and end) to determine which direction the tiles will point (left, right, up, down.) The warp tiles have these points, but they'll be added to two other lists (warp start and end). The way the warps work is: if the player hits one tile they'll be teleported to the corresponding warp tile. Now, if I'm going to get this to work properly, I need to make it so the player can't be teleported into a wall or off the map. So I need to move the point to an open tile exactly one space away from any walls.

What would be the best way to do this?

sentences: Getting started with Box2D for iOS I just want to run any Box2D "Hello World" or test apps.  I've downloaded the source twice (zip file the first time and via svn the second time), followed the build instructions (do stuff w/ cmake, "make", "make install" etc) and don't know where to go from there.  How do I run the test apps or Hello World apps that come w/ Box2D on my iPhone (or simulator)?

sentences:
Correct primitive to start with for modified cone shape I am very new to Maya and trying to make a Nikon F camera from reference images.

I can't quite wrap my head around how I would make the shape on top of the camera because it is essentially a square cone but has some modifications to the base and front slanted side that I can't seem to achieve with a square pyramid, I believe because of the rules of quad/tri geometries

Is this possible by starting with a square cone? If so how do I apply the relevant loop cuts horizontally and vertically?
Alternatively if is best to construct with another primitive could someone please detail which one?

sentences:
Why the Vector3.Dot value is -12 when running the game? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System;

public class InteractableItem : MonoBehaviour
{
    public string currentMode;

    private Transform player;
    private InteractableMode currentInteractableMode;
    private string currentDesription;
    private float originDistance;

    private void Awake()
    {
        player = GameObject.Find("Player").transform;

        originDistance = transform.GetComponent<InteractableItem>().distance;
    }

    public enum InteractableMode
    {
        Description,
        Action,
        ActionWithoutThrow
    };

    public enum ViewMode
    {
        FrontView,
        AllView
    };

    public ViewMode viewMode = ViewMode.AllView;

    public InteractableMode interactableMode = InteractableMode.Description;
    public float distance;

    [TextArea(1, 10)]
    public string description = "";

    public bool IsAnyAction()
    {
        return interactableMode == InteractableMode.ActionWithoutThrow || interactableMode == InteractableMode.Action;
    }

    public bool IsActionWithoutThrow()
    {
        return interactableMode == InteractableMode.ActionWithoutThrow;
    }

    private void Start()
    {
        currentMode = GetComponent<InteractableItem>().interactableMode.ToString();
        currentInteractableMode = GetComponent<InteractableItem>().interactableMode;
        currentDesription = GetComponent<InteractableItem>().description;

    }

    private void Update()
    {
        var heading = transform.position - player.transform.position;
        var dot = Vector3.Dot(heading, -transform.forward);

        if(viewMode == ViewMode.FrontView
            && dot < 1)
        {
            transform.GetComponent<InteractableItem>().distance = 0;
        }

        if (viewMode == ViewMode.FrontView
            && dot > 1)
        {
            transform.GetComponent<InteractableItem>().distance = originDistance;
        }
    }
}

The script is attached to some objects and one of them the ViewMode is set to FrontView and then when running the game first time the dot value is -12 and then it's getting inside and going the line :
if(viewMode == ViewMode.FrontView
    && dot < 1)
{
    transform.GetComponent<InteractableItem>().distance = 0;
}

but it should not set the distance to 0.  only if I'm getting close enough to the item then it should see the item from the front and then only if I'm moving the player behind the item the dot should be minus and set the distance to 0 but for some reason the dot is minus 12 when running the game so it's setting the distance to 0 right away.

sentences:
Is It More Efficient To Make Games In Languages I Like? Is it more "efficient" to develop games with languages you're good with and like best rather then the "best" language?

For example: I like C# (It's My First Language) and I'm really good at it and used to how it works. I'm not as good with C++; I'm kinda slow at it because I don't prefer how the systems work, like I think int a[] is not as good as int[] a.

Would it be better to go with what I know best or what's the "best" available?

sentences:
Good system for experimenting with shaders in different languages I'm trying to experiment a bit with shaders and they have been programmed in several different languages (GLSL,  Cg and HLSL). Now most systems (dirrectX, openGL) have only support for one of them. Does anybody know of such a system that easily allows all 3?

Thank you

sentences:
Use an external sprite or image file in flixel game in flashbuilder Is there any way to use an external image/sprite file for the graphic of a FlxSprite instance?

Say I declare my player FlxSprite as follows:

player = new FlxSprite(FlxG.width/2 - 5);
player.makeGraphic(10,12,0xffaa1111);

How could I instead instantiate the FlxSprite using my own spritesheet or image?
I have seen others do it in the Flixel demos , and in the featured games.

sentences:
Bukkit shoot tnt where player is looking Possible Duplicate:
  Bukkit shoot tnt & help with vectors

Hello. I want to shoot a piece of tnt from the players face and then let it explode when it hits the target block.

I set it up so where the player looks and type in /tnt [power] /cannon [power] or /t [power] it will blow up at the target block:

        if (cmd.getName().equalsIgnoreCase("cannon")) {
        if(!perrmissionCheck(sender, "Needs.cannon", "cannon")){
            return true;
        }
        if (!(sender instanceof Player)){
            sender.sendMessage(nameC+"You must be a player to preform this command.");
            return true;
        }
        Block block = ((Player) sender).getTargetBlock(null, 50);
        Location location = block.getLocation();
        float power = 4;
        if (args.length == 1){
            power = Float.parseFloat(args[0]);
        }
        sender.sendMessage(name+"BOOM!");
        block.getWorld().createExplosion(location, power);
        return true;
    }

That's all fine and dandy but I want it to appear in front of the user then start to move away towards the target block. And NOT blow up before it reaches the target block. Any help is greatly appreciated.

EDIT: I think it may have something to do with vectors but I have no idea how to use them.

Thanks.

sentences: Time calculation between openGL update calls In XNA, the system calls update and draw function with the time information. This contains information such as how much time has passed since last update was called. This makes easy to integrate time and do animation calculation accordingly. But I dont see any such mechanism in openGL. I see openGL requires programmers to have their own implementation which could be buggy or inefficient. Is there any standard (and efficient) code that demonstrate this practice in openGL?

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

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

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

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

sentences:
Where do I begin if I want to write a C++ 2d game? I am a C# web developer and I want to expand my skillset and have some fun while doing it. I know some of the basics of C++ and I would love to write a simple 2d game/game engine for myself using C++. What other libraries or SDKs do I need and where would I find some tutorials and informational resources to move forward?

I've already looked into XNA with C#. There are a lot of resources for that but I would rather use non Microsoft products. The point of this is to have a little fun while becoming a better rounded programmer.

Please note that I'm not asking for the best place to start. I'm just asking for a place to start.

Thanks for any help!

sentences:
Designing a four-directional movement control I'm developing an RPG for iOS. Currently, I plan my controls to look like this:

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

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

sentences: Having Your Own Copyrighted App Automatically After Publishing I have a question regarding for the game app and in business. You see, I decided to publish an app to Google Play. When I published it, does this app automatically declared that this app is copyrighted or copyright protected by the publisher and creator like me itself or not? If not, does it have to seek something or required to register this app for copyright authentication via online or at office or not?

sentences:
Sound Synthesis from object collision in Virtual Reality Environment I have a project whose subject is "Sound Synthesis from object collision in Virtual Reality Environment" First of all, I have to define some objects with certain attributes (like shape, mass, material) and then I have to create sound from the collision of these objects in C++ according to their attributes, area of collision etc. I think I have to use some sort of Physics Engine like Bullet or ODE but I'm not sure how to start this project. Is there any Physics Engine specialized in Sound Synthesis?

I've come up with PhyA but I don't know how to download it and implement it. http://www.tech.dmu.ac.uk/~dylan/z/phya/

P.S. I intend to use CHAI3d or H3dApi because I have to use the Falcon device.

sentences:
Order of render with transparency opengl I tried to render using different render configurations (GL_BLEND_FUNC()) but I couldn't get the back object to render in certain angles. The first screenshot here shows one angle where the back object is not visible through the front one. In th second screenshot, I looked at the blocks from 180 degrees.

Is there a way I could render them through? Or would I have to implement a sorting algorithm?

sentences:
ID3D10Device creation failure in release mode My ID3D10Device creation works fine in debug mode but I throws an error in release mode:

DXGI_SWAP_CHAIN_DESC scDesc = {0};
    scDesc.BufferDesc.Width = desc.width;
    scDesc.BufferDesc.Height = desc.height;
    /*scDesc.BufferDesc.RefreshRate.Numerator = 60;
    scDesc.BufferDesc.RefreshRate.Denominator = 1;*/
    scDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
    scDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
    scDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;

    scDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
    scDesc.BufferCount = 1;
    scDesc.OutputWindow = desc.hWnd;
    scDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
    scDesc.Flags = 0;

    scDesc.Windowed = true;
    scDesc.SampleDesc.Count = desc.sampleCount;
    scDesc.SampleDesc.Quality = desc.sampleQuality;

    // Create the device.
    UINT createDeviceFlags = 0;
#if defined(DEBUG) || defined(_DEBUG)
    createDeviceFlags |= D3D10_CREATE_DEVICE_DEBUG;
#endif

    HRESULT hr;
    hr = D3D10CreateDeviceAndSwapChain(
        nullptr,
        D3D10_DRIVER_TYPE_HARDWARE,
        NULL,
        createDeviceFlags,
        D3D10_SDK_VERSION,
        &scDesc,
        &g_Renderer.m_DxCore.pSwapChain,
        &g_Renderer.m_DxCore.pDevice);

    std::tcout<<hr;

//////RUNTIME ERROR HANDLING
    if(FAILED(hr)) {
        throw std::runtime_error("ERROR: Failed to create ID3D10Device and IDXGISwapChain");
    }

I've already checked each of these options, but none of it triggers.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb205278(v=vs.85).aspx

The value of the hr seems to be -2005270527, after checking it with std::cout<<hr
My debugger also can't show the value of hr when hovering over it, for some reason. :(

What could the problem possibly be?

sentences:
When constructing an orientation matrix, are the rows of the matrix the axis? When constructing an orientation matrix, are the rows of the matrix the axis?

The matrix is row-major and I'm multiplying vectors on the right (Mv).  So, the matrix looks like

r0c0 r0c1 r0c2
r1c0 r1c1 r1c2
r2c0 r2c1 r2c2

sentences: How do I make an object destructible? How do I make one of my objects break into random pieces? I've tried Add-Ons, Blender, and a few other things that I can't remember of the top of my head.

sentences:
Using dom elements for game interaction - slow performance I have a need for my html5 game (using melonjs) to allow users to click tile areas on the map. The idea is it will show a css styled hover area. The browser tested is chrome.

I could do this natively in the game engine but the styling options available for canvas entities is limited. So I went with creating a dom element for each item in the canvas map. As the player moves, I update only the positions of the dom elements which are on the viewport.

Probably 70 total elements are created and only 2-3 are on the screen updating at any given time.

I'm pretty surprised how slow it's making my browser.

So my questions are:

why would updating 2-3 elements as the player moves be so slow?
is it better to remove elements when offscreen then readd when they are back on, even though they arent updating as they move off screen?
should I just scrap the dom solution altogether and rely on the api the canvas and game engines provide for styling

sentences:
Color Switch Collision Detection If you don't know what color switch is look here: http://poki.com/en/g/color-switch

I need a good way to detect the color collisions, one way would be to get the colors of pixels around the ball on the jpanel but I don't know how that would work. I can't use Shapes and Area intersections because some of the obstacle shapes have a hole in the center so I can't use the shape and area class to find collisions.

Any Ideas would be great.

All my Obstacles are made with A multiple Shape objects for different colors and holes.

sentences:
How to make an object in box2d have constant velocity even after collision? I have iOS game where I have a bouncing character. Everything is being handled by box2d. The problem is when the character hits a wall of another character it's velocity changes, but I don't want this. I need the velocity to stay constant even after collisions.

I was thinking the only way to do this was to keep setting the velocity after each collision unless there's another way to do this that I'm not aware of?

sentences:
The most efficient and accurate game loop? Obviously for a game to work you need a game loop... Normally, my game loop would consist of something like this:

while(running){
    update();
    render();
    Thread.sleep(10);
}

This seemed to work fine at first, but then after I started to make my games a bit more complicated the frame rate of my game dropped by 90% in most cases, sometimes they would hang at around <10fps on a high spec system just by simply rendering a couple of 2D image. So I thought to myself: "Should I try putting the render loop on a different thead?". With that in mind, I made a system similar to this:

new Thread(new Render()).start();
new Thread(new GameLogic()).start();

private class Render implements Runnable{
    public void run(){
       while(running){
          render();
      }
    }

private class GameLogic implements Runnable{
public void run(){
   while(running){
      update();
      Thread.sleep(10);
  }
}
}
}

This then caused the graphics to become out of sync with the game update, which then caused the occasional jitter which got quite annoying, later on, I then discovered a use where there is no wait in the loop itself and everything runs as fast as it can, but then you multiply everything in the gameLogic by a deltaTime variable to ensure the game movement is solid. Basically I want to know which way of implementing a game loop is most efficient and whether or not you should render and do gameLogic on the same loop.

sentences:
Axis Mapping gives one-sided values this has got me stuck badly: my project is in 2.5D. Jumping and crouching not implemented yet.

Making use of Axis Mapping Input from the project settings, where numpad 4= 1 and numpad 6= -1 to control my movement, the follow problem poses itself:

I have a blendspace with a horizontal axis which is MovementDirection from -1 to 1 divided in 2.The upward axis is a MovementSpeed from 0 to = 200 = Max Walk Speed on my CharacterMovement asset.

In this Blendspace I go from idle in the bottom middle, to WalkForward and WalkBackward in the upper outer extremes.

However, when in my Level Blueprint I get my MovementSpeed and MovementDirection variables from my "BP_Player" Anim Instance, in order to print them, I can see that my MovementSpeed goes all the way to my max which is 200, while in the other direction it's stuck around 0,01.

I thought it would go -200 but it doesn't, which is messing up my WalkForward blendspace part, only blending very slightly into it.

However in the blendspace I have positioned my WalkForward and WalkBackward animations correctly.

Any idea where I could have gone wrong?

sentences: How to split sprites into multiple pieces, like in image below Or how it should be called? I will change color programmatically. Sorry for my English.

sentences:
How to directly change a vector3 I'm new to unity, and written code in general, but I haven't been able to change the value of a vector3.

public Vector3 VARIABLE = (5f, 5f, 5f)

sentences:
Let a point drive on a polyline I want to create a polyline which should be quite smooth for my game. A point is following moving on the line, but can accelerate/brake and has to get slower in corners.

In the end I want to set up some stats (good acceleration, low topspeed, "good" cornering") and simulate the time it has taken to go from start to finish (drawning it to the player would be just a bonus). Yes, this will be some sort of a racing simulation.

I'm quite new to this style of games and I have no idea to do that. I don't even know how to create such a polyline I can easily use.

I don't want a finished algorithm but rather some hints in the right direction. I thought about using the angle of the corner to determine the speed, but that's not really much. I want to implement the time simulation in python, outputting the movement with html/javascript.

How would I start implementing such a mechanism?

sentences:
On Click Add Listener not working on Game Object I have this code attached to a 3D cylinder game object. I plan to use it as an arrow and rotate it when clicked and dragged. I had no idea what do as I am a beginner so I started with adding an onClick listener to a Button component on the Cylinder, and wrote this script which I added as component to the cylinder.. But the Rotate() function isn't called when I click on it, as there is no message in the Log.. This is the code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class MoveAim : MonoBehaviour {

    public bool isAiming;
    private Button button;

    void Start () {
        isAiming = true;
        button = GetComponent <Button>();
        button.onClick.AddListener (Rotate);
        Debug.Log ("Start!");
    }

    void FixedUpdate () {
    }
    void Rotate() {
        Debug.Log ("Click recorded");
    }

}

Any idea what to do? And how should I implement the rotation of the cylinder? Help would be appreciated!

Thanks!

sentences:
QuadTree Checking Collision With Different Levels of Nodes I am making a QuadTree for a 2D Platformer. Researched on it and I managed to make a pretty good one where each node stores its 4 SubNode and there's a MAX_OBJECTS for each Node and MAX_LEVELS which represents the amount of Levels my Tree has, with 0 being the root.

So, I get my object and I try to store it into the Deepest Node possible. If I can't, then I'll store it in the Parent Node instead.

Then when I check for Collision, I'll see which Nodes have Possible Collisions with my Object, get the Objects in those Nodes and add it to a List of my Collision Checks.

My problem is this Checking for Collision. I am quite confused.
For example, I have an ObjectA at Level 1 Node and it will collide with objects within its node. I have another ObjectB at Level 0 (Root Node) and it overlaps ObjectA's node so there is a possible Collision.

This is where it gets tricky, just from the paragraph above, I can see that Objects in the Parent Node have a chance to to collide with the Objects in the SubNode. So when I check for the Possible Collisions, do I check the Parent Nodes + SubNodes of my Object's Node...I'm not really sure as to how you choose which node to check.

There will be Nodes of Different Levels won't there?
An Object of Level 1 can have  Collision Checks with Level 0, Level 2, Level 5...etc(or is this wrong). It's hard to grasp what the criteria is of checking a specific node...To put it simply, a Tree has so many different Levels...

For all I know, there might be an ObjectA(x,y) at Level 0 and ObjectB(x,y) at Level5. Completely same coordinates, but different node levels. If I were to check Collisions for ObjectC(x,y) at Level 0, I'd put ObjectA in the List cause same Node, but what about ObjectB whose in a different Level, but same coords.

So just from the above theory/explanation or whatever you may call it.
Can I conclude that the Nodes I check for Collisions should include Nodes from Root til the Node My Object is in + the SubNodes of Node my Object is in.

You might ask why not just store it in the same Level, well I heard from others that it's better if I store those overlapping ones at the parent node and it'd be good if I limit the amount of objects per node. So if the level is full, I need to send it up.

I'm sorry if this might be an easy question, it's just that I've pondered on this for 6 days now but I still can't figure it out. Please help! This is my last hope!

sentences:
Bounce ball after collision I added Box Collisions (Walls) outside of the screen and a player (ball) with rigidbody and Circle Collider in dynamic forcing to a random direction.

I want the ball to bounce when it collides the wall.

Bomb.cs

private Rigidbody2D rigidbody;
private Vector2 direction;

// Use this for initialization
void Start () {
    rigidbody = gameObject.GetComponent<Rigidbody2D> ();
    direction = new Vector2 (Random.value, Random.value);
}

// Update is called once per frame
void FixedUpdate () {
    rigidbody.AddForce (direction);
}

sentences:
What is a simple deformer in which vertices deform linearly with control points? In my project I want to deform a complex mesh, using a simpler 'proxy' mesh.

In effect, each vertex of the proxy/collision mesh will be a control point/bone, which should deform the vertices of the main mesh attached to it depending on weight, but where the weight is not dependant on the absolute distance from the control point but rather distance relative to the other affecting control points.

The point of this is to preserve complex three dimensional features of the main mesh while using physics implementations which expect something far simpler, low resolution, single surface, etc.
Therefore, the vertices must deform linearly with their respective weighted control points (i.e. no falloff fields or all the mesh features will end up collapsed) - as if each vertex was linked to a point on the plane created by the attached control points and deformed with it.

I have tried implementing the weight computation algorithm in this paper (page 4) but it is not working as expected and I am wondering if it is really the best way to do what I want.

What is the simplest way to 'skin'* an arbitrary mesh, to another arbitrary mesh?

*By skin I mean I need an algorithm to determine the best control points for a vertex, and their weights.

sentences:
collisions: How to handle contact constraints for a rigidbody constrained to a line segment I'm trying to come up with a strategy to handle a situation in 2D, where a rigidbody moves along a straight line segment, and can collide with other similar bodies and also static tiles.

A naive approach was to handle collisions by projecting the displacement vectors onto the line segment (worked ok for aabb), and then at the end snap the position of the rigidbody back to the line, which had lots of conflicts.

I'm trying to implement impulse based physics, so far only handling contacts, and unsure how to both constrain the rigidbody to a line segment and handle contacts at the same time. Or is it better to do in two separate phases. It's probably easier to allow some displacement from the line and then gradually move the body back to it. Any suggestions?

sentences:
Java - Lemmings - How to detect mouse over lemming My first post on gamedev :) And my first go at game dev :D

To ease me in, I'm starting with a lemmings clone.

I have my lemmings moving about and already have a MouseAdapter for moving around the map with the mouse.

In order to detect when the mouse is over a lemming I thought the easiest way
would be to override the mouseMoved method. This would iterator over the lemmings and check if the mouse coords are in the lemmings rectangle. Is the normal way to do this?

I realised this wouldn't work for a lemming walking under/past the mouse cursor.

sentences:
Following a path in a smooth fashion I am currently making a 2d tower defense game with a static, predetermined lane that the enemies follow (i.e. towers cannot block the path and path finding is not the problem I am trying to solve).

I am trying to figure how exactly to make units follow this lane in a smooth way. I have two rough ideas about how to do this, but I would love some input on which is likely to be easier to implement/the more standard technique. Or of course if I there is some totally different way that I haven't considered I would love to learn about that as well.

Waypoints:
My first idea was to define the path as a series of hard coded waypoints. Units would then use a basic "seek" steering algorithm (such as this one) to move to each waypoint along the path in succession. However, I have wondered if it might be hard to keep the units from deviating to much from the lane I want them to follow. I wonder if inability to turn sharply enough might cause them to sort of "glide" out off of the desired lane. I suppose I might be able to prevent that though by allowing for a relatively strong steering force to be applied?

Bezier Curves:
The second solution I have considered is to define the path with a bezier curve and at each time step calculate the point along the curve with is (dt * speed) away from the unit's current location. I suspect that this technique would make it much easier to precisely define the path that units will follow, but I don't know know how exactly to go about implementing this. Any suggestions?

Also, I don't this will change anyone's answers, but units also must be able to travel at a constant speed along the path. Additionally, I am programming this game in python using the pyglet framework.

If anything about the question is unclear please let me know.

Edit:
Also for whatever its worth, I'm sort of trying to replicate the movement behavior of enemies in the Kingdom Rush.

sentences:
Good way to store entity data I'm building an RPG style game, but i have some trouble with storing data from entities. These entities can carry data including but not limited to their location, their graphics, whether they are solid, and so on.

I have thought about just storing it as a list of numbers, but this means that a single change (adding a variable for example) will break the entire saving system.

Is there an easier and more versatile way to store this information?

EDIT: Ok i did a bit of searching and i found a bunch of questions basically the same as this one. Feel free to ignore this question ;)

sentences:
up vector for quaternion First, I know there's a question exactly like mine, and some ohter really close, but my implementation of the solutions didn't work at all. Ok, now to the question.

I created some forms of camera based on quaternions, however, for my orbit/chase camera every quaternion I create will roll the camera in an uncontrollable manner. What I want is a function like Unity's Quaternion.LookRotation where you can pass an up vector.
This is a simplification current attempt of implementation:

Vector3 target = -Position; //Because we're looking at the origin
target.Normalize();

float cosine = Vector3.Dot(Vector3.Forward, target);
Vector3 axis = Vector3.Cross(Vector3.Forward, target);
Rotation = Quaternion.CreateFromAxisAngle(axis, (float)Math.Acos(cosine));

//Trying to unroll up vector to Vector3.Up
//based on the other answer but results were unchanged
Vector3 rolledUp = Vector3.Transform(Vector3.Up, Rotation);
Vector3 right = Vector3.Cross(target, Vector3.Up);
Vector3 newUp = Vector3.Cross(right, target);

Vector3 axis2 = Vector3.Cross(rolledUp, newUp);
float angle2 = (float) Math.Acos(Vector3.Dot(rolledUp,newUp));

Rotation = Quaternion.CreateFromAxisAngle(axis2, angle2) * Rotation;

return Matrix.CreateLookAt(
    cameraPosition: Position,
    cameraTarget: Vector3.Transform(Vector3.Forward, Rotation),
    cameraUpVector: Vector3.Transform(Vector3.Up, Rotation));

If my sleepiness got in the way of my clarity, here's what I have:

and here's what I want:

sentences:
How do I draw thick lines in XNA 4.0? I can draw some curves using this:

GraphicsDevice.DrawUserPrimitives<VertexPositionColor>
           (PrimitiveType.LineStrip, Points, 0, count);

Now I try to set the PointSize to make the line thicker but I can only find a solution for XNA 3.0 using:

GraphicsDevice.RenderState.PointSize

How can I make my lines thicker in XNA 4.0?

sentences:
Will points on path with width intersect I want to be able to check if a list of points will hit a screwed rectangle (rhombus i think).

I start out with 2 point P and T, i want to create a rectangle between the 2 points. I have used https://stackoverflow.com/questions/7854043/drawing-rectangle-between-two-points-with-arbitrary-width to do this. This gives me 4 points A, B, C and D of the new rectangle.

I then want to check if the point M is withing this rectangle.

The two black dots are my points P and T, the black box is the rectangle i want to generate between the two dots, being X wide.
I then want to test if the red dots are withing the black box.

sentences:
Error in destroying object in Box2D/LibGDX I'm trying to delete an object when a collision happens. I have put the following code in the render method of the object so it would be outside of the physics calculations.

public void render(SpriteBatch spriteBatch) {
    // some other code...
    body.setActive(false);
    body.getWorld().destroyBody(body);

But I'm getting an run-time error which crashes the JVM and shows,

  AL lib: alc_cleanup: 1 device not closed

  Assertion failed!

  Program: C:\Program Files\Java\jre6\bin\javaw.exe
  File: /var/lib/hudson/jobs/libgdx-git/workspace/gdx/jni/Box2D/Dynamics/b2World.cpp, Line 133

  Expression: m_bodyCount > 0

Can anyone help me here?

sentences:
How to create per-vertex normals when reusing vertex data? I am displaying a cube using a vertex buffer object (gl.ELEMENT_ARRAY_BUFFER). This allows me to specify vertex indicies, rather than having duplicate vertexes. In the case of displaying a simple cube, this means I only need to have eight vertices total. Opposed to needing three vertices per triangle, times two triangles per face, times six faces. Sound correct so far?

My question is, how do I now deal with vertex attribute data such as color, texture coordinates, and normals when reusing vertices using the vertex buffer object?

If I am reusing the same vertex data in my indexed vertex buffer, how can I differentiate when vertex X is used as part of the cube's front face versus the cube's left face? In both cases I would like the surface normal and texture coordinates to be different. I understand I could average the surface normal, however I would like to render a cube. Also, this still doesn't work for texture coordinates.

Is there a way to save memory using a vertex buffer object while being able to provide different vertex attribute data based on context? (Per-triangle would be idea.)

Or should I just duplicate each vertex for each context in which it gets rendered. (So there is a one-to-one mapping between vertex, normal, color, etc.)

Note: I'm using OpenGL ES.

sentences: Is there a simple way to do true isometric projection with an HTML5 canvas? Is there a simple way to get a true isometric projection with the HTML5 canvas element?

sentences:
Should a server run all maps in one loop, or a thread/game loop per map? I'm working on a real time multiplayer browser-based game.
The game is top down on variable size tile based maps. There is no central map where all players come together, the entire game plays out in multiple maps. (Player chooses one on login, but has the ability to switch whenever they want).
Let's take the following loop that runs on the server side of things:
let tick_time = Duration::from_millis(500); // e.g. Tick 2 times per second.
let mut next_tick = Instant::now();

loop {
    let now = Instant::now();

    if now >= next_tick {
        // Parse user input
        // Update state
        // Update to state to users in map

        next_tick += tick_time;
    } else {
        let wait_time = next_tick - now;
        sleep(wait_time - Duration::from_millis(1)).await;
    }
}

In my 'map based' gameplay scenario, would it make sense to spawn a thread for every map where one of these loops runs? Or would it be recommended to have only a singular thread with a singular game loop that updates every map? Or is there perhaps a better, already existing, pattern for this?

sentences:
Changing AnimationOverrideController "sometimes" fails - Unity 5.2.1 I have the following code, in a menu where you can chose the armor and weapon of a character:

private List<string> armors = new List<string> { "armor1", "armor2", "armor2" };
private List<string> weapons = new List<string> { "weapon1", "weapon2", "weapon3", "weapon4", "weapon5", "weapon6", "weapon7", "weapon8", "weapon9" };

private int  armor_index = 0;
private int weapon_index = 0;

public GameObject avatar_body;
public GameObject avatar_weapon;

void Update() {
         if (Input.GetKeyDown(KeyCode.RightArrow)) nextArmor();
    else if (Input.GetKeyDown(KeyCode.LeftArrow))  previousArmor();
    else if (Input.GetKeyDown(KeyCode.DownArrow))  nextWeapon();
    else if (Input.GetKeyDown(KeyCode.UpArrow))    previousWeapon();
    else if (Input.GetKeyDown(KeyCode.Return))     loadLevel();
}

void nextArmor() {
    if (armor_index < armors.Count - 1)
        armor_index += 1;
    else
        armor_index = 0;

    setArmor();
    setWeapon();
}

void previousArmor() {
    if (armor_index > 0)
        armor_index -= 1;
    else
        armor_index = armors.Count - 1;

    setArmor();
    setWeapon();
}

void nextWeapon() {
    if (weapon_index < weapons.Count - 1)
        weapon_index += 1;
    else
        weapon_index = 0;

    setWeapon();
}

void previousWeapon() {
    if (weapon_index > 0)
        weapon_index -= 1;
    else
        weapon_index = weapons.Count - 1;

    setWeapon();
}

void setArmor() {
    avatar_body.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/body" ) as AnimatorOverrideController;
}

void setWeapon() {
    avatar_weapon.GetComponent<Animator>().runtimeAnimatorController =
        Resources.Load("AnimationControllers/player/"+armors[armor_index]+"/"+weapons[weapon_index] ) as AnimatorOverrideController;
}

The problem is when I start switching between the weapons, sometimes the sprite showing does not update. Inspecting the GameObject, it is weird, because the Animator Component has successfully updated, but the Sprite Renderer still shows a fixed sprite from the last Animator.

Here are 2 examples:

Here we see that the animator is set for the weapon Gladius, and that the Sprite renderer is looping through all the frames of that animation

Here we can see that even though we have moved to the Flanged mace animator, the Sprite Renderer is still stuck on a sprite of Gladius

The problem is hard to recreate, because it happens just SOMETIMES. If I were to switch back to gladius and then once again back to flanged_mace...

Now it works... but I didn't change anything.

What is going wrong??

sentences:
Take a screenshot from camera problem I use script below to take a screenshot from camera. It's working fine. However, when I take a screenshot again (pressing k multiple times), its old image is not clear from the memory and it keep drawing over same image over and over again. If object is moving while taking screenshot multiple times, image I will get all frame combine into one image with every frame in the same image. What should I do to fix this problem?

using UnityEngine;
using System.Collections;

public class HiResScreenShots : MonoBehaviour {
    public int resWidth = 2550;
    public int resHeight = 3300;

    private bool takeHiResShot = true;

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

    public void TakeHiResShot() {
        takeHiResShot = true;
    }

    void LateUpdate() {
        takeHiResShot |= Input.GetKeyDown("k");
        if (takeHiResShot) {
            RenderTexture rt = new RenderTexture(resWidth, resHeight, 24);
            camera.targetTexture = rt;
            Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.ARGB32, false);
            camera.Render();
            RenderTexture.active = rt;
            screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
            camera.targetTexture = null;
            RenderTexture.active = null; // JC: added to avoid errors
            Destroy(rt);
            byte[] bytes = screenShot.EncodeToPNG();
            string filename = ScreenShotName(resWidth, resHeight);
            System.IO.File.WriteAllBytes(filename, bytes);
            Debug.Log(string.Format("Took screenshot to: {0}", filename));
            takeHiResShot = false;
            Debug.Log("Capture!!");
        }
    }
}

sentences:
Quaternion Rotation after performing previous rotations Have Quaternion \$ Q\$ which is rotated on the \$X\$ axis 90 degrees.

\$Q\$ is now \$ (0.707106, 0.707106, 0, 0)\$.

I want to rotate \$Q\$ another 90 degrees by a different pivot \$P\$ so i will calculate \$ Q * -P  * Q^{-1}\$, save the \$x,y,z\$ coordinates in \$ res(x,y,z)\$ and then \$ res = res + P\$. This should give me the offset between the new coordinates and the old ones, however in my case i get a big translation on the \$ Y \$ axis.

Example 1

Here i do both rotations around the same pivot, compared to first center then pivot.

Example 2

i do both rotations around the same point \$C(-0.5,0.5,0.5)\$ if it matters, for the second rotation i first rotate the pivot with the current rotation to get actual coordinates of the pivot.

I do all calculations in object space where the object center is at 0,0,0

---EDIT CODE

Before i start a rotation i calculate where the pivot should be at the current rotation like this, it only happens when there are no active rotations, i choose to rotate by vertices[3]

state.currentPivot = state.rotation * vertices[3];

this is the part of the update function that gets executed during rotations

for (auto& rotationRule : v_rotationRules)
{
    if (deltaTime >= rotationRule.startTime && deltaTime <= rotationRule.endTime)
    {
        state.rotation = glm::rotate(state.rotation, glm::radians(rotationRule.degrees), rotationRule.axis);
        state.rotateAroundPivotWithQuat();
    }
}

TranslationMatrix = glm::translate(glm::mat4(1.0f), state.rotatedPosition());

    ModelMatrix =
        TranslationMatrix *
        glm::mat4_cast(state.rotation) *
        ScaleMatrix;

glm::vec3 ObjectState::rotatedPosition()
{
    return position + rotationOffSet;
}

void ObjectState::rotateAroundPivotWithQuat()
{
    glm::vec3 negp = - currentPivot;
    glm::vec3 res = rotation * negp;
    rotationOffSet = res + currentPivot;
}

When a rotation is over i add position += rotationOffSet, happens at the end of it, and make it equal to (0,0,0) again.

in the gifs, the first value of rotationOffSet has the high offset on y axis, as i checked in debugger.

sentences: getting direction of x and y... north,south,east,west I have a player in the center of the screen, where I also have my mouse position origin. (0,0)  I would like to know the direction of the mouse, imagine splitting the screen with a  X, so the top quadrant would be north, the bottom would be south... and so on. So if my mouse was at 5,-100 it should log ("North")  as that is just a bit to the left and up 100 pixels.

sentences:
How to debug Android App Eclipse? Ok. So while this isnt a programming question. I wanted to know how do people debug apps? How do you view log cat, and where these exceptions are thrown etc? And do I need to run the app on the emulator to see all the stuff, or is there a way to view this after running the app on my phone(while not being connected to the computer)

Links to plugins and tips would be really helpful, as im gonna start work on my next game, and while the first one works fine, had a lot of problems while debugging.

sentences:
Height and Width of Player Depth View using Kinect SDK This code shows that how we can find the player from the depth Image:

this.depthData = new short[frame.PixelDataLength];

frame.CopyPixelDataTo(this.depthData);

    for (int depthIndex = 0; depthIndex < depthData.Length; depthIndex++)
    {
            player = depthData[depthIndex] & DepthImageFrame.PlayerIndexBitmask;
    }

I wanna ask about how can I find Width and Height of Depth View of the player ?
Thanks

sentences:
Percentage of object inside a moving rect The idea is that I want to get a percentage of the position of Rect2 in relation to Rect1. In the picture, it would be about 75/80%. Rect2 never leaves Rect1. I move Rect1 around all the time, so it should work regardless of Rect1's position.

I had something like this, but it didn't work as intended:
((Rect2.X + Rect1.X) / (Rect1.Width + Rect1.X)) * 100

Rect1.X would work as an offset so the calculation would "ignore" the moving around of Rect1. Or that was the idea...

sentences:
How to implement dynamic background music? Assumption 1: As a game's story progresses, dynamic background music is often used to enhance the player's immersion.

Assumption 2: Background music is probably always streamed due to memory limitation and performance.

What do I need to consider when I'm checking the feasibility of having dynamic(ally changing, adapting) background music? For example when a boss enemy appears the game should not just replace the "wandering music" to "boss combat", it should rather somehow cross-fade the two music scores as it starts playing the new music.

Is it usually possible to stream multiple sounds in parallel? I'm using LibGDX, where -- as far as I'm aware -- only a single streaming music instance can be played at a time, so how can I have such music with this framework?

Do I suspect correctly if I also need to separate a dynamic music into parts like "intro", "loopable part", "loopable part near the climax", "outro", etc., and when a part ends have a music manager code decide which part should be (re)started?

I'm more interested in understanding the theory instead of the actual implementation of the code.

sentences:
I need to improve my ring shop. help with array, loop & query PHP I have an array setup which consists of 25 rings, names, stats, prices. Right now in its current form, I have a form setup with 25 radio buttons with a value of 1-25 on them, and I'm using If statements in my function to buy a ring. It works but I feel it's very inefficient because I have this code running 25 times based on $_POST['ring'] which sends the value 1-25.
    if ($rings[1][7] > $_SESSION['cash']) {
        echo "You do not have enough cash for this ring!

        GO Back!

";
        return;
    }
    if ($_POST['ring'] == 1) {
        $ringcost = $_SESSION['cash'] - $rings[1][7];
        $stmt = $pdo->prepare('UPDATE cu_cash SET cash=:cash WHERE id=:id');
        $stmt->bindParam(":cash", $ringcost);
        $stmt->bindParam(":id", $_SESSION['id']);
        $stmt->execute();

        $stmt = $pdo->prepare('UPDATE cu_users SET ring_id=:ring_id WHERE id=:id');
        $stmt->bindParam(":ring_id", $_POST['ring']);
        $stmt->bindParam(":id", $_SESSION['id']);
        $stmt->execute();
        echo "You have Successfully Purchased " . $rings[1][0] . "

        GO Back!

";
    }

Now I am wondering if there's a loop I could use to take the value from $_POST['ring'] and pull the price assign it to a variable so I can do my cash - price then update the DB with ring id & update my cash? been thinking about this for a while & I am having a hard time wrapping my head around it. Loops have always confused me, but I know they are useful!

sentences:
DirectX11 - Texturing Terrain Mesh with Shared Vertices I'm trying to create and texture a terrain mesh in DirectX11. I've managed to create the mesh itself, but I don't know how I should do the texturing. Let me start by explaining what I'm doing so far:

I have a vertex structure that looks like this:

struct Vertex
{
    XMFLOAT3 position;
    XMFLOAT4 color;
};

Then I create all the vertices for the terrain mesh:

for (int z = 0, index = 0; z < terrainHeight; ++z)
{
    for (int x = 0; x < terrainWidth; ++x, ++index)
    {
        vertices[index].position = XMFLOAT3(x, 0.0f, z);
        vertices[index].color = XMFLOAT3(1.0f, 1.0f, 1.0f, 1.0f);
    }
}

Then I create all the triangles for the terrain mesh with indices:

for (int z = 0, index = 0; z < terrainHeight - 1; ++z)
{
    for (int x = 0; x < terrainWidth - 1; ++x)
    {
        indices[index++] = (z    ) * terrainWidth + (x    );
        indices[index++] = (z + 1) * terrainWidth + (x    );
        indices[index++] = (z + 1) * terrainWidth + (x + 1);

        indices[index++] = (z    ) * terrainWidth + (x    );
        indices[index++] = (z + 1) * terrainWidth + (x + 1);
        indices[index++] = (z    ) * terrainWidth + (x + 1);
    }
}

With 256x256 vertices I get this result (rendering in wireframe):

I'd now like to change the color to a texture, so I change the Vertex structure to this:

struct Vertex
{
    XMFLOAT3 position;
    XMFLOAT2 texture; // Changed the color to a texture coordinate.
};

And this is where I get stuck. Since each vertex now have a texture coordinate (U, V) I'd like to set it up like this:

But each vertex can only hold one texture coordinate. As you can see, the 2 vertices between square A and B needs 2 different texture coordinates each in order to map it correctly. If I'd loop through each pair of triangles, then when I reach square B I'll overwrite the texture coordinates that was correct for square A.

So therefore I have some questions:

Am I doing this in the "right" way? How does modern games do it? Do they texture each square or the entire mesh?
If I'd like to texture each square, how can I solve this problem?

sentences:
How can I use an HLSL pixel shader to peek at other pixels? I think this is like a pixilation shader but I had a hard time trying to find one online, and one that I could manipulate specifically.

I want to create a pixel shader for my monogame project that splits the texture up into blocks. The width and height of the block may or may not match. Then on each block, I want to average out the color of all pixels in the block, and fill it in.

I'm not sure how I would do this in a pixel shader. I can do something like this in code pretty easily but that is because the code scans the entire image at once. A pixel shader though seems to run on each pixel, so I'm not sure how to do that.

I currently have a simple pixel shader where I can plug in code to test. It doesn't do anything right now but return the same color.

#if OPENGL
    #define SV_POSITION POSITION
    #define VS_SHADERMODEL vs_3_0
    #define PS_SHADERMODEL ps_3_0
#else
    #define VS_SHADERMODEL vs_4_0_level_9_1
    #define PS_SHADERMODEL ps_4_0_level_9_1
#endif

// Our texture sampler
texture Texture;
sampler TextureSampler = sampler_state
{
    Texture = <Texture>;
};

// This data comes from the SpriteBatch Vertex Shader
struct VertexShaderOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR0;
    float2 TextureCordinate : TEXCOORD0;
};

// Our Pixel Shader
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float4 color = tex2D(TextureSampler, input.TextureCordinate);
    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile PS_SHADERMODEL PixelShaderFunction();
    }
}

sentences:
How are physical model programmed in simulation games? Being a Gran Turismo fan, I'm wondering what are the algorithms used to compute realistic behavior for friction, aerodynamism, velocity, curves etc.

Also, are there sophisticated ways to simulate fluid mechanics in flight simulation which are trivial enough for an amateur project ?

If I wanted to build a flight simulator, neglecting the parameters which have the littlest effect (temperature, pressure, humidity, friction of the air on the wings, gravitational center of the plane, etc), are there some kind of physical formulae or programming models I should know about ?

Or does physics engine feature such kind of simulation dedicated calculation ?

sentences:
Create an atlas texture in photoshop to use in unity To create a button in NGUI looks like we need to create something called Atlas that is a material that contains a lot of little images called Sprites.

I created a set of 40 sprites (for 20 buttons needed in game, normal state and clicked state) in photoshop in a 2048x2048 image file. When i tried to use NGUI atlas maker i realized that atlas maker requires each sprite in a separate file and wants to merge them in the atlas itself!

Well, i already have them in one file, should i slice all these buttons and save them in 40 other  separate files and let the atlas maker merge them again for me? (Sounds very stupid!)

Isn't there any way to give the merged 2048x2048 file to atlas maker (or any other equivalent plugin/software) and then tell the software "Hey! I have 40 sprites in this image, let me tell you where they are! The first one is in (3,3) with size of (150px, 150px), The second one is..."?

UPDATE: I found a part of solution, unity could identify my 40 sprites in texture using sprite editor tool, but NGUI cannot still find them.

I created a material using "Unlit/Transparent Colored" shader and referencing the atlas to it, then i created a new empty game object, added UI Atlas component to it and referenced the material in it, but it says there are no sprites. If i make a prefab out of this game object then NGUI can use it as an atlas and my problem will be solved

sentences:
Shooting Bullets Around a Sphere I currently have a ship that can orbit around a sphere freely controlled by a joystick. There is a separate joystick that controls the gun and starts shooting when it is touched.

Right now the bullets start shooting and then orbit the sphere until their lifetime has elapsed. Instead of having them orbit the sphere I want them to orbit for maybe the first half of their life and then shoot off into space. Does that make sense?

It would give the effect of a kind of glancing off the atmosphere, instead of staying in orbit for the whole time.

I am working in Unity3D and using the RotateAround() method to get the bullets to orbit. I'm thinking I need to take a snapshot of there position at half life, and then figure out the vector that would shoot them off into space. If someone could help me get going in the right direction with that, that would be great!

sentences:
phaser.io mouse cursor sprite I am trying to build a game and i want people to be able to select stuff with a pointer but i don't want it to be just an ugly looking default pointer so i wrote this code to try and get a image as it

first i loaded the image

game.load.image('selector', 'assets/img/pointer.png')

then I put it into my game

selector = game.add.sprite(game.world.centerX, game.world.centerY, 'selector')

and then in my render() function i do this

selector.x = game.input.x;
selector.y = game.input.y;

it moves fine with my mouse but with one problem

my game is designed so that i have to use a camera that follows my character because the map is bigger than the view

so since for some reason my sprite always starts at 0,0 it can only move 800x600px since thats all that the canvas sees the mouse in so i need a way to fix this but i'm not sure how to do this because i am new to phaser

sentences:
Octree subdivision problem Im creating octree manually and want function for effectively divide all nodes and their subnodes - For example - I press button and subnodes divided - press again - all subnodes divided again.
Must be like - 1 - 8 - 64. The problem is - i dont understand how organize recursive loops for that.

OctreeNode in my unoptimized implementation contain pointers to subnodes(childs),parent,extra vector(contains dublicates of child),generation info and lots of information for drawing.

class gOctreeNode
            {
   //necessary fields
    gOctreeNode* FrontBottomLeftNode;
    gOctreeNode* FrontBottomRightNode;
    gOctreeNode* FrontTopLeftNode;
    gOctreeNode* FrontTopRightNode;
    gOctreeNode* BackBottomLeftNode;
    gOctreeNode* BackBottomRightNode;
    gOctreeNode* BackTopLeftNode;
    gOctreeNode* BackTopRightNode;
    gOctreeNode* mParentNode;
    std::vector<gOctreeNode*> m_ChildsVector;
    UINT mGeneration;
    bool mSplitted;
    bool isSplitted(){return m_Splitted;}

    .... //unnecessary fields
    };

DivideNode of Octree class fill these fields, set mSplitted to true, and prepare for correctly drawing. Octree contains basic nodes(m_nodes). Basic node can be divided, but now I want recursivly divide already divided basic node with 8 subnodes. So I write this function.

    void DivideAllChildCells(int ix,int ih,int id)
    {
        std::vector<gOctreeNode*> nlist;
        std::vector<gOctreeNode*> dlist;

        int index = (ix * m_Height * m_Depth) + (ih * m_Depth) + (id * 1);//get index of specified node
        gOctreeNode* baseNode = m_nodes[index].get();

        nlist.push_back(baseNode->FrontTopLeftNode);
        nlist.push_back(baseNode->FrontTopRightNode);
        nlist.push_back(baseNode->FrontBottomLeftNode);
        nlist.push_back(baseNode->FrontBottomRightNode);
        nlist.push_back(baseNode->BackBottomLeftNode);
        nlist.push_back(baseNode->BackBottomRightNode);
        nlist.push_back(baseNode->BackTopLeftNode);
        nlist.push_back(baseNode->BackTopRightNode);

        bool cont = true;
        UINT d = 0;//additional recursive loop param (?)
        UINT g = 0;//additional recursive loop param (?)

        LoopNodes(d,g,nlist,dlist);

        //Divide resulting nodes
        for(UINT i = 0; i < dlist.size(); i++)
        {
            DivideNode(dlist[i]);
        }
    }

And now, back to the main question,I present LoopNodes, which must do all work for giving dlist nodes for splitting.

    void LoopNodes(UINT& od,UINT& og,std::vector<gOctreeNode*>& nlist,std::vector<gOctreeNode*>& dnodes)
    {
        //od++;//recursion depth
        bool f = false;

        //pass through childs
        for(UINT i = 0; i < 8; i++)
        {
            if(nlist[i]->isSplitted())//if node splitted and have childs
            {
                //pass forward through tree
                for(UINT j = 0; j < 8; j++)
                {
                    nlist[j] = nlist[j]->m_ChildsVector[j];//set pointers to these childs
                }
                LoopNodes(od,og,nlist,dnodes);
            }
            else //if no childs
            {
                //add to split vector
                dnodes.push_back(nlist[i]);
            }
        }
    }

This version of loop nodes works correctly for 2(or 1?) generations after - this will not divide neightbours nodes, only some corners. I need correct algorithm.
Screenshot

All I need - is correct version of LoopNodes, which can add all nodes for DivideNode.

sentences:
Change players state and controls in-game I'm using Unity 3D

Let's say the player is an ice cube. You control it like a normal player. On press of a button, ice transforms (with animation) into water. You control it completely different than the ice cube.

Another great example would be: Player is human being and has normal FPS controls. On press of a button human transforms into birds and now has completely different controls.

Now, my question is, what would be easier and better:

make one object with animation transition and to stay in that state of anim. until button is pressed again
make two object: ice and water. Ice has an animation of turning into water. So replace ice (with animation) with water object

And if anyone knows this one too: how to switch between 2 different types of player controls.

sentences:
Buttons only trigger right/left movement once, not continually I have a Unity mobile project where I am trying to use right/left movement using two UI buttons situated accordingly.  The issue is that it only moves the player to the right/to the left one time, not continually when the player is holding the button down.
I'd like the player to be able to hold down a certain button and have the character move constantly in that direction until the button is released.  I've tried making the void into a Coroutine, but nothing working works.
Here is my code.  (rightCallable and leftCallable are attached to the buttons).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playerController : MonoBehaviour
{
    public GameObject player;
    public float speed = 1000f;
    public GameObject left;

    //this is so the player may also use the A and D keys if they want, and it works fine.
    public void Update()
    {
        var movement = Input.GetAxis("Horizontal");
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
    }

    //Below is what isn't working
    public void rightCallable ()
    {
        StartCoroutine("moveRight");
    }

    public void leftCallable ()
    {
        StartCoroutine("moveLeft");
    }

    IEnumerator moveRight()
    {
        var movement = 1f;
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
        yield return null;
    }
    IEnumerator moveLeft ()
    {
        var movement = -1f;
        transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * speed;
        yield return null;
     }
 }

sentences:
Unity Render Texture Artifacting I'm having weird black artifacts appear on my render textures when they are transformed while the game is running.

I am using a ScrollRect as a scrolling container for buttons (the buttons are just textured quads with the same render texture applied to them). When I translate the quads while the game is running, strange black artifacts will appear on the quads themselves.

Is there a way to fix this?

Edit: Interesting to note, setting every quad inactive except for one fixed the artifacting on the only visible quad: http://i.imgur.com/OInBBWs.png

The intensity of the artifacting seems to be related to the number of objects on-screen that use the same render texture. 5 quads active with the same render texture has a really pronounced artifacting, 3 is more subtle, 1 is visibly non-existent.

sentences:
What is Opengl ES ? What is gl and GLES20 mean? I am new in opengl. I saw tutorial some have gl at the beginning and some have GLES20 at the beginner and some has GL10.

What are the differences? Is GLES20 mean opengl es2 whereas GL10 mean version 1

sentences:
Why is rotation not applied instantly? I am working though the Space Shoot tutorial and I have just applied tilt to the player object. One of the things that I have noticed is that the tilt is not applied instantly but instead the player object can be seen to rotate to the new rotation position. Why does the rotation appear to applied over time (1/2 second maybe) instead of instantly?

My expectation would be that when I set an attribute the value is changed instantly, not over time. I understand that instantly snapping to a position might not be very desirable, but I can't find anything in the unity documentation that explains the behavior I am observing. My desire is to understand this behavior so that I can account for it and take advantage of it, so please provide a link to any supporting documentaion.

Sample code that exhibits this behavior.

using UnityEngine;
using System.Collections;

public class PlayerControler : MonoBehaviour {
    void FixedUpdate(){
        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");

        rigidbody.velocity = new Vector3 (moveHorizontal, 0.0f, moveVertical);

        rigidbody.rotation = Quaternion.Euler (0, 0, rigidbody.velocity.x);
    }
}

sentences:
Random.range giving me the same value at the same time I created a random direction in x and y-axis at where to move, then my problem is when I tried to randomize it sometimes I get the same value at the same time on both x and y-axis. How do I not let this happen, I only want one axis to have a value, not both?

ERROR

HOW I WANT IT TO HAPPEN

CODE

public Vector2 randomDirection;

void Awake()
{
}

void Update()
{
    randomDirection = new Vector2(Random.Range(-1, 2), Random.Range(-1, 2));
}

sentences:
Working hours and productivity expectations for game artists and programmers I have a startup with a limited budget and have recently hired a programmer and an artist. Before they started the project, I set down a project roadmap with a lot of good documentation on what needs to be done and deadlines.

Both were asked to produce a timeline as to how these deadlines would be met. For the artist, I mentioned that if the workload was too much, it might be possible to hire an additional contractor for a month or two while they need help.

I have already started hearing things like, "well, I might need some extra help with this," and "I'm not exactly sure how long it will take me right now, so these timelines are just very rough estimates." And I get it, they're trying not to set themselves up for failure, but as a manager, I also need to know what the heck is going on.

So, there are two questions here:

I frequently see both my hires using non-company Slack, answering phone messages, and doing life admin on my watch. They've turned up late more than once in the first week, when I have a company policy of being in at 9. Maybe this is unorthodox, but we're working on a big project, and the last thing I want is them turning around and accusing me of under-scoping the project. On the other hand, I realize that this might be the norm elsewhere, in larger companies. What can generally be expected from artists/programmers in terms of working style and productivity? What's the difference between flexibility and being lazy?
My artist has already started to refuse other work (work for marketing assets, etc) on the basis that they have a lot of work on their plate already and need to manage expectations. I could deal with this if I didn't see them coming in late, answering messages on Slack, and generally doing things that don't relate to work. On the other hand, I don't know if this is normal/necessary for creatives. Is it?

If it can help:

The studio is situated in Europe.
I have no written policy, but working hours are contractual obligations.
We're using agile project management.
We are 3 people working on the project. Both are "leads" so they make decisions related to their own fields – art and code

sentences:
does order of updates and renders matter? I know in a game loop there needs to be an order like physics should update before rendering. So, I have created two separate functions: update and render and the game loops like below:

while(running) {
    clock.reset();
    for(auto system : systems) {
        system->checkForInput();
        system->update(clock.getElapsedTime());
    }

    for(auto system : systems)
        system->render();
}

Some systems have empty render function or empty update functions.

My question is, does the order of updates or renders matter? would it matter if gui is rendered before graphics, or input is updated after physics?

sentences:
which courses in Computer Science are really needed for game development? I would like to know what courses that somebody interested in game development, should take in a Computer Science Career?

I suppose that are necessary for example:

- Discrete Mathematics
- Computer Graphics
- some programming language courses, for example C++ or C#
- AI
- Web programming

what else does anybody involved in this field could recommend me? I got a group of universities that I would like to apply, but their computer science curricula are not the same for every case.

This question is not for generating a debate about which career to follow. I think the natural way will be to follow CS, but here the question is what model would be more suitable according to the standard curricula?

Somebody from mathematics would lack the background in CS, and also that problem comes with people from arts.

Any advice?

sentences:
How do I check for collision between an ellipse and a rectangle? I am working on LibGdx framework for developing a 2D isometric tower defense game.All my sprites are drawn in 2D isometric view.

I have used an array list to store 8 points at boundary in the rectangle.LibGdx has an inbuilt function (returns Boolean) ellipse.contains(x,y),by iterating through array list I can check whether any points are inside ellipse
But the problem is as shown in below picture,it wont detect the enemies in some particular cases

So my question is:
1)Is this a correct approach for solving these kinds of problems
2)If not can you suggest better approach for solving this problem

Thank you.

sentences:
We are asked not to use "Set Native Size" it's been around 2.5 weeks since we were tasked to build a 2d mobile game. The game heavely uses canvas and we have lots of images. Our designer uses Figma to design the game and I export images from it.
If you have ever used Figma or Sketch, you may know that their mobile phone frame width and height is quite different than the physical device. For example, iPhone Pro Max frame in Figma has 896x414 but the physical device 2688×1242. So all the screens and the images in design is scaled down to look good in Figma's 896x414 frame.
Another important thing I think worth to mention is that we set our Canvas Scaler's reference resolution to 1920x1080 as shown in the image below.

So the thing is, there is also a guy, who is much more experienced in Unity, told us that we should export images from Figma with 2x scale. He says that images will look blurry if we export them in 1x.
On top of that, he told us not to use Image component's Set Native Size property, because the image has twice the size shown in Figma. Instead we should scale down the images ourselves MANUALLY with eye decision (not sure if that phrase exists).
So I am confused and not sure if that method is correct. What is a common practice in such situations? Do people not use Set Native Size? What would be a correct way of exporting images from Figma to a 1920x1080 canvas?
P.S. As I am new to Unity, I may not be able to explain the situation correctly, if there is some extra information you need, feel free to ask in the comments.

sentences:
How to edit visual appearance of mod in Euro Truck Simulator 2(ETS2) Not sure if this is the right place, so here goes nothing...

I want to update my truck's appearance in-game, to make it more on par with it's real life counterpart. The part of the truck I want to edit, to be more specific, is the grill of the truck. The truck's looks are pretty outdated, and it seems it needs a facelift.

From what I found, all my sources tell me that I need to edit the base files of the game, and then I can alter the game mod itself. Is there a simpler way of updating the truck's appearance? Or am I better of just sticking with it's old looks?

sentences:
Android frame by frame PNG animation I am new at Android game development. I have done some apps before, but none of them are games :)

So, I wanted to do a frame-by-frame animation of PNGs. I tried with AnimationDrawable, but OutOfMemory error comes quickly (I have a lot of PNGs). So I came upon SurfaceView. But I am stuck, because I really don't find any useful tutoirals/examples.

What is the best way to make an animation like this?

Here there already is a great answer to almost the same question, but all the links there don't work anymore.

I would really like to here suggestions how to make an animation frame-by-frame with PNGs in Android and if you have any tutorials or examples, I will be really happy :)

EDIT

I thought wrong about sprites, I think... Sorry, but I am a noob at game developing :) I have 60 PNG pictures (40kb, 427*420px each - on disk) which I would like to put in a animation. Is this even possible to do it with frame by frame animation?

The most similar and famous game that is close to mine is Talking Tom (but I don't know if they have frame-by-frame or any other method for animation).

sentences:
Unity - export package - but on import, scene and folder structure are different (screenshots) I export a package and shows me all the files I am exporting.

When I go to import this package, one of the files is renamed and placed in a folder that no longer exists.

Can anyone explain what is happening here and how I can fix it?

Here is the image of me exporting, including the assets folder in the screenshot.

Then I start a new project, and I try to import that package. But a filename has changed itself, and there is a folder there that I did not export, I actually purposely deleted it and it exported anyway:

sentences:
Releasing a game without really having an officially registered company I'm thinking of releasing my iOS game without formally registering a company at all.  I'm not sure I even want to create a company.

ITunes wants to know the copyright holder of my title. I have 2 questions regarding this:

1) Can I use my (already decided upon if will exist) company name and just register it later (if the need arises)?

2) Or should I just use my NAME as the copyright holder, regardless if I plan to formally register the company later or not?

sentences:
Why do my character's feet slide when I auto-configure a humanoid rig in Unity3D? I've downloaded an FBX animation of someone walking from the "Walking" section here.

I imported that and also a humanoid character and specified the Rig for both as Humanoid (auto-create).

The original animation has very solid foot placement, but whenever I apply it to any character in Unity the feet slide around as if it were walking on ice.

Here is a video demonstrating my issue. Is there something about the way I am getting Unity to auto-rig my character that would cause this problem? It happens no matter which 3D character I use.

Thanks

sentences:
How to convert font size to pixels? I'm trying to add text to my game using SDL_TTF, and it's working pretty well.

Except for one thing :

My text's SDL_Surface needs a width and a height, if I don't give it one it will automatically set it to 0, making the text invisible.

However, if I insert a value like 100 width and 100 height, it will stretch the image.

I need to know how I would convert ANY font size on the font arial to pixels in width and height.

sentences:
IsolatedStorageException : Could not find file I'm trying to save/load player data from a file using the persistenceDataPath using the following code:

private void Save()
    {
        if (File.Exists (Application.persistentDataPath + "/playerInfo.dat"))
        {
            FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
            data.userExperience = userExperience;
            bf.Serialize (file, data);
            file.Close ();
        }
    }

private void Load()
{
    if (File.Exists (Application.persistentDataPath + "/playerInfo.dat"))
    {
        FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat ", FileMode.Open);
        PlayerData data = (PlayerData)bf.Deserialize (file);
        userExperience = data.userExperience;
        file.Close ();
    }
}

[Serializable]
class PlayerData
{
    public int userExperience;
}

It works fine if I play the game with Unity Editor. However, on Android, when I try to execute this line of code in Load():

FileStream file = File.Open (Application.persistentDataPath + "/playerInfo.dat ", FileMode.Open);

I get this error:

The file does exist since the code pass through the if(File.Exist...) and it works when I try to access the file from the Save() method.

I really don't know what it could be since the code that open the file in Save() and Load() is the same.

sentences:
Unity (C#): How can I create dialogue to be used in my game? (also critique my system?) I've created my own system for handling dialogue. There's a class for each 'node' or part of dialogue. It contains the following variables: identifier (identifiers are unique for each NPC, but not globally, ie "1", "2"), a text variable, a list of strings (which are the option button values), another list of strings (which contains option identifiers), and a string which is used for passing custom functions through. A collection of these Dialogue classes are made, and then stored in a dictionary, with the key of each being the identifier.

public string identifier;
public string text;
public List<string> options;
public List<string> optionIdentifiers;
public string onCloseFunction;

public Dialogue(string identifier, string text, List<string> options, List<string> optionIdentifiers, string onCloseFunction = "") {
    this.identifier = identifier;
    this.text = text;
    this.options = options;
    this.optionIdentifiers = optionIdentifiers;
    this.onCloseFunction = onCloseFunction;
}

At the start, the dialogue with identifier 1 will be chosen, and the text displayed, with each of the buttons.

If the first option is chosen, that is index 0 in the options list. The index selected is used to get the correct identifier from the identifier list, which will return "2_1". This is then used to find the next dialogue.

The system fortunately works, however I'm wondering if I've overcomplicated this, and if there's a simpler way to do this.

Building further on this, it isn't easy to sort out the conversations to appear in. I have made the class 'Dialogue' serializable, so the properties are displayed in the unity window. I've made a public array of dialogue, which then is turned into a dictionary with the corresponding key identifiers.

public Dialogue[] dialogueList;
public DialogueLibrary dialogueLibrary;

void Awake() {
    Dictionary<string, Dialogue> dict = new Dictionary<string, Dialogue> ();
    for(int i = 0; i < dialogueList.Length; i++)                // Add all dialogue from inspector into dictionary
        dict.Add(dialogueList[i].identifier, dialogueList[i]);
    dialogueLibrary = new DialogueLibrary (dict);
}

This allows me to add dialogue as such:

The biggest problem I have with this, is the fact that it's just... not very nice to deal with. For example, if there were 30 pieces of dialogue, and I wanted to add another between 2 and 3, I would have to either increase every identifier afterwards, or use something like 2a for an identifier. Furthermore, it would be a lot better if I could read the dialogue list from an XML file.

What I'm stuck with is how I can create this XML file. I need some software that can simply create the conversations and export them in XML. Honestly I'm not sure how to go about this. Is there any software which exists already which could do something like this, or should I create my own in Visual Studio? I'm not sure how I'd go about creating something like this in visual studio. Ideally the software would be similar to mind maps, where the node of text is the dialogue text, and the connecting arrows have text on, and are equivalent to the options. Identifiers should ideally handle themselves.

Can anyone give me any pointers in what direction I should take, and if the direction is creating my own program, could anyone suggest any resources which would help me?

I understand this is a long message and I'm asking a lot, but any help, comments or even constructive criticism on my system would be greatly appreciated. Thanks in advance.

sentences:
An API independent way of managing video memory? I'm developing a game. The game architecture is very modular. I have a "Graphics Engine", which uses either a Direct3D or OpenGL renderer. However the user does not have access to the renderers directly. Instead the "Graphics Engine" class is used, which uses a renderer interface.

I also have a resource management system. As for now, the renderers are respoinsible for allocating and releasing video memory. That couples my design in a bad way, since the "Graphics Engine" has undesirable logic for transferring resources between the RAM and the VideoRam through sending signals to the "Renderer". I want the resource management system to be responsible for allocating video memory.

I want to decouple the "Renderer" and "Graphics Engine" classes as much as possible, and make the renderer only responsible for rendering. Is there a way to obtain a universal pointer to a Video RAM buffer, and use it to render with both renderers?

My problem is basically that I can only obtain OpenGL or Direct3D handles, which can be used only from the relevant API. And the "Graphics Engine" should not know which renderer it uses.

sentences:
How to create a path-finding compatible road map from user input? I'm currently working on an agent simulation (inspired by the recent SimCity release). Now, basically I understood how agents work but I do not understand how to put them into context. Agents travel along roads on a map and pursue their own goals.

As in SimCity, I want the player to be able to create his own roads. If I used grids, I would run into a problem caused by user input: Imperfect grids will be created where two roads would need to share one "box". This would be even worse with bevels.

(Grey = Street, Orange = Agent road, Dots = Immobile Agents)

Is there another, more clever way of building a road map that would support this kind of map and is compatible with path-finding?

Thanks a lot!

Paul

sentences:
Am I on the right track with this component architecture? I've recently decided to revamp my game architecture to get rid of deep class hierarchies and replace them with configurable components. The first hierarchy I'm replacing is the Item hierarchy and I would like some advice to know if I'm on the right track.

Previously, I had a hierarchy that went something like this:

Item -> Equipment -> Weapon
                  -> Armor
                  -> Accessory
     -> SyntehsisItem
     -> BattleUseItem -> HealingItem
                      -> ThrowingItem -> ThrowsAsAttackItem

Needless to say it was starting to get messy and these was no easy solution to items that needed to be multiple types (i.e. some equipment is used in item synthesis, some equipment is throwable, etc.)

I then attempted to refactor and place functionality into the base item class. But then I was noting that the Item had alot of unused/superfluous data. Now I'm trying to do a component like architecture, at least for my items before attempting to do so to my other game classes.

Here's what I'm currently thinking for the component setup:

I have a base item class that has slots for various components (i.e. an equipment component slot, a healing component slot, etc. as well as a map for arbitrary components) so something like this:

class Item
{
    //Basic item properties (name, ID, etc.) excluded
    EquipmentComponent* equipmentComponent;
    HealingComponent* healingComponent;
    SynthesisComponent* synthesisComponent;
    ThrowComponent* throwComponent;
    boost::unordered_map<std::string, std::pair<bool, ItemComponent*> > AdditionalComponents;
}

All item components would inherit from a base ItemComponent class, and each Component type is responsible for telling the engine how to implement that functionality. i.e. the HealingComponent tells the battle mechanics how to consume the item as a healing item, while the ThrowComponent tells the battle engine how to treat the item as a throwable item.

The map is used to store arbitrary components that are not core item components. I'm pairing it with a bool to indicate whether the Item Container should manage the ItemComponent or if it's being managed by an external source.

My idea here was that I define the core components used by my game engine up front, and my item factory would assign the components that the item actually has, otherwise they are null. The map would contain arbitrary components that would generally be added/consumed by scripting files.

My question is, is this a good design? If not, how can it be improved? I considered grouping all components into the map, but using string indexing seemed unecessary for the core item components

sentences:
How do I construct the planes for my camera's frustum? I'm trying to get a handle on frustum culling, but I'm not quite there yet.

I have a camera in three-dimensional space

Camera
    position (cx, cy, cz)
    rotation (tx, ty, tz)
    fieldofview
    near-plane
    far-plane

and a quadtree containing my chunks of terrain

Quadtree
    Chunk
        bottomleft (x, y)
        width
        length
        heightmap

Currently, I am rendering every chunk within the quadtree. However, I would like to cull all chunks outside the six planes of the camera's frustum.

I am unsure how to:

Generate these planes given the information in the camera class.
Efficiently test for intersection using my quadtree. If one region of the quadtree fails, do all of its children (that seems reasonable, I just want to make sure)? What is the process for running through a quadtree for culling?
Perform the intersection test using the planes and my terrain chunks. How do I quickly tell if a piece of terrain (square with varying y values) lies within the 6 camera planes?

sentences:
Saving an interface instance into a Bundle All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle.  When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu (Another custom class) which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

sentences:
How to move around a player in a curved tunnel? In a scenario where the player moves freely along the walls of a tunnel (like this), what is the best way to move the player along the walls of the tunnel?

I'm using Unity3d game engine. I've tried to remove all gravity and apply relative downward force on the object on every tick. Pressing right or left key applies relative force on the x-axis. But the player object will not rotate along with the walls of the tunnel and hence wont climb. I can calculate tangent to the center of the circle inside the tunnel and rotate the player myself but that wont work with curved tunnels.

sentences:
Animating a background 'pulse' with easing equation I'm trying to find a suitable easing equation (or other method) to animate an object so that it 'pulses' (imagine a 'spike' on a music visualiser, or see the image I drew badly below)

'v' is the value I'm using to scale. 't1' and 't2' mark the end of a single pulse.

The game I'm working on is a puzzler, but I'd like to have objects in the background pulse in time with user-selected music.

I'm sure it's just a case of knowing what to search for, but any advice would be appreciated on how best to achieve this.

sentences:
How can I make a computer opponent for my board game? I am trying to create a game, not exactly checkers, but the level of its interactivity is on par with checkers as opposed to something more complex (I think) like chess.

Anyway, according to my analysis, the UI, gameplay, player turns, time constraints, rewards are very easy to implement.

What I find hard is the actual CPU logic.

I'm looking at checkers as an example because I used to play checkers on my PC and Nokia long before sophisticated modern AI became a thing. Are there techniques used in old checkers games that I could use to calculate which of its moves is the most advantageous for it to win the game?

I would implement a logic on my own but I need a special algorithm to compute every possible move, and this will def take me a decade to implement.

I am sure there is a smarter and quicker way but I have no idea.

sentences:
Migrating 2D game from immediate mode to VBOs I am in the process of migrating away from legacy OpenGL calls in my 2D LWJGL game. Previously I would render each sprite using immediate mode, which was dead easy - bind the texture, add the vertices, and it's done.

Now I want to use vertex arrays. Ideally I would put the vertices for ALL my entities in one big array and render it in a single draw call. The problem? Each entity type uses a different texture, and glDrawArrays uses just one texure at a time.

Here are some possible solutions I came up with:

1) Create a separate vertex array for each entity

This is by far the easiest solution, but it somehow seems wrong to me, because it's so similar to using immediate mode. Doesn't this defeat the benefit of using vertex arrays?

2) Create a separate vertex array for each entity type

In other words, all entities that have the same texture will be rendered together. This isn't ideal as it would involve a good chunk of extra work and some extra effort on the CPU to separate the entities by type, and more importantly, would affect the z-ordering of the entities.

For example, it would be impossible to have a Tree that appears in front of one Squirrel but behind another Squirrel.

That is, unless I introduced a depth buffer, but I was trying to avoid this as it adds another level of complexity and, as I understand it, more work on the GPU (although that probably doesn't matter too much).

3) Combine all textures using a texture atlas

If I was able to use a single texture for all entities, I could use a single vertex array. However, there are 2 problems with this:

I have not been able to find a good library for creating a texture atlas at runtime, and writing this code myself would be non-trivial.
I am worried that some GPUs may have a prohibitively small texture size limit.

Summary

Would the first solution be viable / advisable?
Am I being foolish for trying to avoid using the depth buffer?
Am I missing something here? Is there a better solution?

sentences:
Weird squares everywhere So in unity I have some weird squares on surfaces of certain objects, which are buildings represented by planes:

I don't know what causes it, I tried changing some settings in lighting and material, but couldn't fix it. This only occurs with one object which is a few planes representing buildings temporarily. The lighting is baked (one directional light).
 Here's the screenshots of lighting and materials tab:

Does anyone know what could be the problem and how I can fix it?
Ask for more information if needed.
Thanks.

EDIT: The buildings were imported from blender.

sentences:
How to ensure that a 3D coordinate at Z=1 act like a 2D coordinate (using perspective projection) Possible Duplicate:
  OpenGL ES 2.0: Mixing 2D with 3D

The title probably is not that clear but please help me out here. I am going to write a (mostly) 2D game using OpenGL ES 2.0 so if I have a vertex at (5,10,1) I want it to be drawn at the (5,10) pixel on the screen. But I can't use orthogonal projection because I'll still use some few real 3D objects on it to give a cool effect, and I want to preserve the perspective distortion on their vertices with Z > 1.

How should I set up my view/projection matrices to achieve this?

note: I am so sorry if this sounds like a noob question, but please take in account that I am a noob myself...

sentences:
Unity vr device support I have been looking for a list of VR devices that unity supports (or that you can use to develop VR games with).

However i have been unable to find a list. Currently im looking at BOBO VR Z4

But to make sure i do not make any incorrect purchases so it would be really helpful to know supported devices.

Also it is worth noting i'm going to be using the newest version of Unity. (which is currently version 5.6)

sentences:
understanding image rotation XNA C# I do not understand how the rotation of the image i have works. Is it something to do with the ThumbSticks on the Xbox Pad? or properties of a float? if someone could explain to me what is actually happening here i would be very greatful.

The image is of a Gun. I would like to add in shooting guided by the thumbsticks for enemies above the player, so understanding this is crucial.

The image and coding has its own class. So in Game1.cs only initialised, WMpos set to the character and update and draw methods referenced, so does not affect rotation.

This is all the relevant code for it here:

public Texture2D WMtxr;
public Vector2 WMorigin;
public float WMrotation;

public void UpdateMe(GameTime gameTime)
    {
        WMorigin = new Vector2(WMtxr.Width - 100, WMtxr.Height - 36);
        if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y < -0.1)
        {
            WMrotation += 0.03f;
        }
        if (GamePad.GetState(PlayerIndex.One).ThumbSticks.Right.Y > 0.1)
        {
            WMrotation -= 0.03f;
        }
    }

public void DrawMe(SpriteBatch sb)
    {
        sb.Draw(WMtxr, WMpos, null, Color.White, WMrotation, WMorigin, 1f, SpriteEffects.None, 0);
    }

sentences:
Shared Object Not saving the level Progress I am making a flash game in which i have a variable levelState that describes the current level in which user has entered I am using SharedObject to save the progress
but it does not do so
first i declred a clas level variable

private var levelState:Number = 1;
private var mySaveData:SharedObject = SharedObject.getLocal("levelSave");

in the Main function i am checking if it is a first run of the game like below

if (mySaveData.data.levelsComplete == null)
    {
        mySaveData.data.levelsComplete = 1;
    }

and in a function where the winning condition is checked so that levelState could be increased i am usin this sharedobject to hold the value of levelState

if (/*winniing condition*/)
    levelState++;
    mySaveData.data.levelsComplete = levelState;
    mySaveData.flush();
    setNewLevel(levelState);
}

but when i play the game clear a level and again run the game it does not start from that level it starts from beginning.

sentences:
Grid pathfinding with a lot of entities I'd like to explain this problem with a screenshot from a released game, DROD: Gunthro's Epic Blunder, by Caravel Games.

The game is turn-based and tile-based.

I'm trying to create something very similar (a clone of the game), and I've got most of the fundamentals done, but I'm having trouble implementing pathfinding.

Look at the screenshot. The guys in yellow are friendly, and want to kill the roaches.
Every turn, every guy in yellow pathfinds to the closest roach, and every roach pathfinds to the closest guy in yellow.

By closest I mean the target with the shortest path, not a simple distance calculation.

All of this without any kind of slowdown when loading the level or when passing turns.
And all of the entities change position every turn. Also (not shown in screenshot), there can be doors that open and close and change the level's layout.

Impressive.

I've tried implementing pathfinding in my clone.

First attempt was making every roach find a path to a yellow guy every turn, using a breadth-first search algorithm. Obviously incredibly slow with more than a single roach, and would get exponentially slower with more than a single yellow guy.

Second attempt was mas making every yellow guy generate a pathmap (still breadth-first search) every time he moved. Worked perfectly with multiple roaches and a single yellow guy, but adding more yellow guys made the game slow and unplayable.

Last attempt was implementing JPS (jump point search). Every entity would individually calculate a path to its target. Fast, but with a limited number of entities. Having less than half the entities in the screenshot would make the game slow. And also, I had to get the "closest" enemy by calculating distance, not shortest path.

I've asked on the DROD forums how they did it, and a user replied that it was breadth-first search. The game is open source, and I took a look at the source code, but it's C++ (I'm using C#) and I found it confusing.

I don't know how to do it. Every approach I tried isn't good enough. And I believe that DROD generates global pathmaps, somehow, but I can't understand how every entity find the best individual path to other entities that move every turn.

What's the trick?

This is a reply I just got on the DROD forums:

  Without having looked at the code I'd wager it's two (or so) pathmaps
  for the whole room:

  One to the nearest enemy, and one to the nearest friendly for every
  tile.

  There's no need to make a separate pathmap for every entity when the
  overall goal is "move towards nearest enemy/friendly"... just mark
  every tile with the number of moves it takes to the nearest target and
  have the entity chose the move that takes it to the tile with the
  lowest number.

To be honest, I don't understand it that well.

sentences:
What makes Minecraft so great? I believe everybody has heard of Minecraft. It is a deceptively simple game, that was made by a single indie developer, and sold more than 500k copies - despite having no active marketing and being technically a buggy alpha-version.

That is really great success for an indie game. And I think we can all learn much from it. So I want to examine Minecraft's game design: what, in your opinion, makes it so great? What choices work well, how they combine together to make a great game? And what design decision are bad (I don't think everything is ideal in Minecraft)

What do you think?

sentences:
Is wireframe effect possible without geometry shader? I am trying to write a shader that highlight the edge between each pair of vertices, much like the UCLA Wireframe Shader.

All implementations I came across require geometry shader support. I am wondering if this is possible with just vertex and fragment shaders?

(Of course, I can use texture to workaround it; but I am trying to avoid create custom textures for each model that I need this effect. On the other hand, I could just use geometry shader but it presents quite a problem when porting to iOS, which lacks support.)

sentences:
How do I merge quads to simplify a heightmap? I'm trying to improve my frame rates.

My map has an area of 200 * 200 vertices, where each vertex has a height.
200 * 200 = 40000 vertices per frame.

I'd like to create a method to simplify the whole heightmap (i.e. decrease vertex count). Every 4 vertices form a quad, so when there are 2 or more adjacent quads with the same height on each vertex, they could be merged.

How do I detect and merge vertices like that?

My height map is a list of floats representing the height of each vertex. The list is indexed by an x and y coordinate.

package rgc.area;

import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;

public class Terrain {

    private HeightMap map;

    public Terrain(HeightMap map) {

        this.map = map;
    }

    public void render() {

        float spaceBetwVert = 1f; // Space between each vertex

        GL11.glColor3f(0.1f, 1.0f, 0.2f);
        GL11.glBegin(GL11.GL_QUADS);
            for(int i = 0; i < map.getHeight() - 1; i++) {

                for(int ii = 0; ii < map.getWidth(); ii++) {

                    GL11.glColor3f(0.1f, 1.0f - ii * 0.1f, 0.2f);

                    float vz = i * spaceBetwVert;
                    float vx = ii * spaceBetwVert;
                    float nextVz = (i + 1) * spaceBetwVert;
                    float nextVx = (ii + 1) * spaceBetwVert;

                    GL11.glVertex3f(vx, map.getHeight(vx, vz), vz - 80);
                    GL11.glVertex3f(nextVx, map.getHeight(nextVx, vz), vz - 80);
                    GL11.glVertex3f(nextVx, map.getHeight(nextVx, nextVz), nextVz - 80);
                    GL11.glVertex3f(vx, map.getHeight(vx, nextVz), nextVz - 80);

                }
            }
        GL11.glEnd();
    }
}

sentences:
NavMesh - LoS and "Containing" For a gameserver/backend, I have a navmesh for "walkable" areas in form of points/triangles.

Now I want to check every gametick if the client is still in a legit place and if he shots/casts a spell, if his target is in line of sight.

I found several possibilities, but I am not sure what is performance-wise ideal.

To check if the player is still in the allowed area (and not wallhacking) I would check if his position is in one of the triangles with a algorithm using barycentric coordinates like this:
https://github.com/SebLague/Gamedev-Maths/blob/master/PointInTriangle.cs
But this would mean that every gametick I have to check soooo much triangles.

To check if its LoS I could either check if the line from the player to its target crosses one of the "border" lines of the mesh (which have no other triangle next to it). Those border lines could be computed at bake time and are just a static list for each level. But still it would be a lot lines per check.
Second option I found would be to start a Simple Stupid Funnel Algorithm (http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html) until LoS is broken.

The questions now are:
How does a good gameserver handle this/can it be optimised?
What way to check is the best/fastest?
Is it common to only check if the position is legit every now and then or every gametick?

The Levels are fairly simple (~300 mesh-triangles, ~200 border lines, 10 players, 10 npcs maybe)

sentences:
Labeling Areas on a map I've been wondering how you would go about labeling an area on a 2D tile map. What I'd like to do is associate tiles with an area i.e Forest Area, Desert Area, etc.

Keep in mind this is an idea, so far I've been thinking that one way to go about this is to have each area store tile positions as the pivot points and you need at least four of these pivot points before it is a valid area. This way would allow for some of the granularity I would like as my first idea was to just associate every tile with an area id, which is pretty inefficient time-wise, though the task would have been alleviated somewhat with a map editor that I am going to build (i.e. just paint a tile with an area color/number).

What are your ideas on this?

Also, the map, areas, and etc will be stored in an sql database FYI.

sentences:
Input.GetKeyDown not working while Unity Remote is running? I have this simple code:
void Update()
{
    if (Input.GetKeyDown(KeyCode.Escape))
    {
        Debug.Log("Escape");
    }
}

When I test it...

In the Editor, I press Escape, and it works.

On my Android, I press the Back button, and it works.

But when I hit play in the Editor while Unity Remote is running on my phone, neither the Escape on my keyboard, nor the Back button on my phone works.
The Update method is constantly running, just the Input.GetKeyDown returns false.
Why?

sentences: Different collision effects on different objects I'm a beginner to Corona and game development. I am using a variety of objects in my game. On collision, they all perform the same function. I want them to do different things, and also want some objects to only collide with certain other objects. How would I go about doing this?

sentences:
Detecting if "Wall" To The Left or Right Of Player Unity3D I am working on a 3D Platformer in Unity3D and I need to prevent the player from going through walls. The movement for my player works like this:

(A bird-eye-view representation)The areas the player can move a divided into layers. He can slide into the 2nd, 1st , or 3rd layers. The player is not a rigid-body, and is controlled using a character controller. To move the player into these layers I simply increase his Z-Axis. Currently if my player is behind the wall he will slide directly into it. How can I determine if there is a wall to the left of the player in Unity 3D? If so, I simply wont allow the user to move to the layer until they have steered clear of the obstacle. Does anyone have any suggestions of what I should do?

sentences:
Tile Map Collision in 2D Platformer (C# Monogame) I am trying my hand at making a small 2D platformer. Currently I am trying to implement collision on a tile map. I have been trying to experiment with different ideas but can not find a way for the life of me. Currently, bounding boxes have been set up around the player and the blocks.

My current algorithm is as follows:

        for (int i = 0; i < blockBound.GetLength(0); i++)
        {
            if (playerBound.Intersects(blockBound[i]))
            {

                if (playerBound.Bottom > blockBound[i].Top)
                {
                    jumping = false;
                    player.pos.Y = player.prevPos.Y;
                }
            }
        }

I have tried using an intersect amount by subtracting the blockBound[i].Top value from the playerBound.Bottom value and moving the player by that much back to their previous position but it only caused the player to move in and out of the block rapidly.

When doing the same thing with all sides, you could probably guess, always makes the collision code run.

Also with this code, when the player jumps, it appears to have somewhat of a jolt for lack of a better word when it begins jumping, compared to the normal smooth jump it has without any collision.

Is there a better way of doing this and if so, how?

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

Any help would be greatly appreciated!

sentences:
How can I make a character smoothly traverse a list of waypoints? I want to set up paths for enemy characters in my game to patrol. I'd like to be able to define a list of waypoints and have the enemy follow the path from one point to another, but in a smooth curve.

How can I do this?

sentences:
Why are my 2D positions "off" after adding a camera transformation in XNA? My game's source is on github.

I am following this tutorial to create a 2D camera. After I adding the transformation to the SpriteBatch, all of my positions seem to be "off" when I move the ship (and hence camera) away from the screen center.

Any idea what might be wrong?

sentences:
Do I, and how, separate the concerns of input and game objects? In probably every game a developer has to somehow deal with input, may it be simple keyboard and mouse events, touch events or something as accelerometer input. This input directly of indirectly effects objects in the game. Sometimes the same input can effect diffent objects. Now I've been thinking about how to model this. The way I see it there are two different approaches.

Let the game object itself handle it, subscribe to the events and call it's own methods.
This has the advantage of letting the game-objects themselves decide which inputs cause which action. A disadvantage seems to be that the input code gets mangled with the "core" game object code. Also the game objects are unaware of the state of the rest of the game, and should sometimes maybe not act upon input events. This doesn't seem right.
Have a general input-controller take care of all the input and make decisions about who gets to handle what event.
This seems to separate concerns better, but tighly couples the input-controller class to the game-objects. It somehow need to know who wants to receive which event and in which state. This doesn't seem right either.

What strategies are you using to handle this?

sentences:
Unity 5: 3rd Person Controller runs by default. How to change this? I have been working with the Third Person Controller of the Standard Assets (called Sample Assets in the beta versions) in Unity 5. When the player press the forward button, the character runs by default, and walks if you hold Left Shift, and I want to swap that.

However, The controller makes use of Blend Trees, and have two scripts to manage movement and input and it's far too complex for me and so I need your help. How can I change the controller so that the player walks by default and has to hold Shift to run?

sentences:
How to find the angle of an arc for reflection I am using the following code to calculate points for a circle arc drawn with a Line Renderer.

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

        float x = radius * Mathf.Cos(ang * Mathf.Deg2Rad);
        float y = radius * Mathf.Sin(ang * Mathf.Deg2Rad);
        arcLine.positionCount = i + 1;
        arcLine.SetPosition(i, new Vector2(x, y));
        ang += (float)totalAngle / pts;

    }

How can I change the angle ang to create a reflected arc along the line P1P2 as in the image below?

Please note that totalAngle represents the portion of the circle that is to be drawn between 0 and 360.

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

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

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

sentences: Lightmapping & runtime combine children Is it possible to have lightmapping on runtime generated combine children in Unity? It is possible to bake combined meshes when they are done in the editor, but the .apk/.ipa size increases too much.

sentences:
Designing loots for chests Let's say we have a game, with enemies you fight, items to get and also chests to find and loot. Imagine a RPG game if you will.
We also have a table with x items that the player can loot from these mentioned chests. Some of these items are "one drop only", while others can drop more than one time. We might set that as a variable in the table.
Now to the question: When would you scatter the items in the table to the chests?

Would you do this as soon as the level loads?
Would you do a lookup when the player opened a chest?

As far as I see it, if you scatter the items when the level starts, the player could miss a unique item, if the player skipped that specific chest containing that unique one-time-only item.
But, if you do a lookup when the player opens a chest, the player does not need to worry (if the player knew exactly how it was coded) about actually missing unique items.
How would you handle this design wise? Is it ok for players to miss unique items for being lazy/bad/unlucky? Or, do we always want the player to be able to get just about all the items in this table at one point?
Which way would you prefer as a dev? Which way would you prefer as a player? Have I missed an important factor, a third way to handle it, or something else?

sentences:
What range of values can HLSL's tex2D function return? When using the tex2d function in a HLSL shader, as so:

float height = tex2D(heightMap, IN.texCoord).r;

What range of values can be returned to the height variable? Is it always a number between 0.0f - 1.0f? Or does it depend on the texture or sampler?

sentences:
Unity generates bad mipmap, making voxel terrains look bad It's just a dirt terrain with grass blocks on the top. (which are just dirt blocks with green tops.)

I sampled a Unity terrain's heightmap, and constructed a voxel terrain based on it, and divided it into chunks, whose meshes then were combined.

Sadly the generated mipmaps are bad, the mipmap change is easily noticeable: first the shade of green changes, then it fully becomes dirt colored.

sentences: What is required for casting shadows in JavaFX 8 3D? In a scene with an added point light the shapes are not casting shadows on each other. Is anything required to cause them to cast shadows?

sentences:
how to handle interactive choice in the middle of the game loop? I am programming a turn-based game, 2D tile-based, overhead view.
I have an update function and a render function running in separate threads.
When it's the player's turn, the player can e.g.

select a target tile from the map
then a popup menu with the available interactions appears
player selects interaction and the interaction gets executed

One tedious way is the following:

GameLoopUpdate():
        switch( interaction_state )
            case tile_selected:
                lookup_interactions_for_selected_tile()
                break
            case tile_and_interaction_selected()
                execute_interaction_at_tile()
                break
             default:
                break

Of course the above does not scale when the interactions get complex.

Conceptually, I would like it to be more like:

KeyListener():
    if tile is clicked
        set_tile_selected()

GameLoopUpdate():
    if tile is selected:
        interaction  = spawn_thread_interaction_selection()
        execute_interaction_at_tile( interaction )

where the spawned thread would somehow override the input listeners AND the rendering. But this looks bad as well.

Another idea (I'm starting to consider implementing this) is the following:

GameLoopUpdate():
    if it's player's turn
        set next state as PlayerState_Base
    else
        run ai turn

PlayerState_Base():
    if tile is selected
        set next state as PlayerState_TileSelected

PlayerState_TileSelected():
    if interaction is selected
        execute interaction
        set player's turn as done

where each state above would have dedicated key listener and rendering functions

Any other ideas?

sentences: Tile walking algorithm for already known set of walkable tile? Suppose I already have a list of tile that specify which tile the character can move to, and these tiles are clustered around the character. If I want to produce a path (maybe not shortest, but just a short path) to the desired tile, how would I construct it with the given list of tiles? I was going to do an A* algorithm, however, thinking again, it will complicate my coding process. Therefore, is there a better way to find short path for known list of movable tile?

sentences:
How can I randomly choose a monster from an array of monsters? I have a problem dealing of how can I call the values inside the arrays correctly. First of all, I am into making an array of monsters and a set of hp for them. I made it this way:

string monsterlist [] = {"Imp", "Orc", "Troll", "Gnome"};
float monsterhealth [] = {5.0f, 8.0f, 9.0f, 10.0f};
int monsterlife;
int monsternumber;

wherein, since i can not call the variables correctly, I made a very simple way to do it, which is:

srand(time(0));
monsternumber = 1 + (rand() % 3);
if (monsternumber == 1)
    cout << monsterlist[1];
else if (monsternumber == 2)
    cout << monsterlist[2];
else if (monsternumber == 3)
    cout << monsterlist[3];
else if (monsternumber == 4)
    cout << monsterlist[4];

Is that correct? I know it might be not the proper way. This is what I wanted:

I want to create a random number generation from 1 to 4 and store that variable in monsternumber. The next thing that will happen is, if the monsternumber is equal to 1, for example, should make the monster Imp and 5.0 as its health, seen from string monsterList and monsterHealth.

Is there a proper way to make this simplier or rather the correct way of doing it?

sentences:
Why do companies still use really old versions of Visual Studio? I understand why C++ is used. That is not what this question is about.

When I install games, commonly Steam (I pretty much only use Steam these days) will install the C++ 2005 Runtime distributable.

My question is why is this the case? What is the reason a runtime released over 8 years ago is still prevalent? Some of the games I've installed recently are slightly older, so assuming a couple of years dev time you could make the case it was the tried and tested standard at the time.

Why do game companies not use a newer version of the VC++ runtime?

sentences:
How to change the value of variable from actor Y by the blueprint of actor X? I have a project, and it has: 1 NPC (actor X), 2 target points and 1 tower (actor Y).

Image of components in level:

These rose arrows demonstrate part of the NPCs path.

I added a Event Begin Overlap in the blueprint of the NPC so that when it collides with the tower it loses 10 of life every second:

Image of print of variable life:

When the NPC gets 0 life, it goes to the next target point.

But I would like to know how to also modify the life of the tower by the same blueprint (NPC).

The code is already in my mind, it is kind of obvious to speak the truth.

"Code" of NPC blueprint:

I do not want to have to create a new Event Begin Overlap on the blueprint of the tower.

And I think using the blueprint level would not be a good idea.

One of the links below indicated something like Blueprint Interface, but I'd like to know if I can do what I want for the NPCs own blueprint.

Links:

https://forums.unrealengine.com/international/brazil/89438-pegar-vari%C3%A1vel-de-outro-blueprint

https://answers.unrealengine.com/questions/21386/communication-between-2-blueprints.html?sort=oldest

https://answers.unrealengine.com/questions/24773/how-to-call-a-blueprint-variable-from-another-blue.html

https://docs.unrealengine.com/en-us/Engine/Blueprints/UserGuide/Types/Interface

sentences:
Scroller game level map advice I'm started a XNA project to make a game similar in gameplay to Super Spy Hunter on a NES, which is used as a feature reference. The first thing I thought of is how to store and display level. Currently I'm thinking of using some tile graphics editor and custom pipeline for drawing level. I'm not sure however, that all is possible to implement every feature of reference game, but at least it's a start.

Question is, looking at a given gameplay video, can you think of any possibly better approach then to design level using a tiles?

By "better approach" I mean which will be either easier to work with, which will be more "natural" for this kind of game. The doubt comes mainly from a huge technology gap between then (1990) and now. So there is possibility that using current cpu power this could be done easier.

Update 1. As I continue study reference game and @ashes999 correctly mentioned procedural generation also comes into my mind. I began to think game logic is something like (simplified):

while next road section exist:
    get road section data;
    set road generation options (borders type, road type, etc);
    set road section lenght;
    while not end of a section:
        generate road;
        apply pseudorandom eye candy stuff;

this all looks like a pretty good data driven algorithm.

sentences:
Increase speed with each enemy destroyed? I need some help with coding this idea: "For each Target destroyed, increase the Gunner's speed by (speed variable)". The idea is that the Gunner is automatically moving, and I want it to become more frantic with each target hit.

Here's the relevant code I have so far:

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

    void Update () {
            Gunner_Move ();
    }

    //gives me the error "Assets/_Scripts/MovementPathScript.cs(60,83): error CS0200: Property or indexer `System.Array.Length' cannot be assigned to (it is read only)"
    void Gunner_Move(){
            if (GameObject.FindGameObjectsWithTag ("BulletProgressionObject").Length -= 1)
                Gunner_SpeedIncrease ();
    }

void Gunner_SpeedIncrease(){
         //behavior that I'm not sure how to make
   }

    //for the bullets colliding with target's parent object
        void OnTriggerEnter(Collider other){
            if (other.gameObject.CompareTag ("BulletProgressionObject"))
                Destroy (other.gameObject);

I think it's a foreach loop, but the issue I'm having is properly implementing it. Any suggestions or referrals would be greatly appreciated.

sentences:
Input Handling and Game loop So, I intercept the WM_KEYDOWN and other messages.

Thing is, my game can't/shouldn't react to these messages just yet, since my game might be currently drawing to the screen or in the middle of updating my game entities.
So the idea is to keep a keyboardstate and mousestate, which is updated by the part of my code that intercepts the windows messages. These states just keep track of which keys/buttons are currently pressed.
Then, at the start of my game's update function, I access these keyboard and mouse states and my game reacts to the user input.

Now, which is the best way to access these states? I assume that windows messages can be sent whenever, so the keyboard/mouse states are constantly being edited. Accessing say a list of currently pressed keys in the keyboard state the same time another part of the code is editing the list would cause problems.

Should I make a deep copy of a state and act on that?
How would I deal with the garbage generated though, this would take place every frame.

sentences:
What are some good MMO middleware server packages? If you have any experience with any MMO middleware packages and have any positive or negative experiences with them, your feedback will be appreciated.

Specifically I'm looking for server packages.  Price, functionality, speed, and ease of use would all be useful metrics to know about.

For example, doing some preliminary research has led me to some packages like Exit Game's Photon,  RedDwarf Server, and SmartFoxServer.

sentences:
Unity 4.6.6 iOS Build Issue I am using unity 4.6.6 to create a Xcode build. When I create a build I am getting following error

Cannot initialize return object of type 'Singleton_1_t6738 *' with an rvalue of type 'Singleton_1_t6737 *'

sentences:
Noisy edges, smoothing out edges between faces via fragment shader I have a generated terrain, with hexagonal geometry, as per screenshot below:

I then generate biomes, but as you can see the borders between them are really ugly and straight. To hide that hexagonal origin, I would need to smooth out the borders between biomes. This is how it looks now in wireframe with real tringular faces:

What I'm aiming for is something more like this:

Each vertex has attibute that holds the biome type, I can also add special attributes to the vertices on the edge between two biomes, but I just don't seem to be able to figure out how to pull this off in shader code, obviously noise is involved here, but how do I make it continous across multiple faces and entire border of multiple biomes?

I'm rendering with WebGL using THREE.js

sentences:
Distribute XNA as a standalone zip or exe (no installer needed)? I want to know how would I distribute my XNA such that it won't distribute as an installer/setup files? I just want a zip of files such that when the user can run instantly after extracting into a folder. I am making a small prototype of some functionalities, and I would like my co-workers to visually see it so that we can communicate better. However, this must means I must frequently release my projects (as I update it frequently), so I want to know a way to produce easy-to-launch distribution.

I tried to turn Build option in Visual Studio to Release, and try copy and zip all the files inside Release folder. However, when I zip it and send to my coworkers, they said nothing comes up after they open the exe.

sentences:
Triangles in the corners of skybox When looking at the corners of skybox this happens:

http://i.imgur.com/H8XvS8I.jpg

How to get rid of this?

6 skybox textures are 2048x2048px each.

Tried changing Near and Far clipping of the main camera inside the character controller but it was ineffective.

If I look away from the corners the dark triangles dissapear. Only when I look directly at the corners they appear.

sentences:
How to implement a Trail using Cocos2dx I'd like to implement a trail (like the white circles in Angry Birds) that chase my sprite. I already used CCMotionStreak, but the trail texture is "stretched" instead.

Anyone has an idea how to make this?

sentences: In theory, would an erosion algorithm compute faster on a GPU than CPU? I'm planning to port an erosion algorithm from CPU to GPU, in theory, will it be faster or would it be better to multi-thread it on the CPU? The algorithm has quite a lot of if statements and loops with non-constant amount of iterations so it's going to be a lot of branching.

sentences:
How can I calculate the bounding box of a 3D model? I am making a game in OpenGL and Blender and trying to use JBullet as the collision manager. I am using BoxShapes for collisions, which requires a javax.vecmath.Vector3f representing half of the box to create.

How do I calculate the dimensions (width, depth and height) of a Blender model in-game?

sentences:
How to render images/textures in shape/polygon form? I'm working with SFML right now, and upon finishing the tutorials I still do not know how to give a shape a texture or image -- not just a solid color/outline.

The only thing I know can take an image is a sprite, but thats way to simple, as it only allows you to render rectangular images in a rectangluar way!

What are the techniques for rendering images onto shapes, and only inside the shape? It would be great if some of you could provide some resources or SFML-specific stuff!

sentences:
Rain effect using DirectX 9 capabilities Is it possible to achieve something similar to nVidia's rain demo using only shader model 3.0 capabilities? If yes, could you point out a few documents/web resources that are suitable candidates and do not require a heavy programming load (e.g. not more than two hard weeks of programming for one single person)?

It would be nice if the answer could also contain a pro/con phrase for the proposed idea (e.g. postprocessing rain shader vs. a particle based effect).

sentences:
Per instance world matrix is 0.0f/NaN I'm trying to draw some cubes with Hardware Instancing.

However they don't get displayed. So I debugged my code, and found the source of the problem:

In my VertexShader, the var that has the per instance world matrix has a value of:

{ 0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, 0.0f, 0.0f, 0.0f,
  0.0f, NaN, NaN, NaN }

The weirdest thing is that it outpus NaN (Not a Number). Here's how I create my instanced buffer:

XMMATRIX trans[4];

trans[0] = XMMatrixTranslation(0.0f, 0.0f, 0.0f);
trans[1] = XMMatrixTranslation(0.5f, 0.5f, 0.5f);
trans[2] = XMMatrixTranslation(-0.5, -0.5, 0.5);
trans[3] = XMMatrixTranslation(0.5, -0.5f, 0.5);

//Store world matrices
for (int i = 0; i < 4; i++)
    XMStoreFloat4x4(&mIV[i].world, trans[i]);

D3D11_BUFFER_DESC instDesc;
ZeroMemory(&instDesc, sizeof(D3D11_BUFFER_DESC));
instDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
instDesc.Usage = D3D11_USAGE_DYNAMIC;
instDesc.ByteWidth = sizeof(XMFLOAT4X4) * 4;
instDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;

//Create instanced buffer
HR(mDevice->CreateBuffer(&instDesc, NULL, &mBoxInstB));

Here's how I map the instanced data to my buffer:

D3D11_MAPPED_SUBRESOURCE mapSub;
mContext->Map(mBoxInstB, 0, D3D11_MAP_WRITE_DISCARD, NULL, &mapSub);

VertexI* idata = reinterpret_cast<VertexI*>(mapSub.pData);

idata = mIV;

mContext->Unmap(mBoxInstB, 0);

Thanks for the help!
If you need some more info, write it in the comments!

sentences:
Chess engine stock fish process for mobile I am making the chess interface I designed for a game. I am using the process to get answers from a stock fish binary:

stockfish = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName = System.IO.Directory.GetCurrentDirectory () + "\\Assets\\Scripts\\Stockfish\\stockfish.exe",
                    Arguments = "",
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardInput = true,
                    RedirectStandardError = true,
                    CreateNoWindow = true
                }

            };

The problem I face is it worked for my Windows build but for mobile package build it won't work with the executable. Is there a way around it?

sentences:
What is the name of the balancing technique that reduces the incremental value of bonuses? Some games, including Dungeon Crawl (example), use a balancing technique that attempts to prevent certain values (stats, damage, etc.) from being excessively high. The algorithm looks like this:

if value > 20:
  value = 20 + (value - 20)/2
#70 → 45

...and can be applied multiple times:

if value > 20:
  value = 20 + (value - 20)/2
if value > 40:
  value = 40 + (value - 40)/2
# 70 → 45 → 37.5

sentences:
How do you generate tileable Perlin noise? Related:

Simple noise generation
Understanding Perlin Noise

I'd like to generate tileable Perlin noise.  I'm working from Paul Bourke's PerlinNoise*() functions, which are like this:

// alpha is the "division factor" (how much to damp subsequent octaves with (usually 2))
// beta is the factor that multiplies your "jump" into the noise (usually 2)
// n is the number of "octaves" to add in
double PerlinNoise2D(double x,double y,double alpha,double beta,int n)
{
   int i;
   double val,sum = 0;
   double p[2],scale = 1;

   p[0] = x;
   p[1] = y;
   for (i=0;i<n;i++) {
      val = noise2(p);
      sum += val / scale;
      scale *= alpha;
      p[0] *= beta;
      p[1] *= beta;
   }
   return(sum);
}

Using code like:

real val = PerlinNoise2D( x,y, 2, 2, 12 ) ; // test

return val*val*skyColor + 2*val*(1-val)*gray + (1-val)*(1-val)*cloudColor ;

Gives sky like

Which isn't tileable.

The pixel values are 0->256 (width and height), and pixel (0,0) uses (x,y)=(0,0) and pixel (256,256) uses (x,y)=(1,1)

How can I make it tileable?

sentences:
OpenGL ES 2.0 Point Sprites Size I am trying to draw point sprites in OpenGL ES 2.0, but all my points end up with a size of 1 pixel...even when I set gl_PointSize to a high value in my vertex shader.

How can I make my point sprites bigger?

sentences:
Porting Ruby/NCruses Rogue-Like to .NET and FlatRedBall I created an awesome rogue-like game in Ruby. For the GUI, I used NCurses. Since I'm using FlatRedBall as my engine of choice for Silverlight game development, I want to port this game over.

What is the best way to efficiently doing this, and what are the pitfalls I should expect?

For example, Ruby is object-oriented, like C#, and I should be able to just convert (rewrite) classes one by one. However, I will run into issues like:

NCurses API. I need to possibly create my own notions of a "Window", or else rewrite GUI code. It's one class, but it's BIG.
Mix-Ins. These are essentially aspect-oriented development. There are a couple of solutions in .NET, like dynamic classes.

What else? Also, I should mention that I want to create a FlatSilverBall (C#) application out of this. That is to say, I will be using the FlatRedBall 2D engine as my foundation. I am not interested in Curses, or any other variation that will allow me to make a console-type game.

As much as possible, I'll dump reusable and helper code, algorithms, etc. into separate projects and generate reusable DLLs.

sentences:
Do I need to "use" the shader program when buffering and defining VBO data? I'm trying to wrap my head around the relation between a GL "program", and the VAOs, buffers, textures, etc. I don't quite understand when I need to "use" my shader program, and when (if ever) I need to "un-use" it?

So when do I need to use the shader program (i.e. invoke glUseProgram), exactly? Does my shader program need to be in "use" when:

Creating and binding VAOs?
Creating and binding VBOs?
Buffering data to VBOs?
Defining vertex attributes (i.e. invoking glVertexAttribPointer)?

sentences:
Understanding MotionEvent to implement a virtual DPad and Buttons on Android (Multitouch) I'm trying to implement a virtual DPad in android, but I'm still very confused about how do I keep track of each trouch point, from the moment it is pressed, till it is released.

In my code, I test if there is a "DOWN" or "MOVED" event, then if one of this events collides with one of the 4 rectangles of my DPad, I set the pressedDirectin variable to the side of the DPad which the user pressed.

The thing I'm not sure, is how do I get track of the touch points, I want to store the ID of the touch point which collided with the DPad direction, so when this ID is moved I update the direction of the DPad and when it gets released I set the Direction to None.

I don't want my DPad to handle multiple directions, but I still didn't get how to handle the multiple touch points, so I can know exacly which touch point is touching the DPad and store it's ID so I know when it is released.

Is the onTouchEvent called for every touch point, or all touch points comes in a single call? I still don't get it.

Here is the code I wrote so far, it works, but guess that it will only handle one touch point.

public boolean onTouchEvent(MotionEvent event)
    {
        if (event.getPointerCount() == 0)
            return true;

        int touchX = -1;
        int touchY = -1;

        pressedDirection = DPadDirection.None;
        int actionCode = event.getAction() & MotionEvent.ACTION_MASK;
            if (actionCode == MotionEvent.ACTION_UP)
            {
                if (event.getPointerId(0) == idDPad)
                {
                    pressedDirection = DPadDirection.None;
                    idDPad = -1;
                }
            }
            else if (actionCode == MotionEvent.ACTION_DOWN || actionCode == MotionEvent.ACTION_MOVE)
            {
                touchX = (int)event.getX();
                touchY = (int)event.getY();

                if (rightRect.contains(touchX, touchY))
                    pressedDirection = DPadDirection.Right;
                else if (leftRect.contains(touchX, touchY))
                    pressedDirection = DPadDirection.Left;
                else if (upRect.contains(touchX, touchY))
                    pressedDirection = DPadDirection.Up;
                else if (downRect.contains(touchX, touchY))
                    pressedDirection = DPadDirection.Down;

                if (pressedDirection != DPadDirection.None)
                    idDPad = event.getPointerId(0);
            }

        return true;
    }

sentences:
What do I need to do legally to protect my game with copyright? I am in the process of writing a game and I'm wondering what the copyright laws about publishing this game are.

I do not (for now) intend to make money from this. The beginning of my code contains a comment with # Copyright 2013, Collin Norwood, but is that legally valid? Do I have to apply with some government for a trademark or such?

sentences:
What do I need to know about game design before I design and develop a game in Silverlight? I have started to design a game. I have weighed up the options of XNA, Unity, and Silverlight. I am going with Silverlight... Is there anything I important that I am missing that I need to know?

EDIT

I sketched the structural design yesterday: http://carnotaurus.tumblr.com/post/4921541502/old-school-game-to-be-written-in-silverlight

Not to repeat the game specifications at great length, a description of the 2D old school game can be found here: What approach would you take to develop an old school game?

sentences:
How do I change the direction of a circle when it hits a corner? I have a 2D Ball that might go against a wall.
If the Ball goes against the wall perpendicularly, it will just invert its direction (assuming no air resistance and no bounces that should make its speed change).
My problem is: how the velocity of the Ball changes when it goes against a corner?
This is the case I didn't figure out how to handle:

sentences:
Unity UV map, tint / change color of texture I have an array of vertices with texture coordinates for a UV map in Unity:

newUV.Add(new Vector2 (0, 1)); // FACE 1
newUV.Add(new Vector2 (1, 1));
newUV.Add(new Vector2 (1, 0));
newUV.Add(new Vector2 (0, 0));

newUV.Add(new Vector2 (0, 1)); // FACE 2
newUV.Add(new Vector2 (1, 1));
newUV.Add(new Vector2 (1, 0));
newUV.Add(new Vector2 (0, 0));

mesh.uv = newUV.ToArray();

It textures my mesh just fine.

How could I go around tinting FACE 1 to a darker color? Let's say the texture is just plain green and I wanted to texture only on FACE 1 to be a darker shade of green.

sentences:
How do I set the Foot IK property of an animator state by code? I would like to set Foot IK to enabled via code, but I can't find how.
Which type is "Foot IK" a part of?

sentences:
Unity - OnRenderImage hides UI I have a component which renders a few different cameras and the images. However, this obscures my UI when in Screen Space - Overlay mode.

I can put the canvas in WorldSpace mode, which works, but then the UI is affected by the image effect I've built and is, of course, not locked to the camera.

Suggestions?

Update - additional details

At design time, the OVR camera rig contains a single camera centered between the "eyes." This component is attached to the camera rig's centerEyeAnchor.

At run time, the rig creates two additional cameras - one for each eye. These aren't supposed to be modified by user code. (Among other things, their projection matrices are pretty weird.)

I need to modify the image per eye.

I created a new component which create two additional cameras per eye. One renders a low-res version of the entire scene, the other renders a high-res image of a portion of the screen, each to a dedicated RenderTexture.

Pseudocode:

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

/// called twice per frame - once per eye
void OnPreRender()
{
}

/// called twice per frame - once per eye
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
  /// low-res render of entire scene
  var camOuter = m_cameras[...];
  /// hi-res render of part of the scene - 10-20% of original image area
  var camInner = m_cameras[...];

  /// update cameras to match current eye camera
  camOuter.copyFrom(Camera.current);
  camOuter.targetTexture = m_outerTexture;

  /// render scene to low-res texture
  camOuter.Render();

  camInner.copyFrom(Camera.current);
  camInner.targetTexture = m_innerTexture;

  /// target texture that the Oculus wants to render to
  var ovrTexture = Camera.current.targetTexture;

  /// save projection matrix
  var originalProjectionMatrix = camInner.projectionMatrix;

  var scale = new Vector3(m_innerTexture.width * 1.0f / ovrTexture.width, m_innerTexture.height * 1.0f / ovrTexture.height);

  /// zoom/pan matrix to clip to part of the scene
  var gazeMatrix = Matrix4x4.Scale(scale);

  /// offset projection
  gazeMatrix.m03 += (1 - 2 * gaze.x) * scale.x;
  gazeMatrix.m13 += (1 - 2 * gaze.y) * scale.y;

  camOuter.projectionMatrix = gazeMatrix & originalPRojectionMatrix;

  /// render hi-res portion of the scene centered at gaze pixel
  camOuter.Render();

  /// restore projection matrix
  cam.projectionMatrix = originalProjectionMatrix;

  /// composite images
  m_material.SetTexture("InnerTexture", m_innerTexture);
  m_material.SetTexture("OuterTexture", m_outerTexture);
  Graphics.Blit(null, destination, m_material);

}

(I'm also worried that there may be additional scene renders happening in the background.)

The problem is that the UI does not render if set to Screenspace - Overlay or Screenspace - Camera. I can get it to render in Worldspace, which may be the only way to do this, but then it seems I'd need to create yet another hi-res texture matching the viewport dimensions and render the UI layer to that, and keep it locked to the current eye's camera position. Alternatively, I could re-use one of the current cameras, I guess, and just tweak its settings.

Is there a better way to do this?

Ideally, I'd like to have the engine just render the UI as it does in other applications without having to jump through hoops. However, at this point, I'll take anything I can get that works and looks good.

Update the 2nd

Okay, it looks like the UI is rendered perfectly if I use a regular camera instead of the OVR rig. :( Having the rig in the scene, though, prevents it from drawing at all.

sentences:
Is flash game development not considered 'proper' game development? I've come across this a couple of times. That flash game development is not 'proper' game development when compared to XNA or even Unity. Mentioned here:
Need guidelines for studying Game Development

Also here in some comments : Where to start with game development?

This judgement also befalls java, according to some. Is it because in flash its so easy to draw graphics and to import and add on to the stage any element we want and also because flash needs a 'container program' to run and others don't?

But flash is by far way easier to 'distribute' than any other of those mentioned above. Maybe except for iphone or android games.

sentences:
OpenGL App not setting cursor position appropriately I have written a small application using OpenGL, and have implemented some rudimentary camera controls. Unfortunately, I cannot get the application to set my cursor position correctly. The cursor is never set to where I tell it to go, so my application just reacts to where the cursor is on my entire screen.

I first attempted to use GLFW, and when I saw that I couldn't set the cursor appropriately, I decided to try SFML. Neither one works.

I'm on an Arch Linux install with a Gnome desktop. I've been trying to figure this out for a few days now to no avail.

The relevant code is as follows:

sf::Vector2i cursor_pos = sf::Mouse::getPosition(*window);
sf::Mouse::setPosition(sf::Vector2i(1280/2, 720/2), *window);

This gets called every frame inside a function that messes with some matrices.

I also set the cursor position at initialization.

Any hints or advice would be greatly appreciated.

sentences:
How should bullet reflections be implemented? Im working on a tank game where bullets are relected off of walls.  The formula for a relfection is r=d−2d⋅n∥n∥2n where d is the incoming vector and n is the normal of a wall.  My bullets stick to the walls and then "bounce" off at the corners; an undesirable effect.  Im honestly questioning my formula implementation at this point.
func collision():
    for i in get_slide_count():
        var collision = get_slide_collision(i)
        if collision.collider.is_in_group(globals.wall_group):
            var normal = collision.normal
            velocity = velocity - ((2 * velocity.dot(normal)) / normal.length_squared()) * normal
            rotation = velocity.angle() + PI

if i use the is_on_wall function and simply negate the velocity this does produce a bouncing effect but not a correct one.  I still need the normal.
I orignally used rigid bodies as seen in the image.  But i have switched to kinematic bodies.

sentences:
Unity 3D Move Object with RigidBody I have added RigidBody component as well as Mesh collider to an object moved with keyboard. I know that it the object will go through another (with RigidBody and Mesh collider too) if I use transform to move the object. Could you give me example of code how to move an object with RigidBody. Here is my current code (still using Transform)

if (Input.GetKey(KeyCode.RightArrow))
{
    character.transform.position += Vector3.right * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.LeftArrow))
{
    character.transform.position += Vector3.left * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.UpArrow))
{
    character.transform.position += Vector3.forward * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.DownArrow))
{
    character.transform.position += Vector3.back * speed * Time.deltaTime;
}

sentences:
How to apply numerical integration on a graph layout I've done some basic 1 D integration, but i can't wrap my head around things and apply it to my graph layout.
So, consider the picture below:

if i drag the red node to the right, i'm forcing his position to my mouse position
the other nodes will "follow" him, but how ?

For Verlet, to compute the newPosition, i need the acceleration for every node and the currentPosition.
That is what i don't understand.

How to i compute the acceleration and the currentPosition ?

The currentPosition will be the position of the RedNode ? If yes, doesn't that means that they will all overlap ?

http://i.stack.imgur.com/NCKmO.jpg

sentences:
How to make proper billboarding trees ? (Unity3D & C#) I make a 2.5D first person game like Doom, Duke Nukem 3D, and Daggerfall used to be. I'm new to Unity and game development in general, so I'm sorry if this seems obvious to some people.

What I want is to have the 2D sprites of the trees to billboard smoothly in the same way they did in the old games.
Take a look at this video to understand what I mean: https://www.youtube.com/watch?v=xPwGXf8y6XA&t=277s

I've already tried the proposed solution at http://wiki.unity3d.com/index.php?title=CameraFacingBillboard and it doesn't work the way I want, it's uncanny and off-putting the way it works.

Please help me.

sentences: how do I instantiate something with only the y axis rotation matching the instanciators y rotation i'm making a swimming mechanic for my game and i need to instantiate the swim camera under neath the fps player when it hist the water. no mater what I try the swim cam wont have the same y rotation as the fps when its instantiated, and vice versa. what am i doing wrong? here is the scriptInstantiate(swim, new Vector3(transform.position.x, transform.position.y -2, transform.position.z), rotation: transform.rotation=Quaternion.AngleAxis(0,0,0));

sentences:
OpenGL dynamic font glyph cache library I have begun work on an OpenGL application (all on my own and with little knowledge) and started with FTGL, rendering true type fonts, which, with alot of text has a great impact on frames per second.

I believe that to overcome this limitation one needs to generate a font atlas and save glyphs to opengl textures which are then drawn by shaders.

I have done a search of github for such a library and found several, a few of which are incomplete (and by their own admission have memory leaks)

I am looking for, and hoping that one of you can recommend, the most stable opengl font library that you preffer and does the aforementioned. I also need unicode support.

Or a guide to help a noob like me achieve this

Thankyou for reading

sentences:
Rotate around the centre of the screen I want my camera to rotate around the centre of screen and I'm not sure how to achieve that. I have a rotation in the camera but I'm not sure what its rotating around. (I think it might be rotating around the position.X of camera, not sure)
If you look at these two images: http://imgur.com/E9qoAM7,5qzyhGD#0

http://imgur.com/E9qoAM7,5qzyhGD#1

The first one shows how the camera is normally, and the second shows how I want the level to look when I would rotate the camera 90 degrees left or right.
My camera:

public class Camera
{
    private Matrix transform;
    public Matrix Transform
    {
        get { return transform; }
    }

    private Vector2 position;
    public Vector2 Position
    {
        get { return position; }
        set { position = value; }
    }

    private float rotation;
    public float Rotation
    {
        get { return rotation; }
        set { rotation = value; }
    }

    private Viewport viewPort;

    public Camera(Viewport newView)
    {
        viewPort = newView;
    }

    public void Update(Player player)
    {

        position.X = player.PlayerPos.X + (player.PlayerRect.Width / 2) - viewPort.Width / 4;

        if (position.X < 0)
            position.X = 0;

        transform = Matrix.CreateTranslation(new Vector3(-position, 0)) *
            Matrix.CreateRotationZ(Rotation);

        if (Keyboard.GetState().IsKeyDown(Keys.D))
        {
            rotation += 0.01f;
        }
        if (Keyboard.GetState().IsKeyDown(Keys.A))
        {
            rotation -= 0.01f;
        }
    }
}

(I'm assuming you would need to rotate around the centre of the screen to achieve this)

sentences:
C++: Setup the basic Update function in different classes which all derive from GameObject Im working on a little game-framework in c++. Currently i have a (base)class called "GameObject" from which all future in-game objects will derive from.
Class enemy will be class Enemy : public GameObject and class Player will be class Player : public GameObject

This way, i can store all my gameobjects in an array of type GameObject and manage them easily and they will all have the basic game-object variables such as x/y/z coordinates, scale, etc. So what i eventually want is to be able to quickly create a new game-object by creating a new class and then simply inheriting from GameObject.

Know how in Unity every game-object monobehaviour script has a start function and an update method? That's what im trying to recreate, and my teacher has been able to recreate in the past using Java. (except he simply used the constructor instead of a "Start" method)

Here is where my problem comes in: I can't find a way to call the Update() method from all those classes that derive from GameObject. My teacher was able to get this working in a small java framework by putting this for-loop in the main-loop of the program:

if(_gameObjList.size() != null){
   for(int i = 0; i < _gameObjList.size(); i++)
   {
     _gameObjList.get(i).Update();
   }
}

Now im pretty sure that this is the correct c++ equilavent of that code:

if(_gameObjList.size() > 0){
   for(unsigned int i = 0; i < _gameObjList.size(); i++)
   {
     _gameObjList[i].Update();
   }
}

In the GameObject class of that java program there's an empty Update() method, which, if removed will break everything, and offcourse in every class that derives from GameObject there's also their own Update() method which for some reason gets called too, but does not give an error if removed. So this way all Update() methods from all classes that derive from GameObject get called even though from the code, it looks like it's just calling that Update() method from the GameObject class itself and not the classes that derive from it.

So now i wish to use this magic in my c++ program but it doesn't work. It just calls the Update method from the GameObject class and does nothing else :/ It won't call the Update functions of the classes that derive from it.
So perhaps there are any sorcerers online on this forum who can explain this magic to me and how to use it? Or perhaps another way of executing all Update functions without calling all of them specifically?

Sidenote: if in the java program, i change the name of the Update() function in one of the classes that derive from GameObject, it won't be called/executed but doesn't give me any errors either. That specific object just won't be updated anymore.

Sorry for writing all this text, i just want to be as clear as possible.

sentences:
Best way to blend colors in tile lighting? (XNA) I have made a color, decent, recursive, fast tile lighting system in my game. It does everything I need except one thing: different colors are not blended at all:

Here is my color blend code:

return (new Color(
       (byte)MathHelper.Clamp(color.R / factor, 0, 255),
       (byte)MathHelper.Clamp(color.G / factor, 0, 255),
       (byte)MathHelper.Clamp(color.B / factor, 0, 255)));

As you can see it does not take the already in place color into account. color is the color of the previous light, which is weakened by the above code by factor. If I wanted to blend using the color already in place, I would use the variable blend.

Here is an example of a blend that I tried that failed, using blend:

return (new Color(
       (byte)MathHelper.Clamp(((color.R + blend.R) / 2) / factor, 0, 255),
       (byte)MathHelper.Clamp(((color.G + blend.G) / 2) / factor, 0, 255),
       (byte)MathHelper.Clamp(((color.B + blend.B) / 2) / factor, 0, 255)));

This color blend produces inaccurate and strange results. I need a blend that is accurate, like the first example, that blends the two colors together.

What is the best way to do this?

Update:
I noticed that the reason simply adding them together and the above isn't working is because the light was spreading onto itself and blending with itself. I am going to try and prevent this by writing the light spread onto one array, a temporary one, not using blend at all, only using the first method. After each light is finished with the recursion process I'll draw it to the main one using a custom pixel shader that will blend the light together properly. This may or may not solve my problem.

sentences:
The Pixel Shader unit expects a Sampler configured for default filtering to be set at Slot 0 [...] I don't understand this error. The full output being :

  The Pixel Shader unit expects a Sampler configured for default
  filtering to be set at Slot 0, but the sampler bound at this slot is
  configured for comparison filtering.

Here is how I create the sampler state.

// Skybox sampler description
D3D11_SAMPLER_DESC skyboxSamplerDesc;
ZeroMemory(&skyboxSamplerDesc, sizeof(D3D11_SAMPLER_DESC));
skyboxSamplerDesc.Filter = D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
skyboxSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
skyboxSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
skyboxSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
skyboxSamplerDesc.MipLODBias = 0.0f;
skyboxSamplerDesc.MaxAnisotropy = 16;
skyboxSamplerDesc.ComparisonFunc = D3D11_COMPARISON_EQUAL;
skyboxSamplerDesc.MinLOD = 0;
skyboxSamplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

// Create the skybox texture sampler state
hr = g_d3dDevice->CreateSamplerState(&skyboxSamplerDesc, &g_SkyboxSamplerState);
if (FAILED(hr)) return false;

The bindings.

ID3D11SamplerState* samplerStates[2];
samplerStates[0] = g_SkyboxSamplerState;
samplerStates[1] = g_PixelDepthSamplerState;
g_d3dDeviceContext->PSSetSamplers(0, 2, samplerStates);

HLSL side.

SamplerState sbSamplerState : register (s0) {
    Filter = MIN_MAG_LINEAR_MIP_POINT;
    AddressU = CLAMP;
    AddressV = CLAMP;
    AddressW = CLAMP;
    ComparisonFunc = EQUAL;
};

sentences:
How many Fringe/Base layers in a 2D map editor? I'm creating a highly flexible 2D tile-based map editor in XNA to make some of my future projects easier (will work for side-scrollers and top-down games). This editor can work with any sized tile.

This editor is based on a standard system. It has pre-determined layers such as Base, Fringe, and Collision. However, I've run into a bit of a problem. I don't know how many Fringe layers to use.

I'll be working with fairly detailed tilesets and will want enough Fringe layers to be able to render a wide variety of fairly complex scenes (e.g., forests with lots of trees overlapping).

I'm also considering having multiple Base layers to enable things like a player walking both over and under a bridge.

So my question is this: Is there a "right way" to approach this situation, and if so, what is it? Just lots of Fringe and Base layers? If you were a map editor, how would you expect/want this situation to be approached?

Also, while I have this question here, is storing layered maps in 3D arrays a good way to go about things? Meaning the first level is an array of layers, the second is an array of tile columns within the layer, and the third is the array of tile rows within the column.

sentences:
How do I fix this unintentional chromatic aberration on a lightmap? Some strange rainbow halos (front and left) appear after computation of a lightmap for direct light. The formula is
dot * dot2 / ( dist * dist ) * dl->intensity

with gamma correction, lightmap is computed as vec3_t and ultimately cropped to 3 bytes. However, brightness of the region in question fit into 255 nicely, and even calculating in byte instead of float beforehand - result in just a subtle "oil painting" effect and does not produce such artifact across entire image.
My best guess is how this artifact appear from base change in a floating point math, but I don't know for sure nor do I understand what exactly is happening.

sentences:
Cuda API to render using Physically Based Rendering (PBR) in OpenGL-ES based project I need to develop a OpenGL-ES based application to render a model using Physically based Rendering (PBR).
Do I need to use Cuda API to render the computation intense PBR rendering?
Is there any performance advantage of using CUDA in the OpenGL-ES project for PBR?

sentences:
Adding a new highscore before or after an equal score? I'm making a highscores list for my 2048 replica. An entry in the list consists of a name and a score (e.g. "John" and 2100.) When I add a new entry, the code runs through the list and inserts the new entry when the score for the new entry is greater than the currently indexed entry. So imagine this list:

Roman   17000
Sergei  12500
Dean    8000
Andrew  1400

If John was inserted into the list, the new list would look like:

Roman   17000
Sergei  12500
Dean    8000
John    2100
Andrew  1400

The question is, what do I do when inserting the entry for "Steve" whose score is 8000. Does he go before or after Dean? Is there a convention for this?

sentences:
State Machine class vs function pointers What do you guys recommend to use?
A State Machine with function pointers or classes?

Or, in which case one would be better than the other one?

At work we use the state machine with function pointers only and I've never tried to use one with classes before.

sentences:
How can I call Schedule() on interface that inherits from IJob So I have a voxel terrain engine, and I have an interface that all meshing jobs should inherit from. That looks like this (simplified from the actual):
public interface IMesherJob : IJob
{
    VoxelDataVolume<byte> VoxelData { get; set; }

    NativeArray<MeshingVertexData> OutputVertices { get; set; }
    NativeArray<ushort> OutputTriangles { get; set; }
}

One example of a meshing job is marching cubes, which looks like this: public struct MarchingCubesJob : IMesherJob
So here's my question: If I have a reference to an IMesherJob, can I somehow call Schedule on it? If I have a reference to MarchingCubesJob, I can call Schedule on it:
This works:
MarchingCubesJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64)

But this does not work:
IMesherJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64);

I noticed that Schedule() is an extension method for T where T : struct, IJob so that might be interfering with it, but it should still work because IMesherJob inherits from IJob

sentences:
Unity C# Array Scripting! I was just trying and make a simple 2D game. I have a simple circle sprite (red, green and blue). These circles fly upwards with my scripting as shown below:-

public class Direction : MonoBehaviour {
    public GameObject[] ballons;
    public float increase;
    public float timeInterval;
    public float timeForGetGo;
    public float increaseInterval;

    public float startTime;
    public float timeForNextSpawn;
    public Transform instantiatePos;
    void Start () {;
        StartCoroutine (direction ());

    }

    void Update () {
        increase += increaseInterval;
        direction ();
        Instantiater ();
    }

    IEnumerator direction (){
        while (true){
            foreach (GameObject gameObjects in ballons) {
                gameObjects.transform.position = new Vector3 (gameObjects.transform.position.x, gameObjects.transform.position.y + increase, 0f);
                yield return new WaitForSeconds (timeInterval);

                }
                }

So, instead of making them fly with one script by one script, which I normally do, I tried to make array of these gameObjects and make them go upwards. **It worked great!** But, I have a problem. I want these upward going circle to instantiate but when I instantiate them, they won't go upwards as they aren't in the list of arrays I put earlier as in:-

public GameObject[] ballons;

in first line in that script.

So, as in conclusion, my problem is the instantiated objects won't have same property coz the script is attached to another gameobject and not in the original gamobject itself. Any ideas?

sentences:
What are the usual tools for importing models and animations? I'm a total noob with regard to game programming (though not a noob to programming) and I'm using pygame + opengl to do some experiments with a little game I've been thinking of.

I've been trying to import OBJ files into my pygame OpenGL "game", but there's apparently different formats of OBJ files, and writing a loader is a fairly nontrivial process. At least from my experience, which is not too large.

So I guess my question is: What do people generally use in the industry to read 3d model files? What about animation? Is there a place I can look into to understand?

Thanks,
Marcelo.

sentences:
unity and maya - how to export/import fbx animation with rootmotion and non-rootmotion clips? I've started learning about and playing around with animations in Unity and I've installed the Basic Motions Pack by Kevin Iglesias. I wanted to know how they work and to see if I can modify them so I've looked at the animation files which are .fbx. The animation hierarchy in Unity looks like this

where BasicMotions@Walk01 is the in-place animation and [RootMotion] is the root motion variant which has velocity. I've looked into what root motions are and I think I've grasped what they are, but here's where things have gotten interesting.
I've imported the BasicMotions@Walk01.fbx into Maya and it looks like this

it has a root joint for root motion and the animation moves the rig in each keyframe. So far so good! I've modified the animation so that it plays in reverse, basically made a sketchy reverse walk animation. Exported it to .fbx with the following parameters

And then opened that in Unity, however when I import the animation and rig it it only has one clip and it's the Root motion clip, and I can't get the non-rootmotion clip.
The Root Transform Position (XZ) Loop match is always red and if I don't bake it into pose the animation functions like the Kevin's RootMotion animations, but I don't know how to get the non-RootMotion clip. What am I doing wrong here?

sentences:
How to handle multiplayer in JavaScript? I'm just doing a bit of research into tech to use for a mobile multi-player game.

It's more an experiment at present so for the moment, the only thing that Players need to be aware of is the other Players.

If this was a typical web application and not a game It'd just have HTTP requests firing all the time -- but since this is a game, performance and accuracy is going to be a problem.

Due to the game being targeted at multiple phone platforms, lets say that the client will be written in JavaScript or a framework based on JavaScript. The server technology is totally open.

Each player will need to make the equivalent of a HTTP post and get only using a faster protocol. The reason for multiplayer being web based is because multiplayer across Bluetooth or other local networking would be too diverse across the platforms and could cause problems.

So the question boils down to whats a good protocol/technology to use for JavaScript multiplayer? Any advice on the server side stuff or does it matter? Any reason I should drop this two-tier architecture and go with direct phone-to-phone connection?

sentences:
Does there exist a library of animations for easing, skewing, bouncing, and squishing? I'm specifically referring to the types of animations that are typical in 2D hand held games on the Nintendo platform, where menus slide in, bounce, squish, etc.

I'm looking for something that is somewhat canned but allows for tweaks. Does something like this exist in any form (don't really care what language or for what targeted platform, I'm just looking for the pure math behind it).

sentences:
Can someone explain me how rayCast works? Im learning libgdx and one of the things that really confuses me its raycasting. I read a tutorial of how to use it and I understand it but I really want to know what's in the back. I searched for the source code of this method.

public void rayCast (final RayCastCallback callback, float point1X, float point1Y, float point2X, float point2Y) {   // FIXME pool RayCastCallback?
    world.raycast(new org.jbox2d.callbacks.RayCastCallback() {
    @Override
    public float reportFixture (org.jbox2d.dynamics.Fixture f, Vec2 p, Vec2 n, float fraction) {
        return callback.reportRayFixture(fixtures.get(f), point.set(p.x, p.y), normal.set(n.x, n.y), fraction);
    }
}, this.point1.set(point1X, point1Y), this.point2.set(point2X, point2Y));

}
How we can see this method calls itself recursively and returns a call to reportRayFixture of the callback variable. The thing that really confused me it's from where the code select the Fixture, and how its checks every fixture. Can someone explain me really how its works.

This its the source code page https://github.com/libgdx/libgdx/blob/master/extensions/gdx-box2d/gdx-box2d-gwt/src/com/badlogic/gdx/physics/box2d/gwt/emu/com/badlogic/gdx/physics/box2d/World.java

I will appreciate it!

sentences:
Am I doing this node.js game loop wrong? I have 2 arrays of JSON objects, actions and game objects.

At any time a user can make a request from the client which can add an action to the actions array.

I have a setInterval(function(){ }, 1000); that runs every second and first loops through all of the actions, doing them in order then dumping emptying the array. Then it for loops (on the length of the array) through all the objects and does change processing such as healing, repairing, consuming resources, updating location of travelling objects, etc.

Each game object is tied to a user and when it is done being modified it will push out to them using socket.io all the data they need for their current view (assuming they are in an active session still).

Is this right? Am I not taking advantage of the node.js event loop as well as I could for this?

sentences:
Algorithm for 2d AI aiming to compensate for gravity In a 2d side-view scenario I have two riflemen aiming at each other. By normalizing the x and y difference they know the direct path to the enemy.

However, gravity will pull the projectiles downwards, so aiming straight for the enemy is obviously useless.

Any interesting ideas for AI-logic when it comes to adding a correction based on world.gravity (which is a "force" in y-pixels per physics tick) and enemy.path (libgdx Vector2 with the X and Y difference to the enemy. Weapon.muzzleVelocity could also be factored in (double, speed in pixels after the shot is fired.

I've been thinking of two things:

Option 1 - Magic numbers

The X distance is multiplied by a magic number (such as gravity) to produce a reasonable close result to an aiming offset. Possibly also factoring in Y-distance, but in most cases, the Y distance should be close to 0.

Pros: Simple, easy to implement, quick, low calculation overhead

Cons: Boring, A bit too arcade for my taste with a very static result, Been done before countless times including by me in previous projects

Option 2 - Firing table

AI trial and error, basically. Each time the unit fires, the X (and Y?) distance of that shot is recorded with the offset used, and the result (hit vs too low vs too high) is registered. Each time the unit fires it'll look up for the closest match to the x-distance to get a rough estimate on aiming offset.

Pros: Units become more valuable as they learn, it's a lot more modern, and it makes sense to me.

Cons: Unit types with low rate of fire will not have much use of their firing table. It's also somewhat complex to implement and will cause a much larger memory footprint as the firing table grows.

For the record, I'm writing this in java/libgdx, mainly targetting the android and HTML5 platforms, but if it turns out to be decent, ports are expected. I'd love to hear other ideas for how a unit can come up with an aiming offset, as well as pros/cons. I have to pick something, and I'm not entirely convinced either of my own algorithms are right for the task.

sentences:
ARBShaderObjects.glDeleteObjectARB vs GL20.glDeleteShader to remove shader? I've created a shader object using ARBShaderObjects.glCreateShaderObjectARBand I'm wondering exactly how I'm suppose to remove said shader.

It seems both ARBShaderObjects.glDeleteObjectARB and GL20.glDeleteShader can do this.

I'm leaning towards ARBShaderObjects.glDeleteObjectARB since I created the shader using the ARBShaderObjects set of classes.

Do both of these work?

In this case is one prefered or different from the other?

Sorry for general LWJGL / OpenGL noobiness.

sentences:
Would like some help in understanding rendering geometry vs textures So I was just pondering whether it is more taxing on the GPU to render geometry or a texture. What I'm trying to see is whether there is a huge difference in rendering two scenes with the same setup:

Scene 1:
Example Object: A dirt road (nothing else)
Geometry: Detailed road, with all the bumps, cracks and so forth done in the mesh

Scene 2:
Example Object: A dirt road (nothing else)
Geometry: A simple mesh, in a form of a road, but in this case maps and textures are simulating cracks, bumps, etc...

So of these two, which one is likely to tax the hardware more? Or is it not a like for like comparison?

What would be the best way of doing something like this? Go heavy on the textures? Or have a blend of both?

sentences:
How to implement curved movement while tracking the appropriate angle? I'm currently coding a 2D top-down car game which will be turn-based. And since it's turn-based, the cars won't be controlled directly (i.e. with a simple velocity vector that adjusts its angle when the player wants to turn), but instead it's movement path has to be planned beforehand, and then the car needs to follow the path when the turn ends (think Steambirds).

This question has some interesting information, but its focus is on homing-missile behaviour, which I kinda had figured out, but doesn't really apply to my case, I think, since I need to show a preview of the path when the player is planning his turn, then have the car follow that path. In that same question, there's an excellent answer by Andrew Russel which mentions Equations of Motion and Bézier's Curve. Some of his other suggestions of implementation are specific to XNA though, so they don't help much (I'm using Marmalade SDK).

If I assume Bézier's Curve as the solution of choice, I'm left with one specific problem: I'll have the car's position (the first endpoint) and the target/final position (the last endpoint), but what should I use as the control point (assuming a square/quadratic curve)?

And whether I use Bézier's Curve or another parametric equation, I'd still be left with another issue: the car can't just follow the curve, it must turn (i.e. adjust its angle) accordingly. So how can I figure out which way the car should be pointing to at any given point in the curve?

sentences:
How can I selectively update XNA GameComponents? I have a small 2D game I'm working on in XNA. So far, I have a player-controlled ship that operates on vector thrust and is terribly fun to spin around in circles. I've implemented this as a DrawableGameComponent and registered it with the game using game.Components.Add(this) in the Ship object constructor.

How can I implement features like pausing and a menu system with my current implementation? Is it possible to set certain GameComponents to not update?

Is this something for which I should even be using a DrawableGameComponent? If not, what are more appropriate uses for this?

sentences:
Skeletal Animation with UV seams I have a UV-mapped model that I am about to animate and load into my game. Like most unwrapped models, I have several UV seams. In order to render the model correctly, I split each vertex along the seam into two vertices whose positions and normals are the same but whose UV coordinates differ. I do the same thing when I have more than one normal associated with a vertex.

This works fine for static models, but now I'm getting into the realm of animation. Technically since the two seam vertices occupy the same position in space they should use the same joint weights and joint IDs. Right now the simple way to do this is to just give them the same joint weights and joint IDs and then skin them separately. But to me this seems very wasteful because there are so many vertices along seams and so there will be many duplicate computations. It gets even worse since I need to render the animated model into the shadow map too.

Does anyone have any thoughts about improving this process? I've considered using something involving OpenGL transform feedback to save the results of the transformed vertices. This would at least help with computing transformed positions once and using the same results in the main render pass and shadow pass, but I still can't think of an elegant way to handle the duplicate computation along UV seams.

sentences:
Input handling with callbacks I have set up a class for input handling that allows me to create key bindings with different key behaviours such as single press action bindings where the action will only happen once if the key is held, and state like actions to make things happen more than once.

In the constructor of the key handler class I pass in the value of the key to bind to and a pointer to a callback function to be called as necessary. My problem comes when I try to pass the pointer to the function in to the constructor since the method I am trying to pass is a member function of my main game class.

I know of solutions that involve making the members static but my problem here is that doing so would require for me to change the signature of every method which has to take the pointer as a parameter and doing so would impact upon the re-usability of my input class for other projects.

Are there any other solutions to this problem that wouldn't involve changing the signature of the methods to accommodate the member function?

sentences:
How to draw a rectangle with a border pixel over a camera/viewport? With this code I intended to visually delimit the complete view of the circuit and the two controlled cars:

draw_rectangle(0,0,1279,719,true);
draw_rectangle(0,720,639,1079,true);
draw_rectangle(640,720,1279,1079,true);

It turns out that only the complete view of the circuit that is drawn directly in the room is correctly delimited (observe the black line of a thick pixel):

Where there should be the rectangle strokes (red line, not necessarily at this thickness):

This happens because of this camera/viewport:

I believe the rectangle is being drawn under the camera/viewport.

What do I need to do to make this rectangle draw over the camera/viewport?

sentences:
How to do offline notifications for Android in Unity3d I am making a game for Android with Unity3d.
I've been looking for a solution to this on the web for a little, but I couldn't find anything suitable:

I want to make my game have offline notifications.Like...I want to set up an alarm that notifies the user at some point in the future e.g.

  "Building complete!"

but the app should not have to be running.

How do I accomplish that?

sentences:
Multilingual data bases for most common words and phrases used in games Games tend to have easy to understand instructions/menus/tutorials and so on, so I was wondering whether...

Are there multilingual data bases, built-in with the most common phrases used in games?

For instance Start, Resume, Play, Pause, Edit Profile, Awards, etc.

Any info is appreciated.

sentences:
What are the tessellation factors Direct3D11? I don't quite understand the documentation but if I was to tessellate a mesh using 3 control points in Direct3D11 with the "tri" domain am I right in thinking that

SV_TessFactor is how many times to split up each edge

and

SV_InsideTessFactor is how many points inside the triangle to create?

sentences:
Computing how fast a vector should go toward certain direction I have two object in space, one has velocity (object A) with fixed magnitude, and one is static (object B).
every timestep, I add to object A's velocity a vector which direction is object A to object B, and then make the length of velocity back again (so after this addition, only angle changed), then I move object A using this new velocity (with its magnitude multiplied by fixed timestep), so at the next timestep, the additive vector will have different angle because object A had moved.
If I keep doing it every timestep, the angle between velocity vector of A and vector that goes from A to B will go toward (small enough) zero.
How do I calculate the magnitude of the additive vector so that the angle will go to zero after x seconds?

sentences:
Java - Trouble with recursion and rectangle placement I am using Android API's and using the RectF class for rectangles. I have a list of blocks that are on the screen at one time. Each block is given a random position, and then I go through all of the tiles previous, to check if there is an intersection. If there is, it recursively calls the method again to get a new random position and check it against all the other tiles.

I feel like this should work perfectly, except for one thing that may be affecting it. Since recursion opens up so many instances of a method, it needs to finish them off, so I don't know if the rectangle is just being drawn at the initial position, and the rest of the calls are doing nothing?

I have tried quite a few different methods and this seems to be the closest, but something weird is happening and I cant figure it out.

Start method:

    private void start() {

    timerTask = new TimerTask() {
        @Override
        public void run() {

            if(Game.STATE == Game.State.Playing) {
                removeFailedTiles();

                Random deathRate = new Random();
                int i = deathRate.nextInt(100);
                if(i % 10 == 0) {
                    System.out.println("Death tile");
                    activeDeathTiles.add(new DeathTile(getRandomPosition()));
                    //System.out.println(activeDeathTiles.toString());
                } else {
                    System.out.println("Normal Tile");
                    activeTiles.add(new Tile(tileLifetime, getRandomPosition()));
                }

            }

            if(Game.STATE == Game.State.Lost) {
                timerTask.cancel();
                timer.cancel();
            }
        }
    };

    timer.schedule(timerTask, 1000, tileDelay);

}

Get Random Position method:

private RectF getRandomPosition() {
    int screenWidth = (int) Game.SCREEN_WIDTH;
    int screenHeight = (int) Game.SCREEN_HEIGHT;

    RectF pos = new RectF();

    Random random = new Random();
    int maxX = (int) (screenWidth - (Tile.TILE_WIDTH * 1.5f)), minX = (int) (Tile.TILE_WIDTH / 1.5f);
    int maxY = (int) (screenHeight - (Tile.TILE_HEIGHT * 1.5f)), minY = (int) (Tile.TILE_HEIGHT / 1.5f);

    pos.top = random.nextInt(maxY - minY) + minY;
    pos.left = random.nextInt(maxX - minX) + minX;
    pos.bottom = pos.top + Tile.TILE_HEIGHT;
    pos.right = pos.left + Tile.TILE_HEIGHT;

    if(isOverlap(pos)) {
        return getRandomPosition();
    } else {
        return pos;
    }
}

Helper methods:

private List<RectF> getAllTiles() {
    List<RectF> allTiles = new ArrayList<RectF>();

    for(RectF t : activeDeathTiles)
        allTiles.add(t);
    for(RectF t : activeTiles)
        allTiles.add(t);

    return allTiles;
}

private boolean isOverlap(RectF position) {

    for(RectF r : getAllTiles()) {
        if(RectF.intersects(position, r)) {
            return true;
        }
    }

    return false;
}

If someone could please help me figure out what is going wrong here that would be stellar!

sentences:
Java heart based health mechanic so I've made a basic game in java w/ LWJGL 2 and Slick. Right now Im working on the hud and health system. I'm kindof trying to get a minecraft like health system, 15 hearts for health,but I want the health to change from level to level.
Right now Ive got this:

    int z = (int) (Math.floor(hp/15)); // this is how many hearts are being drawn
    for(int k = 0; k < z; k++){
        if(z >= 15){
            z = 15; // here it says that it can't draw more than 15 hearts
        }
        g.drawImage(heart, x + k * 32, y); // it draws the hearts with some distance inbetween each heart
    }

I'd be happy if I get some suggestions on how could I add half a heart "mechanic", like if I have 30 max health and 15 hearts (allthought rightnow I have 200 hp, I wanna work with bigger numbers :P) that would mean that If I had 15 health it should draw 7 full hearts and 1 half heart. I don't exactly know how to do that. If you can please do help :D. Thank you

sentences:
Flip sprite vertically AND horizontally? In Microsoft.Xna.Framework.Graphics.SpriteEffects there is the possibility to flip a texture horizontally or vertically before rendering. But can one do both at the same time?

When I use: spriteEffect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; with spriteEffect being a parameter of the particle. The method spriteBatch.Draw(spriteSheet,
                        currentPositionForDraw,
                        sourceRectangle,
                        currentColorMultiplied,
                        currentRotation,
                        currentOriginForDraw,
                        Temp.delta,
                        spriteEffect,
                        0); does not draw the particle flipped on both axis.

sentences:
Does using [STAThread] with XNA have any negative implications? I'm working on a game in XNA, which has an inbuilt level editor. To facilitate this I want use the FileOpenDialog from Winforms. I followed the instructions as per this answer. This involves setting the [STAThread] attribute on my Program class.

Does using STAThread have any negative implications? Meaning will it cause worse performance or limit me in some way?

sentences:
OpenGL gradient banding on Samsung Galaxy S2 Android phone I've got a live wallpaper out on the market which uses OpenGL to render some basic shapes and a flat plane.  The simple lighting creates a gradient effect across the plane, which looks fine on most devices.  The Samsung Galaxy S2 series seems to have some trouble rendering the gradient, though, as you can see in this screen shot:

The color banding looks awful, especially compared to this screen shot from an Incredible:

I'm using a 565 EGL config in both cases, so I believe this is just a display issue with the GS2 devices.  Can anyone confirm this suspicion?

Is there any solution to the banding?

sentences:
Recognize pattern in 3D building environment I'm currently developing 3rd person building game (as bacheleor thesis). I need to recognize constructed patterns co I can mark corresponding structure as some building (so player can start using that building).

I have folowing rules:

3 types of building blocks (all based on cube) (and in future there will be more types)
any block can be scaled up to k multiple in each axis (k = 20)
blocks can be rotated by any axis (but stays in 3D grid)

  Problem definition:
  4 cubes of base size (1,1,1) in a grid 2x2 should be equivalent to 1
  box size (2,2,1), so all possible variants (mainly different in rotation) could be evaluated as valid pattern construction.

I expect that my patterns will be up to 30x30x30 multiple of base size.

For example, I'd like to recognize structure like this: (currently placed in level by hand)

Size is 21x21x22 and it is constructed from multiple objects.

As a limitation, I will border pattern search from exact point (lets say control console for that structure). Current limitation constant is around 50x50x50 multiple of base cube. (Limit is subject to change based on answers here.)

I searched over 20hrs and result was only papers to recognize 3D structure from 2D image or recognize exact structure in 2D.

  My problem is that with growing K( each X,Y,Z) there is exponencially growing number of structures, which should be accepted as correct pattern construction.

  Question: What algorithm (+ heurestic) should I use?

EDIT: following 3 images contains visualization of structures, that are considered as correct variant of pattern at image 4, thus they should be found and accepted.

All together has same final shape (and has same material at same places). I simplified the problem only to 2D shape, but extending in 3D space is obvious.

Thank you for all answers / comments.

sentences:
Ray tracing - texture and phong lighting Other questione releated to my ray tracer implementation for iPad.

If I have a polygon that has a texture and a material, how do I calculate the color using Phong lighting model? Is the texture used in substitution of some of the component (diffuse?)? Or if there's a texture I need to just ignore the material and get only the texture color?

sentences:
Convert a one-player client to a hotseat I'm making a card game (inspired by Dominion, Hearthstone, Gwent, and others). The way it's set up now, it has a player manager that handles a player's resources and hand of cards, while I have a game manager that handles anything else. At the moment it is set up so that behind the scenes there really is just one player, while the opponent is actually the game manager moving cards around with no regards for the rules of the game, using information sent over the network to mirror what the real opponent is doing at their computer. (I don't care about cheating. I'm not planning to go big; I just want to be able to play and test the card game itself with friends across the country.)

However, I would also like for there to be a hotseat variation on this game. In other words one that is played by two people on one computer. I don't know if it would work out in practice. Things like the length of turns and how much a player can do during the opponent's turn isn't quite fixed yet (note: allowing the players to keep their hands secret from one another is not a concern at the moment).

How would I implement it easiest? Just have one player manager that "switches sides" and swaps out all its fields once a turn is over? That seems ungainly and prone to errors. A second player manager? That would need quite a bit of rewriting of the game manager, and remember that it should still mainly be used online.

sentences:
When importing a character to Unity, textures and meshes don't appear I'm relatively new to Unity, and I'm left with doing this as my last step towards my task - importing my animated character to a game engine and program the movements.

The problems that I have noticed are the missing textures and meshes, you can see in the first picture how it should look like in Blender, and what results I get in Unity:

The apple here doesn't have any holes, I think only one material got imported, and it doesn't look right. Textures are missing, the leaf near the stem is completely filled with gray texture. At least the animations work perfectly...

Download link to my .blend file - https://pasteall.org/blend/6c14ec0d9446404b81251585f83f3551

sentences:
How to Use Images Instead Of Drawing Primitives I want to build backgammon game. I have successfully built the board using primitives  such as lines, triangles and circles. I'm curious whether it's possible to draw the board using images which will make the board look much nicer. Is it possible to have images of triangle and then to put on top of it tiles? How is this achieved?

For example, let's say I have 100x80 image of a triangle and a 100x20 tile image of tile. What theoretically needs to be done in order for the tile image to be shown on top of the triangle image? (each have different colors, and the width of both is the same).

P.S
I'm currently programming this in Objective C for the iOS, but I don't think it's important, as this is more of a general question.

Thanks.

sentences:
Is making a sandbox feasible in Godot/Unity (w/o open world)? I want to make a 3D multiplayer game. It will inherit the basic principles of the MOBA genre: players choose from the variety of characters each having 4-8 unique abilities, then battle it out. I also want some abilities to affect terrain.
I try to keep the concept simple to be able to make this game alone. It would be good if I manage to finish the first playable prototype in no more than 6 months (keeping in mind that I'll be able to work on the game mostly on weekends). Multiplayer AND 3d in themselves make things much harder, so deciding which mechanics to implement and how is essential. Thus I want to make sure I won't have to redo much after I start programming.
To implement the destructible terrain I decided to stick with a Minecraft-ish approach, where everything consists of blocks. The sandbox is a very hard genre in terms of game development, but after doing quick research, I concluded that most difficulties arise from the fact that the game is open-world. This isn't my case. I won't need too many blocks to construct the arenas.
Now I need to come up with the engine I'm gonna use. I like Godot due to its development paradigm, but I'm not sure whether it is a good choice for a game like this. Maybe Unity is the better choice in my situation. Or something else.
Maybe I need to remove some mechanics from the concept to make the development a lot faster.
Can you comment on it? Thanks!
P. S. I have 7 years' programming experience (with Haxe and Python being my main languages) and a good mathematical background. I have been developing my multiplayer game for 3 years now (but it is a 2D game, I have no experience in 3d gamedev beyond the Godot tutorial). It is okay if I need to learn different things before starting to make a game, but I want to make the learning process as effective as possible.

sentences:
Random Coroutine Delay? IEnumerator Shooting()
    {
        //Random Delay
        rand2 = random.Next(1, 4);

        if (!audioSource.isPlaying)
        {
            enemyParticles.SetActive(true);
            particle.Play();
            audioSource.Play();

            rand = random.Next(0, 5);
            Vector3 vel = rb.velocity;

            if (rand == 2)
            {
                if (vel.x < 6f || vel.y < 6f || vel.z < 6f)
                {
                    health.numOfHearts -= 1;
                }
            }
        }
        yield return new WaitForSeconds(rand2);
    }

This script is tied to several enemy objects.
random is initialized in the Start method with a different seed for every object. For some reason that I can't figure out, the delay is not randomized here.
The AudioSource for instance is played for all the enemies at the same time with the same delay every time. I'm not too familiar with coroutines and how they are executed, but I always put the WaitForSeconds() statement at the beginning or end which usually works for me.
Here is the Start method:
//Random Seed
    public int RandomSeed;
    private System.Random random;
    private int rand;

    //Random Delay
    private int rand2;

    void Start()
    {
        //Random
        random = new System.Random(RandomSeed);
    }

Could someone explain why the AudioSources of all the enemy objects are played at the same time when I encounter them? Thanks in advance. :)

sentences:
Why is Y up in many Games? I learned at school that the z-axis is up. It is the same in modeling software like Blender. However in many games the y-axis is up.

What is the reason?

sentences:
Animated lighting in amusement parks What is the best way to handle animated lights on rides in a night time amusement park scene?

Is there a better way that doing lots of emission lights?

At the moment I have been using emission lights, but there could be a lot of them in a park (some are just static lights) and I would also like to animate some of them on some rides.

Best example I could find was from GTA 5:

Video: https://youtu.be/zVj8D0lqgl4?t=146

sentences:
Methods to remove horizontal world slices of voxels in a 3D voxel world I've recently been working on a hobby voxel world recently.

I'm currently interested in ideas or solutions which would enable me to basically step up and down the Y-axis 1 horizontal block slice at a time, effectively making all upper horizontal slices transparent so that I can see objects/terrain/units under the earth.

[A quick visual attempt at describing the problem]

I've done a bit of googling on the subject but perhaps I'm not describing the problem set correctly because I'm unable to find anything satisfactory.

Goals :
1.) I dont' want to have to recreate the chunk meshes across the entire world everytime I step up and down the Y-axis blocks. It would destroy performance and probably crash Unity.
2.) Reasonably optimized quick stepping up and down the Y-axis i.e. no perf drops.

I know that a few options must be out there as I've seen examples in other engines and games (Byte56's Age of Goblins tech demo and Gnomoria etc). I'm guessing an algorithm via some magic shader math would be perfect.

All ideas greatly appreciated!

sentences:
How to include fur in the exported obj file in Maya? In Maya I use fur to create plants. In my game I want to render these plants with cel shading. I use Wavefront .obj as a file format in my game for the models, but it doesn't seem to include the fur.

Is there a way to export the fur (as vertices) with the model into the obj file? Generating the fur at runtime is a bit CPU expensive for the platform.

sentences:
How to stop movement from moving multiple spaces when a directional key is pressed I am making a 15 piece puzzle game and having difficulty making my sprite move one tile at a time, when i initially press the left key the sprite moves once, but after that the sprite moves multiple tiles after i press the keys again, instead of moving one tile like it should. Eventually this also messes with the sprites and some of them disappear. The code that i use to determine movement is:

if (positionx16 - positionx1 == 200 && positiony16 == positiony1)
{
    canswapleft1 = true;
}

if (oldState.IsKeyUp(Keys.Left) && newState.IsKeyDown(Keys.Left))
{
    if (positionx16 > 0 && canswapleft1 == true)
    {
        positionx16 += -widthoftile;
        positionx1 += widthoftile;
        canswapleft1 = false;
    }
}

The positionx16 is the X position of the player controlled tile, and the positionx1 referes to the X position of the 1st tile, this was repeated for each tile.

sentences:
Application.OpenURL not working I have a public void

Public void patreononclick(){Application.OpenURL("http://www.patreon.com/HubakaGs");}

Which supposed to open my patreon page when a button is tapped.
But when i tap the button in the built application, nothing happens.
I have assigned the function to the On Click() section of Button (Script).
I am building the game for android patform and i use Unity 2017.1.0p4 Personal.
How can i make the button to function properly?

Update:
I changed the function to
public void patreononclick(){
        Debug.Log ("the game should open patreon");
        Application.OpenURL("http://www.patreon.com/HubakaGs");
    }
But when the button is clicked, there is no message at the console.

sentences:
How can I check if component is enabled? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraInformation : MonoBehaviour
{
    public string currentCameraState;

    // Start is called before the first frame update
    void Start()
    {
        var components = new List<Component>();
        foreach (var component in GetComponents<Component>())
        {
            if (component != this)
            {
                var fullName = component.GetType().FullName;
                if (fullName.StartsWith("Cinemachine"))
                {
                    currentCameraState = component.
                }
            }
        }
    }

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

    }

    private void OnEnable()
    {

    }

    private void OnDisable()
    {

    }
}

At this line I want to assign the string the component status if it's enabled true or false.

sentences: 3D theory before graphics APIs? I'm a software engineer and I'm hoping to move my career towards game development. I'm reading a book right now on 2D using C++/DirectX. When I get into 3D I know I want to do it correctly. For example, I know nothing about 3d space. So if I learn only an API I might know it but I don't know if I can develop an interractive mini 3d world with it. I wouldn't call myself successful just having a rotating crate with the latest shaders etc. My math skills are up to trig/linear algebra and still in college. I know more math is to come. Should I be reading on 3D theory books before picking up on OpenGL/Direct3D, or any other suggestions? I just know an API isn't going to teach 3D game development and don't want to be lost afterward. I'm very book-oriented so that's fine if there's suggestions there too. Thoughts are welcome. Thanks!

sentences:
How to "place" object in a 3d world without overlapping them ? I would like to place object  in a 3d world "like minecraft player can do".

What I'm trying to do is to allow the user to place objects, without overlapping them (like in minecraft you can do).

So if the player try to place an object partially over another, my  game automatically "move and place" the object in the allowed position.

What can be the right approach ?

sentences:
DirectX -- Best version to develop for? Possible Duplicate:
  learning Direct3D 9, 10 or 11?

I'm just starting to learn DirectX, and I was wondering what the best version would be best to develop for. I'm trying DirectX 9 right now, but was wondering if I should use 10 or 11... Which version is the most commonly used version for games nowadays? I want to be able to play my game on most versions of windows... Is DirectX 9 still used a lot now?

sentences:
Correct velocity on collision between two rects I have two moving objects. The objects consist of a velocity vector2, a Rectangle and a vector2 as position (origin in the middle of the rect).

Some rough pseudo code for my collision checking function:

foreach (object1 in objects)
  foreach (object2 in objects)
    intersectionRect = Rectangle.Intersect(object1.Rectangle, object2.Rectangle)
    if (intersectionRect != Rectangle.Empty) // If colliding
      ResolveCollision(object1, object2, intersectionRect) // does nothing currently
    object1.position += object1.velocity
    object2.position += object2.velocity

My problem now is how to do the collision resolution. I need help figuring out a formula to calculate the new velocities of the objects so that they only move as far as they need to not intersect anymore.

I have used google to find a solution, but the most stuff I found was how to do collisions and not how to resolve them.

sentences:
Unable to get accurate y position on terrain to spawn object all I am trying to spawn some crabbies and can't seem to get an accurate y height to spawn.
I have a terrain created with GAIA Pro 2 and have tried a few things to get an accurate y value. When trying to get the y from the terrain data I keep getting a 0 for example :
        //newCrabStartPos.y = mainIslandTerrain.terrainData.GetHeight((int) rayPosition.x, (int) rayPosition.z); //getYPositionFromRay(rayPosition) + 2.5f;

Here is my current implimintation :
   IEnumerator SpawnCrab()
{
    while(spawnedCrabbies <= waveCount)
    {
        GameObject instance = Instantiate(Resources.Load("Whakin_Crab", typeof(GameObject))) as GameObject;
        instance.transform.position = SetStartPosition();

        spawnedCrabbies += 1;
        yield return new WaitForSeconds(spawnRate);
    }
}

Vector3 SetStartPosition()
{

    float minDistanceAwayFromGoal = 10f;
    float maxDistanceAwayFromGoal = 50f;

    float xpos = Random.Range(-1f, 1f) <= 0 ? Random.Range(-minDistanceAwayFromGoal, -maxDistanceAwayFromGoal) : Random.Range(minDistanceAwayFromGoal, maxDistanceAwayFromGoal);
    float zpos =  Random.Range(-1f, 1f) <= 0 ? Random.Range(-minDistanceAwayFromGoal, -maxDistanceAwayFromGoal) : Random.Range(minDistanceAwayFromGoal, maxDistanceAwayFromGoal);
    Vector3 newpos = new Vector3(xpos, 0, zpos);

    Vector3 rayPosition = new Vector3(xpos, 100, zpos);
    Vector3 newCrabStartPos = new Vector3(newpos.x, 15, newpos.z);

    newCrabStartPos = newCrabStartPos + goal.transform.position;
    newCrabStartPos.y = getTerrainDistanceFromRay(rayPosition); // mainIslandTerrain.terrainData.GetHeight((int) xpos, (int) zpos); //getYPositionFromRay(rayPosition) + 2.5f;

    return newCrabStartPos;
}

float getTerrainDistanceFromRay(Vector3 drawFromPosition)
{
    RaycastHit hit = new RaycastHit();

    if (Physics.Raycast(drawFromPosition, Vector3.down, out hit, 100))
    {

        return (100 - hit.distance); // collider.gameObject.transform.position.y;
    }

    return 0;
}

sentences: There is no ".text" after i type guitext in "void update" of "monodevelop" I want to write a text in game scene... but when I type GUIText (in Update()) then dot after that, when I type "t" there is no text to become a GUIText.Text, why?... I'm using Unity 5.6.4(64 bit).

sentences:
How can I build an authoritative server to handle players actions taking into consideration scalability of solution I've started with Unity3D to develop a multiplayer game similar to world of tanks, it's using authoritative server and I was able to sync movements between several clients. I'm using c# and on the networking part using sockets directly.

Currently, I have a hard time understanding how can the server perform operations such as:

Calculate if projectile shot by client A will hit client B
In addition to (1), also to see if the project did hit a static object (rock, metal...)

If we take into consideration that there could be hundred of player simultaneously, how can I approach this on the server side ? I'm looking to build myself from scratch everything in order to have a strong understanding of each puzzle piece.

On the other hand, I understood that there's the concept of headless server which is just the physics engine without rendering, however, this doesn't seem to be a scalable solution.

sentences:
MonoGame - render target drawn below other sprites and in the wrong location This seems like a simple thing but still doesn't work. So I'm trying to draw a scrollable log window (not scrolling yet) by using a RenderTarget2D.

There are several bugs:

The text should be drawn on a black background, now it seems transparent
The text should be drawn in the black box below the game area, now it's drawn in the top left corner
The text appears now on the background color only, it should be drawn over the other sprites

What's wrong with my code? The relevant parts are below.

    private GraphicsDevice graphicsDevice;
    private RenderTarget2D logRenderTarget;

    private bool redrawLogFlag;

    public void Init(ContentManager content, GraphicsDevice graphicsDevice)
    {
        this.graphicsDevice = graphicsDevice;
        logRenderTarget = new RenderTarget2D(
            graphicsDevice,
            10,
            10
        );
        Log.LogWritten += SetRedrawLogFlag;
    }

    private void DrawUiComponents(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["game_area"], Vector2.Zero, Color.White);
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["log_area"], new Vector2(0, Constants.GAME_AREA_HEIGHT), Color.White);
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["stats_area"], new Vector2(Constants.GAME_AREA_WIDTH, 0), Color.White);
        spriteBatch.Draw(Scavenger.AssetManager.TextureMap["help_info"], new Vector2(Constants.GAME_AREA_WIDTH, Constants.SCREEN_HEIGHT - 52), Color.White);

        DrawStats(spriteBatch);
        TryRedrawLog(spriteBatch);
        WriteLog(spriteBatch);
    }

    private void SetRedrawLogFlag(object sender, EventArgs e)
    {
        redrawLogFlag = true;
    }

    private void TryRedrawLog(SpriteBatch spriteBatch)
    {
        if(redrawLogFlag)
        {
            redrawLogFlag = false;

            logRenderTarget = new RenderTarget2D(
                this.graphicsDevice,
                Constants.GAME_AREA_WIDTH,
                Log.Height
            );

            this.graphicsDevice.SetRenderTarget(logRenderTarget);
            this.graphicsDevice.Clear(Color.Black);

            for (int i = 0; i < Log.Count; i++)
            {
                spriteBatch.DrawString(Scavenger.AssetManager.Font12,
                    Log.Entries[i],
                    new Vector2(Constants.LOG_MARGIN, Constants.LOG_MARGIN + i * Scavenger.AssetManager.Font12.LineSpacing),
                    Color.GreenYellow
                );
            }

            this.graphicsDevice.SetRenderTarget(null);
        }
    }

    private void WriteLog(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(logRenderTarget,
            new Rectangle(0, Constants.GAME_AREA_HEIGHT, Constants.GAME_AREA_WIDTH, Constants.LOG_HEIGHT),
            new Rectangle(0, 0, Constants.GAME_AREA_WIDTH, Constants.LOG_HEIGHT),
            Color.White
        );
    }

sentences:
Runtime Storage vs Static Storage Runtime Storage (hardcoded) vs Static Storage (file storage)

  (original question)

  I extended my engines GUI from
  procedural style to object orientated
  style, but I still have to create
  menues, buttons etc. So I got the
  choice to create each menue via a
  class or have a static main class
  which loads menues from a XML file. My
  problem is that I actually like to
  have static and external storage in
  XML because it keeps the code and the
  project clean. But if a GUI Object is
  created e.g. a button I want to have
  delegates/callbacks/events on it, but
  I think that isn't possible with
  loading and creating GUI Objects by
  XML files that only contain ints and
  strings.

The question is when do you hardcode parts of your game and when do you store them locally.

Runtime Storage

+ You safe time while you do not have to write a parser or something similar.

- You lose a lot of flexibility in late development

Static Storage

+ You gain a lot of flexibility in the late development

- You spent a lot of time into a system to read and write, and also handle the storage

sentences: Texture2D ignored by GC I loaded my textures with FromStream method and I noticed a problem that those textures are being ignored by garbage collector. I even nulled them, called dispose on them and tried to force garbage collector - they're still in the memory. Any ideas why this might be happening?

sentences:
Creating a countdown Timer in Unity I want to create a countdown timer in a Unity game I am creating. Up until now my game was running for a specific time but I was using InvokeRepeating to end the game after the set time.

But now I want to display the time left in a GUI text. One approach could be to use InvokeRepeating again but this time call it every second to decrement the timer. With this approach though it would mean do extra calculations for when a minute passes in order to display time appropriately and not just display the whole time in seconds.

Is there a different approach? Does Unity have any timers built in?
Also which is the more efficient method?

sentences:
Java/Android pixel perfect hit detection I am making a game for android which I need hit detection between two objects. The first bitmap I have is a flying superhero, and the second bitmap is anything that he collides with.

The superhero bitmap is created on the fly by rotating the original bitmap between -90 and 90 degrees. As a result of the rotation, the bounding box is much, much larger than the non-rotated version. I have code to detect if the bounding box of the player hits any object, but visually this creates a problem when the object comes in contact with the skewed bounding box.

I need a solution that computes pixel-perfect hit detection between the player and the object, not just the bounding boxes.

I have been searching for the past 5 days for examples, tutorials, code snippets, or anything that could help me, but I haven't found a solution. The solution I'm looking for would be simply one function call similar to public boolean(obstacle theobject), where the obstacle's bitmap. coordinates, width, and height are returned with obstacle.getbitmap, obstacle.getx, obstacle.gety, obstacle.getwidth, and obstacle.getheight. The bitmap of the player is named rotatedbm and has global variables playerx, playery, playerh, and playerw.

I do not wish to implement external game engines or libraries.

I have read much on using int arrays with Bitmap.getPixels, and then comparing the arrays, but I cannot grasp the math behind comparing the arrays nor sorting out alpha values. I cannot afford to stay stuck on this one problem much long for the sake of development.

Thank you

EDIT- This is my implementation of the pseudo code. In the log, 'hit true' is never thrown but 'hit trying' is. Its not working as intended...

public boolean gethit(obstacle second){

        int px,py,ph,pw;

        Bitmap sprite1 = rotatedbm;
        Bitmap sprite2 = second.getgfx();

        px = playerx;
        py = playery;
        ph = sprite1.getHeight();
        pw = sprite1.getWidth();

        int ox = second.obx;
        int oy = second.oby;
        int oh = second.obh;
        int ow = second.obw;

        int [] AABB1bl = {px, py+ph};
        int [] AABB1tr = {px+pw, py};
        int [] AABB2bl = {ox, oy+oh};
        int [] AABB2tr = {ox+ow, oy};

        AABB2bl[0] -= AABB1bl[0];
        AABB2bl[1] -= AABB1bl[1];

        AABB2tr[0] -= AABB1bl[0];
        AABB2tr[1] -= AABB1bl[1];

        AABB1tr[0] -= AABB1bl[0];
        AABB1tr[1] -= AABB1bl[1];

        AABB1bl[0] -= AABB1bl[0];
        AABB1bl[1] -= AABB1bl[1];

        int start_x = AABB2bl[0];
        int start_y = AABB2tr[1];
        int end_x = AABB1tr[0];
        int end_y = AABB1bl[1];

        int ALPHAMASK = 0xFF<<24; // assuming colors are represented as 0xAARRBBGG

        int alpha1;
        int alpha2;

        Log.i("hit", "trying");
        for(int x = start_x; x < end_x; x++)
            for(int y = start_y; y < end_y; y++) {
              alpha1 = sprite1.getPixel(x , y*sprite1.getWidth()) & ALPHAMASK;
              alpha2 = sprite2.getPixel(x + AABB2bl[0], (y+AABB2tr[1])*sprite2.getWidth()) & ALPHAMASK;
              if(alpha1 != 0 && alpha2 != 0) {
                Log.i("hit", "true");
                return true; // you'd probably wish to return after a colliding pixel has been found
              }
            }
        return false;
}

sentences:
How to approach a coloring app? I want to make a coloring app in unity. I don't need flood filling. THe player will select a color and click the shape to fill that color. The app will have designs as shown below:

Here the problem is, design has to be empty with black outline. One way would be to create textures using the jpg of each shape. However, there are thousands of shapes and each can be colored in about 7 colors. So, i will have to create 7 textures for each shape.Is there any way to create model with black outline so that only inner color can be changed?

sentences:
Inventory View Screen Looking to create an inventory screen in Unity, and trying to think of the best way to do it.

My current line of thinking is having a few rows of squares for inventory items that are drag and droppable onto a paperdoll, a la Diablo.  When dragging and dropping on the items, it would update a 3D model of your current playable object with the items.

The menu itself would be easy enough to do with a simple square and a hierarchy of game objects for the items, each responding to mouse hovering over.

The problem I am trying to figure out is being able to render the 3D model on the side.  Granted, this is a nice to have, and not necessarily a need, but browsing the documentation, the only way I can think of accomplishing this is using a render to texture which requires Unity Pro with a separate camera completely out of bounds of the current space.

Anyone have suggestions on how to accomplish this?

sentences:
PyBullet & OpenGL - Rotations are reversed in OpenGL Project description: I am writing a basic game engine to help with my PhD topic on multi-agent learning. I am using PyBullet as the backend physics engine and OpenGL for visual display. I have OpenGL buffers set up to hold the object information such as position(vec3) and rotation(matrix4x4) with rotations being done using Quaternions, but are stored using Euler angles for convenience.
My problem is that when I rotate an object in the OpenGL game world (around any axis), the pyBullet rotation (as seen from the pyBullet GUI) is in the opposite direction and sometime completely off. I must be missing something quiet basic and I apologies if this is a simple fix. I have also provided a video to show the issue that I am having - link to video of error (Link to video):
When I extract the rotation from PyBullet using getBasePositionAndOrientation() and convert the quaternion to Euler angles using pybullet.getEulerFromQuaternion(), the result is the correct vec3, but upon conversion to the rotation matrix pybullet.getMatrixFromQuaternion(), it seems to reverse the rotation direction.
Please see my code below:
'obj = Class BaseSceneObject'
'action = Euler rotation angle in degrees to apply vec3(x, y, z) e.g.(1., 0., 0.) apply +1 degree rotation to x-axis'

'Collect current position and rotation of object and update PyBullet'
# get the rotation - euler angles in degrees vec3(x,y,z)
rot = obj.get_rotation()
# add rotation action (e.g. +1 degree to x = vec3(1., 0., 0.)) and convert to radians
rot = math.radians(rot[0] + action[0]), math.radians(rot[1] + action[1]), math.radians(rot[2] + action[2])
# convert rotation from euler to quaternion
quat = pybullet.getQuaternionFromEuler(rot)
# update position and orientation
pybullet.resetBasePositionAndOrientation(bodyUniqueId=obj.get_rigid_body_id(),
                                         posObj=obj.get_position(),
                                         ornObj=quat)

'Collect PyBullet results and update OpenGL'
# get position and rotation from PyBullet
position, rotation = pybullet.getBasePositionAndOrientation(bodyUniqueId=obj.get_rigid_body_id())
# update object position
obj.set_position(position=position)
# convert rotation quaternion to euler angles
rot_r = pybullet.getEulerFromQuaternion(rotation)
# convert radians to degrees
rot_d = math.degrees(rot_r[0]), math.degrees(rot_r[1]), math.degrees(rot_r[2])
# construct OpenGL object rotation matrix
rot_m_final = numpy.identity(4)
rot_mr = numpy.array(pybullet.getMatrixFromQuaternion(rotation)).reshape(3, 3)
rot_m_final[:3, :3] = rot_mr
# update OpenGL rotation matrix
obj.set_rotation(rotation=rot_d,
                 rotation_matrix=rot_m_final)

Thank you for reading this and I hope that you can help me.

sentences:
Main Camera re-sizing in 2d My UI :

An UI from YouTube video :

Look my camera's size is 10 and his camera's size is only 5. But, my camera's width is larger than height. If you look at scale (x,y,z)=(1,1,1). I tried to change them. But, nothing changes.I tried to change ViewPort Rect then, I am able to change the size of Main Camera. But, look at following image. His ViewPort Rect is 1 by 1 mine also. But, we have differences of width and height.
How to fix it?

sentences:
Could not establish connection with local server process when opening or making Unity project Whenever i try to either create or open a Unity project, I get faced with this error.

Does Unity need a proxy server, because I dont have one. (If so, how do I get one?) And
apparently I need to add some environment variables, (HTTP_PROXY, HTTPS_PROXY and
UNITY_NOPROXY=localhost,127.0.0.1) what values do i add to these?

Unity Package Manager Diagnostics (v0.1.5)

Ran 7 checks

1 succeeded

6 failed

❌ UPM registry reachable (FAIL)
Make an HTTP request to the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Ping UPM registry (FAIL)
Measure the latency of the UPM package registry API

    No successful pings could be made in 0.062 seconds (30 failed)

❌ Ping UPM download (FAIL)
Measure the latency of the UPM package download endpoint

    No successful pings could be made in 0.039 seconds (30 failed)

❌ UPM registry download speed (FAIL)
Test the Internet connection using the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Speedtest.net (FAIL)
Test the Internet connection using Speedtest.net

    Connection error. This could be because a proxy is misconfigured.

✅ HTTP proxy environment variables (PASS)
Detect whether proxy-related environment variables are set (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, UNITY_PROXYSERVER, UNITY_NOPROXY)

    Proxy support has been configured through the following environment variables:
    HTTPS_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    HTTP_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    UNITY_NOPROXY = C:\Program Files\Unity Hub\Unity Hub.exe

❌ UPM health check (FAIL)
Start the UPM process and call its health endpoint

    Server started but did not respond to health requests:
    Error: Invalid protocol: c:

How do I fix this?

sentences:
How to update the monsters in my MMO server using Node.js and Socket.IO Currently I am creating an MMO using Node.js and Socket.IO.

The node server needs to handle connections for players, and also use a loop to update all monsters positions in my game and let them attack players in range.

For the loop I read that you can use process.nextTick or use a child process, which option would be the best choice? What are the advantages/disadvantages of using each?

Also, how many times per second should I run this loop for the monsters?

sentences:
UE4 Gear VR won't "lock to HMD" the problem:

"Is Head Mounted Display Enabled" seems to always return false on samsung Gear VR.
so the camera is not locked to the HMD and it will use the default camera's not the ones for hmd.
the checkboxes under the camera settings are checked.

how to reproduce:
 (osig and nvpack is already
    installed)

create a clean Top Down blueprint
template "Mobile/Tablet", "Scalable
3D or 2D", "No Starter Content"
enable the plugins "Gear VR" and the
"Oculus Library" and disable all
other in the VR section.
in the project settings configure
for andriod, set the minimum and
target SDK version to 19, turn on
"configure the android minifest.xml
for deployment for gear vr".
package the project for "Android
ETC2".

hardware:

Samsung Galaxy S7 Edge (SM-G935F)

Gear VR (SM-R322)

software:

Android 6.0.1

UnrealEngine 4.12

sentences:
Visual Studio IntelliSense & syntax highlighting not recognizing Unity types Frequently when I open a Unity C# script in Visual Studio, the built-in Unity Engine types aren't recognized, so I don't get syntax highlighting or code completion hints for things like MonoBehaviour.

Sometimes if I delete the script and create a new one it works, but lately nothing I do solves the problem.  Is there something I can do?

sentences:
When the motion button is pressed, the shape of the character changes and always goes to the left direction good day. When the motion button is pressed, the shape of the character changes and always goes to the left direction.

Why is this happening and what is the solution?

Pressing two buttons moves to the left and the shape changes.

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

public class PlayerKontrol : MonoBehaviour {

public float karakterHizi = 8f, maxSurat = 4f;
private Rigidbody2D myRigidbody;
private Animator myAnimator;

private bool solaGit, sagaGit;

void Awake () {
    myRigidbody = GetComponent<Rigidbody2D> ();
    myAnimator = GetComponent<Animator> ();

}

void FixedUpdate () {
    if (solaGit) {

        SolaGit ();
    }

    if (sagaGit) {

        SagaGit ();
    }
}

public void AyarlaSolaGit (bool solaGit)
{
    this.solaGit = solaGit;
    this.sagaGit = !solaGit;
}

public void HareketiDurdur () {
    solaGit = sagaGit = false;
    myAnimator.SetBool ("run", false);
}

void SolaGit (){

    float Xdurdur = 0f;
    float surat = Mathf.Abs (myRigidbody.velocity.x);

    if (surat < maxSurat)
        Xdurdur = -karakterHizi;

    Vector3 yon = transform.localScale;
    yon.x = -0.3f;
    transform.localScale = yon;

    myAnimator.SetBool ("run", true);

    myRigidbody.AddForce (new Vector2 (Xdurdur, 0));

}

void SagaGit () {

    float Xdurdur = 0f;
    float surat = Mathf.Abs (myRigidbody.velocity.x);

    if (surat < maxSurat)
        Xdurdur = -karakterHizi;

    Vector3 yon = transform.localScale;
    yon.x = 0.3f;
    transform.localScale = yon;

    myAnimator.SetBool ("run", true);

    myRigidbody.AddForce (new Vector2 (Xdurdur, 0));

}

}

sentences:
character movement data passing on server I am trying to build my first online game using unity with photon, the data transfer between server and clients is implemented but I am facing a great problem; How/What should be transferred to synchronise the movement data?

My game has a lobby and may have as many as 20 people online at the same time if I pass the position of every players to server and then server to clients, I believe the server would be overloaded, wouldn't it?

Hence I think an other way is to pass the movement of characters:
1) only when a player presses a movement key, then pass it to server and other clients,
2) if the player releases the key, then pass the position for validation.
It is workable?
Will there any inconsistency between the clients?

I Hope someone can give me some advice, Thank you!

sentences:
HTML5 Quintus button click doesn't work in local If you try to run this example http://html5quintus.com/docs/ui.html, you'll be able to click the buttons, but you won't if you download a local copy of the example and click the index file (without using a web server).

I know I need to run the code in a web server and not by just double clicking on the files when I have a .json file, but I can't understand the reason why also the click doesn't work (it does not require resource loading).

Maybe there's a simple modify I can apply to the example code or to the libs to make it work... Any suggestion? Thank you!

EDIT

I don't see any JS error:

sentences:
How can I make all the objects to move between the waypoints? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MovementSpeedController : MonoBehaviour
{
    public List<Transform> objectsToMove = new List<Transform>();
    public List<Vector3> positions = new List<Vector3>();
    public int amountOfPositions = 30;
    public int minRandRange, maxRandRange;
    public bool randomPositions = false;
    public bool generateNewPositions = false;
    public float duration = 5f;
    public bool pingPong = false;

    private void Start()
    {
        if (generateNewPositions || (positions.Count == 0 && amountOfPositions > 0))
            GeneratePositions();

        StartCoroutine(MoveBetweenPositions(duration));
    }

    private void GeneratePositions()
    {
        for (int i = 0; i < amountOfPositions; i++)
        {
            if (randomPositions)
            {
                var randPosX = UnityEngine.Random.Range(minRandRange, maxRandRange);
                var randPosY = UnityEngine.Random.Range(minRandRange, maxRandRange);
                var randPosZ = UnityEngine.Random.Range(minRandRange, maxRandRange);
                positions.Add(new Vector3(randPosX, randPosY, randPosZ));
            }
            else
            {
                positions.Add(new Vector3(i, i, i));
            }
        }
    }

    IEnumerator MoveBetweenPositions(float duration)
    {
        for (int i = 0; i < positions.Count; i++)
        {
            float time = 0;
            Vector3 startPosition = objectsToMove[0].position;

            while (time < duration)
            {
                objectsToMove[0].position = Vector3.Lerp(startPosition, positions[i], time / duration);
                time += Time.deltaTime;
                yield return null;
            }

            objectsToMove[0].position = positions[i];
        }
    }
}

Now only the first object in objectsToMove is moving between the waypoints but I need all of the elements of objectsToMove to move between the waypoints. If I try this:
objectsToMove[i].position = Vector3.Lerp(startPosition, positions[i], time / duration);

I will let out of bound index exception because the size of objectsToMove is not the same the size of positions[i]

sentences:
Detecting possible moves in a swap-match game I've been coming up with ideas for how I would go about programming a Bejeweled-like minigame. After some deep thought, I've managed to figure out how to detect matches (including special bonus cases like 4 in a row, 5 in a row, intersections...) without any real issue.

However, one major issue I'm struggling with is this: how do I detect possible moves, and influence the dispensing of new tiles in light of them?

Specifically, I need to be able to:

Detect that there are no moves possible on the board

A legal move consists swapping two adjacent tiles in order to create a match of at least three in a row.

Ensure that there are no moves on the starting board layout

This could be a simple case of "generate a board, check if there are any matches, try again until there aren't" but this seems messy.

Ensure that there is at least one valid move on the starting board

Again, can be achieved by generating boards until true, but anything with more finesse than brute force would be nice.

Optionally (based on game mode) ensure that tiles fall such that there is always at least one valid move on the board.

Once again, brute force simply says "pick some tiles to drop in, check there's a valid move, if there isn't then drop some different ones in until there is".

Ultimately almost all of these can be done through brute force, but I'm sure there must be a better way. At the core, however, I really need help with figuring out how to detect potential moves on the board...

sentences:
Scene2D: How to use Image.setDrawable() I'm trying to change the texture of an Image actor on my Scene2D stage, however I can't seem to get it working. It seems like setDrawable() doesn't really do anything.

For example, this will make the texture of the Image cookie.png:

Image itemImage = new Image(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("cookie.png")))));
itemImage.setPosition(10, 10);
getStage().addActor(itemImage);

However, this will not:

Image itemImage = new Image();
itemImage.setPosition(10, 10);
itemImage.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("cookie.png")))));
getStage().addActor(itemImage);

Am I missing something?

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

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

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

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

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

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

The process would like this:

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

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

sentences:
Rotation of rectangles offsets render position I have an unknown number "Bricks" that must follow a straight, but not always level, path. Each brick is rotated around one central point properly to form a shape of intersecting paths. My problem arises when rendering an image for a rotated brick. By rotating an image the width and height are changed thus altering the relative render point (top left, x/y). I need to find out what render offset would be necessary to make sure each brick is an equal relative distance from the center rotation point. I am using MonoGame (XNA) if that matters, but I don't currently have any code worth sharing (I need to understand this concept before anything else is worth coding). I hope the following image helps to visualize my problem. The example uses 3 bricks but that won't always be the case.
http://i.stack.imgur.com/rO4IT.png

sentences:
16-byte aligned matrix in DirectX9 and D3DX with Havok Physics 2012 I want to ask a question about D3DXMATRIX and D3DXMATRIXA16, and how to use them with Havok Physics.

I'm using Visual Studio 2012 on Windows 8.

I successfully created an instance of hkpWorld, added an hkpRigidbody instance with hkpSphereShape.

The class representing the sphere object has:

hkpRigidBody m_RigidBody;  // Rigidbody
D3DXMATRIX m_Transform;    // Rendering matrix

Judging from the values of m_RigidBody->getPosition(), the simulation is running without problem.
So now obviously I want to render the sphere according to its position and orientation calculated by havok.

This is how I tried to extract the matrix for rendering:

const hkTransform& t = m_RigidBody->getTransform();
t.get4x4ColumnMajor(&m_Transform._11);

Then I happily ran the program, which would break in get4x4ColumnMajor and give me this message through my error report function:

  C:\NightlyJobs\09-07-Sun-01\Source\Common/Base/Math/Vector/Sse/hkSseVector4.inl(
  1831): [0x64211C2F] Assert: pointer must be aligned for SIMD.

I took this to mean that the matrix had to be 16-byte aligned, so I changed

D3DXMATRIX m_Transform;

to

D3DXMATRIXA16 m_Transform;

This time, the problem is still there but isn't 100% reproducible.
Sometimes it runs without problem, sometimes get4x4ColumnMajor fails with above message.

Changing the matrix declaration to

_declspec(align(16)) D3DXMATRIX m_Transform;

did not help either.

So, to summarize my question:

How would I go about extracting the matrix suitable for rendering with DirectX9?
Why do D3DXMATRIXA16 and _declspec(align(16)) seem to be inconsistent about being 16-byte aligned or not, every time I run the program ?

sentences:
Open source component-based game engines? Possible Duplicate:
  Are there existing FOSS component-based frameworks?

What open source game engines with component-based design of game objects do you know? And which best of them? I mean best not in Graphics or Physics, but best in context of Behaviour, Messaging, etc.

This question is the result of inspiration by another question

Thank you!!!

sentences:
How to make an event happen only at the first start of the game? I want to know how to make something happen only once like a tutorial in a game which appears only when you first start your game and then when your game got saved to a further point it never appears again even when you close your game and start again.

I want to give players some amount of gold when they first got their hands on my game ... but I do not want to give them that again and again whenever they restart the game ...

So I want to know how to make something happen only once in a game application..

I hope you get my point ... thanks ..

sentences:
Main game objects as static I'm making a game for Android using Android Studio with Libgdx in Java.
In my game there are main object like Screen, ObjectFactory, SoundPlayer, Painter (Responsible for drawing) and a few more. 'til now I passed them to each GameObject that uses them but then I realized I could just make them static and every GameObject who needs them will just call them statically.
I wonder if I make these main objects static, would it hurt the performance? Because it seems like such a comfortable solution...
Thanks in advance.

sentences:
How to compile with OpenGL ES on Windows? I downloaded OpenGL ES 3.1 sdk here.

But when I tried to run (or compile and run) the executable in "samples" directory, I got the following message:

  The program can't start because libGLESv2.dll is missing from your computer. Try reinstalling the program to fix the problem.

This sounds strange, because the sample program is directly linked with libGLESv2.lib, so it shouldn't even look for dll files.

But when I wanted to install dll files (libGLESv2.dll and libEGL.dll), I got the following error:

regsvr32 libGLESv2.dll

  The module "libGLESv2.dll" was loaded but the entry-point DllRegisterServer was not found.
  Make sure that "libGLESv2.dll" is a valid DLL or OCX file and try again.

So it looks like these dll files are kind of invalid.

Is the problem from my dll files? Or did I miss something in installation process?

sentences:
Applying effects to an existing program that uses BasicEffect Using the finished product from the tutorial here.

Is it possible to apply the grayscale effect from here:

Making entire scene fade to grayscale

Or would you basically have to rewrite everything?

EDIT: It's doing something now, but the whole grayscale seems extremely blue. It's like I'm looking at it through dark blue sunglasses. Here's my draw function:

protected override void Draw(GameTime gameTime)
{
   device.SetRenderTarget(renderTarget);
   graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

   //Drawing models, bullets, etc.

   device.SetRenderTarget(null);
   spriteBatch.Begin(0, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, grayScale);
   Texture2D temp = (Texture2D)renderTarget;
   grayScale.Parameters["coloredTexture"].SetValue(temp);
   grayScale.CurrentTechnique = grayScale.Techniques["Grayscale"];
   foreach (EffectPass pass in grayScale.CurrentTechnique.Passes)
   {
      pass.Apply();
   }
   spriteBatch.Draw(temp,
   new Vector2(GraphicsDevice.PresentationParameters.BackBufferWidth/2, GraphicsDevice.PresentationParameters.BackBufferHeight/2),
   null, Color.White, 0f, new Vector2(renderTarget.Width/2, renderTarget.Height/2), 1.0f,
   SpriteEffects.None, 0f);

   spriteBatch.End();

   base.Draw(gameTime);
}

Another edit: figured out what I was doing wrong. I have Blendstate.Additive in the spriteBatch.Draw() call. It should be Blendstate.Opaque, or it literally tries to add the blank blue image to the grayscale image.

sentences:
How To Rotate A Vector around A Pivot Point In Unity, I'm trying to figure out how to rotate an object around a pivot point.
I found a snippet of code over on the regular stack overflow, but it wasn't working even close to correctly. I have edited it a bit and now its starting to work a little better, but its still pretty off from what I need.
It rotates around the object, but about half way through it jumps to another position. The one half actually rotates with the pivot point, albeit a little bit offset from where it should be, and if you keep rotating it the offset becomes greater and greater. Then the other half is just completely off, still not as bad as the original code though.

Sorry I'm having trouble explaining, here is a GIF to make it easier.

 public Vector3 RotTesta(Vector3 point, Vector3 pivot, Quaternion pointRotation, Quaternion pivotRotation)
        {
            //To rotate an object around an arbitrary point, translate first (the arbitrary offset) then rotate as opposed to rotate-scale - translate

            Vector3 offset = point - pivot;
            Vector3 rotationOffset = pivotRotation.eulerAngles - pointRotation.eulerAngles;
            offset = Quaternion.Euler(rotationOffset) * offset;
            return offset + pivot; // calculate rotated point
        }

This just handles its position, after you call this you would just do transform.rotation = pivotRotation.

If someone could please help me out with this I would be very grateful.

sentences:
Unity3d: "random" transform position values on editor Run into some strange behavior on editor position values.

https://youtu.be/DUBpbOUkbfo

As you can see we have two cube object with colliders on both and rigidbody on parent.
After start play mode parent object editor values sets to some random numbers while transform.localPosition and transform.position is still (0,0,0).

This somehow related to parent-child physics hierarchy but can't understand how.

sentences:
OpenGL ES 2 on Android: native window According to OGLES specification, we have the following definition:

EGLSurface eglCreateWindowSurface(EGLDisplay display,
                                  EGLConfig config,
                                  NativeWindowType native_window,
                                  EGLint const * attrib_list)

More details, here: http://www.khronos.org/opengles/documentation/opengles1_0/html/eglCreateWindowSurface.html

And also by definition:

int32_t ANativeWindow_setBuffersGeometry(ANativeWindow* window, int32_t width,
                                         int32_t height, int32_t format);

More details, here: http://mobilepearls.com/labs/native-android-api

I am running Android Native App on OGLES 2 and debugging it in a Samsung Nexus device. For setting up the 3D scene graph environment, the following variables are defined:

struct android_app {
    ...
    ANativeWindow* window;
};
android_app* mApplication;
...
mApplication=&pApplication;

And to initialize the App, we run the commands in the code:

ANativeWindow_setBuffersGeometry(mApplication->window, 0, 0, lFormat);
mSurface = eglCreateWindowSurface(mDisplay, lConfig,
                                  mApplication->window, NULL);

Funny to say is that, the command ANativeWindow_setBuffersGeometry behaves as expected and works fine according to its definition, accepting all the parameters sent to it. But the eglCreateWindowSurface does no accept the parameter mApplication->window, as it should accept according to its definition. Instead, it looks for the following input:

EGLNativeWindowType hWnd;
mSurface = eglCreateWindowSurface(mDisplay,lConfig,hWnd,NULL);

As an alternative, I considered to use instead:

NativeWindowType hWnd=android_createDisplaySurface();

But debugger says:

Function 'android_createDisplaySurface' could not be resolved

Is 'android_createDisplaySurface' compatible only for OGLES 1 and not for OGLES 2?

Can someone tell if there is a way to convert mApplication->window? In a way that the data from the android_app get accepted to the window surface?

sentences:
Translate extrinsic rotations to intrinsic rotations ( Euler angles ) The problem I have is very frustrating:
I am using the Jitter Physics library which gives Quaternion rotations, you can extract the extrinsic rotations but I need intrinsic rotations to rotate in OpenTK (There are other reasons as well so I don't want to make OpenTK use a Matrix)

GL.Rotate(xr, 1, 0, 0)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(zr, 0, 0, 1)

EDIT : Response to the first answer

Like This?

GL.Rotate(zr, 0, 0, 1)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(xr, 1, 0, 0)

Or This?

GL.Rotate(xr, 1, 0, 0)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(zr, 0, 0, 1)

GL.Rotate(zr, 0, 0, 1)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(xr, 1, 0, 0)

GL.Rotate(xr, 1, 0, 0)
GL.Rotate(yr, 0, 1, 0)
GL.Rotate(zr, 0, 0, 1)

I'm confused, please give an example

sentences:
Unity: running GPU intensive operations in editor mode I have written an erosion simulator that I want to execute from the editor (for generating terrain and such outside of play mode). Unfortunately, when I crank the parameters on my simulation, unity hangs. The UI becomes unresponsive, none of the menus work anymore. However, the process is still running - windows doesn't claim that the program is no longer responding.

The weird thing is that task manager claims that the GPU is sitting at zero utilization while Unity hangs. My (CPU side) erosion code looks something like this (executed via editor script):

    HydraulicCompute.SetFloat("_ErosionRadius", ErosionRadius);
    HydraulicCompute.SetBuffer(_erosionId, "HeightMap", heightMap);
    HydraulicCompute.SetBuffer(_erosionId, "Droplets", _dropletBuffer);

    int threadGroupsX = Mathf.CeilToInt(mapSize / 8.0f);
    int threadGroupsY = Mathf.CeilToInt(mapSize / 8.0f);
    for (int i = 0; i < 100; i++) {
        HydraulicCompute.Dispatch(_dropletId, Mathf.CeilToInt(_dropletBuffer.count / 1024.0f), 1, 1);
        HydraulicCompute.Dispatch(_erosionId, threadGroupsX, threadGroupsY, 1);
    }

When the size of the _dropletBuffer is bigger than 12,000 (32 bytes per droplet), and the heightMap buffer larger than 1024x1024 (4 bytes per pixel), then I run into the aforementioned problem.

I would guess that the issue occurs either because there is a problem with the buffer sizes, or that the frame takes too long and Unity times out.

When I comment out the Dispatch calls Unity is able to allocate and populate the buffers instantaneously (at least it looks really quick). While that doesn't rule out the potential buffer problem, it certainly makes it seem less likely.

So what exactly is the problem here? Is it a memory problem? Or is the frame timing out? Or something else entirely?

Is there a prescribed way to doing this kind of intensive GPU work in the background in editor mode? I've looked at the Job system, but that seems to be CPU side only...

[EDIT]

I have managed to put together the following snippet which always crashes on my GPU (NVIDIA 980ti):

[numthreads(1,1,1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
    for (int i = 0; i < _NumIterations; i++) {
        HeightMap[1024*512 + 512] = 0;
    }
}

When executed as 1 thread group for 1 iteration (_NumIterations = 1), this crashes my GPU driver. I am running on the latest version. I have no idea as to what might be causing the problem, windows event viewer just lists a nvlddmkm error, which apparently means it could be just about anything. It's frustrating to say the least.

sentences:
OpenGL shaders messed up So after a long attempt at DirectX I switched back to good old OpenGL. Now I'm running into this weird problem. My code involves shaders, of course, and drawing a basic cube. But I'm getting this weird shape. I've never seen this before. I was just wondering what could possibly be causing this? Thanks very much!

Initialization:

lightingShader->GenerateVAO();
lightingShader->GenerateVBO();

lightingShader->SetVertices(vertices, sizeof(vertices), GL_STATIC_DRAW);

lightingShader->BindVAO();
{
    lightingShader->AddAttribute(0, 3, GL_FLOAT, GL_FALSE, 3, 0);
}
lightingShader->UnbindVAO();

Rendering:

lightingShader->Use();

GLint objectColorLoc = lightingShader->GetUniformLocation("objectColor");
GLint lightColorLoc = lightingShader->GetUniformLocation("lightColor");

glUniform3f(objectColorLoc, 1, 0.5f, 0.31f);
glUniform3f(lightColorLoc, 1, 0.5f, 1);

GLint modelLoc = lightingShader->GetUniformLocation("model");
GLint viewLoc = lightingShader->GetUniformLocation("view");
GLint projLoc = lightingShader->GetUniformLocation("projection");

glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->View()));
glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->Projection()));

lightingShader->BindVAO();
{
    glm::mat4 model;
    glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));

    glDrawArrays(GL_TRIANGLES, 0, 36);
}
lightingShader->UnbindVAO();

Result:

As you can see, position and color is set fine, but I still get that weird shape.

sentences:
What's the best way to generate an NPC's face using web technologies? I'm in the process of creating a web app. I have many randomly-generated non-player characters in a database. I can pull a lot of information about them - their height, weight, down to eye color, hair color, and hair style.

For this, I am solely interested in generating a graphical representation of the face. Currently the information is displayed with text in the nicest way possible, but I believe it's worth generating these faces for a more... human experience.

Problem is, I don't know where to start. Were it 2007, I'd naturally think to myself that using Flash would be the best choice. I'd love to see "breathing" simulated. However, since Flash is on its way out, I'm not sure of a solid solution.

With a previous game, I simply used layered .PNGs to represent various aspects of the player's body: their armor, the face, the skin color. However, these solutions weren't very dynamic and felt very amateur. I can't go deep into this project feeling like that's an inferior way to present these faces, and I'm certain there's a better way.

Can anyone give some suggestion on how to pull this off well?

sentences:
Click counting and actions based off count So I have a button that is the 'mine' for my incremental game. I would like to track the number of times that it is clicked and be able to do two things:

Have events happen say every 5 clicks.
display the total number of times that is has been clicked.

This is what I have so far:

function addstone(){
        //stone = (parseFloat(stone) + 0.1).toFixed(1);
        //stone = stone + 1;
        var count = 0;
        var totalcount = 0;
            $("input[type='button']").click(function(){
                count = count + 1;
                if(count == 5){
                    stone = stone + 1;}
                if(count == 5){
                    count = 0;
                    totalcount = totalcount + 1;}
                }
                document.getElementById("stone").innerHTML = stone;
    }

So what do I need to do from here. My button calls function "mine1Click" which in turn calls the different resource addition functions. so for "mine1Click" I have this:

function mine1Click(){
    addstone();
    addwood();
    }

function addstone(){
        //stone = (parseFloat(stone) + 0.1).toFixed(1);     TOO LARGE
        //stone = stone + 1;                                TOO MUCH STONE
        var count = 0;
        var totalcount = 0;
            $("input[type='button']").click(function(){
                count = count + 1;
                if(count == 5){
                    stone = stone + 1;}
                if(count == 5){
                    count = 0;
                    totalcount = totalcount + 1;}
                }
                document.getElementById("stone").innerHTML = stone;
    }

function addwood(){
    wood = wood + 1;
    document.getElementById("wood").innerHTML = wood;
}

//function addcopper(){                                     UNIMPLEMENTED

//}

How should I go about this?

sentences:
D3D12 device not supported In the last days, I tried to learn the basics of Direct3D12, using some online resources and tutorials/demos.

After failing to run the demos,
I created a new project in Visual Studio 2015, added the necessary configurations and tried to get the basic initialization done. However, running that project, it fails at the same location, which is D3D12CreateDevice() (builds without any warnings/errors).

The return value I keep receiving is DXGI_NOT_SUPPORTED. I changed my code to enumerate through all adapters of the DXGIFactory, which ended up with the same result (the same applies to the warp adapter).

This is the part of the device creation:

bool created = false;

UINT i = 0;
ComPtr<IDXGIAdapter1> pAdapter;
HRESULT hr = S_OK;
while (SUCCEEDED(m_dxgiFactory->EnumAdapters1(i++, pAdapter.ReleaseAndGetAddressOf())))
{
    DXGI_ADAPTER_DESC1 desc = {};
    pAdapter->GetDesc1(&desc);
    if (SUCCEEDED((hr = D3D12CreateDevice(pAdapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device)))))
    {
        created = true;
        pAdapter.ReleaseAndGetAddressOf();
        break;
    }
}
if (!created)
{
    ComPtr<IDXGIAdapter1> pWarpAdapter;
    CHK(m_dxgiFactory->EnumWarpAdapter(IID_PPV_ARGS(&pWarpAdapter)));

    CHK((hr = D3D12CreateDevice(
        pWarpAdapter.Get(),
        D3D_FEATURE_LEVEL_11_0,
        IID_PPV_ARGS(&m_device)
        )));
}

My system is running on Windows 10, 64 bit and has integrated Intel HD Graphics, as well as a NVIDIA GeForce GT540M, using the Optimus Technology. I did make appropriate changes to the NVIDIA Control Panel, to make the program run on the GeForce 540M, which - according to the Control Panel - supports the DX12 Runtime and feature level 11.0.
The integrated card however, only supports DX11. According GPU-Z, the Intel card only supports DX10 and the GeForce DX11.

I did install all the latest Windows Updates and drivers for both cards.
My guess is, that this is a driver related problem, since I am not able to run the demos either.

Can this be any issue related to the program itself, or should I try to get help from NVIDIA(or Microsoft?) about this problem?

sentences:
Server/Client architecture I have high experience In Java and Networking. Our team have built a effective server that can create thread-pools managing many players. But we have hit a brick-wall. The way our server works is that our clients directly all just connect to the server. The client sends information to the server. For example, Client 004 pressed W. And the server calculates and responds. But here's the problem. What exactly do we send over the data stream? Do we send strings and decode them on the client/server side, or serialize objects? Sadly that question is very opinion based. So let me re-phrase it. What data do we send over the stream? For example, you can use W,A,S,D To move around. Im guessing it should look like this.

User Pressed W > Client sends string saying w to server > Server calculates movement > Server sends string saying player position to player > User updates players position.

But then we have to render other players. So we thought about this

User MPressed W > Client sends string saying W to server > Server calculates movement > Server checks if any others players are in the area > Server saves data of all players and yourself into a string and adds positions and sends to client.

Fair enough. But imagine if the server had to send over information, like the other players clothing, their health, mana, position, current animated frame.

The string might look like this:

"Bob, 12, 321, 391.34, 2914.2, Left, 0, False, null, null, sword, null, null"

Just for one player! To be sent over. The string concept is becoming long and tedious.

I have re-wrote this several times. And I still do find it confusing to understand the question myself.

But to shorten it down. How do I create a system where its a mmo really.

We've created the server, client art. We've payed for a large server with ddos protection. But we don't know what to send over the sockets.

sentences:
Add parabola curve to straight MoveTowards() movement I have some units shooting arrows, right now they move in a straight line to the target. I want them to move like a real arrow, i.e using a parabola curve. However I don't want to use physics.

The math I need to do seems to be beyond me, I've tried to convert 2d solution I found online and other semi-similar solution with no luck.

My current straight movement:

private void Update()
{
    var nextPos = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
    transform.LookAt(nextPos, transform.forward);
    transform.position = nextPos;

    if (Vector3.Distance(nextPos, target) < .1f)
        Arrived();
}

An example of a 2d version I tried to replicate: Here.

sentences:
Can I create a remix of a song & incorporate it into my game music? DJs frequently remix eachothers work and use as they please. Can I as a programmer do similar - remix a song I like and embed it in a game I create without royalty/copyright issues?

Disclaimer: answers will not be considered legal advice, this is just a hypothetical discussion :)

sentences:
How would you recommend I get started with ActionScript 3? I wanted to make Flash games so I bought the book "Flash Games Development with AS3." I did the 'hello, world' program by trace and addChild (or something like that). But the problem was, instead of understanding what I was writing, I was just copying and pasting those lines of code. I felt it wouldn't work that way, and as the book had asked the learners to know at least some Java/Javascript, C#/C++, I didn't go any further.

Now, I want to start again (and yes, I still don't know Java or C programming). What would you recommend for me?

Thanks :)

sentences:
Connecting varying tilemap layouts at possible connection points? I'm building an isometric 3D ARPG in Unity3D, and

I have a tilemap, for example a dungeon.
I have tiles marked where a door could be placed.
I select a random "could-be-a-door" tile from the tilemap.
I "receive" an any shaped room, which could be a prefab, or a generated one as well. This room got tiles marked for door placement as well.

Without editing anything:

how could I easily determine whether this room could be connected to the existing dungeon via the selected connection point? (and of course find the solution if it could be)

by (valid) connecting I mean: only their doors and walls can overlap, but nothing else. (and removing the duplicates, creating the door itself, etc)

(Of course rooms can differ from rectangles)

sentences:
way to implement a menu -pratical i do my first game and already read alot about design strategie, programming style, design .. and so on
theoretically it works perfect but in practice i dont know if i do thinks "right"

i have three classes my main which starts the view
in this i do all my stuff -currently-

it holds an state variable, it has an onDraw method .. and so on

the third class is the game-thread while my game is running, in here are decisions -depending on my current state- what should be done

@Override
public void run() {
    Canvas canvas = null;
    mStartTime = System.currentTimeMillis();
    while (mRun) {
        canvas = mHolder.lockCanvas();
        if (canvas != null) {

            // State Updating State means to manage state transitions, such as a game over, character select or next level.

            switch( mPanel.getModeState() ){
                case Surface.MODE_LOGO_SPLASH :
                break;

                case Surface.MODE_MENU :
                    // the menu

                break;
                case Surface.MODE_LOADING :
                    // loading animation

                break;
                case Surface.MODE_GAME_PLAYING :
                    // game stuff
                                            // GAME START _ RUNNING _ END

                    // Input
                    // AI
                    // Physics

                    // animation
                    //mPanel.animate(mElapsed);
                break;
            }

            // draw everyThing
            mPanel.doDraw(mElapsed, canvas);
            // sound
            // Sound and Video.
            mElapsed = System.currentTimeMillis() - mStartTime;
            mHolder.unlockCanvasAndPost(canvas);
        }
        mStartTime = System.currentTimeMillis();
    }
}

my problem is .. the function onDraw draws everything .. including the menu ?
this sounds for me like bad code because everytime doDraw is executet, i have to check in this function which state i am currently in .. this cost time, dosent it ?

public void doDraw(long elapsed, Canvas canvas) {
    canvas.drawColor(Color.BLACK);

        // currently just gameLayout
        canvas.drawBitmap(background, 0, 0, mPaint);
    gameLayout.draw(canvas);

}

would it not be better do implement an other thread which draws the menu ?
but if so, how can i overlay the menu afer pause the game ?

:\
thanks for help
erwin

sentences:
Detect Collision on Child Object I've created an obstacle prefab. The Prefab has following hierarchy.

The player must die if he collides with Enemy. But It detects collision with parent object. I am also uploading the screen shot of property of enemy(Child Object) and Parent Object.

What should I change to let player collide with Child Object (Enemy).

sentences:
How do I customise automatically-generated script? When you create a script via the Unity editor, it generates a script with some pre-formatted code.

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

public class GenericClass : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

    }
}

When I create a script, I am generally guaranteed to use additional code, such as a namespace or a custom editor. Furthermore, I almost always delete content from the automatically-generated script. Is there a way to change the automatic code generated by Unity?

sentences:
Unity gizmos with custom renderer Im working on a small project to learn the basics of post-processing, shaders and other effects in Unity.
My project is in 2D, so I followed this Brackey's tutorial and this tutorial. The bloom effect did not work for me with the expiremental 2D renderer, so I used a forward renderer instead.
Problem is, now all of my gizmos (including the camera's gizmos) are gone!
Anyone knows what could be the problem? Do I need to set something in the renderer so it will show?

sentences:
Edit existing editor inspector? I want to write custom inspector for one of my scripts. All I want to change is input method for one of the strings to popup (so instead of writing whole string everytime I choose it from premade list of strings, like enums, the list is different for every dialogue). But the thing is it's VERY long inspector with a lot of variables and rewriting everything just for this one input doesn't click for me. Other problem is that this string is nested deep in the serializable object arrays, it look like so

I'm very happy with how default inspector shows all the fields, expect this one string I want to change. I tried playing around with SerializedProperty but no luck.

If it comes to available options I populate public string array with the names in the inspector (every dialogue has different list of participants) so the options should vary between different dialogues. What's the best way to set options?

Is there a way to do it without rewriting whole inpector on your own?

sentences:
OpenGL Bump Map -- Texture artifacts ? I am learning OpenGL (and learning the math behind it) and I'm making a simple OBJ viewer, nothing fancy.
I have diffuse, specular and ambient light/texture working fine and now I am implementing the bump mapping.
I based my code on what I learned with the OpenGL 4.3 Redbook and "Mathematics for 3D game programming and computer graphics" book.

There is probably something I didn't understand correctly, I just hope you will be able to help me :)

Anyway this is the result I get (from a free asset used just for testing -- the results are fine in blender) :

This is the diffuse texture and the bump map :

Fragment shader code :

void main() {
    vec3 normalDirection = normalize(tangenteSpace*(texture2D( bump_tex, f_texcoord ).rgb*2.0 - 1.0));
    //vec3 normalDirection = normalize(mat3(invTransp)*vertNormal);
    vec3 viewDirection = tangenteSpace*normalize(vec3(invView * vec4(0.0, 0.0, 0.0, 1.0) - position));

    float attenuation = 1.0;//none
    vec3 vertToLightSource = vec3(light.position - position*light.position.w);
    float distance = length(vertToLightSource);
    attenuation = mix(1.0,1.0/(light.constantAttenuation +
                    light.linearAttenuation *distance +
                    light.quadraticAttenuation*distance*distance),light.position.w);
    vec3 lightDirection = tangenteSpace*(vertToLightSource/distance);

    //spotlight if spotCutoff <= 90
    float clampedCosine = max(0.0, dot(-lightDirection, normalize(light.spotDirection)));
    float tempMix = mix(attenuation * pow(clampedCosine, light.spotExponent),0.0,clampedCosine < cos(light.spotCutoff * 3.14159 / 180.0));//if outside of spotlight nothing
    attenuation = mix(attenuation,tempMix,light.spotCutoff <= 90.0);

    //should there be any attenuation ?
    attenuation = mix(attenuation,1.0,light.position.w);

    //------------------------------ ambiant light
    vec3 ambientLight = vec3(ambientScene)*vec3(mat.Ka);

    //------------------------------ specular light
    //get the reflection
    vec4 specularMapPixel = texture2D(spec_tex, f_texcoord).rgba;
    vec3 specularColor = specularMapPixel.rgb;
    float shininess = specularMapPixel.a;
    vec3 specularReflection = mix(
    attenuation * vec3(light.specular) * vec3(mat.Ks)* pow(max(0.0, dot(reflect(-lightDirection, normalDirection), viewDirection)),mat.Ns*shininess) *specularColor.rgb,
          vec3(0.0, 0.0, 0.0),
          dot(normalDirection, lightDirection) < 0.0
          );

    vec3 diffuseReflection = attenuation*
    vec3(light.diffuse)*vec3(mat.Kd)
    *max(0.0,dot(normalDirection,lightDirection));

    vec4 Color = vec4(vec4(specularReflection,1.0) + vec4(ambientLight,1)*texture2D(amb_tex, f_texcoord) + vec4(diffuseReflection,1.0)*texture2D(dif_tex, f_texcoord));

    FragColor = Color;
}

Vertex Shader Code :

void main()
{
    //comnpute tangent space
    tangenteSpace[0] = mat3(mv)*normalize(tangent.xyz);
    tangenteSpace[2] = mat3(mv)*normalize(vertNormal);
    tangenteSpace[1] = mat3(mv)*normalize(cross(tangenteSpace[0],tangenteSpace[2])*tangent.w);
    tangenteSpace = transpose(tangenteSpace);

    //position in world space
    position = m * vertCoord;
    f_texcoord = vec2(texCoord);

    gl_Position = mvp * vertCoord;
}

sentences: Animation in top down 2d How is this usually done? Especially when the character might need to use different animations, for instance at his hands and legs. I noticed some skeletal animation solutions but they were only applicable to platformer games. Any ideas?

sentences:
Time granularity for games So far I've always used a time granularity of 1 msec (that's it, 1 millisecond is the atomic time unit).

I'm wondering if this is always fine, or if for some cases (some specific games, game components or platforms) it would be suggested to have a more accurate time unit (on the order of microseconds or, I don't know, hundreds of microseconds).

sentences:
Angle between start and current rotation I'm facing problem of the operations on rotations. I have a wheel with a start rotation of (0, 0, 0). The player has to rotate wheel 270 degrees in Y axis either left or right.
During the rotation slider should indicate progress of the rotation. For example if player rotated 135 degrees in right direction, slider is 50% filled to the right.
The thing is that I'm not sure how to get the value of which the player rotate the object.
For example when I start rotating right my angle changes from (0, 0, 0) to (0, 359, 0). How can I resolve this issue so it knows that change from (0, 0, 0) to (0, 359, 0) means player rotated only +1 degree?

sentences:
Is there any relation between Game Theory and Game Development? I'm a Java programmer interested to learn games on Java, recently I looked on a book on Operations Research written by Wayne L.Winston. There is a topic on Game Theory.

It's truly mathematical. I'm just an app developer, but would that book be helpful to start a game career?

sentences:
How do I create a 3rd person camera? I currently have a camera class set up and have my model/player loaded but I can't get my camera in the correct position by changing the x,y,z coordinates.

I have set up my "game" with a separate class for the model/player and a class for the camera. I am fairly new to XNA and most of what I have already got is from a tutorial from my lecturer.

Here is my player/model class:

public class Player
{
    public Model model;
    public Matrix world = Matrix.Identity;
    public Vector3 position;
    public Vector3 direction;
    public Quaternion rotation = Quaternion.Identity;
    public BoundingSphere collision;
    public float speed = 2f;
    public float moveForwards;
    public float moveLeft;
    public float forward;
    Matrix[] transform;

    public Player(Model m, Vector3 iPos)
    {
        model = m;
        position = iPos;
        direction = new Vector3(0, 0, 1);
        transform = new Matrix[m.Bones.Count];
        m.CopyAbsoluteBoneTransformsTo(transform);

        foreach (ModelMesh mesh in m.Meshes)
        {
            collision = BoundingSphere.CreateMerged(collision, mesh.BoundingSphere);
        }
    }

    public Player()
    {

    }

    public BoundingSphere getSphere()
    {
        return collision.Transform(world);
    }

    public void sampleInputMovement(GamePadState player)
    {
        moveForwards = (player.ThumbSticks.Left.Y / 5);
        moveLeft = (player.ThumbSticks.Left.X / 32) * -1;
    }

    public void update()
    {
        rotation *= Quaternion.CreateFromAxisAngle(new Vector3(0, 0, -1), moveLeft) * Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), moveForwards);

        Vector3 motion = Vector3.Transform(direction, rotation);
        position += motion * forward;
        world = Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(position);
    }

    public void Draw(Matrix projection, Matrix view)
    {
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.Projection = projection;
                effect.View = view;
                effect.World = transforms[mesh.ParentBone.Index] * world;
            }
            mesh.Draw();
        }
    }
}

And here is my camera class:

 public class Camera
{
    Vector3 position;
    Vector3 newposition;
    Quaternion cameraRotation;
    Vector3 targetOffset = new Vector3(0, 1f, -6f);

    public Matrix view = Matrix.Identity;
    public Matrix projection = Matrix.Identity;

    public Camera(Game game, Vector3 xPostion)
    {
        position = xPostion;

        projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, game.GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000000f);
    }

    public void update(Matrix targetWorld)
    {
        Quaternion rotation;
        Vector3 target;
        Vector3 scale;

        targetWorld.Decompose(out scale, out rotation, out target);
        cameraRotation = Quaternion.Lerp(cameraRotation, rotation, 0.15f);
        newposition = Vector3.Transform(targetOffset, targetWorld);
        position = Vector3.SmoothStep(position, newposition, 0.8f);

        Vector3 cameraup = Vector3.Transform(new Vector3(0, 1, 0), Matrix.CreateFromQuaternion(cameraRotation));
        view = Matrix.CreateLookAt(position, target, cameraup);
    }
}

Could someone help me get my camera in the correct position?

sentences:
How can I speed up Unity3D Substance texture generation? I'm working on an iOS/Android project in Unity3D. We're seeing some incredibly long times for generating substances between testing runs. We can run the game, but once we shut down the playback, Unity begins to re-import all off the substances built using Substance Designer. As we've got a lot of these in our game, it's starting to lead to 5 minute delays between testing runs just to test a small change.

Any suggestions or parameters we should check that could possibly prevent Unity from needing to regenerate these substances every time? Shouldn't it be caching these things somewhere?

sentences:
How to texture voxel terrain without triplanar texturing? How can a voxel terrain (marching cubes) be textured without triplanar mapping ?

The goal being to have more artistic freedom.

I think, I could unwrap the mesh while extracting the isosurface then use projective painting. But I do not know how to handle terrain modifications without breaking the texture. I also guess that virtual texturing could help here.

Links for these matters would be appreciated.

sentences:
How can SpriteBatch use a single texture/asset as multiple independent objects/instances I'm using LibGDX to create a game, but I'm encountering a problem with SpriteBatch. Whenever two objects that use the same image for their sprite come onto the screen, the new object replaces the old object. So, for example, one ship will come onto the screen, and when a ship with the same sprite comes onto the screen, the old ship will disappear and the new ship will have all the damage and other characteristics of the old ship.

I could always make multiple copies of the same image and put them in the assets folder, but that seems unnecessary. Does anyone have any ideas? Am I using SpriteBatch incorrectly?

Edit: Here's a couple of examples of rendering methods in the game loop.

The method for rendering ships:

private void renderDoodad(Doodad doodad) {
    if (!doodad.isDisabled()) {

        batch.begin();
        if (doodad instanceof Enemy) {
            batch.draw(doodad.getSprite(), doodad.getX(), doodad.getY());

Followed by some code about what to do if the ship is the player's ship. But the player's ship is rendering fine, so I left that out.

Then there's the method for rendering shots:

    private void renderShot(Shot shot) {
    if (!shot.isDisabled()) {
        batch.begin();

        batch.draw(
                shot.getSprite(),
                shot.getX(),
                moveDoodadY(shot, shot.getDirection().getVal()
                        * getApp().getGraphics().getDeltaTime()));
        batch.end();
    }
}

sentences:
Concept of "scene" in Godot, misunderstanding Could anyone clarify a beginner's question in Godot?

As in this 3D video tutorial (https://www.youtube.com/watch?v=-D-IcbsdT04), the guy creates one scene for the floor, another scene for the wall, and so on.

But from the concept I have of "scene," everything that appears at the same time should be part of just ONE scene.

Why this technique of creating multiple scenes for objects that will all appear together in one (and real) scene?

sentences:
How to move player along navmesh link's curve? NavMesh Link creates a navigable link between two locations that use NavMeshes.
This link can be from point to point or it can span a gap, in which case the Agent uses the nearest location along the entry edge to cross the link.

I don't know why when I use navmesh link player move along horizontal plane (that I demonstrate it by red line) between gaps in navmesh link
Is there a option that player jump along curve (that I demonstrate it green curve)?
should I use force?

you can see player move horizontally! that isn't interesting.
Offmesh Links - Unity Official Tutorials

sentences:
Some UI button script not working in apk build! There are a lot of posts regarding this problem in various website and even in this one but no one has given a feasible solution to this problem. I have a button that has a custom sprite. I also have a custom script attached to that button which when pressed down (IPOINTER DOWN) changes the color of particular sprite renderer. All this works in pc but not on apk build. Why?
I have two canvas, so I thought there might be raycasting issues, so I disabled one but still no luck.
The buttons are in world space in canvas. So, I thought I might not use a canvas but IPointer only works on clickable UI elements.
The scene looks like this, star is the clickable button and the borders are a sprite(district).
The script attached to the button is:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;// Required when using Event data.

public class OnHighlighted : MonoBehaviour, IPointerClickHandler, IPointerDownHandler// required interface when using the OnPointerEnter method.
{
    // HoldByeach button

    private GameObject correspondingImage;

    void Start ()
    {
        correspondingImage = GameObject.Find(gameObject.name);
    }

    public void OnPointerClick(PointerEventData pointerEventData)
    {
        GetComponent<Image>().color = new Color32 (36,53,53,255);
        correspondingImage.GetComponent<SpriteRenderer>().color= new Color32 (36,53,53,255);
    }

    public void OnPointerDown(PointerEventData pointerEventData)
    {
        GetComponent<Image>().color = new Color32 (47,255,0,255);
        correspondingImage.GetComponent<SpriteRenderer>().color = new Color32 (47,255,0,255);
    }
}

sentences:
What's wrong with reversing an action like this? I'm working on an undo and redo system map editor and have come across a major issue. If I place a tile down, move right a tile, and then move back to that tile I previously placed everything works fine. Until I try and Undo, Redo, and then Undo again.

This is the state when they're placed:

Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:

The undo redo stack looks something like:

Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
41
Unexecuting:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Executing:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 1
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
-1
Unexecuting:
X: 0
Y: 0
Tiles: {X:32 Y:160 Width:32 Height:32}
Previous Tiles:
41

I don't want this to be a code dump or "debug my code for me". I understand the problem is located at the bottom most segment where it assigns the tile an ID of 41 once again - since that's what it's previous value was. This works the first time - but not the second as seen. I'm confused to why the algorithm fails. If anyone has written something similar, feedback would be appreciated. I don't need code-fixed - just hints as to where I can find a working algorithim or a rational explanationa s to why this happens. It's just a simple pencil tool that should write tiles the grid.

  public new void Execute(GameMap gameMap)
{
    Console.WriteLine("Executing: ");
    PrintState();

    _previousTiles.Clear();

    // Get vertical portion
    var curTexture = MapEditorGlobals.CurrentActiveTexture;

    // We need to loop over the width of the editor
    for (int w = 0; w < SelectedTiles.Width / 32; w++)
    {
        for (int h = 0; h < SelectedTiles.Height / 32; h++)
        {

            var gX = SelectedTiles.X / 32 + w;
            var gY = SelectedTiles.Y / 32 + h;

            var tY = (gY) * curTexture.Width / 32;
            var tX = gX;
            var tileID = tY + tX;

            _previousTiles.Add(gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId);
            gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId = tileID;
        }
    }

}

  public new void UnExecute(GameMap gameMap)
        {

            Console.WriteLine("Unexecuting: ");
            PrintState();

            List<int> newTiles = new List<int>();

            // Get vertical portion
            var curTexture = MapEditorGlobals.CurrentActiveTexture;

            // We need to loop over the width of the editor
            for (int w = 0; w < SelectedTiles.Width / 32; w++)
            {
                for (int h = 0; h < SelectedTiles.Height / 32; h++)
                {

                    var gX = SelectedTiles.X / 32 + w;
                    var gY = SelectedTiles.Y / 32 + h;

                    var tY = (gY) * curTexture.Width / 32;
                    var tX = gX;
                    var tileID = tY + tX;

                    newTiles.Add(gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId);
                    gameMap.Layers[Layer].MapTiles[X + w][Y + h].TileId = _previousTiles.Last();
                    _previousTiles.Remove(_previousTiles.Last());
                }
            }

        }

sentences:
How can I identify loaded models so I can efficiently avoid loading them twice? I'm making a fairly basic OpenGL 3D engine, at the moment. In this engine, when you load an object, you would write

manager->LoadObjFile("cube.obj");
manager->AddParent("uvmap.bmp", "cube.obj", "cube", glm::vec3(10.0f, 1.0f, 0.0f));

"uvmap.bmp" being the texture, "cube.obj" is the .obj file path, "cube" being the ID for the object.

My question is, at the moment, when it loads an object, it stores the object in a struct with all of the buffer data and an ID, the ID being the path of the obj file, so when I load an .obj, it runs through all of the already loaded files and compared the ID of each using strcmp, which obviously when there's thousands of items, is going to start to get a bit slow.... it does the same for AddParent, and most of my other methods (different vector of data than where the obj data is stored).

What would be best in terms of identifying items, an integer? I really don't know, I want this to be as high level, user friendly as possible, but want to keep it as optimized and as efficient as possible.

sentences:
How can I hook up player input to an action in RPGMaker? How do I set a player input to perform an animation such as swinging a sword.

I tried doing it by creating a parallel process in which hitting z calls the following common event.

Change Party Member: Add [mage sheild], Initialize
Change Party Member: Remove [Mage]

Effectively making the animation a party member that can be switched to. This doesn't really work at all. I tried looking at Sapphire ABS to see how they do it, but I can't find a definition for $Game_player in the code. So I'm sorta incredibly lost.

sentences:
Unreal modular character tutorial errors I'm trying to follow the modular character tutorial for Unreal from this link
Specifically the mesh merge portion. How ever the code that is provided seems to not be working.
For example when I add this piece of code :
USTRUCT(BlueprintType)
struct VR_API FSkelMeshMergeSectionMapping_BP
{
    GENERATED_BODY()
        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Mesh Merge Params")
        TArray<type> SectionIDs;
};

I get the following error : Unrecognized type 'type' - type must be a UCLASS, USTRUCT or UENUM
I;m guessing I should provide a certain type in the <> but I have no idea what it should be. I've been using unreal only for 2 days now so if anyone can help me figure this tutorial out and get it working I would be thankful.

sentences:
Best Game Engine/Framework and Language for 2D actor/sprite intensive game I'm new to the game dev world.

I have a rather large project in mind (I learn by setting myself challenges :P ) and I'm wondering what the best engine/framework/language is for a 2D game with thousands of sprites/actors on screen at a time. Bare metal type stuff. I need to still be able to zoom in and out with that many actors at once.

This game will have no 3D elements.

Any thoughts?

Suggestions?

sentences:
A good place to learn about Game Programming with Mathematical Vectors? I am looking for a place in the web where I can turn my current game development process into a vector based approach. I am sorry If this question has been asked once.

According to my google search analysis, few places I've found pretty interesting are Tony Pa's tutorials and Metanet. But, due to limited explanations, I found it little bit tough to implement. I could try out the same examples as provided there, but when I have to use it in my games, I am STUCK. I want to know about the dot products and cross product stuff, Its uses and detecting collisions and predicting collisions with these mathematical techniques.

Please, write down some links and a brief description of the link. Thank you

sentences:
Accessing enum value in other scripts I am attempting to make a global MaterialAssign script that I can assign to anything and have an enum selector in the inspector to assign a material type.  This would then drive hitFX and soundFX variation in other scripts.
My selector script MaterialAssign.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MaterialAssign : MonoBehaviour
{
    public enum MatSelection
    {
        defaultMat,
        metalEnemy,
        metalWall,
        dirtWall
    }
    public static MatSelection currentMat;
}

Attempt at usage in another script:
if (MaterialAssign.currentMat == MaterialAssign.MatSelection.metalEnemy)
{
    selectedHitFX = bulletMetalEnemyFX;
}
else if (MaterialAssign.currentMat == MaterialAssign.MatSelection.metalWall)
{
    selectedHitFX = bulletMetalWallFX;
}

I have no errors in the console BUT the enum selector doesn't show up in the inspector, so I'm assuming no value is ever passed. I read that enums can't have a static value, but not sure how to handle that.
Any assistance would be most appreciated or alternate approaches welcome! I'm purposely trying to stay away from tags, but can go down that path if needed.

sentences:
UNET Performance of (many) Kinematic Rigidbodies I am building a game in Unity in C# using the UNET networking elements.

I am trying to figure out what is the performance cost of kinematic rigidbodies?

My understanding is that, when kinematic, rigidbodies are outside the physics system and therefore are not as resource-heavy as non-kinematic rigidbodies.

For my game, I will need to use a lot of kinematic rigidbodies in the scene, because they are used to detect collisions between player-placed objects (with box colliders) and the rigidbodies. All the objects instantiated in the scene will therefore need a kinematic rigidbody to allow this collision checking to take place.

Thanks very much for your help.

sentences:
How Lots of ComputeBuffers at Once Affect Performance Unity How will lots ComputeBuffer instances affect performance? And why?
I know that I should call ComputeBuffer.Release() on every ComputeBuffer I create, but will it affect performance if I were to have lots of open ComputeBuffers at once? and by "lots" I mean hundreds to thousands.
It of course goes without saying that all of those ComputeBuffers will be released at some point, possibly at the same time.

sentences: How to change an animated sprite's images per second from script? Consider an AnimatedSprite with an animation of 9 .png files and a setting of 5 images per second. How can I change the number of images per second from script?

sentences:
SDL - Limiting loop with timer? Not polling I am using SDL/Glew to create an engine for a game I want to make. I am trying to set a constant framerate of like around 60 (once every 17ish ms). I don't know the best way to do this so I do attempted to do it with a timer.

//Main Loop
int EngineLoop(int interval, CEngine* engine)
{
    Input->Poll();
}
//---------

void CEngine::Start()
{
    _running = true;

    SDL_AddTimer(17, (SDL_TimerCallback)EngineLoop, this);
}

The input poll is this:

void CInput::Poll()
{
    SDL_Event evnt;

    while (SDL_PollEvent(&evnt))
    {
        switch (evnt.type)
        {
        case SDL_MOUSEMOTION:
            *(Rect*)(&MousePosition) = Rect(evnt.motion.x, evnt.motion.y);
            *(Rect*)(&MouseDelta)    = Rect(evnt.motion.xrel, evnt.motion.yrel);

            break;

        case SDL_MOUSEBUTTONDOWN:
            _mouseButtons[evnt.button.button - 1] = true;
            break;

        case SDL_MOUSEBUTTONUP:
            _mouseButtons[evnt.button.button - 1] = false;
            break;
        }
    }
}

This system works perfectly when I put it in some random class function to pump as much as it'd like. But when I introduced the timer, nothing works, no input is taken and the window freezes up. Is it because I am not Polling the events quick enough or?

I tried using a separate timer function that called the class function to poll the input because maybe having it on a different thread is the reason, that didn't work either.

So why didn't this work?
What other approach should I take if necessary?

sentences: When would I use "scripts" or "scripting" in a game, as opposed to the core language? The terms scripts and scripting appear to be used interchangeably on the Game Development Stack Exchange, but other than reading questions about a scripting language choice, I don't understand the relationship between scripts and scripting, and the core language. What does a script typically do, when would it be used, and are scripts in some contexts (as defined by game programmers) different than a scripting language?

sentences:
How can I make backtracking interesting? When a player navigates a space for the first time, it is very interesting: the content is new, the dangers are unknown, paths need to be found. However, various situations force the player to backtrack, or navigate the same space multiple times. Perhaps the level designers are being economical, or trying to build familiarity with a space. Perhaps the game itself is open-ended, or like a sandbox, where navigating the same spaces is part of the game itself. These can make the same spaces seem tedious and sparse.

Given that backtracking (or navigating the same space multiple times) is unavoidable, what are some effective, economical ways of making it interesting? Please keep in mind:

We are reusing levels deliberately, either for effect or to save on cost. Therefore modifying the levels beyond recognition would be against our intent.
We also cannot modify the gameplay too much; if we were attempting to save cost by reusing levels, incurring more costs by adding gameplay would be counterproductive.

One quick-fix I had in mind was to give the player some sort of powerup or vehicle so that they could backtrack faster. I'm sure there are better methods, and examples of games where they were used.

sentences:
Handling movement using an Entity Component-based System Architecture I have seen various descriptions of how to handle movement in a component-based entity framework.  The most common I've stumbled across is the idea of using components called Controller, Physics, Transform, Velocity, and Collider.

The idea here is that the Controller influences the Velocity component when movement keystrokes are detected.  The Velocity component in turn influences Physics.  Once the simulation has been stepped, the Collider is either affected if a collision occured or is not if no collision happened.  In the end, the Transform is updated with the new position from the physics simulation step and thusly the Renderable needs to be adjusted so it is drawn in the proper location.

I have often read that one needs to consider both physics-driven and non-physics-driven entities.  As outlined in the above paragraph, manipulating physics-driven entities seems like a piece of cake.  The difference with non-physics-driven entities is that the Velocity component values need to simply be applied to the the Transform based on delta-time.  This would allow moving the entity without being concerned with physics nor collision detection.

For physics-driven entities, one simply iterates entities with both Velocity and Physics components.  But for non-physics-driven entities, simply iterating over entities with a Velocity component isn't sufficient as it would include the above subset as well.

So there must be some factor that clearly separates these two cases.  So with these two cases in mind, how would movement actions that influence the values of Velocity be carried out in such a system to manipulate both types of entities whether physics plays a roll in their movement or not??

And lastly, considering that there may be times where the transform for an entity needs to be manipulated directly, such as player clicking on a portal to be teleported to another x/y/z position, how would one properly propagate this change to adjust both the physics step simultation and the renderable's draw location?

EDIT:
@bobenko
Your explanations provide insight to the most common case where objects are simulated via physics but I'm somewhat lost on the Kinematic aspect regarding updating an entities position via a velocity value?  Are you simply implying that some code of my own will apply movement to the entity via velocity, thus being Kinematic? I still am interested in your explanation on how to avoid cyclic notifications effectively when aspects of these components involved change.

For all who answered, I'm still not clear how would you handle teleporting an entity from one position to another?  Would this involve turning off physics, teleporting the player, then turning physics on after teleport finished?  Turning physics on/off can be as simply as setting the entity as Kinematic YES/NO, right?

sentences:
Removing the circle outline rendered on Box2d CircleShape How can I remove the outline on the CircleShape below?

CircleShape circle = new CircleShape();
circle.setRadius(1f);

This is what I'm using to draw:

batch.draw(textureRegion, position.x - 1, position.y - 1, 1f, 1f, 2, 2, 1, 1, angle);

I use this to set the body for a Box2d collision but I get a silly circle shape around my texture in libGdx. My textured sprite (ball) has a circle over the top of it with a line running from center along the radius.

Any ideas on how to remove the overlying circle lines?

sentences:
What is the logic behind the 'Loading' scenes in games? I'm making my first game, it's a tower defense type of game, using Unity game engine and taking Fieldrunners as a reference. I would like to know more about the functionality behind 'Loading' scenes in games.

Until now I am instantiating/creating objects at run time and I'm not facing any delay or similar issues doing so. So what are 'Loading' scenes in other games used for? Is there some functionality or instantiation of specific objects for the next round or stage? If yes why do I need them if I'm not getting any delays?

sentences:
Adding shadow and other effects on a spritefont Monogame Is there a way that I can add shadow effect on text drawn in monogame? Because you cannot add shadow effect when creating a new spritefont file in Monogame Content Pipeline.

Thanks.

sentences:
Why even use coroutines in Unity? I have been thinking about the use of Unity's coroutines recently, and while I've used them in the past, and am already aware of their bad reputation (although I've also seen posts on the unity forums of people who seem to absolutely swear by them), the more I think about it, I'm kind of struggling to see any compelling reasons to use them at all instead of simply creating a new component and simply performing the logic of the coroutine in said new component's Update method. By using a IEnumerator coroutine inside of another component, it seems to me like all it accomplishes is decreasing the cohesiveness of individual components and the re-usability of the component using them.

Is there any convincing argument to actually use coroutines in Unity and would I be missing out by simply not using them? Are there any scenarios I'm overlooking where their use would either be required or prove incredibly useful?

sentences: (Unity Engine) Is it possible to make 2d animation bones perfectly straight within the sprite editor I am experimenting with pixel perfect camera and 2d animation. I noticed in the skinning editor that there is no option to edit bone coordinates. When I make an ik it extended the arm making it noticeable  that the bones weren’t perfectly aligned. so im wondering if it is possible to make a bone perfectly vertical/horizontal within the skinning editor.

sentences: Importing a File Containing Two Objects from Blender into Unity Leads to a Single GameObject Not Two I have two separate objects in a Blender file (say a cube and a sphere). Unity import this file (OBJ type) as a single gameObject which is not want I want. I want cube and sphere to be two separate gameObjects.

sentences:
Why am I having trouble, combining color attachments to implement bloom? I'm trying to implement bloom in the same manner as this tutorial, but I am having difficulties. I have the blur buffer blurring correctly, but I can't seem to combine the two images.

Below, you will find my code. The commented-out lines just render one or the other buffer to the screen, so I know these are correct. For now, I am just trying to combine them together; not fix them with HDR. I just add together both textures, but no matter how I change things around, all I get is the one on the left.

blurShader.use();
glUniform1i(glGetUniformLocation(blurShader.program, "horizontal"), true);
glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[1]);

long blurCount = 5;

for(long i=0; i<blurCount; i++)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glActiveTexture(GL_TEXTURE0);

    // bind texture of other framebuffer (or scene if first iteration)
    glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[i%2]);

    RenderQuad();
    glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[i%2]);
}

glUniform1i(glGetUniformLocation(blurShader.program, "horizontal"), false);

for(long i=0; i<blurCount; i++)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glActiveTexture(GL_TEXTURE0);

    // bind texture of other framebuffer (or scene if first iteration)
    glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[(i+1)%2]);

    RenderQuad();
    glBindFramebuffer(GL_FRAMEBUFFER, pingpongFBO[(i+1)%2]);
}

glBindFramebuffer(GL_FRAMEBUFFER, 0);

//renderScreenQuad(colorBuffers[0]);
//renderScreenQuad(pingpongColorbuffers[1]);

// 2. Now render floating point color buffer to 2D quad and tonemap HDR colors
// to default framebuffer's (clamped) color range
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
bloomShader.use();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, colorBuffers[0]);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[1]);
glUniform1i(glGetUniformLocation(bloomShader.program, "bloom"), bloom);
glUniform1f(glGetUniformLocation(bloomShader.program, "exposure"), exposure);
RenderQuad();

#version 330 core
out vec4 FragColor; in vec2 TexCoords;

uniform sampler2D colorTexture; uniform sampler2D bloomTexture;
uniform bool bloom; uniform float exposure;

void main() {
    vec3 firstColor = texture(colorTexture, TexCoords).rgb;
    vec3 secondColor = texture(bloomTexture, TexCoords).rgb;
    FragColor = vec4(firstColor+secondColor, 1.0f);
}

#version 330 core
layout (location = 0) in vec3 position; layout (location = 1) in vec2 texCoords;

out vec2 TexCoords;

void main() {
    gl_Position = vec4(position, 1.0f);
    TexCoords = texCoords;
}

Basically, what happens is that the first image bound goes through, and is accessible. Then, the second is the same as the first! If I change the order in which I bind the images, then the other image becomes the one sent in.

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[0]);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, pingpongColorbuffers[1]);
glUniform1i(glGetUniformLocation(bloomShader.program, "bloom"), bloom);
glUniform1f(glGetUniformLocation(bloomShader.program, "exposure"), exposure);
RenderQuad();

The above code is the section I'm talking about. Each of the pingpongcolorbuffers is attached to its own FBO. I am trying to send those in. Is there some reason that would limit me to sending in only one?

Here is the combined result, before HDR:

sentences:
Has an open console any chance to give more strength to the indie game world? I have heard about the GPX, but i don't really think the embedded market is mature enough in terms of performance, but what about the home console market ?

I'm not talking about last-generation graphics, because that would be economically impossible, but what about an hardware as fast as a playstation 2/Xbox 1/Gamecube ?

For games, the trick would be to ask some editors to recompile their best sellers  for the new machine: those games being from the PSX age or even older console generations, I think this would have a very low cost job and they could still make some good profit, but I need to know if this is doable technically, considering the architecture which can be quite exotic.

Do you think it would be a viable project to talk about to investors ?

sentences:
Collision causing First Person Controller to go haywire I have created a first person controller as an enemy in my game (Zombie). My character is an archer that uses arrows as projectiles that are shot with the following code:

if(Input.GetButton("Fire1")) {
    shotForce += 45f;
}

if (Input.GetMouseButtonUp(0)) {
    Rigidbody shot = Instantiate (projectile, shotPos.position, shotPos.rotation) as Rigidbody;
    shot.mass = shotMass;
    shot.AddForce (Camera.main.transform.forward * shotForce);
    shotForce = 0f;
}

I have a script to parent the fired arrow to the collided object which works fine for most objects in the game, but  my enemy object (Zombie) speeds up and moves all around the place on a collision, I'm new to unity, I've spent a few hours trying to resolve this with out success.

I have a Rigidbody, Charcter controller and First person controller on the Zombie.

I have a Rigidbody and Sphere Collider on the Arrow.

The method I think is causing the problem:

void OnCollisionEnter(Collision collision){
        if (this.flying) {
            this.flying = false;
            Destroy (this.GetComponent<Rigidbody>());
            this.transform.position = collision.contacts [0].point;
            GameObject anchor = new GameObject ("ARROW_ANCHOR");
            anchor.transform.position = this.transform.position;
            anchor.transform.rotation = this.transform.rotation;
            anchor.transform.parent = collision.transform;
            this.anchor = anchor.transform;
            collision.gameObject.SendMessage ("arrowHit", SendMessageOptions.DontRequireReceiver);
        }
    }

I think the issue is with the line anchor.transform.parent = collision.transform;
Maybe there is a solution without parenting the arrow to the Zombie?

I'm stumped at this stage any help appreciated.

sentences:
Instantiation taking too long? I have a game where there are about 4 empty objects that are my object "spawners". I have two scripts attached to all of them, one that will keep spawning objects from "basictable", and then switch to the other component which will then spawn objects from  "complextable".

This is my first script :

public void SpawnA() {

    if (destroyer.spawncount < destroyer.spawnchange) { //if condition

        int randomi = Random.Range (0, basictable.Length);
        Instantiate (basictable[randomi], new Vector3 (this.transform.position.x,this.transform.position.y,basictable[randomi].transform.position.z), Quaternion.identity);
        Invoke ("SpawnA", Random.Range (mini, maxi));

    }
    else if (keep){
        this.GetComponent<spawnscript2>().SpawnB();
        keep = false;
    }

And the second script :

public void spawnB()  {

        int randomi = Random.Range (0, complextable.Length);
        bobo = (GameObject) Instantiate (complextable [randomi], new Vector3 (this.transform.position.x, this.transform.position.y, complextable [randomi].transform.position.z), Quaternion.identity) as GameObject;
        StartCoroutine ("DelayedSpawnC");

}

IEnumerator DelayedSpawnC () {

        yield return  new WaitForSeconds (6);
        destroyer.spawncount = 0;
        this.GetComponent<basicSpawner> ().keep = true;
        this.GetComponent<basicSpawner> ().SpawnA();
}

Logically, this should work. And indeed it does. But the problem I'm having is that my "spawner", sometimes works, and sometimes doesn't, some objects from the complextable are always spawned, but in other cases the spawner just does nothing, until it switches to the first script. Is there anything I can do to optimize the spawning process and avoid this? I can't get ahold of why are some blocks spawned and others take much longer, while other blocks don't get instantiated at all.

sentences:
MacOS Mojave makes SDL2 unaccessible I have some code that worked with no issues on MacOS Sierra, but when I update to Mojave, my compiler always says that it can't find SDL2.

Here's the error:

20:24:40 **** Incremental Build of configuration Debug for project Causality ****
make all
Building file: ../src/engine/SE.cpp
Invoking: Cross G++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/engine/SE.d" -MT"src/engine/SE.o" -o "src/engine/SE.o" "../src/engine/SE.cpp"
In file included from ../src/engine/SE.cpp:1:
../src/engine/SE.h:6:10: fatal error: 'SDL2/SDL_events.h' file not found
#include <SDL2/SDL_events.h>
         ^~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/engine/SE.o] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

20:24:42 Build Failed. 2 errors, 0 warnings. (took 1s.304ms)

I'm using SDL 2.0.9

My project structure is this:

src
|main.cpp
|engine
 |SE.h
 |SE.cpp
 |SE_Audio.h
 |SE_Audio.cpp
 |SE_Graphics.h
 |SE_Graphics.cpp
 |SE_Input.h
 |SE_Input.cpp
 |SE_Structs.h

I'm including the libraries with -framework SDL2 -framework Cocoa -framework SDL2_image

I'm using the exact same settings that I used before and that worked in MacOS Sierra. Please tell me what more details you need before down-voting

sentences:
How to stop the Unity Editor from continuously rendering? Look closely at the image below. Even though the game is not running the scene shows that green wheel is spinning. This means the scene is being rendered constantly and my battery is dying.

I know Unity used to not do this and was in fact one of the reasons I liked Unity over some other engine that defaulted to always running and would make my laptop fans start up even when just sitting idle in the editor.

Is there any way to get Unity to render on demand. Meaning, only render when I interact with it, when I move the camera or change a setting like it used it?

I saw in preferences there's an "interaction mode" setting but the best it can be set to is don't render faster than 30fps. That's not useful.

Is there some other setting to get the editor to only render when interacted with?

sentences:
Why do games ask for screen resolution instead of automatically fitting the window size? It seems to me that it would be more logical, reusable and user-friendly to implement flexible, responsive UI layout over a 3d or 2d screen, which can then be run on any screen resolution.

Some modern games auto-detect screen resolution and adjust the game to that, but the option to change the resolution still remains in the settings.

Why is this option there?

My guess is that this is one way to provide older machines with a way to improve performance by rendering less graphics and just stretching them across the screen, but surely there are better ways of improving performance (choosing different texture and model qualities, for example).

sentences:
Best practice for toggling between ragdoll and CharacterController One feature of the game I'm working on is that if a character is hit with a certain amount of force, it will temporarily ragdoll, then get up off the ground after a small period of time. This character is moved by a CharacterController (CC) component. At the moment, I have the model as a child of an object with a CC component and movement script. My issue is that when the ragdoll is activated/animator is disabled, the model moves independently of the CC - if it ragdolls with some arbitrary force in any direction, the CC does not move with it (as you'd expect). This would be fine if the ragdoll wasn't meant to be re-enabled, but it is. At this stage, the model teleports/moves to where the CC is, and it looks very weird.
I have tried a few different methods to synchronize the two:

Decoupling the CC and model. Both objects are children of a shared parent, and I added them both to an PhysicsIgnoreLayer (for now - eventually if I go with this I'll probably add all the ragdoll colliders to an array and ignore them individually). When the ragdoll state is enabled in the parent, the CC is disabled and the object is teleported to the root bone every frame. When the CC is enabled, the model is teleported to the CC object every frame. See here. The issue here is that setting the position means extra Update() calls and it lags behind the controller a little. Also, because the model isn't a child of the controller, it doesn't inherit the velocity of the controller, so it needs to be manually applied.
Changing the parented GameObject at runtime. Depending on the state of the character, the CC/model will be parented to each other - if the CC is active, the model is set as its child and vice versa using SetParent. I couldn't get this one working (the local position variable was a little confusing to me, but no configuration I tried worked for me).
Conjoined CC and model. I placed the CC on the same object as the model. This isn't really ideal for me because I want greater control over the rotation and presentation of the model. I couldn't get this one working either - I don't know how I could set the position of the CC without moving the whole thing.

Is there a more effective way of doing this? If so, what? I feel like I am greatly overcomplicating this. Any help would be great. In an ideal situation, I could have the model as a child of the controller (or behave that way) and move the CC when it is inactive without affecting the model position.

sentences:
What exactly are smart material packs on Quixel Mixer? Not sure if this is a good spot to ask this, but I'm using this for Unreal, so I figure it probably is?  If not, please comment instead of downvoting.
When prompted to select the packs I wanted on the installer, I left it at the default which was only Smart Material Pack 5, mainly because it made it a 3 gb download instead of a 20 gb download.  This leads me to wonder what exactly these packs do, and what I will be missing by not downloading all of them?  Will I still get all of Mixers features?  Are they just materials with settings already set up?  Thanks.

sentences: How does changing weapons and character animation in 2d games work? I know how I can make my character move by changing animation-frames. What if I want to use a weapon database? I want the character to fight with a bow and sometimes with an axe (different moves). Do I need like many pictures/animations for every different kind of weapon (bows, swords)? Or am I totally wrong?

sentences:
IndexOutOfRangeException on World.Step after enabling/disabling a Farseer physics body? Earlier, I posted a question asking how to swap fixtures on the fly in a 2D side-scroller using Farseer Physics Engine. The ultimate goal being that the player's physical body changes when the player is in different states (I.e. standing, walking, jumping, etc). After reading this answer, I changed my approach to the following:

Create a physical body for each state when the player is loaded
Save those bodies and their corresponding states in parallel lists
Swap those physical bodies out when the player state changes (which causes an exception, see below)

The following is my function to change states and swap physical bodies:

new protected void SetState(object nState)
{
    //If mBody == null, the player is being loaded for the first time
    if (mBody == null)
    {
        mBody = mBodies[mStates.IndexOf(nState)];
        mBody.Enabled = true;
    }
    else
    {
        //Get the body for the given state
        Body nBody = mBodies[mStates.IndexOf(nState)];

        //Enable the new body
        nBody.Enabled = true;

        //Disable the current body
        mBody.Enabled = false;

        //Copy the current body's attributes to the new one
        nBody.SetTransform(mBody.Position, mBody.Rotation);
        nBody.LinearVelocity = mBody.LinearVelocity;
        nBody.AngularVelocity = mBody.AngularVelocity;

        mBody = nBody;
    }

    base.SetState(nState);
}

Using the above method causes an IndexOutOfRangeException when calling World.Step:

mWorld.Step(Math.Min((float)nGameTime.ElapsedGameTime.TotalSeconds, (1f / 30f)));

I found that the problem is related to changing the .Enabled setting on a body. I tried the above function without setting .Enabled, and there was no error thrown. Turning on the debug views, I saw that the bodies were updating positions/rotations/etc properly when the state was changes, but since they were all enabled, they were just colliding wildly with each other.

Does Enabling/Disabling a body remove it from the world's body list, which then causes the error because the list is shorter than expected?

Update:

For such a straightforward issue, I feel this question has not received enough attention.  Has anyone else experienced this? Would anyone try a quick test case? I know this issue can be sidestepped - I.e. by not disabling a body during the simulation - but it seems strange that this issue would exist in the first place, especially when I see no mention of it in the documentation for farseer or box2d. I can't find any cases of the issue online where things are more or less kosher, like in my case. Any leads on this would be helpful.

sentences:
What is the better way to speed up gameplay as the level rises? I started with game programming couple of weeks back. For the starters I tried to develop ZigZag (link takes you to 2 min gameplay).

I am done with the logic of gameplay by now. It runs well and all. Now I want to speed up the gameplay as user passes some score. Say after 100 points increase the speed of the ball.

I have two options:

Control the speed using time-delay by varying time.delay(var).
Actually increasing the speed of the moving ball

Not sure which one is a good idea in long term, I'm looking for help from experienced game developers.

You can checkout the source code: https://github.com/ravi-ojha/zigway/blob/master/zigway.py

sentences: Improving my Roguelike Dungeon generator? I am looking to find improvements upon my Roguelike Dungeon generator. I find it is not 'roguelike' enough, with dungeons just looking like a mess more than anything. What would improve my generator(images below)? I just can't seem to get it to look 'right'. Reference image for what roguelike should appear as: [link]

sentences:
Playing Multiple Sound effects isssue in cocos2d-x Please help if someone faced this issue. I have a sound effect 3sec long which need to be played repeatedly for some time of 10 to 15 secs. Implemented like below:
SimpleAudioEngine::sharedEngine()->playEffect(powerUpSound, true);

But when I play an another sound effect, previous sound (powerUpSound) effect stops.
SimpleAudioEngine::sharedEngine()->playEffect(starsSouns, false);

Any help will be appreciated. Cocos2d-x v2.2.3

sentences: 2d Tower Defense - Projectile Prediction For my map, it's very curvy and the node sizes aren't consistent. I have everything finished so that projectiles will actually fly at an enemy, however if a projectile is going too slow it will miss. I am wondering if I should just go the easy route, and just make the projectile homing, or if I could get help here on where to start. The enemy is changing directions, and moving around, although never changes speed.

sentences:
Trying to translate object I'm trying to tranlate a matrix by xy but the result is strange. can someone help me translate and rotate the matrix properly?

void Transform_Update(Transform *transform, GLfloat depth)
{
    Matrix4_SetToIdentity(transform->transformationMatrix);
    Matrix4_Set(transform->transformationMatrix, 0, 3, transform->position->x);
    Matrix4_Set(transform->transformationMatrix, 1, 3, transform->position->y);
    Matrix4_Set(transform->transformationMatrix, 2, 3, depth);
}

Here is my Matrix set value.

void Matrix4_Set(Matrix4 *m, GLuint line, GLuint column, GLfloat value)
{
    m->data[line * 4 + column] = value;
}

Here is where I make the matrix to the identity matrix

void Matrix4_SetToIdentity(Matrix4 *m)
{
    GLfloat data[16] = { 1, 0, 0, 0,
                         0, 1, 0, 0,
                         0, 0, 1, 0,
                         0, 0, 0, 1 };

    memcpy(m->data, data, sizeof(GLfloat) * 16 );
}

This is where I render my mesh and update shader values

void Renderer_Render(Renderer *renderer, Camera *camera)
{
    glUseProgram(renderer->shader->id);

    Transform_Update(renderer->gameObject->transform, renderer->depth);

    GLint location = Shader_GetUniformLocation(renderer->shader, "transformationMatrix");
    glProgramUniformMatrix4fv(renderer->shader->id, location, 1, GL_FALSE, renderer->gameObject->transform->transformationMatrix->data);

    GLint location2 = Shader_GetUniformLocation(renderer->shader, "projectionMatrix");
    glProgramUniformMatrix4fv(renderer->shader->id, location2, 1, GL_FALSE, camera->projectionMatrix);

    GLint location3 = Shader_GetUniformLocation(renderer->shader, "viewMatrix");
    glProgramUniformMatrix4fv(renderer->shader->id, location3, 1, GL_FALSE, camera->viewMatrix);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, renderer->texture->id);

    Mesh_Render(renderer->mesh);
}

Here is my shader transforming the vertices :

#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec2 pass_textureCoords;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;

void main(void) {

    vec4 worldPosition = transformationMatrix * vec4(position, 1.0);
    vec4 positionRelativeToCamera = viewMatrix * worldPosition;

    gl_Position = projectionMatrix * positionRelativeToCamera;
    pass_textureCoords = textureCoords;
}

Here is how I get the view and projection matrix :

void Camera_Render(Screen *screen, Camera *camera)
{
    glClearColor(camera->backgroundColor->red, camera->backgroundColor->green, camera->backgroundColor->blue, camera->backgroundColor->alpha);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLoadIdentity();
    glTranslatef(camera->transform->position->x, camera->transform->position->y, 0);
    glRotatef(camera->transform->angle, 0, 0, 1);

    glGetFloatv(GL_PROJECTION_MATRIX, camera->projectionMatrix);
    glGetFloatv(GL_MODELVIEW_MATRIX, camera->viewMatrix);
}

The current output when I change X is this :

sentences:
How can I bend an object in OpenGL? Is there a way one could bend an object, like a cylinder or a plane using OpenGL?

I'm an OpenGL beginner (I'm using OpenGL ES 2.0, if that matters, although I suspect, math matters most in this case, so it's somehow version independent), I understand the basics: translate, rotate, matrix transformations, etc. I was wondering if there is a technique which allows you to actually change the geometry of your objects (in this case by bending them)?

Any links, tutorials or other references are welcomed!

sentences:
Sobel Edge Detection on Depth Texture I'm currently trying to implement contour shading via edge detection on a depth texture.

I'm rendering the color and depth information onto two textures.
In my post processing shader I do the following:

out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
uniform float far;
uniform float near;

Then the matrices for the sobel filter:

mat3 sobel_y = mat3(
     1.0, 0.0, -1.0,
     2.0, 0.0, -2.0,
     1.0, 0.0, -1.0
);

mat3 sobel_x = mat3(
     1.0, 2.0, 1.0,
     0.0, 0.0, 0.0,
    -1.0, -2.0, -1.0
);

The function to linearize the Depthvalue

float LinearizeDepth(float z)
{
     float n = near;
     float f = far;
     return (2.0 * n) / (f + n - z * (f - n));
}

In the main I'm filling the matrix to calculate the gradients and then substract the result of the diffuseColor to get Black if the gradient is high (an edge) and just output the diffuseColor if the gradient is low.

void main()
{
    vec3 colorDiff = texture(colorTexture, TexCoords).rgb;
    mat3 I;
    vec3 texel;
    for (int i=0; i<3; i++) {
        for (int j=0; j<3; j++) {
            float depth = LinearizeDepth(texture(depthTexture, TexCoords + vec2(i-1, j-1)).r);
            I[i][j] = depth;
        }
    }

    float gx = dot(sobel_x[0], I[0]) + dot(sobel_x[1], I[1]) + dot(sobel_x[2], I[2]);
    float gy = dot(sobel_y[0], I[0]) + dot(sobel_y[1], I[1]) + dot(sobel_y[2], I[2]);

    float g = sqrt(pow(gx, 2.0)+pow(gy, 2.0));

    FragColor = vec4(colorDiff - vec3(g), 1.0);
}

My problem is that g is always 0 since i just the the normal color as output.

If i just output the depth values it does look correct:

Any Idea what I'm doing wrong here?

sentences: Unity: Is it possible to copy a rig from one model to another Lets say I have a model with a ready humanoid rig and a humanoid model with no rig. Can I somehow copy the bones from the rig to the model with no rig in unity?

sentences:
Where to promote your indie game? Possible Duplicate:
  Where to advertise my game?

Let's say I have developed a game and I want to "get it out there".  What I have in mind is open-source, non-commercial games.

What websites do you know of where you can promote your newly developed game, rather than simply posting it on your blog?

sentences:
What algorithms exist for generating collision geometry from an image? I am currently working on a game using SFML and Box2D. I am interested in generating collision geometry from the sprite data that I load into SFML. So, for example, an algorithm that would do this would take an image and find the edges (for example where the alpha area starts) and then generating a polygon that fits to those edges.

Can I be pointed to any resources that describe an algorithm to do this?

sentences:
Smooth camera movement between followed objects I have 2d game where my camera follows the player. Simplified, it copies the player position as its own.

Now I have some other object in the game, that I want to camera to follow. This is easy enough by not setting the camera's position with the player's, but with the position of the other object.

The problem is that this camera movement is instant. I'd like to have a more smooth transition (e.g. panning over the level to the given object).

How can I achieve this?

sentences:
Procedural generation of semi-correct planetary systems So there are lots of resources you can find via Google or using the search here on how to procedural generate a whole galaxy. But I couldn't find any good resource on how to generate planetary systems that follow these criteria:

The systems don't have to be accurate simulations of orbits but should be close to plausible orbits. I don't care about any simulation that cares about how the system might look in 200k years, the orbits could be rock solid. The main problem I'm facing is how to randomly generate a system that could be seen as plausible. This becomes especially interesting when you have a system with a binary star.

Just randomly creating orbits won't make up a plausible system, you'll end up with obviously non working orbits. Yes, I'm aware of the N-body problem :) but this doesn't help me, at least I think so, to solve the problem of generating a plausible system procedural?

I think you could just randomly spawn planets on their orbit and give them a mass and then use the N-body mathematics to calculate if they're more or less valid, if not start over and randomly generate new orbits until you get something that matches, but this would be very inefficient.

sentences:
How do I snap the Unity camera to a 2D, tile-based map? I have a 2D, tile-based map. I want to be able to control the number of visible tiles on the screen vertically and horizontally, regardless of resolution. I want the player to be able to move the camera one tile width at a time until it hits the edge.

I do not understand how to manipulate the Unity camera in order to accomplish this. I have read the documentation, and Googled, but there is just something that is not clicking for me.

So, let's say I have a 100x100 map. A 32x24 portion of the map is shown at a resolution of 1024x768, each tile has a size of 1x1 Unity unit. The bottom-left of the visible area of the map starts at the bottom-left of the map (0, 0). The player then clicks the right arrow key and the map moves one tile to the right (1, 0).

How do I accomplish this, given that I am using the latest version of Unity in 2D mode?

sentences:
Unity: OnCollisionEnter not called I created a sphere object, added a rigidbody component (no kinematics) and attached a script to it like this:

function Update () {
}

function OnCollisionEnter(collision : Collision) {
    Debug.Log("OnCollisionEnter");
}

I then created a cube under the ball, added a box collider component with no trigger of course.

Then, when I run the game, the ball falls down onto the cube, but nothing happens. The OnCollisionEnter function isn't called.

What should I do?

sentences:
Unity not opening in Ubuntu I installed the latest version version of Unity for Linux from the official website, but when I try to launch Unity, it displays a blank dialog box. I waited for a long time, but nothing happens.

These are my system specifications. I was running Unity on the same computer, several months ago, using Windows.

Model: Thinkpad R500
Processor: Intel® Core™2 Duo CPU P8600 @ 2.40GHz × 2
RAM: 2Gb DDR3 RAM
Storage: 155Gb HDD
Graphics Card: ATI Mobility Radeon HD 3400 Series 128mb dedicated GFX

Why is it doing this? Is there a problem with the latest build? What should I do to fix it?

sentences: Can I incorporate a small fraction of a song into my iOS game? I was wondering if I can use a small portion of a song without running into any copyright issues. I would give full credit to the artist as well.

sentences:
How to efficiently handle registration/anchor points for graphics? I am currently working on an iPhone project, but most of my work has been in Flash. Flash has a feature where you can place a bitmap into a MovieClip, set its registration point with the mouse and it's automatically adopted. It's one of the lovelier Flash features.

Now I'm doing iPhone stuff, using TexturePacker for importing the graphics, and I'm having to write code like this:

if(graphic == "spikes1") setAnchorPoint(ccp(1, 0));
if(graphic == "spikes2") setAnchorPoint(ccp(.5f, 0));
if(graphic == "spikes3") setAnchorPoint(ccp(.5f, 0));
if(graphic == "spikes4") setAnchorPoint(ccp(.5f, 0));

if(graphic == "bush-a") setAnchorPoint(ccp(.5f, .25f));
if(graphic == "bush-b") setAnchorPoint(ccp(.5f, .25f));

if(graphic == "tree1") setAnchorPoint(ccp((float)134/209, (float)34/202));
if(graphic == "tree2") setAnchorPoint(ccp((float)96/236, (float)31/184));

I can obviously use macros or functions to shorten this a little, but is there a more intelligent way to go about this?

How do professional platformer games (on consoles and PC) handle this?

sentences:
How to implement "model quality" in OpenGL In many games, there is an option named: "Model Quality", which ranges from Low to High. Low model quality simply removes a lot of vertices from the model, to make it faster, while High preserves the original model vertices (I think).

So I'm wondering, how do I implement this in my game?

sentences:
Spawning enemies at way points I'm trying to have my game spawn enemies when ever the player reaches a way point.

Right now, I have this functionality working. When my player gets to the first way, the enemies spawn. He only moves on once he has killed all of the enemies on the screen are dead. However, when he gets to the second way point, no enemies spawn.

Right now, in my collision class I call the following line of code:

Destroy(gameObject)

Whilst this work for the first way point, the second one wont spawn anything as the game object my collision class has been attached to has been destroyed. However, all of my enemies are prefabs and I thought the destroy function would only destroy that instance of the prefab. No matter when you called the instantiate method, it would only destroy that instance.

I'm spawning my enemies with the following method:

  public GameObject SpawnEnemies()
{
    Vector3 _position = new Vector3(transform.position.x, transform.position.y, transform.position.z);

    // instantiate particel system
    Instantiate(_particle, _position, Quaternion.identity);

    _clone = (GameObject)Instantiate(_enemy, _position, transform.rotation);
    _ai = _clone.GetComponent<HV_BaseAI>();
    _ai._waypoints = _wayPoints;

    return _clone;
}

Then I'm finding out how many of the enemies are still alive with the following code in my collision method:

  GameObject g, f; // enemies I want to spawn
    g = GameObject.FindGameObjectWithTag("SectionController");
    f = GameObject.FindGameObjectWithTag("SectionController");

    HV_SectionController tempSectionControllerGroundEnemies, tempSectionControllerFlyingEnemies;
    tempSectionControllerGroundEnemies = g.GetComponent<HV_SectionController>();
    tempSectionControllerFlyingEnemies = f.GetComponent<HV_SectionController>();

    tempSectionControllerGroundEnemies._numberOfGroundEnemies.Remove(gameObject); // remove enemies from list
    tempSectionControllerFlyingEnemies._numberOfFlyingEnemies.Remove(gameObject);
    //Destroy(gameObject);

    _numberOfGroundEnemies = tempSectionControllerGroundEnemies._numberOfGroundEnemies.Count;
    _numberOfFlyingEnemies = tempSectionControllerFlyingEnemies._numberOfFlyingEnemies.Count;

Then when I want to move on I do the following check:

 if (_groundEnemiesRemaining == 0)
        {
            MoveToNextSection();
            _sectionStartTime = Time.time;
        }

i know the above line is checking only one type of enemy at the moment, but its the ground enemies I'm having issues with at the moment.

Does anyone know how I can delete the enemy prefab I'm spawning from my first section, once they've been hit, then have it respawn at the next section without the error:

  The object of type 'GameObject' has been destroyed but you are still
  trying to access it.

sentences:
LibGdx Table not firing touch events I can easily add listeners to the actors within a table, and they will fire events, but if I want an entire to table to have 1 listener and do not care to have differentiated effects depending on where it is touched, I want to be able to add the listener directly to the table. However, it is not firing, at all. I have turned on debug and tried pressing within the labels in the table or outside of them (still in the table, like on padding), but to no avail.

This is how I add the create the table:

il = new InfoListener();// extends ClickListener
info = new Table(skin);
info.setBackground("default-rect");
info.setVisible(false);
info.addListener(il);
info.setDebug(true);

// later on I have a method that adds things to the table
info.clear();
info.add(item.getDescription()).padRight(5);

info.setVisible(true);
info.setSize(info.getPrefWidth(), info.getPrefHeight());

It is a dynamic table (i.e. I change it's children when necessary), but that shouldn't make a difference. How do I have the table fire touch events?

sentences:
Problem in nested parent-entity relationship in ecs In the given flow, the character is the parent entity, gun is child of character and bullet is child of gun. I've got a component called NodeComponent which has the storage of child entities and a NodeSystem that iterate the children then update its position relative to its parent. The problem is when the iteration reach to the bullet, it takes some time to update the bullet position. So when I move the parent the bullet is noticeable. How do I handle the parent-child relationship transformation without losing or slowing down the update from top to bottom?

Character >>
             Gun >>
                    Bullet

sentences:
What are Glow Textures? So i'm not quite sure exactly what "glow textures" are. For my implementation of a "lightning" effect, according to the comments on the article;
http://drilian.com/2009/02/25/lightning-bolts/

They guy uses "glow textures". To achieve the really cool effects on his beams. I'm trying to-do the same thing, except that i'm not 100% sure what a glow texture is, currently the texture i'm using produces this output *I'm also using a simple shader to adjust the color value the lightning is rendered at;
http://www.youtube.com/watch?v=dQNRYD8bJJo

Which isn't very good, it has the shape of the lightning but it doesn't have the sorta "flare" of it. This is a screenshot of my current texture that i'm using:
http://dl.dropbox.com/u/13874083/screenshots/screen120417-105326.png

So essentially what i'd like to ask is mainly what is a glow texture? And perhaps to see  an example of one would be really appreicated.

Edit:
Taking the advice of kaoD, i'm now rendering the using Additive Blending, I've also got the Max Blending working, yet, still the bolt's do not produce the required effect that i'd like. Here's another video of them in action with the current code;
http://www.youtube.com/watch?v=T0OEBobHqks

And here's specifically how i'm rendering them;

        spriteBatch.Begin(SpriteSortMode.Immediate, new BlendState
            {
                ColorSourceBlend = Blend.One,
                ColorDestinationBlend = Blend.One,
                ColorBlendFunction = BlendFunction.Max
            }, null, null, null, effect);

        //Set Brightness of The First Bolt
        effect.Parameters["brightness"].SetValue(firstBoltBrightness);

        spriteBatch.Draw(firstBoltTarget, Vector2.Zero, Color.White);

        //Set Brightness of the Seconded Bolt
        effect.Parameters["brightness"].SetValue(secondBoltBrightness);

        spriteBatch.Draw(secondBoltTarget, Vector2.Zero, Color.White);

sentences:
OpenGL shows a black screen I am new at OpenGL, I try this example:  https://stackoverflow.com/a/31524956/4564882

but I get only a black widget. The code is exactly the same. this is the code associated to the QopenGLWidget:

OGLWidget::OGLWidget(QWidget *parent)
: QOpenGLWidget(parent)
 {

 }

 OGLWidget::~OGLWidget()
{

}

 void OGLWidget::initializeGL()
 {
   glClearColor(0,0,0,1);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_LIGHT0);
   glEnable(GL_LIGHTING);
   glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
   glEnable(GL_COLOR_MATERIAL);
}

 void OGLWidget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glBegin(GL_TRIANGLES);
    glColor3f(1.0, 0.0, 0.0);
    glVertex3f(-0.5, -0.5, 0);
    glColor3f(0.0, 1.0, 0.0);
    glVertex3f( 0.5, -0.5, 0);
    glColor3f(0.0, 0.0, 1.0);
    glVertex3f( 0.0,  0.5, 0);
glEnd();
 }

 void OGLWidget::resizeGL(int w, int h)
 {
glViewport(0,0,w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45, (float)w/h, 0.01, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,5,0,0,0,0,1,0);
  }

I tried the example here: https://doc.qt.io/archives/qt-5.3/qtopengl-2dpainting-example.html. It works fine (trying the both base class: QGLWidget and QOpenGLWidget. this is the code associated to the Widget:

  GLWidget::GLWidget(Helper *helper, QWidget *parent)
  : QGLWidget(QGLFormat(QGL::SampleBuffers), parent), helper(helper)
 {
 elapsed = 0;
setFixedSize(200, 200);
setAutoFillBackground(false);
}

void GLWidget::animate()
{
 elapsed = (elapsed + qobject_cast<QTimer*>(sender())->interval()) % 1000;
 repaint();
 }

void GLWidget::paintEvent(QPaintEvent *event)
{
QPainter painter;
painter.begin(this);
painter.setRenderHint(QPainter::Antialiasing);
helper->paint(&painter, event, elapsed);
painter.end();
}

I use  Qt 5.5.1 binairies built on my machine. I let the Build Configuration by default, so it is based on Qt ANGLE not Desktop OpenGL.
My Graphic card Driver is updated.
What is the problem of such a behaviour?

sentences:
Opengl in 500 lines point in triangle question https://github.com/ssloy/tinyrenderer/wiki/Lesson-2-Triangle-rasterization-and-back-face-culling
I am on lesson 2 of the "Opengl in 500 lines" tutorial. I follow the part of the lesson in "The method I adopt for my code", but I don't understand this leap from
P = A + uAB-vector + vAC-vector

to
0-vector = uAB-vector + vAC-vector + PA-vector.

sentences:
For a custom game engines, what should I do if my core data is malformed or missing? I'm writing a custom engine for a game. I started this game well before I understood why I should use middleware, instead, and it's too far along to rewrite.

The vast majority of my data comes from external files, and I don't just refer to assets; I define all of my game objects through .JSON.  But, alas, I am human; occasionally my data files are invalid, or I change the format but forget to update the file, or the loader itself is flat-out buggy.

If, for whatever reason, an attempt to load some form of asset in a custom engine fails, what options do I have?

This is not a duplicate of How should I handle missing resources?, as that question is about user-facing assets like models or textures.  Bad textures can be replaced with a checkerboard, bad sounds with silence, and bad text with "ERROR".  My problem lies with data that's critical to the game even running, such as levels, game object definitions, and GUI layouts.

sentences:
Creating color texture from greyscale heightmap in shader I'm trying to create a shader that takes a grayscale map as input, and returns a colored albedo that I want to use as texture for my PCG planets, I think that the code below should work, but it only produces flatly white objects.

I'm a total shader noob, so I'm terribly sorry if I'm missing something obvious here.

    Shader "Custom/Planet" {
    Properties{
        _height("HeightMap", 2D) = "white" {}
    }
    SubShader{
        Tags { "RenderType" = "Opaque" }
        LOD 200

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        struct Input {
            float2 _heightMap;
        };

        float minHeight = 0;
        float maxHeight = 1;

        float inverseLerp(float a, float b, float v) {
            return saturate((v - a) / (b - a));
        }

        //UNITY_INSTANCING_CBUFFER_START(Props)
        //UNITY_INSTANCING_CBUFFER_END

        void surf (Input IN, inout SurfaceOutputStandard o) {
            float hv = inverseLerp(minHeight, maxHeight, IN._heightMap);
            o.Albedo = hv;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
Games with rubbing/scratching as interaction? I'm brainstorming a game aimed for touchscreen. Its primary interaction involves a lot of rubbing and scratching with the finger to the on screen objects, sort of like Fruit Ninja, but a bit more work than a single swipe. I recall there are somewhat similar operation in Rayman Raving Rabbid that uses Wiimote to draw shapes.

At this stage, the interactions in my mind looks repetitive and unappealing. I'm trying to find similar examples that appear repetitive but still fun to play. Besides these two, are there any others?

sentences:
2-Color Fonts in Unity? (so maybe called 3-Color including transparent alpha?) I have been trying to make my game title screen look better. I realised it was because all my fonts have just one colour.
I read some very old threads about a Editor Scripts to extract the font to png format. I then see there is now a way to do it in the 'hamburger' menu of the Font in Inspector.
I had to change my font to be not 'Dynamic' then it allowed me to extract a copy to PNG. I opened this in GIMP and added my white inside the outlines of each character (it had been alpha before this, giving a horrible see-thru effect on the letters).
I put this back into Unity (the new PNG) and used it as the source texture for my Text Shader. However it is still not handling both colours. (Screenshot below). So what can I do using Unity 2020 to achieve better looking text? I've read this: (https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html) and many other pages on Unity site but I am now going around in circles not achieving anything.
Thanks for any help.

EDIT: Since DMGregorys comment. I am posting picture of my import settings on the modified (coloured-in) font PNG file:

EDIT 2: The 3rd screenshot shows the 'Text' objects settings. Note I have changed Material to be my extracted one. 4th screenshot shows that Material's settings
enter image description here

sentences:
Binary Serialization of C# for GameObject in Unity? I'm trying to serialize a GameObject (with children and textures) using the binary serialization for C#.

It works with many data types but not with GameObject. In the docs it says should be serializable (http://docs.unity3d.com/ScriptReference/SerializeField.html):

  Serializable types are:
   - All classes inheriting from UnityEngine.Object, for example GameObject ....

I've read suggestions of using the asset of UnitySerialization, but that is overkill for me, I just need to store a GameObject on my scene (that will be generated by many users) and load them all in another scene.

This is the code (I'm following this tutorial: http://www.youtube.com/watch?v=J6FfcJpbPXE&feature=player_embedded)

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public class GameControl : MonoBehaviour {

    public static GameControl control;

    public GameObject drawing;
    public string drawName;

    void Awake () {
        if (control == null)
        {
            DontDestroyOnLoad(gameObject);
            control = this;
        }
        else if (control != this)
        {
            Destroy(gameObject);
        }
    }

    // Use this for initialization
    void Start () {

    }

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

    }

    public void Save ()
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/drawing.drawli");

        UserDraw data = new UserDraw();
        data.drawing = drawing;

        bf.Serialize(file, data);
        file.Close();
    }

    public void Load()
    {
        if (File.Exists(Application.persistentDataPath + "/drawing.draw"))
        {
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(Application.persistentDataPath + "/drawing.draw", FileMode.Open);
            UserDraw data = (UserDraw)bf.Deserialize(file);
            file.Close();

            drawing = data.drawing;
        }
    }

}

[System.Serializable]
class UserDraw
{
    public GameObject drawing;
}

Check the Save/Load functions. I'm just trying to store the "drawing" (GamObject), save it and load it. That's all! Is very simple. With other data types it works. But not with GameObject.

This is the (execution) error:

SerializationException: Type UnityEngine.GameObject is not marked as Serializable.

sentences:
Space to Switch to Hand Tool in Tile Palette? Hi I just download a Utility called: Hold Spacebar for Hand (drag) Tool
I read the code and I can understand it, but now I wondering how can I modify this to support the same functionality but works in Tile Palette tab, thanks!

sentences:
MMO Chat system methods I'm working on a little MMO game as a learning experience, the server coded in Python.

When a player logs in it pulls their character data from a SQL db and into server memory. It then uses memory for just about all things in the game and only uses the database again to back up the states at periodic save intervals, or when that player leaves/disconnects.

My question though is about the chat system. I've made chat systems before for websites where it just pulls from mySQL databases. But as I've learned accessing databases can be expensive for MMOs.

Currently in my build, chat is just sent to and stored locally by the player as and when it happens, but if an important guild message is sent while the player is loading between zones/channels then they don't receive it.

Is my current way the 'common' one? (just needing tweaks) Or should I be pulling chat from a SQL database? Or should chat be saved in server memory? Maybe its a mix...

Some pointers in the right direction would be great!

sentences:
What causes aliasing? I always hear about aliasing and anti-aliasing and I know what it looks like but what I don't understand is what causes it. Is it a physical phenomenon? Or a numerical one?

If it helps to explain, I have some programming knowledge, but not in video games or graphics.

sentences:
Get the dropped object using IDropHandler.OnDrop In Canvas, I drag some UI objects to a panel using this code:

public void OnDrag(PointerEventData eventData)
{
   Vector3 screenPoint = Input.mousePosition;
   screenPoint.z = 10.0f;
   Item2Drag.position = Camera.main.ScreenToWorldPoint(screenPoint);
}

But what I can't figure out is when I dropped an object on the panel, how can I get the gameObject which has been dropped?

sentences:
Efficient Rendering for multiple light sources I'm building a 3D rendering engine using C++ and OpenGL.

Right now, I've added support for multiple light sources in my GLSL shaders, but I've hit a bit of a bump for my rendering methods.

I'm worried about my engines performance if it has to render a lot of objects for a lot of light sources.

The straight-forward approach would be something like this:

for every object to be rendered
    closestLights []

    for every light in the scene
        if (light closer than all lights in closestLights)
            swap furthest light from closestLights with current light

    loadLightSourcesToShader(closestLights)

    renderObject(object)

However, I'm afraid the performance of this rendering-loop will degrade quickly since when either the amount of lights or the amount of objects increases, the amount of calculations will rise even quicker.

1) Is there any way to circumvent this?

2) How is this implemented in 'real' engines?

3) How can I find the closest K lightsources to an object efficiently?

I've heard about kd-trees and octrees, but I feel like building a tree everytime I render is probably worse than what I'm thinking about doing right now.

4) I could keep an octree and a kd-tree for every object (which keeps track of all other objects), which when using (smart) pointers, could be quite efficient in terms of time (but not space?).

Is this a good approach?

I know the saying 'Premature optimization is the root of all evil', but I'm pretty sure this WILL become a problem when a game/program reaches a certain complexity/size.

sentences:
How can I make item interactable for action? In this script when there is a detection I'm setting the flag detect to true and using in with other scripts. And using the clickForDescription flag and OnGui to display text description for each interactable item if there is a text for it.

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

public class DetectInteractable : MonoBehaviour
{
    public Camera cam;
    public float distanceToSee;
    public string objectHit;
    public bool interactableObject = false;
    public Transform parentToSearch;
    public static bool detected = false;

    private RaycastHit whatObjectHit;
    private bool clickForDescription = false;
    private bool clickForAction = false;
    private int layerMask = 1 << 8;

    private void Start()
    {

    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            clickForDescription = true;
            clickForAction = true;
        }

        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);
        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee, layerMask))
        {
            detected = true;
            objectHit = whatObjectHit.collider.gameObject.name;
            interactableObject = true;
            print("Hit ! " + whatObjectHit.collider.gameObject.name);
        }
        else
        {
            detected = false;
            clickForDescription = false;
            print("Not Hit !");
        }
    }

    private void OnGUI()
    {
        if (clickForDescription == true)
        {
            ProcessOnGUI(parentToSearch);
        }
    }

    void ProcessOnGUI(Transform parent, int level = 0)
    {
        foreach (Transform child in parent)
        {
            if (child.GetComponent<ItemInformation>() != null)
            {
                ItemInformation iteminformation = child.GetComponent<ItemInformation>();
                if (child.name == objectHit)
                {
                    var centeredStyle = GUI.skin.GetStyle("Label");
                    centeredStyle.alignment = TextAnchor.UpperCenter;
                    GUI.Box(new Rect(
                          Screen.width / 2 - 50 + 20 * level, // <== INDENTATION
                          Screen.height / 2 - 25, 100, 50),
                        iteminformation.description, centeredStyle);
                }
            }

            // Process next deeper level
            ProcessOnGUI(child, level + 1);
        }
    }

    public class ViewableObject : MonoBehaviour
    {
        public string displayText;
        public bool isInteractable;
    }
}

This is the ItemInformation:

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

public class ItemInformation : MonoBehaviour
{
    [TextArea]
    public string description;
}

Once object is tagged for Interactable and the ItemInformation is attached to it it will display some description for the item.

Now I want to do something for action. For example if the item is Interactable and a script name ItemAction is attached to it do some action, For example move the object from side to side or rotate the object. The logic should be like the Information. It's just with the Action there might be many options then just displaying text.

I'm not sure how to make some logic and how to work with the ItemAction.

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

public class ItemAction : MonoBehaviour
{

}

sentences:
vertices, better to have more but draw a smaller area or less but expand a larger area I have a simple question really. I am creating water for a game and had two different design approaches:

Make a single plane that expands the entire playspace, which would take 6 vertices but cover a much larger area. The idea being the plane would be at a certain height so the sourrong land if higher should cover it.
Check at regular intervals around the created land, ask if the height of that peice of land is below a certain height if so, draw a small square to cover the area and then check the next interval and the next... The idea being you'd have a lot more vertices but much less area will be drawn.

Any help would be appreciated as to which design approach makes more sense.

sentences: AndroidManifest file was deleted by accident I deleted the AndroidManifest file of my project which was located in Assets\Plugins\Android , so I tried creating new project and copying the Assets and everything but it seems that something is missing ,it's perfectly working in the editor , but as apk there are few things aren't working, I can't figure out why, and there isn't even a Plugins folder in my new project !

sentences:
How do I know my VRAM upload is ready to be used? Previosuly in Direct3D 9 and 11, if I wanted to update a resource in a Default heap, for example, a Vertex Buffer, I would lock the memory of the buffer, copy the data to the returned pointer, and then unlock the buffer. It is my understanding that unlocking the buffer committed the data to VRAM, and I could be certain that the buffer would be ready to be used by any draw commands.

With Direct3D 12, we now have the concept of upload heaps, and instead of locking the buffer each time I want to modify it, I can just get a mapped pointer to the VRAM area with ID3DResource::Map(). This is pretty cool, because I understand that in most cases, the write is performed with write combining, so I don't have to wait until the entire data is committed to VRAM to keep on doing work on the CPU.

Now the question is, how can I ensure that when I execute a GPU command that references that memory, the memory is already committed, and the GPU can safely read it?

sentences: How do you make money from html5 games (i.e sponsorships)? I make games with flash and I am interested in making games in html but I haven't seen any companies or websites which are willing to buy these games (i.e game sponsorships). I was hoping somebody could tell me about a company who would do this or why people don't buy html games?

sentences:
How can I reference the frontmost part of a mesh in my Unity code? (and help making FPS projectiles seem more real) I have started making a PC game using Unity. It's just a test project, where I'm making as basic as possible FPS shooter.

I'm using the FPS Controller prefab, and I have also a rifle model attached to it. The result is pretty much what I wanted.

Now I'm considering how I want to create projectiles for the gunfire. I think it will be best for me to create each bullet as just being a ray from the gun barrel heading forwards, OR I might create rigidbodies from the gun barrel I'm not sure yet.

My question is: What is the proper way to reference the point in space in which the gun barrel current ends? At the moment, I am thinking just attach ANOTHER gameObject to the gun model, and just manually position it where the barrel finishes. But this seems 'cheaty' and I think perhaps there is a better way (something like mesh.position.z + mesh.length, but I can't seem to find anything like mesh.length).

I haven't posted code at all, because I haven't really written any on this project yet.

I would also be very interested to hear the pro-tip version of how best to simulate this gunfire (ie. is it best to use rigidbodies? or somehow use raycast or something? or some better way that I haven't even dreamt of)

sentences:
Earth and sun - How to make the sun revolve around the earth in the following code? I want to imitate the planetary system with Earth and Sun drawn as solid spheres on the same window. I have drawn the two: the earth as the bigger sphere and the sun as the smaller sphere.

Now I want the earth to revolve around the sun when I press key A and when I press key B the earth must rotate around its axes. How do I achieve this? Thanks.

Here is the code so far:

 #include <GL/glut.h>
 void init(void){
 glClearColor(0.0,0.0,0.0,0.0);
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }
 void display(void){
 glClearColor(0.05,0.05,0.5,0.0);
 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 glColor3f(0.03,0.05,0.09);
 glutSolidSphere(0.5,30,30);//Earth
 glMatrixMode(GL_MODELVIEW);
 glLoadIdentity();
 glTranslatef(.7,.7,.7);
 glColor3f(1.0,1.0,1.0);
 glutSolidSphere(0.2,50,50);//Sun
 glLoadIdentity();
 glFlush();

 }
int main(int argc, char **argv){
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowPosition(10,10);
glutInitWindowSize(400,400);
init();
glutCreateWindow("Planets");
glutDisplayFunc(display);

glFlush();
glutMainLoop();

}

sentences:
Generating a set of islands in real time With thismethod I can create multiple separated islands just by randomly choosing a point as the center for a gradient. Now what I want to do is to have a system of real time generation like the one in Minecraft.

When I generate a new chuck, some random points inside of it are chosen to be the center of a gradient. However, if one of these points gets positioned near the border of the chuck, the gradient will cross the border and affect the other chunk. But if that other chunk was already generated and visited by the player, I couldn't update that chunk to include the new gradient, so I would end up with something that looks like this:

What could be a method to avoid this?

sentences:
Do games use threads? I 'understand' that the concept of how a game runs i.e

while (game_loop = true)
 {
  //handle events
  // input/output/sound etc
 }

But it has come to my attention while programming in another HLL is do some games use threads for certain operations? For example take any Pokemon game ; during interaction a textbox appears to display information. Now I've been trying to simulate that sort of textbox and the only way I could have got it to be exactly the same is by using a loop and yes once a loop is started there is no way to handle window events unless they are handled again inside the loop itself.

I couldn't have used this loop inside a different thread other than the main one (due to a DirectX limitation) so the only option was to use it inside the main program thread. I was wondering if some games work like this ; do they only use the main program thread and handle events again if they're inside a loop?

Edit: I forgot to mention this is about console games not PC games!

Thanks
Nubcake

sentences:
Enable and disable different component on a Gameobject So far I am not clear how do you actually access the various components on a game object, to enable and disable them.

I have a component that has various scripts and elements, like a camera, transform, audio listener and few other custom scripts.

It is in the scene, so I try to access to it via script:

private GameObject _player;

_player = GameObject.Find("the_player")

So far so good; if I want to access for example to the camera, and enable or disable it, I can do it

    _player.GetComponent<Camera>().enabled = true;

This disable correctly the camera, or eanble it, depending from the paramenter that I pass.

Now, if I want to access my script, called "playerscript"; I can't do the same thing, since I get an error:

    _player.GetComponent<playerscript>().enabled = true;

Not sure why I get an error; I have a class that is called "playerscript", that is attached to that _player object, but instead, VS complain.

This is the error message:

Error   CS0246  The type or namespace name 'playerscript' could not be found (are you missing a using directive or an assembly reference?)

I did try to use also GetComponentInChildren, but the result is the same.

If I have the object _player, which hold a reference to the original game object instantiated in the scene, why I can't simply access all the elements attached to it, via GetComponent and dot notation? I believe this used to work time ago, but in Unity5 I can't get this to work.

EDIT: This is the content of the playerscript class:

using UnityEngine;
using System.Collections;

public class playerscript : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        // get the instance of the button from UI manager
    }

    void OnTriggerEnter(Collider world_item)
    {
        //enable item animation
    }

    void OnTriggerExit(Collider world_item)
    {
        //disable item animation
    }
}

sentences:
Specific path for ai for follow I have an entity's following details:

x, y
vx, vy
angle to x axis
its target

I want to reach the target by a parabolic path, how to implement an ai that follow a particular path from any given point to another like parabolic or sine wave.

sentences:
Idle game: calculating resource generation/consumption I'm making an idle game in the vein of Melvor Idle and I've run into a problem calculating the yield and consumption of resources while the user is away. For those who don't know, many idle games have a feature where they'll still "run" while the user is away. I say "run," because they most likely just save the user's log off and login time and then determine any offline yield based on that time delta, e.g. if I quit when I'm cutting wood @ 1 log per minute, when I get back an hour later, the game will calculate that I gained 60 logs in the interim by multiplying the time I was gone by task completion rate.

However, tasks can be more complex than simply getting a resource every minute. Tasks can consume some resources to generate another, e.g. turning ore into ingots, if there is no resource to consume, the task is cancelled. Tasks can also be exhausted and need to recharge, e.g. after doing a task 10 times, it needs to cool down for 2 minutes (look at mining in Melvor for example). I would also like players to be able to perform multiple tasks at once.

So, each task has the following features:

time: integer; how long it takes to complete one task in milliseconds
cost: a list of tuples of the form (resource, count), e.g. (ore, 5)
yield: a list of tuples of the form (resource, count), e.g. (ingot, 1)
charges: integer; the number of times this task can be completed before needing to cooldown
cooldown: integer; cooldown time in milliseconds

And I maintain a list of active tasks in the game's overall state.

You can see how this complicates the delta calculation. I can very easily deal with this if I ignore cost. The total yield can be modeled by this function multiplied by the task's yield:

function tasksCompleted(time: number, taskTime: number, taskCharges: number, taskCooldown: number) {
  if (!taskCooldown)
    return time / taskTime
  if (taskCharges <= 1)
    return Math.floor(time / taskCooldown)
  let upTime = taskTime * taskCharges;
  let totalTime = upTime + taskCooldown
  let tasksCompleted = Math.floor(time / totalTime)
  let tasksRemainder = time % totalTime
  return Math.min(charges, Math.floor(taskRemainder / taskTime)) + charges * tasksCompleted
}

I just don't know how I'd easily find the x intercept of this function so I can figure out when the cost of the task outpaces the player's resource pool. Further, imagine the player is running 2 tasks that both exhaust the same resource but have different completion times, charges, and cooldowns, how do I combine these functions to find the intercept?

My question is: is there an optimal way to represent this problem, and if not, how might I simplify it to achieve as close to the desired results as possible?

Potential solutions I have come up with so far, but don't particularly like:

Calculate yields iteratively rather than with a function and a delta. This avoids the complex math because if I ever run out of a resource, I'll know mid-loop. I don't like this because it means that the game has to essentially run X hours of game the instant the user logs back in.
Do what Melvor does and only let users perform one task and don't let tasks with cooldowns have costs. This simplifies things, but performing multiple tasks is a core mechanic to the game design, and I'd rather not lose that.
Give each task an "offline function" which would be a simple linear function that I could more easily compute. I'd still have to figure out how to combine linear functions in the code and I don't like losing the fidelity, but it could work.

I'd appreciate any advice you could give me!

sentences:
Can I create relative filepaths to images in an XCode SDL project? Can I create relative filepaths to images in an XCode SDL project?

I have to use absolute filepaths as it is, but it would be much easier if I could make the filepaths relative.

sentences:
In Android, neat way to send input info from `GLSurfaceView` to `onDrawFrame` in `GLSurfaceView.Renderer`? The input is pinch/drag for camera movement, which modifies a matrix to scale/translate, and sent to a vertex shader. It's working, but ugly.

What's the proper way to do it?

I've noticed:

GLSurfaceView gets onTouch callbacks; but Renderer has access to GL.
Shaders and textures can only be loaded after the onSurfaceCreated() callback, so should be loaded there?
Touch and graphics are on different threads, so should  use queueEvent() or similar.

Is there a game/app on github that's a good example to follow?
Thanks for any help!

sentences:
How can I stop transform.position from being modified when adding a child object? I suspect there is a well-known and easy to explain reason for the behavior I'm seeing, but I am having difficulty explaining it (and likely not able to Google for the answer).

When adding a child GameObject to a translated parent, the child's localPosition is modified so that the child's position stays the same after  the parent's transformation is applied. Is there a way to not have this be the case?

In the following example, I create a parent object and move it to (1,1,1), and then attach the child. I would like the child's position to be (1,1,1), that is (0,0,0) relative to the parent. However, the child's position is modified to be (-1,-1,-1) so that it is (0,0,0) relative to the world.

Here is a repro:

// Create parent.
GameObject parent = new GameObject();
parent.name = "Parent GameObject";
parent.transform.parent = foregroundObject.transform;

// Move the parent.
parent.transform.Translate(1, 1, 1);

// Add a child under the parent GameObject.
GameObject child = (GameObject) GameObject.Instantiate(guildiePrefab);
child.name = "Child GameObject";

child.transform.parent = parent.transform;

// PROBLEM: localPosition is set so that the "global" position is (0,0,0).
// How can I add the child object and have its position be (1,1,1)?
this.Assert(child.transform.localPosition.ToString() == "(-1.0, -1.0, -1.0)");
this.Assert(child.transform.position.ToString() == "(0.0, 0.0, 0.0)");

Is there a different way I should be adding child as a child of parent? Or, should I always zero-out the position of parent before adding a child? If that is the case, any reason why I need to do this? What is the rational for this design choice?

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

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

sentences:
How to create a walkable 3D terrain I want to make a terrain for a RPG game that I'm developing. I started modeling the surface and implementing it to my game, but now I realized that i might be doing everything wrong. So I would like to ask a few questions:

How should I make the surface Model?

I'm developing my game without an engine, so I have to do coding for everything (Java, LWJGL). I use Blender to model the surface, and I export it to an .smd model file.

How to detect intersections between the surface and other models?

I guess I need to detect intersections, to make the terrain walkable. The problem is that I don't know the best and easiest way to do that. I tried making a triangle-triangle intersection detection algorithm, but it was to hard for me, and I guess I need something faster and simpler.

sentences:
How to calculate angle for shooting bullet in 3D? What I want to know is if I can calculate an angle similar to how I'm doing in 2D and update the x,y,z position of a bullet based on that angle in a similar manner I'm doing the update function below.

I wrote this function in Ruby to find the target angle between two 2D (x,y) vectors, but now I want to find out how to do this in 3D in a similar way:

  def target_angle(point1, point2)
    x1 = point1[0]
    y1 = point1[1]
    x2 = point2[0]
    y2 = point2[1]
    delta_x = x2 - x1
    delta_y = y2 - y1
    return Math.atan2(delta_y, delta_x)
  end

Given an object (like a bullet in this case), I can shoot the object given a target_angle between the player (x,y) and the mouse (x,y), as such in the bullet update function:

  def update
    wall_collision
    # the angle here is the target angle where point 1 is the player and
    # point 2 is the mouse
    @x += Math.cos(angle)*speed
    @y += Math.sin(angle)*speed
  end

Is there a similar method to calculate a target angle in 3D and use that angle in a similar manner as my update function (to shoot a bullet in 3D)? How can I make this work for two 3D vectors (x, y, z), where you have the player position (x,y,z) and some other arbitrary 3d point away from the player.

sentences:
Adding Animation to Object—Unexpected Behavior I've been following the Unity 2D roguelike tutorial and I'm a bit confused about something. When he drags a series of sprites to his player object, a dialog box appears that prompts him to name and choose a location for his animation. I have seen this behavior in a couple video tutorials now.

When I do this, it simply creates the animation and animation controller in the sprite folder and nothing more. This becomes a bit tedious after a while and I'm not sure these animations are being associated with the object correctly.

What am I doing wrong?

sentences:
Matrix operations to flip 3d models front to back, without changing position Multiple 3D objects look to be in the correct screen position, and I can move around them and this continues to be true, but each one looks like it is flipped back to front (I can see the backside of the object as if the camera were on the other side of it).

Any clues to why this may be happening in addition to correcting it would be welcome also- I'm getting a transform matrix from one api what is documented as OpenGL 4x4 matrix format, but my underlying api (bgfx) is wrapping opengl so may be assuming another format.  I can probably go get the transform in different format, but now I'd really like to know how to correct this also if there was no option but to start with the opengl matrix.

sentences:
Playing with hashmap in drawing I'm developing a game in Java for Android, using LibGDX.
In my render(), between the batch.begin() and batch.end() I'm running through all the game objects and draw them.

Every game object is stored in a list, which that list is stored inside a hash map. I iterate through this hash map, getting every list and going through that list, like this:

    batch.begin();
    Iterator it = objectsMap.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        Array list = (Array) pair.getValue();
        for (int i = 0; i < list.size; i++) {
            GameObject object = (GameObject) list.get(i);
            drawObject(object);
        }
    }
    batch.end();

My drawObject() code:

private void drawObject(GameObject object, float x, float y) {
    if (object == null) {
        return;
    }
    if (object.getVisibility()) {
        TextureAtlas.AtlasRegion currentFrame = object.getCurrentFrame();
        if (currentFrame != null) {
            float objectAlpha = object.getAlpha();
            Color color = batch.getColor();
            if (objectAlpha != 1) {
                color.a = object.getAlpha();
                batch.setColor(color);
            }
            batch.draw(currentFrame, x - object.getOriginX(), y - object.getOriginY(), object.getOriginX(), object.getOriginY(), currentFrame.getRegionWidth(), currentFrame.getRegionHeight(), object.scaleX, object.scaleY, object.getSpriteDirection());
            color.a = 1;
            batch.setColor(color);
        }
    }
}

A method called setRegion() sets the current animation frames of the object:

protected void setRegion(String name, float frameDuration) {
    currentFrame = atlas.findRegion(name, 0);
    if (currentFrame == null) {
        currentFrame = atlas.findRegion(name, -1);
    }
    width = currentFrame.getRegionWidth();
    height = currentFrame.getRegionHeight();
    animationStateTime = 0;
    animation = new Animation(frameDuration, atlas.findRegions(name),      Animation.PlayMode.LOOP);
}

And in the update() of the objects this is called:

            currentFrame = (TextureAtlas.AtlasRegion) animation.getKeyFrame(animationStateTime, isLooping);

The getCurrentFrame() method only returns currentFrame variable.
The alpha is a field with a value between 0 and 1. (getAlpha() returns only the field)

My question is that considered a "heavy" activity? Can this be a significant impact on the FPS values? Because I'm running my game on old devices (like Galaxy S2) and the FPS can get pretty low values. I'm trying to find the cause to it.
I used to have a reference to every list but with the time I realized I'm going to have too much lists, so I decided to do it like this. Maybe you know a better way of holding references to all game objects?

Thanks!

sentences: Unity - Access animation clips/motion of an animator So I have an animator on my GameObject. I need to change the animation clip/motion of different states in my animator to the one I assign in my EditorGUILayout.ObjectField. Problem is, I have no idea how to access those clips. This is purely Editor Scripting.

sentences:
Explanation of the parameters in the line intersection code I am trying to understand a C code that moves the mesh nodes for each time step and i am totally struck on the parameters t1 and t2 please help me sorting this out.
So here is what the function gets (Xa,Ya) (Xb,Yb) (Xc,Yc) and (Xd,Yd) where (Xc,Yc) is the origin (0,0) about which mesh rotates now i have a function that calculates t1 and t2 and (i think t1 is the parameter in barycentre form of line that gives intersection point between two line formed by (Xa,Ya)(Xb,Yb) and (Xc,Yc)(Xd,Yd)) and i have no idea what t2 is...

The code is

static void find_t(real xa, real ya, real xb, real yb,
             real xc, real yc, real xd, real yd,
             real *t1, real *t2, int * flag)
{
  if((xd==xc)&&(xb!=xa))
  {
    if(yd==yc)
    {
      Message0("\nc and d are the same points-aborting!!!\n");
      exit(0);
    }
      (*flag) = 2;
      (*t1) = (xc-xa)/(xb-xa);
      (*t2) = ((yb-ya)*(*t1)-(yc-ya))/(yd-yc);
   }
  else if((xd!=xc)&&(xb==xa))
   {
     if(yb==ya)
     {
        Message0("\na and b are the same points-aborting!!!\n");
        exit(0);
      }
        (*flag) = 2;
        (*t2) = (xc-xa)/(xc-xd);
        (*t1) = ((yd-yc)*(*t2)+(yc-ya))/(yb-ya);
      }
else if((xd==xc)&&(xb==xa))
      {
         (*flag) = 0;
         return;
      }
else
     {
       real k1, k2;
       k1 = (yd-yc)/(xd-xc);
       k2 = (yb-ya)/(xb-xa);
       if(fabs(k2)>=fabs(k1))
   {
     if(k1==k2)
     {
        (*flag) = 0;
        return;
     }
      (*flag) = 1;
      (*t1) = (-k1*(xc-xa)+(yc-ya))/((yb-ya)-k1*(xb-xa));
      (*t2) = ((xb-xa)*(*t1)-(xc-xa))/(xd-xc);
     }
  else
     {
       (*flag) = 1;
       (*t2) = (-k2*(xc-xa)+(yc-ya))/(-(yd-yc)+k2*(xd-xc));
       (*t1) = ((xd-xc)*(*t2)+(xc-xa))/(xb-xa);
     }
    }
       return;
       }

and the value returned is used to update the mesh point if the following condition is satisfied

  if(((flag==1)||(flag==2))&&(t1<=1+cal_small_number(j))&&(t1>=-cal_small_number(j))&&(t2>=0))

  {
     (*x) = (1-t1)*pt1[0] + t1*pt2[0];
     (*y) = (1-t1)*pt1[1] + t1*pt2[1];
      return;

  }

please can some recognize what t2 is and correct me if my thought about t1 is wrong,The point(*x,*y) i get is the intersection point between two lines

sentences:
Unity sizeDelta of an Image update opposite to what it should I have an IEnumerator coroutine in which I call the UIManager script to update the Image size to fit the text size but it doesn't happen. when I use yield return new WaitForEndOfFrame() it sometimes solve the problem. but I don't want to use it.

edit: I tested the code like I was suggested in an empty unity project and it still happens, the width should change according to the text size but it happens opposite (when the text is small the width of the image is large and when the text is large the width of the image is small) (it only happens correctly at the first time - the width of the image fits the text width)

public class Example : MonoBehaviour
{
    public Image image;
    public Text text;
    private int k = 0;

    public void ButtonClick()
    {
        text.text = (k % 2 == 0) ? "10" : "10 / 10";
        image.rectTransform.sizeDelta = new Vector2(text.rectTransform.rect.width, 30);
        k++;
    }
}

edit: Solved! thanks for the help, Canvas.ForceUpdateCanvases() did the trick

sentences:
Get range of hexagon based on specified center I have this method to get the cells inside a given N range:

public function getRadius($range, $center) {
    // $center[0] = X or Q
    // $center[1] = Y or R
    $cell = array();
    for ($dx = -$range; $dx <= $range; $dx++)
    {
        for ($dy = max(-$range, -$dx - $range); $dy <= min($range, -$dx + $range); $dy++)
        {

            $ddy = $dy + $center[0];
            $ddx = $dx + $center[1];

            $cell[] = array($ddx,$ddy);
        }
    }
    return $cell;
}

But it returns bad coordinates by adding the offset on the delta X and delta Y.

sentences:
Having trouble with getting an image to fit on a face of a cube I have a problem with a Unity project that I'm working on. I'm creating an 3D art gallery which will be developed into a VR application in the future.

In a 3D scene, I have created a paint canvas GameObject (a cube) but I have some trouble getting images fit on the whole canvas. When I try to apply an image as a material, it is treated as a texture and only a small part of the image is visible on the canvas.

I am planning to make a UI where the user can upload pictures and the application will automatically render the gallery with these pictures.

sentences:
Creating a curve path for gameObject which reacts to Triggers I am trying to create a path for a gameObject which will bounce off other gameObjects if it hits them. Can I get an idea on how I could possibly get this curve path set up.

Stuck on ideas. I don't want to use ITween and I can't simply define the entire path via ITween either. I need to account for whether it hit another gameObject and cause it to carry on the path or just fall through.

Attached the image below for clarification. I need the circle(purple) gameObject to bounce along the white path provided the rectangle(green) gameObject is in place to cause a Trigger and let the path carry on or the circle gameObject just simply falls through.

There is only 1 green gameObject at any point of time which moves to one of the 3 possible positions. Placed 2 just for clarification.

sentences:
Getting screen coordinates of actor I'm trying to tell if an actor exists at a screen position so I can do something if the actor is clicked on. To do this, I first need to get the screen coordinates of the actor so I can compare it to the coordinates where I click, however, I am having some difficulty. I am currently trying to do this:

Actor actor = ...
// The position where I clicked obtained from touchDown() in my InputAdapter
Vector2 screenPos = ...
Vector2 actorStagePos = actor.localToStageCoordinates(new Vector2(0,0))
Vector2 actorScreenPos = actor.getStage().stageToScreenCoordinates(actorStageCoordinates)
Rectangle actorScreenBounds = new Rectangle(actorScreenPos.x, actorScreenPos.y, actor.getWidth(), actor.getHeight());
if (actorScreenBounds.contains(screenPos))
{
    System.out.println("An actor is there")
}

However, the coordinates don't seem to be converting correctly. They end up slightly below and to the right of where they should be. At first, I thought this was caused because I'm scaling some of the Image actors, but it also did not work when nothing was scaled up.

sentences:
Which are the most complete DirectX game or technical demo with source available I have found plenty of games with source for OpenGl, but so far I haven't found anything like that for DirectX. There are plenty of examples in the SDK, but they are very basic and usually they just expose one very specific aspect of the API at a time.
So I am wondering which are the best or most complete DirectX games with source available these days.

EDIT

I am making a small study about the differences in the final output across different GPUs. I want to have games in DirectX and OpenGL. To remove any differences caused by non-determinism, like thread scheduling and timing information. I already have done it for Doom 3 which is a great example for OpenGL. I would like to have something in DirectX to perform similar tests with, and I was hoping I could find something better than the simple demos included in the SDK.

sentences: Does "Object.ToString().GetHashCode()" return a truly unique character seed? In my game I'm generating a character seed from a bunch of traits that the player chooses. The traits are all part of a Enum. In unity I've attached a script to a bunch of toggles. When the player selects a toggle I do this :  charGen.testCharHash += trait.ToString().GetHashCode(); Does this guarantee that I will have a unique number generated based on the players choice ?

sentences:
Non-integer speed values - is there a cleaner way to do this? Often I will want to use a speed value such as 2.5 for moving my character in a pixel-based game. Collision detection will generally be more difficult if I do that, though. So I end up doing something like this:

moveX(2);
if (ticks % 2 == 0) { // or if (moveTime % 2 == 0)
    moveX(1);
}

I cringe on the inside every time I have to write that, is there a cleaner way to move a character with non-integer speed values or will I remain stuck doing this forever?

sentences:
Good, free isometric game engine? Any recommendations for a good isometric game engine that is also free?

Should be possible to develop entirely using freely available tools (meaning: no Flash, and no I don't want to learn haXe...)
Works-in-a-browser is a plus, but not required.
Support for 32-bit images is required!
Good performance.
Excellent documentation.

I have looked at FIFE but it is still too unfinished, and the documentation sucks!

sentences:
How to get the maximum installed version of DirectX? Okay, So I would like my engine to detect weather or not it can use DirectX 10, if it can't it defaults to DirectX 9.0c but, the function DirectXSetupGetVersion() will only return Versions 5 through 9. Could someone point me to what could tell me the device capabilities?
Thank you for your time.

sentences:
Qix diagonally adjacent movement I'm implementing a Qix clone game and I do not have any problems with implementation but rather with possible scenario.
Is this a valid scenario for this game and if yes how exactly should gameplay go in this case?
Black - Filled, Red - Current Player's Path, Blue - Player

If this is a possible scenario, then after completing the path player will end up with two diagonally adjacent rectangles.

After that player can start moving from the bottom of the top rectangle to the right.

In this case it should be immediately considered as a complete path and fill 1x1 square or player can create a path adjacent to the top of the bottom rectangle?

sentences:
Efficient datastructure to store a galaxy map I'm working on a project for an intro level Ai class, and the project I've closen is to create a simulated universe in which Ai actors play against each other economically and militarily. I have the actual Ai fundamentals planned out, but I've hit a bit of a snag in trying to properly store the randomly generated game world.

The solar system objects are generated and populated randomly and the aim I'm going for is to place them in a 3d world, with x,y,z positions relative to a galactic center.

Each system should be reachable from any other system, limited only by the jump range of a given ship. Which I assume would mean that id need a 3d bounding algorithm to determine what other systems are in range.

For storing them, would a weighted edge graph be best, although the number of edges would be huge as in theory each system is reachable from any other. Or would an octree be better. And if so how would I calculate a list of reachable systems from the current system with an octree.

sentences:
Where can I find some beginners to learn and work with? I am very new to game programming. I am currently studying Java (Android mainly) and I know what it takes to make a game, as well as how to render it via OpenGL. Finding some others at nearly my level I think would motivate me more and give me some experience to working with others. Do you know a good place to find some people?

Thank you in advance!

sentences:
How can I get a 4x4 matrix from a bullet quaternion? I'm trying to make a game using JavaScript with Ammo.js ( an implementation of bullet ) and Sylvester to do my matrix maths. The problem is I don't know how to turn the WXYZ that bullet gives into the 4x4 matrix Sylvester needs.

If there is a way to just get Bullet Physics to give me the 4x4 matrix please tell me! I am completely lost here.

sentences:
How can I detect a perfect passageway for collision detection? The problem is when I move diagonal it moves fractions of units and therefore my coordinates might be a fraction of a unit say (40,400) might be actually (40.12,400.40) but another problem is my pink square might be moving really fast. Below is a screenshot where you can see I can make it past a pixel perfect passageway with my pink square but the other passageway with the white square is very difficult if not impossible to make it through (I have by zooming in and moving REALLY slow but sometimes it impossible for the reasons listed above) Suppose in the example above I am holding the up and left arrows how can I make it so the pink square slides across the yellow rectangle and detects it can move upward and begins to move up?

The code I am using right now looks like this

float d45 = (float) (1 / Math.sqrt(2));
moveX = -d45;
moveY = d45;
moveX = moveX * t * speed;
moveY = moveY * t * speed;
        for (Stuff s : collidables) {
            if (overlaps(s, moveX, 0)) {
                collidedX.add(s);
                x += moveX > 0 ? s.x - width - x : s.x + s.width - x;
            }
        }
        if (collidedX.size < 1) {
            x += moveX;
        }
        for (Stuff s : collidables) {
            if (overlaps(s, 0, moveY)) {
                collidedY.add(s);
                y += moveY > 0 ? s.y - height - y : s.y + s.height - y;
            }
        }
        if (collidedY.size < 1) {
            y += moveY;
        }

I check for collision twice once on the Y axis and another on the X axis so that it can still slide to the left even if you are pushing the up and left arrow. The problem is it skips over the 100 unit passage to the left of the picture above. If I create a passage that is 110 units wide it will slide up fine but this isn't really cool because I like how it looks where it slides perfectly. Any ideas?

sentences:
How to get a list of parameters from a material in UE4? TLDR: how to access the parameters of a given material/material instance in BP and/or C++.
I would like to expose material parameters to the UI so the player can edit material instances at runtime(i.e. color, roughness of objects, etc).
I have a base class, that is the parent of everything in game; that has a variable of type Material Instance Dynamic called WMaterialInstance. It also has an Interface function to return that var.
Please see the construction script.
I'd like read parameters of this instance and expose it to the UI somehow.
But I can't get those parameters...
I am using a Get Scalar Values node to get my params...
I tried feeding it a Material Instance Dynamic reference, but my Print String nodes return zero, although there are parameters on the material, 100%.
Please see the BP nodes here.
I found a post describing a similar issue.
One of the answers says:

That node is a bit silly, it doesn't work with dynamic material instances, only constant. What you can do is get the parent of the material instance you're creating, cast it as a MaterialInstance (not dynamic), then get the scalar parameters of that one. If you need the values too you can use a for loop with the scalar parameter array as the input, break the array element and hook the Name into a GetScalarParameterValue (from your dynamic material instance) in the loop.

So I got the parent of my Material Instance Dynamic and tried casting it to just a normal MaterialInstance, but the cast seems to fail, if I feed the parent to it...
Here is how I did it.
Note: the Get Material node is my interface call to the Dynamic Instance from construction script, not the built in one.
Further down in the post there is an answer saying:

Well you need to have an actual constant material instance first,
create that by right clicking your material and creating a material
instance in the content browser. Then create your dynamic version from
that.

I created a material instance from my original material and assigned it to one of the child classes of the baseclass, so I use that one in the base construction script.
Still, doesn't want to work...  I get the same zeros and cast failures...
I noticed, that if I Print String the Display name of the Parent I get from the accessed base material it prints WorldGridMaterial, which means, it did not find what it supposed to...
Did anyone experience something similar?
Is there a better way to access these parameters?

sentences: Rotate a single member of a group I have a Group object comprised of 2 actor members. Each member in the group can have their height, width, and positions scaled and set independently with no issues. However, attempting to utilize setRotation() or rotateBy() on an individual member of the group does not cause the member to rotate. The entire group can be rotated at once, but not an individual member in the group. Is there a way to rotate a single actor member that is part of a group?

sentences:
How can I store tile maps as PNG images? I want to let players of my top-down game save, load and share worlds as PNG images. How do I read the colors in a PNG file or change them?

I imagine something like this:

BufferedImage mapImg = ImageLoader.loadImage(path);

// (then, later)

for(x = 0; x < mapImg.width; x++) {
    for(y = 0; y < mapImg.height; y++) {
        // Look up the color at this position
    }
}

Here is my ImageLoader class:

public class ImageLoader {

    public static BufferedImage loadImage(String path) {
            try {
                return ImageIO.read(ImageLoader.class.getResource(path));
            } catch (IOException e) {
                e.printStackTrace();
                 System.exit(1);
            }
            return null;
    }
}

sentences:
How to tell right from left: Finding the vector pointing towards the right side of a character? We have two vectors:

Pointing from the floor to a 3d character's head.
Pointing from the character towards where it's facing.

How do I find the vector point from the character towards the right?

The vector has to be orthogonal with the other two but also face in right direction and not to the left.

This is very similar to the question: Determining if something is on the right or left side of an object?
But I just want the math to computer the third vector from the first two.

sentences:
Get Specific depth values in Kinect (XNA) I'm currently trying to make a hand / finger tracking with a kinect in XNA. For this, I need to be able to specify the depth range I want my program to render. I've looked about, and I cannot see how this is done. As far as I can tell, kinect's depth values only work with pre-set ranged found in the depthStream.

What I would like to do is make it modular so that I can change the depth range my kinect renders. I know this has been down before but I can't find anything online that can show me how to do this.

Could someone please help me out?

I have made it possible to render the standard depth view with the kinect, and the method that I have made for converting the depth frame is as follows (I've a feeling its something in here I need to set)

  private byte[] ConvertDepthFrame(short[] depthFrame, DepthImageStream depthStream, int depthFrame32Length)
    {
        int tooNearDepth = depthStream.TooNearDepth;
        int tooFarDepth     = depthStream.TooFarDepth;
        int unknownDepth    = depthStream.UnknownDepth;
        byte[] depthFrame32 = new byte[depthFrame32Length];

        for (int i16 = 0, i32 = 0; i16 < depthFrame.Length && i32 < depthFrame32.Length; i16++, i32 += 4)
        {
            int player      = depthFrame[i16] & DepthImageFrame.PlayerIndexBitmask;
            int realDepth   = depthFrame[i16] >> DepthImageFrame.PlayerIndexBitmaskWidth;

            // transform 13-bit depth information into an 8-bit intensity appropriate
            // for display (we disregard information in most significant bit)
            byte intensity = (byte)(~(realDepth >> 8));

            if (player == 0 && realDepth == 00)
            {
                // white
                depthFrame32[i32 + RedIndex]    = 255;
                depthFrame32[i32 + GreenIndex]  = 255;
                depthFrame32[i32 + BlueIndex]   = 255;
            }

         // omitted other if statements. Simple changed the color of the pixels if they went out of the pre=set depth values

            else
            {
                // tint the intensity by dividing by per-player values
                depthFrame32[i32 + RedIndex]    = (byte)(intensity >> IntensityShiftByPlayerR[player]);
                depthFrame32[i32 + GreenIndex]  = (byte)(intensity >> IntensityShiftByPlayerG[player]);
                depthFrame32[i32 + BlueIndex]   = (byte)(intensity >> IntensityShiftByPlayerB[player]);
            }
        }

        return depthFrame32;
    }

I have a strong hunch it's something I need to change in the int player and int realDepth values, but i can't be sure.

sentences:
How to run code as an instance you just created in GML Alright, I'm looking how to create an instance, and then run a chunk of code on the instance I just created, and not have that code run on any other duplicate instances.

Noob question, I know. Please help though?

sentences:
Combining raster textures with vector graphics. How can I do this? (See image) I'm developing an art style that combines pixel art with simple vector graphics, but I'm feeling lost and need clarity what is technically possible within game engines.

First of all, take a look at this image:

How can I achieve this look with game engines/libraries? Is it even possible?
What can you recommend?

The game is supposed to run on PC, 60fps preferable, uses pixel sprites for smaller objects, while using simple shapes to represent very large objects. I want it to have a lighting system, all shapes must be able to rotate, move and scale at runtime and have seamlessly tiling pixel art textures drawn on top of them.

sentences:
Multiple planar reflections works weird in UE4 When I add multiple planar reflections for arch-viz, some of them on glasses don't have any result, but ones on mirror works properly.
Sometimes all the planar reflections on glass are invalid. But after restart the engine, the reflections get back to normal.
Any clue to fix it? Or it is the Engine limit.
(No ray tracing.)
Below are my material settings.
Glass material:

Mirror material:

sentences:
"The Object you want to Instantiate is null" But it works, can I ignore the error? This has never happened to me so I'm a bit confused.

GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;

This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.

Can I ignore this error or is there some problem that I'm not seeing?

sentences:
How to write a good functional spec for a game? I am basically (shamelessly) copying a question that has appeared on SO few years ago. The answers are good, but I would like to get more on this topic, so I'm trying a more specialized subreddit substackexchange. What I'm secretly hoping for is an answer from Byte56, I wonder if he has wrote a spec for AoG? :)

I'm trying to write a functional spec for a game according to Joel's article series (who wouldn't love anything this genius guy writes) and I'm not happy with my current approach. It's much easier to write a functional spec for a web application, or a website (my full-time job is still web app development) where I can describe every possible screen in a separate chapter, and also scenarios are easier to come up with.

The game is a turn-based logic/puzzle game, but it's fast and fun enough to play for many audiences, so:

Should I write scenarios based on various gamer types (e.g. nervous FPS players, macro-obsessed strategy guys, solitaire loving housewives, etc.) and try to describe what will they expect from the game and how will they use it?
What should represent "screens" in the spec; the game screens (e.g. menu, loading screen, main game screen, etc.) or should I rather describe all different possible in-game situations as screens (e.g. my turn, waiting for opponent's turn, possible turns, what happens if I make a invalid move, etc.)?

Just writing this question helped me to settle my thoughts about the spec, but I'm submitting it to see if I can get any good answers from this great community.

sentences:
Hardware for testing Mapper 30 NES homebrews For someone wanting to get into NES/Famicom game development, and test on hardware (original and/or clones) to make sure the controls feel right, and to make sure the game is compatible for hardware play, what is a sure method for doing this?

Two SD/MicroSD hardware solutions I am aware of are EverDrive N8 and KrzysioCart.

Below are the Famicom versions of these cartridges respectively:

The end goal would be to flash the game to Muramasa hardware, so the game should play the same on the testing hardware as it does on the final hardware. What I know about these boards, I learned from this video. When it comes to distinctions between the various types of boards, I still have lots of questions, but that's another post for another day.

If the best solution is to strictly test through the Muramasa hardware (skipping SD/MicroSD cart solutions) by flashing to it each time (since that would be the final destination), then that's fine. I don't really know what workflow will be quickest when going back and forth between coding and testing. While not all testing will be through hardware (probably most will be via ROM), periodic hardware testing seems like a good idea, and so a quick workflow for that is desirable.

When it comes to flashing cartridges, the INLretro is the only hardware I am currently aware of for that, and I'm not sure how quick it would be workflow wise to flash with this over and over, or whether that's even a good idea. Workflow speed and ease of use are the main factors that have led me to look at SD cartridge solutions for testing.

Hardware testing workflow criteria:

Must support Mapper 30, which NESmaker uses.
Must work the same on the SD cart as on the final Muramasa hardware (if SD is used).
Must work with Famicom (my console is Japanese).

I've come across various forum threads discussing Mapper 30 compatibility with the SD cartridge solutions mentioned above, but couldn't pin down a definitive answer.

I realize this is a somewhat niche topic, but hopefully someone here has some experience with it and can offer some guidance. Thanks.

sentences:
Can I render some vertices as an object instead? I am generating vertices at runtime that represent terrain.

I've always drawn the vertices as triangles with GraphicsDevice.DrawUserPrimitives<VertexPositionColor>, but I'm wondering: Can vertices be converted into a "Model" so I could handle model and terrain rendering in a unified way?

This page is quite similar to what I am searching for.

I want to later port my game to Mono. Would this approach cause problems when using the Content Pipeline to convert the data?

sentences:
Changing contents of level depending on which character was selected I'm trying to create a character selection menu in Unity, where each character has their own version of the level that follows.

There are about 10 characters. Each character has a different location where they spawn in the level, and each enemy has a different spawn position as well, depending on which character was selected.

What I have been doing is to create separate levels (scene files) for each character. Then in the character selection menu, I load the level depending on the level selected by the user.

This seems to be a lot of code and data repetition, as the scene is the same in all levels; it's just that the spawn positions and enemies are different.

Is there any way have only one level scene, and get the spawn position and enemy spawns based on the character?

This is the code I have so far in GameManager.cs:

public GameObject enemy;
public Transform enemySpawnPoint;

public GameObject player;
public Transform playerSpawnPoint;

public static GameManager instance;

private void Awake()
{
    if (instance == null)
    {
        instance = this;
    }
}

void Start()
{
    StartCoroutine("SpawnEnemies");
    SpawnPlayer();
}

IEnumerator SpawnEnemies()
{
    while (true)
    {
        yield return new WaitForSeconds(1.0f);
        SpawnEnemy();
    }
}

public void SpawnEnemy()
{
    Vector3 enemySpawnPos = enemySpawnPoint.position;

    Instantiate(enemy, enemySpawnPos, Quaternion.identity);

}

public void SpawnPlayer()
{
    Vector3 playerSpawnPos = playerSpawnPoint.position;

    Instantiate(player, playerSpawnPos, Quaternion.identity);

}

...and the character selection script:

public void Level1()
{
    SceneManager.LoadScene(1);
}

public void Level2()
{
    SceneManager.LoadScene(2);
}

// ...

public void Level10()
{
    SceneManager.LoadScene(10);
}

Now the issue is, if I want to make any changes in one scene, like the skybox or background color, I will have to open all the other level scenes and make the changes.

Another thing is that if I want to add new levels, I will have to do the same thing, which seems like a lot of repetition.

Is there some way to set the enemy prefab, enemy spawn positions, player prefab and player spawn position once the character has been selected?

For example, if the user clicks on level1, all the preceding variables are set automatically and so on.....

sentences:
Display loading screen after scene change but wait for coroutine to finish I thought I'd understood how coroutines work but I'm still experiencing problems getting them to run when I want them to run:

There are two scenes in my game: The main menu one and a game one.
The main menu consists of a couple of buttons that let you choose a txt file and if you click on one of them, the "game" scene is loaded (SceneManager.LoadScene("Game");), which first thing reads the chosen txt file from HDD. Afterwards there's some other stuff that has to be finished (FinishRest()) but it's pretty quick anyway.

I want to display a loading screen while it's reading the file (no need to update it), which can take a while. Clicking on the button freezes the game in the main menu while the txt file is being read and it never displays the loading screen. That's why I put the actual reading part inside a coroutine and start it as soon as the "game" scene is loaded:

//In SciptA (derives from MonoBehaviour, is on the main camera)
void Awake() {
    loadingOperationReadTxt = StartCoroutine(ClassB.ReadTxtCoroutine());
    FinishRest();
}

//In ClassB (derives from ScriptableObject)
public IEnumerator ReadTxtCoroutine() {
    loadingPanel.SetActive(true);
    loadingPanel.GetComponentInChildren<Text>().text = "Reading txt file...";
    output = ClassC.ReadTXT(); //ClassC derives from nothing
    loadingPanel.SetActive(false);
    yield return null;
}

The problem is that it never displays the loading screen like this (I'm guessing because I don't let it tick until after I'm already done), so I tried to fix it by putting another yield return null; right before output = ClassC.ReadTXT();. Now it does display the loading screen but skips the rest of the coroutine and goes right to FinishRest(), which fails, of course, because it's missing the data from the txt file.

I want to display a loading screen but I also have to wait for the coroutine to finish before actually calling FinishRest() (I miss Tasks...). How can I accomplish this?

sentences:
How to reset a gameobject to it's prefab condition? I have a GameObject with a ragdoll in it. Gameobject comes from a prefab which is pooled. So whenever the enemy is killed it's disabled then enabled when spawn.

Problem is that the ragdoll settings and it's condition cannot be reset by enabling.  i.e. enemy stays dead even though respawned.
Is there a way to easily reset a GameObject to prefab state?

Solution online is to keep all the transforms and re-apply them by code. Is this the only way?

sentences:
Implementing frame-independent friction So I'm not looking for anything realistic like a physics engine, just want to say that first.  I'm working on a simple top-down game and I'm trying to get friction working with deltaTime.

This was my old code:

friction = Math.pow(0.99f, deltaTime * maxFPS);

This worked well and I applied the friction each frame.  However, I need to refactor this code since I do not know what the possible maxFPS will be (it could be 30, 60, 120 - it depends on the device limitations).

So here's my new code:

friction = Math.pow(0.6f, deltaTime);

This eliminates the need to know the maxFPS and gives me (roughly) the same output value to apply each frame.

My issue is this: I do not just set the friction to a static value, it changes depending on other factors.

So with my old code, for example, the value I would raise to a power to get friction would range anywhere from 0.6f to 1.0f.

With the new code, I have to use different values since the power is different, so the new range would be 0.0000000000001f to 1.0f.

This just doesn't seem (and feel, when playing the game) right.  The range is way too big and from 0.2 - 1.0f the results are all nearly the same value (0.98+, very "slippery" friction) - it doesn't seem like a linear gradient (if that makes sense) the way 0.6f - 1.0f with my old method was.

Just wondering what the common method is to implement frame-independent friction, if I'm doing it right and if there is anything I can do to get the same "feel" I was getting before.

sentences:
InvalidCastException when instantiating a prefab on the network using Photon As stated in the title, I get this error when I try to instantiate a game object using Photon:

InvalidCastException: Cannot cast from source type to destination type.
NetworkingPeer.DoInstantiate (ExitGames.Client.Photon.Hashtable evData, .PhotonPlayer photonPlayer, UnityEngine.GameObject resourceGameObject) (at Assets/Photon/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3069)
PhotonNetwork.Instantiate (System.String prefabName, Vector3 position, Quaternion rotation, Int32 group, System.Object[] data) (at Assets/Photon/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:2493)
PhotonNetwork.Instantiate (System.String prefabName, Vector3 position, Quaternion rotation, Int32 group) (at Assets/Photon/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:2437)
GunController.EquipGun (.Gun gunToEquip) (at Assets/Scripts/Gun/GunController.cs:38)
GunController.init () (at Assets/Scripts/Gun/GunController.cs:19)
NetworkPlayer.Start () (at Assets/Scripts/Network/NetworkPlayer.cs:20)

Old, working code:
equippedGun = Instantiate(gunToEquip, weaponHold.position, weaponHold.rotation) as Gun;
equippedGun.transform.parent = weaponHold;

New code, using Photon:
equippedGun = PhotonNetwork.Instantiate(gunToEquip.name, weaponHold.position,
                                        weaponHold.rotation, 1).GetComponent<Gun>();
equippedGun.transform.parent = weaponHold;

(I do GetComponent, as normal instantiate returns Object and PhotonNetwork.Instantiate returns GameObject)

equippedGun is by default an empty variable of type Gun

gunToEquip is again a Prefab variable of type Gun that gets passed into the function. (PhotonNetwork.Instantiate takes in the name of the prefab, not the actual prefab, thus gunToEquip.name)
In this particular case, gunToEquip is the default gun that fails to instantiate, which is set by the unity inspector

weaponHold is just a transform variable, again set by the inspector.

I somehow managed to fix it for my player prefab, I have no idea how. I was just changing and reverting stuff until it magically worked. How can I resolve this error?
Not sure if it is the problem, but I've attached the prefab settings:

sentences:
Select Neighboring X or Y Tiles I have a randomly generated set of tiles, and I am trying to select neighboring x or y tiles to perform functions on them based on if they are a certain value of tile, like so:

var IsometricMap = new Object();

      IsometricMap.tiles = [
        // "images/dirt.png",
        "images/dirtHigh.png",      // 0
        "images/grass.png",         // 1
        "images/water.png",         // 2
        "images/waterBeachCornerEast.png",  // 3
        "images/waterBeachCornerNorth.png", // 4
        "images/waterBeachCornerSouth.png", // 5
        "images/waterBeachCornerWest.png",  // 6
        "images/waterBeachEast.png",    // 7
        "images/waterBeachNorth.png",   // 8
        "images/waterBeachSouth.png",   // 9
        "images/waterBeachWest.png"]

var blockcount = 10;

    let generate_row = _=> Array(blockcount).fill().map(_=>Math.floor(Math.random()*3));
     IsometricMap.map = Array(blockcount).fill().map(generate_row);

    console.log(IsometricMap.map);

    for(let x = 0; x < IsometricMap.map.length; x++){

        for(let y = 0; y < IsometricMap.map.length; y++){

            if ((IsometricMap.map[x-1][y]) == 2) {
            //IF THE TILE IS WATER, DO ALL THIS:

            alert("SUCCESSFULLY SELECTED THE " + IsometricMap.map[x-1][y] + " TILE");

            //DONE WITH WATER TILES
            }

        }

    }

So far this is not yielding any results, its as if it cant find the tile I am trying to specify. Is there something wrong with my scope here?

sentences:
Creating Primitives and Model from Texture2D Xna 4.0 So I was playing around with XNA working on a 3d engine with 2d sprites as characters and objects.
After a while I became very unhappy with the way the sprites were being scaled and billboarded so I created a GameSprite class that takes all the information from
the texture2D(pngs) and turns it into VertexPositionColor quads on init.

these are drawn with a basic effect, a struct quad, and a quadList.

basicEffect.CurrentTechnique.Passes[0].Apply();
        foreach (ColorQuad quad in currentFrame.quadList)
        {
            graphicsDevice.DrawUserIndexedPrimitives<VertexPositionColor>(
                PrimitiveType.TriangleList,
                quad.Vertices,
                0,
                quad.Vertices.Length,
                quad.Indices,
                0,
                quad.Indices.Length / 3);
        }

(frames are different quads chopped up from the original image for animation,
like a sprite sheet)

This creates a great 3D recreation of the sprite that can be zoom entirely with no blur.

Each GameSprite has its own basic effect file.

I was wondering if there was a way, maybe during LoadContent, that I could create
these vertices and turn them into models for easier drawing and rendering in this
3D world and if this is even a good way to go about this and if I might experience
longerterm problems using lots of these GameSprites and their many quads.

Thanks for reading!

sentences:
How do you "branch" a Unity project How do you branch a unity project?
Suppose you have Game Project A, and say there is variant A' that requires a large convoluted plugin. But the idea is also that you want to keep developing this without the plugin getting in the way, for the other variants - say A and A'' - that don't require it.

sentences:
How would one go about integrated python into a c++ written game for the use of user-made scripts I'm quite new to game development  (not the site) and I'm currently just trying to educate myself about some certain things before I really begin working and a game.

anyway, I'd like to know what basic algorithm/outline of how a game would be coded effeciently with the implementation of user coded scripts for gameplay and levels that are written in python,

Is this even possible? would all the features of python be avalible? like say "multi-threading"?

sentences:
OpenGL: Is it possible to use VAO's without specifying a VBO On all the tutorials I can find about VAO's (Vertex Array Objects), they show on how to use them by configuring vertex attributes and binding a VBO (Vertex Buffer Object). But I want to create a VAO that will be configured for a set of VBO's in combination with a fixed shader, where each buffer uses the same data pattern (vertex, uv, color, etc). So, I want to create one VAO for multiple VBO's that will be drawn using one shader.

I couldn't find any demo on this, so I decided to just give it a try. But it doesn't work and crashes on the glDrawArray call. It looks like the VBO isn't bound. Here is the code I'm using:

Rendering:

/* Prepare vertex attributes */
glBindVertexArrayOES(vao);

/* Upload the buffer to the GPU */
glBindBuffer(GL_ARRAY_BUFFER, pool->next());
glBufferSubData(GL_ARRAY_BUFFER, 0, parts * buffer.stride() * 6, buffer.getBuffer());

/* Draw the triangles */
glDrawArrays(GL_TRIANGLES, 0, parts * 6);

glBindVertexArrayOES(0);

VAO Creation:

glBindVertexArrayOES(vao);

glEnableVertexAttribArray(ls.position);
glVertexAttribPointer(ls.position, 2, GL_FLOAT, GL_FALSE, buffer.stride(), 0);

glEnableVertexAttribArray(ls.color);
glVertexAttribPointer(ls.color, 3, GL_FLOAT, GL_FALSE, buffer.stride(), GL_BUFFER_OFFSET(buffer.dataTypeSize * 2));

glBindVertexArrayOES(0);

Where ls is a simple struct that holds the attribute locations.

In the Rendering part, swapping the glBindBuffer and the glBindVertexArrayOES around didn't work either.

So, the question is: Is it even possible to do so, or will I have to create for each buffer a VAO? And if I have to create a VAO for each VBO, is it possible to update the VBO's data using glBufferSubData in combination with a VAO?

sentences:
Rotate an object given only by its points? I was recently writing a simple 3D maze FPP game. Once I was done fiddling with planes in OpenGL, I wanted to add support for importing Blender objects. The approach I used was triangulization of the object, then using Three.js to export the points to plaintext and then parsing the result JSON in my app.

The example file can be seen here:
https://github.com/d33tah/tinyfpp/blob/master/Data/Models/cross.txt
The numbers represent x,y,z,u,v of a single vertex, which combined in three make a triangle.

Then I rendered such an object triangle-by-triangle and played with it. I could move it back and forth and sideways, but I still have no idea how to rotate it by some axis. Let's say I'd like to rotate all the points by five degrees to the left, how would a code doing it look like?

sentences:
Can I run my own loading script during the Unity splash screen? Can I load data in the background while the Unity splash screen is up?  If so, how?

I am trying to run code during the splash screen, not just load assets.

I have not been able to find any information on this in Google or the Unity Documentation.

sentences:
How to smooth jagged pixel edges in Unity? So I am reading an image from a png file into a 2D sprite. This sprite serves as a "province" in my game. Currently, I am getting this:

If you look closely, you will notice that you are seeing the square corners of each pixel, because I am mapping the image on a 1:1 ratio of pixels:world coordinates.

What I want is a slightly rounded corner in these places. Look at the 2-dimensional provinces in this example:

I have been googling around for algorithms, but most answers simply say "use a shader" and don't describe the techniques used to do this (until now I have not done much with shaders). If you would like to see my working code for the province system, it is posted on my answer to my own question here.

sentences:
Programmatically set brightness of a PointLight I'm a beginner, so there is definitely something I'm missing here. I'm trying to set brightness of my PointLight object from the in-game command line.

Here is what I tried, but it doesn't work:

class MyCustomGameInfo extends GameInfo;

exec function myTest(float brightness)
{
    local PointLight pointLightOut;
    local PointLight pointLight;

    foreach AllActors( class 'PointLight', pointLightOut )
    {
        pointLight = pointLightOut;
    }

    pointLight.LightComponent.SetLightProperties(brightness);
    pointLight.LightComponent.UpdateColorAndBrightness();
}

defaultproperties
{
}

So when I compile it, go to my UDK project, run it, press tab and start typing myTest, the command line autocomlpete works perfectly, and even shows the float parameter. However, it doesn't work. I have a feeling that the way I'm retrieving the object is wrong.

sentences:
Detecting wins in peer to peer RTS games like Starcraft A typical RTS game is implemented with the standard networking model: peer to peer lockstep.

Consider Starcraft 2, given that Battle.net presumably doesn't know anything about the state of game given that there is only communication between the two players in a peer to peer model, how does Battle.net know who was the winner in the end. Relying on the two peers to not try to cheat and report accurate results is naive.

sentences: Is it possible to make a text based game and filter bad stuff? I was thinking of a text based game where the users type in various "things."  But I know it will quickly degenerate into filth.  Is there any way to stop something like this?

sentences:
Handling an item database with procedurally generated items? Let's say you have an item database which has every item in your game.
This works fine for regular items like a Health Potion, a normal Iron Sword etc, because these items have ItemID's so we can get an exact copy of this item.
But what if we have an Iron Sword with an enchantment: '+5 Fire Damage'? (or whatever)

If you were to save that item to a player's inventory, exit the game and load the game, the item will load as a regular Iron Sword, because it still has that ID.

Specifically, how would you save that item to a file? I'm using Unity, so to save the Player's inventory, I use:

PlayerPrefs.SetInt("Inventory " + i, inventory[i].ItemId );

Would you create a custom item ID for every item with enchantments or is there a better way around this?

sentences: Can the solar system be accurately represented in 3d space using doubles (or longs)? I would like know to how to best manage coordinates in a 3D game whose aim is to realistically model the entire solar system, yet be able to handle the smallest movements in a "ship" (ie: perhaps we can consider 1cm to be the smallest acceptable movement for a frame). Do 64-bit doubles (or 64-bit longs) support this, or do we run into overflow problems? If not, then should longs or doubles be used, or if so, then which alternative approach do you think is the most sensible for modelling positions in the solar system in a 3D game? (ie: only holding a bit of the system in the display at a time based on distance to ship, or having the system somehow represented in a different co-ordinate space etc)

sentences:
What technique should I use to create models and animation sequences in OpenGL code? I'm getting into game development using OpenGL (and the LWJGL library) and I want to create models for characters, NPC's etc. in the code, as well as animation sequences (for example the way the models are done in Minecraft).

What is the process to go about doing something like this? Is there a particular feature set that is used or common methods of doing this? I'm basically looking for pointers as to what to search for when trying to find examples of how this is done.

sentences:
click event not registered for an actor inside stacked cell within a table in libgdx In the following code segment, the click event for image element is not registered. However, if i comment out stack.add(shapeLabel) statement, then the image button is able to register the click event. Why is it so ?

        private Array<Shape> tableShapes;
        private Array<Stack> tableofStackedShapes;
        ....
        ....
        Stack stack = new Stack();
        Label shapeLabel;
        colorIndex = MathUtils.random(colorsList.size - 1);
        cellShape = shapesList.get(MathUtils.random(shapesList.size - 1));
        String filename = cellShape + "/" + cellShape + "_" + colorsList.get(colorIndex) + ".png";
        img = new Shape(cellShape, colorsList.get(colorIndex), new Texture(filename));

        if (this.currentLevel > 2) {
            int randomNumber = MathUtils.random(0, 9);
            img = new Shape(cellShape, colorsList.get(colorIndex), null, randomNumber, new Texture(filename));
            img.setSize(cellSize * ((float)stage.getWidth() / stage.getHeight()), cellSize);
            stack.add(img);
            shapeLabel = new Label("" + randomNumber, new LabelStyle(new BitmapFont(), com.badlogic.gdx.graphics.Color.BLACK));
            shapeLabel.setAlignment(Align.center);
            shapeLabel.setBounds(img.getImageX(), img.getImageY(), img.getWidth(), img.getHeight());
            stack.add(shapeLabel);
        }   else {
            img = new Shape(cellShape, colorsList.get(colorIndex), new Texture(filename));
            img.setSize(cellSize * ((float)stage.getWidth() / stage.getHeight()), cellSize);
            stack.add(img);
        }
        stack.debugAll();
        tableofStackedShapes.add(stack);
        tableShapes.add(img);
    }

My suspicion is on chaining of events, and that the label is restricting the click events to be detected by the img element. But I don't know what exactly is triggering this and how to fix it. Thanks for any inputs .

sentences:
Unity uNet Low Level API - which values should I snyc? I am using unitys unet low level api: TransportLayer.

I send my own message by converting strings to byte-arrays.

I want a server authoritive setting, so that I can try to implement my own client side prediction.

I am also using unitys physics2d, rigidbodies and so on.
I thought about to move the rigidbodies with it's velocity.

I wonder which values I should send from client to server and backwards, to avoid the rigidbody jittering.

I know that I cannot simply send the clients position to the server, because that will cause the jittering "effect".

Would be nice, if anyone can give me guidance.

Thanks :)

sentences:
How to write an adjacency algorithm that compares position data? I have a list of indexed triangles for which I need to generate adjacency data. I've already written a brute force algorithm that creates 3 edge data structures for each triangle and then compares the edge structures with those of other triangles like so:

public struct AdjEdge
        {
            public Vector3 _ref0;
            public Vector3 _ref1;
            public int _edge;
            public int _face;
            public bool _parsed;

            public AdjEdge(Vector3 ref0, Vector3 ref1, int edge, int face)
            {
                _ref0 = ref0;
                _ref1 = ref1;
                _edge = edge;
                _face = face;
                _parsed = false;
            }
        }

private static int[] GenerateAdjacency(Vector3[] positions,
            List<int> positionIndices)
        {
            int ncFaces = positionIndices.Count / 3;
            int ncVertices = positions.Length;

            // inst. adjacency array and set all values to -1
            int[] adjacency = Enumerable.Repeat(-1, 3 * ncFaces).ToArray();
            if (adjacency == null)
                throw new OutOfMemoryException("Failed to allocate memory for adjacency data");

            List<AdjEdge> edges = new List<AdjEdge>();

            for (int i = 0; i < positionIndices.Count; i+=3)
            {
                int iFace = i / 3;
                edges.Add(new AdjEdge(positions[positionIndices[i + 0]], positions[positionIndices[i + 1]], 0, iFace));
                edges.Add(new AdjEdge(positions[positionIndices[i + 1]], positions[positionIndices[i + 2]], 1, iFace));
                edges.Add(new AdjEdge(positions[positionIndices[i + 2]], positions[positionIndices[i + 0]], 2, iFace));
            }

            for (int i = 0; i < edges.Count - 1; ++i)
            {
                AdjEdge edgeA = edges[i];
                if (edgeA._parsed)
                    continue;

                for (int j = 3 - (i % 3) + i; j < edges.Count; ++j)
                {
                    AdjEdge edgeB = edges[j];
                    if (edgeB._parsed)
                        continue;
                    // CompareVectors() returns true if the vectors are separated by a distance less than 1e-6f
                    if (CompareVectors(edgeA._ref0, edgeB._ref1)
                        && CompareVectors(edgeA._ref1, edgeB._ref0))
                    {
                        adjacency[3 * edgeA._face + edgeA._edge] = edgeB._face;
                        adjacency[3 * edgeB._face + edgeB._edge] = edgeA._face;
                        edgeA._parsed = true;
                        edgeB._parsed = true;
                        break;
                    }
                }
            }

            return adjacency;
        }

Needless to say, time complexity is an issue here. What is the most efficient method for generating adjacency when comparing position data using an epsilon?

sentences:
Seeking an C/C++ OBJ geometry read/write that does not modify the representation I am seeking a means to read and write OBJ geometry files with logic that does not modify the geometry representation. i.e. read geometry, immediately write it, and a diff of the source OBJ and the one just written will be identical. Every OBJ writing utility I've been able to find online fails this test.

I am writing small command line tools to modify my OBJ geometries, and I need to write my results, not just read the geometry for rendering purposes.

Simply needing to write the geometry knocks out 95% of the OBJ libraries on the web.

Also, many of the popular libraries modify the geometry representation. For example, Nat Robbin's GLUT library includes the GLM library, which both converts quads to triangles, as well as reverses the topology (face ordering) of the geometry. It's still the same geometry, but if your tool chain expects a given topology, such as for rigging or morph targets, then GLM is useless.

I'm not rendering in these tools, so dependencies like OpenGL or GLUT make no sense.

And god forbid, do not "optimize" the geometry! Redundant vertices are on purpose for maintaining oneself on cache with our weird little low memory mobile devices.

sentences:
Drawing from an ArrayList drawing same image repeatedly (Slick2D) This is the game I'm working on.

I isolated the problem into this class.

public class Runa extends BasicGame {
int startTime, tracker;
public ArrayList<Circle> circ = new ArrayList<Circle>();
public int[] a = new int[]{
        15, 16, 17, 18, 19, 32, 36, 40, 45, 46, 55, 56, 57, 58, 63, 65, 68, 70, 72, 74, 79, 80, 81, 82, 86, 94, 95, 96, 97, 98, 99,
        100, 101, 102, 103, 104, 105, 117, 120, 122, 126, 128, 129, 130, 131, 133, 138, 139, 140, 142, 149, 151, 155, 156,
        158, 164, 166, 172, 174, 180, 182, 184, 188, 189};
public ArrayList<Integer> aList = new ArrayList<Integer>();
public Runa(String title) {
    super(title);
}

@Override
public void init(GameContainer c) throws SlickException {
    startTime = 0;
    tracker = 0;
    //this just transfers the hard coded values into an arraylist
    for(int i = 0; i<a.length;i++){
        aList.add(a[i]);
    }
}
@Override
public void update(GameContainer c, int d) throws SlickException {
    //this calculates the rhythm of the game
    startTime+=d;
    if(startTime>((60/(calcBPM(195.8,89)))*1000)){
        startTime=0;
        tracker++;
    }

    //this adds a new circle every time the current beat (tracker) reaches a beat on the aList
    if(aList.indexOf(tracker)>0)
        circ.add(new Circle(50,50,50));
    //this should just move one circle at a time, meaning I thought that only one circle would be added above, and move it down 4 px
    for(Circle circle: circ)
        circle.setCenterY(circle.getCenterY()+4);
}

@Override
public void render(GameContainer c, Graphics g) throws SlickException {
    //draws each circle in the arraylist
    g.setColor(Color.red);
    for(Circle circle: circ)
        g.draw(circle);
}
//calculates the bpm
public double calcBPM(double d, int numSecs){
    return d*60/numSecs;
}
public static void main(String[]args) throws SlickException{
    new AppGameContainer(new Runa("Test"),680, 480, false).start();
}

}

Why is it doing that weird stretch thing? Is that because I'm using an arraylist?

sentences:
Make main game music volume less louder when player getting close to sfx audio object? The audio mixer settings :

Then the audio source for the game music :

And the sfx audio source I changed the Spatial Blend to 3D and then in the 3D settings changed the Volume Rolloff to Linear Rolloff Min Distance to 10 and Max Distance to 13.

The sfx effect is working fine but the game music volume stay loud too loud.
How can I make that when the player is getting closer to the fire the main game audio will get less louder not to set the game music volume to 0 but make it slowly also less louder while the sfx getting more louder ?
my problem is to make the game music less louder slowly when the player is getting closer to the fire.

sentences:
Lag Spike When Creating Model I am creating a game using OpenGl in c++. Whenever I create a new model while the game is running, such as fire a bullet, there is a huge lag spike. The function that creates the model is below.
    std::string jsonString;
    jsonString = file->load(type);
    json jf = json::parse(jsonString); //Might be causing the lag

    indicesSizeTexture = jf["textureIndices"].size();
    verticesSizeTexture = jf["textureVertices"].size();
    indicesSizeCollision = jf["collisionIndices"].size();
    verticesSizeCollision = jf["collisionVertices"].size();
    verticesTexture = new float[verticesSizeTexture * 8];
    verticesCollision = new float[verticesSizeCollision * 8];
    verticesCollisionUpdated = new float[verticesSizeCollision * 8];

    indicesTexture = new int[indicesSizeTexture];
    indicesCollision = new int[indicesSizeCollision];

    for (int i = 0; i < verticesSizeTexture; i++) {  //responsible for just the texture vertices
        verticesTexture[i] = jf["textureVertices"][i];
    }
    for (int i = 0; i < indicesSizeTexture; i++) { // responsible for just the texture indices
        indicesTexture[i] = jf["textureIndices"][i];
    }
    for (int i = 0; i < verticesSizeCollision; i++) {  //responsible for just the collision vertices
        verticesCollision[i] = jf["collisionVertices"][i];
        verticesCollisionUpdated[i] = verticesCollision[i];
    }
    for (int i = 0; i < indicesSizeCollision; i++) { // responsible for just the collision indices
        indicesCollision[i] = jf["collisionIndices"][i];
    }

    //binds id
    glGenBuffers(1, &VBO);
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &EBO);
    glGenTextures(1, &texture);

    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, verticesSizeTexture * 8 * sizeof(float), verticesTexture, GL_STATIC_DRAW);
    // position attribute
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    //texture
    glBindTexture(GL_TEXTURE_2D, texture);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
    glEnableVertexAttribArray(2);

    stbi_set_flip_vertically_on_load(true);
    unsigned char* data = stbi_load(texturePathString.c_str(), &width, &height, &nrChannels, 0);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
    glGenerateMipmap(GL_TEXTURE_2D);
    stbi_image_free(data);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);

I stripped out a lot of parts that I am almost certain aren't causing the lag. There is a lot of stuff going on, but it is mostly simple mathematical operations. The only parts that I think could be causing the lag is the json section used for loading the model data. The model data is stored in a variable from file as a string. I need the json section for the data storage though. What could be causing the lag? should I find a different data storage type? What if I created a bullet offscreen on startup, then copied it whenever I needed it? The specific json library I am using is https://github.com/nlohmann/json

sentences: LibGDX: Max number of textures? I've been developing a game targeted at android. I know not to think about program optimization until the project is finished, but I have to wonder how many textures most phones can handle safely without melting or murdering battery. I've seen that the max SIZE of a texture should be 1024 or 2048 pixels squared (I've been combining sprite-sheets into 1024x1024 atlas's) but I can't help but wonder if there is a limit to how many of these I can use at runtime. I understand it should depend on the GPU but what spec determines it?

sentences:
How can I get a reference to a object in the world in UE4? I'm coding a simple maze game in UE4 and I have everything I wanted to implement done except having an obstacle in the scene. What I have is a simple Obstacle class which is a child of an Actor class.

Now in the scene I have a Blueprint which is a child of the Obstacle class and this Blueprint is placed in the maze. What I'm trying to achieve is when the player collects so many objects (let's say 10) then the Obstacle will be destroyed but I don't know how to get a reference to that Obstacle object in my code.

AObstacle* Obstacle /////// This is where I don't know how to initialize the object
if (MyCharacter->collectedPickUps >= requiredAmountOfPickups)
{
    Obstacle->Destroy();
    Obstacle->isActive = false;
}

sentences:
Preventing diagonal movement I was originally fine with diagonal movement but it's clashing with my sprite animation...

    public void keyPressed(KeyEvent e){
    int key = e.getKeyCode();

    switch(key){
        case KeyEvent.VK_W:{
            dir = 3;
            velY = -speed;
            break;
        }
        case KeyEvent.VK_S:{
            dir = 2;
            velY = speed;
            break;
        }
        case KeyEvent.VK_A:{
            dir = 1;
            velX = -speed;
            break;
        }
        case KeyEvent.VK_D:{
            dir  = 0;
            velX = speed;
            break;
        }
    }
}

public void keyReleased(KeyEvent e){
    int key = e.getKeyCode();

    switch(key){
        case KeyEvent.VK_W:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_S:{
            velY = 0;
            break;
        }
        case KeyEvent.VK_A:{
            velX = 0;
            break;
        }
        case KeyEvent.VK_D:{
            velX = 0;
            break;
        }
    }
}

    public void update(){
    y += velY;
    x += velX;
}

I thought that perhaps a switch statement or an if else statement would prevent multiple keys from firing at once, but it's not working out. I even tried synchronizing some methods but still to no avail. Any suggestions? And please ignore the dir variable I use it to find the direction the player is facing.

sentences:
Ragdoll on alive creatures: has somebody already implemented it? I find that a dead creature falling realistically is boring.

I wonder, has any game implemented an animation system where the model moves depending of the muscle forces and the velocity of the limbs, but calculated ingame ?

It is much faster to have determinate animation data which is loaded and is just read sequentially, but it looks much "static".

Since I hear a lot about procedural generated data, one could generate a body with its own animation depending of the weight of the bones.

I'm not talking about a real-life robot simulation where the bone is standing, auto-adjusting some angles to keep balance, but something more intermediate and more pre-calculated.

The forces vary slightly between steps (some random on a float so vary plus or minus 10%), so the trajectory of the limbsvary between steps.

It would require a lot of adjustement and preconfiguration, but it would look much less deterministic.

sentences:
For 2D games, is there any reason NOT to use a 3D API like Direct3D or OpenGL? I've been out of hobby Game Development for quite a while now.  Back when I did it, most people used Direct Draw to create 2D games.  By the time I stopped people were saying OpenGL or Direct3D with an orthogonal projection is just the way to go.

I'm thinking about getting back into creating 2D games, in particular on mobile phone but maybe on the XNA platform as well.  To make something using OpenGL I'd have a (hopefullly) small learning curve to acclimate myself to 3D development.

Is there any reason to skip that and instead work with a 2D framework where I just have a Width x Height frame buffer I need to fill with pixels?

sentences:
NullReferenceException shown every single time a change is applied to my prefab I created a prefab out of a game object in my scene. Every single time I hit Apply after making changes to my game object, I see the following stack trace:

However, as far as I can surmise, the changes are applied nonetheless, because the bolded field (indicating that its value is yet to be applied to the prefab) immediately becomes un-bolded once I hit Apply.

If, contrary to my belief, my changes are not applied to my prefab, what should I do to ensure that they are?
If the error message appears even when I successfully apply my changes to my prefab, what can I do to make it go away?

UPDATE 1:

I noticed that after the first time I hit Apply, the game object went from being highlighted in blue (indicating that it mirrors a prefab) to being highlighted in black (indicating that it no longer mirrors a prefab).

Game objects that mirror other prefabs work fine. This is the only exception.

UPDATE 2:

I deleted the prefab, and created another prefab from the same game object. This time, after hitting Apply, I still see the same exception, but the game object remains highlighted in blue (indicating that it is still mirroring a prefab).

sentences:
Run some objc code very early in unity iOS game lifetime I want to hook up a crash reporting service to my unity iOS game. It's just one line of objC to add, as early into the app lifecycle as possible, but I'm not sure how to get it to run. I know I could make a native plugin and then call that from some Awake() function in C#, but that's too late for my purposes.

I'm not a native iOS developer, but I know enough to be dangerous. I have been able to google enough that I know I want something to with UnityAppController, probably preStartUnity(). But that's all.

Has anyone got further resources on how to do this? Or another way, if I'm barking up the wrong tree?

edit: I'm on unity 4.6.

sentences:
Creating a game with in game programmable AI I am looking to make a game where the player can access an in game terminal and then use this terminal to write AI logic in a programming language such as C++ or C#, then they can compile the code and apply the AI to NPC characters.

Of course if the code failed to compile error free then it would not be applied to the NPC. Mostly the code would be function calls with a few basic constructs available like int, float, bool etc.

My question is how could I achieve this in say Unity or another game engine. Would I need to use a scripting language such as LUA or Python to create the AI or could I be done in real time on a separate thread in Unity somehow?

sentences:
Immediate GUI - yae or nay? I've been working on application development with a lot of "retained" GUI systems (below more about what I mean by that) like MFC, QT, Forms, SWING and several web-GUI frameworks some years ago. I always found the concepts of most GUI systems overly complicated and clumsy. The amount of callback events, listeners, data copies, something to string to something - conversions (and so on) were always a source of mistakes and headaches compared to other parts in the application. (Even with "proper" use of Data Bindings/Models).

Now I am writing computer games :). I worked with one GUI so far: Miyagi (not well-known, but basically the same Idea as all the other systems.)

It was horrible.

For real-time rendering environments like Games, I get the feeling that "retained" GUI systems are even more obsolete. User interfaces usually don't need to be auto-layouted or have resizable windows on-the-fly. Instead, they need to interact very efficiently with always-changing data (like 3d-positions of models in the world)

A couple of years ago, I stumbled upon "IMGUI" which is basically like an Immediate Graphics mode, but for user interfaces. I didn't give too much attention, since I was still in application development and the IMGUI scene itself seemed to be not really broad nor successfull. Still the approach they take seem to be so utterly sexy and elegant, that it made me want to write something for the next project using this way of UI (I failed to convince anyone at work :(...)

let me summarize what I mean by "retained" and "immediate":

Retained GUI:
In a separate initialization phase, you create "GUI controls" like Labels, Buttons, TextBoxes etc. and use some descriptive (or programmatical) way of placing them on screen - all before anything is rendered. Controls hold most of their own state in memory like X,Y location, size, borders, child controls, label text, images and so on. You can add callbacks and listeners to get informed of events and to update data in the GUI control.

Immediate GUI:
The GUI library consists of one-shot "RenderButton", "RenderLabel", "RenderTextBox"... functions (edit: don't get confused by the Render prefix. These functions also do the logic behind the controls like polling user input, inserting characters, handle character-repeat-speed when user holds down a key and so on...) that you can call to "immediately" render a control (doesn't have to be immediately written to the GPU. Usually its remembered for the current frame and sorted into appropiate batches later). The library does not hold any "state" for these. If you want to hide a button... just don't call the RenderButton function. All RenderXXX functions that have user interaction like a buttons or checkbox have return values that indicate whether e.g. the user clicked into the button. So your "RenderGUI" function looks like a big if/else function where you call or not call your RenderXXX functions depending on your game state and all the data update logic (when a button is pressed) is intermangled into the flow. All data storage is "outside" the gui and passed on-demand to the Render functions. (Of course, you would split up the big functions into several ones or use some class abstractions for grouping parts of the gui. We don't write code like in 1980 anymore, do we? ;))

Now I found that Unity3D actually uses the very same basic approach to their built-in GUI systems. There are probably a couple of GUI's with this approach out there as well?

Still.. when looking around, there seem to be a strong bias towards retained GUI systems? At least I haven't found this approach except in Unity3D and the original IMGUI community seems to be rather .... ..  quiet.

So anyone worked with both ideas and have some strong opinion?

Edit: I am most interested in opinions that stem from real-world experience. I think there is a lot of heated discussions in the IMGUI-forum about any "theoretical weakness" of the immediate GUI approach, but I always find it more enlightening to know about real-world weaknesses.

sentences: How to manage the lifetime of Ogre3D objects? I haven't found tutorials that are concerned about deleting scenenodes and entities. I assume that the scenemanager will take ownership of them when they are attached (am I right?). However, I can imagine many situations where I would like to deterministically and selectively terminate objects, for example if I were to use OGRE to display a huge open-world level, I would like to dynamically load and unload parts of the world. How can I do this while also telling the scenemanager that his pointer is no longer valid?

sentences:
How to go orthographic instead of perspective view in XNA with CreateOrthographicOffCenter? Using these view and projection values:

var eye = new Vector3(0, 0, 10f);
var view = Matrix.CreateLookAt(eye, Vector3.Zero, Vector3.Up);
var projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000f);

and then applying world rotation to the effects with this matrix:

var rotation = Matrix.CreateRotationX(-MathHelper.PiOver2)*Matrix.CreateRotationY(MathHelper.PiOver2);

I am able to render my animated model:

But simply changing projection matrix to something like this:

var projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1.0f, 1000.0f);

Renders pure CornBlue screen. I don’t see my model at all. What should I do to make it visible?

sentences:
How do I create a half-ortho half-perspective projection matrix I've been trying to make a formula for the projection matrix where your vertical axis is projected orthographically but your horizontal axis will have perspective to it.
So the view frustum would look like this:

I studied how the formulae of orthographic projection and perspective projection and how they where achieved. And tried to modify those to try to reach projection I wanted. It seemed to me it wasn't possible to have one axis scale to Z and the other not (or to have them scale at a different factor).
It it possible to reach the perspective I want? If so what would the projection matrix look like?

sentences:
OpenGL picking performance: ray casting vs. color picking I am curious of how the performance of color picking compares to ray casting. I am looking at the scenario when the mouse is clicked which means only then the scene is rendered in a backbuffer for color picking or ray-cating has to be applied.

Note: I have found this question which unfortunatly does not give any indication.

sentences: How to simulate random scope movement? I want to simulate that random and soft movement that lot of games got (like BF3) when you use the scope of a sniper gun, so the question is how to achieve that.

sentences:
Do UV coordinates need correction for moving object? The image above is a static capture of a dynamic OpenGL project I created in which I wrapped a NASA albedo, i.e., sans clouds, image on an OpenGL generated sphere.  In so doing, I also generated the UV coordinates associated with each vertex position.

This was an incremental learning effort in which I had already applied model matrix corrections to the vertex positions for the rotating and translating (orbiting) "Earth".

I was surprised to find that I did not have to apply a model matrix correction to the UV coordinates.

I have tentatively concluded that once the jpg image coordinates are associated with the corresponding vertex positions with the UV coordinates in the range of [0, 1], they are fixed and need no further correction.

Does that sound correct, or is there more to the situation?

sentences:
Android LibGDX game: Choosing starting activity I am making a Android game with LibGDX (using ADT eclipse bundle). How do I choose the default activity to launch when the user opens the app. I set the project up with the LibGDX setup GUI, and I can't find the main activity.
I want a main menu to open before the game starts, is there something I should change in the manifest?
Thanks in advance.

sentences:
Texture filtering: Is the minification or the magnification filter used when rendering at the exact texture size? Suppose you have a texture where the minification filter is linear, but the magnification filter is nearest-neighbor (point filtering). If the texture is rendered at exactly 1:1 pixels, but at a non-whole-number pixel position, it is being neither minified or magnified.

Is there a convention for whether the min or mag filter will be used? What is the justification?

sentences:
Export baked lightmaps from Unity to Monogame I'm trying to bake lightmaps in Unity, export as textures and apply the textures in Monogame. Is this the right path to go? If so, how it should be done?

Thank you.

sentences:
Can't call method out of a timer. Why? I have another problem i can't solve by myselve.

My situation:
I have four FrameLayouts in LinearLayouts.

I color them, set Layout hight and width at wrap content and just change the minwidth to use them as a status or progress bar.

To adjust the bars i have a method:

public void update_bars(){

    FrameLayout bar_eat = (FrameLayout)findViewById(R.id.bar_eat);
    FrameLayout bar_drink = (FrameLayout)findViewById(R.id.bar_drink);
    FrameLayout bar_wash = (FrameLayout)findViewById(R.id.bar_wash);
    FrameLayout bar_care = (FrameLayout)findViewById(R.id.bar_care);

    bar_eat.setMinimumWidth((int)(((float)screen_part/1000)*eat));
    bar_drink.setMinimumWidth((int)(((float)screen_part/1000)*drink));
    bar_wash.setMinimumWidth((int)(((float)screen_part/1000)*wash));
    bar_care.setMinimumWidth((int)(((float)screen_part/1000)*care));
}

This method works fine from everywhere in my activity.
But i also want to call this update_bars() method every second so i made a timer for it.

private void update(){

    Timer timer = new Timer();
    timer.schedule(new TimerTask(){

        @Override
        public void run() {
            update_bars()

        }

    },0,(1000* getResources().getInteger(R.integer.remove_speed_inSecond)));

But at this point it crashes....

The debugger says this:

  Thread [<12> Timer-0] (ViewRootImpl$CalledFromWrongThreadException)
      Timer$TimerImpl.run() Zeile: 290

So where it the problem? And what can i do?
I woud be very happy if someone have an idear because i'm going crazy^^

sentences:
Need ideas on how to give my levels structure I am making an iOS game for a project at school. It is going to be a tiny bit like Fruit Ninja, as in it will have different things on the screen, and when you hit them, they die, and you get points. The trouble is that unlike Fruit Ninja, my game will have different types of sprites, all doing different things (moving different places, doing different things, etc).
The one thing that is bad about having all of these sprites that do different things is that it is hard for them to look neat on the screen all together. I was planning on having a couple of different gamemodes:

Time Trial
You have 120 seconds to kill as many sprites as possible.

Survival
You have three lives, every time you try to hit a sprite and miss, you lose a life.

????
Whatever I think of.

I am a rookie to game design in general, and I don't know the best way to make my game look good, and play well. I could have all of these sprites on the screen at the same time, or I could have them come in waves, for example 10 of sprite_a come on, and once they are killed, 10 of sprite_b come on, etc...

Please give me your opinion about which one I should code. If you have any other suggestions for either a third gamemode, or a completely different way to make the levels, feel free to tell me.

sentences:
Android AndEngine creating a body behind the sprite exactly I am using AndEngine for Android. I created a body, but it is not behind the sprite as I wanted.

                                Body.setTransform(Sprite.getX()/32, Sprite.getY()/32, 0);

This is what I am currently using and this is how it appears.

My body is the white circular borders, and my sprite is the red circle.

and When I remove /32 from the code the body doesn't even appear.

Extra code;

                    FIXTURE_DEF = PhysicsFactory.createFixtureDef(
                            1,     // density
                            0.75f,  // elasticity
                            0.5f, // friction
                            false); // isSensor

the Body

                Body = PhysicsFactory.createCircleBody(this.physicsWorld, Sprite, BodyType.KinematicBody, this.FIXTURE_DEF);
                Body.setUserData("eSprite");
                this.physicsWorld.registerPhysicsConnector(new PhysicsConnector(Sprite, Body, true, true)

my sprite is 65px ..

sentences:
How can a make a game end and display win message when the mouse/figure is placed/clicked on a certain tile? I am trying to make a game, kind of like Minesweeper, but instead of looking for mines, you are looking for a 'hidden base' that is hidden under one of the unturned tiles. I am new to this and have no idea how to make it happen. I want when the mouse double-clicks on the 'hidden base' tile the game to display "You win!" message (I got the message ready, just need to put it in.) and the game to end.
I tried with '''while(isGameRunning){...}''', the made a  boolean class isGameOver, but I can't seem to be able to target the tile. BTW. Each tile is placed randomly across the board each time a new game starts.

sentences:
Sprite Animation in Android with OpenGL ES How to do a sprite animation in android using OpenGL ES?

What i have done :

Now I am able to draw a rectangle and apply my texture(Spritesheet) to it

What I need to know :

Now the rectangle shows the whole sprite sheet as  a whole
How to show a single action from sprite sheet  at a time  and make the animation

It will be very help full if anyone can share any idea's ,
links to tutorials and suggestions.

Advanced Thanks to All

sentences:
Tank / turret animations I don't know if this question is more of Blender / 3D or gamedev / Unreal question, but I decided to ask here first.
What I want to do is make a character, simple robot. The bottom part rides around on wheels, controlled by keyboard, while the top part is a turret that turns towards player cursor (which works as a crosshair).
I made the model in blender, using only two bones, one for the bottom part and one for the turret. I created 4 poses for aiming each direction.
Then, in Unreal, I created 2D aim offset (as I only need one dimension). And after some coding, it works... almost. When I aim forward, and then to the right, it transitions, nice. Then towards the back, also works. But if I then move to the left, instead of rotating extra 90 degrees, the turrent rotates back forward and then to the left.
How can I fix it? Is there some settings in Unreal that I could use, or should I create the model in blender differently? Is the whole rig / bones solution not gonna work?
TLDR: I want the turret on my robot to rotate infinitely to whatever I aim at.

sentences: Can You Make an iPhone game for Free? A friend and I want to try making an iPhone game, but we don't really have a budget to speak of. From what I've found, I need the iOS SDK, and that costs money. Is there really no way to make an iPhone game on a $0 budget? If not, can I do so for the Android?

sentences:
Jump a gameobject when a key is pressed I am working on a platform game,When I press the space bar  the object should jump and  when I release the space bar it should come down.

The code I have used for jump is

void Update () {
    transform.Translate(Vector3.right*Time.deltaTime);
    if(Input.GetKey(KeyCode.Space))
    {
        rigidbody2D.AddForce(Vector3.up*3);
    }

    if(Input.GetKeyUp(KeyCode.Space))
       {
        rigidbody2D.AddForce(Vector3.down);
    }

}

But when I release the space bar the object is not coming down

sentences:
Transform check should return null, but returns as initialized instead In my Player script, I initialize my FirePoint transform using GameObject.Find in the Awake function. In the editor, I purposely misspelled the name of FirePoint to test if the null check inside of my Fire function will print an error to the console. The only error that shows up is from the Awake function giving a NullReferenceException, but why don't I see my Debug.LogError? Instead, the else statement prints that the FirePoint is not null.

public class Player : MonoBehaviour
{

   [HideInInspector] public Transform FirePoint;

   private void Awake()
   {
       FirePoint = GameObject.Find("FirePoint").transform;
   }

   private void Fire()
   {
       if (FirePoint == null)
       {
           Debug.LogError("FirePoint is null.");
       }
       else
       {
           print("FirePoint is NOT null.");
       }
   }
}

sentences:
How can I load/import GIS file (ESRI Shapefile) to Unity3D at runtime? I'm new to Unity3D and I need to implement an open source Markerless Augmented Reality GIS mobile app (Android, IOS) to show the underground utilities (like wastewater pipes, water pipes, electricity lines,...) when the user moves with the mobile camera.

I found some SDKs for Unity3d that use location based AR (like Wikitude, Vuforia, ARCore, ... ) but I have not found a way to load a GIS file format (like ESRI Shapefile, CAD, GeoDB, ... ) at runtime and draw (points, lines, polygons) in 3D Unity shapes in its geographic location.

Screenshot from (vGIS) software to show what I need to implement
.

sentences: In what instances would you want to use path-finding algorithms other than A*? I am familiar with how the common ones technically work (BFS, DFS, Dijkstra, A*) but as far as their realistic benefits I don't quite see the need for them. Considering that, given the right heuristics, A* is more performant then why bother with any others?

sentences: How does Unity call "update()" in the scripts? I understand that you can expose your C++ code to a scripting language such as ChaiScript. From this you can call code that you've made in C++. In Unity, however, they have functions in the script, such as Update() that get called. In other words, how do I call script functions from C++?

sentences:
Does a detailed texture take longer to render? Let's say I want to render a square; its texture is "square.png."

Is it easier for the computer to render it if the texture is just a plain color?

And what about if it is a very noisy texture with completely random colors here and there?

Or what if that texture is noisy in the sense that every pixel in it is different from one to another, but only by a tiny bit?

sentences:
Render Occluded pixels to gray color In 3d space, objects can be occluded by another objects.
By depth testing, the occluded faces are skipped rendering. Only the nearest(smallest) depth value pixels are drawn.
But, sometime we need to render the occluded object or pixels for game play.

To differentiate the occluded object's pixels from foreground pixels, some game use gray color to render the pixels.

This is the sample images for the case.

I guess this can be achieved by some sort of shader.
How can I make this effects in Unity 3D Engine? Any hints or idea plz.

sentences:
Point System For Answering Categorized Questions We are currently developing a gamified e-learning website.

The website will have a point system where the users can gain points by doing either asking or posting questions. Questions are grouped by categories. Every time they answer/post a question, they get points for it.

The problem is students can easily gain points by repeatedly posting questions and get a lot of points. In order to prevent this we decided to implement a point system where posting questions will garner less points than answering questions. The point system will also follow the law of supply and demand.

When the amount of unanswered questions for a category is greater than the median of the total questions, the amount of points you will gain from asking a question on that category decreases while the amount of points gained from answering increases vice versa.

Our initial plan was to set a range for points with 1 point being our minimum and 8 being the max. By following the rule above we labeled each category with "Lower points" being the categories less than the median, and "Higher points" for the categories higher than the median. "Higher points" will have points ranging from 5-8 while "Lower points" will have a range of 1-4.

The points shown here are for answering questions

The problem is if there is an outlier the points given is not justifiable

We believe that points from category 7 should garner smaller points because of the huge difference of questions from category 8.

We also want to limit the maximum points from answering to 8

Is there any other better point system if this does not seem fit?

sentences:
Allowing one sprite to move through another in Quintus I have a Bumper class extended from Sprite:

Q.Sprite.extend("Bumper", {

    init: function(p) {
        this._super(p, {gravity: 0});
        this.add("2d, ... //etc.
}

I have an Enemy class that should trigger a function when the center of the Bumper and of the Enemy collide.

I was thinking about doing something like this in my Enemy class :

this.on("bump.top, bump.bottom, bump.left, bump.right", function(collision) {
    if(collision.obj.isA("Bumper")) {
        if (this.p.x == collision.obj.p.x && this.p.y == collision.obj.p.y) {
        //Do something
        }
    }
});

But for that I need the two sprites to move through one another. Is there a way to do that while still checking for collision ?

sentences:
Why do I get this compile error when using InputComponents in UE4? I'm following this documentation, but it doesn't compile cause of "InputComponent". Unfortunately the error is not that clear even in my language.

Here's the error:

  CompilerResultsLog: Error: C:\Users\Paradisee\Desktop\C++\Paper\Source\Paper\PlayerTile.cpp(83) : note: I tipi a cui si punta sono privi di relazioni. La conversione richiede reinterpret_cast, cast di tipo C o cast di tipo funzione
  CompilerResultsLog: ERROR: UBT ERROR: Failed to produce item: C:\Users\Paradisee\Desktop\C++\Paper\Binaries\Win64\UE4Editor-Paper-583.dll

Here's the code:

// Called to bind functionality to input
void APlayerTile::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    // Respond every frame to the values of our two movement axes, "MoveX" and "MoveY".
    InputComponent->BindAction("MoveX", IE_Pressed, this, &APlayerTile::MoveX);
    InputComponent->BindAction("MoveY", IE_Pressed, this, &APlayerTile::MoveY);
}

This is the definition of the method MoveX():

void APlayerTile::MoveX(float AxisValue)
{

}

sentences:
2d games unity vs Flash do people find unity better than flash for 2d games while unity is 3d engine , or Flash still better because it's made for 2d games and flash can get the job done faster ,and now flash is better for ios/android 2d games .
so what platform is the best for 2d games?

sentences:
Implementing a "tech tree" Writing for android, but this is an abstract question for any OO language.  Is there a "best-practice" for implementing a TechTree?

Here is an example:

    Vegetation  ->v     Strawberries        ->      BioDome
    Livestock   ->      Biomass

In this example, both Vegetation and Livestock are required for Biomass, but only Vegetation is required for Strawberries.

I have brainstormed a handful of implementations, but I'm not very confident with any of them.  I will probably be loading the techs from XML, if that matters.

Is there a "best-practice"for implementing tech trees?

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

My matrix looks something like this:

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

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

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

I'll include a visual aid if needed.

sentences: Batching a bunch of gameObjects that change their color So I have a bunch of cubes instantiated. Each time the player hits one of these cubes (which is quite often) they change their color to match that of the player. What would be a performant way to do this? So far i am doing this on OnTriggerEnter then grab my player’s mesh renderer, get its material and get the color. This is quite an expensive process. I was wondering if there is any better way. The cubes do not move by the way, so if they can somehow be batched as well that would be a plus! Also, the player’s color is random.

sentences:
Weird case of a key not working I finished a game in Java. It works perfectly fine on my computer.

Sent it to a friend. On his computer, for some reason, one of the keys that are used to play doesn't work inside the game. (It works in any other context, like a web browser).

He tried pushing this key with no other keys held. Still didn't work. So it's not a 'key combination' issue.

We both use Windows and the most updated JRE version.

What could it be? This is really weird. Thanks

sentences:
What are some examples of MMOs with small development teams? I'd like to see a list of MMOs with small development teams in order to better understand where small teams have found a place for themselves.

While examples of MMORPGs are of interest, so are games focusing on socializing, trade and commerce, city or empire building, crafting, exploration, strategy and so on.  Any shipping game supporting between, say 800 and 10,000 simultaneous players belongs on this list.

sentences:
A star algorithm implementation problems I’m having some trouble implementing the A* algorithm in a 2D tile based game.

The problem is basically that the algorithm gets stuck when something gets in its direct way (e.g. walls)
Note that it only allows Horizontal and Vertical movement.

Here's a picture as it works fine across the map without something in its direct way: (Green tile = destination, Blue = In closed list, Green = in open list)

This is what happens if I try to walk 'around' a wall:

EDIT

Thanks DeadMG, I rewrote the algorithm last week and got it somewhat working.

But the heuristics are still some faulty.

As you can see here it prefers a uneven path on an straight way:

The heuristics function:

float c_astar::GetH(cTILEext TILEX)
{
    short a = 0; short b = 0;
    if(TILEX.Tile.Position.x > Destination.x) a = TILEX.Tile.Position.x - Destination.x;
    else a = Destination.x - TILEX.Tile.Position.x;
    if(TILEX.Tile.Position.y > Destination.y) b = TILEX.Tile.Position.y - Destination.y;
    else b = Destination.y - TILEX.Tile.Position.y;

    float h = a+b;

    //Tie-Breaker
    float dx1,dy1,dx2,dy2;
    dx1=dy1=dx2=dy2 = 0;

    if(TILEX.Tile.Position.x > Destination.x) dx1 = TILEX.Tile.Position.x - Destination.x;
    else dx1 = Destination.x - TILEX.Tile.Position.x;

    if(TILEX.Tile.Position.y > Destination.y) dy1 = TILEX.Tile.Position.y - Destination.y;
    else dy1 = Destination.y - TILEX.Tile.Position.y;

    if(Start.x > Destination.x) dx2 = Start.x - Destination.x;
    else dx2 = Destination.x - Start.x;

    if(Start.y > Destination.y) dy2 = Start.y - Destination.y;
    else dy2 = Destination.y - Start.y;
    float cross = abs(dx1*dy2 - dx2*dy1);

    h += cross*0.001;

    return h;
}

I used the Tie-Breaker as described here. What am I doing wrong?

Regards,
bryan226

sentences:
What is an efficient way to deal with large, scrolling background images? In my mobile game you basically you just fly up (infinite height) and collect stars.

I have many quite large background images, scaled down so that their width is the same as the device width. Then they are appended after each other during rendering.

Since I implemented these backgrounds, my game runs poorly. I've got about 20 background images with a size of 800x480 each; without backgrounds the game is quite smooth.

Does anyone have an idea how to implement this many backgrounds without making the game slow down?

The images are used as a 2DTexture.
If I leave the clouds out of the image and "just" display the blue part, the app still slows down. Showing some code is a bit difficult, because I got many many classes which will do the loading, rendering and display stuff. Basically its done as Google does it in there "spriteMethodTest" example here:
http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest

2 of these image set.

First: http://picbox.im/view/b7c8c86abb-01.png

Second: http ://picbox.im/view/3a8162314a-02.png

sentences:
Game state management (Game, Menu, Titlescreen, etc) Basically, in every single game I've made so far, I always have a variable like "current_state", which can be "game", "titlescreen", "gameoverscreen", etc.

And then on my Update function I have a huge:

if current_state == "game"
  game stuf
  ...
else if current_state == "titlescreen"
  ...

However, I don't feel like this is a professional/clean way of handling states. Any ideas on how to do this in a better way? Or is this the standard way?

sentences:
Combining a pure ECS with a FSM scheduling system Currently I am evaluating how to refactor my core game logic since I tried to design most of it in pure ECS but isn't really completely feasible the way I intended it.
My game at its core is a turn-based roguelike with multiple (implicit) phases during a turn:

Player Action Phase: Movement, Attack or Item Usage

If the chosen action was Attack or Item Usage, handle it right away
Otherwise, queue a Movement intent

Movement Phase: All units that decided to move will move simultaneously
Attack Phase: All enemy units that haven't moved will attack one-by-one
End Phase: Resolve status effects

These phases have been difficult to design with ECS. Certain systems have checks whether the should run right now with a bunch of tag components. Examples include:

The BehaviorSystem updates enemy entities, that are currently thinking (applied after any player actions have been resolved), but have neither finished their turn yet and are not suppressed by anything (usually used to await animations).
The AttackerSelectionSystem that only runs when no movement or attack animation is currently playing and then only picks enemies that still have to attack, sorts them by initiative and tags the next enemy to start his attack during the next frame.

Eventually my current architecture won't scale well with more and more systems to come, especially with different kinds of game states such as game elements that are UI only, in-town/hub maps where I don't need any of these combat/turn-based elements and finally the instance/dungeon areas where I will need them.

My idea is now to include a FSM in my Game class decoupled from the ECS itself to handle my current approach to invoke systems:
auto Game::Implementation::updateSystems(const sf::Time DeltaTime) -> void {
  updatePlayerControllers(Registry, InputManager, Tilemap);
  updateBehaviors(Registry, Tilemap);
  updateMovementAnimations(Registry, DeltaTime);
  updateAttackerSelection(Registry);
  updateAttackAnimations(Registry, DeltaTime);
  updateDamageEvents(Registry, ContentManager);
  updateFloatingCombatTextAnimations(Registry, DeltaTime);
  updateEndOfTurn(Registry);
  updateLocalToWorldTransforms(Registry);
  updateSpriteRendererTransforms(Registry);
  updateEntityRemovals(Registry);
}

Now I am evaluating how to implement this in a clean way. I fear with too many states I might end up with spaghetti scheduling using weird if/switch constructs. Alternatively I could add a check at the beginning of each system whether the current state of the FSM/game allows them to even run.
Finally a most sophisticated approach would most likely be a dependency graph with conditions that will schedule the systems to run each frame.
Are there any common patterns and approaches to handle this scheduling based on game/turn state?

sentences:
Input events not working simultaneously on android devices in libgdx I am making a simple platform game in Libgdx... in which I have made the player to move left, move right and jump. The code works fine on Desktop but on Android devices, Jump is not fired when the player moves left or right. It looks strange. Here is my code...

private void updatePlayerForUserInput(float deltaTime)
    {

    // check input and apply to velocity & state
    if ((Gdx.input.isKeyPressed(Keys.SPACE) || isTouched(0.87f, 1,0,1f)) && world.player.grounded)
    {
        world.player.velocity.y += world.player.JUMP_VELOCITY;
        world.player.state =2;
        world.player.grounded = false;
    }

    if (Gdx.input.isKeyPressed(Keys.LEFT) || Gdx.input.isKeyPressed(Keys.A) || isTouched(0, 0.1f,0,1f))
    {
        world.player.velocity.x -=world.player.MAX_VELOCITY;
        if (world.player.grounded)
            world.player.state =1;
        world.player.facesRight = false;
    }

    if (Gdx.input.isKeyPressed(Keys.RIGHT) || Gdx.input.isKeyPressed(Keys.D) || isTouched(0.2f, 0.3f,0,1f))
    {
        world.player.velocity.x =world.player.MAX_VELOCITY;
        if (world.player.grounded)
            world.player.state =1;
        world.player.facesRight = true;

    }
}

private boolean isTouched(float startX, float endX , float startY, float endY)
{
    // check if any finge is touch the area between startX and endX
    // startX/endX are given between 0 (left edge of the screen) and 1 (right edge of the screen)
    for (int i = 0; i < 2; i++)
    {
        float x = Gdx.input.getX() / (float) Gdx.graphics.getWidth();
        float y = Gdx.input.getY() / (float) Gdx.graphics.getHeight();
        if (Gdx.input.isTouched(i) && (x >= startX && x <= endX) && (y>=startY && y<= endY))
        {
            return true;
        }
    }
    return false;
}

I took the idea from the demo platform game SuperKoalio by mzencher at

https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/superkoalio/SuperKoalio.java

Please suggest

sentences:
How do I use the dot product to get an angle between two vectors? I am learning to use normalized vectors in my games.

I've learned that in order to know the angle between two vectors, I can use the dot product. This gives me a value between -1 and 1, where

1 means the vectors are parallel and facing the same direction (the angle is 180 degrees).
-1 means they are parallel and facing opposite directions (still 180 degrees).
0 means the angle between them is 90 degrees.

I want to know how to convert the dot product of two vectors, to an actual angle in degrees. For example, if the dot product of two vectors is 0.28, what is the corresponding angle, between 0 and 360 degrees?

sentences:
GLSL - Efficient Point inside Box Check I'm attempting to improve the performance of a shader that changes the colour of a region of the world that is inside a "zone".

I am using a deferred lighting system, so the colour and world-space position of each pixel on the screen are stored in two separate textures, gColor and gPosition.

The zonePos uniform stores the two corners of each zone.
The zoneColor uniform stores the colour of each zone.
The totalZones uniform stores the amount of zones in the current game.

Here is the fragment shader:

out vec4 FragColor;

in vec2 texCoords;

layout (binding = 0) uniform sampler2D gColor;
layout (binding = 1) uniform sampler2D gPosition;

uniform vec3 zonePos[10];
uniform vec3 zoneColor[5];
uniform int totalZones;

void main()
{
    vec3 FragPos = texture(gPosition, texCoords).rgb;
    vec3 Albedo = texture(gColor, texCoords).rgb;

    vec3 j;
    vec3 k;

    for (int i = totalZones; i > 0; i--)
    {
        j = zonePos[i * 2];
        k = zonePos[i * 2 + 1];

        if (FragPos.x >= j.x && FragPos.x <= k.x &&
            FragPos.y >= j.y && FragPos.y <= k.y &&
            FragPos.z >= j.z && FragPos.z <= k.z)
                Albedo += zoneColor[i];
    }

    FragColor = vec4(Albedo, 1.0);
}

The changes I have made so far are:

Using j and k, rather than accessing zonePos 6 times in the if statement
Looping down from totalZones to 0, as a comparison against 0 is faster

Any suggestions are greatly appreciated.

sentences:
OnTriggerExit2D called multiple times when two triggers touch I have two GameObjects tagged "Point", each with a Collider 2D set to Is Trigger.

I have another GameObject, "pencil", which also has a Collider2D set to Is Trigger

I want to move the pencil the first point to the start drawing a line, and then stop drawing when it hits the second point.

My problem is that when the pencil hits a point, it calls OnTriggerExit2D multiple times. How can I only detect first contact with the point?

Pencil script:

private void OnTriggerExit2D(Collider2D collision)
{
    if (!collision.isTrigger)
    {
        if (collision.gameObject.tag == "Point")
        {
            writing = !writing;
        }
    }
}

sentences:
How do I render a PNG image with OpenGL? I have an image (100×200 px) painted with Paint.NET and saved as a .png with 32-bit color depth. How can I render it using OpenGL 1.1  (with the LWJGL binding) or higher inside the display?

I tried creating a ByteBuffer, then loading the pixel color values inside that buffer, but I'm missing the OpenGL settings that need to be enabled. Some help?

sentences:
Trying to create a UE4 blueprint or script to recognize set shapes I'm currently developing an indie game using Unreal Engine 4 and I've stopped developing it within the last week because I have hit a massive roadblock..

I am trying to figure out how to create a blueprint (or c++ script if necessary) that can have a library of different shapes such as an L (2x1 blocks) in any order which would fit within a 5x5x5 (x,y,z) crafting grid in the game world. See the screenshot with the L shape near the green arrows as a sort of gun object to configure and craft from blocks so long as it matches that particular shape. It's almost like minecraft's crafting system but instead of in the menu this one is on a platform in the game world.

I've tried researching and looking at stuff on youtube and google searching like blueprinting, grid systems, shape systems, crafting systems, building systems, arrays, and now I am thinking maybe I have to use c++ instead just to try to figure out how to make it happen.

Does anyone with more experience on this stuff have any advice or better ideas on how I can create this? Any help to point me in the right direction is greatly appreciated, thanks in advance!

sentences:
How do I implement a quaternion based camera? UPDATE The error here was a pretty simple one. I have missed a radian to degrees conversion. No need to read the whole thing if you have some other problem.

I looked at several tutorials about this and when I thought I understood I tried to implement a quaternion based camera. The problem is it doesn't work correctly, after rotating for approx. 10 degrees it jumps back to -10 degrees. I have no idea what's wrong. I'm using openTK and it already has a quaternion class. I'm a noob at opengl, I'm doing this just for fun, and don't really understand quaternions, so probably I'm doing something stupid here. Here is some code: (Actually almost all the code except the methods that load and draw a vbo (it is taken from an OpenTK sample that demonstrates vbo-s))

I load a cube into a vbo and initialize the quaternion for the camera

protected override void OnLoad(EventArgs e) {
    base.OnLoad(e);

    cameraPos = new Vector3(0, 0, 7);
    cameraRot = Quaternion.FromAxisAngle(new Vector3(0,0,-1), 0);

    GL.ClearColor(System.Drawing.Color.MidnightBlue);
    GL.Enable(EnableCap.DepthTest);

    vbo = LoadVBO(CubeVertices, CubeElements);
}

I load a perspective projection here. This is loaded at the beginning and every time I resize the window.

protected override void OnResize(EventArgs e) {
    base.OnResize(e);

    GL.Viewport(0, 0, Width, Height);

    float aspect_ratio = Width / (float)Height;

    Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect_ratio, 1, 64);
    GL.MatrixMode(MatrixMode.Projection);
    GL.LoadMatrix(ref perpective);
}

Here I get the last rotation value and create a new quaternion that represents only the last rotation and multiply it with the camera quaternion. After this I transform this into axis-angle so that opengl can use it. (This is how I understood it from several online quaternion tutorials)

protected override void OnRenderFrame(FrameEventArgs e) {
    base.OnRenderFrame(e);

    GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

    double speed = 1;
    double rx = 0, ry = 0;

    if (Keyboard[Key.A]) {
        ry = -speed * e.Time;
    }

    if (Keyboard[Key.D]) {
        ry = +speed * e.Time;
    }

    if (Keyboard[Key.W]) {
        rx = +speed * e.Time;
    }

    if (Keyboard[Key.S]) {
        rx = -speed * e.Time;
    }

    Quaternion tmpQuat = Quaternion.FromAxisAngle(new Vector3(0,1,0), (float)ry);
    cameraRot = tmpQuat * cameraRot;
    cameraRot.Normalize();

    GL.MatrixMode(MatrixMode.Modelview);
    GL.LoadIdentity();

    Vector3 axis;
    float angle;

    cameraRot.ToAxisAngle(out axis, out angle);
    //////////////////////////////////////////////////////////////////////
    // THIS IS WHAT I DID WRONG: I NEED TO CONVERT FROM RADIANS TO DEGREES
    //////////////////////////////////////////////////////////////////////
    //BEFORE
    //GL.Rotate(angle, axis);
    //AFTER
    GL.Rotate(angle * (float)180.0/(float)Math.PI, axis);
    GL.Translate(-cameraPos);

    Draw(vbo);
    SwapBuffers();
}

Here are 2 images to explain better:
I rotate a while and from this:

it jumps into this

Any help is appreciated.

Update1: I add these to a streamwriter that writes into a file:

    sw.WriteLine("camerarot: X:{0} Y:{1} Z:{2} W:{3} L:{4}", cameraRot.X, cameraRot.Y, cameraRot.Z, cameraRot.W, cameraRot.Length);
    sw.WriteLine("ry: {0}", ry);

The log is available here: http://www.pasteall.org/26133/text. At line 770 the cube jumps from right to left, when camerarot.Y changes signs. I don't know if this is normal.

Update2 Here is the complete project.

sentences:
WebGL - send part of texture to GPU I have a matrix of pixels in RAM memory, e.g. 1000x1000 pixels. I send it to GPU using

gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1000,1000, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels);

Which works great. But then I change some pixels, located in rectangle x=50, y=50, width =100, height=100. Sending the whole 1000x1000px picture again takes too much time, I would like to send only changed sub-area to the GPU.

I have tired

gl.texSubImage2D(gl.TEXTURE_2D, 0, 50,50, 100,100, gl.RGBA, gl.UNSIGNED_BYTE, pixels);

but it seems, that parameter "pixels" should be the sub-area of 100x100 pixels. Copying out a sub-area from a large picture also takes too much time. Can I somehow specify a sub-rectangle for source pixels in RAM? Maybe somehow using gl.pixelStorei() ?

UPDATE: I discovered that it is possible in WebGL 2.0 (= OpenGL ES 3.0) using gl.pixelStorei() by changing  PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS  parameters. Too bad WebGL 2.0 is not supported in most of devices now :(

sentences:
How to draw 2D images using OpenGL, in SDL? After everything, I managed to find a simple piece of code that shows how to draw a 2D image with openGL:

    #include "SDL/SDL.h"
    #include "SDL/SDL_opengl.h"
    #include "SDL/SDL_image.h"

    const int SCREEN_WIDTH = 640;
    const int SCREEN_HEIGHT = 480;
    const int SCREEN_BPP = 32;

    int tex;

    int loadTexture(char* fileName){
        SDL_Surface *image=IMG_Load(fileName);
        SDL_DisplayFormatAlpha(image);
        GLuint object;
        glGenTextures(1,&object);
        glBindTexture(GL_TEXTURE_2D,object);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE);
        glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE);
        glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,image->w,image ->h,0,GL_RGBA,GL_UNSIGNED_BYTE,image->pixels);
        SDL_FreeSurface(image);
        return object;
    }
    void init(){
        glClearColor(0.0,0.0,0.0,0.0);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0.0,800,600,1.0,-1.0,1.0);
        glEnable(GL_BLEND);
        glEnable(GL_TEXTURE_2D);
        glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
        tex = loadTexture("hi.png");
    }
    void draw(){
        glClear(GL_COLOR_BUFFER_BIT);
        glBindTexture(GL_TEXTURE_2D,tex);
        glBegin(GL_QUADS);
            glTexCoord2f(0,0);
            glVertex2f(0,0);
            glTexCoord2f(1,0);
            glVertex2f(500,0);
            glTexCoord2f(1,1);
            glVertex2f(500,500);
            glTexCoord2f(0,1);
            glVertex2f(0,500);
        glEnd();
        glFlush();
    }
    int main(int argc,char** argv){
        SDL_Init(SDL_INIT_EVERYTHING);
        SDL_Surface* screen=SDL_SetVideoMode(800,600,32,SDL_SWSURFACE|SDL_OPENGL);
        bool running=true;
        Uint32 start;
        SDL_Event event;
        init();
        while(running){
            start=SDL_GetTicks();
            draw();
            while(SDL_PollEvent(&event)){
                switch(event.type){
                    case SDL_QUIT:
                        running=false;
                        break;
                }
            }
            SDL_GL_SwapBuffers();
            if(1000/60>(SDL_GetTicks()-start))
                SDL_Delay(1000/60-(SDL_GetTicks()-start));
        }
        SDL_Quit();
        return 0;
    }

I'm inexperienced in 2D, and about a week ago started messing with SDL. Built some simple structures to have images, which would be on layers, so I could have my own drawing order, so sprites would be drawn after background, etc, and then did a little "sprite engine".
I got a Megaman sprite walking left and right just like I wanted it, above a simple 900x900ish background image.

Thing is, CPU almost reached 20% on my i5... so I thought of using the graphic card to do the drawing! Delved abit into OpenGL and today, finally managed to get gl3w working!

So now I'm looking for a simple way to display my sprites/images, on the window, through use of OpenGL. I've tried all sorts of code I ran across, but I can't get anything displaying, despite that I've done error checks basically everywhere, and everything seems to check out to be right!

TL:DR; I was looking for some simple working code, using SDL, on how to draw 2D images (which, if it doesn't work, for sure I've got something wrong).

Thanks!

sentences:
How to make object move in exact gametime in Monogame, XNA? I have recently started learning monogame. The big question i faced is how to make object move, when gametime variable has an exact value.

//Update method in Game.cs
     float delta = (float)gameTime.ElapsedGameTime.Milliseconds / 1000f;
        if (CurrentState != null)
            CurrentState.update(delta);

     if (Keyboard.GetState().IsKeyDown(Keys.Enter))
            SetState(new GameState());

    //GameState.cs, there is a box that's need to be moved in 5 seconds
    Vector2 boxpos = new Vector2(800, Game1.graphics.PreferredBackBufferHeight / 2 - 100);
    float olddelta = 0;
    public void update(float delta)
    {
        float newdelta = delta;
        if (newdelta - olddelta >= 5)
        {
            boxpos += new Vector2(0, -200);
            olddelta = newdelta;
        }
    }

I've drawn a box in my gamestate's draw method using spritebatch.Draw(Box, boxpos, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);, but it's position remains constant.
I really have no idea how to do it in a right way. Hope can receive some help.

sentences:
Unity | Camera - Follow target with view port point's offset from center Some additional remarks before I address the issue:

How Viewports work in Unity:

Whatever the dimensions of the screen's rect, the viewports coordinates are mapped in normalized coordinates, where 0 represents left and bottom, for x and y respectively, and 1 right and top, for x and y respectively (image below).

Follow a Target (Easy implementation for the sake of demonstration):

Consider this following simple algorithm to follow a target:

CameraFollowExample : MonoBehaviour
{
    public Transform target;
    public bool relativeToTarget;
    public Vector3 followOffset;

    private void LateUpdate()
    {
        if(target != null) FollowTarget();
    }

    private void FollowTarget()
    {
        transform.position = target.position + (relativeToTarget ? target.TransformDirection(followOffset) : followOffset);
        transform.Lookat(target);
    }
}

Issue:

The following works as expected, but the target will always be at the viewport's center ({ 0.0, 0.0 })

What I am trying to Achieve:

This is what I am trying to achieve: make camera follow a given target, with an additional offset from the viewport's center. This offset being additional to the following offset applied to the target.

So for example, if I define two ranged floats, centerX and centerY respectively, I'd like the camera to be positioned with an additional offset, so the defined offset is at the target. As an example, on the image below, I have centerX and centerY on { 0.2, 0.25 } respectively, so the target should be at that viewport's point.

Having a resulting (partial) script:

CameraFollowExample : MonoBehaviour
{
    public Transform target;
    public bool relativeToTarget;
    public Vector3 followOffset;
    [Range(0.0f, 1.0f)] public float centerX;
    [Range(0.0f, 1.0f)] public float centerY;

    private void LateUpdate()
    {
        if(target != null) FollowTarget();
    }

    private void FollowTarget()
    {
        Vector3 destination = target.position + (relativeToTarget ? target.TransformDirection(followOffset) : followOffset);
        transform.position = destination + GetCalculatedOffset();
        transform.Lookat(target);
    }

    private Vector3 GetCalculatedOffset()
    {
        // interpret the Vector { centerX, centerY } to return an offset.
        // return (interpretedOffset - target.position);
    }
}

What I have already tried:

Make the camera position to the destination plus an offset of the center [{centerX, centerY} - {0.5, 0.5}], the direction is ok, but obviously, the target is not positioned at the expected viewports' point coordinate.
Have a global vector that is the custom center point relative to the camera's transform and the nearPlane, and then make an offset between that point and the target, ignoring the z. The camera gets away from the target.

What I am not trying to achieve:

Something like following example (define an additional offset vector, and position the camera with the additional offset):

CameraFollowExample : MonoBehaviour
{
    public Transform target;
    public bool relativeToTarget;
    public Vector3 followOffset;
    public Vector3 additionalOffset;

    private void LateUpdate()
    {
        if(target != null) FollowTarget();
    }

    private void FollowTarget()
    {
        Vector3 destination = target.position + (relativeToTarget ? target.TransformDirection(followOffset) : followOffset);
        transform.position = destination + additionalOffset;
        transform.Lookat(target);
    }
}

I mean, this technically works, since the target won't be at the center of the viewport. But the intention is for the target to be positioned at the defined viewport's point.

Any additional information you may need, let me know. Thank you beforehand, and Happy New Year.

sentences:
Why the object is not getting close enough to the waypoint/s too high? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Waypoints : MonoBehaviour
{
    public GameObject objectToMove;
    public GameObject[] waypoints;
    public Transform target;
    public float moveSpeed = 1f;
    public float rotationSpeed = 1f;
    private Transform myTransform;
    private int targetsIndex = 0;
    private Vector3 originalPosition;
    private bool visitNpcsDistance = false;

    public float walkSpeed = 15f;

    // Use this for initialization
    void Start()
    {
        if (objectToMove == null)
        {
            myTransform = transform;
        }
        else
        {
            myTransform = objectToMove.transform;
        }

        originalPosition = myTransform.position;

        if (waypoints.Length == 0)
        {
            waypoints = GameObject.FindGameObjectsWithTag("Waypoint");
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (visitNpcsDistance == false)
        {
            WayPointsAI();
        }

        DrawLinesInScene();
    }

    private void WayPointsAI()
    {
        if (targetsIndex == waypoints.Length)
            targetsIndex = 0;
        target = waypoints[targetsIndex].transform;
        float distance = Vector3.Distance(myTransform.position, target.transform.position);
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

        //move towards the player
        myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
        if (distance < 0.3f)
            targetsIndex++;
    }

    void DrawLinesInScene()
    {
        // draw lines between each checkpoint //
        for (int i = 0; i < waypoints.Length - 1; i++)
        {
            Debug.DrawLine(waypoints[i].transform.position, waypoints[i + 1].transform.position, Color.blue);
        }

        // draw a line between the original transform start position
        // and the current transform position //
        Debug.DrawLine(originalPosition, myTransform.position, Color.red);

        // draw a line between current transform position and the next waypoint target
        // each time reached a waypoint.
        if (target != null)
            Debug.DrawLine(target.transform.position, myTransform.position, Color.green);
    }
}

The object that move between the waypoints. I added to it a box collider and set the size of the collider to 0.4,0.4,0.4 it was 0.5,0.5,0.5

The moving object also have a rigidbody I added :

Each waypoints sphere WP1,WP2....scale is set to 0.3,0..3,0.3

I added some spheres as waypoints on a stairs so the object will move up and down the stairs.
But when it's moving up and down the object seems to be too far from the waypoints :

Look at the droid (the object that move between the waypoints) height and it's not 0.3f distance from the waypoint/s. I don't want the droid to walk on the stairs move on it touch the stairs I want it to be in the air a bit but not that high.

The droid selected and set to center and local :

when changing the local to global nothing changed but when changing the center to pivot :

sentences:
Move enemies over the network without sending their positions I am trying to move enemies on two clients without sharing their positions. I use this:
startingPosition + GetRandomDir() * Random.Range(1f, 10f)

To have the same movement on clients and server, I set the same seed to get the same directions with Unity Random.
I set it with the system datetime now ticks on server and clients:
Random.InitState(newTicks);

I am getting the same movements on the server and on the clients until a enemy starts looking for a player and chasing that player.
When this happens, the enemy on one client is not at the same position on the other client. One enemy is targeting a player on one client, but on the other client he hasn't targeted that player yet. The enemy keeps wandering creating a different position on one client than on the server or other clients for example.
Is there a better way to synchronize the enemy movement ?
My idea was not to send the positions of the enemies from the server to the clients but rather have the clients move their enemies themselves.
I would also like to know what to search for on Google to get help with this problem: networking ai movement doesn't help, synchronize movement over the network without sending position does not return the results I would like either.
What I think is strange and I don't understand is that the same code is executed on both the client and the server. The players and the enemies are at the same positions. Yet the enemy will choose to chase a player on the server and not to chase a player on the client. Resulting on the client to view the enemy at a different position than the position of the enemy on the server.

sentences:
Predicted target location I'm having an issue with calculating the predicted linear angle a projectile needs to move in to intersect a moving enemy ship for my 2D game.

I've tried following the document here, but what I've have come up with is simply awful.

protected Vector2 GetPredictedPosition(float angleToEnemy, ShipCompartment origin, ShipCompartment target)
{
    // Below obviously won't compile (document wants a Vector, not sure how to get that from a single float?)
    Vector2 velocity = target.Thrust - 25f; // Closing velocity (25 is example projectile velocity)
    Vector2 distance = target.Position - origin.Position; // Range to close
    double time = distance.Length() / velocity.Length(); // Time

    // Garbage code, doesn't compile, this method is incorrect
    return target.Position + (target.Thrust * time);
}

I would be grateful if the community can help point out how this is done correctly.

sentences:
Pre baked fractures and explosion : I need an answer for C++ What are the prebaked or precomputed explosions or fractures from a programmer viewpoint ?

I would like to know how to achieve this in C++ and how this things are usually considered (they are animations? textures?), it would be perfect if there will be some examples available or someone that can picture a broad view about this.

I need to add a really small support for this in my code and i need an hint about how to start, i would like to do this on my own without other libraries.

sentences:
Minecraft-Style Voxel Sunlight Algorithm I'm implementing a pure Minecraft clone, and I want to implement sunlight.
I have a basic sunlight algorithm working perfectly in 2D, and I understand how to scale it to 3D.  But how do I make it so I don't have to recompute the entire sunlight every time I place a block?

Pseudocode, because the actual algorithm is not written very well :)

FUNC propogateSunlight(x,y,z):
    IF (x,y,z) is out of bounds then RETURN
    IF light_at(x,y,z) is <= 0 then RETURN

    # PROPOGATE
    IF light_can_spread(x,y-1,z) AND light_at(x,y-1,z)<light_at(x,y,z) then:
        set_light_at(x,y-1,z) to light_at(x,y,z)
        propogateSunlight(x,y-1,z)
    IF light_can_spread(x-1,y,z) AND light_at(x-1,y,z)<light_at(x,y,z) then:
        set_light_at(x-1,y,z) to light_at(x,y,z)-1
        propogateSunlight(x-1,y,z)
    *repeat above IF statement for (x-1,y,z), (x+1,y,z), (x,y,z-1), (x,y,z+1) and (x,y+1,z)

Then it sets the top layer to 16 (the max light level) and calls propogateSunlight on the top level.

This algorithm does what I want it to PERFECTLY.  The only downside is that it is really really slow.

So what (psuedocode) algorithm is there to place / remove blocks (without transparency) that make it so I don't have to recalculate the entire world?

P.S. The coordinate system is standard 3d graphics, XZ is ground plane, +Y is up and -Y is down.

sentences: Early stages of games development - create 2d animation images for iOS games? I am in the early stages of developing a game. I don't have an artist or graphics person on board yet. How can I create simple images for animation to work through the early stages of game development? Should I create stick figure images in Photoshop/Pixelmator or are there other ways of using sample artwork or some other tools which can help make images for animation?

sentences:
Best Way To Develop Robust Cross-Platform Application? Possible Duplicate:
  Any tips for creating cross-platform games?

Windows C programmer here (going back to 1992 and Windows95 back when it was called Windows93). Can function in C++, but mostly still a C programmer.

Looking to build a cross-platform casual game. Very numbers heavy with only a few artistic embellishments and animations, so perhaps a development environment for business apps might be the best option. Or an easy-to-use 2D game dev platform.

Target platforms: Windows, Mac, MS Tablet, iPhone, iPad, Android.

I currently develop on Windows with Visual Studio 2012, but we could spend up to $50K on hardware/software/middleware if necessary. Not very competent getting open-source software working. Would rather pay the money and jump right into app development.

Recommendations?

sentences:
Move Particle to touch position on android I am attempting to make a Particle start moving to the position of my finger on the touch of the screen.

I have been using this as the basis so far:

public void update()
{
    deltaX *= .9;
    deltaY *= .9;

    this.x += this.deltaX;
    this.y += this.deltaY;
}

public void moveTo(int newX, int newY)
{
    float dx = newX-this.x;
    float dy = newY-this.y;

    float length = (float) Math.sqrt(dx*dx+dy*dy);

    dx/=length;
    dy/=length;

    dx *= 10;
    dy *= 10;

    deltaX = dx;
    deltaY= dy;
}

now while it does move the Particle, it is rarely in the direction of my finger.
How can I make the particle have the correct amount of velocity to get to the position of my finger, but no farther?

Thanks in advance!

sentences:
Do UDK mutators only apply on local games? I have developed a pretty simple mutator. It works exactly as intended on a local game against bots, but it doesn't work (nor do any of the stock mutators) on a listen server.

Is this to be expected of UDK (May Beta Release by the way)?

sentences:
Shadow map shimmering, indexing outside the shadow map I have tried to reduce the shadow shimmering/flickering using the technique described here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324%28v=vs.85%29.aspx

It works as I want and shimmering is reduced but sometimes I have artifacts. It looks like my code tries to index space outside the shadow map. The article above writes about it but I didn't find a solution.

When I played with the code I also got black strips on the corners.

Code:

// reduce shadow shimmering/flickering
Vector2 vecWorldUnitsPerTexel = Vector2(D.x() / (float)D.shadowMapSize(), D.y() / (float)D.shadowMapSize());

// get only x and y dimensions
Vector2 min2D = min.vector2(),
                max2D = max.vector2();

min2D /= vecWorldUnitsPerTexel;
min2D = Round(min2D);
min2D *= vecWorldUnitsPerTexel;

max2D /= vecWorldUnitsPerTexel;
max2D = Round(max2D);
max2D *= vecWorldUnitsPerTexel;

min.set(min2D, min.z);
max.set(max2D, max.z);

// crop matrix based on this article https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch10.html
Vector scale;
Vector offset;
scale.x  = 2.0f / (max.x - min.x);
scale.y  = 2.0f / (max.y - min.y);
scale.z =  1.0f / (max.z - min.z);

offset.x = -0.5f * (max.x + min.x) * scale.x;
offset.y = -0.5f * (max.y + min.y) * scale.y;
offset.z = -min.z * scale.z;

Matrix4 m;
m.x = Vector4(scale.x, 0, 0, 0);
m.y = Vector4(0, scale.y, 0, 0);
m.z = Vector4(0, 0, scale.z, 0);
m.w = Vector4(offset.x, offset.y, offset.z, 1.0f);

I think that I should store in the depth map a slightly larger area but I'm not sure how to do this. I tried to change the scale of the crop matrix but it doesn't help.

EDIT:
It seems I've found a solution. When I'm rounding (or flooring) min and max values I subtract one from the min value and add one to the max value. This makes the shadow map contain a slightly larger area and I don't see any artifacts.

sentences:
Update animation based on distance traveled instead of elapsed time? 2D sprite Animation is supposed to be based on the elapsed time from the previous update so that it runs (and looks the same) no matter the speed of the machine/device it's running on.

The method that moves my game objects already takes into account the elapsed time.  The distance the object moves during updates is the elapsed time (delta) * the objects velocity.

Because the object's location changes based on the elapsed time, would it look (/run the same on all machines) passing the "distance delta" to my Animation update method instead of the delta time?  The distance delta would be a number of pixels.  Using the distance would ensure my frame animation lines up with how far the object has traveled.

sentences:
Vector-based fonts vs. bitmap fonts in (2d) games? I know that many games are using bitmap fonts. Which are the advantages for vector-based font rendering / manipulation when compared to bitmap fonts and in which scenarios would they matter the most?

Prefer a focus on 2d games when answering this question.

If relevant, please include examples for games using either approach.

EDIT:
Please also include your personal preference if you have experience with the matter.

Some factors you might consider:

amount of text used in the game
scaling of text
overlaying glyphs and anti-aliasing
general rendering quality
font colors and styling
user interface requirements
localisation / unicode
text wrapping and formatting
cross-platform deployment
2d vs 3d

Background:

I am developing a simple falling blocks game in 2d, targeted for pc. I would like to add text labels for level, score, and menu buttons. I am using SFML which uses FreeType internally, so vector-based features are easily available for my project.

In my view, font sizes in simple games often don't vary, and bitmap fonts should be easier for cross-platform concerns (font-formats and font rendering quality). But I am unsure if I am missing some important points here, especially since I want to polish the looks of the final game.

sentences:
How to use LuaJIT the same that Lua in a C++ program? I'm using Lua in my C++ program, as an library. But I read that LuaJIT is a better implementation.

Is it posible to replace with LuaJIT with little change? How?

sentences:
Attaching objects on collision in Unity? I'm trying to make a game where the player can connect objects Lego style with objects becoming children of any object they come into contact with, so if the parent object is moved the child is moved too, but the child object can be dragged away to disconnect it.

What is the best way to go about doing this?

sentences:
How to deal with crackers who are also trolls? Assuming the following:

the game will be cracked at some pont no matter what
players are pushing to the limits
trolls exist

What happens when these 3 combines?

Regulating a troll can be handled if the device / game is not cracked, i.e. kick out, ban etc.

But how to handle someone who comes online with different identities and ruins others fun?

Do you check patterns? (same IP, being cooperative instead of competitive?)
Should this be crowd sourced like in wikipedia and add rights to trusted users?

We are having these issues, even though our game has only a small community.

Is the game free, or is a subscription / purchase required? Is the online element peer to peer or does it go through a server under your control? – Adam 5 mins ago

Answers to Adam's comment:

iOS game. Free version is available without multiplayer
Traffic goes through a server and is under our control

sentences:
Would it be a good idea to offload tasks like navigation to the GPU? So I was reading through my copy of GPU Pro 2 and I came across a chapter for building a rendering pipeline for real-time crowds. The implementation uses render targets on the GPU to update agents and finite state machines while also performing frustum culling and level of detail sorting. With this approach, the test case in the chapter is able to easily render about 8,000 characters walking in a crowd.

My question is have any games started taking advantage of the GPU for task other than rendering and physics such as game object updating and AI? And if so, are there any conceivable disadvantages to their implementations?

I ask this because I'm thinking about going this route with my game using D11 DirectCompute to create and simulate large scale space battles. Off the top of my head, I think the GPU would at least be a good tool in calculating and blending steering behaviors.

sentences:
How do I get a popup menu to block clicks from hitting UI elements beneath it? You can see in the picture that I have a Canvas with a popup menu in it. I just enable this, and it covers the main menu stuff. Clicks go through it and hit stuff in the main menu.

I've tried adding an EventTrigger to the PopupRoot object, and adding an event to listen for PointerClick events, but it doesn't fire.

EventTrigger trigger = m_popUpRoot.GetComponentInChildren<EventTrigger>();
EventTrigger.Entry entry = new EventTrigger.Entry();
entry.eventID = EventTriggerType.PointerClick;
entry.callback.AddListener((eventData) => { PopupClickBlocker((PointerEventData)eventData); });
trigger.triggers.Add(entry);

I'm open to other suggestions. My current system is horrible; button click events query the Popup to see if it's enabled or not, then return doing nothing if it is. This doesn't work for sliders very well, so I want to do this the right way.

sentences:
How to know if these profiler values are good or bad? I'm making a 2D game for Android Mobile using LibGDX and Java in Android Studio. My game mostly runs alright with 60FPS, but for some time to time it lowers to 50FPS. I'm trying to find out what causes it. I came across this profiler and implemented it and here are the values in a very "messy" frame with lots of objects going around and messing around:

06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Calls: 498
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Draw Calls: 37
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Shader Switches: 8
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Bindings: 36
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Vertex Count: 31.945946

My question is how am I supposed to know if these are considered to be high values or low? I read the LibGDX documentation but it doesn't give any direction or indication about the values effect. Yes, it might be an opinion-based question, but at least someone can give relevant direction using these values?

Thanks in advance

sentences:
LibGDX: Problems with Button Listener in a Dialog I'm developing a game where the player has an inventory, and you can find chests in the map with items which you can collect, so I created a class that extends from Dialog to show both item lists, player's inventory and chest's inventory, just like this:

private class InventoryDialog extends Dialog{
    public InventoryDialog(boolean isPlayerInventory, Inventory inventory) {
        super(isPlayerInventory? "Inventory":"Chest", mySkin);

        final List inventoryList = new List(mySkin);
        inventoryList.setItems(inventory.getItems());
        ScrollPane pane = new ScrollPane(inventoryList,mySkin);
        getContentTable().add(pane).size(myDimensions);
        button("Back");

        if(isPlayerInventory){
            button("Use").addListener(new ClickListener(){
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    super.clicked(event, x, y);
                    player.getInventory().useItemAt(inventoryList.getSelectedIndex());

                }});
        }else{
            button("Get").addListener(new ClickListener(){
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    super.clicked(event, x, y);
                    player.getInventory().add(inventory.remove(inventoryList.getSelectedIndex()));
                }});}

    }

}

So they will use or get the item only if they click that button.

My problem is that the get/use listener is always invoked even if the clicked button is the "Back" button, what am I doing wrong? :/

sentences:
States, actions logic am I doing it right? Currently I have the follow states:

Need To Run
Run
Need To Walk
Walk
Need To Fight
Fight

Am I misunderstanding it and mixig possible actions with states ?

I mean, to me Need To Run would either return true of false telling wether I should procced to the Run action or not and same goes for the other needs.

While I am fighitng should I have second FSM to threat what skills it should be using for example if it needs to heal or not ?

For instance inside the fight I would have the another FSM for

Need To Heal
Heal
Back To Fight
Use Skill

sentences:
view if GL_CULL_FACE is enabled/disabled Im using GL_CULL_FACE, an i'm trying to map a key for enable/disable the gl_cull_face. Is there any posibility of viewing if it's enabled or not?
Thanks

sentences:
is GameObject.Find() a bad idea even for one frame? as I searched GameObject.Find and GameObject.FindwithTag are heavy to work with and for reall projects its better to find repalcements.

for a NPC that get instantiated in game it first needs to find player character. for this issue I only can use GameObject.find() .

for a scene with lots of objects maybe its heavy for even one frame if there is lots of objects in the scene. is there any way to set the researching object in head of hierarchi and the NPC to only get that?

sentences:
Unity Nav mesh lading data each frame Hey all I had a question, I was looking into my game's performance and noticed this in the profiler:

Is there any way to optimize this such as pre-generating tiles so it doesn't have to do it each update :) ?

sentences:
transform touch/click coordinates(2D) into 3d coordinates I would like to convert touch/click input (2D coordinates) to 3D coordinates by dropping the Z axis (would like to move only up/down, left/right (Z is the axis for depth).

The problem is that the coordinates i get from input (2d) aren't corelated with the 3d actual space.

Does XNA provide a way to do this?

sentences:
Raycasting with a selection rectangle box I'm currently making a level editor for my game and want to implement a selection tool to make it easier to select multiple voxels at once.
My question is what the most efficient way is to get all the selected objects?
Do I just unproject the starting position and end position of the selection rectangle and create a bounding box that I then can use for intersection checking or is there a better way?

EDIT: Since I can't rotate a bounding box I need to find another way. I just need a way to find out if the bounding box of a voxel is inside the box that is formed by the four points of the selection.

sentences:
Is there a more useful "inverse" alternative to portal rendering than antiportal rendering? I'm in the process of sketching out the design of a 3D rendering engine as I'm learning my way around the subject. (Preemptively: yes, I have my reasons for rolling one from scratch, not least the educational value, so no, I'm not interested in just using prefab solution X.) As in the Elder Scrolls games, the engine fundamentally differentiates between "indoor" and "outdoor" areas, since in "indoor" (primarily enclosed) areas it uses a portal-and-cell approach to simplify visibility determination. I've  been trying to work out a good solution for simplifying visibility determination for "outdoor" (primarily open, freely roamable) areas, but I haven't run across anything I like nearly as much.

Primarily the issue is that, with portal rendering, you can not only skip on rendering anything behind an occluded portal, but you can actually discount it outright. If, for example, you store the cells as separate data structures and track which objects are within which cells, if a portal isn't visible, anything within the cell behind it can be completely removed from consideration without ever having to even check the objects themselves. (Aside from a few edge cases of objects that extend over the boundary of the portal into another cell, but that's not too hard to work around.) And that happens entirely without any pre-calculated visibility information, just by the nature of the rendering process. I like that quite a bit.

But I haven't found a technique that provides that kind of benefit for "outdoor" spaces, at least not without a lot of pre-baked analysis. The inverse of portal-and-cell rendering, "antiportal," seems like a not-bad approach in the broad strokes, since in the intended application "outdoor" areas will likely have fairly large areas of the screen occluded (by mountains, buildings, etc.) But as far as I can determine there's no way to use it for the kind of wholesale removal of objects/architecture at the data-structure level as you can pull with portal-and-cell rendering, since antiportal rendering requires you to actively check objects against an "occlusion volume" created from the antiportal and dependent on the camera position. Which, I guess, would work, but it seems like there should be a better way.

Maybe there isn't, and it's just the nature of the beast, but I thought I'd ask: is there a good method for removing objects from visibility determination in a primarily open environment before considering the individual shapes, without having to use more traditional pre-calculated BSP-type techniques?

sentences:
How to manage time in a two player game? I'm making my first online board game. After the two players accept to play with each other, I want to show a get ready message for 3 seconds, then both start playing together, each has 30 seconds to do an action in his turn.

But I don't know the process.

Should I pass to clients the time the game will start?
Should I check from server whether a player's 30 seconds is over? There may be
a slight difference in server and client time, and I end a game from
server while client still has 27 seconds for example.

What are the steps to have an accurate multiplayer game. Thanks.

sentences: Import Blender model into Unity with Textures I tried a very straightforward import of the Monk model from https://opengameart.org/content/monk into Unity 5.6.1f1, and ended up with no color/texture on the model. Why?

sentences:
Why do multiplayer games/chat services ever need to be able to open all NAT ports? I understand that games need to be able to open NAT ports in order to receive incoming connections.

What I do not understand is why there is an issue between "limited" and "open" NAT. The only reason I can see that a game would ever need to have the flexibility to open any port is if it is intending to accept incoming connections on ports that aren't specified in advance as part of the protocol. (If there was a restricted set specified in advance, forwarding these and no others should satisfy all of the game's demands for NAT forwarding, meaning that "open" would not need to be a thing.)

This seems to imply there's some port negotiation going on as part of the protocol (otherwise how does the connector know that this port, not specified in advance, is available?) but if a connection is already established to conduct the negotiation, why move to a different port? And even then, why can't negotiation be limited to a subrange of ports rather than the entire range?

sentences:
Collision handling for grid based games and simulations I'm trying to implement a grid based game where there are many creatures moving in the grid from square to square. I'm having a hard time handling collision with creatures in the grid (multiple creatures trying to move into the same square or cell). Where can I find information on how I should handle a game (or simulation) where multiple creatures in a grid want to move into the same cell but aren't allowed to? It's easy to handle 2 creatures, but handling n object collision is tough.

I'm looking for info on how to handle collision in a grid world. I don't expect a specific answer as much as resources or suggestions to find more info.

EDIT: To clarify, I'm looking for info on HOW TO HANDLE COLLISIONS BETWEEN MULTIPLE OBJECTS IN A GRID. In a grid world where multiple objects want to move into the same cell at the same time, how do I resolve this? Does one object get to move into the cell and the other objects remain stationary? Do I make each object push the other object out of its cell? These are the questions I want to answer.

An example of the problem I'm looking to answer:
Consider a grid where there's 3 creatures who move from tile to tile. What do I do when two creatures, A and B, try moving into the same tile? Let's consider if I allow creature A to move into the tile but creature B remains stationary. What happens if a different creature C wanted to move into the tile that creature B was stuck in? Then creature C also wouldn't be able to move.

This would cause an issue if I would evaluate creature C's movement first, telling it that he can move into the tile that creature B is in (because creature B plans to move out) but then creature B ends up never moving out.

How do I determine which creatures to evaluate first? Also, how do I avoid this huge chain of creatures being forced to remain stationary (in this example, only 1/3 creatures were able to move).

sentences:
glClearBuffer takes 1 second on a Geforce 9500GT These 2 lines (in C# using OpenTK) seem to cause 1 second lag every frame on a machine with a Geforce 9500 GT

GL.ClearBuffer(ClearBuffer.Color, 0, new float[] { 0, 0, 0, 0 }); // accum
GL.ClearBuffer(ClearBuffer.Color, 1, new float[] { 1, 0, 0, 0 }); // reveal (only red)

The framebuffer in question has 2 color attachments (Rgba16f and R16), and one depth attachement. The framebuffer status after setup indicates no problems.

This is also just one of 3 framebuffers that are cleared every frame - only this one turns the my game into a diashow. There is no such problem on any other card I've tested. Before clearing both color attachment are bound using

DrawBuffersEnum[] bufs = new DrawBuffersEnum[] { DrawBuffersEnum.ColorAttachment0, DrawBuffersEnum.ColorAttachment1 };
GL.DrawBuffers(2, bufs);

How could a very particular gfx card be so slow in clearing 2 color attachments? o.O

sentences:
Unity2D: Scaling and Locking Image to anchor points I have a script that uses Index to change an objects sprite using OnClick to move through the sprites, like a slideshow. I want the image to scale to the size of my anchor points, because I've notice that when I stretch the game or put the game on maximize play the image stays the same size and doesn't scale to the size of my anchor points. How would I do that?
This is my script:

public Sprite[] Images;
//Index starts at one because we are setting the first sprite in Start() method
public int _Index = 1;

void Start(){
    //Set the image to the first one
    this.gameObject.GetComponent<SpriteRenderer>().sprite = Images[0];
}

public void onClick(){
    //Reset back to 0 so it can loop again if the last sprite has been shown
    if (_Index >= Images.Length)
        _Index = 0;

    //Set the image to array at element index, then increment
    this.gameObject.GetComponent<SpriteRenderer>().sprite = Images[_Index++];
}

Thank you. :)

sentences:
How do display a "mucus spreading" effect in a 2D environment? Here is an example of such a mucus spreading. The substance is spread around the source (in this example, the source would be the main alien building).

The game is starcraft, the purple substance is called creep.

How this kind of substance spreading would be achieved in a top down 2D environment? Recalculating the substance progression and regenerate the effect on the fly each frame or rather use a large collection of tiles or something else?

sentences:
How to enter a level when touching an object I am working on a project in Unity 4.6.1f1 and I was wondering how can I make a cube touch another cube to go to the next level (the image below)?

!

EDIT: I made a script and put it on the purple cube then enabled "is trigger" on the purple cube, but the blue cube goes right through it.

Inspector:

And the code:

EDIT 5/15/15: I edited my script and I was wondering if I'm doing something wrong.

sentences: How do I change the material of an object with Script in Unity? I was making a game with Unity and I want to change an object's material using UnityScript when the player collects 5 collectables that I made. The collectables get stored in an int variable called Score.

sentences:
How can I spin a child capsule of a cube parent? I have a parent cube and to make it like a surface I had to change the rotation of the cube on the X to 90. and as a child, I added a capsule, and to make the capsule-like standing I had to change the capsule X also to 90. The result is :
The reason I put the capsule child of the cube is that I want the capsule to move with the cube.

The capsule rotation on the X is also 90 :

Then in a script at the top, I added speed and index variables for the rotation :
private int index = 0;
private int rotationIndex = 0;

In the Update :
RotateTo();

And the method : curvedLinePoints is a List
private void RotateTo()
    {
        var distance = Vector3.Distance(capsule.position, curvedLinePoints[rotationIndex].transform.position);
        if(distance < 0.1f)
        {
            rotationIndex++;
        }

        // Determine which direction to rotate towards
        Vector3 targetDirection = curvedLinePoints[rotationIndex].transform.position -capsule.position;

        // The step size is equal to speed times frame time.
        float singleStep = rotationSpeed * Time.deltaTime;

        // Rotate the forward vector towards the target direction by one step
        Vector3 newDirection = Vector3.RotateTowards(capsule.forward, targetDirection, singleStep, 0.0f);

        // Draw a ray pointing at our target in
        Debug.DrawRay(capsule.position, newDirection, Color.red);

        // Calculate a rotation a step closer to the target and applies rotation to this object
        capsule.rotation = Quaternion.LookRotation(newDirection);
    }

The problem is that because the capsule is a child when I rotate the capsule it looks like the capsule changes its shape and not spinning around itself. If I remove ut the capsule from the prefab and will rotate it on its own it will spin fine but when it's a child of the cube the result is :

I tried before running the game to play with the capsule rotation in the editor in the inspector changing the Y and Z values and the result is like in this screenshot. but I want to spin it around itself but because it's a child of the cube it's not spinning but looks like it's changing its shape.
The workaround I found is to create an empty GameObject at 0,0,0 and put both Platform and Capsule as a child of it.
Then I added this part to the script above :
private void LateUpdate()
    {
        capsule.localPosition = transform.localPosition + new Vector3(0, 1.4f, 0);
    }

This way the Capsule is following the Platform. The empty GameObject is just to put them both together.
and for testing I just did in the Update :
capsule.Rotate(0, 10, 0);

and it's working fine. Now I have to figure out how to make this rotation with the code in the RotateTo method.

sentences:
Space Invaders-type game: Keeping the enemies aligned with each other as they turn around? OK, so here's the lowdown of the problem I'm trying to solve.

I'm developing a game in PyGame that's a cross between Space Invaders and Columns.  I'm trying to make the motion of the enemies similar to that of the aliens in Space Invaders; that is, they're all clustered in a grid, and if even one hits the side of the screen, the entire formation moves down and turns around.  However, the motion of these aliens is continuous (as continuous as a monitor can be, anyway), not on a discrete grid like in the original.

The enemies are instances of an Enemy class, and in turn they're held by a 2D array in a enemysquadron module (which, if you don't use Python, is in this case essentially a singleton due to the way Python modules work).

Inside the Enemy class I have a class-scope velocity vector that is reversed every time an Enemy object touches the edge of the screen.  This won't do, though, because as time goes on the enemies just become disorganized and jumbled (i.e. not in a grid as planned).  I haven't implemented the Enemies going downward yet, so let's not worry about that right now.

Any tips?

sentences:
Setting time for a particular action to be happened-LibGdx In my LibGdx game,enemies are coming in to the screen one by one.

I want to make enemeies appear at a particular time after the game starts.

How can I do it efficiently?

sentences:
Attributes for calculating a hit in a turn based game or Roguelikes I'm trying to figure out a good formula for determining a hit when the player attacks an enemy in a Roguelike. I'd like to come up with something simplistic but, still true to the way it's done in D&D or popular Roguelikes like AngBand or NetHack.

What I have so far is adding the differences between player and enemy attributes, along with a random integer:

if ((player.dex - enemy.dex) + (player.speed - enemy.speed) +
    (player.luck - enemy.luck) + random_integer_below_6()) >= 10) {
    hit(enemy);
}

This makes for unnatural gameplay: the player never misses weak enemies and vice versa for strong ones. Does anyone know of a guide to attribute based combat used in turn based games etc? Should I (and can I) copy the D&D rules verbatim?

sentences:
Raise/Lower Object Height Based on Distance, with Easing I'm trying to make an indicator object appear higher up in the sky the farther away a player is, up to a certain distance.

Basically, if the player is < 5 distance away, the object's height should be 1.
If the player is > 60 distance away, the object's height should be 50.
If the player's distance is between 5 and 60, the height of the object should be calculated based on the given scale, with an easing function applied so that it moves gradually to it's top and bottom locations.

This can be best illustrated with the attached graph that I created. The graph may not be perfect, but it should be close enough to get the general idea of what I'm hoping to achieve.

That said, I'd assume you'd need at least 5 variables... groundHeight, maxHeight, minHeight, maxDistance, and minDistance, but how would I use this information to calculate the expected height for a given distance?

This isn't related to a specific game engine and language isn't important. I happen to be working with Lua on my current project, but JavaScript, C#, or even pseudo-code solutions would help me understand how this is achieved.

sentences:
RPG combat and gold/exp reward equations I have a game that I'm creating, but I'm running across issues in keeping the ratios between high and low level players similar in the battle and reward equations. Obviously a higher level player should receive less experience, but have the upper-hand in battle when fighting lower level players and monsters. Here is how I'm calculating things currently:

Battle starts If player.dex > enemy.dex Accuracy = ((player.dex - enemy.dex)/2)*20

If player.dex < enemy.dex Accuracy = ((enemy.dex*player.dex)-enemy.dex)/player.dex

Accuracy is a percentage tested against a roll of a 100 sided die.

If accuracy > roll Hit success

If accuracy < roll Hit fails

If hit success All of the attacker's damaging items (spiked helms and shields, weapons, etc.) are added together and applied as such: Damage = (player.str + item.damage)-(enemy.dex + enemy.armor)

If the player is fighting a monster, I have a base amount of gold and experience which is modified according to the player: Gold gained = (enemy.gold*rand(1,10))/player.level Exp gained = (enemy.exp*rand(1,3))/player.level

If the player is fighting another player, then there will have to be a different equation for the rewards, but I'm not sure how to go about creating that one.

As this is my first attempt at creating (though I'm an avid RPGer), I'm not sure if there is kind of an "industry standard" form of calculating these things or not. I'm also afraid that these equations won't hold up once the player reaches higher levels (say level 50+).

sentences:
UDK - Packaging the Game I have set up all the config files to my game classes and am able to launch the game to test everything.

Although when I package the game, it still runs the UT deathmatch game??

What other lines in the config files should be changed to make it default to my game and default map once published?

sentences:
Get all the gameobjects for a SceneManager scene in Unity I'm using the new SceneManager to load multiple scenes in the same structure adopting the Additive method. I find it extremely useful but I wonder if there is a way to get all the GameObjects for a specific scene. When multiple scenes are loaded I see the GameObjects clearly separated by scene in the hierarchy but I cannot find a way to access the specific hierarchy of a single scene via script. Is that possible?
The findGameObject method I think returns the GameObjects for all the scenes..

sentences:
convert image to spritesheet of tiles for isometric map? is there a way to convert an isometric image (like the first image) to a spritesheet (like the second image), in order to place each image on the isometric map with the code?

The map looks like the first image, but some buildings are bigger than just one tile, so I need several squares (let's say the first image is a building, made of multiple tiles with different colors), and each square is placed with an offset of 64x32. The building is created in Blender and I save the image with the isometric perspective. But I have to split each square from this image in order to have the spritesheet, maybe there is smarter way, or a java software that would make the conversion for me?

sentences:
Developing AI for Zatacka I am trying to develop a stronger AI for the popular game, Zatacka.
The basic aim of the game is to survive the longest. It's like the TRON game, but the characters can only turn smoothly, instead of 90 degree turns.

I am new to game AI. I have the following ideas in mind, but I don't know how they can be implemented.

Collision prediction. If another player is about to come into the same area, then the player should turn around and try to evade.
Hole taking capability. How to detect holes. How to distinguish holes from a normal empty area.
Early detection of a dead end and being able to turn around before its too late. The problem with this how do we determine a dead end, it could be a bit far than our current position. Doing a path finding algorithm and searching for the wall or a player's body might not be efficient enough as this has to be done for each steps.

Are there any standard algorithms for these problems? Can somebody throw some light on how I can approach these problems?

sentences:
Unity: Dimensions of color surface does not match dimensions of depth surface I am receiving the error, "Dimensions of color surface does not match dimensions of depth surface" whenever I attempt to use my screenshot code, without any callstack or anything further insight of what I am doing wrong.

I have a separate camera from my main camera, whose purpose is to take screenshots at different angles.  Hierarchy as such:

The main camera captures the 3D scene just like a normal main camera would, including post-processing components.  No HDR or MSAA.

The GUI camera captures just the UI layer.  Nothing enabled except MSAA.
The canvas and image are simply a watermark, rendered by the GUI camera.

I point both the main camera and GUI camera to the same target render texture.  When ready to take a screenshot, I enable the camera components, thus Unity takes over and tells them to render the frame.  In the OnRenderImage callback, I disable the camera so it can be used again, I remove the render texture I previously assigned, extract the pixels, and save it as a PNG.

In a separate test, this all seems to work as intended.  No error messages.  However, when playing the full game, suddenly I receive the dimensions errors upon each screenshot.

I have read that RenderTexture.IsCreated will test if the render texture is still available.  Supposed, it will be set to false due to a large variety of events, such as window changes.  I have made it impossible to even get the reference to the render texture without it checking if the IsCreated bool is true.  I have also tested if the render texture matches its Descriptor property, out of paranoia.  All of these checks succeed.

I don't know what to look at next.

What is SUPER strange is I have a GIF generator, using quite similar code, that's much more complicated, and it does not suffer from this problem.

Has anyone dealt with this error before?  Any hints at all?

sentences:
How would I go about coloring marching cubes terrain? I'm making a game with marching cubes terrain (I know very original idea) and I don't exactly know how to color it. I have a system to do it, I just need to know how to interpolate it where it's not all smoothed out.
I just want flat colors, I think it boils down to this function (this is this guys code http://www.paulbourke.net/geometry/polygonise/):
glm::vec3 VertexInterp(const float& isolevel,const glm::vec3& p1,const glm::vec3& p2, const float& valp1, const float& valp2) {
    float mu;
    glm::vec3 p;

    if (ABS(isolevel-valp1) < 0.00001)
        return(p1);
    if (ABS(isolevel-valp2) < 0.00001)
        return(p2);
    if (ABS(valp1-valp2) < 0.00001)
        return(p1);
    mu = (isolevel - valp1) / (valp2 - valp1);
    p.x = p1.x + mu * (p2.x - p1.x);
    p.y = p1.y + mu * (p2.y - p1.y);
    p.z = p1.z + mu * (p2.z - p1.z);

    return p;
}

So if anyone could help me implement a flatter or smoother variant of that function it would be very much appreciated
(I know all the rest of the things I need to do I just need help with this)

sentences:
Why do I have to switch T(v) texture coordinates while importing OpenGL to Direct3D? I am importing my code from OpenGL to Direct3D. My D3DTS_PROJECTION uses D3DXMatrixPerspectiveFovRH, and my D3DTS_VIEW uses D3DXMatrixLookAtRH to set a view equal to OpenGL's view. My question is why do I have to switch all of my 1.0000 Tex(v) texture coordinates to "minus value" in D3D to get equal texture mapping as in OpenGL.

OpenGL:

//T(u)   T(v)
1.0000,  1.0000,
0.0000,  1.0000,
1.0000,  0.0000,
1.0000,  0.0000,
0.0000,  1.0000,
0.0000,  0.0000,

0.0000,  1.0000,
0.0000,  0.0000,
1.0000,  1.0000,
1.0000,  1.0000,
0.0000,  0.0000,
1.0000,  0.0000,
// ...

Direct3D:

//           T(u)     T(v)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)

D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
// ...

Is it because Direct3D's origin (0.0) of texture coordinates lies in different place than in OpenGL?

sentences:
OnTrigger not firing consistently I have a Prefab called Player which has a Body and a Sword.
The game uses 2 instances of Player, Player1 and Player2.

I use Player1 to strike Player2. This is code on the sword. My hope is that Sword of Player1 will log on contct with Body of Player2. It happens but only the first hit and then i have to hit several times before another strike is logged. But when i look at log from OnTriggerStay it looks like the TriggerExit is never detected untill long after the sword is gone.

    void OnTriggerEnter(Collider other)
{
    //Play sound to confirm collision
var sm = ObjectDirectory.soundManager;
    sm.PlaySoundClip(sm.gui_02);

    Debug.Log(other.name + " - ENTER" );

}

void OnTriggerStay(Collider other)
{
    Debug.Log(other.name + " - collision" );
}

void OnTriggerExit(Collider other)
{
    Debug.Log(other.name + " - HAS LEFT" );
}

DEBUG LOG:

  Player2 - ENTER
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerEnter(Collider) (at Assets/Scripts/SwordControl.cs:28)

  Player2 - collision
  UnityEngine.Debug:Log(Object)
  SwordControl:OnTriggerStay(Collider) (at Assets/Scripts/SwordControl.cs:34)

  (The last debug log then repeated hundreds of times long after the sword of player 1 had withdrawn and was in no contact with player 2  )

EDIT:
Further tests shows that if i move player1 backwards away form player2 i trigger the OnTriggerExit. Even if the sword is not touching Player2 since after the blow. However even after OnTriggerExit it takes many tries untill i can get another blow registered.

sentences:
Calculating required force for pushing a body to a desired position at once in Unity In a 3D world I simulate that a coin is being pushed over a plane (applying a force in his rigidbody where y-axis = 0) using a top-down view.

Some time ago but using Box2D, I was able to calculate the amount of force required to stop the coin in a desired position with just one push.

Box2d-js

var fps=60;
var groundFriction = 0.01;
var force= new Box2D.Common.Math.b2Vec2(distance.x * coin.box2dBody.GetMass() * fps * (groundFriction * fps),
      distance.y * coin.box2dBody.GetMass()* fps *(groundFriction * fps));
coin.box2dBody.ApplyForce( force, coin.box2dBody.GetWorldCenter(), true );

In order to simulate the friction, during the update, I substracted the groundFriction(0.01) to the linearvelocity of the objects in movement in every frame.

Now using Unity with a more complex physics engine I cant replicate the same.

Unity3d

Vector3 posFinal = transform.position + direction * distFinal;
Vector3 distanceVecFinal = posFinal - transform.position;
float fps= 1/Time.fixedDeltaTime //50 fps
Vector3 force = new Vector3(distanceVecFinal.x  * myBody.mass * fps, 0,
     distanceVecFinal.z  *    myBody.mass * fps);
myBody.AddForce(force);

I think that in the final formula I should add the friction of the objects, but I am not sure how to do it. Maybe this is not the only thing that I should change.

I need help pls!

tl&dr Calculate the required force for making move an object to a desired position in a plane with just one push.

sentences:
URP PostProcessing doesn't work? I'm trying to get postprocessing work again after updated to URP. But it does not work !!

Could anyone help me with any solution or clue ?

sentences:
How to remember a non-consumable Unity IAP the right way I have implemented Unity 5's IAP system through Google Play. I read a few guides that mention not to store completed purchases in PlayerPrefs because it is clear text and easy to hack, but none mention the correct way to "remember" purchases. For example, when re-installing an Anroid app, purchases are restored the first time the app runs by individual calls to this method defined in the Unity IAP API.

public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs e)
    {
        //my Playerpref save that I want to avoid is here.
        return PurchaseProcessingResult.Complete;
    }

On subsuqent app runs, this method is not called again. Is there a way to query past purchases other than saving them in PlayerPrefs?

sentences:
Problem using glm::lookat I am trying to rotate a sprite so it is always facing a 3D camera.

Object

GLfloat vertexData[] = {
    //  X     Y     Z       U     V
    0.0f, 0.8f, 0.0f,   0.5f, 1.0f,
    -0.8f,-0.8f, 0.0f,   0.0f, 0.0f,
     0.8f,-0.8f, 0.0f,   1.0f, 0.0f,
};

Per frame transform

glm::mat4 newTransform = glm::lookAt(glm::vec3(0), gCamera.position(), gCamera.up());
shaders->setUniform("camera", gCamera.matrix());
shaders->setUniform("model", newTransform);

In the vertex shader:

gl_Position = camera * model * vec4(vert, 1);

The object will track the camera if I move the camera up or down, but if I move the camera left/right (spin the camera around the object's y axis), it will rotate in the other direction so I end up seeing its front twice and its back twice as I rotate around it 360.

If I use -gCamera.up() instead, it would track the camera side to side, but spin the opposite direction when I move the camera up/down.

What am I doing wrong?

sentences:
Creating Transparent Game Menu Items using AndEngine I'm trying to create a Game Menu which contains some Menu Items like

New Game
Multiplayer
Options
Exit

I want to make this Menu Items Transparent. Only Text in White color should be visible.
So i guess i do not need any background image for Menu Items.

I have seen examples of SpriteButton like given below.

ButtonSprite playButton = new ButtonSprite(0, 0, btnNormalTextureRegion, btnPushedTextureRegion, this.getVertexBufferObjectManager(), new OnClickListener() {
    @Override
    public boolean onAreaTouched(TouchEvent pSceneTouchEvent, float pTouchAreaLocalX, float pTouchAreaLocalY) {
        // Do Stuff here
     }
}

The thing which i don't understand is how can i initialize btnNormalTextureRegion?
I use the code give below to initialize ITexture and ITextureRegion for objects.

mBackgruondTexture = new BitmapTexture(activity.getTextureManager(), new IInputStreamOpener() {
                public InputStream open() throws IOException {
                    return activity.getAssets().open("gfx/backgrounds/greenbg.jpg");
                }
            });
mBackgruondTextureRegion = TextureRegionFactory.extractFromTexture(mBackgruondTexture);

This code openes up an Image from assest.
As i do not want to use any image for Menu Item How can i initialize btnNormalTextureRegion for SpriteButton.

OR

Is there any alternative to create Game Menu?

sentences:
MD5Mesh Calculate Vertex Normals I am writing an MD5 3D model loader to display animated models. The vertices and texcoords load in correctly, but the lighting is supposed to be smooth. I calculate per-vertex normals by looping through all triangles, finding the triangle normal, and then adding that to each of the triangle's vertices' normal (follow?). Then, I normalize all the normals. This should work, but md5 declares each vertex with a texcoord, meaning that if I have a single vertex that has different texcoords for each of the faces it's attached to, it declares multiple vertices at the same position. Each of these will end up with its own normal, resulting in flat shading. Should I somehow merge duplicate vertices, or export the model differently, or do something fancy that I haven't thought of?

Thanks!

sentences:
Is it possible to reverse perspective projection with simple scale and translate? Basically I'm asking this question (which seems to have gone un-answered): How to do perspective projection “parallax” but without changing the scale or offset of objects?

I'm using perspective projection and would like to scale up certain objects in the background (z < 0) such that they would render unscaled and in the same relative position. In other words, I want to reverse the perspective foreshortening for bg objects.

I've figured out how to unscale accurately: basically I project the top left and bottom right corners of the image to z = 0, then do the same at the current z value. I then compare the change in distance between the points in order to derive the scale factor.

The problem I have though is once I unscale the object, its position is incorrect. I've tried scaling around different anchor points, with no luck. I can't seem to derive a generic formula to position the images in the correct places after scaling.

Any ideas how to do this? Is this even mathematically possible?

sentences:
Godot and getting files via HTTP So, I am wanting to use Godot to get a (binary) file using HTTP and then either save it or, even better, turn it into a Resource in memory that I can use.  It'll be WAV files that I'm getting in return (trying to implement MaryTTS, which is running as a server on localhost).  I had a look at the docs for HTTPRequest, but can't seem to get a working solution.

I do $HTTPRequest.request("http://...") when a keypress is made, and I have the _on_HTTPRequest_request_completed() function, but this never seems to be called.  I tried with the function in the same Node as the request (as per the docs' example), and I also tried putting it as part of a script for the HTTPRequest Node.  If I hit the triggering key fast enough, it gives an error ("HTTPRequest is processing a request"), but if I do it slower, it doesn't give that error, so it appears it is finishing.  It just doesn't do anything when it finishes.  HTTPRequest gives a return value of 0, which I assume means no error?  (Or should this give me HTTP status codes?)

Any idea what I'm doing wrong?  Can HTTPRequest handle binary files?  How do I get this working?

(Any suggestions on a better way to implement MaryTTS are also welcome).

sentences:
Blending transition in cocos2d In my cocos2d-iphone game, I have 2 backgrounds (CCnodes), each containing a quite complex hierarchy of sprites.

I would like to make a smooth transition between them:

Initially, only the first background is visible
At the end, only the second one is visible

Is there a good way to set the opacity of a full hierarchy of sprites ?

I tried to recursively set the opacity of all the contained sprites. It kinda works except that:

I guess it's not very efficient
I would like the opacity of overlapping sprites to be 'merged' (as if the background was one single big sprite)

sentences:
Game "Hocus": How to do the path finding? I rebuild popular apps to get good at Godot. This game Hocus poses a challenge in terms of path finding. I have a solution, but as the illusions scale, it becomes ridiculously time-consuming to set up. I set destination, to which the cube can go, but then you have to set up possible connections for every destination, because there're supposed to be constraints. This can lead to something like 100 variations to be set up for one level, which is of course ridiculous if you want to do 100 levels like the creators. Any idea?

This is a video, where you can exactly see the pathfinding mechanism. Short description:
Whenever you're at one corner of the bars of the illusion graphic (it's just a 2D graphic), you have to set up ways, where the player can go next, because some ways are invalid in this illusion, logically. This is what I intended with setting up an array of numbers, which represent the possible next points for each point. However, this is extremely time-consuming if levels reach even slightly more complexity. I highly doubt the creators did it that way.

sentences:
How can I find the valid words in a grid of characters? I am creating a game similar to Tetris, with two main differences: the screen already begins filled with tiles (like in Puzzle Quest for Nintendo DS and PC) and each individual tile has a letter in it. The player's objective is to eliminate tiles by forming valid words with them. Words are formed by placing letters next to each other, in any direction, except diagonally.

The player can move an entire row of tiles to the left or to the right or an entire column of tiles up or down, for as many spaces as he desires (if the movement of a row/column surpasses the limits of the board, the letter that crosses the limit will "cycle", appearing at the other end of the row/column). After the player's action, the game should check the entire board to look for valid words and remove the letters that form those words from the board. The letters above those that were removed will fall down in the place of those letters that were removed and new letters will drop from the top of the screen until the board is filled up again.

I have already written a linear algorithm that, given a sequence of characters, determines if it is a valid english word. The problem I am having is: how can I check for valid words on the board? Is brute force the only way? Testing all possible combinations from the board to see if they are valid is very slow, even for a small (5x5) board. Any help will be very appreciated, thanks!

sentences:
Testing HTML5 canvas games on low resource computers I've made a game in HTML5 & JS and want to test it on varying types of user setups as I've heard it doesn't perform too well on older MacBooks.

How can I accomplish this? I'm thinking of something like browserstack.com but for GPU, CPU and memory testing.

sentences:
Stop 2D platformer character from sliding down slope I'm making a 2D platformer game with the default Unity 2D physics. I am implementing slopes, but my player slips down the slope because of the physics.

Here is the code I use for the player movement:
MoveInput = Input.GetAxisRaw("Horizontal");
rbd2.velocity = new Vector2(MoveInput * speed, rbd2.velocity.y);
//rotacion de personaje
if (MoveInput > 0)
{
    transform.localScale = new Vector3(1f, transform.localScale.y, transform.localScale.z);

}
if (MoveInput < 0)
{
    transform.localScale = new Vector3(-1f, transform.localScale.y, transform.localScale.z);

}

sentences:
Setting object position in screen space - camera I'm trying to set an Image gameobject's transform.position. My canvas is "screen space - camera" because I needed to use a line renderer.

However, when I set the position, say to new Vector3(-320, -240); the object (in play mode) gets positioned at -16266.44, y: -15360, way off-screen.

I've tried to reset the localPosition and such based on some other answers but it doesn't help. What else could be translating my pixel coords?

var go = Instantiate(HexTilePrefab, this.transform);
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;
go.transform.localScale = Vector3.one;
go.transform.position = new Vector3(screenX, screenY);

sentences:
How can I use an unsigned int as a GLSL attribute for OpenGL ES 2 I'm having trouble finding conclusive information on this, but it seems like I can't pass integer attributes to GLSL for OpenGL ES or that if I do they'll be converted to float. I need a value between the range [0-65535] for each vertex. If I pass it as a float and then convert it back, I'm concerned that the value will have changed (if the precision is low enough and can't suitably represent values at the higher magnitudes).

Its also confusing trying to figure out what precision for floats the OpenGL ES 2 standard requires. It seems like the minimum requirement is 16-bit (ie some implementations will use 16-bit floats for highp variables). In this case, it would seem like the floating point number wouldn't be able to store enough information for 0-65535 since that's what a 16-bit unsigned int holds.

So, formally, how can I specify a vertex attribute that will let me precisely represent the values 0-65535 in OpenGL ES 2.

sentences:
I followed a youtube timelapse video to make same 3d model in blender, Can I use this in my game? I saw a youtube timelapse video about making a car 3d model, I liked it and followed the same, I design almost same looking model (90% same), Can I use this in my game?

There is no license mentioned on video, the creator of video has just written 'Just for fun' in description of youtube video.

Update:
As per my understanding if we download or copy/paste a copyrights protected asset, we will need permission of its author, but I am neither downloading nor copy pasting anything, I am simply just seeing a video and making something similar asset, so do I really need a permission of the video creator and however he hasn't mentioned any license term also in the video.

sentences:
Qt 5 - QOpenGLWidget not updating the screen I'm creating a level editor for my game using Qt for gui and i'm in really early stages. Right now i'm trying to dynamically add objects ( entities ) on screen when i click a button. So far the objects are pushed into a stack but i can't see them on screen.

When my widget inherits QGLWidget the screen is updated immediately and i can see the objects being drawn but since QGLWidget is deprecated i use QOpenGLWidget.

Strangely this class does not auto update the screen. I have also connected update() to a timer and set the interval to 0 to update the screen in real time.

connect(&timer, SIGNAL(timeout()), this, SLOT(update()));
timer.setInterval(0);
timer.start();

Am i missing something ?

sentences:
How can I restart an animation? The first time the player clicks a button, my animation plays properly.

The problem is that when the player presses the button a second time, the animation does not play.

Here is the code I'm using to control my animation:

public Animator anim;

public Animator animsfirst;
public Animator animssecond;
public Animator animsthird;

public Animator reanimsfirst;
public Animator reanimssecond;
public Animator reanimsthird;
public Animator closeinstruct;

public void instructionpanel()      //(instruction panel open animation)
{
    anim.enabled = true;         //when button click instruction panel open
    animsfirst.enabled = true;
    animssecond.enabled = true;
    animsthird.enabled = true;
}

public void closeinstructionpanel()  //(instruction panel close animation)
{
    Debug.Log("animationrun");   //when button click instruction panel close
    reanimsfirst.Play("freverse");
    reanimssecond.Play("srevese");
    reanimsthird.Play("lreverse");
    closeinstruct.Play("clreverse");
}

Here is the animator controller setup for the animsfirst object:

And for the reanimsfirst object:

How can I resolve this issue?

sentences:
Flow/design of steering behaviors implementation I am implementing some simple steering behaviors like: follow the leader, separation, cohesion and flee(from the leader when he walks in our direction - aka spread the group for him).

I am having issues with design of this system. I know how each of this behavior works separately but I simply can't do it with "if ladder" (as I did up to know). Can someone lead me on how to concatenate/normalize/multiply the forces and how to join them in one resultant force ?

EDIT

What I am exactly talking about is: for now I have something like so :

if(leaderGoingAtMe)
    makeSpaceForhisMovement()
else if(followTheLeader)
    goto(positionBehindLeader)

if(separation)
    addSeparationForce()
if(cohesion)
    addCohesionForce()

if(velocity > maxSpeed)
    clamp(velocity, maxSpeed)

Which is EXTREMELY bad in my opinion but I have no idea how to improve it.

sentences:
LibGDX Android Textures reload other textures, and transparent images get black backgrounds [Pictures] I have very strange problems with my LibGDX Game in Android - The problem is that sometimes the textures get black backgrounds when they should be transparent, and sometimes when I remove the texture, or press the back button, the textures get replaced with other textures that I have.

To clarify:
I'm using x texture to show the status of health. I'm using three x textures to show how many lives the player got, and when I lose health, and remove one texture, the x texture get replaced with y or z texture, or the remaining x textures get black backgrounds. Sometimes it works flawlessly, and the x texture gets removed, and the backgrounds are still transparent.

I'm loading my textures via an AssetManager, and just load them on create().

In my render I use this:

    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    batch.enableBlending();

                  batch.begin();
                   for (Entity life : LifeEntities) {

                        life.render(batch);
                    }
                  batch.end();

I'm also using this in my Launcher Class.

 AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
 cfg.r = cfg.g = cfg.b = cfg.a = 8;

 MainGame myGame = new MainGame(arrayName);
 initialize(myGame, cfg);

I do dispose the textures also. I have looked up on google and on gamedev about this problem, but all the questions are for problems when the transparent always have black background, not when it is something that happens like a bug.

Any suggestions on where the problem could be? Thanks a lot, if you need more code, please let me know.

Pictures of the problem:

sentences:
What tools should I consider if my aim is to make a game available to as many platforms as possible? We're planning on developing a 2D, grid-based puzzle game, and although it's still very early in the planning stages, we'd like to make our decisions well from the beginning.

Our strategy will be to make the game available to as many platforms as possible, for example PCs (Windows, Mac and/or Linux), mobile phones (iPhone and/or Android based phones), game consoles (XBLA and/or PSN)
PC will have an emphasis, but I believe that's the most flexible platform so that shouldn't be a problem.

So, what programming language, game engine, frameworks and all around tools would be best suited for our goal?

P.S.: I'm betting a set of tools won't cover ALL of them, and that there will still be some kind of "translating" effort for some platforms, but we'd like to know what the most far reaching are.

sentences:
Why are we not using integers in game physics? We can use integer for game physics (or without physics, simply object representation): mass, position and rotation, where the integers represent, for example, the number of milligrams, millimeters or (1/56000) of a degree. However, almost all game code I've seen recently use floating points.

Is it slower to use integers for game physics calculations? Are there any other advantages and disadvantages from the developer's point of view for using integers? Or it is because all our hardwares

sentences:
UDP + digital signature vs TCP vs other solutions to guarantee message authenticity TCP guarantees message authenticity rather reliably using packet sequence number.
Other option would be going with UDP and using digital signatures to make the message authentic.
What could be my other options (basically are there any I missed)?
Maybe there is some sort of framework which I could use which would allow me to plug into a game engine without writing all authentication logic(each time using tcp i would need that clients login into my system, with udp i would rely on client public signatures inside my db).

TY

sentences:
Why does transforming a Vector3 by a Quaternion result in reversed Z? I'm trying to transform the vector (1, 0, 0) by an orientation unit quaternion, which in XNA should be:

Vector3 v = Vector3.Transform(Vector3.Right, Orientation);

But this results in the Z value reversed from its expected value—for example, transforming Vector3.Right by Orientation (0.6532815, -0.270598, 0.270598, 0.6532815) results in the vector (0, 0.7071, -0.7071) when it should result in the vector (0, 0.7071, 0.7071).

I found another implementation here:

Quaternion o = Orientation;
Vector3 oV = new Vector3(o.X, o.Y, o.Z);
Vector3 v = 2 * Vector3.Cross(oV, Vector3.Right);
v = Vector3.Right + o.W * v + Vector3.Cross(oV, v);

But that results in the same problem. Reversing the Z value is trivial, but I'm worried that if I don't find a solution to this now the problem will manifest some other way down the road. Especially since, up until now, I thought I was playing by XNA's rules in my game engine (same coordinate system, same handedness).

For reference, this code I wrote does produce the expected result in my engine:

Vector3 v;
Quaternion o = OrientationGlobal;
double y = Math.Atan2(2 * (o.W * o.Z + o.X * o.Y), 1 - 2 * (o.Z * o.Z + o.Y * o.Y)); // yaw about global Z axis
v.Z = MathHelper.Clamp(2 * (o.W * o.Y - o.Z * o.X), -1, 1);
double m = Math.Sqrt(1 - v.Z * v.Z);
v.X = (float)(m * Math.Cos(y));
v.Y = (float)(m * Math.Sin(y));

What am I missing?

sentences:
How do I store multiple bullets' coordinates? My game is a 2D game(or tries to be) in pure C using SDL(no OpenGL at all). No specific goal in it, it's pretty much boilerplate code.

I decided I want to make my character/player shoot "something", whether you'd call it a bullet or not is up to you.
But even before writing any code, I already saw my first hurdle. You see, in reality when you shoot a bullet it's pretty fast, you'd normally hit a target by the time you shoot again, in my game I want the bullets to be slow so that two or three or more can be displayed on the screen. This is where the problem starts. I have written some pseudo-code to illustrate my problem.

Basically, when I shoot a bullet, I increment a total bullet counter, then the sprite would appear and every few MS I would update the animation and check for collision. When I have multiple bullets which I store in a structure array, I would loop through all of them to check their collision, or if they went out of the screen's view. When one fits either condition, I will remove it from the screen and (free it) from the structure array and that index will point to invalid memory. Basically, my pseudo-code tries to illustrate the problem.

http://pastebin.com/9Y40GgT4

This is my interpretation of how it should be done. I am assuming there are other ways. Hopefully we can avoid the "Why C and not C++ discussion at this time".

sentences:
does glBindAttribLocation silently ignore names not found in a shader? Does glBindAttribLocation silently ignore names that are not found? For example, in a shader:

// Some vertex shader
in vec3 position;
in vec3 normal;
// ...

And in some set up code:

// While setting up shader
GLuint program = glCreateProgram();
glBindAttribLocation(program, 0, "position");
glBindAttribLocation(program, 1, "normal");
glBindAttribLocation(program, 2, "color"); // What about this one?
glLinkProgram(program);

sentences:
Shader issues when creating projection using CreateOrthographicOffCenter instead of CreateOrthographic Pre. Having these matrix transformations:

var scale = Matrix.CreateScale(50f);
var eye = new Vector3(0, 0, 10.0f);
var view = Matrix.CreateLookAt(eye, Vector3.Zero, Vector3.Up);
var projection = scale * Matrix.CreateOrthographic(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 1.0f, 1000f);
var rotation = Matrix.CreateRotationX(-MathHelper.PiOver2)*Matrix.CreateRotationY(MathHelper.PiOver2);

and then for each mesh producing “world” like this:

var localWorld = transforms[mesh.ParentBone.Index] * rotation;

and then applying these parameters to the effect:

effect.Parameters["World"].SetValue(localWorld);
effect.Parameters["View"].SetValue(view);
effect.Parameters["Projection"].SetValue(projection);
effect.Parameters["Bones"].SetValue(boneTransforms);
effect.Parameters["WorldInverseTranspose"].SetValue(Matrix.Transpose(Matrix.Invert(localWorld)));

I’m getting nice model like this:

Post. But after I changed CreateOrthographic to CreateOrthographicOffCenter like this:

var projection = scale * Matrix.CreateOrthographicOffCenter(-GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Height / 2f, -GraphicsDevice.Viewport.Height / 2f, 1.0f, 1000f);
var rotation = Matrix.CreateRotationX(MathHelper.PiOver2) * Matrix.CreateRotationY(-MathHelper.PiOver2);

I’ve got this:

Can someone give me a hint what am I doing wrong?

sentences:
How do I create an in-app update for a mobile game? I'm researching how to make an in app update on mobile game.

When there is a hotfix, or an update, I don't want users to have to go to Play store, or App Store to update, but rather for them to update inside the game (like in Clash of Clans). I want to do this because Apple takes too much time for reviewing.

I found https://ionic.io, they use Cordova to embebed HTML inside. We can do live update, rollback to old version with a click. This is pretty suitable for normal app, but for game, the performance is not great.

How can I create an in-app update like this?

sentences:
Unity rigidbody velocity In Unity, what is the correct way to move a game object by modifying the velocity of its rigidbody?
I'm having some issues with stuttering movement, so I just want to make sure I understand the basic idea. Is the following correct for moving an object vertically down the screen? Should this result in smooth, stutter-free movement?
using UnityEngine;

public class MovementTest : MonoBehaviour
{
    private Rigidbody2D rb;

    [SerializeField] private float speedY = -250;

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

    void FixedUpdate()
    {
        rb.velocity = new Vector2(
            0,
            speedY *  Time.fixedDeltaTime
        );
    }
}

```

sentences:
Empty game object (child of player) not changing position correctly when key pressed I've made an empty game object which is the child of the player. It is by default on his right side and following his every move, and I want to make it so that every time a directional key is pressed (WASD) it changes position and stays there. But the way I've made it, it's not working as intended and seemingly goes to random positions every time. Here's the script:

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

public class ChangePositionAccordingToKey : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.W))
        {
            transform.position = new Vector3(-0.58f, 3.09f,0);
        }
    }
}

This is probably a dumb question but I am new to coding so I can't figure it out. Any help is greatly appreciated

sentences:
dual contouring concept and term translations I am working on a 3D sandbox mmo with destructible terrain, using Java and LWJGL. I looked at most options to achieve this and found that dual contouring would probably be the best option for me. I've read about every paper i could find on the internet about how to implement such a thing and, since i have a very basic experience in game/3d/complex programming, I've had quite a hard time. but I think I've found the solution i was looking for and would like to check with some more experienced programmer if my solution seems right and if I really successfully wrapped my mind around some of those pesky terms that were haunting my nights for the last few months;

Edit: I will try and add some more precise detail as to what i already do here in bold

so, first of all, I've created an object called voxel when I say object, i refer the the user side's way of handling the data received from the server. I already compress the data as to have it fit a byte or a short and use bitwise operations. Voxels are loaded once from the server then stored to memory unless the server returns a change to that voxel (not sending entire chunks for a small change), a voxel knows it's type and it's "integrity" (in this case, how much that stone voxel has been mined for example. I think it refers the the volume i often read about?). Those voxels "will" be created from a pre generated world map for a persistent world. Yes, the world will have overhangs and most of all, tunnels players can mine.

then i got a chunk, composed of at most 32x32x32 voxels. A chunk knows it's world position and has a 3D array of voxels passed from the server when first loaded to memory, then the client/server only updates the voxels that have changed since the last update. A chunk also knows it's neighbors (if such neighbors have been loaded into memory, or creates a default chunk of 32x32x32 air voxels)

To find the surface, inside a chunk, i check every voxel from the bottom,left,near (I think it is the right order to fit with the way OpenGL read it's coordinates?) to the top,right,far. each time, i take the current voxels and all it's 7 neighbors in a cube shape and check whether their is a type change from solid to air in any of them, indicating a surface running through that cube. If there's a type change, i compare every edges to see if there's a type change and if so, place the entersection of that edge using and average of both corners integrity. doing so for all 12 edges allows me to average all the planes to a single point inside that cube and create a vertex and store it in an array.

The point where I'm confused is this: what should i do next? I think I should check along one edge that displays a type change to find the 3 other cubes that has the same edge and find their vertices. Since i know what direction the ground is (comparing the type change along the edge axis) I can deduce the front and back of the quad. taking 3 of those 4 vertices should allow me to get a normal from their dot product and from there, go around that normal CCW and send those vertices to the GPU for the rendering phase. I guess the real question here is: How do I get the right order of vertices to form triangles that OpenGL can draw correctly from that large collection of vertices generated while finding the surface?

In theory, in my mind, it makes sense! but I find it so much simpler than all those papers I've found, that i fear I've missed the boat completely! I get lost when it comes to Isosurface (I guess here, the formula they're talking about would be the average of integrity along any type change?) and hermite data (here, should i read voxel collection instead?) and most maths are slightly beyond my understanding yet (working on it tho and I progressed quite a bit) please, can you help me out here and guide me a bit?

sentences:
How to put virtual hands in front of player? I want to have the VR hands always in front of the player. This works while walking forwards/backwards, once I rotate the camera they stay in the same place.

I know that I need to take the camera facing into account, but I am missing the math here.
Here is the code for hand translation/rotation:

    void Update()
{
    if (UnityEngine.XR.XRDevice.isPresent)
    {
        GameObject player = GameObject.Find("PlayerGameObject");
        if (hand == WebVRControllerHand.LEFT)
        {
            transform.position = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.LeftHand) + player.transform.position;
            transform.rotation = UnityEngine.XR.InputTracking.GetLocalRotation(UnityEngine.XR.XRNode.LeftHand);
        }

        if (hand == WebVRControllerHand.RIGHT)
        {
            transform.position = UnityEngine.XR.InputTracking.GetLocalPosition(UnityEngine.XR.XRNode.RightHand) + player.transform.position;
            transform.rotation = UnityEngine.XR.InputTracking.GetLocalRotation(UnityEngine.XR.XRNode.RightHand);
        }
    }
}

Update:
Having no movement implemented, looking around will make the hands always appear in front of the camera. If I add this code to the camera object, it will break  so the hands never leave their original space(they still move when I rotate the controller but they stay in the same place):

//Script is attached to the parent of the hands
public class SimpleMovement : MonoBehaviour {
void Update()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
        var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

        transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
    }
}

Update 2:
It seems like I got it partially working. At least for translation movement. I set the position only according to what comes out of the XR framework, now I add the player's position on top(previously I did this at the wrong spot).
What is missing now is rotating the camera with the sticks seemns different than rotating the camera with the headset. So the hands still do not respond to rotation movement of the sticks.

sentences:
How to correctly handle multiple Songs in XNA? I'm working on a (Windows-only) game in XNA, and I have multiple music tracks. I don't want to load them all into memory, but play them on demand. To properly dispose them, I have a separate ContentManager just for music and a method that looks like this:

    public void PlayMusic(MusicTracks trackToPlay)
    {
        if (trackToPlay == _currentlyPlayingTrack)
            return;

        MediaPlayer.Stop();
        _musicContentManager.Unload();

        Song song = null;
        switch (trackToPlay)
        {
            case MusicTracks.TitleMusic:
                song = _musicContentManager.Load<Song>("TitleMusic");
                break;
            case MusicTracks.CreditsMusic:
                song = _musicContentManager.Load<Song>("CreditsMusic");
                break;
        }

        if(song != null)
        {
            MediaPlayer.Play(song);
            MediaPlayer.IsRepeating = true;
        }
        _currentlyPlayingTrack = trackToPlay;
    }

(MusicTracks is an enum).

Is this the correct way to make sure I'm not using more RAM/Resources than required? Or should I be looking into XACT? To be clear, I don't need to play multiple Songs at the same time (I do need to play 1 Song and a few SoundEffects though) and I don't need any crazy effects apart from setting the Volume of the music independently from the soundeffects, which should be straight forward with MediaPlayer.Volume.

sentences: Running multiple game servers on single host I want to use a vps/dedicated server for game hosting. I expect hosting a lot of servers on that. For the connection, should I assign a unique port for every server or change IPs for every server. And how would these 2 options impact on the game, if I had multiple vps/dedicated servers.

sentences:
Complexity of defense AI I have a non-released game, and currently it's only possible to play with another human being. As the game rules are made up by me, I think it would be great if new players could learn basic game play by playing against an AI opponent. I mean it's not like Tennis, where the majority knows at least the fundamental rules.

On the other hand, I'm a bit concerned that this AI implementation can be quite complex. I hope you can help me with an complexity estimation. I've tried to summarize the gameplay below. Is this defense AI very hard to do?

Basic Defense Game Play

Player Defender can move within his land, i.e. inside a random, non-convex, polygon. This land will also contain obstacles modeled as polygons, that Defender has to move around. Player Attacker has also a land, modeled as another such polygon.

Assume that Defender shall defend against Attacker. Attacker will then throw a thingy towards Defender's land. To be rewarded, Attacker wants to hit Defender's land, and Defender will want to strike away the thingy from his land before it stops to prevent Attacker from scoring.

To feint Defender, Attacker might run around within his land before the throw, and based on these attacker movements Defender shall then continuously move to the best defense position within his land.

sentences: Can both High poly model go with a low poly scene? I'm in the process of developing a game, and I've found a model that would go perfectly for the character. However, the scentre I already have is low poly and I can't find a good enough high poly to go with it. So tell me whether or not I should I should carry on with the art I have or find a low poly model.

sentences:
Draw multiple objects with textures I want to draw cubes using textures.

void OperateWithMainMatrix(ESContext* esContext, GLfloat offsetX, GLfloat offsetY, GLfloat offsetZ) {

UserData *userData = (UserData*) esContext->userData;
ESMatrix modelview;
ESMatrix perspective;
    //Manipulation with matrix
    ...
    glVertexAttribPointer(userData->positionLoc, 3, GL_FLOAT, GL_FALSE, 0, cubeFaces);
    //in cubeFaces coordinates verticles cube
    glVertexAttribPointer(userData->normalLoc, 3, GL_FLOAT, GL_FALSE, 0, cubeFaces);
    //for normals (use in fragment shaider for textures)

    glEnableVertexAttribArray(userData->positionLoc);
    glEnableVertexAttribArray(userData->normalLoc);

    // Load the MVP matrix
    glUniformMatrix4fv(userData->mvpLoc, 1, GL_FALSE,
                       (GLfloat*)&userData->mvpMatrix.m[0][0]);

    //Bind base map
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_CUBE_MAP, userData->baseMapTexId);

    //Set the base map sampler to texture unit to 0
    glUniform1i(userData->baseMapLoc, 0);

   // Draw the cube
    glDrawArrays(GL_TRIANGLES, 0, 36);
   }

(coordinates transformation is in OperateWithMainMatrix() )
Then Draw() function is called:

void Draw(ESContext *esContext)
{
   UserData *userData = esContext->userData;
   // Set the viewport
   glViewport(0, 0, esContext->width, esContext->height);

   // Clear the color buffer
   glClear(GL_COLOR_BUFFER_BIT);

   // Use the program object
   glUseProgram(userData->programObject);

  OperateWithMainMatrix(esContext, 0.0f, 0.0f, 0.0f);

  eglSwapBuffers(esContext->eglDisplay, esContext->eglSurface);
}

This work fine, but if I try to draw multiple cubes (next code for example):

void Draw(ESContext *esContext)
{ ...

    // Use the program object
    glUseProgram(userData->programObject);

    OperateWithMainMatrix(esContext, 2.0f, 0.0f, 0.0f);
    OperateWithMainMatrix(esContext, 1.0f, 0.0f, 0.0f);
    OperateWithMainMatrix(esContext, 0.0f, 0.0f, 0.0f);
    OperateWithMainMatrix(esContext, -1.0f, 0.0f, 0.0f);
    OperateWithMainMatrix(esContext, -2.0f, 0.0f, 0.0f);
    eglSwapBuffers(esContext->eglDisplay, esContext->eglSurface);
}

A side faces overlapes frontal face.
The side face of the right cube overlaps frontal face of the center cube.
How can i remove this effect and display miltiple cubes without it?

sentences:
Averaging Camera Position I'm making a camera which tracks the player. I am using a basic algorithm to calculate a position for the camera relative to the player. Then I am taking an average of this over the last x number of frames. This creates a nice chase camera which always slightly lags and evens out the players movements.

Where I am running into trouble is with delta Time. How can I weight each entry in my list of previous positions so that delta time is taken into account. Currently I'm having an issue where, when the frame rate is particularly slow, the camera lags really far behind the player.

I should also mention that currently I am adding each entry ElapsedTimeInSeconds/0.01f times to give the weight. So the average is effectively over fewer frames if the frame rate is slow. I also tried entering values as Value * DeltaTime, then keeping an average of delta time to divide the values by when I get them back out of my average tracking class but that didn't work.

What I think I really want is an average over the last n seconds rather than the last n frames.

sentences:
Is WaitForSecondsRealtime() dependent on machine lag? I was reading the documentation and I'm trying to get some timing down for a few animations.
My question is, is the WaitForSecondsRealtime dependent on machine lag or anything? A friend of mine said that WaitForSecondsRealtime was invoked at the kernel level and thus it would be as accurate as possible.
Like I said I've read the documentation, but they don't really go into the specifics about how that works. Anyone have any insight?

sentences:
How can I use ParallaxBackground in AndEngine? I'm new to game development with  AndEngine. I want to add ParallaxBackground but I don't know how to change the background when the player moves. I'm using arrows for moving a player.

Now my question is where I write the code parallaxBackground.setParallaxValue(5);?

I have written this line in onAreaTouched method of arrow but it does not work.

Code

private Camera mCamera;
private static  int CAMERA_WIDTH = 800;
private static  int CAMERA_HEIGHT = 480;

private BitmapTextureAtlas bgTexture;
private ITextureRegion bgTextureRegion;

@Override
protected void onCreateResources() {

    BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
    bgTexture = new BitmapTextureAtlas(getTextureManager(),2160,480,TextureOptions.REPEATING_BILINEAR);
    bgTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(bgTexture, this, "background.png", 0, 0);
    bgTexture.load();
}
@Override
protected Scene onCreateScene() {

    this.getEngine().registerUpdateHandler(new FPSLogger());

    Scene scene = new Scene();
    scene.setBackground(new Background(Color.BLACK));

    final ParallaxBackground parallaxBackground = new ParallaxBackground(0, 0, 0);
    final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();

    parallaxBackground.attachParallaxEntity(new ParallaxEntity(0.0f, new Sprite(0, CAMERA_HEIGHT - this.bgTextureRegion.getHeight(), this.bgTextureRegion, vertexBufferObjectManager)));
    scene.setBackground(parallaxBackground);

Robot robot = new Robot();

    // add Player
    final AnimatedSprite animatedRobotSprite = new AnimatedSprite(robot.centerX, robot.centerY, 122, 126, (ITiledTextureRegion) robotTextureRegion, getVertexBufferObjectManager());
    scene.attachChild(animatedRobotSprite);
    animatedRobotSprite.animate(new long[]{1250,50,50});

    // add right arrow button
    Sprite rightArrowSprite = new Sprite(0, CAMERA_HEIGHT-70, rightArrowTextureRegion, getVertexBufferObjectManager()){

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,float pTouchAreaLocalX, float pTouchAreaLocalY) {

            switch (pSceneTouchEvent.getAction()) {

            case TouchEvent.ACTION_DOWN:
                moveRight = true;
                parallaxBackground.setParallaxValue(5);
                break;

            case TouchEvent.ACTION_MOVE:
                moveRight = true;
                break;

            case TouchEvent.ACTION_UP:
                moveRight = false;
                break;

            default:
                break;
            }
            return super.onAreaTouched(pSceneTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
        }
    };
    scene.attachChild(rightArrowSprite);

    scene.registerTouchArea(rightArrowSprite);

    scene.setTouchAreaBindingOnActionDownEnabled(true);

    scene.setTouchAreaBindingOnActionMoveEnabled(true);

    scene.registerUpdateHandler(new IUpdateHandler() {

        @Override
        public void reset() {

        }

        @Override
        public void onUpdate(float pSecondsElapsed) {

            if ( moveRight ){
                animatedRobotSprite.setPosition(animatedRobotSprite.getX()+speedX, animatedRobotSprite.getY());

            }
        }
    });

    return scene;
}

sentences:
Bullet Physics Terrain Im trying to Load an RGB image (.BMP) into bullet's btHeightfieldTerrainShape

Im using a loader that creates a openGL height map, it stores the data in a vector float, but I cant get the btHeightfieldTerrainShape to accept it.

I changed the vector float into a float array which contains height data according to the debugger, when loaded it takes forever to load the terrain, and when its loaded it is a flat terrain.

It is alot of code, but I can add it if needed.

The Code

sentences:
Meshes exported from blender as .obj does not map correctly I am having some problems with developing my game in OpenGL with java (Using LWJGL3). I have been following a guide for the more complex steps of the process, like loading meshes.

When using the basic mesh of a cube that was provided by the guide it works as it should, so it seems like it is not my software that is the problem? The problem comes when I attempted to create my own models using blender. I made sure to triangulate faces and include normals when exporting, but for some reason even when I created a simple cube it does not work correctly. The textures get smeared, only one face is intact. I have both tried the automatic UV projection, and making my own seams.

I have been stuck on this for a while and I have no idea where I am doing something wrong. I would greatly appreciate some help.

sentences:
2d camera shaking back and forth I'm trying to create a smooth moving 2d camera but the camera is shaking back and forth 1 pixel.

Player camera rectangle:

public Rectangle recCamPosition(Global global)
{
  return new Rectangle((int)Position.X, (int)Position.Y , 320, 240);
}

Camera rectangle:

public Rectangle recCamera(Global global)
{
  return new Rectangle((int)_pos.X / global.zoom, (int)_pos.Y / global.zoom, 320, 240);
}

The move method:

public void physic(Vector2 position, Player player, GameTime time, Global global)
{
  if(player.recCamPosition(global).X!=recCamera(global).X)
  {
    _pos.X+=(player.Position.X-160-recCamera(global).X)/16;
  }
}

sentences:
On Android, How can I avoid FPS drops during sensor listener setup/tear down? When I open my Android app after 5 or 10 seconds it sets up the sensor listener, during which I see clear stuttering and the FPS drops for a second to 40 instead of 60.

Is there a way to avoid this?

I am working in Android Studio with LibGDX.

sentences:
Should I still display splash screens for middleware that has been discontinued? Usually, you would include splash logos at the beginning of a game to credit various middleware that you've used. Say the company has dissolved or for open source the supporting group has simply moved on and declared the project over. In the hypothetical situation where a middleware project has been discontinued and you still have the legal right to use it, wouldn't you still include the logo for that project at the beginning?

Only concerned with the opening splashes, since I'm pretty sure it would be polite to credit the individuals who worked on that piece in the text credits or at the end.

sentences:
OpenGL ES indices optimization I am using OpenGL ES 1.x/2.x

I have 2 attributes to be passed to the GPU(one is colors, one is vertices, one color per vertex).

I use indices. Both attributes will use the same indices array

This is not a big issue but I was wondering if there is a way to tell the GPU that both attributes use the same indices array so that it is not transfered to the gpu twice, or maybe it does not matter because the GPU uses the RAM?

sentences:
multiple contacts for SAT collision detection I have implemented SAT algorithm for obb-obb intersection and I am able to generate a contact for this collision type. My problem is that SAT only generate ONE contact and in many situation I need more than one contact. For example, If I have a big cube and above it I have a small cube I need two contact (two contacts in 2D and 4 contacts in 3D) one for each bottom vertex of small cube.

My question is how can I generate more than one contacts with SAT?

Thanks.

sentences:
LibGDX - Executing 2 different touchDown events in the same method On the bottom left of my screen is a circle with an Arrow and on the bottom right is a circle with a gun. If the player is in jetpack mode and the Arrow "button" is clicked he flies like flappy bird (touch down = push him upwards, touch up = he falls down) - if the player is in jump mode he simply jumps.

My problem is I can't seem to fly the jetpack upwards AND shoot a bullet at the same time (i.e. the case where I'm tapping both the Arrow and the Gun). Is there some sort of trick I can use here?

My touchDown() method is in a class Controller looks like this:

@Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        int tapY = Gdx.graphics.getHeight() - screenY;
        //true if the arrow (bottom left) is tapped
        arrowClicked = inRange(upArrowSprite, screenX, tapY);
        //true if the gun (bottom right) is tapped
        gunClicked = inRange(gunSprite, screenX, tapY);

        // if arrow is pressed and player isn't in jetpack mode, make him jump
        if (arrowClicked) {
            if (!(player.getState() == ObjectState.JETPACK_MODE)) {
                player.setState(ObjectState.JUMPING);
                player.jump();
            // if the player is in jetpack mode, accelerate him upwards every time arrow is tapped
            } else {
            player.setTouchedDownFlying(true); // set boolean to be true
            player.setState(ObjectState.JETPACK_MODE);
        }
        }
        //if the gun is tapped (bot right), shoot a bullet
        if (gunClicked) {
            player.shoot();
            }
        return true;
    }

these are the relevant methods in Player:

public void update() {
    moveBy(xSpeed, -gravity);
    ...
    if(touchedDownFlying) {
        jetPackFly();
    }
    ...
}

public void setTouchedDownFlying(boolean bool) {
    touchedDownFlying = bool;
}

public void jetpackFly() {
        setySpeed(getySpeed() + flyAcceleration);
}

public void shoot() {
        Bullet i = new Bullet(this);
        bullets.add(i);
}

Any help is highly appreciated, thank you :)

sentences:
Prevent Unity click go trough Canvas I'm currently facing this problem: If I click on a Button on my Canvas, the currently selected Unit moves towards the location under the Button.

Is is there any option to solve this? I'm using the A* Project for this.

Sadly, I can not provide a lot of things I've done so far as I absolutely have no clue how to solve this problem.

If I disable the Button Option "Raycast Target" ist still moves to this position but holds a bit earlier.

Also, adding this as check didn't work:

if (!EventSystem.current.IsPointerOverGameObject() )

I also checked if the Raycast hit's the layer of the GUI

My Movement code so far:

public override void MouseClick(GameObject hitObject, Vector3 hitPoint, Player controller)
    {
        base.MouseClick(hitObject, hitPoint, controller);
        if (hasAuthority && player && player.human && currentlySelected)
        {
            if (hitObject.name == "Ground" && hitObject.name != "UI" && hitPoint != ResourceManager.InvalidPosition)
            {
                float x = hitPoint.x;
                float y = hitPoint.y + player.SelectedObject.transform.position.y;
                float z = hitPoint.z;
                destination = new Vector3(x, y, z);
                //Debug.Log("Start_Move");
                StartMove(destination);
            }
        }
    }

sentences:
How to determine size of art assets for Unity UI? Previously when I made games, I used ui assets from the asset store. Working with those assets was easy as the backgrounds were plain. However, I'm now working on a game where custom graphics are used for UI. So, I need to specify size of backgrounds,icons etc to the art team. I understand how aspect ratio works with regards to unity camera, but having trouble understanding the relation between camera size and Canvas. For example, for a camera size of 4.6, an image size of 517X920 will cover the whole screen in 9:16 aspect. However, the same image is considerably larger when used as UI image under the Canvas.
Can someone please help me understand how Canvas deals with image sizes?

sentences:
Calling a function from Super is getting an error I am following GameDev.tv's unreal C++ course, but I am getting an error that is causing my compiler to fail.  I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying: anything followed by '::' must be followed by a class or namespace.
Here is my .h file which has no known compiler errors.
    #pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "ShooterPlayerController.generated.h"

/**
 *
 */
UCLASS()
class SIMPLESHOOTER_API AShooterPlayerController : public APlayerController
{
    GENERATED_BODY()
public:
    virtual void GameHasEnded(class AActor *EndGameFocus = nullptr, bool bIsWinner = false) override;
};

Here is my .cpp file with the problem.
// Fill out your copyright notice in the Description page of Project Settings.

#include "ShooterPlayerController.h"

void GameHasEnded(class AActor *EndGameFocus, bool bIsWinner)
{
    //this is the problem super
    Super::GameHasEnded(EndGameFocus, bIsWinner);
}

I have a lot of other scripts, but I don't think they're related to the problem.  I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor’s code.

sentences:
Calculate gravity between two intersecting bodies I've been working on a 2D gravity simulator for some time and I'd like to add some surrealism to it by creating planets that can't collide with other planets (passing right through them).

The problem is, as distance between two bodies approaches zero, gravity goes to infinity - causing planets to slingshot when they're intersecting. Stopping gravity from being applied for a pair of bodies as soon as they touch looks odd as their velocity will suddenly go from accelerating to constant until they get to the other side.

Is there a function that gives me the best of both worlds or should I just leave the planets not being affected by gravity while intersecting other bodies?

sentences:
Understanding use of dot product in speed boost pad I am trying to understand the dot product. I have found a website that gives you intuition about this topic and one of the examples involves a speed boost pad:

Imagine the red vector is your speed (x and y direction), and the blue vector is the orientation of the boost pad (x and y direction). Larger numbers are more power.
How much boost will you get? For the analogy, imagine the pad multiplies your speed:

If you come in going 0, you'll get nothing [if you are just dropped onto the pad, there's no boost]

If you cross the pad perpendicularly, you'll get 0 [just like the banana obliteration, it will give you 0x boost in the perpendicular direction]

But, if we have some overlap, our x-speed will get an x-boost, and our y-speed gets a y-boost:
\$\text{Total} = speed_x \cdot boost_x + speed_y \cdot boost_y\$
Neat, eh? Another way to see it: your incoming speed is \$\|a\|\$, and the max boost is \$\|b\|\$. The percentage of boost you actually get (based on how you're lined up) is \$\cos(θ)\$
, for a total of \$\|a\| \|b\|\cos(θ)\$.

Let's say we have an object moving with a speed v of <3,3> at an angle of 45 degrees and a boost pad p of <10,0>. I am looking to see the increase of vector v when it hits the pad.
I have calculated the dot product obtaining a value of 30. My questions are:

how does this value modify the speed vector?

And what does this value actually represent? The new total length of v? Does it modify only the x coordinate of v?

And how do I add it over the initial vector? What would be the new speed vector after the interaction with the boost pad?

If we are to normalize the vectors and calculate the dot product, we get a value of around 0.70(cos 45). How is this value to be used on the current speed vector v<3,3>? And what does this percentage represent?

Also, I imagine that the new value for the vector would be just for the frame where it hits the pad, thus to make use of the boost a timer should be added before the speed comes back to normal.

sentences:
Lighting in a Minecraftian World Minecraft is a game that is largely based on a heightmap and uses that heigtmap information to flood the world with light.  From my understanding the highest point in the heightmap is the end of the sunlight influenced area.  Everything above that is lit by sunlight, everything below that just is influenced by light nearby in a radius of 8 blocks.

Thus if you have a floating island on the top of your world everything below that will be seen essentially as a cave.  When two lights influence the same point the brighter light wins (unsure about that).

Either way there are a couple of problems with minecrafts lighting model: first of all, if your world does not have a heightmap it becomes trickier to figure out what exactly is supposed to emit sunlight and what not.  A simple way would be to assume that the world is (in my case) a floating rock and then traverse each axis from both directions and figure out where the rock starts and ends.  But this does not fully eliminate the problem as dents in the rock are not supposed to be in darkness.

Minecraft itself will cache the light information in its chunks together with the information about the material of a block.  Thus only if the world is modified the lighting has to update.  Unfortunately that process is still pretty slow on updates and on quick light changes one can see the lighting lag behind.  That's especially true if a lot of blocks change (TNT, sunset etc.) and you're not running the fastest computer (Or Java on Mac).

From my still limited understanding of 3D graphics lighting a world like minecraft shouldn't be the biggest issue.  How would you tackle the problem?

I think the basic requirements for lighting in a voxel world would be

update fast enough that it could happen in a single frame.  One might be able to do the lighting in the graphics device and download the changed light information to the main RAM.
light information must be quickly available for the main game logic so not entirely based on the graphics device: reasoning: light affects the growth of grass, spawning of monsters etc.
light updates would have to be local to a chunk or have some other limit so that one does not have to relight the whole world which might be very large in size.

The main idea would be to make the light updates fast, not necessarily more beautiful. For general light rendering performance improvements one could easily add SSAO on top of that which should result in much nicer worlds.

sentences:
What are projection independent ways of determining whether a normal is facing the viewer? A position v and normal n are given in world coordinates. Also there is a view matrix V for world-eye coordinate transition and a projection matrix P for eye-ndc transition. I would like to determine, whether the normal is facing the viewer.

If we assume that P is a perspective matrix, we can compare the normal direction with the direction to the viewer, both in eye-space. Note that the approach won't work for an orthographic projection, because there is no well defined eye position. But if P is orthographic, we only need to check the Z coordinate of n in eye space. Nevertheless, I'm seeking a solution that does not make assumption about what projection type we're using.

One way of achieving this is to compute the inverse P' of P and retrieve the viewing direction as a vector spanned between P' [u.x, u.y, -1] and P' [u.x, u.y, 1], where u is v transformed to ndc. The drawback here is that it requires inverting a matrix and in my case also passing it to the shader.

Another solution would be to construct a small triangle around v within the normal plane of n, and check what's its winding direction in the ndc. The problem with this approach is that it's computationally heavy and it's still seems to me more like a hack than a proper solution.

I am not very satisfied with these two solutions. Do you have any other ideas? Am I missing something very simple?

EDIT:
Since it seems unclear why the dot(v - eye, n) < 0 is not satisfactory in my case, I post an exaple showing the difference between perspective and ortho projection for this particular problem.

As you can see, the vector is facing slightly away in the perspective projection, but clearly towards in the orthographic projection. More specifically, a face having that particular normal would be culled in perspective, but not in ortho.

sentences:
Why does my disable z-depth test shader do not work? I wrote the following shader which purpose is to force draw a mesh over the rest, regardless z-depth :

Shader "Custom/AlwaysOnTop"
{
    SubShader
    {
        Tags { "Queue"="Overlay" "RenderType"="Overlay" }
        ZTest Always

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input
        {
            float4 color : COLOR;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            o.Albedo = 1;
        }
        ENDCG
    }
    Fallback "Diffuse"
}

It works great, however transparent objects still get draw over it. Setting the queue as Overlay should have solved the problem.

White = AlwaysOnTop shader
Green = Transparent diffuse
Blue = Diffuse

The left face of the white cube should be white, no tinted in green.

sentences:
3D Studio Max biped restrictions? I have a stock biped character in 3D studio max which has a jump animation.

The problem I have with the jump animation is that there is actual y offset happening inside it which makes it awkward to play while the character is jumping since it's not only jumping in the game world but the jump animation is adding its own height offset.

I'm tryuing to remove the jump animations height offset, so far I've found the root node and deleted all its key frames which has helped a bit.

The problem I'm having now is that the character still has some height offset and if I try to lower it it has a fake 'ground' that isn't at 0 and the limbs sort of bend on the imaginary floor, si there a way to remove this restriction just for the jump animation?

Here's what I mean: http://i.imgur.com/qoWIR.png

Any idea for a fix? I'm using Unity 3D if that opens any other possibilities...

sentences:
How do I determine the draw order of isometric 2D objects occupying multiple tiles? My current sorting method works only for objects that occupy 1 tile and fails for multi-tile objects. For examle, the bed in the above picture occupies 1×2 tiles, and the sorting fails.

Also that bed picture is 1 whole image that covers 2 tiles.

How can I change my sort method to accomodate this?

sentences:
Fog shader camera problem I have some difficulties with my vertex-fragment fog shader in Unity. I have a good visual result but the problem is that the gradient is based on the camera's position, it moves as the camera moves. I don't know how to fix it.

Here is the shader code.

struct v2f {
    float4 pos : SV_POSITION;
    float4 grabUV : TEXCOORD0;
    float2 uv_depth : TEXCOORD1;
    float4 interpolatedRay : TEXCOORD2;
    float4 screenPos : TEXCOORD3;
};

v2f vert(appdata_base v) {
    v2f o;
    o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    o.uv_depth = v.texcoord.xy;
    o.grabUV = ComputeGrabScreenPos(o.pos);
    half index = v.vertex.z;
    o.screenPos = ComputeScreenPos(o.pos);
    o.interpolatedRay = mul(UNITY_MATRIX_MV, v.vertex);
    return o;
}

sampler2D _GrabTexture;

float4 frag(v2f IN) : COLOR {
    float3 uv = UNITY_PROJ_COORD(IN.grabUV);
    float dpth = UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, uv));
    dpth = LinearEyeDepth(dpth);
    float4 wsPos = (IN.screenPos + dpth * IN.interpolatedRay); // Here is the problem but how to fix it
    float fogVert = max(0.0, (wsPos.y - _Depth) * (_DepthScale * 0.1f));
    fogVert *= fogVert;
    fogVert = (exp (-fogVert));
    return fogVert;
}

Thanks a lot !

sentences:
How to check metadata stored in FBX files? Is there a way to check and edit metadata information stored in FBX files? I'm using 3ds Max's fbx exporter. Can this be done with it or is there any other tool for that?

For example: adding name, contact info, tags or anything that provides ownership of the file.

sentences:
What debugging info should I put in the "About" box I'm developing an Android game with the idea of publishing it, and I wonder what info should I put in the "About" dialog that many main menus have.

The idea is to make bug report and debugging easier. Users can click in the "About" box and read the details of their device, and include them in any bug report they send me - I know Google sends relevant device data to the developer when there's a crash, but I'm thinking in bugs that not necessarily end with an abnormal program termination.

So far, I've added API number of device, screen size, screen density, and number of processors.

My current "About" screen is something like this:

  Game titleGame iconAPI versionScreen sizeScreen densityNumber of
  processors (just in case, because game uses threading)Game version numberDeveloper e-mailCopyright information

If anyone has experience publishing and maintaining an app, specially in Android, I want to know what can I add there to make user reporting and debugging easier.

sentences: How to play a movie on top of a webcam texture I've been through the Unity docs, searched here, and on stackoverflow; I have not found any good information about using the WebCamTexture for my purposes. So here goes, how do I play a movie asset such as an mp4 clip so that it appears to be on top of the captured webcam image? Lets assume the movie is semi-transparent.

sentences:
What is render path? What is "render path"? Who invented this term?

I can suppose that this thing mean something one from the list below:

The thing which shows which rendering technique should be used (e.g. forward/deffered rendering)
Module for rendering lines and curves
Description how shaders should be connected in mutlipass render to reach the goal of some render FX.

For what this term is stand for? Thanks

sentences:
Process for Creating Imposters (For Unity) I'm still working on making a sports stadium with crowd etc. I've been reading a lot about 'Imposters' and 'Billboarding'. I want to explore and learn the imposters technique.
But I am stuck at step 1 :|
I have a stadium model made which is empty (no seats or people).
All I want at the moment is seats. I have the model made in Maya for a seat.

Do I need to make (and import to Unity) both a low-poly and high-poly version of the model.
How exactly is an 'imposter' asset stored in data (specifically if used in Unity)?
Do I need to make 2d images/textures of many angles of the seat?

I do have more questions, but these may be enough to get me started.
Thanks as always for any help.

sentences:
Multiplayer architecture in games like Diablo 2 So I've been wondering, what kind of architecture would games like world of warcraft, diablo 2 (which is most probably a different beast than WoW) use?

As far as I know, RTS games state-syncs every client and server, and the input from the clients get relayed to the server, and all states from all clients will get the same input, because everything is synced.

And because everything is synced, state changes can be done safely, thus allowing large numbers of entities in the game (e.g zerglings), because the clients only need to know the players' inputs.

This is all fine and well, but AFAIK diablo 2 allows players to join servers mid-game, which leads me to believe they use a different architecture. I'm stumped on how they do this though, and if elegant solutions exist for such a thing. Does anyone have a better idea?

sentences:
Importing python DirectX into c++ DirectX program I'm not asking for code or anything, just some advice on what to google, because I have no idea what to call this process.

I made a video player (with full controls) with python and DirectX and would like to just simply import the rendering of the display into a c++ DirectX fullscreen app. That way, it can be customizable to the user.  Any advice is greatly appreciated.

sentences:
Objective-C or C++ of game engine header file for iOS developers? We've developed a game engine written in C++. Now we are preparing our game engine for iOS developers.

I guess that many game developers use C++ or Objective-C for their game apps. So I think we should expose the API of our library in both Objective-C (@class blahblah) header files and in C++ (class blahblah) header files.

Am I on the right track? If not, what is the most recommended way of exposing the API for our library?

sentences:
What is a good way to procedurally generate large tilemaps? I'm sorry if this question was already asked before.
The game I'm aiming to make is a 2D-top down game in similar fashion to Zelda. I'm generating tilemaps, simple grids with 16x16 pixels per tile, and I'm using cellular automata combined with some other methods to generate these tilemaps. I can generate fairly large tilemaps, but It's problematic to go too big and it seems very ineffiecent. To be able to have a big world I decided it was probably smart to divide everything up in smaller seamlessly connected tilemaps, but I'm really unsure how to actually deal with such a large map. Since I'm planning on having maybe 40x40 tiles per area, and 100x100 areas for the whole world that will add up to a ridiculous amount of tiles in total.
What is the best way to generate such a huge area and still letting it all flow together nicely and naturally? I'm currently generating a mini map of a world to get the general layout of the world. (100x100 pixels) And I could generate all of the areas seperately based on this layout, but i'm not sure it would allow me to create larger open and natural environments.
I see 3 different options:

1) Generating the whole map at once as the game is started, everything in one go, this including all the different regions like forests, lakes, mountains etc.

2) Breaking the areas down by the type of region, for example, getting the bounds of a forest area (which spans over several tilemaps) and then generating it with more detail, and moving on to other regions after that

3) Generating the areas one by one as you enter them, meaning the world will only be fully generated once you explored it all.

I appreciate all replies a lot! It's more of a general question and I imagine there are a lot of ways to do these, so any suggestions are welcome! Maybe I have the wrong approach altogether? I'm very new to procedural map generation so I apologise if I come off as very inexperienced
Thank you!

sentences:
More efficient way to implement Line of sight on a 2d grid with ray casting? Consider a 2d grid of tiles, and an approximated sphere of coordinates - centered on the player - that represents line of sight. The goal is to block the line of sight beyond obstacles (ie walls).

It's relatively simple to determine if an individual cell in the sphere of sight is visible: cast a ray from the player to the target cell, using Bresenham's - if one of the overlapping cells between the player and the target is an obstacle, the target cell is not visible.

Now, my first thought was to iterate through all grid cells in the line of sight - but this seems inefficient to me. For example, if the player is standing next to a wall, and you determine that the cell beyond the wall isn't visible, you can determine all cells on the ray after that won't be visible.

Also considered casting a ray to each cell along the perimeter of the sphere of sight, and iterating each cell along each ray - but then I'd be processing some cells more than once.

Is there a more efficient way to do this?

While iterating ~50 cells per turn is a relatively lightweight calculation, I'm going for speed - the goal is to be able to cycle a few turns per second on auto-play. So, the more efficient I can make this, the better.

sentences:
Are polygon normals really shadeable? Garry's Mod has a copy-protection trap that shows this error:

  Unable to shade polygon normals

It made me wonder if such a problem could ever actually exist.  Can polygon normals be shaded? Is a failure to do so detectable and reportable?

sentences:
Binary Serialization and Protocol i found this page Protocols. I'm currently working on a game similar to agario and i find that page is helpful for my game.

They using WebSocket for sending game messages which is mine too. But i'm use text message (JSON) instead of binary message and i'm planning to switch to binary message for minimizing bandwidth reason because JSON are verbose even it's easy to serialize/deserialize.

On the section server->client protocol and client->server protocol, they used term of opcode. I don't about what opcode is and what the purpose of those number, but i know in WebSocket protocol RFC 6455, they used term of opcode too like 1 for text message and 2 for binary message.

My Question is:

How to serialize/deserialize game messages in binary message?
What is those number in opcode used for? for now, my assumption is those number are used for serialization in binary message, maybe not i don't know
If my assumption in Q2 is right, how to implement those number to my protocol? maybe some code demonstration? it will be great if the code in javascript and golang because i'm use go for server and javascript for client.

Thanks

sentences:
Is there a way to determine Android physical screen size? We're currently porting our games to Android, and would like to be able to release a universal build for tablets and phones. Is there a way to determine the actual screen size or DPI in order to adjust the size of interface elements accordingly? It took a fair bit of research.

Here's what we have tried:

using UnityEngine;

public class DisplayMetricsAndroid {

 // The logical density of the display
 public static float Density { get; protected set; }

 // The screen density expressed as dots-per-inch
 public static int DensityDPI { get; protected set; }

 // The absolute height of the display in pixels
 public static int HeightPixels { get; protected set; }

 // The absolute width of the display in pixels
 public static int WidthPixels { get; protected set; }

 // A scaling factor for fonts displayed on the display
 public static float ScaledDensity { get; protected set; }

 // The exact physical pixels per inch of the screen in the X dimension
 public static float XDPI { get; protected set; }

 // The exact physical pixels per inch of the screen in the Y dimension
 public static float YDPI { get; protected set; }

 static DisplayMetricsAndroid() {
     // Early out if we're not on an Android device
     if (Application.platform != RuntimePlatform.Android) {
         return;
     }

     // The following is equivalent to this Java code:
     //
     // metricsInstance = new DisplayMetrics();
     // UnityPlayer.currentActivity.getWindowManager().getDefaultDisplay().getMetrics(metricsInstance);
     //
     // ... which is pretty much equivalent to the code on this page:
     // http://developer.android.com/reference/android/util/DisplayMetrics.html

     using (
         AndroidJavaClass unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"),
         metricsClass = new AndroidJavaClass("android.util.DisplayMetrics")
     ) {
         using (
             AndroidJavaObject metricsInstance = new AndroidJavaObject("android.util.DisplayMetrics"),
             activityInstance = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity"),
             windowManagerInstance = activityInstance.Call<AndroidJavaObject>("getWindowManager"),
             displayInstance = windowManagerInstance.Call<AndroidJavaObject>("getDefaultDisplay")
         ) {
             displayInstance.Call("getMetrics", metricsInstance);
             Density = metricsInstance.Get<float>("density");
             DensityDPI = metricsInstance.Get<int>("densityDpi");
             HeightPixels = metricsInstance.Get<int>("heightPixels");
             WidthPixels = metricsInstance.Get<int>("widthPixels");
             ScaledDensity = metricsInstance.Get<float>("scaledDensity");
             XDPI = metricsInstance.Get<float>("xdpi");
             YDPI = metricsInstance.Get<float>("ydpi");
         }
      }
   }
}

sentences:
Powder games: how do they work? I recently found these two gems:

http://powdertoy.co.uk/

http://dan-ball.jp/en/javagame/dust/

My question is: How are the physics with so many elements efficiently handled? Am I just severely underestimating modern computing power or is it possible to 'just' have a two-dimensional array, each cell of which describes what is placed at the according position and simulate each cell in every step. Or are there more complex things being done like summarising large areas of the same kind into a single data set and separating said set as needed?

Are there any open-source games like this I could look at?

sentences:
Which nodes of the Collada DAE are most relevant for game object/character use? I'm really new to game dev / D3D. And I was looking to choose an intermediary format to work with and convert to my internally used format. Collada DAE seems to be good as it can export animation too and it's XML. Kind of bloated but easy to parse.

My expertise is in reusable code writing, libraries, APIs and such. So my first impulse was to go an implement a FULL parser of the Collada format given the fact that I'm not 100% what I need or will need to extract from it.

As it seems Collada is trying to be everything and the kitchen sink, there's definitely stuff in there I don't think I need to be concerned about. So, sanity prevailed and decided to come here and ask the experienced people what are the important nodes for game characters and objects in the .DAE file? Or is there another format considered friendlier by game devs that can export animations too?

I've figured out the following are important:

geometries (mesh + triangles)
materials + images
animations + controllers
visual scenes + scene

What else am I missing from the top-level node list? I don't think lights are important as I deal with that in code. I just need to import meshes + textures + animations. At least for now, as I'm just starting out in D3D programming.

For a non-animated object I can get away with a .OBJ file but for a player with animations, I really don't think .OBJ supports them.

  So the question is: Which DAE nodes are relevant to game objects and animated characters?... and if someone experienced consuming this format could provide a few words describing them, in a more game-friendly way then that specification... would be great! Or should I use another intermediary format but .DAE?

sentences:
Setting a uniform float in a fragment shader results in strange values, is this a type conversion? How can it be fixed? First, some details:

I'm learning OpenGL from the tutorials on https://open.gl
My computer is running Linux Mint 18.1 Xfce 64-bit
My graphics card is a GeForce GTX 960M
OpenGL Version: 4.5.0 NVIDIA 375.66
GLSL Version: 4.50 NVIDIA
Graphics Card Driver: nvidia-375 Version: 375.66-0ubuntu0.16.04.1
CPU: Intel Core i7 6700HQ
The code I'm working on can be found here: https://github.com/Faison/sdl2-learning/blob/8a61032d20edf91cfa60f665e1bb4d72e58f634b/phase-01-initial-setup/main.c (Makefile is located in the same directory)

In a fragment shader, I'm trying to make an image do a sort of "flipping mirroring" animation (lines 44-57):

#version 450 core
in vec3 Color
in vec2 Texcoord;
out vec4 outColor;
uniform sampler2D tex;
uniform float factor;
void main() {
 if (Texcoord.y < factor) {
    outColor = texture(tex, Texcoord) * vec4(Color, 1.0);
  } else {
    outColor = texture(tex, vec2(Texcoord.x, 1.0 - Texcoord.y));
  }
}

When factor is 1, the image should be right-side up and has some color on it.
When factor is 0, the image should be upside down and has no color added to it.
When factor is 0.5, the top half should be right-side up and the bottom half should be upside down.

Currently, that is only the case if I replace factor with the number.

When I set the uniform factor with glUniform1f(), I'm getting very strange results. To illistrate, I added some debug code to lines 188-197 that sets the uniform with one number, retrieves the number from the uniform, and outputs both values to try and see what's going on.

Here's the code:

GLfloat factorToSet = 1.0f;
GLfloat setFactor = 0.0f;
GLint uniFactor = glGetUniformLocation(shader_program, "factor");

while (factorToSet > -0.1f) {
  glUniform1f(uniFactor, factorToSet);
  glGetUniformfv(shader_program, uniFactor, &setFactor);
  printf("Factor of %.1f becomes %f\n", factorToSet, setFactor);
  factorToSet -= 0.1;
}

And here are the results:

Factor of 1.0 becomes 0.000000
Factor of 0.9 becomes -2.000000
Factor of 0.8 becomes -0.000000
Factor of 0.7 becomes 2.000000
Factor of 0.6 becomes 0.000000
Factor of 0.5 becomes -0.000000
Factor of 0.4 becomes 2.000000
Factor of 0.3 becomes -36893488147419103232.000000
Factor of 0.2 becomes 0.000000
Factor of 0.1 becomes 36893488147419103232.000000
Factor of -0.0 becomes -0.000000

So with what little I understand about OpenGL and the way scalar types are stored in binary, I'm thinking that this issue is caused my GLfloat getting converted into something else on the way to the shader's uniform float. But I'm grasping at straws.

What could be causing this strange conversion between the number I send to the uniform float and the value that the uniform float becomes? What could I do to fix it if it's possible to fix?

Thanks in advanced for any help and leads, I really appreciate it :)

An additional note after receiving a working answer

George Hanna provided a link to a post where someone had a similar issue. I read over the comments and someone said to use -DGL_GLEXT_PROTOTYPES as a CFLAG. So I rolled back my local code to use glUniform1f() again, added -DGL_GLEXT_PROTOTYPES to the Makefile, and everything worked! Even crazier, all the compiler warnings I had for implicit declarations of OpenGL functions were gone!

So in addition to the answer below, if you have this issue, try adding -DGL_GLEXT_PROTOTYPES to your CFLAGS.

(You can also get this affect by adding #define GL_GLEXT_PROTOTYPES before any OpenGL #includes)

sentences:
How do I implement efficient collision avoidance in 100 enemies I am developing a libgdx game. It is a top down shooter and I am trying to make a good AI. I have tried to implement A* from the AI library from libgdx and it works fine but when i have a lot of enemies it starts to slow down the game. Have tried implementing a Pathfinding manager to manage threads and path requests but I have trouble implementing it and still slows down.

Also I know A* is a bit overkill for my game, which is a big open zone mostly (see pic of my map)

So I tried to implement this collision avoidance Steering Behaviors: Collision Avoidance but it doesn't go well when the player is inside houses.

My question is, does exists some type of algorithm that fits perfectly for what I am asking? There are a lot of games with hundreds of enemies going to kill you so I bet there is a way, just I cant find out

pd: Any doubt ask and I will provide more information if necessary

sentences: Unity 3D engine for Ubuntu? Is there any way to get Unity 3D to run on Ubuntu. I am currently running Ubuntu 12.04 64bit edition. I also have Wine installed.

sentences:
Technical differences between square and hexagon for a grid? I'm developing a 2D city-building game and trying to decide on the type of grid. There will be vehicles, so the unit movement is important too.

I know there are visual differences for using Squares or Hexagons, what I want know is:

What are the issues for programming each type of grid regarding implementation and performance?
Is there a tradeoff or specific benefit for using one of them in a game context?

sentences:
Why my keyPressed method stops reacting to any key i press after i hold (W/A/S/D) for 1 or 2 seconds? public class Testing extends JPanel{

    public void Action() {
        Timer t = new Timer();
        t.schedule(new TimerTask() {

            public void run() {
                if(move2==true) {
                    switch(direction2) {
                    case 1 : x-=2;
                    break;
                    case 2 : x+=2;
                    break;
                    case 3 : y-=2;
                    break;
                    case 4 : y+=2;
                    }
                }
                repaint();
            }

        }, 10, 20);
    }

    public void paint(Graphics g)
    {
        g.clearRect(0, 0, 526, 690);
        g.drawLine(x, y, x, y-30);
        g.drawLine(x+1, y, x+1, y-30);
        g.drawLine(x-1, y, x-1, y-30);

    }
    static boolean move2 = false;
    static int x = 200;
    static int y = 100;
    static int direction2 = 0;
    public static void main(String[] args) {
    JFrame f = new JFrame();
    Testing t = new Testing();
    f.setVisible(true);
    f.setSize(526,690);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLocationRelativeTo(null);
    f.setFocusable(true);
    f.add(t);
    t.Action();
    f.addKeyListener(new KeyListener() {

        public void keyTyped(KeyEvent e) {

        }
        public void keyPressed(KeyEvent e) {
            System.out.println("did");
            switch(e.getKeyCode()) {
            case KeyEvent.VK_A:
                move2 = true;
                direction2 = 1;

                break;
            case KeyEvent.VK_D:

                move2 = true;
                direction2 = 2;
                break;
            case KeyEvent.VK_W:

                move2 = true;
                direction2 = 3;
                break;
            case KeyEvent.VK_S:

                move2 = true;
                direction2 = 4;
                break;
            }

        }

        public void keyReleased(KeyEvent e) {
            switch(e.getKeyCode()){
            case KeyEvent.VK_A:move2 = false;
            break;
            case KeyEvent.VK_D:move2=false;
            break;
            case KeyEvent.VK_W:move2=false;
            break;
            case KeyEvent.VK_S:move2=false;
            }
        }
    });
    }

}

sentences:
What criteria should I have met before releasing a game? I am working on a hobby game that is played in the browser (not flash). It is a sort of civilization simulator. It is a pretty substantial sized game that I hope one day has many players.

My question is what should my game have before I allow the public to play. I have several thoughts and would appreciate suggestions as well as other thoughts.

Limit the game to colleagues and friends to test until I effectively finish the game.
I open the game up to the public shortly after basic enjoyable functionality is done. I would then release weekly or biweekly updates with new functionality and bug fixes.

So the root question is, is it better to release to the world after everything is "done" (potentially years) or after it is "playable", but lacking?

sentences:
Can you show rng code running in real time in a game? First off, I know almost nothing about game development/rng but I will learn. So apologies for sounding uninformed.
I want to make a sandbox ios game with several activities to do within, one of which is poker, but I want the poker to be infallibly transparent unlike online poker. They wouldn't dare.
So I want to show the rng code to be viewable by players as the hand plays out, so players will know its legit, and can verify after the hand etc if they have concerns, is this possible, can you "show" rng?

sentences:
How to use multiple animations? convert an animated model:
3dsMax(CAT) -> Export FBX -> fbx-conv -> model.g3dj
my code:
...
val model = modelLoader.loadModel(Gdx.files.getFileHandle("model.g3dj", Files.FileType.Internal))
val modelInstance = ModelInstance(model)
val controller = AnimationController(modelInstance)
controller.setAnimation("Take 001", -1, 0.5f, null)
...

docs:

setAnimation(java.lang.String animationId)
Set the active animation, replacing any current animation.

How to set animationId in the source file (FBX) ?
my research:
model.g3dj
{..., animation: { id: 'Take 001', ... } }
format: https://github.com/libgdx/fbx-conv/wiki/Version-0.2-%28draft%29
model.fbx
AnimationStack 'Take 001'
format: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=files/GUID-E5C89F5F-09D1-4C32-BA83-28F63D0B2A6C.htm,topicNumber=d30e11661
my question: How to set AnimationStack.name in 3dsMax?
https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/3DSMax/files/GUID-26323F8D-3CC2-4918-A60D-C9D6C558584E-htm.html

sentences:
Calculate line intersecting most points, based on random points in a grid I have been struggling with a math issue for a game I've been developing. I am in need to find the best starting and ending point for a straight line so that it intersects most of the circles (the blue one always needs to be intersected).

As you can see in the image below I want to be able to calculate that green line based on the given points, where the blue one is required to be intersected. The rule is that the line has to intersect as many circles as possible and should always intersect the blue circle.

I've tried to apply the best fit algorithm but that doesn't really takes intersection into consideration. Would appreciate if someone could help me out solving the math for this.

There will only ba a maximum of 5 circles while calculating the line.

Note: I am not deeply involved into math, only know the basic symbols for it.

sentences:
C# XNA Rectangle.Contains returns false? I am creating a simple XNA game. My mainMenu class contains a list of strings for menu options wich I draw on the scren using spriteBatch.DrawString. I've set Vector2 variables to controll the position of the spritefont. Then I created 2 Rectangles (and took the values of the Vector2s) and 2 Colors that will be given a value if the mouse is/isn't currently hovering the drawn string. My mainMenu.cs class contains these variables:

Vector2 playGameButtonPos = new Vector2(303, 300);
Vector2 exitGameButtonPos = new Vector2(303, 350);
List<string> m_ButtonList = new List<string>();
Rectangle m_ButtonArea0 = new Rectangle(303, 300, 50, 30);
Rectangle m_ButtonArea1 = new Rectangle(303, 350, 50,30);
Color optionsColor0;
Color optionsColor1;

mainMenu.LoadContent(ContentManager Content):

Game1.g_MainMenuFont = Content.Load<SpriteFont>(".\\mainMenu\\mainMenuFontTex");

mainMenu.cs's constructor:

m_ButtonList.Add("Play Game");
m_ButtonList.Add("Exit Game");

mainMenu.Draw(SpriteBatch spriteBatch):

var m_MousePosition = new Point(Game1.g_MouseState.X, Game1.g_MouseState.Y);
if (m_ButtonArea0.Contains(m_MousePosition))
{
    optionsColor0 = Color.Yellow;
}
else
{
    optionsColor0 = Color.CornflowerBlue;
}
if (m_ButtonArea1.Contains(m_MousePosition))
{
    optionsColor1 = Color.Yellow;
}
else
{
    optionsColor1 = Color.Red;
}
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[0], playGameButtonPos, optionsColor0);
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[1], exitGameButtonPos, optionsColor1);

Game1:

public static MouseState g_MouseState = Mouse.GetState();
public static SpriteFont g_MainMenuFont;
mainMenu m_MainMenu;

Game1's Initialize() method:

m_MainMenu = new mainMenu();

Game1's LoadContent() and Draw() methods:

m_MainMenu.LoadContent(Content);

m_MainMenu.Draw(spriteBatch);

But when I hover with my mouse on the position where the Rectangle should be, nothing happens.

sentences:
Bump and push entities without a physics engine I have seen on many games the ability to push entities around and bump into enemies/characters. What is this called?

I have implemented Matterjs to accomplish this with Pixijs but it seems overkill when I just need the ability to bump and push. I'm not really interested in an accurate physics model, just collision enough to allow the character to interact with the environment.

I can't seem to find out what this is called. My idea is to have all entities defined by a circle collision boundary, and move away from the character based on primitive collision detection and a tangent force calculation to displace.

sentences:
HTML5 or Javascript game engine to develop a browser game I would like to start developing a MMO browser game, like Travian or Ogame, probably involving also a bit of more sophisticated graphical features such as players interacting in real time with a 2d map or something like that.

My main doubt is what kind of development tools I should use: I've a good experience with PHP and MySQL for the server side and Javascript (and jQuery) regarding the client side. Coding everything from scratch would be of course really painful so I was wondering if I should use a javascript game engine or not. Are there (possibly free) game engine you would recommend? Are they good enough to develop a big game?

Also, I saw a lot of HTML5 games popping up lately but I'm now sure if using HTML5 is a good idea or not. Would you recommend it? What are the pro and cons about using HTML5? If you'd recommend it, do you have any good links regarding game development with HTML5?

(PS: I know that HTML5 and a Javascript engine are not mutually exclusive, I just didn't know how to formulate a proper title since English is not my main language. So, please, answer addressing HTML5 and a game engine pro and cons separately)

sentences:
why child class can access object while parent can't I have Block class which is the parent and StandardBlock the child , the prefab block have StandardBlock script attached to it, and according to my small knowledge in inheriting I though this would work

public class Block : MonoBehaviour
{
HUD HUDscript;
// Start is called before the first frame update
void Start()
{
    HUDscript = GameObject.FindWithTag("Canvas").GetComponent<HUD>();
}
public void OnCollisionEnter2D(Collision2D col)
{
    HUDscript.addPoints();
    Destroy(gameObject);
}
}

and child class

public class StandardBlock : Block
 {

      // some code
}

but this is the error that i got

NullReferenceException: Object reference not set to an instance of an object
Block.OnCollisionEnter2D (UnityEngine.Collision2D col) (at Assets/Scripts/Gameplay/Block.cs:24)

while writing OnCollisionEnter2D in the child class worked fine

sentences:
how to use glm::rotate with a eulerangle? I have a vec3 to represent my object's orientation/rotation but the glm::rotate method expects a quaternion. If I just convert it to a quaternion like this:

glm::quat rot = rotation;

The W value will just be zero, right? And then there won't be any changes in rotation.

In my code I just want to be able to do rotation.x += 5.0f; in the update method of an object.

This is the method I'm using for my transformations:

glm::mat4 GameObject::Transform(glm::mat4 model, glm::vec3 position, glm::vec3 scale, glm::quat angleAxis)
{
    model = glm::translate(model, position);
    if (angleAxis.w > 360.0f)
    {
         angleAxis.w -= 360.0f;
    }
    else if (angleAxis.w < 0.0f)
    {
         angleAxis.w += 360.0f;
    }
    model = glm::rotate(model, angleAxis.w * toRadians, glm::vec3(angleAxis.x, angleAxis.y, angleAxis.z));
    model = glm::scale(model, scale);
    return model;
}

Currently I'm just passing on that rotation vec3 to that angleAxis quaternion parameter but that obviously doesn't work.

This is how i currently calculate my front, up, and right vectors:

void GameObject::calculateCameraView()
{
    front.x = cos(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front.y = sin(glm::radians(rotation.y));
    front.z = sin(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front = glm::normalize(front);

    right = glm::normalize(glm::cross(front, worldUp));
    up = glm::normalize(glm::cross(right, front));

    front.y = invertMouse ? front.y * -1 : front.y;
}

sentences:
Side detection on Rectangle collision detection? How can I determine which of the sides on a Rectangle that was hit by another Rectangle (or Circle if that's easier)?

I originally tried creating 8 subrectangles for my main rectangle - one for each side and corner - with the appropriate length and width of one pixel. This didn't work out very well though, to my understanding it was thwarted by the speed and update frequency...

Any thoughts?

sentences:
jQuery - div border around map area Let's say I have this map:

<map name="diffmap1" id="diffmap1" class="myMap">
<area shape="poly" coords="152,347,253,292,264,307,167,358" class="diff diff1">
<area shape="poly" coords="93,244,164,215,171,233,97,264" class="diff diff2">
</map>

and javascript:

$('.diff').click(function(e){
//code here
});

How can I make when I click on one one 'diff' to make a div with border appear around that 'diff'?

It has to calculate the position automatically, like the margin-top, margin-left and size based on the coordonates.

Any thoughts?

sentences:
Why is the origin in computer graphics coordinates at the top left? From what I've seen almost all things use coordinates where (0, 0) is at the top left and the positive Y-axis goes in the downwards direction of your screen.

Why is it like this? Why not the conventional positive Y-axis going upwards like shown in graphs in simple math classes?

sentences:
How does Apple use App Store image banners? I am about to publish my very first iOS game and was reading the Apple iTunes Connect guide (pages 237 till page 240). I understand that they require a PSD file of dimension 3200x600 pixels. I also understand that this image will be cropped in order to fit the desktop, iPad and iPhone store aras, along with a "minimal view" version.

How, what I don't understand is:

Do they ever scale the image? I've never seen a high resolution banner in the iPhone Editor's choice images. The iPhone specs are about 640x960 or 640x1136 pixels and the width of the iPhone image area in the guide seems much higher, so that's why I assume the rescale it.
How do they obtain the "Extreme Skater" 150px300px image on the left, below? Is that simply the title rescaled on a portion of the background? There is no mention of how they do this in the guide.

I imagine that the one on the right is the one obtained from the iPhone area of the editor's choice banner creation guideline, but haven't found any specs on how to obtain the other image.

How does the Apple measuraments relate to the view I can see here (it is taken from an iPod touch 4th generation with retina display and measured using the rectangle selection on the Mac OS X Preview tool)

sentences:
Tell Unity to use a certain LayerMask to raise or not OnDrop (for a class that implements IDropHandler) I am trying to make a draggable GameObject that can be dropped within a container but when i'm releasing the mouse button even though the mouse is over the container (and the dragged object too) OnDrop isn't raised on my container. To make it work i must pick the dragged GameObject right at its edge so that the mouse is over the container but not the draggable when i release the mouse button

According to what I've seen drag and drop handled by unity is based on Raycasts and Raycasts could be configured to ignore objects that are in certain Layers thanks to a LayerMask the problem is that i wasn't able to find anything to apply a LayerMask

Is there a way to do this or any workaround that could let the drop target know that a dragged was dropped on him?

sentences:
SpriteSheets with XML and without XML I'm very new to game development, and I'm working with Godot engine.
I'm making a platform game and I downloaded a package from the web with assets, it contained some sheets.
I have used a 2D atlas importer in Godot before bt it requires a .json file which contains the coordinates.
The sprite sheet i downloaded does not have a xml or json.
How can i get sperate images from that sheet? Or any work around to make a tiled map in Godot?

sentences:
How can I avoid a delay with continues touch detection in swift? I want control a character on my screen with a continuous swipe gesture. As soon as I do a swipe +x or -x my character moves left or right. And as long as I hold my finger it continuous to move to the direction in that I swiped. When I swipe into the opposite direction of my last swipe without leaving my finger from the touch ground, my character should move into this direction. When I release my finger from the touch screen, my character should stops instantly.

My problem is that there is often a small delay within the change of direction. And this delay makes it less precise.

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    /* Called when a touch begins */
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        lastFingerPosition = location

    }
}

override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent){
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        if(location.x > lastFingerPosition?.x && lastMoveDirection != "right"){
            movePlayer("right")
        } else if(location.x < lastFingerPosition?.x && lastMoveDirection != "left"){
            movePlayer("left")
        }
    }
}

//@Todo: Wenn man touchMoved und nicht über dem Button hoch geht, wird die Action nicht aufgehoben
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
    var player = self.childNodeWithName("man")

    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)
        let touchedNode = self.nodeAtPoint(location)

        player?.removeAllActions()
        lastMoveDirection = ""
    }
}

func movePlayer(direction: String) {
    var player = self.childNodeWithName("man")

    if(lastMoveDirection != direction){
        player?.removeAllActions()
        lastMoveDirection = direction

        var duration:CGFloat? = 0
        var x = player?.position.x
        duration = x!

        if(direction == "left"){
            var xDestination:CGFloat = 10
            var run = SKAction.moveToX(10, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveLeft")
        } else if(direction == "right") {
            duration = self.frame.width - x!
            var xDestination = frame.size.width - 1
            var run = SKAction.moveToX(xDestination, duration: NSTimeInterval(Double(duration! / runSpeed)))
            player?.runAction(run, withKey: "moveRight")
        }
    }
}

sentences: What makes a good jump scare? I am working on a game and would like to include a few jump scares. So here is a rather simple question — What makes a good jump scare and when and how should they happen?

sentences:
Inheritance vs Composition I make my money in C# Generally in that language I like to decouple everything to the high heavens using interfaces. This has served me well in enterprise code but in writing games in C# I find myself tending towards inheritance due to being able to define some default behaviors for base classes. I feel dirty doing this though, like I'm disobeying some architecture god who once said "favor composition over inheritance". I know its not black and white but I also feel like i could use interfaces with a bit more work and achieve roughly the same thing.

What do other people do? Is inheritance the right approach for games or should I refactor in some interfaces?

sentences:
Render ModelContent directly Say I have a set of .fbx files which contain all my bones, meshes and animations. I want to make use of these in the finished application i.e. rather than converting them all to .xnb I just want to load the .fbx files at runtime. I've got AssImp importing them, MonoGame.Framework.Content.Pipeline processing them, but now I have a ModelContent object which is not usable as a Model (unless I'm missing something obvious).

Can I convert these to Model without passing them to a ContentWriter/ContentReader?

sentences:
self extending factory: return type and serialization I'm trying to implement a better management for the objects in my game project.
With input from another thread here on S.O., I decided to implement different collections for different types for better access. Seems to be a common way. So far I #included all the class files and added containers (just maps right now) for each type I needed/wanted, as well as functions to create/add/remove etc., that take care of what is needed. That way no free objects exist (object's constructors are private) that could be missed somewhere.
But ofc that means for every new type the container/manager/factory needs to be modified and that's error prone. So I wanted to try and make it self extending with a registration like this:
template<typename ObjectType>
class Registration
{
    public:
        Registration(const std::string& typeID)
        {
            EntMan::getInstance()->registerTypeCreator(typeID, [] (Properties* props)->Entity* {return new ObjectType(props); } );
        }
};

saving it in a std::map<std::string, std::function<Entity*(Properties* props)> >. This works, ofc it's a common pattern, but has especially one flaw: the return type.
I could add as much additional containers, defined by tags for example, as I want (shurely helps with iteration/preselection), but the contained items would always be just base class pointers.
So if I get an item I still would need to dynamic_cast (or static_cast with if(object->getType == "someThing") ) it to the derived type to get full derived access to the object. Seems wasteful and error prone.
Integrating all functionality with virtual functions would solve this, but in the end turns the base in a kind of blob class. Doesn't feel right either.
Let alone the fact that it would also be also pretty horrible for data locality. Not my main concern right now, but maybe will be in the future.
I'm a bit uneasy with the Properties "parameter amalgamation"-workaround aswell, to fullfill the std::function criteria of having the same signature, as it's a bit error prone doing it "by hand" for example, but should be less of a problem once it's abstracted away with parsing those as prefabs from files and
accessing those. Still, it also would mean a lot of wasted space to save those as prefabs...
So I'm at my wits end here.
How could I go on from here, if I need...

different collections for different types (for preselection)
acessors delivering the proper derived types (for avoiding casts and blobs)
self extending, no modification needed just for adding types
serializable use (ie: create("stone") for use with parsing functions of xml data etc. )

Can this be done? Or is this a dead end? No good idea at all?
Thanks in advance for any help.

sentences:
User generated content: a basic yet simple to use OR a complex yet powerful solution? As stated above, which solution is better for a game based on user generated content?

The simple solution (in-game editor) is great for gamers without experience in coding and etc. In this way every player could populate the game with content. But the content would be very limited.
The complex solution would allow the content to be with almost no limitation but casual gamers probably couldn't make hardly any content at all.

If both solutions are used, the quality behind the second solution would be more valuable than the first solution's quantity.

However, making a powerful in-game editor could even take more time and manpower than the actual game and every gamer would have to learn how to use the new complex tool, understand it, and master it if he or she wants to make quality content.

You would be able to make levels and objects for it as well as the  player model itself.

sentences:
Box2D: Efficient method to create b2Chainshapes for a tile-based map? I'm working on a platforming game with tile based levels. I store the collision model for my tileset in an array.

This is how the collision model for a 4x4 tilesheet would look like (I can't post pictures yet so this link will have to suffice: Tileset example). The red dots are the vertices of the b2ChainShape.

When I load a level, I look up the collision model for each tile and create a b2Body at the corresponding place. The problem is that between the tiles, my character can experience a "bump" because it gets stuck on the edge of the shape of the next tile's body.

Is there an existing algorithm to connect the bodies of neighbouring tiles to a single b2ChainShape? Or should I ditch the idea of tile-based collision models all together and simply create the collision model for the whole map with the Tiled map editor? I don't create the the collision map with the Tiled map editor at the moment, because it is very time consuming for slopes and hills.

sentences:
How do you repeat 2D tiles in Java code when you go out of range? I am looking up tutorials on how to make 2D games, and I can just copy and paste their code but I would rather know what it means and how to do it.

Suppose you have a 2D game window that has a map width of 64, how do you actually repeat the tiles when you go out of range when scrolling?

In this render method what line of code is actually allowing the game to repeat the tiles when you go out of range?

From the below code this line stands out to me:

int tileIndex = (xTile &(MAP_WIDTH_MASK)) + (yTile &(MAP_WIDTH_MASK))* MAP_WIDTH;

As this line gives you the X and Y coordinates of which tile you are on, it seems like the bitwise & operator is repeating the tiles, please correct me if I am wrong and also explain to me what the & operator is doing?

Code Example:

 public static final int MAP_WIDTH= 64;
 public static final int MAP_WIDTH_MASK= MAP_WIDTH - 1;
 public static final int PIXEL_SIZE= 8;
 public static final int PIXEL_SIZE_MASK= MAP_WIDTH - 1;
 public int[] tiles = new int[MAP_WIDTH*MAP_WIDTH];
 public int[] colours = new int[MAP_WIDTH*MAP_WIDTH*4];
 public int xOffset = 0;
 public int yOffset = 0;

 public void render(int[] pixels, int offset, int row) {
        for(int yTile = (0 + yOffset) >> 3; yTile<=(height + yOffset) >> 3; yTile++) {
            int yMin = (yTile * PIXEL_SIZE) - yOffset;
            int yMax = yMin + PIXEL_SIZE;
            if (yMin<0) yMin=0;
            if (yMax>height) yMax = height;
            for(int xTile = (0 + xOffset) >> 3; xTile<=(width + xOffset) >> 3; xTile++) {
                int xMin = (xTile * PIXEL_SIZE) - xOffset;
                int xMax = xMin + PIXEL_SIZE;
                if(xMin<0) xMin=0;
                if (xMax>width) xMax = width;
                int tileIndex = (xTile &(MAP_WIDTH_MASK)) + (yTile &(MAP_WIDTH_MASK))* MAP_WIDTH;
                for (int y = yMin; y < yMax; y++){
                    int sheetPixel = ((y + yOffset) & PIXEL_SIZE_MASK)*sheet.width + ((xMin + xOffset)& PIXEL_SIZE_MASK);
                    int tilePixel = offset + xMin + y * row;
                    for(int x = xMin; x< xMax; x++) {
                        int colour = tileIndex * 4 + sheet.pixels[sheetPixel++];
                        pixels[tilePixel++] = colours[colour];
                    }
                }
            }
        }
```

sentences:
i need suggestion animation technique for 3d? firstly you need to now i am beginner :)

i am using opengl and for display vertex buffer object(vbo).

i made 2000 frames animation model with blender and i export with (.obj) files and i upload all these 2000 obj files to my opengl project.

But upload process is taking too much time. like 7-8min and this method use too much vram around 2-3gb.

Despite all this i'm glad draw performance because when i draw 100 animation(same model) at the same time my pc using %1-2 cpu and %70-80gpu.

Now i want to learn is there another method of good draw performance and low system consumption ? (i want to draw 100 and much more animation model at the same time)

sentences:
Making a parenting system Each Entity can have one parent and any number of children. They have a position vector and a quaternion orientation.

I know that I can make objects look like they're in a hierarchy by multiplying parent transforms all the way to the root, but how to I get the canonical coordinates out of those transformations? I need to have the real position of every Entity in the world in order to update their bounding meshes.

I would like to keep my drawing code for everything as just this:

XMMATRIX transform = XMMatrixRotationQuaternion(orientation);
transform = XMMatrixMultiply(transform, XMMatrixTranslation(position));
transform = XMMatrixMultiply(world, transform);
model->Draw(context, *states, transform, view, projection);

Eg. without relying on visual tricks to get the hierarchy looking right, so no multiplications with parent transforms while rendering.

How do I properly change a child's position and orientation with respect to the parent?

sentences: DirectX 9.0c Lights? I'm still learning DirectX from a book. It says that a graphiccards can only handle 15 lights. I'm just a bit confused , there are a lot of games using more lights, or are this just some alpha blending  tricks or what ever?

sentences:
HTML5 without a framework I am looking to get into game development, after a lot of searching I have decided to try with html5 and, while I can see the advantages of frameworks, I would like to learn the basics without a "crutch".

Is it realistic to even try and start learning game development without using a framework? Also, if I decide to use one, what should I consider when deciding on one?

sentences:
How to Check and Destroy "linked" gems quickly efficiently Engine: Gamemaker Studio

(simplified) Situation: I have a 6x6 board (at this moment) stored in a 2D matrix, a mechanism for linking adjacent squares, similar to Puzzlecraft, and a button that confirms the link - adding the resources, and destroying the instances of the squares, then moving existing squares and generating new ones.

Question: Is there a way to instantly go through the linked squares, and not just check for any instances marked as linked = true.

Efficiency is in all likelihood not a true concern, especially on this tiny scale, but I'd like to know for the sake of self-improvement more than anything.

Idea for Solving it: I've thought of a way that may be fairly lightweight and quick, I don't know if it is though:

Once a square is added to the link, put the square's position in the matrix in a separate array (one which has 36 slots, in case the entire board is linked). Then once the button to confirm is pressed, it goes up from the bottom of the array, until it reaches a null or -1 value - destroying and setting the value of this array at the appropriate position to null or -1.

Question on the idea: Would this work? How would I store the square's position in the matrix in this array? Would I need to make the array 2D so that it can hold both the x and y position of the square [ie. 0 to 5]?

sentences:
SailsJS + Rotational direction coordinates calculation issue I'm creating a small game to learn how NodeJS & Sails work (and by extension Waterline, Socket.io, Express, and all their components).

I'm using websockets to make the server calculate the coordinates. Everything is handled server-side.
The client only receives serialized data in order to redraw the whole canvas.

For debugging purposes, I decided not to redraw but simply "draw" (leaving the old canvas visible) to show you the result.

See below for situation, issue and code.

The issue

I'm having trouble when calculating coordinates.

What I need is a simple forward/backwards system, and when pressing left or right keys, change the direction angle so the character can move in the canvas.

Kinda like the good'ol Asteroids retro games.

The issue is the following:

The drawn loops you see shouldn't exist. In fact, they should be circles. I drew this by simply pressing either up or down key, combined with one of left or right keys.

I think there is an issue in the calculation system...

This shouldn't be a performance issue because each tick occurs at the same interval, so even if it was a performance issue, it should only be related to delay when redrawing the canvas, not such an offset in coordinates calculation...

Any idea ?

Info about code api

moves contains a javascript object like this:
{ left:false, right: false, up: false, down:  false }
It is used to check whether the user is "pressing" associated arrow keys.
It is updated each time there is a keyUp or keyDown event client-side.
user.pick contains the "physical object" to be rendered in the canvas, which contain x, y coordinates, and information about movement speed and rotation speed.

Here's the code that handles the coordinates calculation.

// Change angle if "left" or "right" is pushed
if (moves.left || moves.right) {
    // let PI2 = 2 * PI;
    let angle = user.pick.angle;

    if (moves.left) {
        angle += user.pick.angleSpeed;
    } else if (moves.right) {
        angle -= user.pick.angleSpeed;
    }

    // Use this to avoid having huge integers to manage
    if (angle < 0) {
        angle = 360 - angle;
    }
    if (angle > 360) {
        angle = angle - 360;
    }

    user.pick.angle = parseInt(angle);
}

// Up and down allow us to move either forwards or backwards.
if (moves.up || moves.down) {

    let moveRatio = moves.up ? 1 : -1;

    let angleRadians = user.pick.angle * (PI / 180);
    let x = user.pick.x + moveRatio * user.pick.speed * Math.sin(angleRadians);
    let y = user.pick.y + moveRatio * user.pick.speed * Math.cos(angleRadians);

    // Avoids collisions with canvas walls
    if (x > 0 && x < user.map.width) {
        user.pick.x = parseInt(x);
    }
    if (y > 0 && y < user.map.height) {
        user.pick.y = parseInt(y);
    }
}

sentences:
Projecting Coordinates from one Space into another, but with "twisting" i'm trying to generate a decal mesh kinda like this: http://blog.wolfire.com/2009/06/how-to-project-decals/

but instead of projecting the decal with a box, i need to project it with a sort of triangular space. the "decal space" will have a start triangle and an end triangle. the end triangle isn't necessarily the same size as the start triangle and it isn't necessarily parallel to it and it can be rotated.

i need to be able to transform coordinates into that space and back out. how can i do that? can you do that with a normal 4x4 matrix?

sentences:
optimal pixel-read back strategy I need to render certain scenes and read the whole image back in main memory for further processing which is not suitable for rewriting into shaders of CUDA, and saving to disk. I've search for this and it seems that most video cards will accelerate the rendering but the read-back will be very slow. After a bit of research i only found this card mentioning "Hardware-Accelerated Pixel Read-Back"

The other approach would do software rendering and the read-back problem doesn't exist, but then the rendering performance will be bad.

Likely, i will have to implement both in order to be able to find the optimal trade-off, but my question is about what other alternative can i have hardware-wise; i understand Quadro is for modelling and designer market segment, which is precisely the client target of this application, Does this means that i'm not likely to find better pixel read-back performance in other video card lines? i.e: Tesla or Fermi, which don't even have video outputs btw

sentences: How do I make a 2D sprite flash green when tapped? I have a sprite that is based on an image of a gray circle. When the user touches the sprite, I want the sprite to flash green, as in I want the circle to appear to turn green for 0.2 seconds. I tried setting the color of the sprite via SpriteRenderer's function SetColor, and it blended the color with the initial gray color of the sprite, so I got a very dark green even though I'm really sure I didn't mess up the values when I created the color. Now I'm trying to get my flashing effect by using separate images. I have the images I need, and I have a message getting logged when I tap the circle, I just need to setup a non-looping animation and trigger that animation in my code.

sentences:
Torque applies to one wheel, but inconsistently to the other wheel I have a GameScript class which is derived by another class WheelScript; it is meant to apply torque to a rigidbody in different directions depending upon the key pressed.

However the result to this is that one of the rigidbodies rotates fine but the other one doesn't (say the right wheel rotates but the left doesn't turn or even if it does, it doesn't move with the same angular velocity as the first one)

Base class:

public class GameScript : MonoBehaviour
{
    public static GameScript instance;
    protected float Force;

    protected virtual void  Print(GameObject gameObject) {
        print(gameObject.name);
    }

    protected virtual void MoveForward(Rigidbody rigidBody, int identifier) {
        if(identifier == 1)
        {
            rigidBody.AddRelativeTorque(-Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }

    protected virtual void MoveLeft(Rigidbody rigidBody, int identifier) {
        if (identifier == 1)
        {
            rigidBody.AddRelativeTorque(-Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }

    protected virtual void MoveRight(Rigidbody rigidBody, int identifier) {
        if (identifier == 1)
        {
            rigidBody.AddRelativeTorque(Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }

    protected virtual void MoveBack(Rigidbody rigidBody, int identifier) {
        if (identifier == 1)
        {
            rigidBody.AddRelativeTorque(-Vector3.forward * Force);
        }
        else
        {
            rigidBody.AddRelativeForce(-Vector3.forward * Force);
        }
    }
}

Child class:

public class WheelScript : GameScript
{
    [SerializeField] private int identifier;
    Rigidbody body;
    [SerializeField] float force;

    private void Start()
    {
         body = GetComponent<Rigidbody>();
         Force = force;
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.W))
        {
            MoveForward(body, identifier);
        }
        else if (Input.GetKey(KeyCode.A))
        {
            MoveLeft(body, identifier);
        }
        else if (Input.GetKey(KeyCode.D))
        {
            MoveRight(body, identifier);
        }
        else if (Input.GetKey(KeyCode.S))
        {
            MoveBack(body, identifier);
        }
    }
}

and similarly for the other wheel with only difference being that of axis as its axis is (0,0,-1)

Hinge Joint for left wheel is visible in this picture

Hinge Joint for right wheel is visible here in this picture

This is how each wheel is aligned

Hinges are attached to the pivot in the opposite direction as marked in the circle

Also I think I forgot to mention but the WheelScript is attached to both the wheels (it is the script component for both wheels)

sentences:
Attach the UIButton to Component Via Script (C# Unity) I want to attach the UI to the MC_Streaming Option Script via Code .

What i wanted here is that this live_onOff will go to the Livestream(MC_Streaming Option) without dragging it . And i don't know where to start.

PS: The MC_Streaming Option script is being attached only when the program run

MC_StreamingOption mcStreamingOption = gameObject.AddComponent<MC_StreamingOption>();

sentences:
Deleting/Cleaning Screen-Objects with all child-objects in libGDX For my game, Im using

libGDX
Ashley (ECS)
Box2D

Ive got a lot of screens but for simplification: MainMenuScreen and InGameScreen.

In InGameScreen Im init the ECS (Ashley) and create a lot of entities. Some have PhysicsComponent. The PhysicsSystem will catch them and call Box2D to spawn some objects based on the parameters within the PhysicsComponents.

So far so good.

Now, when the player dyes, I run setScreen(new MainMenuScreen()); from my "Main"-Class (MyGame.java).

the game starts and MyGame loading at first the MainMenuScreen
than the InGameScreen will get loaded (when player presses a key)
than the player dyes
MyGame recognized it and loading again (throu calling setScreen(...)) the MainMenuScreen
When Player press key: MyGame loading another round (setScreen(new InGameScreen))

I guess I have to do something like a complete clean up between switching screens. But how should I implement this? Just "deleting" the old InGameScreen-Object shouldent be enought, right?

Do I have to use the dispose()-Method?
Is it enough to instantiate everything new (in the init from InGameScreen) since it will instantiate all child-object new for its own like Box2DWorld world = new World();

sentences:
Android Dynamic 2D Map My problem is, I want to create a 2D tiled map. Yes, I know it's been asked a lot. I've seen answers that propose the use of tiled however it only allows (or so it seems to me) to generate static maps that do not change once generated. And I need a large empty uniform space of empty tiles, upon which players may place various buildings (some spanning more than one tile and logically being the same one).

How to approach this in Android? Do I make some kind of TableLayout, use arbitrarly large amount of rows and imageviews (with my emptyTile), than somehow work event-based changing of image ids from there? I'd think that only a portion of that map should be visible at a time, but I don't see how scrolling around could be the part of that structure.

sentences: OpenGL - texture releasing If I call glDeleteTextures, will it release memory immediately? And what is the performance? I know that glGenTexture is quite cheap, because it only alocated id, but I have nor found anything about deleting.

sentences:
How can I determine if an object hit the top of a tile rectangle in MonoGame? I've been implementing an AI system in my 2D game using MonoGame.

In some situations when a collision between two objects occurs, I need the NPC to move in different directions depending on the direction of the collision. With the simple Rectangle.Intersects method I can't handle this, because it only detects if two rectangles intersect and doesn't tell me how they intersect.

Basically I need to know if the top of the NPC rectangle collides with the bottom of a tile rectangle, and so on.

This question talks about something similar but I don't think there is CollisionDetection2D.BoundingRectangle in MonoGame.

sentences:
Since Table.drawDebug is deprecated in libGDX, what should I use instead? I am following the "Learning LibGDX Game Development" book to make a simple game. I am in the menu creation section where we create a stage and render it with debug borders.

The book says to use Table.drawDebug(stage) but this static method seems to have been removed from the frameworks Table class entirely.

I am importing com.badlogic.gdx.scenes.scene2d.ui.Table; below is my code:

@Override
public void render(float deltaTime) {
    Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if (debugEnabled) {
        debugRebuildStage -= deltaTime;
        if (debugRebuildStage <= 0) {
            debugRebuildStage = DEBUG_REBUILD_INTERVAL;
            rebuildStage();
        }
    }
    stage.act(deltaTime);
    stage.draw();

    Table.drawDebug(stage);
}

The last line, Table.drawDebug(stage); has the compilation error "The method drawDebug(ShapeRenderer) in the type Table is not applicable for the arguments (Stage)"

Is there a new way to draw the stage in debug mode?

sentences:
When do I save the buffer data to the database? My entire game is server side and I use nodejs with mysql.

When players connect or join a game, their player data (Items, Stash, Quests, etc) all get stored into the memory buffer.

For example, if a player joins a game and there are 40 items on the floor and he decides to pick them all up, it's easier just to add that to their Inventory object instead of using a insert statement each time. Then, when that user disconnects I can save all that data respectively. (Now that I think of it, that query would run 40 insertion rows..)

That's the problem I have though, do I save the data during the looting process or wait until the player disconnects and run a db update to save their memory buffer (only the changed buffer) to the database?

The Issue I have with that is, if a player picks up over 40 items in the game, that's going to be a lot of sql insertions when they disconnect..

Imagine them finding a ton of items from mobs and having a huge amount of new updated buffer data that needs to be stored.. (after they disconnect), that would be a dreadful update. Especially if they stored hundreds of items in their stash or whatnot. Hmmm.

sentences:
Is Batching Geometry Every Frame Always Slower Than Individual Draw Calls I'm currently have an application that has ~10k draw calls.  I implemented a batching scheme where I group all objects that share material, vertex format, etc and pre-transform them by their world matrices and put all those objects in one vertex buffer / index buffer, and then draw them with DrawIndexedPrimitive (I do this every frame, since some objects might have moved / changed material etc).  However, this method is always slower than if I just had multiple draw calls.  Using VTune, it seems most of my time is spent computing the transformed vertices and copying the vertex/index data into the buffers.

My question is: Is this expected?  Do systems that perform batching typically cache the batched data or are there some that get away with batching every frame like I am attempting to do (and if so, are there any tips for what I might be doing poorly)?

My application is in DirectX 9, but I'm curious about solutions in other platforms as well (OpenGL or DirectX 11).

sentences:
Should entities store other other entities that they spawned? How should a game entity add another game entity to the game world?

For example, an entity shooting a missile (which is another entity), means the new Missile will need to be added to the entities list in the GameWorld class (so that the next game-loop iteration it will be drawn, moved, etc).

I can think of two approaches:

Approach 1

The entity adds a new Missile to the GameWorld:

class SpaceShip extends Entity{
    // .. stuff omitted
    void shoot(){
        GameWorld.getInstance().add(new Missile(x,y));
    }
}

Approach 2

Have the GameWorld query it's entities every gameloop iteration for their 'stored entities'. For example (pseudocode):

class SpaceShip extends Entity{
    // .. stuff omitted
    List<Missile> missiles;
    void shoot(){
        missiles.add(new Missile(x,y));
    }
}

class MineCreatorThing extends Entity{
    // .. stuff omitted
    List<Mine> mines;
    void putMine(){
        mines.add(new Mine(x,y));
    }
}

class GameWorld{
    // .. stuff omitted
    void gameloop(){
        while(true){
            // .. more stuff omitted
            foreach entity in entities{
                if(entity instanceof MineCreatorThing)
                    foreach mine in entity.getMines() entities.add(mine);
                if(entity instanceof SpaceShip)
                    foreach missile in entity.getMissiles() entities.add(missile);
            }
        }
    }
}

Which approach should I pick?

sentences: Godot play video after file load I used WebM video in my game but it's lagging. The audio is few secs delayed then video. Is there any way to load the video first then play so that the lagging doesn't occurs

sentences:
XNA game loop Update and Draw I'm confused on how the game's methods are called and when.

So I read that the sequence is:

Initialize
LoadContent
Update
Draw
UnloadContent

Where 3 and 4 are the game loop, so after Update is called, Draw is called, then Update, then Draw, and so on. The game loop (Update and Draw) is executed 60 times per second.

Then I read in another place that Update and Draw can be invoked at different times and Update may be called more then one time before Draw and so on.

... and at the end UnloadContent is invoked after the Update if the Exit method is called.

sentences:
Why does the object spawns only on client? In my game I have an object, let say food, that whoever consumes it, that player will spawn one more element. I am checking collision in Update.
The following code is working fine on server side, but the object is not spawning. Although, it is spawning on local client but it is not updating on server.
Here is my code:
// This function is called on Update
private void CheckForFood(Vector3 snakePartPosToBeInitialize,Vector3 headPos)
{
    if(_food != null)
    {
        if (_food.transform.position == headPos)
        {
            UiControllerCS.UI.showScore();
            GameObject obj = Instantiate(snakePart, snakePartPosToBeInitialize, Quaternion.identity) as GameObject;
            currPartOfSnake += 1;
            obj.name = "" + currPartOfSnake;
            obj.transform.parent = gameObject.transform;
            tail.Add(obj);
            NetworkServer.SpawnWithClientAuthority(obj , connectionToClient);
        }
    }
}

I am getting the following error :

SpawnObject for 1 (UnityEngine.GameObject), NetworkServer is not active. Cannot spawn objects without an active server.

sentences:
Animated light effects in games I have been wondering now for quite some time, how certain animated texture effects are done, specifically involving light effects.

Some good examples of what I mean are the green bridges in Darkspore, who have a pulsating light effect (pic), the light bridges in Portal or some spell effects from Oblivion (pic).

Are those effects purely done with shaders? And if so, how would you go about doing them? If I for example wished to create an effect, which would send little lightning bolts from a character models feet to the top as illustration that he got electrocuted, how would that work?

To my person:
Although I am proficient in programming, I am mostly a beginner, when it comes to shaders. I understand most of the math behind it, but have almost no practical experience with them.

I hope you can clear things up for me a bit!

Thanks you for reading and in advance for any help!
Christoph

sentences:
How to edit and persist serializable Assets in the Editor Window? I have an asset saved in my project which represents a serializable scriptable object.
Code of the object is very simple:

using UnityEngine;
using System.Collections;

public class TestScriptable : ScriptableObject {
    public float gravity = .3f;
    public float plinkingDelay = .1f;
    public float storedExecutionDelay = .3f;
}

There is no problem changing values for this object in the inspector, and the changes do persist and survive after exiting → entering Unity.

I am trying to mimic the inspector behavior in an Editor Window. But any changes I do in the Editor Window, though reflected in the Inspector, do not persist.
Here is my two scripts which lay inside the Editor folder:

the first one (auxiliary) - this script replaces inspector fields (see image above) with button, which calls my custom EditorWindow.

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(TestScriptable))]
public class TestScriptableEditor : Editor {
  public override void OnInspectorGUI() {
    if (GUILayout.Button("Open TestScriptableEditor"))
      TestScriptableEditorWindow.Init();
  }
}

the second (with my problem) - script, where I'm trying to change my asset values:

using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class TestScriptableEditorWindow : EditorWindow {
    public static TestScriptableEditorWindow testScriptableEditorWindow;
    private TestScriptable testScriptable;

    [MenuItem("Window/TestTaskIceCat/TestScriptableEditor")]
    public static void Init() {
        // initialize window, show it, set the properties
        testScriptableEditorWindow = GetWindow<TestScriptableEditorWindow>(false, "TestScriptableEditorWindow", true);
        testScriptableEditorWindow.Show();
        testScriptableEditorWindow.Populate();
    }

    // initialization of my troubled asset
    void Populate() {
        Object[] selection = Selection.GetFiltered(typeof(TestScriptable), SelectionMode.Assets);
        if (selection.Length > 0) {
            if (selection[0] == null)
                return;

            testScriptable = (TestScriptable)selection[0];
        }
    }

    public void OnGUI() {
        if (testScriptable == null) {
            /* certain actions if my asset is null */
            return;
        }

        // Here is my tries to change values
        testScriptable.gravity = EditorGUILayout.FloatField("Gravity:", testScriptable.gravity);
        testScriptable.plinkingDelay = EditorGUILayout.FloatField("Plinking Delay:", testScriptable.plinkingDelay);
        testScriptable.storedExecutionDelay = EditorGUILayout.FloatField("Stored Execution Delay:", testScriptable.storedExecutionDelay);
        // End of the region of change values
    }

    void OnSelectionChange() { Populate(); Repaint(); }
    void OnEnable() { Populate(); }
    void OnFocus() { Populate(); }

}

My questions is: what am I doing wrong? What could be the problem? How to fix it?  Am I loading the asset wrongly in the Editor Window? Or what?
Any help/ideas would be appreciated.

sentences:
"Overloading" GameObject? I would like to show weapons and health items in an inventory grid.

The item can be rotated in the grid, and it occupies a certain region in the grid.

Currently I store this information (where the item is located, if it is rotated, etc.) in an additional array. However, this is not elegant and error prone.

I would therefore like to ask if it is possible to somehow store this additional information directly in the weapon or health GameObject.

Ideally I would like to be able to do something like this:

Pistol.GridProps.Rotation = 90
Pistol.GridProps.Row = 5
Pistol.GridProps.Col = 3

Is it possible to add something like "GridProps" to all my game objects?

Thank you!

sentences:
alpha test shader 'discard' operation not working - GLES2 I wrote this shader to illustare alpha test action in GLES2 (Galaxy S6).
I think is not working at all cause I don't see any change with or without it.
Is there anything Im missing?
Any syntax error?
I know its better not using if in shader but for now this is the solution I need.

precision highp float;
precision highp int;
precision lowp sampler2D;
precision lowp samplerCube;

        //0 - CMPF_ALWAYS_FAIL,
        //1 - CMPF_ALWAYS_PASS,
        //2 - CMPF_LESS,
        //3 - CMPF_LESS_EQUAL,
        //4 - CMPF_EQUAL,
        //5 - CMPF_NOT_EQUAL,
        //6 - CMPF_GREATER_EQUAL,
        //7 - CMPF_GREATER

        bool Is_Alpha_Pass(int func,float alphaRef, float alphaValue)
        {
            bool result = true;
            if (func==0)
            {
                result = false;
                break;
            }

            if (func==1)
            {
                result = true;
                break;
            }
            if (func==2)
            {
                result = alphaValue < alphaRef;
                break;
            }
            if (func==3)
            {
                result = alphaValue <= alphaRef;
                break;
            }
            if (func==4)
            {
                result = alphaValue == alphaRef;
                break;
            }
            if (func==5)
            {
                result = alphaValue != alphaRef;
                break;
            }
            if (func==6)
            {
                result = alphaValue >= alphaRef;
                break;
            }
            if (func==7)
            {
                result = alphaValue > alphaRef;
                break;
            }
            return result;
        }

void FFP_Alpha_Test(in float func, in float alphaRef, in vec4 texel)
{
    if (!Is_Alpha_Pass(int(func), alphaRef, texel.a))
        discard;

}

sentences:
Do glColorMask and glDrawBuffer accomplish the same thing? I'm doing a shadowmap pass (only storing depth values) so I set glDrawBuffer(GL_NONE) to disable color writing for the moment.

Yet, I see some tutorials also do glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE). Is this really necessary, given glDrawBuffer(GL_NONE)? Don't they accomplish the same thing?

sentences:
Why is my image speed not changing? Following is my code for my platformer. However, in the //Run with left shift// section when I made the image speed change, the speed is still the same and doesn't change so is there any piece of code that is preventing this task?

///Get player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);
key_jump_held = keyboard_check(vk_space);
key_shoot = keyboard_check(ord("D"));

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x, y+1, Obj_Floor))
{
 vsp = key_jump * -jumpspeed;
}

if (vsp < 0) && (!key_jump_held) vsp = max(vsp,0)

//Run with left shift
if (keyboard_check(vk_lshift))
{
 movespeed = 5;
 image_speed = 0.14;
}

if (keyboard_check_released(vk_lshift))
{
 movespeed = 3;
 image_speed = 0.025;
}

//Shooting direction
if (keyboard_check(vk_right))
{
 mpfacing = 0;
}

if (keyboard_check(vk_left))
{
 mpfacing = 180;
}

//Shooting
if (keyboard_check(ord("D"))) && (canshoot = true)
{
 instance_create(x+13, y-0.5, Obj_MP_Laser);
 canshoot = false;
 alarm[1] = 30;
}

//Horizontal Collision
if (place_meeting(x+hsp, y, Obj_Floor))
{
 while(!place_meeting(x+sign(hsp), y, Obj_Floor))
 {
  x += sign(hsp);
 }
 hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x, y+vsp, Obj_Floor))
{
 while(!place_meeting(x, y+sign(vsp), Obj_Floor))
 {
  y += sign(vsp);
 }
 vsp = 0;
}
y += vsp;

//Animate
if (move != 0)
{
 image_xscale = move;
}

if (place_meeting(x, y+1, Obj_Floor))
{

 if (move != 0)
 {
  sprite_index = CalvinWalking;
  image_speed = 0.05;
 }

 else
 {
  sprite_index = CalvinStanding;
  image_speed = 0.025;
 }
}

else
{
 if (vsp < 0) sprite_index = CalvinJumping
 else sprite_index = CalvinJumping
}

sentences:
Shop and Inventory System I'm creating a JavaScript game, and I'm getting stuck. When the player obtains X amount of gold, a middle column appears (you've unlocked the shop, yay!), and when you obtain more gold than an item costs, it will appear (except special conditions where it requires more than just gold of course).

Right now, I'm stuck on the base foundation of the system, and I would like to hear some suggestions before I move on.

function _shop() {
    this.items = [
        {
            effect : function() { engine.player.revive(true); },
            "price" : 100,
            "name" : "Heal"
        }
    ];
}

The shop holds an array of item objects, some will be holdable, some will be instant use (currently working on instant use).

Now, here's how the item is called:

in my elements.js file --

addShopItem : function(gold) {
    console.log(engine.shop.items.length);
    for (var i = 0; i < engine.shop.items.length; i++) {
        if (engine.shop.items[i]["price"] <= gold) {
            document.getElementById("items").innerHTML += "<br />"+engine.shop.items[i].name;
        }
    }
},

Which is called by going raiding (irrelevant, won't post that code, it's going to change to the engine's trigger function with flags based on the item object.

Now my question is:

Is this a good way to handle an dynamic shop system?
What's the best way to link this to a player object? (My initial guess is an object inventory inside the parent?

sentences:
Tetris implementing rotation I am currently at the last stage of the Tetris Clone using SDL library, the only thing left is rotation. For each piece I have a separate class, and in order to move the pieces down I use a method:

void PieceZ::movePieceDown()
{
  drawBlock(x1,y1++);
  drawBlock(x2,y3++);
  drawBlock(x3,y3++);
  drawBlock(x4,y4++);
}

This method is called like that: current->movePieceDown(); where current represents a pointer to the current piece. Now to rotate the piece I have another method:

void PieceZ::rotatePiece()
{
  drawBlock(newX1,newY2++);
  drawBlock(x2,y2);
  drawBlock(newX3,newY3++);
  drawBlock(newX4,newY4++);
}

New X and Y coordinates are calculated elsewhere, with x2 and y2 taken as the origin.
My question is how do I swap current->movePieceDown() with current->rotatePiece() while the piece is moving? Taking into acount that I am handling keyboard events in another method.

sentences:
Authentication for LAN Multiplayer Games I'm working on the authentication scheme for a multiplayer game using only C++ and SLD2.

It's an RPG with a kind of complicated character-group/permadeath scheme, and world-instances are intended to be hosted by the players. So it matters that players have exclusive access to controlling their characters. I want players to be allowed to save the current state of a multiplayer world instance, close it, and come back to it later, or set up their own dedicated world instance for them and their friends to join/quit/rejoin at will. Absent player characters will simply not be present in the world until their creator returns

Servers will be hosted by player-computers. I'm not planning to set this up with a dedicated hole-punching or identity server, so players will just be playing with people who they intentionally connect to. I don't want to deal with encryption, so I'm not planning to require passwords to log in. I figure since there's no formal identity server and no encryption, passwords might do more harm than good. Player character names will change over the course of the game, and I don't necessarily mind if two players have the same username.

Here's my current authentication strategy:

When a player creates an account on his/her game instance, the account will just consist of a username and an automatically generated (random) UUID. The username and UUID will be stored in a SQLite file that the user can copy onto any computer with this game installed, and access their unique account. The username and a naively hashed UUID will be stored in a connection log on every server that the player connects to (so the server can assign them to the right character when they log back in). I recognize this means that programmers who know what they're doing will be able to hack each other's accounts, but I'm not convinced that I should really be concerned about that in the case of this particular game.

Here are my questions:

Is copying the file too much to expect from users who want to switch computers?
Can you guys think of any potential issues with this, other than what I've already pointed out?
Is there a better (common) way to achieve what I'm trying to do?

Thanks!

sentences:
How do I remove specfic OptionData from Dropdown? How would I remove one of the elements from the dropdown? For example, how would I remove Sprites? Here is my code:

public Dropdown researchFeatureDropDown;
researchFeatureDropDown.options.Add(new Dropdown.OptionData("Sprites"));
researchFeatureDropDown.options.Add(new Dropdown.OptionData("Scrolling - 2000"));

sentences:
Voxel terrain collision detection with AABBs I'm working on implementing collision detection on voxel terrain (Like Minecraft) with AABBS.

Right now, I have it so I can tell if a point is within a voxel or not, I do this by having a 2D byte array of active voxels. If a byte at any index is 0, the voxel is air. If its 1, its solid. Right now I'm just testing to see if the voxel at the player's position vector is solid or not.

My problem is, I now wish to implement AABBs to get more precise detection, but I have no idea how to do it without checking if all the voxels within the AABB are solid. That might now be a problem for games like Minecraft, where there would only have to be about 1 extra voxel check, but the voxels in my game are much smaller (The player's dimensions are about 4x10x4), so I would have to check a lot of voxels.

Ive seen one or two other people having a issue similar, but I didn't find the answers they got clear enough, and so I come here asking for your help.

Thanks.

sentences:
Unity Pink Texture On WebGL I'm trying to follow a youtube tutorial for my new game(images puzzle) and by using it's implementation on github to upload it later on facebook.

When I run the game inside unity editor its work without any problem, but when I export the game to exe or WebGL I get pink images background instead of the image am using.

Youtube tutorial link here.
GitHub repository link here.

The game works Fine inside unity

But shows pink images on web browsers and exe games

Why the images are showing pink background?

sentences:
No more OpenGLES 2 UWP template in Visual Studio 2017? In Visual Studio 2015, a convenient cross-platform C++ project template was available named "OpenGLES 2 Application (Android, iOS, Windows Universal)."  I cannot find this template in Visual Studio 2017; only the Android + iOS template is present.

A response to this post on the VS dev community site suggests the template was removed by design.  If so, are there any alternatives I might consider to give a similarly streamlined workflow?

sentences:
What is the difference between a HUD and a GUI in a game? Does anyone know the difference between a graphical HUD (head-up display) and a GUI (graphical user interface) in a game? Is a HUD part of the GUI and just displaying information? That would mean that I can not technically interact with a HUD while I could with the GUI (e.g. clicking a button)? Or are both terms basically describing the same thing?

Note: I'm talking about these words while being ingame.

See the following example:

What would be described as GUI in this image and what as HUD?

sentences:
Opengles 2.0, Replace the black region in the image to make it transparent I have two textures, Source image A and Overlay B, B is drawed on top of A, I want to replace the black color in B, then make the region of A visible, what should I do?

This is my shader language:

 varying highp vec2 textureCoordinate;
 varying highp vec2 textureCoordinate2;
 uniform sampler2D inputImageTexture;
 uniform sampler2D inputImageTexture2;
 void main()
 {
 lowp vec4 base = texture2D(inputImageTexture, textureCoordinate);
 lowp vec4 overlay = texture2D(inputImageTexture2, textureCoordinate2);

 if (overlay.r == 0.0 && overlay.g == 0.0 && overlay.b == 0.0)
 {
     gl_FragColor = base;
 }
 else
 {
     gl_FragColor = overlay;
 }
}

but the result is not right.

This is my overlay

when I mix the source and overlay by using the shader, I got the result like the following, What should I do to make it works right?

sentences:
unable to launch LibGDX Particle Editor.jnlp I am not able to launch LibGDX ParticleEditor.jnlp file on my system(win7 64 bit) with java7.

when I execute this file with javaws.exe in jre7/bin folder, it displays splash screen of badlogic games for jst 2-3 sec but after that it gives an alert having error message "Unable to launch application". And the exception is :

com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: http://libgdx.googlecode.com/svn/jws/gdx-tools.jar
    at com.sun.javaws.security.SigningInfo.getCommonCodeSignersForJar(Unknown Source)
    at com.sun.javaws.security.SigningInfo.check(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
    at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
    at com.sun.javaws.Launcher.launch(Unknown Source)
    at com.sun.javaws.Main.launchApp(Unknown Source)
    at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
    at com.sun.javaws.Main.access$000(Unknown Source)
    at com.sun.javaws.Main$1.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

I've googled this problem,, but still unresolved. Please help me .

sentences:
Making random spawn points fair? If all players are spawned at random positions the same distance from adjacent players, the number of players will be proportional to the likelihood of their spawn positions being unfair.  The closer players spawn to the centre of the map, the more likely they are to encounter other players and the less likely they are to survive, compared with players on the edge of the map.  Assume all players are spawned at the same time.

Is there a way to shape spawn points, or change the map, so that:

All players have a limited number of adjacent foes.
All players have equal chance of encountering adjacent foes.
Map size does not have to increase proportional to the number of players.
These limitations are not enforced with arbitrary impassable spaces.

The answer does not have to be perfect, just obviously better than the alternative.  Out of the box thinking welcome.

sentences:
Import Unity Package Into Specific Folder Everytime i do import custom unity package file, I alwasy get Messy Folder and files in root of Asset Folder.

Any Idea how to solve this ?

Many Thanks in advance...

sentences:
libgdx: SpriteBatch and ShapeRenderer projection wrong I'm using LibGDX and the SpriteBatch and ShapeRenderer are having a perspective problem or something... When I draw something with both (code below), the planet texture is smaller than it should be. I can even manually set the size values and it's still wrong.

I'm setting:

    Matrix4 matrix = cam.combined;
    batch.setProjectionMatrix(matrix);
    sr.setProjectionMatrix(matrix);

and the draw code is...

            // outline
            sr.begin(ShapeRenderer.ShapeType.Filled);
            sr.setColor(Color.BLACK);
            sr.circle(c.getPos().x,c.getPos().y,c.getSize());
            sr.end();

            // planet tex
            batch.begin();
            batch.draw(c.getTexture(), c.getDrawPosition().x, c.getDrawPosition().y, c.getSize(), c.getSize());
            batch.draw(c.getShadow(), c.getDrawPosition().x, c.getDrawPosition().y, c.getSize(), c.getSize());
            batch.end();

Both the texture and the shape are centered properly and c.getSize() should always be returning the same value, so I'm trying to figure out why this isn't working. I've tried manually setting the value for size and it still does it, so either the texture is being rendered at the wrong size or somehow the ShapeRenderer and SpriteBatch are using a different camera/projection.

sentences:
How to split 2 teams for a FPS death match game in Unity? I'm making a playable one level only FPS death match game in Unity. I'm in the part where the AIs now can find and shoot their own target and keep looping to find targets until nothing left. Every AIs and including player were tagged with tag "Target" for the AIs to randomly find their target. (I already excluded self finding).

Now I want to split them in 2 teams. And here is the thing that I keep wondering. Should I use 2 tags for 2 teams (like team red, team blue for ex) then make and attach 2 scripts separately for each AI in the team (the logic in the script will be like "team red" will find game object with tag "team blue" and vice versa). Is that how it works? Is there more efficient way or should I say, "smarter" way to work around this problem?

Here is the script if you need to know more about what I am trying to say https://github.com/Bezari0us/FPS_AI_Behaviour

sentences:
Unity input manager use multiple keys Is it possible to use multiple keys so that they combined will do the action?
Say for instance you want a jump attack that would require two buttons to be pressed at the same time. in this case: space + mouse 1 ?
I tried creating  that however it didnt seem to take my input.

Does anyone know how this can be achieved?

sentences: Check If a 2D Collider Is Completely Inside / Outside of a Polygon Collider How can I check if one 2d collider (circle, capsule, polygon etc.) is completely inside / outside of a polygon collider?

sentences:
Setting up an "Oct-Tree" Instead of spam the same hard question like my previous one that Is difficult to get a minimum verifiable example for, I have decided to rework my path-finding and I can fix a lot of my issues with an oct-tree, not a true one but rather just subdividing my world into 8 or however many i specific in the function as this is all thats needed.

I already know what i need to do the stage after this, but I'm a not sure the best way to approach the subdivision so i get the right vector points of the subdivided cubes.

div = the number of cubes I want to create.

If I already have my 8 points,

    worldspace(Vector3 origind, float sized)
{
    //  face1
    ca = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() - sized };
    cb = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() - sized };
    //-----------------------------------------------------------------------------
    cc = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() - sized };
    cd = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() - sized };
    //  face 2
    ce = Vector3{ origin.GetX() + sized,origin.GetY() + sized, origin.GetZ() + sized };
    cf = Vector3{ origin.GetX() + sized,origin.GetY() - sized, origin.GetZ() + sized };
    //-----------------------------------------------------------------------------
    cg = Vector3{ origin.GetX() - sized,origin.GetY() - sized, origin.GetZ() + sized };
    ch = Vector3{ origin.GetX() - sized,origin.GetY() + sized, origin.GetZ() + sized };
};
~worldspace();

I can define my worldspace as worldspace(0,0,0,25) so thats a cube of 25 units, but then I want to divide it in the most efficient way into 8 = cubes lets say or so and make them into a vector.

I'd like the function to be able to specify how many subdivisions i want, I don't want a dynamic one, so I think. So I'm thinking I could do something along the lines of

semi pseudocode

createoct(div)
int divisions = div
for (int i = 1; i =< div; i++)
{
  dist of ca to cb / div ?
  store the new point
  do the same for the other points ?
}

Am I going about this the right way ? what would be the best way to calculate the subdivisions and store their 4 seperate points as one object ? perhaps a new class ?

sentences:
3d Collision detection help xna? I was hoping if you could help me out here. I'm developing a 3d table tennis game, and got the collision detection working perfectly when the ball hits the racket. However, now I would like the ball to move depending on where it hit the racket (example if it hit the far left side, it goes to the left etc..) Heres the collision detection I used:

private bool IsCollision(Model model1, Matrix world1, Model model2, Matrix world2)
    {
        for (int meshIndex1 = 0; meshIndex1 < model1.Meshes.Count; meshIndex1++)
        {
            BoundingSphere sphere1 = model1.Meshes[meshIndex1].BoundingSphere;
            sphere1 = sphere1.Transform(world1);

            for (int meshIndex2 = 0; meshIndex2 < model2.Meshes.Count; meshIndex2++)
            {
                BoundingSphere sphere2 = model2.Meshes[meshIndex2].BoundingSphere;
                sphere2 = sphere2.Transform(world2);

                if (sphere1.Intersects(sphere2))
                    return true;
            }
        }
        return false;
    }

Any help would be greatly appreciated as to how i could improve this so as to get what I desire. Thanks

sentences:
ID3D10Device::RSSetState to be called every frame? I am trying to create a ID3D10RasterizerState with direct3D10, and then call

ID3D10Device::RSSetState()
with the proper information. However, whenever the window get rescaled, or when the app goes fullscreen, the rasterizerstate seems to reset to the default state. I have tried to set the state with WM_SIZE messages, but awkwardly, nothing seems to happen...

It works properly when I call RSSetState() every frame, but that seems highly inefficient.

Does anyone know a solution to this? It seems to be poorly documented on msdn.

Code:

bool TestGameApp::InitGame()
{
    D3D10_RASTERIZER_DESC desc;
    desc.AntialiasedLineEnable = TRUE;
    desc.CullMode = D3D10_CULL_NONE;
    desc.DepthBias = 0;
    desc.DepthBiasClamp = 0.0f;
    desc.FillMode = D3D10_FILL_SOLID;
    desc.FrontCounterClockwise = false;
    desc.MultisampleEnable = true;
    desc.ScissorEnable = FALSE;
    desc.SlopeScaledDepthBias = 0.0f;

    m_pD3DDevice->CreateRasterizerState(&desc,m_pRSState);
    m_pD3DDevice->RSSetState(m_pRSState);

    //...more code
}

WndProc:

switch( message )
{
    case WM_SIZE:
    {
        m_pD3DDevice->RSSetState(m_pRSState);
        break;
    }
}

sentences:
Java Libgdx - Fire bullets This is my project structure!
I am using Java Libgdx

I want to make my Man class shoot the bullets from my bullet class. To make it more clear for example the spaceship game that you shoot asteroids the bullets come from the spaceship while you move it I want the same thing.
   package com.kovach.gameobjects;

  import java.awt.*;

  import com.badlogic.gdx.Gdx;
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.graphics.Texture.TextureFilter;
  import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Bullet {

int x,y;
public static TextureRegion bullet;

public static Texture texture;

public Bullet(int startX, int startY){

    x = startX;
    y = startY;
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    bullet = new TextureRegion(texture, 238, 5, 6, 13);
}

public void move(){

    x = x + 2;
    if (x > 700)
        visible =false;

   }

}

Fire method in Man class

   public void fire() {

    Bullet z = new Bullet((left + width), (y + height/2 ));
    bullets.add(z);

}

GameRenderer draw method

    private void drawBullets(){
    ArrayList bullets = Man.getBullets();
    for (int w = 0; w < bullets.size(); w++){
        Bullet m = (Bullet) bullets.get(w);

    }
}

sentences:
Updating GameObject Position in Unity 5 I have a simple Sprite called Player that has the follow components (Transform, Sprite Renderer, Box Collider 2D, Rigidbody 2D, Player Controller Script). In my Player Controller script I want to update the player's position when a key is pressed.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    Vector2 playerPos;

    // Use this for initialization
    void Start () {

        playerPos = gameObject.transform.position;

    }

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

        if (Input.GetKey("d")) {

            playerPos = new Vector2(playerPos.x + 0.2f, playerPos.y);

        }

    }
}

This script is attached to my gameobject but whenever I press or hold down the 'd' key, nothing happens to the player. Does anyone know how to fix this?

sentences: Making a zoom out/in space map in Unity I'm new to unity, I was wondering how would one go into implementing a dynamic 2d space map. Let me give you an example what i mean. You see our solar system on the map, if you zoom out at a treshold value this solar system would just be represented by a name and our sun and around it you see adjacent solar systems. How would I do this in unity?

sentences:
GraphicRaycaster performance OnClick Let's say I have two Canvases: BackgroundCanvas and UICanvas.

Now, on BackgroundCanvas I have multiple moving, not clickable objects so I removed the GraphicRaycaster (+ 69 to performance).

On the UICanvas, all the objects are on the UI layer.
I also have some additional layers somewhere else.

Now, if I change the GraphicRaycaster's (on UICanvas) blocking mask to UI only, would it improve performance if there are other objects on the Default and other layers? Or would it still ray all these objects on other layers?

How does this really work? I'm asking cause I don't see any performance impact while switching these Blocking Masks, but after disabling the entire component - I do (but the input is not working ;S).

sentences:
Handling raycast reticle aiming/tracking if no geometry or colliders present? My third person aiming system is really coming together, with a Canvas reticle that is driving the direction of a Raycast which is then aligning the weapon barrels. The problem I'm running into now is that the barrels lose tracking when aiming at the sky or anywhere there is not geometry or colliders.
I've considered:

Hidden geometry/colliders everywhere in the sky but seems inefficient.
Non-handle, reticle goes red/gun deactivates which is interesting but not what I'm going for.
If Raycast hit is null, switch to another form of tracking which I have found any that are accurate enough.
Dynamic reticle opens real wide and gun gets wild - turn it into a game mechanic.

None of these actually solve the problem though. Is there a code based approach to handling this to maintain tracking when there is no Raycast hit?  Any thoughts would be appreciated!

sentences:
Android glsl discard problem Whenever I use discard or an if statement in my shaders, I get an error message with the text

<qgl2DrvAPI_glAttachShader:398>: GL_INVALID_VALUE

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

sentences:
Libgdx/Box2D PolygonShape has no position... well, what now? As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body.

So for Box2D I figured I'd need multiple fixtures, like one for the legs, one for the torso and one for the head.

Each of these fixtures will get a different sprite/texture that should be swappable dynamically if the player puts on some armour or changes cloths etc.

Until now the player-character consisted of a Box2D Body with just one single fixture.
I added the sprite like this:

   body.setUserData(this.sprite);

I rendered it like this:

 // Draw-method
  if(body.getUserData() != null && body.getUserData() instanceof Sprite) {
      Sprite sprite = (Sprite) body.getUserData();
      sprite.setPosition(body.getPosition().x - sprite.getWidth() / 2, body.getPosition().y - sprite.getHeight() / 2);
      sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
      sprite.draw(spriteBatch);
  }

Now that I want to have multiple sprites for different "regions" of the body I figured it's better to add them to the fixture itself. For now I just wanted to reproduce what I already had, so just the one sprite I have to the one fixture I have right now instead of the body.

I do this like that:

Fixture fixture = body.createFixture(fixtureDef);

My problem arises when trying to render this.

for(Fixture fixture : body.getFixtureList())
{
    if(fixture.getUserData() != null && fixture.getUserData() instanceof Sprite)
    {
        Sprite sprite = (Sprite) fixture.getUserData();
        //sprite.setPosition(fixture.getShape().getPosition() ... // Not gonna work, because PolygonShape has no position! :(
        sprite.draw(spriteBatch);
    }
}

As you can read in the comment, the fixture for now has a rectangular shape which is made like:

shape = new PolygonShape();
shape.setAsBox(widthInMeters / 2, heightInMeters / 2);

The problem is, that a PolygonShape has not position :/ Now when I render this, the sprite is not being drawn at the fixtures position and currently I really have no idea how to fix that.

I'd highly appreciate any help you can give me! Thanks in advance and have a wonderful day! :)

sentences:
Why is my button script not working? Okay so i'm new to C# and i made this script. The goal i have in mind is that when the player is on the button and presses a button ( W in this case ) the button is switched from on to off ( or vice versa). The problem i have is that when the character stands on the button and presses W it doesn't always switch its state and i have no idea why. Any info would be appreciated.

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

public class Button : MonoBehaviour {
     public bool Pressed = false;
     Animator Anim;

     // Use this for initialization
     void Start () {
         Anim = GetComponent<Animator> ();
     }

     // Update is called once per frame
     void Update () {
         Anim.SetBool ("Pressed", Pressed);
     }
     void OnTriggerStay2D(Collider2D other){
        if (Input.GetKey(KeyCode.W)){
            if (Pressed){
                Pressed = false;
            } else {
                Pressed = true;
            }
        }
    }
}

sentences:
Find index of GameObject in array of GameObjects In my script, i have declared an array of GameObjects like this:

public GameObject[] go;ld object name. `String temp;`

Also, i have a temporary variable to ho
Then, i assigned objects to elements in Inspector.

I'm using Raycasting to find which object was clicked. Block of code for handling Raycast:

Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
        RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction, Mathf.Infinity,layerMask);

        if (hit) {
            temp=hit.collider.gameObject.name;
            index=ArrayList.IndexOf(go,GameObject.Find (temp));

                }

Ray casting works well. It will print object name if i insert a Debug.Log. However, what i want to do is, find the GameObject's index in the array "go".
I need this index because i have another boolean array isSelect[] which, has a property that needs to be set to true when the corresponding GameObject is selected.

With the IndexOf code above, i get the following error:

An object reference is required to access non-static member `System.Collections.ArrayList.IndexOf(object)

What changes do i need to make to this code?

sentences:
Libgdx, lines between tiles I'm trying to make smooth following camera using this algorithm:

camera.position.add((pos.x - camera.position.x) * 1.2f * deltaTime, (pos.y - camera.position.y) * 1.2f * deltaTime, 0);

It works fine(camera movements are smooth), but when I move the player appears this artifacts:

Player move() function:

moveX(SPEED  * deltaTime);

protected void moveX (float amount) {
        float newX = pos.x + amount;
        if (!map.doesRectCollideWithMap(newX, pos.y, getWidth(), getHeight()))
            pos.x = newX;
    }

sentences:
How to develop ruzzle game for web I am creating a game like ruzzle but i am creating for web . Initially my basic task is to display the alphabets in the html5 canvas the letters should fetched from the database randomly in the html5 canvas tiles and when the user create the word just like in ruzzle , the new words add randomly in the html5 canvas .

Should I use easeljs or any other technology . I also want to include multiplayer gaming both friends can simultaneously play the game with each other.

sentences: How do I slice a 3D object at runtime in Unity? I'm specifically looking for some sort of algorithm or way that can "cut" a 3 dimensional mesh with some other game object. How would I implement this?

sentences:
What is the movement represented by this sprite animation? Fire Emblem 7 is a sprite based game with some interesting sprite art aesthetics. For example, see this sheet of one of the main characters, Lyn:

On the last frames of the critical hit, the artist used some kind of slash effect to represent the entire motion of the sword in a single frame. It looks really appealing on video. I have two questions:

What is this effect called?
How or why did the artist arrive at that result? For example, why are those "spikes" where they are, and why is the "end" of the line fatter?

sentences:
2D mouse coordinates from 3d object projection Not entirely certain of the nomenclature here -- basically, after placing a model in world coordinates and setting up a 3D camera to look at it the model has been projected onto the screen in a 2D fashion.

What I'd like to do is determine if the mouse is inside the projected view of the model.

Is there a way to "unproject" in the XNA framework?  Or what is this process called as, so that I can better search for it?

sentences:
Gizmos not being drawn until GameObject selected I have implemented Scene loading in my game and have three scenes: Persistent, Main Menu and Game
By default, the player is loaded into the Persistent scene, which immediately loads the Main Menu, and when the player clicks on Play, Main Menu is unloaded and Game is loaded.
Now, the two active scenes are Persistent and Game.
However, I have a script with OnDrawGizmos on a GameObject in the Game scene. It seems that by default gizmos only begin to be drawn when I click on that GameObject, sort of activating it, and everything works fine. This used to just work before because Game was my only scene and Unity automatically selected that first GameObject. Now, with multiple scenes, no GameObject is selected by default and my gizmos won't draw until I manually click on it.
How can I solve this?

sentences:
Implementing rubber rope I'm using LibGDX to implement rubber rope in which player can fly and launch. I know I could use Box2D as physics engine and I'm going to one day, but I'd like to learn it myself for now.

I've already got it working, but some unexpected movements are sometimes noticeable and I don't understand why. I feel like I haven't thought of something important. So I figured you guys might find a flaw in my implementation.

For starters, it looks like this:

My maths is basically taken straight from the physics class. There are two forces applied to the bird, because there are two fractions of the rope. Their sum is the actual force.

Both forces are obviously laid along the corresponding rope fractions. Magnitude of the force is |F| = kx, where k is some constant and x is how much this fraction had to stretch. I cache its initial length at the beginning of collision, then measure it each frame and calculate the difference. The code:

private void calculateForces() {
    //A and B are blue circles in the picture; M and Z are red

    //Negative number means no extension, hence Math.max call
    float modifierA = Math.max(0, A.dst(M) - mLengthA);
    float modifierB = Math.max(0, B.dst(Z) - mLengthB);

    mForceA.set(A.x - M.x, A.y - M.y).setLength(K*modifierA);
    mForceB.set(B.x - Z.x, B.y - Z.y).setLength(K*modifierB);
}

What am I not taking into consideration?

EDIT:

As requested, I made a video. You can see some weird movement at the end of second swing, and the third one is completely wrong.

I also tried getting rid of Math.max() call changing line to float modifierA = A.dst(M) - mLengthA;  and, suprisingly, it looks much better. Video. The question is why. Isn't it logical for the rope not to apply any force when it's not being stretched?

sentences:
Android Loop : Draw Loop : How to pull off smooth FPS? I am writing 2D side scrolling bullet hell-like game.
I am at a point where I struggle to pull off smooth fps.
I have separated loop that manages drawing.

However I want update the position of sprites from game logic(for bullets).
Since there are many bullets, waiting for new set of position significantly decreases the speed in which the drawing loop executes itself.

I thought about another approach like this:

I could upload and stack positions of bullets somewhere. So my drawing method can pull off only the previously completely uploaded data, but doing so it can free itself from worrying about waiting for updating since stacked data is already in there. however <- that approach seems counter intuitive.

sentences:
Where can I find fonts which I can distribute with an open source game? I want to be able to release my game as open source, and I need to be able to distribute font files with my game. Where can I find fonts which I can use in this way, and what font licenses should I be looking for?

Are there any further considerations if I want to release my game under GPL rather than a less restrictive open source license such as BSD?

Edit: In response to Olie saying that the question is unclear: My main problem is that fonts which I find on the Internet either do not clearly state their licenses, or have licenses which do not make it clear whether I can distribute the font with software. I know very little about font licenses, but I am looking for sources of fonts which guarantee that the fonts are basically open source / creative commons / public domain / some other font license which allows me to distribute it with a game without paying license fees.

sentences:
On key press, spawn a collider where my player is facing? I'm trying to create an attack mechanic to my player hero in my 2D Tower Defense game. When I press the Q button I want my hero to do an animation and spawn a temporary collider shaped as a cone at where the hero is looking at. If this collider collides with a GameObject called "Stone" it will decrease its hpValue with a script I made. If there is multiple Stones in the cone I want it to only effect one Stone, chosen either by random or/and closest to the hero.

How would I go about doing this and how can I detect the direction of where my hero is facing? This is my movement script:

public float speed;   //Movementspeed

Rigidbody2D rbody;

void Start () {

    rbody = GetComponentInChildren<Rigidbody2D> ();
    rbody.freezeRotation = true;
}

void FixedUpdate () {

    Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

    rbody.MovePosition (rbody.position + movement_vector * speed * Time.deltaTime);

}

A picture visualising what I mean:

sentences:
best way of rendering more 3D models in three.js that not slow down page? I am in the way of creating a 3D web game using threeJS library. This is a multi-player game that players are 3D human models in game, and I need to add a human 3D model for each player that enters the game. Additionally, I want to animate the humans while they walking, but the problem, here is that adding a 3D model and animating that for each player will slow down the game or maybe cause the browser to crash.

question: what is the better way of showing and animating the player's models that will not slow down the game?

sentences:
Is it possible to make a randomly rotating terrain texture painting brush in Unity? I wanted to make a terrain in unity with a dirt texture painted onto the original grass texture to make a path, but when I tried, the dirt (and grass) looked repetitive and full of patterns.

My question is, is there any way I can make a texture's tiles randomly rotate when being applied or painted onto an object?

sentences:
Determine percentage of screen covered by an object without using frustum culling On the CPU-side of an 3D first-person / ego perspective game I need to check whether what the players currently sees on screen is the inside of a box object defined by world space coordinates (the player might be outside of that box but on screen sees only/mostly the inside of the box, or vice-versa, looks from within the box to the outside).

The "casual" way of performing such a check would incorporate frustum culling but such an approach would be hard to achieve with my given set of engine parameters which I'd like to avoid if there is a simpler way.

What I actually have at the point where I would like to do the check (high-level script on CPU, not GPU side):

Camera world position
Camera direction
Camera FOV
Two Box corner world coordinates (left-bottom-front, right-top-back)

What I do not have right away:

View frustrum definition (near/far plane or say 6 planes defining
frustum)
Any specific pixel information (uv, view space position, depth or the
like)

What I would like to calculate:

Percentage of screen "covered" by box.

Any hints on how to perform such calculation?

sentences: why animated tiles aren't animated? So I got some code and I'm using pytmx to load the maps, but the animated tiles don't seem to animate in my pygame game. Is there a setting to change that or do I need to write the animation code myself?

sentences:
How to fetch only the sprites in the player's range of motion for collision testing? (2D, axis aligned sprites) I am working on a 2D sprite game for educational purposes. (In case you want to know, it uses WebGl and Javascript) I've implemented movement using the Euler method (and delta time) to keep things simple. Now I'm trying to tackle collisions.

The way I wrote things, my game only has rectangular sprites (axis aligned, never rotated) of various/variable sizes.

So I need to figure out what I hit and which side of the target sprite I hit (and I'm probably going to use these intersection tests). The old fashioned method seems to be to use tile based grids, to target only a few tiles at a time, but that sounds silly and impractical for my game. (Splitting the whole level into blocks, having each sprite's bounding box fit multiple blocks I might abide. But if the sprites change size and move around, you have to keep changing which tiles they belong to, every frame, it doesn't sound right.) In Flash you can test collision under one point, but it's not efficient to iterate through all the elements on stage each frame. (hence why people use the tile method).

Bottom line is, I'm trying to figure out how to test only the elements within the player's range of motion. (I know how to get the range of motion, I have a good idea of how to write a collisionCheck(playerSprite, targetSprite) function. But how do I know which sprites are currently in the player's vicinity to fetch only them?)

Please discuss. Cheers!

sentences:
How can I get a background image and game objects to fill black areas of letterbox or pillarbox? I have used the Aspect Ratio Enforcer to force my game's aspect ratio to remain as 9:16. I need to prevent some game objects and the backgrounds from being affected by the enforced aspect ratio to cover the black areas that result from other aspect ratios.
How can I prevent some game objects and background images from getting affecting by the Aspect Ratio Enforcer?

sentences:
How can I utilize external libraries within an entity system? I'm implementing an entity system for educational purposes.  I wanted to focus on the system itself and don't know much about rendering and physics, so I'm using external libraries for those tasks.

These libraries come with pre-defined classes for their objects (sprites, bodies, etc.)  These do not fit into my entity system easily.

How can I utilize existing libraries and classes within an entity system?

sentences:
How do I use Bezier Curves in unity? I have to rotate few objects on an ellepsoidal(Capsule shaped) track and at the run time speeds are assigned to the objects from the server as this is a betting game which I am developing in Unity 5 using C#.

So can I use Bezier Curves for that if yes then how do I use that?

sentences:
GLSL uniform array with size set by another uniform Will the follwing GLSL code work?

#version 330

uniform int size;
uniform float[size];

void main() {
  //do something
}

sentences: Is it more efficient to add scripts to each GameObject or to a single parent object? Does a C# script added to a parent object work more efficiently and effectively (in terms of both memory and performance) on all objects, in my case lighting, or adding script components to each lighting/GameObject object? This goes for other GameObjects parented in the hierarchy.

sentences:
OpenGl: Error, The loaded object takes the same colors and style of the Texture? I'm new to OpenGl Faced this problem:

Draw function:

void Renderer::Draw()
{

    glUseProgram(programID);
    shader.UseProgram();

    mat4 view = mat4(mat3(myCamera->GetViewMatrix()));
    glm::mat4 VP = myCamera->GetProjectionMatrix()*myCamera->GetViewMatrix();
    shader.BindVPMatrix(&VP[0][0]);

    glm::mat4 VP2 = myCamera->GetProjectionMatrix() * myCamera->GetViewMatrix() * floorM;
    model13D->Render(&shader, scale(100.0f, 100.0f, 100.0f)); // scaling the skybox

    t2->Bind();
    model3D->Render(&shader, scale(2.0f, 2.0f, 2.0f)); //scaling aircraft

    glUniformMatrix4fv(VPID, 1, GL_FALSE, &VP2[0][0]);

    mySquare->Draw();

}

The code of loaded:

    shader.LoadProgram();
    model3D = new Model3D();
    model3D->LoadFromFile("data/models/obj/Galaxy/galaxy.obj", true);
    model3D->Initialize();
    myCamera->SetPerspectiveProjection(90.0f, 4.0f / 3.0f, 0.1f, 10000000.0f);

    model13D = new Model3D();
    model13D->LoadFromFile("data/models/obj/skybox/Skybox.obj", true);
    model13D->Initialize();
    // Projection matrix :
    //shader.LoadProgram();

    // View matrix :
    myCamera->Reset(
        +0.0f, +0.0f, 5.0f,// Camera Position
        +0.0f, +0.0f, +0.0f,// Look at Point
        +0.0f, +1.0f, +0.0f // Up Vector
        );
    //////////////////////////////////////////////////////////////////////////
    std::string Images_names[6];

    Images_names[0] = "right.png";
    Images_names[1] = "left.png";
    Images_names[2] = "top.png";
    Images_names[3] = "bottom.png";
    Images_names[4] = "back.png";
    Images_names[5] = "front.png";
    t = new Texture(Images_names, 0);
    t2 = new Texture("arrakisday_dn.tga", 1);

sentences:
Web games are being played less by the year, is this only on PC, or also on Mobile? I just came from reading the NewZoo 2016 global game market report. The last time I read it, I noticed that the web game's segment was less than the years before (it was 5% in 2016, 6% in 2015, 9% in 2014, and 10% in 2013)

But these are all for users who accessed games using their PCs not mobile phones. And if you've been following the current trends of game portal websites, you'll notice that they are moving to mobile. Both Kongregate and Miniclip, two very big gaming portals, have started publishing games on the two major app stores. They (and the larger part of web game publishers) will usually reject any HTML game doesn't support mobile. So they are definitely aware of this trend.

So now my questions is: what are the stats when it comes to web games on mobile?
 Does anyone know any resource that has stats on this?

sentences:
Is chess-like AI really inapplicable in turn-based strategy games? Obviously, trying to apply the min-max algorithm on the complete tree of moves works only for small games (I apologize to all chess enthusiasts, by "small" I do not mean "simplistic").
For typical turn-based strategy games where the board is often wider than 100 tiles and all pieces in a side can move simultaneously, the min-max algorithm is inapplicable.

I was wondering if a partial min-max algorithm which limits itself to N board configurations at each depth couldn't be good enough? Using a genetic algorithm, it might be possible to find a number of board configurations that are good wrt to the evaluation function. Hopefully, these configurations might also be good wrt to long-term goals.

I would be surprised if this hasn't been thought of before and tried. Has it? How does it work?

sentences:
btBvhTriangleMeshShape useQuantizedAabbCompression Crash I use btBvhTriangleMeshShape for static world collision. Generally this works fine, but recently I have encountered situations where the construction of btBvhTriangleMeshShape would crash.

In debug builds I get an assert from:

btQuantizedBvh::quantize(unsigned short *,class btVector3 const &,int)
btQuantizedBvh::mergeInternalNodeAabb(int,class btVector3 const &,class btVector3 const &)
btQuantizedBvh::buildTree(int,int)
btOptimizedBvh::build(class btStridingMeshInterface *,bool,class btVector3 const &,class btVector3 const &)
btBvhTriangleMeshShape::buildOptimizedBvh(void)
btBvhTriangleMeshShape::btBvhTriangleMeshShape(class btStridingMeshInterface *,bool,bool)

If I disable useQuantizedAabbCompression during construction the issue does not occur and all appears to work well.

Are there some requirements for the mesh geometry that I am missing?

sentences:
Level and Player objects - which should contain which? I've been working on a several simple games, and I've always come to a decision point where I have to choose whether to have the Level object as an attribute of the Player class or the Player as an attribute of the Level class.

I can see arguments for both:

The Level should contain the player because it also contains every other entity. In fact it just makes sense this way: "John is in the room." It makes it a bit more difficult to move the player to a new level, however, because then each level has to pass its player object to an upcoming level.

On the other hand, it makes programming sense to me to leave the player as the top-level object that is persistent between levels, and the environment changes because the player decides to change his level and location. It becomes very easy to change levels, because all I have to do is replace the level variable on the player.

What's the most common practice here? Or better yet, is there a "right" way to architecture this relationship?

sentences: Show procedural map without running the game? Currently I have a script that generates prefabs by code and I'm wondering if I could show a certain "seed" of that map without actually running the game. The reason why is that I often want to tweak things, and when I run the game and alter settings for objects like lights they get reset when I stop running the game and perhaps have some kind of button where I can reset the seed and see another generation of the map.

sentences:
Ini files only work on my computer. How to create ini files in a directory on another computer? I am creating a game that requires the use of ini files.
The game works perfectly on my computer.
When I create and executable, the executable even uses the ini files when I am programming/testing the game on the engine.
Directory where the ini files are located:
D:\Users\BonecoSinforoso\AppData\Local\Brasmotor_1

The problem occurs when a person from another computer tries to play. The game does not create any ini files.
Even placing the ini files in the zipped file that I put the game on, it gives an error. Because the ini files don't go to a directory that the game can read.
I would like to know how to make my executable create or move the ini files to a directory where the files can be read.

EDIT 1
How do I create the ini files:
ini_open("config.ini");
    arkivoIdioma=ini_read_string("jogoIdioma","arkivoIdioma","");
    dadosNum=ini_read_real("dadosNum","dadosNum",1);
    paradaModo=ini_read_string("paradaModo","modo","automatico");
    paradaPorcAutomatico=ini_read_real("paradaPorcAutomatico","porcentagem",10);
    paradaPorcAviso=ini_read_real("paradaPorcAviso","porcentagem",10);
ini_close();

Searching about, I found something explanatory about the directory:

The ini files get created. Probably you are not looking in the right
place for it. The ini file get created in
%AppData%/Local/"YourGameNameHere" folder, that's where you'll find
all the files you save.

BY JM DG.
LINK:
https://www.reddit.com/r/gamemaker/comments/5d6pf0/how_do_i_create_a_new_ini_file/
Error obtained by a user:

A little earlier, I made a change to the line of this script. I will wait for this user to test again to see if the error has been resolved.

sentences:
Can you remove Steamworks DRM from your own game after release? Is it possible to remove Steamworks DRM from a Steam game after release? I'm sure that some developers have accidentally used DRM, without fully understanding the drawbacks for a consumer (the Steam client has to be running during gameplay, forced online checks etc.). Using DRM is optional, you can release your game on Steam without copy protection of any kind.
I haven't released a game on Steam, I'm asking for someone who has to answer.

sentences:
How my bullet can take HP from enemy? using UnityEngine;
using System.Collections;

public class GunScript : MonoBehaviour
{
    public Transform barrel;
    public float range = 0f;
    public Rigidbody myBullet;

    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Rigidbody bulletInstance; // reference
            //make the bullet apear out of the barrel
            bulletInstance = Instantiate(myBullet, barrel.position, barrel.rotation) as Rigidbody;
            bulletInstance.AddForce(barrel.forward * range); //give the bullet some force to move forward
        }
    }
    IEnumerator Fire()
    {
        RaycastHit hit;
        Ray ray = new Ray(barrel.position, transform.forward);
        // in don't know how write this iff
        if (Physics.Raycast(ray, out hit, range))
        {
            Enemy enemy = hit.collider.GetComponent<Enemy>();
            enemy.health -= 1;
        }
        //Debug.DrawRay(barrel.position, transform.forward * range);
        yield return null;
    }
}

I made an enemy class, my bullet is a prefab, but i don't understand what i need to do to lower HP points when the bullet hits.

sentences:
Conditional priority in behavior trees I want to trigger behavior based on certain conditions. I currently just have a sequence that runs different behavior, it triggers on condition but always in sequence. When the first condition is met it runs that.
Let's say I have 2 behaviors. Flee from threat and find food if hungry. Usually the flee from stronger threat prevails and thus is placed early in the sequence. But what if the entity running the behavior is starving, it can take more risk. Since the flee from threat comes first in sequence and triggers on a threat it will never pick to gather food if there is a threat present. I guess I need something like a scoring system and let the tree pick the best option. Is this common in behavior trees? How is it called or best implemented?
I'm using gdx.ai in particular and perhaps there is something out of the box I can use. I can make a task in the behavior tree that weighs all the possible actions but this ties everything together and bt's are widely used for the opposite.

sentences:
Unable Compile Unreal Project into .Exe File I'm new to Unreal Engine and I've been looking for an answer online but I don't understand why the project I just started on is unable to compile. I only used the default blueprints. The error logs are below.
UATHelper: Packaging (Windows (64-bit)): Running AutomationTool...
UATHelper: Packaging (Windows (64-bit)): Parsing command line: -ScriptsForProject=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide/EscapeFromDarkSide.uproject BuildCookRun -nocompileeditor -installed -nop4 -project=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide/EscapeFromDa
rkSide.uproject -cook -stage -archive -archivedirectory=C:/Users/belmo/OneDrive/Documents/GitHub/EscapeFromDarksidePenitentiary/EscapeFromDarkSide -package -ue4exe="C:\Program Files\Epic Games\UE_4.26\Engine\Binaries\Win64\UE4Editor-Cmd.exe" -ddc=InstalledDerivedDataBackendGraph -pak -prereqs -nodebuginfo -targetplatform=Win64 -clientconfig=Development -utf8
output
UATHelper: Packaging (Windows (64-bit)): Setting up ProjectParams for C:\Users\belmo\OneDrive\Documents\GitHub\EscapeFromDarksidePenitentiary\EscapeFromDarkSide\EscapeFromDarkSide.uproject
UATHelper: Packaging (Windows (64-bit)): ********** COOK COMMAND STARTED **********
UATHelper: Packaging (Windows (64-bit)): Running UE4Editor Cook for project C:\Users\belmo\OneDrive\Documents\GitHub\EscapeFromDarksidePenitentiary\EscapeFromDarkSide\EscapeFromDarkSide.uproject
UATHelper: Packaging (Windows (64-bit)): ERROR: Cook failed.
UATHelper: Packaging (Windows (64-bit)):        (see C:\Users\belmo\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.26\Log.txt for full exception trace)
PackagingResults: Error: Cook failed.
UATHelper: Packaging (Windows (64-bit)): AutomationTool exiting with ExitCode=25 (Error_UnknownCookFailure)
UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
PackagingResults: Error: Unknown Cook Failure
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogEditorViewport: Clicking on Actor (LMB): StaticMeshActor (Cube11)
LogSlate: Window 'Output Log' being destroyed
LogSlate: Window 'Output Log' being destroyed
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogD3D11RHI: CreateSwapChainForHwnd failed with result 'DXGI_ERROR_INVALID_CALL' (0x887A0001), falling back to legacy CreateSwapChain.
LogEditorViewport: Clicking on Actor (LMB): StaticMeshActor (Cube11)

sentences:
Issues loading in AudioSource at runtime using WWW class I am having an issue with loading in an OGG audio file to my project. Basically I want to set my game up so that players can drop audio files into a folder called Playlist in the game directory then they can listen to this music while they play.

For some reason my audio clip never becomes instantiated. I have an Audio Source in my scene with this script attached to it.

As you can see I have commented out some code for the time being as I am trying to get a simple case of only 1 audio file playing at this stage.

So my question is what exactly am I doing wrong here? I have printed out the file path and it comes out as file://B:/Users/Matt/Development/Unity Projects/Space Game/Playlist/19_Tumbling_Dice.ogg which is the location to my audio.

However when I print out the audioLoader.audioClip.name it comes out as blank...

[RequireComponent(typeof(AudioSource))]
public class MP3AudioImporter : MonoBehaviour {

    private List<string> playlist;
    private string musicDir = "B:/Users/Matt/Development/Unity Projects/Space Game/Playlist/";
    private int currIndex = 0;

    void Start()
    {
        string[] songs = Directory.GetFiles(@musicDir, "*.ogg", SearchOption.TopDirectoryOnly);
        playlist = new List<string>(songs);

        StartAudio();
    }

    void StartAudio()
    {
        WWW audioLoader = new WWW("file://" + playlist[currIndex]);

        Debug.Log(audioLoader.audioClip.name);

        audio.clip = audioLoader.audioClip;
        audio.Play();

        /*
        currIndex++;

        if (currIndex > playlist.Count)

            currIndex = 0;
        }

        Invoke("StartAudio", audio.clip.length + 0.5f);
        */
    }
}

sentences:
How to make a boss control multiple object spawners in Game Maker Studio 2 I'm working on a boss fight for a 2D platformer/shooter game in the vein of the Megaman franchise. I expect part of the fight to include this boss causing large boulders to fall from certain points on the ceiling to possibly crush the player, which serve both as an attempt to harm the player and a possible means by which the player may harm the boss. I am having some difficulty, however, with conceptualizing how to tie these randomly-falling rocks to an action on the boss's part. I can make spawner objects to drop the boulders when prompted, my issue mainly lies in how to give the boss object the ability to trigger this action, especially given there will be several such spawners in the level, which may be selected at random.

Are there any functions or techniques that may be useful in allowing a single "boss" object to trigger one or more of a set of other "spawner" objects as a part of an action the "boss" takes, rather than simply automating the spawners to work on their own timing?

sentences:
GameObject scope over RPC call Debugging my code I faced some unexpected behavior.

I called an RPC using uLink.NetworkView on the server passing some parameter including a GameObject tagged as Player.

Inside that RPC I make a call to GameObject.FindObjectsWithTag("Player")

What I refer to by saying "unexpected" is that that function returns all the gameobjects in hierarchy INCLUDING the gameobject passed as parameter to the RPC call.

I noticed that inside the editor it appears in hierarchy the gameobject passed to the RPC but without all the components BUT the transform.

My question is to know exactly how the scope is working, I seem to understand that the scope of the FindObjectsWithTags seems to include RPC parameters but without the most informations.

Any clue about this?

sentences: Installing the right version of PyGame I've been trying to install PyGame for Python, and can't seem to get Python to recognize that it's there.  I use Python 3.3, and have a 64-bit Windows computer, but that's really all I know.  The PyGame website has piles of different versions of the installer, but I can't seem to find the right one.  Either they let me install it but then starts spitting errors (basically saying the module doesn't exist, when it does), or I get this sort of set-up program that keeps saying it's not in my "registry".

sentences:
In pixel art, should i keep the same color palette for every sprites? The question may sounds weird (and very noobish but i'am :p) but i can't find any answer. When making pixel art, it is often said that a color palette could be 2, 4, 8, 16 or even 256 colors, through it is not recommended. When it comes to the palette choice, is it for a single sprite (like a character, and another palette for the landscape for example) or for an entire game (and in this case i must stick to the same palette for every sprites) ?

Honnestly i think it is for an entire game, but my mind is stuck with the second question implied by this answer: how could i do everything (characters, trees, rocks, explosions, sky...) with only - let's say - 8 colors ? All my sprites looks flat because of this, i can't find a suitable color to make a nice shading.

sentences:
How to attach an UI button to a prefab and follow it in Unity2D My plan is creating a button above my prefab (a tree) and whenever my character is detected, the button will appear and allow me to click on it to active a dialog. I just want my trees are randomly spawned and stay still so it's not "follow" actually but I would like to know in that case too.

I did some researches but most of them were about Text and HP/MP things, which weren't used by UI system.

One more thing, I kinda new to code so it would be fantastic if I got a full code (Button follow only).

Thanks in advanced.

sentences:
Can someone explain Flappy Bird's physics to me? I am having a difficult time trying to understand the Flappy Bird physics. I know it seems simple but I kind of suck at math. I am trying to see if I can make a simple game like this but it is just the dang physics that are throwing me off. I have something like gravity effecting the bird but when you click the screen and I add some amount to the y position but it doesn't look good. You guys have any ideas?

Stuff like:

velocity += -9.8 * Gdx.graphics.getDeltaTime();
position.y += 0.5 * velocity;

That is falling but when I tap the device I would like to know how to add upward force but when it loses it continue falling.

sentences:
XNA Calculate two points of triangle with given Z I want to calculate the two points of a 3D triangle that have a specified Z coordinate. I guess the way to do this would be to somehow create a plane which is perfectly flat with my given Z coordinate and then calculate where the triangle intersects with it (or is this wrong).

If you know how to do this in any way please help. I have searched for but have not really found anything that seems to work.

sentences:
How to split a screen in half using LibGDX without scaling? I am currently working on a racing game with libGDX and I need to split the screen in half for a two-players mode. (Player 1 in first half and Player 2 in second half).

I already have Camera1 that will follow Player 1's car, and Camera2 that will follow Player 2's car.

Basically, I want the first half to show Player 1's car and the second half to show Player 2's car.

I have been searching for a while online for a way to split screens with LibGDX and found how to split the screen in two with this code:

/*Left Half*/
Gdx.gl.glViewport( 0,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );

/*Right Half*/
Gdx.gl.glViewport(Gdx.graphics.getWidth()/2,0,Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight() );

However, it squeezes the screen into the right half, which is not what I want.

Is there a way to split the screen without squeezing it?

sentences:
When should I mark GameObjects as Static? Here is the corresponding Unity documentation.

According to explanations of Unity documantation pages about Static GameObjects, sometimes marking GameObjects as static may effect performance in a bad way (for example Static Batching causes more memory usage).

So when should i exactly want to use these functionalities?

Thanks in advance.

Footnotes:
I'm currently developing a 2D top-down game which has lots of Sprites and LineRenderers, but no 3D objects (not even a quad). All GameObjects are being instantiated procedurally from premade prefabs. LineRenderers get updated from scripts each frame. And nearly all Sprites are moving constantly. Majority of Sprites share same material. All LineRenderers also share same material of their own.

sentences:
How to fill a 2d array with elements of a 1d List I have a 2d array for 'Slots' in my inventory screen (slot width: 150px; total slots is based on width and height of inventory panel currently at 1500x600). The slot holds a reference to the pickupObjects that the player has picked up and added to the inventory (these items have been stored in a list).

So I try to make a method which fills the slots using the List of pickupItems. But the problem is that when I iterate through the inventory it will reach a number higher than the width of the first row of slots. I feel like the answer can be simple, but I just can't seem to figure out how to iterate through them and place it into the 2d array. I've solved this very issue in the past but can't remember how I did it.

Here's the code I have for creating the grid of slots, and then the method for putting the inventory in there (even though this method is pretty much empty right now as I am completely out of ideas):

Any help would be massively appreciated. Thanks

void CreateSlotLayout()
{
    panel_rt = GetComponent<RectTransform>();
    panelWidth = panel_rt.rect.width;
    panelHeight = panel_rt.rect.height;
    slotCount_x = (int)(panelWidth / slotWidth);
    slotCount_y = (int)(panelHeight / slotHeight);
    slots = new Slot[slotCount_x, slotCount_y];

    for (int y = 0; y < slotCount_y; y++)
    {
        for (int x = 0; x < slotCount_x; x++)
        {
            Slot slot = Instantiate(slotPrefab);
            slot.transform.SetParent(transform);
            slot.GetComponent<RectTransform>().anchoredPosition = new Vector2(x * slotWidth, -y * slotHeight);
            slots[x, y] = slot;
        }
    }
}

public void FillSlotsWithInventory(Player_Inventory playerInventory)
{
    for (int i = 0; i < playerInventory.GetPickupsList().Count; i++)
    {
          //something like....
          //slots[i?,i?].FillSlot(playerInventory.GetPickupsList[i];
    }
}

sentences: How to move a body from one world to another? I have a Box2D world for each level in my game. When a level is completed, I want the player to be removed from the completed level's world and added to the next level's world. How do I do this?

sentences:
JavaScript character direction delay I am developing a top down game and I'm having trouble with a delay in switching from one character walk direction to another, particularly if the previous direction key is still being pressed by the user.

Take the following user interaction:

User presses up arrow;
User presses right arrow (up arrow is still pressed);
User releases up arrow (right arrow is still pressed).

The problem I am experiencing is that there is a delay in the character switching from the "walk up" movement to the "walk right" movement.

requestId: 0,
settimeoutID: 0,
counter: 0,

move: function(keyCode) {
  var _this = this;
  // Frame per seconds
  var fps = 60;

  if (this.requestId === 0) {
    (function animationLoop() {
      // Control the timing of an animation with requestAnimationFrame
      _this.settimeoutID = setTimeout(function() {
        _this.render();
        _this.requestId = requestAnimationFrame(animationLoop, _this.move);
      }, 1000 / fps);
    })();
  }
},

changeAnim: function() {
  if (this.counter % 10 === 0) {
    if (this.currentFrame > 1) {
      this.currentFrame = 0;
    } else {
      this.currentFrame++;
    }
  }
},

render: function() {
  // Add some drawing
  this.counter++;

  if (keyCode === config.PLAYER_DOWN) {
    this.action = 'Front';
    this.newPos.y += 1;
  } else if (keyCode === config.PLAYER_UP) {
    this.action = 'Back';
    this.newPos.y -= 1;
  }

  if (keyCode === config.PLAYER_RIGHT) {
    this.action = 'Right';
    this.newPos.x += 1;
  } else if (keyCode === config.PLAYER_LEFT) {
    this.action = 'Left';
    this.newPos.x -= 1;
  }
  this.changeAnim();
  // Draw player logic
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
},

onKeyUp: function() {
  // Cancel the animation request
  if (this.requestId) {
    clearTimeout(this.settimeoutID);
    cancelAnimationFrame(this.requestId);
  }
  // Allow a new request to be called
  this.requestId    = 0;
  this.counter      = 0;
  this.currentFrame = 0;
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
}

Note: The function move gets called every time a new key is being pressed.

sentences:
Tweaking screen transitions not to fire every time in Unity I'm making a simple screen transition system for my game which consists of two states firing the right clips (one for the starting half od the transition animation, one for the ending one) and a condition between the end and start one which is set to true when user wants to change the level (so that the Start animation would fire in the previous animation and the End in the new one).

This is cool and all but poses two problems - firstly, the game starts with the End phase animation which looks a bit weird. Secondly, since the Restart button in the main game just reloads the level, it causes the End transition to fire every time too which looks weird and out of place.
How would I go about tweaking the Animator so that the End phase only runs when I actually change the level as opposed to when starting the game or reloading the current scene? Maybe there's some way to pass some kind of a parameter when loading a new scene that I'm not aware of? This way, I could just pass a flag like shouldFireEndAnimation so that it does not fire when the game just starts or a level restarts?

sentences:
Is Quake 3's shader language copyrighted? Right now I am using Quake 3 tools to make maps for my graphics engine, to have some kind of start and an idea on how to build one from scratch. I know that the BSP format is copyrighted and maps made with GTKRadiant cannot be used in commercial games.

But suppose that I would like to create/use a shading language with syntax that is similar or even identical to Quake 3's shading language's syntax, would I risk copyright issues?

sentences:
Best practice child and parent script What is the best practice coming to where to place the code in this scenario.

I have a gamobject called player. It has lots of child objects. One of them is sword.
Like this:

Player

Body

Head

Torso

Sword

So i have code that controls the player in player. It controls movement and triggers an attack animation which swings the sword. The code that checks if the sword is swinging and if it has hit something is at the moment inside the sword. My question is, what model is best practice? I can think of some:

All code in player. player checks if sword is colliding and handles what happens to the enemy that was hit.
sword checks for collision but player handles it by polling sword and takes care of what happens with enemy and player after.
sword checks for collision but player handles it  by listening to an event that sword triggers and takes care of what happens with enemy and player after.
sword handles everything by handling what happens to enemy and player communicating with parent through a reference.

sentences: In what order should collisions be resolved? I am creating my 2D game engine and I need to know if I should first move all objects and then resolve collisions with all objects or I should move and resolve collision one by one objects.

sentences:
XNA Sprite mouse selection with layered/overlapping sprites If I use mouse coordinates to select a sprite does XNA provide a built in way to return the top-most sprite on the screen at a coordinate?

I am trying to highlight the selected sprite, but when iterating through my sprites at the specific mouse location there can be multiple sprites found.  The way my game works any one of the sprites found is valid to be on top.

sentences:
Issue with multiplayer interpolation In a fast-paced multiplayer game I'm working on, there is an issue with the interpolation algorithm. This interpolation is for a moving object not controlled by the local computer.

The server sends packets with the object's position at a fixed rate. (red markers) The interpolation algorithm is attempting (and failing) to create a smooth path between the red markers.

The results of this interpolation are shown by green and black markers. Green is the local position at the exact time a packet is received, and black is the local position at every frame.

Green: Local position when a packet is received (edited for clarity)

Red: Position received from packet (goal)

Blue: Line from local position to goal when packet is received

Black: Local position every frame

On a network with a realistic amount of lag and packet loss, this is the result:

The local position (green&black lines) seems to oscillate around the goals (red lines) instead of moving between them smoothly.

This is how it looks on a perfect network with the object moving right to left. (0 ping, 0 packet loss, etc.)

The code works like this:

Every x ms, receive a packet with a Vector3 position
Set the goal to that position
Set the positionAtLastPacket to the current local position
Every frame, lerp from positionAtLastPacket to goal, attempting to reach the goal approximately when the next packet should arrive.
If the next packet takes longer than expected, interpolation continues past the goal and becomes extrapolation.

I believe what is happening is the extrapolation overshoots a bit to far. Over several packets, this issue compounds, causing the oscillation.

    // local transform position when the last packet arrived. Will lerp from here to the goal
    private Vector3 positionAtLastPacket;

    // location received from last packet
    private Vector3 goal;

    // time since the last packet arrived
    private float currentTime;

    // estimated time to reach goal (also the expected time of the next packet)
    private float timeToReachGoal;

    private void PacketReceived(Vector3 position, float timeBetweenPackets)
    {
        positionAtLastPacket = transform.position;

        goal = position;

        timeToReachGoal = timeBetweenPackets;
        currentTime = 0;

        Debug.DrawRay(transform.position, Vector3.up, Color.cyan, 5); // current local position
        Debug.DrawLine(transform.position, goal, Color.blue, 5); // path to goal
        Debug.DrawRay(goal, Vector3.up, Color.red, 5); // received goal position
    }

    private void FrameUpdate()
    {
        currentTime += Time.deltaTime;

        float delta = currentTime/timeToReachGoal;
        transform.position = FreeLerp(positionAtLastPacket, goal, currentTime / timeToReachGoal);

        // current local position
        Debug.DrawRay(transform.position, Vector3.up * 0.5f, Color.black, 5);
    }

    /// <summary>
    /// Lerp without being locked to 0-1
    /// </summary>
    Vector3 FreeLerp(Vector3 from, Vector3 to, float t)
    {
        return from + (to - from) * t;
    }

Any idea about what's going on?

sentences:
How can I clearify users my controlls? In my game I use a really simple control mechanic to control a character on screen. But my problem is that users do not understand this control.

Beside a little delay problem they work this way:

  As soon as I do a swipe +x or -x my character moves left or right.
  And as long as I hold my finger it continuous to move to the direction
  in that I swiped. When I swipe into the opposite direction of my last
  swipe without leaving my finger from the touch ground, my character
  should move into this direction. When I release my finger from the
  touch screen, my character should stops instantly.

a) Do you think this mechanic could work, if my users learn to use it?

If yes: what would be the best way to show them how it works? A short video? Or some graphics? Maybe a tutorial level?

My concern is that it might be not a good mechanic, because people do not understand it when playing my prototype the first time. That could be because they only know swipe and tap, but not swipe-hold-swipe.

I do not know if there is a right answer or if it is just a question of opinions.

sentences:
LibGDX Shader works fine on desktop but does not work at all on Android device I made a very basic shader that works perfectly fine on Desktop, but when I try it with an AVD the sprite affected by the shader is not drawn. I have tried with WQVGA API 16 and Nexus S API 23. I have also tried putting this in my shaders but then it doesn't work on Desktop nor android :

#ifdef GL_ES
    "#version 300"
    precision mediump float;
#else
    "#version 130"
#endif

My vertex shader is simply a "passthrough" :

#version 130
attribute vec4 a_color;
attribute vec3 a_position;
attribute vec2 a_texCoord0;

uniform mat4 u_projTrans;

varying vec4 v_color;
varying vec2 v_texCoord0;

void main() {
    v_color = a_color;
    v_texCoord0 = a_texCoord0;
    gl_Position =  u_projTrans * vec4(a_position, 1.0);
}

My Fragment Shader :

#version 130
precision mediump float;
varying vec4 v_color;
varying vec2 v_texCoord0;

uniform sampler2D u_sampler2D;
uniform vec4 color1;
uniform vec4 color2;

void main()
{
    vec4 actualColor = v_color * texture2D( u_sampler2D, v_texCoord0 );

    if(actualColor.g > actualColor.r)
        actualColor = color1;
    else if(actualColor.r > actualColor.g)
        actualColor = color2;

    gl_FragColor = actualColor;
}

Edit :
I changed gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); in my fragment shader in order to test if a red rectangle would appear, but it failed. The red rectangle being the desktop version and on top being Android.

If it helps I also get this error in my Android console :

libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
emulator: Listening for console connections on port: 5554
emulator: Serial number of this emulator (for ADB): emulator-5554
emulator: emulator window was out of view and was recentered
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetUniformLocation:1628 error 0x501
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetUniformLocation:1628 error 0x501
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetUniformLocation:1628 error 0x501
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetUniformLocation:1628 error 0x501
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetAttribLocation:988 error 0x501
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetAttribLocation:988 error 0x501
distrib/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetAttribLocation:988 error 0x501

sentences:
How to implement a mechanism to select language specific expression (python)? On a game server, programmed in python, I want to be able to select language specific expression, according to the user's preference. Provided a 'name tag' and a 'language identifier' I want a function to return the appropriate text for the specified tag in the given language, for example

> print(foo("turn left","de"))
Bitte nach links abbiegen
> print(foo("turn left","en"))
Turn left please

I hope you get the point.

Is there something available for python which can provide a solution? I am not looking for gettext or something which uses the computer's locale setting for the language! I am looking for a solution which might work similar, but works as given in the example.

Or is it better to code something like this by oneself? How then to store the language phrases in a best way? Just in a big text file? A data base? ...?

sentences:
Integrate Stripe with Unity I'm trying to install the Stripe API Library through NuGet Manager in Visual Studio but it installs it inside packages folder of the Project (I.E. before Project's Assets folder) doing this I cannot use the library:

Using UnityEngine;
Using Stripe; //Doesn't recognise this

Then I:

Moved those installed files from packages to Assets folder
Uninstalled Stripe from NuGet (as I could now access them in my script by using Stripe)

Now these are the main errors that I'm getting:

PrecompiledAssemblyException: Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included for the current platform. Only one assembly with the same name is allowed per platform. Assembly path: {0}
Assembly 'Assets/Temp/lib/netstandard2.0/Stripe.net.dll' will not be loaded due to errors:
Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform?

Assembly 'Assets/Temp/lib/netstandard1.2/Stripe.net.dll' will not be loaded due to errors:
Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform?

sentences:
Why do I keep getting an exception about "an element with the same key already exists" in this code? I'm trying to follow this tutorial about object pooling in Unity

I got to minute 17:22. But when I run the game I get this exception:

ArgumentException: An element with the same key already exists in the dictionary.

System.Collections.Generic.Dictionary`2[System.String,System.Collections.Generic.Queue`1[UnityEngine.GameObject]].Add (System.String key, System.Collections.Generic.Queue`1 value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
ObjectPooler.Start () (at Assets/Scripts/ObjectPooler.cs:31)

This script is attached to a new empty GameObject:

using System.Collections.Generic;
using UnityEngine;

public class ObjectPooler : MonoBehaviour
{
    [System.Serializable]
    public class Pool
    {
        public string tag;
        public GameObject prefab;
        public int size;
    }

    public List<Pool> pools;
    public Dictionary<string, Queue<GameObject>> poolDictionary;

    private void Start()
    {
        poolDictionary = new Dictionary<string, Queue<GameObject>>();

        foreach(Pool pool in pools)
        {
            Queue<GameObject> objectPool = new Queue<GameObject>();

            for (int i = 0; i < pool.size; i++)
            {
                GameObject obj = Instantiate(pool.prefab);
                obj.SetActive(false);
                objectPool.Enqueue(obj);

                poolDictionary.Add(pool.tag, objectPool);
            }
        }
    }
}

Like in the tutorial I'm making size of 1 of the Pools in the Inspector then giving as tag name: Cube then drag a cube prefab to the Prefab then set the size to 150.

But I'm getting this exception when running the game.

sentences:
Move object at angle like a sine wave I currently have this code, which moves an object in a straight line at an angle, where "dir" is the angle.

velX = (float)(Math.cos(Math.toRadians(dir))) * speed;

velY = (float)(Math.sin(Math.toRadians(dir))) * speed;

x += velX;

y += velY;

What I need now is to have the object move like a sine wave, do I have to change the way I calculate velX and velY or is there some way of changing dir that would make it work?

I tried this but it didn't work, my objects would just got bunched up near 0, 0.
Move a sprite in a sine wave along different angles

sentences: Custom Unity launcher localization I would like to localize Unity launcher using own texts. At the very least I would like to change "play!", "quit", "Graphics" and "Input" to own arbitrary labels. How can I achieve that?

sentences:
High level project workflow We are a small software company trying our hand at our second game. Since our first games' process was a living nightmare (since we used webdevelopment workflow) I have decided to educate myself on how to manage a game project on a high level.

How does your process work, from idea to launch? Preferably in situations where you have a team that needs to cooperate.

I've seen these 2 links, which are useful in a way, but was wondering if there are better/more comprehensive ways to do this?

http://www.goodcontroller.com/blog/?p=136

http://gogogic.wordpress.com/2009/02/09/symbol6-how-we-created-an-iphone-game/

All input would be infinitely appreciated.

sentences:
Why can a certain DirectX mode produce display lag? I have written two small test games using DirectX 9. One uses

presentParams.Windowed = false;

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_ONE;

and the other one uses

presentParams.Windowed = false; // same results with true

presentParams.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

Both use exactly the same window position, size and style. Both are written to cover the screen completely, even when using "Windowed = true".

In the latter game, to vsync and avoid tearing, my code waits until a certain scan line is passed. My tests showed: On different PCs it has to wait for different scan lines to avoid tearing completely. This is a drawback, since it has to be tweaked individually by the user. Is this technique used in any games?

And, compared to this technique, why does DirectX produce a display lag when "Windowed = false" is used with D3DPRESENT_INTERVAL_ONE?

To clarify where the lag occurs:

Windowed = false + INTERVAL_ONE => LAG

Windowed = false + ...IMMEDIATE    => no lag

Not mentioned in the question but tested:

Windowed = true;  + INTERVAL_ONE  => no lag, tearing

Windowed = true; + ...IMMEDIATE     => no lag

sentences:
Should I use an abstract class or function pointer to implement component notifications? I want to create a component-based game engine with subsystems which do the work, entities which are simply a list of components (plus position and rotation, because every object will have that), and data.

In addition I want the subsystem to create the components for the entity (the entity has a list of component types and the subsystem creates them). The subsystem has to be notified if an entity is added to the world. I think the best way is the observer pattern: my scene manager notify every subsystem.

This is where I got stuck. When the scene manager notifies, should this be a function pointer or a abstract system class with handle message? In the first case, how can I get this work with a variable count of parameters?

This approach with an abstract class is not my favorite, I think function pointers may be better. Consider this case: my position component will be edited from the position system, so my system or my component have to notify the render system.

Given my above requirements, what should I do to deal with these notifications?

sentences:
Unexpected Execution Order in Unity (uNet) I made a little game in Unity. It works fine in the Editor. But if I run the build version I get a NullReferenceException.

This problem does only appear if the build-version-client hosts the game.

No problems if the BUILD-version plays as client or server only.
No problems when played in EDITOR

I have a class (CharacterSpawner) that is meant to run on the server only.

public static CharacterSpawner instance;

...

public void Awake()
{
    instance = this;
    print("Character Spawner Awake");
}

[Server]
public void SpawnCharacter(NetworkConnection owner)
{
    GameObject character = Instantiate(characterPrefab, randomSpawnPoint, Quaternion.identity) as GameObject;
    NetworkServer.SpawnWithClientAuthority(character, owner);
}

I have another class (Player) that should send a Command to the server in order to spawn a character right at the beginning.

void Start()
{
    if (isLocalPlayer)
    {
        CmdSpawnCharacter();
    }
}

[Command]
public void CmdSpawnCharacter()
{
    CharacterSpawner.instance.SpawnCharacter(connectionToClient); // throws NullReferenceException
}

'instance' is here the only thing that could cause the NullReferenceException, because connectionToClient would not cause a NullReferenceException even if it was null! This means the instance is not set yet.

As problem I can think that the Start-method in the Player-script is called before the Awake-method in the CharacterSpawner Script. Because if I call CmdSpawnCharacter like this:

Invoke("CmdSpawnCharacter", 0.5f);

It works perfectly, but that is not the way I want to do this.

I even changed the priorities of the scripts, but without success.

QUESTION: Why does Start() gets called before Awake() gets called? This does not line up with the docs http://docs.unity3d.com/Manual/ExecutionOrder.

sentences:
Behaviour Trees: How to clean up when a sequence is interrupted? I'll try to show my problem on a minimal example, in reality it's more complex:

It's a simple behaviour, that repeats "an action" that has a certain animation. If a player gets close, this sequence gets interrupted and the AI executes the "Flee" action.
The interruption happens because the top level selector is "dynamic" which in Unity/NodeCanvas means, that its higher priority nodes get executed every frame and if they succeed they interrupt the lower priority ones.
My problem is shown via the red arrow - if the "action" gets interrupted, the clean up (in this case "stop animation") doesn't execute.
What is the best practice to handle the clean up? Is my setup flawed? Or should I just be using a different interrupting mechanism?
Thanks for any help!

sentences:
Mapping rectangular texture on trapezoid-like shape I have a problem with rendering rectangular textures on non-rectangular surfaces. While googling, I found a thread with person having a pretty similar problem: http://www.gamedev.net/topic/419296-skewedsheared-texture-mapping-in-opengl/

But in my case, I cannot be sure about surface's exact properties. It's not regular trapezoid, it can be slightly bent. Which means, that I cannot just calculate correct texture matrix, or at least I don't know how.

I've tried to render triangle fan-like shape, but it just changed the characteristics of final distortion.

sentences:
How collision boxes are assigned to object in 3D games? Level designers make levels and then programmers import the models and use it but How and when collision boxes are generated for objects and models in the 3D map placed at random locations?

Thanks.

sentences:
I need advice on creating animal 3D walk cycles in XNA I want to purchase a number of 3D models from TurboSquid and animate them in an XNA game.

I wrote a lot of games from 1985-1999 and have recently become involved with XNA. Now I would like to port one of my old games to the XBOX. I do have a background in 3D animation; but that was years ago.

What is the current method for animating a walk cycle with a 3D model and using it inside XNA?

Is there a book, software or a tutorial that you can recommend?

Thanks in advance and sorry for such a broad and currently naive question.

sentences: Top down water view, cocos2d Has anyone successfully created a top down view of a stream/river? I need to also work out how to make it look like a boat is cutting through the water.

sentences:
How do I get a table of AABB's? I am not sure if this is the right site to put this question on.

What would be a good, time saving method to reference an AABB with an integer id in Java programming language?

AABB class:

public class AABB {
private EndPoint[] min = new EndPoint[3];
private EndPoint[] max = new EndPoint[3];
private int entityId = 0;
private Boolean isStatic = false;
private static Map<Integer, AABB> table = new HashMap<>();
private Vector3f pos;
private int id = 0;

public AABB(Vector3f min,Vector3f max,Vector3f pos,int entityId,Boolean isStatic) {
    this.min[0] = new EndPoint(true,pos.x - min.x,id);
    this.min[1] = new EndPoint(true,pos.y - min.y,id);
    this.min[2] = new EndPoint(true,pos.z - min.z,id);

    this.max[0] = new EndPoint(false, pos.x + max.x,id);
    this.max[1] = new EndPoint(false,pos.y + max.y,id);
    this.max[2] = new EndPoint(false,pos.z + max.z,id);
    this.pos = pos;
    this.entityId = entityId;
    this.id = UniqueIdentifier.nextInt();
    this.isStatic = isStatic;
}
public static AABB setAABB(AABB aabb) {
    return table.put(Integer.valueOf(aabb.getId()), aabb);
}

public static AABB getAABB(int id) {
    return table.get(Integer.valueOf(id));

}

public static AABB getAABB(EndPoint endpoint) {
    return getAABB(endpoint.getId());

}

@Override
public boolean equals(Object arg0) {
    if(arg0 == this) {
        return true;
    }
    if((arg0 == null) || !(arg0 instanceof AABB)) {
        return false;
    }

    AABB aabb = null;
    try {
        aabb = (AABB) arg0;
    } catch (ClassCastException e) {
        return false;
    }

    return ((aabb.getMax() == getMax()) && (aabb.getMin() == getMin()) && (aabb.isStatic() == isStatic || aabb.isStatic().equals(isStatic())) && (aabb.getPos() == getPos()) && (aabb.getId() == getId()) && (aabb.getEntityId() == getEntityId()));

}

@Override
public int hashCode() {
    int hash = 17;
    hash += 5 * ((Boolean) isStatic).hashCode();
    hash += 5 * ( min == null ? 0 : min.hashCode());
    hash += 5 * ( max == null ? 0 : max.hashCode());
    hash += 5 * ( pos == null ? 0 : pos.hashCode());
    hash += 5 * id;
    hash += 5 * entityId;
    return hash;
}

}

SAP class:

 public class SAP {
public static List<EndPoint> xaxis = new ArrayList<>();
public static List<EndPoint> yaxis = new ArrayList<>();
public static List<EndPoint> zaxis = new ArrayList<>();
private SAP() {}

public static void addObject(AABB aabb) {
    if(!PairManager.isInPairs(aabb)) {
        xaxis.add(aabb.getMax()[0]);
        xaxis.add(aabb.getMin()[0]);

        yaxis.add(aabb.getMax()[1]);
        yaxis.add(aabb.getMin()[1]);

        zaxis.add(aabb.getMax()[2]);
        zaxis.add(aabb.getMin()[2]);

                    // Where i set table
        AABB.setAABB(aabb);
    }
}

private static boolean  intersects(AABB a,AABB b, int axis)
{
            // Where exeption is thrown a and b == null
    return !(a.getMax()[axis].getValue() < b.getMin()[axis].getValue() || b.getMax()[axis].getValue() < a.getMin()[axis].getValue());
}

private static boolean intersects(AABB a,AABB b) {
    return intersects(a,b,0) && intersects(a,b,1) && intersects(a,b,2);
}

}

sentences:
What are the legal considerations about making a game with a dynamic age restricted content? What I mean by this is - is it legal to make a game which asks (or proves) your age during install or on initial load, and then dynamically sets the content to the players age.
For example if the players is under-age then all swear word assets are replaced with there PG13 equivalents.
Or the same with blood and gore.

Does this make sense?
Also what are the communities opinions or feelings about this?
(note for locality I am referring to UK law but laws and opinions for any other country is encouraged!)

(ps i can't create tags)

sentences:
how can I transform a skewed line to a vertical line? So, I have a line:

And I skewed it with x += y * cos(angle)

and got something like:

My question is, if I have another line segment with that same skew, how can I transform it so that it is pointing up again like:

I tried just applying a rotation (reverse of the skew angle) to the line's x,y coordinates, but that did not seem to give me the effect I am going for.

How can I do this?

EDIT

So, if I start with a rectangular like:

and I apply:

x1 = x1 + (y2 - y1) * cos(angle);
x2 = x2 + (y2 - y1) * cos(angle);

I get:

I am not quite clear why my x1 is wrong? (as you can see, it extends outside of the rectangle)..

But, regardless of that, this still is not the direction I am trying to skew by... What I really want is something that looks like this:

sentences:
Is there a free and open source 3D engine for Android? Is there a free and unlimited open source 3D engine for Android? Something that is a direct, thin layer to the NDK?

I have only found two engines: Unity and Shiva 3D. But no free or open source ones.

sentences:
Why is my FPS computation yielding higher numbers than I expect? I have following code:

void Game::execute()
{
    isExit = false;
    init();

    double dt = 1.0 / 60.0;
    boost::timer timer;
    double accumulator = 0.0;

    boost::timer fps_timer;
    int fps = 0;
    while (isExit != true)
    {
        handleEvent();
        accumulator += timer.elapsed(); timer.restart();
        while (accumulator > dt)
        {
            accumulator -= dt;
            handleEvent();
            update(); // updating physics
        }
        if (fps_timer.elapsed() > 1.0) //if 1 second is elapsed
        {
            fps_timer.restart();
            m_fps = fps;  //m_fps - is result, which is rendered
            fps = 0;
        }
        else fps++;
        render(); // main rendering command
    }
}

And usually m_fps is equal 300-400. But I expect to see 30-60. Where I did wrong?

sentences:
Low traffic client synchronization with server in MMO I am implementing MMO where player flies in space on his starship controlling it with arrow keys and cooperate with other players.

I want to implement it so that player will be able to dodge his ship from rocket or something else, so I am trying to predict whole game state on client side using the same world simulating algorithm as server use. That game world is written on C# and will be called within client directly (it's written on Unity3D) and through CLR on C++ server (under Linux). Connection through UDP.

Problem is how to maintain, for example, 1000 players within single map (exclusing all other game objects, mobs...):
Let's say I will:

synchronize server with clients 50 times per second
send to each client states of just that game objects (and players) which he is able to see (within some radius)
have to send 100 objects to each player within his view radius
must send averagely 50 bytes per game object (it's id, x,y coords, rotation, state...)

so, it will need to have such network bandwidth: 1000 (clients) * 50 (times per second) * 100 (objects to send to each player) * 50 (bytes per object) = 250 000 000 bytes per second! It's impossible!

Is it possible to reduce this value somehow? For example let clients to fully simulate their game worlds (for a long period of time) and send them just inputs of other clients and synchronize game worlds, let's say, each several seconds but it will cause weird desynchronization issues at leash because of float computations.

Anyway, how such games are programmed in common way? Thank you.

sentences:
Building placement in tilemaps (pattern matching) I'm building a small RTS and in my code I've given my buildings a pattern, much like you would pieces in tetris, i.e. I want to place irregularly-shaped buildings on a map without overlaps.

The map could be 100x100 and my structure that I'm placing could be as follows:

OXO
XXX
XXX

I'm currently bruteforce-checking each building cell individually against cells in a map.

Is there an easier/nicer way to check a tile map for a matching pattern?

sentences:
How would I go about creating my own SDK to allow users to develop their own addon mods? I am looking into developing a game, but I am very interested in the more abstract concepts such as modding. I would like to know, or get linked to information detailing the prerequisites, architecture and general idea behind, how I would develop an add-on mod support with a language such as C++ or C# specifically, although any language will be fine.

The mod would work alike to Minecraft, it adds onto the current game giving more content, but doesn't change any base code.

I'd love some detailed answers and I am more than happy to clarify anything that I didn't explain well or if I didn't provide enough information.

sentences:
Unity and Apple TV Remote control sensitivity I'm developing a game for Apple TV and I'm responding to the swipe gesture using

if (Input.GetKeyUp(KeyCode.Joystick1Button4)){
   DoSomething();
}

But the problem is that this is too sensitive, and triggers when the player didn't intentionally swipe. Is there any way to set the sensitivity?

sentences: How to draw a circle with WebGL using GL_POINTS I'm trying to draw a circle using simple vertices points and a big gl_PointSize value. I found this example and try to reproduce it on WebGL with no success.

sentences:
Compute world position by walking N units along spline? My goal is to move ahead along a spline 'x' world units, unfortunately there is no way to map spline points to world points.

What I do is I iterate along the spline by a small alpha amount (say 0.001), get the new spline point vs the old one and add the difference to a total up until it equals or is slightly greater than the distance I wanted to move in world space.

This works fine but there is a huge bottleneck with the sqrt, basically to calculate the distance between two vector points you need to do a square root calculation.

I feel it should be possible to just get the squared value and just use that, unfortunately I can't get the code working, here is what I have:

Where _distance is the amount to move, Distance is the alpha value along the spline.

        float distanceMoved = 0;

        float oldDistance = Distance;

        while (distanceMoved < (_distance))
        {
            Vector3 before = Position;
            float oldAlpha = Alpha;
            float oldDist = Distance;
            Distance += _iteration;

            distanceMoved += (before - Position).magnitude;
        }

Notice the line with (before - Position).magnitude, the .magnitude property performs a square root.

I've tried changing it to .sqarMagnitude and say distanceMoved < distance * distance but it has accelerated the rate of movement forwards.

Any ideas what is going wrong or how I can get rid of the square rooting or do this differently entirely?

sentences:
Collision in EdgeCollider Unity I want to make a collider for a line that I've drawn on the screen using mouse. so the detection should be cover the whole line that has drawn.

What I've learned from edge collider is you can have collider if you assign the position of a certain point in col.transform.position (for example I can assign the startpos of my line and the collider works only for that point).

the green line which is drawn by mouse in front of car is using the LineRenderer and requires EdgeCollider to be a road that car can drive on it's surface

and my functions:

private LineRenderer line; // Reference to LineRenderer
private Vector3 mousePos;
private Vector3 startPos;   // Start position of line
private Vector3 endPos; // End position of line
public Material material;

void Update()
{
    // On mouse down new line will be created
    if (Input.GetMouseButtonDown(0))
    {
        if (line == null)
        {
            createLine();
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(0, mousePos);
            startPos = mousePos;
        }
    }
    else if (Input.GetMouseButtonUp(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
            endPos = mousePos;
            addColliderToLine();
            line = null;
        }
    }
    else if (Input.GetMouseButton(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
        }
    }
}
// Following method creates line runtime using Line Renderer component
private void createLine()
{
    line = new GameObject("Line").AddComponent<LineRenderer>();
    line.material = material;
    line.SetVertexCount(2);
    line.SetWidth(1.1f, 1.1f);
    line.SetColors(Color.black, Color.black);
    line.useWorldSpace = true;
}
// Following method adds collider to created line
private void addColliderToLine()
{
    EdgeCollider2D col = new GameObject("Collider").AddComponent<EdgeCollider2D>();
    col.transform.parent = line.transform; // Collider is added as child object of line

    col.points[0] = startPos;
    col.points[1] = endPos;

    Vector3 midPoint = (startPos + endPos) / 2;
    col.transform.position = midPoint; // setting position of collider object
    // Following lines calculate the angle between startPos and endPos
    float angle = (Mathf.Abs(startPos.y - endPos.y) / Mathf.Abs(startPos.x - endPos.x));
    if ((startPos.y < endPos.y && startPos.x > endPos.x) || (endPos.y < startPos.y && endPos.x > startPos.x))
    {
        angle *= -1;
    }
    angle = Mathf.Rad2Deg * Mathf.Atan(angle);
    col.transform.Rotate(0, 0, angle);
}

btw i don't know what that col.points[] used for. I just found it from the unity documentation which won't make any collision

sentences:
Raycast is not restricting by other layer collider I have converted my project to URP and suddenly I found the situation where my Raycast code even is working beneath the collider (other layer colliders):
if (DisplayMessage.Click && Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 1000f, layermask))

I corss check the signature of raycast it is fine and the collider it self. Is there any changes in URP? Here is the way i am setting the layer:
int layermask => LayerMask.GetMask("Interact");

Scenario: In my scene, I have a plane (Default Layer) and a cube(Interact layer). The cube is beneath the Plane. But my camera Detecting the cube on mouse pointer and bypassing the Floor. The raycast should acctually not work if there any object of the desired layer.

sentences:
How to prevent/"reverse" displacement from a collision? In my game I can throw a hammer. The hammer moves based on physics in Unity.
The hammer destroys the first object it touches. I want it to continue moving as though it didn't touch anything when this happens.
To try and achieve this, I made it destroy objects using a separate, larger trigger collider, intending to destroy the object before the physical collision occurs.
However, when moving at very high speeds (as in the GIF), both colliders hit at once, so the hammer moves and the object deletes.

How can I prevent the hammer from moving when/before the trigger occurs, or (I suppose more realistically) "reverse" the movement such that there's no perceptible collision?

I tried using the impulses from each of the contacts in the collision to apply forces in reverse, but didn't really understand what I was doing and ultimately failed.

NOTE: I cannot simply disable the physics collider, because it doesn't destroy everything.

sentences:
Pygame Scrolling Map I have two questions.

I'm working in a rogue-like and I've manage to implement a camera on the player, the camera shows just the players surroundings and is fixed in the side of the windows.

The problem is, when the player is close to the sides of the map there's a black space in the surface.
Like so:

1) How do I make the camera 'snap' to the side and don't go any further?

To draw the map

I took the Camera Rect positions [topleft and bottomright];
Converted it to World Position;
Iterate over it, with a enumerator too;
Did any lit/visited FOG calcunations with X and Y;
And Blited in the screen using the enumerators 'i' and 'j'.

Here's the code:

topleft = Map.toWorld(camera.rect.topleft)
bottomright = Map.toWorld(camera.rect.bottomright)
for i, x in enumerate(xrange(topleft[0], bottomright[0])):
    for j, y in enumerate(xrange(topleft[1], bottomright[1])):
        tile = mymap.tileAt(x, y)
        object = [obj for obj in Object.OBJECTS if obj.pos == (x,y)]
        if tile:
            lit = field_of_view.lit(x, y)
            visited = field_of_view.visited(x, y)
            graphic = tile.graphic
            if lit:
                color = tile.color
            elif visited:
                color = GRAY
            else:
                color = BLACK
            renderedgraphic = myfont.render(ch, 1, graphic)
            screen.blit(renderedgraphic, Map.toScreen((i + 1, j)))
        if object:
            Draw.drawObject(object[0], Map.toScreen((i + 1, j)))

I saw HERE a exemple of this but I couldn't adapt the code to my game because it uses sprites.

I also tried a different approach using just a camera.center position:

in short:

class Object():
    def update(self):
        self.relX = self.x - camera.x
        self.relY = self.y - camera.y

class Camera(Object):
    def update(self):
        self.x = self.relX = PLAYER.x
        self.y = self.relY = PLAYER.y

def MapDraw()
    for x in xrange(mymap.width):
        for y in xrange(mymap.height):
            ... # do fov stuff
            tile = Tile.At(x, y)  # get tile instance
            if tile:
                tile.update() # update it's relative position
                screen.blit(renderedgraphic, (tile.relX * TILESIZE, tile.relX * TILESIZE)) # blit the postion to it's relative position

This is what happens:

which leads to the next question:

2) Is there a better way to create a camera than using this 'hack' of enumerating?

EDIT: Answer

So after some struggles I tried the old, print whatever I had and found out that I could use the camera.x and camera.y for this.

first I check the distace between camera.x and the optional position in the sides, It was 3 for up and down, 7 to sides.

Then a couple of if-statements fixed this. But since int's aren't very consitent depending on mapsize, cameraview, I found that the camera.rect width and height divided by 2 in world position was the same as (7,3) I was looking for.

Anyway, here's the code for the camera.

def update(self):
    self.x, self.y = PLAYER.pos # center camera on player

    self.size = Map.toWorld((camera.rect.width, camera.rect.height)) ## get the ScreenSize of the rect and convert to World Position
    self.size[0] /= 2 # divided each one by two, because the player is in the center.
    self.size[1] /= 2

    if self.x < self.size[0]:  # right
        self.x = self.size[0]
    if self.y < self.size[1]: # up
        self.y = self.size[1]
    if self.x + self.size[0] > mymap.width: # left
        self.x = mymap.width- self.size[0]
    if self.y + self.size[1] > mymap.height: # down
        self.y = mymap.height-self.size[1]

    self.rect = pygame.Rect((self.x * TILESIZE) - CAMERA_WIDTH / 2,
                            (self.y * TILESIZE) - CAMERA_HEIGHT / 2, CAMERA_WIDTH, CAMERA_HEIGHT) # updated the rect

Thanks Tyyppi_77, even tho you provided a small answer, the way you phrased it was just right for me to get it.

sentences:
Extract formula from vector drawing I am creating a game with HTML5 canvas for browser. I want to create animations with many shapes, which would be drawed with canvas, not from spritesheets.

The problem i face now is - to create formulas for so many shapes. I need them resizeable, also different width/height ratio. I was drawing chess pawn, but took 1 week to complete it right using arc's.

This is that pawn formula:

function pawn_shape(ctx, xx, yy, fill, stroke, grid_size) {
  var g = grid_size / 100;
  g *= 0.8;
  ctx.lineWidth = grid_size / 10;
  xx += g * 12;
  yy += g * 10;
  ctx.fillStyle = fill;
  ctx.strokeStyle = stroke;
  ctx.lineJoin = "miter";

  ctx.beginPath();

  var x = xx + 50 * g;
  var y = yy + 25 * g;
  var radius = 10 * g;
  var startAngle = 0.8 * Math.PI;
  var endAngle = 2.2 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 55 * g;
  y = yy + 48 * g;
  radius = 15 * g;
  startAngle = 1.6 * Math.PI;
  endAngle = 2.4 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 50 * g;
  y = yy + 97 * g;
  radius = 35 * g;
  startAngle = 1.7 * Math.PI;
  endAngle = 1.955 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 30 * g;
  y = yy + 92 * g;

  ctx.lineTo(x, y);

  x = xx + 50 * g;
  y = yy + 98 * g;
  radius = 35 * g;
  startAngle = 3.055 * Math.PI;
  endAngle = 3.3 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);

  x = xx + 45 * g;
  y = yy + 48 * g;
  radius = 15 * g;
  startAngle = 2.6 * Math.PI;
  endAngle = 3.4 * Math.PI;

  ctx.arc(x, y, radius, startAngle, endAngle);
  ctx.stroke();
  ctx.fill();
  ctx.closePath();
}

This is only 1 pawn. I need many more figures as configurable formulas.
What would be the ways to get faster such formulas?

So far I am thinking about a new open source project, where people could draw shapes and these would be converted into such formulas. Or maybe even extract formulas from simple images, like programs do image to vector.

Another idea was to find out how does normal vectors work - what formulas they have. Maybe i could reuse and modify that? No idea, hoping to find answer here..

sentences:
Facial expressions capabilities in various engines For a research project, I am developing a small game focused on non-verbal communication clues, like facial expressions (smiling, frowning, looking bored, etc), eyegazing, proxemics, etc. My main issue is facial expressions, as I can't find detailed info on various engines capabilities on that point.

I usually believe that the engine/language used doesn't matter, as you can more or less do anything with any engine/language, but in this case I need something as efficient as possible (I am time limited).

I have reduced my options to 4:

UDK
Unity
Skyrim Creation Kit
Source Engine

So, what are the capabilities of these 4 regarding facial expressions? And let's be honest, in which of them are they the easiest to implement/manipulate?

If there is another engine more appropriate, I'll be glad to hear about it too.

Thanks!

sentences:
OpenGL: glGetError() returns invalid enum after call to glewInit() I use GLEW and freeglut. For some reason, after a call to glewInit(), glGetError() returns error code 1280. Reinstalling the drivers didn't help. I tried to disable glewExperimental, it had no effect. Code worked before, but I am not aware of any changes I could possibly make.

Here's my code:

int main(int argc, char* argv[])
{
    GLenum GlewInitResult, res;

    InitWindow(argc, argv);

    res = glGetError(); // res = 0

    glewExperimental = GL_TRUE;
    GlewInitResult = glewInit();

    res = glGetError(); // res = 1280

    glutMainLoop();

    exit(EXIT_SUCCESS);
}

void InitWindow(int argc, char* argv[])
{
    glutInit(&argc, argv);

    glutInitContextVersion(4, 0);
    glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
    glutInitContextProfile(GLUT_CORE_PROFILE);

    glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,
    GLUT_ACTION_GLUTMAINLOOP_RETURNS);

    glutInitWindowPosition(0, 0);
    glutInitWindowSize(CurrentWidth, CurrentHeight);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);

    WindowHandle = glutCreateWindow(WINDOW_TITLE);

    GLenum errorCheckValue = glGetError();

    if (WindowHandle < 1)
    {
        fprintf(stderr, "ERROR: Could not create new rendering window.\n");
        exit(EXIT_FAILURE);
    }

    glutReshapeFunc(ResizeFunction);
    glutDisplayFunc(RenderFunction);
    glutIdleFunc(IdleFunction);
    glutTimerFunc(0, TimerFunction, 0);
    glutCloseFunc(Cleanup);
    glutKeyboardFunc(KeyboardFunction);
}

Could someone tell me what I am doing wrong? Thanks.

sentences:
Unity Matrix4x4 to rotate a point around a pivot / axis I need the Matrix4x4 to rotate around a given axis that does not go through (0,0,0). Is there some built in straightforward way to do this in the Unity libraries, or do I need to build and maintain my own?
Below is the formula I'd use to build my own in case somebody needs it:

We will define an arbitrary line by a point the line goes through and
a direction vector. If the axis of rotation is given by two points P1
= (a,b,c) and P2 = (d,e,f), then a direction vector can be obtained by ⟨u,v,w⟩ = ⟨d-a,e-b,f -c⟩. [...] Assuming that ⟨u,v,w⟩ is a unit vector
so that L = 1, we obtain [...]

Source

I do need the rotation Matrix, not just the rotation. If I didn't need the Matrix I could use (not tested, may contain flaws, but you get the idea):
public Vector3 RotatePointAroundAxis(Vector3 point, Ray axis, float rotation) {
    return Quaternion.AngleAxis(rotation,axis.direction) * (point - axis.origin) + axis.origin;
}

So far the best I've got is the equivalent of the above (not tested, may contain flaws, but you get the idea), but it looks quite wasteful:
public Matrix4x4 RotationMatrixAroundAxis(Ray axis, float rotation) {
    return Matrix4x4.TRS(-Axis.origin, Quaternion.AngleAxis(rotation, Axis.direction), Vector3.one)
         * Matrix4x4.TRS(Axis.origin, Quaternion.identity, Vector3.one);
}

sentences:
Flexible projectile system? Projectiles need to accommodate timed, homing, linear, and arced behaviours and have single, cone, and splash effects on hit. What is a good pattern to accommodate these different behaviours that require different parameters?

I want a system where I can call something like ProjectileManager.Fire (*Projectile Parameters*) from anywhere and have a projectile get fired. How would parameters like timeToDetonate, coneAngle, and aoeRadius be handled in a user-friendly way?

sentences:
Unity3D Orbit around orbiting object (transform.RotateAround) The best way to explain this is I'm attempting to make a small model solar system (not to scale or anything complicated, just simple rotation as a learning exercise). There's a sun, a planet, and that planet's moon. The planet orbits like normal, however the moon orbiting around the planet shoots off and makes an extremely large and far-away orbit.

My code is as follows (where "target" is the object being orbited around, and "transform"  is the orbiting object itself. Both are "Transform" objects.):

public class RotateAndOrbit : MonoBehaviour {
    public Transform target;
    public float RotationSpeed = 100f;
    public float OrbitDegrees = 1f;
    void Update () {
       transform.Rotate(Vector3.up, RotationSpeed * Time.deltaTime);
       transform.RotateAround(target.position, Vector3.up, OrbitDegrees);
    }
}

I'm not sure how to compensate for this or even what my mistake is called, but any help would be appreciated.

sentences:
How to use 3D transformation matrices with GLM old version that has simd functions I need matrix 3D transformation, model transformation i.e scale-rotate-translate and then that model into world space so model-projection-view matrices.

I need it with GLM specified simd vectors and matrices according to their old version.
But I can only find transformation functions without simd vectors or matrix in examples like this

#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
{
glm::mat4 Projection = glm::perspective(glm::radians(45.0f), 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
return Projection * View * Model;
}

I need it something like this

 glm::detail::fmat4x4SIMD MatrixMultiply()
    {
        glm::detail::fmat4x4SIMD m(1.0f);
        glm::detail::fmat4x4SIMD m1(1.0f);
        m1 = m1 * m;
        return m1;
    }

But If I try to give glm::lookAt, glm::rotate with fvec4SIMD/fvec4x4SIMD it gives me error that these built in functions does not support simd.

Any idea how to do this?

sentences:
Does Unity3D custom shader use its default GPU or CPU skinning automatically? I'm writing my own shader in mobile, but was wondering if it uses default GPU or CPU skinning feature in Unity3D?

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

My shader is as below:

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

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

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

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

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

     struct Input {
         float2 uv_MainTex;
     };

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

 FallBack "Mobile/VertexLit"
 }

sentences:
Kinetic scrolling in AS3 I have a container movieclip that contains my "game" and I would like to be able to drag the "camera" (i.e. the container clip) around, but I need it to have kinetic movement, i.e. feel more like native dragging and scrolling on an iOS device.

I can't seem to find anything that deals with this properly and in the manner that I am looking for, and I also would prefer to stay away from using any 3rd party packages if there are licenses involved. This is for personal side projects that may or may not see a form of commercial release, so I would rather a) learn how to code this myself and b) not have to rely and pay for third party libraries.

Any help would be greatly appreciated.

Thanks!

sentences:
3d rotation of a Gunner unit to shoot the target I'm developing a scenario to shoot incoming targets by a specific gunner unit, however I'm confused to actual logic of shooting an object with a gun. I'm working in 3D environment.
I'v target's position vector i.e [x,y,z] and its rotation vector [x,y,z,angle], and also Gun's position vector i.e [x,y,z] and its rotation vector [x,y,z,angle]. The gun has two components, i.e a TopDondur and a set of Barrels, both components have the rotation along y-axis, i.e only angel of rotation vector [0 1 0 angle] is required to move the Gunner Unit to the target.

What rotataions shuould give the Gunner unit to rotate both TopDondur and Barrels, i.e TopDondur rotates to the target and Barrels are to move up/down with respect to that target.

sentences:
Rendering tiles at a larger size for a detailed look I'm trying to make my 32-bit tiled map become more "zoomed" in. However, I experience an error that I can't resolve. Firstly, I followed this post on how to render the tiles larger.
This is my code (close to identical to the code in the other post):
class TiledMap:
    def __init__(self, filename):
        tm = pytmx.load_pygame(filename, pixelalpha=True)
        self.width = tm.width * tm.tilewidth
        self.height = tm.height * tm.tileheight

        self.tmxdata = tm

    def render(self,surface):
        ti = self.tmxdata.get_tile_image_by_gid
        for layer in self.tmxdata.visible_layers:
            if isinstance(layer,pytmx.TiledTileLayer):
                for x,y,gid in layer:
                    tile = ti(gid)
                    tile = pg.transform.scale(tile,(64,64))       <---------- Line that gives Error
                    if tile:
                        surface.blit(tile,(x * 64, y * 64))

    def make_map(self):
        temp_surface = pg.Surface((self.width, self.height))
        self.render(temp_surface)
        return temp_surface

The error that is produced is:
tile = pg.transform.scale(tile,(64,64))
TypeError: argument 1 must be pygame.Surface, not None

I'm suspecting that some tile that its trying to render simply is empty. I've tried a separate smaller map but the issue persists. Is it the tileset? They've all been processed through the program Tiled where they were initially part of one png.
If anyone knows a possible solutions I'll gladly try one. Or any other methods that could make it more zoomed in...

sentences:
How do I calculate the visible area of a big isometric map? I have a simple isometric map of 128px x 128px, tile in a 2D field [xxxx][xxxx] I have a problem with my calculating. I need to get startx:[0], startY[0] and endX[20], endY[10], if I know the screen width and height, and the camera offset like this:

(not effective for big maps)

This is my current code:

starti = (-camera.xOffset - tileWidth) / 64;
int endi = (-camera.xOffset + camera.width + tileWidth) / 64;
int startj = (-camera.yOffset - tileHeight) / 64;
int endj = (-camera.yOffset + camera.height + tileHeight) / 64;

Point start = twoDToIso(new Point(startx,starty));
Point end = twoDToIso(new Point(endx, endy));
for (int i = start.X; i < end.X; i++)
{
    for (int j = start.Y; j < end.Y; j++)
    {

This does not work; it will create something like this:

It does something, but when I move and my offset is changed, it does not work at all. How do I calculate the visible lines on a big isometric map?

sentences:
Determine if the player should be able to interact with a door You know the drill, standard first person door mechanics. How do they do it?

My most noticeable and frustrating problem is when there is a door within range and in view, but the closest door is actually behind the player.

I'm aware of the "dot product trick" but say the player position is point 1, what is point 2? The center of the doors bounding box? The center of the open door way?

Any insight would be gold.

sentences:
How to draw a Bezier line with shaders? I found a shader code to draw a filled Quadratic Bezier in

https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch25.html

How can I use something similar to draw a Bezier line that follows the same path?

sentences:
How can I render a shiny, metallic surface? I am creating a game for which I want to render a kind of shiny black metallic surface with some refection property in it. I know that there would be something related to masks involved with it. But somehow I am not able to get started on it.

So could someone give me insight in the matter or give a link to a good tutorial?

sentences:
C++ friend class, rendererer and mesh I often hesitate to use friend classes in C++. Since it often does not feel right, or just seems to be an indicator of bad design. Though, in this case I think a friend class might improve the design. Let me explain:

Let us say I have a very simple mesh class:

class Mesh {
    friend class Renderer;
public:
    using Vertices = std::vector<Vertex>;
    Vertices::iterator begin() {
        return vertices_.begin();
    }
    Vertices::iterator end() {
        return vertices_.end();
    }
    void invalidate(){
        valid_ = false;
    }

private:
    Vertices vertices_
    bool valid_;
}

The renderer looks something like this:

class Renderer {
public:
    void render(Mesh & mesh){
        if (!mesh.valid_){
            //The mesh has changed, update internal data.. GL buffers etc.
            mesh.valid_ = true; // Mesh becomes valid again.
        }
        //render...
    }
}

So, this is of course a very simplified example. My question is, if this is a good design in this case? Clients can only call invalidate() on meshes. And only the renderer is allowed to "validate" a mesh again. Without a friend class, A public setter would have to be used in the Mesh class. Hence providing a "leaky" interface. Allowing clients to "validate" meshes, which I do not want.

Edit to clarify

A valid mesh in this sense means that its corresponsing data in other subsystems is the same. The renderer has its own mesh data in its own form (a GL buffer). Therefore, only the renderer should be able to validate, since it knows about its own mesh data. Clients can edit meshes, and invalidate them only.

sentences:
Correct order of operations when enabling/disabling Cg shaders in OpenG I've started writing an Effect class which uses Cg shaders in OpenGL and I'm a bit confused about the order of operations when creating and rendering using Cg.

Currently, my Effect class contains CGprogram, CGprofile and an array of CGparameter variables which get populated on loading the Effect similar to this:

m_vertexProfile = cgGLGetLatesProfile(CG_GL_VERTEX);
cgGLSetOptimalOptions(m_vertexProfile);
m_vertexProgram = cgCreateProgramFromFile(g_cgContext, CG_SOURCE, fileName, m_vertexProfile, entryPointName, NULL);
cgGLLoadProgram(m_vertexProgram);[/color]

CGparameter param = cgGetFirstParameter(m_vertexProgram, CG_PROGRAM);
while (param)
{
    const char* paramName = cgGetParameterName(param);
    m_vertexParameters[m_vertexParamNum++] = param;
    param = cgGetNextParameter(param);
}

It's not exactly like this and this is only using a vertex shader but it contains the important code. Anyway, that's how I create the Effect and then when I want to use it during a render I use Enable() and Disable() functions before and after I draw the verts etc.

void Effect::Enable()
{
    cgGLBindProgram(m_vertexProgram);
    cgGLEnableProfile(m_vertexProfile);
}

void Effect::Disable()
{
    cgGLUnbindProgram(m_vertexProfile);
    cgGLDisableProfile(m_vertexProfile);
}

I'm not sure if this is the correct way to do it, though. Is it correct to enable and disable the profile for each shader? More to the point, do I actually want a profile per shader? I'm using the same profile for each shader so surely I could just have a global one and use that?

Any advice would be much appreciated.

sentences:
Opengl mutiple texture in a shader Im using modern opengl and c++.

How do I draw a number of triangles each one having a different texture in one draw call when I only have 32 texture units on my graphics card and the max texture size is 1024? My video card has 2gb of memory yet it can only hold 32 texture at a time?

Why do graphics cards have this limitation? I'm a c++ programmer and in c++ you don't have restrictions like that. The only restriction that you have is how much RAM you have which is fine.

sentences:
Is it considered poor programming to do this with xna components? I created my own Menu System that is event driven.

In order to have a loading screen and multithreaded loading to work, I devised this sort of implementation:

//Let's check if the game is done loading.
if (_game != null)
{
    _gameLoaded = _game.DoneLoading;
}

//This means the game is loading still,
//therefore the loading screen should be active.
if (!_gameLoaded && _gameActive)
{
    _gameScreenList[2].UpdateMenu();
}

//The loading screen was selected.
if (_gameScreenList[2].CurrentState == GameScreen.State.Shown && !_gameActive)
{
     Components.Add(_game = new ParadoxGame(this));
     _game.Initialize(); //Initializes the Game so that the loading can begin.
     _gameActive = true;
}

In the XNA Game Component that contains the actual game, in the LoadContent method I simply created a new Thread that calls another method ThreadLoad that has all the actual loading.

I also have a boolean variable called DoneLoading in the XNA Game Component that is set to true at the end of the ThreadLoad.

I am wondering if this is a poor implementation.

sentences:
UE4 Drag and Drop: Place PaperCharacter Over Image Widget I'm working on adding drag and drop functionality to my game. I have it working with the exception of I can't get what I'm dropping to be placed where it was dropped. I've tried a number of different things but I can't seem to get it to work.

The image shows my OnDrop with some leftovers of things I have been trying. And when I adjust the MakeTransform manually, a change of 1.0 seems to move the character much more than 1 pixel. The item I am creating in the OnDrop is a PaperCharacter.

Here is an image from part of the level showing the result. The white blocks circled in red are UMG images so I can eventually adjust them to look better and change dynamically as the player is dragging. The player can only drop the item over one of there squares. This functionality works. But no matter which square I drop over the item always gets placed at the point circled in green or nowhere to be seen in the viewport. This is a 2d game so everything has to be in the viewport to be seen. The white squares are attached to a PaperSpriteActor. Not sure if that matters or not.

What I need to have happen is when the player drops the item above one of the squares, the PaperCharacter must be dropped right in the middle of that square. How do I go about making that happen?

EDIT

Another observation, if I manually set the MakeTransform location to 0, 0, 0 and drop the item on the same white square multiple times, the item is dropped in a slightly different spot each time.

sentences:
How do I move an object towards a moving object? I am trying to make an AI that tries to move towards the player but I don't know how. I tried using Vector2.MoveTowards() but it just mimics my movements instead of moving towards the player. I tried everything i could think of (which was not a lot :D) but i couldn't make it move towards and touch the player! Help please :D.

Also my original code:

#pragma strict
var speed : float = 100;
var targetX : Transform;
var targetY : Transform;
var mex : Transform;
var meY : Transdorm;
function Update ()
{
var targetX = transform.position.x;
var targetY = transform.position.y;
var meX = transform.position.x;
var meY = transform.position.y;
Vector2.MoveTowards(Vector2(meX, meY), Vector2(targetX, targetY), speed);
}

sentences: drag and drop a specific image to a specific panel and picture should not drop anywhere else except in that panel hi guys i'm building a drag and drop in unity and I have panels and images so for example I want the bank image to drop in the panel that has bank text in it and that image shouldn't drop anywhere else please help

sentences:
Press and hold camera movement with mouse in new Input System? I am transitioning to the new movement system and am having trouble figuring out how to move the camera when a mouse button is pressed and held.
Here's how I did it before:
private void Update()
{
    // Get the position of the mouse when a middle click occurs
    if (Input.GetMouseButtonDown(2))
    {
        _dragOrigin = cam.ScreenToWorldPoint(Input.mousePosition);
    }

    // If the MMB is still held down, calculate the distance and move the camera
    if (Input.GetMouseButton(2))
    {
        Vector3 difference = _dragOrigin - cam.ScreenToWorldPoint(Input.mousePosition);
        cam.transform.position += difference;
    }
}

I have tried doing something similar in the new input system but it doesn't work:
public void OnMMB(InputAction.CallbackContext context)
{
    if (context.phase != InputActionPhase.Started)
    {
        // Get the position of the mouse when a middle click occurs
        dragOrigin = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
    }
    else
    {
        // If the MMB is still held down, calculate the distance and move the camera
        Vector2 newPosition = cam.ScreenToWorldPoint(Mouse.current.position.ReadValue());
        Vector3 difference = dragOrigin - newPosition;
        cam.transform.position += difference;
    }
}

Here is how I set this up inside the Input editor:

The Action Type of the action is Button.

sentences: How to create a Pixmap from an OrthographicCamera in LibGDX I am trying to create a picture based on what one of my OrthographicCamera can see. LibGDX has a ScreenUtils class that has a getFrameBufferPixels method, but it does not what I want as I want to get only what one camera sees, not the whole screen.

sentences:
How to make levels that never get old, even with a leveling system? I always get the feeling that in games with a linear plot and leveling system, players never go back to the older levels because the monsters there are too easy and the world has nothing new to offer there.

Players usually don't go visit floor 1 just for memory's sake or to remember the good times they had there. In fact, they probably forget what happened there and move on like it's nothing. For some reason, this bothers me to no end.

Is there a way to remedy that? I don't want the feeling of certain game areas to become obsolete to the player as the story progresses.

I want my game to be dynamic and ever-changing, with things to offer at every location, at every point in the player's game progress, even if one place is not at the right "level" to match with the player's current overall character levels. There should be a kind of equality, where at no point does the player tire of one place and can move freely from one place to the next. Does this sound slightly open-world ish?

This is not only for replayability, but also to provide a certain kind of elegance to the game. I feel like there is something lacking, and something that might be able to be improved, in RPGs, where the story is everything and so "old" levels are treated as second-class citizens. I was always slightly bored when I had "conquered the world" and ran through every monster like it was spaghetti.

One of the solutions I thought of is to simply update the monsters, treasure chests, items, dialogue, etc. at the old locations. Perhaps even updating the graphics would provide a visual cue that the player can have some more novel experiences there. However, isn't that essentially just changing the very nature of the location itself? The problem I have with that is that players will then forget what happened because the place itself disappeared/changed.

If anyone thinks of any good ideas, I would like to hear them. Thanks!

sentences:
How can I achieve glow effects similar to those in  WoW? I've recently implemented a glow effect using a gaussian filter and could not get the full effect I was wanting. I'm curious to know if how certain glow effects are done in WoW. Like this image:

Around the sword is a really nice glow effect. How might this be done? Also, sometimes in WoW you see these glow effects take a life of there own. Like the purple glow in this pic:

Are these accomplished with particle effects?
Are there any good resources/tutorials that could help with someone to learn how to do these effects?

sentences:
Creating LOS zones on a 2D grid for chase AI I have a 2D grid, around 20x20, stored as an array. Each grid cell can contain an opaque object or not. I also already have an algorithm to calculate LOS between any two squares via Bresenham.

I want to implement an AI that chases the player in a step-time game. The current rules I have are (re-evaluated with this priority each step):

If we can see the player go get them (a step at a time with Dijkstra/A* pathfinding).
If we can't see the player go to where we last saw them.
If we can't see the player and are where we last saw them, give up and head home.

But I want to add a further rule:

If we can't see the player and are where we last saw them, but there is only one way they could have gone to now be hidden without coming past us, go that way.

This turns out to be really hard to detect. What I have wondered about doing is to assign each grid square one or more zone numbers, such that every square that is in a given zone can see all other squares in that zone; then if there is only one neighbouring zone than the guard has not visited the guard will move into it. However, the zones overlap and a ridiculously large number of them are generated for even simple maps (due to, for example, different parts of a room gradually becoming visible as you walk down a corridor into it) which makes this awkward or difficult, and the generation algorithm seems to be at least O(n^2) or worse. Alternatively the zones could be calculated as a navigation mesh but this seems very difficult to compute from a grid map.

Is there any way to do this without manually putting hints on the map?

sentences:
Coordinate System - Movement from A to B I've got the following code snipped :

 var distanceFromDestinationSquared = (
                    Math.pow(this.orders.to.x - this.x, 2) +
                    Math.pow(this.orders.to.y - this.y, 2));
                if (distanceFromDestinationSquared < Math.pow(this.radius / game.gridSize, 2)) {
                    this.orders = { type: "float" };
                } else {
                    this.moveTo(this.orders.to);
                }

Summary :

x and y are always integers (-1, 0, 1, 2, .. )
The x and y coordinates of the destination and starting point get subtracted from each other, then the square number is taken and eventually those results are added to each other.
this.radius / game.gridSize gives you the equalent size related the coordinate system.

e.g game.gridSize = 20px - thus one field in the coordinate system is equalent to 20x20px

I've used this formula with the example of (2/2) as destination and (4/4) as starting point. As result I end up at the line if (distanceFromDestinationSquared < Math.pow(this.radius / game.gridSize, 2)) with 8 < (18 / 20)² = 8 < 0.81

What's the reason behind this apperently trivial formula of movement? Why is it important to take square number of the delta of x and y and add it together?

On one hand it avoides negative values but there would be other ways to deal more efficient with that issue.

Can someone point me to an explanation of this mathematical formula?

sentences:
Open sourcing a Unity game with assets So, I have a goal to make and publish one (small, stupid, simple) game every ~Saturday.  (I've made two, so far, thanks for asking.)  I've started in Unity, because it's convenient.  My plan for each game was to have a free version with ads, a paid version without, but also have it open sourced (and if they're willing to go to the trouble of removing the ads themselves, so be it).

Now, concurrently, I keep wandering into e.g. Humble Bundle, or Unity Asset Store sales, and picking up things I probably don't need but maybe might use.

It has just occurred to me, though, that if I'm open sourcing these games - I kinda suspect the owners of these assets aren't going to be happy with me just posting all their files on the internet.  Pretty sure I can't open source assets I've purchased.

Now, I could probably just use free assets and make note of where they came from, and everyone would PROBABLY be ok with that.  But that significantly restricts the things I can use.  (And it would be kindof a waste - you don't want to know how many ancient untouched game-dev Humble Bundles I'm sitting on, haha.)

Is there some kind of workaround?  Like, if I posted the whole project, but included a license stating that only my code was open sourced, and the rest could not be used in anything else, for instance?  Anybody know any nice solutions?

sentences:
Best way to manage in-game events? I'm working on a game where some in-game events need to happen once in a while. A nice example would be a tutorial.
You start the game, and at several points in the game an event occurs:

You encounter your first enemy, the game pauses and you receive an explanation on how to kill it.
You killed the first enemy, you receive a "good job" message.
You gain a new item, a menu with the items stats popup.
etc etc.

The game I'm working on is a puzzle game where the rules in the game are pretty much all the same, so it seems inefficient to hardcode all these events in separate levels.

Should I somehow define these events in an external source, like XML? Then write an interpreter that reads out the XML and sets the events requirements for the level?
I'm not sure how I could define an event that should occur when you killed two enemies for example.

Just to be clear, I'm not looking for the best programming language or scripting language to do this, but more at the best method to handle this.

Thanks!

Edit:
A second example since my question was pretty hard to understand:

The problem I'm having is to put some extra actions in the game in a procedure that is always pretty much the same. Like an RPG battle, everyone has a turn, picks a skill etc - it's always the same. But what if there was a case where I would like to display a cutscene somewhere in between. Modyfing the entire game structure to pass in an altered battle class with the cutscene included seems very inefficient. I'm wondering how is this usually done.

sentences:
HLSL texture not reading from register S1 I made a simple post processing shader, that draws scanlines. This all works perfectly. I wanted to make it a bit more interesting by applying a shadowmask instead so I wanted to pass a texture to the shader. From my understanding the Spritebatch sets Texture Register(S0), so I set my shadowmask texture to Texture Register(s1).

When applying the shader is seems that both S0 and S1 contain the texture I plan to draw. I have tried to set parameters in different ways- without succes. How can I pass the Texture?

My HLSL code:

sampler ScreenTextureSampler: register (s0); // This is the texture that SpriteBatch will try to set before drawing
sampler ShadowSampler: register (s1); // This is set in GraphicsDevice.Textures[1];

int colorlines = 2;
int shadowlines = 1;

//------------------------ PIXEL SHADER ----------------------------------------

float4 PixelShaderFunction(float4 pos : SV_POSITION, float4 color1 : COLOR0, float2 texCoord : TEXCOORD0) : SV_TARGET0
{
    float4 color = tex2D(ScreenTextureSampler, texCoord.xy);
    float4 maskcolor = tex2D(ShadowSampler, texCoord.xy);

    float ypos = pos.y;
    float scanline = (ypos) % (colorlines + shadowlines);
    float intensity = scanline < colorlines ? 1 : 0.20f;

    //comment out one of these two return statements...
    return maskcolor*intensity; //note this return has the exact same result
    return color*intensity;     //as this one! even though the samplers point at different registers.

}

technique Postprocessing
{
    pass Pass1
    {
        PixelShader = compile ps_4_0  PixelShaderFunction();
    }
}

This shader is loaded in an Effect called Assets.GameArt.PostProcessor. I have a shadowmask Texture2D in Assets.GameArt.shadowTexture.

My C#, Monogame code looks like this:

        gd.SetRenderTarget(null);

        sb.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, Assets.GameArt.PostProcessor, Resolution.getTransformationMatrix());

        gd.Textures[1] = Assets.GameArt.shadowTexture;

        sb.Draw(_gameRenderTarget, Vector2.Zero, _camera.Viewport, Color.White);

        sb.End();

gd points to the GraphicsDevice and sbis the spriteBatch. I first render my scene to a _gameRenderTarget.

Why isn't the Texture passed via the S1 register (or: why do the texture samplers both return the same result?)

sentences:
XNA - Drawing zoomed 2D sprites I have a tile based game. Each tile texture is loaded and then I draw each one next to the other, forming a continuous background. I actually followed this tutorial for the xml files.

http://www.xnadevelopment.com/tutorials/looksleveltome/looksleveltome.shtml

The sources of the textures are 50x50.

However, it works only it the scale is 1 (or lower), if the scale is greater

The results:

Larger size (Zoomed or 100 pixel in xml file)

We can see there are lines between the tiles, which are not in the texture. It's actually not so bad here, but in my game tileset, that's what it does:

The same effect is present whether I increase the tile size in the xml file, change the scale when drawing or use my camera to zoom.

//zoom code
public Matrix GetTransformation()
{
    return
       Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
       Matrix.CreateRotationZ(Rotation) *
       Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
       Matrix.CreateTranslation(new Vector3(_device.Viewport.Width * 0.5f, _device.Viewport.Height * 0.5f, 0));
}

//draw
_spriteBatch.Begin(SpriteSortMode.Immediate,
  BlendState.AlphaBlend, null, null, null, null,
  _camera.GetTransformation());

//for each tile
theSpriteBatch.Draw(mSpriteTexture, Position, Source,
  Color.Lerp(Color.White, Color.Transparent, mAlphaValue),
  mRotation, new Vector2(mSource.Width / 2, mSource.Height / 2),
  Scale, SpriteEffects.None, mDepth);

Is there a reason for this? A way to fix it to have a continuous texture when zoomed?

sentences:
LibGDX - how to detect touchUp with GestureListener? I'm making a game and I have implemented GestureListener as my inputprocessor. It came with a bunch of methods such as fling, pan, tap etc etc including touchDown. However, there is no touchUp method!

What I want to do is have something happen when the user does a 'fling', but I want something to happen when the user then takes their finger off the screen after flinging, probably setting a flinging boolean and testing if true when taking finger off the screen.

However, I don't see how I can get a touchUp method into my inputprocessor! Is there any work around to this or an alternative solution?

Thanks!

sentences:
What will happen at a different aspect ratio and what is the most efficient and easy way of dealing it? Let's say I have built a game for Android at the size of 480x854. If I test this on my device that has this resolution I suppose it will work and look property. But at a different aspect ratio will the game work and look good? Also, what is the most efficient and easy way to handle this?

Thanks in advance.

sentences:
Split up a screen into regions My task: I want to split up a screen into 3 regions for buffs-bar (with picked items), score-info and a game-map. It doesn't matter are regions intersect with each other or not.

For example: I have a screen with width=1; height=1 and the origin of coordinates (0;0) is the left bottom point. I have 3 functions: draw items, draw info, draw map. If I use it without any matrix transformations, it draws fullscreen, because it's vertex coordinates are from 0;0 to 1;1.
(pseudo-code)

drawItems();
drawInfo();
drawMap();

And after that I see only map onto info onto items.

My goal: I have some matrixes for transformation vertexes with 0;0->1;1 coordinates to strict regions. There is only one thing, what I need to do - set matrix before drawing. So my call of drawItems-function is like:
(pseudo-code)

adjustViewMatrixes_andSomethingElse(items.position_of_the_region_there_it_should_be_drawn, items.sizes_of_region_to_draw);
setItemsMatrix();
drawItems(); //the same function with vertex coordinates 0;0->1;1,
             //but it draws in other coordinates,
             //because I have just set the matrix for region

I know only some people will understand me, so there is a picture with regions which I need to make. Every region has 0;0 -> 1;1 inner coordinates.

sentences:
When should I set a texture as a shader resource in order to read it? I'm writing a Direct3D 11 HLSL shader with SharpDX. What I want to do is write the depth to a texture in one pass and read it in the next one. After declaring the texture, do I have to set the depth texture and the shader resource view per frame, or just once when attaching?

this.depthStencilShaderResourceVariable = this.effect.GetVariableByName("DepthTexture").AsShaderResource();
this.depthStencilShaderResourceVariable.SetResource(this.depthTextureShaderResourceView);

sentences:
XNA / Monogame Camera flickering on collision I have my camera follow my player and it works perfectly, I had some issues with collision and managed to get it working, but now my camera follows my player when it gets pushed back so the camera just flickers when holding down the button towards a collision since it's following the player! I tried to stop the camera from following the player on an axis when colliding with something but it still makes the character look weirdly bouncing from walls. This is my code:

Camera Updating

if (player.CameraFollow)
{
    Camera.IsFollowingObject = true;
    if (Camera.IsFollowingObject)
    {
        Vector2 relativePlayerpos = -player.CurrentPos;
        relativePlayerpos.X += Camera.Viewport.Height;
        relativePlayerpos.Y += Camera.Viewport.Width/2 - player.Sprite.SourceRect.Height/2;
        Camera.Pos = relativePlayerpos;
    }
}

Collision Handler

public void CollisionHandler(ref Player player, Rectangle tileRect)
{
    //push left
    int left = Math.Abs(tileRect.Left - player.CollisionBox.Right);
    //push top
    int top = Math.Abs(tileRect.Top - player.CollisionBox.Bottom);
    //push right
    int right = Math.Abs(tileRect.Right - player.CollisionBox.Left);
    //push bottom
    int bottom = Math.Abs(tileRect.Bottom - player.CollisionBox.Top);

    if (left < top && left < right && left < bottom)
    {
        player.Velocity.X = 0;
        player.Sprite.Position.X -= left;
    }
    else if (right < top && right < left && right < bottom)
    {
        player.Velocity.X = 0;
        player.Sprite.Position.X += right;
    }
    else if (top < left && top < right && top < bottom)
    {
        player.Velocity.Y = 0;
        player.Sprite.Position.Y -= top;
    }
    else if (bottom < left && bottom < right && bottom < top)
    {
        player.Velocity.Y = 0;
        player.Sprite.Position.Y += bottom;
    }
}

This is what the collision basically does:

Any help is appreciated, thank you!

sentences:
How do I correctly set up a Unity animation to move? I downloaded a custom .fbx model from the asset store, imported it to my project and placed it in my scene. I then created an animator controller and added it to the object.

To get the animations (that came with the model) into the animator tab, I dragged them onto the model in the hierarchy. I then set the one animation to default and pressed play, but in the game window, the model didn't move.

What might be going on?

The only time it did something was when I set it to "play from start" but that made it go through all the animations.

I'm quite new to Unity 4. If you need any extra information, please ask.

sentences:
Is it possible to get a Vector3 from a single Input Action in Unity's Input System? I'm trying to implement moving up/down (R/F), left/right (A/D), forwards/backwards (W/S) all at the same time using Unity's new Input System. There is an Action type for Vector3, but there doesn't seem to be a corresponding type for it.

The way movement works right now means that it would be a lot better to get the whole vector at the same time for it to work smoothly. Is there a way to do this with a single Input Action, or will I just need multiple?

sentences:
How to assign an instance of an object to an array? Game Engine: Gamemaker Studio

I am making a game similar to bejeweled. I decided to use an array to control everything. Placing instances of objects themselves in to the array seems to be the best way to accomplish this because then I won't have to check where the square is in the room, and then compare it to where in the array that lines up, and so on and so forth.

However, I can't figure out how to do that. How do I do it?

sentences:
A Quick HLSL Question (How to modify some HLSL code) Thanks for wanting to help!

I'm trying to create a circular, repeating ring (that moves outward) on a texture.  I've achieved this, to a degree, with the following code:

float distance = length(inTex - in_ShipCenter);
float time = in_Time;

///* Simple distance/time combination */
float2 colorIndex = float2(distance - time, .3);

float4 shipColor = tex2D(BaseTexture, inTex);
float4 ringColor = tex2D(ringTexture, colorIndex);

float4 finalColor;
finalColor.rgb = (shipColor.rgb) + (ringColor.rgb);
finalColor.a = shipColor.a; // Use the base texture's alpha (transparency).

return finalColor;

This works, and works how I want it to.  The ring moves outward from the center of the texture at a steady rate, and is constrained to the edges of the base texture (i.e. it won't continue past an edge).  However, there are a few issues with it that I would like some help on, though.  They are:

By combining the color additively (when I set finalColor.rgb), it makes the resulting ring color much lighter than I want (which, is pretty much the definition of additive blending, but I don't really want additive blending in this case).
I would really like to be able to pass in the color that I want the ring to be.  Currently, I have to pass in a texture that contains the color of the ring, but I think that doing it that way is kind of wasteful and overly-cumbersome.

I know that I'm probably being an idiot over this, so I greatly appreciate the help.

Some other (possibly relevant) information:

I'm using XNA.
I'm applying this by providing it to a SpriteBatch (as an Effect).
The SpriteBatch is using BlendState.NonPremultiplied.

Thanks in advance!

EDIT: Thanks for the answers thus far, as they've helped me get a better grasp of the color issue.  However, I'm still unsure of how to pass a color in and not use a texture.  i.e. Can I create a tex2D by using a float4 instead of a texture?  Or can I make a texture from a float4 and pass the texture in to the tex2D?

DOUBLE EDIT:  Here's some example pictures:

With the effect off:

With the effect on:

With the effect on, but with the color weighting set to full:

As you can see, the color weighting makes the base texture completely black (The background is black, so it looks transparent).  You can also see the red it's supposed to be, and then the white-ish it really is when blended additively.

sentences:
2D Rope with verlet and Semi-implicit Euler integration I'm trying to create 2D rope. Chain based solution is not working pretty well, so I'm looking for new approach. Every good looking rope implementation is based on verlet integration, but this method is not good for rigid body based system.
Is there any save method to combine these methods - ropes with verlet and rigid bodies with Euler?
Basic requirement for method I'm looking for is proper (or good enough) collision detection for both of simulated bodies.

sentences:
Translating object 2's movement on object 1 I am moving Object 1 with the translation of the object 2. That is, it should not copy the object 2's position, but instead moving in the same direction/angle as the object 2 is moving. I am stuck at this point where I must add a certain offset if the object is moving Left/Right/Up/Down, since it may be positive/negative floating value. So how do I add an offset to object 1's position?
The problem with the below code is that the object2 comes in position of object1 and then translates which is not what I want.
    public Vector3 offsetPosition;

    public Transform Object2;

    // Update is called once per frame
    void Update () {
        offsetPosition = Object2.transform.position - this.transform.position;
        this.transform.position = new Vector3 (Object2.transform.position.x, this.transform.position.y, Object2.transform.position.z) - new Vector3 (offsetPosition.x * 0.02f, 0, offsetPosition.z * 0.02f);
    }

sentences:
Why isn't the bitangent calculated? In teh tangent space vertex attributes why is the bitangent (aka binormal) provided as an attribute instead of calculated?

If the three vectors of the tangent space must be perpendicular then the bitangent can be calculated as the cross-product of the other two vectors. There are technically two perpendiculars here, but surely we could consistently calculate the one we want, even if it requires a boolean marker to negate it.

Similarly the bitangent itself doesn't need a full vector to be represented. From the normal alone we know the plane on which the tangent must reside. In theory a simple angle would be enough to calculate the tangent vector.

Given that GPU memory is at a premium why do we provide the full vectors for these values rather than calculating them (with reduced data input)?  Or am I wrong in assuming the tangent space must be a cartesian system?

sentences:
2D Rendering Based On Y Coordinates I'm trying to build an RPG worldbuilder. I have seperate classes for images. Like this.

Object1::Object1(int x, int y, CSDL_Setup *sdl_set, int *p_CamX, int *p_CamY)
{
    X_pos = x;
    Y_pos = y;

    MouseX = 0;
    MouseY = 0;

    CamX = p_CamX;
    CamY = p_CamY;

    Object = new CSprite(sdl_set->GetRenderer(),"data/Trees/Tree3.png", X_pos, Y_pos, 100, 200, CamX, CamY);

}

I've created a vector of objects of the class Object1 and pushing it back when I create a new image. I draw them here.

void DrawObjects()
{
    for(std::vector<Object1*>::iterator i = Object.begin(); i != Object.end(); ++i)
    {
        (*i)->Draw();
    }
}

Now the rendering is done by the order the objects are created. I want to do the rendering based on y values of each object. I did a lot of research but couldn't find any example code. I also have other classes for other images. So I tried something on my own to sort y values and detect which y value corresponds to which object. But I'm stuck here.

int a;
void DoChanges()
{
    if(ChangeMade)
    {
        a = 0;

        for(std::vector<Object1*>::iterator i = Object1.begin(); i != Object1.end(); ++i)
        {
            ObjectArray[a] = (*i)->GetY();
            a++;
        }
        for(std::vector<Object2*>::iterator i = Object2.begin(); i != Object2.end(); ++i)
        {
            ObjectArray[a] = (*i)->GetY();
            a++;
        }
        ...

        SIZE = Object1.size() + Object2.size() + Object3.size() + ...;

        sort(ObjectArray, ObjectArray + SIZE);

        for(size_t i = 0; i < SIZE; i++)
        {
            for(size_t j = 0; j < SIZE; j++)
            {
                if(tree1[j]->GetY() == ObjectArray[i])
                {
                }
                else if(tree2[j]->GetY() == ObjectArray[i])
                {
                }
                ...
            }
        }

        ChangeMade = false;
    }

Is there a way to create an array of pointers to store the addresses of objects to different classes by their y values and use this array to do the rendering? Or do you have any suggestions on how to handle creating objects to the sprite class and rendering or any useful links?

Thanks.

sentences:
How to pass content through the project's structure efficiently? so following situation. I have a project which is structured something like this.

Game1 -> GameManager -> Module (multiple instances)

During runtime units are being spawned in each instance of the Module class. Those Units require spritesheets for animation. Let us say each unit has a "Move", "Attack" and "Die" state, each using a individual spritesheet. This makes three Texutre2D instances per unit and with 5 different units this adds up to 15 different Texture files. Those are being passed to the unit's constructor on creation.

As I am loading those textures in Game1's LoadContent method I have to pass them the entire way to the Module class which then uses those textures to instaciate units.

Game1.LoadContent(15x textures) -> GameManager(15x textures) -> Module(15x textures) -> Unit(3x textures)

Imo this has several disadvantages:

As far as I can judge all those 15 textures are being held in memory of the Module classes the entire time. I would like to avoid
that.
Also passing 15 textures through the project's entire structure makes the classes unreadable and ugly.
I've got the overall feeling that this is not the way things should be done here.

In order to avoid problem #2 I created a class, its only purpose is to hold all textures that are needed in Module.cs. I called the class AnimationCollection. It holds Texture2D variables and the according getters and setters. So now my Project looks like this.

Game1.LoadContent(new AnimationCollection(15x textures)) -> GameManager(AnimationCollection) -> Module(AnimationCollection) -> Unit(AnimationCollection)

While this does seem to solve problem #2 the other problems remain. Are there other options on how to handle this problem? I could think of something like loading all content in the Module Class itself, but I never saw this before. I always load my stuff in Game1.LoadContent().

Any ideas, suggestions or expert knowledge is highly appreciated.

Thanks in advance!

sentences:
Detect collision with bullet physics, to make a character controller I inherited from btCollisionWorld::ContactResultCallback but I really have no idea how to use this virtual function:

btScalar addSingleResult(btManifoldPoint& cp,
        const btCollisionObjectWrapper* colObj0Wrap, int partId0, int index0,
        const btCollisionObjectWrapper* colObj1Wrap, int partId1, int index1)

I thought about using btCollisionWorld::ConvexResultCallback instead but there is no method in btCollisionWorld to use it.

For now my only goal is to move a btCollisionObject around and detect collision with walls, to adjust the position and movement.

I would just need the collision normal, some collision point, or anything else...

sentences:
Unity Gui from text file templates I've been banging my head against a wall this past while over how I might create menu's and menu components in unity from text file. I would normally just build my own extended panel/label classes etc in c# and then use the properties loaded from file on instances of those extended classes. I have a properties loader but I cant seem to get my head around making a gui class that's dynamic from reading unitys documentation. Has anybody ever tried this?

Here's an example of a menu definition file.

    <GUI_Menu: mainMenu >
    <Atributes>
        <> Type : Menu
        <> Position_X : 0
        <> Position_Y : 0
        <> Height : Vanilla_Property_Screen_Height
        <> Width : Vanilla_Property_Screen_Width
    </Atributes>
    <GUI_Panel: menu >
        <GUI_Button: play >
            <Atributes>
            <> Position_X : 50
            <> Position_Y : 50
            <> Type : Button
            <> Height : 50
            <> Width : 100
                <Description>
                    <> Key : desc_Play
                    <> Description_Address : Main\\Text\\Menu\\desc_Menu.xml
                </Description>
            </Atributes>
            //button action/button data/description
        </GUI_Button>
        <GUI_Button: options >
            //button action/button data/description
        </GUI_Button>
        <GUI_Button: mods >
            //button action/button data/description
        </GUI_Button>
        <GUI_Button: texturePacks >
            //button action/button data/description
        </GUI_Button>
    </GUI_Panel>
</GUI_Menu>

<GUI_Menu: play >
    <GUI_Panel: load-New >
        <GUI_Button: loadSave >
            //button action/button data/description
        </GUI_Button>
        <GUI_Button: newGame >
            //button action/button data/description
        </GUI_Button>
        <GUI_Button: multiplayer >
            //button action/button data/description
        </GUI_Button>
        <GUI_Button: voxelEditor >
            //button action/button data/description
        </GUI_Button>
    </GUI_Panel>
</GUI_Menu>

EDIT:
Note that it is important that the menus are loaded from a definition file that is easy to read and write by a human being as custom menu's and GUI's/components will be supported through modding.

sentences:
Sprite button not triggering "On Click()" event -Unity Hi have created some buttons from sprite and I added image and button components on it.

I am just using sprites because In my game the camera can be moved on x and y. But I don't want my button to move and since UI buttons move with camera that is why I am not using them.

Here is the GIF to explain the scene:

sentences:
Unity remote not recognising my phone? I made a new project with the Android module installed, which works fine as I can build and run it on my phone when connected to my computer via USB, and yet can't get Unity Remote to work. Edit/Project Settings/Editor/Device won't display my phone's name.
I tried several internet solutions I found (such as closing and opening again both Unity and Unity Remote or enabling PTP transfer) and none worked.
Any ideas on what could be going on?

sentences:
Animate a 3D boss with some parts that become independant I would like to create a boss but first, I want the player to fight the head. Then the head flies to the body and becomes attached to it.

Later, the boss will throw an arm to the player and the arm will chase the player, becoming independent with its own AI.

Do I have to render 3 models separatly? (The head + one arm + the body)
If I do this, how am I supposed to animate the complete body when everything is attached together?

Do I have to render the 3 models (The head + one arm + the body) + 1 model without the arm (Head + body) + 1 model with everything attached?
If so, how do I handle animations with these 5 models?

sentences:
What is the impact of adding an emoticon to an app title? Is there research that shows that adding an emoticon into an Android app title impacts (positively or negatively) the App Store Optimization (ASO) and conversion rate?

What is the conclusion?

sentences:
As3 Random movieclips from an array to the stage For a game with orders and clients I was trying to create the following situation:

Every half minute, a client should appear at the counter. In this case I have an array with 4 movieclips (4 clients). After 30 seconds I want the first randomly choosed client to appear at the counter (y = 200). This is my solution (wich obviously isn't the right way, forgive me):

    var timer:Timer = new Timer(1000);
    var elapsedTime:Number = 0;

    timer.addEventListener(TimerEvent.TIMER, displaytime);
    timer.start();

    function displaytime(event:TimerEvent):void
        {
            elapsedTime++;
            counterDisplay.text = String(elapsedTime);
        }

    if(elapsedTime == 30){

    for (var i:uint = 0; i < mcArray.length; i++) {

         mcArray[i].x = Math.floor( Math.random()*(stage.stageWidth) );
         mcArray[i].y = 200;
         addChild(mcArray[i]);

    }

    }

My question to you is: What am I doing wrong, and how can I accomplish this?
Thanks in advance!

sentences:
Multiple IF statements on Update (Unity) Background

I am testing out a "Pause" system for my game. I have a Game Manager script and figured as it's the GM, it's a good place to stick a Pause system.

My pause works that on pressing "P" key, the timeScale is switched between 0 and 1.
Due to the nature of the game, if the game is paused and then unpaused I want the timeScale to not "jump" to 1 but to gradually increase, taking half a second to reach "normal" game speed again.

This aspect is NOT my issue. This is just background.

My Code:

I have the pause detection in the Update script. I figured two if statements to check Timescale values and then to take appropriate action.

(SloMoTime is a timescale that kicks in when the player wins or looses the level)

My Code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class GManager : MonoBehaviour
{
    public float sloMoTime = 0.2f;
    public bool ballInPlay = false;

    ....

 void Update()
     {
     if(Input.GetButtonDown("PauseGame") && ballInPlay == true)
     {
         if (Time.timeScale == 0)
            {
            //Game is already paused, so now continue...
            // dactivate "paused" text notice
            paused.SetActive(false);
            /***
             * Becauase we are speeding time up we can't use deltaTime
             * Easy as the timescale we want is 0.5f so 1/0.5 == 2. So use 2.
             ***/
            Time.timeScale = Mathf.MoveTowards(Time.timeScale, 1.0f, 2f);
            }
        if (Time.timeScale > slowMoTime)
            {
            //Pause the game.
            Time.timeScale = 0;
            // Show "paused" Text notice.
            paused.SetActive(true);
            }
        }
    } //end Update.
} //close class.

Now, Can you see any major issues here?

My Issue

I found running my script from above, that the game did not pause.

I expected every frame to load Update, then to check IF number 1, and then check If number 2 (hence in that order).  then continue.

I found using error logs that by swapping the If statments around that only the first if statement was ever executed. So the game would alternatively always pause but then never unpause. I additionally found with error logs that the values of TimeScale where not causing this inconsistency.

What I have trouble with is understanding why this happens. Why do two completely mutually exclusive IF statements not both fire, when in the same method?

FAILS:

Class {
    void Update () {
       if(){
          //works
       }

       if(){
         //never works
       }
   } //close method.
}

A Solution

BUT putting the second IF statement within an else solves this issue.

WORKS:

Class {
    void Update() {
       if(){
          //works
       }
       else if(){
         //works
       }
   } //close method.
}

Obviously this is impractical for more than a few ifs at once and I find it hard to understand why this logic works and the previous logic never did.

I havn't yet dug into if this is Update or timeScale (entity rather than value) specific but Why does this happen?

sentences:
Help with a Fast 2D Grid-Based world rendering technique First I'm going to give you my current situation and explain what I'm attempting. I will then pose my question below. I will attempt to include a "TL;DR" for those of you who prefer things to be concise.
OVERVIEW OF CURRENT SETUP:

The current representation of my game world is one where ' Pieces ' of a larger world are represented by three layers of IDs as follows.

//This is being done in C++
struct WorldPiece {
   ivec2 pieceLocation;         //Where ivec2 is a vector containing ints
   short backLayer[PIECE_SIZE]; //Where PIECE_SIZE is the size of the grid this piece contains, ie. for a 32x32 grid, this is 1024
   short middleLayer[PIECE_SIZE];
   short frontLayer[PIECE_SIZE];
};

The world as a whole is then composed of these pieces, which are loaded (and cached as needed) as the player traverses from piece to piece.
I currently have the data side of this all working. I may change the active data set and move around the camera (zoom in and out as well) and watch it all function.
I have also written a tool to support the loading and saving of pieces, and the painting of IDs across the world.
I HAVE THIS DATA:

Each ID within a piece maps to a texture that will be used when that ' cell ' of the piece must be rendered.

QUESTION:

How might I go about rendering each piece in such a way as to do this in as few passes as possible? I could render each cell at a time, but that would be slow. I could generate a list of vertices and indices and create massive VBOs, or sets of quads. Or perhaps there is a better way?
I would prefer to keep the data separate from the rendering and to keep the size of the data as small as possible (so as to have a small as possible load time while the game is running).
If possible, I would like this to be fast enough to render large swaths of tiles, (for example a 3x3 area of 1024 tiles apiece, or more). Since zooming in and out is possible it would be nice to provide this functionality to the player while still maintaining the detail of rendering the world.

If there would be a better setup for the world data to accommodate these requirements, I'm open to suggestions.
SIDE NOTES:

Please do not bring collision/physics, or other game-map-related things into this. I have that worked out and it will not be a bottleneck. I am merely concerned with a best approach to a rendering pipeline where speed is the top concern.
Please do not suggest API X or ENGINE Y. I have looked around quite thoroughly and nothing available would properly provide what I need or integrate with my current codebase.
I will be using a texture atlas.

tl;dr version-  I have a grid based world that streams pieces in as needed, I would like suggestions on a fast way to render these pieces and nothing I have found anywhere has a suitable solution for my current situation.

sentences:
Game planning and software design? I feel that UML is not convenient In my university, they always emphasize and hype about UML design and stuff, in which I feel it is not going to work well with game structure design. Now, I just want a professional advice on how should I begin my game designing? The story is I have some skill in programming and have done many minor game such as getting some 2D platformer working to some extend. The problems that I find about my program is the poor quality design. After coding for a while, things start to break down due to poor planning (When I add new feature, it tends to make me have to recode the whole program). However, to plan everything out without a single design flaw is a bit too ideal. Therefore, any advice to how should I plan my game? How should I put it into visible pictures, so that me and my friends are able to overview the designs?

I planned to start coding a game with my friend. This is going to be my first teamwork, so any professional advices would be a pleasure. Is there any other alternatives than UML?

Another question is how does "prototyping" normally looks like?

sentences:
How to implement own UI widget in libGDX? I want to implement my own widget, here is an image:

what I want to get. Instead of numbers there will be some names, but I think it doesn't matter. I'm pretty new in libGDX, so could you please briefly describe me plan, how can I do something like this (if there will be some code, it would be awesome)? I tried to google it, but didn't find something relevant.

Thanks in advance!

sentences:
What's the difference between Update and FixedUpdate in Unity, and should I bother? I was told to use Update() for graphics and FixedUpdate() for physics, but sometimes my inputs won't register when I use FixedUpdate(). It works fine if I use Update() for everything though.

Should I bother with FixedUpdate(), or am I doing something wrong?

sentences: Hills in a topdown game I'm making a top down rpg game and was wondering if it was possible to show hills on a map instead of having everything completely flat. I've thought about changing to an isometric view, but if it can be avoided, I would rather do top down. How would I do this? Would I draw the tiles on an angle or something? Or is not possible without switching levels like in dwarf fortress?

sentences:
Constructing a Planetoid Cube World? This is sort of a multidisciplinary question, so I'm asking it here rather than on one of the other Stack Exchange sites.

I've been toying with the idea of making a game that's a mix between Minecraft and Kerbal Space Program, where the world is actually a planet and can be traveled around (either on the ground or in orbit) seamlessly, yet still consisting entirely or mostly of cubes à la Minecraft.  It turns out this is actually incredibly difficult to wrap my head around!

There are a few requirements and concessions.

Requirements

Must be able to travel and build on all parts of the planet seamlessly (poles included)
Every tile must be able to be mapped exactly or roughly to a spherical coordinate.

Concessions

Planet's perceived 'radius' at varying depths can be uniform.
Depth of buildable area can (and should) be limited, meaning you don't need to be able to tunnel into the center of the planet and you don't need to be able to make an absurdly large tower.

Those are the main points, and the problem is open to interpretation and more concessions are able to be made so long as the illusion of being on a planet is maintained.

Initial Idea

Here is an I've had that may have some merit but I'm not sure if it'd actually work.

Tesselated Platonic Solid

The idea here is to create a 'virtual' sphere made of a patchwork of faces of a platonic solid (e.g. cube, icosahedron, octahedron).  The faces represent a plot of flat land, with each edge being the 'portal' to another faces and so on.  In this way the world is always 'flat' and you are basically traveling over a 2D unwrap of the original shape.

One of the problems with this method is that with some tesselated platonic solids (such as the cube above), the tesselated faces are warped and the surface area of each face is not uniform.  A little bit of this is acceptable, but not too much.

The Question

The real question here is ultimately "is this possible?" and if so, what would be the best method to achieve all of the requirements.  If not, what kind of concessions would I need to make to make a believable world?

sentences:
How to delay a timer when it's run the first time in update method not using a coroutine In the code below I am resetting a timer after a duration maxiTime within the update method.
I want to delay the timer before it begins to run for a certain duration. I believe this could be done with a coroutine, but I am using StopAllCoroutines, so I need to do this within the update method. How can I get the delay only before the first run?

        timeElapsed +=1;
    if(timeElapsed >= maxiTime) {

        timeElapsed = 0;

        Debug.Log ("Thank You!");
    }

sentences:
Reinterpreting point inside a distorted cube Given a cube:

And a point anywhere inside that cube.
Could that point be reinterpreted given any kind of deformation applied to the cube?

I.e., where would that point be inside the deformed cube?
The cube could be deformed in any way, and we only know the location of the vertices.
Likewise, given a point in relation to the distorted cube, could we find where that point is in relation to the undistorted cube?
The vertices of the cube are indexed and stay the same between the undistorted and the distorted cube.

sentences:
Keyboard shortcuts in RTS game Imagine you have a multiplayer RTS game (e.g. Dune, Age of Empires, Settlers, Warcraft). There are certain commands available from keyboard to command the troops (Stop, Attack, Move) and some more general commands like Pause or Exit. The game is localized into many languages (18+).

I can see two possible ways of using keyboard shortcuts:

A. Use first English letter of said commands ("S", "A", "M", "P", etc.) for every locale.

B. Use first letter of the word on that locale (e.g. Russian shortcuts will be "С", "А", "Д", "П". German will be "H", "A", "S", etc..)

Which of these (or suggest your own) approaches is better when choosing the shortcuts for multiple locales?

P.S. Of course the shortcuts might be customizable by player, but some sane defaults are still needed.

sentences:
2D non-tile based map editor I am currently developing a relatively simple 2D, topdown oriented adventure game for the iPhone and was wondering what would be the easiest way to create the maps for my game. I figured I would need some kind of visual editor that would give me immediate feedback and would allow me to place all objects in the world exactly where I want them. I could then load the saved representation of the world I create in the editor in my game.

So, I am looking for a simple map editor that allows me to do this. All the objects in my game are simply textured rectangles build up from two triangles. All I need to be able to do is position different rectangles/objects in the map, and give them a texture. I am using texture atlases, so it would be useful to be able to assign portions of textures to the objects. I then need to be able to extract all the objects from the saved representation of my maps, together with the name/identifier of the texture(atlas) they use, and the area of the texture atlas.

I have looked at some tile-based map editors like Tiled and Ogmo, but they don't seem to be able to do what I want.
Any suggestions?

EDIT: a more concrete example: something like the GameMaker level editor, but then with added export functionality in a handy format.

sentences:
Map building - Tower Defense Before diving too deep into my question, let it be known that I am learning as far as java script goes and figured a simple Tower Defense game would be an excellent way to learn things.

So I have found a simple background image with a path drawn on it and my question is how would I go about building a path so that I can animate my objects.
Would I have to take the image and overlay a grid system, or can I store the path in some sort of array and have my objects move across it?

Here is the background image:

sentences:
Unity / How to add a shader to a material via c# script? I found already some things - but those seem not quite what I need. (perhaps outdated functions?)

https://docs.unity3d.com/ScriptReference/Material-shader.html

here, it seems you can add a shader to a renderer:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Shader shader1;
    public Shader shader2;
    public Renderer rend;
    void Start() {
        rend = GetComponent<Renderer>();
        shader1 = Shader.Find("Diffuse");
        shader2 = Shader.Find("Transparent/Diffuse");
    }
    void Update() {
        if (Input.GetButtonDown("Jump"))
            if (rend.material.shader == shader1)
                rend.material.shader = shader2;
            else
                rend.material.shader = shader1;

    }
}

well - i dont have a renderer. i only have a material.

and there is no "material.setShader" , only a material.setTexture"

sooo can anyone solve this mystery of how to add a shader to a material via script?

sentences:
Scalability of multi-threading in game server What is a reasonable number of threads for a simple 2D mmo in Java? Is it reasonable to have two threads per connection, one for the input stream and one for the output stream?

The reason I ask is because I use a blocking method on the input stream, and a workaround seems unnecessarily complex if I were to try to get around it without adding threads.

This is mostly for my own edification; I don't expect to have 5 million people playing it ever, or even 5, but I'm wondering what a good scalable solution is, and if this is reasonable for a small server (<30 connections).

sentences:
Input.GetAxisRaw not returning zero after releasing the key In my WebGL Project here is the way for camera navigation (Movement/Rotation) on Update event:

void UpdateMovement()
    {

        bool accelerate = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
        moveDirection   =
            new
            Vector3(
                Input.GetAxisRaw("Horizontal") * moveSpeed,
            0,
            Input.GetAxisRaw("Vertical") * moveSpeed);
        //moveDirection = new Vector3(Input.GetAxis("Horizontal") * moveSpeed, 0, Input.GetAxis("Vertical") * moveSpeed);
        moveDirection   = transform.TransformDirection(moveDirection);

        if (Input.GetButton("Up"))
        {
            moveDirection.y += moveSpeed;
        }
        else if (Input.GetButton("Down"))
        {
            moveDirection.y -= moveSpeed;
        }

        if (Input.GetAxisRaw("Mouse ScrollWheel") > 0)
        {
            moveDirection.y = moveDirection.y + scrollSpeed;
        }
        else if (Input.GetAxisRaw("Mouse ScrollWheel") < 0)
        {
            moveDirection.y = moveDirection.y - scrollSpeed;
        }

       moveDirection *= (accelerate ? speed : moveSpeed);
        controller.Move(moveDirection * Time.deltaTime);

    }
    void UpdateRotation()
    {
        if (!Input.GetMouseButton(1))
            return;

        rotationX += Input.GetAxis("Mouse X") * lookSpeed;
        rotationY += Input.GetAxis("Mouse Y") * lookSpeed;
        rotationY = Mathf.Clamp(rotationY, -90, 90);
        rotationZ = Input.GetAxis("Mouse ScrollWheel");

        transform.localRotation = Quaternion.AngleAxis(rotationZ, Vector3.forward);
        transform.localRotation = Quaternion.AngleAxis(rotationX, Vector3.up);
        transform.localRotation *= Quaternion.AngleAxis(rotationY, Vector3.left);
    }

All working fine but the problem on WebGL canvas when I rotate the camera using mouse and comes out of the bound of WebGl canvas meanwhile, I also continuously press horizontal or vertical key, then release input key doesn't work. Remember I logged the key[Input.GetAxisRaw("Horizontal"),Input.GetAxisRaw("Vertical")] input and found that it is not reset to zero on release.

 Debug.Log("Hr GetAxisRaw : " + Input.GetAxisRaw("Horizontal"));
 Debug.Log("Vertical : "     + Input.GetAxisRaw("Vertical"));

Normally when I don't use camera rotation using mouse and during this time, when i release the horizontal/vertical key, it works fine.

sentences:
stop previous audio from playing when starting a new one I created a dialogue system with audio it works perfectly fine unless you start skipping the voice lines so then it all becomes a mess with all of the voice lines overlapping is there a way to make it so when you go to the next audio line the previous one stops playing?
Example of what is happening
as you can see in the video you can switch the text just fine and it doesn't show the previous one but for the audio, it just transforms into a jumbled mess, is there a way to fix this or to at least make it so people cant go to the next line until they finish hearing the current one?
DialogueManager Script:
public class DialogueManager : MonoBehaviour
{
public Door1Animation doorAnimation;

public Text nameText;
public Text dialogueText;
public Text changeText;

public AudioManager Sound;

public Animator textBoxAnimation;

public Queue<string> sentences;

public Queue<string> voiceLines;

void Start()
{
    sentences = new Queue<string>();
    voiceLines = new Queue<string>();
}

public void StartDialogue (Dialogue dialogue)
{
    textBoxAnimation.SetBool("Open", true);

    changeText.text = ("Aperte R para continuar");

    nameText.text = dialogue.name;

    sentences.Clear();

    voiceLines.Clear();

    foreach (string sentence in dialogue.sentences)
    {
        sentences.Enqueue(sentence);
    }

    DisplayNextSentence();

    foreach (string voiceLine in dialogue.voiceLines)
    {
        voiceLines.Enqueue(voiceLine);
    }

    PlayNextLine();
}

public void DisplayNextSentence()
{
    if (sentences.Count == 1)
    {
        changeText.text = ("Aperte R para fechar");
    }

    if (sentences.Count == 0)
    {
        EndDialogue();
        return;
    }

    string sentence = sentences.Dequeue();
    dialogueText.text = sentence;
}

public void PlayNextLine()
{
    if (voiceLines.Count == 0)
    {
        return;
    }

    string voiceLine = voiceLines.Dequeue();
    Sound.Play(voiceLine);
}

public void EndDialogue()
{
    Debug.Log("End of conversation");
    doorAnimation.openDoor = true;
    textBoxAnimation.SetBool("Open", false);
}
}

AudioManager Script:
using UnityEngine.Audio;
using System;
using UnityEngine;

public class AudioManager : MonoBehaviour
{
public Sound[] sounds;

void Awake()
{
    foreach (Sound s in sounds)
    {
        s.source = gameObject.AddComponent<AudioSource>();
        s.source.clip = s.clip;

        s.source.volume = s.volume;

        s.source.pitch = s.pitch;

        s.source.loop = s.loop;

    }

}

private void Start()
{
    Play("BackgroundMusic");
}

public void Play (string name)
{
    Sound s = Array.Find(sounds, sound => sound.name == name);
    s.source.Play();
}
}

Just the part of the interaction code so you can go to the next line/audio:
    public void Update()
{
    if (Input.GetKeyDown(KeyCode.E))
    {

        PersonInteract();
        buttonInteract();

    }

    if (Input.GetKeyDown(KeyCode.R))
    {
        FindObjectOfType<DialogueManager>().DisplayNextSentence();
        FindObjectOfType<DialogueManager>().PlayNextLine();
    }
}

Inspector view of the dialogue manager:

sentences:
How to update a dynamic texture I'm using Ogre 1.10, I have a dynamic texture assigned to a material that I need to update its buffer with a new image every few seconds.
How can I transfer pixel data from an image to my dynamic texture?

I've created a manual texture like:

         // Create the texture
        Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual(
            "dyn_texture", // name
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D,      // type
            256, 256,         // width & height
            0,                // number of mipmaps
            Ogre::PF_BYTE_BGRA,     // pixel format
            Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);

And on my update function I have the image that I want to transfer:

Ogre::Image img;
img.load(basename.toStdString(), "resources");
//Copy pixels from img to texture
//??

I've already tried doing:

Ogre::HardwarePixelBufferSharedPtr pixelBuffer = texture->getBuffer();
pixelBuffer->blitFromMemory(img.getPixelBox());

works but it's quite slow, gui freezes when updating like that.

sentences:
How can I get the texture file name for my polygon? I have a problem with the FBX SDK. I read in the data for the vertex position and the UV coordinates. It works fine, but now I want to read for each polygon to which texture it belongs, so that I can have models with multiple textures. Can anyone tell me how I can get the texture file name for my polygon? My code to read in vertex position and uv coordinates is the following:

int i, j, lPolygonCount = pMesh->GetPolygonCount();
FbxVector4* lControlPoints = pMesh->GetControlPoints();

int vertexId = 0;
for (i = 0; i < lPolygonCount; i++)
{

    int lPolygonSize = pMesh->GetPolygonSize(i);

    for (j = 0; j < lPolygonSize; j++)
    {
        int lControlPointIndex = pMesh->GetPolygonVertex(i, j);
        FbxVector4 pos = lControlPoints[lControlPointIndex];
        current_model[vertex_index].x = pos.mData[0] - pivot_offset[0];
        current_model[vertex_index].y = pos.mData[1] - pivot_offset[1];
        current_model[vertex_index].z = pos.mData[2]- pivot_offset[2];

        FbxVector4 vertex_normal;
        pMesh->GetPolygonVertexNormal(i,j, vertex_normal);

        current_model[vertex_index].nx = vertex_normal.mData[0];
        current_model[vertex_index].ny = vertex_normal.mData[1];
        current_model[vertex_index].nz = vertex_normal.mData[2];

        //read in UV data
        FbxStringList lUVSetNameList;
        pMesh->GetUVSetNames(lUVSetNameList);

        //get lUVSetIndex-th uv set
        const char* lUVSetName = lUVSetNameList.GetStringAt(0);
        const FbxGeometryElementUV* lUVElement = pMesh->GetElementUV(lUVSetName);

        if(!lUVElement)
            continue;

            // only support mapping mode eByPolygonVertex and eByControlPoint
        if( lUVElement->GetMappingMode() != FbxGeometryElement::eByPolygonVertex &&
            lUVElement->GetMappingMode() != FbxGeometryElement::eByControlPoint )
            return;

        //index array, where holds the index referenced to the uv data
        const bool lUseIndex
            = lUVElement->GetReferenceMode() != FbxGeometryElement::eDirect;
        const int lIndexCount= (lUseIndex) ? lUVElement->GetIndexArray().GetCount() : 0;

        FbxVector2 lUVValue;

        //get the index of the current vertex in control points array
        int lPolyVertIndex = pMesh->GetPolygonVertex(i,j);

        //the UV index depends on the reference mode
        int lUVIndex = pMesh->GetTextureUVIndex(i, j);
        lUVValue = lUVElement->GetDirectArray().GetAt(lUVIndex);
        current_model[vertex_index].tu = (float)lUVValue.mData[0];
        current_model[vertex_index].tv = (float)lUVValue.mData[1];

        vertex_index ++;
        }

    }

    float v1[3], v2[3], v3[3];
    v1[0] = current_model[vertex_index - 3].x;
    v1[1] = current_model[vertex_index - 3].y;
    v1[2] = current_model[vertex_index - 3].z;

    v2[0] = current_model[vertex_index - 2].x;
    v2[1] = current_model[vertex_index - 2].y;
    v2[2] = current_model[vertex_index - 2].z;

    v3[0] = current_model[vertex_index - 1].x;
    v3[1] = current_model[vertex_index - 1].y;
    v3[2] = current_model[vertex_index - 1].z;

    collision_model->addTriangle(v1,v2,v3);

sentences:
Get world object transform relative to another object (potential parent) I'm attempting to parent a bullethole decal to a dynamic object. I've figured out how to set the correct position for the bullethole object so that it shows at the correct position of the dynamic object, but once that dynamic object is rotated, parenting new bulletholes are skewed because I'm not compensating for the rotation of the dynamic object (the child object, bullethole decal in this case, is translated relative to the parent, which is why I'm attempting to remove the initial rotation of the parent object to get the actual rotation for the child). I've probably done a terrible job of explaining this...so here is a video of what I'm working on (note that the bulletholes that are added to the barrel before it is moved stay where they should be, and it's only after the barrel is rotated that new bulletholes become skewed)
So I believe I know what needs to happen, I'm just not sure how to go about implementing it. I need to compensate for the rotation of the barrel at the time the bullethole is parented to it, setting the rotation of the bullethole to this value. Possibly an easy question to answer for someone with experience working with quaternions.
if (raycast.hasHit())
{
    auto hitPoint = vel::helpers::functions::bulletToGlmVec3(raycast.m_hitPointWorld);

    bulletObject->currentPositionFromScreen = hitPoint;
    bulletObject->disposeOnNextTick = true;

    auto normal = vel::helpers::functions::bulletToGlmVec3(raycast.m_hitNormalWorld);
    float nrmDot = glm::dot(normal, glm::vec3(0.0f, 1.0f, 0.0f));

    auto bulletHoleAdjustmentValue = this->currentBulletHoleIndex == 0 ? 0.00001f : 0.00001f + (0.00001f * this->currentBulletHoleIndex);
    auto bulletHolePosition = hitPoint + (normal * glm::vec3(bulletHoleAdjustmentValue, bulletHoleAdjustmentValue, bulletHoleAdjustmentValue));

    auto bulletHoleActor = this->bulletHoleQueue.at(this->currentBulletHoleIndex);

    if (this->currentBulletHoleIndex < (this->bulletHoleQueueSize - 1))
        this->currentBulletHoleIndex++;
    else
        this->currentBulletHoleIndex = 0;

    bulletHoleActor->getTransform().setTranslation(bulletHolePosition);

    if (nrmDot < 1.0f && nrmDot > -1.0f)
        bulletHoleActor->getTransform().setRotation(glm::toQuat(glm::transpose(glm::lookAt(hitPoint, bulletHolePosition, glm::vec3(0.0f, 1.0f, 0.0f)))));
    else
        bulletHoleActor->getTransform().setRotation(90.0f, glm::vec3(1.0f, 0.0f, 0.0f));

    bulletHoleActor->setVisible(true);

    // if physics object has a user pointer, parent bullethole actor to the actor which that value represents
    if (raycast.m_collisionObject->getUserPointer() != nullptr)
    {
        auto dynamicActor = (vel::scene::stage::Actor*)raycast.m_collisionObject->getUserPointer();

        bulletHolePosition =  bulletHolePosition - dynamicActor->getTransform().getTranslation();
        bulletHoleActor->getTransform().setTranslation(bulletHolePosition);

        // Was thinking below would work, but it does not for some reason?
        //auto newRotation = bulletHoleActor->getTransform().getRotation() * glm::inverse(dynamicActor->getTransform().getRotation());
        //bulletHoleActor->getTransform().setRotation(newRotation);

        bulletHoleActor->setParentActor(dynamicActor);
    }

}

sentences:
Camera rotate at target? I have free camera that move and rotate around the level. In this script if tb = true, I want my camera to rotate at target. Camera will show my character not rotate at character direction. image

public Transform avatar1; // character
public Camera cam;
public bool tb;

void Start()
{
    tb = false;
}

void Update()
{

    if (tb == true)
    {
        StartCoroutine(bu1());
    }

}

IEnumerator bu1()
{
    cam.transform.position = Vector3.Lerp(cam.transform.position, new Vector3(avatar1.transform.position.x + 6, 10, avatar1.transform.position.z + 7), 0.1f);
    cam.transform.rotation = Quaternion.Lerp(cam.transform.rotation, avatar1.transform.rotation, 0.4f); // here is my problem
    yield return new WaitForSeconds(2);
    tb = false;

}

sentences:
Navigate UI with Dpad from Xbox controller on Mac [Unity]? So, according to some documentation I found, the Xbox controller on Mac does not return Dpad presses as vertical/horizontal axes:

As you can see, the Dpad is only recognized as buttons 5, 6, 7, and 8, and not as horizontal/vertical axes. For my character's movement, I just created code that returns 1 or -1 for axis depending on the button pressed. It works perfectly fine. But then I found another problem: UI navigation.

I can't navigate my menus with the Dpad on Mac because the the EventSystem is expecting navigation via horizontal/vertical axes, which the Dpad is not providing.

Is there any way I can turn these Dpad button presses into real horizontal/vertical axes in Unity's Input system? Or is there something else I can do to make UI navigation happen on a Mac, with the Dpad?

sentences:
AndEngine: edit elasticity on action I'm making a game for Android with AndEngine.

It's going quite well, but now I'm stuck on something.
My main character has a elasticity set in its fixturedef so it bounces around throughout the game.
Now i want the user to be able to not let the player bounce when he does a control.

So my question: how can I modify the elasticity of my character? Because I saw you can adjust the setDensity and setFriction, but I cant see the setElasticity....

Thanks in advance!

sentences:
How can I execute GLFW fullsceen in a secondary monitor (Xorg)? I am currently learning GLFW using C++. I have found many tutorials on initializing windows, but not many on initializing full screen, and next to nothing on initializing full screen on a secondary display (In this case, my television). This way I can use my primary display for logging and debugging.

I have visited the man-pages for GLFW. However, even after going over examples for glfwGetMonitors(), I am still not entirely sure how to use these in conjunction with  glfwCreateWindow().

I have included links to the reference pages.

GLFW Monitor Guide

GLFW Window Guide

sentences:
How to add noise into a texture? I'm working on a Heat Map generated from Perlin Noise. So far I've got 2 different outputs. Let's go step by step:

The result should be something like this:

This is the Perlin Noise I've got, easy to get, RED means hot and BLUE means cold, it's already generated in a spherical way.

And this is the gradient TEXTURE, it's based on Y axis as you can see.

At the moment they are generated in different functions in Unity, public Texture2D PerlinHeat() and public Texture2D GradientHeat(). I'd like to multiply them but you can't just simply do something like Texture2D * Texture2D, so I´m trying to figure it out and any help would be appreciated.

I'm using LibNoise as reference but as my gradient is not a noise module I can't multiply them.
By the way: How to make a noise gradient?
That´s the page that approach the best to my issue, as is about the same, I just don´t know how to implement everything that is said there.

Here is the code of the Gradient Texture, is pretty messy but it allows to change dynamically colors and heat ranges over the texture with just a change in the inspector.

    public Texture2D GetGradientHeat()
    {
        var texture = new Texture2D(heatMap.Width, heatMap.Height);
        var pixels = new Color[heatMap.Width * heatMap.Height];
        for (var x = 0; x < heatMap.Width; x++)
        {
            for (var y = 0; y < heatMap.Height; y++)
            {
                    if (y <= southPoleCap || y >= northPoleCap)
                    {
                        pixels[x + y * heatMap.Width] = coldest;
                    }
                    else if (y > southPoleCap && y <= southArcticCap || y < northPoleCap && y >= northArcticCap)
                    {
                        pixels[x + y * heatMap.Width] = colder;
                    }
                    else if (y > southArcticCap && y <= southArcticOuter || y < northArcticCap && y >= northArcticOuter)
                    {
                        pixels[x + y * heatMap.Width] = cold;
                    }
                    else if (y > southArcticOuter && y <= southMiddleOuter || y < northArcticOuter && y >= northMiddleOuter)
                    {
                        pixels[x + y * heatMap.Width] = template;
                    }
                    else if (y > southMiddleOuter && y <= southTropic || y < northMiddleOuter && y >= northTropic)
                    {
                        pixels[x + y * heatMap.Width] = hot;
                    }
                    else if (y > southTropic && y <= southMiddleInner || y >= northMiddleInner && y < northTropic)
                    {
                        pixels[x + y * heatMap.Width] = hoter;
                    }
                    else if (y > southMiddleInner && y < northMiddleInner)
                    {
                        pixels[x + y * heatMap.Width] = hotest;
                    }
            }
        }

        texture.SetPixels(pixels);
        texture.wrapMode = TextureWrapMode.Clamp;
        texture.Apply();
        return texture;
    }

Any help with this will be appreciated as I've been trying to do it during weeks and I´m not able to find any more documentation or a pseudocode that I can make work.

EDIT 2
So answer from DM Gregory just works like a charm, awesome. The resulting output is at follows, with that you can alter that noise strength and playing with the offsets, color multipliers, or other noise modules, you get such a nice output, thanks!

sentences:
Deactivate keyboard input on collision I'm creating an online-canvas-game with a tank as player object.

Now I have several structures in my canvas, that shouldn't be able to be overdriven by the tank...
My solution is to detect the collision like that:

if(hero.x > reactor[i]['x'] - 32 && hero.x <= reactor[i]['x'] + 32
   && hero.y > reactor[i]['y'] - 32 && hero.y <= reactor[i]['y']){
    collidetop = true;
}

if(hero.x > reactor[i]['x'] - 32 && hero.x <= reactor[i]['x'] + 32
   && hero.y >= reactor[i]['y'] && hero.y < reactor[i]['y'] + 32){
    collidebottom = true;
}

if(hero.x > reactor[i]['x'] - 32 && hero.x <= reactor[i]['x']
   && hero.y > reactor[i]['y'] - 32 && hero.y <= reactor[i]['y'] + 32){
    collideleft = true;
}

if(hero.x > reactor[i]['x'] && hero.x <= reactor[i]['x'] + 32
   && hero.y > reactor[i]['y'] - 32 && hero.y <= reactor[i]['y'] + 32){
    collideright = true;
}

The hero object is the tank, hero.x the x-coordinate, and so on...
Now I'd like to deactivate the keyboard input for the direction key, if the objects collide...
For this reason I have the variables wok, aok, sok and dok - they all contain booleans.
If wok = false, then the key "w" is deactivated...
I've connected the collide variables to the keyboard inputs:

if(collidetop == true){
    sok = false;
}
if(collidetop == false){
    sok = true;
}
if(collidebottom == true){
    wok = false;
}
if(collidebottom == false){
    wok = true;
}
if(collideright == true){
    aok = false;
}
if(collideright == false){
    aok = true;
}
if(collideleft == true){
    dok = false;
}
if(collideleft == false){
    dok = true;
}

My problem is: if the tank doesn't collide the other object any more, the keys stay blocked... Could you help me with that?

sentences:
Efficient UI for RTS units I was wondering how I should approach the runtime changes on the game UI when selecting different types of units in a RTS.

For example, in Starcraft, each unit type has its own portrait, attributes, buffs and command cards displayed in the UI. Selecting another unit will update all of these.

I can see two possible solutions:

Each unit type has its own UI panel created (in memory), and selecting another unit disables the current UI panel and enables the new one.
There is only one UI panel, and selecting a unit fills the portrait, attributes, command cards, etc. dynamically.

Both solutions seem inefficient. The first may consume too much memory, and the second makes no caching at all. Maybe the way to go would be something in-between, or completely different.

I'm working with Unity, but I think the discussion should stay pretty high level.

sentences:
ECS: Should Systems access only one component-type Let's say I have a Transform-component-type, and a Color-component-type (to keep things simple).
I also have an entity E that is assigned both of these component-types.
To render E, my engine will internally have to bind a uniform-buffer containing both a mat4-transformation-matrix, and a vec3-color.
Now I think I heard conflicting opinions about whether there should be a strict 1-to-1 component_type-to-system relation, or whether it is considered more appropriate to have systems which act on multiple component-types.
In the latter case I'd know how to do things.
I would have a RenderSystem, which only considers entities which have both a Transform, and a Color component.
For the first case I don't have a solution though..
Both the TransformSystem and the ColorSystem wouldn't know how to render the entity, since they only hold a subset of what is required by the shader.
So I would just jump head-first into implementing my ECS as having one system potentially acting on multiple component-types, but I first wanted to hear from people having more experience with ECSs.
Are there good solutions in an ECS that maps systems 1-to-1 to components to achieve behavior that is the effect of the presence of multiple different component-types, or is a solution in which one system requires the presence of multiple component-types generally preferable?

sentences:
Alternatives to Component Based Architecture? Usually when I develop a game I will use an architecture like what you see below. What other architectures are popular for simple game development? I'm concerned about having a narrow view of what exists out there for architectures beyond this. Is this an example of component-based architecture? Or is this something else? What would that look like? What alternatives exist?

public abstract class ComponentBase {

    protected final Collection<ComponentBase> subComponents = new LinkedList<ComponentBase>();

    private boolean enableInput;
    private boolean isVisible;

    protected ComponentBase(boolean enableInput, boolean isVisible) {
        this.enableInput = enableInput;
        this.isVisible = isVisible;
    }

   public void render(Graphics2D graphics) {
        for(ComponentBase gameComponent : this.subComponents) {
            if(gameComponent.isVisible()) {
                gameComponent.render(graphics);
            }
        }
    }

    public void input(InputData input) {
        for(ComponentBase gameComponent : this.subComponents) {
            if(gameComponent.inputIsEnabled()) {
                gameComponent.input(input);
            }
        }
    }

    ... getters/setters ...

    public void update(long elapsedTimeMillis) {
        for(ComponentBase gameComponent : this.subComponents) {
            gameComponent.update(elapsedTimeMillis);
        }
    }

}

sentences:
How to make a character jump? I am currently making a game in C# using Direct X 9.0. The game remake is Donkey Kong NES. I have nearly everything completed, but I am having problems with the physics of Mario's jump. I have variables declared for the Y and X co-ordinations.

I was wondering if there was a simple method of doing this. I have searched high and low for an answer but the answers I have found are either irrelevant/ or using a different programming language such as XNA.

I currently have a bool variable set to check to see if W has been pressed then that will trigger any code to make him jump. I have been messing around such as.

  if (jump == true)
    {

        Playerypos -=  vel;
        Playerxpos +=  vel;
    }

Which didn't work that well. I have searched high and low for an answer and now I am desperate, if someone could point me in the right direction to a simple solution. That would be great. Much appreciated for any responses.

sentences: FPS Collision detection and movement How is collision detection and movement typically handled in a FPS, particularly handling slight changes in ground height such as stairs (both on incline and decline)?

sentences:
Box2d Collision problem I'm not good with words so here's a picture to describe my problem:

In my game there is this big ball which the user can move on x-axis only. Now, if the ball is falling like the red one, it's blast away. But, with the angle/hit position of the green one it's just kinda sliding on the big ball and falling.

I'm using Box2d above AndEngine on an Android platform.

What is the reason for my green ball problem?

sentences:
Creating 3D gravity in zero-G tied to mass in unity with c# As a total beginner,
I've been working on a patch-job script for a gravity mechanic in an open space sim, I want to derive all my objects from this "Block ALPHA" object and its' set of variable attributes, so it's important that I get it right before moving on.

The idea is simple enough, call an array of all interactive objects' coordinates and apply a basic equation to simulate gravitational pull.

After some tinkering I have a piece of code that ticks all the boxes AFAIK, but I can't for the life of me figure out the syntax error I've made... I've been up all night massaging the script to fit my needs, but in the best cases it only raises one error:
"expected '}'"

Maybe I'm just tired, maybe I broke the code, but trying to place parentheses only seems to bring more errors :/

Here's the code as it is so far complete with the compiler error and suggested fix (in red), which does no good whatsoever:

using UnityEngine;
using System.Collections;

public class DynamicWeightAnalysis : MonoBehaviour
{

//Strength of attraction from your game-object, ideally this will be derived from a calculation involving the objects volume and density eventually
public float RelativeWeight;

//Here, we name our target objects
GameObject[] blockALPHA;

//Initialise code:
void Start ()
{
    //here, we define our target objects further by searching for the predefined tag
    blockALPHA = GameObject.FindGameObjectsWithTag("Block ALPHA");
}

//Use FixedUpdate because we are controlling the orbit with physics
void FixedUpdate ()
{ "} EXPECTED"

    //this is where we define the graverage coordinates
Vector3 graverage (Vector3[] blockALPHA)
    {
        if (blockALPHA.Length == 0)
            return Vector3.zero;
        float x = 0f;
        float y = 0f;
        float z = 0f;
        foreach (Vector3 pos in blockALPHA)
        {
            x += pos.x;
            y += pos.y;
            z += pos.z;
        }
        return new Vector3(x / blockALPHA.Length, y / blockALPHA.Length, z / blockALPHA.Length);

        Vector3 offset;

    //here we get the offset between the object and the average position of all objects
    offset = graverage - transform.position;

    //This is the variable for square magnitude calc
    float magsqr;

    //Offset Squared:
    magsqr = graverage.sqrMagnitude;

    //Check distance is more than 1 to prevent division by 0 (because my blocks are all 1x1x1, any closer and they'd be intersecting)
    if (magsqr > 1f)
        {
        //Create the gravity- make it realistic through division by the "magsqr" variable

            GetComponent<Rigidbody>().AddForce((RelativeWeight * graverage.normalized / magsqr) * GetComponent<Rigidbody>().mass);
        }
    }
}

I don't doubt that I've overlooked something stupid, but it's my first stab at proper coding, so, no shame in asking

Thanks :D

sentences:
Determine if Plane is seen by Camera If I have an arbitrary plane (center and normal) or a quad (center, normal and width and height) and a camera (frustum, projection & view matrix, etc). Then how would I go about calculating if the plane/quad is visible to the camera?

Additionally how would I calculate to check if it's the front or the back of the plane/quad that is visible to the camera?

My first idea was to do some ray vs plane intersection, but then I realized that it of course wan't going to work!

bool plane_visible = false;
const float denom = plane_normal.dot(camera.getLook());

if (abs(denom) > 0.0001f)
{
    const float t = (plane_position - camera.getPosition()).dot(plane_normal) / denom;

    plane_visible = (t >= 0.0f);
}

Using the dot product of the plane/quads normal and the camera's look direction. Will give wrong results!

For instance, use the following image as an example! A dot product will tell me that I'm looking at the face that's facing outwards of the frustum. Though the face that I'm actually looking on is face facing inwards the frustum/towards the camera!

sentences:
Where should I place input/output console for server? I'm developing a simple 2d online game and now I'm designing my server. The server will be run on linux vps and I need a way to communicate with it (for example to close it, and as it will be run on vps, simply closing terminal won't work). So I think there are 2 options:

1) Write 2 apllications - server which doesn't say anything and doesn't accept console input and the second application is console which sends commands to server (like exit, get online players etc).

2) Have 2 threads on the server appplication - one is the real server, the second thread will be used for cin and cout. However I'm not sure if this will work on vps...

Or maybe there is better aproach? What is the usual way of doing this?

sentences:
gamemaker getting a ball to bounce 90 degrees off of a 45 angle I am trying to get a circle to bounce off a 45 degree diamond shap using Gamemaker Studio.
I would like the ball to bounce in straight lines so my directions would be 0, 90, 180, or 270 degrees, depending on which side of the diamond the collision takes place.  Precise bouncing is giving me all sorts of results so I think I would have to do it in code.

I tried saying:

  if (direction >=0 && direction <=90) {   direction = 90 }

And doing this for all the angles, but this did not work.

Has anyone encountered this before?

sentences:
How do I iterate over map tiles visible within a rectangular portion of an isometric view? I have an isometric map broken up into terrain tiles.
the area of the map on-screen is given by a rectangle rotated 45 degrees (in red below).

Given the position of the corners of the visible rectangle,
how would I go about iterating over all visible tiles (shaded),
such that no tile down or to the right of tile A is iterated upon before tile A

sentences: In Android, is saving game data in a binary file a good approach? I am nearly finished with my Android game, but I want to make sure my save format is good. I am working on a fairly large game, so data such as high scores, stars, etc. are stored for around 80 levels, along with data for purchased items. Currently I save this data sequentially in a binary file. So when I need to load it, I have to go through all of the previous data to get to the data that I actually need. It seems to work fine, but I question how well this format will hold up for game updates. Is this is a bad approach to take? I considered using SQLite, but after trying to implement it into my game it didn't seem very effective. Updates seem as if they would be even more complicated.

sentences:
How can i rotate both NPCS facing the door moving to the door and then...? I need to make some steps.

To rotate both npcs but each time running the game they will rotate randomly from another direction. For example the first one will rotate from the right side or left side same the other one.
They will facing the door and start moving to the door. Near the door she will open automatic they will wait then they will move through the door.
one of the npcs will keep moving and will start random patrolling.
The second npc will rotate facing the door from the outside and will do something like locking the door ( I will animate it later he will rotate facing the door wait 2-3 seconds will rotate and will join the first npc and start patrolling too.

This is a screenshot of both npcs each one have a box collider. The door they should rotate smooth randomly and facing and moving to the door the one behind them.

This is the behind the door outside the hall. This is where one of the npcs should start patrolling and the other one wait some seconds facing the door like he is locking the door and then after some seconds to join and start patrolling too.

And this is the hall out side the door and then the hall right and left. They should be patrolling the hall right and left and also the hall with the door.
But not getting too close to the door/s so they will not open all the time.

The last screenshot show where they should be patrolling. The left image is the hall outside the door the right image is a door on the front hall on the right and the bottom image the door on the left.

It's like a T

I need some guide how to start it by logic how to do it.
I have the scenario in my mind what they should do the 4 steps. But not surw hot start doing it.

The scenario in general is: Two guards(npcs) lock the door from the outside and start patrolling outside.

sentences:
MonoGame Cross-Platform Conditional Compilation Symbols What are the possible compiler directives for MonoGame?

For example, XNA contained directives for WINDOWS, XBOX/XBOX360, and WINDOWS_PHONE.

I've also seen DIRECTX and OPENGL, but when would you need to leverage those?

Supported Platforms:

PC
Windows 8 Store App
Linux
Android
OUYA
Mac
iOS
Playstation Mobile

sentences:
Right click a location and move towards it (C# Monogame) I would like the player to move towards the mouse when the player right clicks. The player does move, but doesn't stop when the player reaches the point.
Here is the code.

void playerUpdate(GameTime gameTime)
    {
        float dT = (float)gameTime.ElapsedGameTime.TotalSeconds;
        player.pos.X += player.vel.X * dT;
        player.pos.Y += player.vel.Y * dT;

        player.checkDest(x2y2, player.pos);

        if ((mouse.RightButton == ButtonState.Pressed) && (player.moving == false))
        {
            x2y2.X = mouse.X;
            x2y2.Y = mouse.Y;

            player.move(x2y2, player.pos);

        }
    }

The player's file,

        public void move(Vector2 dest, Vector2 pos)
    {
        dist.X = pos.X - dest.X;
        dist.Y = pos.Y - dest.Y;

        vel.X -= dist.X;
        vel.Y -= dist.Y;

        moving = true;
    }

    public void checkDest(Vector2 dest, Vector2 pos)
    {
        if (pos == dest)
        {
            vel.X = 0;
            vel.Y = 0;
            moving = false;
        }
    }

I assume it is because of the player's position and its use of decimals and the mouse position being integers. How could I work around that?

sentences:
(XNA) Possible to hide, compress, or rename .XNB files? I'm fairly new to XNA (only a week into C# and XNA at this point) but I have been developing games for a while now, and the program I used did not require any/many external files in creating an executable. I am perfectly fine with external files (for the most part) but reading around, it seems as if .XNB files are easily accessed for others to pull your resources out of.

After some thinking, I was wondering if it was possible to do any of these 3 things:
1. Hide the .XNB files within the .exe in which case it would likely create them in an external location only during run-time (wouldn't really solve the main issue, but still)?
2. Compress many of the .XNB binaries into a single binary (such as 1 for sounds, 1 for sprites, etc.)
3. (This one is one simply for my own OCD) Change the extension name from .XNB to something of my choosing? For example, to .DAT instead to make it less of a direct indicator I used XNA and/or these files can be accessed with an .XNB ripper?

None of these would particularly solve my initial problem, but I still wonder if they are possible. Anyhow, thanks in advance guys!

sentences:
LibGDX, vertical group not displaying I'm having trouble showing a simple custom VerticalGroup.

Here's my SideBar class:

public class SideBar extends VerticalGroup {
    final GameManager gameManager = GameManager.instance;
    final Image nextBackground;
    final Image nextImage;
    final Image powerImage;
    final Image powerUp1Background;
    final Image powerUp2Background;
    final Image powerUp3Background;

    public SideBar() {
        super();
        nextBackground = new Image(gameManager.getTexture("bar.next.png"));
        addActor(nextBackground);
        nextImage = new Image(gameManager.getTexture("label.next.png"));
        addActor(nextImage);
        powerImage = new Image(gameManager.getTexture("label.power.png"));
        addActor(powerImage);
        powerUp1Background = new Image(gameManager.getTexture("powerup.bg.png"));
        addActor(powerUp1Background);
        powerUp2Background = new Image(gameManager.getTexture("powerup.bg.png"));
        addActor(powerUp2Background);
        powerUp3Background = new Image(gameManager.getTexture("powerup.bg.png"));
        addActor(powerUp3Background);
    }
}

And here's where I add it to my main Stage:

    TopBar topBar = new TopBar();
    topBar.setY(DonutsGame.WORLD_HEIGHT - topBar.getHeight());
    stage.addActor(topBar);

    SideBar sideBar = new SideBar();
    Gdx.app.log(TAG, "side bar - x,y: " + sideBar.getX() + "," + sideBar.getY() + ", w,h: " + sideBar.getWidth() + "," + sideBar.getHeight());
    stage.addActor(sideBar);

My TopBar class extends Group and is displaying correctly, so I'm not sure what I'm doing wrong with SideBar that's causing it to not show.

The log output shows that the position, and width/height are all 0, which seems incorrect to me according to the vertical group's documentation. Which states that the width/height should be based on the pref. width/height of the children (height based on sum).

I've tried calling validate and layout with no success.

sentences:
Detect walking on floor - works partially I have a set of Gameobject blocks that form a floor with Box Collider and a GameObject with a Box Collider in it.

My first hunch detecting hitting the floor was:

void OnCollisionEnter2D(Collision2D collision) {
    print ("Enter: " + collision.gameObject.tag);
    switch (collision.gameObject.tag) {
        case "Floor":
            isOnFloor = true;
            break;
    }
}

This works well. However, when I want to check whether he left the floor (falling):

void OnCollisionExit2D(Collision2D collision) {
    print ("Exit: " + collision.gameObject.tag);
    switch (collision.gameObject.tag) {
        case "Floor":
            isOnFloor = false;
            break;
    }
}

The GameObject Drops down as soon as I move a little, as I get the OnCollisionExit2D method...

How do I create a constant movement on a floor, and invoke "falling" only if I completely leave it?

Thanks!

sentences:
Unity access Label in GUI? There is a quick and dirty appreoch to creating text boxes:

void OnGUI(){
    GUILayout.Label("Text 1");
}

It works well. But, since the Label method returns void, how do I access this later on?

Let's say I want to access the text later to change the score?

someField = GUILayout.Label("Text 1");

Is not going to work.

sentences: Converting Cube Maps I have cube maps in lat/long format, and i need to convert them to Horizontal/Vertical Cross, and individual cross images, is there an utility to do that?

sentences: LWJGL Rendering a 2D Object at a Certain Position On-Screen Okay, so in LWJGL, how can I render a 2D object (maybe for like a menu, or meter that shows up on screen during the game), and have control over size and position on screen? So I can tell it what position relative to the screen. It is a 3d game using gluPerspective (as opposed to glOrtho).

sentences:
Mobile vs. Desktop Games - Upsides and Downsides? what is the opinion on developing a game for Mobile vs. Desktop in terms of monetization and revenue versus time spent?

In my opinion, Mobile has more upside in terms of revenue, but as a developer I am not sure if Mobile is any easier to develop for than Desktop.

Thoughts?

These articles are a good source:

https://venturebeat.com/2017/07/13/mobile-game-revenue-finally-surpasses-pc-and-consoles/
https://www.cnbc.com/2016/04/22/mobile-game-revenue-to-pass-console-pc-for-first-time.html

sentences:
OpenGL Water reflection seems to follow camera yaw and pitch I'm attempting to add reflective water to my procedural terrain. I've got it to a point which seems like it's reflecting however when I move the camera left/right/up/down the reflections move with it.

I believe the problem has something to do with the way I convert from world space to clip space for the projective texture mapping.

Here is a gif of what is happening.
http://i.imgur.com/PDta5Qu.gifv

Vertex  Shader

#version 400
in vec4 vPosition;
out vec4 clipSpace;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

void main ()
{
  clipSpace = projection * view * model * vec4(vPosition.x, 0.0, vPosition.z, 1.0);
  gl_Position = clipSpace;
}

Fragment Shader

#version 400
in vec4 clipSpace;
out vec4 frag_colour;
uniform sampler2D reflectionTexture;

void main ()
{
    vec2 ndc = (clipSpace.xy / clipSpace.z) / 2.0 + 0.5;
    vec2 reflectTexCoords = vec2(ndc.x, -ndc.y);
    vec4 reflectColour = texture(reflectionTexture, reflectTexCoords);

    frag_colour = reflectColour;
}

I'm using this code to move the camera under the water's surface to get the reflection

float distance = 2 * (m_camera->GetPosition().y - m_water->GetHeight());
m_camera->m_cameraPosition.y -= distance;
m_camera->m_cameraPitch = -m_camera->m_cameraPitch;

If this is insufficient code to diagnose the problem, I'll post more. I tried to keep it to what I thought could be the problem.

sentences:
Drawing roads on heightmaps I've been running into walls for the past week or so on my toy project in UE4. My goal is to draw procedural roads on a procedural landscape (eventually getting to intersections and buildings). The landscape is generated with libnoise and the roads are generated with a slightly modified version of the algorithm found here.

But I'm having issues draping the roads on the landscape and I can't find any straightforward algorithmic way of doing it. You can see my problem below: the geometry of the road intersects the geometry of the landscape.

In short, given:

The landscape index buffer
The landscape vertex buffer
Every road segment's X,Y,Z coordinate

How do I modify the underlying vertex/index buffer so that the landscape "wraps around" the roads?

sentences:
How can I create a lightning attack similar to Agahnim's in Legend of Zelda: Link to the Past? I'm currently trying to recreate this attack, and I'm unsure of how it works.

It seems like the boss creates 4 lightning bolts which move downward at 45 degree/diagonal angles, changing direction every so often.

I'm building my game in Zelda Classic. I'd preferably like to know how to do this in C++, although I am fine with Java or anything C++/C-like.

sentences:
Testing whether two cubes are touching in space Does anyone have any clean ideas on testing whether two cubes in 3D space touch? By touch I mean, touch at corners or on a face or on an edge. Say that the cubes are axis aligned and there is no nesting of the cubes. So either the cubes touch or they don't. There is no overlap of the cubes at all (except of course possibly an edge or corner point).

Everything I have thought of ends up needing a ton of cases. Also numerical stability is a factor. I don't want to just test == on all the edges/points.

I guess I could utilize some sort of epsilon instead of testing whether something == 0. The main thing however is minimizing the number of cases to test.

sentences:
Load Prefab to variable I have my code, for my weapon:

using UnityEngine;
using System.Collections;

public class Arma : MonoBehaviour {

    public static int municao;
    GameObject bullet;
    GUIText texto;
    // Use this for initialization
    void Start ()
    {

        //bullet = GameObject.Find("Bullet");
        municao = 10;
        texto = GameObject.Find ("qtdMunicao").GetComponent<GUIText>() as GUIText;
    }

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

        texto.text = municao.ToString ();

        if(Input.GetKeyDown("i"))
        {
            if(municao > 0)
            {
                Instantiate(bullet, transform.position, transform.rotation);
                municao--;
            }
        }
    }
}

`

How can i load the prefab to my variable to use in my instantiate?

sentences:
Matchmaking by user-supplied parameters I'm looking for matchmaking algorithm for a 1 vs 1 online game. Players must not be matched by their skill level, but instead by some specific filters set by the players.

Each player sends a request that specifies some set of parameters (generally, 2-4 parameters). If some parameter is specified, the player can be matched only with those who had sent this parameter with exactly the same value or those who haven't specified the parameter at all.

I need this algorithm to be thread-safe and preferably fast. It would be great if it worked with 3-4 or even more parameters, but even one is alright (in my case, it's a game bet). Also, I'd appreciate ideas on how to implement or improve this algorithm on my server platform - ASP.NET.

One more problem I'm facing is that match finding can't be executed right after the user sends request, because if another user sends a request before a previous matching is finished, they won't be matched even if they possibly could. So it seems that match finding should be started on schedule. I need help on how to optimize it and how to choose time interval for starting new match finding.

P.S. I've also posted this question on stackoverflow

sentences:
What is UVIndex and how do I use it on OpenGL? I am a noob in OpenGL ES 2.0 (for WebGL) and I'm trying to draw a simple model I've made with a 3D tool and exported to .fbx format. I've been able to draw some models that only have: A vertex buffer, a index buffer for the vertices, a normal buffer and a texture coordinate buffer, but this model now has a "UVIndex" and I'm not sure where am I supposed to put this UVIndex. My code looks like this:

GL.bindBuffer(GL.ARRAY_BUFFER, this.Model.House.VertexBuffer);
GL.vertexAttribPointer(this.Shader.TextureAndLighting.Attribute["vPosition"],3,GL.FLOAT, false, 0, 0);
GL.bindBuffer(GL.ARRAY_BUFFER, this.Model.House.NormalBuffer);
GL.vertexAttribPointer(this.Shader.TextureAndLighting.Attribute["vNormal"], 3, GL.FLOAT, false, 0, 0);
GL.bindBuffer(GL.ARRAY_BUFFER, this.Model.House.TexCoordBuffer);
GL.vertexAttribPointer(this.Shader.TextureAndLighting.Attribute["TexCoord"], 2, GL.FLOAT, false, 0, 0);

GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, this.Model.House.IndexBuffer);

GL.bindTexture(GL.TEXTURE_2D, this.Texture.HTex1);
GL.activeTexture(GL.TEXTURE0);

GL.drawElements(GL.TRIANGLES, this.Model.House.IndexBuffer.Length, GL.UNSIGNED_SHORT, 0);

But my model renders totally incorrect and I think it has to do with the fact that I am ignoring this "UVIndex" in the .fbx file, since I've never drawn any model that uses this UVIndex I really have no clue on what to do with it.

This is the json file containing the model's data: http://pastebin.com/raw.php?i=G294TVmz

sentences:
How can I enhance this keyboard handler class (remove global variables) I would like to enhance my keyboard class to be more tight and encapsulated. The first issue I've addressed is Singleton design pattern. I've done this as follows:

/*** inside keyboard.h ***/
class Keyboard
{
public:
    static Keyboard* Instance(){
        if(s_pInstance == NULL)
            s_pInstance = new Keyboard;
        return s_pInstance;
    }
    ...
private:
    static Keyboard* s_pInstance;
    Keyboard() {}
    ...
};

/*** inside keyboard.cpp ***/
#include "keyboard.h"

Keyboard* Keyboard::s_pInstance = NULL;
...

The design pattern works just fine. Now in while(true) I can do

while(Window is Open){
...
    if ( Keyboard::Instance()->isKeyDown() ){
        if ( Keyboard::Instance()->m_key == GLFW_KEY_E )
            std::cout << "E is pressed ..." << std::endl;
    }
...
}

In GLFW, I have to declare key_callback as static member function. To store keyboard actions, I've introduced global variables and every time I call any Keyboard function, I need to update those global variables as follows:

bool Keyboard::isKeyDown()
{
    // assign global variables to data members
    update(g_key, g_scancode, g_action, g_mode);

    if( m_action == GLFW_PRESS ){
        std::cout << "Key down..." << std::endl;
        ...
        // reset global variables
        m_action = -1;
        g_action = -1;
        return true;
    }

    return false;
}

void Keyboard::update(int k, int s, int a, int m)
{
    m_key      = k;
    m_scancode = s;
    m_action   = a;
    m_mode     = m;
}

The code works but I don't believe this is the right way to encapsulate my class. Any suggestion how to remove these global variables which is a consequence due to using static function?

This is the full code

#ifndef _KEYBOARD_H
#define _KEYBOARD_H

#include <GLFW/glfw3.h>

class Keyboard
{
public:

    static Keyboard* Instance(){
        if(s_pInstance == NULL)
            s_pInstance = new Keyboard;
        return s_pInstance;
    }
    void init(GLFWwindow* window);
    void update();
    bool isKeyDown();
    bool isKeyUp();

    int m_key, m_scancode, m_action, m_mode;
private:
    static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mode);

    GLFWwindow* m_pWindow;
    Keyboard() {}
    static Keyboard* s_pInstance;
    bool keys[1024];

    void update(int, int, int, int);

};

#endif

keyboard.cpp is

#include "keyboard.h"
#include <iostream>

Keyboard* Keyboard::s_pInstance = NULL;

int g_key, g_scancode, g_action, g_mode;

void Keyboard::init(GLFWwindow* window)
{
    m_pWindow = window;
    glfwSetKeyCallback(window, key_callback);
}

void Keyboard::key_callback(GLFWwindow* window, int key, int scancode, int action, int mode)
{
    g_key      = key;
    g_scancode = scancode;
    g_action   = action;
    g_mode     = mode;
}

bool Keyboard::isKeyDown()
{
    update(g_key, g_scancode, g_action, g_mode);

    if( m_action == GLFW_PRESS ){
        std::cout << "Key down..." << std::endl;
        keys[m_key] = true;

        m_action = -1;
        g_action = -1;
        return true;
    }

    return false;
}

bool Keyboard::isKeyUp()
{
    update(g_key, g_scancode, g_action, g_mode);

    if( m_action == GLFW_RELEASE ){
        std::cout << "Key up..." << std::endl;
        keys[m_key] = false;

        m_action = -1;
        g_action = -1;
        return true;
    }

    return false;
}

void Keyboard::update(int k, int s, int a, int m)
{
    m_key      = k;
    m_scancode = s;
    m_action   = a;
    m_mode     = m;
}

sentences:
How can I access game instance data in a window procedure callback? In the window procedure message processing function, I have come across a couple of things where I just have no idea what to do apart from declare a class globally so that my window procedure can see it.

Imagine I have a Game class that is created in the window loop function and has a handle to the window passed through into it:

class Game
{
    game( HWND hWnd );
    void Go();
    void ReCalculateViewportOffsets();
}

...// windows stuff and handle to window created
Game theGame( hWnd );
...// windows loop starts
theGame.Go();

Half-way through my game, someone changes the resolution so I need to fire a redraw with new offsets to center my viewport... I  would like to call that from my WM_RESIZE handler, but theGame has been declared as a local in my main function rather than a global. Probably a good thing? but how on earth can I get hold of theGame in my windows procedure function without declaring it globally:

case "WM_RESIZE":
    //...
    theGame.ReCalculateViewportOffsets( newWidth, newHeight );

sentences:
Why would an online MMO throttle actions per day? I started playing Die2Nite and was surprised that it has such a strict limit on the number of actions per day. After a while, I figured it was just part of the charm.

I also started playing Magic Duel and it has a similar mechanic that limits the amount of actions per day.

Is there a game design principle behind a decision to limit actions per day in an MMO?

sentences:
Good practices while working with multiple game engines, porting a game to a new engine I have to work with multiple game engines, like

Cocos2d
Unity3d
Galaxy

While working with multiple game engines, what practices should I follow?

For instance, we made a game with Cocos2d and released it on the AppStore. Now we want to port it to other platforms using Unity.

What would be the course of actions to follow?

sentences:
Trying to simulate a cannon ball I'm writing a game, and I need to simulate a the path of a cannon ball.
I imagine I would have the initial velocity vector, and a vector for gravity.
Is there a good tutorial on how to do this?
(maybe I need to read some high school text books?)

sentences:
In regards to applet games and UDP I've got about a year in Java experience, and would like to set up a server and client for an applet game. However, there doesn't appear to be any tutorials out there on anything like I want to use.

I would the server to be able to store an array of x and y coordinates with a player name somehow associated to them, and send them to multiple clients in a short time span. I would like the client implemented in the applet, and be able to request any player's position data.

I'd like to use UDP, because it seems to be the best option for efficient (if less reliable) transmission of data.

If anyone could give me some pointers on how to do such a project, or point me to an appropriate tutorial, I'd certainly appreciate it.

sentences:
stats or profit give away result of game Think of a coinflip game, whose logic looks as follows:

Server sends websocket message (RESULT_MESSAGE) to frontend with result of a game (won/lost)
Server sends websocket message to frontend with updated aggregated stats (STATS_MESSAGE) (think all-time profit after the new coin flip, or updated all-time stats)
Frontend reacts to RESULT_MESSAGE by playing an animation (coin flipping). It also updates the all-time stats and profit in response to STATS_MESSAGE

The problem with this logic is, responding to STATS_MESSAGE (updating profit and stats) gives away the result of the coin flip before the animation finishes.

Solutions I cannot use:

Merging RESULT_MESSAGE and STATS_MESSAGE together, and only updating the  stats/profit after animation finishes. Because those 2 messages are produced and sent by different services.
Linking a particular RESULT_MESSAGE to a STATS_MESSAGE and only reacting to a STATS_MESSAGE when its corresponding RESULT_MESSAGE has been processed and its animation completed. Because in reality I have several kinds of STATS_MESSAGES (trophies updated, stats updated, profit/balance updated, etc), and it's just not practical for the frontend to hold onto all those messages until their respective RESULT_MESSAGE is processed

Solutions I've tried successfully before, but I'm trying to avoid:

Having the backend send STATS_MESSAGE with a delay, to make sure it doesn't reach the frontend before the coinflip animation has finished. This sort of encodes frontend behavior (animation) on the backend.

All ideas and suggestions appreciated. Thanks a lot!

EDIT: I made the coin-flipping example for simplicity, but it's not precisely con-flipping. It's a multiplayer game where dozens of games/animations per user per seconds are going on. So queuing a bunch of stuff on the frontend might be less than ideal (I'm still looking into performant versions of this solution though).

Pulling the STATS data via an API call when the animation finishes (instead of using websockets data) is another alternative that I've considered, but for the same reason described above it might not be feasible (dozens of API calls per user per second). Plus there's a chance that an API call is triggered by game-1 finishing, but while game-2 animation is still going on, giving away the result of game-2

sentences: Unity3d memory management I am baking animation to draw a huge amount of crowd in unity3d. I am storing mesh of each frame of skinned mesh in the list and just iterating over it. I can't use the compute shader as I want to target low-end devices too. But now I am facing memory issues as mesh consumes over 1.5gb of memory. Is there any way I can free memory consumes by mesh?

sentences:
Unity3d:Detect a collision between an image and a sphere So, I just realized, an image with BoxCollider2D wont detect any collision with Sphere with SphereCollider.

I tried adding a BoxCollider to my image, but it behaves in a weird manner (The Canvas position keeps shifting)

So, I can see the only way for it to work is adding a 2D Collider to the sphere? Is there any other better way to solve it? Adding a 2D Collider to the sphere wont cover the whole area

sentences:
Collision physics error I am working on a game developed using Scenekit (iOS). I am facing some strange issues with collision physics.

I have added one 3D table (with a hole at its center) to the scene. I am setting physics shape of this 3D model using following code:

SCNBox* tableBody = [SCNBox boxWithWidth:(5*golf.scale.x) height:(0.5*golf.scale.x) length:(9*golf.scale.x) chamferRadius:0];

table.geometry = tableBody; //table geometry

//physics shape scale
NSValue *shapeScale = [NSValue valueWithSCNVector3:SCNVector3Make(table.scale.x, table.scale.y, table.scale.z)];

//physics shape options
NSDictionary *shapeOptions = [NSDictionary dictionaryWithObjectsAndKeys:shapeScale,SCNPhysicsShapeScaleKey,SCNPhysicsShapeTypeConcavePolyhedron,SCNPhysicsShapeTypeKey, nil];

//physics body
table.physicsBody = [SCNPhysicsBody bodyWithType:SCNPhysicsBodyTypeStatic shape: [SCNPhysicsShape shapeWithNode:table  options:shapeOptions]];

I am adding one 3D ball on top of this table.

Issue:
The Ball collides with 3D table mesh triangles and changes directions

Image showing 3D table's physics shape:

I have following questions:

How can I stop collision of ball with these lines?
Are there any modification to the physics can be done? I want the hole to be part of the physics shape so that the ball can fall into the hole.

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences:
Game mechanics for a persistent real-time strategic/tactical game I am designing a game based around a fairly realistic simulation of 'Age of sail'-like trading and combat, and I  am currently trying to decide whether to make the game a limited on-line application, in which the game world exists only while all the players - 2 to 8 of them - are all online, or a persistent real-time mmo application, in which game events occur on a set schedule.  As a game for a small number of players, uninteresting events could be time-accelerated away.

The trouble with a real-time MMO is that the world objects would be persistent, yet the players would be transient.  Since in-game encounters and combat would take place on a schedule determined by the actions of all the players, not just those that happen to be online, players could easily miss an encounter or battle in which their vessel happened to be involved - or at least could be involved.

An idea I had for the MMO version was that otherwise idle time could be spent in training - which would be simulated, not merely administrative, and that active crew positions such as gunners, helmsmen, marines and officers could be filled by players, so one ship might have many players online in engagements, each contributing to the success - or otherwise - of the battle.  These positions would be filled by players whose vessels were all engaged in uninteresting travel or laid up for repairs, using a matchmaking system to match the players' observed skill to that of the NPC into whose shoes they would be stepping.  NPC skill progression would be based upon the actual skill improvement of the players who step into the role.

What other game mechanics could allow a game such as this to be playable as a persistent real-time mmo, especially when vessels could spend a long time in transit, doing nothing much of interest?

sentences:
Unable to add button in Unity I am wanting to add a button to my scene in order to mute/unmute music.  I can add the button to my scene, but it's not appearing on the UI.  I can't see it anywhere, not on the scene nor the game when running.

Below is a screenshot of the editor.  You can see the button in front of the camera and in front of the scene itself, but it doesn't appear.  I can't actually see a button, just a 'move' control'.

Things I have tried:

Changing the 'Layer' of the button to default
Adjusting the z-axis (I've tried 0, +1-5, -1-5)
Giving the Image (Script) a material inside the Inspector

The button has text, which isn't visible either.

I could create a sprite and do a raycast, but that seems like overkill just to do a simple click action.

Any ideas?

sentences:
Why is my velocity decaying? Programming in Java.  Tinkering around with physics.  My entities all have position and velocity.  In the main loop, all I'm doing is applying gravity and bouncing off the edges, like so:

    //  add gravity vector
    o.velocity.add(GRAVITY.cpy().mul(dt));

    //  bounce off walls
    if ((o.position.x<0 && o.velocity.x<0) || (o.position.x>WORLD_SIZE_X && o.velocity.x>0))
        o.velocity.x*=-1;

    //  bounce off of ground
    if (o.position.y<=0.0f) {
        o.position.y=0.0f;
        if (o.velocity.y<0)
            o.velocity.y *= -1;
    }

The x and y values of my vectors are just floats.

For the first second it looks like it's working fine, but the vertical velocities slowly decay.  Any idea why?

sentences:
portal cutoff effect I want a 3D Mesh to come out of a flat portal. Only the part of the mesh that's coming out of the portal should be rendered, so the mesh should be cut off or sliced until it's fully outside the portal.

I thought about using discards in a fragment shader, but since I work on iOS OpenGL ES 2.0 I'd like to avoid that for performance reasons. Is there a performant way to do this?

sentences:
Asset workflow for Blender models? As a coder, I don't have much experience in asset creation workflow. I'm trying to figure out the best way to work effectively with Unity + Blender combo. I don't export to FBX, I prefer to work directly with Blender files, with no intermediate export step.

I have parts of the map that I place in the scene: walls, decorations, whole rooms, etc - I keep them in one Blender file. I have models of collectibles, like treasures, keys and the like - I keep them in another Blender file. I have models of characters, which I keep in another one. It has worked OK so far, however I feel like it's not the best way to work. While it makes sense in Blender, it gets messy in Unity.

What is an effective way of working with this combo? Or with asset import in a larger project, in general? Should I export to FBX instead of using Blender files directly? I'd like to understand now how and why to adapt the workflow than have everyone involved being slowed down later.

sentences:
Create multiple viewports in minecraft? Im new to minecraft modding, but Im curious about the possibility of creating a mod such that players could set up a 'security camera' with its own viewport so that the player could 'see what the camera sees'. For example, imagine a minimap style window that displays the viewport of the camera you've setup.

Specific questions:

can you have a second viewport that isnt tied to the player?
Can you programmatically access a viewport? e.g. store the pixel values to a variable rather directly rendering to the screen.

sentences:
2d array to calculate height for player in heightmap? I'm trying to work out how to do so my player position takes into the account of the floor so if I generate a floor that is hilly when I walk I won't walk through the heel. The problem is that I'm not sure how to do it.

I can do basic collision detection for walls. However, this isn't collision detection. I need the add the height of the terrain to the player.

So as you see the terrain is really a grid with 4 points making a face. So I can get the 4 points and work out. I can probably work this out on myself, but I was wondering if I should store say the heigh at (x,z) in a 2d array or do I just work out the height again everytime I move?

It just I use simplexnoise and I worry that this will be expensive to do every turn.

 import java.util.ArrayList;

    public class VoxelLevel
    {
    Mesh mesh;
    Material material;
    Transform transform;
    Shader shader;

    VoxelLevel(String textureName)
    {
        material = new Material(new Texture(textureName));
        transform = new Transform();

        shader = BasicShader.getInstance();

        generateLevel();

    }

    private void generateLevel()
    {
        ArrayList<Vertex> vertices = new ArrayList<Vertex>();
        ArrayList<Integer> indices = new ArrayList<Integer>();

        int sizeX = 10;
        int sizeZ = 10;
        int freq = 25;

        for(int x=-300; x<300; x+= sizeX)
        {
            for(int z=-300; z<300; z+=sizeZ)
            {
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+3);
                indices.add(vertices.size()+2);
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+1);
                indices.add(vertices.size()+3);

                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, z/freq) + 0.25 * SimplexNoise.noise(2*x/freq, 2*z/freq)),z), new Vector2f(0.75f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, z/freq) + 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*z/freq)),z), new Vector2f(0.75f,1.0f)));
                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*x/freq, 2*(z+sizeZ)/freq)), z+sizeZ), new Vector2f(1.0f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*(z+sizeZ)/freq)),z+sizeZ), new Vector2f(1.0f,1.0f)));
            }
        }

        Vertex[] vertArray = new Vertex[vertices.size()];
        Integer[] intArray = new Integer[indices.size()];

        vertices.toArray(vertArray);
        indices.toArray(intArray);

        mesh = new Mesh(vertArray, Util.toIntArray(intArray));
    }

    public void input()
    {

    }

    public void update()
    {
        //SimplexNoise.noise(0.25, 0.25);
        //SimplexNoise.noise(0.35, 0.65);
        //SimplexNoise.noise(0.254, 0.225);
        //SimplexNoise.noise(0.254, 0.215);
    }

    public void render()
    {
        shader.bind();
        shader.updateUniforms(transform.getTransformation(), transform.getProjectedTransformation(), material);
        mesh.draw();
    }

}

sentences:
How to make a road terrain for unity game? im making a FP game in low poly style. I want to make some terrains for my game, with roads, trees, rocks, buildings and e.t.c. Unity terrains are not as good as i thought. They allow a good tool for placing multiple objects (like tree-to-sprite tools, trees mesh copy for perfomance), but the terrain building tool itself is very poor, so i cant use 3d terrain, because there will be no great tools for placing surroundings.

So my plan is - make low poly mountains, trees, rocks in Blender, then make a simple terrain with hills in unity and just place my surrounding objects on it. I have some troubles, for example - roads. I have a road elements, and by connecting & banding them i can get a really nice road. But how can i make a road on Unity's terrain?

For example it could be useful to export unity terrain as a 3d mesh to Blender, then make my roadways and export them in Unity.

sentences:
Using result of ProjectWorldToScreen for DeprojectScreenToWorld does not produce initial input data I am using this logic to project a point in world space into screen space.
const FVector Location = FVector(1, 2, 3);

FIntRect Rect;
Rect.Max.X = ViewportSize.X;
Rect.Max.Y = ViewportSize.Y;
FVector2D CurrentScreenSpaceCoords;

const FMatrix ViewProjectionMatrix = SceneView->ViewMatrices.GetViewProjectionMatrix();
SceneView->ProjectWorldToScreen(Location, Rect, ViewProjectionMatrix, CurrentScreenSpaceCoords);

I am using this code to get the initial value back
FMatrix const InvViewProjMatrix = ViewProjectionMatrix.Inverse();
FVector WorldPosition;
FVector WorldDirection;
FSceneView::DeprojectScreenToWorld(CurrentScreenSpaceCoords, Rect, InvViewProjMatrix, WorldPosition, WorldDirection);

However the result of DeprojectScreenToWorld does not produce the initial input (Location).
Instead of giving me the expected vector of [1, 2, whatever], it gives me X = [69.8139954,3840.00073, 250.49826]
Edit:
I am interested in X,Y. I don't need Z.
Somebody knows:

Why this happens?
How to get the initial value back from it

Thanks in advance

sentences:
Is networking programming quite generic I have only looked into the basics, at least I assume it gets more complex. So does network code really change from one game to the next or is it pretty much portable. For example I can create say a 2 person chat app, now if you want to make it multi-chat you then need to use mutli-threading, ie a new thread for every connection(load a new Winsock object for each connection). I am also reading about mutex ojects, blocking and non-blocking sockets.

You then have 2 base networking API's, Winsock and BSD sockets, there are various wrappers for these such as Boost.

The principle is that you then send a snapshot of all the gamestate data back and forth between client and server and have some kind of load balancing to take into account lag and general synchronicity.

I can't see how this would really change from game to game though, these are fairly linear principles and one set of networking code should be compatible with the next?

sentences:
Where is the best place to find modeling artists that are loyal? For the past 3 years I have been working on my first indie game with a few friends but had to learn how to do everything myself, from coding, to creating models in blender and how to use Unity.

After a while I found a few people to help but they're either young or busy and I would like to find dedicated members for my game who won't leak or share things online.

I'm new to this and I would love some advice on where I can recruit members for my team who are loyal and dedicated to my game and it's cause.

(also if I posted this in the wrong place or said something odd I'm sorry, I don't know where else to ask as I've been stuck trying to find help for a good while now)

My biggest worry is that someone will steal or copy my idea if I post anything about the game online(we've had a few scares like that before) so it's the biggest thing for members to be loyal and not leak anything.

sentences:
What is a systematic process for choosing a mobile game engine? I am looking for a systematic process or methodology for choosing a mobile game engine for a mobile game project.

Intuition tells me that it should be similar in principle to choosing any off-the-shelf product (requirements, evaluation, short-list, trial, etc).

Any suggested processes?

sentences:
How can I simplify this code to compute the shortest rotation between two angles? The following code will find the shortest rotation (in radians) (from pi to -pi) that I need to apply to from to leave me with to.

Scalar rotationBetween(Scalar from, Scalar to)
{
    Scalar fromMod = std::signbit(from) ?
        pi * 2 + std::fmod(from, pi * 2) : std::fmod(from, pi * 2);
    Scalar toMod = std::signbit(to) ?
        pi * 2 + std::fmod(to, pi * 2) : std::fmod(to, pi * 2);

    Scalar rotation = toMod - fromMod;

    if(rotation > pi)
        return rotation - 2 * pi;
    else if(rotation < -pi)
        return 2 * pi + rotation;
    else
        return rotation;
}

Scalar is a c++ float.

Can I simplify this? I feel like this is far too much logic to do something so simple.

sentences:
Creating a static 2D background at runtime I'm using unity for a 2D game.

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

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

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

sentences:
Corona SDK: Animation takes a long time to play after "prepare" step First off, I'm using the current publicly available build, version 2011.704

I'm building a platformer, and have a character that runs along and jumps when the screen is tapped. While jumping, the animation code has him assume a svelte jumping pose, and upon the detection of a collision with the ground, he returns to running. All of this happens.

The problem is that there is this strange gap of time, about 1/2 a second by the feel of it, where my character sits on the first frame of the run animation after landing, before it actually starts playing. This leads me to believe that the problem is somewhere between the "prepare" step of loading up a sprite set's animation sequence and the "play" step. Thanks in advance for any help :).

My code for when my character lands is as follows:

local function collisionHandler ( event )
    if (event.object1.myName == "character") and (event.object2.type == "terrain") then
        inAir = false
        characterInstance:prepare( "run" ) -- TODO: time between prepare and play is curiously long...
        characterInstance:play()
    end
end

sentences:
DirectX11 without window attached? I just wonder, if it's possible to initialize and use DX11 or DX9 for offscreen rendering only - meaning with no attached window.
My intention is to do some GPU benchmarking before opening actual window. In this benchmarking some test scene is rendered, but should not be visible. (Actually depending on the benchmark score different windows are opened)

sentences:
Making an organized rendering class I'm using LWJGL (opeengl wrapper for Java) and Don't know how to make a renderer class for OpenGL. So In Immediate mode rendering I'd do a method like this to draw quadralaterals.

public static void drawQuad(int x, int y, int width, int height) {
    glBegin(GL_QUADS);
    glVertex2f(x, y);
    glVertex2f(x + width, y);
    glVertex2f(x + width, y + height);
    glVertex2f(x, y + height);
    glEnd();
}

Now that I want to use OpenGL 3+ , how can I organize code like this into a static rendering class I can call methods like Renderer.drawRect(x,y, width, height);? Or if I can make something like a spriteBatch class.

sentences:
Why is 90° horz / 60° vert the default FPS Field of View? As far as I understand it, vertical Field of View should be adjusted to:

fov = 2 * arctan(0.5*screenHeight / distanceEyeScreen);

That is, Field of View should match a user's distance to and size of the screen.

In many FPS, there's a default value of 90° for horizontal FoV, or 60° for vertical FoV (assuming 16:9). One example is CryEngine.
But for a 16:9 20" screen (diagonal of visible area, i.e. about 40 cm x 25 cm), this default value would require users to have their eyes 20 cm from the screen in order to get a perspectively correct view.

So either I've made a mistake in my calculations, or there must be a reason why you'd choose an inadequate FoV value on purpose.

What is the reason for a default FoV of 90° horz / 60° vert?

sentences:
Unity2D Sprite flips camera when moving left and right I am using the Unity Engine and coding in C#.

I have a sprite as a parent with a main camera as a child so that the main camera follows the sprite. However, when pressing 'A' and 'D' to move the camera 'flips 180 degrees' due to me using transform.eulerangles is there anyway that the camera can be excluded from this 'flip'?

void Movement () {

anim.SetFloat ("moveSpeed", Mathf.Abs (Input.GetAxisRaw ("Horizontal")));

if (Input.GetAxisRaw ("Horizontal") > 0) {
  transform.Translate (Vector3.right * moveSpeed * Time.deltaTime);
  transform.eulerAngles = new Vector2(0,0);
}

if (Input.GetAxisRaw ("Horizontal") < 0) {
  transform.Translate (Vector3.right * moveSpeed * Time.deltaTime);
  transform.eulerAngles = new Vector2(0,180);
}
}

sentences:
How can i convert a non-convex mesh collider object to a convex mesh collider object I created a character object in Maya and stored it as char.obj, then I imported the object into Unity.

The character object is not colliding with any other Unity objects like cube, plane, sphere, etc.

Then I found non-convex mesh colliders do not collide with any other Unity default objects. How can I convert the non-convex mesh collider to a convex mesh collider?

Here is the error message I see:

  Non-convex MeshCollider with non-kinematic Rigidbody is no longer
  supported in Unity 5. If you want to use a non-convex mesh either make
  the Rigidbody kinematic or remove the Rigidbody component. Scene
  hierarchy path "mesh_octopus/Default", Mesh asset path
  "Assets/PlaceAsset/mesh_octopus/mesh_octopus.obj" Mesh name "Default"

sentences:
How to move the arrow markers 1 unit only? I'm new to learning C#. How can I move an arrow one unit at a time?

Here's the code I'm using now:

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

public class ArrowMovement : MonoBehaviour
{
    float directX;
    float directY;

    public float moveSpeed = 5f;

    private Rigidbody rb;

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

    }

    private void FixedUpdate()
    {
        float h = Input.GetAxis("Horizontal") * 100;
        float v = Input.GetAxis("Vertical") * 100;

        Vector3 vel = rb.velocity;
        vel.x = h;
        vel.z = v;
        rb.velocity = vel;
    }
}

I just know how to do basic move

sentences:
Is a computer science degree worth it? I'm in my last year of high school, and I've been looking at colleges. I'm taking a C++ class at a local community college and I don't feel that it's worth it. I could have learned everything in that class in a week.

This had me thinking, would a CS degree even be worth it? How much can it teach me if I can learn everything on my own? Even if I do need to learn more advanced subjects, many colleges put their material online AND I can buy a book. Will companies hire me if I don't have a CS degree? If I have a portfolio will I stand a chance? What kind of things are needed in the portfolio?

I want to live doing what I love - programming. So I will do it. I'm just not sure that a CS degree will do anything to me. In addition, if there is a benefit to getting a CS degree, what places are the best?

sentences:
Problem with collisions detection on canvas platformer Having a lot of trouble with my collision detection in my platformer. If you go straight to the right the block will float.  Also the corners let the block sink right through and the walls are sticky. It's a bit of a mess. I know for the floating my gravity is a big issue. If anyone could help me out i'd be so so happy.

Heres the collision code:

  const calculatedTileSize = 1.0 / mapTileSize;
  const nextX = guy.x + guy.velX;
  const nextY = guy.y + guy.velY;

  const currentMinX = (guy.x * calculatedTileSize) | 0;
  const currentMaxX = ((guy.x + guy.width) * calculatedTileSize) | 0;
  const currentMinY = (guy.y * calculatedTileSize) | 0;
  const currentMaxY = ((guy.y + guy.height) * calculatedTileSize) | 0;

  const nextMinX = (nextX * calculatedTileSize) | 0;
  const nextMaxX = ((nextX + guy.width) * calculatedTileSize) | 0;
  const nextMinY = (nextY * calculatedTileSize) | 0;
  const nextMaxY = ((nextY + guy.height) * calculatedTileSize) | 0;

  // X axis collision
  if (guy.velX !== 0.0) {
    for (let i = nextMinX; i <= nextMaxX; i++) {
      for (let j = currentMinY; j <= currentMaxY; j++) {
        if (map[j][i]) {
          guy.velX = 0.0;
          break;
        }
      }
    }
  }

  // Y axis collision
  if (guy.velY !== 0.0) {
    for (let j = nextMinY; j <= nextMaxY; j++) {
      for (let i = currentMinX; i <= currentMaxX; i++) {
        if (map[j][i]) {
          guy.velY = 0.0;
          physics.gravity = 0;
        } else {
          physics.gravity = 0.4;
        }
      }
    }
  }

The full game is in this codepen:

https://codepen.io/charlie1172/pen/OeGdvJ

sentences:
When should I clear an auxilliary render target? I'm using a few different render targets in my game in addition to the back buffer. These other render targets are only used in a few places, for specific tasks.

I'm wondering when I should be clearing them. Right now I clear all of my render targets at the beginning of the frame, and it seems like I'm waiting for all the textures to clear before the rest of the drawing gets underway.

Would it be more efficient to clear these textures later in the frame, when they aren't being used? Is there any hope of the GPU sort of clearing them "on the side" while unrelated rendering is happening? Or are these tasks always sequential and will I always need to wait for clearing?

sentences:
Unity: C# Spell System I couldn't find any proper tutorials in the internet how to make one so I tried it myself. I've written a base "Skill" class with methods like Cast(), DealFlatDamage(), ShootProjectile() and they all work so far. But I also wanted to implement trigger methods for passive spells: OnDeath(), OnKilled(), OnProjectileHit().

First Question: Is this a wrong way to go? Because I couldn't find anything like this in the internet.

Second Question: The idea was to create new classes inheriting from this base class and the base class calling all the "On..."-methods of each derived class. How can I do this?

Would appreciate help!

sentences: what makes render() and update() change frame 60 times every second in LibGDX Whenever we declare the render(float deltatime) or update(float deltatime), in any class, it automatically become a method that is repeated 60 times per second. But what makes this method repeat itself 60 fps? What makes the method do that? In some classes, I am not implementing any other interface or expending any abstract class but that still makes the render(float deltatim) and update(float deltatime) work. Also, even though I do expend a interface like Game, how does the render(float deltatime) work? I mean, there is no special code within the render() in the Game interface class as well.

sentences:
Inconsistent sprite velocity? I'm moving my sprites using the following formula:

Code that I'm using (Only shows sprite's X position being calculated but Y position is also being done)

spriteGridX = 240/480;  //I start out with a virtual 'Grid' so I can scale position to all resolutions etc so 240/480 would place the sprite at the center of the screen (X)

spriteScreenX = spriteGridX * width;  //Scale to physical screen where width is the width of the current devices screen (viewport)

spriteXTime = 8f; //8 being the amount of time in seconds that this sprite will take to traverse the entire width of the screen

spriteXVel = 1/spriteXTime; //Velocity that will be used to move the sprite along the virtual grid position

So, when I need to move the sprite, I simply do the following:

spriteXGrid+= (spriteXVel * Delta) //+= for right -=for left. I'm using a fixed delta time
spriteScreenX = spriteGridX * width; //And again, convert to usable screen position for current device
drawsprite(spriteScreenX, SpriteScreenY); //Draw the sprite (drawSprite is just a method I've written to draw openGL quads and it takes the screen X and Y as coordinates - spriteScreenY not shown here but essentially same as X with height instead of width.

Problem

The above seems to work OK (if I specify, as above, 8seconds, then the sprite does indeed take 8seconds to pass the whole screen as far as I can tell).

However, a problem becomes evident when I have 2 sprites (in my case, 2 horizontally moving platforms, both starting at the outer edges of the screen - one on the left and one of the right) - these move towards each other and when they 'meet', they go back in the opposite direction, and again when they reach their initial starting positions.

After the second time, they start to move slightly out of sync and the problem accumulates.  Each platform has the same time/velocity settings and it seems that a sprite over the right side of the screen moves at a very slightly different speed than the one on the left.

After the initial move, the difference between the grid positions of my 2 sprites are a follows:

Left sprite = 0.002083334
Right sprite = 0.0020834

I can't work out why there is a difference.  They're using the same formula.

Of course the problem could be that they are reversing at slightly different times and not the speed as I suspect, but for now I've ruled that out as they seem to be reversing correctly.

Be grateful if anyone could assist.  Thanks

Test Device: Google Nexus 10, Samsung Galaxy Ace v1

sentences:
Algorithms for calculating vertex normals in 2D polygon I have the points of a 2D polygon in the order in which they are connected, and I need to calculate the vertex normals and move them along it. An example is shown.

I would like to know how to calculate them efficiently and which structures I could use. I don't know if I have to find the orientation of the polygon, and what to do in general. As I said the only thing I have to start with is the list of points in the order in which they are connected. Say 5 vertices, I have a list that goes: x1, y1, x2, y2, x3, y3, x4, y4, x5, y5.

Where should I start?

It doesn't matter if the polygon becomes complex or self crossing, nothing matters just that to calculate the normals at the vertices and move them along these normals in the correct direction, all outwards or all inwards the polygon.

sentences:
Modifying alpha of pixels in sufrace/texture I have a texture who's surface I've loaded with an image. Some areas of this image are completely transparent (alpha = 0), some completely opaque, and some are somewhere in the middle.

The issue I'm having is that when i draw the texture, the semi-transparent areas are "too" transparent. I want to make them more opaque.

In short, i want to multiply the alpha of all pixels on the surface by some constant. 0's will stay at zero. 255 will stay at 255. But the semi-transparent should get more opaque.

Is this possible? I've been messing around with the alpha blending render states but none of them seem to be able to do what i need them to do.

Thanks!

sentences:
Optimizing Octree Rendering Say I have an octree and at a certain level I store VBOs in that octree. I know the dimensions of of the nodes that own the vbo so I can do basic frustum culling.  That works nicely because everything outside of the screen is never rendered.

However my world is quite big and I currently also draw things behind already drawn octrees.  What would I use to not draw nodes that are occluded by other nodes and how would I go about that?

I saw some mentions of occlusion culling in the OpenGL superbible but I fail to see how I can utilize that when I don't have a clear distinction between occluders and occludees.

sentences: Font to polygon or triangle mesh I've been happy using bitmap fonts for games so far, but now I find I really need the polygon edge in some form. I saw the freetype engine some time ago, which can provide rastering of truetype fonts from within your engine, but what I think I really want for my current project is some way of converting from truetype to a triangle mesh.

sentences:
How do I generalise Bresenham's line algorithm to floating-point endpoints? I'm trying to combine two things. I'm writing a game and I need to determine the grid squares lying on a line with the floating-point endpoints.

Moreover I need it to include all the grid squares it touches (i.e. not just Bresenham's line but the blue one):

Can someone offer me any insight on how to do it? The obvious solution is to use naive line algorithm, but is there something more optimized (faster)?

sentences:
3d immersive Virtual Conference meeting environment development on the web (3d website)-Help required I want to develop 3d immersive virtual collaborative conference meeting environment on the web i.e an immersive virtual environment for our university Teachers to attend and address conference (meeting) Virtually in 3d

Each attendee have login with their customized avatar and can collaborate and discuss different issues(USING SPEECH IN REAL TIME) with each other by using their personalized avatar(other teachers present in meeting Virtually ) I want to implement these features + some other like text support , Multimedia Projector for presentation etc

I need help regarding platform selection preferably I want to Implement it as a webpage (3d website) with no installation or plugin support (plugin independent ) other wise I'll go for Plugin Solution I don't know WebGL and graphics programming I want to do it more by designing in 3d and integration with reusable components

I'm confused in choosing platform I've explored these names so far [ WebGL/Google O3d/web 3d's X3D ,VRML /X3doom/Sirikata Platform/yogurt3d/Unity3d/Jibe/OpenSim/Papervision3d/Flash/3dmlw/Java3d/Infinity3d/ Cube3/CloudMach] also please tell me if other are available and appropriate for me

sentences:
Weird GLM perspective problems with my 2D Game I am trying to create the graphics system of a 2D game using OpenGL 3.3.
To help me in this task I am using the GLM math libraries.
However I am having some trouble. When my objects (for now they are just squares) have  a different scale, they "slide" through each other. I am posting some examples below.
In this picture both objects are at the center and camera is centered at the center
In this other picture the code has only moved the camera, but for some reason the big square moved down faster than the smaller one

Here are the matrices I am using to transform my camera
  // Projection matrix : 120° Field of View, display range : 0.1 unit <-> 10000000 units
  glm::mat4 Projection = glm::perspective(3.141516f/1.5f, (float)_WindowWidth / (float)_WindowHeight, 0.1f, 10000.0f);

  //glm::mat4 Projection = glm::ortho(0.0f, 16.0f, 12.0f, 0.0f,  0.1f, 100000000.0f);
  // Camera matrix
  glm::mat4 View       = glm::lookAt(
    glm::vec3(CameraPos.x, CameraPos.y ,2.0f), // Camera Position
    glm::vec3(CameraPos.x, CameraPos.y ,1.0f), // Where the camera looks
    glm::vec3(0,1,0)  // This is another way to say camera is not rotated
  );

And here are my matrices for my model transform
  glm::mat4 ViewProj = View * Projection;

  // Object to world matrix
  glm::mat4 Model      = glm::translate(glm::mat4(), glm::vec3(ElementToDraw.Position.x, ElementToDraw.Position.y, 1.0f)) *
      glm::rotate(glm::mat4(), ElementToDraw.Rotation, glm::vec3(0.0f, 0.0f, 1.0f)) *
      glm::scale(glm::mat4(), glm::vec3(ElementToDraw.Scale.x, ElementToDraw.Scale.y, 1.0f));

  glm::mat4 MVP = Model * ViewProj;

I really don't know why this happens. Am I using some matrix wrong?
Another thing, this only happens on the axis of the different scale. If both objects have the same scale they don't "slide"
Thank you in advance :)
EDIT:
I tried using glm::ortho with the following parameters:
 glm::mat4 Projection = glm::ortho(0.0f, 4.0f, 3.0f, 0.0f,  0.1f, 1000.0f);

EDIT 2:
I am passing the MVP using shaders
But the sliding continued and the objects werent centered at the center of the window

sentences:
Pathfinding in Procedural cave generation I'm learning THIS tutorial about procedural cave generation using cellular automata with Unity.

I want to implement pathfinding on some enemies, so I need to make a quantization of the procedurally generated "non-wall" part of the map. Is there a best way to place nodes in this space?

I hope I was clear enough and I'm sorry if not.

sentences:
How can I make an object move in four directions relative to its rotation? I want to make a game object move in directions relative to the direction it is facing.
That is, if the user presses the "W" key the object goes "forward"; if they press "D" the object goes to its left. etc

So far I am having trouble, because I can't make it move in the correct direction when its rotated.
I just want some pseudo code to point me in the right direction, thank you.

sentences:
Implementing cheat safe loot algorithm at clientside I am developing a "city building" type of browser based flash/flex game. I was checking some of the implementation of existing one of the popular games in facebook using decompilers. I noticed they have implemented the loot algorithm the client side and sending the loot item to the server which I think is not cheat safe.

Knowing the fact that there are cheaters every where and it is easy to manipulate the messages and send the best loot always, is there any way we can counter this type of cheats?

I dont have a concrete solution designed for it yet but I am thinking to track the drops by maintaining the loot history.

So instead of mere updating the resources/inventory, I will implement a logic which will compare the loot with history to see if the player is receiving the rare drops excessively and flag the user or take a smart decision (which I don't have yet)

Or

Is it a good idea to implement the loot algorithm in the server side? Since this is "city building" kind of game, where it will not have extensive user actions like in typical RPG games which can trigger loot events.

sentences:
glOrthof not being applied I have had a problem with OpenGL where glOrthof is not being applied, leading to my frame having the default 1:1:1 ratio. Here is the code initializing it:

    public void reshape(GLAutoDrawable glAutoDrawable, int i, int i1, int i2, int i3) {
        GL2 gl=glAutoDrawable.getGL().getGL2();
        if(window.getWidth()!=screenWidth||window.getHeight()!=screenHeight)window.setSize(screenWidth,screenHeight);
        unitsTall=window.getHeight()/(window.getWidth()/unitsTall);
        gl.glMatrixMode(GL2.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glOrthof(0.0f, unitsWide, 0.0f, unitsTall, 0.0f, 1.0f);
        gl.glMatrixMode(GL2.GL_MODELVIEW);
    }

unitsWide is equal to 100. Here is the code for drawing the rectangle:

    public static void drawRect(float x,float y,float width,float height){
        GL2 gl=Render.getGL2();
        gl.glRotatef(-rotation,0,0,1);//Rotation needed to be reversed
        gl.glColor4f(red,green,blue,alpha);
        gl.glBegin(GL2.GL_QUADS);
        gl.glVertex2f(x,y);
        gl.glVertex2f(x+width,y);
        gl.glVertex2f(x+width,y+height);
        gl.glVertex2f(x,y+height);
        gl.glEnd();
        gl.glFlush();
        gl.glRotatef(rotation,0,0,1);
    }

The "Render" class is the class with all of the main methods for OpenGL. Here is the code that I used for drawing the rectangle:

Graphics.drawRect(0,0,0.5f,1);

Finally, here is a screenshot of what it looks like when this code executes:

I have looked around and have not found any other problems like this. Please tell me what I might be doing wrong.

sentences:
Comparing two tree structures I'm having a hard time trying to describe this in correct terms so I will just give as much detail as possible and hopefully someone knows what I'm trying to do =-)

I am trying to compare two node trees to determine how similar/different they are structure-wise. In my diagrams below, both examples have the same number of children, grandchildren, etc. In example 1, Root has a child with two children, but in example two, root does not.

I could probably figure out how to recursively loop through and count how many of each level there are and compare that, giving me an idea of how similar the trees are, but only doing it that way, it will look like they are identical, but in fact they aren't.

Anyone happen to know about this? Or even what the technical term for what this is?

Edit: Also, this is in C# and I am using Lists to store these objects and their children.

Example 1

Example 2

sentences: How to make a horizontal scrolling menu in Unity 3d 4.5 I want to make a horizontal scrolling menu that will hold the levels of a game but I have a little idea about how to make it so it would be very great if anyone help me with it.

sentences:
Don't message systems slow down game engines? I am wondering, aren´t messaging systems slowing the speed of engines down? I mean, lets say that I want to zoom in my camera, without messaging I would do something like:

_camera->zoomIn(0.005f);

But with messaging, I have to broadcast the message (to the bus for example)

Data data;
data.float = 0.005f;
MessageBus::sendMessage(CAMERA_ZOOM_IN,&data);

Then iterate through all systems (all systems that can possibly handle the message) and at the end, when it arrives to my camera system, I have a handling function that calls proper method based on the message type.

eventFunctions[CAMERA_ZOOM_IN](data);

That means it needs some additional time to "do stuff" and also harder implementation. (imagine for different data types I also need some static casts etc.)

So, will it affect the actual speed of my engine?

sentences:
Ray Picking: how can I find which copy of model to pick, if they share the same vertices, but each one is translated before being drawn? I have a scene, in which I am drawing few different objects - each one has the same vertices and each one is translated to proper place before being drawn.

While using libgdx (but I think that this question should be generic enough to work with other libraries), I try to do ray picking, casting ray and trying to find intersections of given ray with triangles, from meshes of each object. My problem is, that because they all share the same set of vertices, how should I find which one exactly was pointed by user?

As I have no experience in this, I was thinking about translating the vertices for each object and getting rid of glTranslate(x, y, z) called before each one, but in that situation I won't be able to use one copy of mesh to work with all objects.

May I ask for a few hints / links to articles how this should be done?

sentences:
texture movement stutters Hey I at the moment I have got my texture to move however it stutters as I increment by 0.001 every second.  My animation is done via FPS if that make sense and here is some code

FrameCount++;

p_Time = c_Time;
c_Time = PVRShellGetTime();

elapsed = c_Time / 1000.0f;
DT = ((float)(c_Time - p_Time)) / 1000.0f;

fCount += DT;

if(fCount >= 1.0f) //if time is over 1 second reset counters and recount
{
    FPS = FrameCount;
    FrameCount = 0;
    fCount = 0;
    move += 0.001;
    glUniform1f(m_ShaderProgram.auiLoc[eTime], move);
}

My problem is I want it to move more seamlessly and not sure how to achieve this and thought I would get some ideas from you.

Oh and here is my vertex and fragment shader

Vert

    attribute highp   vec3  inVertex;
attribute mediump vec3  inNormal;
attribute mediump vec2  inTexCoord;
attribute mediump vec3  inTangent;

uniform highp   mat4  MVPMatrix;
uniform mediump vec3  EyePos;
uniform mediump float Time;

varying mediump vec3  EyeDir;
varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;
varying mediump float vTime;

void main()
{
    // Transform position
    gl_Position = MVPMatrix * vec4(inVertex,1.0);

    /*mediump vec2 waterCoord = inTexCoord;
    TexCoord = waterCoord.xy * waterSX;
    TexCoord += watermovementX;*/
    TexCoord = inTexCoord;
    vTime = Time;
}

and here is my frag

    uniform sampler2D  n_mapTex;
uniform sampler2D  n_mapTex2;

varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;
varying mediump float vTime;

void main()
{
    gl_FragColor =  texture2D(n_mapTex, vec2(TexCoord.x + vTime, TexCoord.y + vTime));
}

Thanks

sentences: Draw rectangles on Cube and remove I have 3d object as Wall ( Cube with texture and width and height large ) with some texture and attached c# ( Unity 5.3.2 ) script to that wall. I want to programmatically draw rectangles on that Wall with green semitransparent color and after 5 seconds remove them. I am new to Unity and found OnGui but it is not drawing in 3d space but in front of screen. How to achieve this to draw and remove rectangles on Wall ?

sentences:
Why are clicks not corresponding correctly to XY positions? I'm trying to make custom buttons in LibGDX (I really only wanted to use it for the Android/Desktop portability, not for any of its features, like Scene2D)

The issue I'm having is that the clickable area and the texture don't have a 100% overlap. I can click some places in the texture that don't respond to my isClicked method, and there are places outside the texture that do. I just don't understand what's happening.

Here's my button  class.

public class btn
{
private Texture btnTexture;

private int x;
private int y;

private int width;
private int height;

public btn(String btnTexturePathSet, int xSet , int ySet)
{
    btnTexture = new Texture(btnTexturePathSet);
    x = xSet;
    y = ySet;
    width = btnTexture.getWidth();
    height = btnTexture.getHeight();

}

public void render(SpriteBatch sb)
{
    sb.begin();
    sb.draw(btnTexture, x, y);
    sb.end();
}

public boolean isClicked()
{
    if (Gdx.input.justTouched())
    {
        if (Gdx.input.getY() >= y && Gdx.input.getY() <= y + height && Gdx.input.getX() >= x && Gdx.input.getX() <= x + width)
        {
            return true;
        }

    }
    return false;
}
}

sentences:
How to handle player slowness while moving up and down in a Top Down game with angled ortho camera and angled sprite due to stretching of ground? So i'm making a 2D top down game setup in 3D using tilted Sprites and angled orthographic camera.
My camera setup is as shown.
In my game I have the floor flat on the X/Z plane with walls/characters rotated +45 degrees about the X axis. The orthographic camera is pointing down also at 45 degrees about the x axis, parallel with my walls/characters.
As a result, I dont see any distortion for players/characters since they face the camera directly on, while the ground however sees a distortion of sqrt(2) shorter. This makes sense considering how an orthographic camera works. To fix this, I've made my Tilemap set up with X:1 Y:1 Z:Sqrt(2) so that each tile is stretched on the Z axis by Sqrt(2) to compensate for this distortion.
All looks well with only one problem now... foreshortening with regards to movement: Forward and backwards movements of objects/characters along the z axis are perceived to be slower than movements left/right on the x axis. This makes sense because while each tile is perceived to be a square in the camera view thanks to scaling Z on the tilemap by sqrt(2), the real world tile is, well, sqrt(2) times taller than its width, so obviously it takes longer to travel forwards / backwards.
How do i correct this?

sentences:
Determining relative velocities on impact? I'm trying to figure out a way to determine the relative velocity of a body colliding with another in a 2D environment.

For example if one body is moving at (1,0) and another traveling behind it collides with it from behind at (2,0) the velocity of the impact relative to the first body was (1,0).

I need a method which takes in two velocities, one velocity belonging to the body the velocity is being measured against, and the other for the impacting body and return the relative velocity.

sentences:
3D model rendered in halftone I am writing a 3D renderer that would render 3D models as if they had been drawn in halftone.
Feature-wise I need nothing fancy - no colors, just pure 3D geometry and basic lighting like here:
Image credit: https://blenderartists.org/forum/showthread.php?438820-Suzanne-Sketch

Notes:

I have written a basic 3D renderer in the past, however, I am really inexperienced when it comes to shaders (again, I do know basics) and I have absolutely no idea where to start with this.
The example image has been created in Blender, but I am writing my custom renderer.
This is not a duplicate of "How can I make a shader effect that looks like a lightly shaded pencil drawing?", as my input is a 3D model, whereas the OP in the linked question used an image.

sentences: Build-time GLSL syntax validation Is there a way to validate GLSL syntax build-time instead of run-time? My application takes a long time to start and I want to know at the earliest possible stage that my shaders are ok. I'm using Visual Studio/Xcode. The solution probably involves running a tool as a part of build process, but I'm looking for such a tool.

sentences:
How to adjust scaling with rotation? I'm rendering a texture to a square.

I have to scale the texture because it is 10 times wider than it is tall.

In my fragment shader I divide both the X and Y texture coordinates (I'm using OpenGL), but I divide the x texture coordinates by 10 times more than the y coordinates and I get this nice looking image:

Then I do some rotation of the texture (the square stays put). I rotate my texture coordinates using a matrix that looks like this:

[cosr sinr]

[-sinr cosr]

where r is the angle of rotation in radians of the player. (OpenGL uses column-major matrices).

When I rotate, of course I have to do something about scaling differently now, but I'm not sure what. For now, I'm doing nothing to adjust my scale factor for the orientation of the texture. Thus, if I rotate a little it looks like this:

And if I rotate by a lot it looks like this: (that green is the green circles from before)

What can I do to accurately adjust scale for changes in orientation in a way that makes mathematical sense?

sentences:
When storing voxels in chunks, how do I access them at the world level? I'm not looking for how to store the voxels, data wise; I'm looking for the theory. Currently, my voxel engine has no global list of tiles. Each chunk has its own list, and its "hard to do things" like collision detection or anything that may use tiles that are outside of its own chunk. I want to start using height maps, but I have a problem. If each chunk has its own list, then it will be pretty difficult to implement the height maps.

Should I store a global list of voxels, independent of the chunks? Then, I can just easily perform collision detection and terrain generation. However, it would probably be harder to do things such as frustum culling.

So how should I store voxels?

sentences:
Unity update sizeDelta in OnValidate based on Layout Group computed values I'm trying to update the sizeDelta of a RectTransform in OnValidate.  I'm trying to grab the computed values from a Layout Group.
Here's what I've got:
#if UNITY_EDITOR
        void OnValidate()
        {
            UnityEditor.EditorApplication.delayCall += Resize;
        }

        private void Resize()
        {
            if (this == null) return;
            RectTransform parentRect = (RectTransform)gameObject.transform;
            RectTransform textRect = (RectTransform)tabText.transform;
            textRect.sizeDelta = new Vector2(parentRect.rect.height, parentRect.rect.width);
            layoutElement.preferredHeight = parentRect.rect.height;
        }
#endif

At first this seemed to be working, but it only works the first time OnValidate runs.  Subsequence invocations of Resize() sets the sizeDelta to Vector2(0, 0).
I'm wondering what causes this and if there's a way to avoid it.  If I remove the delayCall, the values are correct, but I get warnings:

SendMessage cannot be called during Awake, CheckConsistency, or
OnValidate

I'd like to do this at edit time since there's no need to compute this stuff at runtime.

sentences:
Why am I getting these artifacts when rendering polygons with OpenGL and SDL from far distance? I'm working in a toy BSP (quake3 version) renderer. I started creating the context and handling the input with GLFW but then I switched over SDL. The performance change was amazing with SDL leading with 100+ fps.

But when rendering some surfaces from far now I'm getting some strange and ugly artifacts in the borders or junctions. The only thing that I changed from GLFW to SDL was the initialization (code bellow) and the input handling but the OpenGL Draw calls are the same.

Why am I getting these artifacts when rendering polygons with OpenGL and SDL from far distance?

This only happens with some surfaces (mostly the ones without textures, only vertex colors) but there are some tiny surfaces (pendants or flags) that also have the same problem. Also, not all the borders of the same faces have the problem.

if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) < 0) {
    cout << "Failed to init SDL Video" << endl;
};

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS,   SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);

_window = SDL_CreateWindow("BSP Test", 0, 0, width, height,
                            SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL);

if (_window == nullptr) {
    SDL_Quit();
    return false;
}

SDL_GLContext ctx = SDL_GL_CreateContext(_window);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glGetIntegerv(GL_MAX_PATCH_VERTICES, &ee);
cout << "Max patch vertices : " << ee << endl;

glPatchParameteri(GL_PATCH_VERTICES, 9);

cout << "GL ERROR LOAD  :" << glGetError() << endl;

glClearColor(0.0f, 0.0f, 0.01f, 1.0f);

glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE);
glEnable(GL_POLYGON_SMOOTH);
glEnable(GL_LINE_SMOOTH);

SDL_GL_SetSwapInterval(0);

matrices.proj = glm::perspective(glm::radians(100.0f), (float) width / (float) height, 1.0f, 4000.0f);

camera.position = glm::vec3{-41.415211f, 320.293121f, -537.225281f};

return true;

sentences:
Way to render objects Is it best to have a renderer class in which you have a seperate function for each object you wish to draw? Or is it best to give each object a render function?

class Renderer {
    ...
}

Renderer::renderPlayer(Player *player)  {
    ...
}

vs

class Player  {
    ...
}

Player::render()  {
    ...
}

sentences:
Calculating the output of two armies fighting I am programming a strategic game using Flash. The game works very similar to the famous game "Travian".

My problem is as follows: I am trying to make the calculation of the troops lost as a result of a fight between two armies. The two armies have different types of units. Some of them are stronger against some other units and weaker against other types.

How can I put that effect of this differences in the equation of the fight?

It seems to be easy if they only have att and def points only, but when it comse to the units type dependency, I am lost.

sentences: Break a learning barrier with Java + LWJGL I have been coding with Java and LWJGL for some time. I mainly use thebennybox's tutorials, but I can't always remember the 3D rendering. But even when I have a 3D rendering models, planes, cubes, etc. I can't get past that. I need a good LWJGL tutorial! I look up to Notch and I know a good bit about Minecraft's history, and wish I could code as fluently as him. I also understand a good bit of Java.

sentences:
How can I handle sharing storage units in multiplayer? I have recently come across a certain problem in programming my MMORPG: the synchronization of shared storage units.

With shared storage unit I intend something like a "chest" that can be accessed by multiple users. Any user can take items from it or put items in it or even move items around and merge items stacks in the chest. To get the idea, think about the guild chest in WoW.

At the moment my approach with non-shared storage is to apply any transaction on the client (move/split/merge they take place instantly on the client) and then communicate to the server the change which also does validation and stuff. This works just fine: it's rather impossible that one client issues a transaction that would conflict with another of its transactions as he always sees an updated state of the storage (because he/she is the only one issuing transactions on that storage).

How do you keep a storage synchronized among its co-owners when they share a storage unit and therefore can issue conflicting transactions? For example: two players issue at the same time a move transaction of the same item.

An approach I was thinking about is scratching client-side prediction for shared storage but that adds some overhead to my work as clients at the moment are not aware (code-wise) that a storage unit is shared. Is there a smarter way to do it?

sentences:
Basic pseudocode to create a rope physics I am trying to simulate the physics of a 2D hanging rope, consistent of a series of n-links. It could be a series of four pendulums. I just want some movement of the rope and the ability to contact with the ground. I was inspired by this question and this one.

I would like to programme it from zero in Python or a similar modelling program, but I don't find simple maths to recreate this effects. Which are the basic equations to escalate a series of n-links to resemble like a rope, please?

sentences:
How to free the GPU from a long task? I'm developing an application that uses the GPU. Some tasks might be rather long (like a fragment shader with a loop). I have the impression that I can make the entire OS visually freeze by asking the GPU to perform a job that doesn't end. Of course, I'm not doing this on purpose, but when that accidentally happens, I have to force power off my machine and this is very difficult to debug.

Some questions:

Is this behaviour normal? Or could this be a bug in the hardware or driver?
Is there a technique to recover from this without force stopping my machine?
Since the OS is still functioning (only not rendering), I could try to ssh into my machine and kill the process. Would that free the GPU from its job? Update: I tried to ssh into my machine and sudo kill -9 *pid*, but didn't work.

I would like to know if there is an OS independent answer for this. If there isn't, my setup is macOS, with OpenGL (running on Intel HD Graphics 3000).

sentences:
Unity - unable to play audio clips simultaneously from within a coroutine I am using Unity 2017.3.1f1. I have created a co-routine for a car engine controller which would play a car start sound once, and while it is fading, it would start a looping sound that would gradually increase its volume while the start sound is still playing. Here is what I have written:

     public virtual IEnumerator PlayEngineSounds()
     {
         float playtimeStarted = Time.unscaledTime, startSoundLength = startSound.clip.length;
         startSound.Play();
         if (loopSound == null)
         {
             yield return new WaitUntil(() => startSound.isPlaying);
         }
         else
         {
             while (startSound.isPlaying)
             {
                 var percent = (Time.unscaledTime - playtimeStarted) / startSoundLength;
                 loopSound.volume = percent*_loopSoundMaxVolume;
                 Debug.Log("Loopsound % = " + percent, this);
                 yield return null;
             }
             loopSound.volume = _loopSoundMaxVolume;
             yield return null;
         }
     }

Basically I am taking the percentage of the start sound and I use that for the level of the loop sound. The more completely the start sound is played, the louder the loop sound should get.

What I observe, is that my logged messages appear correctly in time, but the volume level of the loop sound is not affected. Then, when the start sound completes, the loop level gradually increases its volume. It behaves as if the volume updates are "delayed" and executed after the start sound is finished, instead of playing both simultaneously.

The startSound and loopSound are separate AudioSource components, that reside in different game objects within the hierarchy of my vehicle. I am invoking the PlayEngineSounds corouine from my Start method like this:

internal void Start()
{
    StartCoroutine(PlayEngineSounds());
    // other code ...
}

sentences:
In Unity how can I know which direction is the screen auto-rotated? From the Screen.orientation description I get

  If the value is set to ScreenOrientation.AutoRotation then the screen will select [...] automatically as the device orientation changes.

This seems to imply that if the screen does auto-rotate, then Screen.orientation has been set to ScreenOrientation.AutoRotation.

If that's so, how can I know in which direction it has been auto-rotated?

Disabling the auto-rotation doesn't count (obviously), and I need to distinguish between LandscapeLeft and LandscapeRight, so checking height and width doesn't work either.

This should be cross-platform, without including any kind of non-C# plugin.

(the answer, given this documentation, seems to be "you can't", but maybe I'm missing something)

sentences:
How does Vector3.Angle compute the resulting angle? I don't understand the concept of Vector3.Angle in Unity.

Can someone please explain in detail how it computes the angle? From which two points is the angle measured? It would also be really awesome if you could provide some diagrams for me understand it more, visually.

sentences:
Cocos2dx v3 Problem with moving Sprite on tilemap after it was scrolled up I have a problem I can't solve so far.
I have a scene with tile map on it. And there is a Sprite spawnpoint on map. This Sprite should do MoveTo() action to the point where TouchEnded().

It all works perfectly in the borders of the screen, but after I scroll my map up and do touch again my Sprite stuck in the max Y point of the screen. (Let's say there is max 480px of screen's Y, but 850px of tile map)

Please help!

sentences:
XNA Required information to represent 2D Sprite graphically I was thinking about dividing my game engine into 2 threads: render thread and update thread (I can't come up on how to divide update thread from physic thread at the moment).

That said, I have to duplicate all Sprite informations, what do I really need to represents a 2D Sprite graphically?

Here are my ideas (I'll mark with ? things that I'm not sure):

Vector2 Position
float Rotation ?
Vector2 Pivot ?
Rectangle TextureRectangle
Texture2D Texture
Vector2 ImageOrigin ? (is it tracked somewhere else?)

If you have any suggestion about using different types for datas, it's appreciated

Last part of the question: isn't this a lot of data to copy in a buffer?what should I really copy in the buffer?I'm following this tutorial:

http://www.sgtconker.com/2009/11/article-multi-threading-your-xna/3/

Thanks

UPDATE 1:

Newer values at the moment:

Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
byte Facing (can be left or right, I'll do it with an enum)

I re-read the tutorial, what I was doing wrong is not that I need to pass all those values, I need to pass only changed values as messages.

UPDATE 2:

Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
bool Flip
uint DrawOrder
Vector2 Scale
bool Visible ?

Mhhh, should Visibile be included?

sentences:
Directx11 create Texture2D using subresourceData I'm trying to create immutable texture in d3d11 so I want to use subresourceData, every tutorial on textures creates them with 2nd argument being null and after that updates subresource but I want to create it using the 2nd argument.
This code works:

hResult = m_device->CreateTexture2D(&textureDesc, NULL, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

int rowPitch = textureWidth * 4;
m_deviceContext->UpdateSubresource(m_cubeTexture, 0, NULL, &(decodedTexture[0]), rowPitch, rowPitch * textureHeight);

And this does not:

int rowPitch = textureWidth * 4;
D3D11_SUBRESOURCE_DATA tSData;
tSData.pSysMem = &(decodedTexture[0]);
tSData.SysMemPitch = rowPitch;
tSData.SysMemSlicePitch = rowPitch * textureHeight;

hResult = m_device->CreateTexture2D(&textureDesc, &tSData, &m_cubeTexture);
if (FAILED(hResult)) {
    return false;
}

DirectX11 debug layer outputs this:

D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[3].SysMemPitch cannot be 0 [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]
D3D11 ERROR: ID3D11Device::CreateTexture2D: pInitialData[5].pSysMem cannot be NULL. [ STATE_CREATION ERROR #100: CREATETEXTURE2D_INVALIDINITIALDATA]

Which I don't understand since it's not even an array and texture array size is set to 1

sentences:
How to share image in persistentDataPath to facebook feed? I'm trying to share an image taking from CaptureScreenshot() using FB.ShareLink(...) to Facebook.

My code is the following: (After calling FB.Init(), etc..)

 string tmpScreenshotPathname = "file:///" + currentScreenshotPathname;
 System.Uri contentUri = new System.UriBuilder(tmpScreenshotPathname).Uri;
 System.Uri imageUri = new System.UriBuilder(tmpScreenshotPathname).Uri;
 FB.ShareLink(contentUri, "Test", "Test desc", imageUri);

However,  when open the FB share, the page opens for a split second before returning me back to the game. I tried using a normal Uri such as http://........jpg and it works fine, but when I try to use a local Uri, it fails.

Is there any way to share the image to the feed without uploading it to the user's Facebook gallery using FB.API? Because there's the case where the user might decide not to share the image to the feed.. but it would have already been uploaded to his gallery from FB.API.

sentences:
Local avoidance together with any-angle types of A* Pathfinding Recently I have been implementing the Block A* any-angle path-finding algorithm in a project I have, for which I need extremely efficient results due to the large number of NPCs. However, I still do not know exactly how to handle the problem of local avoidance between the NPCs moving at the same time in the same scene.

So, my question is this: what is the best method to implement local avoidance with any-angle path-finding? Just testing for LOS and steering to the tangent of the predicted encounter is a good enough solution or should a specific AI implementation be included within the pathfinding routine?

I would highly appreciate references (academical or not) with state-of-the-art implementations of local avoidance for me to explore the most recent developments in that field.

Many thanks.

sentences:
How to ensure a condition in a behaviour tree when processing following nodes? Example tree (Source):

As far as I understood, a sequencer iterates over the children until one failed or all are successful. If one children returns "running", the sequencer will start to process from that child on the next tick.

Let's say "Do I have food?" takes longer than one tick because the AI has to walk to the fridge. When "Am I Hungry" was successful, it won't be processed anymore. Now while walking to the fridge, the hunger magically disappears. How do I prevent the tree from processing the other nodes even though I am not hungry anymore? Should every following node check the condition again? That doesn't seem to fit the idea of a behaviour tree.

How do I implement a condition that has to stay true while following nodes are processed?

sentences: What basic windows form games should I build as a newbie in game development? I am a complete newbie in game development. I want to know about some basic games that I can start building with simple algorithms and basic knowledge. I have already made few basic games like minesweeper, TicTacToe, basic card games, and a snake game. I just want to have an idea to start a new fun project.

sentences:
How to make it clear that a game is in Beta? I develop games on ROBLOX which is a site full of user-generated games that are typically free for other users to enjoy. Many users have studios in which they have a consistent set of playtesters, but I am the only developer in the case of my project. Nonetheless, I still have the need to test my game at times, so I recruit random people from the forums of the site (specifically the site's "Scripters forum"). While recruiting from the forums is a reliable and quick way to get players, it may be hard for them to get over the fact that the game is meant to be unfinished.

ROBLOX has a like and dislike system, and during testing I have already received three likes and one dislike. The dislike concerns me because I feel that someone probably evaluated my game on the notion of "This game should be working for me, but it's not." when those problems are the purpose of why I recruit people to go to the game in the first place. Many users even absurdly evaluated the game on its artistic value  which I believe to be an afterthought in the game development process versus functionality which should be at its core.

For the future, how do I make it clear that the current game should be evaluated for its functionality, and that in the beta phase, it may or may not work for all users?

Side note: I do some preliminary testing before I recruit testers to the game, so it works at the very least on my device, but their own experience varies based upon their quality of connection and device.

sentences:
Unity 2D detect if swipe goes through an object I am developing a game in unity with flying arrows that the user tries to deflect by swiping through them (changing their direction). I can get the arrows to move with the swipes, but they move no matter where the swipes occur. I want them to only move (be affected) iff the swipe goes through the arrow. Here's what I have so far:

public class swipe : MonoBehaviour
{

private Vector2 leftFingerPos = Vector2.zero;
private Vector2 leftFingerLastPos = Vector2.zero;
private Vector2 leftFingerMovedBy = Vector2.zero;

public float slideMagnitudeX = 0.0f;
public float slideMagnitudeY = 0.0f;

bool touched = false;

void Update()
{
    if (Input.touchCount == 1)
    {
        Touch touch = Input.GetTouch(0);

        if (touch.phase == TouchPhase.Began)
        {
            leftFingerPos = Vector2.zero;
            leftFingerLastPos = Vector2.zero;
            leftFingerMovedBy = Vector2.zero;

            slideMagnitudeX = 0;
            slideMagnitudeY = 0;

            // record start position
            leftFingerPos = touch.position;

        }

        else if (touch.phase == TouchPhase.Moved)
        {
            leftFingerMovedBy = touch.position - leftFingerPos; // or Touch.deltaPosition : Vector2
            // The position delta since last change.
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            // slide horz
            slideMagnitudeX = leftFingerMovedBy.x / Screen.width;

            // slide vert
            slideMagnitudeY = leftFingerMovedBy.y / Screen.height;

            if(touched)
            {
                //rigidbody2D.velocity = new Vector2(slideMagnitudeX, slideMagnitudeY)*20;
                rigidbody2D.AddForce(new Vector2(slideMagnitudeX, slideMagnitudeY)*5000);
                touched = false;
            }
        }

        else if (touch.phase == TouchPhase.Stationary)
        {
            leftFingerLastPos = leftFingerPos;
            leftFingerPos = touch.position;

            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }

        else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
        {
            slideMagnitudeX = 0.0f;
            slideMagnitudeY = 0.0f;
        }
    }

}

void OnMouseEnter()
{
    touched = true;
}
}

The only way I have been able to find so far is using "onMouseEnter" which only works for very slow swipes.

How do I detect whether a swipe goes through an object?

sentences: How to add melee weapons in UDK? I am very new to game design and programming in Unrealscript for UDK. I have created a weapon mesh and imported it alongside it's animation set and created a start and end socket on it. I was wondering if anyone could help me create a weapon class for it and allow it to be used in the game?

sentences: Animation transitions won't work I downloaded an animated spider that comes with its own animations. I put the idle and walk animations in the controller. The default idle works fine but it won't transition to walk. I have other characters in my scene that transition with no problem. The only difference is that the other characters animations are separate from the character and the spider's animations are attached to the spider. I have been looking for any tutorial on the attached animations but can't find anything. Any help would be appreciated.

sentences:
Do I have to use new keyword for unity single game object? I'm using Unity4.
Do I have to use new keyword for single game object? look at the following code.

1.
GameObject obj = new GameObject();
obj = Resources.Load("Prefabs/Ball", typeof(GameObject)) as GameObject;

2.
GameObject obj;
obj = Resources.Load("Prefabs/Ball", typeof(GameObject)) as GameObject;

is it the same?

sentences:
Calculate gears rotation for a realtime simulation I'm trying to do a game with real time simulations of gears. There is a big Gear with inside a smaller gear.
I managed to draw gears with different diameters but equal size teeth, but if i try to move the smaller one inside the bigger one the movement is odd.
See the animated gif:

The biggest gear is in center C1 and the small in the center C2. I calculate C2 position in this way:
C2.x = C1.x + C1_RADIUS-C2_RADIUS) * cos(t);
C2.y = C1.y - C1_RADIUS-C2_RADIUS) * sin(t);

for t that goes from 0 to TWO_PI in n steps.
I apply as rotation the angle t, but maybe it is wrong and i have to calculate another rotation for get a perfect joint.
EDIT:
I am using radians for rotations and I think this is OK.
My main problem is that I want to achieve a perfect joint between teeth like this example. My teeth are overlapping in some odd way.
EDIT
a working example can be found here: http://www.openprocessing.org/sketch/83665

sentences:
Unity - Where should downloaded level data be stored? I've been looking around and it appears suggestions are only to store data to UserPrefs, or PersistentDataPath.

I intend to have map files streamed to the client on demand, and saved for reuse. UserPrefs seems inappropriate for large blobs. PersistentDataPath is per computer user, thus duplicating data and space usage. I believe Program Files has access restrictions too.

What are the current best practices for storing runtime data that meet the following criteria?

Is shared across user accounts to avoid wasting disk space.
Doesn't require elevated permissions.
Doesn't annoy the user (such as data being placed in My Documents).
Can be modified at any time.

sentences:
Why my calculated value is far different from actual value? I using CharacterController and not using a Rigidbody so I writing a script for downward velocity which is velocity=-9.81*(time) and I declare my initial velocity as 12. Supposing from this calculation, the max height it can reach from the equation is roughly 6.7891 unit on y axis. By using the formulae
distance travel=initial velocity*(time)-0.5g*(time)^2,differentiate this w.r.t time, getting time=u/g=12/9.81=1.223, then max distance travel=12*(1.223)-0.5*(-9.81)*(1.223)^2=7.339 but from the coordinate below, can clearly seen the max distance travel before falling down is 13.2803unit--0.5499unit=13.8302unit? This is far exceed calculated value, wonder what went wrong?
Initial coordinate of y on ground=-0.5499

approximate final coordinate of y=13.2803

using UnityEngine;

public class NewPlayerMovement : MonoBehaviour
{
    public CharacterController Controller;
    //speed of the character
    public float Speed = 12f;
    // earth gravitational value
    public float Gravity = -9.81f;
    Vector3 velocity;
    //hit point of character
    float hp = 90;

    bool Grounded = true;

    public void OnControllerColliderHit(ControllerColliderHit hit)
    {
        Grounded = true;
        hp -= velocity.magnitude;
        velocity.y = 0;
        Debug.Log(hp);
    }

    public void OnControllerColliderExit(ControllerColliderHit hit)
    {
        Grounded = false;
    }

    public void Checkstatus()
    {
        if(Grounded==false)
        {
            velocity.y += 0.5f * Gravity * Time.deltaTime;
        }
    }

    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");
        Vector3 move = transform.right * x + transform.forward * z;

        Controller.Move(move * Speed * Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Space) && velocity.y == 0)
        {
            velocity.y = 12;
            Grounded = false;
        }

       //check if it grounded
        Checkstatus();
        Controller.Move(velocity * Time.deltaTime);
    }
}

sentences:
How to implement 3d maneuver gear physics in unity? I am trying to create a attack on titan styled game for a school project. I am not new to programming, but I am new to game development. I couldn't find any resources for this, hence I am posting it here.

How do I go about implementing 3d maneuver gear physics from attack on titan anime?

What is it?

In case you don't know, here's a brief link about 3d maneuver gear.

A brief commentary about 3dMG

It's basically a grappling hook based system (similar to what you would find in a spiderman game), but it has different components to it, which makes it quite complex to think about.

My Approach so far

I have seen tutorials on how to use hooks in unity and stuff, but it would be great if someone could give me a general idea as to how to even start with this kind of thing. I would appreciate your answer, even though it is not unity specific.

The idea is to have two points on the character, from where we fire the ropes. These ropes could simply be graphics (or unity's RaycastHit). And then we would also need information about the hook "hit point". Once we know that, we just reel in ourselves towards that. However the problem is that I don't know how to use momentum etc to effect the character's movement. Also since it's not just one rope(like a spiderman's game), but two, it's even difficult to think as to how would the movement be if user uses only left hook, or right hook or both. Also there is this gas aspect, which would propel you further and it should also be taken into account, along with momentum that we would carry.

So any general idea would be greatly appreciated.

sentences:
The best way to make collisions I'm making a 2d game, all is working, I have the characters and the map. The player have 6 different weapons and now I'm trying to make the collisions and the life / destruction system.

I have a character that follows the player. I made two triggers for this character and one for the player. When the player approaches, begins to haunt him, and when are near this character stop walking. To do this I programmed a "OntriggerEnter2d" and all is good, but now, I need to do anything similar with the bullets (or not). I tried OntriggerEnter2d and not works as expected, this detects the enter on the first zone of the bigger trigger, and I only need to detect the collision with the "body" of the characters.

Well, the question is, what is the best way to do the collisions between bullets and characters / objects??

Sorry if I explained bad the situation.

sentences:
Rendering 3D out of layers - optimizing fillrate? I'm rendering a city of several million cuboids that are all axis-aligned, touching each other and same-sized. They only differ in height.

Rendering them as real geometry is vertex-bound and too slow, so I've went with another approach: render them as several flat layers of a single, big texture. The more layers, the better the buildings look. This is similar to how a 3D printer works. Also I've seen it used for rendering hair, grass and snow. In my case, I'm using nearest-neighbor filtering to make the buildings square-shaped, and alpha-testing to control the building heights.

Here's a very zoomed-in screenshot so the individual layers are visible:

This works great, but when I use a higher number of layers, it gets too slow due to the fillrate. The cuboids are opaque so I tried optimizing this by enabling z-testing, but it hardly helped, because my shader is cheap (fixed-function, actually), and it's the only thing z-testing helps to skip. Or maybe it's because on my dev machine I have an Intel GPU and it doesn't do early-z discard.

So now I'm out of tricks. What could be used to optimize this? Also, any common names for the technique?

Notes:
- I'm aiming for OpenGL 1.4-level hardware, which is pretty restrictive when it comes to optimizing.
- I'm additionally using multitexturing with alpha-modulation to make arbitrarily-shaped, antialiased buildings (not enabled in the screenshot)
- Usually the city is viewed from a RTS-style viewpoint, all of it is visible, and it fills the screen, so fog or LOD techniques wouldn't work

sentences:
What's the equivalent of wglShareLists for Mac OS? I'm trying to share lists between two contexts on Mac OS but despite my research I couldn't come up with an answer so far. I've found that NSOpenGLContext was able to initialize a context with a shared context but not to set it afterward.

What's the equivalent of wglShareLists on Mac OS?

sentences:
Available AI middleware A useful list of AI middleware.  Please provide URL, free/open-source or licenced, and brief description of abilites.

Format:

*Package* (License)
Link

Pros

Cons

sentences:
Simulate parallel dimensions / subspaces in Unity without colliding coordinate systems I've built an online game with Unity with a very large open world.  The server (which can be a local player, or run as a standalone application without a local player) simulates everything around players - so for example if there is an object or NPC at coordinates (100,34,20) but there aren't any players nearby then the object is not simulated.  Objects are streamed dynamically from a database or generated procedurally depending on the object.

Problem

I want to enable players to go to other worlds.  Of course it is impractical if not impossible to have global coordinates shared across all of these different worlds due to floating point limitations. I'll have to share the limited coordinate system for each simulated world.

The issue is the server would still need to render and handle physics of multiple worlds but could now potentially have conflicts with objects and/or people on one world appearing in other worlds.  Essentially I need a way to divide up these "worlds" into parallel dimensions that are executed simultaneously on the same server (in one Unity scene).

Parallel Dimensions

A partial solution would be to have some sort of indicator, such as an integer (I'll call it "worldIndex") on each object to indicate which "world" that object exists in.  This would work for clients since the server would be able to tell the clients only about objects that are on their world.

There would still be a problem on the server itself.  Every world needs to be simulated in the same coordinate space.  For a local player I could use the "worldIndex" to hide objects that aren't in the local player's current "world".  But I still need to simulate physics for every world.

Unity's Layers could be used to mask physics interactions between objects.  However I would then need to have at least one layer per world - and I already use multiple layers for various different interactions.

My thoughts are I would need something like a layer I could specify on each GameObject or some way to group a bunch of GameObjects together and instruct the physics system to only allow interactions within the group.  But as far as I know no such mechanism exists within Unity.

Subspace Pockets

Another thought I've had is rather than using the Unity coordinate space directly, I could slice it up into "subspaces" or pockets.  Each player would be in their own subspace, unless a player physically enters the same space that is already being simulated by another player, in which case that player would join the same subspace.  But then I would have shift around the coordinate systems and it would increase complexity of merging players into and out of these subspaces.  I would also have to generate subspaces dynamically as players enter new areas that are not currently being simulated.

Even if each world is extremely large, it is not necessary to use the entire Unity coordinate system around each player - a few thousand kilometers is more than enough.

Overall I think something along these lines is probably the best solution.

Multiple Servers

I could run one server per "world" and have a hand off process to make it transparent to players.  But then I'd have to run multiple server instances and players would not be able to host their own server - at least not without a lot of additional overhead.

Question

So my question is: what is the best method for essentially running multiple, parallel simulations within a single Unity scene?

sentences:
Android Game Development problem with Speed = Distance / Time I have been coding speed for an object. I have made it so the object will move from one end of the screen to another at a speed depending on the screen size, at the monemt I have made it so it will take one second to pass the screen. So i have worked out the speed in code but when I go to assign the speed it tells me to force close and i do not understand why. Here is the code:

MainGame Code:

@Override
protected void onDraw(Canvas canvas) {
    setBlockSpeed(getWidth());
}

private int blockSpeed;
 private void setBlockSpeed(int screenWidth){
Log.d(TAG, "screenWidth " + screenWidth);
 blockSpeed = screenWidth / 100; // 100 is the FPS.. i want it to take 1 second to pass the screen
 Math.round(blockSpeed); // to make it a whole number
 block.speed = blockSpeed; // this is line 318!! if i put eg block.speed = 8; it still tells me to force close
 }

Block.java Code:

public int speed;

public void draw(Canvas canvas) {
    canvas.drawBitmap(bitmap, x - (bitmap.getWidth() / 2), y - (bitmap.getHeight() / 2), null);
    if(dontmove == 0){
        this.x -= speed; // if it was eg this.x -= 18; it would not have an error

    }
}

The exception

06-08 13:22:34.315: E/AndroidRuntime(2801): FATAL EXCEPTION: Thread-11
06-08 13:22:34.315: E/AndroidRuntime(2801): java.lang.NullPointerException
06-08 13:22:34.315: E/AndroidRuntime(2801):     at com.charltonsantana.game.MainGame.setBlockSpeed(MainGame.java:318)
06-08 13:22:34.315: E/AndroidRuntime(2801):     at com.charltonsantana.game.MainGame.onDraw(MainGame.java:351)
06-08 13:22:34.315: E/AndroidRuntime(2801):     at com.charltonsantana.game.MainThread.run(MainThread.java:64)

sentences:
Facebook login using Godot 3.1 in iOS In my game I have to integrate Facebook login. I searched about custom modules and all.

I found one but it not working in ios and its for older version.

Any help would be appreciated

sentences:
Unity LWRP alternatives for camera stacking I am working on upgrading a project in unity from a 2018 version to the latest 2019. One of the mechanics of the game is an AR (augmented reality) system. Some of the UI elements appear in the 3D world, but clearly as part of the hud. They need to be transformed as the camera moves, but should always be drawn on top of the 3d scene.

The old project achieved this via camera stacking. All the AR elements were drawn on a different camera which rendered on top of the 3D camera. The clear flags were set to "depth only" and it removed all other elements from that camera.

In the 2019 version of Unity with the Lightweight Render Pipeline (LWRP), the clear flags feature on the camera is missing. To the best of my research, camera stacking has been removed from LWRP.

What are my alternatives? How can I now achieve this effect? I would like to stick to LWRP as I am using Shader Graph for many of the effects in the game.

sentences:
Making a text only console game in C#. Can't figure out a way to organize states When I say states I mean like what you would call scenes in unity. As in each phase of the game. But in straight up code for a console application in C#.

Example:
Name select.
Race Select.
Store.
Help Screen.

I've tried organizing each phase by methods, and while loops, but i've run into a lot of trouble these ways. How should I do it?

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

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

sentences:
What is the process for getting a dev-kit for Xbox 360 to allow native coding I'm curious about the process of getting a Xbox 360 dev-kit.

What are the requirements? Do you have to have a track record in game development. Can indie gamers get one. How much does it cost? Is there special hardware?

sentences:
How to fix pink tiles when there is a problem with the Shader? Because of some dumb mistake I did fifth time, I had to repaint my level in my 2D game.
The problem is that the tiles I use from the Tile Palette turn into pink because of some shader error. I came to this conclusion after a long time of browsing through the forums.

I am 100% sure that this will happen again, because I don't know what causes this behavior. So, prevention is not an option for me.
What is the solution?

By @DMGregory's suggestion, I was able to recreate this dumb behavior of mine in an empty project.
What I do is dragging and dropping a tileset onto a tile palette which I am using, and then overwriting the current tile palette. Then, the former assets are lost (I guess?) leaving me with pink tiles.

Attached picture is one of my levels created using Tile Palette. How do I take this back? I don't want to repaint my level everytime I do whatever that causes this behavior.

sentences:
What in the BOTW game engine makes physics behave wildly when certain actions are triggered during bullet-time? What in the BOTW game engine makes physics behave wildly when certain actions are triggered during bullet-time?
https://www.youtube.com/watch?v=dXKsTrwZ6XY
Also, what can you do to prevent it? Is this problem unavoidable when you include bullet-time?

sentences:
Switch scenes and continue to receive bluetooth stream from Update I have a scene where I'm connected to a BLE device and receive data in bytes. I want to switch scenes from the current Update and continue to receive the data without disconnecting. How should I do this. Here is my current code in Update:

            case States.Subscribe:
                HM10_Status.text = "Subscribing to HM10";

                BluetoothLEHardwareInterface.SubscribeCharacteristicWithDeviceAddress (_hm10, ServiceUUID, Characteristic, null, (address, characteristicUUID, bytes) => {

                    float floatprint = EnterDataQueue(bytes);
                    Debug.Log("floatprint" + floatprint.ToString());
                    HM10_Status.text = "Received Serial: " + floatprint.ToString();
                    //HM10_Status.text = "Received Serial: " + Encoding.UTF8.GetString (bytes);
                });

And the method outside:

static float EnterDataQueue(byte[] bytes)
    {
        ArduinoHM10Test aTest = new ArduinoHM10Test();
        //always load the data byte array in full
        for (int i = 0; i < bytes.Length; i++)
        {
            aTest.myQueue.Enqueue(bytes[i]);
        }

        //Dequeue the queue and check if 4 bytes have been dequeued
        if (aTest.myQueue.Count >= 4)
        {

            byte[] byteArray = new byte[4];
            for (int i = 0; i < byteArray.Length; i++)
            {
                byteArray[i] = aTest.myQueue.Dequeue();
                if (i == 3)
                {
                    break;
                }
            }

            aTest.floatnum = BitConverter.ToSingle(byteArray, 0);
        }

        Debug.Log("floatnum: " + aTest.floatnum.ToString());
        return aTest.floatnum;
        //throw new NotImplementedException();
    }

sentences: Is it legally possible to make a clone of the game? With board games like "Monopoly", "Domino", "Checkers", or "Chess", can game developers make clones and sell them? Also, can I make a clone of ZX Spectrum games? Are there many parts of the game with which can do the same?

sentences:
How to render a pseudo-3D view like in the game Biosys (1999)? Biosys is a PC game released in 1999, where navigation through its environments is done by clicking an "exit" on a scene, taking the player to a new scene. The player can't move in a scene, and interaction is done by clicking a location in it. In some scenes the player can freely look around in 360 degrees by moving the mouse.

My question is, what technique could be used to render such a scene? I'm asking because that doesn't look like it's true 3D; it looks drawn as if a picture is wrapped around the player, but how would you produce and render a picture in such a way?

Here is a rare YouTube video of that game, beginning at 3:40 where the technique I'm curious about is shown.

And here's a picture of one of those environments:

sentences:
Game-oriented programming language features/objectives/paradigm? What are the features and language objectives (general problems to solves) or paradigms that a fictive programming language targetted at games (any kind of game) would require?

For example, obviously we would have at least Performance (in speed and memory) (because a lot of games simply require that), but it have a price in the languages we currently use.
Expressivity might be a common feature that is required for all languages.

I guess some concepts from not-usually-used-for-games paradigms, like actor-based languages, or language-based message passing, might be useful too. So I ask you what would be ideal for games.

(maybe one day someone will take those answers and build a language over it? :D )

Please set 1 feature/objective/paradigm per answer.

Note: maybe that question don't make sense to you. In this case please explain why in an answer. It's a good thing to have answers to this question that might pop in your head sometimes.

sentences:
No files in .net.minecraft So, I've been trying to make a minecraft 1.11.2 client for minecraft. Thing is, the mcp/src/minecraft folder is empty, without any net files. The only error I had while decompiling was missing lwjgl 2.9.4, which does not exist. I have everything ready, but those files are missing, and thus I cannot code anything on my client(I am only using allowed mods.) This is a massive project I am taking for my favorite server, and I would like some help. Can anyone be kind and tell me how to fix this?

I have installed Optifine files for my client, and seems to have got about half of the files that I need.

What I need:

What I have:

As you can see, I am missing a lot of packages and have errors in most of them.

sentences: button thumbnail slider effect unity3D I am trying to make this effect for buttons. i.e the middle one is bigger and is selected. the buttons can be moved left or right by swapping with finger. Does anyone have any idea how to do it?

sentences:
How can I highlight words in a word search puzzle? For days I am struggling to implement the highlighting functionality in game as there is not much tutorial also for this. I did how ever make the cell of the grid change the material color but it looks ugly that's why I prefer to choose this method (see pic).

How can I implement a highlighting method that will work the same on link.

My try:

 private bool first_sel = false;
    private void Update() {
        if (Input.GetMouseButton(0)) {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out pressed)) {
                if (pressed.transform.tag == "cell") {
                    if (!first_sel) {
                        GameObject sel = Instantiate(sel_cell, new Vector3(pressed.transform.position.x,
                            pressed.transform.position.y, pressed.transform.position.z - 0.55f), Quaternion.identity);
                    }

                }
            }
        }

sentences: Unity editor, horizontal line in inspector How to draw a horizontal line in the inspector like on the reference image? Kind of separation line.

sentences:
Get world-position in Vertex shader I'm wondering how I can get the final position of a vertex. I use glTranslate in my render code, and I'm not getting the world-coordinates correct. My world is devided in chunks and my position get's screwed up.

I have tried multiplying the position with the 3 built-in matrices, but no success.

sentences:
Mesh made in Blender is correct in Unity3D as a rendered mesh, but "empty" as a collider? I created a simple stair "block" in Blender, and it's rendered correctly, but when I tick "Generate Colliders" and try to use it in a Mesh Collider, there is nothing.

(Ps.: I need the real mesh as a collider, not just that generated convex one)

Maybe a good clue is that my other objects' generated colliders are smaller than the rendered meshes themselves. Maybe this one is scaled to zero?

After triangulating:

And via Unity's automatic triangulation: (the original, non triangulated blender model)

sentences:
May I put a ClickListener to the Stage or better if every Actor/Group has its own? On the web it's almost always better to have a single click event listener at the top of a hierarchy. For example in a tabular data representation the <table> element would listen for all its child elements instead of each <tr> or <td> having their own listeners, since the event knows its originating element anyway.

Instinctively I'd do the same in LibGDX Scene2D and put my ClickListener to the Stage instead of the Actors or Groups.

So far I haven't seen anything which suggests I'm doing it wrong, but as I'm new to LibGDX I thought I'd ask.

Clarification

I'm a bit worried about possible memory management issues, similarly to when certain Disposables aren't properly disposed, or when I forget to use pooling on objects which are constantly reused.

sentences:
"Time Control" in a 2d Platformer I am making a 2d platformer where the player can press a button, and restart the level, only their previous character will also run the level at the same time, like they are traveling back in time.

I know other games have done this before, and the way I have thought of doing it is to make the game character have a set of actions (Idle, Jumping, Walking Left etc.) and then detect changes in those actions and log them into a list along with the game time. So then when I need the character to run the level again on its own, I can just go through the list changing its actions at the right time.

Is this the best way to do it? Does anyone have any experience in this?

Thanks.

sentences:
How do engine sounds for vehicles work? How does the engine sound for a car (or whatever has an engine) work?

When you increase the throttle the engine sound changes but it's never quite the same. When programming such a system what is the high level view of how it works. I know that there is some looping involved in the sound files but how do you transition when for example you change gear or you increase/decrease the throttle? How would one go about getting and preparing the sound files?

sentences:
Box2D: Adjusting character position for side-scrolling In my side-scroller I would like to give the illusion of the character walking forward while his sprite is actually being held in place. If he walks near the edge of the screen, I would like to adjust his position at each step so that he is remaining still while the background moves backwards at the same rate he would have been moving. I think you get what I mean.

I figured that a simple case of "position = position - velocity" would do the trick, but then I realized it is not quite that easy with box2d. Velocity is expressed not at distance per frame, but distance per second. So instead I am essentially using position = position - velocity/60 since my game refreshes (or attempts to refresh at) 60 frames per second. But I can still see some lilting in the character's movement, and if I monitor his position, it shows that it indeed changes, most likely due to variations in frame rate.

Is velocity/60 the best I can hope for, save for hard coding the stop positions?

I am using the newest release of Box2Dweb. Yes, the javascript one. Here's a sample of the code:

var posX = this.body.GetPosition().x;
var posY = this.body.GetPosition().y;
var velX = this.body.GetLinearVelocity().x;

if(posX > 21 || posX < 12){
    screen.pos -= velX;
    this.body.SetPosition(new b2Vec2(posX - (velX/60),posY));
    }

I realize I can hardcode the positions like this:

    if(posX > 21) {
        screen.pos -= velX;
        this.body.SetPosition(new b2Vec2(21,posY));
    } else if(pos < 12){
        screen.pos -= velX;
        this.body.SetPosition(new b2Vec2(12,posY));
    }

But I'm not super excited about how decidedly undynamic that option is.

sentences:
What is the use case for slerp in 2D? When searching for slerp, I get this text:

  Slerp is shorthand for spherical linear interpolation, introduced by Ken Shoemake in the context of quaternion interpolation for the purpose of animating 3D rotation.

As far as I understand it, slerp is important for rotations in 3D, since the rotation is composed of multiple angles and it's important to consider the whole structure rather than each number individually.

However, I've also heard of people choosing between lerp and slerp for a single angle for rotation in 2D (where lerp is done with a lerp_angle method takes into account rotations in both directions). I don't understand what slerp would mean in 2D or how it would be different. Is there some case in which lerp doesn't work right in 2D? Is the behavior different, how?

sentences:
Voronoi graph - traversing from vertex to vertex I'm working on a Unity Project in C#

I've built a 3D Voronoi Diagram using the csDelaunay library from PouletFrit
and using the X and Y values from a 2D diagram to instead setup some Vector3's with something like (x,0,y)

Example:

My current task is to build a river, as a List of Vector3's

I've so far been able to figure out most of the library code, and  build/retrieve lists of:

The north-most Vertices, South-most, East and West
All Edges, and for each their left vertex (green) and right end vertex (red)
All Sites / Seeds

To start the river I've picked one vertex at random from the North-most list and then pick a suitable opposing vertex on the south list.

I've been at this for many hours now, getting nowhere really, but I think my main problem is I can't focus. So I'm going to avoid splines, meshes, etc. for now and keep this simple, I just want to get a list of points the river will go through.

as advised by 'Arcane Engineer' on a previous question (too broad), I'll just use the Voronoi cell boundaries for this, but I need to find the shortest or best path between my north river point and my south point.

I've been assuming that either Dijkstra's Algorithm or A* are the best way to do this but I'm really struggling now, and A* seems to be more built for open space and determining the route around obstacles, rather than shortest path through fixed nodes ?

as Dijkstra's would need a graph data structure (among other things), would I be correct in saying that The Voronoi class in the library I'm using is already a type of graph data structure ? or would I need to augment it a bit to perform Dijksta's algorithm

My background is mainly in Java, and I hope I have a decent understanding of all the OOP principles I need here, and I have some data structure knowledge, at least at a high level. but if possible i'd like to use pre-written stuff. I found a Priority Queue class from Microsoft that may help me in implementing Dijkstra's ?

I tried working on a "simpler" recursive algorithm that checks from the first point (north-most), what edges are connected, and then what direction vector they are going in and compares the angles for each edge vs the target direction, and the smallest angle wins. I haven't got it working yet.
But I also get the feeling this is NOT the best way to do this.

Any advice you could give is much appreciated!

sentences:
How do I calculate a new position from current and target position for intuitive non-instant dragging? I have a simple 2D game where I can move an object using the mouse. I've been improving on the 'feel' of the movement gradually, however it still doesn't behave as you'd expect if the object were to be moved by human hands in a real-world scenario. My improvements were as follows:

New position = mouse position
Sharp unrealistic movement. No max speed.

Cap the maximum speed
Nicer. Still stops abruptly. Doesn't accelerate smoothly

Add 'inertia', recording last change in position and applying it to subsequent moves

Vastly improved, however...

Object is dragged as if on elastic, slow to accelerate, very slow to stop.
Once moving, object oscillates or orbits around a stationary mouse position.

I'm looking for suggestions on how to make the movement more intuitive:

Moving an object from A to B a human would rarely overshoot

A user shouldn't need to correct against inertia to stop an object

I'd like to be able to adjust the weight of the object so that heavier things are harder to get moving

My current code is as follows:

float maxInertiaChange = 0.1;
Vector2 lastPosition = Vector2.negativeInfinity;
Vector2 inertia = Vector2.zero;

private Vector2 InterpretPosition(Vector2 mousePosition) {
    Vector2 newPosition;
    if (lastPosition.x != float.NegativeInfinity) {
        newPosition = lastPosition + (inertia * Time.deltaTime);
        newPosition = GetPointTowardsTargetWithMaxDistance(newPosition, mousePosition, maxInertiaChange);
        inertia = (newPosition - lastPosition) / Time.deltaTime;
    } else {
        newPosition = mousePosition;
    }
    lastPosition = newPosition;
    return newPosition;
}

private static Vector2 GetPointTowardsTargetWithMaxDistance(Vector2 startVector, Vector2 targetVector, float maxDistance) {
    float lerpScale = maxDistance / Vector2.Distance(startVector, targetVector);
    return Vector2.Lerp(startVector, targetVector, lerpScale);
}

Thanks in advance!

sentences:
Textures loading too large on smaller monitors I have an XNA game, and when i run the game the textures load all good on my computer and on my tv and they're all bring drawn in the right position. But on my laptop, which screen is smaller then both my othe computers monitor and my tv screen, all the textures are being drawn way to large. Example: i have a background which is just grass, and a stone path, and the image size is 1920x1080. It loads fine and is centered on my other computer and TV, but on my laptop, its drawn way too big and where the center should be is in about the bottom right corner of the laptop screen. Is it possible to edit the code to make it resize better on smaller screens, or is it just my laptop and my laptop's screen size is messed up. I believe that my laptop is in the 16:9 aspect ratio.

Update 1

I have noticed that the textures load fine when the window is not in full screen, but in full screen the textures have problems. How should i change this Draw Method to fix this problem, and draw this in the right spot in a full screen 1920x1080 window?

spriteBatch.Draw(backgroundTexture, Vector.Zero, Color.White);

(keep in mind the backgroundTexture is 1920x1080)

sentences: Using Unity's uNet to create a turn-based RPG I've been checking some tutorials about uNet and it seems pretty powerful. The NetworkManager is a great tool when you want to make generic games, but what is troubling me about it is the need of spawning a "Player". I intend to create a turn-based RPG, and for that, during the battle there's not a "physical player entity", there's two players which have a set of monsters and the players can select a monster to attack the opponents', but the player itself doesn't exist, in the end it sums up to a trade of commands between the clients. How can I achieve such an architecture with uNet? Should I discard the use of the default NetworkManager? Should I simply create a bodyless Player and go along with it?

sentences:
Unity - strange performance impact with moving objects I'm trying to find the solution for 46 hours now and I'd be really happy if someone knows it!

I'm using a DOTween library for moving the objects. I also use LeanTween, cause I heard it's faster but none of these work for me in this case. I've used tweening libraries alot, but never faced an issue like this.

The bug appeared in my project, so to check it I created a blank one. An empty scene, with a camera and one cube with scale[10,2,10].

Now, I've added a simple script:

    Sequence sequence = DOTween.Sequence();

    sequence.Insert(0f, transform.DOMove(transform.position + new Vector3(10f,0f,0f),1f)).SetEase(Ease.Linear);
    sequence.Insert(1f, transform.DOMove(homePosition,1f)).SetEase(Ease.Linear);
    sequence.SetDelay(1f);
    sequence.SetLoops(-1);

The script moves the cube continously by 10 units to the right, and back (both in 1 second).

There's a noticable jitter.

This jitter is strange, cause it does not happen contantly. It choses a time and just freezes the cube in place for a really tiny amount of time which is noticable - when you see a smoothly moving object and it freezes for a moment.

As you can see, there's a linear interpolation, but I've tried with many (it's even better visible with other interplation types).

Now. The profiler is not the case, cause I've tested it on the empty project with one object on the scene.

Things I've already tried:

Turning off occlusion culling
Turning off everything I could
All the combinations of quality settings
LeanTween instead of DoTween

The one thing I came up with is the profiler's WaitForTargetFramerate.
By definition, when WFTF is huge it means that the app is doing well, cause it finished it's work and waits for the next frame. In my opinion in this case it's the reason of the bug.

I have a screenshot of the profiler window (with one cube, one directional light and this script attached to a cube):

Now, I'm not 100% sure, but I think that this jitter may happen on these V-Sync drops on the screen.

Everything is tested on the PC. On Android there's the same thing (a noticable jitter), but I didn't run the profiler.

If someone has any idea what may be the cause of this - I'd be grateful. I'll put a bounty here as soon as I can, cause I'm really tired! :)

@ DMGregory

This is before the 'jump' on the GPU chart:

and that's on the 'jump':

There's no RigidBody or Collider, but on my main project there are box colliders on these floors. I've also tried adding RB with the Interpolation checked. No difference.

@ Josh Hamilton

Even if this is a normal behavior, that the frame completed faster - there are games on Google Play and AppleStore without any glitches like this. In my main project (where I discovered the issue) the biggest problem is that this lag is happening when I move the camera to follow the player smoothly and the freeze it noticable like anywhere else. Like the entire enviroment was freezing for 1-3 frames.

sentences:
Pre-render 3D object from multiple angles, save as PNG I'm looking for a tool or script that takes a 3D object (any format) and makes multiple renders of it automatically (using a raytracer or other high-quality offline renderer). It would then save the output as a series of PNG files.

Example: let me render a car from angles 0,90,180,270 and save the images to car0.png, car1.png, car2.png and car3.png with a single command.

Is there such a tool?

sentences:
Why translation uses multiplication and not addition? To translate an object from (x, y, z) to (a + x, b + y, c + z) it's done using:

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

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

sentences: Conditionally use java or android classes I'm using bezier curves in my libgdx project. I was testing the desktop version using java.awt.geom with GeneralPath but when I went to test on android, it raised an error saying that I can't import java.awt. Android have corresponding classes for GeneralPath, Point2D etc so my question is how can I use those classes in their respectives environments?

sentences:
How can I quantify a drawn line's straightness? I'm working on a game which requires players to draw a line from a point A(x1,y1) to the other point B(x2,y2) on the screen of an Android device.

I want to find how well that drawing fits to a straight line. For instance, a result of 90% would mean the drawing almost perfectly fits the line. If players draw a curved line from A to B, it should get a low score.

The end points are not known in advance. How can I do this?

sentences:
Initializing a blank texture in OpenGL without artifacts I'm generating a texture atlas in OpenGL, where I want to create a blank texture and copy my sprites to it.

The texture is generated like this:

glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);

glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
  GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
  GL_CLAMP_TO_EDGE);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
  GL_UNSIGNED_BYTE, NULL);

While the sprites are copied like this:

GLenum format;
if (sprite.hasAlpha)
{
    format = GL_RGBA;
}
else
{
    format = GL_RGB;
}

glTexSubImage2D(
    GL_TEXTURE_2D, 0,
    sprite.x, sprite.y,
    sprite.width, sprite.height,
    format, GL_UNSIGNED_BYTE,
    sprite.data);

The issue is I keep getting artifacts in the texture not covered by a sprite:

Here I'm supposed to only have two slugs, one sword in the stone, one light grey tile, and one dark grey tile.

I tried creating a width * height * sizeof(GLuint) GLuint array filled with zeros and passing it to the glTexImage2D call, but that didn't seem to do anything.

sentences:
storing user data for rpg I'm creating a single player Web rpg that will store a decent amount of information about the player, items,  map,  npcs,  etc.

I have been developing html5, javascript, php, and the mysql database approach and saving/retrieving with json.

Someone mentioned for my purposes,  using 'localStorage' persistent user storage would remove much complexity and help with performance.

Is localStorage the better way to go here?  If I wanted to find out information about my players, or ensure that esch player profile is saved... can I rely on localStorage?

What are the pros and cons of each?

sentences:
How would I move something around inside of a sphere without it going outside of the sphere? I want to be able to do this, but not go outside of the 4.4 meter limit, the radius is 4.4 meters, and it has zero gravity and no friction. I have a hard time explaining this, but imagine holding a hollow sphere with a little ball inside, when you shake it around the ball goes around the inside, I need something like that, but with zero gravity and no friction. I wasn't really sure how to do this, but I tried:

void Slide() {
if (slide) {
    for (uint32_t deviceIndex = 0; deviceIndex < vr::k_unMaxTrackedDeviceCount; deviceIndex++) {
        glm::vec3 position = devicePos[deviceIndex].xyz();
        if (sqrt(pow(position.x - 0.35, 2) + pow(position.y + 1.75, 2) + pow(position.z + 0.85, 2)) >= 4.4) {
            if (abs(position.x) > abs(position.y) && abs(position.x) > abs(position.z)) {
                if (position.x > 0) {
                    velocity.x = ((abs(velocity.y)) + (abs(velocity.z))) / 2;
                }
                else {
                    velocity.x = ((abs(velocity.y) * -1) + (abs(velocity.z) * -1)) / 2;
                }

            }
            if (abs(position.y) > abs(position.x) && abs(position.y) > abs(position.z)) {
                if (position.y > 0) {
                    velocity.y = ((abs(velocity.x)) + (abs(velocity.z))) / 2;
                }
                else {
                    velocity.y = ((abs(velocity.x) * -1) + (abs(velocity.z) * -1)) / 2;
                }

            }
            if (abs(position.z) > abs(position.x) && abs(position.z) > abs(position.y)) {
                if (position.z > 0) {
                    velocity.z = ((abs(velocity.x)) + (abs(velocity.y))) / 2;
                }
                else {
                    velocity.z = ((abs(velocity.x) * -1) + (abs(velocity.y) * -1)) / 2;
                }
            }
        }
    }
}

}

sentences:
iOS game center game is out of sync I've been building a game center game for iOS and it works great so far. I finally started testing the game and theres (obviously) some latency, which is causing the game to be out of sync.

Basically I have 2 players, each controlling a game character. The game character can shoot fireballs and iceballs etc. These attacks do damage, and they have effects. For example. the ice ball effect will freeze the opponent for 3 seconds if it makes contact. the fireball will do extended fire damage for 3 seconds.

so the problem is, when I was playing against my brother, because of the latency, my game said I had 40 health left and he was down to 0, while on his device, the game said I had 0 and he had 20.

This means that attacks were registering/colliding on one device (based on the positions of the characters/fireballs) and not on the other. and vice versa.

I'm currently using the default peer-to-peer game-center architecture. Would using a client-server architecture (one person becomes the server) solve this out-of-sync problem?

if not, what other options do I have with the game kit API?

sentences:
Structure gameobjects and call events I'm working on a 2D tile based game in which the player interacts with other game objects (chests, AI, Doors, Houses etc...). The entire map will be stored in a file which I can read. When loading the tilemap, it will find any tile with the ID that represents a gameobject and store it in a hashmap (right data structure I think?).

    private static HashMap<Integer, Class<GameObject>> gameObjects = new HashMap<Integer, Class<GameObject>>();

How exactly would I go about calling, and checking for events? I figure that I would just call the update, render and input methods of each gameobject using the hashmap.

Should I got towards a Minecraft/Bukkit approach (sorry only example I can think of), where the user registers an event, and it gets called whenever that event happens.

Or should I just loop through the entire hashmap looking for an event that fits?

I'm using Java and LWJGL.

Thanks waco

sentences:
Camera chasing player I want the camera to follow the player and lag a little bit and then catch up with the player when the player halts. When stopped the player is in the center.

At the moment im at the point where i get the camera to move with the player but i dont know how to get the lag effect!

On the camera object

    void Update () {
    var newX =  player.transform.position.x;
    var newZ =  player.transform.position.z;
    var y = transform.position.y;
    transform.position = new Vector3(newX, y, newZ);
}

sentences:
System.Runtime.Serialization.SerializationException while trying to deserialize List I'm trying to serialize / deserialize a class that holds inventory items.

The code is attached below.

First I call AddOne() void a few times, then I call SaveFile(), then I call LoadFile().

In LoadFile() the following error occurs :

  ex = "System.Runtime.Serialization.SerializationException: End of Stream encountered before parsing was completed.\r\n  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run () [0x00288] in <1f0c1ef1ad524c38bbc5536809c46b48>:0 \r\n  at System.Runt...

Does anybody see my mistake?

Thank you for the help!

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;

public enum Type
{
    undefined = 0,
    Pistol = 1,
    Magnum = 2,
    Grenade = 3,
    BlendGrenade = 4,
    FireGrenade = 5,
    PistolAmmo = 6,
    MagnumAmmo = 7,
    Rifle,
    RifleAmmo,
}

[System.Serializable]
public class Inventory : MonoBehaviour
{
    public class InventoryItem
    {
        public int Amount = 0;
        public int Row = 0;
        public int Col = 0;
        public int Rotation = 0;
        public Type ItemType = Type.undefined;
    }
    public List<InventoryItem> Items;

    public void Start()
    {
        Items = new List<InventoryItem>();
    }
    public void AddOne()
    {
        InventoryItem n = new InventoryItem();
        this.Items.Add(n);
    }
    public void SaveFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        if (File.Exists(destination))
        {
            File.Delete(destination);
        }
        using (Stream stream = File.Open(destination, FileMode.Create))
        {
            BinaryFormatter bin = new BinaryFormatter();
            bin.Serialize(stream, this.Items);
        }
    }

    public void LoadFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        using (Stream stream = File.Open(destination, FileMode.Open))
        {
            BinaryFormatter bin = new BinaryFormatter();

            try
            {
                this.Items = (List<InventoryItem>)bin.Deserialize(stream);
            }
            catch (Exception ex)
            {
                Debug.Log(ex.ToString());
            }
        }
    }
}

sentences:
How would you design a transformation matrix to project absolute coordinates to any orthographic projection desired? I am attempting to make an RTS based on AoE II HD Edition. I want to have ease of control by designing a transformation matrix given any style of projection I want.
This is a good example of what I mean. So, given each of those three angles, and any absolute x, y, and z, how can I design a transformation matrix to multiply the absolute position by to get the projected position on the screen? I just want full control, and I need to get better at matrices. I am about to graduate High School but I hardly learned anything related to matrices. Only a little in Physics and a little in Algebra II with Trig.

I just need to know how to create the matrix.

Also, after that, how would I convert a projected matrix back to the original position? Dividing it (Although, I know matrices can't divide - I mean multiply by the inverse)? Thanks so much for any help!

sentences:
Application stops working when I add two fonts I created a game that has two fonts.
Being precise, the two fonts are PRESS_START_2P with the difference only in size. One of the fonts serves to write the title and the other for all other things.
The problem occurs after building the application (apk). As it is a special font I click on the option "copy to project" for it to be exported to the cell phone.
Image of the two fonts:

A detail is that the program does not recognize the original source directory, so I need to copy the source to the desktop to be able to copy it to the project.
Image demonstrating the problem:

Adding any of the fonts (alone), the game works. The problem happens when I add the second font.
Before posting here, I posted on the official engine forum, but I still haven't gotten any response.
LINK:
https://forum.yoyogames.com/index.php?threads/application-does-not-work-when-i-export-2nd-font.83968/

sentences:
How to access files in Chrome So, I am making a game-like html file that needs to load a few assets. I have a loading animation which uses the timing of the loading files to create a progress bar. This all goes fine. The files all load, and the app launches. However, none of the files can access each other as they are all in different script tags. And I cannot merge them because the JS is never actually put into the html. So what I need to do is to access the local file system (it uses the file:// prototype) and read the file, then stick the text into a script tag. However, all of the examples I have found on the web throw this error:

  Xhtmlrequests can only access (list of protocols not including file)

What I need is a JS way to access the files with no input from the user (other than opening the application). How can this be done?

sentences: Android emulator with acceleration and gyroscope simulation Is there an Android emulator that is compatible with eclipse that can simulate acceleration and tilting of a mobile device?

sentences:
Player disappears when it collides with a tagged object I am working on a simple game where the goal is to help a Player catch specific objects with a tag "Present".

After taking care of the models, animations I am now working on the collisions and counting UI.

For the collisions, on my Player Controller (I am using the ThridPersonUserController from the player Unity Standard Assets - which simplified the whole animation process), I added the following functions:

    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.tag == "Present")
        {
            Destroy(gameObject);
            count = count - 1;
            SetCountText();
        }
    }

    void SetCountText()
    {
        countText.text = "Count: " + count.ToString();
        if (count == 0)
        {
            winText.text = "Thanks to you the Christmas will be memorable!";
        }
    }

However, like this, when the Player hits an object with the tag "Present", even though the counting is working properly, the player disappears.

I have tried to change the OnCollisionEnter to an OnTriggerEnter, like this:

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Present"))
        {
            Destroy(gameObject);
            count = count - 1;
            SetCountText();
        }
    }

However when the Player hits the objects with the tag "Present", they don't disappear.

My Player has a Capsule Collider and a Rigidbody.

The objects with the tag "Present" have a Box Collider and a Rigidbody.

Any guidance on how to make my Player stay in scene while removing the other objetcs and reducing the count is appreciated.

sentences:
Should I be concerned that my microtransaction based game will often be hacked? I used to play Diablo II, both online and offline. The game was so easily “hackable” offline that one could download a program called Hero Editor and, using a nice, comfortable interface, change their character in many ways. However, it was harder to hack the online portion of the game, and many that did were caught. Thus some of the game’s content was restricted to online play, doubling up as a way to promote people playing together.

Now I’m making a mobile TD using Unity, targeting the iOS, Android, and perhaps PC/Mac/Linux platforms initially. Players would slowly earn some rare currency during play that can be used for permanently unlocking exciting (but non-essential) extras, or they can just pay for them.

I’m concerned that if I allow this gradual unlocking to happen offline (without a server to confirm the accrual of said currency), then it’ll be as easily hacked as Diablo II’s offline mode and that many people would simply resort to doing that instead of either playing it through or paying for it. However, I’m also reluctant to force online play, as the mobile environment has significantly lower network stability and this is a relatively long game to be playing in such conditions, so drop-out is very likely.

So my question is: how concerned should I be about the mobile game getting hacked for the purpose of acquiring these unlocks without going through the correct methods? Is it so easy that your average user could do it, like they could for Diablo II, having the potential to significantly damage the game’s bottom-line? Or is it difficult such that only a small percentage of people who are interested enough would bother to try, so I can focus on providing the best UX for all players without worrying about these hackers?

Brownies for anybody who can summarise how it may actually be hacked!

sentences:
Can you help me find resources for developing a top-down 2D game in Java? I just started reading about games, and I'm going to develop a game where a person is moving around on a 2D map. My preferred language is Java. Is that suitable to develop games?

I'm going to develop a desktop app and need some help to get started. Can someone please give me some good resources for newbies?

sentences:
Calculate the angle between two 3d vectors: Function always returns 89.1-89.9 I have my own 2d game and I am attempting to calculate the angle between 2 GameObjects.

My Problem: My function that is meant to calculate the angle(direction) between 2 Vector3's doesn't appear to be correctly calculating the angle. It always returns a value thats between 89.1 and 89.9, its never any other value.

What am I doing wrong? Can you help me to get my function to correctly calculate the angle between 2 Vector3's?

float getAngle(Vector3 p1, Vector3 p2) {

    // If p1 or p2 == Vector3.zero then this funciton wont work. What shd I do in this case?

    float coefI  = p1.x * p2.x;
    float coefJ  = p1.y * p2.y;
    float coefK  = p1.z * p2.z;
    float scalar = coefI + coefJ + coefK;
    float magnitude1 = p1.sqrMagnitude;
    float magnitude2 = p2.sqrMagnitude;

    Debug.Log (System.String.Format ("{0}, {1}, {2}, {3}, {4}, {5}", coefI, coefJ, coefK, scalar, magnitude1, magnitude2));
    return (Mathf.Acos ( scalar / (magnitude1 * magnitude2) ) * Mathf.Rad2Deg); // Always returns between 89.1 and 89.9 for some reason
}

void Update() {
    Debug.Log( getAngle (Input.mousePosition, transform.position) );
}

sentences:
How to change the sprite of an object from another's script? I have an object A and an object B, I want that when object B is in a certain position, the sprite of object A changes to that corresponding to that position, how do I change the sprite of object A from the script of object b?

The image may give them an idea of what I want to do, object B is the glove, And the object A is the viewer.

Tansk form any help.

sentences:
Where to store OpenGL object id:s When working with OpenGL, you often recieve integer id:s to keep track of OpenGL objects.

For example, representing a simple mesh, you may have a number of references to objects like so:

GLuint arrayBuffer;
GLuint elementArrayBuffer;
GLuint texture;

Having many meshes, the id:s add up quickly. Therefore my problem is, where it is most logical and efficient to store them?

Alternative 1

My first thaught was to hand out the id:s to corresponding game entities. Something along the lines:

class Entity {
public:
    GLuint arrayBuffer;
    GLuint elementArrayBuffer;
    GLuint texture;
    // Other methods...
}

Then having a render class:

// Create the buffers and textures and pass id:s to entity.
renderer.init(entity);
// Render with corresponding buffer/texture id:s stored in entity
renderer.render(projection, view, entity);

Where it then is easy enough, in the implementation of the render method, just picking id:s and render with them.

Some disadvantages is that this is a leaky abstraction, where OpenGL concepts are "leaked" to game entities. Which does not feel quite right. An advantage might be that the method supposedly is efficient. You do not have to find id:s, you know them for each rendering pass.

Alternative 2

Another alternative would be to store the id:s internally in the renderer. For example, an internal data struct:

struct RenderData {
    GLuint arrayBuffer;
    GLuint elementArrayBuffer;
    GLuint texture;
}

Then having an unordered map with references to each entity and corresponding RenderData:

std::unordered_map<unsigned int, RenderData> render_data;

Then in the rendering method, the correct render data is fetched from the map only by a unique id that is stored in each entity.

Advantages of this approach, is that it is less "leaky", where only the entity id is passed to the renderer, to know what data to use. Disadvantages may be slightly less efficiency, because of lookups in the unordered map?

I would greatly appreciate inputs on this, what approach to prefer, or if there are any other approaches out there?

sentences:
How to vary the initial velocity of a jump based on hold time? What I want to do is, the longer player holds the screen, the longer distance the object will jump when they release the hold.

Here is my code:

private float timeBeginTap;
switch (touch.phase)
{
    // Finger start touching the screen
    case TouchPhase.Began:
        print("Start tapping");
        timeBeginTap = Time.time;
        break;

    // Finger leaving the screen
    case TouchPhase.Ended:
        //when finger release,the object jump
        float timeHolding = Time.time - timeBeginTap;
        Debug.Log($"The player1 touched the screen for {timeHolding} seconds.");

        Vector2 jumpVelocity = new Vector2(timeHolding, timeHolding);
        rb.velocity = rb.velocity + jumpVelocity;

        break;
}

So with the code above I can get the value like 0.6324167, or 0.423567 for timeHolding, which is the amount of time that user hold the finger on screen.

And I able to make the object jump by using this code below:

Vector2 jumpVelocity = new Vector2(timeHolding,timeHolding);
rb.velocity = rb.velocity + jumpVelocity;

But the distance traveled or "force" with which the object jumps is very small and it doesn't make sense. Therefore I make an attempt with the code below:

float right = 5;
float up = 10;
Vector2 jumpVelocity = new Vector2(right*timeHolding,up*timeHolding);
rb.velocity = rb.velocity + jumpVelocity;

With the code above, the distance is of course longer. But it feels constant and not dynamic, because the relationship between the Vector2's X and Y value is always constant.

Therefore my question is,

What is the correct way to define the values of X and Y for a Vector2 object based on the value of Time?

If I missed anything, please guide me in the right direction.

Desired Outcome:

For example,the velocity added to the box is to let the box jump from pole to another pole and stand on it.

The velocity is define by using the time user hold on the screen,the longer the user hold on screen,the greater the velocity,means the x,y value of Vector2 is define by the timeHolding.

Now when I hold the screen for the long time,the box will jump to  the 3rd or 4th pole,and it not guarantee will reach the pole.Like everything is by chance.

What I want is,the box will jump from 1st pole to 2nd pole,from 2nd to the 3rd and continuously.At the same time,the velocity to go higher or lower and the distance is depends on the time user hold the screen.

This is what I want and my limited understanding of the problem.

sentences: Do I need to ask Microsoft for permission to use their products logo? I am currently making a trailer of my game for my college project, I would like to note that my game is cross platform. Do I need to ask for permission to use those images in such situation? - When I want to say that their game will be on playable on Windows/Mac/Linux.

sentences:
DirectX10 How to use Constant Buffers I'm trying to access some variables in my shader, but I think I'm doing this wrong. Say I have a constant buffer that looks like this:

cbuffer perFrame
{
    float foo;
    float bar;
};

I got an ID3D10EffectConstantBuffer reference to it, and I can get a specific index by calling GetMemberByIndex, but how can I figure out how many members perFrame has so that I can get each member without going out of bounds?

sentences:
Time complexity of solving constraints in physics engine Erin Catto mentioned in a talk that solving constraints precisely requires cubic time and quadratic space. What algorithm is he talking about when he mentions cubic time?

pdf of slides with following quote:

  We can model and program our constraints perfectly. Good enough to drive a robot arm on an assembly line or
  launch a satellite into space. Unfortunately for games, we do not have enough cycles to solve constraints accurately.
  Solving constraints precisely requires cubic time and quadratic space. For games we make due with linear time and
  space, so we are constantly wrestling with our solvers. The better you understand constraint solvers, the better
  chance you’ll have of creating robust simulations in your game.

sentences:
Unity3D : Unity fails to detect null objects im instantiating an object which is gonna play the background music for my game. On the Awake() function I check if there is a gameobject with the tag "MusicPlayer" on it, and if there isn't any I instantiate a prefab (the music player prefab with the tag "MusicPlayer" on it).

Now my issue is this :

It keeps instantiating the prefabs even if there is one or more music players(objects with the "MusicPlayer" tag on them). Why is this happening ?

Here is my code :

var musicPrefab : Transform;

function Awake()
{
    if(GameObject.FindWithTag("MusicPlayer") == null)
    {
        Instantiate(musicPrefab,transform.position,transform.rotation);
    }
}

I also have a script that makes the music player not be destroyed upon the level reload. This is the script :

function Start()
{
    DontDestroyOnLoad (gameObject);
}

Thank you for your time, I hope I was clear enough.

sentences:
How to create 2D shadows and lighting? How do I create shadows and lights in a 2D top down perspective game? I want to achieve an effect similar to this game (also made in unity) where some objects like a torch, different sprites, and the player have a light source while the rest of the map is dark.

Do you anyone know how to achieve this, and could link me to some good resources on how to implement it in unity?

sentences:
SimpleOpenNI: Check if user hand is in specific area on image Concerning our Microsoft Kinect project, we need some help.

We control a robot with our movements tracked by the Kinect sensor. We display the depth image of the Kinect sensor on our screen, so we see what the sensor is acutally tracking.

Now we want to implement a feature that a user can turn the robot on and off by moving the hand on a specific area drawed on this depth image. You can see this in the image below. The problem now is, that the coordinates of this "on-drawed" ellipse obviously are relative in the 3d-space.  I know that there must be any possibility to translate the X-, Y- and Z-coordinates of the hand in the 2d-space, but honestly, I have no idea how to do this. I imagine a kind of "tunnel" from the point of view of the sensor, like in the picture below, which the user must hit.

I hope that somebody can help us here.

sentences:
What steps should I take to learn level design/programming? I'm still in high school, and I've been playing games for 12 years, and I've always wanted to eventually learn level development and design, and programming. However I'm no good at art and as of now have absolutely no education what-so-ever about either of these things.

I was wondering which fields of study should I branch into in order to learn these things? Is it even reasonable to attempt to learn level creation if I'm no good at art anyway?

sentences:
Extracting tiles from a tileset programatically? How do I programatically extract tiles from a tileset such as this one:
http://opengameart.org/sites/default/files/grassland_tiles.png

I want to use these tiles in my game. I see that some tiles here are of different sizes (or maybe all tiles are a multiple of some fixed size). For example, if I want to use one of the tree tiles in my program, how can I figure out what offset into the tileset image I must use, and how big of a sub-image i must extract? I don't see any metadata associated with any of these tilesets that I can use.

Thanks!

sentences: Dynamically Deformable Terrain In Game Engine I am looking for a game engine that is open to the public for free or at a payed price that allows for any reasonable way of doing deformable terrain over a network. The closest I have found to this is in udk where one can build a terrain in 3ds, cut it up, and import different chunks into udk, and fracture them. Unfortunately after a few hours work I discovered that this doesn't seem to work too well for what I am trying to do. Can anyone recommend a game engine, or even a rendering engine that supports this? Programming other features into a rendering engine is not an issue for me.

sentences:
How to assign an index to different node clusters? (for pathfinding) Hellow~
So for a bit of context: i'm currently working on a RTS (way above may league) which already has a level editor and a node grid which maps the terrain, i previously make a navigation system with A* as explainned by Sebastian Lague in his tutorial series about the topic, but then i run into a problem when running with multiple units (not the point here: but never manage to find each unit cluster within the selection), so i change it into a navmesh mapping which if made dynamic by assigning navmesh obstacles to the unwalkable nodes (the frame after the creation of the node grid)
Now i want to use the node grid basically to check if the target node and the start node share the same node cluster. But here is the thing: i can't assign the needed index to the nodes as i expected.
I've been trying adapting code from this post, but didn't quite make it.
Now i have this one, which i think could achieve something but still gets me a invalid operation exception:
public const int UNWALKABLE_ISLAND = 999;

public static void SetIslands(ref WorldGrid _worldGrid) {
    int width = _worldGrid.nodeGrid.GetLength(0);
    int height = _worldGrid.nodeGrid.GetLength(1);

    bool[,] visited = new bool[width, height];

    int clusterCount = 0;

    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++)
        {
            if (visited[x, y]) { continue; } else {
                List<Node> cluster = new List<Node>() {
                    _worldGrid.nodeGrid[x, y]
                };

                foreach (var node in cluster) {
                    if (node.isWalkable)
                    {
                        visited[node.X, node.Y] = true;
                        node.SetIslandIndex(clusterCount);
                        cluster.AddRange(_worldGrid.GetNeighbours8D(node));
                    }
                    else
                    {
                        cluster.Remove(node);
                    }
                }

                clusterCount++;
            }
        }
    }
}

The error:

InvalidOperationException: Collection was modified; enumeration operation may not execute.
System.ThrowHelper.ThrowInvalidOperationException (System.ExceptionResource resource) (at<437ba245d8404787b9fbab9b439ac908>:0)
System.Collections.Generic.List1+Enumerator[T].MoveNextRare() (at<437ba245d8404787b9fbab9b439ac908>:0) System.Collections.Generic.List1+Enumerator[T].MoveNext() (at<437ba245d8404787b9fbab9b439ac908>:0)
Pathfinding.SetIslands (WorldGrid& _worldGrid) (at Assets/Pathfinding.cs: 25)
WorldGrid.CreateNodeGrid() (at Assets/WorldGrid:80)
WorldGrid+d_12.MoveNext() (at Assets/WorldGrid.cs:42)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, Sustem.IntPtr returnValueAddress) (at<437ba245d8404787b9fbab9b439ac908>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

My node class contains an int that should hold the cluster index, which will be using for the request check. (the code its based from this youtube video)
Right now i'm trying to understand the spectral clustering stuff, i've been told it could help.
I hope you can help an animator in need with some pointers.
Cheers :3
*Oh!, I also tried reading the nav agent path end coordinate for comparison, but it ended up becoming a huge mess for me.

sentences:
How do I efficiently perform collision detection on an NxN rectangle grid? I have a simple level that is constructed from an NxN rectangle grid. Some of the rectangles are walls, and some of them are the path. The player is allowed to move only on the path they are on and also the path rectangles on the grid. So I have two kinds of rectangles in the grid:

"path"
"wall"

The player is a sprite above the grid. I want to efficiently find if the player is colliding with the wall. I want to loop through the rectangles, to see if they intersect. What is the best method?

sentences:
Attributes and Behaviours in game object design Recently I have read interesting slides about game object design written by Marcin Chady Theory and Practice of the Game Object Component Architecture. I have prototyped quick sample that utilize all Attributes\Behaviour idea with some sample data.

Now I have faced a little problem when I added a RenderingSystem to my prototype application. I have created an object with RenderBehaviour which listens for messages (OnMessage function) like MovedObject in order to mark them as invalid and in OnUpdate pass I am inserting a new renderable object to rederer queue. I have noticed that rendering updates should be the last thing made in single frame and this causes RenderBehaviour to depend on any other Behaviour that changes object position (i.ex. PhysicsSystem and PhysicsBehaviour).

I am not even sure if I am doing this the way it should be. Do you have any clues that might put me on the right track?

sentences:
LibGDX Change mouse cursor to custom image......and keep it there I'm able to create a custom cursor no problem using the following code running in my GameScreen's Show method:
Pixmap pixmap = new Pixmap(Gdx.files.internal("ui/cursor.png"));
Cursor cursor = Gdx.graphics.newCursor(pixmap, pixmap.getWidth() / 2, pixmap.getHeight() / 2);
Gdx.graphics.setCursor(cursor);
pixmap.dispose();

The problem is...if I deselect the game window and return back...the cursor has returned back to the default one. At least that happens for me on Mac desktop. If I move the cursor out of the screen (without deselecting) and then back again I get the custom cursor image back but I don't think people would know to do that.
But after searching I couldn't find any way for LibGDX to detect when the game window is deselected? I thought I would be able to find that since it would seem useful for something like automatically pausing when deselecting the game window and such.
That would seem to be the way to reset the cursor every time returning to the game window, unless there's some other way to make it more permanent?
EDIT: The cursor in fact just seems to randomly disappear for no reason during gameplay and then sometimes reappear briefly....seems like it's a bug.

sentences:
How can I fix this transparency problem when my data is viewed from a certain angle? using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;

I render a 3D data by setting device.RenderState.AlphaBlendEnable = true

Now my top view looks like below, the outer surface layer covered the underneath layers and resulting only outer layer is displayed at top view.

I would like to view the underneath layer from top view. How do I do this? Is there any setting can be done using Microsoft.DirectX ?

Update: Question is solved by myself

device.RenderState.ZBufferWriteEnable = false;

sentences:
Do iOS users use Facebook and Twitter buttons within games? Does anyone have any insight or experience into the successfullness of placing Facebook or Twitter "share" buttons within an iOS game?  For example, when a user gets a high score, presenting them with the option to share their score via Facebook or Twitter.

My reservations/bias against including Facebook or Twitter buttons in my game are:

Distrust of buttons that auto-post without giving one the chance to format the text yourself
I don't use themself because I tend to manually create tweets or Facebook wall posts on my own

On the other hand, the potential benefits of such buttons can obviously be profound.  The question is simply: do iOS users actually use such buttons?

sentences:
GL_TRIANGLE_ADJACENCY and glDrawElements So I've not been able to find much online about how data should be stored for triangle adjacency.

Currently I calculate my adjacent using half-edges (mention in an answer here).

But do I store this data in with my VBO? (Which means twice the vertex data)
Or do I store it in my element array buffer? And if so how do I tell opengl the interleaving I would have in it?

sentences:
How to generate a navmesh from a set of 3D meshes from scratch I've found a great article on how to build a constrained delaunay triangulation that can be used to create a simple navmesh from cutout geometry. However, this does not seem sufficient to generate a high quality navmesh from any arbitrary set of level geometry from scratch.
One of the problems is that it only deals with triangles in XZ space. But how should I handle situations where an arbitrary 3D mesh is intersecting another arbitrary 3D mesh? Within their intersection, each triangle would need to retriangulated in some way.

sentences:
help a 2D image onto a 3D cube I am just diving into the Stage3D APIs for Flash Player 11.  I am trying to figure out a simple way to display isometric 2D content that gets blitted from a sprite sheet onto a 3D cube.  The idea being that then the isometric content can be split into the appropriate quads of the cube and handed over to the GPU.

I found this post 2D sprites in 3D space? but I don't understand if the billboard method would split the content properly to ensure depth sorting of the quads.

Are there algorithms for basically projecting the image into the respective quads?

Addition Info (added 2012.03.06 @ 1124 GMT -6)

If you were to overlay a 3D box projected isometrically on top of a 2D isometric sprite (say a crate), the faces of the box (i.e. the top, left & right) should line up roughly with the perceived edges of the 2D sprite.  I want to chop up the 2D sprite along those edges and apply them to the 3 quads (again the top, left and right faces of the 3D cube).

I'd assume there is some pretty gnarly translations to skew the 2D content to fit that quads yet maintain their perspective when viewed via an iso camera in 3D.

sentences:
surface.Bake(); no such command Regarding the code shown in this video at 13:50:
When I try: surface = GetComponent (); surface.Bake();
I am getting the following error message:

UnityEngine.AI.NavMeshSurface does not contain a definition for bake
and no extension method Bake of type UnityEngine.AI.NavMeshSurface
could not be found "are you missing an assembly reference

I am struggling to get the dynamic navmesh working with Unity 2017.1.

sentences:
Sprite framework binding multiple textures In an attempt to batch render as many quads (sprites) as possible, I'm instance rendering a single unit-sized quad and passing in a buffer of per-instance data that includes width/height, texture coordinates, color, texture Id, etc.

Offline, I have a tool that constructs texture atlases based on any particular sprite animation, so the output is flexible in terms of texture atlas width/height, which sprites reference which texture atlas, and so on.

The end result is that I may have many texture atlases, and sprites which reference any one of those atlases for their current frame.

I need a robust solution that'll allow me to draw these sprites in any order while reducing texture binding as much as possible. After some research there are two options:

combine multiple 2D textures into a 2D array texture (up to GL_MAX_ARRAY_TEXTURE_LAYERS_EXT)
bind multiple textures in array of samplers (up to MAX_TEXTURE_IMAGE_UNITS)

The first solution I believe requires all textures to be the same height/width.
The second solution seems to have a limitation that requires a constant index to access the array of samplers in the fragment shader.

I think I want to go with the second solution, but I'm worried I won't be able to properly write a fragment shader if I have to use a constant index, as I'd be getting the index via per-instance data input.

Are my above suspicions correct? Is there a known work-a-round for the second solution? Or is there a better way to do this than what I presented.

sentences:
lemniscate of Bernoulli I am trying to learn and teach myself openGL and I wanted to draw a figure 8 in a 3D setting but I'm having a problem. Please forgive me, I am very new at this but I'll attempt to explain what I have done so far

I understand that I can use the Lemniscate of Bernoulli to draw a nice figure 8, so I've have adopted that idea into my code. I just want to draw it along the x and z plane.
 My code looks like this

#define PI 3.1415926535f
#define MAX_STEPS 100.0f
//...
Vector3 PointOnCurve1(Vector3 p1, float t)
{
    Vector3 tempPoint = {0.0f, 0.0f, 0.0f};
    float scaler = 2/ (3- cos(2*t));

    varX = scaler * cos(t);
    varZ = scaler * sin(2*t) / 2

    tempPoint.x = varX+p1.x;
    tempPoint.y += p1.y;
    tempPoint.z =varX+p1.z;

    return tempPoint;
}

Vector3 g_Point    = {-4,  0,  0};
glBegin(GL_LINE_STRIP);
    for(float t = -PI; t <= PI; t += PI / MAX_STEPS)
    {
        vPoint = PointOnCurve1(g_Point, t);
        glVertex3f(vPoint.x, vPoint.y, vPoint.z);
    }

glEnd();

All I'm getting is one straight green line instead of a figure 8. any ideas? Am I missing something here? I'm basing this equation from this gamedev article

How can I move an object in an "infinity" or "figure 8" trajectory?

sentences:
Unity 5 How Do I Set Text of Text Component of Input Field How do I set the text of the new Input Field's Built In Text UI Object in Unity 5+?

 myInputFieldText.text = "Text Value I Want";

The code above does not work to set the text inside of a InputField's Text. Thanks

sentences:
Texture filtering of look-up table in post process shader I am doing post processing by drawing to an FBO and then applying a certain fragment shader when drawing the FBO's texture to the screen. I want to use a look-up table texture to apply color grading. Since I am targeting OpenGL ES 2.0 and possibly older PCs, I cannot use 3D textures. Instead I can use a 2D texture as an atlas of the layers of my 3D look-up table.

What I'm concerned about is correctness and performance when the texture lookup is performed. My look-up texture needs to have linear filtering so I don't have to have a full 256^3 sized look-up table to cover all hues.

My fragment shader would look something like this: Round B up and down to get the two regions of the texture to sample from, add offsets accordingly to R/G and sample the texture twice with the two offset .rg values. And finally linearly interpolate based on B.

But I as I understand it, the when the GPU encounters a texture2D call on a texture with linear filtering, it will be calculating the input coordinates for those calls for neighboring pixels in parallel to get a derivative. This derivative is used to determine how to sample the texture pixels.

Since this is a post process, I don't want two neighboring pixels to influence each other. It could be a black pixel from the edge of a sprite next to a bright blue sky pixel. In the look-up table, these two would need to sample distant points. So is the GPU going to decide the derivative is huge (minification) and try to linearly sample and involve all the random in-between texels on my look-up table?

Is there a way to get my linear filter to ignore neighboring pixels and only interpolate from the 4 nearest texels? Sort of like treating everything as magnification?

The problem is similar to this question that was asked in regards to HLSL, but I'm targeting OpenGL 3.0 and OpenGL ES 2.0: Color grading, shaders and 3d textures

sentences:
How To Scale Canvas In Android I am writing a android game using Canvas as the way to draw everything, the problem is that when i run it on different android phones the canvas dosn't change size i tried using canvas.scale() but that didn't make a i difference. The code i use for drawing is ...

public void draw( Canvas c, int score )
{
    Obstical2[] obstmp = Queue.toArray(this.o);
    Coin[] cointmp = QueueC.toArray(this.c);

    for( int i = 0; i < obstmp.length; i++ )
    {
        obstmp[i].draw(c);
    }

    for( int i = 0; i < cointmp.length; i++ )
    {
        cointmp[i].draw(c);
    }
    c.drawText(String.format("%d", score ), 20, 50, textPaint);

    if( isWon && isStarted ) c.drawText("YOU WON", 20, 400, resPaint);
    else if( isLost && isStarted ) c.drawText("YOU LOST", 20, 400, resPaint);
}

The function above calls the draw functions for the entity's on the screen, theses function are as follows

Draw Function For Obstical :

public void draw( Canvas c )
{
    Log.i("D", "COIN");
    coin.draw(c);
}

Draw Function For Coin :

public void draw( Canvas c )
{
     obstical.draw(c);
}

The on create function is :

protected void onCreate(Bundle savedInstanceState)
{
    player = new Player(this);
    //map = new Map(this, );
    WindowManager w = this.getWindowManager();
    Display d = w.getDefaultDisplay();

    float sy = d.getHeight()/800;
    float sx = d.getWidth()/480;

    super.onCreate(savedInstanceState);

    Intent intent = getIntent();
    String type = intent.getStringExtra(CUBEMenuActivity.EXTRA_MESSAGE);

    Log.i("MENU", type);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    //mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
    mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);

       // Remove the title bar from the window.
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

        // Make the windows into full screen mode.
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    map = new Map( this, type, sy, sx );

    canvasView = new CanvasSurfaceView(this, map, player, sx, sy );
    setContentView(canvasView);

    Log.i("C", "Canvas View Set");

}

i am using a canvasSurfaceView instead of an XML layout, the canvasSurfaceView constructor method is

public CanvasSurfaceView(Context context, Map map, Player player, float sx, float sy)
{
    super(context);
    holder = getHolder();

    gestures = new GestureDetector(new GestureListener(this));

    this.map = map;
    this.player = player;
    this.background = Bitmap.createScaledBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.background1), 480, 10000, false);
    this.sx = sx;
    this.sy = sy;
}

when the game is running the run() method is called repeatedly this is where the canvas class is initialized

public void run()
{
    while( run == true )
    {
        if( !holder.getSurface().isValid() )
        {
            continue;
        }

        Canvas c = holder.lockCanvas();

        if( ( map.isWon || map.isLost ) && map.isStarted ) setCompleated();
        //c.scale(sx, sy);

        if( notCompleated == false )
        {

            if( map.map.bottomOfLevel != 800 ) by += player.terminalVelosity / 2;
            update();
        }
        c.drawBitmap(background, 0, by, null);
        map.draw(c, player.score);
        player.draw(c);

        holder.unlockCanvasAndPost(c);
    }
}

How could i make the canvas re-size to it would look the same on any screen ?

Cheers Daniel

sentences:
How to play GameObject (ParticleSystem) and stop? Have a game where you've to shoot somethings and when you hit the GameObject I've should play. I've tried with Instantiate but I can keep shooting even if the gameobject is destroyed. What should I do in order to fix it?

 public GameObject particlesystem;

 void Start () {
    particlesystem= GameObject.Find("Effect");
 }

 void Hit(){
 Destroy(gameobject)
 Instantiate(particlesystem, transform.position, transform.rotation);
 }

This is how I handle it now, but as I wrote earlier I can keep activating the particle system.

sentences:
Should I refer to browser-based games as HTML5 games or Javascript games? First of all, I know that there are alternatives to both HTML5 and Javascript, but I worded the question so generally ("browser-based") because if I had said "HTML5" or "Javascript" games that would already imply an answer to the question.

When writing wiki posts or discussing, I usually call these games "HTML5/Javascript" games. They are written in Javascript, using the new HTML5 technology. What is the proper way to call them: HTML5 or Javascript games? I see that most people opt for HTML5, why?

sentences:
Quaternion.LookRotation with Joystick I am having an issue i cannot seem to figure out within my code. What this code does at the moment is that it rotates the 3D Model around the z axis but i need it to rotate around the y axis. Any help would be greatly appreciated.

void Update ()
    {
        Vector3 moveVector = (Vector3.up * joystick.Horizontal + Vector3.left * joystick.Vertical);
        if (joystick.Horizontal != 0 || joystick.Vertical != 0)
        {
            transform.rotation = Quaternion.LookRotation(Vector3.forward, moveVector);
        }

    }

sentences:
Error "glGenBuffers is ambiguous" in Eclipse Mars I have called a function, which is part of OpenGL correctly.

uint vboId;
glGenBuffers(1, &vboId);

This is definitely correct because the program successfully runs.

The error shown when I hover over the second line is as follows.

  'glGenBuffers' is ambiguous '
  Candidates are:
  void glGenBuffers(int, unsigned int *)'

The full function is below.

void Loader::storeDataInVao(int position, short data[], ushort data_length) {
    uint vboId;
    glGenBuffers(1, &vboId);
    vbos.push_back(vboId);
    glBindBuffer(GL_ARRAY_BUFFER, vboId);
    glBufferData(GL_ARRAY_BUFFER, data_length * 2, &data, GL_STATIC_DRAW);
    glVertexAttribPointer(position, 2, GL_SHORT, GL_FALSE, 0, 0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
}

The includes are "Loader.h", "RawModel.h" and "", two of which are my other files. However, every single one of my header files has valid header guards, defined as shown below.

#ifndef SRC_DISPLAY_LOADER_H_
#define SRC_DISPLAY_LOADER_H_
code here
#endif /* SRC_DISPLAY_LOADER_H_ */

The glGenBuffers is underlined red, just like any other error.

sentences:
How to implement toroidal mapping in SDL? I am making an Asteroids clone in SDL2. I think the kind of world asteroids takes place in is called toroidal map. I'm refering to the fact that the edges of the world are connected so when you exit from one side, you appear at the opposite.

My first approach was with SDL_DrawRect(), but I don't know how to "break" the rectangle in order for it to appear in two (or more) sides at once. I faked the effect by creating another rectangle, like a shadow, when the original rectangle was touching an edge. It worked somehow, but I wanted the real deal: render the diferent parts of the rectangle in different edges.

My second approach is creating the rectangle by SDL_FPoints in a std::vector, like this:

struct SpaceObject {
  std::vector<SDL_FPoint> shape_;
  // more members
  void generateSquareShape(const SDL_FPoint& where);
  void move(float delta_time, const SDL_Point& screen_size);
  void render(SDL_Renderer& renderer) const;
  void warpCoordinates(SDL_FPoint& point, const SDL_Point& screen_size);
  // more functions
};

The shape is generated once with generateSquareShape(). It just sets the appropiate coordinates to each SDL_FPoint.
The movement function is just applying deltas to each point:

void SpaceObject::move(float delta_time, const SDL_Point& screen_size) {
  for (auto& point: shape_) {
    point.x += delta_.x * delta_time;
    point.y += delta_.y * delta_time;
    warpCoordinates(point, screen_size);
  }
}

Render is more of the same, another vector travesal:

void SpaceObject::render(SDL_Renderer& renderer) const {
  for (const auto& point: shape_) {
    SDL_RenderDrawPointF(&renderer, point.x, point.y);
  }
}

The warpCoordinates() is called at every move to check if a point must go to another side:

void SpaceObject::warpCoordinates(SDL_FPoint& point, const SDL_Point& screen_size) {
  if (point.x < 0) {
    point.x = screen_size.x + point.x;
  } else if (point.x > screen_size.x - 1u) {
    point.x = point.x - screen_size.x;
  }

  if (point.y < 0) {
    point.y = screen_size.y + point.y;
  } else if (point.y > screen_size.y - 1u) {
    point.y = point.y - screen_size.y;
  }
}

All in all it accomplishes with the effect nicely, but I think it performs poorly (at least in my laptop i5 2,6ghz, 6gb RAM, win10) and it hasn't collision detection yet.
One optimization I think is moving and rendering on the same function so it only loops through the points vector once, but I think that breaks the one function, one job, doesn't it?

So, is there anything I'm missing to improve performance? A faster algorithm to implement this toroidal world? Maybe a most suitable SDL class to work with? Or some C++ technique I'm not using and I should? Thanks in advance, any help appreciated.

Using win10, SDL2.0.12, and the latest visualC++ compiler.

sentences:
How can I change the Value in HSV color via scripting? I have a glowing object (point light attached to a ball with a default shader with the emission property) in my scene and I've added a script to make the point light flicker.
The script randomly changes the intensity of the point light to make it flicker.
Since I'm using an emission shader, the ball can also be seen without light.
I'm using HDR values in my emission shader and by changing the Value in the HSV Color picker I can change the color of the ball to black.
I need help in linking the value of the HSV color on the emission shader of the ball to the intensity of the point light.
Any help would be useful! Thanks!

sentences:
Geometry shader for multiple primitives How can I create a geometry shader that can handle multiple primitives? For example when creating a geometry shader for triangles, I define a layout like so:

layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;

But if I use this shader then lines or points won't show up. So adding:

layout(triangles) in;
layout(triangle_strip, max_vertices=3) out;
layout(lines) in;
layout(line_strip, max_vertices=2) out;

The shader will compile and run, but will only render lines (or whatever the last primitive defined is).

So how do I define a single geometry shader that will handle multiple types of primitives? Or is that not possible and I need to create multiple shader programs and change shader programs before drawing each type?

sentences:
Unity - Apply different Near/Far clip plane value for different layer I am Lerping the Near value of my camera, from 0 to 38, and it gives this result:
change near clip plane effect

As you see, it gives a nice effect. But now I would like the effect to occur only for one specific layer. How can I do that?

sentences:
What is the license you need to publish to Xbox 360 from Unity3D? I have a license for deploying and releasing games using XNA.
What is the license I need to deploy and publish games using Unity3D, and how do I get it?
I have found very little and unclear information about how to publish to Xbox360 from Unity3D, and I can't come up with search words to get this information.

sentences:
How are the following 3D effects mocked in Myst 4? (link) Superficially, I thought 'all' that would be required to make a myst style game would be to place the camera inside a 3D sphere, with the sphere's inner surface textured with an appropriately-distorted (to account for the concave nature of the sphere), 2D rendering of a 3D world.

The only thing that I can't really work out is how are some elements of the game alive and moving?

In this video, the sea waves are moving:
http://www.youtube.com/watch?v=ju0lACSm7Us

In this one we have some pretty cool particle effects involving clouds, as well as lighting, thought I think the lightning is pre-rendered:
http://www.youtube.com/watch?v=_CidCIDHFL4

I doubt these effects are actually 3D; I think they are 2D looping movie files. However I could be wrong.

To clarify, how do you think they've achieved such gorgeous 3D effects regarding the water, clouds and lightning?

Are they looping movies? How are these movies presented to the user and integrated so well?

sentences:
How to draw a line in 3d space? I have a top down billiard game. And on click / tap the ball moves in the clicked direction like in the image below:

Now, I want a line to be drawn in the direction where the mouse is hovers or the finger is swiped, here is my update code:

void Update () {

        //this should make the line, why not working?
Vector3 forward = transform.forward;
Debug.DrawRay(transform.position, forward);
Debug.DrawLine(transform.position, transform.position + forward * 10000);

        if (Input.GetMouseButtonDown (0)) {

            //
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100.0f)){

                //

                //
                Vector3 startPos = transform.position;
                Vector3 clickPos = new Vector3(hit.point.x, hit.point.y, transform.position.z);
                Vector3 direction = Direction (clickPos - startPos);

                //direction
                rb.velocity = new Vector3(direction.x * 5, direction.y * 5, 0);

            }

        }

    }

I tried DrawLine, Drawray, any ideas?

sentences:
Playing Sounds and removing instances once they have played -- Android I am playing sounds in my application I have the following code

sounds = new HashMap<String, MediaPlayer>();

Then when guys are created on screen they are given a sound.

sounds.put("sounds"+Integer.toString(ncount), MediaPlayer.create(this, R.raw.hit));

I want to remove the MediaPlayer from the hashmap like I do the enemies when they die

sounds.get("sounds"+Integer.toString(ncount)).setOnCompletionListener( new MediaPlayer.OnCompletionListener() {

    public void onCompletion(MediaPlayer mp) {

        sounds.remove("sounds"+Integer.toString(ncount));
    }

});

This errors out... how would I reference the sounds hashmap to remove the associated MediaPlayer when sound is complete?

Thanks!

sentences:
samplerCube for point light shadow map has dark corners relative to screen aspect ratio / size? I almost have point light shadows working but the corner of the samplerCube that I use for the shadow map has corners that get darker depending on the main camera. Is this something to do with a transform into a different space somewhere? I followed learn-opengls tutorial on this and they don't seem to have this issue or it just didn't come up in their simple example.

Here a YouTube video of the problem because it is kinda hard to explain... https://youtu.be/FXpwgyJh1ZA

That shows the depth map sampler not the shadows by the way.

This also happens when the radius is almost 0 and the cube map is completely white.

float PointLightShadow(
    vec3 NegL, // FragWorldPos - pointLights[i].Position
    float R)   // radius of light
{
    if (mat_hasShadowMap2 == 0) {
        return 1.0f;
    }

    float closestDepth = texture(mat_shadowMap2, NegL).r;
    float currentDepth = length(NegL);

    float bias = 0.05;
    float shadow = R * closestDepth > currentDepth - bias ? 1.0 : 0.0;

    return closestDepth; // for this example
}

Sending light position to shader

...
m_lightData.PointLights[i].Position = lights[i]->Position(); // setting in world space
...

and for the FragWorldPos

...
out vec3 FragWorldPos;
...
vec4 worldPos = model * vec4(vert, 1);
FragWorldPos  = worldPos.xyz;
...

and then the fragment shader has a matching in variable.

I think like 99% of this is working, I just don't understand why the cube map seems to have these dark corners. They change aspect by changing the screen also suggesting that they are in some type of camera space, but I don't see where that would happen. Let me know if you need more context for the code snippets, these are the only important parts I think though.

sentences:
Why do games have different ports for different maps? A little old example for that would be Metin2, this is the only game I know which have that, but there may be more.
In Metin2 there are maps which are accessable through other ports.
I'm not a network specialist, but I think then it is needed to connect to an other port on an map change.

So would it not be possible todo all that on one port? Are there any benefits from that?

Could it be that there is a limit on port connections on a server, that this would be something for loadbalancing?

sentences:
How does a wow server handle which player position to set to each nearest players? I already understood how game developers could create very large game levels, bypassing the floating point precision limit.

This was my very first mind boggling question, and I understood it when I read how some programmer told the story of some dungeon PC game.

My question is more related to game networking, more precisely wow.

There are no interruptions in the game level (apparently I think).

Since the viewing distance is much smaller than the world size, and since there are a lot of players, you can't send all players positions because it would require too much bandwidth; so you have to only send the nearest players positions, among a pretty big list of connected players.

Those servers are almost always online, with a large number of players (only doing quests or idling into cities, since I guess dungeons and raids must be hosted on dedicated servers), and they must find a solution to save as much bandwidth as possible.

So at one point the server has to determinate which players positions it has to send to which players, and when it has to stop sending it.

I was wondering about how the server does this, because to me it seems to have O(n^2) or even an O(2^n) complexity.
How do they do it ? Do they fragment into virtual tiles so they only check players in the nearest tiles ? Do they calculate this not so often so that the server can handle it ?

A continuous online persistent world is quite awesome, but technically I don't really know how they do it.

sentences:
Rendering multiple objects in OpenGL I am using advanced OpenDL methods (VBO, VBA, ...) to render over screen. Currently I abstracted vbo, vba, index buffer, texture, and shader to a class called 'Object2D'.

I tried to render two objects on screen. I saw that when the same shader is applied to both objects it works fine; but if the two objects are rendered with two different shader script, only the one rendered last is visible to screen.

Here is Object2D::render():

void Render()
{
    if(check_status())
    {
        sh.bind(); //shader
        vb.Bind(); //vertex buffer
        ib.Bind(); //index buffer
        tex.bind(); //texture buffer
        glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_INT,NULL);
    }
    else{}
    //sh.unbind();
}

And here is the drawing function (assume the two 2D objects are obj and box):

void display()
{
    glClear(GL_COLOR_BUFFER_BIT); //refresh/..
    box.sh.setUniformMat4x4("m_projection",GL_FALSE,1,&m_PROJ[0][0]);
    box.Render();
    obj.sh.setUniformMat4x4("projection_matrix",GL_FALSE,1,&m_PROJ[0][0]);
    obj.sh.setUniformMat4x4("view_matrix",GL_FALSE,1,&view_transform[0][0]);
    obj.Render();
    glFlush();
}

And this is the shader binded to box:

#shader vertex
#version 330 core

layout(location = 0) in vec4 positions;
uniform mat4 m_projection;
void main(void)
{
    gl_Position=m_projection*positions;
}

#shader fragment
#version 330 core

layout(location=0) out vec4 color;

void main(void)
{
    color=vec4(1.0,0.4,0.3,1.0);
}

and this shader is binded to obj:

#shader vertex
#version 330 core

layout(location = 0) in vec4 positions;
layout(location=0) in vec2 texture_coodrinate;
out vec4 p;
out vec2 TexCoord;
uniform mat4 projection_matrix;
uniform mat4 view_matrix;

void main(void)
{
    gl_Position=projection_matrix*view_matrix*positions; //modelvi
    p=projection_matrix*view_matrix*positions;;
    TexCoord=texture_coodrinate;
}

#shader fragment
#version 330 core

layout(location=0) out vec4 color;
in vec4 p;
in vec2 TexCoord;
uniform vec4 U_color;
uniform sampler2D tex_;

void main(void)
{
    ;
    U_color;
    color=texture(tex_,TexCoord);
}

My problems are:

Two of the objects aren't being rendered if until and unless both the shaders are same
Unbinding the shader result in no rendering?

sentences:
Unity - Blend tree weird transition I have duplicated the blend tree from the ThirdPersonCharacter (Ethan) which comes with the Standard Assets package.

In the duplicate I went into the blend tree and swapped out the walk animation "HumanoidWalk" with my own animation named "walk", but now I get a weird transition from the animation "walk" to "HumanoidRun".

Both animations, my walk animation and the original "HumanoidWalk" are root animated and look similar they have around 1.5 velocity both and same frame length.

Animation Settings:

I created the animation in blender, you will see in my video below that the animation itself runs smooth and as it should, but the transition to HumanoidRun is very weird for unknown reasons. I am using a custom metarig armature which comes with the blender add-on "rigify", I deleted some bones on the finger, but the avatar has a check and is ok (no warnings either).

Rig Settings

Player settings

I basically "copied" all the components from Ethan (ThirdPersonController) and only changed the Animator Controller and the Capsule Collider settings to match the model.

I made some short videos where you clearly see the problem, it happens if the parameter Forward is at about 0.6 - 0.8.

https://youtu.be/Q-T7FplDxLE

https://youtu.be/nrJNeo1ltsg NOTE: First I am demonstrating how it looks with the normal animations, then I add my own.

What am I doing wrong?

More Infos:

I just baked the walk animation in blender and exported it to unity again, but this made no difference.

I tried to export it from blender as FBX, it made no difference. However, I noticed that the import is happening much faster and applying in unity importer is very fast now.

sentences: How do I smooth out of the effects of a too-sensitive control? I have a game that takes input from a joystick. If you tilt the joystick right, the ship moves right linearly according to how much the joystick is tilted. So if you tilt the joystick twice as much the ship tilts twice as much. This feels fine in cases when you want to bank the ship through a steep turn (ie. lots of tilt). But for small tilts, the controls feel far too sensitive. How do game devs flatten/smooth the effects of controls? Do I just take the log of the tilt? Mostly, I want to flatten things in the middle of the range of possible tilts.

sentences:
I can't center my actors with ExtendViewport, Libgdx I'm making a level select screen and I need use ExtendViewPort (I can't use Fit for other reasons), but this viewport moves my actors to the left, I need center them. I put X and Y position corresponding with my virtual screen size. This is my problem:

I do this things:

setViewport(new ExtendViewport(720, 1280));

@Override
public void resize(int width, int height) {
    levelsStage.getViewport().update(width, height, true);
}

actor.setPosition(10,100); (Examples..)

Sry for my bad english, I speak spanish.

sentences: How to have 3d multiple planet gravity in unity c#? Im using unity and I want to make a game where you can walk around small planets and the further away you get, the weaker the gravity, so you can go to other planets. All the tutorials so far only work with one planet, how do I code this? Is there anything I can download that does it for me?

sentences:
What is eigenvalue decomposition and why would it be useful in games? In various math libraries developed for game engines, I see 2x2 and 3x3 square matrices having this function (along with some helper functions). I tried to find information regarding it but did not come across game specific material (wikipedia entry is quite heavy and does not relate to games).

It would be great if in your answer, you could provide an example or two on how it is used in games.

sentences:
MMO Server with C# asynchronous sockets performance I have developed a 2D RPG MMO client / server. The server is developed in C# with asynchronous sockets. It is a pretty simplet implementation. The server gets the client's input / coordinates and broadcasts it to the other players. It is a very alpha stadium so that I only want to test performance to know if this way to go is good.

Now I am living in Germany, I have a static public IP (accessible via the internet) and deployed my game server on a Raspberry Pi 3 (it runs in the command line with C# / Mono). The only database access (write / read) is currently made, when a client connects or disconnects (store / load coordinates).

I made a speed test right now and have the following result:
Download Speed: 100840 kbit/s
Upload Speed: 8973 kbit/s
The Raspberry Pi is connected on a router (Fritz Box) via LAN and the port is set to  bridge mode (because of the public static IP).

Everything runs fine, but I tested it with ony two clients and when one client begins to move, the second client "sees" it maybe 1 second later. The movement is "lag free". But of course, it takes a lot of time until the signal arrives to the other clients.

My question now is, will I have the same issues later, when I rent a server? I really hope that this is what I should expect, when I run my server in my home network. Maybe this question is pretty difficult to answer, because I give you no source code of the server here, but as I said, when the clients get the signal, it is "lag free". The only thing I have is kind of a "delay".

Thanks in advice.

sentences:
Offset during zooming to keep object within boundries I have a simple zoom feature which lets the user zoom in and out. I'm having an issue how ever when i zoom out the object gets smaller to the point that the boundaries become broken.

The idea is the red dot stays inside the circle but the red dot never moves, its stationary in position and size.

This for example is correct because the red dot is inside the circle:

Now if i zoom out and make the circle smaller the red dot ends up outside the circle like so:

The problem i have, is i don't know how to offset the circle to keep the red dot inside of the circle regardless of zooming scale. I have a working example here: http://jsfiddle.net/3wr885so/ if you zoom out you'll find the circle doesn't fix its offset to keep everything in the right place.

The two relevant functions I used for zooming and drawing are below:

Zoom function

function zoomObj(e){
var delta       = e.wheelDelta,
    mousePos    = {};
    mousePos.x  = e.pagex;
    mousePos.y  = e.pageY;
var range = zoom.percentVal * zoom.modifier;
if(delta == 120){         //scroll in
    var endVal = zoom.position + range;
} else {                  //scroll out
    var endVal = zoom.position - range;
}

zoom.position = endVal;
zoom.percent = (zoom.position/zoom.range) * 100;

//need to set offsets to correct for new zoom here
}

Game Loop

function start(){
    var radius = obj.radius/100*zoom.percent;
    if(radius < 0){ radius = 0; }
    ctx.clearRect(0,0,canvas.width,canvas.height);
    ctx.beginPath();
    ctx.arc(camera.offsetX, camera.offsetY, radius ,0,2*Math.PI, false);
    ctx.restore();
    ctx.lineWidth = 1;
    ctx.strokeStyle = 'black';
    ctx.stroke();

    ctx.setTransform(1, 0, 0, 1, 0, 0);
    ctx.beginPath();
    ctx.fillStyle = 'red';
    ctx.fillRect(canvas.width/2-5,canvas.height/2-5,10,10);
    ctx.stroke();

}

Any suggestions how i fix this problem :) ?

sentences: Frustum culling with an octree: one AABB per bone or one AABB per object? I've constructed an octree for use in frustum culling. The question is, should I insert an AABB for each bone of each object, or just the one AABB for the object?

sentences:
What is the code for panning a camera from touch input? (libGDX + scene2d) I would like the user to pan around a game world by dragging their finger on a touch screen - just like Google Maps. I tried a few things but I'm not having much success thus far.

Here is where I'm up to.

public class Game extends ApplicationAdapter {
    Stage stage;

    @Override
    public void create () {

        stage = new Stage(new ScreenViewport());
        Gdx.input.setInputProcessor(stage);

        // Create world
        Planet planet = new Planet();
        stage.addActor(planet);

        stage.addListener(new ActorGestureListener() {

            public void pan(InputEvent event, float x, float y, float deltaX, float deltaY) {
                ((OrthographicCamera)stage.getCamera()).translate(deltaX, deltaY);
                stage.getCamera().update();
            }
        });

    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(Gdx.graphics.getDeltaTime());
        stage.draw();
    }

}

sentences:
Does one need normals for a strictly 2d Game? I'm starting to learn OpenGL by creating a pure 2D game.

I have to decide on the format of the Vertices. Do I need a normal component? Or is this for a 2d component not needed?

My gut feeling says I won't need it since everything is flat. But perhaps I need it for some shader or other thing I don't see yet.

sentences:
(Hitbox) OnTriggerEnter2D only work if enemy is moving (UPTADE) I am developing a 2D Topdown Rpg Game. I have a problem with trigger colliders. I have button which make active an object and ı use it like Hitbox when i press button ı destroy enemy if it is touching hitbox but there is a problem about something. When i press button enemy is destroyed if only enemy is moving when it stop i cant destroy it
How can I fix this?
This is my hitbox's destroy script
 private void OnTriggerEnter2D(Collider2D other)
    {

        if (other.tag == "Enemy")
        {
            Destroy(other.gameObject);
        }
    }
```

sentences:
GLSL shader performance reduced by loop? I hav a fragment shader like this:

#version 330 core

in vec4 v_color;
in vec2 v_texCoords[10];

out vec4 frag_color;

uniform int actual_textures;
uniform sampler2D u_texture[10];

void main() {
    vec4 final_color = texture(u_texture[0], v_texCoords[0]);
    for(int i = 1; i < actual_textures; i++){
        vec4 tex = texture(u_texture[i], v_texCoords[i]);
        final_color = tex * tex.a + final_color * (1 - tex.a);
    }

    frag_color = v_color * final_color;
}

But somehow this slows my game down by 30 - 40fps in comparison to this approach:

#version 330 core

in vec4 v_color;
in vec2 v_texCoords[10];

out vec4 frag_color;

uniform sampler2D u_texture[10];

void main() {
    vec4 final_color = texture(u_texture[0], v_texCoords[0]);
    vec4 tex = texture(u_texture[1], v_texCoords[1]);
    final_color = tex * tex.a + final_color * (1 - tex.a);
    tex = texture(u_texture[2], v_texCoords[2]);
    final_color = tex * tex.a + final_color * (1 - tex.a);
    //...

    frag_color = v_color * final_color;
}

Why does a single loop slow the gpu down so much?

sentences:
Frustum Culling bug in program I did Frustum Culling in my engine, but it does not work correctly. All shown in the video:

Video

If the approximation is too close, the model disappears. On the right in the console you can see that one model is rendered less. With what it can be connected?

Frustum creation code:

bool FrustumCulling::update(ID3D11Device* device, const Camera & view, float angle, float ratio, float _near, float rear)
{
    Vector3 pos = (Vector3)view.getViewPosition();
    Vector3 d = pos - (Vector3)view.getViewDirection();
    d.normalize();
    Vector3 right = (Vector3)view.getViewHeight();
    right = right.cross(d);
    right.normalize();
    Vector3 up = Vector3::cross(d, right);
    // get h and w near and rear planes
    float val = angle * 0.5;
    float tang = (float)tan(val);
    float nh = _near * tang; // near height
    float nw = nh * ratio; // near width
    float rh = rear * tang; // rear height
    float rw = rh * ratio; // near width
    // generate 8 vertex frustum
    Vector3 fc = pos - d * rear;
    Vector3 ftl = fc + up * rh - right * rw; // ftl - Far(rear) Top Left
    Vector3 ftr = fc + up * rh + right * rw;
    Vector3 fbl = fc - up * rh - right * rw;
    Vector3 fbr = fc - up * rh + right * rw;
    Vector3 nc = pos - d * _near;
    Vector3 ntl = nc + up * nh - right * nw;
    Vector3 ntr = nc + up * nh + right * nw;
    Vector3 nbl = nc - up * nh - right * nw;
    Vector3 nbr = nc - up * nh + right * nw;
    // generate 6 planes frustum
    Plane3 p(ntr, ntl, ftl);
    data.planes[TOP] = PlanesFrustum(p.getPlane());

    p = Plane3(nbl, nbr, fbr);
    data.planes[BOTTOM] = PlanesFrustum(p.getPlane());

    p = Plane3(ntl, nbl, fbl);
    data.planes[LEFT] = PlanesFrustum(p.getPlane());

    p = Plane3(nbr, ntr, fbr);
    data.planes[RIGHT] = PlanesFrustum(p.getPlane());

    p = Plane3(ftr, ftl, fbl);
    data.planes[FARP] = PlanesFrustum(p.getPlane());

    p = Plane3(ntl, ntr, nbr);
    data.planes[NEARP] = PlanesFrustum(p.getPlane());
}

Model verification code (cube bbox) to hit frustum:

bool modelCheckFrustum(Vector3 * v)
{
    for(int k = 0;k<8;k++)
    {
        Vector3 p0 = v[k];
        int isFrustum(0);
        for(int l = 0; l<PLANES_SIZE;l++)
        {
            Vector4 n = planes[l].pl; //
            float value = shortDistanseFromPointToPlane(n, p0);
            if(value > 0.f) // point in current plane
                ++isFrustum;
        }
        if (isFrustum == PLANES_SIZE)// point in frusrtum
            return true; // model in frustum
    }
    return false; // model not in frustum
}

PLANES_SIZE - count planes, == 6

planes - array planes frustum

planes - Vector4, when x,y,z - a,b,c, and w - d

Method shortDistanseFromPointToPlane:

float shortDistanseFromPointToPlane(Vector4 p, Vector3 p0)
{
    return p.x*p0.x + p.y*p0.y + p.z*p0.z + p.w;
}

Distance to the front and rear planes:

float SCREEN_DEPTH = 1000.f;
float SCREEN_NEAR = 0.01f;

Creating a matrix of perspectives:

matrixProjection = Matrix::CreatePerspectiveFovLHMatrix(GeneralMath::PI / 4, w / (float)h, SCREEN_NEAR, SCREEN_DEPTH);

w, i - width and height window

How to fix this nasty bug? Thank.

P.S.: I did frustum culing in this lesson.

UPD1:

I created a model frustum, and it shows that not a single BBox vertex got inside the frustum. Now I know the reason, it remains to come up with a solution to this problem :)

Image:

sentences:
Sequencing / triggering messages based on conditions in an adventure game I've been struggling conceptualizing the best way to make a level flow with dialog and help hints changing as you play etc.

Imagine your goal is to make this one screen 'adventure' game, where you leave your house for work, but along the way, you realize you cannot find your keys to leave the house (and drive to work), also the door handle has fallen out of your door again!

Here is the structure of the story as I see it and how I'd break it down for a game. But what data types would you use, and how would you send messages to the dialog classes telling them to display the lines of text in the correct timing and order?

items:
metal bar - floor
door handle - floor
keys - down sofa

bools:
hasFoundKeys
hasFoundDoorHandle
hasFoundBar

dialog flow:
1. "Well I better get to work now."
2. "Oh damn, I can't find my keys." [when trying door]
3. "Ooh whats this" [said when keys found / other items found]
4. "Oh great, the door handle fell out again" [when trying door, but now have keys]
5. "You need that little metal bar thing before the handle works" [trying door before using metal bar on door]
6. "I cant turn that with my bare hands" [trying door without handle but with metal bar in door]

The text at the bottom would be the exact string I'd want to pop up, the timing for each one is described in the [] brackets.

sentences:
How can I reset the mouse axes when respawning a player? I am making a simple parkour game in which the camera will follow the mouse based on the mouse input axis * the sensitivity. This works great, but when I want to reset my character to the start I cant figure out how to reset the mouse axis to zero, thus preventing me from resetting the camera rotation. I have tried Input.ResetInputAxes();, but that seems to only reset the buttons.
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{

    public CharacterController characterController;
    public Transform Player, camera;
    public Camera cam;
    public float XSensitivity, YSensitivity;
    public bool grounded, jumping;
    public float forwardSpeed, horizontalSpeed, jumpPower, gravity, sprintModifier;

    [HideInInspector] public float sideSpeed, lastPlayerPosX, lastPlayerPosZ, jumpSpeed, verticalRotation, horizontalRotation;

    private float isSprinting = 1;

    void Update()
    {
        //This is where I get the axes
        float mouseX = Input.GetAxis("Mouse X"), mouseY = Input.GetAxis("Mouse Y");

        //This is how I rotate the player and camera
        verticalRotation += -mouseY * YSensitivity;
        Player.transform.localRotation = Quaternion.Euler(0, horizontalRotation, 0);
        horizontalRotation += mouseX * XSensitivity;
        cam.transform.localRotation = Quaternion.Euler(verticalRotation, horizontalRotation, 0);

        if (Input.GetMouseButtonDown(0))
        {
            Cursor.lockState = CursorLockMode.Locked;
        }

        float horizontal = Input.GetAxis("Horizontal"), forward = Input.GetAxis("Vertical");

        grounded = characterController.isGrounded;

        if (grounded)
        {
            if (Input.GetKey("left shift"))
            {
                isSprinting = sprintModifier;
            }
            if (Input.GetKey("left shift") == false)
            {
                isSprinting = 1f;
            }
            jumping = false;
            jumpSpeed = 0;
            sideSpeed = .75f;
        }
        else
            jumpSpeed -= (gravity * 25) * Time.deltaTime;

        if (Input.GetKey("space"))
        {
            sideSpeed = .25f;
        }
        if (Input.GetAxisRaw("Jump") != 0 && !jumping)
        {
            jumping = true;
            jumpSpeed = jumpPower;
        }

        lastPlayerPosX = Player.transform.position.x;

        lastPlayerPosZ = Player.transform.position.z;

        Vector3 motion = new Vector3(horizontal * horizontalSpeed * sideSpeed, jumpSpeed, forward * forwardSpeed * isSprinting);
        characterController.Move((Player.transform.rotation * motion) * Time.deltaTime);
    }

    void OnTriggerEnter(Collider col)
    {
        if (col.gameObject.name == "deathbarrier")
        {
            //Resets player to starting position
            Player.transform.position = new Vector3(20.5f, -2, -22.5f);
            //Is supposed to reset all inputs (including mouse)
            Input.ResetInputAxes();
            //Sets camera rotation to 0, but only for one frame before the stored mouse axes change it
            camera.transform.rotation = Quaternion.Euler(0, 0, 0);
        }
    }
}

Thanks for any tips!

sentences:
Is there a way to write a camera class without matrix-transformation? I have a problem with a camera class I got from the internet. It does a transformation like this:

public Matrix get_transformation(GraphicsDevice graphicsDevice)
    {
        _transform =
          Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
                                     Matrix.CreateRotationZ(Rotation) *
                                     Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
                                     Matrix.CreateTranslation(new Vector3(ViewportWidth * 0.5f, ViewportHeight * 0.5f, 0));
        return _transform;
    }

Later the spritebatch is called like this:

spriteBatch.Begin(SpriteSortMode.BackToFront,
                    BlendState.AlphaBlend,
                    null,
                    null,
                    null,
                    null,
                    cam.get_transformation(device));

The problem is that at this point the mouse coordinates are not relative anymore to the other sprites I draw. This is a problem because I try detect which sprite has been clicked. I understand that this issue can be solved by considering the following picture:

This was posted in a very good awnser before, here. But somehow this does not really help me. So my question is:

Is there a way to create a Camera class which does not use transformation, can be moved with keys and keeps the viewport coordinates relative?

Thanks in advance!

sentences:
Animate/Interpolate and wait for completion. I'm implementing a blackjack game in flash and so far the logic is fine but there is no animation for the cards so they just appear and disappear which doesn't look very pleasing to the eye. I want to add some animations for when cards are dealt where they slide across to their position one by one.

Is there a simple way to just tell a displayobject to interpolate from one position to another while waiting for it to complete?

My current thought would be to just do something like this:

on enter frame:
   if a card is animating:
      move it further towards its destination;
      continue;
   else (if it is done animating):
      process as usual;
   end;
end;

I believe this would produce the results I'd expect because the game should only continue after the card being dealt is where it should be. However, this feels like a weird approach and I'm probably over thinking it which is why I'd like to know if any of you have a better solution.

sentences:
Android Swipe In Unity 3D World with AR I am working on an AR application using Unity3D and the Vuforia SDK for Android. The way the application works is a when the designated image(a frame marker in our case) is recognized by the camera, a 3D island is rendered at that spot. Currently I am able to detect when/which objects are touched on the model by raycasting. I also am able to successfully detect a swipe using this code:

if (Input.touchCount > 0)
{
         Touch touch = Input.touches[0];

         switch (touch.phase)
         {
                case TouchPhase.Began:

                    couldBeSwipe = true;

                    startPos = touch.position;

                    startTime = Time.time;

                break;

                case TouchPhase.Moved:

                    if (Mathf.Abs(touch.position.y - startPos.y) > comfortZoneY)
                    {

                        couldBeSwipe = false;

                    }
                    //track points here for raycast if it is swipe
                break;

                case TouchPhase.Stationary:

                    couldBeSwipe = false;

                break;

                case TouchPhase.Ended:

                    float swipeTime = Time.time - startTime;

                    float swipeDist = (touch.position - startPos).magnitude;

                    if (couldBeSwipe && (swipeTime < maxSwipeTime) && (swipeDist > minSwipeDist))
                    {

                        // It's a swiiiiiiiiiiiipe!

                        float swipeDirection = Mathf.Sign(touch.position.y - startPos.y);

                        // Do something here in reaction to the swipe.
                        swipeCounter.IncrementCounter();
                    }

                break;

            }

         touchInfo.SetTouchInfo
          (Time.time-startTime,(touch.position-startPos).magnitude,Mathf.Abs (touch.position.y-startPos.y));
       }

Thanks to andeeeee for the logic. But I want to have some interaction in the 3D world based on the swipe on the screen. I.E. If the user swipes over unoccluded enemies, they die. My first thought was to track all the points in the moved TouchPhase, and then if it is a swipe raycast into all those points and kill any enemy that is hit. Is there a better way to do this? What is the best approach?

Thanks for the help!

sentences:
How should I implement a first-person camera? I'm a beginner programmer and I'm creating a project which allows me to walk around rooms via a first person camera. So far, I have the buildings drawn and  on, but now I'm stuck and don't know how to make a first-person camera to allow me to walk around.

Could anyone point me towards a camera class I could use, or some useful code?

sentences:
Calculating the difference between two numbers using exponential growth I think this is a very basic game programming question, but I am bad with math and new to programming & game programming so I'm looking for some advice. I'm making a 2D sprite game for iOS. Every frame in my game loop I check to see if player moves past a boundary in the game; if so, I scroll the camera's view:

    if playerPosition.x > rightBound {
        let amt = playerPosition.x - rightBound
        camera.position = CGPoint(x: camera.position.x + (amt * 0.1), y: camera.position.y)
    }

This works OK; the camera scrolls slowly when the player exceeds the boundary by a small amount and scrolls more quickly when they exceed the boundary by a larger amount. So the scrolling speed scales up linearly. However, I would like the scrolling speed to scale up faster, perhaps in at a more "exponential" rate. (Enter my terrible understanding of math...)

I don't know the best way to express this mathematically. I know that exponential growth is an actual thing in math, but I actually had to look it up on Wikipedia. And I don't know the best way to implement that in game programming.

To clarify with a simple hypothetical, say that the boundary x position is at 0. When the player moves past it in the first frame his position is 1, so the difference between the two positions is 1. Then next frame his position is 2 so the difference increases to 2, and so on. So the difference between the positions grows like 1, 2, 3, 4, 5, 6, etc. However, I want to calculate the difference between these positions so that my result grows more like 1, 2.1, 3.3, 4.5, 6.1, 7.8, etc.

This graph suggests that I might want to use cubic growth or exponential growth:

But I'm not sure how to express such a formula programmatically. Perhaps more importantly, I don't know if that is the best way to approach this sort of calculation from a game programming perspective. This calculation will run four times every frame, and performance is a concern so I'm trying to find an efficient solution rather than some crufty version I arrive at by myself.

Can anyone provide some advice? I'm working in Swift but I think this is a language-agnostic problem. If you express the answer in another language I can probably figure out how to implement that in Swift.

UPDATE:

Thanks to tom10, I ended up going with this formula for exponentially increasing my camera scrolling speed based on how far the player has passed beyond a boundary:

if playerPosition.x > rightBound {
    let dx = playerPosition.x - rightBound
    let baseAmt = dx * 0.033
    let amt = baseAmt + pow(2, baseAmt * 0.25)
    camera.position = CGPoint(x: camera.position.x + amt, y: camera.position.y)
}

0.033 and 0.25 are "magic numbers" that work well for my game; I arrived at them by trial & error.

sentences:
Why (SDL) animated filled-circle leaves trail of movement? I'm trying to achieve proper animation using SDL. Used flags are SDL_HWSURFACE and SDL_DOUBLEBUF.

That what I'm getting is technically smooth (I think), but I can figure out what should I do to remove that trail?
My animation is time-based (I'm calculating displacement with delta time).

Link to to video: https://vimeo.com/62065078

my (every-frame) drawing function is like:

for(int x = 0; x < screen->w; ++x)
    for(int y = 0; y < screen->h; ++y)
        draw_pixel(screen, x, y, 136, 136, 136);

and ball:

filledCircleColor(screen, ball.x, ball.y, 17, 0x000000ff);

and finally:

SDL_Flip(screen);

main loop is:

for(;;) {
    curr_ts = stopwatch_seconds_elapsed(sw);
    d_time = curr_ts - prev_ts;
    prev_ts = curr_ts;
    cpSpaceStep(space, d_time);
    draw_scene(screen);
}

sentences:
What is the best way to code the XNA gameserver for an FPS game? I'm writing an FPS XNA game. It is going to be multiplayer, so I came up with the following:

I'm making two different assemblies — one for the game logic, and one for drawing it and the game irrelevant stuff (like rocket trails).
The type of the connection is client-server (not peer-to-peer), so every client connects to the server, and then the game begins.
I have decided to use the XNA.Framework.Game class, for the clients to run their game in window (or fullscreen), and the GameComponent/DrawableGameComponent classes, to store the game objects, update, and draw them on each frame.

What should I do on the server side? I got few options:

Create my own Game class on the server, which will process all the game logic, without graphics. I am not using the standard Game class because, when I call Game.Run(), the white window appears and I cant figure out how to get rid of it.
Somehow, use the original XNA Game class, which already has the GameComponent collection and Update event (60 times per second, just what I need).

I have additional questions:

First, what socket mode should I use? TCP or UDP? How do I actually let the client know the order in which packets are meant to be processed?

Second, if I am going to use the exact GameComponent class for the game objects, which are stored and processed on the server, how do I get them to  draw on the client side? Should I inherit them, while they are combined in an assembly), or something else?

sentences:
Why do tutorials use different approaches to OpenGL rendering? http://www.sdltutorials.com/sdl-opengl-tutorial-basics

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/

These two tutorials use completely different approaches to get nearly the same result. The first uses things like glBegin(GL_QUADS). The second one uses stuff like vertexBufferObjects, shaders based on GLEW. But the result is the same: you get basic shapes.

Why do these differences exist?

The first approach seems much easier to understand. What's the advantage of the complicated second approach?

sentences:
Realtime multi-player game design principles for Node.js I've been reading the Valve article on multi-player networking which has been adapted from Yahn Bernier's 2001 paper called Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization. I'm making a realtime multi-player game using a node.js server connected to clients through socket.io and I have a few questions regarding the principles detailed below:

Entity Interpolation

  [Interpolation] prevents the jittery motion this would ordinarily lead
  to by buffering server updates then playing them back with the gaps
  smoothly interpolated between. It can also protect against glitches
  caused by packet loss.

Client-Side Prediction

  Prediction is the notion of the client predicting the effects of the
  local player's actions without waiting for the server to confirm them.
  An entity's predicted state is tested against server commands as they
  arrive until either a match or a mis-match is detected.

Lag Compensation

  Lag compensation is the notion of the server using a player's latency
  to rewind time when processing [user input], in order to see what the
  player saw when the command was sent. In combination with prediction,
  lag compensation can help to combat network latency to the point of
  almost eliminating it from the perspective of an attacker.

Do the principles apply to TCP as they do to UDP and would there be any differences in implementation? I can see that the entity interpolation would not need to protect against packet loss but thats about it.
Can I even communicate between a server and web-browser and vice-versa using UDP and Node.js?
Since the paper is over a decade old are these principles still in use or has other technology appeared?

Any help would be much appreciated.

sentences:
glViewport() Win10 doesn't draw new parts I've been steadily working through building a basic 2D tile framework in python.

I'm trying to use modern openGL so I have a simple shader and some vertex buffers and it's mostly doing what I want so far. I have a Scene with a method for centering the viewport on a Sprite:

def centre_viewport(self, x, y):
    x = -x+self.viewport_width//2
    y = y-self.viewport_height//2
    if x > 0:
        x = 0
    if y < 0:
        y = 0
    if x - self.viewport_width < -self.width:
        x = -self.width + self.viewport_width
    if y + self.viewport_height > self.height:
        y = self.height - self.viewport_height
    self.viewport_x = x
    self.viewport_y = y
    glViewport(x, y, self.viewport_width, self.viewport_height)

self.viewport_width and _height are set when a scene is added to the window, so they have the same dimensions as whatever window is created.

In my test game, the scene width and height are twice the window dimensions of 704x512. Everything works fine on my main mac development machine. On my work windows machine though, when the sprite moves and causes the scene to scroll, the previously hidden parts of the scene are not drawn:

My draw loop is very simple:

def _draw(self):
    glBindBuffer(GL_ARRAY_BUFFER, self.sprite_vertex_buffer)
    glVertexAttribPointer(self.vertices, 3, GL_FLOAT, GL_FALSE, 0, None)

    glBindBuffer(GL_ARRAY_BUFFER, self.sprite_texture_buffer)
    glVertexAttribPointer(self.tex_coords, 2, GL_FLOAT, GL_TRUE, 0, None)

    glDrawArrays(GL_TRIANGLES, 0, self.sprite_vertex_count)

    glBindBuffer(GL_ARRAY_BUFFER, self.tile_vertex_buffer)
    glVertexAttribPointer(self.vertices, 3, GL_FLOAT, GL_FALSE, 0, None)

    glBindBuffer(GL_ARRAY_BUFFER, self.tile_texture_buffer)
    glVertexAttribPointer(self.tex_coords, 2, GL_FLOAT, GL_TRUE, 0, None)

    glDrawArrays(GL_TRIANGLES, 0, self.tile_vertex_count)

and as mentioned, it works fine on my mac.

Is glViewport() the appropriate way to be doing this, and why isn't it working properly on windows?

sentences:
Texture2D can't find my sprite - how to setup the content directory in XNA So I keep getting told that spr_lives can't be found.  I'm working out of a book and using the samples given to me (have not changed the code or folder structure, so it /should/ work) but nothing's working unfortunately.  I know it's a directory issue but I'm unclear on how to remedy it.

Picture of both code and folder structure:

sentences:
Best strategy to track object hierarchy using groups and obj files I am making a 3D game in OpenGL from scratch. In this game I have a ship with stuff inside it. How can I attach the stuff to the ship in the CAD program and maintain that hierarchy in my own game?

For example say I have a fire extinguisher in my ship that mounts on the wall.  There are two approaches both with problems.

Solution 1: Save fire extinguisher and ship as separate obj files.

Problem: How can I place the fire extinguisher in the proper place inside my ship in my game?  With hundreds of objects manually placing them is completely infeasible. I want to arrange stuff in my CAD and load it into the game and be done.

Solution 2: Save fire extinguisher as its own group inside the ship obj file.

Problem: Now I can't reuse the fire extinguisher in other ships. The obj files for game assets will balloon out of control in size with new instances of reused sub-objects.

Is there some way I can specify the position of an external object? A 3d point in my ship obj file representing the origin of another obj model?

sentences:
DX11 application running on Windows XP using only DX9? I'm developing an application that utilizes DX11. I know that DX11 is only available on Windows 7 (and Vista with SP). I wonder if there is some way to run the application on Windows XP and use only the old DX9? I need to prevent the loading of DX11 dlls when on Windows XP. How can this be done?

I've got an old renderer, that runs entirely on DX9 and a new renderer that uses DX11. My idea is to run the old renderer underr Windows XP and load only DX9 dlls, and to run the new renderer on Windows Vista / 7 and load DX11 stuff as well.

I've heard about a LoadLibrary() function that loads libraries at runtime. So far I have my Visual Studio project with all that DX11 .lib files in Additional Dependecies. How should I change this to load it completely at runtime? Do I need to define all symbols in DX11 .dlls manually?

sentences:
References about Game Engine Architecture in AAA Games Last weeks I focused on game engine architecture and learned a lot about different approaches like component based, data driven, and so on. I used them in test applications and understand their intention but none of them looks like the holy grail.

So I wonder how major games in the industry ("AAA Games") solve different architecture problems. But I noticed that there are barely references about game engine architecture out there.

Do you know any resources of game engine architecture of major game titles like Battlefield, Call of Duty, Crysis, Skyrim, and so on? Doesn't matter if it is an article of a game developer or a wiki page or an entire book.

I read this related popular question: Good resources for learning about game architecture? But it is focused on learning books rather than approaches in the industry.

Hopefully the breadth of our community can carry together certain useful informations! Thanks a lot!

Edit: This question is focused but not restricted to first person games.

sentences:
C++ and SDL Trouble Creating a STL Vector of a Game Object I am trying to create a Space Invaders clone using C++ and SDL. The problem I am having is in trying to create Waves of Enemies. I am trying to model this by making my Waves a vector of 8 Enemy objects.

My Enemy constructor takes two arguments, an x and y offset. My Wave constructor also takes two arguments, an x and y offset. What I am trying to do is have my Wave constructor initialize a vector of Enemies, and have each enemy given a different x offset so that they are spaced out appropriately.

Enemy::Enemy(int x, int y)
{
    box.x = x;
    box.y = y;
    box.w = ENEMY_WIDTH;
    box.h = ENEMY_HEIGHT;

    xVel = ENEMY_WIDTH / 2;
}

Wave::Wave(int x, int y)
{
    box.x = x;
    box.y = y;
    box.w = WAVE_WIDTH;
    box.y = WAVE_HEIGHT;

    xVel = (-1)*ENEMY_WIDTH;
    yVel = 0;

    std::vector<Enemy> enemyWave;
    for (int i = 0; i < enemyWave.size(); i++)
    {
        Enemy temp(box.x + ((ENEMY_WIDTH + 16) * i), box.y);
        enemyWave.push_back(temp);
    }
}

I guess what I am asking is if there is a cleaner, more elegant way to do this sort of initialization with vectors, or if this is right at all. Any help is greatly appreciated.

sentences:
How to remove a box2d body when collision happens? I’m still new to java and android programming and I am having so much trouble Removing an object when collision happens.
I looked around the web and found that I should never handle removing BOX2D bodies during collision detection (a contact listener) and I should add my objects to an arraylist and set a variable in the User Data section of the body to delete or not and handle the removing action in an update handler.
So I did this:
First I define two ArrayLists one for the faces and one for the bodies:

ArrayList<Sprite> myFaces = new ArrayList<Sprite>();
ArrayList<Body> myBodies = new ArrayList<Body>();

Then when I create a face and connect that face to its body I add them to their ArrayLists like this:

face = new AnimatedSprite(pX, pY, pWidth, pHeight, this.mBoxFaceTextureRegion);
Body BoxBody = PhysicsFactory.createBoxBody(mPhysicsWorld, face, BodyType.DynamicBody, objectFixtureDef);
mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, BoxBody, true, true));

myFaces.add(face);
myBodies.add(BoxBody);

now I add a contact listener and an update handler in the onloadscene like this:

this.mPhysicsWorld.setContactListener(new ContactListener() {
private AnimatedSprite face2;
@Override
public void beginContact(final Contact pContact) {
}
@Override
public void endContact(final Contact pContact) {
}
@Override
public void preSolve(Contact contact,Manifold oldManifold) {

}
@Override
public void postSolve(Contact contact,ContactImpulse impulse) {
}
});

scene.registerUpdateHandler(new IUpdateHandler() {

@Override
public void reset() { }

@Override
public void onUpdate(final float pSecondsElapsed) {

}
});

My plan is to detect which two bodies collided in the contact listener by checking a variable from the user data section of the body, get their numbers in the array list and finally use the update handler to remove these bodies.

The questions are:
Am I using the arraylist correctly?
How to add a variable to the User Data (the code please).
I tried removing a body in this update handler but it still throws me NullPointerException , so what is the right way to add an update handler and where should I add it.
Any other advices to do this would be great.
Thanks in advance.

sentences:
Removing ads but maintaining opt-in video ads 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!

sentences:
Moving a character according to the animation, rather than code I'm using 3ds Max to export character animations in which my character is moving. I expected this to mean that the character will move in Unity, but it doesn't...

For example, if my animation (in 3ds Max) moves my character forward for a second, from 0,0,0 to 1,0,0, in Unity, the character snaps back to 0,0,0 once the animation ends.

Is there a way to change the position of the character according to the animation, without something like CharacterController.Move?

sentences:
How do I render a filled and stroked path using OpenGL? I want to render a 2-dimensional geometric path consisting of Bézier curves and straight lines. Paths can be concave.

What is the most efficient way to draw this using modern OpenGL? Can I do this with a vertex shader? How should I store the path segments?

sentences: What is the difference between a level designer and an environment artist? What are a level designer's roles in the development of a game, what are an environment artist's, and how do they compare? Are they overlapping roles? Does a game development team typically have both roles?

sentences: What is the different between "LoadSceneMode.Additive" and "LoadSceneMode.Single"? What is the different between LoadSceneMode.Additive and LoadSceneMode.Single? When should I use one, over the other? I read the documentation, but I can't find any good examples of use for a definitive situation.

sentences:
Square tile navigation unity I'm looking to generate a grid style navigation system in Unity. I have created a map in Tiled and am unsure how to continue considering the tiles will have different properties.

The closest example I can think of  would be something akin to the Fire Emblem series of games, in which sprites navigate across the terrain using square tiles.

Any advice on how to achieve this, preferably without paying for a unity asset, would be greatly appreciated. If it helps, I'm hoping to run this on a mobile device.

Here is an example.

sentences:
How to allow character to keep moving after it hits a wall I am developing an iPhone game. There is a fountain that the user should not be able to walk through. Now, this question is about checking circle-point collision or anything like that. I am checking collision with CGRectIntersectsRect(character1.frame, fountain.frame).

But, here is the problem: If I prevent the person from moving; he will never be able to move. So, I tried combatting this with following:

    if (character.center.y > fountain.center.y && CGRectIntersectsRect(character1.frame, fountain.frame) && g == false) {
        g = true;
        character1.center = CGPointMake(character1.center.x, character1.center.y-0.1);
    }
    if (character.center.x > fountain.center.x && CGRectIntersectsRect(character1.frame, fountain.frame)) {
        character1.center = CGPointMake(character1.center.x-0.1, character1.center.y);
    }
    if (character.center.y < fountain.center.y && CGRectIntersectsRect(character1.frame, fountain.frame)) {
        character1.center = CGPointMake(character1.center.x, character1.center.y+0.1);
    }
    if (character.center.x < fountain.center.x && CGRectIntersectsRect(character1.frame, fountain.frame)) {
        character1.center = CGPointMake(character1.center.x+0.1, character1.center.y);
    }

This should check what side the character1 is intersecting the fountain and then make it so it is not intersecting the fountain by incrementing or decrementing the x or y coordinates of the characters it. But, this still gives weird results. It will move it diagonally across the fountain if keep holding down on the the top side of the fountain and also, it will keep moving it left other wise on the top of the fountain.

sentences:
Coroutine only partially executing I have a Coroutine that I use to pull and spawn an enemy in my game. This coroutine works perfectly fine, with the exception of the very first call. I am fairly certain this is because I am probably loading something before it is ready, but I don't know enough to know where.

This is my code (Note the Debug.Log entries). I have removed whatever I think is irrelevant code.

EnemyHandler.cs

public class EnemyHandler : MonoBehaviour
{
public int mob_id;
IEnumerator LoadMob()
{
    Debug.Log("Checkpoint 1");

    WWWForm form = new WWWForm();
    form.AddField("mob_id",mob_id);
    WWW www = new WWW("my-url-here",form);
    yield return www;
    Debug.Log("@@@@@@ Checkpoint 2 @@@@@@");
    string[] webResults = www.text.Split('\t');

    int returncode = int.Parse(webResults[0]);

    switch (returncode)
    {
        case 0:
        //Mob Loaded Successfully
        //Mob variables are set here
        Debug.Log("@@@@@@ Checkpoint 3 @@@@@@");
        break;

        default:
        Debug.Log("Error!");
        break;
    }

}

 public void CallMobLoad(int requested_mob_id)
 {
     mob_id = requested_mob_id;
     StartCoroutine(LoadMob());
     Debug.Log("Coroutine called! Checkpoint 0");
 }
}

2.GameManager.cs (This is my primary class)

public class GameManager : MonoBehaviour
{
    public GameObject spawnManager;
    public static EnemyHandler thisenemy;

    void Start()
    {
     thisenemy = spawnManager.AddComponent<EnemyHandler>();
     thisenemy.CallMobLoad(1);
    }
}

CallMobLoad is called once at Start, and every time a monster dies. It never works when called in Start(), but always works after that.

Furthermore, the first call only calls the first 2 Debug.Logs "Checkpoint 0" and "Checkpoint 1", none of the other checkpoints are hit. Every subsequent call works correctly and hits all checkpoints.

I really want to learn how/why this happens, Any help is greatly appreciated!

EDIT: I have fixed this by turning Start into an IEnumerator, and adding a yield return to thisenemy.CallMobLoad(mobloadtemp);

Still not sure if this is the best way to do this, so please do advise.

sentences:
Collision Detection/Response Issues in Unity Sprite A: Box Collider 2D and Rigidbody 2D.

Sprite B: Box Collider 2D.

Both sprites have a Sprites/Default material with Pixel Snap enabled. The textures being used are set to Truecolor Format and Point Filter Mode. No Mip Maps and 1 Pixels Per Unit (higher PPU seems to make the issue more obvious, but lower value does nothing but scale the problem down).

I put Sprite A above Sprite B, hit play. I see Sprite A fall into Sprite B and hover slightly above it. I think this is horrible, so I look it up. I find I can lower Min Penetration For Penalty to help.. but not fix.. this issue. It's barely noticeable now.

After a while, I noticed Sprite A sometimes overlaps Sprite B briefly during collisions. I can't seem to find a clean fix to either of these issues.

Is Unity's physics engine just not designed for the level of accuracy I'm wanting? It seems the whole way the physics engine works is by allowing overlap (minPenetrationForPenalty) before pushing objects out of each other. I've been coding for many years as a hobbyist, so no professional experience, but this seems.. wrong. Are there options that don't involve overlapping of objects?

Thanks for any and all help.

sentences:
Touch Gesture Map Movement I really dig the way that the map is moved in Clash of Clans (https://itunes.apple.com/ca/app/clash-of-clans/id529479190?mt=8)...

I can recognize the pinch and finger movement needed for the zooming and the swiping around the map, what I'm looking for is a tutorial in any language that reveals how to test for the map going out of bounds when moved or scaled.

My google fu has failed so far on this one, any hints?

Right now I can perform the scale operations and the movement operations, but I can't figure out how to stop the map from going out of bounds when pinched or scaled.  My code is a crazy mess and makes me think I'm missing the fundamental logic of how this is done.

(I am using Starling with AIR, but a tutorial in any language if you have a link).

Update: this is what I'm basing what I have currently so far:
https://github.com/PrimaryFeather/Starling-Framework/blob/master/samples/demo/src/utils/TouchSheet.as

sentences:
Updating an XML Document to Match New Save Data? The Problem

I'm developing a game and using the XmlSerializer to store some user data.

While it isn't an immediate problem, I'm trying to conceptualize what would happen if I needed to update Save Data to a newer version of my game. Since the XmlSerializer reads as a Type, if I update my class with more variables, the save file becomes unreadable.

After doing some research, I discovered the XmlDocument class, which is able to read XML files as that type. This allows the data stored to be arbitrary, allowing me to read and write data accordingly.

What's confusing me is how exactly I would go about this. Is there an easy way to populate an XmlDocument with the Nodes/Elements of a custom class? And how can I detect when data is missing and needs to be added to the XML file?

Example

If you were confused by the question, here's a simple example of what I would like to accomplish:

<FileData version="Original File">
  <foo>14</foo>
</FileData>

Several versions later, I update my class to look like this:

class FileData {
    var foo = 14;
    var bar = 4;
}

Now I need the XML file to look like this before I can use XmlSerializer:

<FileData version="Updated File">
  <foo>14</foo>
  <bar>4</bar>
</FileData>

sentences:
sample project that mix unityscript and c# I like the simplicity of unityscript, at same time I also like the plenty of c# library and open source projects.
I prefer to put my model/controller/logic flow in unityscript using standard unity3d sdk and invoke c# extension library.
Is there any sample project demonstrate how to mix the two scripts in one project?

Your comment welcome

sentences: What is the rule with number of levels? I have been making my first game, I have a number of levels I was thinking of making, around 20-30 but I'm not sure if this is too many. Is there a hard and fast rule for number of levels to include in a game?

sentences:
How can I draw a specific GameObject into a texture in Unity? I need to draw only a few specific objects into a texture (with their material) and then use that RenderTexture as a texture for an another object. I think Graphics.DrawMesh() and Graphics.SetRenderTarget() would be helpful, but I'm not sure.

Ultimately I'm trying to create refractive water, which will refract only specified GameObjects, not layers. How can I do this?

sentences:
Transparency behaviour on PowerVR I'm doing some graphics optimizing tests, especially on PowerVR transparency. Now I made a scene where there are two groups of simple objects. One group has the shape in geometry using diffuse shader and the other with quads using transparency shader. The camera looks through a plane towards a group.

The test was about the "lateness" of PowerVR's Z-tests. And whether or not use better geometry instead of transparencies for e.g leaves or flowers.

The results were not wholly what I expected. The transparency group benefitted from changing the plane from transparent to diffuse by increasing the FPS by 20(expected).

But why is the group without the plane infront so much faster than when the plane is in front?(Not expected) FPS was 38, screenshotting lowered it.

Tests on the geometry group were opposite of what I had learnt in the past few days. There was only 2FPS difference between transparent and diffuse planes. (Not expected). Shouldn't the transparent plane infront cause the whole scene to render as the Z-test is at the bottom of the pipeline?

sentences:
Unity Direct Compute: Setting a struct of arrays The NVIDIA Direct Compute programming guide lists some best practices for memory management on the GPU. One tip they give on page 8 ("Structured Buffers") is to use a 'structure of arrays' (SOA) layout rather than the typical 'array of structures' (AOS) one:

struct Particle {
    float4 position;
    float4 velocity;
};
RWStructuredBuffer<Particle> particles;

vs

struct Particles {
    RWStructuredBuffer<float4> position;
    RWStructuredBuffer<float4> velocity;
};
Particles particles;

(At least, as far as I understand)

AOS layout seems to be the most popular (maybe even only) way to manage lists of stuff in the compute shader.

I haven't found a way to implement SOA from the CPU side, Unity's ComputeShader.cs doesn't have a set struct function or similar. Does Unity expose a way to set SOA structs from the CPU side at all?

sentences:
Dynamic frame rate in Unity I'm developing a 3D visualization tool based on Unity, targeting WebGL. The user rarely interacts with the 3D scene and when he does it's only about adjusting the camera like rotating or zooming the view. I disabled vSync (QualitySettings.vSyncCount) and locked the frame rate to 30 (Application.targetFrameRate) to reduce the CPU usage at least a bit while still having an acceptable level of responsiveness when the user moves the camera around. With 30 fps I get a CPU usage of around 30%. Considering lower-end hardware this seems still too high.
In order to further decrease CPU usage, I introduced two 'modes':

Interactive: runs with 30 fps
Idle: runs with 10 fps

I wrote some lines of code to switch between those modes depending on user interaction. So when an input is detected, the application uses more fps and after a certain amount of time without any interaction, the application uses less fps again. It works pretty well so far: The app uses 30% in interactive mode and 8% to 10% of the CPU while in idle mode.
Setting the idle frame rate to 1, CPU usage is reduced to 1.5% while in idle mode. This is really great. But as expected there's a problem. Basically I locked all the Update() methods to be called only once per second. When the user interacts with the camera, the event will be processed with an expected delay of something around one second.
Now the question: How can I detect user input immediately while having the application run with a low frame rate and also immediately apply a new frame rate (say 30) without any  noticeable delay?
Originally I wanted to have some sort of on-demand rendering. I've read some posts about how people render to a texture to reduce rendering cost in less interactive scenes. But setting the frame rate dynamically seems like a cleaner solution in my opinion. I also tried to use the FixedUpdate() method to check for inputs and switch to interactive mode, but that didn't work either.
Note Also worth mentioning, this approach produces errors in the browser, indicating that the application frame rate should be 0 (not in terms of Unity's target frame rate but as in 'let the browser handle the frame rate'). While this might be a different question it's still related to this topic. Maybe someone has an answer for that as well!

Edit 1
As mentioned in the comments below, Unity provides the callbacks MonoBehaviour.OnApplicationPause and MonoBehaviour.OnApplicationFocus to detect whether the application is about to receive or lose focus.
However, the problem is this: My application nearly never loses focus. While this is a nice additional optimization it doesn't really help me too much. My problem is that the app is idle most of the time while also having focus. It's really just the user staring at the window most of the time.
Just to make some more sense: I'm targeting WebGL. Unity's sole purpose is to visualize some stuff while the user mainly interacts with some HTML controls. In the rare case he wants to interact with the 3D scene, I want to set the frame rate to say 30. The idea is "I don't re-render the scene too often as long as you don't interact".
To emphasize: In my most relevant use case the application never loses focus. This means, the only reliable indicator to determine when to switch between frame rate profiles is based on user input.
Sorry if I wasn't too clear about that :)

Edit 2
I posted this topic on the Unity Feedback Page. If you're interested, check it out and leave a vote. Maybe this request gets enough attention to get supported by the Unity developers.

sentences:
How do I install the Unity Editor on Linux? I have installed Unity trough the Hub but still need the editor. I cannot for the life of me figure out how to do that? I'm running a Ubuntu based Linux system. I already have MonoDevelop installed I just need the darn editor.
I then get greeted with the following popup but nowhere does it give me the chance to install the editor.

sentences: Can't move bone on blender. "Location" transform grayed out I'm trying to move a bone on Blender. I can't do anything with it at all. I've searched through the menus and noticed the Location transform is grayed out.

sentences:
Unity 2D Game: Camera following target and looping stage I'm with a problem and I need some help, because I'm on early learning of gaming and Unity, and i want to learn doing it, so, i need all the help, you developers know how each little help, helps a lot!!

I found the answers of these questions in here, but they don't work properly together or i don't understand it how it works to put it on my code;

I'm building a mobile game and i need the camera to follow the character, i found how to do it, but the thing is: the stage is a 4:3 kinda stage, that repeats again and again and again(well, that's the idea, i still don't know how i do this), but, when the player goes to the groud, the camera is still centered on the character, so it continues following it, but there's no more stage, then nothing appear in there, but i want the camera to doesn't follow the character when it's already on the Y border of the stage. Can someone light me with the google searching with this?

Exactly like this:
https://www.youtube.com/watch?v=ETxoUDWCBvE

And how i can do the stage repeat in a looping? I though in make the scenario move instead of the character then make it loop with a technique i saw in some Flappy bird clone video, but i don't know how the camera would work.

I want to know how i can start doing these.

Thanks.

Ps: Unity 5 ;-;

That's what happen with the camera:

sentences:
Finding out what pixel on the screen the fragment falls on In my 2D game, I render tiles. I want to do lighting without needing an extra buffer the size of the screen.

Either in glsl or hlsl, what could I feed to the shader each time I render a bitmap so that it knows what pixel on the scren it will fall on. That way I can do per pixel lighting.

Currently I only get the UV coord relative to the texture, not the screen.

Thanks

Using ps 2.0

sentences: Geometric Transformations on the CPU vs GPU I've noticed that many 3d programs normally do vector/matrix calculations as well as geometric transformations on the CPU. Has anyone found an advantage in moving these calculations into vertex shaders on the GPU?

sentences:
Should I dedicate a single thread to each player in a split-screen game? I was thinking about making multiplayer version of a game I am making with SDL and OpenGL. It would be a split-screen game.

Do you think it would be a good idea to have each part of the screen (game session) handled by different thread? Those threads would have no data to share except for pause and game over/victory events. Since the single player version is already written, I thought I could save a lot of development time by implementing it this way.

sentences:
Unable to rotate a 2D object, wanting to move it like a ball/wheel I'm using Unity2D.

I have a very basic 2D space with a platform, a ball and 2D physics.

Physics is being applied and ball sits on top of the platform.

However, it will not spin.

Below is the script attached to the ball:

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

public class Circle : MonoBehaviour
{
    private Vector3 screenPoint;
    private Vector3 offset;
    private float speed = 10f;
    public Rigidbody rb;

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

    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

        rb.maxAngularVelocity = 999;
        rb.AddTorque(movement * speed);
    }

    void OnMouseDown()
    {
        offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
    }

    void OnMouseDrag()
    {
        Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
        transform.position = curPosition;
    }
}

The script is attached to the ball, I know this because I'm able to drag it (see OnMouseDown).

I have also tried with other objects such as a rounded-corner square, but I just can't get any spin or torque to be applied.

Below is a screenshot of the inspector on the element.  Circle.cs (the script) is the above pasted script.

Any help appreciated.

sentences:
Cannot create a neutral unit with a trigger I've been playing around with the starcraft UMS (Use map settings) for a while and usually i figure things out pretty quickly when im stuck. Alas not this time.

I'm trying to place a neutral unit (player 12) using a trigger. It refuses to work.
I'm using Scmdraft 2.0 as my editor (but i cant get it to work in other editors either)
(all neutral units placed before the game starts are visible and all other triggers work fine. Also i created a text msg and it does displays it in-game so the trigger triggers )

For testing I created a trigger that looks like this:

Player: neutral (i tried neutral players player 1 and all players as well)
Condition:
-always
Action:
-Create *1 Terran Medic* at '*location 022*' for *Neutral* (also tried neutral players)

When I start the game nothing happens.

Here is what I tried:

I tried placing a start location for neutral player (player 12)
I tried changing the owner under map properties of player 12 to neutral and computer from unused which was the default.

Although it seems like it should be a common enough problem, I don't see it in any FAQ and I cant find anything about it when I Google it.

Thanks in advance.

sentences: What are game save files? I've reached the saving part of my game, as in, you press save and it writes to a text file, but I've noticed that most games and programs out there use custom save formats, like Dwarf Fortress DAT files. What are these? are these just text files formatted for the program, or are they a lower level thing?

sentences: Detect Mouse Enter on An oval shape image in unity I have an image that is attached to a panel and I want to detect On Pointer Enter and exit. The event is working fine but currently, it is working on the full image while I want to detect this event on an inner oval shape. Actual the remaing are of the image is transparent.

sentences:
How to get collision area within a circle in libgdx I have a ball inside of a multi-colored circle, the ball will hit the inner area of the circle like this bellow circle image

And the Circle will be rotated clockwise or anti-clockwise based on user input.
How would I know, where the ball hit the Big Colored circle.

I just need to identify in which color of my circle sprite has made a collision with the ball.

I have tried a lot, googled a lot but still, the solution has not been found yet.

Experts, please help me.

sentences:
Should I use a database to store ~10 000 names in a sports game? I'm working on a single player sports game for a year or so and this doubt came up: how should I treat/store big amounts of data, like player names.
Let's take an arbitrary number as example: 10000 names, 5000 first names and 5000 surnames. These names would be equally divided between 100 countries, which give us 50 first names and 50 surnames per country.
Should I have a local database with these names (or even these countries) considering this data will be needed to generate new players names during the course of the game? Would that introduce limitations, considering I want to make my game moddable by players, as much as possible?
These doubts can be extended to other, more complex game entities, such as:

Players - each one with their own face, attributes, team etc...
Teams - each one with its own crest, kit, squad etc...

In my previous research about that, the SQLite popped up as a seemingly viable solution. It happens that I have almost no experience with DB's (specially in games) and would like to know if this is a good direction before start to study and try to implement it.

sentences:
My sprite is not listening to any keyboard keys First time ever creating html canvas game. Once I finally got my sprite ant tiles drawn on the canvas, now I want to make my sprite interactive. Unfortunately, for some reason it is not working. I get a message in console when the certain key is pressed but the sprite is not changing its position. I wonder why?  The code:

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");

var mapArray = [
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 2, 2, 0],
  [0, 0, 1, 1, 1, 0, 0, 2, 0, 0],
  [0, 0, 1, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
]

var StyleSheet = function(image, width, height) {
  this.image = image;
  this.width = width;
  this.height = height;

  this.draw = function(image, sx, sy, swidth, sheight, x, y, width, height) {
      context.drawImage(image, sx, sy, swidth, sheight,x, y, width, height);
  }
  this.drawimage = function(image, x, y, width, height) {
    context.drawImage(image, x, y, width, height);
  }
}

/* Initial Sprite Position */

var boatPosX = 230;
var boatPosY = 200;

var Loader = function(src) {
  this.image = new Image();
  this.image.src = src;
  this.image.onload = function() {
  var sprite = new StyleSheet(background, 36, 36);
  var ship = new StyleSheet(boat, 90, 100);
  for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {
      if (mapArray[i][j] == 0) {
        sprite.draw(background, 190, 230, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 1) {
        sprite.draw(background, 30, 30, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 2) {
        sprite.draw(background, 200, 20, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
    }
  }
  ship.drawimage(boat, boatPosX, boatPosY, 50, 50);
}
  return this.image;
}

/* Sprite controls */

function move(e) {
  if (e.keyCode == 39) {
    boatPosX += 2;
    console.log("works");
  }
  if (e.keyCode == 37) {
    boatPosX -= 2;
  }
}

  document.onkeydown = move;

var background = new Loader("ground.png");
var boat = new Loader("ship.png");

console.log(background);

sentences:
Why is XmlSerializer adding junk to the end of my file? I'm making a game and I am serializing the save game data. The data is simply a few lists of bools, ints and floats.

But about 50% of the time I get an error when the data tries to save or load that says "There is an error in XML document." The error is always located at the end of the file, even after it has changed size or I have added other variables.

It appears that very last part of the XML data is getting copied twice. The last line of the XML should read:

</LevelStats>

But when an error occurs it often reads

</LevelStats>>

Or

</LevelStats>tats>

Or some other small part of the last line duplicated.

Here is the class I am serializing:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Microsoft.Xna.Framework.Storage;
using System.IO;

namespace Jetpack.Classes
{
    [Serializable]
    public struct LevelStats
    {
        // Player Bests
        public List<float?> fTimeList;
        public List<int?> iScoreList;
        public List<int?> iFuelList;

        // Time
        public List<bool> bBronzeTimeList;
        public List<bool> bSilverTimeList;
        public List<bool> bGoldTimeList;

        // Score
        public List<bool> bBronzeScoreList;
        public List<bool> bSilverScoreList;
        public List<bool> bGoldScoreList;

        // Fuel
        public List<bool> bBronzeFuelList;
        public List<bool> bSilverFuelList;
        public List<bool> bGoldFuelList;

        // Level Complete
        public List<bool> bIsLevelComplete;
    }
}

And here are my methods for saving the loading the data:

region Save & Load Level Stats
    public static void SaveLevelStats(LevelStats levelStats, string filename)
    {
        // Get the path of the save game
        string fullpath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), filename);

        // Open the file, creating it if necessary
        FileStream stream = File.Open(fullpath, FileMode.OpenOrCreate);
        try
        {
            // Convert the object to XML data and put it in the stream
            XmlSerializer serializer = new XmlSerializer(typeof(LevelStats));
            serializer.Serialize(stream, levelStats);
        }
        finally
        {
            // Close the file
            stream.Close();
        }
    }

    public static LevelStats LoadLevelStats(string filename)
    {
        LevelStats levelStats;

        // Get the path of the save game
        string fullpath = System.IO.Path.Combine((Directory.GetCurrentDirectory()), filename);

        // Open the file
        FileStream stream = File.Open(fullpath, FileMode.OpenOrCreate,
        FileAccess.Read);
        try
        {
            // Read the data from the file
            XmlSerializer serializer = new XmlSerializer(typeof(LevelStats));
            levelStats = (LevelStats)serializer.Deserialize(stream);
        }
        finally
        {
            // Close the file
            stream.Close();
        }

        return (levelStats);
    }

    #endregion

Why am I getting the error above?

sentences: How to remove a node from a scene imported with Assimp? I need to remove one object from the scene graph imported by Assimp and I can't.  I've tried to change aiScene.h including a method called DelNode and I can´t. How can I do it - is it possible?

sentences:
How to justify text that appears character-by-character I'm currently using the latest version of phaser framework and I have a problem to which I haven't been able to figure out how to approach.
I need to have a block of text appear letter by letter and also be justified as a block.
(I'm working on a text-based game project).
Text typed letter by letter is functional, but my issue is with justification: it has issues like some words first appearing on a line and then being removed and placed in the next line.
This is my code so far:
    addTextParagraph(text) {
    //  We check the current GAME STATE.
    //  During exploration (SCOUTING_STATE), text is in typewriter mode.
    if (gameState === SCOUTING_STATE) {
      this.typewriteText(text);
    }
  }

  typewriteText(text) {
    let delayedCallback;
    let length = text.length;
    let i = 0;

    this.time.addEvent({
      callback: () => {
        this.textParagraph.text += text[i]
          ++i
        // Callback after typewriter text is complete.
        // Delay before the choices appear in the screen (in ms)
        if (i >= length) {
          i = 0;
          delayedCallback = this.time.delayedCall(200, this.addChoiceArray, [], this);
        }
      },
      repeat: length - 1,
      delay: 40,
    })
  }

Thanks.

sentences:
Rendering voxel data efficiently With Metal, I need to pass in an array of primitives to the GPU to be rendered. I'm making a terrain-based voxel game like Minecraft, but I have a problem.
foring through all of the visible voxels, and in each processing the list of block IDs and Metadata into a list of primitives for rendering is asinine, because I imagine obtaining primitives from raw block data being an expensive process. Surely there's a better way.
Given that you cannot duplicate or cull vertices and planes on the fly on the GPU, doing this in the vertex shader is out of the question. My problem is when or how translate raw block data into a list of primitives ready for the GPU to apply 3D projections to it.
It would definitely be a good idea to maintain the already-processed primitive lists, and only update them when a block updates. However, maintaining these is tricky. Maintaining them one block at a time is very messy, but one voxel at a time would require stitching them together prior to rendering.
This is the foundation of a block sandbox game like Minecraft. Without it I can't progress to gameplay mechanics. My game manages voxel data with a C++ style map, of 3 dimensional arrays of 16 by 16 by 16 4-byte blocks. I simply need to know where, when, and how the process of obtaining primitives from raw block data should take place. How do most games do it?
It's also worth noting that I'm using Metal, a game framework, rather than a game engine, so if game engines generally abstract away this process and therefore this question seems nonsensical, I'm not using a game engine, I'm using a game framework.

sentences:
Actors (Label) not being drawn to stage I have a weird issue that when I try to draw a Stage with only an Actor, a Label to be more precise, added to it and nothing seems to be getting drawn.

This is how my setup goes:

I have a Sprite (player) being drawn and in another class, which is the HUD, that I draw in a separate SpriteBatch, now in the same class I am trying to draw the Stage, I have ensured that the Stage is outside of the HUD's SpriteBatch.begin()/.end() calls and that the Stage is being drawn after, which should be "above" the HUD.
I have also set the position, of the Actor, to be in the middle of the Stage

I just can't seem to get this to work.

This is my code for the Player class:

public void update(SpriteBatch spriteBatch, float delta){
    // *** REMOVED FOR CLARITY ***
    spriteBatch.setProjectionMatrix(camera.combined);
    camera.update();
    hud.render(delta);
}

And this is my code for the HUD class

public void render(float delta){
    spriteBatch.begin();
    spriteBatch.draw(hudBackgroundTexture, position.x, position.y, size.x, size.y);
    // *** REMOVED FOR CLARITY ***
    spriteBatch.end();
    labelLives.setPosition(size.x/2, size.y/2);
    hudStage.act();
    hudStage.draw();
}

I'm not receiving any errors, and I know I have initialised my Stage and Label.

Thanks in advance =]]

sentences: Free physics library? What are some good recommendations?  I have a vertex buffer and indices and I want to be able to detect collision between it and a bounding box or another object.

sentences:
Examples of faking 3D Does anyone know of any good examples of 3D being faked in 2D (not necessarily code, but games I could look up)? The player has the perspective that they are going 'into' the screen and things are coming out at them. At the moment, I'm simply scaling the 2D enemies to give the illusion that they're coming closer, but it still feels quite flat. Are there any tips on how to give it more of a 3D illusion without actually using a 3D engine?

Edit: Just came across the term 'Mode7' and this video which shows pretty much what I'm trying to figure out. (especially the games at 0:13 and 1:03). What's a good way of implementing something like this?

sentences:
glUniformMatrix4fv OpenTK equivalent Very simple and quick question which surprisingly I couldn't find an answer to over the internet: what is the equivalent of glUniformMatrixfv for opentk? I've browsed all the 7 overloads of GL.UniformMatrix4 and none of them seems correct to me and/or I have found any example usage for.

E.g. if I have a

Matrix4[] matrices;

variable (properly initialized etc..) that I want to map on a

mat4 matrices[2];

in glsl, which GL.UniformMatrix4 overload should I use?

P.S. Using OpenTK.Next NuGet package version 1.1.1616.8959

sentences:
How to detect GLSL warnings? After compiling a shader with glCompileShader, I can call glGetShaderiv with GL_COMPILE_STATUS to check if the shader compiled successfully. I can also call glGetShaderInfoLog to get information about possible errors, warnings or other info. The information log returned by this function is unspecified.

In a tool where users can write their own shaders, I would like to print all errors and warnings from the compilation, but nothing if no warnings or errors were found. The problem is that the GL_COMPILE_STATUS returns only false if the compilation failed and true otherwise. If no problems were found, some drivers return empty info log from glGetShaderInfoLog, but some drivers can return something else such as "No errors.", which I do not want to print to the user. How is this problem generally solved?

sentences:
How to make a character sit in Unity? So I've got the animation, it has root motion but activating it in the settings doesn't seem to do much.

What would be a good optimized way to have the character sit on the stool with the animation matching the movement? Would I need to do it through code?And if that's the case, could I specify in which frame do the movement? Or add a second animation that is in charge of Root Motion?

I know either of these two options I give could work but I'm checking to see if there is a better way or if I'm missing something here.

Thanks!

EDIT: Following DMGregory's comment I disabled the collider to see if it improved... it did change, but it isn't much better:

EDIT 2: This is how the animation preview looks like (what I'm expecting)

Then I just hold the last frame while they're sitting and play the animation backwards for when they're getting off - this is just while I get it to work.

sentences:
Running geometry shader only once (Unfortunately couldn't find the answer myself)

Does a neat way to cache the geometry shader results in Direct3D10 or OpenGL exist? (preferably Direct3D10).

I'm building my geometry based on texture sampling and I want to do it only once. So, when the first frame of the scene is rendered, this geometry is build and I want to substitute the geometry building process with simple vertex / index buffer rendering.

I hope this can be achieved without intervening into the non-shader code, but if it doesn't, what should I do? I guess the geometry can somehow be "snapshotted" right before the rasterizing stage, can it?

sentences:
Speed up the DirectX game - how else can I boost the fps with typical triangle drawing? I am writing my own c++/DirectX engine. I've made the basic framework and here comes the time for optimizations.

I don't want to focus on optimizing the resources themselves right now (meshes, textures) or on instancing. I've also commented out shadows and normal mapping for that test. So it's just a "flat" problem of "how to speed up rendering that vertices?".

The meshes are fully static, loaded from files (no terrain generation involved).

I just have about 120.000 triangles with textures on scene (one shader, few models). And on my laptop I get about 20-40fps. I was able to increase fps with vsync and back-face a bit (note that camera is rotating and fps falls when all 120.000 triangles are within its range):

Still, other engines (Unity, Unreal) can render the same meshes faster on the same hardware (and Unreal does it even faster then Unity which still is better then my DirecX11/c++ implementation). How they do that? I know there are many "pro programmers" behind that engines, but they are no magicians. And some solutions should be possible to apply in my engine too (vsync was easy to apply yet it gave me a nice speed boost).

I use DirectX 11, c++. I use Visual Studio if it's important. There is very little logic involved in application, no physics, no searches etc. that could slow down the render loop.

So far I made just few optimizations:

Dynamic/static vertex buffers where they are needed. Index buffer.
Back-face culling.
V-SYNC (more about removing bugs but also helped with fps a bit).
Near/far clipping.
Compressing textures into single texture atlas (I've not done it yet, but I am aware of that technique).
Lowering the AA (e.g. MSAA) and resolution (but it has an big impact on render quality).

I know my hardware is capable of rendering such amount of triangles. But how to help it? My problem is that I don't know all the tricks & methods that can be used here.

If any part of the source code would be useful, just comment me (I'm not sure which parts should I post and I don't want to paste meaningless code listings). I will post the results of fps increase/decrease as I manage to incorporate new optimizations.

sentences:
Unity3d High level literature Is there any high level literature for mid professional programmers for Unity?
There are a lot of tutorials for beginners, but I can't find anything about main API, pipeline or engine architecture. Recommend, please!

sentences:
XNA Guide text input - maximum length so I am using Guide.BeginShowKeyboardInput to get the user to enter their username. I would like this to be limited to 20 characters, and it seems to break expected behaviour to let them input whatever they like and trim it later - so how would I go about limiting what they can input in the text box itself? I have the following code:

public string GetKeyboardInput(string title, string description, string defaultText, int maxLength)
    {
        if (input.CheckCancel())
        {
            useKeyboardResult = false;
            KeyboardResult = null;
        }

        if (KeyboardResult == null && !Guide.IsVisible)
        {
            KeyboardResult = Guide.BeginShowKeyboardInput(PlayerIndex.One, title,
                                                          description, defaultText, null, null);
            useKeyboardResult = true;
        }
        else if (KeyboardResult != null && KeyboardResult.IsCompleted)
        {
            string result = Guide.EndShowKeyboardInput(KeyboardResult);
            KeyboardResult = null;
            if (result == null)
            {
                useKeyboardResult = false;
                return null;
            }

            if (useKeyboardResult)
            {
                KeyboardResult = null;
                return result;
            }
        }
        else //the user is still entering inputs
        {

        }

        return null;
    }

I assume the code I need would go in that final, empty else{} block, but I can't see any way to do this. Does anyone know how?

sentences:
Is there a tool to batch resize images to nearest power of two, on a specific side? For example, i have multiple images with similar properties like width = 66 and height = 62, i would need the resulting image to be 64x60, keeping its ratio. is there any Gimp plugin example, or a simple and fast to use tool that already does this?

My main problem is that the art department guys sometimes save hundreds of textures with the wrong resolution, for example, 1025x1025, which occupy 4 times as much memory as a 1024x1024 image, or or 560x520, which could be scaled down to not use too much memory. I know they should be the ones doing the resizing but at this point, but i would like to quickly correct the error for the sake of the whole team.

I am using Corona SDK, and using OSX Mavericks. A relevant document about image optimization on Corona can be found here. (Nothing we do not know about, basically power of two stuff.)

I have tried ImageMagick before, but right now i already started building my own gimp plugin thanks to the examples provided below, have done 1 gimp plugin before but this will be a new challenge.

sentences:
Python collision problem I have a hero character with jumping physics that I am trying to figure out the collision detection for. Right now, the problem that I am running into is as soon as the character hits the floor (while I'm pressing left on the left side of the screen) the rect that it recognizes that it is colliding with is the ground. Which is to be expected.
However, based on the checks that I have,
for sprite in self.group.sprites():
        wall_collide = sprite.feet.collidelist(self.walls)
        if wall_collide > -1:
            print wall_collide
            if self.col_ground(sprite, wall_collide):
                self.hero.jumping = False
                sprite.move_back_y(dt)
            if self.col_left(sprite, wall_collide):
                sprite.move_back_x(dt)
            if self.col_right(sprite, wall_collide):
                sprite.move_back_x(dt)
            print ""

since the character is colliding with the ground, the check to see if the character's rect is inside the colliding rect fails for 2 reasons:
1: The current collision rect is the ground which the character is above, so the test fails
2: Because of #1, the character will keep moving left until it realizes it's colliding with the left side, at which point it will have already gone too far into the wall.
What's the best collision solution?
Note: the character starts to the right of the left wall, on the ground but isn't colliding with the ground since the start position is right above it. Also, I realize that my code is a bit jumbled and I'm not taking care of every sprite in the group. I'll fix that once I have this fixed.
I can provide more code/pictures if necessary
Edit:
More code
def col_ground(self, sprite, wall):
    if self.walls[wall].collidepoint(sprite.feet.midbottom):
        return True
    return False

def col_left(self, sprite, wall):
    if self.walls[wall].collidepoint(sprite.feet.midleft):
        return True
    return False
def col_right(self, sprite, wall):
    if self.walls[wall].collidepoint(sprite.feet.midright):
    return True
return False

sentences:
How to make a part of an object with navmesh agent rotate separately? I have a game object (a Humvee jeep) and it has a turret gun on top of it.

What i want to do is while the vehicle is moving in a line the turret look at player. I tried rotating the turret gun with "Transform.rotation" and "transform.lookat()" but nothing happened.
Is it possible to move/rotate some part of an object with navmesh separately?

sentences:
LibGDX Headless System.in I started developing a little multiplayer game with LibGDX and Kryonet. I'm also using the headless backend for the server. So far everything went well, but now I'd like to create a command-line parser for the server. I found out that I should make that in a separate thread, so I made a class for that. But the BufferedReader's readLine() method always returns with null (but it doesn't raise any exceptions).
Here is the code I'm using:

public class ServerScreen implements Screen {
    boolean headless;
    Server server;
    CLIParser cliParser = null;

    public ServerScreen(boolean headless) {
        this.headless = headless;
        server = new Server();
        server.start();
        if(headless){
            cliParser = new CLIParser();
            cliParser.start();
        }
        System.out.println("SERVER STARTED");
    }

    //Screen overrides omitted...

    public static class CLIParser implements Runnable{

        public boolean started = false;

        public synchronized void start(){
            if(!started) {
                started = true;
                new Thread(this).start();
            }
        }

        public synchronized void stop(){
            started = false;
        }

        @Override
        public void run() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("cliParser run started");
            while(started){
                String line = null;
                try {
                    line = br.readLine();
                } catch (Exception e){
                    System.out.println(e);
                }
                if(line != null){
                    System.out.println("READ LINE: " + line);
                }
            }
        }
    }
}

The cliParser starts up successfully, but the readLine() always returns null, and doesn't even blocks the code from running. I don't get any exceptions. I tried the CLIParser in a dummy project, and it works fine, so I assume this could be an issue with the headless backend.

Here is the sample code I used:

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class CliParserTester {

    public CliParserTester(){
        CLIParser cp = new CLIParser();
        cp.start();
    }

    public static void main(String[] args) {
        new CliParserTester();
    }

    public class CLIParser implements Runnable{

        public boolean started = false;

        public synchronized void start(){
            if(!started) {
                started = true;
                new Thread(this).start();
            }
        }

        public synchronized void stop(){
            started = false;
        }

        @Override
        public void run() {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            System.out.println(System.in);
            System.out.println("cliParser run started");
            while(started){
                String line = null;
                try {
                    line = br.readLine();
                    System.out.println(line);
                } catch (Exception e){
                    System.out.println(e);
                }
                if(line != null){
                    System.out.println("READ LINE: " + line);
                }
            }
        }
    }

}

sentences:
Maya 2015 Collada mesh transforms not applied I am trying to load a dae (Collada) model into my 3d engine. The problem is they export the vertices and transforms seperately. So in Maya 2015 it looks like this

In the game engine I have it simply read in vertices, normals, etc. It looks like this...

You can tell it loaded the model without any transformations. I would like it so it applies the transformations to the vertices before it exports them to the file. Does anyone know how to do this in Maya. It defaulted like that in maya on my old computer but not on my new one I just built. So now I can't make 3d geometry and load it in the engine.

NOTE: I am also using Assimp to load my models is there possibly a flag that would do this.

sentences:
How can I author objects with perspective that fit into a tile-based map but span multiple tiles? I'm creating a tilemap city and trying to figure out the most efficient way to create unique building scenes. The trick is, I need to maintain a sort of 2D, almost-top-down perspective, which is hard to do with buildings or large objects that span multiple tiles.

I've tried doing three buildings at a time, and mixing and matching the base layer and colors, like this:

This creates a weird overlapping effect, and also doesn't seem that efficient from a production standpoint. But it was the best way to have shadows appear correctly on the neighboring buildings.

I'm wondering if modular buildings would be the way to go? That way I can mix and match any set of buildings together as tiles:

I guess I would have to risk some perspective and shadowing to get the buildings to align correctly.

What sort of authoring process could I use to allow me to create a variety of buildings (or other objects) that maintain this perspective while spanning multiple tiles worth of screen space? Would you recommend creating blank buildings, and then affixing art overlays as necessary to make the buildings unique? Or should they be directly part of the building tile (for example, create a separate tileset of buildings signs and colorings)?

sentences:
How can I render from a buffer that exists and was created on on the GPU? I'm looking for a unity API or function call to allow me to do the following ...

I wrote some really complex functions that are compute shaders. These compute shaders  manage a huge compute buffer containing voxel information. I then take portions of (or the entire) voxel buffer in another compute shader and produce a vertex buffer. All of this is done on the GPU with only compute shader calls from the CPU.

Now I want to render that vertex buffer but I must be looking in the wrong place because I can't find any information on how this is done within unity despite there being other examples on how to do this using raw DX or openGL approaches.

Can anyone point me in the right direction to determine how I can render using a specified shader a buffer already in graphics RAM (and ideally give it some textures too)?

sentences:
Components in a client/server network game? Behavior and logic are executed on the server.  The clients are mostly for rendering, audio, and gathering input.

It looks as though most of the a components architecture benefits are only realized on the server.

Is it still beneficial to design the client with an component based architecture?  Or is there a different approach that better fits a client.

sentences:
How to implement a simple bullet trajectory I searched and searched and although it's a fair simple question, I don't find the proper answer but general ideas (which I already have).

I have a top-down game and I want to implement a gun which shoots bullets that follow a simple path (no physics nor change of trajectory, just go from A to B thing).

a: vector of the position of the gun/player.
b: vector of the mouse position (cross-hair).
w: the vector of the bullet's trajectory.

So, w=b-a. And the position of the bullet = [x=x0+speedtimenormalized w.x , y=y0+speed*time * normalized w.y].

I have the constructor:

public Shot(int shipX, int shipY, int mouseX, int mouseY) {
//I get mouse with Gdx.input.getX()/getY()
...

  this.shotTime = TimeUtils.millis();

  this.posX = shipX;
  this.posY = shipY;

  //I used aVector = aVector.nor() here before but for some reason didn't work
  float tmp = (float) (Math.pow(mouseX-shipX, 2) + Math.pow(mouseY-shipY, 2));
  tmp = (float) Math.sqrt(Math.abs(tmp));

  this.vecX = (mouseX-shipX)/tmp;
  this.vecY = (mouseY-shipY)/tmp;
}

And here I update the position and draw the shot:

public void drawShot(SpriteBatch batch) {
  this.lifeTime = TimeUtils.millis() - this.shotTime;

  //position = positionBefore + v*t
  this.posX = this.posX + this.vecX*this.lifeTime*speed*Gdx.graphics.getDeltaTime();
  this.posY = this.posY + this.vecY*this.lifeTime*speed*Gdx.graphics.getDeltaTime();
...
}

Now, the behavior of the bullet seems very awkward, not going exactly where my mouse is (it's like the mouse is 30px off) and with a random speed. I know I probably need to open the old algebra book from college but I'd like somebody says if I'm in the right direction (or points me to it); if it's a calculation problem, a code problem or both.
Also, is it possible that Gdx.input.getX() gives me non-precise position? Because when I draw the cross-hair it also draws off the cursor position.

Sorry for the long post and sorry if it's a very basic question. Thanks!

sentences:
How to limit the speeding up of enemy movement? Is there a way of limiting my speeding my enemy script every time my player collects 10 points. I have a movement script attached to my enemies and every time my player collects 10 points my enemies get faster. I want to put a limit on that so that the movement script (attached to my enemies) doesn't increase all the time even if the player continue to collect 10 more points and onwards. I want the limit to be 40, so even if the player continues to collect another 10 points the movement should stay at 40.

This is my speeding up my enemies script (this is used in my score script):

if (Score % 10 == 0){
    //Increment movespeed variable  from Movement script
    Movement.movespeed += 4;
}

And this is my movement script attached to my enemies:

public static int movespeed = 20;
public Vector3 userDirection = Vector3.right;

//public float lifetime;

void Start ()
{
    //Destroy (gameObject, lifetime);
}

public void Update()
{
    transform.Translate (userDirection * movespeed * Time.deltaTime);
}

How can I limit the movement speed so that it doesn't exceed the upper limit I want?

sentences:
Mapping a Texture to a 2d Quadrilateral I want to map a 2d picture onto an arbitrary 2d quadrilateral, for the purpose of particle system. To do that, I split the picture into two triangles, and then linearly interpolated  u,v along the triangle edges, using the following code:

struct tlerp {
  double x,i;
  double u,v;
  double ui,vi;
} tlerp;

void tlerp_init(tlerp *l
                      , double first_step, double steps
                      , double sx, double ex
                      , double su, double eu
                      , double sv, double ev) {
  l->i  = (ex - sx) / steps;
  l->ui = (eu - su) / steps;
  l->vi = (ev - sv) / steps;
  l->x = sx + first_step*l->i;
  l->u = su + first_step*l->ui;
  l->v = sv + first_step*l->vi;
}

void tlerp_advance(tlerp *l) {
  l->x += l->i;
  l->u += l->ui;
  l->v += l->vi;
}

But the result is garbled. My guess is that linear interpolation can't be used here, because the space inside quadrilateral is obviously non-linear (on the attached picture it gets more compressed the closer it gets to the top). Is there some way to make it linear again?

As always, I'm not using an OpenGL/DirectX, so can't use any built-in solution.

sentences:
AudioClip is empty saving recording from Microphone EDIT: I updated the code to what I have currently. I'm not sure why but, the editor and my platform complained when I put the WWW in a co-routine, it seems to load the audio clips to the object but I cannot play them. In a script attached to the object I wait until the Audio Clip is loaded before I try to play it.

So I am trying to record some Audio through the microphone and then save an AudioClip to the disk as a .wav file and also save the filepath as a playerpref and then later I can come back and load the string into a url but, for some reason the Audio Clip doesn't get loaded properly as I can see that there is an audio clip on my audio source in runtime but, it has no name and it has no sound on it. However, when I press play in the inspector I can hear my sound

I am using SavWav.cs to save my audio clips to .wav files.

Here is the url(filepath) I am sending to my load method:

string filename = string.Format(@"CapturedAudio{0}_n.wav", Time.time);
string filepath = Path.Combine(Application.dataPath, filename);

Here is the method I am using to get the AudioClip:

private void SpawnObject(string savedNames, Vector3 savedPositions, Quaternion savedRotations)
{

        GameObject cubeToSpawn = Instantiate(cube, savedPositions, savedRotations);
        WWW www = new WWW("file:///"+savedNames);
        cubeToSpawn.GetComponent<AudioSource>().clip = www.GetAudioClip(false, false, AudioType.WAV);

}

The obj is just a cube with an AudioSource attached to it that I instantiate prior to calling this method above.

The filepath works fine for saving but, for some reason it doesn't want to load the audio clip. Any help would be greatly appreciated.

sentences:
How can I make a sprite slow down to the speed of another sprite while following it? I'm making a SpriteKit game where two SpriteNodes are in a maze. That maze is represented as a grid. One sprite (A) travels faster than the other (B). Items randomly pop up, and the sprites have to collect them.

Pathfinding is easy (GKGridGraph is simple to use).

Here's the problem: At any given time, A and B could be on the same stretch of the maze. If A is behind B, I want A to be forced to go the same speed as B (cannot pass through or around). How can I accomplish this?

Thank you for your time!

sentences:
How can I make a sprite based animation using Cocos2d JS? I am learning Cocos2d JS, but I can find very few tutorials and I find the documentation very vague. I can put a simple image on a layer like this:

var sprite = new cc.Sprite(res.my_image_png);
sprite.setAnchorPoint(0.5, 0.5);
sprite.setPosition(cc.winSize.width / 2, cc.winSize.height / 2);
this.addChild(sprite);

I can also move it like this:

var actionTo = cc.moveTo(2.5, cc.p(100, 100).easing(cc.easeInOut(1));

sprite.runAction(
    new cc.Sequence(
        actionTo,
        new cc.CallFunc(
            function() {
                cc.log("Animation complete");
            },
            this
        )
    )
);

How could I improve this code to also show some sprite-based animation? I would like to exchange the sprite image every 0.25 seconds. What is the designed way to do that in Cocos2d JS?

sentences:
Are there multiple valid definitions for what translate, rotate and scale do? Are there multiple valid definitions for what translate, rotate and scale do to the 4x4 matrix?

I bring up this question, because I have a simple webgl program that draws a square and does a few translate, rotate, and scale transformations. When I originally wrote the program I was using glMatrix v0.9.5. I upgraded the glMatrix to v2.2 and now the square is in a different position and rotation.

I'm fairly certain I correctly upgraded the program to use the new version, since the program was so small to begin with.

Regardless of what is happening to my program, I'm very interested to know if translate, rotate, and scale have a single universal definition or if different graphics engines / matrix libraries can have different definitions for what the transforms do.

Further details:

No transformations (origin is at the top left corner)

The square program with the following transformations:

translate   x: 250, y: 250, z: 0

rotate around Z axis   angle: -90

Finally the square program with the following transformations:

translate   x: 250, y: 250, z: 0

rotate around Z axis   angle: -90

translate   x: 150, y: 0, z: 0

sentences:
One framebuffer for each light vs unique framebuffer per light Currently I have two ideas how to implement my lighting system:

1) Use one framebuffer per light source

no need to switch texture attachments of framebuffer
may be faster
bigger memory usage

2) Use one framebuffer for every light source

some time may be wasted on attaching new textures to framebuffer
less memory usage

So could you please tell me which way is better and why? Or I'm totally wrong on my thoughts and there is no difference at all?

sentences:
Directx Compiling shader issue I need to be able to compile a shader ".hlsl, .fx" in my DirectX app but here is the issue I can only specify 6 textures by there default path directory I don't want this I want to be able to set one path for all textures all 50 of them and then compile them and see the shader effect on all textures all 50 of them that's my issue thanks?
I am using DirectX June 2010 and using Direct3D11 and visual studio 2015.

#define NUM_TEXTURES 7
DETAIL_TESSELLATION_TEXTURE_STRUCT DetailTessellationTextures[NUM_TEXTURES +
1] =
{
//    DiffuseMap              NormalHeightMap                 DisplayName,
fHeightScale fBaseTextureRepeat fDensityScale fMeaningfulDifference
{ L"Textures\\rocks.jpg",    L"Textures\\rocks_NM_height.dds",  L"Rocks",
10.0f,       1.0f,              25.0f,        2.0f/255.0f },
{ L"Textures\\stones.bmp",   L"Textures\\stones_NM_height.dds", L"Stones",
5.0f,        1.0f,              10.0f,        5.0f/255.0f },
{ L"Textures\\wall.jpg",     L"Textures\\wall_NM_height.dds",   L"Wall",
8.0f,        1.0f,              7.0f,         7.0f/255.0f },
{ L"Textures\\wood.jpg",     L"Textures\\four_NM_height.dds",   L"Four
shapes", 30.0f,       1.0f,              35.0f,        2.0f/255.0f },
{ L"Textures\\concrete.bmp", L"Textures\\bump_NM_height.dds",   L"Bump",
10.0f,       4.0f,              50.0f,        2.0f/255.0f },
{ L"Textures\\concrete.bmp", L"Textures\\dent_NM_height.dds",   L"Dent",
10.0f,       4.0f,              50.0f,        2.0f/255.0f },
{ L"Textures\\wood.jpg",     L"Textures\\saint_NM_height.dds",  L"Saints" ,
20.0f,       1.0f,              40.0f,        2.0f/255.0f },
{ L"",                       L"",                               L"Custom" ,
5.0f,        1.0f,              10.0f,        2.0f/255.0f },
};
DWORD                               g_dwNumTextures = 0;
ID3D11ShaderResourceView*
g_pDetailTessellationBaseTextureRV[NUM_TEXTURES+1];
ID3D11ShaderResourceView*
g_pDetailTessellationHeightTextureRV[NUM_TEXTURES+1];
ID3D11ShaderResourceView*
g_pDetailTessellationDensityTextureRV[NUM_TEXTURES+1];
ID3D11ShaderResourceView*           g_pLightTextureRV = NULL;
WCHAR
g_pszCustomTextureDiffuseFilename[MAX_PATH] = L"";
WCHAR
g_pszCustomTextureNormalHeightFilename[MAX_PATH] = L"";
DWORD                               g_bRecreateCustomTextureDensityMap  =
false;

sentences:
Implementing material deformation I want to implement deformation of plastic material, like plasticine for example. Where should I start to study? What technique should I use?

Thank you for any advice.

EDIT

I want to use it in real-time in kind of a 3D game, not a physics simulation. When I "push" on the plasticine, it is expected to spill. I want to rotate it or any other actions.

Look at this video: http://www.youtube.com/watch?v=mDbVHEg5qC4

sentences:
Started game development no idea of computer graphics. Should I learn tools or concepts? I am in 6th semester of my Computer science bachelor degree program, Working as Intern in a start up company. I started game development using AndEngine, things are going good because I have good hold on OOP and Java.

But I don't have any experience in OpenGL programming and neither studied a course of computer graphics. I want to develop 3D games and there are tools available like Unity3d etc.

My question is should I master tools or take online lectures of computer graphics to get started on basics. I want to continue game development as my profession. So what should I do? start learning from scratch or Learn already built tools and just dive into development?

I see successful designers with no background of academic study, just did a photoshop course and now they are in the softwarehouse and making websites, sprites etc.

sentences:
How to add a volume bar like YouTube for iOS? I am almost done with my game in Unity 5. However when the player presses Volume Up/Down, the iOS (version) shows the standard UI to show volume. Android has it's own (looks better on Stock).

I want to make my game consistent on either platform and different variations of Android. So I want to recreate how YouTube (for iOS) handles the change in volume.

I can't figure this out. Any help would be awesome!!!

sentences:
Platform game collisions with Block I am trying to create a platform game and doing wrong collision detection with the blocks.

Here's my code

// Variables
GTimer jump = new GTimer(1000);
boolean onground = true;

// The update method
public void update(long elapsedTime){
    MapView.follow(this);
    // Add the gravity
    if (!onground && !jump.active){
        setVelocityY(4);
    }
    // Jumping
    if (isPressed(VK_SPACE) && onground){
        jump.start();
        setVelocityY(-4);
        onground = false;
    }
    if (jump.action(elapsedTime)){
        // jump expired
        jump.stop();
    }
    // Horizontal movement
    setVelocityX(0);
    if (isPressed(VK_LEFT)){
        setVelocityX(-4);
    }
    if (isPressed(VK_RIGHT)){
        setVelocityX(4);
    }
}

// The collision method
public void collision(GObject other){
    if (other instanceof Block){
        // Determine the horizontal distance between centers
        float h_dist = Math.abs((other.getX() + other.getWidth()/2) - (getX() + getWidth()/2));
        // Now the vertical distance
        float v_dist = Math.abs((other.getY() + other.getHeight()/2) - (getY() + getHeight()/2));
        // If h_dist > v_dist horizontal collision else vertical collision
        if (h_dist > v_dist){
            // Are we moving right?
            if (getX()<other.getX()){
                setX(other.getX()-getWidth());
            }
            // Are we moving left?
            else if (getX()>other.getX()){
                setX(other.getX()+other.getWidth());
            }
        } else {
            // Are we moving up?
            if (jump.active){
                jump.stop();
            }
            // We are moving down
            else {
                setY(other.getY()-getHeight());
                setVelocityY(0);
                onground = true;
            }
        }
    }
}

The problem is that the object jumps well but does not fall when moved out of platform. Here's an image describing the problem.

I know I'm not checking underneath the object but I don't know how. The map is a list of objects and should I have to iterate over all the objects???

Thanks

sentences:
Present fails randomly on mixed C++ Direct3D9 app I have a mixed .NET application (managed and unmanaged code bridged by C++/CLI wrappers) which uses unmanaged Direct3D9 9.0c to do rendering inside a control which is wrapped inside a C++/CLI class which extends System.WIndows.Forns.UserControl.

Everything has been working fine for years now, but I recently put another instance of this Direct3D9 control inside a new Windows Form. That is, I have two concurrent instances of the control. I had done that before and it worked, but now I have issues. Perhaps the problem was always there, but because it's related to a race condition, it started happening now...

Ok, the details: When I try to render an image over a texture on the new instance of the control, sometimes it works, sometimes it doesn't. And when it doesn't, nothing is rendered, and from that point onwards, all Present calls fail (I log those failures). If I close the form and open it again, it might work or not. Nasty.

If I use DXGetErrorString and DXGetErrorDescription, all I get is something like:

  EFAILED Undetermined error

Not really helpful... To make matters worse, I can't reproduce the issue in my development environment; I only see it in a production box.

As far as I know, the main reason Present fails like this is a Lost Device. But I implemented the usual scheme to handle that (I can post the code if necessary), and it seems like the device is not being lost... What else can I try?

sentences:
How do i make a list of generic classes? First of all, I want mods in my game, as stated in a previous question, I want to do that via registries. Users make content known to the game in the form of 'Registering' it, then it can be used in several other stuff. Registering a block to have it appear on the terrain is one example.

Registering is done in the form of events, where each registry has an OnEntryCollection event with a list where other classes subscribe to in order to add Entries, and then it gets invoked to gather said entries.

Basically I have a registry system, where there's a large meta-registry(The Game-registry) that has a list of smaller Registry<T> registries, each dedicated to a type (a block, an item, etc). I want to be able to add to these registries via a Registry.Add(T obj) method, but I'm not exactly sure how to do that because in order to store them I had to use an empty interface I made (IRegistry).

This is meant to be a way for me to add Entries in through code, from specific files I parse in, while also allowing modders to add in custom content through registry events I will add later. Nothing is meant to be added in through the inspector, rather registered in through events.

My code:

Game-Registry:

[SerializeField] List<IRegistry> registries = new List<IRegistry>();

Registry :

public class Registry<T> : IRegistry where T : IRegistryEntry {
    Dictionary<ResourceLocation, T> EntryDictionary = new Dictionary<ResourceLocation, T>();

    public delegate void registryAdditionHandler(List<T> entries);
    public event registryAdditionHandler OnRegisterAddEntries;

    ResourceLocation keyName;

    public Registry(ResourceLocation keyName) {
        this.keyName = keyName;
    }

    public void Register(T entry) {
        EntryDictionary.Add(entry.GetRegistryName(), entry);
    }
    public void Remove(ResourceLocation loc) {
        EntryDictionary.Remove(loc);
    }

    public T Get(ResourceLocation key) {
       return EntryDictionary[key];
    }
    public int Count() {
        return EntryDictionary.Count;

    }

    public bool ContainsEntryKey(ResourceLocation key) {
        return EntryDictionary.ContainsKey(key);
    }
    public bool ContainsEntryValue(T value) {
        return EntryDictionary.ContainsValue(value);
    }

    public bool TryGetValue(ResourceLocation key, out T value) {
        if (EntryDictionary.TryGetValue(key,out value)) {
            return true;
        }
        return false;
    }

    public ResourceLocation getRegistryName() {
        return keyName;
    }
}

IRegistry interface:

public interface IRegistry  {
}

sentences:
Custom inventory items based on inheritance So, here's the scenario:
I'm building an RPG. Like most of the other RPGs on the market, my game will feature an inventory and of course, inventory items. So far I've worked well with using a single class for all items, because I did not need anything else than character stat alteration on item usage (consumption). However, I'd like some items to have a more exotic effect. Think of something like when the user consumes a transformation potion, he automatically turns into a beast.

In order to achieve this I've thought about declaring a new class that inherits from BaseItem for each item. Each descendant would override some methods (like void OnConsume()), to change the base behavior.

This works fine, but when it comes to inventory management, I have some issues. The actual inventory will have to work with BaseItem components only (for obvious reasons, as it's an enumerable collection of objects of the same type); casting any descendant to the base class is possible, so no problems in adding items to the inventory. But how can I keep track of the descendant's type (class) for each item in the inventory? And how to perform the descendant's OnConsume from withint he inventory, for each item?

Let me know if you can think of a better solution than mine, or if you can think of a solution to my problem only.

Development is done in C#, inside Unity 3.5.

Thanks!

sentences:
Interaction between entity and tiles In my game, I have a player, ennemies and tiles like Mario. And each entity has a different behavior when it touches a tile. For exemple, when my player walks on spike he dies. But a certain type of ennemy can walk on spike without dying.

Is there a good way to write this interaction between objets in OOP. I mean without cast, without breaking OCP principle and not having to write every behavior in every objects. Is there a design pattern for this purpose ?

sentences:
What component should hold the character movements in ecs and fsm? In the below code, there's a FSM for CharacterState that will be handled also in CharacterSystem. The problem was, I don't know what component should hold movements data to process in CharacterState or CharacterSystem

public class CharacterState implements State<Entity> {
    STANDING,
    WALKING,
    RUNNING,
    IN_PAIN,
    DEAD
}

public enum Movements {
    STAND_STILL,
    MOVE_UP,
    MOVE_DOWN,
    MOVE_LEFT,
    MOVE_RIGHT,
    MOVE_UP_RIGHT,
    MOVE_UP_LEFT,
    MOVE_DOWN_RIGHT,
    MOVE_DOWN_LEFT;
}

CharacterComponent implements Component {
    Movements movement
}

MovementComponent implements Component {
    Movements movement
}

AnimationComponent implements Component {
    IntMap<Animation> map = new IntMap<Animation>();
}

animation.map.put(Movements.MOVE_UP.order, ASSET.CHAR_MOVE_UP);

sentences:
Floodfilling a texture in HLSL Compute shader I have a very large texture which I want to fill with values representing "distance in units from a river tile".
The texture is already seeded with these origin river points (meaning distance/value = 0 in them).
From these points I want to floodfill outwards, incrementing the value with each step from these origin points.
Doing this on the CPU is no problem using a stack or similiar structure but ideally I want to do this in the middle of a Compute shader execution which runs over the entire texture.
I have read this which sound similiar to what I want to do but it mentions there might be a smarter way to do this with Compute shaders - which is what I am using.
Any ideas on how to solve this on compute shaders?

sentences:
How can I stress-test my sever for the game Rust? I am looking to stress test my server for the game Rust and monitor CPU, RAM and FPS. I could not find much around.
I general I think I will need a good amount of compute power, bunch of cloud based VM which generate the load through UDP using some headless client.
Monitoring CPU and RAM should be fairly easy, but how about the in game FPS?
Also I could not find much about Rust clients that could simulate a player.

sentences:
what is the name for the category of game that use a real time clock as the game time like die2nite.com I was looking for more game like http://www.die2nite.com and http://mush.twinoid.com/
They use real time as the fictional time.
Player are given a number of action point they can use freely during a 24 hour cycle.

It was quite common to see these kind of games  10 years ago and would really like to explore some more. Any idea what the category is called and where could I find more game like this. Any more example of such games would be great,

Thanks

sentences: What are the tools required to learn in order to create atari 2600 Games I am a beginner in C++ and i would like to learn how to  create a clone of an Atari 2600 game and using an emulator allow it to run on my current PC. my question is what programming language do i need to know in order to get started, i am aware assembly maybe required but i do not have any background in assembly. so if someone could give me a briefing on the process or point me to the starting point i would appreciate it greatly. i apologize upfront if the question is not constructive.

sentences:
Running multiple box2D world objects on a server I'm creating a multiplayer game using LibGdx (with Box2d) and Kryonet. Since this is the first time I work on multiplayer games, I read a bit about server - client implementations, and it turns out that the server should handle important tasks like collision detection, hits, characters dying etc...

Based on some articles (like the excellent Gabriel Gambetta Fast paced multiplayer series), I also know that the client should work in parallel to avoid the lag while the server responds to commands.

Physics wise, each game will have 2 players, and any projectiles fired.

What I'm thinking of doing is the following:

Create a physics world on the client
When the game is signaled to start, I create the same physics world
on the server (without any rendering obviously).
Whenever the player issues a command (move or fire), I send the
command to the server and immediately start processing it on the
client.
When the server receives the command, it applies it on the
server's world (set velocity etc...)
Each 100ms, the server sends the new state to the client which
corrects what was calculated locally.
Any critical action (hit, death, level up) is calculated only on
the server and sent to the client.

Essentially, I would have a Box2d World object running on the server for each game in progress, in sync with the worlds running on the clients.

The alternative would be to do my own calculations on the server instead of relying on Box2D to do them for me, but I'm trying to avoid that.

My question is:

Is it wise to have, for example, 1000 instances of the World object running and executing steps on the server? Tomcat used around 750 MBytes of memory when trying it without any object added to the world. Anybody tried that before?
If not, is there any alternative? Google did not help me, are there any guidelines to use when you want to have physics on both the client and the server?

Thanks for any help.

sentences:
Rotating, moving and scaling a mask in a shader I want to rotate, move or scale a mask in a shader. But I have no clue to how perform these actions.

My code:

@Override
public void create() {
batch = new SpriteBatch();

background = new Texture(Gdx.files.internal("images/background.png"));
spritebackgournd = new Sprite(background,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());

foreground = new Texture(Gdx.files.internal("images/foreground.png"));
mask = new Texture(Gdx.files.internal("images/mask.png"));

 spriteforegournd = new Sprite(foreground,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());

shader = new ShaderProgram(Gdx.files.internal("shaders/shader1.vert"), Gdx.files.internal("shaders/shader1.frag"));
}

@Override
public void render() {

batch.begin();
spritebackgournd.draw(batch);
 batch.setShader(shader);
    Gdx.graphics.getGL20().glActiveTexture(GL20.GL_TEXTURE0);
    spriteforegournd.getTexture().bind(0);
    //texture.bind(0);
    shader.setUniformi("u_texture", 0);
    Gdx.graphics.getGL20().glActiveTexture(GL20.GL_TEXTURE1);
    //spritemask.getTexture().bind(1);
    mask.bind(1);
    shader.setUniformi("u_mask", 1);
    Gdx.graphics.getGL20().glActiveTexture(GL20.GL_TEXTURE0);
    spriteforegournd.draw(batch);
    batch.end();
    batch.setShader(null);
   }

The vertex shader:

attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;

uniform mat4 u_projTrans;

varying vec2 v_texCoords;

void main() {
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}

The fragment shader:

varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_mask;
uniform mat4 u_projTrans;

void main() {
vec4 texColor = texture2D(u_texture, v_texCoords);
vec4 maskColor = texture2D(u_mask, v_texCoords);

gl_FragColor = texColor * maskColor.a;
}

What I would like to be able to is to scale, rotate and move the mask in the shader. How can I do this?

sentences:
Obj Blender Export Recommendation for OpenGL C++ I have been modelling some objects inside blender, like a light bulb.
I finished the light bulb, and I got a question at the time of export it.

I want to export the light bulb in the wavefront format (.obj), but the light bulb is formed by different meshes, I mean, It's not joined in one mesh. If I export the obj that will be as different meshes inside the .obj

My final question is, for import it in the OpenGL C++ side, it's better to join all the meshes (vertexes) inside one or leave them as separated objects? There will not be any trouble on translating... resizing... etc, if they are not joined?

sentences:
Cannot open a package from the Unity Asset Store website Yesterday I found an asset on the Unity Asset Store website, clicked the button "Open in Unity", and it was opened in Unity.

Today, when I did the same thing, I got the error message below:

I opened the Defaults Apps page in Windows 10 Settings. But what do I do from here?

sentences:
What is the most efficient way of rendering a large number of SDL2 objects? I'm trying to find the most efficient way of rendering a large number of SDL2 objects to the screen.

Each of my objects have their own sprite sheets which are stored as SDL_Texture*.

Currently my render process looks like this:

Update objects.
Clear screen.
Call each objects render function, which calls SDL_RenderCopyEx(...) to render to the screen.
SDL_RenderPresent()

I was thinking I could improve this in one of two ways:
Method 1:

Update objects.
Clear screen.
Call SDL_SetRenderTarget(...) to set render target to a new texture 'X' which had previously been created with a SDL_TEXTUREACCESS_TARGET flag.
Call each objects render function, which calls SDL_RenderCopyEx(...) to render to texture 'X'.
Call SDL_SetRenderTarget(...) to set render target to screen.
Call SDL_RenderCopyEx once more to render texture 'X' to the screen.
SDL_RenderPresent()

Method 2:
Method 2 would require all sprite sheets to be stored as SDL_Surface*.
It would also require a 'global' SDL_Surface 'Y' to memcpy to.

Update objects.
Clear screen.
Call each objects render function, which calls a custom function to memcpy(...) each current obj surface information to surface 'Y'
Use surface 'Y' to create a new texture 'Z'.
Call SDL_RenderCopyEx only once to render texture 'Z' to the screen.
SDL_RenderPresent()

Unsure if any of these methods would make a difference in speed. Was looking for some input on whether it would be a good idea to implement either, or implement something new entirely.

Also, I'm not really looking for any new libraries to use, currently trying to use pure SDL. But if it's impossible to have an efficient rendering system with SDL, I would consider switching.

sentences:
Looking for very simple implicit integration example I am trying to design a robust cloth system. I have no problem at all simulating things like that using forward integration such as euler, midpoint, runge-kutta, verlet, etc. However, I just can't wrap my head around implicit methods.

I don't understand how you formulate the equations in linear algebra terms.
I'd really like to see a VERY simple tutorial, and an actual example of how to construct the equations, and then solve for a very simple system (for example, 3 particles connected by 3 springs).

I looked into David Baraff's Large Steps in Cloth Simulation, and I can kind of follow it, but going from equations to code is a weak spot of mine.

I can use a package like eigen to solve, but I'd also really like to see some code for something like conjugate gradient descent. I don't care about efficiency at the moment, I just want to be able to clearly understand what's going on.

Thanks

sentences:
Designing rules to fight smallpox in Civ-style TBS games TL;DR: How do you design a ruleset for a Civ-style TBS game that prevents city smallpox from being a profitable or viable strategy?

Long version: Civ-style games are pretty great. Bringing a civilization from cradle to grave is a great endeavor, and practicing diplomacy with hard-line human players is fun and challenging. In theory.

In practice, however, many of these games has, especially in multiplayer, exactly one viable strategy: City smallpox, a.k.a. infinite city spread, a.k.a. covering all available space with 1-citizen cities, packed as tight as they will go. I suppose this could count as emergent gameplay, but still; it could hardly be considered to be in the spirit of the class of game.

The Civilization series, of course, is stuck in their more or less fixed rule sets, established with Civilization. Yes, there have been major changes in some respects, but the rules pertaining to city building and maintenance have stayed pretty similar.

So the question, then: If you build a ruleset for a TBS from the ground up; what rules should be in place to prevent Infinite City Sprawl from being a viable strategy?

Or should ICS be a viable strategy?

sentences: iOS gaming with copyrighted characters? Can I use animate characters in an iOS game if I do a citation in the credits. Ex Steven univers in a fighting game and I list Rebecca Sugar in the Credits or by the character bio.

sentences:
Box2d contant speed before and after collision I want to make my body fly at constant speed, how to make it fly at constant speed before and after collision? I set restitution of my body to 1.0 but after some direct and powerful collisions my objects begins to slow, I want it to fly same speed as before. I heard this can be done by setting liner damping of the object, I think it can prevent only from fast flying objects not slow.
 Thanks in advance.

Edit* I can simply modify velocity of the object every frame, is it a solution?

var velocity:b2Vec2=b.GetLinearVelocity();
var speed:Number=velocity.Length();
var ratio:Number=circleSpeed/speed;
velocity.Multiply(ratio);
b.SetLinearVelocity(velocity);

sentences:
Running Unity development build in Android emulator without signing I am working on project with a friend who uses Windows while I am using Ubuntu. We are using Unity collaborate and it's going fine except when we want to build.

The keystore is in his filesystem, D:/Programs -Work/Game Dev/Keystore/user.keystore and I can't replicate his path.

Also, when I try to do a development build and run, it fails because Unity says the apk isn't signed, contrary to this article which says that development builds do not need to be signed.

So this leads to two questions:

Is there any way to build from both devices?
Is there any way to emulate the game on android emulator?

sentences:
Simplify paths when a user builds I am looking for some guidance on how to simplify my nodes on a path when a user builds on the fly.

Imagine a path like this with a gap:

Logically 3 nodes are required 2 connected one isolated.

But now the user builds another inbetween these nodes like this:

You can see the idea is now the nodes have simplified automatically and i only now have 2 nodes on my path.

My question is how would i approach the logic for this so the code can update accordingly? I currently store my path data as an array of nodes which have a property that lists an array of other nodes that link to them. This is what it would look like before the user adds a new tile to the map:

var path    = [];
    path[0] = {'x':1,'y':3,'linksTo':[1],'id':0};
    path[1] = {'x':1,'y':4,'linksTo':[0],'id':1};
    path[2] = {'x':1,'y':1,'linksTo':[3] ,'id':2};
    path[2] = {'x':1,'y':0,'linksTo':[2] ,'id':3};

I use JavaScript - but the language isn't strictly important only the logical approach here.

I should be more clear, the paths can go in 8 compass directions in total the diagonals will be 45 degree angles rather than any other type of shallow angle. But the image just merely shows an example of a path running north to south.

sentences:
What methods do game hacks use to counter anti hack systems? In popular multiplayer first person shooter games, there are often hacks such as Aimbot, Noclip, Speed, and other similar hacks which I know game developers deploy anti hack features to combat, but, wanting to know why some of these hacks are able to get past these systems, I looked up a hack for the game I'm currently playing and they claim to deploy "counter measures" against the anti hack systems.

My question is, when everything happening is being seen by the game server, how can hacks avoid the anti-hack system? Movement that's too fast for example seems impossible to hide. Moving through walls also seems impossible to hide. Finally aimbot is a difficult one, maybe there's no very good solution to detecting it, if the hack developer, for example, purposely makes it imperfect.

My question to game developers is: How can anti hack systems fundamentally detect speed, noclip, and aimbot hacks, and how can hack developers fundamentally deploy counter measures against systems to detect those three types of hacks?

sentences:
How to switch between views in android? I've tried several methods to switch between two views in my program. I've tried creating a new thread then have the view run for 5 seconds before creating intent to start my main activity. This is the code snippet from the said view class:

mHelpThread =  new Thread(){
        @Override
        public void run(){

            try {
                synchronized(this){
                    // Wait given period of time or exit on touch
                    wait(5000);

                }
            }
            catch(InterruptedException ex){
            }

            finish();

            // Run next activity
            Intent intent = new Intent(Intent.ACTION_MAIN, null);
            intent.addCategory(Intent.CATEGORY_HOME);
            startActivity(intent);
            //stop();
        }
    };

    mHelpThread.start();

I can access the said view without error but it doesn't disappear after 5 seconds nor did it switched to main view when I even utilized an onTouchEvent() to detect touch on the screen of which it should have automatically closed.
I've also tried adding a button on the said view to manually switch to main view:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.help);
    final HelpView helpView = this;
    final Button btnback = (Button) findViewById(R.id.back);
    btnback.setOnClickListener(new View.OnClickListener(){
        public void onClick(View v) {
            Intent intent = new Intent(helpView, MainActivity.class);
            startActivity(intent);
        }
    });

}

These codes worked, though, for creating a launcher for my program. So I thought that it would work the same if I added an option for help/rules(for the game) that would switch to another view. I've only since started using eclipse for android so pardon my lack of knowledge. Here is also the snippet from my manifest:

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="MainActivity"
        android:label="@string/title_activity_main">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <intent-filter></intent-filter>
    </activity>
    <activity android:name="SplashScreen"
              android:theme="@style/Theme.Transparent">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity android:name="HelpView"
              android:theme="@style/Theme.Transparent">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <intent-filter></intent-filter>
    </activity>
</application>

sentences:
In Unity, how to get reference of descendant? I'm trying to get descendant game object, not a child. Let's assume that I have a GameObject and it's hierachy looks like this:

Weapon
- Hands
- metarig
  - upper_arm.L
  - upper_arm.R
    - forearm.L.001
      - hand.L.001
        - weapon.L.001
          - AttackDetection(!)
- Sword

I want to access "AttackDetection" from Weapon(Root) in script. But when I try this:

void Start() {
    attackDetectionGObject = this.transform.Find("AttackDetection").gameObject;
}

It fails with this:

  NullReferenceException: Object reference not set to an instance of an object

Looks like transform.Find just looking up it's own child, not descendant. I try to find way to solve this problem, but there's nothing I found.

Any advice will be very very appreciate it.

sentences:
Instantiate a prefab on button press and keep it dragged So far the gameObject is created, but I need to click on the object a second time, in order to start the Drag event. Here's the script where I use the button to spawn a prefab

public void SpawnPrefab(Transform prefab)
{
    clicked = false;
    Vector3 mousePosition, targetPosition;
    mousePosition = Input.mousePosition;
    targetPosition=Camera.main.ScreenToWorldPoint(new Vector3(mousePosition.x,mousePosition.y,distance));
    prefab.position=targetPosition;
    if(isAlreadyClicked == false)
    {
        Instantiate(prefab, prefab.transform.position, prefab.transform.rotation);
        isAlreadyClicked = true;
        Debug.Log(clicked);
    }
}

I call this Drag event from another script inside the spawned gameObject though

void OnMouseDrag()
{
    cursor.setGrab();
    if(this.transform.parent == null || this.transform.parent != null)
    {
        //drag the component
        Vector3 curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
        Vector3 curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
        transform.position = curPosition;
        if(this.gameObject.CompareTag("Component"))
        {
            mainCanvas.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.transform.GetChild(4).gameObject.SetActive(false);
        }
        if(this.gameObject.CompareTag("NewComponent"))
        {
            mainCanvas.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.transform.GetChild(4).gameObject.SetActive(true);
        }
    }
}

Hope it's clear enough. Any ideas?
Thanks in advance!

EDIT:
So I found out that the SpawnPrefab() only works when mouse button is released. Is there any way I can make the buttons work on mouse pressed?

sentences:
How to stop an anmation and a loop in relation to a timer? Phaser javascript I am not ajavascript or phaser expert, I just got stuck with this problem.
I'll try to explain it.
In  this game; is a 21 second timer in all this:  which starts AFTER a beginning 3 second animatiton.

var maxTime = 21; //in SECOND

There is a wheel (station) that spins over and over (loops) and scales up and down:

var init_station_scale = 0.5;
var scale_station = 0.40;

When the game resets the station (wheel) resets

function resetGame(){

station.scale.setTo(init_station_scale);

//station(middle anchor point).

  station = game.add.sprite(750,195,"station");
  station.anchor.setTo(.75,.75);
  station.scale.setTo(init_station_scale);
  station.animations.add("anim"); //Init animations
  station.animations.play("anim",15,true);  //play Animations "anim" with 30fps, loop true

Not to confuse you, but there is a lot going on in this 21 seconds, such as:

//hint  (this is hooked up with the station (wheel)

      hint = game.add.sprite(game.world.centerX+50,game.world.centerY+100,"hint");
  hint.anchor.setTo(0.5);
  hint.animations.add("anim");
  hint.animations.play("anim",15,true);
  hint.visible = false;

Playing a 3 second animation that only plays once at the very beginning of the game (including if game resets);
also starting
.play ("anim",15, true); //(above (station/wheel) code and looping it)

after that 3 second animation;
    console.log("FINISH ANIMATION and ADD TIMER");  TIMER is referring to the 21 second timer

timerEvent = game.time.events.add(Phaser.Timer.SECOND * maxTime,  moveToEndGame, this);  //(also the 21 second timer)

function moveToEndGame(){
  console.log("TIMER END");
  var twn = game.add.tween(bg).to({alpha:0},tween_speed,"Linear",true);
  twn.onComplete.addOnce(function(){flagGameover = true;},this);
}

 if(!flagGameover && !star.visible && idx_bullet < bullet_array.length)
        initBullet();
      else{
        if(flagGameover){
          console.log("GOTO GAMEOVER");
          window.location = "../EndGame.html";
        }
      }
    }

  }

Everything works up until the end of the 21 second timer, but station/wheel keeps spinning creating an 'infinite loop"
So there is nothing to stop the 'loop in the station"  after the 21 second timer finishes.  Coder left out a line that would do that?
Some line of code needs to be added to that last block of code (or somewhere else?)to stop the loop on the station timed with the end of the 21 second timer.  I think????

Or  some kind of javascript kill switch:  i.e. stop all javascript then go to endgame.html

Anyone know the answer?

sentences:
Understanding how texCUBE works and writing cubemaps properly into a cube rendertarget My goal is to create accurate reflections, sampled from a dynamic cubemap, for specific 3d objects (mostly lights) in XNA 4.0.

To sample the cubemap I compute the 3d reflection vector in a classic way:

    half3 ReflectionVec = reflect(-directionToCamera, Normal.rgb);

I then use the vector to get the actual reflected color:

    half3 ReflectionCol = texCUBElod(ReflectionSampler, float4(ReflectionVec, 0));

The cubemap I am sampling from is a RenderTarget with 6 flat faces.

So my question is, given the 3d world position of an arbitrary 3d object, how can I make sure that I get accurate reflections of this object, when I re-render the cubemap. Should I build the ViewProjection matrix in a specific way? Or is there any other approach?

sentences:
Is multipass rendering possible with SpriteBatch? I'm trying to implement a bloom effect. This requires three shader passes: a brightness threshold, a horizontal blur, and a vertical blur. It also requires resizes, but these are irrelevant to the question. I've also omitted the threshold, as the problem lies in the blurs.

Now, I've read that HLSL passes are just syntactic sugar for different shaders, and that switching between them is about as expensive as setting a new effect to the GraphicsDevice. Still, I prefer to keep them in one .fx file.

The passes:

    pass Pass0
    {
        PixelShader = compile ps_2_0 PS_Threshold();
    }
    pass Pass1
    {
        PixelShader = compile ps_2_0 PS_BlurHorizontal();
    }
    pass Pass2
    {
        PixelShader = compile ps_2_0 PS_BlurVertical();
    }

The blurring code:

        private void Blur(SpriteBatch SpriteBatch, RenderTarget2D Source, RenderTarget2D Rendertarget1, RenderTarget2D Destination)
        {
            // Blur pass 1
            Contents.BloomEffect.CurrentTechnique.Passes["Pass1"].Apply();
            SpriteBatch.GraphicsDevice.SetRenderTarget(Rendertarget1);
            SpriteBatch.GraphicsDevice.Clear(Color.Black);
            SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, Contents.BloomEffect);
            SpriteBatch.Draw(Source, Rendertarget1.Bounds, Color.White);
            SpriteBatch.End();

            // Blur pass 2
            Contents.BloomEffect.CurrentTechnique.Passes["Pass2"].Apply();
            SpriteBatch.GraphicsDevice.SetRenderTarget(Destination);
            SpriteBatch.GraphicsDevice.Clear(Color.Black);
            SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, Contents.BloomEffect);
            SpriteBatch.Draw(Rendertarget1, Destination.Bounds, Color.White);
            SpriteBatch.End();
        }

Finally, the Draw loop:

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.SetRenderTarget(RT1);
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, bloom);
            spriteBatch.Draw(android,
                             new Rectangle(0, 0, 258, 294),
                             Color.White);
            spriteBatch.End();

            Blur(spriteBatch, RT1, RT11, RT1);

            GraphicsDevice.SetRenderTarget(null);
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null);
            spriteBatch.Draw(RT1,
                RT1.Bounds,
                Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }

The output, however, is as follows:

It's obvious what happens: the last pass is applied twice. I've tested the passes individually by snipping them out of the shader, and they work fine. Is EffectPass.Apply() simply not meant to be used with SpriteBatch, or is there another way to change what passes are applied (without putting the passes in different .fx files)?

This has all been in XNA. To make this even weirder, when I do the same thing in Monogame the opposite occurs: the shader will only use Pass0. However, I'm converting the shader to OpenGL there, so that might be a conversion quirk.

EDIT: I fixed this by putting the different passes in different techniques, and switching techniques instead of passes. That doesn't answer the original question though, so I'll leave it open.

sentences:
WaitForSeconds isn't working I have a class which is changing the player speed. Here is the code:

using UnityEngine;
using System.Collections;

public class MultiplySpeed : MonoBehaviour {
    public int multiplier = 2;
    public Controls player;
    bool flag = false;
    void OnTriggerExit(Collider c){
        if(c.tag == "Player"){
            player = c.gameObject.GetComponent<Controls>();
            if(!flag){
                multiplySpeed();
                StartCoroutine(powerUp());
            }
            flag = true;
        }
    }
    public IEnumerator powerUp(){
        yield return new WaitForSeconds(10);
        backToNormal ();
        StopCoroutine(powerUp ());
    }
    public void multiplySpeed(){
        player.speed = player.speed * multiplier;
    }
    public void backToNormal(){
        player.speed = player.speed/ multiplier;
    }
}

I have two problems, the first one is that after starting the coroutine and the flag varaible is set to true, the method OnTriggerExit is called once again, and the flag is false and everything is executed again. The second problem is that the method backToNormal seems like it's never executed, it simply multiplies the speed and never take it back to normal.

Any help is appreciated.

sentences:
Sprite Body can not stop Hey i have issue regarding jump sprite body. In my code i am using moveLeft and moveRight Button and when i am press moveRight Button using following code

if (moveRight.active==YES)
    {
            b2Vec2 force=b2Vec2(4,0);
            ballBody->SetLinearVelocity(force);
    }

Its move perfectly and When i release this Button than sprite body stop using following code

else
{
      b2Vec2 force=b2Vec2(0,0);
      ballBody->SetLinearVelocity(force);
}

But when i put this else part then jump can not done. My jump code is following

if (jumpSprite.active==YES)
                {
                    NSLog(@"Jump Sprite");
                    b2Vec2 locationWorld;
                    locationWorld=b2Vec2(0.0f,4.0f);
                    double force=ballBody->GetMass();
                    ballBody->ApplyLinearImpulse(force*locationWorld, ballBody->GetWorldCenter());
                }

If i remove else part then jump will perform complete but sprite body can not stop after release button.

So what to do??

Thanks in advance

sentences:
Some help understanding and modifying a 2D shader I have a similar question as the one posed here, except that I don't wish to use a 1D Color Palette.

I simply wish to have it display 1 color of my choosing (red, for example).  I plan to use this as a "shield" effect for a 2D ship.

I also wish to understand how it works a little bit better, as I'll be the first to admit that shaders in general are not my strongest suit.  I'm not asking for an overview of HLSL (as that is too broad of a subject), just an explanation of how this shader works, and the best way to implement it in a 2D game.

Code examples would be ideal (even if they are theoretical) but if the answer is explained well enough, I might be able to manage with plain old text.

This is also in XNA 4.0.

Thanks in advance.

sentences:
What scaling system to use in Box2d? I'm worried about this Caution box from the Box2d manual:

  Box2D is tuned for MKS units. Keep the size of moving objects roughly between 0.1 and 10 meters. You'll need to use some scaling system when you render your environment and actors. The Box2D testbed does this by using an OpenGL viewport transform. DO NOT USE PIXELS.

I don't want to use OpenGL since I know nothing about it. I'm using SFML to render my game.

sentences:
Receiving user commands in a text based console game I'm working on a little text based console game for a bit of fun and am starting work on the user commands entered into the console.

Are there some good design patterns for deciding what to do with the commands the user enters into the console window?

My thoughts so far:

I've createed a basic query structure for obtaining the command and it's arguments. It works kinda as follows (the code is C#):

var userCommand = _getUserInputQuery.Invoke(new GetUserInputRequest
                                                {
                                                  FullCommandText = Console.ReadLine()
                                                });

I now have two items available to me in the userCommand. Firstly I have the name of the command as a string userCommand.UserCommand and secondly I have a string array of arguments userCommand.UserCommandArgs.

I figure there's a couple of ways I can now proceed with the information I have.

The most basic form could be a simple switch/if on the command name and invoke the relevant class/method required (seems a bit icky though).

I also figured given a generic interface for all commands IUserInputCommand I could create the class required using reflection and fire off a generic Invoke method from the interface. (Although I'm not sure how useful this will be given that some command invokations will require different data than others).

What are some design patterns already available for solving this kind of problem? What would you do personally?

sentences:
Rent-a-Coder style site for artists My Google-fu is failing me: is there a site in the same vein as Rent a Coder, but for hiring artists?  In particular, I'm looking for a site which fits the following criteria:

Allows me to specify the style and scope of the work I'm looking for beforehand
Allows artists to "bid" on the project, including time and cost estimates
Showcases the work of the bidding artists so that I can see what kind of quality I can expect from each bidder
Is designed specifically for smaller, short-term projects or one-off graphics

It seems that the original incarnation of Rent a Coder is dead (the above seems to be some sort of knockoff), and that it was probably killed by an unsustainable market full of unrealistically low bids for large projects by unskilled and unqualified "coders."  That being the case, such a site might be poorly suited to art as well.

The reason I'd like such a site, though, is that as a "bedroom programmer" with a small budget and little experience in this sort of thing, I have no idea where I should be looking for art or how much I should reasonably expect to pay.  Thus, a site with good competition where market prices are somewhat transparent would be ideal.

Any other suggestions about how best to acquire custom artwork as an indie developer are also appreciated.

sentences:
Opengl-es picking object I saw a lot of picking code opengl-es, but nothing worked. Can someone give me what am I missing?

My code is (from tutorials/forums)

Vec3 far  = Camera.getPosition();
Vec3 near = Shared.opengl().getPickingRay(ev.getX(), ev.getY(), 0);

Vec3 direction = far.sub(near);
direction.normalize();

Log.e("direction", direction.x+" "+direction.y+" "+direction.z);

Ray mouseRay = new Ray(near, direction);

for (int n=0; n<ObjectFactory.objects.size(); n++) {
    if (ObjectFactory.objects.get(n)!=null) {
        IObject obj = ObjectFactory.objects.get(n);

         float discriminant, b;
         float radius=0.1f;

         b = -mouseRay.getOrigin().dot(mouseRay.getDirection());
         discriminant = b * b - mouseRay.getOrigin().dot(mouseRay.getOrigin()) + radius*radius;

         discriminant = FloatMath.sqrt(discriminant);

         double x1 = b - discriminant;
         double x2 = b + discriminant;

         Log.e("asd", obj.getName() + " "+discriminant+"   "+x1+" "+x2);
    }
}

my camera vectors:

//cam
Vec3 position   =new Vec3(-obj.getPosX()+x, obj.getPosZ()-0.3f, obj.getPosY()+z);
Vec3 direction  =new Vec3(-obj.getPosX(),   obj.getPosZ(), obj.getPosY());
Vec3 up         =new Vec3(0.0f, -1.0f, 0.0f);
Camera.set(position, direction, up);

and my picking code:

public Vec3 getPickingRay(float mouseX, float mouseY, float mouseZ) {

    int[] viewport      = getViewport();
    float[] modelview   = getModelView();
    float[] projection  = getProjection();

    float winX, winY;
    float[] position    = new float[4];

    winX = (float)mouseX;
    winY = (float)Shared.screen.width - (float)mouseY;

    GLU.gluUnProject(winX, winY, mouseZ, modelview, 0, projection, 0, viewport, 0, position, 0);

    return new Vec3(position[0], position[1], position[2]);
}

My camera moving all the time in 3d space. and my actors/modells moving too. my camera is following one actor/modell and the user can move the camera on a circle on this model.

How can I change the above code to working?

sentences:
Attach simple, portable 2D graphics for a c++ game I have a game written in C++ (using STL and c++11 extensively).

I would like to do the following things:

Attach graphics to this game -> Think chessboard of some kind. I just need some pictures and simple status bars, no movement necessary, even though it would be nice I guess. It's a turn based game.
Port the game across Windows / Android / iOS

So, all in all, I need a tool that would provide a portable, simple, 2D graphical interface. A tool that would allow me to "bind" my c++ code to portable graphical representation.

How would I go about making this idea come true?

sentences: What is the delta value passed to the Screen's render method? The delta value given to the render method in the Screen class is a non-constant number. What is it? Where does it come from? Does it differ by screen size?

sentences:
How can I implement Objective-C libraries in Unity? I've been a "hardcore" developer for sometime now, as I've always worked with pure code reactive rendering, and contributed to Cocos2d library some time ago , (It is the one I used for my games) . But I've come to realize that most of the work I'm doing by setting up my game environment , user interface and everything else is becoming a bit repetitive, and complicated, as position must be tested each build , debugging sometimes involves exploring the deep down framework and I've decided to try out a full game development environment.

Some friends have recommended me Unity for mobile development (If you could give me any better advice I'd be grateful) but my main concern is my custom libraries I built on Objective C for multiplayer real time connectivity, it's probably thousands of lines and I wouldn't like to write them all over again.

Is there any way I could invoke my objective-c library in Unity ?

I know it's probably a vague question but can't seem to find where to start! Any guidance will be highly appreciated!

sentences:
What is a good way of handling shaders? I'm currently reading this book and are at the chapter about the rendering subsystem of a game engine.

Now, the book suggests that a material is a structure that provides information on how to shade a mesh. So the material contains visual properties and also what information to send to the shader prior to rendering.

My question is: What is a good tructure/syntax of such a material model?

My current ideas are that the material holds info such as specularity, diffuse colors, textures and so on. The (to me) tricky part comes when a shader needs multiple render passes.

A simple material could be something a long the lines of:

Transform info:
ModelMatrix : get_from_model
ViewMAtrix: get_from_camera
ProjectionMatrix: get_from_camera

Textures:
diffuse: get_from_file
normalmap: get_from_file
glossmap: get_from_file

Lighting:
direction: get_from_somewhere
.
.
.

But for instance, if I want to render the reflection of a mirror,  need a good way to tell the engine that I want to render the scene with the camera flipped in the mirror plane, and perhaps with a lower LOD. Is there a well know good way to encode this in the interface between user-data and the shader program?

Also, in general, are there well proven methods for mapping in-game data to shaders without too much manual instruction on where to find the data?

Thanks in advance : )

sentences:
Is it possible to push real-world, real-time data into Unity? I'm pretty new to this, and I'm having trouble figuring out where to even look.  If there's relevant terminology that'll be google-able, that would be a great help.

Suppose I want to have a monitor in-game that displays the output from a camera that's in the same room as the player.  Are there libraries for grabbing and rendering that data?

sentences:
How to build bullet (hit) damage detection in Augmented Reality to a real life person acting as an opponent? I am building an Android AR game using ARcore 1.18 in Unity 2019.4.5f1 (LTS). Now I want to create something like bullet damage detection just like it is built in a normal Unity 3D game.
Of course, the biggest problem is how can I even detect the real person's hitbox like it is done in a normal game? I need to somehow be able to attach the bullet damage script to the body of the real-life person in real-time.
Has anyone tried this before? How can we achieve this? I understand if I might not get a spoonfed tutorial but some help towards what should I be doing to achieve this will be greatly appreciated.
I see some other FPS Augmented Reality games which either uses Laser Tag (Father.io) or Barcodes to scan the opponents. These are definitely some great ideas to create an FPS game experience but still, if possible, I want to try it with just the mobile camera without any external support. I am ready to bear some accuracy loss :)

sentences:
An algorithm to make one object follow another on a 2D grid I am using Greenfoot, but this can apply to pretty much any 2D engine.

So my question is a basic one that I somehow couldn't find an answer to already. Basically, if I have an enemy and the player, how can I make the enemy follow them? The player can move in all 4 directions, and the enemy can move in any direction, whichever one is faster. It would be done using a method that accepts an integer for speed, and an in-game object to move towards (an Actor in Greenfoot). It shouldn't simply teleport there but move closer by however much the value for speed is. And this would have to be done without rotating the image of the enemy.

This is in Java but if the answer you provide is in pseudo-code or a similar language (such as c++ or c#) I can still use it.

sentences:
Trying to use yield to wait for a few seconds to avoid the sounds from Interfering with each other Ok so when my player hits a wall (Enemy tag). My player is destroyed after a certain amount of time. During this time, I disabled the mesh renderer on impact so it "appears" as if the player is destroyed.

I have some sounds I want to play upon impact. One is 'game over" sound and one is an "explosion sound".

right now, when they play at the same time, they interfere with each other, causing the game over not to be heard correctly.

I wanted to delay the output of "game over" by 3 seconds. So the explosion is over. Play the 'Game over sound' and then destroy the player.

This is my code so far, but the compiler tells me that now OnTriggerEnter cannot be an iterator block now that I have a yield function. Is there any way to just delay the output of the game over sound without creating a whole new function for the game over sound and using Play Delayed?

and if I do have to use Play delayed, how do I set the volume of the sound? as right now I am using PlayOneShot

     // function to detect whether collision is with a pick-up cube or an emeny wall.
void OnTriggerEnter(Collider other)
{
    if (other.gameObject.CompareTag("PickUp"))
    {
        // if pick-up object. Pick it up!
        float vol = Random.Range(volLowRange, volHighRange);
        playerSource.PlayOneShot(coinSound, vol);
        other.gameObject.SetActive(false);// other.gameObject should destroy here by the way.
        getCount = GameObject.FindGameObjectsWithTag("PickUp");
        count = getCount.Length;
        countCollected = countCollected + 1;
        SetCountText();
        if (count < 10)
        {
            // spawns new pick-up objects
            Invoke("SpawnObject", 2.0f);
        }
    }
    if (other.gameObject.tag == "Enemy")
    {
        // if enemy wall... kill the player it is game over
        rend.enabled = false;
        float vol = Random.Range(volLowRange, volHighRange);
        playerSource.PlayOneShot(deathSound, voldeath);
        playerSource.PlayOneShot(explosion, volex);
        yield return new WaitForSeconds (3);
        playerSource.PlayOneShot(gameOver, volgo);
        deathText.text = "GAME OVER!";
        Destroy(Player.gameObject, deathTime);
    }
}

Note: before the addition of yield the code runs perfectly and does everything I want it to.

Thanks for any help you can provide

sentences: Using blend trees for a simple 2d character Let me start by saying that I'm not a animator and basically have no idea what I'm talking about. The character in the game has 3 states : indle(looks at camera) walk left and walk right. I've set up the transitions for all states but now I want to know how to blend from the idle state to each one of the walking states. This is how my animator looks like :

sentences:
Component systems: No inheritance hierarchy at all, or a basic one? (I asked a similar question, but it had more questions inside it and I feel it wasn't clear enough, so I'm opening a new one).

Until recently I implemented all my games using an inheritance hierarchy. Those were simple games.

For example:

          Entity
          /    \
      Movable  Static
      /  \        /  \
    Orc  Mage   Tree  Wall

This worked for simple games.

However recently I read about 'entity component systems'. Using this approach, a class doesn't inherit from another class in order to receive functionality. Instead it is composed with it, which allows for more flexible designs.

My question is this:

I know that each component is a class (derived from a common base class).

However, there is one thing I don't understand: In the 'component system' approach, is there one class that all entities are instances of - and the only difference between entities is the components they contain?

For example: There is a class Entity. All entities in the game are instances of this class.

The only differences between them is that they are composed with different Component objects.

For example:

Component aiComponent = new AIComponent();
Component movementComponent = new MovementComponent();
Component physicsComponent = new PhysicsComponent();
Component rangedAttackComponent = new RangedAttackComponent();

Entity orc = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(movementComponent);
orc.addComponent(physicsComponent);

Entity shootingCastle = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(rangedAttackComponent);
orc.addComponent(physicsComponent);

As you can see, both orc and shootingCastle are instances of the Entity class. But they are composed with different components.

Is this how 'entity component systems' are supposed to be? No inheritance hierarchy at all? Or is there still a basic inheritance hierarchy, but most of the logic is inside components?

sentences:
Calculation of distance while switching between two speeds There are two speed values, that are used by moving object. After a while speed switching occurs from V1 to V2. I need the formula that can be used for calculation of current distance (at specified time).

Input variable:

T - Current time

Constants:

V1 - first speed
V2 - second speed
Ts - switching time between V1 and V2
P - switching power

Output variable:

S = ?

I tried to use next formula:
S = Lerp[Clamp(T / Ts, 0, 1) ^ P), V1, V2] * T

But in this case the moving object will be returned back after time and moves forward again.

Probably acceleration should be used in the formula?

sentences: SDL zooming/upscaling without images becoming blurry? I'm working on a game with 32px tiles and I have one question regarding this and scaling. When I try to see my game fullscreen my image just becomes blurry. I remember playing NES games and when the image was scaled you just saw pixels as big blocks but they were still as crisp as when they were small, so I'm wondering how I can do this in SDL.

sentences: Google Sketchup pro exporter/importer for MD5 model format? Where can I find google sketchup pro MD5 (The doom3 model format) exporter/importer? If there isn't one what modeling program can I use to export/import MD5 models?

sentences:
Smooth decelerate, interpolation? I have two points A and B.  I want to perform a smooth deceleration from A stopping at B over time t.  The only thing I managed to do so far was a lerp, which isn't right of course because it's unnatural.  I also tried multiplying the velocity by some factor (0.9 or similar), but then I don't know how to choose the factor such that the end point B is reached (or as near to it as some epsilon value seems reasonable).

Does anyone have something relatively simple that I could use?  I can read C++ and C# code.

sentences:
Android developer/publisher royalty sharing I am creating and Android game, and will need to partner with a publisher. I am curious about how this is typically implemented. Probably publishers are going to have a difficult time trusting some developer that they don't know to pay them, assuming the develop puts the game up on Google Play. So will the publisher want the apk file so that they can put it up on Google Play themselves?
Or does Google Play have a mechanism where the royalties can be automatically split between two parties from sales/IAP?
I know that all contracts will be different and it will depend, but I'm just looking to get a general idea of what is usual/typical.

sentences:
Convert global 3d coordinate system to a local one with specific direction Imagine a (x,y,z) coordinate system within a solar system, with (0,0,0) beeing the center of sun where Z axis goes thru both solar poles.

I'm standing on a planet inside a house within that solar system.

Now from my perspective Z axis is skewed in unknown direction depending on where exactly the planet is at this moment.

What would be the steps I should take to create a local coordinate system with (0,0,0) being the house and where Z axis is perpendicular to the ground/house, so that I would be able to convert coordinates from local to global.

I have the global coordinate of my house and directional vectors for where is up/forward/right for my house.

I have some limited knowledge of vector math and projecting vectors on other surfaces, but there is a gap in my understanding that keeps me from solving this.

local housePos = vec(getHouseWorldPosition())        -- (x,y,z) position of house in global cooridnates (housePos.x,housePos.y,housePos.z)

local vRight = vec(getHouseWorldOrientationRight())  -- X directional normalized vector
local vForw = vec(getHouseWorldOrientationForward()) -- Y directional normalized vector
local vUp = vec(getHouseWorldOrientationUp())        -- Z directional normalized vector

local playerPos = vec(getPlayerWorldPosition())      -- players position in global coordinates

--Now how to get players position in coordinate system relative to housePos, with Z axis going along vUp vector

sentences:
LibGDX - On the "slowness" of loading assets Many tutorials I've seen put the loading of assets via AssetManager in a dedicated screen which displays some progress bar or image while the loading happens in background. Each "real" screen then gets the resources it needs from the asset manager, typically in the constructor, eg

public class GameScreen extends ScreenAdapter {

  private MyGame game;

  private Texture t1;
  private Sound s1;

  public GameScreen(MyGame game) {
    this.game = game;

    AssetManager am = game.getAssetManager();

    t1 = am.get("....", Texture.class);
    s1 = am.get("....", Sound.class);
  }
  // use t1 and s1

Now another source I've seen takes this concept a bit further and also does the actual get()s in the asset loading class, so screens don't have to do them themselves, eg

// in the Loader class

public AssetManager am = new AssetManager();
public Texture t1;
public Sound s1;

...
am.load(...);
am.load(...);
am.load(...);

// finishLoading() or update()....
...
t1 = am.get(...);
s1 = am.get(...);
...

// in the screen class

t1 = game.am.t1;
s1 = game.am.s1;
...
// use t1 and s1

Now my question is: is this good practice? What's the expensive part of loading assets, the AssetManager's .load()s or also the .get()s? (I thought it was only the .load()s.) Is removing the get()s from the screens really a performance gain?

sentences:
Java High-Resolution Timer for a simple game I want to work on a model of some kind of simple shape shooter game I would develop for either the desktop or the Android, using the libGDX library. There's something I want to incorporate into the game, and that is a countdown timer with the smallest unit in centiseconds.

The trouble I'm having is which resource to use to incorporate a fully-accurate game timer where it is in sync with real time, meaning that every second on the game timer, when the game is running at full speed, is equal to one second in real time. (I should understand what is a high-resolution timer)

Java's Swing Timer class won't do, and so are the two methods from the static System class. And I'm not very confident about the timer classes I've looked up online, unless I accidentally ran into one of them and never realized it's completely accurate.

I have practiced implementing my own countdown timer except that it ain't synchronized because I'm doing an update for every 10 milliseconds. I asked a similar question on StackOverflow, but I am getting a little too obsessed in trying to find a perfectly good timer.

sentences:
Where to store service urls for a Unity3D game I have URL information for services (dozens of them) that I want to store in a Unity3D web player project.  What is a good practice for storing it.  (please don't say hard coding them)

I've recently joined a large scale Unity 3D project in the business world.  I've noticed that there is no configuration file of any type.  I.e. All URLs for service calls are hard coded.  (among other configuration settings that are not typical for player editing)

While looking for a good solution to store/load, I'm seeing that:
1) Unity does not appear to have any kind of AppSettings.  I.e. like Visual Studio dlls/exes/services might.  (PlayerPrefs expressed in #3)

2) Web Player (which the project uses) does not support File IO, to store my own config.xml/config.json type file.

3) PlayerPrefs appears that it will remain isolated to the local machine.  Updating the project does not replace the player prefs, and new variables are supposed to be hardcoded to populate the PlayerPrefs if those variables didn't already exist.

4) Hard Coding the values creates a hefty inconvenience, as we push our solutions from Dev to Test to Staging to Prod, we have to make sure to replace a code file.  (typically systems are designed to change config files.)  Additionally, once the code was built, we wouldn't be able to reasonably change the settings to experiment with different servers or other configuration changes.

What would you recommend?

sentences:
Black screen when switching from fullscreen to windowed mode with libgdx I have just started working with libgdx, and have run into my first problem. I have a simple program that switches a desktop application from windowed mode to fullscreen and back again. If I start the program in windowed mode, it initially displays fine. When I toggle to full screen it is also OK.

However, when I toggle back to windowed mode the screen goes completely black. The application remains responsive though, and if I toggle again it will go back to fullscreen and display correctly.

I am using 64-bit Windows 7 with the IntelliJ IDEA IDE.

Any help with working out why it is doing this would be greatly appreciated.

A minimal example that displays the issue is shown below:

public class MyGdxGame extends ApplicationAdapter {

    @Override
    public void create () {
        fullScreen = false;
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if (Gdx.input.isKeyPressed(Input.Keys.TAB)) {
            fullScreen = !fullScreen;
            DisplayMode currentMode = Gdx.graphics.getDesktopDisplayMode();
            Gdx.graphics.setDisplayMode(currentMode.width, currentMode.height, fullScreen);
    }
}

private boolean fullScreen;
}

sentences:
How can I pass an external instance to the constructor of an object that's being created using the default XNA XML content loader? I'm trying to understand how to use the XNA XML content importer to instantiate non-trivial objects that are more than a collection of basic properties (e.g., a class that inherits from DrawableGameObject or GameObject and requires other things to be passed into its constructor).

Is it possible to pass existing external instances (e.g., an instance of the current Game) to the constructor of an object that's being created using the default XNA XML content loader?

For example, imagine that I have the following class, inheriting from DrawableGameComponent:

public class Character : DrawableGameComponent
{
  public string Name { get; set; }

  public Character(Game game) : base(game) { }

  public override void Update(GameTime gameTime) { }
  public override void Draw(GameTime gameTime) { }
}

If I had a simple class that did not need other parameters in its constructor (i.e., the Game instance), then I could simply use this XML:

<XnaContent>
  <Asset Type="MyNamespace.Character">
    <Name>John Doe</Name>
  </Asset>
</XnaContent>

...and then create an instance of Character using this code:

var character = Content.Load<Character>("MyXmlAssetName");

But that won't work because I need to pass the need to pass the Game into the constructor.

What's the best way to handle this situation? Is there a way to pass in things like the current Game using the default XNA XML content loader? Do I need to write my own XML loader? (If so, how?) Is there a better object-oriented design that I should be using for my classes?

Note: Although I used Game in this example, I'm really just asking how to pass any type of existing instance to my constructors. (For example, I'm using the Farseer Physics Engine, and some of my classes also need a reference to the Farseer World object too.)

Thanks in advance.

sentences:
What does "non commercial use" mean in terms of game assets? I recently got an app for my iOS device called "123D Design." It is a 3D model editor. Upon creation of an account, the application tell you that "your models may not be used commercially."

What exactly does this mean? If I were to create a 3D game and sell it, does this mean I cannot use any models made with that app in my game?

This seems quite ridiculous if it's true. Can companies do that?

sentences:
Setting Higher Z-Index for Sprite For my game, I have to set highest z index for my sprite.
At present, I wrote following code but didn't work for me.

    Sprite houseSprite = new Sprite(pX, pY,
            textureManager.houseBgRegion.deepCopy(),
            mVertexBufferObjectManager);
    attachChild(houseSprite);
    houseSprite.setZIndex(500);
    sortChildren();

My requirement did not satisfied with setting sprite in the HUD. So any how I have to apply highest z index. Also in my game sprites are dynamically generated as per game play.

So members please share your thoughts.

sentences:
Calculate distance from the centre to the edge of a cube in OpenGL I'm trying to calculate the distance between a central point on a cube and anywhere on the surface of the cube, depending on the location of a second 3D point.

I have two vertices in 3D; Q and P. Q is the centre of the cube, P is a random point outside of the cube. I also have a known size of the cube, where distance across is d.

If I have the normalised vector of u,  which is Q->P, how do I calculate the distance from the centre to where it hits the surface of the cube? I could not find the answer to this anywhere,on the Stack Exchange.

sentences:
Problem with monogame reference in monodevelop MAC I've downloaded monogame, monotouch (test version) and monodevelop for MAC and I created a monotouch IOS project, I included the Lidgren and Monogame csproject inside my monodevelop project and I added the monogame reference in my project. But when I try to build it, my Main class doesn't find the Game class and Game.run();

My Main is the same code that I got monogame site:

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Microsoft.Xna;
using Microsoft.Xna.Samples;
using Microsoft.Xna.Samples.Draw2D;

namespace Microsoft.Xna.Samples.Draw2D
{
    [Register ("AppDelegate")]
    class Program : UIApplicationDelegate
    {
        private Game1 game; //doesn't find

        public override void FinishedLaunching (UIApplication app)
        {
            // Fun begins..
            game = new Game1();
            game.Run();
        }

        static void Main (string [] args)
        {
            UIApplication.Main (args,null,"AppDelegate");
        }
    }
}

and My appDelegate:

using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace testeios
{
    // The UIApplicationDelegate for the application. This class is responsible for launching the
    // User Interface of the application, as well as listening (and optionally responding) to
    // application events from iOS.
    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate
    {
        // class-level declarations
        UIWindow window;

        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
    }
}

I don't know what's happening, I follow every step to install it. has Someone the same problem?

sentences:
Getting contour without the background I have a texture and vertex which are needed to create a set of closed polygons. For this purpose I use these functions:

Code for create texture:

CCSprite* spr = CCSprite::spriteWithTexture(mShape->getTexture());

spr->setPosition(ccp(spr->getTextureRect().size.width/2, spr->getTextureRect().size.height/2));
spr->setFlipY(true);

CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(mShape->getTextureRect().size.width, mShape->getTextureRect().size.height);

texture->beginWithClear(1, 1, 1, 0);
spr->visit();

glColor4f(0, 0, 0, 1);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);

for(int i=0; i < innerBorders.size(); i++) {
    std::vector<Vector2d> sitePoints = innerBorders.at(i);

    for(int n=1; n < sitePoints.size(); n++ ) {
        Vector2d origin = sitePoints.at(n-1);
        Vector2d destination = sitePoints.at(n);

        drawSmoothLine(ccp(origin.GetX(), origin.GetY()), ccp(destination.GetX(), destination.GetY()), 0.25f);
    }
}

glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glColor4f(1.0, 1.0, 1.0, 1.0);

texture->end();

drawSmoothLine method:

drawSmoothLine(CCPoint pos1, CCPoint pos2, float width){
GLfloat lineVertices[12], curc[4];
GLint   ir, ig, ib, ia;
CCPoint dir, tan;

width = width*8;
dir.x = pos2.x - pos1.x;
dir.y = pos2.y - pos1.y;
float len = sqrtf(dir.x*dir.x+dir.y*dir.y);
if(len<0.00001)
    return;
dir.x = dir.x/len;
dir.y = dir.y/len;
tan.x = -width*dir.y;
tan.y = width*dir.x;

lineVertices[0] = pos1.x + tan.x;
lineVertices[1] = pos1.y + tan.y;
lineVertices[2] = pos2.x + tan.x;
lineVertices[3] = pos2.y + tan.y;
lineVertices[4] = pos1.x;
lineVertices[5] = pos1.y;
lineVertices[6] = pos2.x;
lineVertices[7] = pos2.y;
lineVertices[8] = pos1.x - tan.x;
lineVertices[9] = pos1.y - tan.y;
lineVertices[10] = pos2.x - tan.x;
lineVertices[11] = pos2.y - tan.y;

glGetFloatv(GL_CURRENT_COLOR,curc);
ir = 255.0*curc[0];
ig = 255.0*curc[1];
ib = 255.0*curc[2];
ia = 255.0*curc[3];

const GLubyte lineColors[] = {
    ir, ig, ib, 0,
    ir, ig, ib, 0,
    ir, ig, ib, ia,
    ir, ig, ib, ia,
    ir, ig, ib, 0,
    ir, ig, ib, 0,
};

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, lineVertices);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, lineColors);
glDisable(GL_TEXTURE_2D);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 6);
glEnable(GL_TEXTURE_2D);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);}

I need to get the texture of the contour (without the main texture on the background.) How can it be done using openGL ES 1.1?

sentences:
flicker when drawing 4 models for the first time i have some models that i only draw at a certain moment in the game (after some seconds since the game has started). The problem is that in that first second when i start to draw the models, i see a flicker (in the sence that everything besides those models, dissapears, the background gets purple). The flicker only lasts for that frame, and then everything seems to run the way it should.

UPDATE
I see now that regardless of the moment i draw the models, the first frame has always the flickering aspect

What could this be about? i'll share my draw method:

int temp = 0;
foreach (MeshObject meshObj in ShapeList)
{
    foreach (BasicEffect effect in meshObj.mesh.Effects)
    {
        #region color elements

        int i = int.Parse(meshObj.mesh.Name.ElementAt(1) + "");
        int j = int.Parse(meshObj.mesh.Name.ElementAt(2) + "");
        int getShapeColor = shapeColorList.ElementAt(i * 4 + j);
        if (getShapeColor == (int)Constants.shapeColor.yellow)
            effect.DiffuseColor = yellow;
        else if (getShapeColor == (int)Constants.shapeColor.red)
            effect.DiffuseColor = red;
        else if (getShapeColor == (int)Constants.shapeColor.green)
            effect.DiffuseColor = green;
        else if (getShapeColor == (int)Constants.shapeColor.blue)
            effect.DiffuseColor = blue;

        #endregion

        #region lighting

        effect.LightingEnabled = true;
        effect.AmbientLightColor = new Vector3(0.25f, 0.25f, 0.25f);

        effect.DirectionalLight0.Enabled = true;
        effect.DirectionalLight0.Direction = new Vector3(-0.3f, -0.3f, -0.9f);
        effect.DirectionalLight0.SpecularColor = new Vector3(.7f, .7f, .7f);

        Vector3 v = Vector3.Normalize(new Vector3(-100, 0, -100));
        effect.DirectionalLight1.Enabled = true;
        effect.DirectionalLight1.Direction = v;
        effect.DirectionalLight1.SpecularColor = new Vector3(0.6f, 0.6f, .6f);

        #endregion

        effect.Projection = camera.projectionMatrix;
        effect.View = camera.viewMatrix;
        if (meshObj.isSetInPlace == true)
        {
            effect.World = transforms[meshObj.mesh.ParentBone.Index] * gameobject.orientation; // draw in original cube-placed position
            meshObj.mesh.Draw();
        }
        else
        {
            effect.World = meshObj.Orientation; // draw inSetInPlace position
            meshObj.mesh.Draw();
        }
    }
    temp++;
}

sentences:
Two Colliders on the same GameObject for different purposes I'm somewhat new to Unity and am trying to build a battle system.
Right now, I have an attack that checks collisions with enemy objects like this:
private void OnTriggerEnter2D(Collider2D other) {
  if (other.gameObject.layer != LayerMask.NameToLayer(_hurtboxLayer))
    return;

  var enemyHealth = other.GetComponent<Health>();
  enemyHealth.TakeDamage(_damagePoints);
}

My game also uses Rigidbody2D objects to let the player and enemies bump into each other.
Because I want the "bumping" Collider2D be different from the hitbox Collider2D, I made a child GameObject called Hurtbox for each enemy.
The Hurtbox objects have a Health behaviour which handles the HP and death of an enemy:
public class Health : MonoBehaviour {

  [SerializeField] private int _initialHealthPoints;
  private int _healthPoints;

  public void TakeDamage(int damagePoints) {
    _healthPoints -= damagePoints;

    if (_healthPoints <= 0) {
      Die();
    }
  }

  private void Die() {
    Destroy(gameObject);
  }

  private void Start() {
    _healthPoints = _initialHealthPoints;
  }

}

The Die method only destroys the hurtbox object and is not allowed to destroy the enemy object, which is its parent.
Is there any way I can put both Collider2Ds and the Health behaviour on the same GameObject and only check a specific Collider in the OnTriggerEnter2D method?

sentences:
Unity3D - Smooth rotation for seek steering behavior I am trying to implement Reynolds' seek steering behaviour, but I am having problems on the rotation part. This is what I have:

void FixedUpdate()
{
// get position of current waypoint
        Vector3 targetPos = new Vector3(path[currentWaypoint].x, transform.position.y, path[currentWaypoint].z);

        // velocity vector towards target
        Vector3 desiredVelocity = targetPos - transform.position;

        // calculate the steerforce required for the desired velocity based on current velocity
        Vector3 steerForce = desiredVelocity - currentVelocity;
        steerForce = new Vector3(steerForce.x, 0, steerForce.z);
        steerForce = Vector3.ClampMagnitude(steerForce, maxSteer);

        // create a move vector to be added to agent's current position
        // Then normalize it so it can be scaled according to the agent's max speed
        Vector3 moveVector = steerForce.normalized * moveSpeed * Time.fixedDeltaTime;
        transform.Translate(moveVector);
}

How would I do it so my agent will be rotated smoothly based only on the code above? I tried rotating based on the current velocity, but the agents is rapidly rotated in one frame towards the target waypoint. I am not working with rigidbodies.

Am I doing something wrong? What am I missing?

Thanks,
Jack

sentences:
Perpendicularity of a normal and a velocity? I'm trying to fake angular velocity on my vehicle when it hits a wall by getting the dot product of the normal of the edge the car is hitting and the vehicle's velocity:

            Vector2D normVel = new Vector2D();
            normVel.equals(vehicle.getVelocity());
            normVel.normalize();
            float dot = normVel.dot(outNorm);
            dot = -dot;
            vehicle.setAngularVelocity(vehicle.getAngularVelocity() +
                    (dot * vehicle.getVelocity().length() * 0.01f));

outNorm is the normal of the wall.

The problem is it only works half the time. It seems no matter what, the car always goes clockwise.

If the car should head clockwise:

--------------------------------------
       /
      /

I want the angular velocity to be positive, otherwise if it needs to go CCW:

--------------------------------------
       \
        \

Then the angular velocity should be negative...

What should I change to achieve this?

Thanks

Hmmm...

Im not sure why this is not working...

        for(int i = 0; i < buildings.size(); ++i)
        {
            e = buildings.get(i);
            ArrayList<Vector2D> colPts = vehicle.getRect().getCollsionPoints(e.getRect());

            float dist = OBB2D.collisionResponse(vehicle.getRect(), e.getRect(), outNorm);
            for(int u = 0; u < colPts.size(); ++u)
            {
                Vector2D p = colPts.get(u).subtract(vehicle.getRect().getCenter());
                vehicle.setTorque(vehicle.getTorque() + p.cross(outNorm));
            }

sentences:
Change Pawn movement speed I'm newbie in Unreal development and I don't know how to move my pawn faster.

By the way, I'm using Unreal 4.16.

I'm developing Pong game and I have this method to move the pawn:

void AAIPaddle::MovePaddle(float Scale)
{
    // Add a movement input, hardcoding Z speed to 100.0f
    FVector direction = FVector(0.0f, 0.0f, 100.0f);

    // Scale could be -1.0f or 1.0f or 0.0f.
    AddMovementInput(direction, Scale);
    if (OurMovementComponent &&
        (OurMovementComponent->UpdatedComponent == RootComponent))
    {
        OurMovementComponent->AddInputVector(direction * Scale);
        ZVelocity = Scale;
    }
}

You can find the class AAIPaddle here.

I use this FVector direction = FVector(0.0f, 0.0f, 100.0f); to set its speed, but I change the value 100.0f with 400.0f or another greater values and it moves with the same speed.

Maybe I haven't understood anything. How can I change its movement speed?

I'm using the following class that inherits from UPawnMovementComponent.

void UPaddlePawnMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    // Make sure that everything is still valid, and that we are allowed to move.
    //      PawnOwner: which pawn owns this MovementComponent.
    //      UpdatedComponent: the component we move and update.
    //      ShouldSkipUpdate: Possibly skip update if moved component is not rendered or can't move.
    // If none own this component or there isn't anything to move or we have to skip this update, then return.
    if (!PawnOwner || !UpdatedComponent || ShouldSkipUpdate(DeltaTime))
    {
        return;
    }

    // Get (and then clear) the movement vector that we set in ACollidingPawn::Tick
    FVector DesiredMovementThisFrame = ConsumeInputVector().GetClampedToMaxSize(1.0f) * DeltaTime * 150.0f;
    // If movement isn't nearly zero
    if (!DesiredMovementThisFrame.IsNearlyZero())
    {
        FHitResult Hit;
        // Move our UpdatedComponent by the given DesiredMovementThisFrame, and sets rotation to
        // UpdatedComponent->GetComponentRotation(), do a bSweep and store any hit on Hit.
        SafeMoveUpdatedComponent(DesiredMovementThisFrame, UpdatedComponent->GetComponentRotation(), true, Hit);

        // If we bumped into something, try to slide along it
        if (Hit.IsValidBlockingHit())
        {
            StopMovementImmediately();
        }
    }
};

The project is public in Github.

Maybe I don't understand something about Vectors.

sentences:
How do MMO servers handle a large concentrated number of players? I have a pretty good understanding of how to scale servers but there's one thing I can't quite be sure about is how to manage a lot of players in a concentrated area.

If I have a server which is using multiple threads and processes as long as you limit the amount of players that can join a single game instance then this can scale indefinitely by adding more servers and placing it behind a load balancer.

But MMO games don't work that way because it's broken down into zones that anyone can connect to. So if a massive amount of players all decided to connect to the same zone it would put all of the stress on 1 server.

If you tried to spread the load across multiple servers then you'd run into problems of having to share information between the servers (Such as if player X was connected to sever 1 then all of his movements would also have to be passed on to the players connected to server 2 since server 1 and 2 are managing the load for the same zone).

So I was wondering how do you go about solving this problem? Do you just keep on ramping up the specs for the server on heavily populated zones? Or is there a fast and efficient way for multiple servers to manage the load for the same zone and efficiently share data between the two servers?

sentences:
AI, Pathfinding - Searching Behavior I'm developing a top-down 2D game mostly based off a tilemap/grid. The player will be able to build structures on this grid while other objects like vehicles will move around freely. I've been working on the AI for awhile and have struggled with coming up with a searching method.

The basic behavior I'm looking for is that of a dog barking at someone inside a house. When the person inside runs to the left out of view, the dog will run left and could very well run around the whole house trying to reach/see the person.

Standard pathfinding algorithms look for shortest paths or near shortest paths. But the behavior I'm looking for is more dynamic and isn't about finding a path as much as searching for a way in.

The example I'm working with currently, as seen below, depicts a zombie that has sight of a player inside a building through a window. The player then moves to the right out of view. The desired effect would be that the zombie runs to the right and all the way around the building until finding the player again or giving up. Note that I don't want the zombie to go left and in through the door (which would be the shortest path) to reach the player.

I've fiddled with ideas about using steering behavior, weighted tiles based on distance, wall-following, etc. and nothing has really made sense yet. I'm looking for any thoughts on ways to go about this kind of behavior driven searching.

sentences:
How can I attract & repel the mouse cursor from particular UI controls? This question came from some of my students. I wanted to share it here so others can find & improve on the solutions we've found so far.

In particular, my answer below doesn't behave as well as I'd like in windowed / editor mode - UI buttons no longer respond to hovering the cursor. I welcome alternative answers that solve this more completely.

We're making a visual novel game using the Fungus asset for Unity.

We want to add a twist where some dialogue options are easier or harder to press, because they attract or repulse your mouse cursor.

Unfortunately, we haven't been able to identify a cross-platform way to manipulate the mouse's position, nor a way to create a "Fake" mouse cursor image that can still interact with Fungus's UI buttons.

How can we pull this off?

sentences:
Is there an efficient way to identify in which run-time generated room a character is, in a non-grid 3D environment? How? Here is what I am trying to implement. I wrote a script that allows the player to place walls during run-time, in non grid-based 3D environment (walls can be diagonal with rotation increasing/decreasing in amounts of 10 degrees). Like the figure below shows, since wall can form different angles, rooms might end up having both convex and concave angles:

What I have been looking for, without success so far, is a way to detect in which room a given character is, according to its position. Of course, if that was a grid-based setting, I could only pass an ID for each cell and then retrieve the ID of the cell where the given character stands. However, that being a non-grid setting and with irregular rooms that have shapes unknown in advance, how could I accomplish that in an efficient way?

Many thanks.

EDIT:
Although it is a 3D environment, the problem may be treated as a 2D one since height is not a concern here.

sentences:
How to FindGameObjectsWithTag then cast the array of GameObjects to an Array of Interfaces I have a few GameObjects that implement a common Interface: IsTree.
I need to call the function doTreeThing() on each of those IsTrees after getting a reference to each of them via FindGameObjectsWithTag("tree").

This line complains that it cannot implicitly convert from GameObject[] to IsTree[]

IsTree[] trees = GameObject.FindGameObjectsWithTag("tree");

So then I tried to leave the GameObject[] an iterate over it to convert each individual object inside to an IsTree.

GameObject[] trees = GameObject.FindGameObjectsWithTag("tree");
        foreach (GameObject tree in trees) {
            IsTree isTree = (IsTree)tree;
            isTree.doTreeThing();
        }

But this complains that it also cannot convert GameObject to IsTree.

Then I got a little desperate and tried to make my IsTree into a GameObject.

public class IsTree : GameObject {
    public System.DateTime getAge(){
        return null;
    }
}

GameObject is a sealed type. (I don't really know what that means besides that this does not work)

So how do I get this array of GameObjects into an array of SomeInterface?

sentences:
Rotate an object smoothly by using Accelerometer Input in Unity There is a simple script where the object orientation is equal to the mobile devices orientation.

it works but the object doesn't rotate smoothly.

void FixedUpdate()
{
    float accelx = Input.acceleration.x;

    float angle = Mathf.Asin(accelx) * Mathf.Rad2Deg;

    transform.eulerAngles = new Vector3(angle , 0, 0);
}

How to rotate an object smoothly by using Accelerometer Input ?

sentences:
SDL_types.h file not found using xcode Getting this error when trying to use SDL_mixer...

SDL_types.h file not found..

I am including all the correct files as far as I can tell and have included the frameworks (both SDL and SDL_mixer) to my /systems/library/frameworks folder and it compiles well until I add SDL_mixer.h to my project. What should I do?

Here is main.cpp

#include <SDL/SDL.h>
#include "SDLMain.h"
#include "SDL_mixer.h"

int main(int argc, char ** argv)
{
    SDL_Init(SDL_INIT_EVERYTHING);
    Mix_Chunk song;
    //Initialize SDL_mixer
    if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 )
    {
        return false;
    }

    song = Mix_LoadWAV("song.wav");
    SDL_SetVideoMode(1000, 500, 32, SDL_SWSURFACE);
    SDL_Event event;
    bool done = false;
    while(!done)
    {
        while (SDL_PollEvent(&event))
        {
            if (event.type == SDL_QUIT)
            {
                done = true;
            }
            if (event.type == SDL_KEYDOWN)
            {
                if (event.key.keysym.sym == SDLK_UP)
                {
                    Mix_PlayChannel( -1, song, 0 );
                }
            }
        }
    }
    SDL_Quit();

    return 0;
}

Thanks

sentences:
Direct3D 11 : Vsync to 60 fps not matter the monitor refresh rate I am working with Direct3D 11 and I am trying to figure out how to make my game run at 60 fps. Currently I use :

swapChain->Present(1, 0);

To max the fps with Vsync. This only works because my monitor is 60hz though. As I understood it, the first parameter of Present is used to divide the current screen's refresh rate to obtain a certain fps. So I can get 60fps by setting this to 2 on a 120hz monitor or even 4 on future 240hz monitor and so on.

My problem is this : what do I do with 144hz monitors? Is there any way to get 60fps vsync on those monitors?

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

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

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

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

sentences:
Separating game logic from animation For non-game applications the model-view-controller pattern is typical where data, logic, and visuals are separated. But for a game how would you architect the game logic and the animation system in this way?

The gut instinct is to just not think about this and jam the 3d model and its animations into the Unit class where there is also the unit attack logic. And then to just to intermix the code that runs the attack logic with the attack animation. But suppose you wanted to keep these animations separated. What kind of design pattern would you use?

Perhaps a way of testing a design to see if its good is to see if it allows reasonably easy replacement. Imagine replacing the the 3d polygonal animation system with a voxel animation system. What kind of design pattern and game architecture would make this easy? Obviously just intermixing the code that runs the attack logic with the attack animation would make this hard.

sentences: How do I detect when the Xbox home button is pressed XNA? How do I detect when the big Xbox button in the middle of the gamepad is pressed in XNA?

sentences:
MonoGame - Ordering Movement Key Presses I'm looking for a way to retrieve the last key pressed even when other keys might be pressed for a top-down four-directional game. For example:

W is pressed → Move up
D is pressed → Move right
S is pressed → Move down

The above I can get to work fine using a stack. When S is released, then we start moving right again, and when D is released, we go back to moving up. The issue arises when trying to release (say W) and then pressing W again to move up before S and D are released.

I've tried using arrays and lists to solve this problem (to use flags or remove a key from any point in the collection), but it results in whatever key is last in the if statements to check for the movement keys being given the priority.

Any help is greatly appreciated. If there's anything else I could provide please let me know.

Edit - a more detailed example:

Player is currently standing still.
User presses W to move the player up. This key is stored as the current movement key on a stack and as long as the key is pressed (checking per frame), the player will continue to move up.
User presses D to move the player right. The D key is stored as the current movement key on the same stack W was stored on. W is not the current movement key anymore.
User releases the W key - since this is stored on a stack, we know W was released but we cannot remove it from the stack (but we do know it is on the stack). I do not want to just keep adding the keys to the stack, thus the reason we check if the stack contains the key.
User presses the W key again. Since D is still the current movement key, and since we weren't able to remove W from the stack, we cannot add it to the stack again.

sentences:
Both are scale 1, one is a lot smaller Both of these balls are the same scale (1) but one is a lot bigger.

What can cause this? I don't think I've ever scaled the ball anywhere in my code.

sentences:
No animation clips in assets folder I'm trying to import an FBX file made in Blender into Unity so I can use the actions created in Blender in a Unity animation state machine. A lot of sites seem to suggest that simply dropping the FBX file into the assets will automatically import animation clips, but that doesn't seem to be happening. Unity does however recognize the discrete actions created.

Tutorial image:

My screen image:

I used the Blender export settings "Include Animation" and "All actions", but not "Include Default Take" as people recommend.

For reference, I'm trying to follow the animator controller tutorial at unity3d.com

How can I retrieve my animation clips from the fbx file, or is there another way to insert them into the Animator?
Thanks!

sentences:
Rotating a square rendered on a Bitmap I'm writing a Software Renderer for fun/learning. Basically, it's just a giant array of integers which contain hexadecimal values (representing colour) that are rendered to the screen....

int screenWidth = 16;
int screenHeight = 16;
int[] pixels = new int[screenWidth * screenHeight];
Arrays.fill(pixels, 0xffff00ff);

Something like that, the above should render a pink screen (255, 0, 255). So my problem is I've written a method that will fill a rectangle...

public void fillRect(int x0, int y0, int x1, int y1) {
    x0 += xOffs; // apply offset to each vertex
    y0 += yOffs;
    x1 += xOffs;
    y1 += yOffs;

    if (x0 < 0) x0 = 0;
    if (y0 < 0) y0 = 0;
    if (x1 >= width) x1 = width - 1;
    if (y1 >= height) y1 = height - 1;
    for (int y = y0; y <= y1; y++) {
        for (int x = x0; x <= x1; x++) {
            components[x + y * width] = 0xDEADBEEF;
        }
    }
}

And it works fine, although I want to try and rotate the quad by 90 degrees, then render it to the bitmap. So I tried this....

public void fill(int x0, int y0, int x1, int y1) {
    final int theta = 90;
    x0 = (int) (x0 * Math.cos(theta) - x0 * Math.sin(theta));
    x1 = (int) (x1 * Math.cos(theta) - x1 * Math.sin(theta));
    y0 = (int) (y0 * Math.sin(theta) + y0 * Math.cos(theta));
    y1 = (int) (y1 * Math.sin(theta) + y1 * Math.cos(theta));

    x0 += xOffs; // apply offset to each vertex
    y0 += yOffs;
    x1 += xOffs;
    y1 += yOffs;

    if (x0 < 0) x0 = 0;
    if (y0 < 0) y0 = 0;
    if (x1 >= width) x1 = width - 1;
    if (y1 >= height) y1 = height - 1;
    for (int y = y0; y <= y1; y++) {
        for (int x = x0; x <= x1; x++) {
            components[x + y * width] = hex;
        }
    }
}

Although it doesn't work, nothing is shown on the Window. Any ideas? I have a feeling after the rotation, the entire method is wrong. Any help would be great :)

sentences:
Unity XR Spectator Camera I would like to have a VR camera (for the player) but also have another camera (spectator).
I am using Unity 2019.4.8f1 on the Universal Render Pipeline
I have only been able to find outdated articles:
https://blogs.unity3d.com/2017/12/12/spectating-vr/
https://unity3d.college/2017/05/08/unity3d-spectator-mode-vr/
https://forum.unity.com/threads/using-a-second-cam-while-still-rendering-the-vr-camera-for-the-vr-headset.659434/
Thanks!

sentences:
How do I handle objects with a width and height in grid-based pathfinding? I'm using the Jumper library for Love2D to do grid-based pathfinding, which worked fine until I wanted to make larger enemies (with larger collision boxes). How do i do that?

My initial idea was to make a new map for each entity that needed pathfinding I could make a new map, with all the objects scaled up in size, but that seems way to complicated.

To give an example, I could have a wall with a passageway that is wide enough that my player has no trouble walking around it, but a giant ogre would have to walk around.

sentences:
Filling a 2D polygone with N points more or less equally distanced Following challenge: having any number of connected 2D faces forming virtually a polygone and filling the polygone with a variable number of points equally distanced to each other.

So here is a sample 2D object with any number of faces, all connected to each other, forming virtually a polygone:

Here is what I would like to calculate (in JavaScript or Python or pseudo): a variable number of points inside the faces, equally distanced to each other.

Some notes:

The points distance to each other doesn't need to be 100% the equal.
Prioritized points are at the borders of the faces
I should be able to define the targeted number of points, but it doesn't need to be exactly that number of points, can be more or less.
Any ideas how to approach?

sentences:
glScalef - game math issue I can't get my head wrapped around this issue. The issue is my latest code is making the camera zoom in and out really quickly.

My approach is built on -

http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847?tag=content;siu-container

The opengl scale will be getting the variable - scale.

gl.glScalef(scale, scale, 1);

the distance is obtained by between two fingers, old distance (initial touch points), and new distance (dragging touch points). The zooming in and out works well. However, it would reset glScalef each time the user start using pinch zoom.

scale = newDistance / oldDistance;

I tried calculating by additive ratio. The oldtscale handles the previous distance, if it is same, then it doesn't need to add up anything to scale. The zooming is really quick, I moved the fingers closer by mere 1 cm to 5 cm, zoom goes down or up fast.  I think additive ratio is a bad solution. I think it might be incomplete solution. I'm trying to figure out what's wrong with it.

//additive ratio
tscale = (newDistance / oldDistance) - 1;
                    if(oldtscale == tscale) {
                        oldtscale = tscale;
                        tscale = 0;
                    }
                    else {
                        oldtscale = tscale;
                    }
                            //adding up the additive ratio and scale
                    tscale = scale + tscale;
//checking tscale for limiting the maximum/minimum scale
if(tscale >= 2) {
                        tscale = 2;
                    }
                    else if(tscale <= 1) {
                        tscale = 1;
                    }
                    //supply scale
                    scale = tscale;

sentences:
2d block based game storing water simulation I am making a 2d block based sandbox game like terraria.

I'm trying to think where is the better place to store water in, data structure wise.

That is, to store it in the block world array, or to store it in its own sparse data structure. Does doing this have any benefits?

If I store it in the world array I have to store the fluid level (which would be like 16 levels possible). The other way I could simply have a fluid cell struct or something.

It might make things more clear separating it, but not sure if it would possibly affect performance either way.

In a game like this, the simulation is of course usually done via cellular automata (just in case that affects which data structuring I should use)

sentences:
Money in different platforms So first of all, let me start off by saying that I am not in this to make money as of right now. I'm a novice - however I would like (in the frture) to be able to earn some extra cash on the side with my games.

I have several ideas for what my first game could be and then I started considering the platform on which my game should run.

So I started thinking

iOS & Android mobile devices already have a built-in store that everyone uses. This means that even if my game doesn't get a lot of attention (and doesn't reach the highest position on the market) everyone would still be able to find my game on the same platform.

How is this possible with games made for web or even desktop?

Are the chances of making money of web and desktop as big as on the mobile market?

sentences:
Change 3ds max mesh local origin pivot point I'm developing a 3D videogame in C# with XNA, my problem comes when I load my model done in 3ds max, and I try to rotate a mesh of it, because the pivot point isn't exported so it takes the local origin of the mesh, the point you get when pressing "Reset Pivot" in 3ds max.

What I want to do is to change its point default value, so that my animation gets the correct pivot point, how can I achieve this?

Thanks in advance! :)

sentences:
Questions related to rendering to texture and rendering to buffer (OpenGL) I am experimenting with off-screen rendering. I understand there is two solutions to this:

rendering to texture (you attach a texture to one of the FBO's attachment point which can be a color, depth, etc.)
use a render buffer.

Question 1

I first experimented with using render-buffers. I have a FBO and 2 RBOs, one for color (attached to COLOR0) and one for depth (attached to DEPTH). When I want to visualise the content of what I rendered to the render buffer, I use the glBlitFramebuffer function to copy the content from the FBO to the Window frame buffer (index 0).

glBindFramebuffer(GL_READ_FRAMEBUFFER, fboId);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR);

First I would like to know if this the best way? (of passing the image from the a render buffer back to the window buffer).

Question 2

My second question. The method I described above works but I can only see the "color" buffer of the FBO, not the depth buffer (I would also like to visualise the depth buffer). So I was wondering how/if this was possible using this approach? I tried to use the index of the depth render buffer in place of the fboIdx in glBindFramebuffer but it didn't change anything. Can I make it work without using render-to-texture approach?

Question 3

My end goal is to render two images using an off-screen approach and blend them together. The result of the mix between the two rendered images is what I want to display to the screen. To keep things fast, I understand this can be done in hardware. What's the best way for doing this? Can it be done using the render-buffer approach or do I need to go the render-to-texture approach (aka render to two textures and then blend these textures using a fragment shader when I do my final pass in which I render a quad stretched over the surface of the screen?

sentences:
Black borders in Andengine I am using Andengine and when I start the examples there are black borders on left and right of the screen. Like this:

10000001
10000001
10000001

where 1 is black and 0 is not black. On my phone (Google Nexus 4) it is always. In emulator sometimes. it is in all examples from here: https://github.com/nicolasgramlich/AndEngineExamples

What is causing this?

sentences: How do you allow joints in a character to fall freely based on gravity? I am building a game in Unity in which a character falls down on death. Is it possible to make the joints fall and bend based on gravity? That is to leave the joints fully dependent on gravity and colliders and not any skeletal animation.

sentences:
SharpDX(DirectX 11) N-tier layering of images I have an project I'm looking for a better solution to. I have a need to render n images over each other the previous one. So I have loop if you will. This should simulate alpha bending via basic combining the target and overlay pixel color values. Please see code below.

public void Render()
    {
        Device3DModule.DeviceContext.ClearRenderTargetView(Device3DModule.RenderTargetView, Colors.Blue.ToDXColor());

        CompositeShader.Apply();

        foreach (var image in Images)
        {
            Texture2D target = null;
            var pass01 = true;

            foreach (var imageChannel in image)
            {
                if(!imageChannel.IsVisible || imageChannel.Image == null) continue;

                imageChannel.Pass01 = pass01;

                Device3DModule.DeviceContext.PixelShader.SetShaderResource(1, imageChannel.Image);
                imageChannel.CopyToDeviceBuffer(ref m_ChannelSettingBuffer);

                QuadMesh.Draw();

                target?.Dispose();

                target = new Texture2D(Device3DModule.Device, Device3DModule.RenderTarget.Description);
                Device3DModule.DeviceContext.CopyResource(Device3DModule.RenderTarget, target);

                ShaderResourceView = new ShaderResourceView(Device3DModule.Device, target);
                Device3DModule.DeviceContext.PixelShader.SetShaderResource(0, ShaderResourceView);

                pass01 = false;
            }

            target?.Dispose();
            ShaderResourceView.Dispose();
        }
    }

Does anyone have a better idea?

sentences:
Problem when animating MD5 model (GPU Skinning) I'm trying to implement a GPU skinning version of the md5mesh.js by @tojiro (demo with CPU skinning) in WebGL (live demo of the project here, use WASD to move the camera around).

The main concept is as follows: I modified the Vertex buffer object in order to fit the information of bones indices and bone weights, then for every frame of the animation I modify the bone matrix (an array of transformation matrices for each bone) with the appropiate matrix (for each joint I create an identity matrix and multiply it by it's orientation and position, then I multiply the result by the inverse of the bind pose and it's ready to go to the shader).

This works OK when the boneMatrix array is filled with identity matrices (by concept it should render the bindPose and it does). However when I try to load an animation the movements appear messed up and clipped. I discarded a wrong/corrupt version of the md5mesh / md5anim by loading them in an MD5 viewer.

Here there is an example of what happens when the boneMat array is filled with identity matrices:

I think this is the way the model should look, but when I try to animate it...

The general movement of the mesh is correct but some vertices move with an strange direction / orientation which forces a lot of clipping to occur.

Maybe someone experienced in the matter can spot the problem directly from the image, if not I' willing to provide any part of my modifications on the md5Mesh lib.

In order to implement all of this I've followed this tutorial and took a lot of ideas from this implementation.

Any help will be appreciated, I've really hit a wall with this!

Thanks in advance.

sentences:
Destroy chunked block like Minecraft I am trying to do a Minecraft-like game (like every one have already tried I guess) and i went across the problem i expected: lag with world Generation. I did lot of searching but i can

I tried to combine them into a bigger mesh, which work, but not i can destroy a single block. So how can I place/destroy chunked (mesh combined) block? If i cant, can someone clearly explain me a solution (i am not fluent in english nor with programming expressions, i can code tho) and how to do it (with a script example if possible :) ) ? Thanks in advance !

I generated my world using 2D perlin noise. Once i have the blocks, i split them into 16x16x100 chunk meshes.

Before Making chunks, i first tried to combine all of them into one block (using the unity manual), but the result is only one cube placed at 0,0,0. Where are all the other cubes ?

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class ThisWorldGen : MonoBehaviour {

public GameObject blockPrefab;
public GameObject grass;
public GameObject dirt;
public GameObject rock;
private string[] blockTag;
private GameObject stockin;

public int amp;
public int freq;
private Vector3 mypos;
[SerializeField]
private Material material;
private Vector3 blockLocations;

public List<MeshFilter> meshes = new List<MeshFilter>();

void Start()
{
    Generate();
}

void Generate()
{
    amp = Random.Range(0,100);
    freq = Random.Range(30,100);
    mypos = this.transform.position;
    int cols = 100;
    int rows = 100;
    float startTime = Time.realtimeSinceStartup;
    #region Create Mesh Data
    MeshFilter blockMeshes = Instantiate(blockPrefab, Vector3.zero, Quaternion.identity).GetComponent<MeshFilter>();

    for(int x = 0; x < cols;x++)
    {
        for(int z = 0; z < rows;z++)
        {
            float y = Mathf.PerlinNoise ((mypos.x + x) / freq,(mypos.z + z)/freq) * amp;
            y = Mathf.Floor(y);
            for(float hy = y; y > 0.0F; y -= 1.0F)
            {
                blockMeshes.transform.position = new Vector3(mypos.x + x,y,mypos.z +z);//move the unit cube to the intended position
                meshes.Add(blockMeshes);
            }
        }
    }
    int i = 0;
    MeshFilter[] listMeshes = new MeshFilter[meshes.Count];
    foreach(MeshFilter cubesToAdd in meshes)
    {
        listMeshes[i] = cubesToAdd;
        i++;
    }
    CombineInstance[] combine = new CombineInstance[listMeshes.Length];
    int w = 0;
    while(w < listMeshes.Length)
    {
        combine[w].mesh = listMeshes[w].sharedMesh;
        combine[w].transform = listMeshes[w].transform.localToWorldMatrix;
        listMeshes[w].gameObject.SetActive(false);
        w++;
    }
    Debug.Log (combine.Length);
    transform.GetComponent<MeshFilter>().mesh = new Mesh();
    transform.GetComponent<MeshFilter>().mesh.CombineMeshes(combine);
    transform.gameObject.SetActive(true);
    #endregion
    Debug.Log("Loaded in " + (Time.realtimeSinceStartup - startTime) + " Seconds.");
}
}

(the world was generating randomly and perfectly before trying to merge the meshes)

sentences: Head bone not found when importing .blend to Unity I have created a model, rigged it(using rigify), and created several actions(animation clips) for it Blender.  Everything seems to be fine.  However, when I import the .blend to Unity I get a console warning that "Required human bone 'Head' not found".  I know that there is a bone called "head" in my .blend.  The animations work, except the head rotation does appear to not be deforming.  Has anyone experienced this? Is this just a naming convention thing.  Should I try to rename my "head" bone to "Head"?  I just don't know the inner workings of the the import process well enough to know what to do.

sentences: Light and shadows like Diablo I wanted to have shadows in my game and thought the way they were implemented in Diablo was good enough. Any hints on how to produce a similar outcome?

sentences:
How can I reduce a frustum to the subset that passes through a portal AABB? I'm trying to implement portal based occlusion culling:

There are sectors and portals.

When a portal is visible, the sector it is connected to is rendered.

The sector is made of polygons and portals.

The sector is sealed by a portal to the next sector.

The portal has an axis aligned bounding box.

The view frustum has an array of mathematical planes in it. There is top, bottom, left, right, near and far.

The view frustum planes change shape when in contact with a wall.

When the view frustum planes are in contact with the portal's AABB, the sector get rendered.
Then an array of mathematical planes are added behind the portal to create a reduced view frustum.

Reduced frustums are made from other portals in contact with the view frustum until there are no more portals in view.

How can I perform the bolded step, where I find a new collection of frustum planes representing the portion of the original frustum that continues through the portal's AABB?

sentences:
OpenGL Camera causes spatial distortion I'm trying to implement a 3D camera of the "Orbit around the origin" variety in a game engine I'm developing in order to learn about 3D graphics and game programming. I have a basic handle on the required math, and have implemented my own crude 3D math library and matrix stack (functionally similar to the one in OpenGL's compatibility profile). My first attempts at a camera failed miserably, until I decided that I should use quaternions to represent rotation. Once I'd done that, I had a camera that moved in the direction I expected it to at about the right speed and fairly smoothly, but there is an odd spatial distortion effect that I can't seem to get rid of. I have posted a brief video on YouTube showing exactly what is happening.

I honestly don't know what could be causing this issue, the magnitude of the distortion appears to reach a maximum at certain angles, but beyond that I'm not sure what I should be looking at. Right now my chief suspect is my quaternion math code, because the matrix stack appears to be behaving itself and if something was wrong with my matrix math code I would be having more serious issues than this.

I'm not sure what information or code I can provide that would be of any use, so I'll start with the code that handles quaternion math.

public class Quaternion {
private float w;
private float x;
private float y;
private float z;

public Quaternion(){
    this(1.0f,0.0f,0.0f,0.0f);
}

public Quaternion(float W, float X, float Y, float Z){
    w = W;
    x = X;
    y = Y;
    z = Z;
}

public void loadIdentity(){
    w = 1.0f;
    x = 0.0f;
    y = 0.0f;
    z = 0.0f;
}

public float magnitude(){
    //AKA the "norm"
    return (float) Math.sqrt(w*w + x*x + y*y + z*z);
}

public void qNormalize(){
    float mag = this.magnitude();
    w /= mag;
    x /= mag;
    y /= mag;
    z /= mag;
}

public void qMultiply(Quaternion q){
    this.qMultiply(q.w, q.x, q.y, q.z);
}

private void qMultiply(float w2, float x2, float y2, float z2){
    //Performs A*B, where this Quaternion is A
    this.w = w*w2 - x*x2 - y*y2 - z*z2;
    this.x = w*x2 + x*w2 + y*z2 - z*y2;
    this.y = w*y2 + y*w2 + z*x2 - x*z2;
    this.z = w*z2 + z*w2 + x*y2 - y*x2;
}

public float[] qMatrix(){
    //Return a 4x4 matrix representation of this Quaternion, column-major like OpenGL prefers
    float w2 = w*w;
    float x2 = x*x;
    float y2 = y*y;
    float z2 = z*z;

    if(Math.abs(w2+x2+y2+z2 - 1.0) >= 0.000001){
        this.qNormalize();
        return this.qMatrix();
    }

    return new float[]{
        1.0f - 2.0f*y2 -2.0f*z2, 2.0f*x*y + 2.0f*w*z, 2.0f*x*z - 2.0f*w*y, 0.0f,
        2.0f*x*y - 2.0f*w*z, 1.0f - 2.0f*x2 - 2.0f*z2, 2.0f*y*z + 2.0f*w*x,0.0f,
        2.0f*x*z - 2.0f*w*y, 2.0f*y*z + 2.0f*w*x, 1.0f - 2.0f*x2 - 2.0f*y2,0.0f,
        0.0f,0.0f,0.0f,1.0f
    };
}

public void qFromAA(float angle, float[] axis){
    //create a Quaternion from an axis-angle representation

    if(Vector.magnitude(axis) == 0.0f){
        this.loadIdentity();
        return;
    }

    float theta = angle/2.0f;
    axis = Vector.scale((float)Math.sin(theta), Vector.normalize(axis));

    w = (float)Math.cos(theta);
    x = axis[0];
    y = axis[1];
    z = axis[2];
}

public String toString(){
    return "w: "+w+"\tx: "+x+"\ty: "+y+"\tz: "+z+"\tmag: "+(x*x+y*y+z*z+w*w);
}

}

Any ideas about where I should start?

sentences:
Vulkan vkEnumeratePhysicalDevices Returning Unexpected Device Count In the machine I'm running I have two GTX 980 Tis.
When I query the physical device count with vkEnumeratePhysicalDevices it always returns 1 despite having 2 physical discrete graphics cards. When I use vulkaninfo the only device listed is GPU0 which is a DISCRETE_GPU / GTX 980 Ti.

This happens in Windows 10 as well as GNU/Linux 4.5 using Vulkan API 1.0.11 with proprietary Nvidia drivers.

Is this normal behavior and I'm not using the API correctly or is this a bug? I feel like I've made a glaring obvious mistake but I can't find anything in the Vulkan specification about it.

For clarity, this is exactly how I query physical device count:

auto deviceCount = uint32_t{0};
instance.enumeratePhysicalDevices(&deviceCount, nullptr);
// At this point deviceCount is 1

Also, to confirm that the OS sees the cards:

Windows 10:

C:\Users\matt>wmic path win32_VideoController get name
Name
NVIDIA GeForce GTX 980 Ti
NVIDIA GeForce GTX 980 Ti

Linux 4.5:

+------------------------------------------------------+
| NVIDIA-SMI 364.19     Driver Version: 364.19         |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 980 Ti  Off  | 0000:01:00.0      On |                  N/A |
|  0%   56C    P8    34W / 300W |    444MiB /  6140MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 980 Ti  Off  | 0000:02:00.0     Off |                  N/A |
|  0%   43C    P8    25W / 300W |     22MiB /  6143MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

sentences:
D3D11 SetShader States I have some questions regarding the XXSetShader and what happens after, for instance I would like to know if when XXSetShader is called the subsequent calls would be bound to that particular shader, like PSSetShaderRsources. Because at load time I am bounding the resource views needed for that particular shader, then the next one and so on, but what I found is that the resources were not bound, I need to set them again every time the XXSetShader is called.

Am I doing something wrong? it's not supposed to work like that, the purpose of this is to have the least change states at runtime.

Thanks.

sentences:
Problem with camera deapth culling only option and objects in front of each other I have a prefab with 2 cameras. the 1st is rendering the world, the 2nd one all the suff in front of the 1st person characters "face". Now i have a problem with a gun using a muzzleflash - both on the deapth only camera. The muzzleflash is on the very front tip of the gun and i assume because the 2nd face camera is set to "deapth only" it causes the muzzleflash to be off place. I came up with 3 ideas

1: changing the layer of the muzzleflash to world for some frames everytime a muzzleflash appears

2: having a 3rd camera rendering the muzzleflash only

3: adjusting the gun on the face camera, the muzzleflash on the world camera

I assume the 1st two options have a huge overload, i prefer the 3rd one. But is it a good way to do it? How should i proceed in this situation? Or how do others?

I also have animations so it can appear on 2 positions, normal and scoped.

Edit Here is an image i added Debug.Break() as it was instantiated, its totally correct aligned.

sentences:
Why does my SFML game cause screen tearing on Linux? I wrote a little game of a bouncing ball, using SFML and Box2D.

On Windows, the graphics animate smoothly. However, on my Linux machine, the animation stutters randomly. To be precise, I get a horizontal video tearing effect.

I use the Intel graphics driver. I tried multiple solutions I found online to solve video tearing but I haven't been able to solve this. I've never had video tearing before (even in other OpenGL apps): It appears now for the first time.

sentences:
Collision detection problem in XNA I'm having two problems with my collision detection in XNA. There are two boxes, the red box represents a player and the blue box represents a wall.

The first problem is when the player moves to the upper side or bottom side of the wall and collides with it, and then try to go to the left or right, the player will just jump in the opposite direction as seen in the video.

However if I go to the right side or the left side of the wall and try to go up or down the player will smoothly go up or down without jumping.

The second problem is that when I collide with the box and my key is still pressed down the blue box goes half way through red box and and goes back out and it keeps doing that until I stop pressing the keyboard. its not very clear on the video but the keeps going in and out really fast until I stop pressing the key.

Here is a video example:-
http://www.youtube.com/watch?v=mKLJsrPviYo

and Here is my code

Vector2 Position;
Rectangle PlayerRectangle, BoxRectangle;
float Speed = 0.25f;

enum Direction { Up, Right, Down, Left };
Direction direction;

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    KeyboardState keyboardState = Keyboard.GetState();

   if (keyboardState.IsKeyDown(Keys.Up))
   {
       Position.Y -= (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
       direction = Direction.Up;
   }

   if (keyboardState.IsKeyDown(Keys.Down))
   {
       Position.Y += (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
       direction = Direction.Down;
   }

   if (keyboardState.IsKeyDown(Keys.Right))
   {
       Position.X += (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
       direction = Direction.Right;
   }

   if (keyboardState.IsKeyDown(Keys.Left))
   {
        Position.X -= (float)(Speed * gameTime.ElapsedGameTime.TotalMilliseconds);
        direction = Direction.Left;
    }

    if (PlayerRectangle.Intersects(BoxRectangle))
    {
         if (direction == Direction.Right)
             Position.X = BoxRectangle.Left - PlayerRectangle.Width;
         else if (direction == Direction.Left)
             Position.X = BoxRectangle.Right;

         if (direction == Direction.Down)
             Position.Y = BoxRectangle.Top - PlayerRectangle.Height;
         else if (direction == Direction.Up)
             Position.Y = BoxRectangle.Bottom;
     }

     PlayerRectangle = new Rectangle((int)Position.X, (int)Position.Y, (int)32, (int)32);

     base.Update(gameTime);
}

sentences:
Setting variable values in XNA 4.0 from an XML file I made a program that simulates an assembly line using the XNA 4.0. I made a 3D model, and divided it into 5 positions - start, 3 workstations, and end.
These positions represent the places on the model that (in real life) would be covered by some type of sensors. Whenever an object gets to one of these positions, it triggers a method that is binded to that specific position (like "Stop", "Start", "Increment/Decrement Counter"...).

This program has to be able to load a file that describes the behavior of the entire assembly line - meaning, this file has to tell the program when and which method will be triggered (for now it is only Start/Stop methods). To do this, I created a method that serializes the class that contains bool variables (these variables determine if the position will be "active" or not - if the value is true then the object will trigger the binded method, if it is false then it will simply pass that position, without any additional actions being performed).

This is the problem I'm having:
My method successfully serializes the class, and creates the .xml file, but if I load this file as Content, it gives me the following error "There was an error while deserializing intermediate XML. Cannot find type "Postavke.PostavkeStanice"."

This is the code of my class:

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;
using System.Xml;
namespace Postavke
{

    public class PostavkeStanice
    {
        public bool radnaStanica1_Stanje;
        public bool radnaStanica2_Stanje;
        public bool radnaStanica3_Stanje;
        public bool kraj_Stanje;
        MemoryStream ms = new MemoryStream();
        public void ClassToXML()
        {

          XmlTextWriter pisac = new XmlTextWriter(ms, Encoding.UTF8);
          pisac.Formatting = Formatting.Indented;
          IntermediateSerializer.Serialize(pisac, this, "Postavke.xml");
        }

        public string XMLToXNA()
        {
            ms.Seek(0, SeekOrigin.Begin);
            TextReader citac = new StreamReader(ms);
            return citac.ReadToEnd();
        }
    }
}

Since this class is a part of Game Library, I set the dependencies so that the Game library gets compiled before the main project.
When I run the code I get the fore mentioned error. Can you tell me what I'm doing wrong
Thank you

sentences:
How can i write automated tests for some SDL2 objects? For eg having a class that is rendering something on the screen, could be even a point or a line if not an image or whatever.

How is possible to write some tests for that class only?

or just a small program rendering a line, would it be possible to write an automated test for it?

sentences:
Z axis for player movement is being incremented, but i don't know how I'm currently learning and developing a 2D plataform game in Unity, but now i'm having some errors that i can't solve.

When I press the arrow keys to make my character move right and left, the Z axis is being incremented somehow,and the player is "getting into the screen", even though I didn't write anything about it in my script.

I read about the "Apply Root Motion" in the Animator segment, and I unmarked it as they said, but I think the error might still be there, but i'm not sure.

Does anyone know about it?

Here is a snippet of my code:

void Movement() {
    anim.SetFloat ("speed", Mathf.Abs (Input.GetAxis ("Horizontal"))); //Makes it record a value of speed between -1 and 1, so that the trigger of the animation can work.

    if (Input.GetAxisRaw ("Horizontal") > 0) {
            transform.Translate (Vector3.right * speed * Time.deltaTime);//speed * Time.deltaTime makes things smoother, it updates frame by frame, so that it does not jump all around
            transform.eulerAngles = new Vector2 (0, 0);
    }

    if (Input.GetAxisRaw ("Horizontal") < 0) {
            transform.Translate (Vector3.right * speed * Time.deltaTime);
            transform.eulerAngles = new Vector2 (0, 188);
    }

sentences:
Unreal Engine Visual Studio 2019 C++ - Could not open source file CoreMinimal.h I'm trying to follow a YouTube tutorial and I've ran into this (Severity    Code    Description Project File    Line    Suppression State
Error (active)  E1696   cannot open source file "CoreMinimal.h" Network2    E:\Unreal Projects\Network2\Source\Network2\MyClass.h   5   ) and a lot more errors, so if anybody has more experience than me with C++ please help me out.

sentences: Combine Unity games in one app I want to combine multiple Unity games in one Unity app (or other framework if necessary). This app would have a bunch of buttons that will start the desired game. Is this possible and what would be the best way to do this? Thanks!

sentences:
Push cube outside triangle face I'm creating a 3D game, and I need to know how to push a player (axis aligned box/cube) outside a triangle.

How can I get get the push direction?

sentences:
Varibles Initialized in Awake are null in other script's Start I have a component gameState Attached to one gameobject called GameState:

public class gameState : MonoBehaviour
    {
        public Context stateMachine;
        private void Awake()
        {
            PlayerGameobject p = GameObject.Find("Player").GetComponent<PlayerGameobject>();
            stateMachine = new Context(new Playing(), p);
        }

On another gameObject I have this component:

public class PlayerGameobject : MonoBehaviour
{
    void Start()
    {

        gameState = GameObject.Find("GameState").GetComponent<gameState>();
    }

}

When I try to use gameState within PlayerGameobject's Update method I find that stateMachine is null.

 if (gameState.stateMachine.CurrentState == "Playing"){}
      //       ^^^^ null

why is statemachine null? I initialized it in awake which should run before start. gameState is not null and other public variables assigned in Editor are not null.

sentences:
How to handle multiple events in SDL2 and C++? I'm working on an entity component based game and I ran into this problem.
I've got a component called PlayerControlComponent:

void PlayerControlComponent::HandleInput() {
    SDL_Event event;
    while(SDL_PollEvent(&event) != 0) {
        if(event.key.keysym.sym == SDLK_RIGHT) {
            Entity->MoveRight();
        }
        else if(event.key.keysym.sym == SDLK_RIGHT) {
            Entity->MoveLeft();
        }
        else {
            Entity->Stay();
        }
    }
}

and I've got a GameManager class that handles the input for the window, like if you hit escape it will quit:

void GameManager::HandleInput() {
    SDL_Event event;
    while(SDL_PollEvent(&event) != 0) {
        switch(event.key.keysym.sym) {
        case SDL_QUIT:
        case SDLK_ESCAPE:
            Quit();
        }
    }
}

After I put everything in my main function, it looks like this:

while(GameManager::GetInstance().IsRunning()) {
        //Inputs
        GameManager::GetInstance().HandleInput();
        player->GetComponent<PlayerControlComponent>()->HandleInput();
        //Update, Draw, etc..

My problem is that wich ever I put first gets executed only. So in this example the player won't handle inputs. If change it up and put the player first like so:

while(GameManager::GetInstance().IsRunning()) {
            //Inputs
            player->GetComponent<PlayerControlComponent>()->HandleInput();
            GameManager::GetInstance().HandleInput();
            //Update, Draw, etc..

..my player will move but than the window won't quit if I hit escape. For some reason wich ever input handling function is called first, gets executed. I figured out it has something to do with SDL_PollEvent(). So I created a global SDL_Event variable and changed up the code a bit so there is only 1 SDL_PollEvent() call wich happens in main:

while(GameManager::GetInstance().IsRunning()) {
        //Inputs
        while(SDL_PollEvent(&event) != 0) {
            GameManager::GetInstance().HandleInput();
            player->GetComponent<PlayerControlComponent>()->HandleInput();
        }
        //Update, Drawing, etc..

So as I said, the event variable is now global and both GameManager and Player uses the (only) same event variable.b Now everything works fine, but is that really the only option? (If so, than I don't know why would they allow us to declare multiple SDL_Events.)
So my question is:

Is there a way around this, can I handle multiple input events?

sentences: Is there a library or a framework that handles networking in an RTS? I'm aiming for making a(n) RTS game with networking so instead of doing tedious stuff like networking I wonder if there is a library/framework that will save me the effort. I intend to make that game in Unity if it is of any interest.

sentences:
TiledMap resizing and aspect ratio with LibGDX I'm making a game and I don't know how to resize my TiledMap when the window is bigger but keeping its squared shape.

Here is a screen:

When I change window size, here's what happens:

I want to see all the map with all window sizes.

Here's my GameScreen file

http://pastebin.com/rgKgHskN

Thank you for your help and I'm sorry for those big screenshots and for my english.

sentences:
Garry's Mod gamemode scripting (lua) - How do I tell if an object is inside a hollow cylinder? I'm fiddling about with gMod trying to make a gamemode where you have to throw a piece of cake into a cylinder that spawns on the map.

This is the code I'm using to spawn the cylinder:

local ent = ents.Create( "prop_physics" )
ent:SetModel("models/props_phx/construct/windows/window_curve360x1.mdl")
ent:SetPos( Vector(math.random(100,2500), math.random(1500,-1000), 150) )
--ent:SetPos( math.random(-1500,-2500), math.random(-1500,-2500), 100 )
ent:Spawn()

cleanup.Add( self.Owner, "props", ent )

undo.Create( "Spawned_Cylinder" )
undo.AddEntity( ent )
undo.SetPlayer ( self.Owner )
undo.Finish()

The cake throwing part is basically just a SWEP that shoots the 'cakehat' prop. How would I test whether there is a piece of a cake inside the cylinder?

sentences:
XNA advanced rotation 3D I'm able to rotate any model with any angle I want, where I can not rotate my model around a given point.

e.g: My model rotates from the origin assigned in its .fpx file. I want it to rotate related to a point of its bottom plane, so that it is animated as falling

sentences:
Player is instantly teleported back I built a teleporter that changes a players position and rotation.
He is instantly teleported back. Why?

I'm using the standard FPS Controller.

sentences:
Capsule collider triggered unexpectedly I have an object with a capsule collider on its root, with IsTrigger=true (triggered by the player). The trigger works fine, but is also triggered unexpectedly some times when the player walks near the collider, but still way out of its range.

See attached image: the capsule collider limits are wel within the round circle object. On the right you see that the player has triggered the trigger, while it was far away from the collider.

When I run circles around the collider, this will happen sometimes. Location appears to be random and it doesnt happen if the player is further away than say 10 meters.

Anyone else have this issue or can tell me what is causing it?

sentences:
Putting items into a 3D space Imagine a fridge and a bunch of random foods. I want to take one food item, automatically put it somewhere in the fridge, and repeat. I can stop at any time.

Basically, the filled fridge should look like it has been gradually stocked over the course of a week or so (as opposed to deliberately organized at once) by a calm human being (as opposed to by someone who's just thrown things into it).

Formally, this procedure has to satisfy the following:

Similar items should stack or be next to each other given that there is sufficient space (ex. egg cartons cases go in one stack, 2L milk cartons go side by side)
Other items should not stack until there is no more space left at the bottom
Placed items should be as upright as possible (ex. plastic-wrapped leftovers shouldn't be sideways), unless limited space requires rotation
Items should be put somewhere in the center of the fridge when it is relatively empty (instead of being squished to one side)
The procedure should automatically stop when the fridge no longer has any room left

Ignoring any dividing racks that may be present in the fridge (say it's just one big container), how should this be done? What variables would I need to define with an Item, and/or what algorithms should I use to determine where to put the next item and how to find out which angle of rotation will give me the fit?

sentences:
What is the maximum number of shaders I can have in OpenGL 4? What is the maximum limit of shaders I can have on the GPU?

With 1000 different objects, I might have 1000 * 5 shaders (vertex, tcs, tes, geo, frag) on the GPU at a time. Though only one will be active at once, I wonder what the upper limit is.

sentences:
accelerometer not working unity why is the cube moving when I use a controller, but not with the accelerometer?

void Update () {
    text.text = "X: " + Input.acceleration.x + "; Z: " + Input.acceleration.z;
    //transform.position = new Vector3(10* Input.acceleration.y, 0, 10* Input.acceleration.z);

    transform.Translate(Input.acceleration.x, 0, Input.acceleration.z);

    //transform.position = new Vector3(10* Input.GetAxis("Horizontal"), 0, 10* Input.GetAxis("Vertical"));

    transform.Translate(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
}

(I'm on a Xperia Z3 compact by the way)

sentences:
Why does matrix multiplication lead to different result if it's done on CPU, compared to GPU(shader)? If I'm calculating a "camera space" on the CPU, by multiplying the view with the projection matrix on the CPU , and afterwards multiplying the world to the result my vertices do not pass to the pixel shader (probably because they are thrown of the screen space).

On the other hand if I'm multiplying the world with the view and the result with the projection, all on the GPU the result is right.

What exactly happens on the GPU that doesn't happen when multiplying on the CPU?

sentences:
Slot Probability Function Please can someone point me in the right direction. I'm working on a slot game. that I'm having trouble figuring how to implement the probability function for. The game has a set of symbols that bets can be placed on. A symbol is selected when the start button is pressed. If there is a bet on the symbol that is selected the player wins a value equal to the [bet]*[bet multiplier]. The bet multipliers work as follows:

If the selected symbol is marked with x3 it overrides the normal multiplier and the winning value is equal to bet*3 for that symbol.
If the selected symbol is Apple then the winning value is [bet apple]*5
If the selected symbol is BAR then the winning value is the bet on BAR multiplied by the multiplier on the selected BAR symbol (x50 or x100).
The other symbols are grouped into 2 groups of 3 and share a multiplier value that is selected at the time when a symbol on the board is selected. Eg. the orange, lemon and bell form a group. and share a multiplier of 10, 15 and 20. If the selected symbol is lemon and the selected multiplier is 10 the the winning value is equal to [bet lemon]*10.

There is also a luck symbol that have the following 3 outcomes:

The player looses.
3 Symbols are selected and winning value is the sum of the bets multiplied by their respective multipliers.
A respin is triggered and a new symbol is selected (cannot be a respin but may be one of the other 2 luck outcomes)

The player may also double there winnings by selecting between two options [1-6] or [8-13] a number is generated between 1 and 13 and the winnings are either lost or multiplied by 2.

See the attached pictures for a better understanding of the game.

What I'm having a problem with is figuring out a way to select the outcome of the spin and double feature while maintaining a pay back percentage X% that should hold true over many spins/doubles and that can be adjusted manually.

sentences:
Should there be a limit to how many in game models there is for a 3d MMORPG? I was considering building a character creator/customizer program that would enable a player to create their own 3d model based off of a series of preset body parts. i.e. A player could choose to add the legs of a horse, the body of a man, wings of a falcon and the head of a snake. From there the player can then customize each body part by tweaking sliders responsible for length, thickness, color, position, etc.

Ultimately this will give players the ability to customize their characters with infinite degrees of freedom (not like preset customizations we see in some MMORPGs i.e. 8 hair cuts, 10 faces, 8 body types, etc.). So as you can imagine this would most likely lead to ever player having a different character.

Would having thousands upon thousands of separate 3d character models some how slow the game down?

I consider that it would not because the most characters that would be rendered in the game I am working on would be 25 to 50 if that.

sentences:
Drawing textures off screen optimization required? I recently started using LibGDX and I am wondering if I have to optimize my code when drawing textures/sprites off-screen, just like I used to do with XNA.

My biggest concern here is specifically for the TiledMapRenderer.render() method, which draws a tiled map, imported from the Tiled map editor software.

I don't know how reliable this test I tried was (I just used the Sprite and SpriteBatch class here), but here it is:

// Doesn't cause frame drop
spriteBatch.begin();
for (int i = 0; i < 50000; i++) {
    mySprite.setPosition(i, i); // most of times this is off-screen
    mySprite.draw(spriteBatch);
}
spriteBatch.end()

// Less than 1 frame per second
spriteBatch.begin();
for (int i = 0; i < 50000; i++) {
    mySprite.setPosition(0, 0); // always inside the screen view
    mySprite.draw(spriteBatch);
}
spriteBatch.end();

So, from what I observe, I assume that anything drawn outside of the screen with LibGDX is not being drawn, to improve performance. Is this the case ? If so, in what degree should I be abusing this feature ?

Is LibGDX just checking a couple of logical conditions with the camera/viewport I am using and the u,v coordinates I am trying to draw the texture to and determines if this texture should or should not be drawn ? Or is it a process that takes requires lot of resources from the system ? Keep in mind that I mostly care about the android devices.

Should I be worried about this at all ? Again, TiledMapRenderer.render() is my biggest concern here, but I would also like to know if there is an optimization with drawing textures off-screen in general as well.

sentences:
Tile based map player movement I'm doing a tile based 2d rpg in pygame. The problem I'm working on right now is character movement...
I am already able to create a map by using multidimensional arrays and a 'camera' follows the player.
My problem is now the collision detection... The player should only move one tile at the time so I can easily get his position in tile coordinates and check if he's collided. But I don't know how to do that! At the moment, if a key is pressed, the player moves four pixels in a direction every frame. But that makes tile based collision detection nearly impossible. The player has the size of one tile and yeah, my question is, how can I make the player move only one tile (but NOT every frame since then he would move 32 pixels every single frame.)
I know this question was asked before : Pygame Tile Based Character movement speed  but this wouldn't work for me, because you had to press the key EVERY TIME you want to move one tile. I use booleans so the player moves as long as the key is pressed.

sentences:
Delaying a Foreach loop half a second I have created a game that has a ghost that mimics the movement of the player after 10 seconds. The movements are stored in a list and i use a foreach loop to go through the commands. The ghost mimics the movements but it does the movements way too fast, in split second from spawn time it catches up to my current movement. How do i slow down the foreach so that it only does a command every half a second? I don't know how else to do it.
Please help

this is what i tried :
The foreach runs inside the update method

DateTime dt = DateTime.Now;

        foreach ( string commandDirection in ghostMovements )
        {
            int mapX = ( int )( ghostPostition.X / scalingFactor );
            int mapY = ( int )( ghostPostition.Y / scalingFactor );

            // If the dt is the same as current time
            if ( dt == DateTime.Now )
            {
                if ( commandDirection == "left" )
                {
                    switch ( ghostDirection )
                    {
                        case ghostFacingUp:
                            angle = 1.6f;
                            ghostDirection = ghostFacingRight;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );// add half a second to dt
                            break;

                        case ghostFacingRight:
                            angle = 3.15f;
                            ghostDirection = ghostFacingDown;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );
                            break;

                        case ghostFacingDown:
                            angle = -1.6f;
                            ghostDirection = ghostFacingLeft;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );
                            break;

                        case ghostFacingLeft:
                            angle = 0.0f;
                            ghostDirection = ghostFacingUp;
                            Program.form.direction = "";
                            dt.AddMilliseconds( 500 );
                            break;
                    }
                }
            }
        }

sentences:
Best practice for scrollable viewport rendering I am working on a tile based game that renders the playing surface in a viewport. I am struggling with getting my head around the mechanics and best practices of rendering a viewport, specifically a scrollable viewport.

Typically the entire playing surface is made up of many adjoining tiles, and will display a portion of the surface to the user. The user will be able to scroll around the viewport by dragging or scrolling (North, east, South, west directions)

What would be considered best practice, for example.

would one render and update every tile in the playing surface whether visible or not (I could see this using potentially a lot of processing time on larger maps with processing and needing to update every tile), or;
should one only render what is visible to the user (and a few additional tiles around the edges to ensure that it looks like everything is rendered and avoid holes in the map)

I am quite new to game programming and would appreciate any thoughts and guidance of best practice in this area

sentences:
Calculate the initial velocity of a 3D trajectory I've got a 2D projectile code sample working, but would like to extend it to 3D. How would I calculate the initial velocity of the Z-axis? At the moment, I've got:

initVel.X = (float)Math.Cos(45.0);
initVel.Y = (float)Math.Sin(45.0);

How would I convert this to work in 3D, and add the initial velocity for the Z-axis?

In my example, X is across, Y is up down and Z is going into the screen. I also normalize the vector and multiply it by the speed.

sentences:
How do I contiguously store and iterate over ECS components in C++? I'm writing an entity component system and want to store each type of component separately and contiguously in memory in a way that's easy to iterate over.
Component is a simple base class from which like classes like MoveComponent derive.
I store components inside the World class:
struct World {
    ...
    std::vector<Component> components;
};

This would work fine if there was only one type of component, just a Component class. The problem is I don't know how to handle component subclasses. For example every MoveComponent should be stored contiguously in memory in a way that I can easily iterate over and process them.
I want to avoid this kind of copy-paste junk code for hopefully obvious reasons:
struct World {
    ...
    std::vector<MoveComponent> move_components;
    std::vector<PhysicsComponent> physics_components;
    etc.
};

I'd like to instead structure it in a way that permits iterating over each component of a certain type in a World like, for example, this (inspired by Overwatch's entity component system video, see here):
for (MoveComponent *mc : ComponentIterator<MoveComponent>(world)) { ... }

I'm at a loss as to how to implement this.

sentences:
How to prune an AI game tree for a game like Magic? I've got a game tree structure for my AI that I need to trim in order to gain some depth.

It is a single-player game of perfect information. A good analogy would be a single-player game of Magic the gathering with an oponnenet that plays no card but automaticaly deals you some damage per turn.

Since I don't have an opponent I don't need either minimax (I can do a pure MAX) or a/b pruning.

I got an evaluation function I can use on nodes if necessary. I'm trying to plan ahead and find good combo's of cards to play.

I dont want to hard-code these combos.

I'm finding hard to prune any branch at all since even a branch with bad-scoring node can potentially lead to a good combo that will completely change the game (you know, like : play 5 shitty cards and be almost dead but the 6th card will grant you a win).

Any idea on how to approach pruning in a game tree like that?

sentences:
In 2D, how can I improve character rotation using raycasts when dealing with sharp/convex edges? Edit:

After making some edits to my polygon collider (based on @Alex F's suggestion), I can indeed confirm that sharp, convex corners are causing the buggy rotation. For now I've decided to only rotate my character if its moving, so standing on a corner when velocity.x = 0 won't cause my collider to rotate rapidly. However, this seems like a band-aid fix, and I'm still wondering if there's a better way to handle these edges. Resuming movement after idling on a corner still causes some buggy behavior, and I'm concerned that this will compound once my rotations become more complicated or frequent:

Original question:

I'm quite inexperienced with quaternions and rotating, so I'm not entirely sure if this issue has to do with my code, the collisions shown in this question, or my game design.

What I'm trying to achieve is "smooth" rotation of my character's collider based on  the normal of the current surface. I've been creating a custom raycast controller in 2D from the ground up, and already know how to find all kinds of information from rays, such as the current angle of a sloped surface. My controller is coming along quite nicely, and rotation is one of the last things I'd like to tackle. It should be able to handle sloped box colliders, but also irregular ground shapes that require something like a polygon collider.

I've been somewhat successful, having learned that I shouldn't set my character's z-rotation directly, but instead update my entire transform.rotation with a method like Quaternion.Lerp. This has worked generally well, but I'm running into issues on irregular ground, and on corners.

Notice the smooth transition from flat to sloped surfaces, but that my collider rotates rapidly when the raycast hits a corner:

Movement is still somewhat smooth on irregular terrain, but there is a noticeable shakiness at times. Sometimes my character's collider rotates rapidly as well (end of gif):

I suspect that the shakiness on the irregular terrain is just my collider getting "caught" on the many edges that the polygon collider creates. I just don't know if this is happening because I could be doing something differently in my code, or if I need to edit the polygon collider, or is caused by something else entirely. Perhaps raycasting isn't the best way to achieve my desired behavior.

[SerializeField]
private float speed = 5;
[SerializeField]
private float gravity = -20;
[SerializeField]
private LayerMask collisionMask;

private BoxCollider2D boxCollider;
private Vector2 velocity;
private Vector2 groundNormal;

private void Awake()
{
    boxCollider = GetComponent<BoxCollider2D>();
}

private void Update()
{
    float playerInput = Input.GetAxisRaw("Horizontal");

    velocity.x = playerInput * speed;
    velocity.y += gravity * Time.deltaTime;

    MoveCharacter(velocity * Time.deltaTime);
}

private void MoveCharacter(Vector2 velocity)
{
    //Rotate the character
    Quaternion targetRotation = Quaternion.FromToRotation(Vector2.up, groundNormal);
    transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, 0.5f);

    groundNormal = Vector2.zero;

    CollideBelow(ref velocity);
    transform.Translate(velocity);
}

private void CollideBelow(ref Vector2 deltaMovement)
{
    float rayLength = 1;
    Vector2 rayOrigin = transform.position;

    RaycastHit2D hit = Physics2D.Raycast(rayOrigin, -transform.up, rayLength, collisionMask);
    Debug.DrawRay(rayOrigin, -transform.up * rayLength, Color.red);

    if (hit)
    {
        velocity.y = 0;
        deltaMovement.y = -(hit.distance - boxCollider.size.y * 0.5f);

        groundNormal = hit.normal;
    }
}

sentences:
Why does the X Y Z translations now rotate along with my static meshes? So I was making a map for UT3, using the Unreal 3 Editor provided, and all was going well.

However I was doing some work with InterpActors and Vehicle Spawners, when I must have hit a key by mistake (or other wise somehow changed something) by mistake.

Now the X Y Z translations that are used to move objects around in the editor will rotate along with the object (Ive put images down below to help show what I mean)

This is very annoying because it also changes the direction the arrow keys move a rotated object, in the example below, the Down arrow key will now move the object to the right.

How can I fix this?

(Note both images are taken from the same viewpoint)

Before Rotation:

After Rotation:

P.S. If someone could please provide me with the correct / better name for the X Y Z "things" it would be much appreciated, thanks!

sentences:
Why am I seeing this assertion error during Collada DOM loading? D3DXMATRIX ColladaFileLoader::processMatrix(daeElement* node)
{
D3DXMATRIX matWorld;

daeTArray<daeElementRef> nodeChildren = node->getChildren();

for (int i = 0; i < nodeChildren.getCount(); i++)
{
    string type = nodeChildren[i]->getAttribute("sid");

    if (type == "rotationX")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[0][0];
        stm >> matWorld.m[0][1];
        stm >> matWorld.m[0][2];
        stm >> matWorld.m[0][3];
    }

    if (type == "rotationY")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[1][0];
        stm >> matWorld.m[1][1];
        stm >> matWorld.m[1][2];
        stm >> matWorld.m[1][3];
    }

    if (type == "rotationZ")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[2][0];
        stm >> matWorld.m[2][1];
        stm >> matWorld.m[2][2];
        stm >> matWorld.m[2][3];
    }

    if (type == "location")
    {
        string data = nodeChildren[i]->getCharData();
        stringstream stm(data);

        stm >> matWorld.m[3][0];
        stm >> matWorld.m[3][1];
        stm >> matWorld.m[3][2];
        matWorld.m[3][3] = 1;
    }

}

return matWorld;
}

This function will run run debug assertion failed after it ends the first pass through the loop.  The loop will run correctly, it will enter the last if statement and set all values correctly.  However when the pass is done and before it starts the next pass it will debug assertion failed on me.  I think it is trying to destroy the string type variable but something is breaking when it does tries to delete it.  I don't know what the problem is.  It seems to do this on other parts of my program that get strings from the file and place in std::string.  I fixed those by just removing those entirely but this one cannot be removed it needs to exist.

Don't know if this has anything to do with it, but I'm using visual studio 11 dev preview, and using compiler vs100 (vs10's compiler) settings.

dbgheap.c
Line:1322

Expression: _CrtISValidHeapPointer(pUserData)

also when i use debugger none of my vars from this function show up after the error.

sentences:
How to make a smooth circuit path in Universal tween engine? I tried to make a circuit by starting at point A, with waypoints B and C and final target at A again, and infinite repeats. What happens is that the path from A to B, B to C is smoothed, but path C to A ends with a "sharp" edge

Is there any way to make it totally smooth?

sentences:
OpenGL height map accuracy for planetary rendering I am trying to implement planetary rendering and I am trying to use OpenGL tessellation to model the terrain. Here is an overview picture using cube faces projected onto a sphere:

If I use the following code for the tessellation evaluation shader, I get a smooth sphere even when rendering a near view.
#version 410 core
layout(quads, equal_spacing, ccw) in;
in mediump vec2 texcoord_tes[];
out mediump vec2 texcoord_geo;
uniform mat4 projection;
uniform mat4 transform;
void main()
{
  vec2 c = mix(texcoord_tes[0], texcoord_tes[1], gl_TessCoord.x);
  vec2 d = mix(texcoord_tes[3], texcoord_tes[2], gl_TessCoord.x);
  texcoord_geo = mix(c, d, gl_TessCoord.y);
  vec4 a = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x);
  vec4 b = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x);
  vec4 p = mix(a, b, gl_TessCoord.y);
  float s = 1.0 / sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
  gl_Position = projection * transform * vec4(p.xyz * s * 6388000, 1);
}

Here is a near view using the computed scaling factor (float s = 1.0 / sqrt(p.x ...)):

However if I take the scale factors from a floating-point texture, I can see quantisation artifacts.
The scale factors (or heightmap values) are extracted from the texture using float s = texture(hf, texcoord_geo).r. The code for the tessellation evaluation shader in this case is as follows:
#version 410 core
layout(quads, equal_spacing, ccw) in;
in mediump vec2 texcoord_tes[];
out mediump vec2 texcoord_geo;
uniform sampler2D hf;
uniform mat4 projection;
uniform mat4 transform;
void main()
{
  vec2 c = mix(texcoord_tes[0], texcoord_tes[1], gl_TessCoord.x);
  vec2 d = mix(texcoord_tes[3], texcoord_tes[2], gl_TessCoord.x);
  texcoord_geo = mix(c, d, gl_TessCoord.y);
  float s = texture(hf, texcoord_geo).r;
  vec4 a = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x);
  vec4 b = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x);
  vec4 p = mix(a, b, gl_TessCoord.y);
  gl_Position = projection * transform * vec4(p.xyz * s * 6388000, 1);
}

In this case the near view looks like this and shows artifacts:

My question is, what am I doing wrong?
Or is it normal that OpenGL textures are less accurate than 4-byte floating point numbers?
Any help is appreciated.

sentences:
How can I access LWJGL's Keyboard from a thread other than the graphics thread? I'm loving LWJGL, but have been running into a number of odd problems with it. Most of it seems to deal with the fact that OpenGL is a state-machine and was only ever meant to be accessed from a singular thread.

However, I'm dealing with OpenAL and input as well, and they are both bound pretty tightly into LWJGL. In spite of the fact that they are entirely independent of graphics, I have been getting an IllegalStateException every time I try to access Keyboard.isKeyDown outside of the graphics thread. It's hard to emphasize how important it is to me that I have a new thread for each feature of this project; the classic game loop will not do the job.

How do I accomplish this? There must be a way.

sentences:
Using tilemaps for an isometric football game with cocos2dx I am writing a simple soccer game in cocos2d-x and recently found out that older iOS versions do not support cocos2d sprites larger than 1024x1024px.

I was thinking about using isometric tilemaps to create a larger football field.

Is this the way to go ? If so, how can i convert a  convert my 2048x2048px football field image into several isometric tiles ?

sentences:
Working with lots of cubes. Improving performance? Edit: To sum the question up, I have a voxel based world (Minecraft style (Thanks Communist Duck)) which is suffering from poor performance. I am not positive on the source but would like any possible advice on how to get rid of it.

I am working on a project where a world consists of a large quantity of cubes (I would give you a number, but it is user defined worlds). My test one is around (48 x 32 x 48) blocks.

Basically these blocks don't do anything in themselves. They just sit there.

They start being used when it comes to player interaction.

I need to check what cubes the users mouse interacts with (mouse over, clicking, etc.), and for collision detecting as the player moves.

Now I had a massive amount of lag at first, looping through every block.

I have managed to decrease that lag, by looping through all the blocks, and finding which blocks are within a particular range of the character, and then only looping through those blocks for the collision detection, etc.

However, I am still going at a depressing 2fps.

Does anyone have any other ideas on how I could decrease this lag?

Btw, I am using XNA (C#) and yes, it is 3d.

sentences:
How to perform simple collision detection? Imagine two squares sitting side by side, both level with the ground like so:

A simple way to detect if one is hitting the other is to compare the location of each side. They are touching if all of the following are false:

The right square's left side is to the right of the left square's
right side.
The right square's right side is to the left of the
left square's left side.
The right square's bottom side is above
the left square's top side.
The right square's top side is below
the left square's bottom side.

If any of those are true, the squares are not touching.
But consider a case like this, where one square is at a 45 degree angle:

Is there an equally simple way to determine if those squares are touching?

sentences:
What's the difference between using hardware-accelerated APIs and the OS's drawing API? On Windows, I can do drawing with the OS API without OpenGL or D3D. The code I am writing will make calls to a device driver and tell the GPU what to do regardless, right?

How is using OpenGL different exactly? Do these libraries have code that will interact with the GPU differently than just the Windows API does?

sentences:
In-Depth Lockstep Explanation I'm making a multiplayer game built upon a lockstep system and I'd just like a better grasp on the concept. My main question is on how to get every command to simulate at the same time on every client, or rather, on the same points in each client's timeline. I'm using a fixed update of 10 frames per second for simulating every object's position from movement commands (Click and move style) the same way. How do I tell all clients to execute all commands at the same relative time to the first command?
Note I'm using Unity3D and a sufficiently accurate physics implementation. I just need to get across every command at the correct time.

sentences:
A system that figure out the fastest (not shortest) navigation method between points for 2D spaceship with 2 axes propulsion I am working on a space themed game with space being a 2D pane. The player issue order by clicking on the coordinate for his/her ship to navigate to a certain point on the  pane.
The player ship can:

Propel forward and backward
Strafe starboard and port
Yaw starboard and port

The ship's performance on each direction varies greatly depending on configuration. Some may move faster on sides and back directions than they do forward direction.
I have combined A* and PID control for navigation but couldn't help but noticed that in many occasions where the ship could have accelerate to the full speed and turn towards the target to reach the target faster, it instead turns in place while strafing slowly until it faces the destination before accelerating.
I would like to add another calculation that let the ship knows which navigation approach it should take to minimize the time to reach the target but I have no idea which field of study I should look into or if there is a quick win scenario I could use to achieve an expected outcome.
Please kindly recommend and thank you very much in advance.

sentences:
Data oriented design in physics engine I am new to data oriented design and I am currently developing a physics engine as a hobby project. I am really interested in data orinted design but I am not sure how to apply data oriented design to my physics engine. I am using Box2D as a reference and when I look at the source code, erin catto use linked list as a container for rigid bodies. The reason why he use linked list over array is stated here. This is what he stated at the forum

  I could use an array of body pointers. That would have worse cache
  performance. First you have to get the array element, then the element
  data. I would also need some extra logic to ensure the array is big
  enough.

  I'm not sure how I would use an array of bodies. If I resize the
  array, the pointers become invalid. I could return an index when you
  create a body, but then the array would have holes as bodies are
  freed. Traversing the body array would then involve extra logic to see
  if the body is allocated or destroyed. Also, it may be cumbersome for
  users to have to use an index rather than the object itself. If I
  return the current body pointer from the index, there will likely be
  many bugs where users hold onto that pointer and it becomes invalid.

  Finally, when islands are created the set of bodies is likely no to be
  contiguous in memory.

I will add that when the physics engine do a broadphase collision detection, It will return a list of collider pairs that will most likely located randomly at memory. From what I understand, you need something like handle so the data can be moved around in memory. With handle, you only need to move the last object to the slot that holds the deleted object. Using handle over pointer will add an extra level of indirection which results in more cache misses. So is it really beneficial to store a set of rigid bodies or their components as array?

Edit: I believe there are parts of physics engine that benefit from storing rigid body using array. For example the integration phase. But I am not sure if the benefits outweight the disadvantages.

sentences:
Dynamic game configuration I am not sure how that systems type called, so I try to describe what we want and it will be great if someone can advise…

We have online game with client/server architecture. The game has some configs and this configs must be available for change. Simple example is that we have monster_id 10 with attack_power 15 and our game designers while trying to improve balance, changed attack_power value to 14, so next time, when clients load game, they also load Monster config and monster with id 10 have attack_power 14.

For now, we use Google Sheets as configs “frontend”. We add some custom scripts that allow load this sheet as json on our backend that will compress it, update revision and store in our DB. And when game client booted, backend sends this compressed configs from DB. But the problem is that architecture lack off functionality… I mean, that is hard to ever add simple validation for some rows of sheets, because we need to use google macros and they (as I know) even don`t allow to load external js libraries…

Ofc we can write our backend&frontend for this, but I think that it is as making a bicycle… So, my question is there any system that work with “dynamic configuration” as described above and allow users to customize it, write extension etc.?

sentences:
How to add (not blend) non-looped animation clip to looped animation with Mecanim? I have a GameObject with Animator and looped animation clip.
This animation changes X coordinate from 0 to 10 and back.

I need to add another animation to the first one that increases GameObject's scale and changes its color to red simultaneously.

After scale and color change GameObject keeps these parameters and continues to move according to the first animation clip.

The only way I managed to work it around is writing a custom script with couroutine:

IEnumerator Animate()
{
    float scaleDelta = 0.2f;
    float colorDelta = 0.02f;
    for (int i = 0; i < 50; i++)
    {
        spriteRenderer.color = new Color(
            spriteRenderer.color.r,
            spriteRenderer.color.g - colorDelta,
            spriteRenderer.color.b - colorDelta);

        transform.localScale = new Vector3(
            transform.localScale.x + scaleDelta,
            transform.localScale.y + scaleDelta,
            transform.localScale.z);

        yield return new WaitForSeconds(0.02f);
    }
}

This works for linear interpolation, but requires to write additional code and write even more code for non-linear transformations.

How can I achieve the same result with Mecanim?

Sample project link: https://drive.google.com/file/d/0B8QGeF3SuAgTU0JWNGd2RnpUU00/view?usp=sharing

sentences:
Problems with BlendOp Max I'm trying to write a shader that doesn't blend additively etc etc. I'd like to take whichever of the source or destination colours is brighter and use that and BlendOp Max seemed like the tool for the job.

However, as you can see below, the shadow of one light seems to be occluding the other, which doesn't match up with how I understand BlendOp Max is supposed to work:

Unity Docs
NVidia
OpenGL

Could anyone clarify where I'm going wrong or provide an alternative?

Interestingly, Blend One One is working fine, however, BlendOp Add (along with all the other BlendOps apart from the 'logical' ones) are creating the same issue.

Update

Shader Code:

Shader "Lantern/Flat Pullup" {
Properties {
    _LitTex ("Lit (RGB)", 2D) = "white" {}
    _UnlitTex ("Unlit (RGB)", 2D) = "white" {}
    _Pullup ("Pull up Point", Range(0,1)) = 0.7
    _BlendSize ("Blend Size", Float) = 0.3
}
SubShader {
    Pass{
        Tags { "LightMode" = "ForwardBase" }
        LOD 200

        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        uniform sampler2D _UnlitTex;
        uniform float4 _UnlitTex_ST;
        uniform sampler2D _LitTex;
        uniform float4 _LitTex_ST;
        uniform float _Pullup;
        uniform float _BlendSize;

        uniform float4 _LightColor0;

        struct VI {
            float4 vertex : POSITION;
            float4 tex : TEXCOORD0;
        };

        struct V2F {
            float4 pos : SV_POSITION;
            float4 tex : TEXCOORD0;
            float4 posWorld : TEXCOORD1;
        };

        V2F vert(VI v){
            V2F o;
            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
            o.tex = v.tex;
            o.posWorld = mul(_Object2World, v.vertex);
            return o;
        }

        float4 frag(V2F i) : COLOR {
            float3 flatReflection = _LightColor0.xyz *
                (1 / length(_WorldSpaceLightPos0.xyz - i.posWorld.xyz));

            return lerp(
                tex2D(_UnlitTex, i.tex.xy * _UnlitTex_ST.xy + _UnlitTex_ST.zw),
                tex2D(_LitTex, i.tex.xy * _LitTex_ST.xy + _LitTex_ST.zw),
                clamp((length(flatReflection) - _Pullup + _BlendSize) / (2 * _BlendSize), 0, 1)
            );

        }

        ENDCG
    }

    Pass{
        Tags{"LightMode" = "ForwardAdd"}
        //Blend One One
        BlendOp Max
        LOD 200
        CGPROGRAM
        #pragma vertex vert
        #pragma fragment frag
        #include "UnityCG.cginc"

        uniform sampler2D _UnlitTex;
        uniform float4 _UnlitTex_ST;
        uniform sampler2D _LitTex;
        uniform float4 _LitTex_ST;
        uniform float _Pullup;
        uniform float _BlendSize;

        uniform float4 _LightColor0;

        struct VI {
            float4 vertex : POSITION;
            float4 tex : TEXCOORD0;
        };

        struct V2F {
            float4 pos : SV_POSITION;
            float4 tex : TEXCOORD0;
            float4 posWorld : TEXCOORD1;
        };

        V2F vert(VI v){
            V2F o;
            o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
            o.tex = v.tex;
            o.posWorld = mul(_Object2World, v.vertex);
            return o;
        }

        float4 frag(V2F i) : COLOR {
            float3 flatReflection = _LightColor0.xyz *
                (1 / length(_WorldSpaceLightPos0.xyz - i.posWorld.xyz));
            return lerp(
                float4(0,0,0,1),
                tex2D(_LitTex, i.tex.xy * _LitTex_ST.xy + _LitTex_ST.zw),
                clamp((length(flatReflection) - _Pullup + _BlendSize) / (2 * _BlendSize), 0, 1)
            );
        }
        ENDCG

    }
}
FallBack "Diffuse"
}

Update 2

The same plane and lights rendered using Unity's standard shader, for illustrative purposes.

sentences:
XNA - Update vertices property stored in a VertexBuffer I've a class that creates a cube using VertexPositionColor and these vertices are stored in  a VertexBuffer. Now i would like to dynamically change the color of my vertices. In my class i have a reference to a VertexPositionColor array wich contain all my vertices. I've wrote a SetColor function wich accept a Color in parameter and update each Color property of my vertices. But when i call it, it doesn't work. This is normal because vertices are stored in VertexBuffer and is not updated.

So, how can i update vertices property and keep using VertexBuffer?

sentences:
How to find position of the edge of an object? I have two planes and I want to put both planes one after another so that I can form a road. I set them from the editor and that was very easy but I wanted to do this from code. So in the code:

void Start() {
  secondRoad.position = firstRoad.position;
}

But this just set the second plane in the center of the first plane, kind of overlapping. But I want the second plane to be placed next to the first plane where it ends right the edge of the first plane. How will I do this?

sentences:
What is an acceptable input delay? It is common knowledge that if the framerate of a game is over 25-30 fps, we humans perceive it as running smoothly. More is better, but if it is above that, it at least doesn't lag.

I have been looking for research as to how long  a mouse input can take to reach the screen, and still feel instantaneous to the average person, for example. I'm sure it may vary a little bit, from person to person, but I'm sure we all have a limit on how fast anyone can perceive small time differences between events.

I'm interested in this because I want to try and statically update the data for my game, for example every 0.05 seconds, instead of as soon as I get a new input. This will save computer power, while still not causing delay in the game.

What is an acceptable input delay?

sentences:
Efficient structure for representing a transform hierarchy Can anyone suggest a memory efficient way to represent a tree of matrices, for example in a hierarchy model?

I'm particularly keen to preserve data locality, and I suspect a structure-of-arrays (matrices & indices to matrices) type approach might be suitable.

As well as many chained matrix computations, this structure will probably be copied around in memory a fair bit, so having contiguous storage would be a big bonus.

sentences:
How can I add an impulse to specific rigid bodies at rest? Scenario

Rocks falling down a rocky slope, with a flat surface at the bottom.
When they land on the surface, the rocks move slightly before coming to a rest.

GLESDebugDraw shows the bright orange outline turning to a slightly darker orange once a rock comes to a rest, until the rock is agitated by another falling rock.

Question: I would like to add an impulse to the rock once it reaches the rest state. How would I implement that?

sentences:
Questions about Libgdx This question might be naive, I'm just making sure I grasp the API. Suppose you have an array of 3 objects

Is array.get(o) the same as array.first(); and array.get(2) the
same as array.peek()?

Suppose you have an object moving on screen

Is array.get(o).x the same as array.get(o).getX()

By reading the API it seems to me that x returns position of the object while getX() returns the position of the mouse, or the user's finger whenever he touched the screen. But if that's true then I shouldn't be allowed to use getX() on an object like I did above

sentences:
How to load a separate map from a text file? I have a text file that I am using for my map for the tiles to be allocated. This works fine, but I am running into issues figuring out how I would go about loading in a different part of the map.

For example, say I wanted the character to go into a cave or building, what would be a good way to go about loading this new area?

Right now I have my handler class setting the world in my game state class, and I have tried messing around in the game state class to try and accomplish what I want but have not had much success. In that game state class I have a tick and render method, and in the constructor I have it being set.

The methods that I have tried have resulted in a new map to be loaded in, but the other map is still loaded in under this, and I know this because the character has collisions set up. This also goes along with this issue, but what would be a good way to trigger this loading of the new section of the map?

Below is the code in my GameState class. (changeWorld is based off of the X coordinate when in game, and once you reach a certain point it switches maps; this was just done for testing because it is not an accurate way of doing it).

// Constructor...
    World1 = new Worlds(handler,"resources/Worlds/world1.txt");

    SpawnWorld = new Worlds(handler,"resources/Worlds/world2");

    if(Worlds.changeWorld() == false)
        handler.setWorld(World1);
    }
    else if(Worlds.changeWorld() == true) {
        World1=SpawnWorld;
        handler.setWorld(World1);
        entityManager.setPlayer(new Player (handler, 0,0));
    }
}//end contructor

public void tick() {
    if(Worlds.changeWorld() == false)  {
        World1.tick();
    }
    else if(Worlds.changeWorld() == true){
        World1=SpawnWorld;
        handler.setWorld(World1);
        SpawnWorld.tick();
    }
}//end tick

public void render(Graphics g) {
    if(Worlds.changeWorld() == false) {
        World1.render(g);
    }//end if
    else if(Worlds.changeWorld() == true) {
            World1=SpawnWorld;
            handler.setWorld(World1);
            World1.render(g);
    }
}//end graphics

sentences: Placing a gameobject with restrictions I am newbie in programming and I am making a tower defense game 2d. My problem is I want to make a restriction to place a tower only, if the mother tower is in place or within its range. I'm sorry if my explanation is a bit confusing. For example, you can oly place a certain tower within the range of the mother tower and only if that mother tower is placed. I don't exctly know if I have to create a function for this or create a range game object for the placement attached to the mother tower. Any help and tips would be appreciated, thank you. This is by the way unity C#.

sentences:
How to code UI / HUD in Entity System? I think I already got the idea of the Entity System inspired by Adam Martin (t-machine). I want to start using this for my next project.

I already know the basic of Entity, Components, and Systems. My problem is how to handle UI / HUD. For example, a quest window, skill window, character info window, etc. How do you handle UI events (eg. pressing a button)? These are stuff that doesn't need to be processed every frame. Currently, I'm using MVC to code UI but I don't think that'll be compatible for Entity System.

I've read that Entity System is embedded on a larger OOP. I don't know if UI is outside of ES or not. How do I approach this one?

sentences:
XNA 4 game for both profiles I am writing game in XNA 4 and this version have two profiles hi-def and reach. My problem is that I need to have my game code for each of these profiles and is very uncomfortable to have two projects and do all changes in both of them. My idea was to use preprocessor directive (i am not sure about name of this, http://msdn.microsoft.com/en-us/library/ed8yd1ha%28v=vs.71%29.aspx) and use IF statement at places with problems with profile. There is only problem that program needs to be compiled two times (for each profile) and manually changed directive and project settings to another profile.
And my questions are: Is that good way? Is there better and cleaner way how to do this?

sentences:
Why does my machine render OpenGL using my onboard chipset instead of my graphics card? I'm following an OpenGL tutorial series at opengl-tutorial.org, but have run into a problem:

The following lines:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

cause my glfwCreateWindow() call to return null.

As I understand, this is caused by lack of support for OpenGL 3.3.

Why is my machine trying to render OpenGL 3.3 using my onboard graphics chipset (Intel HD Graphics 3000, which only supports OpenGL 3.1) instead of using my dedicated graphics card (GeForce 520M, which supports OpenGL 4.x)? I think this has something to do with power saving.

Note: I have newly updated nVidia drivers, installed as of yesterday. I know they are working because if I right-click my desktop I get a context menu for nVidia Control Panel.

Running OpenGL Extensions Viewer 4.x also displays that I'm using Intel HD Graphics 3000, supporting OpenGL <= 3.1, which is consistent with my theory regarding power saving.

Regards,

sentences:
Camera movement with slerp I have 3 spots, I would like to move my camera to using slerp. Just As seen in the image below. My question is how I can connect my camera to the first spot? I should be able to move between other spots after I connect my camera to the first spot.

Maybe a better way to ask is how can I make the camera location my first quaternion spot?

sentences:
Skyrim/Papyrus: Random Actor Patrol I saw this question and was hopeful to find the answer to my question, but no such luck:
How do I make someone walk in Skyrim?

I want to, using papyrus ONLY, make Actors that I spawn to travel/patrol to a PatrolIdleMarker, preferably one that I create in the Papyrus script and set the coordinates for.

Example:
I want a bandit to appear at a random location but specific distance from the Player. Then I want the bandit to start moving towards the player, attacking the player. The script below works just fine for this:

ScriptName SomeQuestName extends Quest

ActorBase property LvlBanditMelee1H auto

Int[] BanditStatus
Actor[] Bandits

Event OnInit()
        Int MaxBandits = 11
        Bandits = new Actor[11]
        BanditStatus = new Int[11]
        int i=0
        while(i

Event OnUpdate()
        Float SpawnDistance = 15000.0
        Float ClearDeadDistance = 10000.0
        Float ClearAllDistance = 20000.0
        Int SpawnCounter = 0
        Int MaxBandits = 10
        if (PlayerRef.Z < 20000 && PlayerRef.GetWorldSpace() == Tamriel && (MQ101DragonAttack.IsCompleted() || MQ101DragonAttack.GetStage() > 195))
            int i = 0
            int j = 0
            while(i
                        if(VerboseDebug==1)
                            Debug.Notification("Bandit #" + i + " has wrong BanditStatus.")
                        EndIf
                    Else
                        Distance = PlayerRef.GetDistance(Bandits[i])
                        if((Bandits[i].IsDead() && Distance > ClearDeadDistance ) || Distance > ClearAllDistance )
                            If(BanditStatus[i]==2)
                                Bandits[i].Delete()
                                Bandits[i] = None
                                BanditStatus[i]=0
                            EndIf
                            if(BanditStatus[i]==1)
                                Bandits[i].Disable(true)
                                BanditStatus[i]=2
                            EndIf
                        EndIf
                    EndIf
                EndIf
                i+=1
            EndWhile

    RegisterForSingleUpdate(30.0)

EndEvent

But lets say I wanted the Bandit to just patrol passed the player, replacing the bandit with say an Imperial guard?

ActorBase property LvlGuardImperial auto

Removing one row to stop spawned actor to start attacking the player from a distance:
Bandits[i].StartCombat(PlayerRef)

And instead adding
Bandits[i].EnableAI()
won't work - the imperial guard will stand in one spot, only moving if combat starts close by or if the player comes into proximity and the guard is hostile to the player. If they are friendly the guard will simply stand/talk but not patrol or walk...

I need the codelines for adding creating a PatrolIdleMarker, LinkedReference or something else that I can set X,Y,Z to related to the Player, so that the spawned Actors will patrol passed the point where the player was when they spawned.

I have even tried to make them patrol to PatrolIdleMarkers already defined in vanilla Skyrim (Stable outside Solitude, Barracks in Falkreath etc), but the Actors will just not start patrolling/walking...

It also seems no forums are active anymore when it comes to Skyrim... I am so glad there will be a new release of Skyrim this fall (Skyrim Remastered) and hopefully some old modders will attend the forums again...

sentences:
Libgdx - notification popup (something like Toast) - on both Desktop and Android I'm trying to implement a notification system with LibGDX. As we know, Android has it's Toast which is great, but I can't use it in Desktop mode.

I tried extending Dialog etc, adding as an actor and it all worked, but there's one problem - it still needs to be within the 'stage' object range, cause I have to add the 'notification actor' to the stage.

Do you have any ideas how to implement it in a static way, that the notification dialog/label/window would be 'callable' from the whole app?

Here's my code:

public class Notification extends Dialog {

public enum NotificationType{
    SUCCESS, FAIL, INFO;
}

static Skin skin = new Skin(Gdx.files.internal("data/notificationskin.json"));
Label label;
public Notification(String text, NotificationType type) {
    super("", skin);
    setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()/10);
    setPosition(0, Gdx.graphics.getHeight() + getHeight());
    label = new Label(text, skin);
    add(label).center();

    label.setColor(Color.BLUE);
    setKeepWithinStage(false);
    show();
}

public void show(){

    MoveToAction moveTo = new MoveToAction();
    moveTo.setPosition(getX(), Gdx.graphics.getHeight() - getHeight());
    moveTo.setDuration(2f);

    MoveToAction moveBack = new MoveToAction();
    moveBack.setPosition(getX(), Gdx.graphics.getHeight() + getHeight());
    moveBack.setDuration(2f);

    SequenceAction action = new SequenceAction(moveTo, Actions.delay(1.0f), moveBack, Actions.removeActor());
    addAction(action);

}
}

To show the toast I need to call:

Notification not = new Notification("You're now connected", SUCCESS);
stage.addActor(not);

which is bad - it should be static.

sentences:
Libgdx loading images I can't find a sulotions that solves my problem, I've tried pretty much every tip I can find, but with no luck.

Error :

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: assets/enemy.png

From code:

enemyImg = new Texture(Gdx.files.internal("assets/enemy.png"));

I've linked the asset file from android to desktop as I am supposed to. But still, no luck, the asset file in my desktop-project doesn't even update when I add my image to my android projects asset file.

Please help so I can get started :)

EDIT: Managed to load png now, but I have to manually put the picture in the desktop projects asset folder, so would still appriciate an answer on how to do it automaticly

sentences:
Computing Normals for a displaced material Disclosure: cross-posted on Unreal Answers, thought was sufficiently general for GameDev.SE

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

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

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

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

Calculation:

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

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

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

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

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

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

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

sentences:
How to make a sword swing effect I'm working on a 2d java game on Slick engine and I always wondered how to make swing effects when striking with a sword? How to code something like this what's in the game Hollow Fear? Example from YouTube here.

(Image source)

sentences:
Unity3D: Problems drawing on duplicated texture I'm trying to:

load texture from assets folder
create a clone of said texture that will be manipulated during runtime
set pixels on cloned texture

I have successfully set pixels on the original texture (ie. discarding the code in the start function), but I cannot
seem to be able to draw to the duplicated version.

void Start () {

    canvas = gameObject.GetComponent(typeof(SpriteRenderer)) as SpriteRenderer;
    Sprite oldSprite = canvas.sprite;
    Texture2D oldTex = oldSprite.texture;
    Rect oldRect = oldSprite.textureRect;

    tex = new Texture2D(oldTex.width, oldTex.height, TextureFormat.RGB24, false);
    tex.SetPixels32(oldTex.GetPixels32());
    tex.Apply();

    Rect r = new Rect(oldRect.x, oldRect.y, oldRect.width, oldRect.height);
    Vector2 pivot = new Vector2(oldSprite.pivot.x, oldSprite.pivot.y);
    float pixelsPerUnit = oldSprite.pixelsPerUnit;
    Sprite sprite = Sprite.Create(tex, r, pivot, pixelsPerUnit, 0, SpriteMeshType.FullRect);

    canvas.sprite = sprite;
}

public void draw(Tool tool, Color32 color, List<Vector2> locations) {
    Color32[] pixels = tex.GetPixels32(0);

    for(int i = 0; i < pixels.Length; ++i) {
        pixels[i] = color;
    }
    tex.SetPixels32(pixels);
    tex.Apply();
}

Please ignore the unused vars, I'm just trying to set the whole texture's color for now.

Anyways, any help is always appreciated - thanks :)

sentences:
What are constraints and how are they pluggable? I have been reading this book called "Game Physics Engine Development" and Came across this image in the context of Collision Resolution.

See the contact Generator part. Can someone tell me what are constraints and how there can be different types of them? Thank you.

sentences: Porting libgdx game to iOS using Multi-OS engine - how to add Admob ads I want to port my libgdx game to iOS using Multi-OS (RoboVM is no longer available). I've searched whole internet but can't find any info about how to use Admob with Multi-OS engine on iOS. Every resource I found is about RoboVM, but it's not available anymore since April 17 for new developers (you can only use it if you already have an account, but it's not possible to create a new one). Libgdx with Multi-OS is available in another branch on Github, but there is no info about ads and I want to publish my game this week. Can anyone help me?

sentences:
Predicting circle-circle bounce vector when aiming one at another I am making a game with libGDX (with box2d) in which you drag and aim one circle body at another then release to fire. I would like to be able to predict the path of the second circle based on the aim of the first. very like 8 ball pool when aiming your shot.

I have been playing around with various trig solutions but i just cant get it to work at all! I have also been reading about ray casting in which I would cast a ray from the center of the first circle body in the direction i am aiming. this would tell me where the ray intersects the second circle body (if it does so) but it would not be correct as the circle fixture would not actually collide where they ray does because it obviously has a radius.

Is the trig solution the correct path or is there a simpler way to do this?

sentences:
Adding force to a 3d object in a 2d scene I have a 3d game object placed in a 2d scene (top-down view) in Unity. I want to add force to the object to move it in the direction it's facing. I attached a RigidBody2D component to it and when I use the AddForce() method, it's not working as I want it to i.e. it's moving on only one plane x or y but not in the facing direction.
Please help me.
Edit :- The game is my version of Asteroids. The ship is 3d and the asteroids are 2d. The scene is in 2d. I fixed the 'y' and 'z' rotation of the ship.
Now how do I add force to the ship in the direction its facing ?
The Update method -

void Update() {

    float rotationInput = Input.GetAxis ("Rotate");
    if (rotationInput != 0) {
        float rotationAmount = RotateDegreesPerSecond * Time.deltaTime;
        if (rotationInput < 0) {
            rotationAmount *= -1;
        }
        ship.transform.Rotate (Vector3.down, rotationAmount);
    }
    Vector3 currentRotation = ship.transform.eulerAngles;
    currentRotation.x *= Mathf.Deg2Rad;
    thrustDirection = new Vector3 (Mathf.Sin(currentRotation.x) * -1, Mathf.Cos(currentRotation.x), Mathf.Cos(currentRotation.x));

}

The FixedUpdate method -

void FixedUpdate()
{

    if (Input.GetAxis ("Thrust") > 0) {
        print (thrustDirection);
        ship.AddRelativeForce (ThrustForce * thrustDirection, ForceMode.Force);
    }

}

Thanks in advance.

sentences:
How can I make the camera that follows my character position also follow the character rotation? So I've tried to make the camera also follow my character rotation, I tried using the same process that I did for the position follow, using quaternion and transform.rotation but it was giving me some errors. Since I'm pretty new, I will ask for the best solution for my problem, here's the code:

void Start()
{
    followPos = transform.position - player.transform.position;
}

void LateUpdate()
{
    transform.position = player.transform.position + followPos;
}

sentences:
Rotating a sprite around its center I also use Farseer Physics and Artemis ECS. Here is RenderingSystem Process method:

    public override void Process(Entity entity, TransformComponent transformComponent, RenderingComponent renderingComponent)
    {
        Vector2 dimension = transformComponent.Dimension * camera.ScalingFactor;

        Vector2 rotationOrigin = new Vector2(dimension.X,dimension.Y)/2;

        Vector2 renderingPosition = new Vector2(1, -1) * transformComponent.RenderingPosition * camera.ScalingFactor + camera.BitmapPosition;

        Rectangle rectangle = new Rectangle((int)(renderingPosition.X), (int)(renderingPosition.Y), (int)dimension.X, (int)dimension.Y);

        spriteBatch.Draw(renderingComponent.Texture, rectangle,
            null, Color.Wheat, -transformComponent.Rotation,rotationOrigin, SpriteEffects.None, 0f);
    }

That's what i get:

And that's what I get if

Vector2 rotationOrigin = new Vector2.Zero;

What's the reason for such a weird behavoir of rotationOrigin parameter and how to correctly rotate the sprite around its center?

sentences:
Unity: Drag and drop for tower of hanoi type game I'm a complete noob with Unity, and I want to make myself a small Tower Of Hanoi type game.

I could use some advice on how to do this, but for now, I've settled for a drag and drop system - the player can just drag the discs (or in this case, a panda) sideways from one tower (bamboo) to another.

I looked up some resources online, and also came across the video from qull18creates, but I wasn't sure if using a canvas was the way to go, so I eventually settled on this video by K2niceStudio

Since there will be multiple pandas, I thought it best to put the script in the camera. Here's what I have so far:

using UnityEngine;
using System.Collections;

 public class DraggingScript : MonoBehaviour
 {
     public GameObject objectToDrag;
     public Vector3 objectCenterOriginal, objectCenterNew, objectMouseOffset, mousePosition;

     RaycastHit hit;

     public bool isDragging = false;

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

     // Update is called once per frame
     void Update()
     {
         // Click to Drag
         if (Input.GetMouseButtonDown(0))
         {
             Debug.Log("Button Down");
             Debug.Log(Input.mousePosition);
             // If left mouse button is clicked

             Ray lookForObject = Camera.main.ScreenPointToRay(Input.mousePosition);

             if (Physics.Raycast(lookForObject, out hit))
             {
                 Debug.Log("hit!");   // <------ I've never seen this printed out
                 objectToDrag = hit.collider.gameObject;
                 objectCenterOriginal = objectToDrag.transform.position;
                 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                 objectMouseOffset = mousePosition - objectCenterOriginal;
                 isDragging = true;
             }

             if (isDragging)
             {
                 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                 objectCenterNew = mousePosition;
                 objectToDrag.transform.position = new Vector3(objectCenterNew.x, objectCenterNew.y, objectCenterOriginal.z);
             }
         }

         if (Input.GetMouseButtonUp(0))
         {
             Debug.Log("Button Up");
             isDragging = false;
         }
     }
 }

Unless I made a mistake somewhere, I think it's mostly identical to the video's, with the only exception (AFAIK) being there's already three images in my scene (background, foreground, panda), whereas the video only has one.

However, the video's code works. Mine doesn't. Putting debug logs in the code makes me believe the panda is not being fetched, even if I click on it directly.

Where did I go wrong?
I'm also open to advice, if there's a better way to do this overall.
Thanks.

Here's a shot of my sprites in the Scene:

EDIT:

Apparently, having the camera set back to -10 Z position messed with the selection. I can now select the panda, though it doesn't move at all.

sentences:
Performance problem with chunked LOD I managed to create Zoomable planet. When I get closer to it the respective chunks are splitting and every split holds 4 x 16x16 grid (1024 verts). When getting closer the respective chunks split again and so on. AT the end (let's say when Im on ground), there is so much splits, that when looking on horizont its about 120000 vertices, what is way to much and drops fps to around 7-12. Where I really want like 3-4 layers - near detailed, far less detailed, farest coarse.

I can't get my brain around how to fix this. Any advice appreciated.

sentences: Unity: Keyboard Shortcut to Deselect Game Object How do you unselect a game Object in the 3d view using your keyboard?

sentences:
How do I convert a panorama image into a skybox? I have two panoramas (1, 2) that are the same but are shaped a little different.

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

(Image source here.)

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

sentences:
snapping an angle to the closest cardinal direction I'm developing a 2D sprite-based game, and I'm finding that I'm having trouble with making the sprites rotate correctly. In a nutshell, I've got spritesheets for each of 5 directions (the other 3 come from just flipping the sprite horizontally), and I need to clamp the velocity/rotation of the sprite to one of those directions. My sprite class has a pre-computed list of radians corresponding to the cardinal directions like this:

protected readonly List<float> CardinalDirections = new List<float>
                           {
                               MathHelper.PiOver4,
                               MathHelper.PiOver2,
                               MathHelper.PiOver2 + MathHelper.PiOver4,
                               MathHelper.Pi,
                               -MathHelper.PiOver4,
                               -MathHelper.PiOver2,
                               -MathHelper.PiOver2 + -MathHelper.PiOver4,
                               -MathHelper.Pi,
                           };

Here's the positional update code:

if (velocity == Vector2.Zero)
            return;

        var rot = ((float)Math.Atan2(velocity.Y, velocity.X));
        TurretRotation = SnapPositionToGrid(rot);

        var snappedX = (float)Math.Cos(TurretRotation);
        var snappedY = (float)Math.Sin(TurretRotation);
        var rotVector = new Vector2(snappedX, snappedY);

        velocity *= rotVector;
        //...snip

private float SnapPositionToGrid(float rotationToSnap)
    {
        if (rotationToSnap == 0)
            return 0.0f;

        var targetRotation = CardinalDirections.First(x =>
                (x - rotationToSnap >= -0.01 && x - rotationToSnap <= 0.01));
        return (float)Math.Round(targetRotation, 3);

    }

What am I doing wrong here? I know that the SnapPositionToGrid method is far from what it needs to be - the .First(..) call is on purpose so that it throws on no match, but I have no idea how I would go about accomplishing this, and unfortunately, Google hasn't helped too much either. Am I thinking about this the wrong way, or is the answer staring at me in the face?

EDIT: Thanks Gregory for the answer. Only thing I really had to modify from the answer  was to re-construct the velocity vector to the new snapped rotation (I'm sure there are further optimizations that I can do, but for now it's enough that it works!):

        var snappedX = (float)Math.Round(Math.Cos(TurretRotation), 3) *
                           velocity.Length();
        var snappedY = (float)Math.Round(Math.Sin(TurretRotation), 3) *
                           velocity.Length();
        var rotVector = new Vector2(snappedX, snappedY);

FOLLOW-UP EDIT:
The initial answer worked very well as a naive implementation, but suffered from inaccuracies of up to 45 degrees when dealing with negative angles; -3.14 snapped to -2.356 for instance. To correct that, I added a check to account for those situations.  Below is a complete implementation of a SnapToGrid method. Some optimizations have been made, like pre-computing the various divisors of Pi to avoid the division. Further optimization could possibly be achieved by looking for short-circuit scenarios, i.e. if rotationToSnap ~=0, but if anyone has further optimizations, I'd be curious to see them!

public static float SnapPositionToGrid(float rotationToSnap)
{
    if (rotationToSnap == 0)
        return 0.0f;

    var modRot = rotationToSnap  % MathHelper.PiOver4;

    float finalRot;

    if (modRot < RoundedPiOver8)
    {
        if (modRot < -RoundedPiOver8)
            finalRot = rotationToSnap + -MathHelper.PiOver4 - modRot;
        else
            finalRot = rotationToSnap - modRot;
    }
    else
        finalRot = rotationToSnap + MathHelper.PiOver4 - modRot;

    return (float)Math.Round(finalRot, 3);
}

sentences:
How i can do colisions with irregular hitboxes? I'm developing my new platform engine and i don't know how to program collisions with slopes - I'm using hitboxes.
For the collisions of rectangles i use this:

if (player.rec(Position, level.scale).Intersects(t.rec(level.scale)))

but this doesn't work for sloped collisions or triangular hitboxes.
How can I do this?

sentences:
Which 3D graphic engine to use to target old pc's and old graphic cards? I would like to build 3d applications that are targeted at old PCs for education.  Which 3d engine do you recommend to use?  What technology should I use or approach?  I would like to avoid Unity3d or any other non-free frameworks, as this work I'm doing is voluntarily.

It's main idea is to make learning fun, using 3d simple gaming.  The target PCs are old single cpu Pentium4, or maybe even p3 (:

Thank a lot for helping.

sentences:
How to make (or where to get) a half-sphere mesh that textures properly? I'm making a game in Unity that involves lots of spheres.  Said spheres will have lighting applied to them, but will also be viewed from only one camera angle.  Right now, the full spheres look something like this when textured, normal-mapped, and lit:

This is correct.  The spheres in my game will only be seen head-on, thus I only need to render their top halves.

However, if I use the same material on only half a sphere (with a lower resolution, mind you), I get something like this:

(It's not the exact same material, but it's close enough, and shows the same problem.)

This is incorrect.  The weird part is I only encounter this issue in compiled builds of the game; in the editor, the hemisphere is textured exactly as I expect.

At the request of a commentator, here is one of the textures I'm using:

I'm also using it as a normal map.

My question is thus: how can I make (or where can I find) a hemisphere that can be properly textured, and why does my current hemisphere mesh only render properly in the Unity editor?

sentences:
Getting the winding order of a mesh I'm doing some topological operations on my mesh and I need to know the winding order for my mesh.

Since I will be importing models from different sources I will need to know whether the winding order is clockwise and anti-clockwise so I can get normals and things like that.

Question : Is there a way that I can determine the winding order of a list of vertices.

Edit 1: I am using a 3D mesh

sentences:
Implementing game synchronization between clients and server I'm creating a small online multiplayer game where I have multiple thin clients and an authoritative server. Both the client and the server have a fixed game loop.

Now I have a game entity with the following properties:

X position: float
Y position: float
Direction: float

In the client, the entity is in constant velocity changing its direction based on user input and sends an input event to the server.

[LEFT, PRESSED]: Entity moves to the left
[LEFT, RELEASED]: Entity moves to the right

Every event is queued on the server, and simulated the same way as on the client (calculating the new properties based on trigonometric functions) and the event is send to other players in the room. The other players apply the same simulation to that particular entity (keeping track of what key is pressed for each entity).

Now after some time playing, the position and direction start to drift and stop being in sync. I suspect this has to do with floating-point arithmetic(?)

Is this implementation correct, rather than sending its position and direction every step?
How would I solve this problem?
I think I need to make the server the single source of truth and send regular state snapshots to the the clients to correct possible mistakes/drifting? What would be a good interval to keep the clients up to date?
At the moment, I'm broadcasting an event to every player in the room. What would be a nice approach to only send events to players near the entity? Would a quadtree work here (the same I'm using for my collision detection)?

sentences:
What are valid ranges of space dimensions used in OpenGL? I want to know what the valid ranges of all the spaces in OpenGL are.

Specifically:
Maximum and Minimum Clip space X, Y, and Z (gl_Position)
Maximum and Minimum gl_FragCoord X, Y, and Z
Maximum and Minimum gl_FragDepth value

sentences:
What is the cause of this lighting artifact on my dynamic terrain mesh? I am generating my own terrain mesh in Unity, using pseudo-random noise to determine the height. I construct the mesh using quads, each quad is composed of two triangles.

All seems to be going well, except the terrain does not look right - the quads are very visible. You can see the outline of them on the surface, but I haven't seen this effect before elsewhere. I feel that something is wrong with either my normals or my UV's. I am using just one white directional light.

Dynamic Terrain http://www.spannerworx.com/images/terrain.png

I thought the issue was with the normals, so I stopped calling RecalculateNormals and manually calculated the normal for every vertex using the averaged normal of the sum of each triangle touching that vertex. This was a lot of effort, but made no effect and ended up looking just the same.

Has anyone else seen this dynamic mesh effect before and maybe make some suggestions as to how I could try resolve this?

Just to clarify, I am already generating the triangles myself, two per quad. I do it like this:

for (int t = 0; t < quadCount; t++)
{
    int x = t / (Samples - 1);
    int z = t % (Samples - 1);

    // Calculate quad corner indexes
    int indexBR = CalculateIndex(x + 1, z);
    int indexBL = CalculateIndex(x, z);
    int indexTL = CalculateIndex(x, z + 1);
    int indexTR = CalculateIndex(x + 1, z + 1);

    // Assign indexes for triangles
    // Triangle 1
    triangles[6 * t + 0] = indexBR;
    triangles[6 * t + 1] = indexBL;
    triangles[6 * t + 2] = indexTL;

    // Triangle 2
    triangles[6 * t + 3] = indexBR;
    triangles[6 * t + 4] = indexTL;
    triangles[6 * t + 5] = indexTR;

    // Normals stuff...

}

sentences:
Camera Control Techniques in Games I am an MPhil student in Computing Science working on the problem of camera control in graphics. Though the literature of camera control dates back to the end of 1980s, the majority of them (up to my knowledge) is mainly academic and rarely used in games.

Now part of my thesis should be dedicated to camera control methods used in games. But the problem is that I have not implemented all the games in the world, so I can't speak about them. But I suppose there are some references that game developers usually use.

Can anybody help me with this? Even if it is from your own experience rather than a book.

sentences:
Calculating the number of tiles shown on an isometric map I'm currently changing an existing computer game from a top-down view to an isometric view. The map consists of an infinite number of tiles. Only the tiles which are currently visible in the players window should be shown.

What i know is:

How many pixels the worldmap has been scrolled on x and y axis
The width and height of a single tile
The width and height of the players window

What i need to know is

The coordinates of the first tile to be shown
The amount of tiles that will fit in the players window

To visualize the old approach was something like this (the dashed square represents the players window):

So with the old approach this calculation was pretty simple.

The new one looks like this:

And this is where i'm stuck at the moment. I can't figure out how to calculate which tile is in the upper left corner of the players window and how many tiles fitting inside the players window on the two new axes.

Can anyone help me with that? If yes, it would be really nice if the solution also contains a short explanation.

Thanks a lot in advance.

sentences:
Change the shape of body dynamically I have a problem where i have a ballon which i need to continuously inflate and defalte in update method, I have tried to used setScaleCenter but it is not giving desired result.
Below is a code i am trying to make work

    scale += (float) ((dist-lastDist)/lastDist);
    Log.d("pinch","scale is "+scale);
    Log.d("pinch","change in scale is "+(float) ((lastDist-dist)/lastDist));
    player.setScaleCenter(scale, scale);
    player.setScale(scale);

sentences:
How to instantiate a prefab only when something is hit, and for some seconds? How do I instantiate a prefab only when something is hit for a few seconds? I mean, I just need to activate the particle system when something is hit. Now it always runs, even before I hit something. I need it to activate the particle system when something is hit and for 2-3 seconds.

This is what I do now:

public void Shot()
{
    Destroy(gameObject);
    Instantiate(effect, transform.position, transform.rotation);
}

sentences:
Shadow maps, reducing "shimmering" I'm doing shadow maps, and my shadows move around, "shimmer", when I move around the camera. It is difficult to spot on still images but very much noticable in motion.

I read an MSDN article describing the very same problem - http://msdn.microsoft.com/en-us/library/windows/desktop/ee416324(v=vs.85).aspx - but even with their fix, the problem still very much persists - in fact, I hardly see any difference at all.

Here's how I construct view/projection for my directional light source, and the measures I take to combat "shimmering" yet which does not work - why?

Mat4 CreateDirLightVPMatrix(const Vec3& lightDirection, const Mat4& viewProjectionMatrix, const float shadowMapResolution)
{
    const Vec3 lightDir = glm::normalize(lightDirection);
    const Vec3 perpVec1 = glm::normalize(glm::cross(lightDir, Vec3(0.0f, 0.0f, 1.0f)));
    const Vec3 perpVec2 = glm::normalize(glm::cross(lightDir, perpVec1));

    Mat4 rotationMatrix(Vec4(perpVec1, 0.0f), Vec4(perpVec2, 0.0f), Vec4(lightDir, 0.0f), Vec4(0.0f, 0.0f, 0.0f, 1.0f));

    Vec4 corners[8] = { Vec4(-1.0f, -1.0f, 1.0f, 1.0f), Vec4(-1.0f, -1.0f, -1.0f, 1.0f), Vec4(-1.0f, 1.0f, 1.0f, 1.0f), Vec4(-1.0f, 1.0f, -1.0f, 1.0f),
                        Vec4(1.0f, -1.0f, 1.0f, 1.0f), Vec4(1.0f, -1.0f, -1.0f, 1.0f), Vec4(1.0f, 1.0f, 1.0f, 1.0f), Vec4(1.0f, 1.0f, -1.0f, 1.0f) };
    const Mat4 inverseVPMatrix = glm::inverse(viewProjectionMatrix);
    for (uint32_t i = 0; i < 8; i++)
    {
        corners[i] = inverseVPMatrix * corners[i];
        corners[i] /= corners[i].w;
        corners[i] = corners[i] * rotationMatrix;
    }

    float minX = corners[0].x, minY = corners[0].y, minZ = corners[0].z, maxX = corners[0].x, maxY = corners[0].y, maxZ = corners[0].z;
    for (uint32_t i = 0; i < 8; i++)
    {
        if (corners[i].x < minX)
            minX = corners[i].x;
        if (corners[i].x > maxX)
            maxX = corners[i].x;
        if (corners[i].y < minY)
            minY = corners[i].y;
        if (corners[i].y > maxY)
            maxY = corners[i].y;
        if (corners[i].z < minZ)
            minZ = corners[i].z;
        if (corners[i].z > maxZ)
            maxZ = corners[i].z;
    }

    Mat4 viewMatrix(rotationMatrix);
    viewMatrix[3][0] = -(minX + maxX) * 0.5f;
    viewMatrix[3][1] = -(minY + maxY) * 0.5f;
    viewMatrix[3][2] = -(minZ + maxZ) * 0.5f;
    viewMatrix[0][3] = 0.0f;
    viewMatrix[1][3] = 0.0f;
    viewMatrix[2][3] = 0.0f;
    viewMatrix[3][3] = 1.0f;

    Vec3 halfExtents((maxX - minX) * 0.5, (maxY - minY) * 0.5, (maxZ - minZ) * 0.5);
    // supposed fix from MSDN article - does not have any effect at all
    float texelSize = 1.0f / shadowMapResolution;
    halfExtents.x /= texelSize;
    halfExtents.y /= texelSize;
    halfExtents = glm::floor(halfExtents);
    halfExtents.x *= texelSize;
    halfExtents.y *= texelSize;

    return glm::ortho(-halfExtents.x, halfExtents.x, -halfExtents.y, halfExtents.y, halfExtents.z, -halfExtents.y) * viewMatrix;
}

sentences: Play soundcloud in Unity 3d I'm trying to make a game with cool soundtracks from a bunch of artists. I've made a few playlists in Soundcloud (soundcloud.com) and am trying to get those to play inside of Unity 3d. Is it possible to do that? I can get a mp3 url from the api but then how do I play it? I'm planning to mac and windows. Please help, thanks! <3

sentences:
Mono Develop unable to load plugins or editor When I load up MonoDevelop, it gives me an error, saying how it could not load the C# editor and plugins for my project. I have had this problem for as long as I can remember, and I can still use MonoDevelop to create scripts.
However, MonoDevelop no longer acts like an IDE, more like Notepad+. The lack of plugins causes MonoDevelop to lose even the most basic form of line suggestion. How do I fix this error, and restore the IDE capabilities of MonoDevelop?

Could not load project 'Welp.CSharp.Plugins.csproj' with unknown item type '{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1}'
Could not load project 'Welp.CSharp.csproj' with unknown item type '{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1}'
Could not load project 'Welp.CSharp.Editor.csproj' with unknown item type '{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1}'

sentences:
What would be a fast way of detecting collision between 2 2d rotated rectangles? Currently I am following this tutorial here for 2D collision detection:
http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604

I have found that the way of converting the projected vectors to a scalar value doesn't seem to be correct and there are false reports of collision. I tried to only take the projected x value and using that as a scalar however this runs into the rare corner case of when the axis is pointing up the x values are all 0.

If there is a way to solve this problem it would be great. All help is appreciated.

sentences:
How to center a tilemap in Phaser? In Phaser, I am loading a Tilemap from JSON.

I would like my Tilemap to display in a particular position (for simplicity here I say the middle of the screen).

var map = this.game.add.tilemap('level');
map.addTilesetImage('tiles2', 'tiles2');
var layer = map.createLayer('Ground', map.widthInPixels, map.heightInPixels);
layer.anchor.set(0.5);

//this does not work...
layer.position.set(this.world.centerX, this.world.centerY);

//or even
layer.x = this.world.centerX;
layer.y = this.world.centerY;

The anchor.set works as it should however setting the position does not seem to work.

What am I doing wrong?

sentences:
How to obtain a camera stream from Unity without rendering it to the player's screen? I'd like to stream the output of two cameras to a separate process. Right now, it looks like the best way to do that is to grab the rendered camera views from the screen via platform specific screen capture hooks then compress them real time with h.264. Is there a way to grab the input of the cameras within unity and avoid rendering them to the screen?

One solution I'm considering involves using Unity's multiplayer capability to run the game on a separate machine and grab it from that screen buffer, unbeknownst to the player.

sentences:
Enabling Unity GUI drawtexture permanently? I'm trying to get an image to show in Unity based on a certain criteria.
I would like the position of the image to be randomized every time on play.

However since GUI.DrawTexture shows the image for a single frame only, I end up with the image flashing across the screen in random areas. I would the first location to be randomized and the image to remain still there.

Any advice on how to perform this will be greatly appreciated.

Code:

void OnGUI(){
 if(HP>=0.9f){
   GUI.DrawTexture(new Rect (Random.Range(0,1000), Random.Range(0,700), 500, 300) aTexture);
  }
}

sentences: Are lightmaps also considered textures? I want my game to support phones with max texture size of 1024 so my texture atlases are 1024. My question is: are lightmaps also considered textures and their max size must be 1024? Or they can have higher dimensions like 4096?

sentences:
Click to move - get NavMesh layer I'm using NavMesh, and NavMeshAgent for my character movement and Pathfinding.

I made a testing NavMesh with 2 area layers:

0 = Walkable
3 = Water.

In have a  click to move script, and i need to get the ID of the NavMesh Area where the player clicked. I tried to get the ID of the layer where the player clicked, using NavMeshHit.mask but is always resulting 0, even if I click where the NavMesh area ID is 3.

From Unity documentation:

  Mask specifying NavMesh area at point of hit.

Script:

RaycastHit hit;
NavMeshHit nHit;
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if(Physics.Raycast(ray, out hit)){
    bool hasHit = NavMesh.Raycast (this.transform.position, ray.direction, out nHit, NavMesh.AllAreas);
    if (hasHit) {
        Debug.Log ("Area ID: " + nHit.mask);
        targetPosition = hit.point;
    }
}

sentences:
Is it possible to have a script built-in into a custom resource? Here's a rudimentary custom resource:

extends Resource

export(Resource) var scr

I can drag a pre-made .gd script into this exported property in Inspector, and it works as intended. I can click on the exported property field and embed a resource (like "New ShaderMaterial"), and it would also work as intended, and I would be able to edit that sub-resource normally. However, if I click on the exported property and select "New GDScript", there doesn't seem to be a way to open the new gdscript for editing. Is it possible to embed a gdscript sub-resource the same way you can embed a different sub-resource?

sentences:
Ortbit camera rotation multiplication order with quaternions? So I switched my camera to use quaternions and the first thing I noticed is that things started to 'roll' even though I'm not using any roll values. I looked it up and I found that people suggest that using rotation = horizontal * rotation * vertical solves the issues instead of rotation = rotation * horizontal * vertical which I thought was the more intuitive thing from doing matrix multiplication. The explanations I read as to why one works and the other doesn't were pretty vague and unclear.

My question is: why does it work this way? what's wrong with 'rotation * h * v`?

Sample code:

float Horizontal = 0;
float Vertical = 0;

if (Keys['W'] == Key_Held)
{
    Camera->Position += Camera->Forward() * CamMovSpeed * DeltaTime;
}
if (Keys['S'] == Key_Held)
{
    Camera->Position -= Camera->Forward() * CamMovSpeed * DeltaTime;
}
if (Keys['A'] == Key_Held)
{
    Camera->Position -= Camera->Right() * CamMovSpeed * DeltaTime;
}
if (Keys['D'] == Key_Held)
{
    Camera->Position += Camera->Right() * CamMovSpeed * DeltaTime;
}
if (Keys['E'] == Key_Held)
{
    Camera->Position += vec_Up * CamMovSpeed * DeltaTime;
}
if (Keys['F'] == Key_Held)
{
    Camera->Position -= vec_Up * CamMovSpeed * DeltaTime;
}

// mouse
int dx = Mouse->x - Mouse->LastX; Mouse->LastX = Mouse->x;
int dy = Mouse->LastY - Mouse->y; Mouse->LastY = Mouse->y;
if (Mouse->MMB == Key_Held) // pan
{
    Camera->Position -= (Camera->Up()*dy + Camera->Right()*dx) * SpeedMul/2 * DeltaTime;
}
if (Mouse->RMB == Key_Held) // orbit
{
    Horizontal += dx * SpeedMul*10 * DeltaTime;
    Vertical += dy * SpeedMul*10 * DeltaTime;
}
if (Mouse->Wheel) // zoom
{
    Camera->Position += Camera->Forward() * Mouse->Wheel * SpeedMul*10 * DeltaTime;
}

if (Horizontal != 0 || Vertical != 0)
{
    quat QVertical(vec_Right, -Vertical);
    quat QHorizontal(vec_Up, Horizontal);
    Camera->Rotation = QHorizontal * Camera->Rotation * QVertical; // this works
    //Camera->Rotation = Camera->Rotation * QHorizontal * QVertical; // this doesn't
    Camera->Rotation.Normalize();
}

sentences:
Timer to control the object in XNA I thought this was a great concept; a method that is activated from the constructor when the object is created and in the method, see code below, after 3 seconds call another object to remove it from a list, but unfortunately this isn't working the way I want! There seems to be some problems with the timer, because the call to remove the object is done immediately without any delay! Have I missed something or isn't this possible? Perhaps in another way?

public void ExplosionTimer(GameTime gameTime)
    {
        seconds += (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (seconds > 3)
            objectManager.ExplosionControl();
    }

sentences:
How to predict movement correctly when a player is invisible? I have a multiplayer game and I'm doing client-side prediction, but some players can drink a potion and become invisible...

The problem is that when they become invisible I don't share anything that the client could use to know he's there, so when a player tries to step into a tile occupied by a invisible player, he predicts that he succeeds, and then gets a ugly position correction sent by the server.

One solution would be to share something so the client can tell, but then hackers could use it to find out where invisible players are, cheating.

Btw I already solved regular movement prediction, it works perfectly.

sentences:
Generate a range of number with X being returned most of the time I am attempting to write a RNG which returns a normal-like curve. For example, say I define X to be 4, I would like to generate a range of numbers from 1 to 8, but with 4 being returned most of the time (say 60%).

How can I accomplish this in a way I can easily define X, and the range of the numbers?

sentences:
how to use texture atlas I am trying to implement texture atlas.

1) I am using the texturepackerGUI and the result is taking 2 files , one png (whicj contains all the images and one .atlas (and not .pack).

2) Now , I want to use the above instead of every seperate image.

Right now , I use for example:

private void loadTextures() {
bobTexture = new  Texture(Gdx.files.internal("data/images/bob_01.png"));
blockTexture = new Texture(Gdx.files.internal("data/images/block.png"));
    }

I want to use texture atlas , so instead of the above :

TextureAtlas atlas;
atlas = new TextureAtlas(Gdx.files.internal("data/images/bobs"));  //bobs.atlas
Sprite bobsprite = atlas.createSprite("bob-01");
Sprite blocksprite = atlas.createSprite("block");

Now,I must initialize TextureAtlas I think because it gives me error "Syntax error on token ";", , expected".I don't know how.

3) I put TexturePacker2 in the android project (MainActivity) :

  ...
  AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGL20 = true;
    cfg.useAccelerometer = false;
    cfg.useCompass = false;
    cfg.useWakelock = true;
    TexturePacker2.process("my-gdx-game-android/assets/images/", "/my-gdx-game-android/assets/data", "bobs.atlas");
 ...

The folders inside TexturePacker are ok syntaxed? Or I must remove the "my-gdx-game-android/assets/"?

Thanks!

sentences:
Making objects larger than 1 tile in a pixel art tile map I'm working on a pixel game, and started creating a little town to test some stuff.

My question is whether there is a way to create bigger objects without having to split them into several parts.

My grass tiles and similar are 16 pixels wide, but how do I build a house for example, I want to stay at 16 pixels with all objects but the house would be far too small this way.

I know I can build it by creating the parts separately, but is there an easier way?

sentences:
How can I load a large tile map with cocos2d? I am try to design a cocos2d game with a big world. The world's tile map is very big, maybe 20 iPad screen sizes worth of tiles.

I want to know how to load this using a CCTMXTiledMap? If I directly add it to screen, will it use too much memory? If so, is there a solution to solve this problem?

sentences:
Random Position between ranges Does anyone have a good algorithm for generating a random y position for spawning a block, which takes into account a minimum and maximum height, allowing player to to jump on the block.

Blocks will continually be spawned, so the player must always be able to jump onto the next block, bearing in mind the minimum position which would be the ground, and the maximum which would the players jump height bearing in mind the ceiling

sentences:
Simultaneous Animation for a GameObject - Unity3D Its my second week with Unity. I am doing a 2D game and I have a small GameObject which should change its sprite along with following a definite path defined in Animation Curves.

I did both of them in separate .anim files since the transform animation had many keyframes, i thought it wont be good to put the '2' sprite keyframe repeatedly along side the transform keyframe.

But the problem is, I cant get it both working together at the same time. I dont want any blending because the animation is timed well already.

Also, I tried deleting the sprite change animation and tried it under script changing the SpriteRenderer.Sprite property under Update(); but it works only when the Animator component is disabled in the GameObject.

Any Solutions ? :)

sentences:
Missing texture coordinates for channel 0 Fbx and XNA 4.0 I'm getting this error while trying to load a model in XNA 4.0 :
Error   2   The mesh "transform1", using SkinnedEffect, contains geometry that is missing texture coordinates for channel 0.
The model was dxf format then I upload it to maya then I added some skeleton and some texture (viewed it on the UV) but I still get this error.

this is the load function.

    protected override void LoadContent()
    {
        // Load the model.
        currentModel = Content.Load<Model>("myModel");

        // Look up our custom skinning information.
        SkinningData skinningData = currentModel.Tag as SkinningData;

        if (skinningData == null)
            throw new InvalidOperationException
                ("This model does not contain a SkinningData tag.");

        // Create an animation player, and start decoding an animation clip.
        animationPlayer = new AnimationPlayer(skinningData);

        AnimationClip clip = skinningData.AnimationClips["Take 001"];

        animationPlayer.StartClip(clip);
    }

this is the draw function :

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice device = graphics.GraphicsDevice;

        device.Clear(Color.CornflowerBlue);

        Matrix[] bones = animationPlayer.GetSkinTransforms();

        // Compute camera matrices.
        Matrix view = Matrix.CreateTranslation(0, -40, 0) * // x, y, z
                      Matrix.CreateRotationY(MathHelper.ToRadians(cameraRotation)) * //rotate y
                      Matrix.CreateRotationX(MathHelper.ToRadians(cameraArc)) * //rotate x
                      Matrix.CreateLookAt(new Vector3(0, 0, -cameraDistance),
                                          new Vector3(0, 0, 0), Vector3.Up);

        Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
                                                                device.Viewport.AspectRatio,
                                                                1,
                                                                10000);

        // Render the skinned mesh.
        foreach (ModelMesh mesh in currentModel.Meshes)
        {
            foreach (SkinnedEffect effect in mesh.Effects)
            {
                effect.SetBoneTransforms(bones);

                effect.View = view;
                effect.Projection = projection;

                effect.EnableDefaultLighting();

                effect.SpecularColor = new Vector3(0.25f);
                effect.SpecularPower = 16;

            }

            mesh.Draw();
        }

        base.Draw(gameTime);
    }

PS : 1-My knowledge with Maya & XNA is very limited cause I used to use OpenGL/C++ for some time.

2-Also I change my Content Processor to SkinnedModelProcessor not Model - XNA Framework.
thanks in advance.

sentences:
Building a touch event driven UI from scratch: what algorithms or data types? I have a touch display. As input I can receive the coordinates and how many touch points are in use, basically I just get an X,Y couple for every touch event/activated point at a customizable rate.

I need to start from this and build my own callback system to achieve something like Object.onUp().doSomething() meaning that I would like to abstract just the detection of some particular movements and not having to deal with raw data: what algorithms can be useful in this case? What statements? Is there some C++ library that I can dissect to get some useful info?

Would you suggest the use of an heuristic algorithm?

sentences:
How can I pass a texture to a custom deferred lighting model in Unity? I've replaced the Internal-DeferredShading.shader with my own shader, and it's working fine, but I want to add a uniform texture for it to sample from.

I've tried adding a texture as a property and assigning it a default value in the inspector but at run-time the shader still uses the default value given in the shader (e.g. white).

Is it possible to do this?

sentences:
Need to save UI.Image to png I have ui.Image1 with Mask component and ui.Image2 that is placed inside ui.Image1, then I want to save the result to Texture2d to save the resulting image to png.

Sprite sprite = sourceImage.sprite;
Texture2D newText = new Texture2D((int)sprite.rect.width,(int)sprite.rect.height);
Color[] newColors = sprite.texture.GetPixels((int)sprite.textureRect.x,
                                             (int)sprite.textureRect.y,
                                             (int)sprite.textureRect.width,
                                             (int)sprite.textureRect.height );
newText.SetPixels(newColors);
newText.Apply();

System.IO.File.WriteAllBytes(_SavePath + "photo.png", newText.EncodeToPNG());

but I have the error:

  Texture 'mask' is not readable, the texture memory can not be accessed
  from scripts. You can make the texture readable in the Texture Import
  Settings.

If I change the texture type of 'mask' from Sprite to Advanced - the mask stop work. Let me know what need to do.

sentences: Store custom data against XboxLIVE Gamer in XNA? If I am using Xbox LIVE Gamer Services for a networked XNA game, is there anyway to store custom data against the Gamer or GamerProfile so should they sign-in again even on a different machine I can access it? For example if I want to store their colour choice.

sentences:
Efficiently drawing large numbers of small, moving squares to screen in libgdx I'm trying to make a game which behaves somewhat like The Powder Toy. The world is square and can be filled with particles. Particles are drawn as small squares, constrained to integer positions, and stored in a 2D array, similar to the GOL. Here's what the world looks like:

I've tried a few different approaches of drawing particles to the screen:

Using a ShapeRenderer by calling setColor and rect for each particle. Seems to have been the slowest of the approaches.
Using a SpriteBatch to draw a Pixmap for each particle.
Writing asynchronously to a Pixmap, storing the Pixmap in a Texture, then drawing the Pixmap with a SpriteBatch.

Although these approaches work, I'd be interested in hearing about other, possibly more efficient ways to render the particles. Could VBO be used here? Or is it not accessible from within gdx?

sentences:
IntersectMovingAABBAABB weird behavior I'm using the IntersectMovingAABBAABB implementation from the book Realtime Collision Detection and I'm having a little bit of an issue. When I have two AABBs next to each other (not touching), A being stationnary and B moving up or down, I'm getting a result saying there's a collision. Obviously this is wrong.

 _______     _______
|       |   |       |
|   A   |   |   B   |  B moving up/down
|_______|   |_______|

I've rechecked my code multiple times to make sure I had the same thing as in the book. Stepping through the code, I realized that the check for v[i] < 0 and v[i] > 0 will never be true for either X or Z axis when moving straight up or down. Therefor, no checks for intersections on these axis will be done. I find that quite weird, and I was wondering if I was missing something, or if this code is simply bad.

Here's my implementation for reference:

public static bool IntersectMovingAABBAABB(AABB a, AABB b, Vector3 va, Vector3 vb, out float first, out float last, out BlockFace face)
{
    face = BlockFace.None;
    if (TestAABB(a, b))
    {
        first = last = 0;
        return true;
    }

    Vector3 v = vb - va;
    float current;

    first = 0;
    last = 1;

    for (int i = 0; i < 3; i++)
    {
        if (v[i] < 0)
        {
            if (b.Max[i] < a.Min[i]) return false;
            if (a.Max[i] < b.Min[i]) if ((first = Math.Max(current= (a.Max[i] - b.Min[i]) / v[i], first)) == current) face = (BlockFace)(1 << (i));
            if (b.Max[i] > a.Min[i]) last = Math.Min((a.Min[i] - b.Max[i]) / v[i], last);
        }

        if (v[i] > 0)
        {
            if (a.Max[i] < b.Min[i]) return false;
            if (b.Max[i] < a.Min[i]) if ((first = Math.Max(current = (a.Min[i] - b.Max[i]) / v[i], first)) == current) face = (BlockFace)(1 << (i + 3));
            if (a.Max[i] > b.Min[i]) last = Math.Min((a.Max[i] - b.Min[i]) / v[i], last);
        }

        if (first > last) return false;
    }

    return true;
}

sentences:
Unity baked lighting - blotchy shadows, bleeding and/or stiching I have spent days trying to get baked lighting to look good. I use a simple low-poly style. No matter what I do, I get this type of effect (blotchy shadows and odd dark lines):

Here are my settings:

Baking a scene already takes around 4 hours, not sure I can increase the resolution any more without Unity crashing during the bake. Am I doing something wrong? Feel like Ive tried everything.

sentences:
Rotating an object continously in UNITY with onclick I have a script that works but it does not do what I want it to do. My script makes an object rotate on when another is clicked. However, I want the object to continuously rotate until I click on the other object again. Right now when I click it rotates just a bit and stops.

Here is my script

 using UnityEngine;
 using System.Collections;

 public class Rotate : MonoBehaviour {

public float speed =50f;
public GameObject target;

public void OnMouseDown(){

    target.transform.Rotate (new Vector3(0, Time.deltaTime, 0) * speed);

}

 }

Any assistance? I created what I have now using what I found on the internet but cant find another solution.

sentences:
3D Zoom To Mouse Cursor accounting for Change in Camera Pitch Overview:

Simply put, I'm trying to make a zoom to cursor algorithm. This would normally be very simple, but the implementation of the camera is making it difficult.

As the camera zooms in and out, the pitch of the camera (angle relative to the ground) changes. At its farthest position from the ground, it looks nearly directly at the ground, and at its closest position, it looks at about a 40 degree angle toward the ground.

This greatly complicates the method for zooming into a mouse position on a non-uniform 3d terrain.

Specifics:

More details for those who are still interested in trying to help.

The camera is implemented in unreal engine using a spring-arm (basically a large stick) attached to an actor that serves as the center of the screen. Zooming in and out simply requires us to shorten the spring-arm and change the angle of the spring-arm. moving the camera around the world is done my moving the actor around the plane at z=0 (0 height).

The problem then becomes: Where should my actor be after zooming in such that the point that the cursor is over doesn't change?

There is already an algorithm in place to determine the current pitch of the camera and the new pitch of the camera, so you can assume that information is already known. We can also easily find the new height of the camera, and the new distance between the camera and the actor (length of the spring-arm). We can fairly easily determine the point the cursor is over in the game world, and we can determine that point when it is projected along the plane at z=0.

I had originally tried implementing this using a naive solution based on some 2D trigonometry, but this didn't account for the direction that the new actor position would be in relative to the cursor position after the translation occurs. After working on this for as long as I have, I'm having trouble coming up with a new solution that also finds this value.

I'm thinking now that I can use an alternative method that would involve drawing a plane with the same normal as the camera using the vector directions of the actor and cursor position as corners, then rotating about a line going through the cursor position and scaling the new triangle to make it identical to the previous one when viewed from the camera. This, though, seems like it would be unnecessarily complicated, and expensive to implement.

I was wondering if anyone had a simpler solution (or any solution for that matter) that they know of for this problem. Or at least if anyone has some kind of direction they could point me in for finding out how I might be able to solve this problem in a reasonable amount of time without it being too computationally expensive.

Let me know if you need any more details.

(Programming language is kind of irrelevant here, so feel free to use whatever you want for explanation or examples, or just use English or pseudo code. I don't really expect anyone to write me an algorithm to do this, I'd just like some ideas on how I ought to approach this problem to keep me from ripping off my head)

Thanks,

Zac Taylor

sentences:
Character bobs when moving Whenever I try to move a character in unity, the character kind of, like, bobs around when walking. Is there any way to remedy this? I have tried the trick of putting the inputs into update and the outputs into fixedupdate, if that's any consolation. Also please ignore the fact that I've used the arrow keys instead of getaxis.
using System.Collections.Generic;
using UnityEngine;

public class MovePlayer : MonoBehaviour
{

    public bool upArrow = true;
    public bool downArrow = true;
    public bool leftArrow = true;
    public bool rightArrow = true;
    public float speed;
    public bool test = false;

    void Update()
    {
        if (Input.GetKey(KeyCode.UpArrow))
        {
            upArrow = true;
        }
        else
        {
            upArrow = false;
        }

        if (Input.GetKey(KeyCode.DownArrow))
        {
            downArrow = true;
        }
        else
        {
            downArrow = false;
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            leftArrow = true;
        }
        else
        {
            leftArrow = false;
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            rightArrow = true;
        }
        else
        {
            rightArrow = false;
        }

    }

    void FixedUpdate()
    {

        if (upArrow == true)
        {
            transform.position = new Vector3(transform.position.x, transform.position.y + speed, 0);
        }

        if (downArrow == true)
        {
            transform.position = new Vector3(transform.position.x, transform.position.y - speed, 0);
        }

        if (leftArrow == true)
        {
            transform.position = new Vector3(transform.position.x - speed, transform.position.y, 0);
        }

        if (rightArrow == true)
        {
            transform.position = new Vector3(transform.position.x + speed, transform.position.y, 0);
        }

    }

    void OnTriggerEnter2D(Collider2D bump)
    {

        if (bump.gameObject.tag == "Wall")
        {

            test = true;

        }
        else
        {

            test = false;

        }

    }

}
```

sentences:
Real-time fluid simulation? I'd like to create a system in Unreal Engine 4 with glob-like fluids which interact with the environment, like the gel in Portal 2. Here's a GIF of the gel from that:

(search that I used to bring up similar images)
I was wondering how it might be possible to do something like this? An in-depth guide would be nice as I have a mostly basic understanding of blueprints in UE4, although I know it's a lot to ask for. If you know how I can achieve this, please let me know. Thank you! :)
P.S: The "fluid" stains don't need to give effects such as speed like you saw in the GIF, but I would still like the liquids to stain wherever they hit. :)

sentences:
“Play Now” via website vs. download & install I've spent some time looking over the various threads here on GDSE and also on the regular Stackoverflow site, and while I saw a lot of posts and threads regarding various engines that could be used in game development, I haven't seen very much discussion regarding the various platforms that they can be used on.

In particular, I'm talking about browser games vs. desktop games.

I want to develop a simple 3D networked multiplayer game - roughly on the graphics level of Paper Mario and gameplay with roughly the same level of interaction as a hack & slash action/adventure game - and I'm having a hard time deciding what platform I want to target with it. I have some experience with using C++/Ogre3D and Python/Panda3D (and also some synchronized/networked programming), but I'm wondering if it's worth it to spend the extra time to learn another language and another engine/toolkit just so that the game can be played in a browser window (I'm looking at jMonkeyEngine right now).

Is it worth it to go with engines that are less-mature, have less documentation, have fewer features, and smaller communities* just so that a (possibly?) larger audience can be reached? Does it make sense to even go with a web-environment for the kind of game that I want to make? Does anyone have any experiences with decisions like this?

(* With the exception of Flash-based engines it seems like most of the other approaches have downsides when compared to what is available for desktop-based environments. I'd go with Flash, but I'm worried that Flash's 3D capabilities aren't mature enough right now to do what I want easily. There's also Unity3D, but I'm not sure how I feel about that at all. It seems highly polished, but requires a plugin to be downloaded for the game to be played -- at that rate I might as well have players download my game.)

For simple & short games the Newgrounds approach (go to the site, click "play now", instant gratification) seems to work well. What about for more complex games? Is there a point where the complexity of a game is enough for people to say "OK, I'm going to download and play that"?

sentences:
Updating children nodes in a game engine I am writing my own small game engine (thin layer based on SDL2) in C++. My base class is Node (contains information on an entity's position, scale, rotation, etc.), And I've got two special subclasses, Layer and Scene.

Node
|_SpriteNode
|_RectNode
|_...
|_Layer
  |_Scene

A layer can have Node children. Each time the loop runs, I call the update(int timeInterval) method on the scene being rendered, and the method loops through the vector<Node*> field containing my children. Layers propagate that call to their children, etc.

This works well until I start adding/removing children during the update. My first implementation of Layer had those two methods:

void Layer::addChild(Node* child)
{
    if(!child) return;
    _children.push_back(child);
}

void Layer::removeChild(Node* child)
{
    _children.erase(child)
}

This is, of course, stupid, since removing a Node from the vector would cause a null pointer error when the update loop ( for (auto child: _chidren) ). Using an iterator instead could fix this, but when a Node calls _parent.removeChild(this), it does not know about the iterator being used for that frame.

The solution I use at the moment is having an addition and a deletion buffer in the Layer, to which new and deleted nodes are added during the frame update. Once the frame has been rendered, the Layer performs the actual insertions and deletions from its children array. It works, and I've made a Game Jam game with this, but is seems more than sketchy to me.

I have looked through Cocos2D-X source code, and they use a simple push_back() or erase() call, which makes me think I'm missing a bigger point, or some trick that prevents the iterator issue. Is there something obvious (or not) that I missed?

Sorry if the question is dumb or missing a point. I hope I documented everything enough :)

sentences:
Rotating hitboxes in PyGame? I'm using pygame.rect.colliderect() to check hitbox collision between sprites in my game, but now that I'm rotating the sprites, I'm realizing I can't do this because there's no way to rotate a PyGame rect, so the hitboxes are way off now.

How should I handle collision in a game with rotating sprites if I don't want to use masks or pixel perfect collision? Is there a way to make a hitbox that rotates with the sprite?

sentences:
How can I fill a Color[] from a Texture2D given a Rectangle in SharpDX? I used to fill a Color[] using XNA's

Texture2D.GetData<T>(int, Rectangle?, T[], int, int)

method, but there doesn't seem to be an equivalent overload on SharpDX's Texture2D. Anyone know how I can get this same functionality with SharpDX?

EDIT

How can I fill a Color[] from a SharpDX.Toolkit.Graphics.Texture2D given a Rectangle in SharpDX?

sentences:
Round position to center of current grid position The title may not make sense, nor may the question - I'll try nevertheless.
I'm attempting to make a game similar to The Powder Toy.
Essentially, this is a physics simulation game, where the users create various structures using the provided materials.
As of now, I've created the grid, and given the user the ability to draw with grey cells (or, Stone).
Of course, this may seem like what I would want - however, all the cells are stored in a two dimensional array. When the user clicks on the screen, the program round the x and y of the cursor to the grid, and adds to the array like that.
What I want to happen is for the cell to change in the place of the cursor, instead of rounding it to the nearest cell.
I've attempted to explain it in this image:

In this image, the green large dots are the mouse position, and the place at which the arrows are pointing are examples of where the cell could be.
Green represents what I want to happen but in most cases doesn't, and red is what does happen, but what I don't want.

Here's part of my function to set the cells:

public void handleInput () {
    if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
        mouse_x = Gdx.input.getX();
        mouse_y = Gdx.input.getY();

        rou_mouse = new Vector2(round2px(mouse_x), round2px(mouse_y));

        set_px (rou_mouse, new Element_stone());
}

Where set_px sets a certain item, this is used to draw to the screen.
I hope this is enough information, but if you would need anymore to solve it, I'd be happy to update the post to include more code.

Oh, and I should probable mention I'm using LibGDX.

sentences: Can someone help me with my mario-inspired timer scoring system? I am new to GameMaker's coding language or GML. I have learned and done a lot so far, but now i am having a problem. I have a countdown timer starting at 5 minutes counting down and I want the player to receive points based on how much time is left kind of like in Super Mario Bros. along with the points accumulated for performing other tasks. How do I go about doing this with the coding language? Thanks in advance!

sentences:
Where will my character stop? Many years ago I coded some AI for a budget pseudo-3d game. There was one calculation which I never really figured out the best way to do, and that was calculating where the enemy would end up if it stopped now. For example:

The enemy is currently at X = 540.0.
The enemy is moving right at 10 pixels per frame.
When the enemy wants to stop, it's speed will drop by 1 pixel per frame until it reaches zero.

Is there a simple formula that would get me the position where the enemy ends up when he is fully stopped? I ended up precalculating and hardcoding the offset which worked for my needs but would have to be calculated separately for enemies with different speeds.

sentences:
Put layout over Surfaceview I have this problem: I'm trying to create new RelativeLayout over whole screen - which also contains SurfaceView in the middle - and display some things on this RelativeLayout (in my case Imageview containing animation). Almost everything is working ok - Imageview is displayed, animation is working... but SurfaceViews drawings (Bitmaps) are on the top of my RelativeLayout with Imageview, which I'm trying to appear it on top.

Calling bringtofront() doesn't work. Although I've created RelativeLayout with ImageView after SurfaceView, it's still below it.

So my question is: how to bring this RelativeLayout with ImageView to the top of SurfaceView?

In Activity:

// Layout, on which I'm adding Surfaceview programmatically
RelativeLayout layout = (RelativeLayout) findViewById(R.id.middle_layout);
layout.addView(new SurfaceView((getApplicationContext())));

// Layout which should be top over everything
RelativeLayout topLayout = new RelativeLayout(getApplicationContext());
RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(
                                 RelativeLayout.LayoutParams.MATCH_PARENT,
                                 RelativeLayout.LayoutParams.MATCH_PARENT);
topLayout.setLayoutParams(rlp);

// Although I'm adding SurfaceView first and Relative second, no hierarchy order is visible...
layout.addView(topLayout);
// OR
root_layout.addView(topLayout);
// ^ Both attempts are displayed under SurfaceView

SurfaceView class:

public class SurfaceView extends SurfaceView implements SurfaceHolder.Callback
{
    public SurfaceView (Context context)
    {
            super(context);

            getHolder().addCallback(this);

            this.setZOrderOnTop(true);

            getHolder().setFormat(PixelFormat.TRANSPARENT);

            setFocusable(true);
    }

    ...
}

PS: I need to create SurfaceView programmatically.

Thanks for any help!

sentences:
Inconsistent accessibility: parameter type is less accessible than method I have a level class in which I make a new turret. I give the turret the level class as parameter. So far so good.
Then in the Update function of the Turret I call a function Shoot(), which has that level parameter it got at the moment I created it.

But from that moment it gives the following error:

  Inconsistent accessibility: parameter type 'Space_Game.Level' is
  less accessible than method
  'Space_Game.GameObject.Shoot(Space_Game.Level, string)'

All I know it has something to do with not thr right protection level or something like that.

The level class:

    public Level(Game game, Viewport viewport)
    {
        _game = game;
        _viewport = viewport;
        _turret = new Turret(_game, "blue", this);
        _turret.SetPosition((_viewport.Width / 2).ToString(), (_viewport.Height / 2).ToString());
    }

The Turret Class:

        public Turret(Game game, String team, Level level)
        :base(game)
    {
        _team = team;
        _level = level;

        switch (_team)
        {
            case "blue":
                _texture = LoadResources._blue_turret.Texture;
                _rows = LoadResources._blue_turret.Rows;
                _columns = LoadResources._blue_turret.Columns;
                _maxFrameCounter = 10;
                break;
            default:
                break;
        }

        _frameCounter = 0;
        _currentFrame = 0;
        _currentFrameMultiplier = 1;
    }

    public override void Update()
    {
        base.Update();

        SetRotation();
        Shoot(_level, "turret");
    }

The Shoot Function (Which is in GameObject class. The Turret Class inherited the GameObject Class. (Am I saying that right?)):

protected void Shoot(Level level, String type)
    {
        MouseState mouse = Mouse.GetState();
        if (mouse.LeftButton == ButtonState.Pressed)
        {
            switch (_team)
            {
                case "blue":
                    switch (type)
                    {
                        case "turret":
                            TurretBullet _turretBullet = new TurretBullet(_game, _team);
                            level.AddProjectile(_turretBullet);
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }
        }
    }

sentences:
Does LibGDX share preferences with Android API? Can I get a value from LibGDX preferences like this:

Preferences preferences = Gdx.app.getPreferences("someName");
int value = preferences.getInteger("intValue");

And then in the same project, in a different activity, do this:

SharedPreferences preferences = getSharedPreferences("someName",Context.MODE_PRIVATE);
int value = preferences.getInt("intValue",0);

So assuming there is a value already stored, would both methods retrieve the same value?

sentences:
LibGDX - Textures rendering at wrong position Update 2:

Let me further explain my problem since I think that i didn't make it clear enough:
The Y-coordinates on the bottom of my screen should be 0. Instead it is the height of my screen. That means the "higher" i touch/click the screen the less my y-coordinate gets.
Above that the origin is not inside my screen, atleast not the 0 y-coordinate.

Original post:

I'm currently developing a tower defence game for fun by using LibGDX.
There are places on my map where the player is or is not allowed to put towers on.
So I created different ArrayLists holding rectangles representing a tile on my map. (towerPositions)

for(int i = 0; i < map.getLayers().getCount(); i++) {
            curLay = (TiledMapTileLayer) map.getLayers().get(i);

            //For all Cells of current Layer
            for(int k = 0; k < curLay.getWidth(); k++) {
                for(int j = 0; j < curLay.getHeight(); j++) {
                    curCell = curLay.getCell(k, j);

                 //If there is a actual cell
                if(curCell != null) {
                    tileWidth = curLay.getTileWidth();
                    tileHeight = curLay.getTileHeight();
                    xTileKoord = tileWidth*k;
                    yTileKoord = tileHeight*j;

                    switch(curLay.getName()) {

                     //If layer named "TowersAllowed" picked
                    case "TowersAllowed":
                        towerPositions.add(new Rectangle(xTileKoord, yTileKoord,  tileWidth, tileHeight));

// ... AND SO ON

If the player clicks on a "allowed" field later on he has the opportunity to build a tower of his coice via a menu.
Now here is the problem: The towers render, but they render at wrong position. (They appear really random on the map, no certain pattern for me)

for(Rectangle curRect : towerPositions) {
            if(curRect.contains(xCoord, yCoord)) {

                //Using a certain tower in this example (left the menu out
                if(gameControl.createTower("towerXY")) {

                    //RenderObject is just a class holding the Texture and x/y coordinates
                    renderList.add(new RenderObject(new Texture(Gdx.files.internal("TowerXY.png")), curRect.x, curRect.y));
                }
            }
        }

Later on i render it:

game.batch.begin();
    for(int i = 0; i < renderList.size() ; i++) {
        game.batch.draw(renderList.get(i).myTexture, renderList.get(i).x, renderList.get(i).y);
    }
game.batch.end();

regards

sentences:
Which axis-aligned line does an AABB collide with first? I am making the collision resolution system for my 2d top-down game, and I managed to find a solution where I query which surfaces of other AABBs the current entity can collide with in the next frame.

To resolve the new location of the player however, I need to find which surface the entity collides with first.

I have a list of lines, which is LinkedList<int[4]> collidedLines. a line is {x1,y1,x2,y1}, however in this case, they are axis-aligned, so either x1==x2 or y1==y2.

I also have the entity, which has the following properties:

int posX
int posY
int speedX  // The amount to move in the
int speedY  // next step of the game.
int size  // The halfwidth of the square AABB.

How can I find the first line the entity collides with? Thanks for your help!

sentences:
Soft Body Collision with Box2d (libGDX) I've made a few classes to create soft body objects in libGDX using Box2D (specifically a circle and rectangle similar to these links).

The objects are constructed of a number of circle shaped Box2D bodies (hereafter deform points) connected together by distance joints which allow the object to "deform" when the deform points move around. Collision works more or less fine when the objects are colliding with other standard Box2D rigid bodies such as a box polygon (what they're sitting on):

The problem starts when two soft bodies collide. As you can probably guess from the way they're constructed, the two often pass through each other since the deform points for which Box2D handles collision are small and spaced apart, so they easily don't collide when the two soft bodies should. If the two bodies are placed like seen on the left in the following image, the circle passes through the square, rather than bouncing off the top of it as it should:

I've tried solving the problem (methods shown below) by tessellating the bodies more so that the deform points are closer together (left), which seems far too resource intensive and didn't affect much anyway. Then I tried enlarging the size of the deform points to fill the gaps (middle), which worked perfectly for the collision but as you can see caused problems mapping the texture to the object since the textures don't appear to collide. After that I tried to bound the outside of the object using polygon bodies connected between deform points using revolute joints, this works with the texture better and does prevent objects from falling through each other, but it stops the object from deforming properly.

I can't think of any more ways to tackle this problem, but I'm very new to Box2D and libGDX and maybe I'm overlooking a much more simple solution. I'll give any ideas a shot.

sentences:
Prevent player from jumping on a mesh I am working on a game and I have a mesh that I use to block hallways and prevent the player from going that direction. They are placed vertically with slight angles. I'm having a problem that the player can jump up on these. The player needs to be on the ground all the time otherwise they will be able to avoid dying indefinitely. I have tried moving and rotating and no matter how its placed I can always seem to jump on it. I want to avoid adding more to the scene then what is necessary so I don't want to add another mesh or extra collision of some kind just to keep the player away from those points as that mesh already has collision. Unless it turns out that is actually a good way to handle this.

Is there a way I can prevent the player from jumping on these items? Or is there some other way I can handle if the player does jump up on them. Like maybe start damaging the player after a few seconds until they get down? What is a proper way of handling this?

sentences:
LibGDX with SoundPool I'm developing a game for Android using LibGDX in Android Studio.
I recently found out that some sounds in my game fail to play. I noticed that every time a sound fails to play, these are the logs:

04-12 10:49:51.784 24234-24283/com.gadarts.parashoot.android E/AudioTrack: AudioFlinger could not create track, status: -12
04-12 10:49:51.785 24234-24283/com.gadarts.parashoot.android E/SoundPool: Error creating AudioTrack
04-12 10:49:52.503 24234-24283/com.gadarts.parashoot.android W/AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 4, track 44100 Hz, output 48000 Hz

This is the code I use to play the sounds:

public long playSound(SFX fileName, boolean loop, float volume, boolean randomPitch) {
        if (GameSettings.SOUND_TOGGLE) {
            try {
                Sound sound = prepareSound(fileName);
                if (randomPitch && GameSettings.SOUND_RANDOM_PITCH) {
                    return setRandomPitch(loop, sound, volume);
                }
                if (loop) {
                    return sound.loop(volume);
                } else {
                    return sound.play(volume);
                }
            } catch (GdxRuntimeException e) {
                e.printStackTrace();
            }
        }
        return -1;
    }
private Sound prepareSound(SFX soundFile) throws GdxRuntimeException {
        try {
            String soundPath = SFX.fileAttribute.SFX_FOLDER_NAME.getValue() + "/" + SFX.fileAttribute.SOUNDS_FOLDER_NAME.getValue() + "/" + soundFile.getParentDir().getValue() + "/" + soundFile.getValue() + "." + soundFile.getFormat().getValue();
            Sound sound;
            if (!sounds.containsKey(soundFile.getValue())) {
                sound = Main.getAssetsManager().get(soundPath, Sound.class);
                sounds.put(soundFile.getValue(), sound);
            } else {
                sound = sounds.get(soundFile.getValue());
            }
            if (sound == null) {
                throw new GdxRuntimeException("preparing sound failed - sound not found.");
            }
            return sound;
        } catch (GdxRuntimeException e) {
            throw e;
        }
    }

The sound files are in WAV format.
Any ideas how to fix it? Thanks in advance!

Update: I've found out that this problem appears only on my Nexus 5X. I tried it on Xiaomi Redmi Note 4X and it didn't happen.

sentences: Is it bad practice to set the velocity of an object every loop? Say I have a simple game with a gameLoop function that gets called every 50 milliseconds or something similar, and I have a box2d object. Is it bad practice/too CPU intensive to use SetLinearVelocity on the object every time the gameLoop is called?

sentences:
Mouse click movement I need to make realistic human movement (3D) using mouse click.

Get mouse click point using Raycast.
Smoothly Slerp to LookRotation.
Move transform.forward.

Everything works fine, except I have problem with circular movement (close radius).

Example If dont move transform.forward while Slerp to LookRotation or MoveTowards instead of transform.forward it will be spinning like whirligig on circular movement.
Example If do move transform.forward while while Slerp to LookRotation it will distort trajectory of straight direct movement.

Is there any solution to move circular realistic (not spin like whirligig) and move straight direct when needed (not distort trajectory)?

I need straight movement from first example and circular movement from second.

        if (Input.GetMouseButtonDown(1))
        {
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            RaycastHit[] hits = Physics.RaycastAll(ray);

            foreach (RaycastHit hit in hits)
            {
                if (hit.transform.tag == "Ground")
                {
                    DestinationPosition = new Vector3(hit.point.x, transform.position.y, hit.point.z);

                    DestinationRotation = Quaternion.LookRotation(DestinationPosition - transform.position);

                    break;
                }
            }
        }

        if (Vector3.Distance(transform.position, DestinationPosition) > 1)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, DestinationRotation, RotationSpeed * Time.deltaTime);

            transform.position += transform.forward * MovementSpeed * Time.deltaTime;

            //transform.position = Vector3.MoveTowards(transform.position, DestinationPosition, MovementSpeed * Time.deltaTime);

            animation.CrossFade("run");
        }
        else
        {
            animation.CrossFade("idle");
        }

sentences:
Server-side physic simulations with hundreds of players I’m currently working on a singleplayer physics-orientated game where I would like the physics to be simulated server-side. This because the game will have leadersboards, persistant player progression, etcetera and I want to prevent any type of cheating – basically a pure client-server architecture, the client is “dumb” and only displays what the server wants you to display.

The problem however is that the game will most likely be played by hundreds (maybe thousands) of people at the same time. This concerns me, as it will most likely kill server-processing power if I have to do and maintain hundreds of states at the same time.

I would have no problems moving all of the physics simulations to the client-side, but then I would really need a way to validate if the result of a client simulation is valid. However, I can't figure out how.

I have thought about running the simulation server-side once in a while to validate if the client is still playing fair, but I really want the server to have as less strain as possible.

Physics will become about as complex as the GDC 2011 demo by Glenn Fiedler, maybe even simpler. However, a lot more always-colliding rigid-bodies will be in a single scene and they will all be visible at once.

I have a hard time getting an answer to this particular case, as most resources on the web - again, Glenn Fiedlers site being a great one - speak about small-scale networked physics (eg. a FPS with 30 players, like Halo).

Any advice, websites, papers or the like on the subject will be very appreciated.

A recap of the questions I would like an answer to:

How feasible is a client-server model? Is my server-processing power concern legit and grounded?
Is it possible to reliably validate a physic simulation run by the client on the server? If so, how?

sentences:
Is it possible to customize the Scriptableobject inspector for Simple level data, without the use of PropertyDrawers? I've invented an innovative, new game mechanic for Bricker Breaker Quest and want to create a quick prototype to recruit a game development team. After wasting a week researching the best way to easily represent the simple level data, I reluctantly started using Scriptableobjects. Each level is defined as a List<Block>, where :

public class Block : MonoBehaviour, IComparer<Block>
{
    public int x;
    public int y;

    public int lives = 0;
    private int pastLife = 0;

    private SpriteRenderer spriteRenderer;
    private TextMeshPro text;

    private void OnCollisionEnter2D(Collision2D collision)
    {
        lives--;

        if (lives > 0)
            UpdateVisualState();
        else
        {
            gameObject.SetActive(false);
        }
    }

    private void Awake()...

    public void AddLives(int life)...
}

How do I properly serialize the Block object so that I can enter the X, Y, and Lives integers directly in the Inspector? As a quick hack, I created a List<Vector3Int> instead of the Block List and use the Z input field to enter the lives. Seems like overkill to create a PropertyDrawer just to relabel one field.

Any other advice is appreciated.

sentences:
Proper use of texture units I'm a beginner using OpenGL v3.3 on C# with SharpGL. I have a simple scene with a Skybox and some OBJ Models. Both the skybox and models have multiple textures. Currently what I do is that I load all the textures used in the scene into different texture units at once program launch and then while rendering each element in the scene I just change a uniform variable to reflect the correct texture unit and render the vertices. Doing this could get me into trouble if there are more textures in my scene than texture units on the GPU, so I'm not sure if this is the right approach.

I would like to know what the standard practice for such a scenario. Do you just (re)load the texture for each element into say fixed texture unit 0 on every draw call or what?

sentences:
How should I cycle my game to be more scalable? I'm trying to improve my game emulator so it can handle more users. I currently have one separate thread and execute all processing there.

The cycles processes players and rooms, rooms are individual maps that users can belong to, with other users where they can walk, talk and interact with each other

Currently my game server starts having issues where there are more than 2,000 users online, or when a single room has more than 60 users inside it.

Here is the main game cycle

private Task _gameCycle;
private int _cycleSleepTime = 25;

public Game()
{
    _cycleActive = true;

    _gameCycle = new Task(GameCycle);
    _gameCycle.Start();
}

private void GameCycle()
{
    while (_cycleActive)
    {
        Root.GetGame().GetRoomManager().OnCycle();
        Root.GetGame().GetPlayerManager().OnCycle();

        Thread.Sleep(_cycleSleepTime);
    }
}

RoomManager's OnCycle:

var sinceLastTime = DateTime.Now - _cycleLastExecution;

if (sinceLastTime.TotalMilliseconds >= 500)
{
    _cycleLastExecution = DateTime.Now;

    foreach (var room in _rooms.Values.ToList())
    {
        if (room.isCrashed)
        {
            continue;
        }

        if (room.ProcessTask == null || room.ProcessTask.IsCompleted)
        {
            room.ProcessTask = new Task(room.ProcessRoom);
            room.ProcessTask.Start();
            room.IsLagging = 0;
        }
        else
        {
            room.IsLagging++;

            if (room.IsLagging >= 30)
            {
                room.isCrashed = true;
                UnloadRoom(room.Id);
            }
        }
    }
}

PlayerManager's OnCycle:

if (_clientPingStopwatch.ElapsedMilliseconds >= 30000)
{
    _clientPingStopwatch.Restart();

    var toPing = new List<IGameClient>();

    foreach (var client in _clients.Values.ToList())
    {
        if (client.GetConnection().PingCount < 6)
        {
            client.GetConnection().PingCount++;

            toPing.Add(client);
        }
        else
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }

    var start = DateTime.Now;

    foreach (var client in toPing.ToList())
    {
        try
        {
            client.SendPacket(new PongComposer());
        }
        catch
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }
}

if (_timedOutConnections.Count < 1)
{
    return;
}

lock (_timedOutConnections.SyncRoot)
{
    while (_timedOutConnections.Count > 0)
    {
        IGameClient client = null;

        client = (IGameClient)_timedOutConnections.Dequeue();

        if (client != null)
        {
            client.Disconnect();
        }
    }
}

Each room has its own task (thread). It processes a lot, user movement, chat messages, items, status updates. I figured rather than waiting for each room to process in RoomManager's OnCycle, use a new thread and try to process multiple at the same time, after all the server is multi-core.

Room's ProcessRoom

public void ProcessRoom()
{
    if (isCrashed || mDisposed)
    {
        return;
    }

    try
    {
        if (GetRoomUserManager().GetRoomUsers().Count == 0)
        {
            IdleTime++;
        }
        else if (IdleTime > 0)
        {
            IdleTime = 0;
        }

        if (Promotion != null && Promotion.HasExpired)
        {
            EndPromotion();
        }

        if (IdleTime >= 60 && Promotion == null)
        {
            Root.GetGame().GetRoomManager().UnloadRoom(Id);
            return;
        }

        GetRoomItemHandler().OnCycle();
        GetRoomUserManager().OnCycle();
        GetRoomUserManager().SerializeStatusUpdates();
        GetWired().OnCycle();
    }
    catch (Exception e)
    {
        _logger.Exception(e);
        OnRoomCrash(e);
    }
}

sentences:
Trying to make a box move around the screen with the arrow keys I have a box and it moves around the screen when the user presses the arrow keys. It seems a bit bulky and awkward though. Any thoughts on how to make it more efficient/less resource intensive?

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;

public class Box {

private float boxWidth, boxHeight;
private int gameWidth, gameHeight;
private Color boxColor;

private Vector2 position;
private Vector2 velocity;
private Vector2 acceleration;

private boolean goRight, goLeft, goUp, goDown, stopRight, stopLeft, stopUp, stopDown;

public Box(int boxWidth, int boxHeight, Color boxColor, int gameWidth, int gameHeight) {
    this.boxWidth = boxWidth;
    this.boxHeight = boxHeight;
    this.boxColor = boxColor;

    this.gameWidth = gameWidth;
    this.gameHeight = gameHeight;

    position = new Vector2(gameWidth/2 - boxWidth/2, gameHeight/2 - boxHeight/2);
    velocity = new Vector2(0, 0);
    acceleration = new Vector2(0, 0);
}

public void update(float delta) {

    velocity.add(acceleration.cpy().scl(delta));

    if(velocity.x >= 100) {
        velocity.x = 100;
    }

    if(velocity.x <= -100) {
        velocity.x = -100;
    }

    if(velocity.y <= -100) {
        velocity.y = -100;
    }

    if(velocity.y >= 100) {
        velocity.y = 100;
    }

    if(stopRight) {
        if(velocity.x > 0) {
            velocity.x -= velocity.x/20;
            if(velocity.x <= 0) {
                velocity.x = 0;
                stopRight = false;
            }
            if(goLeft) {
                acceleration.x = -100;
            }
        }
        else {};
    }

    if(stopLeft) {
        if(velocity.x < 0) {
            velocity.x -= velocity.x/20;
            if(velocity.x >= 0) {
                velocity.x = 0;
                stopLeft = false;
            }
            if(goRight) {
                acceleration.x = 100;
            }
        }
    }

    if(stopUp) {
        if(velocity.y < 0) {
            velocity.y -= velocity.y/20;
            if(velocity.y >= 0) {
                velocity.y = 0;
            }
            if(goDown) {
                acceleration.y = 100;
            }
        }
    }

    if(stopDown) {
        if(velocity.y > 0) {
            velocity.y -= velocity.y/20;
            if(velocity.y <= 0) {
                velocity.y = 0;
            }
            if(goUp) {
                acceleration.y = -100;
            }
        }
    }

    if(position.x >= gameWidth - boxWidth) {
        position.x = gameWidth - boxWidth;
    }

    if(position.x <= 0) {
        position.x = 0;
    }

    if(position.y >= gameHeight - boxHeight) {
        position.y = gameHeight - boxHeight;
    }

    if(position.y <= 0) {
        position.y = 0;
    }

    position.add(velocity.cpy().scl(delta));

}

public Box getBox() {
    return this;
}

public Color getBoxColor() {
    return boxColor;
}

public void goRight() {
    goRight = true;
    acceleration.x = 100;
    stopRight = false;
}

public void goLeft() {
    goLeft = true;
    acceleration.x = -100;
    stopLeft = false;
}
public void goUp() {
    goUp = true;
    acceleration.y = -200;
    stopUp = false;
}
public void goDown() {
    goDown = true;
    acceleration.y = 200;
    stopDown = false;
}

public float xPos() {
    return position.x;
}

public float yPos() {
    return position.y;
}

public void stopRight() {
    acceleration.x = 0;
    stopRight = true;
    goRight = false;
}

public void stopLeft() {
    acceleration.x = 0;
    stopLeft = true;
    goLeft = false;
}

public void stopUp() {
    acceleration.y = 0;
    stopUp = true;
    goUp = false;
}

public void stopDown() {
    acceleration.y = 0;
    stopDown = true;
    goDown = false;
}

}

Any ideas on how to do this with fewer lines of code? Thanks!

sentences:
Quaternion representing rotation from shoulder to hand I am provided with 3 quaternions. One for the shoulder, one for the elbow, and one for the hand. What I want is to obtain a single quaternion representing the rotation from the shoulder to the hand, essentially removing the elbow in the process. I have a diagram below to better illustrate this.

Assuming that both of the above sections (forearm and upper arm) are of the same length, how could this be calculated?

sentences:
How to solve artifacts caused by vertex lighting in my voxel engine? My current lighting system bakes the light amount based on ray-tracing from the light source to the 8 corners of the block (so per-vertex) and the distance to the light on the blocks. It works acceptable, but it's definitely not perfect.

Of course the blocks are made out of faces, which are made out of triangles. In the situation shown in the screenshot, where there is a light directly behind the camera, you get those weird triangle lighting issues.

How can I fix this problem?

sentences:
How to control which path a unit will take? This might be a really easy solution that I probably just do not know due to lack of experience so thanks for any and all the help. TLDR at bottom of post.

I'm still learning Unity / C# and I am following Brackey's Tower Defense tutorial series while adding my own twist.
The tutorials use levels with only 1 available path for units to walk along. However, the game I am currently developing has 3 separate paths that units can walk along.

Essentially, the game is similar to the mobile game Clash Royale with 3 lanes except it is also a tower defense.

Here is the current layout:

The different lanes are empty gameObject labeled as Path1 (red), Path2 (blue), and Path3 (green).
The nodes laid out in each path are all children objects of their respective path.

Each of the parent path objects contain the following script:

public class Waypoints : MonoBehaviour
{
    public static Transform[] points;

    private void Awake()
    {
        points = new Transform[transform.childCount];
        for (int i = 0; i < points.Length; i++)
        {
            points[i] = transform.GetChild(i);
        }
    }
}

Now, following the tutorial, I have also successfully added an enemy that contains this EnemyMovement script:

public class EnemyMovement : MonoBehaviour
{
    public float speed = 10f;

    private Transform target;
    private int waypointIndex = 7;

    void Start()
    {
        target = Waypoints.points[7];
    }

    void Update()
    {
        Vector3 dir = target.position - transform.position;
        transform.Translate(dir.normalized * speed * Time.deltaTime);

        if(Vector3.Distance(transform.position, target.position) <= 0.2f)
        {
            GetNextWaypoint();
        }
    }

    void GetNextWaypoint()
    {
        if(waypointIndex <= 0)
        {
            Destroy(gameObject);
            return;
        }

        waypointIndex--;
        target = Waypoints.points[waypointIndex];
    }
}

Now, as it currently stands, whenever I have an enemy present on the field, it will successfully run down path2 (blue nodes). However, it will ONLY run down path2. I would like to be able to decide which path the enemy will take. Eventually, the enemy's actions will be decided by an Enemy AI.

The player will also be able to spawn units and will be able to decide which path the unit will travel.

So to reiterate:

TL;DR: Following Brackey's Tower Defense tutorial. Currently, enemy will always default to path2. I need to figure out how to have control over which path, out of 3 options, an enemy or friendly unit will take.

sentences:
How people get their game ideas? One thing that always stop me when I want to start making a game is having no idea what to do. How do people get ideas for their game ? I mean realistic ideas for people who are alone with the minimum ressources (no money for assets, blender and unity). I will never stop being impressed by all new concept, mecanics or crazy ideas of game indie developpers come-up with, like making game out of random everyday objects. I wish I was able to do that.
Do developpers get their inspiration by looking at other games and trying to mix them or change the concept ? Do they look outside trying to come up with what they wish was a game ? Or do they simply walk around and try to imagine a game with whatever they see or reallife situations or concept ?

sentences:
How can I tell in code if vsync is disabled on desktop PC? My game needs to behave differently to get the best performance if the user disables vsync globally (basically, I need to change the scheduling on my housekeeping operations).

Is there a graphics card independent way (SDK call, C/C++) for me to find out if vsync is disabled?

I'm using opengl/glfw 3.2.1, and I can use glfwSwapInterval(0) to force vsync disabling, but that's not the same as reading the player's current default preferences.

I can always use application settings, but it'd be good if the game could default to the most suitable approach for the default video settings.

sentences:
How do I set a touch listener in a child scene in AndEngine? In my game, I want to implement touch listener for my child scene objects. Basically I tried all the possible way to implement this that I have usually done for my normal scenes, but those methods do not work here. Could somebody provide some guidance for setting touch area listener in child scene?

Here is my code:

    menuScene.setTouchAreaBindingEnabled(true);

    menuScene.registerTouchArea(resumeButtonSprite);
    menuScene.registerTouchArea(retryButtonSprite);
    menuScene.registerTouchArea(exitButtonSprite);

    menuScene.setOnAreaTouchListener(new IOnAreaTouchListener() {

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                ITouchArea pTouchArea, float pTouchAreaLocalX,
                float pTouchAreaLocalY) {
            System.out.println("Touch");
            return true;
        }
    });

In this code, menuScene was a child scene activity.

Also after research I found that my engine was stopped while the child scene was activated so the touch event is not detected. I want to implement a pause menu in my game so any desirable solution for a pause menu implementation would help.

sentences:
Ways to get around the limiting default terrain shaders in Unity I am trying to use the Toon Rim Light shader for Unity however there are a few problems when trying to use any custom shaders for a terrain in Unity. The most well known is of course, that all textures immediately become a blurry mess and ruins the look. The other issue is that all shading on the terrain ceases to be, and causes it to not cast shadows for both nature objects as well as characters.

I have researched methods for circumventing this problem, however all sources for troubleshooting have been inadequate in providing enough details or steps in correcting the issue and I am left to turn here for a possible better breakdown of the processes and coding involved in achieving the effect that I desire.

Thank you in advance, I appreciate any help.

sentences:
How do set a layer on an ECS entity? I'm using Unity ECS entities to draw out some tiles. I would like to determine the layer (or sortOrder) of the rendered tile so that if a tile is placed over another at the same position, the tile with the higher layer value will be visible.

It appears random at the moment. I tried:

entityManager.SetSharedComponentData(entity, new RenderMesh
{
   mesh = mesh,
   material = mat,
   layer = level
});

But it didn't seem to do anything.

sentences:
Simple Line Formation I'm working on the first formation for my game's troops. These should simply stand on land, facing the same direction.

To achieve this, I tried to create offsets towards a pivot-unit, that is approximately the unit in the center of the formation.
The units are (temporary) elements of a squad list withing the Squad class.
I divide the List by 2 and get the closest integer, that should be the pivot point of the formation. Now I generate offsets for all units on the left side (Unit 1 to pivot-1) and right (pivot+1 to last unit) based on the distance/gaps.

This is the code for the line formation. Sadly, the units are only forming a very stange line with no visually detectable system:

int count = (int)(squadMembers.Count / 2);
pivot = squadMembers[count];
center = pivot.transform.position;
switch (type) {
    case FormationType.Line:
        int space = 5;
        for (int i = 0; i < squadMembers.Count; i++) {
            Unit tmp = squadMembers[i];
            int dist = 0;
            if (i > count) {
                dist = (count + 1) * space;
                center.x -= dist;
            }
            if (i < count) {
                dist = (count - 1) * space;
                center.x += dist;
            }
            tmp.StartMove(center);
        }
        break;
}

It also appears that this only works along the x axis, any idea how i can realize this with the walking/facing direction ov the pivot?

Is there any (obvious) error? How can I improve this script?

PS: Any idea, how I can transform this into a double line (2 Lines behind with half spacing)

sentences:
How can I implement "quality levels" for models and textures? I'm preparing to build a 3D game without an engine and am wanting to know how I could implement graphic detail levels for my models.

To do this, are the models made in the highest quality level and then the artists remove polygons and texture detail for each model of a lower quality? Or does it work in some other way?

sentences:
How do I plot individual pixels using the XNA APIs? If I wanted to fill my game screen with individually coloured pixels, how would I do this?

For example, if I wanted to write a 'game of life'-type game where each pixel was a cell, how would I achieve this using XNA?

I've tried just calling SetData() on a Texture2D object using a screen-sized array of Color values, but it complains with:

You may not call SetData on a resource while
it is actively set on the GraphicsDevice.
Unset it from the device before calling SetData.

How do I do as it asks? Or better still... is there an alternative, better, efficient way to fill a screen with arbitrary pixels?

sentences:
Unity - separate shapes on a map into individual objects? Okay, I asked this question yesterday anonymously thus I couldn't edit it so I'm remaking it.

Short version:
I have a transparent map with black borders (Colored map) and I want those shapes formed by these borders to become individual objects in Unity. Is it even possible and if it is, how?

Long version:
I want to make a Grand Strategy type game with provinces and countries. However, I'm not really an experienced graphics nor Unity programmer.

I already have a map drawn with the desired black borders with each province being defined by these very borders and each has an unique color (sort of an identifier). Having just this seems plain and complicated to use so I'd like for each province to emit a color corresponding with a selected map type (diplomacy, terrain, domains, etc.). Obviously, this would be hard to do with just a single plain texture therefore I need to make objects and this is where my inexperience blocks me from continuing.

Is there anything I can do (in Unity and/or Photoshop) that could make the provinces be objects without manually isolating, importing and matching (as a puzzle) each single one?

I've already looked at countless questions and answers but still none fit my problem. I'm at my wits' end with this to the point where I'm actually thinking about scrapping the project.

sentences: How do I make a sprite fire a bullet in a direction using SFML and C++? I'm learning game programming for the first time using sfml and c++. I have sucessfully animated my sprite in all four directions watching some video tutorials. But now i want my sprite to fire in a facing direction. I just want to do it a very basic way. It would be great if i could get some idea of it. I am using xcode 7.

sentences:
How does one do alpha transparency testing in XNA 4.0? I've read a lot of tutorials, but it just doesn't seem to work. Here's the code as suggested by a tutorial, using the built-in AlphaTestEffect class:

Matrix projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);
Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);
alphaTest = new AlphaTestEffect(GraphicsDevice);
alphaTest.VertexColorEnabled = true;
alphaTest.DiffuseColor = Color.White.ToVector3();
alphaTest.AlphaFunction = CompareFunction.Greater;
alphaTest.ReferenceAlpha = 128;
alphaTest.World = Matrix.Identity;
alphaTest.View = Matrix.Identity;
alphaTest.Projection = halfPixelOffset * projection;

Then this object is just passed in to the SpriteBatch.Begin method. The result: Nothing appears on the screen, whereas the exact same code that doesn't pass in the alphaTest object renders correctly.

Note that this is the case even with CompareFunction.Always! (I tried CompareFunction.Never too in case I misunderstand the comparison order).

I am following this tutorial, but I've also seen that same code elsewhere. The tutorial has a downloadable file for XNA 4.0 to demonstrate it. I downloaded and tried it, and - It doesn't work. No craters show up. So what the heck is going on?

sentences:
MonoGame Mac installation instructions Does anyone know how to install MonoGame on Mac. I have been looking around for a while and I can't find any guides. I have Mono and MonoDevelop up and running fine, but I cannot figure out how to install MonoGame.
Thanks.

sentences:
Making online battles take time Let's say I have an account on an MMORTS and I send my 10,000 strong army to a location on the map. I then shut off my computer.

Another player gives orders to his 10,000 strong army to walk to the same location and attack anyone located there. He then turn off his computer.

After 30 minutes when his 10,000 guys arrive at the scene the battle begins. Now killing 10,000 guys where both armies are using the same skill and weapon might take several hours.

Let's say I turn my computer on again and find the raging battle and that I only have 4500 soldiers left, so I decide to pull my army back.

This type of ongoing battle happens on the server. How could this be accomplished? I'm thinking JavaScript / PHP technologies. I'm thinking that there should be some sort of dice system to each attack so it could end with one side winning with 1500 men left even if they started with equal amount. Is there some sort of clever logic that would not require 20,000 calculations per frame to calculate each hit and and parry for every unit?

sentences:
Should I combine multiple tiles of terrain as one mesh in Unity3D? I have a tiled terrain, generated by multiple noise algorithms. Currently, each tile is it's own GameObject, that has a handler for an OnMouseOver event. The area that is loaded at a time consists of 9 chunks that each contain 4096 tiles. This totals to 36864 tiles that are loaded at a time. On top of this, there are actual objects on top of these tiles.

Is there any considerable performance difference if I were to combine some of these tiles into a single GameObject and mesh?

sentences:
How can I get my Android camera system working more like Google Earth's? I'm implementing a touch screen interface whereby the user dragging their finger on the screen will rotate the camera in a sphere around the central point.

My code works well for the horizontal swipe (rotation around the y axis), but only covers a smaller angle from the vertical swipe (rotation around the x axis) instead of the full 360. I used the article - Spherical coordinate system form Wikipedia (http://en.wikipedia.org/wiki/Spherical_coordinate_system), specifically the Cartesian Coordinates section, to do this. I've posted my code below. Can anyone help get this working through the full 360 degrees on both axis? See how Google Earth works when you swipe the globe for what I want.

This must have been done a billion times, but Google searches confuse with the phone built in camera, gps and the like. Thanks!

//Get current position
oldX = getPosition().x;
oldY = getPosition().y;
oldZ = getPosition().z;

//convert to inclination/azimuth
camRadius = Math.sqrt((oldX * oldX) + (oldY * oldY) + (oldZ * oldZ));
inclinationTheta = Math.acos(oldZ / camRadius);
azimuthPhi = Math.atan2(oldY,oldX);

.
.
.

//use touch screen changes (deltaTouchX and Y)
inclinationTheta = (inclinationTheta + deltaTouchScreenX) % (2 * pi);
azimuthPhi = (azimuthPhi + deltaTouchScreenY) % (2 * pi);

//get new co-ordinates
newX = camRadius * Math.sin(inclinationTheta) * Math.cos(azimuthPhi);
newY = camRadius * Math.sin(inclinationTheta) * Math.sin(azimuthPhi);
newZ = camRadius * Math.cos(inclinationTheta);

//set new position
setPosition(newX, newY, newZ);

sentences:
Rotate a Crosshair around a sprite - 2d worms style game?? (LibGDX) I'm currently learning to code 2d games in Libgdx. Right now I'm making a kind of worms clone. I am using Box2d and have just my main sprite and a flat ground object so far.

What im stuck on is making the crosshair for the main character which I would like to rotate around him at a distance of say 90px when the player presses UP or DOWN key.

Here is the code I have so far but I havent even been able to attempt the rotation code at all:

package com.supermegabrobro.apoca.Sprites;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.supermegabrobro.apoca.Screens.PlayScreen;

    public class ArmyDude extends Sprite {
PlayScreen playScreen;
BodyDef bodyDef;
Body body;
FixtureDef fixtureDef;

boolean crossHairShowing = false;

Texture crossHairTexture;
float crossHairDistance = 30f;
float crossHairAngle = 45f;
Vector2 crossHairPosition;

public ArmyDude(PlayScreen playScreen){
    super(new Texture("armydude.png"));
    this.playScreen = playScreen;
    bodyDef = new BodyDef();
    bodyDef.type = BodyDef.BodyType.DynamicBody;
    bodyDef.position.set(0,0);   // TODO: Make this random

    body = playScreen.world.createBody(bodyDef);
    CircleShape circleShape = new CircleShape();
    circleShape.setRadius(getWidth() / 2);
    fixtureDef = new FixtureDef();
    fixtureDef.shape = circleShape;
    body.createFixture(fixtureDef);

    crossHairTexture = new Texture("crosshair.png");
    crossHairPosition = new Vector2(0,0);

}

public void update(float dt){
    setPosition(body.getPosition().x - getWidth() / 2, body.getPosition().y - getHeight() / 2);

    if(Gdx.input.isKeyPressed(Input.Keys.UP)){
        crossHairShowing = true;
    }
}

@Override
public void draw(Batch batch) {
    super.draw(batch);
    if (crossHairShowing){

    }
}
}

Any help is massively appreciated thanks.
(nb. I have read up on, and implemented in previous projects, normal rotation of sprites. But I beleive this is very different since I am trying to not rotate the actual sprite but instead draw a texture (of a crosshair) that rotates around this sprite.

I'm really stuck though my poor brain can't figure it out alone :(

sentences:
snap an object to another object? so I have some walls which are cubes stretched along a direction.and I have some windows and doors that are suppose to snap to a wall and don't let go until the desired location is out of the snapping range.and in the meantime I want the Objects to move along the wall but never detach from it.

if I wasn't clear enough let me know.

sentences:
User-friendly scripting when using an ECS? I am currently creating a small hobby project to get back into game development, and I have decided to structure my entities using an ECS (Entity Component System). This implementation of an ECS is structured like so:

Entity: In my case it's a unique int identifier that is used as a key to a list of components.
Component: Holds only data, e.g. the Position component holds an x and y coordinate, and the Movement component holds a speed and direction variable.
System: Handles components, e.g. it takes the Position and Movement components and adds the speed and direction to the position's x and y coordinates.

This works fine, but now I wish to implement scripting into my games, in the form of a scripting language. In previous projects I've used an OOP implementation of game objects, which meant that scripting was pretty straight forwards. For example, a simple script could look something like this:

function start()
    local future = entity:moveTo(pos1)
    wait(future)

    local response = entity:showDialog(dialog1)
    if wait(response) == 1 then
        local itemStack = entity:getInventory():removeItemByName("apple", 1)
        world:getPlayer():getInventory():addItemStack(itemStack)
    else
        entity:setBehavior(world:getPlayer(), BEHAVIOR_HOSTILE)
    end
end

However, when using an ECS, the entity itself does not have any functions like moveTo or getInventory, instead the above script written in ECS style would look something like this:

 function start()
    local movement = world:getComponent(MOVEMENT, entity)
    movement:moveTo(pos1)

    local position = world:getComponent(POSITION, entity)
    local future = Future:untilEquals(position.pos, pos1)
    wait(future)

    local dialogComp = world:getComponent(DIALOG, entity)
    local response = dialogComp:showDialog(dialog1)

    if wait(response) == 1 then
        local entityInventory = world:getComponent(INVENTORY, entity)
        local playerInventory = world:getComponent(INVENTORY, world:getPlayer())
        local itemStack = entityInventory:removeItemByName("apple", 1)
        playerInventory:addItemStack(itemStack)
    else
        local entityBehavior = world:getComponent(BEHAVIOR, entity)
        local playerBehavior = world:getComponent(BEHAVIOR, world:getPlayer())
        entityBehavior:set(playerBehavior, BEHAVIOR_HOSTILE)
    end
end

This is a lot more verbose compared to the OOP version, which is not desirable when the scripting is aimed towards mostly non-programmers (players of the game).

One solution would be to have some sort of wrapper object that encapsulates an Entity and supplies functions such as moveTo directly, and handles the rest internally, although such a solution seems sub-optimal since it takes a lot of work to cover all the components, and every time a new component is added you would need to change the wrapper object with new functions.

To all game developers that has implemented scripting in an ECS before - how did you do it? The main focus here is usability for the end user, with as little "maintenance" cost as possible (preferably you don't need to change it every time you add a component).

sentences: How to prevent a certain textured quad from the effect of the pixel Shader at the run time in slimdxdirect3d9 or directx9? I am having a video and and image slide show being rendered simultaneously. Both video and the image is being rendered by the help of texture and two different quads. Video is being rendered on the whole screen but the image of the slide show is being rendered along the video on some particular area of the screen. I am using pixel shader to give effects in my slide show but the pixel shader is affecting both the textures being rendered that is my video and the image slide show. But I want it to give effect only to the image slide show. For this I am doing Device.PixelShader=null when the video quad is being drawn but giving my pixel shader to the device when the the image is being drawn. But I want to know that is there any other way that can prevent my video quad from the effect pf the pixel shader.

sentences:
Why does my sprite shifts position on specific animationframe? I have created a spritesheet to create animation. Everything is working fine untill I come to a specific frame in one animation.

I have currently 3 animations loops

Idle Animation
Moving Animation
Shooting Animation

Nr 1,2 is working fine and behave like they should but when I am shooting my sprite shifts a little to the left. And I don't why it does.

Here is a gif for the animations

Here is the spritesheet I am using for the animations

And here is the code I am using for looping and shifting different animations

public void DrawSpriteSheetFrame(CustomTexture2D ct, Vector2 position, StateOfObject soo, GameTime gt, SpriteFont sf)
    {
        if (!_currentstate.Equals(soo))
        {
            _currentframe = 0;
        }
        _currentstate = soo;

        List<SpriteFrameInfo> currentLoopsheet = ct.SubTexture.FindAll(x => x.name.Contains(soo.ToString()));
        _timeSinceLastFrame += gt.ElapsedGameTime.Milliseconds;
        if (_timeSinceLastFrame > _frameUpdateSpeed)
        {
            _timeSinceLastFrame -= _frameUpdateSpeed;
            if (_currentframe <= currentLoopsheet.Count - 1)
            {
                _currentframe++;
            }
            else _currentframe = 0;
        }
        var t = currentLoopsheet.Where(x => x.name.Contains(_currentframe.ToString())).FirstOrDefault();
        Vector2 origin = new Vector2(t.width, t.height);
        var rec = new Rectangle(0,0, 400,200);
        _spriteBatch.Begin();
        _spriteBatch.DrawString(sf, "Currentsheet: " + t.name, new Vector2(100), Color.White);
        _spriteBatch.DrawString(sf, "Position X: " + position.X, new Vector2(100,150), Color.White);
        _spriteBatch.DrawString(sf, "Position Y: " + position.Y, new Vector2(100,200), Color.White);
        _spriteBatch.DrawString(sf, "SheetCord X: " + t.x, new Vector2(100, 250), Color.White);
        _spriteBatch.DrawString(sf, "SheetCord Y: " + t.y, new Vector2(100, 300), Color.White);
        _spriteBatch.Draw(ct.Texture, position, new Rectangle(new Point(t.x, t.y), new Point(t.width, t.height)), Color.White, 0, origin, 1, SpriteEffects.None, 1);
        //DrawBorder(new Rectangle(new Point(t.x, t.y), new Point(t.width, t.height)), 1, Color.Black);
        //_spriteBatch.Draw(ct.Texture, position, new Rectangle(new Point(t.x, t.y), new Point(t.width, t.height)), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);
        //_spriteBatch.Draw(ct.Texture, position, rec, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1);

        _spriteBatch.End();
    }

sentences:
Isometric tiles math for 4:3 ratio (64 x 48 pixels) I've read and tested the code from this article, http://clintbellanger.net/articles/isometric_math/, and also from this Isometric rendering and picking? and I can get the math and tile picking to work properly for a 2:1 isometric base tiles. However I haven't come across any article on tile picking math that involves a 4:3 ratio isometric base tiles. Can I just use the same math for the 4:3 ratio isometric or should I change it to make it work? If so, can anyone point me in the right direction of what is the right tile picking math for a 4:3 ratio isometric base tiles?

Thank you.

sentences: OpenGL/GLSL/LWJGL return value from shader I'm trying to do some bone animation. I don't want the whole skeleton to be loaded to the GLSL shader every time, even tough it's not needed, because one vertex is parented to one bone, not more. My question is simple: (How) can i return some value from the vertex shader back to my code? I'm using LWJGL/Java

sentences:
Load destructible mesh at runtime Using the tutorial: Components and Collision as a guide, to dynamically load a SphereShape the following is done:

AClass::AClass()
{
    // Create USphereComponent
    USphereComponent *sphere = NULL;
    sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Root"));
    sphere->InitSphereRadius(1.0f);
    sphere->SetCollisionProfileName(TEXT("PhysicsActor"));
    sphere->SetSimulatePhysics(true);
    sphere->WakeRigidBody();

    // Create UStaticMeshComponent
    UStaticMeshComponent *mesh = NULL;
    mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    mesh->SetupAttachment(RootComponent);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Sphere.Shape_Sphere")
    static ConstructorHelpers::FObjectFinder<UStaticMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        mesh->SetStaticMesh(asset.Object);

    RootComponent = sphere;
}

Now, when I try the same set of steps, but this time for an Actor that has a UDestructibleComponent instead of a USphereComponent:

AClass::AClass()
{
    // Create our UDestructibleComponent
    UDestructibleComponent *destructible = NULL;
    destructible = CreateDefaultSubobject<UDestructibleComponent>(TEXT("Root"));
    destructible->SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
    destructible->SetSimulatePhysics(true);
    destructible->SetEnableGravity(false);
    destructible->WakeRigidBody(NAME_None);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Cube_DM")
    static ConstructorHelpers::FObjectFinder<UDestructibleMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        UE_LOG(LogTemp, Warning, TEXT("It worked!"));

    RootComponent = destructible;
}

I receive the following errors:

ConstructorHelpers.h:105:20: error: cannot initialize a parameter of type 'UObject *' with an lvalue of type 'UDestructibleMesh *'
ValidateObject( Object, PathName, ObjectToFind );
                ^~~~~~

ConstructorHelpers.h:29:19: error: incomplete type 'UDestructibleMesh' named in nested name specifier
UClass* Class = T::StaticClass();
                ^~~

I've also tried adding .Shape_Cube_DM to the end of the string, similar to how the first asset was imported, but no luck. What is the correct way to load a DestructibleMesh from the filesystem and apply it to the UDestructibleComponent?

sentences:
How do I destroy a Box2D body on contact without getting an IsLocked assertion error? I get this error when attempting to remove a body from the world:

  java:
  /var/lib/hudson/jobs/libgdx/workspace/trunk/gdx/jni/Box2D/Dynamics/b2World.cpp:134:
  void b2World::DestroyBody(b2Body*): Assertion 'IsLocked() == false'
  failed.

What am I doing wrong?

sentences:
How to add user created data to drop down menu options So I'm trying to make it that I can have a dropdown that will have user created info appear in it.

List<engines> engineList = new List<engines>();
public Dropdown engineSelect;

public class engines
{
    public string engineName;
    public int featureNumber;
    public int totalDevPoints;
    public string optimizedGenre;
    public engines(string name, int feature, int totalPoints, string opt)
    {
        engineName = name;
        featureNumber = feature;
        totalDevPoints = totalPoints;
        optimizedGenre = opt;

    }
}
engines playerEngine = new engines(engineName, numFeature, 0, whatGenre);

Pretend player set engineName, numFeature, and whatGenre with text fields.
I wanted to have it that the drop down would add in whatever new engines the player makes. How would I do that? I want to have it say select engine: and then the player would pick from dropdown from engines they made(only saying engine names).

sentences:
When should I represent points and sizes as structures? As part of my simple Ruby 2D game development framework, my game objects have position (x and y values) and size (width and height).

class MyGameObject
  attr_accessor :x
  attr_accessor :y
  attr_accessor :width
  attr_accessor :height
  ...

Another approach I've seen was treating the position as a Point structure, and the size as a Size structure:

Point = Struct.new(:x, :y)
Size = Struct.new(:width,:height)

class MyGameObject
  attr_accessor :position   # Point instance
  attr_accessor :size       # Size instance
  ...

Some frameworks use the former (I think GDX, Gosu...). Others use the latter (cocos2d-iphone). The problem is, it isn't entirely clear to me the advantages and disadvantages of both behaviors (in game development) - I don't know why some frameworks chose one and not the other.

Are there significant differences I should consider?

sentences: Would flipping a sprite depending on direction be too inhibitive for modders? For a game I'm making (similar to games like Terraria, Starbound etc.) I want to ensure that the framework is as modder friendly as possible. This leads me to wonder if it would be too inhibitive to modders if I only allowed them to create one sprite, then the game flips the sprite depending on what direction you're walking/facing. The only reason I want to make the game flip sprites is because my file structure is already horrible, and I feel like creating another right/left folder would make the whole think even worse.

sentences:
Rendering Performance: num Draw Calls == num Texture Bindings I'm making a game with Libgdx 1.6.4 and experience some lag issues on iPhone 4 and then discovered:

// in the constructor
GLProfiler.enable();

...

// in the render method
Gdx.app.debug("draw calls: " + GLProfiler.drawCalls);
Gdx.app.debug("texture bindings: " + GLProfiler.textureBindings);
GLProfiler.reset();

What the log shows is that the number of draw calls is always equal to the number of texture bindings. Do you know if this is ok?

It seems strange because I have all images as TextureRegion in only one TextureAtlas with size 1024x512. Isn't it supposed to be that I will have for example 50 draw calls and only 1-2 texture binding instead of 50 draw calls and 50 texture bindings. Can this be the source of the lag?

Another clue may be, that I use a SpriteBatch and Scene2d Stage at the same time, but they both use the same TextureAtlas. The Scene2d Skin is loading the TextureAtlas and SpriteBatch draws TextureRegions from the skins' regions.

Thank you for any help.

--- Update ---

The main SpriteBatch (it's only one) is making 9 totalRenderCalls. The value of maxSpritesInBatch is 26. These values seem normal from what I read in the Docs and the FPS during rendering with the SpriteBatch is 60 FPS. Which is ok, no problem there.

The problem with the lag is when I use a Scene2D Stage to display a Dialog above the GameScreen. The Stage has it's own batch which I don't manipulate directly. When the Dialog is displayed the frame rate drops to 49-50 and the Animations in the Dialog are crappy. I guess the problem has something to do with Texture Binding of the main SpriteBatch and the Stage's SpriteBatch.

sentences:
How to change the position of a circle in pygame in three stages I will try to explain it as well as I can excuse me if I'll fail. I have the following simple game situation:

I know the coordinates of each point. So each of the green points try to hit the blue one. I know the target of each green point. What I would like is to acquire a nice movement effect so that lets say each green point will change the coordinates in 3 steps before getting to the target. For example: if a point would be at (2,2) and the target is at (8,9) it would change to (3,3), then (6,7) then (8,9). The idea is how to aceive this? Is there some math involved with sin and cos? I don't know if choosing a random number for example between (2,8) and (2,9) for the new x and y coordinates will do it. I don't know if so it follows the correct direction of the point towards the target.
I use pygame, but if you don't know pygame but can help me with how to aceive this effect is cool. Thanks a lot!

sentences:
Why does SDL render the background from the operating system to the window? My code displays a fully transparent window that copies the background from the operating system.

This is the code I use for rendering:

void render()
{
    SDL_RenderClear(renderer);
    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    SDL_RenderDrawRect(renderer, &background);
    SDL_RenderPresent(renderer);
}

And this is the code I use to create my window:

window = SDL_CreateWindow("title", posX, posY, windowWidth, windowHeight, SDL_WINDOW_OPENGL);

sentences: Unity Mirror Shader double image in HTC Vive / Steam VR I'm implementing a mirror in Unity for SteamVR / HTC Vive. I'm using the mirror reflection shader for Unity. It looks fine, overall, but the left eye and right eye don't align unfortunately, so it's creating double image. How do I resolve it?

sentences:
Is it possible to mod a GameMaker game? I been google searching on how to mod Game Maker games (Hyper-Light-Drifter to be more specific) but so far everyone says it's impossible to mod the files. The reason I want to do this is I want to learn to program by modding first and seeing examples that is already made, I also really like this game.

If there is a more better place/website to ask this question please tell me.

sentences:
How to make a sprite jump up and return to original position? I am just trying to make my game character, which is a texture (ball), to jump up in the air and then return back down to the position that it started at when the screen is pressed. I was just wondering if someone could give me a code example or help me to do this with my current code which is below. I have basically just drawn the background and the ball texture and positioned the ball where I want it to start the jump. The ball texture is what I want to make jump straight up.

    public class MyGdxGame extends ApplicationAdapter {
    SpriteBatch batch;
    Texture background;
    Texture ball;

    @Override
    public void create () {
        batch = new SpriteBatch();
        background = new Texture("gamebackground.png");

        ball = new Texture("ball2.png");
        ball.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
    }

    @Override
    public void render   () {
        batch.begin();
        float scaleFactor = 2.0f;
        batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight    ());
        batch.draw(ball, 80, 145, ball.getWidth() * scaleFactor, ball.getHeight() *     scaleFactor);
        batch.end();
    }

    @Override
    public void dispose () {
    }
}

sentences:
How to make an event appear after one event has been activated on RPG MAKER VX ACE? I am trying to create my first RPG, and I having some difficulty to make an event appear after an event had been activated, and then disappear later, only to reappear after the player activated an event (to cut off an area during certain times).

How would I do this in RPG Maker?

sentences:
Limit rotation to certain angles for transform.rotate I'm working on a small project to learn Blender and Unity, and one issue I recently came across is that while I can have the turret of my tank rotate on the z-axis based on mouse movements, I can't for the life of me figure out how to lock it to certain angles.

My current approach was to use Mathf.Clamp to limit the range of values that I could pass to the rotate function, but that doesn't seem to have done anything at all, even though when outputting the value Clamp produces, I can tell it doesn't go over my specification.

The code I have:

enum RotationAxes {MouseX, MouseY, MouseXandY};
var axes : RotationAxes;
private var MouseX = RotationAxes.MouseX;
var sensitivityX : float = 15F;
var minimumZ : float= -35;
var maximumZ : float = 35;
function Update ()
{

    if (axes == MouseX)
    {
        //yRotation += Input.GetAxis("Mouse X");
        //transform.eulerAngles = Vector3(0, 0, yRotation);
        transform.Rotate(0, 0, Mathf.Clamp (Input.GetAxis("Mouse X")*sensitivityX, -30, 30));

    }

}

function Start ()
{

}

sentences:
Using 2D Heightmap Data to generate terrain with the Marching Cubes Algorithm The Marching Cubes (MC) algorithm works by taking 8 points of a cube with different density values and converting them into vertices and triangles based on a given iso level (threshold above which is considered solid area). It can create quite a smooth result. For example the following picture shows MC generating polygons using a 3D noise perlin function.

However 3D perlin noise is not very useful for generating terrain. 2D perlin noise is much better. One could use the following function to generate the density values at each corner of each cube sent through the marching cubes algorithm with an iso level of 0:

float IsoValue(Vector3 pos) {
    float gap = maxHeight - minHeight;
    float perlin = (Mathf.PerlinNoise(pos.x * frequency, pos.z * frequency) * gap) + minHeight;
    if(pos.y > perlin) {
        return -1f;
    }
    else {
        return 1f;
    }
}

It produces a jagged-looking result:

This is because unlike the 3d-noise function, the density values go straight from 0 to 1, and MC always generates vertices along a grid instead of at different heights in between the grid. How do I modify the above IsoValue function to not always give values between 0 and 1 (to make smoother looking terrain) depending on how close the generated noise is to the grid?

sentences: what is the best way to code an online multiplayer game? so i want to create a simple game that runs over a network but I am having trouble deciding what needs to be done in terms of what the server needs to do and what the clients need to do. I understand I should use UDP sockets but I am unsure how to implement it within a game and have all the clients be in sync. Should the server side have like a master copy of the game where i basically runs the game and accepts moves, plays them in itself, and then sends the current state of the object to the other clients?

sentences:
Unity 5: Accessing a C# variable from Javascript I've set up a SQLite database with Unity. Into this I would like to add the current CPU Utilisation. The SQLite scripts are in Javascript and the method for finding the CPU utilisation is in a C# script, I have tried changing the javascript to C# but I am not that skilled. Ive tried several methods, each giving me errors:

(http://www.41post.com/1935/programming/unity3d-js-cs-or-cs-js-access)

private var csScript : ClientValues;

function Awake()
{
csScript = this.GetComponent("ClientValues");
}

using this method gives me the error "The name 'ClientValues' does not denote a valid type ('not found')"

and if I use (http://answers.unity3d.com/questions/272122/can-i-pass-a-value-from-a-c-script-into-a-java-scr.html)

var curValue : int;
var gObject2 : GameObject;

function Update()
{
var cSharpScript = gObject2.GetComponent("Clientvalues");
curValue = cSharpScript.myValue;
}

I get the error: 'myValue' is not a member of 'UnityEngine.Component'

Is this something to do with me using Unity 5?
What can I do to have the Javascript access the C# value?

sentences:
FPS Android game that moves the gun as user swipes the screen I am Making a First Person shooter game for android. Gun moves in all directions I swipe left right up or down. But the speed is so slow. How can i increase it's Speed.Here is my code.

void FixedUpdate ()
{
    foreach (Touch t in Input.touches)
        if (t.phase == TouchPhase.Began)
        {
            initialTouch = t;
        }
        else if (t.phase == TouchPhase.Moved && !hasSwiped)
        {
            float deltaX = initialTouch.position.x - t.position.x;
            float deltaY = initialTouch.position.y - t.position.y;
                //distance formula
            distance = Mathf.Sqrt((deltaX * deltaX) +(deltaY * deltaY));
            bool swipeSideways = Mathf.Abs (deltaX) > Mathf.Abs (deltaY);
            if (distance > 100f)
            {
                if (swipeSideways && deltaX > 0) {
                    this.transform.Rotate (new Vector3 (0, 30f, 0), rotationSpeed * Time.deltaTime);
                }

                else if (swipeSideways && deltaX <=0)// swipe right
                {
                    this.transform.Rotate (new Vector3 (0, 30f, 0), -rotationSpeed * Time.deltaTime);
                }

                hasSwiped = true;
            }

        }

        else if (t.phase == TouchPhase.Ended)
        {
            initialTouch = new Touch ();
            hasSwiped = false;
        }

}

sentences:
Cleaner implementation of this draw call Simple static class that will write out a message that is passed in.  The SpriteSheet is 256x256 and the A-Z starts at line 240 and the 0-9 starts at 248.  Each character is 8x8.  I hate the if (ix >= 32) and wondered if there is a tidier way of doing this?  I'm pleased it's only one Draw call, but it looks ugly.

public static class Font
{
    private static String chars = "" + //
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ      " + //
        "0123456789.,!?'\"-+=/\\%()<>:;     " + //
        "";

    public static void Draw(string msg, SpriteSheet sprites, SpriteBatch spriteBatch, int x, int y, Color color)
    {
        msg = msg.ToUpper();
        for (int i = 0; i < msg.Length; i++)
        {
            int ix = chars.IndexOf(msg[i]);
            int w = 0, h = 240;
            if (ix >= 0)
            {
                if (ix >= 32)
                {
                    w = 32;
                    h = 248;
                }
                spriteBatch.Draw(sprites.Sheet, new Rectangle(x + i * 8, y, 8, 8), new Rectangle((ix - w) * 8, h, 8, 8), color);
            }
        }
    }
}

sentences:
Objects do not stop when colliding each other while using mouse drag I work on a 2D game and I have multiple objects that the player can control.

The objects each have a RigidBody2D and a Collider, and a method OnMouseDrag() with which I can drag the objects.

I want the dragging to stop when the objects hit each other.

I tried by using this:

rigidbody2d.velocity = Vector3.zero;
rigidbody.isKinematic = true;

But the objects do not stop.

I want exactly like this video.
I tried this but it isn't work too.

https://www.youtube.com/watch?v=ZfjVR-0ZFHU&t=270s

using UnityEngine;
 using System.Collections;
public class NewBehaviourScript1 : MonoBehaviour
{

bool allowDrag = true;
void OnCollisionEnter(Collision collision)
{
    allowDrag = false;
}

void OnMouseDrag()
{
    if(allowDrag)
    {
    float distance = 7;
    Vector3 mousePosition = new Vector3 (Input.mousePosition.x, Input.mousePosition.y , distance);
    Vector3 objPosition = Camera.main.ScreenToWorldPoint (mousePosition);
    transform.position = objPosition;
        if ((transform.position.x <0))
            {
            Vector3 _tmp = transform.position;
            _tmp.x = 0;
            transform.position = _tmp;
            }
            if ((transform.position.x > 4.5f))
            {
            Vector3 _tp = transform.position;
            _tp.x = 4.5f;
            transform.position = _tp;
            }

    }
}
void OnMouseUp()
{
    if ((transform.position.x > 0) && (transform.position.x < 0.375f))
        {
        Vector3 _tr = transform.position;
        _tr.x = 0;
        transform.position = _tr;
        }
    if ((transform.position.x > 0.375f) && (transform.position.x < 1.25f))
        {
        Vector3 _fs = transform.position;
        _fs.x = 0.75f;
        transform.position = _fs;
        }
    if ((transform.position.x > 1.125f) && (transform.position.x < 1.875f))
        {
        Vector3 _tr2 = transform.position;
        _tr2.x = 1.5f;
        transform.position = _tr2;
        }
    if ((transform.position.x > 1.875f) && (transform.position.x < 2.625f))
        {
        Vector3 _tr4 = transform.position;
        _tr4.x = 2.25f;
        transform.position = _tr4;
        }
    if ((transform.position.x > 2.625f) && (transform.position.x < 3.375f))
        {
        Vector3 _tr6 = transform.position;
        _tr6.x = 3;
        transform.position = _tr6;
        }
        if ((transform.position.x > 3.375f) && (transform.position.x < 4.125f))
        {
        Vector3 _tr7 = transform.position;
        _tr7.x = 3.75f;
        transform.position = _tr7;
        }
    if ((transform.position.x > 4.125f) && (transform.position.x < 4.875f))
        {
        Vector3 _tr8 = transform.position;
        _tr8.x = 4.5f;
        transform.position = _tr8;
        }
}
void Start ()
{
}
void Update()
{
}

}

Please help!

sentences: Variable height jumping in side scrollers How can I have the player jump higher if the jump key is held down longer? I am currently just reducing gravity as long as the key is held and the player is jumping, but this looks odd.

sentences:
Aligning a sprite with a tilemap I'm trying to create a hybrid system for my Unity game. I want to use tilemap for collision and use sprites for the world.

I drew a sprite onto a 40x40 checkerboard grid as can be seen here. I wanted an easy way to create a collider for this without spending 30+ minutes hand placing box colliders and I decided to use a tilemap to place red tiles and use a tilemap collider for collision geometry and just hide the red tiles in-game.

Issue is, I have no clue how to align the checkerboard with the Unity tilemap grid.

Here's a screenshot of the sprite in the unity editor with the tilemap grid visible.

If it isn't obvious, then the white lines is the grid for the tilemaps. The cellsize for each cell on the grid isn't the same size as the cells on the checkerboard pattern and I have no idea how to fix it.

The PPU (pixels per unit) of the sprite is 140. The PPU for the tileset tile(singular since there is literally only 1 tile in the entire tileset) is also 140. The checkerboard in paint.net is 40x40 and so is the tile. How can I get the cellsize of the grid in unity to match the cell size of the checkerboard.

sentences: Data-driven animations Say you are using C/SDL for a 2D game project. It's often the case that people use a structure to represent a frame in an animation. The struct consists of an image and how much time the frame is supposed to be visible. Is this data sufficient to represent somewhat complex animation? Is it a good idea to separate animation management code and animation data? Can somebody provide a link to animations tutorials that store animations in a file and retrieve them when needed. I read this in a book (AI game programming wisdom) but would like to see a real implementation.

sentences:
What has changed in the lighting systems of Rage, Battlefield 3 to make them so realistic? I've played and completed Rage and currently Battlefield 3 (which looks a lot better with less hype). One thing that is immediately apparent is the lighting, or the bump maps - I can't figure out which it is - makes the experience on a high end PC a lot clearer and better looking.

What is the advancement that these games are making use of in Open-GL/Direct-X or the graphics cards that has increased the realism of the lighting engines so dramatically?

sentences: How to project a vector onto a plane, but not along plane normal? In 3d space, is there any way to project a vector onto a plane,  but alongside the UP vector (0,1,0) instead of the plane normal? If so, then how do I do that and what is it called?

sentences:
How can I achieve a pseudo-3D camera effect like this? I am trying to achieve a pseudo-3D camera effect similar to this:

I have gotten the following results using a 3D camera and billboards:

I am now running into the following problems:

In the first billboard example, the size discrepancy between when the sprites are at the "front" and "back" is too great. I need to have them be more similar to the above.
The bottom y-coordinate of the sprites never seem to change in my example, but they do (slightly) in the example that I want.
I need to be able to control how close to the right and left edge of the screen the sprites go to.

In the first billboard example I setup my camera like so:

// (float fovxDegrees, float aspect, float znear, float zfar)
this.simpleCamera.Perspective(75f, 1.5f, 0.01f, 400);

// (Vector3 eye, Vector3 target, Vector3 up)
this.simpleCamera.LookAt(new Vector3(0, 5f, 10f), Vector3.Zero, Vector3.Up);

My sprites are positioned at the following locations:

new Vector3(-4f, 1f, 0f);
new Vector3(-4f, 1f, 1f);

Full CSharp code: http://pastebin.com/9G0FDNLs

Billboard HLSL: http://pastebin.com/uB8e3gXU

If you want the grid: http://pastebin.com/R5UCBNWt

sentences:
LibGDX How to adjust mouse aim angle calculation when screen is resized I'm starting with a screen resolution of 1280 x 960 and that is the default resolution where mouse aiming is calculated thus:
angleRad = (float) (Math.atan2(screenX - (screenWidth / 2), screenY - (screenHeight / 2)));
angle = (float) Math.toDegrees(angleRad - Math.PI / 2);
angle = Math.round(angle) <= 0 ? angle += 360 : angle;
if (Math.round(angle) == 360)
    angle = 0;

Which all works fine. But when the game is resized to some resolution with a vastly different ratio to the default, like for example 2560 x 1440 at full screen in my case, the aiming is off. The resize method is like this:
@Override
public void resize(int width, int height) {
    game.getViewport().update(width, height);
    control.screenWidth = width;
    control.screenHeight = height;
}

Where control.screenWidth and control.screenHeight are used in the above angle calculation and as the set resolution in other areas. The angle calculation when resized is roughly correct but tends to get further and further off course the further the aim is away from the player.
If the player aims straight up, down, left or right (N, S, W or E basically) then the aim is dead on, but veers off as aiming goes away from the player towards a screen edge - no doubt due to the resolution ratio difference.
We have these ratio differences which no doubt affect the angle calculation:
1280x960 1.33 ratio
2560x1440 1.77 ratio

But I'm not sure how to take into account these ratios to adjust the angle calculation accordingly in my code?
The crosshair and bullets are both off position. In the screenshot below the crosshair position in comparison with the mouse pointer can be seen. This is for resolution 2560x1440. The code for the crosshair is this:
point = angleToVector((float) (angleRad + Math.PI)).scl(10000);
gs.getWorld().rayCast(callBack, pos, point);

angleRad is the mouse angle in radians, pos is the vector position of the player and point is the vector target position. This is the raycast callback
private RayCastCallback callBack = new RayCastCallback() {
    @Override
    public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) {
            collision.set(point);
        return fraction;
};

sentences:
Moving a sprite in XNA/C#, using vectors I'm currently looking into XNA game development with the C# language.

I have two classes: the main game handler and a "sprite" class. Following is some basic pseudo-code which I hope adequately describes the issue.

Game.cs

class game {
  sprite the_sprite;
  void update(time) {
    var mouse = mouse.state
    if(mouse.clicked) { this.the_sprite.moveTo(mouse.x, mouse.y) }
    this.the_sprite.update(time)
    base.update(time)
  }
}

Sprite.cs

class sprite {
  vector2 location;
  vector2 move_to;
  void moveTo(x, y) { this.move_to = new vector2(x, y) }
  void update(time) {
    if(this.location.x > this.move_to.x /* (or less than) */) {
      // adjust location.x
    }
    if(this.location.y > this.move_to.y /* (or greater than) */) {
      // adjust location.y
    }
  }
}

Basically: when the user clicks somewhere in the game window, the x and y coordinates of the mouse are taken, and the game object will move towards that location over a period of time.

Well... the code works, but it's ugly, and objects don't move directly towards the object (instead, it's diagonal movement, followed by single-axis movement). I'm guessing there are some mathematical functions I can use, but I honestly haven't a clue where to get started. Any suggestions?

sentences:
Actor in Stage Does Not Update the MoveTo XY Location I am creating a game wherein an apple is being shot with an arrow. The apple's location is the XY location of the user input and the arrow actor has to move to that location using the code actor.moveto. The problem is the arrow only moves only once to the user input's direction. I know that the moveTo action of the actor is updated many times per second when I called stageArrow.act in the update method so I am wondering why the arrow only moves once. Here's my code:

appleclass.java

public class AppleClass implements Screen {

Arrow arrow;
private final MainApp app;
public Image ShotImage;

public AppleClass(final MainApp app){
        this.app = app;
        this.stageApple = new Stage(new StretchViewport(app.screenWidth,app.screenHeight , app.camera));
        this.stageArrow =new Stage(new StretchViewport(app.screenWidth,app.screenHeight , app.camera));

        arrow = new ArrowClass(app);

    }

@Override
    public void show() {

        InputMultiplexer inputMultiplexer = new InputMultiplexer();
        inputMultiplexer.addProcessor(stageApple);
        inputMultiplexer.addProcessor(stageArrow);
        Gdx.input.setInputProcessor(inputMultiplexer);

        arrow();

    }

    public void arrow(){
        arrow.isTouchable();
        stageArrow.addActor(arrow);
        arrow.addAction((moveTo(Gdx.input.getX(),Gdx.input.getY(),0.3f)));   //===> only executes once.
        arrow.addListener(new InputListener(){
            public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor){

            if (Gdx.input.isTouched()){
                        ShotImage.setVisible(true);

                          }
                        }
                    });}

}

@Override
    public void render(float delta) {

        Gdx.gl.glClearColor(0, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        update(delta);
}

public void update(float deltaTime){

        stageApple.draw();
        stageArrow.draw();

        stageApple.act(deltaTime);
        stageArrow.act(deltaTime);

    }

ArrowClass.java

public class ArrowClass extends Actor {
    MainApp app;
    AppleClass appleClass;
    public Texture arrowTexture;

    public ArrowClass(final MainApp app){
        this.app = app;
        arrowTexture = new Texture("medievalarrow.png");
        this.setSize(arrowWidth, arrowHeight);
        this.setTouchable(Touchable.enabled);
        this.setBounds(app.screenWidth*0.45f,0,arrowWidth,arrowHeight);
        this.setOrigin(0,0);

}
@Override
    public void draw(Batch batch, float parentAlpha) {
        super.draw(batch, parentAlpha);

        final float delta = Gdx.graphics.getDeltaTime();
        this.act(delta);

        app.batch.begin();
        app.batch.draw(arrowTexture, getX(),getY(),getWidth(),getHeight());
        app.batch.end();

    }
}

Any help will be highly appreciated. Thanks.

sentences: How difficult is it to implement 3D models in a 2D game? Creating a full blown 3D game requires a lot more math for physics, but what if I just want to mix 3D models in a 2D game, such as in the New Super Mario Brothers? Would I be able to get the looks of 3D models with the ease of making a 2D game?

sentences:
My game has messed up layouts! Earlier, I asked this question:
Landscape mode for game?

Where I had a directory for each and every layout, but the layout in the layout-land directory wasn't showing up when positioning my layout in landscape orientation.

So, someone suggested to me that it maybe that the

Layout-normal directories are overriding my regular layout-land directories. Is this true?
If so, will any other of my layout folders get overriding?** What is the purpose of layout-normal in the first place then anyway?

sentences:
Why the OnCollisionEnter is not working? This script is attached to the wall(3D Cube) with a box collider :

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

public class LockedRoomTrigger : MonoBehaviour
{
    private void OnCollisionEnter(Collision collision)
    {
        Debug.Log(collision.transform.name);
    }
}

But when the player is moving and hit the cube it's not getting to the Debug.Log I used a break point on the Debug.Log line.

A screenshot of the cube wall with the box collider component and the script attached to it.
The problem is not with the player since if I'm moving with the player near doors they open so the player does trigger things and also not walking through walls.

This is a screenshot of NAVI.
NAVI is a bit in front of the player and moving with the player and part of the player in the game like a friend helper.

NAVI is the one that collide and hit stuff if doors walls not the player since the NAVI is a bit in front of the player.

NAVI have only a box collider :

And this is the Inspector screenshots of the player. I will add two screenshots since it's not getting inside in one screenshot :

The player is a first person view :

sentences:
Unity - Part of the sprite is covered in shadow I have a sprite with Transparent/Cutout/Diffuse shader. Recieving shadows is turned on in SpriteRenderer. The light is a pointlight and I am using deffered rendering path.

However when I am above or right of the object, it is covered in shadow. When I am below or left of the object everything seem to work as it should.If I place the light in the center of the sprite, only a part of the sprite is lit up, the other part is covered in shadow.

Maybe it is something with normals? I need to get rid of the self shading effect.

Shader

Shader "Transparent/Cutout/Diffuse" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}

SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 200

CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff

sampler2D _MainTex;
fixed4 _Color;

struct Input {
    float2 uv_MainTex;
};

void surf (Input IN, inout SurfaceOutput o) {
    fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    o.Albedo = c.rgb;
    o.Alpha = c.a;
}
ENDCG
}

Fallback "Transparent/Cutout/VertexLit"
}

I found out what unity uses for lambert lightning. Since I use deffered rendering so unity should use function with _PrePass prefix. But the implementation of the actual lighning is implemented somewhere else and is it used for all materials, that looks like dead end.

Custom Lightning

inline fixed4 LightingSLambert (SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed diff = max (0, dot (s.Normal, lightDir));

fixed4 c;
c.rgb = s.Albedo * _LightColor0.rgb * (diff * atten * 2);
c.a = s.Alpha;
return c;
}

inline fixed4 LightingSLambert_PrePass (SurfaceOutput s, half4 light)
{
fixed4 c;
c.rgb = s.Albedo * light.rgb;
c.a = s.Alpha;
return c;
}

inline half4 LightingSLambert_DirLightmap (SurfaceOutput s, fixed4 color, fixed4 scale, bool surfFuncWritesNormal)
{
UNITY_DIRBASIS
half3 scalePerBasisVector;
half3 lm = DirLightmapDiffuse (unity_DirBasis, color, scale, s.Normal, surfFuncWritesNormal, scalePerBasisVector);
return half4(lm, 0);
}

sentences:
Access Android Camera.Parameters from Unity I would like to access the android defined class

Camera.Parameters.getHorizontalViewAngle()

from a Unity3D c# script but my java skills are limited. Can anybody offer any help?
I have this code:

using UnityEngine;

#if UNITY_ANDROID
public class CameraParametersAndroid
{
    public static float HorizontalViewAngle { get; protected set; }
    public static float VerticalViewAngle   { get; protected set; }
    public static int   numCameras      { get; protected set; }

    static CameraParametersAndroid()
    {
        AndroidJavaClass unityPlayerClass = new AndroidJavaClass ("com.unity3d.player.UnityPlayer"),
                         cameraClass = new AndroidJavaClass ("android.hardware.Camera"),
                         cameraParametersClass = new AndroidJavaClass ("android.hardware.Camera.Parameters"),
                         cameraInfoClass = new AndroidJavaClass ("android.hardware.Camera.CameraInfo");

        AndroidJavaObject currentActivity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");
        object[] args = {currentActivity};

        AndroidJavaObject camera = cameraClass.CallStatic<AndroidJavaObject>("getCamera", args);

        if (camera != null)
        {
            AndroidJavaObject cameraParameters = camera.Call<AndroidJavaObject>("getParameters");

            numCameras = camera.Call<int>("getNumberOfCameras");
            HorizontalViewAngle = cameraParameters.Call<float>("getHorizontalViewAngle");
            VerticalViewAngle   = cameraParameters.Call<float>("getVerticalViewAngle");

        }
        else
        {
            Debug.LogError("[CameraParametersAndroid] Camera not available");
        }
    }
}
#endif

but not even the getNumberOfCameras() call works.

sentences:
Help creating combat for collection type game sorry for my odd terminology, I am rather new to all this

I'm creating a collection/pokemon type game. as of right now I have created a separate GameObject prefab for every monster/character in the game. Each gameobject contains a script with enumerated values for it's stats. When combat begins It calls a random monster from a pool of gameobjets. The problem is at this point I'm not sure how to have it create a new instance of the enemy in a way where it retains the values in it's public floats from the prefab or have it's level be adjusted as it enters. And I don't know how I can derive it's stats and properties for scripts outside the function that spawned it. as the function that creates the new duplicate won't remember the new creature after the function resolves.

so In short, How can I reference the enumerated integers of a newly duplicated gameobject

I was asked to include some more information on what I've coded:

public List<baseMonsters> allMonsters = new List<baseMonsters> ();

public void EnterBattle(Rarity rarity)
{
    // this code swaps camera view to the battlefield from the overworld map
    playerCamera.SetActive(false);
    battleCamera.SetActive(true);

    // call function to determine which monster appears
    baseMonsters battleMonster = GetRandomMonsterFromList(GetMonsterRarity(rarity));

    // returns which monster was chosen
    Debug.Log (battleMonster.name);

    // prevents the player from moving after combat begins
    player.GetComponent<PLayermove>().isAllowedtoMove = false;

    //Creates the defending monster
    GameObject dMon = Instantiate (emptyMon, defencePodium.transform.position, Quaternion.identity);
    //Ensures scale from original is preserved
    dMon.transform.localScale = battleMonster.transform.localScale;

    Vector3 MonLocalPos = new Vector3 (0, 1, 0);
    dMon.transform.parent = defencePodium;
    dMon.transform.localPosition = MonLocalPos;

    //Adds the stat components of the original prefab
    baseMonsters tempMon = dMon.AddComponent<baseMonsters> () as baseMonsters;

    tempMon = battleMonster;

    dMon.GetComponent<SpriteRenderer> ().sprite = battleMonster.image;
    bm.ChangeMenu (BattleMenu.Selection);

}

the issue that I see with the code is that it's transforming an already existing object into what the prefab monster is, not copying it. what method can I use to copy the prefab in a way I can easily reference in the same function to change it's level?

-Update-

ok so changing everything over to instantiating a GameObject is what I want. now there is the other part from the code before:

public List<baseMonsters> GetMonsterRarity(Rarity rarity)
{
    List<baseMonsters> returnMonster = new List<baseMonsters> ();
    foreach (baseMonsters Monster in allMonsters)
    {
        if (Monster.rarity == rarity)
        returnMonster.Add (Monster);
    }
    return returnMonster;

}
public baseMonsters GetRandomMonsterFromList(List<baseMonsters> monList)
{
    baseMonsters mon = new baseMonsters ();
    int monIndex = Random.Range (0, monList.Count - 1);
    mon = monList [monIndex];
    return mon;
}

I was following a tutorial when I created this code, I am starting to understand more and more how spaghetti it is.
sorry for all the Alike Terms, baseMonsters is a class that houses things like the rarity and stats of the monster. These functions are searching by and for that script. How can I convert these codes over to searching the class from a list, to a Gameobject from a list, and still be able to read baseMonsters of each respective GameObject and it's rarity int?
 as of right now, one workaround I can think of is to create a seperate list for each rarity. that way I can skip needing to read the rarities in the baseMonsters script entirely. But I will still need to know how I can call that class script for other things like determining level of the monster and what it's attacks will be?

sentences: NavMesh going in the ground I'm trying to do a navmesh. Everything seems to work fine exept that my character in almost completely under the ground. The ground is a plane with a mesh collider. I have baked it and checked my heigth mesh. My character has a rigidbody and a collider. What could be the problem ?

sentences:
Where is the source of XNA lighting? Talking BasicEffects,
where is the source of the three directional lights?

When I write this:

effect.DirectionalLight0.DiffuseColor = new Vector3(0.5f, 0, 0); // a red light
effect.DirectionalLight0.Direction = new Vector3(1, 0, 0);

What does it mean for the direction? From where is it directing?

sentences:
Understanding how to create/use textures for games when limited by power of two sizes I have some questions about the creating graphics for a game.

As an example. I want to create a motorbike. (1pixel = 1centimeter)
So my motorbike will have 200 width and 150 height. (200x150)
But the libgdx only allows to load sizes with the power of 2?! (2,4,8,16,...)

First I thought about that way.
I will create my bike with the size (200x150) and save it as png. Than I will open it again (e.g. with gimp) resize the image to a size which uses values with power of 2 (128x128). I will load that as texture in the programm and set width as 200 and height as 150.

But wouldn't it be a problem? Because I will lose some pixel information when I make the first conversation.?! Isn't it?

sentences:
Scale a game object to Bounds I'm trying to scale a lot of dynamically created game objects in Unity3D to the bounds of a sphere collider, based on the size of their current mesh. Each object has a different scale and mesh size. Some are bigger than the AABB of the collider, and some are smaller. Here's the script I've written so far:

private void ScaleToCollider(GameObject objectToScale, SphereCollider sphere) {
    var currentScale = objectToScale.transform.localScale;
    var currentSize = objectToScale.GetMeshHierarchyBounds().size;

    var targetSize = (sphere.radius * 2);

    var newScale = new Vector3 {
        x = targetSize * currentScale.x / currentSize.x,
        y = targetSize * currentScale.y / currentSize.y,
        z = targetSize * currentScale.z / currentSize.z
    };

    Debug.Log("{0} Current scale: {1}, targetSize: {2}, currentSize: {3}, newScale: {4}, currentScale.x: {5}, currentSize.x: {6}",
        objectToScale.name, currentScale, targetSize, currentSize, newScale, currentScale.x, currentSize.x);

    //DoorDevice_meshBase                   Current scale: (0.1, 4.0, 3.0), targetSize: 5, currentSize: (2.9, 4.0, 1.1), newScale: (0.2, 5.0, 13.4), currentScale.x: 0.125, currentSize.x: 2.869114
    //RedControlPanelForAirlock_meshBase    Current scale: (1.0, 1.0, 1.0), targetSize: 5, currentSize: (0.0, 0.3, 0.2), newScale: (147.1, 16.7, 25.0), currentScale.x: 1, currentSize.x: 0.03400017

    objectToScale.transform.localScale = newScale;
}

And the supporting extension method:

public static Bounds GetMeshHierarchyBounds(this GameObject go) {
    var bounds = new Bounds(); // Not used, but a struct needs to be instantiated

    if (go.renderer != null) {
        bounds = go.renderer.bounds;
        // Make sure the parent is included
        Debug.Log("Found parent bounds: " + bounds);
        //bounds.Encapsulate(go.renderer.bounds);
    }
    foreach (var c in go.GetComponentsInChildren<MeshRenderer>()) {
        Debug.Log("Found {0} bounds are {1}", c.name, c.bounds);
        if (bounds.size == Vector3.zero) {
            bounds = c.bounds;
        } else {
            bounds.Encapsulate(c.bounds);
        }
    }
    return bounds;
}

After the re-scale, there doesn't seem to be any consistency to the results - some objects with completely uniform scales (x,y,z) seem to resize correctly, but others don't :|

Its one of those things I've been trying to fix for so long I've lost all grasp on any of the logic :| Any help would be appreciated!

sentences: GL_EXT_draw_instanced vs VBO's I'm having trouble understanding the benefit of the newer GL_EXT_draw_instanced over traditional VBO's.  Don't both keep geometry cached on the gpu for faster redrawing?  VBO's seem much more flexible.

sentences:
Frame timing for GLFW versus GLUT I need a library which ensures me that the timing between frames are more constant as possible during an experiment of visual psychophics.

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

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

For example if my gameloop is the following

void gameloop()
{

// do some computation

printDeltaT();
Flip buffers
}

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

sentences:
How to move a Box2D body towards a mouse click? In a top down game using Box2D, I would like the player's Box2D body to rotate towards the mouse click, and then move to a point on mouse click (move, not teleport). I have worked out the rotation part, but cannot figure out the movement.

Every time the screen is touched, the target point (mouse click) is updated:

if (Gdx.input.isTouched())
{
    Vector3 tmp = camera.unproject(new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0));
    touch_prev = touch_target;
    touch_target = new Vector2(tmp.x, tmp.y);
}

Here is the Rot2D class:

package com.elsealabs.ghostr;

public class Rot2D {

   public static Rot2D fromDegrees(double angle) {
      return fromRadians(Math.toRadians(angle));
   }

   public static Rot2D fromRadians(double angle) {
      return new Rot2D(Math.cos(angle), Math.sin(angle));
   }

   public static Rot2D fromVector(double dx, double dy) {
      float length = (float) Math.sqrt(dx * dx + dy * dy);
      return new Rot2D(dx / length, dy / length);
   }

   public double getAngle() { // radians
     return Math.atan2(sin, cos); // atan2(y, x)
  }

   public double cos, sin;

   private Rot2D(double cos, double sin) {
      this.cos = cos;
      this.sin = sin;
   }

   public Rot2D load(Rot2D that) {
      this.cos = that.cos;
      this.sin = that.sin;

      return this;
   }

   public Rot2D copy() {
      return new Rot2D(cos, sin);
   }

   public Rot2D rotate(Rot2D that) {
      double cos = (this.cos * that.cos) - (this.sin * that.sin);
      double sin = (this.cos * that.sin) + (this.sin * that.cos);

      this.cos = cos;
      this.sin = sin;

      return this;
   }

   public static double cross(Rot2D a, Rot2D b) {
      return (a.cos * b.sin) - (a.sin * b.cos);
   }
}

(Source)

I am showing these because it may be helpful, but what I need to get working is the movement. I do not want to use setTransform, as it may end up letting the player travel through walls.

Using the vectors below, and any other variables needed, how would I move the player gradually towards a point on mouse click?

private Vector2 touch_prev = new Vector2(0, 0);
private Vector2 touch_target

sentences:
Unity: camera moving up and down for no reason I have a standard camera in my scene. With standard I mean the camera you get when you click right mouse > Camera, with no modification except for the transform position and rotation. Then I attached to the camera this simple script:

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

public class CameraController : MonoBehaviour {

public GameObject target;
public Vector3 translationOffset;
public Vector3 rotationOffset;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    transform.position = target.transform.position + translationOffset;
    transform.LookAt(target.transform);
    transform.Rotate(-rotationOffset);
}

}

the result I have is this:

Why my camera is doing that? It may be worth noticing that everything was working fine, but at some point i clicked on "reimport all assets" and it started this weird behaviour. How can I fix? Thanks a lot.

sentences:
windows phone 7 apps marketplace paid to free I have question about paid and free + ad-based apps/games in wp7 marketplace, can I publish my app as paid version initially and later(after a month or so) can i publish the same app/game as free + ad based version? Is there any such rule/policy in wp7 marketplace.
I could not find proper answer on the net not lucky enough. And i hope this is not off topic question.  - Thanks

sentences:
Color Picking Troubles - LWJGL/OpenGL I'm attempting to check which object the user is hovering over.  While everything seems to be just how I'd think it should be, I'm not able to get the correct color due to the second time I draw (without picking colors).  Here is my rendering code:

public void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    camera.applyTranslations();

    scene.pick();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    camera.applyTranslations();

    scene.render();
}

And here is what gets called on each block/tile on "scene.pick()":

public void pick() {
    glColor3ub((byte) pickingColor.x, (byte) pickingColor.y, (byte) pickingColor.z);
    draw();

    glReadBuffer(GL_FRONT);
    ByteBuffer buffer = BufferUtils.createByteBuffer(4);
    glReadPixels(Mouse.getX(), Mouse.getY(), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

    int r = buffer.get(0) & 0xFF;
    int g = buffer.get(1) & 0xFF;
    int b = buffer.get(2) & 0xFF;

    if(r == pickingColor.x && g == pickingColor.y && b == pickingColor.z) {
        hovered = true;
    } else {
        hovered = false;
    }
}

I believe the problem is that in the method of each tile/block called by scene.pick(), it is reading the color from the regular drawing state, after that method is called somehow.  I believe this because when I remove the "glReadBuffer(GL_FRONT)" line from the pick method, it seems to almost fix it, but then it will also select blocks behind the one you are hovering as it is not only looking at the front.

If you have any ideas of what to do, please be sure to reply!/

EDIT:  Adding scene.render(), tile.render(), and tile.draw()

scene.render:

public void render() {
    for(int x = 0; x < tiles.length; x++) {
        for(int z = 0; z < tiles.length; z++) {
            tiles[x][z].render();
        }
    }
}

tile.render:

public void render() {
    glColor3f(color.x, color.y, color.z);
    draw();
    if(hovered) {
        glColor3f(1, 1, 1);
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
        draw();
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
    }
}

tile.draw:

public void draw() {
    float x = position.x, y = position.y, z = position.z;

    //Top
    glBegin(GL_QUADS);
    glVertex3f(x, y + size, z);
    glVertex3f(x + size, y + size, z);
    glVertex3f(x + size, y + size, z + size);
    glVertex3f(x, y + size, z + size);
    glEnd();

    //Left
    glBegin(GL_QUADS);
    glVertex3f(x, y, z);
    glVertex3f(x + size, y, z);
    glVertex3f(x + size, y + size, z);
    glVertex3f(x, y + size, z);
    glEnd();

    //Right
    glBegin(GL_QUADS);
    glVertex3f(x + size, y, z);
    glVertex3f(x + size, y + size, z);
    glVertex3f(x + size, y + size, z + size);
    glVertex3f(x + size, y, z + size);
    glEnd();

}

(The game is like an isometric game.  That's why I only draw 3 faces.)

sentences:
How can story and gameplay be artfully merged? Let me give some context. Three of my friends and I have a pretty good game idea cooking. It's based off of a prototype I made that's evolving into a cool game mechanic. The mechanic itself is a toy that's fun on its own, but we haven't designed any puzzles around it yet. We have a design document going, and we are answering a lot of questions about what's in the game.

It's become clear early on that everyone (including myself) likes the characters and the story a lot. Considering what our favorite games are, this is unsurprising. A story driven game makes sense to me. I like the emphasis that Paper Mario: The Thousand-Year-Door, Portal 2, and Tomb Raider place on story, and I imagine our game will have a similar feel (lots of dialogue, plot twists, lovable characters). These games, IMO, have very successfully merged gameplay and story, so I know it's possible to do this successfully.

However, one team member raised this point in the design doc:

  I am feeling like [fleshing out the story] is our biggest hurdle right now for making more design decisions - like more specific decisions about levels etc. Is this true?

I am uncertain about working on the story extensively before gameplay, and my uneasiness was reinforced when I read this question about story vs. gameplay.

Main Question

My team and I want to design a puzzle-adventure game, such that (in the final version of the game) the puzzles and other gameplay sequences integrate with the story as naturally as possible (the gameplay should, of course, be fun on its own), while the story itself (including plot, characters, events, etc...) does not feel contrived. In light of this goal, in what order should the design of gameplay and story be carried out? And more importantly, what tasks can/should be completed in parallel (by different team members)? Is there anything we need to be wary of during development?

sentences:
How do I provide a fully programmable pipeline for rendering? I am writing a game engine and I want people who use it allow to define the rendering pipeline. Just they can define the scene geometry, characters, items, light sources, and so on. So the term programmable pipeline doesn't refer to using custom shaders in OpenGL, which is the case anyway.

To provide a programmable pipeline, I want to abstract the OpenGL level so that people who use the engine don't directly have to struggle with framebuffers, render targets, and so on. The definition of the pipeline have to be done in scripting. The engine will then load the definition and create the framebuffers, render tagets and so on at initialization time.

Are the already approaches to this kind of a programmable pipeline in game engines? How can I let the people who use the engine define the pipeline on a sensible abstraction level? I do not want them to create all their render targets on their own. It would be better to just define connections beweent passes and the shaders which should be used.

Another problem is to connect geometry and lights with the pipeline if it is customizable. How can I approach this challenging goal? Every idea, as answer or comment, is appreciated.

sentences: Alternative to soundeffect.play()? I have been using a profiler to optimize my game for the Xbox, my aim is as with any optimization to reduce excess CPU and memory usage. I have managed to cut down a lot of the processor time and memory used by my game. However i have a lot of bullets in my game that the player fires and every-time a bullet impacts with something the soundeffect.play() method is called to play the explosion. I would like to know if there is a more efficient way of playing the explosion soundeffect?

sentences:
How do I manually draw a part of a sprite sheet? I'm working in Unity, and I'm finding that the animator isn't working for what I'm trying to do, in my 2D game.  I want to build a specific animation, using sprite sheets, and be able to reuse the same animation with other sprites that are the same size and dimensions by cells. After some research, I find that it is impossible.

Instead, I'm trying to create my own animation script, but I don't understand how to tell Unity to draw only a section of the sprite. Something like in XNA, where you could render only a specific rectangle of a sprite using start and end coordinates.

How do I manually draw a part of a sprite sheet?

sentences:
Trying to make sprite float up and down Using LibGDX + Box2D and my understanding of the answer posted from this question: Here

I apply the following impulse:

// modify sprite's Box2d Body object
int a = 8; // amplitude
int f = 1; // frequency
int p = 1; // phase
float value = (float) ( a * Math.sin( 2 * Math.PI *f * TimeUtils.millis() + p ) );
body.applyLinearImpulse( 0, value, body.getPosition().x, body.getPosition().y, false );

// render it
sprite.setPosition( body.getPosition().x, body.getPosition().y );
sprite.draw( spriteBatch );

But this just causes my sprite to go straight up and offscreen rather than doing a wave. What part of the algorithm am I doing wrong?

sentences:
Too much delay while sending object over UDP to server I'm getting 4 sec delay when sending objects over UDP. Working on small game and trying to implement multiplayer. For now just trying to synchronize movements of 2 balls on the screen. StartingPoint.java is my server(first player), that receiving serialized objects (coordinates). SecondPlayer.java is client that sending serialized objects to server.
   When I'm moving my first object it appears 4 seconds later on different screen.

StartingPoint.java

@Override
public void run() {

    byte[] receiveData = new byte[256];
    byte[] sendData = new byte[256];
   // DatagramSocket socketS;
     try {
        socket = new DatagramSocket(5000);
        System.out.println("Socket created on "+ port + " port");
    } catch (SocketException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    while(true){

        b1.update(this);
        b3.update();

        System.out.println("Starting server...");

        //// Receiving and deserializing object

            try {
                //socket.setSoTimeout(1000);
                DatagramPacket packet = new DatagramPacket(buf, buf.length);
                socket.receive(packet);

                 byte[] data = packet.getData();
                    ByteArrayInputStream in = new ByteArrayInputStream(data);
                    ObjectInputStream is = new ObjectInputStream(in);
                  //  socket.setSoTimeout(300);
                        b1 = (Ball) is.readObject();

            } catch (IOException | ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        repaint();

        try {       Thread.sleep(17);
        } catch (InterruptedException e) {
                e.printStackTrace();
        }

SecondPlayer.java

@Override
public void run() {

    while(true){

        b.update();
        networkSend();

        repaint();

        try {
            Thread.sleep(17);
        } catch (InterruptedException e) {
                e.printStackTrace();
        }

    }

public void networkSend(){

    // Serialize to a byte array
    try {
                ByteArrayOutputStream bStream = new ByteArrayOutputStream();
                ObjectOutputStream oo;
                oo = new ObjectOutputStream(bStream);
                oo.writeObject(b);
                oo.flush();
                oo.close();

                byte[] bufCar = bStream.toByteArray();

                //socket = new DatagramSocket();
                //socket.setSoTimeout(1000);
                InetAddress address = InetAddress.getByName("localhost");
                DatagramPacket packet = new DatagramPacket(bufCar, bufCar.length, address, port);
                socket.send(packet);

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

sentences:
Calling an android method from Unity3D with a JAR plugin I am developing a game with Unity only for Android platform and I am requiring to share content of my game through an intent so I have implemented a JAR plugin according to several tutorials with this code:

package a.b.c;

import android.content.Intent;
import android.os.Bundle;

import com.unity3d.player.UnityPlayerActivity;

public class UnityBridge extends UnityPlayerActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public void callShareIntent() {
        Intent shareIntent = new Intent (Intent.ACTION_VIEW);
        startActivity(shareIntent);
    }
}

The JAR is located at Assets/Plugins/Android with an AndroidManifest file which override the file created by unity, this is its code:

<?xml version="1.0" encoding="utf-8"?>
<manifest android:theme="@*android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0" android:installLocation="auto" package="a.b.c"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
    <application android:label="@string/app_name" android:icon="@drawable/app_icon" android:debuggable="false">
        <activity android:label="@string/app_name" android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:screenOrientation="portrait" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|fontScale">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
        </activity>
        <activity android:name=".UnityBridge"></activity>
    </application>
    <uses-feature android:glEsVersion="0x20000" />
</manifest>

I just copied the manifest created by Unity and added this line:

<activity android:name=".UnityBridge"></activity>

... as you can see.

In the other hand, I have created a C# file in order to launch the share method of the plugin, this is its code:

using UnityEngine;
using System.Collections;

public class BotonCompartir : MonoBehaviour {

    AndroidJavaClass androidClass;

    // Use this for initialization
    void Start () {
        if (Application.platform == RuntimePlatform.Android) {
            AndroidJNI.AttachCurrentThread ();
            androidClass = new AndroidJavaClass ("a.b.c.UnityBridge");
        }
    }

    // Update is called once per frame
    void Update () {
        if (Input.GetMouseButtonDown (0) && Application.platform == RuntimePlatform.Android) {
            androidClass.Call("callShareIntent");
        }
    }
}

... and I have attached it to a gameobject.

When I deploy the apk to an android device nothing happens, so What am I doing wrong? Any other suggestion?

Thank you very much

sentences:
Techniques for displaying vehicle damage I wonder how I can displaying vehicle damage.
I am talking about a good way to show damage on screen. Which kind of models are common in games and what are the benefits of them? What is state of the art?

One way I can imagine is to save a set of textures (normal/color/lightmaps, etc.) to a state of the car (normal, damage, burnt out) and switch or blending them. But is this really good without changing the model?

Another way I was thinking about is preparing animations for different locations on my car, something like damage on the front, on the left side/right side or on the back, and start blending the specific animation. But is this working with good textures?

Whats about physics engines? Is it useful to use it for deforming vertex data? I think losing parts of my car (doors, sirens, weapons) can looks really nice.

My game is a kind of RTS in a top down view. vehicles are not the really most important units (its no racing game), but I have quite a lot in.

sentences:
How can I move the snake toward the mouse cursor? I am making a snake game. I have got it to animate. I just want it to follow the mouse pointer. I am able to find the mouse cursor position. I am also to get my snake to move to the right. What I want is to get my snake to move in the direction in the mouse pointer.

        private void timer1_Tick(object sender, EventArgs e)
    {
        Graphics g = this.CreateGraphics();
        SolidBrush greenBrush = new SolidBrush(Color.Green);
        SolidBrush blackBrush = new SolidBrush(Color.Black);
        Rectangle rect_green = new Rectangle(340 + x, 280 + y, 100, 10);
        Rectangle rect_black = new Rectangle(240 + x, 280 + y, 100, 10);
        g.FillRectangle(greenBrush, rect_green);
        g.FillRectangle(blackBrush, rect_black);
        if (x >= 340)
        {
            x = 340;
        }
        x += 5;
        greenBrush.Dispose();
        g.Dispose();

        if (MouseButtons == MouseButtons.Left)
        {
            Graphics g_two = this.CreateGraphics();
            SolidBrush greenBrush_two = new SolidBrush(Color.Green);
            SolidBrush blackBrush_two = new SolidBrush(Color.Black);
            Rectangle rect_green_two = new Rectangle(340 + x, 280 + y, 10, 100);
            Rectangle rect_black_two = new Rectangle(340 + x, 180 + y, 10, 100);
            g_two.FillRectangle(greenBrush_two, rect_green_two);
            g_two.FillRectangle(blackBrush_two, rect_black_two);
            y += 5;
            greenBrush_two.Dispose();
            g_two.Dispose();
        }
    }

sentences:
Grid Pathfinding with known points What is the best way to, in a grid, to find a path (not necessarily shortest) from a start point to an end point (for both of which the coordinates are known)?

The grid is approximately 60x60, and has some obstacles in it. The coordinates of the start point, the end point, and all of the obstacles are known and easily accessible. Searches such as Breadth-first and A* work, however they seem to do an unnecessarily large amount of "searching" when you should already know where you are going.

sentences:
Restore IAP in Android using Prime 31 can someone please guide me how to restore purchases in android using prime 31.

What my basic understating is to get the list skus which player has purchased after he logs in with his account and restore them accordingly.

What I am not getting is how to get that list.

sentences:
Generate random numbers without repetitions How to generate Random numbers without repeating any numbers in the given target like(1-5000) there should be no reparation and I should be able to get 5000 randomized numbers. I should be able to run the randomized as many times as the user wants,How to do with C#

For Sample
Target is (1-10)
No of times to run =2

First run:
5,4,6,8,3,1,2,0,7,10

second run
6,3,5,8,4,2,0,1,10,7

Like this I should be able to get the results as many times as I run..

sentences:
How to keep the state of all games in the server? i have a problem implementing a turn-based game server in java.

What i want is a way or a technic that let the server keep all the games state that are created in order to the client recover at the same state when an disconnection occurs.

Until now i have developed the server-client programmes and they work fine, but i didn't know that TCP can't recover over some situations of connection lose. So i get so many "connection timed out" errors, and my programmes don't have a reconnect and recover technic. Now i need to think a way the server keeps some info of all the games.

My (for now) solution is to have a class that all threads have a reference to, inside the class we have many ArrayLists to store every info we need so threads can access and handle them.

For Example:

Game-123 has the score 100 so an ArrayList scoreOfGame[123]=100

Game-3 PlayerB name is stored at ArrayList PlayersB_Names[3]=name.

If there is a better way to keep track of all game states seperately on the server, i would appreciate it!!!!

sentences:
How do I keep a rigidbody from making unnecessary collisions on smooth surfaces in Unity3d? I have been having trouble with a custom character controller I am making. The root of the problem lies with collisions. I am trying to make movement code, but I have a problem with ground movement. Pay attention to this gif. It might be hard to notice due to the low frame rate, but the collider registers collisions with objects (in red) that do not point out of the ground. They share the same y-position as the ground. I've printed the normals of the collisions, and there are a lot of normals that are perpendicular to the normal of the ground (which is causing the rigidbody to get stuck).

The problem lies with collisions in unity. If I were to print the y-position of the bottom of my collider, it would be just a tad lower than the y-position of the ground. The collider actually rests below the ground by an almost negligible amount (which is why it doesn't always collide with these objects).

Here is what I have tried: I created a function that runs at the beginning of every FixedUpdate() that uses current collisions to change the y-position of the rigidbody. It only runs on collisions that would ground the player (meaning that they are below the collider). The problem with this approach is that the same issue can occur with walls, meaning that the collider can get stuck on walls. I cannot create another function that would do the same for walls for various reasons.

Here is what would fix the issue: I need help figuring out how I can make collisions more discrete in unity. Colliders rest slightly below objects when ontop of them. They can also "sink" just a little into walls. In other words, colliders can rest into other colliders, and I need this to stop.

Any help is appreciated. Thank you.

sentences:
How does normal mapping really work? I'm trying to grasp the concept of normal mapping, but I'm confused by a few things. In short, I'm not sure whether a normal map is viewpoint dependent or not (i.e. whether you'll get a different normal map of the same object when you rotate around it). Secondly, I don't get why the blueish color is the predominant color in normal maps.

How I think about normals, and their relation to RGB colors, is as follows. The unit sphere represents any unit normal possible — in other words, the X, Y and Z components of a unit normal vector range from -1 to 1. The components of an RGB color all range from 0 to 255. Therefore, it makes sense to map -1 (normal component) to 0 (color component), 0 to 127 or 128, and 1 to 255. Any value in between is just linearly interpolated.

Applying this mapping to the normals of an arbitrary 3D object results in a very colorful picture, not at all predominantly blue. For example, when taking a cube, all six faces would have a different, but uniform, color. For instance, the face with the normal (1,0,0) would be (255,128,128), the face with the normal (0,0,-1) would be (128,128,0) and so on.

However, for some reason the normal maps of a cube I found are completely blueish, i.e. (128,128,255). But clearly, the normals are not all in the positive z-direction, i.e. (0,0,1). How does this work?

[Edit]

Ok, so the approach described above seems to be referred to as the object space normal map or the world space normal map. The other one is called the tangent space normal map. I understand how such a tangent space normal map can be used to modify the normals of a geometry, but I'm still not completely sure how it is actually calculated (see my comment at Nicol Bolas' answer).

[Edit 2]

I should probably mention that I'm working with piecewise parametric surfaces. These surfaces consist of a set of surface patches, where each patch is associated with its own parametric space (u,v) = [0,1] x [0,1]. At any point on the surface, the normal can be calculated exactly. Apparently, the vectors T (tangent) and B (bi-tangent) — required to span the tangent space — are not simply the partial derivatives of the surface patch in the direction of u and v...

sentences:
When does DirectX convert a vertex/pixel's depth from range Near-Far to 0-1? When I output a vertex from a vertex shader, it seems to have a world-space-ish mapping. Vertices about 1 unit away have about 1 unit as their Z value.

When we input into the pixel shader, the depth values are mapped from 0..1 as defined in the viewport state.

Where does this conversion occur? It's late and I'm forgetful, but I can't find a place where I told DirectX what my depth range even was (other than implicitly in the projection matrix). How does it know how to convert it?

sentences:
common math algorithms that aren't physics/object based I'm starting to customize my game a lot more beyond just the engine and I'm curious what sorts of algorithms and concepts exist. There are a ton of solutions for physics and geometry-like questions, but I'm curious apart from that what is the most common. I know of things like LERP, etc. What else do you find most useful?
Thanks,

sentences:
Why are there no sophisticated construction animations in RTS games in general? I want to code a small demo to test what degree of detail regarding animations, is possible in modern RTS/building games and which of them have the largest impact on the playing experience. Similar to the first few minutes of a '0 A.D'/AoE game. (No music and art assets, no story, as simple as possible.)

All building animations in RTS and building games are made rather modest. They simply arise from the ground or jump from one state of completion to the next accompanied by some particle effects.
The Settler games are the only ones known to me, that model the transportation of goods to the building lot and make the area plane, before they build on it.

In the demo I mainly want to focus on the construction process, that should be continuous. The building material is to be represented by objects in the game world. Based on a predetermined pattern, workers shall combine these building materials piece by piece to a building.

Had one of you the same idea and experienced difficulties, that led them to the adoption to a simpler animation/building scheme? Are there computational problems, because this approach needs to many calculations (e.g. for collision detection of the building blocks)?

List of different ways construction has been done in RTS / building games before:

Positions of interest are stored in the links.

Sprite fades in:

Settlers 1

Completed building emerges at desired location:

Anno 1404, Anno 2070, (haven't checked the early ones)

Stronghold, Stronghold Crusader 2 (and 1)

Building arises from ground (without or with worker units bashing the ground)

0 A.D.

Godus

Dawn of War (with extra animation, while the building is ascending)

Incremental, stepping animation (without or with moving/non-moving worker units):

Age of Empires 2

Age of Empires 3

Incremental, continuous animation (without or with moving/non-moving worker units):

?

WarCraft 3 (a mixture of different animation types)

StarCraft 2 (similar to WarCraft)

sentences:
Game Programming Gems series still of value? Former Nintendo dev Mark DeLoura wrote a series of books called "Game Programming Gems".

(http://www.satori.org/game-programming-gems/)

Do these books still contain valuable concepts, considering where games are today, the engines that are available, etc?

sentences:
What game mechanic can I use to show that the player character is bored? I'm designing a part in my game where the player must notice that his character feels bored about a certain mundane task he is doing, without being boring for the player.

By observing the game mechanic, the player should understand that his character is bored or fatigued. To keep the player interested in playing though, the mechanic has to gamify that mundane process into something interesting or challenging.

How could this be done?

sentences:
Do I have to commit the downloadable assets for Unity to the repo? Or a reference for the team to download them? QUESTION (Short version)

I am going to use the Unity Test Tools asset to do unitary testing.
Q: Do I have to commit the Unity Test Tools to my repo? (using git, by the way).

CONTEXT

Team / Workflow

We are an indie team of 10 people (of which 4 coders, 2 graphics, 1 music, 2 marketing, 1 automation-test QA), remotely located.
We built the team 2 weeks ago, have explored Unity, decided that unity shall be our devel framework, and finally we did an internal silly tic-tac-toe internal for us to check the workflow.
Now we want to start developing our 1st game. Clean code. Clean repo.
Using git for version control.
We configured Unity to write all forced in text and visible metas.
We are using Unity5 free edition.

Coding

Up to now, I've managed to create a MVC schema. MonoBehaviour acts as the Controller and then we have non-dependant classes that act as the Model of our game. The controller calls methods of this model. The model throws events to notify the changes in its state.
We want to unit-test the model.

Assets

Yesterday I discovered the Unity Test Tools.
This is the only downloaded asset, the rest of the assets are made by us.
The wonderings presented by this question may happen again if we download other assets or if we want to keep a common own-made library across several games.

QUESTIONS (Long version)

As far as I've seen, assets get "copied" into your project. Okey for working. But... comitting?? I'm feeling uncomfortable.

The same way in PHP you may use composer to handle "dependencies" so if you need a library you do not commit it inside your project, you just commit a text file saying "I want this library, this specific version" -for the sake of example, you can tell composer to install PHPUnit for unit testing, and you commit the composer text file, you do not commmit a full copy of PHPUnit-, these are our questions/wonderings:

Q1) Do I have to commit all the Unity Test Tools in my repo? It is 10 Megas - may seem an overkill or not, depending on your optics... but, as it carries "examples" and I don't know how to filter what is needed and what not, it seems so overkill to me to commit all of it - but worse: this might happen with another asset that is 500 Megas for example. Committing downloadable assets seems anti-pattern. Do I have to commit?

Q2) Or it is better that I don't, and have all the members in the team to manually download the Unity Test Tools?

Q3) If they delete that repo and download it again, the Unity Test Tools seem to be kept local to the project, then a new download is imposed if it's not kept in the repo? Or Unity may store "local in your computer; still global to your projects" things like "the testing library" you are likely going to use in several projects?

Q4) Case one thinks "maybe each project needs its own version of libraries, best practice is do not keep anything global" then, committing them to the project still seems overkill... is there any standard of "config file" that I can place and then once the "git repo" is cloned, run some kind of "dependency installer" or so (much like the composer install action is to a recently cloned repo in PHP)?

I've seeked for information, but I'm still confused on this. I've seen it exists something like an "asset manager" but I'm not sure if this is what I need. Any pointer to documentation I must read will be highly appreciated.

Note that the documentation in Unity website, as for example this one: Mastering Unity Project Folder Structure - Version Control Systems does not address my specific question.

Thanks!

sentences: Best way to test simple cases in games When designing and play-testing a new game, a lot of the time, the people trying out functionality get used to things, and no longer try the "dumb ways" any more. So if the development breaks something, it may be a feature only a new user would bother trying. What are some of the best ways to make sure that your game has its "stupid cases" tested when it's finally released, or after a major update? Methodology, software assistance, maybe even sites where people will play-test for you, et ceteras.

sentences:
How do I display the next speaker image in my dialogue? I am working on a dialogue system and while the text part works, the UI for the Dialogue Boxes does not.

When I click on the Continue button, I want the script to go down the Elements [] and use the Image that I have selected there, similar to what the sentences[] feature does.

This is my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;

public class TextDialogueScript : MonoBehaviour
{
    public TextMeshProUGUI textDisplay;
    public TextMeshProUGUI ContinueDialogue;
    public Image UIDisplay;
    public string[] sentences;
    public Image[] CharacterNames;
    public Sprite[] CharacterDialogueBox;
    public Image[] CharNames;
    //public List<Image> DialogueBoxes = new List<Image>();
    // public List<Image> CharacterName = new List<Image>();
    private int index;
    private int DBindex;
    public float typingSpeed;
    public GameObject DialogueTrigger;
    public GameObject DialogueEventController;
    public GameObject NormalEeventController;

    // Start is called before the first frame update
    void Start()
    {
        NormalEeventController.SetActive(true);
        DialogueEventController.SetActive(false);
        UIDisplay.enabled = false;
        ContinueDialogue.enabled = false;
    }

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

        if(textDisplay.text == sentences[index])
        {
            ContinueDialogue.enabled = true;
        }

    }

    public void OnTriggerEnter(Collider other)
    {
        if(other.CompareTag("Player"))
        {
            NormalEeventController.SetActive(false);
            DialogueEventController.SetActive(true);
            StartCoroutine(Type());
            ContinueDialogue.enabled = true;
            UIDisplay.enabled = true;
            UIDisplay.sprite = CharacterDialogueBox[DBindex];
        }

    }

    public void OnTriggerStay(Collider other)
    {
        if (ContinueDialogue == true)
        {

        }
    }

    public void OnTriggerExit(Collider other)
    {
        NormalEeventController.SetActive(true);
        DialogueEventController.SetActive(false);
        ContinueDialogue.enabled = false;
        UIDisplay.enabled = false;
    }

    IEnumerator Type()
    {
        foreach(char letter in sentences[index].ToCharArray())
        {
            textDisplay.text += letter;
            yield return new WaitForSeconds(typingSpeed);
        }
    }

    public void NextSentence()
    {

        ContinueDialogue.enabled = false;

        if(index < sentences.Length - 1)
        {
            index++;
            textDisplay.text = "";
            StartCoroutine(Type());
        }
        else
        {
            textDisplay.text = "";
        }

        if (DBindex < CharacterDialogueBox.Length - 1)
        {
            DBindex++;
        }

    }

}

I was using a List that grabbed sprites, but the problem is, it would only use Sprites from the Assets and not the Hierarchy. This is a problem because I have messed with the colours using Unity and played around with the Alpha to get the exact effect I want that cannot be replicated with my image program.

(I do not know what the term is for adding [] on the end of items to add elements that can be expanded. I have been stuck on this dialogue system for a very long time and I am very tired yet excited because I am so close to getting this to work, that it's painful)

sentences:
Applying angular velocity distorts model I am calculating the orientation of a sphere through the following code

wV = new Vector3(0, pi/2, 0);
w = new Quaternion(wV, 0);
// o is the current Orientation
o.Normalize();
w = 0.5f * w * o;
// dt is the elapsed time since the last frame
o += w * dt;

However it seems that over time the sphere tends to become distorted and then shrink back to its original size. Is this due to the simplicity of the integration or am I doing some simple mistake?

sentences:
DX11 Handle Device removed I get the DXGI_ERROR_DEVICE_REMOVED error on some machines. According to this (https://msdn.microsoft.com/en-us/windows/uwp/gaming/handling-device-lost-scenarios) MSDN article this can happen and it should be handled by your application.

I've managed to recreate the device but I'm unsure how to handle all content. It seems I have to create all vertex buffers and textures again, which essentially means I have to reload almost the entire scene. Is this really the correct way?

sentences:
How can I quickly determine whether objects are onscreen in 2D? Currently, I have this in each object's renderer's update method:

        float a = transform.position.x * Main.scale;
        float b = transform.position.y * Main.scale;
        float c = Camera.main.transform.position.x * Main.scale;
        float d = Camera.main.transform.position.y * Main.scale;
        onscreen = a + width - c > 0 &&
                a - c < GameView.width &&
                b + height - d > 0 &&
                b - d < GameView.height;

transform.position is a 2D vector containing the game engine's definition of where the object is. This is then multiplied by Main.scale to translate that coordinate into actual screen space.

Similarly, Camera.main.transform.position is the in-engine representation of where the main camera is, and this is also multiplied by Main.scale.

The problem is, as my game is tile-based, thousands of these updates get called every frame, just to determine whether or not each object should be drawn. How can I do this more efficiently, please?

sentences:
Tile map/terrain implementation with differing heights of neighbouring tiles Ahoy!

I'm looking for some information about tile maps, or rather, what a specific type of tile map is called.

I'm interested in the kind of implementation used in rollercoaster tycoon, or the transport tycoon series of games and have been looking into vector field terrain and height map terrain but i'm not sure they're suitable for what i'm looking to develop.

It's been a struggle to find any decent info as most people refer to it as an isometric tile map, but I'm looking to create something in 3D with a fixed orthographic perspective. I understand that the underlying storage of the tile map has nothing to do with how it is rendered but i'm not looking to create a 2D tile map like old school pokemon/zelda games, more along the lines of diablo with the capability to include overhanging cliffs and sloping terrain.

I'm just trying to find the right terms to search google and stackoverflow for resources to help me decide which path to proceed.

So far i've managed to flesh out a basic tile map without using the height/y component stored in a VBO and rendered as a wireframe. This looks fine so far but I envisage that I will encounter problems when trying to manipulate a single vertex to create cliffs and slopes without affecting a neighbouring tile.

Is there a specific type of implementation I should be looking into? I thought i'd cracked it when I found a fair amount if info on vector field terrain but i'm not sure this would yield the correct results either.

If anyone can shed some light on this for me please, the help would be greatly appreciated :)

Update

I've included an image for further clarification as to what i'd like to achieve:

Image borrowed from How to create tilted (height) isometric tiles

This image shows the type of terrain i'd like to generate but doesn't include the "cliffs" or overhanging terrain types i'm interested in modelling. It does however raise a few other questions I hadn't considered, namely;

How would 'layers' such as the water (top left of the image) be handled to include the visible ground underneath the water?
How would the "edges" of the map be catered for so that the earth/mud is rendered to depict the world as a non-flat entity?
Could the underlying storage for this kind of terrain be used to model physics such as a ball rolling down a hill or movement speeds of a player traversing a slope?

I had an idea in that each tile of the terrain could be modelled with 8 vertices where the 4 main vertices cover the actual tile itself and the remaining 4 vertices are used to model the sides/walls of each tile. The two problems I see with this implementation is that a) the world map is essentially doubled in size and b) given that not all tiles will include "walls", some tiles will end up with redundant vertices which are not used.

I'd like to create a terrain editor which allows for each tile to be deformed as well as including the ability to change the terrain during game play. This in itself poses additional questions such as; Can a VBO be used to store and render the terrain whilst being modified on the fly and also, is it possible to modify vertices without affecting neighbouring tiles?

I'm under the impression that i'm either over-complicating things or running into analysis-paralysis in that i'm neglecting to write any code to solve the problem without having a clear idea of how I would achieve what I want.

Again, i'm really just looking for a shove in the right direction with this. Is there a specific type of tilemap/terrain implementation that would cater for a 3D map to be deformed by both a map editor as well as during gameplay or do I have to roll my own, so to speak? I'm not trying to reinvent the wheel here but I am struggling to find any resources given that I'm not sure what to be searching for.

If anyone can provide any info, resources or snippets of code, that would be hugely appreciated as i'm eager to get my hands dirty and start producing something other than the flat wireframe I currently have.

Thanks for reading!

sentences:
Accurate sprite rotation with mouse movement I am using the current mouse position to aim the player sprite, but I am not getting the best results.

It will often by off by a noticeable amount, or even a complete ~180 off if I go from one side, through the player, to the other side.

boolean mouseMoved(int screenX, int screenY) {
    mouseX = screenX;mouseY = screenY;
    rot = MathUtils.radiansToDegrees * MathUtils.atan2((float)mouseY - (float)player.y, (float)mouseX - (float)player.x);
    if (rot < 0) rot += 360;
    player.setRot(rot);
}

Update 1:

When I am at 90/270 it seems to pickup the angle fine. But for 0/180, the angle is off depending on how far away my cursor is to a certain point (not the player's point).

Update 2:

Added in semi-fix, but I'm still having the same exact problem

Update 3:

I was mistaken the semi-fix wasn't actually a fix. I fixed it for real, though. The problem was that libgdx has (0,0) at the bottom left, but the InputProcessor has (0,0) at the top left. What I had to do was adjust the mouse position so that it's (0,0) was the bottom left. I did this by

mouseX = screenX;
mouseY = Game.HEIGHT - screen y;

This will give the player coordinates & mouse coordinates the same origin, and then the formula will work.

sentences:
what is use of ScriptableSingleton in Unity? in unity 2020.x Unity just has introduced scriptable Singleton. a class that derives from Generic Class Called ScriptableSingleton its like singleton but you only can have single instance of it and seems to be good for ScriptableObjects that need to be Forced to be Single. but there are some differences.
they can be project Specific or Shared. they can get any format and unlike usual scriptableObjects they have no visualization in the inspector. the question is how should i use them and they are appropriate for which approaches? this is the link to the reference:
https://docs.unity3d.com/2020.1/Documentation/ScriptReference/ScriptableSingleton_1.html

sentences:
Pygame, how can I move a rect/sprite from point A to B smoothly? As the title suggests, i want to move a rect/sprite from point A to point B in a smooth manner. What I mean more specifically is that the speed of the movement should change throughout the course. So it starts off slowly then speeds up as it reaches the half-way point then slows down again to finally land exactly on B. Or it can just start off fast then to slow down right till it hits B.

I've already tried to do this once by making the acceleration of the object 1/2 of the distance it needed to travel then halving the acceleration again before every frame. Then after a while it just reassigns the objects position to exactly where it needs to be. But i don't really like this method and i thought there had to be a more elegant and efficient way of doing it. But I can't think think of anything.

Here's what I've got so far(It's not the one that 1/2s acceleration):

clock = pygame.time.Clock()

class Block():
    def __init__(self, x, y, width, height):
        self.x = x
        self.y = y

        self.rect = pygame.rect.Rect((self.x, self.y, width, height))

    def draw(self, surface):
        pygame.draw.rect(screen, (55,150,55), self.rect)

        self.x = self.rect.left
        self.y = self.rect.top

    def move(self, vect):
        x = vect[0] - self.rect.left
        y = vect[1] - self.rect.top

        self.rect.move_ip(x, y)

block = Block(100, 100, 50, 50)

def gameloop():

    loopExit = True

    while loopExit == True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                loopExit = False
            if event.type == pygame.KEYUP:
                if event.key == pygame.K_d:
                    block.move([5,0])

            if event.type == pygame.MOUSEBUTTONUP:
                block.move(pygame.mouse.get_pos())

        screen.fill((25,25,25))

        block.draw(screen)

        clock.tick(60)

        pygame.display.flip()

gameloop()

sentences:
Player jitter when positioned at large coordinate values I am trying to make a simple top down scrolling shooter using Unity3D comprising of the following elements:

1) Top down orthographic camera: points at 65 degrees towards the ground. At a height of 1000 units. Size 100.

2) Spaceship: Moves around based on the up/down/left/right keyboard commands. Each press moves the ship 1/100 of the screenwidth in distance. I keep its position in screen coordinates and use a ray cast to project it to a height of 500 units off the ground in the camera space using the following code:

Ray ray = mainCamera.camera.ScreenPointToRay(screenLocation);
Plane plane = new Plane(new Vector3(10, 500, 0),
    new Vector3(0, 500, 10),
    new Vector3(-10, 500, 0));
float enter;
plane.Raycast(ray, out enter);
transform.position = ray.origin + ray.direction * enter;

3) A camera scroll component that moves the camera forward by 0.75 units every frame.

When I play the game the spaceship is controlled in screen space and its world coordinates are calculated relative to the scrolling camera. The camera starts at y: 1000, z:0 and z is incremented by 0.75 (scroll per frame).

The problem I am running into is that after a while, the player ship begins jittering. The jittering gets worse the longer the game goes on. The jittering is noticeable around the time z becomes 4200 which gives me about 1m30s game time at 60fps before the jittering starts. The levels I want to create would only be less than 20 mins which would mean that I need a max Z value of 2700 assuming my Z started at -2700 and finished at +2700.

I realised this must be caused by the limitations of floating point precision so I started playing around with the numbers to see what I could do to solve this.

I found that modifying the height of the camera to 50 and the ship to height 25 whilst keeping the orthographic camera size at 100 allowed me to set the distance to around 32,000 with no jittering. I didn't fully understand why this worked as the values of the ship transform and camera transform were still truncated to 2 decimal places at the extreme distance of 32,000. Scaling the camera size to 5 brought back the original problem. This 'fix' seemed mighty hacky to me though as it pretty much screws up the scale of objects in the game and only looks 'normal' because of the orthographic perspective. I don't know how well this would play with other things I plan to add to the game.

I have 3 options at this point:

1) Continue to find a way to get it to work with the limit of 20 minutes and using a virtual camera that tracks around the world coordinate frame. This would be great if it works as I could easily use the editor to add enemies at correct positions e.t.c.

2) Make it so that when it reaches a z limit, the camera resets to z = 0 and all objects in the scene revert back relative to the camera shift. The downside to this I guess is that I would need to figure out how to get the objects to shift back correctly when the limit is reached and also it would be trickier to use unity's editor to do enemy placement e.t.c.

3) Keep the camera at position z=0 and scroll the world backwards towards the camera. This seems like the ideal thing to do as I could place objects and scripts in unity world space and when the game runs, these elements could shift back every frame. I don't know how to achieve this at the moment however. I thought of using a parent object that moves back by 0.75 every frame. Enemies would be children of this object and the player camera would not be a child but be at the same place all the time. However I think this would still cause problems as maybe enemies placed far out in the z direction might jitter as they moved around. Is this concern legitimate?

I am wondering if anyone has any better ideas to solve my problem or understands why changing the height scale seems to temporarily fix the problem?

sentences:
C++ Entity Component System: Diverse Behaviours I'm trying my hand at an action RPG kind of game and using a modified version of entityx from alecthomas, which is basically an Entity Component System. I have really big troubles with some of the stuff I want to implement, because I don't know how to put it in terms of Components. Here are some of the things I can't figure out:

Let's say I have entities that are supposed to represent actors and they have things like Health, Stamina, Mana, Attributes... How would I implement a timed buff/debuff system, without defeating the purpose of ECS? Each actor can be affected by multiple buffs at a time and the buffs could influence anything about them. A component can only hold so much data and I can't introduce a new component for each buff that needs to save different data.
If I had a Chain Lightning skill that I cast with an actor and it selects and damages enemy actors at random immediately, the game-logic processor would just dish out the damage and create an entity for the Lightning Effect with a RenderComponent. But the RenderComponent will only tell the render processor that it is Lightning, where does the data go that describes which enemies were hit? Most skill effects have some kind of parameter for their renderable parts like Source, Target, Intensity...

Both questions are based on the same problem: How do I represent things that can have diverse parameters in as few components as possible?

sentences:
Fastest way to neutralize scale in the transform matrix? Let's assume we have 4x4 3D transformation matrix, that is the result of scale, rotation, and translation transforms. How to set its scale to (1,1,1) in the fastest way? Assume also that the matrix is represented by float[16] array.

By fastest way I mean, the most performance accurate way, that will be low CPU cost.

sentences:
How do I end a behavior tree's action early without evaluating the entire active branch? I'm reading about behavior trees, and one of the common recommendations I've seen is to maintain a reference to your running action so that you don't have to traverse the entire tree during every game loop.  Without traversing the entire tree every time, how do I check if an action should end early?

For example, suppose I have the following tree and the AI encounters an enemy that's closer than 10m, so he starts to aim his weapon.  But then while he's aiming, his HP drops below 50%.  I would want the agent to stop the aiming/firing sequence and move to the "use medkit" action.

The only way that I can think of to accomplish that sort of behavior is to evaluate every node in the active branch -- starting from the root node -- during every game loop.  But based on what I've read, evaluating the entire active branch every game loop is discouraged.

Is there a way to be able to abort an action if a higher-level node is no longer valid, while not spending a lot of processing power evaluating the entire branch every game loop?

sentences:
Can I use System.Windows.Rect in Unity? I need to work with a Rect that has Left, Top, Bottom, Right.

Unity's Rect has x, y, width and height instead.

Also, Unity's Rect doesn't accept Rect.Compare(otherRect).

System.Windows.Rect however seems a good choice for my needs.

I would like to ask if it's ok to use System.Windows.Rect in my Unity script and if it will be cross-platform.

sentences:
How to inplement a save-system for a complex nested list of character classs? This is the situation I'm in:

I'm developing a game with C# using unity. In the game I have characters which is either locked or unlocked, and they're pretty much the same. For every character, they have their respective rank, level, type and race (provides additional effects), HP and MP as well as some stats, unique abilities with arbitrary effects to the game suited to them.

Then, the complication comes in as there's also a "Inventory" with predefined "Items", which every one of them holds arbitrary effects, can be either passive or active, as well as another set of rank and level for every item.

So, now I have to do planning. I want all the parameters for the characters to be in a single file (for obvious reasons), where the character class should read these file, retrieve the relevant part, and apply it to the character.

The game will be updated with new characters/items, or changed abilities/stats/effects. My saving system has to generate save data that persist from all versions too. (Say, a character is added. Then the old save should still load fine, with the new character initialized at locked and basic stats)

And I'm not sure what should be used to implement it with such a multi-layered nested structure, which still has to persist. My idea is to make the whole character structure a list with each character being the element, but then I can't see how to make a flexible system when there are apparently lists of lists of lists of lists, which is basically a mess to work with. I need some way to store the structure in a abstracted way that allows me to save all the parameters in all the nested stuff of a list of characters in a save file, and then also be able to read them (and fill those missing parts with initialized value).

sentences:
MonoGame: PC + Mobile? I'm researching Monogame. Their goal is to allow "easy" porting of an existing XNA/Windows game to mobile.

Does this mean you can have one solution (theoretically) with shared code, and it works on all three platforms (PC, Android, iPhone)? Or do you need to port your game from PC to Android, and then again to iPhone?

I'm sure "write once, run anywhere" works 80% of the time, I'm not worried about that other 20% like support for GPS, acceleratometer, etc. which doesn't exist on all platforms.

sentences: How do I make my prefabs spawn behind the UI? I'm making a game where three characters spawn in specific locations. I made three gameobjects called stations so I could take the transform positions and spawn the three caracters there. And I have a UI element that is supposed to stay in front of everything. But the problem is that when I hit play, the three characters spawn in front of the UI element. I already checked the positions related to the camera but it doesn't seem to be it. Does anyone know how to help me?

sentences:
Intersystem communication in a ECS game Apologies if this question has been answered before, but after relentless searching I couldn't find anything.

As many, I've recently jumped on the ECS-bandwagon, and I am currently killing some time by making a modest ECS-game. The game is a somewhat simple 2D-platform game. It is programmed in plain JS.

The layout of the game is essentially as following:

The core of the game is the Engine, the Engine runs the game-loop and holds an EventManager, responsible for raising events, and an EntityManager, responsible for containing all components of all entities.

All logic is done by systems. The systems registers event-handlers (i.e. member-functions) with the EventHandler for specific EventTypes, which gets called when an event of that type is raised.

For example:

this.eventManager.registerHandler(EventType.EVENT_RENDER, this.render, null, this);

I recently switched from calling all systems relevant functions explicitly in the Engine to this pattern.

But over to my problem and question.

For rendering I have a RenderSystem. This system contains references to several type of drawable/animatable-components which it, you guessed it, renders.

Until recently, this system also contained a reference to another system, MapSystem, which spatially indexes all entities. The reason for this reference was to be able to call a function along the lines of

mapSystem.search(frame_bound);

effectively pruning away all entities not needing to be rendered.

So I have a couple of questions regarding this:

Is it very bad practice for systems to communicate directly? Something about it just doesn't smell right to me.

I see how it might severely complicate your code if you have say 100 systems, and each system holds references to many of the other systems. Hello O(n^2).
If I am not to hold inter-system references, how do I perform communication like described above?

My initial thoughts was to create an entity whose primary purpose were to hold the necessary information (i.e. all entities currently in the frame). Then let MapSystem write to and RenderSystem read from this entity.

But this also seems to be rather unclean to me. Especially as MapSystems search function might be useful to call in many different contexts. Creating an entity per calling-context doesn't really seem like a good way to go about it either.

TL;DR: Is it bad for systems in a ECS-game to communicate directly and hold references to each other?

sentences:
Basic 2D game collision I've been trying to program a game for the past while and I can't ever figure out one thing: collision detection. I can get up+down and left+right to work, but when I put them together, they interfere with each other.

I seriously don't really know how to do it, and I don't want to have to use Box2D or any other premade collision detection system. All I need is something simple and will work in 4 directions.

Here's the code I have now from my Player class:

for (int i = 0; i < blocks.size(); i++) {
            Block b = blocks.get(i);

            if (isCollidingDown(b)) {
                b.doTopCollision(this);
            }

            else if (isCollidingUp(b)) {
                b.doBottomCollision(this);
            }

            else if (isCollidingLeft(b)) {
                b.doRightCollision(this);
            }

            else if (isCollidingRight(b)) {
                b.doLeftCollision(this);
            }

        }

Here's the actual detection code. I know it's long, but just roll with it:

public boolean isCollidingDown(Block b) {
        if ((Float.compare(this.yPos,b.yPos+b.height) <= 0) && (Float.compare(this.yPos,b.yPos)>=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)>=0)) {

            if (((Float.compare(this.xPos, b.xPos)>=0) && (Float.compare(this.xPos, b.xPos+b.width)<= 0)) ||
                    ((Float.compare(this.xPos+this.width,b.xPos)>=0) && (Float.compare(this.xPos+this.width,b.xPos+b.width)<=0))) {

                    return true;

            }
        }
        return false;
    }

    public boolean isCollidingUp(Block b) {
        if ((Float.compare(this.yPos+this.height,b.yPos) >=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)<=0) && (Float.compare(this.yPos,b.yPos)<=0)) {

            if (((Float.compare(this.xPos, b.xPos)>=0) && (Float.compare(this.xPos, b.xPos+b.width)<= 0)) ||
                    ((Float.compare(this.xPos+this.width,b.xPos)>=0) && (Float.compare(this.xPos+this.width,b.xPos+b.width)<=0))) {

                return true;
            }
        }
        return false;
    }

    public boolean isCollidingLeft(Block b) {
        if ((Float.compare(this.xPos,b.xPos+b.width) <=0) && (Float.compare(this.xPos,b.xPos)>=0)) {

            if (((Float.compare(this.yPos, b.yPos)>=0) && (Float.compare(this.yPos, b.yPos+b.height)<=0)) ||
                    ((Float.compare(this.yPos+this.height,b.yPos)>=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)<=0))) {

                return true;
            }
        }
        return false;
    }

    public boolean isCollidingRight(Block b) {
        if ((Float.compare(this.xPos+this.width,b.xPos) >=0) && (Float.compare(this.xPos+this.width,b.xPos+b.width)<=0)) {

            if (((Float.compare(this.yPos, b.yPos)>=0) && (Float.compare(this.yPos, b.yPos+b.height)<= 0)) ||
                    ((Float.compare(this.yPos+this.height,b.yPos)>=0) && (Float.compare(this.yPos+this.height,b.yPos+b.height)<=0))) {

                return true;
            }
        }
        return false;
    }

Note that I had to do this Float.compare() thing because floats aren't accurate when comparing. Also, I'm not using Java2D, I'm using a framework called libgdx. That shouldn't matter though.

What can I do? Thanks!

EDIT: Guys, that's not the point. I know my code is very unprofessional, but the point is that the collisions don't work the way they're supposed to. I just need a 4-way collision system with boxes. That's all.

sentences:
Why do I get this error about DllMain when using D3D from within a DLL? I am trying to create a Dll that will handle all my rendering, I am trying to initialize Direct X but I am getting the following error message:

  DXGI ERROR: CreateDXGIFactory cannot be called from DllMain. [ MISCELLANEOUS ERROR #76: ]
  Exception thrown at 0x00007FF978181F28 in Engine.exe: Microsoft C++ exception: _com_error at memory location 0x000000541631BE90.

I never directly call CreateDXGIFactory, I only call D3D11CreateDevice before the program crashes, here is the code for D3D11CreateDevice:

HRESULT hRes;
    D3D_FEATURE_LEVEL featureLevel;
    m_pConsole->WriteToConsole("Creating D3D11 device !");
    hRes = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, D3D11_CREATE_DEVICE_DEBUG, NULL, 0, D3D11_SDK_VERSION, &m_pD3D11Device, &featureLevel, &m_pD3D11DeviceContext);

This function call is not in Dll main it is in an initialize function that is in its own class within the Dll.

sentences:
semi 3d walls, should I use sprite sheet or render them 3d? I'm going to develop a game and this is just a prototype of it's graphics.

Knowing that my primary target platform is iPhone, I'm wondering if it's better to create a spritesheet containing all possible angles from a wall or is it better to render them with 3d boxes?

here is sample spritesheet I was going to use:

sentences:
Try to connect to Game Maker server I'm trying to make a simple multiplayer experience with Game Maker, using a local network, and the basic idea is to use Game Maker's built-in networking functions.
Using a simple client-server pattern, I want to create a server only if there is no active server in my local network. My idea is to scan all the IPs from 192.168.0.0 to 192.168.255.255 (inelegant, I know, I'll figure out a way to determine "192.168.x.x" after solving this problem, maybe looking at the subnet mask). Here is the code:
var n1 = 192;
var n2 = 168;
var n3 = 0;
var n4 = 0;
var server = -1;
var ip = "";

while(n3 <= 255 && server < 0){

    ip = string(n1) + "." +
         string(n2) + "." +
         string(n3) + "." +
         string(n4);
    show_debug_message("Trying " + ip);
    server = network_connect(global.socket , ip, port );

    n4 += 1;
    if(n4 > 255) {
        n4 = 1;
        n3 += 1;
    }
}
if(server >= 0)
    show_debug_message("Found! Here you are: " + ip);
else
    show_debug_message("No IP found, man!");

And that's the problem: the first IP doesn't work, the game freezes for a minute and then all the others tries will fail, even the right one, with this error:

trying 192.168.255.254
ioctlsocket failed with error: -1
Error (0x    2736): Could not set socket option

My tries:

I tried starting with the right IP and it works, so, the connection works.

I tried lowering the timeout to one second and the effect is what I expected: after one second the first attempt fails and all the latter fail as well

Any idea to check the connection before actually try it? Thanks in advance!

sentences:
How to make AI detect a target behind a wall, who is only partially exposed? I'm making an FPS game where, even when a target's whole body is behind a wall or box, but its finger or foot exposed, the AI should be able to detect it and shoot its finger.

So far the way I've thought of to implement this it so traverse all the targets, find who is near a wall, and compare their position with the corner of wall. But I don't know how to check whether its finger is exposed.

I could use a raycast forward from the AI's gun, but would I need to add a collider to every small body part of every target?

sentences:
Tagging "regions" in rot.js map generator I'm working on a small roguelike and I'd like to be able to tag the various "regions" generated via the Map generators so that I can use it as a lookup to environment descriptions.  I see that there are "Rooms" that are generated in the dungeon generator algorithms, however I didn't really see anything similar in say, the cellular automata generator.  Is there a way to leverage the generator in rot.js, or am I stuck with manually determining if I'm in a particular open area (and breaking encapsulation of internal, private variables along the way)?
Basically, I'd like to be able to link up my player's location to the text you see at the bottom of , but can't seem to figure out how to do it generically.  I'm fairly certain I could use the 'Rooms' object in the first 2 screenshots, and everything else is a hallway, but I'm not clear on how I could get a particular 'region' in a cellular automata generator (or one of the maze generators, for instance).

sentences:
Save a mouse coorinates after a specific number of seconds I have a specific method that saves my mouse x and y coordinates. I want that mouse coordinates be saved by specific time (for example after 1000ms). How I need to do that in Java?
Please add a simple usage example.

 public void mouseMoved(MouseEvent e) {
        currentX = e.getX();
        currentY = e.getY();

        if(enemy.onWall() == true){
            timer.schedule(new TimerTask(){
                public void run() {
                    saveX = e.getX();
                    saveY = e.getY();
                    enemy.setCont(true);
                    move();
                }
            },100);
            enemy.setOnWall(false);
        }
    }

But this code saves mouse coorinates immediately and then waits for 1000ms and I have old coordinates.

sentences: How to protect Lua scripts in IOS game? I'm developing an iOS game and was considering putting level info and monster info in a Lua script for ease of use. However, since I'm using Game Center for multiplayer I'm concerned users will attempt to change these scripts to cheat. What measures can I take to protect my Lua scripts?

sentences:
2D Map Editor Tiles Palette - Best suited Java Elements to use? I'm making a 2D RTS Map Editor and here came the moment to make a Palette which is just a popup frame showing tiles to be clicked on and then applied on the map.

I'm wondering which Java Elements to use for this palette?
At the moment I have set a JFrame which will contain Jlabels which have their Icon set as some ImageIcon (which are the tiles of my game).
(I have a List<ImageIcon> tiles which contains every tiles)

mainFrame.setLayout(new GridLayout(tiles.size() / 2, 2, 5,5));
    JLabel tilePanel;

    for (int i = 0; i < tiles.size() ; i++) {
        tilePanel = new JLabel();
        tilePanel.setIcon(tiles.get(i));
        mainFrame.add(tilePanel);
    }

Here's what I have:

However, I want to be able to click on these JLabels to be selected and so that I can use a function like getSelectedTile in my main JFrame to place them on the Map. But adding a mouseListener/Event to each and every JLabel doesn't seem right.

My questions are:

Am I going the right way? If so, how should listen to my JLabels to know which tile is selected.
What SHOULD I use if this isn't the way to go?

Thanks in advance! All suggestions will be taken into consideration :)

sentences: Estimated framerate for custom engine? I've been writing my own engine with C++ and DirectX 11. I've got 3d models loaded in with diffuse maps, normal maps, and shadows. There's other things with the engine but my question doesn't pertain to those parts. What estimated framerate should I be getting from a simple cube with all the maps on it. And a moving shadow? Obviously my computer specs make the biggest difference. But lets say anywhere from Nvidia 500 series to 700. Personally I have a GT 750m. So whats a rough estimate of framerate to be getting? Dont want to keep building something that has a major framerate flaw.

sentences:
.NET WCF as backend server for iPhone games I'm planning to develop an iPhone game. Is it possible to use .NET WCF as a backend?
The server would be windows 2008 and MS-SQL database.

sentences:
Does gimbal lock occur only when a combination of local and world rotation axis are used? In all the explanations I've seen of gimbal lock, they always refer to the fact that when performing a series of rotations on all axes, it is possible that one rotation might end up aligning an axis with another which causes us to lose a degree of freedom. This never made sense to me since a rotation around e.g. the LOCAL_RIGHT axis will rotation the whole LOCAL_BASIS, no alignment happens. The only explanation I've seen that made sense was this one by DMGregory where it clearly explains that gimbal lock occurs when we e.g. change the yaw using the local basis and the pitch using a world basis.
My question is: Is that the only scenario where gimbal lock occurs or am I missing something? I also thought that quaternions help avoid gimbal lock but again, I'm missing something here because it seems to occur regardless of the rotation representation method (euler/quaternion).

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

sentences:
Applying a torque to a different centre of mass In Unity I have an object with a circle collider attached to it and when I apply a torque to this object's rigidbody2D, it rotates as expected. However, I have now attached a sub-object to this object with a polygon (trigger) collider which I am using to detect when something is in a cone in front of the ship. There is no rigid body (2D or 3D) attached to the child object. The only rigid body on the object is the one I am applying torque to.

However, when I do this, the centre of mass of the ship is moved to the centre of this collider, which produces totally the wrong effect. This happens even if I move this collider to the root node (so both it and the circle collider are attached).

I either need a way of getting the rigid body to ignore the child collider/allow me to set the centre of gravity, or else some other way of detecting objects inside a region.

sentences:
Rotation grid positions I'm dealing with objects on 15x15 chunks in my game.
I'd like the chunks to rotate, for example, rotation version 0 is the original position of 2,5;
(EDIT: Oops, rotation 2 and 3 names need switching in the image)

How can I get the other positions in the simplest and quickest way? It only needs to rotate in 90 degrees increments, having 4 version (so 0, 90, 180, 270)

sentences:
Runtime NavMesh Builder source mesh combined mesh is skipped because it does not allow read access I'm getting this error:

  Runtime NavMesh Builder source mesh combined mesh is skipped because
  it does not allow read access

I checked all the models and it has the read permission. I also noticed, that in some cases unchecking the static checkbox helps and I'm getting a smaller amount of these errors.

sentences:
How do I save data to the iPhone properly and securely? I'm creating a game using Cocos2D (objective-c) and it has come to the point where I have to save data to local storage, like high scores and similar stuff.

I know that NSUserDefaults is not a good option because it isn't encrypted. I would like to know what is or what are the best/simple methods of saving data with security to the iPhone to avoid a casual hacker from changing the score.

sentences:
Game Engine Class and Subsystem Architecture I have a quick question for those who have experience coding their game engine and such. I was wondering what a better approach would be when designing my own game engine. Right now I plan on having different "subsystems" for example a event system and a graphics system (I plan on including more later on and they may or may not contain their own hierarchy). My question is should my engine class inherit these systems or should I make each system a member of the engine class or is there another proper way of structuring my engine? Whatever approach I wish to choose, I want it to be modular yet efficient.

tl;dr: What is the proper architecture for a game engine with subsystems in C++?

sentences: How to unpack game data files encrypted with AES key? In game development pak files are secured by some encryption and one of these are AES key. I want to know that for security purpose is the AES key is stored in the game files itself? I know that computer cannot store the AES key in his mind so it need some clues or files to extract these Ppak files, so where does these AES keys gets stored in a game file itself?

sentences: Help me to find a simple 3D game development tutorial in Unreal Engine 4 I am looking already several hours to find a UE4 tutorial that creates a simple 3D game from scratch, but not using Blueprint. Instead I would like to see complete C++ tutorial. Cannot find any resource! Maybe unreal gurus can help on this? A single link of a game from scratch that is being created using C++ with UE4.

sentences:
Ray & Segment Intersection I'm writing some code to check intersection between all of a rectangles segments and a ray. It will sometimes use the Left and Right side of the rectangle as the closest face hit (face DA & BC) even when it is clearly on the top of the rectangle (face AB).

This is what the Rectangle v Ray collision looks like.

    // Ray intersections
    static public IntersectData IntersectRectRay(Rectanglef rect, Vector2 origin, float dir)
    {
        IntersectData data = new IntersectData();

        // Create segments for all the sides of a rectangle
        Segment topLeftRight = new Segment(rect.TopLeft, rect.TopRight);
        Segment leftTopBottom = new Segment(rect.TopLeft, rect.BottomLeft);
        Segment bottomLeftRight = new Segment(rect.BottomLeft, rect.BottomRight);
        Segment rightTopBottom = new Segment(rect.TopRight, rect.BottomRight);

        // Check collision with all the faces and use the closet one
        float smallestDepth = float.PositiveInfinity;

        IntersectData topLeftRightData = IntersectSegmentRay(topLeftRight, origin, dir);
        if (topLeftRightData.intersecting && topLeftRightData.depth.Length() < smallestDepth)
        {
            smallestDepth = topLeftRightData.depth.Length();
            data = topLeftRightData;
            data.face = "AB";
            data.dir = MathHelper.PI / 2f;
        }

        IntersectData leftTopBottomData = IntersectSegmentRay(leftTopBottom, origin, dir);
        if (leftTopBottomData.intersecting && leftTopBottomData.depth.Length() < smallestDepth)
        {
            smallestDepth = leftTopBottomData.depth.Length();
            data = leftTopBottomData;
            data.face = "DA";
            data.dir = 0f;
        }

        IntersectData bottomLeftRightData = IntersectSegmentRay(bottomLeftRight, origin, dir);
        if (bottomLeftRightData.intersecting && bottomLeftRightData.depth.Length() < smallestDepth)
        {
            smallestDepth = bottomLeftRightData.depth.Length();
            data = bottomLeftRightData;
            data.face = "CD";
            data.dir = MathHelper.PI / 2f;
        }

        IntersectData rightTopBottomData = IntersectSegmentRay(rightTopBottom, origin, dir);
        if (rightTopBottomData.intersecting && rightTopBottomData.depth.Length() < smallestDepth)
        {
            data = rightTopBottomData;
            data.face = "BC";
            data.dir = 0f;
        }

        return data;
    }

and this is the ray v Segment intersection

    static public IntersectData IntersectSegmentRay(Segment seg, Vector2 origin, float dir)
    {
        IntersectData data = new IntersectData();

        // Get vector between p1 and p2
        Vector2 q = seg.p1;
        Vector2 s = seg.p2 - seg.p1;
        Vector2 p = origin;
        Vector2 r = new Vector2((float)Math.Cos(dir), (float)Math.Sin(dir)) * 100000f;

        float t = MathHelper.Vec2CrossProduct(q - p, s) / MathHelper.Vec2CrossProduct(r, s);
        float u = MathHelper.Vec2CrossProduct(q - p, r) / MathHelper.Vec2CrossProduct(r, s);

        if (MathHelper.Vec2CrossProduct(r, s) != 0 && t <= 1 && t >= 0 && u <= 1 && u >= 0)
        {
            data.intersecting = true;
            data.depth = p + t * r;//q + u * s;
            data.dir = dir;
        }

        return data;
    }

Extra Info: My Vec2CrossProduct is V × W to be Vx Wy − Vy Wx

I imagine there is something wrong with the ray segment intersection because if I tried to replace that 100000f with float.PositiveInfinity() it won't work.

sentences:
How to blend two cameras when traveling through a portal in Unity3D Before I get to my question, I know the most obvious solution would be to use the normalized view port rect, however I need more complex shapes than a rectangle, and I've looked in to using the view port rect and it seems to not be my solution.

EDIT:
Some people were confused by my question, let me go in to a bit more detail.

What's happening is as the player moves in to one portal, I create a clone FPS controller and move it out of the other. This gives me two cameras, and the view you see on the right above. It's just showing one camera, and clipping through the portal. What I want is something similar to this where the cameras blend to create the illusion of a smooth transition. What I want to do is delete everything from the green checker image to the left in the image below, and replace that with the other camera. That way you get the part of camera A's view that is peaking out of the portal, blended with the part of camera B's view that's peaking out of the other portal, to get one complete image. And as you move through the portal the cut changes appropriately.

I've been designing a portal system, I have everything down, including getting the player to smoothly move through the portal. My main problem now is getting that camera blend effect Valve does. I need two cameras to blend together seamlessly, as if you were poking your head through the portal. And it can't just be a rectangle, it has to match however the player is looking through the portal.

My best lead on this right now is to possibly project a depth mask shader behind each portal, then make the camera from the portal you're traveling to be depth only. Then somehow mix the two cameras. My main problem is figuring out exactly how I'd do this, how to make the second camera only render what's outside of the portal, and have the rest default to camera 1 to get one full screen projection.

If you could give me ideas, or explain how I may do this with the depth mask shader that would be a tremendous help. I'll continue to work on this and update as I make break throughs.

sentences:
XNA Content Pipeline With Map Creation Utility I've been looking into how to use the XNA Content pipeline appropriately for a game I am working on. I have however been having a hard time wrapping my head around it and am not sure on the best way to proceed.

The specific example is, I have a top down 2-d RPG style game. I want to create a utility (probably Windows Forms) that will allow me to easily create and edit maps. Each map consists of 1 or more graphic layers, each layer containing a N x N grid of tiles. In turn each tile starts out as a bitmap.

Given the above information I see a few ways to proceed:

Store the map info in an XML file compatible with the Content Pipeline XML loader. Each tile is stored as a string reference to the corresponding texture asset. Texture assets are added in the game project.
Store the map info in an XML file compatible with the Content Pipeline XML loader.
Each tile is stored as the path to the corresponding .bmp/.png files.

Now there are things that I really don't like about both approaches. The main issue with approach one is that the map creation and the .xnb texture asset creation are completely separate. The .xml map file is created by the utility, while the texture asset is added to my content in my game. This becomes an issue trying to make sure the .xml map file and all the texture assets in the project stay in sync.

Approach two would allow me to keep all the appropriate image file next to the map files using the map utility. However, it seems like I shouldn't have to do something like this. Also I would need to be more intelligent about loading the maps so that I am not rapidly loading the same image off disc for each tile.

So my question is: If you want to add a content generation utility (like a map editor), what is the best way to make sure that the custom content (map file) stays in sync with the texture assets. Also, keep in mind that in my map editor I would need the ability to load and display the texture assets.

Any input is much appreciated.

sentences:
Does SoundEffect.CreateInstance load from file everytime? This is something which has been bugging me. If I create a SoundEffectInstance via  SoundEffect.CreateInstance() I'm meant to dispose of it when I'm finished with it. SoundEffect.CreateInstance() does not use ContentManager as far as i can tell.

So does it load from file or does it keep a copy in memory? Loading from file would obviously be very slow :-/

sentences:
How to stop a host from the client script? I am developing a two player multiplayer game. Since its only two players, I don't want to keep my connection open if a player disconnects.

Now this works well from the host side, through usage of StopHost(). If the player who hosts disconnects, it disconnects both the players from the game.

But using StopHost() in the client(Player B) side does not remove the host player(Player A). In other words, the client is out of the game, but the host is still in the game.

So, what I want is if one player(host or the client whoever it is) disconnects, I want both of them to be disconnected.

So, how can I do it? Please help me with this. I have almost lost hope with UNET. Thanks

EDIT:

My setup is like this, my LobbyManager comprises of UI elements like "TitlePanel", "MainPanel", etc.  The Disconnect button is part of the title panel and gets enabled on press of Esc key. The button is linked to a script attached to the "TitlePanel". This script uses a MonoBehaviour which I changed to NetworkBehaviour in order to use [Command]. But it doesn't work as my "Title Panel" does not have a NetworkIdentity. Adding one creates even more problems

So, I thought if there was a way to send mesages from client to server without NetworkBehaviour, then maybe I could send a flag there to the server.

So is it possible?

sentences:
Multitexturing depending on given variables? I'm having trouble with rendering multiple textures.
Using XNA gamestudio: working with 3D meshes and texturing.
Effect.fx HLSL

I do have a map/level that loads from a heightmap. - This works

I have created an effect.fx file that renders the textures. - This works

Multitexturing shader works to a degree where I hardly can alter the function.

So I can fade from different textures if I pass a height value, would have worked fine if the world was meant to be solid/static, but that's not the case here.

I want to hold certain variables to the vertex/faces and alter them in realtime while the vertexshader and the other drawing components renders it correctly as the variables is being altered.

If I wanted to paint a vertex/face red on a Grass-textured plane then this mentioned vertex/face would then be red.

I'm having a hard time finding the problem.
Wasn't able to make a 2 dimensional for loop within the Pass technique loop
"that just made too much thinking and almost crashed the application"

Have looked trough the source codes for a few example app with no success.

I even bought a book on the subject, but all I've got so far is how to render different textures when the vertex/faces reaches a certain height value on the Y axis.

sentences:
Penetration Depth into a Planar Polygon I'm working on a self-made physics engine, and I'm wondering about the best way to calculate the penetration depth into a polygon that lies in a plane given that resolution must occur along the polygon's normal.
My current system correctly uses GJK/EPA to detect if a polygon that lies in a plane is intersecting a 3D collider. However, in a case such as the one illustrated below, EPA would not calculate the separating axis to be along the plane normal, but rather outwards parallel to the plane, as that is the direction of minimum penetration.

My first thought was to simply manually alter the resolution direction. After GJK detects a collision, I can calculate the support mapping of the polygon in the opposite direction of the plane's normal, then take its perpendicular distance from the plane as its penetration depth. However, in a case such as the one below, this would yield an incorrect penetration depth, as the support point does not project onto the plane.

What's the best way to go about getting the penetration depth into the polygon, but only considering penetration of points on the polygon that actually project onto the polygon?

sentences:
Cloth tool and Skeletal Bone Weight Paints in Unreal Engine Just a quick question:
I've got my 3rd person rigged and skinned, but I have some hanging fabric around the characters waist which drapes down to the characters legs. Should this fabric be weighted so that it is affected by the characters legs as they are animated, or just the bones around the waist area?
My thinking is that I don't want the cloth to be affected by the legs, as the cloth simulation will take care of that for me. Instead the aim should just be to make the cloth orientate with the bones in the waist area, mostly "spine" and "spine1". As such I should just skin the cloth to the lower spine bones, and ignore the legs.
If I am incorrect, I'd appreciate any correction, and my apologies for any incorrect terminology, I am still learning.
Cheers!

sentences:
How to balance audio levels to be loud enough yet safe There are a few sound effects in my game that sound a bit piercing over earbuds but OK when played through the iPhone speaker. Also sound levels seem lower on older hardware. Is there some objective way to be sure my sounds are loud enough yet safe?

Notes: I made my music with GarageBand for iPad. The output was very hot but not clipped. To preview the sounds on my computer I played them in the iPad simulator and matched the volume coming out of my iPhone. To resolve my volume issues, I reduced the high end in Amadeus Pro using the EQ tool. A couple passes for each of the worst sound clips let me reduce the shrillness without muting the volume too badly. Thanks everyone for your help.

sentences:
How can I increase the speed and frequency of a spawn? I'm using the official Unity tutorial for the Space Shooter game, and I'm at the part where the ability to spawn a set amount of hazards in a wave at a certain delay is introduced.

I want to make it so that at the end of a certain level, the speed of the hazards, and the amount of hazards both increase. I'm pretty sure that can be handled in the game controller, but I don't know the commands I would be needing to use to make that happen. This is the existing code:

public class GameController : MonoBehaviour
{
    public GameObject hazard;
    public Vector3 spawnValues;
    public int hazardCount;
    public float spawnWait;
    public float startWait;
    public float waveWait;

    void Start ()
    {
        StartCoroutine (SpawnWaves());
    }

    IEnumerator SpawnWaves ()
    {
        yield return new WaitForSeconds (startWait);
        while (true)
        {
            for (int i = 0; i < hazardCount; i++)
            {
                Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
                Quaternion spawnRotation = Quaternion.identity;
                Instantiate (hazard, spawnPosition, spawnRotation);
                yield return new WaitForSeconds (spawnWait);
            }
            yield return new WaitForSeconds(waveWait);
        }
    }
}

What commands would I need to use to increase the amount of hazards that spawn at the end of each round? And likewise, how could I change the Hazard's script so that it will increase in speed by a certain factor at the end of each round? Is there a way I can reference the hazard's script in this script, by any chance?

sentences:
Hardware Fragment Sorting? I'm writing a rendering engine in OpenGL.

I Want to do order independent transparency.

I had heard somewhere that some GPUs have support for actually sorting the fragments of all the objects in the scene based on depth and then drawing them.

I then realized that this feature is likely very important to many people.

Does OpenGL have a built-in fragment sorting algorithm, or access to this hardware?

sentences:
Displaying text letter by letter I am planing to Write a Text adventure and I don't know how to make the text draw letter by letter in any other way than changing the variable from
h to he to hel to hell to hello
That would be a terrible amount of work since there are tons of dialogue.

Here is the source code so far

protected override void Update(GameTime gameTime)
{
    //input code removed for clarity

    if (Dialogue == 1)
    {
        Row1 = "Input Text 1 Here.";
        Row2 = "Input Text 2 Here.";
        Row3 = "Input Text 3 Here.";
        Row4 = "Input Text 4 Here.";
    }
    if (Dialogue == 2)
    {
        Row1 = "Text 1";
        Row2 = "Text 2";
        Row3 = "Text 3";
        Row4 = "Text 4";
    }

    base.Update(gameTime);
}

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

    spriteBatch.Begin();
    spriteBatch.Draw(sampleBG, new Rectangle(0, 0, 800, 600), Color.White);
    spriteBatch.Draw(TextBG, new Rectangle(0, 400, 800, 200), Color.White);
    spriteBatch.DrawString(defaultfont, Row1, new Vector2(10, (textheight + (rowspace * 0))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row2, new Vector2(10, (textheight + (rowspace * 1))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row3, new Vector2(10, (textheight + (rowspace * 2))), Color.Black);
    spriteBatch.DrawString(defaultfont, Row4, new Vector2(10, (textheight + (rowspace * 3))), Color.Black);
    spriteBatch.End();
    base.Draw(gameTime);
}

sentences:
Loop in coroutine stops after going halfway I have a very weird problem with a particular loop in a coroutine:

    public IEnumerator DestroyCubesGameOver() {
    var startingCubeHolder = GameObject.FindWithTag("StartingCubeHolder");
    DestroyOutOfCameraCubes();

    Debug.Log(cubeGroup.transform.childCount);

    for (int i = 0; i < cubeGroup.transform.childCount; i++) {
        Debug.Log(i);
        Destroy(cubeGroup.transform.GetChild(i).gameObject);
        yield return new WaitForSeconds(0.001f);
    }

    Destroy(startingCubeHolder);
}

The loop starts doing its thing and it needs to do it 100 times for example. However it stops after going about halfway and after destroying about half of the objects. Even if I increase the delay for each repeat it still does the same exact thing - needs to repeat itself and destroy 100 objects, ends after destroying just 50. What is causing this?

Edit: If I make it just a void method it destroys all of the objects.

Edit 2: This loop was initially a foreach but I rewrote it to try the other way - same thing.

sentences:
What Game mechanic can I implement to give players incentive to finish a race? I am essentially making deathrace the game. How do I give players incentive to finish or participate in the race instead of strictly deathmatching on the race track.

Edit More Detail:

General Race Rules:

Death during the race knocks you out of the race
Weapons  and defensive tools are picked by player at the start of the race where they are limited by the amount of "space" on the weapon and defensive system
Using a weapon increases the heat of the weapon system. certain weapons within a cars weapon system can only be used if the weapon systems temperature is below a certain threshold
Defensive systems are power based, where certain defensive tools can only be used if a cars power if above a certain threshold
Killing other players is fun but not required to win the race
Finishing the race or completing a lap or making progress around the track grants X

Where X is something I can't make appealing enough to dissuade player from just deathmatching on the race track.

sentences:
DX11 CreateTexture2D When i want to load texture i can either call
CreateTexture2D without passing pointer to texture content passing Default usage and call UpdateSubResource

or

CreateTexture2D with pointer to texture content passing Immutable or Default as usage.

In first case texture is uploaded to GPU, in seconds case it is also backed to RAM. IIRC it is a so called Managed Pool that help with device loss, but i have hand-made mechanism to handle device loss, i don't want DX to consume pretty big amount of RAM for nothing.

I would be easy to stick with 1st option, but if i call UpdateSubResource from BG thread it sometimes crashes (because it uses ImmediateContext that is used on render thread).

Is there any way to tell DX11 not to copy textures to RAM on CreateTexture2D?

sentences:
Does Debug.LogAssert gets deleted in Unity once I build the game? Does Debug.LogAssert(expression) gets deleted in Unity once I build the game?

I was not able to find it here. I feel like it should get deleted, but still I can not assure myself in it (no reliable source was found by me).

So, I would be grateful for the source provided which would assure me in it or point me out, that it is not the case.

sentences:
Strategy Games Online Resources I am looking for some good online (ebooks) resources about strategy games discussing the gameplay and the interactive aspects of strategy games, and how to design interesting and challenging strategy game.

I found this book (http://www.amazon.co.uk/Game-Guru-Strategy-Dave-Morris/dp/1904705456) and seems interesting by reading table of contents. Unfortunately, I did not find any way to buy an ebook version of it and I am in Middle East and ordering this book would take lots of time.

Any idea?

sentences:
Breakout paddle bouncing I am having trouble with making a Breakout Clone using JavaFX. I have almost everything working, but I have a problem with the physics of the ball after it bounces off of the paddle. I used this question to get the physics working with the paddle, but only slightly. Instead of working nice and clean after switching around x and y values, the ball will sometimes end up getting stuck inside the paddle and jittering back and forth very rapidly instead of bouncing off. I have tried getting a "future version" of the ball, by checking where it would be on the next frame, but it still ends up doing the same thing. My code is here for anyone who is interested (it is all one class file, so I figured I would just use a pastebin).

Thanks in advance for any help!

EDIT: If anyone needs a video of what is happening, I will post one.

sentences:
Character not collecting animated coins I am trying to make a simple game where the player jumps and collects animated coins. After collecting all the coins, the scene is supposed to change. For some reason, my character collects the coins but the scene doesn't change.

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

public class Coins : MonoBehaviour
{
    [SerializeField] private string newLevel;
    public int coinAmount;
    int coins ;

        void OnTriggerEnter2D(Collider2D other)
        {
        if (other.CompareTag("Player"))
        {
            coins += 1;

            Destroy(gameObject);
            addCoins();

        }
    }

    void addCoins()
    {
        coins++;

        if (coins == coinAmount)
        {
            SceneManager.LoadScene(newLevel);
        }
    }
}

This is a screenshot of the game:

sentences:
Does Pokemon use any deep A.I in battle? A Pokemon wild battle. The enemy may have up to 4 moves.

I am wondering, is there any.. A.I going on here, or does the enemy simply take a random move and then executes it? Are there not any battle factors/conditions that may change the enemy's behavior?

I guess it makes sense to categorize moves by "Offensive" "Defensive" and/or "Healing", and from there make choices depending on HP etc... dunno.

sentences:
Handling strange physics behaviour while sliding between coplanar surfaces We've got a character setup based around manually resolving collisions, and we're using bullet to do so. Our characters have a kinematic rigidbody to push things around, but their movement and positioning is done using a separate (pair caching) ghost object. Every physics tick we iterate over all contacts for that ghost and resolve collision either by depenetrating 100% when it's ground, or by depenetrating gradually/not at all with walls or other characters. We then apply our ghost's new position to the kinematic rigidbody so that can interact with other physics objects.

Unfortunately, when moving around a flat world made up of a bunch of coplanar blocks, when the characters moves from one block to another it will often do one of two things;

Fall through the cracks
Get bumped upward a significant distance (we're talking up to half a unit/meter with a character that is 2 units/meters tall)

Debugging this tells me sometimes these contact points are unexpected, and not something I want to resolve by depenetrating 100%. Gravity moving the character downward can result in a contact point that is closer to the side of the terrain block than the top, and it will give you a normal/distance accordingly (blue arrow). Resolving that with 100% depenetration will just push you in between the blocks, while not counteracting the gravity forces. This would explain the falling through the cracks. But I don't know why I sometimes get contact points with normals pointing straight up, but with a distance that would place the collider far above the ground (purple arrow).

I've come to the point where I feel like my only option to handle character movement like this is by not colliding with the ground at all, and just spherecast downwards at the character's position on the horizontal plane just to place it down on the ground properly.

Now obviously I want to get rid of this behaviour. And seeing how you don't see this happen in many games, I'm lead to believe others have solved this issue somehow. Has anyone here encountered similar issues, and how did you go about fixing them?

sentences:
High Resolution Timer Options in Windows I'd like to know what are my options for high resolution timer in Window. I want a timer with at least 1ms precision since I need it for a rhythm game. I'm using QueryPerformanceCounter now, but I read there are many problems I can have with it (variable clock due to laptop power consuption, intel speed stepping, multi-core sync gives negative times, etc).

I tried SDL_GetTicks() but I realized it is implemented using QPC in Windows. What other options do I have?

Thanks.

sentences:
Random noise based on seed I am currently working on a program that should generate random noise on a screen based on the 'coordinates' of a pixel. The coordinates should have the same color every time you restart the program. However, using the Java's util.Random, the results I get are not as random as I'd like:

I thought that if I used the combined coordinates (as in one integer formed from both coordinates next to eachother) each coordinate would have a different number. By using that number as a seed I expected to get a different random numbers for each coordinate to use for the rgb value of that coordinate.

This is the code I used:

public class Generate {

static Random Random;

    public static int TileColor(int x, int y){
        Random = new Random(Integer.valueOf(Integer.toString(x)+Integer.toString(y)));
        int b = 1 + Random.nextInt(50);
        int g = 1 + Random.nextInt(50);
        int r = 1 + Random.nextInt(50);
        int color = -Color.rgb888(r, g, b);
        return color;
    }
}

Is the pattern that the program creates due to the way java's Random function works or am I doing something wrong and should I try a different approach?

Update:
I now tried to get rid of the problems surrounding concatenation by using the following code:

public static int TileColor(int x, int y){
            Randomy = new Random(y);
            Randomx = new Random(x);
            Random = new Random(Integer.valueOf(Integer.toString(Randomx.nextInt(1234))+Integer.toString(Randomy.nextInt(1234))));
            int b = 1 + Random.nextInt(100);
            int g = 1 + Random.nextInt(100);
            int r = 1 + Random.nextInt(100);
            int color = -Color.rgb888(r, g, b);
            return color;
}

Somehow, this also provided a (in my opinion) sufficiently random image:

This code does however reseed three times per pixel. Even though this is not a problem for me right now, I do consider changing this code in case I need better preformance later on.

sentences:
Pointer to member function of another class I have two classes, CEffect and CEffectPool. A third class CLevel, is doing most of the stuff in my code.

In every frame, it checks each CEffect in CEffectPool, and if it is currently inactive, it disables it.

What I would like to do is to give CEffect the pointer to the CEffectPool member function called Destroy(), so I don't have to check every single CEffect by another class whether it shall be destroyed or not.

With this function pointer, CEffect would simply call a function, which would destroy it.

Also, I am not talking about destroying in the C++ way (I don't want memory to be freed or to call the destructor).

Here is some code, that i have, but it unfortunately don't work and I am not sure why:

CEffect.h

class CEffectPool;
class CEffect {
    public:
        CEffect();
        CEffect(const CEffect& eff);
        CEffect& operator=(const CEffect& eff);
        void Initialize(CEffectPool* pool,
                        ushort id,
                        real x,
                        real y,
                        ushort timer);
        void Frame();
        void Draw();
        bool IsActive() const;
    private:
        CEffectPool* _pool;
        ushort _id;
        CSprite _sprite;
        ushort _anmfrm;
        ushort _timer;
};
void DestroyEffect(CEffectPool* pool,
                   ushort id);

CEffect.cpp

void CEffect::Frame() {
    if(_timer) {
        --_timer;
        return;
    }
    ++_anmfrm;
    if(_anmfrm == 24) {
        DestroyEffect(_pool,_id);
    }
}

CEffectPool.cpp

void CEffectPool::Destroy(ushort index) {
    if(index >= _size) {
        return;
    }
    CEffect temporary = _pool[index];
    _pool[index] = _pool[_size-1];
    _pool[_size-1] = temporary;
    --_size;
}
void DestroyEffect(CEffectPool* pool,
                   ushort id) {
    pool->Destroy(id);
}

Could you help me with this? What is the best approach to do this?

sentences: How do I create a message box that fires a callback on button press? I need to create a message box with an "OK"-button. When the user touches the button, it should execute a callback. I'm new to this and couldn't find any articles in the docs.

sentences:
Why does RGB order differ between color formats? On the reference page for SurfaceFormat, it indicates that the Bgra4444 format is an unsigned format which is 16-bits long, with 4 bits per color with alpha. Further down the page, it describes the Rgba64 format as being 64-bits long, with 16 bits per color (including alpha).

Why does one format list R-G-B as the color order, while the other lists it as B-G-R? I understand it likely has to do with the underlying hardware, but there certainly needs to be a reason that it wants it in a reversed order for the other format.

sentences:
What's the largest "relative" level I can make using float? Just like it was demonstrated with games like dungeon siege and KSP, a large enough level will start to have glitches because of how floating point works. You can't add 1e-20 to 1e20 without losing accuracy.

If I choose to limit the size of my level, how do I calculate the minimum speed my object can move at until it begins to be choppy ?

sentences:
slow/fast/slow experience system I am looking for an experience ladder that 'starts' off relatively quickly like a bit of geometric series, then quickly grows like an exponential curve, and then a slow exponetial curve for later levels, in the range of levels 1-5000.

How would I do this mathematically? I am assuming I might just have three sets of equations, but then what is the correct math for getting the level (based on XP), and vice-versa, XP based on level?

I.e., I am thinking something like:

lvl 1 - 10 exp
lvl 2 - 12 exp
lvl 3 - 15 exp
lvl 4 - 18 exp
lvl 5 - 22 exp (not quite fibacconi)
lvl 6 - 26 exp
lvl 7 - 32 exp
...
then maybe around level 150 or so it starts growing quickly, like
lvl 150  -1000 exp
lvl 151 - 1200 exp
...
lvl 3000 - 30000 exp
lvl 3100 - 40000 exp
lvl 4000 - 75000 exp
lvl 5000 - 100000 exp

If it's been done, a link would be great (since I am not exactly sure what I am looking for, not quite sure how to find it). Or if it is easy for you to just write the math, please do that too, thanks for your help!

sentences:
Is there any opengl cel shading tutorial out there (without GLAUX)? I want to implement cel shading into my opengl game. I have only found a nehe tutorial that uses glaux (old as hell). I'm looking into it, but I wanna avoid the pain of learning how to translate those old glaux functions/variables. Is there any cel shading tutorial out there that uses glut/sdl?

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=37

sentences:
How do I add the "tween-engine-api" to my libGDX game? I finished now my first game at LibGDX (I am using Eclipse). I run the game in the desktop launcher and it works. I now want to run my game on Android and iOS.

From some guides I have read, I understand that for running the game on devices I must have the tween-engine library in my project. I tried but couldn't add it to my project.

Can someone help me? (I already tried to do that at "add jars", but it only shows me my project and not the tween-engine library)

sentences:
how to move the camera behind a model with the same angle? in XNA I'm having difficulty moving my camera behind an object in a 3D world. I'd like to have two view modes:

for fps (first person).
external view behind the character (third person).

I've searched the net for examples but they don't work in my project.

Here is my code used to change the view when F2 is pressed:

 //Camera
        double X1 = this.camera.PositionX;
        double X2 = this.player.Position.X;
        double Z1 = this.camera.PositionZ;
        double Z2 = this.player.Position.Z;

        //Verify that the user must not let the press F2
        if (!this.camera.IsF2TurnedInBoucle)
        {
            // If the view mode is the second person
            if (this.camera.ViewCamera_type == CameraSimples.ChangeView.SecondPerson)
            {
                this.camera.ViewCamera_type = CameraSimples.ChangeView.firstPerson;

                //Calcul position - ?? Here my problem
                double direction = Math.Atan2(X2 - X1, Z2 - Z1) * 180.0 / 3.14159265;
                //Calcul angle - ?? Here my problem

                this.camera.position = ..
                this.camera.rotation = ..

                this.camera.MouseRadian_LeftrightRot = (float)direction;
            }
            //IF mode view is first person
            else
            {
                    //....

sentences:
How to get the texture coordinate of a neighbouring pixel for a blur shader? I'm still having some trouble to get my head around fragment shaders and doing some image processing on textures. The context is a 2D sprite: a simple texture painted on a quad. All done with OpenGL ES 2.0.

My very basic goal is a simple blur filter using a 3x3 Kernel with average weights: every pixel used is weighed 1/9th and summed up.

Besides many ways to improve the performance of the fragment shader(code below) so far I'm still having some difficulties to find the right texture coordinate for the kernel.

My approach so far is to use the actual size of the quad on the screen on which the texture is painted and pass those two values to the shader. This is done outside the shader and passed as a uniform to the shader program.

glUniform2f(_offset, 1 / spriteWidth, 1 / spriteHeight);

This should result in the step in both directions to calculate a texture coordinate in the 0 to 1 space.

The result is kind of looking good. BUT I am still struggling if this is something that could be done within the shader. Is there a way to get the size of the texture within the fragment shader? If we would be only doing this on a bitmap, I'll just go from pixel to pixel and read the color of the surrounding pixels. I am wondering if my understanding of a fragment shader is quite right: It's run per rendered pixel on the screen. I found some examples for the GLSL to do this but I wasn't able to port it to OpenGL ES, so I had to start from scratch.

For the sake of readability I write a bit more code in hope it's easier to understand the fragment shader:

varying vec2 v_texCoord;
uniform vec2 u_offset;
uniform sampler2D u_texture;

const int size = 3;
const int KernelSize = size * size;

void main()
{
    int i, j;

    vec4 sum = vec4(0.0);
    vec4 intensityOfPixel;
    vec2 texCoordForKernel;

    for (i = 0; i < size; i++)
    {
        for (j = 0; j < size; j++)
        {
            texCoordForKernel = vec2(v_texCoord.x + (float(i) - 1.0) * u_offset.x,
                                     v_texCoord.y + (float(j) - 1.0) * u_offset.y);

            intensityOfPixel = texture2D(u_texture, texCoordForKernel);

            sum += intensityOfPixel * 1.0 / float(KernelSize);
        }
    }

    gl_FragColor = sum;
}

Thanks alot in advance!

sentences: How can I disable the forward/back buttons in AS3? How can I disable the Flash player forward and back button in AS3? These buttons make it possible to cheat in my game by moving from level to level.

sentences:
Unity 2d overlapCircle melee combat issue I have an issue with my overlapCircle melee combat in the game. I'm not good at such things, so I just copied that code from some YouTube tutorial. But the thing is that if the enemy is behind the collider, I can still damage and kill him. And I don't want this. Is there a solution to this problem except recreating the melee combat system from the ground up? Maybe changing circle radius when close to collider?...
Here's a video clip that may help show the situation.
void Attack()
{
    Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, whatIsEnemy);
    foreach (Collider2D enemy in hitEnemies)
    {
        Debug.Log("Melee hit: " + enemy.name);
        if (enemy is BoxCollider2D)
        {
            CinemachineShake.Instance.ShakeCamera(3f, 0.2f);
            SoundManager.PlaySound("Knife_kill");
            if (enemy.tag == "Melee enemy")
                enemy.GetComponent<enemy_melee>().TakeDamage(attackDamage);
            else if (enemy.tag == "Gun enemy")
                enemy.GetComponent<enemy_gun>().TakeDamage(attackDamage);
        }
    }
    animator.SetTrigger("Melee_attack");
    animator.SetBool("IsCrouching", false);
    animator.SetBool("IsJumping", false);
}

sentences: Can someone explain radiosity lighting to me? I already have the basics of ambient occlusion down.  I have a raycaster and am capable of shooting rays about a hemisphere uniformly.  It seems like those are the basics of what are needed for radiosity but I don't know where to go from there.  Do I find how much light comes from each face?  (I'm making my game out of cubes like minecraft)  After that what do I do?

sentences:
Getting an object to shoot directly towards click libgdx java I am trying to get my player to shoot a spell and it travels to where ever the player clicked. I can easily accomplish this by doing the following.

    if(position.x >= destination.x - 1 && position.x <= destination.x + 1)
        reachedX = true;
    if(position.y >= destination.y - 1 && position.y <= destination.y + 1)
        reachedY = true;

However if the players origin is at, for example, 0,0 and I click at 10,300 then it travels right and up but when the spell reaches an x of 10 it travels directly upwards. I want the spell to travel at an angle that it will reach the x coordinate at the same time as the y coordinate. Here is an image showing what happens and what I want to happen.

sentences:
OBB collisions in Buildings So I decided on using OBB as the main collision detection in my 3D game but I started to wonder how OBB can be used to detect collisions if a player is in a building, an object you can walk into. Should the building object be broken up into dozens of OBBs or is there like an OBB to mesh check I can do. Or maybe there's some other better way of doing this.

Thanks for the help guys.

sentences: Blender modelling for a C++ game? I want to know if it were possible to integrate models created with Blender into a game written in solely C++.

sentences: Trigger an event only if two colliders fully cover each other Let's say I have two different objects that can go through each other. Both have a circle collider (2d) that has the exact same size and there is a good chance that the two colliders will completely overlap each other. How can I trigger an event when that happens?

sentences:
Creating mesh at run-time I've a set of voxel data and I want to create a mesh out of it at run-time.

I've looked into MeshBuilder and MeshHelper but I haven't found anything useful or a good tutorial how to use them. Can anyone tell me how to create a mesh at run-time?

sentences:
Movement algorithm for Pocket Civ game I am developing a Pocket Civ game engine. (You can check the process at www.pocketciv.com). Basically there is maximum of 8 Areas (round nodes in the pic) that have Tribes (number inside the node). So area 3 has three tribes and area 5 has two tribes.

There is basic movement rules see page 7 and then the movement rules change after new advances are acquired. There is only one movement phase and you can move the tribes in any order you want.

Basic: A single tribe can cross a border once (by land)
Advancement: You can move a stack of tribes across the sea at the cost of 1 tribe (so every tribe in the stack then crosses a border)
Advancement: A single tribe can cross a border two times
Advancement: A single tribe can cross any number of borders (crossing the sea still costs one tribe)
Advancement: When you move the stack across the sea, it doesn't cost anything

Essentially, if you have the last two advancements you can move any tribes anywhere you like.

The naive way to implement this would be to track what tribes are moved where when user moves them. But this is hard for the user (for example if you move one tribe 3->5 and one tribe 5->3 you have not moved anything. My approach is to let the user move tribes around and always check if the given situation is valid. For example valid end situations from above starting point are (shown as list [area1, area2, area3, area4, area5]:

[0, 0, 3, 0, 2] (no movement at all, also the starting point)
[0, 0, 3, 1, 1] (5 -> 4)
[0, 0, 0, 5, 0] (5 -> 4, 3 -> 4)
[0, 0, 5, 0, 0] (5 -> 3)
[0, 0, 2, 2, 1] (5 -> 4, 3 -> 4)
... etc

I have implemented some kind of way to check if the proposed situation is valid. It gets hard when we take the sea movement cost into account. We would need to know what is the cheapest way to make the movement and recognize when tribes moved over the sea. For this I would need all the permutations about what tribes moved where.

For example if we have starting position: [0, 0, 3, 2, 0]

[3, 0, 2, 0, 0] (3 -s> 1, 4 -> 3) would cost 1 tribe at minimum
[2, 2, 1, 0, 0] (3 -s> 1, 3 -s> 2) would cost 2 tribes at minimum

Can anyone help me phrase this problem or say what would be the correct algorithm to find that the proposed situation is valid and what is the minimum cost. Is this a graph problem? Can this be solved with matrices? I have studied Prolog a little but haven't managed to get anything usable out of it. I can tell my implementation later but I would like a "clean-table" view of this problem.

sentences:
Architecture for Versioned Save Data We're working on an iOS game that we plan on having several content updates for.

It's a story type game with lots of little flags when things have been accomplished and such.  There is also an inventory system.

I'm looking for ideas on how to best design a game state save data system that will be resilient to a lot of updates and changes to the game.

sentences:
How can I rig an object to animate from two different orientations? As an example: Say you're animating a skateboard. The board has a nose and a tail. Normally, the nose points forward and the tail points backward. Now say you have two animations: idle and trick. The idle is animated with the nose pointing forward. The trick, however involves the board rotating 180°, ending with the nose pointing backward, functionally swapping the nose and tail. Now, if you were to blend the trick animation back into idle, the blend would rotate the board back around so the nose points forward, which would not be the intended behavior. The intended behavior would be for the animator to somehow know that the tail is now the forward facing orientation and animate as if the tail were the nose.

I'm competent but no expert with rigging/animation and I've been racking my brain trying to come up with either a way to cleverly rig the object to somehow work as intended or to be able to modify the animations procedurally in code or something, but I haven't been able to figure it out.

This seems like a problem that must come up somewhat frequently with game animation, but I haven't been able to find any specific resources.

I'm using Blender and Unity.

Edit: To be clear, I'm not talking about root motion or the animating object's position/rotation in the world, just the orientation of the bones being animated.

sentences:
Why do people like `realistic' physics and graphics in games? If games are all about fun, then why do people tend to like realistic physics and graphics are good for games?

Can you cite your source?

sentences:
UNITY 3D - Get X and Y components relative to a value and an angle I have an algorithm, that, once the gameObject collides with a trigger, a method is called, on which the current collectibles (almonds) picked are instanciated around the circular area of the gameObject on the (x,y) plane. The spawning distribution is correct (at least that seems to be). The problem is the translation, I want to push each almond relative to the Y Axis of the object, so I figured out that with geometry I could take both x, y component for a vector with the angles, then to pass that Vector3 to the DOMove method (I am also using DOTween).

Maybe the approach isn't the right one, or maybe the trigonometric functions change relative to the position.

Here is the code that spawns and translates each almond:

public void takeAlmondsAway() //Will take as parameter the current position of the nerve impulse when it's backed after collision...
{
    int quant = gm.getAlmondsScore(); //The quantity of almonds that will be taken away from the player, relative to the almonds score, duh...
    float angle = 360 / quant; //The angle distribution each individual almond will have when instanciated, the iterator will multiply the angle...
    GameObject[] almonds = new GameObject[quant];
    Vector3 tempMov;
    float tempX;
    float tempY;
    int distance = 1;

    for(int i = 0; i < quant; i++)
    {
        Quaternion rot = Quaternion.Euler(0, 0, (angle * (i + 1))); //The i jump will be necessary here since we care about the i values from 1 to 'quant'

        if(rot.z > 180) rot.z -= 360; //Since the transform rotation goes from 180 to -180, we have to caompensate it with the minus 360 to get the inverse...

        almonds[i] = (GameObject)Instantiate(almond, this.transform.position, this.transform.rotation);
        almonds[i].transform.localRotation = rot;

        //Trying to, based on the prediction distance vector, determine the x & y components needed for the DoMove parameters...
        tempX = Mathf.Cos((angle * (i + 1)) * Mathf.Rad2Deg) * distance;
        tempY = Mathf.Sin((angle * (i + 1)) * Mathf.Rad2Deg) * distance;

        Debug.Log("X: " + tempX);
        Debug.Log("Y: " + tempY);

        //tempMov = new Vector3(almonds[i].transform.localPosition.x, almonds[i].transform.localPosition.y+5, almonds[i].transform.localPosition.z);
        tempMov = new Vector3(tempX, tempY, almonds[i].transform.position.z);

        almonds[i].transform.DOMove(tempMov, 0.5f);
    }
}

Thanks in advance!

sentences:
Require maths help calculating deflection angles of quadrants For each quadrant, I need to find a neat way of calculating the deflection angle for a small circular object striking a circle, as shown in the diagram.

Angles a and b are already known.
Angle a is always relative to 0 degrees position.
Angle b is relative to the quadrant.
The initial angle can also be greater than 180, when coming from the
other direction, as shown in the diagram the right.

For quadrant 2, in the following snippet from my code, dy and dx represent the x and y coordinates of a point on the circle:

intersectAngle = atan(dy/dx);

Initial angle is calculated from velocity vectors:

pAngle = PI - (atan2(pVel.x, pVel.y));

For quadrant 0, I came up with this for the rebound angle:

pAngle = pAngle - 2 *(pAngle - tangentAngle);

Where tangentAngel is just the intersect angle with half PI added. Thsi worked for a ball from any direction.

Moving onto quadrant 1, this works for pAngles of less than 90 deg, but not for pAngles from the other direction:

pAngle = pAngle + 0.5 * PI - intersectAngle;

Feels like I shouldn't be writing all this code and that there is a more efficient way. I realise this is an elementary question but I'm studying this so it's all new to me. Please be gentle.

sentences: How to write a script for circular motion? Сan any body explain me the script for the tangential motion,so that when i cut the rope circle should move tangentially:

sentences:
GLSL - rewriting (geometry) shader from #330 to #130 version I'm having trouble running example from:
https://raw.github.com/progschj/OpenGL-Examples/master/07geometry_shader_blending.cpp
My graphics card supports only #130 shaders version so I have to rewrite shaders.

I figured out how to fix vertex and fragment shaders. I removed:

layout(location = 0)

from

layout(location = 0) in vec4 vposition;

and added this into my source code:

glBindAttribLocation(shader_program, 0, "vposition");

However I have no idea how to rewrite geometry shader...

#version 130
uniform mat4 View;
uniform mat4 Projection;
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
out vec2 txcoord;
void main() {
   vec4 pos = View*gl_PositionIn[0].gl_Position;
   txcoord = vec2(-1,-1);
   gl_Position = Projection*(pos+vec4(txcoord,0,0));
   EmitVertex();
   txcoord = vec2( 1,-1);
   gl_Position = Projection*(pos+vec4(txcoord,0,0));
   EmitVertex();
   txcoord = vec2(-1, 1);
   gl_Position = Projection*(pos+vec4(txcoord,0,0));
   EmitVertex();
   txcoord = vec2( 1, 1);
   gl_Position = Projection*(pos+vec4(txcoord,0,0));
   EmitVertex();
}

The main problem is how to get rid of location here:

layout (points) in;
layout (triangle_strip, max_vertices = 4) out;

Can someone help me?

EDIT:
@melak47 - I edited shader, now I'm not getting any error, but window is black.

#version 130
#extension GL_EXT_geometry_shader4 : enable
precision mediump float;
uniform mat4 View;
uniform mat4 Projection;
out vec2 txcoord;
void main() {
    vec4 pos = View*gl_PositionIn[0];
    txcoord = vec2(-1,-1);
    gl_Position = Projection*(pos+vec4(txcoord,0,0));
    EmitVertex();
    txcoord = vec2( 1,-1);
    gl_Position = Projection*(pos+vec4(txcoord,0,0));
    EmitVertex();
    txcoord = vec2(-1, 1);
    gl_Position = Projection*(pos+vec4(txcoord,0,0));
    EmitVertex();
    txcoord = vec2( 1, 1);
    gl_Position = Projection*(pos+vec4(txcoord,0,0));
    EmitVertex();
};

sentences:
Is there a good comprehensive walk-through of deriving the math for 3D model rendering that starts from scratch? I'd like to fully understand the math of rendering a 3D model in a 2D perspective.

I always find tutorials that are in terms of the APIs used to do the math for you, and not the math itself.

I'd like to understand it from the standpoint of geometry as opposed to linear algebra if possible.  What I mean is, I'd like to be able to visualize what the matricies stand for in the 3D model and/or 2D image which is the result of rendering.

Is there a definitive source or sources I can consult for this?

sentences:
Applying angular velocity to quaternion I am reading Game Physics Engine Development by Ian Millington currently. In his book, he represent an orientation of rigid body by quaternion. I don't understand the formula where he apply angular velocity to the quaternion. The formula is

$$ q_{new} = q_{0} + \frac{t}{2} * w * q_{0} $$

where w is the angular velocity in quaternion representation.

$$ w = \begin{bmatrix} 0\\ w_{x}\\ w_{y}\\ w_{z} \end{bmatrix} $$

He doesn't explain where the formula come from. Currently I apply this method in my physics engine where I compute the angular rotation then convert it to quaternion and multiply it. It is slower than the above operation because of the sine, cosine and square root operation when converting the rotation to quaternion. Can someone explain to me where did the formula above come from? I understand basic quaternion operation like representing axis angle by quaternion and rotating a vector by quaternion.

sentences:
How do I move a sprite to the mouse position? So, I'm trying to make my sprite walk to the X-coordinate of my mouse click.
This is my code:

currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();
            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                int mouseposx = mouseState.X;
                if (playerPosition.X < mouseposx)
                    {
                        playerPosition.X += 3;
                    }
                if (playerPosition.X > mouseposx)
                    {
                        playerPosition.X -= 3;
                    }
            }`

The problem is that the sprite will walk only 3 pixels and then stop. If I use while instead, like this:

  currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();
            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                int mouseposx = mouseState.X;
                while (playerPosition.X < mouseposx)
                    {
                        playerPosition.X += 3;
                    }
                while (playerPosition.X > mouseposx)
                    {
                        playerPosition.X -= 3;
                    }
            }

it will simply teleport to the X-coordinate instead. I tried adding a delay using Thread.Sleep(ms), but that just made it freeze and then teleport anyway.

So, what should I do?

EDIT:
This is the new code, by Byte56.

currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();
            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                if (playerPosition.X - mouseState.X < 3)
                {
                    playerPosition.X = mouseState.X;
                }
                else if (playerPosition.X < mouseState.X)
                {
                    playerPosition.X += 3;
                }
                else if (playerPosition.X > mouseState.X)
                {
                    playerPosition.X -= 3;
                }
            }

edit3:

 void update()
        {
            // Check if the player has reached the target, if not, move towards it.
            if (playerPosition.X - playerTarget.X < 3)
            {
                playerPosition.X = playerTarget.X;
            }
            else if (playerPosition.X > playerTarget.X)
            {
                playerPosition.X -= 3;
            }
            else if (playerPosition.X < playerTarget.X)
            {
                 playerPosition.X += 3;
            }

        }

and

 currentMouseState = Mouse.GetState();
            MouseState mouseState = Mouse.GetState();

            if (lastMouseState.LeftButton == ButtonState.Released && currentMouseState.LeftButton == ButtonState.Pressed)
            {
                // This will give the player a target to go to.
                playerTarget.X = mouseState.X;
            }
            update();

sentences:
How can I store my 2D map in JAVA? I'm working on a 2d adventure game where the player can explore a random generated map. It's working perfectly if I set it to be about 3000x1000 blocks (my array is 3000x1000x2), but this is TOO SMALL. When I want to make a bigger map it trows an OutOfMemory error.

I store my map in a 3d float array where the first two dim shows the position on the world plus I need 2 more data (3rd dim) for each block the type (int blockID) and the stored last update time (float elapsedTime).

Can it be better if I make it 2 separeted 2d array?

This 3d array is the one what is too big and trows OutOfMemory error. The blocks that have made Objects are the ones that can be seen(~32x14 block) the other are just two number ID and elapsedTime.

How should I store the map data?

EDIT:

This code:

   int x = 10000;
   int y = 10000;
   float[][][] ft;
   ft = new float[x][y][2];

It trows OutOfMemory error.

sentences:
Landscape mode for game? TL;DR: I have made 8 new layouts for each activity layout, but they are not showing up. For example, I have a layout-land directory with a layout, but that layout doesn't show up when I turn my phone to landscape?

I have made 8 new layouts for each layout in order to work for every screen size. This took me about 4 hours, but I finally got it done. When I tested it on my phone, and changed to landscape mode, the landscape layout didn't show!

Why is this? Is it a problem with my directory names? Here is the project view:

Why isn't the appropriate layout showing? Have I done something wrong and wasted my last 4+ hours by making layouts for each? If you need any more information, feel free to ask for it.

sentences:
How to get past Visual Studio "Setup Error" for Unity development? When I launch Visual Studio from Unity on my laptop, I get the following error:

Setup Error
The setup for this installation of Visual Studio is not complete. Please run the Visual Studio Installer again to correct the issue.

As instructed, I've tried reinstalling Visual Studio multiple times, or using the "repair" option, but nothing has resolved the error.
How can I fix this?

sentences:
Optimizing models & improving performance I've created a map editor for a game I've been developing. The maps (planets) are made using a form of meta ball editing. Basically, in the end the Marching Cubes algorithm is used to get my final model.

Here's an example:

In the game however, when planets are or a largish size, as you would expect, I start having quite a lot of lag. So what I was wondering, is are there any good libraries out there that could be used to remove clusters or triangles that are basically flat and turn them into a single triangle?

I'm not after simply reducing the count, I want the same amount of detail, but to merge triangles where their normal is practically the same.

Also curious, as to how you would go about having more/less detail as you approach/leave areas of a planet. Obviously chunks isn't the easiest method when the world's a sphere.

The project is in C#.

sentences:
Can you use a standard multi-thread if only reading unity objects? First of all I know about coroutines and how to use them (they're awesome).

A friend of mine was telling me about the way the he implemented his saving system in a game he was working on, after asking him what he was using I found out that he is using system.threading and not coroutines to save data.

I know that Unity isn't thread safe but apparently he has had no issues with saving which leads me to wonder if it is ok to use normal threads as long as you're only reading data and no pre-existing data is modified in the gameworld? would this affect the game at all (other than some moving objects being slightly ahead of where they should be because of the time it took to get to that object and save it)?

sentences:
Position an object at the center of the screen I need to create a grid of squares such as the grid is centered on the screen. Here is a schema:

I need the two green lengths to be equal, and the two red lengths to be equal.

Here is the method I am using right now to try to generate this pattern (slotGrid is a 2D array, but only its size is revelant right now).

void GenerateLevel(bool[,] slotGrid) {

    // The size of the grid, in the image above this is equal to 2 as it is a 2*2 grid
    // Note that I assume that the grid width and height are equal
    int slotGridSize = slotGrid.GetLength(0);

    // The size of one of the square
    float slotSizePixel = m_Slot.transform.lossyScale.x;

    // The size of the screen
    float screenWidthPixel = Screen.width;
    float screenHeightPixel = Screen.height;
    Debug.Log("Screen size: " + screenWidthPixel + "*" + screenHeightPixel);

    // Position of the upper left square
    float firstSlotX = (screenWidthPixel - (slotGridSize*slotSizePixel)) / 2;
    float firstSlotY = (screenHeightPixel - (slotGridSize*slotSizePixel)) / 2;
    Debug.Log("First slot position: " + firstSlotX + "," + firstSlotY);

    Vector3 newSlotPosition = new Vector3(firstSlotX, firstSlotY, 0);

    // Generate the grid starting from upper left corner
    for (int i = 0; i < slotGridSize; i++) {
        for (int j = 0; j < slotGridSize; j++) {
            Instantiate(m_Slot, newSlotPosition, Quaternion.identity);
            newSlotPosition = new Vector3(newSlotPosition.x + slotSizePixel,
                                          newSlotPosition.y,
                                          0);
        }
        newSlotPosition = new Vector3(firstSlotX, newSlotPosition.y, 0);
    }
}

However, this method is placing the squares in some weird position (i.e far off the screen). I realized this is because I mix pixel size (for the screen width and height) and... Unity scale size I guess (I don't know the proper name) for the square size.

How can I fix this?

sentences:
Rotate camera with quaternion around axis going through the origin I am trying to implement my own third person camera using quaternions in DirectX. I first wanted to check that the camera rotates as expected so I started to rotate it around the world y-axis (0,1,0) and then x-axis (1,0,0) and it worked fine. But when rotating around the axis (1,1,0) the effect is not what I expected. Here is a description of what I do.

The scene is composed by a cube of side 2, centered at the world origin. The camera is originally placed at (0,0,-10), looking at the origin (0,0,0) and has the up vector (0,1,0). To test the rotation, at each frame I increase the angle of rotation theta by a constant amount dTheta. I build my quaternion from the axis of rotation (1,1,0) and the angle theta, transform the quaternion to its 3-by-3 matrix form and multiply both the position vector and up vector. I call the D3DXMatrixLookAtLH function to build the view matrix with the new position, the lookAt point (the origin of the world frame) and the new up vector.

What I get is my cube rotating in a very strange way (well, I know it is the camera that is rotating, but you know what I mean, everything is relative). Moreover it seems the distance between the cube and the camera changing because, as the cube rotates, its size oscillates.

I can put some code if someone asks but I first wanted to check there is no mistake in my approach. Thanks.

sentences:
Circle physics and collision using vectors This is a problem I've been having, When making a set number of filled circles at random locations on a JPanel and applying a gravity (a negative change in the y), each of the circles collide. I want them to have collision detection and push in the opposite direction using vectors but I don't know how to apply that to my scenario could someone help?

public void drawballs(Graphics g){
    g.setColor (Color.white);

    //displays circles
    for(int i = 0; i<xlocationofcircles.length-1; i++){
    g.fillOval( (int) xlocationofcircles[i],  (int) (ylocationofcircles[i]) ,16 ,16 );
    ylocationofcircles[i]+=.2; //gravity
    if(ylocationofcircles[i] > 550) //stops gravity at bottom of screen
    ylocationofcircles[i]-=.2;

    //Check distance between circles(i think..)
    float distance =(xlocationofcircles[i+1]-xlocationofcircles[i]) + (ylocationofcircles[i+1]-xlocationofcircles[i]);

    if( Math.sqrt(distance) <16)
    ...

sentences:
Anti-cheat: How secure is the client? Let's say, theoretically, that I'm developing a first person shooter with, of course, a map with things like walls. In the client code, the player is obviously halted upon collision with these wall objects. The server, however, only receives the player's location coordinates.

Without some sort of data encoding in the client, the player could easily read the network communication to the server and send false coordinates to the server, allowing them to go wherever they wanted.

My question is, is there a way to encode  this location message to the server before it exits the client binary such that it would be extremely difficult for  someone to read? Even by someone who disassembles the code to try and break the encoding? Or do all player collisions have to be detected by the server?

sentences:
Why is the bullet not created realitive to the player? I'm using GameMaker to make my game and I'm trying to get the player bullet to fire out of the players gun but for some reason even though I checked 'relative', the bullet is still being created at the top of the room.

Why? How could I have the bullet created relative to the player?

sentences:
Tennis game algorithm and maths Tennis courts are real dimensions and game is 3D

Ball has position (x,y,z), speed(vx,vy,vz) and acceleration (ax,ay,az)

Game has 30 fps and on each update (1/30sec) it has these properties

vx +=ax;
vy +=ay;
vz +=az;

ball.x += vx;
ball.y += vy;
ball.z += vz;

function hitBall(destinationx, destinationy=0, destinationz) {
    // calculate vx, vy, vz, so ball imapcts  the point (destinationX, 0, destinationZ)
    // destinationY = 0 = bounce on floor
    vx = ....
    vy = ....
    vz = ....
// I guess this problem has infinite solution, so we must intersect with 1 point
// intersection line is (x,1,12)
// 12 is middle of the tennis court and 1 is 1 metter above the ground.
// ball passes there 1 meter above the ground.

}

Any clue on how to resolve that math problem ?

regards

Google doc :
https://docs.google.com/presentation/d/1EiUYpalDXlJUgjg8aIxLiWENgZJW7fnH4bGHsj1jb9I/edit?usp=sharing

sentences:
Why is unity's RaycastHit2D contact point is slightly off This is a small test I made, basically I have a simple BoxCollider2D that has the top surface aligned with the x axis. It's just a 1x1 cube placed at (0, -0.5). Now when I cast a ray down from position (0, 1) I would expect the resulting RaycastHit2D's contact point to be (0, 0) however when I log the contact point, it shows it is slightly over the actual surface at (0, -2.384186E-07).

So the question is, why does this happen? Also, can it be fixed somehow (like tweaking settings or something)?

sentences: Where to put Tweening effect codes in HTML5 Canvas game? I am building a javascript HTML5 canvas game and I need to scale the map. However whenever I scale my map the screen stutters very obviously. To scale smoothly without player noticing I add Tween effect using Greensock TweenMax. I put the codes gsap.TweenMax.to(...) inside my animation update loop, right after requestAnimationFrame method. But I realize that the TweenMax may have its own ticker in animation and it handles animation internally. But the codes work very well. Does that implementation has any side effect? What is the correct place to put my tweening codes? Should I implement my own code inside the update loop?

sentences:
How can you visualize a quaternion? When I visualise a three dimensional rotation matrix, or scaling matrix I visualize it as three axes.

Is there a similar way that I can visualize a rotation quaternion?

sentences:
Pygame Error AttributeError: 'pygame.Surface' object has no attribute 'add_internal' I'm making my first game of Pygame. I'm going to create groups for making collisions but when I add an object to the group, I get an error in sprite.py (Pygame's Files)

AttributeError: 'pygame.Surface' object has no attribute 'add_internal'

Why I get this error?
There is a simplest way to make collisions?

There is my code:

import pygame
from pygame.locals import *
import sys
import os
import time
width = 950
height = 500
Game = False
GameOver = False
keyboard = pygame.key.get_pressed()[K_UP]
def main():
    pygame.init()
    screen = pygame.display.set_mode((width, height))
    pygame.display.set_caption('Flappy Dog')
    background = pygame.image.load(os.path.join("Images", "Background_00.png")).convert()
    FlappyDog = pygame.image.load(os.path.join("Images", "Flappy.png")).convert_alpha()
    Play = pygame.image.load(os.path.join("Images", "Play.png")).convert_alpha()
    Dog0 = pygame.image.load(os.path.join("Images", "Dog0.png")).convert_alpha()
    Dog1 = pygame.image.load(os.path.join("Images", "Dog1.png")).convert_alpha()
    SpikeUp0 = pygame.image.load(os.path.join("Images", "SpikeUp0.png")).convert_alpha()
    SpikeUp1 = pygame.image.load(os.path.join("Images", "SpikeUp1.png")).convert_alpha()
    SpikeDown0 = pygame.image.load(os.path.join("Images", "SpikeDown0.png")).convert_alpha()
    SpikeDown1 = pygame.image.load(os.path.join("Images", "SpikeDown1.png")).convert_alpha()
    GameOver = pygame.image.load(os.path.join("Images", "Game-Over.png")).convert_alpha()
    Replay = pygame.image.load(os.path.join("Images", "Replay.png")).convert_alpha()
    Bone = pygame.image.load(os.path.join("Images", "Bone.png")).convert_alpha()

    Game = True
    Dog1_pos_x = 100
    Dog1_pos_y = 100
    screen.blit(background, (0, 0))
    screen.blit(FlappyDog, (0, 0))
    screen.blit(Bone, (550, 100))
    screen.blit(Play, (600, 350))
    screen.blit(Dog0, (5, 240))
    bones = pygame.sprite.Group()
    bones.add(Bone) # <-- Error here
    Dog = pygame.sprite.Group()
    Dog.add(Dog1)
    pygame.display.update()

    while True:
        if GameOver == true:
            screen.blit(background, (0, 0))
            screen.blit(GameOver, (20, 50))
        if pygame.sprite.gropucollide(Dog, Bones, True, True):
            Game = False
            GameOver = True
        while Game == True:
            pygame.event.pump()
            if pygame.key.get_pressed()[K_UP]:
                for i in range(10): # Up
                    Dog1_pos_y = Dog1_pos_y -1
                    screen.blit(background, (0, 0))
                    screen.blit(Dog1, (Dog1_pos_x, Dog1_pos_y))
                    screen.blit(SpikeDown0, (0, 436))
                    screen.blit(SpikeUp0, (0, 0))
                    pygame.display.update()
                    pygame.time.delay(1)
            else: # Down
                Dog1_pos_y = Dog1_pos_y +1
                screen.blit(background, (0, 0))
                screen.blit(Dog1, (Dog1_pos_x, Dog1_pos_y))
                screen.blit(SpikeDown0, (0, 436))
                screen.blit(SpikeUp0, (0, 0))
                pygame.display.update()
                pygame.time.delay(1)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
                pygame.display.update()

if __name__ == "__main__":
    main()

sentences:
Questions on the legal protection of games and their parts (assets, sounds, title) we started new pirate game, and I just want to ask some questions about rights. So I am new in game dev, I guess there are a lot of answers, but I guess professionals can advise something for first steps.

So we started some things like:

concept arts
sounds
we are working on the name of the game (just use temp one for now)
we develop some models of ships and characters

I have question what's my step to protect everything I listed above. Do I need to protect everything separately? Do I need to register a game somewhere? Can I use my already made domain and subdomain for the game? Or do I need to register unique one domaine.

sentences:
How can I draw filled triangles in C++? VERY IMPORTANT NOTE: Im trying to fill a triangle. I have already made the 3D part. Sorry if this wasn't understandable.

I'm currently trying to create a simple 3D-Engine. Well, I have successfully drawn a triangle using this method.

void DrawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
  drawLine(x1, y1, x2, y2); //Usage: drawLine(x, y, x1, y1)
  drawLine(x2, y2, x3, y3);
  drawLine(x3, y3, x1, y1);
}

After this method worked surprisingly well and a cube appeared very convincing, I tried to add lighting. Now I'm facing a pretty big problem. After a long thought I found this method of filling a triangle but here is the problem. It paints a few triangles but not all. Unfortunately I cannot show any pictures because I do not have a camera and a screenshot would not work (as I explain later). My theory is that it only draws bottom flat triangles (or the other way around). What should I change about my method so that it works? Thanks in advance.

This is my filling code:

void FillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
 drawLine(x1, y1, x2, y2);
 drawLine(x2, y2, x3, y3);
 drawLine(x3, y3, x1, y1);
 for(int x = x1; x<=x2; x++) {
    for(int y = y1; y<=y2; y++) {
     drawLine(x3, y3, x, y);
    }
  }
}

I'm currently working with an Arduino UNO
I'm using the Nokia 5110 display
I'm using C++
I'm using this library for displaying
Do not downvote, just comment what you need to know.
I have already tried this code but it wasn't working.

sentences:
Smooth out movement of the snake in a 2d Snake game I am working on a 2-D snake game in C++ with the SFML library. I would like to smooth out the movement of my snake as it looks extremely choppy currently.
How the Snake moves
The snake is made up of a list of parts. If I want to move the snake, I simply remove one part from the back (.pop_back()) and then add a new part in the front accrding to the velocity. This works perfectly. The speed of the snake must be the same as the distance between the parts.  So if the distance is 15, the will be 15. But a speed of 15 is extremely high, so I need to only update the snake every few frames or use sf::Sleep(). Since the snake moves such a high distance every frame, the movement doesn't look smooth at all. And since the speed must be equal to the distance between the parts, reducing the speed doesn't work too. How can I come about tackling this?

sentences:
Cell Lighting Propagation Problem I have in place a cell-based lighting system that works basically like this: (Not my actual code)

    //Light moves up
    for (int x = 0; x < width; x += 1)
    {
        for (int y = 0; y < height; y += 1)
        {
            light[x,y] = light[x,y+1] - amount;
        }
    }

    //Light moves down
    for (int x = width; x < 0; x -= 1)
    {
        for (int y = height; y < 0; y -= 1)
        {
            light[x,y] = light[x,y-1] - amount;
        }
    }

    //Light moves left
    for (int x = 0; x < width; x += 1)
    {
        for (int y = 0; y < height; y += 1)
        {
            light[x,y] = light[x+1,y] - amount;
        }
    }

    //Light moves right
    for (int x = width; x < 0; x -= 1)
    {
        for (int y = height; y < 0; y -= 1)
        {
            light[x,y] = light[x-1,y] - amount;
        }
    }

The variable amount is determined in each for() loop by if there is a block at x,y.

This should make it so that light darkens faster if there is a block at the position, but the light shows up looking like this:

Light shine out sides oddly

Light is in a tunnel, as you can see the top and bottom blocks are solid but they are not being lit up

Verical tunnel, but it seems to work correctly

Up and down dont seem to work quite right

I should also mention that changing the order of the passes changes in which direction the light propagates incorrectly. For example, if I change the order from up,down,left,right as shown above to left,right,up,down, the light is spread correctly in a horizontal tunnel and incorrectly in a vertical tunnel.

SO MY QUESTION IS: What is wrong with my code that creates this obvious miscalculation?

If you need to see more code or explanation or screenshots, I'll be happy to provide.

sentences:
Should the HUD be Entites in a ECS ? And how to handle Events if so? I'm building a GameEngine using Ashley and some how I can't figure out how.

I through I could use something like this. Or use the Signal/Listener from Ashley.
But how to Implement a interactive HUD? This is my current idea:

I have a System that only polls for inputs. If it detects an Input it would be a MouseClick so the PollySystem is sending out a MouseClickEvent witch the Coords. And a HUDClickedSystem will catch this event and checks if the click was inside a HUD Boundary and will Tag it with a clickedCompoment or not.
A Third system will look out for all entities with a clickedComponent and will react something like Respawn button clicked -> Respawn, Pause button clicked -> Pause etc.

This is a mix from the ideas here and here

I would love to have something like the Command pattern / Intent System  because I think it easy and straight forward but I can't figure out how to handle more than a flag ( Key pressed / Mouse pressed ).
But for this I need to know where the Mouse is pressed.

sentences:
Whats the physics behind the doodle jump game? I'd like to know how we can achieve the doodle jump type physics using andengine.

I mean the character is not colliding with the ground blocks when he moves upwards but will collide when he came downwards and will make a jump from their.

Can it be achieved using the collision filter? If yes how? Is it possible to enable and disable collision filter for particular bodies dynamically?

sentences:
XNA how to draw some sprites tiled/wrapped and others not? I already have:

mySpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);

and take care to draw all my sprites in order.

I now want to draw some textures tiled. Do I have to create another SpriteBatch and call:

mySpriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.Opaque, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone);

To draw my tiled textures? But won't these tiled sprites be drawn on top the ones already drawn with the previous SpriteBatch?

What I would really like is to be able to do is draw some sprites normally and some tiled using the same SpriteBatch then my ordering wont be messed up. Is this possible? I tried:

GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Wrap;
GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Wrap;

In my first and only SpriteBatch but got the InvalidOperationException:

  Cannot change read-only SamplerState. State objects become read-only the first time they are bound to a GraphicsDevice. To change property values, create a new SamplerState instance.

sentences:
What is the perfect sprite size for new ipads with retina displays The graphic designer is sending me huge sprites 3000px in width drawn by hand. And now the company is hiring a professional painter to paint huge oil paintings for the game for other levels. Nothing digital. I receive PNG.

The game is a clicking game where you find hidden stuff, puzzle. So the slightest details matters. Everything must look so perfect. Primary devices are the ipads with retina displays but the game must be cross platform.

What is the size I should ask the painter to paint? And the graphic designer to draw?
What is the best size for a background PNG? And what size is the items? currently I resize to 600 * 400 the background and the items are 100px by whatever height photoshop deems good.

I'm afraid to go smaller than that, even though technically I should be able to. Another programmer working on the game, resized them down so much and they got stretched.

sentences:
Sprite animation in Android view I'm looking for a way to have different sprite animations in individual Android views.

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

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

Thanks for the help. Jose

sentences:
Slope scaled depth bias with normal maps I'm using a slope scaled depth bias to reduce shadow acne with shadow maps. However, it's causing artifacts when used with normal mapped surfaces because the bias varies over the surface, where it should really take the normal of the underlying geometry as a bias for all texels instead.

The bias is calculated like this:

float bias = 0.005 * tan(acos(dot(normal,-lightDirection)));

How can I get around this problem, when I don't have geometry information available while applying the shadow map (e.g. during lighting pass of deferred shader)?

sentences:
Small health bar above entity is drawn differently when the entity is rotated differently Here is a simple positioning code for my health bar:

transform.position = Camera.main.WorldToScreenPoint(target.position - 0.2f * target.up);

Here is the prefab:

HealthBar is middle-center anchored, and 0.5, 0.5 pivoted,
Background and Fill are stretched and 0.5, 0.5 pivoted, but background is Left, Right, Top, Bottom -1 positioned.

Here is how it should look: (all images are zoomed in)

And here is a video about the entity rotating around: https://i.imgur.com/EOzFEvt.mp4

2 example rotations, in which the health bar is drawn incorrectly: (see the border of the bar)

Why?

Edit: Another interesting artifact:

If I'm moving the camera up, the healthbars are offsetted up a bit, and if I start moving down, it's instantly offsetted down, with left and right the same, etc. As soon as I stop, it's at the correct position, but as soon as I start moving, it becomes offsetted to the direction I'm moving.

See gif: https://i.imgur.com/K8mwzTW.mp4

Fix for this: Place it in LateUpdate.

sentences:
Unity - Problems with scene object orientation and rotation after updating my project from 5.0.0 to 5.2.2 Last year I made a large project on Unity 5.0.0, today I re-opened it on 5.2.2 to do some work on it. I was given the message that the project needed to be updated, I allowed it to do the update. Now when I open up my scenes, many of my scene objects are misplaced, the rotation is completely wrong and positioned in the wrong place. My scenes are of a refinery and the most commonly broken object is the pipework, something that would take hours to correct manually.

My pipework is created this way...

All pipes are made in blender and each scene's pipes are saved as a single blender model (with each pipe make from a bezier curve and left as a separate object).
Once imported into Unity (as a single .blend file), I've then dragged and dropped coloured materials onto all the individual pipes, so they are all coloured correctly.

This has all been fine until updating the project to 5.2.2 - now some of the pipes are in the right place, but many are rotated in completely the wrong direction, leaving it looking a mess. If I delete the pipes from Unity and reimport the pipe model back in, this would solve the problem, but then all the materials/colours will be gone. Due to the sheer amount of pipes throughout the whole project, to re-colour them all again would be an extremely problematic task, especially as it's critical that the pipes are the right colour.

I am confused how some of the pipes within the same pipe model are fine and the others are wrong, it would be so much easier to sort if they had all changed rotation together, then I could just switch them all back in 1 go. I have a total of 13 scenes and so far all of them have suffered the same problem.

Nothing whatsoever has been changed on any of the scenes, assets or indeed anything in the project folder. In fact I haven't touched a single file within the project since October last year, so it is certainly to do with updating to 5.2.2. Is there anything I can do to fix the problem without having to re-import the models back in or manually rotate everything back?

I have attached some screenshots to show the issue - See how in the blender image, all the pipework is placed correctly and then in the Unity image, half the pipes have flipped and are facing the wrong way. I have removed the ground so this can be seen clearer. Any help would be much appreciated.

Many thanks

sentences:
Large-Scale Case Handling for 2D Procedural Environment I am creating a procedurally generated side scroller and I have a question regarding proper code structure/Architecture when it comes to connecting different platforms and large scale cases. There are various platform types I need to connect (e.g. a hill which leads into a tunnel which then leads into a cave, etc). I can successfully generate and connect the meshes using a bezier curve. My problem is that the way I am handling each platform connection case seems very clunky/inelegant the more I expand.

Currently I am using switch statements to handle each scenario like the above mentioned. Below is a small snippet of how I am handling each case.

public void SetTransition(int PrevPlatform, int CurrPlatform , Vector3 LastPosition)
{
    switch (PrevPlatform) {
    case 0:
        GroundTransition (CurrPlatform,LastPosition);
        break;
    case 1:
        CaveTransition (CurrPlatform,LastPosition);
        break;
    case 2:
        WaterTransition (CurrPlatform,LastPosition);
        break;
    case 3:
        TunnelTransition (CurrPlatform,LastPosition);
        break;
    case 4:
        WallJumpTransition (CurrPlatform,LastPosition);
        break;
    }
}

From here I have separate functions that handle the cases using more switch statements. The problem now is that I am starting to have a large number of branching functions that are relying each case. My code structure is becoming this large tree of switch statements. For the most part it works but I wanted to reach out to other developers before I continued this route. Is there a more effective, organized methodology to handling large scale cases?

sentences:
Why aren't my Unity rotations working properly? I'm experiencing a rather annoying bug and I was hoping someone could offer some help because this just isn't making sense to me. I have a Ballistic script that tells the bullet to move in its local forward direction, which should be whichever way the gun is pointing. I have a PlayerAttack script that calls for a bullet to spawn with OnShootEnter(). It sets the bullets position to that of a bulletSpawn transform, which is a child of the gun.

OnShootEnter() is being properly called and bulletSpawn is properly assigned; and yet, when the bullet spawns, its facing Vector3.forward, instead of it facing bulletSpawn.forward. These are the only two scripts affecting the bullets spawn, rotation, and direction. Everything looks in order to me; what am I missing?

public class PlayerAttack : MonoBehaviour
{
    public GameObject bulletPrefab;

    public Transform gun;
    public Transform bulletSpawn;
    public float damage;

    void OnShootEnter()
    {
        GameObject bullet
            = Instantiate(bulletPrefab, bulletSpawn.position, bulletSpawn.rotation);
     }
}

public class Ballistic : MonoBehaviour
{
    public GameObject model;
    public float range;
    public float accuracy;
    public float speed;

    Vector3 dir = Vector3.zero;

    void Start ()
    {
        model.transform.SetParent (this.transform);
        dir = transform.forward;
    }

    void Update ()
    {
        transform.GetComponent<Rigidbody> ().velocity = dir.normalized * speed;
        range -= Time.deltaTime;

        if (range <= 0)
            Destroy (this.gameObject);
    }
}

sentences:
XNA move from start position to target position exactly in 3D If I have a list of positions that map out a path a character should follow. What would be the best way to move at a constant speed to each position making sure the character lands exactly at each position before moving onto the next?

For example the character is at position A, we then queue up position B and position C. The character cannot move towards position C until it reaches position B exactly.

It would be great if the solution worked at slower frame rates/update speeds as well.

sentences:
How do I calculate the required force to launch an object? I want to use a rigidbody AddForce() method on an object to launch it over from the enemy to the player, like throwing a ball at a target.
The problem is, I'm not sure how much force is required to use in the AddForce() method and it is taking too long to figure it out, and adding to that, the force would be different if I was farther away.
I found this helpful guide but it is not in 3D: https://forum.unity.com/threads/how-to-calculate-force-needed-to-jump-towards-target-point.372288/#post-2415612.
Could someone explain step by step in an easy to understand manner how to calculate the force required to get an object launched perfectly onto a target? (I'm not very good at math, haha...) Here's some images from that thread that will help illustrate the desired result:

sentences:
How is the terrain generated in Commandos and Commandos game clones/look-alikes? The Commandos series of games and its similar western counterpart, Desperados, use a mix of 2D and 3D elements to achieve a very pleasing and immersive atmosphere. Apart from the concept that alone made the series a best-seller, the graphics eye-candy was also a much appreciated asset of that game.

I was very curious on what was the technique used to model and adorn the realistic terrains in those titles? Below are some screenshots that could be relevant as a reference for whomever has a candidate answer:

The tiny details and patternless distribution of ornamental textures make me think that these terrains were not generated using a standard heightmap-blendmap method.

sentences:
LibGDX - Image width is not set to resetting to zero when full width I am making a progress bar for showing the players current experience. However I have come around to a bug, which appears when the player is maxing out his experience and then is getting a new level. In the ideal world my code should reset the progress bar image width (which is a Scene2D image btw), but for some reason it is not setting the image width to zero, but is setting it to its full width instead, which I can't seem to understand why. I hope anyone can help me.

I have provided my code below, and also uploaded a video on youtube with my bug - Video of the bug

The method below is the one I use to change the experience progress bar width as well as the experience.

public void changeLevelExperience(int gainedExperience) {
    float maxExpDividedInPixels = 131f / this.GAME.gameScreen.getGameManager().maxExperience;

    this.GAME.gameScreen.getGameManager().currentExperience += gainedExperience;

    if (this.GAME.gameScreen.getGameManager().currentExperience >= this.GAME.gameScreen.getGameManager().maxExperience) {
        this.GAME.gameScreen.getGameManager().currentLevel++;
        this.currentLevelLabel.setText(this.GAME.gameScreen.getGameManager().currentLevel + "");
        //TODO: Another arrangement for the experience needs to be made.
        this.GAME.gameScreen.getGameManager().maxExperience += 35;
        this.GAME.gameScreen.getGameManager().currentExperience = 0;
        Gdx.app.debug(TAG, this.GAME.gameScreen.getGameManager().currentExperience + "");
    }

    this.levelProgressBar.setWidth((int) (maxExpDividedInPixels * this.GAME.gameScreen.getGameManager().currentExperience * this.scaleFactor));
}

sentences: How can I make particles glow and cast light on its surroundings? Im currently attempting to make a firefly effect on a dark forest. The level has very low light and the player is one of the few light sources. To let the player see the level better, I am attempting to making glowing fireflies appear randomly on the map. One way is to use a particle system. But I cant make the particles cast light one the surroundings. Is there a way to do this?

sentences:
How can I get the vector3's names to gameobject name? void DrawBox()
    {
        SpawnLineGenerator(v3FrontTopLeft, v3FrontTopRight, color);
        SpawnLineGenerator(v3FrontTopRight, v3FrontBottomRight, color);
        SpawnLineGenerator(v3FrontBottomRight, v3FrontBottomLeft, color);
        SpawnLineGenerator(v3FrontBottomLeft, v3FrontTopLeft, color);

        SpawnLineGenerator(v3BackTopLeft, v3BackTopRight, color);
        SpawnLineGenerator(v3BackTopRight, v3BackBottomRight, color);
        SpawnLineGenerator(v3BackBottomRight, v3BackBottomLeft, color);
        SpawnLineGenerator(v3BackBottomLeft, v3BackTopLeft, color);

        SpawnLineGenerator(v3FrontTopLeft, v3BackTopLeft, color);
        SpawnLineGenerator(v3FrontTopRight, v3BackTopRight, color);
        SpawnLineGenerator(v3FrontBottomRight, v3BackBottomRight, color);
        SpawnLineGenerator(v3FrontBottomLeft, v3BackBottomLeft, color);
    }

And the gameobjects name:

    void SpawnLineGenerator(Vector3 start, Vector3 end, Color color)
    {
        GameObject myLine = new GameObject();
        myLine.name = start.ToString();

        myLine.transform.position = start;
        myLine.AddComponent<LineRenderer>();
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.material = new Material(Shader.Find("Particles/Alpha Blended Premultiply"));
        lr.startColor = color;
        lr.endColor = color;
        lr.startWidth = 0.03f;
        lr.endWidth = 0.03f;
        lr.SetPosition(0, start);
        lr.SetPosition(1, end);
    }

The method SpawnLineGenerator get two vector3 and a color:

SpawnLineGenerator(v3FrontTopLeft, v3FrontTopRight, color);

In the SpawnLineGenerator i'm setting a name for each gameobject:

 myLine.name = start.ToString();

This give me the name for example: (-2.1, 3.4, 4.9)
Nut I want it be the name like this format:

v3FrontTopLeft (-2.1, 3.4, 4.9)
v3FrontTopRight (-1.1, 3.4, 4.9)

The problem is if there is a easy way to get the names v3FrontTopLeft and v3FrontTopRight and the rest from the method DrawBox instead typing each one.

I want to know that (-2.1, 3.4, 4.9) are the coordinates for v3FrontTopLeft

sentences:
3D meshes for WPF (XAML)? I'm trying to make a WPF-3D game. WPF uses XAML.

I'm trying to find free 3D assets from the internet. :-)

What format of 3D models I should be looking for, direct XAML or 3D Studio format or what?
I know that there are some 3D Studio format to XAML -converters, but I don't know if they really work...

sentences:
How would I properly flip a character when they reach the edge of a ground object in Unity 2D? The idea here is that the raycast shoots downwards from an empty game object and when it detects that there is no ground below it the character should bounce back and walk the other way. When I get to the edge of my platform the character just gets stuck in place and keeps rotating on the Y axis.

public class npcAI : MonoBehaviour
{
public float speed;
public float distance;
private bool movingRight = true;
public Transform groundDetection; //raycast goes downward from this point

private Vector2 movementDirection;

void Start()
{
    //Initialise direction
    movementDirection = Vector2.right;
}

void Update()
{
    transform.Translate(movementDirection * speed * Time.deltaTime);
    RaycastHit2D groundInfo = Physics2D.Raycast(groundDetection.position, Vector2.down, distance);
    if (groundInfo.collider == false)
    {
        if (movingRight)
        {
            movingRight = false;
            movementDirection = Vector2.left;
      transform.localScale -= new Vector3(0.30F, 0, 0);

        }
        else
        {
            movingRight = true;
            movementDirection = Vector2.right;
      transform.localScale += new Vector3(0.30F, 0, 0);
        }

    }
}

The code above was edited to reflect the answer below. If you find yourself attempting to do the same thing and need to flip your sprite when you reach the edge change 0.30F to whatever double the X value of your sprite is in order to flip it. My sprites scale was (0.15, 0.15, 0) so I used 0.30F to flip my sprite. Be mindful of when you should use -= and when you should use +=.

sentences:
How to avoid being throttled? I'm writing a networked iOS game.  When sending packets with GKMatchSendDataReliable (which I assumed was UDP with their own packet reception code written) at 60 packets per second (so 16 ms between adjacent packets), average ping times rapidly get worse:  I opened 7 GameCenter matches below (one after the other) and simply sent a "flood" of 100 packets (at a rate of 60 packets per second).  I measured the average roundtrip time, and these are the results:

[ 21:16:39 ]:  I saw an average roundtrip time of 52.342787 ms, he saw 54.496590 ms
[ 21:16:34 ]:  I saw an average roundtrip time of 62.631942 ms, he saw 61.991655 ms
[ 21:16:45 ]:  I saw an average roundtrip time of 88.394380 ms, he saw 83.619123 ms
[ 21:16:51 ]:  I saw an average roundtrip time of 179.053118 ms, he saw 156.869141 ms
[ 21:16:57 ]:  I saw an average roundtrip time of 75.025076 ms, he saw 75.419723 ms
[ 21:17:23 ]:  I saw an average roundtrip time of 8832.082488 ms, he saw 7616.877558 ms
[ 21:19:33 ]:  I saw an average roundtrip time of 25088.962344 ms, he saw 16833.064914 ms

After the last 2 tests the results are around 1000 ms.

It would seem that I'm being throttled, most likely by my ISP.  Because this is an iOS game, people will use regular residential connections.

When I changed the packet send rate to being 10 times slower (so 1 packet every 160 ms), the tests take much longer, but roundtrip times remain consistently low.

  [ 21:31:27 ]:  I saw an average roundtrip time of 55.289109 ms, he saw 69.032727 ms

So it looks like to keep low latency on the connection (and not be "punished" by ISPs) I have to reduce the rate of packets that I send.  Keep in mind these are very small packets, like 40 bytes maximum, yet I'm still being throttled.

I'm looking for guidelines on how many UDP packets I can send per second to avoid being throttled!  Are there any general guidelines anywhere?

sentences:
How to raycast against a physx cloth mesh? I'm using the PhysX 3.3 SDK in a application and mostly everything is working fine. However, I'm trying to develop a feature that would allow users to click on various actors in the scene and modify their properties.

My approach so far has been to use the PhysX raycast to query the scene and use RaycastHit to return a pointer to the actor. This works fine for rigid bodies, but for cloth actors, the hit is invariably null.

This suggests that PhysX can't raycast against cloth objects, but other than my tests, I haven't seen anything in the docs (or on the interwebs) that say this definitively.

Any thoughts?

sentences:
Procedural 3D Environment Generation I am concerning a 3D Scroller game which is like Subway Surf or Temple Run. The thing I am confused about is their way of generating 3D environment. For example for 2D games like Flappy Bird, there is a camera and player which have fixed positions respect to the X axis. And the environment is being generated, moved into camera's viewport, and finally gets destroyed after getting out of viewport. I mean, player and camera does not move in general, the environment does.

Is this approach efficient by means of performance for 3D scrollers? Do they use a box which covers the camera's viewport, and when objects get out of the box, destroy them? Or do they create the environment via code as the player goes further, then make the camera follow the player and they are moving both? Is this a valid approach and what are the advantages or disadvantages of these implementations?

Thanks in advance!

sentences:
Solution for lightweight LAN peer discovering? I built a library for purely cross-platform programming. My games made with it run fine in Android , Pc, Linux, Mac etc.

The networking capabilities are provided by ENET library, therefore all communication between my apps is not TCP or UDP compatible, but only in the custom protocol, even tough its based on the UDP ultimately.

I don't think its possible to do what i want with ENET, thats why I ask here for help!

Lets say I have the same game running in my Android phone, my laptop and my pc. They are all in the same wifi network, and therefore in a LAN, whether its Wifi hotspot(?) or the household router.

I need each of those 3 peers to discover the other two in the network. This is meant only to find the IP of alive apps in the LAN network, to be able to host multiplayer games between them.

I can only think of one effective way to do this, UDP broadcast, wait responses, but if that is the solution, i need something small, since its the only purpose of the implementation.

Other way could be to try to connect to all IPs in the LAN address subrange, but I don't think the OS would be with me on this one :p

sentences:
How do I make an XML-specified animation show completely? I want to add animation to my game board when updating tile positions. I can start an animation at the right point, but there's a catch: When the translate animation starts, it seems like the animation is confined within the tile (button) or is just hidden behind another button. Instead, I want it to look like it is moving.

This is what happens:

This is what I want to happen:

Here's how I start the animations:

    Animation tile_up = AnimationUtils.loadAnimation(this, R.anim.tile_up);
    // This was a valid move. Add to moves and enable undo for this
    for(int i = 0; i < 5; i++)
    {
        buttons[x][i].startAnimation(tile_up);
    }

Here's the animation spec (in res/anim/tile_up.xml):

    <?xml version="1.0" encoding="utf-8"?>
    <translate
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:shareInterpolator="true"
        android:fromYDelta="100%p"
        android:toYDelta="0%p"
        android:duration="100"/>

How can I fix this?

sentences:
Method keyTyped in ClickListener is not working When im click my SelectBox and press some key, nothing happens.

sbNationality.addListener(new ClickListener() {
    @Override
    public boolean keyTyped(InputEvent event, char character) {
        System.out.println(character);
        return super.keyTyped(event, character);
    }
});

Im doing something wrong?

sentences:
How can I take ingame images and videos? I’m using MonoGame and Visual Studio Community on my Mac to develop a game for iOS. I want to take ingame images and videos of the gameplay while the game is running on an iPhone/iPad. Afterwards, I want to use these images and videos for promotional reasons on my website or on facebook.

Is it necessary to install third party software or can I take images and videos in Visual Studio Community without installing additional software?

sentences:
How does the SAT collision detection algorithm work There are a lot of tutorials and sample code available showing how to implement the SAT collision detection algorithm.

But can someone explain, without math or code, what are  the general principls behind this technique.

sentences: Is there a known most efficient version of A* search algorithm? Is there a known 'most efficient' version of the A* search algorithm? I know some people write papers on the most efficient way to compute common operations, has this been done for A*?

sentences:
How to make a drawing action run in an left released event in Game Maker? At first I tried to make the progress bar update using only one object that would command everything (obj_Control), linking to the global left released event a script containing the draw_rectangle function, but I got no results.

The Game Maker did not acknowledge any errors, but the progress bar did not update when I clicked on the created rectangles.

obj_Control (already without the draw_rectangle event):

Because of this I decided to create 3 new objects (obj_Vida, obj_Fome, obj_Energia), each containing a sprite and when each was clicked it would perform the action to update the progress bar:

obj_Vida:

scpt 1 => obj_Control.vida+=10; (applies to self)

scpt 2 => draw_healthbar(120,100,240,120,vida,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

obj_Fome:

script 1 => obj_Control.fome+=10; (applies to self)

script 2 => draw_healthbar(120,150,240,170,fome,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

obj_Energia:

script 1 => obj_Control.energia+=10; (applies to self)

script 2 => draw_healthbar(120,200,240,220,energia,c_black,c_red,c_green,0,true,true); (applies to obj_Control)

Room:

Room size => 360x640

Translate => vida/life, fome/hungry, energia/energy

What happens is that even dying of clicking on objects (obj_Vida, obj_Fome, obj_Energia) nothing happens to the progress bar. I discovered that it is because of the event, it would have to be a draw event. I added one below the left released event, but it did not work.

I apologize for any typing errors. I am not an English speaker and I had to translate everything. If something was not clear, please signal.

Thanks for everything.

sentences:
Unity C# 2D Platformer Enemy Patrolling I'm setting up a basic mario-like 2D platformer and I'm trying to give 'enemies' a patrolling path on a platform. (just like the turtles in Super Mario Bros). All they do is patrol from left to right and back. <--->

Currently my game object is walking to left and right in the middle of my scene.
Despite me positioning my game object as far left as I can, at first it walks to the center of the scene and continues acting out his patrol in the center of my scene.

What I can't seem to figure out is adjusting the position where he patrols. I don't want him to patrol in the center of the scene.

I think I should use the originalX position in the Update function but I'm not sure how (I could be wrong)?

This is the script that is linked to my enemy gameobject.

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
    public float walkSpeed = 1.0f;      // Walkspeed
    public float wallLeft = 0.0f;       // Define wallLeft
    public float wallRight = 5.0f;      // Define wallRight
    float walkingDirection = 1.0f;
    Vector2 walkAmount;
    float originalX; // Original float value

    void Start () {
        this.originalX = this.transform.position.x;
    }

    // Update is called once per frame
    void Update () {
        walkAmount.x = walkingDirection * walkSpeed * Time.deltaTime;
        if (walkingDirection > 0.0f && transform.position.x >= wallRight) {
            walkingDirection = -1.0f;
        } else if (walkingDirection < 0.0f && transform.position.x <= wallLeft) {
            walkingDirection = 1.0f;
        }
        transform.Translate(walkAmount);
    }
}

sentences:
Overlap color between objects I'm currently trying to build a game with Ogre3D that is basically a moving vehicle that leaves a green trail (2D manual mesh) in it's path, what i'm trying to achieve is exactly what this image shows:

My problem is that i need to change, by some method/technique, the color of the intersected path where the two meshes overlap (red area).
I've been searching around the Ogre forum and found this thread http://www.ogre3d.org/forums/viewtopic.php?f=2&t=47674, I've replicated that solution in my code but now on the screen i only see the intersected path. I'm a total newbie in stencil buffers and in Ogre generally, so I'm still not sure if this is the best approach to solve my problem.
should I try another method rather than applying a stencil buffer? vertex/fragment shader code that could help?

Any advice or direction that you could provide will be very appreciated.
Thanks a lot

***** UPDATE *****

According to JasonPh's answers i've managed to start adding some code:

1) Create manual texture

Ogre::TextureManager* tmgr = Ogre::TextureManager::getSingletonPtr();
gkString mMapTextureName = "pathTexture";
if (!tmgr->resourceExists(mMapTextureName)) {
    Ogre::TexturePtr ptr = tmgr->createManual(mMapTextureName,
                           Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                           Ogre::TEX_TYPE_2D,
                           480,  // Width
                           640,    // Height
                           1, // Depth
                           0,
                           Ogre::PF_A8R8G8B8,
                           Ogre::TU_RENDERTARGET);

    ptr->createInternalResources();
    ptr->load();

    Ogre::RenderTexture* pathTexture = ptr->getBuffer()->getRenderTarget();
    gkEngine* engine = gkEngine::getSingletonPtr();
    Ogre::Camera* camera = engine->getActiveScene()->getMainCamera()->getCamera();
    pathTexture->addViewport(camera);
    pathTexture->getViewport(0)->setClearEveryFrame(true);
    pathTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
    pathTexture->getViewport(0)->setOverlaysEnabled(false);
    pathTexture->setAutoUpdated(true);
}

2) Create material from scratch and use the previously created texture. This material is then assigned to my "path" entity.

Ogre::MaterialManager* mmgr = Ogre::MaterialManager::getSingletonPtr();
mMaterialName = uniqueMaterialName("pathMaterial");
mMaterial = mmgr->create(mMaterialName, "General");

Ogre::Technique* tec = mMaterial->getTechnique(0);
tec->setSchemeName("ShaderGeneratorDefaultScheme");
Ogre::Pass* pass = tec->getPass(0);
pass->setVertexProgram("pathMaterial/vs", false);
pass->setFragmentProgram("pathMaterial/fs", false);
pass->setCullingMode(Ogre::CULL_NONE);
pass->setColourWriteEnabled(true);
pass->setLightingEnabled(true);
Ogre::TextureUnitState* tus = pass->createTextureUnitState();
tus->setTextureFiltering(Ogre::TFO_NONE);
tus->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP);
tus->setTexture(tmgr->getByName(mMapTextureName));

mMaterial->prepare();
mMaterial->load();

3) Fragment shader code

uniform sampler2D pathTexture;

void main()
{
   vec4 color = texture2D(pathTexture, gl_TexCoord[0].xy); =
   if(color == vec4(0.0, 1.0, 0.0, 1) //green
       gl_FragColor = vec4(1.0, 0.0, 0.0, 1) //red
   else
       gl_FragColor = vec4(0.0, 1.0, 0.0, 1) //green
}

This still needs some fixes to work, so new questions have emerged:

1) Do I realy need to render "pathTexture" on screen to this to work? Maybe that texture could only be used to decide pixel colors an then discard it?

2) To only use "pathTexture" as an "input" for my shader, should I add a second pass on my material file with "pathTexture" as a texture unit?

Thanks!

sentences:
Why Does unity_LightPosition[0] Seem to Depend on Camera Position? I'm trying to write a fairly basic shader but I keep running into lighting issues with Unity.  My first problem was trying to figure out which variable stored the light's position in world space.  (I'm only working with one light, at least at the moment).

I finally found something that responds to movement of my light source: unity_LightPosition[0].  However the shader still didn't do what I wanted it to do, so I did some debugging:

I have a basic vertex and fragment shader and what I'm currently doing in the fragment shader is:

float4 c = float4(0, 0, 0, 1);
float3 lp = normalize(unity_LightPosition[0]);
c.rgb = lp;
return c;

This should just set the color of my object to the normalized position of the light source, correct?  What I see in my scene is my object changes colors when I move my camera around it (I'm not moving the light source at all, it is a separate entity).  The color also seems to increase in strength as I zoom in.

To me, it seems as if unity_LightPosition[0] is related to my camera's position, as well as orientation and zoom level, yet the documentation I've found says it should represent the position of the light in world space.

I tried switching to using the following:

float3 lp = float4(
    unity_4LightPosX0[0],
    unity_4LightPosY0[0],
    unity_4LightPosZ0[0],
    1.0
);

...but that only colors my object red regardless of the light's actual position.

Additionally, I've set the LightMode tag to Vertex.

It seems like simply getting the world position of the light source shouldn't be this difficult.  What am I not doing correctly?

EDIT:
I've been playing around with the camera and light position and I think that unity_LightPosition[0] actually puts out position in the projection space.  If I place the light source in the lower-left corner of the screen, the object is black.  Upper-left the object is green (0, 1), upper-right is orange (1, 1), and lower-right is red (1, 0).  When I place it in the lower-left (0, 0) and move the camera in front of it, it becomes blue.  This is consistent with the depth value behavior.  (0, 0, >0) would appear as blue.

Now, how to get it from projection back to world?...or should I use a different variable?

sentences:
Game Architecture: Class leaking into almost all files We currently have the problem that our main class GameController is being pulled into every backend file in our game. We're wondering what are common solutions to this problem.
Here's a bit more about the game architecture. The game is a board game, so since ~90-95% of the time there isn't anything happening, the game is set up more like a rest API. It waits for a user prompt, when received, the msg is distributed to the respective components of the game and the proper logic is executed. No large update loops, just executes logic when prompted.
The problem is that as this msg cascades through the system, GameController acts more like a relay point between the systems. It's how the nodes communicate to each other so that all game components are updated properly. The problem is that it's created this system where all new/old classes contain a pointer to parentGame, so GameController is everywhere.
Are there any simple architectural solutions to avoid having every class contain a pointer to parentGame? Is this necessarily a bad thing?
Some example code:
class GameController {
    bank: Bank
    action: Action
    ...
}
class Bank {
    parentGame: GameController

    constructor(game: GameController) {
        this.parentGame = game
    }
}
class Action {
    parentGame: GameController

    constructor(game: GameController) {
        this.parentGame = game
    }
}
```

sentences:
how to link a c++ object to a local variable in Lua I'm completing my scripting interface with Lua, but recently I've stuck at some point. I have several functions for my Entitiy events like Update(). I have a function called create_entitiy() which instantiate a new entity from a given entity index:

function Update()
  local bullet = create_entity(0, 0, "obj_bullet")
end

create_entity returns a table which is the properties of the created entity. Now how can I make a connection between bullet variable and my newly created object?

Right now for previously added objects to the scene, I simply set a global table for each of them and then after every call to Update(), I go through registered names to find object tables and perform new changes. Like the one below:

function Update()
  if keyboard_key_press(vk_right) then obj_player.x += 3
end

I can get obj_player table because I know its name from C++, plus I can get it as a global table and simply reach for the first instance named obj_player.

Is there any solution for me to make bullet variable act like this?

I was thinking to get all local variables in Update() function and check for every one to see if is it table and it has an unique field attached to it like id, this way I can determine that this is an object table and do the rest of the process.

By the way, is this interface going to work easier with luaBind if I implement it?

Bottom line:

How can I make a local variable in Lua that receives a table from create_entity function and track that local variable to capture it from C++.

e. g.

function Update()
  local bullet = create_entity(0, 0, "obj_bullet")
  bullet.x = 10 <== Commit a change in table
end

Now I want to get variable bullet from C++. And it's not just this variable, there might be a ton of these local variables with different names.

sentences:
Keep state in Unity editor without hitting serialization In my game I have a MonoBehaviour WorldView that, when created at editor time, initializes a large dictionary. Later from a Editor WorldViewEditor I call WorldView.SetBlock() that tries to access this dictionary, but finds it empty.

If I understand correctly this is because my editor doesn't access the same WorldView instance, but rather a copy it received through serializing and de-serializing my original instance.
Pushing this dictionary through the serializing process is a performance nightmare and not supported by Unity out of the box.

This dictionary should never be shown in any editor, is private to the instance and initialization will be called every time the scene is loaded.
This sounds like a perfect case for keeping it somewhere outside the serialization process.

I could try to leverage ISerializationCallbackReceiver but this still requires me to pull the entire dictionary through some serialization process.
I'm looking into keeping everything state related in a separate library outside of unity, but this has it own downsides.

Is there a way to put this dictionary in a place where its state is kept?

sentences:
Multi texturing in XNA I am attempting to make a map editor for my game, just so I can visualize how the end result would be.

To my world I can add cubes (2 triangles) or corners (1 triangle), which are then added to a list of the vertices to draw, and the indices are added to a list of indices. Everything draws fine here, and I can set different colours for each vertex.

I would like to implement texturing, so that when you add a primitive to the scene it will let you choose a texture (that, I can handle), but then also blend with other primitive's of different textures if they are touching (everything is on a grid).

I would guess that I would have to store the texture name for each primitive, and somehow set that texture when drawing it. But I fail to see how you can set the effects texture when you are using one DrawUserIndexedPrimitives<> to draw the entire scene.

If anyone has a work around for this, or ideas on other ways of doing this, you help would be greatly appreciated.

Edit 1

I have incorporated the technique from this website here - http://toyfactorygame.com/wp.php/2010/05/06/simple-fast-gpu-driven-multi-textured-terrain/ (similar to Blau's answer below), and have the current working result...

Which maps to this...

Using each color channel as a texture..

Output = tex2D(TextureSampler0, input.TexCoords) * input.Color.r;
Output += tex2D(TextureSampler1, input.TexCoords) * input.Color.g;
Output += tex2D(TextureSampler2, input.TexCoords) * input.Color.b;
Output += tex2D(TextureSampler3, input.TexCoords) * input.Color.a;

But doing it this way means I can only be setting 4 textures to blend together each DrawPrimitives call.

Is there another way I can achieve multi texturing with more than 4 (preferably unlimited) textures? I know this is possible, as games like C&C generals allow you to set textures anywhere you want on the map.

Thanks.

Twitchy

sentences:
Unity3d import file on iOS device im trying to figure out how to recall an external file in runtime on iOS device. I've already tried using Application.data+"/Raw/MY_FILE", with Application.streamingAssetsPath+"/MY_FILE", and with Application.persistentData+"/Raw/MY_FILE" (but, if i dont get wrong, persistentData is used for write, i need just of reading).

Please, anyone can help me?

sentences:
How to determine vertex index using Shader Model 3 or lower? I need something like SV_VertexId (added in Shader Model 4) in HLSL shader to determine which vertex is currently handled. Unfortunatelly, I can compile only vs_3_0 or lower.

The objective is to change position of one specific vertex using HLSL. I can't edit the mesh and can't pass any data from game engine, my capabilities are limited by HLSL shader.

Shader is writing only for one mesh (humain face), I need to change it's shape a bit (for example, close an eye or make it smiling). I already tried to locate vertex by TEXCOORD, but had no idea how to separate it from other triangles verticles connected to it (placed at the same point where many triangles are met).

if ( VS.TC[0] > 0.8828125 && VS.TC[1] > 0.6328125  && VS.TC[1] < 0.671875 ) {
    // Upper lip center
    VS.Position += VS.Normal * uUpLip;
}

Could you, please, give me any advice how to identify / move only one specific verticle in HLSL? I need something like moving verticle in Blender's Edit Mode (wytn neighbour triangles are still connected in one point), but my attempt with TEXTCOORD makes them moving in different directions

Thanks

sentences:
TModLoader reports a file to be missing when its not I'm Making a terraria Mod that adds all sorts of Junk, but one single issue keeps hitting me: It Thinks one of the Items needed does not exist.

The error I seem to be getting is:

 The item Copper Shortsword Stack of twenty does not exist in the mod GrandFinale.
If you are trying to use a vanilla item, try removing the first argument.
   at Terraria.ModLoader.ModRecipe.AddIngredient(Mod mod, String itemName, Int32 stack)
   at GrandFinale.Items.OmegaHeadbutt.AddRecipes() in c:\Users\sjpar\Documents\My Games\Terraria\ModLoader\Mod Sources\GrandFinale\Items\OmegaHeadbutt.cs:line 32
   at Terraria.ModLoader.RecipeHooks.AddRecipes()

Even Though The item exists here (full code)

using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GrandFinale.Items
{
    public class TwentyStack : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Copper Shortsword Stack of twenty";
            item.width = 40;
            item.damage = 1;
            item.melee = true;
            item.height = 40;
            item.toolTip = "This is a modded sword.";
            item.useTime = 20;
            item.useAnimation = 20;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 2;
            item.autoReuse = true;
            item.UseSound = SoundID.Item7;

        }
        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient("Copper Shortsword", 20);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

And Is Being Called By this Other Item:

using System.Collections.Generic;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

namespace GrandFinale.Items
{
    public class OmegaHeadbutt : ModItem
    {
        public override void SetDefaults()
        {
            item.name = "Omega Slash";
            item.damage = 10000;
            item.melee = true;
            item.width = 40;
            item.height = 40;
            item.toolTip = "The Sword Of The Ancients. Using it deals 499 Damage to the user, to deal 10,000 Base Damage";
            item.useTime = 20;
            item.useAnimation = 20;
            item.useStyle = 1;
            item.knockBack = 6;
            item.value = 10000;
            item.rare = 12;
            item.UseSound = SoundID.Item7;
            item.autoReuse = true;
        }

        public override void AddRecipes()
        {
            ModRecipe recipe = new ModRecipe(mod);
            recipe.AddIngredient(null, "Copper Shortsword Stack of twenty", 2);
            recipe.AddIngredient("Flask of Poison", 2);
            recipe.AddTile(TileID.WorkBenches);
            recipe.SetResult(this);
            recipe.AddRecipe();
        }
    }
}

(The Null on the line beginning tells of recipe.AddIngredient tells TModLoader that the item needed for crafting belongs to a Mod (not vanilla))

Any Help?

sentences:
How do I create a color picker with variable hue and saturation? I am trying to create a Color Picker similar to that of MS Paint.

Unfortunately, I can't figure out the algorithm for saturation.

This is what my current algorithm creates.
Anytime I try to perform a saturated effect going down on the Y axis, it just makes everything after the first line completely red or black.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML;
using SFML.Graphics;
using SFML.Window;

namespace Source
{
class ColorWheel : IGameObject
{
    Image image = new Image(255*6,355);
    Color color = new Color(255,0,0);
    int brightness = 255;
    public Sprite sprite = new Sprite();

    public ColorWheel()
    {
        for (int y = 0; y < 255; y++)
        {
            for (int x = 0; x < 255 * 6; x++)
            {
                //Red 255 - Green 0-254
                if (color.R == brightness && color.G < brightness && color.B == 0)
                {
                    color.G += 1;

                    //color.R -= (byte)y;
                    //color.G += (byte)y;
                    //color.B += (byte)y;
                }
                //Green 255 - Red 255-0
                else if (color.R > 0 && color.G == brightness && color.B == 0)
                {
                    color.R -= 1;

                    //color.R -= (byte)y;
                    //color.G -= (byte)y;
                    //color.B += (byte)y;
                }
                //Green 255 - Blue 0-255
                else if (color.R == 0 && color.G == brightness && color.B < brightness)
                {
                    color.B += 1;

                    //color.R += (byte)y;
                    //color.G -= (byte)y;
                    //color.B += (byte)y;
                }
                //Blue 255 - Green 255-0
                else if (color.R == 0 && color.G > 0 && color.B == brightness)
                {
                    color.G -= 1;

                    //color.R += (byte)y;
                    //color.G -= (byte)y;
                    //color.B -= (byte)y;
                }
                //Blue 255 - Red 0-255
                else if (color.R < brightness && color.G == 0 && color.B == brightness)
                {
                    color.R += 1;

                    //color.R += (byte)y;
                    //color.G += (byte)y;
                    //color.B -= (byte)y;
                }
                //Red 255 - Blue 255-0
                else if (color.R == brightness && color.G == 0 && color.B > 0)
                {
                    color.B -= 1;

                    //color.R -= (byte)y;
                    //color.G += (byte)y;
                    //color.B -= (byte)y;
                }

                image.SetPixel((uint)x, (uint)y, color);
            }

                //brightness--;
        }

        Texture texture = new Texture(image);
        sprite.Texture = texture;
    }

    public void Update(double dt)
    {
    }

    public void Render(RenderWindow rWindow)
    {
        rWindow.Draw(sprite);
    }

}

}

sentences:
Spawn Array of GameObjects to Array of Transforms I have a question regarding spawning an array of GameObjects in Unity. What I want to happen is that when a big enemy dies, it will spawn enemies into their respective Transform positions (i.e., Enemy 1 will spawn in Position 1, Enemy 2 in position 2, and so on).

I suppose I could go on with something like:

// C#

public GameObject[] Enemies;
public Transform[] SpawnPoints;

void KillEnemy()
{
    GameObject enemy1 = Instantiate(Enemies[0], SpawnPoints[0].position, SpawnPoints[0].rotation;
    GameObject enemy2 = Instantiate(Enemies[1], SpawnPoints[1].position, SpawnPoints[1].rotation;
    GameObject enemy3 = Instantiate(Enemies[2], SpawnPoints[2].position, SpawnPoints[2].rotation;

    Destroy(gameObject)
}

But the problems are:
1. I'm aware that the code is expensive to run, especially since I'm doing a 2D game; and
2. It provides no flexibility, meaning if I want a different enemy to use the same code, then I won't be able to do stuff like adding more enemies to spawn (after the first one dies, of course).

So yeah, I hope I get some help with this. Thanks!

sentences:
Limiting Framerate and Input So I have been learning HTML5 canvas recently and ran into a bit of a snag. I created a proof of concept that builds a block based 2d map that you can move a character inside of using arrow keys. This works well because everything is free moving (character moves 1 pixel per frame, so the movement is fluid and looks good).

I am trying to fork off of this code to create another concept that forces grid based movement (like in a typical roguelike). I have updated my movement code to move in chunks equal to tile size.. but the issue is that the refresh rate is so fast that it just seems like the character is moving at super speed.

Here is a snippet of my code that handles animations:

function gameLoop() {
        ctx.clearRect(player.x,player.y,PLAYER_SIZE,PLAYER_SIZE);
        getInput();
        ctx.fillStyle = '#000000';
        player.draw(ctx);
        window.requestAnimationFrame(gameLoop);
}

Is using requestAnimationFrame() for this sort of movement not a good idea? Is it better to just setInterval() for this sort of thing? I found a article via Google that talks about using variables for time, delta, fps, etc to limit the framerate... but Im not sure I understand how to do that in conjunction with requestAnimationFrame(). Should I somehow hold my gameLoop() from hitting requestAnimationFrame() until some time interval is hit? That seems like it would just be a waste because I would need to force a loop of some kind... doesnt seem too elegant

sentences:
How to make a sun that only illuminates stuff in sunlight? I set up a scene with Gaia Pro, and it looks really nice so far.  It even has a script to add a Sun object and have it circle the scene, which is pretty cool.

Problem is, it's implemented as a Directional Light, which illuminates everything.  I created a cavern with Digger as a part of the scene, and the interior of the cavern is brightly lit by the sun.  For obvious reasons, this should not happen!

What's the best way to fix the sun so it won't illuminate things that logically wouldn't be in sunlight?

sentences:
Skeletal Animation - Automatically apply skeleton to model Looking at websites such as mixamo.com or some game's development systems such as the animation editor for Overgrowth (http://www.youtube.com/watch?v=-RpqbC5-Z0E), i see that the skeleton in these situations is automatically being applied to the models.

I really don't expect (though wouldn't mind) code that does this, but i really am looking for some sort of pointer in the direction, or how they go about this. If any of you have done this, or know how to, please do reply, i don't want to spend the next week trying to crack it, then another to actually code it :P

Thanks all :)

Just for a bit more information, i am in C# working with OpenTK with my own custom model loader, etc. but i can easily adjust any given code / concept to fit with mine :)

sentences: speed up the update of glutidle() I have a client that sends data at 1KHz (i.e. 0.001 sec) to a master over Internet using UDP protocol. In Master, I need to draw an object, but the problem is that the update of GLUT is slower than the client's update. I have tried to use glutTimerFunc(0,glutIdle, 0); but still slow. Is there a way to speed up the update rate of drawing? I need to update Display() every 0.001 sec. Any suggestions? I'm using windows 7.

sentences:
Need help making a semi-simple javascript game I'm currently trying to make a fairly simple game in JavaScript and it isn't going too well.

Before I started, I thought I'd only need to know three things (on top of what I already know) which were:

How to 'spawn' an object (i.e. a bullet) by pressing an on-screen button.
How to make that bullet move across the screen.
How to make that bullet collide with something.

I thought the first two would be pretty simple, but I cannot find anything online to help me with them. Source code and tutorials appear to be either too simple or too complicated, and I'm starting to worry this project will be a lot more complicated than I thought.

So, can anyone help me do any of the listed things? If so it'd be much appreciated!

sentences:
How to handle objects on 2D Map I am making a 2D RPG game in Monogame XNA. For the moment I have 2 kinds of data in my game: sprites objects and tiles.
All the sprites are contained in a array list. I iterate over the sprites ArrayList to update and draw each sprites. Sprites objects are sort by their Y positions before each draw. This way, my character and other enemies can walk behind sprites. Sprites can be anything that require player interaction for example: chest, tree, enemy, player…
Tiles represent inanimate objects(2D array) (object that you cannot interact with) and only used for collision data and have a basic animation system.
However, for sprites collision checking I have to iterate over every sprites to do a bounding box overlap check.
My system works well, but I want to simplify things. What if I store static objects in my 2D tile array? I could just do getTile(x,y) to get the object stored in that position instead of going through my array list.
In the future I would like to have several types of objects, weapons, projectiles, and I want a consistent way to organize this.

sentences:
OnClick unity from another class I have class "Button" with function

public void SetOnClickListener(UnityAction listener)
{
    btn.onClick.AddListener(listener);
}

I have class "A" with fllow code

void D()
{
    Button btn = new Button();
    btn.SetOnClickListener(new UnityAction(SomeFunction));
}
public void SomeFunction()
{
    Debug.Log("Some Function was called!");
}

And it doesn't work. But if I do next change->

void D()
{
    Button btn = new Button();
    btn.SetOnClickListener(new UnityAction(SomeFunction));
}
public static void SomeFunction()
{
    Debug.Log("Some Function was called!");
}

All work correctly. Why I must use static and can I not use it?

sentences:
Unity InputSystem using Unity Events not maintaining values I am testing out using the new Input System and cannot get the values from context.ReadValue<Vector2>() to pass into a private variable.
The simple setup is below:
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    Vector2 leftThumbstickValues;

    void Start()
    {
        leftThumbstickValues = Vector2.zero;
    }

    void FixedUpdate()
    {
        Debug.Log("FixedUpdate: " + leftThumbstickValues); //Always displays "FixedUpdate: (0.0, 0.0)"
    }

    public void Move(InputAction.CallbackContext context)
    {
        leftThumbstickValues = context.ReadValue<Vector2>();
        Debug.Log("Move: " + leftThumbstickValues); //Displays correct values
    }
}

As you can see, in the Move function it correctly pulls the values from the thumbstick, but when it tries to use the values in FixedUpdate it always equals Vector2.zero. It seems like it should just work, but I think I must have overlooked something very simple.
Player Input Settings

Input Action Move Properties

Input Action Left Stick Properties

EDIT: I decided to remove the Player Input component and subscribe to the events in code:
 controls.Player.Move.performed += cntxt =>
 {
     Move(cntxt);
 };
 controls.Player.Move.canceled += cntxt =>
 {
     leftThumbstickValues = Vector2.zero;
 };

This now works as expected. I'm not sure I should mark this as the answer though as it doesn't explain why it doesn't work with the original setup, just offers an alternative solution.

sentences:
Splitting a character model to ease animations I've recently been looking into animations within Unity, and came across the idea of splitting my humanoid character's object into two at the waistline. The Idea being that animations used for movement can be applied to the legs, without interfering with general upper body animations/stances (and vice versa). Is this a viable option and would there be any adverse effects from doing this?

Also, is there any real need? I've noticed Unity is quite flexible when it comes to animations, but am unsure whether unity would be able to handle this? My main issue is different weapon types, where I would like the hands in different idle positions, but without having to have 4 or 5 different running forward animations.

sentences:
Unused constant buffers in shaders If you define a constant buffer in a shader, for example

cbuffer test : register(c2)
{
    float4x4 data;
}

But never actually use the data in the shader, does that incur any runtime cost at all?
It's convenient for me to do this but not at the cost of slowing runtime performance at all. When I time it I don't see any difference...

sentences:
problem on enable and disable GameObject I'm trying to enable and disable GameObject (canvas) using this code:

public int canvaslevel = 1;
public GameObject one;
public GameObject two;
public GameObject three;

void Update(){
    if(canvaslevel=1){
        one.SetActive(true);
        two.SetActive(false);
        three.SetActive(false);
    }
    if(canvaslevel=2){
        one.SetActive(false);
        two.SetActive(true);
        three.SetActive(false);
    }
    if(canvaslevel=3){
        one.SetActive(false);
        two.SetActive(false);
        three.SetActive(true);
    }
}

but it doesn't work!!!

error:

  Cannot implicitly convert type int' tobool'

sentences: Liang-Barsky Line Clipping Algorithm Is it possible to generalize Liang-Barsky Line Clipping Algorithm for n-dimensional space ?

sentences:
How to generate Spritefonts for monogame I just want to render some text to the screen using:

monogame 3.0
MS Visual Studio 2010 C# Express

In XNA, you were able to add fonts to the content pipeline quite easily. But this doesn't seem to be the case in monogame. Loading TTF Files using Content<SpriteFont>.Load() doesn't work. Is there any way to generate or download *.spritefont files or *.xnb files containing the font data (without resorting to install XNA)?

sentences:
Writing a basic shader for large input files I started writing a shader for my iOS app and instead of starting from scratch i used this tutorial here:
http://www.raywenderlich.com/3664/opengl-es-2-0-for-iphone-tutorial

I wrote an import function, first to import wavefront .obj models. My problem is that with I can't handle larger inputs (with a simple cube it was working). I realized that the indices array is an array of GLubyte values, which is unsigned char, so as a result i cant have more than 256 indexes. I modified it to GLuint, but then only get a blank screen.

What else needs to me modified?

p.s.: the source can be downloaded from here: http://d1xzuxjlafny7l.cloudfront.net/downloads/HelloOpenGL.zip

sentences:
LWJGL/Java - Implementing a writeable text box? I would like to create a writeable text box where a user can input text into it. A nice "send" button that the person could click to send the text to the server would also be nice.

I currently haven no idea how to do this and I do not see any tutorials on how to do this.

I am using LWJGL and Java, and also I am using the Slick2D library.

Thanks!

sentences:
Unity Editor: Get Mouse coordinates on left click on Scene Editor I need a simple script which does the following:

When I left-click somewhere in the Editor-Scene:

(doesnt matter if there is an object under the cursor- or not)

Do NOT deselect the current selection in the Inspector.
Do not select the object under the cursor.
and

Just print the mouse X and Z interception with the Y-Plane in the Debug.Log();

i stumbled on many solutions but somehow i couldnt get this to work.

i tried:

HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));

and

Tools.current = Tool.None;

both seem to do nothing ..... X.x

EDIT:

Happens that
"HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive));"
needs to be inside:
public void OnSceneGUI()
and called every frame - to "block" the mouse clicks on the editor.
i thought it toggles it off.

still the problem of the mouse coordinates persists.

sentences:
AABB SAT code detects collision wrongly I've been having trouble getting my SAT code working using AABBs, and I've been trying to find a solution but, I'm scratching my head.

For some reason, it detects collisions very wrongly, as shown by this desk check I did.
(AABBvsAABB method at bottom.)

Consider two AABB, A and B.

A = X: 0, Y: 0, W: 102, H: 19

B = X = 87, Y: 6, W: 1, H: 1

These are colliding.

First, calculate normal

Normal = (0,0) - (87,6) = (-87,-6)

Next, we get half widths

aExtent = 102/2 = 51
bExtent = 1/2 = .5

Now lets calculate the overlap of the two.

 xExtent = 51 + .5 - |-87| = 51.5 - 87 =  -35.5

xExtent is less than zero so it says its not colliding, obviously this is wrong.

   /// <summary>
   /// Compares bounding boxes using Seperating Axis Thereom.
   /// </summary>
   public static bool AABBvsAABB(AABB a, AABB b, ref Manifold manifold)
   {
        manifold.Normal = a.Position - b.Position;

        //Calculate half widths
        float aExtent = a.Width / 2f;
        float bExtent = b.Width / 2f;

        //Calculate the overlap.
        float xExtent = aExtent + bExtent - Math.Abs(manifold.Normal.X);

        //If the overlap is greater than 0
        if (xExtent > 0)
        {
            //Calculate half widths
            aExtent = a.Height / 2f;
            bExtent = b.Height / 2f;

            //Calculate overlap
            float yExtent = aExtent + bExtent - Math.Abs(manifold.Normal.Y);

            if (yExtent > 0)
            {
                //Variable to multiply the normal by to make the collision resolve
                Vector2 faceNormal;

                //Check to see which axis has the biggest "penetration" ;D

                //Collision is happening on Y axis
                if (xExtent > yExtent)
                {
                    faceNormal = manifold.Normal.X < 0 ? -Vector2.UnitX : Vector2.UnitX;
                    manifold.PenetrationDepth = xExtent;
                    manifold.Normal = Physics.GetNormal(a.Position, b.Position);
                    manifold.Normal.X *= faceNormal.X;
                }
                //Collision happening on X axis
                else
                {
                    faceNormal = manifold.Normal.Y < 0 ? -Vector2.UnitY : Vector2.UnitY;

                    manifold.PenetrationDepth = yExtent;
                    manifold.Normal = Physics.GetNormal(a.Position, b.Position);
                    manifold.Normal.Y *= faceNormal.Y;
                }
                manifold.AreColliding = true;
            }
        }
        return manifold.AreColliding;
    }

Any idea what I am doing wrong here?

sentences:
How do I convert matrices intended for OpenGL to be compatible for DirectX? I have finished working through the book "Game Physics Engine Development 2nd Ed" by Millington, and have got it working, but I want to adapt it to work with DirectX.

I understand that D3D9+ has the option to use either left handed, or right handed convention, but I am unsure about how to return my matrices to be usable by D3D. The source code gives returning OpenGL column major matrices (the transpose of the working transform matrix shown below), but DirectX is row major.

For those unfamiliar for the organization of the matrices used in the book:

[r11 r12 r13 t1]
[r21 r22 r23 t2]
[r31 r32 r33 t3]
[ 0   0   0   1]

r## meaning the value of that element in the rotation matrix, and t# meaning the translation value.

So the question in short is: How do I convert the matrix above to be easily usable by D3D?  All of the documentation that I have found simply states that D3D is row major, but not where to put what elements so that it is usable by D3D in terms of rotation, and translation elements.

sentences:
Java - simultaneous ground and wall collision I've been working on a Line2D based collision system:

public void update() {
    for (int i = 0; i < lines.size(); i++) {
        line = lines.get(i);
        if (line.line.intersects(player.hitbox))
            playerCollision();
    }
}

public void playerCollision() {
    if (Math.abs(line.angle) <= 45) {
        player.jumped = false;

        if (player.speedY > 0)
            player.speedY = 0;

        // inefficient?
        while (line.line.intersects(player.hitbox)) {
            player.centerY--;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }

        player.centerY++;
        player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2, player.WIDTH,
                player.HEIGHT);

    } else if (line.angle > 0) {
        while (line.line.intersects(player.hitbox)) {
            player.centerX--;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }

    } else if (line.angle < 0) {
        while (line.line.intersects(player.hitbox)) {
            player.centerX++;
            player.hitbox.setRect(player.centerX - player.WIDTH / 2, player.centerY - player.HEIGHT / 2,
                    player.WIDTH, player.HEIGHT);
        }
    }
}

Overall, it works pretty well. There is, however, one problem I haven't been able to fix. When the player collides on a place where a wall and the ground meet, both the ground and wall collisions are executed, however, only one should be.

The result is that the player is abruptly pushed off a cliff when approaching one, or that the player is abruptly moved up when jumping alongside a cliff.

When approaching a cliff:

After one step to the right:

I've been able to come up with a method to determine which collision should be executed:

if (player.hitbox.getMaxY() - player.speedY > line.line.getY1())
    // execute wall collision only
if (player.hitbox.getMaxY() - player.speedY <= line.line.getY1())
    // execute ground collision only

However, I haven't been able to come up with how to implement this. I can't check all lines for collision first and execute the collision later, as the collision is executed per line. Does anyone know how I can fix my collision system?

P.S. I'm a beginning game developer, so my collision detection system might be bad or inefficient. If there's a better way to do this, that doesn't have the same problems, I'd love to hear about it. Please keep in mind, though, that I'm trying to keep the code simple and efficient.

sentences:
I'm having trouble with collision detection in XNA I've written a tile editor and game in XNA, with velocities and gravity, and am having trouble with some of my collision detection things. It works okay, but seems to glitch between just inside and outside the tile the player is on. Here's my collision detection function and the other functions it uses:

void SolveCollisions(List<Tile> tiles, Vector2 screensize)
    {
        if (position.X < 0)
        {
            position.X = 0;
        }
        if (position.X + 32 > screensize.X)
        {
            position.X = screensize.X - 32;
        }
        if (position.Y < 0)
        {
            position.Y = 0;
        }
        if (position.Y + 32 > screensize.Y)
        {
            position.Y = screensize.Y - 32;
        }

        foreach (Tile t in tiles)
        {
            if (absTilePos(position.X) == absTilePos(t.position.X))
            {
                if (intersect(position.Y, t.position.Y, 32, 32))
                {
                    if (position.Y > 0)
                    {
                        velocity.Y = 0;
                        position.Y = tilePos(position.Y);
                    }

                    if (position.Y < 0)
                    {
                        velocity.Y = 0;
                        position.Y = tilePos(position.Y) + 32;
                    }
                }
            }

            if (absTilePos(position.Y) == absTilePos(t.position.Y))
            {
                if (intersect(position.X, t.position.X, 32, 32))
                {
                    if (position.X > 0)
                    {
                        velocity.X = 0;
                        position.X = tilePos(position.X);
                    }
                    if (position.X < 0)
                    {
                        velocity.X = 0;
                        position.X = tilePos(position.X) + 32;
                    }
                }
            }
        }
    }

    bool intersect(float p1, float p2, float s1, float s2)
    {
        if (p1 < p2 && p1 + s1 > p2)
        {
            return true;
        }
        if (p2 < p1 && p2 + s2 > p1)
        {
            return true;
        }

        return false;
    }

    float tilePos(float f)
    {
        int i = (int)f;
        i /= 32;
        i *= 32;
        return (float)i;
    }

    float absTilePos(float f)
    {
        int i = (int)f;
        i /= 32;
        return (float)i;
    }

The player also glitches into blocks on it's top and right ( http://puu.sh/2cVQf ) when it hits them instead of bouncing off them - it just goes straight into them.

Does anyone know how to remedy this? Thanks!

sentences: Versions of GL and its device that don't display or required powers of 2 for the sprites From this question aside from identifying possibilities of displaying images that don't needed to require powers of 2, what are the versions of GL that can actually display images even if don't needed the power of 2 size?

sentences:
Unity using "as" vs "GetComponent()" Hello im new to unity and im learning raycast right now , after checking the documentation here https://docs.unity3d.com/ScriptReference/RaycastHit-triangleIndex.html , i got something that's confusing me , what is the difference between :

 MeshCollider themeshhit = thehit.collider as MeshCollider;
 //
 if (themeshhit == null) {
 Debug.Log (" | themeshhit == null ! | ");
 }
 //

and :

 MeshCollider themeshhittwo =  thehit.collider.gameObject.GetComponent<MeshCollider> ();
 //
 if (themeshhittwo == null) {
 Debug.Log (" | themeshhittwo == null ! | ");
 }
 //

Both method is working correctly , but i want to know what is the difference between them , and i also want to know which one is better if comparing against speed , compatibility , and ability .

Edit : variable thehit is look similar to this

 RaycastHit thehit;

sentences:
How to make custom shaped holes in terrain So I'm trying to create a game where you fit certain shaped objects into the hole that fits them (similar to the young children's game with different shaped blocks) in Unity 3D.

I've encountered a problem, how do I make the holes in the terrain? Or what type of object should I use for making holes in?

So far I've tried to make a 3d model in unity by using other cubes and planes, it just doesn't feel right.
I guess I need to create a model in another software and import to unity, I don't know any other software I can use. Tips would help.

sentences:
Most common format & good practice for 3D models for a placeholder in a PC game I'm soon starting programming my first 3D game in OpenGL, C++, for PC. It's going to be a top-down space-based game.

Early on I want to create basic placeholder 3D models for my objects, and then in later stages (if I prove able to write C++ game mechanics successfully...) I'll collaborate with / employ a 3D model artist for the full textured models.

What's the best format to create these placeholders in for optimum integration later on?

Any particular advice for how to program it from the start to make it easier to work with the artist later on?

sentences:
How can I resolve collisions at different speeds, depending on the direction? I have, for all intents and purposes, a Triangle class that objects in my scene can collide with (In actuality, the right side of a parallelogram).

My collision detection and resolution code works fine for the purposes of preventing a gameobject from entering into the space of the Triangle, instead directing the movement along the edge.

The trouble is, the maximum speed along the x and y axis is not equivalent in my game, and moving along the Y axis (up or down) should take twice as long as an equivalent distance along the X axis (left or right).

Unfortunately, these speeds apply to the collision resolution too, and movement along the blue path above progresses twice as fast. What can I do in my collision resolution to make sure that the speedlimit for Y axis movement is obeyed in the latter case?

Collision Resolution for this case below (vecInput and velocity are the position and velocity vectors of the game object):

// y = mx+c
// solve for y. M = 2, x = input's x coord, c = rightYIntercept
lowY =  2*vecInput.x + parag.rightYIntercept ;

...

else
{
    // y = mx+c
    // vecInput.y = 2(x) + RightYIntercept
    // (vecInput.y - RightYIntercept) / 2 = x;

    //if velocity.Y (positive) greater than velocity.X (negative)
    //pushing from bottom, so push right.
    if(velocity.y > -1*velocity.x)
    {
            //change the input vector's x position to match the
            //y position on the shape's edge. Formula for line: Y = MX+C
            // M is 2, C is rightYIntercept, y is the input y, solve for X.
        vecInput = new Vector2((vecInput.y - parag.rightYIntercept)/2, vecInput.y);
        Debug.Log("adjusted rightwards");
    }
    else
    {
        vecInput = new Vector2( vecInput.x, lowY);
            Debug.Log("adjusted downwards");
    }
}

sentences:
How to become a Game Artist? If I understand correctly, there are two major kinds of artists involved in game development - 2D and 3D.

I think I somewhat understand, that if I want to go 3D, I should learn some 3D modeling package really well and that would be it. Please correct me if I am wrong.

With 2D I am completely lost. There are a lot of tutorials on the web describing so many different topics like general drawing, vector graphics, raster graphics, pixel art and a whole lot of other things.

So what tools and techniques are most commonly used by professional 2D artists and if I wanted to become one, exactly were should I start(like tomorrow) and what should my goals be?

sentences:
Downscaling texture via mipmap Copied from Computer Graphics SE.

I am implementing a post-processing effect in my DirectX 11 pet renderer. The post-processing pass is implemented by rendering a full-screen quad covered with texture containing original rendered image, which works as it should, but I have problems with downscaling the texture.

The non-processed testing scene looks like this (three very bright emmissive spheres):

I see no problem at this stage, but when I run the first post-processing pass, which just down-scales the image by the factor of 8 using the texture sampler, the result is very flickery (up-scaled for clarity):

I expected a mipmap would solve or at least reduce the flickering, but it didn't change a thing. What am I doing wrong?

RenderDoc Update

After investigating the issue using RenderDoc I found that the mipmap is being generated successfully and it's third level looks like this:

However, the output of the down-scaling pass looks like this:

As if the sampler didn't use the mipmap at all. Don't get distracted by coloured object instead almost white ones. I lowered the sphere brightness a bit while investigating the bug.

Even if I choose the mipmap level explicitly

float4 vColor = s0.SampleLevel(LinearSampler, Input.Tex, 3);

it changes nothing :-/

RenderDoc also says "LOD Clamp 0-0" for the used sampler. What is it? Couldn't this be the problem?

DirectX details

Samplers

D3D11_SAMPLER_DESC descSampler;
ZeroMemory(&descSampler, sizeof(descSampler));
descSampler.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
descSampler.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
descSampler.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;

descSampler.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
mDevice->CreateSamplerState(&descSampler, &mSamplerStateLinear);

descSampler.Filter = D3D11_FILTER_MIN_MAG_MIP_POINT;
hr = mDevice->CreateSamplerState(&descSampler, &mSamplerStatePoint);

...are set right before rendering the screen quad

ID3D11SamplerState* aSamplers[] = { mSamplerStatePoint, mSamplerStateLinear };
mImmediateContext->PSSetSamplers(0, 2, aSamplers);

...and used within the down-scaling PS shader

SamplerState PointSampler  : register (s0);
SamplerState LinearSampler : register (s1);

Texture2D s0 : register(t0);

float4 Pass1PS(QUAD_VS_OUTPUT Input) : SV_TARGET
{
    return s0.Sample(LinearSampler, Input.Tex);
}

Texture

D3D11_TEXTURE2D_DESC descTex;
ZeroMemory(&descTex, sizeof(D3D11_TEXTURE2D_DESC));
descTex.ArraySize = 1;
descTex.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
descTex.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
descTex.Usage = D3D11_USAGE_DEFAULT;
descTex.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
descTex.Width  = width;
descTex.Height = height;
descTex.MipLevels = 0;
descTex.SampleDesc.Count = 1;
device->CreateTexture2D(&descTex, nullptr, &tex);

...it's render target view

D3D11_RENDER_TARGET_VIEW_DESC descRTV;
descRTV.Format = descTex.Format;
descRTV.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
descRTV.Texture2D.MipSlice = 0;
device->CreateRenderTargetView(tex, &descRTV, &rtv);

...it's shader resource view

D3D11_SHADER_RESOURCE_VIEW_DESC descSRV;
ZeroMemory(&descSRV, sizeof(D3D11_SHADER_RESOURCE_VIEW_DESC));
descSRV.Format = descTex.Format;
descSRV.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
descSRV.Texture2D.MipLevels = (UINT)-1;
descSRV.Texture2D.MostDetailedMip = 0;
device->CreateShaderResourceView(tex, &descSRV, &srv);

Explicit generation of mipmap is called after the scene was rendered into the texture and another texture was set as a render target.

ID3D11RenderTargetView* aRTViews[1] = { mPass1Buff.GetRTV() };
mImmediateContext->OMSetRenderTargets(1, aRTViews, nullptr);

mImmediateContext->GenerateMips(mPass0Buff.GetSRV());

ID3D11ShaderResourceView* aSRViews[1] = { mPass0Buff.GetSRV() };
mImmediateContext->PSSetShaderResources(0, 1, aSRViews);

The code is compiled in debug and the D3D device was created with D3D11_CREATE_DEVICE_DEBUG flag and I get no runtime errors on the console.

sentences:
Drawing a grid over a terrain using a mesh - Shader Depth and Z-Buffer What I'm trying to achieve is rendering a (huge) tile grid over a terrain. For that I'm using a generated mesh of quads, one for every tile, whose vertices Y value is the same of the terrain to "shape" this mesh like the terrain.

My problem is that this mesh should be rendered always over the terrain, keeping every other object rendered on top of this grid. As you should guess I'm a beginner in shader programming. So here are some caps:

Rendering the mesh with simple unlit transparent shader (with ZTest, ZWrite and Cull values):

As you can see there are problems with the z-fighting, when the grid should always be drawn on top. Rising the terrain won't solve it, since the terrain have lots of "peaks" and the quads should be planes with lots of vertex to be able to follow the terrain (or rising a lot the grid which will cause it to float over the terrain).

Changing the ZTest to Always:

Here I've the problem that the tiles behind the mountains are still drawn when they shouldn't, which make sense since it's ignoring z-ordering, and therefore rendering over other objects too.

I've tried using a another shader pass to first write to the z buffer to avoid rendering the tiles behind the mountains with no success. I guess I'm missing something related to the terrain shader, but I have no clue what it may be.

Any help will be much appreciated.

sentences:
SerializationException: Type UnityEngine.MonoBehaviour in assembly UnityEngine,l is not marked as serializable I am trying to save/persist some data between my scenes but I keep getting the error:

SerializationException: Type UnityEngine.MonoBehaviour in assembly UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as serializable.

Here is my script:

public static void SaveState()
    {

        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/EmpireGame", FileMode.OpenOrCreate);

        SaveClass sc = new SaveClass()
        {
            food = Player.food.amount,
            wood = Player.wood.amount,
            iron = Player.iron.amount,
            stone = Player.stone.amount,
            buildingList = new List<Building>(),

    };
        sc.buildingList = playerBuilt;

        Debug.Log("State Saved!");

        bf.Serialize(file, sc);
        file.Close();
    }
}

[Serializable]
class SaveClass
    {
        public int food, wood, iron, stone;
    public List<Building> buildingList;

}

I've narrowed it down to: public List buildingList; being the offending code, but I don't know how else to save this list. I think the MonoBehaviour part of it is the "" as it inherits from MonoBehaviour.

I've read:

Unity Docs: Serialization

Watched:

persistence-saving-and-loading-data

Saving Data In Unity

I've looked up so many Q&A's over this but still can't figure it out.

sentences:
Best practices in managing character states While in development of a character, I feel like I'm digging myself deeper into a hole every time I add more functionality to him, creating more bugs and it seems like my code is tripping over itself all over the place.

What are the best practices when managing character states for a character that has a large selection of abilities and actions that they can perform, without their abilities interrupting each other and creating a mess overall?

sentences:
Using Ogre particle point billboards with shaders I'm learning about using Ogre particles and had some questions about how the point type particles work.

Q. I believe point type particles are implemented as a single position. Is one single vertex is passed to the vertex shader?

Q. If one vertex is passed to the vertex shader then what gets sent to the fragment shader?

Q. Can I pass the particle size to the shader? Perhaps with a custom parameter?

sentences: Unity 2D animation running partially I have a 2D skeleton animation of human walk cycle - which is fine. I am trying hard to code that should STOP only hands animation but legs should not (on a player input - for example on space bar press) Is it possible to disable animation keyframes/curves/properties on some condition Or any other way to achieve this.

sentences: TRS Matrix between 2 points I have got 2 Points in 3D Space whose TRS Matrix' from 0.0 to there current place is known. Now I want to change the Matrix of the left point so that the matrix of the right point combined with the new Matrix results in the point being at the same position as before. Here a short illustration that I hope helps a little. Sorry for the bad explanation

sentences:
Prefab not working when I import maps form Tiled using Tiled2Unity I have correctly created the map using Tiled with no errors or warnings, then i imported the package from tiled2unity, imported the map then waited few seconds and the prefab from tiled2unity appears only after some minutes but not working.
the tiled to unity package imported

The error
the map

Basically i dont see the tiled map in unity after it's imported.

sentences:
Unreal Engine 4 AI Character Pawn Entirely Unresponsive to Movement Commands I'm new to game development and to Unreal but I cannot for the life of me get my AI character pawn to move at all using any method I know.
I'm developing a 2d Sidescroller game using a Tilemap. I have made sure collision is set up with the map and tiles, the player character can interact with it all just fine, and I made sure to widen the collision thickness of the map so that the navmesh can properly appear (as seen with the green areas).
Nav Mesh loading. AI spawns in the air and falls down so I know he isn't overlapping with the ground

I've disabled and enabled collision for the static mesh cube component in the character pawn, but he still doesn't move.
The goal is to get him to follow the player when he sees him. The pawnsensing trigger works just fine, as I had it print whenever he sees him, and he even properly gets to the point of executing the "follow player" function (the print statement works).
However, using AIMoveTo fails every time. I've tried putting the player as the target, the player's worldLocation as a vector, and even an arbitrary point vector to the right of the AI but AIMoveTo fails every time.
I've deleted and replaced the NavMesh, and I've even tried completely skipping using AIMoveTo and just using Add Movement Input in both the AI Thinking Blueprint and Character Pawn Blueprint but neither make it move. I literally put an Add Movement Input function on the Pawn's event tick but it never moves.
Any suggestions?
Code:
AI Logic event is triggered every tick

Character Pawn Tick (for debugging). Does not cause the Pawn to move

sentences:
How to apply a script to multiple Objects in Unity? In Unity, I've almost 200 or more objects. I wish to apply single script to all those objects.

I'm a beginner & learning scripts in Unity.

Edit: At the time of editing the scene itself.

sentences:
Clipping wrong results in C++ DIRECTX 11 Im trying to do some clipping but having some weird results. The triangle is not getting clipped how it should be. Here are some images.
The second image is how it should.

video of what is happen VIDEO OF WHAT IS HAPPENING

What is wrong with my code that is making the triangle wrong way.

CLIPPING ALGORITHM

ClipVertex( const Vector3& end )
{
    float BCend = mPlane.Test(end);
    bool endInside = ( BCend >= 0.0f );

    if (!mFirstVertex)
    {
        // if one of the points is inside
        if ( mStartInside || endInside )
        {
            // if the start is inside, just output it
            if (mStartInside)
                mClipVertices[mNumVertices++] = mStart;

            // if one of them is outside, output clip point
            if ( !(mStartInside && endInside) )
            {
                float t;
                Vector3 output;
                if (endInside)
                {
                    t = BCend/(BCend - mBCStart);
                    output =  end - t*(end - mStart);
                }
                else
                {
                    t = mBCStart/(mBCStart - BCend);
                    output = mStart + t*(end - mStart);
                }
                mClipVertices[mNumVertices++] = output;
            }
        }
    }
    mStart = end;
    mBCStart = BCend;
    mStartInside = endInside;
    mFirstVertex = false;

}

PLANE EQUATION

Plane clipPlane( 1.0f, 0.0f, 0.0f, 0.0f );

In directx 11 in a Left Handed system

sentences: Ignore specific key press in textbox there is a text box on GUI in my application created using Unity3D. in the textbox user can input only the keys of "A-Z", "0-9" , "enter key" , "." and "," other key press should be ignored (not should print in textbox when typing). how to do this in Unity3D C#

sentences:
Building TMX in the MonoGame Pipeline using MonoGame Extended I updated MonoGame to the latest development build and noticed the Tiled Map Importer and Processor wasn't in the content pipeline anymore (even after adding both MonoGame Extended Content DLL and MonoGame Extended Tiled Content DLL).

Am I supposed to build TMX maps into .xnb files using the MonoGame XML Importer and No Processing or am I doing something wrong?

sentences:
Underlying skills and knowledge I am trying to expand my knowledge on gaming and programming and I was wondering what underlying skills people think they one should learn to be a great programmer, or developer. What are some important patterns or practices that you use frequently?

Thanks.

sentences:
Bullet holes on curved surfaces and corners So right now I am making an FPS game where the gun creates bullet holes (plane with texture) on impact, but there is a problem with that, if I shoot at the edge the plane will stick out and also bullet holes will not look proper when I shoot at a curved surface. I know there's at least 2 ways one is shaders and another mesh manipulation, but I could not find any tutorials on how to do it and never understood neither of them. Is anyone able to explain in detail exactly how I would achieve the effect?
Thanks in advance.

sentences:
How to reproduce the 3ds Max Gradient Ramp effect? The material definition of a mesh is composed of these three components: Self-Illumunation, Refletcion and Refraction. Each of these components has a Gradient Ramp as a map and the mapping mode is set to spherical environment.
I'm searching for a way to reproduce these effects in a shader (the shader language doesn't matter). Is it possible?

My first idea was to save the Gradient Ramp as a texture: you can see the result in the image below (reflection component):

and using them in the shader through environment spherical mapping, but the result is wrong.

In this image you can see the original rendering (3ds Max, reflection component):

and in this image you can see my rendering:

The underlying idea seems to be correct, in fact there's a correlation between the two images but something goes wrong.

Thanks for any suggestion.

sentences:
Effective methods to continuously update movement in a tower defense game? We are four guys making a Tower Defense game as a project in first grade on a university. The game is going to be really simple!

Three different towers
Three different monsters
One map (maybe add some more if we have time)

The game has to be object oriented.

The class structure is as following

Game - Drawing of graphic, etc.
Level - Every level is an object of this class. Each level has a finite number of wave-objects (in a list)
Wave - Contains a list of monster-objects.
Monster - This is a superclass. We make subclasses for the different type of monsters
Tower - Superclass to the towers. There are subclasses for each type of tower.

We are thinking about how to solve the problem that many objects have to do stuff, at the same time, e.g. move one pixel in one direction.

What we came up with is the idea of implementing av class Timer, to control when objects do things. I am not sure this is the best way to do it. Could someone give some good ideas about how to solve the continious update case?

sentences:
c++ most used libraries I'm trying to find out whether or not I want to switch from Java to c++ for my OpenGL game programming. I now have setup a test project in VS 11 professional, with GLUT. I created my windows with GLUT, and I can render OpenGL primitives without any problems.

Now my question: What library(s) is/are used mostly in the indie/semi professional industry for using OpenGL in c++?

With 'using OpenGL' I mean:

Creating and managing an OpenGL window
Actually using the OpenGL API
Handling user-input (keyboard/mouse)

sentences:
Libgdx Actions interpolation Fadeout In libGDX there is a simple fade Interpolation that speeds up towards the end of the action animation. But what I am looking for is the reversed of it, it needs to start fast and slow down near the end. Is there a Interpolation function for that or how can I create this effect myself?

Currently i'm directly just initiating the action from the actor.

actor.addAction(Actions.moveTo(currentTouch.x - actor.getWidth() / 2,
 currentTouch.y - actor.getHeight() / 2,
 .2f,
 Interpolation.fade));

sentences:
How do I determine the forward/right direction when I have the "up" vector? - Unity I am trying to fix a gameobject for e.g. a cube (which i am using as a sensor) on my character. I need the cube to rotate (with orientation control from the inspector - I have a public quaternion rotation variable set). I have identified 3 vertices using ray cast to fix my sensor onto the character. I already have determined the normal of these vertices which will be the "up" direction of the cube. I am wondering how I can determine the forward/right vector to use in the LookRotation() function. I need to basically be able to rotate the cube ON the character even as the character moves on animation. This is my code, and as of now there is no rotation happening. I'm sure I am missing something and would really appreciate help. I really hope this is enough explanation.

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class orientation : MonoBehaviour
{
    // importing from Vertex Finder Script to use InterpolatedNormalInWorldSpace value

private VertexFinder script;
public Transform target;

// to edit orientation of sensor in Unity Inspector
public Quaternion rotation_edit;

// Start is called before the first frame update
void Start()
{
    script = GetComponent<VertexFinder>();
}

Quaternion TurretLookRotation(Vector3 approximateForward, Vector3 exactUp)
{
Quaternion rotateZToUp = Quaternion.LookRotation(exactUp, -approximateForward);
Quaternion rotateYToZ = Quaternion.Euler(90f, 0f, 0f);

return rotateZToUp * rotateYToZ;
}

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

    // aligning axes of sensor to z axis and y axis respectively
    Quaternion rotation1 = TurretLookRotation(relativePos, script.interpolatedNormalInWorldSpace);

    // setting rotation of sensor to values entered in Inspector with respect to the above aligned axes
    transform.rotation = rotation1 * rotation_edit;

}

}

sentences:
How to create a MessageBox in OpenGL using C++ I have a game that needs results displayed upon exit with a messagebox. I have the following code that works but I need to add an integer variable to the text.
This works:

MessageBox(NULL, L"Description\nline2", L"Info", MB_OK | MB_ICONEXCLAMATION);

But I need to say: "Description:" + num

I tried to pass a string but it won't compile:
MessageBox(NULL, L(string), L"Info", MB_OK | MB_ICONEXCLAMATION);

sentences:
How to create HDR and bloom in Unity3D? Unity3D's reference describes the HDR Bloom as:

  Using HDR allows for much more control in post processing. LDR bloom
  has an unfortunate side effect of blurring many areas of a scene even
  if their pixel intensity is less than 1.0. By using HDR it is possible
  to only bloom areas where the intensity is greater than one.

My question is how to achieve it in a surface shader? I have tried to output both the Albedo and Emission greater than 1, but still when I set the Threshold of Bloom equal to or greater than 1, no visible effect can be seen.

The relevant part of shader snippet is:

float rim = saturate(dot(normalize(IN.viewDir), o.Normal));
if (rim >= 0.98) {
    o.Emission = 1.5; // or any large value
}

Which basically outputs a bright white circle when view angle and normal are at almost same angle, and I want to enhance it with HDR. But outputting a value greater than 1 is not being registered and setting the threshold almost equal to 1 (0.98 or above) creates the Bloom on areas other than the bright white spot, which is not what is needed. I have tried to output extremely large values of Emission and have also tried output Albedo > 1.

Please tell what I am doing wrong or missing. I think I have not been able to figure out what is the meaning of pixel intensity > 1 and what settings does this translate to.

sentences:
Video playback on mobile: can't seek to the end My Unity3D game needs to play videos on mobile devices (using Handheld.PlayFullscreenMovie()). Seeking works badly. If I tap the video progress bar near the end (expecting it to play the last second then finish), playback jumps back a full 10-20 seconds, depending on the video. What should I try to make it easier for the player to seek within the file? Force additional key frames?

I'm currently encoding with HandbrakeCLI and the following settings:

--preset="AppleTV" --x264-tune=animation --x264-preset=veryslow

sentences:
implementing daily challenges in games I want to know how can I define daily monthly challenges in my game? Is this something can be defined locally or its need server and external services? And which servers and technologies can implements that? Is persistent connection or … needed as server should send messages to clients with no request?

Specifically, I use unity.

sentences:
Is it possible to procedurally place objects in a non-gridded game? I'd like to implement procedural world generation, but I don't want it to look gridded or blocky, where everything is obviously placed on an integer grid.

I know that you can do this in gridded worlds by inputting a square's x and y into a noise function, or similar, but is it possible to generate a more natural looking object placement using procedural methods?

This is in the context of an adventure game, if it matters.

Edit: I guess I should have been a bit more clear in my original question, but I'm mostly wondering about the actual placement of objects in game, e.g. trees, buildings.

Edit 2: I feel silly now. I typed up this question too quickly, and I didn't realize I was asking a yes or no question. I've reposted my actual question which asks, more specifically, how this can be done. Sorry!

sentences:
Engine for 2.5D Voxel Based City Simulation We're looking into making a game where you're part of a city and you're interacting with its economy and people. The world should be an open and procedurally generated sandbox to enable players to the most freedom they can get.

The question we're unable to answer is whether to use a game engine and if yes, which one. We don't have any experience with engines as we're from a web development background.

The style is planned to be similar to Kingdoms and Castles:

low poly
voxel based
more or less 2.5D as in you're looking down on the world

We have been thinking about Unity and Unreal and are wondering whether those engines are "overkill" or whether they are able to compile down to a result where the unnecessary parts aren't in the game anymore. Also we've been thinking about a HTML5 / JavaScript basis. Obviously, it has immense platform benefits, but we're not sure whether performance would be adequate.

tl;dr to not get this lost in discussion: What are the benefits and drawbacks of

the usual 3D game engines like unity and unreal
a web based approach
a completely new engine (would the extra effort be justifiable?)

Thanks for any advice

sentences:
BoxCollider2D Not Working So I'm making a copy of noobtuts tutorial on Snake
I've done all their steps and am at the point of extending the game solo, however I have an issue with the basic set-up. My box colliders aren't working at all!
I have four borders each with a Box Collider 2D, nothing fancy about them, and a Snakehead with a Box Collider 2D, nothing fancy about that either. Only the food prefab I have uses the IsTrigger. The Snake head also has a Rigidbody 2D and I've experimented with putting a Rigidbody2D on the borders too but it's not solved my problem.
Basically when I have the Snakehead moves to the border, it just passes through the border! It doesn't stop, it doesn't do anything, just continues straight through the border.
I've a basic gif showing off what I mean:

The only different thing about the box colliders is that for the snake they're 0.7 in size, not 1. But even when put to 1, they don't work properly.
Why isn't it stopping the snake from moving? I've never had to tell an object that when it hits another object to not move through it from what I can remember.

sentences:
2D Object 'Targeting' / 'Selecting' I'm currently working with C# with the XNA framework.

I'm trying to create a list of objects that are individually target-able after they are created and set in a list and displayed on a tile map.

For example, I have a blank tile map and I cycle through the tiles and randomly set objects (we'll say a box) throughout the map. When I set the box object, I add that new iteration of Box to a Box List.

At this point I have a tile map with a series of randomly placed boxes. Within these boxes I also have randomly picked values for their name, size, color etc. And these values are correctly stored within the box object in its respective index in the List.

My question is how do I go about setting up a method for targeting/selecting a box so that when I click on any given box it's respective data values appear? I'm not worried about graphical representation of the selected object but the retrieval of the objects specific data via a mouse click on its position.

I've set up Events to handle the changing of my game states, does this require the same methodology or something all together different?

Thanks for your time.

sentences:
Why is the light following my camera around? I have implemented a simple Phong shader without specular highlights for now (just ambient + diffuse components)

The problem however, is that the calculations seem to be done in camera space; as I move the camera around, the light source seems to move along with it. This is evident by me not being able to see the dark side of the models

(Note: Image is a gif, if it is not animating, open in a new tab)

My light is a point light, that I would like to have fixed somewhere in the world. It has a defined position. To my shader, I also pass in the M, V, P matrices, as well as the normal matrix, which is the inverse transpose of the MV matrix

cameraPosition=glm::vec3(8,8,8);
cameraTarget=glm::vec3(0,0,0);
cameraUp=glm::vec3(0,0,1);
glm::vec3 cameraDirection=glm::normalize(cameraPosition-cameraTarget);
cameraRight=glm::cross(cameraDirection, cameraUp);
view=glm::lookAt(cameraPosition, cameraTarget, cameraUp);
glm::mat4 model_view = view * modelMatrix;
glm::mat4 normal_matrix = glm::transpose(glm::inverse(model_view));

The following is my shader code

attribute vec3 vertex_position;
attribute vec3 vertex_colour_in;
attribute vec3 vertex_normal;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
uniform mat4 normal_matrix;
uniform vec3 ambient_light_colour_in;
uniform vec3 light_position_in;

varying vec4 fragment_colour;

void main(void){
  //position
  gl_Position = projection * view * model * vec4(vertex_position, 1.0);

  //ambient colour
  vec3 ambient_colour = ambient_light_colour_in * vertex_colour_in;

  //diffuse colour
  vec3 normal = normalize(vec3(normal_matrix * vec4(vertex_normal, 0.0)));
  vec4 pos4 = view * model * vec4(vertex_position, 1.0);
  vec4 lightPos4 = vec4(light_position_in, 1.0);
  vec3 lightDirection = normalize((lightPos4 - pos4).xyz);
  vec3 diffuse_colour = vertex_colour_in * max(0.0, dot(normal, lightDirection));

  fragment_colour.rgb = ambient_colour + diffuse_colour;
}

As far as I understand, the problem is that these lighting calculations are done in Camera space, and hence change when the camera changes position. So, my question is How would I change that to get the light to be at a fixed position, ie: do the light calculations in World space

sentences:
How to allow other games to communicate with my Lua scripts? I am planning some small games that will all rely on a single system of Lua scripts to manage some unified data about:

Some achievements that are common to each game.
The player's progress in completing the achievements.

Players would need to have these three parts on their system to play:

This small set of three unifying Lua scripts.
A single data file containing a list of challenges and the status of the player's progress in completing each.
At least one of the small games.

The three Lua scripts manage the player's progress data file:

One script tells the game which challenge the player needs to complete next.
Another script updates the data file with information about the player's progress.
A final script calculates statistical information about the player's progress. A game can check use this script and decide which of this information it will show to the players.

So far, I am having the games execute the Lua scripts and using stdout to communicate information between the games and Lua scripts placed in a bin directory, which seems to work well on Linux, but I need a solution that works equally on Windows, OS X, and mobile devices and that will not be a challenge for players to install. Is this a more preferred method?

Other developers using different programming languages should be able to easily connect their games to this system.
Everything is stored locally, nothing uses the Internet.

sentences:
Switching bezierpath to follow SpriteKit swift I am trying to make it so that a SKShapeNode follows a UIBezierPath. Then when the screen is tapped it switches to another UIBezierPath to follow. I have this functionality working except that when the screen is tapped the shape node moves back to where it started. I want it so that when the screen is tapped the circle does not go back to where it starts. Here is my code.

override func didMoveToView(view: SKView) {
    //screenWidth and screenHeight
    screenWidth = view.bounds.width
    screenHeight = view.bounds.height

    // Set up the circle track
    let trackWidth = screenWidth/3

    let circleTrack = UIBezierPath(roundedRect: CGRectMake(screenWidth/2 - trackWidth/2, screenHeight/2  - trackWidth/2, trackWidth, trackWidth), cornerRadius: 100)
    let shapeTrack = SKShapeNode(path: circleTrack.CGPath, centered: true)
    shapeTrack.position = CGPointMake(screenWidth/2, screenHeight/2)
    shapeTrack.strokeColor = UIColor.whiteColor()
    self.addChild(shapeTrack)

    //Outside track
    outsideTrack = UIBezierPath(roundedRect: CGRectMake((screenWidth/2 - trackWidth/2) - trackWidth*0.08, (screenHeight/2  - trackWidth/2) - trackWidth*0.08, trackWidth + trackWidth*0.16, trackWidth + trackWidth*0.16), cornerRadius: 100)

    //Inside track
    insideTrack = UIBezierPath(roundedRect: CGRectMake((screenWidth/2 - trackWidth/2) + trackWidth*0.08, (screenHeight/2  - trackWidth/2) + trackWidth*0.08, trackWidth - trackWidth*0.16, trackWidth - trackWidth*0.16), cornerRadius: 100)

    //Set the default track
    track = outsideTrack

    // Create the ball
    circle = SKShapeNode(circleOfRadius: 15)
    //circle.position = CGPointMake(screenWidth/2, screenHeight/2)
    circle.fillColor = SKColor.whiteColor()
    self.addChild(circle)

    //Move the circle
    let followPath = SKAction.followPath(track.CGPath, asOffset: false, orientToPath: false, speed: 200.0)
    let repeatForever = SKAction.repeatActionForever(followPath)

    //Move the circle
    circle.runAction(repeatForever)
}

//Movement of circle
func movemementOfCircle(){
    if track == insideTrack{
        track = outsideTrack
    }else{
        track = insideTrack
    }

    //Actions
    circle.removeAllActions()
    //Move the circle
    let followPath = SKAction.followPath(track.CGPath, asOffset: false, orientToPath: false, speed: 200.0)
    let repeatForever = SKAction.repeatActionForever(followPath)

    //Move the circle
    circle.runAction(repeatForever)
}

sentences:
Simple pass-through geometry shader with normal and color I've written a very simple pass-through geometry shader. My input and output primitives are points. I also want to forward the color and normal from vertex shader to fragment shader through geometry shader. The shaders are compiled and linked flawlessly but the final color is very weird. I think there is something wrong with this forwarding. Can anyone point out the problem? Here are my shaders:

Vertex shader:

#version 330 compatibility

struct vData
{
    vec3 normal;
    vec4 color;
};

out vData vertex;

void main()
{
    vertex.normal = gl_NormalMatrix * gl_Normal;
    vertex.color = gl_Color;
    gl_Position = ftransform();
}

Geometry shader:

#version 330

layout (points) in;
layout (points) out;
layout (max_vertices = 1) out;

struct vData
{
    vec3 normal;
    vec4 color;
};

in vData vertices[];
out vData frag;

void main()
{
    int i;
    for(i = 0;i < gl_in.length();i++)
    {
        frag.normal = vertices[i].normal;
        frag.color = vertices[i].color;
        gl_Position = gl_in[i].gl_Position;
        EmitVertex();
    }
    EndPrimitive();
}

Fragment shader:

#version 330

struct vData
{
    vec3 normal;
    vec4 color;
};

in vData frag;

void main()
{
    gl_FragColor = frag.color;
}

sentences:
How much extra processing power is required for a 3D TV compatible game? Possible Duplicate:
  How much extra power is required for a stereoscopic 3D game?

How much extra processing power would be required to make a 3D TV compatible mode in a 3D game?

(Nothing specific, think any modern FPS)

Would it be negligible as you would split the framerate between the two 'eyes'?

sentences:
What is a "2.5D" environment? I don't understand the meaning of the term "2.5D." I'm specifically confused about the difference between 2.5D and 3D environments, even though I've read different definitions and articles about both. I understand the parts where 2.5D is like 3D but I don't get the parts where 2.5D is different.

So, what does it mean for a game to be 2.5D? For example, is the game shown here 2.5D?

sentences:
Rotating a parent rectangle to align child with target My beautiful drawings will explain better than many words (or at least I hope):

The structure:

The black rectangle is a GameObject (my weapon sprite).
A and B are also GameObjects (children of black rectangle): StartShotPoint and ShotPoint used for the direction of my projectile.
C is the first hypothetical target

In this situation my sprite will be rotate of 0 degree.

In this second image there is the question. I want to find the rotation of my sprite (-10 degree in the example) knowing the Vector2 destination D and of course all the coordinates of the 3 GameObjects.

The situation is simple as long as the player rotates the weapon, but in this case is the AI (after finding the player at the point D) must turn the weapon in the right direction. I know how to find the direction between one point and another, but between two decentralized points and a third one messed up my brain.

I really don't know which "direction" to take.

Thanks for your help.

sentences:
Supporting Multiple Input Devices I'm currently developing a PC game with the assistance of XNA and I'm integrating keyboard and gamepad control support. Up until now I've only supported gamepad control, and finding an elegant way to allow the player to choose one or the other is posing a complicated task to resolve.

I was thinking of creating a class that would sort of convert either input into a universal sort of data that the game could then use for the player's character and the rest of the game to interpret.

Then, I thought maybe it would be simpler to create a duplicate of my main character's class, except to accept keyboard input instead of the gamepad input.

Can anybody offer any insight?

sentences:
Loading non-skeletal animation to opengl via assimp I'm a newbie in assimp and openGL. I'm trying to import .fbx or .dae formatted file to openGL via assimp.
Importing skeletal animation was kind of easy. Lots of introductions and sample projects helped me to run several files properly.
But, in case of none skeletal animation(does it named 'vertex animation'?), which has no bone, I can't find any of source, instructions, including assimp tutorials.
Or, I'm not sure it is even possible, maybe assimp doesn't support this kind of animation.
Is there any recommendable project for non skeletal animation? Any single comment, will be helpful.
Thanks.

sentences:
When is the CheckResources() function called? This question is asked in the context of image effect shader implementations in Unity.

Looking through the scripts for image effects in the standard assets package, I notice that initialization is generally done in the CheckResource() function.

The following is a snippet of code from the BloomAndFlares image effect.

public override bool CheckResources()
{
    CheckSupport(false);

    screenBlend = CheckShaderAndCreateMaterial(screenBlendShader, screenBlend);
    lensFlareMaterial = CheckShaderAndCreateMaterial(lensFlareShader, lensFlareMaterial);
    vignetteMaterial = CheckShaderAndCreateMaterial(vignetteShader, vignetteMaterial);
    separableBlurMaterial = CheckShaderAndCreateMaterial(separableBlurShader, separableBlurMaterial);
    addBrightStuffBlendOneOneMaterial = CheckShaderAndCreateMaterial(addBrightStuffOneOneShader, addBrightStuffBlendOneOneMaterial);
    hollywoodFlaresMaterial = CheckShaderAndCreateMaterial(hollywoodFlaresShader, hollywoodFlaresMaterial);
    brightPassFilterMaterial = CheckShaderAndCreateMaterial(brightPassFilterShader, brightPassFilterMaterial);

    if (!isSupported)
        ReportAutoDisable();
    return isSupported;
}

I am probably wrong in assuming that this is essentially the Start() or Awake() functions for PoseEffectsBase, but I decided to try implementing something simillar.

public override bool CheckResources()
{
    saturationPassMat = CheckShaderAndCreateMaterial(saturationPassFilter, saturationPassMat);

    if (!isSupported)
        ReportAutoDisable();
    return isSupported;
}

Unlike the standard asset scripts, CheckResources() does not seem to be called consistently for me. Unity console throws UnassignedReferenceExceptions every frame, for the object saturationPassMat.

When is the CheckResources() function called? Should it be used for initialization just like Start()?

sentences:
Accessing vertex Input in surf directly without vert's out parameter In Tessellation Shader I can get the vertex Input in vertex shader as follows:

   o.worldPos = v.vertex.xyz;

But how do I get the worldPos directly without filling the out parameter in the vert function. Asking this because the shader is a DX11 Tessellation one and out parameter in vert function is not available at all.

basically I want Initialize my Input shader and pass It to surface shader In vertex shader.I can do It but It's different In Tessellation shader so I need to Accessing vertex position in surf directly without vert's out parameter.

Shader "Tessellation Sample" {
        Properties {
            _EdgeLength ("Edge length", Range(2,50)) = 15
            _MainTex ("Base (RGB)", 2D) = "white" {}
            _DispTex ("Disp Texture", 2D) = "gray" {}
            _NormalMap ("Normalmap", 2D) = "bump" {}
            _Displacement ("Displacement", Range(0, 1.0)) = 0.3
            _Color ("Color", color) = (1,1,1,0)
            _SpecColor ("Spec color", color) = (0.5,0.5,0.5,0.5)
        }
        SubShader {
            Tags { "RenderType"="Opaque" }
            LOD 300

            CGPROGRAM
            #pragma surface surf BlinnPhong addshadow fullforwardshadows vertex:disp tessellate:tessEdge nolightmap
            #pragma target 4.6
            #include "Tessellation.cginc"

            float _EdgeLength;

            float4 tessEdge (appdata_full v0, appdata_full v1, appdata_full v2)
            {
                return UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);
            }

            float _Displacement;

            struct Input {
                float4 position  : POSITION;
                float3 worldPos  : TEXCOORD2;   // Used to calculate the texture UVs and world view vector
                float4 proj0     : TEXCOORD3;   // Used for depth and reflection textures
                float4 proj1     : TEXCOORD4;   // Used for the refraction texture
            };

            void disp (inout appdata_full v, out Input o){
            UNITY_INITIALIZE_OUTPUT(Input,o);
            o.worldPos = v.vertex.xyz;
            o.position = UnityObjectToClipPos(v.vertex);
            o.proj0 = ComputeScreenPos(o.position);
            COMPUTE_EYEDEPTH(o.proj0.z);

            o.proj1 = o.proj0;
            #if UNITY_UV_STARTS_AT_TOP
            o.proj1.y = (o.position.w - o.position.y) * 0.5;
            #endif
            }

            sampler2D _MainTex;
            sampler2D _NormalMap;
            fixed4 _Color;

            void surf (Input IN, inout SurfaceOutput o) {
                o.Albedo = float3(0,0,0);
            }
            ENDCG
        }
        FallBack "Diffuse"
    }

but I have error:

Shader error in 'Tessellation Sample': 'disp': no matching 1 parameter function at line 173 (on d3d11)

sentences:
Touch to continue (coroutine) in unity When the object gets destroyed in my game, I want a touch to continue function after a delay. This is what I tried.

this is the SceneManager class which is attached to the Main Camera

 public bool ttc;
 public void NextLevel()
{
    StartCoroutine(Delay());
}
IEnumerator Delay()
{

    yield return new WaitForSeconds(2);
    print("touch to continue");
    ttc = true;}

My Object class:

   void OnDestroy()
  {
   Camera.main.GetComponent<SceneManager>().NextLevel();
    if (Camera.main.GetComponent<SceneManager>().ttc == true)
    {
        if (Input.GetKeyDown(KeyCode.V))
        {
            Application.LoadLevel("TheGame2");
        }
    }
}

I also tried this:

IEnumerator Delay()
{
    yield return new WaitForSeconds(2);
    print("touch to continue");
    if (Input.GetKeyDown(KeyCode.V))
        {
            Application.LoadLevel("TheGame2");
        }
    }

side note: I will change the 'KeyCode.V' to a mouse button later

sentences:
libgdx sprite position relative to body Apologies if this is a reiteration, as I couldn't find another discussion of this over the past couple days.

Issue:
I'm using libgdx and box2d, and I'm currently updating the sprite's position to the body's current position every render call. Using a debugRenderer to see the bodies, I see that there is fairly noticeable lag between the movement/position of the body and the sprite that is being moved relative to it.

Question:
Is this lag normal, possibly to perform collisions ahead of time? If not, should I be manipulating/relating the positions differently?

Thanks in advance!

[Solution]
This was a coding error on my part. Pointed out by a good reply below, I was updating the position of the sprite relative to the body and then stepping the physics. Thus never actually setting the sprite to the body's CURRENT position. Thanks!

sentences:
How do I create a sound manager? I have a basic entity system in place. Now I want to add audio. I want to make a database class that watches over entities, pulls data out of them, and creates audio streams whenever necessary.

I'm using C++ and SDL2. What is a simple approach to this?

sentences:
nvidia SSAO visible errors I am trying to add ssao effect to a visualization application but there are errors in resulting image. I am using code from https://github.com/nvpro-samples/gl_ssao .
Errors occur in rapidly changing lighting near the edges of screen.

Only change to code was to remove basic shading and passing only white from scene.frag shader so the error could be seen more pronounced. I also added obj input to import sponza scene but the error is visible with the included sample scene as well if camera is moved close to object.
As is this implementation only enables viewing objects in relative distance. Moving closer to objects brings up this errors.

What causes this error and is there fix.

sentences:
Are shader-based antialiasing methods making traditional multisampling obsolete? See an analysis of FXAA here, and the page for SMAA here

Now these methods have a drawback which is that they are not capable of improving quality in a physically accurate way, like multisampling does (what I mean by this is that it brings out the sub-pixel details from geometry by super-rasterizing), but they are a terrific method for curtailing visual artifacts which are a result of regular rasterization.

Case in point: I run an Nvidia GTX 260, it came moderately overclocked from the factory, it is a Gigabyte Super Overclock model. I also run a 1920x1200 screen.

It's sometimes difficult to maintain good framerates when I play Battlefield 3, but I've noticed some general improvements in terms of speed recently which has made the game play quite a bit better today than it did back when it was released.

The point is, the performance hit caused by 4xMSAA or even 2xMSAA is very noticeable in this game at my full resolution, because it needs all the power it can get. However, FXAA post processing antialiasing comes at almost no cost! A month or two ago, I found myself running the game in windowed mode most of the time because it achieved better framerates that way. But now I've discovered that disabling MSAA and using FXAA almost completely eliminates edge-artifacts without the performance hit of MSAA.

I find that shader-post-process AA is extremely good at producing smooth edges when lines are near-horizontal or near-vertical, and also with thin objects, like the cables on the telephone pole in the link. On still images, a similar smoothness quality is unobtainable until you crank MSAA to 16x.

However shader-post-process AA does not eliminate temporal aliasing artifacts: Even though edges are smoothed terrifically, they "jump" as they move across pixel boundaries.

The reason why this happens is because the shader-AA has no knowledge of actual geometric coverage data, which is what MSAA and friends are essentially based on. As an edge traverses the pixel boundary, our smooth edge will "jump" the length of a pixel, rather than smoothly blending in and out like we would see with 16xMSAA/CSAA. CSAA is particularly good for this because it rasterizes at a higher resolution than MSAA.

So with all this in mind I don't think that shader-based antialiasing methods are a replacement for traditional methods. However I think they are a really cool way to improve image quality in almost every situation. They have the benefit of not requiring a different render buffer storage format.

I think that, going forward, the best way to apply antialiasing in games would be a combination of coverage sampling AA and post-process AA.

Jeff Atwood claims that FXAA made MSAA/CSAA obsolete overnight. What do you think? What are some other ways to compare and contrast traditional antialiasing with shader-based antialiasing?

sentences:
Developing a card game framework What sort of design patterns and ideas might one use to build a somewhat general purpose card game framework?

This stems from I made an attempt to build a clone of the popular Steve Jackson game "Munchkin".  Because of the nature of that game I ended having to hard code so many card functionalities that the development became chaotic and over-bearing.  I had wanted to build something general but ended up with just to many classes with to many overridden functions and switch statements to determine behavior.

I was curious what someone with more experience in design would handle such a task of building a general purpose card game framework, or at least something that could be extended.  Or is it best that if I want to make a simulation of a card game like Munchkin, i'm stuck making a specific framework.

I would like to use C#.

EDIT

I would like to clarify somewhat of what i'd eventually like to achieve.  I'd like a framework where I can basically implement phases with custom functionality (phase 1: draw cards, phase 2: apply upkeep rules, phase 3: play cards, phase 4: resolve, etc).

I think then defining a ruleset would be wise which would be coupled with both the cards and the phases.

Then, the cards would be defined and I suppose tied to the rules so for instance a rule might be "During upkeep phase, lose 1 token".  However, a card that the player has might provide "Don't lose any tokens during the upkeep phase".  So it would be nice to be able to tie this together but within the guts of the framework.

I suppose this might be way out of my league as well.

sentences:
How to implement Vector3.MoveTowards follow with random movement I want to implement an AI behavior where an enemy runs towards the player while sidestepping randomly and aggressively (like in this video: https://www.youtube.com/watch?v=35Ut_C4eL40)
Currently I am just using Vector3.MoveTowards but that results in smooth movement which isn't exactly what I need. I've tried adding an offset to the target using Random.insideUnitCircle but it just doesn't work.
If anyone could give me an algorithm to implement it'll be great. Thanks

sentences:
How do I efficiently check if a point is inside a rotated rectangle? Part for the sake of optimization, part for learning purposes, I will dare to ask: How can I most efficiently check whether a 2D point P is inside a 2D rotated rectangle XYZW, using C# or C++?

Currently, what I am doing is using a "point in triangle" algorithm found in the book Real Time Collision Detection, and running it twice (for the two triangles that make up the rectangle, say XYZ and XZW):

bool PointInTriangle(Vector2 A, Vector2 B, Vector2 C, Vector2 P)
{
 // Compute vectors
 Vector2 v0 = C - A;
 Vector2 v1 = B - A;
 Vector2 v2 = P - A;

 // Compute dot products
 float dot00 = Vector2.Dot(v0, v0);
 float dot01 = Vector2.Dot(v0, v1);
 float dot02 = Vector2.Dot(v0, v2);
 float dot11 = Vector2.Dot(v1, v1);
 float dot12 = Vector2.Dot(v1, v2);

 // Compute barycentric coordinates
 float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
 float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
 float v = (dot00 * dot12 - dot01 * dot02) * invDenom;

 // Check if point is in triangle
 if(u >= 0 && v >= 0 && (u + v) < 1)
    { return true; } else { return false; }
}

bool PointInRectangle(Vector2 X, Vector2 Y, Vector2 Z, Vector2 W, Vector2 P)
{
 if(PointInTriangle(X,Y,Z,P)) return true;
 if(PointInTriangle(X,Z,W,P)) return true;
 return false;
}

However, I have the feeling that there might be a cleaner and faster way. Specifically, to reduce the number of math operations.

sentences:
Basic equation for pure metallic reflectance I'm working on a live wallpaper that shows a pure metallic object. Since it's a live wallpaper, I can make a ton of approximations...this isn't a full blown scene in a game world. My shader only has to support this one material. People won't expect extreme detail, etc. So, for example, I don't even bother with diffuse since a pure conductive material barely has any.

So I'm trying to implement a reflective conductive surface that pulls the reflection from a cubemap representing the lighting environment. On a very basic level it looks like this:

vec3 fresnelSchlick (vec3 f0, float cosTheta)
{
    return mix(f0, vec3(1.0), pow(1.0 - cosTheta, 5.0));
}

//...
float NdV = dot(normal, viewDir);
vec2 brdf = texture2D(u_brdf, vec2(u_roughness, NdV)).rg; // from a LUT

vec3 reflection = textureCube(u_cubemap, reflect(viewDir, normal));
gl_FragColor = reflection * (fresnelSchlick(materialColor, NdV) * brdf.x + brdf.y);

The problem with my simple math here is that the range of possible final pixel colors does not produce a proper-looking range of hues. Suppose my material color is #0050ff and the environment is monochrome white. Then all of the possible colors that could be seen are:

This doesn't allow for bright looking reflections at the light sources in the envmap. I found this example material render for comparison. The cubemap in the example here is close to monochrome white. But at the bright areas of the reflection, there is a lot of red component in the color.

With my limited range of colors, my object looks dull and lifeless. Can anyone point out what I'm missing in my equation?

sentences:
How do I retain previously drawn graphics? I've created a simple program that draws lines from a fixed point to a random point each frame. I wanted to keep each line on the screen. However, it always seems to be cleared each time it draws on the spriteBatch even without GraphicsDevice.Clear(color) being called. What seems to be the problem?

protected override void Draw(GameTime gameTime)
{
   spriteBatch.Begin();
   DrawLine(spriteBatch);
   spriteBatch.End();

   base.Draw(gameTime);
}

private void DrawLine(SpriteBatch spriteBatch)
    {
        Random r = new Random();

        Vector2 a = new Vector2(50, 100);
        Vector2 b = new Vector2(r.Next(0, 640), r.Next(0,480));

        Texture2D filler= new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
        filler.SetData(new[] { Color.Black });

        float length = Vector2.Distance(a, b);
        float angle = (float)Math.Atan2(b.Y - a.Y, b.X - a.X);
        spriteBatch.Draw(filler, a, null, Color.Black, angle, Vector2.Zero, new Vector2(length,10.0f), SpriteEffects.None, 0f);

    }

What am I doing wrong?

sentences:
Tile detection on a 2D isometric layered diamond shaped map - What are the math? What are the math for tile detection on a 2D isometric layered diamond shaped map ?

Here is an image of a layer (this is an image from an old folder, I didn't write the display yet for my current project, so it's incomplete but you get the idea) :

A layer

I have them staggered on top of each other.
Tile detection could works with a loop but it would take too much time. The basic math for floor tiles doesn't work.

A layer is composed of a tiles(array) :

A tile_size * tile_size image representing a 3D square.

A long time ago I asked this question with an account I'v lost unfortunatly and I  had one answer :

Create an hollow ground

But I never understood what that was and when I type "tile detection hollow ground" on google, I got nothing.

I also found several solution I do not understand the concept :

Ray scan on neightbours (I know the theory for ray scanning, but neightbours ??? All of that sounds very difficult for me)
using color mask for a pixel perfect detection (no time to implement such a method)

So, was left the math. And here I'm stuck. I'm looking at my formula 'isometric to screen' conversion(for display), hoping a miracle ha ha :

int x = (i - j) * TILE_SIZE_HALF,
    y = (i + j) * TILE_SIZE_QUARTER - (layer_id * TILE_SIZE_HALF);
//This one is totally working

Anyway, is there even a formula able to solve tile detection for such a map ?
Am I missing something ?

What I'm looking for :

   //With given x & y (mouse coordinates on screen)

    int i = ?,
        j = ?,
        layerID = current_layer_index,
        //tile's index in tile array(layers are tile arrays) :
        tileIndex = calculated from I & J;
        //Where goes the offsets in these calculations ?

How am I gonna know which layer the tile is from ?

I decided to only edit the selected layer (current_selected_layer variable) and then check if the tile is empty. If yes, I'll select the "same tile" but the layer under the selected one and so on.
Now the problem should be less complicated since it's like there is only one layer. What bother me are the map offsets.

EDIT : I didn't tought about the corner... This is not gonna work. If I don't find a solution, I'll maybe switch to classic 2D. Sounds very complicate to code tile selection with isometric map.

There is another problem I have no idea how to handle these :

(this is a layered map, the screen do not represent the final result)

End note: Pseudo code is welcome. Also, consider you have all informations about the map. Since I use a pseudo MVC code, I have access to all data everywhere (tile size, layers number, etc...). There is no restriction.

sentences:
2D platformers: why make the physics dependent on the framerate? "Super Meat Boy" is a difficult platformer that recently came out for PC, requiring exceptional control and pixel-perfect jumping. The physics code in the game is dependent on the framerate, which is locked to 60fps; this means that if your computer can't run the game at full speed, the physics will go insane, causing (among other things) your character to run slower and fall through the ground. Furthermore, if vsync is off, the game runs extremely fast.

Could those experienced with 2D game programming help explain why the game was coded this way? Wouldn't a physics loop running at a constant rate be a better solution? (Actually, I think a physics loop is used for parts of the game, since some of the entities continue to move normally regardless of the framerate. Your character, on the other hand, runs exactly [fps/60] as fast.)

What bothers me about this implementation is the loss of abstraction between the game engine and the graphics rendering, which depends on system-specific things like the monitor, graphics card, and CPU. If, for whatever reason, your computer can't handle vsync, or can't run the game at exactly 60fps, it'll break spectacularly. Why should the rendering step in any way influence the physics calculations? (Most games nowadays would either slow down the game or skip frames.) On the other hand, I understand that old-school platformers on the NES and SNES depended on a fixed framerate for much of their control and physics. Why is this, and would it be possible to create a patformer in that vein without having the framerate dependency? Is there necessarily a loss of precision if you separate the graphics rendering from the rest of the engine?

Thank you, and sorry if the question was confusing.

sentences:
How can I ensure procedural levels in an RTS are fair? I've seen that symmetry and coherance is important in RTS level design, but I'm lazy and want to do procedurally generated levels.

How can I ensure I generate a fair playing field when procedurally creating levels for an RTS?

sentences:
How do I create textured landscape in low poly style? I'm trying to create something similar to this kind of artistic landscapes in Unity.

I've been from trying to use Unity's terrain system and Gaia to making it in Blender; no matter how I can't figure out how it's made; how to texture it afterwards.

I'd be thankful is someone can point me in the starting direction.

Thanks !

sentences:
IwGame (Marmalade): Does CIwGameSprite support SVG? How? I have a small question about Marmalade IwGame engine.

Does the CIwGameSprite support SVG (I've read that yes it does)

If it does support SVG, how does it handle it,

Does it convert that Vector graphic to Pixel Graphics and cache it as an image then?

If it does not then how about the game performance? How does it handles animation, does it redraw the SVG each time?

How about scaling, if it does Caches images, Can I scale an SVG before scaling it?

Hopefully Someone can help

Thank you in advance

Ahmed

sentences:
How to reapply force applied to one object to another object Edit: While I wasn't able to make the code work completely, I believe my question has been sufficiently answered.

I want to make two objects move, react to collisions and other stuff as if they were one.

For example, Objects A and B are entangled.

When Object C rams into Object A and starts moving with it, Object B should start moving with it. When Object B hits a wall, Object A should act like it also hit a wall.

I tried changing position/speed every frame, but this only works when done in one direction.

Now, I want all forces applied to any of the objects to also apply to the other objects entangled to it.

EDIT: The next step is making the thing work with one of the objects moving along a different axis(e.g. the opposite direction of the others) and at a different scale (e.g. speed is proportional to size). So fixed joints, while a working solution for the simplified version of the problem, don't work for me.

UPDATE: Here's the code so far, trying to figure out how to send the other object spinning in the same way as the first one, not sure how to set the position for the force(s?) applied

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

[RequireComponent(typeof(Rigidbody))]
public class EEScript : MonoBehaviour
{
    public List<GameObject> activeObjects;

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

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

    private void OnCollisionStay(Collision collision)
    {
        OnCollisionEnter(collision);
    }

    private void OnCollisionEnter(Collision collision)
    {
        Rigidbody rigidbody = gameObject.GetComponent<Rigidbody>();
        foreach (GameObject obj in activeObjects)
        {
            Rigidbody rb = obj.GetComponent<Rigidbody>();
            if (rb is null || rb.gameObject==gameObject) continue;
            Debug.Log(collision.gameObject.name+"->"+obj.name);

            for (int i = 0; i < collision.contactCount; i++)
            {
                ContactPoint co = collision.GetContact(i);
                Vector3 relativePoint = co.point - rigidbody.centerOfMass;
                Vector3 normal = co.normal;
                Vector3 impulse = collision.impulse;
                if (Vector3.Dot(normal, impulse) < 0f) impulse *= -1;
                rb.AddForceAtPosition(impulse, relativePoint + rb.centerOfMass, ForceMode.Impulse);
            }
        }
    }
}

sentences:
3D collision avoidance: finding the updated velocity vector (outside the "collision-velocities" cones) I am trying to understand and implement the mechanism of a fully 3D collision avoidance (steering behavior) system for flight movement (six degrees of freedom), currently focusing on circumventing static obstacles (all with the shape of a sphere).

However, I don't quite get how to figure it out the new velocity vector of the moving agent. The figure below illustrates the scene. The moving agent (green) has to steer three static objects (blue). The red line represents the initial ahead velocity vector.

Notice that there are also three white/semi-transparent cones. These represent the "forbidden velocity vectors" regarding each obstacle. It means, the set of velocity vectors that, if used as the new ahead vectors of the agent, would make the agent collide with one or more of the obstacles (also note that the radius of each cone is equal the radius of the given obstacle plus the radius of agent, so to allow an offset for the player to maneuver around).

In order to find out the new ahead vector of the moving agent in such 3D environment, considering the three obstacles, a naïve approach would be to simply port to 3D the classic solution explained in this often cited article and exemplified by the following 2D image:

There, a new velocity (orange arrow) is simply calculated by normalizing the minimum distance (black arrow) between the original velocity and the center of the obstacle and then multiplying such normal by the sum between the radius of the obstacle and the radius of the moving agent. Then, an average of the new velocities calculated for each of the obstacles would give the total final velocity.

In many cases, that is sufficient. However, take a look at the cases below (exemplified in 2D to ease visualization):

In all of them, the naïve approach will result in a collision. In a and b, the final new velocity will coincide with the original velocity (red arrow) and the moving agent will move forward despite being partially or fully blocked. In c) and d), the new velocity (orange arrow) will still result in the same consequence.

So, my question is: what is the most computationally efficient way to find out the new ahead vector of the moving agent in such 3D environment, considering the three obstacles, in a way  that avoids collision? Or, in other words, the new ahead vector that:

1) is not inside any of the cones;

2) is the closest possible to the original ahead vector (red line in the picture).

PS: Preferably, I am not looking for a library, I am looking to learn how to that.

sentences:
Getting Into Game Development After a bit of research (And a bit of experimenting) I found that coding is quite fun. I've always wanted to try game development, but never really found a place to start. As well as this, this is my first time using Stack Exchange, so if this post is horrendously misplaced, I apologise. I don't want to go into professional game development, as I'm only 13, but I would like to try it. As I said before, I did try some programming (In Java), so I know the very basics of code-Java at least-so this is my question:
How would I go about building a simple platformer? I don't want fancy graphics, or multiple states. All I want to try is the code a simple engine that can use collisions and take keyboard input, and have a single level that can be changed within the code (By that I just mean drawing different sized rectangles). That is it.
How would I go about this, in the simplest way possible? Any help would be appreciated! :D

sentences:
Jumping Logic Issues Possible Duplicate:
  How to make a character jump?

I have been working on a 2D platformer and am trying to implement jumping. At the moment I have it simply teleporting upward and then falling back down:

if(Keyboard.GetState().IsKeyDown(Keys.Space) && !jumping) _position2D.Y -= 64f;

Is there any way to smooth it out and make it more parabolic?

sentences:
Converting cartesian geo-coordinates to isometric (real world map to game map) I need to create an automated method to convert real cartesian, geo-coordinate data (such as roads and parks), into isometric coordinates as a game map view for use in HTML5 Canvas.

Here is an image of what I mean:

Example Image

Taking into account heavy map distortion in the process to fit they isometric layout. Is this even remotely possible?

sentences:
How to blur entire scene but a specific spot in Unity? What I want is basically: A way to blur every object/sprite on the scene, but have a "blur-free" circular zone, that can move. And everything that's behind that circular zone won't have the blur effect applied to it.

In a 2D mobile game, how would I do that, especially in a way that's not too heavy, performance-wise(if possible).

And if it's not possible to do that in a way that won't completely destroy my performance, I also have those sprites already "pre-blurred" so maybe there's a way to have both blurred and "unblurred" objects at the same position, and only draw the right parts of them as they go through the scene and reach the blur-free zone. If there's a way to do that, that'd also help immensely.

Thanks for your time.

sentences:
How to store data and behaviour for what happens within a level? I made a game a year ago featuring a custom scripting language, but I realised that it took far too long to actually make the language and there were many commands that were very rarely used.
I'm trying now to do something similar with a game I'm working on, and I'm wondering what the simplest way to store level data would be. There are programs like Tiled that let you store some JSON data and tiles and .png's and whatnot, but I want to be able to store commands for what happens within a level gameplay wise. I'll give some examples.
I could have a file for the starting room that has commands that run when you enter the room, e.g. to have some text pop up, have a character walk up to the player, etc. I could also have individual commands for what happens when you interact with an object or with a character. What's a good way to store this data without having to write my own scripting language? It's not too difficult to make a very basic one with minimal functionality, but I feel like there are much better ways out there.

sentences:
Weird texture binding bug on Mali-400 MP On Mali-400 MP, there's a weird bug with texture binding.

Sometimes, shaders use textures from wrong samplers.

On other mobile and desktop GPUs, the same code works fine, but on Mali, almost every draw call is broken:

As you see, lightmap texture (at sampler 6) is used instead of diffuse texture (0).

Anyone knows a workaround to this?

sentences: Move an object towards a point relative to its position I am attempting to move an object a set distance in a direction relative to the objects current position. In other words I want the object to move to whatever point is 144 pixels below the object, and then stop moving. How can I do this?

sentences: game physics: contact constraint and relative velocity For two rigidbodies (2D boxes), A and B, I have been colliding A with B and finding the collision normal pointing towards A i.e. the direction that would separate A from B. When it comes to calculating the relative velocity for the contact constraint, does it matter which body has the edge that the collision normal is perpendicular in terms of which velocity to subtract from which?

sentences:
OpenGL ES - jagged edge I need to render roads and some direction marks on top of them. I render roads as triangled geometry, same goes for marks (see picture - road is purple, mark is red, ignore z-fighting).

Problem goes for edge of road. Is too much "jagged" and not straight. Is it result of perspective projection (thats what I believe). And how can it be improved? There is no texture, colors are filled directly in fragment shader.

EDIT:

I have tried solution from duplicite answer, but jagged edges are still there. Even if multisampled EGLConfig is selected.

sentences:
How to make my characters turn smoothy while walking on a path(list of coordinates)? I have a list with coordinates - output from A* algorithm - and I would like to make my characters smoothly follow this path with rotations.

So I have something like A and I want to get C

How can I do this ?

EDIT

To make myself a little bit more clear:

I am more interested in smooth turning as I already know how to walk from one node to another.

EDIT

As many people find this useful (me too) I am posting link to Daniel Shiffman's "Nature of code" where he discusses a lot of game AI (and physics) problems e.g. steering behaviours http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section8

sentences:
Using 3D models in an 2D Game in libGDX In my libGDX 2D RPG-Game (like Zelda or something) I want to display some items as 3D-Objects. Since I'm using an OrthographicCamera like this:

this.gameWorldCam = new OrthographicCamera();
this.hudCam = new OrthographicCamera();
gameWorldCameraViewport = new ExtendViewport(FRUSTUM_WIDTH, FRUSTUM_HEIGHT, gameWorldCam);

I don't know how to render 3D-Object on it. In my render loop I call this:

// 2D
spritebatch.begin();
...
spritebatch.end();

// ----------------------------------------------
// Just some hardcoded model creation for testing
// ----------------------------------------------
Model model;
ModelInstance instance;
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createBox(
  5f,
  5f,
  5f,
  new Material(ColorAttribute.createDiffuse(Color.GREEN)),
  Usage.Position | Usage.Normal
);
instance = new ModelInstance(model);
// ---------------------------------------------

// 3D
modelBatch.begin(gameWorldCam);
modelBatch.render(instance);
modelBatch.end();

// 2D
spritebatch.begin();
...
spritebatch.end();

What do I have to do, to get the proper result? Right now, nothing of the green 3D cube is visible.

sentences:
How to prevent overlapping of gunshot sounds when using fast-firing weapons So I am now trying to find sounds for my guns but when I grab a gun sound effect and play it in my game a lot of the sounds are either terrible sounding or have this horrible echoing effect because as a gun shoots sometimes the previous sound is playing still.

public void shoot(float x, float y, float direction){

    if(empty){
        PlayHUD.message = "No more bullets!";
        return;
    }

    if(reloading){
        return;
    }

    if(System.currentTimeMillis() - lastShot < fireRate){
        //AssetsLoader.lmgSound.stop();
        return;
    }

    float dx = (float) (-13 * Math.cos(direction) + 75 * Math.sin(direction));
    float dy = (float) (-14 * -Math.sin(direction) + 75 * Math.cos(direction));

    float dx1 = (float) (-13 * Math.cos(direction) + 75 * Math.sin(direction));
    float dy1 = (float) (-14 * -Math.sin(direction) + 75 * Math.cos(direction));

    PlayState.effects.add(new MuzzleFlashEffect(x + dx1, y + dy1, (float) Math.toDegrees(-direction)));

    PlayState.projectiles.add(new Bullet(this, x + dx, y + dy, (float) (direction + (Math.toRadians(MathUtils.random(-accuracy, accuracy))))));

    if(OptionState.soundOn){
        AssetsLoader.lmgSound.play(OptionState.volume);
    }

    bulletsInClip--;
    lastShot = System.currentTimeMillis();

}

Here is the code for where the sound plays. Every time this method is called the sound is called but it happens so often in this case that there is this terrible echoing. Any idea on how to fix this?

sentences: How do I get the position of a static body in Jbox2D? I'm trying to get the position of a static body in JBox2D, how do I do that?

sentences:
Sprite sheet textures picking up edges of adjacent texture I have a custom sprite routine (openGL 2.0) which uses a simple sprite sheet (my textures are arranged horizontally next to each other).
So, for example, here is a test sprite sheet with 2 simple textures:

Now, what I do when creating my openGL sprite object is specify the total number of frames in its atlas and when drawing, specify which frame I want to draw.
It then works out where to grab the texture from by:
Dividing the required frame number by the total number of frames (to get the left coordinate)
And then diving 1 by the total number of frames and adding the result to the left hand coordinate calculated above.
This does seem to work but sometimes I get problems.  Say for example, I want to draw the X below and I get...........

I've heard about putting a 'padding' of 1 px between each texture but could someone explain exactly how this works?  I mean if I do this it will surely throw off the calculations for getting the texture.
If I simple include the padding in texture picked up (so the sprite is drawn with a blank border), then surely this will cause problem with collision detection? (ie sprites may appear to collide when using bounding boxes when the transparent parts collide).
Would appreciate if someone could explain.

sentences:
Scale camera to fit screen size unity My background and gameobjects are 2d sprites not UI images ,I want to know how to make my background scale with screen size and positions of 2d sprits on it don't change after building game (webGl) like scale canvas with screen size and anchor points in UI elements .

Before building the game

After building

sentences: Should I draw a button using a single shape (triangle list) and draw call, or multiple shapes and draw calls (triangle strip and line lists)? I know this is too simple for performance improvements to make much of a difference, but I find that knowing this information would be simple for many future scenarios. Basically, what I am trying to draw is a rectangle with text over it. I don't know whether it would be better to draw the entire thing using triangles, or use two draw calls (one using GL_TRIANGLE_STRIP for the rectangle, and the other using GL_LINES for the text). My worry is that the cost of the draw call outweighs the cost of reducing the number of vertices used.

sentences:
Swaying tree in OpenGL ES 2 I've seen this many times, but I have no idea what's the best way to achieve it. I am looking for something close to, for example, this: Lonely Tree Live Wallpaper

I have two approaches in mind: one would be to make an animation in, say, Blender and then export the resulting images & create a spritesheet animation out of it. This is very straightforward, but creating a 120-frame spritesheet out of 512 x 512 or 1024 x 1024 images (for larger screens) seems overkill.

The second approach would be to cut my tree into a few separate textures and then move them simultaneously in such a manner that it gives the impression they form a single image of a tree swaying in the wind.

Any other approaches?

sentences:
MSAA/ CSAA / FXAA How to set the mode in OpenGL? I'm learning OpenGL and something I am stuck with is AA. Specially when I want to turn it on and off at runtime. I know that I can set the samplecount when I create a FBO and blit it over to the final window. When I want to change the mode I switch the FBO and everything is fine. The question I am completely stuck with is, how do I change the mode and also important, how do I query the modes that the card supports. With mode I mean CSAA,MSAA,.. .I can't find a lot. At least I know that it is vendor specific.
Hope anyone can point me in the right direction. Thanks

sentences: What is it called when you combine textures for an object I am trying to gain a better understanding for modeling and texturing for Unreal 4 and Blender. Now my question is: What is the process/result called when packing textures into one image as shown below?

sentences:
How can I convert OBJ data into CSS3D transformations? I want to convert the data in a 3D .obj file (vertices, normals, faces) to CSS3D (width, height, rotateX,Y,Z and/or similar transforms).  I found a bunch of formulae and what-not, but 3D isn't my forte, so I don't know which I should use.

Essentially: How can I get the X/Y/Z-rotation of a 4-point plane from it's matrix of x,y,z coordinates?

For example, here are  2 simple planes in .obj format:

g plane1
# simple along along Z axis
v  0.0  0.0  0.0
v  0.0  0.0  1.0
v  0.0  1.0  1.0
v  0.0  1.0  0.0

g plane2
# plane rotated 90 degrees along Y-axis
v  0.0  0.0  0.0
v  0.0  1.0  0.0
v  1.0  1.0  0.0
v  1.0  0.0  0.0

f  1 2 3 4
f  5 6 7 8

I'd like to convert it into CSS:

#plane1 {
    width: X;
    height: Y;
    transform: rotateX(Xdeg) rotateY(Ydeg) rotateZ(Zdeg) translateZ(Zpx)
}

#plane2 {
    width: X;
    height: Y;
    transform: rotateX(Xdeg) rotateY(Ydeg) rotateZ(Zdeg) translateZ(Zpx)
}

/* Or equivalent, like using transform: matrix3d() */

sentences:
How to move a player along Waypoints with Rigidbody.MovePosition in Unity? I have a player with a Rigidbody, I want it to follow along the Waypoints.
I have used MoveTowards but it seems also not to work however. I want to use MovePosition to add force while grinding. I commented a code that could maybe work but I got an error on that, check //ADDFORCE lines.

Here is my code:

public GameObject[] waypoints;

public float grindSpeed;
public float turnSpeed;

public int currentWaypoint;

private Animator anim;
private Rigidbody rb;

public bool isGrinding = false;

void Start()
{
    anim = GetComponent<Animator>();
    rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    MoveAlongWaypoints();

    if(isGrinding)
        anim.SetBool ("isOnGrinding", true);
    else if(!isGrinding)
        anim.SetBool("isOnGrinding", false);
}

void MoveAlongWaypoints()
{
    if(isGrinding)
    {
        //TRANSLATE
        transform.position = Vector3.MoveTowards(transform.position, waypoints[currentWaypoint].transform.position, grindSpeed * Time.deltaTime);
        //ADDFORCE
        /*
        Vector3 movePosition = transform.position;
        movePosition = Mathf.MoveTowards(transform.position, waypoints[currentWaypoint].transform.position * grindSpeed * Time.deltaTime);
        rb.MovePosition(movePosition);
        */
        //ROTATE
        var rotation = Quaternion.LookRotation(waypoints[currentWaypoint].transform.position - transform.position);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, turnSpeed * Time.deltaTime);

        if(Mathf.Abs(transform.position.x - waypoints[currentWaypoint].transform.position.x) < 1
            && (Mathf.Abs (transform.position.y - waypoints[currentWaypoint].transform.position.y) < 1)
            && (Mathf.Abs (transform.position.z - waypoints[currentWaypoint].transform.position.z) < 1))
        {
            //rb.useGravity = false;
            currentWaypoint++;
        }
    }
}

void OnTriggerEnter(Collider other)
{
    if(other.gameObject.tag == "GrindWayPoint")
    {
        Debug.Log ("Waypoint!!");
        isGrinding = true;
    }
}

sentences:
What is the optimal way to update different entities in an engine? EDIT: half of my question seemed to disappear, but thankfully, it was still in the clipboard.
When I say entities, I mean instantiations of various classes in my engine (example class: Engine.Animation, or Engine.Scene). The language in question is Javascript.
 The situation:

The current structure of my engine goes something like this:
// The single engine object that only stores constructor functions,
// aka classes (or at least it used to only store those).
Engine = {};

Engine.Scene = function()
{
    ...
}

Lets take the Scene class as an example... It basically stores all the information needed to render the visual part of the game state, which is done by the Renderer class (renderer.render(scene, camera)).

 The problem:

All worked well, but then I realized that the entities sometimes needed to be updated! The best (and, for now, the only) example of this is the scene.AlphaDown() method, which makes the scene transparent, "shuts it down", in a way.
I implemented this with the use of setInterval (the interval would call a function that used to lower the scene's alpha depending on how much time passed. This is the kind of "update method" I am talking about: the one that needs to be called iteratively, usually at 60FPS.) But, I was told that it was a bad practice (here and here). It was suggested to me that I use alternative ways of updating entities (without the use of setInterval).

 The possible solution:

I meant to have an array in Engine, called toUpdate, in which different entities would push their update methods. Then, the Engine would have a central update() method, which would calculate the time since last updated, and call the entities' registered update methods, giving that time as an argument. In the previous example with a scene, AlphaDown() would register an update method by pushing it into the Engine.toUpdate array.
When the task of an update method (ie scene.alpha = 0) was completed, it would be removed from the toUpdate array.

 The problem with the solution:

This method has it's flaws, though. First, it would require the user to call Engine.update() on each of his game loop iterations. Then, it would make the global Engine object have methods, but I just want to keep it a namespace of some sort, a collection of useful classes. I don't want to dictate how a loop should be structured!

 The question:

Is my solution an acceptable way of updating entities? Are there some other, more standard ways? Should I strive to have my entities not have update methods that need to be iteratively called, and let the user implement them?

sentences:
Data Structures for Logic Games / Deduction Rules / Sufficient Set of Clues? I've been cogitating about developing a logic game similar to Einstein's Puzzle , which would have different sets of clues for every new game replay.

What data structures would you use to handle the different entities (pets, colors of houses, nationalities, etc.), deduction rules, etc. to guarantee that the clues you provide  point to a unique solution?

I'm having a hard time thinking about how to get the deduction rules to play along with the possible clues; any insight would be appreciated.

sentences: How does double dispatch help collision detection? There are a few specific techniques to test if one object has hit another object in a game. One of them is called "double dispatch." Can someone explain what double dispatch is, and how it can be used to test hit objects?

sentences:
Bullet spread changes depending on the camera direction I'm working on an FPS game. I want to make a little bit of difference in shooting direction, only on the horizontal axis.

To do this, I wrote this code:

Temp_Shake_Horizontal.x = Random.Range(-0.1f, 0.1f);

if (Physics.Raycast(the_camera.position, the_camera.forward + Temp_Shake_Horizontal, out BulletDecal_Hit, Mathf.Infinity))
{
     Quaternion HitRot = Quaternion.FromToRotation(Vector3.forward, BulletDecal_Hit.normal);
     decals_Objs[decal_Index].transform.position = BulletDecal_Hit.point;
     decals_Objs[decal_Index].transform.rotation = HitRot;
}

But I don't know why, when I rotate the camera, the result is changing!

Here is what it looks like when I face in one direction (this is the intended result):

But when I rotate the camera about 90 degrees to the left or right, the result is no horizontal variation: the bullets all line up in a vertical column.

Why does this happen, and how can I solve this issue? I want the result to always be like the first picture, with random variation side-to-side.

sentences:
When should I start designing levels? I'm working on a puzzle game. I thought of a core mechanic, implemented it, tuned it and now I have something I'm happy with.

I'd really like to build a few levels before I work on stuff like UI and sound, however, I'm not sure if I should sort out some other things first:

Story

The game has a story (as opposed to many other puzzle games). The thing is, I just have a basic idea of what it should be, nothing detailed and nothing's written down.

Should I work out the story in some detail first? Figure out what arc I want to tell in the first 5 levels before I build them? Or is the story somewhat orthogonal in puzzle games and I can just go ahead and build some levels?

Elements

I've thought of a rather minimal set of gameplay elements, i.e. objects you can interact with, to evaluate the core mechanic.

I'd really like to keep things minimal and see how far I get with just those, but is that sane? Should I think long and hard about what elements I need upfront or should I add them when I feel that something's missing in a level I'm building?

Bottom line: What should I do before designing the first few levels?

sentences:
Couldnt visualize the mechanism describe by the code Was reading this article http://www.jgallant.com/2d-liquid-simulator-with-cellular-automaton-in-unity/ but couldn't understand the mechanism in "CalculateVerticalFlowValue". Is the remaining liquid represent the tile just above the tile "destination liquid"? Would appreciate if can provide simpler example to visualize the mechanism as I couldn't see the logic behind this code.
using UnityEngine;
using System.Collections.Generic;
public class Liquid {

// Max and min cell liquid values
float MaxValue = 1.0f;
float MinValue = 0.005f;

// Extra liquid a cell can store than the cell above it
float MaxCompression = 0.25f;

// Lowest and highest amount of liquids allowed to flow per iteration
float MinFlow = 0.005f;
float MaxFlow = 4f;

// Adjusts flow speed (0.0f - 1.0f)
float FlowSpeed = 1f;

// Keep track of modifications to cell liquid values
float[,] Diffs;

public void Initialize(Cell[,] cells) {
    Diffs = new float[cells.GetLength (0), cells.GetLength (1)];
}

// Calculate how much liquid should flow to destination with pressure
float CalculateVerticalFlowValue(float remainingLiquid, Cell destination)
{
    float sum = remainingLiquid + destination.Liquid;
    float value = 0;

    if (sum <= MaxValue) {
        value = MaxValue;
    } else if (sum < 2 * MaxValue + MaxCompression) {
        value = (MaxValue * MaxValue + sum * MaxCompression) / (MaxValue + MaxCompression);
    } else {
        value = (sum + MaxCompression) / 2f;
    }

    return value;
}

sentences:
How to lead a moving target from a moving shooter I saw this question: Predicting enemy position in order to have an object lead its target.  My situation is a little different though.

My target moves, and the shooter moves.  Also, the shooter's velocity is added to the bullets' velocities, i.e. bullets fired while sliding to the right will have a greater velocity toward the right.

What I'm trying to do is to get the enemy to be able to determine where they need to shoot in order to hit the player.  Using the linked SO solution, unless the player and enemy are stationary, the velocity difference will cause a miss.  How can I prevent that?

Here is the solution presented from the stack overflow answer.  It boils down to solving a quadratic equation of the form:

a * sqr(x) + b * x + c == 0

Note that by sqr I mean square, as opposed to square root. Use the following values:

a := sqr(target.velocityX) + sqr(target.velocityY) - sqr(projectile_speed)
b := 2 * (target.velocityX * (target.startX - cannon.X)
      + target.velocityY * (target.startY - cannon.Y))
c := sqr(target.startX - cannon.X) + sqr(target.startY - cannon.Y)

Now we can look at the discriminant to determine if we have a possible solution.

disc := sqr(b) - 4 * a * c

If the discriminant is less than 0, forget about hitting your target -- your projectile can never get there in time. Otherwise, look at two candidate solutions:

t1 := (-b + sqrt(disc)) / (2 * a)
t2 := (-b - sqrt(disc)) / (2 * a)

Note that if disc == 0 then t1 and t2 are equal.

sentences:
How can I extend this graphics code to draw more vectors of vertices? I want to include the drawing of other vectors of vertices in the following code, in a number of places it seems easy enough to simply add or multiply size()s of the two vectors, for instance in the first check. But then it gets a bit fuzzy simply because of a lack of understanding.

Should I add them together to create a bigger buffer description and copy everything together? Or should I do it all separately?

Basically how would I extend this code to include more vectors of vertices?

if (temporary2DVerts.size() > 0)
{
    // create the vertex buffer and store the pointer into pBuffer, which is created globally
    D3D10_BUFFER_DESC bd;
    bd.Usage = D3D10_USAGE_DYNAMIC;
    bd.ByteWidth = sizeof(VERTEX) * temporary2DVerts.size();// this breaks the create buffer line : temp2DVerts.size();
    bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
    bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
    bd.MiscFlags = 0;

    device->CreateBuffer(&bd, NULL, &pBuffer);

    void* pVoid;    // the void pointer

    pBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the vertex buffer
    memcpy(pVoid, &temporary2DVerts[0], sizeof(temporary2DVerts[0]) * temporary2DVerts.size());
    pBuffer->Unmap();

    // select which input layout we are using
    device->IASetInputLayout(screenVertexLayout);

    // select which primtive type we are using
    device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);

    // select which vertex buffer to display
    UINT stride = sizeof(VERTEX);
    UINT offset = 0;
    device->IASetVertexBuffers(0, 1, &pBuffer, &stride, &offset);

    // apply the appropriate pass
    screenPass->Apply(0);

    // draw the vertex buffer to the back buffer
    device->Draw(temporary2DVerts.size(), 0);

    temporary2DVerts.clear();
}

EDIT - just to be clearer - there are 4 vectors of vertices. two that don't change and two that constantly change. permanent 2D and permanent 3D and a temporary version of both. This is so the permanent ones can just be loaded in and are always drawn, and the temporary ones  only get drawn for a frame. This way I can create moving lines for debugging, like line of sight cones etc.

EDIT - the naive approach would be to duplicate this code 4 times for each vector, but surely there is a better way? I don't think this is a hard thing to do, but trying to do it has exposed a basic gap in my knowledge about what some of these lines of code do. should I just populate one big list from all the vectors and push that through?

some need to be drawn with different passes, and some don't need to be changed each frame. for example, the permanent ones can just stay on the gpu. right?

sentences:
Update() method never called I have a class BlinkingBehaviour which inherits from MonoBehaviour. Game objects attached to scripts containing classes that inherit from BlinkingBehaviour should, as the name suggests, blink.

BlinkingBehaviour is a small class so I will share the entirety of its code here:

public class BlinkingBehaviour : MonoBehaviour
{
    private Renderer renderer;

    public bool BlinkingEnabled;
    public Color BlinkingColour = new Color(1.0f, 127f / 255f, 39f / 255f);

    protected float CurrentColourScale;
    protected float ColourScaleIncrementPerUpdate = 0.005f;

    protected const float MaxColourScale = 2f;

    protected void Start()
    {
        this.renderer = this.gameObject.GetComponent<Renderer>();
    }

    protected void Update()
    {
        if (this.BlinkingEnabled)
        {
            SetBlinkingColour();
        }
        else
        {
            SetColour();
        }
    }

    protected void SetColour()
    {
        if (this.CurrentColourScale <= 1f)
        {
            this.renderer.material.SetColor("_EmissionColor", this.BlinkingColour * this.CurrentColourScale);
        }
        else
        {
            this.renderer.material.SetColor("_EmissionColor", this.BlinkingColour * (MaxColourScale - this.CurrentColourScale));
        }
    }

    protected virtual void SetBlinkingColour()
    {
        SetColour();
        this.CurrentColourScale += ColourScaleIncrementPerUpdate;

        if (this.CurrentColourScale <= MaxColourScale)
        {
            return;
        }

        ResetBlinkingColourScale();
    }

    protected void ResetBlinkingColourScale()
    {
        this.CurrentColourScale = 0f;
    }
}

I have a class Lamp which inherits from BlinkingBehaviour. I attached Lamp.cs to an object in my scene. In my inspector, I checked the BlinkingEnabled option, expecting to see the Lamp game object blinking after I pressed "Play".

However, the object did not blink.

Here is my Lamp class:

public class Lamp : BlinkingBehaviour
{
    private void Start()
    {
        base.Start();
    }

    private void Update()
    {
        base.Update();
    }
}

After setting various breakpoints, I could see that the Start() method was hit in both Lamp and BlinkingBehaviour. I could also see that this.gameObject.GetComponent<Renderer>(); returned a valid component.

On the other hand, my breakpoint in the Update method in Lamp was never hit.

What can I do to fix this issue?

UPDATE:

I deleted the Start() and Update() methods from my derived class. I discovered something new: The Update() method in BlinkingBehaviour is never called, even though Start() is.

sentences:
Access TrackAsset from PlayableAsset in unity I have a PlayableAsset which samples a configuration randomly and then creates a Playable based on that configuration. Now, I want to include a gender configuration which is set inside a TrackAsset-Parameter (Serialized Field on the TrackAsset).
How can I access this parameter now?
[TrackClipType (typeof (OverlayAsset))]
[TrackClipType (typeof (RandomOverlayAsset))]
[TrackBindingType (typeof (MoveOverlayManager))]
public class OverlayTrackAsset : TrackAsset
    {
        [SerializeField]
        public IntParameter GenderParameter;
    }

public class RandomOverlayAsset : PlayableAsset
    {
        public static System.Random SYSRAND = new System.Random();

        //[ScriptableObjectDropdown (AppendNextDrawer = true)]
        [SerializeField]
        private MoveOverlay[] Overlays;

        [SerializeField]
        private float OverlayProbability = 1;

        public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
        {
            ScriptPlayable<OverlayPlayable> playable = ScriptPlayable<OverlayPlayable>.Create (graph);
            OverlayPlayable overlayPlayable = playable.GetBehaviour ();
            double rand = SYSRAND.NextDouble ();
            if (OverlayProbability >= rand)
            {
                for (int i = 0; i < 10; i++) //Monte Carlo
                {
                    int selected = SYSRAND.Next (0, Overlays.Length);
                    MoveOverlay selectedOverlay = Overlays[selected];
                    if ((selectedOverlay.GenderSpecific &  ????GenderParameter???.Value()) == 0){ // ??? How to define GenderParameter???
                        continue
                    }
                    overlayPlayable.Overlay = selectedOverlay;
                    break;
                }
            }
            else
            {
                overlayPlayable.Overlay = null;
            }

            return playable;
        }
    }

sentences:
Stuck at enemy movement I am making a TD game in unity, Initially I made all of my enemy movements frame rate dependent say:

I had a grid point1 at -22.65 and other at -21.1, diagrammatically:

(-22.65) _________(-21.1)_______(-21.1+1.55) ......

so the distance on x axis between two points is 1.55, divided it by 25 jumps with each enemy jump of 0.062 of each frame. On reaching on next point of grid the enemy find again its path. All went fine until I have requirement of FastForward and Pause feature. I used timeScale property of unity but it wont work as they are frame dependent. I also tried double speed of enemy on clicking fast forward button at any time, it has some issues that enemy jumps are now less and it fails to reach on next grid point.

Could someone suggest me solution to my problem. Do I need to change the enemy movement code to make it frame independent ?? I need the enemy to reach on the grid specific point I also need later to slow down any one enemy's speed when tower fires on it. Thnx

sentences:
Is Update(GameTime) called before it's finished? Code at the beginning of Update(GameTime) is being called over and over again, and code at the end of Update(GameTime) is only being called after a delay. Is Update(GameTime) called again before it's finished?

Relevant code:

    public override void Update(GameTime gameTime)
    {
        Console.WriteLine($"Current Position (Outer): {Texture.Position.Y}");
        if (Keyboard.IsKeyDown(Keys.Space))
        {
            Jump(gameTime);
        }

        UpdateGravity(gameTime);

        if (Keyboard.IsKeyDown(Keys.A))
        {
            velocity.X = -HorizontalMoveSpeed*(float) gameTime.ElapsedGameTime.TotalMilliseconds;
        }
        else if (Keyboard.IsKeyDown(Keys.D))
        {
            velocity.X = HorizontalMoveSpeed*(float) gameTime.ElapsedGameTime.TotalMilliseconds;
        }
        else
        {
            velocity.X = 0f;
        }

        Texture.Position += velocity;

        CheckCollisions();

        base.Update(gameTime);
    }

    private void UpdateGravity(GameTime gameTime)
    {
        velocity.Y += Gravity * (float) gameTime.ElapsedGameTime.TotalMilliseconds;
    }

    private void Jump(GameTime gameTime)
    {
        if (jumping) return;
        jumping = true;
        velocity.Y -= JumpSpeed * (float) gameTime.ElapsedGameTime.TotalMilliseconds;
    }

    private void CheckCollisions()
    {
        foreach (var platform in CryoGame.Platforms.Where(CollidesWith))
        {
            Console.WriteLine($"Current Position (Inner): {Texture.Position.Y}");
            var collision = false;

            var topInsideOther = Texture.Top <= platform.Texture.Bottom;
            var bottomOutsideOther = Texture.Bottom >= platform.Texture.Bottom;
            if (topInsideOther && bottomOutsideOther)
            {
                Texture.Top = platform.Texture.Bottom;
                collision = true;
            }

            var topOutsideOther = Texture.Top <= platform.Texture.Top;
            var bottomInsideOther = Texture.Bottom >= platform.Texture.Top;
            if (topOutsideOther && bottomInsideOther)
            {
                Texture.Bottom = platform.Texture.Top;
                collision = true;
            }

            if (collision)
            {
                velocity.Y = 0f;
            }
        }
    }

Example output:

Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Outer): ...
Current Position (Inner): ...

```

sentences:
spriteBatch.draw is not getting overloaded I am following this tutorial from gamefromscratch.com tutorial 11.
I am using libGdx framework in Android studio .

public class OrthogonalTiledMapRendererWithSprites extends OrthogonalTiledMapRenderer {

public OrthogonalTiledMapRendererWithSprites(TiledMap map) {
    super(map);
}

@Override
public void renderObject(MapObject object) {
    if(object instanceof TextureMapObject) {
        TextureMapObject textureObj = (TextureMapObject) object;
            spriteBatch.draw(textureObj.getTextureRegion(), textureObj.getX(), textureObj.getY()); // getting error in this line
    }
}
}

I am getting an unresolved error in the following line

spriteBatch.draw(textureObj.getTextureRegion(), textureObj.getX(), textureObj.getY());

The code in render() method is

public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    camera.update();
    tiledMapRenderer.setView(camera);
    tiledMapRenderer.render();
    }

I am new in game development please help me solve this error.
Thanks in advance

sentences:
How to get asset folder path in android native activity? I am trying to create a small game with android native activity. I wish to load textures using stb image. I don't know how to get the path to assets folder.
Is there any API to get path to apk directory so that I can use that to get textures? Thanks.

sentences:
Drawing simple geometric figures with DrawUserPrimitives? I'm trying to draw a simple triangle based on an array of vertex. I've been searching for a tutorial and I found a simple example on riemers but I couldn't get it to work.
I think it was made for XNA 3 and it seems there were some changes to XNA 4?

Using this example:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/The_first_triangle.php

I get this error:

  Additional information: The current vertex declaration does not
  include all the elements required by the current vertex shader.
  TextureCoordinate0 is missing.

I'm not english so I'm having some trouble to understand everything.

For what I understand error is confusing because I'm trying to draw a triangle color based and not texture based and it shouldn't need a texture.

Also I saw some articles about dynamic shadows and lights and I would like to know if this is the kind of code used to do it with some tweaks like culling because I'm wondering if its heavy code for performance in real time.

    public void LoadContent()
    {
        effect = Game.Content.Load<Effect>("Effect1");
        playerVision = new VertexPositionColor[3];
        playerVision[0].Position = new Vector3(-0.5f, -0.5f, 0f);
        playerVision[0].Color = Color.Red;
        playerVision[1].Position = new Vector3(0, 0.5f, 0f);
        playerVision[1].Color = Color.Green;
        playerVision[2].Position = new Vector3(0.5f, -0.5f, 0f);
        playerVision[2].Color = Color.Yellow;
    }

    // comes from draw method
    private void drawPlayerVision(GameTime gameTime, SpriteBatch spriteBatch)
    {
        effect.CurrentTechnique = effect.Techniques["Pretransformed"];
        Game.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, playerVision, 0, 1, VertexPositionColor.VertexDeclaration);
    }

sentences:
Starcraft II Galaxy Editor - Eventdefinition I can create an Action with parameters using an Actiondefintion.

But how can I create an Eventdefinition ? I'd like to make an Event that is 'called' when a Unit, that is saved in a variable, dies. Like an Event called 'My unit dies'.

The  desired behavior is the following:

Called when a unit defined in a variable dies
the deceased unit should be returned by 'Triggering Unit()'
the owning player of the deceased unit should be returned by 'Triggering Player()'

I hope you get my point,
Thanks

sentences:
Why is my collision resolution failing on the corners? I'm tearing my hair out trying to work out how to handle my collision resolution at the corners of the rectangles that I'm colliding with.

The code that I'm working with is:

class Player(object):
    def move(self):
        # Calculate velocity based on gravity, etc
        # ...

        # Check collisions
        for obj in self.controller.collidable():
            sides = self.get_intersect(obj)

            if sides & TOP:
                self.mover.vy = 0
                self.mover.y = obj.coord.y + obj.size.y
            elif sides & BOTTOM:
                self.mover.vy = 0
                self.mover.y = obj.coord.y - self.size.y
            elif sides & LEFT:
                self.mover.vx = 0
                self.mover.x = obj.coord.x - self.size.x
            elif sides & RIGHT:
                self.mover.vx = 0
                self.mover.x = obj.coord.x + obj.size.x

        self.coord.x = self.mover.x
        self.coord.y = self.mover.y
        self.velocity.x = self.mover.vx
        self.velocity.y = self.mover.vy

    def is_intersecting(self, other):
        return (
            (
                self.coord.x + self.size.x > other.coord.x
                and
                self.coord.x < other.coord.x + other.size.x
            )
            and
            (
                self.coord.y + self.size.y > other.coord.y
                and
                self.coord.y < other.coord.y + other.size.y
            )
        )

    def get_intersect(self, other):
        if not self.is_intersecting(other):
            return 0

        pos = 0

        # Are we overlapping the bottom edge?
        if self.coord.y < other.coord.y < (self.coord.y + self.size.y) > other.coord.y:
            pos |= BOTTOM
        # Are we overlapping the top edge?
        if self.coord.y < (other.coord.y + other.size.y) < (self.coord.y + self.size.y):
            pos |= TOP

        # Are we overlapping the left edge?
        if self.coord.x < other.coord.x < (self.coord.x + self.size.x):
            pos |= LEFT
        # Are we overlapping the right edge?
        if self.coord.x < (other.coord.x + other.size.x) < (self.coord.x + self.size.x):
            pos |= RIGHT

        if pos == 0:
            pos = INSIDE

        return pos

The problem I'm experiencing is during vertical movement. If you push into a wall and jump, as you reach the top corner, it will push you vertically. This is due to the sides & TOP being the first check. Moving the horizontal checks first fixes this when jumping up, but then falling onto a corner moves the player horizontally.

I've tried doing checking based on what the horizontal/vertical velocities are, but this falls apart, since the vertical velocity is always non-zero due to gravity (and is corrected by this check if standing on a platform). Any other answers I've found fail to take this into account.

sentences: Do all normalized quaternions represent valid rotations? Basically, I'm getting a bug where the rotations in the animations seem to be skewing the model even though I'm normalizing them. I suspect that the rotations are showing the error, but not causing it, if that makes sense.  But that's based on the idea that a normalized quaternion can't skew a model.

sentences:
Unexpected behavior of bodies affected by gravity in 2D I have a simple code that calculates the acceleration of a body every update of my simulation using the Newton's law of universal gravitation and the second law of motion.

def move_bodies():
    def get_dist(b1, b2):
        return math.hypot(b2['x'] - b1['x'], b2['y'] - b1['y'])

    for body in bodies:
        acceleration = 0
        angle = 0

        for other_body in bodies:
            dist = get_dist(body, other_body)

            if body != other_body:
                angle = math.atan2(other_body['y'] - body['y'], other_body['x'] - body['x'])
                acceleration = (GRAVITY_CONSTANT * body['m'] * other_body['m'] / dist ** 2) / body['m']

            body['x'] += math.cos(angle) * body['vx']
            body['vx'] += acceleration

            body['y'] += math.sin(angle) * body['vy']
            body['vy'] += acceleration

when these bodies interact, something unexpected happens when their x/y values are approaching one another -- the bodies move at extremely high speeds and seemingly disappear off the screen.

For example, if we have a body at (200, 100) and another at (200, 300), they do not gravitate towards one another as they would do in a situation where they have unique (x, y) values such as (200, 100) and (300, 400).

Looking at the code, as the y-values of body and other_body approach one another, values get exceedingly large(?)

I can't quite pin down the issue as I'm a beginner. Any suggestions/criticism?

sentences:
HTML5 clicking objects in canvas I have a function in my JS that gets the user's mouse click on the canvas.

Now lets say I have a random shape on my canvas (really its a PNG image which is rectangular) but i don't want to include any alpha space.

My issue lies with lets say i click some where and it involves a pixel of one of the images. The first issue is how do you work out the pixel location is an object on the map (and not the grass tiles behind).

Secondly if i clicked said image, if each image contains its own unique information how do you process the click to load the correct data.

Note I don't use libraries I personally prefer the raw method. Relying on libraries doesn't teach me much I find.

sentences:
Creating a player that can hold different items I am making a game using Java, LibGDX and Box2D. What would be the best way to create a player that can hold:

no item
one item from group A
one item from group B
one item from both groups

Items from group A can only be used to attack, and are held in the right hand.
Items from group B can only be used to defend, and are held in the left hand.

Should I add the item to the player class and render/update the item in the player class? Or is there any best way to this that I am not aware?

This is the best way I know how to do it:

I would also be interested in any design pattern that could be applied to this situation.

sentences:
Storing voxels for a voxel Engine in C++ I am trying to write a little voxel engine because it's fun, but struggle to find the best way to store the actual voxels. I'm aware I will need chunks of some sort so I don't need to have the entire world in memory, and I'm am aware I need render them with reasonable performance.

I read about octrees and from what I understand it starts with 1 cube, and in that cube can be 8 more cubes, and in all those 8 cubes can be another 8 cubes etc. But I don't think this fits my voxel engine because my voxel cubes/items will all be the exact same size.

So another option is to just create an array of 16*16*16 size and have that be one chunk, and you fill it with items. And parts where there aren't any items will have 0 as value (0 = air). But I'm afraid this is going to waste a lot of memory and won't be very fast.

Then another option is a vector for each chunk, and fill it with cubes. And the cube holds its position in the chunk. This saves memory (no air blocks), but makes looking for a cube at a specific location a lot slower.

So I can't really find a good solution, and I'm hoping someone can help me with that. So what would you use and why?

But another problem is rendering. Just reading each chunk and sending it to the GPU using OpenGL is easy, but very slow. Generating one mesh per chunk would be better, but that means every time I break one block, I have to rebuild the entire chunk which could take a bit of time causing a minor but noticeable hiccup, which I obviously don't want either. So that would be harder. So how would I render the cubes? Just create all the cubes in one vertex buffer per chunk and render that and maybe try to put that in another thread, or is there another way?

Thanks!

sentences:
Optimization and Saving/Loading I'm developing a 2D tile based game and I have a few questions regarding it.

First I would like to know if this is the correct way to structure my Tile class:

namespace TileGame.Engine {
    public enum TileType {
        Air,
        Stone
    }

    class Tile {
        TileType type;
        bool collidable;

        static Tile air = new Tile(TileType.Air);
        static Tile stone = new Tile(TileType.Stone);

        public Tile(TileType type) {
            this.type = type;

            collidable = true;
        }
    }
}

With this method I just say world[y, x] = Tile.Stone and this seems right to me but I'm not a very experienced coder and would like assistance.

Now the reason I doubt this so much is because I like everything to be as optimized as possible and there is a major flaw in this that I need help overcoming. It has to do with saving and loading... well more on loading actually. The way it's done relies on the principle of casting an enumeration into a byte which gives you the corresponding number where its declared in the enumeration. Each TileType is cast as a byte and written out to a file. So TileType.Air would appear as 0 and TileType.Stone would appear as 1 in the file (well in byte form obviously). Loading in the file is alot different though because I can't just loop through all the bytes in the file cast them as a TileType and assign it:

for(int x = 0; x < size.X; x++) {
     for(int y = 0; y < size.Y; y+) {
          world[y, x].Type = (TileType)byteReader.ReadByte();
     }
}

This just wont work presumably because I have to actually say world[y, x] = Tile.Stone as apposed to world[y, x].Type = TileType.Stone. In order to be able to say that I need a gigantic switch case statement (I only have 2 tiles but you could imagine what it would look like with hundreds):

Tile tile;
for(int x = 0; x < size.X; x++) {
     for(int y = 0; y < size.Y; y+) {
          switch(byteReader.ReadByte()){
               case 0:
                    tile = Tile.Air;
                    break;
               case 1:
                    tile = Tile.Stone;
                    break;
          }
          world[y, x] = tile;
     }
}

Now you can see how unoptimized this is and I don't know what to do. I would really just like to cast the byte as a TileType and use that but as said before I have to say world[y, x] = Tile.whatever and TileType can't be used this way.

So what should I do? I would imagine I need to restructure my Tile class to fit the requirements but I don't know how I would do that. Please help!

Thanks.

sentences:
How to compute acceleration by using Kinect device joint positions I have an application which uses the Microsoft Kinect camera device.

At each point I can obtain the position of my hand in the 3 Dimensional space ( X - Y - Z ) and I want to compute acceleration of my hand over each second on each axis.

Basically, I can obtain the coordinates at each frame(where 1 sec = 30 frames), and I want to compute the acceleration of my hand in 1 sec.

StartPoint - (x1, y1, z1)

EndPoint after 1 sec from StartPoint ( 30 frames ) - (x2, y2, z2)

Acceleration between StartPoint and EndPoint = ?

Also I can obtain all the other coordinates of my hand over time, but I want to compute the acceleration in the period of time between start point and end point.

Could you please explain or show me how?

sentences:
Run menu in gameloop or as activity? Currently I am running my menu (with buttons "new game" and "choose level") as an xml view of an activity, that then starts my gameactivity with custom view run on a gameloop. But Im starting to see some restrictions with this.

Would it be a terrible idea to let the menu be part of the gameloop and just add another state for it, like gameState = MENU ? and then render and update touch accordingly.

Does anyone have any experience with this and if so how did you choose to solve it?

sentences:
How to build repetition into a game that won't ruin the experience I am building an Educational technology (Edtech) game that attempts to follow the format of an adventure RPG while teaching foreign languages.

Obviously, EdTech games must actually teach, which requires repetition for mastery. Especially foreign languages which requires a lot of practice to master. But, the game's goal is for the story line and game world to be immersive to the point the player is hooked in. Repetition often destroys the immersive aspect and linearity of a story.

What are some strategies to ensure the necessary repetition is happening such that a student retains the information, but also has fun playing along with the story? Are there any?

sentences:
How to spawn an object on collision in box2d + love2d? I'm trying spawn collidable debris from a ship when it explodes in love2d/box2d, however,  World:isLocked() is true when collision callbacks are called:

  This will return true inside the callbacks from World:setCallbacks.
  (source)

So creating a new body throws an error. Are there any workarounds for this?

sentences: How do you transition to playing in XNA? I have two classes in my game, a Main Menu and the main playing screen. How can I swap through classes? E.g I click on "New Game" in the menu class and it changes it too the Game class.  A transition animation explanation would be nice.

sentences:
How to render portals in OpenGL? I am making RPG in OpenGl and I need to make some portals.
How should I render it if I want to see through the portal on the other side?

sentences:
How can users verify a game distributed peer-to-peer has not been modified maliciously? I'm interested in p2p software distribution, and I'm also directly including a modding interface into my game, which is built on my own custom engine.
I was working with a folder inside of the Roaming folder to store the data (resource, saves... etc), and I quickly figured out a malicious programmer could easily modify my program and make or erase (at least) folders.
How would one prevent this kind of modification, without owning the whole distribution process?
Do you really have to trust the provider/source to trust the software? Or could you trust software on the client side using some hash or such?
The only solution I can think of would be having a website on which I put a hash of my game, and any user that gets an instance of my game can verify it was not modified by hashing it and comparing it with the one on my website. But it is definetely not user-friendly at all...

sentences:
XNA CustomModelAnimationSample problem I downloaded the official tutorial from:CustomModelAnimationSample
It works fine but when I try to replicate it in my project, it fails to load the Tag property in my model.

Is found that the probelm is in the line:

skinnedModel = Content.Load<Model>("DudeWalk");

This line loads the model from the DudeWalk.fbx file and with the custom SkinnedModelProcessor. It loads the animations data in the model. After the line the Tag property is full. I stepped into the method and it went to the custom ModelData class.

I copied everything from the projects CustomModelAnimationWindows and CustomModelAnimationPipeline to my solution and set all the references. I tried the same line of code and couldn't step in the method. It called the default method or model constructor and after the line the model's Tag propetry was null.

I have to load the model through my custom SkinnedModelProcessor class, but how I tell the game to use this class? In the tutroail CustomModelClass the line is changed to:

model = Content.Load<CustomModel>("tank");

So I assumed that I have to set the generic type to a custom model class, but the first example works without it.

If anyone has some useful advice or some other helpful link, I'll be happy to try it.

EDIT :

I tried this tutorial Creating a Custom Importer and Processor but it didn't work either.

I understand now that the binding of the custom pipeline processor is done at build-time and not a run-time. But my custom processor never gets bound nor called.

sentences:
LibGDX: Can i get some useful tips for loading textures? So basically in my game(completely new to gave dev) I have a level select screen. I have 8 Buttons to select the levels and i use an asset manager to load the textures for the buttons. For example their is a locked button for when you have unlocked the level, an active for when your mouse is over the button and inactive when your mouse is not over it. My problem is that having all these textures keep interchanging is causing memory usage to go off the charts, from as low as 30mb all the way over 1000mb as soon as i go to the level select screen and it keeps rising. Whats a good way to load lots of textures without having to use so much memory? Or should i just figure out a better way to load them without causing so much usage of memory. Im new to this so go easy on me :)

or... Would this amount of memory being sprung be a memory leak somewhere?

Edit: Heres the code snippet where the memory leak i traced to i believe.

I'm calling this method in my handleInput which i then call in the render method.

public void levelManager(float rowX, float rowY, Screen setScreen, Texture drawActive, Texture drawInactive,
        float multiplier) {
    if (Gdx.input.getX() / GravitySpikesRevamped.PPM < (rowX + BUTTON_WIDTH) / GravitySpikesRevamped.PPM
            && Gdx.input.getX() / GravitySpikesRevamped.PPM > rowX / GravitySpikesRevamped.PPM
            && (GravitySpikesRevamped.GAME_HEIGHT - Gdx.input.getY())
                    / GravitySpikesRevamped.PPM < (rowY + BUTTON_HEIGHT) / GravitySpikesRevamped.PPM
            && (GravitySpikesRevamped.GAME_HEIGHT - Gdx.input.getY()) / GravitySpikesRevamped.PPM > rowY
                    / GravitySpikesRevamped.PPM) {

        if (multiplier == 1) {
            game.batch.draw(drawActive, BUTTON_WIDTH / 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 2) {
            game.batch.draw(drawActive, BUTTON_WIDTH * 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 3) {
            game.batch.draw(drawActive, BUTTON_WIDTH * 3.5f / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        }

        if (Gdx.input.isTouched()) {
            game.setScreen(setScreen);
        }
    } else {

        if (multiplier == 1) {
            game.batch.draw(drawInactive, BUTTON_WIDTH / 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 2) {
            game.batch.draw(drawInactive, BUTTON_WIDTH * 2 / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        } else if (multiplier == 3) {
            game.batch.draw(drawInactive, BUTTON_WIDTH * 3.5f / GravitySpikesRevamped.PPM,
                    rowY / GravitySpikesRevamped.PPM, BUTTON_WIDTH / GravitySpikesRevamped.PPM,
                    BUTTON_HEIGHT / GravitySpikesRevamped.PPM);
        }
    }

Okay i solved it, basically in my method above every time i called it was creating a new screen. So i basically was creating infinite amount screens in memory. I fixed it :]

sentences:
model view projection multiplication order I'm debugging a lighting problem where the camera position is effecting the diffused lighting component on my 3d model. In researching my problem I went back and am reading over all the how to documents. I found that one of my old sources (where I learned open gl 2.0) said this (summarized):

  When creating the modelViewProjection matrix you can't change the order or you'll get unexpected results.  First take the View Matrix and post-multiply it by the projection matrix to create a viewProjection matrix. Then post-multiply the model matrix to get the modelViewProjection matrix.

Looking at my code, all this time I haven't been doing this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mModelView, mModelViewProjection);

As a test I tried changing it to this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mView, mViewProjection);
matrixMultiply(mViewProjection, thisItem->objModel, mModelViewProjection);

...but the result appears the same.

EDIT: To answer a question about what the matrices contain. A snapshot of the matrix values:

EDIT2: As a test I did the math both ways to compare the results and even with moving the camera and model around and rotating the model I'm getting the same results for the final ModelViewProjection.

sentences:
cocos2d Merging box2d bodies i'm using cocos2d to build an iphone game.

my game currently has two sprites: one for the main character and another for an item i should carry once he gets on him.

the main character and the item are both box2d bodies. i can detect the collision between the two. what is want is to make the item body stick to the main character body when they meet, that way any movement of the main character would also affect the item.

any suggestions on how to implement this?

thanks!

sentences:
Dynamically applied texture to GameObject using GUI button In a scene I have multiple different GameObjects (almost 30 kinds) with parent child relationships. At run time (by using a GUI button) I want to change the texture of each clicked GameObject. As the user clicks specific GameObjects, a GUI with a multiple texture button will appear. By clicking on the button, that specific texture will be applied.

Is there a smarter way to do this?

Do I need to apply a script to every object?

I have tried to apply a script with some specific code; it's working but not regularly and correctly.  Additionally, I want different texture options for each kind of GameObject.

sentences:
Player positions in a race game through arrays or...? First time posting on these forums so go easy on me!

I've been programming a race game which has been going quite well. I've just discovered now how hard it is to set up player positions!(As in 1st, 2nd, 3rd, etc). From research I've discovered that the easiest way of doing this is through checkpoints which I've successfully managed to set up. Each player races through the checkpoints in the game and this progress is stored as an int. There's 2 int, one for laps and one for checkpoints. When the checkpoint integer reaches a certain number it resets back to zero and the lap integer is incremented.

I was planning to compare these to work out player positions. Hopefully by putting them into arrays and then sorting them so it could tell me the player's positions in the race as the person with the high lap and checkpoint count would surely be the highest ranked.

Also to make the measuring of player positions more accurate I've measure the distance between checkpoints. At each checkpoint it works out how far the player is from the next point and using the distance from the previous to the next I'm able to generate a percentage which tells me how far the player is from the lap.

What I was hoping to do is create an integer worked out from the players race progress. So for example going through a checkpoint would increment the player's race progress integer by 100. If there were 12 checkpoint a complete lap would obviously be 1200. 2 laps would be 2400 and so on. By inverting the percentage I generated earlier it gives me the distance to the next checkpoint. so for example a player 75% towards the 4th checkpoint in their first lap would have an integer of 375, whereas a player 50% towards the first checkpoint in their second lap would have an integer of 1250.

I hope that logic made sense.

So what I'm essentially looking to create is a sort of table, using the player's object or even a unique player id as an index. And then to sort this table by the player position int.

I think this maybe possible through multidimensional arrays but I'm quite unsure. I've looked into associative arrays, dictionaries and hashtables but I'm still pretty unclear on what to do.

Would really appreciate being pointed in the right direction.
Thanks!

sentences:
How do i store blocks information in my Voxel game? I am trying to make a voxel game.

Voxel games made by blocks and each block has it's own information such as durability, step sounds, strength, ...

How do i store these information inside of blocks? or is it true to save their information inside of themselves.

Do i store them on all blocks instances or static properties?

public class Block
{

    public virtual float durability
    {
        get
        {
            return 1f;
        }
    }

    public virtual float strength
    {
        get
        {
            return 1f;
        }
    }

    public virtual StepSound stepSound
    {
        get
        {
            return new StepSound ( "stone.ogg" );
        }
    }

}

Then create a class by inheriting Block class:

public class BlockDirt : Block
{

    public override float durability
    {
        get
        {
            return 0.5f;
        }
    }

    public override float strength
    {
        get
        {
            return 0.5f;
        }
    }

    public override StepSound stepSound
    {
        get
        {
            return new StepSound ( "dirt.ogg" );
        }
    }

}

Now i have all the above properties inside of any BlockDirt instances.

But it takes to much memory. just think i have 100 BlockDirt.

Or Do i create a base class:

public class Block
{

}

Then inherit it for creating blocks:

public class BlockDirt : Block
{

    public static StepSound stepSound = new StepSound ( "dirt.ogg" );
    public static float durability = 0.5f;
    public static float strength = 0.5f;

}

And use the BlockDirt static properties for all BlockDirt instances?

I don't know how to get static properties from class instance, but i know i can do it using Reflection but it takes more CPU and memory than instance based data.

What should i do?

Any help is appreciated.

sentences:
Game Maker not recognizing variable Attempting to set up a targeting array for a MMO-style game in GameMaker8 Pro, I have this code in the create event for the player's character, which is and has been running perfectly fine:

j = 0
i = 0
g = 0
for (i=100000; i<1000000; i+=1) if instance_exists(i) {if i.object_index = enemy         {global.ttarget[j] = i j+=1}  if i.object_index = rk or i.object_index = sage    {global.etarget[g] = i g += 1}}
global.rmtargets = j
global.etargets = g

Then running this code in the step event for the player character:

h = 0
g = 0
i = 0
for (i=0; i<global.rmtargets; i+=1) global.target[i] = 0
global.target[0]=101139
for (h = 0; h<global.rmtargets; h+=1){hv = -1
for (g = 0; g<global.rmtargets; g+=1){if global.ttarget[g].range > hv {hv =    global.ttarget[g].range}}
global.target[h] = hv
global.ttarget[h] = -1}

Returns this error message:

ERROR in
action number 1
of  Step Event
for object rk:

Error in code at line 8: for (g = 0; g hv {hv = global.ttarget[g].range}}
at position 61: Unknown variable range

Even though I have this in the create event for the enemy:

range = 0
range = distance_to_object(rk)

And I've used this sort of syntax all over:

global.target[target].threat[s] += damage

Help? Any ideas why Game Maker won't recognize the variable?

sentences:
How should my game characters store their abilities/spells? I'm new to game development and a bit confused about how to effectively store an object's access to certain spells/abilities.

The player and mob objects are all generated from the same class. However, each object may have access to different abilities and spells. How do I keep track of a specific object's access to these?

Example: My player object might have access to Fireball and Haste, while a goblin might have access to Confusion.

I followed the RogueBasin Python Libtcod tutorial, and I understand how to attach a spell function to scroll use. I'm just not sure how to emulate a character memorizing a spell and using it as an ability.

sentences:
Geometry Shader and Stream Output with Directx11 I am having trouble trying to send verticies generated in the Geometry Shader to Stream Output. What I am trying to accomplish is to generate verticies from the Geometry Shader and store them to a vertex buffer so that I can use the vertex buffer to draw later.

I read that I have to use the CreateGeometryShaderWithStreamOutput function to create a Geometry Shader that can send verticies to Stream Output instead of the rasterization stage.

This is how I am trying to use it:

    device->CreateGeometryShaderWithStreamOutput(this->mGSBlobSO->GetBufferPointer(), this->mGSBlobSO->GetBufferSize(), so_decl, 1, &stride, 1, D3D11_SO_NO_RASTERIZED_STREAM, NULL, &this->mGeometryShaderSO)

I am getting an E_INVALIDARG at this line. I am specifying D3D11_SO_NO_RASTERIZED_STREAM because I think this means that I do not want to send data to the rasterizer but I am not sure. When I replace D3D11_SO_NO_RASTERIZED_STREAM with a 0, I do not get this runtime error, but I do not get the result I want.

How can I setup the geometry shader to store vertices to a vertex buffer in Stream Output?

sentences:
How to better refactor loops in procedural world generation? One of the steps for cell-based dungeon generation is deciding the amount and location of exits for each room. My current set up consists of the following:

Define my exits. There are 15 types of room exits:

Left (L), Right (R), Top (T), Bottom (B).
Every non-redundant combinatoric of two directions (LT, TR, RB, BL, LR, TB)
The same for three directions (LTR, TRB, RBL, BLT)
All directions (LRTB)

Create a list exitsList that contains the type of exit of that index, i.e. exitsList[0] = L means that our first room has a single exit: one to the left.

After creating my basic level layout and having my exit generation ready, it's time to go back to each room and assign its exits, and this is the part I'm having my doubts about.

Currently, my method for assigning rooms is to make a case check looping through each cell. Something such as:

for (each room){
    switch (exitsList[this_room]) {
        case L:
            place_exit_L;
            break;
        case LT:
            place_exit_L;
            place_exit_T;
            break;
        case TR:
        .
        .
        .
        case LTRB:
            place_exit_L;
            place_exit_T;
            place_exit_R;
            place_exit_B;
            break;
        default:
            return_error;
            break;
    }
}

While this can work, it seems very inelegant, and more importantly obnoxious to read by a human. I was able to refactor cases that shared the same type of exit by omitting breaks, for example:

case LTR:
    place_exit_R;
case LT
    place_exit_T;
case L
    place_exit_L;
    break;

But this seems rather arbitrary. I suspect there's a more efficient way to do this, or at least one that won't become a pain to read by other people if the number of exits somehow increases.

sentences:
In Unity, how do I make a mesh change its opacity during runtime? I'm trying to make a isometric game. I want to make it so that when the player goes behind a wall, the wall's alpha goes down.

How do I go about doing this?

I have this code that I made, but I don't understand what's wrong with it.

I already have the wall that's meant to disappear on the "Wall" layer.

using UnityEngine;
using System.Collections;

public class WallAlpha : MonoBehaviour {

    public LayerMask mask =LayerMask.GetMask("Wall");

    void Update() {

        if (Physics.Raycast(transform.position, transform.forward, 100, mask.value))
        {
            transform.GetComponent<Renderer>().material.SetColor("_Color", new Color(1,1,1,0.1f));
            Debug.Log("Something in the way");
        }

        else
        {
            transform.GetComponent<Renderer>().material.SetColor("_Color", new Color(1,1,1,1.0f));
            Debug.Log("Nothing In the Way!");
        }
    }
}

sentences:
How do I detect ledges? In my game, I'd like my character to be able to grab and hold onto ledges, and to be able to pull themselves up if there's room to do so.

How do I detect if there's a ledge, and if the character has enough space to climb up?

sentences:
Calculating initial velocities given trajectory parabola I'm working on a volleyball game but my maths/physics knowledge isn't quite up to par. I need some help with the following problem:

The player can hit the ball from anywhere on the left of the court into one of three points on the right:

    P    | x  x  x

The ball travels in a parabola defined by the three points, all of which are known:

The players X coord and height (Xp, Yp)
The point just above the top of the net (0, Yn) (assume the left of the court is negative along the x axis)
The point where the ball impacts the ground on the other side of the net (Xi, 0)

I need to calculate the initial X/Y velocities when the player hits the ball so that the ball, affected only by gravity, follows that parabola. EDIT Alternatively, the velocity magnitude and angle from which the X/Y component velocities can be calculated.

I'm able to find the function of the parabola using pen and paper but since this involves "saving" equations with unknown variables I have no idea how to translate that to code (how could you have variable a = 2b for example if b is undefined?). I'm not even sure if finding the function is necessary for this problem.

Any help?

EDIT: I just came to the realisation that if I can calculate the flight time then I can divide the distance traveled each frame along the x axis and just plug that into the parabolic function to get the ball's y coordinate. I guess that's my next avenue of research.

sentences:
World Canvas InputField cursor precision/control from RenderTexture output in Overlay UI How do you have a world canvas input field cursor be controllable from the input being mapped from a UI overlay with its raw image supplied from render texture from a render camera?
Described another way:
World Canvas Input Field -> Render Camera creates renderTexture for -> Screen Overlay UI Raw Texture -> Main Camera
How do you have the cursor position be mapped from the Screen Overlay UI Raw Texture?

sentences:
How to set default pose of model from Blender? (Exported as FBX) I have a model that has lots of animation clips(actions).

Before export as FBX, I set the pose to named "default" pose and exported as FBX like this.

But in Unity, it's changed to first animation clip in animation list in Blender!

I try to fix it, but there is nothing I can do. I can't change the order of animations in Blender and Unity either.

This wasn't first time, I had same issues before but I just ignored because it's fine in game play, but I really want to fix it this time.

What I want is set "default" pose in edit mode in Unity(not play mode). How do I set "default" pose as default, not first animation clip in the list?

Using Blender 2.78, and Unity 2017.3.0f3.

sentences: ActionScript 3.0 and iOS In Adobe CS5 you can export games to iOS, but all my research in the past indicated that Apple was not going to support Flash. It's my understanding that Adobe and Apple were working on this at one point and then Apple terminated the project. I was chatting with some other developers about this and one mentioned they were porting an AS3 project to their iPhone. Is there a way to get a Flash App on to the iStore? I don't think so.

sentences:
How To Smoothly Animate From One Camera Position To Another The Question is basically self explanatory. I have a scene with many cameras and I'd like to smoothly switch from one to another. I am not looking for a cross fade effect but more to a camera moving and rotating the view in order to reach the next camera point of view and so on. To this end I have tried the following code:

    firstCamera.transform.position.x = Mathf.Lerp(firstCamera.transform.position.x, nextCamer.transform.position.x,Time.deltaTime*smooth);
    firstCamera.transform.position.y = Mathf.Lerp(firstCamera.transform.position.y, nextCamera.transform.position.y,Time.deltaTime*smooth);
    firstCamera.transform.position.z = Mathf.Lerp(firstCamera.transform.position.z, nextCamera.transform.position.z,Time.deltaTime*smooth);

    firstCamera.transform.rotation.x = Mathf.Lerp(firstCamera.transform.rotation.x, nextCamera.transform.rotation.x,Time.deltaTime*smooth);
    firstCamera.transform.rotation.z = Mathf.Lerp(firstCamera.transform.rotation.z, nextCamera.transform.rotation.z,Time.deltaTime*smooth);
    firstCamera.transform.rotation.y = Mathf.Lerp(firstCamera.transform.rotation.y, nextCamera.transform.rotation.y,Time.deltaTime*smooth);

But the result is actually not that good.

Thank you all, I fixed it this way

 var pos:Vector3 = firstCamera.transform.position;
    var rot:Quaternion = firstCamera.transform.rotation;
    firstCamera.transform.position = Vector3.Lerp(pos, nextCamera.transform.position,Time.deltaTime*smooth);
    firstCamera.transform.rotation = Quaternion.Lerp(rot, nextCamera.transform.rotation,Time.deltaTime*smooth);

sentences:
How can I create a .ico file with all the various resolution sizes within one container? I was looking at this GOG.ico in ffmeg, and was surprised to see all the streams for it...indicating it was holding multiple images in the .ico container or .ico has some kind of self-creation function where it generates the resolutions from a singular image based on condition? Or Maybe I'm overthinking it and its just a container with 7 different image variants stored inside?
Regardless I was curious on what the method of creation was for this many .ico in one hybrid, and how to replicate it. I'm already familiar with how to create a singular .ico image using gimp and/or ffmpeg....gimp is probably using ffmpeg itself. If its 7 images, those can be mapped to various streams of the .ico container using a tool like ffmpeg.
What's a more automated workflow people use to create these kinds of elaborate .iso though?

sentences:
how do i make the JS/jquery tic tac toe squares only clickable once? As i have it now my script makes the 3x3 grid clickable, and I dont know exactly how to turn on the click once it has been clicked. This is using jQuery and a simple if else statement to switch between turns.

    $(document).ready(function(){
  var turn = 0;
    $("#cell11, #cell12, #cell21,  #cell22, #cell13, #cell23, #cell31, #cell32, #cell33, ")
            .click(
            function(){
                var cell = $(this);
                if(turn===0){
                    turn = 1;
                cell.css("background","url(images/o.png)");
                }
                else{
                    turn = 0;
                    cell.css("background","url(images/x.png)");
                }
            })
});

sentences:
How can I create an array of GameObjects? I need to add one assest multiple times in my scene similar to the blender array tool and I was wondering what is the best way to do this because adding each asset individually and setting there locations doesn't seem like the best way to do it. I need to:

Create multiple sprites quickly
Be able to set the distance between the sprites
Set the number of sprites

How can I do this in the editor preferably without any plugins?

sentences: Is there any JavaScript game library good for mobile gaming? I do not know how should I ask this question. I am a very new in this field. I want to learn game development. I want to learn it for Android and iPhone game development. That's why i was looking for JavaScript game engine or libraries. But, I got many. I do not know which one will good for me for 2D or 3D JavaScript game development.

sentences:
How to express and verify euler rotation limits in Unity I need to find a way to set min and max angles for each Euler component and check whether transform.localEulerAngles falls within those limits.

My current code looks like this:

class JointLimit : MonoBehaviour
{
    [SerializeField]
    [Range(-180f, 180f)]
    private float minX = -180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float maxX = 180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float minY = -180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float maxY = 180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float minZ = -180f;
    [SerializeField]
    [Range(-180f, 180f)]
    private float maxZ = 180f;

    public float Error
    {
        get
        {
            Vector3 localEuler = transform.localEulerAngles;
            Vector3 signedLocalEuler = new Vector3(Mathf.DeltaAngle(localEuler.x, 0), Mathf.DeltaAngle(localEuler.y, 0), Mathf.DeltaAngle(localEuler.z, 0));

            float error = 0;
            error += Mathf.Max(0, minX - signedLocalEuler.x);
            error += Mathf.Max(0, signedLocalEuler.x - maxX);
            error += Mathf.Max(0, minY - signedLocalEuler.y);
            error += Mathf.Max(0, signedLocalEuler.y - maxY);
            error += Mathf.Max(0, minZ - signedLocalEuler.z);
            error += Mathf.Max(0, signedLocalEuler.z - maxZ);
            return error;
        }
    }
}

This basically checks whether the Euler components fall within the specified range and sums the exceeding angles up to an error.

The problem is that Unity internally stores rotations as Quaternions and that there can be several euler representations for a single Quaternion, like Euler 123f, 17f, 235f and Euler 57f, 197f, 55f are the same thing.

Is there any way I can bring an Euler representation into some kind of normalized form that allows me to reliably check it against my limits?

sentences:
How to properly manage game music and sounds? I'm developing a WinForms customized version of Pac-Man for a Software Engineering project and I reached the point where I have to implement music and sound effects. I used the MVC architectural pattern, so almost every entity in the game has: a model, a view and a controller (for example, I have a MainMenuModel, a MainMenuView and a MainMenuController).

In order to play music and sounds I decided to use the System.Windows.MediaPlayer class (because the System.Media.SoundPlayer one cannot play two sounds simultaneously). More specifically, I put in every controller the related MediaPlayer objects. So, for example, in the MainMenuController I put: the MenuBackgroundMusicPlayer, the MenuItemSelectionSoundPlayer and the MenuItemOpeningSoundPlayer.

This solution works fine, but I would like to know if it is considered bad design to have multiple instances of MediaPlayer spread all over the controllers, instead of having a single static centralized MediaPlayer instance that handles everything. The problem with having a single instance is that I don't know then how to play two or more sounds simultaneously, because a single MediaPlayer object can handle a single media at a time.

sentences:
Entity system game design and input handler I have started create a lightweight game engine with Ogre and C++. I have a abstract component class and an abstract entity class.

#ifndef ENTITY_HPP_
#define ENTITY_HPP_

#include <string>
#include <vector>

#include "Component.hpp"

class Entity
{
public:
    Entity(int uniqueId) { m_UniqueId = uniqueId; };
    ~Entity();

    void AddComponent(Component *comp);
    void RemoveComponent(Component *comp);

    Component *GetComponent(m_ComponentTypes type);

    int GetID() { return m_UniqueId; };
protected:
    std::vector<Component*> m_Components;
    int m_UniqueId;
};

#endif /* ENTITY_HPP_ */

Component:

/*
 * Component.hpp
 *
 *  Created on: Jul 15, 2013
 *      Author: dominik
 */

#ifndef COMPONENT_HPP_
#define COMPONENT_HPP_

#include <string>

class Entity;

typedef enum
{
    MESH_COMPONENT,
    POSITION_COMPONENT,
} m_ComponentTypes;

class Component
{
public:
    Component(m_ComponentTypes type) { m_Type = type; m_pParent = NULL; };
    virtual ~Component();

    void SetParent(Entity *entity) { m_pParent = entity; };
    Entity *GetParent() const { return m_pParent; };

    m_ComponentTypes GetType() const { return m_Type; };

protected:
    Entity *m_pParent;
    m_ComponentTypes m_Type;
};

#endif /* COMPONENT_HPP_ */

After this I created an EntityManager where I manage all entities in the game world, an a rendersystem where I render all entities and initialize Ogre. Now I have a window, but I need the escape button managed -> so I implement an inputsystem and here is the problem. My InputSystem works with OIS which needs a handle to the window, the handle to the window is available in the RenderSystem but not in the InputSystem, how can I get this data?

Here is my engine class:

/*
 * Engine.hpp
 *
 *  Created on: Jul 15, 2013
 *      Author: dominik
 */

#ifndef ENGINE_HPP_
#define ENGINE_HPP_

#include "EntityManager.hpp"
#include "RenderSystem.hpp"

#include <vector>

class Engine
{
public:
    static Engine *GetInstancePtr()
    {
        if (!instance)
            instance = new Engine();

        return instance;
    }

    EntityManager *m_pEntityManager;

    void update(double timeSinceLastFrame);
    void loop();

    void Shutdown() { m_bShutdown = true; };
private:
    static Engine *instance;

    Engine()
    {
        m_pEntityManager = new EntityManager();

        m_Systems.push_back(new RenderSystem());

        m_bShutdown = false;
    }
    Engine(const Engine&);

    ~Engine()
    {
        delete m_pEntityManager;

        while(!m_Systems.empty())
        {
            System *sys = m_Systems.back();
            delete sys;
            m_Systems.pop_back();
        }
    }

    std::vector<System*> m_Systems;

    bool m_bShutdown;
};

#endif /* CORE_HPP_ */

In my Engine singleton I have only the abstract system class, so I can't get the window handle. Is there a nice solution?

Any suggestions? Is my approach correct, or is it limitated in any way?

How should I implement the input manager, should he handle all the clicks on keyboard and mouse and send events, or should I create a component with the input manager fields and react on this in this entities which have this component added?

sentences:
Getting Started with Component Architecture: DI? TLDR:  if I have entities like Ship and Bullet and components like Positionable and Drawable, should I create interfaces for each component and inject them into my entities using DI, or should I be doing something else?

(In this case, Ship would extend IPositionable and have an instance of a PositionableComponent which is injected by DI. Any calls to ship.getX or ship.setX would be implemented as myPositionable.getX or myPositionable.setX.)

I just moved away from MVC towards something more component-architecture-like. I have no concept of messages yet (it's rough prototype code), objects just get internal properties and values of other classes for now.

That issue aside, it seems like this is turning into an aspect-oriented-programming challenge. I've noticed that all entities with, for example, a position component will have similar properties (get/set X/Y/Z, rotation, velocity).

Is it a common practice, and/or good idea, to push these behind an interface and use dependency injection to inject a generic class (eg. PositionComponent) which already has all the boiler-plate code?

(I'm sure the answer will affect the model I use for message/passing)

Edit: The DI model I'm proposing is as follows.

Create entity classes like Ship and Bullet
Create interfaces to represent these components. Eg. I can expect a PositionableComponent.getX method.
Create component classes like PositionableComponent, DrawableComponent which implement my interface
Entities like Ship will have components like PositionableComponent. They will implement the methods by internally keeping an instance of a positionalbleComponent and redirecting all interface calls to the component.
My DI framework will (presumably automatically) wire up components by interface, eg. Ship._positionableComponent = new PositionableComponent(). This is how NInject works, which is the only framework I've ever used (and I'm working in Haxe now).

This will allow me to work on a higher level (ships contain components), and reduce boilerplate code (component implementations), but introduces duplicate code (redirecting to the internal component). Since I'm working in Haxe, I may be able to avoid writing that boilerplate by hand.

However, the advantage is that I can override component behaviours. If undeadMonster.IsAlive() should return true when its HP is above -100 (instead of 0), I can easily code this, and the change becomes very visible from the code level.

But I'm not sure if I'm solving this correctly.

sentences:
XNA4 - Trouble updating part of a Texture2D I have a big Color[] ColorMap in memory (1280x720), and I have a Texture2D that I've uploaded this ColorMap to.
I update parts of the in-memory ColorMap, and want to upload those changed parts to the texture. I'd rather not re-upload the entire texture every time, so I'd like to use

public void SetData<T> (
     int level,
     Nullable<Rectangle> rect,
     T[] data,
     int startIndex,
     int elementCount
)

As far as I can see, I can not use this directly to upload just a part of my in-memory map to the texture since I can't specify a stride in the SetData method.

So say I'd like to update the area specified by DirtyRect, I'd first need to create a temporary in-memory buffer

Color[] tempBuffer = new Color[DirtyRect.Width*DirtyRect.Height];

then copy the wanted data from my ColorMap to the tempBuffer, and then upload the tempBuffer to my Texture2D like

Text.SetData<Color>(0, DirtyRect, tempBuffer, 0, DirtyRect.Width*DirtyRect.Height);

This seems to work - sometimes... But sometimes it appears in the wrong place ?!

If I get rid of the rectangle code and reupload the entire texture every time using

Tex.SetData(ColorMap);

it works fine, so apparently I must be doing something wrong.

Anyone got any idea? Or is there any code-example of updating only parts of a texture that I can have a look at (XNA 4)?

sentences:
How do I simplify this code with an Array and counting int up in Unity? I want to simplify my code. I had the idea of making an Array of waypoints[] and and int i to count up each time I arrive a new point of waypoint but it should be the same way my code is but instead of waypoint1.position... waypoint3.position I thought it should be like waypoint[i].position and it counts up everytime I reach another waypoint this would simplify a lot and would make the code much shorter.
The code is for moving an Object from A to B from B to C and so on..

I commented some lines how it would look like but ignore the //MOVE //ROTATE comments

Code:

public float speed;
public float turnSpeed;

//Starting with these somehow
//public Transform[] waypoints;
//private int i = 0;

public Transform player;
public Transform waypoint;
public Transform waypoint1;
public Transform waypoint2;
public Transform waypoint3;

public bool b0 = true;
public bool b1 = false;
public bool b2 = false;
public bool b3 = false;
public bool b4 = false;

void FixedUpdate ()
{
        if(b0)
        {
            //MOVE
            player.position = Vector3.MoveTowards(player.position, waypoint.position, speed * Time.deltaTime);
            //ROTATE
            var rotation = Quaternion.LookRotation(waypoint.position - player.position);
            player.rotation = Quaternion.Slerp(player.rotation, rotation, turnSpeed * Time.deltaTime);

            float distance = Vector3.Distance(player.position, waypoint.position);
            //Debug.Log (Mathf.Round(distance));
            if(distance <= 1)
            {
                // i++;
                b1 = true;
                b0 = false;
            }
        }

        if(b1)
        {
            //MOVE
            player.position = Vector3.MoveTowards(player.position, waypoint1.position, speed * Time.deltaTime);
            //ROTATE
            var rotation1 = Quaternion.LookRotation(waypoint1.position - player.position);
            player.rotation = Quaternion.Slerp(player.rotation, rotation1, turnSpeed * Time.deltaTime);

            float distance1 = Vector3.Distance(player.position, waypoint1.position);
            //Debug.Log (Mathf.Round(distance1));
            if(distance1 <= 1)
            {
                b1 = false;
                b2 = true;
            }
        }

        if(b2)
        {
            //MOVE
            player.position = Vector3.MoveTowards(player.position, waypoint2.position, speed * Time.deltaTime);
            //ROTATE
            var rotation2 = Quaternion.LookRotation(waypoint2.position - player.position);
            player.rotation = Quaternion.Slerp(player.rotation, rotation2, turnSpeed * Time.deltaTime);

            float distance2 = Vector3.Distance(player.position, waypoint2.position);
            //Debug.Log (Mathf.Round(distance1));
            if(distance2 <= 1)
            {
                b2 = false;
                b3 = true;
            }
        }

        if(b3)
        {
            //MOVE
            player.position = Vector3.MoveTowards(player.position, waypoint3.position, speed * Time.deltaTime);
            //ROTATE
            var rotation3 = Quaternion.LookRotation(waypoint3.position - player.position);
            player.rotation = Quaternion.Slerp(player.rotation, rotation3, turnSpeed * Time.deltaTime);

            float distance3 = Vector3.Distance(player.position, waypoint3.position);
            //Debug.Log (Mathf.Round(distance1));
            if(distance3 <= 1)
            {
                b3 = false;
                b4 = true;
            }
        }
}

sentences:
How to code a Game Grid in Java? Suppose I wanted to code a game grid in java. Not an abstract text one but an actual grid with graphics and 'cells'. Would I have to draw line by line or is there a more efficient way? Also how would I go moving units (objects) around the grid, moving them and repainting their positions?

  public static int [] [] map = {{2,0,1,0,0}, // e.g. 2 is base
                                   {1,0,0,0,0},
                                   {0,0,0,0,0},  //1 is unit
                                   {0,0,0,0,0},
                                   {0,0,0,0,2}};

I still wonder if there is a resemblance between 2D arrays and actual game grids as I can just paint coordinates and lines. However I feel there is a better way and want to implement a structure like above (the code) to emulate a map like this:

sentences: XNA development tutorials Can anybody guide me about where can I get the basic starter tutorials for developing using XNA framework?

sentences:
Quaternion Rotation Help So I'm making a little engine with DirectX 11 and C++. (Some other help from other API's as well) DirectX has this function XMMatrixRotationQuaternion(XMVECTOR quaternion). I know nothing about this so excuse my cluelessness. I have a few questions about them that maybe someone could help me with.

Do I use XMMatrixRotationQuaternion(XMVECTOR quaternion) and multiply the resultant Matrix with my scaling matrix and translation matrix to get my transformation matrix?
How can I convert an angle (let's say in radians) to a quaternion. I've tried to look at this and what I got was something like this(I have a feeling this isn't anywhere close to correct)...
Lastly, do I need to normalize that XMFLOAT3 axis?

static XMVECTOR XMConvertToQuaternion(XMFLOAT3 axis, float radian)
{
   return XMVectorSet(cos(radian/2), sin(radian/2)*cos(axis.x), sin(radian/2)*cos(axis.y), sin(radian/2)*cos(axis.z));
}

sentences:
Choosing the correct normal for a collision I have taken the task of building a basic impulse physics engine. Circle vs Circle collision resolution has been done and I moved onto Line vs Circle. I can detect a collision and know that the normal should be perpendicular to the line which can be calculated easily (2d physics engine). However it's the direction of the normal that I cannot work out.

From the image you can see there are 2 possible normals, one upwards (the correct one) and one downwards. How do I choose the correct normal?

sentences:
Problem building a color grading map I am trying to build a default color grading map into a 1024x32 RenderTarget.
Here is my shader code:

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Position = float4(input.Position,1);

    output.TexCoord = input.TexCoord;
    return output;
}

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{
    float temp = TexCoord.r*1024;
    float4 result = (float4)0;
    result.a = 1;
    result.r = (temp%32)/32;
    result.g = TexCoord.g;
    result.b = TexCoord.r;

    return result;
}

I'm using Catalin Zima's quad renderer to render the color grading map AND to render the contents of the texture back onto the screen. Here is the copy shader:

texture Texture;
sampler targetSampler = sampler_state
{
    Texture = (Texture);
    AddressU = CLAMP;
    AddressV = CLAMP;
    MagFilter = POINT;
    MinFilter = POINT;
    Mipfilter = POINT;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Position = float4(input.Position,1);

    output.TexCoord = input.TexCoord + halfPixel;
    return output;
}

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{
    return tex2D(targetSampler, TexCoord);
}

When I take the resulting image into the Photoshop, the bottom right pixel of the texture always equals (247, 247, 255), even though top left color equals zero.

What could be the problem? I checked the quad renderer class - it is recording texture coordinates exactly 0,1 into the quad's corners. I am aligning pixels to texels with the halfPixel and using point texture sampling. Somewhy the V component of texture coordinates never reaches one. I have no clue where the problem can be. As I plan to use this texture for color grading, the accuracy is crucial.

UPDATE: So far I can only achieve the needed result with the folowing shader code:

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{

    float temp = TexCoord.r*1024;
    float4 result = (float4)0;
    result.a = 1;
    float m = (temp%32);
    result.r = m/32+0.035f*m/32;
    result.g = TexCoord.g+0.035f*TexCoord.g;
    result.b = TexCoord.r;

    return result;
}

Which is very wierd.

UPDATE 2: Ok, I had to modulo divide over 33 instead of 32, but I still have to correct the V coordinate.

float4 PixelShaderFunction(float2 TexCoord : TEXCOORD0) : COLOR0
{
    float temp = TexCoord.r*1024;
    float4 result = (float4)0;
    result.a = 1;
    float m = (temp%33);
    result.r = m/33;//+0.035f*m/33;
    result.g = TexCoord.g+0.035f*TexCoord.g;
    result.b = TexCoord.r;

    return result;
}

sentences:
Getting Bodies to go "Super Fast" in Box2D I am making a breakout game in Android using the LibGDX version of Box2D. I have a ball that I am applying a force to with the following code...

getBody().applyForceToCenter(-10000000000.0f, -10000000000.0f);

This makes the ball move properly, but it never seems to gain a lot of speed (and I want to make it go super fast). I tried adding an accelerate method where I applied the force 40 times, but again it doesn't seem to move that fast. What is a good way to make a Body go "Super fast" in Box2D?

If there is acceleration I would like it to be as short as possible.

I tried adding the following....

World.setVelocityThreshold(1000000.0f);

But now the ball doesn't seem to "bounce" off walls, do I need to raise my restitution or something?

sentences: Does Animator.SetBool take precedence over Animator.SetTrigger in Unity's Animator? I've got an Animator with transitions from Idle to Walk or Dash. Walk requires isGrounded to be true and a float MoveX to be greater than .2. The Dash animation requires Dash trigger is returned. In my code, when the shift key is pressed I call anim.SetTrigger("Dash"), if a Walk key is pressed, I set anim.SetBool("Idle") to false and begin increasing MoveX. The problem I'm noticing is that when I play, and hit the dash button, it first starts walking and then after playing that animation it will then perform the dash animation. Looking in the animator as this is happening, it's clear that the walk animation plays in full before moving to the dash animation. What can I do to give priority to the Dash animation when that button is pressed?

sentences: Can I debug XNA Xbox 360 games on my PC? If I made an Xbox 360 game with XNA, would I need to debug it on the Xbox 360 as I was coding it? Or would there be a small emulator on my computer to debug it?

sentences:
Negamax for turn based game I am working on a fast paced turn based game, each turn the player can move left, right or stay put and choose whether or not to fire. Each turn the shots move one block in the direction they are pointing.

I would like to implement NegaMax on this game for curiosity's sake.

Could anyone recommend a brilliant tutorial they tried and found satisfactory?

Thanks

sentences:
Build a vbo once every second I have a VBO storing some data in my game. The thing is, the data can change at a rate of about a second. The data is not fixed size, meaning that some objects will sometimes be visible, sometimes invisible and could even have a different polygon count. I'm trying to figure out how I could do that efficiently using VBOs. In immediate mode, I would simply not call the render method of the single objet, and it would simply not appear! And if I needed more polygons, I would just... call glVertex2f more often! I understand why using immediate mode is really bad in performance, but I really can't think of any good way to "build" the VBO.

I thought about using a list, append the vertices to the list and then create the vbo, but this would have, I think, three drawbacks. More CPU intensive, requires more memory copying, and would require me to recreate (I could work this out) the VBO every time, since I don't know the size before building the lists!

Is there a common way of building a VBO for many small objects without using a list?

Some pseudo code:

void GlobalRender()
{
    foreach (chunk in chunks)
    {
        if (chunk.RequiresUpdate)
        {
            chunk.UpdateVBO(); //In there, that's where I don't know how large I'll need my VBO to be.
        }

        chunk.Render();
    }
}

void UpdateVBO() //The code called above
{
    foreach (node in nodes)
    {
        if (node.Visible)
        {
        //Emit vertices from here!
        }
        else
        {
            //There's nothing here really, just pointing out that there could be no vertices for a single node
        }
    }
}

sentences:
How to rotate and move an object in precise time frame My task is to rotate and move an object into a new position and rotation in a given time. Say I have to move a cube from (0,0,0)|(0,0,0) to (1,1,1)|(0,90,0) in 5 seconds. Could anyone explain to me please how to achieve that?
My experiment is:
private IEnumerator DoMove(/*float time, Vector3 targetPosition*/)
{
    foreach(WayPoints wp in tposes)
    {
        float counter = 0;
        float duration = wp.timeStamp;
        while (counter < duration)
        {
            counter += Time.deltaTime;
            Vector3 curpos = cube.transform.position;
            Quaternion crot = cube.transform.rotation;
            float time = Vector3.Distance(curpos, wp.position.position) / (duration - counter) * Time.deltaTime;
            cube.transform.position = Vector3.MoveTowards(curpos, wp.position.position, time);
            cube.transform.rotation = Quaternion.Lerp(crot, wp.position.rotation, time);
            yield return null;
        }
        Debug.Log("Reached position: " + wp.position.position + " in time: " + Time.time);
    }
}

The cube gets to its position in time, but rotation is late. The end position of the cube should be (2,2,2)|(0,120,0), but it stops moving at (2,2,2)|(0,~110,0).
There are two positions I want the cube to be in:

(1,1,1)|(0,90,0) in 5 seconds
(2,2,2)|(0,120,0) in next 4 seconds

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

This is my proxy.invoke:

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

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

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

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

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

sentences:
How to run skactions randomly Hey guys I need some help I have 2 SkActions.
ball1.run(SKAction.moveTo(y: -self.size.height * 0.2, duration: 1.5))
ball2.run(SKAction.moveTo(y: self.size.height * 1.2, duration: 1.5))

and I want to randomize which one gets called I dont want to run a sequence and no clue how to do it. I've tried a switch statement and an enum but that didn't work.
this is what I have tried. so essentially when I move my player to the right it could be attacked form the top or the bottom.
switch swipeGesture.direction {

case .right:
bat.run(SKAction.moveBy(x: 50, y:0, duration:0.01))
    ball1.run(SKAction.moveTo(y: -self.size.height * 0.2, duration:
1.5)) || ball2.run(SKAction.moveTo(y: self.size.height * 1.2, duration: 1.5))

case .left:
bat.run(SKAction.moveBy(x: -50, y:0, duration:0.01))
       ball1.run(SKAction.moveTo(y: -self.size.height * 0.2, duration: 1.5)) || ball2.run(SKAction.moveTo(y: self.size.height * 1.2, duration: 1.5))

and it gives me an error: Cannot convert value of type 'Void' to expected argument type 'Bool'
If anybody know how to do so that would be great.

sentences:
Any problems with Event usages within XNA on Xbox/Phone This is a slightly vague one but I am currently looking at a couple of areas of my current framework, such as spatial partitioning and UI based menus, and with UI menus it makes sense to have an event based system so you can tell if the user has clicked on it etc... its like your own small version of winforms.

However for some other areas it got me thinking that I could expose a lot of evens for other things, such as when an object moves so it could be re-allocated in a spatial tree of some kind if needed, or if it needed to calculate a collision it could return an event.

Anyway I quite like using events everywhere as it decouples you from having to know about who needs to know what, however I was wondering if there were any hidden gotchas with using events on the Xbox/Phone. I read a few older posts that mentioned that there are performance penalties with events on non PC platform (i.e http://blogs.msdn.com/b/shawnhar/archive/2007/07/09/delegates-events-and-garbage.aspx)

So is this still an issue or has XNA and the .net implementation on these machines improved in this area, as it would be nice to add events of all kinds to high level entities, like Player.HealthChanged, Creature.AnimationStateChanged etc, but I dont want to go exposing these for usage if there is a major performance overhead with doing so...

sentences:
How to work with smaller intermediate textures in OpenGL and GLSL? I'm working on a project rendering water simulated through smoothed-particle hydrodynamics (SPH) with a non-photorealistic look to use in games.

In the actual stage of the project everything about this rendering is done through OpenGL and GLSL in C++, with many shader steps that stores intermediate textures in FBOs, which are later used in a final shader that brings everything together.

Everything is working fine, except for the framerate, which lies below between 25 and 30 FPS in the better case, rendering everything, including the intermediate textures, in 1024x768 pixels. So, since some of these intermediate steps involve image smoothing algorithms that are time consuming, I thought of reducing the dimensions of the textures generated in intermediate steps to make them faster, trying to find a sweet spot between the level of reduction/performance (divided by 2, 4, 8...) and the rendering final visual.

My question lies precisely here: How can I work with smaller textures in intermediate steps and use them on a final shader step to render to a image in a bigger dimension?

sentences:
How do I permanently set the interpolation for every image, sprite, and texture in pyglet to GL_NEAREST in pyglet? There are plenty of examples of posts that describe how to set the default interpolation of specific images to GL_NEAREST, for example here, but they all have to be run after the image texture is defined.

My question is simply this: is there any way to set the default interpolation of every image, including ones that have not been created yet, to GL_NEAREST in a single statement? I will never use any other scaling method as I am making a pixel-based game, and I do not want to have to set the interpolation every time on_draw() is run. If there is no answer, then please say so.

sentences:
Is there a convenient way to port a .apk file to a .swf file? My friend just made a game and has a bunch of installs on the Android/Google Play.

I'm curious if it's possible at all to port said game to a flash game.  I've seen tutorials on how to port an .swf to an .apk, but I haven't seen anything yet that would make it seem to go backwards.

I'd love to help my friend get extra exposure for his game.  Is there any way he can port it?

sentences:
Can you adjust the proportions of a 3D model via scripting? We are developing a game in Unity where the character is different ages in different levels. Would it be possible to use a single 3D model asset, and alter its proportions via scripting to achieve this effect? For example, stretching the head to make it more oval for older self, or increasing head size for toddler self?

We don't have a model yet. We are envisaging a simplistic, cartoony look rather than something realistic. Is this doable?

sentences:
GLSL C++ Only first sampler array index is accessible I have the following shader, which whose fragment shader contains a sampler array of 16 elements.

Fragment

#version 330 core
in vec2 _uv;
flat in int _instanceID;

out vec4 color;

uniform sampler2D sampler[16];

void main() {
    color = texture(sampler[_instanceID], _uv);
}

Now when I try to set the second array element using the following method

void Shader::setUniform(const std::string& uniform, GLuint* values, size_t amount) const {
    bindProgram();

    GLuint loc = getUniformLocation(uniform + "[0]");
    for(int i = 0; i < amount; i++){
        glUniform1ui(loc+i, values[i]);
        std::cout << values[i] << " "; //For debug
    }
    std::cout << std::endl; //For debug
}

It just sets the first element of the shader. Even though I'm passing 2 values.

This is the output of the cout's:

5 4
5 4
5 4
5 4
...

Looking up the shader variables with GDebugger, only the first element is set.

It also only draws the first (index 0) image.

sentences:
Finding flexible patterns in a 2D grid I'm stumped trying to create a matching algorithm for my game.

I have a 2D grid like this for example:

0, 0, 0, 0, 0, 0

0, 1, 2, 2, 1, 0

0, 1, 1, 0, 0, 0

0, 0, 2, 0, 1, 0

0, 0, 0, 2, 1, 0

0, 0, 0, 0, 0, 0

Along with a list of patterns:

1, 2, 1

1, 1, 1

Where I am trying to find instances of the patterns in the grid, and the higher listed pattern has the higher priority if multiple patterns are found.
That would normally not be a problem if I were searching for them appearing purely horizontally or vertically. But I want to implement the search for them appearing in more than just straight lines like this (an "L shaped" example for the first pattern):

1, 2

0, 1

Some implementations I've tried included picking a grid element and trying to crawl from it to neighboring elements, but this has been problematic since each element has 4 neighbors and when you go to a neighboring element it has 4 more possible neighbors, and sometimes the crawling path curls in on itself resulting in duplicates. I feel like there is an easier and more efficient way to implement this that I am missing.

Is there any already well known algorithm that would fit this criteria? I have not been able to find something that fits these criteria on google. Any help would be appreciated.

sentences:
When to use a vertex array and when to use a VBO? I'm trying to learn about vertex arrays and vertex buffer objects, but I don't understand the differences in terms of:

case-of-use (static geometry like terrains, geometry that changes every frame like a particle system, etc.)
performance
portability (old graphics card, consoles, devices like Android or iPhone, etc.)

some clarifications?

sentences: LWJGL—How to Animate Sprites from a Sprite Sheet Using Certain Keys? I'm talking here about walking animations and such for a 16-bit RPG. I have a simple sprite sheet that contains walking animations for all directions (up, left, down, and right), but I'm having trouble getting LWJGL to animate them—how would I do it?

sentences:
TiledMap taking a lot of time to load in libgdx I am developing a game using libGdx in which a level has 2400 * 450 tiles Map and each tile is of 4 pixels. I am also using box2d in my game.

My problem is that when I run the game on my phone it takes a lot of time to load the screen (more than a minute).
How can I reduce this loading time?

I created tilemap using Tiled and I am using Android Studio.

Below is my code (SCALE is 2.0f and PPM is 4)

@Override
public void show() {
    w = Gdx.graphics.getWidth();
    h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, w / SCALE, h / SCALE);
    camera.update();
    viewport = new FitViewport(w / SCALE, h / SCALE  ,camera);
    viewport.apply();
  .
  .
  .

    map = new TmxMapLoader().load("maps/lvl3.tmx");
    tmr = new OrthogonalTiledMapRenderer(map, 1/SCALE);

}

@Override
public void render(float delta) {
    update(Gdx.graphics.getDeltaTime());

    //Render
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    tmr.render();

    .
    .
    .
    b2dr.render(world, camera.combined.scl(PPM));
}

public void update(float delta) {

    world.step(1 / 60f, 6, 2);
    cameraUpdate(delta);
    tmr.setView(camera);
    batch.setProjectionMatrix(camera.combined);
}

@Override
public void resize(int width, int height) {
    camera.setToOrtho(false, width / SCALE, height / SCALE);

    viewport.update( width , height );
}

Please help and thanks in advance

sentences:
What is the difference between an orthographic and oblique projection? They both seem to be a parallel projection. I know that the angles of axes of viewing differ based on the type of orthographic projection (eg, an isometric projection has equal angles for all the axes).

But what sets the oblique projection apart from the orthographical projection?

I found this image on Wikipedia and I don't see what sets the two oblique examples apart from the dimetric example.

sentences:
UDP server in unity not working I know there are a lot of UDP examples out there, but I really need to know specifically what I am doing wrong. I have Wireshark monitoring my data traffic and according to that program Unity is not sending data at all. Could some of you coding wizards look over this and help me find my mistake?

public class heatLampControl : MonoBehaviour { //Ben Stewart, june 6th, 2016
                                           //this code controls the                      "Position" of the heat lamps, ie what angle the heat should be coming from. The
// value will be added to a new UDP connection to the dSPACE machine

//Update 6-10: Added UDP functionality, as accessing the UDP class that was created for this purpose turned out to not function correctly
public float lampIntensity = 0.0f; //Multiplier for relative intensity of the sunlight
GameObject sun;
public GameObject player; // dropped in via GUI
public bool isNight = false; // is it night? if so, heat lamp should turn off
public double sunAngle; // angle about the y axis. that is the only angle that can be controlled.
public bool isOn = false;
public string keyDown;
public int port;
public string dataStr;
byte[] data;
public GameObject cycle; //following three keep track of day/night cycle
public Day_Night.TimeOfDay tod;
public Day_Night dayNight;
public int strLength;
private IPAddress ip;
private UdpClient udp;
private IPEndPoint ipep;
public float fruitIntensity;
public float hayIntensity;
OlfactoryControl olfactory;
string hostname;
IPAddress[] ipList;
void Start () {
    hostname = Dns.GetHostName ();
    ipList = Dns.GetHostEntry (hostname).AddressList;
    port = 13722;
    cycle = GameObject.Find ("DayNight");
    dayNight = cycle.GetComponent<Day_Night> ();
    sun = this.gameObject;
    olfactory = GameObject.Find ("Olfactory").GetComponent<OlfactoryControl>();
    ip = ipList [0];
    ipep = new IPEndPoint (ip, port);
    udp = new UdpClient (13722);
}

// Update is called once per frame
void Update () {
    sunAngle = player.transform.eulerAngles [1] - Math.Atan2 (sun.transform.position [2], sun.transform.position [0]);// gets the positional angle of the sun compared to the player
    keyDown = Input.inputString;
    if (isNight || Input.GetKeyUp (KeyCode.L)) { // IF L is pressed down, light will come on
        lampIntensity = 0f;
        isOn = false;
    }
    if (!isNight && Input.GetKeyDown (KeyCode.L)) {
        lampIntensity = 1f;
        isOn = true;
    }
    tod = dayNight.tod;
//      if (tod == Day_Night.TimeOfDay.Idle)
//                      lampIntensity = 1.0f;
//      if (tod == Day_Night.TimeOfDay.SunRise) {
//          lampIntensity = (dayNight.timeOfDay / (dayNight.sunSet - dayNight.StartTime));
//      }
        hayIntensity = olfactory.hayIntensity;
    fruitIntensity = olfactory.fruitIntensity;

    sendUdp ();

}

//june 30th edit
void sendUdp(){

    dataStr = hayIntensity.ToString () + fruitIntensity.ToString () + lampIntensity.ToString ();
    byte[] sendBytes = System.Text.Encoding.ASCII.GetBytes (dataStr);
    Debug.Log (dataStr);
    udp.Send (sendBytes, sendBytes.Length, ipep);
    Debug.Log ("Data sent to IP Address " + ip.ToString() +  " on port " + port.ToString());
}
}

sentences:
Network communication via Sockets. Is there a better way? I'm building a game engine on the OpenTK framework that needs to support multiple players.

How I have the basic framework established is that there is a Client and a Server.  The Server binds and listens on a specified port, and the Clients connect to the Server's IP Address and Port to make a TCP socket.  The server then transmits a World object to all clients as they connect.

A World object contains all of the Light objects, Surface objects, Mesh objects and Camera objects.  With all of these objects, the World is responsible for rendering the game environment.

My idea is that each Camera object has a Unique ID, a position (X,Y,Z), and 2 angle values representing Zenith and Azimuth.  When any of these values changes (only the camera can move at this point.  Basics first!) I want to Serialize and send the updated Camera object to the Server, which then transmits this object to all of the Clients.  The Client then deserializes the new Camera object, uses its Unique ID and updates the existing Camera object in the World.  Since the Camera object consists of only 5 double values (X,Y,Z,Az,Ze) it shouldn't be a lot of data being sent over the network, but my implementation seems to slow down the Game Screen significantly

Is there a better model for Multiplayer network communication?  Is there any built in functionality in C# that handles this kind of communication?

Basically, I just need to update all of the other Clients when one Client's Camera changes.

Thanks for any help!

sentences:
How do I resolve asynchronous client actions against an authoritative server state? I have a multiplayer card game which I am in the process of developing.

The game is relatively simple; players have a certain number of cards which they can activate, sell, or use in various other ways.

The game isn't turn based.  Instead, it is asynchronous so that players (A, B, C, and D) all make their choices at the same time. Certain actions will affect the game state.  For example, removing a card from the game or adding a card to the game. Players should always be in sync with each other so that, for instance, Player A cannot use a card that Player B has just removed, as it is no longer present.

Obviously there are situations in which Player A may remove a card at nearly the same time that Player B tries to interact with the same card. How would the server handle this sort of situation?

My original thought is that each client could hash their game state and send it with their command to the server, for example:

Player A - #MYHASH# - Command = Pick Up Card Z

Player B - #MYHASH# - Command = Remove Card Z

The server would then action the first command and regenerate the hash. Upon trying to execute the second command it would notice the hash sent by Player B differs from the current hash, so the server would reject the request.

In the above example Player A would notice nothing and the game would continue normally, but Player B would have to be informed that their action failed.

sentences:
I want to blit a standing man on pygame I was making a game with pygame and python and I wanted to blit an image of a standing man and when a right key is pressed I want the man to run and when the right key is released I want the man to stand again... I tried to make it like that but couldn't work... here's the code I tried

import pygame
from pygame.locals import *
from sys import exit

pygame.init()

screen = pygame.display.set_mode((600,600))
pygame.display.set_caption('running man')

image_1 = pygame.image.load('standing-man.jpg')
image_2 = pygame.image.load('running-man-1.jpg')
image_3 = pygame.image.load('running-man-2.jpg')

move_x = 0
x = 0

clock = pygame.time.Clock()

while True:
    running_man = [0]
    #creates a loop and make the image look like its running by swithching the two man images
    for man in running_man:
        screen.fill((255,255,255))
        x += move_x
        #first i want a standing man to be seen on the screen and when a right key is pressed i want the other two images to blit on the screen
        if man == 0:
            screen.blit(image_1,(x,100))
        if man == 1:
            screen.blit(image_2,(x,100))
        if man == 2:
            screen.blit(image_3,(x,100))
        pygame.display.update()
        clock.tick(7)

        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
            if event.type == KEYDOWN:
                if event.key == K_RIGHT:
                    move_x = +1
                    #here i want the variable running_man to be 1,2 so to blit the otherr images and remove the standing man image
                    running_man = [1,2]
            if event.type == KEYUP:
                if event.key == K_RIGHT:
                    move_x = +0
                    #when the right key is released i want the value of the variable running_man to be 0 again so to blit the standing man image again
                    running_man = [0]
        pygame.display.update()

sentences:
What is wrong with my vertex declaration? What is wrong with my vertex declaration below? I am using it with instancing. After adding TextureInformation to it, it renders weird and has an epileptical seizure.

    public struct VertexInstance : IVertexType
    {
        public Matrix World;
        public Color Color;
        public Vector3 TextureInformation;

        // I use arithmetic here to show clearly where these numbers come from
        // You can just type 28 if you want
        public static readonly int SizeInBytes = sizeof(float) * 23;

        // Vertex Element array for our struct above
        public static readonly VertexElement[] VertexElements = {
            new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 0),
            new VertexElement(sizeof(float) * 4, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 1),
            new VertexElement(sizeof(float) * 8, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 2),
            new VertexElement(sizeof(float) * 12, VertexElementFormat.Vector4, VertexElementUsage.TextureCoordinate, 3),
            new VertexElement(sizeof(float) * 16, VertexElementFormat.Color, VertexElementUsage.TextureCoordinate, 4),
            new VertexElement(sizeof(float) * 20, VertexElementFormat.Vector3, VertexElementUsage.TextureCoordinate, 5)
        };

        public static VertexDeclaration Declaration
        {
            get { return new VertexDeclaration(VertexElements); }
        }

        VertexDeclaration IVertexType.VertexDeclaration
        {
            get { return new VertexDeclaration(VertexElements); }
        }
    }

sentences:
How should I calculate the score in Minesweeper: 3BV or 3BV/s? I'm designing a minesweeper game, and I'm a bit confused as to how to calculate the score.

The objective of my game is to reveal all the non-flagged boxes. Marking the flag must not count toward the score. Just showing the number of seconds required to complete a board seems obsolete as I have a variable board size which is decided by the user. I studied the Wikipedia page on Minesweeper regarding the two scoring techniques.

But I don't understand how to calculate the 3BV. Is it just the number of left clicks done by user done during the game, or is the 3BV the minimum number of clicks required to complete the board? Also how can 3BV/s be judged: does a higher or lower score give a higher ranking?

Regarding my implementation

I used an integer array with all zeros and 9 designating a mine position. When a user click in the grid I calculate the nearby cells and then display the appropriate number and if he clicks on cell with value 9 then game is over.

sentences:
Novice Mobile Game Developers | Publishing on our own or Publisher? So we are almost done with our first indie game, developed on Android. We believe that the game has potential, our graphics guy is damn good so we have some good eye candy in our game.

Now we are thinking what should be our starting step? We can purchase the Google Play account and launch it on our own, but we aren't sure if we'd be able to advertise it well and get something big out of it.

Or we can contact a publisher, and talk about some deal.

Which one is better? What are the pros and cons of both, considering this is only our first game and we intend to make a lot more. Also considering that we're only students yet, currently in our senior year. We would love to generate some revenue out of it.

What are the best ways of contacting publishers? How do we approach them and deal with them?

Many thanks for your kind help!

sentences:
Getting started at 3D modelling and animation I'm looking for  book or a guide that will direct me to 3D modelling/animation for gaming.  Most tutorials will go for lengths about things I don't really need for games and I want to get to the chops of making assets for my games -- like many developers have said: the best way to get experience is finish a game!

So what good books/tutorials are there on modelling for games?

sentences:
How do we keep ourselves from being sued for unknown patent infringements? There's breaking news about Zynga being sued over some very obvious implementations. This is making me think that the game industry is full of landmines to be stepped on at every turn. What input does everyone have to minimize the damage?

Latest:
http://www.gamasutra.com/view/news/36657/Zynga_Sued_Over_Prize_Redemption_Patents.php

Another example:
https://w2.eff.org/patent/wanted/patent.php?p=sheldon

sentences:
Render on texture with alpha 0 for the background colour Sorry if the question is stupid but I am very new to opengl.

I render on a target a scene with a couple of object on a background that is nothing more than the clear colour (which is 0.0,0.0,0.0,0.0).
 When I access the texture again every single pixel has 1 has alpha, how can I make sure the background has 0.0 ?

Thank you

Faye

sentences:
RPC's in Legacy Unity, what to use in Unity 5.1? I have created a small experiment in 5.1, a server has an AI character pathfinding around a map over a grid, so its a straight line node to node before it reaches the end.

I would like for the client to also view this pathfinding character.

Using the networking scripts built in it sends fine, however the client see's a stuttering character and not something smooth like the server sees. So my solution to this is that when the server calculates the new node for the character to go to that the location of this node is sent to the client, the client moves its character to the node and so on. So instead of constant transform data being sent, the clients AI can go to the node and wait for the next node location to be sent, therefore being smooth.

In previous versions of Unity I would've used RPC's, but this is labelled as Legacy now, what can I use now to send a node location from the server to the client?

sentences:
Securing a replay-based leaderboard system (as much as possible) A few years ago, I implemented a basic online leaderboard system in one of my games that sent encrypted score data over the wire. The encryption keys were stored in the game client's binary. Of course, the leaderboards got hacked the same day they were released.
I have now released a new game on Steam, and I've worked hard to implement fully-deterministic game logic and a replay system.
The replay system works by simply replaying the user's input that was recorded in a previous playthrough. The fully-deterministic game logic ensures that the replay will work on any machine, independently of the game's FPS.
Now, it is time for me to implement online leaderboards.
My idea is to create a server version of the game executable which receives replay files over the network, replays them on some remote machine, and adds the score to a database if the replay data is valid.
While this prevents cheaters from simply sending a fake score to the server, it opens up many other cheating avenues, including:

Tool assisted creation of replays, either by slowing down the game speed or by manually crafting a replay file after reverse-engineering its format (the game is open-source).

Taking someone else's replay and sending it over the network, changing data regarding who the replay belongs to.

I could somehow encrypt and compress the replay data before sending it over (or saving it on the user's local machine), but since the game is open-source, it would be easy to reverse-engineer the encrypted replay format.
What is a good way of securing a replay-based online leaderboard system?
One possible idea I had is to have the server generate an encryption key / token for a specific user which is only valid for a small amount of time, send it over to the client, and only accept replays that are encrypted with that key. This would prevent users from uploading older replays to the server, but in theory it should work -- am I missing something?

sentences:
Is copying UI and layout of other apps legal? I would like to develop an Android App for Google Play and I am going to use Facebook and Whatsapp UI as background of the game (as a back-story). I will use icons without copyright to emulate/duplicate the style of Facebook and Whatsapp (they are not part of original drawable of the external app). I will inform the user about the objective of the game. I won't include any direct references to the emulated apps such as the title "Facebook" or "Messenger". The user is free to interpret what he is seeing. I will add the text

  "any name and reference is fictitious".

However I have some great doubts:

After the development, will I be able to upload the app on an app store such as Google Play?
Is copying UI and layout of other external apps legal?
Does it break any law or rule?

sentences: Make paid app free for specific user Is it possible for me as an developer/owner of my paid app (released on the Google Play market) to unlock its full version for specific user?

sentences:
How to Convert a Z Up Matrix to a Y Up Matrix? My 3D program exports my vertex data and instancing matrixes in Z+ up format.  I want to store them in my own data format as Y+ up.  If given a Matrix4 describing a position with Z+ being up. How can I convert that to a Y+ up Matrix4?

I know you can just rotate the object but I don't want to rotate the object.

sentences:
Collisions between two objects in 2D space I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to make it a little more interesting when the player plays with other objects in motion, they collide and separate. This is a very physical 2D issue itself.
If an object A is at positive velocity at x collides with an object B is at negative velocity at x, collide head-on, what would be the best calculation to do so that they separate naturally after the collision?

What if they go in the same direction in x? and if one has going on x and another on y? How do I deal with all this?

Should I add mass and acceleration to make this separation calculation after the collision?

sentences:
Authenticating users without a username or password I'm curious about what the process is for anonymously authenticating users when it comes to mobile games. There are quite a few examples out there, but the ones that immediately come to mind are Lords Mobile, Family Guy: Quest for Stuff, and Clash of Clans. When you first open the game, you're assigned an account id and that id is tied to your device until you choose to register an account with a password or sign in through some SSO service.

In that initial step where you're not creating a password or using SSO, how are these games making sure the requests are from both the user/device that they come from? Or is it that they actually don't?

I can imagine a simple setup where you're providing a key that needs to be refreshed every now and then just like you would with something like OAuth, but other than that you don't care that the user is who they say they are. After all, you're dealing with a request that already has to be validated for legality within the game rules.

sentences:
iOS custom memory allocator I'm about to start writing an iOS game and I'm going to use mainly C++/C for the core gameplay logic.

I really like pre-allocating everything in the game and try to avoid any dynamic allocations as much as possible. With my own C++/C code it's not a big deal. However there are some ObjC libraries which I'd like to re-use and I'm not sure how to inject my custom memory allocator to Cocoa based classes.

Is there any central 'inject point' in Cocoa where I can do that?

sentences:
How do I add a custom mob to Minecraft? Basically decided to make my own mob, I have:

Created my mob's entity class
Created my mobs model class
Drawn the model
Added the function call for addMapping within the EntityList class

I'm stuck on what to do next. I've tried finding the code that deals with passive animal spawning in the world, however I can't seem to find it.

Help greatly appreciated.

sentences:
How to make a single action run for two objects in GAME MAKER? Think of a traffic light that only turns green or red.

If it is green, the next car passing through the detection point (pink square) will be directed to the green path and will cause the traffic light to turn red.

This way the next car that passes, will be directed to the red path, also making the green light, and so on.

Let's assume that two cars are in the same place and at the same speed and thus collide with the pink square at the same time. How can we make both directions to the same path be green or red and so that the light of the traffic light changes only once?

Considering "obj_BolaAzul" as "obj_blueCar", "obj_BolaRoxa" as "obj_purpleCar" and "obj_Cannon" as "obj_trafficLight".

The codes are basically:

obj_traficLight collision with obj_blueCar

if greenLight==true{
  obj_blueCar.move_towards_point(x+1,y,manSpeed); //go to right
  testGreen=true;
}

if redLight==true{
  obj_blueCar.move_towards_point(x-1,y,manSpeed); //go to left
  testRed=true;
}

if testGreen==true{
  greenLight=false;
  redLight=true
}

if testRed==false{
  redLight=false;
  greenLight=true
}

There are more things besides in code, but it has no relation to the problem.

I'm sorry again for the translation errors, I'm still not speaking English.

sentences:
How to place planes for each face of frustrum in Unreal engine? How to place planes for each side of frustrum from a Blueprint ?

How to get the rotation and size for each side of camera frustrum from Bleuprints ?

sentences:
Is there any way to get PVRTexTool's version from the command line? I am to make an automated task which involves requiring the version of the PVRTexTool that comes with the Unity installed in a machine.

Is it possible to get the version of PVRTexTool on the command shell?

sentences:
How to make a game people can mod? In C++, how can one make it's game load content developped by other people?

For instance in Java you can look for jar files and load specific class from it.

sentences:
Scaling surface changes colors I'm building a pixel art game with pygame, and I'd like to scale it to double the size. I have tried the pygame.transform methods like scale and scale2x, but they seem to alter the colors quite badly, there's an added red hue. Is there a way to scale pixel art correctly in pygame? Basically making each pixel 2x2 of the same color. Or do I have to do it manually, if yes, any suggestions?

This is the setup I have currently, "works" but messes up the colors:

#set scaling
scaling = 1

screen = pygame.Surface( (screen_w, screen_h) )
window = pygame.display.set_mode( (screen_w * scaling, screen_h * scaling) )

while not done:

    #do things...

    pygame.transform.scale(screen, (screen_w * scaling, screen_h * scaling), window)
    pygame.display.update()

E. for reference, here's what happens.

No pygame scaling

vs. pygame scaling

sentences:
MMORPG Design Question: Best idea for adding PvP(PlayerVsPlayer) in open world MMO? Brief Explanation of game: Time Travel, one map, open world MMO called ChronoCraft. If you'd like to know more about the game, you're welcome to check out our twitter where we post some of our development: https://twitter.com/Chrono_Craft

Here are the ideas so far:

1- Safe Zones

Pros: People in major towns are safe and can fight when they leave the safety of the town
Cons: When dealing with NPC's and Quests(Non-instance ones) outside of town, someone can kill you as you are talking to them

2-PvP Zones

Pros: Instead, areas of the map where PvP is possible is limited to the "wilderness" or dangerous areas(Anything that doesnt have Quest-able NPCs)
Cons: Significantly reduces the area of allowable PvP areas

3-PvP Toggle

Pros: This allows players to turn on PvP mode in settings where only other PvP enabled players can fight eachother outside of Safe Zones
(We would make it so if you are hit, you cant turn off PvP mode until a certain time to prevent people escaping death)
Cons: Ambushing is limited, because only the people who are ready to fight will have it enabled

4-Separate servers

Pros: Having a PvE server and a PvP server. Which makes it so the player decides what gameplay he wants.
Cons: Players cant bring items or money between servers so they may have to start from scratch if they change their mind on what type of server they like playing.(This is to protect the player economy from taking all the resources from one server and bringing them to another server)

5-Time Specific

Pros: When night falls, then PvP is enabled for everywhere outside a Safe Zone
Cons: For players wanting to avoid PvP they will be forced to stay in towns half the time which might get boring unless they do fun stuff like running a shop or restaurant.

6-Special Days

Pros: When there is lighting and rain, PvP is enabled which will happen every few minecraft days in the game. Allowing PvPers to fight outside of safe zones. And a HUD display will make this clear.
Cons: Players wanting to avoid PvP will have to stay in town during the inclement weather, which they might not enjoy.

7-Level Specific

Pros: Only players with a similar skill level will be able to fight eachother. So new players dont have to worry about pros slaughtering them early on.
Cons: It would be hard to fight along friends unless you're the same skill level. "John help me kill this guy"-"Sorry cant, he is too low skill for me"

8-Arenas

Pros: Confines the fight to specific spot like a colosseum
Cons: Nearly impossible to wage huge fights like 100v100
(Colosseum will make it into the game at some point, but should it be the only PvP option)

9-PvP Everywhere
Pros: Either (A)Players can figure out their own police/protection system or (B) NPC guards in major towns spawn and nearly guarantee the death of a killer in the town.
Cons: Has alot of potential to be annoying if players dont want to get killed in the middle of business in towns. Might also turn away less PvP focused players.

-What do you think is the best?

-Can I mitigate the cons for the one you choose?

-Is there a better idea entirely?

sentences: (love2d)How would I go about drawing the same image multiple times? Obviously I could just copy and paste a love.image.draw() function multiple times for how many times I want the item to be drawn, but lets say I wanted to draw an image wherever the mouse is clicked at. How would I go about making it so it draw said item every time I clicked. If I only clicked twice it would draw two objects, and if I clicked it 500 times it would draw 500 items, without having to have 500 different draw functions?

sentences:
XNA games C# application executable work on one win7 not the other one Our company wrote a game in XNA studio 4 almost ten years ago. we try to reinstall it in win7 with only the executable. Both installed XNA Game Studio 4.0. Below is the environments parameter I can find. The one on the laptop is not rendering the effect(I am new to this, this is my guess).

Laptop
Desktop

OS
win7 Service Pack1
win7 Service Pack1

DirectX version
11
11

Graphic Card
AMD firepro M4000 Mobility Prographics
integrated GPU Intel HD graphics 4600

Chip Type
AMD FirePro(0x682D)
Intel(R) HD graphics family

We don't know what make these two executable behave differently. Part of the window image just not shown. Second check on the source code, the different between the image that can be show and can not be shown on the failed Laptop is working one is using Bitmap and the not working on is using Texture2D with  Microsoft.Xna.Framework.Graphics Effect with passes. Any ideas. Thanks.

sentences:
Texturing different block types on an optimized voxel mesh I have a cubic world (like Minecraft) where I'm generating chunks. In those chunks, only visible vertices and faces are generated.
Currently, it means that if I have a 2x2x1 chunk, it will generate 8 triangles for the top part (2 for each block). I'm trying to generate only two following this greedy meshing method:

If I combine adjacent faces together, I'd still like to be able to draw transitions in materials between adjacent blocks, something like this:

As you can see it has 3 different tiles: grass, dirt-grass transition, and dirt.
Currently, my shader looks like this:
Shader "MultiTexture_Diffuse_Worldspace"
{

    Properties
    {
        _Color ("Main Color", Color) = (1,1,1,1)
        _TexAbove ("Above texture", 2D) = "surface" {}
        _TexSide ("Side texture", 2D) = "surface" {}
        _TexBelow ("Below texture", 2D) = "surface" {}
        _TexTopSide ("Top side texture", 2D) = "surface" {}
        _Scale ("Texture Scale", Float) = 1.0
    }

    SubShader
    {

        Tags
        {
            "RenderType"="Opaque"
        }

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input
        {
            float3 worldNormal;
            float3 worldPos;
        };

        sampler2D _TexAbove;
        sampler2D _TexSide;
        sampler2D _TexBelow;
        sampler2D _TexTopSide;
        float4 _Color;
        float _Scale;

        void surf (Input IN, inout SurfaceOutput o)
        {
            float2 UV;
            fixed4 c;

            if(abs(IN.worldNormal.y > 0.5))
            {
                UV = IN.worldPos.xz;
                c = tex2D(_TexAbove, UV* _Scale);
            }
            else if(abs(IN.worldNormal.x) > 0.5)
            {
                UV = IN.worldPos.yz;
                c = tex2D(_TexSide, UV* _Scale);
            }
            else if(abs(IN.worldNormal.z) > 0.5)
            {
                UV = IN.worldPos.xy;
                c = tex2D(_TexSide, UV* _Scale);
            }
            else
            {
                UV = IN.worldPos.xz;
                c = tex2D(_TexBelow, UV* _Scale);
            }

            o.Albedo = c.rgb * _Color;
        }
        ENDCG
    }
}

How would I modify this shader to work with faces that have been merged together? Or would I have to keep separate faces per block and handle them individually?

sentences:
Causing Update loop with Coroutine Unity Total Noob Alert! < 7 days with C# and Unity

My Win Game screen becomes SetActive and my Player is SetActive false when you are standing in a trigger and crouch. That all works fine except you cant see the crouch animation because he is IMMEDIATELY SetActive false.

I tried to delay this by creating a coroutine. The problem with that is this is all happening in the Update function (or whatever it's called) because of the getkeydown for crouch. That gets called once per frame so my coroutine is trying to go off once per frame.

I tried creating a bool called isCoroutineStarted and set it to false and then set it to true in the Coroutine to break the loop but that didn't work either.

Don't know what to do so I reverted it back to before where it doesn't show my crouch animation.

Here's my script (It's attached to a Game Object with the trigger):

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

public class xxxxxx : MonoBehaviour {

    public bool xxx = false;

    [SerializeField]
    private GameObject youWinUI;

    [SerializeField]
    private GameObject player;

    // Determines whether or not the player is standing on the xxxxx
    void OnTriggerEnter2D (Collider2D other)
    {
        xxx = true;
    }

    void OnTriggerExit2D (Collider2D other)
    {
        xxx = false;
    }

    //Turns on Win screen and makes player disappear when crouch on xxx
    void Update ()
    {
        if (Input.GetKeyDown (KeyCode.S) && xxx == true) {
            youWinUI.SetActive (true);
            player.SetActive (false);
        }
    }
}

P.S. ignore the x's no stealsies lol. Also this piece of script works as intended I just want a delay so you can see the crouch animation.

sentences:
Create Full Tile Map Zone in an Art Software, then generate corresponding tile name list? I'm completely new to tile map creation. I'm a programmer and I'd like to make life easier for myself. It's a bit long to explain the problem I think I have, but bear with me.

The Scenario:
From what I understand, in my code I need an array which holds my tile information for a zone/area in my game. Lets say for simplicity this zone was a 10x10 grid, so 100 indexes in the array. Now, lets say each index holds a number that corresponds to a specific tile. ex) Number 1 means grass tile. Number 4 means rock tile. etc.

So far so good. From this array (and additional coding), my tile map will be generated on my game screen.

The problem:
As it stands I have to individually type each tile identifier for each index in the array. Now let's say that I have already fully designed the visual tile grid map for my zone in a particular art software. Simply put, I am staring at my fully completed zone in my art software screen and it is my visual aid for creating my array. My strategy now is to look at each grid cell, see what tile I put in there, and type its identifying number into my array. Rinse and repeat hundreds of times, looking at each individual tile until I manually complete the array. This is an extremely tedious and long process.

What I want:
So my full tile map is already in my art software. What I want is for the software to more or less generate the array for me! I press a button, and It will see what tile is in each grid square, and accordingly generate a list in a text document with each tile's identifying number that I give it. That's literally all I need. I can then copy and paste the list into my array in my code. It shaves off tons of time.

The Question:
Notice that I have used the generic term "art software". Is there any art software that can do what I described? Is there any art software (e.g. adobe illustrator, photoshop, gimp, etc.) which upon having a fully completed tile map, will be able to generate a text file list of each tile's identifying name?

sentences:
Java: Exported JAR file doesn't load images I am using Netbeans to create my game. The images do seem to load when I run it in Netbeans. However, the built jar file only leaves me with a blank screen.

This is how I call the images in my game.

public Image playerSprite = playerSprite = Toolkit.getDefaultToolkit().getImage("sprites\\spritesL.png");

I put all image resources in a folder called sprites, and I declared it as a Source in the Project Properties. In addition, the image files does appear in the root directory of the JAR file, but cannot seem to access it.

sentences:
"Solve" a game algorithmically -- creating bots (and making them smart) EDIT :  at first I gave a lot of context for this question, explaining why I wanted to create a bot. I'm sorry it distracted people from my "actual" question.

My question is pretty simple : how does one create a bot for a game ? (Especially... on a mac, if it's possible -- though I can use a Linux virtual machine if needed).

Is it interfaced with the application, or just "watching" the screen and extracting information from it (as if it was taking pictures and analyzing them to get informations such as your HP, your position, etc.) ?
Could I use python to code it, or are there specific languages ?

The forementioned context :

Since I started programming, I've wanted to try to create algorithms that would be able to "play" (or even "beat") video games. Many games require only logical choices, more and more complex as the difficulty grows, which seems perfect for algorithms.

I currently enjoy the game "Pixel Dungeon" a lot (see here), but it's not always nice to you (and you die. A lot.). A few researches on the internet show that a lot can be achieved just by following simple guidelines.

So I figured maybe this would be a good game to try and create bots to play it. In the long term, I would like to let bots play, extract data out of it, and modify my algorithms according to these data.
I am really enthusiast about this, but also really novice.

(maybe this belongs more to https://stackoverflow.com/ ?)

sentences:
How can I use spectrum data to calculate energy values of certain frequency bands? I'm working on a rhythm game, and need to detect beats in a piece of music.

After all the research and reading through old posts in unity forum/reddit etc., as far as I understood, I need to calculate the average energy, and if there is a sudden energy change/spike, I want to register them as beats.

So here's the thing as far as I understood ;

 public class something : MonoBehaviour {

     public AudioSource audioSource;

     public float[] freqData = new float[1024];

     void Start ()
     {
         audioSource = GetComponent<AudioSource> ();
     }

     void Update ()
     {
         audioSource.GetSpectrumData (freqData, 0, FFTWindow.BlackmanHarris);
     }
 }

Let's say I have this code in place. My sampling rate is at 48000 Hz. The array size determines the frequency range of each element. So with a size of 1024, my frequency resolution is 23.4 Hz. So freqData[0] represents the freq between 0-23.4 Hz. freqData[1] represents 23.4-46.8 Hz. so on and so forth. And I want to detect, let's say bass beats between 60Hz and 250 Hz.

How can I translate this data into the average energy value for this frequency band?

sentences:
computing gl_FragDepth I am trying to draw spheres using a billboard, so I have a normal map with a z component that I am sampling in my fragment shader.  I just need to add this z component to the depth of my fragment to get proper 3D spheres...

How do you determine the current fragment's z-depth, add my offset and then set gl_FragDepth?

I've found lots of confusing contradictory hints and partially working bits of code all over the 'net, but no definitive clear answer.

UPDATE

final result (no shadowing) http://www.youtube.com/watch?v=88idbFlvQV0

sentences:
Why it’s recommended to keep global variable initialization and the objects’ constructors very simple (C++)? Considering  game-development?

I have this question in a gamedev quiz and I wonder what to answer.

Any clues?

sentences:
What is the difference between OpenGL 1.x and 2.x? Is there a good tutorial that shows the difference between OpenGL 1.* and 2.*?

It would be very helpful to know which functions I should not be calling (like glBegin(), I assume).

sentences: Creating a good looking interface for a Java CCG? I would like to create a Java collectible card game. I have the logic down pat, but I am having some trouble with the interface. I would like to make it look nice. Rather than using the standard java SWING components, I would like to create something like this. What is necessary to create something like that?

sentences:
How do I perform collision resolution for rigid bodies of varying volume? I am currently trying to develop a small physics engine for my games. I have created bounding volumes for different rigid bodies. However, I am having problems handling collision resolution, more specifically with determining the direction to apply the impulse to the objects and their changes in velocities.

How do I perform collision resolution for rigid bodies of varying volume? Is there a general solution for resolving collision between all rigid bodies like sphere, AABB or OBB, or do I have to specifically arrive at a solution for each scenario?

sentences:
Stretched textures in Blender First of all: I'm relatively new to Blender.

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

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

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

Does anyone know this strange behavior?

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

sentences:
How can I prevent 2D teleportation from teleporting through solid objects? In my 2D game, the player is able to teleport to any place on the screen with the click of the mouse button. What I am trying to prevent is the ability to teleport across solid objects. If the point from the player and the mouse click position is across an object then I want the player to teleport next to that object instead of across it.

I am currently trying to achieve this with raycasting. The code I wrote somewhat works but only if the mouse click is on an object, if the mouse click is across another object, it still teleports me accross the object without it registering that there is an object between the player and the mouse position.

My code:

Vector3 player_position = Camera.main.WorldToScreenPoint(transform.position);
Vector3 to_object_vector = transform.position - Camera.main.transform.position;
Vector3 linear_distance_vector = Vector3.Project(to_object_vector, Camera.main.transform.forward);

float distance_to_camera = linear_distance_vector.magnitude;
Vector3 mouse_position = Input.mousePosition;
float dist = Vector2.Distance(player_position, mouse_position);
Vector3 dir = (mouse_position - player_position).normalized;
mouse_position.z = distance_to_camera;

RaycastHit2D hit = Physics2D.Raycast(new Vector2(player_position.x, player_position.y), new Vector2(dir.x, dir.y), dist, 0);
if (hit.collider != null) {
     Debug.Log(hit.point);
     mouse_position = new Vector3(hit.point.x, hit.point.y, mouse_position.z);
}

Is there a better approach to this problem?

sentences:
Rectangles clear each other when moving on canvas I am having this problem after moving rectangles, they seem to delete one another.
Most probably it is a problem with clearRect(...) method.
This is the clean function I am using:

clean: function(element){
        // All default values clean all the screen
        if(typeof element.x === 'undefined'){
            element.x = 0;
        }

        if(typeof element.y === 'undefined'){
            element.y = 0;
        }

        if(typeof element.width === 'undefined'){
            element.width = canvas.width;
        }

        if(typeof element.height === 'undefined'){
            element.height = canvas.height;
        }

        // In case values are entered
        if(element.type === 'rectangle'){
            ctx.clearRect(element.x,element.y,element.width,element.height);
        }
    }

This is the rendering

rect: function(element){
    // Check if color is defined
    if(typeof element.color === 'undefined'){
        element.color = 'black';
    }
    else{
        ctx.fillStyle = element.color;
    }

    // Draw the rectangle
    ctx.fillRect(element.x,element.y,element.width,element.height);
}

sentences:
How would you go about rendering something like a line of coke more realistically, say with shaders? Im currently developing an app, where it simulates the snorting of cocaine. Im using LibGdx in Java to do that, I have got the mechanics down, but what Im currently left with is this:

Im currently rendering 1000 particles, which is doable by my Huawei P8, which isnt really high end. Doesnt really look good though. Any recommendations or other approaches you would use?

sentences:
How do I play audio with Javascript? I want to add a short audio track to a game of concentration I'm coding. I want the sound to occur when the user has won the game. How do I go about doing this?
I would really appreciate the help, thank you.

sentences:
Why does my Win32 call, contained in a class method, fail? Using a Direct3D Tutorial, I took the knowledge and encapsulated it into a class. The code builds in MSVC 2010 fine, and I've handled all compiler warnings pertaining to my project with the highest warning levels. When stepping through the code from the entry point, the program fails to RegisterClassEx(&wc). After which, the program is told nicely to exit. Shortly after the unique_ptr's destructor is run (not manually, but after the unique_ptr goes out of scope), the program crashes w/invalid memory access.

My WinMain looks something like this:

std::unique_ptr<Engine> j_engine(new Engine);
j_engine->CreateD3DWindow(title, width, height, fullscreen); //public method of Engine, similar to CreateD3DWindow from the tutorial

while(message looping)
{
// etc
}

//if loop is exited, let j_engine fall out of scope (my program has never reached this point)

The start of my CreateD3DWindow method contains VERY standard window creation code, and does not even contain a shred of a Direct3D call prior to the crash (RegisterClassEx()).

It is essentially:

WNDCLASSEX wc;
hInstance = GetModuleHandle(NULL);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = "SomeName";

RegisterClassEx(&wc); // fails. GetLastError() == "Invalid Parameters". Stepping through WNDCLASSEX struct creation doesn't raise any invalid parameter flags.

I've also tried using ZeroMemory() after declaring WNDCLASSEX wc.

Two things register in my mind as I type this:
1. GetModuleHandle() is being called from inside the class, which exists on the heap and is referenced by a pointer from WinMain. Does this matter? Is it providing a valid handle?
2. WndProc declaration and definition is outside the class and outside the namespace of the class. Does this mean WNDCLASSEX.lpfnWndProc cannot see it? As such:

#includes

LRESULT CALLBACK WndProc()
{
}

namespace xyz
{
class Engine
{
}
}

I'm out of ideas and my problem solving capabilities are waning. Any advice? I will certainly provide more information if necessary.

Specifically, I'd like to know why RegisterClassEx() is failing.

Thank you!

***Mentioned below that GetModuleHandle(NULL) will return a global handle for the given process, so the context of this call in this program should not matter.

sentences: Implementing a tile-based game Which data structure should be best used to store a pile of tiles from which a player can pick a random tile?

sentences:
How can I remove inventory items in a Bukkit plugin? I am making a Bukkit plugin that takes the player to a "FunZone" and allows them to do just about anything. I don't want data transferred between the two worlds. So far I have got most everything stopped. Here's the problem code:

            Integer normInvSize = player.getInventory().getSize();
            Integer i = 0;
            for (i=0; i<normInvSize; i++) {
                ItemStack item = player.getInventory().getItem(i);
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".amount", item.getAmount());
                Short durab = item.getDurability();
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".durabillity", durab.intValue());
                pConfig.set(player.getWorld().getName()+"Inv."+i.toString()+".type", item.getTypeId());
                player.getInventory().removeItem(new ItemStack(item.getType(), item.getAmount()));
            }

I have everything set up how I want it but I get stray items following me between the worlds. The line

player.getInventory().removeItem(new ItemStack(item.getType(), item.getAmount()));

does not remove all of the inventory. I want some code that will remove all inventory items (I've handled armor already). I already have a way to restore the inventory later, but my code currently won't remove everything. For example I can end up transfering some stone tools from the "FunZone" to the normal world, which I don't want.

sentences:
Where does game logic belong? I've always had a hard time wrapping my head around the 'high levels' of game logic and where/how large components, such as collision detection/physics, rendering, and user input, interact with one another. What I'm asking is how you deal with these higher level interactions.

Here is what I am doing:

interface Stage() { //or a "scene" as many call it. Manages the logic for Actors
   init()
   update() //update this stage
   render() //render this stage
}

StageManager() implements Stage { //a stage that manages stages :)
   var stages = array<Stage>
   init() //create a MainStage & other stages that may be used in this specific game
   update() //logic for checking which stage should be active
   render() //tell the active stage to render
   getActiveStage()
}

MainStage() implements Stage {
   var mainCharacter
   var actors = array<GameObject>
   var ...
   init()   //create the player, game world, other initialization stuff
   update() //collision detection, check mainCharacter state, etc
   render() //render all the Actors on this stage
   handleMouseClick()
   handleKeyBoardEvent()
}

Main() { //created on game start
   var manager = new StageManager()
   updateGameState() {
      manager.update()
      loop
   }

   renderState() {
      manager.render()
      loop
   }

My main gripe with this is that the StageManager and all other Stages will become enormous and unwieldy as the game scales over time. Off the top of my head, some components can be delegated out such as a Stage uses a PhysicsManager, but there would still be all the keyboard events and what not.

I was thinking of making individual Actors listen to events and giving them an update() method, thus encapsulating what an Actor should do at any given point. However, I would run into complications when an Actor needed game-state information (game time, a "power-up" Actor needing the player's speed) and I would no longer have Stages as Actors are now managing themselves.

sentences:
How is Unity's [Command] supposed to behave? Here's a very simple class/call hierarchy:

public class NetworkPlayer : NetworkBehaviour {
    public static NetworkPlayer localPlayer {
        get;
        private set;
    }

    [Command]
    public void CmdTurnDone() {
        Debug.Log("Turn done! isServer "+isServer+" isClient "+isClient+" isLocalPlr "+isLocalPlayer);
    }
}

public class SomeMonoBehaviour : MonoBehaviour {
    void Update() {
        NetworkPlayer.localPlayer.CmdTurnDone();
    }
}

When Update() gets executed on the host, it outputs as expected:

  Turn done! isServer True isClient True isLocalPlr True

Now, when Update() is executed on the remote client it outputs the following at the remote client's log only. However, the message does not appear at the server's logs:

  Turn done! isServer False isClient True isLocalPlr True

What puzzles me is why the message appears at the remote client's log only.

If I'm not mistaken, calling CmdTurnDone() at the remote client should execute it on the server. But why does the log message appear at the remote client's log instead of on the server's logs - where it is executed? Is it valid to call CmdTurnDone() from a MonoBehaviour?
Do you have any ideas why it's behaving like this? Is this the intended behavior? Thank you.

sentences:
Rendertarget and alphablending problem (Offscreen particle rendering) Today, I have implemented soft particles by rendering them to a separate render target and blending that with the scene, which worked as expected with additive blended particles. In that case I render the particles to a rendertarget while blending them additively, then drawing that rendertarget in fron of the scene while blending additively, works like a charm, I even save some render time if I use a smaller render target.
In the case of alpha blended particles, I have a serious issue. First I draw them with a blend state set up for alpha blending:

D3D11_BLEND_DESC bd;
bd.RenderTarget[0].BlendEnable=true;
bd.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
bd.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
bd.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
bd.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ZERO;
bd.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
bd.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
bd.RenderTarget[0].RenderTargetWriteMask = 0x0f;
bd.IndependentBlendEnable=true;

(This is it after reading the GPU Gems article on this subject.)

The render target which I draw them to is cleared by zero for all channels. When I draw this rendertarget to the screen I use a blend state set up for alphablending (it is used for all the 2d images and definetly works well) and I get this:  It seems as if I have depth writing turned on but I made sure it is turned off.
If I draw the rendertarget with these alpha blended particles on it, but with no blending (for the RT) I get this:  Which seems correct, it just doesn't blend how I want to. On GPU gems there are sure some well described formulas for the blending, but if I set the blendstate descibed there I won't get the results they get. Could someone help me with what I am missing?

sentences:
Is there a way to use other fonts, besides the default ones in OpenGLUT? I'm using OpenGLUT functions like glutBitmapString to render sentences and words in a game. However, there is a limited set of fonts to use and I need some bigger size fonts. Is there a way to add new fonts to these functions/API?

Thanks

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

sentences:
Separating scene generation and scene starting in Unity? I'm working on a game, where the map is generated, and:

The map is generated in an Awake(), so when an object's Start() is called, the map should be fully initialized.
But the scene's physics world won't be updated till the next FixedUpdate.
So when Start() is called, there is a high chance, that physics operations are done in an incorrect world (like raycasting)

I tried using Physics.SyncTransforms, but it didn't solve the issue for some reason. (Why?)

My next approach was to start the objects with a delay. Precisely: after a FixedUpdate.

So I started a Coroutine in the Start() method, which waits for a FixedUpdate, then starts the object.
But this caused that for example: ObjectA's Update() is called before ObjectB's Start coroutine finishes.

How could I achieve that scenes won't be started until the scene is fully initialized?

Is there a way to tell Unity to call every Start() i.e. 1 frame later? Or how else could I fix this? What is the best solution?

sentences:
How to get position of next object that closest to player,when player is move forward to nearest every time? I have a scene that looks like the following picture:

The Player has a RigidBody2D and all the steps have a BoxCollider2D. All steps are tagged with a 'step' tag.

I would like to let the player move to the next step, every time the user presses a key. In this case, I'll need to get the position of the next step that is the closest to the player, every time the player moves to the next position.

I have tried the following so far:

using UnityEngine;
using System.Linq;

public class Box : MonoBehaviour
{
    //the rigidbody of the box
    private Rigidbody2D player2D;

    // Start is called before the first frame update
    void Start()
    {
        player2D = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Vector2 targetPosition = GetNextTargetTransform(player2D.position );

            //here set trajectory to move from current position to target position
            Vector2 trajectory = SetTrajectory(player2D, targetPosition);
            player2D.AddForce(trajectory, ForceMode2D.Impulse);

            //after reach the position update player position to current position
            //player2D.position = targetPosition;
        }
    }

    public Vector2 GetNextTargetTransform(Vector2 player2Dposition)
    {
        GameObject[] step = GameObject.FindGameObjectsWithTag("step");

        //here is the code to get the nearest object using LinQ
        var nearest = step.OrderBy(t => Vector2.Distance(player2Dposition, t.transform.position)).FirstOrDefault();

        Transform nearestPosition = nearest.transform;
        Vector2 targetPosition = new Vector2(nearestPosition.position.x, nearestPosition.position.y);

        return targetPosition;
    }
}

I am able to get the position of the first step when a button is pressed, but when I press the key again, I am unable to get the position of the next step (and thus remain on the first position).

I've added player2D.position = targetPosition; after AddForce(...) and the player will directly appear on the first step and move to the next one, which is not the result I want.

Question

How do I get the position of the nearest step, every time the player moves to a new step?

sentences:
Java - Finding distance between player and tile in array What is the best way performance wise to do this? When I click a tile I want it to get the distance and if I am close enough I can interact with the tile. One way would be to find the tile by doing mouse / tile width when I click correct? But then how would I get that tiles position? I know how to find the distance I just don't know how to get a certain tiles position from the array when I click it

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

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

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

    //Distance code
    double lengthX = Math.abs(playerX - mousetileX);
    double lengthY = Math.abs(playerY - mousetileY);
    double distance = Math.sqrt((lengthX*lengthX)+(lengthY+lengthY));

    System.out.println(distance);
}

sentences:
Is glDrawArraysInstanced in OpenGL parallel when drawing those instances? Is glDrawArraysInstanced in OpenGL parallel when drawing those instances?

I cannot figure out by referring to its reference and numerous online tutorials.

[Update] To be more clear, I mean, for example, we have 100 instances.
Are the drawing of those 100 instances parallel?
For example, we have the 100 commands "glDrawArrays(mode, first, count);"?
Is execution of those 100 commands sequential or parallel?

I think it should be sequential. GPU begins to draw the second instance, only AFTER the first instance drawing finished.

Or glDrawArraysInstanced just save the time for "giving your GPU the commands"?

[Update 2] The reason I wanted to know the answer, is that:
If it is sequential, personally I think drawing thousands of tree leaves in this way is time consuming. I may draw them in one shader program with some algorithm tweak.

sentences:
What steps can developers take to improve the graphics of their games? My understanding is that the differences in graphic quality between games for systems like Xbox One and PS4 and Pixar-style movies stems from that the former are rendered in real-time.

But even with real-time rendering, it looks like some game makers can get rather nice looking results. An example below is about the new Gears of War game:

Above image is from this YouTube video posted by GameSpot. So admittedly it could be from a video (e.g. a promo) that has been rendered more than the actual game.

Anyway so what I wanted to ask is, are games solely dependent on the real time rendering on the target system, or are there some steps developers can take (besides the obvious: start with as good graphics as possible) to improve the graphics in their game?

Edit: here I am referring strictly to in-game graphics.

sentences:
How can I remap Unreal's Editor default movement (WASD) keys for a non-QWERTY keyboard I am using a French (AZERTY) keyboard, and as such my "usual" game movment keys are ZQSD instead of WASD. I have been trying to change Unreal Editor's default keys to those I am accustomed to but I can't figure out how to do it.

Using UE 4.19.1

Here are the settings I've tried so far:

sentences:
How to combine embedded generated graphs in a finite 2D plane? I'm pretty new to working with graphs but I'm looking at using them to create the world map for our game (a text mud with rooms/nodes and paths/edges between rooms). There are a number of interesting small-world generators, for example Watts-Strogatz (http://en.wikipedia.org/wiki/Watts_and_Strogatz_model) that I'd like to combine.

My question is how to combine different generators. All the rooms will have coordinates in an XY plane (the rooms themselves won't have real dimensions). I can easily generate a graph, and then laying it out I can work out the XY coordinates of its nodes. But then I'd like to generate a new graph and connect at least one of its nodes to a node on the previous graph.

My first idea is to figure out the XY bounding box of a graph, and use that to place it in the larger XY plane next to the previous graph (kind of tiling the graphs). Are there other methods I should be aware of?

sentences:
How do I query a LibGDX Box2DLights "light" and "dark" regions? I have lighting implemented using Box2dLight. I want to update/render things inside the player's PointLight area. Stuff in the dark area should not be rendered.

How can I find which areas are lit or dark?

My PointLights and Body look like this:

sentences:
Material tiling and offset in unity Ambiguity:
What exactly is the difference between Tiling the material and Offset of material?

Need to do:

I need the material to be repeated n times on the object where I need to set the value of n via script.How do I do it?

It seems to happen through Tiling(tried via inspector) but again what is difference between mainTextureOffset and setTextureOffset?

Tried:

Following is the line of code that I tried to repeat the texture n number of times on an object(repeat across the width of object), but it does nothing significant that I can see.

sentences:
Is it a good idea to use box2d to control sprite movement in a 2D game? I'm trying to use Box2D to control sprite movement.Some burning issues are these:

1.When I trying to move the sprite on a slope or a lean barrier. The sprite will move off the slope which is not what I want.

2.ALternatively, I could use setPosition or CCAction which provides by cocos2d-x to move the sprite and update the body position use SetTransform. But the body will lost it's physical limitation, it will passthrough other body.

Thanks for your time, if you guys got any solution?

sentences:
How can I toggle between single shots when clicking the mouse left button and automatic none stop shooting when clicking the mouse right button? I'm talking in build not in editor !

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

public class Shooting : MonoBehaviour
{
    [SerializeField]
    private Transform[] firePoints;
    [SerializeField]
    private Rigidbody projectilePrefab;
    [SerializeField]
    private float launchForce = 700f;
    [SerializeField]
    private Animator anim;
    [SerializeField]
    private bool automaticFire = false;
    [SerializeField]
    private bool slowDownEffect = false;

    private void Start()
    {
        anim.SetBool("Shooting", true);
    }

    public void Update()
    {
        if (isAnimationStatePlaying(anim, 0, "AIMING") == true)
        {
            if (Input.GetButtonDown("Fire1")/*automaticFire == false*/)
            {
                automaticFire = false;

                if (anim.GetBool("Shooting") == true)
                {
                    anim.Play("SHOOTING");
                    LaunchProjectile();
                }
            }
            else
            {
                if (/*automaticFire == true &&*/Input.GetButtonDown("Fire2"))
                {
                    automaticFire = true;
                }
            }
        }

        if(automaticFire == true)
        {
            anim.Play("SHOOTING");
            LaunchProjectile();
        }
    }

    private void LaunchProjectile()
    {
        foreach (var firePoint in firePoints)
        {
            Rigidbody projectileInstance = Instantiate(
                projectilePrefab,
                firePoint.position,
                firePoint.rotation);

            projectileInstance.AddForce(new Vector3(0, 0, 1) * launchForce);

            projectileInstance.gameObject.AddComponent<BulletDestruction>().Init();
        }
    }

    bool isAnimationStatePlaying(Animator anim, int animLayer, string stateName)
    {
        if (anim.GetCurrentAnimatorStateInfo(animLayer).IsName(stateName))
            return true;
        else
            return false;
    }
}

I tried to do it in the Update using the automaticFire variable but it's not working fine.

When clicking first the left mouse button it's shooting singles but then when clicking the mouse right button it's shooting automatic but then when clicking the left mouse button again it's not back to single shots again it's staying on automatic.

The idea is right click mouse button automatic fire left button each time clicking the left mouse button the automatic should stop and then single shots with the left mouse button. And this way to toggle between the Fire1 and Fire2.

Fire1 = left mouse button click Fire2 = right mouse button.

sentences: Drawing polygons with a repeating texture on iOS I want to draw a terrain for a 2d game, and this terrain is defined by some rotated rectangles and circles, I want to draw my terrain as if it was a repeating texture clipped by those forms. I already modified the cocos2d draw primitives methods to draw them using a triangle fan, but I'm not sure how to apply a texture on them.

sentences:
Is Updating Sprite/Entity Movement Using Framerate Necessary? Apologies if this is a dumb question I'm still new to this, but I'm trying to understand if calculations of sprite movements/hitboxes/etc. is necessary or is generally better than just using fixed values to calculate movement or events (i.e movement += velocity/framerate vs. movement += velocity/constant).

The main reason I ask is that while following tutorials for basic movements they use the frame rate to determine how to move the sprites, but I haven't seen a full explanation as to why things are done that way. While I was using these tutorials, things seemed to work well, but after I moved past them I've run into odd issues. I'm not sure if that was just because the games in the tutorials were very simple, like pong and breakout, and I just didn't notice these problems.

For example, I made a very simple demo where I take a sprite and have it bounce off the edges of the screen. When it reaches the edge the velocity reverses and it goes in the opposite direction. While the numbers show as correctly calculated, visually it's wrong, either rebounding early or beyond the edges of the screen. However, when I replace frame rate with a constant number it works perfectly. Even when I replace the frame rate with a random value of particular range (say 45-60) it works well. It seems to me on the occasion that the frame rate dips below 30, it throws off everything and doesn't recover.

I've heard about limiting frame rate and that makes sense in a capping the top way, but is limiting it below also something that is done? If so, it doesn't seem too different from just putting in a constant and I wonder what benefits using frame rate even has at that point.

tl;dr: I guess what I'm asking is what are the pros and cons of using frame rate to determine how things move/interact vs using constant values and will it create problems down the line if I try to forgo frame rate completely?

sentences:
How to make HLSL effect just for lighting without texture mapping? I created an effect and just want to use lightning but in default effect that XNA create we should do texture mapping or the model appears 'RED', because of this lines of code in the effect file:

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
float4 output = float4(1,0,0,1);

return output;
}

If I want to see my model, I must do texture mapping by UV coordinates. But my model does not have UV coordinates assigned or its UV coordinates are not exported.

I do texture mapping by this line of code in vertexshaderfunction:

 output.UV= input.UV

When I use BasicEffect I have no problem and model appears correctly.

How can I use "just" lightings in my custom effects?

here is inside of my Model Using BasicEffect

This is my code for drawing with or without BasicEffect inside of my draw() method:

    Matrix baseWorld = Matrix.CreateScale(Scale) * Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z)
            * Matrix.CreateTranslation(Position);

        foreach(ModelMesh mesh in Model.Meshes)
        {
            Matrix localWorld = ModelTransforms[mesh.ParentBone.Index] * baseWorld;

            foreach(ModelMeshPart part in mesh.MeshParts)
            {
                Effect effect = part.Effect;

                if (effect is BasicEffect)
                {
                    ((BasicEffect)effect).World = localWorld;
                    ((BasicEffect)effect).View = View;
                    ((BasicEffect)effect).Projection = Projection;
                    ((BasicEffect)effect).EnableDefaultLighting();
                }
                else
                {
                    setEffectParameter(effect, "World", localWorld);
                    setEffectParameter(effect, "View", View);
                    setEffectParameter(effect, "Projection", Projection);
                    setEffectParameter(effect, "CameraPosition", CameraPosition);
                }
            }
            mesh.Draw();
        }

setEffectParameter is another method that sets effect parameter if i use my custom effect.

sentences:
Best approach to implement server authority in client/server game I am currently trying to create a 2D game with a client/server model, and was wondering how I could implement the server's authority over the client (when client moves, prediction happens, and server checks if the prediction was well done, and if not, client reverts to older state).

Should I create a State class where the local player's state is saved at every tick in a buffer, for revert being possible ? Or should I wait for the server to respond and should the client be a simple renderer ?

How could I make sure that client and server are synchronized ?

I use pure java Socket class as well as DatagramSockets.

sentences:
Is Unity + Scala.js possible or even makes sense? I never actually used Unity (yet) and I have no possibility to check anything now, but I'm thinking about Unity for my project. I actually know C# (and hate it for some unimportant reason) and I think I'm able to learn JS or UnityScript, but I just want to use a language I know and love - Scala.

There is Scala.js - a tool that compiles Scala code to JS code. And i'm thinking: is it possible to write Scala code in some IDE (Intellij), compile it to JS code and load into Unity? And if it IS possible, what difficulties may I encounter? Does this idea even makes sense, or should I forget it, use C#/Learn JS/UnityScript or just search some Scala game frameworks?

sentences: How could you create an SSX style snow trail in unity3d? So it SSX (a snowboarding game) when you are snowboarding you leave behind a dents in the snow(like a trail) .It's like how if you take a step in the snow you will leave a footprint behind but with a snowboard you leave a trail of where your snowboard has been. Can you create this or is this not supported by unity? If you can, how? Thanks in advance

sentences:
How can I exploit multithreading in collision resolution? I'm trying to speed up my collision resolution by using multiple threads.

I'v read through Box2D's source code and while it was challenging and educating, it didn't really point me to how I could use multiple threads.

I'm ready to make some sacrifices with accuracy. I am investigating this because I have boatloads of game objects.

My current implementation handles AABB checks for 100000 objects in about 10 ms. I have no idea if this number is good, but for my purposes it seems sufficient.

Next, I'm trying to figure out how to resolve collisions. How could I get power out of multiple threads here?

This is what i'm currently planning to do: (Do you see any issues with it?)

Calculate position for each object in separate threads based on manifold data
Update existing manifolds in separate threads
get New collisions for moved objects in separate threads
Repeat 10 times or until no changes

sentences:
Filling a room with random furniture This is a rather complex question and I'm more hoping for general algorithms anyone might have heard of.

I wish to generate randomly sized rooms. Each of these rooms has a type and a corresponding list of furniture to be placed inside it (ie: kitchens can have fridges, both kitchens and living rooms can have TVs, etc). Each piece of furniture has it's own collider (cylinder, cube, mesh...). Are there any good algorithms to randomly lay them out?

The best idea I've managed so far is to subdivide the room into a grid the size of the smallest piece available. Then I would randomly place the furniture until every grid square is at least partially filled. However, this is hardly ideal and the rooms would more or less look like warehouses.

[Optional]How do I randomly place the furniture in such a way as to make it at least look slightly realistic?

sentences:
Slowmotion except main player? My script works fine except I don't know how to not let the slow-motion affect the main player.

public GameObject player;

void  Update () {
    if (Input.GetKeyDown(KeyCode.A)) {
        Time.timeScale = 0.5;
        Time.fixedDeltaTime = 0.02F * Time.timeScale;
    }

    if (Input.GetKeyDown(KeyCode.Z)) {
        Time.timeScale = 1.0f;
    }
}

sentences:
How does mmorpg store data? I want to use sql database in my server.exe.

lets say 1000 users online. And players will change their data when they play. And server need to save these updates.

But how ?

i think there two way:

1) server will save in ram at run time and sometime or hourly server will write data (update) to sql database from ram. But if electricity goes or somehow the server shuts down , updates won't save. of course i don't want lose updates.

2) server will save updates in database at run time. but what will happen to speed ? I thought of a method. i will show you below with image. Can i get enough speed for 1000 online players with this method ?

sentences: How How can I make a simple combo combat system in Unity I'v been trying to make a melee combo combat system in the Unity Animator, but I can't seem to get it right. I'm trying to go for a combo system that flows from Hit 1 to Hit 2 to Hit 3, ect, with clicks from my mouse, and if I don't click again it will go back to Idle. How would I go about making this combo attack system in the Animator with Unity and C#.

sentences:
Perspective View using Spritesheets I am creating a Top-View 2D game. However, the only way i can get a good view of the objects, such as houses, trees, is to make the game in orthographic view. The same way games such as Pokemon games in GameBoy Advances used. Until i found out that, GTA 1 and 2 are originally in top-view. Whenever the car (your focus) passes a building, the view of the building changes, specifically, the "Skewness" of the building.

Is it possible to do this using SpriteSheets? or atleast a single image and just dynamically change its attributes? or GTA 2 is already using a 3D game engine.

sentences:
Why does my blur shader implementation produce this strange result? I tried to implement the blur shader shown here.

Instead of having a simple 2D texture I use Unity's GrabPass function to capture what's behind the plane to have a transparent effect. Then I apply this on a 3D plane:

struct v2f {
    float4 pos : SV_POSITION;
    float4 screenPos : TEXCOORD3;
    float3 uv;
};

v2f vert(appdata_full v)
{
    v2f o;
    o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    o.screenPos = ComputeScreenPos(o.pos);
    o.uv = UNITY_PROJ_COORD(o.screenPos);
    return o;
}

// In the frag part there is the shader blur computation but based on XYZ, with Z = 0

Then I apply the blur and this leads to this when I zoom in:

Is there a way to avoid this effect?

sentences:
Monogame sprite rotation issue I'm having interesting problem with rotating a sprite in MonoGame. Here is how origin, destination rectangle and scale are created:

  Vector2 origin = new Vector2(tx.Width / 2, tx.Height / 2);

  Rectangle dstRectangle = new Rectangle((int)e.Xpos, (int)e.Ypos, (int)(tx.Width), (int)(tx.Height));
        dstRectangle.X += (tx.Width / 2);
        dstRectangle.Y += (tx.Height / 2);

  Vector2 scale = new Vector2(tx.Width * (float)TxScaleFactor, tx.Height * (float)TxScaleFactor);

And here is the draw function:

 Editor.spriteBatch.Draw(texture: GlowWhite, destinationRectangle: dstRectangle, color: Tint * (Alpha * 0.6f), rotation: rotation, scale: scale, origin: origin);

Now, with angle 0.0f, everything is fine but any additional rotations become weird:

Zero rotation, white background is WinForms picturebox, below is MonoGame

90 deg

And 180 deg

Its like there is some kind of offset - I've tried to change 0 to 90, and back 0 and next to 180 - result is always the same (apparently, there is no adding). I'm guessing that problem is related to origin, destination rectangle or scale. Sprites are rotated in place as you can see (no issues with that) but something with rotation isn't right. Any ideas?

sentences:
Rendering performance in FlasCC + UDK when compared to Stage3d and UDK on Windows? Adobe recently released the Flash C++ Compiler, which UDK uses to target Flash Player.

Developers can now access UDK for browser applications. Does this mean greater performance than using a Stage3D engine (Away3D 4) and how much of a noticeable difference in performance would it make in rendering speeds?

Is there any benchmark you could propose that would allow to compare them fairly?
I am asking this to help myself understand the consequences in performance for deciding to use UDK in a browser based game. I would also like to know how it compares with UDK running natively in Windows?

I am not asking which technology to use or which is better. Only interested in optimizing rendering speed in a 3d browser game with flash.

sentences:
Why is my character jumping at different heights randomly? I have a character controller on my character's gameobject and I'm trying to make the character jump. This is working but sometimes he jumps way higher than other times. Does anyone know why this is happening? Here's the code:

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

public class Movement : MonoBehaviour
{
CharacterController cc;
public float Speed;
float Forward;
float Sideways;
float vertical;
public float gravity;
public float Jump;

// Start is called before the first frame update
void Start()
{
    cc = GetComponent<CharacterController>();
}

// Update is called once per frame
void Update()
{
    Forward = Input.GetAxis("Vertical") * Speed;
    Sideways = Input.GetAxis("Horizontal") * Speed;

    if (!cc.isGrounded)
    {
        vertical -= gravity * Time.deltaTime;
    }
    else
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            vertical = Jump * Time.deltaTime;
        }

        vertical = -8 * Time.deltaTime;
    }

   Vector3 Delta = transform.TransformDirection(Sideways, vertical, Forward);

    cc.Move(Delta * Time.deltaTime);
}
}

sentences:
Upload vertex data for particles I am kind of beginner with opengl.

I am using point sprites (currently without any texturing) for my particles. I seem to fail to get them uploaded to the GPU memory correctly. I have readed lots of tutorials on VBOs and VAOs and I can not locate the reason why the particles seems to be wrong.

The problem is, that some of the particles are behaving correctly, but others dont. They have random colors even if every one of them should be white and they are not in correct point in space. Also when a particle dies and the size of the array gets decreased, all particles warp in another location.

Here is my particle GPU data struct:

[StructLayout(LayoutKind.Sequential)]
public struct GPUParticle
{
    public Vector4 Position;
    public Vector4 Color;

    public static int SizeInBytes = Vector4.SizeInBytes * 2;
}

Here is the VAO, VBO and EBO initialization:

GL.GenBuffers(1, out Vbo);
GL.GenBuffers(1, out Ebo);
GL.GenVertexArrays(1, out Vao);

// Bind the VAO as current
GL.BindVertexArray(Vao);

// Bind the VBO to the VAO
GL.BindBuffer(BufferTarget.ArrayBuffer, Vbo);

// Describe the VAO data

GL.EnableVertexAttribArray(0);
GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0);

GL.EnableVertexAttribArray(1);
GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, 0, Vector4.SizeInBytes);

// Bind the EBO to the VAO
GL.BindBuffer(BufferTarget.ElementArrayBuffer, Ebo);

// Unbind the VAO
GL.BindVertexArray(0);

And here is the uploading which I do on every frame:

// Bind the buffer and send the data to the GPU
GL.BindBuffer(BufferTarget.ArrayBuffer, Vbo);

// Invalidate old data
GL.BufferData (BufferTarget.ArrayBuffer, new IntPtr(Count * GPUParticle.SizeInBytes), IntPtr.Zero, BufferUsageHint.StreamDraw);

// Upload new data
GL.BufferData (BufferTarget.ArrayBuffer, new IntPtr(buffer.Length * GPUParticle.SizeInBytes), buffer, BufferUsageHint.StreamDraw);

// Unbind
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

//Console.WriteLine ("Uploaded array buffer. Count: {0}", buffer.Length);

// Update index buffer only if there are more elements in the buffer than there has ever been
// Generate index buffer for EBO
indices = new uint[buffer.Length];

// This is really stupid. Perhaps we really do not need any indices?
for(ushort i=0; i < buffer.Length; i++)
{
    indices [i] = i;
}

// Bind the EBO for uploading
GL.BindBuffer(BufferTarget.ElementArrayBuffer, Ebo);

// Invalidate old data
GL.BufferData (BufferTarget.ElementArrayBuffer, new IntPtr(Count * sizeof(uint)), IntPtr.Zero, BufferUsageHint.DynamicDraw);

// Upload new data
GL.BufferData (BufferTarget.ElementArrayBuffer, new IntPtr(buffer.Length * sizeof(uint)), indices, BufferUsageHint.DynamicDraw);

// Unbind EBO
GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);

// Save the particle count for drawing and zeroing the buffer
Count = buffer.Length;

Here are the shaders:

#version 330 core
// VERTEX SHADER
layout(location = 0) in vec4 vertex;
layout(location = 1) in vec4 color;

uniform mat4 mP;
uniform mat4 mV;

out vec4 fragColor;
out vec4 pos; // For debugging

void main(){
    fragColor = color;
    pos = vertex;
    gl_Position = mP * mV * vec4(vertex.xyz, 1.0);
}

#version 330 core
// FRAGMENT SHADER
in vec4 fragColor;
in vec4 pos;

layout(location = 0) out vec4 color;

void main(){
    color = fragColor;
    //color = vec4(1,1,1,1);
    //color = pos;
}

I  have simplified the code a bit, but this is basically what I do. I am unable to spot what I am doing wrong.

The most weird thing is, that when in vertex shader I swap the color to be used as vertex and vertex to be used as color, the motion of the particles gets corrected, but the colors are still going haywire.

Any suggestions? I am out of ideas myself. Is the VAO initialization / uploading code correct?

sentences:
Trying to create a '2D 8 Ball Pool' game - Trajectory Prediction I am trying to create a game similar to (Pocket Run Pool) https://www.youtube.com/watch?v=ewlAE6NQnsI&t=215s a 2D pool game that is much simpler than a 3D one I need help with creating code for trajectory prediction something similar to this https://docs.unity3d.com/Manual/physics-multi-scene.html
How do I go about doing this?

sentences:
Recommended hardware for developing ios games? I know you have to have mac os x to use xcode and thus to develop/compile apps for the iphone. And I'm not exactly wanting to go the hackintosh way, so I'm looking at buying a used mac.

What specs are recommended. If I buy a cheap mac mini that has only 1gb of ram would that be enough? (I'm not talking about using that to create the graphics/audio, I'll use my normal windows/ubuntu pc for that). I'm just talking about being able to use xcode and write applications.

I'm trying to spend the least amount I can without running into problems developing the app.

sentences:
Where can I access the installed Maya Bonus Tools? I installed Maya 2013 Bonus Tools... checked plugin manager... don't know what plugin to load to use UV Align feature.

Where can I access the installed Bonus Tools?

sentences:
Non axis aligned bounding box collision and physics Exactly how much more expensive, and while we're at it, difficult, is it to have non-axis aligned bounding boxes in your framework?

I realise that it very much depends on what you're trying to do, so here's a little bit of detail; My small demo framework has a number of bots running around shooting each other. when they die, they explode into cubes. When they're hit, or the bullets miss and hit a wall; more cubes.

At the moment I'm taking advantage of the fact that my framework has no floor, just walls, so you can't really tell if the cubes are resting exactly on the floor or not - as a result I'm using bounding spheres as a cheats collision detection. The main visual problem is when a bot dies from a point blank shot; the middle of the agent blows out backwards but the bottom and top parts sort of collapse into a little pile of cubes.

I'd love to be able to have much more realistic physics on all the cubes so they collide and tumble realistically over one-another.

How would I go about achieving this? and how feasible is it? to have a little physics engine which is just cube on cube.

sentences:
A little bit confused on how to set normals in this case I'm learning how to use VBOs and I'm following up on the tutorial at the bottom of this page.
So I went ahead and created a structure Vertex to hold vertex data.(coordinates and normals).
struct Vertex  {
  GLfloat  x,  y,  z;
  GLfloat nx, ny, nz;
  GLfloat   r, g,  b;
  GLfloat padding[7];
};

For the moment I'm trying to draw a cube.So I created an array with 8 vertices.
My question is how do I set the normals?
When I used immediate rendering, I would just do a glNormal3f and proceeded to draw the vertices for that face.
Now that the normals are defined on a per-vertex basis, and a vertex practically belongs to 3 faces, I'm somewhat confused as what I should do here.
Have I taken a wrong approach on making that structure, or I am missing something else.
I would also like to note that I want to make something more generic, so I don't want it to be limited to just drawing cubes.
Thanks.

sentences:
Monitoring and storing chat logs in a 3D space There are a lot of 3D games on the market with text chat functionality holding literally thousands of conversations happening at the same time.

Being in a 3D space is there a defacto method of monitoring and storing these?

The difficulty I can see is that not all text is visible to all participants at all times meaning a raw chat log wouldn't make any sense, with having so many conversations occurring in real time.

sentences:
How to use base.Function() in Unity I am using 3 classes:

EnemyBullet : MonoBehavior
EnemyBulletType1 : EnemyBullet

EnemyBullet Class:

void FixedUpdate(){
    this.gameObject.transform.rotation = Quaternion.Euler (new Vector3 (0,0,90));
}

EnemyBulletType1 Class:

override void FixedUpdate() {
    base.FixedUpdate ();
    //Do something else here
}

The reason is I'll have many EnemyBulletType classes and I want them all to do a common thing and then do something on their own.

Question:
This code isn't working: Error: virtual or abstract members cannot be private
How is FixedUpdate() defined in the MonoBehviour and how to change it to help my usecase?

sentences:
Basic Connections Through Socket Server I'm designing a simple 2 player RTS with Stencyl, a program that uses blocks for coding. The current code updates lists whenever an actor moves (new X and Y), and I'd want the server to update the game state with each change to the list. However, to start off: I don't even know how to set up a socket server. Stencyl has taught me the basics of logic, but I've yet to learn any programming languages.

I've downloaded a Smartfox 2X socket server that I'm intending to use. Right now I'm only looking to make baby steps; I want to do something to this effect: "When someone connects to the server, open insert file here". How can I do this? My intention is to have this file be the game client. Is this "open file when connected" method the best way to go about this? When answering: assume that I know nothing, because really, though I have done research (I know that UDP>TCP for real time), implementation-wise I know nothing.

sentences:
Unity / Animation / Change the "Transition Speed" between 2 animations during runtime I need to change the Transition Duration per Runtime.
I just didnt find a way to do access it.
I found questions with similar problems though (links below)- those didnt work for me because they accessed it to change it via editor - script. But I need it in runtime.
Is that even possible?

https://stackoverflow.com/questions/29315507/unity-5-access-modify-animatorcontroller-from-c-sharp-script-in-editor

sentences: Can I add rigging bones to a model imported from Blender inside Unity? I created a model in Blender but recently I stumbled upon a video claiming that you can add rigging to a model in Unity. So instead of rigging in Blender, is it possible to do it in Unity?

sentences:
How to create 3D area mask? I have two cubes, one parent and one child. I want to use the parent's cube mesh as a mask for the child cube. I want to make visible only the part of the child cube that it is inside the parent cube.

I can easily achieve this effect with 2D sprites using the Sprite Mask, but I can't find a way to do it for 3D areas or 3D objects.

What I have:

What I want:

sentences: What exactly does SDL_RenderSetClipRect do? I assumed that this function would move the area which is clipped out of conceptual space and copied onto the renderer (and subsequently drawn to the window) - i.e. change the origin of rendering - but it doesn't seem to do this. Anybody know how it works?

sentences:
Area Lights in DirectX So after reading https://www.guerrilla-games.com/read/killzone-shadow-fall-creating-art-tools-for-a-new-generation (a guerilla games presentation on PBR) I noticed the Area lights as opposed to the standard Directional, Point & Spot lights in DirectX can produce very realistic shadows.

Now a lot of the resources online talk about it and what it is but there's not much regarding implementation. Some websites online say that it is just an array of lights but I don't think that's what it is.

Can somebody explain how I can implement this (and maybe with some code). If you could include any links to some good resources regarding implementation that would be great aswell.

sentences:
Saving a high score and updating it as score increases I'm following Brackeys "Dodge the Blocks" tutorial. In the video, he covered everything accept the score/high score system.

I have a working score system, which gives you 1 point every time you collect a coin.

In the scene where you play the game, I have a text UI that says "Score:", and another one for the score number, another that says "Best:", and one more for the best number.

I want to make it so that your high score gets saved, and updates in real-time with your score every time you pass the score.

Here are some of the scripts:

UI Manager (Where I want to put the high score code):

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

public class UIManager : MonoBehaviour {

    public Text scoreText;
    int score;

    public static int coinAmount;
    void OnTriggerEnter2D(Collider2D col)
    {
    CoinTextScript.coinAmount += 1;
        Destroy (gameObject);
    }

    public void scoreUpdate()
    {
        score++;
    }
}

Coin Text Script:

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

public class CoinTextScript : MonoBehaviour {

    Text text;
    Text bestScoreText;
    public static int coinAmount;
    public int score;

    void Start()
    {
        text = GetComponent<Text> ();
    }

    void Update()
    {
        text.text = coinAmount.ToString();
    }
}

sentences:
Objects stick together on Collision I have a ball which has CircleCollider2D attached to it. It is also rigidbody. When it lands on a platform, it jumps . The platform is static, with Edge Collider attached. It also has a platform effector attached with "Use One Way" selected.
Most of the times it works fine, but some times, the ball lands on the platform and instead of bouncing, just sits on the platform.
When ball lands on the platform, following code is executed:
 rb.AddForce(upForce, ForceMode2D.Impulse);

upForce is Vector2(4,10);
image shown below:

Why is this happening?

sentences:
Unity - Water Cube (to 2D game) I wonder if you can create a cube of water within the unity!

I'm starting to use the Unity, and took a sought as to whether there was already something like this ... but have not found any tutorial

The idea is to use the 3D feature of water and turn it into a 2D scenario:

As shown below:

For this result:

The idea would be to make the cube of the material is "water".

Its possible?

sentences:
Time reverse mechanism in games I am wondering about how time manipulation mechanisms in games are typically designed. I am particularly interested in time reversing (sort of like in the latest SSX or Prince of Persia).

The game is a 2D top down shooter.

The mechanism I am trying to design/implement has the following requirements:

1) Actions of entities apart from the player character are completely deterministic.

The action an entity takes is based on the frames progressed since level start and/or the    position of the player on the screen
Entities are spawned at set time during the level.

2) Time reverse works by reversing back in realtime.

Player actions are also reversed, it replays in reverse what the player performed. Player has no control during reverse time.
There is no limit on the time spent reversing, we can reverse all the way to the beginning of the level if wanted.

As an example:

Frames 0-50:
Player moves foward 20 units over this time
Enemy 1 spawns at frame 20
Enemy 1 moves left 10 units during frame 30-40
Player shoots bullet at frame 45
Bullet travels 5 foward (45-50) and kills Enemy 1 at frame 50

Reversing this would play back in realtime:
Player moves backwards 20 units during this time
Enemy 1 revives at frame 50
Bullet reappears at frame 50
Bullet moves backwards 5 and disappears (50-45)
Enemy moves left 10 (40-30)
Enemy removed at frame 20.

Just looking at movement I had some ideas about how to achieve this, I thought of having a interface that changed behavior for when time was advancing or reversing. Instead of doing something like this:

void update()
{
    movement += new Vector(0,5);
}

I would do something like this:

public interface movement()
{
    public void move(Vector v, Entity e);
}

public class advance() implements movement
{
    public void move(Vector v, Entity e)
    {
            e.location += v;
    }
}

public class reverse() implements movement
{
    public void move(Vector v, Entity e)
    {
        e.location -= v;
    }
}

public void update()
{
    moveLogic.move(new vector(5,0));
}

However I realised this would not be optimal performance wise and would quickly become complicated for more advance actions (such as smooth movement along curved paths e.t.c.).

sentences:
Solve Constraints with linear factor of 0 in Bullet Physics In my code I need to set the linear factor for velocity to 0 (sometimes). For example, game->rigidBody->setLinearFactor(btVector3(0, 0, 0)); When this is done, collision detection continues to work, however, collision response fails to work. Essentially running as if there were not colliders at all. I think this is because it applies a velocity to solve the constraints.

Is there an alternative to setLinearFactor or is there another Constraint Solver which does not rely on velocity?

I am using the default btSequentialImpulseConstraintSolver();

sentences:
Smoothing a shot power curve I'm making a game with shot powers (user presses and holds and launches an object)

Distance from the cursor was working for testing but obviously a distance of 1 and 2 pixels is double. I scaled this by 4 to make the difference itself less drastic but they're double of each other.

Is there a common way to smooth the strength of a shot so it's not so great per jump?

sentences:
XNA: weird effect by matrixTransform of spriteBatch on isometric tile I wrote a Camera class that contains Matrix (for zooming and moving around). When I zoomed it with any zoom scale other than 1, some isometric grids becomes visible on each of my isometric tile.

//Camera.cs
//Producing the matrix from previously set Zoom and Location
        public static void Update()
        {
            Transform =         Matrix.CreateTranslation(Location.X, Location.Y, 0) *
                                Matrix.CreateScale(Zoom,Zoom,1);
            InverseTransform =  Matrix.Invert(Transform);
        }

//Game.cs
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, Camera.InverseTransform);

                /* Some Drawing */

            spriteBatch.End();

PS: Actually, I really want these grids to be visible for zoom scale of 1.0f too. Having these grids make my game looks more like a tile-based game.

Before Zoom (Scale = 1.0f):

After Zoom (Zooming in):

After Zoom (Zooming out):

Zooming very close (Grid line appears to be more than one pixels):

sentences:
.NET Framework version is fixed for Unity scripts? It seems that the C# project that Unity creates uses version 4.7.1. But I want to use only the latest version and do not want to install lots of older versions of .NET Framework targetting packs that I do not use. Even if I change the version to 4.8 and save the project, if I add a new script asset, then the version changes back to 4.7.1.

So, my question is, do I have to use the version that Unity sets by default? Or is there a way to make Unity always use the latest .NET version such as 4.8, in this case? If the answer is the former, I will give up and install 4.7.1.

sentences:
Movement on a curved planet surface I'm looking for a solution for moving a variety of objects over the uneven surface of my planet. The idea is that I will have a number of objects that follow the planetary landscape moving about in random directions.

The planet surface is made up of 6 sphere projected planes, all have been displacement mapped to create a "bumpy" surface. A grid based movement system would be ideal as it lends itself to a lot of pathfinding solutions. I am also using Unity, so leveraging the Physics engine is an option, but past experience hasn't yielded very good results.

I'm having trouble understanding the best approach for realistic movement, would it be a matter of calculating gravity and then translating the object along its forward, right etc. Or on the other hand would It be more a case of pre-calculating the path from A to B and applying that movement.

I've looked all over for some ideas on this subject but have found nothing. A few suggestions would be greatly appreciated.

Thanks.

sentences:
Pixel perfect clickable picture in OpenGL/C++ So I have a picture(for easier understanding of problem like this: http://www.lib.utexas.edu/maps/europe/europe_95.jpg).

My goal is to click on any of the countries and get what country I clicked. The picture is full of colors, not just simple lets say Germany is purple. Also if I hover above a country I could also do things, like highlight it, write some text in a bar, etc.

What solutions popped in my mind:

Draw every slice into a mesh, and ray trace the click. (making lots of meshes is a lot of time)
Draw a single quad with texture, make a pixelmap, and get the coordinates clicked, then look up in the table.(I have to make a map for every resolution)

Is there any better way of doing this? Or are there any algorithms for it?

sentences:
Software and Hardware Rendering From what I understand, the main difference between software rendering and hardware rendering is that in software rendering you use the CPU to determine what to color each pixel, and in hardware rendering you let the GPU take care of calculations and determine how to draw each pixel.

However, in the end, isn't an API such as OpenGL still required to do the actual drawing no matter which method you pick? I saw a basic software rendering engine that someone built, and the person said he still used OpenGL to do the actual drawing after using the CPU to do the rendering. So is an API like OpenGL or DirectX still required in the end? And if so, is it true that a computer must at least have an integrated GPU or dedicated GPU to display anything at all?

sentences:
Set rotation on single axis with provided angle using Quaternion I am using a Quaternion to represent the rotation of some object, and I would like to allow the user to rotate it about a single axis at a time using textbox, so he would write the angle that the object is rotated by (ex. at X-axis), then the object rotation is set to that rotation.
I know that, this operation q1 * q will rotate q by q1, but I don't know how to set the rotation at a single axis, Could any one help me to complete this function?

public void SetRotationX(float Angle)
{

}

sentences:
Using a GLSL fragment shader to draw a texture in the middle of a quad I'm not sure how possible this is, but I'm trying to use a fragment shader to draw a portion of a texture in the middle of a quad. This is all 2D. The quads consist of four vertices from (0, 0) to (width, height). The modelview matrix is transformed to position the quads.

I have a sprite sheet of 32x32 icons and a 32x32 quad that one of the icons is mapped to. In a vertex shader, I'm creating a 2 pixel 'border' around the quad by moving it's vertices out by 2 pixels. In a fragment shader, I want to display the texture with it's original size, in it's original position; basically, there should be no visible difference between the original 32x32 quad and the 36x36 quad. The result should be an invisible 'border'.

The only solution I can come up with is calculating the window coordinate for the corner of the quad in the vertex shader, then passing it to the fragment shader and subtracting it from gl_FragCoord, in order to get the position of each pixel relative to the corner of the quad. With this information, I can display the texture in the center of the quad, with it's original size.

Is there any easier way to accomplish this?

sentences:
How can I calculate the new vector of an object trying to push into (move along) the ground? Say I have a sphere (planet). If I have object on the surface, I want to limit movement so that it can only travel in directions along or above the surface.

Imagine a coin on a table. If I were to push the coin from up above at an angle, the table would cancel out any downward vector component and the coin would move in 2 dimensions across the table. This is what I would like to achieve.

In the case of a planet (sphere) then I can calculate the cancelling vector to some extent (this is just the line from the centre of the sphere to the point on the surface).

Now I struggle - how do I calculate the magnitude of the opposing vector such that it is sufficient to stop the object falling through the surface but not too big that it starts to launch the object away from the surface?

sentences: How to make the capsule collider that comes with character controller follow the animations I'm making a 3D endless running game like subway surf. When I swipe/press down arrow the slide animation starts but the capsule collider isn't following along as it doesn't slides along with the character. Searched a lot on this on the forums, one possible answer is to attach the collider with some bone. I tried doing so, but couldn't make it. As I'm fairly new to Unity please provide some insights to how to overcome this situation. Here are the screen shots of the collider not following the sliding animation

sentences:
What direction is forward when the rotation is (0, 0, 0)? I'm representing the rotations of my actors (or gameobjects) with euler angles (one float for each axis). And I've always considered the vector (1,0,0) (x,y,z) to be the actor's direction if all angles are 0. So if an actor don't have any rotation, and walks forward, he will be walking down the positive x axis.

However, I was implementing a camera today that's supposed to display the view from the actors perspective. If I use the actor's rotation, that is (0, 0, 0), the camera will be looking down the -z direction (straight into the monitor), but the actor is actually looking to the right.

If, instead, -z would be considered the direction when the rotation is (0, 0, 0), then the camera would be facing the correct direction. Is that how this is normally handled? Or am I thinking of this the wrong way?

To clear things up, I'm using a right handed coordinate system with y as the up axis.

sentences:
How to write properly shader with gradient based on vertex-color? I took 4 squares with the outer corners painted in black, and the other ones in white. For some reason, they have a different gradient.

fixed4 frag (v2f i) : SV_Target
{
    fixed4 mainTex = tex2D(_MainTex, i.uv);
    fixed4 overTex = tex2D(_OverTex, i.uv3);
    fixed4 final = fixed4(lerp(mainTex.rgb, overTex.rgb, overTex.a) * i.color, 1.0);
    final = lerp(float4(0, 0, 0, 1.0), final, i.color.a); // shadows

    return final;
}

How can i make the same gradients as bottom-left and top-right?

In-game this is faces of blocks (like minecraft) and gradients - is smooth shadow/light. So I cannot change tris

sentences:
3d game terrain creation approach I want to create a terrain/world map for my 3d game.

I want a huge map. For example, ill make it in Blender or generate from a heightmap. Then I plan to divide it in chunks so I can load/unload and show/hide them when needed in the game.

If I want to remake the map, then I will have to divide it in chunks again, and again spend time on placing world objects on the terrain. I'm not sure that is the best way.

What approach is optimal here?

sentences:
Game resource timers - general implementation I'm interested in understanding how resource generation timers work on many of the mmorts type games out there. I can't wrap my head exactly around how the timers are synched with servers, especially with multiple users. If I need to provide more details, please let me know.

Thanks!

sentences:
Player must places the object in the preset position I want to know how to do like this video:
https://youtu.be/6gouxqSxeG8
At the minute 3:09, the player can put the street vendor in the predetermined location (with the green arrow show that place).

Please tell me some keyword about this or video tutorial about how to implement it in unity 2d.

Thanks.

sentences:
What makes a good tech tree? In strategy/simulation games there are often tech/research trees which allow players research new abilities/options, improve existing options and decease negative effects.

Some games seem to follow the abc approach of item 1 -> item 2 -> item 3 with minor stat changes while others make every unlocked option wildly change the way a game is played by throwing new units into the game which are able to change the balance of the game. Some make unlocking one branch block off another for the rest of the game while other will let you research everything. Some let you research multiple things while others will penalize you for switching research before it is complete. On that note tech trees can be progressive (with dedicated research over time unlocking an item) while some need you to collect enough money/points in order to unlock instantly.

What are some general guidelines for when to employ what strategy in a game? What games types of games would benefit more from one tech tree type over another and why? When should a linear tech tree be employed over a branching one?

Edit

For example a game where the main character has to build up an organisation and research technologies in secret while others are finding them and shut them down resulting in lost research laboratories, which reduce research output. The research output should increase somewhat exponentially as the game goes on as better technology is unlocked and research laboratories are upgraded. There would presumably be a very large tech tree to explore and the constant danger of losing facilities to other parties until you either unlock some endgame tech or lose everything.

Why this isn't a duplicate

Some people are marking this question as a duplicate because there is a related question about tech tree size. This question has to do more with the connections, cost and relationships between the technology options (of which size is a factor but not everything).

sentences:
shadow mapping with directional light and octree i am about to add shadow mapping to my simple game, i have a map level structured in an octree the camera culls out the octree nodes out of the vieweing frusutm and everything runs smooth. Now i want shadows and i have a doubt , the directional light runs is set at an infinite distance so basically it encompasses all the octree destroying the purpose of node culling. How can i add a directional shadow map and cull nodes outside the light frusutm if it is at an infinite distance ?
thanks in advance

sentences:
MonoGame - Left/Right Sided Collision Not Working I'm working on a platformer as part of my course, the problem I have come across is Left/Right sided collision is not working very well. I already have bottom & top collision working. Here is an example of the problem in action:

As you can see pretty much all the time I'm slowing down, I know this issue but haven't found a work around code solution yet. The main problem I'm having as you can see is my player being able to slide almost into the middle of the block if he's coming down and moves into the block.

The slow down problem is due to my left/right collision code, I just haven't found a viable solution yet for sided collision.

Collision Code:

        foreach (SkyTile block in PlatformBlocks)
        {

            IntersectRectangle = block.GetRect();
            GetRect().Intersects(ref IntersectRectangle, out IntersectResult);
            if (GetRect().Intersects(block.GetRect()))
            {
                if (IntersectResult && (IntersectRectangle.Bottom > GetRect().Bottom))
                {
                    isPlatformColliding = true;
                }

                if (IntersectResult && (IntersectRectangle.Top < GetRect().Top))
                {
                    isPlatformBottomColliding = true;
                }

                if (IntersectResult && (IntersectRectangle.Left > GetRect().Left))
                {
                    isPlatformLeftColliding = true;
                }

                if (IntersectResult && (IntersectRectangle.Right < GetRect().Right))
                {
                    isPlatformRightColliding = true;
                }
                break;
            }
        }

        if (isPlatformColliding)
        {
            velocity.Y = 0;
        }

        if (isPlatformBottomColliding && !isPlatformColliding)
        {
            velocity.Y = 20;
        }

        if (isPlatformLeftColliding)
        {
            velocity.X = 0;
        }

        if (isPlatformRightColliding)
        {
            velocity.X = -0;
        }

sentences:
XNA: Non-overlapping shadows I want to create an effect similar to the following in XNA / MonoGame:

There's a background and a semi-transparent shadow consisting of several objects (two circles in this example). However, the shadows merge without darkening their overlapping region!

My current approach was the following:

Render all required shadow objects using a DepthStencilState and a AlphaTestEffect.
Then, render a single-pixel semitransparent black texture over the entire screen using another DepthStencilState to display shadows.

However, it didn't work as expected: the shadow objects get rendered to the target, and the stencil buffer seems unaffected.

Here's what I want:

A way to render a sprite to Stencil Buffer only, with absolutely no visible modifications to the target.
A way to render a semitransparent texture using the stencil buffer.

Stencil states and effects are initialized as follows:

StencilCreator = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Always,
    StencilPass = StencilOperation.Replace,
    ReferenceStencil = 1
};

StencilRenderer = new DepthStencilState
{
    StencilEnable = true,
    StencilFunction = CompareFunction.Equal,
    ReferenceStencil = 1,
    StencilPass = StencilOperation.Keep
};

var projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);
var halfPixel = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

AlphaEffect = new AlphaTestEffect(GraphicsDevice)
{
    DiffuseColor = Color.White.ToVector3(),
    AlphaFunction = CompareFunction.Greater,
    ReferenceAlpha = 0,
    World = Matrix.Identity,
    View = Matrix.Identity,
    Projection = halfPixel * projection
};

MaskingTexture = new Texture2D(GameEngine.GraphicsDevice, 1, 1);
MaskingTexture.SetData(new[] { new Color(0f, 0f, 0f, 0.3f) });

What am I doing wrong?

sentences:
My collision detection is not working when I rotate my mesh in three.js I am trying to move a ball mesh through a maze. The maze belongs to a parent object3d. My issue is that when I move the ball I can't detect collision right well because in the rotation, the axis relative to the ball are changing and for some reason I can't control the collisions with the wall. Here is my code:

//This function detects collisions
function collisionControl() {
  var colision = false;

  //Checking collisions with the ball
  var originPoint = bola.position.clone();

  //I get the position of the ball relative to the maze(=puzzle)
  var globalPositionPoint = originPoint.applyMatrix4(puzzle.matrix);

  for (var vertexIndex = 0; vertexIndex < bola.geometry.vertices.length; vertexIndex++) {
    var localVertex = bola.geometry.vertices[vertexIndex].clone();
    var globalVertex = localVertex.applyMatrix4(bola.matrix);
    var directionVector = globalVertex.sub(bola.position);

    var ray = new THREE.Raycaster(globalPositionPoint, directionVector.clone().normalize());
    var collisionResults = ray.intersectObjects(collidableMeshList);

    if (collisionResults.length > 0 && collisionResults[0].distance < directionVector.length()) {
      if (collisionResults[0].object.name == "fin") {
        location.reload();
      }

      // Si encontramos una colision, la bola vuelve a su lugar origen
      colision = true;
      break;
    }
  }

  return colision;
}

The function RotacionEje

// Function to rotate the ball
function RotacionEje(object, axis, radians) {
  var rotWorldMatrix = new THREE.Matrix4();
  rotWorldMatrix.makeRotationAxis(axis.normalize(), radians);
  rotWorldMatrix.multiply(object.matrix);
  object.matrix = rotWorldMatrix;
  object.rotation.setFromRotationMatrix(object.matrix);
}

So when I press the Up arrow for example it executes, the following function:

function moveUp() {
  bola.position.z -= 0.5;
  RotacionEje(bola, ejeX, -0.1);
  camera.translateY(0.5);
  if (collisionControl()) {
    bola.position.set(47.5, 0, 50);
    camera.position.x = 47.5;
    camera.position.y = 0;
    camera.position.z = 100;
    camera.lookAt(bola.position);
  }
}

I have to say that collisions works fine if I don't use the function RotacionEje.

What am I doing wrong?

sentences:
Calculating an experience formula I'm having trouble working out a formula using this experience curve to get the total exp after each level. I bet it's easy and I'm just overthinking it.

maxlvl = 10;
increment = 28;
baseexp = 100;
function calc(){
    for (i = 0;i<(maxlvl*increment);i+=increment){
        expperlvl = baseexp + i;
        document.writeln(expperlvl);
    }
}

sentences:
How can I debug _why_ glDrawArrays is very slow? I'm working on a game that uses CEGUI and Ogre.  Recently, we've discovered that some of our customers with GeForce4 MX 4000's, performance is terrible.

After a night spent debugging, I've tracked the issue down to a glDrawArrays call inside the Ogre GL Renderer.  Most executions of this call are pretty quick (<10ms, which still sucks but is ok for this terrible card).  But one execution of the GLRenderSystem::_render function takes 3500ms every single frame.

It's only drawing a 54-element TRIANGLE_LIST.  All the other calls to it are drawing similar-sized TRIANGLE_LISTs, so it's not the size of the array or its type that is the problem.

I've:

disabled fragment shaders (the GF4 MX doesn't support them)
disabled vertex shaders (it supports them, but CEGUI can only do all types of shaders or none of them)
attempted to disable a nearby call for multitexturing
massively simplified the UI that I'm drawing so that it is only a single CEGUI::Window

But I'm really just shooting in the dark.  I'm in a windows environment.  What's a good tool to figure out the OpenGL state at the time of a function call?  I'm guessing that there's a particularly piggish texture or a fragment shader somehow slipping through and getting rendered.

If there aren't any tools to do what I need, can anyone suggest ways that glDrawArrays could be made really slow on an old card?

Update:

I grabbed GLTrace and compared the calls that precede both a fast glDrawArrays and a slow one.  They're absolutely identical, they're even binding the same texture IDs.
One consistent difference however, is that the call that executes slowly is the first one in each OGRE/cegui render frame.  Perhaps there is some copying-over of texture data to the video card each frame (which would be ridiculous and clearly doesn't happen on other cards...).  Update: this isn't the case - no matter where in the queue I draw the offending object, it still takes forever.  See below.
There are 3 main objects being drawn: a full-window background (plain white, gets textured with a 128x128 texture), a smaller rectangular label, and text in that label.  The ratios between their draw speeds are approximately the same the ratios between their areas
If I force the slow object to be drawn several times instead of drawing the entire render queue, it is slow every time, which means it's not a one-time-loading issue.

Update for current theory: this is somehow a fill-rate issue.  Is there a way to configure a window so that the card has issues filling it?  Since I'm drawing in windowed mode, will that mess up a card sometimes?  My window doesn't have power-of-two dimensions (or dimensions similar to any standard resolution), could that be a chokepoint?

sentences:
Exponential EXP Curve | FIXED TIME -> MAX LEVEL I have yet another experience equation question, with a slight twist.

Problem Situation

Player gain experience from Level 1 - 80.

Time to level from Level 1 to 80 grows exponentially.

There is a constant of total hours X (540 hours in this case) to reach level 80.

What equation results in this?

From this, I should be able to balance an approximate Time To Kill Monster + downtime, varying from easy to hard monsters and experience they can give, resulting in same time to Max Level.

Or I could create quests that takes an approximate Time To Completion but rewards the same ratio of experience.

In my opinion this should be the optimum solution to create content that grant the same ratio of experience to time to level.

Thank you.

sentences:
XNA Camera Positioning All Wrong I've been working in 3DSMax for years now and decided to give XNA 4.0 a try.  I've got the majority of it working, however the camera is being a pain to me and I can't discern what's gone wrong.  I followed tutorials up to this point and am branching out into newer things.

Basically for this setup, I have a 'grid' in 3D space (all have a Y-component of 0) with spheres located here and there along the grid (spheres are FBX models from 3DS).  What I'm trying to do is write a quick move command that'll move the camera above and behind one of the objects and then look at it.  By using the keyboard, I can scroll through the list of objects and the camera should immediately jump to the specified position.  However, in practice, the camera ends up in strange places, doesn't look where it's supposed to, and I'm not even sure it's actually moving!

The location of the objects is stored within a class object as a Vector2 (hence the Y/Z swap below), as they are all on the same plane (no Y-axis used).  The following code, in theory, should return the position of the camera, and it's target, based on that class object's position in the world.  m_vPosition is a Vector2 that defines the location of the object.  That vector is defined at creation-time and is in the Translation Matrix for the object.

    public void GetCameraHoverLocation(out Vector3 p_vPos, out Vector3 p_vLook)
    {
        p_vPos = new Vector3(0, 0, 0);
        p_vLook = new Vector3(0, 0, 0);
        // Position should be above and behind
        p_vPos.X = m_vPosition.X;
        p_vPos.Y = 1;
        p_vPos.Z = m_vPosition.Y + 10;

        p_vLook.X = m_vPosition.X;
        p_vLook.Y = 0;
        p_vLook.Z = m_vPosition.Y;
    }

The code to move the camera into position is:

    public void SetCameraPosition(Vector3 p_vPos, Vector3 p_vLookAt)
    {
        m_mViewMatrix = Matrix.CreateLookAt(p_vPos, p_vLookAt, Vector3.Up);
        m_vCameraPos = p_vPos;
        m_vCameraView = p_vLookAt;
    }

The Position and LookAt are stored for later usage.  The ViewMatrix is then given to the shader and bob's your uncle.  However, again, the positioning of the camera is alllll wrong.  I'm thinking it might be a complete misunderstanding of the Matrix.CreateLookAt function, but it works as written if I don't bother moving it (up to this point that is).  Can anyone point me in the right direction on this one?  I'm used to the way 3DS does things with cameras (vector for location, vector for target), so that might be polluting my thought process.

sentences:
Switching between world and battle scene with no or minimum loading? I am making a strategy game where the player roams a grid map.
When the player encounter enemy on the map he is transferred to a "battle" scene where two armies are fighting in turn based battle.
Imagine Heroes 3 like game.
My question is:

Should I load the battle scene in additive mode and temporary hide the "world map" and when the battle is finished to just show the "world map" and hide the "battle" scene?

Or i should unload the world scene and load the battle scene, and when the battle is over -> unload the battle scene and load the world scene ?

I think the 1st approach will give me less loading time between the two scenes, but will require more RAM ?
Second approach is standard one, but i will have loading between the scenes ?
My idea is to have no or minimal loading between battle and world scenes.
What do you guys thing ? Did you know what is the best practice in this case ?
By the way, i am using Unity as a engine.

sentences:
Why will my server not execute a command sent by the client in Unity 5.1? I'm working on a very simple/basic client-server networking program, the basis of a future game I hope to create. Now the client program/project DOES successfully connect with the 'server program/project' (both completely separate). However when it comes to having the client send a request/command to the server. Well it doesn't send the command to the server, it executes it on the client.

I read about changing the 'Monodevelop' inheritance to 'NetworkBehaviour' so I did and it resulting in an error along the lines of;

Command xxx was sent to the server
...Debug.logerror(object
So I seemed to have got half way there, it allegedly sent the command to the server, but the server did nothing with it. I don't know why.

Below are the relatively short programs I've got for my server and client and are pretty much the same, but if anyone can help me out I'd greatly appreciate it, as my University course didn't really go into Network Programming all that much;

Server Code

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class server : MonoBehaviour
{

    public string IP = "127.0.0.1";
    public int port = 25001;
    public int prevConns = 0;
    private int currConns = 0;

    public virtual void OnServerReady (NetworkConnection conn)
    {
        NetworkServer.SetClientReady (conn);
    }

    void OnGUI ()
    {
        if (Network.peerType == NetworkPeerType.Disconnected) {
            if (GUI.Button (new Rect (100, 100, 100, 25), "Start Client")) {
                Network.Connect (IP, port);
            }
            if (GUI.Button (new Rect (100, 125, 100, 25), "Start Server")) {
                Network.InitializeServer (20, port, false);
            }
        } else {
            //CLIENT - NOT NEEDED
            if (Network.peerType == NetworkPeerType.Client) {
                GUI.Label (new Rect (100, 100, 100, 25), "Client");
                if (GUI.Button (new Rect (100, 125, 100, 25), "Disconnect")) {
                    Network.Disconnect (250);
                }
            }
            if (Network.peerType == NetworkPeerType.Server) {
                currConns = Network.connections.Length;
                GUI.Label (new Rect (100, 100, 100, 25), "Server");
                GUI.Label (new Rect (100, 125, 100, 25), "Connections: " + currConns);

                if (prevConns != currConns) {
                    if (prevConns < currConns) {
                        Debug.Log ("NEW CONNECTION");
                        prevConns++;

                    } else if (prevConns > currConns) {
                        Debug.Log ("Lost CONNECTION");
                        prevConns--;
                    }
                }

                if (GUI.Button (new Rect (100, 15, 100, 25), "Shutdown")) {
                    Network.Disconnect (250);
                }
            }
        }
    }

}

Client Code

using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class connection : MonoBehaviour
{

    public string IP = "127.0.0.1";
    public int port = 25001;
    public GameObject player;

    public virtual void OnClientConnect (NetworkConnection conn)
    {
        ClientScene.Ready (conn);
    }

    void OnGUI ()
    {
        if (Network.peerType == NetworkPeerType.Disconnected) {
            if (GUI.Button (new Rect (100, 100, 100, 25), "Start Client")) {
                Network.Connect (IP, port);
            }
        } else {
            if (Network.peerType == NetworkPeerType.Client) {
                GUI.Label (new Rect (100, 100, 100, 25), "Client");
                if (GUI.Button (new Rect (100, 125, 100, 25), "Disconnect")) {
                    Network.Disconnect (250);
                }

                if (GUI.Button (new Rect (100, 150, 100, 25), "Send Cmd")) {
                    CmdSendCommand ();
                }

            }
        }
    }

    [Command]
    void CmdSendCommand ()
    {
        NetworkBehaviour.print ("HELLO");
    }
}

sentences:
DOM for GUI - display animated objects I'm creating an HTML5 game using Canvas, but want to use DOM for the GUI for the reasons mentioned in there articles:

http://blog.sklambert.com/html5-game-tutorial-game-ui-canvas-vs-dom/
http://www.html5gamedevs.com/topic/29569-how-do-you-guys-build-your-ui/
http://www.html5gamedevs.com/topic/802-gui-methodologies/

That being said, we have a component on the GUI that needs to be animated which will be through a sprite. Is it possible to render sprite animations through a DOM element?

sentences:
What's the best control scheme for an arena shooter on a touchscreen phone? I am developing Android an game. It's going to be a top-down shooter with stealth features. I am now thinking about how to the make controls. Most top-down games are now twin stick (joystick on the left and right sides) but I need more buttons (for choosing weapons, commanding your squad, and using skills).

So here are my ideas:

Two (virtual) sticks like in other games, when you tap somewhere on the display, a circle with buttons appears, where you can choose abilities or weapons.
One stick on the left side for walking, shoot where the second finger is pressed, weapons and skills on the right side.

What do you think is the best? Or do you have any other idea? I want to choose the most intuitive and simplest.

sentences:
Allow code after a bugged line to continue without use of try and catch My problem is with C# in unity, but I think the problem can be applied to all coding languages.

For example I have a start function/event that may initiate many things. Some lines of code may issue a bug but I want to allow new lines of code run after that without having to encapsulate every line of code with try and catch. Is there any common solution for this that I'm missing?

sentences:
Most efficient way to implement walls and shadows in 2d I am making a 2d top-down programming game similar to robocode. There will be up to 1000 walls (lines) in the arena, and up to 50 robots. Each robot can see in a 90 degree arc, and cannot see through walls. I need an efficient way to calculate what each robot can see (other robots and walls). I already have a grid of bins implemented. I was wondering what is the most efficient way to tackle this problem.

It would be nice if the method also includes a way to draw the shadows for visualization, but this is not necessary.

I am using C++ and the Qt framework.

Summary: The main question is how to generate a list of robots and walls that each robot can see. For example:

Robot 1 can see:
    Robot 6
    Robot 15
    A wall from (50,60) to (70,80)

Robot 2 can see:
...

sentences:
XNA - Debugging/Testing Individual Sprites and Pixel Collision I ran through the first training on XNA where you make a shooter game. They did some thing that I would not do and I want to use their starting point to learn more things.

I want to try better collision and adding a menu. I saw something online with the sonic physics where they have a frame by frame of sonic moving 1 pixel. See picture below.

I am new to development, but I have been programming for years now. What would you guys suggest to try these different things out.

How would I simulate a similar frame by frame testing as they do in the above picture?

Thanks!

sentences:
How do I handle specific tile/object collisions? What do I do after the bounding box test against a tile to determine whether there is a real collision against the contents of that tile?  And if there is, how should I move the object in response to that collision?

I have a small object, and test for collisions against the tiles that each corner of it is on.

Here's my current code, which I run for each of those (up to) four tiles:

// get the bounding box of the object, in world space
objectBounds = object->bounds + object->position;
if ( (objectBounds.right >= tileBounds.left) &&
     (objectBounds.left <= tileBounds.right) &&
     (objectBounds.top >= tileBounds.bottom) &&
     (objectBounds.bottom <= tileBounds.top))
{
    // perform specific test to see if it's a left, top , bottom
    // or right collision. If so, I check to see the nature of it
    // and where I need to place the object to respond to that collision...
    // [THIS IS THE PART THAT NEEDS WORK]
    //
    if( lastkey==keydown[right] && ((objectBounds.right >= tileBounds.left) &&
                                   (objectBounds.right <= tileBounds.right) &&
                                   (objectBounds.bottom >= tileBounds.bottom) &&
                                   (objectBounds.bottom <= tileBounds.top)) )
    {
        object->position.x = tileBounds.left - objectBounds.width;
    }
    // etc.

sentences: How is a 3d perlin noise function used to generate terrain? I can wrap my head around using a 2d perlin noise function to generate the height value but I don't understand why a 3d perlin noise function would be used. In Notch's blog, http://notch.tumblr.com/post/3746989361/terrain-generation-part-1, he mentioned using a 3d perlin noise function for the terrain generation on Minecraft. Does anyone know how that would be done and why it would be useful? If you are passing x,y, and z values doesn't that imply you already have the height?

sentences:
Polygons and actionlisteners Libgdx I've been browsing these forums for a while now and I nearly always am able to find an answer without having to ask my own question! Such a great community!

This is the first time I've been stumped so I hope that someone can help me, I'm just learning libgdx so any help is appreciated I know the code is rough but please be gentle as I'm learning everyday!!! :)

I'm trying to create 6 shapes with inputlisteners which eventually will return the index of the shape which will correspond to an answer, but I can only seem to get the last input listener I create to actually fire...

    public Panel(final int count){
    this.count = count;

    img = new Texture("badlogic.jpg");

    handlerShapeVertices = new float[]{128,30,0,256,256,256};
    handlerShape = new Polygon(handlerShapeVertices);

    triangle = new PolygonRegion(new TextureRegion(img), handlerShapeVertices,new short[]{0, 1, 2});

    triangleSprite = new PolygonSprite(triangle);

    triangleSprite.setOrigin(img.getWidth()/2,30);
    triangleSprite.setX(x);
    triangleSprite.setY(y);
    triangleSprite.setRotation(count * 60);

    handlerShape.setOrigin(triangleSprite.getOriginX(), triangleSprite.getOriginY());
    handlerShape.setPosition(x, y);
    handlerShape.rotate(count * 60);

    setBounds(x,y, 256, 256);

    addListener(new InputListener(){
        public boolean touchDown (InputEvent event, float xP, float yP, int pointer, int button) {
            //float [] temp = handlerShape.getTransformedVertices();

            if(resourceManager.getInstance().interSector.isPointInPolygon(handlerShape.getVertices(),0,6,xP,yP)) {
                System.out.println("CLICK INSIDE : " + count);
            }
            return true;
        }
    });

}

I figured the polygon.getTransformedVertices() should work and to check they were correct I drew them in as you can see by the white lines surrounding the polygonsprites however it doesn't seem to and none of the listeners are actually fired when I use that... I'm completely stumped and hope someone has some insight or can point me in the right direction? I don't want someone to write my code for me but a pointer would be greatly appreciated!

sentences:
UI: Main Menu options for mobile games. What options should be listed? What do users want to see? When a user arrives at your main menu on your mobile touch phone game. What do you want them to see? What do they need to see?

Start, About, Load, Leaderboards, and Settings are just a few of the options that I "could" put on the Main Menu. The question really is what "should" be there and why?

My game is about surviving waves of enemies to get to the next level, with a twist of course.

What options could/should be shown on my Main Menu and why?

EDIT UPDATE:

Easy recognizable PLAY button.
Possible buttons include, but are not limited to Options, Stats/Achievements, Leaderboards, Level Solutions, and Promote Game.
Choose appropriate options for your type of game. (ie. Level Solutions good for puzzle games but not FPS)
Less is more, don't clutter the Main Menu to prevent users from getting confused. Weigh the benefits of an additional button against the risks of confusing users.
Symbols can be used to convey the meaning of a button, be sure to reach the largest audience possible.
Have as few clicks as possible to get into the game.

sentences:
OpenGL ES - read content of VBO Is it possible to read back content of VBO in OpenGL ES 2.0 ?
I have tried glMapBufferOES, but there is no READ flag.

I dont want any answers, like "you shouldnt do it" or "keep copy of geometry in ram".

sentences:
How to get the Exact Collision Point and ignore the collision (from 2 "ghost bodies") I have a very basic problem with Box2D.

For a arenatype game where you can throw scriptable "missiles" at other players I decided to use Box2D for the collision detection between the players and the missiles. Players and missiles have their own circular shape with a specific size (varying). But I don´t want to use dynamic bodies because the missiles need to move themselve in any way they want to (defined in the script) and shouldnt be resolved unless the script wants it.
The behavior I look for is as following (for each time step):

velocity of missiles is set by the specific missile script
each missile is moved according to that velocity
if a collision accurs now, I want to get the exact position of impact, and now I need a mechanism to decide if the missile should just ignore the collision (for example collision between two fireballs which shouldnt interact) or take it (so they are resolved and dont overlap anymore)

So is there a way in Box2D to create Ghost bodies and listen to collisions from them, then deciding if they should ignore the collision or should take them and resolve their position? I hope I was clear enough and would be happy about any help!

sentences:
What is the best way to manage 'state' in Phaser? I have heard that this is not the best way to manage state in phaser

var game = new Phaser.Game(800, 600, Phaser.CANVAS,'YourGameName');
game.state.add("Boot", Boot);
game.state.add("Preload", Preload);
game.state.add("MainMenu", mainMenu);
game.state.add("Play", Play);
game.state.add("GameOver", GameOver);
game.state.start("Boot");

so what is the best way to do it. I am newbie in Phaser game development.

sentences:
Unity2D - Horizontal Scaling to Support Various Aspect Ratios? I am trying to work out how to support various resolutions for my Android game. I have come up with a solution, but do not know how to implement it.

Automatically, I am told that Unity vertically scales the screen to match the screen, leaving more room at the sides. How can I change this behaviour? I am hoping to shrunk the game down till it fits horizontally, and filling it the background above and below with more decorative features. How can I achieve this?

I'm sorry if there is an obvious answer, I'm quite new working with the Unity UI system.

If it makes it any easier, my game is heavily based on UI, and is locked in landscape.

BIG EDIT: I completely rephrased this question because it was so broad and messy.

sentences:
Anyone know of other unique playable archetypes? Well I like to play games that give me a wide breath of options. For most part I see games implementing certain archetypes like the usual RPG trinity (tank, DPS and healer).

So far the most archetypes I've seen are in fighting, card and strategy games.

Fighting games archetypes I've seen are:

Rush down (GG Accent Core Venom, Kof 2k1 heidern)
Grappler (SF Zangief)
Zoning (SF Dhalsim, KoF Billy Kane)
Ranged(GG Dizzy)
Trapper (GG testament)
Well rounded (SF Ryu)
Status effects (GG Baiken)
Chance (GG Faust)
Counter (GG Baiken)
Time (Arcana Heart Anutpada, Psychic force Wong, Jojo's Bizarre adventure Dio)
Positions control (Arcana Heart Dieu Mort).

Card Games: Burn, milling, OTK, counter, graveyard based, trapping (Yu-gi-oh), remove from play, restrict.

Strategy games: League of legends have a number of them so I'll just link to their wiki. Note not all are archetypes though, add to that builders as well.

So any other that you guys might know that is worth mentioning?

sentences:
How should I design game object dependencies between windowing, input and behavior systems? This is my first time attempting to create a game engine. I came across a theoretical problem and would like to solve it before implementation. Right now I have a WindowSystem, which opens the window, sets the GL_CONTEXT, etc. I would like it to be responsible for all things window. Then I have another system that manages input called InputSystem. Then I have a BehaviorSystem for game object behavior.

The problem:
Consider a game object representing a menu where it has options to change the resolution/other graphics settings. How can I link these three systems with minimal coupling so that a Behavior script can close the window? Normally systems interact through components, but there's no component for the window. From what I've read systems shouldn't know about each other. I haven't a clue how I could go about such a scenario.

sentences:
What's the difference between XNA Game Services and glorified global variables? The Microsoft.Xna.Framework.Game class has a Services property that allows the programmer to add a service to their game by providing the type of the class and an instance of the class to the Add method.

Now, instead of having to pass an AudioComponent to all classes and methods that require it, instead you just pass your Game instance and look up the service. (Service Locator)

Now, because games have many services (GraphicsDevice, SceneGraph, AudioComponent, EffectsManager, et cetera), you will now basically be passing Game to everything.

So why not just make these instances a Singleton? Well, because Singletons are bad because they have a global state, prevent testing, and make your design much more brittle. Service locators are equally considered to be an anti-pattern to many because instead of just passing the dependency to an object, you pass a service locator (the Game) which couples that class with the rest of the services.

So then why are Services recommended in XNA and game development? Is it because games are different from regular programs and are highly intertwined with their components and having to pass every component necessary for the functioning of a class would be highly cumbersome? Are Game Services just then a necessary evil in game design? Are there alternatives that don't involve lengthy parameter lists and coupling?

sentences:
How do I set the exact local position of a RectTransform? I have a game object that creates a keyboard in side of my world canvas. I am working out the offset positions for each key, and appear to be doing that correctly. However, when I set the positions in the actual keys, the values are being offset by anything from 100 - 1000.

This is the basic method I am currently using to set the position:

public void SetDimensions(Vector2 position)
{
    GetComponent<RectTransform>().localPosition = position;
    Debug.Log(key + ": " + position);
}

I have also tried using .position and .anchoredPosition, as per the somewhat confusing API reference. I have also tried simply referencing transform.localPosition and transform.position. No matter what, the output is exactly the same. The debug output confirms that I am working out the correct local position, but no matter what I do, that is not the value being set to my transform.

As you can see, I have my pivot set to the center; though I think this may have an impact, it certainly should not cause an offset of 400-500.

As per request, this is my main canvas:

What am I doing wrong, or more specifically, how do I set the exact local position of a game object using a RectTransform?

sentences:
How to handle keyboard in worker thread in XNA I am using multithreading in my XNA application and run my update logic s in a update thread(witch is a worker thread) and rendring is being done by main thread, now the problem is updation is required there on keyboard event, and key Board handling can be done only in main thread.

Note that my application was single threaded and I have implemented threading, synchronization is being done by 'data partitioning', both the threads are working correctly, except my keyboard is not working..

if any one have any suggestion or example, please allow me to know.

thanx in advance.

sentences:
How to implement a job queue system? Essentially I'm trying to make a system which you can add a job to it then finds an AI which is idle and gives it that job to do, For an example look at Prison Architects job list system (image below).

I need to be able to add a job, removed them and look at all the jobs. The next job that this returns should be the oldest one in the list.

Initially I thought of using a queue as it already provides adding and removing but as it turns out I can only see the next item in that list (well at least thats the case with the standard C# implementation of it), meaning that if there is a certain requirement which isn't met I can't skip to the next task.

Is there a version of the queue that exposes all the items within the list or some other way of doing something similar? This will be coded in C# if that makes difference to the options available.

sentences:
Can I make a multiplayer Android Game using Android Studio? I want to create a multiplayer android game, where the clients connect together via a web server.

My question is: Is it possible to make this kind of games using Android Studio with other libraries like LibGDX and Java sockets?

sentences:
save generated gameobject to an array for shuffling hey everyone i have this script here that breaks down a sprite into pieces and makes each one a gameobject.im having touble saving them into an array so i can shuffle them as gameobjects.
 public void Start()
    {

        GameObject spritesRoot = GameObject.Find("SpritesRoot");
        Debug.Log("Array length: " + array2D.GetLength(0));

        for (int i = 0; i < array2D.GetLength(0); i++)
        {
            Debug.Log("x: " + array2D[i, 0]);
            Sprite newSprite = Sprite.Create(source, new Rect(array2D[i, 0], array2D[i, 1], array2D[i, 2], array2D[i, 3]), new Vector2(0.5f, 0.5f));
            GameObject n = new GameObject();
            SpriteRenderer sr = n.AddComponent<SpriteRenderer>();
            sr.sprite = newSprite;
            n.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(array2D[i, 0], array2D[i, 1],0),0);
            n.transform.parent = spritesRoot.transform;
        }

    }

my shuffle function is this
 public void Shuffle(GameObject[] gameObjects)
    {
        for (int i = 0; i < gameObjects.Length; i++)
        {

            // Find a random index
            int destIndex = Random.Range(0, gameObjects.Length);
            GameObject source = gameObjects[i];
            GameObject dest = gameObjects[destIndex];

            // If is not identical
            if (source != dest)
            {

                // Swap the position
                source.transform.position = dest.transform.position;

                // Swap the array item
                gameObjects[i] = gameObjects[destIndex];
            }
        }
    }
```

sentences:
How to pass values in UE2Runtime to UnrealScript? We have a game that launches via vbscript and calls UE2Runtime:

set demofile = filesys.GetFile("..neuro2\Inifiles\"&usrFoldername&"\LostWorld.ini")
'WShell.Run "..\System\UE2Runtime.exe LW1_basic.urt?Class=neuro2.Exp2Subject -log=" & usrName & "_training.log"

How do you grab the value in usrName that is passed to UE2Runtime to a console command in UnrealScript 2 when certain events are triggered in the game?

Many thanks in advance

sentences:
How do I make volumetric grass? I've been extremely interested in volumetric technology, especially for grass.

Online resources are extremely scarce on this topic.

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

sentences:
Unity Assets folder is empty after opening package from the asset store I downloaded the following Survival Shooter Tutorial from the Asset Store :
https://www.assetstore.unity3d.com/en/#!/content/40756
I was prompted to open it in Unity so I did and began following this tutorial :
https://www.youtube.com/watch?v=_lP6epjupJs
I am only 2 minutes into the first video and am stuck. In the tutorial there are lots of folders in the assets folder. I took a screenshot of what my screen looks like to show that it is empty.

sentences:
How can I create my mesh so that textures applied to it are NOT rotated 90 degrees in Unity 3D? I'm trying a really simple test in Unity 3D. I want to render a texture on the simplest plane possible.

So, I've created a two-triangle plane in Blender, then imported it into Unity. From there, I put that mesh on a GameObject, and then drop a texture on top of that. Every time I do this, the texture is rotated 90 degrees when drawn on the plane.

By contrast, if I just create a plane in Unity and drop the texture on that, it is not rotated.

Here is a screenshot showing the simple plane in front of the stock Unity plane:

http://cl.ly/0X052y1G0L1G0a181M1d

I noticed that the triangles in the stock Unity plane's mesh are oriented differently than the ones in the mesh I created (the hypotenuses go from bottom-left to top-right instead of bottom-right to top-left). I went into Blender, rotated the plane 90 degrees, then reimported it unto Unity, but it doesn't seem to make a difference.

What am I missing here?

sentences:
Unity2D - How to destroy my Instantiate particle system I'm having trouble trying to destroy my Instantiated particle system, I can only destroy my gameobject

using UnityEngine;
using System.Collections;

public class meteor_destruction : MonoBehaviour {

public GameObject meteor_d_effect;
public GameObject meteor_explo_effect;
public GameObject meteor_explo2_effect;

public int pointsIncrement = 1;

void OnCollisionEnter2D (Collision2D col)
{

    var effect_explo = Instantiate(meteor_explo_effect, col.gameObject.transform.position, col.transform.rotation);
    var effect_explo2 = Instantiate(meteor_explo2_effect, col.gameObject.transform.position, col.transform.rotation);
    var effect_d = Instantiate(meteor_d_effect, col.gameObject.transform.position, col.transform.rotation);
    Destroy (gameObject);
    Destroy (effect_explo,3);
    Destroy (effect_explo2,3);
    Destroy (effect_d,3);

}

It's generated after the meteor collide, but those 3 particle effects keeps adding inside my Hierarchy panel.

sentences:
Light Attenuation Formula Derivation I understand that when sampling the brightness of a given point on the surface, a certain cutoff needs to be taken into consideration.

Other words, when the light is further away, the intensity decreases.

I came across the following formula that is used to compute the aforementioned:

attenuation = 1.0 / (1.0 + a * dist + b * dist * dist)

However, I have not been able to find out why and how this formula is derived.

From the formula what I can understand is that as the distance get larger, the result will become smaller; but how it is derived is beyond me.

If distance takes an important role in the above formula, which helps determine the intensity, could we simply ignore a and b from the formula and simply use:

attenuation = 1.0 / (1.0 + dist)

?

Does anyone know how the formula is derived and the importance the values a and b play within the formula?

Thanks.

sentences:
How can I implement view wobble when my player is running? I'm creating a FPS in XNA.  So far its' going great.  What I'm looking at doing is replicating the camera movements that you see in Modern Warfare.  So, if you are walking the camera stays pretty still except for the slight weapon movement, but if you sprint then it shakes left and right.  Here is a good example :  Modern Warfare 2 camera motion

Has anyone achieved this?  If so, can anyone give any pointers or articles that I can take a look at?

sentences:
How do I use Unity's OnPlayerConnected method? https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnPlayerConnected.html

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

public class SendData : MonoBehaviour {

    void OnPlayerConnected (NetworkPlayer player) {
        Debug.Log ("A player connected!");
    }

}

This code, surprisingly, doesn't work!

Expected: The server prints "A player connected!" in the Unity editor debug console.

What happens: Nothing is printed. It doesn't matter if I use print() or Debug.Log().

This script is applied to a standard object in the scene. It has a NetworkIdentity.

I really don't know what else to try. The Unity documentation is very short and gives an example very similar to this. My code should be even simpler than Unity's example but it doesn't work.

sentences:
How much is java used in 2d/3d indie games? (before/after Minecraft) I wonder for my own use and curiosity, how popular is Java in indie game development ,
in 2d and 3d? Are there any good open/closed source games done in java?

sentences:
What are the pros and cons of these voxel data file formats? .VXL
.VOX
.KVX
.KV6
.V3A
.V3B

I am trying to decide whether it's worth going with any of the above, or some other, or if I should roll my own. The deciding factors in order of importance are:

Animation support (I am aware this is a difficult aspect when it comes to voxels), using voxel deltas or numerical transform descriptions.
Simplicity (or at least a concise format)
Compression

From what I can tell, the Tiberian Sun VXL format is the only one which is designed for animation, but Ken Silverman of Voxelstein3D fame claimed that VXL does not support animation (in a single file, were his words). So I wonder if maybe there are not two different .VXL formats, since it seems an obvious choice of file extension for voxel data... could be from a medical imaging context.

I do need someone with solid experience of voxel formats to come and comment on the practical pros and cons, in their experience. Consider this question in the same way you might compare JPG to PNG to GIF.

sentences:
Regarding sprite design and resolution for tablets and phones I am about to start working on a game for android devices, in my spare time, to get familiar with android development. I'm more interested in using the best practices possible than getting a quick result, and that is why I need some guidance regarding graphics.

I think the game is going to be fully sprite based. Everything is going to be in .bmp form, or something similar, and my question is:

Should I design the sprites in a small resolution (ie for phone screens) and scale them up to fit into larger screens (tablet screens), should I do it vice-versa or should I consider a completely different approach? Would designing a different set of sprites for each of the most used resolution settings be worth it or are there simpler solutions to the problem with fewer drawbacks than the ones I mentioned above? (If I follow the first approach, for example, the larger the screen the worse the graphics will get, since every pixel of the original drawing will cover several pixels on the screen). Is there a standard approach for dealing with this kind of problems?

If you need me to be more detailed or more clear about something I mentioned (or forgot to) please don't hesitate to ask. Also, excuse me for any inaccurate use of the English language.

Thank you in advance for your input.

sentences:
How do I handle or manage commands which are sent by server in unity? In my game there are 10 objects which are just started running on play as this is a web player game and betting as well and it requires some socket programming.

At run time the commands are sent by server and client machine accepts these commands as well but I don't have any idea that how can I manage these commands and how do I executes that commands as per the requirements?

If anyone knows please try to help me out..!
Thanks

sentences:
Why can't I rotate anything to be "more than 360 degrees or less than 0 degrees"? I've been trying to make an animation in Unity, but most assets already come bundled with everything facing at 0 degrees, not to say it's a bad thing.
However, the problem I'm facing is that the animation keyframes aren't playing out correctly.
When this is done with raw measurements (simply dragging the XYZ rotations), negative and greater than 360 degree angles are taken account. But then again - Unity could be simply remapping them, whcih is not the case.
For example, the prop_robotArm prefab, found within Unity's Robot Factory asset pack has a rotator script that simply rotates the whole thing along the Y axis.

void OnFixedUpdate()
{
    transform.Rotate (new Vector3(0, rotateSpeed*Time.deltaTime,0));
}

Meaning that after slightly more than a full revolution, the Y rotation value should be more than 360 degrees, which it does end up becoming... Eventually.

Thinking that was possible, I tried to mimic this behavior by making the arm rotate 720 degrees (twice) in an animation file (this is not using the rotator.cs script attached to the body in the example above).
Instead, all I ended up was the arm's body staying still as 720 is the same as... 0 degrees in rotation changes.
So, I tried a second experiment; trying to rotate from 359 degrees to 1 degree (or -1 to 1 degree).
Just like above, it didn't go to plan. When the animation is run, it simply runs from 359, through every angle in-between before reaching 1, instead of 359, 360 (0) and 361 (1).
If you don't get what I mean, see the diagram below.

So, I was wondering, is there a way to allow for such rotation to be defined in an animation curve?
Every time I try doing it, any value greater than 360 (or lesser than 0) is replaced by its co-terminal counterpart that's between 0 and 359.999999...999.

sentences:
Sticking to a moving platform My character is not sticking on the platform when jumping on it, but I don't know why. I checked, and I have rigidbodys and colliders. The problem appeared when I moved the game to another hard drive.

Here is mycode:

void OnCollisionEnter2D(Collision2D other)
{
    if (other.transform.tag == "MovingPlatform")
    {
        transform.parent = other.transform;
    }
}

void OnCollisionExit2D(Collision2D other)
{
    if (other.transform.tag == "MovingPlatform")
    {
        transform.parent = null;
    }
}

Why doesn't my character stick to the platform?

sentences:
Testing Unity 2D Physics I am looking to push the 2D physics in Unity to the extent where when so much is going on that there becomes noticeable lag in a game. This is for testing purposes, so that when so much is going on that a button can be pressed to reduce the amount of physics objects on screen then see what affect that has. So in my small 2D demo I have placed alot of barrels on the map, all of which have physics on them, player bumps into them and they move. I have went to the extent of placing alot of them on the map (864 to be exact), bumping into them I still don't see any effect on the gameplay. Other things I have tried, besides adding alot in, is increasing the mass of the barrels, changing their linear and angluar drag and making them bouncy.

Is there anything I can do besides adding alot more in?
Thanks!

sentences: GL_GENERATE_MIPMAP vs. GL_MAX_TEXTURE_SIZE If we generate mipmaps for a texture using GL_GENERATE_MIPMAP (or glGenerateMipmap), how big can the original texture be? Is it the size returned by GL_MAX_TEXTURE_SIZE, or half of it?

sentences:
Where to place cards drawn from a deck of cards to a tableau I've never written card games before and am currently coding up a simple card game, I have a deck of cards and they need to be shuffled (done) and then draw from the top deck into a tableau (centre of table) from which the user(s) can pick from.

The only issue is I'm not sure how I can figure out where the cards drawn from the top deck go to.

Let's say the draw deck is drawn at 100,100.

Let's say the tableau starts at 200,200 and can have 6 cards in them.

How do I know where the cards are going to appear on screen within the tableau?

My current thoughts are that we fill the tableau "empty" card objects at set X/Y co-ordinates so that I know without having to do too much programming where the cards should go to.

But I'm not sure if this is the best way to do it because of screen sizes, etc.

ie: Tableau. A card width is 50, and the distance between them is 20

> Card slot #1 = 200,200 (State: Empty)
> Card slot #2 = 270,200 (State: Empty)
> Card slot #3 = 340,200 (State: Empty)

So the first card drawn would animate from 100,100 to 200,200 and change it's state to Filled
The second to 270,200, changing its state
The third to 340,200, changing its state
And so on..

But I'm still unsure if using hard number co-ordinates is really the best way forward, especially if the screen sizes change; or even if there's a better way to animate cards from a draw pile to a tableau.

My question therefore is -- how do I make the computer know where to put cards drawn from a deck of cards to a tableau?

Many thanks

sentences:
Procedural star field generator Is anyone aware of any code to procedurally generate star fields?

Ideally I'd like it to be physics-based so I can have realistic planets and moons.
Best would be in C++, open source, and workable with Ogre3d.

I'm not afraid of coding something from a university paper if there's nothing available.

sentences:
Collision with User Input and Object I am curious on how to handle collision detection involving a moving target and user input. Basing myself in the mobile space, I get events from a set framework, but I do wonder about the amount of lag involved.

Say the object moves faster and faster, then position of the input and the object is very important. What I want to know is what is the best design for handling user input and then also the best way to make sure to accurately work out when the input point collides with the object, keeping threads in mind?

sentences:
"Super meatboy"-ish replay I'm making a platformer built from mini-levels - and I want to create a sort of a replay of all the player tries that the player did for the level.

My question is - what is the best way to record the player's actions in-game, so that I could replay them later when he finishes the level.

I thought about recording only the player's input and replay them later on, each on a clone of the player.
The problem I have with this is with dynamic obstacles (that could be moved around) - if one clone moves them, it throws the simulation off for the rest of the clones.

So then I thought about recording every frame the X/Y of the player, and then just replay it - but that seems it could cause a major memory leak and very ineffective.

So - does anyone have any ideas? :)

EDIT:
As per the request in the comment, link showing said mechanic

sentences:
How do you upgrade your Unity license from Plus to Pro? If I buy a Plus license for Unity for only one month, can I upgrade that license from Plus to Pro in the next month? Or I am in am annual commitment to renew only the Plus license?

If I need to upgrade from Plus license to Pro license a month after publication, what do I do?

sentences:
Making an 'anim in circular motion' get attracted by gravity of the center I am working on a project, where the main player anim is in circular motion with respect to a center point. This video shows what I have done to the anim till now.

In that video, there are multiple apples are in circular motion. However, in my case, there is only one anim which is in circular motion. I have tried the following code for the circular motion.

public Transform center;
public float degreesPerSecond = -65.0f;

private Vector3 v;

void Start() {
    v = transform.position - center.position;
}

void Update () {
    v = Quaternion.AngleAxis (degreesPerSecond * Time.deltaTime, Vector3.forward) * v;
    transform.position = center.position + v;
}

The above code works perfect for the circular motion.

At the center (0, 0), I placed a circle sprite with 'point effector 2d' component. (see below image).

The reason why I 'added point effector 2d ' is to apply gravity effect to the player. But that didn't work. The player anim which is in circular motion around the circle sprite should get affected by gravity of that circle sprite and it should be pulled towards the center.

Changing the 'Point effector 2d' parameters is good enough to create gravity? or do I require any change in code?

sentences: Simple bare-bones path-finding routine I have a 2D grid with a number of cells. I need to find a path from one cell to another. There are no obstacles or opponents, and all cells are identical. What is a SUPER SIMPLE routine to calculate the shortest path? I have read about A* and other routines, but they are waaaaaaaay overkill in my case at this point. (Maybe I will need them later, in the future.) Thanks!

sentences:
Better way to handle ordering and visibility of renderable objects? I'm just wondering whether there is a more effective way to handle the ordering and visibility of renderable components that fits into the design of my already existing engine.

How I do it now:

In each update in my SceneHandler, do this:
Retrieve all renderable components that currently are in the current scene
Send these components to the RenderManager
Call RenderManager.Update
In each update in RenderManager, do this:
Iterate over the given list and perform an occlusion test
If the object is visible, put it in a new list of visible items
Sort the list of visible items in the order of their layer depth
When RenderManager.Draw() is called the RenderManager iterates over the list of visible items and draws them

Is there any way that is obviously better than this or is this how you usually do? Maybe I could keep a sorted list of all the current scene objects and then just perform occlusion testing and thus not having the need to sort each update?

Pros and cons of the suggested method are greatly appreciated.

sentences:
Second pass in multipass effect is ignored I am trying to render my vertecies in 2 passes, but it seems I am doing something wrong, because only one pass applying. I cannot make the second one work despite that second pass is applying.

Here is my code:

var effectByteCode =            ShaderBytecode.CompileFromFile(@"Content\Effects\SpriteBatchEffect.fx", "fx_5_0");
spriteBatchEffect = new Effect(this.graphicsDevice, effectByteCode);
pass = spriteBatchEffect.GetTechniqueByName("SpriteBatch").GetPassByIndex(0);
//Layout from VertexShader input signature
var passSignature = pass.Description.Signature;
layout = new InputLayout(graphicsDevice, passSignature, inputElements);

Effect code:

    Texture2D Texture;
    SamplerState TextureSampler;

matrix OrthoMatrix;

struct VertexInputType
{
   float4 position : SV_POSITION;
   float4 color: COLOR;
   float2 tex : TEXCOORD0;
};

struct PixelInputType
{
   float4 position : SV_POSITION;
   float4 color: COLOR;
   float2 tex : TEXCOORD0;
};

PixelInputType SpriteVertexShader(VertexInputType input)
{
   PixelInputType output;
   output.color = float4(0, 0, 0, 0);
   output.position = float4(0, 0, 0, 0);

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

   output.position = mul(input.position, OrthoMatrix);

   // Store the texture coordinates for the pixel shader.
   output.tex = input.tex;
   output.color = input.color;
   return output;
}

float4 SpritePixelShader(PixelInputType input) : SV_TARGET
{
   return Texture.Sample(TextureSampler, input.tex)* input.color;

}

float4 SpritePixelShader2(PixelInputType input) : SV_TARGET
{
   /*return Texture.Sample(TextureSampler, input.tex)+ input.color;*/
   return float4(1,0,0,0);
}

technique10 SpriteBatch
{
   pass P0
   {
      SetGeometryShader(0);
      SetVertexShader(CompileShader(vs_4_0, SpriteVertexShader()));
      SetPixelShader(CompileShader(ps_4_0, SpritePixelShader()));
   }

   pass P1
   {
      SetGeometryShader(0);
      SetVertexShader(CompileShader(vs_4_0, SpriteVertexShader()));
      SetPixelShader(CompileShader(ps_4_0, SpritePixelShader2()));
   }
}

And how I am using it:

graphicsDevice.SetVertexBuffers(0, vertexBufferBinding);

     var technique = tempEffect.GetTechniqueByName("SpriteBatch");
     for (int i = 0; i < technique.Description.PassCount; i++)
     {
        var localpass = technique.GetPassByIndex(i);
        //if (localpass.IsValid)
        {
           localpass.Apply(graphicsDevice);
           graphicsDevice.DrawIndexed(indexCount, 0, 0);
        }
     }

Could someone point me why second pass is not apply? What I am missing here?
Note that I am not using SharpdDX toolkit - just plain SharpDX + C#

sentences:
WebGL game won't go into fullscreen mode on iOS devices I have built my game and hosted it on itch.io. it works well on PC browsers and on the mobile Android browser.
The problem appears when I try to launch it on an iOS phone: the game won't go into full screen (it's supposed to go into it automatically). I added a button that's supposed to switch to full screen but it doesn't respond (the button does work on PC and Android though).

sentences:
Using model tools as map editor I want to make a game which would require a 3D map editor. Of course, I would like to avoid creating such an editor. My idea is now to use modeling tools (3DS Max, Maya, Blender) to create the map, and to give game specific objects specified names. This way I'd just need to write an COLLADA -> native map format converter. But I'm not sure if this is possible the way I imagine it, that's why I'd like to hear your thoughts on the matter.

Are modeling tools suitable to create big open world maps?
Can this "naming convention"-idea for game specific objects work?
Are the modeling tools able to export a scene in chunks / in a way that occlusion culling and collision detection can be properly done? If not: Is there a way to build a suitable data structure from the exported data?

sentences:
Need the co-ordinates of innerPolygon Let say I have this diagram,

Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon co-ordinates?
Edit:
I was able to solved the issue by getting the mid-points of all lines. From these mid-points I can move d distance, So I can get three points. No I have 3 points and 3 slopes. From this, I can get three new equations. Simultaneously, solving the equation get the 3 points.

sentences:
why collision not detection not happened in Two Sphere I start practice 3d collision detection of sphere in OpenGl containing two sphere one sphere hit using cannon gun but collision not detect when it hit and when i debug code collision statement triger when sphere is too far of each other here is sphere One code

    glPushMatrix();
    glTranslatef(400, 50, -400);
    drawBomb();
    glPopMatrix();

Connon gun code is here which control by keyboard handler

glPushMatrix();
    glTranslatef(600, 0, -400);
    glRotatef(-longFire, 1, 0, 0);
    glRotatef(-longFireChaw, 0, 1, 0);

    //glTranslatef(0, 0, -25);
    drawFireHolder();
    //printf_s("Long fire is %d", longFire);

    glPopMatrix();

second sphere code is here which hit by mouse handler

glPushMatrix();
 // bombX is global variable of value 600
 // bombY and bombZ is global variable of value 0
    glTranslatef(bombX, bombY, -400);
    //glRotatef(-longFire, xRotate, yRotate, zRotate);
    glRotatef(-longFire, 1, 0, 0);
    glRotatef(-longFireChaw, 0, 1, 0);
    //glRotatef(longFire, 0, 1, 0);
    glTranslatef(0, 0, bombZ);
    glTranslatef(0, 0, 25);
    drawBomb();
    glPopMatrix();

Timer and Shphere collsion detection code s here

dx = 400 - bombX;  // 400 for sphere one x and bombX for sphere two
        dy = 50-bombY;  //50 for sphere one y and bombY for sphere two
        dz = -400 -(-400);// 50 for sphere one z and bombz for sphere two

        float distance = sqrt(dx*dx + dy*dy + dz*dz);

        if (distance <=6+6) // 6 is radius of first and second sphere
        {
            printf("Collision Occur");
        }

        bombX-=1;

        bombY =0.3+bombY*sin((longFire*3.1424543567) / 180);
        bombZ++;
        //printf("Y IS %f",bombY);

Keyboard Handler  code is here

if (key == 't' || key == 'T')
    {
        xRotate = 1, yRotate = 0, zRotate = 0;
        longFire += 5;
        handlerMove();
    }
    if (key == 'e' || key == 'E')
    {
        xRotate = 1, yRotate = 0, zRotate = 0;
        longFire -= 5;
        handlerMove();
    }
    if (key == 'r' || key == 'R')
    {
        xRotate = 0, yRotate = 1, zRotate = 0;
        longFireChaw += 5;
        handlerMove();
    }
    if (key == 'w' || key == 'W')
    {
        xRotate = 0, yRotate = 1, zRotate = 0;
        longFireChaw -= 5;
        handlerMove();
    }

sentences:
Tilesets with two dimensions I have done tiled maps and tile sets quite often, but in a rather simplified way. My tile sets were linear images of the size (tile_width * num_tiles) * tile_height, so I could find an index easily by using val src_pos = (index * tile_width, 0).

But in reality, I've come to notice, tile sets are actually fully sized images of two dimensions. That has some advantages, clearly, it's easier to draw. So I wanted to support that. The problem would be just to turn the index to the right source position. Failed a bit, so I wanted to ask here.

I've had two ideas dealing with it:

Turn the index into two values with

src_x = index modulo num_tiles_x
src_y = index div num_tiles_y

which lead me to some quite weird results. The tiles are correctly cut, but they're the wrong ones for the position.

The other idea is to take the image and turn it into a 1D-tile set by cutting it up. But I am afraid that would not be an option, as I am using Textures.

How is this solved in 'professional' applications?

sentences:
What is the state of the art at shipping game graphics such as lots of small BMP files? We have lots of small BMP files which I think would be easier to copy if we had them combined in a big TAR/ZIP/whatever.

What is the state of the art at shipping game graphics?

We are using C# and are aware of zlib. Just brainstorming to see if there are any other solutions better than zlib.

sentences:
How do I make the player invulnerable using Fabric modding? I am making a Minecraft mod using the fabric mod loader and I want to make the player invulnerable for a duration when they eat a certain food item.
I don't know how to manipulate anything concerning entities or players so I am asking for some guidance.

sentences:
Collision Resolution: How to avoid Interpenetration/Tunneling Caused by Prior Collision Handling? My game processes world collisions followed by entity collisions. The problem here is that entities can break through walls the next frame when world checks are run again as a result of the prior collision resolution.  For example:

Entity1 is up against a wall and pushing against it
Entity2 runs into Entity1, collision detection resolves Entity1 inside the wall.
World collisions push Entity1 onto the other side of the wall.

What happens is that Entity2 pushes Entity1 into the wall far enough that when the world collision detection attempts to find the shortest distance out of the wall, that position happens to be on the other side.

sentences:
How can I implement temporary effects in Objective-C? How could I use this IBAction

-(IBAction)shield:(id)sender{
    appDelegate.healthInt = 150;
}

and simply make it work for a limited time. I want to set appDelegate.healthint = 150 for about 20 seconds. I'd assume this works with some sort of NSTimer. Not really sure. I'm not using any frameworks.

sentences:
Where do assets for Minecraft mods go? I found this link:
Where do I store (or how do I refer to) textures for custom blocks?

Unfortunately, the answer did not explain where that assets folder actually is. As such, I can't figure out where the textures themselves go.

I'm trying to replicate the tutorial on minecraftforge.net, so the mod's ID is "generic". For some reason, though, the assets folders all contain folders called "genericmod".

Basically: Can someone give me the exact path I should go to, starting from forge_1710_src, to put my graphics in?

sentences:
Getting ip address of connected network I have two scripts, a server script and a client script.
I built two parts of the app, one with the client script and another one with the server script.
I put both apps on devices, connected two devices with the local network and run the server.
First I wrote this line in the client to get the IP of the server device:

NetworkManager.singleton.networkAddress

But it gives me the IP of the client device.
Do you have any solution to this problem?

Thanks.

sentences:
Cocos2dx+Chipmunk: Fully elastic collision between moving bodies I'm using Cocos2dx and the built in Chipmunk physics engine, and currently I've got my PhysicsBodys' materials set up with:

Density=0
Restitution=1
Friction=0

in order to get fully elastic collision, and keep moving bodies moving at a constant speed. This works great if they collide against a static element, like a wall, not so much if they collide with other moving objects.

I'm moving these bodies by applying an initial force:

Vec2 velocity = moveDirection.getNormalized()*moveSpeed - myPhysicsBody->getVelocity();
Vec2 newForce = myPhysicsBody->getMass()*velocity / deltaTime;
myPhysicsBody->applyForce(newForce);

So I'm guessing that even though their materials would result in fully elastic collisions, the moving objects both carry an impact force, this modifies the resulting force into one with different magnitude? All these moving bodies have the same mass.

Currently I'm manually catching the impact start and manually generating the resulting force in the right directing, and using the object's speed to apply it with the same previous magnitude, effectively overriding Chipmunk's collision resolution.

Is this the best way to do this, or can I configure my bodies in a way that allows Chipmunk collision resolution to achieve the same effect? I'm a bit rusty on my physics.. heh..

sentences:
Moving sprite using the accelerometer in LibGDX? I don't know how to use accelerometer in LibGDX; how could I use the the motion sensor? I'm working for a top down game with the motion sensor. I'm new to this framework. My sprite image is already working and I want to control it using the accelerometer.

All comments are much appreciated, thanks in advance :)

Here is my code:

public class IngameDayOne extends ApplicationAdapter implements Screen {

// Constant rows and columns of the sprite sheet
private static final int FRAME_COLS = 5, FRAME_ROWS = 1;
// Objects used
Animation<TextureRegion> walkAnimation; // Must declare frame type (TextureRegion)
private Texture cat ;
SpriteBatch spriteBatch;
Texture Background;
// A variable for tracking elapsed time for the animation
float stateTime;

@Override
public void create() {
    // Load the sprite sheet as a texture
    cat = new Texture(Gdx.files.internal("cat2.png"));

    //Accelerometer
    float accelX = Gdx.input.getAccelerometerX();
    float accelY = Gdx.input.getAccelerometerY();

    if (accelX < -1){
        //go up
    }
    if (accelY < -1 ){
        //go left
    }
    if (accelY > +1){
        //go right
    }

    // Use the split utility method to create a 2D array of TextureRegions. This is
    // possible because this sprite sheet contains frames of equal size and they are
    // all aligned.
    TextureRegion[][] tmp = TextureRegion.split(cat, cat.getWidth() / FRAME_COLS, cat.getHeight()/ FRAME_ROWS);

    // Place the regions into a 1D array in the correct order, starting from the top
    // left, going across first. The Animation constructor requires a 1D array.

    TextureRegion[] walkFrames = new TextureRegion[FRAME_COLS * FRAME_ROWS];
    int index = 0;
    for (int i = 0; i < FRAME_ROWS; i++) {
        for (int j = 0; j < FRAME_COLS; j++) {
            walkFrames[index++] = tmp[i][j];
        }
    }
    // Initialize the Animation with the frame interval and array of frames
    walkAnimation = new Animation<TextureRegion>(0.090f, walkFrames);

    // Instantiate a SpriteBatch for drawing and reset the elapsed animation
    // time to 0
    spriteBatch = new SpriteBatch();
    stateTime = 0f;
    Background = new Texture(Gdx.files.internal("floor.png")); //File from assets folder
}

@Override
public void show() {
}

@Override
public void render(float delta) {

}

@Override
public void resize(int width, int height) {

}
@Override
public void render() {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); // Clear screen
    stateTime += Gdx.graphics.getDeltaTime(); // Accumulate elapsed animation time
    // Get current frame of animation for the current stateTime
    TextureRegion currentFrame = walkAnimation.getKeyFrame(stateTime, true);
    spriteBatch.begin();
    spriteBatch.draw(Background,0,0);
    spriteBatch.draw(currentFrame, 50, 50); // Draw current frame at (50, 50)
    spriteBatch.end();

}
@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() { // SpriteBatches and Textures must always be disposed
    spriteBatch.dispose();
    cat.dispose();
    Background.dispose();
}
}

sentences:
What tools do you use for 2D art/sprite creation? What cheap/free tools do you use for 2D art and/or animation?

I don't really like Gimp's interface, Paint.NET is limited and GraphicsGale is sort of archaic. Cosmigo ProMotion looks like it could be good, anyone use it? Seems a bit pricey at $78/92 but of course cheaper than Photoshop.

I used to like Jasc Paint Shop Pro 7, but the newer versions Corel makes are more for photos.

2D Bones support would be handy also.

sentences:
How was/is playback of music handled on consoles such as the NES, Master System, Gameboy, etc? So, I deliberately left out the SNES because AFAIK the music subsystem is basically entirely self-contained. However, on systems like the NES and Gameboy, while there are sound chips, there isn't any sort of dedicated sound CPU.

My question is how one reliably plays back music without putting too much of a burden on the CPU? Timing is clearly very critical: music won't sound right if the notes aren't played at exact intervals. Naively, one might just continually update the registers of the sound chip. However, this leaves no time for programming game logic! You could plan to update the registers every cycle in the main loop, but then any interrupts triggered would throw everything off.

I haven't been able to find any information on this, despite there seeming to be a clear conceptual gap! So basically, how does a game like say, Super Mario Bros on the NES manage to play back music consistently and reliably, regardless of what is happening on screen?

sentences:
Saving a list of points into a text file I recently posted a question about this, but was not really sure where to go. I've gotten some progress, and have generated some simple noise here:

http://pastie.org/5408655

That works well enough for me, but I would really like to be able to save the points into an ascii text file. currently it's formatted so that something like this:

11111111

11111111

11111111

11111111

would create a square. I need to save in this format with the points(and lines connecting them) generated in the method above.

Essentially, I need to write the array of points created in the first example to a text file formatted like the second example.
EDIT:
I ended up using serialization. This method makes it un-editable, but works for my purposes, I can really have good terrain generation now. here's my code: http://pastie.org/5455624 Everything is working excellently. Thanks to all those who helped

sentences:
How to find the source of a memory leak in a Blockchain + Node.js game We have been working in a Node.js game, part of a game network, which seems to be working slower and slower as you keep it open, as well as it seems to increase the RAM and CPU usage over time.

We are assuming it's a memory leak issue/improper use of the data structures within the application.

The question is, how could I detect the source of this type of issue?

sentences:
Delay for seconds when key is held down? Hello I am very new to Unity and am trying to make a shooting game in which when the space key is pressed down the gun charges then shoots. I want it to wait for 0.3 seconds before the gun fires off because I want an effect to happen with a particle system(I confused animation with effect in the first post). Also the problem the script has is that the bullet would not fire at all when the space is pressed. Here is the scripts I wrote:

 void Start()
 {
     StartCoroutine("Shoot",0.3f);
 }

 IEnumerator Shoot()
 {
     yield return new WaitForSeconds (0.3f);
     Bam ();
 }

 void Bam()
 {
     transform.Translate (0, 0, 12);
 }

 void Update ()
 {
     if (Input.GetKey (KeyCode.Space))
         Shoot();
 }

sentences:
How to correctly implement custom tick system? I am making a custom tick system to suit my needs (calling normal ticks every 0.2 seconds, medium ticks every 5 seconds etc...)
I followed the tutorial in this video: CodeMonkey tick system tutorial
In his tutorial, he implements the tick counting as shown:
    private const float tickTimerMax = 0.2f;

    private void Update()
    {
        tickTimer += Time.deltaTime;

        if (tickTimer >= tickTimerMax)
        {
            tickTimer -= tickTimerMax;
            Tick++;

            // Happens every 0.2 seconds.
            OnTick?.Invoke(this, new OnTickEventArgs {Tick = Tick});
        }
    }

However, in other sources I have seen that instead of subtracting tickTimerMax from tickTimer, we just straight up set the tickTimer to 0, as shown:
if (tickTimer >= tickTimerMax)
    {
        tickTimer = 0;
        Tick++;
    }

It's hard to say if there's a big difference between these two methods, because at first glance they seem to do the same thing, but clearly they have their differences. So I'm wondering, which one I should use?

sentences: Why Change from one coordinate system to another? When dealing with affine transformations, why do we need to change from one frame to another? What are some reasons. What are the pros and cons of doing this and the limitations if this was not possible.(Change of Coordinate Transformations)

sentences:
Rendering a model with transparent or translucent uv map applied doesn't work Before I try to make anything transparent, the model renders nicely. When I change the uv layout so that one piece of the model will be transparent, it renders horribly. This is the result with a translucent green texture:

I did transparency with OpenGL when I did 2D games and everything worked nicely because of these two lines:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Now, I fear, this won't be enough, right? Or maybe I should use some other technique?

sentences:
How do I change iTween values at runtime? I am trying to figure out how to run and change the speed of rotation on an iTween path at runtime. I'm trying to code it in Unity5 in C#. I have to rotate a few objects on an iTween path which I have created and I have to manage the speeds of the objects at runtime as they change.

My problem is that:
If I write the code in start method then it runs once within the whole game. How can I use this script in Update method so I can manage the speeds at the run time?

sentences:
Unity3D HTC Vive graphical bug when making builds Recently I noticed that my builds seem to have a weird graphical bug. This only occurs when I play a build. Running the game in VR in unity play mode doesn't show this bug.

I am not sure what is causing this or what it is even called. I do remember in the old days windows having a similar bug where you could draw on your screen basically by dragging an interface. I have an older build where this glitch didn't occur and checked the settings I had then and now and nothing changed.

Developing in VR is still fairly new to me so if it is anything basic I might not be aware of it.

My Unity version is 2017.2.0f3 with the latest SteamVR version using the HTC Vive, which has been running on the same version as when the bug didn't occur.

This link is a video of the bug occurring during the play mode in a build (in the menu the bug didn't occur strangely enough).

This link is a video of it being run in play mode. This is what I would expect in a build as well.

Just watching the first few seconds of both videos is plenty to understand the issue I am experiencing.

Thanks in advance.

Edit:
I have discovered that this issue is called ghosting. I hope this helps anyone.

sentences: Unreal Engine Ubuntu: Failed to import video, unknown file extension I've been reading tutorials and guides on getting video file playback in Unreal. I have media player materials created and textures. I'm having issues importing video files to Content/Movies directory. When I use the import manager the files don't show. Drag and drop says its an unknown file extension for MP4, MWV, and other formats I tried like AVI even though I know AVI is not supported. So I wonder if maybe I'm missing a plugin for Unreal 4.8 / 4.9 in Linux?

sentences: Unity 5 missing Standard Assets I have Unity 5 and when I make a new project, there are no assets that are usually there (Character Controller, Terrain, etc.). How do I fix that?

sentences:
Is there a way to blur objects in a 2d game with OpenGL without using shaders? Is there a nice way in OpenGL to blur objects without using shaders?

Currently, I'm accomplishing blur by rendering the object slightly up, down, left, right, and the four diagonals from its original position. It seems like there should be a much better way of doing this. I'm working in a 2d scene.

sentences:
Getting distance between point of an object and another object in Unity First, I'd like to apologize because this is a very basic and repetitive question, but I am completely new to game development.

I understand that I can find a distance between two objects using:

float dist = Vector3.Distance(other.position, transform.position);

However, how can I find the distance between a point of one object to other object?

For instance let's say my object is this sphere

Now, how can I return an array that says that there are no objects to the left (null), in the front there is an object at 1, and to the right there is an object at 0.5?

Thank you for your patience and understanding

sentences:
What is the best way to exploit multicores when making multithread games? Many people suggest to write a program, and then start optimizing it. But I think that when it's coming to multithreading with multicore, a little think ahead is required.
I've read about using threads, and experienced it myself during some courses at the university (still a student).

The big question is simple, but a bit abstract:

  What thread related steps in game design do I need to take, before implementation?

Now trying to be more specific. Let's say, as an example, that I'm making a small board game  (like Monopoly) that I want to be multithreaded.
My goal Is that this multithreaded game will exploit the best of the multicore system, lets say 4-6 cores (like in i7 processors).

My answer to this question at the moment is, one thread for each of these four basic components:

GUI
User Input / Output
AI (computer rival)
Other game related calculations (like shortest path from A to B, or level up status change)

I'm not an expert (yet!), and I'm sure there are better answers out there.
Any suggestion, answer, different approach will be helpful.

Some thoughts:
Maybe splitting the main database is a good way.. (or total disaster.. )

sentences:
Game State and Configuration via Events Often "singletons" are problematic for testing, so with my next game I'm trying my best to avoid them. But there is bunch of data (configuration or game state information) that different parts of my game require to function. So far I've used events (publish/subscribe) to pass around for example keyboard/touch actions.

Is it a bad idea to try to do the same with configuration/game state? So for example user changes some configuration parameter and instead of all those that need it doing something like ConfigurationSingleton.getParam("someparam") my event handler would call all those interested in param changes with SomeSubscriber.paramChanged("someparam", "new value").

How do you usually make available this kind of "global state/configuration" data in games?

sentences:
Populate triangles array when you already have sorted vertices array Input is a Vector3[] of verticies. Length is unknown, it could be anything above 2 - so these vertices form all kinds of multifaceted shapes with 3 being a triangle and 6 hexagon-ish.

Poor example to visualize:

vertices = [Vector3(..), Vector3(..), Vector3(..), Vector3(..), Vector3(..)];

Coordinates in that array are ordered counterclockwise. I also have the coordinates of center point that these verticies form (look at illustration below) - it doesn't have to be used but if it helps..

Few examples of which shapes can occur and which cannot:

Now I need to build meshes out of them. For each shape I need:

Vertices array (which I already have, nicely ordered)
Triangles array - 3 indices (from vertices array) per triangle until all vertices are covered

How to populate triangles array with these relatively easy shapes where each vertex has "direct line of sight" to every other vertices? Number of vertices is unknown of course.

sentences:
Why when using Mathf Lerp the speed is not changing according to Time.deltatime? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DetectCollision : MonoBehaviour
{
    public Transform player;
    public Transform target;
    public bool turnOnOffPlayerAnimator = false;

    float timeElapsed = 0;
    float lerpDuration = 3;
    float startValue = 1;
    float endValue = 0;
    float valueToLerp = 0;

    private Animator playerAnimator;
    private bool entered = false;
    private bool prevFacing = false;
    private Rigidbody rigidbody;
    private bool stopped = false;

    // Start is called before the first frame update
    void Start()
    {
        rigidbody = player.GetComponent<Rigidbody>();

        playerAnimator = player.GetComponent<Animator>();

        if (turnOnOffPlayerAnimator)
            playerAnimator.enabled = false;
    }

    // Update is called once per frame
    void Update()
    {
        var currFacing = IsFacing(target);
        if (currFacing != prevFacing)
        {
            // here you switched from facing to not facing or vise verca.
            timeElapsed = 0;
        }
        prevFacing = currFacing;

        var distance = Vector3.Distance(player.position, target.position);

        if (IsFacing(target))
        {
            if (entered && distance > 30)
            {
                if (timeElapsed < lerpDuration)
                {
                    valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
                    playerAnimator.SetFloat("Forward", valueToLerp);
                    timeElapsed += Time.deltaTime;
                }
                playerAnimator.SetFloat("Forward", valueToLerp);

                valueToLerp = 0;
            }
        }
        else
        {
            if (valueToLerp < 0.9f)
            {
                if (timeElapsed < lerpDuration)
                {
                    valueToLerp = Mathf.Lerp(endValue, startValue, timeElapsed / lerpDuration);
                    playerAnimator.SetFloat("Forward", valueToLerp);
                    timeElapsed += Time.deltaTime;
                }
                playerAnimator.SetFloat("Forward", valueToLerp);
            }

            Mathf.Lerp(valueToLerp, 0, Time.deltaTime * 0.0001f);
        }

        if(turnOnOffPlayerAnimator)
        {
            playerAnimator.enabled = false;
        }
        else
        {
            playerAnimator.enabled = true;
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        entered = true;

        Debug.Log("Entered !");
    }

    private void OnTriggerExit(Collider other)
    {
        entered = false;

        Debug.Log("Exited !");
    }

    private bool IsFacing(Transform target)
    {
        Vector3 forward = player.TransformDirection(Vector3.forward);
        Vector3 toTarget = target.position - player.position;
        return Vector3.Dot(forward, toTarget) > 0;
    }
}

I tried first 0.1f but it didn't change the lerp speed.
I want that if the player is pressing the W key and moving the player forward and then stop pressing the key W it will smooth slow will lerp to 0. and it does but I also wanted to control the lerp speed.
I want that when the player is starting moving backward direction if the player leave the W key the player should stop slowly to 0. This should be the line :
Mathf.Lerp(valueToLerp, 0, Time.deltaTime * 0.0001f);

but the Time.deltaTime does not seems to affect the lerp at all.
the lerp is working fine I just wanted to control the lerping speed too.

sentences:
Maya/Unity - See through models I've recently modeled my character inside Maya; here's an image. The first thing I noticed whilst creating my model is that the models could be seen through source 1, after doing a little research people stated that it was a graphical bug in Maya. However, once imported into Unity the same effect occurs.

Therefore, my Question is: How can I fix this inside Maya or Unity?

To prove that my UV map doesn't contain a low opacity texture see the second image below:

sentences:
Nonsense error in the overlap between 2 warriors and a tower I have a project where 1 warrior is generated every 5 seconds. This warrior as it is generated tries to follow a path that contains 4 target points. Between the target point 1 and the target point 2 there is a tower.

Then the warrior is going to meet the target point 2, but as soon as he hits the tower, he fails to reach the target point 2 and goes to meet it until it is destroyed.

The part of the code circled in pink was to be executed only after the destruction of the tower (when the life of the tower reaches 0), which does not happen, but the worst thing is that when it executes, it does not execute completely, the tower is not destroyed, but the warrior moves toward target point 2.

Result in game:

Look that the impression occurs for the two warriors.

Maybe the message log will help:

I decrease the delay time of the loop to 0.1 and as there is no time for the second warrior to overlap the tower along with the first warrior, everything works correctly.

The problem occurs when more than one warrior reaches the tower simultaneously.

sentences:
Tilemap Collision w/ different height levels and directions I've been programming a final fantasy 6 clone in C# using Monogame and Monogame Extended, and have met on a few interesting challenges regarding tilemap collision.

The game seems to have different height levels on tilemaps, such as in the picture below where the bridge is on one height level and the ground on another. I'm using Tiled for my maps and have the bridge on it's own layer, and the ground on another. However, when it comes to collision, you shouldn't be able to for example walk up on the bridge and end up on the ground, which leads to the problem of collision detection. Collision for the ground level should be different than on another height level like the bridge, but I'm not sure what a good solution to handle that could be.

Since I'm using TiledMap from Monogame Extended, I can't really modify the Tile class to hold collision data. My initial idea was to have an extra object or tile layer for each height level to specify collision/solids for each height level, but I found that it wasn't very intuitive and that it was a little messy. Optimally I would only need one tile layer per height level, but I'm at a loss for any ideas on how to handle collision in a scalable and intuitive way, so I was wondering if anyone here had any ideas?

Another interesting problem is regarding tile collisions and directions. For example, when standing in front of the fence in the picture below, you should not be able to walk up and behind the fence. But, if you are standing one tile above the fence, you should be able to walk down and behind it, but once you are behind it you should not be able to walk down again and end up in front of it.

I think the solution to that problem is to define collisions on each edge of the tile, so that the bottom edge of the tile is marked as solid, while the other edges aren't. The main issue with that is that I have no idea how to implement something like that with Tiled. It also presents the problem of rendering, since the tile would need to be rendered below the player if the player stands in front of it, and above the player if the player stands behind it. I think using a Z-index would solve it, but again, I haven't found a way to implement that using Tiled. Soo, I was wondering if anyone has any ideas or pointers on how to use Tiled w/ Monogame + Monogame Extended to implement those things?

sentences:
Building 2D Assets for a Game Targeting Multiple Framerates To make a real-world example, lets assume I want to build an animated sprite for an explosion. The duration of the animation should last ~1 second, and we'll say exactly one second to make the math a bit more simple. And lets assume I'm using XNA and my goal is to target both XBox (60fps), PC (60fps), and Windows Phone 7 (30fps).

My question is this, how should I build the sprite animations so that my programming is as simple as possible without simply using a timer to calculate which frame I should be on (which I feel would make the animation "choppy")?

sentences:
Help me to understand Geometry Clipmaps Ok, so It's a mesh of frames (high to low density) around the camera that adjusts the vertices Z by height-map values. But what happens, how does it work outside those frames? Its like the coarsest grid that somehave blends with the most outside clipmap (green in pic) frame? Or anything outside it, is not culled?

Edit: also how do collisions with terrain work, if the height values are calculated in vertex Shader?

sentences:
Ground texture comes up blurry using the UV Rect Tool Im trying to recreate the ground as this sample sprite sheet: https://opengameart.org/content/post-apocalyptic-expansion

I downloaded the sprite sheet and extracted the top left block and saved it separately and added it as a default object not Sprite/UI. I then added a UI > Raw Image to my scene, added the imported texture. But as I expand it, it becomes blurry, even the UV rect does not seem to help. I though the UV rect was supposed to repeat the texture.

Am I doing this wrong?

sentences:
Does transparency work with SSS in Unity's HDRP Lit shader? I am using Unity's HDRP Lit shader in Shader Graph (all are version 4.8.0-preview) on Unity 2018.3.0b12.

I am trying to use both transparency and subsurface scattering on the material. However, it appears that the visual appearance loses SSS when transparency is introduced.

Example: The cube on the left has transparency enabled, and has no visible SSS. The cube on the right has the same SSS settings as the left cube, however the right cube has no transparency enabled.

I need transparency to fade in the cube depending on its position, like this:

And here is my master node:

If anyone has an alternative solution that sidesteps this potential limitation, I am all ears. Cheers!

sentences: Where to start, to develop an online Backgammon game? I would like to develop a backgammon game to play against other players online, as a way of learning more Javascript/jQuery and a little game development. I'm a web developer and most of my experience is in PHP. I have minimal Javascript experience and no game development experience. Where should I start? Are there any particular books, tutorials, libraries, or frameworks that would help give me a jumpstart? As a beginner, am I better of using the DOM or Canvas?

sentences:
How can I reuse objects without depending on prefabs? I have several "frames" in a scene, each frame holds a different image.

These frames all hold the same scripts and are in a way instances of the same concept, but the image is different in each frame.

I want to find a solution for reusability. If I make a change in the hierarchy or add a script to the frame, I don't want to have to go through all the frames and make the same change.

The prefab system works for this case in all ways but one:

There are desirable differences between the frames that I want to keep (the image for instance). But if I make a change to one frame, and click the "Apply" button, all the settings of the current frame will apply to all other frames, including the ones that are desirable.

Is there a solution for this other than "Be careful not to click the Apply button" ?

sentences:
How to know the size of object in Unity in world units? Suppose I have some external package with objects. Suppose I place some of these object to the scene. Now how to know actual size of object in world units?

I found no any rulers or something in Unity.

The I thought I can place primitive cube and compare it, but then I realized that I don't know the size of cube too.

Is is possible to "measure" arbitrary object in Unity somehow?

sentences:
Is Apple Game Center Multiplayer Online? I'm trying to build a real-time multiplayer game on Unity. I was thinking of using services such as PUN or UNet, but then I ran into Game Center's multiplayer API.

I've read that Apple doesn't give servers and only provides matchmaking services. Is that true? How does that work? Would I still need PUN/UNet with Game Center?

I guess what I'm trying to ask is, will Apple host my game's multiplayer instance, where position of players is synced across, and replace PUN/UNet?

Any help is appreciated. Thank you. Also, if you can provide a source with your answer, that'd be great.

sentences:
Why doesn't my SpriteRenderer's color change when setting .color = new Color(166, 33, 33)? I need to change the color of my SpriteRenderer, and so I looked up how to do it and come up with this code:

spaceOne.GetComponent<SpriteRenderer>().color = new Color(166, 33, 33);

(In case you are wondering, yes I checked that 'spaceOne' is correctly linked to a GameObject.)

This should change the color, but it doesn't. As I was writing this, I found that replacing new Color(166, 33, 33); with Color.red; actually does change it to red.

So now I am wondering, why does the new Color(166, 33, 33); code not work, and how can I fix it?

P.S. I made sure that it wasn't something simple, like it being RGBA rather than RGB, but no, it still doesn't work with new Color(166, 33, 33, 255);.

sentences:
How do you make a bullet ricochet off a vertical wall? First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar methods (e.g. https://stackoverflow.com/questions/3203952/mirroring-an-angle) and reading other answered questions about this subject I have not been able to get the bullets to ricochet off a vertical wall correctly. Any method I've tried has failed and sometimes made ricocheting off a horizontal wall buggy.

Here is the collision code that calls the ricochet method:

//Loop through returned tile rectangles from quad tree to test for wall collision. If a collision occurs perform collision logic.
for (int r = 0; r < returnObjects.Count; r++)
    if (Bullets[i].BoundingRectangle.Intersects(returnObjects[r]))
        Bullets[i].doCollision(returnObjects[r]);

Now here is the code for the doCollision method.

    public void doCollision(Rectangle surface)
    {
        if (Ricochet) doRicochet(surface);
        else Trash = true;
    }

Finally, here is the code for the doRicochet method.

    public void doRicochet(Rectangle surface)
    {
        if (Position.X > surface.Left && Position.X < surface.Right)
        {
            //Mirror the bullet's angle.
            Rotation = -1 * Rotation;
            //Moves the bullet in the direction of its rotation by given amount.
            moveFaceDirection(Sprite.Width * BulletScale.X);
        }
        else if (Position.Y > surface.Top && Position.Y < surface.Bottom)
        {
        }
    }

Since I am only dealing with vertical and horizontal walls at the moment, the if statements simply determine if the object is colliding from the right or left, or from the top or bottom. If the object's X position is within the boundaries of the tile's X boundaries (left and right sides), it must be colliding from the top, and vice verse. As you can see, the else if statement is empty and is where the correct code needs to go.

sentences:
In Game Window Frame Size Consistency I'm currently building a game that utilizes many of its own 'windows' to display various information and dialogue to the user.  Since there are multiple sizes and proportions these windows must be displayed at, we need a consistent way to draw the frame around the window itself so that it does not become stretched as we change the default size/proportion of the art asset during runtime.

The solution we have currently come up with is drawing the frame in pieces, and the background of the windows separately.  We would have the background, a 'corner piece', and a 'connector piece'.  The background would be drawn and resized to whatever size and proportion not caring about if this particular piece was stretched .  The corner would be drawn and rotated to fit at each corner of the window.  Finally the connectors would be 1 pixel wide pieces that would be drawn and rotated/stretched to fill the gap between the 4 corner pieces.

While I feel this is an adequate solution to the problem I am not sure if this is the solution most games use when they have windows they would like to keep consistently framed.  Is there a more commonplace solution for this issue, or does what we've come up with pretty much nail it on the head?

sentences:
Why does my Point light turn off if Player walks in any direction in Unity 2D? My 2D Sprite has a material, Sprite diffuse attached to it.

Now when I set up a light, it works but if I play the Game and walk, the light turns off immediately and the Player turns black.

The light is set up, Type as Point and Baking as Realtime, Distance at Z-axis is -25.

The Camera distance is at -30 on the Z-axis.

The Player is at 0 on the Z-axis.

I set the light between Camera and Player, but I also have a Camera Follows Player script, maybe it causes the problem, but I watched the Z-axis while playing and it doesn't move on the Z-axis.

I will also post Camera Script if someone can detect any problem.

{
    private Vector2 velocity;

  public float smoothTimeY;
  public float smoothTimeX;

  public GameObject player;

  // Use this for initialization
  void Start ()
  {
    player = GameObject.FindGameObjectWithTag("Player");
  }

  // Update is called once per frame
  void FixedUpdate ()
  {
    float posX = Mathf.SmoothDamp (transform.position.x, player.transform.position.x, ref velocity.x, smoothTimeX);
    float posY = Mathf.SmoothDamp (transform.position.y, player.transform.position.y, ref velocity.y, smoothTimeX);

    transform.position = new Vector3 (posX, posY + 29, transform.position.z);
  }
}

sentences:
Finding direction of travel in a world with wrapped edges I need to find the shortest distance direction from one point in my 2D world to another point where the edges are wrapped (like asteroids etc). I know how to find the shortest distance but am struggling  to find which direction it's in.

The shortest distance is given by:

int rows = MapY;
int cols = MapX;

int d1 = abs(S.Y - T.Y);
int d2 = abs(S.X - T.X);
int dr = min(d1, rows-d1);
int dc = min(d2, cols-d2);

double dist = sqrt((double)(dr*dr + dc*dc));

Example of the world

                   :
                   :  T
                   :
    :--------------:---------
    :              :
    :           S  :
    :              :
    :              :
    :  T           :
    :              :
    :--------------:

In the diagram the edges are shown with : and -. I've shown a wrapped repeat of the world at the top right too. I want to find the direction in degrees from S to T. So the shortest distance is to the top right repeat of T. but how do I calculate the direction in degreed from S to the repeated T in the top right?

I know the positions of both S and T but I suppose I need to find the position of the repeated T however there more than 1.

The worlds coordinates system starts at 0,0 at the top left and 0 degrees for the direction could start at West.

It seems like this shouldn’t be too hard but I haven’t been able to work out a solution. I hope somone can help? Any websites would be appreciated.

sentences:
Use Mathf.PingPong() from current position I am trying to use Mathf.PingPong() from the current x, y and z coordinates and let it move along the x axis however now it moves too far and too fast. I know how I can speed down but what about the distance?

       transform.position = new Vector3(transform.position.x + Mathf.PingPong(Time.time * speed, 1), transform.position.y, transform.position.z);

sentences:
Adding a small slide when player releases left/right key The aim is for the player object to slow down and stop instead of just stopping dead. The following codes works ok when the player is not jumping, but gets stuck in an object if the player is in the air when they do it.

Left key released event:

if hsp = 0 exit;

hspeed = -3;
friction = 0.20;

if obj_Player.hspeed = 0
{
hspeed = 0;
}

Right key released event:

if hsp = 0 exit;

hspeed = +3;
friction = 0.20;

if obj_Player.hspeed = 0
{
hspeed = 0;
}

Horizontal collision code for interest:

if (place_meeting(x+hsp,y,obj_bound))
{
while(!place_meeting(x+sign(hsp),y,obj_bound))
{
    x += sign(hsp);
}
hsp = 0;
}

x += hsp;

sentences:
What do I need to do to my slope collision detection to prevent the player from passing through my collision? I've recently implemented slope collision detection for my project. The issue I'm having is that the character occasionally passes through the line.

This usually occurs when the characters MoveAcceleration is increased from 5000 to 8000 via a game mechanic. I was wondering if there is a way to make the line collision more reliable without reducing the MoveAcceleration variable ?

This is how the characters position is calculated

velocity.X += movement * MoveAcceleration * elapsed;
Position += velocity * elapsed;

This is how the slopeCollision is handled

private void HandleSlopeCollisions(GameTime gameTime)
        {
            isOnSlope = false;

            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (velocity.Y >= 0)
            {
                if (attachedPath != null)
                {
                    isOnSlope = true;

                    position.Y = attachedPath.InterpolateY(position.X);
                    velocity.Y = 0;

                    if (position.X < attachedPath.MinimumX || position.X > attachedPath.MaximumX)
                    {
                        attachedPath = null;
                    }
                }
                else
                {
                    Vector2 footPosition = position;
                    Vector2 expectedFootPosition = footPosition + velocity * elapsed;

                    CollisionPath landablePath = null;
                    float landablePosition = float.MaxValue;

                    foreach (CollisionPath path in collisionPaths)
                    {
                        if (expectedFootPosition.X >= path.MinimumX && expectedFootPosition.X <= path.MaximumX)
                        {
                            float pathOldY = path.InterpolateY(footPosition.X);
                            float pathNewY = path.InterpolateY(expectedFootPosition.X);

                            if (footPosition.Y <= pathOldY && expectedFootPosition.Y >= pathNewY && pathNewY < landablePosition)
                            {
                                isOnSlope = true;
                                landablePath = path;
                                landablePosition = pathNewY;
                            }
                        }
                    }

                    if (landablePath != null)
                    {
                        isOnSlope = true;

                        velocity.Y = 0;
                        footPosition.Y = landablePosition;
                        attachedPath = landablePath;

                        position.Y = footPosition.Y;
                    }
                }
            }
            else
            {
                attachedPath = null;
            }
        }

sentences:
How to debug shaders running on Android 4.x devices? I have tried some of the existing inspectors such as RenderDoc and gapid, but none of them can be used with Android 4.x. Latest version of gapid requires Android 6.0 and RenderDoc requires Android 5.0.

But I need to debug shaders in my app running on a Galaxy Tab 3 8.0 (SM-T311, ARM Mali 400), which uses Android 4.2.2. I cannot upgrade its Android version.

The app was made with Unity 2018.4 and targets Android 4, ARMv7. How can I inspect & debug my shaders running on this kind of device?

sentences:
how to render small texture on another texture? can anybody help me to render small texture on another texture.
i.e
I have one background image, when user touches on the screen it should draw small(circle or any object) on it.

can anybody suggest me good tutorial to starts with it?

sentences:
How to make 2D water like in this video? I wanna make water and waves for my little 2D PC game like in this video:
http://www.youtube.com/watch?v=ooU6cTeirlQ
I don't know how to write a similar shader. Does anybody know how to write a similar shader?
Or is it possible to do the waves without shaders?

sentences: In HaxeFlixel, how do I avoid hard-coding dialogue? I'm planning to develop a visual novel in Haxe Flixel and wanted to know if there is a easier way to add dialogue than to hardcode them in every square. I don't know if I can import a txt file with the dialogues or something like that so I can simple change the txt file instead of have to check the code for every typo.

sentences:
Behaviour tree editor Unity I'm a programmer, so I am perfectly aware of how to implement a behaviour tree. I don't want to rely on third party tools, but still have convenient tools for creating the AI for my game.

I was looking at tools like this one but I could not find out how to create editor extensions like that in Unity.

I also noticed that there is a new experimental feature (Playables) in the current versions of Unity.Does this use the state machine editor from the Animator? Should/Could I use that to implement a behaviour tree?

sentences:
Armature rest matrix - why does this exist? I'm not sure I have a clear idea on what purpose the rest matrix/bindpose is supposed to serve in skeleton animation. If it is supposed to transform a bone into the rest pose and the mesh itself is always exported in the rest pose then shouldn't the rest matrix always be the identity matrix? But then why is it not the identity matrix in Blender?

I also find that if I transform my mesh (exported in the rest pose) by the rest matrix for each bone then it is very incorrectly deformed (it was after all already in the rest pose).

sentences:
Using Lazer with a Quadtree I have a quadtree implementation that works well with what I need for handling collisions between enemies, projectiles, and heroes.

However, most of these types of entities are pointbased, with varying radius but that's about it.

I have a weapon idea for lazer or ray weapon that's essentially a line.  How does something like that fit in to working with something like a quadtree?  Normally when we have a quadtree, we are essentially letting that data structure handle point masses to figure out which subset of objects we need.  How then might we handle something like a line?

The dumb way to do it is to just query the enemies and do something like a circle line intersection test on all the enemy objects.  This is obviously not efficient especially when we already have a quadtree.

One idea i have are to just put some dummy projectile object along the line and submit those to the quadtree.  Then if we get any returned objects from those dummies, then we can use the circle line intersection test on it.

Any ideas pertaining to how to use ray weapon that requires some line intersection test with a quadtree would be appreciated.  Thanks.

sentences:
Lightmapping + custom model + manifold What are the things one should consider before doing light maps?

We have custom models in Unity Scene,while doing light mapping it stuck at "Clustering job 5/11".

After researching I come to know models should be "Manifold" to be light mapped  so we did manifold our custom models and now light maps are occurring properly though at the cost of lot of polys which is causing performance hit on Android device.

So my question is has anyone faced similar issue or workaround for same?

sentences:
Efficient vertex buffer memory management? I am building a voxel engine with a similar mechanism to minecraft(yes, I know...).
It works by loading and unloading individual chunks of 16*64*16 cubes each in a square grid around the player. This works fine for small render distances - like a 9x9 square grid of chunks. However, since updating a single vertex buffer entirely with a new mesh of millions of blocks each time a chunk is loaded/unloaded is inefficient, I have designed it so that each chunk has its own VB of fixed size, and rendering the entire world is basically looping through all the buffers, using d3dDeviceContext->IASetVertexBuffers(...).

When I increase the render distance, say to a square grid of 11x11 (around minecraft's large render distance), creating the vertex buffers simply cannot proceed beyond a certain point, and d3dDevice->CreateBuffer() returns E_OUTOFMEMORY.

So my question is: How do i manage the memory usage of the vertices, to both maintain good FPS (not using a single buffer for the entire terrain) and to have decent memory usage?

Additional Details:
My vertex datatype is a struct composed of x,y,z coords, u,v texture coords and 3 normal coords. I know it can be improved in ways like a single byte for normals, since in voxels there are only 6 possible directions, however this will come later.

The fixed size of each chunk's vertex buffer is 16*16*64*18 vertices (16*16*64 blocks with a maximum of half of the sides showing, or 36/2 vertices max per block). This could also use some work, as each of these buffers is around 10MB.

How do games like minecraft handle this amount of data at once? (not to say i am using 64 blocks high chunks, where minecraft has 256)
I have briefly considered using points as vertex shader inputs and expanding them to cubes in the geometry shader, to save 87.5% of the space, but this seems rather intense on the GPU.

sentences:
How to generate a city street network? I would like to create a city generator for a game, but I am facing a problem at the very start of the generation: the road system.

As it is a medieval world, I don't want a grid plan like many modern cities. I would ideally prefer a pseudo-random generation of large avenues and smaller streets, where it could be possible to get lost, but with still some logic - not a complete labyrinth.
Something that would look like a naturally grown town.

In order to keep it simple, let's say my cities would be on flat and stable terrains, without any river-crossing or relief problems. I could try to integrate it to a solution after.

I didn't decide of a precise size or disposition for my cities, so if you have a solution that would work only with cities of a precise form (square, circle, rectangle etc), I would take it.

sentences:
How to apply Data Oriented Design with Object Oriented Programming? I've read lots of articles about Data Oriented Design (DOD) and I understand it but I can't design an Object Oriented Programming (OOP) system with DOD in mind, I think my OOP education is blocking me. How should I think to mix the two? The objective is to have a nice OOP interface while using DOD behind the scenes.

I saw this too but didn't help much: https://stackoverflow.com/questions/3872354/how-to-apply-dop-and-keep-a-nice-user-interface

sentences: Is point texture filtering the same as nearest? Is point texture filtering the same as nearest (different names for the same technique)?

sentences:
Libgdx: How to setZIndex for pause dialog? Pause dialog has to appear on top of the play screen, it has to appear on top of other objects.

I have tried to use

dialog.setZIndex(10); // or whatever number and I tried adding it in many places

It just doesn't work, how to make the dialog be on top of other objects? for a ccomplete version here

I'm using only one batch and the stage is used only to add background and dialog

  stage = new Stage();
  Gdx.input.setInputProcessor(stage);
  stage.addActor(bg); // somewhere else in the code
  stage.addActor(btnPause);
  camera.update();
  game.batch.setProjectionMatrix(camera.combined);
  stage.act(delta);
  stage.draw(); // and thats about it for stage
  game.batch.begin();
  font.setColor(Color.YELLOW);
  font.draw(game.batch, myScore + score, Gdx.graphics.getWidth(), camY);
  // and here I draw the game   game.batch.draw(game) and I'm using only one batch

I hope I didn't miss anything

If I put the game batch in state.RUN in an effort to hide objects when the pause dialogue appears, then when I resume, it will go to batch.end and exit the game

Pause

public void pause() {
 this.state = State.PAUSE;
 final Dialog dialogP = new Dialog("", skin, "pauseDialog") {};

 dialogP.setScale(4, 6);
 dialogP.setPosition(Align.center, Gdx.graphics.getHeight());

 dialogP.addAction(sequence(alpha(0),
  parallel(fadeIn(.5 f)),
  moveBy(0, -1000 f, .30 f, Interpolation.smooth),
  moveBy(0, 30 f, .40 f, Interpolation.smooth)));

 //PlayOn
 ImageButton btnPlayOn = UIFactory.createButton(txtrPlayOn);
 btnPlayOn.setSize(40, 40);
 btnPlayOn.setPosition(75, 75, Align.center);
 dialogP.addActor(btnPlayOn);

 //EndGame
 ImageButton btnEndGame = UIFactory.createButton(txtrEndGame);
 btnEndGame.setSize(40, 40);
 btnEndGame.setPosition(75, 55, Align.center);
 dialogP.addActor(btnEndGame);

 stage.addActor(dialogP);

 //playOnAction
 btnPlayOn.addListener(new ClickListener() {
  @Override
  public void clicked(InputEvent event, float x, float y) {
   dialogP.hide();
   resume();
  }
 });

 //EndGameAction
 //PlayButtonAcion
 btnEndGame.addListener(
  new InputListener() {
   @Override
   public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
    super.enter(event, x, y, pointer, fromActor);

    Actions.scaleTo(0.7 f, 0.7 f, 0.5 f, Interpolation.bounceOut);
    stage.addAction(Actions.sequence(Actions.moveBy(-stage.getWidth(), 0, .5 f), Actions.run(new Runnable() {
     @Override
     public void run() {
      game.setScreen(new MainMenuScreen(game));
     }
    })));

   }

  });

}

The basic principle is implemented from the accepted answer to this question

sentences:
Why the rotation using the Coroutine is rotating but the object is in slant ? and how to rotate it with Coroutine non stop? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Spin : MonoBehaviour
{
    public Vector3 targetRotation;
    public float duration;
    public bool spinInUpdate = false;

    // Start is called before the first frame update
    void Start()
    {
        if (spinInUpdate == false)
        {
            StartCoroutine(LerpFunction(Quaternion.Euler(targetRotation), duration));
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (spinInUpdate == true)
        {
            transform.Rotate(new Vector3(0, 1, 0));
        }
    }

    IEnumerator LerpFunction(Quaternion endValue, float duration)
    {
        float time = 0;
        Quaternion startValue = transform.rotation;

        while (time < duration)
        {
            transform.rotation = Quaternion.Lerp(startValue, endValue, time / duration);
            time += Time.deltaTime;
            yield return null;
        }
        transform.rotation = endValue;
    }
}

slant I mean this is how it's rotating with the Coroutine the small cube that rotate is in slant :

When using the Update way it's rotating fine and this is how it should rotating also with the Coroutine for example on the X only :

The small cube when rotating either in update or in the Coroutine  should not be slant. but it's slant in the Coroutine.
And how can I add a speed factor to the Update to control the rotation in the Update in case using the Update ?
About controlling the speed in the Update I just added a global float variable and in the Update :
transform.Rotate(new Vector3(0, Time.deltaTime * rotationSpeed, 0));

and it's working for the speed.

sentences:
Workflow for a data-heavy, almost spreadsheet-like management game I'm absolutely fascinated by the management games, such as Football Manager, with dozens of spreadsheets and thousand of pieces of data.

Coding it all in Unity, especially for a prototype, feels like a lot of useless UI work. Trying to just make it from scratch with React suffers, at the same time, from architecture problems...

What architecture or approaches would help tackle this problem?

sentences:
How can I prepare the different difficulty levels for my game? I've though about creating the game for the easiest difficulty level, and from there scale up and create the other, more difficult difficulty levels, but I'm not sure it's the fastest way to go.

How should I create the different difficulty levels for my game?

sentences:
UnrealScript access variable in one class from another? So there are some similar questions out there but the responses often say that you should use 'new' or 'spawn', but I'm working with the playercontroller don't want to make a new playercontroller.  Maybe this isn't the right way to be doing this but I want to view the state of a variable in the playercontroller that will change fairly often from my HUD.  Is there a way to do this?

playercontroller class

var bool bYeaNo;

exec function change() {
  bYeaNo= !bYeaNo;
}

defaultproperties
{
  bYeaNo = false
}

HUD class

event PostRender() {
  Super.PostRender();
}

function DrawHUD() {
  Super.DrawHUD();
  Canvas.SetDrawColor(0, 0, 0);
  Canvas.SetPos(25, 25);

  if (bYeaNo) { //this is wrong so what would make this work?
    Canvas.DrawText("Yea");
  } else {
    Canvas.DrawText("No");
  }
}

sentences:
Modeling an inventory system in SQL I'm working on a multiplayer game played through the browser.  It's not a real-time game which is why I decided to go with a database, however I'm pretty weak with SQL and starting to run into problems.

Right now I'm working on the inventory system, the requirements being:

A Player can have 0 or more of each item
Certain items have a max limit
Certain items can only be bought with a minimum XP

I have a table for my Player and Item.  How should I store the inventory relationship?  I feel like I'll need a separate table for this, rather than a simple ManyToMany relationship, but I'm not sure what it would look like.  My first thought is a table that has a player ID and the counts of each item that player has.  I would need a column for each item I have which doesn't seem very maintainable... does that seem right?

And what's the best way to ensure the max limit and minimum XP constraints?  The proper way seems to be a constraint in the database, but I can't think of a way to query items that the player is eligible to buy.

Thanks!

sentences:
Unreal Engine Player Quality I had to force Unreal to use my integrated graphics card because VR wasn't working with my NVidia card.

When I did this, the framerate dropped terribly and it popped up a dialogue "Frame rate's bad, would you like to lower quality?"  Which I said yes to.

Now, I've set it to use my NVidia card again, but it's stuck in this low quality state.  It seems to be tied to the engine, not the project.  All my 4.9 projects run in this garbage state, but my 4.10 projects are fine.

How can I reset the engine player settings for 4.9?

sentences:
Square Grid Polygonal Terrain Query algorithm? I have a square, fixed-grid terrain with one terrain type per grid unit in my game, and I want to do an arbitrary polygonal terrain query which returns all of the grid units enclosed/intersected by the polygon. Can anyone point me towards an algorithm for this?

I'll be using this to make sure that my actors aren't going through invalid terrain when they move.

Thanks!

sentences: Making a licensed game you want to make If I, for example, wanted to make a Spongebob game and was not asked to to do so by the company that owns the character, what would I have to do in order to get the rights to make the game?

sentences:
Unity LoadLevelAdditive and baked light scene settings I am a programmer for a small game.
For our levels, I separated the UI from the level data, so one scene is a scene which contains only the UI, the other scene has all the gameobjects and models and ... the light.

So when loading a level, I first load the UI scene (LoadLevel), then the actual play scene (LoadLevelAdditive).

Now that our graphics guy wants to bake some lights, he is telling me it doesn't work, because whatever his settings in the play scene, Unity ignores them and uses the settings of the UI scene.
He also tells me we cannot just ignore the light settings of the UI scene ...

So my question is, how do I make Unity ignore the light settings of a certain scene (UI scene in my case) or how can I enable a settings override?

Thanks.

sentences:
How to make a character jump in SFML? How could I made a character jump with SFML in C++, a simple example could be very helpful.

Thanks in advance.

This is the code I currently have; how can I make the sprite jump?

#include <SFML/Graphics.hpp>
#include <iostream>
using namespace sf;

int main(){
    sf::RenderWindow ventana(sf::VideoMode(800,600),"mi ventana");
    ventana.setFramerateLimit(60);
    sf::Texture Image;
    Image.loadFromFile("tortuga.png");
    sf::Sprite sprite(Image);
    sprite.setPosition(-230,100);
    bool isPlay=true;
    bool presionarW(false);
    bool presionarA(false);
    bool presionarS(false);
    bool presionarD(false);
    //Controlar cualquier evento
    int x=30;
    int y=3;
    sf::Event miEvento;
    sf::CircleShape figura(10);
    while (isPlay)

    {
        //Eventos

        while(ventana.pollEvent(miEvento)){
            if (miEvento.type==sf::Event::Closed){
                isPlay=false;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::W){
                presionarW=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::A){
                presionarA=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::S){
                presionarS=true;
            }
            if (miEvento.type==sf::Event::KeyPressed && miEvento.key.code==sf::Keyboard::D){
                presionarD=true;
            }

        }

        //Logica del juego
        if(presionarW){
            sprite.move(10,-20);
            presionarW=false;
        }
        if(presionarA){
            sprite.move(-20,5);
            presionarA=false;
        }
        if(presionarS){
            sprite.move(0,25);
            presionarS=false;
        }
        if(presionarD){
            sprite.move(25,0);
            presionarD=false;
        }

        //Renderizado
        ventana.clear();
        ventana.draw(sprite);
        ventana.display();
    }
    ventana.close();
}

sentences:
Character on platform move slowly I'm having a problem similar to this link: http://answers.unity3d.com/questions/1295955/character-on-a-moving-platform-slows-down.html

But...

My 2D character is on an elevator (which does not have any physics) and is being moved up and down through an animation (transform). But when my character is on the elevator, the colliders2D overlaps another, as my character's RigidBody2D stands still as I move the game object elevator (crossing each other).
My solution was to try to attach my character as the child of the elevator (SetParent), and this solved the problem of overcoming the colliders, but it gave me a new problem.

The new problem consists of a certain slowness in the movement of the character while it is on the elevator. I believe the problem is because the transform of my character is in motion while the elevator goes up and my rigidbody don't add any force.

Do I need move the elevator with physics to stay movent? Or am I thinking the wrong way?"
How to solve this problem?
See the player movement script:

 using UnityEngine;
 using System.Collections;

 public class Move : MonoBehaviour {

     public float speed;
     public float jump;
     public GameObject rayOrigin;
     public float rayCheckDistance;
     Rigidbody2D rb;

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

     void FixedUpdate () {
         float x = Input.GetAxis ("Horizontal");
         if (Input.GetAxis ("Jump") > 0) {
             RaycastHit2D hit = Physics2D.Raycast(rayOrigin.transform.position, Vector2.down, rayCheckDistance);
             if (hit.collider != null) {
                 rb.AddForce (Vector2.up * jump, ForceMode2D.Impulse);
             }
         }
         rb.velocity = new Vector3 (x * speed, rb.velocity.y, 0);

     }
 }

sentences:
3D collision detection on non flat surface I am developing a game which needs an accurate collision detection algorithm, when an object travels down a slope which isn't flat.  To be more precise I need to simulate a skier who travels down a ramp.

My first idea was to create simple bounding box around the skies and the ramp. Then place the skier in mid air and start calculating gravity. When the two bounding boxes intersect => collision detected (this is how I did it in 2D). But the problem is that the skies are flat and the slope isn't. So there is a chance that the ski will stick into the jump (due to curved surface of the jump) or even worse the skier  will go under the jump (I don't want the skies to "sink" into the jump as well) .

What would be the best way of solving this?
What I could think of is:

when collision is detected, rotate the skies until the front and the back end of the skies are colliding with the surface.

Is this idea any good? Did any face this kind of problem? Would be better to morph the skies according to the slope (but this would probably be an overhead I can't afford)?

P.S. if I didn't explain enough, write a comment and make a sketch.

sentences:
Implementing my Entity System. Questions about some problems I have found Well during this week I have deciding about implementation of my entity system. It is a big topic so it has been difficult to take one option from the whole. This has been my decision:

1) I don't have an entity class it is just an id.

2) I have systems that contain a list of components (the list is homegenous, I mean, RenderSystem will just have RenderComponents).

3) Compones will be just data.

4) There would be some kind of "entity prototypes" in a manager or something from we will create entity instances.Ideally they will define the type of components it has and initialization data.

5) Prototype code to create an entity (this is from the top of my head):

int id=World::getInstance()->createEntity("entity template");

6) This will notify all systems that a new entity has been created, and if the entity needs a component that the system handles it will add it to the entity.

Ok, this are the ideas. Let's see if some can help with the problems:

1) The main problem is this templates that are sent to the systems in creation process to populate the entity with needed components. What would you use, an OR(ed) int?, a list of strings?.

2) How to do initialization for components when the entity has been created? How to store this in the template? I have thought about having a function in the template that is virtual and after entity is created an populated, gets the components and sets initialization values.

3) Don't you think this is a lot of work for just an entity creation?.

Sorry for the long post, I have tried to expose my ideas and finding in order other could have a start beside exposing my problems.

Thanks in advance,
Notbad.

sentences:
Sprite character/item less than tile size I am starting to work on a 2d top down tile-map game for fun and learning purposes. I have read some great answers here re tile-map size vs character sprite size, pixel density, ppu, screen resolution etc.

A standard route is to set a constant PPU and do characters as 2 tiles (vertically usually). We went with 32x32 pixels for the tile and 32x64 for the character.

Unfortunately, our artist didn't draw the character to fill out that space on the extremes (the feet and head do not touch the vertical edges and there is also space between the character and the horizontal edges) and when Unity slices the sprite-sheet we get smaller characters of 28x53.

I imagine this is a problem for keeping the consistency I outlined above with the tile size.

Is this a problem? If so, are the solutions to this to either change the tile size to 28x28 or ensure that the sprite design actually fills the tile space (that is, touching edges of the 32x64 area)? Must one draw items as always filling out the full tile size or can one make, say potions, in a 32x32 tile but only take up say 12x16?

sentences:
How to resolve a sphere-mesh collision? I'm making a rolling-ball type game, and I can't seem to get my sphere-mesh collision code working properly.

Currently what I have for the main loop (in regards to collision) is the following:

Calculate player acceleration based on input
Clamp velocity to avoid clipping
Add velocity to position
Add acceleration to velocity
For each solid object:
    Check for collision for this object and resolve (how I do this is below)

If there were any collisions:
    Normalize accumulated normal vector (explained below)
    Slow down ball to account for friction

I tried two main methods for resolving collisions, each with their own problems.

The first method:

For each triangle:
    If there is a collision:
    Correct player velocity along normal based on distance
    Accumulate normal for friction calculations later
    If velocity perpendicular to surface is above threshold:
        Rebound ball off surface with damping factor
    Otherwise, if moving toward surface instead of away:
        Clear perpendicular velocity

The problem with this method is, when I hit a wall, the player will begin to bounce erratically. The collision I'm using to test this looks like this (player to scale):

The second method is similar to the first:

Set collision distance accumulator to arbitrarily high value
Set triangle index to -1 (to denote that there's no collisions)

For each triangle:
    If there is a collision:
        Calculate collision distance
        If this distance is smaller than the accumulator value:
            Set triangle index to current triangle
            Set collision distance accumulator to current distance value

If the index is not -1 (there was a collision):
    Correct player velocity along normal based on distance in accumulator
    Accumulate normal for friction calculations later
    If velocity perpendicular to surface is above threshold:
        Rebound ball off surface with damping factor
    Otherwise, if moving toward surface instead of away:
        Clear perpendicular velocity

This fixes the bounciness issue, but now I can go partially through surfaces which are supposed to be solid.

I have no idea where to turn at this point. Hopefully someone here can provide some insight as to what's going on.

[EDIT] I can add some video if that'd help anyone.

[EDIT 2] Here's a link of a video using the first method:
https://drive.google.com/open?id=1n1MxTYQkzKA2eixTkEOD3E7eOd0Ryl4f

[EDIT 3] I redid the code somewhat, here's some related code snippets:
https://pastebin.com/GQd9bwgB

It still bounces, like so:
https://drive.google.com/open?id=1JPJ4lkIB0wBhjnlT5mawxKwq0dC6DlNr

I think I know the cause, but I don't know how to best fix the issue.

sentences:
Ray is not shooting forward This is the code for Raycast:

RaycastHit hit;
Vector3 direction = transform.forward;

Debug.DrawRay(transform.position, direction * 200f, Color.red, 0.1f);

if(Physics.Raycast(transform.position, direction * 200f, out hit, 200f)) {
    if(hit.transform.tag == "Enemy") {
        // do something with enemy
    }
}

I'm shooting the ray to in front of the object, but it's not quite working to me.

These are the screenshots:

As you can see above second picture, shot the ray to forward, but actual ray wasn't forwarded.

I also rotated the ray z axis 90 or -90 degree, but stil not working. (Actually I tried to rotate each axis 90 and -90, but nothing seems work)

Vector3 direction = Quaternion.Euler(0, 0, 90) * transform.forward;  // Doesn't work
Vector3 direction = Quaternion.Euler(0, 0, -90) * transform.forward;  // Doesn't work either

What am I missing?

sentences:
SceneGraph understanding So far i can understand that it is a  tree data structure consisting of multiple nodes.

If i draw an entity in world without any scenegraph, e.g. I have an object "Aircraft" which inherit from object "Entity"... so far so good i guess.

But what if i use scenegraph? if i draw an entity in world with scenegraph, i still have an object "Aircraft" which inherit from object "Entity" but now my object Entity inherit from a object "Node"? what is the diference? i still move my aircraft as the same without a scenegraph? or do i need to move node instead of aircraft?

sentences:
Unlock levels using coins - Unity I'm creating a game that has multiple levels. The first three levels are free but the others can be unlocked either using coins (collected during the game) or through IAP. For the coins, I'm using a binary formatter to store the number of coins. The reason I'm using BF is because it persits through all levels(so far this seems to work as the coin score is carried through to other levels). Here is code I have so far in the coinSystem:
public class CoinSystem : MonoBehaviour
{
  public TextMeshProUGUI coinScoreText;
  public int coinScore;

  void Start()
  {
    LoadScore();
  }

  public void Save()
  {
    coinScore++;
    coinScoreText.text = coinScore.ToString();

    BinaryFormatter bf = new BinaryFormatter();
    FileStream file = File.Open(Application.persistentDataPath + "/TotalCoinScore.dat", FileMode.Create);

    CoinContainer coinContainer = new CoinContainer();
    coinContainer.coinScore = coinScore;

    bf.Serialize(file, coinContainer);
    file.Close();
   }

  public void LoadScore()
  {
    if (File.Exists(Application.persistentDataPath + "/TotalCoinScore.dat"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/TotalCoinScore.dat", FileMode.Open);
        CoinContainer coinContainer = (CoinContainer)bf.Deserialize(file);
        file.Close();
        coinScore = coinContainer.coinScore;
        coinScoreText.text = coinScore.ToString();

     }
   }
 }

  [Serializable]
  public class CoinContainer
  {
     public int coinScore;
  }

This is code that I use to add to the coinScore.
public class Player : MonoBehaviour
{
  Rigidbody rb;
  public CoinSystem cs;
  public bool dead = true;

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

  .
  .
  .
  .

  void OnTriggerEnter(Collider col)
  {
    if (!dead && col.gameObject.tag == "Enemy")
    {
        die();
    }
    if (!dead && col.gameObject.tag == "Coin")
    {
        cs.Save();
    }
  }

So now in the level select menu, I want to add a button that once clicked should enable the user to unlock a particluar level if he has enough coins. For example, if a level requires 500 coins and the user has 600, then on clicking this button the level is unlocked and the total coins now available are 100. And if the number of coins are less than what is required to unlock a level then the user should not be able to unlock that level. I'm not sure how to implement this.

sentences:
Learning to optimize with Assembly I am a second year student of Computer Games Technology. I recently finished my first prototype of my "kind" of own pathfinder (that doesn't use A* instead a geometrical approach/pattern recognition, the pathfinder just needs the knowledge about the terrain that is in his view to make decisions, because I wanted an AI that could actually explore, if the terrain is already known, then it will walk the shortest way easily, because the pathfinder has a memory of nodes).

Anyway my question is more general:
How do I start optimizing algorithms/loops/for_each/etc. using Assembly, although general tips are welcome.
I am specifically looking for good books, because it is really hard to find good books on this topic. There are some small articles out there like this one, but still isn't enough knowledge to optimize an algorithm/game...

I hope there is a modern good book out there, that I just couldn't find...

sentences:
Monogame drawing lines above map cells I'm trying to draw 4 lines above map cells as cells access level using this code

VertexPositionColor[] collection = new VertexPositionColor[]
{
    new VertexPositionColor(new Vector3(loc.X + _cellPoints[0].X, loc.Y + _cellPoints[0].Y, 0f), color),
    new VertexPositionColor(new Vector3(loc.X + _cellPoints[0].X, loc.Y + _cellPoints[0].Y, 0f), color),

    new VertexPositionColor(new Vector3(loc.X + _cellPoints[1].X, loc.Y + _cellPoints[1].Y, 0f), color),
    new VertexPositionColor(new Vector3(loc.X + _cellPoints[1].X, loc.Y + _cellPoints[1].Y, 0f), color),

    new VertexPositionColor(new Vector3(loc.X + _cellPoints[2].X, loc.Y + _cellPoints[2].Y, 0f), color),
    new VertexPositionColor(new Vector3(loc.X + _cellPoints[2].X, loc.Y + _cellPoints[2].Y, 0f), color),

    new VertexPositionColor(new Vector3(loc.X + _cellPoints[3].X, loc.Y + _cellPoints[3].Y, 0f), color),
    new VertexPositionColor(new Vector3(loc.X + _cellPoints[3].X, loc.Y + _cellPoints[3].Y, 0f), color),

};

_vertexBuffer = new VertexBuffer(_device, VertexPositionColor.VertexDeclaration, 8, BufferUsage.WriteOnly);
_vertexBuffer.SetData(collection);

Device.SetVertexBuffer(_vertexBuffer);
Device.DrawPrimitives(PrimitiveType.LineList, 0, 4);

but it gives on this error

  An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, COLOR0.

in

Device.DrawPrimitives(PrimitiveType.LineList, 0, 4);

sentences:
how to re-use a sprite in cocos2d-x some times it takes time to create the sprite structures in the scene, I might need to setup structures inside this sprite to meet requirement, thus I would hope to reuse such structures with the game again and again.

I tried that, remove the child from parent, detach it from parent , clean parent with the sprite. but when I try to add the sprite to another scene, it's just wont pass the assertion that the sprite already have parent

did I miss some step ?

add an example:

I have a sprite A which involves of quite a few steps to construct, so I used it in scene A layer A, and then I want to use it in scene A layer B, scene B layer A1  etc..... generally speaking I don't want to reconstruct the sprte again.

sentences:
Multiple clicks required before listener is called I have a screen with multiple stages (pre-game, game, pause) and on the game stage I have a pause button. This is implemented as:

public class PauseButton extends Actor {
    private NumberzGame m_game;
    private TextureRegion m_pauseButton;
    private int m_buttonSize;

    public PauseButton(NumberzGame game, Stage stage, int size) {
        super();

        m_game = game;
        m_buttonSize = size;
        m_pauseButton = createPauseButton();

        setWidth(m_buttonSize);
        setHeight(m_buttonSize);
    }

    @Override
    public void draw(Batch batch, float parentAlpha) {
        Color color = getColor();
        batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
        batch.draw(m_pauseButton, getX(), getY());

        super.draw(batch, parentAlpha);
    }

    private TextureRegion createPauseButton() {
        Pixmap map = new Pixmap(m_buttonSize, m_buttonSize, Format.RGBA8888);
        map.setColor(ColorUtils.colorFromHex(NumberzGame.COLOR_BACKGROUND));
        map.fill();

        int radius = (m_buttonSize / 2) - 4;
        map.setColor(ColorUtils.colorFromHex(NumberzGame.COLOR_SOUND_BUTTON_BACKGROUND));
        map.fillCircle(m_buttonSize / 2, m_buttonSize / 2, radius);
        map.setColor(ColorUtils.colorFromHex(NumberzGame.COLOR_SOUND_BUTTON));

        int width = 2 * radius - 10;
        int height = width;
        int xpos = (m_buttonSize - width) / 2;
        int ypos = (m_buttonSize - height) / 2;

        Pixmap pause = m_game.getAssets().get(NumberzGame.ID_PAUSE_PIXMAP, Pixmap.class);
        map.drawPixmap(pause, 0, 0, pause.getWidth(), pause.getHeight(), xpos, ypos, width, height);

        TextureRegion result = new TextureRegion(new Texture(map));
        map.dispose();

        return result;
    }
}

In the screen class I have the following code to add the pause button to the game stage:

m_pauseButton = new PauseButton(getGame(), m_gameStage, NumberzGame.PLAY_BUTTON_WIDTH);
m_pauseButton.setX(width - NumberzGame.PLAY_BUTTON_WIDTH - NumberzGame.MARGIN);
m_pauseButton.setY(height - NumberzGame.PLAY_BUTTON_WIDTH - NumberzGame.MARGIN);
m_pauseButton.addListener(new ClickListener() {
    @Override
    public void clicked(InputEvent event, float x, float y) {
        m_state = GameState.PAUSED;
        getGame().getWorld().pauseWorld(true);
    };
});
m_gameStage.addActor(m_pauseButton);

When I run the application the first click on the pause button properly pauses the game and after I resume the game, I need to press the pause button twice to have it trigger.

What am I missing here?

sentences:
Emissive material not casting light on itself in Unreal I have a static mesh that has an emissive material applied to part of the mesh. The emissive material successfully cast light to surrounding objects. However, the face of the mesh with the emissive material fails to cast light on the rest of the mesh.

This is how the unlit scene look:

The parts circled blue has the emissive material, and the sphere and cube are both lit by the emissive material. However, the part of the stairs (highlighted in red) does not get lit.

The lit scene:

Is there a way for the stairs to be lit by itself?

sentences: Scale smaller resolution to full resolution libGDX Short question about the scaling in libGDX. At the moment i have a application with the resolution 480x320. I define this in the main method of the desktop launcher. My whole application is now calculating with this resolution. For example is the player 50x50 pixels. How can i now scale my application to, for example, 1920x1080 on android so my player is now not only 50x50? I use a orthographic camera and give the width and height of 480x320 in the constructor.

sentences:
Saving Scores Using Cookies I've recently created a small galiga like game recently using JavaScript and HTML5. I've run into a bit of trouble saving cookies, the cookie saves, but then resets itself when the page is refreshed, my code:

function saveScore() {
 var date = new Date();
  date.setMonth(date.getMonth()+5);
  var expires = "; expires=" + date.toGMTString();
  document.cookie = "score=" + lvl + expires + "; path=/";
}

function loadScore() {

  var cookiearray = document.cookie.split(';');
  for (var i = 0; i < cookiearray.length; i++) {
    var name = cookiearray[i].split('=')[0];
    var value = cookiearray[i].split('=')[1];
    if (name == "score") {
      alert("Prior score found. Loading score...");
      lvl = value;
    }
  }
}

EDIT:
It appears as though I made an error outside of the given code, and reset the level to zero, I fixed this, and everything works well, I apologize for any confusion caused.

sentences:
Why are there no dynamic shadows in UE4? So my problem is that other than for static objects which have baked shadows from building lighting, there are no shadows for movable objects, like those cubes. Neither from the Light source actor, which is stationary, nor from Point lights that are either static or moveable.

I may be wrong but I think it used to have dynamic shadows (or I didn't notice the lack of them until recently). So any ideas how to get dynamic shadows?
Thank you

sentences:
Display a Message Box over a Full Screen DirectX application In our custom assertion handler, I'd like to display a message box asking to see whether or not this failure can be ignored.  However, when our DirectX game is full screen, I can't get the MessageBox function to display above the full screen.

Note: The first parameter to MessageBox is the the HWND used to create the device, and it still does not work.

Is this even possible?

sentences:
How to determine what difficulty is right for the game? I am targeting mass casual audience as I am developing the hyper-casual game. The problem is that I have played Helix Jump and Color Bump 3d and those games have a pretty big difference in difficulty level (well at least for me). They are both considered hyper-casual, both target mass casual audience and both have market success.

If two so similar games have such decent difference in difficulty how to determine that the difficulty of my game is just right? It's easy to say that it's subjective but when you invest so much time in your project you need to have at least some benchmark to work with. How to define this benchmark?

sentences:
XNA game for Xbox360 I learn XNA 4 and made a simple game for Windows. Now i want to run it on Xbox360.
I choose "Create Copy of Project for Xbox360" and build it. After that i have in bin folder two files with extensions .exe and .pdb and Content folder.
How i can run this on Xbox360?

sentences:
Copyright notices on a web game portal I notice that for several games on Kongregate, the copyright notice either uses the author's handle name (login name), the name of the group that produce it or a domain name.

Are all those valid copyright notices?

sentences:
How does raytracing triangle meshes with RTX work internally? Raytracing a huge bunch of triangles the naive way (ie. testing each ray against every single triangle) would be humongously slow, which is why raytracers use optimizations to greatly reduce the number of ray-triangle tests that needs to be done. The most common optimization is to organize the triangles into a tree-like data structure, such as a kd-tree.

How does Nvidia's RTX technology do this internally? It's my understanding (please correct me if I'm wrong) that it, indeed, also uses a tree data structure for the triangles to be raytraced. My question is which part of the rendering pipeline performs this construction of the tree data structure. Is it done on the application side?

But, more importantly, and this is the crux of my question: How are mesh deformations handled? (In other words, triangles that change shape and/or their relative position to each other within the same mesh object.)

It is my understanding that a tree data structure works wonders when raytracing a triangle mesh... as long as the mesh is completely rigid and doesn't deform. If the mesh deforms (triangles change shape and/or their position in relation to each other) the entire tree needs to be rebuilt (because the changed triangles can well end up in completely different locations in the tree).

RTX demos, and especially BF5, show animated human characters (with eg. their clothes being deformed by wind) being shown in raytraced reflections just fine. How is this achieved? Are the tree data structures recalculated on every single frame, or is this done some other way?

sentences:
d3d11 renderqueue multi pass rendering design best practice The goal: issue least calls to d3d11 ImmediateContext and render advanced effects like toon / outline / anything that requires rendering the same vertex buffers with at least two different vertex shader and pixel shader programs efficiently by sorting opaque drawcalls front to back and transparent drawcalls back to front.

What I did: Abstract calls to d3d11 immediate context by a DrawCall struct that acts as a gpu command recorder. A call to DrawCall.SetIndexBuffer will create a c# Action that will issue a call on the ImmediateContext upon invoke call. The DrawCall internal gpu command list is sorted the following way: set shaders, set constantbuffers, set blendstate, set stencilstate, set vertexbuffers.... I am using sharpdx and c#.

My problem: I use a 64bit sortkey for my gpu commands. When rendering complex effects like outline or anything that requires state changes to outputmerger the whole idea with sorting doesn't seem right... example: I render opaque objects first and then transparent objects... I want to render an object opaque with a diffuse shader and it should have a red transparent outline. For this effect I have to modify stencil and blend states in between drawindexed calls. According to my sortkey those gpu commands are on different draw loops opaque<>transparent but the stencilstate requires both drawindexed calls to be one after another.

Should I implement a chained gpu command for multipass rendering or are there better ways to handle such effects?

sentences: Which 2D rendering algorithm is the most suited for mobile devices? Which 2d rendering algorithms are popular for mobile game engines (specifically Android) and why? Are the same ones for the desktop and/or console world as effective here?

sentences:
Unity ScriptableObject Conversation Dialogue and Reading I'm unsure as to how I would reference a scriptable object's variables within a struct from another class. I know I'd have to make a public Conversation, but I'm stuck understanding how I could access it's struct, and how I could access individual variables such as the Position, or line string array.
Is this method even viable or should I look at creating a different way of accomplishing a dialogue conversation scriptable object?
Thanks for any insights and help~
My current code:
[System.Serializable]
[CreateAssetMenu(fileName = "New Conversation", menuName = "Create/Conversation", order = 1)]

public class Conversation : ScriptableObject
{
    [System.Serializable]
    public struct LineData
    {
        public string[] line;
        public string[] option;

        public enum Position
        {
            BottomLeft,
            BottomCentre,
            BottomRight,
            MiddleLeft,
            MiddleCentre,
            MiddleRight,
            TopLeft,
            TopCentre,
            TopRight
        }

        public Position position;

        public enum TextSpeed
        {
            Normal,
            Slow,
            Fast,
            UltraFast
        }

        public TextSpeed textSpeed;

    }
    public LineData[] Line;

}

```

sentences:
Communication in a simple GUI (C++ / SDL2) I've spent a few months now working on a fairly simply 2D game engine with SDL and C++. I'm now trying to develop a simple but well-featured GUI suitable for most games.

Right now I'm really struggling on figuring out how I should handle communication between the GUI and the other parts of the game / engine that might want to use it.

For example, the "shop" game state may have a list of items that I want to display on a shop GUI, along with their prices and quantities, i.e "Wooden sword / 30GP / 5". Obviously I need to get this information to the GUI in order for it to be useful, along with a way of notifying the shop component which item has been clicked/given focus. Seeing as the internal representation of an object such as an "item" or an "inventory" can vary wildly, how do I get the data I want to/from the GUI in a way that doesn't require excessive coupling between the two components?

I'd really appreciate anyone's advice on how to approach this issue, and I fully appreciate that my understanding is flawed.

Finally, I'm set on developing it from the ground up as a learning exercise, so I'm not really interested in GUI libs for SDL (it seems none of them are updated for SDL2 anyway).

Thanks in advance

sentences:
Making plane with quad I'm a beginner Unity 3d developer. I want to keep quads one aside another touching each other and use that as a road for making an endless runner game. The problem is each of the quads have their own box collider thus the car bounces a little bit sometimes.

Is there any way to get those stuff connected with each other and make the whole thing behave like a single plane?

I know using a big box collider covering all the quads in the repeating unit is gonna work but I don't want to use that.

sentences:
Hill-jumping game mechanic like Tiny Wings I'm a huge Tiny Wings fan and I'd like to understand the game mechanic at a deeper level. What are some good resources for the basic Box2d (or similar) physics behind the hill-jumping game mechanic?

I've used some basic features of Box2d. I imagine the flying character is just a circle, tapping the screen increases the downward force on the character, and the hills are some sort of curve object from the physics engine.

Edit #1 Here's more info: I'd like to understand which objects from the Box2d physics library are used to create the bare-bones hill-jumping mechanic. This mechanic would look like a "curvy" horizontal line that just scrolls across the screen. The most basic shape for this line that comes to mind is a sine wave so that's probably a good starting point.

Then there's the character that moves around. Note the character's horizontal position is fixed while the vertical position moves up and down. I'm curious about which Box2d body shape, type etc is used for this character. What are some values for the coefficient of friction that work well? How about the density etc.

I've searched around the web for tutorials that ideally will answer the above questions and perhaps provide additional resources regarding efficiency, camera motion and so on.

sentences:
Workaround for reading and writing same texture? To apply post effects, it is often needed to read the preliminary image, perform computations on its pixels and store the result in the same texture again. For example, think of a tone mapping or desaturation effect. The input and output should be the same texture, but this isn't allowed by OpenGL.

Therefore, what is a good workaround?

One idea I came up with but which isn't very satisfying is to have two image textures and automatically use them alternating. Also keeping track of which is the newer one to finally display it on the screen.

sentences: Unity - Create terrain in Blender? I am going to make a terrain ( not too big ) for my RTS and I was wondering whether to use Unity's terrain tool or create a terrain in Blender and import it to Unity?..I have been told that Unity's terrain is intense work for the mobile GPU..So would it be any good to make the terrain in Blender ( in terms of performance )?

sentences:
Level progression grid/chart What I'd like to do is create a sheet where I can track character XP/level progression.

I created this by hand:

It's sloppy, but in the realm of what I'd like to generate on a computer. Each bar represents XP needed to level up, with each square on the grid representing a set number of XP.

Any ideas how I could go about doing this in a more standardized/repeatable/printable?

sentences:
Strange I'm getting exception but the scripts in the exception message are not exist on my pc. What should I do? I'm using unity version : 2019.2.5f1 personal

I searched on my hard disks the entire pc and none of the scripts in the exception message are exist. And the exception is happens only sometimes. When I stop the game in the editor by pressing the play button the exception is show sometimes and sometimes not.  I tried to close and open over agai the unity editor and the project. Still strange.

  MissingReferenceException: The object of type 'ReflectionProbe' has been destroyed but you are still trying to access it.
  Your script should either check if it is null or you should not destroy the object.
  UnityEditor.ReflectionProbeEditor.OnPreSceneGUICallback (UnityEditor.SceneView sceneView) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ReflectionProbeEditor.cs:651)
  UnityEditor.SceneView.CallOnPreSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3359)
  UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1935)
  UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2320)
  System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
  Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRChainBuilder.cs:238)
  UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:66)
  UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:54)
  UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:72)
  UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:637)
  UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
  UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
  UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

sentences: Behavior trees - Can sequences and selectors contain conditions? I can't wrap my head around this. Is it legal for parent nodes to contain additional logic ?

sentences:
Shadows shimmer when camera moves I've implemented shadow maps in my simple block engine as an exercise. I'm using one directional light and using the view volume to create the shadow matrices. I'm experiencing some problems with the shadows shimmering when the camera moves and I'd like to know if it's an issue with my implementation or just an issue  with basic/naive shadow mapping itself.

Here's a video:

http://www.youtube.com/watch?v=vyprATt5BBg&feature=youtu.be

Here's the code I use to create the shadow matrices. The commented out code is my original attempt to perfectly fit the view frustum. You can also see my attempt to try clamping movement to texels in the shadow map which didn't seem to make any difference. Then I tried using a bounding sphere instead, also to no apparent effect.

    public void CreateViewProjectionTransformsToFit(Camera camera, out Matrix viewTransform, out Matrix projectionTransform, out Vector3 position)
    {
        BoundingSphere cameraViewFrustumBoundingSphere = BoundingSphere.CreateFromFrustum(camera.ViewFrustum);

        float lightNearPlaneDistance = 1.0f;

        Vector3 lookAt = cameraViewFrustumBoundingSphere.Center;

        float distanceFromLookAt = cameraViewFrustumBoundingSphere.Radius + lightNearPlaneDistance;
        Vector3 directionFromLookAt = -Direction * distanceFromLookAt;
        position = lookAt + directionFromLookAt;
        viewTransform = Matrix.CreateLookAt(position, lookAt, Vector3.Up);

        float lightFarPlaneDistance = distanceFromLookAt + cameraViewFrustumBoundingSphere.Radius;

        float diameter = cameraViewFrustumBoundingSphere.Radius * 2.0f;

        Matrix.CreateOrthographic(diameter, diameter, lightNearPlaneDistance, lightFarPlaneDistance, out projectionTransform);

        //Vector3 cameraViewFrustumCentroid = camera.ViewFrustum.GetCentroid();

        //position = cameraViewFrustumCentroid - (Direction * (camera.FarPlaneDistance - camera.NearPlaneDistance));
        //viewTransform = Matrix.CreateLookAt(position, cameraViewFrustumCentroid, Up);

        //Vector3[] cameraViewFrustumCornersWS = camera.ViewFrustum.GetCorners();
        //Vector3[] cameraViewFrustumCornersLS = new Vector3[8];
        //Vector3.Transform(cameraViewFrustumCornersWS, ref viewTransform, cameraViewFrustumCornersLS);

        //Vector3 min = cameraViewFrustumCornersLS[0];
        //Vector3 max = cameraViewFrustumCornersLS[0];
        //for (int i = 1; i < 8; i++)
        //{
        //    min = Vector3.Min(min, cameraViewFrustumCornersLS[i]);
        //    max = Vector3.Max(max, cameraViewFrustumCornersLS[i]);
        //}

        //// Clamp to nearest texel
        //float texelSize = 1.0f / Renderer.ShadowMapSize;
        //min.X -= min.X % texelSize;
        //min.Y -= min.Y % texelSize;
        //min.Z -= min.Z % texelSize;
        //max.X -= max.X % texelSize;
        //max.Y -= max.Y % texelSize;
        //max.Z -= max.Z % texelSize;

        //// We just use an orthographic projection matrix. The sun is so far away that it's rays are essentially parallel.
        //Matrix.CreateOrthographicOffCenter(min.X, max.X, min.Y, max.Y, -max.Z, -min.Z, out projectionTransform);
    }

And here's the relevant part of the shader:

if (CastShadows)
{
    float4 positionLightCS = mul(float4(position, 1.0f), LightViewProj);

    float2 texCoord = clipSpaceToScreen(positionLightCS) + 0.5f / ShadowMapSize;

    float shadowMapDepth = tex2D(ShadowMapSampler, texCoord).r;

    float distanceToLight = length(LightPosition - position);

    float bias = 0.2f;

    if (shadowMapDepth < (distanceToLight - bias))
    {
        return float4(0.0f, 0.0f, 0.0f, 0.0f);
    }
}

The shimmer is slightly better if I drastically reduce the view volume but I think that's mostly just because the texels become smaller and it's harder to notice them flickering back and forth.

I'd appreciate any insight, I'd very much like to understand what's going on before I try other techniques.

sentences:
Why is an empty Unity Iphone Build over 700 Megs? Is this Normal? So after 2 weeks of slaving over my first game I was finally done! I was entirely ecstatic....until I saw its file size.
770 Megabytes
For a simple numbers game, that was way too much and I created an empty unity project as a test and that was also over 700 megs
Why is an empty Iphone project this large?

sentences:
Can I Create A Windows Package to Submit to the Window Store using the Mac Version of Unity 5.3? Note: New to App Development.

I'm using a Mac for building my three 3D puzzle apps with Unity 5.3.2. I want to create Windows versions to sell in the Windows Store. I attempted to transfer the package for one of our apps to the Windows version of Unity but it was a pure hot mess. A lot of the alignment of text and images was skewed really bad. We have not used Windows in approx. 10 years so for all practical purposes we are brand new Windows users. The last OS we used was XP. The laptop we just purchased runs Windows 10 Home.

I can create a Windows executable (.exe) file from the Mac version of Unity that executes my 3D puzzle app perfectly just like the Mac version. However I found out that I had to submit a special package to the Windows Store. The instructions that I found so far for this assumes that you are using the Windows version of Unity.

I do not plan to be a full time app developer so the idea of trying to learn Visual Studio for me is a waste of my time. I would prefer creating the Windows package for the Windows Store using the Mac version of Unity. Is this possible? I could not find instructions in the manual or from search on what options need to be set to do this. I'm thinking it can be done since I was able to create a Windows exe file using my Mac version of Unity. I would like to create Windows Store packages for both 8.1 and 10.

sentences:
How can I launch Visual Studio via a double-click on a C# script in Unity? This is my first time using Unity and I am following the tutorial for the 2D RogueLike Game. Everythings seems to be working properly, apart that I cant get Visual Studio to launch, if I'm double click my c# scripts.

What I have tried so far:

Checked my preferences, that External Script Editor says "Visual Studio 2017"
Reinstalled Unity and Visual Studio.

Unity Version: 2019.3.0a2 Personal

Hope somebody can help me.

Additional information:

After double click, nothing seems to be happening, even my mouse doesnt show a load icon
When I create a new project, the bug (dont know if bug, or my fault) is still there.
I can open the .sln file from my project in Visual Studio. Visual Studio can even autocomplete unity based code then, before it was a "miscellaneous file" and didnt autocomplete code like for example "Transform" or "Rigidbody2D".

sentences:
How could I implement programming as a mechanic? I am wondering how I could manage to execute programs made by players in my game via some sort of in-game computer. I have been trying to figure it out but I have no idea how it is even possible.

Examples of other games that do this are:

ComputerCraft
Space Engineers
Screeps
Glitchspace

I just need a basic explanation of how I could do it so I can start making my own games with in-game coding as a mechanic.

sentences:
Letting the player create a combination of any 4 items that the game will then give the player on a set timer Okay, so I've researched scriptable objects and I've realized that it's something that might be very useful for the kind of game I'm making. I've managed to create my own scriptable object for weapons that is able to hold weapon upgrades, range, damage, and other special stuff. I was told scriptable objects are much better for larger scales than enums so that I can hold data for each weapon. I do know how to implement them into
 [CreateAssetMenu(fileName = "New Weapon", menuName = "Weapon")]
 public class Weapon : ScriptableObject
 {
     public new string name;
     public string _discription;

     public Sprite _artwork;

     public int _range;
     public int _damage;
     public int _upgrades;
     public int _element;

     public void Print()
     {
         Debug.Log(name + ": " + _discription + " The weapon does:  " + _damage + "damage.");
     }
 }

I've researched how to show these on the UI, but is there any hint you could give me on getting scriptable objects working with an inventory system, and point me in a direction on how I can give the player control of the order of weapon in the inventory that the game will use to give said weapons in the same order the player set for themselves.
For Example, I want the player to be able to take any of the four weapons: Katana, Spear, Axe, Chakram, and be able to set them in any order. Even using multiple of itself. Eg. (Chakram, Spear, Spear, Axe) and then the game will then give the player the items list they created on a set timer. (Weapons are one-time use, and the player can only hold one weapon at a time, and the timer won't start until the player has used up their current weapon)
 public class Weapon
 {
     public WeaponType type { get; set; }
 }

 public enum WeaponType
 {
     Katana,
     Axe,
     Spear,
     Chakram
 }
 public class WeaponCycle: MonoBehaviour
 {
     [SerializeField] private Weapon[] _weapon;

     public Weapon[] weapons = new Weapon[4];

     List<Weapon> InventoryWeapons = new List<Weapon>();

     // Start is called before the first frame update
     void Start()
     {
         for (int i = 0; i < weapons.Length; i++)
         {
             weapons[i].type = (WeaponType)Random.Range(0, 3);
         }

         StartCoroutine(GiveWeapons(1));
     }

     IEnumerator GiveWeapons(float delay)
     {
         for (int i = 0; i < weapons.Length; i++)
         {
             yield return new WaitForSeconds(delay);
             InventoryWeapons.Add(weapons[i]);
         }
     }
 }

Sorry if it feels like I'm asking for too much, but I'm a beginner when it comes to C# and I'm trying to learn as efficiently as I can.

sentences:
In Unity, what's a better solution than having a bunch of singleton static managers? (SceneManager, UIManager, SfxManager, PfxManager) I always hand a bunch of public static manager classes in my game:

GameManager (singleton) for reading and writing persistent data and gamestate across scenes
SceneManager for holding scene data (coins picked up, score, are we in a cutscene)
UIManager for dealing with HUD stuff
SfxManager for sound effects
PfxManager for particle effects

On the gameobject that holds these manager classes, there are also subordinate classes (e.g. HUDManager, a smaller class that managers tasks specific to HUD, and then delegate those tasks into other smaller scripts) in order to avoid monolithic manager classes.
Is this method frowned upon in Unity game development and if so, what are some better solutions than this approach?

sentences:
Defining collision response in an Entity system I'm building a really simple top-down 2d shooter which uses an Entity Component pattern.

I've added several different entities to a level and given them different collision groups. I have an entity to represent a teleporter (assigned to collision group A), a player entity (group B), and a bunch of enemies (Group C).

I understand that the actual collision response should be decided in the collision System based on the groups that the colliding entities belong to. What I can't figure out is how to define the specifics of a collision.

For example, if a player collides with a teleporter I need to move the player across the level. Where do I store the target location? I'd assume in a component on the teleporter. Should I create a whole new component just for that data? I feel it should be stored in the teleporters collision component but no all entities that use the collision component will require this data.

Could someone please try to enlighten me?

Thanks

sentences:
Directional light shader not behaving as expected I coded my first glsl shader which manage diffuse and specular effects of a directional light.
This is the fragment shader.
#version 120

//matrix
uniform mat4 model_matrix;

//directional light position in world coordinates
uniform vec3 light_position;
uniform vec3 eye;

//send to fragment shader
varying vec4 color;
varying vec4 normal;
varying vec4 vertex;

void main()
{

    float light_diffuse_intensity;
    float light_specular_intensity;
    float light_mod;

    vec3 world_normal;
    vec3 world_vertex;
    vec3 world_reflec;
    vec3 vertex_to_light;
    vec3 vertex_to_eye;

    world_normal = (model_matrix * normal).xyz;
    world_vertex = (model_matrix * vertex).xyz;

    vertex_to_light = light_position - world_vertex; //vector from vertex to light
    vertex_to_eye = eye - world_vertex; //vector from vertex to eye
    world_reflec = 2 * dot(vertex_to_light, normalize(world_normal.xyz)) * normalize(world_normal) - vertex_to_light; //reflection of vertex_to_light

    light_diffuse_intensity = dot(normalize(vertex_to_light), normalize(world_normal.xyz)); //computing angle between light and normal
    light_specular_intensity = dot(normalize(vertex_to_eye), normalize(world_reflec)); //computing angle between eye and reflection

    if (light_diffuse_intensity > 0){
        light_mod = light_diffuse_intensity;
        light_specular_intensity = pow(light_specular_intensity, 8.0);
    }
    else{
        light_specular_intensity = 0;
    }

    gl_FragColor = vec4(mix(color.rgb * light_diffuse_intensity, vec3(1.0,1.0,1.0), light_specular_intensity), 1.0);

}

As you can see from the screenshot below, in the first screen, where I look at the sphere from the direction of the light, the border of the sphere is white because of the specular effect. However if the shader were correct it should not look like that. It should be white only in the middle of the sphere.
In the second screen, I look at both the sphere and the source of the directional light (the yellow sun) and everything looks just fine.
I cannot find the error in my shader, could someone help please?
Thank you very much!

sentences:
How rotate a 3D cube at its center XNA? I try to rotate a 3D cube on itself from its center, not the edge.
Here is my code used.

public rotatemyCube()
{
    ...
    Matrix newTransform = Matrix.CreateScale(scale) * Matrix.CreateRotationY(rotationLoot) * Matrix.CreateTranslation(translation);
    my3Dcube.Transform = newTransform;
    ....

public void updateRotateCube()
{
    rotationLoot += 0.01f;
}

My cube rotate fine, but not from the center. Here is a schematic that explains my problem.

And i need this:

sentences:
Crash due to removal of Elements like CCSprite from NSMutableArray So, here's how it goes.

I am currently working on Cocos2d game, which consists of many Obstacles. One obstacle gets added on the screen at an interval of 10 seconds like this.

ObstacleSprite* newObstacle = [ObstacleSprite spriteWithFile:@"Obstacle.png" rect:CGRectMake(0, 0, 20, 20)];
newObstacle.position = ccp(mainPlayer1.position.x,10);
[self addChild:newObstacle];

[self.arrayForObstacles addObject:newObstacle];

Now, I insert these obstacles into the arrayForObstacles because I also want to keep checking whether the Obstacles and MainPlayer don't collide.

I check it with the help of this function.

- (void) checkCollisionWithObstacle
{
    if(mainPlayer1.playerActive)
    {
        for(int  i = 0; i < [self.arrayForObstacles count]; i++)
        {
            ObstacleSprite* newObstacle = [self.arrayForObstacles objectAtIndex:i];
            if(newObstacle != nil)
            {
                if(CGRectIntersectsRect([mainPlayer1 boundingBox], [newObstacle boundingBox]))
                {
                    mainPlayer1.livesLeft--;
                }
            }
        }
    }
}

THE ISSUE

Problem is when I get to certain score, one of the Obstacles gets deleted. Removal of Obstacles works as in First In-First Out (FIFO) mode. So, to delete obstacles, I write the following method :

- (void) keepUpdatingScore
{
    //update new score
    mainPlayer1.score+=10;
    //remove obstacle when score increases by 5k
    if(mainPlayer1.score > 5000 && mainPlayer1.score > 0)
    {
        mainPlayer1.playerActive = NO;

        if([self.arrayForObstacles count] > 0)
        {
            CCLOG(@"count is %d",[self.arrayForObstacles count]);
            ObstacleSprite* newObstacle = [self.arrayForObstacles objectAtIndex:0];
            [self.arrayForObstacles removeObjectAtIndex:0];
            [self removeChild:newObstacle cleanup:YES];

            CCLOG(@"count is %d",[self.arrayForObstacles count]);
        }
    }
    else
    {

    }
}

It crashes when score crosses 5000 mark!

UPDATE

Crash happens when it again goes to the method checkCollisionWithObstacle.

This is the THREAD Look.

THis is the line Which crashes.

sentences:
OpenXR device not present in Start or Awake methods in Unity C# script I'm developing a VR game using OpenXR in Unity (specifically developing on a Valve Index). When I try to access the input devices through the InputDevices.GetDevices() function, I get 0 devices back when I call this function from my script's Awake() or Start() methods. But when I call the same function from my script's Update() method, I see all the devices (e.g. head set, left controller, right controller).
Why can't I see the devices in the Awake() or Start() methods?

sentences:
Best way for first person view to look at a note/item and add it to inventory? Implementation question from a beginner. I would like to implement a functionality to a first person game where the player can pick up notes lying around and have the note align itself to the camera and get bigger for the player to read its contents. The game will have a Myst like feel to it.

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

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

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

Any suggestions ?

Thank you

sentences: Can flixel or a similar engine be used with reddwarf server? I like the sgs/projectdarkstar or now known as reddwarf server for a back end game server.  However I am looking for a good front end, preferably 2D.  I was thinking of something such as flixel.  I know there is an AS3 library available for reddwarf, so I am hoping someone already has connected up flixel or a similar engine?   Or if you have a recommendation for another easy client side engine that will connect to reddwarf?

sentences:
How to increase the selectable size of an object for dragging I am currently dragging a gameobject like this.

   Vector3 screenSpace;
   Vector3 offset;
   void OnMouseDown(){

 //translate the cubes position from the world to Screen Point
 screenSpace = Camera.main.WorldToScreenPoint(transform.position);
 //calculate any difference between the cubes world position and the mouses Screen position converted to a world point
 offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y, screenSpace.z));
 }

  private float speed = 7.5f;

  void OnMouseDrag(){
     Vector3 curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y,    screenSpace.z);
     Vector3 curPosition =  Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;
     transform.position = curPosition;
 }

Sometimes a user doesn't click directly on an object so is there a way that if a user is between 3-7 pixels off, it still counts as a click and drag? Any help is appreciated.

sentences:
demographics of paying mobile gamer I was googling for this now for a while but didn't find any relevant data.

Does someone know any statistics of the demographics of mobile gamers that actually spend money on their games? It's clear that this data may vary over different genres but any kind of analysis in this direction would be interesting for me.

sentences:
Collisions between mesh (bounding-box) and Vertex/Index Buffer I have a short Question:
I'm trying to add Collisions in my 3D DirectX9 game and my World is Stored in a LPDIRECT3DVERTEXBUFFER9 and LPDIRECT3DINDEXBUFFER9 and Rendered per DrawIndexedPrimitive. My Player is a LPD3DXMESH loaded from a .X file. Now I want to detect Collisions between the two! How can I do that? After some research I could only find Collisions between Bounding Boxes and/or Rays!

Apologise my bad English, I'm German! :-)
Hope for fast reply!

sentences:
Can you achieve a non-square look with tiles or a similar technique? Just to explain the kind of look that is refered to in the question, it is apparent in the game Toejam and Earl 2.

Not asking how this was made but would like to know how you could efficiently blit a level design that isn't made or doesn't appear to look like easily identifiable square tiles. Another example for a "non-blocky" world would be worms but that looked more like a bitmap which sounds like it would require a lot of memory and could potentially limit the game world size.

sentences:
Creating models in 3ds max and exporting as .x for XNA I have created a few models in 3DS max which contains textures, geometry and animations . .however .fbx doesnt really support textures.. So im planning to use .x format.. I have seen a few converters in pandasoft but once i unzip the file and place the .dle file in the plugins folder of 3D max gives an error saying failed to initialize..
Is there any way to convert my .max models into .x format ? ? I dont know blender so that isnt an option. . I'm currently using 3ds max 2013

After adding the .3DS object content importer. . i get the following error:

.3Ds files along with the solution

sentences:
Select Unity Prefab from enum choice After a couple tries, I still haven't found any solution to this problem of mine.

Currently, I have a script inheriting from MonoBehavior which creates a map with Perlin Noise. Let's call it mapGenerator.
It instantiates a HexTile object from another script, which does not inherit from MonoBehaviour, that contains a refere to my terrain prefab and an enum value which says its type (so water, grass, wood, etc.). There is an array declared at the beginning of the script that I manually change as I'm adding terrains.

Everything works fine except when tweaking the map generation, If I want to change some values for perlin intervals, I might have to add another value to my HexTile[] and then drag my terrain prefab and set the enum value.

What I want is to know if there is a way to make the script select a prefab depending on the value the enum was set to.

Here is the code (simplified):

public class ProceduralTerrainGenerator : MonoBehaviour
{
public bool regenerateMap = true;

public Hextile[] hexTiles;

void Update()
{
    CreateMap();
}

private void CreateMap()
{
    // Some code for Perlin Noise generation inside perlinMap[,]
    for (int i = 0; i < mapLength; i++)
    {
        for (int j = 0; j < mapHeight; j++)
        {
            // Setting up position from i and j index
            foreach (HexTile hexTile in hexTiles)
            {
                if (ValueInRange(perlinMap[i,j], hexTile.LowLimit, hexTile.HighLimit)
                {
                    Instantiate<HexTile>(hexTile.tile, position, Quaternion.Euler(0f, 0f, 0f), this.transform);
                }
            }
        }
    }
}
}

and my other script

[System.Serializable]
public class HexTile
{
    public GameObject tile;
    public HexMetrics.HexType hexType;
    public float perlinNoiseLowLimit;
    public float perlinNoiseHighLimit;
}

=========== EDIT 1 ===========

I tried simplifing my problem, because I'm more interested in the concept, but here are more details.

I have a class named HexSettings, which contains the hex prefab (HexTile) named tile, its HexType, and the perlin noise bundaries.

[System.Serializable]
public class HexSettings
{
    public HexTile tile;
    public HexMetrics.HexType hexType;
    public float perlinNoiseLowLimit;
    public float perlinNoiseHighLimit;
}

Here is the HexType enum contained inside HexMetrics

public class HexMetrics
{
    // Hex metrics data for placement in grid data

    public enum HexType
    {
        GRASS,
        FOREST,
        WATER,
        SNOW,
        DESERT,
        LAKE
    }
}

What I would like is to have some soprt of dictionnary that contains the correct prefab according to the selected HexType.

As you can see in the image below, I can set my HexType to my terrain types, but I also have to set the HexTile object manually, where it could be set automatically according to the HexType value set. That is what I'm looking for.

I tried adding it in a dictionnary (something like Dictionnary<Hextype, HexTile>), looking for prefabs in my folder prefab with Resources.LoadAll<HexTile>("prefab");, no success, prefabs couldn't be loaded in HexSettings.

sentences:
Collision detection in SFML I am building a simple 2D game with SFML and have a GameState object that contains a Plane and a vector of Enemies. THe plane is represented by a triangle and the enemies by a rectangle. The plane object has bullets and I am wondering what is the most appropriate way of handling collision between the bullets and the enemies. The structure of the code is the following :

 GameState
    /\
   /  \
Plane Enemies
  /
Bullets

Every object has Render and Update and possibly HandleInput methods. The way I think that this could work is if I pass the enemies vector to the plane's update method which in turn calls the bullets update method and there I do the check. Is this ok ? Is there an easier and more solid method of doing it ?

sentences:
Problems making my basketball bounce around horizontally This is probably a very easy question, but I can't seem to understand why it's not working.

I want the basketball to bounce horizontally when it touches the borders on the right and left, but when it bounces on the right, it seems to go just a little bit further than it should.

Any suggestions?

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    basketballPosition.X += ballSpeed;
    if (basketballPosition.X > Window.ClientBounds.Width - basketball.Width || basketballPosition.X < 0)
    {
        ballSpeed *= -1;
    }

    base.Update(gameTime);
}

And my Draw method:

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

        spriteBatch.Begin();

        spriteBatch.Draw(basketball,
                         basketballPosition,
                         null,
                         Color.White,
                         0,
                         Vector2.Zero,
                         1.5f,
                         SpriteEffects.None,
                         0);

        spriteBatch.End();

        base.Draw(gameTime);
    }

Edit The problem was I was using a scale of 1.5f for drawing the image. Can someone explain how I would get the true border of the image if I were using scale? It seems the border stay as the original size, but the texture is drawn to whatever scale I choose.

sentences:
ThreadAffinity being changed by OpenGL / ChoosePixelFormat If I change thread affinity and then create the window used in my OpenGL game it changes the thread affinity to something else. I tracked down the exact API call (ChoosePixelFormat) which changes it by calling setThreadAffinityMask after and before all the API calls. Strangely enough it is only the first call to ChoosePixelFormat which exhibits this behaviour. Is this when the OpenGL driver initializes itself and perhaps changes the thread affinity?

Has this been seen by anyone else and is there a reason why it is happening? For what it's worth I have a Radeon 290.

sentences: What server architecture should I use for matchmaking in Node.js? I'm making a board game in which users register for a game which will start at fixed time and users can register till the start of the game. My initial idea was to use it with socket.io(connection sets up when user opens up the app and use same socket for gameplay) with Redis adapter and fire start game event from outside the context of sockets (using redis adapter and separate process). But my friend suggested to use ws with in-memory state management(for making stateless and not use socket.io for performance) and use polling for showing registering tournaments. Can you please help me with if I'm missing out anything ?

sentences:
How to Fill the Gap Between Camera Clip Plane And Skybox? I'm talking about the brown-greyish area i marked with blue. How can i fill it with something that does fit the environment?

I'm looking for a solution like this plugin.

sentences:
Mix multisample and non multisample rendering in Directx11 is there a way to mix multisample and non multisample rendering in Directx11?
It seems that when I create a multisampled render target I always get a multisampled rendering, regardless of the value of the MultisampleEnabled flag of the RasterizerDescription.

Microsoft says:

"To use multisampling, set the enable field in the rasterization description, create a multisampled render target, and either read the render target with a shader to resolve the samples into a single pixel color or call ID3D11DeviceContext::ResolveSubresource to resolve the samples using the video card."

and also

"There are no restrictions for mixing multisampled and non-multisampled rendering within a single render target."

But then in the rasterizer description page it says:

"
 For feature levels 10.1 and higher, the setting of MultisampleEnable has no effect on points and triangles with regard to MSAA and impacts only the selection of the line-rendering algorithm as shown in this table...

"

So, how can I temporarily turn multisampling off on a multisampled render target, in order to draw part of the scene without multisampling?

sentences:
Techniques for incorporating physics engines like Box2D into a Component-based Entity System Currently i'm working with my own physics engine, however given the fact that the emscripten ports have gotten incredibly good, i wanted to try and incorporate Box2D into my entity system for the next project (and Bullet for future ones). Currently though, my own physics engine works on components directly, like Position (x, y), Dynamic (mass, velocity, drag) or Collidable (friction, restitution), which allows the user to pick an choose what kind of a body the entity is dynamically and fiddle with the variables directly, this isn't possible with Box2D, so i'll somehow have to create a component out of the Box2D objects.

Do you guys have any experience with this? Incorporating OOP engines like Box2D or Bullet seems daunting when i try to think about it, for example the physics component would hold the position, so my rendering system would require a physics component, which isn't desirable, since not every sprite i render is a physics object, etc. To solve issues like these, i thought about just creating a Position component and having the rendering system hold entities with a Position or Box2DBody and Sprite components, but i'm not sure if this is the most robust solution. I'd love to hear some input from people that have experience with these things.

EDIT: This isn't just for Javascript, the question should be language agnostic.

sentences:
Coordinate system for a strategy game I am working on a personal project of developing a simple 3D strategy game. I am working on my own game engine (let's assume that I have to have my own) and I have one theoretical question. How to develop a suitable coordinate system, which would be scalable and provide the best versability?

I am deciding between a X,Y coordinate system (different units cover different space - simply rectangle shaped) and a hexagonal system (bigger units take more hexagons).

I am working here with a simple concept of three different units of three different sizes for every player (maybe even buildings) and collision detection with conflict resolution. Thanks.

sentences:
Unity + UMA Power tools 2.10 - issues with saving prefabs I just got familiar how to work with UMA 2 and I personally would like to use those characters as prefabs so bought the power tools package as well.
I managed to figure out how to save the dcs to prefab but prefab is missing the mesh. Any idea what I'm missing? Downloaded UMA 2 + power tools today so I don't think that it's version issue as well.
Screenshot from unity added
characters should be the same

Thanks already in advance!
Steps to reproduce:

install uma 2 + uma 2 power tools assets
Create new scene
Drag UMA_DCS and UMADynamicCharacterAvatar prefabs to scene from UMA/Getting Started
Modified the UMADCA to be human female with no wardrope
Press play from unity
Click the UMADCA to be active
From menu press UMA -> Powertools -> Save Characters Prefab
Choose location
Drag newly created prefab to scene
Result is empty character with needed assets (textures etc)

sentences:
Unity both duration and cooldown system I have a boss with machine gun and i am trying to make him shoot for 5 seconds and then stop for 5 seconds and so on. I tried to create an IEnumerator and call it on Start (as far as i know i can not call it from update) but its not the behaviour i want as i always want him to start shooting when he spots the player. Any help is appreciated.

IEnumerator MachineGunShootTimer()
{
    while(true)
    {
        machineGunOnCooldown = false;
        yield return new WaitForSeconds(3f);

        machineGunOnCooldown = true;
        yield return new WaitForSeconds(3f);

    }

}

sentences:
How to draw a curved line in Box2d? I need to draw a curved line, I have searched the Internet but found nothing that would suit my needs.

I used b2ChainShape but it's not completely what I need.

How can I draw a curved line with Box2d?

sentences:
Flare fading when moving camera I have been trying to do a sun in Unity 3D. I have used a sphere with a texture and a flare.

The problem is that when I move the camera the flare fades until it disappears when the sun is almost out of view, as shown in the image:

I've tried changing the fade value fron the flare but I can't see any difference.

Does anybody know if this is a normal behaviour or if it can be fixed so the flare is always the same as long as the sun is in view?
Thank you!

sentences:
Which unit test framework for c++ based games? Which combination of testing tools do you feel is best?
Given the framework / library of your choice you might consider:

suitability for TDD
ease of use / productivity
dealing with mock objects
setup with continuous integration
error reporting

Note: While this is potentially a generic question like the one on SO I would argue that game development is usually bound to a specific work flow which influences the choice for testing. For a higher-level perspective, see question Automated testing of games.

sentences:
Greenfoot java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 When an enemy comes into contact with the hero the hero class is supposed to remove the enemy class with the same X and Y. It works the first time but throws an error immediately after that:

  java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
          at java.util.ArrayList.rangeCheck(ArrayList.java:653)
          at java.util.ArrayList.get(ArrayList.java:429)
          at Hero.checkCollision(Hero.java:39)
          at Hero.act(Hero.java:23)

public void act()
{
    ...
    checkCollision();
    ...
}
private void checkCollision()
{
    Actor 2 = (Actor)getWorld().getObjects(2.class).get(0);
    if(2.getX() == getX() & 2.getY() == getY()) {
        getWorld().removeObject(2);
    }
    Actor 1 = (Actor)getWorld().getObjects(1.class).get(0);
    if(1.getX() == getX() & 1.getY() == getY()) {
        getWorld().removeObject(1);
    }
    Actor 3 = (Actor)getWorld().getObjects(3.class).get(0);
    if(3.getX() == getX() & 3.getY() == getY()) {
        getWorld().removeObject(3);
    }
      if (Room.totalPeeps == 0) {
          setLocation(250,250);
          GreenfootImage img = getImage();
          img.setFont(img.getFont().deriveFont(30f));
          setImage(new GreenfootImage("YOU WIN!!" , 75, Color.WHITE, Color.BLACK));
          Greenfoot.stop();
    }
}

sentences:
Collision detection for multiplayer game with MatterJS We are developing JavaScript multiplayer top down game where characters can move freely and collide with each other. We are rather weak at mathematics and physics, luckily we don't need much, just some basic movement & collision mechanics.

After a lot of struggle and failures with custom collision mechanics we decided to use MatterJS library. That works like a charm when character collides with static object (like a wall). However when two characters meet, they basically bounce off each other.

We use simple circle based body with frictionAir and inverseInertia set to 0. There is a lot of other properties, but we are rather clueless how the bounce off actually happens. Anybody can point us in the right direction please?

sentences:
About online game servers and how to handle data So my question isn't about what technology to use or how to do this or that, but a more general question.

I'm currently developing a action third person shooter. With elements of RPG - weapon,armor upgrades and items.

Players will be able to create new games or join old ones.
So my question is how to create the game server that players will play in.
I have two ideas on my mind.

The player who made the game is the server. All data passes trough him and he send this data to the server updating the database of the players with their XP points kills/deaths score and other.
Or my host machine is the server, the player who made the game just will open new instance on my host and will be like client. And all players send their input data to the host, the host updates the game and send response back to client for any new changes like where is the enemy and other.

And if i choose option 1 is there a chance the host to change the game content and manipulate the game results? (I think there is but i'm not sure)

And if i choose option 2 isn't that raising the response time and potentially the game lag?

or maybe there is another option?

sentences:
How to break the feeling of busywork in a game I don't know if this topic has been explored before but in a handful of games I've played there comes a point where trying to explore everything, doing sidequests, or even trying to get gear starts feeling like busywork. That sort of feeling makes me less interested in the game, and I usually wind up either just stopping playing altogether or just breezing through the rest of the game just to get it finished and out of the way. This feeling seems to happen mostly with RPGs from my own personal experiences.

How do you prevent activities the player can do (sidequests, exploration, item crafting, etc.) from feeling like artificial time padding or busywork?

sentences:
Unity doesn't change particle color when render is set to mesh? I've got a particle system with Render Mode set to Mesh. Then I applied a material to it, which is just white with the default shader. Now I can't change the start color nor the color over lifetime etc. As far as I know that shouldn't happen, right? I'm using Unity 5.5.0f3

This is what my PS looks like with the material :

This is what I achieved with 3 particle systems with 3 different materials, but actually, I don't want these materials. Instead, I want to set the start color property of the particle system to apply some color. The material solution restricts me in terms of random start color and stuff like this.

sentences:
How to use 3D models in video games? (Copyright related) There are many gray areas in using 3D models online that may be free, creative commons with specific terms, or public domain. I notice many 3D models being sold by artists that are exact replicas of known vehicles (eg. BMW,Honda,etc.(with emblem)). I would think in this situation there will be some sort of infringement  especially if someone bought that model and used it in their video game, no matter if it was marked as royalty free. I would appreciate if someone with experience could assist in clarifying some of the following areas. Please note, this is the information I have inferred based of personal research, may not be factual, please correct me if I am wrong.

Commercial Use: Of course never sell someone's 3D model, but what part of that is considered theirs; if they made a model of an RC car, are the wheels legal to use, the chassis, engine especially if the creative textures(or meshes) are removed and all that is the mere form of the object. (Eg. if I 3D model a nail/screw; that is not considered copyright protected because it is a 'common'/'useful' object)

Free Usage: If your product is free, my assumption is that game devs could use a 3D model as long as they change textures, colors, etc. But form of the object is all for grabs.

Commercial Use & Free Use: If the product/game you are using is free, but you have advertisements bringing you revenue that may be on the side of a website or phone app and pop up every now and again; does this make it acceptable?

Thank you ahead of time!

sentences:
Determining if a point is perpendicular to a line I am trying to walk a line that is intersecting a mesh, and given the point on the line I need to see what vertices may be perpendicular to it. My initial idea was to attempt a dot product between the line's direction vector and the direction vector from the point on the line to the mesh's vertex, and then only accept values that were near 0. This resulted in a collection of vertices behind the point on my line. Playing with the threshold values for the dot product check do not seem to help either. Any ideas?

Code

//actual_pos = position of the vertex
//trav_in_soace = point along the line
//m_fireDir = normalized direction vector of the line

Vector3 dir_to_point = actual_pos - trav_in_space;
dir_to_point.Normalize();

float dot_accept = DotProduct(m_fireDir, dir_to_point);
if (dot_accept > max_threshold || dot_accept < min_threshold)
    continue;

Picture with threshold values near 0.5

This is best result I can get and it is still really inaccurate. The orange verts are the points on the purple line, the red and blue are what should be the desired vertices.

sentences:
How to reproduce this (parallax?) effect? I'm wondering how to imitate the camera movement like in the gif below. It´s from a Android game.

This game for example (via GIPHY)

Actually, I am not sure if this can be called a parallax effect, but it is the only word I can think of.

My code until now:

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

public class RotateAroundTarget : MonoBehaviour {

public Transform target;    // The object to follow
public Transform background;
public Transform foreground;
public float speedMod = 20.0f;  // Camera speed
public float topMargin = 0.2f;  // Top rotation margin

// The position of the target
private Vector3 point;
// Point if the camera is rotating to the left
private bool toLeft = false;

// Use this for initialization
void Start () {
    point = target.transform.position;
    transform.LookAt (point);
}

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

    // The camera is moving to the right until it reaches the top margin, then it changes it movement direction
    if (!toLeft) {
        transform.RotateAround (point, new Vector3 (0f, 1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (1);
        rotateForeground (-1);
        Debug.Log ("Izquierda");
        if (transform.rotation.y >= topMargin) {
            toLeft = true;
        }
    } else {
        transform.RotateAround (point, new Vector3 (0f, -1f, 0f), Time.deltaTime * speedMod);
        rotateBackground (-1);
        rotateForeground (1);
            Debug.Log ("Derecha");
        if (transform.rotation.y <= -topMargin) {
            toLeft = false;
        }
    }
}

// Direction = 1 (left) | -1 (right)
public void rotateBackground(float direction){
    background.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod * 2) * direction, 0));
}

public void rotateForeground(float direction){
    foreground.transform.Rotate (new Vector3(0, Time.deltaTime * (speedMod / 2) * direction, 0));
}
}

But what I obtain in Unity Editor is this:
Result in Unity Editor (via GIPHY)

Any suggestion on how to get this?
Any help would be appreciated.

sentences: Best 2d AI movement system I'm creating a top-down rpg (no tile-based) using libgdx. Now I need to make enemies move on map with obstacles. What is the best approach to realize that? A*(I think, if enemy see player, he should turn to Pursue+Raycasting, because A* is bad for following moving targets) or just combining steering behaviors Seek+Raycasting?

sentences:
Proper way to maintain Vertex Buffer Objects I've started learning WebGL, currently I'm building a 2D lighting system, but there is some confusion going on inside my head.

How the lighting works is based on this tutorial http://archive.gamedev.net/archive/reference/programming/features/2dsoftshadow/default.html (probably the most linked article of the genre).

My question is about the proper way to store/create/update the Vertex Buffer Objects of the polygons.

Currently I have something like:

//-- during initialization of each polygon
//build vertices from the provided points
//[...]
//create the VBO
this._VBO = gl.createBuffer();
gl.bindBuffer( gl.ARRAY_BUFFER, this._VBO );
gl.bufferData( gl.ARRAY_BUFFER, vertices, gl.DYNAMIC_DRAW );

//-- during rendering of each polygon
gl.bindBuffer( gl.ARRAY_BUFFER, this._VBO );
gl.enableVertexAttribArray( program.aVertexPosLoc );
gl.vertexAttribPointer( program.aVertexPosLoc, 3, gl.FLOAT, false, 0, 0 );

The vertices array is created only one time at the top of the file, and reused for each new polygon, the motive to do that is to avoid the creation of various Float32Arrays per object.

//top of file
var vertices = new Float32Array( 20 * 3 ); //maximum of 20 points

It's okay to have one VBO for each object? I was thinking about the possibility of a single VBO, but I don't understand how I can make it work with only one.
The number of vertices can vary between one polygon and another, so how I'm going to store that?

Currently I'm not taking into consideration textures, however, answers that already take they into account are welcome.

sentences:
How do I fit the camera frustum inside directional light space? I'm trying to improve the coverage of a shadow map for a directional light. Currently, it works great if the camera is looking straight down. However, if the camera is close to the ground and looking toward the horizon, I can see where the shadow map ends because it doesn't cover enough of the scene.

I'd like to create a frustum for the directional light so that it entirely encloses the camera's frustum, as this article suggests in figures 14 and 15. (I'm not really worried about the near and far planes for the light; I've picked a number that works well for every test I've tried)

I know the direction of the light, and the position, rotation, and field of view of the camera. I'm using OpenGL.

How do I create a frustum for the light so that it encloses my view frustum?

sentences:
VBO = glGenBuffers() IllegalStateException i'm kinda noob in OpenGL but I have this problem: I get an IllegalStateException at this code:

int vboVertex = glGenBuffers();

In-detail exception:

Exception in thread "main" java.lang.IllegalStateException: Function is not supported
at org.lwjgl.BufferChecks.checkFunctionAddress(BufferChecks.java:58)
at org.lwjgl.opengl.GL15.glGenBuffers(GL15.java:116)
at Mesh.initVbo(Mesh.java:49)

OpenGL version:
2.0.5819 WinXP Release

Thanks for support and sorry for the horrible english.

sentences:
Which iPhone/iPod Hardware to Support for iPhone Game I'm coming from a background of Android. I would like to figure out what kind of iBlah device hardware I need to support for iPhone game development; something like Android's OS distribution stats, but for iBlah hardware.

From my research, it seems that I need to support both iPod and iPhone. But which versions of hardware? is 3G still used? What about 3GS?

For example, the -S phones seem to have dual core instead of single-core CPUs.

I also worry about performance. In Android, I had a severely low-end phone, which meant pretty much anything that ran okay there ran okay on other phones. For iPhone, how do I figure out what to support in terms of performance?

sentences:
Existing game to virtual reality game? What kind of existing game can be taken as a good source for a 'virtual reality' game, specifically, the one you can play with any 3D VR glasses?

Why do you think this particular game or these games can be adjusted well in the new realm?

Thank you for your thoughts.

sentences:
Fully destructibility in 2D I would like to create a small game about battles in the Middle Ages.
Imagine a procedurally generated 2d map with rivers, fields, and a small castle.
Two sides. One player will attack the castle, and the second player defends it.
The whole game will be with a view - top down. I like this look (and maybe it will simplify the work).
Imagine a player's cannon approaching the castle and attacking it.The cannon fires (e.g., into a tower) and the tower starts to fall apart. How to make this process more interesting? With various effects (for example, to the place where the gun fell off a piece of wall, and on the roof of the tower there was a crack).
I like the process of destruction in AE defenite edition, but it looks the same for all types of buildings (sooner or later they will turn it into the same bunch).
The example what I'm mean when say 2d castle in top down view:
How to break this castle into chips?
P.S I hope you see the author's patron, from his patron this picture could be downloaded for free. He has many other amazing pictures.

ADD some visual guide:
enter image description here

sentences:
How to make rhythm game long notes in Unity? I'm making a rhythm game for a university course and I can't figure out a way to make the long/sustained notes. For reference, this is what I mean taken from Guitar Hero:

I already have a system working for regular notes. The way I do it is that the notes are stored in an external file as numbers which represent the absence or presence of a note as well as what type of note it is, separated into musical bars:
000
010
020
001

There are three lanes for the notes to be, and this means that in this particular bar there are notes wherever it's not 0 (with the numbers being different types of notes).
I had thought of using this system to create long/sustained note start and end markers (say 3 and 4) and that create another game object which would be the line between the start and end markers. But the way my note generator works is that the notes are not all generated at once because that'd be pretty heavy.
Instead, the notes are generated at a certain time taking into account its speed so that it's instantiated and will reach the player's activator when it's supposed to. The following is a part of my note generator code, put in the Update method:

// if current song time - time offset is greater than
// time taken for all executed bars so far
// spawn the next bar's notes
if (songTimer - _timeOffset >= (barExecutedTime - barTime))
{
   StartCoroutine(PlaceBar(noteData.bars[barCount++]));

   barExecutedTime += barTime;
}

And here is the PlaceBar coroutine:

// go through all notes in a bar
// creates an instance of note prefab
// depending on which note is meant to be spawned
private IEnumerator PlaceBar(List<SongParser.Notes> bar)
{
   for (int i = 0; i < bar.Count; i++)
   {
       if (IsThereNote(bar[i].bottom))
       {
          GameObject _obj = (GameObject) Instantiate(GetNotePrefab(bar[i].bottom, true), new Vector3(bottomLane.transform.position.x + distance, bottomLane.transform.position.y, bottomLane.transform.position.z - 0.3f), Quaternion.identity);
       }
       if (bar[i].middle != 0)
       {
          GameObject _obj = (GameObject) Instantiate(GetNotePrefab(bar[i].middle, false), new Vector3(middleLane.transform.position.x + distance, middleLane.transform.position.y, middleLane.transform.position.z - 0.3f), Quaternion.identity);
       }
       if (bar[i].top != 0)
       {
          GameObject _obj = (GameObject) Instantiate(GetNotePrefab(bar[i].top, true), new Vector3(topLane.transform.position.x + distance, topLane.transform.position.y, topLane.transform.position.z - 0.3f), Quaternion.identity);
       }

       yield return new WaitForSeconds((barTime / bar.Count) - Time.deltaTime);
   }
}

So if I were to make start and end markers, the start marker would not know where the end marker is because it doesn't exist. Could anyone help please?

sentences:
Are mobile devices a viable platform/market for "User-Generated Content"-based games? I intend to do a lot of research into this, but I know this community has a knack for delivering hard-to-find gems of knowledge, so I figured I'd ask here first.

 Preamble (My Situation)

I'm currently looking into the viability of becoming an independent games developer by selling games for the mobile platforms (iOS and WP7 in particular). However, as I currently work full-time, all development has to be done in my own time (weekends, after-work, early mornings). Thus, I need to be careful with how I spend my time (I also have a social life to maintain). Basically, if I can release something that makes enough money, relative to my time investment into it, to be able to support myself with, I'll seriously consider taking the plunge.

The Question

One of the ideas I've had is for a game in a similar vein to Little Big Planet or Kodu, where the focus is on user-generated content, with the game itself providing a set of tools, samples and access to a 'market' for user-content.

What I envision is a simple set of drag and drop tools for placing content in levels, customising template assets, etc, and node-based editors for behaviour and logic (Think along the lines of Kismet, for those of you familiar with the Unreal Engine).

As a programmer, I've looked into this enough to know it is possible from a technical standpoint. However, what I need to know is if it is viable in terms of userbase. Is there a market for user-generated content games on the various mobile platforms?

Just to clarify, I'm not asking how to do it, I'm asking if it's worthwhile to do it.

EDIT
To reword the question and make it more answerable (given the lack of existing examples), what are relevant design considerations typically associated with the psychology of the mobile gamer that would influence the success of a game based on user-generated content?

EDIT 2
Microsoft have just released an app for WP7 called TouchDevelop that allows users to write executable scripts using a simplified tile-based interface. It's been downloaded a lot and garnered positive reviews. So, that's as strong of an indicator of community interest as I figure I'm ever going to get.

sentences:
Map circular thumbstick to square I want to make a plane controller using SDL2. I want to use one joystick for pitch/roll. Y-axis sets the pitch-flaps, and X-axis sets the roll-flaps.
But there is one problem: Say I want to fully pitch and roll at the same time: I will hold the joystick at a 45 degree angle. But in SDL2, the joyAxis then get reported as 0.707... which is roughly half of the square root of 2. I understand why this happens: the physical joystick is restricted within a circle, so to move it up, you need to sacrifice a little bit of left/right. So the magnitude of the input vector is at most 1, instead of sqrt(2). How do I correct for this in code? I can't think of a good mapping.
I would like something like this:
float rawInput[2] = {0.707, 0.707};
float actualInput[2] = squaredCircle(rawInput); // {1,1}

rawInput = {1, 0};
actualInput = squaredCircle(rawInput); // {1,0}

What is a good squaredCircle function?

sentences: Load Meshes with Bullet Physics I just started implementing some physics in my game with Bullet Physics and I was just wondering how would i use bullet physics to load in meshes. For my for DirectX I load in x files into a ID3DXMesh. I'd like to know how do I create a mesh in bullet physics instead of using boxes and spheres. I can't seem to find a way to do this. It would be great if someone could help me out. Thank you.

sentences:
differences betwen game resolution in a different display resolution my game is not supported on the other devices with a different resolutions. for example may character is 140w X 55h pixels which is ok on a 4 inch display but it goes wide when i tested my game on a device with 4.7 inch display. how can i make a correct character for 4.7 or more inch displays?
i am using cocos2d-x engine. i want to see if it has a automatic synchronize tool or no. i my self must do it manually ?

sentences:
Infinite 3D Cave in Unity A friend and I are hoping to make a game in Unity in which you fly through an infinite 3D cave that can twist and wind in any direction (though obviously not to the point that the turns are impossible to make). We were thinking about creating a number of tunnel "pieces" that each curve a certain amount, and spawning each at the end of the one that came before.

But we have no idea how to make sure that the mouth of one tunnel piece always aligns perfectly (in both position and rotation) with the end of the previous one. Can anyone offer any advice on how to accomplish this?

Are we even going about it in the right way, or is there a better way to procedurally generate the cave? Bonus points: It'd be awesome if the cave could change in diameter and/or shape as well, though that'd just be gravy.

sentences:
Implementing network smoothing We are making a multipler first person shooter.
The client sends it's position to the server at a fixed rate (currently at 10Hz). The server sends a single message contatining all player's positions to all players at the same rate (10Hz).

As expected, the movement is pretty choppy since the 60fps game is only recieving updates 10 times a second.
What is the best way to smooth this movement?
The most obvious way would be to interpolate between the last two packets, so that the interpolation finishes as we recieve a new packet. But this adds an instant 100ms delay for all players.

The other way would be to use the velocity and acceleration inferred from the last few packets to predict where the player is before the next packet arrives, however if the prediction is wrong, the player would tend to jump as soon as a new packet is recieved.

Does anyone know how AAA titles solve this problem?

sentences:
What is a good budget ratio for computation time? What sort of budgets do they put on computation time?

For example, lets say a football game needs to run at 50 frames per second.  That means that each frame can only be 20 milliseconds long.  How is that 20 milliseconds divvied up?  For example, it could be:

Pathfinding - 3ms limit
Ball Physics - 8ms limit
Particle Effects - 2ms limit
Animations - 7ms - limit
Total - 20ms

However, I just made those numbers up without any idea what I was doing.

Is there a rule of thumb or a standard practice used?  I know every game is different depending on art-style, game genre, etc.  I am looking for as generic as an answer that can be had; however, if specifics are needed, then Madden Football 2017 can be used as the example game.

What percentage of milliseconds should be allowed for each aspect of game development?

sentences:
GLSL Unsigned Int Values Not Retrieved Properly I have packed several values needed for shading a particular vertex into a single 32-bit uint. In the shader, it is unpacked like this:

vec3 color;
uint vertexData = data;
float sunlight, artificialLight;
bool occlusion;

artificialLight = float(vertexData & 31u);
vertexData = vertexData >> 5;
sunlight = float(vertexData & 31u);
vertexData = vertexData >> 5;
occlusion = bool(vertexData & 1u);
vertexData = vertexData >> 1;
color.b = float(vertexData & 127u);
vertexData = vertexData >> 7;
color.g = float(vertexData & 127u);
vertexData = vertexData >> 7;
color.r = float(vertexData & 127u);

The color produced by this extraction is much different from the originally intended color. For example:

130, 245, 90 --> 78, 125, 249   (These values are not exact)

I took the code and put it into my main c++ program and ran it with a debugger. It showed the right values.

130, 245, 90 --> 130, 245, 90

EDIT

I have taken a uint produced by my compressor and directly inputted it into my shader like this

vertexData = 2179293184;

Every vertex is shaded with the color of green this value corresponds to. So apparently, there is something going wrong with the transmission of the values. What might be causing this?

sentences:
How to make a Sprite using CoreGraphics iOS - Cocos2d-iPhone I'm trying to make a sprite that uses the graphics that are made with core graphics.   I cant seem to find anything to explain how to make shapes using core graphics to create a sprite to use in cocos2d-iPhone.

Thanks for any insights and help!

sentences:
How to deal with (bad?) player suggestions Every game which builds a community while still being in active development will soon be confronted with players who post suggestions for new features on its forum. Most of these suggestions, however:

Go into a completely different direction than where you want your game to go
Would require far too much effort for the benefit they could have
Are just plain awful

What's a good way to deal with such suggestions?

Should you tell the players honestly what you think about their suggestions so that they learn to make more constructive ones?

Should you always try to maintain a positive and encouraging attitude towards player ideas, even when you secretly think that there is not a chance in hell you are following them?

Should you just ignore any suggestions which you don't like?

sentences:
GLSL variables as main function params vs on their own line? I am learning OpenGL and GLSL. I was taught that the in/out variables should be formatted like this:

in vec3 something;
out vec3 somethingElse;

int main()
{
    // etc...
}

However, I ran across code like this online (ShaderToy):

int main(in vec3 something, out vec3 somethingElse)
{
    Is there a difference?
}

Is there any difference?

sentences: Quarter turn sprite sheets? I'm having trouble finding sprite sheets that have the characters turn in 8th movements, so that you can see back, front, left, right, and in between.  What would be a good term to search for when trying to find these kind of sprite sheets?

sentences:
RagDoll in AndEngine I want to create a RagDoll body in andEngine which can run and jump over different jumpObjects. Can any one give a nice tutorial on how to create RagDoll body and how to move it, like jump and running.

Thanks in Advance.

sentences:
How should I make realistic electricity? I am currently designing electricity for my game. If you've ever played or seen Factorio, this is pretty much the exact way I want it to be.

Okay, on to theory:
What I came up with is some sort of power source produces a certain amount of Watts per frame. Most power sources cannot store any energy, so at the end of the frame, it is all lost.

Machines connected by wires to energy sources will perform a Dijkstra-style flood-fill from themselves through all connected wires, ignoring wires that have already been processed. The Watt cost will slightly increase for each wire it passes through (to simulate energy loss) and when it reaches a battery or power source, it will drain as much as it needs. If the source doesn't have enough, it continues to search for more power. If, by the end of the frame, it doesn't have enough Watts, it simply works slower or stops working entirely.

After all machines have done this, all batteries will perform a similar flood-fill, but ignoring other batteries, and will attempt to take ALL of the energy from sources (up to its storage capacity).

Then, all power sources discard all energy.

Is this how it actually works? I want to use numerical values, so just being connected to an energy source is not enough. Thanks.

sentences:
when to do A* pathfinding? I'm trying to build my first game, a really simple RTS like Age of Empires but I have a question about pathfinding.

When do this kind of games usually do pathfinding?

I've read some games do a global pathfinding once at game start but I'm not sure if that will fit this kind of games.

Do they usually calculate pathfinding each time a game entity starts a new task and has to move?

How do they handle when a obstacle suddenly appears on the path? Do they re-calculate pathfinding on every step? Or do they check if the current path is clear on every step? Or they just walk the current path until they actually hit the unexpected obstacle?

Actually if you know a link to a source code of pathfinding on some RTS game I would really appreciate it.

Thanks in advance

sentences:
How to do FoV similiar to Nethack? I am currently writing a little roguelike and wondered how Nethack/other games do the FoV of the player. I had a look at Nethacks source code, but since it's C it's pretty hard to read.

For people who don't know how it looks in nethack:

I couldn't find good resources on how to achieve this result.
Of note is that my maps are a little more complex with regards to shape and objects that block sight.

So how would I actually implement that? Map is just an array of ints.

I figure I should have flags on each cell saying if it's been discovered or not, but how to I simulate the FoV?

sentences:
Can't use SFML sprite drawing and OpenGL rendering at the same time I'm using some SFML built in functions to draw sprites and text as an overlay on top of some OpenGL rending in an SFML RenderWindow. The opengl rendering appears fine until I add the code to draw the sprites or text. The sprite or text drawing causes the OpenGL stuff to disappear.

The follow code show what I'm trying to do

sf::RenderWindow window(sf::VideoMode(viewport.width,viewport.height,32), "SFML Window");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0,viewport.width,0,viewport.height,0,1);

while (window.pollEvent(Event))
    {
    //event handling...

    //begin drawing
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_TRIANGLES);
    glColor3f(col.x,col.y,col.z);
    for(int i=0;i<3;i++)
        glVertex2f(pos.x+verts[i].x,pos.y+verts[i].y);
    glEnd();

    // adding this line causes all the  previous opengl triangles not to appear
    window.draw("Sometext");

    window.display();
}

sentences:
MVC (Model-View-Controller) Game Engine Architecture - Yes or No? I am reading one great book, Game Coding Complete, and that book strongly recommends using MVC (Model-View-Controller) approach, with three key layers:

Game Application Layer
Game Logic
Game View

To me, this approach looks like an overkill for a mobile computer game.

What is your opinion, please? Is it worth of implementing this architecture, even if it adds extra communication needed between modules? Can this design consume so much CPU power, that at the end, the result would be significantly slower, than if it weren't implemented?

sentences:
Libgdx change velocity of moveTo action I am trying to create physics for a ball in Libgdx. The ball starts moving after a pan and everytime the ball collides with a wall, a moveTo action is added to it. But my ball moves with a constant velocity (action time = distance/velocity). I want my ball movement to get slower smoothly.

Here is my method for calculating velocity

private float velocity(float panDistance) {
        float coefficent = 0.3f;
        return panDistance / coefficent;
    }

in act method of the Ball I decrement velocity

  @Override
    public void act(float delta) {
        super.act(delta);
        if (velocity < 100 && velocity > 0) {
            ballImage.clearActions();
        }
     velocity -= 3f*delta;
 }

When gesture detector detects a pan the method below is called.

public void moveTheBall(float tanX, float tanY) {
        if (ballImage.getActions().size == 0) {
            motionVector = (int) (tanX / Math.abs(tanX));
            motionAngleTan = tanY / tanX;
            panDistance = (float) Math.sqrt((tanX * tanX) + (tanY * tanY));
            velocity = velocity(panDistance);
            recursivelyAddActions(motionVector);
        }
    }

in recursivelyAddActions() method

private void recursivelyAddActions(int vectorDirection) {
    // AFTER SOME CALCULATIONS
    distance = (float) Math.sqrt(((predictionX - ballStartingPosX) * (predictionX - ballStartingPosX)) + ((predictionY - ballStartingPosY) * (predictionY - ballStartingPosY)));
        moveToAction = Actions.moveTo(predictionX, predictionY, distance / velocity);
        ballImage.addAction(moveToAction);
    }

this is not smooth and this does not work good. I need an advice to make this work better. Thank you.

sentences:
How does mass work in Box2D I'm making a 2D platformer, shooter type game in LibGDX, and I'm wondering about Box2D's mass system. I'ven't used mass for anything in the game so far, and everything has worked ok. We move the player, enemies, and bullets around by
body.applyLinierImpulse(new Vector2(impulseX, impulseY), body.getWorldCenter)
and even have a variable jump height system, and it all works fine. To change the speed or impact of objects, we just change the impulse. I've tried using aplyForce() but it won't move the body. Everything is usually just a simple polygon, but when I'm creating fixtures there's an option to set the density, and bodies have the option to set the massData, but I don't know what either of these properties does. The gravity of the world is around 11. Can anyone tell me how I should be handling mass with my objects in the game? Thanks.

sentences:
Can OpenAL be used with Python? I'm from a background of using OpenAL with other languages; and I'm on a project that benefits very much from Python. I remember PyAL, but it hasn't been updated since 2013 and my computer can't even find a copy of the package to download. I'm also aware of such relative-fringe packages as alpy and python-openal; but I'm hesitant to pick them up if they are also unmaintained. (Can't be sure yet.)

Is there a library that provides a Python binding to OpenAL? Or do I simply need to either write my own or make due with one of the other, non-3D-sound, packages? If getting it is more complicated than pip, how would I go about doing so?

Thanks.

sentences:
How to optimize pathfinding on a very large dynamic 2d grid? I have a large 2d tilemap, ranging anywhere from hundreds to thousands in size. The map is formed by 8x8 chunks. I am currently using A* but it isn't quite efficient because I may have as many as a hundred objects pathfinding simultaneously. The path doesn't have to be the absolute shortest, but a certain degree of shortness is expected.

I've looked here and saw that HPA* might work for me since my map is broken into smaller chunks. However, because the map is highly dynamic (let's assume that at least two chunks are modified per second) it seems there may be better alternatives.

Also, D*/Lite (mentioned in the link) might work, but how can it be optimized for a chunk based grid?

My question isn't particularly about HPA* or D*, but rather about finding an optimal algorithm for a large and dynamic, chunk-based, tilemap.

EDIT: The chunks contain procedurally generated content. Most of the time this will mean that the chunk is empty except for about 10-20% of its tiles, however sometimes this number can go up to 90% (that is in the case of generated "blobs"). The chunks will contain near-arbitrary data, and two chunks will rarely be the same.

Furthermore, each agent will have an independent path, however because the map is dynamic, it may contain man-made corridors and long passage ways that might result in them being shared often by many agents.

Most goals will be arbitrarily located, however there will be some predefined goals (locations) as well. For those predefined locations, I am considering using a vector field (sort of like a heat map) that can be used to approach it. However, doing this for every goal would be terribly inefficient especially since I would use the generated field only once (or in better cases, maybe a few times).

sentences:
How do I make camera move at same speed when rotating and moving forward I made a camera in DX9. To move forward I press the Up arrow. To rotate on the Y axis I use the mouse. When I perform these movements on their own the camera moves at the speed I want.

However, if I hold down Up and move the mouse at the same time then the camera moves a lot faster than it should. I want it to move at the same speed as it does when only the Up arrow is pressed.

I think I need to normalize something somewhere but not sure what and not sure where. Have tried various combinations without success so if anyone can point me in the right direction that would be great. Thanks.

I've post code below.

#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)

LRESULT WINAPI MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
    if( KEY_DOWN(VK_UP))    MovePlayer(D3DXVECTOR3(0, 0, -1.0f));
    if( KEY_DOWN(VK_DOWN))  MovePlayer(D3DXVECTOR3(0, 0, 1.0f));

    switch( msg )
    {
        case WM_MOUSEMOVE:
        ProcessMouseInput();
    }
}

void  MovePlayer( D3DXVECTOR3 in_vec )
{
    D3DXMATRIX CameraRot;
    D3DXMatrixRotationY(&CameraRot,D3DXToRadian(AngleY));
    D3DXVECTOR3 CameraRotTarget;
    D3DXVec3TransformNormal(&CameraRotTarget,&in_vec,&CameraRot);
    CameraPos +=  (m_timeElapsed * CameraRotTarget);
}

void ProcessMouseInput()
{
    GetCursorPos( &CurrentMouseState );

    if ((CurrentMouseState.x != GameMouseState.x) || (CurrentMouseState.y != GameMouseState.y))
    {
        int dx = CurrentMouseState.x - GameMouseState.x;
        int dy = CurrentMouseState.y - GameMouseState.y;
        AngleY+=m_timeElapsed*dx*7.0f;
    }
    GameMouseState = CurrentMouseState;
    // Set back to window center in Render function
}

VOID UpdateCamera()
{
    D3DXVECTOR3 CameraOrigTarget(0, 0, -1);
    D3DXVECTOR3 CameraOrigUp(0, 1, 0);

    D3DXMATRIX CameraRot;
    D3DXMATRIX CameraRotX;
    D3DXMatrixRotationX(&CameraRotX,D3DXToRadian(AngleX));
    D3DXMATRIX CameraRotY;
    D3DXMatrixRotationY(&CameraRotY,D3DXToRadian(AngleY));
    CameraRot = CameraRotX * CameraRotY;
    D3DXVECTOR3 CameraRotTarget;
    D3DXVec3TransformNormal(&CameraRotTarget,&CameraOrigTarget,&CameraRot);

    D3DXVECTOR3 CameraTarget;
    CameraTarget = CameraPos + CameraRotTarget;

    D3DXVECTOR3 vUpVec( 0.0f, 1.0f, 0.0f );
    D3DXMatrixLookAtLH( &matView, &CameraPos, &CameraTarget, &vUpVec );
    g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

    D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI / 4, 1.0f, 1.0f, 100.0f );
    g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
}

sentences:
Export Spriter animations to Unity I want to use bone animations in my 2D game for Unity (5.0 beta). I am trying Spriter. Apparently, it has no official Unity support. There was some guy, back in 2014, who posted a plugin to convert Spriter files to Unity prefabs here: http://brashmonkey.com/forum/index.php?/topic/3365-spriter-for-unity-43-updated-integrated/.

However, the plugin does not seem to work (perhaps it is because I am using 5.0 beta).

There are deprecated lines, like

AnimationUtility.SetAnimationType(animClip, ModelImporterAnimationType.Generic);

Or

 UnityEditor.Animations.AnimatorController.AddAnimationClipToController(controller, animationClip);

If you remove them, of course it won't be able to properly export your files.

So my question is: is there a reasonable to use Spriter animations in Unity? I know I could just export to a spritesheet, but I was hoping to use bones for super fluid animations (I have several characters so I don't really want to make lots of spritesheets). Or perhaps there is a better bone-based solution for 2D animation in Unity?

sentences:
Gravity stops when side-collision detected Please, look at this GIF:

The label on the animation says "Move button is pressed, then released". And you can see when it's pressed (and player's getCenterY() is above wall getCenterY()), gravity doesn't work. I'm trying to fix it since yesterday, but I can't.
All methods are called from game loop.

public void move() {
    if (left) {
            switch (game.currentLevel()) {
            case 1:
                for (int i = 0; i < game.lvl1.getX().length; i++)
                    game.lvl1.getX()[i] += game.physic.xVel;
                break;

            }
        } else if (right) {
            switch (game.currentLevel()) {
            case 1:
                for (int i = 0; i < game.lvl1.getX().length; i++)
                    game.lvl1.getX()[i] -= game.physic.xVel;
                break;
            }
        }
    }

    int manCenterX, manCenterY, boxCenterX, boxCenterY;
//gravity stop
    public void checkCollision() {
        for (int i = 0; i < game.lvl1.getX().length; i++) {
            manCenterX = (int) game.man.getBounds().getCenterX();
            manCenterY = (int) game.man.getBounds().getCenterY();
            if (game.man.getBounds().intersects(game.lvl1.getBounds(i))) {
                boxCenterX = (int) game.lvl1.getBounds(i).getCenterX();
                boxCenterY = (int) game.lvl1.getBounds(i).getCenterY();
                if (manCenterY - boxCenterY > 0 || manCenterY - boxCenterY < 0) {
                    game.man.setyPos(-2f);
                    game.man.isFalling = false;
                }
            }
        }
    }
//left side of walls
    public void colliLeft() {
        for (int i = 0; i < game.lvl1.getX().length; i++) {
            if (game.man.getBounds().intersects(game.lvl1.getBounds(i))) {
                if (manCenterX - boxCenterX < 0) {
                    for (int i1 = 0; i1 < game.lvl1.getX().length; i1++) {

                        game.lvl1.getX()[i1] += game.physic.xVel;
                        game.man.isFalling = true;

                    }
                }
            }
        }
    }
    //right side of walls
    public void colliRight() {
        for (int i = 0; i < game.lvl1.getX().length; i++) {
            if (game.man.getBounds().intersects(game.lvl1.getBounds(i))) {
                if (manCenterX - boxCenterX > 0) {
                    for (int i1 = 0; i1 < game.lvl1.getX().length; i1++) {

                        game.lvl1.getX()[i1] += -game.physic.xVel;
                        game.man.isFalling = true;
                    }
                }
            }
        }
    }
public void gravity() {
    game.man.setyPos(yVel);
}

 //not called from gameloop:    public void setyPos(float yPos) {
        this.yPos += yPos;

}

sentences: How much memory does a texture take up on the GPU? A large png on disk may only take up a couple megabytes but I imagine that on the gpu the same png is stored in an uncompressed format which takes up much more space. Is this true? If it is true, how much space?

sentences:
Need help thinking of a way to code a text parser Apologies if this has been asked before, or if it is a bit too simple for this forum.
I'm new to C++ and as one of my first projects I have decided to try a textual adventure. Step 1: the text parser.
Note that I am aware that there are libraries out there that will make this for you, but I want to code it from scratch to learn what is going on :)

So! I've gotten to the point where I add the user's input to a vector, so that I can handle each word individually. However, I cannot for the life of me figure out a "handler" that does not hard-code everything.
I want to create a map through which to associate the string, for example "Go", to the relative action handler.
Something like this:

map<string, ActionHandler> actionMap;

actionMap["Go", GoActionHandler];

GoActionHandler would be a struct of ActionHandler type, and I would put in ActionHandler or the general messages/actions/reactions, and then in GoActionHandler I'd elaborate on the possible "Go" actions.
But, one thing at a time... The code above does not compile, as ActionHandler is not a "type".
Considering that for now I am just focusing on having a (scalable!) program that reacts differently based on the word entered, could someone help me by showing me real code? I've found online people making examples in pseudocode, but I'm to big of a noob to then know how to execute what they are talking about, even though I understand the logic.

So could anyone dumb this down and point me in the right direction? How do I include in my main() a way to call a struct/function based on the a string contained in a vector? (eg. string "Go" in vector[0]?)

sentences:
XNA Deferred + Forward, Depth Problem? Im working with my deferred engine in XNA 4.0 and Im combining it with a forwardpipeline to support semi-transparency and other "forward only" effects.

Let me describe what I do:

Render GBuffer and all deferred geometry based on materials
A final composit where I combine the lightbuffer and the diffusebuffer
from the GBuffer. I output color and depth to a rendertarget so I
can use forward rendering to draw directly onto that RT.
Render forward geometry
I then take the RT from the forward pipeline and do postprocessing
stuff.
Finally I write the RT to the backbuffer

Question:

As you can see in the image below there's a problem with the
boundingboxes. The are drawn using forward rendering and is drawn
using the depthbuffer I descibed in step 2. I have tried to offset
the depthbuffer in different directions with a texel or two. But
nothing seems to solve the problem. Has anyone experienced this
problem before?

EDIT:
   This post has been cleaned from some statements to avoid confusion.

sentences:
Add navigation obstacles during runtime lags Please watch this short video. http://screencast.com/t/vw2a5FdOOT It shows the problem.

It's using the build in Unity navigation and followed the guide to build the demo in the video.

Everytime I add a new obstacle than all agends pauses (hiccups) for a short time. I think this is because they have to recalculate a new path. How to make this recalculation in a background thread? I want to make a mace tower defense.

Thank you for reading an watching!

sentences:
Rotate 2D Object Towards Mouse & Stop After Full Revolution Essentially what i'm trying to recreate is a dial with a min and max setting. The player clicks and drags the mouse around the dial to move its position but I would like for it to stop at a full rotation even if the mouse keeps revolving around the object.

The only way I've come up with this is to keep track of the distance covered by the drag.

So I use 360f - StartingAngle for the distance it is allowed to travel ( I know this doesn't account for negative direction however you want to think about it ).

I then calculate a previous angle and next angle and find the difference and then add that to the total.

Then I was checking if the total > 360f - starting angle for slerping my rotation.

Problem I'm running into is when it crosses the threshold between 359.9 degrees and 0 degrees of course the difference comes up with a negative number and I'm not sure if I'm going about this the best way cause I can't seem to come up with a way of determining whether they crossed that threshold or they just went back really far.

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

public class Dial : MonoBehaviour
{
    Vector2 direction;
    float speed = 20f;
    float startingAngle;
    float angle;
    float angleRotationTotal;
    float previousAngle;
    Quaternion rotation;

    void Update()
    {

        if (Input.GetMouseButton(0))
        {
            direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
            angle = angle < 0f ? angle + 360f : angle;

            if (startingAngle == 0f)
            {
                startingAngle = angle;
                SetPreviousAngle(startingAngle);
            }

            SetAngleRotationTotal(angle);
            SetPreviousAngle(angle);

            if (angleRotationTotal > 360f - startingAngle)
            {
                rotation = Quaternion.AngleAxis(0f, Vector3.forward);
                transform.rotation = Quaternion.Slerp(transform.rotation, rotation, speed * Time.deltaTime);
            }
            else
            {
                rotation = Quaternion.AngleAxis(Angle, Vector3.forward);
                transform.rotation = Quaternion.Slerp(transform.rotation, Rotation, Speed * Time.deltaTime);
            }
        }
        else
        {
            angleRotationTotal = 0f;
            previousAngle = 0f;
            startingAngle = 0f;
        }
    }

    private void SetAngleRotationTotal(float currentAngle)
    {
        if (currentAngle - previousAngle > 0f)
        {
            angleRotationTotal += currentAngle - previousAngle;
        }
    }

    private void SetPreviousAngle(float currentAngle)
    {
        previousAngle = currentAngle < 0f ? currentAngle + 360f : currentAngle;
    }
}
```

sentences: Building a windows game for Mac. I have a game that I made in Unity and I have a windows build for it. It works fine on windows no problems there but I want to make a mac version of it. To make a mac version will it work if I just build it for mac or will I have to reprogram it for mac? I don't have a mac to test this and obviously I dont want to release a broken game. Note that the game uses the command Input.GetMouseButtonDown(0) a lot, not sure if you need a different command for a mac mouse.

sentences:
What is the metrics of vectors in XNA? When exporting a model from 3ds Max as FBX to import it into XNA, what metrics should I choose to make 1 unit in 3ds Max equal to 1 unit in XNA?

For example: I have a sphere model with 1m radius exported to XNA. When drawing I use:

Matrix[] transforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(transforms);
foreach (ModelMesh mesh in model.Meshes)
{
    foreach (BasicEffect be in mesh.Effects)
    {
        be.EnableDefaultLighting();
        be.World = mesh.ParentBone.Transform * Matrix.CreateScale(radius)
                    * TransformMatrix;
        be.View = camera.view;
        be.Projection = camera.projection;
    }
    mesh.Draw();
}

Radius is defined in my class as float.

This will draw a ball smaller than 1.

sentences:
How to switch screens when a button is pressed? LibGDX Currently working on a game for school and I ran into a problem. I created a Main Menu for my game with the buttons (Play, Level Picker, and Settings). What I'm trying to do is when the "Play" is pressed it will switch to a different screen where the user will play. The menu is under the name of MainMenu and the screen I want it to switch to is called StartGameScreen. I've tried looking online for my answer but can't seem to find something that will work. If it helps here's my code for the play button. Any help would be fantastic!

TextButton playButton = new TextButton("Play", (com.badlogic.gdx.scenes.scene2d.ui.Skin) skin); // Use the initialized skin
playButton.setPosition(Gdx.graphics.getWidth() / 2 - Gdx.graphics.getWidth() / 8, Gdx.graphics.getHeight() / 2 + (playButton.getHeight() + buttonOffSet));
playButton.addListener(new ClickListener() {

    @Override
    public void clicked(InputEvent event, float x, float y) {
        System.out.println("play game button clicked");
    }
});
stage.addActor(playButton);

sentences:
Why does my turn-based game loop allow the enemy to act repeatedly? I'm trying to create a turn-based game in pyGame but hit a wall when trying to properly handle the main game loop. So I have something like this:

def loop(self):
    while self.stategame==1:
        for event in pygame.event.get():
            if event.type == QUIT \
            or (event.type == KEYDOWN and event.key ==    K_ESCAPE):
                self.stategame = 0

        if self.isPlayerTurn:
            self.events()
        else:
            self.enemyTurn()
        self.draw_map()

        pygame.display.flip()

The enemyTurn() function here is called multiple times after each player's move causing the enemies to move multiple tiles before the player does anything again. I'm a beginner in gamedev do I don't know how to overcome this and, in the first place, why does it hapen. Isn't the code supposed to be analyzed from top to bottom like in regular Python so that the enemyTurn() is called just once and then the game goes back to waiting for user input? How can I solve this problem and call the enemyTurn() just once each time the player makes a move?

sentences:
JavaScript movement of player Okay so I am quite new, I've got the player to move using up, down, right, and left. But what I am trying to do is make the character move with a left click.

var Player = function(id){
    var self = {
        x:250,
        y:250,
        id:id,
        number:"" + Math.floor(10 * Math.random()),
        pressingRight:false,
        pressingLeft:false,
        pressingUp:false,
        pressingDown:false,
        maxSpd:10,
    }
    self.updatePosition = function(){
        if(self.pressingRight)
            self.x += self.maxSpd;
        if(self.pressingLeft)
            self.x -= self.maxSpd;
        if(self.pressingUp)
            self.y -= self.maxSpd;
        if(self.pressingDown)
            self.y += self.maxSpd;
    }
    return self;
}

That's what I have for the up, down, left, right movement. I've seen a few documents stating the click but just can't seem to implement it into the file.

sentences:
Unity - 2D Platformer Controller responsiveness issue I've been designing some basic controls for a 2D platformer and managed to get the feeling that I've been looking for when moving and jumping, but something is not quite right, it's not very responsive.

Most of the inputs are detected, but a lot of times, for example, the simple action of pressing some key to jump is completely ignored and the player ends up falling when the key was pressed at the right time. I don't consider that I'm developing on a laptop with low specs at all if that matters.

Looking at some other questions it has always been said that input detection should be inside the Update function and that physics related stuff should be on FixedUpdate, however, it has not always been very clear what exactly should be on which function, as far as I understand it should go something like this...right?

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

public class PlayerController : MonoBehaviour {
    public float speed;
    public float jumpForce;
    public float groundCheckRadius;

    public Transform groundCheck;
    public LayerMask groundMask;

    private float direction;

    private bool facingRight;
    private bool shouldJump;
    private bool isGrounded;
    private bool shouldFall;

    private SpriteRenderer renderer;
    private Rigidbody2D rigidbody;

    void Awake() {
        this.renderer = GetComponent<SpriteRenderer>();
        this.rigidbody = GetComponent<Rigidbody2D>();
    }

    void Start () {
        this.facingRight = true;
        this.shouldJump = false;
        this.isGrounded = false;
        this.shouldFall = false;
    }

    void Update () {
        this.direction = Input.GetAxisRaw("Horizontal");
        this.isGrounded = Physics2D.OverlapCircle(this.groundCheck.position, this.groundCheckRadius, this.groundMask);
        this.shouldJump = Input.GetKeyDown(KeyCode.S) && this.isGrounded;

        if (this.facingRight && this.direction < 0 || !this.facingRight && this.direction > 0)
            this.Flip();

        if (Input.GetKeyUp(KeyCode.S) && this.rigidbody.velocity.y > 0)
            this.shouldFall = true;
    }

    void FixedUpdate() {
        Vector2 velocity = this.rigidbody.velocity;

        if (this.shouldFall) {
            velocity.y = 0f;
            this.shouldFall = false;
        }

        if (this.shouldJump)
            velocity.y = this.jumpForce;

        velocity.x = this.speed * this.direction;

        this.rigidbody.velocity = velocity;
    }

    private void Flip() {
        this.renderer.flipX = this.facingRight;
        this.facingRight = !this.facingRight;
    }
}

I'm not sure if I got the idea of Update vs FixedUpdate correctly because of this lack of responsive jumps, and I'm guessing that if I add some more mechanics, later on, those will react the same or worse.

Something that I noted is that if I move everything to update it now feels right every time I press the jump button, but I'm still not sure if that should be the right approach when building tight controls.

And I still feel lost about what everyone means by "You should manage physics in FixedUpdate", what do you mean by physics here?

sentences:
What is the simplest 3D file format to parse? I want to parse Blender-Made Files directly into my homemade Lisp program. I've been pulling data out of .X3D files manually. Is this the best format to focus on writing a parser for?

Thanks!

sentences:
How to bend a 2D rectangle in an animation? It is something done often in 3D but I've never heard of it in 2D. I want to bend a 2D rectangle looking a bit like that:

I've seen people adding lots of vertex around knees and elbows of 3D models for that purpose. Should I make my 2D rectangle be lots of smaller triangles in order to bend it, just like in 3D? I feel like it's overkill just to bend a rectangle. Is there a better way to do this? I'm using LibGDX. I would like the rectangle to stay proportioned. Is there common algorithms to do that?

sentences:
Which is worst: Too many VertexShader instructions, or FragmentShader instructions? I want to have a better understanding of how to create shaders with optimal performance and realize where some bottlenecks can occur.

Is it usually favorable (when possible) to delegate most of the work to the VertexShader since in certain situations it may only need to process a few vertices vs. having the Fragment process the same thing potentially on thousands of pixels?

For example, if I have scrolling UV values for a texture, is it best that I pass this scroll amount in the Vertex-Shader so that it adjusts the start UV + scroll UV to a Variant register for the Fragment to read, or to just use a Fragment Constant with the scroll UV amount stored in it which will be added with the start UV's read from a Variant register?

Is passing values to one kind of Constant register (Vertex vs. Fragment) faster than the other?

sentences: Writing my own gravity I am writing a little game engine in LWJGL. I want to have a gravity, but I don't know correct equations. Let's assume that I've got a 3D vector marking gravity force in each axis(e.g. Vector3f(0.0, -9.8, 0.0) would be Earth's gravity), object's mass and object's CdA(coefficient of drag multiplied by approximated object area). I wanna know how to correctly calculate object's gravity!

sentences:
Reorder a set of points in order to draw a triangle fan (example) I'm doing a light engine (c++, using sfml), and to connect the light vertices, I thought about drawing a triangle fan.
Here is a representation of a triangle fan (sfml documentation):

The points HAVE TO be "ordered" to draw the shape correctly, otherwise it would mess the shape I suppose.

I drew the desired effect in ms paint:

As you can probably see, there is a central point, a light, and other points that I want to connect together. The problem is that the points are not always ... "In a row/Ordered" ? Let's see an example and simplify this problem.

In the example above, I can't connect the points from 0 to 8 because it would mess the shape.

I would like to reorder the points so I can connect them properly, like :

Do you have any ideas ?

I thought about doing something based on the "point in polygon" algorithm, like checking if the point is "on the right/left" but it seems complicated.

I don't necessarily need code (if you have time it would be nice) but I can try to do some, I just need ideas. Thanks

sentences:
Fixed Function vs Programmable Pipeline performance with many batches In OpenGL 2.0 I can easily make 10,000 draw calls per frame (with state changes in between each call).  However, if i try to do this in either OpenGL ES 2.0 or DirectX9 with shaders, my peformance is 1Hz.  Is there an inherent different between fixed function and programmable pipeline rendering that requires programmable pipeline to require much fewer draw calls per frame, or is it more likely that I'm just doing something stupid in my code? I thought that most fixed function pipelines were implemented in shaders nowadays anyway, so if it is the case that I have to batch, then how does the fixed function implementation get away with not batching if its really using shaders?

Any "official" resources you could point me to would be great.

sentences:
How to manage frustum culling I have a spherical clipmap based planet terrain. The entire planet is made from a ring geometry of 1 unit which the vertex shader moves to cover the entire planet of 6 million unit radius. But the planet gets culled whenever the starting point for this geometry isn't in the camera's view (which is 99.9999% of the planet).

What's the best solution for making sure the planet is viewable even when the original mesh isn't?

This is based on WebGL and Three.js.

sentences:
Confused about DXT/DDS compression and color depth I have done my research on DDS/DXT compression, and the information is kind of "everywhere." It is rather difficult to even find good, organized, sensible information on color depth. However, it is apparent that DXT5 changes the image to... RGB565?

Alright, so I am restricted to 16 bit color and RGB565. Makes sense.
I also read that converting it yourself, choosing the colors in the image, can stop or even entirely prevent loss of detail.

Nvidia's Photoshop plugin seems to degrade the quality to something much worse than other programs are capable of when converting an image to RGB565.

In particular, I use an absolutely wonderful tool which allows me to choose the colors. I altered my image to actually only include 128 colors. This is less than the 256 allowed by RGB565.

However, Nvidia's Photoshop plugin seems to ignore those colors, and chooses its own- as if I never changed the image in the first place. It's identical to what it was if I convert it to DDS from 24 bit Truecolor.

Why is Nvidia's tool not keeping my color table?
Why is it still lossy, and significantly worse at Nvidia's 256 colors, when my 128 color version is so superior and loses no quality or detail?

Currently, I am using "COLOR QUANTIZER", which is the best tool I have found to lower the number of colors without losing image quality.

I might be a little confused, as apparently TexturePacker's RGBA5555 is 20 bit and unsupported in a lot of frameworks, which confused me thinking RGB565 and RGBA5555 were both 16 bit. (Dur! The non-existence of RGBA5555 in google threw me off bigtime.) However, I assume I could easily achieve RGBA4444 (16 bit with alpha) because my colors can degrade in COLOR QUANTIZER to 128 colors, and RGBA4444 supports 256 colors. When I use TEXTUREPACKER or other programs, it is worse quality than in COLOR QUANTIZER. This program is simply superior in my experience, and I have been obsessive with all tools available to find the best one.

My images: PNG with pre-multiplied alpha. Can degrade to 128 colors, in COLOR QUANTIZER, before losing any quality. Alpha is a very big requirement, so RGB565 and DXT1 are out of the question. These are small sprites, which are smaller than 100x200.

My Goal: Low memory consumption and compression. Obviously, the best way to handle this would be DDS/DXT5 so I can keep the textures compressed in memory. Although I could handle RGBA4444, it is only a 2:1 compression, while DXT5 is 4:1. I would much prefer to use the DDS format.

sentences:
Making use of the Android GPU debugging tools I tried following the manual to install the Android GPU debugging tools for android Studio 2.0. Unfortunately it has not been very successful.
I have been following the instructions of the official documentation which are still for version 1 of the gpu debugging tools here: http://tools.android.com/tech-docs/gpu-profiler
It also isn't that helpful otherwise.

I am using an arm based emulator for testing since the abi specific folders specified in the manual are for arm abi's only.
Also the red button above the gpu monitor that is used to start the debugging tools is grayed out for me and it tells me that the gpu debugging tools are not installed when I hover over it.

Are there any extra steps I need to follow to get it to work?

sentences: In Hammer 3.4 where do I find the 'null' texure? I'm using Valve's Hammer Editor v3.4 to make maps for Counter-Strike 1.6.  I want to learn to use the 'null' texture to optimize my map by not drawing surfaces the player won't see, but when I search for it in the list of textures, I don't see it.  I'm guessing I'm not loading some WAD that I need, but I'm not sure which one it is.

sentences:
Good resources for learning about game architecture? Are there any good resources for learning about game architectures? I am looking for high level overviews of different architectures. I tend to find information about the various pieces of a game such as entities, physics engines, scripting, etc but not about how to bring all of the pieces together.

As a bonus, how does the type of game influence this? For example, a platformer and an MMO would have differences.

sentences:
Pure ECS, How to copy all components from one entity to another I am attempting to create component payloads using prefabs. My goal is to use

var entity = EntityManagerExtensions.Instantiate(EntityManager, ai_steeringPipelinePrefab[i].Prefab);

to get all the components I need copied over to another entity (including there data)

The only way i have found so far is to get the component types from the payload entity and add them to the recieving entity with

EntityManager.AddComponents(entity, componentTypes);

But this does not copy the data.

Thoughts?

sentences:
How can I randomly generate achievements? Novice programmer here.
To challenge my self i want to create an achievement system that randomly generates achievements for me based on a set of trackable metrics within my game.

To keep it as abstract as possible my game is a turn based highscore chaser. Each game has 13 turns. Each turn consists of placing 4 tiles, each tile can have an individual score which together form the turn score. There are 5 different tile types that can be individually combined to raise each tile's score differently. Each turn one of the 5 tiles gets a bonus making it worth double points. Also in each turn you can form "hands" similar to poker where for example two tiles of the same type next to each other are a pair, which nets a hand bonus for individual turns.

Here's what my generated achievements should look like:

Get a turn score of 15 and create a pair using tile type x.
Create a tile type y that has 5 points.
Create 5 hands of type x and use tile type x or y.
Get a total score of 50 without creating more than 3 hands of type x.

Obviously this seems kind of complicated and i'm kind of asking myself how to create such "complex" achievements. Seems like i need to establish some kind of syntax that i can feed the system to produce these kinds of requirements. But i'm kind of stuck since i couldn't find any info on this issue yet.

Maybe you have done something similar?

sentences:
What should I watch out for in a 3d artist's portfolio? I'm looking to hire a freelancer to help with 3d modeling. I've thought up a few qualifiers so far:

Is their topology okay for animation?
Have they demonstrated the technical capabilities necessary for my project? (Have they baked normals, AO maps, etc.)
Have they shown an ability to execute from conceptual drawings?

Are there any massively important things I should watch out for that I haven't included?

Any red flags I should be aware of, like making sure the work isn't plagiarized?

Note

I'm specifically talking about reviewing portfolio content, before interviewing them. I'm looking for things I can say yes or no to, or that I might want to question them on further in an interview.

sentences:
Blend Modes in Cocos2D with glBlendFunc We've been trying to replicate the most common blending modes that are available in Photoshop and Quartz 2D, but we've only come up with 3 and that's after some long searching online.

For anyone interested, here they are:

  Multiply = GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA
  Screen = GL_MINUS_DST_COLOR, GL_ONE
  Linear Dodge = GL_ONE, GL_ONE

You can try these and other such modes in action online, at this very useful website: http://www.andersriggelsen.dk/glblendfunc.php

Now, we would appreciate it if anyone could provide us with additional blending modes that we can recreate inside Cocos2D, since our Open GL experience is really, really limited.

Thank you in advance!

Argiris

sentences:
Is an ECS viable in garbage collected languages? I've done some research on Entity Component System architectures. Right now I have a convoluted OOP implementation which I'm planning on rewriting, so I was considering switching to a different architecture. Since everything was already composed using components, the switch from OOP to ECS shouldn't be too difficult. However, I'm doing my project in a language with managed memory and GC, and  a lot of the benefits of ECS are to do with memory management, processor cache, etc. so I was wondering whether there is any real performance advantage of ECS over OOP in a garbage collected language?
Also, I'm not too familiar with manual memory management and I haven't really used C/C++ for anything big.

sentences: Transparency issues Unity5 I made a potion that displayed and rendered perfectly in 3DS max. When I imported it to Unity it didn’t render correctly as the transparency was all over the place. I first imported it with a png texture with a separate png map for the alphas. I then tried using a .tga and a .psd file with alpha channels set up within the file but I got the same issues happen with both file formats. Does anyone know how to fix this I cannot seem to work it out.

sentences:
Move Sprite in constant speed on squircle I'm creating a game and i need to move a sprite on squircle path.

https://en.wikipedia.org/wiki/Squircle

i created the path using the  equation :

    angle -= Gdx.graphics.getDeltaTime()*speed ;
    float x = (float) (R*Math.pow(Math.abs(MathUtils.cos(angle)),1/10f)*sgn(MathUtils.cos(angle)))+a;
    float y = (float) (R*Math.pow(Math.abs(MathUtils.sin(angle)),1/10f)*sgn(MathUtils.sin(angle)))+b;
    sprite.setPosition(x,y);

the result is :

My question is how to make the sprite move in a constant speed

Edit :
i used the formula found on Wikipedia :

sentences:
Unity 5.3 Webgl Build not working on Google Chrome I am testing a game I build it on webgl and opened it on Google Chrome but nothing showed up just a screen with unity logo and no loading screen, then I tried on Firefox and it ran smoothly without any issues I am using unity 5.3.3f1 and Chrome 48 what can be the issue?
I am really looking forward for your replies, I searched on internet but in vain and not too many people answered this question on internet.

sentences:
Problem with Raycasting in a 2D Game I'm new to using unity and came across a problem when I was following a tutorial. The game is in two dimensional space, and when my player walks over a certain tile the detection never goes off. Here's the code that I have,

function calculateWalk() {

    yield WaitForSeconds(0.3);

    var hit : RaycastHit;

    if(Physics.Raycast (transform.position, Vector3.down, 100.0)) { // Never evaluates to being true
        var distanceToGround = hit.distance;
        Debug.Log("Hit");

        if(hit.collider.gameObject.tag == "tallGrass") {
            walkCounter++;
            Debug.Log("Tall Grass");
        } // END if
    } // END if
} // END calculateWalk()

I've made sure to attach the script to my player, as well as tag the tiles that I want with "tallGrass". I've followed what was done in the tutorial, but for some reason it's not working out for me, not sure if this is all the code needed to help solve this problem, if more information is needed let me know, I also set my player 1 unit above the tiles.

sentences:
How do 3d engines add textures to objects? I was wondering how 3d engines like Unity or OpenGL added textures to objects.

Example:

How would Unity add this texture to the side the arrow is pointing to?

sentences:
How can I find the right UV coordinates for interpolating a bezier curve? I'll let this picture do the talking. I'm trying to create a mesh from a bezier curve and then add a texture to it. The problem here is that the interpolation points along the curve do not increase linearly, so points farther from the control point (near the endpoints) stretch and those in the bend contract, causing the texture to be uneven across the curve, which can be problematic when using a pattern like stripes on a road. How can I determine how far along the curve the vertices actually are so I can give a proper UV coordinate?

EDIT: Allow me to clarify that I'm not talking about the trapezoidal distortion of the roads. That I know is normal and I'm not concerned about. I've updated the image to show more clearly where my concerns are.

Interpolating over the curve I get 10 segments, but each of these 10 segments is not spaced at an equal point along the curve, so I have to account for this in assigning UV data to vertices or else the road texture will stretch/shrink depending on how far apart vertices are at that particular part of the curve.

sentences:
3D format or software that stores a vertex normal At the moment i'm using .obj file format to store 3D models. It's popular, easy to read and parse. The issue is that it stores sufrace normals for each face. This isn't an issue for me yet, but i'm keeping in mind that i have to deal with lights once i'm done with the basics of my engine. This will require vertex normals and not surface normals. I want to avoid vertex multiplication and i want nice, curved surfaces. Blender seems to be unable to store vertex normals, only sufrace normals, is this typical of 3D rendering software and file formats?

Now i'm still kind of bad at profiling and i lack experience of what's "standard", but still i want to write effective code and i can't benchmark my ideas, so please excuse me asking weird questions here.

Is it "normal" to load surface normals from the .obj file and then for each vertex do an average of all the surface normals of surfaces that use this vertex (f.e. a plane "f " in .obj says vertex of index "i" has some normal "n", so i averate this normal "n" with the one already stored for this vertex)? This seems like such an expensive calculation to do when loading a model, is this the right way to think about it? Or is there a better way (or a file format/3D editor) to deal with this issue. Having multiple normals per vertex means that i have to duplicate vertices which is out of the question, not to mention that i'd get flat shading.

I'm mostly asking this because it seems illogical that a 3D model would be stored with surface normals that are very easy to calculate and not vertex normals which aren't easy to calculate and which are required for realistic lighting. Maybe it's a "legacy" thing?

Also, while we're on the subject, how do people deal with surfaces that have to be flat planes like a brick? For light calculations these models need vertices normals to be surface normals. but if i had a model like a knife that would consist of the blade that needs to be flat and the handle that i want round i would have to have the blade with duplicate vertices and the handle with not duplicate vertices which seems like a weird thing to request from my 3D softare (if it's even possible).

How do people deal with it, the only "smart" idea i can think of is to do separate models for flat objects (that would be stored in an innefficient way with vertex copies instead of indices) and separate models for round objets that would use the averating described above. The other idea is to have a program with a geometry shader in case i want to render a flat surface that would calculate a surface normal and set each vertex's normal to the one calculated and pass that to the fragment shader (though the extent of my geometry shader knowledge is a short article, haven't used them yet, is this even possible in OpenGL?).

I feel like i'm trying to brute force the issue, maybe there's a "magic" math trick that could help me or am i just stuck with more models or shader programs to manage.

sentences:
Scale Matrix Transform without moving primitive So I have the following....

GLbyte vShaderStr[] =
  "attribute vec4 vPosition;    \n"
  "uniform mat4 move;           \n"
  "uniform mat4 scale;           \n"
  "void main()                  \n"
  "{                            \n"
  "   gl_Position = vPosition;  \n"
  "   gl_Position = move * gl_Position;  \n"
  "   gl_Position = scale * gl_Position;  \n"
  "}                            \n";
...
void glScale2D(float y, float x){
float zoom[16] = {
    x, 0, 0, 0,
    0, y, 0, 0,
    0, 0, 1, 0,
    0, 0, 0, 1
};
GLint projectionUniform = glGetUniformLocation(userData.programObject, "scale");
glUniformMatrix4fv(projectionUniform, 1, 0, &zoom[0]);
}
...
glScale2D(userData.widthScreen/userData.heightScreen, userData.heightScreen/userData.widthScreen);

This works, however, it also moves the primitive so it goes from...

To...

Is there a matrix I can use to scale the primitive without moving it?

sentences:
C++ and SDL resource management for 2D game My first question is about stateManagers. I do not use the singleton pattern (read many random posts with various reasons not to use it), I have gameStateManager which runs the pointer cCurrentGameState->render(), etc. I want to make a transitioning game, this engine should ideally cover both a platformer and a bird's eye RPG (with some recoding, I just mean the base engine), both of which will load different levels and events, such as world map, dungeon, shops, etc. So I then thought, rather then having to store all this data within all the states, I would break the engine into gameStates, and playStates... when gameState reaches gameStatePlay(), gameStatePlay simply runs the usual handleInput, logic, and render for the playStates, just as the low level gameStateManager does. This lets me store all the player data within the base playstate class without storing useless data in the gameStates. Now I have added a seperate mapEditor, which uses editorStates from gameStateEditor. Is this too much usage of the gameState concept? It seems to work pretty well for me, so I was wondering if I am too far off a common implementation of this.

My second question is on image resources. I have my sprite class with nothing but static members, mainly loadImage, applySurface, and my screen pointer. I also have a map pairing imageName enums with actual SDL_Surface pointers, and one pairing clipNumber enums with a wrapper class for a vector of clips, so that each reference in the map can have different amounts of clips with different sizes. I thought it would be better to store all these images, and screen within one static body, since 20 different goblins all use the same sprite sheet, and all need to print to the same screen, and of course, this way I do not need to pass my screen reference to every little entity. The imageMap seems to work very well, I can even add the ability to search through the map at creation of entity type to see if a particular image at creation, creating if it doesnt exist, and destroying the image if the last entity that needs it was just destroyed. The vectored clip map however, seems to take too long to initialize, so if i run past the state that initializes them to fast, the game crashes ><. Plus, the clip map call is half of this line =P

SPRITE::applySurface( cEditorMap.cTiles[x][y].iX,
    cEditorMap.cTiles[x][y].iY,
    SPRITE::mImages[ IMAGE_TILEMAP ],
    SPRITE::screen,
    SPRITE::mImageClips[IMAGE_TILEMAP]->clips.at( cEditorMap.cTiles[x][y].iTileType ) );

Again, do I have the right idea? I like the imageMap, but am I better off with each entity storing its own clips?

My last question is about collision detection. I only grasp the basics, will look at per-pixel and circular soon, but how can I determine which side the collision comes from with just the basic square collision detection, I tried breaking each entity into 4 collision zones, but that just gave me problems with walking through walls and the like ><. Also, is per-pixel color collision a good way to decide what collision just occured, or is checking multiple colors for multiple entities too taxing each cycle?

sentences:
Problem Rendering TTF_Font Textures to one Texture with SDL2 I'm trying to render multiple lines of text to one texture so I only have to render one texture to the screen. However, when I use a dstrect argument in SDL_RenderCopy the text doesn't show up and when I use NULL for the dstrect argument it does work, but it is stretch to the entire texture which I don't want. I've checked the values of the dstrect (x,y,w,h) and they all seem to be at the right values when I try to render.

Here is the creation of the "Font Texture"

void Font::setMessage(std::string textureMessage, SDL_Color textColour){

if(text != NULL){
    SDL_DestroyTexture( text );
    text = NULL;
}

//contents is a string
contents = textureMessage;

//Render text surface
SDL_Surface* loadedSurface = TTF_RenderText_Blended( fontType, contents.c_str(), textColour );

if( loadedSurface == NULL ){
    std::cout << TTF_GetError() << std::endl;
}

if( loadedSurface == NULL ){
    //Error Check
    std::cout << "COULDN'T RENDER TEXT." << std::endl;
}
else
{

    //Create texture from surface pixels
    //text is of type SDL_Texture
    text = SDL_CreateTextureFromSurface( rendererPtr, loadedSurface );
    if( text == NULL ){
        //Error Check
        std::cout << "COULDN'T LOAD FONT TO TEXTURE." << SDL_GetError() << std::endl;
    }
    else{
        //w and h are int pointers to the SDL_Rect "textBox" offsets
        w = &textBox.w;
        h = &textBox.h;
        if( TTF_SizeText(fontType, contents.c_str(), w, h) != 0){
            std::cout << "COULDN'T SIZE FONT." << SDL_GetError() << std::endl;
        }
    }

}

//Get rid of old loaded surface
SDL_FreeSurface( loadedSurface );
loadedSurface = NULL;

}

And here is where I'm trying to render it to another texture:

    dstRect->x = xTemp;
    dstRect->y = yTemp;
    dstRect->w = messageLog.at(placeCount)->getW();
    dstRect->h = messageLog.at(placeCount)->getH();

    std::cout << dstRect->x << " " << dstRect->y << " " << dstRect->w << " " << dstRect->h << std::endl;

    if (messageLog.at(placeCount)->getSelf() != NULL){
        if ( SDL_RenderCopy(rendererPtr, messageLog.at(placeCount)->getSelf(), NULL, dstRect) != 0){
            std::cout << SDL_GetError() << std::endl;
        }
    }

Any ideas why giving an argument would make it not work but using NULL would?

sentences:
How can I optimise collision checks for a large number of AI units? Let's say I got 100 Orcs in my 3D world and they all aim to kill each other.

That means for every 1 Orc I have to check for collision with the 99 others. That will give me 99^2 which is about 10,000! That many collision checks every update (24-60 times a second) only for the AI will probably use my whole GPU + CPU.

How can I handle such a large number of AI?

How is this is done in games with large numbers of NPCs (e.g. Skyrim, Fallout, Red Dead Dedemption...).

sentences:
UV Packing Roadblock I noticed that when I was unwrapping and packing UV's in 3DS Max, that about 75% of the map was taken up by a bunch of repetitive small parts, because of their unique shape and inability to fit somewhere else. It's because of this that they turned out the way they did:

This is a problem for me because now I don't have much texture space for the important UV islands such as the sides of the gun handle. The circled part in viewport mode is the section that matches with parts like the one circled in UV editing, and there are a lot of them. I need them to be scaled proportionately because they are already small enough that they'll barely have any pixels on them anyways. Perhaps ovelrap them and use the same part of the texture for every other, or every third ridge? At this point I'm not sure. Any suggestions are appreciated. Thanks!

sentences:
How to develop multi-player game without involving server side code? There have been lot of cloud based frameworks released in past few years. They provide real-time communication among users but does not allow developers to write server side code.
So, how can we use these frameworks to develop mulitplayer games.

I want to know how we can deal with network latency and write prediction algorithm to recover network lag.

sentences:
How to make a text of several letters animate, only with an animation I wonder if it is possible to create an animation in a text with a single "animation". The problem is that for me to reach the desired effect I need to create an animation for each letter, as each one will appear a screen location. There is possibility to create this effect with just an animation? Remember that the deed is not the same as an animation into a sprite (one over another).

I did the animation for entering each letter on the screen, Curve > Transform > Position. (in the picture I tried to simulate using arrows to input source for each letter).

sentences:
Moving ships between two planets along a bezier, missing some equations for acceleration OK, I already posted this over at math.stackechange.com but didn't get any answers :(

First of here's a picture of my problem, the description follows afterwards:

So I got all the points and values set up.

The ship starts out moving around the left planet P1 with S=0.27 Degrees per gametick, when it reaches Point A it starts following the bezier curve till it reaches Point D, then it travels around the right planet P2 with S=0.42 Degrees per game tick. The difference in S is so that the travel with the same movement speed around the planets.

So far so good, I got that up and running, now my problem.

When S P1 and S P2 differ to much, the ship jumps between the two speeds when it reaches it's destination, which looks pretty bad. So I need to accelerate the ship between Point A and Point D from S P1 to S P2.

The thing I'm missing are in purple, those are:

A way to calculate the ticks it takes the ship to move along the bezier considering the acceleration.
And a way to find a position on the bezier curve based on T, again considering the acceleration.

ATM I calculate the length of the bezier by calculating the distance between N of its points. So what I think I need, is a way to scale the T I need to put into my bezier calculation accordingly to the acceleration.

sentences:
How do I let the an object know where in a matrix it is? Game Engine: Gamemaker Studio

Situation: I want 6 rows of 6 objects, each housed in a cell of a 6x6 matrix. However, this presents the problem of the matrix knowing what's in the cell, but the object in the cell doesn't know where in the matrix it is.

Reason why this is a problem is because I want to have events in the housed object's events that check adjacency to other objects in the matrix.

Question: How do I let the an object know where in a matrix it is?

Do I just need to have 2 variables in the object, which is set to the object's position in the matrix, or is there an easier way to do this? Or a better way, I guess.

Or perhaps the question is, is there a better way than the way I am doing?

How I'm using it Right Now:

//check if the last link in the chain is adjacent to the target link

     //includes diagonals
     if(obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y-1)
     || obj_Handle_Links.Last_Link.Matrix_Location_y = (Matrix_Location_y+1)
     || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x-1)
     || obj_Handle_Links.Last_Link.Matrix_Location_x = (Matrix_Location_x+1))
    {
        obj_Handle_Links.Match_Length +=1; //because we're increasing the length
        image_index = 1; //this should highlight
        //add to link - implement later
        obj_Handle_Links.Last_Link = id; //makes it so this is what's seen as last link
    }

sentences:
Pressing two on-screen buttons at the same time, with the same touch - Android Unity Event-Triggers OK so I have this code working and the methods are being called at the times I'd expected (ie. when the mouse hovers over the button and stops hovering over it)

But when I test it on an Android device, it is not possible to press both buttons at once. The only button that gets pressed is the one where the touch-down happened.

 public class EventHandlerThrust : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
 {
 public static EventHandlerThrust instanceOf;

 [HideInInspector] public bool isButtonPressed = false;

 void Start()
 {
     instanceOf = this;

 }

 public void OnPointerEnter(PointerEventData eventData)
 {
     isButtonPressed = true;
     Debug.Log("OnPointerEnter Interfaceyyyy called.");
 }

 public void OnPointerExit(PointerEventData eventData)
 {
     isButtonPressed = false;
     Debug.Log("OnPointerExit Interfaceyyyy called.");
 }
 }

So is it possible to allow the user to press both buttons by holding his thumb over both at the same time, using the Event Trigger System? Or do I have to implement some other kind of Input system?

sentences:
Preserve top right position and relative size to screen I have the following circle laid out where I'd like it at 1920x1080: http://imgur.com/a/PmvVA at 1280x720 it takes the same amount of relative screen space.

When the aspect ratio changes I want the circle to remain a circle and for it to always be top right aligned.

When I set the image to preserve aspect it gets pushed downwards like so: http://i.imgur.com/1sicdD5.png

How can I ensure the image stays top right aligned in all cases?

sentences:
How does pathfinding in RTS games work? [crossposted from stackoverflow]

In a game such as Warcraft 3 or Age of Empires, the ways that an AI opponent can move about the map seem almost limitless. The maps are huge and the position of other players is constantly changing.

How does the AI path-finding in games like these work? Standard graph-search methods (such as DFS, BFS or A*) seem impossible in such a setup.

sentences: i want to upload to 2gb model animation to vram with VBO technic but i am getting this error with nvidia (with amd no error) when i try to work with amd its working with amd hd6870 and ati x1550 but when i try to work with gtx 950 its giving this error. if i upload less than 2gb example 300mb then its working but i want to upload 2gb. what can i do ? sorry for bad english.

sentences: Is there a plugin to integrate Face FX with Blender? Is there a plugin to integrate Face FX with Blender? I only see plugins for Maya, Max, SoftImage, and MotionBuilder on the Face FX website.

sentences:
Find friend groups in a virtual social graph In my game, "people" form bonds through common interests.  A person may have 1 or more interests, and a certain weight (0f - 1f) attached to it.  Every now again, when 2 people are close to one another, relationships are formed based on common interests.  E.g., if I have interests such as "Movies, Cheese, and Art", and you have "Movies and Cheese", then we have a pretty strong bond.

This is all working great, and over time, all the people in my game have some sort of bond with others.

What I'd like to do now, is construct social groups in a somewhat efficient manner (my game has an asynchronous task manager, so if the calculation is somewhat heavy, it's not a show-stopper).  My current theory is to pick a person, look at his or her relationships, and then try to slowly build a graph to match as much like-minded people as possible.

I'm not 100% sure how to do this.  I was thinking of comparing interests with common friends, but wondered if there was a better way?  Currently relationships are stored as a person identifier, and then a list of (up to) 5 relationships, which contain their identifier, plus the weight.

The end result that I'd like, is a bunch of "groups" of like-minded people, that have been fed from this initial map.

What I'm looking for needs to be quite performant (with the caveat that I do have an asynchronous task manager), but the end result is that over time, social groups are constructed within which are people best suited to "hang out" with one another, based on their shared interests.

sentences:
How to render 2D particles as fluid? Suppose you have a nice way to move your 2D particles in order to simulate a fluid (like water). Any ideas on how to render it?

This is for a 2D game, where the perspective is from the side, like this. The water will be contained in boxes that can be broken in order to let it fall down and interact with other objects. The simplest way that comes to my mind is to use a small image for each particle. I am interested in hearing more ways of rendering water.

sentences:
XNA Rotating a Rectangle? I am in the process of making a giant shooter game and I have got to the point where I needed to use rectangles to detect bullets and giants hitting the player. I did that however, if you look at this image:

It shows the giant and the players rectangle, as you can see they are not rotating with the player, any idea how to fix this? Also yes I know they are no the same size as the sprites, that is because I set the size as they were to big before.

Thanks for any help :)

sentences:
Unity3d - Transform rotation(angle) help Im trying to rotate an object 90 degrees to the left but instead of rotating straight left it rotates 270 degrees to the right.

Here's the part of the code which controls the rotation:

rotationDestination = new Vector3(60, 270, 0);
if (Vector3.Distance(transform.eulerAngles, rotationDestination) > 0.2f) {
  transform.eulerAngles = Vector3.Lerp(transform.rotation.eulerAngles,
                                       rotationDestination,
                                       rotationSpeed * Time.deltaTime);
}

If I try to make the Y axis -90 a.k.a (60, -90, 0) then it rotates constantly to the left.

How do I make it rotate straight to the left (90 degrees) ?

Thank you.

sentences:
How can I make cars drive navigate an intersection without colliding? I'm trying to create a 2D game with a traffic intersection:

My car game-objects need to pass through the intersection without colliding with each other, and without stopping, if possible.

How can I implement such a behaviour?

sentences:
libGdx Window .pack() not working I'm trying to make a window, then use the pack method to get the right size, but the window maximizes instead. Here's my code:

private Table buildOptionsWindowLayer() {
    winOptions = new Window("Options", skinLibgdx);
    // (...) building some widgets

    Gdx.app.log(TAG, "pref width is " + winOptions.getPrefWidth());
    // displays: "pref width is 247.0"

    winOptions.pack();

    // move the window
    winOptions.setPosition(Constants.VIEWPORT_GUI_HEIGHT - winOptions.getWidth() - 50, 50);
    return winOptions;
}

The window ends up with a width of 800.0f. Why?

What it is supposed to render:

What it does render:

sentences:
Accelerometer input for flying game I'm trying to create an infinite flying game where the gameobject (a plane) keeps moving forward and at a particular height throughout the game. I want to be able to
roll and pitch the plane but not move it up/down. I added a rigid body to the plane and selected "y" position constrain. However the plane doesn't stay in the 'y' position but starts move up or down. I just have a script that translates the plane in the z direction. Not sure how to implement the mobile input and keep at the same "y" position throughout.

Update

Here is the code for the plane. Its very basic as I'm not sure how to use the accelerometer:

public class Player : MonoBehaviour {

public float speed = 1.0f;

void Update () {
    float tempx = Input.acceleration.x;
    float tempy = Input.acceleration.y;
    float tempz = Input.acceleration.z;
    transform.Translate(0, 0, 10); // move forward in z
    transform.Rotate( 0,  tempy * speed, tempz * speed);
}

As for the freezing of the 'y' position, I'm just selecting the y constraint available in the inspector that comes along with the rigidbody.

sentences:
What type of document for game design? What type of support/format do you use to store and diffuse your game design documentation?
Wiki? Doc files? Files in Repository? Shared folder? Google Doc?

Please provide pros and cons for each one.

sentences:
Unity Free Inverse Depth Mask? How would it be possible to create an inverse depth mask? In this case, I refer to a depth mask as a shader attached to a mesh that 'pokes a hole' through the current camera layer to let you see the camera render layer one depth down, usually by using ColorMask 0.

What I want is for, instead, the mesh to determine what ISN'T cut out, without everything that is NOT seen through the mesh being cut out.

sentences:
How to design a damage formula in an RPG which keeps weapons with different attack speeds balanced? I'm making a mobile rpg game, an infinite one where there is a loot system like Diablo 3. Weapons have attack and speed, armor pieces have a resistance value (not percentage).

The formula I'm using is:

float realDamage = SkillDmg * BaseDamage / ( BaseDamage + Defense )

The results are good, the damage gets bigger if the defense gets lower and it doesn't exponentially go up because of the division between ( BaseDamage + Defense ).

Lets say I have a sword with 1.0 attack speed that deals 50 damage. Thats 50 dps, and I have a dagger that I want it to attack faster, but of course deal less damage, to maintain the dps the logic says that if the daggers attack speed is doubled, the damage needs to be halfed (2.0 speed with 25 dmg ). But using the formula above you'll see that the actual real damage DPS is lower than the sword.

Iv'e solved this by making the dagger not do 25 damage but a bit more, doing some calculations I can make the real dps be the same to balance things. In this case the dagger at 2.0 speed would need to deal 32 damage to be the same real damage dps as the sword.

However, I want to display the DPS number on weapons. If I just display the daggers DPS as 32 dmg * 2 attackspeed it's going to be 64 dps, compared to the sword 50 dps, one will clearly say that the dagger is better, but of course it's not.

Possible solutions? Change the initial damage formula? If so to which one? Lets assume I don't change the formula, is there any solution? I really don't like having to trick the dagger to deal more damage than half to make it even...

I'd really wish I'd know the damage formula for diablo 3. I know that diablo 3 weapons DPS it's simply base damage * attack speed.

Edit:

Lets assume defense = 50 and normal attack (skillDmg = baseDmg)

Sword 1.0 attack speed dealing 50 dmg -> real damage hit=  50 * 50 / ( 50 + 50 ) = **25 dmg** = 25 dps

Dagger 2.0 attack speed dealing 32 dmg -> real damage hit = 32 * 32 / ( 32 + 50 ) = **12.5 dmg** = 25 dps

Sword item, lets display the actual sword dps, 50 * 1.0 = **50 dps**
Dagger item, lets display the dagger dps, 32 * 2.0 = **64 dps** (SHOULD BE THE SAME)

sentences:
How can I stop certain keys from being prioritized in a 2D platformer? I am currently working on a 2D platformer in Monogame. I have implemented WASD and arrow keys control, but because of the ordering of the if statements, the D key is always executed last if down, making the character flip the wrong direction.

if (Keyboard.GetState().IsKeyDown(Keys.Left) || Keyboard.GetState().IsKeyDown(Keys.A))
{
    if (Velocity.X > -MaxVelocity)
        Velocity.X -= Acceleration.X * time;
    spriteEffect = SpriteEffects.None;
}
else //Deceleration
{
    if (Velocity.X < 0)
        Velocity.X += Acceleration.X * time;
}

if (Keyboard.GetState().IsKeyDown(Keys.Right) || Keyboard.GetState().IsKeyDown(Keys.D))
{
    if (Velocity.X < MaxVelocity)
        Velocity.X += Acceleration.X * time;
    spriteEffect = SpriteEffects.FlipHorizontally;
}
else //Deceleration
{
    if (Velocity.X > 0)
        Velocity.X -= Acceleration.X * time;
}

Is there a way to prioritize the key that is pressed last, as well as only performing one every update cycle?

sentences:
How can I un-bloat my player input processing in my text based game? I'm writing a text based game, and I hit a snag with the user commands processing: so far I have a huge hardcoded ifelse block, and that does not seem good or scalable.

With single word non session commands it is easy:

> quit

Here I know I simply have to quit; but when it comes to multi word commands, like:

> help skills
> use bag
> take sword from bag

the if/elseif/else pattern is so cumbersome and not scalable.

Also, with regards to commands in one session, like so:

> open box
> look inside box
// you see next items inside box: one, two, three
> take one

how can I process different options depth, when each command received from client is processed from the beginning? How to respond with "first you must open box to take items from it" if user enters "take one" without prior "open box"?

How can I organize and process user input efficiently here?

sentences: What is isometric game? There is an understanding like isometric or 2.5D games. As I understand those are the same things. But I could not understand completely what is it. Is it about how the art for the game is drawn? I mean if art is drawn such that you see the game scene from the angle (visible from a top-down perspective or side view [from wiki]) and not perpendicular, is this isometric? Or there are some programming tricks that make game isometric, such as ability of the hero to move in 3 dimensions whereas it actually moves only in 2D like in old Nintendo games (Ninja Turtles or Double Dragon). Please explain this understanding.

sentences:
How can I access bitmaps created in another activity? I am currently loading my game bitmaps when the user presses 'start' in my animated splash screen activity (the first / launch activity) and the app progresses from my this activity to the main game activity,

This is causing choppy animation in the splashscreen while it loads/creates the bitmaps for the new activity.

I've been told that I should load all my bitmaps in one go at the very beginning.

However, I can't work out how to do this - could anyone please point me in the right direction?

I have 2 activities, a splash screen and the main game.  Each consist of a class that extends activity and a class that extends SurfaceView (with an inner class for the rendering / logic updating).

So, for example at the moment I am creating my bitmaps in the constructor of my SurfaceView class like so:

public class OptionsScreen extends SurfaceView implements
  SurfaceHolder.Callback {

      //Create variables here

 public OptionsScreen(Context context) {

Create bitmaps here
}

public void intialise(){                         //This method is called from onCreate() of corresponding application context

// Create scaled bitmaps here (from bitmaps previously created)

}

sentences:
Unity: Hiding Game Objects vs Creating them My game project involves collecting items that will be displayed in trophy cases of sorts.

There could be several hundred objects as the scale of the project increases, each with their own position, rotation and scripts.

I would find it easier to place the assembled items in their correct location using the editor and set their canvas group alpha to 0 (and set booleans in the script to inactive etc) and 'activate' them when they are 'collected' rather than instantiate them from prefabs as GameObjects.

My main question is about performance, is it costly to have my Gameobjects set in scene & created but set to 0 alpha? I don't need these objects to move or be destroyed etc.

My second question is about best practices for architecture design, is this a horrible way to do things? is a workaround for instantiating prefabs just lazy and counterproductive?

sentences:
Different executions with different results using the same Random seed in LIBGDX In my Libgdx project (for PC) I am using a Java Random object initialized with a constant seed. I use the Random object to generate a lot of different pseudorandom integers. I am not using multithreading, but the integers are a bit different each time I execute the application.

How can this be possible?

EDIT: What is really strange is that the Random object is called a few times more in some executions and I don't know why, causing the random numbers to be a bit different for each execution.

sentences:
Fastest visibility calculation towards all possible directions I am searching for your advice. I have a massive voxelized model, like the one in the picture (but with a few million voxels more..). To reduce the total number of the model’s triangulations, I can remove the shared faces among the voxels, nevertheless, the triangles will indeed remain MANY. What I need to do is create an index that will hold a boolean list (of visible/not visible) information, coming from the following procedure:

Define a set of points, like the centroids of the 3 yellow voxels in the picture (but, this set might again contain millions of points) and for each point calculate which voxels (except their corresponding containers) can be seen (direct and unblocked line of site) towards ALL directions (something like a global illumination concept). If the ray-source (coming from a given point) can reach even at the minimum a target voxel, it means we have a "true" condition for that voxel. For example, if we assume that the ray-source point in the picture is the light source, then all voxels in the blue circle are "true" for the specific point.

This has nothing to do with game development, so I am sorry if my post should be somewhere else. I just felt I should better ask here, because most of my searches conclude to ray-casting, hard shadows, visible surface determination, OpenGL, etc which are quite relevant here.  I do not need to see any graphics (or have high fps :D), just store the results for future usage into a 3rd simulation process.

I get the feeling that if I go with implementing simply geometric calculations this indexing will run for too long (even though this can be parallelized quite easily I believe). Nonetheless, can I take advantage somehow of OpenGL and GPU maybe? Will this boost significantly my task? How should I approach the problem?
 I am working on an ASUS ROG-G752VY.

I only have to construct and store this index (which I would not be surprised if it would turn out to be tens of GBytes). The rest of the simulation runs on a cluster continuously. This indexing calculation operation will run more or less only once.

I just don't know what execution time to expect (days/weeks/years) with this amount of ray-source points that I am mentioning along with a "brute" check towards all directions and voxels (with or without the use of OpenGL and GPU). Yet, I can predict that the max number of visible voxels every time will be just a few thousand.

That, because (sorry for not mentioning it) there is a life-termination logic of this ray when the distance of its travel exceeds "x" units ("x" will be much much smaller than the size of the total model). Hence, for a ray further than "x" the searching process should break every time.

Thank you so much already for your time!!!

sentences:
How to prevent creation of game object clones Within the script of one game object I am initializing another game object with a prefab. To make development easier (so I don't have to run the game for every change) I call the function in OnValidate(). Anytime I select the hasWindow bool a Window clone is created. So in situations that I select then deselect (doesn't go away) and reselect, two clones are created. I don't even have a window game object in my hierarchy, so I don't get why any clone is created. I want the window to appear when I select hasWindow and disappear (not hide) when I deselect within the inspector. How can I do this? The relevant code follows:

public bool hasWindow;

void OnValidate ()  {
    prepareWindow();
}

void prepareWindow  ()  {
    if (hasWindow) {
        window = (GameObject)Instantiate(Resources.Load("Prefabs/OtherPrefabs/Window"));
    }

}

sentences:
Agent trying to reach same position as other agents, instead start spinning in place I create units in my game and have a rally point where they should walk to when created, like Age of Empires.

My problem is that since they compete for this position after a while, sometimes they end up doing this:

https://gfycat.com/decentquestionableandeancondor

https://gfycat.com/densehonoredgalapagosalbatross

As you can see one of the guys cant reach the rally point, so he starts rotating.

I realize this has to do with stopping distance, but no matter how high I set the stopping distance this eventually becomes a problem when there are many enough units. And if I set it too high they dont walk to the rally point at all, since its not THAT far from the building they spawn from.

Is there any way to manage this scenario? i.e just making him go as close as he can, and then stop?

My AI Script:

using UnityEngine;
using UnityEngine.AI;

[RequireComponent(typeof(NavMeshAgent))]
public class BaseAi : MonoBehaviour
{
    [HideInInspector]
    public NavMeshAgent agent;

    [HideInInspector]
    public NavMeshObstacle obstacle;

    float sampleDistance = 50;

    Transform mTransform;

    private void Awake()
    {
        agent = GetComponent<NavMeshAgent>();
        obstacle = GetComponent<NavMeshObstacle>();
        mTransform = transform;
    }

    private void Start()
    {
        agent.avoidancePriority = Random.Range(agent.avoidancePriority - 10, agent.avoidancePriority + 10);
    }

    void LateUpdate()
    {
        if (agent.isActiveAndEnabled && agent.hasPath)
        {
            var projected = agent.velocity;
            projected.y = 0f;

            if (!Mathf.Approximately(projected.sqrMagnitude, 0f))
                mTransform.rotation = Quaternion.LookRotation(projected);
        }
    }

    /// <summary>
    /// Returns true if the position is a valid pathfinding position.
    /// </summary>
    /// <param name="position">The position to sample.</param>
    public bool SamplePosition(Vector3 point)
    {
        NavMeshHit hit;
        return NavMesh.SamplePosition(point, out hit, sampleDistance, NavMesh.AllAreas);
    }

    public bool SetDestination(Vector3 point)
    {
        if (SamplePosition(point))
        {
            agent.SetDestination(point);
            return true;
        }

        return false;
    }

    public void Teleport(Vector3 point)
    {
        agent.Warp(point);
    }

    /// <summary>
    /// Return true if agent reached its destination
    /// </summary>
    public bool ReachedDestination()
    {
        if (agent.isActiveAndEnabled && !agent.pathPending)
        {
            if (agent.remainingDistance <= agent.stoppingDistance)
            {
                if (!agent.hasPath || agent.velocity.sqrMagnitude == 0f)
                {
                    return true;
                }
            }
        }

        return false;
    }

    public void ToggleObstacle(bool toggleOn)
    {
        agent.enabled = !toggleOn;
        obstacle.enabled = toggleOn;
    }

    void OnDrawGizmos()
    {
        if (agent == null) { return; }
        if (agent.path == null) { return; }

        Color lGUIColor = Gizmos.color;

        Gizmos.color = Color.red;
        for (int i = 1; i < agent.path.corners.Length; i++)
        {
            Gizmos.DrawLine(agent.path.corners[i - 1], agent.path.corners[i]);
        }
    }
}

sentences:
Events to communicate between game objects in a component based system? I am planning to try and implement a small simple "game engine" thing, with game objects that have their components and all that. My problem is, how do they communicate with one another?

I understand event based communication is popular, but how does it work practically?
Let's say I make a platformer shooter, and the player needs to know about every platform, enemy, bullet, every frame. How will the events look? I thought the player should just say "hey scene manager, I need to know about the platforms. any chance you give me a pointer to those?" and then the player can just handle it. But generally, the address of the platforms (or any other game object) shouldn't change that much, so I am back to a situation where everyone knows about everyone else... This seems like events are useless in this case.

How are events practically used to communicate between objects? is my example the same as what is actually done in games? if not, then what do games do instead?

sentences:
How do I size my map in blender so it will be the right size in unity? I am working on a fps game but I cant get the size right of my map in blender, every time I export it to a .fbx file (unity won't work if it is a .blend file) it is a super small plane floor in unity the player controller is 10 as big as the map.
I don't know what to do.

sentences: How do I create a Loading Scene in SLick? I actually wanted just a fake loading scene. For a fake loading scene, how do I make a time variable or a time Method? I'm still a fresh java programmer!

sentences:
instancing and GPU skinning I'm trying to render a large number of identical rigged entities with independent animation.

Compared to standard skeletal animation, I can't compute the pose of each entities and send it to the GPU for each frame. This would demand too much work for the CPU and saturate the VRAM very quickly. Let's say I have 5000 entities with 20 bones, I would have to compute and send 5000 * 20 * (size of matrix/quaternion-translation/dual-quaternion) poses to the GPU, each frame.

I recently found this article/paper : https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch02.html Their idea is to load animations to the GPU in order to access them independently with each instance.
Correct me if I'm wrong but I think this is equivalent to move the interpolation part to the GPU.

I pre-computed all the bone transformation in local space for each frame for each animation and packed it into texture buffers. It works as expected.

However, I experience strange results with my animated models...
In fact the interpolation is necessarily wrong ! I am trying to interpolate between poses in local space, not in bone space like with standard CPU interpolation. There is no problem with translations, but with rotations. (the axis is shifted to the local space origin).

I imagine I could send the bone space transformations AND the bone hierarchy. But that would impose to parse the hierarchy for each vertex (in vertex shader), in order to re-compute the interpolated bone transformations.

One other idea I had is to upsample the animations in order to have smaller interpolation intervals, but again, it will use more VRAM.

To be honest I'm not sure I understood well the paper (especially in the interpolation part)...

Any suggestion ?

EDIT 1 : It's maybe unclear : by "local space" I mean entity space, so it is more like "global space"...

EDIT 2 : To provide more details about my implementation :

In the CPU (c++) pre-process part, I pre-compute all the bone transformations in local space for each frame (natively, I get bone-space transformations using Assimp library so I have to do a bit of work here).

Then, I send this information as an array to the GPU (array of numFrames * numBones * numAnims dual quaternions).
In the vertex shader, I get information about the current instance using gl_instanceID. I get world position, current animation and time in current animation.

Then I compute the interpolated pose of the bones influencing the current vertex. I do that by finding the bounding frames using the instance's time. I interpolate my pairs of transformations (pairs of dual quaternions) for each concerned bone.

(I know there is a mistake because the interpolation must be performed in bone space).

Once they are interpolated, I blend linearly the transformations into one using the bone weights attached to my vertex (and I normalize my final dual quaternion).

It worked when i was doing interpolation in bone space in CPU, I'm just trying to move the interpolation part on the GPU.

sentences:
What coding issues can be significant in damaging the performance of a game? I have just finished a 2D game in Java that I've been working on for a while.

I found that on some computers it runs fine, and on others (which are not particularly slow in general), the game runs a little slower, and with minor interruptions every second or so. Not completely smooth.

Since I am a beginner to making games, and probably since I didn't plan everything about the game in advance, the code of the game is rather long, clumsy and probably inefficient.

I want to improve this in my next projects. So my question is - In general, what would be the main causes for a common 2D game to slow down on a computer?

What should I pay the most attention to, next time, in order to design an efficient game?

Making a small amount of classes? (Even if the classes are small
ones?)
Avoiding repetition of code? (Even small sections of code, such as
short if statements).
Avoiding too many threads running?
Anything else?

Obviously, all of the above are recommended for an efficient program.

But I'd like to know, what in a game's code, could be especially significant for making an efficient application, and what would be less important and will not save significant amounts of memory.

Any advice would be welcome - could be regarding game design, or regarding more specific coding issues.

I don't know if this matters, but please note that I'm talking mainly about real-time games, using a 'game-loop' that constantly updates the game and the dispaly.

Thank you

sentences:
HTML5 multi-player game data/event validation best practices I'll start by saying that I am fully aware that this question might seem subjective at first, but I'll try and provide a specific test case scenario for it to be a clear question about validating the data received from 2 multiplayer game clients.

Scenario

Imagine we have a multi-player Tower Defense (TD) game. And let's assume that the game is built using HTML5 Canvas, Javascript and a multi-threaded web server, for example, Tornado running in the back-end. And in this scenario both of the players have an option to place a turret anywhere they want.

After a turret is placed, a bunch of enemies are released from both sides and move in a straight line towards the other side.

As soon as an enemy reaches turret range, we can assume that it is destroyed in 1-5 shots. If it takes more than that, the enemy safely passes to the other side.
Now, my problem lies in the fact that usually I would do all the validation server-side, but it becomes increasingly difficult to do, because I would need to simulate every step of the game.

Instead, I would like to depend on the event data (enemy destroyed/enemy gets safe passage) received from both clients.

Question

The main question then is this:

What is the best and hopefully easiest way to implement these sorts of checks and would there be anything prohibiting me from continuing with the development using HTML5, Canvas and Javascript?

sentences: Generate random number in Unity without class ambiguity I have a problem in Unity (C#) where I would like to create a random number. I wanted to use System.Random (reference: using System) but Unity complains that it's ambiguous to their own UnityEngine.Random. I can not specify the reference (using System.Random) as random is not a namespace. How do I specify that I want to use the system random and not the Unity one?

sentences:
UniRx: Subscribing to ReactiveProperty condition I'm trying to track a cold source with a contiguous range, and every example I've seen involves discrete increments or events that are already handled, so I'm vague on how to apply it.

Here's what I have:

ReactiveProperty<float> CurrentAlpha = new ReactiveProperty<float>(msg.GetComponent<CanvasRenderer>().GetAlpha());
CurrentAlpha.Where(x => x <= 0.0f).Subscribe(x =>
{
    Debug.Log($"CurrentAlpha == {CurrentAlpha} Observed");
    img.transform.SetParent(null);
    Destroy(msg);
});

I verified the alpha value, but never received notice when it reached 0. What have I mistaken?

EDIT: Found that it's actually subscribing to the value returned, which will always be 1. The value it receives is outside managed code, so there's no object property to observe, and CanvasRenderer itself doesn't observe it.

Is it possible to observe a method's return value?

sentences:
How to set multiple animations in cocos2d-x I'm currently starting with cocos2d-x to build games for blackberry/android/iOS.

I have the png and plist for the animations of a character created with texturepacker. I load them with CCSpriteBatchNode and CCSpriteFrameCache then I use a function created by me that loads all frames into an array of frames, then create a CCAnimation object and store the CCAnimate object created with the animation (code is more clear) the thing is that I have a function that detect touches and it is supposed to cycle through all animations, but it always crashes.

here is some code (this goes in the init()):

_batchNode = CCSpriteBatchNode::create("Character/girl.png");
_cache = CCSpriteFrameCache::sharedSpriteFrameCache();

_cache->addSpriteFramesWithFile("Personajes/girl.plist");

_character = CCSprite::createWithSpriteFrameName("girlneutral1.png");
_character->setPosition(ccp(winSize.width * 0.1, winSize.height * 0.5));
_batchNode->addChild(_character, 1);
this->addChild(_batchNode);
createAnimation(0, "girlpush", 8, 0.15f);
createAnimation(1, "girlneutral", 4, 0.3f);
createAnimation(2, "girlcrash", 12, 0.3f);
createAnimation(3, "girljump", 12, 0.2f);
createAnimation(4, "girltrick", 12, 0.3f);

_character->runAction(CCRepeatForever::create( _charanimation[3]));

this->setTouchEnabled(true);

the function that loads the animations (_charanimation[] is just an array of CCAnimate):

void HelloWorld::createAnimation(int a, CCString animation_name, int frames, float delay)
{
    CCArray* animframes = CCArray::createWithCapacity(frames);
    char str[100] = {0};
    for(int i = 1; i <= frames; i++)
    {
        sprintf(str, "%s%d.png", animation_name.getCString(), i);
        CCSpriteFrame* frame = _cache->spriteFrameByName( str );
        animframes->addObject(frame);
    }
    _charanimation[a] = CCAnimate::create(CCAnimation::createWithSpriteFrames(animframes, delay));
    //_charanimation[a]->getAnimation()->setLoops(-1);
}

and I get the animation to work (the one I set with runAction()) but if I try to change the animation, for example, when I touch the screen:

void HelloWorld::ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event)
{
    action++;
    action%=5;
    _character->stopAllActions();
    _character->runAction( CCRepeatForever::create(_charanimation[action]));
    char str[100];
    sprintf(str, "Animation: %d", action);
    pLabel->setString(str);

}

it crashes... I don't know if I am doing it wrong, if anyone could help, I will appreciate.

If I change the animation in runAction() it shows the animation correctly, but I can't change ingame with touches.

by the way, this is the error I get in console:

cocos2d-x debug info Assert failed: reference count should greater than 0
In function retain -- ..\..\cocoa\CCObject.cpp:92 m_uReference > 0 -- assertion failed

sentences:
The import aurelienribon cannot be resolved I've been having problems with using the Tween Engine by aurelien ribon for a Splash Screen for my 2d game. I'm using Eclipse and libgdx.

I've tried rebuilding, clean...-ing, and refreshing.

I've closely followed the import directions from here:
https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine

I'd be more than happy to provide anyone with more information/code if they need it.

The import file/lines of code (Game Renderer class):

package com.companyname.gameWorld;

import aurelienribon.tweenengine.Tween;
import aurelienribon.tweenengine.TweenEquations;
import aurelienribon.tweenengine.TweenManager;

build.gradle:

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"

        compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-bullet-platform:$gdxVersion:natives-x86"

        compile fileTree(dir: '../libs', include: '*.jar')
    }
}

...(other project(":...")s)...

project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"

        compile "com.badlogicgames.gdx:gdx-bullet:$gdxVersion"

        compile fileTree(dir: '../libs', include: '*.jar')
    }
}

The /libs folder:

sentences:
New to Game Development, need advice Possible Duplicate:
  What are some good resources for getting a beginner started in developing games?

I'm a CS student, having plenty enough knowledge in programming, and general algorithms. What is your suggestion in game developing? How to start?

Thanks a lot!

sentences:
Adding a profile to a dialogue box I am trying to create dialogue boxes that contain the profile picture of the speaking character in them. As such, I want the profile pic to be attached to the object itself. If I understand this right, the following creates a variable space for profilePic that I then populate within the GUI.

using UnityEngine.UI;

public class NPC : Character {

[SerializeField] private Image profilePic;
}

Then over in my dialogue script I have the following:

using UnityEngine.UI;

//This currently only allows for one sided conversations
//this can be later modified to add profile picture as well as several iterated conversations

public class Dialogue : MonoBehaviour {

    [SerializeField]
    private UnityEngine.UI.Text dialogueText;

    [SerializeField]
    private GameObject dialoguePanel;

    [SerializeField]
    private UnityEngine.UI.Image profilePic;

    private string[] dialogue;
    private int dialogueIndex;

    public void StartDialogue(string[] dialogue)
    {

        dialogueIndex = 0;
        this.dialogue = dialogue;
        dialoguePanel.SetActive(true);
        //This is what actually affects the GUI
        dialogueText.text = dialogue[dialogueIndex];
        this.profilePic = profilePic;

    }

The dialogue functions work. It should be taking the contents of this.profilePic and putting them into the UI.image profilePic component, right? The text works. The panel pops up. Just no picture.

Anyone have any thoughts?

sentences:
If a 3D vector represents a point, how can it have a length? I am trying to understand vector arithmetic (and specifically its use in the Unity engine). I am not able to figure out how a vector can have a length (magnitude) even though it only represents a point (position and direction)?

Does that mean that the magnitude is simply its distance from the origin point (0, 0, 0)? Or am I missing something?

sentences:
How do I prevent XNA from pausing Updates while the window is being resized/moved? XNA stops calling Update and Draw while the game window is being resized or moved.

Why? Is there a way to prevent this behaviour?

(It causes my network code to desynchronise, because network messages aren't being pumped.)

sentences:
Android: Loading bitmaps without premultiplied alpha (OpenGL ES 2.0) Is this possible? To load textures in non-premultiplied format (Straight alpha?)?

My game has 1 or 2 images which have semi-transparent pixels and I need to be able to fade them in and out but this doesn't seem possible easily.

As far as I understand Android always loads graphics in premultiplied alpha format, but if this is the case, how to blend them correctly?

Any help would be appreciated.

EDIT  I have included some code:

String strFShader =
"precision mediump float;" +
"varying vec2 v_texCoords;" +
"uniform sampler2D u_baseMap;" +
"void main()" +
"{" +
"gl_FragColor = texture2D(u_baseMap, v_texCoords);" +
"gl_FragColor.a *= "+opVal+";"+    //where opVal is a value from 0.0f to 1.0f
"}";

And then......

//Enable Alpha blending and set blending function

GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);

//Draw it
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

//Disable Alpha blending
GLES20.glDisable(GLES20.GL_BLEND);

Using this, the semi-transparent parts of the image will display too dark (including a dark border where anti-aliased edges should be) but will fade in and out (It's just no good though as the image isn't correct).

If I change the blending mode to:

//Enable Alpha blending and set blending function

GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

Then it will display perfectly at full opacity (1.0f) but becomes 'oversaturated' (This is the best way I can describe it) the more transparency you introduce (ie 0.9f down to 0.0f).

Thank you for the suggestions, as highlighted in the accepted answer in the end I didn't need to load without with "straight alpha" as I was able to correctly work with the pre-multiplied version that Android loads by default by changing the 2nd line of my Fragment shader to:

"gl_FragColor *= "+opVal+";"+

sentences: Line of Sight/Clear Path Check Theta* For Rectangle Character I am implementing Theta* pathfinding in a tile-based 2D game. A tile is either blocked or unblocked. The character has a rectangle collider with a width and height in tiles. Is there an algorithm for finding all the tiles the rectangle will overlap when moving in a straight line from A to B on the tile grid?

sentences:
FPS - How to handle accuracy with red dot sight on guns I have a gun which you can aim down the red dot sight. If you are moving while aimed down sight, there is some bobbing that comes into play. The arms are bobbing, not the camera itself.

Currently when the player fires their gun, I fire a ray from the center of the camera and check for a hit on a player.

The problem is, if the player is aiming and moving, the red dot is bobbing(since the arms are) but because the camera isn't, the ray always fires down the center which doesn't line up with the red dot. It Doesn't feel right in gameplay.

I was hoping someone may have some ideas to offer on how to handle this..

sentences:
Outline Shader Effect for Orthogonal Geometry in XNA I just recently started learning the art of shading, but I can't give an outline width to 2D, concave geometry when restrained to a single vertex/pixel shader technique (thanks to XNA).

the shape I need to give an outline to has smooth, per-vertex coloring, as well as opacity. The outline, which has smooth, per-vertex coloring, variable width, and opacity cannot interfere with the original shape's colors.

A pixel depth border detection algorithm won't work because pixel depth isn't a 3.0 semantic.
expanding geometry / redrawing won't work because it interferes with the original shape's colors.

I'm wondering if I can do something with the stencil/depth buffer outside of the shader functions since I have access to that through the graphics device. But I don't believe I'm able to manipulate actual values.

How might I do this?

sentences:
How can I efficiently implement a bitmask larger than 64-bits for component existence checks? In my ECS implementation, I use bit-wise operations (as described and illustrated in this thread) to tell an entity what type of components it currently consists of. So my Entity class has the following member:

unsigned long m_CompMask;

The different component types are then defined as an enum, whose member values are all power of two:

enum ComponentType
{
    COMP_TYPE_UNKNOWN                   = 0,
    COMP_TYPE_PERSON                    = 1,
    COMP_TYPE_RENDERABLE                = 2,
    COMP_TYPE_MOVEABLE                  = 4,
    [...]
};

Each time a new component is added to my entity instance, I do the following bit operation to update the mask (where newType is a member of the enum mentioned above):

m_CompMask |= newType;

This approach enables me to efficiently check if a certain entity instance has a certain component (and hence might be relevant for a specific system), like so:

return (m_CompMask & type);

The limiting factor in this approach however is the m_CompMask variable since it won't be able to handle more than 64 component types (if I increase it to unsigned long long).

I don't expect to be needing more than that in my current project, but nonetheless I'd like to hear some ideas regarding alternatives that allow more than 64 types (as big games certainly need to) while still maintaining the ease and efficiently of those bit-wise operations as much as possible? Any ideas how this is handled in "proper big" projects?

sentences:
How to use generic level editors with my arbitary code? I have a game, breakout clone. It has a Block class that contains CCSprite as a property.
Usually I made levels by manually setting those blocks to positions.
Here comes the question, how do I use generic level editors with my custom code? All editors work with CCSprites and not my class. How can I overcome that?

sentences:
Android, how important is deltaTime? Im making a game that is getting pretty big and sometimes my thread has to skip a frame, so far I'm not using deltaTime for setting the speed of my different objects in the game because it's still not a big enough game for it to matter imo. But its getting bigger then I planned, so my question is, how important is delta Time?

If I should use delta time there is a problem, since speedX and speedY are integers(they have to be for eclipse to let you make a rectangle of them), I cant add delta time very functionally as far as I understand, but might be wrong?
Ive tried adding deltaTime to the code below, and sometimes my enemies just not move after spawn, they just stand there and run in the same place

Will add an some code for how I set / use speed:

     public void update(int dx, int dy) {
        double theta = 180.0 / Math.PI * Math.atan2(-(y - controls.pointerPosition.y), controls.pointerPosition.x - x);

        x +=dx * Math.cos(Math.toRadians(theta));
        y +=dy * Math.sin(Math.toRadians(theta));
    currentFrame = ++currentFrame % BMP_COLUMNS;
}

     public void draw(Canvas canvas) {
    int srcX = currentFrame * width;
    int srcY = 1 * height;
    Rect src = new Rect(srcX, srcY, srcX + width, srcY + height);
    Rect dst = new Rect(x, y, x + width, y + height);
    canvas.drawBitmap(bitmap, src, dst, null);
}

So if someone with some experience with this has any thoughts, please share. Thank you!

Changed code:

    public void update(int dx, int dy, float delta) {
        double theta = 180.0 / Math.PI * Math.atan2(-(y - controls.pointerPosition.y), controls.pointerPosition.x - x);
        double speedX = delta * dx * Math.cos(Math.toRadians(theta));
        double speedY = delta * dy * Math.sin(Math.toRadians(theta));
        x += speedX;
        y += speedY;
    currentFrame = ++currentFrame % BMP_COLUMNS;
}

     public void draw(Canvas canvas) {
    int srcX = currentFrame * width;
    int srcY = 1 * height;
    Rect src = new Rect(srcX, srcY, srcX + width, srcY + height);
    Rect dst = new Rect(x, y, x + width, y + height);
    canvas.drawBitmap(bitmap, src, dst, null);
}

with this code my enemies move like before, except they wont move to the right (wont increment x), all other directions work.

sentences:
How is the render() method called in libGDX? I know that the project generator in libGDX finds the render(deltatime) method in my Game project and make it into a game loop so that it repeats itself on an average of 60 times per second. But I want to know how exactly the project generator finds the render() method.

Let me give you an example:

In my game, in the Main class, I declared a SecondClass with its own render() method using its constructor in the create() of the Main class. Then, I didn't have any render() method in the MainClass. When I did this, the render() in the SecondClass worked. However, when I created the render() method in the MainClass, the render() from the MainClass worked but not the render() method in the SecondClass. Does that mean that the project generator access the first render() it can see as the GameLoop?

sentences:
How do I pause/play animation in Unity without the animation getting cut off I'm trying to achieve a common game behavior that when you hit an enemy, then whatever the enemy's action (animation) is, when the hit happens, the enemy pauses a bit, then continues with the animation. So everytime you hit the enemy, the enemy pauses for a bit.

I currently have this code:

IEnumerator StopStartMotion()
{
    _animator.speed = 0;
    yield return new WaitForSeconds(.2f);
    _animator.speed = 1;
}

Problem is, sometimes, when I hit too early in the enemy's animation (like at the beginning of a punch), the enemy pauses, and then doesn't continue the animation where he paused for a bit. Is there a better way of doing this?

I tried animator.enabled as well, but the animation also jumps.

sentences:
Swap buttons in layout Say I have 4 buttons. I want to have button 2 always swap out with another button, randomly.
So, when the user taps button 2, it should swap with another button (randomly).

Now, button 2 is at the bottom right corner. So if the user taps button 2 again, it has the option to
swap with the other three buttons. How can I achieve this?

I have already tried to make an array of the four values:

top_right, top_left, bottom_right, bottom_left

And have successfully had them swap, but it was very memory inefficient, and took a while.

sentences:
are there any alternatives to developing android apps other than with eclipse Ever since I installed the android sdk and avd manager in eclipse for java developers, it's been pretty simple to create apps for the mobile device. The only issue I have is eclipse is way too slow for comfort. Sometimes it takes up to a minute to do simple things like opening up a java class file.

Are there any faster ways to utilize the android sdk/avd manager plugins in some alternative IDE that is stable?

sentences:
Unity: Smoothing between two floats which are continuously changing I'm looking for some help with smoothing between an original float and a target float, where the original float is consistently changing (potentially interfering with interpolation techniques and or Mathf.SmoothDamp)

I tried Mathf.SmoothDamp with the below:

(float rocketBoostPower is a global variable)

float yVelocity = 0.0F;
float tempForce = rocketBoostPower + Input.GetAxis("Mouse Y") * shiftSpeed / 5f;
rocketBoostPower = Mathf.SmoothDamp(rocketBoostPower , tempForce, ref yVelocity, 0.5f);

This doesn't change the force at all however, it just stays locked in place.

I'm currently using the below to change my power, however I want to smoothly change the power instead of just incrementing sharply on each Update frame:

rocketBoostPower += Input.GetAxis("Mouse Y") * shiftSpeed / 5f;

Please can someone help? I need the assumption that every update will receive a new rocketBoostPower value, whilst still smoothing its previous value.

sentences:
How to slide a non-kinematic rigidbody? I'm studying Unity3d, coming from a 2d background, and I'm a bit confused how some things work.

I'd like to slide a non-kinematic rigidbody, i.e. "just move it forward", like if it was hovering over the terrain. Applying a force makes a ball rotate forward, while I wanted it to slide forward without rotating, also unless that force is huge, a cube just won't move (for the same reason).

I understand there are kinematic objects which are "easier" to "just move", but I both think I might really need non-kinematic ones, and I think I need to understand them anyway.

edit: I did try to use some "rotation constraints/freeze", but they just prevented the sphere from moving at all.

sentences:
How does input work when exporting to Android? I know I must add Android sdk , but my question is this :

If I make a game that works with the mouse, for example a puzzle game, then I output my game to Android, do I have to rewrite it to work with the touch screen?

sentences:
Moving while doing loop animation in RPGMaker I made a custom class to display character portrait in RPGMaker XP
Here is the class :

class Poser
  attr_accessor :images

  def initialize
    @images = Sprite.new
    @images.bitmap = RPG::Cache.picture('Character.png') #100x300
    @images.x = 540 #place it on the bottom right corner of the screen
    @images.y = 180
  end
end

Create an event on the map to create an instance as global variable, tada! image popped out. Ok nice. But Im not satisfied, Now I want it to have bobbing-head animation-like (just like when we breathe, sometimes bob our head up and down) so I added another method :

  def move(x,y)
    @images.x += x
    @images.y += y
  end

  def animate(x,y,step,delay)
    forward = true
    2.times {
      step.times {
        wait(delay)
        if forward
          move(x/step,y/step)
        else
          move(-x/step,-y/step)
        end
      }
      wait(delay*3)
      forward = false
    }
  end

  def wait(time)
    while time > 0
      time -= 1
      Graphics.update
    end
  end

I called the method to run the animation and it works, so far so good, but the problem is, WHILE the portrait goes up and down, I cannot move my character until the animation is finished.

So that's it, I'm stuck in the loop block, what I want is to watch the portrait moving up and down while I walk around village, talk to npc, etc.

Anyone can solve my problem ? Or better solution ? Thanks in advance

sentences:
Qt opengl glTexImage2D in a widget I was doing an OpenGL display, where I render in an opengl context (GLUT).

But now I would like to integrate it into a big project that does not use the Qt OpenGL API at all (QGLWidget, QOpenGLWidget, …).

So I would have to display on QWidget for example using the function glTexImage2D () because it can take a Qimage input ((GLvoid *) Qimage.bits ())

sentences:
Calculating specific coordinate along a path Let's say I have a path comprised of a sequence of points that are connect by lines and arcs. The entire path has some specific length. Let's call that length 100.

What would be the mechanism to determine the exact x,y coordinate for any given point on that path?

meaning...

 Path path = new Path();
//fill in various lineTos and arcTos to the path here
....

Point p = getCoordsFromPath(path, 50.0f); //get the coords at the half way point on the path

Point getCoordsFromPath(Path inP, float position){
    Point ret;
    //do some magic and get the x,y at the point in the path
    //that is the position distance from start

    return ret;
}

TIA

sentences:
Exporting .FBX model into XNA - unorthogonal bones 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 . . .

sentences:
How can i exclude "Y" from drag in unity? I'm trying to make a moving object drag when no input is received, but i want the drag to only apply to X and Z variables, and not Y. Meaning i want it to fall at a normal speed, but when i stop giving it force in x and z directions, i want it to gradually and quickly stop going in those directions. How can i achieve this?

I've done this:

Vector3 input = new Vector3(Input.GetAxis("Horizontal") , 0, Input.GetAxis("Vertical");
If (input.x == 0 && input.z ==0) rb.drag = 3;

sentences: How to move an object in a heart shape pattern in javascript? How can I move an object in a heart shaped pattern? I have a move(x, y) function that I can use to move the object, but how to I make a function that will move the object in a heart shaped pattern, with something like a setInterval?

sentences: How to program (architecturally/organize) a set of customizable changes to a game? The floor of my game (tower defense) is composed by a set of cubes. I wish to change these on some of the waves. I have a list of the changes that need to be made on each wave in a floorController class. However, in order to decide which floor cubes should appear or disappear on each round, I had to assign each cube a bool for each wave (if this is set to true the floor changes in that wave). However this process is tedious and not ease to change and customize in order to experiment with the level. From an architectural programming perspective how can I better structure this system?

sentences:
Pitch camera around model Currently, my camera rotates with my model's Y-Axis (yaw) perfectly. What I'm having trouble with is rotating the X-Axis (pitch) along with it. I've tried the same method for cameraYaw() in the form of cameraPitch(), while adjusting the axis to Vector.Right, but the camera wouldn't pitch at all in accordance to the Y-Axes of the controller.

Is there a way similar to this to get the same effect for pitching the camera around the model?

// Rotates model on its own Y-axis
    public void modelRotMovement(GamePadState pController)
    {
        Yaw = pController.ThumbSticks.Right.X * MathHelper.ToRadians(speedAngleMAX);

        AddRotation = Quaternion.CreateFromYawPitchRoll(Yaw, 0, 0);
        ModelLoad.MRotation *= AddRotation;
        MOrientation = Matrix.CreateFromQuaternion(ModelLoad.MRotation);
    }

    // Orbit (yaw) Camera around model (camTarget is the model's position)
    public void cameraYaw(Vector3 axis, float yaw)
    {

        ModelLoad.CameraPos = Vector3.Transform(ModelLoad.CameraPos - ModelLoad.camTarget,
            Matrix.CreateFromAxisAngle(axis, yaw)) + ModelLoad.camTarget;
    }

    public void updateCamera()
    {
        cameraYaw(Vector3.Up, Yaw);
    }

sentences:
Will scaling images at runtime impact my game's speed? I have read the android developer guide to working on different screen sizes. My question is, if I only provide one image in the drawable file, and let android scale it for me, will it impact the overall performance of my app?

For example, I am simply displaying a red square, and there aren't any details to the square. Should I provide alternative resources, will android's scaling impact my performance as an app on bigger/smaller screens?

sentences:
Exact collision time of two axis-aligned bounding boxes I am trying to calculate the exact collision time of two axis-aligned bounding boxes (aabb) as fast as possible (in the sense of CPU time).

I have all the required information (aabb min, max, center, etc., velocity vector, and so on)
My aabbs are not rotating, so they have linear velocity
The aabbs can be both moving, only one of them might be moving, or they both might be steady

My current approach creates lines from one of the boxes' corners and checks the collision among the planes of the other box (you can see the algorithm below); however it takes 6 times longer than I can afford. So, I am trying to find a faster algorithm; however, I couldn't have managed, yet.
My current "slow" algorithm:

Add velocity of Aaabb to Baabb and assume Aaabb is steady and Baabb is moving
Calculate the corner positions of Baabb
For each corner of Baabb, perform the line-plane intersection with Aaabb's each 6 planes (I use the line-intersection formulate (algebraic form) on Wikipedia) to check if there is an intersection.
If a corner of Baabb intersects with a plane of Aaabb, verify the intersection point is behind the other 5 planes of Aaabb
Keep the smallest value of d and return

sentences: DrawString and Render graphics after custom time I want to draw String after some second like "Boss is incoming",and after the string is disappeared i want to draw the Boss.I have the graphics and the string so my question is how to add timer for string and graphics?

sentences: What Javascript game engines are out there, other than Impact? Does anybody know of a decent (meaning preferably free ;)) alternative to Impact? Any suggestions are very much appreciated!

sentences: Is it possible to configure a unity project so it only runs on a device? I am want to give someone a sample Android Unity project and I want them to be able to run it only on a device, not the simulator. Is there a way that I can configure the project so that it will only run on a device?

sentences: Should I used Box2D for a Flash platformer or use something for gaming like Fixel or Flashpunk? I'm trying to make a platformer with Flash/AS3 and have been looking for something to help with some of the collision etc. I've look at a few engines and Box2D/WCK seems the most sophisticated. Do I need that level of sophistication or should I just stick to something simple like Fixel or Flashpunk? OR should I just do everything myself?

sentences:
Finding x and z value in the direction of another object In my game you can drive a car and it has an arrow point to an object you need to drive towards. The arrow pops up above the car using the same x and z value as the car but adding 2 to the y value. What I am trying to do is push the arrow out a little bit toward the object it is pointing to. This way it looks like it is rotating in a circle around the car instead of rotating about it's own center point.

This is what I am doing right now:

if (!(Vector3.Angle(car.transform.forward, obj.transform.position - car.transform.position) < 40f))
{
    arrow.SetActive(true);
    temp = car.transform.position;
    temp.y = car.transform.position.y + 2f;
    arrow.transform.position = temp;
    temp = obj.transform.position;
    temp.y = arrow.transform.position.y;
    arrow.transform.LookAt(temp);
}

sentences: VSCode doesn't open the specified Unity script I have downloaded Visual Studio Code to edit Unity scripts. When I double click on a script in Unity, VSCode opens but it doesn't open the script, only an empty file called Unity appears. Anyone knows how to solve this?

sentences:
Detecting extremely fast joystick button presses? Is it usually possible for the player to press and release a button within a single frame, so that the game engine doesn't have time to detect it?

How do programmers usually handle this situation?  Is it even necessary to handle it?

While testing, I was able to press and release a button within about 14 or 15 milliseconds (over 1 click/frame).  I was not, however, able to do this while holding the joystick normally, and the press-release cycle would have to start at almost the exact time the frame starts.

Specifically, I am asking about GLFW's joystick input capabilities.

I am currently using GLFW to make a game, and I've noticed that keyboard and mouse have callback functions, while joysticks do not.  Also, it does not appear to be possible to enable "sticky keys" for a joystick.  (I have only recently started using GLFW, so please correct me if I am wrong, as having either of those would solve the problem.)

Although I am asking about GLFW, answers related to any library/engine/language are welcome.

sentences:
Cocos2dx - Physics - Abort() When Changing Dynamic PhysicBody to Static? I just learned cocos2dx v3.3 integrated chipmunk physics engine.

Here ,as you see, I create a simple circle with physic as:

auto sprite = Sprite::create("circle.png");
auto body = PhysicsBody::createCircle(sprite->getContentSize().width / 2);
body->setContactTestBitmask(-1); //active collisions event
sprite->setPhysicsBody(body);
sprite->setPosition(...);
this->addChild(sprite);

When I toggle this circle static/dynamic in normal situation everything work fine and when circle become static it stop in its position (as we expect gravity don't move it longer). here is a toggle code which works fine:

body->setDynamic(false);
scheduleOnce([=](float dt){body->setDynamic(true);},3,"Back to Dynamic Mode Timer");

PROBLEM BEGINS

But I want when the circle collide with something else ( in my case screen edge with is not important part of scenario), it become static then. so I use below code:

auto contactListener = EventListenerPhysicsContact::create();
contactListener->onContactBegin = [=](PhysicsContact &contact) -> bool
{
    return true;
};
contactListener->onContactPostSolve = [=](PhysicsContact& contact, const PhysicsContactPostSolve& solve)
{
    contact.getShapeA()->getBody()->setDynamic(false); // ==> Cause Abort() !
};

_eventDispatcher->addEventListenerWithSceneGraphPriority(contactListener, this);

But I just face a abort() message and game exit.

The call stack ( God bless it) show that the error is comming from line 300 in CCPhysicsBody.cpp:

if (_world != nullptr)
{
    cpSpaceRemoveBody(_world->_info->getSpace(), _info->getBody());
}

sentences:
Rotate a bitmap and bitmap is getting blur in android I am developing an android game. and in this I want to move an object along a Bezier path.

my object is rotating with some angle on this curve.

I used this piece of code:

public void update() {

        // check collision with bottom wall if heading down
        if (droid.getSpeed().getyDirection() == Speed.DIRECTION_DOWN
                && droid.getY() + droid.getBitmap().getHeight() / 2 >= getHeight()/2 &&
                droid.getY() + droid.getBitmap().getHeight() / 2 <= getHeight()/2+ 100 ) {

            int pointX[], pointY[];
            pointX = new int[4];
            pointY = new int[4];
            int  X , Y;

                pointX[0] = getWidth()/2;
                pointX[1] = getWidth()/2 + 50;
                pointX[2] = getWidth()/2 + 25;
                pointX[3] = getWidth()/2;
                pointY[0] = getHeight()/2;
                pointY[1] = getHeight()/2 + 25;
                pointY[2] = getHeight()/2 + 50;
                pointY[3] = getHeight()/2 + 100;

                Log.i(TAG, "In the While Zone of Last Half Zone");
                X = (int) ((pointX[3] * u * u * u) + (3 * pointX[2] * u * u * (1-u)) + (3 * pointX[1] * u * (1-u) * (1-u)) +
                    (pointX[0] * (1-u) * (1-u) * (1-u)));

                Y = (int) ((pointY[3] * u * u * u) + (3 * pointY[2] * u * u * (1-u)) + (3 * pointY[1] * u * (1-u) * (1-u)) +
                        (pointY[0] * (1-u) * (1-u) * (1-u)));

                Log.i(TAG+" Value of X: ", Double.toString(X));
                Log.i(TAG+" Value of Y: ", Double.toString(Y));

                double deltaX = X - droid.getX();
                double deltaY = Y - droid.getY();

                Log.i("deltaX :", Double.toString(deltaX));
                Log.i("deltaY :", Double.toString(deltaY));

                double angle = Math.atan2(deltaY, deltaX)  ;
                Log.i(TAG+" Angle: ", Double.toString(angle));
                Matrix mtx = new Matrix();
                mtx.preRotate((float) angle);
                mtx.postScale(1, 1);

                Bitmap rotatedBMP = Bitmap.createBitmap(droid.getBitmap(), droid.getX(), droid.getY(),  X - droid.getX(), Y - droid.getY(), mtx, true);
                droid.setBitmap(rotatedBMP);
                droid.curveUpdate(X, Y);
                u = u + 0.001;
                Log.i(TAG+" Value of U: ", Double.toString(u));

        }
        // check collision with top wall if heading up

        // Update the lone droid
        else{
            droid.update();
        }

    }

my object is moving and rotating as i supposed but image is getting blur. am not getting why is so.

Please suggest what can be the problem.

Thanks.

sentences:
Efficient minimum distance between two axis aligned squares? I have two 2D arbitrarily-positioned axis-aligned squares.

I need to find the minimum distance between those squares – i.e. if you were to draw them, what's the length of the shortest line you could draw that would touch both?

Now, I have an algorithm that works. The problem is it's quite slow. Here it is:

function min_distance(a_left, a_right, a_top, a_bottom, b_left, b_right, b_top, b_bottom) {
    if (a_left <= b_right && a_right >= b_left && a_top >= b_bottom && a_bottom <= b_top) {
        return 0;
    } else if (a_left <= b_right && a_right >= b_left && a_top >= b_bottom/* && a_bottom <= b_top*/) {
        return a_bottom - b_top;
    } else if (a_left <= b_right && a_right >= b_left/* && a_top >= b_bottom*/ && a_bottom <= b_top) {
        return b_bottom - a_top;
    } else if (a_left <= b_right/* && a_right >= b_left*/ && a_top >= b_bottom && a_bottom <= b_top) {
        return b_left - a_right;
    } else if (/*a_left <= b_right && */a_right >= b_left && a_top >= b_bottom && a_bottom <= b_top) {
        return a_left - b_right;
    } else if (/*a_left <= b_right && */a_right >= b_left/* && a_top >= b_bottom*/ && a_bottom <= b_top) {
        let a = a_left - b_right;
        let b = b_bottom - a_top;
        return Math.sqrt(a*a+b*b);
    } else if (a_left <= b_right/* && a_right >= b_left && a_top >= b_bottom*/ && a_bottom <= b_top) {
        let a = b_left - a_right;
        let b = b_bottom - a_top;
        return Math.sqrt(a*a+b*b);
    } else if (a_left <= b_right/* && a_right >= b_left*/ && a_top >= b_bottom/* && a_bottom <= b_top*/) {
        let a = b_left - a_right;
        let b = a_bottom - b_top;
        return Math.sqrt(a*a+b*b);
    } else if (/*a_left <= b_right && */a_right >= b_left && a_top >= b_bottom/* && a_bottom <= b_top*/) {
        let a = a_left - b_right;
        let b = a_bottom - b_top;
        return Math.sqrt(a*a+b*b);
    } else if (a_left <= b_right/* && a_right >= b_left && a_top >= b_bottom && a_bottom <= b_top*/) {
        return b_right - a_left;
    } else if (/*a_left <= b_right && a_right >= b_left && a_top >= b_bottom && */a_bottom <= b_top) {
        return b_top - a_bottom;
    } else if (/*a_left <= b_right && a_right >= b_left && */a_top >= b_bottom/* && a_bottom <= b_top*/) {
        return a_top - b_bottom;
    } else if (/*a_left <= b_right && */a_right >= b_left/* && a_top >= b_bottom && a_bottom <= b_top*/) {
        return a_right - b_left;
    } else { unreachable() }
}

This can also handle rectangles, whereas I only need squares.

Are there any known algorithmic tricks to calculate this substantially faster?

sentences:
Best way to create neon glow line effect in AS3? What's the best way to create a neon glow line effect in Flash AS3? Say similar to what's going on in the game gravitron360 on the xbox 360?

Would it be a good idea to create movieclips with plain lines drawn in them and then apply a glow filter to them? or perhaps just apply the glow filter to the entire movieclip layer the movieclips are on? or just draw them manually and create a glow effect by converting the lines to fills and then softening edges? (wouldn't blend as well but would be the fastest CPU wise?)

Thanks for any help

sentences:
Encode world matrix as 2 float4s? On one of the slides of their presentation "Batch, Batch, Batch!" guys from NVidia suggest encoding animation matrices for pallet skinning into two float4s as:

• axis/angle
• translate/uniform scale

I wonder how can that be done (including decoding) and why do they say that this leads to:

Video memory overhead: model replication

sentences: State of art shadowing technique for OpenGL on isometric terrain? What's the most efficient way of creating shadows for object on a isometric terrain with OpenGL and JOGL? Note that this terrain is not flat and is not heightmap generated. Think it as another model. However objects' shadows on other objects is just nice to have.Objects must drop shadows just on the terrain.

sentences:
Show the edges between the clipping plane and clipped objects I want to utilize shaders to not only discard fragments if they are on one side of a predefined plane but also render a contour along the intersection.

My fragment shader currently does something along the lines of:

float dot = dot(world_coordinate, normalize(clipping_normal.xyz)) - clipping_normal.w;
if (dot > 0.0f)
    discard;

this works but without the desired contour. I tried comparing the dot product against values close to 0.0 but this results in a contour with varying width depending on view etc...

This is what I am trying to achieve. Notice that the white contour/edge of where the plane intersects the sphere is of consistent width:

So below is what the result I currently see:

With the fragment shader:

in vec4 color;
in vec3 world_position;

out vec4 frag_color;

void main()
{
    float dist = (dot(clipping_plane.xyz, world_position) - clipping_plane.w) /
              dot(clipping_plane.xyz, clipping_plane.xyz);

    if(dist >= 0.0f && dist < 0.05f)
        frag_color = vec4(0.0f, 0.0f, 0.0f, 1.0f);
    else if(dist < 0.0f)
        discard;
    else
        frag_color = ComputePhong(color);
}

sentences:
Rotating on a slanted surface? I want to rotate (change it's yaw) an object when its sitting on slanted ground. Pretty much I want to rotate around the ground's normal.

Right now I ray cast down, get the ground's normal.
Then I do:

Tick(deltaTime)
{
  Quaternion rotationDelta = QuatFromAxisAngle(groundNormal, rotationRate * deltaTime);
  ObjectRotation = rotationDelta * ObjectRotation;
}

But this isn't giving me quite the right results. Any suggestions?

Before Rotation:

A rotation of 90 degrees:

sentences:
Enemy walks to the nearest player? I'm trying making my enemy goes to the nearest player to him but what i get is kind of hesitated or shaking. I think is from the first line on Update but i don't know how to solve it. Here is my script

private Animator enemy_anim;
private NavMeshAgent mAgent;
private GameObject[] player;
public GameObject[] dead_point;
public int farPoint, dead_point_number,player_number;
public float dist;
public bool enemt_run, enemy_atack = false;

void Start()
{
    mAgent = GetComponent<NavMeshAgent>();
    enemy_anim = GetComponent<Animator>();
    player = GameObject.FindGameObjectsWithTag("Player");
    dead_point = GameObject.FindGameObjectsWithTag("dead_point"); // 3 points
    enemy_dirction();

}

void Update()
{
    player_number = Random.Range(0,player.Length);
    dead_point_number = dead_point.Length;
    dist = Vector3.Distance(transform.position, player[player_number].transform.position);

    if (player != null && dist <= 5.1f)
    {
        mAgent.destination = player[player_number].transform.position;
        if (dist < 1.2f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
        }
    }
    else
    {
        if (dead_point_number > 0)
        {
            mAgent.destination = dead_point[farPoint].transform.position;
        }
        else
        {
            mAgent.destination = player[player_number].transform.position;

        }
        if (mAgent.remainingDistance <= 1.5f)
        {
            enemy_atack = true;
        }
        else
        {
            enemy_atack = false;
            enemt_run = true;

        }
    }

    mAgent.speed = 1.0f;

    enemy_anim.SetBool("run", enemt_run);
    enemy_anim.SetBool("attack", enemy_atack);
}// end update

void enemy_dirction()
{
    if (dead_point_number > 0)
    {
        farPoint = Random.Range(0, dead_point.Length);
        mAgent.destination = dead_point[farPoint].transform.position;
    }
    else
    {

    }
}

sentences:
Turn based multiplayer, Google services or Parse or.. I have a turn based game on Google play already (paid with around 2000 users and free with around 50k).i am thinking of adding multiplier option to it. I am unable to progress because I don't know which path to take (given its my first multiplier game). I need your help

Like any turn based app, you have the concept of players joining in, rooms, scores and ranking (linking it with fb is preferred)
For my backend server, which option should I go with? Google play game services, Parse, AppWrap.. Etc or simply me use my website server and do the server code?

I am leaning towards Google Game services just because the infrastructure is there and it's free. But I don't find it to provide flexibility and control (such as using nicknames, listing rooms.. Etc)

I just heard about Parse so no experience

Any help or recommendations? Plzzzz need your advice

sentences:
How to Generate Spritesheet from a 'problematic' animated Symbol in Flash Pro CS6? In the new Flash Pro CS6 there is an option to generate spriteheet from a symbol. I used these tutorials:

http://www.adobe.com/devnet/flash/articles/using-sprite-sheet-generator.html

http://tv.adobe.com/watch/cs6-creative-cloud-feature-tour-for-web/generating-sprite-sheets-using-flash-professional-cs6/

And it works really well!

An artist I'm working with created a bunch of assets for a game. One of them is a walking person as seen from a top-down view.

You can find the .fla here:

https://docs.google.com/folder/d/0B3L2bumwc4onRGhLcGNId1p2Szg/edit
 (If this does not work let me know, it is the first time I used Google Drive to share files)

1 .When I press ctrl+enter I can see it is moving. When I look for the animation, I do not seem to find it. When I select to create a spritesheet, flash suggest creating a spritesheet with one frame in the base pose and no other (animation) frames.

What is causing this and how do I correct it?

2 .I want to convert it to a sprite sheet for 32 angles of movement. Is there any magical easy way to get this done? Is there a workaround without using Flash CS6 to do the same thing?

sentences:
How to create a walkable crate box? I have a 2D platformer with each platform having a PlatformEffector2D component. I want to create a crate that can be pushed.

When I jump into the edge of the crate, my player gets stuck, so I added PlatformEffector2D to the crate. But when the crate has a PlatformEffector2D component it falls below the platform.

I can remove the component and add a Physics2D Material with zero friction to prevent the player from getting stuck in the crate's edge, but I can't walk above the crate (because the zero friction). The images below illustrate it.

Player getting stuck in the edge of the crate that don't have PlatformEffector2D.

If it has a PlatformEffector2D it will fall below the platform.

My objects have the following components (when the player gets stuck at the edge of a crate):

Player (BoxCollider2D, Rigidbody2D)
Crate (BoxCollider2D, Rigidbody2D)
Platform (EdgeCollider2D, PlatformEffector2D)

What should I do so my player can push the crate and walk above the crate? Would anyone happen to have a sample script?

FYI: I use Physics2D.OverlapCircle to detect the ground. (Unity 5.4.0)

sentences:
Event-driven vs state synchronizing networking model I was going through the Tribes network model and the network model used in Quake3. What I understand is that Tribes is more of an event based model where as the Quake model uses game states and delta game states to sync clients. Is my understanding right?

What kind of games do these models favor? Also what are the drawbacks of one model compared to the other. I am currently developing a two player First Person maze solver game and trying to choose between the two models.

sentences:
Rigidbody2D moves on x axis without adding force I'm currently trying to learn some Physics2D in Unity. Now, I've created a Ball (sprite) and added a RigidBody2D and a CircleCollider2D on it.

The RigidBody2D has the following settings:

Bodytype: Dynamic
Simulated: true
Use Auto Mass: false
Mass: 1
Linear Drag: 0
Angular Drag: 0
Gravity Scale: 25
Collision Detection: Continous
Sleeping Mode: Start Awake
Interpolate: None

Now, when I start the scene, the ball drops as expected. However, it's also moving on the x-axis by ~83 pixels, which I don't want. The movement on the x-axis stops once it reached that ~83 pixels point.

If I freeze the x-position in the Rigidbody2D-Settings I get the intended behaviour (ball just dropping on y-axis), but I feel like that would be a hack instead of fixing the actual problem.

What could cause this? I expected the ball to just drop, if I have no drag, a certain mass and gravity enabled.

sentences:
How do I reference one game object in a script attached to another? This is all in Unity, with C#.

I have attached a script to my player that should destroy a TreeGroup (as in a forest) whenever I press 'Q' and instantiate one when I press 'E'.

Here is the code:

using UnityEngine;
using System.Collections;

public class DisableTrees : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

        if (Input.GetKeyDown (KeyCode.A)) {
            //Disable Trees on A Keypress

            Debug.Log("Trees Disabled!");
        }

        if (Input.GetKeyDown (KeyCode.E)) {
            //Enable Trees on E Keypress

            Debug.Log("Trees Enabled!");
        }

    }
}

How do I access and find my 'TreeGroup' object group while script not being attached to 'TreeGroup' but my character instead and then Destroy on Q Keypress?
And how do I Instantiate it?

sentences:
How to spawn collectibles at random positions in Java Please i need assistance,
I made a game in Android Studio with Java.
I am almost done with the game just that i'm having an issue where my collectible keeps re-spawning in the same position after the player has collected it.
I would like for it to re-spawn at random positions on the screen, how can i do this?.
The collectible is a fuel can.

Here is the fuel can collectible class

Fuel.java

public class Fuel extends GameObject {

 public Fuel(Bitmap res, int w, int h, int numFrames) {
        x = GamePanel.WIDTH + 5000;
        y = GamePanel.HEIGHT / 2;
        dy =(random.nextInt()*(GamePanel.HEIGHT - (maxBorderHeight* 2)+maxBorderHeight));
        dx = +GamePanel.MOVESPEED;
        height = h;
        width = w;

        Bitmap[] image = new Bitmap[numFrames];
        spritesheet = res;

        for (int i = 0; i < image.length; i++)
        {
            image[i] = Bitmap.createBitmap(spritesheet, 0, i*height, width, height);
        }
        animation.setFrames(image);
        animation.setDelay(100-dx);
        animation.update();
    }

    public void update()
    {
        if (x < 0) {
            reset();
        }
        x += dx;
        dx = dx- 1;

        if (dx <= -15) {
            dx = -15;
        }

    animation.update();
    }

    public void draw(Canvas canvas)
    {
        try {
            canvas.drawBitmap(animation.getImage(),x,y,null);
        }catch (Exception e){}
    }

    public void reset(){
        x = GamePanel.WIDTH + 5000;
        y = GamePanel.HEIGHT/2 ;
        dy = (random.nextInt()*(GamePanel.HEIGHT - (maxBorderHeight* 2)+maxBorderHeight));
        dx = +GamePanel.MOVESPEED;

    }

    public void fuelCollected(){
    reset();
    }

}

Here is my GamePanel.java class

public class GamePanel extends SurfaceView implements SurfaceHolder.Callback
{
  private Fuel fuel;

  @Override
  public void surfaceCreated(SurfaceHolder holder){
   fuel = new Fuel(BitmapFactory.decodeResource(getResources(), R.drawable.fuel),40,40,1);
  }

 public void update()
{
fuel.update();
        if(collectFuel(player,fuel)){
            distance +=100;
        }

public boolean collectFuel(GameObject player, GameObject fuel){
    if(Rect.intersects(player.getRectangle(),fuel.getRectangle()))
    {
        fuelCollected();
        return true;
    }
    return false;
}

public void fuelCollected(){fuel.fuelCollected();}
}
 @Override
public void draw(Canvas canvas){

// draw fuel can

        fuel.draw(canvas);
 }
}

sentences:
Flickering / tearing with glfwSwapBuffers I recently separated my logic and rendering threads to fix this problem:

GLFW window freezes on title bar hold/drag

This means the logic and rendering are no longer running in lock-step as they were before, so it is possible that the logic has not finished executing by the time we are ready to render. To handle this case, the rendering thread will keep sleeping for 1ms until the logic has finished executing.

Pseudo-code

Logic thread

while (!exiting) {
    timeBefore = now();
    updateGame();
    renderingDue = true;
    timeElapsed = now() - timeBefore;
    sleep(MS_PER_FRAME - timeElapsed);
}

Rendering thread

while (!exiting) {
    if (renderingDue) {
        render();
        renderingDue = false;
        GLFW.glfwSwapBuffers(window);
    } else {
        // Not yet ready to render, but try again in a short while
        sleep(1);
    }
}

This seems to work fine for me, at least with vsync disabled. When I tested with vsync enabled I encountered stuttering, which I suppose is because if we miss a rendering frame, we have to wait until the next monitor refresh interval before we can catch up.

However, on some other systems, in particular low-end laptops, there is a lot of flickering / tearing during gameplay. I don't understand what would cause this, since we are always calling glfwSwapBuffers() after rendering, not during.

Is there something fundamentally wrong with my approach?

I know ideally the rendering thread should take a delta value so that it can render the state "between" logic threads (yes, I have read Fix Your Timestep!), but I am nonetheless curious about what is happening here.

sentences:
Spatial Partitioning - How do I find the object is in the tree? I understand the structure of Spatial Partitioning Trees - BSP, Quad and Octal. You just take a space and split it into however many parts specified by your tree - BSP:2, Quad:4, Octal:8. I've written a self managing quad-tree (in Java but this shouldn't matter) before, and I had the same question I'm having now (in XNA).

How, once an object is in the tree, do I find it specifically. ie. I put the player in the tree, he updates ever frame, but unlike the other AI driven/world objects, he needs input, and his health needs to be checked every frame to see if the game is over. How do I get him out, without knowing his exact location.

My solution last time was to just leave the player out of the tree, and when I need to do collision checking, just pass in his coordinates to get the possible collisions, but I feel like this isn't using the tree the way it's supposed to be used.

Right now I'm trying to write a tree for a 3D game this time in XNA. So my second question really is which tree is better? I've heard BSP trees are the standard, but weren't oct trees written for dividing 3D spaces (Same as quad trees are for 2D)?

sentences:
How to make an object jump an equal height whenever it hits the ground? So, I want to make an object jump an equal height whenever it touches the ground. Something like a bouncing ball. But I can't use Physics Materials. Here are some ways that I tried:
Used Physics.CheckSphere:
isGrounded = Physics.CheckSphere(rayPoint.position, grounDistance, groundLayer);

if(isGrounded )
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

Used Raycast:
bool groundHit = Physics.Raycast(rayPoint.position, -transform.up, rayDistance, groundLayer);

if(groundHit)
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

In each cases, the object jumps a different amount of height each time it reaches the ground. How can I make it jump an equal height each time?

sentences:
Compressed vs Uncompressed Textures differences? What is the difference?

As far as i know, compressed textures would speed things up, because the PCIe bus has to transfer less amount of data, and the interconnect is the main latency issue with GPU's. For this i'm certain.

What i'm not sure of, and this is what i mainly want an answer to is, does the GPU decompress the textures on the fly, or does it display the uncompressed textures? In other words, is there any visual impact of using the compressed textures? The GPU decompresses them automatically? Does this vary with the compression algorithm used, or is it a GPU specific thing?

Thanks in advance.

sentences:
Unity3D: terrain object's textures flickering on long distances I'm making RTS project on Unity3D.

I created terrain with Unity's standard Terrain tool, and added textures of grass, mood etc. on it. Then, for creating "man-made" objects of terrain (roads, sidewalks, road curbs etc) - I'm created this objects in separate assets, and placed on terrain.

And I have one issue with this solution. On moving camera away from the terrain, terrain's texture(e.g. mood) are flickering under roads, sidewalks and other objects. AFAIK, this bug caused by insuficcient accuracy of floating-point coordinates in Unity3D engine (?).

Now, as I concerned, my approach to creating terrain objects is not correct. I must create one mesh with terrain, and all manmade objects in 3D modeling software, and then create UV-map for texturing all of it. Is this approach correct? If "yes", is any special approach for modelling and texturing so large and complex object as terrain?

sentences:
How can I stop this fixed update from executing so I want this FixedUpdate() Method to stop executing when the Method OnMouseDown() is executed.
A bool doesn't work a if() statement also doesn't work
Please use my whole code
Please help :)
Thanks,

 private void FixedUpdate()
    {
            int random = Random.Range(1, 4);
            if (random == 1)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.green;
            }
            if (random == 2)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.blue;
            }
            if (random == 3)
            {
                m_SpriteRenderer = GetComponent<SpriteRenderer>();
                m_SpriteRenderer.color = Color.yellow;
            }

    }
    private void OnMouseDown()
    {
        shouldexecute = false;
    }

sentences:
How to setup glOrtho and Viewport When setting up a window I set 6 variables in my render class

int windowWidth;    // the width of the window
int windowHeight;   //the height of the window
int dimL;           // the coordinate of the left side of the display
int dimR;           // the coordinate of the right side of the display
int dimB;           // the coordinate of the top side of the display
int dimT;           //the coordinate of the bottom side of the display

In my initiation routine, i set the displayMode like this:
Display.setDisplayMode(new DisplayMode(windowWidth, windowHeight));

I set glOrtho like this:

GL11.glOrtho(dimL, dimR, dimB, dimT, 1, -1);

now my question is:

Using these variables how can i configure glViewport to have the area defined by the dimX variables fill the display?

thanks!

sentences:
How can I locate empty space next to polygon regions? Let's say I have the following area in a top-down map:

The circle is the player, the black square is an obstacle, and the grey polygons with red borders are walk-able areas that will be used as a navigation mesh for enemies.  Obstacles and grey polygons are always convex.

The grey regions were defined using an algorithm when the world was generated at runtime.

Notice the little white column.  I need to figure out where any empty space like this is, if at all, after the algorithm builds the grey regions, so that I can fill the space with another region.

Basically what I'm hoping for is an algorithm that can detect empty space next to a polygon.

sentences:
Dynamically load images inside jar I'm using Slick2d for a game, and while it runs fine in Eclipse, i'm trying to figure out how to make it work when exported to a runnable .jar. I have it set up to where I load every image located in the res/ directory. Here's the code

/**
 * Loads all .png images located in source folders.
 * @throws SlickException
 */
public static void init() throws SlickException {

    loadedImages = new HashMap<>();
    try
    {
        URI uri = new URI(ResourceLoader.getResource("res").toString());
        File[] files = new File(uri).listFiles(new FilenameFilter(){
            @Override
            public boolean accept(File dir, String name)
            {
                if(name.endsWith(".png"))
                    return true;
                return false;
            }

        });

        System.out.println("Naming filenames now.");

        for(File f:files)
        {
            System.out.println(f.getName());
            FileInputStream fis = new FileInputStream(f);
            Image image = new Image(fis, f.getName(), false);
            loadedImages.put(f.getName(), image);
        }
    } catch (URISyntaxException | FileNotFoundException e)
    {
        System.err.println("UNABLE TO LOAD IMAGES FROM RES FOLDER!");
        e.printStackTrace();
    }

    font = new AngelCodeFont("res/bitmapfont.fnt",Art.get("bitmapfont.png"));

}

Now the obvious problem is the line URI uri = new URI(ResourceLoader.getResource("res").toString()); If I pack the res folder into the .jar there will not be a res folder on the filesystem. How can I iterate through all the images in the compiled .jar itself, or what is a better system to automatically load all images?

sentences: Examples of good Javascript/HTML5 based games Now that Flash is largely being replaced with HTML5 elements (video, audio, canvas, etc.) are there any good examples of web-based games built on completely open standards (meaning Javascript, HTML and CSS)? I see a lot of examples of pure HTML5 implementations of what was once only in Flash (like stuff here: http://www.html5rocks.com/) but not many games, a domain which still seem dominated by Flash. I'm curious what's possible and what the limitations are.

sentences:
Keeping ratio the same across devices on fixed screen game My game is an Android game using OpenGL ES 2.0 (But this question could apply to any platform).

I have read many questions on here regarding ratio management, and also read many tutorials outside of this site, but I'm still really confused as to how to manage this.

My game is a Fixed screen 2d platformer.  By fixed screen, I mean the player sees the whole screen at once and the screen doesn't scroll.  All action takes place on this one screen (kind of like Bubble Bobble).  Therefore scrolling is not possible as we need to see the whole play area.

On my development device, I've written everything to look perfect, like so:

What I've currently done is when the game is run on other devices, I resize my GLViewport so that I maintain ratio like so:

Obviously, this has it's own problem - namely, it wastes screen real-estate. Now, I would accept this reluctantly, if I couldn't find a better solution, however, Google's documentation states that it's not allowed (of sorts) see: App uses the whole screen in both orientations and does not letterbox to account for orientation changes.

So, finally, I just stretched it out to fit the screen like so:

This takes the whole screen, but frankly looks a little naff as everything is stretched.

Am I out of options?  I see some similar games on the Play Store (ie, fixed screen) and they seem to look identical on different screens (and nothing is stretched) and there doesn't appear to be any extra space, but I have absolutely no idea how they achieve this.  Would love to hear from someone who has dealt with this problem themselves or has any ideas on how best to proceed.

sentences:
AS3 hittest with a tweening movieclip, what is the best way? I'm making a simple game. The character is movable with the arrow keys.
The enemies are moving around the screen with a (classic) tween.

I want to detect collision between the character and the enemies. At first I thought it was working properly, but it also seems to detect a collision on the starting position from the enemies. So even if the enemies are already moving/tweening away from their start position, there's a collision detected between the character and these starting positions. (please ask questions if you don't quite get what I mean)

First method:

addEventListener(Event.ENTER_FRAME, checkIfHitTest);
function checkIfHitTest(Event)
{
      if(player.hitTestObject(enemies))
      {
        trace("yes");

      }
      else
      {
           trace("no");

      }
}

This didn't work properly because it seems to detect the collition even if the enemy moved away from the starting point. (Probably because the ENTER_FRAME but correct me if i'm wrong)

My question to you: What's causing the detection and what is the best way to detect collision between a tweening movieclip and a movieclip wich is movable with the arrowkeys?

sentences:
Hide back button bar of android mobile while playing game I just want to hide back button bar of android mobile while playing the game.

I tried to make it close by pressing back button,it getting close but its always visible.
please help..

sentences:
Unity: onEditEnd and onSubmit only firing from Return key I have an InputField in my UI, but currently I can only submit its contents via the Return key. I tried mapping other buttons to the Submit action (e.g. the tab key on keyboard and the X button on my joystick), but neither worked. I tested both onEndEdit and onSubmit (via the Event Trigger component).

That said, onClick is being called correctly when I remap my Submit button. I can navigate the menu with my joystick and alternate keyboard controls, but I can't submit the InputField without pressing Return. Why is this?

sentences:
How to create bullet hole decals in Godot engine? How can you create decals such as bullet holes in Godot?
Godot doesn't seem to have any native method of creating decals.
I am trying to create decals so that bullet holes will be displayed properly on curved and angled surfaces and corners.
I have tried a few plugins, but none of them worked, they all either had a texture stretching issue or they didn't work at all.
For example, when I tried using the Screen Space Decals plugin (https://godotengine.org/asset-library/asset/241), it did draw decals when a texture wasn't provided (a simple black rectangle by default), but when I assigned the bullet hole texture to the decal property the bullet holes became invisible.
What would be an ideal method of creating decals in Godot?

sentences:
Libgdx problem while converting TextureRegion to Pixmap I'm developping a Tile base game where I have to generate transition tiles. To do so, I have a method that generate those tiles from 2 existing one and 1 "filter tile". I use this method to make a pixMap from the region I retrieved from my TextureAtlas.

public Pixmap getPixMapFromRegion(TextureRegion region){

    Texture texture = region.getTexture();
    TextureData data = texture.getTextureData();
    if (!data.isPrepared()) {
        data.prepare();
    }
    Pixmap pixmap = data.consumePixmap();
    int width = region.getRegionWidth();
    int height = region.getRegionHeight();
    Pixmap px = new Pixmap(width, height, Format.RGBA4444);
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            int colorInt = pixmap.getPixel(region.getRegionX() + x, region.getRegionY() + y);

        }
    }
    return px;
}

Them I apply this method

public Pixmap generateMixedTile(TiledMapTileSet tileset, AssetManager assMan,String template, TextureRegion region1, TextureRegion region2) {
    TextureAtlas atlas = assMan.get("../core/assets/tuiles/MergeFilter.atlas")
    AtlasRegion region = atlas.findRegion(template);
    Pixmap templ = getPixMapFromRegion(region);
    Pixmap img1 = getPixMapFromRegion(region1);
    Pixmap img2 = getPixMapFromRegion(region2);
    Pixmap res = newPixmap(region.getRegionWidth(),region.getRegionHeight(),Format.RGBA4444);

    for (int y = 0; y < templ.getHeight(); y++) {
        for (int x = 0; x < templ.getWidth(); x++) {
            if(0xFF000000 == templ.getPixel(x, y))
                res.drawPixel(x, y, img1.getPixel(x, y));
            else
                res.drawPixel(x, y, img2.getPixel(x, y));
        }
    }
    return res;
}

It seems that after asking again and again for the same texture in the AssetManager, I get a Couldn't load file ../core/assets/tuiles/Water3.png  Exception. But this happen after the system success a lot of time to access that same file.

So I don't know how I could handle that because I thought that using assetManager and Atlas was the bests practices

Any Idea of how to fix that or to do it in another way?

sentences:
*Python* Class - self.x = self - What does it mean to set it to self? I have this class for my game that is a scene manager. I followed a tutorial and I am confused on why the self.scene.manager is equal to self

class SceneManager(object):
    def __init__(self):
        self.go_to(TitleScene())

    def go_to(self, scene):
        self.scene = scene
        self.scene.manager = self #<--

In the main game scene I also have a similar thing happening

class GameScene(Scene):
    def __init__(self, levelno):
        super(GameScene, self).__init__()
        self.player = Player(5, 40)
        self.player.scene = self

What is the purpose of setting it to self?

Another Question:
I have been using classes and for most of them I create a class and I include this within the class

Class myClass():
   super(myClass, self).__init__() #<----- This line here

Does this have something to do with my original question?
What is the purpose of doing this?

sentences:
C/C++ Flexible yet fast way of linking UI elements to functions I am currently working on the UI functionality of my game, which will have very minimal GUI design, yet it needs to be functional and flexible e.g. easy to redesign.

I am planning to construct all my GUI elements (buttons, sliders, knobs, checkboxes) from Quads with an optional texture and a color. These quads will also serve as boundaries for text and mouse-click detection.

But I am having trouble to figure out an efficient way of linking actual functionality to triggers like buttons. I have thought of defining a Button like this:

struct Button{
    unsigned int quadIndex; //an index into the array of quads, which themselves store indices into arrays of positions and sizes
    void (*func)(int); //a pointer to the function to be called when this button is being interacted with. the parameter of the function will be the state of the relevant mouse button
}

But this way I could only make a button call a function void func(int), which will often force me to write a wrapper function for every individual button functionality. Is this the way everybody does it or is there a better, more flexible way?

Edit:
Since performance/high responsiveness is very important to me, i would like to avoid pointers, virtual functions and derived classes. I am looking for a transparent, concrete solution which focusses on the minimal data which has to come in play for a functional and flexible solution

sentences:
Point Sprite Size and Coloring OpenGL ES 2.0 I am trying to render point sprites with with variable color, but they are all black. Before I added gl_PointSize = 5.0 they had color.

The environment is Android with C++, I believe OpenGL ES 2.0.

I have tried to work from point sprite size and applying color to point sprite, but have had no luck.

Vertex Shader:

precision mediump float;
precision mediump int;
attribute vec4 vertex;
uniform mat4 mvp;
varying vec4 v_color;
void main() {
  gl_Position = mvp*vertex;
  v_color = vertex;
  gl_PointSize = 5.0;
}

Fragment Shader:

precision mediump float;
precision mediump int;
varying vec4 v_color;
uniform sampler2D tex;
void main() {
  //gl_FragColor = vec4(v_color);
  //gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
  //gl_FragColor = texture2D(tex, gl_PointCoord);
  gl_FragColor = vec4(v_color.rgb, texture2D(tex, gl_PointCoord).a);
}

All of the gl_FragColor assignments both commented and active lead to black points.

How do I give these points color?

sentences: Decompile an FX shader Is it possible to decompile a .xnb file?  I've lost my shader code, but only have my .xnb file left.

sentences:
How to calculate normal from normal map in world space? (OpenGL) I'm trying to do normal mapping in a deferred renderer and I'm stuck on how to implement normal maps. I have a bool that passes whether or not to use a normal mapped value and thus, whether to calculate the TBN matrix. My vertex code for the geometry pass looks as follows:

#version 410 core

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoords;
layout (location = 3) in vec3 aTangent; // Optional Texture coordinates
layout (location = 4) in vec3 aBitangent; // Optional Texture coordinates

out vec3 FragPos;
out vec2 TexCoords;
out vec3 Normal;
out mat3 TBN;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform bool hasNormalMap;

void main()
{
    vec4 worldPos = model * vec4(aPos, 1.0);
    FragPos = worldPos.xyz;
    TexCoords = aTexCoords;
    Normal = transpose(inverse(mat3(model))) * aNormal;

    if(hasNormalMap)
    {
        vec3 T = normalize(vec3(model * vec4(aTangent, 0.0)));
        vec3 N = normalize(vec3(model * vec4(aNormal, 0.0)));
        // re-orthogonalize T with respect to N
        T = normalize(T - dot(T, N) * N);
        // then retrieve perpendicular vector B with the cross product of T and N
        vec3 B = cross(N, T);
        mat3 TBN = mat3(T, B, N);
    }

    gl_Position = projection * view * worldPos;
}

Here is where I am confused:

In my calculation, I multiplied T and N by the model matrix which should have moved it into world space. Now transposing (T,B,N) should move me back into model space (I think, I'm not sure). In the fragment shader how do I use the TBN to calculate the normal in world space?

If there are better approaches, they are welcome. Thank you.

Update:
I removed the transposing of the TBN as there's no reason to transform into tangent space if we want to pass it in world space. Now that we have the TBN matrix in the fragment shader, how do we apply it so that the normal is the correct value for lighting? Currently I've done:

#version 410 core

layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gAlbedoSpec;

in vec2 TexCoords;
in vec3 FragPos;
in vec3 Normal;
in mat3 TBN;

struct Material {
    sampler2D diffuseMap;
    sampler2D specularMap;
    sampler2D normalMap;
    float shininess;
};

uniform Material material;
uniform bool hasNormalMap;

void main()
{
    // store the fragment position vector in the first gbuffer texture
    gPosition = FragPos;

    // also store the per-fragment normals into the gbuffer
    gNormal = normalize(Normal);

    if(hasNormalMap)
    {
        gNormal = texture(material.normalMap, TexCoords).rgb * TBN;
        gNormal = normalize(gNormal);
    }

    // and the diffuse per-fragment color
    gAlbedoSpec.rgb = texture(material.diffuseMap, TexCoords).rgb;

    // store specular intensity in gAlbedoSpec's alpha component
    gAlbedoSpec.a = texture(material.specularMap, TexCoords).r;
}

but that doesn't feel right. I imagine that I would transform the sampled value from the normal map by the TBN matrix to get it in world space. Am I missing something?

sentences:
Calculating vertex normals to be able to have both sharp edges and smooth gradients I'm computing area-weighted vertex normals, but lighting looks bad on meshes containing sharp edges and corners (e.g. cubes look 'blobby' as the light leaks onto the dark sides).

Is there a way of calculating/using vertex normals to preserve sharp edges and still have smooth regions? Ideally, without the need to create extra geometry (e.g. splitting faces adjacent to a sharp edge and creating new vertices).

Most sources talk about having different 'smoothing groups' which influence geometry generation.

Could someone explain what are "per-corner" normals?
From Libigl tutorial:
"Storing normals per-corner is an efficient and convenient way of supporting both smooth and sharp (e.g. creases and corners) rendering."

sentences:
Can I get around a Pokemon copyright with new art and minor changes? If I develop a game that is essentially pretty much Pokemon (you're a trainer, you catch "monsters" and put them to fight and level up etc), and I do the next things:

I'm a trainer with a 6-"Monsters" party.
Mechanics like the PC, Gym Leaders and "tall grass" will be used.
I will throw an "ball" to catch the weakened "monster".
I will use common item names, like "potion", "high potion".
The battles are almost the same as Pokemon in terms of mechanics (four moves, elements, critical, evasion etc)
I will NOT use Pokemon names nor graphics... artwork is mine.
Some of the attack names will match Pokemon attack names. I think it is okay, like "ember". Come on.

With all these points, I shouldn't run into copyright issues or anything right? Even if the game feels a lot like Pokemon itself?

sentences:
What are some strategies for handling a zoomed out grid of sprites? I'm writing a grid-based 2D game in Unity3D that would ideally use grid sizes of around 200x200 or so, with multiple zoom levels, including all the way out. When I tried render a 200x200 grid at the most zoomed-out level where everything is visible, Unity crapped out saying that there were too many vertices to attempt to draw. This makes sense, as it's trying to render 40,000 sprites.

I was wondering, how do games like Dwarf Fortress and OpenTTD manage so many sprites at once on the screen when the map is zoomed out all the way? Are there any general strategies for handling the rendering of a large number of sprites such as this?

sentences:
Raycasting from 3D object to UI canvas! I have a world space canvas in front of the player and I want to shoot a ray towards an enemy (in the direction of the enemy) and create and object where Raycast hits the UI canvas.
I know that the physics engine doesn't interact with UI elements and event system is not the answer for me since it depends on pointer events and their position.
So how can I do this?
If possible, I would like to draw the ray or the line as gizmo to see if it's working.
My Current Code is this:

void OnDrawGizmos()
{
    foreach (AeroplaneAiControl item in GameObject.FindObjectsOfType<AeroplaneAiControl>())
    {
        Gizmos.color = Color.magenta;
        Gizmos.DrawLine(transform.position, item.transform.position);
        Vector3 Direction = transform.position - item.transform.position;
        RaycastHit rch;
        Ray r = new Ray(transform.position, Direction);
        Physics.Raycast(r, out rch);
        if (rch.collider != null)
        {
            Gizmos.color = Color.cyan;
            Gizmos.DrawLine(transform.position, rch.point);
            Gizmos.DrawSphere(rch.point, 0.1f);
        }
    }
}

it draws the magenta line but not the cyan line and no spheres.

sentences:
Have an object rotate on its Y axis towards mouse position I've been looking at some other answers to similar cases but not every one used different methods, and a lot of them were not what i needed, so here's my question :

What's the best/standard way to get the X and Z positions of the mouse onto a plane, so that object can rotate to look at that position?

I'm trying to get it in a similar setting to, for example "Angry Bots" where the Player is always facing mouse position.

Also, would that be camera independent? i mean, if my camera changes its angle, it would still work because it usually is a projection of the "screen" plane onto the "player" plane, right?

I'm sorry, i'm a bit overwhelmed with the many options Camera.main. has, and i'm not really sure which one should i use.

sentences:
Network tilebased game updates design I have a top/down grid based multi-player game. So I have a 2D array on the server that holds the entire map and a much smaller 2D array on the client that holds only what the client needs to see of the bigger server map. For now we'll say the client 2D is 5x5 but the server is 400x400.

When the player starts, the server see's what tile it's on and gets the 5x5 area around the player (with the player being at the center of that) and sends the tile info to them. The client then updates their 5x5 array and draws the objects in the tiles. This is all great and working.

Now, when the player moves I want to basically always keep the 5x5 array updating around them, loading and unloading the objects in those tiles from the server. Now in reality it'll be bigger than 5x5 but I'm using this for testing purposes only since it's smaller to manage.

I don't want to always send the 5x5 array (will be larger in final version) to the player because it's a waste of bandwidth to do so. If the player moves right 1 tile then the majority of the information in their 5x5 array is still the same. Really it's only the right most column that changed and needs to be updated while every other column gets shifted 1 to the left. The same happens if they move up, down, left, or any of the diagonals.

The question I'm after would be around how the server can track and easily send just the changes of tiles for clients. So on the server I send tile updates once a second, NOT when they tell me they changed tiles. When I send them data I store their current position as last position, so this means I can get the 5x5 array from their last position (which this is what their 5x5 array looks like) and I can get the new 5x5 array from their current position. I the need to know what changed from the last position 5x5 array to this new 5x5 array and only send them those changes along with how to shift their 5x5 array around to match this new 5x5 array. Is there any neat tricks out there for comparing 2 2D arrays to find out such information? Does anyone have any other ideas on how to handle this situation? I'm open to new ideas around this.

sentences: Where does the money to make a video game come from? So 360/ps3 video games takes a few months to a few years to make I assume. If so where does the money to pay employees and costs of everything needed to make the game come from during those few months/few years?

sentences:
Objects with custom shaders cast grayscale shadows when lightmapped Unity 5 seems to be able to calculate colored shadows from objects mapped with standart shader and legacy shaders.

What should I do to make my custom shader to cast colored shadows as well?

sentences:
Stereo music playing in mono in libGDX 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.

sentences:
In Unity, how do I add a MeshFilter to an empty GameObject to generate a procedural model? My code below is modeled after Unity's documentation.  When I put the script into an empty GameObject, the error I get is:

MissingComponentException: There is no 'MeshFilter' attached to the "myMesh" game object, but a script is trying to access it.

How do I add a MeshFilter (and the other necessary Components) to the empty GameObject in order to generate the model procedurally?

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

public class myMesh : MonoBehaviour  {
    public Mesh mesh;

    void Start(){
        mesh= new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
    }

}

sentences: Animation library for XNA I'm looking at implementing an existing XNA Animation library into my engine.  I would ideally like to be able to use BVH animations, but I'm not sure on which is a good library to work with.  Any ideas?

sentences:
How to make a long highway in unity? I'm planning to make a long highway for a Racer game. What is the best way to do it ?

Do you make it in a single scene which I think is difficult to manage ? Or do you make multiple scenes or anything else ?

sentences:
Where should collision detection logic be placed? I am developing a small 2D game engine. The characters have a paint method which currently does the following:

Calculate the new position of the character as per its speed, etc.
Update the collision grid cell **
Draw the character at the new position

** I have created a collision grid to reduce the number of intersection checks

Now the basic algorithm which I have thought for detecting collision is:

For Each Character
    Check intersection with characters in surrounding 8 cells

I can simply place this code in the paint method. But here is the problem I anticipate.

Suppose two characters A and B lie in adjacent cells in the collision grid. Now as per the above algorithm in the iteration of character A it will detect that it has collided with B. In the iteration for character B it will detect that it has collided with A.

But I have an idea that when A detects that it has collided with B, it should inform B that it has collided with A. This would save lot of comparisons when there are more than 2 actors colliding. But I am not sure how to handle this. I think instead of every character checking for its collision, I should check for the collision inside the game loop.

Would this approach be correct? How have you handled this kind of problem? I thought of the collision grid thing myself. Are there any alternatives to collision grid logic?

sentences: Implementing audio for a game made using JMonkey? Is it possible to implement music/SFX in game made using JMonkey?  If yes, how did you do it?  What did you use?

sentences:
Box2D/Farseer Collision Detection I am looking for literature - or a simple explanation - on how the Farseer (and for that reason, the Box2D) collision detection system works - specifically the logic that comes after the broadphase culling:

What data structure does it use?
How does it use that data structure to determine if a collision has occurred?
How does it calculate the response normals?

NB: I am not asking how to use it, I merely want to know how it works as a matter of personal enlightenment.

sentences:
How to make tank track rig? On unity How to rig an unity tank track? Does it use animation or it use some another ways.
Can anyone explain how to do this. thanks

sentences:
How to create a second Window in OpenGL/GLFW I would like to have 2 windows. 1 for display purposes and one for settings / buttons (for example to change the color of the background in my main display). How would I go about having a second window for these settings? Would I just create another window?

GLFWwindow* window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Settings", nullptr, nullptr);

sentences:
OpenGL Black rectangle in rendering texture I create textures (for example, I just fill the texture color), and render their. But, for some reason, to the upper edge added black rectangle.

Screenshot:

var
Textures: array of GLuint;

procedure LoadTexture(const TextureID: Byte; var Texture: GLuint);
var
//
w, h: Cardinal;
//
Data: PByteArray;
begin
//
if TextureID = 0 then
//
  begin
//
w:=512; h:=512;
  end
                 else
//
  begin
//
w:=128; h:=64;
  end;

//
GetMem(Data, w * h * 3);

//
if TextureID = 0 then
//
FillChar(Data^, w * h * 3, 204)
                 else
//
FillChar(Data^, w * h * 3, 102);

//
glBindTexture(GL_TEXTURE_2D, Texture);

//
glTexParameteri(GL_TEXTURE_2D,
//
GL_TEXTURE_MAG_FILTER, GL_NEAREST);

//
glTexParameteri(GL_TEXTURE_2D,
//
GL_TEXTURE_MIN_FILTER, GL_LINEAR);

//
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8,
//
w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, Data);

//
FreeMem(Data, w * h * 3);
//
Data:=nil;
end;

procedure glInit;
begin
//
glEnable(GL_TEXTURE_2D);

//
SetLength(Textures, 2);
//
glGenTextures(1, @Textures[0]);
//
LoadTexture(0, Textures[0]);
//
glGenTextures(1, @Textures[1]);
//
LoadTexture(1, Textures[1]);

//
glClearColor(1, 1, 1, 0);
//
glShadeModel(GL_SMOOTH);
//
glClearDepth(1);
//
glDisable(GL_DEPTH_TEST);
//
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

//
glViewport(0, 0, 800, 600);
//
glMatrixMode(GL_PROJECTION);
//
glLoadIdentity;
//
glOrtho(0, 800, 600, 0, 0, 1);
//
glMatrixMode(GL_MODELVIEW);
//
glLoadIdentity;
end;

procedure glDraw;
begin
//
glClearColor(1, 1, 1, 0);
//
glClear(GL_COLOR_BUFFER_BIT or
  GL_DEPTH_BUFFER_BIT);

//
glBindTexture(GL_TEXTURE_2D, Textures[0]);
//
glBegin(GL_QUADS);
//
glTexCoord2f(0, 0);
//
glVertex2f(0,   0);
//
glTexCoord2f(1, 0);
//
glVertex2f(512, 0);
//
glTexCoord2f(1, 1);
//
glVertex2f(512, 512);
//
glTexCoord2f(0, 1);
//
glVertex2f(0,   512);
//
glEnd;

//
glBindTexture(GL_TEXTURE_2D, Textures[1]);
//
glBegin(GL_QUADS);
//
glTexCoord2f(0, 0);
//
glVertex2f(128,   64);
//
glTexCoord2f(1, 0);
//
glVertex2f(256, 64);
//
glTexCoord2f(1, 1);
//
glVertex2f(256, 128);
//
glTexCoord2f(0, 1);
//
glVertex2f(128, 128);
//
glEnd;
end;

sentences:
What happens with associated animation clips when I copy a gameobject in Unity? I have a gameObjectOne that has two animation clips: move into the screen and move out of the screen. This gameObjectOne has an animator that checks when each clip has to be played.

Now I duplicated this gameObjectOne via the edit menu and named the copy gameObjectTwo, and to my surprise the animator and the animations still work. I expected that the animation clips were associated with gameObjectOne but this is not the case....

The animation clips are not duplicated. There are still only two clips and one animator in the project window. But when I click on gameObjectTwo in the animation window, you can see that there are two animation clips associated with gameObjectTwo as well.

So my question is: how is this possible? And is there a way to see what is "inside" an animation clip file? If I click in the project window on an .anim file, it doesn't say which gameObject it belongs to.

sentences:
Correct method for choosing the user's video cards? My game uses DirectX 10, and I'm having a problem where users are reporting that my game isn't picking up on their graphics card. Instead it prefers to run on their integrated Intel card, ruining performance. It's possible that this is related to Windows 8. It could also be related to mobile cards.

Until now, I've been creating the DirectX 10 device with no adapter specified (as I've seen in all the examples/demos so far), to allow DirectX to choose its own adapter. Apparently I'm going to have to change that.

I already have a function which runs through all of the available adapters, and chooses the one with the highest amount of dedicated memory. That works great for correcting the problem, but is it correct in general?

Unfortunately, I cannot rely on the card having valid video output (i.e: a monitor hooked up) as the machines affected by this problem report no outputs for the desired card.

What algorithm can I use to properly choose which adapter to use with DirectX?

sentences:
How do I find the location of a GameObject in C# I'm making an elevator script. Essentially I'm wanting to find the difference between two empty objects so that I can move the elevator between them.

To be able to do this, I need to be able to get the location of both GameObjects in my script. From a bit of searching, I haven't been able to figure it out.

How would I go about doing this?

sentences:
Is it possible to reuse the same window in multiple games? In particular, I'm thinking about C# and XNA, and obviously on Windows. Let's say I have the main game which is a normal XNA game, but at some point I would like to momentarily switch to a mini-game that was also implemented in XNA but is completely independent of my game.

Is there any way I can switch to and back between the two games, while reusing the same windows handle? And preferably keeping the old state in memory, although I could also implement this persistence writing to a file.

And when going back to the initial game, is there any way I could access the value returned by the mini-game's main method? For instance, 1 or 0 depending on whether the player cleared the mini-game or not.

Andrew Russell wrote:

  You should build your mini game and your main game into separate classes within the same program. Each of those classes should have Update, Draw, Initialize, etc methods. You should then have some kind of master controller to call those methods to have only one game active at a time (this could also simply be in your main game class).

Thanks for the answer. Your suggestion is what I'd do in a normal game situation - one where I'd be the one creating all of the mini games and their content.

But this is not a game, but rather a game maker tool for creating graphic adventures, and it is the end user that might feel the need to plug in external mini-games in response to certain game events.

The older internal engine that I'm trying to replace was done in Flash, and solved this problem simply by loading an SWF inside of the main SWF. It worked okay for most cases. I'm trying to do something similar but with XNA now.

But following your train or thought, perhaps I could create a separate assembly containing a base class or common interface for all mini games, and compile it as a dll. Then the user would reference that library, implement the interface and compile into his own library which could be loaded by the engine at runtime and executed as a separate state inside the main game. Am I missing some hidden implications?

sentences:
Cavity map generation I am looking for an algorithm how to generate cavity (or curvature) map. There seems to be no refernce to it, only final solutions like xNormal software, but that is not what I want. I am looking for a way how to do it, not for a final solution.

I have also found this site: http://wiki.polycount.com/wiki/Curvature_map, but again, mostly references how to do it in specified soft (maya etc).

On my input, I have a mesh and a normal map. From this, I have calculated curvature on my mesh, and now I would like to extend this info with more details from normal map.

sentences: Is host advantage real? I'm sure many of you have heard the term host advantage through out your time playing action video games.  However, I was curious if this was a real studied and proven concept in game design, computer science, and network programming?  I tried looking it up on Google, but all I saw was just some gamers ranting back and forth on a forum (none of them even seem to bring up client-server concepts in their babbling...).

sentences:
Replace text in Unity i tried to look up my question but didn't really find an answer that works for my situation.

I'm using this unity asset called Dialoguer to create interactive dialogues.
What I'm trying to do is to pass a test in the asset, that test if a condition is true, then replace a specific part of the output text.

My problem right now is I can't find the right code to check for a specific string and replace it with another.

Please help

sentences:
How to Replace two object by rotating in center I created Find Rock game but I have problem In replacing two object by rotating in center and when rotating finish stop rotating how can I do this?

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
    public GameObject[] obj;
    public int[] Randomize = new int[2];

    void Start(){
        StartCoroutine (Delay ());

    }

    IEnumerator Delay(){
        Randomize [0] = Random.Range (0, obj.Length);
        Randomize [1] = Random.Range (0, obj.Length);
        while (Randomize [0] == Randomize [1]) {
        Randomize [0] = Random.Range (0, obj.Length);
        }
        yield return new WaitForSeconds (2);
        obj [Randomize [0]].transform.rotation = Quaternion.Euler (new Vector3 (0, 0, 0));
        obj [Randomize [1]].transform.rotation = Quaternion.Euler (new Vector3 (0, 0, 0));

        StartCoroutine (Delay ());
        }
    void Update(){
        if (obj [Randomize [0]].transform.rotation.eulerAngles.y < 90 || obj [Randomize [1]].transform.rotation.eulerAngles.y < 90) {
            obj [Randomize [0]].transform.RotateAround (obj [Randomize [1]].transform.position, Vector3.up, Time.deltaTime * 100);
            obj [Randomize [1]].transform.RotateAround (obj [Randomize [0]].transform.position, Vector3.up, Time.deltaTime * 100);
        }
    }
}

I can make this game but when rotating finish they aren't Directed.
this video link describe my problem and this is unity package of my game.
how can I use mathf clamp RotateAround for stopping rotation?!

sentences:
How do I flatten terrain under a game object? I've got a script that makes a terrain object and paints it with textures, but I'm having an issue.  When I attempt to place game objects (such as the simple water object that unity provides), I use a Raycast to determine the correct height to place the game object, but that just ensures that it is correctly placed at that particular point.

How would I go about flattening the terrain under the game object so that it doesn't go into the terrain or hang out into thin air in the case of hills?

sentences:
Looking for articles/books on: How do games make money? What models do they use? I'm trying to research the ways in which games make money. I want to know more about the models they use (free/premium, trial/subscription, free-to-play with micro-transactions, etc.). In addition, I want information on which models work for which games, what models are best for which age groups, etc.

I've tried my best to find information, and Google hasn't turned anything up at all. I think I'll stop by my University's library and see if there's anything there.

This may seem like a broad question, but I'm looking for links and titles of books, not typed-out answers.

sentences:
Trying to find a solution for instant knockback in multiplayer game I'm making a server-authoritative fast-paced multiplayer game. I'm trying to implement wack-hammers, they are a melee weapon that knocks close players, in other words, that sets their velocity to inverse of their mass *  to the direction aimed at * the force of the hit. Even if the enemy player is only seen getting knocked after the client input gets processed on the server and after the enemy's position and velocity get sent back, I want to make it seem like your action appeared instantly.
I've tried one thing: when you knock a player, that player gets predicted for a short amount of time instead of being interpolated. That way, players appears to have been knocked out instantly, but there's an issue with that. When should I stop predicting? And how? When you think about it, the prediction is done on your own client time. The positions and velocities of other players are a few millisec old, so when you try to interpolate between your local "futur" predicted player position to the "old" server player position, you essentially move the other players back in time, and it looks real bad.
I'm not quite sure what to try to hide this issue. I can't possibly predict the enemy player's position forward in time, its movement can get too chaotic.
I've already watched the GDC talk from Overwatch's and Rocket League's netcode a million time, I'm not sure if they can help me with my issue.
Edit: I still haven’t found the best solution yet but there’s some useful information over at https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1455487-responsive-knock-back-in-multiplayer-game

sentences:
Periodic updates of an object in Unity I'm trying to make a collider appear every 1 second.  But I can't get the code right.  I tried enabling the collider in the Update function and putting a yield to make it update every second or so.  But it's not working (it gives me an error: Update() cannot be a coroutine.)

How would I fix this?  Would I need a timer system to toggle the collider?

var waitTime    : float = 1;
var trigger     : boolean = false;

function Update () {

        if(!trigger){
            collider.enabled = false;
            yield WaitForSeconds(waitTime);
        }
        if(trigger){
            collider.enabled = true;
            yield WaitForSeconds(waitTime);
        }
    }

}

sentences:
Why do GPUs have limited amount of allocations? I've been learning Vulkan lately and I read that you can allocate VRAM memory only set amount of times and it doesn't matter if it's 2gb or 2kb, why is it?

I'm specifically referring to VkPhysicalDeviceLimits structure which has a field maxMemoryAllocationCount.

sentences: How do I deploy my JavaScript/HTML 5 to desktop and smartphone? I'm looking for framework that will let me code on JS for HTML5 canvas and then will let me deploy to desktop and Android. I'm not looking to learn new stuff like Haxe or Lua. I want to do it in plain JavaScript. Is there a frame work that will allow me to do this?

sentences:
Does inflating scores make players happier? I realize that this will depend on a game-to-game, situation-to-situation basis and that this is not a very technical question, but I remember hearing in a tech podcast a few years ago that inflated numbers of points (e.g. 1000 points vs. 1 point) was preferable in games because it was either a standard or because it had been shown to produce better feedback/experience from users. Either case, it seemed to make users happier than lower numbers of points.

I have since been unable to find supportive evidence either way for the theory that inflating scores can keep the user engaged.

Is this inflated-point theory true? Where can I find more information and, particularly, some experimental data on different approaches and their effectiveness?

sentences:
How to know if a model is composed of a group of models? I've downloaded a model, and try to ungroup the model and learn how this model was made. However, the big model in the image below can not be ungrouped anymore.

I feel that this model is composed of a group of models, but I cannot ungroup this model and unlink it. Is there other methods to test if this model is a model or a group of models?

Thanks in advance.

  Full Size: http://i.stack.imgur.com/VF2SM.png

sentences:
Unity 5 - Cloth Constraints I'm trying out the new Version of Unity 3D (5.0.0.4f) and figure out whats new, whats possible now. My experience with Unity 4 free is also just a little. Anyway I work with the "new" cloth component and have some general questions to different funkctions. The documentation brought no knowledge to me. So I would be thankful if one of you could explain me the different points in an accessible way.

First question touchs the constraints. When I edit the contraints (of a plane for example), there are two options to activate. What are the differents between "Max Distance" and "Surface penetration". "max Distance" is clear to me but i don't know what the second option does.

Seceond question: I have an tablecloth positioned over a sphere. In playmode when i move the sphere up and the tablecloth react correctly. But the sphere ist temporaliry visible trough the cloth. Its look like a graphicbug then, but ist there a way to prevent this?

So I hope my questions a clear enough to understand. Thanks a lot for your educational effort.

sentences:
Looking for a game engine to make a game like "Ikariam" or "Ogame" I'm an IT student and currently in my spare time I want to start a project. I would like to make a game that resembles a browser games like "Ikariam" or "OGame". I don't want this game to be a browser game, but It has to work like the games above with a couple of players.
What game engine would you suggest?

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

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

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

sentences:
LibGDX - Level management on a level-based game I'm new to LibGDX and android development in general and am trying to do a puzzle game. Being a level-based game, i'm trying to make it so in every level a certain number of blocks (just rectangular sprites) appear in a certain position / rotation, like in the image linked below:

https://i.gyazo.com/52e6c71e1f05ab4529e0fec9d4f80bd7.png

I've doodled some levels already but i'm really not sure about how to make the blocks's rearrangement over the levels.
How exactly should one manage this? As the position of the blocks won't be random i was thinking about reading from files the information from every level (x, y, rotation, colors, etc. for every block) but to do that i would have to manually organize every level's blocks properties information (to then save), and, considering it would have atleast 100+ levels, it would take too long... Other than that, i could have them as plain assets but having an asset for every single level doesnt't look like an efficient solution either. Do you have any tips, please?

sentences:
Unity: How to make script work with duplicated objects? I have an object in my game that, when clicked, causes the player to move toward it. It does this by sending its position to the player's SetTarget function. The player's Move function then heads toward the position.

This is working, but when I duplicate the object and click on it, the player still moves toward the original object's position. When I print debugging statements to the console, it appears that both positions are being calculated, but the original position is the last one and wins out. (I'm using the object's this.transform.position to send the position to the player's SetTarget function.)

Can I not duplicate objects like this and expect the script to work? Do I need to use a prefab? If so, how? I know how to create prefabs but am not sure what I would need to change with the script or other settings when they are created. Thanks.

Here's the code:

public class PotController : MonoBehaviour {

private GameObject chefObject;

void Start () {
    chefObject = GameObject.Find ("Chef");
}

void Update() {
    if(Input.GetMouseButtonDown(0)){
        //print ("pot clicked!");
        ChefController chefScript = chefObject.GetComponent<ChefController> ();

        print (this.gameObject.transform.position);
        chefScript.SetTheTarget (this.gameObject.transform.position);
    }
}
}

public class ChefController : MonoBehaviour {

private Vector3 target;
public float speed = 2;

// Use this for initialization
void Start () {
    target = this.transform.position;
}

private void MoveTowardsTarget() {
    Vector3 targetPosition = new Vector3(0,0,0);
    targetPosition = target;
    Vector3 currentPosition = this.transform.position;
    //check distance to target
    if(Vector3.Distance(currentPosition, targetPosition) > 0.4f) {
        Vector3 directionOfTravel = targetPosition - currentPosition;

        directionOfTravel.Normalize();

        this.transform.Translate(
            (directionOfTravel.x * speed * Time.deltaTime),
            (directionOfTravel.y * speed * Time.deltaTime),
            (directionOfTravel.z * speed * Time.deltaTime),
            Space.World);
    }
}

void Update () {
    MoveTowardsTarget ();
}

public void SetTheTarget (Vector3 position){
    target = position;
}

}

sentences: How to check collisions between rotated rectangle and a straight line? How do I detect collisions between a rotated rectangle and a straight line?

sentences:
Why is my picture distorted after switching from D3D9 to D3D11? I have moved app from Directx9 into Directx11.

After this upgrade strange thing happened with my world. Objects get skewed and became 2D, also they are clipped in unexpected places.

The two arrows at the image I attached point to my HUD reference frame - three nice cones, arranged to point along the 3 axes, which are supposed to be shown in the lower left corner of the window.

Also you can see that sphere got clipped in difference positions and all objects are 2D. There side and front view. Thanks for your suggestions.

Need to point out that sphere is moving.

I use XMMatrixPerspectiveFovLH to get projection matrix.

Example of matrices:

World
2  0  0  0
0  10 0  0
0  0  1  0
0  0  10 1

View - Identity

Proj
1.72 0    0   0
0    2.41 0   0
0    0    1.  1.
0    0   -1.  0

Both previous images are wrong rendered. Just side view and fromnt view of wrong rendering.
Thanks to Tordin i got this:

This one is almost correct, only some problems with culling in cones which form reference frame.

EDIT: Question was answered, but nobody wants to frame his comment as an asnwer. First was

  Tordin:  transpose your matrices. All of them, World, View,
  Projection. DX11 is Row major and not Colume major like dx9 was

sentences:
Security concerns related to HTML 5 games I would like to know if people could modify an HTML 5 game's code to harm either the server or other players whom visit the page.

More specifically, whether someone could modify a simple game that doesn't have things like high-scores, global stats, log-in, etc. to harm other users and/or the server the game is hosted on.

Is this only a concern for games that retrieve data to be stored on the server itself?

sentences:
What is the view perspective angle of most 2.5D isometric games I examined several quite popular games to determine what perspective angle they are using. For the purpose I created a grid that is 45 and 60 degrees isometric viewed and put it onto a screenshot (of Diablo II in this case). None of these grids fit to the game's perspective. So I tried to find the angle that fits best to the perspective and it is close to 53.5 degrees. However, this number seems like coming from nowhere and I believe there is a strong logic behind the number that defines the perspective angle. I tried 9/16 * 90 degrees and 3/4 * 90 degrees (coming from ratios of screens resolution 16:9 and 4:3) but none of my assumptions seem to be correct. Here are screenshots of what I mean:

60 degrees

45 degrees

Something between the two - 53.5 degrees - quite near to the real number

I really need to know what the real degrees are and where it derives from. Any help is quite appreciated! Thank you!

sentences:
Day/Night - Rotation from a sine wave I recently found this question on stack exchange with a great answer that showed how to condense game time into a sine wave, where 1 = midday and -1 = midnight

Converting time of day into a smooth day/night variable?

I've implemented this fine as far as I can tell but I'm a little confused as to how one would get a clean rotation from this to drive a directional light.

Currently I'm using arc-sine to revert the wave to radians and then converting it to degrees but I feel like this is going against the whole process of getting the sine in the first place. It doesn't actually work correctly anyway because we can't tell what side of the unit circle we're on, at least not with my current setup.

Is there a clean way for me to extract a rotation from this sine value so a sun would rotate smoothly? Thanks!

sentences: What is an expected conversion rate in a free to play game? I understand that there's a lot of factors at play that decide how much free users will become paid users. What can be expected from different marketing strategies such as selling non-gameplay impacting items, selling gameplay impacting items, selling subscriptions, etc? An ideal answer would have statistics showing numbers from different games?

sentences:
Changing alignment within a vertical layout group I have a vertical layout group that has text bubbles instantiated into it.
Instantiating them always aligns them to "lower middle".
However, I'd like to have them on opposite sides for a message app effect.

Right now, I'm changing the anchoredPositions of each instantiated UI object in Update. Is there any better way of doing this?

sentences:
DirectX11 - CreateInputLayout() Vertex shader linkage problem I keep getting the same error every time, I really have tried everything to fix the problem but it's still not working.
Basically I'd like to draw a simple cube.

The error(s):

D3D11 ERROR: ID3D11DeviceContext::Draw: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (COLOR,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (TEXCOORD,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (SV_Position,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]

The vertex shader, pos.hlsl:

float4 main(float3 pos : POSITION) : SV_POSITION
{
    float4 finalPos = { pos.x, pos.y, pos.z, 1.0f };

    return finalPos;
}

The vertex layout:

const D3D11_INPUT_ELEMENT_DESC d[] =
    {
        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }
    };

struct Vertex
    {
        XMFLOAT3 poz;
    };

The actual code:

Vertex vertex_list[] =
{
    { XMFLOAT3{-1.0f, -1.0f, -1.0f} },
    { XMFLOAT3{-1.0f, +1.0f, -1.0f} },
    { XMFLOAT3{+1.0f, +1.0f, -1.0f} },
    { XMFLOAT3{+1.0f, -1.0f, -1.0f} },
    { XMFLOAT3{-1.0f, -1.0f, +1.0f} },
    { XMFLOAT3{-1.0f, +1.0f, +1.0f} },
    { XMFLOAT3{+1.0f, +1.0f, +1.0f} },
    { XMFLOAT3{+1.0f, -1.0f, +1.0f} }
};

/* First, setup the vertex buffer */
D3D11_BUFFER_DESC o;
o.ByteWidth = sizeof(Vertex) * ARRAYSIZE(vertex_list);
o.Usage = D3D11_USAGE_IMMUTABLE;
o.BindFlags = D3D11_BIND_VERTEX_BUFFER;
o.CPUAccessFlags = 0;
o.MiscFlags = NULL;
o.StructureByteStride = 0;

D3D11_SUBRESOURCE_DATA d;
d.pSysMem = vertex_list;

if FAILED(pRenderer->GetDevice()->CreateBuffer(
    &o,
    &d,
    &m_pBuffer
))
    return R_BUFFER_ERROR;

/* Now, setup the vertex layout */
long size = pFileManager->ReadShaderFile("pos.cso", m_bytes);

if FAILED(m_pD3DDevice->CreateInputLayout(
    d,
    ARRAYSIZE(d),
    m_bytes,
    size,
    &m_pInputLayout
))
    return R_SETUP_VERTEX_LAYOUT;

m_pD3DKontekst->IASetInputLayout(m_pInputLayout);

Then I'm using m_pD3DContext->Draw() to draw the scene.
Nothing shows up, just the usual gray background color using ClearRenderTargetView()

Thanks a lot for any help.

sentences: How can I implement a global high score ladder? Are there any existing frameworks I can build on?  Should I build my own?  How can I prevent fake scores from being posted to it?

sentences:
How to implement a multi-platform Java 2D game engine's graphics? I'm not sure whether this question should be posted here. I'm trying to make a basic generic game engine in Java. Here's what I have so far.

public abstract class Device {
    public abstract void startDevice();
    public abstract void closeDevice();
    public abstract int getWidth();
    public abstract int getHeight();
    public abstract void displayImage(Image im);
}
public class Game {
    public final Device device;
    public synchronized void gameStart() { ... }
}
public abstract class GameEntity implements Serializable {
    public abstract void create(Game g);
    public abstract void updateAndDraw(Game g, Graphics2D g2d);
    public abstract void destroy(Game g);
}

So far, I have implemented two concrete classes for Device, SwingDevice and J2meDevice, and it's working fine. Now the problem is I want to implement AndroidDevice. Everything will work just fine except for that I have enforced using java.awt.Image and java.awt.Graphics2D to paint Game's graphics offline. Then I forward this Image to the device for rendering.

Is there any way I can absolutely decouple the Device's graphics from the rest of the engine?

I have two solutions but I doubt they'll fully achieve what I need:

Stick with the java.awt.Image. Devices that support OpenGL will not fully utilize their hardware capabilities as drawing is done on CPU. And it might not work on platforms on which can't import java.awt (I doubt their existence).
Create my Graphics2D-like interface. This will make defining new devices harder and again it might hide some of the device's features.

sentences:
How to use Moving Average to avoid lucky streaks in RNG I spent the last week reading about Luck Mitigation and what a dev can do to avoid extreme cases where the player's psychology will be messed up.

I came up to this question How do I avoid “too” lucky / unlucky streaks in random number generation?, plus some others outside GameDev site. To illustrate my question, let's have this simple game example.

We have a turned base fighting game, like BiteFight. Two characters have their attributes and the match outcome is based entirely to those attributes.

In specific:

Player 1: Str: 10 Def: 15 Agl: 20

Player 2: Str: 12 Def: 20 Agl: 15

The process is simple:

If rnd() * P1_Agl >= rnd() * P2_Agl:
    P1 will attack
else:
    P1 will attack

Then with the same way in case of Player 1 is attacking

If rnd() * P1_Str >= rnd()* P2_Def:
    reduce life points from P2

Repeat the same unlimited times until one of players' life reach zero.

Solutions I found:

Instead of 1 rnd() call, use x-times rnd() and get the average. Something like ( rnd() + rnd() + rnd() ) / 3. This will move the results closer to 0.5 and make the whole process less "random". However, it is still possible enough to have streaks of lucky or unlucky events.
Keep track of the results and if you have x-times the same result then hard-code the other. For example, if on the above, P1 won the Agility test 3 times in the row, then the 4th time will always go to P2. What I didn't like on this are the predictability. Users might understand that behavior through time. But the most important is what would happen if P1 uses an item that changes his attributes on the 4th step? When you hard-code the outcome, the result would be based on different attributes.
I read many times the suggestion to use a Moving Average or a Cumulative Moving Average on the rnd() to guess if their is a streak of lucky results. For example, if Player 1 keeps getting rnd() above 0.9, it is a lucky streak. I wrote a script to calculate those two and here is an example for CMA and MA

Cumulative Moving Average

0 : Random number:  0.348  CMA:  0.348
1 : Random number:  0.74  CMA:  0.544
2 : Random number:  0.967  CMA:  0.685
3 : Random number:  0.578  CMA:  0.659
4 : Random number:  0.932  CMA:  0.713
5 : Random number:  0.134  CMA:  0.617
6 : Random number:  0.397  CMA:  0.585
7 : Random number:  0.537  CMA:  0.579
8 : Random number:  0.861  CMA:  0.611
9 : Random number:  0.893  CMA:  0.639

Moving Average

0 : Random number:  0.295 Moving Average:  0.098
1 : Random number:  0.866 Moving Average:  0.354
2 : Random number:  0.768 Moving Average:  0.492
3 : Random number:  0.888 Moving Average:  0.624
4 : Random number:  0.94 Moving Average:  0.729
5 : Random number:  0.325 Moving Average:  0.595
6 : Random number:  0.823 Moving Average:  0.671
7 : Random number:  0.208 Moving Average:  0.517
8 : Random number:  0.743 Moving Average:  0.592
9 : Random number:  0.038 Moving Average:  0.407

So, I end up to my 2 questions

1) Even if I read many times the suggestion of Moving Average, no-one mentioned how exactly you use it. So, my guess is that each time, you compare the rnd() with the moving average and based on that you take some actions. But what exactly you can do?

2) In the above example, you can see that we have two comparisons. One for Agility and one for Strength. Should one use two different Moving Averages to "identify" lucky streaks for each case, or it should be one for every case that RNG comes to the game?

sentences:
Where and how to store players collection in a computer card game? I am developing a trading card game ( something like Hearthstone but not as complex) and I am faced with the following problem: I don't know what is the optimal way to store players collections and decks (the cards that they have available).

I thought of storing their collections on a local file on their device, but that seems bad, as they could probably modify that file and get themselves cards that they shouldn't have.

The second idea is that i could save all their decks and collection in a database. But having one table for each player isn't possible. Having one table with all that data something like PlayerCards(id, cardId, playerName, deckName) seems like it might work, but the table would be huge, and containg quite a bit of redundant data (cards that are in the same collection but are in multiple decks).

What would be the proper way to do it?

sentences:
How to monetize and protect a engine's and its framework's copyrights and patents? I created a game engine that handles:

Rendering levels with 2d textured curved surfaces
Collisions with curved surfaces
Animationn paths on and navigation in 2d-sapce

I have also made a framework for:

Procedural organic level generation with round surfaces
Level editing
Light weight sprite design

The engine and framework are written in AS3 and I am in the process of translating the code into HaXe to better support other platforms.

I am also interested in adding

Animated curved platforms
More advanced level editing features

Currently, I have a part time job and any time I spend on this engine is either taken out of my limited free time (I'm a student working to support myself through school) or out my time working at my job.

I really believe this engine can make life much easier for people designing Tower Defence games, Shooters and and Platformers while also possibly improving their results. It could also support RTS, RPGs and racing games very well.

It continains original algorithms that could be used for procedural generation of organic round and smooth levels. The algorithms I used are new and are not available in any other level editor I've seen.

In order to constantly improve the Engine and have it tested thoroughly I think the best route is releasing it to the public.

What are the best ways to benefit myself and others with my new framework?

I want to have some lisence, allowing me to share the framework and still benefit from it.

Any advice would be appreciated. This issue has been on my mind a lot this year. I am hoping to find a solution that will bring me some relief.

I am thinking of designing three sample games, releasing them and starting a kickstarter, any advice and thoughts on the matter would be valuable.

My goal is like Markus von Broady suggested, to get people involved in developing the engine and let people use it for games for either a symbolic fee or for free and charge for support.
That or use some form of croud sourcing.

Do I need to hire a lawyer to get some sort of legal document to protect my work?

sentences:
Profiling LibGDX game with GLProfiler I am trying to profile my LibGDX game, It runs on 60FPS on PC and 42-45 FPS on MY mobile phone. Either I improve performance and raise it to 60, or lock it at 30 (I don´t want to do this).

I have found GLProfiler on the LibGDX wiki, and I am giving it a try. (GLProfiler)

Here is how I am using it:

@Override
public void render(float stateTime)
{

    //my Render Code

    System.out.println(
            "  Drawcalls: " + GLProfiler.drawCalls +
                    ", Calls: " + GLProfiler.calls +
                    ", TextureBindings: " + GLProfiler.textureBindings +
                    ", ShaderSwitches:  " + GLProfiler.shaderSwitches +
                    "vertexCount: " + GLProfiler.vertexCount.value
    );
    GLProfiler.reset();
}

  with GLProfiler.enable() on the create() function.

  with GLProfiler.disable() on the dispose() function.

And this is my output:

  Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches:  60, vertexCount: 36.0

  Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches:  56, vertexCount: 36.0

  Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches:  56, vertexCount: 36.0

  Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches:  56, vertexCount: 36.0

  Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches:  56, vertexCount: 36.0

  Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches:  56,
  vertexCount: 36.0

  Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches:  60, vertexCount: 36.0

  Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches:  60, vertexCount: 36.0

  Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches:  60, vertexCount: 36.0

  Drawcalls: 35, Calls: 666, TextureBindings: 35, ShaderSwitches:  60, vertexCount: 36.0

  Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches:  56, vertexCount: 36.0

  Drawcalls: 33, Calls: 626, TextureBindings: 33, ShaderSwitches:  56, vertexCount: 36.0

This is just a couple frames, enough for the example.

I have been looking for information on how to read these numbers, I found nothing.

Do you guys know how can I learn from this information? (Identify problems maybe?)

sentences:
How to make a world-to-player inventory system? I am running into an issue of trying to implement an inventory system within XNA (doesn't really matter, could be any platform) but so far. Here is the issue I am trying to wrap my head around:

How can I get an item from the world (think when you kill a monster it drops armor) and get it into my player's inventory?

If an inventory is just a list of items, technically, how could I get Steel Sword from the world into my player's inventory without having a class do more than one thing?

I currently have an item struct, which contains a unique hex value, a count of how many items there are (for stackables, like arrows) and a Texture for rendering within the inventory, and some other unimportant properties (name, description, etc).

It would be bad design if I had to modify my existing item class to house a world position, along with collision detection (don't want the item falling through the earth).

Thanks for any considerations!

sentences:
Double vision with Google Cardboard in Unity I am working on a VR app.

I have a terrain and some cube placed in the terrain.Even I have added the Reticle to point at the cube and display some message when the user gaze at the cube.

I have set the distortion to "None".

The problem I am facing here is,when I run the app the cubes and the pointer(reticle) is seeing as double in the scene.What will be the reason for it.Can anybody help me out please.

sentences:
Projecting world coordinates to screen coordinates issue - points disappear when origin not in view I am trying to implement a 2d line drawing effect on a 3d mesh using Ogre. In order to do so, I perform silhouette detection on the lines of the object (this works) and then project these lines from world to screen coordinates.

Here is the code I use for converting the coordinates:

            bool toDeviceCoordinates(Ogre::Vector3 &result, Ogre::Vector3 &point,Ogre::Camera *camera)
            {
                if(!camera->isVisible(point))
                {
                    return false;
                }
                Ogre::Vector4 p(point.x,point.y,point.z,1);

                p = camera->getViewMatrix()*p;
                p = camera->getProjectionMatrix()*p;

                result = Ogre::Vector3(p.x,p.y,p.z);
                result /= p.w;

                return true;
            }

To draw these points to the screen I just pass them through the shader like so:

            gl_Position = gl_Vertex;

This works fine except when the origin of the scene is not visible.

Any idea where I am going wrong?

sentences:
Make movement speed relative to player character rotation in Unity? I'm doing a strict topdown 2D game where the character looks at wherever the mouse is pointing (same perspective as GTA 2 or Darkwood) . I want to make movement speed for strafing and backing up slower than walking forward. I'm having a hard time figuring out how to do this using Angle() and understanding vector math.
Any help would be appreciated

sentences:
How To Find Child Object and set is own criteria/condition? I am Making 2D Game.

I Apply a Two Tag On Multiple Child Game Object..

Crate A Empty Game Object and Put Script Obstacle.cs and Rigidbody2d.

Child GameObject -> Static OnTriggerEnter2D

Obstacle.cs

    void Start()
    {
        foreach (Transform item in GetComponentsInChildren<Transform>())
        {
            if (item.tag == "someobstacleslow")  //7 child game object find successfully
            {
                Debug.Log("someobstacleslow:" + item.tag);
            }

            if (item.tag == "someobstaclefast") //4 child game object find successfully
            {
                Debug.Log("movefastobstacle:" + item.tag);

            }
     }

Referance:

https://imgur.com/a/ozcJcO4

I want to some obstacleslow is going slow and someobstaclefast is going fast but nothing happens.

Output: all obstacle going very fasy?? what i miss my programme??

But Child GameObject not working its own condition?

Obstacle.cs

   float speed = 2.5f;                             //normal speed

    float movefastobjectspeed = 3f;                //fast spped

    void Update()
    {
        goTopToDown();
    }

    void goTopToDown()
    {
            foreach (Transform item in GetComponentsInChildren<Transform>())
            {
                if (item.tag == "someobstacleslow")   //issue here
                {
                    //move top to down object normal speed
                    transform.position += Vector3.down * speed * Time.deltaTime;

                    Debug.Log("GameObject obstacle object:" + item.tag);
                    Debug.Log("inside obstacle object");

                }

                if (item.tag == "someobstaclefast") // issue here
                {
                    //move top to down object fast speed
                    transform.position += Vector3.down * movefastobjectspeed * Time.deltaTime;

                    Debug.Log("GameObject movefast object:" + item.tag);
                    Debug.Log("inside movefast object");
                }

            }
    }

When My Obstacle Touch My Player then Ontrigger2d Is fire

Obstacle.cs

 void OnTriggerEnter2D(Collider2D other)
    {
        foreach (Transform child in GetComponentsInChildren<Transform>())
        {
            if (child.tag == "someobstacleslow" || child.tag == "someobstaclefast")
            {
                Debug.Log("chiildtag:" + child.tag);
                gameovertext.SetActive(true);

                StartCoroutine(gameover());
                Debug.Log("inside triggerfire");
            }
        }
    }

But Issue Is all obstacle going very fast(See in referance).I want to some obstacleslow is going slow and someobstaclefast is going fast but nothing happens.??help

sentences:
Filling of a multidimensional array with string I'm trying to fill a dropdown with a lis,t if some input is correct.

now when trying to create the list from a text file (to save the program) i should split the line on a comma so i have 3 settings for one asset:
For ex asset1,colour,used,broken.
the list should show the asset if the item is broken (0 is not broken, 1 is broken).

 public string[,,,] UsedAssetList;

string[] lines = System.IO.File.ReadAllLines(@"" + Application.persistentDataPath + "/assetlist.txt");
    cmbAssetNumber.ClearOptions();
    for (int i = 0; i < lines.GetLength(0); i++)
    {

        UsedAssetList = ***lines[i].Split(',')***;
        if (UsedAssetList[i,0,0,1] == "1")
        {
            list = new Dropdown.OptionData(UsedAssetList[i,0,0,0]);
        cmbAssetNumber.GetComponent<Dropdown>().options.Add(list);
        }
    }

The lines[i].Split(',')gives me the error:

Error   CS0029  Cannot implicitly convert type 'string[]' to 'string[*,*,*,*]'

I think everything is on point, except the filling of my list. any idea on how i can get this right?

EDIT: I was thinking the list should look like this: {{"asset1","Gold","1","0"},{"asset2","Green","0","1"} , ... }

EDIT: While the text file looks like:

asset1,Gold,1,0

asset2,Green,0,1

...

sentences: Gdx.graphics.getWidth() vs cam.viewport width I'm facing difficulty understanding the difference between Gdx.graphics.getWidth() vs cam.viewportwidth, What is the difference?

sentences:
IndexOutOfRangeException: Array index is out of range even though the inspector clues otherwise I am currently making a randomized infinite platform with GameObject already made platforms in 3 arrays. In the inspector everything is obviously running quite smoothly but I keep weirdly keep getting uncalled for errors like: IndexOutOfRangeException: Array index is out of range.

Here is my code:

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

public class BackFloorSetter : MonoBehaviour {

    public GameObject[] gameBackFloorsOne;
    public GameObject[] gameBackFloorsTwo;
    public GameObject[] gameBackFloorsFinal;

    public Vector3 nextPosition;

    public float unroundedFinalOrTwo;
    public int finalOrTwo;

    public float unroundedTwoFloor;
    public int twoFloor;

    public float unroundedFinalFloor;
    public int finalFloor;

    public GameObject currentSpawnFloor;

    public float floorSpawnCounter;

    public int counterGoal = 5;

    void Start()
    {
        nextPosition = new Vector3(0, 0, 0);
        Instantiate(gameBackFloorsOne[0], nextPosition, Quaternion.identity);
    }

    void Update()
    {
        floorSpawnCounter += 1 * Time.deltaTime;

        if(floorSpawnCounter == counterGoal)
        {
            floorSpawner();
            counterGoal += 5;
        }

        unroundedFinalOrTwo = Random.Range(0.6f, 2.4f);
        finalOrTwo = Mathf.RoundToInt(unroundedFinalOrTwo);

        unroundedTwoFloor = Random.Range(-0.6f, 3.4f);
        twoFloor = Mathf.RoundToInt(unroundedTwoFloor);

        unroundedFinalFloor = Random.Range(-0.6f, 4.4f);
        finalFloor = Mathf.RoundToInt(unroundedFinalFloor);

        if (finalOrTwo == 1)
        {
            currentSpawnFloor = gameBackFloorsTwo[twoFloor];
        }
        if (finalOrTwo == 2)
        {
            currentSpawnFloor = gameBackFloorsFinal[finalFloor];
        }
    }

    public void floorSpawner()
    {
        nextPosition.x -= 232;
        Instantiate(currentSpawnFloor, nextPosition, Quaternion.identity);
    }

    public void flatGroundSpawner()
    {
        nextPosition.x -= 232;
        Instantiate(gameBackFloorsOne[0], nextPosition, Quaternion.identity);
    }

}

sentences: 3D motorcycle models for web 3D tools I'm developing a website that can display 3D models of motorbike. I haven't decided on which tool to use yet but it seems most of them support X3D and VRML files. So I'm searching for already-made models in either format but got no result so far, anyone know where I can find one? Thank you.

sentences:
Libgdx: touchup fired even when figure not on texture I've implemented a touchup listener for an actor in stage. Now what happens is that when user touch downs the sprite and releases finger, its all good. The problem is when user touch downs the finger, and drag it somewhere else (possibly to cancel the touch) and releases, it still fires the touch up event as if nothing ever happened. How do I stop that? Here's my code:

voiceToggle.addListener(new InputListener() {
    @Override
    public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
        System.out.println("touched");
        return true;
    }

    @Override
    public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
        System.out.println(event); // still fires even if not on original touchdown element
    }
});

sentences:
Image with FadeIn effect blinks when added to scene I am trying to add an image to the scene, but it should just be added to the scene invisible, FadeIn and then be deleted when the effect finishes.

My problem is that the images blink once when they are added to the scene, then they do the intended effect. My best guess is that when they are added they show on the scene for a split second before starting the animation. I though of making them invisible for a split second before activating them, but I am not sure how to code it.

 const bool Sunbeams::add()
{
const CCSize kSceenSize = CCDirector::sharedDirector()->getWinSize();

const int nRayType = random( m_kRays.size());

const CCPoint kPosition( random( static_cast < int >( kSceenSize.width)),
                         0.0f);

const float fDuration = random( m_fDurationVariance) + m_fDurationMin;

CCSprite* pkLightBeam = CCSprite::spriteWithTexture( m_kRays[nRayType]);

if ( !pkLightBeam)
{
    msg::debug( "Sunbeams::add",
                "Failed to create sprite from ray '%d'!\n",
                m_kRays[nRayType]);

    return false;
}

pkLightBeam->setAnchorPoint( CCPointZero);

pkLightBeam->setPosition( kPosition);

m_kActiveBeams.push_back( pkLightBeam);

CCDirector::sharedDirector()->getRunningScene()->addChild( pkLightBeam);

CCActionInterval* pkAction = CCFadeIn::actionWithDuration( fDuration);

CCActionInterval* pkActionBack = pkAction->reverse();

pkLightBeam->runAction( CCSequence::actions( pkAction,
                                             pkActionBack,
                                             0));

return true;
}

sentences:
Mirroring a game object to create symmetry I have a GameObject with a primitive shape that I call "body". I want to create and add a child to it with another primitive shape. I call it 'mutation'. But i want to duplicate the 'mutation' and mirror the duplicate. So they become symmetrical to the 'body'. This way it could resemble wings or legs or eyes.

I've tried to create two children to the mutation called "LeftSide" and "RightSide". I duplicated the new primitive and put one copy in each. I set the Left Side's scale to -1 for the X, Y and Z hoping that it would mirror and create a symmetry with the right side. But its not working out.

So I'm hoping for some tips on ideas on how to achieve this?

sentences:
Unity Lighting Problems I've got a problem with the settings of lighting in my unity scene.

The objects have got "dark sides" and it doesn't look natural.

You can see the screenshots and my light settings here:

The screenshot that shows the problem

sentences:
Shortcut Not Found (installing game created in GameMaker) I tested the game I created on 4 computers (ALL Windows 7) and had the following problem at installation time.

The shortcut created by the installer itself came like this:

When I click the following message appears:

Clicking in search appears this:

By clicking the application Bet on Man the shortcut would work correctly. However, not that the players have that task.

sentences:
What are some good books which detail the fundamentals of graphics processing? The best book on the nitty gritty of graphics that I've found is Computer Graphics: Principles and Practice http://www.amazon.com/Computer-Graphics-Principles-James-Foley/dp/0201121107

However, as this was written in the early 90s, it is a little out of date.

Are there some similar books which go over the more recent developments?

sentences:
Problem connecting to Steamworks via Facepunch.Steamworks I'm using Facepunch.Steamworks (https://github.com/Facepunch/Facepunch.Steamworks) to connect my Unity game to Steam. The login seems to work fine. The board object is an FP class, and AddScore is a call to the library to send the score to Steam.

I have the boards set up on Steam, and they come out with IsValid == true. Here are the output and the code. The boards currently have no data in them, so I don't think it's because the score isn't beating an existing one.

xxxxxxxx
Standard-Normal
True
Fail

public void SubmitScore(Globals.ApplicationMode mode, Globals.SkillLevels skillLevel, int score)
{
    int index = GetLeaderboardIndex(mode, skillLevel);
    if(index == -1 || !IsSteamPlatform())
    {
        return;
    }
    Leaderboard board = m_leaderboards[index];
    Debug.Log("xxxxxxxx");
    Debug.Log(board.Name);
    Debug.Log(board.IsValid);
    board.AddScore(true, score, null, AddScoreSuccessCallback, AddScoreFailureCallback);
}

private void AddScoreSuccessCallback(Leaderboard.AddScoreResult result)
{
    Debug.Log(result.Score);
}

private void AddScoreFailureCallback(Facepunch.Steamworks.Callbacks.Result result)
{
    Debug.Log(result.ToString());
}

Here's a shot of the leaderboards on the Steam control panel. They seem in order; their "Writes" attributes are false so that the client can submit to them directly.

sentences:
Is any data structure more efficient than quad-tree for storing and querying points that lay within an OBB? Is there any method more effective than quad-trees for storing and searching sets of points that are not spread uniformly on the plane?

I need to be able to add, remove and search for points that are within a specified range.

I am currently testing with quad-tree but it seems the results are less than optimal when the points are not spread uniformly enough.

The points are mostly clustered in specific areas:

sentences:
Rotate smoothly object to angle (Y axis) of the collided object Well, let's say I have two planes, one which I am moving, and another one that I collide with, that has a different y rotation. I want to make that, once both planes collide, the plane the user controls changes it´s rotation to the collided plane rotation.I´ve achieved it simply equaling both planes transform.rotations, but that was just a testing, i would like to rotate the plane smoothly. I have tried with eulerAngles, and Quaternion.Lerps, but it doesn´t work, or I am not following well the sintaxis. I know that a rotation and the eulerAngles are different values. There seems to be a solution with the dotween scripts, but I would like to learn the right approach to do it, rather than make it directly with dotween. Here I paste the trigger enter code, with the methods I tried (are commented). I guess that the rotation origin would be another issue.

void OnTriggerEnter(Collider col)
{
    if (col.gameObject.tag == "Plane")
    {
        Debug.Log ("Yup...Angle: " + col.gameObject.transform.rotation.y);
        //this.transform.rotation = col.gameObject.transform.rotation;

        /*newAngle 0 (this.transform.eulerAngles.x, col.gameObject.transform.eulerAngles.y, this.transform.eulerAngles.z);
        this.transform.eulerAngles(newAngle, 2 * Time.deltaTime);*/
        this.transform.rotation = Quaternion.Lerp (this.transform.rotation, col.gameObject.transform.rotation, Time.deltaTime * 0.1f);
    }
}

sentences:
Why real time lightning fails to show shadows on terrain in Unity? I'm using the TerrainTools unity package to create a simple 500x500 terrain, and placing a simple character that moves around, however, by default, the lightning is at real time mode, and the shadows over the terrain flicker like this:
https://youtu.be/_eFFDCRjObY
I know I can set the terrain as static and bake the lighting, however, doing that I lose my character shadow.
So my questions are, why this happens over real time lighting?, and, why I cannot see my shadow on a dynamic mesh over baked lightning?
Here you can see my lighting and directional light configs:
Lighting config:

Directional light config:

sentences:
Tile map only rendering 1 layer when it should be 3 I've been working on this for a while and I can not seem to figure it out. I had the fileParser() method in the constructor and it worked fine. Then I was told it's very bad practice to have it in the constructor. So I moved it to it's own method(which required making most of the variables static) and moved the call to the main Game class and now it runs without errors, but only my last layer is rendering. I've moved things in the class around. I've used more variables than there are at the moment. I've checked my files and they are for sure 32 by 32. So I have no clue why this is happening.

import com.stardust.main.gfx.Assets;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class TileMap
{
   private static final int TILE_SIZE = 32;
   //placeholder for each tile
   BufferedImage[] tiles = new BufferedImage[37];

   //array of tile types
   private static int[][] map = new int[TILE_SIZE][TILE_SIZE];
   //position coordinates
   private int posX, posY;
   //Edge of map Cooridinates
   public static int sx, sy;
   private String fileName;
   private static int x = 0, y = 0;

   public TileMap(int posX, int posY, String fileName) throws IOException
   {
       this.fileName = fileName;
       this.posX = posX;
       this.posY = posY;
       this.sx = map.length * TILE_SIZE;
       this.sy = map.length * TILE_SIZE;

       setTile();

   }

   public void render(Graphics g)
   {
       for(int x = 0; x < TILE_SIZE; x++)
       {
           for(int y = 0; y < TILE_SIZE; y++)
           {
               int textureType = map[x][y];
               BufferedImage texture = tiles[textureType];
               g.drawImage(texture, posX, posY, null);
               posY += TILE_SIZE;
           }
           posX += 32;
           posY = Game.mapY;
       }
       posX = Game.mapX;
       posY = Game.mapY;

   }

   private void setTile()
   {
       tiles[0] = Assets.grass;
       tiles[1] = Assets.dirt;
       tiles[2] = Assets.water;
       tiles[3] = Assets.tree;
       tiles[4] = Assets.multiTree;
       tiles[5] = Assets.NSpath;
       tiles[6] = Assets.uprtPath;
       tiles[7] = Assets.EWpath;
       tiles[8] = Assets.upltPath;
       tiles[9] = Assets.dnltPath;
       tiles[10] = Assets.dnrtPath;
       tiles[11] = Assets.watgrsdn;
       tiles[12] = Assets.watgrslt;
       tiles[13] = Assets.watgrsup;
       tiles[14] = Assets.watgrsrt;
       tiles[15] = Assets.watgrsSE;
       tiles[16] = Assets.watgrsSW;
       tiles[17] = Assets.watgrsNW;
       tiles[18] = Assets.watgrsNE;
       tiles[19] = Assets.wallWood;
       tiles[20] = Assets.pointer;
       tiles[21] = Assets.pathOpRt;
       tiles[22] = Assets.pathOpLt;
       tiles[23] = Assets.pathOpDn;
       tiles[24] = Assets.pathOpUp;
       tiles[25] = Assets.pathOpAll;
       tiles[26] = Assets.roughWood;
       tiles[27] = Assets.pathOpen;
       tiles[28] = Assets.counter;
       tiles[29] = Assets.storeDude;
       tiles[30] = Assets.pot;
       tiles[31] = Assets.singleHouse;
       tiles[32] = Assets.doubleHouse;
       tiles[33] = Assets.wepBanner;
       tiles[34] = Assets.armBanner;
       tiles[35] = Assets.innBanner;
       tiles[36] = Assets.blankTile;
   }

   public void fileParser() throws IOException
   {
       BufferedReader in = new BufferedReader(new FileReader(fileName));

       String line;

       while((line = in.readLine()) != null)
       {
           String[] values = line.split(",");

           for(String str : values)
           {
               int str_int = Integer.parseInt(str);
               map[x][y] = str_int;
               ++y;
           }
           ++x;
           y = 0;
       }
       x = 0;

       in.close();
   }
}

sentences:
how could RTT be so slow on my intel card? I simply draw something into a render target, and use it as an normal texture. It's always working greate to me with my nvidia video card. But today I found my program ran terribly slow (less than 5 fps) on a intel card.

After running an analyse I found glGenerateMipmapEXT is the trouble maker, it costs most of the cpu time. Here's how I bind a RT texture:

  glBindTexture(GL_TEXTURE_2D, m_textureID);<br>
  glGenerateMipmapEXT(GL_TEXTURE_2D);

without glGenerateMipmapEXT the texture is nothing but pure white pic. Something wrong with my RTT?

sentences:
Combining mesh on the fly without using gameObject I procedurally generate chunks and use the marching cube algorithm to create meshes in 3D.
At first, I just created a gameObject for each cube (of course, I knew it was not optimized, but I wanted to see if the algorithm worked).
For now I stock all gamesObject in child of "blocks" but it would be much more optimized to directly merge the meshes between them and only create a single gameObject.
However, i did not find any way to directly merge the meshes between them.
So my question is: is there a way to directly merge meshes between them without having to use gameObject? (don't worry about texturing)

Here's the code:

    public static GameObject GenerateChunk(int[,,] map, int chunkSize, Vector3 chunkPosition)
    {
        GameObject blocks = new GameObject("BlockList");
        GameObject newMesh;
        int[] cubeVertices = new int[8];

        // create each mesh in a gameObject as child of "blocks"
        for (int x = 0; x < chunkSize; x++)
            for (int z = 0; z < chunkSize; z++)
                for (int y = 0; y < chunkSize; y++) {
                    /*
                    define the vertices (cubeVertices)
                    */
                    Vector3 cubePosition = new Vector3(chunkPosition.x + x, chunkPosition.y + y, chunkPosition.z + z);
                    newMesh = GenerateCube(cubePosition, cubeVertices);

                    if (newMesh != null)
                        newMesh.transform.parent = blocks.transform;
                }

        //combine every children of "blocks" and delete them
        MeshFilter[] filters = blocks.GetComponentsInChildren<MeshFilter>();
        List<CombineInstance> combine = new List<CombineInstance>();
        for (int i = 0; i < filters.Length; i++) {
            if (filters[i].sharedMesh == null)
                continue;
            for (int j = 0; j < filters[i].sharedMesh.subMeshCount; j++) {
                CombineInstance ci = new CombineInstance
                {
                    mesh = filters[i].sharedMesh,
                    subMeshIndex = j,
                    transform = filters[i].transform.localToWorldMatrix
                };
                combine.Add(ci);
            }
            Destroy(filters[i].gameObject);
        }

        //create the chunk and set the final mesh with the CombineMeshes function
        GameObject chunk = new GameObject("Chunk", typeof(MeshFilter), typeof(MeshRenderer));
        chunk.GetComponent<MeshFilter>().mesh.CombineMeshes(combine.ToArray(), true, true);
        Destroy(blocks);
        return chunk;
    }

sentences:
Do you prototype mobile touch games on the desktop with mouse input? What tricks do you use? So I've been prototyping games that if completed would be mobile apps most likely.

But, I'm developing them in XNA on the desktop because its the environment I like the most.

I know I could target windows phone and be testing the touch interface rapidly on that device but I don't own one and I imagine the build and deploy to the phone loop slows you down a bit.

Does anyone else prototype games that would eventually use a touch interface using mouse controls initially?

What tricks do you use to ensure that it will eventually translate well when you move to touch controls?

sentences:
Instantiate unity sometimes lags the game some times it doesnt I have a script that instantiates a object lets say every half a second. THis object is of the type .fbx and has a file size of 53kb, lets call this object A. When i use this object my script instantiates the objects without any freezes or any other problems.

Now i have an other object also of type .fbx and also with a filesize of 53kb lets call this object B. Now when i want to instatiate object my my game freezes a few frames upon instantiation.

Why? Is there a way to instatiate objects more efficiantly? I already looked at using object pooling but this doesnt really works in my case.

See here a screenshot for object A, and its components:

See here object B and its components:

Per request the code that does the instantiation of the objects:

public class ForLoopVisualization1 : MonoBehaviour {

    public DetectorAreaScript ElementDetector;
    public GameObject TowerElement;
    public Transform TowerElementsParent;
    public bool WigglyTower = false;
    public float ElementSpacing, Wiggeliness;

    private Collider BuildElementCollider;
    private Transform BuildElementTransform;
    private Vector3 TowerElementPos;
    private int TowerElementCount, CreatedElements;
    private bool StartBuildingTower = false;
    private float Delay = 0.5f, TowerElementSize;

    // Use this for initialization
    void Start () {
        ElementDetector.DetectedData += OnObjectEnterDetector;
        Destroy(TowerElement.GetComponent<Rigidbody>());
        TowerElementSize = TowerElement.GetComponent<Collider>().bounds.size.y;
        TowerElementPos = TowerElementsParent.position + new Vector3(0, TowerElementSize * 1.5f + ElementSpacing, 0);
    }

    // Update is called once per frame
    void Update () {
        if(StartBuildingTower && CreatedElements < TowerElementCount)
        {
            Delay -= Time.deltaTime;
            if(Delay <= 0)
            {
                CreatedElements++;
                var te = Instantiate(TowerElement, TowerElementPos, Quaternion.identity);
                te.transform.SetParent(TowerElementsParent);
                if(WigglyTower) TowerElementPos += new Vector3(Random.Range(-Wiggeliness, Wiggeliness), TowerElementSize + ElementSpacing, Random.Range(-Wiggeliness, Wiggeliness));
                else TowerElementPos += new Vector3(0, TowerElementSize + ElementSpacing, 0);
                Delay = 0.4f;
            }
        }
        else if(StartBuildingTower)
        {
            StartBuildingTower = false;
            // StartCoroutine(EjectVar()); // add when bugs are fixed..
        }
    }

    void OnObjectEnterDetector(System.Object sender, DetectedVariableData data)
    {
        if(data.DetectedObjectType == DetectedType.Variable)
        {
            var vals = ElementDetector.DetectedVariable.GetVariableValue();
            TowerElementCount = vals.IntValue;
            if(CreatedElements > 0)
            {
                foreach (Transform child in TowerElementsParent)
                {
                    Destroy(child.gameObject);
                }
                CreatedElements = 0;
            }
            TowerElementPos = TowerElementsParent.position + new Vector3(0, TowerElementSize * 1.5f + ElementSpacing, 0);
            StartBuildingTower = true;
        }
    }

    IEnumerator EjectVar()
    {
        yield return new WaitForSeconds(0.8f);
        ElementDetector.EjectDetectedElement(new Vector3(-1, 0, -1));
    }
}

If something is unclear let me know so i can clarify the post!

sentences:
PyGame custom isometric engine : caching or not? In the game I'm making, I need an isometric view with some altitude, which means players can go behind a hill, and be partly or totally hidden. To avoid re-drawing the whole view tile after tile every time a player moves, I decided to put each horizontal line of tiles in cache and draw each line, one after another from top to bottom. This works pretty well, I think FPS are correct and everything, but memory usage could soon be a problem: a 50*50 map means 99 lines resulting in 98Mo, a 100*100 map means 199 lines and 388 Mo.

Here is a line:

The memory consumption will grow even bigger if I allow higher altitude (each line will be stored in a higher Surface object).

I'm wondering if this cache system was really a good idea... I could code a bit better so that lines are stored in the smallest possible Surface, but there will still be a big memory consumption.

Do you have any advice, any feedback on my system? Is it worth optimizing, or should I forget this cache-idea ?

sentences:
When creating an FPS style game, how should the iron sights be setup? I am working on creating an FPS style game for learning purposes. I previously was using self created animations for aiming down the iron sights of a gun. The animation would play when you zoom to iron sights and it would hold it there as long as you have the mouse held down. However, talking to a high rated designer, he told me usually it is done with a second camera that sits perfectly aligned with the guns iron sights. I would imagine you would still have to have an animation that then transitions you into that iron sight camera though. Now my animation works fine but I feel I may run into a problem later down the road if I am approaching it the wrong way from the start.

Can someone verify the right way to do this and explain why it is?

sentences:
Mapping Coplanar Vertices in 3D space on to a 2D Plane Say I have a plane specified by a normal vector and point on the plane.

I want to specify a 2-D co-ordinate system that lies 'across' the plane, and then use that to find the 2-dimensional distance between any given points on that plane.

I want to do this so that I can specify scaled texture UV co-ordinates on an arbitrary plane. I will use the average centre of all points on the plane (the barycentre?) as UV: 0,0, and then I need a way to determine the 2-dimensional UV value for each point, subsequently.

Here's an example of what I'm trying to do:

The points in bright green are supplied as the inputs, those are the values I'm trying to work out. The dark green is the calculated mean-average centre (the image isn't exactly to scale), and should act as UV: 0,0.

A friend suggested that I take (firstPoint - centrePoint).ToUnit() as my 'x-axis' and then xAxis.Cross(planeNormal) as my 'y-axis'. That seems like a good place to start, but I'm unsure how to use these values to get X/Y co-ordinates for each point.

I don't care what the 'plane-local' X/Y axes are as long as they're the same for each vertex on the plane. I can rotate them in-editor later to make the right alignment manually anyway (I don't think there's any good way to programmatically select a 'default').

sentences:
Do i need to integrate leader-board and achievement in my game and then publish in alpha testing for google play? I'm confused about whether I need to publish my .apk file on Google Play Console with or without achievements and leaderboard.

If I publish the game without achievements and leaderboards, then, how can I integrate the google play service at a later date?
The first thing I saw was that I should go for alpha publish. Is that necessary?
If I do publish the alpha version for the game without including achievements and leaderboard, how can I add these later? In this video, first the game is published without the achievements/leaderboard, and later he integrates them. So how does it show results since we didn't include these buttons for leaderboard and achievements?

sentences:
OpenGL object load in reverse I am trying to load a model and it is loading it in reverse. When I am trying to rotate it 180 degrees it changes the lightning as well.
I am not sure what I need to do to change the position that eh model is facing when is being loaded.

This is the object loader:

if (!submarineShader->load("BasicView", "glslfiles/basicTransformations.vert", "glslfiles/basicTransformations.frag"))
{
    cout << "failed to load shader" << endl;
}
glUseProgram(submarineShader->handle());  // use the shader

glEnable(GL_TEXTURE_2D);

cout << " loading model " << endl;
if (objLoader.loadModel("submarine_/submarine v2/submarine5.obj", model))//returns true if the model is loaded, puts the model in the model parameter
{
    cout << " model loaded " << endl;

    model.calcVertNormalsUsingOctree();

    model.initDrawElements();
    model.initVBO(submarineShader);
    model.deleteVertexFaceData();

}
else
{
    cout << " model failed to load " << endl;
}

sentences:
Creating placement grid in Unity I'm fairly new to C# and Unity, so I don't really know much about it.

I want to create an RTS like game where you have a huge grid that the whole world is placed on. Then you can place houses, walls etc on the tiles just like a lot other RTS games (i.e. Age of Empires, Stronghold Series etc).

How would I go about this in Unity? I could imagine having some Terrain/World manager that handles all the models and objects that you can interact with etc. And probably a lot of prefabs too with the different items, soldiers and so.

So if anyone have any smart way of doing this or maybe a link to a tutorial explaining, then the help would be greatly appreciated.

sentences:
Objects don't instantiate at mouse position I'm trying to get the player to shoot a projectile at the mouse position, however the projectile is shot in weird directions (http://gfycat.com/BothFluidHoneyeater).

Here is relevant part of my code:

var shotSpeed = 1000;
var projectile : Rigidbody;

function Update () {
    var clone : Rigidbody;
    if(Input.GetKeyDown(KeyCode.Mouse0)){
        clone = Instantiate(projectile, transform.position, transform.rotation);
    }
    clone.rigidbody.AddForce(Vector3.forward * shotSpeed);
}

What am I doing wrong?

sentences:
OpenGL ES object rotation around z axis I have an object on my screen which is presented rotated and panned,
But i have 2 problems regarding the z axis rotations. It's a bit tricky to explain so i uploaded 2 videos to describe each problem.

1) Reverse rotation : After rotating the object around the x axis, the z rotations are being reversed and not as it should be.

2) Wrong Z axis rotation : Again, After rotating the object around the x axis, i'm trying to rotate the object around the z axis and the rotation results in a different axis rotations.

I do believe the video's describe the problems well.

EDIT: Second attempt

As kindly explained by the user @Fault, i understood the problems i was facing with.
So i tried to solve those by just rotating the projection matrix around the z axis, which seemed to be working, but it doesn't.

Since i am rotating the model's axis, I get this problem (video). the issue appears in the 23'd seconds, while i'm demonstrating how it works.
As can been seen, when the z rotation causes a wrong x and y rotations.

I do understand that i must likely have to move these rotations to world view and not model view, the thing is i'm not really sure how to do that.

Here is the relevant code:

Render function:

{
...

    CC3GLMatrix *projection = [CC3GLMatrix matrix];
    float h = 4.0f * self.frame.size.height / self.frame.size.width;
    [projection populateFromFrustumLeft:-2 andRight:2 andBottom:-h/2 andTop:h/2 andNear:4 andFar:100];
    [projection rotateByZ:zRotationEnd];
    glUniformMatrix4fv(_projectionUniform, 1, 0, projection.glMatrix);

    [modelView populateFromTranslation:_currentPan];
    [modelView rotateBy:_currentRotation];

    glUniformMatrix4fv(_modelViewUniform, 1, 0, modelView.glMatrix);
...
}

X and Y rotations:

- (void) rotateAroundX:(float) x andY:(float) y newRotate:(BOOL) isNewRotate
{
    if (isNewRotate) {
        rotationStart = CC3VectorMake(0.0, 0.0, 0.0);
    }

    int rotationDirection = ceil(zRotationEnd/90);
    if (rotationDirection % 4 == 2 || rotationDirection % 4 == 3) {
        rotationEnd.x = rotationEnd.x - (x-rotationStart.x);
        rotationEnd.y = rotationEnd.y - (y-rotationStart.y);
    } else {
        rotationEnd.x = rotationEnd.x + (x-rotationStart.x);
        rotationEnd.y = rotationEnd.y + (y-rotationStart.y);
    }

    rotationStart.x = x;
    rotationStart.y = y;
    _currentRotation = CC3VectorMake(rotationEnd.y, rotationEnd.x, 0);
    NSLog(@"Current x is: %f y is: %f z is: %f",_currentRotation.x,_currentRotation.y,zRotationEnd);

}

Z rotations:

- (void) rotateAroundZ:(float) z newRotate:(BOOL) isNewRotate
{
    if (isNewRotate) {
        zRotationStart = 0;
    }
    zRotationEnd = zRotationEnd - (z - zRotationStart);
    zRotationStart = z;
}

And the vertex shader:

attribute vec4 Position;
attribute vec4 SourceColor;

varying vec4 DestinationColor;

uniform mat4 Projection;
uniform mat4 Modelview;

attribute vec2 TexCoordIn;
varying vec2 TexCoordOut;

void main(void) {
    DestinationColor = SourceColor;
    gl_Position = Projection * Modelview * Position;
    TexCoordOut = TexCoordIn;
}

I would really like to get this right, so any help will be appreciated.

Cheers!

sentences:
How can I properly detect my cars collisions using hitboxes? I have created two car objects and their current speed is represented as the len variable.

This is the code:

Under Blue Car Collision Event:

if (place_meeting(x,y,obj_CarRed)) { // Checking Collision
    len = 0 //Current speed
    if (len < obj_carRed.len) { // Blue Car's current speed is greater than Red's
        myHP -= obj_carRed.len/2
    }
}

So I copied the code to the other object and replaced Red with Blue. When the Red car crashes into the Blue car, the Blue car takes damage because the Red car is traveling faster than the Blue car. But when the Blue car crashes into the Red car, the Red car won't take any damage.

Later, I thought about using a Hitbox and have it as a parent for both cars, but I don't know if it would mess up the collisions, and I don't know how to tell the hitbox that it's been created by Blue Car, or by Red Car. I don't know if I should make a new hitbox for each car or one for both.

sentences:
OpenGL ES 2.0: Setting up 2D Projection This article describes in general, how to draw sharp OpenGL 2D graphics, using fixed function pipeline.

http://basic4gl.wikispaces.com/2D+Drawing+in+OpenGL

Because OpenGL ES 2.0 has some ES 1.x functions not available (such as: glOrtho()), their functionality must be substituted in Fragment/Vertex shaders.

My question is, how to setup the following 2D projection in programmable function pipeline?

const XSize = 640, YSize = 480
glMatrixMode (GL_PROJECTION)
glLoadIdentity ();
glOrtho (0, XSize, YSize, 0, 0, 1)
glMatrixMode (GL_MODELVIEW)

How Fragment and Vertex shaders must be configured to fully substitute the above mentioned fixed function 2D projection setup?

sentences:
XNA C#: How can I prevent blurring when drawing from a RenderTarget2D? I'm making a game and I want the end graphics to look chunky and pixellated, so I'm drawing from the spritebatch onto a RenderTarget2D which is 1/4th the size of the actual backbuffer, and then drawing from that to the backbuffer.

At first the sprites were blurred by antialiasing and I read that using SamplerState.PointWrap in the spritebatch Begin call would ease this a bit so I made that change. Everything seemed better, however the final on-screen image is still blurry and I think this is because of how it draws from the rendertarget2D to the backbuffer.

The image here is a comparison - On the left is how the output looks now and the right is how I want it to look.

sentences:
Unity 2D: Position Child Object to center of Parent Object What I'm trying to achieve is snapping a child object to the center of its parent object after dragging and dropping it.

The moving object successfully follows the mouse, and drops. It also successfully selects a dynamic parent when it moves over a new node.

What it does NOT do is then snap to the center of its parent. It instead jumps all over the screen and snaps to nothing.

Here is all of my code:

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

public class Object_Moveable: MonoBehaviour {

 private Vector2 mousePos;
 public float moveSpeed;
 public float offset = 0f;
 private bool following;
 private GameObject SelectedNode;

 // Use this for initialization
 void Start() {
  following = false;
  offset += 10;
 }

 void Update() {

  if (Input.GetMouseButtonDown(0) && ((Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position).magnitude <= offset)) {
   following = true;
  }

  if (following) {
   transform.position = Vector2.Lerp(transform.position, Camera.main.ScreenToWorldPoint(Input.mousePosition), moveSpeed);
  }

  if (Input.GetMouseButtonUp(0)) {
   following = false;
   //Attach (Node, 0, 0);
   transform.localPosition = SelectedNode.transform.position;
  }
 }

 void OnTriggerEnter2D(Collider2D trigger) {
  if (trigger.tag == "pipenode") {
   transform.SetParent(trigger.transform);
   SelectedNode = trigger.gameObject;
  }
 }
}

sentences:
After a succesful glLinkProgram, should I delete / detach my shaders? After I have a linked program, and thinking about defensive programming, should I delete and detach the shaders used to link this program?

If yes, is that going to free any resources? Or do these shader objects only going to be freed after a glDeleteProgram call?

edit: Just for clarification what I am doing is (which is consistent with the answer):

  glCreateShader -> glShaderSource -> glCompileShader -> glCreateProgram -> glAttachShader -> glLinkProgram -> glDetachShader -> glDeleteShader -> draw using this shader program -> and when I don't need this shader anymore glDeleteProgram

sentences:
Can Unity4 and Unity5 projects coexist in the same computer? I've Unity5 installed (free edition). When I started with Unity3D I did with 5 and never had the 4 before.

A friend has passed me legacy code of a 90% complete game he used to do with Unity4 as he no longer wants to dedicate to videogames, for me to use that to finish it.

If I load that code into the Unity5, the "automatic upgrader" starts to do lots of changes. And finally the thing does not play. Says All compiler errors have to be fixed before you can enter playmode!

The thing is he used some third-party libraries, like the tk2droot among others and seems that the code of that and other dependant libreries is rather old, so I do not only need to scan over his code for the "v4 to v5 upgrade changes" but also I've to scan all his dependencies, which is rather a suicide at least for an initial contact like "let's just see if this compiles".

Questions:

Is there any way make Unity5 "behave" as Unity4 so it does not do the code-upgrade
and it uses the old API? Ie: Compile v4-code within v5-IDE?
Alternatively, is is possible to freely install Unity4 parallel to Unity5 so they do not interact and I am able to compile his source un Unity4 while doing the new things in Unity5?

The easiest solution I can find is to have 2 computers, one with Unity4 and the other with Unity5 but seems a but weird to me. I'm sure I'm not the only one with this problem.

How do game developers with codebases in Unity4 and Unity5 make all the workflow?

PD: Focusing on Android now only. No need to publish for iOS, web, consoles, etc.

Thanks.

sentences:
Algorithm for spacing points out among a line I'm writing an angled tile system, and my implementation is to have a starting height and an ending height inside the tile.

Like so:

The starting and ending height allow me to get the length of the angle and the angle in degrees using atan2.

For collision against the angled tiles I give the tiles a collection of points along the line, and as a bounding box intersects any of a tile's slope points it will move the box's y position to that point.

This implementation works fine for 45 degree tiles, however with other degrees I don't know how to create the points on the line.

What algorithm could I use to space the points out along the line when they are not in a perfect 1 to 1 ratio angle? (e.g. 17 degrees instead of a nice 45 degrees)

EDIT: Here's a way to interpret my question perhaps more academically:

Given a length of a line and its angle, and an arbitrary number of points, find an algorithm that will space the points out among the line that will as closely resemble the angle.

sentences:
Does a 2D Vector or 2x2 Matrix play any role in 2D Transformations? I'm having trouble trying to figure out if a vec2 or mat2 class are used at all in transformations for 2D rendering. Vec2, apart from representing UVs, AFAIK, is relatively pointless in regards to homogeneity.

What about 2x2 Matrix? I guess if we're hanging on to temp variables for shear, scale, and/or rotation it could make sense, but I'm feeling like I'll never use it.

It isn't much effort to implement, but I'd like to know if I'm missing something, or if Vec2 and Mat2 are largely useful for representing objects in 2D space.

I do know that a 3x2 or 2x3 matrix is a more data efficient* way to store the data for affine transformations-- does vec2 have any utility in these sort of cases?

Or is this even true? Do alignment optimizations negate this advantage? Or is it only true for the data that we transfer into OpenGL?

sentences:
Blurring part of the screen - optimisation I develop 3d menu and sometimes I need to blur only part of the screen. I use a forward rendering. I create a frame buffer object with 3 color attachments. Rendering looks like this:

bind fbo
render objects which  are blurred to the first texture
bind the first texture
perform vertical blur and save a result in the second texture
bind the second texture
perform horizontal blur and save a result in the third texture
unbind fbo (render to the default fbo)
bind the thrid texture
render the third texture
render objects which are not blurred

I can use subroutines to reduce overhead during switching shaders. I also found the following article . Do you have any other ideas how to optimize above rendering ?

sentences:
unity how to make an animation reverse mid way through I have a animation of several parts moving (think bridge) and would like the animation to reverse mid way through if a certain condition is modified (function call). I have the Animation and the AnimationClip which are added via a script.

Currently this is the code:

Animation anim;
public AnimationClip Open;
// Use this for initialization
void Start () {
    anim = GetComponent<Animation>();
    anim.AddClip (Open, "Open");
    anim.Play ("Open");

}
void Update(){
    Debug.Log ("update");
    if (Input.GetKeyDown ("space")) {
        rev ();
        Debug.Log("reversing");
    }
}
void rev(){
    anim.Rewind()

}

However anim.Rewind() doesn't do what I want it to do it moves the animation back the the first frame rather then slowly move the animation backwards. I know there are some tricks involving the time or by changing the speed but I cannot figure those out either.

sentences:
How to reset scene (stage1) when selecting it from Level stagemain menu Good day I have a problem when the player finish stage 1 the screen look like this

Then going back to selecting level

When I try to play the stage 1 again. I want to reset the stage 1 so i can play it again.
I only use
Scene.LoadScene("stage1") in main menu to go to stage1 and
Scene.LoadScene("mainmenu") to back to main menu

sentences:
How a "Collision System" should be implemented? My game is written using a entity system approach using Artemis Framework. Right know my collision detection is called from the Movement System but i'm wondering if it's a proper way to do collision detection using such an approach.

Right know i'm thinking of a new system dedicated to collision detection that would proceed all the solid entities to check if they are in collision with another one.

I'm wondering if it's a correct way to handle collision detection with an entity system approach? Also, how should i implement this collision system?

I though of an IntervalEntitySystem that would check every 200ms (this value is chosen regarding the Artemis documentation) if some entities are colliding.

protected void processEntities(ImmutableBag<Entity> ib) {
    for (int i = 0; i < ib.size(); i++) {
        Entity e = ib.get(i);
        //check of collision with other entities here
     }
}

sentences:
How do I convert two vectors into a bounding box with 8 vertices? I created two vectors named bboxmin and bboxmax using the functions
vector3
applymin_xyz() and vector3
applymax_xyz().

How do I convert them to 8 vertices,so I can test cull with them?

sentences:
How can I scale my UI elements to the lesser screen dimension in Unity 5? I want to create a custom mobile pad for my game. The mobile pad consists of two parts (both inside an ui canvas):

The D-Pad, which will be anchored to the bottom-left side.
The button group will be anchored to the bottom-right side.

I would like to resize the element on different resolutions, so that the element (in my case, the D-Pad is an image):

Has a size of 20% of the minimum of the width and the height.
Has pivot of x=0.5, y=0.5.
Having anchor of left-bottom, its coordinates are (15%, 15%) wrt the minimum of the width and the height.

What I tried is to use an Aspect Ratio Filter in the D-Pad image with ratio=1, but it did not work as intended (the coordinates led the image to an unexpected place).

Note: I am a n00b to Unity. I don't know whether it is right but my Canvas Scaler scales by Constant Pixel Size

These images should illustrate what I want to achieve:

What should I do to make it work like in the pictures?

Edit I attached this behavior, based on answer, to handle the change by runtime:

[RequireComponent(typeof(UI.CanvasScaler))]
class CanvasSmartScaler : MonoBehavior {
    private CanvasScaler _scaler;
    void Start() {
        _scaler=GetComponent<CanvasScaler>();
    }
    void Update() {
        //OMITTED CODE: here I set the scale mode as in the Editor but right now i am in my mobile device and cannot remember the exact lines
        if (Screen.currentResolution.width < Screen.currentResolution.height) {
            _scaler.matchWidthOrHeight=0;
        } else {
            _scaler.matchWidthOrHeight=1;
        }
    }
}

And attached that behavior to the canvas. However, for my debug exe (just for debug purposes) it always picks the 1-case regardless how do I resize the window. What am I missing?

sentences:
GLFW mouselook under OSX I'm continuing to port an OpenGL app from Visual Studio 2012 to XCode 5.

The only major issue I'm having is mouselook. It "doesn't work" under OSX (Mavericks).

Here's the (pseudocode):

Pre-update, executed at the start of the frame:

void Dispatcher::PreUpdate(GameTime &time)
{
    m_currentKeyboardState = m_nextKeyboardState;
    m_previousMousePosition = m_currentMousePosition;

    GetMousePosition(m_currentMousePosition);
}

Post-update, executed, well, after input processing, at the end of the frame:

void Dispatcher::PostUpdate(GameTime &time)
{
    m_previousKeyboardState = m_currentKeyboardState;

    if (m_captureMouse)
        RecenterMouse();
}

Method to recenter the mouse:

void Dispatcher::RecenterMouse()
{
    glfwSetCursorPos(m_window, m_windowSize.x / 2.f, m_windowSize.y / 2.f);

    GetMousePosition(m_currentMousePosition);

    if (m_previousMousePosition != m_currentMousePosition)
        cout << "Mouse: " << m_currentMousePosition.x << "," << m_currentMousePosition.y << endl;

    m_previousMousePosition = m_currentMousePosition;
}

And, jut for completeness:

void Dispatcher::GetMouseMotion(Vector2 &movedBy)
{
    if(m_captureMouse)
    {
        movedBy.x = (m_currentMousePosition.x - m_previousMousePosition.x);
        movedBy.y = (m_currentMousePosition.y - m_previousMousePosition.y);
    }
    else
    {
        movedBy.x=movedBy.y=0;
    }
}

If m_captureMouse is true, and m_previousMousePosition != m_currentMousePosition, the y delta is always 1, no matter how far I've moved the mouse. (Actually, using the trackpad, but should be indentical.)

This code works perfectly under Win7, but never returns anything other motion than (0,1) under OSX.

Suggestions? I've seen other questions regarding glfw and osx, but no solutions.

EDIT

It's worth noting if I turn off mouse capture (which basically does everything but recenter the mouse at the end of the frame), mouselook works correctly but, of course, the cursor is free to wander outside of the window, which doesn't really work for a first-person app.

sentences:
How to generate point based on a map I am making a multiplayer game in Unity, with a socket.io server in NodeJS.
I am using a globe, with a texture to represent the world in Unity.

Let's say something similar do this.

Now, there I am stuck with some algorithm.

I would like to generate equally distant point, on the lands, where user can build stuff.

Something similar to this :

I saw this post here post and I would like to generate the map in the server, create from the generate map a mongoDB collection of point. When a user connect, he get back a list of point (that are already generated and can interact with those).

I get stuck on the generation. How do I make the server generate point based on a map that I will show to client, but that the server do not have idea of ? How would I store the coordinate position, so that the server generate them, and the client no matter the scale of the map would be able to display them at the good point ?

Basically, I don't know where to start to make this algorithm. I just would like some idea on how you would achieve this, so I can inspire myself to find my solution.

sentences:
Resource protection in cocos2d-x 2 and 3 I am developing a game in cocos2d-x 2.2.3 and I want to protect my resources from being extracted. Is there any way I can do this?

I don't know much about encryption.

sentences: Where are the logs created by Unreal Frontend? I am trying to read errors generated by a build and cannot locate the log file. Which directory is it in?

sentences:
Using C# summary documentation as tooltip in Unity In unity, I often end up with duplicating the  tags for code documentation, and the [tooltip] tags for the Unity Inspector.

Is there a way to automatically extract  tags into Unity [tooltip]s, or vice versa?

    /// <summary>
    /// This field sets the whirlygigs speed.
    /// </summary>
    [Tooltip("This field sets the whirlygigs speed.")]
    public float value;

sentences:
How to achieve an GPS-Based game like "Parallel Kingdom" I'd like to use Google Maps, in my game, much like "Ingress", "Pokémon GO" and "Parallel Kingdom".
When I take a deeper look into the Android API/Google Maps API, and dozens of forums, I noticed that it's very hard to display sprites or even animations using the Google Maps API. Someone said that you need to layer stuff. Someone else said it's better to use game engines for that. No one tells me how to begin. I opened Android Studios and made a new Google Maps project. I compiled and ran the app. There is the map, so I guess I have completed the first step.
How do I combine the Google Map with an extra view or LibGDX layer for displaying sprites? How manage this with a multiplayer server?
I am wanting to set my map up like "Parallel Kingdom", which you can see, below.

sentences:
vuforia how do I force objects into a 2D plane I'm working on a game in which cards are placed on a table and then rendered in augmented reality. These objects have 3D physics attached to them which doesn't work as well if they are either rotated or if the system mistakes them for being higher or lower then they really are.

Is there a good method to force Vuforia/Unity to place all items in the same 2D plane and keep all of them upright compared to that plane?

I currently have the following code:

using UnityEngine;
using System.Collections;

public class projectioncode : MonoBehaviour {
    Vector3 p1;
    Vector3 p2;
    Vector3 p3;
    Vector3 v1;
    Vector3 v2;
    Vector3 normal;

    /*
     *use a plane with the following 3 coordinates
     */
    public void setPlaneByPoints(Vector3 point1,Vector3 point2, Vector3 point3){
        p1 = point1;
        p2 = point2;
        p3 = point3;

        v1=p2-p1;
        v2=p3-p1;
        normal=getNormal(v1,v2);
    }

    public Transform projectTransform(Transform input){
        input.position = projectPoint (input.position);
        return input;
    }
    /*
     *  projects a 3d point into space;
     */
    Vector3 projectPoint(Vector3 point){
        Vector3 vOToPoint = point - p1;//vector between origin and point
        float dist = Vector3.Dot (vOToPoint, normal); //distance plane to point
        return point - dist * normal;
    }

    /*
     * caclulates the normal of 2 vectors
     */
    Vector3 getNormal(Vector3 v1,Vector3 v2){
        Vector3 res= (Vector3.Cross (v1, v2));
        res.Normalize();
        return res;
    }
}

This seems to project objects onto a plane but the results tend to be inaccurate and result in weird movements, particularly when moving the camera around.

This is what it looks like:

sentences:
IsoMetric Map draw: sort with Z-Buffer and anchor point I'm writing an IsoMetric renderer for my html5 isometric game. The isometric renderer should be able to render objects with floating point coordinates.

SOURCE: https://github.com/ilmattodel93/EaselJs-Isometric-with-Heightmaps

As now, the renderer works pretty well, but I have some questions and a problem to fix.
Note that little square is the anchor point, and lines are AABB (not correctly drawn I think).

THE PROBLEM

If you have a look at the demo, you should note that when the dragon is behind the tree on a higher level, it will be rendered over the tree instead of behind, as expected.

As you can see in js/mmo/renderer/IsoEntity.js#L91 and js/mmo/renderer/IsoLayer.js#L65, i have a "rough" implementation, and maybe it is'nt good.
I've googoled around and find something called "topological sort", i've attempted to implement it, but it does'nt seems to solve.

For each tile I have information about minX, minY, minZ, maxX, maxY, maxZ. An AABB as you can notice.

THE QUESTION

My question is, how can I solve this problem? Is it better (and will be faster) to maybe implement a depth-buffer? And how can I implement it? Will it ensure high performance? Maybe will a correct anchor point (represented with little square) solve the problem?

Thanks for any help! :D

sentences:
Object Composition in the Unity Editor I'm trying to learn how to use Unity for my class composition, and I was wondering if you could help me.

I'm trying to create a simple game where the player is trying to pop a bunch of balloons. However, any given balloon can only be popped if all of its conditions are met. Example conditions are:

The player color must match the balloon color
The balloon must be popped in sequence (balloon A must be popped before balloon C)
The balloon is only pop-able during a certain time window

And I'm sure you could think of more.

Balloons can have 0 to many conditions associated with them, but they follow the 80/20 principle where 80% will fall into a specific category (e.g. color-match-only, or color-and-sequence-only).

My Initial Solution

I created a "Balloon" class that contains a list of "ICondition" interfaces. When a collision occurs, the balloon loops through each condition to determine whether the balloon is pop-able or not. I populate this list within a "BalloonFactory" class. For 80% scenarios I can just pass in the name of the balloon type I want. For 20% scenarios I can pass a list of conditions.
This solution works, except for each new combination I need to change the factory code to include the new condition.

What I'd Like to Do

Instead of storing the balloon definitions in code, I'd prefer to create prefabs in Unity and use the editor to assign condition implementations to each balloon. My problem so far is that the Unity editor doesn't seem to like displaying a list of interfaces or abstract classes.

Is there some way to do what I'm trying to do here? Or is there a third option which you would recommend?

sentences:
How do you set multiple collision rules with Swift and SpriteKit? So basically I've got 2 types of balls and 2 types of enemies. Green can delete red only, red can hit delete only. Here's what I have for the first collision test:

 func didBeginContact(contact: SKPhysicsContact) {

        // 1. Create local variables for two physics bodies
        var firstBody: SKPhysicsBody
        var secondBody: SKPhysicsBody

        // 2. Assign the two physics bodies so that the one with the lower category
        // is always stored in firstBody
        if contact.bodyA.categoryBitMask < contact.bodyB.categoryBitMask {
            firstBody = contact.bodyA
            secondBody = contact.bodyB
        } else {
            firstBody = contact.bodyB
            secondBody = contact.bodyA
        }

        // 3. react to the contact between ball and bottom
        if firstBody.categoryBitMask == RedBallCategory &&
           secondBody.categoryBitMask == GreenBarCategory {

            (secondBody.node!.removeFromParent())
            score++
            scoreLabel.text = "\(score)"
        }
    }

This works as expected, red ball hits the green bar and it deletes him.

You can't just make a func didBeginContact 2 and change the bit masks as far as I'm aware..or at least it didn't work when I tried it, so how do you handle multiple rules for collision? All of the basic tutorials I've seen handle something like one bullet hitting one type of enemy. What if you have 2 "bullets" and 2 enemies?

sentences: SharpDX Texture to Image in C# I currently have an image processing application that outputs processed images post pixel shaders have been applied. However, using the examples I've found on the internet, the colors are flip to BGRA when RGBA is expected. I currently work around this with by post export processing to get the desired RGBA format. I was hoping someone else has dealt with this and has a solution that does not require post processing to correct the format.

sentences:
OpenGL 4D textures with bilinear interpolation I want to use and interpolated 4D texture in OpenGL, i.e. a texture that is accessed with a texture coordinate vector (s, t, p, q) and interpolated linearly in every texture coordinate.

The extension GL_SGIS_texture4D does exactly this. However, it is unsupported on literally every GPU I have access to.

If the was a GL_TEXTURE_3D_ARRAY, I guess I could sample the appropriate 2 layers of a 3D array texture with the (s, t, p) coordinates and then manually interpolate in the q coordinate. However, there are only "ordinary" GL_TEXTURE_2D_ARRAY texture arrays. A possible solution is to treat the texture array as 2D array of 2D texture, sample the appropriate 4 layers with (s, t) and then manually interpolate in p and q. This method is somewhat constrained by GL_MAX_ARRAY_TEXTURE_LAYERS. I am also afraid of the relatively large number of 2D texture fetches required to fetch a single 4D texture value.

Is there a simpler way of achieving 4D interpolated textures?

sentences:
What to do with unused vertices? Imagine yourself a vertex array in OpenGL representing blocks in a platform game.

But some vertices may be not used.

The environment is dynamic, so there always some vertex may suddenly become invisible.

What is the best way to make them not draw? Graphic cards are complicated and it's hard to predict what is best approach.

Few best ways I can think of:

delete and move all vertices after deleted one to fill freed space (sounds extremely inefficient)
set positions to 0
set transparency to maximum

I could of course benchmark, but what on my computer works faster doesn't have to on other.

sentences:
Math major as a viable degree While I realize there are many topics about CS vs software engineering vs game school programs, I haven't found anything relating to whether pure math degrees (with CS minor and electives) would also be a viable program. By this I mean: Would having a math major, CS minor put one at competitive disadvantage as compared to a pure CS program?

This relates specifically to game engine programming, more on the graphics side.

Background (for those who care): Currently a math major, CS minor at school and looking to land a career doing graphics engine programming. Admittedly, I love math and if at all possible would like to stay my current program as long as it doesn't put me at a competitive disadvantage trying to land a job post-graduation. That being said, I'm strong in the traditional C/C++ languages, strong concurrent programming skills, and currently produce self-made games for iOS. As an employer, how badly is the math major hurting me? Just want to get some advice from people already in the field!

sentences:
How to load a text file from a server into iPhone game with AS3 in Adobe AIR? Im creating an iPhone game with Adobe AIR, and I want to be able to load a simple text msg into an dynamic text box on the games front screen from my server (and then be able to update that text file on the server, so it updates automatically in the game after the game is on the app store) How would I go about acheiving that? is it as simple as using a getURL? are there any specifical issues with trying to do this on the iPhone via AIR that I should be aware of?

Thanks for any advice.

sentences:
When I add in Java transformationMatrix I can't see images? When I add in Java transformationMatrix I can't see images moving but when I remove it I can see why and how to fix it? Any ideas how to fix it?

My Renderer class:

public class Renderer {

    private static final float FOV = 70;
    private static final float NEAR_PLANE = 0.1f;
    private static final float FAR_PLANE = 1000;

    private Matrix4f projectionMatrix;

    public Renderer(StaticShader shader){
        createProjectionMatrix();
        shader.start();
        shader.loadProjectionMatrix(projectionMatrix);
        shader.stop();
    }

    public void prepare(){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        GL11.glClearColor(1, 0, 0, 1);
    }

    public void render(Entity entity,StaticShader shader){
        TexturedModel model = entity.getModel();
        RawModel rawModel = model.getRawModel();
        GL30.glBindVertexArray(rawModel.getVaoID());
        GL20.glEnableVertexAttribArray(0);
        GL20.glEnableVertexAttribArray(1);
        Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(), entity.getRotY(), entity.getRotZ(), entity.getScale());
        shader.loadTransformationMatrix(transformationMatrix);
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getID());
        GL11.glDrawElements(GL11.GL_TRIANGLES, rawModel.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
        GL20.glDisableVertexAttribArray(0);
        GL20.glDisableVertexAttribArray(1);
        GL30.glBindVertexArray(0);
    }

    private void createProjectionMatrix(){
        float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
        float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
        float x_scale = y_scale / aspectRatio;
        float frustum_length = FAR_PLANE - NEAR_PLANE;

        projectionMatrix = new Matrix4f();
        projectionMatrix.m00 = x_scale;
        projectionMatrix.m11 = y_scale;
        projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
        projectionMatrix.m23 = -1;
        projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
        projectionMatrix.m33 = 0;
    }
}

Edit added StaticShader class:

package shader;

import org.lwjgl.util.vector.Matrix4f;

public class StaticShader extends ShaderProgram{

private static final String VERTEX_FILE = "src/shader/vertexShader.txt";
private static final String FRAGMENT_FILE = "src/shader/fragmentShader.txt";

private int location_transformationMatrix;
private int location_projectionMatrix;

public StaticShader() {
    super(VERTEX_FILE, FRAGMENT_FILE);
}

@Override
protected void bindAttributes() {
    super.bindAttribute(0, "position");
    super.bindAttribute(1, "textureCoords");
}

@Override
protected void getAllUniformLocations() {
    location_transformationMatrix = super.getUniformLocation("transformationMatrix");
    location_projectionMatrix = super.getUniformLocation("projectionMatrix");
}

public void loadTransformationMatrix(Matrix4f matrix){
    super.loadMatrix(location_transformationMatrix, matrix);
}

public void loadProjectionMatrix(Matrix4f projection){
    super.loadMatrix(location_projectionMatrix, projection);
}
}

Edit vertexShader.txt

#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec3 colour;
out vec2 pass_textureCoords;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;

void main(void){

gl_Position = projectionMatrix * transformationMatrix * vec4(position,1.0);
pass_textureCoords = textureCoords;
colour = vec3(position.x+0.5,0.0,position.y+0.5);

}

sentences:
DirectX UV coordinates are flipped I'm loading a simple model, which is composed of vertices that have position, normal and UV texture coordinates.

The thing is, displaying that model using DirectX 9 or 10 shows that the UV coordinates are wrong. In fact, if I manually edit the texture using Paint and flip it vertically, the result is ok.

Is something wrong with my loading routines? Using Visual Studio Graphics Debuggers shows that both the model and the texture are correctly loaded.

Do I have to flip the texture vertically when I load it, or just transform the UV coords with:

u = u;
v = 1 - v;

Also, as far as I know, OpenGL differs from Direct3D for the UV coordinates system. Would those coordinates be ok with OpenGL without any transformation?

sentences:
Chroma depth shader unity I'm trying to reproduce a post-effect with unity seen in the answer here.

Chromadepth answer

For the moment I just manage to reproduce the wave effect with a quick edge detection.
I tried multiple textures but can't find one that fit do the same effect.

I am using this texture

The result for far.

Shader "Unlit/ChromaDepthEdge"
{

    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}
        _Ramp ("Texture", 2D) = "white" {}
        _Threshold("Threshold", Float) = 0.1
    }
    SubShader
    {
      Pass
      {
          ZTest Always Cull Off ZWrite Off
          CGPROGRAM
          #pragma vertex vert
          #pragma fragment frag
          #pragma target 3.0
          #include "UnityCG.cginc"

          struct appdata
          {
              float4 vertex : POSITION;
          };

          sampler2D _MainTex;
          sampler2D _Ramp;
          // Request camera depth buffer as a texture.
          // Incurs extra cost in forward rendering, "just there" in deferred.
          sampler2D _CameraDepthTexture;
          float4 _MainTex_TexelSize;

          float4x4 _InverseViewMatrix;

          float _Threshold;

          void vert (
              float4 vertex : POSITION,
              out float4 outpos : SV_POSITION)
          {
              outpos = UnityObjectToClipPos(vertex);
          }

          fixed4 frag (UNITY_VPOS_TYPE screenPos : VPOS) : SV_Target
          {
              // Convert pixel coordinates into screen UVs.
              float2 uv = screenPos.xy * (_ScreenParams.zw - 1.0f);

              //uv.y = (uv.y *-1) + 1;
              // Depending on setup/platform, you may need to invert uv.y
              // Sample depth buffer, linearized into the 0...1 range.
              float depth = Linear01Depth(
                    UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv)));

              float2 uvDist = 3 * _MainTex_TexelSize.xy;

              float depthUp =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(0, 1))));
              float depthDown =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(0, -1))));
              float depthLeft =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(-1, 0))));
              float depthRight =  Linear01Depth(UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, uv + uvDist * float2(1, 0))));

              float mean = ((depthUp - depth) + (depthDown - depth) + (depthLeft - depth) + (depthRight - depth)) / 4;

              // Compressing the range, so we get more colour
              // variation close to the camera.
              depth = saturate(2.0f * depth);
              depth = 1.0f - depth;
              depth *= depth;
              depth = 1.0f - depth;
              //return depth;

              // Use depth value as a lookup into a colour
              // ramp texture of your choosing.
              fixed4 colour = tex2D(_Ramp, depth * 6 * _Time.y * 4);

              return lerp(colour, colour * 6, mean > _Threshold);
          }
          ENDCG
      }

    }
}

What did I miss ?

Thanks in advance.

sentences:
How to create an instance of Windows Firewall interface object in Unity I am trying to make the game add itself into the Firewall rule. I already referenced NetFwTypeLib.dll into the project. It led me to this line of code here:

INetFwPolicy2 fwPolicy2 = Activator.CreateInstance(typeof(INetFwPolicy2)) as INetFwPolicy2;

This gave me an exception of:

MissingMethodException: Default constructor not found for type NetFwTypeLib.INetFwPolicy2

I already tried

Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));

which led me to another exception of:

NotImplementedException: Unmanaged activation is not supported

I don't know what to try anymore. Thank you in advance.

sentences:
C# Monogame Enemy shooting at random intervals I am currently coding a simple Monogame Space Shooter.

I have almost finished my enemy shooting behaviour,
but I spent a long time on fixing it and got to the point
where I wanted somebody to help me out.

Okay so basiclly I have my 9 enemies (instances of Enemy class) in my
Level class, and in level update I do stuff like checking if enemy has been hit by player, if they are Dead so I can remove them from the list etc.

I made a simple Timer class that has only 1 function, uses

var timer += GameTime.ElpasedGameTime.TotalMiliseconds

and simply checks if timer is bigger or equal than function input parameter(or argument?), and func is a bool so it then returns T or F.

Now inside my Enemy.cs claas I have this function:

public bool IsShooting()
        {
            if (enemyTimer.Wait(randomFloat))
            {
                shot = true;
                return true;
            }
            else
            {
                shot = false;
                return false;
            }
        }

enemyTimer = new Timer() & randomFloat = field(variable at the top of the class)
in my Enemy class.

And now last but not least(actually the problem here) is this, so now in my Level class I got this little update function:

public void Update(Weapon weapon)
        {
            if (enemies.Count == 0)
                isFinished = true;

            if(!isFinished)
            {
                for (int i = 0; i < enemies.Count; ++i)
                {
                    if (enemies[i].shot)
                    {
                        seconds = rand.Next(1, 10);
                        randMiliseconds = 1000f * seconds;
                    }

                    enemies[i].randomFloat = randMiliseconds;
                    enemies[i].Update();

                    if (enemies[i].isDead == true) // If enemy is dead, remove it from level
                    {
                        enemies.RemoveAt(i);
                        --i;
                    }

                    foreach (Bullet bullet in weapon.bullets)
                    {
                        if ( !(i < 0) && weapon.ShotEnemy(bullet, enemies[i])) // If not enemies count == 0 and if
                        {                                                      // enemy has been shot decrease its health
                            enemies[i].Health -= weapon.Damage;                          // and set bullet visibility to false;
                            bullet.isVisible = false;
                        }
                    }

                }

            }

        }

This for loop goes through all the enemies, first if block is used for checking that
if the enemy has shot the bullet, then set random value again to something different, if shot has not yet been fired then use the old value and wether it has been changed or not it sets randomFloat field in Enemy class to that value.

Now this is how it works: First all of 9 enemies shoot 1 bullet at the same time (Just about when I open the window, cause I putted randomFloat = 1000f; in my Enemy CTOR), and then randomFloat value is set in Level class to something different, I have message output and FOR EVERY DAMN ENEMY randomFloat is the same.... now that is a problem, I want the rand value to be different for all of them, and it should, right?
Becouse those 9 enemies are all different instances of that class and if in each for(;;) loop cycle in my Level.Update() if it gets positive value that enemies[index] has fired a shot it should change it to some number that is very unlikly to be the same for all 9 enemies (seconds = rand.Next(1,20); randomFloat = 1000 * seconds; ). So basiclly randomFloat get random, but it is the same every time for all enemies, and they all shot and will shot at the same random Time

Expected result: Every enemy shooting at different random time

sentences:
Where is XNA headed? I love XNA. I really do. As president of the Game Development Club at my school, we use it and I teach it. But I'm worried about it.

I've always wondered, are there any signs that XNA will ever become more than just a prototyping/arcade game language? I've always gotten the feeling that Microsoft is on the cusp of abandoning it, like they did Managed DirectX. The Xbox Live Arcade is an amazing idea but it's shoved off to the side, well overshadowed by the "real" Xbox games when I feel like it would've had so much more potential, had Microsoft given it more emphasis.

Now with XNA 4.0 CTP for Windows Phone 7 only, it seems to be morphing into some sort of phone-only thing. I'm really unsure about exactly why they are doing that.

What's the current state of XNA, and where is it headed? Is it going into mobile-only, or will 4.0 eventually be released for Xbox and desktop usage?

In other words, is it a language to invest time and money into, or should it be only tentatively developed on, with the constant fear of abandonment? And when I ask this, I'm talking about desktop and Xbox games, as I can pretty clearly see that it is the game framework of choice for the Windows Phone 7 platform.

Since this question is somewhat subjective (but I'm really looking for facts alongside your opinions!) I am making this a CW.

sentences:
GameObject transform with respect to local camera? I'd like to recycle objects as they pass behind the camera frustum -- i.e, the plane of the local Z axis, orthogonal to the camera vector:  Camera.main.transform.forward.

Is there a nice method to test for the above case?  That is, "if a GameObject's location < local Z = 0 plane", we can know that it is behind the camera.

sentences:
Project 2d click/touch onto 3d plane I have a 3d scene that contains an infinite plane that is NOT parallel to the camera (so every screen coordinate corresponds to a point on this plane- in other words, there are no possible invalid clicks/touches).

I have all the information you'd expect to work with: camera pos, dir, fov, aspect ratio, the 3d points defining the plane (either as a triangle, or as a normal + distance), the view/projection matrices that project it onto the screen, etc...

I haven't found anything online that answers this in a straightforward way. Please no "use this or that library". Also, if you're going to say "invert the matrix", please give a way to go about doing that (I don't think the matrix is easily/possibly invertable, as the "project to 2d" process involves the divide-by-w step, rendering the final translation between 3d to 2d non-affine).

sentences:
Player losing alignment with tilemap after moving I'm using an isometric tilemap(2:1) and I can't figure out how to make grid based movement on it's surface. I managed to get a code working for the grid based movement, moving my character with 0.5 along the Y axis and 0.86 ( sqrt(3)/2 ) along the X axis since I imagine it should work as if they are diamonds with the side of 1 unit, but it doesn't align with the center of the next tile. Here is my movement code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions.Must;

public class Movement : MonoBehaviour
{
    Vector3 pos;         // For movement
    float speed = 5f;   // Speed of movement
    public float x = 0.86f;
    public float y = 0.5f;

    void Start()
    {
        pos = transform.position;          // Take the initial position
    }

    void FixedUpdate()
    {
        if (Input.GetKey(KeyCode.A) && transform.position == pos)
        {        // Left
            //pos += Vector3.left;
            pos += new Vector3(-0.86f, 0.5f, 0);
        }
        if (Input.GetKey(KeyCode.D) && transform.position == pos)
        {        // Right
            //pos += Vector3.right;
            pos += new Vector3(0.86f, -0.5f, 0); // miscare in diagonala
        }
        if (Input.GetKey(KeyCode.W) && transform.position == pos)
        {        // Up
            //pos += Vector3.up;
            pos += new Vector3(0.86f, 0.5f, 0);
        }
        if (Input.GetKey(KeyCode.S) && transform.position == pos)
        {        // Down
            //pos += Vector3.down;
            pos += new Vector3(-0.86f, -0.5f, 0);
        }
        transform.position = Vector3.MoveTowards(transform.position, pos, Time.fixedDeltaTime * speed);    // Move there
}

sentences:
Random 100x100 map using all levels from 1 to 100 I'm developing a game where players walk though a 100x100 grid of different rooms.
Each room has a level associated with it starting from lvl 1 to lvl 100.
The map is divided into 10x10 areas and in the middle of each area there's a 2x2 "castle" which players must conquer in order to access next levels castles (so if players start off at lvl 1 they need to conquer the lvl 1 castle before being able to enter lvl 2 castles).
Each room in a castle (2x2 area in the middle of each 10x10 area) has the same level and there must be a castle for each level from 1 to 100.
As for now I was generating the whole map "statically" and use the matrix blur to interpolate room levels between castles.
What I would like to achieve is having a seeded function f(x,y) that returns the level of the room at position (x,y) without pre-defining the matrix.
I checked out Perlin Noise functions, but it doesn't guarantee each level between 1 and 100 is taken nor the right position of the "castles".

The image above is the starting point of the game map, lower levels of green represent lower room levels, the blue squares in the center are the castles. This image is then blurred preserving just the castles level.
Players can move around the map and will meet harder challenges in higher level rooms. The goal is reaching level 100 by spotting and conquering each castle in sequence.

sentences: What is the status of Monogame now that XNA has been discontinued? XNA has officially been discontinued, with support no longer being offered by Microsoft. Does this mean that Monogame has died also? I see that the site still says it is based upon XNA 4. What is the official status of Monogame?

sentences:
XNA GameTime before first Update Using XNA, is it possible to access the GameTime object before Update is called for the first time?

Can it be used in the game constructor, Initialize or LoadContent methods?

sentences:
How to implement server side auto attack? I'm writing a basic MMORPG and im trying to implement auto attack.

At client side I send an AutoAttackMessage to the server.

Should I send this message every X ms to the server, or juste one time and then server handle this himself ?

How to handle delay between 2 auto attack at server side ? (timer, special thread)...

sentences:
Recenter User Orientation on X and Y axis on with Oculus GO and Unity I am working on an Oculus GO App for patients in a doctors chair. They'll be using Oculus GO Headsets while sitting, lying, or something in between. So what I am trying to do is to recenter the HMD orientation when the HMD is mounted. But since the patients position can be seated or lying horizontally, I will need to recenter the rotation on all three axis, or at least X and Y.

Unity provides:

UnityEngine.XR.InputTracking.Recenter();

But that will only recenter the Y Axis.

Oculus Integration provides:

OVRManager.display.RecenterPose();

But under the hood its just using the Unity InputTracking.Recenter() again.

So how can I recenter my whole scene or the player on y-axis as well?
If you go to Oculus GO main menue and push the recenter button on your controller, it does exactly what I want. However I can't find a way to do the same thing in my Unity application.

Thanks in advance!

sentences: Will Google Play Game Services allow turn-based gameplay? Will the Google Play Game Services multiplayer allow (turn-by-turn) gameplay like DrawSomething?

sentences:
How do I not let my explosion go through the walls like bomberman? I have this problem that I want to fix. Every time I place a bomb it goes pass through the wall even if I added a Layermask to tell if it's a wall or not.

public LayerMask levelMask;
public GameObject explosion;

void Start()
{
    Invoke("Explode", 1f);
}

void Explode()
{
    Instantiate(explosion, transform.position, Quaternion.identity);

    StartCoroutine(CreateExplosions(Vector2.up));
    StartCoroutine(CreateExplosions(Vector2.down));
    StartCoroutine(CreateExplosions(Vector2.right));
    StartCoroutine(CreateExplosions(Vector2.left));

    GetComponent<SpriteRenderer>().enabled = false;
    Destroy(gameObject, .3f);
}

private IEnumerator CreateExplosions(Vector3 direction)
{

    for (int i = 1; i < 3; i++)
    {

    RaycastHit hit;

    Physics.Raycast(transform.position + new Vector3(0,.5f,0), direction, out
    hit, i, levelMask);

    if (!hit.collider)
    {
    Instantiate(explosionPrefab, transform.position + (i * direction),
    explosionPrefab.transform.rotation);
    }
    else
    {
    break;
    }
    yield return new WaitForSeconds(.05f);

    }
}

sentences:
Clamping after forcing aspect ratio I'm using the following script to force aspect ratio of 16:9:

https://forum.unity.com/threads/force-camera-aspect-ratio-16-9-in-viewport.385541/

It works perfectly. However now my game objects are allowed to move off the edges. The camera of the game is fixed, and never needs to move or scale.

I have changed my code to WorldToViewportPoint for this but half my of character still goes off the edge.

void Update()
 {
     Vector3 pos = cam.WorldToViewportPoint(transform.position);
     pos.x = Mathf.Clamp01(pos.x);
     transform.position = Camera.main.ViewportToWorldPoint(pos);
 }
 private void FixedUpdate()
 {
     Vector3 pos = cam.ScreenToWorldPoint(Input.mousePosition);
     if (pos.x - transform.position.x > 0.5f)
     {
         transform.eulerAngles = new Vector2(0, 180);
         animateOgre(true);
         Vector2 move = new Vector2(1, 0);
         rb.MovePosition((Vector2)transform.position + (move * speed * Time.deltaTime));
     }
     else if (pos.x - transform.position.x < -0.5f)
     {
         transform.eulerAngles = new Vector2(0, 0);
         animateOgre(true);
         Vector2 move = new Vector2(-1, 0);
         rb.MovePosition((Vector2)transform.position + (move * speed * Time.deltaTime));
     }
     else
     {
         animateOgre(false);
     }
 }

My questions are:

How do I allow the whole character to stay within the Viewport?
How can I clamp within the fixed update method rather than making a
seperate update method.
Is there anyway to prevent character from moving when the mouse is
aligned up with the position of the character. Right now I'm using a
hacky solution to find if the x difference is > 0.5. (If i don't do
this the character just moves back and forth when mouse stops)

sentences:
Node.js/V8 as a Platform for High End Local PC Game Development? As a Web/UI dev rapidly expanding into more wide-open generalist territory, the more I learn about how its done in other languages, the more I love JS for architectural and basic messaging/event-driven concerns. For the record I am most certainly not a full-blown game-dev (although I did once write for a major gaming mag which is like saying I pretended to be friends with game devs on TV, although you guys were always my favorite folks to talk to).

Anyway, since it's fairly easy to bind C and C++ to JavaScript via Node (or perhaps more specifically V8), how reasonable would it be to assume you could write a decent 3D engine that exposed outcomes of things like collision calculations as events to the JS with the intention of getting the dynamic first-class-function party language benefits (assuming you see such things as benefits - I do) to higher level architecture and AI logic concerns without a crippling loss in performance?

Node, as I understand it, basically exposes a C event loop to JavaScript handled by V8. The JS is single-threaded, meaning any attempt to do anything calculation/IO-intensive with the JS would be foolish, but you get the advantage of not really having to sweat threads, queuing etc... since you're ideally never trying to muck with the same data at the same time. Most code would of course be heavily event/callback driven. All the file I/O concerns and other processor intensive stuff is basically C or C++ under the hood telling you when its done. Not to mention handling UI concerns directly out of the JavaScript via a webkit layer slapped on top of everything.

I'd be delighted to hear why you love/hate the idea but the core question is: is it feasible and why/not? And no, I seriously doubt my own ability to do this all by myself, although plugging an existing 3D engine in might not be outside of the realm of possibility but I'd still be learning a lot of new stuff to make that happen I'm sure.

sentences:
Instantiate prefab randomly but not in already occupied position I want to generate bubbles randomly on screen. When a bubble is generated in one place then other bubbles should not be generated near its radius 1 area, so they can not collide or trigger with any other bubbles.

How can I do it ?

public void GenerateBubble ()
{
    newBubbleXPos = Random.Range (-7, 7);
    newBubbleYPos = Random.Range (-3, 3);
    bubbleClone = (GameObject)Instantiate (bubblePrefab, new Vector3 (newBubbleXPos, newBubbleYPos, 0), Quaternion.identity);
    UIManager.instance.ChangeBubbleSprite (bubbleClone);
    bubbleList.Add (bubbleClone);
    if (bubblePosList.Contains (bubbleClone.transform.position)) {
        bubbleClone.transform.position=new Vector3(Random.Range (-7,7),Random.Range (-3,3),0);
    }
    bubblePosList.Add (bubbleClone.transform.position);
    bubbleClone.transform.parent = UIManager.instance.CurrentLevel.transform;
    GLOBALS.bubbleCounter++;
}

In this code every bubble is generated in a different position, but they can collide with other bubbles.  I want to generate new bubbles not at the same position. My bubble colliders's radius is 1.

sentences:
most efficient Bounding Sphere vs Ray collision algorithms Is there a known 'most efficient' algorithm for Sphere vs Ray collision detection?

I recently stumbled accross Arvo's AABB vs Sphere collision algorithm, and I am wondering if there is a similarly noteworthy algorithm for this.

One must have condition for this algorithms is that I need to have the option of querying the result for the distance from the ray's origin to the point of collision. Although if there is another, faster algorithm which does not return distance, then in addition to posting one that does, also posting that algorithm would be very helpful indeed.

Please also state what the function's return argument is, and how you use it to return distance or a 'no-collision' case. For example, does it have an out parameter for the distance as well as a bool return value? or does it simply return a float with the distance, vs a value of -1 for no collision?

sentences:
How to avoid spaghetti in the animator? I am working with animations in Unity and so far I have made only four (Up Down Left and Right) and my animation window looks following...

Problem is that if I was moving Up I want hero to stay looking Up not go to 'neutral idle' (or however he started), but that means I have 4 Idle positions... and each of them can transition to Up, Down, Left or Right and they go exponentially with each additional action...

Which makes me feel like I am doing something wrong....

Is there a better way of making transitions between different actions?

sentences:
How do I determine how far to move an object in the client when using client-prediction? I have a game server which, for testing purposes, is updating once per second, or 1hz so I can correctly implement client-side prediction. Everything is running locally at the moment so there is no lag issues to deal with, but this setup replicates potential packet loss, or if the server somehow is behind on processing.

I am using Unity for the client. I have a tunnel where the position is updated on the server and then broadcast to each client each tick (once per second). The client simply then lerps between its current position, and the new position received from the server, and this seems to work nicely.

However, as I have set the tick to 1hz, there are unexpected results where the position seems to pulse, rather than smoothly transition. An example can be seen below.

It can perhaps be seen more clearly without lerping

I have tried constantly increasing the tunnel's position in the client, but if it's moved too far in the client, once the server's position is received, it is snapped back to that position which creates some weird rubber-banding like effects even though there is no lag.

How can I determine how much to move the tunnel in the client to create some seamless movement, even when the tick rate is so low? Baring in mind this movement is variable, so it can move faster/slower at times so the movement in the client cannot be a fixed number.

Yes, I can just increase the tick rate which gives smooth movement, however, there is no lag to account for as it's all local so I am just preparing for when I move the server to actual hosting.

Instead of lerping between the current position and the received position, should I be trying to lerp between the current position and the next received position?

Lerp:

        Vector3 currentPosition = transform.position;
        Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, tunnelPositionZ);

        transform.position = Vector3.Lerp(currentPosition, newPosition, Time.deltaTime);

DMGregory's solution attempt:

If I decrease the 1.0f for the blend variable, the tunnel will move very slowly and then jolt forward when a snapshot is received. Decreasing the 1.0f to around 0.1f seems to align the speeds but there is still a noticeable jolt.

I'm using the same velocity for the currentPosition and newPosition because the velocity never changes.

    float dT = Time.time - latestSnapshot.arrivalTime;
    float blend = Mathf.Clamp01(dT / 1.0f);

    Vector3 currentPosition = transform.position;
    Vector3 currentVelocity = rigidbody.velocity;

    Vector3 newPosition = new Vector3(currentPosition.x, currentPosition.y, latestSnapshot.tunnelPositionZ);
    Vector3 newVelocity = new Vector3(currentVelocity.x, currentVelocity.y, latestSnapshot.tunnelVelocityZ);

    Vector3 velocity = Vector3.Lerp(currentVelocity, newVelocity, blend);

    Vector3 position = Vector3.Lerp(
               currentPosition + velocity * dT,
               newPosition + velocity * dT,
               blend);

    transform.position = position;

sentences:
Getting unit to complete rotation before moving? I've been trying to get a unit in my project to move in a fashion similiar to that of modern MOBA games.

However, I am faced with the issue of the unit moving before the rotation is completed and the unit moving along the Y-axis.

I have tried using a cooroutine to allow the rotation to completed first, but to no avail.
Any help would be greatly appreciated.

using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour {

    public float smooth;
    public float speed;

    private float z;
    private float x;
    private Vector3 targetPosition;

    // Use this for initialization
    void Start () {

    }

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

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {

            speed = 1;
            smooth = 20;

            RaycastHit hit;

            //var playerPlane = new Plane(Vector3.up, transform.position);
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            //double hitdist = 0.0;

            if (Physics.Raycast(ray, out hit))
            {
                targetPosition = hit.point;

                x = hit.point.x;
                z = hit.point.z;
                //var targetRotation = Quaternion.LookRotation(targetPoint    - transform.position);
                //transform.rotation = targetRotation;
            }
        }

        StartCoroutine(Turn(x,z));

        //transform.position = Vector3.RotateTowards(transform.position, targetPosition, speed*Time.deltaTime, 0.0f);
        transform.position = Vector3.MoveTowards(transform.position, targetPosition, Time.deltaTime * smooth);
    }

    IEnumerator Turn(float _x, float _z)
    {
        Vector3 turn = new Vector3 (_x, 0, _z);
        transform.Rotate(turn, speed);
        yield return null;
    }
}

sentences:
Implementing a hook (Like pudge in Dota) I'm coding a new game, which involves hooking.

Ive been testing a couple of ideas now and im quite stuck.

The player can throw a "hook" which fires away in the aimed direction, until it hits something, it will bounce on some obstacles and will return to the player if hitting other obstacles. While the hook is in the air, the player can move as he/she wishes, and hook will after a certain time be pulled back to the player.

I don't know if you guys have played pudge wars, but that is the kinda hook I'm after.

What do you think is the best approach in simulating this?

Should i save points a long the way?

Edit: Yes the bounce thing is a from pudge wars.
And yes the length, not time, that is true!

sentences:
Is the source code of the Source Engine available? Is the full C++ source code of the Source Engine available?

I know the SDK is available with the purchase of a Source-based game, but my goal is to find a open-sourced game engine that includes its full implementation details for learning purposes.

sentences:
How can I place the player into a 360° video in UE4? I have a 360° video (6 separate videos stitched together into a panorama) with a first person view walking through an environment. I would like to put this in a game engine such that the actor can walk forward and backward and it will feel like they are in the environment.

I have tried this in UE4 but am somewhat new to all this. I'm not opposed to using UDK or Unity if that is easier. I have created a MediaTexture from the video asset. Now I'm trying to create a Material sphere that uses the MediaTexture and reflects it back so the actor is essentially in a spinning sphere. I keep getting stuck with these errors:

I understand that I must next construct a blueprint that reads the actor's movement to play back the video, and also rotate the texture coordinates according to the view of actor.

How can I do this?

sentences:
Closest to hardware/fastest pixel manipulation I am currently working on the concept of a game, but I'm running into some problems.

For the game, I'd like to be able to directly change pixels on screen. However, all approaches that I tried so far resulted in my programs being rather slow, even without game mechanics attached to it.

Since a lot of games are also running on 60 fps with changing every pixel, you would expect it not to be hard to achieve such frame rates, if you could find the right way of changing pixels. The speed that I am aiming for is also at least 60 fps (if possible even on low-end hardware)

What is (or what library has) the fastest way to achieve this? It doesn't really matter what language the library is for, as long as I can get those high speeds.

sentences:
SFML Segmentation Fault when using VBOs? I'm trying to follow along with the gltut tutorials and for some reason when I call GLDrawArrays my program segmentation faults. I've been looking at the state of my application with the Mac OpenGL Profiler and Googling and I can't seem to figure out why it isn't working. I may have missed setting some OpenGL state somewhere.

My code is here, it segfaults on line 32. If I don't call glEnableClientState(GL_VERTEX_ARRAY); and the respective glDisableClientState(GL_VERTEX_ARRAY); it compiles and runs, but I get no rendering, which is what I would expect given my limited OpenGL knowledge.

sentences:
Dynamically Discovering Game Content I am trying to determine the best way to dynamically discover new levels in my Windows Phone game. This is necessary because I will be selling some levels separately to those included with the initial game purchase. I assume that it is possible for such purchases to be automatically downloaded and merged into the same directory that contains the game itself.

All my levels are pre-processed and stored as XNBs. Ideally, I would be able to obtain an enumeration of all XNBs of a particular type (ie. Level) within my game directory, but I cannot find a means of doing this. Alternatively, if I could get a list of all XNB names then I could use a naming convention to identify levels. Unfortunately, I can't find a way to do that either.

Am I barking up the wrong tree here? Can anyone shed any light on how I might dynamically discover content in my game?

sentences:
Why can we use planes and military vehicles, but not other things? Something sounds a little odd. It seems to me the status quo that if I wanted to put a real car or motorcycle into a video game, say a Toyota or a Ferrari, everyone would say that the default position is that you're not allowed, and that you'd need to ask permission first, and that most likely permission wouldn't be granted, and that the license to place such a thing in my game would cost a fortune.

On the other I've noticed that people are much more confident about placing planes and military vehicles into a game, or display or render. I guess I'll start off with WW2 examples, and move from there. If we take the example of the P-51 Mustang fighter plane, it was manufactured by North American Aviation. That company doesn't exist anymore exactly, but was merged into North American Rockwell, which then became named Rockwell International, and now is part of Boeing.

OK, so there's no problem including a P-51 Mustang in your production. I guess you might say that the rights ownership transitioned so many times and over such a long period that Boeing really doesn't care if you include a P-51 Mustang in your production.

Let's take another example, Boeing P-26 Peashooter, a 1930s fighter plane. In this case the manufacturer was all along Boeing. I am confident there is still no problem in including this in your production. In this case you might say that the plane is so old Boeing doesn't care if you include it in your production.

You might say the same about the Mitsubishi and Kawasaki WW2 era planes.

Even more recently, with the F-16 you'd think rights holders would be General Dynamics or Lockheed Martin. I'm pretty sure you won't have a problem with including an F-16. One of the designers of the F/A-18 Hornet was McDonnell Douglas (now Boeing). Same thing goes here.

In fact you can fast forward all the way to the present to the F-35 Lightning II, which was designed and built by Lockheed Martin. I doubt very much there would be issues with including this plane in your production.

So the thing in common with all the above planes is that they're military.

If we consider civilian planes like the 737 and 747, I feel there is no problem displaying these and putting them into productions. GPL'd flight simulators have been taken and commercialized (sold), with these models in it, and I doubt very much either that permission was sought, or in the case that it was sought I'm almost sure they didn't pay for any license to have them in their game.

So with civilian planes I feel this is very much the same thing. Correct me if I'm wrong.

On the other hand if I said I was I going to include a Porsche 912 from the 60s in my production, you would say I would be crazy to do so without permission, and to get a license to do so would cost me a fortune. However I'd expect a completely different reaction to for example the Porsche 597 from the 50s.

So I'm noticing two things:

Military vehicles seem to be able to be used more permissively (a lot a more permissively).
Civilian aircraft seem to be able to be used more permissively) than civilian land vehicles.

As for boats and ships, it's something I haven't thought of that much. And in the case of VERY old civilian land vehicles, such as maybe the first Chevrolet from 1913, though I'd be guessing, I imagine wouldn't be a problem using its likeness in a production such as a film or game or something. It's very interesting, I feel if someone used the likeness of one of the earliest Ford motor cars, the problem would be to a much greater extent using the trademarked Ford logo than that the likeness of the actual Ford model. Does anyone know roughly speaking why there are these differences in the status quo?

sentences:
How and when should I update events occuring after a while? This question is not language specific but a more generic approach on how to deal with lazy updates for some game variables.

Let's say, for instance, that I want to implement a "character age system" for a game.

I guess that the "age" attribute does not need to be updated 60 times per second for each of my 10.000 or so RTS/MMO characters.

So, how to implement in the game loop the update of this "long term" variables that may have it value changed very sparsely?

At the moment, I would implement some global variables to accumulate the delta time between the frames until it reaches a certain value, then, it resets and updates that variables.

Is that correct? I mean, that's how things work? Or depending on the language/plataform you would set some timers, or events that trigger the update of these variables?

sentences:
Different number of lights => different shader I have a shader that computes lighting for each light.

PointLight PointLights[10];

uniform const float NumPointLights;

for(int i = 0; i < NumPointLights; i++)
{
lightVec = PointLights[i].Position - pos;
lightDist = length(lightVec);
    // Do other stuff with light here, etc.
}

If I set NumPointLights to 2, the loop still iterates 10 times, and discards the result of the last 8 iterations.

Should I set a compiler flag that will permit the loop to actually loop only 8 times, or should I make 10 shaders, a shader for each number of lights that can be rendered?

On some small pieces of geometry I occaisionally need 10 lights. 90% of the time I only need 1-2 lights. How do I proceed?

sentences:
Using Box2D / Physics with Tiles? Here is my issue.

I currently have Box2D setup and working. But, it works with my Entity system. So I can create static objects and dynamic moving ones, and they simulate fine.

However, my world is made up of tiles.

I have very easy ways of determining which Tiles a Body is intersecting, but I'm not sure how to tell this to Box2D.

I could obviously turn each tile into a Body but that would waste a lot of ram because I have 10s of thousands of tiles.

The tiles also form some cool patterns and can be converted to an empty tile at will.

My thought was to do something like this:

-Iterate the bodies, find which tiles they are touching, add these as static bodies into the world. Step the world. Remove the bodies.

This seems like a bit of a hack though and I am wondering if anyone can think of a better way.

Thanks

sentences:
Changing Box2D Body from Kinematic to Dynamic after contact What is the correct way to change a Kinematic body into a dynamic body?

context - I have a dynamic body as a projectile which has to be fired at a kinematic body (it is kinematic because i am tweening it around the world in random movements). when the projectile makes contact with the kinematic body I would like it to become a dynamic body and be affected by gravity and I will apply a force to the contact point.

At the moment I am simply changing the type with in a menthod called by the contactListener

body.setType(BodyType.DynamicBody);

my biggest issue is that gravity is not acting on the body once it is changed to dynamic, so I'm pretty certain I'm going about this the wrong way.

sentences: One single texture atlas? When I want to use texture atlasing, should I try to place all of my sprites into one single texture atlas?  Or are there times when I should have multiple smaller texture atlases?

sentences:
What does it mean to "release" a game in a country? I would like to understand what is the meaning of releasing (or not) a game in a particular country.

See for instance the case of Halo 2. According to this source the game was released in a set of countries (e.g., USA, Germany). I wonder about countries where the game was not 'officially' released. Does it mean that Mexico's market will receive a Halo 2 version that is not localized?

What happens when a game is not officially released in a specific country?

sentences:
How can I update my materials to work with LWRP? I'm using Unity 2019.1.6f1.

When I open a new scene with  the LWRP template project, I see errors from all materials in the scene. For example, the Jigsaw appears in my scene but in console window I see a message telling me:

  Jigsaw_Mat material was not upgraded. There's no upgrader to convert Lightweight Render Pipeline/Lit shader to selected pipeline
  UnityEditor.Rendering.LWRP.LightweightRenderPipelineMaterialUpgrader:UpgradeProjectMaterials()

All materials show this message, and I don't know what to do to fix these materials. How can I resolve this error?

sentences:
Why is SCNNode.rotation property a four dimensional vector? I don't understand why SCNNode's rotation property is a SCNVector4 instead of a SCNVector3. The documentation states that:

  The four-component rotation vector specifies the direction of the rotation axis in the first three components and the angle of rotation (in radians) in the fourth. The default rotation is the zero vector, specifying no rotation. Rotation is applied relative to the node’s pivot property.

What's the fourth axis? I tried adding a light (SCNLight) and if I don't specify the value of the 4th float in the vector the light has no effect (the scene is dark). Why? shouldn't a 3-dimensional vector (x,y,z) be enough?

sentences:
How to find the points of intersection of two OBBs In my game I need to be able to find the points of intersection between two OBBs.

I'm using Separate Axis Theorem to check if there's an intersection and get the penetration vector if there is one.

Can I use SAT to also solve this problem? If not, how can I solve this?

sentences:
Does Unreal Engine Has Good grapic texture editor or I have to Learn Maya? I'm new in game Development , and I had no experience of it (except programming)
So , for my Engine , I preferred to use Unreal Engine. So here's the question:
Are Maya or 3D'sMax needed to be learned or Unreal Engine has a built in Editor ?
and , in comment , After i learned graphic , witch programming Language Does Unreal Engine support and recommended ?

sentences:
How can I fix zig-zagging UV mapping artifacts on a generated mesh that tapers? I am creating a procedural mesh based on a curve and the size of the mesh gets smaller throughout the curve as you see below.

And the problem is UV gets zig-zagged as the size changes (it works perfectly when the size of the mesh is same throughout the curve).

 Vertices.Add(R);
 Vertices.Add(L);
 UVs.Add(new Vector2(0f, (float)id / count));
 UVs.Add(new Vector2(1f, (float)id / count));
 start = Vertices.Count - 4;
          Triangles.Add(start + 0);
                 Triangles.Add(start + 2);
                 Triangles.Add(start + 1);
                 Triangles.Add(start + 1);
                 Triangles.Add(start + 2);
                 Triangles.Add(start + 3);

 mesh.vertices = Vertices.ToArray();
         //mesh.normals = normales;
         mesh.uv = UVs.ToArray();
         mesh.triangles = Triangles.ToArray();

How can I fix this?

sentences:
How do you program the right analog stick of a controller in JInput? I have the Left Analog Stick programmed and accepting input (moving a character around). (getCompassDir() returns the values of the cardinal directions and NONE means the stick isn't touched):

// Left Analog Stick
public int getLeftAnalogStickDir() {
    // return the (x,y) analog stick compass direction
    if ((xAxisIdx == -1) || (yAxisIdx == -1)) {
        System.out.println("(x,y) axis data unavailable");
        return NONE;
    } else
        return getCompassDir(xAxisIdx, yAxisIdx);
}

This works perfectly. Now when trying to program the Right Analog Stick of the controller, I use the same code as above, but instead, I replaced xAxisIdx and yAxisIdx with zAxisIdx and rzAxisIdx (the x, y value of the right stick). The problem is that its not reading the input like the left Analog Stick.

Does anyone know why the right analog stick isnt working? I followed the tutorial from this book:

Pro Java 6 3D Game Development: Java 3D, JOGL, JInput and JOAL APIs

sentences:
Should I load scenes from files, or hard code them? In a game engine I'm working on, I'm using scenes similar to what you would find in Unity. The entities, in my game, are composed of reusable components and custom data which is linked to those components. Entities have children, and one parent. This is shown, below:

class Entity {
    ...custom data here...
    let parent : Component
    var children : [Component] = []
    var components : [Component] = []

    ...methods...
}

If the entities did not have custom data, then creating a scene would be described by the following steps:

Loading a file into memory.
Creating a tree of entities.
Adding components to them, with parameters listed in the file.

However, this does not leave room for custom data. My other alternative is to create a scene by creating a scene object, then hard-coding the entities in. It would look something a bit like this:

var opening_scene = Scene()

opening_scene.addEntity(Player())
opening_scene.addEntity(Car())
opening_scene.addEntity(Terrain())
...

The downside to this is that everything is hard coded. What can I do to create scenes in a game more efficiently?

sentences:
C++ OpenGL / SDL2 VBO -- Depth problem / Transparency I got a problem with my VBO.
When having textures. The far blocks overlay the near ones.

I tried editing the alpha, depth buffer, the VBO byte allocation.
Nothing works for me...

The FAR plane is overlapping the NEAR plane.

    //Alpha
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_CULL_FACE);
glDisable(GL_MULTISAMPLE);

glDepthMask(GL_TRUE);

sentences:
Where can I find code examples of different variations of Perlin noise? I have seen the PCG wiki, and it is a great resource. But a lot of the articles are very brief and it is hard to find good links on specific things.

I have been searching for ways to transform my Perlin noise height maps to make ridges, rivers, and other terrain features. I also can't find any articles on how to divide up the map into different areas for calculating texture coordinates or other values specific to the game. I have only been able to find websites detailing their software that can generate the different things, but no code or explanations. Are there any good sources of code examples/explanations on how to do the above mentioned with Perlin noise?

PS. This should probably be a community wiki. I don't know how to make it as one though.

sentences:
Translation over a vector trajectory I'm working on a particle field system, where the particles can go from a point of the map, to another point of the map, using an angle (with sin and cos).

By now, I can calculate the vector by defining an angle using the cos and sin

float X = sin(DEGREES_TO_RADIANS(45));
float Y = cos(DEGREES_TO_RADIANS(45));

That forms a trajectory, like in this image: (Trajectory in red)

I need the particle to follow that trajectory, to move over that trajectory and arrive to the the vector (X,Y).

How can I translate the object ONLY over the red trajectory?

sentences:
Calculating distance from viewer to object in a shader Good morning,

I'm working through creating the spherical billboards technique outlined in this paper. I'm trying to create a shader that calculates the distance from the camera to all objects in the scene and stores the results in a texture. I keep getting either a completely black or white texture.

Here are my questions:

I assume the position that's automatically sent to the vertex shader from ogre is in object space?
The gpu interpolates the output position from the vertex shader when it sends it to the fragment shader. Does it do the same for my depth calculation or do I need to move that calculation to the fragment shader?
Is there a way to debug shaders? I have no errors but I'm not sure I'm getting my parameters passed into the shaders correctly.

Here's my shader code:

void DepthVertexShader(
   float4 position : POSITION,
   uniform float4x4 worldViewProjMatrix,
   uniform float3 eyePosition,
   out float4 outPosition : POSITION,
   out float Depth
)
{
   // position is in object space
   // outPosition is in camera space
   outPosition = mul( worldViewProjMatrix, position );
   // calculate distance from camera to vertex
   Depth = length( eyePosition - position );
}

void DepthFragmentShader(
   float Depth : TEXCOORD0,
   uniform float fNear,
   uniform float fFar,
   out float4 outColor : COLOR
)
{
   // clamp output using clip planes
   float fColor = 1.0 - smoothstep( fNear, fFar, Depth );
   outColor = float4( fColor, fColor, fColor, 1.0 );
}

fNear is the near clip plane for the scene
fFar is the far clip plane for the scene

sentences:
What are "view frustum", "focal length" and near plane distance? I've been reading through "Mathematics for 3D game programming and Computer Graphics" lately. Specifically definition of the view frustum and how the APIs generally process it, author introduces the concept of a length e which he classifies as the focal length. And it makes absolutely no sense, isn't the whole notion of focal length incompatible with the pinhole camera concept (inf. small) which is at the heart of 3D APIs as Direct3D and OpenGL? I thought all I need is the aspect ratio, the distance from the near plane and the FoV which can be established from the distance from the near plane.

And then he simply drops it and speaks of near plane distance n, which I thought was the actual value of e. What gives? Isn't the distance from the near plane the same as the "focal length" since we're talking about a pinhole camera? How do they differentiate?

sentences:
Other procedural material generators for Unity? In the new version of Unity 3.4, unity announced that they would now support procedural materials (which is awesome, by the way). While I was researching it, I found this in the manual:

  Allegorithmic's Substance Designer can be used to create Procedural Materials, but there are other applications (3D modeling apps, for example) that incorporate the Substance technology and work just as well with Unity.

I don't have Allegorithmic's substance designer and don't plan on buying it soon. What other applications or 3D modeling apps can make procedural materials that work in Unity?

Edit: I found that Allegorithmic has a program called Player. But it is on Windows only. I'm on mac.

sentences:
Unity3d physics stability with low fixed timestep I'm developing a vehicle simulator game for mobile platforms. This vehicle has some hydraulic arms. I use hinge joints and configurable joints. There can be collisions to walls etc.

When I set a low Fixed Timestep (more fixed updates, less performance) like 0.001 it runs smoothly on editor and it handles the collisions well. But on the target mobile device, the performance drops to 2-3 FPS! So 0.001 (1000 fixed updates per second) is not an option.

When I change the Fixed Timestep to its default 0.02 value or 0.01, performance becomes acceptable on mobile. But when collisions occur, the vehicle is torn apart and everything flies away at a high velocity as if there was an explosion.

How can I achieve stable physics with 0.02 Fixed Timestep?

Note: I don't set the velocity or transform position. I move the vehicle by applying torque to the wheels.

Update 1 : The problem happens when the vehicle hits an obstacle that has a collider but doesn't have a rigidbody.

sentences:
Separate shader programs or branch in shader? I have a bunch of point lights and directional lights. Instead of checking the light type in the fragment shader and then branch for either point light calculation or directional light calculation, is it more efficient to use two separate programs, one for point lights and one for directional lights?

(Using deferred shading in OpenGL 3.3)

sentences:
Is there any "object" in monogame for windows phone 8, that is similar to Toast in Android? The title pretty much sums it all.

Is there any "object" in monogame for windows phone 8 (for monogame to be exact), that is similar to Toast in Android?

My purpose is to give a notification / hint at what user do, until certain period / until next user input.

For example:
If the player tapped "attack", then there is text shown "Select your target" in either top or bottom screen. Just like Toast in android.

Note 1 : I can do it manually, but i'm just curious. If I can use a pre-made function (such as Toast) it'll be simpler to implement, rather than making it myself.

Note 2 : Mine is a turn based tactic game (such as FF Tactic)

Thank you.

sentences:
Make perfect constant game animation using javascript I tried different ways to make constant animations using JavaScript and HTML. The problem is that they are never perfect.

If I want to move a square exactly 5 pixels every 50 miliseconds I would use that code:

var leftPosition = 0;

function move() {
    leftPosition += 5;
    document.getElementById("square").style.left = leftPosition + "px";
}

window.onload = function() {
    setInterval(move, 50);
};

What I mean by not perfect is that the square will sometimes move slightly faster or slower during it's course. To notice that you have to really pay attention to the moving animation.

I already tried to using requestAnimationFrame but happened the same thing. Is there a way to improve it?

sentences:
How do you get the collision plane when using AABBs? My collision detection initially seemed to work well enough, but my answer to this question shows that I have went with SAT testing now instead. My goal was to find the plane at which to slide the player when a collision happens, not to implement a commonly used method that 'works well enough' such as Minimum Displacement.

A more accurate and unique question would probably be how to find the first plane of collision in a (possible) multi-object collision of 1 aabb to 1+ aabb objects. My answer below is what I've went with, but please add your own and I'll happily accept them if they provide more than my own answer.

As the picture below demonstrates, from one frame to the next, if the red square moved from bottom up as the arrow points, I need something to show that the bottom face of the black square is what was collided with (or the top face of the red square).

From the book "Real Time Collision Detection by Christer Ericson" I am using the following code to get the first and last contact times of an AABB to AABB collision. I iterate through all cubes around the player in the direction of their current velocity (ensuring their velocity is handled in small increments if too large) and get the first contact time, then I sort all collisions by said contact time. I've modified the code below to report which edge was collided with (if it didn't start out with a collision), and with all of these things I can get the answer I needed.

// Intersect AABBs ‘a’ and ‘b’ moving with constant velocities va and vb.
// On intersection, return time of first and last contact in tfirst and tlast
int IntersectMovingAABBAABB(AABB a, AABB b, Vector va, Vector vb,
float &tfirst, float &tlast)
{
// Exit early if ‘a’ and ‘b’ initially overlapping
if (TestAABBAABB(a, b)) {
tfirst = tlast = 0.0f;
return 1;
}
// Use relative velocity; effectively treating ’a’ as stationary
Vector v = vb - va;

// Initialize times of first and last contact
tfirst = 0.0f;
tlast = 1.0f;
// For each axis, determine times of first and last contact, if any
for (int i = 0; i < 3; i++) {
if (v[i] < 0.0f) {
if (b.max[i] < a.min[i]) return 0; // Nonintersecting and moving apart
if (a.max[i] < b.min[i]) tfirst = Max((a.max[i] - b.min[i]) / v[i], tfirst);
if (b.max[i] > a.min[i]) tlast = Min((a.min[i] - b.max[i]) / v[i], tlast);
}
if (v[i] > 0.0f) {
if (b.min[i] > a.max[i]) return 0; // Nonintersecting and moving apart
if (b.max[i] < a.min[i]) tfirst = Max((a.min[i] - b.max[i]) / v[i], tfirst);
if (a.max[i] > b.min[i]) tlast = Min((a.max[i] - b.min[i]) / v[i], tlast);
}
// No overlap possible if time of first contact occurs after time of last contact
if (tfirst > tlast) return 0;
}
return 1;
}

sentences:
Twine disabling style characters not working when using Harlowe format According to the Twine documentation, if a word has asterisks around it, it's rendered in italics:

Italics = *Italics*

If I want to literaly show the asterisks, then I need to put some extra characters around it:

*Boom!*   == ``*Boom!*``

What is ` ?

Is it '? Because I don't get the desired results when writing ' '*Boom!*' ' or "*Boom!*".

In fact, ''text'' seems to be equivalent to **text** even though it doesn't say that on the doc pages the program links me to.

sentences:
Collision resolution in case of collision with multiple objects I have static objects and movable objects. The collisions are detected using the separating-axis-theorem.
For example, in this situation I have two static objects (in red):

and a movable object between the two:

My algorithm is able to compute the collision between two of these objects, and it also spits out a perfect resolution vector (meaning a minimum-displacement-vector) to the collision.
So for example, when I check the collision between the green rectangle and the right red rectangle, the algorithm spits out a vector that tells me how I need to move the green rectangle in order to resolve the collision:

Notice that I just quickly drew this in MSPaint, so in that picture it could actually be that the minimum-translation-vector pushes the green rectangle out on the top, but I'm going to assume here that pushing it out to the left/right is actually shorter.
The general way of approaching this would be to only resolve the collision of one collision per frame, instead of all at once. But in my case, this would result in flip-flopping:
First, the solver detects two collisions but only resolves the collision between the right rectangle and the green rectangle:

Then, in the next frame, it detects only one collision which is between the left red rectangle and the green rectangle, and resolves it:

As you can see, this doesn't actually resolve the collision (for example by pushing the green rectangle out to the top), and instead just flip flops between the two states infinitely.
How can I solve this?

sentences:
What are the most common AI systems implemented in Tower Defense Games I'm currently in the middle of researching on the various types of AI techniques used in tower defense type games. If someone could be help me in understanding the different types of techniques and their associated advantages.

Using Google I already found several techniques.

Random Map traversal
Path finding e.g. Cost based Traversing Algorithms i.e. A*

I have already found a great answer to this type of question with the below link, but I feel that this answer is tailored to FPS. If anyone could add to this and make it specific to tower defense games then I would be truly great-full.

How is AI most commonly implemented in popular games?

Example of such games would be:

Radiant Defense
Plant Vs Zombies - Not truly Intelligent, but there must be an AI system used right?
Field Runners

Edit: After further research I found an interesting book that may be useful: http://www.amazon.com/dp/0123747317/?tag=stackoverfl08-20

sentences:
JFrame launcher stays open when I'm finished with it I have written a launcher that prompts the user for their name then starts the game when they hit enter. The launcher looks like this:

But when the user hits enter, this happens:

The launcher stays open.

This is the relevant code in the launcher class:

    public void actionPerformed(ActionEvent evt) {
        String text = textField.getText();
        System.out.println(text);
        entered=true;
        Game game = new Game();
        game.start(text);
    }

    public void Launch() {
        //Create and set up the window.

        JFrame frame = new JFrame("Login");
     // maximize the jframe here
        frame.setSize(800,600);
        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Add contents to the window.
        frame.add(new Launcher());
        //Display the window.
        frame.pack();
        frame.setVisible(true);
        while(entered==true){}
    }

And this is for the main method in the game:

    public static void main(String[] argv) {
        Launcher launcher = new Launcher();
        launcher.Launch();
    }

So how would I go about closing the launcher when the user has no use for it?

I am using a JFrame for the launcher and Lwjgl for the actual game window.

sentences:
Input of mouseclick not always registered in XNA Update method I have a problem that not all inputs of my mouse events seem to be registered.
The update logic is checking a 2 dimensional array of 10x10 .
It's logic for a jewel matching game.
So when i switch my jewel I can't click on another jewel for like half a second.
I tested it with a click counter variable and it doesn't hit the debugger when i click the second time after the jewel switch. Only if I do the second click after waiting half a second longer.
Could it be that the update logic is too heavy that while he is executing update logic my click is happening and he doesn't register it?

What am I not seeing here :)? Or doing wrong. It is my first game.

UPDATE :
I changed to Variable time step, then i saw after the reindex of my jewels (so after the switch) i see the elapsedgametime was 380ms. So I guess that is why he doesn't catch the short "Press" of my mouseclick because update method is still busy with executing the reindexing code. Anyone knows how I can deal with this .. Or do I have to start using threads because my update of reindex takes too long?

SOLVED :
The problem was that in my reindexing code I got out of bound exceptions which I catched and then continued. That catching of exceptions caused a massive lag each time a reindex happened. Now everything runs smoothly and I do not have to worry about a slow Update. But I'm still asking the question.. what should you do If you have really heave update logic where the time to process the logic takes almost a 0.5 second? I guess you need to execute your game logic in multiple threads to reduce the update time? I'm also thinking i'll never have to worry about this for a jewels game :p. It's more for a problem for a heavy physics game with alot of game objects ?

My function of the update methode looks like this.

 public void UpdateBoard()
        {
            currentMouseState = Mouse.GetState();
            if (currentMouseState.LeftButton == ButtonState.Pressed &&
                prevMouseState.LeftButton != ButtonState.Pressed)
            {
                debugCount++;
                if (debugCount == 3)
                {
                    int a = 4;
                }

                leftButtonPressed = true;
            }
            if (this.IsBoardActive() == false)
            {
                UpdatingLogic = true;
                if (leftButtonPressed == true)
                {
                    // this.CheckDropJewels(currentMouseState);
                    this.CheckForSwitch(currentMouseState);
                    if (SwitchFound == true)
                    {
                        reIndexSwitchedJewels = true;
                    }
                    this.MarkJewel(currentMouseState);
                }
                if (CheckForMatches == true)
                {
                    if (this.CheckMatches(5) == true)
                    {
                        this.RemoveMatches();
                        reIndexMissingJewels = true;
                    }
                    else
                    {
                        CheckForMatches = false;
                    }
                }

                UpdatingLogic = false;
                if (currentMouseState.RightButton == ButtonState.Pressed &&
                    prevMouseState.RightButton != ButtonState.Pressed)
                {
                    this.CheckMatches(5);
                }

                this.ReIndex();
                leftButtonPressed = false;
            }

            prevMouseState = currentMouseState;
            this.UpdateJewels();

        }

sentences:
Sprite erasing text in Pygame I'm making a Pong clone in which the user can press the 'p' button to pause/unpause the game. When the user presses the 'p' button the word 'PAUSE' is drawn to the screen and when he presses again the word is erased. My problem is this:

As you can see, the ball sprite is erasing the text. Any clue on why this is happening? Here is the code for the main stuff.

sentences:
game server - fault tolerant If you have for example an MMO with 2000 players, and players are constantly removing / creating / swapping items (and doing some other important things that can't be lost).

If the updates are saved instantly in the database, since they are too many, the database dies. If you save them every "x" minute, there's a window where if your server app dies, players may lose items, and sometimes they may be expensive, let's say 100$, so that can't happen.

Is there a design or a guide I could read that handles this issue? The games I play today do not have that problem.

sentences:
Rotation based on x coordinate and x velocity? -(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{

float deceleration = 0.3f, sensitivity = 8.0f, maxVelocity = 150;

// adjust velocity based on current accelerometer acceleration
playerVelocity.x = playerVelocity.x * deceleration + acceleration.x * sensitivity;

// we must limit the maximum velocity of the player sprite, in both directions (positive & negative values)
playerVelocity.x = fmaxf(fminf(playerVelocity.x, maxVelocity), -maxVelocity);

}

Hi, I want to rotate my sprite based on the velocity and accelerometer input. My sprite can move along the X axis like so:

<--------- sprite ----------->

But it always faces forwards, if it is moving left I want it to point slightly to the left, the degree of how far it is pointing to be judged from the velocity. This should also work for the right.

I tried using atan but as the y velocity and position is always the same the function returns 0, which doesn't rotate it at all.

Any ideas?

Regards,

Lewis.

sentences:
GameStateManagement and inputs not being recognized EDIT: I've removed a bit of code from the input class to make this more readable, and updated my StartScreen class, which is now at the bottom. I have the same issues though, but they are explained in my comments on the bottom of this page. It won't let me paste my additional code here (the format comes out crazy), so I've linked to pastebin with the code pastebin

I've been trying to implement the MS provided GameStateManagement sample with my game, but it has proven a bit difficult. Really, I'm using Oneksoft's Starter Kit, which uses the MS provided sample, so they are identical, except for my splash screen.

I'm able to get the splash screen to launch, where it informs the player to press A to advance the screen, but this doesn't seem to accept any of my inputs. I’ve also added Console.Writeline(“Pressing A”) under the IsMenuPressed method in Input.cs to verify that it is getting called, but for some reason it is constantly spamming my log, rather than just appearing each time I press it. Not sure why this is happening.

I have a bit too much code to post it all here, so I’ve attached a link to my .rar with my classes, but I’ll also leave a bit here which I thinkmay be applicable. https://www.dropbox.com/sh/6ek4uru2jc2ch0k/JTeBWN_3PQ

What do you guys think the issue is?

namespace Pong
{
    public class Input
    {
        public const int MaxInputs = 4;

        public readonly KeyboardState[] CurrentKeyboardState;
        public readonly GamePadState[] CurrentGamePadState;

        public KeyboardState[] LastKeyboardState;
        public GamePadState[] LastGamePadState;

        public readonly bool[] GamePadWasConnected;

        public Input()
        {
            // Get input state
            CurrentKeyboardState = new KeyboardState[MaxInputs];
            CurrentGamePadState = new GamePadState[MaxInputs];

            // Preserving last states to check for isKeyUp events
            LastKeyboardState = CurrentKeyboardState;
            LastGamePadState = CurrentGamePadState;
        }

        /// <summary>
        /// Checks for a "menu select" input action.
        /// The controllingPlayer parameter specifies which player to read input for.
        /// If this is null, it will accept input from any player. When the action
        /// is detected, the output playerIndex reports which player pressed it.
        /// </summary>
        public bool IsMenuSelect(PlayerIndex? controllingPlayer,
                                 out PlayerIndex playerIndex)
        {
            Console.WriteLine("Pressing A");
            return IsNewKeyPress(Keys.Space, controllingPlayer, out playerIndex) ||
                   IsNewKeyPress(Keys.Enter, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.A, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex);
        }

        /// <summary>
        /// Checks for a "menu cancel" input action.
        /// The controllingPlayer parameter specifies which player to read input for.
        /// If this is null, it will accept input from any player. When the action
        /// is detected, the output playerIndex reports which player pressed it.
        /// </summary>
        public bool IsMenuCancel(PlayerIndex? controllingPlayer,
                                 out PlayerIndex playerIndex)
        {
            return IsNewKeyPress(Keys.Escape, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.B, controllingPlayer, out playerIndex) ||
                   IsNewButtonPress(Buttons.Back, controllingPlayer, out playerIndex);
}

sentences:
Game Development In C Only. Is it possible? I am a first year college student in India and want to make a small game as a this semester project.

I am quite good at C and am learning it rapidly but I wanted to ask if developing a game entirely in C (no C++ or C#) I'd love to use these but for college projects, we have strict requirements of using only C.

What I am looking for is a simple top view driving game. It won't have anything fancy and even the visual things will be powered by simple characters. For example, user controlled car can be represented by ▓ and edges of road by series of |'s.
What do you think?

sentences:
Delay/Pause game while displaying countdown 3,2,1 go I have already a running script of countdown and it works fine , the problem is that I want to pause or delay the game while the countdown is displaying, the moment countdown finished the player is already dead. Here is my code

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

public class jb : MonoBehaviour {
    private string countdown = "";
    private bool showCountdown = false;
    public AudioSource noise1;
    public AudioSource noise2;
    public Sprite sprite2;
    public Vector2 jump = new Vector2 (0,300);
    private SpriteRenderer spriteRenderer;
    void Start () {
        //GetComponent<Rigidbody2D>().velocity = Vector2.right * speed;
        StartCoroutine(getReady());

        spriteRenderer = GetComponent<SpriteRenderer>();
        noise1.GetComponent<AudioSource>().Play();

    }

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

        if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        {
           Vector2 touchPosition = Input.GetTouch(0).position;
            GetComponent<Rigidbody2D>().AddForce(jump);
            //noise1.GetComponent<AudioSource>().Play();
        }

        Vector2 screen_position = Camera.main.WorldToScreenPoint (transform.position);
        if(screen_position.y > Screen.height || screen_position.y < 0)
        {
            noise1.GetComponent<AudioSource>().Stop();
            noise2.GetComponent<AudioSource>().Play();
            StartCoroutine(Die());
        }

    }

    void OnCollisionEnter2D(Collision2D det)
    {
        noise1.GetComponent<AudioSource>().Stop();
        noise2.GetComponent<AudioSource>().Play();
        StartCoroutine(Die());

    }

    IEnumerator Die(){
        PlayerPrefs.SetString( "previousLevel", SceneManager.GetActiveScene().name );
        spriteRenderer.sprite = sprite2;
        yield return new WaitForSeconds (2);
        SceneManager.LoadScene("score");
     }

    IEnumerator getReady()
    {
        showCountdown = true;

        countdown = "3";
        yield return new WaitForSeconds (1);

        countdown = "2";
        yield return new WaitForSeconds (1);

        countdown = "1";
        yield return new WaitForSeconds (1);

        countdown = "GO";
        yield return new WaitForSeconds (1);

        showCountdown = true;
        countdown = "";
    }

    void OnGUI ()
    {
        if (showCountdown)
        {
            GUI.color = Color.red;
            GUI.Box ( new Rect (Screen.width / 2 - 100, 50, 200, 175), "GET READY");

            // display countdown
            GUI.color = Color.white;
            GUI.Box (new Rect (Screen.width / 2 - 90, 75, 180, 140), countdown);
        }
    }
}

what can I do to pause the game? I tried invoke (by creating another function and copying everything over there) in update call but it didn't work.

sentences: Web site for XAML snippet sharing? I am making a game with WPF and C#, and I frequently am in need of artwork for it.  Some things could be easily shared, such as explosion animations, exhaust plumes, etc.  I was wondering if there are any good web sites for this?  All I can find are tutorials and the infrequent sample, but I imagine there is a site out there that I am missing.  I would also like to clarify that I am looking for pure vector based XAML snippets.  I know there are a lot of sites out there for sprites and textures, but I am looking for XAML components that I can tweak.

sentences:
Rotate around moving object I'm using the function Transform.RotateAround in order to make my player rotate around objects in my game, it's the main feature.
The thing is, when I'm making my levels harder and make the objects (that the player rotates around) dynamic and add some movement on the X & Y axis, the rotation movement is inconsistent, obviously, since the function recalculates each frame a different pivot to rotate around, the player distance from the object changes and not staying static throughout the rotation cycles.
The question is, is there a way to get around this and make the player rotate around the object in a static, permanent distance from the object even though it's moving?
Maybe by predicting the movement of the object or somehow "diffusing" the effect of the object movement..?
Any comment would be helpful.
Thanks in advance!

sentences:
Getting Vector at 90 Degrees from provided vector I need a function that can take a vector as an input and provide a vector that is at a 90-degree angle to the provided vector. I understand that in 3D there is an infinite amount of vectors that could be produced from this calculation, but I only require 1. I have been using GLM and have tried using its built in vector rotation functions but to no avail. I would like to keep the solution compatible with GLM as I wish to have everything standardized.

Here is a basic visualization of what I need.

Edit
The function's purpose is to pass a direction vector into a function, radius, and an angle and it will create a point around the origin at x angle in space. The reason for this is so I can loop through and create a point cloud in 3D space and then join them together to make shapes such as cylinders (see photo)

Solution Code

glm::vec3 CreateAngledPoint(glm::vec3 rotation_point, float radius, float angle, glm::vec3 normal)
{
    // Normalize the normal (axis to rotate on)
    normal = glm::normalize(normal);
    // Create a vector that will be used for the dot product
    glm::vec3 to_cross = glm::normalize(glm::vec3(0.0f,1.0f,0.0f));
    // Make sure that the normal and cross vector are not the same, if they are change the cross vector
    if (to_cross == normal) to_cross = glm::normalize(glm::vec3(0.0f, 0.0f, 1.0f));
    // Get the cross product
    glm::vec3 to_return = glm::normalize(glm::cross(normal,to_cross));
    // Rotate point around the axis
    to_return = glm::rotate(to_return, angle* RAD_TO_DEG, normal);
    // Scale the point up from the origin
    to_return *= radius;
    // Apply it to the point in space we are rotating around
    return rotation_point + to_return;
}

Example of its usage

sentences:
How do game makers (without coding) work? How do game makers/engines like Buildbox, GameSalad, Construct, GameMaker, etc work? What technologies (programming languages, APIs, etc) are used to build the and how does the program convert the user's interactions into exportable code?

I realize this is a very broad question. What I'm looking for is how the software creates code/source files from the user interactions with the software. While details would be awesome, a high level overview would be great too.

I'm a second year CS major and have some experience with Java/C/C++ as well as some web languages and framework. It's hard to find information on how a game creation software works because there's more content on how to make games in general.

If there is a more appropriate forum/site to ask this, please point me in that direction!

sentences:
How to prevent players from using save/load tactics in Roguelike games? Players can achieve the expected results through continuous saving and loading in rogue-like games.

I am try to reduce this method as much as possible, but don't want to keep players from trial and error at all, which makes the game more difficult.

Anybody could give me some advice in this respect?

sentences:
unity 5.x performance After I downloaded unity 5, it became very power consuming. For example, my pc becomes hotter and makes a lot of noise. Also building, compiling, baking of game takes a lot of time. I am making a multiplayer game and need to build the game almost on every change, but it takes hours or sometimes it doesn't even build the game. There are also bugs with directional light, it doesn't work. So yeah, any suggestions?

My internal PC specs: Intel core i3-3130M, 8gb of ram, video card: Intel R4000

I installed unity 5 after Windows 10 came out, maybe it's something with the OS? Also yesterday, I updated Unity but with the same problems.

Also here are some screens:

Directional light is turned off but everything except models is dark, i mean terrain is black.

Also this baking process is more than one hour and stays on 5/11 clustering | 41 jobs

sentences:
Should particles check if they are in a region, or regions if particles are in them? I have around 100 to 200 particles in my game. Then I have 5 to 20 regions (circle-shape) which should count the particles which enter them and add some force to them, so they change their direction.

My idea was now to keep a list of all particles and every region should check the whole list every frame, whether a particle is inside it. For this I calculate the distance between the particle and the central point of the region and check weather its <= the radius of the region.

Is this the most efficient way to do it? Or should every particle have a list of all regions and check whether they are in one of it? Or a totally different approach?

I would like this application to be able to run also on older mobile devices like an iPhone 4S.

sentences:
What are some programming design patterns that are useful in game development? I have a few books on Design Patterns, and have read some articles, but cannot intuitively figure out which programming design patterns would be useful in game development.

For example, I have a book called ActionScript 3 with Design Patterns that details several design patterns such as Model View Controller, Singleton, Factory, Command, etc.

As someone new to this, I cannot figure out which of these would be useful, or in fact if any of these are the design patterns I should be learning and trying to use.  Perhaps there are other, more game-programming-specific design patterns that I am not even aware of?

If you have experience using a certain design pattern in game development, I'd love to hear it.  Reasoning as to why it was used, code samples, or online resources would all be very helpful as well if you have them.  I am at the moment most interested in ActionScript 3 and C++ implementations, but could definitely benefit from experience and examples from any language.

Thanks!

sentences:
How do I programmatically remove an image's background color? I have a sprite sheet (image) and want to draw it on screen.

image  = sprite sheet image
x      = player x position
y      = player y position
width  = player width
height = player height

public class main extends japplet
{
    ...

    public void paint(Graphics g)
    {
        g.drawImage(image, x, y, x+width, y+height,
                   0, 0, 40, 40 ,sprite_sheet.m1);
    }
}

On the sprite sheet, I have the image of a player with a blue background color. Calling drawImage shows the blue background too. I could remove the color with Photoshop, but I really don't want to, because it would remove part of my player.

Can I remove the background color with Java code?

sentences:
How to extend Tiled and Cocos2d to create an Isometric map that supports elevation I've been looking and looking and looking, and I cannot seem to find a solution out there for making a game that uses cocos2d and Tiled to make an isometric map that supports elevation.

I am not looking for anything super complex...

Just maybe 2 or 3 levels of elevation. (Think X-Com UFO Defense, or Final Fantasy Tactics)

I figure that since I've been unable to find a solution, I'll probably have to extend Tiled or something to support this.

For now I'll just stick with level of elevation, but I want to extend the game to support elevation eventually.

Will you share with me any good resources that you know? Where should I read to better understand how to accomplish such a thing?

sentences:
How can I rotate a sphere in response to mouse movement? I'm using jMonkeyEngine to develop a game. I'm good at scripting, but math usually goes over my head. I tried the Wiki page for Quaternion, but I was far too confused to figure this out myself :P

My goal

I have a sphere with physics enabled, and I want to have it rotate based on mouse axis movement. I've got listeners set up properly so that in this method:

void roll(int axis, float tpf) {
    Quaternion rot = this.getPhysicsRotation();
    switch(axis) {
        case MouseInput.AXIS_X:
            // Rotate here
            break;
        case MouseInput.AXIS_Y:
            // Rotate here
            break;
    }
}

an axis and a value (+/-) will be provided. Once I figure out how to modify Quaternions, I'll just use RigidBodyControl.setPhysicsRotation(Quaternion) to update the rotation.

My Problem

I'm clueless about Quaternions.. I don't even know what method I'd be using. I assume Quaternion.add() or .mult() will be necessary.

Someone please help! Here's a link to jme's Quaternion class for reference.

Solution

From Zoltan's answer:

void roll(int axis, float tpf) {
    tpf *= 10;
    System.out.println("roll("+axis+","+tpf+")");
    switch(axis) {
        case MouseInput.AXIS_Y:
            Quaternion quaternion = new Quaternion();
            this.setPhysicsRotation(getPhysicsRotation().mult(quaternion.fromAngleAxis(tpf, Vector3f.UNIT_X)));
            break;
        case MouseInput.AXIS_X:
            Quaternion q = new Quaternion();
            this.setPhysicsRotation(getPhysicsRotation().mult(q.fromAngleAxis(tpf, Vector3f.UNIT_Y)));
            break;
    }
}

I'm not quite sure why case:MouseInput had to be swapped, but it works this way so.. shrug

sentences:
Matrix loading problems with jbullet and lwjgl The following code does not load the matrix correctly from jbullet.

//box is a RigidBody
Transform trans = new Transform();
trans = box.getMotionState().getWorldTransform(trans);
float[] matrix = new float[16];
trans.getOpenGLMatrix(matrix);
// pass that matrix to OpenGL and render the cube
FloatBuffer buffer = ByteBuffer.allocateDirect(4*16).asFloatBuffer().put(matrix);
buffer.rewind();
glPushMatrix();
glMultMatrix(buffer);
glBegin(GL_POINTS);
glVertex3f(0,0,0);
glEnd();
glPopMatrix();

the jbullet is configured as so:

CollisionConfiguration = new DefaultCollisionConfiguration();
dispatcher = new CollisionDispatcher(collisionConfiguration);
Vector3f worldAabbMin = new Vector3f(-10000,-10000,-10000);
Vector3f worldAabbMax = new Vector3f(10000,10000,10000);
AxisSweep3 overlappingPairCache = new AxisSweep3(worldAabbMin, worldAabbMax);
SequentialImpulseConstraintSolver solver = new SequentialImpulseConstraintSolver();

dynamicWorld = new DiscreteDynamicsWorld(dispatcher, overlappingPairCache, solver, collisionConfiguration);
dynamicWorld.setGravity(new Vector3f(0,-10,0));
dynamicWorld.getDispatchInfo().allowedCcdPenetration = 0f;
CollisionShape groundShape = new BoxShape(new Vector3f(1000.f, 50.f, 1000.f));
Transform groundTransform = new Transform();
groundTransform.setIdentity();
groundTransform.origin.set(new Vector3f(0.f, -60.f, 0.f));
float mass = 0f;
Vector3f localInertia = new Vector3f(0, 0, 0);
DefaultMotionState myMotionState = new DefaultMotionState(groundTransform);
RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass, myMotionState, groundShape, localInertia);
RigidBody body = new RigidBody(rbInfo);
dynamicWorld.addRigidBody(body);
dynamicWorld.clearForces();

Nothing is rendered on the screen. What am I doing wrong?

sentences:
Double Jump causing problems? Here is my code. I have an empty Gameobject directly underneath the child with a small radius checking the ground every thing seems to be correctly covered, but for some reason the jumping mechanic is very finicky and broken feeling. Can you take a look a tell me what you see? Thank you for your time!

public class PlayerMovement : MonoBehaviour
{

    public float speed;
    public float height;

    public Transform groundCheck;
    public float groundCheckRadius;
    public LayerMask whatIsGround;
    private bool grounded;

    private bool doubleJumped;

    // Update is called once per frame

    void FixedUpdate ()
    {
        if (grounded)
        {
            doubleJumped = false;
        }

        if (Input.GetButton ("Horizontal"))
        {
            transform.Translate (Vector3.right * speed * Time.deltaTime);
        }

        if( Input.GetButton("Left"))
        {
            transform.Translate (Vector3.left * speed * Time.deltaTime);
        }

        if (Input.GetButton ("Jump") && grounded)
        {
            //transform.Translate (Vector3.up * height * Time.deltaTime);
            Jump();
        }

        if (Input.GetButtonDown ("Jump") && !doubleJumped && !grounded)
        {
            Jump();
            doubleJumped = true;
        }

        grounded = Physics2D.OverlapCircle(groundCheck.position,groundCheckRadius,whatIsGround);

    }

    void Jump()
    {
        transform.Translate (Vector3.up * height * Time.deltaTime);
        return;
    }
}

sentences:
glColor3f Setting colour This draws a white vertical line from 640 to 768 at x512:

glDisable(GL_TEXTURE_2D);
glBegin(GL_LINES);
      glColor3f((double)R/255,(double)G/255,(double)B/255);
      glVertex3f(SX, -SPosY, 0); // origin of the line
      glVertex3f(SX, -EPosY, 0); // ending point of the line
glEnd();
glEnable(GL_TEXTURE_2D);

This works, but after having a problem where it wouldn't draw it white (Or to any colour passed) I discovered that disabling GL_TEXTURE_2D Before drawing the line, and the re-enabling it afterwards for other things, fixed it. I want to know, is this a normal step a programmer might take? Or is it highly inefficient? I don't want to be causing any slow downs due to a mistake =)

Thanks

sentences:
FBO picking in Oculus Rift applications I am writing an Oculus Rift application, I am rendering a very high poly mesh that I wish to be able to perform picking on using the Oculus Touch. Ideally, I want to be able to get the "triangle" id and other information attached to it.

Currently, I am using an OBB Tree and ray casting to perform picking on the CPU, It works perfectly, the problem is that even with OBB tree the picking process is slow. I thought I'd perform picking on the GPU by rendering the view (from the point of view of the Oculus Touch) to an FBO using a custom shader that outputs "triangle information" to the buffer and then use glReadPixels to  read the central pixel data. The problem I am facing is that the Oculus does distortion to  my on-screen scene but there is no way to apply it to the off-screen buffer, so there is significant difference between the on-screen buffer and the off-screen buffer.

My question is, Is ray casting the only feasible way to do picking in Oculus Apps or is there a way to perform the faster FBO picking even when the view distorted?

sentences:
Large scale iterative design Typically in game development, linear development (waterfall model) is riddled with obstacles that drain the programmer's sanity (game turned out horrid, can't redesign). Enter iterative design. Iterative design allows for prototyping of various possibilities in the play space. Unfortunately, it has a major catch. As soon as a project increases in size, iterations become tediously long killing off the main advantage: rapid results.

How can one shorten design iterations for large scale projects?

sentences:
How can I clamp the transform to a range? I am trying to create a level editor in Unity.  When the position of an object is changed, I want that object to have its X and Y positions clamped between 1 and 10.  So if the position is changed to 15, it will snap back to 10; and if the position is changed to -5, it will snap back to 1.

I have tried using the OnValidate() method, but without success.  It snaps everything correctly when I reload the script (make a change to the script and reopen Unity), but it will not snap it on the fly.

void OnValidate(){
    float newX = Mathf.Clamp(child.position.x, 1, 10);
    float newY = Mathf.Clamp(child.position.y, 1, 10);
    transform.localPosition = new Vector2(newX, newY);
}

Any suggestions on how I can accomplish this?

sentences:
Physics motor on servers, How a billiard server works? i'm trying to figure how a phisics game like billiard works in server side . I'm asking this cause i know how to achieve this in a client , but if i use a phisics motor i think it could be very heavy for a server when i want to have many people in the server.

When i see this type of games, it use to be really fast , thinking that server is controlling the movements of course . Cause any other way maybe from client you could have been doing cheats.

Then my questions are:

The server sends in this case, all ball movements?
Are the server trusting in clients?
In this case : How to be sure a phisics motor doesn't have little error. (float decimals differences)

And globaly : How this type of server works?

sentences:
How to make Rigidbody.AddForce less delayed in Unity3D? I'm trying to make it so that when the player in my game moves left or right, he lightly jumps from his current position to his new position. The way I have it set up now, the jump occurs once he has arrived at his new position. What can I do to make it so that the jump happens sooner so that it appears that he jumps to his new position? Here is the code I have that controls that part of his movement:
if (Input.GetKeyDown(KeyCode.LeftArrow) && transform.position.x > minXPos)
    {
        targetPos = new Vector3(transform.position.x - xIncrement, transform.position.y, transform.position.z);
        rb.AddForce(Vector3.up * jumpForceTwo, ForceMode.Impulse);
        transform.position = Vector3.MoveTowards(targetPos, transform.position, speed);
        isHorizontalingLeft = true;
    }
else if (Input.GetKeyDown(KeyCode.RightArrow) && transform.position.x < maxXPos)
    {
        targetPos = new Vector3(transform.position.x + xIncrement, transform.position.y, transform.position.z);
        rb.AddForce(Vector3.up * jumpForceTwo, ForceMode.Impulse);
        transform.position = Vector3.MoveTowards(targetPos, transform.position, speed);
        isHorizontalingRight = true;
    }

Here is a video showing what is happening (sorry it's blurry):
https://youtu.be/rPewtb8QywE

sentences:
Using a mesh stencil with 2D lighting in the Universal Render Pipeline I've followed the CodeMonkey tutorial on using a dynamic mesh as a stencil for a field of view or visibility polygon effect, and have got it working using the latest version of Unity and its Universal Render Pipeline  (I believe this uses a Forward Renderer).
I'd like to use the 2D lighting and this requires a 2D Renderer, which I have also got working.
Unfortunately I can't figure out a way of combining these.  I've got a Universal RenderPipeline and added my 2D Renderer and the Forward Renderer to the renderer list, but it only allows one of these to work (I'd assumed it would trigger in order).
How can I get both of these effects working together, or if it isn't possible, is there a recommended approach for combining 2D lighting and stencil masking?

sentences:
Use constant force to hold something in position This may actually be more of a Physics.SE question but since im doing this in Unity I figured I'd ask here.

I am playing around with the Constant Force component and have a sphere constrained with a linear configurable joint (y-axis free). With one key I apply a force in one direction to get it moving, but then when i press another key, I want to stop it and hold exactly in place by using an opposite force. So even if some other rigid body hits the sphere, it wont move until I remove a force.

Unfortunately, Unity doesnt allow more than one constant force on a gameobject (probably a good reason, not sure exactly) and I know if I do a net force, that it would just end up being 0, which would kind of work but the sphere would move if it gets hit.

Another thing I tried was to take the spheres current force and constantly flip it from positive to negative every FixedUpdate but that didn't seem to work at all.

I know the quick and easy way would be to just set velocity to zero, but I see tons of comments saying that modifying velocity directly breaks the physics, is bad form, etc. and I want to do this as properly as possible.

The best way I can describe what I'm trying to do is like that science experiment where you take a ping-pong ball and use a blower to push just enough air to counter gravity and the ball seems to hover in place. My only difference is that my constraint is side to side instead of up/down.

sentences:
How to make an enemy projectile head to the player's position with constant speed How can I dynamically set the movement speed of the X and Y of the projectile so that it moves at a constant speed when the projectile heads at the player's position? I know this has something to do with vectors but I don't really have an idea how to do it. My current implementation of the speed is getting the difference of the x and y positions so what happens is that the projectile will be slower the nearer the player is to the enemy. I set the projectile's speed using the code below:

projectile.moveSpeedX = Math.abs(position.x - targetPlayer.position.x);
projectile.moveSpeedY = Math.abs(position.y - targetPlayer.position.y);

Below is the contents of the update(float delta) method of the projectile:

if(xdirection == LEFT) {
    position.x -= moveSpeedX * delta;
}
else if(xdirection == RIGHT) {
    position.x += moveSpeedX * delta;
}

if(ydirection == UP){
    position.y -= moveSpeedY * delta;
}
else if(ydirection == DOWN) {
    position.y += moveSpeedY * delta;
}

The movement will slow down when the player is near the enemy since the distance between them is small. The speed is the problem although this already makes the projectile head to the player's position.

sentences:
Unity: Instantiate an object respecting the prefab's default rotation Simple question, I hope.

I've built a variety of prefabs for an isometric shooter game (hazards, enemies, health indicator bars, popup texts, shots, explosions).  All of these prefabs were constructed with default rotations appropriate for the gameplay.

My problem is that Instantiate() will overwrite the default rotation of the prefab with whatever is specified as the rotation parameter.  So I'm left with hard-coded rotations in my Instantiate() calls to get things oriented correctly in the X-Z plane. (0,180,0) and (90,0,0) are common ones.  I'd much prefer to Instantiate prefab gameObjects consistently with "no change to their default rotation," but I'm not sure how to accomplish this.

Thanks for the help,
Mike.

sentences:
Data for bingo tickets Is there a data source for 90 and 75 ball bingo tickets? rather than coding to generate the tickets myself just trying to find a source to save me the time.

Many thanks

sentences:
OpenGL - How to draw each nth triangle using glVertexAttribPointer I have a vertex buffer. There are situations when I don't want to render the whole mesh, but let's say each nth triangle of the mesh.
I am using VAOs and VBOs.

My data in the buffer is like this:

first triangle indx        seciond triangle indx
0 1 2   3 4 5   6 7 8    | 9 10 11   12 13 14   15 16 17 ...

What I want to do is - render first triangle, then skip second, then render 3d and so on.
Can it be done with adjusting glVertexAttribPointer() or are there some other gl methods that can manipulate the data like that, or I have to create a new buffer with skipped triangles ?

sentences:
Locating different models in a single scene I have a curiosity.

Say I wanted to create a big forest using Blender, in this forest I'd like to have a campfire or several campfires. What I could do is create the entire scene in Blender with campfires included and of course in-engine I would add a fire effect to it. Now what I do not understand is how can I actually find the fireplaces' locations in the engine? Since it's all in one scene, I can't just say getLocation on the model.

I guess what I'm asking isn't how to do it per say, but what the "professional" way is. Do professional game developers fiddle around with coordinates until they find it? Do they load the campfire on top of the scene as a separate model and move it until it fits the scene? Just in case it is important, I am using jMonkeyEngine.

sentences:
When to use GameComponents? I know what it is and I'm using it as a frame counter for example. But when should I use it?

Does it make sense to say "I make all the input handling happen in a gamecomponent"? Is it flexible enough to add and remove fast in runtime? I see I can set the update order and draw order, but I guess to keep track of it an enum should be best like "GamePadInput = 0" or "MessageBox = 100".

Or should I just design simple, for example when I want to determinate if a messagebox is open checking "if (MessageBox.Active)" and then manually updating/drawing?

I'm a bit confused and can't decide what to do. I don't want to start designing the game and see later "oops". Maybe you can help me out :)

sentences:
Should I switch to a game development library? I'm making an RPG-like 2D game from scratch with Java.

By now I'm in a pretty advanced stage with my game, but I encountered a problem- my game using too much CPU.

I know it's because my game loop doesn't use Thread.sleep. I looked for a solution on the internet but most of the answers were "you should move to LWJGL or LIBGDX". I also didn't find any good advice for using Thread.sleep in my game loop.

So, should I move my platform to some of those libraries, or could someone give me some advice how to deal with my CPU usage problem?

Here is my game loop:

public void run(){
    int fps = 60;
    double timePerTick = 1000000000 / fps;
    double delta = 0;
    long now;
    long lastTime = System.nanoTime();

    while (running){
        now = System.nanoTime();
        delta += (now - lastTime) / timePerTick;
        lastTime = now;

        if (delta >= 1) {
            tick();
            render();
            delta--;
        }
    }

    stop();
}

I will just mention that I don't think that moving to one of those libraries will make things easier in the future, and that's because I'm in a pretty advanced stage in my game.

sentences: How player(sprite) in the phaser will opposite or reverse while going left and right? I am developing a game where my player has to look to see forward when I am pressing right arrow key. But how can I make it look reverse after pressing left arrow? I can create a sprite of reverse look but how can load that while pressing left and at the same time forward player should be destroyed?

sentences:
How can I change the sprites in the NES Double Dragon ROM? I have played a few NES ROMs where people have gone into them and changed the sprites. How did they do this?

I'd like to do this for the Double Dragon ROM. How can I accomplish that?

sentences: Eliminate delay between looping XNA songs? I'm making a game with XNA and trying to get some background music to loop correctly. Because the file is an MP3 of about 30 seconds in length, I instantiated it as a Song. I want it to loop perfectly, but even when I set the MediaPlayer.IsRepeating property to true, there is always a delay of about one second before the song starts up again. Is there any way to eliminate this delay such that the song loops instantly, so it can play more fluently?

sentences:
Do I have to keep all my UI elements within the safe area defined by the iPhone X? Suppose this is my game's screen for the iPhone 8:

I have 7 blue buttons, and one blue bar at the bottom which is used to display commentary text.

I understand that the iPhone X has a safe area. In this case, there would be a bottom inset because of the home indicator and the swiping gestures.

The swiping and the home indicator pose no issue to my players. The game does not use any sort of gestures, and the center button is large enough that the home indicator doesn't really affect its aesthetics.

Given that, do I still have to avoid the bottom inset? Am I supposed to keep all my buttons within the safe area defined by the iPhone X even when it doesn't affect my user experience?

If I were to stay within the safe area, then I would have to push the bar and the buttons upwards by several pixels, then the leftmost buttons have to be pushed to the right, and the rightmost buttons to the left. That wouldn't look really great with my game art.

Would my game be rejected if I don't keep my elements inside the safe area?

It seems like I must indeed keep all my UI elements within that area, based on this image from the keynote:

sentences: Are shaders always faster? Will using shaders or some other way of talking directly to the GPU always be faster than drawing to the screen in whatever language a game is being (mainly) written in? I guess that code with lots of conditionals is slower on many, (most? all?) GPUs but is that the only heuristic that can be reasonably applied? I understand that there will be edge cases with different hardware and measuring is the only way to know for sure, but I'm trying to figure out whether I should do everything that looks feasible to do in a shader, in a shader, given I don't want to implement it twice to find out which is faster.

sentences:
What input and window handler should I learn for complement OpenGL? I have a good base in C++ programming and I did some 2D games using SDL. Now I want to start making 3D games, but as much as posible, I want to learn following the standars of the profesional industry.
I think learning openGL I will have more acuratte skills for programming 3D graphics, so I prefer to study openGL instead of a game engine. But my cuestion is, what library I should choice for complement openGL in the area of the input and windows handler, if posible, following the standars of the industry?

Thanks you in advance for the help! (And sorry for my bad english)

sentences:
Why can't I load an image with a relative path in SDL2 on Linux? When loading a texture in SDL2 the general procedure is this:

SDL_Texture* texture = IMG_LoadTexture(renderer, "resources/images/image.png);

However this doesn't work and I have to supply the WHOLE path to the specific image. The code that I have to use is:

SDL_Texture* texture = IMG_LoadTexture(renderer, "/home/user/programs/game/resources/images/image.png);

This issue doesn't occur in a Windows Mingw32 environment.

Any suggestion on how to fix this issue?

sentences:
Rotating according to ground normal on Unity 3D I know there are already some threads about this, but my problem isn't exactly with the algorithm itself.
I was able to use RayCast and get the ground normal, using it to store the rotation necessary to align to the ground in a quaternion using:

slopeRotation = Quaternion.FromToRotation (transform.up, hit.normal);

Where hit.normal is the normal of the ground. After this, I check whether the player is moving (the user is moving the joystick axis) or standing still. If it's standing still, I align it with the ground using:

transform.rotation = Quaternion.Slerp(transform.rotation,slopeRotation * transform.rotation,10*Time.deltaTime);

When the player is moving, I rotate using:

transform.rotation = Quaternion.Slerp (transform.rotation,slopeRotation *camRotation*movementRotation , 10 * Time.deltaTime);

Where camRotation is simply the rotation of the MainCamera(a third person one) on the Y axis and movementRotation is the rotation of the joystick axis, also on the Y axis, calculated using:

movementRotation = Quaternion.LookRotation (new Vector3(Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical")));
camRotation = Quaternion.Euler (0, cam.transform.rotation.eulerAngles.y, 0);

Although the code above makes sense in my head, it doesn't work as expected, as seen in the picture below:

As you can see, it works fine when you're standing still, which means that the ground normal and the slopeRotation are correctly calculated. When the player moves though, the combination of all the quaternions seems to cause some kind of problem that makes the player slightly deviate from the correct rotation.
It might be worth noting that camRotation and moveRotation also work completely fine on their own, so the player moves correctly according to both the rotation of the camera and of the joystick, both on the floor and on ramps.

sentences:
Gamemaker - Maintain relative position between objects during rotation I have a large object and a small object - the small object updates its x and y position every step to match the x and y of the larger object. It is easy to keep it in the same position on the larger object without any rotation, as follows (in this instance, slightly above and to the right of the centre of the larger object, here called Owner:

x = Owner.x + 50
y = Owner.y - 50

However, this all goes pearshaped if the larger object is rotated from its sprite's initial position!

How can I maintain the relative position of the two objects even when rotated?

sentences:
Is It Okay To Use Real Designs In My 2D Game? [Cars and Weapons] I am making a 2D mobile game that includes cars and weapons (like GTA let's say). I am using real car and weapons designs to make 2D images, however, I use made-up names for the both cars and the weapons. Is it still copyrighted?

For example; Traffic Racer and Traffic Rider. In the games, the car models are exactly the same as the real ones, but there is no logo nor name in Traffic Racer. In Traffic Rider, you can clearly see BMW in the game (both the design and the logo). Because of these examples, I think, my situation should be okay since the game is not even 3D.

sentences: What does a game programmer and graphics programmer do? I'm quite the novice in terms of my knowledge of game development, and I'd incredibly appreciate any further insight on this. To be a bit more specific, I encountered this video, (https://www.youtube.com/watch?v=_GyFRMr4uf4) and It documents the roles of game programmers and graphics programmers at Naughty Dog but even with the descriptions, I'm still uncertain of what those jobs actually entail. Sorry If this wasn't a suitable place for the post, but for any help thanks in advance.

sentences:
glDrawArrays: Erasing the buffer between calls? I have two VBOs, assigned to names 1 and 2. Only 2 is being drawn. However, if I comment out VBO 2, VBO 1 is drawn with no problem. Here's the relevant code.

                for m in shader._models:
                    try:
                        # Set the model's transform matrix uniform
                        vbo, mode = m.render_data
                        glUniformMatrix4fv(
                            shader.uniforms['model'][0],
                            1,
                            GL_FALSE,
                            np.array(m.model_matrix))
                        vbo.bind()  # Binds the VBO.
                        glDrawArrays(mode, 0, len(vbo))
                    finally:
                        vbo.unbind() # Unbinds it.

glGetting GL_ARRAY_BUFFER_BINDING in the loop gives me alternating 1 and 2s, so the buffers are binding correctly. The second object is smaller and positioned in a different location, so they aren't hiding each other.

The only explanation I can think of is glDrawArrays clears the whole buffer every time it draws? What the heck?

sentences:
How to implement turn-based game engine? Let's imagine game like Heroes of Might and Magic, or Master of Orion, or your turn-based game of choice. What is the game logic behind making next turn? Are there any materials or books to read about the topic? To be specific, let's imagine game loop:

void eventsHandler(); //something that responds to input
void gameLogic(); //something that decides whats going to be output on the screen
void render(); //this function outputs stuff on screen

All those are getting called say 60 times a second. But how turn-based enters here? I might imagine that in gameLogic() there is a function like endTurn() that happens when a player clicks that button, but how do I handle it all? Need insights.

sentences:
How to draw a tileset using HTML5 canvas? I have a tileset something like this:

0, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16,
17, 18, 19, 20

My tileset draw code looks like this:

var image = new Image();
image.src = '32x32.png';
var tile = 5;
var tileSize = 32;
var x = 100;
var y = 100;
context.drawImage(image, Math.floor(tile * tileSize), 0, tileSize, tileSize, x, y, tileSize, tileSize);

And this code draws the 5 tile, but how would I draw the 10 tile, or the 15 tile without adding tileX and tileY?
I probably need something like if tile is equal to 15, then draw tile 15.

sentences:
How to avoid assigning the same GameObject individually for every prefab? In many times, prefabs that share the same script may require the same GameObject in the script. For example, in my game I want to make a series of card prefabs. Each card has their own image when shown, but has the same back image when hidden. My script for card is:

public class DraggingCard : DragAndDropItem
{
    public Sprite secretSprite; //This is the same for every card
    Sprite oringinalSprite; //This is individual for every card
    Image image;

    public void Awake()
    {
        image = GetComponent<Image>();
        oringinalSprite = image.sprite;
    }

    public void Activate()
    {
        image.sprite = oringinalSprite;
    }

    public void Hide()
    {
        image.sprite = secretSprite;
    }
}

But if I write this, I'll have to assign the secretSprite in the inspector for every DraggingCard prefab. I tried to set secretPrefab to be static or const but neither worked.

I believe there must be a clever way to avoid the repeat work. Could anyone tell me that? Thank you!

sentences:
Implementing The Command Pattern - Undo And Entity References I am trying to implement a replay/undo system for a turn based strategy game I am currently working on. A sample move could go as follows:

1. A players select a pawn and gives it an attack command.
2. The attacked unit dies.
3. The dead unit is removed from the map and the controlling player.
4. The controlling player takes some damage.
5. The attacking unit gains a survivor strength power up for the remainder of the game.

The rest of the game plays similarly to a Fire Emblem type game, but the point is a single command like attacking yields multiple effects to various game entities.

Eventually I want to make the game networked, but for now everything is local play.

After doing some research, I came across several resources discussing the command pattern and feel it is the solution to my replay and undo system. I ended up using an interface similar to https://gamedev.stackexchange.com/a/37684/41499 but I am confused on some of the implementation details.

Do I make commands to update each component of my game separately (i.e. AtkUnitCmd, RmvUnitFromMapCmd, RmvUnitFromPlayerCmd, InflictPlayerDmgCmd, etc.) or should my AtkUnitCmd handle all updates of entity state internally?
How do I handle dead units? I can store a reference to the dead unit, but this would likely need to change when networking is implemented as the object itself would not be transmitted over the network correct?
Each command has some animation involved for example when a unit moves an animation needs to play. I may choose to skip the animations while other times leave them on. Do I bake the animations into the commands themselves or should I separate the animation code and call it somehow when the command is played?

Any thoughts?

sentences:
How to align prefab to a accurate position with the best practice? I'm making a plumber game, I have a pump prefab, and pipe section prefab, which allows the user to connect the pipe during game, the pipe needs to be connected seamlessly during game, which means pipe prefab needs to be aligned in pixel level, please check below

User needs to add more and more pipe to connect the with each other, pipe is fixed length prefab.I've got choices,
1.Is the pipe prefab instantiated during game play a good practice? Because it might have many pipe prefabs, if the pipe goes a long way to another position, than there will needs to be so many pipe prefabs, compared to have procedrually generated pipe mesh during runtime, then a long pipe will not have to be cut off to the same small pieces?Which is good way to adpot?
2.If I use the same pipe prefabs to fabricate the piping system, how to accurately connect each other in pixel level, I can make the whole piping system in blender, then cut the system into pieces as my prefabs, then import to Unity as my first choice, this can do pixel level connection, but it seems to have better choice solely solved pixel level connection in Unity?
3.If I do it by generating the mesh during game play, then it could be complex especially it is hard to make elbow pipe mesh during runtime, or could you please advise me of some known library or package can do the work?

sentences:
Graphics.drawImage will only fill a small portion of my control I'm trying to create a map class for a simple 2D game. The map has an array(100,100,5) of string, returning the kind of tiles to draw ( with 5 possible layers from 0 to 4) players will move on the 2nd layer, the background of the game is on layer 0)

I'm want a drawMap sub that I would be able to call as needed. ( not the onPaint method, because I'm loading the game data map from  a binary file, and this game contains the needed coordinates, number of tiles, etc and the array of tiles, so I need to load the map info 1st, then use the draw sub)

I'm struggling right now because only the Tiles(0 to 3, 0 to 1,0) are showing ... while my array is full of tiles  !

Heres the code :

Public class Map
   inherits Panel

'... properties and stuff ....'

 Public Sub New(Optional ByVal mapName As String = "")

    G = Me.CreateGraphics()

    Me.BorderStyle = Windows.Forms.BorderStyle.Fixed3D
    Me.Location = New Point(250, 50)

    Load(mapName)

    Me.Width = mapSizeX * tileSize
    Me.Height = mapSizeY * tileSize

End Sub

Public Sub DrawGraphics(ByVal layer As Integer, ByVal g As System.Drawing.Graphics)
    For y As Integer = 0 To Map.mapSizeY - 1
        For x As Integer = 0 To Map.mapSizeX - 1
            If Not Map.Tile(x, y, layer) = "" Then
                GetSourceRect( x, y, layer, Map) 'return rectangle from my spritesheet '
                dRect = New Rectangle((x * tileSize), (y * Map.tileSize), tileSize, tileSize)
                g.DrawImage(SpriteSheet, dRect, sRect, GraphicsUnit.Pixel)
            End If

        Next
    Next
End Sub
end class

Load(mapname) deserializes a binary file containing the value for mapSizeX and mapSizeY, as well as tileSize and the Tiles(100,100,5) array all filled up.

What am I doing wrong at this point ?

sentences: How to remove a scene after the another one has loaded ]2[]3I'm having this problem in Unity where I load a new scene, but the original is still overlapping it. How would you remove the original scene?

sentences:
How to measure packet latency? In the context of lag compensation, one needs to know when the command is instantiated on the client (this can be named as "command execution time" as well). AFAIK, there can be 2 methods for this:

Client sends a timestamp with the command.
Client doesn't send any timestamps, but server does a smart thing to calculate the command's instantiation time.

About #1:

Is this safe in terms of cheating?

About #2:

According to Valve's paper, command execution time is as following:

  Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation

This means, server must know the packet latency.

Another paper from Valve confirms this and says:

  Before executing a player's current user command, the server:

  Computes a fairly accurate latency for the player
  ...

How can the server compute "fairly accurate latency for the player"?

Most naive and easiest approach would be sending pings regularly (less frequent than game commands and updates though) to find out an average of the latency and use it. Busy network traffic, latency fluctuation and naiveness of this method makes me feel there must be a more elegant way.

EDIT: Would UDP vs TCP change anything in this context?

sentences:
Implementing a 2d Selection Box I'm in the process of implementing a selection box for my simulation and am having difficulty with something which appears simple. At the moment, I can draw the selection box and accurately select the items under it, provided the box was dragged from the top-left-hand corner downwards:

If I start dragging the box from any other point the rectangle doesn't correspond to that of the viewport, as demonstrated by the negative width and height.

Here is my code:

// selectionBox is Rectangle

if (mouse.LeftButton == ButtonState.Pressed && prevMouse.LeftButton == ButtonState.Pressed)
{
    if (selecting)
    {
        selectionBox.Width = mouse.X - selectionBox.X;
        selectionBox.Height = mouse.Y - selectionBox.Y;
    }
    else
    {
        selecting = true;
        selectionBox.X = mouse.X;
        selectionBox.Y = mouse.Y;
    }
}

// Code to handle selection finished omitted

// Drawing code
if (selecting)
{
    DrawingHelper.DrawRectangle(selectionBox, Color.Yellow, false);
    DrawingHelper.DrawRectangle(new Rectangle(startPoint.X - 4, startPoint.Y - 4, 8, 8), Color.Red, true);
}

How can I adjust the X, Y, Width and Height of my selection box so that X and Y are always the top-left of the selection box no matter where the selection began?

sentences:
C# - How to properly play background songs in XNA So I'm using the game states (enum) to change my game screens. I have 2 songs for main menu and game playing states, respectively. To play songs, I'm using an old code example I saw at MSDN, like this:

bool songStart = false;
Song song1;
Song song2;

// LoadContent method:
song1 = Content.Load<Song>(".\\Songs\\mainMenuTheme");
song2 = Content.Load<Song>(".\\Songs\\mainGameTheme");
MediaPlayer.IsRepeating = true;

// Update method:
switch (CurrentGameState)
{
case gameState.mainMenu:
        if (CurrentGameState == gameState.mainMenu && !songStart)
    {
        MediaPlayer.Stop();
        MediaPlayer.Play(song);
        songStart = true;
    }
    else if (CurrentGameState != gameState.mainMenu && songStart == true)
    {
        MediaPlayer.Stop();
        songStart = false;
    }
break;
case gameState.gamePlaying:
        if (CurrentGameState == gameState.gamePlaying && !m_SongStart)
        {
            MediaPlayer.Stop();
            MediaPlayer.Play(song2);
            m_SongStart = true;
        }
        else if (CurrentGameState != gameState.gamePlaying && songStart == true)
        {
            MediaPlayer.Stop();
            songStart = false;
        }
break;

So if I am in mainMenu, the first song plays; when I go to gamePalying the first song stops and the second one starts playing. If I return to mainMenu, the mainMenu song plays. My issue however, is that if I click Play game and the state moves to gamePlaying there is no background music! What could've caused the problem? Please help me fix it, I'm stuck for a whole week.

sentences:
How do I make Unity halt on exceptions? I'm trying to debug a Unity project using the Unity Editor and Visual Studio. A runtime exception keeps popping up, but the debugger doesn't halt when an exception occurs, making it impossible to debug my code efficiently.

In Visual Studio, I've gone into Tools -> Options -> Tools For Unity and set "Exception Support" to "True". I've also enabled all types of exceptions in the Exception Settings panel. I am connecting the debugger to Unity using the "Attach to Unity" button. Breakpoints are working, but the debugger isn't halting on Exceptions.

What do I need to do to get Unity/VS to actually halt on Exceptions?

Note: I've tried closing and re-opening both Unity and VS many times but that doesn't make any difference.

sentences:
How to implement transition between screens Last night I showed my game to my friends and they said it was a bit jumpy.

The example he gave was in the pokemon games when a battle starts music plays, the screen flashes then pixels out then the pokemon slide on from the side and the battle menu appears.

In my game you are walking along and the all of a sudden you are staring at the battle menu, I do see his point.

I am using a switch statement for my game loop, 1 is a fields and 2 is battle, in battle I run an if statement, if battle active do battle else display results screen/wait for user input.

I thought about making a state for the transition but them I would need a stater for field -> battle, battle -> field, town -> field and the list goes on an on seeming like lots of repeated code to me but I cant think of a way to pause the state while i play an animation like pokemon

With that sort or architecture how would transition between screens smoothly like my mate suggests?

C++ and directX

Edit: the problem I have is that once the state is changed the update routeen for that state is not called so all the sprites disappear as they are textures and only the background remains so I cannot just play a animation then change state or it will look even worse.

sentences:
Acceptable memory size consumed by mobile game in 2017? How do you think, what is the acceptable memory size consumed by mobile game in 2017, taking into account current state of mobile devices hardware performance?
I've made a pack of optimizations using a number of recommendations and managed to reduce memory consumption from 270Mb to 120Mb, but it still seems to me too much.
Anyway, my game looks pretty nice, smooth and fast on iPhone 5s (produced in 2013), also I run it on cheapest no-name android, and it still looks quite good.
So my question can be rephrased this way: is there anything criminal if the game eats about 200Mb of RAM in our reality when 1Gb of ram is not something incredible for the mobile device?

sentences:
Controlling a thrustered 2D space ship with angular rotation and max speed In my game I have a computer controlled ship that is accelerated by a thruster: with a constant force and in the direction of the ship's current orientation/rotation angle.

Thrusting
My ship has a maximum speed limit (velocity) and a maximum thrust power that can be applied each time to the velocity until maximum speed has been reached.

Rotating
Given a "desired target" (click the screen on my demo), it determines the required angle and rotates by a constant angular force until it reaches the desired value.

Finding the angle and rotating is done. The problem is that the only way I know how to keep a speed limit is by limiting the ship's velocity vector before it is summed to the ship's location, but this way the ship is always thrusting (like in the video) only the effect is caped:

Check: Thruster space ship in action (youtube)

Thrusting only when required
In a better approach, I only thrust if the ship orientation angle is aligned with the target angle.

Check: A better approach (youtube)

While this is visually more effective, thrusting is still done at max power and still relies in limiting the velocity when the ship is thrusting.

What I need (and I can't do)
I need to calculate the force that the thruster should apply to the ship's velocity to change the direction while keeping the overall speed not beyond the limit so I can get rid of limiting the ship's velocity.

Reading this thread I understand (I think) that I need to apply to the velocity only the component of the force that will affect the ship velocity angle and not its length. And I can determine this checking if the direction of the impulse (thrusting force) is orthogonal to the current direction of the ship's  velocity and applying the relevant component of that force (x or y).

I did many attemps and all failed. So I came here with
hope to find someone who is more familiarized with this or at least that can explain how to apply @dannuic reply to my code.

This is my code on github, just clone and if in Linux run ./simpleServer (may require chmod u+x).

Thank you very much!

sentences:
How to import a texture to be used as occlusion map? The same way normal maps need to be imported as "Normal map" in the import settings, how should I setup an Ambient Occlusion texture to correctly work?

I've been searching around in the manual and the web but still not sure if AO maps should be imported as Lightmaps.

sentences:
Camera that pivots in the direction that the player is moving I'm trying to recreate Rocket League's freeform (non ball-locked) camera, which basically is a camera that follows the player but pivots to allows face the direction the player is moving in (not necessarily facing). Here's a video of Rocket League's implementation for reference: https://www.youtube.com/watch?v=RSpB6ocrIX8&t=37s

What are the main things needed to accomplish this?

sentences:
Networked projectiles in an authoritative server I'm working on a multiplayer game, and I've implemented a simple enough player prediction (according to this great article) - which works well enough.

What isn't discussed there, and my question here; is how do I handle non-raycast projectiles (like missiles for example)?

There is RTT between the player pressing fire to the time he receives back the server's "confirmation", and then all other players add their latency to the mix.

And of course there is the issue of actually rendering hits; what if I see my missile hit someone in my simulation while he wasn't even there on the server and the missile missed him completely?

So my question is, what is the best way to hide latency for all players in (relatively) slow moving projectiles in an authoritative server?

sentences: MonoGame and normal windowed desktop application I am trying to move all my XNA projects to Monogame. But in project templates I found only XAML and horrible metro application template. Is MonoGame support creating application in good old windowed mode for Windows 8? If yes how?

sentences:
Transformation order when dealing with Meshes I have created a player model out of primitive types. To do this I have created a Model class and  Component (mesh) class. Each model consists of one or more components my problems start when you have to rotate the model as a whole. When you manually create a mesh, you have to also specify it's origin, my problem is that the player is not rotating, before it worked somewhat (it turned each mesh indivialy) but then I changed the order of the Matrices and now it doesn't rotate at all, I think it is my matrix order:

effect.Parameters["World"].SetValue(Matrix.Identity *  Matrix.CreateTranslation(component.RelativePosition) * Matrix.CreateRotationY(player.Rotation.Y) * Matrix.CreateTranslation(player.Position)  * Matrix.CreateTranslation(player.Model.Origin));

How can I fix this?

Edit:

The update code is (I added the "0, 0, -1" so I can actually see it) but it is rotating each component idividally rather then as a whole model:

effect.Parameters["World"].SetValue(Matrix.CreateTranslation(-player.Model.Origin)  * Matrix.CreateRotationY(player.Rotation.Y) * Matrix.CreateTranslation(component.RelativePosition) * Matrix.CreateTranslation(player.Position) * Matrix.CreateTranslation(0, 0, -1));

sentences: how to check previous scene in scene manager in unity 3d I'm trying to make my first game using unity 3d and I'm trying to make a game over the scene that when you press the try again? button it should take you back to the previous scene, I was thinking of just making it with the code SceneManager.GetActiveScene().buildIndex - 1)); then just place one after every level on the build index so that it takes to the previous level that the player was in, but I think this would just increase the file size (Idk if it actually does), so I was wondering if there is a more efficient manner on how to do this so that I could only have one Game Over Scene in the Build Index?

sentences:
Libgdx: Check collisions in Stage among actors My goal is to check collisions among the actors that are in the Stage.

My question is: is it necessary to maintain a list for each type of actor I have?

Doing that I get 3 problems, 2 bad design problems and 1 exception.

Design problems I don't like:

The Actors used by the player add bullets (another Actor) to the stage. I need to pass my Stage to these Actors as argument in order to add a bullet to the list of bullets, that is held by the Stage.
Each time I need to add an Actor to the Stage, I have to perform 2 add operations, one in the list and one directly to the Stage.
If I check collisions iterating over the lists and I find out that an enemy (another actor) is dead, I need to remove the enemy both from the stage and from the list, but I can't remove it from the list because I get "Concurrent modification exception".

Is there some common design technique to handle this stuff?

sentences:
CompileFromFile syntax error upon compilation I am using visual studio c++ 2003 edition and I am trying to use the function CompileFromFIle function from DirectX SDK February 2010 SDK to add bloom to my source code for a mod I am working on and I get this error upon building the release build what is the issue. How do I fix this error?

Output build errors:

c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(839) : error C2061: syntax error : identifier '__out'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(843) : error C2061: syntax error : identifier '__in'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : error C2059: syntax error : ')'
c:\Users\john\Desktop\fear public tools 108\Source\Game\ClientFxDLL\D3D10.h(847) : fatal error C1903: unable to recover from previous error(s); stopping compilation

Here is my code cpp file to look at also:

#define _WIN32_WINNT 0x600
#include "stdafx.h"
#include <stdio.h>

#include "C:\Users\john\Desktop\fear public tools 108\Source \Game\ClientFxDLL\D3Dcompiler.h"

#pragma comment(lib,"d3dcompiler.lib")

HRESULT CompileShader( _In_ LPCWSTR srcFile, _In_ LPCSTR entryPoint, _In_   LPCSTR profile, _Outptr_ ID3DBlob** blob )
{
if ( !srcFile || !entryPoint || !profile || !blob )
   return E_INVALIDARG;

*blob = nullptr;

UINT flags = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
flags |= D3DCOMPILE_DEBUG;
#endif

const D3D_SHADER_MACRO defines[] =
{
    "EXAMPLE_DEFINE", "1",
    NULL, NULL
};

ID3DBlob* shaderBlob = nullptr;
ID3DBlob* errorBlob = nullptr;
HRESULT hr = D3DCompileFromFile( srcFile, defines,    D3D_COMPILE_STANDARD_FILE_INCLUDE,
                                 entryPoint, profile,
                                 flags, 0, &shaderBlob, &errorBlob );
if ( FAILED(hr) )
{
    if ( errorBlob )
    {
        OutputDebugStringA( (char*)errorBlob->GetBufferPointer() );
        errorBlob->Release();
    }

    if ( shaderBlob )
       shaderBlob->Release();

    return hr;
}

*blob = shaderBlob;

return hr;
}

int main()
{
// Compile vertex shader shader
ID3DBlob *vsBlob = nullptr;
 HRESULT hr = CompileShader( L"BloomCombine.hlsl", "VSMain",   "vs_4_0_level_9_1", &vsBlob );
if ( FAILED(hr) )
{
    printf("Failed compiling vertex shader %08X\n", hr );
    return -1;
}

// Compile pixel shader shader
ID3DBlob *psBlob = nullptr;
hr = CompileShader( L"BloomExtract.hlsl", "PSMain", "ps_4_0_level_9_1",    &psBlob );
if ( FAILED(hr) )
{
    vsBlob->Release();
    printf("Failed compiling pixel shader %08X\n", hr );
    return -1;
}

printf("Success\n");

// Clean up
vsBlob->Release();
psBlob->Release();

return 0;
}

sentences:
Android activities, when to use them? I'm getting back into programming my game and I can see that I've used activities for so many things. I only have one with a custom-view (my actual game), the others are activities with XML-views, like menus, level-selector, Complete-screen etc.

My question is, Should I not use acitvities for this? and instead create states in my game with different touch-listeners? because I'm afraid of memory-leaks, which tends to come with the use of having activities everywhere.

I destroy all the activities properly before I move onto the next, but still, it feels sloppy somehow. Maybe the startscreen and levelselector are ok, since they are not called in real-time. But my complete-screen is called in real-time through the UI-thread, this just feels wrong.

My heap is already out of control and I dont need any leaks, I already have to limit my app to androids from 2012 and beyond.

So I'm calling out to someone with experience, since this is my first really big game, that I intend to release.

also, if anyone can tell me what these rows that I get in my logcat means, I would really appriciate it, I get that it has to do with heap and allocations, but what is good/bad to have here?

03-20 02:26:23.142: D/dalvikvm(21837): GC_FOR_ALLOC freed 941K, 8% free 14613K/15815K, paused 15ms, total 15ms

03-20 02:26:23.158: I/dalvikvm-heap(21837): Grow heap (frag case) to 17.825MB for 3686416-byte allocation

03-20 02:26:23.181: D/dalvikvm(21837): GC_CONCURRENT freed <1K, 7% free 18212K/19463K, paused 13ms+3ms, total 28ms

sentences:
Opengl texture rendered as solid color,why? her is my vertex array and texture coordinate..

float POS[]=
{
    -0.5,-0.5,-1.0,
    0.5,-0.5,-1.0,
    0.5,0.5,-1.0,
    -0.5,0.5,-1.0
};

float texCoords[] = {
0.0,0.0,
1.0,0.0,
1.0,1.0,
0.0,1.0
};

here is my texture creation

stbi_set_flip_vertically_on_load(1);
    openglTexBuff=stbi_load("lena.jpg",&w,&h,&c,0);

    glGenTextures(1,&TexID);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D,TexID);
    glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,w,h,GL_FALSE,GL_RGB,GL_UNSIGNED_BYTE,openglTexBuff);
    glGenerateMipmap(GL_TEXTURE_2D);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);

    glBindTexture(GL_TEXTURE_2D,0);
    stbi_image_free(openglTexBuff);'

and these are my shaders

#shader vertex
#version 330 core

layout(location = 0) in vec4 positions;
layout(location = 1) in vec2 texCoords;
uniform mat4 translation_matrix; //inactive shader variables..
uniform mat4 rotation_matrix;

mat4 model_matrix; //
mat4 projection_matrix;
out vec4 pos;
out vec2 frag_TexCoord;

void main()
{

rotation_matrix;

gl_Position=rotation_matrix*translation_matrix*positions; //translation matrix operated with POS vector..
pos=positions;
frag_TexCoord=texCoords;
translation_matrix;

}

#shader fragment
#version 330 core

layout(location=0) out vec4 color;
in vec4 pos;
in vec2 frag_TexCoord;rag_TexCoord;
uniform float col;
uniform sampler2D  a_texture;
void main()
{
col;
a_texture;

color=texture(a_texture,frag_TexCoord);

}

when i use (solid)color instead of texture in shader..everything works fine but when i use shader it gives solid color instead of texture..It seems like my whole tex is super-zoomed to output single color

here is draw call

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    box.shader.setUniformat4x4("translation_matrix",translation);
    //box.shader.setUniformat4x4("rotation_matrix",rotation_arr);
    box.shader.setUniform1f("col",1.0);
    glBindTexture(GL_TEXTURE_2D,TexID);
    box.shader.setUniform1i("a_texture",0);
    box.render();

box.render

void render()
    {
        vertices.bind();
        indices.bind();
        shader.bind();
        glDrawElements(render_As,vertices.getSize(),GL_UNSIGNED_INT,NULL);
        vertices.unbind();
        indices.unbind();

    }

sentences:
How do I create an actor class in UDK that will spawn a specific particle system? I'm trying to write a new class that I can drag from actor classes window into the scene and it will spawn a specific particle effect. Its going to be a 'prop' that later will also contain a static mesh and a point light. Maybe some defined variables that can be changed in the properties window. So far, I have the static mesh working using this code:

class LightFixture extends StaticMeshActor;

defaultproperties
{
    Begin Object Class=StaticMeshComponent Name=myMesh
        bAllowApproximateOcclusion=TRUE
        bForceDirectLightMap=TRUE
        bUsePrecomputedShadows=TRUE
        StaticMesh=StaticMesh'props.Meshes.lamp'
    End Object

    Components.Add(myMesh)
}

now, I'd like to add a particle system (template?), and from what I'm learning, it's not as easy as adding the mesh. In a new class, I tried to add a particle effect this way:

class FireParticle extends EmitterPool
placeable;

var ParticleSystemComponent PSC;

defaultproperties
{
    Begin Object Class=ParticleSystemComponent Name=myEffect
        bAutoActivate=true
        Template=ParticleSystem'props.FX.fire'
    End Object

    ParticleSystemComponent=myEffect
    Components.Add(myEffect)
}

So that didn't work... I read somewhere that emitterpool was the way to spawn.. I am very new to scripting, if that isn't already obvious :)

thanks in advance, if anyone can help..

sentences:
How does Unity's execution order work? I wonder how Unity's execution order really works.
There's an ordered list at https://docs.unity3d.com/Manual/ExecutionOrder.html, but how does this work when there are different gameobjects involved? Will Unity first run the specific function for all the monobehaviours in the scene before it proceeds to the next function? Or will each monobehaviour go through that specific order of functions before Unity goes to the next monobehaviour? Or is it more complex? It isn't really clear to me from the documentation.

For example, normally Start() gets called before Update(), however when I was debugging, Update() on my Avatar prefab got called before Start() of my Camera child object. Is this supposed to happen?

sentences:
What is the purpose of a "press start" screen? A lot of games start with their intros and vendor videos, and then show a "Press Start" screen before the actual main menu.

I never quite figures out the purpose of this. Why not go to the main menu directly? The only possible explanation that made sense to me is that when multiple controllers are connected it allows to identify the one that the player wants to use.

sentences:
Reduce bounciness of dynamic bodies in Box2D In my 2D platformer game my player character is modeled using a Box2D dynamic body. One thing I thought feels off though is that even though the restitution of the fixture applied is zero, the player will bounce off static geometry when falling at an angle, kind of like a plastic box would perhaps, but certainly not like a body would.

There isn't really much that Box2D allows me to tweak though except for density and restitution? I noticed that playing with the density has basically no effect on how the player moves which I thought was odd too.

Are there any realistic value ranges you would recommend? It's all a bit trial and error right now for me.

sentences:
In Unity, why does my IndexOutOfRange exception disappear when trying to debug it? I don't get errors when playing from Unity "Game" tab. But when I build an executable (development or not) it stucks. I get "IndexOutOfRange" exception.
Which also magically disappears (yes) when I add some debug lines:

This does not work:

for (int i = x1; i <= x2; i++)
for (int j = y1; j <= y2; j++)
{
    int a, b;
    a = 7 + i; // Out of range
    b = 7 + j; // Out of range

    submap[a, b] = world.WalkableMap[(int)CurrentWalkableTile.x + i, (int)CurrentWalkableTile.y + j];
}

This works:

for (int i = x1; i <= x2; i++)
for (int j = y1; j <= y2; j++)
{
    int a, b;
    a = 7 + i;
    b = 7 + j;

    if (a < 0 || a > 15) // now with this never gets out of range
        Debug.Log("A out of range: " + a);

    if (b < 0 || b > 15) // now with this never gets out of range
        Debug.Log("B out of range: " + b);

    submap[a, b] = world.WalkableMap[(int)CurrentWalkableTile.x + i, (int)CurrentWalkableTile.y + j];
}

I can't find any sense. The exception literally hides from me

Additional info maybe is useful:

x1 = (CurrentWalkableTile.x - 7) >= 0 ? -7 : -(int)CurrentWalkableTile.x;
x2 = (CurrentWalkableTile.x + 7) < world.wmap_x_size ? 7 : (world.wmap_x_size - (int)CurrentWalkableTile.x - 1);

y1 = (CurrentWalkableTile.y - 7) >= 0 ? -7 : -(int)CurrentWalkableTile.y;
y2 = (CurrentWalkableTile.y + 7) < world.wmap_y_size ? 7 : (world.wmap_y_size - (int)CurrentWalkableTile.y - 1);

I'd like to post more information, but I can't even debug to find the problem.

sentences:
Lamba expressions: The => Operator. Any plain English help to understand this please? I've been adding Google Play support into my game. For the most part I'm getting on swimmingly, but I'm having a hell of a time understanding exactly how the submission calls to submit score and achievements work.

It's the => operator and surrounding method that confuse me, such as this one that I have in my code. It all works, I just don't know how. I've read up a bit and I think these are called Lambda expressions.

But I want to know why it is this way, and why it isn't made so we can just use the standard typical bool instead of making this strange way to send the result of whether or not our player is logged in.

Hope that makes sense. Here's the code in question:

Social.localUser.Authenticate((bool success) => {
        if (success)
            {
                Debug.Log("score authenticed successfully");
            }
            else
            {
                Debug.Log("score not authenticed, check user is signed in");
            }
     });
    Social.ReportScore(score, GPGSIds.leaderboard_pinball_wizards, (bool success) => {});

Particularly, the bottom line really has me stuck.

sentences:
How common are game engine bugs, and can I claim damages for them? Are game engine bugs (in popular ones like Unreal and Unity, not some unknown ones) common? I know engines like Unreal, Source and Unity3D are well tested and maintained, but, for example, is there any threat like: I create a game, the engine programming is fine, so is everything I do, but I get a bug in the game because of a bug in the engine?

And as most of you guys here are game developers, has any one had such an experience? Also, can I take legal action on the creators of that engine incase I am under loss because of their bug?

sentences:
midpoint displacement algorithm in sdl I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is that the terrain repeats itself after certain period of time. Why is that exactly happening and how to rectify it. Here is my source code.

#include <SDL2/SDL.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
SDL_Window* gWindow = NULL;
SDL_Renderer* gRenderer = NULL;
int arr_size = pow(2.0,11.0) + 1;
int terrain_array[10000];
float roughness = 0.5;
int intial_displacement = 150;
int count = 0;
bool init()
{
    bool success = true;
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        cout << "SDL could not initialize. SDL_Error: " << SDL_GetError() << endl;
        success = false;
    }
    else
    {
        if( !SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ) )
        {
            cout << "Linear texture filtering not enabled.\n";
        }
        gWindow = SDL_CreateWindow( "Midpoint_Displacement_Algortihm", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
        if( gWindow == NULL )
        {
            cout << "Window could not be created. SDL_Error: " << SDL_GetError() << endl;
            success = false;
        }
        else
        {
            gRenderer = SDL_CreateRenderer( gWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC );
            if( gRenderer == NULL )
            {
                cout << "Renderer could not be created. SDL_Error: " << SDL_GetError() << endl;
                success = false;
            }
            else
            {
                SDL_SetRenderDrawColor( gRenderer, 96, 96, 96, 96 );
            }
        }
    }
    return success;
}
void close()
{
    SDL_DestroyRenderer( gRenderer );
    SDL_DestroyWindow( gWindow );
    gWindow = NULL;
    gRenderer = NULL;
    SDL_Quit();
}
void initializeArray()
{
    for(int i = 0; i < arr_size; i++)
    {
        terrain_array[i] = 0;
    }
}
void generateTerrain(int leftindex, int rightindex, int displacement)
{
    if((leftindex + 1) == rightindex)
        return;
    int midindex = floor((leftindex + rightindex) / 2);
    int change = ((rand()%1) * 5 - 1) * displacement;
    terrain_array[midindex] = (terrain_array[leftindex] + terrain_array[rightindex]) / 2 + change;
    displacement = displacement * roughness;
    generateTerrain(leftindex, midindex, displacement);
    generateTerrain(midindex, rightindex, displacement);
}
void drawTerrain()
{
    int start_point = 1;
    int i;
    SDL_SetRenderDrawColor( gRenderer, 96, 96, 255, 255 );
    for(i = 1; i < arr_size; i++)
    {
        SDL_RenderDrawLine( gRenderer, start_point, SCREEN_HEIGHT, i, (terrain_array[(count + i)%arr_size] + 3 * intial_displacement));
        start_point = i;
    }
    count++;
}
int main()
{
    initializeArray();
    if( !init() )
    {
        cout << "Failed to initialize\n";
    }
    else
    {
        bool quit = false;
        SDL_Event event;
        while( !quit )
        {
            while( SDL_PollEvent( &event ) != 0)
            {
                if( event.type == SDL_QUIT )
                {
                    quit = true;
                }
            }
            generateTerrain(0, arr_size - 1, intial_displacement);
            SDL_SetRenderDrawColor( gRenderer, 96, 96, 96, 96 );
            SDL_RenderClear( gRenderer );
            drawTerrain();
            SDL_RenderPresent( gRenderer );
        }
    }
    close();
    return 0;
}

I am new to this stuff and trying to learn.
This is what it looks like.

sentences:
How to make a map (game world) based on a real world place or city? As a disclaimer before my real question, I have little experience in game development, only basic Unity knowledge.

I noticed a lot of games are based on real world places and cities, for example GTA 5 on Los Angeles and Watch Dogs. What is the process of making such a virtual version of a real world place or city? Or at least, what is a good starting point?

I imagine you could get some sort of map data or satellite images and import this in a tool, from which you can start modelling the buildings etc. But if this is the case I don't know how to do that.

sentences:
Using world coordinates instead of pixels I've been told that having a set pixels-per-world unit number is bad practice because it will not look the same at different resolutions. Because of this, I am trying to learn about using abstract world-space coordinates instead, however I am having some trouble understanding.

I've setup a quick test project for learning this: http://pastebin.com/GiUiR2NS
As I understand it, CAM_WIDTH and CAM_HEIGHT should be the dimensions of the world in world units. However, I must be missing something because the end result seems to have made the world 50 pixels by 30 pixels. (My "wall" texture drawn at (0,0) in the bottom left is 16x16 pixels)

I am trying to achieve a view with which I can see 50 walls on the x-axis and 30 on the y-axis. I was able to do this when using direct pixel coordinates and multiplying by 16 (the pixels-per-world-unit number), however as stated before, I don't think I want to use this method anymore because of negative affects at different resolutions.

sentences: Pros and cons of using dlls I wonder about create every game engine module (render, input, sound, etc...) into dlls (renderer.dll, input.dll, etc...). What are pros and cons in your opinion of divide game into set of dlls ? I see only need to write game module in separate dll, to have posibility to create mods.

sentences: What is the difference between ambient lighting and skylight? What is the difference between ambient and skylight lighting? Please give me a detailed description of the differences.

sentences:
Why are there lines in between my tiles? I'm making a top down XNA game.  The maps are created by tiles.  A problem I recently noticed is a 'grid' of lines between the tiles.  It only shows up sometimes and only depending on the camera position.  I let XNA handle the positioning, why are these lines showing up?

Here is a picture with the lines:

However, after moving my camera over just a bit, it magically goes back to how it is supposed to appear:

Thanks for any help!

EDIT:

This is the best I can do for source code, this is an extremely large project and the rendering is done it multiple areas:

Main Render Loop For dynamic elements such as tiles:

    spriteBatch.Begin(SpriteSortMode.Deferred, Nothing, SamplerState.LinearClamp, Nothing, Nothing, Nothing, Matrix.CreateTranslation(CameraX, CameraY, 0))
    Mode.Render(spriteBatch, False)
    For Each j As [Delegate] In DynamicInjectionList
        j.DynamicInvoke(spriteBatch)
    Next
    DynamicInjectionList.Clear()
    spriteBatch.End()

Mode.Render:

For x As Integer = 0 To GRIDMAX - 1
    For y As Integer = 0 To GRIDMAX - 1
        For z As Integer = 0 To 2
            Dim ter As TiledTerrain = Terrain(x, y, z)
            If ter IsNot Nothing Then
                sb.Draw(CBaseClient.TextureLibrary("TileMap"), New Rectangle(x * GRIDSIZE, y * GRIDSIZE, GRIDSIZE, GRIDSIZE), New Rectangle(ter.Texture_X, ter.Texture_Y, GRIDSIZE, GRIDSIZE), Color.White)
            End If
        Next
    Next
Next

TiledTerrain.vb Class:

Imports ProtoBuf

<ProtoContract()> _
Public Class TiledTerrain

    <ProtoMember(1)> _
    Public Property X As Integer
    <ProtoMember(2)> _
    Public Property Y As Integer
    <ProtoMember(3)> _
    Public Property Z As Integer

    <ProtoMember(4)> _
    Public Property Texture_X As Integer
    <ProtoMember(5)> _
    Public Property Texture_Y As Integer

End Class

My Research:

I've done some searching into it and this is was I've found:

This problem is called tearing (I believe?)
It is commonly caused by using a floating point data type to hold the tile position (I'm using Integer so this shouldn't be a problem right?)

sentences:
Is it possible to load local html pages into Gamemaker games? I was just wondering if it would be possible somehow to load locally saved web pages into a game. My primary use for them would be as menus, helping to navigate between rooms.

I know about the built in "Open URL" function but I want to know if the loaded page can interact with the actual game.

sentences: Should I use Async & Await, instead of Coroutines, in Unity? Should I use Async & Await in Unity?  Or should I keep using Coroutines?  If I should use Async & Await, how can I do so in a manner comparable to Coroutines?

sentences:
How do I trigger OnSelect() via the ISelectHandler in my class? I'm trying to figure out how I can make a custom UI element identify when it has been selected or deselected. Classes such as Selectable inherit from the ISelectHandler and IDeselectHandler  and their methods OnSelect() and OnDeselect() are called whenever I click inside the Selectable element and click outside of it.

From my understanding, inheriting from the appropriate handler interface and implementing it's required method will allow your class to handle events from the EventSystem. As an example if I have:

public class TestSelectable
    : MaskableGraphic,
    ISelectHandler,
    IDeselectHandler,
    IPointerEnterHandler,
    IPointerExitHandler
{

    public void OnSelect(BaseEventData eventData)
    {
        Debug.Log("Selected");
    }

    public void OnDeselect(BaseEventData eventData)
    {
        Debug.Log("De-Selected");
    }

    public void OnPointerEnter(PointerEventData eventData)
    {
        Debug.Log("Pointer Enter");

    }

    public void OnPointerExit(PointerEventData eventData)
    {
        Debug.Log("Pointer Exit");

    }

When the mouse enters and exits the element the OnPointerEnter() and OnPointerExit() methods are sucessfully called. However selecting/De-selecting the element does not cause the OnSelect() or OnDeselect() methods to be called. Though if you look in InputField.cs (which inherits from Selectable), the OnSelect() method does successfully get called when the input field is selected. I'm trying to replicate this within my own element without having to inherit from Selectable, and since Unity's event system is publicly accessible this should be possible.

Are there other requirements that will enable those events to fire and call my methods?

sentences:
XNA: Camera's Rotation and Translation matrices seem to interfere with each other I've been following the guide here for how to create a custom 2D camera in XNA. It works great, I've implemented it before, but for some reason, the matrix math is throwing me off.

public sealed class Camera2D
{
    public Vector2 Origin { get; set; }
    public Vector2 Position { get; set; }
    public float Scale { get; set; }
    public float Rotation { get; set; }
}

It might be easier to just show you a picture of my problem: http://i.imgur.com/H1l6LEx.png

What  I want to do is allow the camera to pivot around any given point. Right now, I have the rotations mapped to my shoulder buttons on a gamepad, and if I press them, it should rotate around the point the camera is currently looking at. Then, I use the left stick to move the camera around. The problem is that after it's been rotated, pressing "up" results in it being used relative to the rotation, creating the image above.

I understand that matrices have to be applied in a certain order, and that I have to offset the thing to be rotated around the world origin and move it back, but it just won't work!

public Matrix GetTransformationMatrix()
    {
        Matrix mRotate = Matrix.Identity *
            Matrix.CreateTranslation(-Origin.X, -Origin.Y, 0.00f) *  // Move origin to world center
            Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation)) * // Apply rotation
            Matrix.CreateTranslation(+Origin.X, +Origin.Y, 0.00f);   // Undo the move operation

        Matrix mTranslate = Matrix.Identity *
            Matrix.CreateTranslation(-Position.X, Position.Y, 0.00f); // Apply the actual translation

        return mRotate * mTranslate;
    }

So to recap, it seems I can have it rotate around an arbitrary point and lose the ability to have "up" move the camera straight up, or I can rotate it around the world origin and have the camera move properly, but not both.

sentences: How do I create a scrollableparallax background in AndEngine GLES1 In my game I want my background to move side by side as the player moves on screen in AndEngine. I moved my sprite using analogScreenControl. I am using AndEngine GLES1. i don't want to move my background automatically but i want to move the background as per player moves on the screen with the help of analogScreenControl.

sentences:
Does game engines (like Unreal, Unity, Crafty) add value compared to pure js frameworks (react, ember..) for my isometric tile-based games I'd like to create a huge tile-based board (say 100K tile). The game does not have any advanced graphics (you don't see the players or landscapes), the main difficulty is that it has 100K tiles to show; something like this (but with many more tiles) or like this

Also, I can't use any technique like in minecraft where I only show smaller "regions" at a time of the map - all of the map has to be shown on the screen at once (people will zoom)

Would a game engine (unity, unreal, crafty, etc) add anything compared to pure javascript frameworks (react, ember, etc) if the only thing you are using them for is to render a tile based board (no animated graphics or characters moving on the screen)? With each tile only showing the state of a tile (occupied or not).

I might need collision detection as 2 players can't be on the same tile (note: I don't think it would be too hard to do this in javascript)
And maybe GPU acceleration out of the box?

sentences:
Learning Web Development and Game Development at the same time? I'm a junior-level developer, currently working full time and trying to get experience with working with ASP.NET MVC. I love web development, and want to continue to pursue it as my career, but I also love gaming and have done a few game tutorials with Monogame/XNA, and love that as well.

For anyone that has been in this situation, Can you tell me, from experience, if you noticed any form of degenerative results when trying to split focus between a full-time career in another field and beginning game development? I am looking for concrete examples of people who managed to split their time, and what their experience was like. I'm concerned that if I focus on game development on my spare time, then my growth in web development might suffer. I hope to use your input to determine for myself, how I should split up my free time, and manage my "Extracurricular" web projects, AND game development projects, so that I don't end up as a jack of all trades, master of none. I don't know why this is such a hard decision for me. :(

sentences:
2D Distance Field as collision handler method Pixeljunk Shooter has really cool fluid simulation.

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

I understand that it is particle based simulation Smoothed Particle Hydrodynamic

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

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

The second resource states

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

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

Is that "all" I need to do?

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

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

sentences:
In Unity, what does the camera script's "Behaviour missing" error mean? I started in Unity few days ago and made a cube with a tank control style. Now I'd like to create controls similar to 3D fighting games (Gunz, Blade Symphony, …): Control body direction with the mouse and walk with WASD.

However, the Camera is giving me a error called "Behaviour missing" each time I try, with all the cameras scripts I saw. I think that is a error with tagging the character movement in the camera, but I don't know how to do that.

What might be the problem?

sentences:
Lagging problem with chunk creation in Godot We are developing a 2D game in Godot and we are stuck while trying to divide the map in chunks. Namely, the scene is a forest, where trees spawn positions were generated by noise: since the trees are too many to be loaded altogether, we created a Chunk node, which only instances trees contained in it, and gets instanced and deinstanced according to player's position. Though, this does not seem to be enough: each time a new chunk is to be instanced, we get a lag spike. How can we improve this?
This is the script attached to Chunk:

extends Node2D

var noise

func _ready():
    randomize()
    self.name=str(global_position)
    noise=get_node("/root/global").noise
    LoadTrees()

func LoadTrees():
    var x=-38
    while x<39:
        var y=-14
        while y<15:
            if noise.get_noise_2d(global_position.x+float(10*x),global_position.y+float(12*y))>0.07:
                InstanceTree(Vector2(10*x+rng.randi_range(-3,3),12*y+rng.randi_range(-3,3)),self)
            y+=1
        x+=1

func _on_Exit_body_exited(body):
    if body.name=="Player":
        call_deferred("free")

func _on_AreaLeft_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position-2*Vector2(380,0)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaRight_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position+2*Vector2(380,0)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaDown_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position+2*Vector2(0,170)
        get_parent().InstanceChunk(NewChunkPos)

func _on_AreaUp_body_entered(body):
    if body.name=="Player":
        var NewChunkPos=global_position-2*Vector2(0,170)
        get_parent().InstanceChunk(NewChunkPos)

The functions the script calls from its parent's script go as follows:

func InstanceTree(pos,Parent):
    var tree=Tree.instance()
    tree.position=pos
    tree.name=str(global_position)+"_tree_"+str(pos)
    Parent.call_deferred("add_child",tree)

func InstanceChunk(NewChunkPos):
    if not self.has_node(str(NewChunkPos)):
        var NewChunk=Chunk.instance()
        NewChunk.global_position=NewChunkPos
        NewChunk.name=str(NewChunkPos)
        call_deferred("add_child",NewChunk)

sentences:
Pattern for collision handling? I am writing a game with Java. There are many different kinds of entities on the screen, like the player, NPCs, monsters, bullets, items, shiftable blocks and so on.

This question is not about collision detection, but about collision handling. If two entities collide, it depends on their type what should happen. Some examples:

If the player and a monster collide, the player should loose a life.
If a monster and a bullet collide, the monster should die.
If the player and an NPC collide, a dialog should start.
If the player and an item collide, the player should pick it up.

Now this could be done like this:

public void checkCollision() {
   for (Entity a: entities) {
      for (Entity b: entities) {
         if (collision(a,b)) {
            if (a instanceof Player && b instanceof Monster) a.loseLife();
            if (a instanceof Player && b instanceof Item) a.pickUp(b);
            ...
         }
      }
   }
}

But I heard that instanceof should not be used for this purpose. So I wonder what is the best way to handle the collision of the different combinations? I heard about the visitor pattern, but this would require me to change the classes of the entities and handle the collision there, what seems very wrong to me.

sentences:
Huge slowdown when running Lua as statically linked lib versus stand alone interpreter I'm developing some algorithms in Lua which are run mostly in Lua (few calls to C++) and I'm noticing a huge slowdown when I'm running them from my app rather than the default Lua interpreter.
The script returns in about 11 seconds with the interpreter, and about 5+ minutes with my program.

I don't think it is a problem with calling the C++ function, overruling that function with an empty function in the script has no noticeable effect for time.

Both Lua and the program are compiled with Visual Studio 2010 (I created a new solution for Lua, with projects for both the interpreter and static library)

I've run a profiler on the code (the Very Sleepy profiler, can't get a Lua profiler working but haven't tried to much) and found that in my application around 50% of the time is spend on malloc.. and 40% on free, both called from the Lua garbage collector (tried disabling that to check, but that crashes with using to much memory (understandably), the Lua interpreter peeks at about 4mb ram usage).

I'm new at Lua, so its very possible I've done something wrong somewhere, anyone got a few hints to try?

sentences: Game Characters vs Characters in other medias How do a characters designed for a game differ from characters made for books or movies? When a book or a movie is converted into a game, what are the differences and similarities that have to be addressed? Are there pitfalls in character design when jumping between these different medias?

sentences:
Positioning ropes equidistantly on a landscape display I would like to render 4 similar ropes in my game that are equidistant on a landscape mode display.

How can I proceed? My screen is 1920*1080, at 420 dpi.

Is there any way that I could link the ropes coordinates with pixels or is there another way?

sentences:
Custom 3D Renderer: Frustum clipping I have recently been toying with the idea of creating a 3D-renderer from scratch and, after looking into it, doesn't seem like such a behemoth of a task as it sounds. Last night, I was tossing and turning in bed because I had tons of ideas and was originally going to base the whole entire renderer off of an index system using vector-lists it occlude points that I don't need, but tossed that out of the window as I realised I needed to prioritise on the main rendering.
As most 3D-based developers will know, all of the vertices move around the viewport. This is a nightmare for people who want to make 3rd/1st person games because, if you don't know semi-advanced geometry then you're practically screwed. I realise that people will have to know about their soh's and their toa's eventually but I wanted to release the burden of that by having the viewport (matrix) move around the "world".
This is surely better for performance as well, as moving a matrix around must be easier for a gpu/cpu to calculate. I could be totally wrong, but I wanted to give this a go.

In my head, everything sort of works and would produce a "3D" world.
The only thing stopping me jumping into C++ and SFML/SDL at this point is a bug (or technically "unimplemented feature") of my program. The way I was going to have my renderer work is like so:

Find all vertices inside of viewport. (Lets call these V[] )
Get depth information of all V[]
Draw lines between certain V[] (In my case, one V will contain information such as, the next V in memory to connect to. Drawing lines is only for debug purposes or for the kewl 80's look.)
Save as a polygon.
Fill colour/texture within a poly's bounds to show depth or for design.

This should work, I think. But there is one issue and that issue is the reason I'm posting all of this.

Let's say that we have something that is bigger/not completely in a view frustum bounds and the camera is not looking at a vertex, how would we figure out that there is a "shape" there. I'm going to draw a crappy example in MS Paint to explain. (Ain't nobody got time for Photoshop..)

Any help is appreciated and a fully understand if what I wrote doesn't 'click'.
Thanks!

sentences:
Wraparound world with wraparound horizontally physics implementation in Unity What is the best way to implement a wraparound world with wraparound horizontally physics in Unity?

That means that if I have an object and move it so that a part of it sticks off to right (so that the camera does not see it) I would like the part of the object to be shown on left. The same goes for the left side.

The best (even though I do not like it at all) implementation I was able to find is to have three objects. One of them is visible for the camera and two others become visible when the middle object goes off the camera.

Any other ideas on this?

Here is my explanation with images of what I want to happen:

Thank you.

sentences:
Heightmap generation I want to implement something like this to create a heightmap: 'Place a group of coordinates evenly across a map, and give them height values within a certain range. Repeatedly create coordinates between all of those coordinates, setting their height by deriving a value that was a mean value of all the surrounding coordinates.'

However, I'm not sure how I would go about it - I'm not sure how I could code the part where I place the coordinates in between the existing coordinates. Can anyone give any help/advice?

sentences:
How to achieve hologram projection effect with head tracking I want to recreate this:
http://www.youtube.com/watch?v=9xMSGmjOZIg&feature=related

I can take care of tracking the user's head, and in one of the comments I believe the author says that he used a vertex shader to do the work, but what logic do you use to move the vertices to get this effect?

sentences:
map/world "decorator" algorithms/patterns I've spent a lot of time working with perlin/simplex noise for different styles of map gen, but I'm having a hard time finding advice/resources on how to populate the map with "world decor" that have some patterns to them... not just a random flower or tree.

I can control where on the map they spawn based on the height/temp values, but what are some good ways to control "patterns" the items spawn in?

For example, I want a specific plant to always spawn in clusters, but I want it to look natural and random - a bunch all together in a cluster and some individuals further out. I don't want all spawn instances to look the same.

A good reference is the Minecraft ore spawner - they're always in random configurations with some min/max size variations. Larger veins are even more rare.

sentences:
Placing tiles on 2D Simplex noise I have been experimenting with 2D Simplex noise for a mini-project and while I cannot say I understand the maths behind it, I begin to feel quite confident with how I can manipulate it to get different types of output.

While noise generation/algorithms/manipulation are quite easy to find, I am having trouble finding any good resources on the next step, i.e. placing 2D tiles based on the noise output (for the purpose of making some kind of 2D terrain).

I realize a crude and simple way would be to just loop through my array and place a tile on every coordinate where the noise value is above a certain point, but the output would look very rough, tiles would be overlapping each other, etc.

Does anyone have any good resources or information to share on this subject?

Thanks,

sentences:
How to create opacity mask from colored bitmap? For the image (bitmap) below,

if I do:

Create a spite with the image in unreal engine.

Create a opacity mask on the spite.

Use this image, choose a specific color, such as blue, make its corresponding region the only opacity region on the mask.

My question is about the implementation of part 2 and part 3 in Unreal engine, they are quite confusing.

If anyone know how to implement it in unity, it would also be helpful.

Thanks a lot.

sentences:
How to create a searchlight in Unity ? I'm trying to create a WW2 simple game and I'm experience issue creating the light emitted from a Flak Searchlight.

The final lighting effect will be something like this:

http://s1115.photobucket.com/user/k4kittycrew/media/K4KITTY3/Slide2_zpsfccf1590.jpg.html

I know that it is called "volumetric light" and this is not supported by Unity.

Thanks

sentences:
How to bind std::map to Lua with LuaBind Is this possible in lua to achieve?

player.scripts["movement"].properties["stat"] = "stand"
print (player.scripts["movement"].properties["stat"])

I've done getter method in c++ with this approach:

luabind::object FakeScript::getProp()
{
    luabind::object obj = luabind::newtable(L);

    for(auto i = this->properties.begin(); i != this->properties.end(); i++)
    {
        obj[i->first] = i->second;
    }

    return obj;
}

But I'm stuck with setter. The first line in lua code which I'm trying to set value "stand" for key "stat" is not going to work and it keep redirecting me to the getter method. Setter method only works when I drop ["stat"] from properties.

I can do something like this for setter in my script:

player.scripts["movement"].properties = {stat = "stand"}

But this isn't what I want because I have to go through my real keys in c++ to determine which key is placed in setter argument table value.

This is my map in class:

std::map<std::string, std::string> properties;

sentences:
Server side random selection of players Assuming I have a simple client-server game, where the server picks random players on a very frequent base, I was wondering what is the best way to select a random player (According to the following constraints):

Solution must be high performance and highly scalable
Random spread should be relatively even (meaning if I have 3 players and pick 99 times, they will all be picked 33 times more or less)
Should only pick players who were active in the past X days (optional, but a big bonus)

The actual DB or data model used to store players isn't an issue here, as we'll select the technology in accordance to our needs.

However, high performance and scalability is (at the moment we have over 60,000 unique daily active players, and we plan on growing even more).

Thanks!

sentences:
How can I get into opensource game development? The short and sweet question

I'm new to game programming in general, so how do I go about making GOOD QUALITY opensource games?

What I have come across

There are a multitude of games that I have played on Linux that are just downright shameful. The graphics are terrible, the AI is lacking, and the replayability is little to none. Don't get me wrong; I have played some good opensource games such as World of Goo, Gish, and Aquaria; but I'm really missing out on good games over here in my Linux hut.

What I have found

So, I did a little research on how the games mentioned were made. Thus, I have started learning OpenGL and SDL using my C++ programming experience (which is about a year of programming, not much). I also picked up the following books, which were recommended from programmers on stack overflow:

Focus on SDL (The only let me post one link for now...)
The OpenGL Super bible
GEB and CODE

What I have been recommended

I have also talked to someone who is a fairly experienced programmer who recommends that I take the C++ route to gaming, and that OpenGL and SDL would be a good way to go. He also recommended that I start using versioning control with my programs (Git particularly). What are your opinions on that?

Hope that was clear, guys.
Let me know,
Immanu'el

sentences:
Polling events with SDL results in stuttering response when dealing with multiple objects I'm new to SDL programming and I'm not quite sure I got how it handles events.
Given an instance like this defined in "game.c":
static struct {

  SDL_Window* window;
  SDL_Renderer* renderer;
  BinaryTree* objects;

} game = { NULL, NULL, NULL };

(Which of course gets properly initialized)
My game loop is defined in the same file as follows:
void game_run() {

  bool closeRequested = false;

  while(closeRequested == false) {

    SDL_RenderClear(game.renderer);

    binaryTree_startIteration(game.objects);

    while(binaryTree_hasNext(game.objects)) {

      GameObject* gameObject = (GameObject*) binaryTree_getNext(game.objects);

      SDL_Event event;

      while(SDL_PollEvent(&event)) {

        if(event.type == SDL_QUIT) {

          closeRequested = true;
        }
        else {

          if(event.type == SDL_KEYDOWN) {

            gameObject_onKeyPressed(gameObject);

            if(event.key.keysym.scancode == SDL_SCANCODE_UP) {

              gameObject_onUpKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_DOWN) {

              gameObject_onDownKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_LEFT) {

              gameObject_onLeftKeyPressed(gameObject);
            }

            if(event.key.keysym.scancode == SDL_SCANCODE_RIGHT) {

              gameObject_onRightKeyPressed(gameObject);
            }
          }

          if(event.type == SDL_KEYUP) {

            //
          }
        }
      }

      gameObject_onRendering(gameObject);
      SDL_RenderCopy(renderer, gameObject_getTexture(gameObject), NULL, gameObject_getDestination(gameObject));
    }

    SDL_RenderPresent(game.renderer);
  }
}

game.objects contains every object which has to be rendered (via game.renderer) onto the the window (game.window). So, on each frame game.objects gets iterated on and for each element various functions get executed, before its texture is loaded to the renderer.
Of course gameObject_onRightKeyPressed() is called only if the right key was pressed, so if this function is defined as
void gameObject_onRightKeyPressed(GameObject* gameObject) {

  gameObject->destination.x += 1,
}

On each frame that the right key is pressed, gameObject's texture will move by 1 pixel to the right.
This works perfectly if game.objects contains only one element, but if a second element gets added, only the first one will smoothly respond to my input, while the other will move by 1 or 2 pixels just once in a while by keeping the right key pressed. It's like the first element contained in game.objects "steals" the input, so that when the second element's turn comes, there's no input for it to respond to. What did I do wrong?

sentences:
How can I check if a point(Vector3) is in Matrix4x4 I'm placing random objects in an imaginary cube in front of my target. I am using following code to do this:

var center = Vector3.zero;
center.z = (m_size.z / 2) + m_offset.z;
center.x += m_offset.x;
center.y += m_offset.y;
var mat = Matrix4x4.TRS(m_target.position, m_target.rotation, m_target.lossyScale);
Vector3 pos = center + new Vector3(Random.Range(-m_size.x / 2, m_size.x / 2), Random.Range(-m_size.y / 2, m_size.y / 2), Random.Range(-m_size.z / 2, m_size.z / 2));
pos = mat.MultiplyPoint(pos);
m_instantiatedObject.Add(Instantiate(m_object, pos, Quaternion.identity));

And it's working as expected. but now my problem is as my target moves, the previously placed objects may not be in this imaginary cube anymore. how can I check if my placed objects are in this imaginary cube and if they are not I can remove them?

sentences:
Timing in fighting game using animations time? I am developing a 2D fighting game in C++. I have made the basic components such as moving, guarding and even a combo system that works perfectly well.

My main concern now is that I want the game to be as balanced as possible, and thus I am entering a testing phase. I am even requesting the help of my father to play against as no AI has been implemented (yet).

In the game you can chain attacks using a punch/kick (PK) button. But you can also charge the attack by pressing the PK button longer, which basically pauses the animation, resuming it when the attack is fully charged or the player releases the button. One thing that I have noticed is that if your opponent is simply pressing the PK button when being hit, it can counter attack pretty easily if you end up charging your attack. This behaviour basically makes charging useless, because it can never go through if your opponent knows that.

So my point is that I need to add a delay so that the counter cannot occur (I do not want it to, because the game is based on an actual PS2 game where you cannot counter that way - for the record, there is a way to escape, either by pressing the guard button, or by hitting a button at the right timing to teleport behind and counter).

To add this delay, I can either modify the actual duration of the "damage" animation so that it does what I want or I can internally add a timer where the character enters a state where he cannot do anything.

I would want to go for the first one, since that way you SEE that you cannot counter using a punch since you are still in the damage animation. But the thing is that each character has its own set of animations and thus in theory, the developer or the designer (which is me in both cases) can modify the duration of one character while the others still have an old value.

My question is thus more on the design level. Is it a good idea to let the timing be decided via animation duration? Is it what is actually done ? If I have fifty characters when I discover another timing issue, it would mean to modify the animation of each and every one of them... But adding a timer internally seems more like a patch that actual fine tuning...

sentences:
Subsurface Scattering - Transmittance I have a question related to SSS and especially transmittance. I've looked at several papers about that topic, most of them from Jorge Jimenez, which are very interesting and, I admit, a bit hard for me.

Here is one of the papers : http://www.iryoku.com/translucency/

I have some difficulties to understand the way it works and the way it calculates the distance the light traveled through the object. I think that I understand the very big lines but I am also a bit confused as I am trying to integrate this into the Unity engine and I have some difficulties to match Unity engine available values such as the shadows maps, the shadows coords, etc... to make them fit the way they are used in the paper.

So here it is, I am a bit lost in the "in-between" and I hope that somebody might be able to help me.

Thanks a lot.

EDIT : added the shader code from referenced paper

float distance(float3 posW, float3 normalW, int i) {
  // Shrink the position to avoid artifacts on the silhouette:
  posW = posW - 0.005 * normalW;

  // Transform to light space:
  float4 posL = mul(float4(posW, 1.0), lights[i].viewproj);

  // Fetch depth from the shadow map:
  // (Depth from shadow maps is expected to be linear)
  float d1 = shwmaps[i].Sample(sampler, posL.xy / posL.w);
  float d2 = posL.z;

  // Calculate the difference:
  return abs(d1 - d2);
}

// This function can be precomputed for efficiency
float3 T(float s) {
  return float3(0.233, 0.455, 0.649) * exp(-s * s / 0.0064) +
         float3(0.1,   0.336, 0.344) * exp(-s * s / 0.0484) +
         float3(0.118, 0.198, 0.0)   * exp(-s * s / 0.187)  +
         float3(0.113, 0.007, 0.007) * exp(-s * s / 0.567)  +
         float3(0.358, 0.004, 0.0)   * exp(-s * s / 1.99)   +
         float3(0.078, 0.0,   0.0)   * exp(-s * s / 7.41);
}

// The following is done for each light 'i'.

// Calculate the distance traveled by the light inside of the object:
// ('strength' modulates the strength of the effect; 'normalW' is the vertex
//  normal)
float s = distance(posW, normalW, i) / strength;

// Estimate the irradiance on the back:
// ('lightW' is the regular light vector)
float irradiance = max(0.3 + dot(-normalW, lightW), 0.0);

// Calculate transmitted light:
// ('attenuation' and 'spot' are the usual spot light factors, as in regular
//  reflected light):
float3 transmittance = T(s) * lights[i].color *
                       attenuation * spot * albedo.rgb * irradiance;

// Add the contribution of this light:
color += transmittance + reflectance;

sentences:
A good way to build a game loop in OpenGL I'm currently beginning to learn OpenGL at school, and I've started making a simple game the other day (on my own, not for school). I'm using freeglut, and am building it in C, so for my game loop I had really just been using a function I made passed to glutIdleFunc to update all the drawing and physics in one pass. This was fine for simple animations that I didn't care too much about the frame rate, but since the game is mostly physics based, I really want to (need to) tie down how fast it's updating.

So my first attempt was to have my function I pass to glutIdleFunc (myIdle()) to keep track of how much time has passed since the previous call to it, and update the physics (and currently graphics) every so many milliseconds. I used timeGetTime() to do this (by using <windows.h>). And this got me to thinking, is using the idle function really a good way of going about the game loop?

My question is, what is a better way to implement the game loop in OpenGL? Should I avoid using the idle function?

sentences:
When is transform width in code not equal to the transform width in inspector? I've come across a strange case in Unity's UI where the width of a RectTransform isn't the same as what is being reported. I have a transform which is 50 by 50 with no scaling, it is a root object of the canvas yet when I use the information that I get from the transform in code to draw from the bottom left edge of the transform to the top right it doesn't reach all the way!

Gizmos.color = Color.red;
Vector2 pos = new Vector2(transform.position.x, transform.position.y);
Gizmos.DrawLine(pos - transform.sizeDelta, pos + transform.sizeDelta);

Vector3[] corners = new Vector3[4];
transform.GetWorldCorners(corners);

Gizmos.color = Color.magenta;
Gizmos.DrawLine(corners[3], corners[0]);
Gizmos.DrawLine(corners[0], corners[1]);
Gizmos.DrawLine(corners[1], corners[2]);
Gizmos.DrawLine(corners[2], corners[3]);

The first section should draw a line from the bottom left to the top right according to what the transform reports are the width and height however they don't reach across the entire transform. Using GetWorldCorners the actual corners can be found and drawn around, with that data you can extract that the actual width is 60 (150.2 - 30.2 = 120 / 2 = 60)!

Why? Is this a bug or an I missing something obvious here?

sentences:
GLM: Camera attached to model moves in opposite direction from the model I have been working on a component based engine with nested game objects each with there own transformation's. Each game object calculates its position in the world based on its parents world transformation multipled by there own local one (ModelsWorldTransform = ParentsWorldTransform * LocalTransform).

This all works great until I attach the camera component to a model and in this scenario, as the model the camera is attached to moves away from the origin, the camera moves in the opposite direction to the movement whitest still seeming like it is in the correct position according to its mat4.

All local transformations are stored in a mat4 rather then three vec3's for position, rotation and scale to save on calculations each update having to generate new mat4's.

Transformation Component Update Code

m_world_transformation = m_local_transformation;
// If we have a parent object
if (m_parent_transform_component)
    m_world_transformation = m_parent_transform_component->GetWorldTransformation() * m_world_transformation;

Camers position buffer being updated

BufferData.view = m_transformation_component->GetWorldTransformation();
m_camera_buffer->SetData();

I'm not sure what i'm missing, if anyone has any sugestions that would be apreatiated.

sentences: What model file formats are supported in XNA? What model extensions are valid in XNA? I know it supports .fbx, for example.

sentences:
Randomised Path from A to B for cursor movement simulation I'm trying to simulate the movement of the mousecursor, by creating a path from point A to B that has random variation. The algorithm I'm using at the moment is very basic, and is limited in that  it's only really good for creating a path where X and Y distance from the start are the same, forming a square:

The code looks something like this:

   function calcualtePath(from, to)
   {
      var pathNodes = [];
      while (from.x != to.x || from.y != to.y)
      {
         var newTransition = {x: from.x, y: from.y};

         if (Rand(1, 3) != 1 && newTransition.x > to.x)       newTransition.x--;
         else if (Rand(1, 3) != 1 && newTransition.x < to.x)  newTransition.x++;
         if (Rand(1, 3) != 1 && newTransition.y > to.y)       newTransition.y--;
         else if (Rand(1, 3) != 1 && newTransition.y < to.y)  newTransition.y++;

         pathNodes.push(newTransition);
         from = newTransition;
      }
      return pathNodes;
   }

I'd like some assistance in creating is a relatively fast algorithm that creates a randomised path between point A and B, that has a more curve like path and isn't limited like the one above. Ideally something a bit like this, with a pronounced curve:

sentences:
Resource/Asset Manager I'm creating a ResourceManager.
At the beginning i'm creating a groups of resources which contain a map of resources. The role of groups is to quick load/unload resources, to find some constant, never unloading resources which placing to group, for example named Static and newer trying to unload, or find resources common for 2 scenes, or batches etc, this is work of pipeline. Also resource names are hashes of string, they are all unique and its checked off-line.

After i'm adding archives, where assets is stored and load table of contents and put it into group. After i'm calling InitializeGroup where i'm creating a raw resources with out creating or loading some data, only passing to them the Location, where their data is stored.

struct Location
{
    Archive* pArchive;

    size_t m_Offset;
    size_t m_Size;
};

class ResourceManager
{
public:
    struct RacingEngineExport ResourceGroup
    {
        LocationMap m_Locations;
        ResorceMap m_ResorceMap;
        String m_Name;
    };

    void CreateGroup(const String& name);
    void AddLocation(const String& path, const Archive::Type lType, const ResourceGroupName& group, bool recursive = true);

    void InitialiseGroup(const String& name);

    void RegisterResourceHandler(ResourceHandler* pResourceHandler);;

protected:

    ResourceGroupMap            m_ResourceGroups;
};

For each Resource type like Mesh, Texture etc. i'm creating specific ResourceHandler. ResourceHandler responsible to retrieve data from archive(not load, just ask some background queue to load it) and prepare resource for future using, also it's creating and unloading them.

class ResourceHandler
{
public:
    inline ResourcePtr Get(const ResourceID& id);
    ResourcePtr Create(const ResourceName& name, const PropertyMap& properties = PropertyMap(), const bool isManual = false);
    inline void Load(ResourcePtr pResource);
    inline void Unload(ResourcePtr pResource);
    inline void Destroy(ResourcePtr pResource);
}

In Load it's retrieving Archive from Resource::Location::pArchive, loading data from disk and creating some other stuff specific for Resource type.

So when the resource needed by some one, it's calling ResourceManager, retrieving ResourcePtr and asking ResourceHandler to load it if it's not loaded, ResourceHandler somehow (async or sync) loading it and returning ready to use resource.
So now the resources ready to load.

This model not friendly to real-time adding new resources, but it's possible, but i don't need it, just it's can't be loaded again after unload automatically.

So, the question is where i have to store resources, in the main ResourceManager, in all ResourceHandler, in Groups or everywhere? Also i want to hear some recommendations how to improve my impl. or defects in it, or some better way to manage resources. May be my question is stupid but i can't get rid of thoughts that that it's not OK at all.

sentences:
Why is texturing interfering with my ID-based picking implementation? Today I came across a tutorial about color picking and I implemented it on my machine. But there is a problem: when I disable the texture and draw the object I want to pick with its picking color, it turns to black (the first colorID) and then switches to the texture which I am placing on pick.

That is the case when I enable the textures after rendering the object. When I enable texturing before rendering my object, as in:

void MenuButton::Render(double windowWidth, double windowHeight)
{
    glEnable(GL_TEXTURE_2D);
    gui_OrthogonalStart(windowWidth, windowHeight);
        TextureManager::Inst()->BindTexture(gui_TextureID);
         glBegin(GL_QUADS);
            glTexCoord2f(0.0f, 1.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 1.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY() - 25.0f);
            glTexCoord2f(1.0f, 0.0f); glVertex2f(gui_Position.GetX() + 100.0f, gui_Position.GetY());
            glTexCoord2f(0.0f, 0.0f); glVertex2f(gui_Position.GetX(), gui_Position.GetY());
         glEnd();
    gui_OrthogonalEnd();
}

Then the texture cannot be disabled and the color picking isn't working. I hope I explained it well. If the code provided in the link isn't enough tell me and I will post more.

Can this problem be solved in some way?

sentences:
Deserialize only some fields from a JSON file I'm trying to parse a very large JSON string in Unity. I do not need all the fields and I can't create a class with all the members.
It appears that all examples I have found, including the official docs, always deserialize and map every field to class members, which I cannot do for my application.
I tried creating a class that is similar to the JSON string, meaning that it has some members of the target JSON, just not all of them. But it's not working as desired: all members of my class are always undefined after deserializing.
Here's part of the string:
{
    "Robots":[{"CanReset":false,
    "CycleTime":123.875,
    "Info":null,
    "LevelInfo":null,
    "Name":"FTF_10033",
    "State":0,"
    ...
    }, ...
}

So I tried creating these classes:
[Serializable]
public class jsonData
{
    public Robot[] robots;
}

[Serializable]
public class Robot
{
    public string Name = "Unknown AGV";
}

And printing the results:
var jsonString = www.downloadHandler.text;
jsonData jsonData_ = JsonUtility.FromJson<jsonData>(jsonString);
Debug.Log("Json data: " + jsonData_);
Debug.Log("Robots: " + jsonData_.robots);

jsonData_ prints Json data: jsonData_, and jsonData_.robots prints nothing (just Robots:).
Is there any way to parse just these particular fields out of the JSON string?
I would be content with something like jsonString["robots"][0]["name"] or something.

sentences:
How can a team work together to assemble a large world map? I recently played a open world FPS game with a large and dense game world, in a single map like this.

It contains many objects, roads, rivers, trees, houses, rocks, hidden places, NPCs, etc... all carefully placed relative to each other. The game was made in two years (which is pretty fast regarding the content).

How can a team work at the same time on such a huge map?

3D models and textures can have been done separately and in parallel as I understand. The question is about how to put all this content on the map and model the map itself (lowering or raising some parts since it is a huge heightmap).

Several things solutions I have in mind:

The map could be divided into big chunks, with each person (or small team) working on a small part. Then (at the end) everything is reassembled. I seriously doubt this, because of the map topology. Or maybe the height of the map was fixed first (no more change possible after some point), then map cut in squares, then reassembled (which would work because height was not changed).
Developers created a multi user editor where it is possible to connect to a server (using LAN) then any change in editor would be directly visible and propagated to other editors connected to the same server. Something like Minecraft.

How can this be done? Has anybody worked on a similar game?

sentences:
Learning C++ for game development I want to learn C++ for game development. Does anyone know a good way to learn this?

It can be with books, tutorials, anything. I would also like to know what is a good engine to start with?

thanks you :)

sentences:
Bullet physics with OpenGL I have got some problem implementing bullet physics into my opengl game. The thing is that it doesn't want to update my translatef value continously but only at the end.
The code for bullet looks like this:

void CGL::initPhysics( void ) {
broadphase = new btDbvtBroadphase();
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
solver = new btSequentialImpulseConstraintSolver;
dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);

dynamicsWorld->setGravity(btVector3(0,-10,0));

ballShape = new btSphereShape(1);
pinShape = new btCylinderShape(btVector3(1,1,1));
pinShape->setMargin(0.04);

fallMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,10,0)));
btScalar mass = 1;
btVector3 fallInertia(0,0,0);
ballShape->calculateLocalInertia(mass,fallInertia);

btCollisionShape* groundShape = new btStaticPlaneShape(btVector3(0,1,0),1);

btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(0,groundMotionState,groundShape,btVector3(0,0,0));
btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
dynamicsWorld->addRigidBody(groundRigidBody);

btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass,fallMotionState,ballShape,fallInertia);
btRigidBody* fallRigidBody = new btRigidBody(fallRigidBodyCI);
dynamicsWorld->addRigidBody(fallRigidBody);

for (int i=0 ; i<300 ; i++) {
    dynamicsWorld->stepSimulation(1/60.f,10);

    btTransform trans;
    fallRigidBody->getMotionState()->getWorldTransform(trans);

    fallY = trans.getOrigin().getY();
}
state_list.remove( STATE_FALL_BALL );
printf("stoped\n");

}

And the drawing function which is called at the beginning looks like this:

void CGL::fallingBall( void ) {
glPushMatrix();

float colBall2[4] = { 0.0f, 0.0f, 1.0f, 1.0f };
glMaterialfv( GL_FRONT, GL_AMBIENT, colBall2);

glTranslatef(0.0f,fallY,0.0f);

printf("fallY: %f\n",fallY);

glutSolidSphere(1.0f,20,20);

glPopMatrix();

}

The thing is that it shows correct value in this function's printf but translation is called only at the beginning I mean I can only see the last state.

Can anyone help me, please?

sentences:
[2D] Finding largest possible straight lines around body I've got a 2D-map, largely consisting of rectangular tiles, but with some none-rectangular objects mixed in as well (tilted lines on corners for example).

Take this image as an example:

I now need all the largest possible (straight) lines around the two bodies inside that map. There are no additional required attributes to the lines.

In this image, I've marked the lines that I'm trying to find, each one with a different color to make sure there are no confusions:

It's important however, that the algorithm doesn't produce lines inside those two objects, as it would be a waste of resources.

Are there algorithms suited for that or will I have to research an algorithm myself?

By the way, the algorithm will run at loading-time of the game, so it doesn't need to be optimized for runtime-speed. Also, principally, an algorithm that is just able to find the lines around bodies which consist only of square or rectangular tiles would suffice as well.

sentences:
How to handle animations for a turn based deterministic game? I have a turn based combat system where all monsters act one turn, then all players, etc. The combat mechanics are completely deterministic - I can pre-calculate the outcome of a turn.

I'm interested if I should do all calculations ahead of time (monster A will be at X, monster B will be at Y), and then just play a bunch of animations based on these calculations:

(Calculate for A)
(Calculate for B)
(Animate A move to X)
(Animate B move to Y)

OR do one animation per calculation?

(Calculate for A)
(Animate A move to X)
(Calculate for B)
(Animate B move to Y)

sentences:
Quaternion understanding I have some understanding problem concerning quaternions.

In order to have my world object rotate in the correct way, I need to invert their quaternion rotation while refreshing the object world matrix.

I create the object rotation with this code:

Rotation = Quaternion.RotationMatrix(Matrix.LookAtRH(Position, Position + new Vector3(_moveDirection.X, 0, _moveDirection.Y), Vector3.Up));

and refresh the object World matrix like this:

Object.World = Matrix.RotationQuaternion(Rotation) * Matrix.Translation(Position);

This is not working; it makes the object rotate in the opposite way compared to what it should!

The is the way that makes my object rotate correctly:

Object.World = Matrix.RotationQuaternion(Quaternion.invert(Rotation)) * Matrix.Translation(Position);

Why do I have to invert the object rotation?

sentences:
Programming Paradigm for Games Which programming paradigm resembles or best suits the Game design or game engine programming?
by paradigm I mean the Imperative, Object oriented, Functional, etc. I came to know that functional programming is more modular than object oriented and is concurrent. is it??

sentences:
How to implement arcade-style spawning? In many arcade-style games with a horizontally scrolling camera, enemies spawn offscreen, either left or right, and traverse the screen in the opposite direction.

Spawning enemies is easy enough, but my question concerns the logic of getting them to spawn in an arcade-type way, just offscreen and according to the predefined patterns of the designer.

One idea I thought of was designating trigger areas in my level.  When the player enters a trigger, enemy spawn points associated  with that trigger then spawn enemies. But with a scrolling camera, sometimes as the camera scrolls, those spawn points enter the viewport and enemies spawn on screen out of nowhere.

What is a good technique to achieve arcade-style enemy spawns?

Here are two examples of the types of spawns I am thinking about:

https://youtu.be/Z7lAZExM21k?t=310 (Blazing Chrome by Joymasher)
https://youtu.be/UAOFcpOfOVs?t=362 (Nightmare Busters by Arcade Zone)

sentences:
Purpose of Displaying Loading Screen Is it necessary for a game developer (on Android, game consoles, online, or desktop) to display the loading screen to cover unfinished rendered game environments and prevent users from thinking that this game is either lagging or freezing ?

I'm thinking if the game runs seamlessly, then, I don't need to add loading screens since it appears to be too showy or takes long for making animated presentations before the game.

Or, if displaying loading screen is a general standard required for each published game, was it okay to "cheat" by displaying a fake loading screen with any certain length of time even though the game renders smoothly? I would like to know why game developers added the loading screen during when the gameplay is started.

sentences:
C++ Thread, structuring thread so Gameloop can continue I want my thread to run seperately, but I want to be able to keep executing the game loop without killing the thread scope, If I remove the join there is a crash ?

What can I do ?

My desired result is for the unit just to wait while the path is being calculated, but I don't want the game loop to pause, now while it is alot quicker, there are freezes of atleast 1 second over long distances while its stuck in the pl and hpl threads.

thread pl

thread hpl

are my seperate pathfinding threads.

path requester--- only execute path for selected unit if there is a unit requesting in the pathingrequester vector, this is stored in an abstract class.
The units waypoints get pushed onto its waypoint queue when its done.

void pathingrequester()
{
    // executes the requested paths for A* pathing
    if (AWorld.RequestingPath.empty() != true)
    {
        AWorld.RequestingPath.front();
        //cout << "Completed "<< AWorld.RequestingPath.front()->pf_Source->warpPointNO<<"to:"<< AWorld.RequestingPath.front()->UltimateDestination->warpPointNO<<endl;
        astarpathfinder(AWorld.HiFiWaypoints, AWorld.RequestingPath.front()->pf_Source->ret_posX(), AWorld.RequestingPath.front()->pf_Source->ret_posY(),
        AWorld.RequestingPath.front()->UltimateDestination->ret_posX(), AWorld.RequestingPath.front()->UltimateDestination->ret_posY(), AWorld.RequestingPath.front(), AWorld.lines, AWorld.pointsInLine, MainAB.Path);
        AWorld.RequestingPath.pop_front();
    }
}

------------------------------- program execution loop

while (ConqEngine->IsRunning())
{
    bool running = ConqEngine->IsRunning();
    // Draw the scene
    ConqEngine->DrawScene();
    updateTime = ConqEngine->Timer(); // Frame Timer

    thread pl(pathingrequester);
    thread hpl(hpa_pathin_requester);

    if (MainAB.bmenuloop)
    {
        initial_menu_loop(MainAB.loaded_men_interface, MainAB.bmenuloop, MainAB.bloadloop, MainAB.binfoloop ,textControl);
    }
    else if (MainAB.bloadloop)
    {
        preconqload(MainAB.bloadloop, MainAB.bgameloop, MainAB.startingx, MainAB.pipnumber);
    }
    else if (MainAB.binfoloop)
    {
        if (ConqEngine->AnyKeyHit())
        {
            ConqEngine->RemoveSprite(MainAB.LoadingSprite);
            MainAB.binfoloop = false;
            MainAB.bmenuloop = true;

        }
    }
    else if (MainAB.bgameloop)
    {

        thread gl(gameloop, ref(myFont), ref(myFont2), ref(textControl));
        gl.join();

    }

    hpl.join();
    pl.join();

Can anyone give me good example code how to set this up ? or a library that helps handle this?

sentences:
Fully decentralized matchmaking? Most games that I know use a master server to connect players in multiplayer. If it ever gets shut down, without third-party software or master server, the game is effectively unplayable in multiplayer, sometimes not even in LAN. Temporary shutdowns can arguably be worse than permanent, because in the latter case you will likely have a community solution soon, in the former you have to wait for an unknown amount of time.

Assuming good intentions of the game developer, how can such a game be constructed so it remains playable? Can matchmaking be made fully decentralized? Do such solutions already exist?

sentences:
How to add an icon to a script registered as a class? While learning Godot, the tutorial dictates how to add an icon to a class.
Tutorial

You may add a comma and an optional path to an image to use as an icon. You will then find your new type in the Node or Resource creation dialog.

Steps taken:

Added a 16x16 svg file to the resources named something.svg  .

Created a script with a path to that icon.

Added a node of that kind.

I don't see that icon? Not sure why.

sentences:
Can someone explain this Pulsate code to me // Pulsate the size of the selected menu entry.
double time = gametime.TotalGameTime.TotalSeconds;
float pulsate = (float)Math.Sin(time * 6) + 1;
scale = new Scale(1 + pulsate * 0.05f,1 + pulsate * 0.05f);

I grabbed it from the XNA GameState sample and just curious.

sentences: Third Person Flying Camera I am having issues creating a third-person camera for my Rogue Squadron (N64) like game. First I have posted my issue on the official Unity Answers site here. So far my ship is behaving as I want and the camera follows position correctly (XYZ), however, it doesn't rotate how I would like. My first attempt was to set the rotation of the camera to the rotation of the ship and realized that is not what I am looking for either. I have found some information on rotating around a (pivot) point but I am having trouble understanding them. For example, I have found this and this but Im not sure how they work. The end result would be something like the camera found here. Thank you for any help, I would greatly appreciate a description of what you are doing/how it works. Lastly this is done in C# in Unity. I can provide my code if needed.

sentences:
How to make local keyboard input move only the local player, not everyone in networked multiplayer? I am working on Unity Networking and following this Tanks Networking tutorial:

https://www.youtube.com/watch?v=V6wEvT6G92M

Problem is that the keyboard inputs move all the tanks in the scene. It is not detecting the local tank. And when I run the game all tanks shows the same movement but it is not giving any error. I have followed all steps in the tutorial and searched all solutions on the google. This step in Tutorial is at 11:48.

Implemented Code is:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using UnityEngine.Networking;

public class TankController : NetworkBehaviour {

// Use this for initialization

[Header("Movement Variables")]
[SerializeField] float movementSpeed = 5.0f;
[SerializeField] float turnSpeed = 45.0f;

[Header("Camera Position Variables")]
[SerializeField] float cameraDistance = 16f;
[SerializeField] float cameraHeight = 16f;

Rigidbody localRigidBody;
Transform mainCamera;
Vector3 cameraOffset;

void Start () {
    if (!isLocalPlayer)
    {
        Destroy(this);
        return;
    }
        localRigidBody = GetComponent<Rigidbody>();
        cameraOffset = new Vector3(0f, cameraHeight, -cameraDistance);
        mainCamera = Camera.main.transform;
        MoveCamera();

}

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

        float turnAmount = CrossPlatformInputManager.GetAxis("HorizontalUI");
        float moveAmount = CrossPlatformInputManager.GetAxis("VerticalUI");

        Vector3 deltaTranslation = transform.position + transform.forward * movementSpeed * moveAmount * Time.deltaTime;
        localRigidBody.MovePosition(deltaTranslation);

        Quaternion deltaRotation = Quaternion.Euler(turnSpeed * new Vector3(0, turnAmount, 0) * Time.deltaTime);
        localRigidBody.MoveRotation(localRigidBody.rotation * deltaRotation);

        MoveCamera();

}

void MoveCamera() {
        mainCamera.position = transform.position;
        mainCamera.rotation = transform.rotation;
        mainCamera.Translate(cameraOffset);
        mainCamera.LookAt(transform);

}
}

I have also checked the auto create player in the spawn info as suggested in some solutions.

sentences: How can I find out what URL my game is executing from in Flash? I want to upload my game to Kongregate and other sites, but on Kongregate I want to invoke one function and other sites I want run another function. How to check in AS3 where (I want to get host like: www.kongregate.com or www.games.com etc) my game is? Or maybe you know other, better way to make this?

sentences:
Player shooting himself when moving - Unity UNET Setting : Creating my first multiplayer game and running into an odd issue. it's a tank game where players can shoot bullets and kill each other

Problem : When the client shoots while moving, the bullet seems to spawn with a little delay which causes the the player to collide with the bullet.

  The issue seems to be that the player itself is local and the bullet
  is being spawned on the network ( which is causing the delay)

Note: The host player does not have this problem, therefore it's somehow related to networking.

How can I sync the bullet with the client player?

private void Fire(){
    // Set the fired flag so only Fire is only called once.
    m_Fired = true;
    CmdCreateBullets ();
    // Change the clip to the firing clip and play it.
    m_ShootingAudio.clip = m_FireClip;
    m_ShootingAudio.Play ();
    // Reset the launch force.  This is a precaution in case of missing button events.
    m_CurrentLaunchForce = m_MinLaunchForce;
}

[Command]
private void CmdCreateBullets()
{

    GameObject shellInstance = (GameObject)
        Instantiate (m_Shell, m_FireTransform.position, m_FireTransform.rotation) ;
    // Set the shell's velocity to the launch force in the fire position's forward direction.
    shellInstance.GetComponent<Rigidbody>().velocity = m_CurrentLaunchForce * m_FireTransform.forward;

    NetworkServer.Spawn (shellInstance);

}

sentences:
How to get drawn Image width/height on the screen with openGL ES on Android? I need to know how to get drawn image length and width.

I have this code so far where I draw Radar in left top corner with hard-coded coordinates:

int _SRC = R.drawable._item;

...

float vertices[] = {
            0f,  0f,  0.0f,
            0f,  2.0f,0.0f,
            2.0f,0f,  0.0f,
            2.0f,2.0f,0.0f
    };
...

addRadarToView(0,240);

...

public void addRadarToView(float x, float y) {
    this.x = x;
    this.y = y;
}

 ...

private void updateScreenData(float screenWidth, float screenHeight){
    // takes screen Height and Width
    this.mScreenWidth = (screenWidth > 0) ? screenWidth : 1f;
    this.mScreenHeight = screenHeight;
    wRatio = 10f/mScreenWidth;
    hRatio = mScreenHeight/10f;
}

 @Override
public void loadTextures(GL10 gl) {
    Log.e(LOG_TAG, "loadTextures");

    InputStream is;

    is = mContext.getResources().openRawResource(_SRC);

    Bitmap bitmap = BitmapFactory.decodeStream(is);

    try {
        is.close();
        is = null;
    } catch (IOException e) {
    }

    gl.glGenTextures(TEXTURE_COUNT, textures, 0);

    gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
    GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

    bitmap.recycle();

}

 protected void drawRadar(GL10 gl){
    gl.glPushMatrix();
    try {
        float transx =  (wRatio * (x));
        float transy =  (mScreenHeight*wRatio) - (wRatio * (y)) - 1/hRatio;
        // Log.e(LOG_TAG, "transx: " + transx + "; transy: " + transy + "; sprite.x: "+  sprite.x + "; sprite.y: " + sprite.y);

        gl.glTranslatef(transx, transy, 0.0f);

        //###########  draw ##############

        gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);

        gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, floatBufferArray[mFrame]);

        //update();

        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
        gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, vertices.length / 3);
        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
        gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);

        //###############################

    } catch (NullPointerException e) {
    }
    gl.glPopMatrix();
}

I used addRadarToView(0,240); to set x=0 and y= 240;

So as I see x represents left border of vertices. When 240 is y that represents bottom border. Strange.

[EDIT]

In canvas i used something like:

 int srcX = currentFrame * width;

Rect  src = new Rect(srcX, 0, srcX+width, height);
Rect  dst = new Rect(x, y, x+width, y+height);
canvas.drawBitmap(bitmap, src, dst, null);

Where width and height are:

bitmap.getWidth();
bitmap.getHeight();

Please, help me to sort it out.

Thanks,

sentences:
rotating model around own Y-axis XNA I'm have trouble with my model rotating around it's own Y-axis. The model is a person.

When I test my world, the model is loaded at a position of 0, 0, 0. When I rotate my model from there, the model rotates like normal. The problem comes AFTER I moved the model to a new position.

If I move the the model forward, left, etc, then try to rotate it on it's own Y-Axis, the model will rotate, but still around the original position in a circular manner (think of yourself swing around on a rope, but always facing outward from the center).

Does anyone know how to keep the center point of rotation updated?

sentences:
Is it a good idea to render many textures into one texture? I'm making a 2D game with OpenGL. In order to avoid changing the state machine and binding at runtime, I want to make consolidate my textures into bigger textures,

for example, taking 4 128x128 textures and making 1 big 512x512. I could then just render part of the texture rather than binding a new one.

Is this a good idea? Could my newly created texture get lost, or are there major faults in doing  this?

Thanks

sentences:
Can inflation exist in a fixed price Mmorpg world? Assumptions:

Crafting materials are infinite. Limit is player boredom.
Players can only trade through the auction house. All prices are fixed. Players cannot decide arbitrary prices.
Goods in auction house stay stored for infinite duration and cannot be withdrawn by auction creator (except if he pays 100% item price + 10% auction fee).
Sell algorithm is FIFO (First item placed by any player is first item sold).
Crafting and gathering professions have a cool-down of 10 craft points per day.

Questions / Points to talk about:

All players will be happy, fair 100% prices, scam free, no need to play stock exchange market to make a profit through crafting. New Players would have the same experience even if they arrive too late to the game.
Money never loses its value, you could store money in a bank, arrive after 10 years to the game and buy everything at the same price. In contrast in WOW, a simple copper ore was worth 10 silver at the game start and now has ended as 200 silver. That's 2000% inflation.
By having fixed prices, you guarantee that even if all players in the universe have 99999999999g in their pocket, the goods are worth the same. So that's guaranteed 0% inflation. Hackers may cry all they want, but goods prices will never change.
Why didn't WOW / Diablo III used this model? They would have become billionaires with the 10% money grab technique.

Btw: my previous question on economy overflow was never answered, probably that site is dead. https://economics.stackexchange.com/questions/14609/understanding-inflation-in-a-video-game

sentences: How to go back to the old input system? I have tried using Unity's new input system, but it's incredibly hard to learn, the documentation is poor, and the old system is much easier to work with.  I would like to revert my project back to the old system, but I am unsure how to do that.  How do i disable the package and reconfigure my project so it will accept code using the old system?

sentences:
GetUserWidgetObject returns null I have a widget component inside of my character:

// ABCharacter.h

...
UPROPERTY(VisibleAnywhere, Category = UI)
    class UWidgetComponent* HPBarWidget;
...

// ABCharacter.cpp
...

AABCharacter::AABCharacter()
{
     // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    HPBarWidget = CreateDefaultSubobject<UWidgetComponent>(TEXT("HPBARWIDGET"));
    HPBarWidget->SetupAttachment(GetMesh());
}

I checked HPBarWidget is null and it wasn't:

if (HPBarWidget == nullptr) {
    UE_LOG(ArenaBattle, Error, TEXT("NULL"));
}

HOWEVER, When I try to get the widget object, it said it's null.

if (HPBarWidget->GetUserWidgetObject() == nullptr) {
    UE_LOG(ArenaBattle, Error, TEXT("NULL"));      // it printed NULL
}

What causes this returns null? I can clearly see I have a WidgetComponent that exists in my character's tree, and HPBarWidget wasn't null too.

I struggled this already hours and couldn't find any related issues. What did I wrong?

Using 4.24.3.

sentences:
Glenn Fiedler's fixed timestep with fake threads I've implemented Glenn Fiedler's Fix Your Timestep! quite a few times in single-threaded games.

Now I'm facing a different situation: I'm trying to do this in JavaScript. I know JS is single-threaded, but I plan on using requestAnimationFrame for the rendering part.

This leaves me with two independent fake threads:  simulation and rendering. Timing in these threads is independent too: dt for simulation and render is not the same.

If I'm not mistaken, simulation should be up to Fiedler's while loop end. After the while loop, accumulator < dt so I'm left with some unspent time (accumulator) in the simulation thread.

The problem comes in the draw/interpolation phase:

const double alpha = accumulator / dt;
State state = currentState*alpha + previousState * ( 1.0 - alpha );
render( state );

In my render callback, I have the current timestamp to which I can subtract the last-simulated-in-physics-timestamp to have a dt for the current frame.

Should I just forget about this dt and draw using the physics thread's accumulator? It seems weird, since, well, I want to interpolate for the unspent time between simulation and render too, right?

Of course, I want simulation and rendering to be completely independent, but I can't get around the fact that in Glenn's implementation the renderer produces time and the simulation consumes it in discrete dt sized chunks.

A similar question was asked in Semi Fixed-timestep ported to javascript but the question doesn't really get to the point, and answers there point to removing physics from the render thread (which is what I'm trying to do) or just keeping physics in the render callback too (which is what I'm trying to avoid.)

sentences:
libGDX without android dependancies I want to create a game that due to some assumptions doesn't make sense as a tablet game.

I already created some frame (controllers, autowiring, build scripts, etc.) that would help me later on, but since Slick2D, that I currently basing it on, is no longer really supported I am considering switching to libGDX while it still not time expensive.

My question is: is it possible to easily get rid of all of Android dependencies? GUI scaffold generator doesn't allow to do that and I would like to know is it just generator's issue or is the library itself tied to Android dependencies?

It's my main concern that would help me decide whether or not switch from Slick.

EDIT:

Basically when I use GUI generator to scaffold project it creates at least 3 Eclipse projects:

core project,
Android project - depending on core,
desktop project - depending on Android.

While it shouldn't a be problem to merge them into 1 bigger project and remove virtually dead code, I want to know if there would be left some Android dependencies that I couldn't remove to make it still runnable on desktop.

sentences:
How do I create a multiplayer server also suitable for local single-player? I've created a voxel game in C++, OpenGL and SFML, and I want to make it multiplayer.

I'd like to make it similar to Minecraft's client-server model: The single-player is just a client to the hidden server underneath; but can be configured to connect to multiplayer as well so that the single player and multiplayer code are one and the same.

Spitball-ideas:

Use a separate thread for the server logic and then share the data between a synchronized point in the code for the client.
Just send packets to local host from the server thread and collect them from the client thread.

How should I do this?

sentences:
Why isn't my background drawing to the screen? Ok, So I have a game I have been working on for a few months now and I am now stumped beyond belief. My friend who has spent days working on this background gave it to me and I put it in my game. On the phone the background draws fine, on the PC the background draws fine but my tablet refuses to draw the background and I have no idea why. The game was pretty much built for tablet and I really need an answer because I want to release this to google play soon to make it worth while for the friends who put the effort into this game. Do any of you have any idea why this isn't working? The file for the background is pretty big is that the reason (2500x2500)?

Here is the code to the drawing method

    //Render Function When in Play Mode
private void renderPlayMode(){

    //Draw background
    background.render(mainBatch);

    foreground.render(mainBatch);

}

The background.render and the foreground.render are the two functions that cause the game to go black on the tablet. I really need an answer, please!

EDIT

Ok, so the code above is the code that screws up the tablet and makes the screen black. Because the foreground.render is the last thing that is drawn it makes the entire screen black and if I comment out that line the background.render just makes the entire background black and no drawing.

sentences:
Recursive dungeon maps as represented by an elastic 2d array I came up with a method for recursively generating simple dungeon maps by starting with one room and recursively connecting new adjacent rooms randomly to it.

Maps are represented as two dimensional arrays where each cell contains a value of 0-15. 0 represents no room while each direction is represented by north=1, east=2, south=4, west=8.

I wanted to start with a single non room ([[0]]) and then expand the 2d array as necessary to fit the generated map. The difficulty I face with this tree like recursion is that if the arrays have to be unshifted to add rows and columns to the left and top of the map, I have to adjust the current position of the function, what row and column it is at. This makes it so that separate branches are not aware of array index adjustments from other branches, only their child functions will know because they have the adjusted position passed to them as their row and column arguments.

Is there a way to do this? I tried storing row and column offset values outside of the recursion, but it did not work for some reason.

sentences:
Multimonitor Support in MonoGame How can I support multiple monitors in mono game ? As far as I know I can not override OnPreparingDeviceSettings and in GraphicsDeviceInformation class there is no DeviceName property in Adapter.

Thanks.

sentences:
Converted XWM(A) files get silence at the end I am writing a playback mechanism for looping background music with XAudio2 and SharpDX.

I converted some perfectly looping WAV files to XWM(A) with the xWMAEncode command line utility (from the DX SDK of June 2010), but as soon as I play back the XWM file in a looping audio buffer, I notice a significantly noticable silence before it loops over.

I found out that when filling an XAudio2 audio buffer manually with a synthesized vibrato sound, no looping bug occurs. To further support this, I decoded the XWM file back into WAV, and the WAV file had exactly the same amount of silence at the end as I noticed in the playback, which turns out to be of 0,06 seconds length:

My first question is if anyone noticed the same behavior of the xWMAEncode utility, and if it is either a bug of the utility or even of the XWMA format itself.

I'd love to know some workaround for this if it can't be fixed by the encoding of the WAV itself.

I thought of setting the LoopLength sample of the audio buffer to exactly before the silence occurs. But for that I'd need to pray that such a silence isn't dynamic depending on the sample rate. Has anyone fixed it like this before and can provide or link me to details about this?

Head-shaking corner: MP3 adds silence to the start of each file, so XWM likes to put it at the end? Do we live in times were only OGG gets stuff looping correctly?

sentences:
Unity GL.Lines going over 3D models I'm drawing lines using GL.lines but they disregard the zbuffer and always appear over my model.

I found this thread: http://answers.unity3d.com/questions/434827/gllines-over-game-objects.html

and decided to give the answers a try, but it didn't seem to fix things. For now I'm using the shader found in that thread, here is the rest of the code:

void OnPostRender() {
GL.PushMatrix();
testMaterial.SetPass(0);
GL.Begin(GL.LINES);
   for (int i = 0; i < basicMesh.linePoints.Length; i++)
   {
     GL.Color(new Color(1,1,1,1));
     GL.Vertex(basicMesh.linePoints[i].point1);
     GL.Vertex(basicMesh.linePoints[i].point2);
   }
GL.End();
GL.PopMatrix();
 }

Any advise on how to make the lines not go over my 3D models?

sentences:
Custom complex body shape with cut feature I need to create sprites (or scene2d actors or whatever) with custom shape, preferably generated from a png image (marching squares?).

I followed some Mesh tutorials but they all hardcode the triangularized-shape vertices in an array, which is completely insane.

I will later have to give my sprite a cut feature, like this game.
so I'll have to regenerate and redraw a new shape several times. Some told me to review the Drawable classes as well as Mesh, and create my own MeshDrawable that renders using meshes.

Do you have an idea of how to dynamically generate vertices and shapes instead of hardcoding coordinates?

at what level will my Mesh be responding to touch events and reacting with the user?

Any clarification will be welcome, I'm kind of lost.

sentences:
How to play sound in WebGL build in Unity? I have a project that works fine when I build for windows, but doesn't work when I switch platform to WebGL. The [SerializeField] AudioClip variables in the inspector are all 'missing', even after I check 'override for WebGL' convert to AAC. And when I try to link any audio file to an AudioClip within a WebGL build in the inspector, it doesn't seem to work.
How do I get sound to play within WebGL?
To recreate the problem:

Switch platform to WebGL.
Create a new Script in any recent unity version, then add a [SerializeField] AudioClip x.
Put that script on a new gameobject and try to link an audio asset to it (default import settings, however don't forget to check 'override for WebGL' to AAC, otherwise you will get compiler errors when you switch platform).

sentences:
Send request for Turned Based Battle I want to create a turn based battle system for Pokemon online rpg!

I will some how implement the coding of the battle..but I want to know how can a user send request for a battle to other user?

If a user wants to have a live battle with some other user, he will send a battle request!
If the opponent wants to battle he will accept it otherwise it will be rejected and no battle will take place...!

How can I implement the above??

sentences:
How to display and hide complex object part in 2.5D I am working on a 2.5D mechanical app. I use 3D software like Blender to render the 3D model to create the 2D assets for the 2D game engine (which's cocos-creator , but it doesn't matter for this case).

How can I hide a part of object which's covered by another object with in the game engine? A sort of mask or something else, I am not sure.

For it has hundreds of object in the scene, like a car engine with all parts. So the solution I am looking for need to be automatic or half-automatic generated by 3D software (eg.Blender, etc), instead of full manual work like using Photoshop to create the mask.

sentences:
Make handlers visible on scene load In my dev enviroment I have a couple custom handlers I want to always be visible.

I have already figured out that I can do this by deriving a class from Editor, linking it to the desired component type, and then appending the render method to SceneView.duringSceneGui (in OnEnable(), as the target gameobject information will be available there).

However, this appending now only happens once a specific gameobject carrying the component has been selected. Is there a way I could have the Editor's OnEnable() method properly trigger on opening a scene, for all relevant gameobjects, without manually selecting them first?

sentences:
Transparent JPanel, Canvas background in JFrame I wanna make canvas background and add some elements on top of it. For this goal I made JPanel as transparent container with setOpaque(false) and added it as first of JFrame container, then I added canvas with black background (in future I wanna set animation) to JFrame as second element.

But I can't undestand why i see grey background, not a black.
Any suggestions?

public class Game extends JFrame {
    public Container container; //Game container with components
    public Canvas backgroundLayer; //Background layer of a game
    public JPanel elementsLayer; //elements panel (top of backgroundLayer), holds different elements

    private Dimension startGameDimension = new Dimension(800,600); //start game dimension

    public Game() {
        //init main window
        super("Astra LaserForces");
        setSize(startGameDimension);
        setBackground(Color.CYAN);
        container=getContentPane();
        container.setLayout(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //init jpanel elements layer
        elementsLayer=new JPanel();
        elementsLayer.setSize(startGameDimension);
        elementsLayer.setBackground(Color.BLUE);
        elementsLayer.setOpaque(false);
        container.add(elementsLayer);

        //init canvas background layer
        backgroundLayer = new Canvas();
        backgroundLayer.setSize(startGameDimension);
        backgroundLayer.setBackground(Color.BLACK); //set default black color
        container.add(backgroundLayer);

    }

    //start game
    public void start() {
        setVisible(true);

    }

    //create new instance of game and start it
    public static void main(String[] args) {
        new Game().start();
    }
}

sentences:
How can I achieve a constant drop rate with a variable frame rate? In my game, I have particles that should spawn at random intervals but with an average rate of x per second.

However, the frame-rate varies from around 60 fps all the way to around 3000 fps. I would like to maintain a variable frame-rate to ensure the game looks as smooth as possible, but this means I cannot simply create particles with probability x each frame:

if (random.Next(100) > x)
{
    // Create particle...
}

How can I maintain a constant "real time" drop-rate when the frame rate fluctuates?

Note that I have a variable dt which is the number of seconds since the last frame.

sentences:
How to highlight non-rectangular hotspots? So my question is highly related to Creating non-rectangular hotspots and detecting clicks.

Yet again, I've irregular hot-spots (think the game Risk). So basically, we can detect clicks on these hot-spots easily using color key mapping as discussed in above question which I don't have any problems implementing (which is also covered here in details).

The problem is about highlighting these irreguar hotspots. So let me explain the question a bit more - the above color key mapping guide uses this as a world map:

Then the author color-maps the imaginary countries:

Now we can now detect the country the pointer is over. In the same article author mentions outlining countries on mouse-over. Though to get the effect, he creates unique border assets for each country - like:

For the game I'm working on I'm using the same color-key mapping idea to detect hot-spots, but I didn't like the way of highlighting hot-spots. Coloring all the hot-spots is already a time-consuming job for me - as I have 25+ hot-spots for each map. Further, the need to have 25 unique border/highlight asset per hot-spot doesn't sound right.

Anyone have a better idea/suggestion on highlighting these hot-spots?

sentences:
Is A* suitable for this particular case? I have a 2D map of nodes a train could travel. They are not in a grid. The node positions are placed by a designer and exported to a JSON file which the game loads to display the node positions on the map texture/sprite.

I'm tying to implement pathfinding for the train. The user can select a node and set a waypoint to that node. The game should find the shortest path and take that (avoiding locked nodes).

The way the nodes are set up right now is that each node has other neighbour nodes. There's the condept of a 'link' which connects two nodes. Nodes do not store any neighbour information in them, instead they're stored in the links which are stored separately (a list of links, each link contain two integers representing the linked nodes' ids)

The train has no restriction on its movement it could move from A->B or B->A, only restriction is that it doesn't move to the previous node it came from. So going from A->B, when asking B of its neighbours, we exclude A and look at the other neighbours.

I hope that's enough context to answer my question: Is A* applicable to me? If so, I'm not really sure how to write a function to generate weights/costs on nodes. I just can't seem to answer the question of: What's the total distance between A->B in order to assign costs/distances? Because there could be more than one path to go from A->B, which requires path-finding in itself (see the infinite loop in my logic?). If A* is not the best here, what is?

[EDIT] Replying to Matt's answer. I thought of using distances to calculate the weights/costs but take this example for instance:

Where's at 'P' trying to go to 'T'. Edge/link 'A' is shorter than 'E' but if we take the 'A' route it would be longer in the long run. I would have to travel both the paths to determine which distance is shorter, otherwise how do I know? am I missing/misunderstanding something here?

Another question is, how do I track paths/links/nodes that I shouldn't visit anymore? I can't just mark a node as 'visited' once I visit it the first time because there could be a branch in there and I have to visit it twice to know which one is shorter, correct?

[EDIT] I guess in the first case^, it would be benefecial to also do the pathfinding backwards from 'T' to 'P' then pick which ever is the shortest between going P->T and T->A?

sentences:
C++ Instantiating objects as function arguments / parameters (base and derived classes) I've noticed with some functions in C++ that accept objects (e.g. constructors), you can actually create the object within the function argument e.g. (this example uses an SDL_Point as the main parameter)

//Constructor for custom object
object::object(SDL_Point spawn_location);

//Declaration of new object
SDL_Point new_point {0, 0};
object new_object(new_point);

//Alternatively, this also works
object new_object(SDL_Point{0, 0});

My question is, is this also possible with derived classes? My thinking behind this is that I have a single base class with a large number of derived (and derived derived etc) classes that I'd like to instantiate using a single function (to set various variables and add to a common vector). Current this looks like this:

void create_new_object(base_class object_to_create)
{
//Do new object stuff
}

This works:

my_derived_class new_object;
create_new_object(new_object);

However, I get an error (expected primary-expression before new_object) with this:

create_new_object(object new_object);

Is this strictly a base / derived class issue, a difference between functions and constructors, or is there something more I need to do to allow the function to accept the instantiation of objects within its parameters?

Thanks

Nathan

sentences:
Emulate border color texture address mode efficiently In WinRT the border color texture address mode is not supported.

The best I came up with in emulating the border address mode, is doing this in my pixel shader:

float4 tcol = tex.Sample(texSampler, texCoord);

if(texCoord.x < 0 || texCoord.y < 0 || texCoord.x > 1 || texCoord.y > 1)
  tcol = borderColor;

But as only ps_4_0_level_9_1 is supported as minimum requirement in WinRT, this conditional in the pixel shader is quite inefficient.

How would I emulate border texture addressing mode efficiently?

sentences:
What is the best way to store meshes or 3d models in a class I am wondering, how I should store my mesh into memory after loading it from whatever file. I have Questions floating in my head:

Should a mesh could have sub meshes or does the 3d model just store a list of meshes all on the same level
Is there one material assigned to one mesh 1:1?
What do I have to consider, if I want to store skeletal animations?

Btw it's a OpenGL|ES2 iOS game using GLKit.

I came up with some basic struct types:
(But I think they are way to simple and I need to add padding or change the vector3 to vector4.)

typedef union _N3DShortVector2 {
    struct { short x, y; };
    struct { short s, t; };
    short v[2];
} N3DShortVector2;

typedef union _N3DShortVector3 {
    struct { short x, y, z; };
    struct { short r, g, b; };
    struct { short s, t, p; };
    short v[3];
} N3DShortVector3;

typedef GLKVector3 N3DFloatVector3;

typedef struct _N3DMeshRecordSV3 {
    N3DShortVector3 v1, v2, v3;
} N3DMeshRecordSV3;

typedef struct _N3DMeshRecordSV3FN3ST2 {
    N3DShortVector3 v1, v2, v3;
    N3DFloatVector3 n1, n2, n3;
    N3DShortVector2 t1, t2, t3;
} N3DMeshRecordSV3FN3ST2;

sentences:
Procedural dungeon algorithms for a more open dungeon I'm working on a game that I want dungeon generating in, but I plan on having ranged weapons in it, so I want it a bit more open. I'd like to avoid corridors and I don't want to use a grid of custom rooms.

I don't want to use perlin noise and make it like random blotches, so that's not an option.

All I need is a summary of how the ideal algorithm for this works.

EDIT: Something that gives a result like this:

It doesn't need to be so rounded. The point is that there aren't really corridors.

I'm also fine with a modular approach where the areas are hand made as long as it's still not on a grid. The issue is that if it's not on a grid, the areas are normally connected by corridors.

EDIT2:
I made this a while ago, which works when it comes to shape, but it works with a modular system and it looks like this because I intentionally put rooms on top of other rooms. This causes problems if I start decorating the rooms and filling them with interesting stuff.

sentences:
Collision detection with multiple polygons simultaneously I've written a collision system which detects/resolves collisions between a rectangular player and a convex polygon world using the Separating Axis Theorem. This scheme works fine when the player is colliding with a single polygon, but when I try to create a level made up of combinations of these shapes, the player gets "stuck" between shapes when trying to move from one polygon to the other.

The reason for this seems to be that collisions are detected after the player has been pushed through the shape by its movement or gravity. When the system resolves the collision, it resolves them in an order that doesn't make sense (for example, when the player is moving from one flat rectangle to another, gravity pushes them below the ground, but the collision with the left hand side of the second block is resolved before the collision with the top of the block, meaning the player is pushed back left before being pushed back up).

Other similar posts have resolved this problem by having a strict rule on which axes to resolve first. For example, always resolve the collision on the y axis, then if the object is still colliding with things, resolve on the x axis. This solution only works in the case of a completely axis oriented box world, and doesn't solve the problem if the player is stuck moving along a series of angled shapes or sliding down a wall.

Does any one have any ideas of how I could alter my collision system to prevent these situations from happening?

sentences:
Can I create an offscreen plain surface with a pointer to pre-allocated surface data? I thought I read somewhere that one could create a 'offscreen plain surface' from an existing system memory buffer, but I cannot seem to find the reference anymore.

My use case is copying a frame from video memory to a pre-allocated buffer, and right now I perform this in two steps: copying to an 'offscreen plain surface' (GetRenderTargetData), and from that to a pre-allocated buffer.  If I could create the surface from the pre-allocated buffer, it would save a copy. I am using Direct3D9Ex on Windows 7.

sentences:
How does Hierarchical Pathfinding deal with obstructions in the same chunk? Aigamedev.com provides this visualization of HPA*:

All the nodes within the same chunk connect to each other. What if there was an obstruction between nodes in the same chunk? For example:

What would the resulting visualization look like with an obstruction in the center bottom left chunk? How would this be detected?

sentences:
Unity - Global illumination seems no longer applied to static objects on runtime First of all I'm newbie with Unity, so please forgive me if the answer of this question is obvious for any experimented developer.

So, in one of my project I have this result while I run the project in the editor:

However, on runtime I get this result:

As you can see, several objects in the scene are no longer lighted. In fact, I noticed that ALL my static objects lost their illumination on runtime. I tried with Windows and WebGL as targets, same result.

As I'm hobbyist, I may provide any info about the project configuration. Better, I can provide the Git link of my project:
https://github.com/Jeanmilost/Unity/tree/master/Survival%20Demo%20Scene

This is a demo project, but in the future I'm interested to create more serious projects, and thus I need to understand why this issue happen. So if someone can point me what I'm doing wrong, I would be very grateful, because I already spent some hours to search the solution, without success.

sentences:
What does mean the float value in a voxel data? We know that a voxel can be represented by a three dimensional array of boolean or float values. There is an answer that demonstrates this perfectly: the difference between binary/boolean or floating-point voxel.

If we use the binary way, we probably use a byte[,,], so we have 256 slots. They can be used to represent the content. For example, 0 can be air, 1 grass, 2 stone, 3 water.

By this way, we can define what is solid or not and which colour where.

But what about the floating-point way? So my question: What does the float value mean in a floating-point voxel context? Is there a way to use it as the binary way to describe the content and keep the terrain smooth?.

What I've experimented & What I get it?

I've tried to build a mesh with Marching Cube, filled with "random" 3d fractal from Perlin Noise. The result looks very good, but now how I am supposed to define what is what? (Air, Stone, ...)

I am pretty sure the solution was already answered in this answer. Unfortunately, even if I read the answer 5-6 times, I don't get it.

I understand there is a threshold which defines what is solid or not.

Giving me 3 for-loop pseudo code to fill with floating-point the three dimensional array would probably be helpful.

sentences:
Is it worth having AI opponents step in for disconnected players in an online multiplayer card game I have an online multiplayer card game resembling spades/bridge and I want to implement a system that autoplays when a client disconnects. Right now, there is a client and server. In the new system, there will be an autoplay server sitting between the client and the actual game server.

The client connects to the autoplay server which in turn connects to the game server. If the client disconnects during a match, the autoplay server is activated.

Both servers will reside on the same machine so communication cost should be minimal. Processing cost should be minimal as well as the autoplay will be programmed with limited skills only to keep the match going till the end. The idea is not to break the game flow once a player disconnects. But, I don't see autoplay systems in popular commercial games such as Zynga poker (maybe in this case because a disconnection can be easily be considered as a Check or Fold.) Well, is it really worth it to have an extra layer for autoplay?

Edit: Are there other drawbacks for having an extra layer for autoplay?

sentences:
Is there any difference between storing textures and baked lighting for environment meshes? I assume that when texturing environments, one or several textures will be used, and the UVs of the environment geometry will likely overlap on these textures, so that e.g. a tiling brick texture can be used by many parts of the environment, rather than UV unwrapping the entire thing, and having several areas of the texture be identical. If my assumption is wrong, please let me know!

Now, when thinking about baking lighting, clearly this can't be done the same way - lighting in general will be unique to every face so the environment must be UV unwrapped without overlap, and lighting must be baked onto unique areas of one or several textures, to give each surface its own texture space to store its lighting.

My questions are:

Have I got this wrong? If so, how?
Isn't baking lighting going to use a lot of texture space?
Will the geometry need two UV sets, one used for the colour/normal texture and one for the lighting texture?
Anything else you'd like to add? :)

sentences:
Faster way to load VBOs in LWJGL I'm currently working on a Minecraft clone for a university project and I'm having some trouble loading a lot of chunks at the same time without reducing performances.
What I'm currently doing is:

Creating the VAO
Creating the VBOs
Buffering the data in the VBOs
Rendering them (that isn't causing any lag)
Destroying the VAO and VBOs when the chunk is no longer needed

I tried to look at other solved questions but they were too specific or too vague, or maybe I'm just dumb.
The chunks are made of 16x16x16 blocks and its VBOs contain only the vertices of the visible blocks (like Minecraft's doing).
I'm looking for a better way(in terms of speed and performance) to load them.

sentences:
OpenGL ES 2.0: Repository of Quality Shaders Could I kindly ask, to suggest me a repository of high quality OpenGL (OpenGL ES 2.0) vertex and fragment shaders, please?

I am looking for pixel based ligting shaders (such as phong) and simmilar. It would be nice to see more of them, to be able to choose between quality vs shader performance.

sentences:
Creating Smooth Animations Possible Duplicate:
  What’s the best way to create animations when doing Android development?
  What animation technique is used in ‘Dont Starve’?

I've always admired Zeptolab for their smooth in game animations. Zeptolab has created both Cut the Rope and now Pudding Monsters.

I'm wonder how you're able to get animations this smooth? Are these sprite sheets? Are they actual 3D models?

Here's a video of their latest game:
http://www.youtube.com/watch?v=rV1dlN-dbJQ

If you get to the game play you'll see how the guys are constantly wiggling and it's so smooth. You also saw this in the monster guy in Cut the Rope.

I'm just wanting some insight into how this is done. Like what tools they may be using.

Thanks

sentences: Feasibility of nested voxels Out of curiosity, does anyone know how feasible it would be to have a voxel engine that allowed for voxels within other voxels? For example, you would have the usual chunks filled with voxels, but instead of stopping there each voxel could become a chunk of it's own to store more, smaller voxels. The first use case that comes to mind would be for showing damage to voxels, but there could be others, such as smoother terrain. Thoughts?

sentences:
How Do I Play An Animation In Unity 5.3.4? I am confused on how to play an animation with the new unity version because the flag "Automatically Play Animation" is gone.  I cant have the animation connected to my GameObject because it plays right away.

using UnityEngine;
using System.Collections;

public class FPSCamera : MonoBehaviour {

    public float lookSensitivity = 5;
    private float xRotation;
    private float yRotation;
    private float currentRotationX;
    private AnimationClip walking;

    void Start() {
        // DONT KNOW HOW TO FIND AND START WALKING ANIMATION CLIP
    }
    void Update() {
        yRotation += Input.GetAxis("Mouse X") * lookSensitivity;
        xRotation -= Input.GetAxis("Mouse Y") * lookSensitivity;
        xRotation = Mathf.Clamp(xRotation, -90, 90);
        transform.rotation = Quaternion.Euler(xRotation, yRotation, 0);
    }
}

sentences:
UDK: Animating characters with weapons I imported a custom character and a pistol model to UDK and both work, but the pistol doesn't appear with the animation of the pistol when I shoot or reload... Also, the character doesn't change its animation from its normal posture to the posture animation holding a pistol.

How can I set the character to change the character's animations to animate correctly when holding a weapon? Can I do this in Unreal Kismet or do I need code?

I don't know UnrealScript well; only C++. :/

PS: On AnimSet, the character's posture is correct with a pistol, walking, firing, reloading, everything.

sentences:
Why does invoking glm::refract function return NaN? At the present time, I make a simple raytracing project and I encounter an issue : When I invoking the glm::refract function, it returns me a vec3 with "NaN" values. However, my input data seems to be correct (2 normalized vec3 and my refractive-index is 1.0). Have you got an idea of the problem ? This function is not so well documented.

EDIT :

Very strange, if my refractive index is 1.0f it's working well actually :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.0f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

However, if I invoke the function and passing a refractive index of 1.10000002f for example (my program seems to approximate values and I don't know why...), it doesn't work => returns vec3 with "NaN" values. Like below :

glm::vec3 view = glm::vec3(0.191318035, -0.0721754059, 0.978870869);
glm::vec3 normal = glm::vec3(-0.151046738, -0.988510013, -0.00574064208);
float refractIndex = 1.10000002f;
glm::vec3 output = glm::refract(view, normal, refractIndex);

EDIT 2 :

More weird : If I try with a refractive-index of 1.1f it doesn't work. Same error.

sentences:
iPhone Game - Sprites I have made games with cocos2d for the iphone however I am looking to move on from that, is there a good direction you could suggest? If not I was planning on using what the SDK gives me, and so for example to make a sprite, say the player on screen, rather than a CCSprite, what would be best to use? What do I need to go and learn?

Thanks.

sentences:
How to set up node data for Pathfinding algorithm in 2D platformer? I've been doing a lot of research into the A* pathfinding algorithm and I'm trying to incorporate it into my program. This is not a game that I created so I have no control over the frames. However, I am reading the necessary information from memory and think I can create coordinate based way points based on the game physics. Currently, I am grabbing all the platforms which are walkable and storing them inside their own doubly linked node based on if they are connected with their vertices. However, I am not sure where to go from here. What other information should I be storing inside of these nodes and how should I be connected one node list to another?

struct Platforms{
    LONG x1;
    LONG y1;
    LONG x2;
    LONG y2;
    struct Platforms *prev;
    struct Platforms *next;
};
std::vector<Platforms*>P;
void GetPlatforms(){
    int platformCount = (int)ReadPointer(CWvsPhysicalSpace2DBase,OFS_PlatformCount);
    LONG rightWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_RightWall);
    LONG leftWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_LeftWall);
    LONG downWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_DownWall);
    LONG upWall = ReadPointerSigned(CWvsPhysicalSpace2DBase, OFS_UpWall);
    //add_log("Platform Count: %d", platformCount);
    for(int i=0; i<platformCount-1; i++){
        LONG x1, y1, x2, y2;
        x1 = GetValue(platStruct, OFS_PlatformLeft);
        y1 = GetValue(platStruct, OFS_PlatformTop);
        x2 = GetValue(platStruct, OFS_PlatformRight);
        y2 = GetValue(platStruct, OFS_PlatformBottom);
        if((x2)-(x1) > 0){ //Make sure the platform is traversable
            //add_log("\n\nPlatform: %d X1: %d Y1: %d X2: %d Y2: %d", i+1, x1, y1, x2, y2);
            if(P.size() > 0){
                bool newHead = true;
                for(std::vector<Platforms*>::size_type i = 0; i != P.size(); i++) {
                    Platforms *curr = P[i];
                    while(curr != NULL){
                        if(curr->x1 == x2 && curr->y1 == y2){//curr->y1 - y2 > -50 && curr->y1 - y2 < 50){ //To account for slope
                            insert_front(&curr, x1, x2, y1, y2);
                            newHead = false;
                            //add_log("front segment found: X1: %d Y1: %d X2: %d Y2: %d", curr->x1, curr->y1, curr->x2, curr->y2);
                            break;
                        } else if(curr->x2 == x1 && curr->y2 == y1){
                            insert_After(curr, x1, x2, y1, y2);
                            newHead = false;
                            //add_log("connected segment found: X1: %d Y1: %d X2: %d Y2: %d", curr->x1, curr->y1, curr->x2, curr->y2);
                            break;
                        }
                        curr = curr->next;
                    }
                }
                if(newHead == true){
                    struct Platforms* head = NULL;
                    insert_end(&head, x1, x2, y1, y2);
                    P.push_back(head);
                }
            }else{
                struct Platforms* head = NULL;
                insert_end(&head, x1, x2, y1, y2);
                P.push_back(head);
            }
        }
    }
}

sentences:
Does it make sense to use both TCP and UDP at once? After reading Is UDP still better than TCP for data-heavy realtime games?, I'm wondering if it makes sense to use both TCP and UDP at the same time, but for different things:

TCP for sending information that is sent infrequently, but should be guaranteed to arrive reliably.
Such as score updates, a player's name, or even the on/off state of a light in the game world.
UDP for transmitting information that is updated constantly and can be lost occasionally, since newer information is always on the way.
Such as position, rotation, etc.

Is this a reasonable idea?
What are the possible drawbacks?
Are there better ways to handle this?

sentences:
Need help with simple octree implementation Hello I'm trying to implement an octree, but when I query the centre positions they all return zero, but these should be offset from zero. Here is my code:

class Octree:

def __init__( self, _centre, _size ):
    '''
    Class to create an Octree

    @param: _centre: [float,float,float], position in world space for centre of octree
    @param: _size: float, length of one edge of the first cube, should be big enough to fit all data
    '''

    self.centre = _centre
    self.size = _size
    self.octreeNodes = []

def subdivideOctree( self, _subdivisions ):
    '''
    subdivides octree

    @param: _subdivisions: int, number of times to subdivide octree
    '''

    for i in range(8):
        newCentre = self.centre

        if ((i&2) == 2):
                newCentre[0] += self.size * 0.25
        else:
                newCentre[0] -= self.size * 0.25

        if ((i&4) == 4):
                newCentre[1] += self.size * 0.25
        else:
                newCentre[1] -= self.size * 0.25

        if ((i&1) == 1):
                newCentre[2] += self.size * 0.25
        else:
                newCentre[2] -= self.size * 0.25

        print newCentre

        self.octreeNodes.append(Octree( newCentre, self.size * 0.5 ))

        if( _subdivisions > 0 ):
                self.octreeNodes[i].subdivideOctree( _subdivisions - 1 )

def isLeaf( self ):
    return self.octreeNodes == None

def getCentre( self ):
    return self.centre

def getSize( self ):
    return self.size

a = Octree([0,0,0], 2.0)
a.subdivideOctree(2)

print a.getCentre()
print a.octreeNodes[0].getCentre()
print a.octreeNodes[0]

for n in a.octreeNodes:
    for b in n.octreeNodes:
        print b.getCentre()

sentences:
fbx material show correctly in unity but import to maya show wrong material see my gif, fbx material work well in unity preview, but when import it in maya, face material show wrong

here is my fbx

I use unitychan material in this unity asset

in unity

in maya

the strange thing is in maya I use eye image material but show pure color material

sentences:
Is there a book describing how old-school 2D games were programmed? This fellow over on Stack Overflow has many questions on how 8/16-bit era games were programmed. I'd like to point him at a basic primer on how game loops worked, static entity arrays and rendering loops and the like; but I don't know of any such book. (And it's been so long since I was there that I've totally forgotten how I learned in the first place.)

Is there any book describing how those old cartridge games were built; or in general any single resource I can point people at for native game programming basics?

sentences:
How do I select my platform and move them in a specific place in gameplay? I saw this game called TaniNani and I was amazed by the concept of the game and I would like to try to replicate it!

My goal is to let the player hover on the available grid (somehow like hovering on an inventory) and when the player finds its desire the player will select the platform and when it is selected it could move in a specific location inside the box only! How do I code this using C# in Unity2D?

The example I want to achieve!

MEANING OF THE COLORS

Red -- The platform

Light Blue -- Where the platform can be moved either from left/up/right

Purple -- The platform can be switched by another platform

sentences:
Character Movement and Collision with Ragdoll Rigidbodies/Colliders? I have a player character that I'm moving with a character controller script and it is moved by applying velocity to a Ridigbody.

This works when I have a rigidbody component on the player but my character also has ragdoll colliders and rigidbodies on each body parts (set up with Untiy's ragdoll wizard).

What I'd like to do is remove the ridigbody and collider that are on the player and use the ragdoll colliders and rigidbodies instead for physics movement and collision.

But it's not working! When I use the rigidbody from the skeleton Root and try to apply velocity the character won't move (animation plays but she keeps running on the same spot). What do I need to do to get this working?

Another issue is that if I leave the player rigidbody on but remove the large capsule collider I can move the character but collision doesn't work and she runs through static objects. I already tried with convex set to true on static meshes but it doesn't make a difference.

Does somebody know what causes movement and collision not to work with the ragdoll rigidbodies and colliders?

sentences:
How to place grass on custom terrain mesh I made a custom terrain mesh and textured it, now I want to place grass on it, but I don't know how. I only find info about grass with the unity terrain.
I am not even sure what exactly to look for.

What is the best/easiest way to place grass on a terrain?
I'd like to do it in the shader if possible, but I guess I will need additional geometry if I want it to "stick out"?

(Random example picture
http://www.beamng.com/attachments/stuff-png.16516/)

I'd appreciate a general outline on how to tackle this problem and maybe some links for further reading.

Thanks.

sentences:
Cant import Sun openGL I've been working with JOGL and I've ran into a problem. The problem is when I try to import import com.sun.opengl.*; on Eclipse, Eclipse doesn't recognize it. Does anyone know where this library is? Did I miss a step during installation? I'm working with the latest build.

Here are the included libraries:

gluegen-rt-natives-windows-i586.jar - JOGL/lib
gluegen-rt - JOGL/lib
gluegen.jar - JOGL/lib
jogl-all-natives-windows-i586.jar - JOGL/lib
jogl-all.jar - JOGL/lib

This is within my JOGL project folder:

gluegen-rt.dll

sentences:
Why are MVC & TDD not employed more in game architecture? I will preface this by saying I haven't looked a huge amount of game source, nor built much in the way of games.
But coming from trying to employ 'enterprise' coding practices in web apps, looking at game source code seriously hurts my head:
"What is this view logic doing in with business logic? this needs refactoring... so does this, refactor, refactorrr"
This worries me as I'm about to start a game project, and I'm not sure whether trying to mvc/tdd the dev process is going to hinder us or help us, as I don't see many game examples that use this or much push for better architectural practices it in the community.
The following is an extract from a great article on prototyping games, though to me it seemed exactly the attitude many game devs seem to use when writing production game code:

Mistake #4: Building a system, not a game
...if you
ever find yourself working on
something that isn’t directly moving
your forward, stop right there. As
programmers, we have a tendency to try
to generalize our code, and make it
elegant and be able to handle every
situation. We find that an itch
terribly hard not scratch, but we need
to learn how. It took me many years to
realize that it’s not about the code,
it’s about the game you ship in the
end.
Don’t write an elegant game component
system, skip the editor completely and
hardwire the state in code, avoid the
data-driven, self-parsing, XML
craziness, and just code the damned
thing.
... Just get stuff on the screen as
quickly as you can.
And don’t ever, ever, use the argument
“if we take some extra time and do
this the right way, we can reuse it in
the game”. EVER.

is it because games are (mostly) visually oriented so it makes sense that the code will be weighted heavily in the view, thus any benefits from moving stuff out to models/controllers, is fairly minimal, so why bother?
I've heard the argument that MVC introduces a performance overhead, but this seems to me to be a premature optimisation, and that there'd more important performance issues to tackle before you worry about MVC overheads (eg render pipeline, AI algorithms, datastructure traversal, etc).
Same thing regarding TDD. It's not often I see games employing test cases, but perhaps this is due to the design issues above (mixed view/business) and the fact that it's difficult to test visual components, or components that rely on probablistic results (eg operate within physics simulations).
Perhaps I'm just looking at the wrong source code, but why do we not see more of these 'enterprise' practices employed in game design? Are games really so different in their requirements, or is a people/culture issue (ie game devs come from a different background and thus have different coding habits)?

sentences:
Markup format or script for data files? Possible Duplicate:
  How to choose how to store data?

The game I'm designing will be mainly written in a high level scripting language (leaning towards either Lua or Squirrel) with a C++ core.  In addition to scripts I'm also going to need different data files.  Many data files will be for static information such as graphical assets and monster types.  I'd also want to create and update data files at runtime for user information like option settings and game saves.

Can I get away with using plain script files (i.e. .lua or .nut files) for my data files, or is it better to use dedicated markup formats like XML or YAML?

If I use script files, loaded separately from my true scripts, then I wouldn't need an extra library to read those files.  Scripting languages like Lua also have table syntax that lend themselves towards data definition.  On the other hand I'd have to write my own schema check code.  These languages also don't seem to support serialization "out of the box" like the markup format libraries do.

sentences:
Unity Hub 2.4.2 does not open a login window I just installed Unity Hub 2.4.2 on my MacBook Pro 2015 running macOS Big Sur. However, when attempting to open a login window from the hub, it opens briefly and then quits. (The hub remains open, but the login window closes.)
I've already tried:

Quitting and reopening the hub
Uninstalling and reinstalling the hub

Are there any suggestions on how to fix this? Does anybody have the same problem?

sentences:
Balance an RTS to make a unit twice as good I am modifying an RTS game (Rise of Nations) and want to make a unit twice as good and expensive as it's previous version so the balance is unaffected.

When I try to do it, I assumed that if I doubled the attack and health it would live twice as long and deal twice as much damage per second giving a total of four times as much damage so instead went for 1.4 times of each.

When I tested this however the modified version could defeat two of the original with little trouble.

I assumed after the first original is killed the damage would be halved. How can I calculate this correctly?

sentences:
How to calculate random new position base on original position on map I am making a 2D game with HTML5 Canvas. The game has several shapes and I want them to move all over the map randomly.

  However, if I just give them a constant angle to follow, they will
  all end up in a corner after a certain amount of time.
  Also, I am building this game with client-server so I don't want to
  send a lot of data. For example, I don't want to constantly update
  the angle on the server side and send it to the client.

That's why I want to generate a random position base on the shape's position on the big map.

For example, it's angle of movement will be tangent of it's (x,y). (It obviously won't work because it will get stuck on the sides of the map).

So what's a good way of generating the new coordinates base on it's current one?

sentences:
How to reduce the size occupied by my video animations? I have a mobile game but my build size is currently 4gb. Furthermore, it crashes on open and I suspect it has something to do with the huge build size.

In my project are 10 animations made of a series of images, each one using around 250-300 images. Each one is quite large as the animation takes up most of the screen so they are high resolution. What can I do to reduce the build size?

I have tried converting it into a video file and using the raw image component to display it as a movie texture, however, it seems unity doesn't support videos with alpha channels, and the alpha channel is critical to my animation.

I thought about combining them into a single image, but lets be real, if each image is more than 1080p, then combining 250 - 300 images into a single file will be massive.

So what can I do to reduce the size of the animations?

sentences:
unable to see sprite in scene Getting error as floating point precision limitation I am trying to create game object by dragging image from project window to scene I am getting error as due to floating point precision limitation- it is recommended to bring the world coordinates of game object within smaller range
I am following ruby's adventure tutorial in unity learning

sentences:
Unity Mathf.Atan2 algorithm complexity using Unity5.5.1f;
using C#;

So I have a circle (2D) divided equally by 16 directions, and I also have a direction V which is different from the other 16.

In order to know which direction is the closest I thought of two apporaches:

Dot product between V and all the other directions and choose the max one
Store atan for all the 16th directions then compute atan for V and see which angle is the closest to V's

My questions are,does anyone know what is the complexity of Mathf.Atan2? Or of an Atan2 algorithm in general? I read it gets worse and worse as the angle becomes bigger, is it true?

sentences:
why won't my character move I am using game maker because I am new to game development and I think it's the easiest to understand because I took a course on it but I put in all the events so that my playerobj moves when you press the A and D keys but when I load up the game it doesn't work here is the GML code below that I am using:

//Speed of player: 5 Pixels per frame
 playerSpeed = 5;

 //Shortcuts for keypresses
 MOVELEFT = keyboard_check(ord('A'));
 MOVERIGHT = keyboard_check(ord('D'));
 MOVEUP = keyboard_check(ord('W'));
 MOVEDOWN = keyboard_check(ord('S'));

 //Move Player
 if (MOVELEFT && x > sprite_width/2)
 {
x -= playerSpeed;
 }

 if (MOVERIGHT && x < room_width - sprite_width/2)
 {
x += playerSpeed;
 }

 if (MOVEUP && y > room_height/2)
 {
y -= playerSpeed;
 }

 if (MOVEDOWN && y < room_height - sprite_width/2)
 {
y += playerSpeed;
 }

sentences: How to make OpenGL rendering resolution independent from its window context resolution? Can the rendering resolution of OpenGL and the window size (at least for the Windows OS) be separated? For example, I may only want to render at 400x300 resolution, but I want my window size to be 800x600. If so, how is this done?

sentences:
Mapping 3D object coordinates to 2D screen coordinates with perspective projection Sort of following on from where this person was in their topic:
Matrix for 2D perspective

What I have at the moment is a transformation matrix that's defined as follows:
http://pastebin.com/GM6BhP0R
-- The field projMat is just a 4x4 matrix.

I have an array of 3D points that I'm trying to map to the canvas and I'm doing that by first multiplying each vertex (3D point) by a view matrix, which I've just set to the identity matrix for the time being, although if I can get this set up that will be responsible for creating a camera with I suppose.

Lastly I take this newly transformed 3D point and I multiply it by the projection matrix as defined in the code sample above. I was hoping that this would give me the screen coordinates for the points, however there appears to be no depth to the points (e.g. points with a higher Z coordinate should start to taper in, while closer points shouldn't), so objects further away from the camera appear smaller.
As I said though, after the transformations it appears to render the points in the same position irrespective of its Z coordinate. Here's how I'm rendering the points (in Java just in case you want to know):

for(int i = 0; i < vertices.length; i++) {
    Vector3f transPos = Matrix4f.multiply(projMat, Matrix4f.multiply(viewMat, vertices[i]));
    screen.drawPoint((int) transPos.getX(), (int) transPos.getY(), 0xffffffff);
}

As you can see here the inner multiplication just multiplies the vextex (point) with the view matrix, which is set to the identity, then the 3D vector that's produced by that is then multiplied by the projection matrix, which should set it to a perspective view.

If you can see where I've gone wrong I'd appreciate any help.

sentences:
Attempting to have a group of units create random values independently in python 3 for a salvage loot system I am working on creating a salvage mechanic for my game.  I want different units to calculate salvage after an encounter to randomly determine how much each one was able to scavenge from fallen allies or attackers.

As I have it setup up now its calculate as a group.
IE:  If I have group of units whom collectively can salvage value of 5 and for each point of salvage I can potentially gain 1-4 piece of salvage then I have a range of 5-20 pieces of salvage (provided there are 20 or more pieces of salvage to collect).  I am simply multiplying the total salvage value of the group by a randomly determined number in a range of 1-4.

My question is, how can I get each unit to calculate its salvage individually from its own range, rather than as a group as I'm doing now to give greater variance in the amount of salvage generated?

I am rather new and any suggestion or insight would be appreciated.

Below is the code for a demo I setup for the salvage system:

import random

parts_inventory = 0
undif_unit_count = 999
haulers = 2
foragers = 1
salvage_value = (haulers * 2) + foragers
temp_salvage = 0
salvage_random = random.randint(1, 4)

attack = random.randint(1, 6)
fatalities = attack
salvage_pool = fatalities * 4

print("There were {} units destroyed resulting in {} pieces of potential salvage".format(attack, salvage_pool))
print("Your units can haul away {} peice of salvage".format(salvage_value))

def salvage_operation(parts_inventory=parts_inventory):
    print("Encounter Haul {}".format(salvage_value))
    if salvage_value <= salvage_pool:
        print("You gained {} salvaged parts.".format(salvage_value))
        parts_inventory = parts_inventory + salvage_value
    if salvage_value > salvage_pool:
        print("You gained {} salvaged parts.".format(salvage_pool))
        parts_inventory = parts_inventory + salvage_pool
salvage_operation()

sentences:
Could a Peer-To-Peer network architecture be good for my fighting game I am looking forward to developing a 2D spaceship-fighting, brawler game and I have so many ideas about it. I am going to make a single-player component anyway, but the core of this game would certainly be its multiplayer.
For this game, I was inspired by Brawlhalla and its dynamic play-style. In my game, there has to be real-time action features such as attack, dodge, getting hit, killed, so a reliable networking needs to exist. I have thought initially about a client/server architecture, but a peer-to-peer connection would be in my opinion more easily for me to implement.
I have read this article and it proves encouraging for me to go on with this simulation solution.

Let me describe my concept:

A client initializes a room and using sockets, IP, port and the other players would after connect to him. Therefore, there is always a Master Client that handles the new connections and gives signal to other clients about a new existing player. Then, as the game is running, the byte data-packets would stream each player's input, his position, his ship rotation, his ship status and so on, so that each of the other clients could run a perfect simulation of the initial client. In other words, this data packets would trigger all the actions on each client. As network protocol, I am thinking about TCP/IP and should someone be willing explain to me in more practical terms the difference between this and UDP, I would be thankful.

I have even computed how much data it would take to transmit over a second: assuming a byte[256] array that holds all the data at one time multiplied by the number of calls per second (about 32 times) multiplied by the number of clients the data should be broadcasted to (3-4)
results in about 32 kb/s. It might be a dummy result, i might have left a lot of things out, but again, I am ready to learn.

As a note, I do not intend to make at this moment a professional multiplayer system, but rather, I would like to learn more about this programming part of applications and I think this is a very good project idea to enhance my skills.
Of course, I am opened to any advanced tips, solutions, materials and should I add anything else about my concept, please let me know.

How is my theoretical model so far?

sentences:
How do I detect a tile map collision's direction? I'm implementing collision detection with the map for my platformer. I have a method that generates a polygon on every tile and checks if the player hits it -- that's all fine. The problem is that when ever a player touches a wall in front of him the d key which moves him to the front gets disabled so he can't walk any further that way.

This method works great for preventing him from walking into walls, but I also want him to be able to jump on the walls and there is the problem. So he falls on the tile(polygon) the game senses that and applies the same method for the d key, preventing the character from walking left or right, because the game thinks it is hitting the tile in the front but it is hitting from above.

Long story short, the game handles collision from above same as from the front or back. How do I make it recognise collisions from the side separately from above?

My code is along these lines:

if(PlayerPolygon.interesects(TiledPolygon) && dKey==1) {
         moveX = 0;
}
if(dKey==1) {
  player.x +=moveX
}

sentences: What are the things to know before to start Game Development Using C++? I just want to ask the question above ^. I want to learn C++ language. Someday i want to develop Game Application in c++ and I think it is so difficult for me to achieve that but im willing to learn and achieve that goals for may personal satisfaction and also for my CV as well. Can you give me a guidelines on how to achieve that goals? What are the languages that i need to learn together with c++? please help me.. Thank you!

sentences:
LibNoise Perlin.GetValue not returning noise for zero decimal place numbers I'm using the LibNoise port from C++ to C# and running into problems generating Perlin noise (Unity demo here). For some odd reason integers never generate any noise. In the code below _firstValue on all axis has no decimal places and with perlin.GetValue(_firstValue); it returns zero. Adding a decimal place to either x/y/z of _firstValue will return a value with perlin.GetValue.

If anyone's ever used this library, any ideas on why something so simple like this demo seems to be causing so much of a head ache? Looking through the Perlin class, everything seems OK.

Vector3 _firstValue = new Vector3(-31.0f, 83.0f, -7.0f);

Vector3 _displacement = 0.0001f * Vector3.one;

Vector3 _secondValue = new Vector3(14.50f, 20.25f, 75.75f);

// Use this for initialization
void Start ()
{
    Debug.Log("Tutorial conversion for http://libnoise.sourceforge.net/tutorials/tutorial2.html");
    var perlin = new Perlin();
    Debug.Log(string.Format("First value: {0}", perlin.GetValue(_firstValue)));
    Debug.Log(string.Format("First value, displaced: {0}", perlin.GetValue(_firstValue + _displacement)));
    Debug.Log(string.Format("Second value: {0}", perlin.GetValue(_secondValue)));
}

sentences: Can I pause Unity Setup download and continue it whenever possible as per convenience(using Unity Hub)? Actually I get only 1.5GB data daily. So it's not possible for me to download the whole Unity setup in a day. So I wanted to know if I can pause and resume download process as per convenience. I am downloading using Unity Hub.

sentences:
Add impulse and torque to a cube I would like to spawn a cube if I press space and apply a short impulse of force and torque to make the cube rotate. I have some calculations for the impulse but I think they are wrong since the cube only gets faster over time and not fast on the impulse.
The formular for the impulse is p = m · v. In my case I decided to give the cube a mass of 1.

At the moment I calculate the whole impulse thing this way in c++:

                f = 8.f / dt; //force = impulse / dt
                a = f / 1; //acceleration = force / mass
                v += dt * a; //velocity = velocity + a * dt
                p = m_pObject1->getPosition()[0];
                p += v * (float)event.dt; //position= position + v * dt
                m_pObject1->setPosition(glm::vec3(p,m_pObject1->getPosition()[1], m_pObject1->getPosition()[2]));

I am sure I am doing something wrong here also I am a little bit lost in implementing the torque here.
I hope my code and question is clear and I would be happy to see some suggestions. :)

Kind regards

sentences:
Bullets moving with the camera, not the world, Java 2D I'm building a simple 2D Top-Down shooter game in Java.
I simply cannot get this to work:
I'm moving the camera and world differently. The world is moving when needed (when not in one edge, so it gives nice effect of not showing outside of the world). When the player moves and edges are not visible, the camera is moved when the player moves.
I implemented bullets right now, but the bullets move with the camera, not the world, like the correct physics should be :D
For moving the world relative to player position and camera, I'm using X and Y offsets.
Now the problem:
I'm creating a new bullet like this in my Player.java class:
new Bullet(handler, angle, x + width / 2 - handler.getCamera().getxOff(), y + height / 2 - handler.getCamera().getyOff(), 2, 4);

Bullet constructor:
public Bullet(Handler handler, double rad, double x, double y, double speed, int r)

I have to add half the width and height of the player, because otherwise it will shoot at the corner of my player sprite. Camera X and Y offsets to the bullet X and Y, because otherwise the bullet will be drawn to the coordinates relative to the world and will not shoot from correct places. But when the bullet is moving it moves with the camera.
Really wouldn't like to change the Camera movement!

sentences:
My isometric game looks flat; how can I improve this? Being bored I decided to make my game isometric by applying a simple filter effect.

    g.scale(1f, 0.5f);
    g.rotate(400, c.getHeight() / 2, 45);

It works great, but now everything appears... flat.

sentences:
What constraint (if any) limits crowd animation variety? I have recently noticed something in a large number of sports games relating to the animation of the crowd.

Scenario

Player holes the golf ball and the crowd all clap their hands.  Whilst the faces and attire of the crowd members are different the animation is exactly the same.  That is, the arm and hand movement of each member is identical.

Similar scenarios exist in other sports games; in football games the crowd often stand up and sit down together as well as doing things like "fist pump", wave, etc. in a perfectly synchronised manner.

Question

Why is there no (or very little) variation in the crowd animation?  Is this a memory constraint?  If so, what is the general architecure/design of this functionality and why is it so constrained?  Is it along the lines of "It is more efficient to animate a collection of objects than multiple individuals"?

Or do game developers simply not see crowd variation as an important enough requirement?

As technology and game "realism" advances so quickly, this is something that still strikes me as "wooden" and unrealistic.

sentences:
Audio not playing until after button release when it should be playing while it's pressed I am trying to play the sound of a car accelerating while a user has a certain button pressed, however, the audio clip isn't playing until after that button is released.  Can anyone explain to me where I'm going wrong?

C#

using UnityEngine;
using System.Collections;

public class MoveCar:MonoBehaviour{
    //Car's idle speed
    private float idleSpeed = 0.0f;
    //Car's current speed
    private float speed = 0.0f;
    //Car's top speed
    public float topSpeed = 165.0f;
    //Car's acceleration rate
    public float acceleration = 10.0f;
    //Car's braking power
    public float deceleration = 15.0f;
    private Rigidbody playerCar;

    void Start(){
        playerCar = GetComponent<Rigidbody>();

    }

    void Update(){
        if(Input.GetKey(KeyCode.W)){
            AudioSource accelerate = playerCar.GetComponent<AudioSource>();
            float horizontal = Input.GetAxis("Horizontal");
            float vertical = Input.GetAxis("Vertical");
            if(speed <= topSpeed){
                accelerate.Play();
                speed = speed + (acceleration * Time.deltaTime);
                Vector3 movement = new Vector3(vertical, 0.0f, horizontal);
                playerCar.AddForce(movement * Mathf.Clamp(speed, idleSpeed, topSpeed));
                Debug.Log(Mathf.Clamp(speed, idleSpeed, topSpeed));
            }
            else{
                speed = topSpeed;
                Debug.Log(Mathf.Clamp(speed, idleSpeed, topSpeed));
            }
        }
    }
}

Here's my editor windows

sentences:
iOS build size is too large in Unity I have finally completed my game and ready to upload my game to the App store, but my build size is too large.

I have checked log statement and it is roughly 13.3 mb but when i build my game and test on iOS device it is 80.0 mb.

Also

Scripting Backend is 'Mono2x'

Stripping Level is 'use micro mscorlib'

Script Call Optimisation is 'Fast but no Exception'

My Game size must be around 15 to 20 mb why it is too large?

What i am missing?

sentences:
Show size / dimensions of an object in Unity Inspector I want to see the size of the currently selected objects in the Unity Inspector, however I can't seem to find how to add it.
Currently when I select a model in my scene, the Inspector panel shows info about its position, rotation and scale, but not the size of the object.

What I want to achieve is to create a scene so that the objects in this scene have the correct proportions to each other, i.e. if a human has a size of 1.8 'units', an example car should be about 5 units long.

sentences:
What state is stored in an OpenGL Vertex Array Object (VAO) and how do I use the VAO correctly? I was wondering what state is stored in an OpenGL VAO. I've understood that a VAO contains state related to the vertex specifications of buffered vertices (what attributes are in the buffers, and what buffers are bound, ... ). To better understand the correct usage of VAO's, I'd like to know exactly what state they hold.

How I assume VAO's should be used

From simple examples, I've understood that correct usage of VAO's is as follows:

Setup

Generate VAO
BindVAO
---- Specify vertex attributes
---- Generate VBO's
---- BindVBO's
-------- Buffer vertex data in VBO's
---- Unbind VBO's
Unbind VAO

Rendering

Bind VAO
---- Draw
Unbind VAO

From this, I assume that at least the vertex buffer bindings and the vertex attribute specifications are stored in the VAO. I'm unsure however how this usage pattern extends to situations where (multiple) textures and (multiple) shader programs come into play. Is the active shader program stored in the VAO? And are the texture bindings (with their sampling/ wrapping settings) stored in the VAO as well? Ditto for uniforms?

Therefore, my questions are:

What exact state is stored in an OpenGL VAO? (VBO bindings, attribute specifications, active shader program, texture bindings, texture sampling/wrapping settings, uniforms ... ?)
How do I correctly use VAO's in a more complex rendering setup where (multiple) textures with associated sampling/wrapping settings, (multiple) shader programs and uniforms are involved?

sentences:
Running one action on multiple sprites simultaneously I have created a spiraling animation for a football. I want to be able to run it on 2 sprites simultaneously.

This is what I have done:

CCAnimation* footballAnim = [CCAnimation animationWithFrame:@"Football" frameCount:60 delay:0.005f];
spiral = [CCAnimate actionWithAnimation:footballAnim];
CCRepeatForever* repeat = [CCRepeatForever actionWithAction:spiral];
[Sprite1 runAction: repeat];
[Sprite2 runAction: repeat];

However, the action is only run on the first sprite. What am I doing wrong?

sentences:
Are there any advantages to different programming paradigms specifically releated to game programming? I have been researching three different programming paradigms namely procedural, object oriented and functional. So far I have been able to find a lot of good information regarding general differences and advantages/disadvantages like readability, re-usability, difference in learning curve, program size, etc.

I am now looking for differences more related to game programming, but I am struggling to find good examples. Does anyone know of specific issues when programming games that these paradigms handle differently, that I could look into? This could include things like handling I/O, rendering and programming AI, but other things related to game programming would also be appreciated.

sentences:
Parallax Background Size If I have three scrolling/continuous parallax backgrounds, what should be the ideal size (width/height) of the background images assuming I am going to support all devices including the new iPad?

UPDATE:

Only landscape mode
Deployment Target: 4.2+
Same scene will be repeated.

sentences:
How do I delete all saved preferences in my libgdx project? I want to delete the preferences that saved my last highscore. How can I do this?

Here's how I am saving preferences at the moment:

prefs = Gdx.app.getPreferences("ZombieBird");
if (!prefs.contains("highScore")){
    prefs.putInteger("highScore", 0);
}

public static void setHighScore(int val) {
   prefs.putInteger("highScore", val);
   prefs.flush();
}

sentences:
Why do phone games limit turns? Many phone games restrict the number of turns you can play in a given amount of time. I don't get what is the purpose of this limitation. Is it only to force the player to buy additional turns? Some games don't even allow this for some turn "kinds" (like action A can be played again by spending real money while action B cannot be played again by spending money).

Another possible reason would be to limit the bandwidth usage to their server and make it more predictable over time, but I can't see phone games using so much data.

sentences:
LWJGL version problems Is it possible to create VAO's while my computer doesn't support openGL 3.0 or higher? I managed to create a vertex buffer object and draw a rectangle.
But then I changed my lwjgl libraries to the latest version, and now I'm using GLFW for creating my display.

Thw problem is: when i create a rectangle using a simple VBO, it has no errors.
When I follow tutorials and start using a VAO, I get a function not available exception on glGenVertexArrays().
After searching on Google, a came to the conclusion that some devices do not support openGl 3.0 or higher. And I also tried a few configuration things, but I can't get to work with VAO's. Is there another way of using them in a lower version?

sentences:
How to prevent sending semantically wrong messages in event based architecture? I have created the following architecture in C++:

ReceiveMessage has two important parameters:

Scope, which defines the scope, like game object, scene or core. This determines how far the message will be forwarded. For example, core messages will be processed by Core, and game object messages will processed by GameObject.
Event, which defnes the name of the event, as an enum. This might include FIND_GAMEOBJECT_IN_RANGE, PLAY_SOUND, etc.

If I accidentally send an event that can only be handled by Core with the game object scope, instead of core, it is only checked at runtime. Currently, it is possible to send a message like ReceiveMessage(GAMEOBJECTS, PLAY_SOUND, ...);. This would be forwarded to every game object, and won't be handled, because the PLAY_SOUND event is only properly handled by Core.

How do I redesign my messaging system so that the compiler will give an error or warning when I try to send a message with an invalid scope-event pair?

sentences:
Character falls through the Platform Effector 2D in Unity. How can I fix it? Character falls through the Platform Effector 2D in Unity. How can I fix it?
Here is the demonstration: https://imgur.com/G5YkTxa.
I tried changing the Edit - Project Settings... - Physics 2D - Default Contact Offset from the current 0.01 value to the 0.1 value. The result is the same and here is the demonstration of it: https://imgur.com/3TAOsNY.
Here are my settings for the platform:

Here are my settings for the character's RigidBody 2D:

Here is what character colliders look like when my character runs: https://imgur.com/CTialU3.
I basically run the recorded inside Unity animation of running and move my character with the help of the:
        private void FixedUpdate()
        {
            ... some code which computes the velocity vector depending on the input (the pressed buttons)
            characterRigidBody2D.velocity = velocityVector;
        }

I googled for a while now similar issues, but was not able to find a solution. I want to avoid the character falling down randomly during running.

sentences:
Java Scrolling 2d Block game - Optimise my code? I have a 2d game where you look down from above and can scroll up, down, left and right using a viewport and a much bigger map.

I have been having trouble drawing a rectangle around the block under the cursor but finally cracked it more through luck than anything else but ended up with this code. Can you help me optimise it and simplify it?

int blockwidth=gridsize-2;

//Draw coloured blocks
for (int x=0;x<sizex;x++){
   int thex=-(int)locationx+(x*gridsize);
        for (int y=0;y<sizey;y++){
        int they=-(int)locationy+(y*gridsize);
        //if (thex>-blockwidth && thex<800){
            g.setColor(new Color( tiles[x][y][1]));
            g.fillRect(thex,they,blockwidth,blockwidth);
        //}
    }
 }

Especially this piece

//Cursor co-ords updated
cursorx=(int)locationx+(int)GameInput.mousex;
cursorx=(int)cursorx/gridsize;
cursorx=-(int)locationx+(cursorx*gridsize);

//Draw on screen cursor
        g.setColor(Color.yellow);
        g.drawRect(cursorx,cursory,blockwidth,blockwidth);

sentences:
What are the basics of 3D triangle/quad sorting? I am really curious how any 3D engine or even the GPU sorts triangles and quads. Are they basically taking a "center" point of a particular triangle/quad/poly and then calculate a distance from a camera point?

How is the depth of a polygon calculated if not using a point distance algorithm? Keep in mind I am a complete noob regarding 3D.

sentences:
Detecting Light Intensity Around Characters Later Edit

Since there seemed to be a bit of confusion: I am asking this for purely didactic reasons, I'm not searching for the most efficient solution. Reformulated question: I'm working under Unity, and I'd like to know if it would be possible to somehow query the material + shader of each GameObject that has a Mesh Renderer attached to itself, in order to find out how much light has fallen on the 3D model. I'm not very experienced in computer graphics, so this may seem like a stupid question. I'm thinking of something along the line of pixel by pixel comparison of a texture's brightness at any given point in time.

sentences:
GameObject once walked on, gives message using C#? I'm struggling to figure this code out by myself. I'm able to check if the objects are in the scene, and if they are print a message. I now want the GameObject of tag Zone to display a message to let me know when I've walked on it or at very least, touched it.

Am I entirely wrong with trying to do this with Raycast, or would I be better off trying to figure out how to do this with purely Collisions or something? Just looking for advice more than anything, I really want to figure this out as best I can.

sentences:
Setting a texture's "Max Size" while ensuring that its dimensions are still multiples of 4 A version of my game has several large textures with dimensions that are multiples of 4 so that Crunch compression can kick in.
A ported version of my game, for platforms that have very limited RAM restrictions, will need us to limit the "Max Size" of our textures to 512 or 256, etc.
There are some cases in which a Crunch-friendly texture, when resized by Unity's "Max Size" parameter, will actually end up with dimensions that aren't multiples of 4.
944x800 would end up as 512x434, if we select "512", which isn't good for Crunch.
The naive solution in my mind is to write a simple script/tool that resizes/pads all my textures by a couple of pixels in such a way that Unity's resize will end up in a Crunch friendly way. However, I'd rather do that as a last recourse if possible.
Is there a more standard way to approach this situation of mine?

sentences:
Algo for rotating tower towards enemy - Unity I have made a grid and placed towers and moving a enemy on it. Now i want to rotate towers face towards enemy when enemy comes in the range of tower.

I have a solution that whenever enemy comes to its range ( 2 grids far ) it starts do something, lets say when tower finds enemy is on left side it starts firing like that when enemy moves up/down ( when it finds there is a tower on very next tile) tower starts rotating with enemy position uniti enemy's range that is 2 grids far. So its mean tower has to rotate whenever enemy comes to its range and moves up/down.

What would you people suggest me a optimized way or any helpful scripting function ?..thnx

sentences:
WebGL Redirecting URL If player's browser don't support WebGL, I want to redirect Web Player version. I think it's possible in UnityLoader.js file but how?

function CompatibilityCheck(){hasWebGL?mobile?confirm("Please note that Unity WebGL is not currently supported on mobiles. Press Ok if you wish to continue anyway.")||window.history.back():-1==browser.indexOf("Firefox")&&-1==browser.indexOf("Chrome")&&-1==browser.indexOf("Safari")&&(confirm("Please note that your browser is not currently supported for this Unity WebGL content. Try installing Firefox, or press Ok if you wish to continue anyway.")||window.history.back()):(alert("You need a browser which supports WebGL to run this content. Try installing Firefox."),window.history.back())}

I just want to add a URL redirect here.

sentences: Is it possible to use Metal and SceneKit at the same time? All the tutorials that I've found online speak about using Metal alone, without any other supporting library. But I don't understand if it's possible to create a SceneKit game and then use a Metal layer just to make some optimizations.

sentences:
How can I implement a game locator or proxy server? I have a turn-based strategy game which already has a multiplayer server/client layer that works fine on local network (where one server is set up and players connect to it).

I would like to extend this architecture to allow players to play via Internet, but I don't want to have a dedicated game server for that, especially due to performance issues. The game's AI is runs on the game server of course, and multiple games with computer players would "kill" the machine.

I would like to have some kind of "central connection point" server that does not run the game logic, state or AI but can be used by players to find servers hosted by other players. How can I implement this?

sentences:
What language and tools are good to start with for Linux game development? I would like to start learning about game development and I would like to do it using Linux. My main experience has been with Java and a bit of C++, but that was for applications and not games.

Now that I want to try with gaming, I'm wondering which IDE/language should I use in Linux, whether I should go with C++ and compiling files manually at the beginning, or maybe continue with Java/Eclipse, also I think I can use Eclipse with C++, I have also started reading about Python...

I was thinking in starting with the typical "Tetris" just to understand how a game works internally, and I think I can achieve that with all the previous options, but what do you recommend me or how have you started game developming under Linux?

sentences: Character jumping movement in isometric tile When I want to draw my character moving from one tile to another, I would find the displacement vector between two tile's drawing offset and let the character walk in a linear line toward that direction until it complete this displacement vector. Now, I want to make my character jump from higher/lower tile to lower/higher tile. I have a drawing location (x,y) for the texture, start and end. However, I want it to motion like a projectile,  not a linear line. Therefore, given 2 point, start and end point, how would I motion my character in a jumping motion form (maybe it's a parabolic form)?

sentences:
Handling of data sharing between framework module I am currently developping a 3D game using C# / XNA 4.0 and i am currently thinking about how i should structure my game. The actual game is in fact not really important as the framework i am working on right know is pretty generic.

1st layer :

BaseFrameWork : This BaseFrameWork is managing all the different game modules

2nd layer :

ContentProvider : This module is a layer loading all the needed content (texture/sound/models) and providing it when needed
SoundManager : This module is handling all the audio request (music activation, music change, sound activation, ect)
InputEventHandler : This module is handling all the inputs of the player. Some flags are provided to each module to operate (for example there is a flag "toggleMusic" which is turned on when the player is pressing "M" while in game.
ObjectFactory : This module is creating all the different objects when it is needed (for example creating a floor, boxes and other stuff)
Player : This module is exclusively dedicated to the player.
HeadUpDisplay : This module is dedicated to write the HUD (2D) of the game

Currently the 3rd layer is not developped (i have a few different objects for the ObjectFactory but that's all).

My first question is : "Knowing how is structured my game, do you think i should do it differently, and why ? For example, should player be part of the ObjectFactory "

My second question is about the way these different modules should be linked together.

The easiest option, but (i think) the nastiest one, is to provide to each module a reference of the other ones with everything public. Really easy to implement, really easy to use ingame, but really REALLY nasty.
One other option could be to let the BaseFrameWork get the useful informations of a module to give it to an other module.
Other options ?

These questions may seem basic and common sense, but last time i have been part of a game development, it looked nice (http://yapt.free.fr/) but i think we/I could have done better by spending more time into the game architecture beforehand instead of just diving the head in water.

Thanks for your comments/advice

Al_th

sentences:
Moving object along X and Z plane relative to camera Using keys, I'm trying to move a cursor object across the X and Z plane, keeping it relative to a camera that I can orbit around the playfield.

This is my code so far, and apologies...I'm about 2 days into learning Unity. This code is on my cursor object.

        if (Input.GetAxis("Horizontal") > 0f) {
            transform.position = transform.position + Camera.main.transform.right * moveSpd * Time.deltaTime;
            }

        if (Input.GetAxis("Horizontal") < 0f) {
            transform.position = transform.position - Camera.main.transform.right * moveSpd * Time.deltaTime;
            }

        if (Input.GetAxis("Vertical") < 0f) {
            Vector3 dir = Camera.main.transform.forward;
            dir.y = 0.01f;
            dir.Normalize();
            transform.position = transform.position - dir * (moveSpd*1.5f) * Time.deltaTime;
            }

        if (Input.GetAxis("Vertical") > 0f) {
            Vector3 dir = -Camera.main.transform.forward;
            dir.y = 0.01f;
            dir.Normalize();
            transform.position = transform.position - dir * (moveSpd * 1.5f) * Time.deltaTime;
        }

        transform.position = new Vector3(transform.position.x, 0.01f, transform.position.z);```

It works, but the vertical axis affects the Y plane so I had to do another transform at the end.

What is the best way of doing this?

I'd also like the cursor to snap to grid co-ords. I've tried turning them to int but it doesn't do what I want.

sentences:
Can't consistently add to TimeSpan for Unity Game I'm making a game that has a timer showing how long the player has survived from being crushed by pessimism. (Long story) I'm trying to use TimeSpan in Unity to accomplish this but it seems that I'm having trouble finding a way to add time consistently. My output is always 00:00:01. Here is the code I've been working on. Any help would be appreciated.

using UnityEngine;
using System.Collections;
using System;

public class TestScript : MonoBehaviour {

static float timer;
TimeSpan t = TimeSpan.FromSeconds(timer);
TimeSpan add = TimeSpan.FromSeconds(1);

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

    TimeSpan span3 = t.Add(add);

    Debug.Log(span3);
}
}

UPDATE

Thanks for your help Jason, here's the code I made in case anybody else wants to know how to do this. The only beef I have is that the milliseconds show 3 characters instead of two, but I'm personally very satisfied with it. Plus, I'm sure that it is something that could be easily fixed.

using System.Collections;
using System;

public class TestScript : MonoBehaviour {

static float timer;

// Update is called once per frame
void Update () {
    timer += Time.deltaTime;
    TimeSpan timeSpan = TimeSpan.FromSeconds(timer);
    string output = String.Format("{0}:{1}:{2}",timeSpan.Minutes,timeSpan.Seconds, timeSpan.Milliseconds);
    Debug.Log(output);
}
}

sentences:
How can I calculate the visible area of my camera in world space and take zoom into account? I am trying to get the bounds from an orthographic camera in Unity which take into account the current orthographic size (zoom).

I thought that I could use the cameraToWorldMatrix to transform the camera pixel rectangle into world coordinates.

var m = camera.cameraToWorldMatrix;

var bL = m.MultiplyPoint(new Vector3(camera.pixelRect.xMin, camera.pixelRect.yMin));
var uL = m.MultiplyPoint(new Vector3(camera.pixelRect.xMin, camera.pixelRect.yMax));
var uR = m.MultiplyPoint(new Vector3(camera.pixelRect.xMax, camera.pixelRect.yMax));

var rect = new Rect(uL.x, uL.y, Math.Abs(uR.x - uL.x), Math.Abs(bL.y - uL.y));

However, this does not take into account the orthographic size (zoom).

Multiplying the cameraToWorldMatrix with the camera's projectionMatrix property does not give me the correct results either.

Is there a sensible way that this can be solved?

sentences:
Object not Augmenting on small marker I am new to Augmented reality. I am developing a jewellery try on app with vuforia using unty3D editor.
What I want is to augment a ring on the marker. I download an image(attached bellow) and used it as my marker and it was working fine but when I resized the image in paint to fit to finger the marker stopped augmenting the object.
any help.

What should be the marker size or anything else which I am missing ?
Please help me.

sentences:
How can I use a coroutine and GetAxis to rotate a game object? For the sake of learning about coroutine, I want to convert the following to a cleaner Update that just calls a coroutine. How would I do that?

using UnityEngine;

public class Controller : MonoBehaviour
{
    public float speed = 5f;
    private float deltaX;

    void Start()
    {
        deltaX = transform.localEulerAngles.x;
    }
    void Update()
    {
        deltaX += Input.GetAxis("Vertical") * speed;
        deltaX = Mathf.Clamp(deltaX, -90f, 90f);
        transform.localEulerAngles = new Vector3(deltaX, transform.localEulerAngles.y, transform.localEulerAngles.z);
    }
}

sentences:
Would it be better to use XML/JSON/Text or a database to store game content? I'm considering how to implement a component-based game, as that seems to be the hot thing and I like the idea of such a flexible design.  One of the features of such a design is that adding new things to the game can be done through data, often presented as loading content through text files such as XML.  This has the advantage of being human readable and easily editable in any text editor.  On the downside, text can be slower to deal with, and you have to manage a large collection of data files.  Similar text-based formats like JSON or config files would have similar benefits.

On the other side, there are small, portable databases like SQLite or Tokyo Cabinet.  While not directly human readable, these files are easy to interface with, and I'd imagine some kind of editing tool would be preferable for game content design anyway.  Using a DB allows for a consistent storage of config information and easy retrieval.  You could serialize data into a DB for save games as well.

Performance wise, I think generally XML is faster for small files but a database scales better to large amounts of data.  I'd imagine any real game is going to have a whole lot of game objects.

So the question:
Which is the preferable approach?  I'm leaning towards the DB, but I want to know if there are hidden pitfalls or real strong advantages to text files.  Or if there are other alternatives besides these (serialize to binary format I guess?)

sentences:
Turning a board game idea into a browser based, slow paced gameplay Suppose I want to create a strategy game with global mutable state shared between all players (think game board). But unlike a board game, I don't want it to be real time action and/or turn-based. Instead, players should be able to log in at any time of the day and spend a fixed number of action points per day as they wish. As opposed to a few hours, game sessions would run over a few weeks.

This is meant to reward good strategy rather than time spent playing (as an alternative, hardcore players could always play multiple games in parallel instead) as well as all kind of issues related to live playing like disconnections and synchronization. The game should remain addictive still have a low time investment footprint for casual players.

So far so good, but this still leaves open the question of when to solve actions and when they should be visible. I want to avoid "ninja play" like doing all your moves just a few minutes before daily point reset to take other players by surprise, or people spamming F5 to place a well-timed action which would defeat the whole point of a non real-time game.

I thought of a couple of approaches to that :

Resolve all events in a single scheduled process running once a day. This basically means a "blind" gameplay where players can take actions but don't see their results immediately. The thing is, I played a similar browser game a few years ago and didn't like the fact that you feel disconnected and powerless until there's that deus ex machina telling you what really happened during all that time. You see the world evolve in large increments of one day, which often doesn't seem like seeing it evolve at all.
For actions that have an big impact on the game or on other players (attacks, big achievements), make them visible to everyone immediately but delay their effect by something like 24 hours. Opposing players could be notified when such an event happens, so that they can react to it.

Do you have any other ideas how I could go about solving this ? Are there any known approaches in similar existing games ?

sentences:
2D RPG - Character sprite size bigger than tile size Ok so I'm trying to make a nice little RPG game in Java & Slick2D engine, the tiles are 16x16, so the collision array is also 16x16, how ever my character sprite is 16x20

What would be the best method of moving the character in relation to a 16x16 grid, also checking for collision?

sentences:
UE4 Code Project is not showing sub folders created within C++ Classes Folder even though they exist These were my steps.
Created an empty code project in UDK4.
The editor starts up.
On the left bottom you have:

If you try to right click on C++ Classes,
Or select [Add New] while having C++ Classes highlighted
The option to add a new folder is greyed out.

This seems odd, since you can add a new C++ Class and set your sub folder in there. When the class gets created and our IDE in my case (Visual Studios) opens up the folder gets created in there no problem. I also tried setting the public or private option when making a new c++ class that just added a sub folder of /private /public where my new class gets nested in code but still not seeing the folder format display on the Unreal Editor.

So what's going on with UDK4? It seems highly unlikely that the issue is actually a bug.
Is it something I'm doing wrong? Or some second step I need to do?

Different Attempts:
1) Tried making the sub folder in the class create pop up, that created the folder in Visual Studios but still did not show up in the Unreal Editor
2) Restarted Unreal Editor to see if it would refresh the folder hierarchy, no luck.
3) Shutdown both UDK4 and VS and restarted UDK4 then VS also tried VS then UDK4 just in case as a second test.
4) Attempted to drag and drop a folder into the hierarchy from Visual Studios you just get a red O with a slash next to the mouse icon stating it wont allow it.

sentences:
A star pathfinding path too narrow for enemy The tiles for my top down 2D shooter are 32x32 and the player and enemies are too. But obstacles like walls and other things can of course be smaller than this - the smallest being 8x8. This causes a problem where a single 8x8 barrier intruding in a 32x32 tile will cause that whole tile to be impassable if my AI Grid is based on 32x32 tiles, like as follows:

This results in a grid with more impassable area than it should have. (On the left the red being the AI grid's impassable area, and on the right, the green being the box2d barriers for the same map section).

The other option is to make the grid 8x8 based and then the grid will perfectly calculate the actual impassable areas but it will create paths too narrow for the 32x32 enemy to pass through. With design I can make the first way (pathfinding grid of 32x32 tiles) work but it's not ideal since you're limited to placing everything in perfect tiles so as to not create impassable areas that are in fact passable.

sentences:
C++ SDL, Opengl 3D Game I have been learning C++ for long time (but only learning game development for eight days) and I have made a simple game using 2D textures.

I was thinking of starting on 3D game development. I wanted to begin by loading and rendering a 3D model on the program, but I dont know how.

Can anybody tell me if this function could be changed to output 3D model:

GLuint loadTexture( const string &fileName )
{
SDL_Surface *image = IMG_Load( fileName.c_str() );

SDL_DisplayFormatAlpha(image);

unsigned object(0);

glGenTextures(1, &object);

glBindTexture(GL_TEXTURE_2D, object);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image -> w, image -> h, 0, GL_RGBA,
GL_UNSIGNED_BYTE, image -> pixels);

//Free surface
SDL_FreeSurface(image);

Also what format should I use for this? I am using Blender, and I have seen it can export to a variety of formats. I don't know which would be the best for this kind of stuff and for serious game development.

sentences:
2D collision and getting closer to objects Just curious what to do from here. So I am done with my tile editor program and currently have it set up so that my background (which is one large image) is mapped in XML to 32x32 tiles (again, a mapping, nothing is really split into tiles).

So when I have my character (this is a platformer rpg) comes across a tile which I have labeled as obstacle or something, they stop. This is nice and all except for some ugly space in between my character and tile where the edge of my rock is. I can't do pixel detection because it will never be sound.

For example, if my character's pinky ends up in the cell marked as an obstacle and for some reason, there is some black along an edge from a castle from the previous cell, this is a hit even though the player didn't actually touch any part of the rock but rather a part of the pinky hit that black edge.

The only thing I had which makes things seem to nicely lineup is to map it to a 16x16 array.

Edit: I will give the example with pic in the morning since site came back up but for now I'll give a better explanation.

My tile editor exports an XML file of my tile mapping...so, if I specified 32x32 tiles over an 800x600 image, my XML file will contain mappings for each 32x32 tile spread across the region. So I could have my XML file with tile 2 having a type of "Obstacle". I then in XNA just read the XML into a list storing each tile and their characteristics.

I then in my program do a collision check for now. In doing this, I create a rectangle around my player. Each time I move, I check for collision by doing this:

Does my rectangle intersect any collisions with a characteristic of obstacle or wall and so on...
If so, return true that a collision occurred.

So let's say that my background image has a blue background, a castle and a rock in the middle. In a tile I marked as being an obstacle, it contains a piece of the black wall of the castle and to the right of this is a piece of that rock along my path. So my character is now running to the right, will have an intersection with this obstacle tile and as a result, have something like 29 pixels between the player and the start of the rock. This collision occurred as the player hit a tile marked as an obstacle.

Using pixel color collision detection won't help either as a piece of my player could be hitting that black edge of the castle I talked about and the alpha values are never going to be 0.

I'll give a picture example but I am just detailing it a bit better for now.

sentences:
Java/LibGDX Self made Input Field I want to create an Inputfield from Scratch in Java and LibGDX, my Question is:
How can I display only certain Parts of a String in a specific width?

For example:
My Input field GUI is 200 pixels wide. But I can write like 500 Letters maximum in my Input field. When I display this 500 letters all at once. It would be bigger than the GUI. So I want when I wrote down the first 100 letters and then write the next one that the first one disappears and the displayed text starts from the 2 Letter and then goes to the 101. And so on. Much like the Minecraft Chat Input field.

sentences:
How to detect that user has touched UI canvas in Unity 4.6? In my 2d game I have a HUD with some buttons on it. To make it I am using new UI system, which was presented in Unity 4.6. When user is touching button, I am running method, which was declared in EventSystem. But the problem is in that I need to make difference between touch in any part of screen and touch directly on UI, because when I am touching to any part of screen my character starts fighting. And when I am touching the UI image,  my character starts fighting and only after that the method that was attached to UI image EventSystem starts. So I need to check what I am touching on screen. For desktop platform everything is okay, when I am running this code:

if (Input.GetMouseButtonDown(0))
{
    EventSystem eventSystem = EventSystem.current;
    if (eventSystem.IsPointerOverGameObject())
    {
        return;
    }
}

And for mobile platforms I am using this code, but it doesn't work. The system doesn't check that user pressed on UI image.

public class TouchController : MonoBehaviour {
    Canvas BonusesAndPotionsCanvas;
    GameObject BonusesAndPotions;
    void Start ()
    {
        BonusesAndPotions = GameObject.FindGameObjectWithTag ("bonuses_and_potions");
        BonusesAndPotionsCanvas = BonusesAndPotions.GetComponent<Canvas> ();
    }

    void Update()
    {
        EventSystem eventSystem = EventSystem.current;
        if (eventSystem.currentSelectedGameObject != null)
            return;
        for (var i = 0; i < Input.touchCount; ++i)
        {
            if (Input.GetTouch(i).phase == TouchPhase.Began)
            {
                Vector2 worldPoint = Camera.main.ScreenToWorldPoint( Input.GetTouch(i).position );
                if (IsPointerOverUIObject(BonusesAndPotionsCanvas, worldPoint))
                    return;
            }
        }
    }

    private bool IsPointerOverUIObject(Canvas canvas, Vector2 screenPosition)
    {
        PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current);
        eventDataCurrentPosition.position = screenPosition;

        GraphicRaycaster uiRaycaster = canvas.gameObject.GetComponent<GraphicRaycaster>();
        List<RaycastResult> results = new List<RaycastResult>();
        uiRaycaster.Raycast(eventDataCurrentPosition, results);
        return results.Count > 0;
    }
}

Can anyone help me? I will be very glad for any help!

sentences:
How to get Google Play to suggest my app? I uploaded a game to Play and obviously it isn't the very first suggestion on the list. I uploaded it 3 days ago.

As somehow new games do get played, I assume people start to know about them.

I would like to ask that how does Play start suggesting an app? Is it by download count/download frequency? Or does it show new apps by itself?

sentences:
implementing different users in XNA - XML So I am making a simple 2D game in XNA, and I want to implement different users (players), so each person playing can have their own high score, can only play levels they've already played, can only edit levels they've made, etc.

The levels are currently stored in XML, in the format:

  <level>
    <name>Level Name</name>
    <number>14</number>
    <authorTime>12.45</authorTime>
    <map>...</map>
  </level>

I was wondering what would be the most efficient way, and the best practise approach, to implementing this?

I am currently torn between two options: 1. each level having a <users> tag, containing a user ID and a time if they have completed the level. 2. Having a separate XML file, containing users and a list of their levels and times.

Are these good ways to do this? Are there other ways to do this better?

Thanks,

Simon

sentences:
LibGDX how to remove PointLight that is attached a destroyed Body I have this code:

@Override
public void beginContact(Contact contact) {
    fa = contact.getFixtureA();
    fb = contact.getFixtureB();

    if (fa == null || fb == null) return;
    if (fa.getUserData() == null || fb.getUserData() == null) return;

    final Body toRemove = contact.getFixtureA().getBody().getType() == BodyDef.BodyType.StaticBody ?
            contact.getFixtureA().getBody() :
            contact.getFixtureB().getBody();
    Gdx.app.postRunnable(new Runnable() {
        @Override
        public void run () {
            world.destroyBody(toRemove);
        }
    });

}

It removes the FA body, but this body have a pointlight attached.
I want to remove this PointLight attached.
I have no idea how to do this :/.

sentences:
Classes in Unity - internal vs public Why are classes created by the game developer in Unity public (by default) when you could just as easily make them internal? For example: I go Assets->Create->C# Script. Via the default script template, I have just created a public class that derives from MonoBehaviour. But technically shouldn't this class only have to be internal? If so, I really want to delete that public keyword, because having the word public is a slight distraction to me.

Do outside DLLs call functions within the developer-created DLL? I don't think so, right? Because the classes in other DLLs wouldn't know what funcitons are in there beforehand anyway.

I don't know much about how these DLLs interact with each other, but I get the feeling outside DLLs don't particularly care about the one DLL assembly the game developer himself generates.

Take a look at my picture - it seems like Unity just jams all developer-created scripts in one assembly. Yes, the assembly does reference MonoBehaviour, (so I assume other classes in all the other dlls are public, not internal) but no classes outside of this one need be concerned with the details inside this assembly.

It doesn't matter that much. Yes, I could go on living my life peacefully and making my classes public within Unity. But is there any potential drawback, and isn't it considered better practice, to make them internal? If there's nothing wrong with making my classes internal, then I'm going to edit the default template.

sentences:
Local player always at same position I am trying out UNET ( Unity Multiplayer Service ) and I am building a space invaders like game but with two players at each side of the screen shooting at each other.

I want the local player to always be at the bottom of the screen and see the enemy at the top.

I tried checking isLocalPlayer and isServer and only if both are false -> this means it's the enemy player and change his transform and rotation to be facing downwards and be at the top. But this brings unexpected behavior like spawning the bullets on the original position.

sentences:
Render to cubemap wrong Y values I'm currently trying to render to a cubemap in order to blur it. However the top and bottom faces appear much closer than they should be in the blurred version. I thought the problem came from my transformation matrices but they're just rotations. I'm beginning to believe that it's the way I'm handling the framebuffer that's causing this problem. Here's how I'm doing it :

    unsigned fbo;
    unsigned rt;
    glViewport(0, 0, size, size);
    glGenFramebuffers(1, &fbo);
    glGenRenderbuffers(1, &rt);

    glBindFramebuffer(GL_FRAMEBUFFER, fbo);
    glBindRenderbuffer(GL_RENDERBUFFER, rt);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, size, size);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt);

    //...
    //enable source cubemap, set projection
    //...

    for(int i = 0; i < 6; ++i) {
        //set rotation
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, target_cubemap, 0);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        //draw cube

(the images below are from the same corder)

sentences:
Is this a good way to handle different game screens? While developing my game I am often asking myself if my way of handling different game screens (MainMenu, Game, Ending, Highscore) is a good one.
I am currently using only one activity. The game loop is running in this class.
The currently active screen gets a update and paint method called from this loop like this:

while (running) {
    if (!holder.getSurface().isValid())
        continue;

    float deltaTime = (System.nanoTime() - startTime) / 1000000000.0f;
    startTime = System.nanoTime();

    if (deltaTime > 0.315) {
        deltaTime = (float) 0.315;
    }

    game.getCurrentScreen().update(deltaTime);
    game.getCurrentScreen().paint(deltaTime);

    Canvas canvas = holder.lockCanvas();
    canvas.getClipBounds(dstRect);
    canvas.drawBitmap(framebuffer, null, dstRect, null);
    holder.unlockCanvasAndPost(canvas);
}

One problem I am often facing is that the screen classes aren't activities, so I am unable to start a DialogFragment, as an example, because it needs a FragmentActivity. Since these classes are just instantiated the FragmentActivity never gets started.

If I need a dialog, I am currently just making an Activity to a custom dialog.

How would you handle a game framework? Are there any good examples out there?

sentences:
Movement on objects in 2D tile/grid based game This question is an addition to both of these questions:

Boat passing under a bridge in a 2D tile based RTS
How to handle slopes/bridges in a 2d grid turn based strategy game

While I get the idea that you can just have multiple independant "layers" of your grid for each unit type. I'm curios as to how this works out in an action game where a player controls a character that can jump (or even crouch). So let's say I want to have the following kind of things:

Bridges or other places that a player can walk over or under.
Slopes that allow a player to move up or down without jumping
Crates, walls or even little differences in hight that a player should be able to jump onto or down.
Tall walles or cliffs that a player should not be able to jump down or up but walk on top of them if he finds another way to get up/down.
Pseudo-free-movement. A player can walk freely on the tiles while movement is still limited by the tile grid.

So slopes and crates are identical in a way that they allow a player to traverse from one layer to another one.

I'm not sure if this can even be achieved with a simple 2D approach, so maybe I'm better off with a full 3D engine? I liked the idea of a simple 2D engine but I don't want to make it more complicated if a a 3D engine is the right call here.

I'm also having a hard time finding any descriptions or papers that deal with these things.

sentences: Would it be possible to randomize LOD distance in unity like in BOTW grass I was studying the BOTW grass shader and noticed how the grass appears uniform at a distance but complex up close. From watching gameplay it appears the LOD is randomized to make the transition between the two types of grass smooth. I can't find any way to do something like this in unity and am wondering if anybody has advice, or can guess as to how they did it. Thanks!

sentences: Why do most 2D platformers start off in the left and progress in the right direction? In almost all 2D platformers I've played, your avatar always starts off on the left side of the world, and continues on to the right. Is there something designers gain by doing this?

sentences:
Is it legal to sell or monetize games created with the Unity 3D free edition? Is it okay to use Unity 3D programming and gaming software to create mobile game apps for Android and iOS? I am using a free version of Unity 3D and planning it to sell my current game app I've created by publishing it to Google Play. I also use this method for earning money by setting as a free app with ads on it.

I saw some developers relied on using free version of Unity 3D to create games and published it via App Store or Google Play. If it does, should I have to pay or share contribution to the Unity development team for earnings since I use the free version in order to rely for producing several game apps for business?

sentences:
Is it possible to animate the texture of a model? Below is how far I've got. I just made a simple block with user primitives to test it. But I haven't found a way to crop the spritesheet.

textureLava = frames[activeFrame];

This line is how I want it but off course this doesn't work. Is there a way to crop this spritesheet or is there another way to animate the texture of a model?

public void CreateFrames()
{
    for (int i = 0; i < 64; i++)
    {
        frames.Add(new Rectangle(WIDTH + i, i, WIDTH, HEIGHT));
    }
}

public override void Update(GameTime gameTime)
{
    if (System.Environment.TickCount - lastFrameTime > TIME_BETWEEN_FRAMES)
    {
        activeFrame++;
        lastFrameTime = System.Environment.TickCount;

        if (activeFrame > 15)
        {
            activeFrame = 0;
        }
    }

    textureLava = frames[activeFrame]; --> DOESN'T WORK

    base.Update(gameTime);
}

public override void Draw(GameTime gameTime)
{
    effect.TextureEnabled = true;
    effect.World = Matrix.Identity;
    effect.View = Camera.ActiveCamera.View;
    effect.Projection = Camera.ActiveCamera.Projection;

    effect.Texture = textureLava;

    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        GraphicsDevice.SetVertexBuffer(vertexBuffer);

        GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 10);
    }
}

sentences:
Civilization Style Borders With Sprites I am making a civilization style game in Unity. The game uses square tiles and has a 2d sprite style. I am currently implementing a border system like in civ4 where a line is drawn around you civilization's borders, but I cannot find a way to create the correct sprites to draw the border.

My first thought was to have a sprite corresponding to each neighbor, the sprite would toggle on if the tile it is over is in the bordered area and the corresponding neighbor is not. This would work but It would require 8 (one for each neighbor) sprite renderers per tile and I assume that would be pretty inefficient.

I thought of making a separate sprite for each configuration to cut it down to one sprite renderer per tile but that would require 2^8 sprites which just is not feasible.

I also thought that maybe I should stick to the first idea but only instantiate or move sprite renderers to where they are needed which would greatly reduce the amount of sprite renderers used at once. This seems like my best option but it seems unnesicarily complicated and still pretty inefficient.

I do not know of any simple way to dynamicaly draw sprites to fit a pattern, so it seems I am stuck with one of these solutions. Does anyone know of a better way to handle this?

sentences:
Switching a project written in Lua to a compiled language I am experimenting with game development in Lua using the Love2D framework, and while it works fine, I am getting tired of using a dynamic scripting language. I would like to have better performance, misspellings caught at compile time, and the ability to create efficient data structures for things like 2D vectors.

I thought about some alternatives:

C++ should be very efficient, but it also would make me have to worry about low-level details like manual memory management, and compiling for different platforms.

Java is cross-platform, but as far as I know it does not support pass-by-value data structures, which I would really like. There are also the claims of it being large and slow, but I'm not sure how valid they are.

C# seems to have similar advantages and disadvantages to Java, plus it only officially supports Windows, which makes me hesitant since I mainly use Linux and would like my program to be cross-platform.

So, if my ideas about one of those languages is wrong, or you have other suggestions, I would be interested to find out.

sentences:
Unity3D object fill shader I've been researching this for a while, and had no luck yet. I figured I'd ask here to see if anyone had any good ideas.

Essentially what I want is a shader that can make only part of an object transparent based on a slider. Similar to fill effects on 2D sprites, the object would fill from the bottom up, when the slider was set to 0 the whole object would be transparent, when it was set to 50 just the bottom half would be visible, and when it was set to 100 the whole object would be visible.

I've tried various masking effects, but it would be best if I could build this in to existing shaders or have a separate mask. Is there perhaps a way to adjust the alpha on individual pixels used for the diffuse texture without incurring great performance loss?

sentences:
Why do I get compile errors in every project, even new ones, and how do I fix them? I downloaded the latest version of Unity as you can see in the snap.

I just created a new project and when I press the play button it shows compile error even if I have not created anything nor any script. I receive 4 blank errors in Unity and one non critical. I am not able to clear them except the non critical one.

sentences:
Knowledge of a Language vs. Games in Portfolio How important is the knowledge of a language versus the games that you have developed in your portfolio?

To be more specific. Personally, I dislike C++ for several reason(mainly due to it's complexity, and pointers, and I prefer D as my language of choice thus far. Due to this, I've written two games in D instead of C++ that are my personal projects. Am I wasting my time with D? Should I start using C++ again?

For reference, I have 6 months of experience in C++. It's the first language I learned. I have messed around with SDL/SFML and a bit of Direct3D with C++ as well.

Even though I like D, i'd rather not waste my time learning it, if it in no way will help me get a job in the gaming industry.

sentences:
Trace with 2D terrain I currently have some 2D terrain in my game defined by 2D coordinates with lines drawn in between them (linear interpolation too keep it simple).

Now I want to cast a ray from anywhere above the terrain and see if it collides with the terrain for drawing bullet tracers.

Here is a quickly drawn example:

sentences:
Area of surface contained in pixel Let's say I have some surface rasterized and stored to a texture. How do I calculate the actual surface area that is visible in one of the rasterized pixels, from some other location?

So far, I'm assuming it's

A_visible = A * cos(theta) / d^2

where d = distance from viewer, theta = angle between normal and viewer-surface direction, A = ... I'm not even sure how to express it. I guess you could call it the "world space area" of the pixel.

Is the above equation even correct? How do I determine "A? Notice that I'm not only looking for the area strictly as visible from the (e.g. perspective) camera. I'd also like to compute this area as visible from other surfaces, i.e. other surface areas that receive light from all around its hemisphere above the surface.

sentences:
How do I know when a player has crossed a point threshold? I’m needing help figuring out logic when adding a time bonus to my game.

I only want to reward the player with extra time if they level up.

Currently when the player’s score is less than 100 no bonus is given. If the player’s score reaches 200 I want to reward the player with some bonus time.

My issue is if the score is 190 and then jumps to 210, the 200 level mark is passed and the player isn't rewarded.

If I turn on the logic to say if the score is between 190 and 210, it could reward the player at the 190, 200, 210 mark or skip from 180 to 220, bypassing the reward altogether. I have tinkered with the idea of setting a bool BonusFlag, but the same issue arises, when I set the flag.

Can anyone help provide some logic on how to overcome this obstacle?

sentences:
Best approach to develop a mobile version of existing browser mmo game? our team has developed a MMO browser game (HTML5, Javascript & PHP). The game is similar to Empire GG, Clash of Kings, Game of War etc.

We want to develop a mobile version and the question is which would be the most efficient way/ process we can take advantage of?

sentences:
Can and should a game design be patented? I have an idea for a game that I want to develop and I feel is unique, and I'm wondering if I should patent it.  I read on the web that games can be patented, but just because it can be done doesn't mean that it makes sense to do it.

I actually don't really want patent it (it's expensive, a hassle and I don't believe in patenting of ideas... unless it's something truly revolutionary). However, I'm concerned a bigger company could come along, with more experienced game designers and developers and steal the idea.

sentences:
Load uncontrolled 3D asset at runtime in Unity I'm trying to load assets at runtime in Unity.
I can load images this way: https://docs.unity3d.com/455/Documentation/ScriptReference/Texture2D.LoadImage.html

But how can I do the same with 3D assets? From what I read, loading .fbx/.obj and alike need importers. But importers are created by users, and support might be bad.

I read you can import using https://docs.unity3d.com/ScriptReference/WWW.html
But that seems only to work with unity3D files

Or do I follow the wrong track? Is there another way to do this?

sentences:
How to create a reliable Installation Package for Windows in seconds? I am looking a reliable way to create an Installation Package for a Unity 3D Video Game.

I have just tried NSIS (Nullsoft Scriptable Install System)
But the default user interface (of the final result) appear too much old.

If you have a better method (based on script) please give an advice!

sentences:
Update the UI Rotation According to camera rotation I have a camera which is showing the userInterface (canvas) object into the front of my camera. I am only updating my userinterface position if the camera raycast is not hitting my userInterface object collider. something like this

public class UIPlacerAtCamFront : MonoBehaviour {

    public GameObject userInterface;
    public float placementDistance;
    Vector3 uiPlacementPosition;
    RaycastHit  objectHit;

    void Update () {

        Vector3 fwd = this.transform.TransformDirection(Vector3.forward);
        //Debug.DrawRay(this.transform.position, fwd * 50, Color.green);

        if (Physics.Raycast(this.transform.position, fwd, out objectHit, 50))
        {
            //raycast hitting the userInterface collider, so do nothing, userinterface is infornt of the camrea already
        }
        else
        {
            //raycast is not hitting userInterfae collider, so update UserInterface position accoding to the camera
            uiPlacementPosition = this.transform.position + this.transform.forward * placementDistance;
            userInterface.transform.position = uiPlacementPosition;
        }

        //Continuously update userInterface rotation according to camera
        userInterface.transform.rotation = this.transform.rotation;
    }
}

The above script has attached with my camera, it displaying the object correctly but as i start to rotate my camera my UI object rotation looks very strange as below image suggested

As i rotate, this problem occurs

I know that the problem is in rotation, so I tired to change my this rotation code

    userInterface.transform.rotation = this.transform.rotation;

to this

userInterface.transform.localEulerAngles = new Vector3 (this.transform.localEulerAngles.x,
            0,
            this.transform.localEulerAngles.z);

but it bring another strange rotation for me, like given below

I want that my userinteface object face my camera correclty, even my camera watching the start or end of my userinteface object. How can i rotate my UI according to camera rotation correctly?

sentences:
Crafty.js multiplayer platform game, keeping players in sync I'm using crafty.js to create a very simple platform game. It doesn't need to stop cheating, it's actually just seeing other players move around, and it doesn't need to have collision detection between players. They are "shadows".

How I've gone about it so far is to use http://pubnub.com to send messages between clients. These messages are simple. The first if a new player arrival, the second is a key down and the third is a key up.

The code is here: https://github.com/whiteoctober/craftyconcept

However I've hit against the old chestnut of keeping everything in sync.

At the moment I'm letting the each of the clients decide where to place the other players based on the received key events, I also only move "you" until I get a key press event back from pubsub. My thinking here is to try and keep things in sync!

However it isn't perfect, http://www.whiteoctober.co.uk/john/gametest/, things can get out of sync very easily. Key presses arrive in the wrong order etc.

Is there any simple solutions to this, I would like to keep it all client side (with pubnub) and not have a central server with positions etc if possible.

sentences:
How to texture a surface generated by marching cubes algorithm? I'm working on a voxel game, and I have some problems with texturing. I have read the related questions on this stack exchange, but they seem adressing a generic problem (using triplanar texturing), and I think mine is simpler.

You can see that the resulting geometry contains a limited set of polygons. Last I checked I saw only 44 of them. My idea was to uv map these polygons to a regular texture using a static map table, without having to use any triplanar texturing (currently, every polygon is mapped to the same values, so it's ugly).

My questions :

Is it valid ? It seems much simpler than triplanar texturing, but I can't find a single resource on the subject, so I'm wondering if it's a right approach.
Where can I find / How can I generate a UV map for this kind of geometrical figure ? I have tried to use blender but it seems like my blender-fu is not strong enough. Is there some simpler software to generate UV map with models like this one ?

sentences:
How can I launch the Unity Editor and open a specific project from C# code? I created a very simple console application:

namespace ConsoleApplication4
{
    class Program
    {
        static void Main(string[] args)
        {
            // The project I want to open
            var arg = @"""-projectPath C:\Users\Administrator\Downloads\New Unity Project""";

            // Start Unity and open the project
            Process.Start(@"C:\Program Files\Unity\Editor\Unity.exe", arg);
        }
    }
}

But only the Unity Editor is launched; the specified project is not opened.

What do I need to modify to launch the project?

sentences:
Render an infinite plane I wish to be able to render any Plane (Defined by a Normal and a distance from the origin).

The closest answer state to use 'Direction' (4D vectors with w = 0) with the Lengyel infinite matrix, but unfortunately it does not render anything with my implementation:

const float FOV = glm::radians(55.0f);
const float e   = 1.0f / std::tan(FOV / 2.0f);
const float a   = height / width;
const float n   = 0.1f;

this->projection = glm::mat4{
  e, 0, 0, 0,
  0, e / a, 0, 0,
  0, 0, -1.0f, -2.0f * n,
  0, 0, -1, 0
};

std::vector<Vertex> vertices =
  {
   Vertex{glm::vec4( 0.0f,  0.0f,  0.0f, 1.0f), Vector::Up()},
   Vertex{glm::vec4( 1.0f,  0.0f,  0.0f, 0.0f), Vector::Up()},
   Vertex{glm::vec4( 0.0f,  1.0f,  0.0f, 0.0f), Vector::Up()},
   Vertex{glm::vec4(-1.0f,  0.0f,  0.0f, 0.0f), Vector::Up()},
   Vertex{glm::vec4( 0.0f, -1.0f,  0.0f, 0.0f), Vector::Up()}
  };

std::vector<GLuint> indices = {0, 1, 2,   0, 2, 3,   0, 3, 4,   0, 4, 1};
// Render by indices
...

sentences:
What is a fragment in 3D graphics programming? What is a fragment in a fragment shader? Wikipedia says that:

  In general, a fragment can be thought of as the data needed to shade the pixel, plus the data needed to test whether the fragment survives to become a pixel (depth, alpha, stencil, scissor, window ID, etc.)

So is it textures, vertices or something else?

sentences:
How is money made from Steam Trading Card Farming Generators? in this SidAlpha Video, SidAlpha talks about how Valve may be doing something that could stop or interrupt Steam Trading Card Farming Generators by preventing them from generating keys.

This got me thinking. from my understanding you get Trading Cards either playing the game which gets you only so many, the rest you then need to create booster packs with Gems or buy them from the marketplace with your own funds. but what i don't get is

1) the name for this practice implies using Steam Trading Cards to make money, however i can't see how "developers" can make money as,

you have to originally own the card you're selling on the market place
when it's brought it goes to your wallet which you can't transfer Steam wallet fund off Steam

and i wouldn't think Valve would allow "developers" to create any number of trading cards for their games at will then sell them because this is obviously very easily abused

2) in the video SidAlpha mentions that reducing/blocking Key generation may have an impact to those who use Steam Trading Card Farming Generators, noting that a certain user base is actually worried it. but i'm not sure how key generation fits in to the scam.

So my question is how is money made from Steam Trading Card Farming Generators? and how do Steam Keys fit in to this?

sentences: Fast zoom in and out in Unity Editor Is it possible to zoom out and zoom in in Unity Editor in Scene View faster than just with the help of scroll wheel on the mouse? I hope there are exist some shortcut for that. Am I right?

sentences:
Unity Mask shows black content in world space canvas (Vuforia) So I've built my scroll rect, like this reference tells me to do : http://docs.unity3d.com/Manual/script-ScrollRect.html

-> Scroll View (Rect Transform with scroll rect attached)
---> Viewport (Image + Mask attached)
-----> Content (Image attached)

In scene view it looks like I want it to look like, but in play mode it looks like this, which is the correct shape, but obviously not the correct content :

Update : My Canvas

Update : The Image is getting displayed normally, when I disable the mask.

Update : The source of this problem seems to lie in Vuforia (Image/Object Tracking library) since Vuforia appends a ClippingMask to the cameras

sentences:
How public should you make your betas? I am approaching the point where I can release a playable beta of a very complex game I am making in Flash/AS3. It is fairly involved and the deepest game Ive made so far. I plan on hosting it on my personal site but I want to try and get good feedback on the game elements so far.

Is it worth it to expose this beta to as many places as possible before the release? What are good communities to do this?

Please note this will be freeware in its final release

sentences: Static Meshes vs 3D models What is the difference between static meshes and regular 3D models. I am very new to game development, and I am using UDK (Unreal Development Kit).

sentences:
Set up Blob shadow projector My game completely uses baked lighting in URP and because of URP's forward renderer, point and spot lights can't cast realtime shadows on moving characters if I set their types to mixed lighting, and my game mostly takes place indoors, so directional lights wouldn't make sense.
So now, I thought I'd use the blob shadow projector from the standard assets pack and it didn't work then I found out that it does not support URP.
Does anyone know how I can recreate the blob shadow projector for URP? Or is there another way to create fake shadows for non-static characters?

sentences:
Cover Screen with Snowing Effect in Libgdx Oddly enough I cant find clear instructions on this theme (I only found rain and the method is very particular) so I ask, how do I implement a whole-screen snow-falling effect?

The methods i can think off the bat are:

-Using LibGDX's Particle System:
But it seems like it will be overkill for some reason, i need the snow all over the screen and i have the idea that particle system is only optimized for ephemeral occasional particles (correct me if im wrong)

-Draw a giant animation that fills the entire screen
Well, it also seems quite overkill... and it sounds hackish and dirty.

Id like a smooth effect, like a snowstorm, I cant think of any optimal method nor I have great experience in particles to be honest. So, any ideas?

P.S: The game is mainly for android, which is why Im so worried about an optimal solution

sentences:
How can I control the volume of the music and the sound effects seperately with two sliders? In the Hierarchy i have one Main Camera with Audio Listener.
In the Hierarchy I have AudioPanel and two child Sliders.

And the AudioManager script that attached to the AudioPanel:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

[System.Serializable]

public class AudioManager : MonoBehaviour
{

    public Slider musicVolume;
    public Slider effectsVolume;

    private void SetMusicListenerVolume()
    {
        AudioListener.volume = musicVolume.value;
    }

    public void ApplyMusicSettings()
    {
        SetMusicListenerVolume();
    }

    private void SetEffectsListenerVolume()
    {
        AudioListener.volume = effectsVolume.value;
    }

    public void ApplyEffectsSettings()
    {
        SetEffectsListenerVolume();
    }
}

Now in the Hierarchy I have some Audio Sources components for the sound effects and I want to control them with the Slider (1).

And to control the music sound with the Slider.
The music sound have his own Audio Source.

The problem is that the AudioListener in the script control all the Audio Sources. Music and Effects. Or maybe only the Music ? U'm not sure.
But when i change both sliders when the game is running it's changing the music volume.

My question/s is how to control with Slider only the volume of the music and with Slider (1) the effects volume ?

And how can i get all the effects audio sources in the script and control the volume of them using the Slider (1) ?

The audio source component of the music is attached to GameObject name Sound.
All the other audio sources components are effects and are in some places in the Hierarchy.

sentences:
MonoGame - Fuzzy Pixels When Drawing (2D) I apologize if this has been answered somewhere; I spent quite awhile searching but couldn't find an answer.

I have any issue with my 2D sprites being drawn to the screen - either the non-moving or moving sprites will appear to have a sort of "fuzzy" texture to them. Now, this isn't an issue with me drawing to integer positions - after a bit of debugging, I found out this was an issue with my camera - it'll jump between, say, (79, 179) and (81, 181). The number is arbitrary, but it's always two pixels.

The camera follows the player's sprite, unless the player happens to be near the edge of the map - in which case, the player can move freely without the camera chasing it (so the camera doesn't show the void space outside the world). During this "free roam" space, when moving, the static entities/sprites appear normal, but the player's sprite appears fuzzy (and if the camera is following the player, the static entities appear fuzzy while the player entity appears normal). If I get the player to move around enough, what happens is that I'll be able to see the console printing out the odd values for the camera's position (as stated earlier).

My camera's update code:

    public void Update(Entity followEntity)
    {
        Vector2 moveToPos = new Vector2((int)followEntity.Position.X - 400, (int)followEntity.Position.Y - 300);
        Console.WriteLine(position);
        position = Vector2.Clamp(moveToPos, MinBounds, MaxBounds);
        transform = Matrix.CreateTranslation(-position.X, -position.Y, 0);

        inverseTransform = Matrix.Invert(transform);
    }

My player's update code automatically casts its position to an int (since Vector2's are stored in floats), but I cast it explicitly in this code while I was debugging. I also tried setting position's x and y values to ints after it clamps the value, but that didn't have any effect.

In case it helps, my draw method is as follows:

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

        spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, playerCamera.Transform);
        tileMap.Draw(spriteBatch);

        foreach (Entity e in Entity.LiveEntityList)
            e.Draw(spriteBatch);

        spriteBatch.End();
        base.Draw(gameTime);
    }

If there's anything information I could add to help you help me, please let me know. Thank you for your time!

Edit: the - 400 and - 300 values in my camera's update code are purely hardcoded values to determine the center of the screen since I was running it in 800x600, in case anyone was curious or needed to know.

As requested, a screenshot:

You can see the corners of the two squares slightly overlapping; it bounces between this and being one pixel away. The desired behavior would look as follows:

sentences:
What data structure to use to implement ocean currents and trade-winds I'm creating an RPG/simulation game which is similar to the Uncharted Waters Series. The game allows the player to control a fleet to explore and navigate the world on the world map. My Game stores the world map as a tiled map into a 2158 * 1080 2D array.

The problem I'm facing is I want to simulate the ocean currents and trade winds on the world map so when the player is sailing on the map, the speed of the fleet will be affected by the current and the wind. It does not have to be a really accurate simulation because this is not a high-detailed simulation game but it should resonably simulate the ocean currents and the wind.

Requirements:

Need to come up with a data structre to represent the ocean currents
For each point (x,y) on the map, the data structure should provide a fast way to look up what is the strengh and direction of the current at that particular point
The current can have 8 directions (N W S E NW NE SW SE).
The strengh of the current is represented as an Int
Same requirements for trade wind so I think the solution should be the same

My thoughts:

I'm thinking about dividing the world into several regions and each region can be subdivided into smaller regions like a quad tree. For look up I can do a contains(x,y) and find out which region the point is in and then for sub-regions to the same thing until it arrives a leave of the tree which stores the strengh and direction of the current.

Is that a reasonable solution or there are better ways to do this? What are the gotchas for implementing it?

Thank you for you answers!

sentences:
Can't show an object in a tapped coordinate So hi, I have a problem. I want to show an object (Texture2D) in an area tapped by user. This is my fields :

List<Texture2D> list = new List<Texture2D>();
List<Vector2> list2 = new List<Vector2>();
List<int> list3 = new List<int>();

list, is used to store the object. list2, used to store tapped coordinate. and list3, is used to store object timeout (after 100ms, the shown object vanishes)

This is my update method

protected override void Update(GameTime gameTime)
{
    TouchCollection touchState = TouchPanel.GetState();

    foreach (TouchLocation t in touchState)
    {
        if (t.State == TouchLocationState.Pressed)
        {
            list.Add(Content.Load<Texture2D>("base_grass"));
            list2.Add(new Vector2 { X = t.Position.X, Y = t.Position.Y });
            list3.Add(100);

            System.Console.WriteLine("added : " + t.Position.Y + "," + t.Position.X);
        }
    }

    for (int i = 0; i < list3.Count; i++)
    {
        list3[i]--;

        if (list3[i] <= 0)
        {
            list.RemoveAt(i);
            list2.RemoveAt(i);
            list3.RemoveAt(i);
        }
    }
    base.Update(gameTime);
}

(base_grass is the name of my object. It is a plain rectangle image)

The "for" statement is to remove the object when the time expires.

And this is my draw method

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

    _spriteBatch2.Begin();

    for (int i = 0; i < list.Count; i++)
    {
        _spriteBatch2.Draw(list[i], list2[i], new Rectangle(0, 0, 64, 64),
                Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1);
    }
    _spriteBatch2.End();

    base.Draw(gameTime);
}

Nothing shown when I clicked on the screen.

But if I change the _spriteBatch2.Draw into this

 _spriteBatch2.Draw(list[i], new Vector2((64 * 0),(64 * i)), new Rectangle(0, 0, 64,64), Color.White, 0, Vector2.Zero, 1f, SpriteEffects.None, 1);

It worked, but shown vertically, not on the tapped / clicked coordinate.

Anyone know where my problem is? Thanks

sentences:
How do you handle scripting in multithreaded environment In my experience, two approaches are preferred when people want to handle scripting in multithreaded environment.

Synchronize every accesses to scripting module with one coarse-grained lock.
No Synchronization - Scripting module should be used by just one logic thread.

Of course, both solutions are not scalable in multi-core perspective.

Question - Is there any other (multi-core) scalable solution?

sentences:
Get object length and width divided by two? I have googled and found a script for the following task; Make the camera move to touched position. However, this script will jump to x and y positions on an object, while i would like for it to move to the middle of the object, and then only be able to jump to others.

using UnityEngine;
using System.Collections;

public class TapToMove : MonoBehaviour
{
    // flag to check if the user has tapped / clicked.
    // Set to true on click. Reset to false on reaching destination
    private bool flagTouchCoords = false;
    // destination point
    private Vector3 cameraDestination;
    // alter this to change the speed of the movement of player / gameobject
    public float duration = 100.0f;
    // vertical position of the gameobject
    private float yAxis;

    void Start()
    {
        // save the y axis value of gameobject
        yAxis = gameObject.transform.position.z;
    }

    // Update is called once per frame
    void Update()
    {
        // check if the screen is touched / clicked
        if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
        || (Input.GetMouseButtonDown(0)))
        {
            // declare a variable of RaycastHit struct
            RaycastHit hit;
            // Create a Ray on the tapped / clicked position
            Ray ray;
            // for unity editor
            #if UNITY_EDITOR
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            // for touch device
            #elif (UNITY_ANDROID || UNITY_IPHONE || UNITY_WP8)
            ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
            #endif

            // Check if the ray hits any collider
            if (Physics.Raycast(ray, out hit))
            {
                // set a flag to indicate to move the gameobject
                flagTouchCoords = true;
                // save the click / tap position
                cameraDestination = hit.point;
                // as we do not want to change the y axis value based on touch position, reset it to original y axis value
                cameraDestination.z = yAxis;
                Debug.Log(cameraDestination);
            }
        }

        // check if the flag for movement is true and the current gameobject position is not same as the clicked / tapped position
        if (flagTouchCoords
        && !Mathf.Approximately(gameObject.transform.position.magnitude, cameraDestination.magnitude))
        {
            // && !(V3Equal(transform.position, endPoint))){
            // move the gameobject to the desired position
            gameObject.transform.position =
                Vector3.Lerp(gameObject.transform.position,
                             cameraDestination,
                             1 / (duration * (Vector3.Distance(gameObject.transform.position, cameraDestination))));
        }
    }
}

So this is how the game looks. The script moves correctly, but will jump at different positions when it hits the collider on the lily pads. I could reduce the collider, but I feel like there should be an easy way to get length and width of a collider, and reduce it by /2 to make the camera move directly in the middle.

Anyone care to help? Thanks in advance. :)

sentences:
How to use alpha channel with emission? I am trying to assemble scene assets and one asset needs an emission material where only the white part emits light:

I set up a texture with a simple (air-quotes) "mask" for the window...

...and tried to make only the white part emit light. This attempt blew up the entire material though (verified by checking model, adjusting intensity). I also tried plugging in the base texture directly but when I turned up the intensity, it looked like the black frame became a deeper black as well, which is not what I want.

Changing the intensity with just the white input and scalar multiplier does not reveal the black metal portion of the diamond pattern. How can I update this graph so that only the white part glows?

I want to use the texture to light the scene but may settle for filler lights, since it could be overkill. Here is the original scene I put together in Blender. The camera will be fixed like this. Note also that there are 9 other windows that emit light in this scene but are made invisible:

Thank you to everyone who takes an interest in helping me solve this problem, your time is appreciated.

sentences:
Puzzle game: clipping of non-convex polygons on the figures I have an original figure in the SVG file. I need to break it randomly on parts, an example of which is specified below:
I have an idea, to use for partitioning Voronoi diagram (Fortune's algorithm). Can I then change the line of intersection of figures to give them a curvature? Can be obtained to identify each shape as a path?
To create a game I'll be using cocos2d-x.

sentences:
Touch input not working well for mobile game made with Unity 2D I made a simple game in unity where the user taps their phone screen and the player jumps up. When I test it on my phone (not sure if this matters but it's a Samsung s9+), I tap the screen and usually the tap causes the player to jump up and fall back to the platform properly, but sometimes when I tap the screen nothing happens at all it just stays in place. The game on my phones is also very slightly laggy (although, on my computer it runs smoothly) and I'm not sure how to fix that either or if they're related.

This is the code attached to the player:

 void FixedUpdate()
 {
     Jump();
     Dead();
 }

 void Jump()
 {
     if (Input.touchCount > 0 && isGrounded)
     {
         gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0f, jumpForce * Time.fixedDeltaTime), ForceMode2D.Impulse);
     }
 }

Also, I know that it's the touch input that's the problem, because when I make it so that pressing the up arrow key on the keyboard makes the player jump, it works perfectly fine. If there's some other information about the game you'd need to know to answer my question, let me know. Thanks for your help.

sentences:
How does Mikktspace work for calculating the tangent space during normal mapping? Increasingly the 3D industry is adopting the standard of Mikktspace for calculating tangent space for normal mapping and other effects which rely on accurate and consistent calculation of tangent space from one application to another. Blender, xNormal, Unity, Substance Painter and Unreal Engine are just a few I can think of which now use Mikttspace. I'm personally attempting to re-code my own projects to adopt this standard as well.

But there are very few resources on how Mikktspace works as it is a relatively new thing. What little resources there are, are usually scarce on details and very technical, not very user friendly to understand, or assume the coder has a certain level of knowledge which is a bit above the average newbie just starting out who needs things explained more carefully.

I am looking for a clear explanation of how Mikktspace works and how to implement it, with a simple explanation of how the maths and code works in a way which is not limited to just one language.

For the sake of example, lets suppose a programmer has a mesh object, with a index of vertices, each with a position, normal and UV coordinate, and list of triangles which reference that index.

For example:

Vertex: { X Y Z NX NY NZ S T }
VertexIndex: A list of Vertex
Triangle: { V1 V2 V3 } (in correct winding order for normal direction)
TriangleList: A list of Triangle

In simple terms, how would one go about calculating per vertex a tangent vector (TX TY TZ) and bitangent vector (BX BY BZ) for each vertex in a way which conforms to Mikktspace?

sentences:
Why do I not see the back of a model in the model I have created a die in blender, that uses two materials.  One material is transparent and the second is opaque.

When I look throught the die, I expect to see the opaque parts blocking the view, but I do not see them at all.

As you can see in the image above, the 6 dots on the back of the die are not shown, it just looks like it is empty.

What can I do to fix this?

sentences:
Calculating theoretical FPS I'm unsure if this question would be more appropriate in stackoverflow, so apologies before hand if it should be moved.

Given that I know the user's hardware (Video Card, RAM, CPU, screen resolution, etc.) is it possible to make a rough estimate of the expected FPS when comparing with the game's minimum and recommended system requirements?

I see some gaming websites with those estimates and I was wondering how do they do it.

sentences:
Creating a queue for BeginInvoke method - loading chunks I have a voxel game similar to Minecraft. I have a funciton PushLoadedChunks(Direction) that pushes all of the loaded chunks forward, backward, left, right. This is done with sfd.BeginInvoke(PushLoadedChunks, null, null).

This works great until I fire two of these quickly, which happens if the user goes diagnol. It errors out because two threads are pulled trying to modify the same data, both writing to the same thing because they try to load the same chunks. I wanted to do something like this:

Create one standard thread and a queue to push through. Instead of invoking PushLoadedChunks, I wanted to add it to the queue and have that single thread work through each chunk one after another, proving to be slower performing but more stable code.

I am struggling because Invoke seems to wait for the chunks to return which works, but freezes my player until it is loaded. I need reference in creating a "queue" of sorts, or help setting up a single thread to run each method when they are called and wait until one is finished to do another.

Does anyone have  any advice or resources I could look at to see the best way to complete my task?

sentences:
How to calculate the magnitude of the drag in Corona-sdk? I'm making a game on Corona that launches a ball.

The force is based on the magnitude of the drag: the larger is the drag -> the higher is the force.

I'm having some trouble to do this, because I can't calculate the magnitude of the drag.

I tried a simple (finalX - initialX) but that's not a good idea.

local function onTouch(event)

    if "began" == event.phase then

    end
    if "ended" == event.phase then
        local finalX = event.x
        local finalY = event.y

        forceX = event.x - event.xStart
        forceY = event.y - event.yStart

        print(forceX, forceY)

    end
end

local function gameComponents()
    local crate = display.newImageRect( "images/sonic.png", 90, 90 )
    crate.x, crate.y = 60, 360
    crate.rotation = 0
    --physics.addBody( crate, "static", { friction=0.3} )

    Runtime:addEventListener( "touch", onTouch )
    return crate

end

local Game = {}
Game.new = gameComponents
return Game

sentences:
Displaying sprites in a 2.5D raycasting engine I'm developing a raycasting engine like the one used in DOOM, Wolfenstein 3D, etc.

My engine is capable of correctly displaying walls and textures on walls, but I'm stuck at sprites rendering.

Given that my engine is based on lines and angles only (just trigonometry), is there a way to render sprites without going for matrices? And if so, which technique should I use?

sentences:
Phong lighting model - R vector In Phong lighting model a vector R is used to calculate the spectral component of light. The equation used to obtain it is

R = 2(N•L)N - L

I can't understand why we use this equation. Could someone give me a demonstration of how we obtain this equation?

sentences: How to scale objects and tiles without doubling view port in gamemaker How do I scale up tiles and sprites without acully making the view port larger than the acual view? I know that I can just scale up the images and the tileset but there must better alternative right? The reason why I dont want to make the port bigger is because then I get this kind of "pixel perfect" behaviour so 1 pixel on the image is one pixel on the screen (So it looks kind of choppy). I'm thinking I can use the draw event if there's no other alternative but how would I do that with the tileset?

sentences:
Swapping Y and Z in quaternion I am converting between coordinate systems where Z is the vertical axis in one, and Y in another. I have the rotation values represented as a quaternion.

I see this related issue but it's switching the handedness (DirectX and OpenGL): Switch axes and handedness of a quaternion?

How would I go about swapping these values? I'd prefer not to convert to a vector3, modify and convert back again.

sentences:
Process of writing to the depth texture In openGL, let's say I output one single point from the vertex shader with this value

gl_Position = vec4(2.0,3.0,5.0,7.0);

what exact math operations happen to "z" after leaving the vertex shader?
what will be the end value of that depth texel?

sentences: Mouse Input Unexplained Behavior Unity3D Input.GetMouseButtonDown(0.....6); - in documentation it says that you can pass, 0, 1, 2 as parameter. Input.GetMouseButtonDown. It doesn't accept negative numbers like -1 or numbers 7+. What does 3 4 5 6 do? What input are they calculating? Or can I use these numbers as default for None state? I couldn't find any information about this.

sentences:
Pixelated and incomplete image when loading with pygame.image.load This is the image I'm trying to load on the surface, an 40x40 Ubuntu logo:

Ans this is how it looks when trying to show the image on the surface via the blit method:

I'm trying to load different Linux logos, the majority have PNG extension and a couple of GIF. The Ubuntu logo is a PNG image, it's weird that the other PNG and GIF images load just fine (Ubuntu and Kubuntu logo are the exceptions, they look pixelated and incomplete).

This is how my code looks like (I'm just starting with pygame):

#-*- coding: utf-8 -*-
import sys
import os
import random
import pygame
from pygame.locals import *

PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
LOGOS_DIR = os.path.join(PROJECT_DIR, 'data/images/logos')
WINDOW_WIDTH = 640
WINDOW_HEIGTH = 480
FPS = 30

# Colors
WHITE = (255, 255, 255)

BACKGROUND_COLOR = WHITE

pygame.init()
MAIN_SURFACE = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGTH))
CLOCK = pygame.time.Clock()

def get_linux_logos():
    logos = []
    for img in os.listdir(LOGOS_DIR):
        try:
            logos.append(pygame.image.load(os.path.join(LOGOS_DIR, img)))
        except pygame.error, e:
            continue
    random.shuffle(logos)
    return logos

def main():
    pygame.display.set_caption('Geezle - Memory Puzzle')
    MAIN_SURFACE.fill(BACKGROUND_COLOR)
    LINUX_LOGOS_IMGS = get_linux_logos()[:12]

    while True:
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()

        MAIN_SURFACE.blit(LINUX_LOGOS_IMGS[0], (300, 220))
        pygame.display.update()
        CLOCK.tick(FPS)

if __name__ == '__main__':
    main()

sentences:
Stuck on development of turn-based-strategy game I am developing a turn based political/military strategy game similar to the DOS game Conflict.  I have my game design document completed, but I'm having trouble actually putting together the logic of the turns.

How do I determine the strengths/weakness of the various nation-states in my game?  Is there a common set of mathematical formulas somewhere on the interwebs that I can modify?  Or do I need to come up with my own?

If I do need to come up with my own, how do I go about doing this?  I have very limited experience playing games like Dungeons and Dragons and Settlers of Catan--would it be a good idea for me to buy a copy of a board game that is similar to my idea and model my game off that?

sentences:
How do I make a sprite move to another position using vectors Ok, so far I have made the sprite move to a mouse position. But I got a question, does anyone know how to make a sprite move by itself without the use of a mouseclick from Point a to point b using vectors? In which then the sprite stops after reaching point B.

def calcMoveVector(self):
    movetopos = self.posto
    currentpos = self.rect.center
    directtoX = movetopos[0]-currentpos[0]
    directtoY = movetopos[1]-currentpos[1]

    vect = pygame.math.Vector2(10, 10)
    if vect.length() > 0: self.vector = vect.normalize()
    return vect

    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            sys.exit()

        if event.type==pygame.MOUSEBUTTONDOWN:
            mpos = pygame.mouse.get_pos()
            r = pygame.rect.Rect(mpos[0],mpos[1],10,10)
            buttons=pygame.mouse.get_pressed()

            if buttons[0]==True:
                c = pygame.color.THECOLORS["green2"]
                pygame.draw.rect(screen,c,r)
                monster.posto = mpos
                monster.state = Monster.MOVETO
                monster.speed=3

sentences: What are typical pitfalls when writing games with a managed Language like C#? What pitfalls did you encounter when writing games for the PC with a managed Language like C# and how did you solve them?

sentences: Unity Ragdoll moves away from parent So this is a weird one. I've looked it up but can't find anyone with similar issues. Basically I have a simple combat system and after the enemy health is zero I go through each rigidbody component in the enemy object and add a force to make it go flying on death. For some reason, the parent object isn't affected and stays still while the Skeleton goes flying. Does anybody know how to make the parent object follow the skeleton, or make the skeleton follow the parent because as of now they act as separate entities? I've tried just adding force to the parent but that only moves the parent object and none of the children. Would appreciate any advice! Thanks.

sentences:
SDL2 C++ How to make enemy move in random directions How do i make an Enemy move in random directions?
I tried this but it doesnt work how i want it to.. thats why im asking what i need to do, to achieve that? (Pseudo code would be cool)

 void Enemy::Update()
{
    Timer += Timer->GetTimeElapsed();
    int Random = (rand() % 4);
    if (Timer >= 2.0f)
    {
        switch (Random)
        {
        case(0):
            m_xPos += 10.0f * Timer->tElapsed();
        case(1):
            m_xPos -= 10.0f  * Timer->tElapsed();
        case(2):
            m_yPos -= 10.0f  * Timer->tElapsed();
        case(3):
            m_yPos += 10.0f  * Timer->tElapsed();
        }
    }
}

Thank you

Edit: This is the movement i get so far.

sentences:
Collision detection errors I have a list of game objects I'm trying to check collision against. My collision system is using code ive seen posted here before, but I'm not sure where I'm going wrong here.

 private bool Intersects(Rectangle player, Rectangle other, CollisionDirection direction, out Vector2 depth)
    {
        if (direction == CollisionDirection.Vertical)
        {
            depth = new Vector2(0, GetVerticalIntersectionDepth(player, other));
        }
        else
            depth = new Vector2(GetHorizontalIntersectionDepth(player, other));

        return depth.Y != 0 || depth.X != 0;
    }

    public float GetHorizontalIntersectionDepth(Rectangle rectA, Rectangle rectB)
    {
        float halfWidthA = rectA.Width / 2;
        float halfWidthB = rectB.Width / 2;

        float centerA = rectA.Left + halfWidthA;
        float centerB = rectB.Left + halfWidthB;

        float distanceX = centerA - centerB;
        float minDistanceX = halfWidthA + halfWidthB;

        if (Math.Abs(distanceX) >= minDistanceX)
            return 0;

        return distanceX > 0 ? minDistanceX - distanceX : -minDistanceX - distanceX;
    }

    public float GetVerticalIntersectionDepth(Rectangle rectA, Rectangle rectB)
    {
        float halfWidthA = rectA.Height / 2;
        float halfWidthB = rectB.Height / 2;

        float centerA = rectA.Top + halfWidthA;
        float centerB = rectB.Top + halfWidthB;

        float distanceX = centerA - centerB;
        float minDistanceX = halfWidthA + halfWidthB;

        if (Math.Abs(distanceX) >= minDistanceX)
            return 0;

        return distanceX > 0 ? minDistanceX - distanceX : -minDistanceX - distanceX;
    }

    private void CheckCollisions(CollisionDirection direction, List<GameObject> objects)
    {
        foreach(GameObject obj in objects)
        {
            Vector2 depth;
            if(Intersects(CollisionRectangle, obj.g_CollisionRectangle, direction, out depth))
            {
                g_WorldPosition += depth;
                Debug.WriteLine("true");
                if (direction == CollisionDirection.Horizontal)
                    g_Velocity.Y = 0;
                else
                    g_Velocity.X = 0;
            }
        }
    }

And in my update method I do this.

....
if(ks.IsKeyDown(Keys.S))
        {
            g_WorldPosition.Y += 10f;
            playerFacing = Direction.DOWN;
            CheckCollisions(CollisionDirection.Vertical, objectList);
        }
        if(ks.IsKeyDown(Keys.A))
        {
            g_WorldPosition.X -= 10f;
            playerFacing = Direction.LEFT;
            CheckCollisions(CollisionDirection.Horizontal, objectList);
        }
...

In the CheckCollision method the Debug line is writing true to the output even when i'm not colliding with anything. I know the g_CollisionRectangle is being set correctly because I have lines being drawn around the outside of each collidable object.

What happens is my player kinda moves sporadically because I'm getting collisions in places where I shouldnt.
Can anyone see where I'm going wrong here? I realize that g_Velocity is not being used in my update method, but I don't think that it should effect what is happening at this point. From what I can tell, my GetVertical and GetHorizontal methods are wrong somewhere because of the Debug line in the CheckCollision method.

sentences:
How do I pack my game LWJGL game into a single executable JAR with Maven? I am trying to use Maven to manage building my LWJGL projects. The entire project needs to be packed into a single executable jar, dependencies, natives and resources included, so that can be easily distributed. I have been using JarSplice to do this until now.

Is it possible to do the same with Maven?

My attempts thus far have failed: either the main class/natives could not be located or OpenAL would crash when I tried to execute the jar file.

My current pom.xml is below:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>Sidian</groupId>
<artifactId>LWJake2</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>LWJake2</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <mainClass>Main</mainClass>

    <lwjgl.version>2.9.3</lwjgl.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.lwjgl.lwjgl</groupId>
        <artifactId>lwjgl</artifactId>
        <version>${lwjgl.version}</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
    </plugins>
</build>

sentences:
What are perimeter and aspect ratio, in the context of 3D mesh approximate convex decomposition? I'm trying to understand the logic behind Mamou and Ghorbel's algorithm in their paper A Simple And Efficient Approach For 3D Mesh Approximate Convex Decomposition.

I cannot understand what is the aspect ratio of a surface as defined by the author. It includes the perimeter of two vertices v and w. These two vertices represent two triangles in the original mesh as they come from the dual graph as the authors define it. So I'm guessing they are talking about the perimeter of the two triangles these vertices correspond to. What is the perimeter of two triangles? Do they mean the sum?

The algorithm proceeds like this:

Create a dual graph of the mesh, where each vertex corresponds to a triangle of the original mesh, and two vertices are connected by an edge iff their corresponding triangles share an edge.
Iteratively choose and collapse an edge, so that two vertices are merged into one. We keep track of the "ancestors" of each vertex, A(v) that have been merged into it in this way.

Here's where I get confused:

  The decimation process described in the previous section is
  guided by a cost function describing the concavity and the
  aspect ratio [5] of the surface \$S(v, w)\$ resulting from the unification
  of the vertices \$v\$ and \$w\$ and their ancestors:

  $$S(v, w) = A(v) ∪ A(w) ∪ {w, v}. (2)$$

  As in [5], we define the aspect ratio \$E_{shape}(v, w)\$ of the
  surface S(v, w) as follows:

  $$E_{shape}(v, w) = \frac{ρ2(S(v, w))}{4π × σ(S(v, w))}, (3)$$

  where \$ρ(S(v, w))\$ and \$σ(S(v, w))\$ are respectively the perimeter
  and the area of \$S(v, w)\$.

sentences:
Disabling impact damage by Kinematic actor on non-dynamic destructibles (using NVidia APEX) I have a destructible non-dynamic object at Apex scene and am hitting the object with a kinematic actor. I do not want it to be fractured by these impacts. Is it possible?

PS: the impact damage is off when the destructible is dynamic. I have tried below settings:

physx::apex::NxDestructibleParameters destructibleParameters =
                                          destructibleActor->getDestructibleParameters();
destructibleParameters.forceToDamage = 0;
destructibleParameters.damageCap = 0;
destructibleParameters.impactVelocityThreshold = PX_MAX_F32;
destructibleParameters.impactDamageDefaultDepth = -10;
destructibleActor->setDestructibleParameters(destructibleParameters);

sentences:
Skeletal animation in OpenGL I'm using Assimp to do skeletal animation in my OpenGL application.

I used Blender to export this one-boned model to a COLLADA file:

The model has only one bone, called arm bone, that controls the arm mesh. All the other meshes are static.

I made several structures and classes that help me play animations.
All the nodes are added to an std::vector of Node objects. each Node contains aiNode data and a toRoot matrix.
The bone hierarchy is encapsulated in a Skeleton class, and the animation matrix (T * R) are updated for each bone in a class called Animation.

My Model::Draw() function is this:

void Model::draw()
{
    //iterate through all animation sets. if the animation is running, update the bones it affects.
    for(size_t i = 0; i < _animations.size(); i++)
        if(_animations[i].running())
            _animations[i].updateAnimationMatrices(&_skeleton);

    //calculate Bone::finalMatrix for each bone
    _skeleton.calculateFinalMatrices(_skeleton.rootBone());

    //iterate through the nodes and draw their meshes.
    for(size_t i = 0; i < _nodes.size(); i++)
    {
        _shaderProgram.setUniform("ModelMatrix", _nodes[i].toRoot());

        _nodes[i].draw();
    }
}

To get the "animationMatrix" for each bone (the TR matrix) I call Animation::updateAnimationMatrices().
Here's what it looks like:

void Animation::updateAnimationMatrices(Skeleton *_skeleton)
{
    double time = ((double)_timer.elapsed() / 1000.0);
    while(time >= _animation->mDuration) time -= _animation->mDuration;

    //iterate through aiNodeAnim (called channels) and update their corresponding Bone.
    for(unsigned int iChannel = 0; iChannel < _animation->mNumChannels; iChannel++)
    {
        aiNodeAnim *channel = _animation->mChannels[iChannel];
        Bone *bone = _skeleton->getBoneByName(channel->mNodeName.C_Str(), _skeleton->rootBone());

        //rotation
        glm::mat4 R = ... //calculate rotation matrix based on time

        //translation
        glm::mat4 T = ... //calculate translation matrix based on time

        //set animation matrix for the bone
        bone->animationMatrix = T * R;
        bone->needsUpdate = true;
    }
}

Now in order to calculate the "finalMatrix" for each bone (based on animationMatrix, offsetMatrix etc..), and upload it to the vertex shader, I call Skeleton::calculateFinalMatrices().

void Skeleton::calculateFinalMatrices(Bone *root)
{
    if(root)
    {
        Node *node = _getNodeByName(root->name->C_Str());
        if(node == nullptr) {
            std::cout << "could not find corresponding node for bone: " << root->name->C_Str() << "\n";
            return;
        }

        if(root->needsUpdate) //update only the bones that need to be updated (their animationMatrix has been changed)
        {
            root->finalMatrix = root->animationMatrix * root->offsetMatrix;

            //upload the bone matrix to the shader. the array is defined as "uniform mat4 Bones[64];"
            {
                std::string str = "Bones[";

                char buf[4] = {0};
                _itoa_s(root->index, buf, 10);

                str += buf;
                str += "]";

                _shaderProgram->setUniform(str.c_str(), root->finalMatrix);
            }

            root->needsUpdate = false;
        }

        for(unsigned int i = 0; i < root->numChildren; i++)
            calculateFinalMatrices(root->children[i]);
    }
}

Here's my bone structure, if it helps.

My glsl vertex shader is pretty standard. Here it is.

And finally, here's the result I get: (ignore the model's static legs. that must be some bug in the Blender exporter).

And here's the result I should get: (using a 3d party software)

It looks like there's something wrong with the bone's matrix calculation, although I don't know what. Any ideas or tips?

Thanks!

sentences:
2D Rivers/Lakes in infinite terrain I've been looking into generating lakes and rivers for a 2D infinite tilemap but I'm stuck with how to handle them for an infinite map.

I can use noise/heightmaps for determining the lakes and the starting points for rivers but for an infinite map I can't use the  "flow downhill" or "carve out" technique because the player could come across the river at any point.

If I have a river that's a max of 200 tiles long, I'd have to calculate noise/map values for 33x33 chunks (my chunks are 6x6 tiles) around the player which feels excessive and very inefficient.

I have not found a way to make noise alone work for this, rivers would always be too circular if I find a range narrow enough and they'd encircle lakes, not extend outward.

Calculating voronoi cells and putting rivers at certain edges, with some extra noise to make the paths more natural, might work.

I just can't seem to find any good examples where they aren't working with known-dimension maps.

sentences:
libgdx ActorGestureListener.pan() parameters not moving actor in smooth line I override the pan method in ActorGestureListener to implement dragging actors in libgdx (scene2d).

When I move individual pieces on a board they move smoothly, but when moving the whole board, the x and y coordinates that is sent to pan is "jumping", and in an increasingly amount the longer it is dragged.

These are an example of the deltaY coordinates sent to pan when dragging smoothly downwards:

 1.1156368
-0.13125038
-1.0500145
 0.98439217
-1.0500202
 0.91877174
-0.984396
 0.9187679
-0.98439026
 0.9187641
-0.13125038

This is how I move the camera:

public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) {
    cam.translate(-deltaX, -deltaY);

I have been using both the delta values sent to pan and the real position values, but similar results. And since it is the coordinates that are wrong, it doesn't matter whether I move the board itself or the camera.

What could the cause be for this and what is the solution?

When I move camera only half the delta-values, it moves smoothly but only at half the speed of the mouse pointer:

cam.translate(-deltaX / 2, -deltaY / 2);

It seems like the moving of camera or board affects the mouse input coordinates. How can I drag at "mouse speed" and still get smooth movements?

(This question was also posted on stackoverflow: https://stackoverflow.com/questions/20693020/libgdx-actorgesturelistener-pan-parameters-not-moving-actor-in-smooth-line)

sentences:
canvas ball physics animation I want to animate ball in html canvas like this.

ctx.beginPath();
ctx.arc(75, 75, 10, 0, Math.PI*2, true);
ctx.closePath();
ctx.fill();

start position is left top corner and ball's maximum height position is always the same

also I don't want to use javascript physics libraries

thanks

sentences:
LibGdx - How can I correctly handle tile transitions / connected textures? So I am making a tiled game and I need to connect textures correctly based on whats next to it.

With tiles that had connection really close to the edge of the tile I could just use the 4 bit meathod ie:

x 1 x
8 x 2
x 4 x

But for tiles with more detail I need to have corners too. I have seen people use the 8 bit meathod ie:

1   2  4
128 x  8
64  32 16

But really I can only see 48 different tile combos.

Is there a way I can separate corners and u d l r. Something like this:

x 1 x  8 x 1
8 x 2  x x x
x 4 x  4 x 2

Or is there a better way all together to do this.

This is what I have tried so far but this only uses 32/48 tiles and doesn't work for special corner cases.

public class RockTile extends Tile {

int y;

public RockTile(int id) {
    super(id);
    y = 7;
}

public TextureRegion getTexture(Level level, int xLoc, int yLoc){

    int u = (level.getTile(xLoc, yLoc + 1) != this) ? 1 : 0;
    int r = (level.getTile(xLoc + 1, yLoc) != this) ? 2 : 0;
    int d = (level.getTile(xLoc, yLoc - 1) != this) ? 4 : 0;
    int l = (level.getTile(xLoc - 1, yLoc) != this) ? 8 : 0;

    int bit = u + r + d + l;

    int ur = (level.getTile(xLoc + 1, yLoc + 1) != this) ? 1 : 0;
    int dr = (level.getTile(xLoc + 1, yLoc - 1) != this) ? 2 : 0;
    int dl = (level.getTile(xLoc - 1, yLoc - 1) != this) ? 4 : 0;
    int ul = (level.getTile(xLoc - 1, yLoc + 1) != this) ? 8 : 0;
    int corner = ul + ur + dl + dr;

    if (bit == 0) {
        if (corner != 0)
            return Game.splitTiles[y + 1][corner];
        else
            return Game.splitTiles[y][bit];

    } else {
        if (corner != 0)
            if (dl > 0 && l == 0 && d == 0)
                return Game.splitTiles[y + 2][bit];
            else
                return Game.splitTiles[y][bit];

        else
            return Game.splitTiles[y + 2][bit];
    }

}

}

If you need anything else let me know.

EDIT: Side question because I've seemed to have stumped you guys. If I decided to use the 8 bit method what would be the best and fastest way to make a lookup table for that.

sentences:
How do I create a Physx heightfield from a model triangle mesh? My question is clear: I have a mesh defined by its vertices, index... I want to transform it to a heightfield, if someone can provide some example or link to, I will really appreciate.
Thank you very much

sentences:
Slick2D and Nifty GUI I am currently trying to combine both slick2d and nifty to work together. I've had some amount of success - I can now actually run my test and it won't crash. As far as I can tell, it will also receive input properly.

First, I'm having doubts I'm doing it right. I extend NiftyStateBasedGame in my outer game and then I extend two NiftyOverlayGameState to create the two states. However, I am getting an error that doesn't crash my application saying:

WARNING: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
org.bushe.swing.event.EventServiceExistsException: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
    at org.bushe.swing.event.EventServiceLocator.setEventService(EventServiceLocator.java:123)

I could ignore it, since the application is running well enough (I think?) but I'm concerened that once I figure out how to actually implement some parts of the GUI they might not work.

Which leads me to my next question. I was trying to create a simple button on screen and I could not for the life of me figure out how to go about it. I have my nifty instance... But what do I do with it? Any pointers in the right direction would be greatly appriciated!

My three classes:

The outer class, TheGame (This is the StateBasedGame)

public class TheGame extends NiftyStateBasedGame
{

    Menu menu;
    Nifty nifty;
    GameOver go;

    public TheGame(String name)
    {
        super(name);
        menu = new Menu();
        go = new GameOver();

    }

    @Override
    public void initStatesList(GameContainer arg0) throws SlickException
    {
        this.addState(menu);
        this.addState(go);

    }

    public static void main(String[] args) throws Exception
    {
        AppGameContainer game = new AppGameContainer(new TheGame("OMG, Super test!"));

        game.setDisplayMode(800, 600, false);
        game.setAlwaysRender(true);

        game.start();

    }

And the two dummy classes the are the states:

public class Menu extends NiftyOverlayGameState
{
    @Override

    protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException
    {
        initNifty(gc, sbg);
    }

    @Override
    protected void renderGame(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException
    {
        g.drawString("Does it work?", 100, 100);

    }

    @Override
    protected void updateGame(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException
    {
        Input input = gc.getInput();
        if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON))
            sbg.enterState(1);
    }

    public int getID()
    {
        return 0;
    }

public class GameOver extends NiftyOverlayGameState
{

    protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException
    {
        initNifty(gc, sbg);
    }

    @Override
    protected void renderGame(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException
    {
        g.drawString("WORKS, OOOH-YEA!", 100, 100);
    }

    @Override
    protected void updateGame(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException
    {
        Input input = gc.getInput();
        if (input.isMouseButtonDown(Input.MOUSE_RIGHT_BUTTON))
            sbg.enterState(0);
    }

    public int getID()
    {
        return 1;
    }

Again, if compiled, this gets me the two screens I want with the warning/exception I mentioned above. What am I doing wrong? And how would I start actually adding GUI elements to this?

sentences:
Libgdx: How to rotate a button on main menu How to keep rotating a button on main menu screen around its center, here's the code for the button

final ImageButton btnSett=UIFactory.createButton(txtrSettings);
btnSett.setScale(1,1);
btnSett.setPosition(Gdx.graphics.getWidth()/ 2,0.f, Align.center);
stage.addActor(btnSett);

sentences:
MonoGame: 2D Sprite acting weirdly I have a double array of tiles that show the ground.
They are randomly populated with a variety of items.

one item that only spawns one is a creature spawner.

this spawner spawns up to 5 creatures (for testing it does all 5 immediately).

these creatures move around randomly every update.

i know for a fact they are moving independent of each other.

but the weird part is, sometimes i only see 1 or 2 of the 5. the others arent there. console output tells me there is in fact 5.

and, additionally, when there is all 5, some of them get cut off if they move too far in one direction. but only SOME of them. ive seen two different creatures move in the same direction and only one of them got cut off.

to further complicate things, i believe some of the items on the ground are disappearing shortly after the world is created, including the spawner. sometimes i never even see the spawner, but the creatures are still created 'properly'.

i have in the initialization section to randomly generate the world, including all the items and where the spawner is.

after that is done, in the Update section, it checks if a tile contains an updateable object (currently, spawner is the only one). if it does, that objects calls its update method.

after that is done, the creatures are updated, if any.

then it is drawn. background tiles then ground objects then creatures.

if anyone has any idea what i might need to change to fix it or require any further information, just let me know, and thanks in advance!

sentences: How to show iPad keyboard? I am developing a game, a word game. I have UIView, in this I have to show the keyboard, without using UITextField. Could you please suggest me something on how to do this?

sentences:
Why does duplicating my object cause its vertex animation shader to distort it? I used a vertex shader (based on this example) to animate a flag waving. When I have a single flag in my scene, it works correctly.

When I duplicate the flag, all of the copies become wildly distorted after I hit play.

Here is the shader code I'm using:

Shader "Custom/Flag" {
    Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _Speed ("Speed", Range(0, 5.0)) = 1
        _Frequency ("Frequency", Range(0, 1.3)) = 1
        _Amplitude ("Amplitude", Range(0, 5.0)) = 1
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        Cull off

        Pass {

            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            sampler2D _MainTex;
            float4 _MainTex_ST;

            struct v2f {
                float4 pos : SV_POSITION;
                float2 uv : TEXCOORD0;
            };

            float _Speed;
            float _Frequency;
            float _Amplitude;

            v2f vert(appdata_base v)
            {
                v2f o;
                v.vertex.y +=  cos((v.vertex.x + _Time.y * _Speed) * _Frequency) * _Amplitude * (v.vertex.x - 5);
                o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
                o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                return tex2D(_MainTex, i.uv);
            }

            ENDCG

        }
    }
    FallBack "Diffuse"
}

How can I make this work with multiple flags using the same material?

Should I use a new material instance for each object like this? It doesn't seem optimal:

    material = new Material (Shader); // Create new material
    material.SetFloat ("_Speed", _Speed);
    material.SetFloat ("_Frequency", _Frequency);
    material.SetFloat ("_Amplitude", _Amplitude);
    material.SetTexture ("_MainTex", _MainTex);
    flagObj.GetComponent<MeshRenderer>().sharedMaterial = material; // Set values

sentences:
Difference between Object.Destroy() and GameObject.Destroy() in Unity What is the difference between using Object.Destroy() and GameObject.Destroy() in Unity?

I found the following info about that: here and here, but it did not answer my question.

So, could someone explain the matter foolproof, please?

sentences: Unity - how to remove standard sky but keep the lighting? How can I remove the standard Unity sky (to have an empty space with no texture around my scene), but keep all the lighting effects from it?

sentences:
Further improvement on algorithm A * i have a game use A*, this algorithm find path is good in many case.

But if I could not find the way to the destination, it would have to go through many nodes (my map is in gird format). I am looking for an algorithm to know that if I cannot find the way to the destination, A * algorithm will not work to avoid wasting CPU or then my object will only go straight to the target, when it collision with an object, it will stop. I saw a game like Age of Empires, when the farmer was locked in between the 4 walls, which meant he couldn't go out. If I want him to go to a point outside those four walls, he just goes straight to that point and stops when he hits a wall. If the 4 walls have a hole, he will go there and get there]1
[]2

Thanks everyone !

sentences:
Software Design/Modelling method and tool for games? 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?

sentences:
Room generation with external walls and doors I am looking to implement a means to generate rooms with outer walls with windows and doors from prefab game objects in Unity.

The idea is that a group of tiles is defined as a room which I then iterate through to find the outer tiles and then use their external edges to generate the walls of the entire room. Gathering the outer tiles is easy enough and working out the external edges is already implemented.

What I need to understand is the best approach for using prefab game objects as the set pieces for walls and floors.

Currently for a single wall piece, I have created a quad and made that into a prefab which I then clone, position and rotate into place along the outer edges. The below screenshot shows a room with walls made using the prefab wall GameObject. In this screenshot, the room consists of 12 wall GameObjects. I want to avoid having lots of GameObjects for single wall segments and instead perhaps merge them all into a single mesh on a single GameObject.

What I would like to achieve is to be able to create a consistent set of pieces for each outer wall, with windows and doors (most likely cloned from other prefabs) to build a realistic looking room. For example, any single length of a wall would be made up from

Wall -> Wall -> Window -> Wall -> Wall

Perhaps there is a much easier way to achieve this that I have overlooked but searching for room generation always leads back to examples for dungeon crawlers and roguelikes. I am not creating a dungeon crawler, nor am I generating the environment proceedurally, instead the player will be able to create rooms in a similar fashion to Evil Genius and The Sims.

In the current approach, creating a room which is 5x5 would mean that there are a total of 20 wall GameObjects and 25 floor GameObjects. I am not keen on having this many objects in the scene for a single room. I would prefer to be able to create a mesh for the entire room, adding in the vertices and triangles from the prefab mesh to cut down on the number of GameObjects in the scene.

Does anyone have any experience with building rooms in this fashion, or are there any clear examples of how to achieve this? I am not sure how to translate and rotate a prefab and then merge the translated meshes into a single mesh. Perhaps I am barking up the wrong tree and there is a better approach but for now, this is the only way I can see which is possible to achieve what I want.

sentences:
Why is my client laggy despite 60 update packets a second? I am developing a small multiplayer game with XNA. It's a usual client-server architecture -- I have a server and many clients communicating with it through UDP (via .NET's Socket class). These clients send data to the server (for example, the player's position) and the server handles it and decides what to do (send it to every other client or drop it).

What's the most efficient "correct" way to send position of moving object from a client to a server? Currently, I send the client's ID and player position 60 times a second (XNA's default update rate) while a player is moving. When I see my own player on the screen, it moves very smoothly, but other don't, despite every client having the same update rate. What am I doing wrong?

sentences:
How to achieve "concept art" graphics? I'm currently working on a 3D Game and I want a unique graphic style.

Concept Arts have a cool "painted" look. You can clearly see that this picture is painted on a graphic tablet.
(https://i.stack.imgur.com/pnyzB.jpg) - Source: Destiny Concept Arts

How can you achieve that kind of graphics?
I guess you draw the texture just like the concept art and apply a light cel-shader?

sentences:
What should i use as a board for my game? I'm a beginning programmer and i need to make a game. The rough idea revolves around fleets fighting in turn based battles while you control your factions resources and manpower.

The original concept was to make a set of routes which the fleet could follow. A graph of location nodes connected by route edges that looks a bit like this:

I don't know how to make a map and make set locations on it.

On that note, i'm making this is html/javascript/css. This is a school assignment.

sentences:
Mathematics: matrix-to-quaternion conversion in left-hand coordinate system I am implementing a typical skeletal animation system, and it requires the usage of quaternion to interpolate rotations between each poses. The asset I import only has a transform matrix for each joint, so I need code to convert a rotation matrix to a quaternion. However, my game is in left-hand system, and most code snippet online out there are for right-hand system only. I tried the code for such conversion in a right-hand system from this gamasutra post. The animation interpolates correctly in some cases, but most of the time it's not working correctly, and here's the symptom:

Say I am animating a guy, in the first key frame he is in bind pose, and in the second key frame he's supposed to raise his right arm by 30 degrees. If my system interpolates the rotation correctly, his arm would slowly raise up to 30 degrees in the interval, maybe first frame it's 10 degrees, then its 15 degrees, and eventually 30 degrees. However, with the code I have, the guy's arm is rotating the longest path. First frame, the guy's arm rotates -30 degrees, then -60 degrees, and comes to the same place to where 30 degree is. Can anyone give me the code snippet that's equivalent to the gamasutra one, but for left-hand coordinate system? Thanks!

sentences:
How can I animate shadow in surface shader? I wrote wind shader that works but as you can see it have shadow problem!
when I animating vertices shadow is fixed!

Shader "Smkgames/Wind Shader" {
        Properties{
            _MainTex("Albedo and alpha (RGBA)", 2D) = "white" {}
            _BumpTex("BumpTex",2D) = "bump"{}
            _WindMap ("WindMap", 2D) = "white" {} // Add noies map like fbm noises
            _Cutoff ("Cutoff", Range(0,1)) = 0.5
            _Speed("Speed",float) = 1
            _Direction("Direction",Vector) = (0,0.2,0,0)
        }

        SubShader{
            Cull Off

            Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "TransparentCutout" "DisableBatching"="True" }
            LOD 200

            CGPROGRAM
            #pragma surface surf Standard alphatest:_Cutoff vertex:vert

            #pragma target 3.0

            sampler2D _MainTex,_WindMap,_BumpTex;
            fixed4 _Direction;
            fixed _Speed, _WindAmount;
            half _Glossiness, _Metallic;
            fixed4 _Color;

            void vert(inout appdata_full v) {
            float4 tex = tex2Dlod(_WindMap, float4(v.texcoord.xy + (_Time.x * _Speed), 0, 0));
            v.vertex.xyz += tex.y *  _Direction.xyz * _Speed;
            }

            struct Input {
                float2 uv_MainTex;
                float2 uv_BumpTex;
            };

            void surf(Input IN, inout SurfaceOutputStandard o) {
                fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
                o.Albedo = c.rgb;
                o.Alpha = c.a;
                o.Normal = UnpackNormal(tex2D(_BumpTex,IN.uv_BumpTex));
            }
            ENDCG
        }
                FallBack "VertexLit"
    }

I couldn't fix it! so I tried to add shadow to my object from scratch by using vertex and fragment shader shadow caster and worked correctly but I want know
Is there a way to fixing this problem in surface shader?

sentences:
Angle range detection I'm trying to make game like portal which players can transform between two holes.
My problem is, how to detect if player's have the right angle to the hole. (hole has an angle to a direction, if player's angle to hole meet the right direction can do transform)

Pseudo code:

var range=30;
 if(collission){
     if(abs(ball.getAngle()-player.getAngle())<=range){
            ball.doTransform(player);
     }
 }

below is some situation:

ball.setAngle(20);
player.setAngle(30);
abs(ball.getAngle()-player.getAngle()) ==10 //ok
player.setAngle(350);
abs(ball.getAngle()-player.getAngle()) ==320 //not ok
ball.setAngle(350);
player.setAngle(20);
abs(ball.getAngle()-player.getAngle()) ==330 //not ok
ball.setAngle(120);
player.setAngle(100);
abs(ball.getAngle()-player.getAngle()) ==20 //ok

and anybody can help me to figure out the right condition so that ball can transform player? thanks!

sentences:
A collider defined as intersection of two colliders I'm working in unity and I have the following problem :
Suppose you have an object that's very similar to say the intersection of say the corner of a cube and a ball, and you want a nice collider for this object.

First option is to simply use the mesh collider option - but this is apparently not  very efficient, and if for example the sphere is very smooth, there might be a lot of polygons and that could be a problem.

Second, you could just fill the object with various simple colliders.

However, both of the above options seem unnecessarily complicated - it would seem natural to me to somehow work with both colliders - the sphere collider and the cube collider. To determine if the object is touching something, the requirement is that both the cube and sphere collider are touching something, not just one of them.

I don't know how the actual collision checks work, but I would expect that say in the second option I wrote above (placing a few small colliders inside the object), a collision check sees if any of the colliders is touching a collider of some other object - so there is an option for "union" type of collision check (see if any of the colliders are touching something). Similarly, I would expect there would be an option of checking whether both the colliders are touching something, but I'm not aware of it.

Either way, I would appreciate ideas on how to implement a good collider for this problem, and whether there's a way to implement it by the way I described, using the "intersection" of two colliders.

sentences:
Is there a simple way to draw only the tiles I need? I am working on a platformer that is going to have a map that is randomly generated and infinite in 3 directions: left, right, and down.

I've figured out that I will need to separate this world into chunks, as otherwise it will be impossible to pull off. Each chunk currently consists of 512x512 tiles. (This may change in the future.) There will be set points on each chunk where the game will check whether or not a chunk exists in the direction the player is heading. If there isn't, one (or a few more) will be generated. If there is, it will be loaded into memory.

Now, my problem is, say I have a chunk and I am near the bottom left corner of it. If the camera moves diagonally down and to the left, I will be intersecting 3 additional chunks. Is my only option to calculate the tiles from each chunk and determine where they need to be drawn on screen? It seems like this will be a little nuisance of a problem to deal with. If this is the only way to do it, I guess I will have no choice but to tackle it, but I'm wondering if there's an alternative solution to this.

sentences:
Is there any difference between the reading of sensors in Unity5 and Android/Java? I'm an Android/Java developer, and I'm new to unity5. I have a program written in Android/Java that uses the readings of three sensors( Accelerometer, Magnetometer and LinearAccelertion ).

I'm now developing my first game in unity5, and I want to use the algorithm that uses the three sensors readings in my game.

In Android/Java, sensors readings are normally row data, which means that I must make some calculations on these data to be able to use them in my program.

Do I also have to make these calculations in unity5? Are the reading of sensors in Android/Java and unity5 the same or different?

If they are different, how can I use them?

sentences:
Seams between tiled textured cubes I've created a textured cube in Blender, which I have uv-mapped like this:

The tiles are 256x256, and I've mapped the coordinates exactly at the edges (e.g. x: 256, y: 512). I then export my model as an fbx-file to Unity. In Unity, if I put many cubes adjacent to each other, seams appear between the cubes, like this:

I think I understand why this happens, because the uv-coordinates are exactly on the edges, and thus two faces sample from the same points along an edge.
I could solve this in some ways:

By making the uv-tiles smaller, but it would look ugly with patterns.
By adding some space between the tiles in the texture, and aligning the uv-coordinates to them.

My question: is there a better proper way for achieving this?

UPDATE:
So, about half a year later I still have issues with the seams. I've tried many things:

Start uv-coordinates at 256.5 instead of 256, and so on...
Turned of mipmapping.
Set wrap mode to clamp.
Set filter mode to point filter.
Edge padded the texture atlas with first 4px, 8px, 16px, 32px. But still bleeding occurs at certain angles. Also updated the uv-coordinates accordingly.
Changed my atlas to be of Power of 2 instead, i.e. 1024x1024 instead of 1024x768.
Set "Non Power of 2" in Unity to None so Unity doesn't rescale my texture to nearest Power of 2.
Set texture format to Automatic Truecolor instead of Compressed.

With 32px edge padding it actually gets a lot better, but it still isn't perfect, I guess I could go on and try even more padding, but my textures will get bigger and bigger.
I understand now that it is the mip-levels that are causing the bleeding. At far distances I don't think this is a problem, but I can see this occuring just about 5-7 units away from the player, if the player is looking down.
I believe there is something trivial about this that I'm missing. This is really a showstopper for me, forever grateful to the one who helps me solve this.
Thanks in advance!
This is how I have edge padded my texture (lines not visible on real texture), the problem does not only occur when the faces has such extremes distinct difference in colors as this one. It also occurs when the faces have patterns.

sentences:
How to Integrate Unity with Google Play Game Services for iPhone and Android games I want to integrate Google Play Game Services for Apple's iOS and for Android.
How can I do this efficiently?

sentences:
How to slow down a sprite that updates every frame? I am going through a Allegro 5 tutorial which has a game loop.

There is also a variable "active" which determines if a key is being held down. Thus if the left key is being held down active is on and it begins looping through the row on the sprite sheet that corresponds to moving left.

The problem is that this logic is checked everytime the loop is performed thus at approximately 60 fps the three images that are used to do the left walking animation cycle round super fast which means my character looks like it is in a rush.

Total beginner question: so what is the correct way to slow down the transition between sprites so that the walking looks like it is done at a moderate pace.

Here is the code used to transition across the sprite between the three different phases of the person walking:

        if (active) {
            sourceX += al_get_bitmap_width(player) / 3;
        } else {
            sourceX = 32;
        }

        if (sourceX >= al_get_bitmap_width(player)) {
            sourceX = 0;
        }

I can kind of guess what it should be in plain English: update sourceX only every certain part of a second but I can't think of how to put this into code.

sentences:
Import from mesh vs hardcoded vertices performance Which brings better performance at run-time: a cube imported from a mesh, or a cube made from hardcoded vertices?

Are there limitations to a certain method? Is one of them better architectural-wise?

sentences:
How to change the gravity with a click How to change the gravity of a ball upward with a click
Then change it again downward with another click
And so on
In unity

sentences:
Export "Lite" and "Full" versions with different package names for Google Play Console On the Google Play Console, you can't have two games with the same package name.
Is there a way to have two of the same game with different package names, exported from the same Unity project? For example, a "lite version" with ads and a "full version" without ads.

sentences:
Split a grid into shapes that can be moved back from 4 directions Basically I have 4 grids Left, Right, Top, Bottom. Player can choose each of  them and move all the blocks on that grid to the Middle grid to fulfill it, like tetris from 4 directions:

      |0 0 0|
      |0 0 0|             (0 is empty, 1 is generated block)
      |0 0 1|
       _ _ _         Bottom->Mid  Right->Mid  Top->Mid   Left->Mid
|0 0 0|0 0 0|0 1 0|    |1 0 0|     |1 1 0|     |1 1 1|    |1 1 1|
|0 0 0|0 0 0|0 1 1|    |1 0 0|     |1 1 1|     |1 1 1|    |1 1 1| -> Win! Generate
|1 0 0|0 0 0|0 1 1|    |0 0 0|     |0 1 1|     |0 1 1|    |1 1 1|    another game.
       _ _ _
      |0 0 0|
      |1 0 0|
      |1 0 0|

The point here is to make sure there is at least 1 way for player to combine all 4 grids.

What I've tried so far is generate the right order first (Left->Right->Top....), then generate all the blocks 1 by 1. When a block is generated, i perfomn a check with the generated order (move all the blocks in Left to Mid, then Right then Top...) to see if its still working, the code is similar to this:

// (left->right, top->right->botttom->left, top... it doesn't have to be all 4 directions)
Random the right direction order.

Generate all possible coordinates from all the directions from the path above.
Initialize an empty list to store all chosen coordinates.

While(!(Generate enough x*x block))
{
    Get one coordinate from all possible coordinates

    if (Perform a check with the right order and the chosen list)
        Add it into the chosen list.

}

The problem here is a block can be wrong at this point, but it can become right when another block is generated:

          |0 0 0|                                      |0 0 1|
          |0 0 1|                                      |0 0 1|
          |0 0 1|                                      |0 0 1|
           _ _ _                                        _ _ _
    |0 1 0|0 0 0|0 0 0|                          |0 1 0|0 0 0|0 0 0|
    |1 0 0|0 0 0|0 0 0|                          |1 0 0|0 0 0|0 0 0|
    |1 0 0|0 0 0|0 0 0|                          |1 0 0|0 0 0|0 0 0|
           _ _ _                                        _ _ _
          |0 1 0|                                      |0 1 0|
          |0 1 0|                                      |0 1 0|
          |0 0 0|                                      |0 0 0|
 At this point the logic is wrong          But if I add 1 more block to the
  with Top->Left->Bottom order.               top grid, it'll become right.

There is no way to check if the each block is right or wrong without re-calculate all the generated blocks logic

So i want to ask if there a better way, algorithm to do it.

sentences:
Suitable interpolation for animating explosions Is there a standard interpolation function for animating explosions? Like there is with smoothstep or smootherstep for walking animations or cars going from point A to B.

I'm assuming the explosion needs to grow very fast at the beginning and then slow down - how much in relation to the default linear interpolation, I don't know.

I've tried inverse smoothstep and inverse squared from this article: Interpolation Tricks, but none quite cuts it, maybe I'm applying them wrong.

sentences:
3ds Max Skeleton Import into Unreal Engine Fail I tried following the "Introduction to UE4 Animation and Rigging Tools" tutorial with maya but I dislike maya and don't under stand it so I tried importing the skeleton from the "3rd Person Game with Blueprints" tutorial into 3ds max and hoping I could just edit the mesh because I want about the same skeleton.

So I imported it and just made a basic mesh to test, Then removed the old mesh

Now I did it like this hoping I could use the existing animations for the original but when I try to play an animation with it in unreal engine 4.7.3 it says it does have any with the same skeleton, then when I tested it trying to ragdoll it stays rigid and just falls over.

Please help, am I importing it wrong am I missing a step? Why doesn't it work?

sentences:
Event-driven Communication in a Game Engine: Yes or No? I am reading Game Coding Complete and the author recommends Event Driven communication among game objects and modules.

Basically, all living game actors should communicate with the key modules (Physics, AI, Game Logic, Game View, etc.) via an internal event messaging system. This means having to design an efficient event manager. A badly designed system eats CPU cycles, especially affecting mobile platforms.

Is this a proven and recommended approach? How should I decide whether to use it?

sentences:
Measure the length of the mesh I have a boat race game. I have a curved mesh, that is the track.
How can I measure the map(mesh) length, so I can place checkpoints on every 1/5 of the length?

sentences:
C++ Frogger game - Logs on Water bounding boxes? I am making a Frogger game in C++ using SFML but have come across a problem.
I have a block of water and log rectangles moving over it (All sprites) and would like the Frog sprite to do something when it hits the water, however with bounding boxes, even in the frog sprite moves onto a log it still passes the water bounding box and carries out the code for that. Is there any way to have the conditions so it intersects the water but only does something when it's not in collision with the log's?

Thank you.

sentences:
Position object in FOV in threejs I'm just starting with threejs, and I'm building a basic first person shooter. I use pointer lock controls.

When the user clicks ("shoots") an object, I remove it and place it at another random position in the 3D world.

When creating the object, I want to position the object randomly, but always inside the current field of view of the user. So the object must be visible in the current view of the user when it's created.

I've tried things like h = tan(fov/2)*dist trying to get the height, but the problem is I don't have the distance between the object and the camera, since the object still needs to be created...

Any help would be much appreciated. I've found similar questions online, but they're usually about changing the camera view based on an object, but that's not what I want since the camera view is determined by the mouse of the user.

sentences:
Best way to have a body with 1 dimensional linear only movement in Box2D I have a body that I am using as a paddle, it is expected to move in a vertical fashion and other objects should "bounce off it". The paddle itself should never move horizontally.

According to the docs this sounds like what I want...

  A kinematic body moves under simulation according to its velocity. Kinematic bodies do not respond to forces.

but reading further....

  Static bodies do not collide with other static or kinematic bodies.

So I create two Static Body lines and a box in between. How do I handle the box's movement? I don't think I want a dynamic object because I am only interested in linear moves (I.E. don't want wabbling).

What is the best way to handle this scenario?

sentences:
Voice recognition libraries - C++ I need to implement voice recognition in my game, the target is that the user speaks into the microphone and the game responds accordingly to some commands.

What libraries could help me with such task? I need them for C++ and as lightweight as possible to plug into the game(it will be used in mobile games).

An ideal usage would be having it capture input sound or receiving the audio samples, and outputting strings with the recognized text.

Thanks

sentences:
How to record gameplay on WP7? I need to record my wp7 game gameplay like on Hot Apps from channel 9 http://channel9.msdn.com/Shows/Hot-Apps/Hot-Apps-Minesweeper-Cheezia-Interior-Design-Talking-Alien-Zombie-Squish.

My current game is written on Silverlight, but I will have XNA games latter as well, so I need some solution which will work for both technologies. If there any free software? If yes is there any way to record video from real device, not emulator?

sentences:
Moving a particle around an Archimedean spiral at a constant speed I want to move a particle in a spiral at a constant speed. Note that that is not a constant angular speed. This is proving rather difficult, and I'll go through my method so far below.

The spiral in question is a classic Archimedean spiral with the polar equation r = ϑ, and the parametric equations x = t*cos(t), y = t*sin(t). This looks like this:

I want to move a particle around the spiral, so naively, I can just give the particle position as the value of t, and the speed as the increase in t. That way the particle moves round the spiral at a constant angular speed. However, this means that the further out from the centre it gets, the faster its (non angular) speed becomes.

So, instead of having my speed in the increase in t, I want my speed as the increase in arc length. Getting the arc length of a spiral is the first challenge, but due to the fact that the Archimedean spiral I am using isn't too insane, the arc length function is , where a = 1. This allows me to convert theta values to the arc length, but that is the precise opposite of what I need. So I need to find the inverse of the arc length function, and at that hurdle, Wolfram-Alpha has failed me.

So is it possible to find the inverse of the arc length function? The function is a one to one mapping, if you exclude negative values of theta.

Thanks,

Laurie

sentences:
What to call an Object that falls only when it's collided with? I am currently working on Objects/Blocks for my 2D Jump'n'Run. Now I want to add a new type of block, which falls down only if the player/an actor collides with it. But I don't know what to call this type.

Or more generally: Objects that only do stuff/change behaviour if interacted with.

How should I name the first type and
the second more general type?

sentences:
Can browser based games be developed without JS/Flash? I have absolutely no knowledge about game development, and for 2 years I have been a web application developer (in PHP & JS).

I'd like to learn game development, and I'd also like to free myself from PHP and Javascript and learn some game related concepts in C/C++/C# (whatever is required for game development).

Can browser-based games be developed in a language like C/C++/C#/Python and not using Javascript or Flash? Additionally, would these be superior (in terms of graphics and browser compatibility,support) to games developed using Javascript/HTML5?

EDIT:

By browser based games I'm looking at this.
Java/Python/C++ which among these would provide a better support for browser game dev (interms of compatibility, graphics)?

sentences:
Friction due to gravity in an impulse based physics engine In my physics engine, I'm using impulses to solve collisions. I'm basing all calculations on these equations:

impulse = desired_velocity_change * mass
impulse = force * time
friction_force <= normal_force * coefficient

If an object moves along flat ground (infinite mass), after integration it'll be moving slowly "into" the ground due to gravity. This means that the impulse needed to react to that (given the restitution equals 0) will be the velocity in the direction of the contact normal, multiplied by mass.

The issue here is that gravity is a constant acceleration, which means that the object, no matter the mass, will always "dip" by the same amount given a constant frame rate. So the mass is never a factor in this situation, outside of the impulse calculation, which is just a flat velocity change.

Now, I can use impulse to calculate the force that was needed to react to the collision, this force can then be used in the friction equation as such:

friction_impulse / time <= normal_impulse * coefficient / time

Since time is always greater than 0, I can just multiply both sides by it, and then I can use the impulse equation, as such:

planar_velocity_change * mass <= velocity_change_along_normal * mass * coefficient

And again, I can just remove mass from the equation, which leaves me with:

planar_velocity_change * mass <= velocity_change_along_normal * mass * coefficient

This is the desired velocity change along the contact surface due to friction. The issue is, obviously, that none of this depends on mass, which means that no matter how heavy or light an object is, it'll always continue sliding along the surface by the same amount given a constant initial velocity.

What am I missing? It really looks like there's a logical mistake here. Should the dynamic friction depend on the mass in the first place? Moving a heavy object requires higher force, so static friction should be modeled properly, since it just flat-out removes velocity, though it'd be nice to hear if this has merit or just "looks good".

sentences: Games for Facebook, iPhone, Web if I want to build a game for web, facebook, and iphone, do I need to build 3 completely different versions? I know there is a new company that is "build once, launch anywhere," but I'm asking about current best/practice and methodology in doing this.

sentences:
ScriptableObject not working after build in Unity? I have a GameObject with a ScriptableObject on it, stats. It works fine in editor but when I try to build I get a message,

A script behaviour (script unknown or not yet loaded) has a different serialization layout when loading.

What is wrong here?

sentences:
Are any 3D design skills required for game development? I am no graphics designer, but I'm a good developer with lots of experience. So, my question is the following:

Are any 3D design skills required for game development? If not, how does one write a game with 3D characters without having to design them?

sentences:
Useful resources for beginning AI What resources are available, including both free articles/ebooks and physical books and things, for game developers looking to begin simple AI programming/design?

Note: I know of this question, but that's more asking about where to start on a specific topic; I'm more asking about resources in general.

sentences:
matrix to transform unit cube to space defined by 8 arbitrary points I asked a question relating to similar to this already, but I think this is a clearer objective of what Im trying to achieve.. or whether its possible at all!

Im trying to find a transformation (matrix ideally) which would transform the 8 points of a 3d unit cube to 8 arbitrary points in space.

The 8 target points have no known structure.

e.g:

My gut feeling is that a matrix is unable to provide this xform since the cube faces vertices can be concave.. but are there any other methods of transformation?
Thanks!

sentences:
Scene2d How to make it work for a Visual Novel I kinda understand that you can use Scene2d for a Hud or stuff like that, I'm new to Java and so far I've done games that update in real time like let's say Flappy bird (simple games), so i wanted to try something different and now I'm kinda stuck, instead of having all the level be decided at the start of the game i want to instead have a forward and backwards button (Visual Novel) that lets me update the screen on each click, the problem is that i don't know how to do it in a clean way, is there a way to update the button on real time or any technique to have an entire "dialog level" scripted?
(sorry if this sounds confusing i don't know how to phrase it properly, if you have played or seen a visual novel you would understand what I'm talking about)

sentences:
Decal implementation I had issues finding information about decals, so maybe this question will help others. The implementation is for a forward renderer.

Could somebody confirm if i got decal implementation right?

You define a cube of any dimension that'll define the projection
volume in common space. You check for triangle intersection with the
defined cube to recieve triangles that the projection will affect.
You clip these triangles and save them.
You then use matrix tricks to calculate UV coordinates for the saved
triangles that'll reference the texture you're projecting.
To do this you take the vectors representing height, width and depth
of the cube in common space, so that f.e. the bottom left corner is
the origin.
You put that in a matrix as the i, j, k unit vectors, set the
translation for the cube, then you inverse this matrix.
You multiply the vertices of the saved triangles by this matrix, that way you get
their coordinates inside of a 0 to 1 size cube that you use as the UV
coordinates.
This way you have the original triangles you're projecting onto and
you have UV coordinates for them (the UV coordinates are referencing
the texture you're projecting).
Then you rerender the saved triangles onto the scene and they
overwrite the area of projection with the projected image.

Now the questions that i couldn't find answers for. Is the last point right? I've never done software clipping, but it seems error prone enough, due to limited precision, that the'll be some z fighting occuring for the projected texture. Also is the way of getting UV coordinates correct?

sentences:
How to express AI area ownership? Situation:

Big open world-ish level
Different types of real estate:

Houses including some land around it
Just houses without land
Flats on different floors

How to express AI ownership of any of those types that I could use in game logic?

My first thought was to use collider around the area as a trigger that I could use to detect if "guest" enters the area and program AI to only react if certain criteria is met (e.g sees the guest, friend vs enemy) but:

Most areas are pretty complex - I would need to use mesh colliders
It would get rather expesive if I had many areas around the player active (urban environment)
I also need the concept of "my area" for other logic - e.g pathfinding, place items etc

sentences:
Help with understanding "transform.root.GetComponent" in Unity I'm reading through a tutorial for making an RTS in Unity, and in certain scripts it wants you to make a Player field and then OnStart(){ transform.root.GetComponent}. I am not quite getting what that does or what purpose it serves.

Player.cs is added as a component to the game object "Player". Player.cs is the following:

public class Player : MonoBehaviour {

public string username { get; set; }
public bool human { get; set; }
}

Then on another script which is also attached to the Player (gameobject) as a component:

protected Player player;

protected void Start ()
{
    player = transform.root.GetComponent<Player>();
}

This is instructed: http://stormtek.geek.nz/rts_tutorial/part2.php right under "Camera Input". There is a description there, but I am confused by it since it does not allow you to actually interact with the game object Player, but the instance of the Player script.

I'm sorry if this was poorly worded, I can't think of a better way to ask this question. I am completely confused as to why it asks you to do this and what it actually does. I'm also very confused about how to reference instances of a class that are attached to a game object, and if the snippet in question assists with that (I can remove the snippet and things seem to work fine).

Edit: I have looked at the unity documentation on game objects, transform, root, getcomponents and other related methods.

sentences:
Reynold's Steering Behaviors So I read Reynold's 1999 paper, [Steering Behaviors For Autonomous Characters][1], and I presume something went over my head, because it doesn't seem to make any sense to me.

steering_force = truncate (steering_direction, max_force)
acceleration = steering_force / mass
velocity = truncate (velocity + acceleration, max_speed)
position = position + velocity

Not sure how this makes any sense. Unless there's a constant time step of 1s, this integration (a forward Euler, which is bad in it's own right), doesn't make much sense to me.

The behaviors themselves don't seem to make much sense either:

Seek:

desired_velocity = normalize (position - target) * max_speed
steering = desired_velocity - velocity

The desired_velocity is in the wrong direction? Should be (target - position)? It also doesn't return a force - it returns a difference of velocities. It doesn't scale at all with mass.

Arrival

target_offset = target - position
distance = length (target_offset)
ramped_speed = max_speed * (distance / slowing_distance)
clipped_speed = minimum (ramped_speed, max_speed)
desired_velocity = (clipped_speed / distance) * target_offset
steering = desired_velocity - velocity

This just doesn't make any sense to me. This will flat out not work. Sure, you'll eventually get a vector pointing away from the target, but depending on the vehicle's mass, may not be able to stop it in time. It's also dependent on an arbitrary slowing radius not tied to the objects max thrust, max speed, or mass. Like Seek, it also doesn't actually return a force.

I stopped reading after that. Clearly there is something I am missing here..

sentences:
How to test a network game on a mobile device I am looking to test a network game with say, 10 or more users, on a mobile device. Think of it like an MMO with a lot less users. (Assuming I can get 10 running, I'd test for more users later)

The test is for two reasons :

To see if and how the server will handle that many users
To see the performance on the client side (seeing how it has to update/render all these objects on a mobile device)

How would I go about testing 10 or more users? Unfortunately I do not have 10 devices to test on, only one. I've seen a few MMOs available on Android/iPhone. How do these developers go about test their game on devices?

sentences:
Detect mouse over a line in Phaser We're developing a game in Phaser as a university project and have come across an obstacle. We need to detect when the mouse is over a line between two points. There are not a lot of lines, definitely fewer then 500. We were thinking of just checking it with line equations on every update call, but that might slow the game down. We haven't found anything useful on google. Should we just stick with the equations or is there a more elegant way?

Cheers

sentences:
rotating a sprite around a non-fixed center I'm trying to get this character to spin in a circle to aim at the cursor. It all works pretty well, but I can't get the image to rotate around its center. Only around its corner. I've been trying to find a solution be using some crazy trig stuff, but I'm not getting anywhere.

public void draw(Graphics g, double inter)
{
BufferedImage im;
Graphics2D g2d = (Graphics2D)g;
GImage gImage;

gImage = GImages.getImage(p.sprite);
im = gImage.imageFile;
AffineTransform at = new AffineTransform();
at.translate((p.xcord+((float)p.width/2))+(p.xspd*inter), (p.ycord+((float)p.height/2))+(p.yspd*inter));
at.rotate(p.angle+(Math.PI/2));
at.scale((double)gImage.xsize/im.getWidth(), (double)gImage.ysize/im.getHeight());
//at.translate(-(float)p.width/2, -(float)p.height/2);
g2d.drawImage(im, at, null);
g2d.setColor(Color.BLUE);
g2d.drawRect((int)p.xcord,(int)p.ycord,1,1);
//g.setColor(Color.BLACK);
//g.drawString(p.suh, (int)(p.xcord+(p.xspd*inter)), (int)(p.ycord+(p.yspd*inter)));
}

p is my sprite object, the cords make up the point of the corner of the image.
The sprite moves around the screen, so I can't use a fixed point method as far as I know.
If anyone has any suggestions to make this work.

sentences:
How'd they do it: Millions of tiles in Terraria I've been working up a game engine similar to Terraria, mostly as a challenge, and while I've figured out most of it, I can't really seem to wrap my head around how they handle the millions of interactable/harvestable tiles the game has at one time. Creating around 500.000 tiles, that is 1/20th of what's possible in Terraria, in my engine causes the frame-rate to drop from 60 to around 20, even tho I'm still only rendering the tiles in view. Mind you, I'm not doing anything with the tiles, only keeping them in memory.

Update: Code added to show how I do things.

This is part of a class, which handles the tiles and draws them. I'm guessing the culprit is the "foreach" part, which iterates everything, even empty indexes.

...
    public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
    {
        foreach (Tile tile in this.Tiles)
        {
            if (tile != null)
            {
                if (tile.Position.X < -this.Offset.X + 32)
                    continue;
                if (tile.Position.X > -this.Offset.X + 1024 - 48)
                    continue;
                if (tile.Position.Y < -this.Offset.Y + 32)
                    continue;
                if (tile.Position.Y > -this.Offset.Y + 768 - 48)
                    continue;
                tile.Draw(spriteBatch, gameTime);
            }
        }
    }
...

Also here is the Tile.Draw method, which could also do with an update, as each Tile uses four calls to the SpriteBatch.Draw method. This is part of my autotiling system, which means drawing each corner depending on neighboring tiles. texture_* are Rectangles, are set once at level creation, not each update.

...
    public virtual void Draw(SpriteBatch spriteBatch, GameTime gameTime)
    {
        if (this.type == TileType.TileSet)
        {
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position, texture_tl, this.BlendColor);
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position + new Vector2(8, 0), texture_tr, this.BlendColor);
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position + new Vector2(0, 8), texture_bl, this.BlendColor);
            spriteBatch.Draw(this.texture, this.realm.Offset + this.Position + new Vector2(8, 8), texture_br, this.BlendColor);
        }
    }
...

Any critique or suggestions to my code is welcome.

Update: Solution added.

Here's the final Level.Draw method. The Level.TileAt method simply checks the inputted values, to avoid OutOfRange exceptions.

...
    public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
    {
        Int32 startx = (Int32)Math.Floor((-this.Offset.X - 32) / 16);
        Int32 endx = (Int32)Math.Ceiling((-this.Offset.X + 1024 + 32) / 16);
        Int32 starty = (Int32)Math.Floor((-this.Offset.Y - 32) / 16);
        Int32 endy = (Int32)Math.Ceiling((-this.Offset.Y + 768 + 32) / 16);

        for (Int32 x = startx; x < endx; x += 1)
        {
            for (Int32 y = starty; y < endy; y += 1)
            {
                Tile tile = this.TileAt(x, y);
                if (tile != null)
                    tile.Draw(spriteBatch, gameTime);

            }
        }
    }
...

sentences:
Why would Rigidbody.AddForce not resulting in movement of my objects? I'm trying to get my card objects to spread out randomly but nothing happens. I know the method is called cause I get the prints in the console for each card. But they don't move. No errors reported. The cards have a RigidBody.

public static void CardCascade ()
{
     print ("CARD CASCADE!");
     foreach (var card in Card.Cards) {
          float range = 500F;

          var x = Random.Range (-range, range);
          var y = Random.Range (-range, range);
          card.rigidbody.AddForce (x, y, 0);
          print ("I just added force to card: X/Y " + x + y);
     }
}

sentences: How do I shoot bullets towards the mouse in a top down shooter? I have a formula for pointing my main character of the game towards the mouse, and it gets the angle he needs to be turned to point towards the mouse. But how do I get the bullets from the gun to use the angle produced and shoot a bullet towards the mouse.

sentences:
Texture not rendering in correct order in xna 4? I am making a simple board game. In the game there is a fixed background called myTexture and others are textureGoat and textureTiger whicha are to be placed on top of the background(myTexture). But i am having problem that fourth and fifth component is not displaying however, the sixth component( i.e. myTexture) is appearing. Here is my code, please look at it

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

        // TODO: Add your drawing code here
        spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);

        //placing tiger
        spriteBatch.Draw(textureTiger, new Rectangle(22, 25, 50, 50), Color.White);//first component
        spriteBatch.Draw(textureTiger, new Rectangle(22, 407, 50, 50), Color.White);//second component

        spriteBatch.Draw(textureTiger, new Rectangle(422, 25, 50, 50), Color.White);//third component
        spriteBatch.Draw(textureTiger, new Rectangle(422, 407, 50, 50), Color.White);//fourth component

        //placing goat
        spriteBatch.Draw(textureGoat, new Rectangle(125, 110, 50, 50), Color.White);//fifth component

        //placing background
        spriteBatch.Draw(myTexture, new Rectangle(0, 0, 500, 500), Color.White);//sixth component

        spriteBatch.End();
        base.Draw(gameTime);
    }

sentences:
How can I disallow the changing of a parent? I want to disable transform.SetParent(Transform) for a particular GameObject.

I am not sure where to start, so it is really difficult to show what I have tried.  Is this even possible?

sentences:
Very easy game builders? Possible Duplicate:
  What are some good game development programs for kids?

I want very easy game builder for a kid - somebody who knows nothing about programming games (how they work inside) and just wants to build some (I could teach him but I am not available all the time). She tried Adventure Maker and got confused. It has to be something very straightforward. Do You know about any? Thanks. :)

sentences:
What language to use to create a browser-MMO? I have a game ready to be implemented (Class Diagrams and other UML stuff are good).

Here are some characteristics:

MMO.
Browser game and download-game.
Multiplatform.
With 2D graphics.
Real time.
Point-and-click.
With an online database (duh!).

What language should I use?

sentences:
How to export a terrain from Unity to Blender? I'm trying to make an environment for my scene that consists animations and other objects such as trees.

Making a terrain in Unity seem to be a lot easier than in Blender, so I want to export that environment which I've made in Unity to Blender. How can I do this?

sentences:
In Unity, how do I move my character to an object when I click on it? Basic question here, and I feel like I'm close but can't quite get it.

I have an object--it's a pot on a stove--that is in my 2D game. There will be multiple pots that appear and disappear in the game, all in predefined places (like on top of the burners of a stovetop). There's also a chef in the game, who goes to each pot and does an action. The user never directly controls the chef's movement--instead, when the user clicks a pot, the chef runs over to the counter in front of that pot, where he can perform an action on the pot.

Can someone tell me how to do this? I'm not only looking for the code but for a "correct" design, in terms of where the various variables and methods should be located. In other words, what goes in the pot's script and what goes in the chef's script? (I'm using C#.)

My thought was that the pot GameObject would have an OnMouseDown() method, to catch the user clicking on it. And in that method, there should be a call to a Move() method that is attached to the chef GameObject.

But what I have is not quite working. The chef moves one small bit toward the pot but then stops. I realize that this is because I'm calling the Move function once and that's it; it seems like the Update method should be involved somehow (the pot's or the chef's?); or maybe I should have an if statement in my Move method that checks to see if the user is at the pot, and if not, runs the move code in a loop. Or maybe the design is just fundamentally wrong and it could be done more easily.

Here is the code I have:

public class PotController : MonoBehaviour {

    private GameObject chefObject;

    void Start () {
        chefObject = GameObject.Find ("Chef");
    }

    void OnMouseDown() {
        ChefController chefScript = chefObject.GetComponent<ChefController> ();
        chefScript.Move ();
    }

}

public class ChefController : MonoBehaviour {

    public float moveSpeed;
    private Vector3 moveDirection;

    public void Move () {

        Vector3 currentPosition = transform.position;
        if (Input.GetButton ("Fire1")) {
            Vector3 moveToward = Camera.main.ScreenToWorldPoint (Input.mousePosition);
            moveDirection = moveToward - currentPosition;
            moveDirection.z = 0;
            moveDirection.Normalize ();
        }
        Vector3 target = moveDirection * moveSpeed + currentPosition;
        transform.position = Vector3.Lerp( currentPosition, target, Time.deltaTime );

    }

}

sentences:
Good baseline size for an A* Search grid? I'm working on a grid based game/prototype with a continuous open map, and are currently considering what size to make each segment. I've seen some articles mention different sizes, but most of them is really old, so I'm unsure how well they map to the various platforms and performance demands common today.

As for the project, it's a hybrid of 2D and 3D, but for path-finding purposes, the majority of searches would be approximately 2D. From a graphics perspective, the minimum segment size would be 64x64 in the XZ plane to minimize loaded segments while ensuring full screen coverage. I figure pathfinding would be an important indicator of maximum practical size.

Addendum:

I realize I was a bit unclear when talking about sizes and segments.

Each segment is a cubical map of blocks, e.g. 64x64x64 blocks. These represent both geometry, but also if an actor can move into that location and is thus a potential node in the graph.

Each of these segments again combine to a larger square or cubical world map. Neighboring segments are to be loaded dynamically to ensure a seamless local map.

Therefore how many blocks fit into the screen space when rendered, sets a practical minimum for the segments, but we would probably want to have larger segments than the absolute minimum. However, since a block also represents a potential node, the segment size also affects the size of the graph, which have to be considered when choosing a segment size.

sentences:
How to get 60fps animation in terms of rounding/truncating position/alpha floats I am wondering what gives the best animation performance running at 60fps with lots of objects. I have seen in a few places such as this that you should round or truncate your values so you don't get 54.2356345234578px, but instead get 54.24px.

animationValue = +animationValue.toFixed(2)

For x, y, alpha, etc. Any float values. I sort of understand why this is, but I am interested to know if there are any ideal heuristics to take into account. For example, maybe rounding .toFixed(2) is not ideal for particle animations. Maybe it is choppy for alpha transitions. Wondering if this has been solved, and what to truncate the values to for performance. Also in terms of calculating velocity or physics stuff, just generally what the scale of rounding/truncation should be so there are no noticeable effects.

sentences:
C# Collision Math Help I am making my own collision detection in MonoGame. I have a PolyLine class That has a property to return the normal of that PolyLine instance. I have a ConvexPolySprite class that has a List LineSegments. I hav a CircleSprite class that has a Center Property and a Radius Property. I am using a static class for the collision detection method. I am testing it on a single line segment. Vector2(200,0) => Vector2(300, 200)

The problem is it detects the collision anywhere along the path of line out into space.
I cannot figure out why.
Thanks in advance;

public class PolyLine
{
    //---------------------------------------------------------------------------------------------------------------------------
    // Class Properties

    /// <summary>
    /// Property for the upper left-hand corner of the owner of this instance
    /// </summary>
    public Vector2 ParentPosition { get; set; }

    /// <summary>
    /// Relative start point of the line segment
    /// </summary>
    public Vector2 RelativeStartPoint { get; set; }

    /// <summary>
    /// Relative end point of the line segment
    /// </summary>
    public Vector2 RelativeEndPoint { get; set; }

    /// <summary>
    /// Property that gets the absolute position of the starting point of the line segment
    /// </summary>
    public Vector2 AbsoluteStartPoint
    {
        get
        {
            return ParentPosition + RelativeStartPoint;
        }

    }//end of AbsoluteStartPoint

    /// <summary>
    /// Gets the absolute position of the end point of the line segment
    /// </summary>
    public Vector2 AbsoluteEndPoint
    {
        get
        {
            return ParentPosition + RelativeEndPoint;
        }

    }//end of AbsoluteEndPoint

    public Vector2 NormalizedLeftNormal
    {
        get
        {
            Vector2 P = AbsoluteEndPoint - AbsoluteStartPoint;
            P.Normalize();
            float x = P.X;
            float y = P.Y;
            return new Vector2(-y, x);
        }

    }//end of NormalizedLeftNormal

    //---------------------------------------------------------------------------------------------------------------------------
    // Class Constructors

    /// <summary>
    /// Sole ctor
    /// </summary>
    /// <param name="parentPosition"></param>
    /// <param name="relStart"></param>
    /// <param name="relEnd"></param>
    public PolyLine(Vector2 parentPosition, Vector2 relStart, Vector2 relEnd)
    {
        ParentPosition = parentPosition;
        RelativeEndPoint = relEnd;
        RelativeStartPoint = relStart;

    }//end of ctor

}//end of PolyLine class

public static bool Collided(CircleSprite circle, ConvexPolygonSprite poly)
{
            var distance = Vector2.Dot(circle.Position -
                poly.LineSegments[0].AbsoluteEndPoint, poly.LineSegments[0].NormalizedLeftNormal) + circle.Radius;

            if (distance <= 0)
            {
                return false;
            }
            else
            {
                return true;
            }

}//end of collided

sentences:
Creating texture and palette modification I need to create a texture from a surface with indexed color palette and alter the colors. However, after I set new colors, the rendered texture gets blank.

int main(int argc, char** argv)
{
    init();

    gSurface = TTF_RenderText_Solid(gFont, "text", fg1);

    // text is rendered properly, without following line
    SDL_SetPaletteColors(gSurface->format->palette, &fg2, 1, 1);

    gTexture = SDL_CreateTextureFromSurface(gRenderer, gSurface);

    SDL_SetRenderDrawColor(gRenderer, 255, 255, 255, 255);
    SDL_RenderClear(gRenderer);

    SDL_RenderCopy(gRenderer, gTexture, NULL, NULL);
    SDL_RenderPresent(gRenderer);

    SDL_Delay(1000);

    quit();
}

I tested this code with software rendering using window surface instead of renderer and pallete changing worked.
Could someone explain me why does it happed and how to fix it?

sentences:
How do i get a list of all joysticks connected to my pc in usb using sharpdx with c# ? Getting errors The code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using SharpDX;
using SharpDX.DirectInput;

namespace Ps4_Controller
{
    public partial class Form1 : Form
    {
        DirectInput input = new DirectInput();
        Joystick stick;

        public Form1()
        {
            InitializeComponent();

            List<Joystick> sticks = new List<Joystick>();

            foreach (DeviceInstance device in input.GetDevices
                (DeviceClass.GameControl,DeviceEnumerationFlags.AttachedOnly))
            {
                stick = new Joystick(input, device.InstanceGuid);
                stick.Acquire();

                  foreach (DeviceObjectInstance deviceObject in stick.GetObjects())
                    {
                        if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0)
                        {
                            stick.GetObjectPropertiesById(deviceObject.ObjectType).SetRange(-100, 100);
                        }
                    }
                    sticks.Add(stick);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
}

I'm getting error on the line:

if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0)

Severity    Code    Description Project File    Line    Suppression State
Error   CS0103  The name 'ObjectDeviceType' does not exist in the current

And on the line:

stick.GetObjectPropertiesById(deviceObject.ObjectType).SetRange(-100, 100);

Severity    Code    Description Project File    Line    Suppression State
Error   CS1503  Argument 1: cannot convert from 'System.Guid' to 'SharpDX.DirectInput.DeviceObjectId'

sentences:
Pixel Picking vs Raycasting I was recently introduced to a way of picking in OpenGL known as pixel picking (or color picking).

From my understanding, how this is done is that the scene is rendered to the back buffer with a different rgb color representing each object. By reading the color of the pixel clicked by the cursor, the relevant object can be picked. The immediate issue I can think of when using this method is that during the picking process, the scene have to be rendered 2 times, once for picking and another time for display. Additonally this also limits the it to 256^3 unique objects for picking.

With this, I would assume this is a much more accurate way of "raycast" than to use physics raycast. By placing a camera at the raycast source, render once for "raycast" picking, and resetting the camera to the original position for normal render. This would reduce issues of "bullet hitting invisible walls" as its not dependent on physics collision, which can be affected by convex hulls for complex meshes.

Is there any reason why this method is not used? Could it be over complication? Or perhaps it is what is happening behind the scenes in raycasting?

As an example where pixel picking might be better would be when raycasting through a wire fence. Most wire fence models are just textures with a transparent channel, giving the illusion of a wire fence while saving on geometry by having 1 single plane. Using color picking, what the player see is what the camera picks. Whereas in raycast, the raycast will not shoot through the plane unless it doesnt collide with the plane at all.

sentences:
Is it wrong to transmit information about a user's machine to my own servers without informing the user? Let's say I ship a game on multiple platforms. My game code detects a few trivialities about the underlying system, like the local settings, the "country," the OS, the kind of graphic cards, etc.

Let's say I ship the game with code inside it that will send this information to a master server where I collect and manage all this data for building charts and such.

In a multiplayer game, it looks pretty reasonable to do this, since connections to that server are totally justified. Still, in a singleplayer game, it may look suspicious if you are informed about this operation.

Is it just wrong to embed this kind of data gathering system in a game? Do you think it absolutely should have a previous authorization from the user before doing any collection and transmission?

If users start to decline that "agreement," I can't really enforce 100% meaningful data. Thoughts?

sentences:
Try-catch or ifs for error handling in C++ Are exceptions used widely in game engine design or it is more preferable using pure if statements? For example with exceptions:

try {
    m_fpsTextId = m_statistics->createText( "FPS: 0", 16, 20, 20, 1.0f, 1.0f, 1.0f );
    m_cpuTextId = m_statistics->createText( "CPU: 0%", 16, 20, 40, 1.0f, 1.0f, 1.0f );
    m_frameTimeTextId = m_statistics->createText( "Frame time: 0", 20, 20, 60, 1.0f, 1.0f, 1.0f );
    m_mouseCoordTextId = m_statistics->createText( "Mouse: (0, 0)", 20, 20, 80, 1.0f, 1.0f, 1.0f );
    m_cameraPosTextId = m_statistics->createText( "Camera pos: (0, 0, 0)", 40, 20, 100, 1.0f, 1.0f, 1.0f );
    m_cameraRotTextId = m_statistics->createText( "Camera rot: (0, 0, 0)", 40, 20, 120, 1.0f, 1.0f, 1.0f );
} catch ... {
    // some info about error
}

and with ifs:

m_fpsTextId = m_statistics->createText( "FPS: 0", 16, 20, 20, 1.0f, 1.0f, 1.0f );
if( m_fpsTextId == -1 ) {
    // show error
}
m_cpuTextId = m_statistics->createText( "CPU: 0%", 16, 20, 40, 1.0f, 1.0f, 1.0f );
if( m_cpuTextId == -1 ) {
    // show error
}
m_frameTimeTextId = m_statistics->createText( "Frame time: 0", 20, 20, 60, 1.0f, 1.0f, 1.0f );
if( m_frameTimeTextId == -1 ) {
    // show error
}
m_mouseCoordTextId = m_statistics->createText( "Mouse: (0, 0)", 20, 20, 80, 1.0f, 1.0f, 1.0f );
if( m_mouseCoordTextId == -1 ) {
    // show error
}
m_cameraPosTextId = m_statistics->createText( "Camera pos: (0, 0, 0)", 40, 20, 100, 1.0f, 1.0f, 1.0f );
if( m_cameraPosTextId == -1 ) {
    // show error
}
m_cameraRotTextId = m_statistics->createText( "Camera rot: (0, 0, 0)", 40, 20, 120, 1.0f, 1.0f, 1.0f );
if( m_cameraRotTextId == -1 ) {
    // show error
}

I heard that the exceptions are a bit slower than ifs and I shouldn't mix exceptions with if-checking method. However with exceptions I have more readable code than with tons of ifs after every initialize() method or something similar, though they are sometimes too heavy for just one method in my opinion. Are they ok for game development or better to stick with simple ifs?

sentences:
DX11 How to guarantee rendering order using Deferred Context? What techniques are used to guarantee rendering order (back to front) when you have more than one deferred context?

My original idea was to manually remap the Command Lists, but it seems like this is not possible.

Do games just render all Alpha objects using the immediate context (to guarantee order)?

Thanks!

sentences:
Unity animator controller animations don't work I'm having problems animating a character pack I purchased from unity asset store.

I've placed the character in an environment and created an animator controller. After I drag the animation that to the animator tab, there aren't any motions. Even if I place triggers or booleans in my script as parameters in the animator it doesn't work.

It worked with other characters but the animations were somehow embedded in the 3d models. How is this supposed to work?

sentences:
Why does the triangle rendered by OpenGL ES 2.0 , with SDL 2.0 context, vanishes after a single render, if events are not polled? I was experimenting with OpenGL ES 2.0 and being new to OpenGL, I was trying to render a simple triangle. But I was shocked to see that, if I do not call SDL_PollEvent(...) after glDrawArrays(...) in the game loop, I see the triangle render on the screen for a split second and then it vanishes altogether ! But, if I call SDL_PollEvent then everything is fine ! Can anyone explain to me the reason for this abnormal behavior???
However, this is the interesting part of my code:
This code works perfectly, if I uncomment the commented block of code:
uint32_t vbo;
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glEnableVertexAttribArray(pos);
glVertexAttribPointer(pos, 3, GL_FLOAT, GL_FALSE, 3*sizeof(float), (void*)0);

bool run = true;
SDL_Event e;
while (run)
{
    glDrawArrays(GL_TRIANGLES, 0, 3);
  SDL_GL_SwapWindow(window);

/*while(SDL_PollEvent(&e))
{
      switch(e.type)
      {
           case SDL_QUIT:
                run = false;
                break;
      }
} */

}
Vertex Shader:
precision mediump float;
attribute vec3 pos;
void main()
{
    gl_Position = vec4(pos.xyz, 1.0);
}

Fragment Shader:
precision mediump float;
void main()
{
      gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0);
}

Every help will be greatly appreciated, Thankyou everyone in advance !

sentences:
Tutorials for shadow mapping with multiple point lights in XNA I've been trying to crack this problem for a while now and I'd like to know if there's a tutorial or two out there that can help me with this.  I know how to do shadow mapping with a single light, and I know how to implement multiple lights.  What I can't seem to do is put them together, despite my many attempts.

So yeah, does anyone know of any XNA tutorials that can baby-step me through this?

EDIT: This is for a 3D environment

sentences:
Google Cloud Messaging (GCM) for turn-based mobile multiplayer server? I'm designing a multiplayer turn-based game for Android (over 3g).  I'm thinking the clients will send data to a central server over a socket or http, and receive data via GCM push messaging.
I'd like to know if anyone has practical experience with GCM for pushing 'real-time' turn data to game clients.  What kind of performance and limitations does it have?

I'm also considering using a RESTful approach with GAE or Amazon EC2.  Any advice about these approaches is appreciated.

sentences:
Smooth jumping in 2D platformers I have a very simple 2D game, similar to old-school Mario or Metroid. I'm having a lot of trouble figuring out the proper way to handle player jumping. I've tried several different methods. The first method being that as soon as the player presses the space bar, his position on the Y-Axis is automatically updated so that he is now 50 pixels higher. This didn't work, because his player model immediately jumped up instead of going for that smooth up/down look. The second method I tried was using a Timer. With this, once the player pressed the space bar, his position on the Y-Axis would be incremented every x milliseconds. This also didn't work, for the exact same reason that the first way didn't work. It shot straight up without looking smooth. The last method I tried was a resemblance of my movement on the X-Axis. Instead of waiting for player input, the Y-Axis is constantly being added, but when the player isn't jumping, the yVelocity = 0. When input does come in, an amount is added yVelocity and the player jumps up. I didn't expect this to work, obviously, but it looked better.

So how do you apply jumping correctly? This is something that I've been struggling with for a while, and I just want to get it right. Please don't confuse this question like this question, as they're both different. I need an efficient way to handle jumping so that he looks smooth (as in one motion) going up and down. I can make his falling look good, just not the going up part. Can anybody explain to me how they make jumping look good?

Note: I wrote this question without code because I want a general description of how one might do it. If you do need code or extra details, or anything to understand the question, I'll be happy to add any extra details that you might need.

sentences:
Calculating complex D&D style interactions So I don't even know if this is the right community to ask (as I imagine it's probably quite maths heavy) in but I figure it falls under the realm of game mechanics.
I want to develop a game mechanic that utilises complex D&D style interactions but on another level from that, but I don't really know where to begin conceptually. What I mean by D&D style interactions is each character will have a set of attributes, strength, skill, intelligence etc and those attributes will dictate how interactions play out between characters.
So for basic example, two characters battling each other and each attribute ranges from 0-20.
Character A - Attack:13, Defence:14
Character B - Attack:15, Defence:10.
So when Character A strikes at Character B I need to calculate how successful that attack would be and what the outcome would be, which would then feed back into their attributes. So maybe their attack is semi-successful and produced a flesh wound, not enough to kill but that reduces Character B's Attack attribute to say 13.
Now that's a fairly trivial, example where I want to try and take it to the next level is to introduce combined attributes that all have an impact on the outcome of a move. So Skill, Experience, Fitness, Attack Speed, Anticipation and even Luck (which I figure would be randomised and offset by attributes like Experience).
Ideally I'd like to build an engine where I can define attributes and how they interact and can add more over time to build up the complexity of interactions. But I am at a loss where to begin. I'm not looking for a ready made solution but just to be pointed in the right direction.
To add some further explanation as to where I'm struggling. Are there known algorithms, techniques or maths solutions that are used to calculate attribute based interactions? In my head I'm imagining some system of values and weights with some pseudo-randomness thrown in but I'm at a loss as to how you actually calculate outcomes.
When I try and think it through all I get is a massive set of 'if' statements where values go in at the top, if's are applied and modify the outcomes. So...
If CharA_Attack == 15 and CharB_Defence = 10 Then Outcome = Kill

If CharA_Speed == 10 and CharB_Speed = 12 Then Outcome = Deflected Blow

If CharA_Luck == 14(random) and CharB_Luck 7(random) Then Outcome = Flesh Wound

Etc...

sentences:
Bullet Physics implementing custom MotionState class I'm trying to make my engine's camera a kinematic rigid body that can collide into other rigid bodies.  I've overridden the btMotionState class and implemented setKinematicPos which updates the motion state's tranform.  I use the overridden class when creating my kinematic body, but the collision detection fails.  I'm doing this for fun trying to add collision detection and physics to Sean O' Neil's Procedural Universe

I referred to the bullet wiki on MotionStates for my CPhysicsMotionState class.

If it helps I can add the code for the Planetary rigid bodies, but I didn't want to clutter the post.

Here is my motion state class:

class CPhysicsMotionState: public btMotionState {
protected:
    // This is the transform with position and rotation of the camera
    CSRTTransform* m_srtTransform;
    btTransform m_btPos1;
public:
    CPhysicsMotionState(const btTransform &initialpos, CSRTTransform* srtTransform) {
        m_srtTransform = srtTransform;
        m_btPos1 = initialpos;
    }

    virtual ~CPhysicsMotionState() {
        // TODO Auto-generated destructor stub
    }

    virtual void getWorldTransform(btTransform &worldTrans) const {
        worldTrans = m_btPos1;
    }

    void setKinematicPos(btQuaternion &rot, btVector3 &pos)
    {
        m_btPos1.setRotation(rot);
        m_btPos1.setOrigin(pos);
    }

    virtual void setWorldTransform(const btTransform &worldTrans) {
        btQuaternion rot = worldTrans.getRotation();
        btVector3 pos = worldTrans.getOrigin();

        m_srtTransform->m_qRotate = CQuaternion(rot.x(), rot.y(), rot.z(), rot.w());
        m_srtTransform->SetPosition(CVector(pos.x(), pos.y(), pos.z()));
        m_btPos1 = worldTrans;
    }
};

I add a rigid body for the camera:

// Create rigid body for camera
btCollisionShape* cameraShape = new btSphereShape(btScalar(5.0f));
btTransform startTransform;
startTransform.setIdentity(); // forgot to add this line
CVector vCamera = m_srtCamera.GetPosition();
startTransform.setOrigin(btVector3(vCamera.x, vCamera.y, vCamera.z));
m_msCamera = new CPhysicsMotionState(startTransform, &m_srtCamera);
btScalar tMass(80.7f);
bool isDynamic = (tMass != 0.f);
btVector3 localInertia(0,0,0);
if (isDynamic)
    cameraShape->calculateLocalInertia(tMass,localInertia);
btRigidBody::btRigidBodyConstructionInfo rbInfo(tMass, m_msCamera, cameraShape, localInertia);
m_rigidBody = new btRigidBody(rbInfo);
m_rigidBody->setCollisionFlags(m_rigidBody->getCollisionFlags() |
    btCollisionObject::CF_KINEMATIC_OBJECT);
m_rigidBody->setActivationState(DISABLE_DEACTIVATION);

This is the code in Update() that runs each frame:

CSRTTransform srtCamera = CCameraTask::GetPtr()->GetCamera();
Quaternion qRotate = srtCamera.m_qRotate;
btQuaternion rot = btQuaternion(qRotate.x, qRotate.y, qRotate.z, qRotate.w);
CVector vCamera = CCameraTask::GetPtr()->GetPosition();
btVector3 pos = btVector3(vCamera.x, vCamera.y, vCamera.z);
CPhysicsMotionState* cameraMotionState = CCameraTask::GetPtr()->GetMotionState();
cameraMotionState->setKinematicPos(rot, pos);

sentences:
Swing KeyListener doesn't work when pressing Shift X Z and directions at the same time My code:

addKeyListener(new KeyListener() {
    @Override
    public void keyPressed(KeyEvent event) {
        if (event.getKeyCode() >= KeyEvent.VK_LEFT && event.getKeyCode() <= KeyEvent.VK_DOWN)
            direction.set(event.getKeyCode() - KeyEvent.VK_LEFT, true);
        if (event.getKeyCode() == KeyEvent.VK_Z) direction.set(4, true);
        if (event.getKeyCode() == KeyEvent.VK_CONTROL)          System.out.println(event.getKeyCode());
    }

    @Override
    public void keyReleased(KeyEvent event) {
        if (event.getKeyCode() >= KeyEvent.VK_LEFT && event.getKeyCode() <= KeyEvent.VK_DOWN) {
            speed = event.isShiftDown() ? 1 : fastSpeed;
            direction.set(event.getKeyCode() - KeyEvent.VK_LEFT, false);
        }
        if (event.getKeyCode() == KeyEvent.VK_Z) direction.set(4, false);
    }

    @Override
    public void keyTyped(KeyEvent keyEvent) {
    }
});

I start my application and press Shift, Z, and X at the same time, at this moment everything was fine (Successfully see command line output).
But when I press UP or DOWN, swing isn't invoking my listener (no command line output).

I've repeated many times and it's all the same.

Is there any work-arounds?

sentences:
SpriteSheet in slick2d or lwjgl import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

public class SpriteSheet {
    private String path;
    public final int SIZE;
    public int[] pixels;

public static SpriteSheet tiles = new SpriteSheet("/texture/spritesheet.png", 256);

public SpriteSheet(String path, int size) {
    this.path = path;
    this.SIZE = size;
    pixels = new int[SIZE * SIZE];
    load();
}

private void load() {
    try {
        BufferedImage image = ImageIO.read(SpriteSheet.class.getResource(path));
        int w = image.getWidth();
        int h = image.getHeight();
        image.getRGB(0, 0, w, h, pixels, 0, w);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
}

So I'm trying to load a SpriteSheet either using slick2d or lwjgl. Was wondering is this faster, than the method above. Also, how do you actually do a spritesheet class for lwjgl.

I'm just confused how you use Sprites in Slick2d. It looks like I need to create an image class and then have SpriteSheet class extend the image class.

http://slick.cokeandcode.com/javadoc/org/newdawn/slick/Image.html

sentences:
What organic traffic can I expect from publishing on Google Play, without other marketing? I've just published a new Android game on Google Play. It has been a bit over 48 hours.  It's active in the store, and I can search for it by name to get to it.  However, I've had 0 organic downloads thus far, only a couple from my friends. As far as I know, it has not been shown in the "new games" list yet, and the only store listing views in the stats are the ones from myself and friends.

Is there some time by which I can expect some "organic" exposure, or will I ever?  Is promoting my game by other channels the only option?

I'm not asking for advice on promoting my game. I'm only asking about what organic exposure I can expect on Google Play.

sentences:
Storing walls that are between tiles I am writing isometric engine in c++. I decided to take a more realistic approach and make walls occupy space between two tiles, not a single whole tile, as shown in the picture below (just like in The Sims).

My problem is that I have no idea how to store the tile map related data in something that is not grid. In this situation I guess I will need to make it A* friendly, so there will be nodes and edges between tiles not divided by walls. Here is another picture showing what I want to achieve:

So here is the question(s):

How should I:

store the whole map, both tiles and walls
optimize it for rendering
use it for A* and other algorithms rather straightforward to implement on a simple grid but now using walls (edges) to determine visibility, collision etc.?

sentences:
Circular class dependency Is it bad design to have 2 classes which need each other?

I'm writing a small game in which I have a GameEngine class which has got a few GameState objects. To access several rendering methods, these GameState objects also need to know the GameEngine class - so it's a circular dependency.

Would you call this bad design? I am just asking, because I am not quite sure and at this time I am still able to refactor these things.

sentences:
ECS -- Textures and Game Objects I'm developing a game using an entity-component system, and had a question about storing, using and linking textures to entities.

I have a GraphicsSystem that is responsible for storing and registering textures. Each entity has a GraphicsComponent including a textureID, which is just an integer used to look up the stored texture in the GraphicsSystem.

This works well for textures that are only used by one entity, for example player textures. In this case, I can create new GraphicsComponents by something like:

GraphicsComponent(graphicsSystem.addTexture("Player1.png"));

graphicsSystem.addTexture() adds a texture to the graphics system and returns an integer to its position, which is then stored in the component for later use.

My problem is that this approach doesn't work for textures that are registered once and then used across multiple entities. Examples are textures for bullets and world terrain.

My temporary solution to this problem is to register the texture once, and store the texture id centrally. Whenever I need to (for example) create a new bullet, I just need to remember that the bullet is texture id of (say) 1, and then pass this to the GraphicsComponent constructor for the bullet.

Similarly for my terrains, I currently just need to remember which texture ID is for which terrain type:

World::World() :    floorTerrain(1),
                    wallTerrain(2),
                    ...

I did think about storing these IDs somewhere, for example in the GraphicsSystem itself, but my world instance doesn't have direct access to the graphics system.

Anyway, as you can probably tell I am new to ECS game design and would appreciate any pointers!

Thanks,
Rich.

sentences:
How can I convert a mouse click to a ray? I have a perspective projection.  When the user clicks on the screen, I want to compute the ray between the near and far planes that projects from the mouse point, so I can do some ray intersection code with my world.

I am using my own matrix and vector and ray classes and they all work as expected.

However, when I try and convert the ray to world coordinates my far always ends up as 0,0,0 and so my ray goes from the mouse click to the centre of the object space, rather than through it.  (The x and y coordinates of near and far are identical, they differ only in the z coordinates where they are negatives of each other)

GLint vp[4];
glGetIntegerv(GL_VIEWPORT,vp);
matrix_t mv, p;
glGetFloatv(GL_MODELVIEW_MATRIX,mv.f);
glGetFloatv(GL_PROJECTION_MATRIX,p.f);
const matrix_t inv = (mv*p).inverse();
const float
    unit_x = (2.0f*((float)(x-vp[0])/(vp[2]-vp[0])))-1.0f,
    unit_y = 1.0f-(2.0f*((float)(y-vp[1])/(vp[3]-vp[1])));
const vec_t near(vec_t(unit_x,unit_y,-1)*inv);
const vec_t far(vec_t(unit_x,unit_y,1)*inv);
ray = ray_t(near,far-near);

What have I got wrong?  (How do you unproject the mouse-point?)

sentences:
What's wrong with this Open GL ES 2.0. Shader? I just can't understand this. The code works perfectly on the emulator(Which is supposed to give more problems than phones…), but when I try it on a LG-E610 it doesn't compile the vertex shader. This is my log error(Which contains the shader code as well):

EDITED

Shader:

uniform mat4 u_Matrix;

uniform int u_XSpritePos;
uniform int u_YSpritePos;
uniform float u_XDisplacement;
uniform float u_YDisplacement;

attribute vec4 a_Position;
attribute vec2 a_TextureCoordinates;

varying vec2 v_TextureCoordinates;

void main(){
    v_TextureCoordinates.x= (a_TextureCoordinates.x + u_XSpritePos) * u_XDisplacement;
    v_TextureCoordinates.y= (a_TextureCoordinates.y + u_YSpritePos) * u_YDisplacement;

    gl_Position = u_Matrix * a_Position;
}

Log reports this before loading/compiling shader:

11-05 18:46:25.579: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x51984000 size:5570560 offset:4956160 fd:46
11-05 18:46:25.629: D/memalloc(1649): /dev/pmem: Mapped buffer base:0x5218d000 size:5836800 offset:5570560 fd:49

Maybe it has something to do with that men alloc? The phone is also giving a constant error while plugged: ERROR FBIOGET_ESDCHECKLOOP fail, from msm7627a.gralloc

Edited: "InfoLog:" refers to glGetShaderInfoLog, and it's returning nothing. Since I removed the log in a previous edit I will just say i'm looking for feedback on compiling shaders.

Solution + More questions: Ok, the problem seems to be that either ints are not working(generally speaking) or that you can't mix floats with ints. That brings to me the question, why on earth glGetShaderInfoLog is returning nothing? Shouldn't it tell me something is wrong on those lines? It surely does when I misspell something.

I solved by turning everything into floats, but If someone can add some light into this, It would be appreciated. Thanks.

sentences:
How to make 3D snake with procedural mesh in Unity Im currently learning Unity3D and I would like to recreate the old Nokia game "Snakes" (example video: https://www.youtube.com/watch?v=FXg3jVG-tXs&ab_channel=aantv, play it at 1:30 and notice the movement and even the animations when the snake is turning to the sides).
The game movement is grid based as you can see, so the snake can turn only, when the head is in the center of each floor slab. I have done this by using Coroutine and I am interpolating the position of the head between the distance of each 2 slabs. (example video: https://www.youtube.com/watch?v=_LWYQE1UC68&ab_channel=Chlebikpastika).
My question is, how to design and implement the solution using procedural mesh? My idea is to update the vertices of corresponding snake body part with the values of vertices of previous snake body part. I could have Body class, which could have the buffer of vertex positions of previous body, and after each update, the vertices would be updated with currently poped values from buffer. I dont know if this is good design, do you have any ideas how I could achieve the movement of vertices of the snake?

sentences:
Array but with a name for every element (value) Say I have 10 different types of grenades, I would like to create one variable, to allow me to set the number of grenades given from the inspector, I could create an array with 10 integers and set the number of grenades there, however it would be much easier for me if every element of the array (10 in total) had a name next to its value in the inspector so I could clearly see which grenade type am I assigning the value.

Is there any variable type or something that would allow me to do this? If so what is it? And how can I create what I want?

Thanks in advance!

If more information/ better explanation of some aspect is needed ask.

sentences:
Solving constraints/joints in 1D For n points moving in 1 dimension.

Position and velocity are known for each point.

Each frame a basic integration is done for each point:

velocity += forces * timestep;
forces = 0;
position += velocity * timestep;

Each point (except for the first one) is attached to the point following it (e.g to its right) with a distance joint of the form

point2 - point1 < distance
&&
point2 - point1 > 0

Which means that the points shouldn't be further appart than distance or closer than 0.

Energy should be conserved, i.e a point should be able to push/pull another.

I tried to solve every constraints with impulses, but it messes with velocities. (at least the way I did it..)

Searching around, I found a lot of resources but I'm unfortunately not able to understand all of it.

If anyone can give me a general idea / starting point ?

sentences:
Working towards going 3D I am a beginner-intermediate C++/Java programmer and my long term goal is to be a game programmer.

I have decided to start off with 2D and work my way towards 3D.

I would like to use SDL to start off with, but I am wondering if it is maybe not such a great idea.

Given the fact that I am working towards 3D, would it be advisable to use SDL or jump into OpenGL without the Z axis?

sentences:
how to fill alpha with color? model changes color completely:

G3dModelLoader modelLoader = new G3dModelLoader(new JsonReader());
Model model = modelLoader.loadModel(Gdx.files.getFileHandle("g3dj/model.g3dj", Files.FileType.Internal));
ModelInstance modelInstance = new ModelInstance(model);
modelInstance.materials.get(0).set(ColorAttribute.createDiffuse(0, 0, 1, 1));

I want to replace only the alpha channel with blue color

(one model, many colors)

sentences:
Distance travelled by gameObject and behavior depend on device's performance? The distance travelled by my gameObject and behavior depend on my device's performance. If the device is slow for example, it takes longer to accomplish a specific task, thus travels at a smaller speed, smaller distance etc. and doesn't end up where it's supposed to. How can I fix this?

Here's the code:

variable1 -= variable2 * Time.deltaTime;
transform.position += new Vector3 (13, variable1 * Time.deltaTime, 0);

sentences:
How to access "move" values from move node in Rain behavior tree? I have a blend tree for the NPC that takes an "input magnitude" value--0 to 1.0--for how fast the character should move...and an "angular input" float-- negative pi to positive pi--for how fast the character should turn.

How do I get the rain behavior tree to update these values correctly in the behavior tree "set parameter" leaves?

I see that I can set the parameter with some kind of variable name, but I don't see where I can specify that variable with a script...and I don't see how I can access the "move" instructions given from the move node on the behavior tree, and use them to set the variables either.

How would I accomplish this steering with Rain?

sentences:
How to compress Unity apk output? I made a game with Unity but the size of .apk file got so large, it is about 70mb...
Is there some way that I can compress my apk file?

sentences: How to read a color of a pixel from texture (cocos2d-js)? How to read a color of a pixel at [x,y] from a texture (in cocos2d-js)?

sentences:
How do I programmatically change the areaSize variable of an Area Light object in Unity? I'm trying to change the areaSize property of an Area Light object, but it looks like it isn't exposed in the class, itself.

this.light.areaSize =
    new Vector2(this.areaLightWidthSlider.Value, this.areaLightHeightSlider.Value);

This code results in the error:

  error CS1061: 'UnityEngine.Light' does not contain a definition for 'areaSize' and no extension method 'areaSize' accepting a first argument of type 'UnityEngine.Light' could be found (are you missing a using directive or an assembly reference?)

The documentation  says it exists, as an "editor only" property.

Is there any way to programmatically access and change this property, possibly using reflection or serialized properties?

I am using Unity 4.6, if at all relevant.

sentences:
Using max for entry time in swept collision I was reading this tutorial on swept AABB collision detection, and I was confused by this piece of code:

// find the earliest/latest times of collision
float entryTime = std::max(xEntry, yEntry);
float exitTime = std::min(xExit, yExit);

The tutorial says this about this code:

  entryTime will tell use when the collision first occurred and exitTime
  will tell us when it exited the object from the other side. This can
  be useful for certain effects, but at the moment, we just need it to
  calculate if a collision occurred at all.

So if entryTime is supposed to be the first time a collision occured, then why is max being used to determine the first time of collision? Shouldn't min be used instead? If max is used, then the highest value will be returned. The highest value would be the time of the last collision. Obviously this must be the correct way of doing this, but I'm not understanding it. If you are trying to find the first axis to collide, it would seem intuitive that you use min.

sentences: Change back to initial value of rotation? I have a sprite that I can rotate and I wonder if there is a way to change the rotation back to the initial value?

sentences:
Improving the look of a character with solid parts inside a translucent jello exterior So my problem is a bit hard to explain. I have a character made out of a jello shell, with an internal skeleton. So let me introduce you to ma boi "Chonker McJello"

The problem is, that I want a rich green slightly transparent jello, without loosing too much details and "whiteness" on the internal skeleton. If I turn the transparency or saturation of the jello down, the jello looks ugly, if I put the jello as I want, the Skeleton looses too much details/turns green. I have thought of different approaches, but do not really know how to achieve the effect I want.

Single sided emission:
Is there a way to make the jello glow internally and light the skeleton up? The emission should only come from the backfaces.

Doing something with the render layers, like rendering the skeleton with transparency on top of the jello again, to make it appear "less affected" by it's color

Everything I have in mind sounds easy but is propably pretty complicated and I don't have a lot of experience with shadergraphs and unity's hdrp. If you have any idea how to achieve the desired effect (maybe not in the way I thought) I would really appreciate your help!
Thanks a lot!

sentences:
Is this a good way of separating graphics from game logic? My current architecture for me game engine looks like this, though it is not accurate:

Everything graphics related is done in by GraphicsEngine, and through its components, like Material, Mesh, etc). My problem is that I want to store the pointers in RenderData, but I have to include the Mesh, Material etc header files, which have included glew.

I currently change an objects material using GetRenderer().SetMaterial("xyz"), which sets a string in the renderData, to be processed by the graphics engine; then the correct pointer will be set, if it exists. This is not so modular, because the scene has graphics related files included, like glew. This is a problem.

My only solution is to store indices in RenderData. There wont be a material pointer, but instead, an index where the material is in the GraphicsEngines material store. This way, RenderData is just a "blind" integer and string store, in which the Renderer egy the GraphicsEngine works.

Is this a good solution?

Meshes have VertexData members (position, normal, texture). When I call GraphicEngine.CreateMesh(), passing the MeshName and FileName, where should the file processing go? I use Tiny Obj Loader, and I don't know where I should include it, and call its function.

I call the function from inside GraphicsEngine, then I transform the returned structures to my Mesh's structure, which I pass to the Mesh's constructor. The initialised list will assign it to the corresponding member variable. Inside Mesh, I pass the FileName to the Mesh constructor, and let it handle it all by itself. I think the first solution is better, but I don't really know why.

Maybe using GraphicsEngine to "create" assets is better than GraphicsEngine commanding assets to "be created"; but this is just a personal feeling. Which solution is better?

sentences:
Sprite Kit - containsPoint for SKPhysicsBody? I have a ball bouncing around the screen. I can pick it up and drag it onto a "bucket".

When my touches finish, I use the containsPoint function to check and see if I have dropped the ball onto the bucket.

This works fine, however, I actually want to check whether the ball is dropped onto the bucket node's physics body because my "bucket" is actually just an oval, and so I've applied a physics body which is the same shape as the oval, so that the white space around the oval isn't included in the physics simulation.

I can't seem to find a "containsPoint" function for physics bodies. Can anyone advise on how I'd check for this?

To summarise, I want to drop a node, onto a specific part of another node (or its physics body) and trigger an event.

Thanks in advance.

sentences:
Rendering metallic look I would really like to get the same metallic reflection look as in CSR Racing for my game in the simplest way possible. It doesn't have to be top-notch, but right now my rendering looks horrible and is in need of some serious improvement. Metallic reflection rendering seems pretty complex (for instance looking at this), so I need some advice on what to try.

I realize CSR Racing renders using some type of environment mapping. Can I cheat using spherical env maps, or do I need cube maps? (Nonetheless I will use static images, it's too much work to generate on the fly, and I'll keep each level in the same "tone" so I think it will work well enough.) How should I map my UVs for the env map? Or should I use the normals? If so how to tranform 3D-normals to 2D? What texture transformation to use? I tried to use the camera transformation with the same UVs I'd have used for a diffuse texture (and using glEnable(GL_TEXTURE_GEN_S)), and there was some... result, but I think that's on the wrong track?

Do I need to use specular maps, even for a shiny, clean metallic surface? When I look at what specular maps are used for it seems like they hold information of what is matte and what is shiny. Any tips and tricks highly appreciated!

sentences:
Unity: Non Power of 2 Textures I have a texture that is 1024x900. Should I resize it in Photoshop to be 1024x1024 or leave it as it is?

What about a texture sized 1000x900?

sentences:
Ponderate dijkstra relative to previous position I use dijkstra in my rust game to find path to a destination. My game is in a square grid like this:

There is, for illustration, the Rust code which use dijkstra:
use crate::map::Map;
use crate::physics::GridPoint;
use pathfinding::prelude::dijkstra;

pub fn find_path(map: &Map, from: &GridPoint, to: &GridPoint) -> Option<Vec<GridPoint>> {
    match dijkstra(from, |p| map.successors(p), |p| *p == *to) {
        None => None,
        Some(path) => Some(path.0),
    }
}

// ...

pub fn successors(&self, from: &GridPoint) -> Vec<(GridPoint, i32)> {
        let mut successors = vec![];

        for (mod_x, mod_y) in [
            (-1, -1),
            (0, -1),
            (1, -1),
            (-1, 0),
            (0, 0),
            (1, 0),
            (-1, 1),
            (0, 1),
            (1, 1),
        ]
        .iter()
        {
            let new_x = from.x + mod_x;
            let new_y = from.y + mod_y;

            if new_x < 0 || new_y < 0 {
                continue;
            }

            if let Some(next_tile) = self.terrain.tiles.get(&(new_x as u32, new_y as u32)) {
                successors.push((GridPoint::new(new_x, new_y), next_tile.pedestrian_cost))
            }
        }

        successors
    }
// ...

And visualization of found path (white is found path, pink is goal):

The found path is not a direct line. I'm not surprised, because the weight of diagonal is the same as lateral. With what I understand with dijkstra is I can return successor with weight for a coordinate. But I can't increase weight of diagonal/lateral according to previous position (ex: comming from West -> moving to Est will be less weight; maybe it is not the solution ...).
How can I achieve that ? With another algorithm than dijkstra ?

sentences:
Linux: blit image on screen without stuttering at a stable frame rate I'm working on a very simple game, and one of the project goals is to minimise the use of libraries.

I'm drawing every frame into a buffer, which is then displayed using XPutImage (see the code of the main loop). This simple code is used to limit FPS:

// Limit FPS
{
  u64 current_timestamp = LinuxGetWallClock();
  u64 ns_elapsed = LinuxGetWallClock() - last_timestamp;

  if (ns_elapsed < target_nspf) {
    struct timespec ts;
    ts.tv_sec = 0;
    ts.tv_nsec = target_nspf - ns_elapsed;  // time to sleep
    clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);

    while (ns_elapsed < target_nspf) {
      ns_elapsed = LinuxGetWallClock() - last_timestamp;
    }
  } else {
    // printf("Frame missed\n");
  }

  last_timestamp = LinuxGetWallClock();
}

Everything works fine and as expected, but every now and then the image stutters, as if the X server has buffered up a few frames' worth of images and then flushed them all in a single go. This happens irrespective of frame misses.

Note: I'm not talking about image tearing here.

I realise that the code above is not supposed to provide a stable frame rate, and occasionally one frame might be displayed for too long, and another frame might get lost and never displayed, but I don't see how that thing alone can cause the terrible occasional stuttering.

My only guess would be that clock_nanosleep may sleep for longer than I asked for.

Questions:

Is my guess above correct?
If not, what might be the reason?
Are there any ways to address this problem without having to use OpenGL to wait on vblank?

Thanks.

sentences: Where can I find indie "teams" I'm looking to work over the internet in a team of people to make a game. I'm not looking to make a profit, I just want the experiance. Where can I find similary minded persons?

sentences:
Getting ray using gluUnProject or inverted MVP matrix I've read a lot of topics here, on SO, opengl.org etc.
Example how gluUnProject should work (from NeHe tutorial):

winX = (float)x;
winY = (float)viewport[3] - (float)y;
glReadPixels( x, int(winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ );
gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX, &posY, &posZ);

The problem is that gluUnProject returns mostly zeros, if not zeros then it returns Camera position in World Coords. Value winZ I'm getting from glReadPixels is always correct, if I scale it like below:

float z_distance = ProjectionMatrix[14] / (winZ * -2.0 + 1.0 - ProjectionMatrix[10]);

I get distance between near plane and parallel plane that contains mouse click point. Look at the sample below:

gluUnProject( winX, winY, -1, modelview, projection, viewport, &posX1, &posY1, &posZ1);
gluUnProject( winX, winY, 0, modelview, projection, viewport, &posX2, &posY2, &posZ2);
gluUnProject( winX, winY, 1, modelview, projection, viewport, &posX3, &posY3, &posZ3);
gluUnProject( winX, winY, winZ, modelview, projection, viewport, &posX4, &posY4, &posZ4);

The result is always the same (posX1,posY1,posZ1)=(posX2,posY2,posZ2)=(posX3,posY3,posZ3)=(posX4,posY4,posZ4) and is either (0,0,0) or (Camera-Position.x,Camera-Position.y,Camera-Position.z)

After gluUnProject I tried to do it manually:

float NDC_x = 2.0f * winX / Width - 1.0f;
float NDC_y = 1.0f - 2.0f * winY / Height;
float winZ = 0;
glReadPixels(winX, (Height - winY), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &winZ);
vec4 point1 = inverse(ViewProjectionMatrix) * vec4(NDC_x, NDC_y, winZ, 1.0f);
vec4 point2 = inverse(ViewProjectionMatrix) * vec4(NDC_x, NDC_y, -1.0f, 1.0f);
vec4 point3 = inverse(ViewProjectionMatrix) * vec4(NDC_x, NDC_y, 0.0f, 1.0f);
vec4 point4 = inverse(ViewProjectionMatrix) * vec4(NDC_x, NDC_y, 1.0f, 1.0f);

Now all points coordinates are different and never zeros but some values, seems like real ones but I don't know how to handle it or I missed something.

BTW I used different approach to get ray (using angles) and it works perfectly. Check here.

Q1: Any suggestions what's wrong with gluUnProject ?

Q2: What is my mistake in manual implementation?

I thought that I messed with row\column-major format, but transposition of matrices had no effect. I read\write matrices as column-major format so last column is (ViewMatrix[12], ViewMatrix[13], ViewMatrix[14], ViewMatrix[15])

sentences:
HTML Multiplayer and Hiding Information I'm in the process of conceiving a multiplayer web-based game of sorts and was looking into different ways of achieving this. Instead of using PHP/MySQL/AJAX like I'm used to, a lot of sites are recommending the use of WebSockets of some kind.

My big question is, how do WebSocket games hide their information from potential hackers? It seems like anyone could hit "view source" on a page and find out everything they need to know due to it being written in Javascript, which to my knowledge is sent with the page. Is it possible to make a server desktop application that isn't hosted along with the website? If so, what languages have support for it?

sentences:
Calculating the poly vertices based on the result of Connected Component Labeling I am making a tile based game.

And now I can find all the connected area using the Connected Component Labeling algorithm.

But now the problem I am having is how to calculate the poly vertices of each connected area.

For example:

As you can see all the YELLOW tiles are of the same AREA and with the help of Connected Component Labeling algorithm I know all the (x, y) info of each tile.

And now I want is the generate a poly vertices array for the YELLOW AREA POLY (clockwise).

Is there any good algorithm for this ?

Any suggestion will be appreciated, thanks :)

sentences: No RenderWindow class in SFML? In their official tutorials it is said that to draw graphics on screen, i have to use RenderWindow instead of Window. But when i write sf:: RenderWindow window, error pops up saying that there is no RenderWindow in sf::  . I  copy-pasted the code but it still does not works. What could possibly be the  reason behind this ?

sentences:
Transformations between coordinate systems In a graphics engine, I have three three-dimensional orthogonal coordinate systems, O, A and B.

A and B are the result of two different transformations from O. I now want to calculate the transformation matrix R, which takes you from A to B. R should be the rotation and translation with respect to coordinate system A, not the original coordinate system O.

Which of the following is correct?

(1) B = A * R or (2) B = R * A

By doing some simple worked examples, it seems that (1) is correct. However, my intuition says that (2) is correct, because the transformation to A should be applied before the transformation to B, via R. Which is it?

Thanks :)

sentences:
Disabled script works anyway I have a simple code that will be enabled when I kick, so I disable it right away but even though it is disabled, it works somehow. can it be because of his parent or something else I dont know of?

//this is the script Kick_Test, i dont reach it from anywhere else
private GameObject ball;
private Rigidbody2D rg2d;
public int power = 30;

void Start()
{
    ball = GameObject.FindGameObjectWithTag("Ball");
    rg2d = ball.GetComponent<Rigidbody2D>();
    this.enabled = false;
}

private void OnTriggerEnter2D(Collider2D col)
{
    if(col.tag == "Ball")
    {
        Debug.Log("KİCK");
        Vector2 pos = (transform.position - col.gameObject.transform.position).normalized;
        rg2d.AddForce(-pos * power, ForceMode2D.Impulse);
    }
}

sentences:
Unity Collision Doesn't Work when Two Players Instantiated I am using Unity3D and I have a problem. I have a script which instantiates the player gameobject once you are connected to the server. I also have an attack script. When there is only 1 player on, everything works fine. When the second player comes on, the attack doesn't work! I did Debug.Log and I found out that when you clicked the other player to attack instead of attacking him, you are attacking the terrain below it.

Here is my code. Instantiate Code:

GameObject myPlayer = PhotonNetwork.Instantiate (
  character,
  mySpawn.transform.position,
  mySpawn.transform.rotation, 0) as GameObject;

Attack code:

using UnityEngine;
using System.Collections;

public class SendAttackInfo : Photon.MonoBehaviour
{
  public float damage = 100;

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

  void Update()
  {
    bool RMB = Input.GetMouseButtonDown(0);
    if (RMB)
    {
      RaycastHit hit;
      Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
      if (Physics.Raycast(ray, out hit, 100))
      {
        Debug.Log("We arm-hit: " + hit.collider.name);

        hit.collider.transform.gameObject.GetComponent<PhotonView>().RPC(
          "ApplyDamage",
          PhotonTargets.AllBuffered,
          damage);
        hit.collider.transform.FindChild("Cube").GetComponent<PhotonView>().RPC(
          "ApplyDamage",
          PhotonTargets.AllBuffered,
          damage);
      }
    }
  }
}

sentences:
Splitting game into multiple standalone parts I'm digging into Starling's CitrusEngine game engine. I try to understand the idea of structuring the game.

If you take a look at chrome.angrybirds.com or puddingmonsters.com you see that games load states (StarlingState's assets) dynamically which is smart. When the game starts a splash-screen displays, then you get a pre-loader which loads the main state (home, settings and choose-level view) and when you select a level a pre-loader displays again which loads the level state. This looks like they've constructed multiple parts for the game and then connect them together where the pre-loader is displayed when switching from one part to other.

How should we do that in Starling/CitrusEngine? What's the logic here? Flash games usually load all assets at the beginning which is not smart on mobile devices. Is it wise to have multiple StarlingCitrusEngine classes or you should handle the whole game in a single StarlingCitrusEngine class? Please explain in details.

Many thanks for answers.

sentences:
What should be taken into consideration when choosing a math library for games? I'm currently selecting a C++ math library to use for a project. There are several questions here and on SO concerning the 'best' library available and many answers with different suggestions, but I would like to run some tests on each of them before I make a decision.

I would like to select a library that will cater for my current needs but also for any needs in any projects I may work on in the future. My problem is that due to being fairly new at this, I'm not entirely sure what those needs will be yet.

Aside from the points that I can think of listed below, and assuming that I will only test libraries with a suitable license, what other commonly used features should I test/look for before making a selection?

Matrix operations - including addition, subtraction, multiplication, inversion, transposition, translation, rotation, scale
Vector operations - cross/dot product, normalisation, zeroing, magnitude, length2, scalar operands, normal calculation
Euler angle + Quarternion operations - rotation, interpolation, conversion, inversion, multiplication
Coordinate system conversion (Cartesian, spherical)
Random numbers - generator speed, period, statistical randomness
Possibly noise generation
Ease of integration with gl functions like glTranslate()

Also, assuming these libraries have been tested for mathematical accuracy, are there factors other than ease of use (documentation, mailing list/developer access), speed (vectorisation, SIMD), and memory usage to consider?

sentences: How do I get the alpha level at a specific pixel with Slick 2D? I know that there is the Texture.getTextureData() method, and that it returns a byte[], but I have no idea how I could use this data to find the color data at a specific pixel.

sentences:
Render just the pixel under mouse cursor in DirectX I'm having difficulties rendering just a single pixel which is on the defined coords of viewport. I'm using D3DXMatrixPerspectiveOffCenter function, but the result is not what I expected.

Here is how I calculate the parameters for the function:

// pCamera is the actual camera used to render full screen picture

// what is the width and height of camera near plane in Camera Space
double dHeight = 2 * pCamera->m_dNear * (tan(pCamera->m_dFOVy/2.0));
double dWidth  = dHeight * pCamera->m_dRatioXY;

// what is the pixel size in Camera space
double dHeightReduced = (dHeight / pCamera->m_dViewportHeight) * CAMERA_1x1px_SIZE;
double dWidthReduced = (dWidth / pCamera->m_dViewportWidth) * CAMERA_1x1px_SIZE;

// mouse pixel position in Camera space
double dCamSpaceX = -0.5*dWidth  + double(uiMousePosX) / pCamera->m_dViewportWidth    * dWidth;
double dCamSpaceY = -0.5*dHeight + double(uiMousePosY) / pCamera->m_dViewportHeight   * dHeight;

// create matrix
D3DXMatrixPerspectiveOffCenterRH( &m_mProjection,
         (float)(dCamSpaceX),
         (float)(dCamSpaceX+dWidthReduced),
         (float)(dCamSpaceY),
         (float)(dCamSpaceY+dHeightReduced),
         (float)m_dNear,
         (float)m_dFar );

(I set CAMERA_1x1px_SIZE = 100 to see a part of the scene, but I see the scene distorted and it's definitely NOT just the cut-off of the original)

How do I need to calc the params to make it work?

Thanks.

sentences:
Water simulation in Isometric game I'm creating a game in Flash AS3 in which the player needs to modify land in order to direct the water in the right direction.

However, water simulation is a new topic for me and I'm kinda stuck. It doesn't have to be like realistic water, with ripples and stuff, but it has to flow, and if there's enough water, it needs to rise.

I've thought up two different types of water:

A Spring: Infinite source of water. Used for simulating seas and stuff.
Water block: Just one unit of water.

My current implementation shows how I'd like the water to spread, but it doesn't rise, and doesn't allow for finite water. Also, the spreading isn't accounting for any amount of water, it just duplicates instead of actually moving units of water.

I'm curious to how you guys would solve this problem. Any examples/pseudo-code is always appreciated.

Current version: http://dl.dropbox.com/u/319897/ProjectWater.swf
You can manipulate the land by pressing left mouse. And can simulate one step of water at a time by pressing A.

Source of the water part: http://pastebin.com/Js2kYt4y

sentences:
How can I tell if OpenGL has finished rendering the current frame? If I make a call to http://developer.android.com/reference/android/opengl/GLSurfaceView.html#requestRender() from my game loop, how can I tell when OpenGL has finished rendering?

I don't want to make a call to requestRender() again in the next frame until the previous frame has finished rendering.

Sorry for the basic question I'm new to opengl and trying to switch to it from canvas.

Also, is GLSurfaceView.requestRender() a blocking call?

sentences:
Using logic gates for Sprite Collision Detection - humor an old fart please Im an old coder who came back so to speak, learning Java I know what I want but I cannot find anyone asking it anywhere so here goes...

Im writing a basic tank game to code for practice but as is always the case my personal ambitions out pace my abilities.

Ive been reading up on the various methods used for collision detection using rectangles and point testing around the sprite for collisions but it all seems a little hap hazard and processor heavy to me.

I was thinking maybe a method would work by which I could logically compare two sprites -

So maybe I have a tank(me) and I come to a tile which is meant to be wall. OK so I can compare the square from an array and look up what type of tile is there and prevent movement in that direction, but again Im not happy with this because its not accurate enough. I mean what happens if I want that wall shootable, where it goes through several stages of destruction before its turned into a fully traversable square, it may have a few bits un-destroyed and I want to be able to detect even this.

So how about if I created a tank mask, black and white and grab the square the tank is entering and logically AND it with the tank sprite, creating zero unless a pixel appears in both locations, in which case it hit something.

Is this clear enough?

Do you think this would work and which coding direction do you recommend, Im still new to the syntax but as you can see I know what I want....I think!

sentences:
How to write a custom shader in Unity 3D that lights up a specific pixel or group of pixel? I'm making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment.
The map would be entirely put in darkness at the beginning, but as the player shoots the environment, it would be rendered with its "real texture". So say I have a tree. First it is entirely black or greyish, but if I shoot somewhere, I would see some green.
To accomplish this, I'm using a raycast to get the impact point and so I can access any renderer of the point that the player is shooting on. I guess the next step would be to write a custom shader to light the exact pixel that is shot. Do you have any idea how I could write this shader or another way of doing this effect?

Regards

sentences:
Unity Video Player: Resolution exceeds the Microsoft Media Foundation decoder limit I'm using Unity's Video Player component to play a short intro video before the main menu.
The problem is that its resolution is 2560x1440, and on Windows 7 or earlier operating systems it says:
Context: Setting media type for first video stream
Error details: The data specified for the media type is invalid, inconsistent, or not supported by this object.
Track types:
   Audio Track, type: %10%16
   Video Track [2560 x 1440], type: H264
      Resolution exceeds the Microsoft Media Foundation  decoder limit of 1920 x 1088 on Windows 7 and below.

Is there a way to check whether it's supported or not? Because then I could change the played video to a lower resolution version. And if that's not supported as well, I would just skip the intro all-together.
I would be happy with other solutions as well.
EDIT: What I'm trying now is:

subscribing to errorReceived,

and if currently it's the 1440p version, I switch back to the 1080p version and play it.

If errorReceived is fired again (so the current version is 1080p), I just skip the whole intro phase.
 videoPlayer.errorReceived += OnErrorReceived;

 ...

 private void OnErrorReceived(VideoPlayer videoPlayer, string message)
 {
     if (videoPlayer.clip == Intro1440p)
     {
         OnIntroFinished(videoPlayer);
         videoPlayer.clip = Intro1080p;
         videoPlayer.Play();
     }
     else
     {
         OnIntroFinished(videoPlayer);
     }
 }

Now the intro is skipped if no suitable format is found, which is good, but for some reason even the 1080p version is unsupported:
Context: Setting media type for first video stream
Error details: The data specified for the media type is invalid, inconsistent, or not supported by this object.
Track types:
   Audio Track, type: %10%16
   Video Track [1920 x 1080], type: H264

I've now added an 1080p wmv version, after all that's a Windows format, it must be supported by Windows 7.
But it's still unsupported:
Context: Setting media type for first video stream
Error details: The data specified for the media type is invalid, inconsistent, or not supported by this object.
Track types:
   Audio Track, type: a%01
   Video Track [1440 x 1080], type: WMV3

sentences:
Silverlight scrolling with camera I'm trying to get my head around scrolling a 2D map that uses a physics engine. If I was to launch a projectile, would I actually be applying the physics to the background images rather than the projectile itself? I'd like to keep the projectile at the center of the 'camera', but I'm not sure how to do this in Silverlight. I thought of using a translate transform to constantly scroll the parent canvas's position, but is this the best way of doing this in Silverlight?

Edit - I'm using Farseer Physics with the Physics Helper library.

*Edit 2 - Solution *

It turns out the MSI installer of the Physics Helper installs an older version that had a broken camera. I downloaded and recompiled the latest source version and it now works!

sentences: Why do games suggest you take a break? A lot of games will suggest you take breaks from them every 30 minutes or so, I think this is especially common in Nintendo games, but they aren't the only ones to do it. What is the advantage to this? Does this somehow help get you to play it more or does it help sell more copies?

sentences:
Why the rotation switching mode is not working right when using bools? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

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

    private float targetScale;
    private Vector3 v3Scale;

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

    void Update()
    {
        RaycastHit hit;
        Ray ray;

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

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

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

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

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

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

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

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

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

The problem is at the bottom:

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

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

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

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

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

sentences:
How can I rotate an object with random speed with some delays? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Turn_Move : MonoBehaviour {
    public int TurnX;
    public int TurnY;
    public int TurnZ;

    public int MoveX;
    public int MoveY;
    public int MoveZ;

    public bool World;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        if (World == true) {
            transform.Rotate(TurnX * Time.deltaTime,TurnY * Time.deltaTime,TurnZ * Time.deltaTime, Space.World);
            transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.World);
        }else{
            transform.Rotate(TurnX * Time.deltaTime,Random.Range(3,300) * Time.deltaTime,TurnZ * Time.deltaTime, Space.Self);
            transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.Self);
        }
    }
}

This is the random part :

Random.Range(3,300)

but sine it's changing the random numbers too quick the changes are almost not visible. I want somehow to make that if for example the next random will stay for example 5 seconds at this speed number then move to the next random number and again stay at this number 5 seconds and so on.

Tried this :

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

public class Turn_Move : MonoBehaviour {
    public int TurnX;
    public int TurnY;
    public int TurnZ;

    public int MoveX;
    public int MoveY;
    public int MoveZ;

    public bool World;

    private bool IsGameRunning = false;

    // Use this for initialization
    void Start ()
    {
        IsGameRunning = true;
        StartCoroutine(SpeedWaitForSeconds());
    }

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

    }

    IEnumerator SpeedWaitForSeconds()
    {
        var delay = new WaitForSeconds(3);//define ONCE to avoid memory leak
        while (IsGameRunning)
        {
            if (World == true)
            {
                transform.Rotate(TurnX * Time.deltaTime, TurnY * Time.deltaTime, TurnZ * Time.deltaTime, Space.World);
                transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.World);
            }
            else
            {
                transform.Rotate(TurnX * Time.deltaTime, Random.Range(3, 300) * Time.deltaTime, TurnZ * Time.deltaTime, Space.Self);
                transform.Translate(MoveX * Time.deltaTime, MoveY * Time.deltaTime, MoveZ * Time.deltaTime, Space.Self);
            }

            yield return delay;//wait
        }
    }
}

but that just rotate the object once each 3 seconds. and not rotating it all the time with speed changing every 3 seconds.

but now it's not rotating for 3 seconds it rotating every 3 seconds.

better to describe what I want is like intervals. The object should spin all the time nonstop like i Update but then each 3 seconds to change for a random speed.

for example spin at speed 5 ....after 3 seconds spin at speed 77 ....after 3 second spin at speed 199

sentences:
Moller Tri Tri intersection I'm done implementing Moller's tri-tri intersection routine.  It gives you the location of where each triangle edge intersects the line of intersection between the 2 triangle planes:

Really you get the point location in the form of t values along the (really big) purple ray shown above.  So you can tell if the triangle intersects if the t values are overlapping..?

That's what the paper says.  But I can show you scenarios where the t values are overlapping, but the triangles don't intersect:

So I can't seem to figure out which edge value to discard.

The original paper is here: http://fileadmin.cs.lth.se/cs/Personal/Tomas_Akenine-Moller/pubs/tritri.pdf

sentences:
May I distribute a game engine that is based on textbook examples? I have purchased several game programming books to start my journey as a game developer. One of them teaches its readers by building a game engine's parts in each chapter until finally you have a complete working game engine. It's bare-bones, but still a game engine.

What exactly am I allowed to do with this engine, as far as releasing an indie game of my own? Is it copyright infringement if I attempt to use the game engine from the book even with my little changes and adjustments?

sentences: transform.Translate only for 10 units? How can I transform.Translate (Vector3.up * Time.deltaTime * 2); a GameObject for 10 units? I mean only make it go up 10 units (10 y units).

sentences:
What are the advantages and disadvantages of exporting spritesheets instead of models from Spriter into Unity? I'm working on a simple 2D platformer in Unity and have been using the Spriter2Unity tool to import my Spriter animations directly into Unity.
I have noticed that this creates large hierarchies of gameobjects within the imported prefabs, basically 1 per image piece.

Since the animations are fairly simple, I am thinking it would be cleaner to import each of them as a spritesheet and hook them up with a spriterenderer on the player object rather than using the importer tool.

Would this actually result in any performance benefit at runtime or are the impacts of animating a lot of game objects at once negligible?

sentences:
What should be the code design for interactions management in a game with lots of object? I'm writing a 2d game for Android in Java using LibGDX. The game consists many interactions between different types of objects. Most of them happen between enemies and bullets. At the beginning, I needed to check every moment if any enemy collide any bullet (if their masks overlaps each other). The code for checking overlap is clear to me. My question is how should I make the interactions be checked between everyone every moment?

What I did is creating a class called InteractionsManager which takes the array of all enemies and the array of bullets and checking in every step collision between each other (if collision happens, it calls the object's onCollision(Object object) method).

My problem got bigger when I needed to check other interactions types (like if enemy is in a specific distance from other type of object and other stuff like that).

I thought about passing to each object the InteractionsManager object and it should tell it whatever interaction it needs.

sentences:
Controlling Constantly Running AIs So, I'm not really sure where to start with this question. Feel free to tell me I'm stupid and Off Topic but I'd also like you to tell me why.

So, the maps in the game I am designing will consist of lots and lots and lots of voxels. Most of the voxels will just sit there and some of them will have methods run when they are touched or something happens around them. However, some blocks will constantly being doing something. Now, I'm not sure if I should have a array in every chunk (Group of voxels) that contains all the 'active' blocks or if there is another way. I know that some voxels will run code when they are loaded that makeup for all the time that they hadn't been doing anything but I may need to constantly run some voxels. (Machine that overheats or powers something can't just be loaded in 20 minutes after it blew up; or can it?)

So, now that that basic background is over, here is my question: Will an array storing all active entities in an area suffice as a way to run all the frame by frame methods of the blocks? Or is there a "normal" way to do this that I am unaware of?

EDIT: I just realized that the client that does rendering will not do a majority of the operations for the game engine. I will have a server that does it. The answer to this question is still largely relevant and helpful though. I just thought I'd mention my change.

sentences:
In Unity, how do get access to animation clips in selected model from EditorWindow? I need to add some animation events or copy them from other models. So I decided to make a EditorWindow. Unfortunately there's not much information about this, and I'm stuck in here.

void OnGUI() {
    GUILayout.Label("Source Object contains Animation Clips", EditorStyles.boldLabel);
    sourceObject = (GameObject) EditorGUILayout.ObjectField(sourceObject, typeof(Object), false);

    if(GUILayout.Button("Copy")) {
        if(sourceObject == null) {
            throw new System.NullReferenceException("Source Object is missing.");
        }

        // Do Copy here

    }
}

What I need to do is:

Extract all animation clips from the selected model(fbx) - it's the source object
Select "AnimationClip" to want to copy. Note that AnimationClip in here is not inside of model, it's seperated AnimationClip that duplicated from original model because basically animation clip from imported model is read-only, so I have to duplicate to update it.

How do I get animation clips from selected fbx model with ObjectField? Any advice will very appreciate it.

sentences:
Android, apply a pixelshader on a canvas Can an opengl pixelshader be applied on a Canvas?

I want to render a bitmap on a canvas, then apply a pixelshader to get, for example, a blur effect. Is this possible?

I don't want to simulate the blur effect by creating a new bitmap and then blur this from java code because i'd like to be able to re-use the shaders in openGL apps too.

sentences:
Sliding down the slope I've just gotten a triangle collision object in using the Separate Axis Theorem, the triangle has a 45 degree slope and resloves collision detection via the projection method. The actual collision detection works fine, but I'm having an issue where the character keeps slipping down the slope when he runs up or goes down it.

These are the number for the characters movement. I know I should be doing something with either the part of the Y velocity or somehow changing the x velocity but not sure what.

The number for the velocity

private float accerlation = 0.25f;
 velocity.X = velocity.X - accerlation

private float superaccerlation = 0.3f;
velocity.X = velocity.X - superaccerlation

How the collision is being resolved.

if (collision == TileCollision.LeftSlope)
{
    Vector2 triDepth = RectangleExtensions.GetIntersectionDepthTriLeft(bounds, tileBounds);

    if (triDepth.X != 0 && triDepth.Y != 0)
    {
        isOnSlope = true;
        Position = new Vector2(Position.X + triDepth.X, Position.Y + triDepth.Y);
    }
    else if (triDepth.X != 0 && triDepth.Y == 0)
        Position = new Vector2(Position.X + triDepth.X, Position.Y);
    else if (triDepth.X == 0 && triDepth.Y != 0)
    {
        headOnRoof = true;
        Position = new Vector2(Position.X, Position.Y + triDepth.Y);
    }

    bounds = BoundingRectangle;

}

sentences:
Intersecting rectangles in space I need to intersect 1 million spatial polygons (specified using their Minimum Bounding Rectangles) with 4 completely disjoint MBR's (MBR1,MBR2,MBR3,MBR4) in space. MBR1, MBR2, MBR3 and MBR4 divide the entire space into 4 disjoint parts. For doing so, I wrote the following code. However, it turns out that for 1 million points the code is running very slowly. Is there some way by which I may improve the code so that it may run a bit faster. If yes, then can someone please help with the same

//---------------------------------------------------------------------------
struct MBR
{
    double xRight, xLeft, yBottom, yTop;
};
bool intersects(MBR spatialId,MBR mbr)
{
    if (mbr.yBottom > spatialId.yTop || mbr.yTop < spatialId.yBottom) return false;
    if (mbr.xLeft > spatialId.xRight || mbr.xRight < spatialId.xLeft) return false;
    return true;
}
//---------------------------------------------------------------------------
bool contains(MBR spatialId,MBR mbr)
{
    if (mbr.yBottom > spatialId.yBottom || mbr.yTop < spatialId.yTop) return false;
    if (mbr.xLeft > spatialId.xLeft || mbr.xRight < spatialId.xRight) return false;
    return true;
}
//---------------------------------------------------------------------------
bool touches(MBR spatialId,MBR mbr)
{
    if (    (mbr.yBottom >= spatialId.yBottom + std::numeric_limits<double>::epsilon() &&
            mbr.yBottom <= spatialId.yBottom - std::numeric_limits<double>::epsilon()) ||
            (mbr.yTop >= spatialId.yTop + std::numeric_limits<double>::epsilon() &&
            mbr.yTop <= spatialId.yTop - std::numeric_limits<double>::epsilon()))
            return true;
    if (    (mbr.xLeft >= spatialId.xLeft + std::numeric_limits<double>::epsilon() &&
            mbr.xLeft <= spatialId.xLeft - std::numeric_limits<double>::epsilon()) ||
            (mbr.xRight >= spatialId.xRight + std::numeric_limits<double>::epsilon() &&
            mbr.xRight <= spatialId.xRight - std::numeric_limits<double>::epsilon()))
            return true;
    return false;
}
//---------------------------------------------------------------------------
MBR MBR1,MBR2,MBR3,MBR4;
vector<unsigned> spatialIds; //contain 1 million spatial identifiers which are intersected with MBR1, MBR2, MBR3, MBR4
//MBR1, MBR2, MBR3, MBR4 are again specified using their Minimum Bounding Rectangles
vector<unsigned> resultMBR1, resultMBR2, resultMBR3, resultMBR4; //contains the resulting intersecting spatial ids
for(vector<MBR>::iterator itSpatialId=spatialIds.begin(),lSpatialId=spatialIds.end();itSpatialId!=lSpatialId;++itSpatialId)
{
    if(intersects((*itSpatialId),MBR1)||contains((*itSpatialId),MBR1)||touches((*itSpatialId),MBR1))
    {
        resultMBR1.push_back((*itSpatialId));
    }

    if(intersects((*itSpatialId),MBR2)||contains((*itSpatialId),MBR2)||touches((*itSpatialId),MBR2))
    {
        resultMBR2.push_back((*itSpatialId));
    }

    if(intersects((*itSpatialId),MBR3)||contains((*itSpatialId),MBR3)||touches((*itSpatialId),MBR3))
    {
        resultMBR3.push_back((*itSpatialId));
    }

    if(intersects((*itSpatialId),MBR4)||contains((*itSpatialId),MBR4)||touches((*itSpatialId),MBR4))
    {
        resultMBR4.push_back((*itSpatialId));
    }
}

sentences:
Visual Studio draws red underlines ("squiggles") on anything in the UnityEngine namespace I work with Unity and Visual Studio 2019 and I have 4 scripts in my project.
I was getting almost every single keyword underlined with the red curvy lines (which shows that it is an error) in all scripts but the game works fine when I start it.
I tried unloading and reloading the solution and also rebuilding and building the solution by following the answers of this question. That solves my problem to some extent. Earlier I had 146 errors and now I have only 42 errors and I noticed that the keywords which are underlined red now (at the time of 42 errors) are a part of the UnityEngine namespace.
I tried restarting Visual Studio and also my computer but that doesn't help.
Even though I am getting those red curvy lines, my game runs well doing all the tasks.
If you didn't understand what am I trying to explain, visit this question. The problem stated in this question is kind of the same as my problem, only the difference is that the answers do not seem to work with the UnityEngine namespace.
Earlier, when I was working on the same project I didn't get those errors without any reason. I am now getting these errors. And I have already installed everything which I needed.

sentences:
Rendering texture buffers to one single texture I am attempting to render multiple font textures onto one single texture,
my issue is that each font texture gets repeated, but i would like to have single instance of that font character.

The characters container seems to be too large for it, but i can't figure out why.

Example of the issue below.

sentences: what is the best way to make a bunch of platforms appear randomly on a JFrame but close enough the player can reach them? Hi I'm trying to make a screen that will have a bunch of platforms that will place themselves randomly around a JFrame. I know how to do the stuff to make the character jump and to deal with the collisions just not a way to place the platforms on the screen randomly so they are close enough together that the character could reach. Any help is appreciated.

sentences:
Understanding unknown mesh data structure I have a large number of old mesh files in a custom, undocumented binary format. I have managed to parse almost everything but am left with one group of structures, described below, that I don't understand. I hope an experienced graphics programmer can explain what is happening.

Here are the structures concerned:

// These types are defined below. We're trying to understand what
// these three arrays are used to achieve.
VertexRef vertexRefs[];
Triangle triangles[];
Unknown unknowns[];

struct VertexRef {
    // Earlier in the file, there are several vertex buffers.
    // The file can contain multiple meshes, either as components
    // of a larger mesh, or as multiple LODs.
    // This value _group_ picks out one of these buffers.
    uint8_t group;
    // Index into the vertex buffer picked out by _group_.
    uint16_t vertexIndex;
};

struct TriangleVertex {
    // Index into the array _vertexRefs_
    uint16_t vertexRef;
    // Index into the array _unknowns_
    uint16_t unknownIndex;
};

struct Triangle {
    TriangleVertex verts[3];
};

struct Unknown {
    // Index into the array _vertexRefs_
    uint16_t vertexRef1;
    // Index into the array _triangles_
    uint16_t triangleIndex1;
    // Another index into the array _vertexRefs_
    uint16_t vertexRef2;
    // triangleIndex2 can be 0xffff, while triangleIndex1 never is
    uint16_t triangleIndex2;
};

The array of VertexRef is straightforward. It picks vertices, potentially from multiple meshes, to form a composite mesh.

The array of Triangle is formed by vertices from the array of VertexRef. Each vertex is also associated with an Unknown.

I am out of my depth in understanding what Unknown is doing. Member triangleIndex2 sometimes being 0xffff (or invalid, or nonexistent?) might indicate it is a leaf node of a tree? Perhaps the structure comprising the arrays vertexRefs, triangles and unknowns is some kind of collision detection tree?

I'd be very grateful for any hints. Please ask questions if I've failed to be clear enough about something.

Edit: In answer to a request in comments, I am attaching a sample file and code to load it. The code should run on any likely system. The file is a mesh of a pair of boots. The file is hosted at uploadfiles.io: https://ufile.io/w66mh

sentences:
Trying to get reference to Button in Javascript Unity3d I've this simple script in Unity3d:

#pragma strict

public var topLeft : UnityEngine.UI.Button;
public var topCenter : UnityEngine.UI.Button;
public var topRight : UnityEngine.UI.Button;
public var midLeft : UnityEngine.UI.Button;
public var midCenter : UnityEngine.UI.Button;
public var midpRight : UnityEngine.UI.Button;
public var bottomLeft : UnityEngine.UI.Button;
public var bottomCenter : UnityEngine.UI.Button;
public var bottomRight : UnityEngine.UI.Button;

private var x = "X";
private var o = "O";

function Start () {

    var board = [[topLeft, topCenter, topRight], [midLeft, midCenter, midpRight], [bottomLeft, bottomCenter, bottomRight]];
    for (var i = 0; i < board.length; ++i) {
        var row = board[i];
        for (var j = 0; j < row.length; j++) {
            var button = row[j];
            button.onClick.AddListener(function() { onTileClicked(button); });
        }
    }
}

function onTileClicked(tile : UnityEngine.UI.Button) {
    Debug.Log("Click click!");
}

Here is how I reference the buttons:

Why are all the buttons in 'board' variable null even if I referenced them through the GUI (the red rectangle in the image)?

sentences:
How can I emulate Diablo 3's Isometric view using Perspective? Using DX11, SimpleMath I am building a isometric game like Diablo 3 in 3D and I want to use a perspective camera that emulates their top down view.

Projection Matrix: CreatePerspectiveFieldOfView(1, width/height, 0.1f, 100.0f);

But after this I am a bit unsure how I am suppose to rotate the camera. I assume I could just do p - Vector3(10, 10, 10) to get a 45 degree angle at any given p.

How do I properly position, and rotate the camera and point it at position p, to mimic Diablo 3 view?

sentences:
I am looking to create realistic car movement using vectors I have goggled how to do this and found this http://www.helixsoft.nl/articles/circle/sincos.htm I have had a go at it but most of the functions that were showed didn't work I just got errors because they didn't exist. I have looked at the cos and sin functions but don't understand how to use them or how to get the car movement working correctly using vectors. I have no code because I am not sure what to do sorry.

Any help is appreciated.

EDIT:

I have restrictions that I must use the TL engine for my game, I am not allowed to add any sort of physics engine. It must be programmed in c++. Here is a sample of what i got from trying to follow what was done in the link I provided.

if(myEngine->KeyHeld(Key_W))
    {
        length += carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_S))
    {
        length -= carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_A))
    {
        angle -= carSpeedIncrement;
    }
    if(myEngine->KeyHeld(Key_D))
    {
        angle += carSpeedIncrement;
    }

    carVolocityX = cos(angle);
    carVolocityZ = cos(angle);

    car->MoveX(carVolocityX * frameTime);
    car->MoveZ(carVolocityZ * frameTime);

sentences:
Are difficult code tests when applying for jobs the norm? I just did the online tech test for Lionhead and found it a bit defeating. There were questions that required you to work out the answers to recursive algorithms that accepted arrays as arguments and made multiple calls each run through, thus splitting off into exponentially more versions. This all had to be done on paper or in your head.

There were also questions that asked you to evaluate the efficiency of theoretical algorithms and say what Big O notation you think would best describe their scaling, something that I have never been taught or learned.

There were 27 such questions. Is this usual? Is this the standard of entry level games programming? I mean, I've written 3D games, but I found this really hard.

EDIT - I have actually done another tech test for another company now which was considerably easier. I had to write various different linked list algorithms and write a routine in sudo code for how I would mathematically calculate a bot's sight given a world up vector and a forward vector.

sentences:
How do I set up a dedicated server for my multiplayer Unity game? I've made a multiplayer game with Unity and Mirror networking, and it all works perfectly when just running it on my own computer. However, I am trying to host on a dedicated server so that I can put the project on my portfolio and not have to worry about whether players can log in and test/play the game or not.
I tried a AWS Free server and I see that the Tanks example from Mirror is working just fine (although laggy), but my own project doesn't. I think this has something to do with the RAM limit of the free server but I'm not sure. I can see the task manager going up to 95% memory usage. When I remove some particle effects and geometry and enemies, it works.
I'm not sure if this is my code that is so cloggy or the server or both. In any case I would need a solution for this but I don't know what my options are.
Would be great if anyone can point me in the right direction. Thanks!

sentences:
glBlendFunc transparency in cocos2d? GL_ONE, GL_ONE

This makes the flamingoes transparent on:

http://www.andersriggelsen.dk/glblendfunc.php

but not in cocos2d using:

sprite.blendFunc = (ccBlendFunc){GL_ONE, GL_ONE}

How can I achieve a similar effect in cocos2d?

Thank you.

sentences:
Should I assign a unique ID to individual units of game currency? I am currently making a MMORPG.

At the moment, I am working on the currency part of the game but I'm confused whether I should assign a unique serial number for every unit of the currency generated.

I'm hoping to use this system to trace any misuse of the virtual currency but is this a common practice and if not, would this be a good idea on operational and / or performance point of view?

sentences:
Texture tearing with UV texture atlas mapping The following code maps the texture from a texture atlas to a UV. The problem is I'm having texture tearing issues.

Does anyone know how to overcome this problem and have any suggestions? Here is the code I have, all images are point filtered and no mipmapping is used.

    for (int i = 0; i < mesh.uv.Length; i++)
    {
        UVs.Add(GetUVTextureFromAtlas(mesh.uv[i].x, mesh.uv[i].y, voxel, 0));
    }

    [...]

    Vector2 GetUVTextureFromAtlas(float x, float y, ushort voxel, Facing side)
    {
        Rect rect = GetVoxelTextureRect(voxel, side);
        float xout = UVLerp(rect.x, rect.x + rect.width, x);
        float yout = UVLerp(rect.y, rect.y + rect.height, y);
        return new Vector2(xout, yout);
    }
    float UVLerp(float from, float to, float t)
    {
        float difference = to - from;
        return from + (difference * t);
    }

sentences:
Writing Game Engine from scratch with OpenGL I want to start writing my game engine from scratch for learning purpose, what is the prerequisites and how to do that, what programming languages and things you recommend me? Also if you have good articles and books on that it will be great. Thanks in advance!

My Programming languages and tools are:

C/C++ is it good to use only C?
Python
OpenGL
Git
GDB

What I want to learn from it:

Core Game Engine
Rendering / Graphics
Game Play/Rules
Input (keyboard/mouse/controllers,
etc)

In Rendering/Graphics:

3D
Shading
Lighting
Texturing

sentences:
Jittery collisions in Unity 2D I tried to implement a simple movement to my object. My object moves perfectly fine but I'm having issues with its collision. When I keep on moving object towards the obstacle/ground, collision are jittery.
Here the code for what I've written.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TempScript : MonoBehaviour
{
    [SerializeField] float walk_speed = 5f;
    [SerializeField] float jump_speed = 10f;
    [SerializeField] float max_up = 7f;
    [SerializeField] float max_low = -1.5f;

    void Update()
    {

        PlayerMovement();

    }
    void PlayerMovement()
    {

        if (Input.GetKey(KeyCode.W) && transform.position.y <= max_up)
            transform.position = transform.position + Vector3.up * jump_speed * Time.deltaTime;

        if (Input.GetKey(KeyCode.S) && transform.position.y >= max_low)
            transform.position = transform.position + Vector3.down * jump_speed * Time.deltaTime;

        if (Input.GetKey(KeyCode.D))
            transform.position = transform.position + Vector3.right * walk_speed * Time.deltaTime;

        if (Input.GetKey(KeyCode.A))
            transform.position = transform.position + Vector3.left * walk_speed * Time.deltaTime;
    }

}

The cube goes below the ground and bounces right back up. making it look like its jittering.
what i want is movement should stop when its colliding with object. just like it happens with addForce method.
for now you can ignore max_up and max_down variable, it was just to make sure its in the camera.

sentences: How do I make my character attack on the side of the character that I click the LMB on (Unity)? This is a top-down game, I guess I should also mention that the character is not centred on the screen and the attack should be in 4 different directions. The attack's direction should be based on which side of the character(up, down,  left, right) that you click on(this should also be universal on the screen, the only deciding factor should be the character and the mouse). I really have no clue where to start on this problem.

sentences:
Why are my water tiles not animating? My game can display tiles such as Grass tile, Dirt tile and Rock tile with no problems. Now I am trying to display water tile and animate it but for some reason it is not animating and only displaying single frame of water tile. What am I doing wrong?

Below are the appropriate classes that I am using to animate my water tiles. Please let me know if you require any more info to help me solve the problem. Thanks!

Tile class:

public abstract class Tile {

public static Tile[] tiles = new Tile[256];
public static Tile grassTile = new GrassTile(0);
public static Tile dirtTile = new DirtTile(1);
public static Tile rockTile = new RockTile(2);
public static Tile waterTile = new WaterTile(3);
public static Tile waterfallTile = new WaterfallTile(4);
public static Tile wateSplashTile = new WaterSplashTile(5);
public static final int TILE_WIDTH = 64, TILE_HEIGHT = 64;

protected BufferedImage texture;
protected final int id;

public Tile(BufferedImage texture, int id){
    this.texture = texture;
    this.id = id;
    tiles[id] = this;
}

public abstract void update();
public abstract void render(Graphics g, int x, int y);

public Boolean isSolid(){
    return false;
}

WaterTile class:

public class WaterTile extends Tile {
private Animation waterAnim;
private int speedAnim = 150;

public WaterTile(int id) {
    super(Assets.water[0], id);
    waterAnim = new Animation(speedAnim, Assets.water);
}

public void update(){
    waterAnim.update();
}

@Override
public void render(Graphics g, int x, int y) {
    g.drawImage(getAnimationFrame(), x, y, Tile.TILE_WIDTH, Tile.TILE_HEIGHT, null);
}

private BufferedImage getAnimationFrame() {

    return waterAnim.getFrames();

}

public Boolean isSolid(){
    return true;
}

Animation class:

public class Animation {

private int speed, index;
private long lastTime, timer;
private BufferedImage[] frames;

public Animation(int speed, BufferedImage[] frames){
    this.speed = speed;
    this.frames = frames;
    index = 0;
    timer = 0;
    lastTime = System.currentTimeMillis();
}

public void update(){
    timer+=System.currentTimeMillis() - lastTime;
    lastTime = System.currentTimeMillis();

    if (timer > speed){
        index++;
        timer = 0;
        if (index >= frames.length){
            index = 0;
        }
    }
}

public BufferedImage getFrames() {
    return frames[index];
}

sentences:
How can I make an object's hitbox rotate with its texture? In XNA, when you have a rectangular sprite that doesnt rotate, it's easy to get its four corners to make a hitbox. However, when you do a rotation, the points get moved and I assume there is some kind of math that I can use to aquire them.

I am using the four points to draw a rectangle that visually represents the hitboxes.

sentences:
The XNA redistributable isn't in the prerequisites list; how do I include it when publishing? So I created a small project in XNA 4.0, and wanted to try and publish it, and so I did.
Yet when attempting to install it on a different computer it didn't seem to work.

I've read and studied about how the process of publishing works, and I saw someone in a different thread asking the same question as me, then I realized that
inside the prerequisites list which is in PROJECT -> PROPERTIES -> Publish,
the XNA redistributable wasn't there therefore it wasn't checked, and when attempting to install it on a different computer they needed to install redistributable on their own
to make it work.

Any idea why isn't the redistributable in the list? Maybe this isn't even
the problem and if that's case any ideas of what IS the problem? Thanks ahead.

sentences:
Detect Collisions While Dragging 3D Game Object Hello i am making a game in which i have to drag a sphere on x axis and z axis on a plane with my mouse and i have created walls from cubes so that my sphere not go anywhere else in the game but while dragging my sphere is not detecting collisions with the wall i also added rigidbody but nothing is working ths is my code thanks

using UnityEngine;
using System.Collections;

public class Ball : MonoBehaviour
{
    Rigidbody r;
    private void Start()
    {

        r = GetComponent<Rigidbody>();

    }

    void OnMouseDrag()
    {

        float distance_to_screen =
Camera.main.WorldToScreenPoint(gameObject.transform.position).z;
        Vector3 pos_move = Camera.main.ScreenToWorldPoint(new
Vector3(Input.mousePosition.x, Input.mousePosition.y,  distance_to_screen));
        transform.position = new Vector3(pos_move.x, transform.position.y,
pos_move.z);

    }

  }

sentences:
AI - Tactics for out of range enemies I'm working on a Fire Emblem style tactical engine, and looking into the AI.

I have it working so enemies will find the best target within their movement/attack range, but what about when no units are within range- for example at the start of the map when they're far away. Who do they decide to move towards?

Does it just pick out the weakest from the player units? Does it go for the nearest?

sentences:
Light Map Generation using DirectX I'm trying to build lightmaps for an engine I'm working on. I'm using DirectX 9 w/c++ but my questions are related to the methodology behing the generation of light maps.

I have a scene built from collections of mesh objects. The scene is divided into an octree. I want to generate a light map for each of the octree nodes or possibly 1 light map for a subdivision( 8 nodes ).

I've read the tutorial on flipcode.com(  here  ). For the explanation on "calculating/retrieving light map texture coordinates the tutorial refers the reader to a broken link.

I'd appreciate a list of instructions on 'what' to do in order to complete this process...I've found bits and pieces from different sites that have different implementations and its hard to piece it together. How do I assign a polygon to a specific area of the light map?

sentences:
When does a Reference become Copyright Infringement? I've seen quite a few posts on here similar to my question, but I am still having doubts about my implementation of an Easter Egg.

In the background of my game, There is a bookshelf, purely for cosmetic purposes. Because it's got books in it, I wanted to have names on all the books, as references to either real-world books, or fictional books in media.

Some Examples:

Real World Books:(These ones all have the authors names included on the cover)

 I-Robot

 D&D Monster Manual

 Rendevous with Rama

Fictional Books:(No Authors, Because they're fictional)

 The Necronomicon (From many H.P Lovercraft Stories)

 The Enchiridion (From Adventure Time)

 Gray's Sports Almanac 1950-2000 (Back to the Future)

Books Imagined by Me:

 Graboid Hunting for Beginers (Graboids are monsters in Tremors, but this book does not exist in the movies)

 Aperature Science Employee Handbook (Aperature Science is the corporation from Portal, but this book does not exist in the games)

So, My question is, is it "acceptable" to simply mention names of real-world or fictional works in a background asset such as this? Or is even that going to far?
My confusion comes from the fact that i'm not using any of the writing or artwork from the works, simply stating the name of the title.

If someone could please give my some guidance on this, I would greatly appreciate it.

Thanks!

sentences:
Saving Unity Custom Inspector state to a text / save file? For the basic values I know how to do it like:

Item name (Simple string value)
Amount (Simple int value)
isNormalDrop (Simple bool value)

The problem is saving the Reflection variable (The script part near the bottom) which is of type 'UnityEngine.Object' and the GameObject variable how would I do this?

sentences:
Generating a Sprite to cover given area I have an area say a x b of cells. actually I render every single cell in this matrix with a tile representing floor, wall, etc. What I'm trying to achieve it to replace this tiling system with a unique tile covering the whole a x b area.

I tried to play with creating a single GameObject and then adding a SpriteRenderer component with the base idea to stick in a sprite with desired size so that the image (whatever it is) gets stretched to fit it but apparently all the suitable fields which could be involved in this are readonly (I considered the rect and the bounds attribute).

In other words I feel like I'd need to attach a SpriteRenderer with a dynamic size based on given dimensions. How could I reach this goal?

sentences:
Loading images using their bytes in Unity If you import an image into the Unity inspector, the image will be encoded in Unity's own format. Usually the resulting image is much bigger than the original (from 100kb to 1MB). Of course, you can do stuff like compress and change the texture max size to reduce the image's size, but at the end it will almost always be bigger.

I noticed that you can create a Texture2D if you got the necessary bytes. As an experiment, I took my 100kb image and imported it to Unity as a .bytes file. Then I read the bytes and created my Texture2D:

    Texture2D texture = new Texture2D(100, 100);
    texture.LoadImage(myTextAsset.bytes);
    Sprite sprite = Sprite.Create(texture, new Rect(0,0,350, 288));

And it works. And it is smaller (100kb).

So my question is: what's the difference between Unity's builtin way of handling images and my way of loading them using their bytes? Because I'm saving tons of memory with this method. I imagine that it is a bit slower. But if that's the only difference, I can live with that.

sentences: FlxSprite ignore camera follow in flixel I am using flixel v2.5 and am using FlxG.camera.follow to get the camera to follow the player. I have a background FlxSprite that I don't want to move with the camera. Is there a way I can set this FlxSprite to stay in the same place on the screen? I would also like to have a GUI HUD that stays fixed to the screen, and was thinking I could do this the same way.

sentences:
Generating spherical world from heightmapped terrain I am using a standard heightmapped procedural terrain in my project.  However, I want the terrain to appear spherical when the user zooms out.  This is an attempt to simulate the appearance of a spherical planet.  Here is my current algorithm:

        //get the direction from the "planet" center to this vert
        Vector3 sphereCentertoVertPosition = vert.Position - SphereCenter;
        sphereCentertoVertPosition.Normalize();

        //our rotation axis is the cross between the direction from this vert to the planet center and the root (center of the terrain) to the planet center
        RotationAxis = Vector3.Cross(sphereCentertoVertPosition, sphereCenterToRootPosition);

        //the amount we rotate is based on the distance of this vert from the center of the terrain
        Vector3 fromCenter = vert.Position - Root.Position;
        float amount = (fromCenter.Length() / ((myTextureWidth / Scale) / 2)) * (float)Math.PI;

        Quaternion rot = Quaternion.CreateFromAxisAngle(RotationAxis, amount);

        Vector3.Transform(ref vert.Position, ref rot, out vert.Position);

My main concern is that the rotation axis is not correct.  Theoretically, should it be the cross between the vert-to-planet-center and the terrain-center-to-planet-center?

sentences:
Problem finding correct value for Yaw I use an Arduino and a 9dof sensor ( gyroscope, accelerometer and magnetometer ) and i'm trying to use the pitch, roll and yaw that the sensor gives me to rotate an object in unity.

I managed to correctly compute pitch and roll ( the z and x axis in unity ) from the accelerometer but it seems that I can't get the Yaw right. By that I mean that when I rotate my sensor pitch or roll it rotates my Yaw too in a weird way.

Code in the arduino to get the heading

void getHeading(void)
{
  heading=180*atan2(Mxyz[0],Mxyz[1])/PI;
  if(heading <0) heading +=360;
}

void getTiltHeading(void)
{
  //float pitch = asin(-Axyz[0]);
  //float roll = asin(Axyz[1]/cos(pitch));
  float pitch = atan( Axyz[0] / sqrt( Axyz[1] * Axyz[1] + Axyz[2] * Axyz[2] ) );
  float roll = atan( Axyz[1] / sqrt(Axyz[0] * Axyz[0] + Axyz[2] * Axyz[2]));

  float xh = Mxyz[0] * cos(pitch) + Mxyz[2] * sin(pitch);
  float yh = Mxyz[0] * sin(roll) * sin(pitch) + Mxyz[1] * cos(roll) - Mxyz[2] * sin(roll) * cos(pitch);
  float zh = -Mxyz[0] * cos(roll) * sin(pitch) + Mxyz[1] * sin(roll) + Mxyz[2] * cos(roll) * cos(pitch);
  tiltheading = 180 * atan2(yh, xh)/PI;
  if(yh<0)    tiltheading +=360;
}

Pitch and roll

    float _Pitch  = (float)(180 / Math.PI * Math.Atan( m_ResultX / Math.Sqrt( m_ResultY * m_ResultY + m_ResultZ * m_ResultZ ) ) );
    float _Roll = (float)(180 / Math.PI * Math.Atan(m_ResultY / Math.Sqrt(m_ResultX * m_ResultX + m_ResultZ * m_ResultZ)));
    float _Yaw = (float)(m_TiltHeadingResult);

Don't hesitate to ask for details.

sentences:
Get rotation of camera in Google VR I'm trying to move child of camera object smooth. To implement that, I need to know the movement of x and y axis, like Input.GetAxis in general PC platforms.

I saw the documentation and examples of Google VR, but there's not much explained well. One thing I found is GvrControllerInput.Gyro, but it's said it's deprecated and use GvrControllerInputDevice.Gyro instead, but there's no Gyro value in GvrControllerInputDevice.

Seems like basic usage is totally changed, so they are not providing static methods, and force to using internal method of the object, but couldn't find any related information about this.

So, how do I get gyro from GvrControllerInputDevice? Or is there an alternative way to make child object rotate smooth from their parent? Any advice will very appreciate it!

sentences:
Unity Custom Inspector Platform dependent property section I want to make a custom inspector for one of my scripts that builds UI elements at runtime. This requires small changes to the default values depending on what platform I'm targeting. How do I add something that is similar to the graphics settings where there is a default option but each platform is able to override the
default setting for a platform specific value?

I'm looking for the same kind of thing that Unity has for the player settings (Edit -> Project Settings -> Player). This allows you to set the details for each one but you can override them for each platform if they need to be different.

sentences: Capping neighbour height difference on heightmap? I am generating a heightmap with some basic perlin noise but I need to cap the differences between each neighbouring value. A cardinal neighbour can only be -1, 0, +1 in difference while diagonal neighbour can range from -2 to +2. What is a good approach to make sure the map is generated within these rules? Does perlin or a small extension help me do this or should I make 2nd pass after the map is generated by perlin or simplex? I am currently doing the latter where I go over each tile and change it's cardinal neighbours according to it's own value but it is going over the same position/number very often.

sentences:
Font loads with artifacts I've recently come on to an error when loading fonts in my game, some letters show up perfect while others have artifacts around them. Here's an example of this:

While some letters are perfectly normal, others are being unstable.

My options menu:

This is what my loader method looks like. (Yes i've tried other fonts)

private static int loadTexture(BufferedImage image) {
        int BYTES_PER_PIXEL = 4;
        int[] pixels = new int[image.getWidth() * image.getHeight()];
        image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());

        ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL);

        for(int y = 0; y < image.getHeight(); y++){
            for(int x = 0; x < image.getWidth(); x++){
                int pixel = pixels[y * image.getWidth() + x];
                buffer.put((byte) ((pixel >> 16) & 0xFF));     // Red component
                buffer.put((byte) ((pixel >> 8) & 0xFF));      // Green component
                buffer.put((byte) (pixel & 0xFF));             // Blue component
                buffer.put((byte) ((pixel >> 24) & 0xFF));     // Alpha component. Only for RGBA
            }
        }
        buffer.flip();

        int textureID = glGenTextures();
        glBindTexture(GL_TEXTURE_2D, textureID);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
        return textureID;
    }

sentences:
Run Love2D on iphone and android I have a game developed in lua using love 2d, and now i want to run it in ios/android.

Is there any porting or way available to do that.

Thanks.

sentences:
How do I move the camera in 2D LWJGL openGL? I am making a top-down rpg game with the LWJGL but I can't figure out how to make the camera follow the player. I've tryed using GLU.gluLookAt() but it seems to be designed for 3D and when I try it with my game everything currently on the screen disappears. I have no idea where the camera gets moved to. Please explain simply how to use GLU.gluLookAt() or a better alternative to move the camera.

public class Camera {

    public float x = 0;
    public float y = 0;

    public void moveCamera(float toX, float toY){
    GLU.gluLookAt(x+toX, y+toY, 0.0f, 0.0f, 0.0f, 0.0f, 0f, 1f, 0f);
    }
}

sentences:
How do I implement melee hit boxes for a top-down game? For a 3D top-down game, how should I handle collision in melee combat? My game has no targeting system, so I can't use a simple distance check between attacker and target.

What I am thinking is have the character swing, generate a hit box, run the damage script for any characters in that hit box, and then delete the hit box. How should I handle this?

Also, I would like to use the same attack script for all players and NPCs in melee, even with different attack animations and hit boxes. However, really I can't figure out how to reliably assign who the attacker and who the target are within that script, or how to handle multiple simultaneous attacks.

sentences:
Could not load dynamic library .\RenderSystem_GL_d. System Error: %1 is not a valid Win32 application I am using OGRE 1.8.1 SDK for Visual C++ 2010 (32-bit) from ogre3d.org/download/sdk and Ogre_VC10_Express_AppWizard_1.8.0.exe downloaded from https://bitbucket.org/ogreaddons/ogreappwizards/downloads. After a successful build when i am runnin application i am getting following error:

OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library .\RenderSystem_GL_d.  System Error: %1 is not a valid Win32 application.

in DynLib::load at ........\OgreMain\src\OgreDynLib.cpp (line 93)

Seems to me that there is a mismatch of some 32bit/64bit dlls but reinstalling directx didn't solved the problem.
I am new to OGRE, kindly guide me on this and i am using windows 8(64bit) and Microsoft visual C++ 2010 Express.

Edit: I tried installing SDK and directly run SampleBrowser (Without using AppWizard) but same error occurred again(build was successful).

sentences:
How to obtain contrail visual effect? I have objects moving in OpenGL ES1 application. I want some of them to leave behind contrail – like if they would emit some radiation or something.

EDIT: the kind of contrail is:

light contrail – not smoke contrail,
the same effect occurs on LCD monitors with long pixel-switch time (it is called response time AFAIK).

HERE IS THE EXAMPLE IMAGE:
http://i.imgur.com/Fcb24.jpg

sentences:
How to detect if a 2D object overlaps any other 2D objects I am programmatically placing 4 large dots on my 2D scene which already has some objects on it. If the new dot overlaps an existing object I want to destroy the existing object. All the objects have 2Dcolliders and all are on the same layer ("Action").
Since I only do this once during the initial setup of the game I don't want to use collision detection events, instead it would seem that Collider2D.OverlapCollider would be the way to do this but I can't get it to work. The following code is called from Start() after all the objects have been placed, and thinking it might be something to do with the colliders not being active until the first frames, I also called it from a mouse click with the same result (no overlaps).
    void EraseOverlapDots()
    {
        GameObject[] largeDots = GameObject.FindGameObjectsWithTag("LargeDot");
        foreach(GameObject ldot in largeDots)
        {
            Debug.Log("Object:" + ldot.tag + "(" + ldot.transform.position + ")");

            Collider2D collider = ldot.gameObject.GetComponent<Collider2D>();
            ContactFilter2D contactFilter2D = new ContactFilter2D();
            contactFilter2D.SetLayerMask(ldot.layer);
            contactFilter2D.useLayerMask = true;

            List<Collider2D> collisions = new List<Collider2D>();
            int colCount = collider.OverlapCollider(contactFilter2D, collisions);
            int i = 0;
            foreach (Collider2D col2d in collisions)
            {
                i++;
                Debug.Log("HIT"+i+":" + col2d.tag + "(" + col2d.transform.position + ")");
            }
        }
    }

In an attempt to debug this I purposely put 4 small dots in exactly the same position as the large dots to ensure they overlap. When I run the game they are visibly exactly on top of each other but the result is always zero overlaps.

sentences:
Getting the Ray position from View and Projection Matrix I'm having some trouble calculating the direction and position of the ray from my matrices. I have tried some things such as:

private Vec3 getPick(Mat4 projection, Mat4 view) {
     Mat4 inverseProject = projection.copy().inverse();
     Mat4 pick = inverseProject.mul(view.copy());
     Vec3 pos = new Vec3(pick.m10, pick.m11, pick.m12);
     return pos;
}

I am using custom math classes and I'm pretty sure they work. Also, would it be better to perform this math in my shader? For better performance etc..?

I contacted Notch (creator of Minecraft) on this issue and he told me  to inverse the view Matrix and multiply by the projection, then multiply by the mouse coordinates. I tried that, it didn't do much.

EDIT: Tried normalising the screen space. It seems to do the job except in negative directions. Plus its a little off.

Vec3 getPick(double w, double h, double ar) {
    double sx = ((Mouse.getX() / w / 2.0) - 1.0) * ar;
    double sw = 1.0 - (2 * ((h - Mouse.getY()) / h));

    Mat4 viewProjInv = view.copy().mul(projection).inverse();
    Vec3 mouseNormal = new Vec3(sx, sw, 1.0);
    Vec3 dir = viewProjInv.mul(mouseNormal);
    return dir.mul(1);
}

sentences:
Merging OpenGL rendering result with other graphical elements like user interface. Concepts For my application, there are several elements drawing: An user interface elements, and several libraries for rendering part of the content of the window. Lets imagine some kind of Google Earth where a library render the earth geoid and several buttons and texts on top (possibly with transparency).

Something like that seem trivial, but it is not, cause OpenGL rendering on double-buffer at ~60fps and GUI elements are redrawn only on demand/changes for small portion of the window. One is by GPU and the other by CPU. One use a endless main loop that peek event, the other stay blocked until some event happens.

The idea is to draw the 3D elements on an internal buffer (in Thread A) and from the QT user interface (Thread B) just take the picture and put it at its correct place. Thread A and B could also have some mutex/signal to synchronize.

Questions are:

What are the correct concepts involved? FBO? PBO? Any other?
Where to found up-to-date information about how to implements it correctly. (meaning for example PBO with OpenGL 3+, not using ARB or deprecated stuff).
Is this image transfer a good idea? any better solution? what about efficiency implications?

As a starting hypothesis (for simplification), I could make modification on any library/source as required.

sentences:
Scanline filling of polygons that share edges and vertices In the image below (a perspective projection of an icosahedron),
the scanline (red) intersects that vertex at the top. In an icosahedron each edge belongs to two triangles. From edge a, only one triangle is visible, the other one is in the back. Same for edge d. Also, in order to determine what color the current pixel should be, each polygon has a flag which can either be 'in' or 'out', depending upon where on the scanline we currently are. Flags are flipped according to the intersection of the scanline with the edges.

Now, as we go from a to d (because all edges are intersected with the scanline at that vertex), this happens: the triangle behind triangle 1 and triangle 1 itself are set 'in', then 2 is set in and 1 is 'out', then 3 is set 'in', 2 is 'out' and finally 3 is 'out' and the one behind it is set 'in', which is not the desired behavior because we only need the triangles which are facing us to be set 'in', the rest should be 'out'.

How do process the edges in the Active Edge List (a list of edges that are currently intersected by the scanline) so the right polys are set 'in'?

Also, I should mention that the edges are unique, which means there exists an array of edges in the data structure of the icosahedron which are pointed to by edge pointers in each of the triangles.

sentences:
Layer Problem After Build&Run I finished my game and it runs fine inside Unity. I exported it to WebGL and ran it there but the main menu background does not show. It looks the background color and is pretty annoying. Here are some snapshots:

It's supposed to look like this. It looks like this when I run in Unity.
But when I export the game, here is what I see:

Anyone know where should I look to fix this? Here are my player settings:

sentences:
XNA slowly stops sprite movement on key released I'm making a game where player moves around a spaceship pressing W,S,A,D. What I would like to achieve is that I would like to make the ship stop slightly when a key is released before it went to full stop. How can I achieve that?

Here's the moving code :

 kbs = Keyboard.GetState();

            if (kbs.IsKeyDown(Keys.W))
            {
                this.pos.Y -= speed;
                this.animation = "up";

                if (kbs.IsKeyDown(Keys.D))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X += speed;
                    this.animation = "upright";
                }
                else if (kbs.IsKeyDown(Keys.A))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X -= speed;
                    this.animation = "upleft";
                }

                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;

                CheckStop();
            }
            else if (kbs.IsKeyDown(Keys.S))
            {
                this.pos.Y += speed;
                this.animation = "down";

                if (kbs.IsKeyDown(Keys.D))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X += speed;
                    this.animation = "downright";
                }
                else if (kbs.IsKeyDown(Keys.A))
                {
                    if (!isDirectional)
                    {
                        frameIndex = 0;
                        isDirectional = true;
                    }
                    this.pos.X -= speed;
                    this.animation = "downleft";
                }

                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;
            }
            else if (kbs.IsKeyDown(Keys.A))
            {
                this.pos.X -= speed;
                this.animation = "left";
                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;
            }
            else if (kbs.IsKeyDown(Keys.D))
            {
                this.pos.X += speed;
                this.animation = "right";
                if (!this.isAnimating) this.isAnimating = true;
                else this.isAnimating = false;
            }
            else
            {
                this.isAnimating = false;
                this.isDirectional = false;
                frameIndex = 0;
            }

I have been trying to check for the ship to slowly stop with CheckStop() function, here it is (for the sake of trying, on the above code I only apply CheckStop() on the 'W' key):

private void CheckStop()
        {
            KeyboardState nkbs = Keyboard.GetState();

            if (!kbs.IsKeyDown(Keys.W) && nkbs.IsKeyDown(Keys.W))
            {
                speed -= fraction;
                if (speed <= 0) speed = 0;
                this.pos.Y -= speed;
            }
        }

Any help is appreciated, thanks.

sentences:
Multithreading/Optimisation for Random Generation in Gamemaker I have a FurGeneration() script in my game; when run, it randomly generates individual oFur objects in specified areas in the game's single Room. Each has a random depth and one of three sprites, and the script produces the impression of dense, layered fur. I've attached a screenshot.

At the moment, the script is working well, as I am using it on relatively small areas. However, my next challenge is to apply this across the single, 20,000 x 20,000 room of my game to produce a consistent field of fur.

My first attempt at this was to create a background sprite, a simple 1000x1000 grey square with its image_alpha set to 0. These would be generated in rows across the entire space of the room, and then each one would have the FurGeneration() script run on it to generate individual squares of fur flush with each other. I've applied this to one 'row' of my games' Room, and the game really slows down; it doesn't crash, but evidently there are just t0o many calculations going on at once.

My question is: is there a way to multi-thread in Gamemaker? Or does it already multi-thread, meaning that this plan is a foolish one? It would be interesting to hear your thoughts.

sentences:
web based networked game physics efficiency I am writing a web based game, using websockets. its pretty simple, two players shooting at each other with bullets that have acceleration from a starting point at an angle.

The client side (frontend in web dev terms) uses phaser.io with p2js for physics.

However after reading this post, i believe that it's smarter to do some of the physics for the players on the server side. Such as collision detections, and update the player positions at regular intervals to keep the two players at sync.

Now i have two questions

if i use the Box2d javascript port on nodejs on the server side to simulate server side physics, than is it just as efficient as using the native c++ one? seeing as from what i have read so far it seems the js ports aren't that well maintained, and they are js ported - on the other hand the js codes might be easier to deal with than the c++ ones.
using p2js on the client side and using box2d on the server. The server being authoritative, and sends regular updates (once every second) as to the actual positions of the players.  will the physics simulation be in sync (atleast to the user)? Theoretically i don't see any reason for it to not, given that both user has the exact same latency (this is assumed for sake of simplicity).

sentences:
Where to find animated matrix transformations in an fbx file? Where can I find matrix transformation animation data in an fbx file?

I have an fbx file with animations. I have successfully read the indices, matrix, and weight from it.

How can I get the frame-by-frame changes in the matrix? Unfortunately, I haven't been able to find the answer in the Autodesk documentation.

sentences:
When/where should a game state transition take place? I'm in the process of redesigning some of my state management code (there are several features I've grown to dislike in practice..) which was based on this tutorial and others. The issue I'm having right now has to do with state transitions.

Where and when should state transitions occur? Should they be executed immediately, or should they be delayed to the end of the current frame, after the current state has finished its work for that frame?

Let's say my states can implement handleEvents, update, render, pause and resume methods, among others that are not relevant for this question.

My thoughts so far are the following:

If the transition is done at the end of the frame, then when I pause the game I might see an update during that same frame I clicked to pause. The Pause State will only appear after the current state has executed the rest of the frame (events, update and render). Perhaps that extra update should not have been done.
If the transition is done immediately I have to be careful to not to delete the current state while it is still executing its method, let's assume the handleEvents method. But even so, if I were to pause a game in the handleEvents function, then the game would immediately pause and the game state update function would not be executed that frame.

The second options is more appealing to me, because as a player I would probably notice that extra bit of movement after pressing to pause the game. What if the player died during that frame? The delayed state change would be unwarranted. But then, the game state itself should probably disable updates if a game pause was requested.

On the other hand it might make more sense to delay state transitions to after the current state has fully executed its functions for the current frame. Maybe the Pause state should be a sub-state of the Game state and not a state of its own.

Is it simply a matter of preference or is one of the approaches clearly superior for a different reason?

sentences:
How to spawn one dummy for each "d" in the message string? Im working on a script building game, I have the executor etc done.
However, I have one problem.
To spawn a test dummy, you say pse/d
You can spawn no more than one dummy, how would I make it so if you say pse/d d d d, it spawns as many dummies as there is in the message

EG:
pse/d (Spawns 1 dummy)
pse/d d d d (Spawns 4 dummies)

Current code:

game.Players.PlayerAdded:connect(function(p)
p.Chatted:connect(function(msg)
msg = msg:lower()
if (msg == prefix.."d") then  if (p.Character ~= nil) then
    local d=game.ServerStorage.Dummy:Clone()
    d.Parent=workspace.Debris
    d:MoveTo(p.Character:FindFirstChild'HumanoidRootPart'.Position)
end
end
end)
end) ```

sentences:
Unity random.range value not same as last value Quick one,

Currently using Unity Random.Range to set a var with the value of an enum state.

State has 4 possible values, up, down, left,right. I call it like :

currentState = (StateType)Random.Range(0, 3);

This gets set at certain conditions.

My issue is though I don't want the new setting to be the same as the current one.

I have taken a look at the random.range on the API but haven't found anything useful.

Is there an easy way to basically say "randomize but not the same as the current state"

EDIT:

Currently im using a while loop.

while (currentState == LastState)
{
    currentState = (StateType)Random.Range(0, 3);
}

Is there anything i can do to remove the while loop?

sentences:
Ray picking gives inversed results I'm trying to do a simple ray picking implementation to allow a user to select a cell in a grid rendered in 3D. I'm almost there, but I've ran into an issue which I can't seem to solve.

Consider the following image:

The line represents the ray. The circled part is where the mouse is, and the line's green tip is where it intersects with the grid (XZ plane). When I move the mouse around, the green tip moves almost opposite of the mouse.

What is causing this?

I am converting screen coordinates to OpenGL coordinates using gluUnproject.

After obtaining the direction and position of the mouse, I use the properties of similar triangles to obtain the XZ interception. The ratio between the direction y and position y is the same for both x and z axis. Hence multiplying the direction x, z by the ratio and using y=0 should give the location of the XZ plane intersection. Essentially:

Ray ray = ...
float ratio = ray.point.y / ray.dir.y;
Vector3 intercept = new Vector3(ray.dir.x * ratio, 0, ray.dir.z * ratio);

And yet, as the image shows, its not. Is there something wrong with my reasoning, or something I've overlooked?

sentences:
Unable to remove class information in serialized json file using libgdx I am encountering a problem in serializing an array of objects to json file. Please let me know where I'm making the mistake.

Object to be serialized :

package components;

public class UserGameInfo {
private int level;
private boolean isLocked;

public UserGameInfo() {

}

public UserGameInfo(final int level, final boolean isLocked) {
    this.level = level;
    this.isLocked = isLocked;
}
public int getLevel() {
    return level;
}
public void setLevel(int level) {
    this.level = level;
}
public boolean isLocked() {
    return isLocked;
}
public void setLocked(boolean isLocked) {
    this.isLocked = isLocked;
}
}

Object definitions:

  public class LevelsInfoFileReader {
  private Json fileJson;
  private Logger logger;
  private Array<LevelObjects> levelObjectsList;
  private Array<UserGameInfo> userGameObjectsList;
  ....
  }

Code for serializing the object :

    //write to the file
    try {
        FileHandle newFile = Gdx.files.local(userInfoFilePath);
        fileJson.toJson(userGameObjectsList, Array.class, UserGameInfo.class, newFile);
        System.out.println(fileJson.prettyPrint(userGameObjectsList));
    } catch (final Exception e) {
        logger.error("Could not save user data to the filepath", e);
    }

1st approach :

File contents after serialization :
[{level:1},{level:2},{level:3,isLocked:true},{level:4,isLocked:true},{level:5,isLocked:true},{level:6,isLocked:true},{level:7,isLocked:true},{level:8,isLocked:true},{level:9,isLocked:true},{level:10,isLocked:true}]

The problem here is that, though no class information is displayed, the boolean variable is not shown for level1 and level2 in the serialized json file. However, I put a debug point and checked the array object before serialization. It does contain the list properly as shown int the attached snapshot
2nd approach
The second approach I tried was with pretty print. However, the class information of the array elements is also displayed in the .json file :

Following is the .json file content :

[
{
class: components.UserGameInfo
level: 1
}
{
class: components.UserGameInfo
level: 2
}
{
class: components.UserGameInfo
level: 3
isLocked: true
}
]

My final expected output is :

[
{
"level": 1,
isLocked : false
}
{
"level": 2.
isLocked : false
}
{
"level": 3,
isLocked: true
}
]

sentences: Creating a playlist with LWJGL and OpenAL I'd like to know how to create a playlist for the music in my games. I use LWJGL, and know a bit of OpenAL, however I can't figure out how to test for when a song is over. I want to be able to play one song after another, and I want to do that without hardcoding a timer for each song.

sentences:
Which structures to use for maintaining 2D objects on canvas? How to map clicks to objects? I need to draw some 2D objects on a canvas. And I need to map the 2D coordinates of clicks to objects.

What is the usual way to maintain a 2D object's size and position (which data structures,  etc.)? What's the effective way to say: this object is at coordinates (x, y)?

sentences:
Architecture design in "buff-heavy" game? I've been trying to wrap my head around this architectural design problem. Think of a game that has lots of spells and buffs (World of Warcraft, Diablo II etc), i.e. spells may cause buffs on characters. Each buff may affect one or several properties. For example a frost bolt normally slows down the target it hits, but if it does a critical hit, it will freeze the target for a moment. The frost bolt will also cause cold damage. A shadow bolt might cause some kind of "black" damage and cause confusion (i.e. invert controls, randomize spell target etc).

I tried to map out the architecture for this kind of spell-buff system, but I'm having trouble connecting the dots. First I thought of entity-component system where each character would have a list of components (health, mana, input...), and each buff would "affect" all these components. The components would then choose whether or not the buff affects it. For example, a "damage-over-time" buff should affect the health component, but not the mana component. The aforementioned shadow bolt would affect both health and input components. However, this feels a bit iffy to do if there's tens or hundreds of buffs and components.

Any ideas on how to approach such a design?

sentences:
Eculidean space and vector magnitude Below we have distances from the origin calculated in two different ways, giving the Euclidean distance, the Manhattan distance and the Chebyshev distance.

Euclidean distance is what we use to calculate the magnitude of vectors in 2D/3D games, and that makes sense to me:

Let's say we have a vector that gives us the range a spaceship with limited fuel can travel. If we calculated this with Manhattan metric, our ship could travel a distance of X if it were travelling horizontally or vertically, however the second it attempted to travel diagonally it could only tavel X/2!

So like I say, Euclidean distance does make sense. However, I still don't quite get how we calculate 'real' distances from the vector's magnitude.

Here are two points, purple at (2,2) and green at (3,3).

We can take two points away from each other to derive a vector.

Let's create a vector to describe the magnitude and direction of purple from green:

|d| = purple - green
|d| = (purple.x, purple.y) - (green.x, green.y)
|d| = (2, 2) - (3, 3)
|d| = <-1,-1>

Let's derive the magnitude of the vector via Pythagoras to get a Euclidean measurement:

euc_magnitude = sqrt((x*x)+(y*y))
euc_magnitude = sqrt((-1*-1)+(-1*-1))
euc_magnitude = sqrt((1)+(1))
euc_magnitude = sqrt(2)
euc_magnitude = 1.41

Now, if the answer had been 1, that would make sense to me, because 1 unit (in the direction described by the vector) from the green is bang on the purple.

But it's not. It's 1.41. 1.41 units is the direction described, to me at least, makes us overshoot the purple by almost half a unit:

So what do we do to the magnitude to allow us to calculate real distances on our point graph?

Worth noting I'm a beginner just working my way through theory. Haven't programmed a game in my life!

sentences:
How do I make sprites overlap eachother based on a layering system? In Unity, I am building a 2D puzzle game, however I need to make sure that certain sprites are rendered on top of other sprites when they are above them.

Here is an example switch (left) and block (right).

I wanted to make sure that the green block appears on top of the green switch when it passes over it, so how do I avoid a situation like this happening?

sentences:
Libgdx rendering problems Have problems with rendering moving character using ShapeRenderer, it twitches while moving, and I don't understand where from comes the problem - bad game structure (do I need to override draw method from my actor,or just draw all entities in Stage's draw method) or troubles with movement logic.I'll add information if needed.

MainClass:

public class MFightGame extends Game {

@Override
public void create() {
    setScreen(new GameScreen());
}

@Override
public void render() {
    super.render();
}}

GameScreen:

public class GameScreen implements Screen {

private GameStage stage;

@Override
public void show() {
    stage = new GameStage();
}

public GameScreen() {

}

@Override
public void render(float delta) {
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.draw();
    stage.act(delta);
}

@Override
public void resize(int width, int height) {
    // TODO Auto-generated method stub
}

@Override
public void pause() {
    // TODO Auto-generated method stub
}

@Override
public void resume() {
    // TODO Auto-generated method stub
}

@Override
public void hide() {
    // TODO Auto-generated method stub
}

@Override
public void dispose() {
    // TODO Auto-generated method stub
}}

GameStage:

public class GameStage extends Stage {
private Creature creature;
private final float TIME_STEP = 1 / 300f;
private float accumulator = 0f;
private ShapeRenderer renderer;
private OrthographicCamera camera;

public GameStage() {
    creature = new Creature(100,100);
    addActor(creature);

    camera = new OrthographicCamera(800, 600);
    camera.position.set(camera.viewportWidth / 2f,
            camera.viewportHeight / 2f, 0);
    camera.update();
    renderer = new ShapeRenderer();
    renderer.setProjectionMatrix(camera.combined);
    Gdx.input.setInputProcessor(new InputHandler(creature));

}

@Override
public void act(float delta) {
    super.act(delta);
    accumulator += delta;
    while (accumulator >= delta) {
        accumulator -= TIME_STEP;
    }
}}

sentences:
Very simple open source games in various languages? Are there any very simple open source games available just to demonstrate the basics of the programming techniques?  Preferably something which fits in to a couple hundred lines of actual code.  Specifically, I'm looking for an open source game written in Objective-C and Cocoa.

I would also appreciate one written in C.

All the projects that I find online are relatively complicated.

sentences: How to use NGUI with Unity I feel like Im missing something really simple, but Ive read about all the events NGUI can generate from an object and just dont get where to recive (or handle) the event. Do I just attach it to a script on the object?

sentences:
How to put different textures on different sides of a Cube in DirectX 11? I have recently learned how to texture a cube in DirectX with a single texture but I am now trying to put multiple textures on a cube. If your confused the photo below should clarify.

I am aware of the technique of Cube Mapping, but most tutorials online only use that method in the form of a Skybox which is not what I'm trying to achieve at the moment. If someone can explain how I can have different textures for different cube sides or any shape that would be great.

The MSDN documentation says that I need to use a Texture Cube/Array but it lacks information regarding implementation.

sentences:
How to make gravity in pygame? I'm not sure why my gravity isn't working... Can pleas anyone help??
Here my code:
import pygame

pygame.init()

white = (255, 255, 255)
green = (0, 255, 0)
blue = (0, 0, 128)
black = (0, 0, 0)
red = (255, 0, 0)

w = 500
h = 500

x = 15
y = 480

vel = 5
screen = pygame.display.set_mode((500, 500))

square = pygame.image.load(r'/Users/lanik2009/Downloads/square.PNG')
square = pygame.transform.scale(square, (46, 40))
triangle = pygame.image.load(r'/Users/lanik2009/Downloads/triangle.PNG')
triangle = pygame.transform.scale(triangle, (46, 40))

def player():
    screen.fill(black)
    screen.blit(triangle, (80, 460))
    screen.blit(square, (180, 460))

jump = False

gravity = False

running = True

while running:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    keys = pygame.key.get_pressed()

    if keys[pygame.K_LEFT]:
        x -= vel

    if keys[pygame.K_RIGHT]:
        x += vel

    if gravity == True:
        y = 480

    if jump == True:
        gravity = True
        y -= 5

    if event.type == pygame.K_UP:
        y == 480

    if keys[pygame.K_UP]:
         jump = True

    player()

    pygame.draw.circle(screen, white, (x, y), 10, 500)
    pygame.display.update()

pygame.quit()

sentences:
Theory behind worm like movement? I don't want code or anything that will make this too easy for me, but I'm just starting the development of a little game and I want to add worms to it, I want the worms to be Terraria like. My current idea is to make the worm be composed of multiple entities, one being the head and the rest parenting each other leading downwards from the head. However, this in my opinion sounds inefficient and might be lag inducing when there are a large number of worms in the entity map. Does anyone have any other theories on how I can implement a worm- like movement?

Terraria worm video: http://www.youtube.com/watch?v=PhFR8bDQA5w

sentences:
UK Indie studio registration I'm from the UK and I've just about completed making an indie game and had some interest from several online retailers that sell games. This requires me filling in a basic contract.

I'm just one guy who works from home as a hobby, I go by a studio name for my game solely because that's the norm.

Do I need to register my 'company' name before I can go any further?

EDIT: I'm already registered as self employed from prior work in a different field

sentences:
Implementing proportional navigation in 3D Good afternoon guys,

a = N * λ' * V

is the formula for the commanded acceleration required to hit the target,
where N is the proportionality constant, λ' is the change in line of sight and V is the closing velocity.

Data I natively have:

[x,y,z] position of both missile and target;
[vx,vy,vz] velocity vector of both missile and target;
[x,y,z] vector which points from missile to target and opposite;
This is set by me but still: maximum speed of missile.

Data I can get with some calculations:

Vertical angle between missile and target (and opposite)  ;
Horizontal angle between missile and target (and the other way around).

That's the reference system of the game:

λ' or the derivative with respect to time of the Line of Sight it's a concept I really didn't understand...  its unit should be, in theory, Hz or (s^-1) since m/s^2 = λ' * m/s -> λ' = 1/s
V should be pretty easy to calculate: V = v(missile) - v(target) OR
Vx = (v(missile) - v(target)) * cos (x0y)
Vy = (v(missile) - v(target)) * sin (y0z)
Vz = (v(missile) - v(target)) * cos (y0z)
N well it's a scalar number, usually 3.

The computed acceleration will then be passed to a RK4 integrator which will move the interceptor towards its target.
To steer the missile, I will simply change its velocity vector at every update (every 1/60th of a second) and its orientation accordingly. For example: if the missile has a velocity of [0,100,0], he's going 100 m/s due y+ axis. If at the next frame it should slightly turn right, then he'll be going to have a velocity of [10,99,0] and so on.

That's the only thing left to finish off my little thesis and unfortunately I'm stuck here. In the meantime,  thank you very much!

Here's a video I made, but it doesn't still actually use the Proportional Navigation law: it checks if the missile is "aligned" to its target and eventually correct its route.
That's my actual code: pastebin

That's what i've come up with but sadly doesn't work as expected:

params ["_n","_missile","_target"];
private "_a";

_vm = velocity _missile;
_rm = getPosASLVisual _missile;

_vt = velocity _target;
_rt = getPosASLVisual _target;

_vr = _vt vectorDiff _vm;
_r = _rt vectorDiff _rm;

_omega = (_r vectorCrossProduct _vr) vectorMultiply (1/(_r vectorDotProduct _r));

_a = (_vr vectorCrossProduct _omega) vectorMultiply _n;

_a

Similar questions:
Finding the components of Proportional Navigation in 2D

sentences:
Key mapping for a 2-players game I've been struggling for a while trying to figure out the best way to map two players on a single keyboard. Let's consider something generic:

Arrows
Validation
Cancel (optional)
Some common actions shared between the two players (start, reset, etc.)

So far, I used:

P1: WASD + [Space or Tab]
P2: Arrows + [Enter or Return]
Common: R for reset

The problem is that some configuration can be uncomfortable on certain keyboards (especially when there is no keypad). Plus some players like to have the direction on left hand (FPS style) and others on right hand (platformer style). Also SHIFT is usually not a good choice on windows because of the sticky keys feature.

Also I'd like to avoid using a settings screen (kind of heavy for a small game). I guess a config file would be OK, but is there another way to handle this problem that would make every one happy?

sentences:
Work With Sounds in Unity I have a script in which I defined different functions for each button and assign them their appropriate functions. I defined if statements for them and now I want every button to play it's music when if is true. in OnClick I assigned the script but it didn't work and when I added AudioSurce to it under play () function, it played my sound on button click not when if was true. here is my script;

public class MainMenu3 : MonoBehaviour {

    [SerializeField] Button WhitePlane;
    [SerializeField] GameObject wood1;

    public static int chnum;
    public bool isPlanesold;

void Start () {

        PlayerPrefs.SetString ("BluePlane", "on");
        if (PlayerPrefs.GetString ("WhitePlane") == "on") {
            wood1.SetActive (false);
        }

        UIManager2.coin_score = PlayerPrefs.GetInt ("Score");
        isPlanesold = PlayerPrefs.GetInt ("isPlanesold") == 0 ? false:true;
}

public void BuyWhitePlane () {

        if (PlayerPrefs.GetString ("WhitePlane") == "on") {
            PlayerPrefs.SetInt ("isPlanesold", 1);
            chnum = 2;
            PlayerPrefs.Save ();
            SceneManager.LoadScene ("Menu2");
        } else if (UIManager2.coin_score >= 1) {
            this.GetComponent<AudioSource> ().Play ();
            PlayerPrefs.SetInt ("isPlanesold", 1);
            chnum = 2;
            PlayerPrefs.SetInt ("Score", UIManager2.coin_score--);
            PlayerPrefs.SetInt ("Score", UIManager2.coin_score);
            PlayerPrefs.Save ();
            PlayerPrefs.SetString ("WhitePlane", "on");
            SceneManager.LoadScene ("Menu2");

            }
        else
        {
            Debug.Log ("You Don't Have The Score");

        }
}

sentences:
Flipping a 3D text around its Y axis SharpGL /// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    private readonly MainViewModel _mainViewModel;
    private float _rotation;
    public MainWindow()
    {
        InitializeComponent();
        _mainViewModel = new MainViewModel();
        DataContext = _mainViewModel;
    }
    private void OpenGLControl_OpenGLInitialized(object sender, OpenGLEventArgs args)
    {
        OpenGL gl = args.OpenGL;
        gl.Enable(OpenGL.GL_DEPTH_TEST);
        gl.ShadeModel(OpenGL.GL_SMOOTH);
    }

    private void OpenGLControl_OpenGLDraw(object sender, OpenGLEventArgs args)
    {
        OpenGL gl = args.OpenGL;

        // Clear The Screen And The Depth Buffer
        gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);

        // Move Left And Into The Screen
        gl.LoadIdentity();
        gl.Translate(0.0f, 0.0f, _mainViewModel.Zoom);

        if (_mainViewModel.Rotate)
        {
            gl.Rotate(_rotation, 0.0f, -1.0f, 0.0f);
        }

        gl.Color(_mainViewModel.RgbColors[0], _mainViewModel.RgbColors[1], _mainViewModel.RgbColors[2]);

        gl.DrawText3D("Mazor", (float) 30.0, (float) 1.0, (float) 0.5, "Mazor");

        _rotation += 3.0f;
        gl.Flush();
    }
}

I would like to flip the 3D text I have around y axis, I am able to do so,
However I want the word "Mazor" to flip around the middle of the word, and not around the left side of the word.

if you run the code you can see the rotation occurs around the M letter, where as I would like to change the y axis to be where the Z letter is.
Can you please help ?
Thanks

sentences:
Colliders for moving inside a spaceship when the whole spaceship is made of a single mesh (in Unity) I've begun to study a unity engine in one purpose: I have a great multi player game idea!
The main essence: In space there are two (or even more) huge spaceships with crew consisted of players (all real humans). Ships are very powerful dreadnoughts with a lot of features (radar system, many weapons, missals, refinery factory, gravity generator, indoor light system, shields generators, engines and so on), but all systems are broken at the beginning of the game. Crew should decide, which systems are more important in battle and repair it. They should extract materials from asteroids and revive their spaceship. Then, they should locate second ship, and try to destroy it. Whose spaceship will be in a whole skin during one minute after destroying another, will be the winners. If there are more then two spaceships, surviving crew from destroyed ship can move to another alive ship.

I've already draw detailed 3d model of spaceship, but I faced with a problem during importing model to unity. The problem with mesh collider. Players should get into a ship and walking in it, HOW can I do that? I can't use non-convex mesh collider in unity 5, and I cannot put one collider to another. It would solve the problem, if I draw ship piece by piece, but not as entire. But ship is really complex, to assembly it from prepared parts take really long time and ship will be messily. Is there another way to solve my problem?

sentences:
XNA/MonoGame screen scale and keeping aspect My aim is to make a simple 2D platformer, the idea is that it will be a base resolution of 480x270 (16:9) which can scale x2, x4(1920x1080) or go full screen.

I basically do:

graphics.PreferredBackBufferWidth = 480;
graphics.PreferredBackBufferHeight = 270;

and call methods do double or x4 them and then call graphics.ApplyChanges() which work well, I assume any 1x1 pixels from 1x resolution now appear as 2x2 or 4x4.

However in full screen the image is just stretched to whatever fits, how can I make it "letterboxed"?

sentences:
Tiled2Unity not accepting a .txm file I'm trying to import a map from Tiled to Unity. I have seen on several video tutorials (all of them on Windows) that they used Tiled2Unity in order to import such files. However, when I download Tiled2Unity, it does not accept .tmx files. It says that it wants .xml. Fair enough--I export it from Tiled as an .xml, and then it can't read the file.

Has anyone else had this problem? Anyone know how to deal with it?

sentences:
WebGL wrong scaling of rectangle I'm working with this tutorial http://www.html5rocks.com/en/tutorials/webgl/webgl_transforms/

and my result is, that the rectangle moves in the direction of it's scaling values, and also scales at the same time. So if I scale (2.0, 1.0) it moves right and stretches, but I only want to strecht/scale it. This is my vertex shader, it is nearly the same as in the tutorial (declarations omitted):

void main(void) {
vec2 scaledPosition = a_position * u_scale;

vec2 rotatedPosition = vec2(
    scaledPosition.x * u_rotation.y + scaledPosition.y * u_rotation.x,
    scaledPosition.y * u_rotation.y - scaledPosition.x * u_rotation.x);

vec2 pos = rotatedPosition + u_translation;

vec2 zeroToOne = pos / u_resolution;
vec2 zeroToTwo = zeroToOne * 2.0;
vec2 clipSpace = zeroToTwo - 1.0;

v_texCoord = a_texCoord;

gl_Position = vec4(clipSpace, 0, 1);
}

What could be the mistake if it is not in the shader? Thanks in advance.

sentences:
what are the essential things to be looked upon in game design I've made a couple of games now.

Starting from basic hobbyist projects like snake , I advanced into platform based games, board games, turn based games. While doing the latter of these projects I had to spent a lot of time redesigning certain concepts, sometimes even throwing away certain logic. So always I've felt the time wasted could have been avoided or at least reduced, if I had properly planned each and every stage of my game.

Though i can try to do it on paperwork or by a word file with bulleted points. I think there ought to be some other way of game design.

Do help me with suggestions and other game design patterns being followed, either as an indie-game developer or as a game company. I can learn from both. I am not looking for game design e-books, since there is already a thread for that. I would like to get suggestions and game design patters.
Thank you.

sentences:
How is AI most commonly implemented in popular games? I'm no gamedev, I'm just a curious coder of not-games. I wonder, how does AI work in popular modern games, say, FPSs? Is it based on hard-coded rules? How much does it have in common with other kinds of AI (like the one which powers autonomous cars etc)? How do developers ensure the AI behaves naturally and is fun to play against?

Stuff I've googled mentioned different derivatives of MinMax but failed to answer how AI deals with continuous, changeable world, for what actions/states AI is rewarded and how it figures out its chance for success of different actions. I've also seen Machine Learning mentioned here and there but it seems it's not used in any serious game?

sentences:
Help developing a scoring system for a tech tree based game I'm working on a tech tree based project in which the player would select "advancements" to effect several measurement stats, or "basic stats".  I have a working excel model that will calculate the "scores" for these basic stats based on advancements selected, but I'd eventually like to use these measurement stats that I have to calculate higher level measurements like population or total production power.

For example in the case of calculating "Population", I'd like to take the (current pop + (current pop. * fertility rate)) - death rate.  Fertility rate would be calculated based on the "basic stats" of "health" and "food supply", and death rate on metrics like "health" and "squalor".

I'm not really sure how to use these measurements though...  If health and food supply both start at 0 and increased by 5 over the course of a few turns, how should I use these scores in a meaningful way to do what I'm trying to do in the case of fertility rate?  Fertility rate should be expressed as a certain percentage of total pop. but I'm not sure how to get there from two scores of 5.  I don't think this will be a simple process, but I feel like I'm missing some basic concepts to put this into place.  Is there a name for this kind of scoring system?

Any ideas would be appreciated!  Thanks.

sentences: How to change frames for the same object Lets say I have four frames A,B,C and D. In idle condition, I want the game object to repeatedly running on frame A and B . When using the method OnMouseDown, the same object change to frame C and D and OnMouseUp it return to the original frame A and B again. I'm not sure what command to look for on the internet. Would appreciate if someone can attach a link or example so I can start learning this myself.

sentences:
How are 3D models created in video games? How are 3D models in games designed and displayed? Is it all code? Drawn on paper, then on a 3D graphics software, then... what?

Of course, game programmers won't define every vertex of every shape(/object,) they want to be drawn, all in code (whether in Direct3D or OpenGL.) So, do the game designers have tools to use, like Maya or something like it of proprietary 3D graphics softwares out there; they "draw" the model in that software, export it in whatever format, then programmers parse it via code and automatically enter the decoded/parsed raw vertices of the object/model?

I have Googled much but I couldn't find something solid to explain how this aspect of professional video games is worked on.

sentences:
XNA Distortion Shader problem So I came up with a distortion pixel shader in hlsl, but it has some issues. First of all, here is how it works:

The shader uses another texture generated by the program as a distortion "map" (if that's the correct term) I called this map a "mask".

The shader uses the red values in the mask for horizontal distortion and the blue values as vertical distortion. The green values are not used.

It subtracts 0.5 from the red and green values so that they have a range from -0.5 to 0.5 instead of 0 to 1. This lets the distortion go in any direction using only two color values.

I let the shader "push" pixels up to 128 pixels.

sampler s0;
texture textu;
sampler tex_sampler = sampler_state{Texture = textu;};
float2 screenSize;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    float4 tex_color = tex2D(tex_sampler, coords);

    if (tex_color.a)
    {
        float distX = (tex_color.r - 0.5f) * (256.0f / screenSize.x) * tex_color.a;
        float distY = (tex_color.b - 0.5f) * (256.0f / screenSize.y) * tex_color.a;

        return tex2D(s0, float2(coords.x + distX, coords.y + distY));
    }
    return tex2D(s0, coords);
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

"textu" being the mask, "tex_color" is the color value from the mask.
It also multiplies the distortion by the alpha value in the mask.

This seemed to work perfectly at first, but I started noticing some issues.
I was using a completely white texture (as the mask) that was blurred around the edges. I set the color of this texture based on its rotation.
Here is the method I used for that:

private Color GetDirectionColor(float rad)
{
    Vector2 v = new Vector2(
        (float)Math.Cos(rad + Math.PI),
        (float)Math.Sin(rad + Math.PI)
        );

    float r = (v.X * 0.5f) + 0.5f;
    float b = (v.Y * 0.5f) + 0.5f;

    return new Color(new Vector3(r, 0, b));
}

This allows the texture to "push" pixels in whatever direction it is facing.
This method seems to work fine.

The problem is, when the texture is rotated more than 135 degrees and less than 315 degrees (as in, the texture is pointing into the upper left half of a circle if you cut it in half at a 45 degree angle) it does something strange. Where the texture is blurred (the alpha values become less than 1) it starts to "push" the pixels in the opposite direction that it should be.

I suspect this has to do with my shader and not something else in the program. Possibly the -0.5f part???

I'm terribly sorry if this is confusing... I could not find a better way to word it.

Thanks a lot for your help!

sentences:
Starting off with coordinate systems Where is a good place to start with learning how to program custom coordinate systems in a 3d environment?

Are there any good books on he topic of gaming coordinate systems? I would like to build a real life data structure based on techniques used for game programming.

sentences:
ResourceContentManager with folders I am attempting to do something like the following:
http://blogs.msdn.com/b/shawnhar/archive/2007/06/12/embedding-content-as-resources.aspx
(Access the content via a DLL)

However, I need to maintain the folder structure of the fonts and images. I have attempted to add the folders to the resources file, but it doesn't add the folder if I drop it in the resources file in VS. I am thinking I might need to embed the content as just a regular folder, and each file will need its property to be set to embedded resource, but I need to use it in another assembly.

I looked at: http://zacharysnow.net/2010/07/03/xna-load-texture2d-from-embedded-resource/
but I think I can only do that with textures. I need to do it with fonts as well.

I looked at: https://stackoverflow.com/questions/859699/how-to-add-resources-in-separate-folders and that doesn't seem to help me much.

Whats the best way I can embed my resources in another assembly, while maintaining my content loading strings?

sentences:
OpenGL HUD is flickering when rotating the camera I draw game HUD after drawing 3D scene. When I move the camera quickly, HUD starts flickering.
I noticed that it happens only if the distance between the camera and an object its looking at changes after camera's position transformation.It does not happen if there is no mesh in front of the camera. I use separate shader program for HUD rendering. Have tried to enable/disable depth test, blending already. Using VBOs to draw stuff.

Render code:

 def render()
{

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

    glEnable(GL_DEPTH_TEST)
    glDepthFunc(GL_LESS)
    glEnable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_VOXEL)
    Shader.currentShader().enable()
    set3DMatrices()
    updateShaderVOXEL()
    val world = WorldRegistry.getWorldByID(0)
    world.renderWorld()
    Shader.currentShader().disable()

    Shader.setCurrentShader(Shader.SHADER_SIMPLE)
    Shader.currentShader().enable()
    set3DMatrices()
    ManagerRegistry.renderManagerSceneBoundingBox.render()
    ManagerRegistry.renderManagerSceneRectangle.render()
    ManagerRegistry.renderManagerSceneLine.render()
    Shader.currentShader().disable()

    glDepthMask(false)
    glDisable(GL_DEPTH_TEST)
    glDisable(GL_CULL_FACE)

    Shader.setCurrentShader(Shader.SHADER_HUD)
    Shader.currentShader().enable()
    set2DMatrices()
    GL13.glActiveTexture(GL13.GL_TEXTURE0) // Texture unit 0
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, Texture.getTexture("screen/cursor/default.png"))
    HUDRenderRegistry.HUDRender.render()
    Shader.currentShader().disable()

    glDepthMask(true)

    glfwSwapBuffers(window)
}

EDIT

I made a video(captured on the phone, so the quality is bad, sorry) and the rectangle in it is actually fully red, not yellow.
https://youtu.be/HhHEfrgsfiU

sentences:
What are Hull, Domain and Geometry shaders used for? I've done my fair share of 3D game programming for my (former) employer, and also in my own custom engines for my own indie games.

Initially, I started with Direct3D 9, and D3DX9, which pretty much did everything for me, and didn't require me to think in terms of shaders at all.

After that, I wrote my first Direct3D 9 shaders, but mostly used one very simple shader for everything I did.

In the most recent iteration of my game engine, I moved to Direct3D 11, and with that I created lots of shaders. I did GPU skinning, GPU calculated particles, lots of lighting and post processing effects, all in the GPU. Really cool stuff.

So far I have only used vertex and pixel/fragment shaders. Even though there are still lots of things I still haven't done, I believe I have a solid knowledge of what the vertex and pixel/fragment shaders do, and how that all fits into the entire 3D pipeline.

Catching up with more recent developments, I've become very interested with the newer shader stages. That is, the Geometry Shader, and even newer, the Hull and Domain shaders.

I have never used these stages, but from what I know, the Geometry shader, if enabled, is run after the vertex shader, once for each transformed vertex (or once per primitive?) and allows you to discard vertices (and primitives?), and create new ones (which I guess go back to the beginning of the pipeline?).

My guess is that the main use of the geometry shader would be to programatically generate geometry in the GPU. A common usage would be to create billboard quads based on a single vertex, but I don't really visualize many other common scenarios apart from generating fractals and other stuff you can generate 100% programatically.

As for the Hull and Domain shaders, it seems like they're related to tessellation (creating smoother surfaces out of rough surfaces?), and must be used together or not at all. The term "patch" also seems to be common in here.

Would anybody care to explain to me, in practical terms, what these new-ish shader stages are for, how they fit into the 3D pipeline, and in which cases should I consider using them?

sentences:
What happens to data between vertex shader and pixel shader? Short version: What can happen to the output of a vertex shader that leads to no(or very few) pixels being drawn, especially in relation to a perspective matrix.

Long version:

My problem refers to the fact that when using a projection matrix very few pixels are actually drawn, more often than not, no pixels are drawn. I have used the built-in debugger in VS2012 and inspecting the output of the vertex shader reveals that the transformations are most likely correct, it is only when it is passed to the pixel shader that things start to go astray.

What I tried:

use different built in matrices for calculating perspective
check the code for indirect modifications
set "CULLING_NONE" as a rasterizer state, that only increased the chance of something actually being drawn
set the "w" component of the SV_POSITION vector to 1, that also seemed to help to a certain degree
checked winding of triangles

My implementation performs the View-Projection multiplication first (of their transposes)
and then multiplies the position with the result of the former. I believe that's not where the problem lies due to the associative property of matrix multiplication.

I'd prefer it if I wouldn't have to resort to all sorts of hacks that can only increase the chance of something being drawn at all (never in the right way) as it seems clear that the problem lies in my implementation.

sentences: How can I fill the white color image to fill within that border in a shape of a glass? I'm using this in 2D canvas. Because I'm doing a health bar and it suppose to fill from the bottom to up but I don't know where to start from here.

sentences:
Reference sf::RenderWindow from another source file in SFML In SFML, How would you be able to reference a window in your main.cpp file to another source file? I want to be able to reference the window made in main.cpp from player.cpp, so I can keep everything organized and not have so much stuff in main.cpp. Any help is greatly appreciated.

Main.cpp

#include "SFML/Graphics.hpp"
#include <iostream>
#include "Player.h"

int main()
{
    sf::RenderWindow window;
    sf::VideoMode vmode(800, 600, 32);
    window.create(vmode, "Test");

    PlayerTest(2);

    //Game Loop
    while (window.isOpen())
    {
        // REMEMBER TO FIX PLAYER.CPP

        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(text);
        window.display();
    }

    return 0;
}

Player.h

#ifndef PLAYER_H
#define PLAYER_H

#include <SFML/Graphics.hpp>
#include <iostream>

void PlayerTest(float speed);

#endif

Player.cpp

#include "SFML/Graphics.hpp"
#include <iostream>
#include "Player.h"

void PlayerTest(float speed) {

    sf::RectangleShape square(sf::Vector2f(100, 100));
    square.setFillColor(sf::Color::Cyan);

    //window from Main.cpp I need to reference
    while (window.isOpen())
    {
        if (sf::Keyboard::isKeyPressed(sf::Keyboard::W)) {
            square.move(0, -speed);
        }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) {
            square.move(0, speed);
        }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::A)) {
            square.move(-speed, 0);
        }
        else if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) {
            square.move(speed, 0);
        }

        //Window from Main.cpp I need to reference
        window.clear();
        window.draw(square);
        window.display();
    }
}

sentences:
Combine all animation state into one clip (.anim) file in unity I have an animation controller where different animation states(clips) are available. Like this:

Now my aim is to convert all this states animation into a single clip (.anim file). Is this possible. ?
I am able to copy one animation clips frame using this. But it very time consuming.

sentences:
Best way to separate display and game logic (threads) What is the best way to separate render and game logic threads?

I'd like to make logic-heavy game (ai, machine learning, and network) in which world updates 50-60 times per second.

I want to separate rendering so it will not waste logic's thread power.

I'm planning to use c++ with boost.

sentences:
Android local multiplayer I am working on a FPS game for Android and I want to make a support for local multiplayer with no additional devices or server required. One of the player's devices would serve as a server, getting and distributing all the messages, OR every device broadcasts messages to everyone inside the group.
First I was thinking bluetooth or wifi direct, but I am running into many problems with both. The plan was to support up to 10 players,  so I am not sure bluetooth can handle that (broadcast messages and similar). If it is possible, let me know.
Also, I heard of an option to make a wifi hotspot on one device, and connect all other devices to it that way, but I have no idea how that would work.
Does anyone have any real experience with this, or any advice on how to implement it?
Thanks in advance.

PS. yes, I've ran through everything on android developers site, but their wifi direct example is kinda bad and only supports 1-way data transfer.

sentences:
Instantiating Prefabs at run time I'm trying to move my project to Addressables and upload assets, prefabs and screens to an archive on the server.
I'm a new in Unity and this a bit challenging for me.
I've prepared all prefabs for addressable usage and now I'm trying load them.

All my prefabs have loads throw GameObject.Instantiate
For example:

    public class PlatformObject : LocationObject
        {
//other properties and methods
            public PlatformObject Clone()
            {
                var clone = ((Runner.PlatformObject)GameObject.Instantiate(this));
                clone.Id = this.Id;
                clone.NextPlatforms = this.NextPlatforms;
                clone.IsStartPlatform = this.IsStartPlatform;
                clone.Level = this.Level;
                clone.Type = this.Type;
                clone.MinimumDistance = this.MinimumDistance;
                clone.AllowDispose = false;
                clone.Size = this.Size;
                return clone;
            }
    }

I've tried change this code for usage Addressables.

public async Task<PlatformObject> Clone()
        {
            var handle = Addressables.LoadAssetAsync<GameObject>(this.name);
            var clone = (await handle.Task).GetComponent<PlatformObject>();
            clone.Id = this.Id;
            clone.NextPlatforms = this.NextPlatforms;
            clone.IsStartPlatform = this.IsStartPlatform;
            clone.Level = this.Level;
            clone.Type = this.Type;
            clone.MinimumDistance = this.MinimumDistance;
            clone.AllowDispose = false;
            clone.Size = this.Size;
            return clone;
        }

I've got a cloned object successfully, but object doesn't appears on the scene. Looks like object not initialized properly, bcouz I've got a lot of warnings like that:

  Setting the parent of a transform which resides in a Prefab Asset is
  disabled to prevent data corruption (GameObject: 'Mid_Town_07').
  UnityEngine.Transform:set_parent(Transform)

I've googled and have found a few solution related with parent location.
Made changed but it didn't help. I'm still getting those warnings.

sentences:
Unity3D: Multiple OnTriggerEnters are called before the first one could finish and destroy the object I'm working on a projectile which explodes when it reaches a destructible object and damages its voxels. (The projectile is a trigger)

But the problem is that I use raycasting in OnTriggerEnter which makes it slow to finish. Which lets multiple OnTriggerEnter to be called before it could be finally destroyed.

I fixed it by having a flag which lets only one call to be executed. But it feels a bit hacky, so I decided to ask you, maybe you have some better solutions.

void OnTriggerEnter(Collider collider)
{
    if (!hit && LayerMask.LayerToName(collider.gameObject.layer) == "Destructible")
    {
        hit = true;
        DoImpact();
        Destroy(gameObject);
    }
}

void DoImpact()
{
    //Do ~1 SphereCast
    RaycastHit[] hits = Physics.SphereCastAll(transform.position, ExplosionRange, transform.forward, 0.0001f, 1 << LayerMask.NameToLayer("Destructible"));
    //Iterate through voxels
    foreach(var hit in hits)
    {
        //the parent object which manages its voxels
        var destructible = FindDestructibleParent(hit.transform);
        //Make some damage to that voxel based on the projectile, the voxel, and some "whole container/parent object properties"
        destructible.TakeDamage(this, hit.transform.gameObject);
    }
}

sentences:
How to fix stretched splash image in Unity? I'm trying to add my own splash on my Unity project. However, when I implement it, the splash is stretched vertically, real bad.

Here is the screenshot:

While the original splash is:

I'm not altering the settings for the sprite that much:

How to fix that problem? I'm using a 1080x1080 PNG file for the splash and Unity 5.5.0f for building the application. Altering the resolution of the PNG results no luck. Am I missing something important here?

EDIT: Sorry for the late mention, but I've made the border on the sprite editor. Still no luck.

sentences:
Legal issues with nba player names, profiles, logos? I am searching for this topic and I found a similar question asked
check here:
Legal issues around using real players names and team emblems in an open source game

however I have specific questions where I don't know where to ask.

So I'll make an nba-quiz mini game and I need to know if there might cause some trouble using player profile images, names, team names and logos.

I found about a dozen suck mobile apps which use real names also some use photos as well.

In case I need a permission or check the customs, where to contact? where can I find such regulations?

Lets say I am allowed to use profile images, can I use the official images found on nba.com or yahoo or any sports website?

If not, where to get all player photos? sure can't capture them one by one :)

As for team logos, there are logo-quiz apps which mentions hundreds of logos of different international famous companies, I don't think the app owner contacted each company.

Any related information would help.

Thanks

sentences:
How can I make Maya or Blender model work with mecanim? I'm working on a simple game project, where I need a stick figure. Due to being stubborn and the desire to learn a new skill, I want to make the stick figure myself! I have followed several tutorials in both Maya and blender. For Maya, I'm using the student version. I have my stick figure rigged within Maya and blender, both utilizing their respective bone tools. I can manipulate their limbs well, enough. However, I can't seem to get the models to work with Mecanim.

I have the Kinect adapter for the PC and would like to be able to use it to create the animations utilizing a tool such as the Kinect v2 mocap animator.

How I can get my model to work with Kinect based mocap?

sentences:
Custom extensible file format for 2d tiled maps I have implemented much of my game logic right now, but still create my maps with nasty for-loops on-the-fly to be able to work with something. Now I wanted to move on and to do some research on how to (un)serialize this data. (I do not search for a map editor - I am speaking of the map file itself)

For now I am looking for suggestions and resources, how to implement a custom file format for my maps which should provide the following functionality (based on MoSCoW method):

Must have

Extensibility and backward compatibility
Handling of different layers
Metadata on whether a tile is solid or can be passed through
Special serialization of entities/triggers with associated properties/metadata

Could have

Some kind of inclusion of the tileset to prevent having scattered files/tilesets

I am developing with C++ (using SDL) and targetting only Windows. Any useful help, tips, suggestions, ... would be appreciated!

Result of the discussion below

I have been designing my map file format the last few hours and came up with a skeleton (contains only layers for now - I'll leave the rest to everyone designing his/her own format) which I wanted to share with everyone interested - if you have the same intentions you can get some kind of inspiration. The full-size screenshot can be downloaded at Imgur.

sentences:
Compiling Quake 3 in Snow Leopard First of all I have Xcode 4 installed in Mac OS X Snow Leopard 10.6.8. I have downloaded the Quake 3 source code 1.32b release but I can't open the Xcode project that is inside the /macosx folder since it is in the old .pbproj format and therefore it throws an "incompatible version" error. Has anyone been able to convert this to a Xcode format or is there any other way to compile the source code in Mac OS X Snow Leopard?

Thanks

sentences:
Looping OpenAL sounds with one buffer - or how to do it correctly? I require to implement a statically played sound class which supports looping of the audio data - and requires this to be changed at runtime (e.g., turning off looping).

Maybe I understand something horribly wrong, but this is how I understood how to implement looping at all, and came to the following solution:

I have exactly one buffer containing all the audio data.
If looping is enabled, ensure that the source playing the sound has this buffer queued twice, so it replays the sound when the end of the current buffer has been reached:

if (Loop && _source.BuffersQueued == 1)
{
    _source.QueueBuffers(_buffer);
}

If a buffer has been processed (e.g. right after the sound audibly loops), it is unqueued and dismissed.

if (_source.BuffersProcessed > 0)
{
    _source.UnqueueBuffers(_source.BuffersProcessed); // Unqueue outdated buffers
}

Here I ran into the first problem: If the user sets the sound to not loop anymore, I cannot unqueue the upcoming buffer (to make it not loop over another time while looping has already been turned off).

This is because I only found methods to unqueue by the handle of the buffer, but since I queue the same buffer twice, the handle is always the same to the one currently playing. OpenAL tries to unqueue the currently played buffer then, which obviously fails.

Unqueuing by the number of processed buffers also doesn't help, as no buffer has been marked as processed yet.

Do I really need to completely duplicate the buffer with all the audio data, keep it stored twice in memory, just to have two different buffer handles to unqueue the second buffer if looping gets disabled?

sentences:
Issue giving object player's hand position I'm trying to put an object (for example a sword) in my player's hand.
To do so i set the player's hand transform as the object's parent, in order to have the same movement for the object and the hand. No problem here.

The real issue starts as soon as i set the sword position to the hand position. My player starts to move backward.

One of my doubt was that my sword has a rigid body and my player too, so it could have an impact on it because I know that you can set a rigid body as a rigid body child.

So I was wondering if it's the right way to do it.

Edit

Here is my script to pickup an item:

 public void PickupItem()
    {
        Ray interactionRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit interactionHit;

        if (Physics.Raycast(interactionRay, out interactionHit, InteractionMaxDistance))
        {
            if (interactionHit.collider.tag == "LootableItem")
            {
                Item item = interactionHit.collider.gameObject.GetComponent<Item>();
                GetComponent<CharacterStats>().AddStats(item.Stats);

                _hand = TransformUtil.FindChild("mixamorig:RightHandMiddle1", _player);
                item.GetComponent<Rigidbody>().isKinematic = true;
                item.GetComponent<Rigidbody>().useGravity = false;

                item.transform.parent = _hand;
                item.transform.position = _hand.position;
                item.transform.rotation = _hand.rotation;
            }
        }
    }

My script for player movement :

void Update()
    {
        float translation = (Input.GetAxis("Vertical") * Speed) * Time.deltaTime;
        float rotation = (Input.GetAxis("Horizontal") * RotationSpeed) * Time.deltaTime;
        transform.Translate(0, 0, translation);
        transform.Rotate(0, rotation, 0);

        if (Input.GetButtonDown("Jump"))
        {
            _animator.SetTrigger("triggerJump");
            return;
        }

        if (Math.Abs(translation) < 0.01 && Math.Abs(rotation) < 0.01)
        {
            Speed = 1;
        }
        else
        {
            if (Input.GetKey(KeyCode.LeftShift))
            {
                Speed = 4;
                RotationSpeed = 150;
            }
            else
            {
                Speed = 2;
                RotationSpeed = 200;
            }
        }

        _animator.SetFloat("speed", Speed);
        _animator.SetFloat("rotation", rotation);
        _animator.SetFloat("translation", translation);
    }

I took my character from Mixamo, same for the animaitons.

sentences:
Getting proper shadows in my Disolve shader So I wipped up this shader that disolves an object. The problem is that the shadow of the object is unaffected from the alpha value. How do I fix this. Full code :

Shader "Custom/SwordDistortion" {
    Properties {
        _Color("Color", Color) = (1,1,1,1)
        _MainTex("Albedo (RGB)", 2D) = "white" {}
        _DissolveScale("Dissolve Progression", Range(0.0, 1.0)) = 0.0
        _DissolveTex("Dissolve Texture", 2D) = "white" {}
        _GlowIntensity("Glow Intensity", Range(0.0, 5.0)) = 0.05
        _GlowScale("Glow Size", Range(0.0, 5.0)) = 1.0
        _Glow("Glow Color", Color) = (1, 1, 1, 1)
        _GlowEnd("Glow End Color", Color) = (1, 1, 1, 1)
        _GlowColFac("Glow Colorshift", Range(0.01, 2.0)) = 0.75
        _DissolveStart("Dissolve Start Point", Vector) = (1, 1, 1, 1)
        _DissolveEnd("Dissolve End Point", Vector) = (0, 0, 0, 1)
        _DissolveBand("Dissolve Band Size", Float) = 0.25
    }
    SubShader {
        Tags {
        "Queue" = "Transparent"
        "RenderType" = "TransparentCutout"
    }

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard addshadow alpha:fade
        #pragma vertex vert
        // using shader model 4.6 for even nicer lighting
        #pragma target 4.6

        sampler2D _MainTex ;
        sampler2D _DissolveTex ;
        float _DissolveScale;
        float3 _DissolveStart;
        float3 _DissolveEnd;
        float _DissolveBand;
        float _GlowIntensity;
        float _GlowScale;
        float _GlowColFac;
        fixed4 _Color;
        fixed4 _Glow;
        fixed4 _GlowEnd;
        struct Input {
            float2 uv_MainTex;
            float3 dGeometry;
        };

        //Precompute dissolve direction.
            static float3 dDir = normalize(_DissolveEnd - _DissolveStart);

        //Precompute gradient start position.
        static float3 dissolveStartConverted = _DissolveStart - _DissolveBand * dDir;

        //Precompute reciprocal of band size.
        static float dBandFactor = 1.0f / _DissolveBand;

        void vert(inout appdata_full v, out Input o)
        {
            UNITY_INITIALIZE_OUTPUT(Input, o);

            //Calculate geometry-based dissolve coefficient.
            //Compute top of dissolution gradient according to dissolve progression.
            float3 dPoint = lerp(dissolveStartConverted, _DissolveEnd, _DissolveScale);

            //Project vector between current vertex and top of gradient onto dissolve direction.
            //Scale coefficient by band (gradient) size.
            o.dGeometry = dot(v.vertex - dPoint, dDir) * dBandFactor;
        }

        void surf (Input IN, inout SurfaceOutputStandard o) {
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
            half dBase = -2.0f * _DissolveScale;
            fixed4 dTex = tex2D(_DissolveTex, IN.uv_MainTex);
            half dTexRead = dTex.r + dBase;
            half dFinal = dTexRead + IN.dGeometry;
            half alpha = clamp(dFinal, 0.0f, 1.0f);
            //Shift the computed raw alpha value based on the scale factor of the glow.
            //Scale the shifted value based on effect intensity.
            half dPredict = (_GlowScale - dFinal) * _GlowIntensity;
            //Change colour interpolation by adding in another factor controlling the gradient.
            half dPredictCol = (_GlowScale * _GlowColFac - dFinal) * _GlowIntensity;

            //Calculate and clamp glow colour.
            fixed4 glowCol = dPredict * lerp(_Glow, _GlowEnd, clamp(dPredictCol, 0.0f, 1.0f));
            glowCol = clamp(glowCol, 0.0f, 1.0f);
            o.Albedo = c.rgb;
            o.Alpha = alpha;

            o.Emission = glowCol;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
How to calculate a movement Vector3 to kill unnecessary momentum and start moving in the right direction? Imagine a rocket is accelerating in a straight line toward PointA, picking up momentum every frame, then suddenly decides it wants to go toward PointB instead.

It can't just turn straight toward PointB and start accelerating, because the new acceleration plus the pre-existing momentum will carry it wildly off-course, and not straight toward PointB.

It could turn exactly 180° around to aim directly away from PointA and thrust until it comes to a stop, then turn toward PointB and start accelerating from scratch. But that's very inefficient, especially if the two points are in generally similar directions.
It would be more efficient to turn and start accelerating in some specific direction that will bleed off the unnecessary momentum but keep any useful momentum, course-correcting so that it is now moving toward PointB.

I'm trying to figure out how to calculate that "specific direction" that the rocket needs to start accelerating toward, in order to efficiently reach PointB. I have the rocket's position, the Vector3 of its inertia, and the Vector3 locations of PointA and PointB, but I'm not experienced enough in Vector Math to totally understand what's needed.
Especially since we're talking about acceleration (not just speed), so the angle will no doubt need to be recalculated each frame as the changing momentum leads to a changing angle toward PointB, etc.
Can anyone help me out?

sentences:
Xna menu navigation with controller I have a menu that you can navigate with the keyboard, but I also want it so you can navigate it with the controller thumb sticks. But my problem is that if you push down or up on the thumb sticks it will just fly through the menu. To fix problem if it was a keyboard you would just do: prevKeyState.IsKeyUp(Keys.Down).
So I was wondering if there anything like this for the controller thumb sticks?

I'm not sure if I'm doing something wrong but it still flies through the menu.

 private enum GamePadStates
    {
        None,
        GoingDown,
        GoingUp
    }

    GamePadStates CurrentGamePad, PreviousGamePad = GamePadStates.None;
     public void Update(GameTime gameTime)
    {
        keyState = Keyboard.GetState();
        gamePadState = GamePad.GetState(PlayerIndex.One);
        PreviousGamePad = CurrentGamePad;

        if (gamePadState.ThumbSticks.Left.Y > 0.1)
            CurrentGamePad = GamePadStates.GoingUp;
        else if (gamePadState.ThumbSticks.Left.Y < -0.1)
            CurrentGamePad = GamePadStates.GoingDown;
        else
            CurrentGamePad = GamePadStates.None;

        if (keyState.IsKeyDown(Keys.Down) && prevKeyState.IsKeyUp(Keys.Down) ||
             CurrentGamePad == GamePadStates.GoingDown && PreviousGamePad != GamePadStates.GoingUp)
        {
            if (selected < (buttonList.Count - 1))
            {
                selected++;
            }
        }

        if (keyState.IsKeyDown(Keys.Up) && prevKeyState.IsKeyUp(Keys.Up) ||
            CurrentGamePad == GamePadStates.GoingUp && PreviousGamePad != GamePadStates.GoingDown)
        {
            if (selected > 0)
            {
                selected--;
            }
        }

sentences:
Pygame Scrolling Bug With Enemys I have a problem with my enemy where when my player scrolls left the enemy scrolls with the player is there anyway to fix this even Video my full code is below its to long to fit here though

what I was trying to do is make my enemy not to change its position when my window is scrolling its doing the same for right and left keeps following the player

while runninggame:
    clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            runninggame = False
  [...]
# I did the same for my players key movement  this part suppose to not make my player scroll
if playerman.y < 250:
        playerman.y += 1
        for platform in platforms:
            platform.y += playerman.speed
        for enemys in enemying:
            enemys.y += playerman.speed

my enemy class

class enemy:
    def __init__(self,x,y,height,width,end):
        self.x = x
        self.y =y
        self.esright = [pygame.image.load("esright1.png"),
        pygame.image.load("esright1.png"),
        pygame.image.load("esright2.png"),
        pygame.image.load("esright3.png"),
        pygame.image.load("esright4.png"),
        pygame.image.load("esright5.png"),
        pygame.image.load("esright6.png"),
        pygame.image.load("esright7.png"),
        pygame.image.load("esright8.png"),
        pygame.image.load("esright9.png"),
        pygame.image.load("esright10.png"),
        pygame.image.load("esright11.png"),
        pygame.image.load("esright12.png"),
        pygame.image.load("esright13.png"),
        pygame.image.load("esright14.png"),
        pygame.image.load("esright15.png"),
        pygame.image.load("esright16.png"),
        pygame.image.load("esright17.png"),
                          ]
        self.esleft = [pygame.image.load("esleft1.png"),
        pygame.image.load("esleft1.png"),
        pygame.image.load("esleft2.png"),
        pygame.image.load("esleft3.png"),
        pygame.image.load("esleft4.png"),
        pygame.image.load("esleft5.png"),
        pygame.image.load("esleft6.png"),
        pygame.image.load("esleft7.png"),
        pygame.image.load("esleft8.png"),
        pygame.image.load("esleft9.png"),
        pygame.image.load("esleft10.png"),
        pygame.image.load("esleft11.png"),
        pygame.image.load("esleft12.png"),
        pygame.image.load("esleft13.png"),
        pygame.image.load("esleft14.png"),
        pygame.image.load("esleft15.png"),
        pygame.image.load("esleft16.png"),
        pygame.image.load("esleft17.png"),
                          ]
        self.esright = [pygame.transform.scale(image,(image.get_width()//3,image.get_height()//3)) for image in self.esright]
        self.esleft = [pygame.transform.scale(image,(image.get_width()//3,image.get_height()//3)) for image in self.esleft]
        self.height = height
        self.width = width
        self.anim_index = 0
        self.distance = 80
        self.speed = 8
        self.vel = 3
        self.path = [x,end]
        self.walking_index = 0
        self.rect = pygame.Rect(x,y,height,width)
       def draw(self,window):
       self.move()
       if self.Walking_index + 1 >= 33:
           self.Walking_index = 0
       if self.vel > 0:
           window.blit(self.esright[self.Walking_index//3], (self.x,self.y))
           self.Walking_index += 1
       else:
           window.blit(self.esleft[self.Walking_index//3], (self.x,self.y))
           self.Walking_index += 1
       def move(self):
       if self.vel > 0:
           if self.x + self.vel < self.path[1]:
               self.x += self.vel
           else:
               self.vel = self.vel * -1
               self.Walking_index = 0
       else:
           if self.x - self.vel >  self.path[0]:
               self.x += self.vel
           else:
               self.vel = self.vel * -1
               self.Walking_index = 0

where I defined the enemy class

black = (0,0,0)
enemys1 = enemy(550,436,50,50,300)
enemys = [enemys1]

my full code its to long to fit here  script

sentences:
How to remove gameobjects that have the same transform position as each other? If I have 4 copies of the same gameobject in my scene and they all have the exact same transform position as each other, how can I remove the 3 duplicates so that only one unique gameobject remains? This is what I tried so far...

private void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        RemoveDuplicate(GameObject.FindGameObjectsWithTag("Path"));
    }
}

private void RemoveDuplicate(GameObject[] other)
{
    for (int i = 0; i < GameObject.FindGameObjectsWithTag("Path").Length; i++)
    {
        if (GameObject.FindGameObjectsWithTag("Path")[i] == other[i]) continue;
        if (GameObject.FindGameObjectsWithTag("Path")[i].transform.position == other[i].transform.position)
        {
            Destroy(other[i]);
        }
    }
}

But it doesn't work at all. Any ideas?

sentences:
Algorithm for simulating collision between circles of different mass First of all, I'm not sure if this is the right site for this question, as it's actually a game I'm developing. However, I thought that this would be a common thing to need to know in games, so I put it here.
I'm programming a physics simulation in which I have a list of balls that are moving around. They have different masses and radii. I am trying to find an algorithm to make them bounce off each other when they collide. I've googled the problem and found lots of solutions for when the balls are the same mass (such as billiards), but none for different mass balls. It's not essential to the question but I'm programming this in JavaScript using p5.js

sentences:
Unity tutorial sync var not working I tried to make a simple miltiplayer game with the unity tutorial. The Code of the Player looks like this:

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

 public class PlayerController : NetworkBehaviour {

     public GameObject bulletPrefab;
     public Transform bulletSpawn;

     public Camera cam;

      // Update is called once per frame
     void Update () {
         if (!isLocalPlayer) {
             return;
         }

         float x = Input.GetAxis ("Horizontal") * Time.deltaTime * 150.0f;
         float z = Input.GetAxis ("Vertical") * Time.deltaTime * 3.0f;
         transform.Rotate (0, x, 0);
         transform.Translate (0, 0, z);

         if(Input.GetKeyDown(KeyCode.Space)){
             CmdFire();
         }

     }

     void Start()
     {
         cam.gameObject.SetActive(false);
         if(isLocalPlayer)
         {
             cam.gameObject.SetActive(true);
         }

     }

     [Command]
     public void CmdFire(){
         GameObject bullet = (GameObject)Instantiate (bulletPrefab, bulletSpawn.position, bulletSpawn.rotation);
         bullet.GetComponent<Rigidbody> ().velocity = bullet.transform.forward * 6.0f;

         // Spawn the bullet on the client
         NetworkServer.Spawn(bullet);

         Destroy (bullet, 2f);
     }

     public override void OnStartLocalPlayer ()
     {
         GetComponent<MeshRenderer> ().material.color = Color.blue;
     }
 }

The Code of the health class like this :

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.Networking;

 public class Health : NetworkBehaviour {

     public const int maxHeath = 100;
     [SyncVar(hook="OnChangeHealth")] public int currentHealth  = maxHeath;

     public RectTransform healthBar;
     public RectTransform publicHealthBar;

     private int maxHealthBarSize;

     public bool destroyOnDeath;

     private NetworkStartPosition[] spawnPoints;

     void Start(){
         if (isLocalPlayer) {
             spawnPoints = FindObjectsOfType <NetworkStartPosition>();

             maxHealthBarSize = (int) healthBar.sizeDelta.x;
         }
     }

     public void TakeDamage(int amount){

         if (!isServer) {
             return;
         }

         currentHealth -= amount;

         if (currentHealth <= 0) {

             if (destroyOnDeath) {
                 Destroy (gameObject);
             }
             else {
                 currentHealth = maxHeath;
                 RpcRespawn ();
             }

         }

     }

     void OnChangeHealth(int health){
         if(isLocalPlayer)
         {
             healthBar.sizeDelta = new Vector2(((float)health / maxHeath) * maxHealthBarSize, healthBar.sizeDelta.y);
         }
     }

     [ClientRpc]
     void RpcRespawn(){
         if (isLocalPlayer) {

             Vector3 spawnPoint = Vector3.zero;
             if (spawnPoints != null && spawnPoints.Length > 0) {
                 spawnPoint = spawnPoints [ Random.Range (0, spawnPoints.Length) ].transform.position;
             }

             transform.position = spawnPoint;
          }
     }

 }

But the health bar is only updating on 1 client. This means : A shoots B -> B's Healthbar updates -> B shoots A -> A's healthbar doesn't update.Does anyone know howw to fix the issue? (Is it unity or me?) Probably me :)

sentences:
Ambient occlusion: Correct culling after anisotropy correction I've added simple color based ambient occlusion to my game.

First it looked like this (from giawa.com):

The description: "Due to anisotropy, the ambient occlusion shading on the top left is inconsistent with the top right. We need to flip those quads so that they get rendered properly."

So according to that I had to flip some faces in order to fix the issue. I did and then it would look like this:

This is of course because of back face culling, culling the flipped faces.

When I disable culling, it looks like this:

Which is how it's supposed to look. But as you can imagine, that costs a lot of performance because culling is now disabled.

According to the article: http://www.giawa.com/author/giawa/page/10/
"This occurs due to differences in how the GPU linear interpolates across the edge of a triangle versus the body of a triangle. This is called anisotropy, and can be fixed by ‘flipping’ the quad. My final fix was to enable polygon culling, which meant I had to make sure to render my quads in a consistent winding. "

I've searched for this "polygon culling" but could not find anything about that.

I can't just switch between culling modes because all the vertexes are added to a vertex buffer when initializing a chunk. This is so I can render each chunk in one draw call.

I hope anyone knows a way to fix this, thanks in advance.

sentences:
2.5D platformer how to darken building edges? I was wondering how I could go about creating a vignette type effect / some sort of volumetric shadow for the 'cross section' parts of a 2.5D level. The effect I'm going for can be seen in 'This war of mine' where the edges of the rooms and walls / floors that are facing the camera have been darkened and blurred. (see below).

I thought about creating the edges in photoshop and then blurring them and putting them in, however the blur scales weirdly as I'm re scaling the sprites so it looks really fake and not like a visual effect. Is there perhaps a 2d shader I could use or make?

Any help on this would be appreciated!

Cheers

My photoshop attempt to recreate

sentences:
Low coupling and tight cohesion Of course it depends on the situation. But when a lower lever object or system communicate with an higher level system, should callbacks or events be preferred to keeping a pointer to higher level object?

For example, we have a world class that has a member variable vector<monster> monsters. When the monster class communicates with the world, should I prefer using a callback function then or should I have a pointer to the world class inside the monster class?

sentences:
How to shoot a triangle out of an asteroid which floats all of the way up to the screen? I currently have an asteroid texture loaded as my "test player" for the game I'm writing. What I'm trying to figure out how to do is get a triangle to shoot from the center of the asteroid, and keep going until it hits the top of the screen. What happens in my case (as you'll see from the code I've posted), is that the triangle will show, however it will either be a long line, or it will just be a single triangle which stays in the same location as the asteroid moving around (that disappears when I stop pressing the space bar), or it simply won't appear at all. I've tried many different methods, but I could use a formula here.

All I'm trying to do is write a space invaders clone for my final in C#. I know how to code fairly well, my formulas just need work is all.

So far, this is what I have:

Main Logic Code

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 1, 1);

            mAsteroid.Draw(mSpriteBatch);

            if (mIsFired)
            {
                mPositions.Add(mAsteroid.LastPosition);
                mRay.Fire(mPositions);
                mIsFired = false;
                mRay.Bullets.Clear();
                mPositions.Clear();
            }

            base.Draw(gameTime);
        }

Draw Code

            public void Draw()
            {
                VertexPositionColor[] vertices = new VertexPositionColor[3];

                int stopDrawing = mGraphicsDevice.Viewport.Width / mGraphicsDevice.Viewport.Height;

                for (int i = 0; i < mRayPos.Length(); ++i)
                {
                    vertices[0].Position = new Vector3(mRayPos.X, mRayPos.Y + 5f, 10);
                    vertices[0].Color = Color.Blue;
                    vertices[1].Position = new Vector3(mRayPos.X - 5f, mRayPos.Y - 5f, 10);
                    vertices[1].Color = Color.White;
                    vertices[2].Position = new Vector3(mRayPos.X + 5f, mRayPos.Y - 5f, 10);
                    vertices[2].Color = Color.Red;

                    mShader.CurrentTechnique.Passes[0].Apply();
                    mGraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, vertices, 0, 1);

                    mRayPos += new Vector2(0, 1f);

                    mGraphicsDevice.ReferenceStencil = 1;
                }
            }

sentences:
How do I go about creating the "Watcher" component? Last weekend, I spent several hours writing a basic entity component model, in JavaScript. I was largely referencing the Ash Actionscript game engine. I successfully worked out how the systems, components, nodes, and entities all link up, but one thing that eludes me is how to implement the "watcher" that checks the entities for their components, creates nodes for them, adds those nodes to the various systems automatically, and watches for any changes in the components on an entity. I was a bit confused by the way it works, in Ash, and all of the posts and tutorials on the subject that I have read seem to forgo the details of that part of the implementation.

Right now, I currently have the following:

Entity, which is assigned components.
Engine, which keeps a track of the systems and entities.
Node, which contains references to the components in an entity that we want the system to modify (I am currently creating these, manually, and adding it to the system).
Component, which contains the data to be modified by the system.
System, which operates on the nodes, which in turn change the data in the entity.
I also have various other classes, dedicated to holding lists of the various objects.

How do I go about creating the "Watcher" component?

sentences:
Is there a way how to handle multiple SDL_PollEvent loops without clearing the event queue? Is there a way how can I handle more SDL_PollEvent while loops for one SDL Event, without taking the events off from the event queue?

Let us say I have something like this:

void Game::processInput() {

    SDL_Event event;
    SDL_PollEvent(&e);

    Engine::InputManager::processInput(&e)

    GUI_Library::InputManager::processInput(&e);
}

And then the engine processes the input in function like this:

    void Engine::InputManager::processInput(SDL_Event* e) {

    _mainEvent = *e;

    while (SDL_PollEvent(&_mainEvent)) {

        switch (_mainEvent.type) {

            case SDL_KEYDOWN : {

                Engine::InputManager::pressKey(_mainEvent.key.keysym.sym);
                break;
            }
            case SDL_KEYUP : {

                Engine::InputManager::releaseKey(_mainEvent.key.keysym.sym);
                break;
            }
        }
    }
}

However, this while loop clears the whole event queue, and another input manager (my GUI, for example) does nothing because it no longer has events in the queue.

Is there a possible way to handle this situation?

sentences:
Full screen quad in the HLSL Directx 11 I want to create a full screen Triangle/Quad so I can blur the box that is the quad I made. I want to do this in the vertex buffer. I tried this code:

    struct VSQuadOut {
    float4 position : SV_POSITION;
    float2 uv: TEXCOORD;
};

// outputs a full screen triangle with screen-space coordinates
// input: three empty vertices
VSQuadOut VSQuad( uint vertexID : SV_VertexID ){
    VSQuadOut result;
    result.uv = float2((vertexID << 1) & 2, vertexID & 2);
    result.position = float4(result.uv * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0.0f, 1.0f);
    return result;
}

I want something like this

Any ideas?

sentences:
UDK iOS: System Requirements confusion Unreal Development Kit for iOS was recently released. The system requirements note that Windows is needed. Does this mean that iOS game development is possible on a PC now?

I am confused since I thought iOS development required an OSX machine.

Thanks in advance.

sentences:
Tilemap Object Placement I am looking for a way to select tiles within a bounding box for object placement within a scene/world, similar to Roller Coaster Tycoon and other simulation games.

(source: tumblr.com)

In the above screenshot of Theme Parkitect you can see that a 4x4 grid is used as the footprint for the object being placed. Given the bounding box and location of the mouse, how can I suitably determine the neighbouring tiles which fall into the bounding box?

I have implemented a graph like structure of tiles, corners and edges by following Amit's fantastic articles on Red Blob Games. As of such, I have a graph of all  tiles and their neighbours as well as associated tile edges and corners. These tiles are laid out diagonally against the world axis so simply selecting all tiles within a rectangular region isn't as simple (or maybe it is?) as i'd expected. This layout can be changed if necessary however.

The main source of information used to steer my implementation has been from Amit's Thoughts on Grids and the graph structure implemented in his article about Procedural Map Generation

As a bonus, I would like to implement a way to rotate the object being placed such that a footprint of 1x5 could be rotated to instead be 5x1. I would imagine that once the basics of multiple tile picking has been implemented this should be reasonably simple.

Unfortunately, Amit's articles don't seem to cover this topic and the approaches I have found and tried so far haven't quite yielded the correct results. Any help that fits in with the graph like structure for connected tiles, edges and corners would be greatly appreciated.

I have tried to implement the approach outlined in Raytracing on a Grid with a mixture of both Broad-Phase collision and A* Path Finding but neither of these two approaches cover selection of multiple surrounding tiles.

I am not concerned with the viability of tiles for placing objects at this point (i.e.: sloped edges of tiles or obstructions from other objects). The ideal solution for now would simply be to find the tiles included within the bounds.

My initial forays into this have resulted in incorrect results whereby the bounding rect doesn't include all neighbouring tiles (sometimes missing entire rows/columns) or returning neighbours outside of the bounds. I was pretty sure that I was close to a winning implementation but my vector math isn't strong enough to validate my findings.

sentences:
Unity2D Collision Issue I have a crate setup (in pic below) with a rigid body component, box collider and 3 circle colliders(they allow me to push the crate most of the time without getting stuck on the floor textures which are normal box colliders) As you can see in the pic there are collisions detected between the crate and floor even though they are not physically touching.

How can i make the collisions more precise as my crate gets snagged on the floor textures when there is minuscule difference between the floor box colliders?

sentences:
Unable to enable IK on someone else's rig I'm using someone else's character rig for reference but I'm not sure how I can enable IK solvers for the arms.  The hand controller has a NURBS control with an ikBlend attribute, but when I try to use the "Enable IK Solvers" tool, I get an error saying the attribute is locked or connected.

Clicking "Unlock Selected" on the attribute doesn't fix it.  Breaking the connections also breaks the ability for it to drive the enabled/disabled state of the IK handle.

The rigged character can be downloaded here if anyone wants to try to help me out: http://www.antcgi.com/2014/06/03/free-model-15-kila-lods-rig-dynamics/

sentences:
How can I retrieve the outer most points on a 2d graph? I have a 2d graph which has some points plotted on it.

What I need to do is get only the outer most points so that I can connect them up (isn't really relevant).

What I can't seem to wrap my head around is the algorithm that I need to use in order to do this?

I think this might help you understand what I want to achieve:

o o o
o x o
o o o

All the o's I want to get and the x I want to ignore. Also, the points can be in any position and any shape but I still want to only grab the outer most points.

Any ideas? Thanks.

sentences:
Trouble Positioning Object In World I have a lightning effect that travels from point A to point B, I am having trouble placing placing point B correctly.

As you can see from the object hierarchy the points (LightningStart, LightningEnd) are nested 3 levels deep. _parentReaction.affectorWidget.transform.positionis the position I would like the object to be at.

As you can see below I have tried setting the position equal to the other widgets transform, I have also tried using transform.InverseTransformDirection and transform.TransformDirection in varying combinations, I have tried many options the code below is just me going back to basics to see what I missed.

I am not sure even which object I am supposed to call TransformPoint from, the Widget with the effect )(Point A) or the Widget at Point B?

Given the above scenario how would I position LightningEnd so that is at the same position as_parentReaction.affectorWidget.transform.position?

I understand this is a very common question and I have read many previous questions related to this but two hours later, I would just like to know how its done so I can understand where I am getting this wrong.

Thank you.

Edit: _controller is the Widget Running this effect, since it spawns as a child of this I dont need to worry about its position.

    public override IEnumerator Do(Widget _controller, WidgetReaction _parentReaction)
{
    effect = _controller.GetComponent<Widget_Effect_Comp>().AddEffect(effect);

    while (true)
    {
        start = effect.effectPrefab.transform.Find("LightningStart").transform;
        end = effect.effectPrefab.transform.Find("LightningEnd").transform;

        Debug.Log("End Position : " + effect.effectPrefab.transform.Find("LightningEnd").transform.position);

        //Debug.Log("Widget World Pos : " + _controller.transform.position);
        //Debug.Log("Widget Local Pos : " + _controller.transform.localPosition);

        //Debug.Log("AffectorWidget World Pos : " + _parentReaction.affectorWidget.transform.position);
        //Debug.Log("AffectorWidget Local Pos : " + _parentReaction.affectorWidget.transform.localPosition);

        effect.effectPrefab.transform.Find("LightningEnd").transform.position = _parentReaction.affectorWidget.transform.position;

        Debug.Log("End Position : " + effect.effectPrefab.transform.Find("LightningEnd").transform.position);

     yield return new WaitForSeconds(2f);
    }

}

public class WidgetEffect : ScriptableObject
{
    public string effectName;
    public GameObject effectPrefab;
}

public WidgetEffect AddEffect(WidgetEffect _widgetEffect)
{
    if (!activeEffects.ContainsKey(_widgetEffect))
    {
        GameObject go = Instantiate(_widgetEffect.effectPrefab);
        go.transform.parent = effectContainer.transform;
        go.transform.position = Vector3.zero;
        go.transform.localPosition = Vector3.zero;
        activeEffects.Add(_widgetEffect, go);

        return _widgetEffect;
    }
    return null;
}

Edit: Removed Extended Explanation not related to initial question!
[![enter image description here]]

sentences:
Sprite with shadows in both sides I have a gameobject with a SpriteRenderer, and I want it to cast (and receive) shadows like a 3D model. The sprite will turn around depending of his direction, so all faces must cast shadows.

I already activated Cast Shadows and Receive Shadows in the Sprite Renderer component, and also included a Transparent Cutout shader with the Cull Off instruction (so all faces are drawn), but only one side of the sprite is being affected by light, while the other is even darker. To ilustrate:

How can I achieve an sprite casting shadows with both faces?

sentences:
JBox2D - how to get vertex positions? I've created a triangle for jbox2d...

public void createTri(){

    PolygonDef shape = new PolygonDef();

    shape.density = 2.0f;

    shape.friction = 0.8f;
    shape.restitution = 0.3f;
    shape.addVertex( new Vec2(35/RATE,35/RATE) );
    shape.addVertex( new Vec2(65/RATE,35/RATE) );
    shape.addVertex( new Vec2(45/RATE,55/RATE) );

    BodyDef bodyDef = new BodyDef();
    bodyDef.position.set(50/RATE, 50/RATE);
    bodyT= world.createBody(bodyDef);
    bodyT.createShape(shape);
    bodyT.setMassFromShapes();
}

... but when drawing it on canvas, how to I get position of all the vertexes?

with bodyT.getPosition().x and .y I can get only the center spot.

Thanks!

sentences:
keeping clients up to date with server state in an mmo-like game I'm making an online RPG that could classify as an MMO, but I'm keeping the project scope very small by making the game's systems simple, and focusing mostly on what I want to learn: real-time networking.

The problem I'm facing is that that I don't want to update every player about every other player, all the time. This is a huge waste of bandwidth, and may even be impossible without a really beefy connection.

My solution is:

Keep track of which entities are in the client's visibility range
Send a "full entity state" packet when the client enters the world
Send a "create entity" packet for any entity that enters the visibility range
Send a "delete entity" packet for any entity that leaves the visibility range
Send a "update entity" packet for any entity that updates within the visibility range

I don't like the fact that when the client moves, I have to update the list of entities it can see, because it means I still have to loop over every entity. Is there anything better? Can this solution be improved somehow? If so, could you provide further reading, or possibly even sample implementations?

sentences:
MMO techniques, algorithms and resources for keeping bandwidth low? Are there any resources and documentation on how current MMOs handle the action and movement data from the compression to the handling on the client?
Any resources for movement prediction algorithms?

I'm especially interested in those that have wsad movement and focus on keeping latency low
Also what is the packet rate and size for different types of MMOs(network wise)?

Is there a way to scale the packet rate or outright disable some packets if the player can't reach or in the later case see them?

sentences:
The rightmost part of the game screen is truncated in HTML I created a game that, when I play it in Unity, looks like this:

But when I build it in WebGL, the rightmost part of the screen (with the red player character in it) is truncated:

Play it in-browser on itch.io to confirm. It looks the same when I open the HTML file locally, so the problem is with the WebGL version and not with itch.

Only when I click the "full screen" button, the rightmost part is shown.

What am I doing wrong?

sentences:
Unity Menu navigation using keyboard/controller input? I am trying to create a character stats menu that uses keyboard/controller input to navigate between options instead of the mouse. I have not found any tutorials for this kind of UI navigation.

In this way, pressing "Up"/"Down" will highlight the closest button above/below the current selection, and pressing "Left"/"Right" will highlight the closest button to the left/right of the current selection.

This is how console menus, especially for popular JRPG's, worked.  Two example images of what I am talking about:

In this top-level menu, only the 8 options in the upper right are selectable, although not all options are necessarily present when the game begins. The finger-pointer icon is used to highlight a button:

This is the Equip menu. Equipable items are pushed into this menu as they are collected and can be scrolled through with the cursor. If the user presses "left", the cursor will jump to whichever character's valid equipment slot is closest:

Could anyone explain (briefly or otherwise) how to make a menu like this?

WIP: The hand cursor does not move yet. It is supposed to snap to highlighted buttons.

sentences:
Overlapping sibling problem in AABB tree I'm trying to make a real-time GPU (CUDA) ray tracer, and for now I'm tracing single rays, but I've ran into a problem: the BVH. This [PDF]paper has been my inspiration for the theoretical part, and as you can see, the BVH is composed of Axis Aligned Bounding Boxes, however, the stackless rope-based algorithm for the ray-AABB intersection does not take into account overlapping siblings, which occur quite a lot with the AABB creation algorithm I've read about in multiple places on the Internet, which is averaging the centroid of each triangle in the current triangle list and deciding in which child to place each triangle based on the projection of the average on the axis parallel to the longest edge of the parent box.

The use of AABBs in the paper indicates that there indeed exists a method to efficiently (in terms of speed) make AABB trees without overlapping siblings. Unfortunately, I can't find such a method.

Would someone please describe a fast method for creating an AABB tree without overlapping children? I'd also appreciate it if they'd post pseudocode too.

Thank you.

sentences:
What technique would I use to animate a 2D curling tentacle? I have played around in Cocos2D-X and I think I understand the limitations of sprite-based animation fairly well.

I want to have a game with some characters curling and extending a tentacle which varies in length and amount of curl depending on the terrain.

Maybe imagine a sloth swinging from a tree but with arms that stretch at times (Gumby character?).

Is there a name for such a technique?

Would this be a variant on Animating Bezier Curves as seen in Jason Davies's example or discussed in this blog on tweening control points?

I'm a very experienced polyglot programmer but relatively naive in games and graphics.

sentences:
Encoding/decoding data with byte arrays For my multiplayer game, I'm trying to figure out a system to send multiple pieces of data from one client to another and separating pieces of data.

When sending a message, all parameter data has to be converted into a byte array (with BitConverter.GetBytes) and will arrive as such on the other side.

What I'm not sure about is how to send multiple numbers in one message and identify them. For example, how would I send a ushort and a ulong in a single byte array? Are there any clever methods to identify the individual numbers or will every number have to be packaged in 4 bytes each?

sentences:
Does the gender of a game's protagonist affect sales? Most protagonists of games are male. I imagine the conventional wisdom is that this is because

We live in a patriarchal society, especially when it comes to game development, and
The target demographic is predominantly male.

I once heard that for fiction, females are more able to empathise with a male character, than males are with a female character. So the great imbalance in gender in fiction is not necessarily due to patriarchy, but that it just makes sense from a financial point of view. I'm not sure if I subscribe to that, but it is interesting.

And there was a time when gaming was for super hardcore nerdy males, but now almost everybody has a games machine, and it is not a stigma to like games as it once was, I don't know if it is such a male domain any more.

So leaving aside any question of whether we should try to reduce gender stereotypes,
my question is, does having a female protagonist actually affect sales, in particular, for small indie games? Are there any experiments, statistics or research relating to this question? What is the actual demographic breakdown of gamers these days?

I realise this is an inflammatory subject, so I will stress here that I am not looking for opinions:

I am looking for hard facts and data.

sentences:
Getting a 3d mouse position I've looked at a few tutorials about picking and the method Unproject, so I have an idea of how getting the mouse in 3d space is done. The code I have does display a mouse position, but it is way off of the actual position the mouse is at.

    public Vector3 FindWhereClicked(MouseState ms)
    {
        Vector3 nearScreen = new Vector3(ms.X, ms.Y, 0);
        Vector3 farScreen = new Vector3(ms.X, ms.Y, 1);
        Vector3 nearWorld = device.Viewport.Unproject(nearScreen, cam.proj, cam.view, Matrix.Identity);
        Vector3 farWorld = device.Viewport.Unproject(farScreen, cam.proj, cam.view, Matrix.Identity);

        Vector3 direction = farWorld - nearWorld;

        float zFactor = -nearWorld.Y / direction.Y;

        Vector3 zeroWorldPoint = nearWorld + direction * zFactor;

        return zeroWorldPoint;
    }

This code is from another thread I found on here. I'm guessing the problem is the near and far world variables.

    public ThirdPersonCam()
    {
        proj = Matrix.CreatePerspectiveFieldOfView(0.78f, 1.7777f, 1f, 10000f);
    }

    public void CameraUpdate(Matrix objectToFollow)
    {
        Vector3 camPosition = objectToFollow.Translation + (objectToFollow.Backward * 10) + (objectToFollow.Up * 2);
        Vector3 camTarget = objectToFollow.Translation;

        view = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up);
    }

The variables are grabbed from my camera class, but I don't know why it isn't working. A point that's supposed to be at 0, 0, 0 ends up being at something like 36, -1, 57

sentences:
Playing NSF music in FMOD.net So, as the title says, I want to be able to play NSF files using FMOD, because my project already uses FMOD and I'd rather not replace it. This will involve figuring out how existing players and emulators work and porting it. I haven't yet found an existing player that uses FMOD.

My starting point is the MyNes source from http://sourceforge.net/projects/mynes/. There are two big steps between here and what I'm looking for.

MyNes plays from a ROM, not NSF. So, I have to rip out the APU and get it to play NSF files.
The MyNes APU uses SlimDX, so I have to convert that to FMOD.NET.

I am really stuck about how to go about either of these, because I'm not that familiar with audio formats and it's hard finding resources online. So here are a few questions:

From what I can tell from the NSF spec at http://kevtris.org/nes/nsfspec.txt, it's just contains the relevant memory section of the ROM, plus the header. If anyone can verify or correct this that would be great.
The emulator APU uses data from the rest of the emulator to play, including things like cycle counts. I'm not sure what replaces this in a standalone player. Can't I just load all the music data at once into a stream and play it?
Joining #1 and #2, does the header data from the NSF substitute for some of the ROM data in the emulator code?
Using FMOD, will I be following the usercreatedsound example for loading a stream? And does this format count as PCM? Specifically MyNes says PCM8. Any tips on loading / playing the stream in FMOD are appreciated.

As an aside, I don't really understand the loading / playing sections of the spec I linked at all. It seems to apply to 6502 systems / emulators only and not to my situation.

I know it's a long shot for anyone here to have enough experience in this area to help, but anything you can provide is definitely appreciated. A link to an existing .NET library that does this would be even better, but I don't believe one exists.

sentences:
Libgdx , how to get mouse position relative to a Tiled Map I'm porting a game that i did for Ludum Dare 26, this year, i made it using Contruct2, i decided to port it to Libgdx, for learning reasons,

http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=15150  (check the web version)

My problem is that the Player moves base on the Angle, where the mouse is pointing at,
in Contruct2, they have a really nice function called

setAngleToward(Mouse.X,Mouse.Y)

in libGdx i made this function

@Override
public boolean mouseMoved(int screenX, int screenY) {

    Vector2 centerPosition = new Vector2((float)Gdx.graphics.getWidth() / 2, (float)Gdx.graphics.getHeight() / 2);
//  Vector2 centerPosition = new Vector2(getX(), getY());

    screenY = Gdx.graphics.getHeight() - screenY ; //Inverse the Y

        Vector2 mouseLoc = new Vector2(screenX, screenY);

        Vector2 direction = mouseLoc.sub(centerPosition);
        float mouseAngle  = direction.angle();/*(float)(Math. atan2(direction.y, direction.x)); */
        setRotation(mouseAngle);

        return true;
}

which works nice, but when i reach the corners on the maps, it give me the wrong angles, because the Player is not centered anymore,

I know the solution is just use "centerPosition" with the player coords, and use
"mouseLoc" with the mouse coords but needs to be relative to the tiled map, and that's my problem i don't know how to get those paramenters , screenX and screenY, are the mouse location but base on screen position

im using OrthographicCamera and OrthogonalTiledMapRenderer

i hope can understand my problem, this is the jar i have right now

https://dl.dropboxusercontent.com/u/2553973/Others/zombiesblocksattack.jar

sentences:
Tool to convert Textures to power of two? I'm currently porting a game to a new platform, the problem being that the old platform accepted non power of two textures and this new platform doesn't.

To add to the headache, the new platform has much less memory so we want to use the tools provided by the vendor to compress them; which of course only takes power of two textures.

The current workflow is to convert the non power of tho textures to dds with 'texconv', then use the vendors compression tools in a batch.

So, does anyone know of a tool to convert textures to their nearest 'power of two' counterparts?

Thanks

sentences: Can you have an embedded browser in Gamemaker:Studio I am trying to make a sort of browser in gamemaker and I wanted to know how to embed a browser within a game. Are there any extensions I need to download?

sentences:
How do I dynamically set a WheelJoint's anchor points? I've created a car in RUBE and imported it into my game. The game has a tuning menu, allowing the ride height of the car to be adjusted with a slider.

I can't work out how to change the position of the WheelJoint relative to the car body. The result I'm looking for is as if I had changed the anchorA Y-value in RUBE. I thought this would be equivalent, but it isn't:

    car.rearWheelJoint.getAnchorA().set(xvalue,yvalue);

I've tried instead creating a whole new jointdef:

        WheelJointDef d = new WheelJointDef();

        d.initialize(car.rearWheelJoint.getBodyA(), car.rearWheelJoint.getBodyB(),
                car.rearWheelJoint.getAnchorA().add(0,(val-100)*0.01f),
                car.rearWheelJoint.getAnchorB());

        car.rearWheelJoint = (WheelJoint) game.world.createJoint(d);

...but I think this is messing up the pointer to the wheel joint.

How can I do this?

sentences:
Unity 5: Check if an object's collider contains the mouse click point I am building a 2D turn-based RPG battle scene with Unity 5. The enemies are represented as 2D sprites with box colliders. In my script, the relevant enemy class is defined as:

public class EnemyView : MonoBehaviour {

    public SpriteRenderer _renderer;
    public BoxCollider2D _collider;

    void Awake() {
        _renderer = gameObject.GetComponent<SpriteRenderer>();
        _collider = gameObject.GetComponent<BoxCollider2D> ();
    }
}

And I have the following code grouping the enemy sprites together:

public class MainGUIView : MonoBehaviour {
    public EnemyView[] _enemyViews;
}

When a player clicks on an enemy, I would like to know the index of that enemy within the _enemyViews array. I thought of implementing this within EnemyView class but that class has no information about its index, so I am thinking of implementing OnMouseDown() within MainGUIView where I could iterate through _enemyViews to find the one whose collider contains the mouse click point, but I don't know how to write the code. Anyone can point me to some useful code snippet?

sentences:
How do I get access to the PS4 platform tools for Unity? I know that you can go to the "Xbox ID" program to get all the resources you need for the Xbox platform (developer forums, Unity SDK, etc.). but there is not really information about how to get the PlayStation tools.

...Well other than the contact sales button in Unity which links to Unity and not Sony (oddly enough).

So where does someone who hopes to put their games onto one of the Sony platforms (PS4, Vita, PS3, etc) go to get the build tools (and other things) they need? Do Sony contact you about it if they're interested or is it really only for developers who are considered above Indy?

sentences:
What Do I Pass for inputGeometryTransform Parameter of ID2D1Geometry::CompareWithGeometry? I have a list of ID2D1Geometry objects and I'm trying to use CompareWithGeometry to detect collisions in Direct2D; unfortunately, I'm not getting the results I need.  I suspect I am improperly using the inputGeometryTransform parameter.

If I pass in D2D1::Matrix3x2F::Identity() or nullptr for this parameter, I almost always get D2D1_GEOMETRY_RELATION_CONTAINS (3) or D2D1_GEOMETRY_RELATION_IS_CONTAINED (2) results back for the returned D2D1_GEOMETRY_RELATION.  On the other hand, if I try and pass in the product of the scale and translation matrices that I used to generate the primary geometry, then I never get collisions.

Can someone help me understand what I need to pass in for the inputGeometryTransform parameter?

The source code that I believe to be relevant appears below:

// This is Shawn Eary's broken code and it is licensed 2012 under the
// Microsoft Public License (Ms-PL) which is compatible with the
// Open Source Initiative
//
// Shawn Eary is not affiliated with Microsoft.
// He just likes the Ms-PL
void SpaceObject::updateDynamics(
    Microsoft::WRL::ComPtr<ID2D1DeviceContext> const i_d2dContext,
    D2D1::Matrix3x2F const & tranformMatrix)
{
    D2D1_SIZE_F renderTargetSize = i_d2dContext->GetSize();
    float const worldWidth = renderTargetSize.width / 2.0f;
    float const halfWorldWidth = worldWidth / 2.0f;
    float const worldHeight = renderTargetSize.height / 2.0f;
    float const halfWorldHieght = worldHeight / 2.0f;

    // Update the position in ideal coordinates
    double idealX = m_p.x + m_v.x;
    double idealY = m_p.y + m_v.y;

    // Account for wrap around
    m_p.x = getWrappedResult(idealX, worldWidth);
    m_p.y = getWrappedResult(idealY, worldHeight);
    m_p.theta += m_v.theta;

    m_v.x += m_a.x;
    m_v.y += m_a.y;
    m_v.theta += m_a.theta;

    // Compute results of elastic collisions
    for (list<SpaceObject *>::iterator it = m_myObjectWorldP->begin(); it != m_myObjectWorldP->end(); it++) {
        SpaceObject * const SOP = (*it);

        // This eventually needs to be fixed, but for now assume all
        // spaceObjects are GeometrySpaceObjects
        GeometrySpaceObject * thisGSOP = dynamic_cast<GeometrySpaceObject*>(this);
        GeometrySpaceObject * currentGSOP = dynamic_cast<GeometrySpaceObject*>(SOP);

        // Don't compare this SpaceObject with itself
        if (thisGSOP != currentGSOP) {
            ID2D1PathGeometry * const thisGP = thisGSOP->gGeoP();
            ID2D1PathGeometry * const curGP = currentGSOP->gGeoP();
            D2D1_GEOMETRY_RELATION theRelation;
            thisGP->CompareWithGeometry(
                (ID2D1Geometry *)curGP,
                tranformMatrix,
                &theRelation
            );
            if (theRelation != D2D1_GEOMETRY_RELATION_DISJOINT) {
                // A Collision has occured.
                //
                // Use conservation of momentum to update
                // velocities after collission here
                int placeHolder = 0;
            }
        }
    }

    this->updateAcceleration();
}

Note: At the time I asked this question, the documentation I found on the MSDN site was a bit unclear regarding the inputGeometryTransform Parameter.  The documentation I viewed was visible at this URL: http://msdn.microsoft.com/en-us/library/windows/desktop/dd316638(v=vs.85).aspx

sentences:
How to implement path-finding with a large number of blocking agents following similar paths? I want to implement a demo like creeps laning in Dota 2.
So for simplicity, there is Left team and Right team, they are enemies.

Units from Left team move toward Right base, and units from Right team move toward Left base.
In their path, if those units encounter unit from enemy team, they will start to fight the enemy unit.
One unit could attack an enemy unit.
In their path, those units should avoid ally unit, they should not collide each other.

For 2 and 4, I want to have the feature that is: When encounters any enemy, one unit should seek its path to be able to fight the enemy unit. Consider this image:

There are some units blocked by their ally, so when an unit blocking the path disappear, another closest ally unit should move on, or move to attack their nearest enemy unit.

I wonder if A* should be applied for the demo. My demo is more simple than Dota 2, it does not have static obstacles, it just has dynamic obstacles (moving units). My main question is, What strategies/algorithms should I apply to implement my demo?

Thanks

sentences:
How can I get the user altitude from an iPhone using Unity 3D? I can see in the Unity 3D documentation that its possible to get the altitude of the user from their iPhone, but I cannot figure out how to actually do it.

I try this code:

using UnityEngine;
using System.Collections;

public class Altitude : MonoBehaviour {

    void Start () {
        Input.location.Start();
    }

    void Update () {
        Debug.Log (LocationInfo.altitude);
    }
}

and I get this error:

  Assets/Altitude.cs(11,41): error CS0120: An object reference is
  required to access non-static member
  `UnityEngine.LocationInfo.altitude'

sentences:
SpriteKit and Swift or Objective-C As a newbie to iOS programming, I'm wondering which of these would be more conducive to the type of game I want to program. I've been tasked to program an iOS game for my company. They asked me to do this after learning I was studying some Swift on my own time.

The game will be a turn-based strategy game consisting of a map with irregular areas/polygons and player pieces that can be moved on the map. I'll need to be able to detect when a piece moves into different areas and restrict a piece to moving only a certain number of areas per turn.

Can this be accomplished in straight Swift/Spritekit?

sentences:
My trigger does not detect my player My trigger does not detect my player.
My Trigger.cs file:
using UnityEngine;

public class Trigger : MonoBehaviour {

public Camera camera1;
public Camera camera2;
public GameObject panel;

 void OnTriggerEnter(Collider other)
{
    camera1.enabled = false;
    camera2.enabled = true;
    panel.SetActive(true);
    Debug.Log ("Entered-");
}

 void OnTriggerExit(Collider other)
{
    camera2.enabled = false;
    camera1.enabled = true;
    panel.SetActive(false);

}
private void Update()
{
    if(Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S))
    {
        panel.SetActive(false);

    }
            }

}

Where I can start troubleshooting te issue?

Object on which the trigger script is sitting on.

 The solution:
-- I created two colliders, and assigned one as a collider, the other (bigger) is a trigger.  -- I also had problems with the small triggers in the scene. The triggers were to small to be detected by my main player, althought
they detected my "sphere" player object

sentences:
What to do when a function to return something is null? I have a generic Items class that keeps track of all items, and when Items are created they are added to this list. The problem is that I have a function that returns the item by its ID, but what do I return in items[id] doesn't exist? It won't let me return null...

Should I just use a for loop that iterates through every item and checks if items[i].id equals the input ID?

Here's my code

public static class Items
{
    public static List<Item> items = new List<Item>();

    public static Item getItemById(Items instance, int id)
    {
        if (items[id] != null)
        {
            return items[id];
        }
        else
        {
            return null;
        }
    }
}

sentences:
How to implement input-texture limited alphablending of 2 textures with HLSL? I try to implement a HLSL shader the does the normal Alphablend with premultiplied colors (just as XNA4 does) but depending on some existing colors. One can think of adding a glow to a 2D terrain where the glow should only be applied to the not fully transparent parts of the terrain.

My current code is:

sampler TextureSampler1 : register(s1); // Addition (Terrain-only particles)
sampler TextureSampler2 : register(s2); // Existing (Terrain)

float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
    // Look up color from partly transparent existing texture (premultipied colors)
    float4 existing = tex2D(TextureSampler2, texCoord);

    // For transparent pixels -> Color stays the same
    if ((existing.r + existing.g + existing.b + existing.a) == 0) return existing;

    // Look up color from partly transparent addition-texture (e.g. glow) (using premultipied colors) that should be added to existing color
    float4 addition = tex2D(TextureSampler1, texCoord);

    // Rescale light that is added by existing alpha
    addition.rgb *= existing.a;

    // Use this color to blend
    existing.rgb *= (1 - addition.a) + addition.rgb;

    return existing;
}

However, there still seems to be a problem with the alpha channel. Any ideas?

sentences: How can i calculate that normal lays in same part of plane with point? I.e. n0 for A and n1 for B. Plane divided by plane CD.

sentences:
How do I run LibGDX's Particle Editor in Netbeans? I am trying to run the Particle Editor that comes with LibGDX in Netbeans.  The gdx-tools-1.9.10.jar file shows up in my dependencies, and I can see all of the packages and class files inside it:

Normally, when I want to run a file, I open the file by double-clicking it in the "Projects" panel, right click anywhere in the file, and then click the "Run File" option.  However, when I use the same process to try to run a class file in gdx-tools, the "Run File" option appears to be grayed out:

I have also tried using the Shift+F6 shortcut, with no effect.  Just as a sanity check, I did also make sure that the class file I am trying to run has a main method:

I have also tried running the Particle Editor from the command line (I'm using Windows).  I navigated to the gdx-tools directory using the following command:
cd C:\Users\<user>\.gradle\caches\modules-2\files-2.1\com.badlogicgames.gdx\gdx-tools\1.9.10\<hash>

I then tried to run the Particle Editor using the following command:
java -cp gdx-tools-1.9.10.jar com.badlogic.gdx.tools.particleeditor.ParticleEditor.class

And the result is simply:
Error: Could not find or load main class com.badlogic.gdx.tools.particleeditor.ParticleEditor.class

How do I run the Particle Editor?  I would prefer to be able to run it in Netbeans, but I would be happy to get it to run at all.  I am using LibGDX 1.9.10, Netbeans 8.2, and Java (JDK and JRE) 8u111 on Windows 10.  I installed LibGDX using their setup app found here.

sentences:
Is it possible to make windows games using Havok's Project Anarchy? I'm interrested in Havok's Project Anarchy as I plan to learn how to make 3D Games, so I've done some research and it seems focused on mobile platforms.

So before I engage myself I would like to know if it is possible to make PC Windows games with It since it is not explicitly mentionned.

sentences:
Unity, changing gravity game & stopping character when he hit a wall I am currently working on a 2d puzzle game in the unity engine. One of the aspect of this game is the possibility to rotate the level of 90°. It also rotate the gravity.

The main character is not directly controlled by the player, but instead falls when the level is rotated.

When the main character hits a wall, he should stop to moving. If I do not stop it, it kind of blinks and shakes against the wall.

To stop it I detect collision and depending on the current rotation state, the player will stop at "vertical" or "horizontal" tags when a OnCollisonEnter occurs. I must do that because when the player falls on his relative ground, he must not stop like if he had touched a wall.

My problem is the 'side' of platform, or the 'top' of wall, they use the same tag and thus do not give the correct tag to my character. I tried to put a very small invisible box on top/side of elements but the collision occurs nevertheless. It seems when the player falls and hit something he go through a bit before being replaced at correct position by unity.

Is there a way :

1 ) to not stop my character but to make it appear immobile on screen

2 ) To detect a "I cannot move anymore" collision other than by using collision?

sentences:
Question About Scrolling A Tilemap In C++/SDL/OpenGL I been working with scrolling this week but I recently encounter a problem that I don't understand why it's happening.

In a 2D scroller I want to scroll a tilemap pixel per pixel which gives a smooth scrolling in the game, but I encounter a weird problem, when the movement of the map corresponds with the exact size of the tile, for example, the map it's scrolling 32 pixels to the right, the map seems to jump to the next tile and not the one that corresponds correctly with the screen.

This is the code for drawing the map:

bool Tilemap::drawTilemap(GLfloat sizeTile, int indexTileset)
{
    offsetX++;
    if (offsetX >= 320.f) offsetX = 320.f;

    GLfloat widthTilesetImage = tilesetList.at(indexTileset).getWidthImage();
    GLfloat heightTilesetImage = tilesetList.at(indexTileset).getHeightImage();

    int widthMap = 40 + offsetX/32;
    int heigthMap = 23;

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glEnableClientState( GL_VERTEX_ARRAY );
    glEnableClientState( GL_TEXTURE_COORD_ARRAY );

    glBindTexture( GL_TEXTURE_2D, tilesetList.at(indexTileset).getTexture() );

    for (int i = 0; i < heigthMap; i++)
    {
        int startX = offsetX/32;

        for (int j = 0; j < 40; j++)
        {
            int frameIndex = layerMap[i][startX];

            if (frameIndex == 0)
            {
                continue;
            }

            frameIndex -= 1;

            const GLfloat tileX = 0.0f + ( (sizeTile)*j);
            const GLfloat tileY = 0.0f + (sizeTile*i);

            const GLfloat verts[] = {
                    tileX, tileY,
                    tileX + sizeTile, tileY,
                    tileX + sizeTile, tileY + sizeTile,
                    tileX, tileY + sizeTile
            };

            const GLfloat textureWidth = (sizeTile - offsetX/widthTilesetImage) / (GLfloat)widthTilesetImage;
            const GLfloat textureHeight = sizeTile / (GLfloat)heightTilesetImage;
            const int numFramePerRow = (GLfloat)widthTilesetImage / sizeTile;
            const GLfloat textureX = ((frameIndex % numFramePerRow) * textureWidth)+offsetX/widthTilesetImage;
            const GLfloat textureY = (frameIndex / numFramePerRow ) * textureHeight;

            const GLfloat texVerts[] = {
                    textureX, textureY,
                    textureX + textureWidth, textureY,
                    textureX + textureWidth, textureY + textureHeight,
                    textureX, textureY + textureHeight
            };

            glVertexPointer(2, GL_FLOAT, 0, verts);
            glTexCoordPointer(2, GL_FLOAT, 0, texVerts);
            glDrawArrays(GL_QUADS, 0, 4);

            startX++;

        }
    }

    glDisableClientState( GL_VERTEX_ARRAY );
    glDisableClientState( GL_TEXTURE_COORD_ARRAY );

    return true;
}

The variable offsetX it's the one that helps me move one tile at a time the map. The variable startX indicates when it's no longer drawing one tile, so in this one start in the next column of the matrix of tiles.

So, what could be wrong in my code?

Thanks for the help.

sentences:
Unity3d Android - Fixed Resolution How can i set a fixed 720p resolution on any devices using unity3d android?

  unity3d version: 2018.4.5f1

sentences:
Optimization of rendering of cube world I have a world made of many cubes (like in Minecraft), they have only color (not texture). I am rendering them using OpenGL 3.3 core profile (GLFW3, GLAD, GLM). I am already have done some optimizations:

not rendering internal faces
backface culling
rendering faces using GL_TRIANGLES and indexing

But it's still a lot slower than Minecraft, but Minecraft is in Java and blocks have textures, there is bigger world (there are entities etc. too)! How can I optimize my program further?
It may be something with pre-computing. Player rarely change the world (only small part of ticks).
I am currently filtering faces with this code:
// for every block
if (blocks[x][y][z] != nullptr) { // nullptr means that block is air
    bool drawSides[6];
    if (world.GetBlockAt(BlockPos(x, y, z - 1)) != nullptr)
        drawSides[0] = false; // internal face, culled
    else
        drawSides[0] = true; // draw that side
    // other 5 sides
    // ...
    blocks[x][y][z].draw(sides);
}

sentences:
How do you calculate if 2 lines are facing toward or away? Given the 4 points describing 2 line segments, how do you calculate if line A is towards or away from line B?

The 2 lines have a fixed length, and can be measured as distance from x1/y1 to x2/y2.

sentences:
How do I implement time scaling? I want to be able to change the game speed, to speed up or slow down all animations and gameplay. Ideally, this could also be set to a negative number to make everything go backwards.

I tried this:

I made everything dependent on a time variable, updated every frame from the OS time:

void calledEveryFrame()
{
    time = System.accurateTime();
}

Then I tried just scaling that time.

lastTime = time;
long now = System.accurateTime();
double diff = now - lastTime;
time = (lastTime + diff * speed);

That obviously doesn't work, because you can't just multiply the speed times the difference because it is not called exactly regularly.

How do I do this correctly?

sentences:
Camera movement and threshold not working I have a platformer that is in progress, part of this has a camera which I only want to move when the character moves out of a certain threshold, to try to accomplish this I have the following if statement:

 if(((Mathf.Abs(target.transform.position.x))-(Mathf.Abs(transform.position.x)))>thres){
            x = moveTo(transform.position.x, target.position.x, trackSpeed);
            }

in unity/c#. In pseudocode it means

if((absolute value of player x) - (absolute value of camera x) is greater than the threshold){
move
{

however this does not seem to work correctly. it appears to work for the first couple of times the threshold is reached, however the distance between the camera and the player has to increase every time for the camera to move. I do not believe the movement of the camera is the problem, however the code for it is as follows:

private float moveTo(float n, float target, float accel) {
    if (n == target) {
        return n;
    }
    else {
        float dir = Mathf.Sign(target - n);
        n += accel * Time.deltaTime * dir;
        return (dir == Mathf.Sign(target-n))? n: target;
    }
}

}

sentences:
The need your game fills. Establishing your "hook." I am a programmer and have worked on games although never attempted design myself. I am now attempting to design a game myself, working with a modest team of programmers and artists.

Game designers have been telling me it is important to establish the need your game fills, in order to develop a more complete vision of the product. I think in terms of mechanics and gameplay and am having trouble finding a "hook," even in existing games.

Any advice in identifying why a mechanic is fun, and what need a game fills, to help develop my own ideas is much appreciated.

sentences:
How to detect RayHit on part of model and not entire model I'm building a low poly role playing Hack and Slash game. When I click it renders a sprite & character moves to that location(with RayCast).

But in this case. I don't want the click to occur on side of the bridge. Clicks should only occur in green coloured part & not in the red part. How should I fix this problem?

sentences:
Who should handle animations when game logic is separated from rendering? Suppose I have a tile-based game and I want the step to be 1 tile but also want the movement to be smooth while the player is getting there. If I understand correctly, the only way to achieve this would be making a series of small movements where the increment is a percentage of a tile.

My question is: should the game logic thread send the animations to the rendering thread? What is the best way to go about it?

sentences:
Do I need a backend engineer for my studio right now? I am working on a mobile game that requires a well thought-out backend, because it spans across the healthcare/data science space and we need to be compliant in terms of security/regulations in how we approach this. Think something like Fitbit.

My team is nearly finished with the client-side game aspect; but I am wondering whether I need to take on a short-term contract/part-time backend engineer to create our entire backend infrastructure OR someone who would work on this full-time with our team.

Here is what we would need to do:

Setup our entire backend infrastructure and plug this into Unity
This would require knowing how to handle (transmit/receive) data securely, and also perform computation with that data in the cloud
Set-up an API where other developers can query our data
Set-up our dev ops infrastructure (Docker, Jenkins) for the future

The kicker here is that we are not yet live and are just in a testing phase. I don't want this to be 2-3 weeks of work, with no users for 3 more months while we're working on other aspects of the project, with the dude having nothing to do.

Does this sound like a lot of work? Or could it easily take up a devs time for a month or two? Would a short contract be advisable here, or would it be better to hire someone FT and have them grow with us.

sentences:
Unity's Profiler doesn't specify which of my methods take how much time? I'm working on a map generator, which is used in Awake(), so I couldn't see it in the profiler.

So I created a new scene, where right clicking generates the map.

Now I can see the generation process (Update method), but not the specific parts of it.

Only GC.Alloc-s, GC.Collect-s and Mono.JIT-s.

Why?

sentences:
Unity "static" references I have been researching this for 2 days now and I cannot seem to find a proper response. I am trying to figure out a good way to store constant variables within my game.

Basically, does it make more sense to create a singleton script that holds all my prefabs inside it so I can easily access them and instantiate through the game? Or does it make more sense to keep all my assets inside the Resources folder and then call Resources.Load throughout the game (or through a Static class that holds references to all the resource paths and loads the resources on start up)

I have the same question regarding variables used within runtime. Would it be better to run through the Static class that is holding all these prefabs through the Resources folder? Or would it make sense to also hold these values inside the singleton.

Thank you!

sentences:
How to differentiate between colliding objects in Box2D? I need to differentiate between different points of contact in my racing game.

I currently have staticSensors which determine if the car is on the track or not, but I have created a second sensor to act as the 'finish line' but I am not sure how to differentiate the contact between the 'checkeredFlag' and all of the other sensors?

Any help would be appreciated! Here is my code:

include "contactListener.h"

void ContactListener::BeginContact(b2Contact* contact)
{
    b2Body* bodyA = contact->GetFixtureA()->GetBody();
    b2Body* bodyB = contact->GetFixtureB()->GetBody();

bool isSensorA = contact->GetFixtureA()->IsSensor();
bool isSensorB = contact->GetFixtureB()->IsSensor();

Wheel * wheel = (Wheel*)bodyA->GetUserData();
CheckeredFlag * flag = (CheckeredFlag*)bodyB->GetUserData();

if (isSensorA)
{
    StaticSensor * sensor = static_cast<StaticSensor *>(bodyA->GetUserData());
    sensor->action();
    Wheel * wheel = static_cast<Wheel *>(bodyB->GetUserData());
    wheel->offRoad();
    return;
}

if (isSensorB)
{
    StaticSensor * sensor = static_cast<StaticSensor *>(bodyB->GetUserData());
    sensor->action();
    Wheel * wheel = static_cast<Wheel *>(bodyA->GetUserData());
    wheel->offRoad();
    return;
}

if (typeid(CheckeredFlag).name() == typeid(bodyA).name())
{
    if (typeid(Wheel).name() == typeid(bodyB).name())
        {
        flag->action();
        return;
        }
}

sentences:
How should I structure a Shared Library for different platforms for my MonoGame project? I am quite new to the MonoGame/XNA framework and i have some structuring questions right now.

One of the reasons I use MonoGame is because there is still that feeling to create a game from scratch without such things as Scene Editors. But also the platform independence plays an important role in my project.

I am trying to create a small 2D-RPG that should run on Windows (not Windows Apps) and on android. iOS is optional for now.

Now I thought it would be nice if I can have some kind of Shared Library where the core of the game is inside as a single project. Then I would create a project for Android specific and Windows specific and maybe later iOS specific.

I was thinking of "just" referencing this Shared Library in every platform project and using the games functions in there.

Is this a good idea and even possible? Because in my whole opinion it's redundant code if I create a project for every platform and put whole game code in every project. If I then want to change something, I need to change it for Android, Windows and later iOS too.

The only problem is, Android can only reference PCL libraries right? That's why the shared library must be a PCL then right? Which would be harder for me because I want to use Sockets since the game should get some kind of  small multiplayer.

That's what I am thinking about for now.

I hope you guys know what I mean and if that's not the way I should do it please let me know how you guys would structure your whole project.

sentences:
Shadow Glitch on Mesh Stitches I use LWRP, one Directional Light and Hard Shadows with 1024 resolution. When I imported this super simple mesh from blender this happened:

What is this weird line on the stitch of the mesh and how do I fix it? I tried using Soft Shadows with higher quality but it did not help.

sentences: What is the purpose of glScissor? I know that it is more efficient than stencil test, but am I right assuming that the same functionality could be achieved using projection transformations with viewport?

sentences:
Structure GameObject - States - Visual representation Question: What is the best data structure for GameObjects that have different states and thus different visuals?

The situation is:

I'm creating a game for mobiles (written in Kotlin, no Engine used).

My simplified object structure looks like this:

I have 2 GameObjects (e.g. Person and Obstacle)

Each GameObject might have two different states (IDLE and MOVE)

But each state might also have different graphics. For instance depending on the movement direction, the MOVE state might show Bitmap-Left or Bitmap-Right.

  Person -> WALK-State -> Visualisation (WALK, PERSON) -> draw(bitmap_walk_left_person)

My problem is, that I'm really not sure about that structure. Should I make subclasses for each State or a composition? One Visual object for each State (e.g. MOVE, IDLE, TALK) containing all Bitmaps for Person and Obstacle and always showing the right one depending on the parent?

Currently it looks like this:

I have the GameObject. The object has a state that is called in the update() method (e.g. moving a bit to the left).
Every State has a "Visual" object that knows its parent State (State = WALK). It draws itself related to its states type (e.g. WALK) and considers (if needed) the orientation (left or right).

This felt like it keeps structures as abstract as possible but I'm not sure sure thats a good solution because all objects have to keep references to their "parents". So the visuals need a reference to the state (WALK) and to the GameObject (Person) in order to draw the visual for a walking person.
Would it be better to create subclases for each State?
So I have a class "VISUAL_MOVE_PERSON", "VISUAL_IDLE_PERSON", "VISUAL_IDLE_TREE" ... That seems a lot of redundant code and classes.

Is there a common structure for Actions / States and their Visual Representation? Especially since I will have many more objects with at least a few different states (IDLE, MOVE, TALK, ...)

Should the visuals be part of each state? Or are they independent to each other (e.g. GameObjects have a State and a Visuals object) instead of the "chain of references" shown above?

sentences:
Texturing issues in cry engine sdk Sup?

I've been working on a new environment scene inside 3ds max. It looks something like this -

When I used the cry engine exporter to export my assets onto my level, I've been getting very weird shadow/texture problems. Do any of you know why that's happening? I'm pretty new to all of this, especially cry engine. Here's a screenshot of the same environment inside of cry engine sdk. If you look to the left of the environment, you can see how I'm getting weird results. The area I'm having issues with is highlighted with a faint blue line.

sentences:
Can I export animated models from Unity? Into what formats? I have an animated 3D model from the Unity Asset Store that I would like a new animator to touch up (the license allows this). But they need it in a format they can use (in Maya or... something else?). All I have been able to find so far is:

how to export from the Editor into Unity Package format
scripts to export the mesh (only?) into OBJ format [1]

Is it possible to export a textured and rigged model from Unity? If so, into what formats and how?

[1] ObjExporter and ExportOBJ

sentences:
Blending Modes in LWRP Particles I created a particle effect using a material created from Particles/Simple Lit shader with an image of white circle tinted red through Start Color setting. On the left I have Alpha Blending Mode and on the right Premultiply Blending Mode.

Why do I get black lines on the left?

sentences:
Why do these DirectXMath functions seem like they return column-major matrics? I know these questions have been asked a million times in various formats, but I'm getting weirdly skeptical about some of the row-major vs. column-major claims about the DirectXMath library.

If I run the following code to get a translation matrix for example:

DirectX::XMMATRIX a = DirectX::XMMatrixTranslation(1.0f, 1.0f, -1.0f));

I would expect the memory layout to look like the following (with rN indicating some row, but all the numbers contiguously in memory):

r1: 1.0   0.0   0.0   1.0      r2: 0.0   1.0   0.0   1.0     r3: 0.0   0.0   1.0  -1.0     r4: 0.0   0.0   0.0   1.0

This would correspond to the following matrix (in standard notation) where each row is stored as a contiguous array:

1.0   0.0   0.0   1.0
0.0   1.0   0.0   1.0
0.0   0.0   1.0  -1.0
0.0   0.0   0.0   1.0

Except when I look at the memory, it's the transpose of the above (i.e. the last array in memory is the last column above) which I'm to understand is "column-major" order. So, in memory, what I'm actually getting is this:

r1: 1.0   0.0   0.0   0.0     r2: 0.0   1.0   0.0   0.0     r3: 0.0   0.0   1.0   0.0     r4: 1.0   1.0   -1.0   1.0

This leaves me thoroughly confused with all the commentary and documentation around DirectXMath matrices needing to be transposed before putting them into HLSL constant buffers (of which I'm using the default column-major order). Everything states that DirectXMath matrices are stored in row-major order, but when I actually look at the memory (either as an XMMATRIX or a more direct XMFLOAT4X4) I find myself staring at a translation matrix that looks like it's been stored in column-major order.

So my confusion then lies in the fact that my transformations actually work when I don't transpose the matrices prior to putting them into the constant buffer.

Am I missing something here?

sentences:
Optimization of 2D terrain generation algorithm I am generating 2D terrain with 2D opensimplex noise, however I am having a problem with the FPS that is low when generating the terrains in TileMap. An example of how my game generates the terrain in javascript:

function generator(map_size=0, _posWorld=[0, 0], size=[1, 48], seed=0) {
    var simplex = new SimplexNoise(seed);

    var x = 0;
    var y = 0;
    var pos_modx = 0;
    var pos_mody = 0;
    while (x < size[0]) {
        pos_modx = utilsfunctions.mod(_posWorld[0] + x, map_size);
        y = 0
        while (y < size[1]){
            pos_mody = utilsfunctions.mod(_posWorld[1] + y, map_size);
            // GENERATION NOISE
            // TEMPERATURE
            var nx = parseFloat(pos_modx)/map_size - 0.5;
            var ny = parseFloat(pos_mody)/map_size - 0.5;
            var v1 = temperature * simplex.noise2D(1 * nx, 1 * ny);
            var v2 = 0.4 * simplex.noise2D(2 * nx, 2 * ny);
            var v3 = 0.23 * simplex.noise2D(4 * nx, 2 * ny);
            var v4 = 0.134 * simplex.noise2D(8 * nx, 8 * ny);
            var e = v1 + v2 + v3 + v4;

            // HUMIDITY
            var unx = parseFloat(pos_modx)/map_size - 0.4;
            var uny = parseFloat(pos_mody)/map_size - 0.5;
            var u1 = humidity * simplex.noise2D(1 * unx, 1 * uny);
            var u2 = 0.6 * simplex.noise2D(2 * unx, 2 * uny);
            var u3 = 0.7 * simplex.noise2D(4 * unx, 2 * uny);
            var u4 = 0.073 * simplex.noise2D(8 * unx, 8 * uny);
            var u5 = 0.09 * simplex.noise2D(16 * unx, 16 * uny);
            var u6 = 0.03 * simplex.noise2D(32 * unx, 32 * uny);
            var ue = u1 + u2 + u3 + u4 + u5 + u6;

            if (pos_modx >= 0 && pos_mody >= 0) && (pos_modx < map_size && pos_mody < map_size) {
                tile_map.set_cell(_posTileMap.x + x, _posTileMap.y + y, biomes.solos(e, ue));
            }
            y += 1;
        }
        x += 1;
    }

The problem is that I am generating several layers of tilemap, one for terrain, one for relief and one for trees. That is three scripts of these, of course for the relief and trees is much less complex, and alone for example, even the two together do not interfere almost anything in the FPS. However, only generating with the above-ground script is already a big problem, and I generate only one minimum possible bit at a time, which is (1, 48) for when moving up or down, and (48, 1) when moving to the right and left, it is clear that there is the case of the diagonal movement, having to generate 48 + 48, which is the worst case. However, even only the 48 are already leaving the FPS bad, nor do I need to move diagonally to feel the FPS suffer.

I would like tips to be able to optimize this generation, and if know any way to use only one algorithm to generate everything (terrain + relief + trees), or any help that can take me to a better way.

Understand why I am generating with 3 different scripts for terrain, relief and trees:

Terrains are large areas within large areas.

Reliefs are crooked lines on the map.

Trees are only points of a dirty noise on the map.

sentences:
Which GameObject should I put the animator on? I have a GameObject.  One of its children is an empty GameObject, whose children are the body parts which need to be animated.

Character (root)
--->Body
--->--->Body Parts

Should I put the animator on the root GameObject ("Character")?  Or on the empty child ("Body")?  Does it matter? What benefits would one way offer over the other?  Or is there another approach I should be taking?

This is for 2D sprites/animations.  I am trying to figure this out before making all of the animations to avoid redoing them.

sentences:
What is the correct way to raycast on click? I am using raycast from screen point to detect if the user has clicked/touched on something.

The following fails 1/10 times; at first I thought due to the raycast missing the subject below, but after adding in the drawline i realise that it randomly doesn't even fire:

// layerMask declared with correct layers
void FixedUpdate(){
    if(Input.GetMouseButtonDown(0)){
        Debug.Log("click");
        Ray ray;
        RaycastHit hit;
        if(Physics.Raycast (ray, out hit, Mathf.Infinity, layerMask)){
            Debug.Log("You clicked on " + hit.collider.gameObject.name,hit.collider.gameObject);
        }
}

If I run this in Update() function instead, it will work perfectly - so FixedUpdate() seems to understandably cause the missed clicks... but i'm told I should always run the raycasts in FixedUpdate() for physics optimisation.

Maybe I should split this basic action over 2 functions?

A friend said i need an event handler

sentences:
Camera horizontal shift I want stretch my game on two monitors. I use Unity 5.3. This version support the multi-display. But, one camera = one monitor.
So, have two perspective cameras (at the same position).  I search a "camera horizontal shift" option for create stretch effect. I don't find this option. Is-there a trick ? A solution ?

sentences:
How to improve performance for expensive functions in 2d city builder I've already searched for answers but I was not able to figure out the best approach for handling expensive functions/calculations.

In my current game (a 2d tile-based city building) the user is able to place buildings, build roads etc. All of the buildings need a connection to a junction the user has to place at the border of the map. If a building is not connected to this junction, a "Not connected to road" sign will popup above the affected building (otherwise it has to be removed). Most of the buildings have a radius and might be related to each others as well (e.g. a fire department can help all houses within a radius of 30 tiles). That is what I also need to update/check when the road connection changes.

Yesterday I ran into a big performance issue. Lets have a look at the following scenario:
A user can of course also erase buildings and roads. So if a user now breaks the connection right after the junction I need to update many buildings at the same time. I think one of the first advice would be to avoid nested loops (which definitely is a big reason in this scenario) but I have to check...

if a building is still connected to the junction in case that a road tile has been removed (I do that only for affected buildings by that road). (Might be a smaller issue in this scenario)
the list of radius tiles and get buildings within radius (nested loops - big issue!).

// Go through all buildings affected by erasing this road tile.
foreach(var affectedBuilding in affectedBuildings) {
    // Get buildings within radius.
    foreach(var radiusTile in affectedBuilding.RadiusTiles) {
        // Get all buildings on Map within this radius (which is technially another foreach).
        var buildingsInRadius = TileMap.Buildings.Where(b => b.TileIndex == radiusTile.TileIndex);

        // Do stuff.
    }
}

This all breaks down my FPS from 60 to almost 10 for one second.

So would could I do. My ideas would be:

Not using the main thread (Update function) for this one but another thread. I might run into problems of locking when I start using multithreading.
Using a queue to handle a lot of calculations (what would be the best approach in this case?)
Keep more information in my objects (buildings) to avoid more calculations (e.g. buildings in radius).

Using the last approach I could remove one nesting in form this foreach instead:

// Go through all buildings affected by erasing this road tile.
foreach(var affectedBuilding in affectedBuildings) {
    // Go through buildings within radius.
    foreach(var buildingInRadius in affectedBuilding.BuildingsInRadius) {
        // Do stuff.
    }
}

But I don't know if this is enough. Games like Cities Skylines have to handle way much more buildings if the player has a big map. How do they handle those things?! There might be a updating queue since not all the buildings do update at the same time.

I'm looking forward to your ideas and comments!

Thanks a lot!

sentences:
Multiplayer Testing with Steam Accounts I'm build a multiplayer first person shooter, that supports 32 players.

What is the best way to test large quantities of players?

I'll need 32 steam accounts, with 32 machines to run on. Less, if I can switch to virtual machines.

sentences:
Drawing cube in SharpDX, wrong perspective I want to draw a cube. This is what i currently have:

As you can see, the perspective is VERY wrong. The the size in the z-direction is too small and the difference between the front and back size is wrong.

My code:

worldprojMatrix = Matrix.Identity;
worldprojMatrix *= Matrix.Translation(0, 0, 10);
//float ratio = ScreenWidth/ScreenHeight;
worldprojMatrix *= Matrix.PerspectiveFovLH(1f, ratio, 1f, 100f);
//worldprojMatrix *= Matrix.RotationY(1.3f);

worldprojMatrix.Transpose();

//update the matrix with a constant buffer
DeviceContext.UpdateSubresource(ref worldprojMatrix, worldprojBuffer);

Vertex Shader:

struct VOut
{
  float4 position : SV_POSITION;
  float4 color    : COLOR;
};

cbuffer meshBuffer  :  register(b1)
{
  float4x4 worldprojMatrix;
}

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
  VOut output;

  output.position = mul(position, worldprojMatrix);
  output.color = color;

  return output;
}

I tried an ortho perspective, but there is the same problem: the z dimension is too small.

How can i fix that?

sentences:
One side of every object is black I'm trying to make a driving game in Unity, but recently have been having lighting issues.

When I was first building it, the lighting worked fine. However, recently, one side of everything (the indirect lighting side) has turned black.

Here's an image of the issue.

I've tried changing my lighting settings, but can't seem to fix it. Here are my lighting settings.

What can I do to fix this? (I am using Unity 2017.2.0f3)

sentences:
How can I change my script execution order programmatically? I have a script that I want to run before any other script.  I want to change its execution order settings.  I could do that using the Script Execution Order Settings option from within Unity, but I want to do this programmatically.

The reason I want to do this programmatically is because the script has an abstract class, and I want to avoid requiring the user to change the execution order every time they extend the class.  Changing the execution order of an abstract class is not an option in the Script Execution Order Settings.  My abstract class has reference to every class that extends it.

How can I change the execution order of a MonoBehaviour?  An example of what I am looking for would be along the lines of:

MonoBehaviour myBehaviour = GetMyMonoBehaviour();
myBehaviour.ExecutionOrder = -100;

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

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

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

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

sentences:
What alternatives to large arrays do I have for level data? So I'm going to store my levels in int[] arrays.

Most levels are going to be 300*300*300. However, there will be about 24 levels and so that is 24 int arrays of size 300*300*300. However, that would mean I need about 2.5GB just to hold the information. Was wondering is there ways around this.

It just the nature of the game I need this many things. I can possible go down to 100*100*100 levels, but then I would still need about 17 at minimum.

I just can't get around using large arrays.

sentences:
How can I set up a flexible framework for handling achievements? Specifically, what is the best way to implement an achievement system flexible enough to handle going beyond simple statistics-driven achievements such as "kill x enemies."

I'm looking for something more robust than a statistics based system and something more organized and maintainable than "hardcode them all as conditions." Some examples that are impossible or unwieldy in a statistics based system: "Slice a watermelon after a strawberry", "Go down a pipe while invincible", etc.

sentences:
How can I apply a mesh collider in Unity to an entire imported model rather than a single piece? I have a series of models from Blender I'm importing to Unity as .blend files and I need mesh colliders applied to each one.

What I'm finding is that with any model that is constructed of multiple primitives, applying the mesh collider to the object is unsuccessful.  The mesh collider can't find the mesh.  Unity seems to treat each shape inside the model as a separate object.  I've even noticed that the Unity editor will allow me to select a single piece of a model and drag it away if I'm not careful.  This is unexpected behavior and somewhat alarming.

I've discovered that if I apply a separate mesh collider to each individual piece inside the model, the colliders will find the sub-meshes and the collision detection will work.  My primary concern at the moment is that this is monotonous.  For example, if I have the following model of a road intersection, then I'll need to individually select each of the seven pieces and create a mesh collider for each one.

How can I apply a mesh collider to the entire model in one move?

UPDATE:

Based on some feedback and some thoughts on my own, I'm redesigning the road pieces to simply be solid road on the bottom with the sidewalks on top.  This way, I'll only need one collider for the bottom, for now (if I don't care about testing collisions with the sidewalk edges yet).

I'm hesitant to merge the meshes into a single mesh at this time, though, since I'm potentially not done modelling street pieces yet.  This also doesn't address the long-term question of what to do in the final version of the game.

Unity primitives have automatic collision detection, but simulating hills this way and still having the pieces meet seamlessly is difficult.  They also won't do curved surfaces as far as I know.

I'd rather not use box colliders, since that will involve a lot of painstaking zooming in and tweaking of tiny values to get them perfect.  It also seems that box colliders will only rotate with a model and not to a model that's already sloped.

What I'm trying to avoid is spending almost as much time messing around with the colliders as I did modelling these bits in the first place.

Sticking with the mesh colliders is looking like the best option for now, since most of these shapes are simple, 6-sided objects and it's only a couple of clicks to add a mesh collider to each shape.  It sounds like if I do it this way, it might be smarter to keep the meshes un-merged, since I would then be using a mesh collider on a concave object.

sentences: Does Overlap2d have frustum culling? Does Overlap2d have its own frustum culling or do I have to implement my own?

sentences:
How do we solve big video memory requirements in a 2D game? How do we solve big video memory requirements in a 2D game?

We are developing a 2D game (Factorio) in allegro C/C++, and we are facing a problem with increasing video memory requirements as the game content increases.

We currently gather all the info about images that are going to be used first, crop all of these images as much as possible and organize them into big atlases as tightly as possible. These atlases are stored in video memory, the size of which depends on the system limitations; currently it is usually 2 images of up to 8192x8192, so they require 256Mb to 512Mb video memory.

This system works pretty good for us, as with some custom optimisations and splitting the render and update thread we are able to draw tens of thousands of images on the screen in 60 fps; we have many objects on the screen, and allowing a big zoom-out is a critical requirement. As we would like to add more, there is going to be some trouble with the video memory requirements, so this system can't possibly hold.

One of the things we wanted to try is to have one atlas with the most common images, and the second as a cache. The images would be moved there from the memory bitmap, on demand. There are two problems with this approach:

The drawing from memory bitmap to video bitmap is painfully slow, in allegro.
It is not possible to work with video bitmap in other than the main thread, in allegro, so it is practically unusable.

Here are some additional requirements we have:

The game must be determistic, so the performance issues/loading times can never alter the game state.
The game is real time, and soon to be multiplayer, as well. We need to avoid even the smallest stutter at all costs.
Most of the game is one continuous open world.

The test consisted of drawing 10 000 sprites in a batch for sizes from 1x1 to 300x300, several times for every configuration. I did the tests on the Nvidia Geforce GTX 760.

Video bitmap to video bitmap drawing took 0.1us per sprite, when the source bitmap wasn't changing between individual bitmaps (the atlas variant); the size didn't matter
Video bitmap to video bitmap drawing, while the source bitmap was switched between drawings (non atlas variant), took 0.56us per sprite; the size didn't matter, either.
Memory bitmap to video bitmap drawing was really suspicious. Sizes from 1x1 to 200x200 took 0.3us per bitmap, so not so horribly slow. For larger sizes, the time started to raise very dramatically, at 9us for 201x201 to 3116us for 291x291.

Using atlas increases the performance by a factor greater than 5.
If I had 10ms for the rendering, with an atlas I'm limited to 100 000 sprites per frame, and without it, a limit of 20 000 sprites. This would be problematic.

I was also trying to find a way to test the bitmap compression and 1bpp bitmap format for shadows, but I was unable to find a way to do this in allegro.

sentences:
Blood particles system,join particles Does anyone know how the particles behave in the following picture?

Let me explain,before the particles join they seem to be just simple textures of blood drops with a black border around them ,when they start to overlap the border disappears giving the illusion that its all one single blood drop.Is this some kind of shader?

sentences:
Handling character with world object collision in libgdx and bullet I am using libgdx and bullet for my 3d mmo project. I have been able to detect collisions using a collision world with collision objects. This was working fine for things like detecting players hitting each other but I was having problems handling players hitting walls or other world objects.

After some searching I came across rigid bodies and the dynamics world. This seemed like it would solve my issue but once I got my objects converted over to rigid bodies my collision handler is no longer detecting collisions and the player is still going through walls.

I would like to not have to handle the low level details of players not going through walls but I would still like to be able to manually handle collisions of collision objects for things like spells or weapons. What is the best way to go about this? I am also seeing different bullet objects like static, kinematic, dynamic, but I am not sure which is best for my situation. I also am thinking that part of my problem may be that I am translating my character every update instead of updating its velocity.

What is the best setup for accomplishing this?

sentences:
Movement appears to be frame rate dependent, despite use of Time.deltaTime I have the following code to calculate the translation required to move a game object in Unity, which is called in LateUpdate. From what I understand, my use of Time.deltaTime should make the final translation frame rate independent (please note CollisionDetection.Move() is just performing raycasts).

public IMovementModel Move(IMovementModel model) {
    this.model = model;

    targetSpeed = (model.HorizontalInput + model.VerticalInput) * model.Speed;

    model.CurrentSpeed = accelerateSpeed(model.CurrentSpeed, targetSpeed,
        model.Accel);

    if (model.IsJumping) {
        model.AmountToMove = new Vector3(model.AmountToMove.x,
            model.AmountToMove.y);
    } else if (CollisionDetection.OnGround) {
        model.AmountToMove = new Vector3(model.AmountToMove.x, 0);
    }

    model.FlipAnim = flipAnimation(targetSpeed);
    // If we're ignoring gravity, then just use the vertical input.
    // if it's 0, then we'll just float.
    gravity = model.IgnoreGravity ? model.VerticalInput : 40f;

    model.AmountToMove = new Vector3(model.CurrentSpeed, model.AmountToMove.y - gravity * Time.deltaTime);

    model.FinalTransform =
        CollisionDetection.Move(model.AmountToMove * Time.deltaTime,
            model.BoxCollider.gameObject, model.IgnorePlayerLayer);
    // Prevent the entity from moving too fast on the y-axis.
    model.FinalTransform = new Vector3(model.FinalTransform.x,
        Mathf.Clamp(model.FinalTransform.y, -1.0f, 1.0f),
        model.FinalTransform.z);

    return model;
}

private float accelerateSpeed(float currSpeed, float target, float accel) {
    if (currSpeed == target) {
        return currSpeed;
    }
    // Must currSpeed be increased or decreased to get closer to target
    float dir = Mathf.Sign(target - currSpeed);
    currSpeed += accel * Time.deltaTime * dir;
    // If currSpeed has now passed Target then return Target, otherwise return currSpeed
    return (dir == Mathf.Sign(target - currSpeed)) ? currSpeed : target;
}

private void OnMovementCalculated(IMovementModel model) {
    transform.Translate(model.FinalTransform);
}

If I lock the game's framerate to 60FPS, my objects move as expected. However, if I unlock it (Application.targetFrameRate = -1;), some objects will move at a much slower rate then I would expect when achieving ~200FPS on a 144hz monitor. This only seems to happen in a standalone build, and not within the Unity editor.

GIF of object movement within the editor, unlocked FPS

http://gfycat.com/SmugAnnualFugu

GIF of object movement within the standalone build, unlocked FPS

http://gfycat.com/OldAmpleJuliabutterfly

sentences:
Creating a BufferedImage with several smaller images? I am making a 2D tile based game. The tiles render fine from a spritesheet and a text file. However, I am using a for loop to draw the map to the screen. When it refreshes, it slows down the loop, and the bottom is black for a fraction of a second.

I was wondering if I could create a separate method to create a BufferedImage to hold the map, so I could render it continuously, and change it when needed.

Map Class:

package uk.co.madmonkeystudios.distortioner;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;

import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

public class Map {

    static BufferedImage sheet;

    public static void SetSpriteSheet() throws IOException{
        sheet = ImageIO.read(new File("res/grid.png"));
    }

    public static BufferedImage GetTile(int id) throws IOException{
        if(sheet == null){SetSpriteSheet();}

        int across = 24;

        BufferedImage tile = null;
        int x = 0;
        int y = 1;
        int w = 31;
        int h = 31;
        for(int done = 0;done<id;done++){

            x= done * w;
            x += id;
            if(done >= across){
                y += h;
                y++;
            }

        }
        tile = sheet.getSubimage(x, y, w, h);

        return tile;
    }

    public static void DrawMap(int id) throws IOException{

        Graphics2D g = (Graphics2D)Core.myself.getGraphics();

        g.clearRect(0,0,640,480);

        int[][] map = ReadMap(0);

        int xsize = map.length;
        int ysize = map[0].length;
        System.out.println("Map Read, size (" +xsize + "," +ysize+")");

        int x = Player.x;
        int y = Player.y;

        for(int loopy = 0;loopy<ysize;loopy++){
            for(int loop = 0;loop<xsize;loop++){
                g.drawImage(GetTile(map[loop][loopy]),loop * 32 + x, loopy * 32 +y + 25,32,32,null);
            }
            }
    }

    public static int[][] ReadMap(int id){
        int [][] map = null;
        try{
        @SuppressWarnings("resource")
        Scanner s = new Scanner(new File("res/maps/area"+id+".map"));
        int [][] map1 = new int[Integer.parseInt(s.next())][Integer.parseInt(s.next())];
        String current;

        int xsize = map1.length;
        int ysize = map1[0].length;

        for(int loopy = 0;loopy<ysize;loopy++){
        for(int loop = 0;loop<xsize;loop++){
            current = s.next();
            map1[loop][loopy] = Integer.parseInt(current);
        }
        }
        map = map1;
        }catch(NullPointerException ex70){
            System.err.println("Cannot read map in area ID " +id);
            JOptionPane.showMessageDialog(null, "Couldn't read map...","",JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        }
        catch(FileNotFoundException ex71){
            System.err.println("Cannot find map in area ID " +id);
            JOptionPane.showMessageDialog(null, "Couldn't read map...","",JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        }
        catch(ArrayIndexOutOfBoundsException ex72){
            System.err.println("Cannot add map to array in area ID " +id);
            JOptionPane.showMessageDialog(null, "Couldn't send map...","",JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        }

        return map;
    }

}

sentences:
How can I skew my XNA sprites? I would like to make a 2D tile based game, but, to make it look a bit prettier, I would need to skew textures so that it would look more like a 2.5D game.
So I thought maybe I should skew textures to something like this:

So far I only found one topic about it - http://forums.create.msdn.com/forums/p/37143/215098.aspx#215098

But I don't really understand it. Maybe some of you do, can tell me how to skew my sprites?

sentences:
What is the better way of generating levels in android game using LibGDX I downloaded the source code of metagun for android from
https://github.com/libgdx/libgdx/tree/master/demos/metagun/metagun-android

The game uses a png image to create the level. It uses the following code.  I am finding it difficult to understanding.  The following code is from Level.java:

@SuppressWarnings("unchecked")
public Level (GameScreen screen, int w, int h, int xo, int yo, int xSpawn, int ySpawn) {
    this.screen = screen;
    this.xSpawn = xSpawn;
    this.ySpawn = ySpawn;

    walls = new byte[w * h];
    entityMap = new ArrayList[w * h];
    this.width = w;
    this.height = h;

    for (int y = 0; y < h; y++) {
        for (int x = 0; x < w; x++) {
            entityMap[x + y * w] = new ArrayList<Entity>();

            int col = (Art.level.getPixel(x + xo * 31, y + yo * 23) & 0xffffff00) >>> 8;
            byte wall = 0;

            if (col == 0xffffff)
                wall = 1;
            else if (col == 0xFF00FF)
                wall = 2;
            else if (col == 0xffff00)
                wall = 3;
            else if (col == 0xff0000)
                wall = 4;
            else if (col == 0xB7B7B7)
                wall = 5;
            else if (col == 0xFF5050)
                wall = 6;
            else if (col == 0xFF5051)
                wall = 7;
            else if (col == 0x383838)
                wall = 8;
            else if (col == 0xA3FFFF)
                wall = 9;
            else if (col == 0x83FFFF) {
                BossPart prev = new Boss(x * 10 - 2, y * 10 - 2);
                int timeOffs = random.nextInt(60);
                ((Boss)prev).time = timeOffs;
                add(prev);
                for (int i = 0; i < 10; i++) {
                    BossNeck b = new BossNeck(x * 10 - 1, y * 10 - 1, prev);
                    b.time = i * 10 + timeOffs;
                    prev = b;
                    add(prev);
                }
            } else if (col == 0x80FFFF) {
                Gremlin g = new Gremlin(0, x * 10 - 10, y * 10 - 20);
                g.jumpDelay = random.nextInt(50);
                add(g);
            } else if (col == 0x81FFFF) {
                Gremlin g = new Gremlin(1, x * 10 - 10, y * 10 - 20);
                g.jumpDelay = random.nextInt(50);
                add(g);
            } else if (col == 0x82FFFF) {
                Jabberwocky g = new Jabberwocky(x * 10 - 10, y * 10 - 10);
                g.slamTime = random.nextInt(30);
                add(g);
            } else if (col == 0xFFADF8) {
                add(new Hat(x * 10 + 1, y * 10 + 5, xo * 31 + x, yo * 23 + y));
            } else if ((col & 0x00ffff) == 0x00ff00 && (col & 0xff0000) > 0) {
                add(new Sign(x * 10, y * 10, col >> 16 & 0xff));
            } else if (col == 0x0000ff) {
                // if (xSpawn == 0 && ySpawn == 0) {
                this.xSpawn = x * 10 + 1;
                this.ySpawn = y * 10 - 8;
                // }
            } else if (col == 0x00FFFF) {
                Gunner e = new Gunner(x * 10 + 2, y * 10 + 10 - 6, 0, 0);
                e.chargeTime = random.nextInt(Gunner.CHARGE_DURATION / 2);
                e.xa = e.ya = 0;

                add(e);
            }
            walls[x + y * w] = wall;
        }
    }
    player = new Player(this.xSpawn, this.ySpawn);
    add(player);
}

I want some advice as to whether this is a good idea or not? This game was developed in 2010 using LibGdx.

The other example I found using TiledMap is at
http://chrismweb.com/wp-content/uploads/2013/03/superkoala/
at the offical site of libgdx.

sentences:
irrlicht for android I was  just wondering after noticing that moblox was.built with irrlicht if there is an android port of it?  Or did the dev make his own port from scratch?

From my research I noticed a port project on github but it seems far from ready.-

sentences:
Collision detection problem in monogame C# protected virtual void CollisionDetection()
    {
        if (CanGoRight() == false) pos.X -= velocity;
    }

    protected bool IsTouchingLeft(Basic2d asset)
    {
        return pos.X + dims.X / 2 > asset.pos.X &&
               pos.X - dims.X / 2 < asset.pos.X &&
               pos.Y + dims.Y / 2 < asset.pos.Y + dims.Y &&
               pos.Y - dims.Y / 2 > asset.pos.Y;
    }

    protected bool CanGoRight()
    {
        foreach (Basic2d asset in Globals.GameAssets)
            if (IsTouchingLeft(asset) == true) return false;
        return true;
    }
}

That's my code(just starting) for collision detection. All of this code is in Character class which has also methods for moving and updating and displaying character.

I struggle with collision detection. I have all my assets(blocks) in the list of objects which is in the class named Globals. Class character is a subclass of a Basic2d class(this is class for all bricks assets).

So I check if a character is overlapping with any of bricks from the list. Criteria for checking left side overlapping is in the IsTouchingLeft method and it doesn't work. I cannot see what is wrong with this code, but every time I change sth it works differently but not well.

What should I change?

And the object of Character class has an origin point in in the center of the texture, but the object of Basic2d class has origin point in the bottom left corner.

sentences:
Speed needed to make a car jump from a ramp I need to make a car jump from a ramp to another, and I need this to be done using AI so I thought it would be enough to set a fixed speed for my car when near the ramp, in order to let it jump correctly.

It works fine if I input the speed manually but I'd like my game to calculate it since the ramps will be generated by user's input.

Unfortunately my physics knowledge lacks, so I need your help.

The problem is summarized in the picture below.

Basically, what I need to compute is the speed (in m/s) that the car has to have on the highest point of the first ramp, given that all the data in red are user's input.

I had some rough ideas on using the projectile range with x=L, y=h-launchRampHeight but the results weren't as I expected them so I gave up.

Do you have any hints on this?

Please note that both ramps have the same length (50m).

EDIT:

Based on @mklingen here's the C# code that I'm using (where Distance = L)

var speed = (Mathf.Sqrt(g)*Mathf.Sqrt(Distance)*Mathf.Sqrt((1/Mathf.Sin(Theta)))* Mathf.Sqrt((1/Mathf.Cos(Theta))))/Mathf.Sqrt(2);

What happens is quite weird though.

For example, with theta = 19, L = 196, h = 46 my code returns 80.54646 which seems to work if I input it to the car. However running the expression in WolframAlpha leads to 55.8 which is wrong.

It may seem that the code is correct but with theta = 35, L = 261, h = 39 my code returns NaN while WolframAlpha shows 52.17 which made the jump happen.

So, tu summarize, I have 2 different cases in which my result is different from WolframAlpha's one and none of them is the correct one both the times.

What's going on?

sentences:
How to display procedurally created rooms as a schematic map? In most games, a map can be generated by essentially doing a "top-down" view of the specific area. This will accurately show the size and positioning of any rooms, as well as how they connect.There might be special icons for stairs, doors, etc.

In a game I am working on I am intentionally keeping some concepts rather loose. The map is not there so much to display distance between rooms or the relative size of rooms between each other, but just to most clearly show the connections between the rooms.

The easiest real-life example I can show is an electronic schematic.

Now, I only know some of the symbols on there, but in this case you might just substitute them for various rooms. You can easily imagine then that this layout could have many actual physical representations. A connection could be a door, but it could also be stairs or even an abstract "border" between two regions.

I currently generate "rooms", without size or even position. I then assign them connections. Not exactly "random" connections but I am still playing with the generation so I don't have any hard rules at this time.

The task I am having a difficult time with is: How do I take these rooms with connections and arrange them in such a way to maximize clarity of which rooms connect to which?

sentences:
Expected OpenGL performance I'm benchmarking some simple code for drawing using OpenGL.

In the following code, the number of indices being drawn is 4,644 (or 1,548 triangles per frame = @60fps 92,880 Triangles per second).

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, screenSize.width, screenSize.height, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnable(GL_TEXTURE_2D);

glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(venomGLAttribute), ,drawingTexturedList.attrib[0].color);
glVertexPointer(2, GL_SHORT, sizeof(venomGLAttribute), &drawingTexturedList.attrib[0].pos[0]);
glTexCoordPointer(2, GL_FLOAT, sizeof(venomGLAttribute), &drawingTexturedList.attrib[0].UV[0]);
glDrawElements(GL_TRIANGLES, drawingTexturedList[cnt].currentIndice /*4644*/, GL_UNSIGNED_INT, drawingTexturedList[cnt].Indices);

This takes 100% of one of my CPU's. If I take out the call to glDrawElements but still perform all the other steps (geometry preperation, gl*Pointer setup) I see my CPU stay at ~3%.

Is this expected behaviour? The machine I'm running on has a GeForce 8800GTX and a Dual Core @ 2.66Ghz.

Using fps as a measurement (which isn't perfect I realise) and using gDEBugger to confirm my findings, rendering 27,904 triangles a frame in a single call to glDrawElements brings my frame rate down to ~35fps (or 977,640 triangles a second).

Is there a better way to pack my data than I'm doing or perhaps a better way to send the data than glDrawElements? I don't think using a VBO will help as the data being sent changes every frame.

Any idea's would be appreciated!

sentences:
Move component to: where to with child components? I have a simple static mesh attached to a scene in a blueprint. I want to move the component back to (0,0,0). If a component is not attached to any other component other than the default scene root, I just type in (0,0,0) as the Target Relative Location.

To be precise, I don't want it to go to (0,0,0) but head there and stop, so I just give it the world location and then multiply X, Y and Z by 0.67 (could be any value).

But now I have a few child components attached to an extra scene. This scene is moved (-2460, 3070, 2600). Now to make matters worse, it's ALSO rotated (0°, 0°, 90°) and every component I try to move is ALSO rotated by (0°, 90°, -90°). The numbers themselves aren't hard to crunch but I have no idea what "Target Relative Component" should be now.

I tried adding vectors, subtracting vectors (both relative and world from both the parent and every child component I want to move), inverting transforms, transform directions, rotating the  resulting vectors, unrotating the resulting vectors, nothing seemed to work, at least not the combinations I tried.

How do I get the correct Target Relative Location?

sentences:
Cyclone LED gaming code HOW TO HELP? I am very new to programming. For a project I decided to make a game of cyclone using some LEDs,a push button, and a raspberry pi. I researched how to at least start on the game, but the problem that I encounter is that most examples of this game utilizes an arduino and python code, when I am familiar with the raspberry pi and c code. I would like to know to loop lighting up multiple LEDs one at a time with a decent amount of speed for a fun reaction game. My code starts out as this:

    #define pinOutYOne 0 //first yellow LED
    #define pinOutYTwo 3 //second yellow LED
    #define pinOutGOne 21 //green LED one
    #define pinOutGTwo 22 //green LED two
    #define pinOutBOne 23 //blue LED one...etc
    #define pinOutBTwo 25 //
    #define pinOutROne 4
    #define pinOutRTwo 5

    int  main(void){
      //set up pin mode as output
      pinMode(pinOutYOne, OUTPUT); //syntax for pinMode(pinNumber, Mode)
      pinMode(pinOutYTwo, OUTPUT);
      pinMode(pinOutGOne, OUTPUT);
      pinMode(pinOutGTwo, OUTPUT);
      pinMode(pinOutBOne, OUTPUT);
      pinMode(pinOutBTwo, OUTPUT);
      pinMode(pinOutROne, OUTPUT);
      pinMode(pinOutRTwo, OUTPUT);

      //clear output
      digitalWrite(pinOutYOne, 0); //write 0 (low) to output pin
      digitalWrite(pinOutYTwo, 0);
      digitalWrite(pinOutGOne, 0);
      digitalWrite(pinOutGTwo, 0);
      digitalWrite(pinOutBOne, 0);
      digitalWrite(pinOutBTwo, 0);
      digitalWrite(pinOutROne, 0);
      digitalWrite(pinOutRTwo, 0);

     //loop to allow blinking
     while (1 == 1){
       //light up the LED for 1 second
       digitalWrite(pinOutYOne, 1);
       digitalWrite(pinOutYTwo, 1);
       digitalWrite(pinOutGOne, 1);
       digitalWrite(pinOutGTwo, 1);
       digitalWrite(pinOutBOne, 1);
       digitalWrite(pinOutBTwo, 1);
       digitalWrite(pinOutROne, 1);
       digitalWrite(pinOutRTwo, 1);
       puts("LED on"); //display a message on console
       delay(1000); //1 for 1 milliseconds, 1000 for 1 second

    //turn off for 1 second
      digitalWrite(pinOutYOne, 0); //write 0 (low) to output pin
      digitalWrite(pinOutYTwo, 0);
      digitalWrite(pinOutGOne, 0);
      digitalWrite(pinOutGTwo, 0);
      digitalWrite(pinOutBOne, 0);
      digitalWrite(pinOutBTwo, 0);
      digitalWrite(pinOutROne, 0);
      digitalWrite(pinOutRTwo, 0);
      puts("LED off");
      delay(1000);
     }
 }

**I do know that this code lights all of the LEDs at once, I'm not sure how to implement a loop and light them up one at a time in sequence

sentences:
Boolean change when clicking the left mouse button (not working) I want to change a boolean when I click the left mouse button, but it doesn't work as expected. I use this method:

if (m.LeftButton == ButtonState.Released && m_Old.LeftButton == ButtonState.Pressed)
{
   if (second)
   {
      second = false; // Boolean changes
   } else
   {
      second = true; // Boolean changes
   }
}

I need a way to tell the code that I only want one change. When I click the left mousebutton, the second boolean changes constantly. The reason for this is that the code keeps executing until m_Old (the old mousestate) is updated. (m & m_Old must be different for this code to run)

An example (when I click the left mouse button once| these are the results for the second boolean):

My mouse update code:

// Mouse stuff
oldMouse = mouse;
mouse = Mouse.GetState();

sentences:
Why does my recursive coroutine freeze Unity? I want the bounds (left wall and right wall) to follow the player's y position, a couple of times. However when I use this code, Unity freezez as soon as it runs, and I have to manually shut it down.

Any idea why?

public Transform bounds;

//in another function
StartCoroutine(Follow_Bounds(0));

IEnumerator Follow_Bounds(int a)
{
    yield return new WaitForSeconds(1f);
    while(a < 3)
    {
        StartCoroutine(Follow_Bounds(a + 1));
    }
   bounds.position = new Vector2(bounds.position.x, transform.position.y);
}

sentences:
Balancing players between air/land fields in a PvP match Background:
In my game there are two teams per PvP match, and those two teams are further divided into air/land fields. Each team has 12 players on the ground and 6 patrolling the sky. The goal of the game is for the air/land units to work together to win the match. Players are matchmade into games randomly, without taking into account skill/field preference/etc (the short explanation is that we don't have control over this).
The problem:
If I allow complete freedom in choosing fields, I might end up with no players in the sky or vice versa on one or both teams. If I don't give players a choice, they won't be happy when they aren't assigned to the field of their preference. Overall I imagine the fields would balance out on their own if they're equally enjoyable, but there's little room for error there -- if either field gets a bad first impression, it'll be difficult to recover from. I want to ensure there are some constraints in place to prevent death by conjecture.
I thought of adding 1 or 2 landing pads at either team's base, and that way players who wanted to play the land field could land, and players who wanted to play the air field could take a parked aircraft on the landing pad. This could breed tension between players where more than 2 players are competing for landing pads though.
What are some approaches I can take to resolve this, which avoid forcing player behavior as much as possible, but still ensure gameplay is predictable and reliable? Specifically I'm looking for what key issues an answer takes into account and how it resolves them. If you're drawing experience from something that's already been put into practice and already has tangible results, those results would be a wonderful addition to your answer.

sentences:
Need help revolving a 2D array Pretty much all I'm trying to do is revolve my 2D Array by its container.
I'm using this array for a background and I seem to be having problems with it revolving.

public class TileTransformer : GridConstants
{
    public Tile[,] Tiles;
    ContentManager Content;
    public TileTransformer(ContentManager content)
    {
        Content = content;

    }
    public Tile[,] Wraping(Tile[,] tiles,Point shift)
    {
        Tiles = tiles;
        for (int x = shift.X; x < 0; x++)//Left shift
        {
            for (int X = 0; X < GridWidth; X++)
            {
                for (int Y = 0; Y < GridHeight; Y++)
                {
                    if (X + 1 >GridWidth-1)
                    {
                        Tiles[0, Y].Container =tiles[X, Y].Container;
                    }
                    else
                    {
                        Tiles[X+1, Y].Container =tiles[X, Y].Container;
                    }
                }
            }
        }
        for (int x = shift.X; x > 0; x--)//right shift
        {
            for (int X = 0; X < GridWidth; X++)
            {
                for (int Y = 0; Y< GridHeight; Y++)
                {
                    if (X-1==-1)
                    {
                        Tiles[GridWidth-1, Y].Container =tiles[0, Y].Container;
                    }
                    else
                    {
                        Tiles[X - 1, Y].Container =tiles[X, Y].Container;
                    }
                }
            }
        }
        for (int y = shift.Y; y > 0; y--)//shift up
        {
            for (int X = 0; X < GridWidth; X++)
            {
                for (int Y = 0; Y < GridHeight; Y++)
                {
                    if (Y - 1 == -1)
                    {
                        Tiles[X, GridHeight-1].Container = tiles[X, Y].Container;
                    }
                    else
                    {
                        Tiles[X, Y - 1].Container = tiles[X, Y].Container;
                    }
                }
            }
        }
        for (int y = shift.Y; y < 0; y++)//shift down
        {
            for (int X = 0; X < GridWidth; X++)
            {
                for (int Y = 0; Y < GridHeight; Y++)
                {
                    if (Y + 1 == GridHeight)
                    {
                        Tiles[X, 0].Container = tiles[X, Y].Container;
                    }
                    else
                    {
                        Tiles[X, Y + 1].Container = tiles[X, Y].Container;
                    }
                }
            }
        }
        return Tiles;
    }

Now the Problems that I'm having is either when I shift up or left it seems the whole array is cleared back to the default state. Also when I'm revolving the array it appears to stretch it upon the sides of the screen that it is shifting towards.

sentences:
Image splitting / tiling software for Mac I have been programming for a bit and for 2D games and other applications I frequently make large images for the levels / the maps. Before I place these into the games I split the large images down into smaller equally sized squares, but I do this manually in 'the Gimp' and it takes ages sometimes! Is there some software which can do this much quicker for me, where I can select how I want  the image split down etc? And for Mac as well?

Thanks

sentences:
How to approach in-game character creation system alike Sims I would like to implement an in-game character creation similar to the Wii/Mii system or The Sims using Blender and Unity. In what ways is this possible, other than (or in conjunction with) using shape keys? The ideal system would have 2-4 body types, ~8 hairstyles, full RGB skin/hair toning (I quite like Terraria's style), and a few styles for faces.

I have been looking into this topic, but so far I have not found a good explanation as to how this would be implemented, and blender shape keys would allow for some aspects of this - namely body and hair manipulation - but would not work for coloring or styling the face.

sentences:
Unity application freezes on ios at pause When I play my game made with Unity on iOS device, and press the home button or let the screen close by time or by pressing the power button and then try to come back to the game, the game freezes immediately. This does not happen always, only when there's certain things happened in the game in the current session. I have found nothing in common in between these situations. If those events have not happened in the current session, I can go to home screen and play other games and come back to the game and continue where I left without issues.

I have tried debugging on xcode, with no output whatsoever in the console regarding this issue. XCode reports 200mb memory usage and Unity profiler reports roughly 300mb memory usage when going to the pause state, and nothing happens when coming back to the game. We have had memory issues previously which we have been optimizing a lot lately, but this particular crash is still persisting. Android works fine, whaterver the device memory capacity is.

I have been trying to google for this type of iOS crash, with no luck. I'm asking here if someone might have some advice or direction for me to go to.

EDIT: I updated the question to match my current situation. I previously had some code in this question and talks about memory issues, which I have found out to have nothing to do with the problem at hand.

What happens according to the debug console in XCode:

Home button is pressed
OnApplicationPause(true) gets called
One Update() gets called
GameAnalytics detects a status change (headingToBackground event) and ends session
User is at home screen, resuming game by tapping on the game icon
GameAnalytics gets a headingToForeground event and restarts the session
Nothing else happens after that

This makes me want to point my finger at GameAnalytics, but why it works sometimes, just not after these specific events?

sentences: Planar reflections not showing when baked reflection probes enabled I have a reflection probe that is baked that is set to capture static environment objects like buildings/terrain etc. I also have a planar reflection probe that is following the player camera which is only set to capture the player. I am trying to have both of these displaying on a surface. When I have the baked reflection probe turned on the planar reflection will not show. Are they mutually exclusive? I am using Unity 2020.1.6f1 with HDRP.

sentences:
Collision detection for an arc of a circle So how do I implement the collision detection for an arc of a circle? Will I have to use the Box 2D collision or can I do it some other way using Rectangle or stuff like that?

BTW I hate box2d because I don't understand most of the things in it, so if there is a solution that excludes the box2d, it will be very much appreciated.

The yellow arc keeps on rotating over the black circle. How do I implement collision detection in here?

sentences:
How can I convert between float3 and float2 in HLSL? I want to offload some 3D calculations to the GPU without raising my requirements to DX10.  Specifically, I am generating densities in 64x64x64 3D blocks, which fit nicely into 512x512 2D textures.  I would like to be able to convert my float2 texture coordinates to float3 values, so I can offset them, convert back to float2, perform lookups against my randomness texture, and interpolate the results manually.

This has been easy to do with integer values on the CPU side, but the GPU's texture coordinates are all floating points.  Is there an easy way to do this?  Or is there a way to coax pixel shader 3.0 into using something similar to 3D textures, so I can take advantage of automatic interpolation?

Another caveat is that I am using the Vector4 image format for my render targets (need better resolution in each channel) in XNA, so I am restricted to Point sampling.

sentences:
Ray-Box (AABB) is slower than without I'm trying to write my own ray tracer. The last days I tried implementing a bounding box algorithm for it. But I'm getting a much slower frame rate with the bounding boxes turned on. I think it has something to do with checking the box with every ray but I don't know how I could change that.
Here is my code for the intersection algorithm:
bool Intersect(Ray r, float3 lb, float3 rt)
{
    float3 dir_inv = 1 / r.direction;

    double t1 = (lb[0] - r.origin[0]) * dir_inv[0];
    double t2 = (rt[0] - r.origin[0]) * dir_inv[0];

    double tmin = min(t1, t2);
    double tmax = max(t1, t2);

    for (int i = 1; i < 3; ++i)
    {
        t1 = (lb[i] - r.origin[i]) * dir_inv[i];
        t2 = (rt[i] - r.origin[i]) * dir_inv[i];

        tmin = max(tmin, min(t1, t2));
        tmax = min(tmax, max(t1, t2));
    }

    return tmax > max(tmin, 0.0);
}

My trace function:
RayHit Trace(Ray ray)
{
    RayHit bestHit = CreateRayHit();
    uint count, stride, i;

    // Trace ground plane
    IntersectGroundPlane(ray, bestHit);

    // Trace spheres
    _Spheres.GetDimensions(count, stride);
    for (i = 0; i < count; i++)
    {
        if (Intersect(ray, _Spheres[i].position - (_Spheres[i].radius), _Spheres[i].position + (_Spheres[i].radius)))
            IntersectSphere(ray, bestHit, _Spheres[i]);
    }

    // Trace mesh objects
    _MeshObjects.GetDimensions(count, stride);
    for (i = 0; i < count; i++)
    {
        //if (Intersect(ray, float3(0.0f, 0.0f, 0.0f), float3(10.0f, 10.0f, 10.0f)))
            //IntersectMeshObject(ray, bestHit, _MeshObjects[i]);
    }

    return bestHit;
}

sentences:
Building an Octree for terrain generation I've previously implemented marching cubes/tetrahedra to render an IsoSurface. It worked (YouTube), but the performance was dire as I never got around to implementing variable Level of Detail based on view distance (or even removing old, distant chunks).

I decided to have another go and do it properly this time.
I've started by creating an OctreeNode that works as follows when Build() is called.

If the chunk is too small to build, return immediately.
Work out if the surface passes through this chunk's volume.
If so, then decide if we want to raise the LOD (because the camera is close)
If so, then spawn 8 children and call the same process on them
If not, build the mesh using the current node's dimensions

Some PseudoCode:

OctNode Build() {
    if(this.ChunkSize < minChunkSize) {
        return null;
    }
    densityRange = densitySource¹.GetDensityRange(this.bounds);
    if(densityRange.min < surface < densityRange.max) {
        if(loDProvider.DesiredLod(bounds)² > currentLoD) {
            for(i 1 to 8) {
                if(children[i] == null) {
                    children[i] = new OctNode(...)
                }
                children[i] = children[i].Build();
            }
        } else {
            BuildMesh();
        }
        return this;
    }
}

¹ As well as returning density at a point, the density source can determine the possible density range for a given volume.

² The LoD provider takes a bounding box and returns the max desired LoD based on camera position/frustum, user settings, etc...

So... This all works fairly well. Using a simple sphere as the Density source, and showing all nodes:

And just the leaves:

However, there are a couple of issues:

I have to define the initial bounding volume (and the larger it is, the more processing I need to do)
At the root of the tree, I have no idea how deep the leaves will be, so my LoD numbering starts at lowest quality (root) and increases as chunks get smaller. Because LoD is now relative to initial volume, it's not much use when I want to do things at specific sizes / qualities.

I've thought of a couple of options but both seem flawed:

Maintain a collection of Octrees and add/remove depending on distance. Can't see how I'd mesh across nicely¹, plus I'd need a list of known-empty nodes, especially if I want arbitrary 3D surfaces (to avoid re-calculating empty volumes repeatedly)
Add a parent Node to the current root, then add seven siblings for the original node. This would work and be on-demand but it seems complex to shrink back down sensibly as the player moves through the landscape. It would also make LoD numbers even less meaningful.

¹ [In clarification to Q below] At present, if 2 physically adjacent nodes in the tree are at different LODs, I have some code to coerce the verts such that there's no seam when the meshes are generated. I'm able to do this by knowing the the density for multiple of surrounding nodes. In a scenario where I have 2 independent octrees side-by-side, I'd have no easy way to retrieve this information, resulting in seams.

What's an optimal way to approach this?

sentences:
How to move rigidbody player to its facing direction with AddForce? How can I move a rigidbody to its facing direction? I've already tried this:

rigidbody.AddForce (transform.forward * v, ForceMode.Acceleration);
// v is a public float which gets a new value in Update function:
v = Input.GetAxis ("Vertical") * Speed;

in FixedUpdate, but it doesn't move forward.

It should go on that blue arrow, but it spins on the red arrow.

Hopefully u understood. Any suggestions?

sentences:
Intersecting Triangle and BoundingBox in 3D environment I am trying to check if a triangle is intersecting a BoundingBox in a 3D space with libgdx, but I am unable to find anything that can help me with that.

I tried using a Plane but it is not precise enough and I would like to avoid using Bullet.

Is there any existing code that I can use to deal with this ?

sentences:
Early Z culling - Ogre For Ogre experienced people, but also experts in the field:
Early Z culling is sometimes quite desirable, and that's what I tried to do in Ogre by using a two pass material. The first one is writing to the Z Buffer, but not to the frame buffer. This is how it looks like:

 pass EarlyZ
    {
        texture_unit TU0
        {
            //ambient diffuse texture
            texture $TU0_TEXTURE
            tex_coord_set 0
            filtering trilinear
        }
        //cull_software none
        //cull_hardware none
        lighting off
        colour_write off
        shading flat
        //scene_blend alpha_blend
        alpha_rejection  greater_equal 200
        depth_bias  -5 -5 // ugly hack - without it, objects tend to flicker
    }

The biggest problem I get is with alpha objects and shadows. For example, now I can't get  tree impostors to cast correct shadows instead of blocks. Although they are rendered correctly, the PSSM isn't working correctly, so the shadows tend to look like stencil shadows. Any ideas on how to fix it? As many people said: is it possible to perform early Z culling and still have transparent objects in the scene? If yes, some hints to do it in Ogre? Here are some screenshots:

sentences:
Given an angle for an arrow, how do I find its X and Y velocities? I want to fire an arrow toward the mouse location.

X0 = the players X location
X1 = the mouse X location
Y0 = the players Y location
Y1 = the mouse Y location

I want to make a method which takes degrees as a parameter, and sets the Yspeed and Xspeed accordingly, so the arrow can reach the mouse position, starting at the player position.

I am using float coordinates (i.e. float x, y, z).

How can I do this?

sentences:
How do I achieve supersampling / anti-aliasing in pixel shaders? I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect:

But I noticed there is aliasing in my resulting image (the above image is a sample from the linked website).

What can I do to prevent this? I couldn't find any article that explains how to solve this. I read some techniques like rendering in a higher resolution and then downsizing the image, but I need to solve this in a pixel shader capacity.

sentences:
How to sync client and server at the first frame I'm making a game where an authoritative server sends information to all clients about states and positions for objects in a 3d world. The player can control his character by clicking on the screen to set a destination for the character, much like in the Diablo series.

I've read most information I can find online about interpolation, reconciliation,  and general networking architecture (Valve's for instance). I think I understand everything but one thing seems to be missing in every article I read. Let say we have an interpolation delay of 100ms, server tickrate=50ms, latency=200ms; How do I know when 100ms has past on the client? If the server sends the first update on t=0, can I assume it arrives at t=200, therefore assuming that all packets takes the same amount of time to reach the client? What if the first packet arrives a little quick, for instance at t=150. I would then be starting the client with t=150 and at t=250 it will think it has past 100ms since its connect to the server when it in fact only 50ms has past.

Hopefully the above paragraph is understandable. The summarized question would be: How do I know at what tick to start simulating the client?

EDIT: This is how I ended up doing it: The client keeps a clock (approximately) in sync with the server. The client then simulates the world at

simulationTime = syncedTime - avg(RTT)/2 - interpolationTime

The round-trip time can fluctuate so therefore I average it out over time. By only keeping the most recent values when calculating the average I hope to adapt to more permanent changes in latency. It's still to early to draw any conclusion. I'm currently simulating bad network connections, but it's looking good so far.

Anyone see any possible problems?

sentences:
Efficient way of training a chabot AI I am currently working on a chatbot game using Python 2.7.10.
I use the Chatterbot library.
This library seems to do all I need but the training data (or corpora) are very very limited.

I haven't quite decided what the game is going to be like.  I was thinking of doing something where the bot contacts you on behalf of a assassinated police inspector and asks you to help it solve the case.

But I am still at the stage where I am experimenting what can and can't be done using a chatbot.

An alternative to this game would be a simple "guess who" kind of game.

I had a look online expecting to find a lot of every day conversation chat logs especially made for training chat bots. But I could only find a few logs of quiet random conversion (mostly on programming). I thought of using plays and film scripts but that requires a lot of editing. What recommendations would you have.  I basically need strings lists in which each string is a response to the previous one. I can also train pairs of question answer.

sentences:
How handle Nifty initialization in a Slick2D state based game? I'm using Slick2D and Nifty GUI. I decided to use a state based approach for my game and since I want to use Nifty GUI, I use the classes NiftyStateBasedGame for the main and NiftyOverlayBasicGameState for the states.

As the description say, I'm suppose to initialize the GUI in the method initGameAndGUI on my states, no problem:

@Override
protected void initGameAndGUI(GameContainer gc, StateBasedGame sbg) throws SlickException {
    initNifty(gc, sbg)
}

It works great when I have only one state but if I'm doing a call to initNifty several times from different states, it will raise the following exception:

org.bushe.swing.event.EventServiceExistsException: An event service by the name NiftyEventBusalready exists.  Perhaps multiple threads tried to create a service about the same time?
at org.bushe.swing.event.EventServiceLocator.setEventService(EventServiceLocator.java:123)
at de.lessvoid.nifty.Nifty.initalizeEventBus(Nifty.java:221)
at de.lessvoid.nifty.Nifty.initialize(Nifty.java:201)
at de.lessvoid.nifty.Nifty.<init>(Nifty.java:142)
at de.lessvoid.nifty.slick2d.NiftyCarrier.initNifty(NiftyCarrier.java:94)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:332)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:299)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:280)
at de.lessvoid.nifty.slick2d.NiftyOverlayBasicGameState.initNifty(NiftyOverlayBasicGameState.java:264)

The initializeEventBus that raises the exception is called from the Nifty constructor and a new Nifty object is created within the initNifty method:

public void initNifty(
    final SlickRenderDevice renderDevice,
    final SlickSoundDevice soundDevice,
    final SlickInputSystem inputSystem,
    final TimeProvider timeProvider) {
    if (isInitialized()) {
       throw new IllegalStateException("The Nifty-GUI was already initialized. Its     illegal to do so twice.");
    }

    final InputSystem activeInputSystem;
    if (relayInputSystem == null) {
       activeInputSystem = inputSystem;
    } else {
      activeInputSystem = relayInputSystem;
      relayInputSystem.setTargetInputSystem(inputSystem);
    }

    nifty = new Nifty(renderDevice, soundDevice, activeInputSystem, timeProvider);
  }

Is this a bug in the Nifty for Slick2D implementation or am I missing something? How am I supposed to handle Nifty initialization over multiple states?

sentences:
Normals vs Normal maps I am using Assimp asset importer (http://assimp.sourceforge.net/lib_html/index.html) to parse 3d models.

So far, I've simply pulled out the normal vectors which are defined for each vertex in my meshes. Yet I have also found various tutorials on normal maps...

As I understand it for normal maps, the normal vectors are stored in each texel of a normal map, and you pull these out of the normal texture in the shader.

Why is there two ways to get the normals, which one is considered best-practice and why?

sentences: How does Unity know that you make more than one hundred thousand dollars on the Personal plan? How do they check if you make more than 100k? That is really puzzling me.

sentences:
Unity 3D: How to stop/reset 2D sprite animation after releasing key? Im following a tutorial to create animations with a 2D sprite character.
But i put in my own. Which has 8 animation positions.
For some reason when my guy walks around,then stop, the walkings animation continues to play out then resets to idles.

I need the animation to reset as soon as i release the key.

Im using Animator if you are wondering.

EDITED:
Original video with all the keys for each animations.
Youtube video

Second video with only 2 keys per animation, it was a test.
Second Video Here

Code Snipet!

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

public float speed;

private Animator _animator;
private Rigidbody2D _rigidbody2D;

// Use this for initialization
void Start () {
    _animator = GetComponent <Animator>();
    _rigidbody2D = GetComponent <Rigidbody2D>();
}

// Update is called once per frame
void Update () {
    CheckDirection();
}

void CheckDirection(){
    if (Input.GetKey (KeyCode.A))
    {
        WalkAnimation(-1,0,true);
    }
    else if (Input.GetKey (KeyCode.D))
    {
        WalkAnimation(1,0,true);
    }
    else if (Input.GetKey (KeyCode.W))
    {
        WalkAnimation(0,1,true);
    }
    else if (Input.GetKey (KeyCode.S))
    {
        WalkAnimation(0,-1,true);
    }
    else
    {
        _animator.SetBool("Walking", false);
    }
}

void FixedUpdate (){
    Move();
}

void Move(){
    float dirX = _animator.GetFloat("VelX");
    float dirY = _animator.GetFloat("VelY");
    bool walking = _animator.GetBool("Walking");

    if (walking)
    {
        _rigidbody2D.velocity = new Vector2(dirX,dirY) * speed;
    }
    else
    {
        _rigidbody2D.velocity = Vector2.zero;
    }
}

void WalkAnimation (float x, float y, bool walking){
    _animator.SetFloat("VelX", x);
    _animator.SetFloat("VelY", y);
    _animator.SetBool("Walking", walking);
}

}

sentences:
How do I set up a delay mid-function? I'm trying to set up a delay so that the UI element I'm using to darken and obscure the player's buttons doesn't disappear the second the enemy begins their turn.

Any help would be very appreciated, as I'm super-new and probably making a bit of a hash of things.

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

public class TurnController : MonoBehaviour {

static bool playerTurn;
public static GameObject ControlBlocker;

// Use this for initialization
void Start () {
    playerTurn = true;
    ControlBlocker = GameObject.Find("Control Blocker");
    UIController();
}

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

}

public static void TurnChange()
{
    if (playerTurn == true)
    {
        playerTurn = false;
        UIController();
    }
    else if(playerTurn == false)
    {
        playerTurn = true;
        UIController();
    }
}

public static void UIController()
{
    if (playerTurn == true)
    {
        print("PlayerTurn");
        //Delay here/////////////////////////////////////////
        ControlBlocker.SetActive(false);
    }
    else if (playerTurn == false)
    {
        print("EnemyTurn");
        ControlBlocker.SetActive(true);
    }
}

EDIT

So after some Google-fu I've made some changes that allow the code to compile with what looks like a working co-routine;

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

public class TurnController : MonoBehaviour {

public static TurnController instance;
static bool playerTurn = true;
public static GameObject ControlBlocker;

private void Awake()
{
    instance = this;
}

// Use this for initialization
void Start () {
    ControlBlocker = GameObject.Find("Control Blocker");
    ControlBlocker.SetActive(false);
}

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

}

public static void TurnChange()
{
    if (playerTurn == true)
    {
        playerTurn = false;
        print("TCnowFalse");
        instance.StartCoroutine(UIController());
    }
    else if(playerTurn == false)
    {
        playerTurn = true;
        print("TCnowTrue");
        UIController();
    }
}

public static IEnumerator UIController()
{
    if (playerTurn == true)
    {
        print("PlayerTurn");
        //Delay here
        yield return new WaitForSeconds(2);
        ControlBlocker.SetActive(false);
    }
    else if (playerTurn == false)
    {
        print("EnemyTurn");
        ControlBlocker.SetActive(true);
    }
}

BUT - Even with this the functionality still isn't working.

The playerTurn == true section of UIController never fires. PlayerTurn never prints to console and the ControlBlocker stays in place.

playerTurn == false works fine however, and TurnChange is working fine too as it prints both messages to the console when appropriate.

Stuck again!

sentences:
How to make unitypackage from allseen alliance's android sdk? Im making an offline multiplayer for Android device by Unity and I found only one way to do this is the allseenalliance sdk. After download its from here I found that to use it I need to create an .unitypackage file but I cant understand the tutorial they give
> Open a CMD window.
>     Add the path to Unity.exe (the Unity IDE) to your PATH, if it is not there already.
>         For example, set PATH=%PATH%;C:\Program Files\Unity\Editor
>     CD to each "unity" folder in the SDK, and run the following command in each location:
>         Unity.exe -batchmode -nographics -quit -projectPath %CD% -exportPackage Assets AllJoyn.unitypackage
>     This command creates the AllJoyn.unitypackage file.

Please give me a noob tutorial for this or the package file, thanks.
p/s:Is there another way to connect mobile device without internet in unity3d?

sentences:
Phaser Game not rendering on normal page I made a game with the Phaser game framework on a course, and now I want to add features and build upon that game.  The only problem is that I built the game with the course on webpack, which served the game on localhost:8080  I want to now stop using localhost and put the game on a normal website, but for that, I need to get it off localhost.  I think the problem is in the index.html file where I render the game.  Here is the index.html code:
<head>
 <style>
  body {
    padding: 200px;
  }
 </style>
 <script type="text/javascript
  src="https://cdnjs.cloudflare.com/ajax/libs/phaser/3.52.0/phaser.min.js"></script>

</head>
...
<script type="text/javascript" src="src/index.js"></script>

Please tell me how I can put my game on a normal website.  Thank You!

sentences:
How to make rigid body move smoothly on uneven platform? Right now I'm using Rigidbody2d for the game character along with polygon collider 2D(2d platform game).

I'm beginner hope I'm using correct components.

And transform to move character from left to right.

Character.transform.Translate(Vector2.right * speed * Time.deltaTime);

And upward(jump).

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

When the game character moves on slopes there's lot of friction and bounciness and rotation and its worse when jumping from slopes.

sentences:
Why do Pool.Default D3D volume textures take memory from my process? I am working on a Direct3D rendering application that uses a lot of texture RAM. I notice that if I allocate a Pool.Default volume texture:

   _texture = new VolumeTexture(device, size.Width, size.Height, size.Depth, 1, Usage.None, Format.L16, Pool.Default);

my process's system memory decreases by the same amount I allocate on the video card. I think this is unexpected. This texture is supposed to be video-memory only.

Effectively this means I can not use all texture RAM on high end video cards, I can not afford to lose a whole gigabyte of system RAM. We're short on adress space as it is....

Is there anybody who knows what's happening here? Are there ways to prevent this from happening?

This was seen on Windows 7 64 bit from a 32 bit process, using Directx 9c, with several different nVidia cards. The process is marked as /LARGEADRESSAWARE to make sure we get as much as adress space as possible.

You may have guessed by now that I am not writing a game.... but I assume the Direct3D experts are here to be found.... And I can imagine this issue affects games as much as it affects us...

EDIT:

This appears to happen only with Volume Textures. If I allocate 2D textures of the same size it does not happen. By default my volume textures were 32megabytes each. If I make them smaller (I tried down to 2megabytes each), There are still blocks being allocated. According to VMMap, each texture gets a 32 meg block in my process, flagged as "Read/Write/WriteCombine".

The fact that they are labeled as "WriteCombine" makes me really curious, no other block of memory is labeled like that.

sentences:
Multiplayer Network Game - Interpolation and Frame Rate Consider the following scenario:

Let's say, for sake of example and simplicity, that you have an authoritative game server that sends state to its clients every 45ms.  The clients are interpolating state with an interpolation delay of 100 ms.  Finally, the clients are rendering a new frame every 15ms.

When state is updated on the client, the client time is set from the incoming state update.  Each time a frame renders, we take the render time (client time - interpolation delay) and identify a previous and target state to interpolate from.  To calculate the interpolation amount/factor, we take the difference of the render time and previous state time and divide by the difference of the target state and previous state times:

var factor = ((renderTime - previousStateTime) / (targetStateTime - previousStateTime))

Problem:  In the example above, we are effectively displaying the same interpolated state for 3 frames before we collected the next server update and a new client (render) time is set.

The rendering is mostly smooth, but there is a dash of jaggedness to it.

Question:  Given the example above, I'd like to think that the interpolation amount/factor should increase with each frame render to smooth out the movement.  Should this be considered and, if so, what is the best way to achieve this given the information from above?

sentences:
Smooth rotation for a bone? I'm trying to make my character bone "chest" rotate smoothly when face enemy and get back to his stand. Can anyone help me with this ?

public Transform Target;
public Vector3 Offset;

Animator anim;
Transform chest;

public float rotation_speed;
public bool aim_at_traget = false;

void Start()
{
    anim = GetComponent<Animator>();
    chest = anim.GetBoneTransform(HumanBodyBones.Chest);
}

void LateUpdate()
{
    if (aim_at_traget == true) {
    // smooth rotation to face target
    chest.LookAt(Target.transform.position);
    chest.rotation = chest.rotation * Quaternion.Euler(Offset);
    }
    else {
        // get back to you stand smoothly
    }
}

sentences:
Marmalade SDK views navigation concepts I want to develop a simple multi-Activity Android game using Marmalade SDK.
I looked at the SDK samples and found that most of them are a single view (Android Activity) apps.

The Navigation model in Android is a stack-like model where views are pushed and popped.

I can't find whether Marmalade has a similar model or it uses a different approach.

would you please explain this to me and provide tutorials and samples to navigation in Marmalade if possible ?

Thanks

sentences: Sending position updates from server to clients (Unity + gRPC) So clients connect to the server and the server spawns an entity for each of them. What I'm confused about is how to send position updates from the server to the connected clients. I read about bidirectional streaming but I'm confused because that would mean clients would have to specifically request the positions every update, which is not what I want. I want the server to send positions to every connected client. Is it possible to do it with gRPC? If so, how would I go about it?

sentences:
Calculate new coords of camera after a 90 degree rotation in an isometric 2D projection I made a 2D isometric renderer. It works fine but now I want to show my scene from 4 different points of view (NE NW SE SW) but, on a 90° rotation, my camera cannot keep the center of my scene on screen.

What's working :

I calculate new projection of scene to match the new viewport (x y z in my world).
I reorganise part of my scene(chunk) to draw them in a correct order
I reorganise 'tiles' of 'chunks' to draw them in a correct order
I can keep the correct center with a 180 degrees rotation.

What's do not working :

I cannot find a correct translation to apply to my camera after a 90 degrees rotation.

What I know :

To keep the same center on a 180° rotation with my camera I have to do this :

camera.Position -= new Vector2(2 * camera.Position.X + camera.Width, 2 * camera.Position.Y + camera.Height);

Illustation of the problem :

sentences:
C++ SFML: Keypressed Event not registering half the time? I have a very simple event handeling system at the moment.

void LevelScreen::PollInput()
{
    sf::Event event;

    while (pWindow->pollEvent(event))
    {
        if (event.type == sf::Event::KeyPressed)
        {
            int x = 0;
            int y = 0;

            if (event.key.code == sf::Keyboard::Left)
            {
                x = -1;
            }
            else if (event.key.code == sf::Keyboard::Right)
            {
                x = 1;
            }
            else if (event.key.code == sf::Keyboard::Up)
            {
                y = -1;
            }
            else if (event.key.code == sf::Keyboard::Down)
            {
                y = 1;
            }

            pCursor->Move(x, y);
        }
    }
}

The system gets updated every single cycle, yet many keypresses are not even registered eventhough there is no lag. Mouse movement is always registered, but when I press, for example, Down alot it fails to register from 30% to 50% of the time. Same counts for the mouse button, if I hold it down I can see that it registers it for 6 times in a row, then stops for about 5 seconds, continues, etc.

Putting it in the main loop doesn't change anything. I cannot find any reason for this input lag.

sentences:
How to find all the possible places to go on a grid? Given the amount of steps you can take in a grid, how could I implement a way to get all the possible places a unit can go to, in a game like Advanced Wars?

I have currently got A* path finding working, but it would be nice to have an indicator of the possible places to go to. I have linked to an image to make things more clear.

I was thinking of computing the path of every single tile on the grid to the unit tile, then working it out from there, but I can imagine that will take crazy amounts of resources.

Notice how the other units 'block' the path of the selected unit. So unfortunately its not a trivial 'draw a circle with radius X'

sentences:
Straightforward guidelines for converting OpenGL to OpenGL ES? Is there a straightforward list of finite steps that I need to follow to convert an OpenGL program into an OpenGL ES that's used on the iPhone and iPad? I'd be using GLKit.

I've seen some similar API functions but I gather that triangles have to be presented differently.

sentences: How to call animation event from another GameObject I have an animation event but I want it to call a function from a script that is attached to a different GameObject that I'm not animating. Is this even possible?

sentences:
Implement continuous integration (smoke test) Moving from J2EE industry to Android development there is a question in my mind, about continuous integration to perform smoke or integration testing.

I'm building a single game, a memory card game, with junit for small logic testing of classes but cannot figure how to implement the testing for the use of canvas.

If the application is developed just with UI elements from android, it is easy to use the UI Testing environment on the SDK:
UI android automatic testing

but what for canvas?

I would try to explain the current infrastructure:

github or bitbucket as CSV
Jenkins server

  Which captures with SCM a commit on github or bitbucket, download the
  changes, compiles and executes all the junit on the application for
  fail-fast.

TestRail

  Where the testcases for QA are described

While working on J2EE industry I had, a part from previous ones:

JBehave (http://jbehave.org/)

  Which reads from testrail all the testcases linked to a Test plan and
  executes it (the test-cases should use a pattern)

ex:
Preconditions:
1. Be on login screen

Steps:
1. Fill login with *{username}*
2. Fill password with *{password}*
3. Click on button *Login*

Expected:
1.
2.
3. Message with info *Login error*

Jemmy

  As the link you can find above, it is used to test java swing
  components, looks for a common element and interacts with it.

So, from jenkins:

1. we check for changes on code
2. compile the code
3. execute junit
4. execute BDD (deploy code on a server, and execute the integration-testing with jbehave)

graphically it is shown as a pipeline:

My question is:

Is it possible to implement the part I miss, the automatic testing, on canvas application?

As the application can be run on multiple devices, each one with different screen sizes, menu positions, I don't like to use x,y coordinates on tests definitions.

Was anyone in my same concern and found a correct "best practices" solution?

Currently, our QA team, is moving from excel, yeah you read it right, from excel to test rail, so moving from manual testing for test-cases to automatic fail-fast continuous integration would help QA as Development team.

Thank you!!!

sentences:
How to upload lights when doing one pass per light Suppose I have a reasonable amount of light sources that I upload at once in my forward rendering and accumulate them in shader.

Now that I am willing to move to deferred, and so one pass per light,  I have a design doubt. Suppose my light struct is no more than 64B, I have two options:

Still upload them to GPU once and then using a uniform to get the right index for each pass.
Upload for each pass the correspondent light info.

With option 1 I have the advantage of not uploading info at each frame, but just once. On the other hand, option 2 allow to have less data on memory, with the downside of having to load about 64B per pass per frame.

Whilst I am leaning towards option 1, I am no expert and kinda new to the field. Knowing I don't think I'll have more than 100 lights, what's the option you'd choose? Any trade off/aspect I am missing?

EDIT: If there's no much difference, I already have all the code ready for option 1, so that's another factor that lead me towards it. However, to be honest, I am more than happy to refactor if it means an advantage.

Thanks

sentences:
Rotation matrix for a 3D vector I have a direction vector on which I have to apply some rotation to align it to positive z-axis.
To use Matrix.CreateRotationX(angle) of XNA, I need the angle for which I'd have to compute cos or tan inverse.

I think this is a complex task to do. Also, eventually those are also converted to sin(angle) and cos(angle) in the matrix.

Is there any inbuilt way to create rotation matrix from a 3D vector?

However, I can write the function but still asking if there is one already there.

sentences:
Night cycle object not going smootly when object instantiated Hello so I'm adding night cycle to my game it's going smoothly for object except the instantiated one

as you can see that is a different color on it.
so here the script for night cycle:
 public GameObject ca1, ca2, ca3, ca4, ca5, ca6;

 void Update()
    {
        if (_GameManager.instance.isStarted)
        {
            timer += Time.deltaTime;

            if (timer >= maxTime)
            {
                GenerateObstacle();

                if (_GameManager.instance.score >= 450)
                {
                    if (_GameManager.instance.score % 2 == 0)
                    {
                        GenerateBuwungObstacle();
                    }

                    if (_GameManager.instance.score >= 3000)
                    {
                        if (_GameManager.instance.score % 5 == 0)
                        {
                            GeneratedMeteorObs();
                        }
                    }
                }

                timer = 0;
            }

            if (_GameManager.instance.score % 200 == 0 && activeFade == null && activeFadeObjectClouds == null)
            {

                fadeToBlack = !fadeToBlack;

                Color colorCactusObs = fadeToBlack ? Color.white : Color.gray;

                activeFadeObjectCactus = StartCoroutine(ObjectCactusFadeTo(colorCactusObs));

            }
        }
    }

   // for generating the cactus
  public void GenerateObstacle()
    {
        choosedObstacle = Random.Range(0, Obstacles.Length);
        GameObject obstacle = Instantiate(Obstacles[choosedObstacle]);
    }

  IEnumerator ObjectCactusFadeTo(Color destination)
    {
        Color start1 = ca1.GetComponent<SpriteRenderer>().color;
        Color start2 = ca1.GetComponent<SpriteRenderer>().color;
        Color start3 = ca3.GetComponent<SpriteRenderer>().color;
        Color start4 = ca4.GetComponent<SpriteRenderer>().color;
        Color start5 = ca5.GetComponent<SpriteRenderer>().color;
        Color start6 = ca6.GetComponent<SpriteRenderer>().color;

        for (float t = 0; t < 1f; t += (Time.deltaTime / fadeSpeed) * 2)
        {
            ca1.GetComponent<SpriteRenderer>().color = Color.Lerp(start1, destination, t);
            ca2.GetComponent<SpriteRenderer>().color = Color.Lerp(start2, destination, t);
            ca3.GetComponent<SpriteRenderer>().color = Color.Lerp(start3, destination, t);
            ca4.GetComponent<SpriteRenderer>().color = Color.Lerp(start4, destination, t);
            ca5.GetComponent<SpriteRenderer>().color = Color.Lerp(start5, destination, t);
            ca6.GetComponent<SpriteRenderer>().color = Color.Lerp(start6, destination, t);

            yield return null;
        }

        ca1.GetComponent<SpriteRenderer>().color = destination;
        ca2.GetComponent<SpriteRenderer>().color = destination;
        ca3.GetComponent<SpriteRenderer>().color = destination;
        ca4.GetComponent<SpriteRenderer>().color = destination;
        ca5.GetComponent<SpriteRenderer>().color = destination;
        ca6.GetComponent<SpriteRenderer>().color = destination;

        activeFadeObjectCactus = null;
    }

I already try with for loop in the object cactus fade but still not smooth

sentences:
HTML Canvas drawing - Firefox error I am getting the following error ONLY when running my game in Firefox (3.6)

  Component returned failure code:
  0x80040111 (NS_ERROR_NOT_AVAILABLE)
  [nsIDOMCanvasRenderingContext2D.drawImage]

The issue does not occur in the other major browsers, and my game runs completely fine after I click 'OK.'

Here are a few snippets of code where I have localized the issue to.  Has anybody seen this issue before?  According to Google it has something to do with drawing the image before it is loaded, but from my understanding I am loading it properly before using it!.

player class

var player = new (function(){
  var that = this;
  that.image = new Image();
  that.image.src = "res/enemy1_sprites.png";
  that.width = 16;
  that.height = 16;
  that.frames = 2;
  that.actualFrame = 0;
  that.spriteXoffset = 0;
  that.spriteYoffset = 0;
  that.moved = false;
  that.boundary = false;
  that.num_balls = 5;
  that.rootX = 350;
  that.rootY = 250;
  that.ballX = [that.rootX,0,0,0,0];
  that.ballY = [that.rootY,that.rootY,that.rootY,that.rootY,that.rootY];

  that.directions = {"up":0, "right":1, "down":2, "left":3};
  that.dirs  = [that.directions.right,that.directions.right,that.directions.right,that.directions.right,that.directions.right];

  for (i = 1; i < that.num_balls; i++)
    that.ballX[i] = that.rootX - (i * that.width);

...
...

that.draw = function(){
    try {
      for (var i = that.num_balls-1; i >= 0; i--)
      {
        // update animation
        switch (that.dirs[i])
        {
          case that.directions.left:
            that.moveLeft();
          break;
          case that.directions.right:
            that.moveRight();
          break;
          case that.directions.up:
            that.moveUp();
          break;
          case that.directions.down:
            that.moveDown();
          break;
        }
        ctx.drawImage(that.image, that.spriteXoffset, that.spriteYoffset, that.width, that.height, that.ballX[i], that.ballY[i], that.width, that.height);
      }
    }
    catch (e) {
      alert(e.message);
    };

    if (that.moved)
    {
      if (that.spriteYoffset > 0)
        that.spriteYoffset = 0;
      else
        that.spriteYoffset += 16;
      that.moved = false;
    }
  }
})();

game loop

 var GameLoop = function(){
    ..
    ..
     player.move();
     player.draw();
    ..
    ..
      if (state)
        gLoop = setTimeout(GameLoop, GAME_SPEED);
    }

sentences:
What do you do when you are at an impasse in the design phase? I own a small web dev shop, and in our down time, I plan on having my guys work on a game (I will be paying them anyway, right?). A few buddies and I started talking about this game, and have been going through the motions of talking/designing it out.

Only problem we are at an impasse, and can't seem to get passed it. The vote is at 50/50%. Compromising hasn't worked.

I have though about just making an executive decision since I am funding the development/design of the game, but I don't want to lose my friends support for the game, and their other opinions.

I don't know what to do.

sentences:
How to create simple acceleration in a 2D sprite? So here's what I thought might work but half the time I press the 'Right' key, it results in a crash and the rest of the time seems to produce no acceleration at all.

if (KeyboardState.IsKeyDown(Keys.Right))

            while (motion.X < 1)
                motion.X += 0.001f + motion.X;

I want to know why exactly it won't work, and any possible alternate algorithms.

sentences:
Box2D simulation running slower on lower FPS(even when the desired FPS is lower than the actual) I´m playing around and trying to make myself an easy platformer using the Box2D physics, before that I was not using it and was using my own physics implementation(just simple movements with timestep). My gameloop architecture now works like this:

while (_isRunning) {

    //Processing input events
    processInput();

    update();

    //Rendering stuff
    startFPSCap();

    render();

    delayFPS();
}

The update function is consisting of updating a game world (normal update function without deltatime) - inside this I´m calling a Box2D step function, with desired timestep at 1/60(wanted to have simulation at 60 fps) and then I call my own timestep function to update entity components(so they can be updated also with timestep not just the physics).

void update()
{
    _physics->Step(1.0f / 60.0f, 6, 2);

    updateEntitiesWithOwnTimestep();
}

However when I tried to run it on slower FPS, the simulation slow downs (even when I capped the FPS to like 200 at the start, so running it at 100 fps is like a slowmotion). I thought that when I set the desired physics simulation for 60 fps it will be no problem when reducing the FPS, but it seems like I´m missing something. Or is there something wrong? I mean, maybe the fact I´m running also my own timestep function.. Thanks for help.

Edit1 - according to Timos answer

Do you mean I should put the delta value I pass to my update function during each step in my own timestep? Like this:

void TimestepManager::update() {

int i = 0;

while ((_totalDeltaTime>0.0f) && (i<MAX_PHYSICS_STEPS)) {

    _deltaTime = std::min(_totalDeltaTime, MAX_DELTA_TIME);

    //This is std::function - i can define my own behavior via this
    _f.exec(_deltaTime);

    _physics.Step(_deltaTime, 6, 2);

    _totalDeltaTime -= _deltaTime;

    i++;
}

}

Or should I pass the total deltaTime? Because I thought that I should keep this unchanged because I don´t want to tie the simulation with the FPS.

sentences:
Tiled tilemapper - isometric I'm attempting to move from oblique mapping (45 degree angles) to isometric (30 degree angles) in Tiled.

I made a test tile in Photoshop:

Made an isometric map:

But my tile appears completely distorted, and the 'isometric' map just appears as a top-down grid rotated 45 degrees:

How do I create a proper isometric scene using tiled?

Hi, in your example (here), your Tiled grid is angled down. As you can see, mine appears Top down. How do I configure this?

sentences:
Unity: How can I control a Shadergraph effect on multiple enemies with the same prefab? So I made a simple White Flash -> Dissolve effect with shader graph 2D, it's my 1st time using shaders.
I'm controlling the effect using a float inside the shader, with:

Material.SetFloat("FLOAT_NAME", 0-1f);

And I'm wandering how can a control only a single instance of my Shader without affecting all my enemies.

Example:
I have 20 enemies, all from the same prefab with the same material.
I want to be able to make 1 enemy dissolve whenever I shoot at him.

sentences:
How can I add velocity to the standard CharacterController? I have FPS controller from standard asset.  After a long trial and error I figured that CharacterController doesn't respond to AddForce.

So, I have this trigger in the scene which I would like to throw FPS controller upwards.

Now, I know that I need to replace AddForce with adding velocity to the player. How to do that?

I need to use FPS controller component for velocity and add Vector3.up.
So, every game object other which will enter the trigger, will get upwards velocity.

void OnTriggerEnter(Collider other)
{
    other.attachedRigidbody.AddForce(Vector3.up * 100, ForceMode.Impulse);
}

sentences:
SDL blitting multiple surfaces at once I'm trying to write a platforming game where the sprites for the level backgrounds are broken up into 512x512 chunks. I keep 3 chunks in memory at a time and I'm trying to write code to blit all three to the screen. Here is the current code I have:

SDL_Rect where;
where.y = -game->camera->y;

where.x = -game->camera->x - MAP_WIDTH;
SDL_BlitSurface(left_chunk, NULL, screen, &where);

where.x = -game->camera->x;
SDL_BlitSurface(center_chunk, NULL, screen, &where);

where.x = -game->camera->x + MAP_WIDTH;
SDL_BlitSurface(right_chunk, NULL, screen, &where);

The issue I'm running into is that whichever chunk gets blitted first is the only one that shows up. The rest fail to appear onscreen. I think the issue might have something to do with alpha transparency, but even if the chunks don't overlap at all they still fail to blit. In other parts of the code I'm blitting multiple things to the screen at once, such as characters and backgrounds, and they all show up correctly. This particular segment of code is the only area I'm encountering this problem.

If I comment out the line that blits left_chunk, it changes to this:

sentences:
Why are Visual Studio and VSCode not giving me a dropdown list of methods and options etc? I am using VSCode but I have also tried Visual Studio 2019 to write code for Unity, but when I'm writing the lines I don't get dropdown menus with for example the methods this class holds. Or objects. Or it's properties. etc.: basically, IntelliSense is not working.

Is there a setting that I need to enable in order to get those? Since I've seen everyone who use VSCode and visual studio get these dropdown menus.

sentences:
How to calculate the exit speed of ball bouncing off a solid surface Hey all, I am working on a simple game to include some rigid body dynamics, involving placing (moving & rotating) some springs to bounce a falling ball into a target area.

My problem is correctly calculating the exit velocity of the ball after it hits the spring surface (Vexit, Ve for short)

Assume the following:
Initial ball velocity vector at point of impact is known (Vimpact, Vi for short)
Surface orientation vector is known (Vsurface, Vs for short)
Bounce coefficient (Bc for short) of ball after hitting surface is constant (for example |Ve| = 1.2 x |Vi|)

My algorithm is as follows:
-get surface normal vector, Vn
-get Vi inverse (reversing both x,y components to get reversed direction vector)
-get normalised Vi inverse, call this Vin
-get angle between Vin & Vn, by arccos(Vin . Vn). Let this be angle A
-rotate Vin by (2A) degrees to get normalised exit vector Ven
-Ve = Ven . Bc

Now as far as I can tell, this would work well. However, I am unable to know on whether to perform the rotation step in clock-wise, or anti-clock-wise motion; since the angle i get is always positive

What do you all think of this algorithm anyways?
Can anyone help me out on how to figure out the rotation direction?
Anyone have a better (faster,simpler,more accurate, etc) algorithm to use?

Thanks a lot!

sentences: cocos2dx- set draw() method interval time What is the default interval of draw method call in cocos2dx engine? Can we set it manually? I couldn't find much information about it online. After researching a bit I found that update() method interval step could be adjusted by setting setAnimationInterval. Can I set a specific interval for draw method too?

sentences:
Looping world for a top down space shooter? I am trying to understand how to make a seamless looping world for my top down space shooter.
First thing I tried was using multiple cameras, and teleporting the player when he reaches the edge, but it is not working well, and I don't like that I have to use 4 cameras.
I wanted to test making the objects in the world teleport around the player, but I will have problems with the fact that each object is a different size, and teleporting them around will for sure create problems with moving objects. (Big obstacles could be teleported away and not collide with, for example, bullets until the bullet gets teleported too but inside the big obstacle)
Are there other ways to accomplish this?
Screen of the game (everything is still a placeholder)
https://i.stack.imgur.com/8FWCE.png

sentences:
How to implement "identify item" feature in RPG In many games there is an approach that you can't use item that hasn't been identified. And usualy you can't identify it by just using it. While this approach simplifies a lot of things it just doesn't feel right to me. It doesn't make sense that I can't equip an armor or sword because I don't know if it has any magical features.

I was thinking about some kind of "identification by use" system but I can't figure out a natural way to do it. What if I drink a potion that boosts my "Speech" skill for a period of time? Should my character instantaneously know that its skill have increased? Should it know the exact value? Or should I increase the skill behind the scenes but leave the displayed value intact and just give some subtle hint ("You suddenly (...)")?

What about weapons and armors? It wouldn't make sense to know anything about it just by equipping it. One approach would be that attacking a target could update weapon's min and max damage basing on damage dealt but then it greatly depends on target's defense and resistances (I'm not sure if that's a bad thing though).

Of course there are conventional ways like identification scrolls and I do have them but I was hoping for some alternative (not a replacement though, you probably can't know everything about every object only by using it).

Has anyone ever thought about it and can share some insight?

sentences:
What is GPU instancing and what are its differences in comparison to standard instancing? I have been reading a lot of debate on a new feature that will be in Unity 5.4: GPU instancing. I understand the importance of instancing in general, both in terms of saving memory and draw calls.

However, even after doing some reading, I still couldn't understand what exactly are the differences between GPU instancing and non-GPU instancing - and, more importantly, where the alleged GPU advantages in terms of performance come from.

Thanks for your knowledge and for any references.

sentences:
How to keep an object in a certain part of the camera view? I have a 3d camera that is viewing a character that is moving. As the character is moving i want the camera to adjust itself so as to keep the character in the left third of the camera view.

I understand how to move the character in world space but how do i check in what part of the camera view it is in? And then know how to adjust the camera to compensate?

EDIT:  I am looking for the maths behind this. I understand that if i have the character world space postiton, i can convert that to screen coordinates by applying the view and projection matrices. I then get the camera view in screen coordinates. I am able then to create some 2d bounding box that will move the camera if the character enters it.

sentences:
Unity3d: Box collider attached to animated FBX models through scripts at run-time have wrong dimension I have several scripts attached to static and non static models of my scene.
All models are instantiated at run-time (and must be instantiated at run-time because I'm procedural building the scene).

I'd like to add a BoxCollider or SphereCollider to my FBX models at runtime.

With non animated models it works simply requiring BoxCollider component from the script attached to my GameObject. BoxCollider is created of the right dimension.
Something like:

[RequireComponent(typeof(BoxCollider))]
public class AScript: MonoBehavior
{

}

If I do the same thing with animated models, BoxCollider are created of the wrong dimension.
For example if attach the script above to penelopeFBX model of the standard asset, BoxCollider is created smaller than the mesh itself.

How can I solve this?

sentences:
How can shears/reflections/enlargements be represented by 4x4 matrices? I understand that 4x4 matrices can represent transformations on a 3d point (represented as x, y, z, w)

Eg, a translation is

[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[x y z 1]

where x, y and z are the amount to move the point along each axis.

I know how to represent translations, scaling and rotations but how are other transformations such as shears (with any invariant plane and shear factor), reflections (in any plane) and enlargements (with any center and any scale factor) represented?

The end goal is to have c++ functions to create a translation matrix.
Eg:

Matrix4x4.generateReflection(Vector3d planeNormal);
Matrix4x4.generateEnlargment(float centerX, float centerY,
                             float centerZ, float scaleFactor);

These would return an instance of a Matrix4x4 class with the elements set such that multiplying it by a point returns the sheared/reflected/enlarged point.

sentences: Slick2D drawString with coordinates from bottom-left corner For OpenGL text drawing I use Slick2D library. Default Slick2D 0:0 coordinates are at upper-left corner. But in my project I use bottom-left corner for 0:0. Is it real to configure Slick2D with bottom-left corner as starting point?

sentences:
Best pathfinding for a 2D world made by CPU Perlin Noise, with random start- and destinationpoints? I have a world made by Perlin Noise. It's created on the CPU for consistency between several devices (yes, I know it takes time - I have my techniques that make it fast enough).

Now, in my game you play as a fighter-ship-thingy-blob or whatever it's going to be. What matters is that this "thing" that you play as, is placed in the middle of the screen, and moves along with the camera.

The white stuff in my world are walls. The black stuff is freely movable.

Now, as the player moves around he will constantly see "monsters" spawning around him in a circle (a circle that's larger than the screen though). These monsters move inwards and try to collide with the player.

This is the part that's tricky. I want these monsters to constantly spawn, moving towards the player, but avoid walls entirely.

I've added a screenshot below that kind of makes it easier to understand (excuse me for my bad drawing - I was using Paint for this).

In the image above, the following rules apply.

The red dot in the middle is the player itself.
The light-green rectangle is the boundaries of the screen (in other words, what the player sees). These boundaries move with the player.
The blue circle is the spawning circle. At the circumference of this circle, monsters will spawn constantly. This spawncircle moves with the player and the boundaries of the screen.
Each monster spawned (shown as yellow triangles) wants to collide with the player.
The pink lines shows the path that I want the monsters to move along (or something similar). What matters is that they reach the player without colliding with the walls.

The map itself (the one that is Perlin Noise generated on the CPU) is saved in memory as two-dimensional bit-arrays. A 1 means a wall, and a 0 means an open walkable space. The current tile size is pretty small. I could easily make it a lot larger for increased performance.

I've done some path algorithms before such as A*. I don't think that's entirely optimal here though.

sentences:
How to properly differentiate single-clicks and double-click in Unity3D using C#? What I am trying to understand and learn here is a very basic thing: what is the most general and most polished way to properly differentiate single-clicks and double-clicks for the 3 main mouse buttons in Unity, using C#?

My emphasis on the word properly is not for nothing. Although I was surprised that this seems to have never been asked in this website before, of course I have searched and found numerous similar questions on Unity's forums and Unity's own question-answer pages. However, as it is often the case with answers posted in these resources, they all seemed to be either plain wrong or at least a bit too amateurish.

Let me explain. Proposed solutions always had either of the two approaches and their corresponding flaws:

every time a click happens, calculate time delta since last click and if it was smaller than a given threshold, a double click would be detected. However, this solution results in that a quick single click is detected before the double-click is detected, which is undesirable in most situations because then it activates both single and double click actions.

Rough example:

float dclick_threshold = 0.25f;
double timerdclick = 0;

if (Input.GetMouseButtonDown(0)
{
   if (Time.time - timerdclick) > dclick_threshold)
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
   } else {
       Debug.Log("double click");
       //call the DoubleClick() function, not shown
   }
   timerdclick = Time.time;
}

set a wait-for delay for the single-click to be activated, which means, at every click, only activate single click actions if the time delay since last click is above a given threshold. However, this gives sluggish results, since a waiting before it is possible to notice the waiting before single-clicks are detected. Worse than that, this kind of solution suffers from discrepancies across machines, since it does not take into account how slow or how fast is the user's double-click speed setting at the OS level.

Rough example:

   float one_click = false;
   float dclick_threshold = 0.25f;
   double timerdclick = 0;

   if (one_click && ((Time.time - timerdclick) > dclick_threshold))
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
       one_click = false;
   }

   if (Input.GetMouseButtonDown(0))
   {

       if (!one_click)
       {
           dclick = -1;
           timerdclick = Time.time;
           one_click = true;
       }

       else if (one_click && ((Time.time - timerdclick) < dclick_threshold))
       {
           Debug.Log("double click");
           //call the DoubleClick() function, not shown
           one_click = false;
       }

   }

Therefore, my questions becomes the following. Is there a more polished and reliable way of detecting double clicks in Unity using C#, other than these solutions, and one that handles the problems aforementioned?

sentences:
How should I manage persistent score in Game Center leaderboards? Let's say that I'm developing an iOS RPG where the player gains 1 point per monster kill.

The amount of monsters killed is persistent data: it is an endless adventure, and the score keeps on growing. It isn't a "session score" like Fruit Ninja, but rather a "reputation score".

There are Game Center leaderboards for that score. Keep killing monsters, your score goes up, and the leaderboards are updated.

My problem is that, technically, you can log out and log in using a different Game Center account, kill one monster, and the leaderboards will be updated for the new GC account.

Supposing that this score is a big deal, this could be considered as cheating, because if you have a score of 2000, any of your friends who have never played the game can simply log into your iPhone, play the game, and the system will update the score for their accounts, essentially giving them 2000 points in the leaderboards for doing nothing.

I have considered linking one GC account to a specific save game. It won't update your score unless you're using the linked GC account. But what if the player actually needs to change their GC account? Technically they would be forced to start a new game and link their account to that profile.

How should I prevent this kind of cheat? Essentially, I don't want someone to distribute a high schore to multiple GC accounts, given the fact that the game updates the score constantly since it isn't a "session score".

I do realize that it isn't quite a big deal. But I'm curious about how to avoid this.

sentences:
Draw 3D ellipse in monogame/xna I am programming a 3d solar system (simulator).
To describe the path of a planet I wanted to add 3D rectangles.. and draw them.
But to no surprise it decreased the frame rate extremely.
Also it does not look nice:

Do You know how to handle this problem?
Is there another way to solve this?
Didn't found anything on 3D HLSL Circle Plotting.

sentences:
How to implement auto-aiming / auto-targeting We all know how auto-aiming or auto-targeting works in games.

Now, I need to find how to implement it in my game.

In fact I should implement it in UDK and I would be glad if anyone gave me more specific explanation for UDK. But conceptual explanation is also enjoyable and I'll implement it myself in my way.

sentences:
Client-side physics simulation I am trying to create a very simple client-server based physics game, using box2d library. A simple football game.
Obviously, the server runs only the box2d world.
My question is:
is it correct to state that the client should run not only the needed rendered simulation but another box2d world as well?

I ask this because I know that the client should receive state information of the elements that have a changing state. And this information is received in packets every few ticks. And between every packet received, there's a time gap where I need to run the world like "nobody did nothing", and then correct the world state if somebody did something after I received the next packet.
That is why I need to run the box2d world in the client as well, but I feel it's kinda awkward and assymetrical.

Is this right? Is box2d prepared for this?

sentences:
Positioning a sprite in XNA: Use ClientBounds or BackBuffer? I'm reading a book called "Learning XNA 4.0" written by Aaron Reed. Throughout most of the chapters, whenever he calculates the position of a sprite to use in his call to SpriteBatch.Draw, he uses Window.ClientBounds.Width and Window.ClientBounds.Height. But then all of a sudden, on page 108, he uses PresentationParameters.BackBufferWidth and PresentationParameters.BackBufferHeight instead.

I think I understand what the Back Buffer and the Client Bounds are and the difference between those two (or perhaps not?). But I'm mighty confused about when I should use one or the other when it comes to positioning sprites. The author uses for the most part Client Bounds both for checking whenever a moving sprite is of the screen and to find a spawn point for new sprites. However, he seems to make two exceptions from this pattern in his book. The first time is when he wants some animated sprites to "move in" and cross the screen from one side to another (page 108 as mentioned). The second and last time is when he positions a texture to work as a button in the lower right corner of a Windows Phone 7 screen (page 379).

Anyone got an idea?

I shall provide some context if it is of any help. Here's how he usually calls SpriteBatch.Draw (code example from where he positions a sprite in the middle of the screen [page 35]):

spriteBatch.Draw(texture,
   new Vector2(
   (Window.ClientBounds.Width / 2) - (texture.Width / 2),
   (Window.ClientBounds.Height / 2) - (texture.Height / 2)),
   null,
   Color.White,
   0,
   Vector2.Zero,
   1,
   SpriteEffects.None,
   0);

And here is the first case of four possible in a switch statement that will set the position of soon to be spawned moving sprites, this position will later be used in the SpriteBatch.Draw call (page 108):

// Randomly choose which side of the screen to place enemy,
// then randomly create a position along that side of the screen
// and randomly choose a speed for the enemy
switch (((Game1)Game).rnd.Next(4))
{
   case 0: // LEFT to RIGHT
      position = new Vector2(
         -frameSize.X, ((Game1)Game).rnd.Next(0,
         Game.GraphicsDevice.PresentationParameters.BackBufferHeight
         - frameSize.Y));

      speed = new Vector2(((Game1)Game).rnd.Next(
         enemyMinSpeed,
         enemyMaxSpeed), 0);
   break;

sentences: Getting the tile over wich the mouse cursor is Im making a tilebased game, I have the rendering, the main engine, everything setup nicely (btw Im using LWJGL and Slick). Now this is more of a math question. How do I get the tile the mouse is on, so that I can draw a rectangle around that tile, so that I can later do stuff with that tile (e.g. if its stone Ill break it if I click...) I draw the map at an offset so the player is always in the middle of the screen, the upper left corner coordinates Ive called xot and yot, the offsets xOff and yOff, and yea. If anyone knows what math I need to use to get the propper tile x and y.

sentences:
In MonoGame, how can I disable font anti-aliasing? I am building a game with a "low resolution" aesthetic, so I would like to disable the default font anti-aliasing. The text is drawn using the built-in SpriteFont and SpriteBatch classes.

Here is what it currently looks like:

Here is what I would like it to look like:

(Please ignore the particles)

sentences:
Balancing a game about gladiatorial robot combat Suppose a player can construct a robot built from various parts and each part costs money. How would you balance the cost of a weapon against its capabilities? What about balancing weapons against other parts?

The base case seems pretty easy: imagine the player can only buy weapons and everything else on the robot is the same. A machine gun that fires 1 bullet per second costs $100. A super machine gun that fires twice as fast could cost twice as much. But what about an ultra machine gun that has four times the range?

Now imagine the player can add other capabilities to the robot like better speed or armor. How do you relate the cost of a machine gun against the ability to move very quickly, or to be stealthed against radar?

I understand that there's a later stage of experimentation where costs and capabilities are adjusted, but where do you start from?

sentences: How can I promote my game? I am a beginning indie developer, and I want to get the word out about my game. What sites can I go to to ask about reviews of my game, and where might I be able to talk about and get feedback on my game from players?

sentences:
SDL Mixer Strange Error Message I have a Visual Studio C++ project. I've just started out with SDL, and I've already rendered images, text, and now I'm trying to play audio. This will be done with the SDL_Mixer extension library.

However, I'm having the following issue. When I run my code with the SDL_Mixer library included, I get the following popup error message:

The procedure entry point SDL_AudioStreamFlush could not be located in the dynamic link library...

What the heck does this mean? Did I do something wrong with the installation? I got SDL mixer from here:
https://www.libsdl.org/projects/SDL_mixer/

Any help would be greatly appreciated!

sentences:
Creating multiple levels in Unity without duplicating scripts I'm trying to create a falling word typing game like z-type.

I have used the code provided here

I want to create multiple levels in the game, and it seems like I need to make some changes in the code for each level.

For example, in the word display file, I want the active word to be changed to red for level 1 and blue for level 2.

So I created a copy of my level 1 scene, created a duplicate WordDisplay script file, changed the code for active word to blue....

public class WordDisplay : MonoBehaviour {
    public Text text;
    public float fallSpeed = 1f;

    public void SetWord (string word)
    {
        text.text = word;
    }

    public void RemoveLetter ()
    {
        text.text = text.text.Remove(0, 1);
        text.color = Color.red;
    }
    //...

Here's the duplicate script I made:

public class WordDisplay1 : MonoBehaviour {
    public Text text;
    public float fallSpeed = 1f;

    public void SetWord (string word)
    {
        text.text = word;
    }

    public void RemoveLetter ()
    {
        text.text = text.text.Remove(0, 1);
        text.color = Color.blue;
    }
    //...

Then I made a copy of the WordSpawner as well because I was getting an error: I had to change the method's return type to to WordDisplay1 and then got one more error which was in the Word file, leading to more changes...

public class WordSpawner : MonoBehaviour {
    public GameObject wordPrefab;
    public Transform wordCanvas;

    public WordDisplay SpawnWord()
    {
        //...

public class WordSpawner1 : MonoBehaviour {
    public GameObject wordPrefab;
    public Transform wordCanvas;

    public WordDisplay1 SpawnWord1()
    {
        //...

Then I created a duplicate of the word prefab and selected the appropriate word spawner file...

All of this seems like too many changes for a simple colour.

Is there a better way to have multiple levels without having to create a duplicate of all these files and the word prefab?

sentences:
Should enemies still attack if they cannot see the player? This may seem like a silly question, but let me explain this further.

Consider a common stealth situation where the player is hidden from the enemy AI. The AI has vision and hearing and if they either see or hear the player they will move towards the player's last known position. However if the player is behind cover (therefore the enemy cannot see them) and they attack with a silent weapon (therefore the enemy cannot hear them either), how should the enemy react?

Realistically, the enemy should have an idea of the direction from which the attack struck them and therefore start moving in that direction. But I am wondering if this then would be detrimental to taking a stealth as oppose to offensive approach. If the enemy turns around when hit irrespective of whether they were hit with a loud or silent weapon, there is little benefit to using a silent weapon, since the loud ones will have more power anyway. On the other hand, if the enemy simply stands their while being hit several times by a silent pistol, it may make the AI seem a little stupid.

I suppose it comes down to balancing between rewarding stealth gameplay in a stealth game, but not making the AI seem silly at the same time. What should I do to balance this?

sentences:
Determine the cut sections of a polygonal mesh I have a polygonal mesh, defined by vertices $V$, edges $E$ and face $F$. One can view this as a real life 3D terrain.

I want to obtain cut sections of this terrain, defined by vertical cut planes. What are the algorithms I can use to determine the cut sections of the terrain in an efficient manner? The cut section here is just a polyline that are the intersection lines between the cut section vertical plan and the polygonal mesh.

Edit:  Since my elevation map is a mesh, this means that I know every information associated to a vertex, face and edge, e.g, which faces are connected to which edge.Is it possible to leverage this information in order to speed up the cut section further?

sentences:
How to dynamically construct a reference to a game object by name I have game objects tagged MenuOption0, MenuOption1, MenuOption2, etc. I want to keep a currentIndex var, which gets incremented each time the user swipes on the controller. That swipe should increment the currentIndex var, and switch the reference to a new game object, whose text color will be changed.

This is what I'm trying as a test:

GameObject testText = GameObject.Find("MenuOption" + 4);
TextMeshProUGUI thisTextMesh = testText.GetComponent<TextMeshProUGUI>();
thisTextMesh.color = colorWhite;

How do I dynamically construct a reference to MenuOption1,2,3,4,etc? Or is there a better way to handle this without writing a big long conditional?

sentences:
NullReferenceException Error For Respawning I am making an infinite runner game, and I am having issues with killing and respawning the player. I have a coroutine setup on the GameMaster objec which is the respawn and on the player I have a method that calls that coroutine. But when ever the player hits an enemy I get a Null Reference Exception and I am not sure why this is happining.

Here is the entire error

NullReferenceException: Object reference not set to an instance of an object
Player.OnCollisionEnter2D (UnityEngine.Collision2D col) (at Assets/Script/Player.cs:32)

Here is the line that when I double click on the error it goes to. This line is on the player.

StartCoroutine(GetComponent<GameMaster>().RespawnPlayer());

This is the method that the above line is in. This method is on the player.

void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "Enemy")
    {
        Debug.Log("HIT");
        Destroy(col.gameObject);
        StartCoroutine(GetComponent<GameMaster>().RespawnPlayer());
    }
}

Here is the coroutine that the above method is trying to call. This method is on the GameMaster GameObject and this object never gets destoryed or setActive false.

public IEnumerator RespawnPlayer()
{
    player.GetComponent<SpriteRenderer>().enabled = false;
    player.GetComponent<BoxCollider2D>().enabled = false;
    player.GetComponent<movemnt>().enabled = false;
    yield return new WaitForSeconds(respawnDelay);
    adMenu.SetActive(true);
}

If anybody can give any suggestions that would be great!

sentences:
Mathematics help. Preliminary grid checking assistance. (Supercover Z) Problem outline: A ray passes through a gridcell. The gridcell's max z's must be compared to the ray segment's min z. This is the preliminary check, so it must be quick.
2 values must be obtained, the 2 points on the ray segment which are directly outside of the grid.
To determine the z values, the distance of the ray from these 2 points must be obtained.
The red shows the points (and distance) of the ray of z values that must be checked as max and min.

The sloppy solution
Instead of getting the points directly touching, calculate the hypotenuse and offset it doing various calculations. I tried this way and there are a lot of operations to be done. I am not sure if this is the best way.
(cant upload more than 3 pics)

The sloppiest (and possibly best) solution
The best sloppy solution would be to create a line offset by the hypotenuse, and have it congruent to the main line then use line_line_collision to determine the distance for point 1 then subtract that distance by hypotenuse*2 for point 2.

The streamlined solution
The best way would have the z's directly retrieved as part of the actual supercover algorithm.
Unfortunately retrieving the n values or error values in tandem with n values couldn't actually yield me the intersection points of the line and grid. My brain is utterly fried at the moment.
My code is here, possibly someone can find an inherent method to retrieve the intersection points of the line and grid.

iX=0 iY=0 s=16 res=8
repeat (res*res)
{
draw_rectangle(iX*s,iY*s,(iX+1)*s,(iY+1)*s,1)
iX+=1;
if iX>res-1
    {iY+=1; iX=0}
}
if mouse_check_button(mb_left) direction+=5

xfrom=mouse_x/s yfrom=mouse_y/s l=300

vecx=lengthdir_x(l,direction)/s vecy=lengthdir_y(l,direction)/s
direction=point_direction(0,0,vecx,vecy)
xto=xfrom+vecx yto=yfrom+vecy

draw_line(xfrom*s,yfrom*s,xto*s,yto*s)
x0=xfrom y0=yfrom x1=xto y1=yto it=0

{
    dx = abs(x1 - x0);
    dy = abs(y1 - y0);

    x = floor(x0);
    y = floor(y0);

    n = 1;
    var x_inc, y_inc;
    error=0;

    if (dx == 0)
    {
        x_inc = 0;
        error = 1000000;
    }
    else if (x1 > x0)
    {
        x_inc = 1
        n += (floor(x1)) - x;
        error = (floor(x0) + 1 - x0) * dy;
    }
    else
    {
        x_inc = -1
        n += x - (floor(x1));
        error = (x0 - floor(x0)) * dy;
    }

    if (dy == 0)
    {
        y_inc = 0;
        error -= 1000000;
    }
    else if (y1 > y0)
    {
        y_inc = 1
        n += (floor(y1)) - y;
        error -= (floor(y0) + 1 - y0) * dx;
    }
    else
    {
        y_inc = -1
        n += y - (floor(y1));
        error -= (y0 - floor(y0)) * dx;
    }
mn=n
    for (n=n; n > 0; n-=1)
    {

   draw_set_color(merge_color(c_red,c_white,it))
   draw_rectangle(x*s, y*s,x*s+s,y*s+s,1)
        it+=1
        draw_set_color(c_green)
        draw_circle((xfrom+lengthdir_x(it+.5,direction))*s,(yfrom+lengthdir_y(it+.5,direction))*s,2,0)draw_set_color(c_red)
        draw_circle((xfrom+lengthdir_x(it-.5,direction))*s,(yfrom+lengthdir_y(it-.5,direction))*s,2,0)
draw_set_color(c_black)
        if (error > 0)
        {
            y += y_inc;
            error -= dx;
        }
        else
        {
            x += x_inc;
            error += dy;
        }
    }
}

There are some other stuff I would like to know...such as 3d triangle/line collisions, but I don't want to boggle the thread down with too much information at the moment...

sentences:
libgdx Camera and World Size Question I'm new to libgdx and especially to using OrthographicCameras. I'm trying to understand how useful they are.

The question is, suppose I have a game map 500 units wide. I have an OrtographicCamera vith a viewport of 50x50. Now If I use SpriteBatch to draw texture of my game map as 500 units (I set projection matrix to cameras combined matrix) and move the camera around as the character moves, is this a right practice to do? If that map is 20000 pixels wide (an entire level for a platformer for example), is this really the way to go? Or should I make my camera and render logic myself (render only part of the map according to current coordinates of the character)? If I need to do this myself, what's moving the camera useful for?

sentences:
Tween - keeping a constant velocity at different distances I am using a tweening library to move my units around. The problem is that the speed varies depending on the distance that the unit has to move because of the  tweening:

var time = 1000;
var tween = new TWEEN.Tween({ x: startX, y: startY })
    .to({ x: endX, y: endY }, time)
    .start();

^No matter the x and y values it will always take the same amount of time.

I tried fixing this by dividing the distance by the speed:

// distance = speed * time
// time = distance / speed
var x = endX - startX;
var y = endY - startY;
var distance = Math.sqrt(x * x + y * y);

var time = distance / speed * dt;
var tween = new TWEEN.Tween({ x: startX, y: startY })
    .to({ x: endX, y: endY }, time)
    .start();

However it still doesn't move at the same speed! Grr!

I made a snippet that shows a square endlessly moving in a rectangle, when done correctly ( which this isnt... ) it should move at the same velocity no matter the distance.

var rect = document.getElementById("rect");

var pos = [ [0, 0], [200, 0], [200, 50], [0, 50] ];
var i = 0;
var time = 1000;
var speed = 10 * 1000; // 10px per second

var tweenStart = { x: 0, y: 0 };
var tweenEnd = { x: pos[i][0], y: pos[i][1] };

var tween = new TWEEN.Tween(tweenStart)
    .to(tweenEnd, time)
    .onUpdate(function () {
        rect.style.top = this.y + "px";
        rect.style.left = this.x + "px";
    })
    .onComplete(function () {
        tweenStart.x = pos[i][0];
        tweenStart.y = pos[i][1];
        i += 1;
        if (i >= pos.length) i = 0;
        tweenEnd.x = pos[i][0];
        tweenEnd.y = pos[i][1];
        // time = distance / speed
        var x = tweenEnd.x - tweenStart.x;
        var y = tweenEnd.y - tweenEnd.y;
        var distance = Math.sqrt(x * x + y * y);
        time = distance / speed * dt;
        tween.start();
});

setTimeout(initiate, 0);

var now, then, dt;

function tick() {

    now = perfNow();
    dt = now - then;
    then = now;

    TWEEN.update();

    requestAnimationFrame(tick);

};

var perfNow = (self.performance && self.performance.now) ? self.performance.now.bind(performance) : Date.now;

function initiate() {

    var x = tweenEnd.x - tweenStart.x;
    var y = tweenEnd.y - tweenEnd.y;
    var distance = Math.sqrt(x * x + y * y);
    time = distance / speed * dt;

    tween.start();

    then = perfNow();

    tick();

};
body {
    margin: 0;
    overflow: hidden;
}
div {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: black;
}

sentences:
Can I display text in SFML without setting a font? I'm trying to render text without setting a font.

#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
string culoare;
int main()
{

    sf::RenderWindow window(sf::VideoMode(800, 600), "Window");
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        sf::Text text;
            //atext.setFont();
            text.setString("HelloWorld");
            text.setCharacterSize(20);
            text.setStyle(sf::Text::Bold);
            text.setColor(sf::Color::White);
            text.setPosition(0,0);
            window.draw(text);
            window.clear(sf::Color::Green);
            window.display();
    }

    return 0;
}

This just make a green window, but doesn't display text.

sentences:
C# Convert List to multidimensional float I have a list of Vector3 structs like this

List<Vector3> cloud

I want to convert this list into a 3 dimensional float array

float[,,] points

Where Vector3 is a struct of 3 floats ( x, y, z )

The points array should be a 3 dimensional float array containing each

float[Vector3.X, Vector3.Y, Vector3.Z]

in the cloud list. Thank you for your help.

sentences:
How is "resolution scaling" done? Lots of new games use Resolution Scaling as an option. At first I thought it was just Super-sampling but it does not appear to remove aliasing so I'm assuming there is more to it than that.

I guess my question is, how are developers implementing this? I'm assuming it means multiplying the width and height of the various rendertargets, and then what?

sentences:
How to use a sprite mask or shader to mask a text? I'd like to know what I need to learn to apply a shader to achieve masking on the text.

Here is my text object in-game, I'm using a sprite mask to mask the game objects on the card, they're all in their own sorting layer, the order number is 11.

Here is my text in the inspector

However, everything on the card is being masked except the text.

If someone could tell me what I need to learn to solve this problem that'd be great, can this problem be solved using a shader?

sentences:
Using a setTimeout to Jump I am trying to make a jump function.

I am making a game in html5 canvas with Javascript. I have gotten the player to move. When making the jump function I decided to use a timeout to reverse the coordinates back to the original after a set time.

The error is after the character moves up he does not return to the original position the character just stays there, and then  upon clicking the jump (arrow key) again the player goes the other way e.g (down).

class Character {
  constructor() {
    this.x = 50;
    this.y = 400;
    this.posX = 0;
    this.posY = 0;
    this.width;
    this.height;
    this.hitPoints = 1;
    this.directionFace = "right";
    this.jump = false;
    this.jumpHeight = 23;
  }

  move(e) {
    this.x += this.posX;
    this.y += this.posY;

    if (e.keyCode == 37) {
      console.log('left');
      this.posX -= 10;
    }
    else if (e.keyCode == 38) {
      console.log("UP");

      if (!this.jumping) {
        this.posY -= this.jumpHeight;
        this.jumping = true;

        setTimeout(function() {
          this.posY = this.jumpHeight;
          this.jumping = false;
        }, 500);
      }
    }
    else if (e.keyCode == 39) {
      console.log("right");
      this.posX += 10;
    }
    e.preventDefault();
  }
}

sentences:
Using points to unlock next scene in Unity Below is my code and I'm a beginning game designer trying to make my first game for art school teehee! :)

I'm not sure how to unlock the next level with a scene I've already made called Rust_Room

Any ideas? :o
I also attached the error codes I'm getting!

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

public class Example
{
    HUD hud;
    int points;

    const int ScorePrefix = "Score:";
    int score;

    public void LoadLevel()
    {
        if ("Score==45")
        // load the nextlevel
        SceneManager.LoadScene(SceneManager.GetSceneByName(Rust_Room)().buildIndex + 1);

    }
}

sentences:
Odds For Fighting Game I'm creating a fighting game where two opponents face off against each other in the ring. While I've been able to figure out the odds of a player winning based on previous wins/losses, I have yet to find a formula which modifies those odds based on opponent. For example:

Player 1: W:5 L:5 - 1/1 odds
Player 2: W:5 L:0 - 1/5 odds

I want to calculate the odds that Player 1 will wins against player 2. Compounding this the players could be of different levels: if the players are within a few levels of each other, the odds should map closely to wins/losses. However, as the levels diverge, the odds of the lower level player winning reduce. As a swag:

Player 1 - W:5 L:5  - 1:1 odds

Against a level  8 - 1:2
Against a level  9 - 2:3
Against a level 10 - 1:1
Against a level 11 - 3:2
Against a level 12 - 2:1

These are just estimates, my sense is that there is a math formula out there which will calculate that - can anyone out there point me to what this could be?

Thanks...Chris

sentences:
How do you get a multiplayer-only game to reach critical mass? Say you have a multiplayer-only game in which players are randomly paired head-to-head against a random online player...

How do get such a beast off the ground?

You need enough players online at all times such that any random player game request will be paired with someone else's request.

Chicken and egg ... You need players to play but without players to play no players will play!

How do I reformulate the problem to make this work?

This happened to me a while back and I haven't come up with anything useful since.
https://github.com/fictorial/Rock-Paper-Scissors-World-Masters-iOS

sentences:
Getting curved-based zooming speed? I am able to get a fairly smooth zooming function going on in my project.

However I'm hoping to achieve a non-linear function.

I've tried using the smoothstep function but it doesn't feel smooth (Could have been an improper implementation of mine).

If anyone can provide any suggestions, that will be greatly appreciated.

An example of what I'm trying to achieve is that of the spectator camera, where it zooms in/out, in Dota2.

using UnityEngine;
using System.Collections;

public class Pan : MonoBehaviour {

    public float zoomSpeed = 20f;
    public float smoothTime = 0.3f;

    private float refSpeed = 0.0f;

    void Update () {

    if(Input.touchCount == 1)
        {
            panUpdate();
        }

    if(Input.touchCount == 2)
        {
            zoomUpdate();
        }

    }

    void panUpdate()
    {

    }

    void zoomUpdate()
    {

        // Store both touches.
        Touch touchZero = Input.GetTouch(0);
        Touch touchOne = Input.GetTouch(1);

        // Find the position in the previous frame of each touch.
        Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition;
        Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition;

        // Find the magnitude of the vector (the distance) between the touches in each frame.
        float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude;
        float touchDeltaMag = (touchZero.position - touchOne.position).magnitude;

        // Find the difference in the distances between each frame.
        float deltaMagnitudeDiff = prevTouchDeltaMag - touchDeltaMag;

//        float into = GetComponent<Camera>().fieldOfView + deltaMagnitudeDiff; //* ZoomSpeed

       // float smoothDiff = Mathf.SmoothDamp(GetComponent<Camera>().fieldOfView, deltaMagnitudeDiff, ref zoomSpeed, smoothTime);

        // Otherwise change the field of view based on the change in distance between the touches.
        GetComponent<Camera>().fieldOfView = Mathf.SmoothDamp(GetComponent<Camera>().fieldOfView, GetComponent<Camera>().fieldOfView += deltaMagnitudeDiff * zoomSpeed, ref refSpeed, smoothTime);

        // Clamp the field of view to make sure it's between 0 and 180.
        GetComponent<Camera>().fieldOfView = Mathf.Clamp(GetComponent<Camera>().fieldOfView, 59.9f, 119.9f);

    }
}

sentences:
Why is the background image less smooth on the phone? I've just downloaded Gamestate code from create.msdn.com, and as you can see from the image below:

The result is less smooth then the image imported to visual studio, how do I increase the quality?

sentences: where can I download unity assets without opening it in in unity. I'm browsing through my mobile phone and I need to download unity assets but unity asset store demands that I open the assets in unity directly. How or which site can I download it on my mobile and send it to my PC.

sentences:
Discrete mathematician? I'm studying a relatively new mathematics degree called 'discrete mathematics'. This degree intertwines mathematics and computer science such that you can solve most mathematical programming problems (and more) while being able to code them (theoretical CS).

Is this something sought after by game developers? My dream is to work for a game developing company and I want to bring something to the table that nobody else brings. In my case, hopefully exceptional mathematical knowledge. You can look at it this way: If you have a mathematical problem, you'd rather want someone of my caliber than a regular mathematician as it's IT related (again, discrete mathematics). But is it needed?

EDIT: This is NOT a duplicate of the supposed duplicate. I am not your every day mathematician which is why I believe that my question has different roots. I am specifically asking the DIFFERENCE between hiring a regular mathematician and a discrete mathematician.

sentences:
Shader - Directional Lights Depth Is there a way to retrieve the deph from directional lights ? I can access the _ShadowMapTexture but this is not the depth.

I found how to access the shadow map of, I think, every light type by using the defines such as SHADOW_ATTENUATION(a) or directly the _ShadowMapTexture, everything is located in the built-in shaders.

But I am wondering how could I access the depth of those lighting type. I found a way to access it for the spot light this way : _ShadowCoord.z which gives the depth scaled with _ShadowCoord.w, which could be considered to the far plane, but am I right ?

How could I do the same for the other light types such as directional or point lights ? For the moment I am stuck with directional lights, any clues ?

Because if I try to access the depth for a directional light by using _ShadowCoord.z it seems that it's more related to the depth view and not the light. Here I am, totally stuck with this directional lights.

sentences:
glsl Expected token ')', found 'identifier' with function mix I have a Fragment shader that contains:

[...]
float c = texture2D(tex, tc).a;
float alpha = mix(0.0f, 1.0f, c);
gl_FragColor = vec4(1, 1, 1, alpha) * color;

This works fine on my desktop and Nexus 5. However I get an exception while running on a Wiko mobile:

0:22: L0001: Expected token ')', found 'identifier'

Line 22 is the line containing the mix function.

What I'm doing wrong?

sentences:
Can I use a SkinnedMeshRenderer animation in a Canvas? I just downloaded an asset from the store: https://www.assetstore.unity3d.com/en/#!/content/67122

They're just animated characters. If you drag & drop the prefabs on the scene, it works fine.

The thing is, I work exclusively with Unity's new 2D Canvas/Image/Button/etc. These prefabs instead use a SkinnedMeshRenderer so it's not like you can put them inside your Canvas.

I want to have the prefabs work in my Canvas. For all intents and purposes I want those animations to act like a Image inside the Canvas.

This is what one of those prefabs looks like:

I want to take advantage of the Unity's canvas because it makes a lot of things easier - like scaling for all devices, scroll views, easy masks, etc.

sentences:
libgdx: how to manage entity classes Good day sirs, I know this is a newbie question but I really need to ask it. I've been reading a lot of sample codes on libgdx, and I have seen entities(player, enemy, boss,etc.).

my question is what should an entity class contain?as I have seen it contains states which i will use to animate my sprite, should I also put my inputs/controls, and animation in this entity class?

sentences:
Custom Editor for Map/Dictionary in Unity I'm trying to build my own little ResourceManager in Unity that will allow me to tag resources (ranging from materials to prefabs) to a label in the editor, and then access them in game.

The ResourceManager itself is really easy to write- it's just a Dictionary. However the Unity Editor doesn't seem to be able to serialize (and thus render) Dictionaries.

To get around this, I created a list of key-value pairs which gets loaded into the dictionary by unity. That way Unity gets its list and I get my Dictionary. However, when I try and run the code shown below, I can only add a single entry to the list. Any idea what I'm doing wrong?

ResourceManager.cs

using UnityEngine;
using System.Collections.Generic;

public class ResourceManager : MonoBehaviour, ISerializationCallbackReceiver {
    private Dictionary<string, Object> resources = new Dictionary<string, Object>();

    #region Unity
    // Unity doesn't know how to deal with maps, so we give it a list to work with
    public List<ResourceEntry> entries;

    // Dictionary -> List
    public void OnBeforeSerialize() {
        entries.Clear();
        foreach(string key in resources.Keys) {
            entries.Add(new ResourceEntry(key, resources[key]));
        }
    }

    // List -> Dictionary
    public void OnAfterDeserialize() {
        resources = new Dictionary<string, Object>();
        foreach(ResourceEntry entry in entries) {
            resources[entry.key] = entry.value;
        }
    }

    [System.Serializable]
    public class ResourceEntry {
        public string key;
        public Object value;

        public ResourceEntry() {}

        public ResourceEntry(string key, Object value) {
            this.key = key;
            this.value = value;
        }
    }
    #endregion

    private static ResourceManager instance;
    public static Object Get(string category, string key) {
        instance = instance ?? GameObject.FindObjectOfType<ResourceManager>();
        if( instance.resources.ContainsKey(key)) {
            return instance.resources[key];
        } else {
            return null;
        }
    }
}

ResourceManagerEditor.cs

using UnityEngine;
using System.Collections.Generic;
using UnityEditor;
using UnityEditorInternal;

[CustomEditor(typeof(ResourceManager))]
public class ResourceManagerEditor : Editor {
    private ReorderableList list;

    public void OnEnable() {
        list = new ReorderableList(serializedObject, serializedObject.FindProperty("entries"), true, true, true, true);
        list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
            SerializedProperty element = list.serializedProperty.GetArrayElementAtIndex(index);
            rect.y += 2;
            EditorGUI.PropertyField(new Rect(rect.x, rect.y, 60, EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("key"), GUIContent.none);
            EditorGUI.PropertyField(new Rect(rect.x + 70, rect.y, 160, EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("value"), GUIContent.none);
        };
        list.drawHeaderCallback = (Rect rect) => {
            EditorGUI.LabelField(rect, "Resources");
        };
    }

    public override void OnInspectorGUI() {
        serializedObject.Update();
        list.DoLayoutList();
        serializedObject.ApplyModifiedProperties();
    }
}

sentences:
How can I simple use global or individual bool flag/s? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DoorsManager : MonoBehaviour
{
    public bool globalDoorsLockState = false;
    public bool[] doorsLockState;
    public GameObject[] doorsShieldFX;

    // Start is called before the first frame update
    void Start()
    {
        doorsShieldFX = GameObject.FindGameObjectsWithTag("ShieldFX");
        doorsLockState = new bool[doorsShieldFX.Length];

    }

    // Update is called once per frame
    void Update()
    {
        for (int i = 0; i < doorsLockState.Length; i++)
        {
            if (globalDoorsLockState == true)
            {
                doorsLockState[i] = true;
            }
            else
            {
                doorsLockState[i] = false;
            }
        }
    }
}

I want to be able to change all the doors flags to true/false or each door individually. Now in the Update it's working only for the global.

How can I add code or change it so it will also be able to change each door lock state individually?

sentences:
Should I downgrade my Unity project to the latest LTS version? I created my Unity project with a 2020 version and now I'm using 2020.2.0f1. Recently, I realized that using the latest LTS version is the best choice for games that are in production or about to ship. I tried downgrading to the latest LTS (2019.4.18f1) but since Unity doesn't support downgrading, all my objects disappeared and I got a lot of weird errors in console. My question is:
Should I continue developing the game with the version that I'm using right now or downgrade to the latest LTS version?

sentences:
How can i get object from TMXTiledMap and store it in Dictionary variable ? I've been following a tutorial to make tiled map in cocos2d x 3.0 ,
but i couldnt complete the rest of the tutorial because its for coco2d x 2.0 version,

How can i get a value of property that is stored in an object from TMXObjectGroup variable ?
and my code is:

tileMap = cocos2d::TMXTiledMap::create("ground.tmx");
ground = tileMap->layerNamed("ground");
this->addChild(tileMap);

TMXObjectGroup *objects = tileMap->getObjectGroup("objects");
??? sign = objects->getObject("sign");// it return ValueMap not Dictionary ?!

how can i get a Dictionary of that object so i can get its values ??

sentences:
SDL Convert pixel format I have two pixes stored in a 32 bit unsigned integer (4 bytes per pixel, using SDL's types for convenience):

Uint32 pixel1;        // Source pixel, format: SDL_PIXELFORMAT_BGRA8888
Uint32 pixel2_format; // Format of the pixel2 (can change)
Uint32 pixel2;        // Destination pixel

How can I convert the format from pixel1 to pixel2?

sentences: How to adjust texture on a sphere? As seen, the texture is not adjusted to the sphere. I tried to change alignment, but it still displays multiple sides. How can I fix this?

sentences:
Are shaders the only way to implement 2d lighting? I'm working on a 2d top down game with libgdx and I think i got the basics. No want I want to implement lighting, I don't know anything about lighting. I want just to have some light sources and shadows, but how do i do it?

Is using glsgl the only wayto do lighting in a 2d game? I've already tried to learn opengl and gave up because i thought it was too dificult and could take too long to do something even if i got the basics. Mabye glsl is different anyways

Any examples/tutorials would be welcome.
Thanks in advance

sentences:
How to write depth texture and read values from it I am new in Unity and specializing in another field. But now I have to rapidly study it for a new project. I will be very thankful if anyone explain me how to read values of the depth buffer.
I wrote a shader, which creates depth image:
Shader "Custom/MyDepthShader"
{
    Properties
    {
        _MainTex ("Texture", 2D) = "white" {}

    }
    SubShader
    {
        // No culling or depth
        Cull Off ZWrite Off ZTest Always

        Pass
        {
            CGPROGRAM
            #pragma vertex vert // compile function vert as vertex shader
            #pragma fragment frag // compile function frag as fragment shader

            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            sampler2D _MainTex;
            sampler2D _CameraDepthTexture;

            fixed4 frag (v2f i) : SV_Target
            {
                float depth = tex2D(_CameraDepthTexture, i.uv).r;
                depth = Linear01Depth(depth);
                depth = depth * _ProjectionParams.z;
                return depth;
            }
            ENDCG
        }
    }
}

Now I need to get depth information into a texture and save float values of this texture to for example txt  file for further processing.
I didn't found yet answer to this question after two days of googling and reading guides.
For testing this shader I am using OnImageRender(RT src, RT dst, material).

sentences:
Client-side prediction for FPS People that understand client-side prediction and client-side interpolation, I have a question:

When I play the game Team Fortress 2, and type cl_predict 1 into the developer's console, it enables client-side prediction. The also says "6 predictable entities reinitialized". It says this regardless of how many players are on the server, which makes sense, because other players are not predictable entities.

I thought client-side prediction was only for the movement of the player. Are there other entities that the client can provide prediction for?

sentences:
Need transform matrix to translate the center of the view to a custom position within the target texture My problem is as follows:

I want to use a single render target texture for drawing 16 viewports where I want to display the 16 different combinations of the marching squares algorithm with my 3D tiles. Each viewport it's supposed to have its own camera and be located at a custom distance from the center of each tile set and this camera should be able to rotate around their center, zoom in and out, etc.

My current issue is that my current projection setting is placing the center of the camera view in the center of the target texture, instead of locating the center of the view in the center of the rectangle corresponding to that viewport.

I assumed I just had to push a translation to the final transform in order to translate the image within the normalized screen coordinates. However, when I tried to do this, it didn't work. How should I do this?

NOTE: Currently I achieved it by using the direct3d viewports, but I'd like to know how should I do if I want to use my custom transform pipeline.

sentences:
How can I orbit a camera about it's target point? I'm drawing a scene where the camera freely moves about the universe.  The camera class keeps track of the view (or look at) point, the position of the camera, and the up vector.  These vectors/points are then passed into gluLookAt.

Pan and zoom are nearly trivial to implement.  However, I'm finding rotation about the look at point to be much more of an issue.  I want to write a function Camera.rotate that takes 2 angles, one that rotates up/down and one that rotates left/right along an imaginary sphere that is centered about the look at point.

Is there an easy way to do this?

I've (briefly) read about quaternions, but I wanted to see if there was an easier solution given the relatively simple construction of my scene.

sentences:
box2d resize bodies arround point I have a compound object, consisting of a b2Body, vector-graphics and a list polygons which describe the b2body's shapes. This object has its own transformation matrix to centralize the storage of transformations. So far everything is working quiet fine, even scaling works, but not if i scale around a point.

In the initialization phase of the object it is scaled around a point. This happens in this order:

transform the main matrix
transform the vector graphics and the polygons
recreate the b2Body

After this function ran, the shapes and all the graphics are exactly where they should be, BUT:
after the first steps of the b2World the graphical stuff moves away from the body.
When I ran the debugger I found out that the position of the body is 0/0

the red dot shows the center of scaling. the first image shows the basic setup and the second the final position of the graphics. This distance stays constant for the rest of the simulation.

If I set the position via

myBody.SetPosition( sx, sy );

the whole scenario just plays a bit more distant for the origin. Any Idea how to fix this?

EDIT::

I came deeper down to the problem and it lies in the fact that i must not scale the transform matrix for the b2body shapes around the center, but set the b2body's position back to the point after scaling. But how can I calculate that point?

EDIT 2 ::

I came ever deeper down to it, even solved it, but this is a slow solution and i hope that there is somebody who understands what formula I need.

assuming to have a set polygons relative to an origin as basis shapes for a b2body:

scaling the whole object around a certain point is done in the following steps:

i scale everything around the center except the polygons
i create a clone of the polygons matrix
i scale this clone around the point
i calculate dx, dy as difference of clone.tx - original.tx and clone.ty - original.ty
i scale the original polygon matrix NOT around the point
i recreate the body
i create the fixture
i set the position of the body to dx and dy

done!

So what i an interested in is a formula for dx and dy without cloning matrices, scaling the clone around a point, getting dx and dy and finally scale the vertex matrix.

sentences:
Collision detection problems using AABB's I implemented a simple collision detection routine using AABB's between my main game sprite and various platforms (Please see code below).  It works great, but I'm now introducing gravity to make my character fall and it's shown up some problems with my CD routine.

I think the crux of the matter is that my CD routine moves the sprite back along the axis in which it has penetrated the least amount into the other sprite. So, if it's more in the Y axis than the X, then it will move it back along the X Axis.

However, now my (hero) sprite is now falling at a rate of 30 pixels per frame (It's a 1504 high screen - I need it to fall this fast as I want to try to simulate 'normal' gravity, any slower just look weird) I'm getting these issues.  I will try to show what is happening (and what I think is causing it - although I'm not sure) with a few pictures: (Code below pictures).

I would appreciate some suggestions on how to get around this issue.

For clarification, in the above right picture, when I say the position is corrected 'incorrectly' that's maybe a bit misleading.  The code itself is working correctly for how it is written, or put another way, the algorithm itself if behaving how I would expect it to, but I need to change it's behaviour to stop this problem happening, hope that clarifies my comments in the picture.

My Code

public boolean heroWithPlatforms(){

    //Set Hero center for this frame
    heroCenterX  = hero.xScreen+(hero.quadWidth/2);
    heroCenterY  = hero.yScreen+(hero.quadHeight/2);

    //Iterate through all platforms to check for collisions
    for(x=0;x<platformCoords.length;x+=2){

    //Set platform Center for this iteration
    platformCenterX = platformCoords[x]+(platforms.quadWidth/2);
    platformCenterY = platformCoords[x+1]+(platforms.quadHeight/2);

    // the Dif variables are the difference (absolute value)
    // of the center of the two sprites being compared (one for X axis difference
    //and on for the Y axis difference)
    difX = Math.abs(heroCenterX-platformCenterX);
    difY = Math.abs(heroCenterY-platformCenterY);

    //If 1
    //Check the difference between the 2 centers and compare it to the vector (the sum of
    //the two sprite's widths/2.  If it is smaller, then the sprites are pverlapping along
    //the X axis and we can now proceed to check the Y axis
    if (difX<vecXPlatform){

    //If 2
    //Same as above but for the Y axis, if this is also true, then we have a collision
    if(difY<vecYPlatform){
        //we now know sprites are colliding, so we now need to know exactly by how much
        //penX will hold the value equal to the amount one sprite (hero, in this case)
        //has overlapped with the other sprite (the platform)
        penX = vecXPlatform-difX;
        penY = vecYPlatform-difY;
        //One sprite has penetrated into the other, mostly in the Y axis, so move sprite
        //back on the X Axis
        if (penX < penY){hero.xScreen-=penX*(heroCenterX-platformCenterX>=0 ? -1 : 1);}
        //Sprite has penetrated into the other, mostly in the X asis, so move sprite
        //back on the Y Axis
        else if (penY < penX) {hero.yScreen-=penY*(heroCenterY-platformCenterY>=0 ? -1 : 1);}
        return true;
        }//Close 'If' 2
        } //Close 'If' 1
    }
    //Otherwise, no collision

    return false;
    }

sentences:
Is there any game engine using a functional programming language? Is there any game engine using a functional programming language similar to Scheme, Common Lisp, Clojure or JavaScript?

I've tried Unity3D but their "JavaScript" is not actually JavaScript, is strongly typed and is not functional.

sentences:
Ring and Pole - Box2d How I can make a b2Body in box2d so that it could form a ring which does not collide from the center just like a ring. like when we flick the object and there's another body (like pole), the pole can go inside from the ring.

like this:

sentences:
Appropriate use for prefabs in Unity in a coordinate based game? I am wondering how exactly to use prefabs in Unity for my discretely coordinate-based game. Should they only be for gameObjects that are exactly the same? Or can they have small variations?

Example: a treasure chest is interactable and it holds items, so I would make it an empty gameObject, add an interactable component and then an itemContainer component and then drag and drop it into my prefabs folder and delete the instance in the scene.

But the question remains, if I make this treasure chest a prefab, how do I edit the itemContainer component of this treasure chest? Moreover, how would I serialize it for later use, and organize my data? Would I have to use external data files and reconstruct the ItemContainerComponent, just for a treasure chest? That sounds like a lot of work.

If I edit the itemContainer component as a prefab, then all treasure chests will have the same items. Obviously this is not feasible.

Do I drag my treasureChest prefab from the prefabs folder and then simply drop it in the game? That's how most people use it, right?

I would prefer not to just drag and drop the prefabs, because I want a more industrialized approach, and I do want some way of saving what is in each treasure chest. I can't for the life of me figure out a good way. Help appreciated!

EDIT: I see the link provided that marks this as a possible duplicate. However, none of the answers in that link are clear enough to be useful to me, e.g., the "factory." It would be nice if someone could explain the factory idea in more concrete terms.

sentences:
Unity Client and Multiplayer Networking/Architecture My background is in Enterprise and SaaS web infrastructure.  Zero information about games and how their networking works.  I only know about the world of browsers and RESTful APIs.

I'm planning on using Unity for the client FYI.

Authentication and Authorization

I'm planning to use Unity and Firebase.  Seems like this is fairly standard HTTP connections during the auth faze.  Nothing surprising here unless there is something I missed.

The client authenticates against a service, Firebase in this case.  And then all future calls after authentication are made using the returned credentials.

Gameplay and Player State

This part confuses me.  I assume shooters use a UDP type protocol or some proprietary protocol on top of UDP. But can a game use a REST API and HTTP or TCP connections to send client updates?

Clients would then poll the game server or have a long running connection open to request updates.  For example the Auction House in WoW.  Is there a long lived TCP connection open between the client and the server updating the auction house data every X seconds?

Then when a player submits a purchase order that same long lived TCP connection is used to update the game server state?

Or is it all literally a REST API like a SaaS app would use?  Is my experience with browsers and Single Page Apps in an Enterprise environment applicable to a WoW auction house type situation?

Thank you,
Any tips or feedback is helpful at this point.

sentences:
Unity 5 The Editor has stopped working Windows 7 64bit As soon as I press the play button to attempt to run any of my updates games crashes the editor immediately and I can't run my games.

Does anyone know how I could debug this or where to start? Does Unity keep a log of errors when it crashes?

I have both a 2D and 3D game that do not work and the editor is not throwing any errors or telling me there are compile time issues.

EDIT: If it makes any difference it is the 64bit version and I am using a Student Pro License

sentences:
Circle inside ellipse collision/intersection (preventing circle from leaving the ellipse) I am working on a 2D RPG with a turned based battle system.

Characters move inside the confines of an ellipse movement area and when they leave the boundaries will be pushed back inside. (i.e they should be able to walk around the inner part of the ellipse). Previously we were using circles for the movement area and I wrote the code to do circle inside circle collision (not too difficult because the radius is always the same) but since we will change to using an ellipse, I am trying to update the code.

I have looked at a few solutions for actual ellipse collision/intersection and the math looks..daunting. My questions are:

Are there any clean solutions to doing circle inside ellipse collision/intersection?
Should I be approximating the ellipse collision in another way? Like using an n-sided polygon?

I am a bit lost on how to approach this and could really use some advice.

sentences:
player goes off screen as the camera smooth follow interpolation Sometimes player goes off screen as the camera lags behind it, especially when the player is falling. Also when the player is climbing walls by jumping left and right, the camera moves left and right, as I want it to stay still.
I am assuming this is a problem with the camera speed not matching the physics speed of the player, I don't know how to match those two.
This is my code:
let camera = Camera()
let player = Player()

let followFrame = Rectangle(0, 0, viewWidth, viewHeight);

let followTarget = Point(player.x, player.y);

function update = () => {

  if (!followFrame.containsPoint(player.x, player.y)) {

     followFrame.position = [player.x - followFrame.width * 0.5,
         player.y - followFrame.height * 0.5];

     followTarget.position = [followFrame.x, followFrame.y];
  }

  camera.position = interpolate(camera.position, followTarget)

};

I have to account for player to take long distance jumps and falls.

sentences:
Rotating sprite 180 deg I should say first, that I have the rotation down. Its just that I want my square to rotate exactly 180 degrees. Currently, it will rotate but it will rotate but by less each jump. So after several jumps it will be moving on one of its side.
There's not much code to show but I'll show you how I'm rotating:

if (jumped)
        {
            roation += 0.1f;
            playerVel.Y += gravity;
        }

I haven't initialized rotation to anything.
I've also tried using some Math functions but I just get the same result.

sentences:
Rotating game object without using localEulerAngles I'm building a player controller.

While aiming, the player can rotate the chest bone. This looks as if the character aims in different directions.

The chest bone should only be allowed to rotate within a certain range.
If this range is exceeded (either to the left or to the right), the chest bone should stay at its current rotation, and the player should be rotated instead.

I'm having problems applying the desired rotation to the parent game object instead.

I'm trying to work with the localEulerAngles in order to applying an additional Y rotation to the gameobject, but the Y rotation value tells me for example "359.9" while I expected to work with a value of ~0.

private void pHandle_LateUpdate_Aim()
{
    Quaternion oldNeckRotation = Neck.transform.rotation;

    // Fade old input before capturing new, so we don't dull the freshest data.
    float yawBlend = Mathf.Pow(1.0f - Aim_yawInputFalloff, referenceFramerate * Time.deltaTime);
    // A Lerp toward zero is just the same as a multiplication by the blend factor.
    Chest_yawRate *= yawBlend;
    // Accelerate by mouse movement over the past frame.
    // (May need adjustment for display resolution).
    Chest_yawRate += Input.GetAxis("Mouse X");

    float yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    float offCenterYaw = Chest_currentYaw - Chest_yawCenter;

    float fDesiredChestYaw = Chest_currentYaw + yawDelta;
    float fHeroRotation = 0f;

    if (fDesiredChestYaw > Chest_rotateRange) // the allowed chest rotate range would be exceeded. Instead, move the gameobject / the parent.
    {
        fHeroRotation = (fDesiredChestYaw - Chest_rotateRange);
        fHeroRotation += this.transform.localEulerAngles.y;
        this.transform.Rotate(0, fHeroRotation, 0);
        return;
    }
    else if (fDesiredChestYaw < -Chest_rotateRange)
    {
        fHeroRotation = (Chest_rotateRange + fDesiredChestYaw);
        fHeroRotation += this.transform.localEulerAngles.y;
        this.transform.Rotate(0, fHeroRotation, 0);
        return;
    }
    else
    {
        // If we're moving away from the center, slow down as we approach the edge.
        if (yawDelta * offCenterYaw > 0)
        {
            float extremityYaw = offCenterYaw / Aim_yawMaxRange;
            yawDelta *= 1.0f - extremityYaw * extremityYaw;
            fHeroRotation = yawDelta;
        }
    }

    // Ensure we never overshoot the allowed range.
    Chest_currentYaw = Mathf.Clamp(Chest_currentYaw + yawDelta,
                              Chest_yawCenter - Aim_yawMaxRange,
                              Chest_yawCenter + Aim_yawMaxRange);

    Vector3 nNewChestRotation = new Vector3(Chest.localEulerAngles.x, Chest_currentYaw, Chest.localEulerAngles.z);
    Chest.localRotation = Quaternion.Euler(nNewChestRotation);

    Quaternion newNeckRotation = Neck.transform.rotation;

    //the neck should not rotate with the chest. So I first counter-rotate it against the new chest rotation, then rotate it a little towards the chest rotation
    Neck.transform.rotation = Quaternion.Lerp(oldNeckRotation, newNeckRotation, neckFollowChest);
}

sentences:
Procedural rock algorithm I'm looking to create some procedural low poly rocks and boulders for a game.

I haven't found much interesting information on the internet other than 3D software articles. Not sure what way to go.

sentences:
Unity 3D Slow car (wheel colliders) My car is moving very slowly even though I apply high amounts of torque to the wheel colliders. The only thing I found to be helpful was to increase the wheel's friction stiffness, but that really messes up the braking and makes the car shake.
The values I use for setting up the car and torque are realistic (1500 kg car, 20 kg wheels, a realistic torque value accounting for gear ratios etc.), so I don't understand the problem.

sentences:
What is missing from SDL for it to gain more widespread adoption? As I understand, SDL offers abstractions that let you make windows, handle input and audio much easier than doing so directly with the low level APIs provided by several operating systems.

However, it seems that a lot of games, both indie and AAA, don't use it, and I would like to know why. This makes me suspect that there may be areas where SDL is lacking, such as features, performance, or robustness, when compared to platform-specific APIs.

Apart from platform support, that is, considering only the platforms SDL supports, I do not understand what would keep a developer from using SDL for their game, since I feel like, based on my admittedly limited knowledge, it'd be much smarter to use SDL on the platforms that do support it.

sentences:
Rotation angle based on touch move I want to rotate my stick based on the movement of the touch on the screen. From my calculation I did not able to find correct angle in degree. So please provide guidance, my code snippet for that are below.

if (pSceneTouchEvent.isActionMove()) {
    pValueX = pSceneTouchEvent.getX();
    pValueY = CAMERA_HEIGHT - pSceneTouchEvent.getY();
    rotationAngle = (float) Math.atan2(pValueX, pValueY);
    stick.setRotation((float) MathUtils.radToDeg(rotationAngle));

}

sentences:
Simulate wind in a powder game 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?

sentences:
Using CAShaperLayer within COCOS2d My class X is interited from CCLayer.

@interface X : CCLayer

Then in X, I added an instance variable of type CAShapeLayer.

CAShapeLayer *_Circle

I drew the Circle using UIBezierPath. Now if I try to add _circle to self, it gives me error:

[self addChild:_Circle];

[CAShapeLayer tag]: unrecognized selector sent to instance 0x916f7f0 * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CAShapeLayer tag]: unrecognized.

I also tried typecasting _Circle to (CCNode*) or (CCSprite*) but nothing helped.

Any suggestions?

sentences:
Dealing with disconnected users Just a strange question. I was thinking about it today. About a poker game website/apps or any online gaming platform with money being involved.

What would be the best way to deals with disconnected users trying to avoid a loss or maybe real disconnection.

I doubt pausing the game until that player comes back is very suitable.

Any ideas? Suggestions?

sentences:
Specular banding with high specular power We're having some issues with our ray tracing in DirectX, especially with some serious banding issues with specular. With high specular power (above 8) banding starts. I'm wondering if this is an HDR/LDR issue or could be related to something else, such as normals or other vectors?

UPDATE

Look below for updates.

Here's the relevant shader code for Blinn-Phong on a sphere:

float3 hitPoint = thisRay.origin + thisRay.direction * bestHit.hitT;
float3 normal = normalize(hitPoint - spheres[bestHit.hitID].center);
float3 toLight = pointLights[0].position.xyz - hitPoint;
float d = length(toLight);
toLight = normalize(toLight);

float diffuse = max(dot(normal, toLight), 0.0f);

float3 v = normalize(thisRay.origin - hitPoint);
float3 h = normalize(v + toLight);

float spec = 0;
if (diffuse > 0)
    spec = pow(max(dot(normal, h), 0.0f), specPower) * diffuse;

output[threadID.xy] = spheres[bestHit.hitID].colour * diffuse + spheres[bestHit.hitID].specColour * spec;

specPower equals 8 in this image

specPower equals 9 in this image

Is this as simple as an HDR/LDR issue or is it somehow related to normal precision? I believe I have encountered this issue before in a deferred renderer where normals were of low precision and improperly packed/unpacked but in this case normals are generated on the fly and the whole thing is rendered directly to the backbuffer.

Update 1

I would like to add to the above that triangles suffer the same artifact and they have their normal currently generated in the following way:

float3 normal = normalize(cross(triangles[bestHit.hitID].vertices[1] - triangles[bestHit.hitID].vertices[0],
                                    triangles[bestHit.hitID].vertices[2] - triangles[bestHit.hitID].vertices[0]));

I'd say this makes it even more unlikely that the normal of the surface is the problem. The following image shows what happens when specPower reaches 2048.

sentences:
Why would it be faster to render using multiple canvas elements? This video suggests that rendering using multiple canvas elements helps performance.

How does this work?

The idea was to use one for the player, one for the enemies, another for the background, though I really don't understand how could it be faster if you use more of the same thing.

Could someone clarify?

sentences:
generating random block-based worlds with 3D noise I want to create a 3D block-based infinite world.

For any block, I want to be able to compute its block type.

3D perlin noise is the usual building block of such a world.  If you ask the 3D noise function the value for a 3D point, it'll give you a value between -1 and 1.

How do you turn this number into a block type?

I want blocks on the surface to be turf, and different minerals to have different probabilities based on depth.  I want sprawling caves and caverns and lava flows but not small ones.  And so on.

So how do you turn noise into block types into a coherent subterranean world?  Particularly how do you make things like coal appear in seams and crystals only appear in caves and any other rules that can be invented that make the type of a block dependent upon its neighbours?

And how to do this efficiently, in an oracle function rather than by having to create large 3D arrays to store the decided outcomes of some terraforming?

sentences:
What are some common FOV for third person games? I am trying to decide on a field of view (FOV) for a third person game and I really don't know where to start. It would be very helpful to have some points of reference from recent TPS games and the FOV they use by default. The trouble is many third person games (or at least those I have tried) do not have any settings or information about what their default FOV is. I have had a look at Uncharted 4, Hitman (2016), The Division and GTA 5 but cannot find information about their FOV anywhere.

I understand that each game is different and the type of gameplay will determine the FOV choice here, but it would be very useful for me to have some existing examples as a starting point. Is there any good place to find this out?

sentences:
Specular Light not working Phong shading I want to implement Phong-Shading using GLSL. I also want to calulate all values using uniforms in the shaders.

Nearly everything works fine, but there is an error with the specular term of the equation.

Here is my vertex shader:

#version 330
layout(location = 0) in vec3 vertex;
layout(location = 1) in vec3 vertex_normal;

uniform vec3 light_ambient_color;
uniform vec3 light_diffuse_color;
uniform vec3 light_specular_color;
uniform vec3 light_position;

uniform vec3 material_ambient_color;
uniform vec3 material_diffuse_color;
uniform vec3 material_specular_color;
uniform float material_specular_shininess;

out vec3 vNormal;
out vec3 camVec;
out vec3 lightVec;

out vec3 diffuse;
out vec3 ambient;
out vec3 specular;
out float shininess;

uniform mat4 view;
uniform mat4 modelview;
uniform mat4 projection;

void main() {

    diffuse = material_diffuse_color.rgb * light_diffuse_color.rgb;
    ambient = material_ambient_color.rgb * light_ambient_color.rgb;
    specular = material_specular_color.rgb * light_specular_color.rgb;
    shininess = material_specular_shininess;

    mat4 normalMat = transpose(inverse(modelview));

    vNormal = vec3(normalMat * vec4(vertex_normal,0.0));
    vec4 pos = projection  * modelview  * vec4(vertex,1.0);

    camVec = pos.xyz;
    lightVec = (1) *(light_position.xyz - pos.xyz);

    gl_Position = pos;
}

And this is my fragment shader:

#version 330

in vec3 vNormal;
in vec3 camVec;
in vec3 lightVec;

in vec3 diffuse;
in vec3 ambient;
in vec3 specular;
in float shininess;

// this defines the fragment output
out vec4 color;

void main() {

  vec3 normal = normalize(vNormal);
  vec3 viewDir = normalize(camVec);
  vec3 lightDir = normalize(lightVec);

  vec3 myDiffuse = normalize(diffuse);
  vec3 myAmbient = normalize(ambient);
  vec3 mySpecular = normalize(specular);

    vec3 finalColor = ambient;
    float lambert = dot(normal,lightDir);
    vec3 specColor;

    if(lambert < 0.0){
        specColor = vec3(0.0,0.0,0.0);
    }else{
        finalColor += myDiffuse * lambert;

        vec3 h = (viewDir + lightDir ) / length(viewDir + lightDir);
        float beta = dot(h, normal);

        finalColor += mySpecular * pow(beta, shininess);
    }

    color = vec4(finalColor,0);
}

All uniforms are set correctly.
Here is what it looks like without the specular term:

And this happens when I add the specular term (which is not working):

Edit:
Another screenshot with changing pos.xyz to -pos.xyz in the vertex-shader

sentences:
How can I prevent resizing of an Ogre3D object once imported into jMonkeyEngine? I created an object in Blender:

Then I exported it as a mesh.xml file and attached it to the game scene:
[Note: The gray color is the ground.]

In the game I end up with have a smaller, horizontal tower. Any suggestions?

Note: I exported the file with "Force Camera", "Force Lamps" and "Export Scene" unchecked and "Swap Axis: x,y,z".

sentences:
Canvas tile grid, hover effects, single tilesheet, etc I'm currently in the process of building both the client and server side of an HTML5, canvas, and WebSocket game.

This is what I have thus far for the client: http://jsfiddle.net/dDmTf/20/

Current obstacles

The hover effect has no idea what to put back after the mouse leaves. Currently it's just drawing a "void" tile, but I can't figure out how to redraw a single tile without redrawing the whole map.
How would I go about storing multiple layers within the map variable? I was considering just using a multi-dimensional array for each layer (similar to what you see as the current array), and just iterating through it, but is that really an efficient way of doing it?
Currently the "borders" encroach on one another. I'm not sure what I'm doing wrong? If you hover over and off of the bordering "tree" tiles, you'll notice how it removes part of the neighboring tiles border. This shouldn't need to happen.
Outside of the map, what would be an elegant way of adding Players to the render scene? I've seen a few places that recommend you use multiple canvas's, would you recommend that since they'll probably be moving much more? In addition to that, how can I confine player movement to the grid, similar to how in the pokemon gameboy games, when you tap the left arrow, you always move one "space" that direction. It's not a halfway type deal.
Camera. What would be a good way about adding a "camera" to the equation, so the viewport can pan around a larger map area?
Obstacles. In the newer version of the map, you'll notice an empty obstacles array. Assuming players get added well, what do you think would be good for adding movement obstacles?

Side note

The tile sheet being used for the jsfiddle display is only for development. I'll be replacing it as things progress in the engine.

If you guys have any pointers for my JavaScript, feel free. As I'm more or less learning advanced usage as I go, I'm sure I'm doing plenty of things wrong.

Note: I will continue to update this post as the engine improves, but updating the jsfiddle link and updating the obstacles list by striking things that have been solved, or adding additions.

Edit

Updated link from http://jsfiddle.net/dDmTf/7/ to http://jsfiddle.net/dDmTf/17/ - this handles the "hover" problem, and it's been striked out.

Edit

Updated link from http://jsfiddle.net/dDmTf/17/ to http://jsfiddle.net/dDmTf/19/ - fixes the out of bounds issue with the tiles

Edit

Updated link from http://jsfiddle.net/dDmTf/19/ to http://jsfiddle.net/dDmTf/20/ - adds multiple layers to the equation

sentences:
How to move bezier curve points along circle to form a symmetric curve at center From the image below, A is an open bezier curve with it's points positioned to represent a circle. AP3 and AP1 have the same position.
From B, How can I move the points (AP1 and AP3 along the bigger circle of radius r whiles the CP's reduce in length as CP1 and CP4 also rotate) till they form a symmetric bezier curve at the center of the bigger circle marked as the red curve?

sentences:
Windows Forms game loop There is a very good game loop in the link which is tailored for windows forms. I need it in c++/cli so I converted the code as below. Here is my main loop.

using namespace System;
using namespace System::Windows::Forms;

HWND g_theAppHandle = nullptr;

bool IsApplicationIdle()
{
  MSG msg;
  return PeekMessage(&msg, g_theAppHandle, 0, 0, 0) == 0;
}

void OnIdle(System::Object ^sender, System::EventArgs ^e)
{
  while (IsApplicationIdle())
  {
    if (PunkEd::ABTCLI::g_initSuccess)
    {
      PunkEd::ABTCLI::Frame(0.0f);
    }
  }
}

[STAThread]
int CALLBACK WinMain(
  _In_ HINSTANCE hInstance,
  _In_ HINSTANCE hPrevInstance,
  _In_ LPSTR     lpCmdLine,
  _In_ int       nCmdShow
  )
{
  _CrtMemState memstate;
  _CrtMemCheckpoint(&memstate);

  PunkEd::PunkEdMain^ theApp = gcnew PunkEd::PunkEdMain;
  g_theAppHandle = (HWND)theApp->Handle.ToPointer();

  Application::Idle += gcnew System::EventHandler(&OnIdle);
  Application::Run(theApp);

  _CrtMemDumpAllObjectsSince(&memstate);
  return 0;
}

This loop triggers PunkEd::ABTCLI::Frame(0.0f); every time the application is idle. And Frame(float deltaTime); function triggers everyting related to game. Like render and physics. However my rendering window is a panel. And I override its mouse move callback as below.

private: System::Void panel1_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
  Debug::WriteLine(e->Location);

  glm::vec3 cp = glm::vec3(e->Location.X, e->Location.Y, 0);
  glm::mat4 view = g_camera->GetViewMatrix();
  glm::mat4 project = g_camera->m_projection;
  glm::unProject(cp, view, project, glm::vec4(0.0f, 0.0f, (float)panel1->Width, (float)panel1->Height));

  cp.x -= panel1->Width / 2.0f;
  cp.y -= panel1->Height / 2.0f;

  g_cursor->m_node->m_translation = cp.xzy;
}

This function updates my curser's position in the game. However my render function is get called after I stop moving the mouse. How can I overcome this stuation such that my curser position gets update and renders immediatly after I moved mouse.

sentences:
Unity 5 - Place objects in game to closest gameobject I am making a puzzle game in unity3D 5 for school and one of the puzzles is this: The player (third person) can pick up certain objects (4 objects) and has to place them inside holes in a wall in a specific order for a door to open.

I have 4 empty gameobjects named as slot001, slot002, slot003 and slot004 at the right positions at the holes in the wall. When the player has an item held and a certain button is pressed I link the transform of the object to the transform of the empty gameobject.

The problem is that the objects transform has to link to the transform of the closest gameobject. So when you stand in front of the slot002 gameobject the objects transform should link to the transform of slot002. The same goes for slot 001, 003 and 004 ofcourse. I am not sure how to do this.

I put the 4 empty gameobjects (slots) in a list.
I know of the Vector3.Distance() function and I tried using that to check for the closest distance with Mathf.Min() but I couldn't quite get it to work.

Any help or a nudge in the right direction would be appreciated!

Thanks.

sentences: Unity3d Colliders not working on my characters I have create 2 characters in maya and imported them in Unity3d. I am able to move and animate them in unity but the characters are not colliding with each others. I have tried all major colliders capsule, box and mesh. I am kind of stuck in it !

sentences:
2D scene graph not transforming relative to parent I am currently in the process of coding my own 2D Scene graph, which is basically a port of flash's render engine.

The problem I have right now is my rendering doesn't seem to be working properly. This code creates the localTransform property for each DisplayObject.

Matrix m_transform =
                Matrix.CreateRotationZ(rotation) *
                Matrix.CreateScale(scaleX, scaleY, 1) *
                Matrix.CreateTranslation(new Vector3(x, y, z));

This is my render code.

float dRotation;
Vector2 dPosition, dScale;
Matrix transform;
transform = this.localTransform;
if (parent != null) transform = localTransform * parent.localTransform;
DecomposeMatrix(ref transform, out dPosition, out dRotation, out dScale);

spriteBatch.Draw(this.texture, dPosition, null, Color.White, dRotation,
new Vector2(originX, originY), dScale, SpriteEffects.None, 0.0f);

Here is the result when I try to add the Stage then to the stage a First DisplayObjectContainer and then a second one.

It may look fine but the problem lies in the fact that I add a first DisplayObjectContainer at (400,400) and the second one within it (that's the smallest one)
at position (0,0). So he should be right over its parent but he gets render within the parent at the same position the parent has (400, 400) for some reason. It's just as if I double the parent's localMatrix and then render the second cat there.

This is the code i use to loop through every childs.

base.Draw(spriteBatch);
foreach (DisplayObject childs in _childs)
{
    childs.Draw(spriteBatch);
}

sentences:
How can I profile and debug my usage of D3D10? I've been working on D3D 10 for about 6 months and I have accumulated a basic framework. The thing is I get frame rate spikes.

Even when I have a simple cube on the screen each side with its own texture, every now and the the frame rate drops suddenly.

Any tips to try and find out what is causing it?

sentences: What is the best practice to resize game views-assets in WPF/silverlight? I am working on simple game using WPF/C#, and I am wondering what is the best practice to resize the game (views, assets…) when user re-sizes the game window? Is it good practice to use the ViewBox control for this job?

sentences:
Ambient occlusion of cubes, a specific case After much fiddling around and thinking I've got my AO working on my game engine as intended; except one specific case.

When a block is nestled between others on two sides, but the corner block is missing, that corner doesn't get occluded. This isn't too shocking, because there's no logic to do otherwise. However, I can't think of a way to neatly solve that case. If I make it detect a block on each pair of sides, then check for the corner piece, we will end up with lots of broken AO in various scenarios, and that will be a lot of checks to boot.

Here's the table I came up with today which finally solved the missing bits of my AO algorithms:

Click for larger view

The logic in my code (C# MonoGame) essentially enforces this table.

If nobody comes up with anything better, I'll put a series of booleans in the checks for each side, then run through each combination and adjust as though a pair of side block were the corresponding corner block.

sentences:
How to rotate an object based on the movement and angles of Lifters I have Lifters that "carry" an object. I want the object to move and rotate based on how those Lifters move. Requirements include:

Supporting 1-4 Lifters at any side of the Object (e.g., both on one side, opposite, so on - can't make any guarantees about their positions relative to the object)
Supporting any orientation of the Object (e.g. the Object could be flipped on its side, sideways, or upside down; can't make guarantees that Forward is always facing forward, etc)

As such I implemented this by having the object move by setting its velocity to the average of the Lifters' velocity.
Now, if not all of them move (or if there's a disparity in their velocities), I want the object to rotate, like so:

This is done by keeping track of how much an individual lifter has moved in a frame from the Object's position, and calculating the angle via
m_Angle += Vector3.SignedAngle(lastPos - transform.position, currentPos - transform.position).

This "movement angle" I add up for every Lifter and then at the end, Rotate the Object via Transform.Rotate(Vector3.up, m_Angle).
However, this approach has some problems:

Calculations are done along the Y axis and therefore does not angle the Object up or down if the Lifters have different vertical positions,
m_Angle actually overshoots, but I found simply dividing m_Angle by the number of Lifters made it perfectly accurate. I do not know why this works.

Because I want this to rotate the object in "3 dimensions", I have attempted to calculate the "euler angles" of each Lifters' movement via:
Vector3 oldDisplacement = lastPos - transform.position;
Vector3 newDisplacement = currentPos - transform.position;
Quaternion rotation = Quaternion.FromToRotation(oldDisplacement, newDisplacement);
m_EulerAngles += rotation.eulerAngles;

And then at the end, I rotate the Object based on these "movement angles":
transform.Rotate(m_EulerAngles, Space.World);

This works in three dimensions, however it is off in the same way that m_Angle was before I divided it. It rotates the object too far. On top of that it seems to produce rotations along axes that have no displacement.

I want the object to only rotate exactly by the angle created by the Lifter's movement. This should keep it "synced" to Blue instead of rotating past as you see here.
When I check how much rotation Blue is adding per frame, I get an output like so:
Blue is adding (0.000, 359.507, 0.066); on movement (-0.015, 0.000, 0.000)

Despite moving solely on the x-axis, there is a z-euler angle being created, and the y-euler angle of 0.493 degrees is too much for -0.015f movement. I do not know why rotation.eulerAngles is inaccurate in my usage.
The only issue I can perceive is that since the Object's position is also moved at the end, the angle calculation assumes it is not moving and generates a larger angle (e.g., perhaps newDisplacement should be something like currentPos - (transform.position - m_Body.velocity * Time.deltaTime) ). However, removing the Object's movement from the finalPosition of the Lifter seemingly has no effect.
Or perhaps there is some finite precision in Quaternion.FromToRotation? Or my math is incorrect in some way?
I'd love a sanity check on the code or approach or if I should approach this problem from a different perspective.
EDIT: Here's an example gif of the functionality with m_EulerAngles code (so the rotation overshoots, but works in 3D - also I recorded the gif at lower fps that's not the game's framerate)

sentences:
Is it bad form to use singletons in unity I've heard a lot of people say singletons are bad practice and an 'anti-pattern',
like here,
this answer
this article
and here.
However, a lot of the reasons I've read about seem to be to do with dangers in their creation, them not being thread safe, difficult to destroy safely etc. But in unity where there are functions such as awake() and start() which are (as far as I'm aware) guaranteed to only be called once, are they unsafe to use?

sentences:
MMO, server-side line of sight I am working on a simple tile-based multiplayer game. I am rather experienced programmer, but not so experienced game developer.

The players will see each other depending if there is a blocking object between them or not. The objects can be moved around, so the map is not static.

If A moves (or performs other action) and B sees that (LOS is not blocked) then B client will be notified and will update it's view. If B does not see A, then B will not be notified.

Question:

Should I notify client A about B's movement regardless of LOS, perform all the LOS checking on the client-side and update the view accordingly, or...
should I do all the LOS server-side and notify client A only in case of visible movement?

I know than, in principle, I should not trust client-side and not send anything to the client that is not necessary (client code can be hacked and show movement out of LOS). But, if there is a significant number of players at once, then I am afraid than the server will not cope with tracking all LOS for all the events and all the players.

How to cope with this problem? Is there some "standard" solution here?
I know that it might be a premature optimization (I don't have this problem yet), but protocol and map data structure will depend on that.

P.S.

The client and the server will be open source, so hacking the client will be easy

sentences:
What is causing my skybox texturing issue? I am using the NVIDIA cubemap tool to generate my .dds file in Photoshop but I am unexpected results when the texture is loaded into my application.

I'm unsure as to whether this is caused by my code, or the texture generation in Photoshop. Does anyone know why this is happening?

The texture is being applied to a sphere and it seems to only be stretching down the centre of the sphere, the rest is ok.

The code I am using to generate the resource view

D3DX11_IMAGE_LOAD_INFO loadSMInfo;
    loadSMInfo.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
    loadSMInfo.BindFlags = D3DX11_DEFAULT;
    loadSMInfo.Depth = D3DX11_DEFAULT;
    loadSMInfo.Filter = D3DX11_DEFAULT;
    loadSMInfo.FirstMipLevel = D3DX11_DEFAULT;
    loadSMInfo.MipFilter = D3DX11_DEFAULT;
    loadSMInfo.MipLevels = D3DX11_DEFAULT;

    ID3D11Texture2D* SMTexture = 0;
    hr = D3DX11CreateTextureFromFile(_pd3dDevice, L"assets/textures/skybox/sky.dds",
        &loadSMInfo, 0, (ID3D11Resource**)&SMTexture, 0);

    D3D11_TEXTURE2D_DESC SMTextureDesc;
    SMTexture->GetDesc(&SMTextureDesc);

    D3D11_SHADER_RESOURCE_VIEW_DESC SMViewDesc;
    SMViewDesc.Format = SMTextureDesc.Format;
    SMViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
    SMViewDesc.TextureCube.MipLevels = SMTextureDesc.MipLevels;
    SMViewDesc.TextureCube.MostDetailedMip = 0;

    ID3D11ShaderResourceView * smrv;
    hr = _pd3dDevice->CreateShaderResourceView(SMTexture, &SMViewDesc, &fullcubemap);

Edit: I have changed the sphere to a cube and the texture is looking better quality on two of the faces, but the other faces are stretched and distorted. I'm going to try another texture.

https://i.gyazo.com/6d4556bd79b0e3adce156e631fb2f514.mp4

Edit: I believe the problem is in my shader, forgetting to set the w value on the position to 1.0f.

https://i.gyazo.com/e1fd41679e2257920aebff8d4c766118.mp4

Perhaps the only problem left is a wrong texture image?

sentences:
D3DXVec3Project returns odd values I would have thought that if the object is on-screen that this function should return screen coordinates. When used in conjunction with the directX draw text function, it works fine. Textual overlays track the 3D objects perfectly, however consider the following code:

D3DXVec3Project(&xyCoords, &HeadPosition(), &viewport, &matProjection, &matView, &matFinal);//for thought bubble

D3DXVECTOR2 origin = D3DXVECTOR2(
    (0.0f / SCREEN_WIDTH) * 2.0f - 1.0f,
    (0.0f / SCREEN_HEIGHT) * 2.0f - 1.0f);

D3DXVECTOR2 headPos = D3DXVECTOR2(
    (xyCoords.x / SCREEN_WIDTH) * 2.0f - 1.0f,
    (xyCoords.y / SCREEN_HEIGHT) * 2.0f - 1.0f);

lineRenderer.Draw2DLine(origin, headPos, D3DXCOLOR(1, 0, 0, 1), D3DXCOLOR(1, 1, 0, 1));

origin has a value of -1, -1 which is fine (texture coords for the screen go from -1 to 1 in each axis) but headPos has the value of -1.#IND000 in both the x and y. I think this may be because D3DXVec3Project is returning MASSIVE numbers, although I could be wrong.

Who knows what's going on under the hood of DrawText_A in the following code, but it clearly compensates for whatevers not working with the above code.

D3DXVec3Project(&xyCoords, &HeadPosition(), &viewport, &matProjection, &matView, &matFinal);

    rct.left   = xyCoords.x;
    rct.right  = xyCoords.x;
    rct.top    = xyCoords.y;
    rct.bottom = xyCoords.y;

    m_font->DrawTextA(NULL, stateStream.str().c_str(), -1, &rct, DT_LEFT|DT_NOCLIP ,   D3DXCOLOR(1,0,0,1));

This all works perfectly. Where am I going wrong with the first bit of code?

EDIT - the code below gives me the following values (also listed below)

D3DXVECTOR2 origin = D3DXVECTOR2(
    (0.0f / 1280.0f) * 2.0f - 1.0f,
    (0.0f / 720.0f) * 2.0f - 1.0f);

D3DXVECTOR2 headPos = D3DXVECTOR2(
    (xyCoords.x / 1280.0f) * 2.0f - 1.0f,
    (xyCoords.y / 720.0f) * 2.0f - 1.0f);

for origin I get (-1, 1.2) and for headPos I get (0, 1.401e-043#DEN). FYI HeadPosition() will return a vector3 that has a 0 z component and x and y values from about 2 to roughly 33.

Now how on earth can me with a calculator be better than the computer? what am I missing?

0.0f / 720.0f) * 2.0f - 1.0f should clearly = -1, not 1.2! what is going on?

0 / anything = 0, 0 * 2 = 0, 0 - 1 = -1!!!

sentences:
Cocos2D Command-Line Application Is it possible to create a terminal application which uses cocos2d? I've tried to make one using cocos2d 2.x, but it requires a MacGLView to be initialized.

I need it so that I could program a terminal application that generates a screenshot given a TMX file and an optional preferred width or height parameter (for resizing). Then I can automate the generation of map previews for my game, instead of manually taking screenshots. It's not practical to load the actual TMX and resize it inside the game (what I'm currently doing), because each TMX file has 7 layers, my tile sheet is huge, and I have lots of levels.

sentences:
How do I detect and remove completed rows of blocks in Tetris? I am making Tetris for a learning experience in XNA, and I'm having trouble deleted completed rows.

I am having an issue with deleting rows, for some reason when I go to delete a row, I end up creating more blocks or not deleting all of the blocks in the row. The method I am using to detect and remove blocks is as follows:

    // 'rowCount' is an int[20] holding the number of blocks in each row
    // (my playing field is 20 rows tall and 10 blocks wide).
    for (int i = 0; i < rowCount.Length; i++)
    {
        if (rowCount[i] >= 10)
        {
            // The row is full, remove the blocks.
            // 'blocks' is a list of all blocks that have settled.
            for (int j = 0; j < blocks.Count; j++)
            {
                if (blocks[j].Row == i)
                {
                    // If the settled block is in this row, remove it.
                    blocks.RemoveAt(j);
                    rowCount[i]--;
                }
            }

            // Move any blocks above the now-empty row down one row.
            foreach (Block b in blocks)
            {
                if (b.Row < i)
                {
                    b.Row++;
                    rowCount[b.Row]++;
                }
            }
        }
    }

This is done in my main Update method after I've determined if the current block has settled or not.

As implemented, this algorithm will usually end up recording more than ten blocks in some rows and will not correctly clear completed rows and move the rows above down one unit. Why is this, and what can I do to fix the algorithm?

sentences:
abstracting window and move semantics I am using GLFW to manage OpenGL context and as such, delegate this task to a GLFW window. For managing the pointer to a window instance, I am thinking a class like this:

class window_t {
public:
    using win_handle = GLFWwindow*;

    window_t(size_t width, size_t height, const std::string &title)
    {
        // Initialize GLFW
        if (!glfwInit())
            std::exit(EXIT_FAILURE);

        // Set up OpenGl core profile
        ...

       // Open the window
       w = glfwCreateWindow(width, height, title.c_str(), NULL, NULL);

       if (!w) {
            glfwTerminate();
            std::exit(EXIT_FAILURE);
       }

        glfwMakeContextCurrent(w);
    }

    void swap_buffers()
    {
        glfwSwapBuffers(w);
    }

    void poll_events()
    {
        glfwPollEvents();
    }

    void terminate()
    {
        glfwTerminate();
    }
    bool about_to_close()
    {
        return glfwWindowShouldClose(w);
    }

private:
    win_handle w;
};

Think something similar. In my display_t class, I have an instance of window_t and an instance of scene_graph. Functions on my scene graph are like render(window_t), handle_input(window_t) etc. What would my strategy should be in passing around these window instances? These are actually a handle to GLFW window and OpenGL context. It is not desirable to copy them because some parts of these context variables are living in VRAM and relates to GPU state. So if I want to change the context variables on say handle_input(window_t), copying the window would defy the purpose. On the other hand, I don't want to pass raw pointers around. I can do a singleton maybe, considering I probably won't have multiple windows and OpenGL contexes. I am not really sure about this one though. And they say, singleton is as good as a global variable.

Maybe I should make window_t moveable but not copyable, making it hold a unique_ptr or something like that. I want to use value semantics as much as I can.

I really don't know the correct abstraction here. What would you suggest? Should I get rid of passing a handle to window to each object in scene graph? I am actually looking for a way to do this but all render calls, input handling etc. modifies the context variables. Want to hear your suggestions on this.

sentences:
Unity Input System: Rebinding composite parts I have controls for movement defined as composite Binding through Vector 2D.

I have shown in settings any single binding which is not composite. I understood that I must get a composite index for binding, which is correct, I got the right binding like up, down, ...
But whenever I click on button for change something on Move, whole game freezes. And I can't do anything... Is there something I'm missing, when rebending part of composite?
Here is my code and screen, how the control settings looks.
public void Start()
{
    Button.onClick.AddListener(() =>
    {
        Key.Text = "Listening";

        _operation = Action.PerformInteractiveRebinding()
            .WithTargetBinding(BindingIndex)
            .Start();

        _operation.OnApplyBinding((op, path) =>
        {
            Action.ApplyBindingOverride(BindingIndex, path);
            Key.Text = Action.bindings[BindingIndex].ToDisplayString();
            _operation.Dispose();
        });
    });
}

sentences:
Does the feature level affect multisampling? I'm using DirectX 11 with the feature level 9_3 even though my computer could run 11_0, but I want to support older hardware as well.

I'm using CheckMultisampleQualityLevels to check whether multi sampling with the given samplecount is supported or not. However it returns 1 for quality with 4samples. And with 8samples it returns 0 (so its not supported). With feature level 11_0 CheckMultisampleQualityLevels returns 1 for 8samples. I'm using a AMD/ATI Radeon HD5830. In the most DirectX9 games I can still use 8x antialiasing. So why is it not supported in DX11 with a lower feature level.

Another point is it seems like 4samples doesnt really affect the output:

With mutlisampling disabled the result is the same. I'm sure that I configurated ms correctly.. even in the Depthbuffer.

Whether I enable AntialiasedLineEnable in the RasterizerDesc or not the output is still the same.

I searched in MSDN but I couldn't find any more information about multisampling.

EDIT: The blacklines in the picture are outlines made in the pixelshader

sentences:
XNA Texture mapping on model I have a cube as my model and want to map a texture on every side of the cube. I have been searching for a while and most answers suggest using 3D max or using VertexPositionTextures.

I am not allowed to use any moddeling program, I have to use XNA, so that is not an option.
For VertexPositionTextures you have to provide a Vector3 and a vector2 containing the position and the some area of your texture. But then, why would I use a model if I provide the position myself? Do I get this wrong maybe?

I tried to add the texture to my effect with effect.texure = ... but I can't specify what to map. It just puts the texture on my model.

So how can I map a texture to my model and specify what and where to map?

sentences:
Implementing Camera Zoom in a 2D Engine I'm currently trying to implement camera scaling/zoom in my 2D Engine.
Normally I calculate the Sprite's drawing size and position similar to this pseudo code:

render()
{
    var x = sprite.x;
    var y = sprite.y;
    var sizeX = sprite.width * sprite.scaleX; // width of the sprite on the screen
    var sizeY = sprite.height * sprite.scaleY; // height of the sprite on the screen
}

To implement the scaling i changed the code to this:

class Camera
{
    var scaleX;
    var scaleY;
    var zoom;
    var finalScaleX; // = scaleX * zoom
    var finalScaleY; // = scaleY * zoom
}

render()
{
    var x = sprite.x * Camera.finalScaleX;
    var y = sprite.y * Camera.finalScaleY;
    var sizeX = sprite.width * sprite.scaleX * Camera.finalScaleX;
    var sizeY = sprite.height * sprite.scaleY * Camera.finalScaleY;
}

The problem is that when the zoom is smaller than 1.0 all sprites are moved toward the top-left corner of the screen. This is expected when looking at the code but i want the camera to zoom on the center of the screen.

Any tips on how to do that are welcome. :)

sentences:
Optimization of linear solving for small matrices (10x10) How to optimize the hell out of linear system solving for small matrices (10x10)? This would be used in an AR engine for a few games, but has to be done very fast.

This solver is to be executed in excess of 1 000 000 times in microseconds on an Intel CPU. I am talking to the extreme level of optimization used in graphiscs for computer games. No matter if I code it in assembly and architecture-specific, or study precision or reliability tradeoffs reductions and use floating point hacks (like many games, I use the -ffast-math compile flag, no problem). The solve can even fail for about 20% of the time!

Eigen's partialPivLu is the fastest in my current benchmark, outperforming LAPACK when optimized with -O3 and a good compiler. But now I am at the point of handcrafting a custom linear solver. Any advice would be greatly appreciated. I will make my final solution open source and share it here.

sentences:
Is there software that allows remote and collaborative work? How is it called? I am currently not in the game development industry and develop my own games using GameMaker, but as a high school student I don't really have the time to make proper titles and actually make money from them. But, I have been thinking. Is there a program/website that, just say you were doing a long distance development with multiple team members in different parts of the world/country, you can upload all your work and with the click of a button anyone else in the "group" automatically downloads it. So for example:

You are a coder working on the physics engine.
There is another coder (somewhere else in the world) that is in your group and is programming the player that relies of the physics engine.
You make a change to the physics engine
Instead of having to email your partner the updated coding file and him having to download it, you save your file to a program that automatically uploads it to a server
Every 5 minutes (or whatever) the server checks if either person has uploaded any new files and automatically downloads them and overwrites them
So in turn your partner stays with continuously updated code and so do you. This could work with any aspect of a game (or any group project).

So is there anything like this? If so, is there a name for it?

sentences:
Bold black bar on right side of game in Unity (Android) I am trying to create an endless runner. I have already created a system to generate infinite backgrounds from an array of some. However, on running the game, I get huge black bar on the right side of the screen, both on PC and on Android phone.

Here are the screenshots :

One more thing, on Android, it doesn't even display the left side of the game, i.e, where the character is. It looks like the things are displaced towards left.

Also, the game is a scrolling on and everything is scrolling but behind that bar. It just doesn't go.

I hope I can get some help. Ask me if you need any piece of code.

EDIT :

"CameraFollow" script

 using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour {

    public GameObject targetObject;
    private float distanceToTarget;

    // Use this for initialization
    void Start () {
        distanceToTarget = transform.position.x - targetObject.transform.position.x;

    }

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

        float targetObjectX = targetObject.transform.position.x;

        Vector3 newCameraPosition = transform.position;
        newCameraPosition.x = targetObjectX + distanceToTarget;
        transform.position = newCameraPosition;
    }
}

My "GeneratorScript"

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

public class GeneratorScript : MonoBehaviour {

    public GameObject[] availableRooms;

    public List<GameObject> currentRooms;

    private float screenWidthInPoints;

    // Use this for initialization
    void Start () {
        float height = 0.0f * Camera.main.orthographicSize;
        screenWidthInPoints = height * (Camera.main.targetDisplay);
    }

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

    }

    void FixedUpdate()
    {
        GenerateRoomIfRequred ();
    }

    void AddRoom(float farhtestRoomEndX)
    {
        int randomRoomIndex = Random.Range (0, availableRooms.Length);

        GameObject room = (GameObject)Instantiate (availableRooms [randomRoomIndex]);

        float roomWidth = room.transform.FindChild ("floor").localScale.x;

        float roomCenter = farhtestRoomEndX + roomWidth * 3.0f;

        room.transform.position = new Vector3 (roomCenter, 0, 0);

        currentRooms.Add (room);
    }

    void GenerateRoomIfRequred()
    {
        //1
        List<GameObject> roomsToRemove = new List<GameObject>();

        //2
        bool addRooms = true;

        //3
        float playerX = transform.position.x;

        //4
        float removeRoomX = playerX - screenWidthInPoints;

        //5
        float addRoomX = playerX + screenWidthInPoints;

        //6
        float farhtestRoomEndX = 0;

        foreach(var room in currentRooms)
        {
            //7
            float roomWidth = room.transform.FindChild("floor").localScale.x;
            float roomStartX = room.transform.position.x - roomWidth * 6.0f;
            float roomEndX = roomStartX + (roomWidth * 13.0f);

            //8
            if (roomStartX > addRoomX)
                addRooms = false;

            //9
            if (roomEndX < removeRoomX)
                roomsToRemove.Add(room);

            //10
            farhtestRoomEndX = Mathf.Max(farhtestRoomEndX, roomEndX);
        }

        //11
        foreach(var room in roomsToRemove)
        {
            currentRooms.Remove(room);
            Destroy(room);
        }

        //12
        if (addRooms)
            AddRoom(farhtestRoomEndX);
    }

}

(I tried playing with the numbers on GeneratorScript, but nothing seemed to help.

sentences: Simple message box in gdscript / godot I want a single line of code which shows a popup dialog with the words "Hello World!" and an "Ok" button.  (I want something simple for now, I know how to make something more complicated but that would be stupid at this point in development).

sentences:
Unity General Prefab I have 2 questions about how i should approach this.

I want to make a 2D game, with alot of different creatures.

Question one: If i have alot of monsters and i'm using ScriptableObjects, since they have very similar variables. How can i make one Enemy prefab which will load the right ScriptableObject information? For example i have an Enemy Prefab, then it will load random monster between: Dragon, Frog, Wolf. How can i achive this without creating 3 new Prefabs for each one and instead load just the right ScriptableObject.

Question two: Should i create new prefab for each monster? Or is approach 1 the right way to do it, if you plan to expand over 100+ creatures.

Thanks

sentences:
Best way to create icon for UI , based on 3d model player can use in game I'm trying to figure the best way to create icon (for UI) from my 3d model (object) that player can use in the game.
Maybe this is a silly question, but: how do you create icon ?
Do you create a new scene, place object and use a "shift-print" to take screenshots ?

Others way ?

Thanks

sentences:
Pan camera within bounds of large image I have a camera that I pan around a large image which works fine, however when I reach the end of the image I can keep panning on and on, forver. I have looked everywhere for an answer on how to prevent this but the only one I found did not use panning and I could not get it to work.

My code atm is very simple:

map.setPosition(-map.getWidth()/2, -map.getHeight()/2);

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
        return true;
    }

My Image is very large, 4096x4096, and my camera is 480x800. My problem is I have no idea how to get the distance I have panned, and even if I did I dont know how to stop a pan from moving past a certain point, just setting camera position won't work because then there will be a "bounce" back.

Basically I have a rectangle inside another rectangle, and the inner rectangle should not be allowed to move outside the larger. But as I said I don't really know where to start since I can't get the panning distance.

Ex of something I've tried:

@Override
public boolean touchDown(float x, float y, int pointer, int button) {
    startX = x * PAN_SPEED;
    return false;
}

@Override
public boolean pan(float x, float y, float deltaX, float deltaY) {
    if(-totalX > map.getX() + cam.viewportWidth/2){
        cam.translate(-deltaX * PAN_SPEED, deltaY * PAN_SPEED);
        cam.update();
    }
    return true;
}

@Override
public boolean panStop(float x, float y, int pointer, int button) {
    endX = x* PAN_SPEED;
    totalX += endX - startX;
    System.out.println("pan: " + totalX + ", map: " + map.getX());
    return true;
}

This is just a test, basically I can't move anymore after I hit the left border of the image, but totalX still keeps adding up so this will not work.

EDIT: Got it to work, code below:

@Override

public boolean pan(float x, float y, float deltaX, float deltaY) {
        cam.translate(-deltaX, deltaY);
        keepCameraInBounds();
        cam.update();
    return true;
}

private void keepCameraInBounds () {
    OrthographicCamera c = this.cam;
    Vector3 camPos = c.position;
    float HW = c.viewportWidth / 2, HH = c.viewportHeight / 2;
    camPos.x = MathUtils.clamp(camPos.x, map.getWidth()/2 - map.getWidth() + HW, map.getWidth() - map.getWidth()/2 - HW);
    camPos.y = MathUtils.clamp(camPos.y, map.getHeight()/2 - map.getWidth() + HH, map.getHeight() - map.getHeight()/2 - HH);
}

sentences:
Where should I put the code for objects interactions? I'm working on a 2D puzzle game, and one of the features is the ability to push crates so you can climb on top of them to get to a destination.

I've tried many things to get this to work but none of them succeed.

My main problem is that I don't know where to put my code. For example, I don't want to handle the movement of the crate in the player class because that wouldn't be neat, the same way some people say something along the lines of "If you're making chess, the rules of the pawn and knight shouldn't be in the rules of the queen".

If anyone has an answer or could provide a pseudo-code explanation it would be appreciated.

sentences:
In XNA, should I use the built-in game component classes? I'm just getting started on an XNA game for Window Phone 7. For my Flash games I have my own framework that I was just going to port from AS3, but I have just found the built-in game component stuff in XNA. So should I use this stuff? Should my Entity class extend game component/drawable game component? I'm sure it will be quicker just to port my AS3 code, but I thought this built-in stuff may have some advantages?

UPDATE: I decided not to use them. It doesn't seem that they are meant to be used in the way I described.

sentences:
UDP sending important data often - Should I use a reliable send or unreliable with resend? I'm making a multiplayer RPG. My problem is that I send player data very often (100 ms), that contains:

Position (float x, y, z)
Radius (float angle)
Animation (int16_t id)

And because the package is unreliable, sometimes packets are lost and here the problem starts. The packet is only sent if something changes, like animation; but animation is important, they must arrive to the clients.

So the question is, should I change reliability to reliable? Or just split packet into two? Or simply resend packet?

sentences:
What should developers do when they receive conflicting feedback about their game? I've been working my first mobile game (I have done a lot of web and PC games before).

I wanted the idea to be simple but fun. The thing is, I received feedback from friends and family and I have heard a lot of contradictory opinions about my game. Some would say that the game is addictive, challenging and fun, while other didn't see it as a fun game and said it was boring or not really good enough.

Now that I have these two opposite opinions I don't know if my game is good or not.

What opinion should I listen to, and how am I supposed to know if the game is fun or not when people's opinions are mixed?

sentences:
Matrix Translation Transformation Question I've been reading a lot about computer graphics lately and because of it I'm building my own math library's for fun.  I was reading about Matrix Translation and Homogeneous Coords, and was wondering if these two both translate the x factor by 3.

{ 1, 0, 0, 3 } = { 1, 0, 0, 0 }
{ 0, 1, 0, 0 } = { 0, 1, 0, 0 }
{ 0, 0, 1, 0 } = { 0, 0, 1, 0 }
{ 0, 0, 0, 1 } = { 3, 0, 0, 1 }

I guess what i'm really asking is if I wanted to preform a translation would both of these be exceptible or only the first?

sentences:
LWJGL int vertex attribute not working in shader I'm trying to send an integer attribute to my GLSL shader. The shader receives the attribute as follows:

layout (location = 3) in int integer_value;

I'm creating the attribute as follows:

glBindBuffer(GL_ARRAY_BUFFER, this.integerValueVboId);
glBufferData(GL_ARRAY_BUFFER, integer_values_buffer, GL_STATIC_DRAW);
glVertexAttribPointer(3, 1, GL_INT, false, 0, 0);

this.integerValueVboId is a valid ID generated with all the other VBOs. integer_values_buffer is an IntBuffer confirmed to contain the correct integer values.

When I set one of the integer values to 1, the shader receives the integer value 1065353216, which I have found to be the value obtained when one interprets a float 1.0f as an integer value.

sentences:
3D Paint tool in Maya Hey everyone, could someone help me out on this question?
When I am trying to texture objects in maya (for example a barrel) I want to texture it with a brush. When I try to use the 3D painting tool it al gets black even when I have a image file selected. Also the resolution is very very low of the models and textures in maya, though the texture image is very high quality. Can someone please help me? Thanks so much for helping.

sentences:
Perfect FPS camera angle I am making a multiplayer FPS and I am in search of some helpful tips on the perfect FPS camera angle. Because it is a multiplayer, I am making a full body model holding the gun, I find, however, that some of the gun positions (when held naturally) seem awkward when placing the camera on the position of the characters eyes. Moving the camera has other consequences, for example, when moving the camera to a more appropriate fps position, when looking at your feet, it seems that your head is too far right, as your point of view is past your left foot..

Any expert advice?

sentences: Who makes the art assets for mobile games? I know how to develop apps for Android but never tried developing games, and I want to start soon. For developing games we need sounds and high quality images (say a background, characters, logos, etc.), so how to create these? For this should we have a separate team? Or a developer can create these using any tools?

sentences:
Smooth Camera Offsets I am attempting to implement a sort of, smooth camera that has angle offsets from the player as they turn, creating a cinematic effect as well as visual feedback for when the player turns.

Here is an example of the desired functionality.
(Starts at 1:06)
http://youtu.be/uJ6tD-k_RuA?t=1m6s

One idea I was thinking of (if even feasible) is to store a "desired quaternion" of orientation of where the camera wants to look (preferably the player's quaternion of orientation)  and a "current quaternion" of the cameras orientation and SLERP to the desired quaternion. Then possibly set a max angle between the two rotations to cap how large the angle offset could be.

What are the ways of doing that?

sentences:
2D open world MMORPG; big map memory problem I am developing an 2d open world mmorpg game for learning purposes, and have a issue with big maps.
A year ago i developed 2d open world single player / co-op game. It saved map in chunks, and AI for NPCs starts 'ticking' when specified map chunk is loaded.
In my mmorpg game, NPCs AI is handled by server, and its always 'ticking' in some specified interval. That is where my troubles begin. I want NPC to walk in random directions. For this to work, I have to check map collision for every step, so my NPC wouldn't end up in wall. Problem is when I have big map, for example 10000x10000, and every tile is represented with 6 bytes, that is about 572MB of map data my server must hold in memory all the time, and i cant load just few map chunks, like in my single player RPG because of lot NPCs AI needs to be updated all the time, even if player is not located near by.
My goal is to archive map size of 50000x50000 tiles. I know its possible because i seen 2d mmorpgs with huge open worlds, a lot bigger then 50000x50000, and I doubt that their server have 20GB of ram to waste just on maps.
If anyone have any ideas how I can lower memory usage, I woud like to hear you.

Thanks in advance, and sorry for my bad english

sentences:
Instantly snap into specific directions? In my 2d setup, I want the player to constantly move in a specific direction at a set speed. It's similar to "Snake" in that you can only move in four directions and you can't stop your movement.

Right now, the way I do this is by having a char variable "direction", which can either be u, d, l, r (take a guess what those stand for). Based on those letters, I use GetComponent().MovePosition and increase/decrease the position on the x or y axis.

Is there a better way to do this? I would prefer if I could just enter the degree (0, 90, 180, 270) to make the player move in the right direction. I tried AddForce but I couldn't get it to work.

Side note: it's important for me that I can set the direction without player input, as there are some objects that force the player into a different direction.

Edit: As the tag would suggest, I'm looking for a Unity specific answer, as I'm not sure which function would best suit my needs.

sentences:
Working out velocity/time based on physical pixels moved In my game I integrate like so: (Please assume all variables to be declared)

sprite.xTimeInSeconds = 5.0; //Time in seconds it should take this object to cross screen
sprite.xVelocity = 1f/xTimeInSeconds;

And then I move it like so:

sprite.gridX+=sprite.xVelocity*dt;
sprite.x=sprite.gridX*screenWidth;

Then I simply render the sprite at those coordinates:

sprite.draw();  //Uses sprite's internal 'x' which was set above

So, everything within the game itself works fine - ie. all movement is correctly scaled regardless of device, but now I'm trying to write my own swipe/fling touch control system for a menu.

The menu does work - the user can place finger on screen, move up and down and when they release their finger, the menu keeps scrolling(* see below).  If they then press their finger down again, the scrolling stops immediately, as one would expect.

The only thing I'm having problems with is how to 'decelerate' the scrolling when the user releases their finger.  At the moment, it keeps scrolling at the same speed until it reaches it's limits or the user taps the screen to stop it.

Within my touch-scroll method, I'm simply detemining how much the users finger has moved by and then moving my objects by the same amount.  What I need to know (and can't figure out), is how can I - from knowing only the amount of pixels moved, work out the 'time' variable above?  (once I have this I can then decelerate at a scaled amount on all devices).

sentences:
2D Platformer Collisions I've basically asked this question before, and I know it's been asked probably a billion times, but I still can't seem to do it. All I want to know is how I should go about doing basic 4-way, rectangular collisions (up, down, left, right). I have been searching for an answer on and off for months and I can't seem to find it. All I need to know is some basic code examples (in Java, preferably) for how I would do this. I've tried a few different methods before, but they just don't seem to work (I can get certain sides to work, but not all of them at the same time). I'm making this game entirely from scratch and I'm using libgdx as my framework. I don't want to use Box2D or any other engine. Thanks in advance to anyone who will help me!

tl;dr: 4 way collisions, how do they work?

sentences:
Why is transform.up behaving differently for different functions? Can anyone please explain to me what i'm doing wrong here?

As I see it the raycast is the only one using transform.up correctly, though why not Debug.DrawLine() and _lineRenderer.SetPosition(1, transform.up * maximumBeamLength);

using UnityEngine;

[RequireComponent(typeof(LineRenderer))]
public class LaserBeam : MonoBehaviour
{
    [SerializeField]
    private float maximumBeamLength = 5f;

    private LineRenderer _lineRenderer;

    private void Start()
    {
        _lineRenderer = GetComponent<LineRenderer>();
    }

    void Update()
    {
        _lineRenderer.SetPosition(0, transform.position);
        RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.up);

        Debug.DrawLine(transform.position, transform.up * maximumBeamLength, Color.blue);
        Debug.DrawLine(transform.position, transform.up , Color.red);

        if (hit.collider)
        {
            _lineRenderer.SetPosition(1, new Vector3(hit.point.x, hit.point.y, transform.position.z));
        }
        else
        {
            _lineRenderer.SetPosition(1, transform.up * maximumBeamLength);
        }
    }
}

sentences: Can I use glTranslate and glRotate when my GLSL Version over (#version 120)? I was using "GLSL Version #120". But now i am trying to do one tutorial and it is using "gl_ClipDistance[0]" inside of vertex shader. And "GLSL Version #120" doesn't support "gl_ClipDistance[0]". Now i need to change GLSL Version with over #120 for example #330 . I also have to change "gl_ModelViewProjectionMatrix" inside vertex shader. But my question is i need to change glTranslate,glRotate,glLoadIdentity etc ?

sentences:
My game is not shown in Play Market New Releases I've published my app for like an 36 hours ago. It is possible to find it with exact search query ("Village Keeper") and it is available via the direct link.

Thing is I can't find it in "New Releases" ("New Free Games") and I can't find it by typing something like "village game" or "keeper". So I have only 3 installs by me and my friends.

Is it a bug or is a new app not guaranteed to get in "New Releases"? I tried to google it but found no answers. If so, how can indie developer get into the market with no money for an ad campaign?

P. S. I tried to contact Google Support twice and 24 hours after first email passed with no reaction.

sentences:
Unity 2019.3 - Tilemap colliders 2D + Componsite colliders + Platform effectors I am using tilemaps to create my own platform game. This is what I had in the first place.

This was working fine in first place, but is an issue. Sometimes, the enemies get stuck while running along the platforms. This was probably due to a similar issue that I had, when the player was getting stuck on the walls. It was solved by adding a composite collider. So I did the same to solve this problem. With the composite, it was looking like this:

This solved the issue too. But now comes the catch. Those elements are also platforms, meaning that I have to add a platform effector. And while this works, there is a small edge case...

If I am in a height where I do not reach the top of the platform, but can reach the bottom part, somehow it can stand on it. This was not happening before using the composite collider 2D.

Why is this happening? How can avoid this issue?

I am using Unity 2019.3.9f1

sentences:
Removing unecessary permissions from AndroidManifest that Unity+Plugins put in there? My game has a lot of unnecessary permissions added to it, I suspect some are coming from plugins and some from Unity. I've looked at all the AndroidManifest.xml files and couldn't find any that use those permissions so I suspect it's added as a post build process or some other way by the plugins wrapped up in a binary or something.

Is there a way to remove those permissions in a post process build step?

sentences:
Alternatives to Singletons / globals I've heard countless times about the pitfalls of Singletons / globals, and I understand why they're so often frowned upon.

What I don't understand is what the elegant, non-messy alternative is.  It seems that the alternative to using Singletons/globals always involves passing objects a million levels down through your engine objects until they reach the objects that need them.

For example, in my game, I preload some assets when the game starts up.  These assets aren't used until much later when the player navigates through the main menu and enters the game.  Am I supposed to pass this data from my Game object, to my ScreenManager object (despite the fact that only one Screen actually cares about this data), then to the appropriate Screen object, and anywhere else?

It just seems that I'm trading global state data for cluttered dependency injection, passing data to objects that don't even care about the data except for the purpose of passing it on to child objects.

Is this a case where a Singleton would be a good thing, or is there some elegant solution I'm missing?

sentences:
Using modified copyrighted music in non-commercial games Background: I'm making a retro style game for both fun, and an unofficial contest.

I have bought a song, song X. However, I then found notation for song X, and all the instruments. So basically, it's a program recreating song X in a sense.

I took the notation, and used another program to make it sound like a chiptune does (just for the fun of it, and it sounds good :P). However, I would like to use this in my game. It's non-commercial, but is this allowed? I would've said yes, because I'm not actually using the original, copyrighted song.

I think the main point is can I:

Use the music with no reference to the author
Use the music with a reference, since it's non-profit.
Not use the music at all since the melody and rhythm is copyright.

sentences:
Player object's model starts to shake after some time I created a default scene in a new project and imported a model from Unity's asset store and then get this strange behavior of the model starting to shake for no reason after some time after starting the game.

I also have a script to read keyboard input and then apply forces to the model when the player presses some keys but the shaking of the model starts to happen even when the player does absolutely nothing.

I'm really confused and have no idea where to look for a problem and google doesn't seem to have a solution to this either.

sentences:
How is JS source protected in Chrome games? I was playing a space arcade shooter https://moonbreakers.com/ and tried to see some of the JS and shader code. However, I was unable to find anything but some server communication code. Game code is thus probably run on servers, but the shaders should at least be local, right? And I have understood that even if the server runs the true game state, clients commonly do some physics interpolation etc by themselves.

My only guess is that the game gets the code with jQuery and it doesn't show in the page source. Can that code be looked at via a debugger?

sentences:
How to fetch unit coordinates for AI? I have been designing a simple turn based Civ-like game over the last two days with libGDX to test myself.  I have a units class that can be extended to make unit types and I have my game board set up.  Everything is almost done... except for the AI, specifically the unit AI.  I want to collect all active units into two seperate arrays (the libGDX array), one for the human player and one for the AI units.  I will not be using diplomacy for the sake of simplicity.

I first tried Array<Unit> playerUnits = new Array<Units>(); and calling the playerUnits.get(index) method to return the unit.  My thought process seems to not be logical, though, as I found there was no way to get the x and y coordinates of units that do not yet exist (all units have to be built in factories in game).  Next, I tried to store x and y coords in an XYCoords method, however there was no built in way to add units to the array later.

I have my pathfinder implemented (with a few minor bugs that cause units to flicker once moved) and now need to simply add the reaction to units.  I have no idea how to do this and as you have probably guessed by now I have never had to implement a more complex AI than one that follows the player mindlessly.  Has anyone had a similar problem that could somehow help me?

sentences:
How to handle physics of moving platforms in a platformer? So after a few hours of searching on the internet, I have yet to find a pleasing answer on how to handle moving platforms in a 2d platform game. So I decided to make a simple prototype where you interact with 2 different platforms, one that moves vertically and one horizontally. I would love some help to dissect and see what isn't working, and how to fix them. I have submitted the .fla file + .as file below, accompanied with a link to the playable .swf.

The goal is to make the Hero interact with the platforms as if they were solid objects that he can stand on, pushed alongside with, jump on/under etc etc.

The problems with my prototype are these:

When you stand on the horizontally moving platform, without moving (not touching any keys), the Hero moves along with platform, but with a slight delay causing hero to slide back a little.
When you stand on the horizontally moving platform, and jump, you move along with the platform midair (some games prefer having it like this, but it doesn't feel natural and is not wanted here). Which might be caused by the Hero retaining the velocity on the X-axis from the platform.
When you jump up to the bottom side on the vertically moving platform, whilst the platform is moving downwards, you sink inside it for a brief second. Hero penetrates through as if the collision was non existent for a moment.
When you jump on vertically moving platform, the veloctiy on Y-axis is retained, so when you walk off the platform, you fall down at a higher speed. With the speed of the retained velocity, + gravity that is added (this is mostly because I cant figure out a way to reset velocity on Y-axis to 0 when you land on the platform, without the player freezing midair).

I'm a novice programmer so I am sure there are BETTER ways to do this, and I would love to hear them all. Any ideas on how to improve the code or other methods in which you can implement moving platforms into a Tilebased game are welcome. In the end, I am trying to find a solid way to handle moving platforms in 2d platformers.

Playable SWF:  http://dl.dropbox.com/u/28271061/PlatformerhowtoFLA.html (Move with arrow keys, Jump with X key, Run with Z key)

Sourcecode AS-file: http://dl.dropbox.com/u/28271061/Platformerhowto.as

SourcefileFLA:  http://dl.dropbox.com/u/28271061/PlatformerhowtoFLA.fla

If you prefer just to read the code through Pastie online: http://pastie.org/2266764

sentences:
What is the difference between .obj files and Collada files? I am currently making a game in java using LWJGL 2.9 and I am wondering what the difference between the .obj format and .dae format is. Currently I can load .obj files and would like to load .dae files as well.

Any information on .dae files would be great.

sentences:
Designing for multiple screen resolutions and aspect ratios, target one resolution then scale to meet others or use normalized values? I feel like what I'm currently doing is stupid but would just like reaffirmation it is. Basically I'm writing games which target a certain screen resolution (800x480), so all positions, widths and heights I set for sprites is for that resolution.

On the engine side I have special scalers which will change the width and height of what is being drawn to meet the current platforms res, so for example if the platforms screen res is 1200x720 I will stretch a sprite by a factor of:

1280 / 800.0f;
720 / 480.0f;

Positions are also offset and manipulated in a similar way.

I really feel I should move to a normalized system for widths and positions (i.e. 0 to 1) but at the same time feel this is more intuitive since the first platform I target is 800x480 and I already kind of have a good udnerstanding of dimensions and such for that.

So my question is, is it really that bad to target a specific ccreen res then in the engine side modify this res to meet different platforms?

sentences:
Checking if an object is inside bounds of an isometric chunk How would I check if an object is inside the bounds of an isometric chunk? for example I have a player and I want to check if its inside the bounds of this isometric chunk.
I draw the isometric chunk's tiles using OpenGL Quads.

My first try was checking in a square pattern kind of thing:

e = object;
this = isometric chunk;

    if (e.getLocation().getX() < this.getLocation().getX()+World.CHUNK_WIDTH*World.TILE_WIDTH && e.getLocation().getX() > this.getLocation().getX()) {
        if (e.getLocation().getY() > this.getLocation().getY() &&   e.getLocation().getY() < this.getLocation().getY()+World.CHUNK_HEIGHT*World.TILE_HEIGHT) {
            return true;
        }
    }
    return false;

What happens here is that it checks in a SQUARE around the chunk so not the real isometric bounds. Image example: (THE RED IS WHERE THE PROGRAM CHECKS THE BOUNDS)

What I have now:

Desired check:

Ultimately I want to do the same for each tile in the chunk.

EXTRA INFO:

Till now what I had in my game is you could only move tile by tile but now I want them to move freely but I still need them to have a tile location so no matter where they are on the tile their tile location will be that certain tile. then when they are inside a different tile's bounding box then their tile location becomes the new tile. Same thing goes with chunks. the player does have an area but the area does not matter in this case. and as long as the X and Y are inside the bounding box then it should return true. they don't have to be completely on the tile.

sentences:
When is a quadtree preferable over spatial hashing? I'm making a 2d platformer with lots of objects at the same time. They're all AABB collision detected. I first tried a quadtree to decrease the number of of objects to check, tried a few different configurations, but it didn't prove as effective as I needed. I implemented a spatial hash and it's way more efficient, the number of objects to check for each collision went down drastically.

Is there a case when doing 2d collision detection using a quadtree is preferable over spatial hashing? According to my tests, it seems spatial hashing always ends up with less objects to be tested for collision?

I haven't done timing over the algorithms, but is hashing simply very expensive or difficult to implement when you're, for example, coding in C?  Worth noting is that I'm writing the game in javascript, where you have hashing "for free".

Here's the comparison, did I overlook something? http://zufallsgenerator.github.io/2014/01/26/visually-comparing-algorithms/

sentences:
How can I override OnTriggerEnter? I am trying to extend Unity's BoxCollider class.  So I am extending it in the editor like such:

using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(BoxCollider))]
public class MyBoxCollider : Editor
{
    public override void OnInspectorGUI()
    {
        EditorGUILayout.LabelField("My Box Collider");
        base.OnInspectorGUI();
    }
}

However, I cannot figure out how to override OnTriggerEnter, OnCollisionEnter, etc.

How can I override these?  They appear to be declared as private in the base class.

My end goal is that when I add a BoxCollider to a GameObject, it has a label in addition to its normal stuff. Then when BoxCollider's OnTriggerEnter method is called, it prints out what the label says before continuing on about its business. (This is a simplification, but I think it helps clarify my objective.)

sentences:
Improving performance of a particle system (OpenGL ES) I'm in the process of implementing a simple particle system for a 2D mobile game (using OpenGL ES 2.0).  It's working, but it's pretty slow.  I start getting frame rate battering after about 400 particles, which I think is pretty low.

Here's a summary of my approach:

I start with point sprites (GL_POINTS) rendered in a batch just using a native float buffer (I'm in Java-land on Android, so that translates as a java.nio.FloatBuffer).

On GL context init, the following are set:

GLES20.glViewport(0, 0, width, height);
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
GLES20.glEnable(GLES20.GL_CULL_FACE);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);

Each draw frame sets the following:

GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE_MINUS_SRC_ALPHA);

And I bind a single texture:

GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureHandle);
GLES20.glUniform1i(mUniformTextureHandle, 0);

Which is just a simple circle with some blur (and hence some transparency)

http://cl.ly/image/0K2V2p2L1H2x

Then there are a bunch of glVertexAttribPointer calls:

mBuffer.position(position);
mGlEs20.glVertexAttribPointer(mAttributeRGBHandle, valsPerRGB, GLES20.GL_FLOAT, false, stride, mBuffer);

...4 more of these

Then I'm drawing:

GLES20.glUniformMatrix4fv(mUniformProjectionMatrixHandle, 1, false, Camera.mProjectionMatrix, 0);
GLES20.glDrawArrays(GLES20.GL_POINTS, 0, drawCalls);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);

My vertex shader does have some computation in it, but given that they're point sprites (with only 2 coordinate values) I'm not sure this is the problem:

#ifdef GL_ES
// Set the default precision to low.
    precision lowp float;
#endif

uniform mat4 u_ProjectionMatrix;

attribute vec4 a_Position;
attribute float a_PointSize;
attribute vec3 a_RGB;
attribute float a_Alpha;
attribute float a_Burn;

varying vec4 v_Color;

void main()
{
vec3 v_FGC = a_RGB * a_Alpha;
v_Color = vec4(v_FGC.x, v_FGC.y, v_FGC.z, a_Alpha * (1.0 - a_Burn));
    gl_PointSize = a_PointSize;
    gl_Position = u_ProjectionMatrix * a_Position;
}

My fragment shader couldn't really be simpler:

#ifdef GL_ES
    // Set the default precision to low.
    precision lowp float;
#endif

uniform sampler2D u_Texture;
varying vec4 v_Color;

void main() {
    gl_FragColor = texture2D(u_Texture, gl_PointCoord) * v_Color;
}

That's about it.  I had read that transparent pixels in point sprites can cause issues, but surely not at only 400 points?

I'm running on a fairly new device (12 month old Galaxy Nexus).

My question is less about my approach (although I'm open to suggestion) but more about whether there are any specific OpenGL "no no's" that have leaked into my code.

I'm sure there's GL master out there facepalming right now... I'd love to hear any critique.

sentences:
(Phaser) Preload Future States in Create? I'm a first time user of Phaser, been trying to make a simple point and click type game. I'm trying to keep things very modular, so I'm defining a list of levels (states) in a JSON, and then every level has its own JSON containing the objects within that level.

However, I'm encountering an issue in that, when changing states, I get a black flash while the assets for the next state load (this happens whether I iterate through the JSON list or define everything manually). From what I've read, all sprites should be loaded in the preload stage, however, by doing this I'm causing that tiny but noticeable black pause.

I know one way would be to simply load every asset at the start of the game, but that seems incredibly inefficient (wouldn't that fill up the memory immensely?). I would rather load a state's assets from the "parent" state. However, in my quick test (which maybe I did wrong) it seems that game.load doesn't work properly if done within the create stage? What is the best approach to doing this?

sentences:
Drawing and rotating bitmaps (with transparency) efficiently in Android I just started making a game for Android and I'm already having some issues regarding performance.

You can imagine the game as being some kind of Tower Defense game with a top-view, and the enemies can move in all directions, so I need to be able to make the sprites rotate in all directions.

I'm currently using a sprite-sheet with transparency for the enemies and using canvas.rotate() to make all the enemies face a given target.

When there are 60 enemies on screen, it takes about 25ms to rotate and draw the enemies, but if I remove the rotation part, it takes about 7 ms. In itself, it doesn't seem too bad, but there are going to be many more enemies at once on screen eventually, with projectiles, other entities, etc. and I'm drawing the background tile by tile (around 80 tiles), so that's 80 more bitmaps to draw, although at the moment it's only 4 different bitmaps being drawn multiple times.

Here is part of the code that draws and rotates the enemies:

In the "render" method in a SurfaceView, called in the gameloop:

for (Enemy enemy : level.getListEnemies()) {
        if (enemy.isVisibleInView(level.getCamera(), screenWidth, screenHeight)) {
            enemy.draw(level.getCamera(), level.getAngle(enemy), canvas, paint);
        }
    }

Enemy.draw:

public void draw(Camera camera, float angle, Canvas canvas, Paint paint) {
    float x1 = this.getPosX() - level.getCamera().getOffSetX() - this.getSizeX() / 2;
    float x2 = this.getPosX() - level.getCamera().getOffSetX() + this.getSizeX() / 2;
    float y1 = this.getPosY() - level.getCamera().getOffSetY() - this.getSizeY() / 2;
    float y2 = this.getPosY() - level.getCamera().getOffSetY() + this.getSizeY() / 2;

    // Rectangles declared in the constructor, change depending on which frame to draw
    drawingLocation.set((int) x1, (int) y1, (int) x2, (int) y2);
    imageSubset.set((int) (frameId * getSizeX()), 0, (int) (frameId * getSizeX() + getSizeX()), (int) getSizeY());

    canvas.save();

    canvas.rotate(angle, x1 + sizeX / 2, y1 + sizeY / 2);
    canvas.drawBitmap(knightAttack, imageSubset, drawingLocation, paint);

    // Heath bars
    paint.setColor(Color.RED);
    canvas.drawRect(new Rect((int) x1, (int) (y2) + 10, (int) x2 + 10, (int) y2 + 14), paint);

    paint.setColor(Color.GREEN);
    canvas.drawRect(new Rect((int) x1, (int) (y2) + 10, (int) (x1 + (((x2 + 10) - x1)) * this.currentHealth / this.maxHealth), (int) y2 + 14), paint);

    canvas.restore();

    // Change frame in the image every SPRITEFRAMELENGTH
    if(frameCount++ % SPRITEFRAMELENGTH == 0){
        frameId++;

        if(frameId > MAXFRAMEID){
            frameId = 0;
            frameCount = 0;
        }
    }
}

Those times I mentionned earlier are by using:

SurfaceView.getHolder().setFormat(PixelFormat.RGB_565);

And creating the images (once, all the enemies use the same image reference):

BitmapFactory.Options op = new BitmapFactory.Options();
op.inPreferredConfig = Bitmap.Config.RGB_565;

Bitmap image = (Bitmap)BitmapFactory.decodeResource(context.getResources(), imageId, op);

if(resizeWidth != 0 && resizeHeight != 0) {
    image = Bitmap.createScaledBitmap(image, resizeWidth, resizeHeight, true);
}

But I noticed that if I don't specify RGB_565, it is much slower because of transparency, especially for the background, which don't have transparency. What's even weirder is that using RGB_565 works properly on my Galaxy Nexus, but on my friend's S3, some images (with transparency) are not displayed at all. I'm using 4.2.1 and he's on 4.1.1.

So, how can I rotate my images more efficiently? Would using OpenGL improve performance a lot or would it be about the same? Is there a better solution?

sentences:
Sprite/Tile Sheets Vs Single Textures I'm making a race circuit which is constructed using various textures.

To provide some background, I'm writing it in C++ and creating quads with OpenGL to which I assign a loaded .raw texture too. Currently I use 23 500px x 500px textures of which are all loaded and freed individually.

I have now combined them all into a single sprite/tile sheet making it 3000 x 2000 pixels seems the number of textures/tiles I'm using is increasing.

Now I'm wondering if it's more efficient to load them individually or write extra code to extract a certain tile from the sheet?

Is it better to load the sheet, then extract 23 tiles and store them from one sheet, or load the sheet each time and crop it to the correct tile?

There seems to be a number of way to implement it...

Thanks in advance.

sentences:
How forcefully should a single-player engine reject invalid data? In a single-player game, when trying to build an entity out of components specified in external scripts, what do you think is more desirable to happen when one of the components is ill-formed:

Should the engine skip over that component and let the entity live in the game world with only the components that were well written?
Or should it not add the entity to the world at all if but one of the components is ill-formed?

Note, I'm not talking about logging the errors — that should come without saying — just about what should happen to the entity.

sentences:
Irrlicht rendering basic OBJ I have been trying to render a "room" with some basic functions and I found some "bugs".

So at first I have made a "room" out of 6 planes in blender and gave each of them a diffrent color.

Afterwards I rendered it using Irrlicht and here is the first resault :

But if I go around the room to see the other sides they start to dissapear:

At first, I though it may be due to the fact that i was "too close" or "too far" from the object, or that the object was "too small" but I have tested all those and got the same resault.

So I guess the problem comes from the way I import and load in the mesh, but I couldn't find a way to solve it.

Here is the code for importing the mesh / rendering it :

IAnimatedMesh* mesh2 = smgr->getMesh("Sky.obj");
ISceneNode* node2 = 0;

if(mesh2)
{
    node2 = smgr->addOctreeSceneNode(mesh2->getMesh(0), 0, -1, 1024);
    //node2 = smgr->addMeshSceneNode(mesh2->getMesh(0));
    node2->setMaterialFlag(EMF_LIGHTING,false);
}

I would like to know why this happens and how to solve it.

sentences:
HTML5 2D Game Renderer i have a question on designing a HTML5 2D game renderer.

I've read that it's better to not let entities draw themselves but instead put all the drawing functions in the renderer. After coding for a bit, I realise that this does have its advantages. For instance, I can have a list of helper functions in my renderer system, like drawRotatedImage(), getSprite(), setFontSize(), plus the context variable etc.

However, wouldn't this lead to a very bloated renderer class, with functions like drawTree(), drawMonster(), drawPlayer(), drawBall() or whatever entity?

Also, how would i easily map the entity objects to their corresponding draw functions? Would i have to do an if (entity.type == 'monster') this.drawMonster(); else if (entity.type == 'tree') this.drawTree(); kind of thing?

sentences:
Does XNA 4 support 3D affine transformations for 2D images? Looooong story short I'm essentially trying to code Mode 7 in XNA. Before I continue bashing my brains out in research and various failed matrix math equations; I just want to make sure that XNA supports this just out-of-the-box (so to speak).

I'd prefer not to have to import other libraries, because I want to learn how it works myself that way I understand the whole thing better. However that's all for naught if it won't work at all. So no opengl, directx, etc if possible (will eventually do it just to optimize everything, but not for now).

tl;dr: Can I has Mode 7 in XNA?

sentences:
Updating texture memory via shader? What the title says.Is it possible to update a texture via a glsl shader  ? Something like :

//Read
vec4 Pixel = texture2D(TextureID,gl_TexCoord[TextureIndex].st);

//Write to texture memory ?
vec4 NewPixel = Pixel + vec4(0.0,0.0,0.0,AlphaPatch);

// ?? How to write back to texture memory ??
texture2D(TextureID,gl_TexCoord[TextureIndex].st) = NewPixel;

??

sentences:
Step by step 3D Game Design in Unity My main question is related to 3D game design for Unity, but please let me introduce my idea so that you can understand what I really mean.

I am very eager to develop an adventurous - travel 3D game (Unity), where the main character is given some kind of task in country A and if he deals with it, he goes to the upper level, which is in another country and so on.

I have never developed a computer game before. I have knowledge of c# and a bit of java (for the programming part of the game). But I really don`t know where to start with the design. I have to think of a main character, episodic characters, environment and distinctive buildings for each country in 3D (for e.g. The Eiffel Tower in Paris, The Colloseum in Rome, The Great wall of China etc. ).

My question is: where to begin with the 3D design of the characters, the cities and the buildings? Can you please give me step-by-step instructions so that I can do something good and meaningful?

I know that Blender is a good option for 3D modeling, but is it the only thing needed for the 3D game design? I have experience with Adobe Illustrator, so can I use it to some extent in this case (for 3D game elements)?

Can I use Illustrator then import it in Blender and finally import the Blender product in Unity?

I accept every advice given. I really need someone to explain these things to me because for now I am really puzzled and not orientated from where to begin.
Thank you!

sentences:
how to generate road in racing game I'm making a racing game in python and I kind of wrote myself into a corner.  This for loop:

 for i in objects:
     if i.name == "road":
         if i.y == 0:
             road = Road(road_x,-20,road_width,20)
             objects.append(road)

is how I generate new road tiles as the old ones move down the screen.  When a block spawns 20 pixels offscreen, it falls down until its top left corner hits 0 and then a new block spawns above it.  if you run this code: https://github.com/hailfire006/economy_game/blob/master/racing%20game
you can see that it works great, right up until the player accelerates by pressing up or "w", at which point the road stops spawning.

What I think is happening is that the road is skipping the 0 mark and that's why no new road is spawning, but increasing the acceleration in the code doesn't seem to mess it up, it's only when it's changed dynamically in game.  Can soneone explain what's happening here because nothing I try is working and I've been stuck on this for days...

sentences:
Movement & Physics in an entity-component system I'm currently playing around with entity-components systems and got started on the movement/collision/physics parts and would like to have some pointers!

It's a basic 2D sidescrolling game, with the goal being something in the style of Terraria. My first goal was to have a character that could run left/right & jump on blocks/tiles and when clicking tiles they'd disappear.

At the moment, each tile/block on the screen is an entity with a Transform(Position) component, a "Renderable component and a Collision component (boundaries)

My player has a Player component(tagging class), a Transform, Renderable, and Physics (velocity, acceleration, mass) and Collision component.

Currently a bit stuck on how to fit in the physics and movement. I read the threads I could find about it here on Stack but left with some questions:

What would be a good approach to let my character move? Should I have a player system that updates the Player's position or velocity? Or should I let it set a state & let another system update the movements of entities based on their velocities and their current state? Leaving the option open that I could move a character by clicking somewhere?
If I were to add gravity, should these affect your acceleration/velocity? I have problems with figuring out how to implement acceleration & which systems could/should be responsible for that..

And unrelated to the questions above, when I was starting on the collision I ran into the issue that it would try to check every single tile against the player & since on a large resolution already 1000ish entities fill the screen it quickly sent performance down the drain. I implemented a quad tree to select the entities only around the player, which seems to work. (Based on http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/ but made it from scratch in Python).

But since it takes the current window size as dimensions once the player would move off screen,  the entities wouldn't add correctly anymore. Should I let the Quad Tree grow/shrink in certain directions? (If anyone has experience with using this?)

Thanks in advance!

sentences:
Cartesian Coordinates & Layout The way cartesian coordinations are presented and used is kinda confusing.

When working with 2D the vertical axis is Y, though when working with 3D the vertical axis is Z and Y becomes the "depth" axis.

Basically I'm thinking the correct way, and best way would be to use the layout of axis.

Though Blender (3D modelling program) and other program, a lot games, present the axis in the "weird order" (my opinion)

Also if you read on Wikipedia about cartesian coordinates, your are presented with that layout of axis.

Wikipedia Cartesian Coordinates

Is there any specific or logical reason for this "flip" of axis?

sentences:
Android: how do I switch between game scenes in a game? Any tutorials? I am trying to create a simple game using the Android SDK without using AndEngine (or any other game engine). I have plenty of experience designing games from the past, but I'm having lots of trouble trying to use the Android SDK to make my game. By far my biggest hurdle right now is switching between views. That is, for example, going from the menu to the first level, etc.

I am using a traditional model I learned (I think it's called a scene stack or something?) in which you push the current scene onto a stack and the game's main loop runs the top item of the stack. This model seems non-trivial to implement in the Android SDK, mostly because Android seems to be picky about which thread instantiates which view. My issue is that I want the first level to show up when you press a button on the main menu, but when I instantiate the first level (the level class extends SurfaceView and implements SurfaceHolder.Callback) I get a runtime error complaining that the thread that runs the main menu can't instantiate this class. Something about calling Looper.prepare(). I figured at this point I was probably doing things wrong.

I'm not sure how to specifically phrase my issue into a question, so maybe I should leave it as either

1) Does anybody know a good way (or the 'proper' way) to switch between scenes in an Android game?

or

2) Are there any tutorials out there which show how to create a game that doesn't take place entirely in one scene? (I have googled for a while to no avail... maybe someone else knows of one?)

Thanks!

sentences:
Simulate shake, tilt and multi-touch in Unity WebGl app I am developing a multi-platform game in Unity.
It works great on Android and also on WebGL (haven't yet checked iOS).
My problem is that in some of the levels I need to use mobile-specific actions like shake, tilt and multi-touch.
Is there any way to simulate this in a WebGL app?
Examples of what I need:
Tilt to move an object without touching the object. The idea is to "sail" the object from the top of the screen into a basket at the bottom avoiding some obstacle on the way.
Tilt to cause an object to move across the screen
Shake to cause something to break.
Multi-touch to select two objects at the same time.

sentences:
Location of drawables Is it possible to get the location of a drawable in Android Studio?

Example: drawable.getLocationonScreen();

I want to use it for collision detection.

sentences:
Are 3D textures used for ground tiles in 2.5D games? In an isometric system, each tile can be painted with texture. Normally, (if I recalled the technical term) the fastest method to paint these ground tiles with appropiate texture is to use something like UV mapping. However, that is not what I have seen on most of isometric tile-based game (such as final fantasy tactics). For example, if I map the texture onto each grid, then the texture would appears to be flat. Now, in modern day game, each tile may have some part sprouting out (for example, grass). What I want to ask is how should I implements the isometric system such that this feature is supported?

The next problem is, if I implement such feature, then I have to make change to the art process too--- UV texture mapping will not work anymore. My question is, what change would I have to make to the art process? How would an artist color a 3D isometric tile?

Basically, I just want to know how this isometric system will work out for both programmer and artists. The grid system seems to require high degree of coordination between programmer and artist.

EDIT: Rephrase the question

sentences:
Application components dependancy and decoupling In my client application I have two major components:

GameCore - wrapper that handles everything about running the actual game
NetworkClient - A layer that takes care of communicating(receiving/sending packets) with the server.

What I am not sure about is the way the NetworkClient should server information to the GameCore process of the game. The core process has an event queue that is executed in update() calls. My initial idea is to have something like this:

NetworkClient receives a snapshot of the state changes, takes that snapshot and chops it down to event objects for the GameCore process to handle.

The problem I see with that, isn't the NetworkClient class too dependent on the Core class. The oposite is not an issue however because, there can be a different client(udp,tcp etc) that works with the Core class.

So from a design point of view, is there a reason I might not want the NetworkClient class to be written for the specific implementation of the Core class.

PS: I am using JavaScript, but the question does not necessary concern the implementation technology.

sentences:
Positive Evaluation Function - Territory AI Help I am trying to implement some positive evaluation into my game. Let me explain.

I have a series (anywhere from 5 to 25 (might vary)) of circles (three sizes, big medium small). And each player starts with a main circle which gains 1 every turn (like risk the circles gain at different speeds, the big one gains the fastest and the small one gains the slowest). You can use these numbers to take over other circles, if the "enemy" is on this circle it does a risk thing (you fight to see who takes it over, who ever has more wins most of the time, I'm not getting into this logic as it is rather irreverent).

So this is a very basic overview of what occurs, now what I need some help with is how I can create an AI which will look at all available (and taken) circles and determine where it wants to move to. There would be circles closes to it, and circles in the enemies area and circles available and circles taken over. And it would need to determine where to move it's forces too next, and so on and so forth.

So after some research I read a lot about Positive Evaluation, which it takes all possible moves and determines the best one.

So I am wondering if anyone could help me out or give me some direction as to where to go from here. I think what I need to do is take all the circles with any forces on them, throw them into a table/array with the cords of each circle and determine which would be best, then I would need to determine how many forces I want to send and where from.

Help!

ADDITION:

Allow me to explain a bit, http://imm.io/4Xwy see that diagram lets assume the circles are sections of forces, and you gain a new force each "time interval" and lets say I want to take all my forces (I'm pink) the circle directly below me and capture it, well the AI would need look at all available circles and pick for example the big green on in the top right (since big would make more troops and its close to the "main"). I'm assuming what you said would still work? Weighted options?

sentences: Does Steam provide persistent data storage to developers? Does Steam provide persistent data storage (for custom data) to developers? For example, would an online shooter be able to store player statistics (kills, matches, player deaths, etc.) on Steam servers?

sentences:
What are the hidden cost while deploying game with Unity3D? I just started learning Unity3D. I created a small 2D game, and I want to host for Windows, iPhone, iPad, Android, Windows 8, Xbox and even on websites.

I created it using free Unity3D editor. Now I want to host all these game on my website.

I will purchase iPhone, Android, and Windows 8 developer accounts. Apart from that, do I need to purchase any license in order to deploy the game on my website?

I can lots of license here: https://store.unity3d.com/

If I later purchase Unity Pro, then do I need to purchase any extra licenses?

And will that Unity logo always appear while starting the game?

sentences:
Tile Based A* Pathfinding, but with a bomb I've written a simple A* path finding algorithm to quickly find a way through a tile based dungeon in which the tiles contain the information of walls.

An example of a dungeon (only 1 path for simplicity):

However now I'd like to add a variable amount of "Bombs" to the algorithm which would allow the path-finding to ignore 1 wall. However now it doesn't find the best paths anymore,

for example with use of only 1 bomb it generates paths like these:

While the correct shortest path would be this one:

The problem is that "Closed Nodes" now interfere with possible paths. Any ideas of how to tackle this problem would be greatly appreciated!

sentences:
Surface shader with VertexLit causes black object I wrote the simplest possible surface shader:

Shader "SimpleSurf" {
    Properties {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {
        Tags {"RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _MainTex;

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

When the "Forward" rendering path is enabled the object looks fine!

But when the "Vertex lit" rendering path is enabled, it looks became black:

Why it happened? How can I use surface shaders (or maybe write a Vertex/Fragment shader which will consider spot lights) which do some effects in VertexLit path?

sentences:
How to Change position + rotation of a parent while keeping X and Z Rotation Sooo this question is a problem , a evolution by another solution of this problem here:

How can I change the parents rotation so the childs rotation is looking at a specific direction

Basically:

We have a "Eye" (HTC Vive).
We have a "Parent" which is the Parent of "Eye".

We can not change the position or rotation of the Eye in code.
We can only change the position and rotation of the Parent.

1.We want to modify the Parent Position so that Eye to goes to a certain "Target 1" position.

2.We want to modify the Parent Y-Rotation so that the Eye looks at a certain  "Target 2" position.

3.While doing this we dont want to modify the Parent X or Z , because this would lead to a Rotated game experience.

The Parent Position changes so the Eye gets to "Target 1" position.
The Parent Position changes so Y- Rotation should look at Target 2 position
The Parent X/Z Rotation should not modify the Eye X/Z

sentences:
Why is GL_TEXTURE_MAX_ANISOTROPY_EXT undefined? So I'm writing my texture class in my opengl game, I get to the part where I would normally set GL_TEXTURE_MAX_ANISOTROPY_EXT, and I'm shocked to discover that it's undefined!  This exact same extensions worked perfectly in a different application, so I know it's not a typo or something.

It's worth noting that I'm getting my extensions using glcorearb.h, instead of glext.h, because I have no intention of supporting the compatibility profile.  Could this be my problem, and if so, how do I work around it?

sentences:
Smooth drag scrolling of an Isometric map - Html5 I have implemented a basic Isometric tile engine that can be explored by dragging the map with the mouse. Please see the fiddle below and drag away:

http://jsfiddle.net/kHydg/14/

The code broken down is (CoffeeScript):

The draw function

draw = ->
  requestAnimFrame draw
  canvas.width = canvas.width

  for row in [0..width]
    for col in [0..height]
      xpos = (row - col) * tileHeight + width
      xpos += (canvas.width / 2) - (tileWidth / 2) + scrollPosition.x
      ypos = (row + col) * (tileHeight / 2) + height + scrollPosition.y
      context.drawImage(defaultTile, Math.round(xpos), Math.round(ypos), tileWidth, tileHeight)

Mouse drag-scrolling control

scrollPosition =
  x: 0
  y: 0

dragHelper =
  active: false
  x: 0
  y: 0

window.addEventListener 'mousedown', (e) =>
  handleMouseDown(e)
, false

window.addEventListener 'mousemove', (e) =>
  handleDrag(e)
, false

window.addEventListener 'mouseup', (e) =>
  handleMouseUp(e)
, false

handleDrag = (e) =>
  e.preventDefault()
  if dragHelper.active
    x = e.clientX
    y = e.clientY
    scrollPosition.x -= Math.round((dragHelper.x - x) / 28)
    scrollPosition.y -= Math.round((dragHelper.y - y) / 28)

handleMouseUp = (e) =>
  e.preventDefault()
  dragHelper.active = false

handleMouseDown = (e) =>
  e.preventDefault()
  x = e.clientX
  y = e.clientY
  dragHelper.active = true
  dragHelper.x = x
  dragHelper.y = y

The Problem

As you can see from the fiddle the dragging action is ok but not perfect. How would I change the code to make the dragging action more smooth? What I would like is the point of the map you click on to stay under the mouse point whilst you drag; the same as they have done here:  http://craftyjs.com/demos/isometric/

sentences:
Handling different screen densities in Android Devices? Well, i know there are plenty of different-sized screens in devices that run Android.

The SDK I code with deploys to all major desktop platforms and android. I am aware i must have special cares to handle the different screen sizes and densities, but i just had an idea that would work in theory, and my question is exactly about that method, How could it FAIL ?

So, what I do is to have an ortho camera of the same size for all devices, with possible tweaks, but anyway that would grant the proper positioning of all elements in all devices, right? We can assume everything is drawn in OpenGLES and input handling is converted to the proper camera coordinates.

If you need me to improve the question, please tell me.

sentences:
Using two shaders instead of one with IF statements I've been working on porting a relatively large opengl ES 1.1 source to ES 2.0.

In OpenGL ES 2.0 (which means, everything uses shaders), I want to draw a teapot three times.

The first one, with a uniform color (ala the old glColor4f).
The second one, with a per-vertex color (the teapot has its array of
vertex color as well)
The third one, with per-vertex texture
And maybe a fourth one, with both per-vertex texture and color. And
then maybe a 5th one, with normals as well..

There are two choices I have with implementation, as far as I know. The first is to make a shader that supports all of the above, with a uniform that is set to change the behavior (e.g use the singular color uniform, or the per-vertex color uniform).

The second choice is to create a different shader for each situation. With some custom shader preprocessing, it's not that complicated to do, but the concern is the performance cost in switching shaders between drawing objects. I've read that it's not trivially small.

I mean, the best way to go about this is to build both and measure, but it'd be good to hear any inputs.

sentences: How to make Frame Independent Timer Clock I want to make a frame Independent Timer that it work consistently across different computer configuration.

sentences:
Problem of saturation of ram on XNA? I developed a small xna games.
For some time I have a problem with the saturation of RAM. In fact everything works perfectly, the game runs with a "Frame" of 60fps. But strangely I do not know for what reason my games every 4 seconds freeze half a second.

Yet my average call time of the "Update" function is approximately 7 ms (which is supposed to be good ..)

Here is a screen capture of the Task Manager. I can see the ram flush periodically.

Have you any idea why the ram saturates at only 50%?

sentences:
How do I render into a sub-region of a texture atlas with XNA / HLSL? Is it possible to render into a texture atlas?

I've been wondering how to reduce the number of textures required for shadow-mapping, and came across a blog post here about rendering up to sixteen shadow maps into one texture-atlas.

According to the blog post mentioned above, these are the steps required:

1. The first step is writing to the texture; bind it to the framebuffer and set the viewport to render into the texture sub-region.

2. When accessing the sub-region, scale/bias the texture coordinates as follows: scale = region size / texture size, bias = region offset / texture size.

I understand this, but I'm not sure how to alter the viewport specifically to allow me to render into a certain square of the texture. I've found plenty of information about reading from it (up-sampling and down-sampling) but I don't know how I'd manipulate the viewport specifically to render into a small square region of the screen, and how I'd do this with a texture smaller than the back-buffer.

I'm using XNA and HLSL at the moment because it's simpler than SharpDX, and there's no point in messing around with that until I've got the theory working 100%.

Thanks for your help.

sentences:
Setting up speedtests in Actionscript 3 for an entire game I'm very new to this so please forgive the questions possibly ill-stated nature.

Firstly is this even a valid way to speedtest:

public function L1() {

        tree.x = 200;
        tree.y = 200;
        tree.healthPoints = 0;
        addChild(tree);
        var myTimer:Timer = new Timer(100,60);
        myTimer.addEventListener(TimerEvent.TIMER,someFunction);
        myTimer.start();
        addEventListener(Event.ENTER_FRAME, speedTest)

    }
    function someFunction(event:TimerEvent) {
        t++
    }
    public function speedTest (e:Event) {
        if (tree != null) {
            do { tree.healthPoints += 1; }
            while (tree.healthPoints < 10000) ;
            tree.healthPoints = 0;
                trace (t);

        }
    }

Secondly:
I want to actually speed-test the entire game somehow to check if adding new features or rewriting current features actually optimizes the game or not.

What are some ways to do this?

sentences:
First object jumps on re-entry of second colliding object The scenario is that I have two objects - Object A and Object B. The Object A is lying on the ground and when Object B enters the collider of Object A, the Object A moves (only X and Z axis) with Object B. The movement works well with the script shown below.
The issue is that most of the time, the Object A's initially position shifts by few meters whenever Object B enters its collider. I feel it is related to offset position. What should happen is that, Object A should be the same position when Object B enters the collider and move along with Object B only when Object B moves.
So how do I fix this?
private Vector3 offsetPosition;

public Transform ObjectB;

public bool ObjectB_Collision = false;

void Start () {
        offsetPosition = ObjectB.transform.position - this.transform.position;
    }

    void ObjectB_HasEntered() {
        offsetPosition = ObjectB.transform.position - this.transform.position;
    }

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

        if (ObjectB_Collision == true) {
            this.transform.position = new Vector3 (ObjectB.transform.position.x, this.transform.position.y, ObjectB.transform.position.z) - new Vector3 (offsetPosition.x, 0, offsetPosition.z);
        }

    }

public void OnTriggerEnter (Collider col) {
        if (!enabled) return;

        if (col.gameObject.name == "Object_B") {
            ObjectB_HasEntered();
            ObjectB_Collision = true;
        }
    }

public void OnTriggerExit (Collider col) {
        if (!enabled) return;

       if (col.gameObject.name == "Object_B") {
            ObjectB_Collision = false;

        }
    }
```

sentences: How do I fill a shape with a texture in Libgdx? I am making a 2D racing game. I want to fill the area of the ground object with a texture. I have the shapes of the ground (a Box2D shape). If I make images of the ground with textures, it uses a lot of RAM, so I instead want to fill the shapes with copies of a small texture.

sentences:
How to calculate the stopping distance of a wheel collider? I have an 'AI' bus in my game that needs to pull over occasionally at a bus stop. What I want to do is change the acceleration and brake force based on the stopping distance of the bus. I don't want to simply use the distance between the bus stop and the bus because each time the bus pulls over, it could be traveling at a different speed.

Right now it uses the distance between the bus stop and the bus. It doesn't really work well though because if a bus is traveling faster, it will take a longer distance to stop and will likely go past the bus stop. Same thing if it were going slower.

How do I calculate the stopping distance my bus will take to come to a complete stop?

sentences:
Color Correction in DirectX After playing games like Star Wars Battlefront & GTA 5 I was wondering how dev's implement Color Correction in their Engines. I know that this can be done through the use of 3D LUT's but I was wondering if there are any other ways to do this. A good example of this would be in GTA 5 when a Characters special ability is triggered the colors on screen have a tint applied to them which over a period of 2 seconds the intensity of the effect gradually increases.

https://www.youtube.com/watch?v=LNGF7J3y5_Y

If someone can explain how this is done/ implemented that would be great.

sentences:
How to Incorporate two loops: One for Turn Based Gameplay, and another for ongoing actions I'm working on a roguelike using libtcod.

So far everything works well with the turn-based functions. Essentially, when a player takes a turn, it triggers everything to advance.

What if I have an item, such as a torch, and I want to animate that cell? Whether or not the player has taken a turn, purely for aesthetics, I'd like this torch's cell to rotate between some various colors.

How would you incorporate animation like this?

sentences:
How to make texture size correctly in THREE.js? I'm new to THREE.js and I have a frustrating problem. I can't get my grass texture to size "normally" on the terrain.

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

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

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

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

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

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

sentences: Mixing Bump mapping and Detail mapping I wonder if I create bump mapping for my terrain is it good to add detail mapping too? Does such mix improve realism or make it even worse (because there is "too much" of it)? If this improve realism, is it even worth doing that? Maybe it takes a lot of resources for small improvement?

sentences:
How can I create a title screen demo? I am writing a 2D game in Unity and I want to offer an old-school style title screen demo (such as in Super Mario, etc.) where it shows a brief run through of either one or various levels. How would I accomplish this?

If anyone can either enlighten me or point me to some further reading then it would be very welcome.

sentences:
License for a Breakout This may not be an appropriate question for gamedev.stackexchange.com.

I'd like to make a basic Breakout game with Unity.
I'd also like to sell it on the Mac App Store, iOS App Store, Google's Play Store, Windows 8 Store etc.

I'm not sure however if that will cause trouble with Copyright.
I asked Google but I didn't find any helpful results.

Can I use the game-concept without buying a license?

I know that there are plenty of games with the same concept on various platforms, I just want to be certain.

sentences:
How to stretch Movie Clip according to user's touch coordinates? I have code like this:

touchX = e.stageX;
touchY = e.stageY;

I also have a player movieclip that I'm trying to make shoot lasers.  So I got the MovieClip to appear and rotate according to the player's location and the user's touchX and touchY.  How do I make the laser MovieClip stretch according to the distance between the player's coordinates and the touchX and touchY coordinates?

sentences:
Most efficient way of communication between "unfamiliar" game objects? Title could look vague, so here's what I actually mean.

Three groups of people are walking in the city. These are Guards, Thieves and Citizens.
Something has happened in the city, Thief have stolen a pocket from a Citizen, the Guard walking around was close enough to see the crime, so now he's chasing Thief.

So here's the question, how that chain would work from execution perspective?
We can imagine there is a some kind of StateCheckingObject placed in the world. When Thief steals a pocket, it's class (or Citizen's class ) would broadcast a message to the StateCheckingObject. After StateCheckingObject is aware of crime it would broadcast message to the Guards walking around making them aware of crime.

Well, broadcasting stuff doesn't look complex, that could be a simple event dispatcher. But how would Thieves, Citizens and Guards hold a reference to StateCheckingObject? And what StateCheckingObject should even look like? Should it somewhere in the level? Should other object access it when spawned with GetAllObjectOfClass(StateCheckingObject)? That could be a heavy task for system since iterating over all level objects is not very efficient.

The issue looks pretty similar to GTA where events are broadcaster to nearby police cars when crime is happening, but what would make a broadcast?

Edit: lilotop suggested a trigger box solution and I've realised I haven't explained the idea why I would want to make state checking system.

Some actions happening in the world should be stored somewhere. I.E. after Citizen got robbed StateChecker would get aware of it and store bool CitizenGotRobbed.
That boolean would later be used in maybe some kind of dialogue adding new branch to guard dialogue.

sentences:
Text mesh not visible on a container I have probably dumb problem with a text-mesh game object. I want to use it as a title on a top of container. I will give you all information that you need to find a problem.
I'm using pixel font Tripfive.

In game result:

In scene result:

3D:

text gameObject settings:

all other settings that can be realted to the scene:

sentences:
How should I detect collisions with objects on a "timeline"? I'd like to replicate this game's mechanic of the player smashing walls with a precise timing to a background rhythm.

How should I check when each wall should be broken? Does the player animation use a hitbox, or does it use timing to detect if the smashing animation should play?

sentences:
How to make game playable in all mobile screen resolution using Unity Cinemachine with perspective mode? I want my 2D game to be playable (auto scale) in all screen resolution. I'm using Cinemachine & under "perspective" mode. I found tutorial to change the screen in "orthographic" mode but there is no answer for "perspective" mode using Cinemachine. Please help on what setting must be done in Cinemachine or if there is any scripting that I can use. Thanks a lot.

NB: I tried to add a script as in  below link. But it doesn't work. Perhaps it's because I'm using Cinemachine instead of normal main camera. Link: Scale camera to fit screen size unity

Edit: Added picture of the "perfect" view I want below.

Image "expanded" to left & right when I change to "free aspect"

sentences:
Rectangle Collision Not Correct As you can see on the top corner it says COL: False/True. This is if the player bounds and the tiles which are solids. The rectangles for the tiles and players are checked if they intercept each-other. Looks like its working right? Well nope. Look more closely.

The BOTTOM RIGHT corner needs to be inside the tiles for it to count.

Now let's get to the code I used now that hopefully you understand the problem.

Player Bounds (Rectangle)

playerBounds.Width = 32;
playerBounds.Height = 64;
playerBounds.X = (int)this.position.X;
playerBounds.Y = (int)this.position.Y;

Tile Bounds (Rectangle)

newTile.bounds = new Rectangle(x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE);

Now onto how it detects it:

for (int x = 0; x < Tilemap.MAP_WIDTH; x++)
        {
            for (int y = 0; y < Tilemap.MAP_HEIGHT; y++)
            {

                if (tm.tile[x, y].bounds.Intersects(playerBounds))
                {
                    if (tm.tile[x, y].getSolid())
                    {
                        Colliding = true;
                    } else
                    {
                        Colliding = false;
                    }
                }
            }

        }

Move

    public void Move(Vector2 pos)
    {
        for (int i = 0; i < speed; i++)
        {

            position += pos;
        }

    }

I have used breakpoints at the collision detection loop. And the rectangle fully covers the character and the tiles.

sentences:
AndEngine Sprite position I had noticed the AndEngine a few days ago, and I tried to create basic game with a few Sprites.Sure, the engine makes the development process much more easier.However I found the sprite lacking a major functionally:

Whenever there is a need to refer to the position of an Sprite the engine manipulates the position based on the top-left corner of sprite,this is not the best thing because there is a need to subtract/add the width/height to its position in order to refer to its center.However when we refer to he scale of the Sprite it scaled according to its center point (which is great)

I find it very confusing to refer to its position each time differently.I solved that by extending the Sprite class and implementing my methods of setCenter and getCenter, I guess that not the best way to do so.

Do you have any suggestion?

sentences:
Sprite Kit - keeping character level with the terrain 2d endless runner I've been trying to figure this out exhaustively for the past few days and still haven't found an answer.  I have an endless runner built using swift where the character is fixed and the terrain moves to the left.  I have edge physics bodies on the terrain, and edge physics bodies that go up and down slopes.

The problem is, if I want my character to collide with the ground without being pushed back by it, since the only thing that can make contact with an edge is a dynamic volume.

My goal is to keep the character level with the terrain, (assuming they're not jumping).  Even on slopes.

I've tried ray casting using enumeratebodiesalongraystart, but can't seem to figure out how to get coordinates of where it intersects with the ground.  I've tried having an edge body that is vertical, that intersects with the ground(two edge bodies cannot make contact in sprite kit).  I've tried dynamic volumes.  I've tried Static volumes.  Nothing works.  I'm not posting code here since I'm really just looking for a general answer to sort of point me in the right direction, but I'm coding in swift.  Thanks in advance.  Also I have the character in a different bitmaskcatagory than the terrain catagory and they are set up to recognize each other, and do if one of them is a dynamic volume physics body.

sentences:
How can I get the assignment of an object back? I have been struggling with this NullReferenceExpection error.

When I don't add anything and just use this version of the code. The game adds a tower, upgrades a tower and takes money for it.

It worked all fine until I tried to add a menu that opens up and then you can choose a tower type you can buy.

So after I add all of this I get a NullReferenceExpection at return tower == null && gameManager.Gold >= cost; and at gameManager.Gold -= tower.GetComponent<TowerData>().CurrentLevel.cost;. The game also doesn't take any money from purchases and you can spawn near infinite amounts of towers on one spot.

  //tower = (GameObject)

  theTowerMenu.gameObject.SetActive (false);

  transform.position = new Vector3(openSpot.transform.position.x, openSpot.transform.position.y, transform.position.z

If i take 'tower = (GameObject)' out of comments I get "error CS0030: Cannot convert type void' toUnityEngine.GameObject'".

The current script:

using UnityEngine;
using System.Collections;

public class PlaceTower : MonoBehaviour {

public GameObject towerPrefab;
private GameObject tower;

public GameObject openSpot;

private GameManagerBehavior gameManager;

public GameObject theTowerMenu;

// Use this for initialization
void Start () {
    gameManager = GameObject.Find ("GameManager").GetComponent<GameManagerBehavior>();
}

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

}

private bool canPlaceTower() {
    int cost = towerPrefab.GetComponent<TowerData> ().levels[0].cost;
    return tower == null && gameManager.Gold >= cost;
}

void OnMouseUp () {
    if (canPlaceTower ()) {
        //tower = (GameObject)
        theTowerMenu.gameObject.SetActive (false);
        transform.position = new Vector3(openSpot.transform.position.x, openSpot.transform.position.y, transform.position.z);
        Instantiate (towerPrefab, transform.position, Quaternion.identity);

        AudioSource audioSource = gameObject.GetComponent<AudioSource> ();
        audioSource.PlayOneShot (audioSource.clip);

        gameManager.Gold -= tower.GetComponent<TowerData>().CurrentLevel.cost;
    } else if (canUpgradeTower ()) {
        tower.GetComponent<TowerData> ().increaseLevel ();
        AudioSource audioSource = gameObject.GetComponent<AudioSource> ();
        audioSource.PlayOneShot (audioSource.clip);
        gameManager.Gold -= tower.GetComponent<TowerData> ().CurrentLevel.cost;
    }

}

private bool canUpgradeTower() {
    if (tower != null) {
        TowerData towerData = tower.GetComponent<TowerData> ();
        TowerLevel nextLevel = towerData.getNextLevel ();
        if (nextLevel != null) {
            return gameManager.Gold >= nextLevel.cost;
        }
    }
    return false;
}
}

Please help. I've been stuck with this for a long time.

sentences:
What is the design rationale behind hard content that's limited to only a couple attempts per week? There is currently a lot of discussion in the World of Warcraft playerbase about a recently added feature: Horrific Visions. Visions are personal areas you can enter alone or with a handful of players and have 5 objectives with increasing difficulty plus additional difficulty options. The details aren't that important, but the core is that these Visions require careful planning of resources and time if you want to progress the harder difficulties, both during the visions themselves and in how you earn the right to complete a Vision. In return for completing these Visions, you can earn increasingly better gear based on difficulty (though repeated gear rewards decline in quality) as well as upgrades for an item you need against the final bosses of the raid that came in the same patch.

Now, usually in games that have really hard content you're supposed to defeat, there is no limit in how many attempts you can do, or the limit is sufficiently high that it makes no real difference. However, this isn't the case in Visions. Visions require you to buy an item to make an attempt, and this item is so costly that even if you log in every day and do all the content that rewards the items you need to buy this item, you can at most earn 4 copies of the item per week. There is also incentive to save these tokens for later weeks because later upgrades require you to complete increasingly more runs, which you can speed up by not using additional tokens in weeks where you don't need them.

This is what many people see as the biggest problem with these Visions. They're hard content, but you have only a couple attempts per week and you need to make them count. So there isn't really a safe way to practise them so you can learn how they work and what the best way to do them is. If you mess up and you don't do enough to earn the upgrade token mentioned above, it's a huge potential loss and you fall behind other players who did manage to complete them.

I'm trying to understand possible design rationale behind this. I don't usually come across this design element in games, and I can't even remember another game with similar design, especially for such a core feature of the content update. in other hard game content, Soulsborne games don't really restrict you in attempts, and Roguelikes actually are built around immediately starting anew when you fail, again without real limitations. AFAIK neither genre really limits you in how often you can try them. And it has been years since Blizzard last put a hard limit on how many attempts you were allowed for the hardest content, especially such a low amount.

What can be potential design rationale behind putting hard content behind a restrictive attempt limit?

sentences:
Surface of Revolution with vertex shader Is it possible to render a surface of revolution with using a vertex shader?

I have NxM vertices, and I would like to transformate them accordingly to the function
I have to draw.

Is it possible, or i can not change the vertex position with a vertex shader?

Thanks ahead!

sentences:
Black screen after running emulation mode in the Unity Editor for hololens I am having issues with black screen when running the emulation mode or simulator for Microsoft hololens. In the preview the camera shows what the user should see. I see no obvious reason to behave like this and no error/warning is given. I am using code snippets from the Origami tutorial,except I chose to use RayCastNonAlloc.

Movement.cs
           public class Movement : MonoBehaviour {
        public GameObject person;
        public float seconds;
    private Vector3 point = new Vector3(0,0,0);
    private RaycastHit[] rayHit = new RaycastHit[5];

void OnSelect()
{
    person.transform.position = Vector3.Lerp(person.transform.position, point, seconds * Time.deltaTime);
}

// Update is called once per frame
void Update()
{
    if (Physics.RaycastNonAlloc(Camera.main.transform.position, Camera.main.transform.forward, rayHit, Mathf.Infinity, ~0) > 0)
    {

        foreach (RaycastHit hit in rayHit)
        {

            point.x = Mathf.Clamp(hit.point.x, -290f, 6970f);
            point.y = Mathf.Clamp(hit.point.y, -40f, 1860f);
            point.z = Mathf.Clamp(hit.point.z, -1700f, 140f);
        }
    }

}
}`

Scene.cs

   using UnityEngine; using UnityEngine.XR.WSA.Input; public class Scene : MonoBehaviour

{

public GameObject cursor;
public GameObject Focused { get; private set; }
public Scene Instance { get; private set; }

private GestureRecognizer recognizer;
private MeshRenderer Renderer;
private readonly RaycastHit[] rayHit = new RaycastHit[5];

void Awake()
{
    Instance = this;
    recognizer = new GestureRecognizer();
    recognizer.Tapped += (args) =>
    {
        if (Focused != null)
        {
            Focused.SendMessageUpwards("OnSelect", SendMessageOptions.DontRequireReceiver);
        }

    };
    recognizer.StartCapturingGestures();
    Renderer = cursor.GetComponent<MeshRenderer>();
}

void Update()
{
    GameObject oldFocused = Focused;

    if (Physics.RaycastNonAlloc(Camera.main.transform.position,Camera.main.transform.forward,rayHit,Mathf.Infinity,~0)>0)
    {
        Renderer.enabled = true;
        foreach ( RaycastHit hit in rayHit)
        {

            cursor.transform.position = hit.point;
            cursor.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
            Focused = hit.collider.gameObject;
        }
    }

    else
    {
        Focused = null;
        Renderer.enabled = false;
    }
    if (Focused != oldFocused)
    {
        recognizer.CancelGestures();
        recognizer.StartCapturingGestures();
    }
}

}

sentences:
How can I transform a 3D triangle to be coplanar with another congruent triangle? - How can I superimpose two congruent triangles? I need to transform an equilateral triangle that is lying flat on the xz plane, to become coplanar with another congruent equilateral triangle. I am developing a simple low-poly space exploration game, and my planet generation system requires this.
Terrain chunks are equilateral triangles rather than squares, and they need to be mapped to the faces of an icosphere.
I have found a stack overflow question that outlines a similar problem, but when I tried to implement their solution in Godot, the results were not what I needed. I may have not correctly implemented it, or it might not be an appropriate solution for my problem.
var m0 = Basis()

m0.x = vertices[triangles[10][1]]-vertices[triangles[10][0]]
m0.y = vertices[triangles[10][2]]-vertices[triangles[10][0]]
m0.z = m0.x.cross(m0.y)
m0.y = m0.z.cross(m0.x)

var m1 = Basis()

var p0 = vertices[triangles[10][0]]
var p2 = vertices[triangles[10][0]] + Vector3(get_triangle_size(1,2)/2,0,1)
var p1 = vertices[triangles[10][0]] + Vector3(get_triangle_size(1,2)/1,0,0)

m1.x = p1 - p0
m1.y = p2 - p0

m1.z = m1.x.cross(m1.y)
m1.y = m1.z.cross(m1.x)

var m = m1.inverse() * m0

$Tri.transform.basis = m

The code above is my attempt at implementing the solution in the linked stackoverflow article.
Let $Tri be the triangle that I am moving, and let triangles[10] be a list of vertex indices corresponding to the destination triangle.
To be honest I really don't know how this is supposed to work, but right now, it does not put the triangle in the right place at all. It puts the triangle inside the icosphere, and it's not even rotated properly.
Any help at all would be greatly appreciated, because I am very lost.

sentences:
cant add unity scripts to obects "unity_csc.bat not found. Is your Unity installation corrupted?" I got a new computer and on it I installed unity and signed in etc. when I load it up however and try adding scripts to objects in the scene it doesn't add them and has this error:
"cant add script component because the script class cannot be found".
I thought it might be something in the script but everything i tried didnt work even from the forums. I made sure it had the same name and the monobehaviour was there and everything. I even got a working script from a prior game i made on my other computer and put it in but it still didnt work. So i thought something was wrong with visual studio. However the last time i was playing around with visual studio and its installs my computer got sent into a bsod reboot loop and then just didnt turn on and it had to get re-imaged. The only other error that could be causing the scripts to not add maybe was this error that i got in the console:
"Exception: 'C:\Program Files\Unity\Hub\Editor\2019.1.8f1\Editor\Data\Tools\RoslynScripts\unity_csc.bat' not found. Is your Unity installation corrupted?"
However the worse part is that that file already exists
please help! I need to gamedev on this computer!
thanks in advance;

sentences:
Set FBX creator while exporting using FBX SDK I am using FBX SDK 2018.1.1 to write a simple utility application on windows that will export existing FBX file (this file is exported from Blender 2.79).

I need to set the creator of the final FBX file to "My custom FBX exporter". As per documentation of FBX SDK, it can be done using

http://help.autodesk.com/cloudhelp/2018/ENU/FBX-Developer-Help/cpp_ref/class_fbx_i_o_file_header_info.html

here is the code snippet used to export the FBX:

FbxExporter* pExporter = FbxExporter::Create(m_pSdkManager, "");

pExporter->SetFileExportVersion(FBX_2012_00_COMPATIBLE);

FbxIOFileHeaderInfo *infoExporter = pExporter->GetFileHeaderInfo();
infoExporter->mCreator = "My custom FBX exporter";

pExporter->Export(m_pScene);
pExporter->Destroy();

But when I read this newly exported FBX file it shows "FBX SDK/FBX Plugins version 2018.1.1" in the mCreator field.
This is the snippet when I import the file (just to check if mCreator property is properly set)

lImportStatus = lImporter->Import(m_pScene);

info = lImporter->GetFileHeaderInfo();

How do I properly set the mCreator in FBX file header so that it is set in final exported file?

sentences:
Removing FMOD from a Unity WebGL project causes an error about not being able to copy fmod_register_static_plugins.cpp When I imported the FMOD plugin into a Unity WebGL project, then removed it afterwards, I wasn't able to build it due to errors about trying to copy an FMOD file: fmod_register_static_plugins.cpp
Restarting the editor, reimporting everything, deleting Library/Temp folders did not help. Neither did deleting the FMod folder.

sentences:
Generate screen space distance field from depth buffer I've been wanting to try out raymarching on real 3D scenes to implement effects like AO, soft-shadows and such.

I pretty much know how to use signed distance functions (as described by Inigo Quilez) to approximate a model and raymarch it, but I want to have way more precision and have the distance field of my scene.

How would you go about generating a (un)signed distance field from the depth buffer in screen space ? Or would the usual depth buffer be usable as a distance field (I don't think so) ? Or there might be better ways that don't use the depth buffer ?

sentences:
LibGdx sprite rotation vs Box2D physics rotation problem LibGdx sprite rotation vs Box2D physics rotation problem

Tearing my hair out on this one. I am an experienced software developer, but very new to LibGdx and Box2D development.

I am writing a game where the game board is the size of the screen. The game board does not pan - it just fills the screen. For the descriptions below presume that the device is being held vertically, so that vertical is the longest length. Also, for the description below, presume that on a device with a 'normal' aspect ratio, circles will be rendered perfectly circular, but a device that is narrower than expected, the circles will be squashed so that they are taller than wide.

I have a number of circle shapes that are rendered to the screen.

Because different devices will have different width / height aspect ratios, I am happy for the circle shapes to be squashed on a device that is narrower on the horizontal than expected (I am trying to avoid maintaining identical aspect ratios and forcing black borders at the edges of the game board).

My problem is this: when Box2D debug renders the screen, showing the physics objects, the circle shapes maintain their width and height, even when rotated. To describe further, if a sphere is displayed with 0 degree rotation on a narrow device, it takes an oval shape that is taller than it is wide, as would be expected on a narrower than expected device. If you rotate the circle shape by 90 degrees, the Box2d debug renderer shows the rotation (there is a line that sticks out of the centre of the object at an angle that shows the angle of rotation) but the object maintains its taller than wide oval shape. This is correct, as a sphere on a horizontally narrower aspect-ratioed device will always be displayed taller than wide.

When I attempt to overlay a LibGDX sprite on top of the Box2D physics simulation (the sprite, in its unaltered form, is circular, and is then scaled to the devices aspect ratio), with a zero degree angle, it appears nicely mapped to the Box2D representation - taller than it is wide. However, when I rotate the LibGDX sprite by 90 degrees, it appears rotated the way a billboard image would be rotated, so it is now wider than it is tall (imagine drawing a taller-than-wide oval on a piece of paper and turning the piece of paper by 90 degrees).

It appears to me that Box2D applies rotation before it applies the camera scaling - so the circular object is rotated first (maintaining its circular shape under the hood), and then sqaushed to form an ellipse that is taller than wide on the screen. Whereas, the LibGDX engine applies the transforms in reverse. The object is squashed to taller-than-wide, then rotated, so it becomes wider-than-tall on the screen.

I have pasted the relevant code below:

//screen size in box2D metres
private static float screenHeight = 100.0f;
private static float screenWidth = 70.0f;

//set up the camera in the show() method
    cam = new OrthographicCamera(screenWidth, screenHeight);
    cam.position.set(screenWidth / 2, screenHeight / 2, 0);

//render method
batch.begin();
for (int i = 0; i < ballList.length; i++)
{
    ballList[i].render(batch);
}
batch.end();

//ball class render method
public void render(SpriteBatch batch)
{
    ballHappyImage.setOrigin(64.0f, 64.0f);
    ballHappyImage.setPosition(body.getPosition().x - 64.0f, body.getPosition().y - 64.0f);
    float scaleWidth = Gdx.graphics.getWidth() / 1400.0f; //hardcoded to make things fit correctly
    float scaleHeight = Gdx.graphics.getHeight() / 2000.0f; //hardcoded to make things fit correctly
    ballHappyImage.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
    ballHappyImage.setScale(scaleWidth, scaleHeight);
    ballHappyImage.draw(batch);
}

The images below show the Box2D debug rendered line drawings overlayed on the libgdx sprites.

sentences:
How to convert mouse coordinates to isometric indexes? I draw isometric map with tile 64x32:

const Offset = 160;
int X, Y;

for (int a=0; a < 6; a++)
  for (int b=0; b < 6; b++) {
    X = a * 32 - b * 32 + Offset;
    Y = a * 16 + b * 16;
    DrawTile(X, Y, tile);
  }

Image, illustrating this code:

Dear professionals, please, help with a formula of transformation of mouse coordinates in isometric indexes of a cell. Example: (105; 100) -> [1; 4].

sentences:
Constant orbit using Rigidbody in Unity I'm trying to make a few game objects (moons) orbit a planet in unity. Basically just picture a planet in the center of the screen, and a few small moons that orbit the planet with a constant velocity. I have gotten this to work nicely using transform.RotateAround(), but I wanted to take advantage of the physics engine that unity provides for realistic "bouncing" of the game objects relative to others as they collide.

I have tried a few things such as Hinge Joints, Configurable Joints, and even just adding forces to try to get it to move in a spherical manner. I can't seem to get it to work correctly though. The configurable joint is the closest that I've come, but it's a bit off and it doesn't stay orbiting. It's likely my lack of knowledge with using rigidbodies in 3d, but I figured someone out there could help get me on the right track. Thanks in advance for any help!

sentences:
LWJGL Lighting advice / fix Problem: The spotlight I've set up with OpenGL won't light up anything behind it, no matter what values I set for GL_SPOT_DIRECTION

    float[] LightDir = new float[]{0,0,-1,0};
    float[] LightPos = new float[]{0,0,15f,1};

Initialization code for lighting

        glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
        glLightModel(GL_LIGHT_MODEL_AMBIENT,asFlippedFloatBuffer(new float[]{0.1f, 0.1f, 0.1f, 1f}));
        glLight(GL_LIGHT0,GL_DIFFUSE,asFlippedFloatBuffer(new float[]{0.5f, 0.5f, 0.5f, 1f}));
        glLight(GL_LIGHT0, GL_POSITION, asFlippedFloatBuffer(new float[]{0, 0, 0, 1}));
        glLightf(GL_LIGHT0,GL_SPOT_CUTOFF,60.0f);
        glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,2.0f);

        glEnable(GL_COLOR_MATERIAL);
        glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
        glShadeModel(GL_SMOOTH);

Lighting code ran every loop

         glLight(GL_LIGHT0,GL_SPOT_DIRECTION,asFlippedFloatBuffer(LightDir));
         glLight(GL_LIGHT0,GL_POSITION,asFlippedFloatBuffer(LightPos));

The Following shows:

To try and change the direction I hit a key that does

LightDir[1]++;

The angle of the light goes up as expected, but seems to stop turning once it's pointed straight up. Which looks like

Which is the problem, it wont turn around.
Iv'e tried every possible value for LightDir in all it's values, but I cannot get it to illuminate the back pf the tube. I've even tried to transform to light around the scene with glRotate and glTranslate.
The light is supposed to function as a flashlight.
Is this something that would be potentially solved with Shaders?
Thanks in advance!

EDIT:

Anytime LightDir[2] goes above 0 the light goes dark.

sentences:
Differences between storyboarding for game design vs. web design I'm looking to UX and storyboard out a web adventure game. The goal being to have an area to show what the UI/UX would look like (mockups), and ability to add dialog/blurbs to describe the screen.

I was thinking InVision, but that seems strictly for web development mockups. I could also simply draw them in Photoshop or on paper, but was looking more for something game design specific.

Are there significant differences between storyboarding for game design as opposed to web design? If so, how do UX or storyboarding tools cater to those differences?

sentences:
Monogame Windows 8 Phone I have monogame 3.0.1 (latest stable) installed on a Windows 8 Pro machine. I can create a new Windows Phone 8 project (Monogame template) and deploy to the emulator and an actual device with no problems.

However after successfully getting a screen of cornflour blue I wanted to display a simple image. I know the content pipeline is something that doesnt work but I wanted to display a simple PNG.

For this, I tried:

Adding a Content folder. Adding a simple PNG (test.png) to the content folder. Set the build to "Content" and ensure it was set to "Copy if newer". Then added the following code.

texture = Content.Load<Texture2D>("test");

And in the draw, draw it out. However , I get a NotImplementedException when I try to deploy this.

Out of the box, how do I draw a simple texture/sprite to the screen?

sentences:
How do I create a horizontally centered "gravity line"? Here's my ideal scenario: A game object (in blue) can change its horizontal velocity, but it will be pulled back by gravity (dotted gray arrows) toward a central vertical line (in red).

How can I do this?

sentences:
Converging at position and angle using motor-based rigidbody movement I am given a rigidbody positioned in \$\mathbb{R}^2\$. It is a box of length \$l\$ and height \$\epsilon\$. The position of the box's left center is described by \$\vec{p}\$, and its angle from the x-axis is \$\theta\$. The body is in a vacuum (no friction), and its mass is \$m\$ (uniformly distributed). Here's a quick diagram.

Next, I am given a target position and angle to reach. It is not guaranteed that the body will reach the target position and angle the next time frame.

I need to calculate the necessary force \$F\$ and torque \$T\$ that will push the body closest to the target. I am given constraints for max force and max torque.

To make things complicated, the body might be affected by external forces. One of them is gravity \$F_g\$, which will always remain constant. Sometimes, normal forces exist as well. The applied forces or the total force is unknown, but the velocity or the angular velocity is available.

I tried to solve this problem using steering behaviors. However, the angle seems to fluctuate constantly. Here's part of my code in C# (Unity).

\$\vec{p}_0=\$transform.position
\$\theta_0=\$transform.eulerAngles.z
\$\vec{p}_t=\$position
\$\theta_t=\$angle

private RigidBody _body;

public float SlowDownRadius = 2f;
public float MaxVelocity = 50f;
public float MaxForce = 10000f;

public float SlowDownDelta = 15f;
public float MaxAngVelocity = 180f;
public float MaxTorque = 10000f;

public void Next(Vector3 position, float angle) // angle in degrees
{
    // force
    Vector2 to = position;
    var from = (Vector2) transform.position;
    var desired = to - from;
    var dist = desired.sqrMagnitude;

    desired = desired.SetMagnitude(dist < SlowDownRadius * SlowDownRadius
        ? MaxVelocity * Mathf.Sqrt(dist) / SlowDownRadius
        : MaxVelocity);

    Vector2 vel = _body.velocity;
    var steering = desired - vel;

    var mass = _body.mass;
    Vector2 force = mass * UnityEngine.Physics.gravity;
    var time = Time.deltaTime;

    var newForce =
        (time <= 0 ? new Vector2() : (mass / time * steering)) - force;

    _body.AddForce(newForce.Clamp(MaxForce)); // limits magnitude of newForce to MaxForce

    // torque
    var toAngle = angle;
    var fromAngle = transform.eulerAngles.z;
    var desiredAngle = AngleDistance(fromAngle, toAngle);
    var distAngle = Mathf.Abs(desiredAngle);

    if (distAngle < 1f)
    {
        transform.eulerAngles = new Vector3(0, 0, angle);
        return;
    }

    desiredAngle = Mathf.Sign(desiredAngle) * (distAngle < SlowDownDelta
                  ? MaxAngVelocity * distAngle / SlowDownDelta
                  : MaxAngVelocity) * Mathf.Deg2Rad;

    var angVel = _body.angularVelocity.z; // in radians
    var steeringAngle = desiredAngle - angVel;

    var newTorque = (time <= 0 ? 0f : (mass / time * steeringAngle));

    _body.AddTorque(0, 0, Mathf.Sign(newTorque) * Mathf.Min(Mathf.Abs(newTorque), MaxTorque));
}

public static float AngleDistance(float from, float to)
{
    var dist = (to - from + 180f) % 360f - 180f;
    return dist <= -180f ? dist + 360 : dist;
}

If I made any errors, please let me know.
Thank you in advance!

sentences:
How do I make my character stop going left in Unity? I have this code and my character can go left, right and jump. I don't want the character going left, so how can I remove that. (I'm very new with coding)

public class Player: MonoBehaviour {

    public float maxspeed = 10f;
    bool facingRight = true;

    Animator anim;

    bool grounded = false;
    public Transform groundCheck;
    float groundRadius = 0.2f;
    public LayerMask whatIsGround;
    public float jumpFocre = 500f;

    bool doubleJump = false;

    void Start ()
    {
        anim = GetComponent<Animator> ();
    }

    void FixedUpdate () {
        grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);
        anim.SetBool ("Ground", grounded);

        if (grounded)
            doubleJump = false;

        float move = Input.GetAxis ("Horizontal");
        anim.SetFloat ("Speed", Mathf.Abs (move));

        GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxspeed, GetComponent<Rigidbody2D>().velocity.y);
    }

    void Update()
    {
        if((grounded || !doubleJump) && Input.GetKeyDown ("up"))
        {
            anim.SetBool("Ground", false);
            GetComponent<Rigidbody2D>().AddForce(new Vector2(0, jumpFocre));

            if(!doubleJump && !grounded)
            doubleJump = true;
        }
    }

    void Flip()
    {
        facingRight = !facingRight;
        Vector3 theScale = transform.localScale;
        theScale.x *= -1;
        transform.localScale = theScale;
    }
}

sentences:
Ball bouncing infinitely and constantly Alright, so I've got hold of some simple physics mechanics, and am currently trying to implement bouncing. Based on the first answer of this question, I've developed the following algorithm:

    Vector2 velocity;

    float gravity;
    float elasticity;

    Hitbox dummy;

    // ---

    void bounce() {
        dummy.MoveY(velocity.Y);
        velocity.Y += gravity;

        if (dummy.ThereWasContact.South) velocity.Y *= -elasticity;
    }

Gravity can be any value, and Elasticity is always between 0.0f and 1.0f. Velocity.Y's initial value can also be anything.

Weight factors aside, which would determine a minimal rebound force for the object to be able to leave the ground again and (probably) aren't related to the problem, this is apparently fallacious.

What happens here is somewhat like this:

If I drop an object from a height of 128 units, for example, 0u marking ground height, with a gravity of 1u and elasticity of 0.9, the object would bounce once, reach a maximum height of ~126u from the rebound, and from then on keep alternating on maximum heights between this and ~122u.

This example is based on one of my own experiments, in which I drop an object from a height of 64 pixels and there is a floor at 192 pixels. The maximum height will keep going from ~66 pixels to ~70.

What am I missing? Does weight after all do more than I think? If I need to explain something better or details appear to be missing, let me know.

sentences:
How can i change the hit distance of RaycastHit? I'm using this script to send a raycast from the center of the camera to objects.
It's working fine but only if i'm getting close enough to objects. But for example if it's npc person i want to be able to detect him as "Interactable" from a more distance. How can i change/set the hit distance ?

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

public class CameraRaycast : MonoBehaviour
{
    public Camera cam;

    void Update()
    {
        Ray ray = cam.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
        RaycastHit hit;
        if (Physics.Raycast(ray, out hit))
            if (hit.transform.tag == "Interactable")
            {
                print("I'm looking at " + hit.transform.name);
            }
            else
                print("I'm looking at nothing!");
    }
}

sentences:
Why doesn't my texture display with this GLSL shader? I am trying to display a DXT1 compressed texture on a quad using a VBO and shaders, but I have been unable to get it working. All I get is a black square.

I know my texture is uploaded properly because when I use immediate mode without shaders the texture displays fine but I will include that part just in case. Also, when I change the gl_FragColor to something like vec4 (0.0, 1.0, 1.0, 1.0) then I get a nice blue quad so I know that my shader is able to set the colour. It appears to be either the texture is not being bound correctly in the shader or the texture coordinates are not being picked up. However, I can't find the error! What am I doing wrong?

I am using OpenTK in C# (not xna).

Vertex Shader:

void main() {
    gl_TexCoord[0] = gl_MultiTexCoord0;
    // Set the position of the current vertex
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Fragment Shader:

uniform sampler2D diffuseTexture;
void main() {
    // Set the output color of our current pixel
    gl_FragColor = texture2D(diffuseTexture, gl_TexCoord[0].st);
    //gl_FragColor = vec4 (0.0,1.0,1.0,1.0);
}

Drawing Code:

int vb, eb;
GL.GenBuffers(1, out vb);
GL.GenBuffers(1, out eb);
//                      Position        Texture
float[] verts = {   0.1f, 0.1f, 0.0f,  0.0f, 0.0f,
                    1.9f, 0.1f, 0.0f,  1.0f, 0.0f,
                    1.9f, 1.9f, 0.0f,  1.0f, 1.0f,
                    0.1f, 1.9f, 0.0f,  0.0f, 1.0f
                };
uint[] indices = {
                   0, 1, 2,
                   0, 2, 3
                 };

//upload data to the VBO
GL.BindBuffer(BufferTarget.ArrayBuffer, vb);
GL.BindBuffer(BufferTarget.ElementArrayBuffer, eb);

GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts.Length * sizeof(float)), verts, BufferUsageHint.StaticDraw);
GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(indices.Length * sizeof(uint)), indices, BufferUsageHint.StaticDraw);

//Upload texture
int buffer = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, buffer);

GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (float)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (float)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (float)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (float)TextureMinFilter.Linear);

GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, (float)TextureEnvMode.Modulate);

GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, texture.format, texture.width, texture.height, 0, texture.data.Length, texture.data);

//Draw
GL.UseProgram(shaderProgram);

GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);

GL.VertexPointer(3, VertexPointerType.Float, 5 * sizeof(float), 0);
GL.TexCoordPointer(2, TexCoordPointerType.Float, 5 * sizeof(float), 3);

GL.ActiveTexture(TextureUnit.Texture0);
GL.Uniform1(GL.GetUniformLocation(shaderProgram, "diffuseTexture"), 0);

GL.DrawElements(BeginMode.Triangles, indices.Length, DrawElementsType.UnsignedInt, 0);

sentences:
How can I speed up the shapes drawing on high-density devices? I have a game that should draw many shapes on the canvas and in every frame these shapes position will change, the game is running smooth but after adding more shapes some jerk arise and it drops some of frames. And this is just happening in high-density devices (more than 320 dpi).

public void run() {
    while (mRunning) {
        if (mSurfaceHolder.getSurface().isValid()) {

            synchronized (mSurfaceHolder){
                canvas = mSurfaceHolder.lockCanvas();

                canvas.drawColor(Color.BLACK);
                drawOnCanvas(canvas);

                mSurfaceHolder.unlockCanvasAndPost(canvas);
            }
        }
    }
}

draw function

public void drawOnCanvas(Canvas canvas) {
    new Thread(changeGamePosRunnable).start();

    for (int i = 0; i < obstacles.size(); i++) {
        Obstacle obstacle = obstacles.get(i);
        x= obstacle.getX();
        y=obstacle.getY();

        canvas.drawLine(0, 0, x, y, linePaint);
        canvas.drawBitmap(bitmap,x,y,null);
    }
}

I have created bitmaps in the constructor, initializing all variables out of the game loop, using SurfaceView and implements Runnable, added Thread.sleep(5); to while loop, tried to decrease bitmap size to about 240 bytes, tried to draw circle instead of bitmap again no change.

It's so strange that the drawing function is so slow in high-density devices, I tried to use some bitmaps as buffer and use them in 3 threads but the game sometimes draw on the wrong location. also I think drawing on another bitmap is not a right solution.

How can I speed things up? The quality does not matter, I just need some more speed.

sentences:
Resource streaming with job threading system I am currently researching resource streaming for my current game engine. To add a bit of context, I am doing a contiguous world for a Baulder's Gate style CRPG. So while the camera is usually looking downwards at an angle... it can be rotated and lifted up and down to compensate for mountains.

That means for vistas, it needs to be reasonably decent. At least with an added advantage that there will probably be very few unique assets that will be loaded in every terrain cell. (currently each cell is about 60m).

Most of the research I found turns up to have a separate thread for loading in assets. I can see how that works, as obviously holding such a thing on the main thread could introduce stalls.

But... currently my architecture is the main thread which has rendering and gamelogic. Then the rest are just worker threads for a job system.

I planned on moving the Rendering system off of the main thread, which means that on a common consumer PC (4 threads) I have two fixed threads... and two worker threads.

Moving a loader to it's own thread would basically reduce performance on some update cycles to a single threaded update.

My main thread is controlled by lua, and low level systems are in C++. Lua dispatches low level jobs only (Physics first, Animation updates, Transform updates, dispatch to renderer), and waits for them to finish before continuing to the next job dispatch, as certain data requires information from the previous component updates.

Annd... one recommendation I ran across, (because I am only targeting PC for now) was to keep data about each cell on the memory. Such as transforms, skeleton handles, material handles, etc.

So... I have a few questions. How well would a resource streamer work if each loading call was dispatch to a job as it is needed? From my research, I found multiple people stating that multiple async loading could slow the disk drive down.

What would be a few effective strategies for resource streaming? I know that it's better to have everything in one file, like a zip instead of scattered about folders. But I could never find any straight answers. One google search said to cut the file up into equally sized bits (which sounds logically stupid in my opinion.) another was priority loading, which sounds pretty reasonable. I understand this question is pretty vague, but finding answers in general in a world dominated by pre-built engines is already difficult enough.

sentences:
Algorithm for procedureral 2D map with connected paths Problem to solve: Generate a random 2D dungeon map for a tile-based game where all rooms are connected.

I am looking for better solutions than what I currently have.

My current solution is that I run two algorithms. The first generates the dungeon with its rooms. The second make sure that all rooms are connected. I am curious what other soltions may exist. Faster and / or easier etc. Speed is not really a concern, but if speed can be gained at no real cost, well, that is a good thing. More important is that I, and others that read, may learn different ways to approach and solve the problem.

Below are my current implementation. Rooms currently have no exits or exits in any 2, 3 or 4 directions.

Generating the dungeon rooms

Setup: Set the current room to the top left room.

Get a valid room type for the room (where valid room type is a type with no exits out of the dungeon and that have exits that matches the exits of the room above and the room to the left. Only need to check above and to the left due to step 2 below).
Put down the room and advance the x-coordinate one step. If the x-coordinate exceeds the dungeon width, set the x-coordinate to 0 and advance the y-coordinate one step. If the y-coordinate exceeds the dungeon height, we are done.
Repeat from #1.

I then check to see if all rooms are connected If they are not all connected I run a second algorithm that, in a non-sexy but definately good enough way in terms of dungeon layout, goes through the rooms and change them so that all end up being connected.

Checking to see if all rooms are connected

Setup: Create a 2D map of integers representing paths and initialize the entries to a "unprocessed" (not yet traversed) value, -1. Set a start path index integer that keeps track of the current path to 1. Set the current room to the top left room by adding it to a stack of rooms to check.

If the stack contains rooms to check, pop it set the path index of the room to the current path index. If the stack does not contain any rooms, increase the path index and try to get a room by advancing column by column, row by row, until we get a room that has not been processed yet. If no room can be found, we are done.
Check to see if the room has an exit to the left. If it has add the left room to the stack if it is not already on there.
Repeat step 2 for down, right and top directions (since we are using a stack that means the rooms are traversed in clockwise order, starting with the top direction).
Repeat from step 1.
If the path indices count is greater than one, there are disconnected rooms.

If there are disconnected rooms I then group the rooms by their path index, get the index of the biggest path and connect all other rooms to those rooms. This is a work in progress, but my (current, "brutish") plan is to go through each room in a room group (except the first) check to see if there is a horizontal or vertical path to the biggeset room group, and if so, create a horizontal / vertical path there by injecting / updating the rooms inbetween. Rinse and repeat. Ugly, yes, but it is something that will not be noticable in terms of visual pattern so it works in that sense.

sentences:
Developing a platform - why are age verifications even a thing? I'm building an online gaming platform and have bumped into the question of age verification. Checkboxes such as "I verify that I am 13 years old or older" or a slider where you put in your age are common online when registering for accounts.

Why? I've been checking that box since I was a kid, it doesn't stop anyone. If you put it in your Terms of Service, is that enough?

Does any of this actually matter?

sentences:
How can I move my player on exact x and y coordinates, like on a grid? I'd like to implement movement exactly like it is done in this game. (You can see it in action on YouTube.)

I need my Player to always stay in the center of X and Y similar to grid movement, but with free movement/line like. Only move on x and y lines. And I need smooth changes at intersections.

 var x = Input.getAxis("Horizontal");
 var y = -Input.getAxis("Vertical");
 var deltaPos = Vector2.zero;

 if (Mathf.Abs(inputY) > Mathf.Abs(inputX)) {
     deltaPos.Y = speed * inputY * Time.deltaTime;
 }
 else {
     deltaPos.X = speed * inputX * Time.deltaTime;
 }

 transform.position += deltaPos;

sentences:
How do I get the vertical angle between 2 vectors? So I'm modding a 3D game, my goal is to place a label on the screen pointing to the unit's direction. I'm getting the horizontal angle by projecting these vectors in a plane, like this:

private double getXAxisAngle(EntityPlayer player,EntityPlayer player2){

    double meYaw = player2.rotationYaw;
    double meX = player2.posX;
    double meZ = player2.posZ;
    double playerX =  player.posX -meX;
    double playerZ =  player.posZ-meZ;
    double yawX = Math.cos(Math.toRadians(meYaw));
    double yawY = Math.sin(Math.toRadians(meYaw));
    double dist = getDist(playerX,playerZ);
    playerX = playerX / dist;
    playerZ = playerZ / dist;
    dist = getDist(yawX,yawY); //get the vector magnitude
    yawX = yawX / dist;
    yawY = yawY / dist;
    double angle1 = Math.toDegrees(Math.atan2(yawY, yawX));
    double angle2 = Math.toDegrees(Math.atan2(playerZ, playerX));
    double angle = angle1-angle2;
            angle+=90; //So when it's facing the other unit it becomes 0
    if(angle > 180)
        angle-=360;
    else if(angle < -180)
        angle += 360;

    return angle;
}

This function gives me an angle between 0/-180 and 0/+180, depending on which side I'm facing then I get this angle and transform into a coord into the screen like this:

private double angleXToPosition(double angle,FontRenderer fontrenderer,String label)
{
    ScaledResolution scaledresolution =
        new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);

    double width = scaledresolution.getScaledWidth();

    double namePosX =
        (int)(angle * ((width / 2 - (fontrenderer.getStringWidth(label) / 2)) / 50)) +
        width / 2 - (fontrenderer.getStringWidth(label) / 2);

    //If the angle is bigger then 50 the label sticks on the side of the screen
    if (angle > 50)
        namePosX = width - (fontrenderer.getStringWidth(label));
    else if (angle < -50)
        namePosX = 0; //Same as above

    return namePosX;
}

And it works until this, the label moves perfectly to the sides, accompanying the unit position on the screen, but now I'm trying to make the label move up and down and the same functions doesn't work, and I can't figure this out.

Some info: the pitch of the player when facing the sky is -90 and when facing the ground is 90.

sentences:
How to draw a diagonal fade-in and fade-out? How to draw a diagonal fade-in/fade-out in 2D using MonoGame draw API?

For a simple (non-directional) fade-in/out drawing the background with alpha variation do  the tricks, but what is the standard way to fade-in/fade-out directionally in 2D?

(The background is a texture, not a unicolored background)

sentences:
Can't refer mesh size after using .BakeMesh() in Unity I can't figure out how to refer to the size of a particular mesh.

The mesh is created through .BakeMesh(), then a box collider is added. Unfortunately the box collider has a scale of 1 by 1 by 1, regardless of how big the mesh I'm adding it to seems to be.

This doesn't match my understanding of how creating a box collider should work, so I've set up a Debug.Log that outputs the mesh size.

Here the plot thickens. The mesh's size just comes back at 0, 0, 0.
My attempts at getting the size of the object are as follows:

objectToMeasure.GetComponent<Renderer>().bounds.size;

objectToMeasure.GetComponent<MeshFilter>().mesh.bounds.size

objectToMeasure.GetComponent<MeshFilter>().sharedMesh.bounds.size;

Assuming I'm referring to the size of the object in the correct way, this seems like it must be an issue created by baking the object. Do I need to wait a frame (via starting a coroutine) before trying to access the size of the object, or am I referring to the wrong component of the object, or is the BoxCollider setting it's size based on objectToMeasure's scale rather than it's size in the world?

I feel sure that
objectToMeasure.GetComponent().mesh.bounds.size;
should be right, since the script I use to bake to the mesh is:
meshToBake.BakeMesh(meshToMeasure.GetComponent().sharedMesh);

I've been driving myself to the edge of sanity for 24 hours with this script not working, so advice is greatly appreciated.

sentences: Minimax for Bomberman I am developing clone of Bomberman game and I am experimenting with different types of AI. First I used searching through state space with A* and now i want to try different approach with Minimax algorithm. My problem is that every minimax article i found assumed players alternates. But in Bomberman, every player make some action at the same time. I think i could generate all possible states for one game tick, but with four players and 5 basic actions (4 moves and bomb place) it gives 5^4 states at first level of the game tree. That value will raise exponentially with every next level. Am I missing something? Are there any ways to implement it or should i use totally different algorithm? Thanks for any suggestions

sentences:
Math and physics, where to start? the only math I know how is to add the velocity to position. Thats it. i would like to know how to do more stuff, physics, collision detection with stuff other than perfect circles, etc.
But where ever I go online to find source to learn I always end up with something that assumes prior knowledge, which is understandable in a lot of cases. But I don't know where to go to learn math and physics from the absolute beginnings. Also I'm dyslexic, so sites or ressources with just definitions of concepts and no relatable examples wont help that much. So could someone give me some links to books and/or sites that can help me learn math and physics for game development.

sentences:
Is it possible that elements in the StreamingAssets folder are not read in build? I'm making a 2D game. In my StreamingAssets folder I have a JSON file with some info about inventory items (id, description, rarity, name, is stackable or not) and a png file which contains a pixel map (128x32) of the level I want to load after a first scene (this is from Quill18's tutorial: https://www.youtube.com/watch?v=5RzziXSwSsg , basically a specific color corresponds to a specific prefab. An object reads through all the pixels and then spawns the level). The fact is that I have issues with both these elements when the game is built (everything works perfectly in the game window in Unity): the inventory items don't collide with the player and the level is not loaded.

This is the code that gets the image name

public string levelFileName;
string filePath = Application.dataPath + "/StreamingAssets/" + levelFileName;
byte[] bytes = System.IO.File.ReadAllBytes (filePath);
Texture2D levelMap = new Texture2D (2, 2);
levelMap.LoadImage (bytes);

And the pickable objects basically have a collision detection script and have a specific ID, so that when they collide with the player, the inventory adds in a free slot an image with the specs correspondant to that ID (i.e. ID=1 then it's an health potion, is stackable, it's not rare and so on). Everything else works fine in the game.
Do you think that the issue is linked to the StreamingAssets folder (first time using it) or is it just a coincidence? And also could you help me solve the problem?
Thank you in advance for any kind of help.

Edit: my Player logs:

sentences:
How to let game characters enter existing 3D buildings model in my own game? I want to use ShiVa 3D game engine to build a 3D RPG game. And I want to load other people's 3D models into my game so that I wouldn't need to draw these things myself.

Here's a building model I loaded in 3ds Max, I don't know if I loaded this model in game engine, can my character enter this building and see the decoration inside? How can I verify this?

http://i.imgur.com/GHWQjXA.png

And if I cannot let my character enter this building, is there any resources that I can use on the Internet?

Thanks in advance.

sentences:
Multiplayer matchmaking algorithm I'm building a game in which there are tournaments.
During the tournaments we want players to play against each other in an efficient way.

What I'm looking for is a generic algorithm that will match players together in an optimal way in order to:

Have the lowest amount of games possible
Be reasonably sure that after all games are played, the highest-ranked player is the best

Tricky part:

Games can have 2, 3 or 4 players in a death match depending on the tournament.
Tournaments have two or more players, no other constraints.

Does such an algorithm exist?

Note: For the ranking, I will probably be using an ELO-based algorithm (unless you have a better suggestion).

sentences:
When when pressing on the G key one of parts is scaling slower then the other? Each Prefab is built with canvas and two panels childs of the canvas.
I'm scaling the two panels. The automatic mode part is working fine.

The problem is with the G key. When I press once on G it's scaling both panels up to maxSize then when pressing on G once again it's scaling the panels back down to minSize.

But when I press on G quick in the middle while it's scaling them it should turn the scaling side in the middle. For example if I press G and both panels start scaling to maxSize if in the middle I press on G again it should scale them both to minSize without getting first to the maxSize. But in this case one of panels is keep scaling to maxSize a bit and then move back to minSize.

But they both should turn side in the middle at once. It seems like one of them have a lag he turn sides a bit after the first one.

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

public class Scaling : MonoBehaviour
{
    public GameObject Prefab;
    public int numberOf = 1;
    public float duration = 1f;
    public Vector3 minSize;
    public Vector3 maxSize;
    public bool scaleUp = false;
    public Coroutine scaleCoroutine;
    public bool automatic = false;
    public bool coroutineIsRunning = false;

    private List<GameObject> parts = new List<GameObject>();

    private void Start()
    {
        for (int i = 0; i < numberOf; i++)
        {
            GameObject objecttest = Instantiate(Prefab);
            foreach (Transform child in objecttest.transform)
            {
                parts.Add(child.gameObject);
            }
        }
    }

    private void Update()
    {
        if (automatic)
        {
            if (!coroutineIsRunning)
            {
                Scale();
            }
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.G))
            {
                Scale();
            }
        }
    }

    private void Scale()
    {
        scaleUp = !scaleUp;

        if (scaleCoroutine != null)
            StopCoroutine(scaleCoroutine);

        for (int i = 0; i < parts.Count; i++)
        {
            if (scaleUp)
            {
                scaleCoroutine = StartCoroutine(ScaleOverTime(parts[i], maxSize, duration));
            }
            else
            {
                scaleCoroutine = StartCoroutine(ScaleOverTime(parts[i], minSize, duration));
            }
        }
    }

    private IEnumerator ScaleOverTime(GameObject targetObj, Vector3 toScale, float duration)
    {
        float counter = 0;
        Vector3 startScaleSize = targetObj.transform.localScale;

        coroutineIsRunning = true;

        while (counter < duration)
        {
            counter += Time.deltaTime;
            targetObj.transform.localScale = Vector3.Lerp(startScaleSize, toScale, counter / duration);

            if (counter > duration)
                coroutineIsRunning = false;

            yield return null;
        }
    }
}

sentences:
Behavior Trees and Animations I have started working on the AI for a game, but am confused how I should handle animations.  I will be using a Behavior Tree for AI behavior and Cocos2D for my game engine.

Should my "PlayAnimationWalk" just be another node in the tree?

Something similar to this:
[Approach Player]
- Play Walk animation
- Move Towards player
- Stop Walk animation

Or should the node just update an AnimationState in the blackboard and have some type of animation handler/component reference this for which animation should be playing?

This has been driving me nuts :)

sentences:
How to get which gameobject the mouse is over in Unity? So I'm working on a simple drag-n-drop based trading card game for my own amusement.

There is a card inspector included.

What I want to achieve is to change values in the inspector (which has its own Inspector.cs, so I would change the variables in it) based on which card I hover over with my mouse.

Each card has its own Card.cs attached from which I want to read the values of the current card.

If I try to do this from within the Inspector.cs by something like this: Name.text = gameobject.GetComponent<Card>().Name;, then obviously it won't work, because using gameobject in the current context is not valid.

So solution No1 would be to properly reference the gameobject over which the mouse is, which I don't know how to do.

When I try to do the same from within Card.cs, I cannot use an event trigger OnPointerEnter and run the code through that, because I have to have a reference to the gameobject that contains that function. ( And I cannot do that in a prefab, only in gameobject already existing in the level.)

So could anyone tell me how I could achieve what I want, please?

sentences:
How to display a tile map from a 2D array in JavaScript? I have stored my map, but the problem I am having is displaying it. My map is 100x100 tiles which are 40x40px.

I have my loop running through the array but I'm having difficulty selecting the portion of the map image to relate to the tiles. This is the code which selects the portion of the image on each iteration:

var sx = Math.floor(tileId % 8 * tileWidth); //source x
var sy = Math.floor(tileId / 8 * tileHeight); //source y

I'm using Canvas and keep getting this error message:

INDEX_SIZE_ERR: DOM Exception 1: Index or size was negative, or greater than the allowed value.

I'm guessing the remainder or division by 8 is wrong, this is something I picked up from the net, but what exactly does that integer need to be?

Thanks

sentences:
Game loop with fixed timestep gives strange result So I've read the famous article at http://www.koonsolo.com/news/dewitters-gameloop/comment-page-2/#comments which describes different methods of implementing a game loop. I've tried to implement the final method that is described in the article in Javascript (ignoring interpolation for the time being):

var Timer = {
        pastTime : 0,
        currentTime : 0,
        started : false,
        //starts the timer
        start: function(){
            if(!this.started){
                this.started = true;
                this.pastTime = new Date().getTime();
            }
        },
        //gets the time in MILLSECONDS
        getTime: function(){
            return new Date().getTime() - this.pastTime;
        },
        //stops the timer but does not reset it (i.e. getTime() can still be
          called to get the time between start() and end())
        end: function(){
            if(this.started){
                this.currentTime = new Date().getTime();
                this.started = false;
                return this.currentTime - this.pastTime;
            }
        },
        //resets the timer
        reset: function(){
            this.pastTime = 0;
            this.currentTime = 0;
            this.started = false;
}

var maxFrameSkip = 5;
var nextTick = new Date().getTime();
var TICKS_PER_SECOND = 25;
var tickTimeMillis = 1000 / TICKS_PER_SECOND;

var ticksPerSecondReal = 0;
var ticksCounter = 0;

var timer = Object.create(Timer);

var loops = 0;

 function gameLoop(){
    loops = 0;

    timer.start();

    while(new Date().getTime() > nextTick && loops < maxFrameSkip){
        update();
        ticksCounter++;
        nextTick += tickTimeMillis;
        loops++;
    }

    draw();

    if(timer.getTime() >= 1000){
        ticksPerSecondReal = ticksCounter;
        ticksCounter = 0;
        timer.reset();
    }

    console.log(ticksPerSecondReal);

    window.requestAnimationFrame(gameLoop);
}

 gameLoop();

So the problem that I'm having is that the console.log(ticksPerSecondReal) should always be giving me 25 because that's the constant ticks per second that I want and have set up. What I end up getting is an alternating number that is 25 and 26. So periodically (~1 second) it will be 25 and then 26 and then 25 and so on. And sometimes (much less frequently) it will even give a result of 27. It keeps switching back and forth when it should be constant at 25. What is the issue here?

sentences:
Which server platform to choose I'm going to write a server for an online multiplayer with these requirements:

Pretty simple turn based game (think a card game) that is played entirely on the server (security reasons)
Must be able to run multiple games (tables) with 4 players per table, but no lobby system required (another server takes care of that)
Can support as many players at once as possible; Might need multiple servers
Chat between players
Socket connection to a Flash/AIR client
Must be able to communicate with other servers (for player accounts and such)

Now, I'm considering two options:

Smartfox (or equivalent)
A custom Java solution in something like Tomcat

Why Smartfox?

It handles multiple rooms and chat natively
It presumably has solutions for well-known multiplayer gaming issues

Why custom?

Smartfox has many unneeded functions, bad for performance
Smartfox communicates with an XML-based format, I could use a more efficient binary one.
Don't know if running the entire game model on the server is convenient with Smartfox' extension mechanism
Multiple rooms and chat are easy to reimplement
Tomcat or a lightweight container is easier to deploy than Smartfox
Better IDE support for developing on Tomcat (automatic deploy, etc)

What do you think? Are my assumptions correct? Do you have anything to add? What option should I choose (or maybe a different one entirely)?

sentences:
Dot based light mask with shader on sprites So I have a scene, completely based on 2D sprites. I want to render "light sources" into a seperate frame buffer (so mostly dots around, for example, the centre of a flame) and then render that frame buffer with my "lighting" shader above my whole scene, causing the light sources to "tint" the surrounding pixels, mostly by blending a pixel with the light source's color dependant on it's distance to the nearest light source.

The question:
What concepts should I apply here to get the results I want?
What am I doing wrong right now?

I have here a few concept drawings:

The scene without lighting:

The framebuffer of the scene containing the light source (the top yellow pixel of the flame):

The result of rendering the framebuffer as a texture with the glow shader. I also "simulated" a 2nd buffer with a smaller radius and a yellow light at the same position.

Alternatively, and closer to my first approach to the idea, imagine the whole framebuffer of the 2nd pixel transparent but the dot at the center.

What I wasn't able to mock up quickly was a gradient of the lighting, dimming it at the edges and having it brighter at the center.

The current idea needs to conform this fragment shader's layout:

#version 400
uniform sampler2D color_map;
layout(std140) uniform Sprite {
    vec2 position;
    vec2 size;
    vec2 position_in_texture;
    vec2 size_in_texture;
    float rotation;
};
in vec2 texture_coordinate;
layout(std140) uniform Color {
    vec4 color;
};
layout(location = 0) out vec4 out_color;
void main(){
    vec4 tex_color = texture2D(color_map, texture_coordinate);
    vec2 diff;
    vec2 norm;
    vec2 sample_coordinate;
    out_color = tex_color;
    int radius = 4;
    int count = 1;
    norm = vec2(radius/size.x, radius/size.y);
    for(int i=-radius; i < radius; i++){ //Sample each pixel around the one rendered right now and add it's color to the current one with a certain gradient factor
        for(int j=-radius; j < radius; j++){
            diff = vec2(i/size.x, j/size.y);
            sample_coordinate = texture_coordinate + diff;
            if(0.0 <= sample_coordinate.x && sample_coordinate.x <= 1.0 && 0.0 <= sample_coordinate.y && sample_coordinate.y <= 1.0){
                tex_color = texture2D(color_map, sample_coordinate);
                if(tex_color != vec4(0.0,0.0,0.0,0.0) && sample_coordinate != texture_coordinate && length(diff) <= length(norm)){
                    out_color = (out_color * count + tex_color * (1.0 - (length(diff) / length(norm)))) / (count+1);
                    count++;
                }
            }
        }
    }
}

I am planning on making the radius variable by passing it as another uniform element.
With what I am doing there, I don't get the results I am looking for.

Though through experimenting I got this glow-shader, which I like, but the edges of the logo are still a bit too dark though (left the passed frame above the original, that is right):

sentences:
Algorithm for spending x points on y things divided by n people I'm trying to devise an algorithm to spend a given amount of points on a randomly generated list of items each with their own cost in a way that results in having a number of items that is divisible by a given value (the number of points given is always divisible by this). Each item must be represented as equally as possible.

Points: 12
Divisor: 6
Items: Foo (1) & Bar (3)

The optimal result would be 3 Foo and 3 Bar (12 total points and 6 items).

That could be achieved by filling the space alternately starting with the smallest item but that algorithm won't work for other permutations of the starting values or if there are more items to spend points on, some of which may have the same value as other items but must be represented equally in the final result.

The algorithm can result in spending less points than are available but never more. There may not always be a 1 cost item to fill in any remainders.

Another example I can't solve...

Points: 24
Divisor: 8
Items: Foo (1), Nacho (1) , Pizza(2), Bar (3), Cake (4)

Just spending all of the points is easy but spending it in such a way that you end with a specific number of items that can be divided between the divisor has had me scratching my head all day.

sentences:
How can I make natural rain drops on screen? I'm trying to make rain effect drop with metaballs and trail on screen.I find a clue in shadertoy but I didn't understand how implemented:
https://www.shadertoy.com/view/ltffzl
unfortunately it have many math calculations and i can't use it in unity because it produces a lag.obviously I should use textures but how can I have trail effect?!

my idea is using a texture and trail renderer for droping but how can I have metaballs effect?

Update
I could Implement Metaballs by This Article
https://github.com/smkplus/RainFX/tree/master
but I haven't Idea about trail

sentences:
Minecraft/OpenGL - Create Multiple viewports I'm working on a project for the game and i have been trying to draw a second smaller "window" that would act like a second camera, independent from the player.

I have looked into glViewport however i keep running into issues where the second viewport is the only one being drawn (the first one gets covered  by the second and has a blank screen where the first viewport should be:

So i guess the question is: How can i have multiple windows on screen and make it so it plays nice with the game's default rendering system?
I know it is possible since the game uses OpenGL, and maybe its just a simple case of putting the code in the right class.

sentences:
Cannot find folder when building game to .jar LibGDX Whenever I run my game from my IntelIJ IDEA the game runs fine. It finds every folder and every asset in there. But whenever I build my game with :desktop:dist and run it it will not see the folder I try to open as a folder and it will have 0 contents.

This is the code I use to open the folder:

        FileHandle mapFolder = Gdx.files.internal("maps");

    System.out.println(mapFolder.list().length);

    for (FileHandle entry : mapFolder.list()) {
        System.out.println("something is in");
        maps.add(new Map(entry.toString()));
    }

    loadMap(maps.get(0));

The length it prints is 0. It does not print something is inso im fairly sure this is not working.

Whenever I try Gdx.files.classpath I get this error: Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Cannot list a classpath directory: maps

For clarification: It's a desktop only project. So no android.

I cannot figure it out, and I've looked at a lot of topics to try and fix this issue.

sentences:
reflecting objects by rendering them to the cubemap I have 2 sphere objects and it isn't reflecting the other one. The picture is when it simply reflects the cube map but when I try to render to the cube map the spheres turn out black.
In camera class:
    void switchToFace(int faceIndex) // For Cube Map camera
    {
        switch (faceIndex)
        {
        case 0:
            m_pitch = 0;
            m_yaw = 90;
            break;
        case 1:
            m_pitch = 0;
            m_yaw = -90;
            break;
        case 2:
            m_pitch = -90;
            m_yaw = 180;
            break;
        case 3:
            m_pitch = 90;
            m_yaw = 180;
            break;
        case 4:
            m_pitch = 0;
            m_yaw = 180;
            break;
        case 5:
            m_pitch = 0;
            m_yaw = 0;
            break;
        default:
            break;
        }
    }

In main
static GLuint createEmptyCubeMap(int width, int height)
{
    GLuint textureID;
    glGenTextures(1, &textureID);

    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
    for (GLuint i{ 0 }; i < 6; ++i)
    {
        glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
    }
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

    return textureID;
}
main()
{
// stuff
    glm::vec3 spherePositions[] = {
    glm::vec3(0.0f, 0.0f, 0.0f),
    glm::vec3(-1.5f, -2.2f, -2.5f),
    };
    // new cubemap
    Camera reflectionCamera(glm::vec3(0.0f, 0.0f, 0.0f));  // Camera position. Should be on ball

    GLint imageWidth, imageHeight;
    SOIL_load_image(faces[1], &imageWidth, &imageHeight, 0, SOIL_LOAD_RGB);
    GLuint newEnvironment = createEmptyCubeMap(imageWidth, imageHeight);

    GLuint FBO{}, DBO{};

    glGenFramebuffers(1, &FBO);
    glBindFramebuffer(GL_FRAMEBUFFER, FBO);
    glDrawBuffer(GL_COLOR_ATTACHMENT0);

    glGenRenderbuffers(1, &DBO);
    glBindRenderbuffer(GL_RENDERBUFFER, DBO);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, imageWidth, imageHeight);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DBO);

    glViewport(0, 0, imageWidth, imageHeight);

    for (GLuint i{ 0 }; i < 6; ++i)
    {
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, newEnvironment, 0);

        reflectionCamera.switchToFace(i);
    }

    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    glViewport(0, 0, WIDTH, HEIGHT);

    while(window.isOpen() // SFML)
    {
        glBindVertexArray(sphereVAO);
        for (GLuint i{ 0 }; i < 2; ++i)
        {
            model = glm::mat4();
            model = glm::translate(model, spherePositions[i]);
            glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model)); // modelLoc is location of uniform model
            glActiveTexture(GL_TEXTURE0);
            glBindTexture(GL_TEXTURE_CUBE_MAP, newEnvironment);
            glDrawElements(GL_TRIANGLES, numberOfIndexes, GL_UNSIGNED_INT, 0);
        }
    }
}

The sphereVAO is simply the Vertex Array Object for the sphere and here we bind the texture to the newEnvironment which is supposed to reflect the other object in spherePositions[i]
The picture above is the sphere Position at (0, 0, 0).
But the code results in this:

sentences:
How do you clean up textures that are too photo-realistic to match the rest of your game assets? I was browsing for textures online and notice most of it are too photo-realistic and many of them is just photo of real thing.
I'm sure there some "cleanup" process for this type of texture using Photoshop filter or via other tool etc.
Let say I want texture to match Left for Dead 2 look.
Does anyone have any links\resources on this?

sentences: Setting up 3d Collision for Primitive shapes Im having some trouble understanding how to set up collision detection between my first person camera and my primitive shapes which are made using the vertex buffer. Do i give my camera a boundingBox and all my objects a boundingbox then add them to a list and check the list for collsions or is there a better more understanding way to do this. My game is literally a maze game so all i really need is my camera to accept collisions against the primitive objects. Thanks in advance.

sentences:
Why is my OpenGL 4.1 shader not working on OS X Macbook ( works on Linux )? I've recently rebuild shaders for my program and it stopped "working" ( black screen ) on OS X ( El Capitan ), but it's ok on Linux. What could be the cause?

There are no shader compilation errors, and here is my shader code:

https://github.com/Marqin/YuriaViewer/blob/master/vertex.glsl

Keep in mind that this software worked on El Capitan with OpenGL 4.1 before shader rewrite. Here are my glfw hints:

glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

My program also is checking for GL_ARB_gpu_shader_fp64 and it's available on my Macbook ( Macbook Air 2013 mid ).

EDIT1:

I've "debugged" it a little and it looks that i is always lesser than vis on OS X, that's why it's black.

EDIT2:

I made a simple test - I've typed all uniform values in shader by hand and now it wasn't black, but I've got some gibberish on screen. Then I've changed every dvec3 and dvec2 to float versions and it showed nice fractal. So it looks like double is not working on OS X. But how can it be? It's saying that GL_ARB_gpu_shader_fp64 is available and it even doesn't complain when I request it in vertex shader.

EDIT3:

It works on iMac with R9 M395. So it's problem with Intel hardware ( or problem with OS X Intel driver ).

sentences:
Life Counter in Greenfoot caught "Incompatible Types" exception I need to make a life counter so that when my Actor get hit by an Enemy, his life will be decreased by 1.

I put this method in my Actor class:

private void decreaseLife() {
    Actor enemy = getOneIntersectingObject(Enemy.class);
    if (enemy != null) {
        int lastIndex = Scenario.getLifeBar().size()-1;
        Life LastLife = Scenario.getLifeBar().get(lastIndex);
        /** catch error on lastIndex --> "incompatible types" **/

        getWorld().removeObject(enemy);

        getWorld().removeObject(LastLife);
        Scenario.getLifeBar().remove(lastIndex);
    }
}

I used Scenario.getLifeBar().size() - 1; to get the last index from my ArrayList collection then decrease it by 1. My LifeMax was set to 3, so when decreased by 1 it should be returning value = 2, and be saved in lastIndex.

This is my code including LifeBar code in Scenario Class:

import greenfoot.*;
import java.util.ArrayList;

public class Scenario extends World {
    private final int LIFE_MAX = 3; //Max value of my Actor's life
    private static ArrayList LifeBar = new ArrayList();

    public Scenario() {
        super(600, 400, 1);
        prepare();}

    private void prepare() {
        prepareLifeBar(40, 30);
        // Add obj. main actor
        // Add obj.enemy
    }

    private void prepareLifeBar(int offsetX, int offsetY) {
        int spaceBetweenLife = 10;  // just to put space between image
        for (int i = 0; i < LIFE_MAX; i++) {
            Life life = new Life();
            life.setLocationX(offsetX+((life.getImage().getWidth()+spaceBetweenLife)*i) );
            nyawa.setLocatinY(offsetY);
            addObject(life, life.getLocationX(), life.getLocationY());
            LifeBar.add(life);
        }
    }

    public static ArrayList getLifeBar() {
        return LifeBar;
    }
}

In my Life class, I put some code to add attributes of LocationX and LocationY to save my Life actor in x and y axis.

I believe there's no other exception caught in any other class related to my life counter, yet my lastIndex caught an incompatible types exception.

What's causing this exception to be thrown?

sentences:
How to prevent cube intersecting with other objects when moved around with mouse? I want to allow the player to freely place cubes anywhere they like in 3D space, but the cube being moved around is not allowed to intersect with other objects.

Currently I do a ray cast based on where the mouse is (ScreenPointToRay), and position the cube at the hit point.  This allows me to move the cube around, but it's possible to intersect other objects if the raycast hit is right next to an object.

I see that there is a Physics.BoxCast method, but I can't get this working based on where the mouse position is.  Am not sure if this is even the best solution.

I was thinking of ray casting out from each 4 points of each face on the cube (4 up, 4 down, 4 right, 4 left, 4 forward, 4 back), but I feel this is a lot of raycasts just to prevent intersecting on movement and placement for a cube.

How can I prevent a cube that is being moved around, and then placed with the mouse from intersecting other objects?

sentences:
Rectangle touch sides of another rectangle I am making a platformer game and im trying to make the player collide with all the blocks, here's a picture:

The blocks is stored in List and im trying to get the side's of the block usin

static class RectangleHelper
{
    public static bool TouchTopOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Bottom >= r2.Top &&
                r1.Bottom <= r2.Top + (r2.Height / 2) &&
                r1.Right >= r2.Left + r2.Width / 4 &&
                r1.Left <= r2.Right - r2.Width / 4);
    }

    public static bool TouchBottomOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Top >= r2.Bottom &&
                r1.Top <= r2.Bottom + (r2.Height / 2) &&
                r1.Right >= r2.Left + (r2.Width / 4) &&
                r1.Left <= r2.Right - (r2.Width / 4));
    }

    public static bool TouchLeftOf(this Rectangle r1, Rectangle r2)
    {
        return (r1.Right <= r2.Right &&
                r1.Right >= r2.Right - r2.Width  &&
                r1.Top <= r2.Bottom - (r2.Width / 4) &&
                r1.Bottom >= r2.Top + (r2.Width / 4));
    }

    public static bool TouchRightOf(this Rectangle r1, Rectangle r2)
    {

        return (r1.Right >= r2.Right &&
               r1.Right <= r2.Right + r2.Width &&
               r1.Top <= r2.Bottom - (r2.Width / 4) &&
               r1.Bottom >= r2.Top + (r2.Width / 4));
    }
}

I got this code from a Youtube video and i changed it a little bit.. (the original code didnt work well)

the problem im having is:
the TouchBottomOf & TouchRightOf functions doesn't work well...(The collision occur randomly, sometimes on top of the block, sometimes little below it (TouchBottomOf), same with TouchRightOf)

Is there a better way to check it?
thanks.

sentences: Was there any equivalent of glVertex3f in Direct3D? I know that OpenGL's Vertex3f is a bit old but I can't find any information about suitable equivalent for that function that was used in DirectX. Was there any equivalent in DX?

sentences:
Building a flexible GLFW Event handling system (for beginners) The 2017 Thread "How to improve my input handling in GLFW?" is brilliant!  Exactly my question and what seems like some great solutions.

However "Tyyppi_77" is hard for me to understand as a beginner.  For starters:

1) how is addBinding called and when in the flow?  Can you describe what the parameter Callback% callback is and its purpose?

I'll stop there for now. Ty!

class Window
{
public:
    using Callback = std::function<void()>;

    void addBinding(int key, const Callback& callback)
    {
        m_Callbacks[key].push_back(callback);
    }

    void onKeyPress(int key)
    {
        for (Callback& callback : m_Callbacks[key])
        {
            callback();
        }
    }
private:
    std::map<int, std::vector<Callback>> m_Callbacks;
};

sentences: Unreal point light error message How to fix this issue with point lights ?

sentences:
When I use a font in my game, do I have to include its license in the credits? For example, if I use this font from Google Fonts:
https://fonts.google.com/specimen/Open+Sans

This font is licensed under Apache License 2.0
But regardless of the license, if it allows commercial use, do I have to include a notice or the license in the credits? (assuming that I didn't modify the font)

sentences:
When should you check collisions? Suppose a basic game with several circles drawn to screen. The user can select and drag any ball and move it around the screen. Should the selected ball overlap with any other ball on screen, the other ball should displace so they are no longer touching.

The example I've seen use the following structure:

for (every ball pair):
   if (collision = true){
   - resolve collision
  }

However, with this method, isn't there a risk that a displacement could cause an overlap in a pair already checked, and therefore the overlap printed to the screen?

Would it not be better to re-check every ball pair's collision, every time a ball is displaced, rather than every time-step?

Maybe something like:

for (every ball pair):
    if (collision = true){
      -resolve collision
         for (every ball pair):
            if (collision = true){
              - resolve collision
              }
       }

EDIT:

Even the method I've listed above shouldn't always provide 100% accurate results. The only way I can think this could work is with some sort of recursive function which only stops when there are no more collisions. Does that seem right?

sentences:
Floor is moving faster than ball above it , and it causes ball to fall off the map. UE4 I am creating a game ( following Udemy lesson on Marble run) which is basically a maze and ball and we move ball my rotating floor on x or y axis through obstacles .
Floor movement is linked on Mouse values.
BP

My problem is if I move my mouse too fast ball comes below floor and drops.
I know there could be multiple hacks to solve this . but I am looking for best solution ( professional solution) I am a newbie so please bear with me :)
Below is screenshot of ball below maze

sentences:
A*  Pathfinding Problems I'm trying to implement the a* pathfinding algorithm in my game. I've looked at dozens of tutorials but I can't seem to get it right. My code is below, and It's not working... does anybody see something I'm doing wrong?
Mainly, I followed these tutorials:
Tutorial 1
Tutorial 2

I'm sure you will be able to understand all of the classes/methods I've created. If you can look over this code and just tell me if it looks remotely correct that would be great.

public void highlightPath(Tile start, Tile end)
    {

        AStar astar = new AStar();

        Tile currentTile = start;
        Tile endTile = end;

        start.node.g = 0;
        start.node.h = astar.getHeuristic(start.getCoordinates(), endTile.getCoordinates());

        start.node.parent = null;//for the loop

        astar.openList.add(start);

        while(!astar.openList.isEmpty())
        {
            currentTile = astar.getTileWithLowestF();

            if(currentTile==endTile)
                break;

            astar.openList.remove(currentTile);
            astar.closedList.add(currentTile);

            AdjacentTiles adjacentTiles = getAdjacentTiles2(currentTile);

            //Assign G and H costs:
            adjacentTiles.aboveRight.node.g = 10 + currentTile.node.g;
            adjacentTiles.right.node.g = 14 + currentTile.node.g;
            adjacentTiles.belowRight.node.g = 10 + currentTile.node.g;
            adjacentTiles.below.node.g = 14 + currentTile.node.g;
            adjacentTiles.belowLeft.node.g = 10 + currentTile.node.g;
            adjacentTiles.left.node.g = 14 + currentTile.node.g;
            adjacentTiles.aboveLeft.node.g = 10 + currentTile.node.g;

            ArrayList<Tile> adjacentTilesList = new ArrayList<>();

            adjacentTilesList.add(adjacentTiles.aboveRight);
            adjacentTilesList.add(adjacentTiles.right);
            adjacentTilesList.add(adjacentTiles.aboveRight);
            adjacentTilesList.add(adjacentTiles.belowRight);
            adjacentTilesList.add(adjacentTiles.below);
            adjacentTilesList.add(adjacentTiles.belowLeft);
            adjacentTilesList.add(adjacentTiles.left);
            adjacentTilesList.add(adjacentTiles.aboveLeft);

            for(Tile t:adjacentTilesList)
            {
                t.node.h = astar.getHeuristic(t.getCoordinates(), endTile.getCoordinates());
            }

            for(Tile t:adjacentTilesList)
            {
               //Check traversability:
               if(t.exists == false)//Change this to test segments/elevation
                   continue;//skips everything below...

               if(astar.closedList.contains(t) && currentTile.node.g < t.node.g)
               {
                   t.node.g = currentTile.node.g;
                   t.node.parent = currentTile;
               }
               else if(astar.openList.contains(t) && currentTile.node.g < t.node.g)
               {
                   t.node.g = currentTile.node.g;
                   t.node.parent = currentTile;
               }
               else
               {
                   astar.openList.add(t);
               }

            }

        }

        Tile startingTile = start;
        Tile currentTile2 = endTile;
        ArrayList<Tile> path = new ArrayList<>();
        path.add(currentTile2);

        while(currentTile2 != start)
        {
            path.add(currentTile2.node.parent);
            currentTile2 = currentTile2.node.parent;
        }

        for(Tile t:path)
        {
            t.highlight();
        }

    }

sentences:
How do I check if a window has focus in SDL2? Is there a replacement for SDL_GetAppState function in SDL2 from older SDL versions? Why was it removed? I want to use it so I can check if the user has focused the framebuffer window or not.

I found it in the documentation of the SDL 1.2.15 (Documentation page) but it seems like it disappeared in SDL2.X.

sentences:
How to get the previous value from string array c#(Unity) I have this example data

Data: P  ,B  ,B  ,T  ,P

This must be something like this

But what is happening to me is this

here's my code
string[,] table = new string[104, 6];
string newPreviousValue = "placeholder";
int xIndex = -1;
int yIndex = 0;
if (result.Equals(newPreviousValue) &&  yIndex < table.GetLength(1) - 1)
{
    yIndex += 1;
    table[xIndex, yIndex] = result;
}

else
{
     xIndex += 1;
     yIndex = 0;
     table[xIndex, yIndex] = result;
}

So you won't get confuse the result variable is the data generator.
What could be missing on my condition?
I tried doing something like this
if (result.Equals(newPreviousValue) && result.Equals(newPreviousValueTie) &&  yIndex < table.GetLength(1) - 1) but what's happening here is they're all in y axis falling in line .

sentences:
How to convert world coordinates to grid movement I'm producing a tactical 3D RPG game and I have the following issue:

I want the NPC to move through the grid. The grid is formed by tiles and each tile has a script attached to it. In this script, there is a variable called TilePosition which is a Vector2Int, that I use it to stores its X and Y values in the grid. The NPC character has a script attached to it called NPCPlayer, where a use a Vectir2Int named NPCGridPosition to stores its position in the grid.

Also regarding the NPC, he has a script called NPCMovement. In this script, I've set a raycast that starts from the NPC feet and goes down. I use the raycast to take the TilePosition variable as it is written in the code:

public void MoveNPC()
    {
        if (Physics.Raycast(transform.position, Vector3.down * MaxDistance, out hitDown))
        {
            if(hitDown.transform.tag == "Tile")
            {
                Tile TilesPosition = hitDown.transform.gameObject.GetComponent<Tile>();
                NPCPlayer NPCPosition = this.GetComponent<NPCPlayer>();
            }
        }
    }

However, when I try to move the NPC through the grid, 3 rows ahead, he goes away, because he moves according to the world position, rather than moving according to his tile position.

I'm using these lines of code to make him move:

public void MoveNPC()
    {
        if (Physics.Raycast(transform.position, Vector3.down * MaxDistance, out hitDown))
        {
            if(hitDown.transform.tag == "Tile")
            {
                Tile TilesPosition = hitDown.transform.gameObject.GetComponent<Tile>();
                NPCPlayer NPCPosition = this.GetComponent<NPCPlayer>();

                targetPosition.x = TilesPosition.TilePosition.x + 3 ;
                targetPosition.y = TilesPosition.TilePosition.y;

                this.transform.position = Vector3.MoveTowards(this.transform.position, targetPosition,velocity);
            }
        }
    }

How could I make the NPC to move according to its position in the grid?

I'll be glad if someone can help me a little bit with this.

sentences:
What's next to learn? I am self-learning programming for video games. I have learned:

Basics (variables, loops, branching, etc.)
Object Oriented (classes, objects)
Functions
Dynamic Memory Allocation
Operator Overloading
Aggregation
Inheritance and Polymorphism
Swallow Copy And Deep Copy
STL Libraries

and I am learning I/O Files. What is next? Thanks for the help.

sentences:
In XNA, how do I get forms to display in front of my full-screen game? I'm trying to open a form in front of my game, which is full-screen.  However, the form seems to appear only behind the game window.

At the moment, I'm doing this:

protected override void Update(GameTime gameTime)
    {
        if(Keyboard.GetState().IsKeyDown(Keys.Q))
        {
            graphics.IsFullScreen = true;
            graphics.ApplyChanges();
            new Form1().Show();
            // The form is empty, just created.
        }
        base.Update(gameTime);
    }

I can reach the form with AltTab, but this is unfriendly to the user.

How can I do this correctly?

sentences:
Making a house in jogl java eclipse? here's what I'm trying to do:
One house, with 3 rooms, a window in two rooms, doors in the front and back of the house and into each room (the back door has to be through one of the rooms). I've added a picture as an example
I'm using JOGL 2.0, in eclipse.

Clarification: my question is how do I code it in java using jogl?

This is what I have so far:

    glBegin(GL_QUADS)
    /* Floor */
    glVertex3f(-1,-1,-1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,-1,1);
    glVertex3f(-1,-1,1);
    /* Ceiling */
    glVertex3f(-1,1,-1);
    glVertex3f(1,1,-1);
    glVertex3f(1,1,1);
    glVertex3f(-1,1,1);
    /* Walls */
    glVertex3f(-1,-1,1);
    glVertex3f(1,-1,1);
    glVertex3f(1,1,1);
    glVertex3f(-1,1,1);

    glVertex3f(-1,-1,-1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,1,-1);
    glVertex3f(-1,1,-1);

    glVertex3f(1,1,1);
    glVertex3f(1,-1,1);
    glVertex3f(1,-1,-1);
    glVertex3f(1,1,-1);

    glVertex3f(-1,1,1);
    glVertex3f(-1,-1,1);
    glVertex3f(-1,-1,-1);
    glVertex3f(-1,1,-1);
    glEnd();

sentences:
How do you do FlashPunk-style animation in libGDX? In FlashPunk, you can have multiple animations set, and then choose which one to play at any time, and it'll do it.

Example:
    animatedSprite.add("running", [0, 1, 2, 3], 50);
    animatedSprite.add("falling", [4, 4, 4, 5, 1], 50);
    animatedSprite.play("running");

How do you accomplish this in libGDX?

I can only make it play one animation, looping, and I have no idea how to add multiple.

sentences:
How to make Sprites scroll with the background image that are inside Scroll View? I'm new in Unity, so I hope you guys can help. I'm developing a 2D-game for Android device, on the scene I have a huge background image inside Scroll View (UI - Scroll View).

Next, I created new empty Game Object "Players", attached to it "Players script" and added "Sprite Renderer" component.

From the Sprites I created two prefabs - housePrefab and dogPrefab. Inside "Players script" I have the following code:

[SerializeField] GameObject housePrefab;
[SerializeField] GameObject dogPrefab;

void Start()
{
var houseXPos = 1.41f;
var houseYPos = 2.63f;

var dogXPos = -0.41f;
var dogYPos = 2.63f;

GameObject house = Instantiate(housePrefab, transform.position = new Vector2(houseXPos, houseYPos), Quaternion.identity) as GameObject;
GameObject dog = Instantiate(dogPrefab, transform.position = new Vector2(dogXPos, dogYPos), Quaternion.identity) as GameObject;
}

After I run game both Sprites appears on the screen (as I expected). The problem occurs when I Scroll background image, both sprites stay in the same position under scrolling. In other words sprites not scrolling with the background image.

As far as I understand, the Sprites needs to be added to the background image, but I don’t know how to do it.
How to make Sprites scroll with the background image?

Thanks to all in advance.

sentences:
How can I make my program load music from files? I'm working with a XNA game and I want my program to load music files from libary/music so I can play that music in the game.
It would be great if the mediaplayer class could play a playlist of all the music in library/music.

sentences:
How can I use a Texture2D larger than 2048 x 2048? I'm having issues working with a large image.  I've read other threads on using images larger than a Texture2D supports, but found nothing that addresses my problem specifically with implementation hints.

My screen resolution is 1920 x 1080.  I'm working in C# XNA.  The game in question is pretty much a board game.

I have an 3840 x 3840 image I planned to use for the terrain map.  The idea was to make each new game look a little different from the last by having the program randomly select a 1920 x 1080 segment of that large image to display.  My code to randomly select and display a part of the image is working.

Unfortunately, I can't even get the initial 3840 x 3840 image to load.  Just picking "Add Existing Item" and adding the image to the content window on the right causes my program to error that a Texture2D can only be 2048 x 2048 maximum.

How do I best handle this?  I may later need to scale or rotate the map.

Suggestions I've seen around:

Cut it up into sections.
Use a smaller image that is made "seamless" or "tile-able", then choose a random starting X,Y point in it and fill the screen with that.

Are these good ways to go about it? How would I actually do this? Would I still be able to scale and rotate the map?

sentences: How Plants vs Zombies animation is done? I really like the plants vs zombies style of animation and it doesn't look complicated yet the result is really good. I doubt it's made of sprites seeing there's a large number of animations, combinations, distortions, outfits. So how that kind of animation is done?

sentences:
How standardized are joystick / gamepad configurations? Right now I'm working on input for my game.

The only controller I own is an XBOX 360 one.

From what I can see, if a controller's stick has a Z axis, these are actually triggers.

Essentially I'm wondering if from one controller to the next, will this be consistent?

sentences:
Should the game host be the authority, or another dumb client? When designing a networked multiplayer-game where one player hosts and others connect, there are two strategies I'm aware of:

Have the host-player's game be the authority, with all other players as dumb-clients trying to catch up with the current game-state.  In the code, there will have to be lots of special cases, depending on if the current player is the host or not.
Make the host a dumb-client like everyone else by running a hidden dedicated server on another thread.  The dedicated-server will be the authority, and the host will connect to it like everyone else (through localhost).

What are the advantages/disadvantages of each of these?  Which is used most often (or does it vary by game type/size)?

sentences:
How to update the data in the source code to avoid cheats? I developed a multiplayer fps game in C++ and many peoples appreciated it, and today someone has created cheats for my game and he is trying to spoil my hard work which I spend developing the game. I am not expert to create an anti cheat system but I know by updating or releasing the new patch can avoid those cheats for a little time and then after some time I will need to update it again.
I want to know the quick and easy way to update all the files. This is a headache to search manually for all classes and strings and values to update them.
Data I want to update to avoid speed hack, aimbot, wall hack and flying hack.

sentences:
Bounding volume hierarchy - linked nodes (linear model) The scenario A chain of points: (Pi)i=0,N where Pi is linked to its direct neighbours (Pi-1 and Pi+1).

The goal: perform efficient collision detection between any two, non-adjacent links: (PiPi+1) vs. (PjPj+1).

The question: it's highly recommended in all works treating this subject of collision detection to use a broad phase and to implement it via a bounding volume hierarchy. For a chain made out of Pi nodes, it can look like this:

I imagine the big blue sphere to contain all links, the green half of them, the reds a quarter and so on (the picture is not accurate, but it's there to help understand the question). What I do not understand is:

 How can such a hierarchy speed up computations between segments collision pairs if one has to update it for a deformable linear object such as a chain/wire/etc. each frame? More clearly, what is the actual principle of collision detection broad phases in this particular case/ how can it work when the actual computation of bounding spheres is in itself a time consuming task and has to be done (since the geometry changes) in each frame update? I think I am missing a key point - if we look at the picture where the chain is in a spiral pose, we see that most spheres are already contained within half of others or do intersect them.. it's odd if this is the way it should work.

sentences:
My pool balls often jump around when there are two or more balls colliding/touching I'm working through the book 'Introduction to Game Physics with Box2D' and I've created a little pool game with the example code. Despite the name, there is NO box 2D used in this particular exercise.

The example in the book can be seen in this video by the author which only consists of the cue ball and 8-ball. This all works well.

I've written my own version from scratch (using SDL instead of DirectX), using the code in the book as a guide. When I limit it to two balls, everything works great.

When there are more than two balls, things are sometimes problematic in a way I can't predict. Breaking can be fine on one run, or it can cause the balls to 'jump' and flicker as they move presumably looking for empty space. Generally, problems occur when there are more than two balls in a collision.

I've read around and it seems that I need to perform more 'iterations' to get closer to the correct result, but the code that I'd learned will work the same regardless of the number of times it is performed - it sets the positions of any overlapping balls so that they are barely touching. I've tried changing it so it 'pushes' the balls slightly in the direction of the collision normal, with no success.

Here's the relevant code:

bool BallManager::ballBounce(Ball& ball1, Ball& ball2)
{
    float r = static_cast<float>(ball1.diameter_ + ball2.diameter_) * 0.5f;

    // Calculate direction of relative velocity.
    Vector2 v = ball2.velocity_ - ball1.velocity_;
    Vector2 vhat = v.normalized();

    // Calculate relative displacement along normal to collision tangent.
    Vector2 c = ball2.position_ - ball1.position_;

    Vector2 n = c.normalized();

    // Relative distance along normal to tangent.
    float cdotvhat = dot(c, vhat);

    // Balls don't collide, exit early.
    float discriminant = cdotvhat * cdotvhat - c.lengthSquared() + r*r;
    if (discriminant < 0.0f)
    {
        return false;
    }

    // The distance we want to move ball2 back by.
    float dist2 = cdotvhat + sqrt(discriminant);

    float relativeVelocity = 0.0f;
    if (ball2.velocity_.length() > 0.0f)
    {
        relativeVelocity = ball1.velocity_.length() / ball2.velocity_.length();
    }

    // The distance we want to move ball1 back by.
    float dist1 = dist2 * relativeVelocity;

    // Move balls in reverse direction of velocity to point of impact.
    Vector2 v1hat = ball1.velocity_.normalized();
    Vector2 v2hat = ball2.velocity_.normalized();
    ball1.position_ -= dist1 * v1hat;
    ball2.position_ -= dist2 * v2hat;

    // Adjust ball velocities after reflection.
    Vector2 vDiff = ball1.velocity_ - ball2.velocity_;
    vDiff = dot(vDiff, n) * n;
    ball1.velocity_ -= vDiff;
    ball2.velocity_ += vDiff;

    // Finally, move balls again to where they should have bounced to.
    v1hat = ball1.velocity_.normalized();
    v2hat = ball2.velocity_.normalized();
    ball1.position_ += dist1 * v1hat;
    ball2.position_ += dist2 * v2hat;

    return true;
}

At the moment I'm mainly looking for a pointer in the right direction or suggestions since I'm new to physics programming.

sentences:
Unreal Development Kit - What is a good method for accessing a relational database file? I'd like to use a SQL Express file or something similar for a UDK demo.

Is there a standard method for accessing data in a local relational database file?

I understand that the best method may involve creating a class library and using the DLLBind feature, but I'm still a bit unclear on how to pass data to controls in the UI (I'd like to populate dropdowns and such with records from the database).

sentences:
Is it possible to create custom functions in Twine 2's Harlowe format? I'm starting to learn Twine and I'm putting together a little framework for making a game.

I'd like to be able to store functions or procedures somehow so that I can use them over and over again without having to write the whole thing each time.

Example[Something like this]: (set: $incrementItemsAmount to (set: _item's amount to it + 1))

I've looked at lambda macros, but they look like they're more for looped procedures.

sentences:
Trouble in 3DS MAX 2016 exported ogre.mesh file refering the correct .material Actually we have some trouble in exporting ogre mesh + material files correctly from 3dsmax.
We are using "Easy Ogre Exporter V 2.40" for the export to ogre format.
And actually just testing its features by displaying the images in Cegui-Meshviewer
(http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CEGUI+Mesh+Viewer).

The problem is, the mesh itself refers to a material file, which has added "default" on to it. So for example if we exported "stone.mesh" the exported material would be "stone.material" which is fine. But when inspecting the mesh inside any mesh viewing tool run on ogreengine, the mesh itself is related to a so called "stoneDefault.material" which if I want to get its attributes listed just has no attributes set. But when I inspect the material itself ("stone.material") In those mesh viewers, I can see the correct UV map related to the material and the other attributes fit to what is expected aswell. But the mesh it self seems to be using an non existing "stoneDefault.material" (thats at least the name related to it) And I also checked if it changes anythign when I just change the name of "stone.material" to "stoneDefault.material" But this jsut resaulted in 2 different materials with the same name isnide the viewer.

So my Question is: Is this probably a bug in the viiewers/exporter?
Or am I missing/missunderstanding soemthing?

we selected for testing portability ogre version 1 as exporting file format.

sentences:
How to Use Text in Unity3d How Can i Create Text in Unity3D?
I Use "3D Text" But Its Always on Top Of Everything!
Can You Suggest Anything?
I creating a 2D Game So its not Necessarily a 3D Text..

Edit: Because I Building a 2D Game My Scene is Full of Planes in Front of Camera And I want My Text to be Over One of the Planes and when plane is moving My Text appears behind it.
But When I Use "3D Text" Its Always In Front of Everything.

Sorry for My Bad English...

sentences:
Capitalizing on JavaScript's prototypal inheritance JavaScript has a class-free object system in which objects inherit properties directly from other objects.  This is really powerful, but it is unfamiliar to classically trained programmers. If you attempt to apply classical design patterns directly to JavaScript, you will be frustrated. But if you learn to work with JavaScript's prototypal nature, your efforts will be rewarded.
...
It is Lisp in C's clothing.
-Douglas Crockford

What does this mean for a game developer working with canvas and HTML5?  I've been looking over this question on useful design patterns in gaming, but prototypal inheritance is very different than classical inheritance, and there are surely differences in the best way to apply some of these common patterns.
For example, classical inheritance allows us to create a moveableEntity class, and extend that with any classes that move in our game world (player, monster, bullet, etc.). Sure, you can strongarm JavaScript to work that way, but in doing so, you are kind of fighting against its nature.  Is there a better approach to this sort of problem when we have prototypal inheritance at our fingertips?

sentences:
what happens with missing vertices in geometry shader I am relatively new to GLSL shader programming, and the documentation I found is unfortunately often inscrutable. I am having trouble understanding a few things with how geometry shaders fit into the pipeline.

I am trying to implement silhouette detection by detecting boundary triangles in a geometry shader. A triangle is a boundary triangle if it is front-facing and an adjacent triangle is back facing. The idea then is to emit additional camera-facing triangles to outline them.

For this purpose, I am looking at GL_TRIANGLE_ADJACENCY shaders, since they seem to fit the bill. Let's assume for the moment that I have already got the data loaded properly into the buffer.

For clarity: I plan on doing skinning and the Model View transform in the vertex shader, but to hold off on the perspective projection until I decide what to do in the geometry shader (this seems reasonable, but maybe I am wrong).

Here is where the uncertainties start to come in. First of all, am I expected to manually perform backface culling at some shader stage?

Second, if a triangle has incomplete adjacency information(only 2 out of three triangles for example), how is this conveyed to the shader? Does it just have a length less than 6 vertices?

Third, what does the pass through shader (the one that does nothing special) have to perform? Do I emit every vertex in the input list, or just 3 from the first triangle? And again, am I supposed to/allowed to cull backfaces?

And last, if I decide to emit additional geometry, is there anyway to distinguish that from the (passed-through) input geometry from the point of view of the fragment shader? I'd like to be able to texture map them separately if it is possible.

If I am on the wrong path on any of this, of course feel free to let me know. In case it is important, I am using OpenGL 3.3.

Based on my understanding and Nathan's answer, I could start with a passthrough shader that looks something like this:

layout(triangle_adjacency) in;
layout(triangle_strip, max_vertices = 14) out;
flat out float is_border;

void main() {
    gl_Position = gl_in[0].gl_Position;
    is_border=0.0;
    EmitVertex();

    gl_Position = gl_in[2].gl_Position;
    is_border=0.0;
    EmitVertex();

    gl_Position = gl_in[4].gl_Position;
    is_border=0.0;
    EmitVertex();

    EndPrimitive();
}

And then when/if I add triangle strips for outlines, I will set is_border=1.0 for each of those vertices.

sentences:
3D models overlapping each other I have a problem at the moment when I draw some models to teach me more about 3D game programming. The models at the moment overlaps each other from some angles witch makes sense since the game at the moment draws from left to right, line after line.

However my question is: Is there any easy escape from this issue or is there any way that you could draw the in-game world from the players position?

I would really appreciate if someone could give me some answers on this.

sentences: How can I divide tile-based space into largest the possible squares? I'm trying to find a way to take a tilemap like the top image and divide it into square spaces like the colored areas in the second image.

sentences:
Dragging an object by touching on Android I am trying to move and object by touching it and dragging. I am testing it on my Samsung Galaxy SIII.

I have used the following code. For some reason it moves faster than my finger. It should always be beneath my finger. What is wrong? (note: I haven't done the "only move object if you touch onto it" part, so right now it moves where ever I touch)

#pragma strict

var speed : float = 1;

function Start () {

}

function Update () {
    if (Input.touchCount > 0 &&
        Input.GetTouch(0).phase == TouchPhase.Moved) {

        // Get movement of the finger since last frame
        var touchDeltaPosition:Vector2 = Input.GetTouch(0).deltaPosition;

        var touchPosition:Vector2;

        touchPosition.Set(touchDeltaPosition.x,
                           touchDeltaPosition.y );

        // Move object across XY plane
        transform.position = Vector2.Lerp(transform.position,
                                                touchPosition,
                                                Time.deltaTime*speed);
    }

}

sentences: LibGDX , Scale button with animation when it is pressed I am developing game using LibGDX . I want to create beautiful menu and to scale buttons when they are pressed but not in this way , when it is pressed scale it 1.5f , I want to scale it with animation . I am using imagebuttons .

sentences:
How are scripted camera usually managed? I noticed that many open games (think platformers, adventure, action...) have very complex cameras that appear to mix both automatic placement most of the time, and sort of pre-placed camera locations.

How are these usually implemented? Is it just some sort of zone trigger that then launches an interpolation between the last camera state and the scripted camera for the zone, or are there more special details?

sentences:
Why is my texture drawn in a different place when in fullscreen? I'm trying to draw a texture (with a crescent moon) in the middle of the y-axis:

public void draw(SpriteBatch batch) {
    batch.draw(lune, 0, Gdx.graphics.getHeight() / 2);
}

It renders this when windowed:

And in full screen mode:

I don't understand why it doesn't work since I'm always drawing at the top of the middle in the y-axis.

I add a little update to what i do exactly :

        @Override
    public void resize(int width, int height) {
            this.levelDatas.screenWidth = width;
            this.levelDatas.screenHeight = height;
            this.levelDatas.lune.updateSize(width, height);
    }

My render method :

        @Override
    public void render(float delta) {
            Gdx.gl.glClearColor(0, 0, 0, 1);
            Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
            this.levelDatas.batch.begin();
            this.background.draw(this.levelDatas.batch);
            this.levelDatas.lune.draw(this.levelDatas.batch);
            this.levelDatas.batch.end();
            [...]

And this is the updateSize and draw method for the "Lune" object :

public void updateSize(int width, int height) {
    this.widthScreen = width;
    this.heightScreen = height;
}

public void draw(SpriteBatch batch) {
    batch.draw(new TextureRegion(lune), 0, this.heightScreen / 2, 0, 0, this.lune.getWidth(), this.lune.getHeight(), 1f, 1f, 0);
}

Still got the problem !

sentences:
Rotating RigidBody2Ds in Godot I am practising programming games with the Godot Engine and I've been having some issues with RigidBody2Ds.

In this case I have a RigidBody2D as a child of a Node2D. The Node2D is rotating and the RigidBody2D with it. However, as soon as I use apply_impulse() it just returns to it's initial rotation point, which is zero.

Does anyone know what's going on here?

sentences:
How to leave trails that are equidistant apart from each other I want bunch of circles to follow the player while keeping a distance apart.
So far I have this:
local p = {
  x=0,
  y=0,
  life={
    {x=0,y=0},
    {x=0,y=0},
    {x=0,y=0},
    {x=0,y=0}
  }
}

local last={x=p.x,y=p.y}
for l in all(p.life) do
  l.x = lerp(last.x,l.x,0.5)
  l.y = lerp(last.y,l.y,0.5)
  circfill(l.x,l.y,2,7)
  last={x=l.x,y=l.y}
end

But this makes it so the circles collapse into each other and the player. I want the circles to have a distance between themselves and the player.

I've also tried this:
  l.x = lerp(last.x*0.8,l.x,0.5)

This leaves a distance as I want but the trail is always on the upper left, barely following player.
I want the trail to stay always behind the player.
Probably I can achieve this by stop following if the distance is less than threshold.

sentences:
How to change the size of a draw GUI? I tried to create a HUD button with a sprite of dimensions 1200x1200 to decrease it by code, but I could not.

Code:

draw_sprite(spr_btnBig,0,100,100);
image_xscale=0.05;
image_yscale=0.05;

I tried also to modify the scale of the object in the options in the room, but did not obtain the expected result.

Result:

I would not want to have to decrease its size in a program other than the game maker, because the quality of a sprite resized in the game maker gets much higher than a resized in image editors like GIMP or Photoshop:

How could he do that?

sentences:
How can I render text above a mesh in DirectX 9? I want to render some text over a mesh in my DirectX app. It will have a similar application to health bars for units in games, just as text rather than a bar. I'm looking for the simplest way to do this.

It's a Win32 app, I'm using DirectX 9 and I need it to be in 3D (i.e. when the unit is moving around the Z-axis, the text above moves with it).

Any ideas?

sentences:
Unity 2D Current object force I'm working on a game with an entity firing a shot. This shot could destroy other entities as well as the entity who generated the shot.
My first step was to apply a force to the rigidbody2D of the shot, but when my entity is too fast the shot destroy it (the speed does not match).

I tried adding the speed to the force but the values mismatch by far (the force is a vector of like 150 magnitude, whereas the speed as a magnitude of 1).

I wonder how one can achieve this, to add the current speed of the entity to the shot fired, and i wonder if there's any litterature concerning the way physics is actually handled in Unity, i find very little documentation on the Physics.

Thanks.

sentences:
Key released, multiple Keys, how to go around ncurses limitations? I have been trying to make a small game in the terminal in C++ using ncurses.

After searching around for some time, I came to realize that ncurses is pretty limiting as far as keyboard inputs are concerned :

How to separate keyPressed and keyReleased events?
How to deal with multiple keys pressed at the same time?

Do you know of any solution to go around those limitations?

To answer someone's comment, in other languages I would use a keyListener to detect if a key has been pressed or released, and keep each pressed key in an array that I can use later :

array pressedKeys[];

keyPressed(event)
{
    pressedKeys.add(event.getKey());
}

keyReleased(event)
{
    pressedKeys.remove(event.getKey());
}

... // Later in update()
    if keyPressed.contains("up")
        goUp();

This does not seem possible in ncurses as it just gets the last pressed character with getch(), and pressed means keydown then keyup, which does not allow to keep track of the different keys pressed at the moment.

sentences:
How does the Wii controller work? I've never played the Wii or Kinect, but to my understanding, the Wii captures user movement with 4 cameras and translates them to controls.

How does this work? Has Nintendo published anything on this? I'd appreciate a mathematical explanation.

sentences:
OpenGL, objects disappear at a certain z distance I'm writing a managed OpenGL library in C++, and I'm having a pretty annoying problem. Whenever I set an objects Z coordinate to -2.0 or lower, the object disappears. And at coordinates 0 through -1.9, it doesn't appear to move away from them camera. I have a world matrix (which is multiplied by the objects position to move it), a view matrix (which is just the identity matrix currently) and a projection matrix, which is setup like this:

FOV: 45.0f
Aspect Ratio: 1
zNear: 0.1f
zFar: 100.0f

using GLMs glm::perspective method. The order the matrices are multiplied by in the shader is world, view, projection, then position.

I can move the object along the X and Y axis perfectly fine. I have depth testing enabled, using GL_LEQUAL. I can change the actually vertices positions to anything I want, and they move away from the camera or towards it perfectly fine. It just seems to be the world matrix acting up. I'm using glm::mat4 for the world matrix, and glm::vec3 for positions. Whats going on here?

I'm also using OpenGL 3.1, GLSL version 140 (1.4?).

sentences:
Programmatically creating new tags in Unity I'm writing a custom editor script to add tags programmatically.

I got the error of IndexOutOfRangeException: Array index is out of range from the lines below:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

These are my codes:

SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);
SerializedProperty tagsProp = tagManager.FindProperty("tags");

// Adding a Tag
string s = "Instantiated";

// First check if it is not already present
bool found = false;

for (int i = 0; i < tagsProp.arraySize; i++)
{
    SerializedProperty t = tagsProp.GetArrayElementAtIndex(i);
    if (t.stringValue.Equals(s)) { found = true; break; }
}

// if not found, add it
if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
}

Latest Update:
Error IndexOutOfRangeException: Array index is out of range is solved by resolving file location in my original script. I apologized for that.

Fixed:
Added a line in the script to update the properties

if (!found)
{
    tagsProp.InsertArrayElementAtIndex(0);
    SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
    n.stringValue = s;
    tagManager.ApplyModifiedPropertiesWithoutUndo();
}

sentences:
ImpactJS and Construct 2 I'm interested in HTML5 game development and I found about this 2 game engines, I already know ImpactJS requires more programming experience and that Construct 2 has its own event and action system that can be extended with plugins made with JavaScript.

I want to know what are each engine's primary focus, when would someone choose one over the other assuming programming knowledge is not a concern.

Is it a matter of taste, features available, type of game or is it that each tool serves better for some kind of games or development process?.

I'm not looking to know which is better, just in which situations works better each tool, so people can have an idea of what's better for building the game they have in mind.

sentences:
How do I model a gooey sprite? I happened to see this structure of a gooey player character made in flash.

Can anybody suggest onto what computer science concept I should use to

make a goo
make it behave like a goo

Thanking You,

Vish

sentences:
XBox controller in while loop I have a while loop that goes for ever. The goal is if I press A button, a message should be printed out showing this button has been pressed A has been pressed. I've done the loop and connecting XBox controller but the problem is that the message is printed out many times if I press the button one time. My question is why the message is being shown many times while I just press the button one time? Should I make some kind of sleep?

Edit:
This is the part of the code

while(true)
    {
        if(Player->IsConnected())
        {
            if( Player->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_A )
                std::cout << " A button has been pressed ..." << std::endl;
        }
        else
        {
            std::cout << "\nERROR: Connect XBox Controller ... \n";
            std::cout << "Press Any Key To Exit.";
            std::cin.get();
            break;
        }
    }

The result when I only press once.

Press A to be printed out ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...
 A button has been pressed ...

sentences:
Implementing Customizable Input I am trying to brainstorm how to create customizable input.  Any help would be greatly appreciated, but here's my best guess so far.

I could create a custom 'Input' class, with Methods to call for each input.  Like public bool IsRight()", "public bool IsJump()", etc.  Then I could call these methods from any other class.

However, I cannot figure how I would assign these different methods to different keys such that:

public bool IsRight(){
    if (keyboardState.IsKeyDown(Keys.Right)){
        return true;
        }
    return false;
}

works, but I could change the input from 'Right' to 'D', or so on.

sentences:
Framerate limitation The most successful competitive game engines like id Tech, GoldSrc, Source and such allow for framerate limitations.

You can play with 30, with 60, with 99, with 72, with 68 etc. In short, you can cap it and control the cap.

I was wondering, how do I limit the framerate?

Not interested in code, but theory.

sentences:
How can I design lots of different attack types that can be combined? I'm making a top down 2D game and I want to have a lot of different attack types.  I'd like to make the attacks very flexible and combine-able the way The Binding of Isaac works.  Here's a list of all the collectibles in the game.  To find a good example, lets look at the Spoon Bender item.

  Spoon Bender gives Isaac the ability to shoot homing tears.

If you look at the "synergies" section, you'll see it can be combined with other collectibles for interesting yet intuitive effects.  For example, if it combines with The Inner Eye, it "Will enable Isaac to fire multiple homing shots at once".  This makes sense, because The Inner Eye

  Gives Isaac a triple shot

What's a good architecture to design things like this?  Here's a brute force solution:

if not spoon bender and not the inner eye then ...
if spoon bender and not the inner eye then ...
if not spoon bender and the inner eye then ...
if spoon bender and the inner eye then ...

But that will get out of hand very fast.  What's a better way to design a system like this?

sentences:
Why is Minecraft's default resolution (seemingly) non-standard? Background: I'm writing some articles on Minecraft in an attempt to introduce 10-year olds to development through modding. I know very little about the game itself, though :)

I'm trying to understand why Minecraft appears to run in an "odd" default resolution. Grabbing a screenshot, I think it's rendering at 550x310 but that doesn't seem to match any of the "common" aspect ratios (although it's close to 16:9), nor is it evenly divisible by 16, which appears to be what the texture packs use.

Is it actually running at 550x310 in its default windowed mode? If not, what is the resolution?
Depending on the answer to the first question, why isn't it using one of the standard aspect ratios? I'm not familiar with OpenGL programming either so perhaps there is a common resolution close to what I'm guessing at that would make perfect sense.

sentences:
Stage3D: Camera pans the whole screen I am trying to create a 2D Stage3D game where you can move the camera around the level in an RTS style. I thought about using Orthographic Matrix3D functions for this but when I try to scroll the whole "stage" also scrolls.

This is the Camera code:

    public function Camera2D(width:int, height:int, zoom:Number = 1) {
        resize(width, height);
                    _zoom = zoom;
    }

    public function resize(width:Number, height:Number):void {
        _width = width;
        _height = height;

        _projectionMatrix = makeMatrix(0, width, 0, height);

        _recalculate = true;
    }

    protected function makeMatrix(left:Number, right:Number, top:Number, bottom:Number, zNear:Number = 0, zFar:Number = 1):Matrix3D {
        return new Matrix3D(Vector.<Number>([
            2 / (right - left), 0, 0, 0,
            0, 2 / (top - bottom), 0, 0,
            0, 0, 1 / (zFar - zNear), 0,
            0, 0, zNear / (zNear - zFar), 1
        ]));
    }

    public function get viewMatrix():Matrix3D {
        if (_recalculate) {
            _recalculate = false;

            _viewMatrix.identity();
            _viewMatrix.appendTranslation( -_width / 2 - _x, -_height / 2 - y, 0);
            _viewMatrix.appendScale(_zoom, _zoom, 1);

            _renderMatrix.identity();
            _renderMatrix.append(_viewMatrix);

            _renderMatrix.append(_projectionMatrix);
        }

        return _renderMatrix;
    }

And the camera is send directly to the GPU with: c3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, cameraMatrix, true);

And these are the shaders:

------Vertex Shader------
m44 op, va0, vc0
mov v0, va1.xy
mov v0.z, va0.z

------Fragment Shader------
tex ft0, v0, fs0 <2d,linear,nomip>
mov oc, ft1

Here is a example and here are two screenshots to show what I mean:

How do I only let the inside of the stage3D scroll and not the whole stage?

sentences:
Creating Multiple Instances of a camera at run time I'm trying to create a bunch of different game objects from a settings file I'm passing in at run time. I've checked and my game is reading in settings fine. But when I run the program, I get the following error:

  ArgumentException: The prefab you want to instantiate is null.

But, I still get two cameras appearing in my scene. So I'm confused as to why this is happening.

Here is the code that is acting on the information received from the settings file:

public void CreateCamera()
{

for (int i = 0; i < testCamera.Count; i++)
{

    camera = Instantiate(gameObject.AddComponent<Camera>(), new Vector3(0, 0, 0), Quaternion.identity) as Camera;
    camera.name = testCamera[i].Name;
    camera.near = Convert.ToSingle(testCamera[i].Near);
    camera.far = Convert.ToSingle(testCamera[i].Far);
    camera.aspect = Convert.ToSingle(testCamera[i].AspectRatio);
    camera.fov = Convert.ToSingle(testCamera[i].FOV);
}

}

Following this, I also get the following message as well:

  Can't add component 'Camera' to GameObject because such a component is
  already added to the game object!

Can anyone help me in fixing these issues?

sentences:
Bizarre Physics FixedUpdate Lag spikes So I have this large forest of around 2M tris:

Same chunk selected with view on the whole level:

It's been generated within Blender and exported as fbx into Unity. Exporting each tree as an individual object is very performance expensive so the whole forest is split into 2 Objects: Treetrunks and leaves. The Treetrunks all have meshcolliders on them, the leaves obviously don't. (However I do split the forest into chunks as seen above, each chunk roughly 400k tris)

When the Player gets outside visible range of the forest it is disabled, and enabled when the Player gets within a certain range. When it is enabled sometimes it causes a massive lag. When looking into the Profiler it shows this:

Physics? FixedUpdate? The leaves have absolutely no colliders on them, why does it take up Physics.Processing? So I wanted to search further what part of Physics.Processing takes up so much processing time but the top process already shows nothing:

I have an 8 year old GTX760 but it still manages to render the entire forest at 200fps so no, the 2 million Tris are definitely not overkill for my computer.

I've tried this and that and 3 things managed to stop the issue (as seen in the profile screenshots above, the Physics processing time significantly reduced a few frames later)

Pausing & Unpausing the game or simply Alt-Tabbing outside the Unity Player and back (not always effective)
Disabling the Player & Reenabling it (almost always effective)
Starting the Scene with the Player (including Rigidbody, Camera and raycasting scripts) disabled and enabling him a few seconds later via script.  (almost always effective) However this only worked if ALL of the forest was set active (roughly 2M tris). If half the forest was disabled on start, and activated after the Player was enabled: LAG.

The Player is the only thing in the game (at this moment) that has a Rigidbody, Raycasting Scripts and a camera.

Things that didn't work:

Waiting a few minutes
Disabling & Reenabling the Players Character Controller at any time
Disabling & Reenabling the camera on the Player at any time.
Disabling & Reenabling the fucking trees

Anyone got an idea? I'm dumbfounded over here.

sentences:
Correctly implement of an object rotation How can I correctly implement 360 degree rotation of some object, every time when some condition is meet?

I have two class, one with definition of function and second with setInterval() function. The problem is that the 360 degree rotation is performed only once, even if later also occurs this condition.

First class (A):

function rotObject()
{
if(rot < 360)
{
 _root.myObject._rotation = _root.myObject._rotation + 10;
}
else
{
clearInterval();
}
rot = rot + 10;
}
var rot = 0;

Second class (B):

class B extends MovieClip {
if (<something>) {
setInterval(A.rotObject, 10);
}
}

sentences:
Perspective projection and ultrawide resolution The problem I'm going to describe did not occur to me until very recently, when I got a super ultra-wide monitor (32:9 aspect ratio) and tried playing videogames on it.

TL;DR: the scenery is stretched near the left and right edges of the screen due to how projection onto a plane works. Question: why isn't the standard to use "spherical" canvas instead of a plane?

I tried several games and I noticed that the objects displayed far left and far right on my screen are stretched and appear way too closer than they actually are. I could not figure out any general setting (field of view, focal distance...) to mitigate this uniformly, until I realized how projection works.

The way 3D objects are displayed on a 2D canvas is as follows: the camera consists of a point (focal point) and an infinite plane (canvas). To calculate where another point in front of the camera will be displayed, this point is connected to the focal point and the point drawn on the canvas corresponds to the intersection of this line with the canvas.

No wonder the far left and far right parts of the screen are so stretched! The rays from these vertices intersect the canvas at a very small angle.

This problem would be eliminated if we chose the canvas to be a sphere, ideally with the same curvature as the monitor (in case the monitor is flat, the sphere degenerates into a plane and we have the same situation as before). That way, if we choose a correct position for the focal point (depends on our screen setup, curvature, aspect ratio etc.), no stretching should occur, since the focal point is literally "surrounded" by the canvas, instead of the canvas running away from it in all directions.

So my question is, why isn't the standard to implement this "spherical" projection instead of "planar"? Is it because it happens on such a low level of coding that developers don't care, or the code with spherical projection would be a serious bottleneck compared to what is done now? Or the market with super ultra-wide resolution is so niche that they don't care, but we should expect to see it sometime in the future? Or the standards are so baked in that nobody cares about implementing something new, even if it would make more sense?

Sorry in case this question doesn't quite fit in here, I actually don't know anything about making videogames, but this strikes me as it's more about geometry than actual game-making.

sentences:
What platform should I use for a master server? We are making a small FPS, and want people to be able to play it online and fetch a list of all servers from a master server. We only have experience in C#, and we have already written a master server that tracks all the servers.

However we realize that we'd have to host it on a windows application server. These are expensive, and making our master server completely reliable and watertight may be a lot of work. Also it seems a waste to have a server out there running windows and our tiny application that only tracks a list of servers...

Should we make the effort to learn PHP and SQL and make our master server that way? Does anyone know of any master servers written in PHP to get us started?

sentences:
Additive "Sprites/Default" shader The Sprites/Default shader multiplies the color with the provided tint, while I need to add it instead.
I fixed this copying the shader (taken from here) and simply changing the line

return tex2D(_MainTex, IN.texcoord) * IN.color;

to

return tex2D(_MainTex, IN.texcoord) + IN.color;

Is this the right approach, or there was a better one? (which uses something like inheritance, as opposite to copy-pasting)

Also, is this legal? I assume they allow you to use it at will, but technically there's no licence attached to the shader, so I'm not sure. Maybe that's covered somewhere in the Unity license?

sentences:
How do I use Libgdx viewport for UI? I am using LibGDX to make a game for Android and I am using 2 Viewports. One for UI and one for the actual game content. My problem is I can't find a good way to scale my UI using a Viewport.

This is a picture of my UI using a FitViewport:

As you can see it adds space on the top and bottom to fit the screen, but I want my pause button to stay on the top of the screen. I tried using a StretchViewport and that worked well for the pause button, but then the joysticks were no longer circle because they were distorted.

Is there a way to make a StretchViewport that only stretches the middle? (since nothing will be in the middle I don't care about that. Should I make a custom Viewport? And if so, how would I go about that? Thank you for any help!

sentences:
Snake movement in monogame Noobie here...
I've started learning monogame development and currently working on a simple snake game. I'm having trouble with the snake's movement, I figured I could make it tile-based movement but eventually decided to create turning points everytime the head changes direction, insert those into a list and remove a point when the last body unit have passed through it.

The method that gets keyboard input and creates the turning points:

 protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            Exit();
        player.update();
        if (Keyboard.GetState().IsKeyDown(Keys.Up) || Keyboard.GetState().IsKeyDown(Keys.Down))
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Up))
                player.direction.Y = -3f;
            else
                player.direction.Y = 3f;
            player.direction.X = 0;
            /**
             * Creating a turnPoint that will save the change in movement
             * and where it occured.
             * **/
            player.turnPoint.Add(new Player.turningPoint(player.position, player.direction));
            return;
        }
        if (Keyboard.GetState().IsKeyDown(Keys.Left) || Keyboard.GetState().IsKeyDown(Keys.Right))
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Left))
                player.direction.X = -3f;
            else
                player.direction.X = 3f;
            player.direction.Y = 0;

            player.turnPoint.Add(new Player.turningPoint(player.position, player.direction));
        }

        base.Update(gameTime);
    }

GameObject which is used as the snake's tail basically consists of 2 Vectors, one for position, the other for movement direction.

 public struct turningPoint // Used to save the point and specific change in movement
    {
        public Vector2 location { get; }
        public Vector2 velocityChange { get; }

        public turningPoint(Vector2 location, Vector2 velocityChange)
        {
            this.location = location;
            this.velocityChange = velocityChange;
        }
    }
    public List<turningPoint> turnPoint = new List<turningPoint>();
    private List<GameObject> bodyUnits = new List<GameObject>();

And finally, the method in whic I update the body units:

        private void updateBodyUnits()
    {
        for(int i = 0; i < bodyUnits.Count; i++)
        {
            //Update the unit's position using it's current movement direction
            bodyUnits[i].position.X += bodyUnits[i].direction.X;
            bodyUnits[i].position.Y += bodyUnits[i].direction.Y;

            foreach(turningPoint point in turnPoint)
            {
                if(bodyUnits[i].position.X == point.location.X && bodyUnits[i].position.Y == point.location.Y)
                {   //If the unit is currently on a specific turning point, change it's direction
                    bodyUnits[i].direction.X = point.velocityChange.X;
                    bodyUnits[i].direction.Y = point.velocityChange.Y;

                    if (i == bodyUnits.Count - 1) //Remove turn point if the last
                                                  //unit passed through
                        turnPoint.Remove(point);
                    break;
                }
            }
        }
    }

Basically it kinda works, if the movement the snake is low. If I set direction. X\Y to 1, or 2 even it kinda works, but above that it seems as if the units just speed through the turning point, ignoring it (and currently there just the head with 3 units of tail).
So, is my code ridiculously inefficient? Or the method I am using is wrong altogether?

sentences:
C# OpenTK - Getting world coordinates of points that are altered by matrices I have written a skeletal animation system for a game I am working on. To draw lines that represent a skeleton, I use the GL matrix, and multiply it by each bone a long the body. For example before drawing the left hand, GL.multMatrix has been called for the lower back, upper back, left shoulder, left upper arm and left lower arm.

Currently I am now trying to deal with hitboxes. After this series of matrix transformations have been made, I am drawing a box with the local coordinates of -2,-2,-2 to 2,2,2. This works fine, the animated skeleton has a box around the hand.

However I've reached the stage of actually needing to use the hitbox, to check if it collides with another hitbox. I've worked out the algorithms I shall use for checking if there is a collision, but I first need to change those coordinates from their local to the hand coordinates, into coordinates I can use against other things in the world.

For example the left hand hitbox has the same local coordinates as the right hand hitbox, but how could I change that all back to global coordinates so I can get their proper world coordinates?

sentences:
How to keep the ball on zigzag movement? I recently make a zig-zag movement it works perfectly but after the ball hit the collider or obstacle the ball is changing their direction like just forward, not zig-zag anymore I've tried to update the velocity after collide but it's same, also I have tried to constant the magnitude but that's not what I want
here my script
public float magnitude;
    public float forwardSpeed;
    public float horizontalSpeed;

    private Vector2 horizontalAxis;
    private Vector2 negationVector;

    public Rigidbody2D rb2d;
    public m_GameManager _GameManager;

    public bool isOver = false;

    private void Awake()
    {

        horizontalAxis = Vector2.right;
        negationVector = new Vector2(-1f, 0);
    }

    private void Start()
    {
        _GameManager = FindObjectOfType<m_GameManager>();
        UpdateVelocity();
    }

    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            ReverseHorizontalVector();
            UpdateVelocity();
        }
    }

    private void ReverseHorizontalVector()
    {
        horizontalAxis *= negationVector;
    }

    private void UpdateVelocity()
    {
        Vector2 velocity = GetCompositeVelocity();
        rb2d.velocity = velocity;
    }

    private Vector2 GetCompositeVelocity()
    {
        Vector2 forward = Vector2.up * forwardSpeed;
        Vector2 horizontal = horizontalAxis * horizontalSpeed;
        Vector2 composite = (forward + horizontal);

        return Vector2.ClampMagnitude(composite, magnitude);
    }

    private void OnCollisionEnter2D(Collision2D collision)
    {
        UpdateVelocity();
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.CompareTag("Goal"))
        {
            _GameManager.IncreaseScore();
        }
        if (collision.gameObject.CompareTag("L") || collision.gameObject.CompareTag("R") || collision.gameObject.CompareTag("Death")
            || collision.gameObject.CompareTag("Player"))
        {
            StartCoroutine(_GameManager.waitAfterDeath());
            isOver = true;
        }
    }

like I said before the ball zig zag but after colliding the movement change like that.

sentences:
Does GPU mipmapping assume the texture es gamma corrected? I have been reading the Real Time Rendering book and stumbled upon this paragraph:

  For textures encoded in a nonlinear space (such as most color
  textures), ignoring gamma correction when filtering will modify the
  perceived bright- ness of the mipmap levels [121]. As you get farther
  away from the object and the uncorrected mipmaps get used, the object
  can look darker overall, and contrast and details can also be
  affected. For this reason, it is impor- tant to convert such textures
  into linear space, perform all mipmap filtering in that space, and
  convert the final results back into nonlinear space for storage.

I have never taken into account gamma correction for color textures using mipmapping.

For generating mipmaps I have always used the GPU-implementation (OpenGL):

glGenerateMipmap

In the resources I have learned from, gamma correction has not been mentioned as something that has to be taken into account for mipmapping.

I was wondering, since color textures that include gamma correction seem to be the norm, are the GPU-provided filtering functions already taking into account gamma correction?

sentences:
How can I make a snake's tail follow the head? Following an assignment and just getting started with libGDX by building a small Snake clone I've run into an issue that I'll probably be ashamed for in a little while.

I currently have a snake's head (a simple rectangle at this stage) moving around the game's canvas. The most straight-forward way of building the rest of the snake was to have the head own a Java Collections LinkedList of SnakeElements which would in-/decrease in size according to what the player does.

Having this list of SnakeElements follow the head however has proven to not be trivial.

The current function doing this is as follows and is called every time the head updates its position:

private void moveTail (float x, float y, int direction) {
    float tmpx, tmpy;
    int tmpdirection;
    int offset_x, offset_y;

    for (SnakeSegment snse : tail) {
        offset_x = 0;
        offset_y = 0;

        tmpx = snse.getX();
        tmpy = snse.getY();
        tmpdirection = snse.getDirection();

        switch(direction) {
            case 0:
                offset_x = 0;
                offset_y = -(2 + snse.width);
                break;
            case 1:
                offset_x = -(2 + snse.width);
                offset_y = 0;
                break;
            case 2:
                offset_x = 0;
                offset_y = (2 + snse.width);
                break;
            case 3:
                offset_x = (2 + snse.width);
                offset_y = 0;
                break;
            default:
                System.out.println("wrong direction");
        }

        snse.setX(x + offset_x);
        snse.setY(y + offset_y);
        snse.setDirection(direction);

        x = tmpx;
        y = tmpy;
        direction = tmpdirection;
    }
}

which unfortunately results in this behavior:

Any tips on how to make a correctly working snake tail would be much appreciated :)

sentences:
Automatically zoom out the camera to show all players I am building a game in XNA that takes place in a rectangular arena. The game is multiplayer and each player may go where they like within the arena. The camera is a perspective camera that looks directly downwards.

The camera should be automatically repositioned based on the game state. Currently, the xy position is a weighted sum of the xy positions of important entities.

I would like the camera's z position to be calculated from the xy coordinates so that it zooms out to the point where all important entities are visible.

My current approach is to:

hw = the greatest x distance from the camera to an important entity
hh = the greatest y distance from the camera to an important entity
Calculate z = max(hw / tan(FoVx), hh / tan(FoVy))

My code seems to almost work as it should, but the resulting z values are always too low by a factor of about 4.

Any ideas?

sentences:
Unity Ads showing test ads I am implementing Unity Ads in my game and for some reason I have the test ads showing up in my production version of my app. I have the advertisements initialized with test ads turned off and I have even gone into my settings on the Unity Ads admin and set it to force test ads to be off. I'm not sure what else to do here.

Here is how I am initializing:

Advertisement.Initialize("myID", false);

sentences:
Dealing with field of view when zooming into a terrain from a height I'm creating a tech demo featuring a small planet. The problem I'm having is that the planet doesn't really feel like the right "scale" when the camera in down on the surface, I think it could be the curvature of the surface of the planet.

I was wondering if anyone had any suggestions for adjusting maybe the field of view, or any other camera tricks to give the impression that, once on the surface, the planet is larger than it appears at the moment.

sentences:
How to support Surface pens in Unity? Our game works great with touch or mouse, but the Surface pen doesn't seem to register as a pointing device at all. How can we support the pen in Unity in a native build?

This question on the Unity Answers site suggests we could build it as a UWP app, but that means restricting ourselves to a very limited subset of the .NET framework (specifically, we lose a lot of the Serialization libraries).

sentences:
Libgdx change color of Texture at runtime I've also asked this question on StackOverflow.
In a Libgdx game, I have some Animations for my Player. All the Frames for this Animation are inside a TextureAtlas. The Player Textures show a human, with a white T-Shirt. The T-Shirt is the only white part of the Player.
Now i want to be able to replace the white color with red for Player1, with green for Player2 and so on. How can I do that, without losing the advantage of the TextureAtlas (Texture switching)?
Of course 1 way would be to store 4 versions of every Frame, for 4 different Players (colors). However, there are games out there where you can fully customize the Player, give them a blue hat, red pants, and pink shirts and so on. How can this be done?

sentences:
Phaser/HTML5 - Trying to add five instances to a group and display on the screen! just started using Phaser today after seeing Thomas Palef's lessmilk series. I completed PhotonStorm's "Make your first Phaser game" tutorial, and grabbed the skeleton, some CSS, and started to throw together a game. It's pretty barebones right now, but this is what I have.

The issue is that the game doesn't display the additional "orc" units I've requested. I used a for loop to throw five orcs around the map within the specified borders (32 pixels from the outside boundary. I even wrote a check for the x and y of each in the Update() function, but they don't appear at all.

I don't know how to move on from where I am, and I'm not sure that any of what I've written has been written the right way, you know what I'm saying? Thanks.

http://pastebin.com/if2VTq7j

sentences:
XNA create differences in enemies I created an enemy class for my game. It works well, except for one dilemma. When I spawn more than one enemy, eventually they begin to "overlap" and look like one enemy. I was wondering if anyone had any ideas on how to create more differences and spontaneity between the enemies. All help would be greatly appreciated.

Here is the class:

using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Defender
{
public class Enemy
{

    Vector2 Location;
    public static Texture2D texture;

    float rotation;
    Rectangle rectangle;
    int shootTimer = 50;

    public void Draw(SpriteBatch spriteBatch)
    {
        rectangle = new Rectangle((int)Location.X, (int)Location.Y, 32, 32);
        spriteBatch.Draw(texture, Location, null, Color.White, rotation, new Vector2(16, 16), 1, SpriteEffects.None, 0);

    }

    public void Update(GameTime gameTime)
    {
        Rotate();
        Shoot();
        Move(gameTime);

    }

    public void Move(GameTime gameTime)
    {
        if (Vector2.Distance(Location, Game.player.Location) > 75)
        {

                Location.X += findDirection(Game.player.Location).X * (float)(gameTime.ElapsedGameTime.TotalMilliseconds / 20);
                Location.Y += findDirection(Game.player.Location).Y * (float)(gameTime.ElapsedGameTime.TotalMilliseconds / 20);

        }

    }

    private void Rotate()
    {

            float XDistance = Location.X - Game.player.Location.X;
            float YDistance = Location.Y - Game.player.Location.Y;

            rotation = (float)Math.Atan2(YDistance, XDistance);

    }

    private Vector2 findDirection(Vector2 target)
    {

            Vector2 direction = target - Location;
            direction.Normalize();
            return direction;

    }

    public void Shoot()
    {
        if (shootTimer > 0)
        {
            shootTimer--;
        }
        if (shootTimer == 0)
        {

            //find slope

            //create bullet
            Bullet bullet = new Bullet(Location, findDirection(new Vector2(Game.player.Location.X, Game.player.Location.Y)));
            Game.bulletList.Add(bullet);

            //reset timer
            shootTimer = 50;

        }

    }

    public Enemy(Vector2 loc)
    {

        Location = loc;
    }

}

}

sentences: OpenGL 2.0 Android Scrolling Horizontally and Vertically I am new to OpenGL2.0 in Android. How can I scroll the GLSurfaceView both horizontally and vertically?

sentences:
Changing background texture by drawing on it? Actually I'm sorry for the title, I'm not sure which short phrase will describe situation best. I'm porting (or remastering, I don't know which word suits better, maybe both) a Win32, pure C, DirectX 8 game to XNA. Here is the problem I'm facing now.

The game background represents dirt through which player can dig, leaving the tunnels in it. The background is erased literally from a background bitmap array (which is static) by applying a "dig step" mask forming a new background picture:

From that little knowledge I have currently on XNA, I assume that it's hard to mimic this approach and modify a background texture in Update method. So I was thinking about storing an array of "tunnels" data and draw tunnels above background. This however seems not so elegant as the original approach. You see, tunnel form depends on direction, so I would need to store following information for a cell: 1) directions of tunnel (from 1 to 4), 2) dig amount (for each direction) ranges from 0 to 5.

So question is, what is a good way to implement that? Am I on a right way?

P.S. BTW anyone can try and see it in action!

sentences:
how to detect Unity UNET errors? I'm working on a simple multiplayer online game. and I use UNET and Networkmanager.

In my game I have some rooms and players that they can join to this rooms by connecting to specific server.exe file that I runned on a dedicated server.

My problem is when I use port 7777 for first server, if I run another server, then this error Appear :

  Cannot open socket on ip{*},and port{7777}

For now I solved this issue by building servers with specific ports.
for example in server1.exe I used port 7777 by default.
and server2.exe , 7778 and same for other servers .

But I want to do this automatically. I mean when the server recognize port 7777 is busy , then increase port number.

I want to know can I use try catch for this kind of errors ?
because I used try catch but it's not work.
I don't know how to use it. this is part of my code :

try
    {
        StartServer();
    }
    catch(Exception ex)
    {
        networkPort++;
        //then change port number and run server again
    }

I just looking for a way that my servers run by choosing right port automatically.

sentences:
2D Terrain Modification/Expansion? I have a problem which I don't really know what to call, and I would like to apologize in advance for perhaps the misleading title. Let's say I break a few objects in the 2D game and they scatter along the floor, I want the objects to now become apart of the floor.

The solution doesn't have to account for movement, it can wait till the object has come to a stop before updating the terrain. It is intended the terrain doesn't produce any concave shapes as I assume that would just add a whole new layer of complexity.

I thought of a few solutions but I am completely new to this all and if all you can do is point me in the right direction I would greatly appreciate it.
What am I actually asking? I am honestly just looking either for the general Maths involved, or what this type of process is even called if it has a proper term or a few suggestions for a solution.

(In the images, the blue rectangles are rigid bodies, the black lines are the edges of the environment, and the red line is the floor/terrain that changes in relation to the blue rectangles)

sentences:
2D game - Missile shooting problem on Android I have to make a tank that sits still but moves his turret and shoots missiles.

As this is my first Android application ever and I haven't done any game development either, I've come across a few problems...

Now, I did the tank and the moving turret once I read the Android tutorial for the LunarLander sample code. So this code is based on the LunarLander code.

But I'm having trouble doing the missile firing then SPACE button is being pressed.

private void doDraw(Canvas canvas) {

canvas.drawBitmap(backgroundImage, 0, 0, null);
// draws the tank
canvas.drawBitmap(tank, x_tank, y_tank, new Paint());
// draws and rotates the tank turret
canvas.rotate((float) mHeading, (float) x_turret + mTurretWidth, y_turret);
canvas.drawBitmap(turret, x_turret, y_turret, new Paint());

// draws the grenade that is a regular circle  from ShapeDrawable class
bullet.setBounds(x_bullet, y_bullet, x_bullet + width, y_bullet + height);
bullet.draw(canvas);

}

UPDATE GAME method

private void updateGame() throws
 InterruptedException {

 long now = System.currentTimeMillis();

 if (mLastTime > now)  return; double
 elapsed = (now - mLastTime) / 1000.0;
 mLastTime = now;

 // dUP and dDown, rotates the turret
 from 0 to 75 degrees. if (dUp)
 mHeading += 1 * (PHYS_SLEW_SEC *
 elapsed);

 if (mHeading >= 75) mHeading = 75;

 if (dDown) mHeading += (-1) *
 (PHYS_SLEW_SEC * elapsed); if
 (mHeading < 0) mHeading = 0;

 if (dSpace){

//  missile Logic, a straight trajectorie for now
       x_bullet -= 1;
       y_bullet -= 1;

//doesn't work, has to be updated every pixel or what?

 }

boolean doKeyDown(int keyCode, KeyEvent msg) {
            boolean handled = false;
            synchronized (mSurfaceHolder) {
                if (keyCode == KeyEvent.KEYCODE_SPACE){
                    dSpace = true;
                    handled = true;
                }
                if (keyCode == KeyEvent.KEYCODE_DPAD_UP){
                    dUp = true;
                    handled = true;
                }
                if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN){
                    dDown = true;
                    handled = true;
                }
                return handled;
            }
        }

}
a method run that runs the game...

public void run() {
            while (mRun) {
                Canvas c = null;
                try {
                    c = mSurfaceHolder.lockCanvas(null);
                    synchronized (mSurfaceHolder) {
                        if (mMode == STATE_RUNNING)
                         updateGame();
                        doDraw(c);
                    }
                } catch (InterruptedException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    } finally {
                    // do this in a finally so that if an exception is thrown
                    // during the above, we don't leave the Surface in an
                    // inconsistent state
                    if (c != null) {
                        mSurfaceHolder.unlockCanvasAndPost(c);
                    }
                }
            }
        }

So the question would be, how do I make that the bullet is fired on a single SPACE key press from the turret to the end of the screen?

Could you help me out here, I seem to be in the dark here...

Thanks,

Niksa

sentences:
Connecting Circular Rooms My roguelike generates a number of circular rooms. I quite like the current results, which look something like this:

It's generated by carving out random circles in a filled space.

I have one main problem with it: several circles are completely unconnected. I cna't quite figure out what algorithm to use to connect them.

I tried "for each circle, find the nearest circle, and tunnel to its center (horizontally then vertically)," but I get something horrible instead (same map as above):

What seems to be the right fit is something like "for each self-enclosed space, find the nearest empty space and tunnel to it." That seems complexity-hard though (for each circular enclosed space, compute the distance to every other space) and will probably be slow (running on Ruby too)

Is there a simple solution to this problem?

sentences:
Improve bloom quality I'm trying to understang how can I improve bloom effect quality using all known to me optimizations.

Currently I'm making it as follows:

Create new texture using some threshold to extracts areas which should glow
Downsample that texture 4 times (using bilinear filtering - GL_LINEAR)
Blur each texture horizontally using 5x5 gaussian blur.
Blur each texture vertically using 5x5 gaussian blur.
Composite each blurred texture with final image.

I've implemented gaussian blur using Incremental Gaussian Algorithm and set radius to 5. However because of size of last texture after composition bloom has very low quality especially when moving camera:

It doesn't look clear here but you can see it near bunny tail.

Simple workaround to that issue was increasing the radius for smaller textures but then image was more blurred.

Similar effect is when I use solution presented by Philip Rideout.

I get better results when I use blur shader presented here. However I still see some kind of vertical stripes.

I also tried to improve the algorithm by blurring the image and then downsampling it. Then I repeated whole process for the rest of images. But I haven't spotted any difference.

I'm also wonder how it is done in Unreal Engine. I mean how effective blur radius is computed. Documentation claims that each Bloom Size value is "the size in percent of the screen width" and each texture is smaller from previous one 2 times.

sentences:
How to find collision detection side between two objects? I am using box2D and I have two objects, one is bouncy ball and the other one is block. I'd like to find which side of the block is collided with, so I can only make the ball bounce when it hits the top.

I tried to implement many things like fixture data and by detecting position, using manifold but not get the accurate result. I also tried to calculate distance between two object but all went wrong.

sentences:
Accelerometer problems When I hit an object, my Fighter is supposed to fall to the Ground but because of the Accelerometer, I can still move it up and down even though it died. The Scroller on the x-Axis though stops.
Question: (FIXED) How can I make the Accelerometer stop, after I've been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)?
When I move the Fighter up and down, the transition from "moving up" to "moving down" isn't smooth. It seems like it lags.
Question: How can I Increase the Sensitivity of my Accelerometer?
Also, when I tilt the phone further, the velocity stays the same.
Question: How can I increase the velocity, in relation to the tilt degree?

The code is below:

Accelerometer Code:

float accelY = Gdx.input.getAccelerometerY();

if (Gdx.input.getAccelerometerY() < 5){
   velocity.y = -40;
}

if (Gdx.input.getAccelerometerY() > 5){
   velocity.y = 40;
}

When Fighter hits an Object and dies:

public void die() {
    isAlive = false;
    velocity.y = 0;
    acceleration.y = 460;
}

sentences:
Rotate player to vector3 point? I want my player object rotate to face vector3 point on terrain.

public Vector3 RocketPointer;
public Transform pointer,Player;
public bool rocket_, button_move;

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

    if (button_move == true)
    {
        Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit mousePoint;

        if (Physics.Raycast(mouseRay, out mousePoint, 100))
        {
            RocketPointer = mousePoint.point;
            pointer.transform.position = RocketPointer;
        }

        if (button_move == true && Input.GetMouseButtonDown(0))
        {
        // rotate player object to face rocketpointer point
            rocket_ = true;
            button_move = false;
        }

    }

    if (button_move == false && Input.GetMouseButtonUp(0))
    {
        rocket_ = false;
    }

}

public void move_button() // UI button
{
    button_move = !button_move;
}

sentences:
Most efficient way to achieve the following 2D heat wave background effect? In Unity, what would be the most efficient way to achieve the following heat wave background effect

Super Metroid - SNES (skip to 34m 5s for those on mobile)

http://youtu.be/yB317FOcU0Y?t=34m5s

Obviously one way of doing this is by animating the sprite directly, which actually might be the most efficient way in terms of GPU, but is definitely more labor intensive. Could a shader be created to do this?

sentences:
NavMesh - Changing Mesh by Jumping upwards I have been playing around with the NavMesh and I have seen that there are different situations where an agent has to change meshes.

When it works:

Everything seems to work alright with links, if I try to make the agent jump from a mesh to another one, tweaking the "Jump distance" paramenter

Another scenario is when the agent needs to fall to another mesh to reach the target. This one also works, when I tweak the "Drop height" parameter.

When it does NOT work

But there are 2 different scenarios, where the agent cant reach the target. The first one is when the agent must jump upwards instead of dropping.

And the other scenario is when the agent needs to fall to another mesh that is not directly below the one he is standing on.

How could I do so that the agent jumps either to move upwards, or to land in a lower mesh?

sentences:
How can I disable the red X button in unity? I just want to know how to disable the red X button in the game window using unity, to prevent the player for example from closing the game.

So if anyone knows how to do it, any help would be greatly appreciated.

sentences:
vector rotations for branches of a 3d tree I'm attempting to create a 3d tree procedurally.  I'm hoping that someone can check my vector rotation maths, as I'm a bit confused.

I'm using an l-system (a recursive algorithm for generating branches).

The trunk of the tree is the root node.  It's orientation is aligned to the y axis.

In the next iteration of the tree (e.g. the first branches), I might create a branch that is oriented say by +10 degrees in the X axis and a similar amount in the Z axis, relative to the trunk.

I know that I should keep a rotation matrix at each branch, so that it can be applied to child branches, along with any modifications to the child branch.

My questions then:

for the trunk, the rotation matrix - is that just the identity matrix * initial orientation vector ?

for the first branch (and subsequent branches)  - I'll "inherit" the rotation matrix of the parent branch, and apply x and z rotations to that also.

e.g.

using glm::normalize;
using glm::rotateX;
using glm::vec4;
using glm::mat4;
using glm::rotate;

vec4 vYAxis     = vec4(0.0f, 1.0f, 0.0f, 0.0f);
vec4 vInitial   = normalize( rotateX( vYAxis, 10.0f ) );

mat4 mRotation  = mat4(1.0);

// trunk rotation matrix = identity * initial orientation vector
mRotation *= vInitial;

// first branch = parent rotation matrix * this branches rotations
mRotation *= rotate( 10.0f, 1.0f, 0.0f, 0.0f );     // x rotation
mRotation *= rotate( 10.0f, 0.0f, 0.0f, 1.0f );     // z rotation

Are my maths and approach correct, or am I completely wrong?

Finally, I'm using the glm library with OpenGL / C++ for this.  Is the order of x rotation and z rotation important?

sentences:
Entity's FSM and exposing internals of the entity I'm trying to implement FSM according to Programming Game AI by Example, it is a pretty standard and straightforward FSM that goes like similarly to this (some stuff omitted and translated from C++ to C#, hope it's fine):

class StateMachine<Entity>
{
    Entity owner;
    State<Entity> state;

    void StateMachine<Entity>(Entity entity)
    {
        owner = entity;
    }

    void Update()
    {
        state.Execute(owner);
    }
}

class State<Entity>
{
    Entity owner;

    void Execute(Entity owner)
    {
        if (owner.Foo)
            owner.Bar();
    }
}

class Entity()
{
    public type Foo;
    private StateMachine<Entity> stateMachine;

    public void OnStart()
    {
        stateMachine = new StateMachine<Entity>(this);
    }
    public void Bar(){}
}

My problem with this state machine is that the because the state machine is not part of the class anymore (as opposed to, let's say, the naive "switch" / "if-else" implementation), it is necessary to expose internal logic of the Entity (e.g. variable Foo, method Boo()). Is this the right way to do it? What if the the Entity class grows, how does it scale. Is it really necessary to keep exposing more and more variables / creating getters/setters?

How are these FSMs implemented in larger projects?

sentences:
Quadtree vs multiple resolution grids for terrain rendering I have been thinking about quad trees with regards to terrain rendering.

From my understanding the basic functionality of quadtree terrain rendering is to frustum cull the terrain in such a manner:

function render() {
    lod_threshold++;
    if(lod_threshold_reached || !has_children()) {
        draw_terrain_mesh();
        return;
    }
    for(child in children) {
        if(child.bounds.intersect(viewing_frustum)) {
            child.render();
        }
    }
}

where node.bounds is a 3d bounds calculated as containing the maximum heightmap value of the contained terrain

My questions are the following

If we are in fact testing a 2d portion of terrain with it's bounds calculated to include the maximum heightmap value against the 3d frustum, what is the preferred bounds calculation for generating the node.bounds in the quadtree?
That a tree is necessary because that one has to iterate every portion of a 3d scene to calculate frustum occlusion in a general way. Eg, there is no shortcut algorithm to calculate the set of 3d cells generated from a 2d grid that intersect the viewing frustum. As a more general question and to question the obvious, is there a way to calculate cells in a viewing frustum without having to iterate every cell in a scene? Presumably not otherwise you wouldn't need trees for culling

With regards to an alternative grid implementation:

Has this implementation been contemplated for general purpose terrain culling? I am presuming that some form of grid base terrain culling is certainly preferred in certain games, namely top down games where the possibility of terrain in the distance of being on camera is non-existent.

function calc_cells_in_quadrilateral(frustum_projection_onto_2d_terrain_grid) {
    //calculate cells in the resulting quadrilateral projection of the frustum onto the grid without having to bounds test every cell
    //at some point based on distance from camera, assign lod
}
retrieve lod for each cell in the calculated set from lod grids
have multiple (array2 or intmap) containing the terrain data at every lod for O(1) retrieval

Is there is a way to calculate cells in a quadrilateral without having iterate every cell in a grid? eg, from shaving off cells from slopes or something?
If there is, in what fashion should one assign the lod cell based on distance? I haven't contemplated this in detail because #1 may be impossible
The terrain would not be optimally culled in this 2d culling algorithm against the quadrilateral frustum projection onto the heightmap, because the height value at the edges may be outside the screen, correct?
http://www.olhovsky.com/2011/03/terrain-started/ In this post, he describes assigning lod from a grid and from a quad tree. The illustrations are confusing with regards to whether question #1 is correct and terrain rendering with quad trees serves to draw the terrain mesh against the frustum as opposed to just as a function of distance 360 around the camera as at appears to do with his grid implementation. Please specify whether it appears that he is infact not frustum culling in the grid implementation but is frustum culling the quadtree.

sentences:
How do I program procedural generation with objects that must fit together in specific ways? I'm working on a game where I have to procedurally generate a large open room building. I'm using Unity, but I think this applies to any engine. The room is made up of different wall segments. What makes this difficult for me is the ends of the segments have to join with a similar end of another segment. There are 2 types of ends. Flat and angled. The purpose of the angled ends is to create an outside corner. Meaning for example a flat wall then turns into a hallway it would use angled ends to make the transition.
The method I tried initially was to define each segment type and what the follow up modules could be. Meaning SegmentA can be followed by: SegmentB, SegmentC, and SegmentD. Then I would randomly select which  of those to add and place it, then move on and repeat. It works ok, but I feel like there is a better way to do it. It's pretty unwieldy and is kind of prone to bugs. I also run into issues trying to close the loop and return to the original segment.

sentences:
Implementing GDPR compliance for multiple different ad networks I'm creating a Unity game that uses admob mediation to show rewarded ads. I'm using about 5-10 different ad networks.
How do I implement GDPR compliance for EU users?
I tried following some online tutorials, but none of them had content showing getting GDPR consent for multiple networks.
How can I modify this script to correctly get compliance where needed for all of my ad networks?
public class Mediation : MonoBehaviour
{
 string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
 private RewardedAd rewardedAd;
 public Button reviveBtn;

 void Start()
 {
    MobileAds.Initialize((initStatus) =>
    {
        Dictionary<string, AdapterStatus> map = initStatus.getAdapterStatusMap();
        foreach (KeyValuePair<string, AdapterStatus> keyValuePair in map)
        {
            string className = keyValuePair.Key;
            AdapterStatus status = keyValuePair.Value;
            switch (status.InitializationState)
            {
                case AdapterState.NotReady:
                    // The adapter initialization did not complete.
                    MonoBehaviour.print("Adapter: " + className + " not ready.");
                    break;
                case AdapterState.Ready:
                    // The adapter was successfully initialized.
                    MonoBehaviour.print("Adapter: " + className + " is initialized.");
                    break;
            }
        }
    });

    RequestRewardBasedVideo();
}

void Update()
{
    if (rewardedAd.IsLoaded())
    {
        reviveBtn.interactable = true;
    }
}

I'm not sure where to ask for consent as I'm using multiple ad networks and not just admob. In the documentation, there is this line of code:
AdRequest request = new AdRequest.Builder().AddExtra("npa", "1") .Build();

Where do I add this in the script above and how do I ask for consent for multiple networks, like Chartboost, Adcolony, ironSource etc?
EDIT
I have added the following code to the mainmenu script which loads up when the game starts.
public GameObject GDPR_Popup;
void Start()
{
    Invoke("CheckForGDPR",.25f);
}

void CheckForGDPR()
{
    if (PlayerPrefs.GetInt("npa", -1) == -1)
    {
        GDPR_Popup.SetActive(true);
    }
}

public void OnUserClickAccept()
{
    PlayerPrefs.SetInt("npa", 0); //this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("1");
    AppLovin.SetHasUserConsent(true);
    GDPR_Popup.SetActive(false);
}

public void OnUserClickCancel()
{
    PlayerPrefs.SetInt("npa", 1);//this is for google admob
    AdColonyAppOptions.SetGDPRConsentString("0");
    AppLovin.SetHasUserConsent(false);
    GDPR_Popup.SetActive(false);
}

Would something like this work as I'm not sure how to test this?
Also, how to initialize the ad networks only when the user has accepted or canceled GDPR option(this I believe was mentioned in the google admob mediation documents but there was no code sample given).
Can someone please help?

sentences: how to port my game for android in sfml i am a c++ programmer , and I want to develop games . I chose sfml , because I wanted to see what happens behind the scene better . I have an idea to make , and the desired platform is mobile devices(android , ios) . I have seen that sfml , support for touch and other capabilities of mobile devices , but I have no idea , how I can write a code , that works on all of them .

sentences:
Can GJK be used with the same "direction finding method" every time? In my deliberations on GJK (after watching http://mollyrocket.com/849) I came up with the idea that it ins not neccessary to use different methods for getting the new direction in the doSimplex function.

E.g. if the point A is closest to the origin, the video author uses the negative position vector AO as the direction in which the next point is searched. If an edge (with A as an endpoint) is closest, he creates a normal vector to this edge, lying in the plane the edge and AO form. If a face is the feature closest to the origin, he uses even another method (which I can't recite from memory right now)

However, while thinking about the implementation of GJK in my current came, I noticed that the negative direction vector of the newest simplex point would always make a good direction vector.

Of course, the next vertex found by the support function could form a simplex that less likely encases the origin, but I assume it would still work.

Since I'm currently experiencing problems with my (yet unfinished) implementation, I wanted to ask whether this method of forming the direction vector is usable or not.

sentences:
Is game maker studio actually flexible enough to cater to an avid programmer? After I got burned by RPGMaker which seemed fine what with the semi-open Ruby-like engine until you encountered some nasty surprises like the draconian resolution limitations etc., I've become more cautious.

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

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

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

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

sentences: Is it better to load all of the scene at once or load small parts of it as the player moves? I want to create a lot of detail in my game but I don’t want to kill the frame rate tracking all the models and movements (like all the grass). Will loading them in pieces save the frame rate or will constantly loading and unloading models with every step negate any benefits of loading in pieces? I want to only load what the player will see at that moment and nothing else until the player either moves the camera or walks. I also want to know if loading a scene on Unity uses the gpu or the cpu?

sentences:
How can I normalize a vector if I am handling movment of each axis seperatley? I am writing a 2D tile based game engine in XNA, and I've recently fine-tuned my collision detection using the answers provided here and more specifically here.

The tile based collision detection now works flawlessly and fixed all the small problems I had with my previous code. However, implementing this forced me to rewrite how movement was handled. Instead of moving the player all at once and then resolving each collision along the smallest axis of intersection depth, it now updates and resolves on the X and Y axes separately.

This is fine, but now my diagonal movement is much faster than my horizontal and vertical movement and I am unsure of how to normalize it.

I'm sure I'm just overlooking something simple, is there a straight forward way of doing this?

    public void HandleInput()
    {
        //Set horizontal and vertical values accordingly based on direction of key presses
        int horizontal = InputHelper.IsKeyDown(Keys.A) ? -1 : (InputHelper.IsKeyDown(Keys.D) ? 1 : 0);
        int vertical = InputHelper.IsKeyDown(Keys.W) ? -1 : (InputHelper.IsKeyDown(Keys.S) ? 1 : 0);

        //If there is movement update sprite position, round the position to nearest pixel and then check for collision
        if (vertical != 0)
        {
            sprite.Position += Vector2.UnitY * sprite.Speed * vertical;
            sprite.Position = new Vector2(sprite.Position.X, (float)Math.Round(sprite.Position.Y));
            HandleCollisions(Direction.Vertical);
            UpdateSpriteAnimation(Direction.Vertical, vertical);
        }
        if (horizontal != 0)
        {
            sprite.Position += Vector2.UnitX * sprite.Speed * horizontal;
            sprite.Position = new Vector2((float)Math.Round(sprite.Position.X), sprite.Position.Y);
            HandleCollisions(Direction.Horizontal);
            UpdateSpriteAnimation(Direction.Horizontal, horizontal);
        }
    }

    private void HandleCollisions(Direction direction)
    {
        // Get the player's bounding rectangle and find neighboring tiles.
        Rectangle playerBounds = sprite.spriteBounds;
        int leftTile = playerBounds.Left / Engine.TileSize;
        int topTile = playerBounds.Top / Engine.TileSize;
        int rightTile = (int)Math.Ceiling((float)playerBounds.Right / Engine.TileSize) - 1;
        int bottomTile = (int)Math.Ceiling(((float)playerBounds.Bottom / Engine.TileSize)) - 1;

        // For each potentially colliding tile,
        for (int y = topTile; y <= bottomTile; ++y)
        {
            for (int x = leftTile; x <= rightTile; ++x)
            {
                Vector2 depth;
                //If this tile is collidable, and it intersects sprite bounds
                if (tileMap.CollisionLayer.GetCellIndex(x, y) == 0 && TileIntersectsPlayer(playerBounds, GetTileBounds(y, x), direction, out depth))
                {
                    //Resolve the collision along the given axis
                    sprite.Position += depth;

                    // Perform further collisions with the new bounds.
                    playerBounds = sprite.spriteBounds;
                }
            }
        }
    }

sentences:
TiledMap problem in android device (LIBGDX) I'm a noob when it comes to programming Java apps, so I'm trying to make a very simple platformer game.
All is running very well on desktop project, but when I put the game on my Xperia a "strange" thing happens...I'm using Tiled to draw the map, and on code OrthogonalTiledMapRenderer and TiledMap, with a OrthographicCamera, I "zoom" with camera.setToOrtho a part of the map. The problem here is...

I have an elevated floor and other tiles, and on phone screen, this all appears squashed: the tiles and the elevated floor display in a lower position than the desktop version, which is an ugly problem. Resizing the window on PC, all runs and resizes good, mantaining the aspect ratio.

Sorry if I don't explain the problem very well, I'm lost on this theme! xD
I thank tutorials, examples and all other things for noobs.
I tried all viewports and still have not solved the problem, a good way I think is cut off the top part when resize, but I don't know how to do it!

Edit:
I add the screenshots, this part of code is from a good book from packt, and I don't know if I can share here here, I prefer not do it, I'm only learning at the moment, and a comment that saying a track to try solve this is sufficient, here are:

The figure is a sprite on code, the floor and the "door" are layers on tiled (floor and doors). I configured as 16x16 tiles, but configuring as 32x32 or more is the same.

The second image is the regular window, and the last is at the minimum size window, but the aspect is the same that on the more big window...If I stretched out the window, all is stretched, but the upper floor and the sprite maintains the same distance. I don't understand what is happening on the mobile version...

sentences: When creating a UI scene in Unity, should I render the canvas in camera space? I'm working on a scene that is strictly going to be used for character creation.  Can anyone explain what the best practice is for a scene like this?  Should I render the canvas to the camera, or should I render it in world space, or as an overlay?

sentences:
Collision Checking in Unity immediately after instantiation I'm working on a dungeon generation script and I'm having some issues detecting overlap. Each piece that I spawn has attachment points, with rotation values and an offset amount so things lineup correctly. So far this is working. After spawning, I then check to see if the piece is overlapping with another, but sometimes it seems like unity hasn't caught up with the collision system, as I check to see if a bool bOverlap is true(which gets set in an ontriggerstay function) and if so destroy the piece. However, many times the script will have gotten past this collision check portion, before the collision event fires.

Any suggestions?

Each piece has a rigidbody and box collider on it for the simple collisions.

sentences:
Splitting a prefab into two These hands are in a single prefab. I want to split this into two so that I can make bones for each of them separately and use them with leap motion.

How can make each of these hands as a single prefab? Also, I'm using Unity 2018.

sentences:
convert clock input into 24 hour format I have stuck in a logical problem I have a third party package of DayNight. It takes hours input(24-hour-format) to show dayNight effects in scene

My code is to transform 12 hours clock cycle into 24 hours is

if (todsky.Cycle.Hour >= 0 && todsky.Cycle.Hour < 11.97)
            {
                Debug.LogError("1st");
                var degree = 360 - hourniddle.transform.eulerAngles.z;
                var degreeToMintues = degree * 2;       //multiply each degree with 2 to get correct minutes
                ConvertMinutesToHours(degreeToMintues); //
            }
            else if (todsky.Cycle.Hour > 11.97 && todsky.Cycle.Hour < 23.97)
            {
                Debug.LogError("2ndt");

                var degree = 360 - hourniddle.transform.eulerAngles.z; // as rotation is anti-clock getting rever degree
                var degreeToMintues = degree * 2; //multiply each degree with 2 to get correct minutes
                var MintuestTo24HoursMintueCoverstion = 720 + degreeToMintues; //add 720 mintues into current minute in order to get 24-hour-format
                ConvertMinutesToHours(MintuestTo24HoursMintueCoverstion);

            }
 void ConvertMinutesToHours(float mintues) {
        result = TimeSpan.FromMinutes(mintues);
        Debug.LogWarning(result.Hours + ":" + result.TotalHours + ":" + result.Minutes + ":" + result.TotalMinutes);
        todsky.Cycle.Hour = (float) result.TotalHours;
        Debug.LogWarning("setted hours : " + todsky.Cycle.Hour);
    }

But it is not working correctly .
 have made a clock GUI(360-degree) and as you know it only show 12 digits-format not 24. I am getting clock needle movement which can be change through mouse drag. Needle z position up to 320 degree which means one degree is equal to 2 minutes and i am taking it as input from GUI. I write below code to integrate my clock needle with my DayNight package in order to integrate GUI with package and passing hour parameter into the package but it not working correctly. Problem is that else condition is skipping.

sentences:
Existing master server software? Considering there are many games out there that use some sort of a server that contains a list of current games/servers, is there an existing library I can use instead of writing my own master server?

I only wish to store game/server data (server name/ip, num players, game-specific data...).

Thanks!

sentences: Is there documentation on XNA other than at MSDN? MSDN documentation of XNA seems to be incomplete and/or bad. Is there another resource available? And by documentation I mean of the library/framework itself, similar to what UNITY, SFML, or SDL all have available.

sentences:
Calculating Hit Accuracy score in a game I'm currently in the process of making a scoreboard for my game. One of things I would like to display is the players accuracy in the amount of hits they had in game. However, I have never done this before and I've no idea how to go about doing this.

Is there a commonly used algorithm out there that can help me calculate this, or has someone found a way to calculate this fairly easily?

Any help with this would be appreciated.

sentences:
Ray-box intersection problem I try to implement ray-box intersection algorithm given by the following code. However, I'm not really understand for two cases as shown in the following figures. Firstly, when the box is located in front of the ray, why the code give intersection even though the end point of the ray doesn't intersect with the box. A similar observation can be seen from the second case when the ray origin is located inside the box. Is this nature of the algorithm? How can solve this problem?

// r.dir is unit direction vector of ray
dirfrac.x = 1.0f / r.dir.x;
dirfrac.y = 1.0f / r.dir.y;

// lb is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner
// r.org is origin of ray
float t1 = (lb.x - r.org.x)*dirfrac.x;
float t2 = (rt.x - r.org.x)*dirfrac.x;
float t3 = (lb.y - r.org.y)*dirfrac.y;
float t4 = (rt.y - r.org.y)*dirfrac.y;

float tmin = max(max(min(t1, t2), min(t3, t4)));
float tmax = min(min(max(t1, t2), max(t3, t4)));

// if tmax < 0, ray (line) is intersecting AABB, but the whole AABB is behind us
if (tmax < 0)
{
    t = tmax;
    return false;
}

// if tmin > tmax, ray doesn't intersect AABB
if (tmin > tmax)
{
    t = tmax;
    return false;
}

// if tmin < 0 then the ray origin is inside of the AABB and tmin is behind the start of the ray so tmax is the first intersection
if(tmin < 0) {
  t = tmax;
} else {
  t = tmin;
}
return true;

sentences:
Why is my ground so dark? I wanted to add a ground so I can know the position of a helicopter in the world. But the ground appeared in a weird way:

The ground had the following texture:

This is the code:

public class ImportModel
{
    public Vector3 Position { get; set; }
    public Vector3 Rotation { get; set; }
    public Vector3 Scale { get; set; }
    Model Model;
    Matrix[] modeltransforms;
    GraphicsDevice GraphicDevice;
    ContentManager Content;
    BoundingSphere sphere;
    bool boundingimplemented = false;
    public ImportModel(string model, GraphicsDevice gd, ContentManager cm, Vector3 position, Vector3 rot, Vector3 sca)
    {
        GraphicDevice = gd;
        Content = cm;
        Position = position;
        Rotation = rot;
        Scale = sca;
        Model = Content.Load<Model>(model);
        modeltransforms = new Matrix[Model.Bones.Count];
        Model.CopyAbsoluteBoneTransformsTo(modeltransforms);
    }
    public void Draw(Camera camera)
    {
        Matrix baseworld = Matrix.CreateScale(Scale) * Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) * Matrix.CreateTranslation(Position);
        foreach (ModelMesh mesh in Model.Meshes)
        {
            Matrix localworld = modeltransforms[mesh.ParentBone.Index] * baseworld;
            foreach (ModelMeshPart meshpart in mesh.MeshParts)
            {
                BasicEffect effect = (BasicEffect)meshpart.Effect;
                effect.World = localworld;
                effect.View = camera.View;
                effect.Projection = camera.Projection;
                effect.EnableDefaultLighting();
            }
            mesh.Draw();
        }
    }
    public BoundingSphere BoundingSphere
    {
        get
        {
            if (!boundingimplemented)
            {
                foreach (ModelMesh mesh in Model.Meshes)
                {
                    BoundingSphere transformed = mesh.BoundingSphere.Transform(
                    modeltransforms[mesh.ParentBone.Index]);
                    sphere = BoundingSphere.CreateMerged(sphere, transformed);
                }
                Matrix worldTransform = Matrix.CreateScale(Scale) * Matrix.CreateTranslation(Position);
                BoundingSphere transforme = sphere;
                transforme = transforme.Transform(worldTransform);
                return transforme;
            }
            else
            {
                Matrix worldTransform = Matrix.CreateScale(Scale) * Matrix.CreateTranslation(Position);
                BoundingSphere transformed = sphere;
                transformed = transformed.Transform(worldTransform);
                return transformed;
            }
        }
    }
}

Then I call the class from the Game1 class:

ImportModel ground = new ImportModel("ground", GraphicsDevice, Content, Vector3.Zero, Vector3.Zero, new Vector3(20f));

This is how the scene looks from top:

sentences:
Questions about rendering access in UDK I also asked about this over on the UDK forums, but haven't had much luck getting any responses. Basically, I have some experience with UT3 modding, but I'm just getting started with the UDK, and I have a few questions about the degree of control over the rendering you have.

I gather that, despite the presence of several HLSL shader files in the UDK distribution (with the extension .usf), there is no means of implementing your own shaders outside of the material editor; is this correct? (I know about the Custom node in the material editor, but it's very limited, and unwieldy for all but the simplest logic.)

I understand that UE3 employs deferred rendering. I know you can access the color and depth at the current pixel in a post process. However, is there any way to access these or other G-buffer attributes in a more general way? (Normals, position, values at neighboring pixels...)

Are render targets supported in a general way? For the sake of argument, would it be possible to set up a camera to render depth from an alternate POV, then do shadow map-style depth comparisons while rendering the main view?

Is it possible to override all the materials on the client (en masse), such as those being used for the terrain or BSP geometry in the current level? (For implementing alternate vision modes and things of that nature.)

The tools that come with the UDK are of course very polished, and it's hard to beat free Scaleform and SpeedTree, but I'm starting to think the platform is a terrible fit for anyone who wants to go above and beyond drag-and-drop material editing in terms of graphics. I feel like I have much more control over the rendering in a Source engine mod, for example.

sentences:
Why does reading my depth texture in GLSL return less than one? I've created a depth texture in OpenGL (using C#) as follows:
// Create the framebuffer.
var framebuffer = 0u;

glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);

// Create the depth texture.
var depthTexture = 0u;

glGenTextures(1, &depthTexture);
glBindTexture(GL_TEXTURE_2D, depthTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 800, 600, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthTexture, 0);

Later, I sample from the depth texture as follows:
float depth = texture(depthTexture, texCoords).r;

But even when no geometry has been rendered to that pixel, the depth value coming back is less than 1 (seems to be very slightly above 0.5). This is confusing to me since, per the documentation on glClearDepth, the default value is 1. Note that this is not a problem of linearizing depth since I'm attemping to compare depth directly (using the same near and far planes), not convert that depth back to world space.
Why is my depth texture sample returning <1 when no geometry has been rendered?

sentences: Why do game studios need graphics programmers if they're using game engines? In the credits section of the games I play, there are names of graphics programmers. If they used a game engine, why do they need a graphics programmer? Isn't the game engine doing their job?

sentences:
Making a scriptable dynamic Distance Joint in Unity I have 2 2D RigidBodies that are connected together using a Distance Joint 2D...

I update the distance of said Distance Joint 2D (using a script) expecting the distance between the two RigidBodies to change, but nothing actually happens.

I'm guessing this is to do with the Physics engine not updating the positions of the RigidBodies?

sentences:
How to add a scrolling camera to a 2D Java game? I am attempting to create a game where the camera follows the player, always making sure the player is in the center of the screen. How would I go about this? This game is a 2D Java game, made with no engine.

I found an opensource game demonstrating what I want but I cannot work out how to add that to my game. The game is here, if you need it.

Thanks

sentences:
Unity Behavior Designer get gameobject I am trying to create my own action in Behavior Designer. However i cannot seem to get the game object that designer is attached to. if i attempt to do:

protected Combatant enemyCombatantObject;

public override void OnAwake()
{
    enemyCombatantObject = GameObject.GetComponent<Combatant>();
    base.OnAwake();
}

It gives me an error:

  the property or indexer 'Task.GameObject' cannot be used in this
  context because it lacks the get accessor

Can anyone tell me how to get the GameObject that the script is attached to?

sentences:
How to match user click and the sprite object position in libGDX framework I am using libGDX Java framework for developing a practice game in Eclipse.

My game is in landscape mode and I am using sprite image for game assets. Actually I am trying to follow the Kilobolt Zombie Bird tutorial.

I have set orthographic camera like this:

cam = new OrthographicCamera();
cam.setToOrtho(true, 250, 120);

I have done this because my background texture region is of 250 x 120 px in the sprite image.

So basically my sprite image is small in size and it is getting scaled according to the device but all the computing is done relative to 250 x 140 px like for changing the position of the object I have defined Vector2 position = new Vector2(x, y); and if I write position.x = 260; the sprite will go outside the screen even if my device width is 500px.

Problem:

Now I have to make the moving sprite vanish when someone clicks on it (just imagine zombies moving around and if I click on them they die). So I am using the following code for matching user click coords with the object coords:

int x1 = Gdx.input.getX();
int y1 = Gdx.input.getY();
if(position.x == x1 && position.y == y1){
    // do something that vanish the object clicked
}

The problem is position.x and position.y returns the coords relative to the ortho cam width and height which is 250 x 120 px and the click coords are relative to the device width and height which maybe anything according to the device. Because of this even if I click right on the object the click coords and the object position coords have a huge difference in their values. So I would never get matching values.

Is there any solution for this or am I doing it wrong?

sentences:
2D Lock x Axis on character I am creating an endless runner with a flying character.

I want to lock any movement in the x axis so that the character object can only move up and down but still move forward through the scene. I have looked into freezing axes and joints, but this stops the forward movement.

Is it possible to edit the below to lock the x axis for character movement only, or is there a setting where i can apply this?

using UnityEngine;
using System.Collections;

public class moveupdown : MonoBehaviour {
    public Vector2 velocity;
    public float uservelocity;
    public Rigidbody2D rb2D;

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

    void FixedUpdate() {

        if (Input.touchCount > 0 && Input.GetTouch (0).phase == TouchPhase.Moved) {
            Vector2 touchDeltaPosition = Input.GetTouch (0).deltaPosition;

            rb2D.MovePosition (rb2D.position + touchDeltaPosition * Time.fixedDeltaTime / uservelocity);

        }
    }
}

sentences:
Legacy GUI - run OnGUI only once I remember something about onGui being able to be run multiple times per frame, and I also seem to recall that you can check 'which state' the onGUI is being run in, so that you can do all of the intense logic in just the part that gets run once.

Does anybody know what I am talking about --- I can't seem to remember what it was called and it is making googling it a daunting task. Thanks!

sentences:
Why does an emulator use more RAM than the original system? Why does an emulator use more RAM than the original system? What are emulators doing that requires so much more power?

For example, when using the PSP emulator PPSSPP I'm experiencing lag on a modern PC with gigabytes of RAM, even though the PSP runs with only 32MB of RAM.

When developing my own console emulator, should I not expect it to use a similar amount of RAM / CPU cycles / other resources as the original system has to offer? Or is there extra overhead that makes emulating much more demanding than what the original hardware's specs would suggest?

sentences:
Average height of any point in a shape Super quick intro. I am making a terrain generator (With a MC exporter mostly to debug). For the islands I am creating a map with points, and create a Voronoi diagram from it. Each intersection (Where lines of the shapes meet) has a different height, depending on the distance to the coast. The coast itself is elevation=0.

However, whatever I try, I keep getting weird heightmaps. (I can't link more than two images, so I will explain). You can clearly see the difference between each site, yet they are slightly sloped.

In-game this looks like this:

The red blocks that stick out is the height of the intersection.
Sites are created by references to the intersections, since they have IDs.

The code I am using at the moment:

Point p = new Point(x, 1, z);

        double[] distances = new double[points.length];
        double[] percentages = new double[points.length];
        double[] elevations = new double[points.length];

        int max = 0;
        for(int i=0; i<points.length; i++)
            if(parent.getIntersections().fromIndex(points[i]).getElevation() > max)
                max = (int)parent.getIntersections().fromIndex(points[i]).getElevation();

        double totaldist = 0;
        for(int i=0; i<points.length; i++) {
            distances[i] = parent.getIntersections().fromIndex(points[i]).getLocation().surfaceDist(p);
            totaldist+=distances[i];
        }

        for(int i=0; i<points.length; i++){
            percentages[i] = (distances[i] / totaldist);
        }

        for(int i=0; i<points.length; i++)
            elevations[i] = (percentages[i] * (parent.getIntersections().fromIndex(points[i]).getElevation()));

        double heightTemp = 0;
        for(int i=0; i<elevations.length; i++)
            heightTemp += elevations[i];
        heightTemp = max-heightTemp+max;

        int height = (int) heightTemp - 3 + parent.getConfig().getSeaLevel() ;
        height = (height>255 ? 255 : height);

The code's quite weird and unorganized since I pretty much tried anything I could come up with.
"points" is an array containing the reference IDs to the correct intersections
"parent.getIntersections().fromIndex(int index)" is the way to retrieve an intersection from the index/reference id.
"p" is the point to get the altitude/elevation from.
"Intersection.getElevation()" returns the elevation (Anything above sea level).

Sorry if this is real vague, I have no clue on how to explain this properly.

sentences:
How to add a animation to myPlayer I'm currently making a shoot em up in monogame.

I want to add just one animation to my object. No commands or transitions between animations for different actions: just an object swapping between different images all the time.

For example, my player will have 4 different images for it and I'd want it to always swap trough these images.

Animation guides I've reviewed seem way too complicated for my needs. Unlike the examples they cover, I don't want different animations for different commands.

How can I make this type of simple, always-looping frame animation?

Edit

I managed to make a constantly looping animation to a sprite and but I don't know how to insert into myPlayer.

Game1:
        Texture2D myPlayerAnim;
        Rectangle myDestRect;
        Rectangle mySourceRect;
        Texture2D myEnemyAnim;
        Rectangle myEnemyDestRect;
        Rectangle myEnemySourceRect;
        float myElapsed;
        float myDelay = 100f;
        int myFrames = 0;

Initialize:
            myDestRect = new Rectangle(0, 0, 512, 512);
            myEnemyDestRect = new Rectangle(0, 0, 808, 608);

LoadContent:

            myPlayerAnim = Content.Load<Texture2D>("SpriteSheetPlayerAnim");
            myEnemyAnim = Content.Load<Texture2D>("SpriteSheetEnemyAnim");

Update:
            myElapsed += (float)aGameTime.ElapsedGameTime.TotalMilliseconds;

            if (myElapsed >= myDelay)
            {
                if (myFrames >= 3)
                {
                    myFrames = 0;
                }
                else
                {
                    myFrames++;
                }
                myElapsed = 0;
            }

            mySourceRect = new Rectangle(512 * myFrames, 0, 512, 512);
            myEnemySourceRect = new Rectangle(808 * myFrames, 0, 808, 608);

Draw:

            mySpriteBatch.Draw(myPlayerAnim, myDestRect , mySourceRect,
            Color.White);
            mySpriteBatch.Draw(myEnemyAnim, myEnemyDestRect, myEnemySourceRect,
            Color.White);´

Draw just draws the animations out but I don't know how to insert it into myPlayer. For myPlayer I currently have this but I couldn't figure out how to do it with my animations.

Draw:
myPlayer = new Player(TextureLibrary.GetTexture("player"), myPlayerPos, 200, new Vector2(.3f, .3f), 0, Color.White, 1000, 1);

sentences:
Unity: Make a moving rigidbody stop exactly at a given distance I have an object that only moves along Z-axis, its rigidbody has a mass of 1 and a drag of 0.2.

That object accelerates till MaxVelocity and then moves at that constant velocity in the Z-axis.

When the user pushes the brakes I want to add a force on that rigidbody to make it stop completely at a given distance (lets say 10 meters from where it pushed the button).

I've tried using: .

Which is what you get when solve for t in the first and replace in the second:

Where v is final velocity and in my case I want it to be zero.

The code

I call this method every FixedUpdate since user pushed brakes:

private float CalculateBrakeAccel(float targetPos)
{
    // targetPos has the position in the z axis the object should stop
    // i.e.: velocity is 0.0f
    float remainingDistance = (targetPos - rigidbody.position.z);
    // formula: a = 0.5 * v0^2 / (e0 - e)
    float brake = 0.5f * rigidbody.velocity.sqrMagnitude / remainingDistance;
    return brake;
}

That alone always results in a braking distance less than the expected (passing 10m as Braking distance and the object brakes at ~8.4m).
I thought it could be drag. So I tried to compensate my braking accel with the drag (for the drag calculation I used the formula found here):

public float Accel = 8f;
private float maxVelocity = 19.44f; // in m/s, approx. 70km/h
[...]
void FixedUpdate ()
{
    Vector3 forwardForce;
    if (playerController.PowerInput < 0.0f)  // if user braking, PowerInput = -1
    {
        float brakeAccel = CalculateBrakeAccel(playerController.BrakeTarget); // BrakeTarget is the transform.position.z where the user pushed the brakes + 10 meters
        forwardForce = new Vector3(0.0f, 0.0f, brakeAccel * playerController.PowerInput);
        Vector3 drag = rigidbody.velocity * Mathf.Clamp01(1f - rigidbody.drag * Time.fixedDeltaTime);
        if (drag.z > 0.0f)
            forwardForce += drag;
        else
        {
            forwardForce -= drag;
        }
        rigidbody.AddForce(myTransform.TransformDirection(forwardForce));
    }
    if (!CapAtMaxSpeed())    // if max. vel not reached, accel force can be applied:
    {
        forwardForce = new Vector3(0.0f, 0.0f, playerController.PowerInput * Accel);
        rigidbody.AddForce(myTransform.TransformDirection(forwardForce));
    }
}

bool CapAtMaxSpeed()
{
    // velocityMagnitude == rigidbody.velocity.magnitude but without sqrt() operation.
    velocityMagnitude = Vector3.Dot(rigidbody.velocity, myTransform.forward);
    if (velocityMagnitude > maxVelocity)
    {
        rigidbody.velocity = rigidbody.velocity.normalized * maxVelocity;
        return true;
    }
    return false;
}

That code gave the best results till now for any given distance (but with that specific Accel and maxVelocity). For example, it returns something in between 9.93-9.97 meters for a given distance of 10 meters (which I would accept as valid enough and a precision issue with floating operations).

The problem is if I encrease the Accel or the maxVelocity, the distance the object reaches full stop is progressively less and less than the one I'm passing to the script.

Also, if I push brake while not at maxVelocity and still accelerating (i.e., applying positive force along Z-axis), the braking distance is way shorter. Common sense suggests it should be larger in any case. And CalculateBrakeAccel() is using the current velocity at any given moment so the correct accel should be a calculated.

sentences:
How do you use your own tileset in Tiled? I'd like to create a 2d platformer and I understand that using tiles helps you a lot.

I think many use the map editor "Tiled" but I can't find anywhere how do you make your own tileset from a given image that you created.

I spent most of today searching a reference for this on Google, without much luck..
The only hint comes from a couple of python scripts, but I didn't manage to make them work
Am I missing something?

sentences:
How would you implement chromatic aberration? How would you implement the effect of chromatic aberration with shaders?

Would rendering of the world with different focus distances for each color solve the problem (maybe with the usage of only one depth rendering pass)?

sentences:
Do any games support different lighting effects according to whether a surface is wet or dry? I've noticed that when driving at night, when the road surface is dry, my headlights appear to illuminate much further than when the road surface is wet. I presume that this is due to the differences in how my headlights is being reflected under wet and dry conditions.

In dry conditions, my headlight will reflect in a diffuse way, producing producing enough scatter to allow me to see the texture of the road for quite a long distance. In the wet however, the thin layer of water over the road surface, combined with the shallow angle of incidence, causes the light from my headlights to be reflected in a specular way and not back scattered to me.

Thinking about this, I realised that I can't remember ever having seen this effect being reproduced in a game.

Has this wet/dry effect been implemented in any game?

If so, what is the name of the technique used to produce the effect?
If not, could this effect be produced without ray-tracing?

sentences:
How to stop this object from overlapping tile's corners in 2D tilemap I am using a tilemap to create my 2D world. All tiles and the player has an AABB. Currently, I'm detecting collisions with surrounding tiles the player is in, from the player's center. This works, but when the player's center is outside the tile and another point of the player is still in the previous tile, the wrong tile is getting checked and the player overlaps the corner of the tile getting checked previously.

How can I solve this?

This is my TypeScript code:

public checkAABB(ent: Entity): TileMap {

    let tileX = this.pxToTile(ent.bounds.centerX());
    let tileY = this.pxToTile(ent.bounds.centerY());

    let indices = [
        [0, -1],
        [1, 0],
        [0, 1],
        [-1, 0]
    ];

    let idx, tile, intersection;

    for (let i = 0; i < indices.length; i++) {
        idx = indices[i];

        tile = this.getTile((tileX + idx[0]), (tileY + idx[1]));

        intersection = tile.solid && ent.bounds.intersects(tile.bounds);

        if (intersection) {
            this.collisionInfo[i].tile = tile;

            switch (i) {
                case 0:
                    this.collisionInfo[i].penetration =   Math.abs(ent.bounds.min().y - tile.bounds.max().y);
                    break;
                case 1:
                    this.collisionInfo[i].penetration = Math.abs(tile.bounds.min().x - ent.bounds.max().x);
                    break;
                case 2:
                    this.collisionInfo[i].penetration = Math.abs(ent.bounds.max().y - tile.bounds.min().y);
                    break;
                case 3:
                    this.collisionInfo[i].penetration = Math.abs(ent.bounds.min().x - tile.bounds.max().x);
                    break;
            }

        }

        this.collisionInfo[i].active = intersection;
    }

    return this;
}

Visualization:

sentences:
Voxel heightmap terrain editor I've recently been experimenting with a simple Voxel-based 3d engine (think Minecraft) which uses heightmaps to define terrain in the following format:

http://en.wikipedia.org/wiki/Heightmap

Does anyone know of the best software for producing these kind of maps? Preferably with the ability to define a texturemap also. Are terrogen and picogen the only real alternatives?

sentences:
Trigger scene loading in one device from another device using Unity WWW class I have a master device and client device. I want to load a scene in the client device by pressing a button in the master. My method is, when the button is pressed in the master device, a data is stored in a server using the WWW class and in the client device it is checked whether the data is there, through a coroutine.

But, in the client device, the coroutine is not waiting for the trigger from the master. Instead it continues the execution. Because in the yield return statement, it says downloading is complete. Can I make it to wait for a trigger from the server?

sentences:
How to correclty play the sounds in a 3D enviornment? I'm currently working on an XNA game with C#. I've been looking into 3D Sounds recently as this is the next objective on my list. I've found several tutorials online and they don't work to the standards I'm after.

What I've found is that even when the player moves, the sounds don't or when the play looks around the sound doesn't change where it's being projected from in my earphones. (When I look at the sound source, I expect to hear it and in front of me, or if I have my left turned to it, then I expect to hear it on my left etc...)

My Code so far:

//Decleration
    private Cue cue;
    private AudioEmitter emitter = new AudioEmitter();
    private AudioListener listener = new AudioListener();
    private AudioEngine engine;
    private WaveBank waveBank;
    private SoundBank soundBank;
    private float angle = 0;

//load content
        engine = new AudioEngine("Content/music/footsteps/footsteps.xgs");
        waveBank = new WaveBank(engine, "Content/music/footsteps/Wave Bank.xwb");
        soundBank = new SoundBank(engine, "Content/music/footsteps/Sound Bank.xsb");

//update
                listener.Position = Vector3.Zero;
                emitter.Position = new Vector3(10, 10, 10);
                cue.Apply3D(listener, emitter);
                cue = soundBank.GetCue("pl_step1");
                cue.Apply3D(listener, emitter);
                cue.Play();

My code works fine in that the sounds are being played and I can hear them, they are just not realistic and so I'm asking if anyone could help me how I could make the sound move around so that it sounds like it does in real life. (If the source/emitter is on my left, the main sounds should be coming through my left earphone.)

sentences: How to drag my dragging object in 'game'-unity? I have made a dragging sphere which drags, problem is how can I drag it using keyboard keys , I dont want to build it again on iphone simulator after experimenting with my code. for dragging it is not accepting mouse or any keyboard keys. Is it possible ?

sentences:
Texture coordinate into texel form? How do I convert a texture coordinate, like 1,0 into a texel form(a single value?). Like in the image below, what is the value of Q22 in texel?

I'm in directx 11.

sentences:
How do I set meshCollider.cookingOptions to MeshColliderCookingOptions.Everything in code? I'm procedurally generating some meshes for a project, and I need to add colliders to them. The meshes are generating fine, but after setting the shared mesh in the mesh collider, I need to be able to set the cookingOptions to Everything. In the inspector, I can do this fine and the colliders work correctly. Since I am generating these at runtime, I can't really do this after making a build. How do I go about doing this?

Works Correctly:

Does not Work Correctly:

sentences:
How to find 1/3 and 2/3 of the distance between two given points? I know how to find the middle of two given points:

var midpoint = (pointA + pointB)/2;

where pointA and pointB are Vector2

I thought that

var thirdBtnPoints = (pointA + pointB)/3;
var twoThirdBtnPoints = 2*(pointA + pointB)/3;

should give me 1/3 and 2/3 between the two points but it doesn't. I guess this might be more of a math question though, but how can I find 1/3 and 2/3 of the distance between two given points?

sentences:
How to get good movement synchronization in a networked game (action/shooter) I've spent the last two days trying to get good movement interpolation with Photon in Unity but I can't get anything that I'm happy with. I've tried several methods but none satisfied me. My understanding is that I better use some kind of interpolation (as opposed to extrapolation/dead reckoning) because in my game the players can change direction fast.
I've tried lerping between the current position and the last received authorized position, I've tried lerping between the old and the new authorized position, but nothing gives me the right amount of responsiveness + smoothness. What can I do?
Sample code:
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
    if (stream.IsWriting) //do we have authority over this object?
    {
        stream.SendNext(transform.position);
        stream.SendNext(transform.rotation);
    }
    else
    {
        newNetworkTime = Time.time;
        oldPosition = transform.position;
        oldNetworkPosition = networkPosition;

        networkPosition = (Vector3)stream.ReceiveNext();
        networkRotation = (Quaternion)stream.ReceiveNext();
    }
}

void RemoteMovement()
{
    float t = 1.0f - ((newNetworkTime + interpolationPeriod - Time.time) / interpolationPeriod);

    transform.position = Vector3.Lerp(oldPosition, networkPosition, t);
    transform.rotation = Quaternion.Lerp(transform.rotation, networkRotation, Time.deltaTime * movementSpeed);
}

sentences:
Is There a Way To Keep Precision When Transforming GameObjects I've seen this issue before, but it's never been a particular issue for me until today.  I have each "room" of a dungeon created with a class script that contains details of that room.  During the process of building the dungeon, rooms may be mirrored or rotated.  When I rotate the y-axis, it updates properly the first time, going from 0 to 180, but if I mirror it back and forth, it begins to get very small variances away from true 0 and 180.  Over time, this could impact some things.  The code I'm using to do this is:

    public void RoomMirror()
    {
        transform.Rotate(0, (transform.localRotation.y==180) ? 0.0000f : 180.0000f, 0);
        Mirror = !Mirror;
        Swap(ref _east, ref _west);
    }

I added the four places in the float to try to overcome this issue, but it doesn't seem to be making any difference.  Thanks!

sentences:
How does ECS handle systems which need to know more about the environment of the entities it processes? I'm trying to wrap my head around the concept of ECS (Entity Component System). I think I grasp the concept of the different parts, Entities, Components, and Systems.

Entities: Basically just a container for components

Components: Data. E.g Transform component holding position, rotation and scale.

System: Runs on a subset of entities matching a combination of components. E.g. RenderSystem rendering all entities with a Mesh and a Transform.

What I'm having trouble wrapping my head around is how a system is supposed to assign data regarding the surrounding environment to the components without using global data. And it's probably because of a lack of understanding.

Example of what I'm getting stuck on:

Lets say I have a Player entity consisting of, among others, a Transform component. And lets say that there are multiple Zombie entities roaming the game world, which has a Transform and a AIPathfinding component. So I would naturally create a System that operates on Transforms and AIPathfinding to make the zombies chase the player.

My only problem is, how is the system supposed to know where the player is, or if there even is a player within range, without having to grab the player globally?
Sure I could pass the player into the creation of the system. But what if along with the player the zombie are also chasing a constantly changing amount of civilians. Do I pass them to the system at creation as well? Or should I have some global way to fetch entities matching a component query, similarly to how the system detemines which entities to operate on?

I understand that this might be entirely up to the implementation of the ECS. But I'm having a hard time finding resources that explains any further that the most basic systems (RenderSystem etc.).

sentences:
Rotating the playing field. (MonoGame) My maths isn't as good as it should be, I need to pick up some reference books on Trig.

Could someone give me an idea of the maths if I wanted to revolve many sprites around a central point?

It's a 2D system in MonoGame.

I'm going to try to describe the scenario, I can't think of anything quite like it to reference.

Imagine a game screen, you are looking down on the world, with my character in the middle, my character sprite will never change, but if I turn left or right I want everything else to rotate around the central point.  Of course every sprite will have to be moved, and also rotate to account for the spin.

Can someone point me in the right direction?
Thanks.

sentences:
Calculating spaceship course There is an idea for (soft) sf strategy game following me for a long time but I need to get a grasp of some math before moving further with it.

Lets assume there is a spaceship traveling (in space) with some velocity and its engines can generate some acceleration - with maximum acceleration much smaller in magnitude than obtainable velocity. Now given the planned use of engine (acceleration in time) I think ti is fairly straightforward to calculate movement of the ship.

But the problem I need to solve is reverse - given starting position, velocity and desired destination I need to find a plan of engine usage (acceleration over time) that will guide the ship to the destination in minimal time.

There may be some complications like

The ship can only accelerate in one direction and turning (changing direction) takes time
There are some large bodies with gravitational pull that affects ship course
The destination point is moving in time - for example it is relative to planet or moon orbiting larger body
The timing is important - for example the ship is flying in fleet and need to arrive on target at roughly same time as her companions

Now I do not expect to get ready to use solution but my question is where I could look for clues? What I should study? What similar problems or related algorithms can help?

As this is for a game the solution may be simplified and even involve some "cheating" that would not work in real life.

sentences:
LIBGDX font.draw() makes letters blink on PC I load Bitmapfont then try to draw it, but on PC(desktop) build screen blinks with frequecy that I can judge that backbuffer is not drawn. On Android all is fine, I don't see blinking. I simply do this:

SpriteBatch = new SpriteBatch();
Bitmapfont font = new Bitmapfont();
font.setColor(Color.GREEN);
spriteBatch.begin();
font.draw(spriteBatch, "Hello world", 0, 100);
spriteBatch.end();

Ways to fix?

sentences:
Performance of delta force-esque voxel terrain I've been reading about voxel terrain lately and often see people asserting that it will absolutely kill performance.

What I don't understand is how games like Delta Force managed to have smooth voxel terrain without all these alleged performance issues? Sure, their terrain doesn't look cutting edge but it certainly doesn't (seem to) impose very harsh performance requirements.

Is Delta Force perhaps not actually using voxels for their terrain? How exactly does their engine work and why don't people use the same techniques today?

sentences:
How to make an object fly out of a slingshot? At the moment I'm improvising a slingshot, the user can click and drag the projectile and let go.
The force on the object is calculated by getting the distance between the vector of the slingshots two forks and the vector between where the user pulled it.
However this will always result in a positive number and will not take into account the angle of the object relative to that of the slingshot. How can I make it fly out of the slingshot correctly?

My attempt:

float distance = mousePos.dst(pouchPos.x, pouchPos.y, 0);
Vector2 d = new Vector2(pouchPos.x - mousePos.x, pouchPos.y - mousePos.y);
object.setVelocity(d.nor().x * FIRE_SPEED, d.nor().y * FIRE_SPEED);

sentences:
Batching Homogeneous Render Objects in XNA, 2D Component-Entity Engine? I've been working on my component-entity engine for about 3 months now, and have managed to get nearly every constituent system working with little effort or compromise. My system has the following attributes:

Components are mostly comprised of data.
Services (physics, networking, rendering, etc) operate on these components' data in a type-agnostic manner.
Components register themselves with their respective service provider on start-up.

One of the services I've been struggling to implement is rendering. I want a rendering service that keeps a list of my drawn components in an ordered list depending on what kind of drawing operations they require from the graphics device (i.e. different shaders, textures, draw order, etc) and then every frame iterates over the the list, grabs the indexed vertex arrays from the component and renders them using the settings specified in the "DrawContext."

In my research, I've stumbled upon the Nuclex.Graphics package which seems to solve a great deal of my concerns. It has an excellent implementation of vertex buffer object batching, queuing and such but it is not necessarily tailored towards a component-entity system. With Nuclex's design, all that is required is for my components to "queue" vertex buffer objects with the service which then batches them according to their "DrawContext."

My question is, how I can hide all of these vertex objects from the user? How can I enable my rendering service to draw both simple textured quads and complex stencil shadows while remaining type-agnostic? If you've worked on a component-entity system, how did you tackle complex rendering schemes?

sentences:
What defines a minigame? A "minigame" (sometimes mini-game) is a rather common term used in game design and the general game industry. Therefore it has a definable scope, that is not opinion based, but rather established and tangible. However, I'm at a loss to define its scope. The wikipedia page says:

  "A minigame (also spelled mini-game or mini game and sometimes called
  a subgame) is a short video game often contained within another video
  game and sometimes in application software or on a display of any form
  of hardware. A minigame is always smaller or more simplistic than the
  game in which it is contained. Minigames are sometimes also offered
  separately for free to promote the main game. For instance, the
  Pokémon Stadium minigames involve merely pressing a few buttons at
  specific intervals, with little complexity."

When asked to define it, I guess loosely I'd consider a minigame any game that:

could easily be a self-contained game within another one
that usually shows all the information on the screen
could have been produced in the "dawning of gaming" (At least its mechanics)
that the average (perhaps even non-gamer) can sit down and instantly
understand nearly all the game rules without having to "learn" them via
play.

Some things to think about:

Is Game_B that has been included in another game, Game_A, still
a minigame if it is later played or released independently from
Game_A?
What if Game_B was originally independent, but Game_B (or
clones) are now almost exclusively found as minigames within other
games? Will Game_B always be a minigame after that?
Is pong a minigame - it most certainly has been a minigame?
Likewise, is chess a minigame (it matches my personal definition
despite being incredibly complex logically)?

(I don't know if I can link pictures here, otherwise I would add some examples.)

Answers should please be constructive and professional. Good answers should also give reasoning and cite sources when possible.

sentences:
A* Pathfinding issues, player node is always off so I am using Sebastian Lague's second video on A* pathfinding (https://www.youtube.com/watch?v=nhiFx28e7JY&list=PLFt_AvWsXl0cq5Umv3pMC9SPnKjfp9eGW&index=2), and since he is using a 3d model, and I am using a 2d model, I need to convert some of the values to 2d. It is working fine, but the problem I ran into is that the node that detects the player is always off.

Like in here, the cyan node is the node where my player is supposed to be, and the my cursor is where my player actually is. You can see that it is completely off. I am pretty sure this is because some error is produced while I tried to turn 3d into 2d, but I don't know how. Here is my grid script:

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

public class Grid : MonoBehaviour
{
    public Transform player;
    public LayerMask unwalkableMask;
    public Vector2 gridWorldSize;
    public float nodeRadius;
    Node[,] grid;

    float nodeDiameter;
    int gridSizeX, gridSizeY;

    void Start() {
        nodeDiameter = nodeRadius*2;
        gridSizeX = Mathf.RoundToInt(gridWorldSize.x/nodeDiameter);
        gridSizeY = Mathf.RoundToInt(gridWorldSize.y/nodeDiameter);
        CreateGrid();
    }

    void CreateGrid() {
        grid = new Node[gridSizeX,gridSizeY];
        Vector3 worldBottomLeft = transform.position - Vector3.right * gridWorldSize.x/2 - Vector3.up * gridWorldSize.y/2;

        for (int x = 0; x < gridSizeX; x ++) {
            for (int y = 0; y < gridSizeY; y ++) {
                Vector3 worldPoint = worldBottomLeft + Vector3.right * (x * nodeDiameter + nodeRadius) + Vector3.up * (y * nodeDiameter + nodeRadius);
                bool walkable = !(Physics2D.OverlapCircle(worldPoint,nodeRadius,unwalkableMask));
                grid[x,y] = new Node(walkable,worldPoint);
            }
        }
    }

    public Node NodeFromWorldPoint(Vector3 worldPosition) {
        float percentX = (worldPosition.x + gridWorldSize.x/2) / gridWorldSize.x;
        float percentY = (worldPosition.y + gridWorldSize.y/2) / gridWorldSize.y;
        percentX = Mathf.Clamp01(percentX);
        percentY = Mathf.Clamp01(percentY);

        int x = Mathf.RoundToInt((gridSizeX-1) * percentX);
        int y = Mathf.RoundToInt((gridSizeY-1) * percentY);
        return grid[x,y];
    }

    void OnDrawGizmos()
    {
        Gizmos.DrawWireCube(transform.position, new Vector3(gridWorldSize.x, gridWorldSize.y, 1));

        if (grid != null)
        {
            Node playerNode = NodeFromWorldPoint(player.position);

            foreach (Node n in grid) {
                Gizmos.color = (n.walkable)?Color.white:Color.red;
                if (playerNode == n)
                {
                    Gizmos.color = Color.cyan;
                }
                Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter-.1f));
            }
        }
    }
}

And here is my node script:

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

public class Node
{
    public bool walkable;
    public Vector3 worldPosition;

    public Node(bool _walkable, Vector3 _worldPos) {
        walkable = _walkable;
        worldPosition = _worldPos;
    }
}
```

sentences:
Multiple keypresses causing wierd results in SDL I have been building a pong clone. I've been using a mixture of peoples different code to understand the way they structure their games as well as reading on game patterns. Currently I've gotten to draw a paddle on the screen and the player can move it with the keyboard no problem.

The issue comes when a player presses a button that is not 'Up' or 'Down'. For instance when the player holds the 'Up' key the paddle travels upwards, but if they simultaneously hold the 'Right' key it causes the paddle to fly downwards at a much greater speed.

My keyboard checking code is:

void GameLoop::Input(SDL_Event &ev)
{
    if (ev.type == SDL_KEYDOWN)
    {
        if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN)
        {
            player1->IsMoving(true);
            player1->velocity = 10;
        }
        if (ev.key.keysym.scancode == SDL_SCANCODE_UP)
        {
            player1->IsMoving(true);
            player1->velocity = -10;
        }

    }

    else if (ev.type == SDL_KEYUP)
    {
        if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN)
        {
            player1->IsMoving(false);
            player1->velocity = 0;
        }
        if (ev.key.keysym.scancode == SDL_SCANCODE_UP)
        {
            player1->IsMoving(false);
            player1->velocity = 0;
        }
    }
}

The GameLoop is ran within loop that is configured to run at 60FPS. You can see this in this code block here:

int main(int argc, char **argv){

    //Initialise the app and SDL
    App app(SDL_INIT_VIDEO);
    GameLoop game;

    double lastTime = 0.0, currentTime;

    SDL_Event e;

    while (app.isRunning())
    {
        if (SDL_PollEvent(&e))
        {
            if (e.type == SDL_QUIT)
            {
                app.exit();
            }
        }

        currentTime = SDL_GetTicks() / 1000.0;
        if (currentTime >= lastTime + 0.01666667)
        {
            game.Input(e);
            game.Update();
            game.Render();

            lastTime = currentTime;
        }

    }

    return 0;
}

This is the paddles update code:

void Paddle::Update()
{
    if(moving == true)
    {
        rect.y += velocity;
        velocity = 50;
    }

    X = rect.x;
    Y = rect.y;
}

I'm unsure of what is causing the paddle to behave so strangely. Any insight given into this problem or even just the way I've approached this problem would be appreciated.

sentences:
How can I architect my game tools to allow for easy extension? In the code for the toolkit for my game, I have a concept I've been calling "contexts."

Each context refers to, essentially, different tools (SelectionContext, DrawTerrainContext, et cetera) and contains contain "actions" which are added/removed from the undo history.

Some pseudo-code:

public abstract class Context
{
    public abstract void Initialize();
    public abstract void Destroy();
    public virtual void Update();
}

public interface IAction
{
    void Execute();
    void Undo();
}

public class SelectionContext : Context
{
    public override void Initialiize() { ... }
    public override void Destroy() { /... }
    public override void Update() {
        if(mouseDown && noSelection)
            startSelection();
        else if(mouseDown && !noSelection)
            expandSelection();
        else if(!mouseDown && !noSelection)
            finishSelection();
    }

    private class SelectionAction : IAction
    {
        private List<object> _oldSelection;
        private List<object> _newSelection;

        public SelectionAction() { ... }
        public void Execute() { ... }
        public void Undo() { ... }
    }
}

The above context may define things like a RectangleSelectionAction, EllipticalSelectionAction, et cetera.

Stacking them like this allows me to do things like select a section of terrain then go to a different context to change textures (or what have you), then return to the selection.

While this is an improvement over putting almost everything in one file it still seems a little strange to me having to define small private classes in each context for each of their major actions.

Is there a standard (or better) way of abstracting out different tools from the main toolkit program to allow for easier development of future tools?

sentences:
How to force a translation to go through an exact point? I have a camera object with a script that will whether translate it with a set speed, or stop it. I also have 7 "checkpoints", where there are 7 different quads, who will stop the camera whenever the camera reaches them.

The problem here is that in my code :

void Update() {

if (scoreholder.CheckScore()<scoretimer) {
//if the current score is less than set X score

        if (killcam.transform.position.y == quadholder.y) {
//and if the camera's position equals the position of the generic quad *PROBLEM HERE*

            killcam.GetComponent<cameraUp> ().SetCam (true); //stop the cam

            while (scoreholder.CheckScore () < scoretimer) { // do stuff

                offset = mr.material.mainTextureOffset;
                offset.y += offsetSpeed * 0.1f;
                mr.material.mainTextureOffset = offset;

                break;
            }
        }

    }

else { //once the score is not less than the desired X score, move the cam
        killcam.GetComponent<cameraUp> ().SetCam (false);
    }

}

So my problem here is that this line of code if (killcam.transform.position.y == quadholder.y) never happens, the translation skips some values, and the camera doesn't hit the exact quad spot. I tried to use > instead of ==, but I ran into another problem, is that after the 3rd quad, since my camera speed increases in time, the code apparently doesn't get processed fast enough, and my camera goes beyond the 4th,5th,6th, and 7th quad without stopping.

I have already tried Vector3.Lerp, and it gives me almost the same result, if I lerp between the beginning and the end of the track, I have to do it with an extremely small fraction, and I can't have my camera move at that speed.

sentences:
Bullet physics convex hull center of mass I am trying to make a convex hull collider for bullet physics. I am using BulletSharp.CompoundShape and BulletSharp.ConvexHullShape.
This is model of a chair in unity with rigidbody and convex mesh collider (how i expect it to behave):

This is that same model in my engine:

Here is the chair in blender:

When attaching collision shapes to CompoundShape there is an option to add offset, i tried setting that offset to center of volume of mesh i calculated, it did not work.
Simple solution would be to center object in blender somewhere around its center of mass, but can this be avoided?
Can i somehow change the chairs center of mass in bullet?
Here is a picture of chairs acting more naturally after changing the center in blender:

All pictures were taken when rigidbodies were still and probably asleep.

sentences: Game engine that allows for objects being placed in-game I am looking for a game engine with multiplayer support that allows for players to place objects in the terrain. (eg. in TF2 one can place teleporters, etc... or in minecraft one can place blocks). I don't need the placeable objects to be interactive like in TF2, but I just need an engine that won't make me code this from scratch. I have decent knowledge of Python, PHP, HTML, C++ and C# (and a small knowledge of Lua scripting, although I have only been at it for a few months) so I should be able to handle most engines. So far I have looked at UDK and Cryengine, and wasn't thrilled with either.

sentences:
Can I leverage the fact that my scene is often static to improve OpenGL (JOGL) performance? My scene is drawn based on the location of several (often several million) vertices (kept in VBO's) and a camera.  I can easily tell in my code when my scene has changed and when it hasn't.  There are also some odd cases such as the window being resized, but I believe I can easily enumerate and handle those as well.

Can I (in user code or through some OpenGL property) leverage this to increase the performance when the scene is static?  Clearly when the scene is changing, all of the math must be done to properly calculate what should be rendered.  But when the scene is static, that picture isn't changing each frame.

I've tried implementing something in my code to do this, but the result is a flickering scene (and I'm not entirely sure why).  Basically I check to see if anything has changed and if it hasn't I simply return from the display(GLAutoDrawable drawable) function that is invoked by the JOGL FPSAnimator.

I feel like this is probably a common problem that should have a standard solution.  However, I haven't been able to find anything so far.

sentences:
Timing Calculations for Opengl ES 2.0 draw calls I am drawing a cube in OpenGL ES 2.0 in Linux.
I am calculating the time taken for each frame  using below function

#define NANO 1000000000

#define NANO_TO_MICRO(x) ((x)/1000)

uint64_t getTick()
{
  struct timespec stCT;
  clock_gettime(CLOCK_MONOTONIC, &stCT);
  uint64_t iCurrTimeNano = (1000000000 * stCT.tv_sec + stCT.tv_nsec); // in Nano Secs
  uint64_t iCurrTimeMicro = NANO_TO_MICRO(iCurrTimeNano); // in Micro Secs

  return iCurrTimeMicro;
}

I am running my code for 100 frames with simple x-axis rotation.
I am getting around 200 to 220 microsecs per frame.

that means am i getting around (1/220microsec = 4545) FPS
Is my GPU is that fast?
I strongly doubt this result.

what went wrong in the code?

sentences:
Load 2 triangles in a simple DX11 example I'm following this tutorial, where they show how to setup a simple dx11 demo with a green triangle in the middle. I'd like to be able to modify it so that it shows 2 triangles instead, i modified the code of the Graphicsclass.cpp in the tutorial by adding some lines to the Render() function, just after the first triangle is drawn, it's the //ADDITIONAL CODE section:

[...]
// Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing.
m_Model->Render(m_Direct3D->GetDeviceContext());

// Render the model using the color shader.
result = m_ColorShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix);
if (!result)
{
    return false;
}

//ADDITIONAL CODE
// Reset the world matrix.
worldMatrix = XMMatrixIdentity();

// Translate to the location of the second triangle.
translateMatrix = XMMatrixTranslation(1.0f, 1.0f, 0.0f);
worldMatrix = XMMatrixMultiply(worldMatrix, translateMatrix);

// Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing.
m_Model->Render(m_Direct3D->GetDeviceContext());

// Render the model using the color shader.
result = m_ColorShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix);
if (!result)
{
    return false;
}
//END OF ADDITIONAL CODE
// Present the rendered scene to the screen.
m_Direct3D->EndScene();

But the second triangle doesn't show up, i also put the complete example on github in case you want to try it yourself. I'm sure i'm missing something pretty basic but i can't figure it out

sentences:
Not able to find the constraints option in the Rigidbody component I am working on a game tutorial right now and I need to freeze constraints for a model prefab. I add a Rigidbody component and I want to freeze rotations on the x and z axes. However, I am not able to find the option in the component. Is there another way to access rotation constraints (I do not want to code the constraints at the moment)? Or is there something I am missing in the new version. Please do let me know. Thanks

I am using Unity 5.6.7f1 Personal

sentences:
Unity3D RigidBody adding force diagonally (x,y,0) results in two separate movements instead of one diagonal movement? The intentions of this function are to utilize the RigidBody component from a "target" object and clear its force while applying a diagonal force in the direction upwards and away from the side they are facing. I have omitted the portion in which detects the other direction for the sake of simplicity in reading the function as I've been testing this function while the user faces the right-hand direction.
Variables:

target refers to the other object currently in the scene
targBody refers to the RigidBody component of the target
object   damage refers to the current damage integer of the
object.      The damage used in this instance is from the target
object   facingRight refers to a bool in which is true
whenever the current object is facing the right-hand
direction.

    public void Damage() {
        targBody.velocity = Vector3.zero;
        if(facingRight) {
            Vector3 newVel = new Vector3(target.GetComponent().damage/16, target.GetComponent().damage/16, 0);
            targBody.AddForce(newVel, ForceMode.Impulse);
            print("Stuff");
        }
        target.GetComponent().damage+=3;
    }
For some reason, when I apply the force, the target object doesn't move diagonally. Instead, it moves horizontally before moving vertically; however, for some strange reason the horizontal speed is always greater than the vertical speed as it goes so fast that it nearly teleports!
I'm not sure if this error happens because of a coding problem on my part that I'm just not recognizing or if it's a problem with RigidBody in which I need to use a workaround for.Anyone have any ideas on what can make this function work the way I want it to?

sentences:
Replace each white spot of image to radial gradient Recently, I read an article about a sun shader (XNA Sun Shader) and decided to implement it using OpenGL ES 2.0, but I encountered a problem with the shader:

I have two textures, one of them is the fire gradient texture:

The other one is a texture which will have each white part filled using the gradient;

So, I'm going to have a result similar to the image below (do not pay attention to the texture being rendered on a sphere mesh):

I really hope that somebody knows how to implement this shader.

As an alternative, how do I make it in photoshop?

sentences:
Navmesh bound in ue4 topdown and third person template The Topdown template has a navmesh volume to build walkable area, if remove that volume, the character will be unwalkable. However, the third person template has no such thing, but the character movement is OK.
What's the difference between them? Why third person template don't need a navmesh volume?

sentences: Is SDL too low level for a beginner? I am getting started in game development. I started by learning SDL because it seems before I start developing big games, I have to start with the most basic stuff, like Tetris or Snake. I was wondering if SDL is too low-level. If I start with something as low level as SDL, will that make other high level libraries easier to pick up? Like for example, when someone is good with assembler, C seems easy.

sentences:
How can I create a 'flaming' effect like in Ocarina of Time's title screen? I'd like to recreate a flaming effect like the one from the logo on the title screen of the N64 game 'The Legend of Zelda: Ocarina of Time,' shown below:

A quick look into the textures used in the ROM provide a single 32x32 texture that looks similar to the effect but I don't know how that image (assuming that's the right one) is transformed into the effect seen on the logo.

How can I implement something similar?

sentences:
knowing all available entity types I'm making a game where at some point the game will create enemies of random types. Each type of enemy available is defined on its own class derived from an enemy superclass. To do this, obviously the different types of enemies should be known. This is what I have thought of:

Just make a list manually. Very simple to do, but I don't like it because I'll be adding more enemy types over time, so any time I add a new class I have to remember to update this (same if I remove an enemy). I would like some kind of auto-updating list.
A completely component based system. There are no different classes for each enemy, but definitions of enemies in some file where all enemy types can be found. I really don't need that level of complexity for my game. I'm still using a component based model to some degree, but each Enemy type gets defined on its own class.
Java Annotation processing. Give each enemy subclass an annotation like @EnemyType("whatever"), then code an annotation processor that writes in a file all available enemy types. Any time a new class is added the file gets updated after compilation.This gives me a feeling of failure even if its a good solution, it's very dependant on Java, so it means I cant think of a general design good for any kind of language. Also I think that this would be too much work for something so simple.

I would like to see comments on these ideas and other possible solutions

Thanks

sentences:
SDL: How would I add tile layers with my area class as a singleton? I´m trying to wrap my head around how to get this done, if at all possible. So basically I have a Area class, Map class and Tile class. My Area class is a singleton, and this is causing some confusion. I´m trying to draw like this: Background / Tiles / Entities / Overlay Tiles / UI.

void C_Application::OnRender()
{
    // Fill the screen black
    SDL_FillRect( Surf_Screen, &Surf_Screen->clip_rect, SDL_MapRGB( Surf_Screen->format, 0x00, 0x00, 0x00 ) );

    // Draw background

    // Draw tiles
    C_Area::AreaControl.OnRender(Surf_Screen, -C_Camera::CameraControl.GetX(), -C_Camera::CameraControl.GetY());

    // Draw entities
    for(unsigned int i = 0;i < C_Entity::EntityList.size();i++)
    {
        if( !C_Entity::EntityList[i] )
        {
            continue;
        }

        C_Entity::EntityList[i]->OnRender( Surf_Screen );
    }

    // Draw overlay tiles

    // Draw UI

    // Update the Surf_Screen surface
    SDL_Flip( Surf_Screen);
}

Would be nice if someone could give a little input. Thanks.

sentences:
How to rotate to a target position over time I know how to do rotations to vectors, but how do I rotate over time?

For instance say I made a function

RotateTo(vec2 iPosition, float iTime);

so it rotates to iPosition over iTime - how would this look? Does anyone know simple algorithm?

sentences: How do I disable texture filtering for sprite scaling in XNA 4.0? I have a sprite that I'm trying to scale up in XNA, but XNA is applying some sort of texture filtering that smooths it and makes it look ugly. I'd like it to just do pixel doubling instead of interpolation. How would I accomplish that?

sentences:
How can I rotate a bitmap without D3D or OpenGL? I've just figured out on my own how to scale a portion of a bitmap using PutPixel. I would like to know the mathematical theory behind rotating a bitmap on my own, using per-pixel operations like PutPixel.

I am not interested in using OpenGL or Direct3D to accomplish this, I'd like to know what the fundamental math and programming technique behind the operation is?

sentences:
3D 3-axes rotation into 3D 2-axes rotation Hello everyone and thanks in advance to anyone who'll help me through this !

I am currently working on the Kinect V2 (for XBox One) to interact with an avatar.
I'd like to use the rotation quaternion that the SDK 2.0 give for each joint of the Skeleton. My avatar (virtual avatar of NAO robot) communicates through nautical angles, yaw, ptich and roll. There's no problem to convert quaternions into nautical angles, but here's my problem :

Let's take the shoulder as an example of joint; Where the Kinect express the rotation of my shoulder as a 3-axes rotation, I need to convert it into a 2-axes rotation.

So for my shoulder I have a [Yaw, Pitch, Roll] from the Kinect, which I want to convert into a [Pitch, Roll] for NAO's avatar

At the beginning, I didn't see the problem; I just ignored the Yaw angle. But I rapidly noticed that the movement was not the same than in the Kinect (and it makes sense).

Can someone help me ? How can I convert a 3D 3-axes rotation into a 3D 2-axes rotation ?

sentences:
How to use continious collision detection in a dynamic AABB tree I am currently writing a game in c++ using openGL, and I am currently using a kinetic sweep and prune algorithm for the broad phase and then using GJK Raycast + GJK & EPA for the narrow phase. However I have realized that kinetic sweep and prune may not be the best choice because there are many objects in the scene that are just static and cause a lot of swapping when an object moves.
So basically I would like to implement a dynamic AABB tree for the broad phase knowing there will be only a few objects requiring continuous collision detection (but these objects are essential). However for these fast moving objects what is the best way to detect a possible collision with other objects in the broad phase? I am thinking about using an AABB that contains the object trajectory from one frame to another, is this a good idea? Or will this a lot of overhead due to many false positives?
Also I haven't read to much about dynamic AABB trees but I think I understand the idea, the idea is for each object that moved check if it's AABB if overlapping with the tree node, if it is do the same check with it's children and do so until we are at the leaves of the tree.
All help is greatly appreciated

sentences:
Perlin Noise unwanted artifacts I am trying to write a perlin noise class with c++ and sfml, but I am experiencing unwanted visual artifacts in the output. In the image, there are obvious lines being drawn between the points of the lattice:

The class template representing the noise is a specialization of lattice noise for vectors. The important function, GetValue() expects values between 0.0-1.0, representing the coordinates at which to get the value of the noise, which should also return a value between 0.0-1.0. Calling the function at (0, 0) should return the value at the top left corner. NormX and normY are the distance between lattice points x0-x1 and y0-y1, again in the range 0.0-1.0.

Before calculating the dot product, the distance vector from each corner lattice point is calculated instead of only using the distance from the top left corner. Because the final value at any point may be negative (-1.0 - 1.0), it is mapped to the range 0.0-1.0 by adding 1 and dividing by two before being returned.

template<>
inline float LatticeNoise2D<sf::Vector2f>::GetValue(float u, float v)
{
    float normX = u * resX_;
    int x0 = normX;
    int x1 = x0 + 1;
    normX -= x0;

    float normY = v * resY_;
    int y0 = normY;
    int y1 = y0 + 1;
    normY -= y0;

    float fadeX = Fade(normX);
    float fadeY = Fade(normY);

    sf::Vector2f dist(normX, normY);
    float dot0 = Dot(At(x0, y0), dist);
    dist = sf::Vector2f(1 - normX, normY);
    float dot1 = Dot(At(x1, y0), dist);
    float lerp0 = Lerp(dot0, dot1, fadeX);

    dist = sf::Vector2f(normX, 1 - normY);
    dot0 = Dot(At(x0, y1), dist);
    dist = sf::Vector2f(1 - normX, 1 - normY);
    dot1 = Dot(At(x1, y1), dist);
    float lerp1 = Lerp(dot0, dot1, fadeX);

    float value = Lerp(lerp0, lerp1, fadeY);
    return (value + 1) / 2;
}

The At(x, y) function returns the pre-generated vector on the lattice (a 2d std::vector) at the given index. The dimensions of the lattice in each dimension are resX_ and resY_, respectivley.

template<typename value_type>
inline value_type LatticeNoise2D<value_type>::At(int x, int y)
{
    return lattice_[x % resX_][y % resY_];
}

The vectors at each point on the lattice are generated on the unit circle by randomly choosing an angle in radians (0-2pi) and then calculating the x & Y components given that the length of their hypotenuse is 1.0.

template<>
inline sf::Vector2f LatticeNoise2D<sf::Vector2f>::Random()
{
    float pi = 4 * atan(1);
    float theta = static_cast<float>(rand()) / RAND_MAX * 2 * pi;
    return sf::Vector2f(cos(theta), sin(theta));
}

The Lerp() function performs linear interpolation, and the Dot() function calculates the dot product of two vectors. The Fade(t) function maps a value from 0.0-0.1 to an S Curve to be used in the Lerp function instead of just the linear distance between lattice points.

Why am I getting these lines between the points of the lattice, and how can I fix them? My goal is to make noise like this example:

sentences:
How do I draw a zoomable image in OpenGL? Up to now I have used glDrawPixels but since my image is a large geotiff one, I'm getting some horrible results for example:
this is the code used for zoom extent:

void COpenGLControl::ZoomFullExtent()
{
    GLint iViewport[4];
    glGetIntegerv(GL_VIEWPORT, iViewport);
    glPixelZoom((GLfloat) iViewport[2] / (GLfloat)width,
                (GLfloat) iViewport[3] / (GLfloat)height);
}

Since the image is a square one, it's not a good result.

This is the code used for zoom in:

void COpenGLControl::FixedZoomIn()
{
    glPixelZoom(2.0f, 2.0f);
}

but it does zoom in operation just one time and when I again click on the button the zoom in is not done I think it is because that when I call COpenGLControl::FixedZoomIn for an instance of the class COpenGLControl infact the openGL window is zoommed not the contents in it.

I have heard about texture mapping and how to zoom by changing z of the camera point.

How would I customize the class COpenGLControl for my purpose?

sentences:
Weird rendering of bounding box I'm trying to make a bounding rect for my bullet which is in space invader game.
I'm using marmalade, and the bounding rect seems translated and doesn't bound the bullet at all, however the math is correct.
Here is a video of the behavior and a snippet of code
http://youtu.be/SbjMPKQ7ilE

void Bullet::Render()
{
    if (ShipBullet == nullptr)
        return;

    if (Visible)
    {
        Transform.SetIdentity();

        // Build transform
        Transform.SetRot(Angle);
        Transform.ScaleRot(Scale);
        Transform.SetTrans(Position);
        Iw2DSetTransformMatrix(Transform);
        Iw2DSetColour(Colour);

        CIwFVec2 pos = Transform.t;
        BoundingRect.x = pos.x;
        BoundingRect.y = pos.y;
        BoundingRect.w = (float)ShipBullet->GetWidth();
        BoundingRect.h = (float)ShipBullet->GetHeight();

        // Render image
        if (ShipBullet != 0)
        {
            int x = -(ShipBullet->GetWidth() / 2);
            int y = -(ShipBullet->GetHeight() / 2);
            Iw2DDrawImage(ShipBullet, CIwFVec2(x, y), CIwFVec2(ShipBullet->GetWidth(), ShipBullet->GetHeight()));
        }

// render bounding rect
#if 1
        Iw2DSetColour(0xff0000ff); // Set red
        Iw2DDrawRect(CIwFVec2(BoundingRect.x, BoundingRect.y),
            CIwFVec2(ShipBullet->GetWidth(),ShipBullet->GetHeight()));
#endif

    }
}

sentences:
Does it make sense to use Lua scripting in a game developed in Python? Well for C++ written games using Lua scripts for easy changing ai, quets etc is very reasonable and it's common. However now I'm going to write a game in pure python and I don't know if I should use Lua. Python itself is very high level script language. However, there are things to consider why I could use lua scripts:

Lua is commonly used for game scripting and other people who will work with me know Lua and don't know python
Python module to embed lua code into python uses very fast JIT compiler so the lua code actually would be much faster than python code (big plus for AI)
It would separate the game engine itself (Python) from the scripted logic (Lua)

Do python games use Lua? Is it a resonable thing or I should just stick to pure python? I need some advice because I have no idea.

sentences:
Adding 'xna content project' reference to monogame project(visual studio 2013 pro)? I want to add reference to an xna content project. Which should be like the content project reference we have in an xna windows game. I am on visual studio 2013. I got the xna extensions to work by following this method.
  http://jaquadro.com/2013/11/migrating-monogame-projects-to-vs2013-and-windows-8-1/

But i dont see an option to add content reference in visual studio 2013. I searched everywhere and couldnt find an answer. Is this even possible? Or am i running in the wrong direction?

sentences:
Background Sprite Setting For my 2d game, I want to set background image. So that I am using multiple background images for that purpose.

But it can't set correctly on screen that illustrated in following image.

Also for setting background correctly, I am calculating camera orthographic size based current resolution and loading that sprite dynamically.

My camera inspector setting illustrated in following image.

My basic target is to display my background image in full screen without any bar. For example, If I have resolution of 600x1024 resolution and I am loading same resolution image then it should be display in full screen.

But you see that I can't able to get this result. So please some one help me to come out of this. If you want any more detail then I will provide at any time.

sentences: How do I determine the collision normal in an axis aligned bounding box collision? I have a 3d moving box and a stationary box.  I can detect collisions ok but now I would like to slide the moving box against the stationary box as a collision response.  For this I need the normal of the face that collides with the moving box.  Does anyone know how I figure this out?  It doesn't seem like the collision test gives me this information.  Any help is appreciated.

sentences:
ForceMode in AddTorque in Unity game development In UNITY game development platform while programming in C# I came across a method to add torque to component: public void AddTorque(float x, float y, float z, ForceMode mode = ForceMode.Force);
In this Function what is meant by ForceMode?

sentences:
How can I have a Mecanim animation with displacement and physics? I have 3D wolf models from my animator with displacement (i.e the wolf transforms with animation, not in-place). I have added rigid bodies to the models. I am facing following issues while executing them in my project:

When I turn on IsKinematic on my rigid body (i.e disable physics) the animations work perfectly, with displacement. But I need to have physics enabled on my wolf because it doesn't detect collision when physics is disabled and gravity doesn't have any impact.
When turn off IsKinematic (i.e enable physics), the animations don't work; the wolf start wobbling and flying in the air.

How can I resolve this?

sentences:
Color mapping of difference I have two arrays A and B. I want to do color mapping of their difference A - B. So far, I am doing this:

1) calculate d = A - B
2) find min / max in d
3) linear mapping of d from (min, max) to (0, 1)
4) convert (0, 1) to color

The problem is, that sometimes, there are noise values in my data. For example, several values in B are too large (like 100 times bigger than the rest) and it leads to enormous difference and increased min or max. After mapping to (0, 1) all other values are "wiped". How can I solve this?

sentences: Rendering one pixel using DirectX11 is it possible to render one pixel using DirectX 11? if its possible how to do it ?

sentences:
Portal 2 Authoring Tools: func_instance_io_proxy not working? I have a func_instance (which I made myself) of a door in my map. It is supposed to open when a cube is fizzled. I also put a checkmark indicator to make sure I had the cube's logic correct. When the cube is fizzled, the checkmark indicator lights up, but the door does not open. To make sure the door was working, I put a logic_auto into the prefab which opened the door when the map loaded. This worked correctly. I therefore think that there is something wrong with the func_instance_io_proxy, but I do not know what. Here are some screenshots:

The cube targets the openDoor relay's trigger input via the func_instance_io_proxy. It also targets the checkmark indicator, which properly lights up when the cube is fizzled.

My door func_instance. The relay on the left opens the door, and the one on the right closes it.

The logic_auto targets the closeDoor relay on startup, which does execute properly, as the door is closed when I go to test the map.

Finally, the func_instance_io_proxy targets the openDoor's trigger input. However, when I try and access it via the cube, it does not work, and the door does not open.

*By the way, I am running this on linux via wine, which is why it looks like windows 98

**Off-topic question, is this the right place to post this, since it is technically map making, not game development?

sentences:
Unity camera has no preview, and is not moving I have set up a camera in 2D mode. There is only one camera named "Main Camera", and it is set to "MainCamera" (tag). In console I can see camera's transform position updating, but it isn't moving. And if I adjust field of view for perspective mode, it doesn't take effect.

That is saying, when I hit "Play", the game view is always fixed. In inspector there is no camera preview neither (see image 2).

The only effect I can make to camera is changing the background color.

EDIT:

Main camera is placed right at root. And the camera is supposed to be looking at a small area:

EDIT:

Thanks for DMGreygory pointing out, I'm using default canvas settings and this won't move with camera in play mode. (btw, if not best under canvas, where exactly is suggested to apply those graphics?)

sentences:
How to implement Core War's .X modifier I'm trying to write an implementation of Core War for an exercise. I'm stuck with the implementation of the X modifier. This is the definition (all quotes from https://corewar.co.uk/standards/icws94.htm):
 Instruction execution proceeds with the A-value set to both the
 A-number and B-number of the A-instruction (in that order) and the
 B-value set to both the B-number and A-number of the B-instruction
 (in that order).  A write to to core replaces both the B-number and
 the A-number of the instruction pointed to by the B-pointer (in that
 order).

Now the implementation of non-division operations in the spec is:
case X:
          Core[((PC + WPB) % M)].BNumber = (IRB.ANumber op IRA.BNumber) % M;
          Core[((PC + WPB) % M)].ANumber = (IRB.BNumber op IRA.ANumber) % M;
          break;

While for division operations (DIV and MOD) is:
case X:
          if (IRA.ANumber != 0)
             Core[((PC + WPB) % M)].BNumber = IRB.BNumber op IRA.ANumber;
          if (IRA.BNumber != 0)
             Core[((PC + WPB) % M)].ANumber = IRB.ANumber op IRA.BNumber;
          if ((IRA.ANumber == 0) || (IRA.BNumber == 0))
             goto noqueue;
          break;

Given the definition, the division operations seem to be implemented correctly, while the other doesn't seem to follow the spec. I'd expect non-division operations to use this implementation:
case X:
          Core[((PC + WPB) % M)].BNumber = (IRB.BNumber op IRA.ANumber) % M;
          Core[((PC + WPB) % M)].ANumber = (IRB.ANumber op IRA.BNumber) % M;
          break;

Am I missing something?

sentences:
How can I use a data grid to make an isometric turn based game in GameMaker? I am making a Hero Quest clone. It is a turn based adventure game with an isometric view point. So far I have been able to turn a 2D map into an isometric view but I believe I need to use a data grid to achieve turn based movement, combat etc.

There are plenty of tutorials on data grids but none that I can find on how to translate a 2D grid to a psedo-3D isometric game.

How could I do it?

sentences:
Unity third person controller and hills So I've been building a game and using the out of the box unity third person controller demo stuff.

I found that even the tiniest of slopes seems to stop the "dude" dead in his tracks.

Is there an easy way to adjust the sensitivity on the scripts somewhere?

I tried messing with the sensitivity options in the input options setup thinking that it might help but it didn't and I don't really want to go messing about in the scripts unless I really have to because i end up complicating my life when I do that.

sentences:
How to create fun and interactive menus with cocos2d? Possible Duplicate:
  How to make animated buttons in a menu with Cocos2d?

How do I make fun and interactive menus with cocos2d, all the tutorials are just for simple clickable menus. Can any one help me learn this?

It would be see the menu flip or slide away, I know you can do this with scenes but how do I make this with just the menu?

Let's say the menu is a bunch of cards and I want them to flip over like the sub-menu is on the backside of the card, how would I do this?

Or, make the Main menu slide in from the left, right, top or bottom side and then when a button is selected it slides away the same way and switch to a sub-menu (settings, Score etc)?

Anyone?

David

sentences:
How to rotate a direction I'm working a spotlight for my deferred renderer and I'm having trouble with matching the mesh to the visual representation of the light. Right now my mesh is a cone, the apex of the cone is at (0,0,0), it has a height of 1 and a radius of 1. The direction of this cone is (0,-1,0) when the rotation is (0,0,0).

The relevant GLSL code:

float spot_alpha = dot(-l,normalize(vec3(0,-1,0) )); // <------
float inner_alpha = cos(light.falloff);
float outer_alpha = cos(light.radius);
float spot = clamp((spot_alpha - outer_alpha) / (inner_alpha - outer_alpha),0.,1.);

As you can see, the GLSL code uses a direction to define the area to be lit, so I could get this direction as a uniform, but I would need to find a rotation from that for the mesh to follow, or I can get the rotation and find a direction, but I don't know how to do either of these things.

Can I rotate a direction? How do I do it? If I can't, is there another solution for this problem?

sentences:
Buffer System For Items I am going to reference this image of what I want to accomplish in JavaScript.

This is the Diablo buffer system.  This question may be a bit advanced (or possibly not even allowed).  But I was wondering how you might go about implementing this type of system in a JavaScript game.  Currently to implement such a system in JavaScript escapes me, and I am turning to SO to get some suggestions, ideas, and hopefully some insight in how I could accomplish this without being to costly on the CPU.

Some thoughts of mine for implementing such a system would be to:

Create DIVS within a DIV that hold each position of the inventory
Go through each item you own in a container and see which DIV it belongs to
Make said item images the DIVs image

This type of system might possibly work if ALL items were 1x1, but for this example its not going to work out.

I am at a complete lost of ideas how to even accomplish this.  Although, maybe rendering directly to the canvas and checking mouse cords could work, there would more than likely be A HUGE annoyance when checking if other items are overlapping each other (meaning you cant place the item down, and possibly switching item with the cursor item ).

That said, what am I left with?  Do I need to makeshift my own hack system with messy code, or is there some source out there (that I don't know about) that has replicated this type of system in their own game.

I would be very grateful to get some replies on how you might go about doing this, and will accept answers that can logically explain how you might implement such a system (code is not required).

P.S. Id like to use pure JavaScript, and nothing else (even though it might be "reinventing the wheel", I also like to learn).

sentences:
XNA - Making 2D Hexagons Connect With Each Other I'm working on a top-down 2D strategy game in XNA, and the tiles are hexagons. I can't have a grid because of the game mechanics, so everything has its own location, and every tile object is stored in a list. What I'm trying to do is have it so that if you place a tile close to the side of another tile, they will snap together and become one object. I can't seem to figure out how to get what side it should snap to.

The red represents the different sections I want to check for mouse clicks in (these would of course not be an actual texture in the game). The white represents the area where if you clicked, it wouldn't allow you to place a tile because it would be on top of another. The closest thing I can think of is to have a larger hexagon around the actual tile that's divided into triangles from the center to the edges, but I'm not sure how to do this.

And I'm gonna move it to Windows Phone with Monogame and I don't think the phone is fast enough to make some sort of thing that checks colors for each sector, so I don't think it can be texture based. I feel like there's some kind of relatively simple math to do this but I can't seem to figure it out.

sentences:
XNA When to call LoadContent I have an enum in my game that denotes the game state ie MainMenu, InGame, GameOver, Exit
and I was wondering if it would be advisable to add a new one in for PrepGame - in which the game creates viewports for however many players there are, creates the battlefield etc.

I feel like this is a good idea except for one thing: should I make a call back to LoadContent() in this state? I could just put a switch statement in the LoadContent for my currentGameState. If it equals PrepGame load things like the skybox, ship models, texures, HUD graphics etc. Or is it a good idea to create an Asset Manager class in the first call to LoadContent() and load everything then.

I feel like both approaches have different benefits: faster, but more load times vs slower initial load time, but then all my objects are referencing the same variables so I only have to load each on once.

Any help is greatly appreciated.

Thanks,
Peter

sentences:
No intellisense on my classes I've been using Monodevelop's current version and Unity 4.
I don't get intellisense on the classes I've created but I do have intellisense on classes that are in Unity's framework. Bug or its just as it is?

I use UnityScript:

class SomeClass extends ScriptableObject{
    public function Test(){return "";}
}

In another class, when I use a variable typed as this class I get no intellisense.

sentences:
Learning OpenGL 3.3 on OpenGL 2.1 machine? I am going to learn OpenGL 3.3 instead of OpenGL 2.1 because many model of OpenGL 2.1 is deprecated (base on this information). It's pity that my "old friend" only support OpenGL 2.1.

Base on this article at learnopengl.com I found that from OpenGL 2.1 to OpenGL 3.3 is a huge jump of Khronos Group and I will receive error if I run OpenGL 3.3 function on OpenGL 2.1 machine.

1) Is it possible to learn OpenGL 3.3 on OpenGL 2.1 machine?

2) Relate to this question 7 years ago, is learning OpenGL 2.1 useless today?

Thank you!

sentences:
Why is everything lit by default? I am following the unity tutorial here and when i drag my environment into the Hierarchy everything i already lit up on my Game view, i noticed this was also the case in the Space Shooter tutorial that i followed before this but i ignored it. Does Unity5 automatically light up things for you if you don't have any lights? I tried setting the ambient Intensity to zero but it literally changes nothing. When i drag in the lighting prefab it also doesn't seem to do much because the scene was already lit up somewhat.

It is still dark but it isn't pitch black like it should be in the Game view.

sentences:
Obscure primitive data types against cheating im trying to create lightweight value obscurer, against possibility to blatantly change primitive values in memory editor. Such as cheat engine. Here's what i have to far.

/// <summary>
/// Obscure for type int.
/// </summary>
public class ObscuredInt{

    public ObscuredInt() {
        this.value = 0;
    }

    public ObscuredInt(int value) {
        this.value = value;
    }

    private int _a;
    private int _b;

    /// <summary>
    /// Current obscure value.
    /// </summary>
    public int value {
        get {
            return _a + _b;
        }
        set {
            _a = Random.Range(int.MinValue, int.MaxValue);
            _b = value - _a;
        }
    }
}

usage

ObscuredInt health = new ObscuredInt(5);
health.value = 10;

printInConsle(health.value);

This works by simply never storing actual value, but rather a combination of two integers, which sum represents the value. That way the value is actually never cached long time in the memory. So finding it in a primitive way using cheat engine is not possible.

My question

I've seen other examples of obscuring, which involve conversion to binary or string hashing or other quite heavy operations.

This example is of course much more lightweight, how is this example worse than more advanced hashing or conversions. What flaws do you see with this example? What can you suggest?

Thank you

sentences:
Change Text - Inside A button, inside a Canvas, inside a GameObject: Access all the texts inside of hierchy? //....
Gameobject tile;
int count = 1f;
float posX = 0;
float posY = 0;
....//

GameObject blueTile = (GameObject)Instantiate(Resources.Load("block_blue"));
tile = (GameObject)Instantiate(blueTile, transform);

for loop {
   ...
   ...
   tile.GetComponent().GetComponentInChildren().text = count.ToString();
   tile.transform.position = new Vector2((float)posX, (float)posY);
   count++;
}

As you can see by the image.
My line of thinking goes like this; I used to create Flash/AS3 Applications and Games. I have used a number of API's and they usually have a lot in common. Unity, however, is very different and I may have not grasped the key concepts.

I want to access my PreFab, named in Assets/Resources (the root path)

"block_blue"

All I wan to do is set up a row and columns of a box with a number inside of it.

Before you go and ask, why the complicated mix of Objects? Well, Adobe had MovieClip and use of layers and also use of a timeline. Unity doesn't seem to have this in setting up a Scene (the Stage in Flash).

So, I set up a block that looks like this (right of main image 66):
It's a Canvas, to hold a Button, the button has a text. To move the Canvas, I put the Canvas inside a GameObject. This, to me, is like a MovieClip in Flash API.

**GameObject > ButtonLight, Button > TextBlack, Text**

I need to access TextBlack and also Text. Pretty easy right? I've been at this for 4 days, many many hours.

EDIT: It seems that it is working, somewhat.

Looking at the reference photo and the Hierarchy reference, it looks like the blackText behind the blueText is changing as expected. But I cannot access the top BlueText. The Blue Text is also a child of type Text, but it's a second (layer?) copy of the text inside of the Button. So, it's getting the first Child Text, but how to access the second Text?

sentences:
Help With Rotating Turret and Muzzle Flare Sprites I am making a top down game that involved tanks rotating their turrets and firing at other tanks.

I have the turrets rotating independently of the tank itself about the center. However, I am now trying to rotate a muzzle flare sprite animation around with the turret.

I am struggling with keeping the muzzle flare at the end of the barrel when the turret rotates.

Here is the two sprites lined up at position (0, 0):

And here is the position I would like the muzzle flare to be at:

The problem is, the muzzle flare does not maintain the offset (45, 8) when the turret rotates.

I have tried using the equations:

x2 = x * cos(theta) - y * sin(theta)

y2 = x * sin(theta) + y * cos(theta)

Where x = 45 and y = 8.

But I have had no luck.

Where is my math wrong?

sentences:
Proper vertex buffer use How're you supposed to use vertex buffers?

Say you have 500 distinct deformable shapes/models in the world (ie you want to be able to change/delete vertices from the models somewhat arbitraily as the game progresses).  The requires you refresh the vertex buffers in the frames the model has become dirty, at least.

So how should you handle your vertex buffer, assuming D3D11 interfaces (so vertex buffers are your only option to draw anything):

Store model vertices in CPU RAM.  Create one vertex buffer at program start. For each model, copy the vertices into the single vertex buffer, render
Create 500 vertex buffers, update each when necessary, render.

sentences:
How to orient a surface normal to a cubic surface The immediate question is: in HLSL, how can I orient a surface normal generated in UV space so that I can apply it to a cube face?

The overall project is that I'm trying to build a procedural planet generator.  I'm using a cube projected to a sphere where each face is a quad-tree.  The intermediate project is that I want to generate a normal map for the terrain.  I think the best way for me to do this (and understand what I'm doing) is to generate the normals for the cube version first, then work out the transformations to warp those normals to the sphere.

Ideally the method would not involve branching code based on which face I'm working on (i.e., if we're on the top side of the cube, then U = X and V = Y).  In other words, what I'm hoping for is some math-magic like "Oh, just cross multiply the terrain normal by the dot product of the cube face normal and blah blah blah".

9/20/10 ETA:

I know how to calculate normals for a flat surface.  My subsequent problem is two-fold:

How do I rotate the normal map so it is oriented correctly on each of the cube faces?
how do I warp the flat normal map so that it wraps the sphere?

I've found one solution that uses a Jacobian matrix, but I can't get it to work.  Even when all of the normals are pointing straight up (i.e. a flat surface), the HLSL code involving the Jacobian totally messes up the lighting--so it makes me not trust my implementation of the solution.

sentences: Is there a way to make GUI.SelectionGrid expand horizontally I am working on an inventory system, And I want to be able to make a Selection Gird that expands horizontally rather than vertically, is there an easy way to do this? Or will I have to create my own version of SelectionGrid?

sentences:
Shader - Transmittance or Absorption I am trying to create a transmittance or absorption shader (glsl, hlsl, cg, etc...) in realtime but I don't find any good tutorial or white paper about this subject. I only find offline rendering references.

Is it possible to achieve this kind of effect in realtime using standard rasterisation of a 3D mesh ? How ?

sentences:
libGDX collision detection / bounding the object I am trying to implement collision detection so I am drawing a red rectangle to see if it is working. When I put the code below into the update method to check if it is going to work the position is not in the right place. The red rectangle starts from the middle and not at the x and y point? So it draws it wrong.

I also have a getter method so nothing wrong there.

bullet.set(getX(), getY(), getOriginX(), getOriginY());

this is for the render

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
shapeRenderer.rect(bullet.getX(), bullet.getY(), bullet.getOriginX(), bullet.getOriginY(), 15, 5, bullet.getRotation());
shapeRenderer.end();

I have tried to do it with a circle but the circle draws in the middle and I want it to be at the tip of the bullet. At the front of the bullet. x, y point.

boundingCircle.set(getX() + getOriginX(), getY() + getOriginY(), 4.0f);

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
shapeRenderer.circle(bullet.getBoundingCircle().x, bullet.getBoundingCircle().y, bullet.getBoundingCircle().radius);
shapeRenderer.end();

I need it to be of the x and y as the bullet is in the middle of the sprite when drawn originally via paint.

sentences:
What data structure to use for the map in Pac-Man? I am trying to make a Pac-Man game in C# using GDI+. I have done some basic work and I have previously replicated games like Copter-It and Minesweeper, but I am confused about how I can implement the map in Pac-Man. I mean: which data structure to use, so I can use it for moving AI controlled objects and check collisions with walls.

I thought of a 2D array of ints but that didn't make sense to me. Looking for some help.

sentences:
Why does my collision detection code cause my framerate to drop? I have this code:

foreach (CollisionTiles tile in map.CollisionTiles)
{
  player.CollisionBox(tile);
  foreach (Enemy enemy in enemys)
    enemy.CollisionBox(tile);
}

This is the CollisionBox() function:

public void CollisionBox(CollisionTiles tile)
{
  int x = rectangle.X / Map.Size;
  int y = rectangle.Y / Map.Size;
  int tileX = (int)tile.Position.X;
  int tileY = (int)tile.Position.Y;

  if (tileX >= x - 1 && tileX <= x + 2 && tileY >= y - 1 && tileY <= y + 3)
  {
    Collision(tile.Rectangle, Map.Width, Map.Height);
    tile.Collide = true;
  }
}

These two lines appear to be the problem:

 int x = rectangle.X / Map.Size;
 int y = rectangle.Y / Map.Size;

I guess because it loops through them on every tile...

The Collision() function just check the face's of the two triangles (both player/enemy and the tiles) with these functions:

 public static bool TouchTopOf(this Rectangle r1, Rectangle r2)
 {
   return (r1.Bottom >= r2.Top && r1.Bottom <= r2.Top + (r2.Height / 2));
 }

public static bool TouchBottomOf(this Rectangle r1, Rectangle r2)
{
  return (r1.Top >= r2.Bottom - (r2.Height / 2));
}

  public static bool TouchLeftOf(this Rectangle r1, Rectangle r2)
  {
  return (r1.Top <= r2.Bottom - (r2.Height / 2) &&
          r1.Bottom >= r2.Top + (r2.Height / 2) &&
          r1.Right >= r2.Left &&
          r1.Right <= r2.Left + (r2.Width / 4));
  }

  public static bool TouchRightOf(this Rectangle r1, Rectangle r2)
  {
    return (r1.Top <= r2.Bottom - (r2.Height / 2) &&
            r1.Bottom >= r2.Top + (r2.Height / 2) &&
            r1.Left >= r2.Right - (r2.Width / 4) &&
            r1.Left <= r2.Right);
  }

When there is more then one monster with the player I get a massive FPSdrop, and it's getting worse when more monsters get added. What should I do to fix that problem?

sentences:
Getting positions of static entities in a Tiled Map I'm creating a 2D game that uses a Tiled Map with an underlying 2D array to store where entities are in the world. At the moment, I'm just creating one instance of an entity, assigning it a number, and storing that in the array to determine what entity is at what position in the array/world. However, this is presenting some issues. The most prevalent being getting the position of an entity from the entity object, because there is only one object being used throughout the whole world.

Would it just be easier to have non-static entities and populate the array with many instances of the entity object or is there a simple way I could get the position of an entity on the tile map through the object?

sentences:
Why does OpenGL >= 3 only allow VBOs? I see that OpenGL versions 3 and up eliminate the use of client-side rendering. Immediate mode has been eliminated, and vertex arrays seem to be deprecated. Instead, if I understand correctly, VBOs are the main way of rendering vertices.

While I see the logic behind having a uniform way of rendering everything, is it the case that VBOs have no major downsides over vertex arrays? I thought VBOs were supposed to be large buffers containing > 1MB of data, generally. What if I have a scene that has a lot of smaller geometry? I have a scene graph with a large number of nodes, each of which needs its own transform, etc. Each node should also be able to be deleted separately, added to separately, etc. I was using vertex arrays before. So my first question is whether, if I switch to VBOs, there will be a greater overhead to my scene graph objects now because a VBO needs to be allocated for each object.

Another concern is that the geometry I'm rendering can be highly dynamic. In the worst case, there may be times when all geometry needs to be resent every frame for some period of time. Will VBOs have worse performance than vertex arrays in this use case, or do VBOs at worst do just as much work as vertex arrays but no more?

So, in more concise format, my questions are:

1) Is there a substantial overhead to allocating / deallocating VBOs (I mean the mere act of setting up a buffer)?

2) If I'm updating the data from the CPU every frame, can this be substantially worse than if I had used vertex arrays?

And finally, I'd like to know:

3) If the answer to either of the above questions is "yes", why deprecate other modes of rendering that could have advantages over VBOs? Is there something I'm missing here, like techniques I'm supposed to use to mitigate some of these potential allocation costs, etc.?

4) Do the answers to any of these questions change substantially depending on what OpenGL version I'm using? If I refactor my code to be OpenGL 3 or 4 forward-compatible by using VBOs in a way that is performant, will the same techniques be likely to perform well with OpenGL 2, or is it likely that certain techniques are much faster with OpenGL 3+ and others with OpenGL 2?

I asked this question on stack overflow, but I am re-posting here because I realized this site may be more appropriate for my question.

sentences:
Rubik's cube array rotation I'm about to make a 3D Rubik's cube based game in Flash AS3 and Away3d.

I don't really know how to manage the 2D arrays of the Rubik's cube.

For example, how do I rotate the corresponding arrays if I rotate a side, or just rotate a middle part?

In this stage I also don't know how to rotate those smaller cube parts all together if a side is rotating. First I was thinking of "groups" ( like in sketchup or 3ds max, blender), but that would be tricky, because the group components would change every time.

So I was thinking of just rotating each individual piece along a global axis. However, I just know the Away3d functions to rotate the cube of his local X , Y or Z axis, but how to rotate in global axis?

Does anyone know of a algorithm for doing these types of rotations?

sentences:
Does scaling affect performance in OpenGL? I've never been able to understand the best practice in this context. I usually want to ship my game with as minimum size as possible. So whereever possible, I try to use scaling of my graphics. Let's suppose I have to draw a 1000 X 300 px wall of yellow color in my game. So I usually just use a 3 X 3 px yellow image and stretch it in game (using nearest neighbor filter). Is this the right approach?

Let us consider another situation. Let's suppose I wish to render rain in my game. Basically 2 X 30 px blue white gradient streaks . Let us suppose at any time 200 drops max are going to be rendered . Now if I just ship a 2 X 6 px streak with the game and scale it at runtime , will it affect performance?

In short, how does scaling affect performance in OpenGL?

sentences:
How to make a 'Picture-book Cutscene' in Unity 2D with simple 2D images? I'm trying to implement a simple cutscene system in my Unity game, preferably one that allows cutscenes to play at the start and end of each of the levels.

What I was imagining was pretty similar to A Hat in Time's 'storybooks' from it's time rifts, but full-screen and advanced with a single key. The images are simple and comic-like, and I was wondering how to implement such a feature since it feels like it's a bit different to Unity's pre-existing Timeline system, as there isn't many moving parts.

How do I go about approaching this problem? At least, I don't know how to get the project to a state where a person can press a key to turn to the next page (whether or not there's a visual transition to the next is optional) and once it's done, to start the actual level/scene. Do I still use the Timeline for this? I know I could potentially use an empty game management prefab in order to set up when to play the cutscenes, however.

sentences: How to emulate PSX's graphics with OpenGL? I want to know what options (or shaders) to set so that my OpenGL game looks like Playstation 1 game. I know it probably can not be achieved 100 % because PSX used television and television renders differently that monitor. Thanks. :)

sentences:
How to draw 2d road similiar to Outrun, Lotus, Pitstop, Cisco Heat games? * UPDATED 23/05/2018 *

I've managed to implement road generation and curves using the techniques described here

I made a short gameplay video.

Hope it helps to anybody looking for answers.

sentences: Is a programmer liable for copyright infringement in other people's mods to his games? If a programmer (P) releases a game, and a modder (M) releases a game modification which includes copyrighted content, can P be held liable for the copyright infringement in the mod?

sentences:
What is a good university for computer science and game development? I am starting my computer science degree at a local community college in programming using C++. However, I will be transferring to a 4-year university. Does anyone have any insight on university programs?

I know Cal State Fullerton has a degree with a minor in Game Development. however, is that as important as getting a degree from a really great school? If I could shoot for something like Cal Poly would that be better? Or even Stanford or SF State being so close to so many gaming companies up there in the Bay area?

sentences:
Build a view frustum from angles I have 4 angles, left, right, top & bottom. These angles are in degrees. They define the angle between the forward vector and the corresponding side. I am trying to use these to calculate the required values for Perseective Off Centre function found here http://docs.unity3d.com/Documentation/ScriptReference/Camera-projectionMatrix.html
I tried doing
 (near plane-far plane) * Tan(angle)
But that didn't give the correct results.

sentences:
Smoothing long paths with splines What is the best way to smooth a long path with splines?
I first implemented a Bezier curve but then realised that I would have to join a lot of them.

I used A* on a weighted grid so I can't use Theta or other any angle algorithms stuff.

I basically would like to achieve the light blue path on the following picture (credit to Amit), but on much longer paths:

How do game programmers do?

sentences:
What is the necessary know-how to write an animation library (IK & FK)? 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++.

sentences:
Octree Frustrum Culling times came when i had to implement some culling into my engine. I started by reading some stuff and so far so good. I managed to create an octree which can effectivly divide my geometry's vertices (per mesh)  into an octree. But here i have some Questions:

Currently i am using immediate mode to test if the culling works. And it does work, i am recursivly traversing the tree's nodes and testing against the node's bounding box if the frustum intersects with it. Repeat untill leaf is found and render that leaf's geometry (with immediate mode for testing) But now i would like to use VBO/VAO's to render the geometry in the leaves and here i see two options:
- 1.Each time the i traverse the tree push the leaves that intersect with the frustrum into a list then get the vertices out of them and construct a VBO and send it to be rendered.
- 2.Pre build a VBO for each leaf then just rebind for each visible leaf and render.

Anyway, which is the better option rebuilding a new vbo each time the frustum changes, or just rebinding multiple vbos (which is also expensive).
Also is this even the right approach , maybe i am missing something.

bool view_Culling(CFrustum& frusrum, COctree *node)
{
if (!node)
    return false;

if (frusrum.CubeInFrustum(node->GetCenter().x, node->GetCenter().y, node-       >GetCenter().z,(node->GetWidth()/2.0f)))
{
    if (node->IsSubDivided())
    {
        view_Culling(frusrum, node->OctreeNodes()[TOP_LEFT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_LEFT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_RIGHT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[TOP_RIGHT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_LEFT_FRONT]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_LEFT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_RIGHT_BACK]);
        view_Culling(frusrum, node->OctreeNodes()[BOTTOM_RIGHT_FRONT]);
    }
    else
    {
        //use prebuilded vbo here
        //or push these vertices here in a list later build a dynamic vbo
        //from them
        node->DrawOctree(node);
        return true;
    }
}
return false;
}

sentences:
Infinite world floor grid shader I am trying to render an infinite world floor grid, similar to this question.
My project is using SceneKit with Metal Shading Language but the concepts are no doubt similar between GLSL/HLSL.
Here is an example project where I attempt to render a plane as a full screen quad with the grid lines drawn using a fragment shader.
Full shader code can be found here.

Grid Rendering
A simple vertex shader sets the position and grid coordinate for the plane:
f.position = scn_node.modelViewProjectionTransform * float4(v.position, 1.0);
f.ij = v.position.xy;

The fragment shader then determines which color to render the grid or floor:
fragment half4 floor_fragment(FragmentIn f [[stage_in]]) {

    float2 fractional  = abs(fract(f.ij; + 0.5));
    float2 partial = fwidth(f.ij;);

    float2 point = smoothstep(-partial, partial, fractional);

    float saturation = 1.0 - saturate(point.x * point.y);

    return half4(mix(backgroundColor.rgb, gridColor.rgb, saturation), 1.0);
}

I then remove any MVP transforms and simply set the vertex position as is in clip space to fill the screen. This does have the intended effect of filling the screen but mangles the grid lines.
//inside floor_vertex()
f.position = float4(v.position, 1.0);
f.coordinate = v.position.xy;

Ray Casting
As suggested in the comments, the fragment position should be projected into world space and intersected with the floor plane to find a new vector on the plane. I have an intersect(plane:ray) method returns a hit with a distance and a point on the plane or otherwise false if the ray is orthogonal to the plane.
It is my understanding that by multiplying the position in clip space with the inverseViewProjectionTransform the result will be in camera space. The plane is also converted to camera space with the modelViewTransform and I then test my ray against this which appears to work but with incorrect results.

fragment half4 floor_fragment(Fragment f [[stage_in]], constant SCNSceneBuffer& scn_frame [[buffer(0)]], constant NodeBuffer& scn_node [[buffer(1)]]) {

    //f.ij is in the vertex position in clip space (-1, -1) to (1, 1)

    //convert position into camera space
    float4 position = (scn_frame.inverseViewProjectionTransform * float4(f.ij.x, f.ij.y, 0.0, 1.0));

    //create ray from camera with direction
    Ray ray = Ray { .origin = float3(0.0), .direction = normalize(position.xyz) };

    //convert floor plane from world space to camera space
    float3 worldFloor = (scn_node.modelViewTransform * float4(float3(0.0, -5.0, 0.0), 1.0)).xyz;

    //hit test ray against floor plane
    Plane plane = Plane { .position = worldFloor, .normal = float3(0.0, 1.0, 0.0) };

    RayHitTest hitTest = intersect(plane, ray);

    if(!hitTest.hit) {

        return f.backgroundColor;
    }

    //grab xz values to determine floor fragment color
    float2 uv = hitTest.vector.xz;

    float2 fractional  = abs(fract(uv + 0.5));
    float2 partial = fwidth(uv);

    float2 point = smoothstep(-partial, partial, fractional);

    float saturation = 1.0 - saturate(point.x * point.y);

    return half4(mix(f.backgroundColor.rgb, f.gridColor.rgb, saturation), 1.0);
}

This video shows the final results where you can see that the grid is not correctly aligned with the world axis. The floor plane is positioned at 0.0, -5.0, 0.0 and the rectangle at 0.0, -4.5, 0.0 which should be aligned with each other but this is not the case. It looks to me that the perspective is off as the grid seems much larger than is should be.
Can anyone please point out the obvious mistake(s) I am making?

sentences:
Why does Unity think my RectTransform has changed? I am working with UI.  I want to know when my RectTransform changes its position.  I am using transform.hasChanged:

void Update()
{
    if (transform.hasChanged)
    {
        Debug.Log("Updated Position");
        transform.hasChanged = false;
    }
}

However, it thinks it has always changed.  "Updated Position" is constantly printing out.  If I remove and then readd the component while in play mode, the issue resolves itself.  However, I don't want to have to do this, as it is very hacky.

I could just throw a bunch of if statements in there to check, but I'd prefer to make use of the build in transform.hasChanged property.

How can I check to see if my RectTransform has changed its position efficiently and elegantly?

sentences:
Bullet Physics Scaling rotational part of 6DoF Spring Damper I am currently trying to scale up my setup (consisting of two rigid bodies connected by a btGeneric6DofSpring2Constraint) to fall within the suggested dimensions for a concise simulation.

In order to do so, I followed to the provided Wiki http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Scaling_The_World.

I scaled all the linear properties and concerning the resulting forces, everything turned out physically consistent.
Note that I did not scale up the liner and angular stiffness and damping values.

However I encountered significant deviations concerning the spring-related torques resulting due to a angular spring offset. I guess that this issue arises due to the fact that the torques should be scaled (*scale^2) as well. However I do not see a way of scaling the internal torque representation of the btGeneric6DofSpring2Constraint. Should i simply scale up the angular spring stiffness and spring damping by a factor (*scale^2) or is there a better more elegant way to retrieve physically consistent results (forces, torques, motion) when trying to scale a world containing the btGeneric6DofSpring2Constraint?

EDIT:
I was able to boil it down to the following:

The rotational stiffness and damping vales are chosen independent from the scale.

The stiffness itself does not alter the behavior of the system. The deviations are caused entirely by the damping part. An experiment with altering the scale and non-existent damping showed results independent from the scaling factor, just as desired (K_stiff = 20.0, K_damp = 0.0):.
]

However when repeating the same experiment with no stiffness and a positive damping factor, significant differences arise when scaling up. (K_stiff = 0.0, K_damp = 9.0): The image denotes the system responses for different scales.

I found the corresponding code snippet in

        btScalar fs = ks * error * dt;
    btScalar fd = -kd * (vel) * (rotational ? -1 : 1) * dt;
    btScalar f = (fs+fd);

    info->m_constraintError[srow] = (vel + f * (rotational ? -1 : 1)) ;

    btScalar minf = f < fd ? f : fd;
    btScalar maxf = f < fd ? fd : f;

    //printf("%.3lf\n",f);
    if(!rotational)
    {
        info->m_lowerLimit[srow] = minf > 0 ? 0 : minf;
        info->m_upperLimit[srow] = maxf < 0 ? 0 : maxf;
    }
    else
    {
        info->m_lowerLimit[srow] = -maxf > 0 ? 0 : -maxf;
        info->m_upperLimit[srow] = -minf < 0 ? 0 : -minf;
    }

    info->cfm[srow] = cfm;
    srow += info->rowskip;
    ++count;
}

Interestingly, the scaling works just fine if the if clause is commented out. Any sugestions why this happens?

sentences: How can I render extremely large models? I'm trying to build a game in Unity similar to the game Kerbal Space Program where there are large celestial bodies that the player can orbit. I'm running into a few problems though. My first issue is that the larger I make a sphere, the slower the game gets. Secondly, whenever the sphere exceeds a certain size, the rendering engine cuts off part of the planet, which means I can only see half the model. How can I do this at the size that KSP has?

sentences:
Keeping Aspect Screen Ratio While Stays in Center I sqw and I tried this suggestion on *PISTACHIO BRAINSTORMIN** on how to make a good and adaptive screen ration. For every different screen size, let's say I put the perfect circle as a Texture in LibGDX and played it on screen. Here's the blueberry image example and it's perfectly rounded:

When I played it on the Google Nexus 7, the circle turn into a slightly oblonng shape, resembling as it was being flatten a bit. Please observe this snapshot below and you can see the blueberry is almost but slightly not perfectly rounded:

Now, when I tried the suggested code for aspect ratio, the perfect circle retained but another problem is occured. The problem is that I expecting for a view on center but instead it's been moved to the right offset leaving with a half black screen. This would be look like this:

Here is my code using the suggested screen aspect ratio code:

Class' Field

// Ingredients Needed for Screen Aspect Ratio
private static final int VIRTUAL_WIDTH = 720;
private static final int VIRTUAL_HEIGHT = 1280;
private static final float ASPECT_RATIO = ((float) VIRTUAL_WIDTH)/((float) VIRTUAL_HEIGHT);
private Camera Mother_Camera;
private Rectangle Viewport;

render()

    // Camera updating...
    Mother_Camera.update();
    Mother_Camera.apply(Gdx.gl10);

    // Reseting viewport...
    Gdx.gl.glViewport((int) Viewport.x, (int) Viewport.y, (int) Viewport.width, (int) Viewport.height);

    // Clear previous frame.
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

show()

        Mother_Camera = new OrthographicCamera(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);

Was this code useful for screen aspect ratio-proportion fixing or it is statically dependent on actual device's width and height?

**see http://blog.acamara.es/2012/02/05/keep-screen-aspect-ratio-with-different-resolutions-using-libgdx/#comment-317*

sentences:
Are there technical reasons to use short variable names in shader code? I have been reading and writing both GLSL and CG for the past few years, and have noticed a trend. In programming, we are generally advised to be as meaningful and concise as possible with variable names, but I see this suggestion being ignored almost every time I look at shaders.

Here is a random example I grabbed off of Shadertoy:

vec3 tex_wmcs(vec2 p)
{
    float s=mix(0.2,1.2,sqrt(smoothNoise2(p*3.0)));
    vec3 col=mix(vec3(0.15,0.2,0.2)*0.4,vec3(0.2,0.15,0.11)*0.7*s,sqrt(max(0.0,sm...
    vec2 p2=p*vec2(4.0,10.0)+vec2(smoothNoise2(p*24.0),smoothNoise2...
    p2.x+=floor(p2.y)*0.5;
    float bh=pow(0.5+0.5*cos(floor(p2.y)*14.0)*cos(floor(p2.x)*1.0),2.0);
    float brick=brickt(p2);
    vec3 bn=normalize(vec3(brickt(p2+vec2(1e-3,0.0))-brick,b...
    ...
}

Is there a practical reason so many graphics programmers minify their code to such a point?

Is there a technical downside to spelling out brickNormal instead of leaving it as bn, or using brick_tangent or brickTexture instead of brickt?

sentences:
C++ Ray Traversing in 3D Voxel game I'm currently working on a Voxel game in 3D and need a tad bit of help to figure out what Voxel the player is looking at. This is the data I currently have:

GRRLIB_Camera3dSettings(Player.x, Player.y, Player.z + 4, 0,0,1, Player.x + Camera.lookx,Player.y + Camera.looky,Player.z + Camera.lookz);

And the two 3d arrays that contains the player cords and block cords:

struct Player{
  int X;
  int Y;
  int Z;
}
int World[X_MAX][Y_MAX][Z_MAX];
//The cords are ALWAYS positive. ( and the array data: 0 Means air, anything higher is solid), The player

(GRRLIB camera is described here: http://grrlib.santo.fr/doc/group___all_func.html#ga7300940a38526ab5aa9be0f4abe4a32a)

So what I basically need to understand is how I would implement ray tracing using this data.
The whole project can be found here: https://github.com/filfat/WiiCraft

For clarification I am asking for a simple way in C or C++ to create a Ray tracing algorithm that would be used in a Minecraft like game for selecting the block the player is looking at, all data that is needed is above. So in short I need help to understand the math in a Ray Tracing algorithm and need a simple example so I could implement it myself.

Thanks! :)

sentences:
Help me to fine tune my diamond-square algorithm Check this map i generated:

I seeded a sine wave to act as a mountain range. The lower portion of the sine wave looks fine, but the upper side is thin, the algorithm did not do its magic there (expanding with some noise the seeded values to generate wider mountain ranges and then some hills (brown and light brown)).

Also, the whole continent shape is not affected by the sine wave. Ideally, it should be like a "S" as the mountain range pretends to be.

I bet this is how the diamond square algorithm takes the values it uses to make the average.

If not seed the center point of the map,  i can not generate a continent, it just makes a pelinesque noise of random hills.

Basically, i'm having some hard time trying to control the noise with seeds and toying with amplitude and randomness reduction values.

I need some experienced people in world generation and noise to help me out!

Thanks!

(PS: red dots are rivers).

sentences:
Is the Microsoft recommendation to use C# properties applicable to game development? I get that sometimes you need properties, like:

public int[] Transitions { get; set; }

or:

[SerializeField] private int[] m_Transitions;
public int[] Transitions { get { return m_Transitions; } set { m_Transitions = value; } }

But my impression is that in game development, unless you have a reason to do otherwise, everything should be nearly as fast as possible. My impression from things I've read is that Unity 3D is not sure to inline access via properties, so using a property will result in an extra function call.

Am I right to constantly ignore Visual Studio's suggestions to not use public fields? (Note that we do use int Foo { get; private set; } where there is an advantage in showing the intended usage.)

I'm aware that premature optimization is bad, but as I said, in game development you don't make something slow when a similar effort could make it fast.

sentences:
Add singleton to an existing gameobject in Unity via script I did notice that if I assign scripts that generate singleton classes (for my managers), to an empty game object, everything works fine.

Now I would like to start the scene with the empty game object, attach the main game manager singleton, and in the game manager singleton I would like to attach to it the other manager singleton classes.

Although I am not sure how you actually do so. Do you run addComponent to the main game manager, and they will be attached to the existing gameobject?

The gameobject that I use for the main gamemanager is set to not be destroyed on load; the doubt is if I should run addComponent on the scripts, or create a reference from the gamemanager script and instantiate it from there.

I did look for examples on the subject, but the only thing that I found is the reference to add a script to a game object; and I am not sure if that's actually what is supposed to be done.

sentences:
Find your value between four values in a grid based on distance, Unity Please note: Originally posted in stack overflow, redirected due to nature of problem.

I am making a procedural mesh game. I am trying to calculate the temperature for the player's current chunk by getting nearby temperature values and interpolating.

The way this works is, let's say we are at world space 95, 0, 65 (x,y,z). What I do is:

1) generate, using perlin noise, temperature values for every 20 squares (smartly generated to only do so to the 4 squares most relevant to us at any given time). We will get the points: 80, 0, 60 100, 0, 60 80, 0, 80 100, 0, 80

Each of these points is fed into a perlin noise generator and spits out a number. That number is the temperature.

So, in order to make the climate smoothly transition, I need to figure out how to get the distance each point weighted against its temperature so I can calculate the temperature of the space I am standing in.

If there is a name for this (there must be, I'm essentially sampling a gradient made by four points) and a way to do it, please just link that instead.

I tried taking the distance from my point to each point and multiplying that number against the temperature at that point, but I'm not sure if that's a correct first step, or what to do from there (just average the four resulting numbers?!).

sentences: How do I store game data with cookies? Im working on a game right now, but I was wondering how I would store the game data in cookies(in javascript) where you can load it up, and resume the last spot you were at. I was looking at some other websites like w3schools, but I didn't really understand it

sentences:
What maths should I learn for game programming, and what aspect of programming does it relate to? Possible Duplicate:
  What math should all game programmers know?

Obviously a good knowledge of maths is essential for good programming, my maths isn’t the best ( I didn’t pay attention in school all those years ago) so, in order to get one step closer to being the best I need some advice. What maths should I learn for specific areas of game programming?
If someone could outline some subjects and say one or two words about what areas of game programming they would be used in I’d greatly appreciate it. I’m working through the Khan academy programme at the moment, and I’m just getting into algebra now.

sentences:
Backing up non-text based assets I'm using a Source Control Management tool (git) for backing up configurations, code etc. But how do I manage art assets and other game assets that are in binary formats, and tend to be big (animators, audio sources etc)?

The working theory is to backup all assets using cloud storage services like Google Drive or similar. But how do you effectively manage your projects? That would work for me being solo, but if I added another team member, how would I effectively manage projects while multiple developers/artists are contributing?

I'm working with Unity, if it's relevant.

sentences:
How to create a tile map texture in Oxygine? I started playing around with Oxygine and Ogmo last night when I stumbled upon this GitHub that read in the Ogmo level.

I ended up fixing the doRender method as it did not work (could just be due to it being an old version of Ogmo or something):

void OgmoLevel::doRender(const RenderState& rs) {
    auto tileLayers = this->tileLayers;
    Sprite sprite;
    for (size_t layerIndex = 0; layerIndex < tileLayers.size(); ++layerIndex) {
        auto tileLayer = &tileLayers.at(layerIndex);

        auto resAnim = project->resource->getResAnim(tileLayer->tileset->name);
        resAnim->getFrame(0).getDiffuse().base->setLinearFilter(false);

        sprite.setResAnim(resAnim);

        int gridXSize = tileLayer->definition->gridWidth;
        int gridYSize = tileLayer->definition->gridHeight;

        size_t columns = roomWidth / gridXSize;
        size_t rows = roomHeight / gridYSize;

        auto tiles = &tileLayer->tiles;
        size_t tilesSize = tiles->size();

        size_t i = 0;
        float yy = 0;
        for (size_t y = 0; y < rows; ++y) {
            float xx = 0;
            for (size_t x = 0; x < columns; ++x) {
                int tileID = tiles->at(i);
                if (tileID != OGMO_BLANK_TILE)
                {
                    int tWidth = tileLayer->tileset->tileWidth;

                    int actualRow = (tileID * tWidth / tWidth) / tWidth;
                    int actualColumn = (tileID - (actualRow * tWidth));

                    sprite.setColumnRow(actualColumn, actualRow);
                    sprite.setPosition(xx, yy);
                    sprite.render(rs);
                }

                xx += tileLayer->definition->gridWidth;
                ++i;
            }
            yy += tileLayer->definition->gridHeight;
        }
    }
}

The issue I see with this, is that the same exact rendering is happening every single frame. Normally for the tile maps, there are checks to determine whether or not the tile is on the screen. Now that is fine and all, but this time around, I know it is fully static 99% of the time and I want to render it to a texture and just continue to render that.

I've looked at the MemoryTexture and ImageData classes, but there wasn't really anything online I could find to tell me how to properly use them. Does anyone have any idea how I can achieve caching this?

(not enough rep to create proper tags)

sentences:
Best way to handle realtime melee AI in authoritative network environment So i've been working on a multiplayer game for a bit; it's a co-op action RPG with real-time combat. If you've seen or played TERA, I'd say it's comparable to that, but not an MMO, heh.
I'm currently handling the AI units authoritatively, the server calculates their pathing, movement, and pursue/attack logic, and syncs the movement to the clients 15x per second, and the state changes when they happen.

When I emulate 200ms ping, though, the client can perceive being out of range to an AI's attack, but still take the hit, because on the server he hadn't moved that far yet. This also plays hell with my real-time blocking.

I don't really want to allow the clients to be allowed to say "that was out of range" or "I blocked that", but I'm not really sure how else to handle it.

sentences:
Is it possible to rent a server for my own game? I'm an independent game developer and I don't yet have a lot of money to buy myself a very cool high-speed and low-latency internet connection along with a powerful server machine to place somewhere in the world to host my very own game's server application for my fans to play on.

I know it's possible to rent a server for an existing popular game (for example, Team Fortress 2), but how about renting a server for my own game that I'm developing? Are there services specifically for that, or should I just rent some general purpose something and go from there?

Such a server should be:

Easy to update
With a low-latency for a specific region (I'm planning on renting EU and US servers)

sentences:
Using Unity's `transform.translate()` to translate relative to an object but only using two axis I'm using transform.translate() to move an object around the world space, relative to the camera that is following it. The camera has an angle of 23 degrees on the X axis.

The problem is that when I move forward the object tries to go into the ground and when going backward the object starts jumping because of the angle of the camera. What I want to do is freeze the Y axis of the object However if I did this the object would no longer be able to jump.

The other solution to this would be to write a method which rests the object to the ground when not jumping but them if the object was jumping and going backwards it would go flying backwards again.

How do I solve this issue?

sentences:
How to calculate the estimated time of arrival and control signal between two quaternion? I'm trying to wrap my head around a control algorithm for a space game. If the user sets a target rotation I want to get a ETA counter and show the engine output. The only input to the system is a max delta angular velocity around the space ship local axis.

I uses Unity engine so I ave access to the quaternion of the rotation and global angular velocity. I can find the delta rotation between the two points as it's dQ = Qstart^-1*Qtarget (from Qstart*dQ=Qtarget).

But how Do I find the engine parameter at that frame and what is the ETA?

sentences: How do I link a GameObject activated state to a UI button being held? How do I go about this functionality: When a user taps and still holds onto a UI button, a GameObject will be set active, when they release the UI button, the GameObject will be deactivated.

sentences:
Stop rotating when select the game object by mouse input I am new to Unity and I am confused about how to solve this problem. Initially, I want to make a platform rotate to its center vector up like this.

transform.Rotate (Vector3.up, speed * Time.deltaTime);

Then, I want to stop it from rotating when the mouse select it, like:

Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast (ray, out hit)){
  //find a way to stop rotate
}

I cannot figure out how to stop it from rotating. Can anyone help me, please?

sentences:
Player with navmeshagent keeps moving back to the last mouse position clicked On my FPSController I have two scripts, Player Controller and Agent Controller.

Player Controller is for using the keys WSAD for moving the player around.

Agent Controller uses a NavMeshAgent to move the player to a position clicked with the mouse (like point and click ).

Everything is working fine, or was working fine until I tried to move the player around using the keys WSAD after clicking the mouse.

I clicked the mouse on the ground (terrain) or on a cube no matter what I clicked on and the player is moving to this position. Now at that position the player stops. Now I'm trying to move the player with the keys WSAD, but even if I click on S for example long time the and player is far away from the last mouse clicked position when I leave the S key the player automatically moves back to the mouse clicked position.

The player should stay at where I move him with the keys WSAD but he keeps moving back to the last clicked mouse position.

On the FPSController I have a Rigidbody and NavMeshAgent and the two scripts Player Controller and Agent Controller.

The original Agent Controller script was:

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

public class AgentController : MonoBehaviour
{
    public Camera camera;
    public NavMeshAgent agent;
    public bool agentControl = false;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update ()
    {
     if (Input.GetMouseButtonDown(0) && agentControl == true)
        {
            Ray ray = camera.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                agent.SetDestination(hit.point);
            }
        }
    }
}

And the Player Controller script:

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

public class PlayerController : MonoBehaviour
{
    public float speed = 10.0f;

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        float translatioin = Input.GetAxis("Vertical") * speed;
        float straffe = Input.GetAxis("Horizontal") * speed;
        translatioin *= Time.deltaTime;
        straffe *= Time.deltaTime;

        transform.Translate(straffe, 0, translatioin);

        if (Input.GetKeyDown("escape"))
            Cursor.lockState = CursorLockMode.None;
    }
}

The main goal is to use either the Agent Controller for point and click with the navmeshagent or using the keys WSAD to move around.

sentences:
Should I make my games graphics lower quality so everyone can play it? The game I'm working on targets lower end graphics capabilities machine users.

Should I make my game's graphics lower quality so that everyone can play it or make its graphics high quality so that people must go and buy a new GPU to play it?

sentences:
Why has the industry switched from C to C++? First of all i would like to have a real answer, i'm always trying to get more from various sources and articles, and when I read things like C++ is slow because it has virtual functions and because of this C is better, i really don't know what to say and think as an human being with a brain. So please avoid to reach this level in your answer/s.

My question is about a massive switch to C++ that was completed, more or less, with Doom 3.

The interesting thing for me is that before this milestone, most of the game engines and the games itself were written in C, just like it was since the Quake era. It's also interesting to note that the ID software decide to completely rewrite the codebase for the IdTech 4 in C++, a massive amount of work that honestly i can't understand without a really good list of reasons.

I'm focusing on Doom 3 because I am mainly interested in the OpenGL world and in my journey i try to stay focused on this topic, so i read a lot about this, but i think that a question like that can be render-API-agnostic without too much problems.

Why at a certain point in time the industry switched massively to C++ ? What are the reasons for the choice that ID made ?

The last thing that i would like to say is that the C language is much more simple to implement and provides a less number of features, because of this has much less chance to be "fragmented" in pieces unlike the C++ really often does. In simplest terms i have much more chances to find a really good C compiler rather than a good C++ compiler with all the features implemented in a good way.

For example the NDK for Android still doesn't have a good C++ support ( with the r8b release ) with all the latest and greatest features, and it's the native toolkit for the most popular mobile OS in the world!

If I had wrote my code in a modern C++ I would probably be in pain now because one of the most popular OS in the world would be off-limits for me. And like Android, many other compilers are not that great.

I should write C++ code referring to a C++ version that is 2-3 release old ?

sentences:
2d Tile Based Collision Response Right now I am trying to make a 2d collision response system for a platformer, and the algorithm I have for it works quite well. The only problem is that if the player is standing exactly on a tile, he cannot move. I think this is related to the fact that the manager is checking if he is colliding on the X axis, instead of the Y Axis.

I have thought of making one big AABB for a check, using all applicable tiles, but I feel as if there is a simpler way. I don't really understand normals, so I have not tried anything with them yet.

Right now, I am getting the centers of both objects, the distance inbetween them, and the minimum distance between them, returning the overlap. And then applying the overlap to the players position. It looks like this

sf::Vector2f centerA(
  AABBFirst.left + (AABBFirst.width  / 2),
  AABBFirst.top  + (AABBFirst.height / 2));
sf::Vector2f centerB(
  AABBSecond.left + (AABBSecond.width  / 2),
  AABBSecond.top  + (AABBSecond.height / 2));

sf::Vector2f distance(centerA.x - centerB.x, centerA.y - centerB.y);
sf::Vector2f minDistance(
  (AABBFirst.width  / 2) + (AABBSecond.width  / 2),
  (AABBFirst.height / 2) + (AABBSecond.height / 2));

return sf::Vector2f(
  distance.x > 0 ? minDistance.x - distance.x : -minDistance.x - distance.x,
  distance.y > 0 ? minDistance.y - distance.y : -minDistance.y - distance.y);

I apologize if this question has already been asked and answered before, I have not found the proper terms to search for.

sentences:
Unity IVRRenderModels_006 SteamVR Error I get this Error in Unity when I imported SteamVR :
"Failed to Load IVRRenderModels Interface Version IVRRenderModels_006"
I looked after on it but nothing really solved the problem.
Why is this happening and what could be the solution?

sentences:
How can I scroll my tile maps? I've been trying to understand how I can use matrix to implement a smooth tile scrolling system but I fail miserably.

So I have a pretty big world stored in a multi-dimensional array which is drawn like this :

 for (int i = 0; i < screenHeight / 32; i++)
            for (int j = 0; j < screenWidth  / 32; j++)
               spriteBatch.Draw( texture[i + offsetY][j + offsetX] , screenRectangle[i + offsetY][j + offsetX] , Color.White );

Can somebody give me some tips on what to do or at least explain the logic behind the matrix translation?
Thank you.

sentences:
Restrict A* pathfinding to overlapping "safe zones" within map I've been bashing my head against this idea for a few days without luck, I'm hoping someone sees something I don't.
So I have a 2D map containing walls and obstacles, and I have a unit that navigates through it (A* and funnel algorithm). So far so good. Now, for gameplay purposes, I need to limit the movement of this unit to circular safe zones that I can place on the map. Think of them like cell towers, the unit has to stay within range of at least one tower, with the max range dictated by the tower (possibly different for each tower). Effectively, imagine drawing a set of interlocking circles over the map, and the unit must remain within that.
Now for the complicated part. The map is a constrained Delaunay triangulation, not a grid, so the triangles that A* is using can vary in size and shape. With a grid, I could imagine limiting individual grid cells by circle distances, but in my case these triangles could be larger than any one circle. There could even be cases where the start and end points of a path are within the same triangle, but because of the network of circles, an indirect path would have to be chosen to stay within the circles.
The only option I can think of involves adding these circles into the triangulation as additional edges, altering the map. This would mean rebuilding the map triangulation each time a player adds or removes these circles, and would require that I maintain a separate copy of that triangulation per player. And since these circles don't care about map walls, I'd have to alter my triangulation method to allow edge splitting and removal, to prevent overlapping lines from rendering the triangulation invalid.
I feel like there has to be another way to do this. I've considered:

Running A* purely on the circles first, then placing that intermediate path on the map and re-pathing it to avoid obstacles.
Finding all of the circle intersections between the start and end points, and treat those lines as portals that I must pass through, somehow altering the A* pathing to prioritize passing through them.
Performing a regular path search on the triangulation, but forcing a dead-end whenever entering a triangle that is too far from a circle. Then refining that path to conform to the circles themselves.

Each of these have issues, or scenarios where they fall apart.
Has this been done before? Any input on how this might possibly be achieved would be appreciated.
Edit: Adding an image to show what I'm trying to accomplish. The red lines show the path that A* would generate using just the map triangulation. The green lines show the desired path, taking the circle bounds into account.

sentences:
Particle System in XNA - cannot draw particle I'm trying to implement a simple particle system in my XNA project. I'm going by RB Whitaker's tutorial, and it seems simple enough. I'm trying to draw particles within my menu screen. Below I've included the code which I think is applicable.

I'm coming up with one error in my build, and it is stating that I need to create a new instance of the EmitterLocation from the particleEngine. When I hover over  particleEngine.EmitterLocation = new Vector2(Mouse.GetState().X,      Mouse.GetState().Y); it states that particleEngine is returning a null value. What could be causing this?

/// <summary>
/// Base class for screens that contain a menu of options. The user can
/// move up and down to select an entry, or cancel to back out of the screen.
/// </summary>
abstract class MenuScreen : GameScreen

    ParticleEngine particleEngine;

    public void LoadContent(ContentManager content)
    {
        if (content == null)
        {
            content = new ContentManager(ScreenManager.Game.Services, "Content");
        }
        base.LoadContent();
        List<Texture2D> textures = new List<Texture2D>();
        textures.Add(content.Load<Texture2D>(@"gfx/circle"));
        textures.Add(content.Load<Texture2D>(@"gfx/star"));
        textures.Add(content.Load<Texture2D>(@"gfx/diamond"));
        particleEngine = new ParticleEngine(textures, new Vector2(400, 240));

    }

    public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                   bool coveredByOtherScreen)
    {
        base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

        // Update each nested MenuEntry object.
        for (int i = 0; i < menuEntries.Count; i++)
        {
            bool isSelected = IsActive && (i == selectedEntry);

            menuEntries[i].Update(this, isSelected, gameTime);
        }

        particleEngine.EmitterLocation = new Vector2(Mouse.GetState().X,      Mouse.GetState().Y);

        particleEngine.Update();
    }

    public override void Draw(GameTime gameTime)
    {
        // make sure our entries are in the right place before we draw them
        UpdateMenuEntryLocations();

        GraphicsDevice graphics = ScreenManager.GraphicsDevice;
        SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
        SpriteFont font = ScreenManager.Font;

        spriteBatch.Begin();

       // Draw stuff logic

       spriteBatch.End();
       particleEngine.Draw(spriteBatch);

    }

sentences:
Is it a good idea to use high-level API's in order to develop game engines? I have been looking around the internet finding articles that talk about what you should learn to develop a game engine. Something that I keep hearing in many articles is that you should learn low-level graphics API's such as OpenGL or D3D11 (great article for example: https://www.haroldserrano.com/blog/how-to-become-a-game-engine-developer) for graphics rendering for instance.

NOTE: I will be using graphics rendering as an example for my question since it makes the most sense to me here.

This got me thinking. Is it really necessary to re-invent the wheel by creating your own framework for just rendering graphics? Isn't it sufficient to learn a library like babylon.js for graphics rendering on the web? If the main goal of creating a game engine is to lay a software framework to build video games, then spending time on developing an entire framework for graphics shouldn't be an issue if others have solved the problem for you via their graphics libraries.

sentences:
Semi-transparent mouse cursor on Windows I want to change the mouse cursor for a desktop game I am writing with libGDX. That is working well under Linux, however, under Windows semi-transparent cursor pixels are not being rendered at all. That means I am unable to anti-alias the cursor image.

For sure there must be a way to render semi-transparent mouse cursors under Windows, like it's possible under Linux. Any ideas what I could do to solve this issue?

sentences:
How can I efficiently resize sprites every frame? I want to animate UI elements, like HP bars, by moving and resizing them. How can I efficiently resize sprites every frame?

I am using the LibGDX framework.

sentences:
Component / Entity-based design => no inheritance at all? [I understand that this this could be seen as a rather theoretical question, but I think it has real-application impact].

"Academic" base
With a component-based design one wants to get rid of the long inheritance chains known in larger games ("deadly diamond of death"). So we create a BaseComponent class that handles all the administrative chores (ID and type handling, possibly a generic list of properties, ...).

Now each actual Componentshould inherit from that base [start of academic/dogmatic flair] and only that base [end].

Concrete situation/example:
Assume I have three components with different attributes:

Person: age, name, gender, isTired, isSick, ...
Guest: satisfaction, desires, ...
Employee: current duty, shift end, ...

Now in traditional OOP design, Person would act as the base class for the other two. As I currently "forbid" that type of inheritance for the components in my project, everytime I am e.g. processing my employees and checking/updating their state attributes I have to either use some helper function to access the sibling component Person (if it exists) or send a message out that hopefully Person will be registered for and will process. Or I can simply assume that each Guest and Employee always will have the component Person. But then I might as well let those two components inherit from Person, so they for example both have the member functions to manipulate some specific properties.

Note: There will never be an Entity that has the component Employee, but not component Person (same applies to Guest). They are a fix requirement, which is why I am considering inheritance here at all.

Question:
My question is now whether anyone can see any real-life problems that would be introduced by (re-)incorporating a bit of inheritance into my components other than to a degree violating the original base/dogmatic concept and the risk that (if used excessively) I would end up with the exact same problem the component-based design tried to solve in the first place?

References:
Thread that ultimately led my to asking that question, showing such inheritance.

sentences:
How do I get line numbers in a unity headless server's stack trace? For some reason Unity 5 doesn't allow me to do a developement build of a headless server, and this is quite a problem when debugging, since I get stack traces without line numbers, such as:

NullReferenceException: Object reference not set to an instance of an object
  at ClientServer.Update () [0x00000] in <filename unknown>:0

Trying the xvfb trick to run a pseudo-headless server, which doesn't prevent enabling debugging symbols, doesn't work (it crashes mono for some reason).

I'm really at a loss on how to debug an headless server… is there something I'm missing?

sentences:
Loading a vertex shader compiled by Visual Studio 2012 I've got an extremely simple vertex shader that Visual Studio 2012 compiles into a .cso file. Now I want to load this file and create a vertex shader on the graphics device using the ID3D11Device::CreateVertexShader function.

So far I have the following code:

ifstream vs_stream;
size_t vs_size;
char* vs_data;

vs_stream.open(vsCompiledPath, ifstream::in | ifstream::binary);
if(vs_stream.good())
{
    vs_stream.seekg(0, ios::end);
    vs_size = size_t(vs_stream.tellg());
    vs_data = new char[vs_size];
    vs_stream.seekg(0, ios::beg);
    vs_stream.read(&vs_data[0], vs_size);
    vs_stream.close();

    result = device->CreateVertexShader(&vs_data, vs_size, 0, &m_vertexShader);
    if(FAILED(result))
    {
        return false;
    }
}
else
{
    return false;
}

I seem to be able to load the file fine, I get sane values in vs_size and vs_data however CreateVertexShader returns E_INVALIDARG and sets m_vertexShader to null.

How can I fix this error?

note that I can't use anything in the d3dx* headers since they are not supported in the Windows 8 App store

sentences:
Unity free look camera on two axes. How do I do it? I'm new to Unity and c# but have programming experience...  I have a a simple "game" in Unity that shows one sphere orbiting another.  How do I allow the camera to be moved by the user in a "free look" dynamic?  I want to be able to press the right mouse button and adjust the camera on two axes. I'm using Unity 5.0. Whenever I run the following Unity freezes when I press the right mouse button.

Here's the camera control script:

using UnityEngine;
using System.Collections;

public class CameraControl : MonoBehaviour
{
     private float horizontalSpeed;
     private float verticalSpeed;

     void Update ()
     {
           while (Input.GetMouseButtonDown(1))
           {
                 horizontalSpeed = Input.GetAxis ("Mouse Y");
                 verticalSpeed = Input.GetAxis ("Mouse X");
                 transform.Translate(verticalSpeed,horizontalSpeed,0.0f);
           }
     }
}

sentences:
Question about designing and controlling a forklift's forks I am building a forklift for a game that I am working and I am trying to come up with a valid way of designing it. So far I haven't really liked the way it behaves in game The forklift has three parts to it

Wheels
Main body: Has a rigid body component
Forks : Has a rigid body component and a configurable joint where the connected body is the main body(2).

The movement is perfectly fine but its forks behaviour that is a bit troublesome. I am trying to make it move as a whole with the main body but it appears as if it is trying to detach itself when I hit another rigidbody in the scene(link goes to a screen cast I made of the problem in action). I have adjusted the drag and angular drag parameters of both the main body and the forks, adjusted the linear and rotational configurable joint parameters and yet this problem constantly occurs. According to an answer found on the official unity forums, I shouldn't parent two rigidbodies together. I am thinking about setting the fork as a purely kinematic rigidbody and updating its position every frame. Does anyone else have any other ideas?

sentences:
How do you cope mentally with one very long piece of work This is my first games industry job and my task is to take out one major game component and put in a newer one.

So far it's been 5 weeks, and I'm still just staring at errors. I think it could be months before it's at the point that it can compile. It's really getting me down. I'm just changing things over, I'm not really writing anything myself. it's just endless. I fix a thousand errors and nine thousand take their place.

I'm sure this must be a common thing, so I was just wondering, how do you cope with this? It doesn't seem like I can break it down into little chunks at all.

sentences:
Unity ball not bouncing off wall correctly I have been making a brick breaker game in Unity in 2D as my first game. I have got the ball bouncing off the paddle correctly and can bounce it of the paddle at different angles. However, when the ball hits a wall or the roof it always bounces so its either traveling exactly in the X-directon or Y-direction regardless of what angle it hits the wall with instead of bouncing off at 90'.

Im not using any scripts to control the bouncing off the walls or roof just using  2D box colliders on the roof and walls (which are cubes) and a circle collider and 2D rigidbody on the ball (sphere) which Ive given a bouncy material.

Any help would be really appreciated.

Here's a gif of the problem: http://imgur.com/a/YJyNH

sentences:
Is there a way to read a picture pixel by pixel in unity without any distortions In my unity project I have an image file which contains information. I would like to be able to read this .bmp file pixel by pixel. So I tried simply loading a sprite, and then reading its texture. However when I do that, the loaded texture appears to be different than the image I'm using, as if it was compressed. I tried modifying the asset settings (making it an advanced texture with point filter mode, and setting format to argb32bit uncompressed) but it doesn't help. Any ideas?

EDIT: Some additional information,

The code with which I load the image into a pixel array

// sprites from which paths will be loaded
public Sprite[] path_maps;
// Color 24 array which contains the texture bitmap
private Color32[] pixels;
// graph with paths
public Graph[] graphs;

void Start () {
    // I skipped some  code that doesn't matter to the problem

    // go through all path maps
    for (int i = 0; i < path_maps.Length; i++) {
        // load sprite into pixels array
        pixels = path_maps[i].texture.GetPixels32 ();
        // create new graph
        graphs [i] = new Graph ();
        // get graph from path map
        graphs[i].pixels_to_graph(pixels, path_maps[i].texture.width, path_maps[i].texture.height, camera_width, camera_height);
    }

}

The function which reads pixels and creates node for each colored pixel (only relevant part of the function)

public void pixels_to_graph (Color32[] pixels, int width, int height, double camera_width, double camera_height)
{
    // assign pixels width and height
    pixels_width = width;
    pixels_height = height;
    // assign camera dimensions
    this.camera_width = camera_width;
    this.camera_height = camera_height;
    // First create as many nodes as there are colored pixels (simply read the pixel map)
    // Note that pixel map contains the bitmap from bottom to the top (left bottom to top right)
    // create nodes array
    pixel_nodes = new Node[width*height];
    // current position in pixel array. Made for easier calculations
    int carriage = 0;
    // go through all rows
    for (int i = 0; i < height; i++) {
        // go column by column
        for (int j = 0; j < width; j++) {
            // if it's transparent or white - ignore
            if (pixels [carriage].a == 0 || pixels [carriage].Equals (col_white))
                continue;
            // else add node to the node array
            pixel_nodes [carriage] = new Node (j, i, pixels_width, pixels_height, camera_width, camera_height); // note that i is the y position while j is the x position
            // add node to nodes list
            nodes.Add (pixel_nodes [carriage]);
            carriage++;
        }
    }

I detect the problem in the above pixels_to_graph function. When I debug it with a 1680x1050 image, that has pixels in its bottom left corner (three black squares with 1 pixel distance between them, of size 3x3px, 2x2px, 1x1px) it only detects the 3x3 one, the colour value at position of the other 2 squares is white. When I tried other shapes I also discovered other distortions, some 1px wide lines are not there, as well as single pixels.

My current texture settings (though note I tried different options but some of them don't display anything, this one at least displays something):

sentences:
Are there drawbacks to resizing mesh renderer bounds? I had a problem yesterday where some of the meshes were not visible. I figured out the problem, which was that the mesh renderer bounds were not in the cameras field of view.
So, in order to make the mashes visible, I'm thinking of either making the bounds of the mesh renderer larger, or moving them forward so they are in the camera view.
If I do this, are there any drawbacks, like potential glitches, problems, more strain on the system, etc that might happen?

sentences:
Uncover Physics Object to Pick it Up I want to be able to have physics objects semi-buried in leaves, dirt, or whatever and be able to have the player click on the area a couple times to uncover them, and he can't pick it up until he has uncovered it.  (He picks it up also by LMB.)
How can I achieve this?  I am using blueprints.  Can anyone show me how?

sentences:
How can I compute the common points when spheres intersect? When two spheres intersect they should share one or two points. I want to know how to compute those points?

I was thinking of something like this:

-check if the spheres intersect
-calculate radius_1 distance from center_1 in the direction of center_2
-calculate radius_2 distance from center_2 in the direction of center_1
-substract the smaller to the larger and have that one as "collision" point

This sounds to me a little too tricky, I wanted to know if there is a simplier way to achieve this?

sentences: how to make the capsule move during anims I'm trying to make a cartwheel/ dodge to the side in ue4 but when the animation plays it moves out of the capsule and slides back. Is there a way to make the capsule move with the character in the animation.

sentences:
How can I find the tangent and normal at an interpolated point on a Catmull-Rom/Hermite spline? I have an implementation of a simple Catmull-Rom spline. It works, but I'm trying my hardest to be able to place vertices at extrusions along the curve. For this I need the normal (and tangent in the process) to be able to find the correct locations off of the curve. I cannot find any information anywhere, at least nothing that I can understand, on how to quickly calculate the tangent for a given t value on the curve. I've tried to do the derivative myself but I quickly realized I had no idea what I was doing.

How can I find the derivative/tangent/normal for a point at a t value on a Catmull-Rom spline?

Just to be extra clear, here is an incredibly rough picture of what I need.

I need to sample a point at a location along the curve and find an orthogonal vector, represented here by the blue lines. At the end of the blue lines I will place vertices. I have a working implementation of this already but it is for a bezier curve.

sentences:
LibGDX “EXCEPTION_ACCESS_VIOLATION” error when recreating previously disposed Box2DLights light I just installed the Box2DLights dependency for LibGDX and I added a cave with 2 ConeLights inside. The first time I render the cave, everything works as expected. Then when I exit the cave, I make sure to dispose() all the lights. Then if I enter the cave again and try to create the same 2 ConeLights, it gives me this exception with a big error log (PasteBin added at the bottom of this post). If I don't dispose() the lights when exiting the cave, it won't crash the second time, but it will keep adding lights and it will get brighter and brighter and it's bad for performance. It doesn't matter if I use a PointLight or a ConeLight, the same exception will occur.

Everytime a map change occurs, destroyLighting() and then loadLighting() for the new map is called. The error happens when a ConeLight is created, the second time when you enter the cave (4th line in the loadLighting() method)

loadLighting():

for(MapObject o : lightingObjects) {
      EllipseMapObject circleMapObject = (EllipseMapObject) o;
      Ellipse ellipse = circleMapObject.getEllipse();
      Light light = new ConeLight(rayHandler, 60, new Color(255,225,166,1), 100, ellipse.x, ellipse.y, 90, 90);
      light.setSoftnessLength(0);
      lights.add(light);
}

destroyLighting():

for(Light light : lights) light.dispose();
lights.clear();

The error log:
https://pastebin.com/1v36aNPg

sentences:
Finding equivalent axial coordinates for a wrapping hexagonal map of radius n I'm creating a wrap around hexagonal map that will potentially render infinatly.

With the method I'm using, I have an x-y coordinate I use to find it's equivalent axial coordinate with the equations:
Q = (sqrt(3)/3 * x - 1./3 * y) / hexSize;
R = (2./3 * y) / hexSize;
the problem is, my map is of radius n and it's possible for the Q R coordinate to be far outside that radius. How can I find the equivalent Q-R coordinate within the radius n? I know methods for a single radius outside, but I'm talking the potential of having a radius of 15 but a Q-R something like (9999999,99999999). What would that coordinate be in relation to the center of the 15 radius hex region it'd be in?

sentences:
Game Physics: Calculating a collision response using the Separating Axis Theorem? I am working on a project in which I have implemented the Separating Axis Theorem to detect collisions between objects. My current collision response is an object that contains whether it is overlapping and what the minimum translation vector (MTV) is.

I then take the MTV and add it to the linear velocity of the object we're testing. This all works fine. However, I want to add rotational forces to the object based on the collision. For this, I imagine we will need two things:

The Minimum Translation Vector, which represents the force
A contact point, which is the point at which the MTV-force gets applied to the object

However, I have been struggling with calculating the contact point for the past two/three days. I haven't been able to find good resources on this, unfortunately.

How would I go about calculating a suitable collision response as I described? Thank you very much!

sentences:
Unity 5.5 and Parse 1.7.0 on iOS 64-bit We are using Unity 5.5 and Parse 1.7.0 (and Firebase for notifications) which doesn't have "Parse.Unity.dll" and while on Editor everything is working fine but when we build using "IL2CPP" on iOS; while running on device the game produces an error of "MissingMethodException: No constructor found for Parse.Common.Internal.FlexibleListWrapper`2".

I think it's because of stripping, I've tried to include "Parse.Core" and "Parse.Common" in "link.xml" but still same error while I was looking for solutions I found that there's a file "Parse.Unity.dll" that should have been in the project from the start but when I try to include it in our project another error but this time in Unity Editor that says "System.Threading.Tasks.Task is defined multiple times" and that's because -I think- the new Parse.Unity.dll and Unity.Task.dll from Firebase, if I try to delete that firebase Dll another error appears....

Please any help is appreciated :(

We have to build with il2cpp to upload on the App store, Android version works fine.

sentences:
Question about coding rarity and non-MonoBehaviour referencing I have a non-MonoBehaviour script called Item which contains two classes.

public class Item
{
    public string itemName;
    //public string itemRarity;

    public Item(string newItemName)
    {
        itemName = newItemName;
    }
}

and

public class ItemRandomizer
{
    List<Item> itemContainer = new List<Item>();

    public void AddItem(Item item, int amount)
    {
        for (int i = 0; i < amount; i++)
        {
            itemContainer.Add(item);
        }
    }

    public Item GetRandomItem()
    {
        int index = Random.Range(0, itemContainer.Count);

        // want to return item combined with rarity
        return itemContainer[index];
    }

I want GetRandomItem to not only return a random item "type", e.g., gloves, contained in the itemContainer list, but also combine it with a rarity (common, rare, legendary) and return that if possible.

How can I code this functionality in a flexible way so that two base items with the same drop chance can have varying drop chances when it comes to their rare versions? Swords and axes have the same drop chance, but a rare sword might be rarer than a rare axe. I'd like to maintain that kind of flexibility.

Also, if I make public string itemRarity a property of the Item class, but I want to set the rarity tier in GetRandomItem() in the ItemRandomizer class, how should I do that? Thus far, I've almost exclusively used MonoBehaviour classes so any pointers are appreciated.

sentences:
2D HUD over 3D scene I'm trying to create a 2D Heads up Display for my players in a 3D OpenTK environment. How I'm doing it is by drawing my 3D elements and then running this code.

GL.MatrixMode(MatrixMode.Projection);
GL.Ortho(-0.5, 0.5, -0.5, 0.5, 1, 100);
GL.LoadIdentity();
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
//Disable all depth stuff
GL.DepthMask(false);
GL.Disable(EnableCap.DepthTest);
GL.Disable(EnableCap.CullFace);
//Pass texture to shaders
GL.ActiveTexture(TextureUnit.Texture0);
GL.BindTexture(TextureTarget.Texture2D, TextureImg.Handle);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texUnit"), 0.0);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texture"), 1.0);
//Enable vertex attributes
GL.EnableVertexAttribArray(Game.attribute_vpos);
GL.EnableVertexAttribArray(GL.GetAttribLocation(Game.pgmID, "texcoord"));
GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);
//MVP matrix is only translation of HUD position
Matrix4 c = Matrix4.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) * Matrix4.CreateScale(0.1f);
GL.UniformMatrix4(Game.uniform_mview, false, ref c);
//Send vertices and uvs to shader
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts.Length * Vector2.SizeInBytes), verts, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(Game.attribute_vpos, 2, VertexAttribPointerType.Float, false, 0, 0);

Vector2[] uvs = new Vector2[]
{
    new Vector2(0,0),
    new Vector2(1,0),
    new Vector2(1,1),
    new Vector2(0,1)
};

GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(uvs.Length * Vector2.SizeInBytes), uvs, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(GL.GetAttribLocation(Game.pgmID, "texcoord"), 2, VertexAttribPointerType.Float, false, 0, 0);
//Draw
GL.DrawArrays(PrimitiveType.Quads, 0, 4);
GL.UseProgram(Game.pgmID);
//Make sure I can render 3D again
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
GL.DepthMask(true);
GL.Enable(EnableCap.DepthTest);

It works exactly how it's supposed to, except the quad that I draw to the screen is slightly stretched out. It's annoying the absolute heck out of me, and I have no idea what I'm doing wrong.

Edit: Picture

sentences:
How can I edit .qvm (Quake Virtual Machine) files? I was browsing through how to mod a game (Urban Terror, a Quake 3 mod). I found that it can be done by editing .qvm files in the game. Under the file named zpak000.pk3. That file contains other files named

ui.qvm
qagame.qvm
cgame.qvm

But I can't find a way in which I can edit these files.

sentences:
Realistic metal shader How do you create a good metal shader?

For different metals and say more or less eroded / rusty and so on.

I know that one difference from ordinary materials is that metal should 'colour' the specular light but when I do that with gold for example it just looks "yellow", not metallic at all.

Any help appreciated!

sentences:
How to apply force towards direction using mouse drag and/or touch input direction and input speed? I've to object. I can move object 1 (my Player) using mouse (or Touch for smartphone version).

I want apply a force to object 2 when object 1 hit it. Force direction must be mouse vector direction or touch vector direction.

For Mouse input i'm using event OnMouseDown and OnMouseDrag to determine mouse original position.

But I think this is not the best approach. Behaviour is not what i am expecting

void OnMouseDown()
    {

        mouseDragStartPosition = Input.mousePosition;

        //translate the cubes position from the world to Screen Point
        screenSpace = Camera.main.WorldToScreenPoint(transform.position);

        //calculate any difference between the cubes world position and the mouses Screen position converted to a world point
        offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z));

    }

    void OnMouseDrag()
    {

        //keep track of the mouse position
        var curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenSpace.z);

        //convert the screen mouse position to world point and adjust with offset
        var curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;

        transform.position = new Vector3(curPosition.x, ClampY, curPosition.z);
    }

    void OnCollisionEnter(Collision collision)
    {
        Debug.Log("OnCollisionEnter");
        if (collision.collider.tag == "Disc")
        {
            ApplyForce();
        }

    }

 void ApplyForce()
    {
        Vector3 direction = mouseDragStartPosition - Input.mousePosition;
        direction = new Vector3(direction.x, ClampY, direction.z); //ClampY used to not allow +-Y
        DiscRb.AddForce(direction * 1, ForceMode.Impulse);
    }

sentences:
How do I make cars on a one-dimensional track avoid collisions? Using three.js, I use a simple spline to represent a road. Cars can only move forward on the spline. A car should be able to slow-down behind a slow moving car. I know how to calculate the distance between 2 cars, but how to calculate the proper speed in each game update?

At the moment I simply do something like this:

this.speed += (this.maxSpeed - this.speed) * 0.02; // linear interpolation to maxSpeed

// the position on the spline (0.0 - 1.0)
this.position += this.speed / this.road.spline.getLength();

This works. But how to implement the slow-down part?

// transform from floats (0.0 - 1.0) into actual units
var carInFrontPosition = carInFront.position * this.road.spline.getLength();
var myPosition = this.position * this.road.spline.getLength();

var distance = carInFrontPosition - myPosition;

// WHAT TO DO HERE WITH THE DISTANCE?
// HOW TO CALCULATE MY NEW SPEED?

Obviously I have to somehow take current speed of the cars into account for calculation.

Besides different maxSpeeds, I want each car to also have a different mass (causing it to accelerate slower/faster). But this mass has to be then also taken into account for braking (slowing down) so they don't crash into each other.

sentences:
Manipulating a free camera I have a camera class in my code which stores two 4x4 matrices. One for the view matrix and one for the projection matrix. Originally, I had two floats in the class for pitch and yaw and these were updated based on keyboard and mouse input. Then on update I would do something like this to set the view matrix:

Matrix33 xRot = Matrix33::CreateRotationX(m_pitch);
Matrix33 yRot = Matrix33::CreateRotationY(m_yaw);

Matrix33 rot = xRot * yRot;

const Vector3& rUp = rot.GetColumn1();
const Vector3& rForward = rot.GetColumn2();

m_viewMatrix = Matrix44::CreateLookAt(m_position, m_position + rForward, rUp);

However, I'm now wanting to add roll to the equation but I know that if I carry on using this method I'm going to run into gimbal lock. I do have a function in my maths library to rotate about an arbitrary axis. The function definition is:

static Matrix33 CreateRotation(const Vector3 &rAxis, const float rad);

But I'm not sure, based on pitch/yaw/roll how to create the arbitrary axis to rotate around. This got me thinking that perhaps pitch/yaw/roll isn't the best way to be doing it so I thought I'd ask on here about what might be the best way? I don't even have to use CreateLookAt(), it just seemed easier at the time :)

I don't have a quaternion class yet but I could add one if that would be the best way. I think ideally I'd rather do it with just matrices for now, though.

Any help would be much appreciated.

sentences:
Increasing mass in ineleastic collision by orders of magnitude resultsin little change in velocity When increasing my rocketMass from 10 to 1000 or to a 1000 or bringing my shipMass down to 1, I notice very little increase in how far the ship's final inertia is. I'm expecting that increasing from 10 to 1000 will be visibly about 100 times faster.. but it's not. If I multiply the hypotenuse at the end, that does make the bouncing incredibly faster.

Am I misunderstanding physics or is this a calculation error?

handleCollision(r) {
    var angle = r.r * Math.PI / 180.0;
    var rr = this.r * Math.PI / 180;

    var rocketVector = {'x' : r.power * Math.cos(angle), 'y' : r.power * Math.sin(angle)};
    var inertiaVector = {'x' : this.magnitude * Math.cos(rr), 'y' : this.magnitude * Math.sin(rr)};

    var rMass = 100;
    var shipMass = 1;

    var x = (rMass * rocketVector.x) + (shipMass * inertiaVector.x);
    var y = (rMass * rocketVector.y) + (shipMass * inertiaVector.y);
    var xDividedByMass = x / (rMass + shipMass);
    var yDividedByMass = y / (rMass + shipMass);

    var yRadians = (yDividedByMass * Math.PI / 180);
    var xRadians = (xDividedByMass * Math.PI / 180);
    var theta = Math.atan( yRadians / xRadians);

    theta = theta * 180 / Math.PI;
    console.log(theta);

    var hypotenuse = Math.sqrt((xDividedByMass * xDividedByMass) + (yDividedByMass * yDividedByMass));

    if (x < 0) {
        theta -= 180;
    }

    this.r = theta;
    if (this.r < 0) {
        this.r += 360;
    } else if (this.r > 360) {
        this.r -= 360;
    }
}

sentences:
Presenting game center leaderboard I have the following code:

-(void)showLeaderboard {

GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
    leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
    leaderboardController.leaderboardDelegate = self;
    [self presentModalViewController: leaderboardController animated: YES];
}

[leaderboardController release];

}

Which I am trying to use to make my leader-board pop up. The issue is cocos2d will not allow me to use the line:

        [self presentModalViewController: leaderboardController animated: YES];

How do I fix this?

Thanks

PS I am using cocos2d

sentences:
How to setup Authentication Database and Game Database? I'm playing around with creating a game in C# using the XNA Framework. I've decided to use technologies that I'm pretty much familiar with and create things from scratch. There are probably frameworks out there that would take away all of the difficulties that I'm encountering but I find it fun to dive into these challenges and over come them manually if you will.

My current issue is that when I play MMO type games I know the general setup. I must login (authenticate) and then select a server to begin playing on. Once I log into the server I'm generally met with a Character Select screen of some sort before I actually "log in to the game".

With that said, my initial attempt at developing a database system was this:

Authentication Database - table for user information, table for server information
Game Database - table for characters, table for inventories, items, etc...

After I created these I noticed a key missing problem. Users are linked to characters and characters are linked to a server. I currently have these pieces of information spread over 2 databases. I thought to myself, maybe this isn't a good idea?

I guess I could: Game Client can store the reference to the account identifier in the code once login was successful, but doesn't that sound like a security issue?

Anyone have thoughts or suggestions? Or a good book recommendation for development in this area?

Note I'm not trying to develop an absolute perfect system that I can release and make money off of. I'm more doing this for experience, fun and enjoyment so my solution doesn't have to be perfect, but I don't want it to be the worst possible solution either :)

sentences:
Jump when the screen is tapped, rather than when the space key is pressed I am trying to make my character jump when the player taps the screen.

At the moment it jumps when I press space bar, but how can I change the code to make him jump when the screen is tapped?

This code works as the character then jumps up:

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        rb.gravityScale *= -1;
    }
}

This code using touch does not work: the character just stays where he is when I click the screen on my computer.

public void Update()
{
    if (Input.touchCount > 0)
    {
        Touch touch = Input.GetTouch(0);
        rb.gravityScale *= -1;
    }
}

sentences:
2.5D UI, perspecitve view, distort objects by angle but not position Instead of thousand words, a few pictures to explain what I want to achieve

How do I get the merit of UI objects rotation in perspective projection, but ignore the position of an object(as in Overlay Canvas)?

UPDATE 1

Can you include an example of what your full UI or scene would look like?

A usual bar which is used to hold stuff like score. Same base prefab is used for mana/health and any other UI parameter on screen. But bars have different rotations, so here is one solution - have a unique sprite for every special rotation and have a bunch of prefabs(nah). Or have one sprite, one prefab and set the rotation in scene(that's the way).

Is there a reason you are asking for this in perspective projection?

Just because I want to be able to rotate UI objects in scene and show the "depth" of rotated object. I'm not particularly stuck onto perspective projection, as long as I can achieve the "want" look without actually redrawing sprites for every unique angle.

so I'm not sure what you are asking for. Are you asking how to skew an image in 2D, so that it looks like a 3D perspective projection?

I know it sounds crazy, since it's obvious that in perspective looking at object which is above camera you get that "looking from down" look. And yet I feel you are onto something(and now am I), one way of thinking is actually to skew a 2D image to simulate rotation as in perspective view!

sentences:
How should loot be distributed across dungeon levels? I am making a dungeon crawler; as the player character adventures down through increasingly difficult floors of a dungeon, they collect more valuable treasure.

What is a good algorithm to determine the distribution of treasure? Should each potential item be given a range from one to a million and then be rolled for, or should multiple dice with special value be rolled and an item constituted that way?

For this example there can be an infinitely varied assortment of randomly generated items.

sentences:
How can I repeat a Texture Region in libGDX I have a texture that is part of a sprite sheet. I want draw the texture to cover a certain length, but I want it to repeat not stretch. However,when I use the following code

batch.draw(hillBottom, hill1.getX(), hill1.getY(), hill1.getWidth(), hill1.getHeight(), 0, 0, 1, hill1.getNumBlocks());

I receive an error indicating that the first argument must be a Texture not a Texture Region. I am new to game development, but I have read from multiple different guides that loading seperate textures in a game hinders performance which is why it should only be done if completely necessary. Is there anyway I can repeat the Texture Region?

sentences:
Switching between meshes vs Loading only specific mesh I am currently developing an online multiplayer game on Unity. In the game, the character of each player will be assigned its mesh after the game receives parameters (their meshes' names) for each character from the server. Assigning each character's mesh can happen after the main scene is loaded. I am wondering whether:

I should make each character's object the same by having every mesh possible loaded into it and only activate the corresponding mesh for that player.
I should create a class that holds every mesh possible (like, mesh manager) and tell each character to use its mesh from that class.
I should delay the characters' meshes loading to wait for the parameter from the server first. Then, load the mesh after the scene has been loaded.

I am not sure if specific assets can be loaded outside of its scene in Unity. If anyone has any different solutions, feel free to suggest. Thanks in advance.

sentences:
Force change prefab source I have a prefab A and i use it in scene A (as gameobject A). Then i to save that scene A as scene B and also renamed the gameobject A to gameobject B. Then inside unity (in project window ) , i duplicated the prefab asset A to prefab B.
Fyi, i'm using .blend (blender file) as the prefabs.
in scene B, i want the gameobject B which refers to prefab A , to switch its prefab's source to prefab B.
This way , i have 2 different scenes which has independent gameobjects  which refer to unique prefab. So i can modify prefab A and will affect scene A but not scene B.
Ussually, i can drag the gameobject to project window and choose/create 'new original prefab' option, but this method can't be used, since i want both prefab as .blend file (so i can modify them directly using blender).
What i did so far, is to drag prefab B to scene B, which then i have to manually redo all the setting which has been done in scene A . I want to avoid this tedious process.
Does anyone have any idea ?

sentences:
Deferred rendering and gaussian blur - artifacts I compute Gaussian blur in two passes (horizontally and vertically). Shaders look like this:

Horizontal blur - fragment shader:

#version 420
layout (location = 0) out vec4 outColor;
in vec2 texCoord;
float PixOffset[5] = float[](0.0,1.0,2.0,3.0,4.0);
float Weight[5] = float[]( 0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162 );
float scale = 4.0;

uniform sampler2D texture0;
uniform vec2 screenSize;

void main(void)
{
    float dx = 1.0 / screenSize.x;
    vec4 sum = texture(texture0, texCoord) * Weight[0];
    for( int i = 1; i < 5; i++ )
    {
        sum += texture(texture0, texCoord  + vec2(PixOffset[i], 0.0) * scale * dx ) * Weight[i];
        sum += texture(texture0, texCoord - vec2(PixOffset[i], 0.0) * scale * dx ) * Weight[i];
    }
    outColor = sum;
}

I use deferred rendering and the following
screens shows a diffuse material texture after blurring. I simplified a render loop for the sake of clarity(only one render target - a diffuse material).

A render loop - first case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, render to a temporary texture (full screen quad)
read a temporary texture, horizontal blur, render to a temporary texture (full screen quad)
read a temporary texture, vertical blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, render to the default framebuffer (full screen quad)

The final image has artifacts(flickering pixels). Some of them are placed between two  triangles which create the full screen quad.

A render loop - second case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, render to a temporary texture (full screen quad)
read a temporary texture, horizontal blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, vertical blur, render to the default framebuffer (full screen quad)

Some artifacts may appear between triangles:

A render loop - third case:

bind fbo1
gbuffer stage
unbind fbo1
bind fbo2
read a diffuse texture, horizontal blur, render to a temporary texture (full screen quad)
unbind fbo2
read a temporary texture, vertical blur, render to the default framebuffer (full screen quad)

The final image doesn't contain artifacts.

How to fix that ? The above code is simplified but normally the first case(render loop order) is most useful, for example: I want to blur a glow texture and use it when shading.

sentences:
How can I use OpenGL and D3D to render to the same window at the same time? I have main render loop in which initial drawing is done via OpenGL to an SDL window, and after that the same window handle is passed to a Direct3D device, which does subsequent rendering.

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

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

sentences:
How should I prepare for pitching a game to potential sponsors? We have developed a mobile game, and are preparing ourselves for demo day. We will be presenting our game to potential sponsors, and we are having trouble deciding how to make a quality presentation.

Specifically, what are the unique challenges and opportunities in pitching a game, in contrast with product demos generally?

Being developers, we are worried we might wrongly focus on elements important to developers, but not to investors. How can we go about identifying them?

For demoing game play, in what situation should we consider switching to a separate app, embedding the game in a slide show, showing canned game footage, or something else?

sentences:
Recursively find neighbors I'm making a Bubble Shooter game in Unity. I came to the point where I can hit another bubble and it destroys all of its neighbors.

Now I'm trying to use recursion to destroy all of its neighbors neighbors and it causes a stack overflow.

private List<Bubble> FindAllRecursiveNeighbors(Vector2Int originPosition)
{
    List<Bubble> allNeighbors = FindNeighbors(originPosition);
    List<Bubble> result = new List<Bubble>();

    foreach (Bubble bubble in allNeighbors)
    {
        if (result.Contains(bubble)) { continue; }
        result.Add(bubble);
    }

    // Recursion starts here.
    foreach (Bubble bubble in result)
    {
        List<Bubble> neighbors = FindAllRecursiveNeighbors(FindPositionOfBubble(bubble));
        foreach (Bubble neighbor in neighbors)
        {
            if (result.Contains(neighbor)) { continue; }
            result.Add(neighbor);
        }
    }
    return result;
}

sentences:
Normal mapping for Android and iOS I'm making a mobile game for Android and iOS on Unity. At the moment I am researching and designing the technical aspects of the game. Since it is not plausible to use highly detailed models for mobile platforms, should normal mapped models be used instead?

Thus I have couple of questions about normal mapping. Are normal mapped models much more costly to make, in other words, do they take a lot longer to create? And are they much more expensive to render? At least there are no additional draw calls, but of course the shader is more complex.

sentences:
sfml - graphic not showing once i change the context setting I am trying out sfml and want to draw simple 2D graphic on top of 3D object.

sf::ContextSettings settings;
settings.depthBits = 24;
settings.majorVersion = 4;
settings.minorVersion = 1;//opengl v4.1
settings.attributeFlags =  sf::ContextSettings::Core;

sf::RenderWindow window( sf::VideoMode(1200,800),"sfml", sf::Style::Default, settings);

sf::CircleShape qs;
qs.setRadius(400);
qs.setPosition(400,400);

while(window.isOpen()){
        sf::Event evnt;
        while (window.pollEvent(evnt)) {
            switch (evnt.type) {
                case sf::Event::Closed:
                    window.close();
                    break;
            }
        }
        glClearColor(0.2f, 0.3f, 0.3f, 1.0f);

        window.draw(qs);

        window.display();
    }

the sf::ContextSettings is set so that I can use openGL to draw 3D graphic. but with this settings, my qs not showing in the window. if I comment out the settings.majorVersion = 4; and settings.minorVersion = 1;, then it appear.

I am rather new and not sure how it works.

Is this possible to be resolved?
Is it correct to think that I want to use sfml for interface graphic and OpenGL for 3D? How do people normally do it?

sentences:
Procedural mesh generation from raytracer I'm interested in applying the following technique:

Define game objects using a object definition DSL similar to what you would use for a raytracer (e.g. POVRay)
Use a specialised raytracer to sample the shape of the object as a mesh and render a texture/normal map for the object
Subsequently use the generated mesh / textures in a 3D game engine as usual

It seems like this technique would be a good way of developing a lot of high quality meshes fairly efficiently, assuming a resoanably expressive object definition DSL.

Has this technique been effectively used anywhere?

sentences:
which is the best approach or algorithm to calculate real-time ranking I want to know the fastest and most efficient way to compute points and ranking in real time.

I'm doing a betting football game (a game where users try to predict the outcome of a game before it). In my country is called "Quiniela".

Players put "predictions" just before the match starts. My question is: from the moment the game starts, which is the most efficient way (not just code level but to the database and server) to calculate the ranking for the players "real time" as their predictions regarding the actual outcome of the game.

For example:

If a Team1 vs Team2 plays, the user U1 predicted that the game would end 0-0, U2 predicted the game would end 1-0, U3 predicted the game would would end 1-1.

When starting the game, the U1 would be to first in the ranking because, if the match ends like this, his prediction would be correct, or at least the most accurate.

Then the score switches to 1-0, and the user U1 would be the last of the ranking (because his prediction is not possible anymore), U2 would be the first and U3 second.

If the score changes to 1-1, U2 would go first, U3 would be second (because he guessed part of the result) and U3 last.

I thought about creating a tree of possibilities with one level (0-0 first node, with 1-0 and 0-1 as child nodes) as you change the score, changes the Ranking "temporarily" and I would keep it in cache.

Once the game is over, I keep the latest Ranking in the database.

There is a more optimal way to solve this problem? It has been proposed before and already solved? I'm using MySQL for database, PHP (Cake Php) for the server and a bunch of mobiles who ask for the ranking once in a while.

sentences:
How to do gpu batching? I need to render two shapes with opengl (let's say a cube and a triangular prism) and one of them has texture and the other one has lightning fx. The thing I want to do is first draw texture and lightning and then render the shapes. I made a research, the only thing I could find is this is called gpu batching. Do you have any ideas or any tutorials etc. about this subject? How can I do this?

Edit: This video explains what I want to do:
Crysis 2 - Rendering Pipeline

Edit: I heard that it is not possible for gpu to render different fxs for different geometries back to back. So I need to group geometries by fxs.(Cube has texture put it in the texture array, prism has lightning put it in the lightning array...then loop these arrays and render the scene) My aim is to first render fxs and then render geometries to render the whole scene.

sentences:
How can I support component-to-object communication safely and with cache-friendly component storage? I'm making a game that uses component-based game objects, and I am having a hard time implementing a way for each component to communicate with its game object.  Rather than explain everything at once, I will explain each part of relevant sample code:

class GameObjectManager {
    public:
        //Updates all the game objects
        void update(Time dt);

        //Sends a message to all game objects
        void sendMessage(Message m);

    private:
        //Vector of all the game objects
        std::vector<GameObject> gameObjects;

        //vectors of the different types of components
        std::vector<InputComponent> input;
        std::vector<PhysicsComponent> ai;
        ...
        std::vector<RenderComponent> render;
}

The GameObjectManager holds all the game objects and their components.  It is also responsible for updating the game objects.  It does this by updating the component vectors in a specific order.  I use vectors instead of arrays so that there is virtually no limit to the number of game objects that can exist at once.

class GameObject {
    public:
        //Sends a message to the components in this game object
        void sendMessage(Message m);

    private:
        //id to keep track of components in the manager
        const int id;

        //Pointers to components in the game object manager
        std::vector<Component*> components;
}

The GameObject class knows what its components are and can send messages to them.

class Component {
    public:
        //Receives messages and acts accordingly
        virtual void handleMessage(Message m) = 0;

        virtual void update(Time dt) = 0;

    protected:
        //Calls GameObject's sendMessage
        void sendMessageToObject(Message m);

        //Calls GameObjectManager's sendMessage
        void sendMessageToWorld(Message m);
}

The Component class is pure virtual so that classes for the different types of components can implement how to handle messages and update.  It also is able to send messages.

Now the problem arises on how the components can call the sendMessage functions in GameObject and GameObjectManager.  I came up with two possible solutions:

Give Component a pointer to its GameObject.

However, since the game objects are in a vector, the pointers could quickly become invalidated (The same could be said of the vector in GameObject, but hopefully the solution to this problem can also solve that one).  I could put the game objects in an array, but then I would have to pass in an arbitrary number for the size, which could easily be unnecessarily high and waste memory.

Give Component a pointer to the GameObjectManager.

However, I do not want components to be able to call the manager's update function.  I am the only person working on this project, but I do not want to get in the habit of writing potentially dangerous code.

How can I resolve this problem while keeping my code safe and cache friendly?

sentences:
Can't sample texture in HLSL using DX11 Environment:

Windows 7 x64
Visual Studo 2012
DirextX11
HLSL Shader Model 5
Ogre 1.9

Okay, so I'm trying to sample a texture in my pixel shader but I'm coming across some strange problems.  Here's the pixel shader:

struct PS_INPUT {
    float4 pos : SV_POSITION;
    float2 uv  : TEXCOORD0;
};

Texture2D tex0;
SamplerState s0;

float4 pixel_shader(PS_INPUT input) : SV_TARGET {
    float3 texSample = tex0.Sample(s0, input.uv);

    float4 color = float4(1,1,1,1);

    color.xyz = texSample;

    return color;
}

If you want / need it here's the ogre .material definition:

material simpleMat
{
    technique
    {
        pass simpleMat
        {
            vertex_program_ref vertex_shader {}
            fragment_program_ref pixel_shader {}
        }

        texture_unit 0
        {
            texture diffuse.png 2d
            tex_address_mode wrap
        }
    }
}

This produces mostly black on my object, but I get 2 random white pixels.  But here's the strangest part.  When I debug the pixel shader in visual studio texSample nearly always equals zero.  So I decided to try something crazy, I debugged the program, got the value of input.uv and then modified the shader to use these values explicitly.  When I do this texSample actually contains the correct color value.  So yeah...  any help is much appreciated!

Rojuinex

EDIT

Here is a snapshot that shows the issue in detail:

http://www.pasteall.org/pic/show.php?id=74835

EDIT 8/4/2014

Upon further investigation I have discovered that the further the object is from the camera, the darker the texture becomes.  If the camera is right up against the object, the texture has the right color values, but as it moves away the sampler returns darker and darker values until they are black.

sentences:
Can't get Direct3D11 depth buffer to work I can't get the depth buffer to work correctly.  I am rendering 2 cubes in a single Draw function, and from one angle it looks great

But swing the camera around to view the opposite sides, and I discover it's just Painter's Algorithm.

This is my code to setup the depth stencil buffer:

void Graphics::CreateDepthStencilBuffer(ID3D11Texture2D* backBuffer)
{
    D3D11_TEXTURE2D_DESC dsTextureDesc;
    backBuffer->GetDesc(&dsTextureDesc);
    dsTextureDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    dsTextureDesc.Usage = D3D11_USAGE_DEFAULT;
    dsTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
    dsTextureDesc.MipLevels = 1;
    dsTextureDesc.ArraySize = 1;
    dsTextureDesc.CPUAccessFlags = 0;
    dsTextureDesc.MiscFlags = 0;
    Microsoft::WRL::ComPtr<ID3D11Texture2D> dsBuffer;
    ASSERT_SUCCEEDED(g_Device->CreateTexture2D(&dsTextureDesc, NULL, dsBuffer.ReleaseAndGetAddressOf()));

    D3D11_DEPTH_STENCIL_DESC dsDesc;
    dsDesc.DepthEnable = true;
    dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
    dsDesc.DepthFunc = D3D11_COMPARISON_LESS;
    ... snipped stencil properties ...
    ASSERT_SUCCEEDED(g_Device->CreateDepthStencilState(&dsDesc, g_DepthStencilState.GetAddressOf()));
    g_pDevCon->OMSetDepthStencilState(g_DepthStencilState.Get(), 1);

    D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
    depthStencilViewDesc.Format = dsTextureDesc.Format;
    depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
    depthStencilViewDesc.Texture2D.MipSlice = 0;
    ASSERT_SUCCEEDED(g_Device->CreateDepthStencilView(dsBuffer.Get(), &depthStencilViewDesc, g_depthStencilView.GetAddressOf()));
}

And I'm calling g_pDevCon->OMSetRenderTargets(1, g_renderTargetView.GetAddressOf(), g_depthStencilView.Get()); after every Present call.

I've been scratching my head for ages wondering what the problem is.  Any clues will be much appreciated!

Edit:
I used the graphics debugger, and apparently the output merger is doing its job, as seen in the screenshot below, but that isn't what I am seeing on screen.
At the top of the pic is the state of the depth buffer, but I can't make sense of it to determine if it's correct or not.

sentences:
How to draw a trapezoid in OpenGL? The question seems easy, but you simply change vertex positions to match the corners of a trapezoid but it simply fails. I've tried scaling top and bottom edges like this :

but when I apply my texture it doesn't behave as I expected rendering this texture

into this image

Edit:

so far I've managed to produce a good looking image by changing w component of vertex coordinates instead of the x component, but I'm wondering if there is any better way to solve it?

Edit2:

here are my vertex and texture coordinates when I initialize the class.

float w = mTexture->getPixelsWide();
float h = mTexture->getPixelsHigh();
mVertices[ 0+0] =-w; mVertices[ 0+1] = 0; mVertices[ 0+2] = 0; mVertices[ 0+3] = 1;
mVertices[ 4+0] = w; mVertices[ 4+1] = 0; mVertices[ 4+2] = 0; mVertices[ 4+3] = 1;
mVertices[ 8+0] =-w; mVertices[ 8+1] = h; mVertices[ 8+2] = 0; mVertices[ 8+3] = 1;
mVertices[12+0] = w; mVertices[12+1] = h; mVertices[12+2] = 0; mVertices[12+3] = 1;
mCoordinates[0] = 0; mCoordinates[1] = 0;
mCoordinates[2] = 1; mCoordinates[3] = 0;
mCoordinates[4] = 0; mCoordinates[5] = 1;
mCoordinates[6] = 1; mCoordinates[7] = 1;

and later to scale it I'm currently using:

float ts = (mSpreadTime - mDropTime) / ((mSpreadTime - mTime) + mTopSpreadRatio * (mTime - mDropTime));
float bs = (mSpreadTime - mDropTime) / ((mSpreadTime - mTime) + mBottomSpreadRatio * (mTime - mDropTime));
mVertices[3] = ts;
mVertices[7] = ts;
mVertices[11] = bs;
mVertices[15] = bs;
mVertices[1] = 0 * ts;
mVertices[5] = 0 * ts;
mVertices[9] = h * bs;
mVertices[13] = h * bs;

note: that method above solved my issue, I'm looking for a way to fix it without messing with w component.

sentences:
Scoring system (3 Variables) I'm writing a mobile game where the player has

a limited number of clicks to direct their avatar to the bottom of the map
into a bronze, silver, or gold basket
land on his/her feet, head, or side.

I'd like to take each of these into consideration when determining the score.

On level 231, the lowest possible clicks to get into the bronze is 2, silver is 4, and gold is 7, with a limit of 10 clicks.

So let's say the score is calculated like so:

Basket: 1 point for bronze, 2 for silver, and 3 for gold.
Landing: 3 for feet, 2 for head, and 1 for side.

That means the possible outcomes are:

Bronze: 1, 2, 3, or 4
Silver: 2, 3, 4, or 5
Gold: 3, 4, 5, or 6

Now that's all good because I can make a 1 star 3, a 2 star 4, and a 3 star 5 or 6.

But now, the remaining clicks come into play: I originally wanted them to multiply the score. 2x for 1 click left, 3x for 2, and so on. That means getting a fast bronze is better than getting the harder-to-reach gold. Raising the base scores to 1, 2.5, and 6.25, respectively, messed up the other levels.

Does anybody has a solution I could try? I don't care if the points go into the hundred thousands. I want to reward players more for gold, with other elements to keep them interested and feeling accomplished after player a level.

Thanks!

sentences:
Do Playfish and Zynga use COTS game engines? I'm very interested to learn how to make 2D and 3D games, but I'm very new to this field so I am wondering if companies like Playfish, Zynga and other producer of games on Facebook are using publicly available game engines to make their games or if they're building their own game engine or what?

What game engines or technologies that are used in such games?

Are there any resources available that I can use to get started?

sentences:
In Cricket games, how is the ball synced with batsman's shot animation? How does the ball hit right at the center of the bat? How does this work? I've been trying to figure this out for quite some time now.

In Cricket games, when the bowler bowls, and batsman takes a shot, how does the ball sync with batsman's shot animation?
For example, let's say the batsman hits a straight drive, how does the ball hit the bat perfectly?

Can anyone help me out with this?

I'm also curious  about how in football games, the player animations sync with the football. How does the player's foot correctly hit the ball?

Thanks in advance.

sentences:
How do I hide an Input field? I have in my hierarchy tab a Canvas. Inside the canvas I have an Input Field that holds a placeholder and a text.

I read the documentations and didn't find how to hide the Input field.

I want that if a if statement is true, then it will show the input field. Else you won't see it.

How can I implement it?

EDIT

I thought about an idea to test: If I press the O key on the keyboard it disappears, and if I press again it appears; and so on.

This is what I tried:

bool shown = true;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    GameObject inputField = GameObject.Find("InputField");
    if (Input.GetKeyDown (KeyCode.O)) {
        shown = !shown;
        inputField.SetActive (shown);
    }
}

I play the scene and when I press the O key I get

NullReferenceException: Object reference not set to an instance of an object

If I double-click on the console message it highlights me the if (Input.GetKeyDown (KeyCode.O)) { line.

Something not good does the SetActive(bool) method, I suppose.

sentences:
What tech will enable a script to run after a certain amount of time elapsed following a user's action? I'm trying to experiment in creating an MMO browser-based game using PHP, MySQL, Javascript, HTML5, and CSS.

There is this certain functionality that I want in my game that I'm having trouble with.

In detail, here's what happens:

The user clicks an action
Then a time limit will commence
After the time limit, then a script will run and the changes will take place.

I've heard of cron jobs but these changes are not in a set time. It depends on when a player makes a move or something.

Here are the possible ways I can think of carrying this out:

You save the time when the user makes a move, and when the user checks back again, there will be a script that will check if the time the user made a move and compare it with the current time. The problem with this is that, I wan't the changes to take place even when the player is offline. With this method, the changes will only happen after the player checks back again.
A cron job will do the above action of checking the time the user made a move and compare it with the current time. Probably every 30 minutes or every hour. The problem with this is, won't this be too much for the server? And still, it will be every 30 minutes or so. Will this be possible too if done in seconds?
A combination of the two. A cron job will check every hour and it will also check every time a user logged back in.

Of course these are the solutions I can think of using only cron jobs. I don't know if there is any better technology out there. I do hope that there is a better way like actually running a script after a certain amount of time elapse after an action even when offline. If there is, tell me. I'm talking server-side here ok.

Yeah, anyone can help me out with this?

sentences:
Simple shadow casting in 2.5D game I am trying to build simple game and I just bumped on some logical problem that I am sure many of you already came across. I have a plane - floor and several sprites-trees that have tree texture on them. It basically looks like this:
What I would like to do is to add dynamic shadows below the trees. I don't want to generate the shadows in runtime - I have texture for that. By "dynamic" I mean that I can control shadow length and rotation (simulating different times of day). And here I would like to ask you for best practice for that. I was thinking about adding small plane under each tree and control it's rotation and scaling directly from the game. The other idea I had was to use vertex shader to position, scale and rotate those planes. I was also thinking about using pixel shader to combine floor texture with shadow texture. The last idea has this advantage over the others that my floor may eventually be not flat, and the shadows would still be nicely casted. Also this would allow me to have shadows close to edges of the floor (which hangs in "space") and the shadows would not stick out from the floor. I would be grateful if you could suggest me some approach to the problem.

sentences: is it possible to use c# GUI toolbox in an XNA app? I need both reach GUI features of c# toolboxes and fast rendering features of XNA, is there any way to merge these two into one app? or is there any other way? for example some equivalent to c# toolbox in xna?

sentences:
CharacterController rotation with mouse I'm trying to rotate my characterController around with the mouse movement.
I've tried to do so with this:

rotLeftRight = Input.GetAxis("Mouse X") * MOUSESENSIVITY * Time.deltaTime;
 rotUpDown = -Input.GetAxis("Mouse Y") * MOUSESENSIVITY * Time.deltaTime;

It works fine when I just move the mouse, but Input.getAxis returns 0 if you don't move the mouse, even if it's already on a corner of the screen. Is this normal?

What I need is something that returns 0 only when the mouse is in the center of the screen. I don't know if that is posible using Input.GetAxis or I should use another function.

Anybody can help me with this?

sentences:
How do I support animation with frames of different sizes? I'm trying to create a simple top-view 2D rpg, in the style of Zelda and Secret of Mana, using PyGame. I've managed to make the beginnings of a game, with an animated character walking around. However, when I start animating attacks, I'm running into problems because the sprite with the sword slash is bigger than the walking sprite. This makes the character appear to be jumping around when attacking.

I managed to handle the problem by defining a center of gravity, so to speak, for each image, and apply a suitable offset at each frame in the animation to make the center of the character stay at the same place throughout the animation. I defined a dictionary of lists of images (instances of pygame.Surface), where I pick out the correct list by the state of the character, so for example there is one list for walking left, and then I loop over the list to get the animation. To handle the offset, I similarly created a dictionary of lists of offsets, looping over those in the same way.

However, I'm not entirely pleased with this implementation, so I'm looking for a more elegant solution.

I tried to add an attribute called offset to each instance of the pygame.Surface class, to hold the offset for each image, but the Surface class doesn't allow new attributes to be set. I then thought about subclassing pygame.Surface, which would allow me to set any attribute I wanted, but then I couldn't load my images with pygame.image.load without a lot of extra code.

I imagine everyone who makes a game with animations where the size of the sprite changes between frames would have to deal with this problem, so if anyone could suggest an elegant implementation, that would be great. If example code with PyGame is available, that would be even greater.

sentences: Unity - Best Random Movement Strategy? As of now, to get random movement of my enemies, I am adding a Rigidbody and a BoxCollider then "throwing" them (i.e. adding velocity) in a random direction for a random amount of time and making them choose a new direction if ever they get outside of their designated area. This does not seem to work that well all the time. Sometimes they manage to get themselves stuck inside obstacles which should be impossible. The more I add guys, the more it seems the physics can't keep up or something with the collisions. Is there a better method to random movement or is "throwing" them perfectly valid? Is my method expensive and terrible? I might have around 50 guys active at a time and perhaps a few hundred to a thousand static obstacles each with their own colliders.

sentences:
Efficient Algorithm for the boundary of a set of tiles I have a grid of tiles of a known finite size that forms a map. Some of the tiles inside the map are put into a set known as a territory. This territory is connected, but nothing is known about its shape. Most of the time it would be a fairly regular blob, but it could be very elongated in one direction, and it could potentially even have holes. I am interested in finding the (outer) border of the territory.

That is, I want a list of all the tiles that touch one of the tiles in the territory without itself being in the territory. What is an efficient way of finding this?

For extra difficulty, it happens that my tiles are hexes, but I suspect this doesn't make too much difference, each tile is still labelled with an integer x and y coordinate and, given a tile, I can easily find its neighbors. Below are a few examples: The black is the territory, and the blue the border I want to find.

This in itself, is not a difficult problem, One simple algorithm for this, in pseudo-python, is:

def find_border_of_territory(territory):
    border = []
    for tile in territory:
        for neighbor in tile.neighbors():
            if neighbor not in territory and neighbor not in border:
                border.add(neighbor)

However this is slow and I would like something better. I have an O(n) loop over the territory, another loop (a short one, but still) over all the neighbors, and then I have to check membership over two lists, one of which is of size n. That gives an awful scaling of O(n^2). I can reduce that to O(n) by using sets instead of lists for border and territory so that membership is fast to check, but it still isn't great. I expect there to be many cases where the territory is large but the border is small due to a simple area vs line scaling. For example if the territory is a hex of radius 5, it is of size 91 but the border is only of size 36.

Can anyone propose something better?

Edit:

To answer some of the questions below. The territory can range in size, from about 20 to 100 or so. The set of tiles forming the territory is an attribute of an object, and it's this object that needs a set of all the border tiles.

Initially the territory is created as a block, and then mostly gains tiles one by one. In this case, it is true that the fastest way is just to keep a set of the border and only update it on the tile that is gained. Occasionally a big change to the territory might happen - so it will need to be recalculated fully then.

I'm now of the opinion that doing a simple border-finding algorithm is the best solution. The only additional complexity this raises is to ensure that the border is recalculated every single time it might need to be, but not more than that. I'm pretty confident that this can be done reliably in my current framework.

As for timing, in my current code I have some routines that need to check every tile of the territory . Not every turn, but on creation and occasionally afterwards. That takes over 50% of the running time of my suit of test code even though it is a very small part of the complete program. I was therefore keen to minimise any repeats. HOWEVER, the test code involves a lot more object creation than a normal running of the program (naturally), so I realise this might not be very relevant.

sentences:
Unity2D - Placing text HP and health bar over character sprite I've got a 2D character sprite that I will move through a game board. I want to add over it, in a corner of the sprite, a Text object with the remaining HP of that character and also a health bar. I want those elements to move with the Character. Wherever the character moves, the UI follows.

I've tried adding a Text element in World Space and attaching it to the character sprite, but the Text is so huge that it's not displayed properly on top of it. I need to know how to adapt that text to the size of the sprite and how to make it follow it automatically. I guess that by setting the ch sprite as parent of the Text/canvas it would work, but I don't know how to get it working.

Thanks in advance

sentences: When to use LOD and when not to? I have a simple question: are there any cases where game LOD models don't need to be created? Obviously you need LODs for landscapes, large props, characters, vehicles etc. But what about small indoor props which are unlikely to be seen from large distances? I understand that it depends on genre and other factors like the distance to the camera, but still, is there any common standard regarding when LODs need to be made?

sentences:
Is there a terrain generation method where seed data is stored for each chunk instead of surface data? I'm a web programmer but I do like the idea of working on games at some point. As an enthusiast, I'm curious:

Is there an accepted terrain building practice in which developers create a generation engine which accepts various seed values to control terrain in a non-random environment?

I'm thinking of a method of, instead of storing gigabytes of map data, just storing a couple of megabytes of seed data, different types of seed data values for each chunk of the map, allowing the client to dynamically generate the map of your desired "design" (Not random gen), with only building and structure component configurations to be saved as map data.

Is there a name for this? It seems like it would be a good method of keeping a game's file size small.

sentences:
Unity download image from Firebase database I am currently trying to download an image using Google Firebase.

The database stores a URL to an image on Firebase storage, Unity pulls the URL from the DB and uses Unity WWW to download it. However the texture shows up as a red question mark texture.

If I use a http URL from another website however it works, is Unity able to download from https addresses?

This downloads the URL from Firebase and stores it in the data_url variable:

void DownloadViaURL()
{
    Debug.Log("Called DownloadViaURL");
    FirebaseDatabase.DefaultInstance
   .GetReference("test_image")
   .GetValueAsync().ContinueWith(task => {
       Debug.Log("Default Instance entered");
       if (task.IsFaulted)
       {
           Debug.Log("Error retrieving data from server");
       }
       else if (task.IsCompleted)
       {
           DataSnapshot snapshot = task.Result;

           string data_URL = snapshot.GetValue(true).ToString();

           //Start coroutine to download image
           StartCoroutine(AccessURL(data_URL));
       }
   });
}

This uses Unity WWW to download from the URL:

IEnumerator AccessURL(string url)
{

    //Debug.Log("Accessing texture URL in database");
    using (WWW www = new WWW(url))
    {
        yield return www;
        Renderer r = GetComponent<Renderer>();
        r.material.mainTexture = www.texture;
        Debug.Log("Texture URL: " + www.url);
    }
}

sentences:
How do i update opengl lightning equation in my fragment shader to make my texture less glossy and more like a fabric I built a model in blender, and am currently trying to import it into my android app using assimp together with opengl, i dont have any issues with the importing but my goal is to make the object look realistic as possible, and this is where my problem lies...I have implemented normal mapping using both the diffuse and normals of my texture but after rendering it the objects looks smooth and glossy, yes the bumps were rendered well and i like it but i need the material to look more like a fabric (cloth/textile), please how can i do this? do i need to update my lighting equation or the issue is with my original diffuse texture?

Here is my original diffuse texture

Here is my rendered model

Here's my fragment shader

    void main()
{
    // obtain normal from normal map in range [0,1]
    vec3 normal = texture2D( normalMap, textureCoords ).xyz;
    // transform normal vector to range [-1,1]
    normal = normalize(normal * 2.0 - 1.0);  // this normal is in tangent space

    // get diffuse color
    vec3 color = texture2D( textureSampler, textureCoords ).xyz;
    // ambient
    vec3 ambient = 0.1 * color;
    // diffuse
    vec3 lightDir = normalize(tangentLightPos - tangentFragPos);
    float diff = max(dot(lightDir, normal), 0.0);
    vec3 diffuse = diff * color;
    // specular
    vec3 viewDir = normalize(tangentViewPos - tangentFragPos);
    vec3 reflectDir = reflect(-lightDir, normal);
    vec3 halfwayDir = normalize(lightDir + viewDir);
    float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);
    vec3 specular = vec3(0.2) * spec;

   gl_FragColor  = vec4(ambient + diffuse + specular, 1.0);
}

Here's my vertex shader

mat3 transpose(mat3 m) {
    return mat3(m[0][0], m[1][0], m[2][0],
    m[0][1], m[1][1], m[2][1],
    m[0][2], m[1][2], m[2][2]);
}

void main()
{

    gl_Position     = mvpMat * vec4(vertexPosition, 1.0);

    vec3 fragPos = vec3(model * vec4(vertexPosition,1.0));

    vec3 T = normalize(normalMatrix * tangent);
    vec3 N = normalize(normalMatrix * normal);
    T = normalize(T - dot(T, N) * N);
    vec3 B = cross(N, T);

    mat3 TBN = transpose(mat3(T, B, N));

    //values for fragment shader
    tangentLightPos = TBN * lightPos;
    tangentViewPos  = TBN * viewPos;
    tangentFragPos  = TBN * fragPos;
    textureCoords   = vertexUV;
}

sentences:
Using orientation sensor data for Android game I'm building a game where a green box floats to different parts of the screen. The user must rotate their phone such that the blue dot intersects the green square. This is different from a standard "roll-a-ball" type game because instead of tilting a 3D surface the ball sits on, the ball always returns to the center point when the phone is held straight. Tilting the phone forward naturally moves the ball up to catch squares that are above its center position, tilting the phone backward moves the ball down to catch squares below it, and same for tilting the phone left and right. The phone has freedom to pitch, roll, and yaw (XYZ). I'm using the Android SensorEvent and the Sensor.TYPE_ROTATION_VECTOR to try and accomplish this.

So far, this is our approach.

On game start, measure the quaternion returned from the sensor, call it Q1
On all timesteps after game start, compute the transform between Q1 and Qi, Qi being any other quaternion.
Apply the resulting transformation matrix to the 2D dot on the screen such that it translates appropriately.

I'm stuck on computing a transform between Q1 and an arbitrary Qi. I'm asking here to see how similar games solve this problem, and if our approach is even correct given the types of sensor data coming from Android.

Figure1

The bottom two pictures of the phone are side views. The top two pictures are a representation of what's on the screen

sentences:
Creating trading card board layout in libgdx I wanna make a trading card game using libgdx. I have a general idea about how to implement the server side of the game and the game rules, but I don't know how to design the visual interface of the game (in the client side). I want to
create a layout similar to the one in the image below, but quite a bit simpler. I don't have an idea of how to do it though. I'm thinking of using scene2d and Table  and have a row the opponent, one for the player and two for the creatures and then each cell is a card/creature. Is that a good way or is there a better way?

sentences:
GLSL Atomics With Floats I am implementing SDSM and in a GLSL compute shader I need to min/max vec3 values to compute the shadow map bounds. The sample implementation (in HLSL) uses vectors in "light space" that spans from 0-1 and then casts them with touint (in GLSL uintBitsToFloat) so that it can call InterlockedMinMax (atomicMin/Max) with them.

I was wondering if it is a better idea to quantize the values to an uint using the bounding volume in light space as uints instead of moving them into the 0-1 range so integer min/max works on the float bit pattern?

On the one hand using float bits in unit throws about about 2/3 the precision, because the sign bit and exponent are ignored. On the other hand almost all algorithms I came up to quantize the values somehow go past the 0-1 float range and would probably loose the precision anyway.

sentences:
Establish a person's genuine interest in game programming I teach on a 3rd level, 4 year games programming degree (B.Sc. in Computer Games Development). We find that new and prospective students often conflate interests and abilities in game-playing, game-design and game-programming. (I know the title could be a a lot more specific or descriptive, but there are internal reason why we can't change it). We do have an open day when prospective students can come and talk to faculty and current students.

This results in a lot of students signing up for our programme who find themselves with interests and/or abilities mis-aligned with their chosen degree. We have options for them to change major, but the are almost just as programming intensive. We don't have any options for students who really wanted to to game related art or design. So some students just stick at it for 4 difficult/unhappy years, as it is the closest degree available to them in gaming.

We outline the content of the programme in our prospectus, but most incoming students have little programming experience, so topics titles like data-structures, software engineering or 3D Graphics don't really mean much to them.

  "I didn't expect so much math in 3D Graphics, I assumed it would be,
  like, drawing..."

Is there any way to help establish a person's genuine interest in game programming, so that they can make a more informed decision about their education?

sentences:
CS:GO workshop awp skin scrambles I was starting make my awp skin, but I was wondering that my skin at CS:GO looks bit different than on photoshop. So I came here for help. I will show just a test skin (fully red).

First I was save my skin with photoshop to .tga format (32 bits/pixel).

Then importing to VTF editor, but not changing any of these settings, they are default.

After that I checked only "No Level Of Detail", "No Mipmap" and "SRGB".

Opening CS:GO and workshop, awp is not fully red, there is some scrambles.

I hope for solution. :)

sentences:
Why does Google keep rejecting my update for my game? I'm trying to push an update to my game that is on the Google Play Store. I've submitted the update over 4 times and Google keeps rejecting it due to the type of ads that are being displayed. I'm using Unity Ads and I've disabled all ads that would be inappropriate such as gambling, dating, 18+..etc.

The annoying part is that I have the game already on the store and I never disabled any of the ads or filtered the ads. Unity Ads are an approved service by Google. Is there something that I am missing? I also have a privacy policy in place as well? Is there something that I could do to keep it from getting rejected? How does Google test games or apps for ad content?!

Update So I've tired submitting the update over 8+ times and it's still being rejected. I've disabled the banner ads and I've changed the ads to not show ads rated for 5+. I'm at a loss for why it's being rejected. I've emailed Google over it and they just send me the same information they sent when it was rejected the first time. Still no answer..

(https://i.stack.imgur.com/wDlj1.jpg)!

(https://i.stack.imgur.com/OHGPi.jpg)

sentences:
How to make a class diagram and data model of a Unity3D game? I'm developing a 3D platformer video game on Unity3D and I've been asked to present its UML class diagram and data model. If I'm not mistaken Unity uses an entity-component-system, which necessarily doesn't use heritage. How would a class diagram from a Unity game look like, in that case?

Also, I've been taught that usually data model refers to entity-relationship-models that represent a database. In the case my game doesn't use a database, how could I diagram the way the player's data is store on the game? I'm storing the player progress on a file in the user's computer.

sentences:
Best Practices for class usage and game architecture I'm making a 2D game similar to mario in Java.

I have some questions about class organization and proper method usage.

I have the following classes:

Main: runs the game in a JFrame
GamePanel: JPanel with boundary rules, timer, paintComponent, scoring, keyboard input, collision check
Player: only knows about its own attributes... has getter and setter methods for x, y location, height, width, weight etc...
Item: Same thing as Item class... this class will be used for items in the game, like bullets, cars, etc...
Physics: I was going to use this class to contain all actions for all items in the game (items class, player class, etc)... Like the rules for jumping, or running, etc...

Am I using the classes appropriately? I'm not sure whether each class should contain its own unique methods...

For example, only Player class objects will be able to jump and run... So should Player class have jump() and run() methods? Or should it just have setX(), setY() methods which alter its location based on run() from another class like Physics()?

And for a gun, I have shoot() which creates a new Item

 bullet = new Item(this, player.getX(), player.getY()+40, 25, 10, 10, bulletVelX, 0);

But as you can see below, I'm actually moving the bullet via the timer() class by calling the Item class's autoMove() method to change the bullet Item's location.

I'm also confused on the correct usage of timer():

I'm using it to run methods at a certain interval if a given boolean is set true...

public void timer() {
    timer.scheduleAtFixedRate(new TimerTask() {
        public void run() {
            collisionCheck();
            if (jump) {
                player.jump(velocityX, -velocityY);
                velocityY--;
                checkPlayerBounds(player);
                repaint();
            }
            if (shoot) {
                if (!bulletMag.isEmpty()) {
                    for (Item bullet : bulletMag) {
                        bullet.autoMove(bullet.getVelocityX(), bullet.getVelocityY());
                    }
                    if (bulletMag.size() > 30) {
                        bulletMag.clear();
                    }
                    repaint();
                }
            }
        }
    }, 0, 100);
}

Is is okay to put all that logic inside the timer class? Or should the timer class be kept as clean and empty as possible? Is that where my main Game loop is?

Lastly, paintComponent():

I put a paintComponent in each class (Player, Item, and  GamePanel so far), and paint them by calling them from within the GamePanel's paintComponent. Is that right?

public void paintComponent(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    player.paintComponent(g);
    for (Item bullets : bulletMag) {
        bullets.paintComponent(g);
    }
}

So, in summary is my usage of classes, timer, and paintComponent correct?

sentences:
How can I cycle through sprites when the player touches some UI element? if(Input.GetKey("y")){
        gameObject.GetComponent<SpriteRenderer>().sprite = Characters[0];

    }
    if(Input.GetKey("u")){
        gameObject.GetComponent<SpriteRenderer>().sprite = Characters[1];
    }
    if(Input.GetKey("i")){
        gameObject.GetComponent<SpriteRenderer>().sprite = Characters[2];
    }

This is my current script, which changes character at keypress Y, U, and I. However as I am developing for touch, I want them to change when a box at the screen is pressed (Left one):

How can I proceed with this? Can I set the sprites to numbers, and let's say at button press, it adds +1, and that changes the sprite? And if so, how does the last one work to get it back at 0?
Appriciate all answers. :)

sentences:
What shapes interlock solidly like cubes? What basic geometric shapes, besides cubes, interlock "minecraft" style like cubes?

A small edit to make question more suited to Game Dev:

I am experimenting with game dynamics to create geometric solids interlock seamlessly on their faces much the way the cubes do in minecraft. The objective is to create an interlock system that is also memory efficient consistent enough to maintain interlock over the course of many connections without deviating from the main grid.

sentences:
Limit rotation heading by cone/angle What is a fast way of limiting the heading vector to a certain angle so that it turns in greater distance relative to the limit.

A smaller cone/angle should make the object take a far bigger curve to traverse to reach its goal where a larger cone/angel allows the object to rotate faster in the direction of its goal.

If there are some vector tricks i'll be glad to know them!

sentences:
Why I cant change the GUILayout.Button color to green when click on a button? I used a break point and it's getting to the line:

style.normal.textColor = Color.green;

But not changing the color of the clicked button.
And there are no any errors or exceptions.

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using UnityEditor;
using UnityEngine;
using System.IO;

public class Manager : EditorWindow
{
    [MenuItem("Tools/Manager")]
    static void Manage()
    {
        EditorWindow.GetWindow<Manager>();
    }

    private void OnGUI()
    {
        var style = new GUIStyle(GUI.skin.button);
        style.normal.textColor = Color.red;
        style.fontSize = 18;

        string[] assetPaths = new string[2];
        string[0] = "Test";
        string[1] = "Test1";

        foreach (string assetPath in assetPaths)
        {
            if (assetPath.Contains(".test")
            {
                var i = assetPath.LastIndexOf("/");
                var t = assetPath.Substring(i + 1);

                if (GUILayout.Button(t, style, GUILayout.Width(1000), GUILayout.Height(50)))
                {
                    style.normal.textColor = Color.green;
                }
            }
        }
    }
}

sentences:
Performing manual clipping in OpenGL I'm learning OpenGL and I understand that OpenGL performs clipping as part of the pipeline, but is it a good idea to also perform manual clipping? By manual clipping, I mean not asking the GPU to draw an object if I'm certain it won't be visible on the screen.

The advantage I can think of is that the GPU will not be wasting time on executing the vertex shader only to find out the primitives are to be discarded. On the other hand, performing calculations on the CPU may cause the overall performance to decrease. I believe the world terrain model is loaded once and so it isn't a good idea to perform manual clipping for the terrain and reloading selective parts on the GPU's memory, but maybe doing this for things like trees boost performance.

Thank you!

sentences:
Box2D how to implement a camera? By now i have this Camera class.

package GameObjects;

import main.Main;

import org.jbox2d.common.Vec2;
public class Camera {

public int x;
public int y;
public int sx;
public int sy;

public static final float PIXEL_TO_METER = 50f;

private float yFlip = -1.0f;

public Camera()
{
    x = 0;
    y = 0;
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public Camera(int x, int y)
{
    this.x = x;
    this.y = y;
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public void update()
{
    sx = x + Main.APPWIDTH;
    sy = y + Main.APPHEIGHT;
}

public void moveCam(int mx, int my)
{

    if(mx >= 0 && mx <= 80)
    {
        this.x -= 2;
    } else if(mx <= Main.APPWIDTH && mx >= Main.APPWIDTH - 80)
    {
        this.x += 2;
    }

    if(my >= 0 && my <= 80)
    {
        this.y += 2;
    }
    else if(my <= Main.APPHEIGHT && my >= Main.APPHEIGHT - 80)
    {
        this.y -= 2;
    }
    this.update();
}

public float meterToPixel(float meter)
{
    return meter * PIXEL_TO_METER;
}

public float pixelToMeter(float pixel)
{
    return pixel / PIXEL_TO_METER;
}

public Vec2 screenToWorld(Vec2 screenV) {
    return new Vec2(screenV.x + this.x, yFlip
            * screenV.y + this.y);
}

public Vec2 worldToScreen(Vec2 worldV) {
    return new Vec2(worldV.x - this.x, yFlip
            * worldV.y - this.y);
}

}

I need to know how to modify the screenToWorld and worldToScreen functions to include the PIXEL_TO_METER scaling.

sentences:
What are the best ways to serialize and unserialize network messages for C/C++ multiplayer game? We are using JSON right now and want to move to a binary format for some types of messages between client and server.

Should I just read structs into the socket?  Use proticol buffers/thrift?

How should I represent arrays of data?

What should the interface look like for packing/unpacking data?

sentences:
General approach to isometrics I am currently discovering the world of isometrics, now I found out there are two approaches to creating the tilemap;

Just create 2:1 ratio tile-images and draw those.
Creating squares and transforming them to the 2:1 ratio. What is the general approach on developing an isometric game?

Now I was wondering a few things;

How do more known games like AOE1/2 do this?
What are the pros/cons of both methods?
Which method is preferred to be used in this day and age?

Edit added more general question

sentences:
Bounding box should rotate - Skews instead I have a method to rotate a sprite's bounding box around the center of the sprite (the sprite rotates and I need the bounding box to rotate with it. The sprite is rectangular).

Instead of being rotated, the bounding box is skewing wierdly. When the angle is 0 - the bounding box is a perfect rectangle. But when the angle changes, the bounding box is getting gradually skewed.

All of this happens in the object's move() method. This method is called every cycle of the game-loop. What I'm trying to do is this:

Move the sprite in the direction the user chose. (x += dx, y += dy).
Get the coordinates of the new center of the sprite.
Get coordinates for the four vertices of the not-rotated-version
of the sprite.
Manipulate these coordinates, so they are now the vertices of the
rotated sprite.

The coordinates that step 4 gives me, are used to create the bounding box (and temporarily draw it on the screen so I can see).

Somewhere, this fails. As I said, the bounding box doens't rotate. Instead, it skews (and maybe also rotates, not sure).

What could be the problem?

Code:

public void move(){

// Advance sprite.
x += dx;
y += dy;

// Get the new center point of the sprite.
centerx = x + width/2;
centery = y + height/2;

// Get the 4 vertices of the non-rotated version of the sprite.
xcoo[0] = (int) x;
xcoo[1] = (int) (x + width);
xcoo[2] = (int) (x + width);
xcoo[3] = (int) x;

ycoo[0] = (int) y;
ycoo[1] = (int) y;
ycoo[2] = (int) (y + height);
ycoo[3] = (int) (y + height);

// Manipulate each vertex, so it fits the rotated sprite.
for(int z=0;z<4;++z){

    xcoo[z] -= centerx;
    ycoo[z] -= centery;

    xcoo[z] = (xcoo[z] * Math.cos(Math.toRadians(angle)) - ycoo[z] * Math.sin(Math.toRadians(angle)));
    ycoo[z] = (xcoo[z] * Math.sin(Math.toRadians(angle)) + ycoo[z] * Math.cos(Math.toRadians(angle)));

    xcoo[z] += centerx;
    ycoo[z] += centery;

}

}

Help would be very appreciated. Thank you

sentences:
When and where and how to turn on back the Player first person when loading a scene on button click ? In the Build Settings I have two scenes at index 0 and index 1:

Then in the Hierarchy I have the two scenes:
The active scene is the MainMenu:

In the StartGameButton I added to it a script component.
In the script:

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

public class LoadSceneOnClick : MonoBehaviour
{
  public void LoadByIndex(int sceneIndex)
    {
        SceneManager.LoadScene(sceneIndex);
    }
}

And this is the StartGameButton Inspector:

I dragged the script on the OnClick
I selected the function LoadSceneOnClick
And set the index to 1

When the game start and I click on the button it stay on the Main Menu scene and not loading anything.

The problem I guess is that I'm getting error in the game No cameras rendering:

The problem is that when I'm running the game and it start from the main menu scene in the space station scene I'm enable false the Player and the Player is a first person character with a camera:

You can see in the Inspector that the Player is unchecked the Player is not enabled. If I will enable the Player and even if the main menu scene is the active one it will show me the player and the player camera and not the main menu. So I had to turn off the Player.

The question now is where by script do I enable back the Player when it's loading the scene ?

Inside the LoadSceneOnClick script ?

sentences: Side of collision with rotation I have 2 rectangles and I want to know if its a length collision or a breadth collision. I will also need to know the rectangle that's acting as pivot. I have made a small illustration. Here, V2 is the pivoting rectangle.

sentences:
How to set keys for emission on/off for a prefab? I am making a prototype for a Mario game and am having difficulty completing a canned animation for a prefab. There is an item box asset that has 3 materials and an "ItemGet" animation. One of these materials has an active emission property that is supposed to turn off during a specific frame of the "ItemGet" animation. These boxes will have an "Active" and "Inactive" state.

While "Active", the item box just bobs up and down and IF Mario hits the trigger, the "ItemGet" animation plays (and the player gets a unique item). The box then becomes "Inactive".
While "Inactive", no animations play, the emission effect is gone and the trigger cannot be reactivated.

Challenges:

finding the correct property to set a keyframe for in the Animations panel.
Making sure Active versions of the prefab remain Active after any ItemBox becomes Inactive and that all materials don't change when GetItem plays.

Ideas:

Instead of keying the emission on/off property (assuming that exists and does what I think it does; trouble finding it), swap the materials.
( . . . ), swap the mesh.

Can somebody please help me find a viable way to finish this animation that fits this object's intended use-case?

sentences:
how to create an outlined polygon with vector3 coordinates? I have a set of vector3 coordinates and I use them to draw a polygon in another app, my question is: how can I calculate a second set of coordinates to make it look like the line is outlined.

in the above picture, the blue dots are the vector3s I have and the red dots are the one I need, can anyone help me with an algorithm or formula to calculate them?
thanks

sentences:
What's a good Game development platform for a platformer game with these characteristics? Yes, I know, the best way to make an indie game is to learn to code. I've got some scripting experience, but I want to do worldbuilding with already-existing tools (and communities surrounding those tools), and I've been really impressed with games like An Untitled Story that were made with pre-packaged toolsets at their core, like Game Maker. :)

So I'm planning to make my game using either Game Maker or something like it.

The basic parameters of my planned game:

2D platformer.
Physics/speed akin to Sonic the Hedgehog.
Large, non-linear world, flowing as seamlessly as possible -- think Super Metroid, but without the forced screen transitions.

The first two points have me leaning toward Game Maker -- Plenty of 2D platformers have been made with it, and there are serviceable, openly available Sonic-the-Hedgehog-style physics engines for it that could be adapted to my needs with minimal muss and fuss.

But the third makes me antsy -- from what limited information I hear, Game Maker has problems with large levels/boards/screens/whateveryoucallthem, thus necessitating transitions between screens.

I want to avoid that if at all possible -- it would, I believe, fundamentally alter the flow of the game.  I understand that generally speaking, the more you have loaded into memory the more things are going to chug (especially for a one-size-fits-all game development platform that isn't a model of efficient coding), but I'm hoping there are systems that can un-load objects that are sufficiently far offscreen and thus better produce seamlessness.

Any thoughts, people? :)  The sooner I can get a basic pre-fab physics engine and world-building program up and running, the sooner I can start prototyping areas and generally tooling around.  Should I be looking at Game Maker, or elsewhere?

(My current plan is to more-or-less build the game prototype-style, then worry about art and sound at the very end once the damn thing is playable.)

EDIT/RESPONSE

To ultifinitus: I might pick up C# for a separate project.

I'm familiar with game dynamics and game design from past projects (Projects that used OOP scripting languages).

The amount of work I'm willing to put into my project is directly proportional to what I can do with what's already out there.

This is where a system like Game Maker appeals to me. :) I've then got the level editor, the physics, etc. all more-or-less taken care of, and the software has a giant enthusiast community that provides various modules, advice, etc.

If I can get most of my game done that way, then once I've got a functional prototype I can happily shell out the cash to pay artists to make the game actually look like something worth a damn.

This is why I'm looking for something like Game Maker. I'm just wondering if Game Maker (or another such system) is the most suitable for what I want to do.

sentences:
Picking 3D with OpenGL ES 2 I'm trying to implement picking in my framework but I don't understand how I can do this.

I'm working with:

OpenGL ES 2.
GLM mathematic library.

What I have understand, picking can be made with two methods:

Draw scene with one color per polygon, and read pixel under mouse.
Ray projection in 3D and finally calculate geometry <-> ray intersection.

My architecture:

A Geometry class with indices/vertices/texture coords/colors data.
A Scene class with a Mesh array (using a geometry).
A Transformable class with Matrix computed with rotation/position/scale.
A Camera class with methods like getViewport/….

What I have:

My ray calculation:

void Ray::createFromEvent( const Camera& camera )
{
    glm::mat4 model         = camera.getMatrix();
    glm::mat4 projection    = camera.getProjectionMatrix();
    glm::vec4 viewPort      = camera.getViewport();

    this->origin = glm::unProject(  glm::vec3( x, y, camera.getMinDistance() ),
                                    model,
                                    projection,
                                    viewPort );

    this->direction = glm::unProject(   glm::vec3( x, y, camera.getMaxDistance() ),
                                        model,
                                        projection,
                                        viewPort );
}

So, my questions are:

How can I calculate intersection with my scene geometries?
It's better to calculate if point is inside a bounding box or ray traversing a bounding box?
How can I compute bounding box with Transformable matrix (rotation, scale, …)?

(I am on mobile so I am limited by hardware performance.)

Thanks!

sentences:
Implementing Screen Shake I'm looking to implement screen shake in a 2D top down game.
From an earlier Q on this exchange, I learned that noise values could be a good candidate, so I intent to try that.

But I wonder: is a screen shake more about rotating the 2D topdown camera, or about jittering the position of that camera?

Or does it really require both?

Additionally, I would like to know if a good screenshake would require motion blur? Something like rendering your world in 4 small micro-steps for each 60fps frame, maybe? Or can you shake the camera at 60fps with normal rendering and it still looks good?

The quality I am after is something like shown in this video. It's kinda hard to judge, but it seems that video does translational jitter only?

sentences:
Unity 3d auto-move player forward script Trying to write a basic script to attach to the player on Unity 3D, I want them to move forward automatically. I'm guessing that will be part of the Update function and using transform, but that's about as far as I get.

I'm assuming it's a Transform.translate function too, but not sure what parameters to use to move forward 1 m/s automatically (for example). Also, how do I block W and S keys moving forwards and backwards, and instead use the for up and down? (My character is 'floating' and I'm looking to incorporate space harrier style controls)

Thank you!

sentences:
Applying different materials to an object I'm currently implementing an Object Loader for the Wavefront File Format (*.obj). When exporting a model (with associated materials) from blender, a material for a group of faces is specified like this:

usemtl MyMaterial
s off
f 2/1/1 4/2/1 3/3/1
f 1/4/1 2/1/1 3/3/1

Since each material consists of (at least) 3 components for each of ambient, diffuse specular color and also shininess (which totals up to 10 floats) I would consider it to be a tremendous waste of memory to store all of these values for each vertex.

Does OpenGL provide us with a more elegant/viable way to achieve the same result with a more reasonable memory consumption or do I have to swallow the bitter pill?

sentences:
Demo (and real game) Protection In a few months I plan to start showing off the (hopefully commercial) game I'm working on to the public (internet). The thing is, besides screenshots and a trailer (of say feature functionality), how does one properly go about making a demo that can be protected?

Let me explain a bit. The game is a cross-platform RPG of a sort. Right now, the way I have the game coded is that it reads in map, character, etc data from files and that decides everything which allows me to expand the world/story just by config files and adding assets.

Meaning, my worry is if I make a demo version of the game, which is say the real game but then all the assets/config files/etc are removed so that its just a demo with the very first map/level. Is there a way to protect against someone just then putting out the datapack of the real game (when released) and now suddenly anyone with the demo EXE can play the real game?

The demo protection is kinda my first priority as I want the demo out there for a while before the real game is released.
I can always decide on what protection methods I choose from the real game later (before release, but still later.. )

I guess it boils down to is there any real way to protect the game anyway (I don't want to restrict users to having to do any online checks because this game will be cross-platform and not require internet to play it). Last thing I want to do is mess with legit users. And I'd like to leave the assets open if possible since that just means easily patching folders and allowing modders to mess around a bit.

I mean, even if I set up a basic key license system, whats really stopping 1 person from uploading their key and a copy of the game somewhere? I've seen people talk about doing frequent updates so that the binary changes and they have to re-crack the game. But, who needs to crack the game at all when you can get 1 legit copy and then spread it around?

I'm not sure if maybe I'm missing something, I'm just trying to make sure I'm not. Does it really just boil down to:

Slap basic key license protection on it.
Remove asset/config files from demo
Hope for the best

Any and all advice is appreciated! I'm very new to all this ; - ;)

Sorry if this is a duplicate! Couldn't find much on the demo concept.

sentences:
Can Event Triggers be used on Non-UI objects? Is there any way to use UI-Based event triggers on Non-UI objects?

Example : on any UI object, you add an EventTrigger component, set the event, and then set the actions for the event. Its easy, and clean, to make UI do various actions on things like mouse enter / exit, drag, etc.

For non UI objects (a cube, for example) these kind of things are mostly done through scripts with raycast code. Its not impossible, but I find it messier, harder to organize, and less flexible then the EventTrigger approach.

I'm working on a turn based strategy type game. Much of the game mechanics is based around mouse movement and clicking. I tried just adding an on-click event to a cube, but it didn't do anything.

Is this scenario just plain not supported?

sentences:
LibGDX polygon caching I am developing an Android game using LibGDX and I have big world map made of polygons.

I use PolygonSprite and PolygonSpriteBatch, when I render map, I get 30-35fps and it feels laggy. I wonder if there is a way to cache polygons like sprites in SpriteCache and is it a good idea to cache part of the map which is currently on camera?

sentences:
Update DXGI swapchain sample count without recreating swapchain in full-screen mode I'm implementing the ability to tweak graphics settings in my application at runtime (resolution, refresh rate, v-sync, multisampling).
It is possible to update the resolution, format and refresh rate using IDXGISwapChain::ResizeTarget and IDXGISwapChain::ResizeBuffers. However, I cannot find any way to update the swapchain's sampling(count and quality) in the same way. The only option I have is to go to windowed mode using IDXGISwapChain::SetFullscreenState, then release the swapchain, recreate the swapchain with a new DXGI_SWAP_CHAIN_DESC, and then go back to fullscreen again. (Didn't mention releasing and recreating back buffer and depth stencil since it is a must do).I am willing to stay at full-screen mode before and after the settings are applied.

sentences:
How to prevent a cube from falling through a plane in Unity I am trying to prevent a player cube from falling through the plane (Battleground) in Unity, but after adding Mesh collider to both the cube and plane, as well as adding a rigidbody, nothing seems to work. The only way I can prevent this from happening is by locking the y axis of the cube, but this is a problem because I am adding in a jumping ability, and the player needs to be able to fall of the map. Is this something I can do within the Unity editor, or do I need to make a script that does that.

To verify, all 3 colliders have "Is Trigger" Enabled, the platform is not designed to be moved, so the X, Y and Z of both the plan's rotation and position are locked, and the material for the colliders are all default. Each of the cubes and the plane's material are custom (Not the collider's material). The X, Y and Z of the cube's rotation are locked. Both cubes have the tag 'player'

The code for player movement is:

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

public class PlayerMove : MonoBehaviour {
    private Rigidbody rb;
    // Use this for initialization
    void Start() {
        rb = GetComponent<Rigidbody>();
    }

    //Update is called once per frame
    void FixedUpdate() {
        float h = Input.GetAxis("Horizontal") * 5;
        float v = Input.GetAxis("Vertical") * 5;

        Vector3 vel = rb.velocity;
        vel.x = h;
        vel.z = v;
        rb.velocity = vel;
    }

}
```

sentences:
Get the difference between 2 matrices Hi I'm using C# and MonoGame, and have the world matrices of 2 objects. I need to get the difference between them, so I can effectively parent the second object onto the first. The aim is to get to a point where any changes to the parent transform can be applied to the child object too, by doing child.Transform = parent.Transform * offset.

I'm using the following code:

// ...

Matrix m1 = info.BoneTargets[i].Transform;
Matrix m2 = rigidbodyDefaultWorlds[transform.RigidBodyIndex];

Matrix transformFromTargetToRigidBody = Matrix.Invert(m1) * m2;
Debug.Assert((m1 * transformFromTargetToRigidBody).Equals(m2)); // FAIL

// ...

The Assert fails though, so I assume my math is wrong. I did try all other variations of the invert(a) * b formula though and none of them worked either.

For completion here are the matrix values:

M1  {M11:1 M12: 2.384186E-07 M13:-6.211763E-22 M14:0} {M21:0             M22:0             M23:1            M24:0} {M31:2.384186E-07  M32:-1            M33:0             M34:0} {M41:0.0005292654 M42:-0.03780181 M43:0.752234  M44:1}
M2  {M11:1 M12:-2.384186E-07 M13:0             M14:0} {M21:-3.884332E-14 M22:-1.629207E-07 M23:1            M24:0} {M31:-2.384186E-07 M32:-1            M33:-1.629207E-07 M34:0} {M41:0.01058531   M42:0.7560362   M43:-17.54894 M44:1}
TR  {M11:1 M12:-4.768372E-07 M13:-3.884332E-14 M14:0} {M21:4.768372E-07  M22:1             M23:1.629207E-07 M24:0} {M31:-3.884332E-14 M32:-1.629207E-07 M33:1             M34:0} {M41:0.01005606   M42:0.7938381   M43:-18.30118 M44:1}
OUT {M11:1 M12:-2.384186E-07 M13:-6.211763E-22 M14:0} {M21:-3.884332E-14 M22:-1.629207E-07 M23:1            M24:0} {M31:-2.384186E-07 M32:-1            M33:-1.629207E-07 M34:0} {M41:0.01058531   M42:0.7560362   M43:-17.54894 M44:1}

EDIT: Actually, now I'm thinking the formula is this...

child.World = childTransformWithOffsetTranslation * parentWorld

sentences:
How can I draw a perspective-correct quad? I'm trying to draw a quad in 2D (in SharpDX, but that is basically XNA). But texture correction is not working, and I'm getting only an affine textured quad.

I'm using BasicEffect to render it.

BasicTextureEffect = new BasicEffect(Device)
{
    Alpha = 1.0f,

    TextureEnabled = true,
    LightingEnabled = false,
    VertexColorEnabled = true,

    Projection = Matrix.OrthoOffCenterLH(0.0f, ScreenWidth, ScreenHeight, 0.0f, 0.0f, 1.0f),
};

It is an 2D isometric game. I have pseudo-3D coordinates in isometric world (it's a shadow on the ground) converted to screen space, and then rendered using DrawQuad.

Do I need to set-up view (or projection?) somehow, to real 3D (emulate the isometric camera), and then draw this quad in 3D coordinates instead? How eventually? Or is there a way to correct this in 2D?

Update:

I've uploaded the actual partial screen-shot (Figure A), for you to see it's almost the same. (I cut it a bit, but it goes all to the corner)

            Figure A                                         Figure B

Update 2:

I can confirm now, that plain SharpDX (XNA) BasicEffect does this with just plain UW mapping (4 corners of a square), and plain DrawQuad. I've temporarily changed it to include center point, and I do draw 4 triangles instead of 2 (Figure B), this reduces effect to minimum, but it's still there. It still needs to be solved, because I won't be using it only on shadow.

sentences: How to export unity project to play in HTC Vive? I have an Unity project which I want to export and use in HTC Vive. How do I do that and in addition is there any resource online which I can use to refer how do I code to use the controllers for HTC Vive?

sentences:
Elegant ways to handle rendering with DirectX 11 I'm looking for a design pattern that's going to help me to elegantly handle the rendering of my game objects.

Lots of game development guides talk about how to handle the game objects themselves, like monsters and characters and all that kind of thing. Nothing talks about linking all of that to DirectX. All the DirectX guides avoid good architecture in favour of getting something simplistic working.

The problem I am essentially having (that nobody seems to want to answer or give guidance on) is how to elegantly handle the COM objects that the DirectX 11 API gives us. I want to come up with a method of controlling how my COM objects are constructed and destructed, to protect my program from wanton destruction of these objects. I want them to be safely housed. The method of housing is consistently the stumbling block. I need the device and the device context in various parts of the program, but I want to avoid coupling every aspect of my program tightly to that.

I don't, for example, want a d3d "manager" object that I'm going to be passing all and sundry into with different methods for rendering the specific type of object I'm passing in. I don't want to have to be passing raw pointers to COM objects to every single method I create.

Ideally I don't want to be building a rigid, hard coded rendering pattern into my main() function or an equivalent Render() method of a cMain class.

I'm ok with how the COM objects interact together, all the interfacing with the DirectX API to achieve rendering. What I'm looking for is someone with experience of modelling a rendering engine, the bit that actually takes objects and renders them in a certain way and order based on a number of conditions. I'm looking for more generalised information on how I should go about designing the rendering element of my game to meet my needs.

My current solution, which includes:

class cMain {
public:
    cMain();
private:
    void Render();
    cD3D m_d3d; //<---- this class initializes and encapsulates all my d3d com objects
};

cMain::Render()
{
    float colour[4] = {0.2f, 0.4f, 1.0f, 1.0f};
    m_d3d.GetDevCon()->ClearRenderTargetView(&m_d3d.GetRenderTarget(), colour);
    m_d3d.GetSwapChain()->Present(0, 0);
}

And an entire philosophy built on that. Surely there's a more elegant way of designing it? I'm running the risk of coupling cD3D to everything using this method, or having all my render work in cMain, neither of which seem particularly sensible.

Alternatively, am I thinking about this too much? Is this the kind of thing that CAN go in my main class without sacrificing too much flexibility?

TL;DR - I'm having trouble wrapping my head around how I should approach building a rendering engine architecture that will accept all the different types of objects I want to render, including but not limited to game units, terrain objects, particles, etc.

I figure how I handle resource loading and access will be linked relatively tightly to how I handle the rendering process, and I want to get it right early on to minimize problems encountered at later stages.

sentences:
WebGL CORS error loading simple texture in Chrome Here's my code:

function loadTexture() {
    textureImage = new Image();

    textureImage.onload = function() {
        setupTexture();
    }

    textureImage.src = "jumper2.png";
}

function setupTexture() {
    texture = gl.createTexture();

    gl.bindTexture(gl.TEXTURE_2D, texture);
    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);

    // this next line has the error: Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, textureImage);
    gl.texParameteri(gl.TEXTURE_2D, gl.OES_TEXTURE_FLOAT_LINEAR, gl.NEAREST);

    if (!gl.isTexture(texture)) {
        alert("Error: Texture is invalid");
    }

    glProgram.samplerUniform = gl.getUniformLocation(glProgram, "uSampler");
    gl.uniform1i(glProgram.samplerUniform, 0);
}

I've researched it and it is a CORS error a "Cross-origin resource sharing" error, but it's a local file! I can't figure out what's wrong.

I did make the picture using gimp, and I'm not sure the coding was right on the export, but I eliminated a previous error using "gl.OES_TEXTURE_FLOAT_LINEAR".

sentences:
The A * algorithm in the map has many moving objects I am using the A * algorithm for my game, it is a kind of Isometric map with lots of tiles. If all the game objects are trees, rocks, houses and only one game object is a moving hero, the A * algorithm works well because then all objects are objects static except for my hero. I use a function: Check_Block (i, j) where i is the row and j is the column of the map. This function will return false if at that location there is a rock or house or tree, etc. But if there are many heroes moving together, I will not be able to use this function because the heroes are not in position permanent.

I have a solution if the hero is in a certain cell, Map [i] [j] = Hero. But if there are many heroes in the same box, I think this solution no longer good.
Can someone show me a solution?

sentences:
Is it possible to use an image, sound or font without importing them externally? [SDL2] It's hard to explain my question, but I will try my best.

When loading sounds, images or fonts in SDL2 (with SDL_image, SDL_mixer, SDL_ttf) you need to load them from an external source path. For example, res/image.png - the issue I have with this is that the user can edit this file which changes the look of the game.

Is there a way in loading the asset internally? (If that's the right term?) So that it cannot be edited by other people.

Thanks.

sentences:
When entities don't draw themselves, who actually does? There are countless questions here about whether entities should draw themselves or not. The answer is almost universally no, there should be a renderer. And I do see a point in having a single place where everything is rendered. Makes asset management easier and the code less convoluted.

However, I'm struggling to find a good approach to implement this in my 2D game. Currently, every entity is told to draw itself, and I pass the renderer object to it. Now, I want the renderer to draw each entity, but I don't want the renderer to actually know about entities, so I need a more generic class, e.g. RenderObject, and a way to construct render objects from entities.

One obvious approach would be to have a GetRenderObject() method on each entity. However, some of my entities actually draw multiple textures, relative to their position, so I'd probably need a GetRenderObjects() function instead.

But that wouldn't really remove any rendering logic from my entities. I'd still have to refer particular assets and their positions relative to the entity position in the render objects I create.

So my question is: Doesn't having a renderer mean that my entities don't have any drawing logic anymore? If so, who will generate these render objects? Does it even make sense to take the render objects detour?

And, bonus question: How can this work together with a UI system? I'd rather not have the renderer know about widgets and containers and such, so my hunch so far is to have widgets stick to drawing themselves.

sentences:
Problem with Quaternions and Unity's Euler Angle Convention So I want to rotate an UI-Element according to my magneticHeading, I just want to apply the magnetic heading to the z rotation in EulerAngles. So I tried to do so, which brought me to some weird rotations, then I tried this :

transform.rotation = Quaternion.Euler(transform.rotation.z, transform.rotation.x, transform.rotation.y);

Which also lead to some weird rotation, but I don't understand why, since in my understanding this should actually do nothing to the rotation...

This:

transform.rotation = transform.rotation;

is working again, like I expected it and does nothing to the rotation.

Can someone explain me why the Quaternion.Euler stuff is not working and how I can fix my problem?

Solution :

    transform.Rotate(0, 0, -temp.z);
    transform.Rotate(0,0,Input.compass.magneticHeading);
    temp = transform.rotation.eulerAngles;

So I'm reseting the Rotation first and then set the z value to the magneticHeading, the reset with Quaternion.identity did not work for me, so I just subtracted the last value.

sentences:
What is the purpose of adding non-gameplay elements to a game? As an example, I'll reference scientists in Jetpack Joyride.

I do understand there are achievements that involve scientists, that you can kill them or you have a nerd repellent, but I am not asking about any of those.

I want to understand whether there is any very important reason to have such an element in a game, since (at least initially) it seems quite insignificant.

More precisely, does the presence of scientists (or any equivalent, apparently insignificant "actor" in a game) has any psychological effect or influence of any kind to the players? Or they are simply there as a small little feature of the game that barely makes any difference to the player's feelings & attitude whilst playing the game?

sentences:
Why cant I use slick-util with image IO and bufferedImage My problem is that I get errors when I use

texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("TEXTURE PATH HERE"));

it gives me these errors:

Exception in thread "main" java.lang.RuntimeException: No OpenGL context found in the current thread.
    at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
    at org.lwjgl.opengl.GL11.glGetError(GL11.java:1277)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:226)
    at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:184)
    at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:64)
    at org.newdawn.slick.opengl.TextureLoader.getTexture(TextureLoader.java:24)
    at game.Map.Init(Map.java:34)
    at game.Game.start(Game.java:17)
    at game.Game.main(Game.java:63)

My code uses ImageIO, Buffered Image and image.getRGB();
But it also uses the Slick-Util library for loading textures to render.

The full code for the Map.java class is:

`
package game;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;
import org.lwjgl.opengl.GL11;
import org.newdawn.slick.Color;
import org.newdawn.slick.opengl.Texture;
import org.newdawn.slick.opengl.TextureLoader;
import org.newdawn.slick.util.ResourceLoader;

public class Map {

    int mapSize=100;
    int[] Tiles = new int[mapSize+1];
    int Tile;

    public Texture texture;

    public void Init()
    {
        try {
            // load texture from PNG file
            texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/Tiles/Grass.png"));

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

     public void LoadMap()
        {

            File file= new File("res/map.png");
              BufferedImage image = null;
            try {
                image = ImageIO.read(file);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            for(int Y = 0;Y<image.getHeight();Y++){
                for(int X = 0;X<image.getWidth();X++){

              int clr=  image.getRGB(X,Y);
              int  red   = (clr & 0x00ff0000) >> 16;
              int  green = (clr & 0x0000ff00) >> 8;
              int  blue  =  clr & 0x000000ff;
              if(red==0&&green==0&&blue==0){
                  Tiles[Tile]=0;
              }
              if(red==255&&green==0&&blue==0){
                  Tiles[Tile]=1;
              }
              if(red==0&&green==255&&blue==0){
                  Tiles[Tile]=2;
              }
              if(red==0&&green==0&&blue==255){
                  Tiles[Tile]=3;
              }
              Tile++;
            }
            }
            for(int i = 0;i<mapSize;i++)
            {
                System.out.println(Tiles[i]);
            }

        }
     public void RenderMap()
     {

     }

}
`

So all I want to know is how can I fix this error and draw the textures down in the

 void Render()
    {

    }

method.

Thanks, Griffin.

sentences:
UGUI scripts stop my project from building Unity 2019.2.21

I am trying to build out my project to Android and I am getting the following error messages:

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Toggle.cs(121,18): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\DefaultControls.cs(152,13): error CS0103: The name 'Undo' does not exist in the current context

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\GraphicRebuildTracker.cs(24,32): error CS0117: 'CanvasRenderer' does not contain a definition for 'onRequestRebuild'

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\StandaloneInputModule.cs(159,25): error CS0234: The type or namespace name 'EditorApplication' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Slider.cs(380,18): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Scrollbar.cs(168,18): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Selectable.cs(771,48): error CS0234: The type or namespace name 'SceneManagement' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

H:\unity versions\2019.2.21f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\InputField.cs(2458,43): error CS0234: The type or namespace name 'PrefabUtility' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

I tried updating Unity(from 2019.2.12 to current).
Deleting some csproj files, and different settings in the Project settings/Player.
The problematic code is in an #if UNITY_EDITOR statement, and not meant to execute at all on builds, I guess.

#if UNITY_EDITOR
        protected override void OnValidate()
        {
            base.OnValidate();

            if (!UnityEditor.PrefabUtility.IsPartOfPrefabAsset(this) && !Application.isPlaying)
                CanvasUpdateRegistry.RegisterCanvasElementForLayoutRebuild(this);
        }

#endif // if UNITY_EDITOR

sentences:
Cut a translucent square in a texture How to remove (cut-out) a transparent rectangle in a Texture, so that the hole will be translucent.

On Android I would use the Xfermodes approach:

https://stackoverflow.com/questions/8115732/how-to-use-masks-in-android

But in libgdx I will have to use opengl. So far I almost achieved what I was looking for, by using the the glBlendFunc  From this nice and very helpful page I learend that

glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);

should  solve my problem, but I tried it out, and it did not quite work as expected:

batch.end();
batch.begin();

batch.setBlendFunction(GL20.GL_ZERO,
        GL20.GL_ONE_MINUS_SRC_ALPHA);
// Draw the background
super.draw(batch, x, y, width, height);
// draw the foreground
mask.draw(batch, x + innerButtonTable.getX(), y
        + innerButtonTable.getY(), innerButtonTable.getWidth(),
        innerButtonTable.getHeight());
// result = {foreground}*{0,0,0,0} +
// {background}*(1-sourceAlpha)

batch.end();
batch.setBlendFunction(GL20.GL_SRC_ALPHA,
        GL20.GL_ONE_MINUS_SRC_ALPHA);
batch.begin();

It is just making the mask area plain black, whereas I was expecting transparency, any ideas.

This is what I get:

This is what I expected:

sentences:
Primitives does not show on screen I'm trying to render terrain, everything compiles fine, but I can't see anything on screen. ( I'm moving camera around in case it was on the other side)

Can't figure out whats wrong.

public class Terrain
    {
        public VertexBuffer vertexBuffer;
        public IndexBuffer indexBuffer;
        public VertexPositionNormalTexture[] vertices;
        public int[] indices;
        //int gridSize;

        Camera camera;
        ContentManager Content;
        GraphicsDevice device;

        Texture2D heightmap;
        public Texture2D grass;

        Effect effect;

        public Terrain(ContentManager Content, GraphicsDevice device, Camera camera)
        {
            this.Content = Content;
            this.device = device;
            this.camera = camera;

            heightmap = Content.Load<Texture2D>("Gfx//heightmap");
            grass = Content.Load<Texture2D>("Gfx//grass");

            effect = Content.Load<Effect>("Effects//terrain");

            CreateVertices();
            CreateIndices();
        }

        public void Draw()
        {
            effect.CurrentTechnique = effect.Techniques["Texture1"];
            effect.Parameters["xWorldViewProjection"].SetValue(camera.worldMatrix * camera.viewMatrix * camera.projMatrix);
            effect.Parameters["xTexture"].SetValue(grass);

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

                device.DrawUserIndexedPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, indices.Length / 3);
            }
        }

        private void CreateVertices()
        {
            vertices = new VertexPositionNormalTexture[heightmap.Width * heightmap.Height];
            for (int x = 0; x < heightmap.Width; x++)
            {
                for (int y = 0; y < heightmap.Height; y++)
                {
                    vertices[y * heightmap.Width + x].Position = new Vector3(x, 0, y);
                    vertices[y * heightmap.Width + x].Normal = new Vector3(0, 1, 0);
                    vertices[y * heightmap.Width + x].TextureCoordinate = new Vector2(y, x);
                }
            }
            //device.SetVertexBuffer(vertexBuffer);
        }

        private void CreateIndices()
        {
            indices = new int[(heightmap.Width - 1) * (heightmap.Height - 1) * 6];
            int counter = 0;
            for (int x = 0; x < heightmap.Width - 1; x++)
            {
                for (int y = 0; y < heightmap.Height - 1; y++)
                {
                    int lowerLeft = x + y * heightmap.Width;
                    int lowerRight = (x + 1) + y * heightmap.Width;
                    int topLeft = x + (y + 1) * heightmap.Width;
                    int topRight = (x + 1) + (y + 1) * heightmap.Width;

                    indices[counter++] = topLeft;
                    indices[counter++] = lowerRight;
                    indices[counter++] = lowerLeft;

                    indices[counter++] = topLeft;
                    indices[counter++] = topRight;
                    indices[counter++] = lowerRight;
                }
            }
        }
    }

sentences:
How can I call a native mobile API in Construct 2? How can I use mobile API features in a Construct 2 game (HTML 5/JavaScrit engine)?

I didn't find anything about that on the net, unlike other game frameworks like Corona Enterprise or Cocos2d.

sentences:
SDL 2 SDL_BLENDMODE_BLEND way faster. Why? I was just tinkering around with a simple ecs, when I noticed drawing like 20,000 rectangles killed my
framerate (~10 FPS). I thought ok, maybe it's just too many.
Later I wanted to draw them transparent and set the blend mode to SDL_BLENDMODE_BLEND. Now I can draw
around 60,000 of them with 60 FPS.
I figured maybe it's because of pixel format conversion or something alike. When I use getWindowPixelFormat I get RGB888. No I'm even more confused because of the lacking alpha channel.
Code (abbreviated):
SDL_Window *window  = SDL_CreateWindow("Test",
                                       SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
                                       1280, 720,
                                       wndFlags);

SDL_Renderer *renderer  = SDL_CreateRenderer( window, -1,
                                             SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
while(running) {
SDL_RenderClear(renderer);
SDL_SetRenderDrawColor(renderer, 0xFF, 0x00, 0xFF, 0xFF);
SDL_RenderFillRect(renderer, &rect);
SDL_RenderPresent(renderer)
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
}

Could someone enlighten me please?

sentences:
2D Motocross physics I'm looking into making a 2D motocross bike game with plausible physics.

It should look like this:

For a first try, I've created only the player (a motocross driver) and the map (consisting of only straight lines; no curves, to keep it simple).

How should collisions between the motocross bike and the track affect the bike's position and velocity? The bike should rotate if only one of the wheels touches the ground and speed up if the back wheel touches the ground. Pretty standard bike game stuff.

How do I achieve this behaviour?

sentences:
Move objects in array with positions array I am trying to get a line of spheres to move around but all i get is the first sphere to move and get the rest to follow as one instead of building a sort of a train of spheres. Any idea how to alter the code to get it right?
In the code bellow i get the first pbject in listBalls to move nicely along the Bezier curve but the rest move as one and overlap with the first sphere too.
    void Update()
{

    t += Time.deltaTime * 0.2f;
    ballPosition = Mathf.Pow(1 - t, 3) * p0 + 3 * Mathf.Pow(1 - t, 2) * t * p1 + 3 * (1 - t) * Mathf.Pow(t, 2) * p2 + Mathf.Pow(t, 3) * p3;
    positions.Add(ballPosition);
    listBalls[0].transform.position = positions[j];
    for (i = 1; i < listBalls.Count; i++)
    {
        Transform ball = listBalls[i].transform;
        Transform nextBall = listBalls[i - 1].transform;
        if ((ball.position - nextBall.position).magnitude > 1f)
        {
            ball.position = positions[j];
        }
    }
    j++;

Feels like it should be something easy, setting the N-1 balls to same position as the first ball must be wrong. I tried setting them at positions[j-2] but it didn't work either.
Edit:
the Spheres should start rolling left to right one after the other eventually all 10 should be on the screen and when they reach P3 they should restarting the rolling.

listBalls is the List with 10 spheres
positions is the List with 50 Vector3 positions along the curve.

[![enter code here][2]][2]

sentences:
It is possible to process data on relay servers? I have a small game engine done in Java, and re-creating it on C++. While re-creating it i've decided on adding basic p2p online multiplayer. However, after reading more about networking, there are multiple models, and the Client-server host with relay model seems attractive, since it overcomes most of NAT issues of port fowarding and does not expose players public IP.
My point is - can a relay server be used to do some minimal data processing? The goal is not to use a dedicated, full featured server application, but just do minimal calculations on the data to detect some basic cheats.
For example: Preventing internal speed hacks by sending the system timestamp every 60 cycles, and then the relay would store the previous time stamp and compare the next one, if the time difference is less than 1000ms, disconnect the player.

sentences:
How are you handling scores that can worsen (e.g. Elo rating) in Game Center? Currently, Game Center leaderboard scores can only change one-way (e.g. increase). This makes it impossible (I think) to deal with Elo ratings and the like. How are you getting around this in your leaderboards?

I have filed a bug report / feature request with Apple already FWIW.

Are you using a third-party leaderboard service? Rolling  your own?

sentences:
How do I control multiple Pawns without possesing them (RTS style)? I am making a multiplayer RTS but I have a problem controlling spawned units (let's call them Vessels), specifically moving them around with AI MoveTo bp.
Vessels can be created by both Clients and Server and are visible for everyone but neither clients nor Server can move Spanwed Vessels.
Only Vessels placed on the map beforehand can be moved and ONLY by the Server.
Also, the server sees all Client CameraPawn movements and clients see Server CameraPawn movements BUT clients don't see each other's CameraPawn Movements (if this is related somehow...)

How can I control a pawn in multiplayer from all clients for starters?
How can I limit control to a specific controller?
Why "preplaced" Vessels work(move) for Server only?

sentences:
game maker stop overlapping buildings I'm trying to make a game with real time strategy elements, where you can build several different buildings.

The problem is that I can't seem to make the buildings stop overlapping. That is too say, if try to build while my mouse is hovering over a building, it won't build, which is good.

But the moment that my mouse is no longer over a building, I can build again. And since the buildings have a centered origin, the building is build around the coordinates where the mouse is. This causes overlap between buildings, which is bad.

I have the following code in a step event of a control object:

if (mouse_check_button_pressed(mb_left)) {
  if (!position_meeting(mouse_x, mouse_y, all)) {
      instance_create(mouse_x, mouse_y, obj_shed);
      player_money -= 100;
  }
}

Any help would be greatly appreciated.

EDIT: The code now follows the suggestions of Despicable and looks as follows:

var object, width, height;
object = obj_shed; //Change to your desired object
w = object.sprite_width;
h = object.sprite_height;

if (mouse_check_button_pressed(mb_left)) {
  if (!collision_rectangle(mouse_x-w/2,mouse_x+w/2,mouse_y-h/2,mouse_y+h/2,all,0,1)){
    instance_create(mouse_x,mouse_y,obj_shed);
    player_money -= 100;
  }
}

However, w and h give an error, so now i need to find a way how to get the width and heigh of an object that is not the calling instance (because the calling instance is a control object, in which is code is situated)

EDIT: Solution

I was able to change the solution so that the buildings won't overlap, even if the buildings aren't circular:

In the control object, in the step event, write the following:

if (mouse_check_button_pressed(mb_left)) {
      instance_create(mouse_x, mouse_y, obj_shed);
}

And in the create event of your building (shed in my case):

if (!place_meeting(mouse_x, mouse_y, all)) {
      global.player_money -= 100;
}
else {
    instance_destroy();
}

So on creation of the building, it checks if there is a collision. If so, it destroys itself. If not, it stays there and deducts the cost of the building. This works with any shape of building.

sentences:
Canvas/Paint Mechanic I'm currently working on an idea for a Unity game app with a canvas mechanic. I understand I may have to use particles for the brush/paint f/x however I can not think of a way to add collision detection let alone the paint itself...onto a canvas...
Any suggestions are much appreciated!

sentences:
Game mechanics patterns database? Do you know http://tvtropes.org ?

It's a kind of wiki/database with scenaristic tropes, patterns that you can find in tones of stories, in tv shows, games, books, etc.

Each trope/pattern have a (funny) name and there are references to where it appears, and the other way arround : each book/game/etc. have a list of tropes that it contains.

I'm looking for an equivalent but for game mechanics patterns, something like "Death is definitive", "Perfect physical control (no inertia)", "Excell table gameplay", etc.

I think it would be really useful. I can't find an equivalent for game mechanics (tvtrope is oriented to scenario, not game mechanics).

Do you know any?

sentences:
pause function for x amount of time I've read up on several ways of doing this but can't seem to find one that works for what I need. I have a method that is called and performs some logic, and then I need it to wait for a period of time, then continue with more logic in the same function. I had planned on using a coroutine which is what I did with another part of the game, but I'm running into an issue because the class doesn't directly inherit from Monobehaviour so it can't start a coroutine. I've tried Thread.sleep, but that just makes the game stop, so that isn't what I want. I don't know if there is some way to put a timer in there that will wait and then continue the function or if there is something else that I'm overlooking.

Here is the current code:

public void AssaultRifleShot (GameObject mainBall)
{
    if (AmmoRemaining > 0)
    {
        //if there is ammo remaining, set the main ball to just a normal ball so it can be destroyed on impact and then start coroutine
        mainBall.GetComponent<Ball> ().mainBall = false;
        mainBall.GetComponent<Ball> ().onBallHitPaddle -= AssaultRifleShot; //unsubscribe to event when mainBall is set to false.
        StartCoroutine(timer, coroutineHost);

        AmmoRemaining -= 1;
    }
    else
    {
        DestroyPickUp();
    }
}

There are other method calls inside the code for the coroutine, so those would end up going after whatever timer or someting goes in instead of the coroutine.

sentences:
How do I properly change the value of a prefab'd instance variable? I am currently following a tutorial on how to make a 2D platformer in Unity.

The tutorial explains how to make an enemy wave spawner, but it doesn't explain how to make enemies stronger after I have completed a certain amount of waves.

So, to explain: I have an Enemy class, which has an EnemyStats class in it:

public class Enemy : MonoBehaviour
{
    [System.Serializable]
    public class EnemyStats
    {
        public int damage = 20;
        public int maxHealth = 100;

        public int CurrentHealth
        {
            get { return _currentHealth; }
            set { _currentHealth = Mathf.Clamp(value, 0, maxHealth); }
        }

        private int _currentHealth;

        public void Init()
        {
            CurrentHealth = maxHealth;
        }
    }

    public EnemyStats stats = new EnemyStats();

    private StatusIndicator statusIndicator;

    void Awake()
    {
        stats.Init();
        statusIndicator = transform.Find("StatusIndicator").GetComponent<StatusIndicator>();

        if (statusIndicator != null)
        {
            statusIndicator.SetHealth(stats.CurrentHealth, stats.maxHealth);
        }
    }
}

And in the WaveSpawner class I have the method to spawn the enemy:

private void SpawnEnemy(Enemy enemy)
{
    Transform sp = spawnPoints[UnityEngine.Random.Range(0, spawnPoints.Length)];

    if (CurrentWave % 5 == 0)
    {
        enemy.stats.maxHealth += 20;
    }

    Instantiate(enemy.transform, sp.position, sp.rotation);
}

In the WaveSpawner you can set a certain number of waves (let's say 5), and after you complete all of the waves I've set them to repeat.
So after I beat the 5 waves, I want the 5 waves to repeat and the enemies to be stronger (for example to have their max hp increased by 20).

I do that with the line: enemy.stats.maxHealth += 20;

But the problem here is that after this line is executed and I Instantiate the enemy prefab, the prefab changes its value in the inspector. So let's say that the initial value of the prefab was 120, after I beat the 5 enemy waves, the value of the prefab is set to 140. Then, after I reset the game, the initial value of the prefab is 140 and the max health of the first enemies is 140 and not 120.

I have tried to not change the maxHealth variable of the EnemyStats class, but instead to have another variable tempMaxHealth and do the changes on it. This doesn't resolve my problem, as other problems arise and I don't know what to do anymore.

I hope that you have an answer for me, I would be grateful if that's the case.

sentences:
Water drops on camera How can I create water drops on camera something like we see in Ripitude GP,

I tried using Unity's default GlassStainedBumpDistort shader though its performance heavy on mobile plus it do not let animate water drops.

sentences:
Creating a list of buttons dynamically in code I have a list of contacts. I need to create a scrollable list of buttons that are created dynamically so I can add each contact name as the button text. How would I do this all in code? My biggest concern is making sure the sizes stay consistent. I haven't had to do that in code before.

EDIT:

And here is the code to add the buttons to this:

for (int i = 0; i < count; i++)
{
    if (i > 0)
        crt.sizeDelta = new Vector2(crt.sizeDelta.x, crt.sizeDelta.y + initHeight);
    GameObject contactButton = Instantiate(Resources.Load("Contact Button")) as GameObject;
    contactButton.transform.parent = contactsList.transform;
    contactButton.GetComponentInChildren<Text>().text = names[i];
}

sentences:
Array Rectangle Collision Handling Inconsistency XNA 4.0 I made a simple collision detection prototype.Here's the code for the Player class's collision handler:

public void handleCollision(GameObject OtherObject)
    {
        if(this.CollidesWith(OtherObject))
        {
            if(OtherObject is Stage)
            {
                float rightEdgeDistance = OtherObject.BoundRect.X - (Position.X + this.BoundRect.Width);
                float leftEdgeDistance = OtherObject.BoundRect.X + OtherObject.BoundRect.Width - Position.X;

                float TopEdgeDistance = OtherObject.BoundRect.Y - (Position.Y + this.BoundRect.Height);
                float BottomEdgeDistance = OtherObject.BoundRect.Y + OtherObject.BoundRect.Height - Position.Y;

                float Left_Right_SmallerDistance = Math.Min(Math.Abs(rightEdgeDistance), Math.Abs(leftEdgeDistance));
                float Top_Bottom_SmallerDistance = Math.Min(Math.Abs(TopEdgeDistance), Math.Abs(BottomEdgeDistance));

                float smallerDistance = Math.Min(Math.Abs(Left_Right_SmallerDistance), Math.Abs(Top_Bottom_SmallerDistance));

                if (smallerDistance == Math.Abs(leftEdgeDistance))
                {
                    Position.X = OtherObject.BoundRect.X + OtherObject.BoundRect.Width;
                    Velocity.X = 0;
                }
                else if (smallerDistance == Math.Abs(rightEdgeDistance))
                {
                    Position.X = OtherObject.BoundRect.X - this.BoundRect.Width;
                    Velocity.X = 0;
                }
                else if (smallerDistance == Math.Abs(BottomEdgeDistance))
                {
                    Position.Y = OtherObject.BoundRect.Y + OtherObject.BoundRect.Height;
                    Velocity.Y = 0;
                }
                else if (smallerDistance == Math.Abs(TopEdgeDistance))
                {
                    Position.Y = OtherObject.BoundRect.Y - this.BoundRect.Height;
                    Velocity.Y = 0;
                }
            }
        }

and here's my Player class's Input Handler method I made:

public void inputHandler(GameTime gameTime,GameObject OtherObject)
    {
        Velocity = Vector2.Zero;

        if (Keyboard.GetState().IsKeyDown(Keys.W))
            Velocity.Y -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (Keyboard.GetState().IsKeyDown(Keys.S))
            Velocity.Y += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (Keyboard.GetState().IsKeyDown(Keys.A))
            Velocity.X -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (Keyboard.GetState().IsKeyDown(Keys.D))
            Velocity.X += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

        handleCollision(OtherObject);
        Position += Velocity;
    }

Also here's my Update method In the Main Game Class.

protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        for (int i = 0; i < 3; i++)
            player.Update(gameTime, stage[i]);
        powerUp.Update(gameTime,player);
        base.Update(gameTime);
    }

It works, but when I use array it becomes buggy for some elements of the arrays as in the character can still move a bit inside of the rectangle when I press the key to go down and it will stay outside of the top of the rectangle only if I let go of the key and vice versa.

The rectangles are an array of 3. If I were to move and test the 3rd box. It will work perfectly.But if test the 2nd, it will sink in a bit and the 1st a bit more than the 2nd.
I use for loop for the update and draw the array elements. I see that the pattern is, the 1st is the first one to be checked in the Main Update method is will suffer the worst collision handling, while the last one will always be perfect. I tried other ways to handle the collision but to no avail. Why is that? And how can I counter this? Help please!

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

sentences:
What game mechanics work best on mobile phones? I teach Swift 3 and Android Studio. My students are always asking why I'm not in the mobile market yet; frankly, I'm migrating my 88 games from flash into native mobile apps ... it takes time. My question is: What game mechanics are most successful in the mobile apps for a profitable endeavor? Puzzle sliders? PacMan-ish chases?

I know there are 7 different methods of input, but which provide fun entertaining games? I could use some advice.

sentences:
Applying multiple forces on a particle If I have a particle, say in a polar coordinate grid, and I want to apply multiple vectors to it, how can I calculate where it's final position will be given those vectors?

Ex. Imagine there's a force represented as a vector, that moves the particle a radius magnitude of 8 at an angle of 45°. Another vector that acts on it at the same time, at magnitude 3 at 90°. How would I calculate the final position of the particle?

sentences:
Moving a platform left to right with continuous movement I made a 2D game with Unity, and I am trying to create a platform that will move from left to right continuously, but I don't know how to make the platform move a greater distance then -1 to 1 units because I use the Mathf.Sin function. I can only control the speed of the platform.

Here is my code:

private Vector2 startPosition;
private int speed;

void Start ()
{
    startPosition = transform.position;
    speed = 3;
}

void Update()
{
    transform.position =
        new Vector2(startPosition.x + Mathf.Sin(Time.time * speed), transform.position.y);
}

Here is what the code actually does:

How can I control the distance that the platform can move to each side? For now, it can only move 1 unit to each side.

sentences:
A problem with texture atlasing in Unity I have the texture below and I need to get rectangular parts from it. I could finally combine meshes of different quads to improve performance, but I with quads of different tilings, this means different materials, then combining meshes will fail.

Can anybody tell me how to have a part of that texture in C#? Such that all quads will be of the same material only then combining meshes passes.

Thanks in advance.

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

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

sentences:
Windows 10 GPU Engine Performance Counters - Phys / Eng Meaning For performance tracing of intermittent degredation in performance I wanted to use the Performance Counters available in Windows 10 1809 under GPU Engine -> Utilization percentage. This particular laptop has NVIDIA GeForce GTX 1050 with 4 GB VRAM + 16GB shared memory.

The instance names look like this:

pid_1388_luid_0x00000000_0x00011372_phys_0_eng_8_engtype_Compute_1
pid_912_luid_0x00000000_0x00010F5C_phys_0_eng_2_engtype_Copy

While I know pid_xxxx is the process identifier, what I am trying to work out the meanings of remaning components.

1) luid_xxxx_xxx

In my case all instances start with luid_0x00000000 and have 3 different endings:

0x00010F5C
0x0001134D
0x00011372

2) Next is phys_0, I assume this is first physical GPU, but I want to be able to programatically translate it to GPU adapater name.

3) Eng_x, on my machine this ranges from 0-12

4) Eng_type have the following. While mostly self explanatory, is the difference between Compute_0 and Computer_1 different cores on the GPU

3D
Compute_0
Compute_1
Copy
GDI
Render
Graphics
LegacyOverlay
Security
VideoDecode
VideoEncode
VideoProcessing
VR

sentences:
How to distort 2d perlin noise? I am using Unity's 2D Mathf.PerlinNoise(x, y) function and I would like to make it distorted. What I mean is described with this picture I made:

How can I do that? What transformations should I apply to Mathf.PerlinNoise(x, y) to achieve this effect?

sentences:
How can I make an instantiation random? I'm trying to do it so when I have an instantiated an item upon the game starting, it is random as to whether it actually instantiates or not. Here's the code I have so far:

public GameObject anyItem;
void Start()
{
    Instantiate(anyItem, new Vector3(0, 0, 0), Quaternion.identity);
    Instantiate(anyItem, new Vector3(11, 0, 0), Quaternion.identity);
}

How can I do it so these items (individually, not both together) are decided randomly as to whether they will actually be instantiated or not?

sentences:
cross resolution level design advice I was looking for some beginner advice regarding level design across multiple resolutions.

I believe the answer is likely "it depends", but any input from anyone with real experience is very appreciated.

Basically, I am building a 2D Super Metroid type game. If rooms/levels are to be a tiled grid, what are some general best practices for designing rooms when taking into account different resolutions?

Since more or less tiles could fit vertically on a single screen depending on the resolution, is it better to design towards possibly having more of the room visible depending on the screen (with a bare minimum needed for gameplay), or should I fix the design at a certain tile height and scale the graphics?

sentences:
How to mimic the same fixed-size horizon as in this racing game? I am trying to replicate the same horizon (buildings and sky) as in the image below:

As you can see, the player has advanced in a straight line, yet the horizon has still the same size:

This is my attempt using 3D, while it's okay when the player is on the start line:

It's not so great when the player advanced as much as in the image no. 2:

This is an overview of where the horizon buildings and sky are located:

Obviously this won't achieve such effect when one is close to it, so I've tried to scale up the horizon on all axes but the problem is that the buildings are too small depending where you look at them from.

How can one mimic such rendering ?

sentences:
Why the state of the duration is all the time 7 even if updating the state inside the while in the ienumerator? I want to get the current coroutine state.

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

public class DepthOfField : MonoBehaviour
{
    public UnityEngine.GameObject player;
    public PostProcessingProfile postProcessingProfile;
    public bool dephOfFieldFinished = false;
    public LockSystem playerLockMode;

    private Animator playerAnimator;
    private float clipLength;
    private Coroutine depthOfFieldRoutineRef;
    private DepthOfFieldModel.Settings depthOfField;
    private DepthField state;

    void Start()
    {
        if (depthOfFieldRoutineRef != null)
        {
            StopCoroutine(depthOfFieldRoutineRef);
        }

        playerAnimator = player.GetComponent<Animator>();

        AnimationClip[] clips = playerAnimator.runtimeAnimatorController.animationClips;
        foreach (AnimationClip clip in clips)
        {
            clipLength = clip.length;
        }

        DepthOfFieldInit(clipLength);

        state = new DepthField();
    }

    public void DepthOfFieldInit(float duration)
    {
        depthOfField = postProcessingProfile.depthOfField.settings;
        depthOfField.focalLength = 300;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }

    public IEnumerator changeValueOverTime(float fromVal, float toVal, float duration)
    {
        playerLockMode.PlayerLockState(true, true);

        float counter = 0f;

        while (counter < duration)
        {
            var dof = postProcessingProfile.depthOfField.settings;

            counter += Time.deltaTime;

            float val = Mathf.Lerp(fromVal, toVal, counter / duration);

            dof.focalLength = val;
            postProcessingProfile.depthOfField.settings = dof;

            state.duration = duration;
            state.focalLength = val;

            yield return null;
        }

        playerAnimator.enabled = false;
        dephOfFieldFinished = true;
        depthOfFieldRoutineRef = null;
    }

    public struct DepthField
    {
        public float focalLength;
        public float duration;
    }

    public void Save()
    {
        SaveGame.Save("depthoffieldstate", state);
    }

    public void Load()
    {
        Time.timeScale = 1f;
        depthOfField = postProcessingProfile.depthOfField.settings;
        DepthField state = SaveGame.Load<DepthField>("depthoffieldstate");
        depthOfField.focalLength = state.focalLength;
        StartCoroutine(changeValueOverTime(depthOfField.focalLength, 1, state.duration));
        postProcessingProfile.depthOfField.settings = depthOfField;
    }
}

Inside the while loop I'm doing :

state.duration = duration;
state.focalLength = val;

The focalLength value does change if for example I save onethe game start the focalLength value will be 299 and if I will save after the coroutine has finished the focalLength value is 1.

But the coroutine duration value is not changing it keep staying on 7 when saving even if the coroutine has finished and should be 0 it still 7.

The value 7 of the duration is coming from the clipLength.

I can't get the current duration time of the coroutine.
In the Load function I'm starting the coroutine over again but since I'm using the loaded focalLength value and duration value it should look like the coroutine is continue from the last saved point. But I can't get the correct duration value when saving.

sentences:
Problem with DirectX scene-graph I'm trying to implement a basic scene graph in DirectX using C++. I am using a left child-right sibling binary tree to do this.
I'm having trouble updating each node's world transformation relative to its parent (and its parent's parent etc.). I'm struggling to get it to work recursively, though I can get it to  work like this:

for(int i = 0; i < NUM_OBJECTS; i++)
{
    // Initialize to identity matrix.
    D3DXMatrixIdentity(&mObject[i].toWorldXForm);

    int k = i;
    while( k != -1 )
    {
        mObject[i].toWorldXForm *= mObject[k].toParentXForm;
        k = mObject[k].parent;
    }
}

toWorldXForm is the object's world transform and toParentXForm is the object's transform relative to the parent. I want to do this using a method within my object class (the code above is in my main class).
This is what I've tried but it doesn't work (only works with nodes 1 generation away from the root)

if (this->sibling != NULL)
    this->sibling->update(toParentXForm);
D3DXMatrixIdentity(&toWorldXForm);
this->toWorldXForm *= this->toParentXForm;
this->toWorldXForm *= toParentXForm;
toParentXForm *= this->toParentXForm;
if (this->child != NULL)
    this->child->update(toParentXForm);

Sorry if I've not been clear, please tell me if there's anything else you need to know. I've no doubt it's merely a silly mistake on my part, hopefully an outside view will be able to spot the problem.

sentences:
Difference between unity scripting backend IL2CPP and Mono2x IL2CPP is a Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. Note - IL2CPP is only available when building for the following platforms:

Android AppleTV, iOS*, Nintendo 3DS, Nintendo Switch, Playstation 4
Playstation Vita, WebGL* ,Windows Store, Xbox One

I have a project(unity 5.2) which has switched for Android deployment. I tried to switch my scripting backed from Mono2x to IL2CPP and its showing me that

  IL2CPP on Andriod is experimental and unsupported

So, my simple question is that if it is still not supported then why the option has included, what is the fundamental difference between IL2CPP and Mono2x. Why I switched to IL2CPP scripting backend ? what are its pros and cons?

I have also checked in unity 5.5.2 there is not IL2CPP option in windows platform deployment.

sentences:
best way to compute vertex normals from a Triangle's list hi
i'm a complete newbie in computergraphics so sorry if it's a stupid answer.
i'm trying to make a simple 3d engine from scratch, more for educational purpose than for real use.

for now i compute only face normals. in this way:

i have a Surface object with inside a Triangle's list. i compute normals inside Triangle class, in this way:

triangle.computeFaceNormals() {
    Vec3D u = v1.sub(v3)
    Vec3D v = v1.sub(v2)
    Vec3D normal = Vec3D.cross(u,v)
    normal.normalized()
    this.n1 = this.n2 = this.n3 = normal
}

and when building surface:

t = new Triangle(v1,v2,v3)
t.computeFaceNormals()
surface.addTriangle(t)

and i think this is the best way to do that.. isn't it?

now.. this works, ok. but light it's not smoothed. i'm trying to compute also vertex normals. (i'm testing my engine with tubolar surfaces so i have almost all vertex shared with more then one triangles)

i've found this simple algorithm: flipcode vertex normal
but.. hei this algorithm has.. exponential complexity? (if my memory doesn't fail my computer science background..) (bytheway.. it has 3 nested loops.. i don't think it's the best way to do it..)

any suggestion?

sentences:
How can I sort vertices efficiently in a specific direction (CW/CCW)? I am trying to triangulate a set of points using a very simple approach where a base vertex is chosen, and then every other vertex is joined to its neighbouring vertex and then back to the base vertex, to create a triangle-fan structure, which creates a solid surface.

The problem with this approach is that in order to triangulate it there is a lot of iterating, and for each triangulation point, it must iterate over the entire list again to find its nearest CW point which is very slow, but works.

    for (int i = 1; i < triangulationPoints.Count; i++)
        {
//this method iterates over available which is a copy of triangulationPoints
//and finds the closest vertex with no backtracking
            Vector3 vertex = findClosestVertex(currentVertex, available, ordered);
//...
available.Remove(vertex);
        }

Now I'm looking to speed up the algorithm so I get the same effect, but faster.

I implemented a binary insert function that sort each point based on distance from the base vertex as it is inserted into the triangulationPoint list which works nicely and is fast, but produces incorrect results as it doesn't take into account the next CW vertex, but any vertex.

Does anyone have any suggestions as to how I can speed this up, or perhaps another triangulation algorithm that is relatively easy to implement which would achieve fast speeds?

Edit
I have tried Unity's triangulator and that produces results that are worse than my attempt. I have also tried a third-party triangulator (https://github.com/CiaccoDavide/Unity-UI-Polygon) and this seems to be exactly what I need, however it only draws on the UI and not in world space.

An attempt at implementing DMGregory's explanation

   Quaternion toPlaneSpace = Quaternion.Inverse(Quaternion.LookRotation(cutter.normal));

    centroidPosition = centroidPosition / sharedIntersectionPoints.Count;

    foreach (Vector3 v in sharedIntersectionPoints)
    {
        Vector3 offset = toPlaneSpace * (v - centroidPosition);

        IntersectionPoint ip = new IntersectionPoint(v, Mathf.Atan2(offset.y, offset.x));

        int index = binaryInsertAngle(new IntersectionPoint(v, Mathf.Atan2(offset.y, offset.x)), 0, points.Count);

        if (index > orderedTriangulationPoints.Count)
        {
            orderedTriangulationPoints.Add(ip.point);
            points.Add(ip);
        }
        else
        {
            orderedTriangulationPoints.Insert(index, ip.point);
            points.Insert(index, ip);
        }
    }

Both the new ordered list and the old ordered list are the same size so it should be stepping over the vertices correctly without missing any.

sentences:
Godot C++ NativeScript version not rendering multimesh instance whereas GDScript version does I am new to Godot. I am aiming to create a RTS game with 10's of thousands of units and for it to run smoothly. So I'm looking to use GDNative C++ with the Visual Server to handle updating and moving the units and GDScript for everything else.
The following script in GDScript successfully renders a single multi mesh cube at the center of the screen.
extends Spatial

func _ready():

    var meshRid=preload('res://new_cubemesh.tres').get_rid()
    var multimesh = VisualServer.multimesh_create()

    VisualServer.multimesh_allocate(multimesh, 1, VisualServer.MULTIMESH_TRANSFORM_3D,
    VisualServer.MULTIMESH_COLOR_NONE, VisualServer.MULTIMESH_CUSTOM_DATA_FLOAT)
    VisualServer.multimesh_set_mesh(multimesh, meshRid)

    var instance = VisualServer.instance_create()
    var scenario = get_world().scenario

    VisualServer.instance_set_scenario(instance, scenario)
    VisualServer.instance_set_base(instance, multimesh)

I have implemented the alternative In GDNative (C++) and while it doesn't crash and does run the code, it does not render the cube. Camera is in correct position to observe the cube at 0,0. I've just re-purposed the GDNative C++ tutorial for now.
I really like the community here and the engine so far, so hopefully I am just misunderstanding something here and it is possible what I am trying to achieve.
Thank you for your time, c++ scripts below.
gdexample.cpp
#include "gdexample.h"

using namespace godot;

void GDExample::_register_methods() {
    register_method("_process", &GDExample::_process);
    register_method("_ready", &GDExample::_ready);
}

GDExample::GDExample() {
}

GDExample::~GDExample() {
    // add your cleanup here
}

void GDExample::_init() {
    // initialize any variables here
    base=5;
}

void GDExample::_ready(){

    visual = VisualServer::get_singleton();
    loader = ResourceLoader::get_singleton();

    Ref<Resource> meshResource = loader->load("res://new_cubemesh.tres");
    RID meshRid = meshResource->get_rid();

    multimesh = visual->multimesh_create();
    visual->multimesh_allocate(multimesh, 1, visual->MULTIMESH_TRANSFORM_3D, visual->MULTIMESH_COLOR_NONE, visual->MULTIMESH_CUSTOM_DATA_FLOAT);
    visual->multimesh_set_mesh(multimesh, meshRid);

    RID instance = visual->instance_create();

    Ref<World> world = get_world();
    RID scenario = world->get_scenario();

    visual->instance_set_scenario(instance, scenario);
    visual->instance_set_base(instance, multimesh);

}

void GDExample::_process(float delta) {
    return;
}

Let me know if you need gdexample.h or gdlibrary.cpp and I can add, the formatting gets messed up if I include them here for some reason. It's basically just the tutorial stuff though.

sentences:
Quickly Converting RenderTexture to Texture2D in Unity3D I have a screenshot preview at the end of the game's level.
When I am loading the screenshot, it makes the game freeze for a moment.
What may I do so there would be no freeze when I am loading that screenshot?
Here is myc ode:

private IEnumerator ShowScreeshotPreview()
        {
    screenshotTexture = new Texture2D(Screen.height, Screen.height, TextureFormat.RGB24, false);
            for (int i = 0; i < 9; i++)
            {
                yield return null;
            }
            RenderTexture.active = Singletons.Get<SpecialEffectsHelper>().MainCharacterScript.GetComponent<GeneratorScript>().screenshotTexture;
            screenshotTexture.ReadPixels(new Rect(0, 0, Screen.height, Screen.height), 0, 0);
    screenshotTexture.Apply();
            RenderTexture.active = null; //Added to avoid errors

            screenshotPrview.mainTexture = screenshotTexture;
    ScreenshotPreviewAnimator.SetBool("visible", true);
            screenshotLoaded = true;

            yield return null;
        }

sentences: How to play Sound of a Destroyed Object So I have implemented grenades, and thats working fine. Now I want some explosion sound, but the problem is that the sound is still playing when the grenade is explode and I Destroy the grenade. Does someone have an idea how to circumvent this? I mean I could disable all Components on the nade so that it's invisible etc. and destroy it after the sound is done playing, but I feel like that's a bit weird.

sentences:
Detecting first or second Mouse Button Release? I want to know how to detect if the user has released the mouse button the first time, or the times after that:

Pseudo-Code:

 if *first* (Input.GetMouseButtonUp(0))
   {
       do something
   }

 if *second, third, fourth..etc.* (Input.GetMouseButtonUp(0))
   {
       do something else
   }

I really have no idea on how to accomplish this. I'm sure it's pretty simple though!

sentences:
How can state changes be batched while adhering to opaque-front-to-back/alpha-blended-back-to-front? This is a question I've never been able to find the answer to. Batching objects with similar states is a major performance gain when rendering many objects. However, I've been learned various rules when drawing objects in the game world.

Draw all opaque objects, front-to-back.
Draw all alpha-blended objects, back-to-front.

Some of the major parameters to batch by, as I understand it, are textures, vertex buffers, and index buffers. It seems that, as long as you are adhering to the above two rules, there's little to be done in regards to batching.

I see one possibility to batch, while still adhering to the above two rules. Opaque objects can still be drawn out of depth-order, because drawing them front-to-back is merely a fillrate optimization, meanwhile state changes may very well be far more expensive than the overdraw of drawing out of depth-order. However, non-opaque objects, those that require alpha-blending at least, must be drawn back-to-front in order to avoid rendering artifacts.

Is the loss of the fillrate optimization for opaques worth the state batching optimization?

sentences:
How to resolve combat of stacks of units to mitigate numerical advantage I just started designing an strategy game where player's armies consist of stacks of units. For my design I was aiming to reproduce the following behaviour for a full combat of multiple turns (for simplicity assume both stacks are the same unit):

1 vs full stack: the single unit is killed, the full stack hardly notices.
half stack vs full stack: the half stack is killed, the full stack sustain noticeable damage.
almost full stack vs full stack: full stack wins but gets almost wiped out. If randomness is involved, any of both may win, although the bigger one has statistical advantage.

My first approach was to add up the stats and treat each stack as a single unit, resolve the combat and then calculate how many units are killed.

That didn't produced the expected results, as even the slight numerical advantage in one side produced it to win by a huge margin.

The reason is that after each turn, the bigger stack would kill more enemies than the smaller, widening the power difference for the next turn. This different increases exponentially until the smaller stack is quickly obliterated.

As a second approach I treated each unit in a stack individually for the combat (something that I wanted to avoid), which produces much better results. However now I have many choices about how to resolve the combat.

Should it be a series of 1 vs 1 or should I allow units to gang up on others?

Should I pair each evenly or randomly?

Should I leave extra units unpaired as "reserve", or all units should fight at least once?

sentences:
Custom FPS Controller in Unity 5.6.6f2 not letting me look up or down Due to the FPS Controller seeming to be broken in Unity now, I started using a custom one by kinifi on GitHub. For some reason though I can't look up or down. I removed the Main Camera so it should of fixed it but no. Is there anything I can change in this script to allow me to look up and down.

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

[RequireComponent(typeof(Rigidbody))]
public class FPS : MonoBehaviour
{

    private float speed = 5.0f;
    private float m_MovX;
    private float m_MovY;
    private Vector3 m_moveHorizontal;
    private Vector3 m_movVertical;
    private Vector3 m_velocity;
    private Rigidbody m_Rigid;
    private float m_yRot;
    private float m_xRot;
    private Vector3 m_rotation;
    private Vector3 m_cameraRotation;
    private float m_lookSensitivity = 3.0f;
    private bool m_cursorIsLocked = true;

    [Header("The Camera the player looks through")]
    public Camera m_Camera;

    // Use this for initialization
    private void Start()
    {
        m_Rigid = GetComponent<Rigidbody>();
    }

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

        m_MovX = Input.GetAxis("Horizontal");
        m_MovY = Input.GetAxis("Vertical");

        m_moveHorizontal = transform.right * m_MovX;
        m_movVertical = transform.forward * m_MovY;

        m_velocity = (m_moveHorizontal + m_movVertical).normalized * speed;

        //mouse movement
        m_yRot = Input.GetAxisRaw("Mouse X");
        m_rotation = new Vector3(0, m_yRot, 0) * m_lookSensitivity;

        m_xRot = Input.GetAxisRaw("Mouse Y");
        m_cameraRotation = new Vector3(m_xRot, 0, 0) * m_lookSensitivity;

        //apply camera rotation

        //move the actual player here
        if (m_velocity != Vector3.zero)
        {
            m_Rigid.MovePosition(m_Rigid.position + m_velocity * Time.fixedDeltaTime);
        }

        if (m_rotation != Vector3.zero)
        {
            //rotate the camera of the player
            m_Rigid.MoveRotation(m_Rigid.rotation * Quaternion.Euler(m_rotation));
        }

        if (m_Camera != null)
        {
            //negate this value so it rotates like a FPS not like a plane
            m_Camera.transform.Rotate(-m_cameraRotation);
        }

        InternalLockUpdate();

    }

    //controls the locking and unlocking of the mouse
    private void InternalLockUpdate()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            m_cursorIsLocked = false;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            m_cursorIsLocked = true;
        }

        if (m_cursorIsLocked)
        {
            UnlockCursor();
        }
        else if (!m_cursorIsLocked)
        {
            LockCursor();
        }
    }

    private void UnlockCursor()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    private void LockCursor()
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;
    }

}

sentences:
timebased scoring algorithm for game i am developing a game where user has to find target number using 5 given numbers and 4 operators. the score depends on the type of operators and number of operators used and time.

score = typeOperators + noOfOperators + timeScore

where typeOperators is the sum of score for each type of operator, 1 pt for +,* 2 pt for -, and 3 pt for /.

if all the three operators are used once, typeOperators will be 13.
currently, i am thinking of

timeScore = max(0, x - timespent)

But, the game should avoid the situation where the user finding target number with worst solution but with minimum time gets higher scores.
so the more weightage should be on the typeOperators rather than timeScore.

can there be any better approach?

sentences:
Game networking , server send rate I've been writing some server code recently and I ran into a bottleneck.
If a server is capable of sending data at 60hz, with 1 client it would send data to that client at 60z, with 2 clients this would drop to 30z, then with 3 clients to 20hz,etc... This is because the server can only send data to one client at a time, Is my logic correct here? For example, if I had 50 clients and I wanted each client to receive 60 updates per second the server would have to tick at (60hz x 50 clients)  3000hz!?

Is there a more efficient way this is done?

sentences:
Where can I post job listings or browse through resumes? [Hypothetically] I'm at a smaller company and looking for a place to get the word out about our available openings.  Alternately, I'm looking for a place to browse through resumes of people looking for jobs.  What are some services I can use to find the people I need?

Answer Format

One URL per answer
Costs (if applicable)
Specializations (if any)
Experiences using the service

sentences:
How to achieve rendering at huge distances? These days I was reading some information about the upcoming GTA V technology, in particular, how it is able to truly render all buildings you can see without a draw distance cap or any faking.

Since I will soon be prototyping a big city environment, I wanted some advice on this topic. We're talking about a really big city, with simple geometry but fully lit and shadowed. My doubt comes in particular to the projection matrix, which imposes a maximum draw distance (the zFar parameter).

Now, at the same time, I read everywhere that zFar should be as small as possible for better rendering results, in particular related to depth buffer issues etc, because of the floating point issues.

So, assuming my computer can render this big city in a stable framerate, how should I approach the problem of rendering parts of the city which I can see REALLY far away, fully lit and shadowed? Shadow maps also seem to have problems with low depth buffer precision..

Thanks

sentences:
Separating axis theorem implementation flaky minimum translation vector based on triangle orientation I've implemented some collision detection using separating axis theorem. Works fine for axis-aligned rectangles and two out of four possible right triangle orientations. For some reason when the hypotenuse is oriented down left or up right, the minimum translation vector being calculated is that of the normal of the base or height of the triangle rather than the hypotenuse that is being collided with.

http://i.stack.imgur.com/W5WHH.png

I've got a jsfiddle demo of my implementation. The center box and right side triangles all show a correct MVT when the collision box collides with them. The ones on the left side do not. Move your mouse over the canvas to move the collision box.

http://jsfiddle.net/XLtdB/

sentences:
How to integrate Firebase to Libgdx? I have an android game built with libgdx and what I'd like to do is to add some kind of authentication so I can connect the game with user data to firebase database.
I have some experience with firebase using it in native android apps, but I have no idea on how to connect "native code" with libgdx.
Researching I found these third party libs https://github.com/mk-5/gdx-fireapp/tree/master/gdx-fireapp-core and https://github.com/TomGrill/gdx-firebase
But as it does not provide any example it didn't help me much.
So what's the best way to "mix" native android code and libgdx? I want to be able to achieve things like storing data on db, implementing in-app-purchases, authenticating users. If I'm looking the wrong way please let me know too.

sentences:
How relevant is the ability to move/rotate buildings post construction in city builders? I am playing with the concept of a city builder and I have seen many around, but I am still fresh in the area of game design.

I have seen city builders where, once you build a building, you have to demolish it to free the space in order to redesign your city. Once you start with a mistake, you have to work around it and in the end you get...ugliness. Improvisation. But its realistic. You have to plan ahead. Maybe restart the game without making that mistake. But this is discouraging to do. I often get frustrated with punishing games and feel no obligation to take the negative impact of my actions.

On other hand you have games that let you reposition / rotate the buildings after you construct them. While this is obviously unrealistic, you don't get punished for your earlier mistakes and have the freedom to aesthetically reshape your city to your liking. Still, you don't require foresight and I feel you are almost robbed of the reward of the foresight. Also, it breaks the immersion somewhat, you feel like "playing a game".

I can't touch on the relevancy of this. It seems such a trivial matter but I can't put my finger on it.

sentences:
How can I extract the RGB color data from a TGA image? I am working in OpenGL, and I am trying to create terrains using height maps.

I am using my own functions to load a TGA image, and in order to pass data to heightmap vertex shader I need to retrieve RGB components from the TGA image.

I am not quite sure how to do that, I saw in one tutorial that SDL library can be used to retrieve RGB component from a TGA image, but I do not want to use any such libraries because I am already able to load a TGA.

So, how do I recover RGB information per pixel from a TGA that we loaded?

sentences:
How can I get the Selector dialog to include my prefabs When setting a variable for an object in Unity, for built-in types there is an option on the right-hand side to bring up a dialog that lists the possible values that can be chosen for that variable, for example when selecting a Sprite for a Sprite Renderer:

Is it possible, and if so what do I need to do, to have that list populated with the prefabs within my project?

In this example, there are a number of Item prefabs (both inside and outside the Resources folder if that makes a difference), however they do not appear in that dialog. Is there an attribute I am missing that needs to be specified on the Item class, or something else to enable this?

using UnityEngine;
using System.Collections.Generic;

public class Item : MonoBehaviour, IIdentifiable, IFilterable
{
    [SerializeField]
    private int IdField;
    [SerializeField]
    private bool ActiveField;

    public int Id => IdField;
    public bool Active => ActiveField;
}

public class ItemRandomiser : MonoBehaviour, IWeightedObject
{
    [SerializeField]
    private List<string> NamesField;
    [SerializeField]
    private List<Item> ItemTemplatesField;
}

sentences:
Last Matrix operation ignored? I have 2 methods, one to rotate my Quad and one to flip it (using scaleM), they are as follows: (Note, all values in these methods have been properly defined).

If I call just one, they work as expected, but if I call both, then only the one that is called last if applied - why is this?  If I combine them into on 'flip and rotate method' - then my quad is both flipped and rotated. (See third code snippet)

Why is this?

Method to rotate

    public void rotate(float x, float y, int angle){

    //Rotate the quad

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

}

Method to 'flip' (horizontally)

    public void flipHorizontal(float x, float y){

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.scaleM(mRotationMatrix, 0, -1, 1, 0f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);
}

Combined method

    public void flipHorizontal(float x, float y, int angle){

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f);
    Matrix.scaleM(mRotationMatrix, 0, -1, 1, 0f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

}

sentences:
C++ OpenGL wireframe cube rendering blank I'm just trying to draw a bunch of lines that make up a "cube". I can't for the life of me figure out why this is producing a black screen. The debugger does not break at any point.

I'm sure it's a problem with my pointers, as I'm only decent at them in regular c++ and in OpenGL it gets even worse.

const char* vertexSource =
    "#version 150\n"
    "in vec3 position;"
    "void main() {"
    "   gl_Position = vec4(position, 1.0);"
    "}";

const char* fragmentSource =
    "#version 150\n"
    "out vec4 outColor;"
    "void main() {"
    "   outColor = vec4(1.0, 1.0, 1.0, 1.0);"
    "}";

int main() {

    initializeGLFW();

    // Initialize GLEW
    glewExperimental = GL_TRUE;
    glewInit();

    // Create Vertex Array Object
    GLuint vao;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    // Create a Vertex Buffer Object and copy the vertex data to it
    GLuint vbo;
    glGenBuffers( 1, &vbo );

    float vertices[] = {
         1.0f,  1.0f,  1.0f, // Vertex 0 (X, Y, Z)
        -1.0f,  1.0f,  1.0f, // Vertex 1 (X, Y, Z)
        -1.0f, -1.0f,  1.0f, // Vertex 2 (X, Y, Z)
         1.0f, -1.0f,  1.0f, // Vertex 3 (X, Y, Z)
         1.0f,  1.0f, -1.0f, // Vertex 4 (X, Y, Z)
        -1.0f,  1.0f, -1.0f, // Vertex 5 (X, Y, Z)
        -1.0f, -1.0f, -1.0f, // Vertex 6 (X, Y, Z)
         1.0f, -1.0f, -1.0f  // Vertex 7 (X, Y, Z)
    };

    GLuint indices[] = {
        0, 1,
        1, 2,
        2, 3,
        3, 0,
        4, 5,
        5, 6,
        6, 7,
        7, 4,
        0, 4,
        1, 5,
        2, 6,
        3, 7
    };

    glBindBuffer( GL_ARRAY_BUFFER, vbo );
    glBufferData( GL_ARRAY_BUFFER, sizeof( vertices ), vertices, GL_STATIC_DRAW );
    //glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, vbo);
    //glBufferData( GL_ELEMENT_ARRAY_BUFFER, sizeof( indices ), indices, GL_STATIC_DRAW );

    // Create and compile the vertex shader
    GLuint vertexShader = glCreateShader( GL_VERTEX_SHADER );
    glShaderSource( vertexShader, 1, &vertexSource, NULL );
    glCompileShader( vertexShader );

    // Create and compile the fragment shader
    GLuint fragmentShader = glCreateShader( GL_FRAGMENT_SHADER );
    glShaderSource( fragmentShader, 1, &fragmentSource, NULL );
    glCompileShader( fragmentShader );

    // Link the vertex and fragment shader into a shader program
    GLuint shaderProgram = glCreateProgram();
    glAttachShader( shaderProgram, vertexShader );
    glAttachShader( shaderProgram, fragmentShader );
    glBindFragDataLocation( shaderProgram, 0, "outColor" );
    glLinkProgram (shaderProgram);
    glUseProgram( shaderProgram);

    // Specify the layout of the vertex data
    GLint posAttrib = glGetAttribLocation( shaderProgram, "position" );
    glEnableVertexAttribArray( posAttrib );
    glVertexAttribPointer( posAttrib, 3, GL_FLOAT, GL_FALSE, 0, 0 );

    // Main loop
    while(glfwGetWindowParam(GLFW_OPENED)) {

        // Clear the screen to black
        glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
        glClear( GL_COLOR_BUFFER_BIT );

        // Draw lines from 2 vertices
        glDrawElements(GL_LINES, sizeof(indices), GL_UNSIGNED_INT, indices );

        // Swap buffers
        glfwSwapBuffers();
    }

    // Clean up
    glDeleteProgram( shaderProgram );
    glDeleteShader( fragmentShader );
    glDeleteShader( vertexShader );

    //glDeleteBuffers( 1, &ebo );
    glDeleteBuffers( 1, &vbo );

    glDeleteVertexArrays( 1, &vao );

    glfwTerminate();
    exit( EXIT_SUCCESS );
}

sentences:
Approach in implementing the web browser game Im Phil and try to figoure out the best approach for my app.
I was searching Stack for my question but I didnt find a completely answer.
Assumptions:

It will be multiple user who can see in real time their vehicles(locations,state, fuel), places(state, is it planted, is it mowed) etc.
Action taken by players - e.g. User click build/drive and have to wait for example 45min. I want to display to user time to end of action.
should action be registered in queue system ? ( RabbitMQ or something like this,generally a message queuing system)
After this time the object of user should change - User get coins or the vehicle change his place from X to Y
Remove this action from queue and store information about ended action in DB

Is my approach correct? Could I ask for ways to implement this? Or should I go in a completely different direction? I will be grateful for all the advice!

EDIT:
I found different solution: Store action in DB to build / drive and save the current timestamp and time when action is finished. Now i should have bacgrond process which will be looking into this DB and change state when the action is finished (add coins to player X e.g.) In the same time when user clik the request to server is send. In response got the time when te action start and finish. Javascript will be drawing to user the progres bar (calculated from current timestamp and from db) What in situation when user not send another request (not rerfresh site)? The script should check if action in finished (current timestamp > timestamp from db ) and then should automatically refresh user site. Is that correct?
Second aproach is simpler to implement IMO.

sentences:
string and int concatenation resulting in null for a Tetris clone? I'm writing a tetris clone, and I have sprites (of every possible piece and rotation) loaded through the XNA content pipeline. For example, I have assets "i", "i2", "i3", and "i4" for each rotation of the 4-block-long I-tetrimino. For the O-tetrimino, I only have asset "o", because the O-tetrimino doesn't require any rotations.

I want to load each of these assets into a 2D array of Texture2Ds. Here's my attempt:

1 Texture2D[,] tetriminoTextures = new Texture2D[7, 4];
2 char[] tetriminos = { 'o', 'i', 'l', 'j', 'z', 's', 't' };
3 string t;
4
5 for (int i = 0; i < 7; i++)
6 {
7     for (int j = 1; i <= 4; i++)
8     {
9         if (i == 0 || j == 1) // If char[i] == 'o', then don't consider rotations.
10                              // The square piece doesn't have rotations.
11                              // If j == 1, then leave the asset name as is.
12            t = letters[i].ToString();
13        else // (i != 0 && j <= 2 && j <= 4)
14            t = letters[i].ToString() + j;
15        tetriminoTextures[i, j-1] = Content.Load<Texture2D>(t);
16    }
17 }

However, when I attempt to

spriteBatch.Draw(tetriminoTextures[x, y], /* some position vector */, Color.White);

I get an ArgumentNullException. Apparently tetriminoTextures[x, y] is null when y >= 1 && y <= 3.

I have no idea what's going on. I think it may have something to do with my concatenating a string and an int together in line 14. But I'm getting an ArgumentNullException even when i == 0 && j >= 2 && j <= 4 (i.e. for each rotation of the O-tetrimino excluding the first one), though the if statement in line 9 should have caught these cases. Any help would be appreciated!

sentences:
Optimize a vertex buffer and generate its associated index buffer I need to generate a 64*64 grid with each cell being 32*32 wide.

The following code works perfectly but I was wondering whether it can be further optimized when creating the index buffer for it.

I've been searching the web for an algorithm that would generate indices and optimize a buffer but without much success ...

var vector3s = new[]
    {
        new Vector3(0, 0, 0),
        new Vector3(1, 0, 0),
        new Vector3(0, 1, 0),
        new Vector3(1, 1, 0),
    };

List<VertexPositionTexture> positions = new List<VertexPositionTexture>();
for (int y = 0; y < 64; y++)
{
    for (int x = 0; x < 64; x++)
    {
        foreach (var vector3 in vector3s)
        {
            var translation = Matrix.CreateTranslation(new Vector3(x, y, 0));
            var transform = Vector3.Transform(vector3, translation);
            var multiply = Vector3.Multiply(transform, 32.0f);
            VertexPositionTexture vpt = new VertexPositionTexture(multiply, new Vector2(vector3.X, vector3.Y));
            positions.Add(vpt);
        }
    }
}

Output sample :

{Position:{X:0 Y:0 Z:0} TextureCoordinate:{X:0 Y:0}}
{Position:{X:32 Y:0 Z:0} TextureCoordinate:{X:1 Y:0}}
{Position:{X:0 Y:32 Z:0} TextureCoordinate:{X:0 Y:1}}
{Position:{X:32 Y:32 Z:0} TextureCoordinate:{X:1 Y:1}}
{Position:{X:32 Y:0 Z:0} TextureCoordinate:{X:0 Y:0}}
{Position:{X:64 Y:0 Z:0} TextureCoordinate:{X:1 Y:0}}
{Position:{X:32 Y:32 Z:0} TextureCoordinate:{X:0 Y:1}}
{Position:{X:64 Y:32 Z:0} TextureCoordinate:{X:1 Y:1}}

For instance, positions at 1 and 4 are identical but their texture coordinates are not.

What are the options for optimizing it and how does one generate the associated index buffer ?

Should positions be separated from texture coordinates and each have an index buffer ?

EDIT

Actually texture coordinates are wrong but it's not really relevant for the question.

sentences:
What is the intended usage of the Sprite class in LibGDX I am making a small game in LibGDX and it all works, sprites are moving etc. The drawing is mainly done in the render() method of a Screen, using Batch.draw(TextureRegion). So far so good.

But now I would like my sprites to rotate. There are Batch draw methods for rotation (I think), but I noticed a bunch of useful methods in tne Sprite class. Problem is I do not know how to use them without making the rest of the program ugly.

I could have a Sprite as a member of each "game object", but that makes direct dependency of the game model on drawing mechanism, specifically LibGDX. Besides I can see problems with serialization and duplicate parameters (Sprite x,y vs model x,y etc) and unnecessary overhead.

Or I could subclass Sprite, which would probably be orders of magnitude messier.

Is there a common way of clearly separating the model part and rendering part of  a small game? And how is Sprite typically used?

sentences:
Determining connectedness of rectangles I am working on some functions to use in my enemy state machines.

I want to write a function which determines whether the platform the enemy is standing on is connected to the platform the player is standing on.

Platforms have associated rectangles, and by connected, I mean there is a chain of rectangles from the first rectangle to the second rectangle.

Here's an illustration:

Here are my assumptions:

The rectangles contain their perimeters.
Two rectangles touching only on their perimeter are connected.
Two rectangles overlapping are connected.
The rectangles are guaranteed to be axis-aligned.
The rectangles will be at integer coordinates (the grid is 1x1).
Every rectangle has attributes like topleft, bottomright, etc.
Directly connected rectangles won't necessarily have any corners in common.

My question: What is an efficient way to determine the connectedness of rectangles in 2D space?

NOTE:
I asked a more specific version of this question in a Godot forum, but given that this is a general game dev question, I figured I'd ask this variation here.

sentences: How to make it so my cursor is not behind the UI? My cursor keeps going behind the UI how to make it go above?

sentences:
Generating 3D-like effect I'm making a 2D sidescroller game and want to give the blocks a 3D like effect. This way it looks like the player is walking on 3D blocks while walking on a 2D plane (thus having only x,y coordinates).

I have already written the code to generate the terrain in 2D, but the 3D effect is now baked in. It looks like this:

At this moment the 3D effect is baked into the blocks, but I want to try to generate it.

Is there a common way to achieve this 3D like effect while still staying 2D?
Do I have to convert from 2D to 3D or is it also possible to do this with calculations/shaders?

EDIT; The reason I want the top texture of the block separate of the block is because when the camera would go up, the top should get bigger as the camera sees more of the top of the block and the other way around when the camera goes down.

sentences:
Bouncing Balls in angular movement I'm trying to bounce a ball off of a wall based on angular movement.
The ball comes in at angle X ( lets say 30 ).
Bouncing off with the equation 360-ballangle works for the left and right walls
180-angle works for top and bottom walls.

Edit Sorry for the vagueness - heres whats going on
When a ball hits a wall on any side, the ball bounces right back on the same angle
. I'm not sure why it does this - I am trying to have the ball flip its X velocity on a horizontal collision, and flip its Y velocity on a verticle collision. Because I am using angular movement, I need to do this by modifying the ball's angle value, and I am not sure how to set it so it bounces correctly.

(wall.getDimensions returns a rectangle with the walls size and location)

public void moveBullet(Bullet b) {
    float xpos = (float) (speed * 2 * Math.sin(Math.toRadians(b.angle)));
    float ypos = (float) (speed * 2 * Math.cos(Math.toRadians(b.angle)));
    Rectangle bulletbounds = new Rectangle((int) (b.bulletx + xpos), (int) (b.bullety + ypos), 10, 10);
    for (Wall wall : walls) {
        if (bulletbounds.intersects(wall.getDimensions())) {
            if (b.bulletx + 10 > wall.getDimensions().x || b.bulletx < wall.getDimensions().x + wall.getDimensions().width) {
                b.angle = (360 - b.angle);
            }
            if (b.bullety - 10 < wall.getDimensions().y + wall.getDimensions().height || b.bullety > wall.getDimensions().y) {
                b.angle = (180 - b.angle);
            }
        }

    }
    xpos = (float) (speed * 2 * Math.sin(Math.toRadians(b.angle)));
    ypos = (float) (speed * 2 * Math.cos(Math.toRadians(b.angle)));
    b.bulletx += xpos;
    b.bullety += ypos;

}

sentences:
LibGDX: Making an object move correctly based on real time Below is an image of my gameworld. As we can see, the player starts at position 0. each cell represents 1 game world unit. My goal is to get the player to move 1 unit (the red cell) in 1 second in 'real world' time using the LIBGDX framework.

LibGDX uses something called 'continuous rendering' by default, which means its 'main loop' runs as fast as the underlying OS is able to. The range could be anywhere from 0-80 frames per second. I am capping the FPS to 60 with the below 'main' loop (In LIbGDX the main loop is called render)

@Override
public void render(float deltaTime) {

    /*
     * Get the time it took to render the last frame and make sure our delta
     * time is never larger than 0.0166666666666667 (60 FPS). This will
     * ensure that on fast OS the game at only 60 FPS.
     */
    float dt = Math.min(Gdx.graphics.getDeltaTime(), 1 / 60f);

    // **********************UPDATE*********************

    player.update(dt);

    // ************************RENDER********************

    // clear the screen and set it to cornflower blue
    Gdx.gl.glClearColor(0x64 / 255.0f, 0x95 / 255.0f, 0xed / 255.0f,
            0xff / 255.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    worldRenderer.render();

}

Below is the code for my player object's update method. As we can see it is operating solely on the delta time for now. In a perfect world of 60 FPS, this would work perfectly but unfortunatly FPS dips will always happen (especially on mobile platforms). How can I add a calculation on top of the delta time to move the player 1 unit in real time regardless of framerate?

@Override
public void update(float deltaTime) {

    // handle user input **always should come first**
    if (Gdx.input.isKeyPressed(Keys.SPACE)) {
        position.x += deltaTime;
    }

}

Below shows what is happening with my current code, if we had a perfect 60 FPS the position should = 1, but as we can see it does not because the FPS varies slightly from frame to frame.

sentences:
Does "Personal Use" mean I can earn from it? I'm almost done with my personal game. One of the reasons I started this is because of monetization. I plan to monetize it using Google Admob. However, I need some icons - essential part of my game.

And these icons are free, released by a certain company, and they say in their download page:

  These icons are free for personal use or commercial testing purposes.
  Otherwise, you'll need a Premium or Enterprise license. :)

Question is, does "Personal Use" mean I can earn from it?

Also, this "personal game" is actually "under" a group named, say "XXX".
The group "XXX" is merely a group name, not a company, not legal/registered, just literally a group name on Github. And this group is composed of 3 people and that includes me. Does this kind of setup go under the "personal use"?

sentences: What is the purpose of mesh optimization functions? I remember there is a specific function in Direct3D which optimizes a mesh or a 3D object in some way. What is the purpose of this function? How does it reorganize vertices to make it better?

sentences:
Game engine design choice, favour data oriented design over oop? I have a scene, in the scene there are multiple systems. Transformsystem, collidableSystem etc ... Currently, these do nothing except returning a bool if the parameter component matches the system:

bool DrawableSystem::match(Component* component)
{
    return dynamic_cast<Drawable*>(component) != 0;
}

The parent class handles everything else:

class System
{
protected:
    std::vector<Component*> _components;
    std::map<int, int> _idToOffset;
public:
    System();
    ~System();

    void initiate();
    void update(long);
    void remove(unsigned int);
    Component& getComponent(unsigned int);
    bool contains(unsigned int);
    void add(Component*, unsigned int);

    virtual bool match(Component* component) = 0;
};

The match method is used in scene when i for example instantiate an entity (I dont really have an entity class, its just a vector of components). It returns the id which is used when interacting with the components representing that entity.

unsigned int Scene::instantiate(std::vector<Component*> components)
{
    _currentId++;

    for (Component* component : components) {
        for (System* system : _systems) {
            if (system->match(component)) {
                system->add(component, _currentId);
                break;
            }
        }
    }

    return _currentId;
}

This will make it so that the vector _components in each system consists of only components associated with that system.

The current design is very maintainable and extendable, i don't have to modify any code in scene when adding a new type of component or system as you can see:

Scene::Scene() {
    _currentId = -1;
    _systems.push_back(new TransformSystem());
    _systems.push_back(new DrawableSystem());
    _systems.push_back(new CollidableSystem());
    _systems.push_back(new ScriptableSystem(*this));
}

Scene::~Scene()
{
    for (System* system : _systems) {
        delete system;
    }
}

void Scene::initiate()
{
    for (System* system : _systems) {
        system->initiate();
    }
}

void Scene::update(long dt)
{
    for (System* system : _systems) {
        system->update(dt);
    }
}

unsigned int Scene::instantiate(std::vector<Component*> components)
{
    _currentId++;

    for (Component* component : components) {
        for (System* system : _systems) {
            if (system->match(component)) {
                system->add(component, _currentId);
                break;
            }
        }
    }

    return _currentId;
}

void Scene::addComponent(Component* component, unsigned int id)
{
    for (System* system : _systems) {
        if (system->match(component)) {
            system->add(component, id);
        }
    }
}

bool Scene::exists(unsigned id)
{
    for (System* system : _systems) {
        if (system->contains(id)) {
            return true;
        }
    }
    return false;
}

void Scene::destroy(unsigned int id)
{
    for (System* system : _systems) {
        if (system->contains(id)) {
            system->remove(id);
        }
    }
}

But from what i've heard oop should not be used extensively like i do when designing a game engine.

I tried a purely data oriented design in the beginning but it started to get difficult to modify when i got up to around 4 different systems / component types.

Worth mentioning is that this is my first time making a game engine or anything remotely that complex so i can't really plan everything out in detail and just implement it by looking at an UML diagram. I constantly come up with better architectural choices for how the systems / scene communicate, additional method that could be useful etc ...

Do you gain so much in performance using a data oriented approach that reducing maintainability / modifiability would be worth it? It does not feel like it at all in my case, but i'd really like to learn how they do it in the industry and start learning "the right way" from the start. Are there other potantial gains with dod that i haven't thought about?

sentences:
Get the address of a matrix in GLM library Is there a way to get the address of a matrix from a GLM matrix?

I'm using opengl 4 and glm library though I can't seem to find anything, which might help.

sentences: How to make sure that all the UI elements were the same size on all screens in new Unity 4.6 UI system I have made a HUD for my 2d mobile game with the help of the new UI system, that was introduced in Unity 4.6. But when I am trying to play game in Unity editor, the UI elements have normal size, but when I am playing this game on mobile devices, they have more small size than in editor. Why this is happening? May be I missed something while watching Unity tutorials about new UI system. Can anyone help me please.

sentences:
Problem With Smooth Animation In C++/SDL/OpenGL I been working in the animation of a 2D platformer game in C++/SDL/OpenGL, and my team and I reach the point where we need to establish that every animation of the player (Walking, Running, etc..) needs a different framerate for our concept, but I use as a guideline the Game  Programming All In One as a example for the smooth animation, and in the book recommend have variables that limits the movement and the changes of frames.

To clarify what I mean I have in my Sprite class these parameters:

std::vector< Vector2f > delayMovementSprite;
std::vector< int > frameDelayPerAnimation;
GLfloat countX, countY;

Where the vector delayMovementSprite contains all the values for the differents animations and countX increment in every frame until it's equal or greater than the value that correspond in the vector delayMovementSprite.

Something like this:

void Sprite::movePosXWithSpeed()
{
  playerMoveInX = false || playerMoveInX;

  countX++;
  if ( countX > delayMovementSprite.at(getCurrentState()).x )
  {
    countX = 0;
    if ( handlerAnimation->getAnimationDirection() == SpriteData::RIGHT )
    {
      if ( position.x + getSpeedX() + width < 6368.f )
      {
        position.x += getSpeedX();
        playerMoveInX = true;
        return;
      }
    }

    else if ( position.x + getSpeedX() + width  > 0 )
    {
      position.x += getSpeedX();
      playerMoveInX = true;
      return;
    }
    playerMoveInX = false;
  }
}

And for the frames I have a class Animation which handles the following information:

Uint32 frameRate, oldTime;
int frameDelay;
int frameCount;

And in the function that animates I do the following, much like the MoveX in Sprite:

int Animation::animate()
{
  if( oldTime + frameRate > SDL_GetTicks() )
  {
    return -1;
  }

  oldTime += frameRate;
  frameCount++;

  if ( frameCount > frameDelay )
  {
    animationAlreadyEnd = false;
    frameCount = 0;
    currentFrame += incrementFrame;

    if( currentFrame > maxFrames)
    {
      animationAlreadyEnd = true;
      currentFrame = returnFrame;
    }
  }

  return currentFrame;
}

I got working all that and everything executes apparently fine, but in some points of the game the animation doesn't look really smooth when in other points it is.

I leave the video of the "gameplay" so everyone could see what I mean.

http://www.youtube.com/watch?v=uoxKEYzwkcQ

I currently using during the execution of the game a general Timer in 60 FPS.

If anyone needs more information, don't hesitate in ask.

Thanks a lot for the help.

sentences:
Hit Detection When rotating the camera This bug/feature has been plaguing me for a while and i want to know the best way to fix it.
I'm testing simple hit detection with a wall, like:

 if (Forward button)
        if(Inv.w.z < -49 || Inv.w.z > 49)
            pos.z = 0.0f;
        else if(Inv.w.x < -49 || Inv.w.x > 49)
            pos.z = 0.0f;
        else
            pos.z = +1.0f;

where Inv.w. is the camera positions.
Now obviously when i now hit that certain point i can no longer move away from the wall or anywhere in fact. How can i change this code to allow for the camera to be turned away from the wall so therefore i should be allowed to move?

for example, the player hits the wall and i cant move until i turn around or to the side?

I know its something to do with velocity but im pretty new to this so please bare with me if this is easy.

sentences:
Subclasses in unity editor I would like to implement an action system where gameobjects offer different actions available to characters.
Actions are composed of several steps holding the details to be performed. These steps have different logic applied to them (go to location, play animation for a time, change variables), so I would like to have them as subclasses.
However I would also like to be able to set up the actual data for an action in the UnityEditor. I know it is possible to do this using ScriptableObjects, but that requires creating an asset for each instance of a step, which I'd like to avoid, since only the classes get reused, the instances being pretty much unique to each gameobject.
Is there a way to work with subclasses in the unityeditor without requiring a dedicated asset for each of the subclass instances cluttering up my folders?

sentences:
TitleSafeRegion isn't available on XNA 4? I'm following the book Microsoft XNA Game Studio Creators Guide v2. and there is a snippet in the book that is used to return a Rectangle that represents the safe area you can draw without the fear of 'drawing' outside the screen.

Except in my IDE Visual Studio 2010, that method doesn't show up in intellisense and in fact doesn't show up anywhere.

Here is the snippet:

private void UpdateAsteroid(GameTime gameTime)
{
    // time between frames
    float timeLapse = (float)gameTime.ElapsedGameTime.Milliseconds;
    if (move == true)
    { // asteroid centered at the middle of the image
        Rectangle safeArea = TitleSafeRegion(rockWidth/2, rockHeight/2);

      // asteroid right edge exceeds right window edge
    if (rockPosition.X > safeArea.Right){
        rockPosition.X = safeArea.Right; // move it back
        rockSpeed *= -1.0f; // reverse direction
    }
// asteroid left edge precedes the left window edge
else if (rockPosition.X - rockCenter.X < 0){
rockPosition.X = rockCenter.X; // move it back
rockSpeed *= -1.0f; // reverse direction
}
// asteroid within window bounds so update rockPosition
else
rockPosition.X += rockSpeed * timeLapse;
// Scale radians by time between frames so rotation is uniform
// rate on all systems. Cap between 0 & 2PI for full rotation.
const float SCALE = 50.0f;
rockRotation += rockRotationSpeed * timeLapse/SCALE;
rockRotation = rockRotation % (MathHelper.Pi * 2.0f);
}
}

sentences:
Level selection view - similiar to Angry Bird's I am making game and need to prepare view for level selection. Could you recommend me some opensource library which could I use? I need icons to vibrate after long pressing one of them, some callbacks after choosing them, possibility to prepare custom icon's view, page control and horizontal scrolling. I was trying to use OpenSpringBoard but weirdly couldn't see scrollview and pagecontrol working in this project - it seems that there's possibility to use only one page. On the other hand, myLauncher(https://github.com/dlinsin/myLauncher) isn't so easy to include in project, as I need a seperate view with some delegate methods.

I need to be compatible with >iOS 4.2

sentences:
Pathfinding over a moving platform I have beens struggling with the following. In the game I am developing with Unity 5 in C#, I need to implement basic pathfinding over moving platforms (not with moving platforms). It means, I am not concerned that NPC are able to take moving platforms, I am specifically concerned that the whole pathfinding process should happen on big moving floors.

Being that the case, NavMeshes are not an option. Would anyone happen to know of any approach, or have any good tips for that? Thanks in advance for your time.

sentences: How to disable spring joint in unity 3d How can I disable Spring joint in unity 3d, since disabling feature only available in 2d mode, I am not able to find any way to disable it via script

sentences:
How to incorporate (agile) user stories with specs into game development? It seems some features/changes lend themselves to user stories: "as a user, I want to be prompted to exit or retry the battle after the hero dies, since these are the only two common navigations". But other features wouldn't be a good fit for stories, like a detailed description of which game elements appear during an event.

How are these detailed specs incorporated into the agile task system? Certainly the umbrella task could be written as an epic, but the specs seem not to fit as stories. (They are not about direct user motivation or benefit, because these specs often make the game harder, like "boss health should refill at 100% per 90 seconds".)

Note: we're using Jira to track bugs and tasks.

sentences:
MMOFPS Player Positions I'm working on a MMO game project. I have a question about MMOFPS game architecture. (I have basic network knowladge)

(MMOFPS) I want to send player position to other players(clients) and other players will render the player. Namely this is the base of the game world. I have read some article about positioning and somebody says "use inputs for movement update" and others says "use  position posting". That's the first problem. What is better? input or position based movement posting? What is more suitable for a MMOFPS game? (And how to do it?)

SUMMARY: I need to learn "how real multiplayer games work?" (but basically). In my first project I have used TCP protocol for posting position (not inputs) and I have sent position data 4 times per second. Server delivered them to other clients and other clients handled this data and maked a smooth movement. This is a very basic method to do it but I know that isn't MMO! Can anybody help me about understanding MMO game architecture?

sentences:
How to draw a charts by flash cs5 Hey all , I want to make something more interesting in my game some thing like a charts Analysis for a flash game. When THE PLAYER FINISH THE GAME  . The score appears in charts . I want to integrate it with actionscript3 .

NOTE

The game is 60 seconds only I want to draw the score of the user in Y-axis And the Time in X-axis .

I read before about highcharts, but i didn't get much information if there are something easier I'll be grateful .
something like that

sentences:
Manage VBO/VAO in a graphic engine I'm trying to make a 2D Graphic engine for training me. I've actually made it with immediate draw and I've made the renderer outside (so I can switch between OpenGL and DirectX).

How can I manage Vertex Buffer Object and Vertex Array Object? I've made a geometry object, and I don't think VBO and VAO need to be here.

It is the work of my renderer to manage the scene? (Group object in a large VBO, hide object out of screen, Order object by transparency, …)

More explications on my architecture:

Spacial : Spacial element containing spacial elements (like a node).
Mesh : Object with a geometry and a material
Scene : Manage spacial element (like mesh) and lights.
Renderer : Draw the given scene (mesh and lights)

Where I should manage buffers (Index buffer, Vertex Object Buffer and Vertex Array Buffer)? In first, I started to put them in the Geometry class, but it seem obvious because a buffer can stock multiple Geometry object.

So, I'm thinking to put buffers in a buffer manager (in the scene object) -> Scene can manage meshes (order + static/dynamic to regroup them in buffers).

What do you think about that?

Thanks!

sentences:
Cannot decide between using a MessageBus and entities for events in my ECS game For example, let's say that the player walks into an enemy and in response, a chain of events should occur (such as: his score goes up, the enemy dies, a cinematic starts, etc.)
I see two "proper" ways of accomplishing this:
Method 1:
There exists a global message bus in the game. Any system can emit events to it, and any other system can listen for some events from it. For example, the system handling the players score would look like this:
messageBus.listen("playerhitsenemy", e => {
  score += e.monsterType;
});

and the collision system may look like this:
messageBus.emit("playerhitsenemy", { monsterType: 5 });

Similarly, other systems can listen for the same event, such that when something happens, the CPU immediately moves from processing the current system to the other system processing this event. That is, the emit call is basically just a list of callbacks that are immediately invoked and sent the message.
Method 2:
The second method, instead, is to encode events / messages as entities themselves. That is, when an event occurs (such as the player hitting something in the collision detection system), this would happen:
let newEntity = new Entity();
newEntity.components.push(new MessageComponent());
newEntity.components.push(new MessagePlayerHitsEnemyComponent(5));
entityAdmin.spawnNewEntitiy(newEntity);

That is, a new "message" entity is created, and it is given the generic Message component and the concrete event component type as well, MessagePlayerHitsEnemy.
Then, all systems interested in these messages would have something like this in their execute function:
for (let entity of entityAdmin.query(MessagePlayerHitsEnemyComponent) {
  let monsterType = entity.getComponent<MessagePlayerHitsEnemyComponent>();

  score += monsterType;
}

And then at the end of the frame there would be a system whose responsibility was deleting all messages, like so:
for (let entity of entityAdmin.query(MessageComponent) {
  entityAdmin.remove(entity);
}

I cannot decide which is better. The first method seems simpler and probably more efficient in Javascript, considering it's just immediately invoking all the requested functions. However, the second one seems more "correct", in each system is iteratively processed. That is, first the collision system runs in its entirety, then the scoring system, etc. There is no "jumping around" from system to system during execution. Each system processes everything in its entirety, and then the second system processes everything it's interested in, etc.
So, in essence, the first method seems simpler and more efficient, while the latter method seems more "correct", pure, verbose, debuggable, and extendable. Which one should I pick?

sentences:
Calculate the amout that should be added or subtracted to x and y axis with rotation? Say I have this figure:

How would I calculate the amount I must add or subtract to x and y axis to get the cube to move in the direction its facing? The rotation is a float 0 - 360 and 0 is straight up.

sentences:
Displaying smooth borders given a coarse grid-based map I've been messing around with different algorithms trying to make a grid based map look smooth, I have tested with various shader based methods and wrote a few of my own but none of them look right.

A grid based map:

The result I'm trying to achieve

So my question is, are there any algorithms or known methods out there to achieve this?

sentences:
How to make the screen not flicker? I want to be able to draw all my text, lines , triangles and other stuff to screen and then clear the screen and draw something new, BUT this method makes the screen flicker, and all the drawings dont appear at the same time.

My idea is to draw to some kind of a buffer and then draw that buffer to the screen and clear the buffer, and repeat. This way the screen wont flicker and all will be drawn at the same time.

I am using windows.h , Visual Studio.

#include <Windows.h>
#include <iostream>
using namespace std;

struct vec2d
{
    int x, y;
};

void Line(HDC dc, vec2d a, vec2d b)
{
    MoveToEx(dc, a.x, a.y, NULL);
    LineTo(dc, b.x, b.y);
}

vec2d GetMousePos(HWND console)
{
    vec2d out;
    POINT p;
    GetCursorPos(&p);
    out.x = p.x; out.y = p.y;
    return out;
}

int main()
{
    HWND console = GetConsoleWindow();
    HDC dc = GetDC(console);
    SelectObject(dc, CreatePen(PS_SOLID, 1, RGB(255, 255, 255)));

    while (1)
    {
        //BitBlt(dc, 0, 0, 1000, 1000, 0, 0, 0, BLACKNESS);        Flickering is much much bigger, because its faster
        system("cls");
        Line(dc, { 0, 0 }, GetMousePos(console));
    }
}

Thanks in advance, Mark.

sentences: What are different rig types mean? I think I know what is rig - it's a set of bones for animation. But recently I watched a presentation where the guy mentioned animation rig, mesh rig, dynamic rig. What each mean?

sentences:
Z-order curve — how to query all nearest neighbors? TLDR: How to query all nearest neighbors with the least effort? (Iterating over a bigger neighboring area that's continuous and filtering out elements that are not immediate neighbors?)

Suppose the following situation:

You have a set of 3D points' discrete-grid locations stored in a 1D array (an OpenCL buffer)
You've assigned each point its Z-index/Morton code
You sort the array according the Z-indexes
You generate a lookup-array containing the beginning and end indices of continuous regions of same-Z-index-value particles in the first array

Next suppose that you have an OpenCL kernel which executes for each individual particle. And in that kernel you need to loop over all nearest neighboring particles – not only grid cells – (including the currently processed particle itself) of the currently processed particle (that could be 9 neighbors for 2D case, or 27 for 3D).

All of the neighboring particles (for a processed particle) are stored in the nearest-neighboring grid cells. Note that the number of particles in one cell can be high (e.g. look at the bottom-right cells of the image below).

Question: How can I iterate through all the neighboring particles (ideally in a continuous manner)? If this couldn't be solved via Z-order curve, what other approaches can I use?

Example pseudocode:

__kernel void process_stuff(...) {
  foreach ( neighboring_particles ) {  // <- how to achieve this efficiently?
    // perform computation
  }
}

Image legend:

Red line = Z-order curve
The blue dot = the currently processed particle
Yellow dots = another particles
Green region = the current particle neighborhood – a set of particles I need to iterate through

sentences: Directx11 / Tessellation What is so special about directx 11's dynamic tessellation? Can't it be implemented by hand, and just render geometry tessellated by your own code using older versions of directx? What are the advantages of using dx11? Thank you!

sentences:
OpenGL and 3ds model loading: Path of least resistance? Hey guys, im working on a final class project for a graphics class, and me and a teammate are making a simple 3d tower defense game.

We're currently planning on using 3ds models and drawing them with OpenGL.However, niether of us have a lot of practice/experience with loading/drawing models.

What is the fastest and/or easiest (not neccesarily the best or most feature-implemented) way to load a 3ds model and draw it with a OpenGL/glut setup?

sentences:
Why not draw a custom font with lines and/or polygons? Reasons/advantages I see:

More flexible procedural animation.
Completely custom font.
Performance (no texturing or high-poly)?
No assets (unless data-driven).
Multi-resolution compared to sprite fonts / sprites.

Downsides I see:

Effort and time to define every character.
Effort and time to implement the general code.
Future localization pain.

Example: https://youtu.be/Tz7L-92Bo-M?t=2m13s

Is this unreasonable and why?
Will I get a rendering performance win compared to sprite fonts on common multi-core mobile devices?

sentences:
Trying to find a function to calculate attribute changes in a game I'm coding a game where after every year depending on results the attributes of characters change. The game is a movie business simulator and here is a example of the ugly code I have in place now:

        if (movie.Reviews.Avg > 8.5f)
        {
            movie.Producer.Reputation += 6f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 7.5f)
        {
            movie.Producer.Reputation += 5f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 6.5f)
        {
            movie.Producer.Reputation += 4f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 5)
        {
            movie.Producer.Reputation += 1f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 4.5)
        {
            return;
        }
        else if (movie.Reviews.Avg > 4)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 6f;
            return;
        }
        else if (movie.Reviews.Avg > 3)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 5f;
            return;
        }
        else if (movie.Reviews.Avg > 2)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 4f;
            return;
        }
        else
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 3f;
            return;
        }

Few problems I have with this code:
1. Reputations balloon. Good AI producers make good choices so their movies get good reviews and their reputation goes even higher.
2. Because reputations keep growing the absolute changes in attributes get smaller and moving up in ranks gets way too slow and hard.

What I am looking from the function:
1. Range is 0-10.
2. At the top of the range growth is slow even with great reviews, but if your movie gets bad reviews the decline is sharp. And the opposite for the bottom of the range.

sentences:
How to activate an object only when it's within the camera view I want to toggle an object's active state using the camera view:

when the object leaves the view it deactivates
when the object enters the camera's view it activates

I'm using this to control the activity of objects in a carousel like this

I did this with a coroutine, but in my project the fps is falling a lot
because of the coroutine.

I've already used OnBecameVisible and isVisible but that's not it since they only work with a renderer.

    public void next() {
        StartCoroutine(On(waitnext));
    }

    IEnumerator On(float waitnext) {
        yield return new WaitForSeconds(waitnext);
        myArray[Selecao].SetActive(false);
        Selecao++;
        if(Selecao > myArray.Length - 1) {
            Selecao = 0;
        }
        yield return new WaitForSeconds(waitnext);
        myArray[Selecao].SetActive(true);
    }

    public void previous() {
        StartCoroutine(On2(waitprevious));
    }

    IEnumerator On2(float waitprevious) {
        yield return new WaitForSeconds(waitprevious);
        myArray[Selecao].SetActive(false);
        Selecao--;
        if(Selecao < 0) {
            Selecao = myArray.Length - 1;
        }
        yield return new WaitForSeconds(waitprevious);
        myArray[Selecao].SetActive(true);
    }

sentences: Unity 5.3.4: Controlling multiple audio sources at once? Is there a way to control the max distance of a group of audio sources at once? I want to implement all my sounds, then be able to play with some of the audiosource settings of all of them..

sentences:
How to get what button was clicked on? Other contexts in which this was done I'm sure have been answered for this kind of problem before. But this has thus far been a 2 week long impasse of wittling down all the other suggestions I've seen and not one has worked.

I've got a prefab GUI with a singleton instance based script, which automatically disables itself at the start (I've tried commenting that out to see if that was it). The gui has a title text, body text, and 8 buttons. The script is meant to allow other scripts for interactive objects to safely access it and "start a conversation", using a coroutine.

I created a script for the buttons that I attach to each, that when called should set a public bool to true, indicating it was clicked, this bool is polled among the buttons to see which button the user clicked. This is then return to the script which called the GUI, and the GUI closes or waits for the next piece of the conversation. I've set everything to be enabled, and removed anything that disabled the components. I've made sure that the buttons are higher in the hierarchy than everything else, to make sure nothing else was intercepting the clicks.

I'm unable to get OnClick, OnMouseOver, OnMouseDown to be called. Debug messages never show. I've tried setting OnClick as part of the GUI where you select a function from the list, and inside of the button's code by adding a listener manually to the button. I've tried IPointerExitHandler, IPointerDownHandler, etc, also never seen anything come back from the methods.

I've tried several other methods to date to get which button I clicked, such as ray casting when the mouse button is down and checking the name for the button's name, however it always passes through to the terrain. I've tried getting the button's rect and using Rect.contain with the mouse position to see if the mouse was over the button when clicked, but this never returns true.

I'm really interested in seeing a working example where something like this has been done, so that perhaps if that doesn't work, I could at least start hunting down what might be causing a functioning example to fail, as I've no idea what's wrong at this point. Not to vent but this is very frustrating, and I feel it could be made so much simpler.

Thank you all for any help you can give, you guys have been very wonderful with my short time here.

sentences:
How to keep my auto-aim in sync with the rendered frame? In my FPS game there is an automated lock system. If you stare at an enemy, your weapon locks onto the enemy as long as your aim is hovering approximately around the target.

If my player sets frame rate high (say they changed frame rate from 60 to 140+) they have smooth frame rate in which allows them to change their view more smoothly. My players can now hover their aim onto an enemy more rapidly.

Problem is, if my game were to run at 60 ticks per second while the player set the render system to render 140+ frames per second, my game's tracking system will be a few frames behind what the player looks at.

So I am wondering, should my game's logic run at the same rate that the rendering system is rendering the game? Or can I solve this synchronization issue in another way?

sentences:
Understanding how to go from a scene to what's actually rendered to screen in OpenGL? I want something that explains step by step how, after setting up a simple scene I can go from that 'world' space, to what's finally rendered on my screen (ie, actually implement something). I need the resource to clearly show how to derive and set up both orthographic and perspective projection matrices... basically I want to thoroughly understand what's going on behind the scenes and not plug in random things without knowing what they do.

I've found lots of half explanations, presentation slides, walls of text, etc that aren't really doing much for me. I have a basic understanding of linear algebra/matrix transforms, and a rough idea of what's going on when you go from model space -> screen, but not enough to actually implement it in code.

sentences:
Compatibility between DirectX 9 and DirectX 10 shaders I am a beginner to game development and as I am used to programming in C# I decided to go for XNA. I've been playing around with it for a while and now I am learning the basics of HLSL shaders, I have noticed in the MSDN documentation that there have been some syntax changes in HLSL between DirectX 9 and DirectX 10, for example, the Sampler type

Since I am having some troubles with my desktop pc, I am using my laptop which video card only supports DirectX 9.0c. Then I'm gonna have to write my shaders using the DirectX 9 syntax, right? So I am wondering, will my HLSL shaders written using the DirectX 9 syntax work on a system running DirectX 10 (or higher)?

sentences:
How can I mimic an isometric perspective using square tiles? Can an isometric perspective be mimicked with traditional square tiles? Can't the effects of the 45-degree overhead view simply be "drawn in" to the square? How would this work?

Picture this: the tiles themselves are square (not diamond) but all objects placed on them (sprites, terrain objects like trees, buildings, etc) are drawn from isometric view as if they were on diamonds.

This might be a silly question to ask, but I'm having difficulty understanding isometric perspective.

sentences:
Control stick map analysis I'm implementing this map of inputs (from the gamecube title Super Smash Bros. Melee) and translating it into code for my game:

The map is depicted using hardware coordinates (the square shape of the map) while the game itself limits the range of inputs to a circle (depicted by the gray circular outline).  If a hardware input is outside the range of the circular game input, then it is rounded down.  This is what causes the radial patterns.  Each colored section is a different output based on the input.  The gray square in the center is the deadzone of the stick.

The zones "fsmash", "usmash", and "dsmash" were easy to code in.  It was as simple as

if (pos.x > 0.80 || pos.x < -0.80) fsmash
if (pos.y > 0.66) usmash
if (pos.y < -0.66) dsmash

My question is how to incorporate the other 4 zones.  It's simple for "jab" as it is in the deadzone so it will be the else condition (when pos.x && pos.y == 0)
The inputs go out radially which seems to suggest it follows the same patterns as the larger zones.  When inputs are outside of the black circle I have drawn, they could be rounded down then I could simply do..

if (pos.x > 0) ftilt
if (pos.x < 0) jab
if (pos.y > 0) utilt
if (pos.y < 0) dtilt
else jab

However I'm not sure of how I could implement it since the cutoff point for the outer zones was the actual implemented radius of the stick in game.  Any help would be appreciated or ask if I need to clarify anything.  Thanks!

sentences: How to make Pong Ball Control? I want to know how can I make the control of the Pong Ball in Plain Javascript. I would like to know how to make the ball faster when it hits the edges just like the original pong game, or how if the ball hit's the middle of the paddle it would go straight and slow. I just want to get a feel for how it works.

sentences:
My bullet changes the velocity depending on where I click I want to build a little 2D-Sidescrolling shooter and I'm now at the shooting script.

I already figured out how to shoot a bullet towards my mouse pointer. I got something like this :

Vector3 shootDirection;
        shootDirection = Input.mousePosition;
        shootDirection.z = 0.0f;
        shootDirection = Camera.main.ScreenToWorldPoint (shootDirection);
        shootDirection = shootDirection - transform.position;

        shootDirection.Normalize ();

        Rigidbody2D bulletInstance = Instantiate (rocket, transform.position, Quaternion.identity) as Rigidbody2D;
        bulletInstance.velocity = new Vector2 (shootDirection.x * speed, shootDirection.y * speed);

Now obviously the bullet goes faster if my Direction coordinates are big and slower if they are smaller. Have you some better code for me or how can I fix that issue?

I added now some loop like this, which brings a horrible performance, but kinda works out for the problem, but I'm still looking for a better solution.

while (((shootDirection.x * speed) + (shootDirection.y * speed)) < 20) {
            speed += 0.1f;
        }

So the loop makes sure that the overall speed is always almost the same, but this solution ends in an infinity loop if the values get too small.

sentences:
Tile based smooth snake movement while making my own Snake implementation I decided to use delta time for smoothing movement on screen. The problem is that before Snake was moving fixed amount of pixels every frame, but now when mulitplying snakeSpeed by timeStep it's no longer aligned to the grid. How can I fix it?

Main game function:

void Run()
{
    while (!gameOver)
    {
        Time = (float)al_get_time() * 1000.0;
        timeStep = Time - lastFrameTime;

        Input();

        if (draw && al_is_event_queue_empty(eventQueue))
        {
            al_clear_to_color(al_map_rgb(255, 255, 255));

            UpdateSnake(&snake, timeStep, direction);
            Draw();
            Logic();

            al_flip_display();
            draw = false;
        }
    }
}

UpdateSnake() function (for now it's only one element moving):

void UpdateSnake(Snake *snake, float timeStep, Position direction)
{
    snake->animationTime += timeStep;

    float f = snake->animationTime * snakeSpeed;

    if (f >= 1.0f)
    {
        snake->animationTime = 0.0f;
        f = 1.0f;
    }

    snake->animationOrigin.x = ((int)snake->position.x / BOARD_CELL) * BOARD_CELL;
    snake->animationOrigin.y = ((int)snake->position.y / BOARD_CELL) * BOARD_CELL;

    if (direction.x == 1)
    {
        snake->animationDestination.x = snake->animationOrigin.x + BOARD_CELL;
        snake->animationDestination.y = snake->animationOrigin.y;
    }

    if (direction.x == -1)
    {
        snake->animationDestination.x = snake->animationOrigin.x - BOARD_CELL;
        snake->animationDestination.y = snake->animationOrigin.y;
    }

    if (direction.y == 1)
    {
        snake->animationDestination.x = snake->animationOrigin.x;
        snake->animationDestination.y = snake->animationOrigin.y + BOARD_CELL;
    }

    if (direction.y == -1)
    {
        snake->animationDestination.x = snake->animationOrigin.x;
        snake->animationDestination.y = snake->animationOrigin.y - BOARD_CELL;
    }

    snake->position.x = Lerp(snake->animationOrigin.x, snake->animationDestination.x, f);
    snake->position.y = Lerp(snake->animationOrigin.y, snake->animationDestination.y, f);

}

sentences:
Fast self collision/intersection detection algorithm for tetrahedral meshes I want to play with deformation of tetrahedral mesh (soft-body simulation) but I need help with self-collision detection stuff.
I found SOFA collision detection but I'm not sure that it fits for self-intersection of a tetrahedral mesh.
Can anyone suggest me good algorithm for self-collision detection? As far as I can understand, something like BVH of tetrahedra can help me, but it would be great if somebody with expertise shows me right direction.

sentences:
Background Scrolling like Zelda - A Link To The Past with XNA i am trying to create a background that scrolls like the one in zelda - a link to the past.
in other words: i have a bigger "screen" than the camera covers, so i need to scroll over it, when moving. if the player reaches an edge of the screen, the camera is going to stop and the character moves out of the center.

my actual problem is, that i have to draw the objects in an other way than the background. i am getting the camera to track the player, but if i want to add another object like an enemy, i have to draw it with screen coordinates, which are not the same as the background coordinates. (background image is 1280x720 with a source rectangle of 640x360). so the player is usually drawn at 640/2, 360/2. but the player also is at position 600,600 of the background image.
so, if there is an enemy at 200,200 and the player moves to that point i want to draw the enemy on the screen. but, of course, i cant draw it at 200,200 in the screen that displays the sorucerectangle of the texture.

so i am looking for a way to kinda get the object into the texture, that there is only one coordinate system or at least a second coordinate system where all the object are in., which is as big as the texture itsself. with such a coordinate system i could get the absolute positions of the objects and draw it like the sourcerectanlge of a texture.

sentences:
Unity Android versus android SDK I am familiar with Unity and in the process of learning android SDK when the announcement about unity android basic came out.

What would be the advantages and disadvantages of using the android SDK directly versus development using Unity Android?

sentences:
Weird Animation Behavior in Unity I discovered a weird animation bug and have no idea how to solve it. Below you find the script I attached to my humanoid character.

using UnityEngine;
using UnityEngine.AI;

public class PlayerCharacter : MonoBehaviour {

    private Animator anim;
    private NavMeshAgent agent;

    private bool dead = false;

    void Awake()
    {
        this.anim = GetComponent<Animator>();
        this.agent = GetComponent<NavMeshAgent>();
    }

    public void Kill()
    {
        this.dead = true;
        this.anim.SetBool("Dead", true);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.X))
        {
            Kill();
        }
    }

    public bool IsDead()
    {
        return this.dead;
    }
}

My character makes use of the NavMeshAgent and can walk around and idle - everything works fine. But if I want to kill the player the dead animation loops continuously. This also happens if I change the death animation.

This is my AnimationController:

As you can see, the transition has the condition "Death" with is set to true in the Kill() method. The code for walking and idling in combination with the NavMeshAgent is similar, but the script shown above doesn't work as expected and I have no clue why the animation starts to loop continuously (which looks a bit funny btw). Additionally the animation is not played to end, it restarts after a few frames.

Any ideas? I could also post a video of the behavior if it would help.
Thanks in advance! :)

sentences:
What's the best practice to use the pbo to upload multi textures? I have a basic model to upload textures as shown in the following picture.

I design this for several reasons:

Only the primary thread owns the OpenGL context, so I choose to create buffers, map buffers and unmap buffers in the primary thread.
I have many pictures to load and I don't want them to block the primary thread, so I use the subthread to load images and copy the memory.

Here are my questions:

Is my model correct?
Is my model the best practice?
Should I create a PBO for each picture or create two PBO for all pictures and use them in turn?
Should I use a shared context?

Thank you for helping me out

sentences:
How do I set the mouse to control views like zoom in and out? How would I go about using the mouse to zoom in and out of my current isometric tiled map, where the tiles need to be in the center of the view when the application has started?

This is what I have, so far:

sentences:
How signals work when Node2D is queue_freed? Consider this setup:
* KinematicBody2D (Player)
|- Sprite (icon.png)
|- VisibilityNotifier2D

With Player.gd:
class_name Player extends KinematicBody2D
signal unvisible

onready var visibility_notifier :VisibilityNotifier2D = $VisibilityNotifier2D

func _ready() -> void:
    visibility_notifier.connect("screen_exited", self, "__on_screen_exited")

func __on_screen_exited() -> void:
    emit_signal("unvisible")

Now I have a template Level.gd:
* Node2D (Level)
|- Player

extends Node2D

onready var player :Player = $Player

export var debug_no_enemy  = false
export var debug_no_player = true

func _ready() -> void:
    player.connect("unvisible", self, "_reset_level")
    if debug_no_player:
        player.queue_free()

func _reset_level() -> void:
    print("reset")
    get_tree().reload_current_scene()

The print statement proves that this setup make a kind of infinite loop of reset because the signal screen_exited is still emited when the player is queue_free.
Is it expected?

I am even more surprised with this modified version which produces the same thing:
func _ready() -> void:
    if debug_no_player:
        player.queue_free()
    player.connect("unvisible", self, "_reset_level")

sentences:
Swipe Detection with mouse in Unity This is my swipe detection code. This code uses touch input. I want to do this using the left mouse button. So basically I want to 'swipe' using the mouse.How can I achieve that?

public float maxTime;
public float minSwipeDist;

float startTime;
float endTime;

Vector3 startPos;
Vector3 endPos;
float swipeDistance;
float swipeTime;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if(Input.touchCount > 0) {
        Touch touch = Input.GetTouch(0);
        if (touch.phase == TouchPhase.Began)
        {
            startTime = Time.time;
            startPos = touch.position;
        }
        else if (touch.phase == TouchPhase.Ended)
        {
            endTime = Time.time;
            endPos = touch.position;

            swipeDistance = (endPos - startPos).magnitude;
            swipeTime = endTime - startTime;

            if(swipeTime < maxTime && swipeDistance>minSwipeDist)
            {
                SwipeFunc();
            }
        }
    }
}

void SwipeFunc()
{
    Vector2 distance = endPos - startPos;
    if(Mathf.Abs(distance.x) > Mathf.Abs(distance.y))
    {
        Debug.Log("Horizontal swipe");
    }
    else if (Mathf.Abs(distance.x) < Mathf.Abs(distance.y))
    {
        Debug.Log(" vertical  swipe");
    }
}
}

sentences:
2D Spatial partitioning alternatives to spatial hashes and quadtrees I've been trying to implement a spatial partitioning algorithm in my game, but both spatial hashes and quadtrees aren't what I'm looking for.

My level size is not supposed to have a limit (only Int32 limits). I need a spatial partitioning algorithm that doesn't need a "Level Width" and a "Level Height".

I have many moving physical objects. I need the algorithm to be fast enough to support 500+ objects.

Any alternative?

sentences:
Compressing textures and recompressing textures Which tools are considered best-quality for compressing textures for use in OpenGL?  Which can be used from the Linux commandline?

And which lossless compressors give good ratio/speed on compressed textures?

(I see that Skyrim's BSA archives are typically only half the size of the DDSes they contain)

sentences:
How to sample from six cubemap images for a skybox in Shader Graph? I'm trying to update a skybox shader to URP and reimplement it in Shader Graph.  The shader code itself is pretty straightforward, but I don't know enough about Shader Graph yet to set up the basic skybox.

It's a standard cubemap skybox made up of six textures for +x, -x, +y, -y, +z, and +z.

Trying to Google different variants of "unity shader graph cubemap skybox" turns up tons of noise and nothing actually useful that I can see.

Does anyone know what the basic node setup is I would need to input six images and output a skybox?

sentences:
How to find the total bounds rectangle around a list of rectangles How can I find the total bounds rectangle around a list of rectangles?

Rectangle object: a simple data structure of 4 floats (w,h,x,y).
I have an array of 2 or more rectangles and want to create a rectangle that surrounds all of them:

The result rectangle, calculated from rectangles A and B:
 Rectangle T : ( Ht, Wt, Xt , Yt)

sentences:
NavMeshAgent.CalculatePath - how to use properly? I seriously can't figure out how to use this function, and the documentation doesn't help at all.

Here's the documentation code:

public class ExampleClass : MonoBehaviour {
 public Transform target;
 private NavMeshAgent agent;
 void Start() {
     agent = GetComponent<NavMeshAgent>();
     NavMeshPath path;
     agent.CalculatePath(target.position, path);
     if (path.status == NavMeshPathStatus.PathPartial) {
     }
   }
}

Here's my code:

public class Movement : MonoBehaviour {
 NavMeshAgent agent;
 NavMeshPath path;

 void Start () {
     agent = GetComponent<NavMeshAgent>();
 }

 void MoveToTargetLocation() {
     agent.SetDestination(targetLocation); <-- being set somewhere else

     NavMeshPath path;
     agent.CalculatePath (targetLocation, path);

     if (path.status != NavMeshPathStatus.PathPartial) {
         if (Vector3.Distance (curLocation, targetLocation) > 0.55) {
             animation.CrossFade (animationRun.name);
             moving = true;
         } else {
             animation.CrossFade (animationIdle.name);
             moving = false;
         }
      }
   }
}

The error I'm receiving is:

  Assets/Movement.cs(59,54): error CS0165: Use of unassigned local
  variable `path'

Am I supposed to be setting the path somewhere else?

sentences:
How to draw realtime 3D amoebas in OpenGL? How would one draw 3D amoebas in real-time in OpenGL? The key components I'm looking for are:

Curved closed surface that changes shape
Generally transparent
Something translucent inside showing the volume is occupied

It has to be in real-time, and be able to handle many (100's) of these moving and animating on screen simultaneously.

What techniques might one use to accomplish this?

sentences:
Should the networking of my game be a component or a service? I am working on a windows game and I am trying to understand the  XNA GameComponents and GameServices classes and use. From what I understand about a component is that it has an Update method that gets call in every frame, and a service can be referenced from other components if needed.

So the way I think a network component would work is that in its Update method it would receive and send data. It probably makes sense to receive the network data once per frame, but it doesn't for sending it. Shouldn't the game send its own updates to others the moment it has it to cut down on lag?

sentences:
Instantiation of a custom class I have a custom class named Stars:

class Star
{
    public int primaryID;
    public string properName;
    public string HIPID;
    public string HDID;
    public string HRID;
    public string GLID;
    public string BFID;
    public decimal rightAscension;
    public decimal declination;
    public string magnitude;
    public string colourIndex;
    public int scale;
    public int red;
    public int green;
    public int blue;
    public bool isSimulated;
    public double x;
    public double y;
    public double z;

    public void setDetails(int primaryID, string properName, string HIPID, string HDID, string HRID, string GLID, string BFID, decimal rightAscension, decimal declination, string magnitude, string colourIndex)
    {
        this.primaryID = primaryID;
        this.properName = properName;
        this.HIPID = HIPID;
        this.HDID = HDID;
        this.HRID = HRID;
        this.GLID = GLID;
        this.BFID = BFID;
        this.rightAscension = rightAscension;
        this.declination = declination;
        this.magnitude = magnitude;
        this.colourIndex = colourIndex;
        decimal deg2rad = 0.01745329251994329576923690768489m;

        this.isSimulated = true;

        // Decimal datatype is used to make sure that values are very accurate and precise
        decimal degrees_ra;
        decimal degrees_dec;
        decimal radians_ra;
        decimal radians_dec;

        degrees_ra = Decimal.Multiply(rightAscension, 15);
        degrees_dec = declination;

        radians_ra = Decimal.Multiply(degrees_ra, deg2rad);
        radians_dec = Decimal.Multiply(degrees_dec, deg2rad);

        // Converted from decimal to double because the Math library cannot work with decimals
        float distanceStars = 19113;

        this.x = (distanceStars * Math.Cos(decimal.ToDouble(radians_dec)) * Math.Cos(decimal.ToDouble(radians_ra)));
        this.y = (distanceStars * Math.Cos(decimal.ToDouble(radians_dec)) * Math.Sin(decimal.ToDouble(radians_ra)));
        this.z = (distanceStars * Math.Sin(decimal.ToDouble(radians_dec)));
    }

    public Vector3 getVector()
    {
        return new Vector3((float)z, (float)y, (float)x);
    }
}

There are many of these stars and I want to instantiate them at run-time:

void plotStars()
{
    int i = 0;
    while (i < (StarDataBank.Instance.NumOfStars))
    {
        string name = StarDataBank.Instance.StarName[i];
        string HIP = StarDataBank.Instance.StarIDHIP[i];
        string HD = StarDataBank.Instance.StarIDHD[i];
        string HR = StarDataBank.Instance.StarIDHR[i];
        string GL = StarDataBank.Instance.StarIDGL[i];
        string BF = StarDataBank.Instance.StarIDBF[i];
        decimal RA = Convert.ToDecimal(StarDataBank.Instance.StarRA[i]);
        decimal Dec = Convert.ToDecimal(StarDataBank.Instance.StarDec[i]);
        string Mag = StarDataBank.Instance.StarMag[i];
        string ColI = StarDataBank.Instance.StarCI[i];

        var star = new Star();
        star = Instantiate(ObjectStar, transform.position + star.getVector(), Quaternion.identity);

        star.transform.parent = StarObject.transform;
        star.transform.localScale = new Vector3(star.scale, star.scale, star.scale);
        i++;
    }
}

But I am experiencing a lot of errors.

Unity isn't instantiating the Stars because it can't convert UnityEngine.Transform to Star
Star doesn't contain definition of Transform

Is there a way to assign a class as a gameobject?

sentences:
Suitable SDK to develop quick game? I'm currently undertaking a personal project at home that I need to turn around inside the next few months (which working full time and still learning programming makes it a tad difficult). I'm looking for suggestions on SDK's or tools (preferably free or that come with games, similar to steam tools) that I can use to develop a "game". I'm OK with coding but have no 3D development skills at all.

I've very little experience with mod tools or SDK's at all but I'm hoping someone can point me in the direction of one that does the following:

A decent library of prefab 3D models to build scenes.
Ability to add scripting to the scene

I've used Unity before and would prefer to continue to do so however I really have the worst 3D skills imaginable and can't waste time learning them.

I'd be looking for pre-fab items that are both industrial and possibly more lush environments (trees etc). If it makes any difference (due to licencing and what-not) I WILL NOT be selling this game or marketing it in any way and I am a University Student if any places do educations licences.

Another alternative would be to source free 3d models elsewhere but again while I'm still learning I have no idea where to look if someone could point me in the right direction I'll do the rest of the digging.

Thanks

sentences:
How do I run a headless Unity server in a Windows Docker (without GPU)? I am trying to run a headless Unity server on a Windows Docker.
On Linux, there is Xvfb, but I don't know how I could get similar results on Windows.
How would I do that?

sentences:
How can I perform 2D side-scroller collision checks in a tile-based map? I am trying to create a game where you have a player that can move horizontally and jump. It's kind of like Mario but it isn't a side scroller. I'm using a 2D array to implement a tile map.

My problem is that I don't understand how to check for collisions using this implementation. After spending about two weeks thinking about it, I've got two possible solutions, but both of them have some problems.

Let's say that my map is defined by the following tiles:

0 = sky
1 = player
2 = ground

The data for the map itself might look like:

00000
10002
22022

For solution 1, I'd move the player (the 1) a complete tile and update the map directly. This make the collision easy because you can check if the player is touching the ground simply by looking at the tile directly below the player:

// x and y are the tile coordinates of the player. The tile origin is the upper-left.
if (grid[x][y+1] == 2){
   // The player is standing on top of a ground tile.
}

The problem with this approach is that the player moves in discrete tile steps, so the animation isn't smooth.

For solution 2, I thought about moving the player via pixel coordinates and not updating the tile map. This will make the animation much smoother because I have a smaller movement unit per frame. However, this means I can't really accurately store the player in the tile map because sometimes he would logically be between two tiles. But the bigger problem here is that I think the only way to check for collision is to use Java's intersection method, which means the player would need to be at least a single pixel "into" the ground to register collision, and that won't look good.

How can I solve this problem?

sentences:
HLSL equivilant to "Object" data from "Texture Coordinate" node in Blender I mocked up a shader how I wanted it with the node editor in Blender. Now I'm trying to write it in HLSL. In Blender there is a node group called "Texture Coordinate". If I use the "uv" node from the group it behaves like a normal unlit frag shader but if I use the "object" node to give coordinates to the texture, it ignores the uv data and just maps the texture like an image overlayed onto the object.

This is actually the effect I want. However, I can't find a way to replicate this in HLSL. As far as I can see I can use TEXCOORD0 and POSITION as texture coordinates to produce uv mapping and world mapping respectively for a texture onto an object. Maybe what I want is object mapping?

And if it matters I'm using a generated texture

sentences:
How does atan2 work when getting angle of a vector? I know that atan2 gives me the absolute angle of any vector. But it doesn't give a value from 0 to 360 degrees. Instead, it gives a value (if I'm not mistaken), between 0 and 180, or between 0 and -180. For example, instead of giving angle 270, it will say -90.

This is a little confusing for me. Let me try to describe how I think this works, and please tell me if I'm correct. Actually, I'll draw it.

Is this correct? I'm having a little trouble understanding this. Thanks

sentences:
IOException java problem I'm working through the Head First Java book, and one piece of code it makes me write looks like this:

import java.io.*;
public class GameHelper {
    public String getUserInput(String promt){
        String inputLine = null;
        System.out.print(promt + " ");
        try {
            BufferedReader is = new BufferedReader(
                    new InputStreamReader(System.in));
            if (inputLine.length() == 0) return null;
        } catch (IOException e){
            System.out.println("IOException: " + e);
        }
        return inputLine;
    }
}

But eclipse tells me the exception is never thrown from the try statement, what does that mean?

sentences: Line-Line intersection vs. DDA Recently, I have wanted to make a game using raycasting techniques, and I saw this video where a guy used an algorithm called "Line-line intersection" . I have normally used the DDA algorithm for raycasting, and that is what I see most raycasters use, is there a reason why that is? Is DDA faster for raycasting? Is there any case to use one over the other?

sentences: Removing the billing permision from a apk build in unity So recently we made a version of our game that is paid and not free. This of course means that we removed both ads and IAP capabilities. Now I'm sure that I have removed every single peice of code that references ads or IAP from scripts that get built into the apk but Unity still keeps adding the billing permision to the manifest. Apart from exporting a google android project and then modifying the manifest and then buidilng to apk what other options do I have to solve this ?

sentences:
Getting started with cross-platform game development I am looking for a starting place to develop a crossplatform OpenGL game that runs on Mac, PC and potentially Linux.  The difficulty is that I don't want to use an existing graphics library.

I've done a lot of work with OpenGL in C++ for Windows.  I have never developed anything for Mac.  I plan to develop most of the Windows game and leave my project open with abstraction so that I can later implement Mac-specific code.

Is there anything that works radically different in Mac and Linux than in Windows?  With Windows for example, I use DirectInput and XInput to capture controllers and keyboard, window messages to capture mouse and typing.  Where can I find some type of "translation guide"?  Also, do I still need to consider endianness?

How can I design my project so that I can load it up in Visual Studio 2008 and easily compile it in OSX and Linux IDEs?  Since I own Visual Studio, I'd like to use that for my Windows development, rather than switch to a cross-platform IDE.

sentences:
SDL: Certain bitmap not displaying I have come across a very wierd problem. Here is my code:

#include <iostream>
#include "SDL.h"

using namespace std;

class MyGame
{
public:

    SDL_Surface* image;
    SDL_Surface* window;
    SDL_Event* e;

    void Start()
    {
        SDL_Init(SDL_INIT_EVERYTHING);

        window = SDL_SetVideoMode(800,600,32,SDL_SWSURFACE);

        image = SDL_LoadBMP("Bitmap.bmp");
        SDL_BlitSurface(image,NULL,window,NULL);
        SDL_FreeSurface(image);

        SDL_Event evt;

        bool programrunning = true;
        while(programrunning)
        {
            SDL_WaitEvent(&evt);
            if(evt.type == SDL_QUIT) programrunning = false;
        }

        SDL_Quit();
    }

    void Update()
    {
        SDL_Flip(window);
    }
};

int main(int argc,char* args[])
{
    MyGame obj;
    obj.Start();
    while(true)
    {
        obj.Update();
    }

    return 0;
}

Whenever I run this code on Code::Blocks, no errors appear and everything works except for the bitmap. For some reason it doesn't display. However, I once tried replacing Bitmap.bmp with cb.bmp (the Code::Blocks logo that came with the IDE) and it rendered perfectly fine. Also, whenever I close the program Windows gives me this error: "2DGame.exe not responding", no matter what bitmap I use. This is one of the strangest coding problems I have come across ever, please tell me why Bitmap.bmp is being a jerk and how to fix it and also how to fix the error I get whenever I close my program. Thanks!

P.S: You guys asked for the image, here it is:

sentences:
Create a crosshair openGL How do I draw a white crosshair in the middle of screen in openGL, it's all well and good knowing how to render objects in 3d space, but I have literally no idea on how to draw something that sticks on the screen no matter what

Would this require a shader? one that does not take into account model view projection matrix? at what point would i draw the cross? after everything to coincide with the painters algorithm? Or do I give it a z value?

sentences:
Creating a model procedurally through coding? Possible Duplicate:
  Creating a basic character skeleton from code

I'd like to have a procedural system that uses a string of data to create a 3d creature. The way I've thought to do this is to use the code to generate a simple creature frame, and later add something to add additional detail.The goal is to create creatures of different forms and frame. The creation will be mirrored down the spine so both sides are the same.

I assume it will work best to generate it like bones so the code would have information used to show what type of bone it was(hierarchy), the bone length, and how the bone was positioned and use this to make the model. (At least in planning, I don't know how to implement it)

I'd like it to be highly adaptable but I'd like to specify a max of 4 legs and 4 arms (8 limb max only 4 on ground for walking). Being able to create a basic structure for humanoids, quadrupeds, and mixes (like a centaur or biped with no arms) is the goal.

I've looked into turtle graphics, l-systems, metaballs, and FReps. But I still don't know what to use. How can I use a set of data to generate the simple 3d frame?

sentences:
Where should I put units and items in a squad-combat ECS-based game? So I'm working on a game where squads of varied units would explore, fight, trade and build on an overworld map. Combat would be automated more or less, and happen on the overworld. Basically, something like Mount&Blade but without the real-time hack and slash combat.

I'm using an ECS architecture, and even in MVP stages I'm running into confusion: Should each unit be an entity in the grand entity pool, with an ID pointing to the squad it belongs to? Or should they be in an array of units in the squad entity?
When they start having items, should every dagger and boot be part of a gigantic entity pool, or only exist inside units and inventories?
When it'll come to skills and enchantments, buffs... will a "+10% damage" buff float among houses and squads and knives and forests in the entity pool, or will it be part of a buff array?
If it helps
I'm using Javascript with a homemade ECS, for fast and shareable iterations, and for learning purposes too.

sentences: Should I use threads to check sockets for multiplayer game? In a multiplayer game does the code to get/send info from/to sockets reside in the game loop or does it belong in its own thread?

sentences:
Why place entity config outside of scripts? I've seen a lot of games that define the entity components in script files, but when they configure each entity and specify what components it has, they use some other file format (like XML). Why do they do that?

I'm asking mostly to see what others' rationale was for this. I also configure my entities outside of scripts (though I chose JSON not XML). My reasons for doing this are to make it easier for me to implement save games and also because I think this kind of configuration is better organized in something like XML or JSON.

@Christopher Larsen's answer: Too long to post as a comment

I fear you might have deviated a bit from the subject of the question. The problems you are describing are more related to hierarchy-based entities; note in my question I mentioned I was talking about component-based entities.

Here's an example of what I wanted to ask. Below are two alternative ways to configure an entity: through the script and through an external JSON file. My question was, why do so many people prefer to configure the entity outside of scripts?

A base Entity class:

class Entity:
    def __init__(self, name):
        pass
    def addComponent(self, comp):
        pass

The script approach:

orc = Entity('Orc')
orc.addComponent(PositionComponent(3.4, 7.9))

The JSON approach:

{
    "name" : "Orc",
    "components":
    {
        "PositionComponent": {
            "x" : 3.4,
            "y" : 7.9
        }
    }
}

I already stated my reasons for using this approach, which are technical and organizational. I wanted to know why so many others (from what I've seen) use this.

sentences:
How to smoothly let an object move along a curved line I'm wondering how to move objects, with rotation taken into account, to follow a curved line

see: http://www.youtube.com/watch?v=iPpO24FeAX4 for an example

In particular I wonder:

how to store the points, how many
points to store for a smooth line
like that
how to interpolate the
curves
how to interpolate between
the object and the first "waypoint"
along the line

sentences:
How do I use tiles and sprites together in an isometric scene? I'm trying to write a 2D isometric scene. Rendering order is complex, since both tilemaps and sprites are different concepts. Rendering one of the 2 before the other will draw the scene incorrectly.

Tiles and Sprites both have some common data that can be used as render information. I thought of creating an extra object which simply holds the coordinates and texture data. However, this also meant having to couple a tile or sprite to a render info object. (something I haven't figured out). This adds complexity. However, I thought this way I could abstract over any renderable object.

This tutorial defines tiles as any other sprite and then uses a topology algorithm to sort the scene every frame.

I was actually thinking of using the pigeon hole algorithm by sorting the render info objects on their depth property.

How is this usually done? I can't wrap my head around it.

Bear in mind that I have no actual z-depth to work with. Everything relies on the artificial depth from the x and y coordinates.

sentences:
Part of model in Unity is inside out but not in Blender? I've downloaded this asset and it looks perfectly fine in preview, and even in blender.

But when I import it in Unity, one of its shoulder is inside out, even after making all faces double sided.

I also tried switching the normal mode in the import settings to Calculate.

What causes this issue and how could I fix this?

sentences: How can I my homing missile avoid walls (2D)? Okay, I have the homing missile implemented. It will follow the player, but I want it to avoid the walls. I tried out A* but I want to make my own. I need some help plzz.

sentences:
What's the fastest way checking if two moving AABBs intersect? I have two AABBs that are moving, what's the fastest way to check if they will intersect under a frame?

By moving I mean not just to check with the usual rectangle intersection method, I mean some kind of simple easy swept test that only returns a boolean, no hit time or anything else.

What I think is to simply do it like this:

But that Hexagon is quite complex and I don't know how to calculate an AABB - Polygon intersection, is there maybe an easier way?

Any programming language that you like the most, I can easily port it.

Thanks.

sentences:
Getting crash on glDrawElements Here is the code where I initialize the VAO, vertex attributes(also the main VBO) and EBO(im using my own wrapper class for these "databuffers" to hide some of the API features and make life easier so i dont think the problem will be in the generic class as it was working without problems)

void initVAOManager(const bool& ebo) {

    if (_vaoID == 0)
        glGenVertexArrays(1, &_vaoID);

    glBindVertexArray(_vaoID);

    /**
    Here is the main data buffer (positions,colors,UVs)
    If it doesn´t exist a new one is created
    **/
    if (!_mainBuffer)
        _mainBuffer = new DataBuffer<T>(GL_ARRAY_BUFFER);

    _mainBuffer->bindBuffer();

    if (!_eboBuffer && ebo) {

        _eboBuffer = new DataBuffer<eboData>(GL_ELEMENT_ARRAY_BUFFER);

        _eboBuffer->bindBuffer();
    }

    //This is the position
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, position));

    //Color attrib pointer
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, color));

    //UV
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_TRUE, sizeof(Vertex), (void*)offsetof(Vertex, uv));

    _mainBuffer->unbindBuffer();

    if (ebo)
        _eboBuffer->unbindBuffer();

    glBindVertexArray(0);
}

Then the render function (dont mind the for loop, as i want to render multiple objects from the batch in one function):

void renderBatchNormal()
{
    uploadData();

    glBindVertexArray(_VAOManager->getVAO());

    std::vector<eboData>

    for (std::size_t i = 0; i < _DATA.size(); i++) {
            glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
    }

    glBindVertexArray(0);

    clearData();
}

The upload data function send a data from the vectors to their buffers, I can send it too but as Im using my generic wrapper and it worked before with normal drawings I assume there is no problem.
And finally a class eboData(if anyone wondered) (basically just a blank class with an array of 6 indices)

class eboData {
public:
    GLuint indices[6];
};

However, this is causing crashes on the line where I try to execute the glDrawElements command, I read that it can be caused with no binded VAO while binding the ELEMENT BUFFER but as you can see from the code I´m doing it right(at least I think that). However, if I change the following line with:

std::vector<eboData> _eboVector;

glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, _eboVector.data());

The code is working (problem is also that I don´t know how to render second item in the buffer as it is showing only the first one). Do you have any ideas what can cause this crash?

PS:
glGetError() returns 0.

sentences:
GLSL - std140 uniform block - fields(vec, float, mat4) always 0.0 Ok,

First of all, if just use uniforms everthing works like it should. Switching to uniform blocks nothing goes, as all values look like 0.0.  I tested this with various if-then-else stuff within the vertex shader and modifying the output color.

According to CodeXL 1.3(here the data is listed as VBO, but I think this is only cosmetic), GL.BindBuffer with GL.MapBuffer, or GL.GetBufferSubData there is really the proper data within my ubo but nonetheless the uniform block in the shader contains 0.0 only.

workflow:

    //Create UBO
    BufferUBOName = new int[2];
    GL.GenBuffers(2, BufferUBOName); // Generate the buffer
    BufferIndex = 0;

    GL.BindBuffer(BufferTarget.UniformBuffer, BufferUBOName[0]); // Bind the buffer for writing
    GL.BufferData(BufferTarget.UniformBuffer, (IntPtr)uboWorldData.SizeInBytes, IntPtr.Zero, BufferUsageHint.StreamDraw);  // Request the memory to be allocated
    GL.BindBufferRange(BufferRangeTarget.UniformBuffer, BufferIndex, BufferUBOName[0], IntPtr.Zero, (IntPtr)uboWorldData.SizeInBytes); // Bind the created Uniform Buffer to the Buffer Index

Creating and linking the shaders works fine and gives the following ouput :

GL   4.3
GLSL 4.30
Shader: basic_fs ok
Shader: basic_vs ok
ShaderProgram :hexgrid [ basic_vs, basic_fs ]
    Active Uniform Block : UboWorld
      Size         : 144
      BlockBinding : 1
      BufferPoint  : 0
        Name : UboWorld.time
          Type[n] : Float [4]
          Offset  : 0
        Name : UboWorld.screenwidth
          Type[n] : Int [4]
          Offset  : 4
        Name : UboWorld.screenheight
          Type[n] : Int [4]
          Offset  : 8
        Name : UboWorld.promat
          Type[n] : FloatMat4 [64]
          Offset  : 16
          matrix stride: 16
        Name : UboWorld.mvpmat
          Type[n] : FloatMat4 [64]
          Offset  : 80
          matrix stride: 16

    // Done after successful program linking
    uniformBlockIndices["ubodata"] = GL.GetUniformBlockIndex(shaderprog.Handle, "UboWorld"); // Gets the uniform variable Location
    if (uniformBlockIndices["ubodata"] != -1)
        GL.UniformBlockBinding(shaderprog.Handle, uniformBlockIndices["ubodata"], BufferUBOName[0]);

Then VBO / VAO are created and working fine, incl. drawing elements.

On UpdateFrame the UBO data will be processed like:

    GL.BindBuffer(BufferTarget.UniformBuffer, BufferUBOName[0]);
    GL.BufferSubData(BufferTarget.UniformBuffer, IntPtr.Zero, (IntPtr)uboWorldData.SizeInBytes, ref uboWorld);

The offsets are taken from the information after program linking and reading the various values for the UniformBlockActiveUniforms. I skip the output here as the struct should reflect it properly.

    [StructLayout(LayoutKind.Explicit)]
    struct uboWorldData
    {
        [FieldOffset(0)]
        public float time;
        [FieldOffset(4)]
        public Int32 screenwidth;
        [FieldOffset(8)]
        public Int32 screenheight;
        [FieldOffset(16)]
        public Matrix4 projectionMatrix;
        [FieldOffset(80)]
        public Matrix4 modelviewMatrix;

        public static readonly int SizeInBytes = 144;
    };

Vertex shader for testing:

    #version 400
    in vec3 in_position;
    in vec3 in_normal;
    out vec3 normal;
    out vec3 colortime;
    out vec3 colortimeubo;

    // These uniforms work
    uniform mat4 mvpmat;
    uniform mat4 promat;
    uniform float time;

    // This compiles fine. But always 0.0
    layout(std140) uniform UboWorld {
        float time;
        int screenwidth;
        int screenheight;
        mat4 promat;
        mat4 mvpmat;
    } w;

    const float pi = 3.1415;

    void main()
    {
      // This uses the UNIFORM FLOAT
      colortime = vec3(abs(sin(time * 360.0 * pi / 180.0)), 0.3, 0.3);
      // Here the uniform UboWorld
      colortimeubo = vec3(abs(sin(w.time * 360.0 * pi / 180.0)), 0.3, 0.3);

      normal = (mvpmat * vec4(in_normal, 0)).xyz;
      gl_Position = promat * mvpmat * vec4(in_position, 1);
    }

Any hints why w.time and also w.mvpmat or w.promat are always zero filled ???

sentences: LibGDX . draw multiline text I am trying to write a big text using BitmapFont in libGDX . But it shows on one line and the user can see only the first part of the text . How can I make that bitmapFont made new line automatically and show whole text on the screen ?

sentences:
Java: refresh KeyInput to avoid sticky fingers during gameover state In short, I am trying to avoid my keys from sticking when its in the gameover state. The problem is if the player is holding down the right button for instance and dies, then he restarts the game moving right indefinitely until the player presses down the right button again. How can I prevent this from occuring? I tried setting up a boolean variable that detects if it's pressed or not but that isn't working.

else if(state == STATE.GAMEOVER)
    {
        gameover.tick();
        MouseInput.pressed = true;
        KeyInput.pressed = false;
    }

public void keyPressed(KeyEvent e)
{
    int key = e.getKeyCode();

    for (int i = 0; i < handler.object.size(); i++)
    {
        GameObject tempObject = handler.object.get(i);

        if(tempObject.getId() == ID.Player && pressed == true)
        {
            if (key == KeyEvent.VK_W) handler.setUp(true);
            if (key == KeyEvent.VK_S) handler.setDown(true);
            if (key == KeyEvent.VK_A) handler.setLeft(true);
            if (key == KeyEvent.VK_D) handler.setRight(true);
        }
        if (key == KeyEvent.VK_ESCAPE && pressed == true)
        {
            Game.setState(Game.STATE.PAUSE);
        }
    }
}
public void keyReleased(KeyEvent e)
{
    int key = e.getKeyCode();

    for (int i = 0; i < handler.object.size(); i++)
    {
        GameObject tempObject = handler.object.get(i);

        if(tempObject.getId() == ID.Player && pressed == true)
        {
            if (key == KeyEvent.VK_W) handler.setUp(false);
            if (key == KeyEvent.VK_S) handler.setDown(false);
            if (key == KeyEvent.VK_A) handler.setLeft(false);
            if (key == KeyEvent.VK_D) handler.setRight(false);
        }
    }
}
public static boolean isPressed()
{
    return pressed;
}
public static void setPressed(boolean pressed)
{
    KeyInput.pressed = pressed;
}

    if(handler.isUp() && KeyInput.pressed == true) velY = -5;
    else if(!handler.isDown() && KeyInput.pressed == true) velY = 0;

    if(handler.isDown() && KeyInput.pressed == true) velY = 5;
    else if(!handler.isUp() && KeyInput.pressed == true) velY = 0;

    if(handler.isRight() && KeyInput.pressed == true) velX = 5;
    else if(!handler.isLeft() && KeyInput.pressed == true) velX = 0;

    if(handler.isLeft() && KeyInput.pressed == true) velX = -5;
    else if(!handler.isRight() && KeyInput.pressed == true) velX = 0;
}

sentences:
How to connect a GUI button to function? I am developing a new Roblox game where you can setup and control you're own virtual machine using SurfaceGUIs on a modeled screen. I am trying to make a confirmation GUI
where if you click YES, then it starts the VM, and if you click NO, then it closes the GUI and doesn't start a VM. But when I click on NO, nothing happens! Here is my code:
local gui = script.Parent.Parent
local button = script.Parent

local function cancel()
    gui.Visible = false
end

button.Activated:Connect(cancel())

Please help!
P.S: The confirmation frame is in the ScreenGUI, the button is in the frame, and the LocalScript is in the button.

sentences:
Know if you're fully utilizing the GPU I render ~17.000 VAOs each frame. 2.840.386 triangles. Only applying texture, nothing else.

I have three computers and the performance across them is not as expected.

Cheap laptop(i3-4010U & Intel HD 4400) runs at ~20 fps.
Desktop1(FX-9590 & GT 630) runs at ~65 fps.
Desktop2(i7-5820k & GTX 970) runs at ~105 fps.

As the game is in a pretty early stage, the only CPU task each frame is to loop through a 3-Dimensional map containing VAO ids, and then render them.

When I look at the CPU Benchmarks and the GPU Benchmarks of my systems, I would expect a much bigger difference between my Desktop2 and the two other systems. The GTX 970's 3D score(8662) is more than 15 times better than the Intel HD 4400's (546), though it only run 5 times as fast. Even more ridiculous the GTX 970's 3D score is ~11 times better than the GT 630's (797), but run 1.6 times faster.

Even without taking the benchmarks into consideration I would still expect bigger difference. When I compare the performance differences in other games(Like GTA V) across my systems, there's a much bigger difference. Therefore I know the problem is my game, and not a hardware/driver related issue.

Am I right that I would expect larger differences between the different systems, if yes: How may I find the issue and how can I solve it?

Edit: I've read that GTX 590 is capable of 3.2 Billion triangles/second, where as my game is only able to squeeze ~300 million of a GTX 970.

Edit 2: I've tested my desktop1(GT 630) that runs 1080p at 65fps and if I change the resolution to 1 * 1, I only get a performance boost of 20fps(85fps).

sentences:
Moving camera in 3D - directX12 I begin to learn graphic programming on directx12. I try to make a camera wich can move dans rotate around the world.

I take this code as a basis:
https://www.braynzarsoft.net/viewtutorial/q16390-transformations-and-world-view-projection-space-matrices

I try lot of method, but every time I finish on the same problem, my camera move and can rotate (on Y only for the moment). But when I move after the control still relative to my basis orientation than my new one.

I dunno if it come from how I handle movement (During waiting answer I will try to make my movement base on a target vector) Or how I multiply martix.

This is the actual point of my code. I use this source to not use LookAtLH():
https://www.3dgep.com/understanding-the-view-matrix/

void UpdateCamera() {

    XMVECTOR cUp = XMLoadFloat4(&cameraUp);

    if (GetAsyncKeyState('Z')) {

        cameraPosition.y += 0.001f;

    }
    else if (GetAsyncKeyState('S')) {
        cameraPosition.y -= 0.001f;
    }

    if (GetAsyncKeyState('Q')) {
        cameraPosition.x -= 0.001f;
    }
    else if (GetAsyncKeyState('D')) {
        cameraPosition.x += 0.001f;
    }
    if (GetAsyncKeyState('A')) {
        rotation += 0.0001f;

    }
    else if (GetAsyncKeyState('E')) {
        rotation -= 0.0001f;
    }

   if (GetAsyncKeyState('P')) {
        cameraPosition.z += 0.001f;

   }
    else if (GetAsyncKeyState('M')) {
        cameraPosition.z -= 0.001f;

    }
    XMMATRIX translationMat =     XMMatrixTranslationFromVector(XMLoadFloat4(&cameraPosition));
    /* XMMATRIX rotYMat = XMMatrixRotationAxis(cUp, rotation);*/

    float cosPitch = cos(0.0f);
    float sinPitch = sin(0.0f);
    float cosYaw = cos(rotation);
    float sinYaw = sin(rotation);

    XMFLOAT3 xaxis = { cosYaw, 0, -sinYaw };
    XMFLOAT3 yaxis = { sinYaw * sinPitch, cosPitch, cosYaw * sinPitch };
    XMFLOAT3 zaxis = { sinYaw * cosPitch, -sinPitch, cosPitch * cosYaw };

    XMVECTOR eye = XMLoadFloat4(&cameraPosition);

// Create a 4x4 view matrix from the right, up, forward and eye position vectors
    XMMATRIX viewMatrix = {
        xaxis.x,yaxis.x,zaxis.x,0.0f,
        xaxis.y,yaxis.y,zaxis.y,0.0f,
        xaxis.z,yaxis.z,zaxis.z,00.0f,
        -XMVectorGetX(XMVector3Dot(XMLoadFloat3(&xaxis), eye)), -XMVectorGetX(XMVector3Dot(XMLoadFloat3(&yaxis), eye)), -XMVectorGetX(XMVector3Dot(XMLoadFloat3(&zaxis), eye)), 1.0f
    };

    XMStoreFloat4x4(&cameraViewMat, viewMatrix);// XMMatrixInverse(nullptr, translationMat * rotXMat));

}

void Update()
{

    UpdateCamera();
     ///....

}

sentences: What is the game development market shifting towards? Aimed at the professionals who are there in the industry, what is the game development market shifting towards? Web-based or Mobile or Consoles/PCs. I have developed a decent knowledge of JavaScript and html5, so I want to know if this is entirely useful(on a game development perspective) or maybe I should learn some other language from scratch?

sentences:
GUI device for throwing a ball The hero has a ball, which shall be thrown with accuracy in a court on iPhone/iPad. The player is seen from above, in a 2D view. In game play, the player reach is between 1/15 and 1/6 of the height of the iPhone screen. The player will run, and try to outmaneuver his opponent, and then throw the ball at a specific location, which is guarded by the opponent (which is also shown on the screen). The player is controlled by a joystick, and that works ok, but how shall I control the stick?

Maybe someone can propose a third control method?

I've tried the following two approaches:

Joystick:

Hero has a reach of 1 meter, and this reach is marked with a semi-opaque circle around the player.
The ball can be moved by a joystick. When the joystick is moved south, the ball is moved south within the reach circle. There is a direct coupling with the joystick and the position of the ball. I.e. when the joystick is moved max south, the ball is max south within the player reach.
At each touch update the speed is calculated, and the Box2d ball position and ball speed are updated. NB, the ball will never be moved outside the reach as long as the player push the joystick.
The ball is thrown by swiping the joystick to make the ball move, and then releasing the joystick. At release, the ball will get a smoothed speed of the joystick.

Joystick Problem:

The throwing accuracy gets bad, because the joystick can not be that big, and a small movement results in quite a large movement of the ball.
If the user does not release before the end of the joystick maximum end point, the ball will stop, and when the user releases the joystick the speed of the ball will be zero. Bad...

Touch pad

A force is applied to the ball by a sweep on a touchpad.
The ball is released when the sweep is ended, or when the ball is moved outside the player reach.
As there is no one to one mapping between the swipe and the ball position, the precision can be improved. A large swipe can result in a small ball movement.

Touch Pad Problem

A touchpad is less intuitive. Users do not seem to know what to do with the touch pad. Some tap the touchpad, and then the ball just falls to the ground.
As there is no one-to-one mapping, the ball can be moved outside the reach, and then it will just fall to the ground. It's a bit hard to control the ball, especially if the player also moves.

sentences:
Animation works well on preview but not when hitting play I'm using a simple animation where I want to move an sprite just a little bit bellow its current position, and this works well on preview mode in the Animation tab.
But as soon as I hit play, the value I'm trying to animate is not the same as the one in the keyframe, the value is lesser than the one I setted. I don't know what I'm doing wrong... I'll append a clip showing this problem.
I already tried turning on and off Apply Root Motion and some alike questions, but none of the solution worked for me so far...

sentences:
"Unable to create OpenGL 3.3 context (flags 0, profile 1)" Trying to run any of the well-known McKesson's tutorials on a friend's laptop results in the aforementioned exception.

I read that in order to run applications which use OpenGL 3.3 you must at least have an ATI HD or Nvidia 8xxx GPU series. He has an ATI HD class graphics processor which eliminates (maybe) this issue. Also, I read that this error may result in having old drivers. He updated his drivers but that didn't solve the problem.

The tutorials are built as said in the book introduction and glsdk is installed.

If more information is needed, say so and I will provide it.

What are the other reasons for this kind of exception? And how can I fix them?

sentences:
Unable to get Box2dlights to cast shadows I'm trying to use box2dlights to add lighting to my game and I have everything working except I am unable to have shadows cast with my box2d bodies.  I also have collision working using category/maskBits with my various objects and I'm trying to apply the same strategy to box2dlight filters.  You can see how the light just passed through the body.

EDIT:  I think I may have discovered why the lights are not colliding with my box2d bodies.  When I define the body shapes using "real world" scale pixel coordinates, the lights cast shadows properly, but I lose collision since the bodies are defined at pixel scale as opposed to the box2d scale I have defined.  Does anyone know why the box2dlights are using real world scale?

Here is my RayHandler Setup

RayHandler.useDiffuseLight(false);
rayHandler = new RayHandler(world);
rayHandler.setAmbientLight(.5f, .5f, .2f, 1f);
rayHandler.setBlurNum(1);
rayHandler.setShadows(true);

I have a PointLight that is positioned in the center of the screen.

PointLight pl = new PointLight(game.rayHandler, 128);
pl.setDistance(1000);
pl.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
pl.setColor(Color.WHITE);
pl.setSoftnessLength(0);
Filter filter = new Filter();
filter.categoryBits = B2DVars.CATEGORY_LIGHT; // Value listed below
filter.maskBits = B2DVars.MASK_LIGHT;         // Value listed below
pl.setContactFilter(filter);

Also, my body is defined as

body = world.createBody(squareBodyDef);
PolygonShape squareShape = new PolygonShape();
squareShape.setAsBox(b2dWidth / 2, b2dWidth / 2, new Vector2(squareBodyDef.position.x * WORLD_TO_BOX, squareBodyDef.position.y * WORLD_TO_BOX), 0f);
body.setUserData(this);

FixtureDef fdef = new FixtureDef();
fdef.shape = squareShape;
fdef.density = 10.0f;
fdef.friction =  0.1f;
fdef.restitution = 1.15f;
fdef.filter.categoryBits = CATEGORY_SQUARE_OBJECTIVE; // Value listed below
fdef.filter.maskBits = MASK_SQUARE; // Value listed below

body.createFixture(fdef).setUserData(this);
squareShape.dispose();

Finally, my box2d filtering constants

public static final short CATEGORY_BALL = 1;
public static final short CATEGORY_LINE = 2;
public static final short CATEGORY_WALL = 4;
public static final short CATEGORY_SQUARE_OBJECTIVE = 8;
public static final short CATEGORY_TRIANGLE_OBJECTIVE = 16;
public static final short CATEGORY_LIGHT = 32;

public static final short LIGHT_GROUP = 1;

public static final short MASK_BALL =
                CATEGORY_LINE |
                CATEGORY_WALL |
                CATEGORY_SQUARE_OBJECTIVE |
                CATEGORY_TRIANGLE_OBJECTIVE;

public static final short MASK_LIGHT =
                CATEGORY_LINE |
                CATEGORY_SQUARE_OBJECTIVE |
                CATEGORY_TRIANGLE_OBJECTIVE |
                CATEGORY_WALL;

public static final short MASK_SQUARE =
                CATEGORY_BALL |
                CATEGORY_LIGHT;

public static final short MASK_WALL = -1

I've been going non-stop for about 3 days trying to solve this problem to no avail.  Any help is appreciated!

sentences:
How to synchronize the speed of spawned object and spawning time interval? I want a stream of enemies coming from the top of the screen one behind other in a line, with their speed (speed of the whole stream i.e. every enemy) increased over time.

When I simply increased their speed, a continuous stream of balls (which will be my enemies) is lost since objects are spawned at a fixed time interval irrespective of the varying speeds of the spawned balls.

To maintain the continuous flow of balls what I wanted is to generate balls rapidly as the speed increases. So there should be a direct relationship between spawning interval and speed of the stream.

How can I do that?

sentences:
Depth of Field Blur - Weighted sampling? I've been studying Intel's fantastic article titled "An investigation of fast real-time GPU-based image blur algorithms" (here), where-in they state that Gaussian blur would need to be customized for proper use in achieving a depth-of-field effect. The relevant part states:

  They are all generic algorithms that are fully applicable to effects
  like a Bloom HDR filter. However, in a specific scenario, for example
  for use in Depth of Field, they would require additional customization
  (such as weighted sampling to avoid haloing/bleeding) which can impact
  relative performance.

However they don't go into detail about how to compute the weighted sampling? Does anyone know what this means, or know of relevant documentation / example code?

I have been using guassian blur for DoF and have indeed seen the bleeding and other artifacts, so I've been looking for ways to solve these problems.

sentences:
Find closest point on NavMesh if current target unreachable I have a mock environment set up with a cube that has a specified "Not Walkable" layer.
I'm using NavMeshAgent and NavMeshPath to set destinations of the player.
The way I'm setting paths is by ray-casting points on the terrain by mouse clicking.

I'm having trouble figuring out a way to fix if I click on the cube that has a "Not Walkable" layer, the player just runs into the cube and tries to reach that point.

I've read about the FindClosestEdge function in unity but I don't think that's exactly what I'm looking for.

So basically I need the target location to change to the nearest point next to the cube when I click on the cube.

Any ideas?

sentences: PUZZLE MAZE using probability - HOW TO is there an easier way to do this? perhaps a formula?

sentences:
Debugging Minimum Translation Vector I implemented the minimum translation vector from codezealot's tutorial on SAT (Separating Axis Theorem) but I'm having an issue I can't quite figure out. Here's the example I have:

As you can see in top and bottom left images regardless of the side the of the green car which red car is penetrating the MTV for the red car still remains as a negative number also here is the same example when the front of the red car is facing the opposite direction the number will always be positive.

When the red car is past the half way through the green car it should switch polarity. I thought I'd compensated for this in my code, but apparently not  either that or it's a bug I can find.

Here is my function for finding and returning the MTV, any help would be much appreciated:

Code

sentences:
CryEngine with Visual Studio 2015 I receive an error in Visual Studio when I open CESharpFramework from my project folder. I had assumed I could use Visual Studio 2015; but the error tells me I need an older version of Visual Studio to open the MonoLauncher solution within CESharpFramework.

Is this a known issue and what should I do?

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

sentences:
Point vs Convex Hull I'm trying to implement a simple collision response to a point intersecting a convex hull.

So far I can detect if the point is inside the hull.

But now I want a collision response that translates and rotates the hull away from the point so it no longer intersects.

I'd like the simplest algorithm possible, I don't want to implement a physics engine or rigid bodies.

Can someone point me in the right direction?

sentences:
OnTriggerEnter2D or OnCollisionEnter2D not getting called I checked the other answers for this but mine didn't get fixed
Here's the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestroyCollectibles : MonoBehaviour
{
    private void Start()
    {
        Debug.Log("Hallo");
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("Trigger");
    }
    private void OnCollisionEnter2D(Collision2D collision)
    {
        Debug.Log("Collsion");
        // if (collision.gameObject.CompareTag("Collectible"))
        // {
        //     Debug.Log("Apple");
        //     Destroy(collision.gameObject);
        // }
    }
}

And screenshots:

sentences: Unity - Renderer "raycasts" from top down? I'm trying to have objects in a game be selectable only from a top down orthographic camera view. I think having physics colliders might be overkill for that - especially because this only needs to be in 2D and not 3D. Is there another method that might be better, such as something like a renderer "raycasts", but perhaps even more performant as it is just from the orthographic 2D top down view

sentences:
How to make game appear to run faster? I believe I read somewhere that there is a technique which will make games appear more smooth than they are. I believe it is some visual trick, but I don't remember which one. (It is be something like "You percieve game to be more fluid if there is good shadows").

I may be wrong and there is no such thing.

sentences:
Shader which supports vertex colors and pixel lights? From my question at Unity Answers:

Hello everyone, I'm facing a bit of a problem here: I need a shader which has the ability to colour individual vertices and be lit pixel by pixel. Until recently, I was planning to use just vertex shading, since I couldn't find any info about this. The thing, it looks like this: Bad shading 1 and Bad shading 2.
As you can see, it is horrendously bizarre and even glitchy. Here is the shader I'm using right now (ShaderLab syntax):

Shader "Alpha/VertexLit Colored" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _SpecColor ("Spec Color", Color) = (1,1,1,0)
        _Emission ("Emmisive Color", Color) = (0,0,0,0)
        _Shininess ("Shininess", Range (0.01, 1)) = 0.7
        _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    }

    SubShader {
        //ZWrite Off
        Alphatest Greater 0
        Tags {Queue=Transparent}
        Blend SrcAlpha OneMinusSrcAlpha
        ColorMask RGB
        Pass {
            Material {
                Shininess [_Shininess]
                Specular [_SpecColor]
                Emission [_Emission]
            }
            ColorMaterial AmbientAndDiffuse
            Lighting On
            SeparateSpecular On
            SetTexture [_MainTex] {
                Combine texture * primary, texture * primary
            }
            SetTexture [_MainTex] {
                constantColor [_Color]
                Combine previous * constant DOUBLE, previous * constant
            }
        }
    }
    Fallback "Alpha/VertexLit", 1
}

I searched around on the Unity forums, wiki and also on Google, but I found no resources for this. I really need the vertex colours here, it's a crucial element of the graphic style of my game, and is the simplest way to do what I want. Any help is immensely appreciated. Does anyone know if such kind of shader exists?

sentences:
Flipping Textures in Modern OpenGL How do I flip a texture in modern OpenGL (3.1+)?

This is the unflipped render, keep in mind it is drawn with 8x8 tiles from a texture atlas, so I edited green squares below him into the image to represent it. Rendered without horizontal flip:

I have tried doing 1-texCoord.x in my vec2 texCoord in my vertex shader.
It gave me... this result:

This is how texture atlas is laid out, if it matters:

Attempting other methods such as inverting texture coordinates of the VBO gave me similarly garbled results. What should I actually be doing, to flip the texture, or more accurately each individual tile? I know I would also have to change each tile's coordinates, but that's for after.

sentences:
Question about save games format my question is about save-games format.

Look at this screenshot:

On the left I made a "simple" fake savegame (Ini format) and on the right there is a "complex" TR2 save game.

I'm wondering how does the complex one work, and why.

I thought that it was made this way to prevent from cheating-editing values, and the format was just a "simple" save encrypted with a key (like aes does).

I'm sceptic though, I don't think every game has implemented an encryption algorithm to save some data. Maybe I miss something, or maybe it's done this way.

Do you have some informations about this ? Have you ever asked yourselves how does this works ?
Thanks, have a good day !

sentences:
How can I rig an SVG humanoid? I have a template SVG file for an articulated doll and it looks something like this:

I can manually rotate and pose it in Adobe illustrator, but is there a better workflow to rig 2D segmented assets?

sentences:
How can I generate random meaningful words in a typing game? I want to make a typing game where users have to type the words displayed on the screen. But I don't know how to generate meaningful English words not gibberish.

What technique can I use to achieve this?

sentences:
How to animate infinite rotary movement I would like to add a chainsaw (or something similar to it... a rotary blade) to my game as a melee weapon. In fact, a rotary blade is a better example.

Would it be better to do it in blender somehow, using skeleton, or should I just create two parts (the handle and the blade) and then rotate it in UE4?

sentences:
Should all primitives be GL_TRIANGLES in order to create large, unified batches? Optimizing modern OpenGL relies on aggressive batching, which is done by calls like glMultiDrawElementsIndirect. Although glMultiDrawElementsIndirect can render a large number of different meshes, it makes the assumption that all these meshes are made of the same primitives (eg. GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_POINTS).

In order to most efficiently batch rendering, is it wise to force everything to be GL_TRIANGLES (while ignoring possible optimizations with GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN) in order to make it possible to group more meshes together?

This though comes from reading the Approaching Zero Driver Overhead slides, which suggests to draw everything (or, presumably, as much as possible) in a single glMultiDrawElementsIndirect call.

sentences:
Orthographic (0,0) center I want to display coordinates from 0 to n, where n is int > 0.
The map is displayed correctly heaving it's center in the middle of the screen pointing top right. I would like to have it pointing bottom right.

My implementation is:

effect.Parameters["wvp"].SetValue(Matrix.Translation(0, 0, 0) *
    Matrix.LookAtLH(Vector3.Zero, Vector3.UnitZ, Vector3.Up) *
    Matrix.OrthoLH(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1));
effect.Techniques[0].Passes[0].Apply();

GraphicsDevice.SetDepthStencilState(GraphicsDevice.DepthStencilStates.None);
GraphicsDevice.SetRasterizerState(GraphicsDevice.RasterizerStates.CullNone);
GraphicsDevice.Clear(Color4.Black);
GraphicsDevice.SetVertexBuffer(layer.Buffer);
GraphicsDevice.SetVertexInputLayout(layer.InputLayout);

GraphicsDevice.Draw(PrimitiveType.TriangleList, layer.Buffer.ElementCount);

And a screenshot of the situation now.

The white area is around coordinate (0, 0). The line is just at X = Y for orientation. The black line should be pointing bottom right as mentioned above. Any Idea how this can be done?

sentences:
Algorithm to make groups of units In Age of Mythology and some other strategy games, when you select multiple units and order them to move to some place, they make a "group" when they reach the desired location:

I have a Vector with several sprites, which are the selected units, the variables tarX and tarY are the target x and y. I just want an example, so you can just set the x and y position and I can adapt it to my code. Also, I would like to ask that the algorithm calls "isWalkable" for the x and y position, to determine if it's a valid position for each unit.

sentences:
Libgdx implement 2d drop shadow for transparent sprites I am a libgdx learner. For an learning application that I am developing using libgdx on android, I need to show drop shadow or glow effect when a sprite is touched. The sprites are created from a TextureAtlas and can have any irregular shape as per the transparent image in the texture. There are a ton of images so it is not possible to create a separate shadow image for each one.

I have looked at some options but haven't been able to figure out how to do it. What I have tried include:

OpenGL ES drop shadows for 2D sprites
I tried the approach of taking the texture and bluring it using the blurutils class provided by Matt Deslauriers at https://github.com/mattdesl/lwjgl-basics/wiki/OpenGL-ES-Blurs. The code I have used is below. But the performance was very slow on android devices for the BlurUitls.blur call.

private Sprite getShadowSprite(String name,float width,float height) {
//Load the texture
Pixmap orig = new Pixmap(Gdx.files.internal(name));

//blur it
Pixmap blurred = BlurUtils.blur(orig, 16, 2, true);

//we then create a GL texture with the blurred pixmap
Texture blurTex = new Texture(blurred);
Sprite shadow=new Sprite(blurTex);
shadow.setSize(width,height);
shadow.flip(false,true);

//dispose our blurred data now that it resides on the GPU
blurred.dispose();
return shadow;
}

I do not have much of an understanding of shaders. Please advise as to what is the most performant way to be able to generate a drop shadow for a transparent image in libgdx.

sentences:
How to guarantee that player fits rooms of a cave created by Cellular Automata? I've implemented a cellular automata algorithm to generate a cave for my game and now I need my player object, which occupies 3x3 tiles in total, to be able to pass between the rooms.

The problem is that some of the rooms automatically created by cellular automata do not have the necessary width/height for the object to pass (example: a 2 x 3 tiles corridor).

How can I transform the result from the cellular automata so that I guarantee that the player is able to pass in any of the rooms? The idea is that this can be done in real time so that I can do an endless game.

This was done in GDScript but any examples in any other language, like C# for Unity, are welcome.

Update

As said in the comments, I could make a map where each cell would correspond to a 3x3 on the final map but, my problem is that I need the 1x1 tiles because my player should lose a life when hitting the walls (and that way I can create some kind of "spikes" based on the walls).

Given that, how can I add 1x1 tiles to the map created from the 3x3 and still guarantee that the player fits the cave's "corridors"?

Update 2

The only rules I currently have for CA are:

If total neighbour walls > 4, the cell becomes a wall
If total neighbour walls < 4, the cell becomes empty
Else, remains as it is

The total number of iterations for the CA is 2

Solution

I was able to do this the way that DMGregory said:

First I run the CA after building the map as I did before in order to add the "empty space adjacent to wall" cells (now on called EmptyNextToWall) to the map
Then I run the CA with the following rules, until none of them are verified (it did not pass 5 iterations on my scenarios):

If my current cell is EmptyNextToWall and has more than 4 EmptyNextToWall adjacent to it, make it an Empty cell
If my current cell is EmptyNextToWall and the adjacent diagonals are a Wall and a EmptyNextToWall, make it an Empty cell
If my current cell is EmptyNextToWall and there's no Empty cells around it, make it an Empty cell
If my current cell is a Wall and there's at least one adjacent Empty cell, make it an EmptyNextToWall
If my current cell is EmptyNextToWall and there's no adjacent Walls, make it an Empty cell

sentences: Using XAudio2 to Process Microphone Input I am trying to come up with a solution to process microphone input for a game. Not entirely sure where to start. I was looking into using XAudio2, but it doesn't seem to have support for microphone processing? Is this correct? What do most companies in the industry currently use?

sentences:
How do I smooth out the edges at the end of the threshold on noise? I'm making a terrain generator for a game and I need it to smooth down to a float, I've tried a bunch of different things with lerping but I can't figure it out.

I need to stop this from happening by smoothing the height down to 1 once it gets to the edges.
public LevelManager level;

public float noise;
public float oceanNoise;
public float mountainNoise;

public Transform water;
public Transform land;

public void Start()
{
    level = FindObjectOfType<LevelManager>();

}
public void Update()
{
    float landNoise = noise + oceanNoise;
    noise = SimplexNoise.Noise(transform.position.x * level.deatalscale, transform.position.z * level.deatalscale);
    oceanNoise = SimplexNoise.Noise(transform.position.x * level.oceanDetailScale, transform.position.z * level.oceanDetailScale);
    mountainNoise= SimplexNoise.Noise(transform.position.x * level.mountainDetailScale, transform.position.z * level.mountainDetailScale);

    if (noise > level.thresh)
    {
        land.gameObject.SetActive(true);
        water.gameObject.SetActive(false);

    }
    else
    {
        land.gameObject.SetActive(false);
        water.gameObject.SetActive(true);

    }

    if (oceanNoise < level.oceanHhresh)
    {
        land.gameObject.SetActive(false);
        water.gameObject.SetActive(true);

    }

    if (oceanNoise < level.oceanHhresh)
    {
        land.gameObject.SetActive(false);
        water.gameObject.SetActive(true);

    }
    land.transform.localScale = new Vector3(level.planeScale, Mathf.Lerp(noise*level.height,1,noise) * level.height + level.addHeight, level.planeScale);

    if (level.landpos.Contains(transform.position))
    {
        Destroy(gameObject);
    }
}

This script goes on the terrain chunk and it uses its position to find value in noise, the level manager just holds a few settings.
Any help is appreciated, thanks in advance.

sentences: Cannot select bone influence in Unity In my sprite editor, under the weights menu, the option for bone influence appears kinda faded and I am not able to select it. Unity is also not generating automatic weights around my bones for different sprites in the same image. Is this feature only available in the pro version, or is there some other setting that is causing the problem?

sentences:
Raycast Masks not working Unity3D I'm having a problem with filters/masks when raycasting.

I've created a LayerMask and then in the inspector selected the layer I want to ignore when Raycasting. however then I print out the name of the object hit by the raycast I am still getting hits on objects on the layer masked out, as well as on other layers.

public LayerMask rayMask;

RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, out hit,rayMask)){
    Debug.Log (hit.collider.name);
}

I have paused the Game and checked that the object I'm getting a hit on is indeed on the layer in the mask.

sentences:
Libgdx game lags on better phones I'm developing a candy crush game and it works just fine on desktop, my mobile (Honor9) and the one I'm using as emulator. But, for my surprise, it lags on my girlfriend's mobile, which is way better then mine (Samsung s10), when I'm doing the starting game animations (pieces falling to their position).
I believe the problem is not how I'm loading assets because it just lags on that specific animation. Does anyone know what I might be doing wrong?

sentences:
Matrix camera, movement concept Someone told me that the movement concept in my 2D game is bad. When left or right arrow is pressed I'm scrolling the background which makes you feel that player avatar is moving (the avatar's X-position remains the same).

So... he told me something about matrix view. I should create all walls and platforms static and scroll only the camera and move the player's rectangle. I did a little research in Google, but found nothing.

Can you tell me anything about it? How to start? Maybe links, books and resources?

sentences:
Unity transform.rotation not giving real value i confused , when the object is at 0 rotation ( not rotated yet )  , it giving real value ( 0 ) , but when the object is rotated 180 degree , transform.rotation is giving false value ( 1 ) , this is the screenshot :

If the picture is not clear enough , go here https://i.stack.imgur.com/miWIE.png .

Then this is my script that debugged the code and rotate the object :

void RotateFlip() {
    GameObject databasegameobject = GameObject.Find ("database");
    database databasechange = databasegameobject.GetComponent<database>();
    Debug.Log ("current object rotation is " + theiconarrow.transform.rotation.z + " degree ");
    if (databasechange.pengertianmenustate == 2) {
        if (theiconarrow.transform.rotation.z == 0 ) {
            theiconarrow.transform.Rotate (new Vector3 (theiconarrow.transform.rotation.x, theiconarrow.transform.rotation.y, 180), Space.World);
        }

    }

    if (databasechange.pengertianmenustate == 1) {
        if (theiconarrow.transform.rotation.z == 180) {
            theiconarrow.transform.Rotate (new Vector3 (theiconarrow.transform.rotation.x, theiconarrow.transform.rotation.y, 180), Space.World);
        }
    }
}

I don't understand why this thing happened , is this a kind of bug or what ?

I am sorry if this already asked somewhere , but i just don't know how to find it at search engine ( neither here ) .

Extra question ( optional ) : is there any application to build app with easy coding and not an game engine ?

sentences:
Why does my tile palette not arrange nicely? I made my own Hex Point Top Tile sprite sheet, ensuring it's pixel perfect and align well. Slicing in Sprite Editor has no problem too. However, when I drag the sprite sheet to a new Palette in the Tile Palette panel, the tiles show up with random spaces. See screenshot below:

What did I miss?

The sprite sheet is here, 30 x 30px offset, 24 x 24px padding, 66 x 66px tile size:

I'm using Unity 2019.3.10f1.

sentences:
iOS unity game was ~60mb on testflight but now its +400mb on release, why is that ? I really have nothing else to add except that bitcode wasn't enabled, the same game was ~60Mb when we were testing it with TestFlight, after uploading it to the store the game just became 422Mb, why is that ?

Thanks!

sentences: SDL surface inside another GUI component? Is there a way to host an SDL surface inside another GUI component so that SDL is not at the top-level? For instance, could I put an SDL surface inside a Java JPanel or other widget?

sentences:
Chunking/caching large levels in a singleplayer game Does it make sense to try to offload a large nonlinear level into file-based chunks, and load those on demand? We've implemented level chunking to improve rendering performance, but still all level objects are persistent in RAM.

If yes, then how do we keep the illusion of a living/changing world? Since the level is not linear, but rather like a world in itself, we cannot just pretend that whatever one's gone through is gone forever.

Is it a better idea to make the levels complex enough, but also optimized enough to be always persistent in memory, but implement micro/macro jump points which allow one to jump to a totally distant point (i.e. a whole new level), thus forgetting about the world consistency, and the illusion of a changing world. Also, this would allow us to follow a slightly linear story in a seemingly non-linear world. It would be possible to just apply a new state to the existing state of a "distant" level, if we are to bring the player back to it.

sentences:
Unity: Move Collider up stairs/ramps The bots have a simple Capsule collider which cannot tilt. Movement is applied across the horizontal axes, gravity is enabled on the rigidbody. It moves up stairs okay with steps roughly 0.2 units high. When the bots speed is too slow or he is moving up steep ramps he gets stuck. I've tried tinkering to fix the problem but to no avail.

    float gravity = currentMovementSpeed * 2f;
    Physics.gravity = new Vector3(0, -gravity, 0);

Here is the problem: https://youtu.be/ypCavT3_As0

What is a simple way to consistently force a collider up ramps and stairs?

sentences:
Infinite / Treadmilling Hexagonal Grid So, I can happily render an infinite square grid by moving said grid whenever the camera moves out of a grid square,

auto diff = (cameraTranslation - gridTranslation);
bool moveGrid = false;

if (diff.x > cellSize.x / 2)
{
    gridTranslation.x += cellSize.x;
    moveGrid = true;
}
else if (diff.x < -cellSize.x / 2)
{
    gridTranslation.x -= cellSize.x;
    moveGrid = true;
}

if (diff.z > cellSize.z / 2)
{
    gridTranslation.z += cellSize.z;
    moveGrid = true;
}
else if (diff.z < -cellSize.z / 2)
{
    gridTranslation.z -= cellSize.z;
    moveGrid = true;
}

if (moveGrid)
    gridTransform.Translate(gridTranslation);

However, when working with a hexagonal grid, things get a bit more complicated. (For that matter, if the grid was textured, I'd have to adjust the grid translation based on the tessellation distance... ouch.)

In this case, I'm dealing with a wireframe hex grid:

And I'm a little unsure how to treadmill in this case.

The first thing that comes to mind is that, given that the camera starts in the center of a hexagon, determine if the camera has exited the cell in which it started. If so, adjust grid position by

float angle_from_center = atan2(camera.z-grid.z,camera.x-grid.x);
grid.x += cell_size.x * cos(angle_from_center);
grid.z += cell_size.z * sin(angle_from_center);

Which will probably work, but the issue gets more complicated when considering that I'm not only checking if the camera has moved a certain distance from the cell center, but if it has crossed a border.

I could clamp the angle of the camera relative to the cell origin to 1/12 of a circle, which would make hex boundary calculation easier, but this seems like a hack.

Any suggestions? I'm 75% sure I'm over thinking this one.

sentences:
Direct3D11 Reading from (Static) Index Buffer Good morning,

I have an Indexbuffer created with usage D3D11_USAGE_DEFAULT and CPUAccessFlags 0. Now I want to read data from this buffer regularly (it is a terrain index buffer). But the problem is that I am not allowed to read data from the buffer, because the buffer is not created with the flag D3D11_CPU_ACCESS_READ.

Even if I make the buffer dynamic, I still am not allowed to read from the buffer. This is because the CPUAccessFlag D3D11_CPU_ACCESS_READ is not allowed to be used together with usage D3D11_USAGE_DYNAMIC.

Could anyone please give me advice on how to properly read data from a vertex or index buffer in Direct3D11. In my case I want to read data from it frequently.

sentences:
Drawing a level in SFML (C++) So in an attempt to move out of the console environment I have set up an SFML poject in Visual Studio. I am currently trying to draw a stage from a vector within a vector (Matrix?), and the results are not exactly what I was hoping for.

First i tried mapping out everything as '0's representing empty space, changing the top and bottom vector to '1's, representing objects, thus drawing what essentially would be a rectangle covering the bottom and a rectangle covering the top, everything inbetween ignored.

bool stage::load()
{
 vector<int> tempvec;
 for (int i = 0; i != 30; i++)
 {
    for (int j = 0; j != 40; j++)
    {
        tempvec.push_back(0);
    }
    hitbox.push_back(tempvec);
    tempvec.clear();
 }

 for (int i = 40 - 1; i != -1; i--)
 {
    hitbox[29][i] = 1;
 }
 for (int i = 30 - 1; i != -1; i--)
 {
    hitbox[i][0] = 1;
 }
 return true;    //Will use this more efficently once I get the function to work
}

So this is how I set up the stage variable-wise, hitbox being defined as:

vector <vector<int>> stage::hitbox;

I then try to map out the individual blocks, so every time it finds a '1' in the vector, it should print out a square (quad).

vector<VertexArray> tilesetrender;
VertexArray tmp(Quads, 4);
tmp.resize(4);

level.load();
for (int y = level.hitbox.size() - 1; y >= 0; y--)
{
    for (int x = level.hitbox.at(y).size() - 1; x >= 0; x--)
    {
        switch(level.hitbox[y][x])   //Switch case allows me to expand on this function in the future
            {
            case 1:
                tmp[0].position = Vector2f(y * 20 - 10, x * 20 - 10);
                tmp[1].position = Vector2f(y * 20 - 10, x * 20 + 10);
                tmp[2].position = Vector2f(y * 20 + 10, x * 20 + 10);
                tmp[3].position = Vector2f(y * 20 + 10, x * 20 - 10);
                tilesetrender.push_back(tmp);
            }
    }
}

With all the variables created, I proceed to draw the level.

for (int count = tilesetrender.size() - 1; count >= 0; count--)
{
    renderWindow.draw(tilesetrender.at(count));
}

And what I get is this...

The vertices being white, and the background being red. As I have said, I hoped for drawing two rectangles, one at the top and one at the bottom. I have no real idea regarding what part of my code is causing the error, but I've played around with the position commands the most, to no avail.

Thanks in advance.

EDIT: Code partially corrected (Thanks Alayric), thus rendering this image instead:

White being the vertices, red the background and blue the player (previously not visible).
Although it is a whole lot better, something is still incorrect, as the upper rectangle does not reach all the way, and the lower rectangle does not mirror the upper. I do belive the main problem has been solved, and thus I am able to continue on my own.

sentences:
BoxCollider2D fails verification, where CircleCollider2D does not I have a 2D game object with no parent and a 2D box collider set with trigger enables. The dimensions are quite large.

When I place the game object in the scene, manually, it works just fine. However, when I instantiate the prefab, it doesn't work; in the inspector view, under the collider component a notification appears:

  The collider did not create any collision shapes as they all failed verification. This could be because they were deemed too small or the vertices were too close. Vertices can also become close under rotations or very small scaling.

When I switch to scene view, while the game is in play mode, I can not see the collider boundaries. Surprisingly, everything works fine, if I use the circle collider.  Does anyone know what the problem could be?

sentences: Quaternion.AngleAxis smallest value? If I'm using an angle with a value of somewhat below 0.1 degrees in Quaternion.AngleAxis, the quaternion will not apply a rotation at all. Why is this?

sentences:
SV_POSITION in pixel shader What are the uses for SV_POSITION in the pixel shader?  Previously this was the POSITION semantic and it wasn't readable in the pixel shader, but now that it is, what can it be used for?

In an SM2 deferred renderer, you'd typically take the texture coordinates, transform them to the [-1, 1] range and then use an inverse view/position matrix to get the world position of a pixel.  Would SV_POSITION be usable here to reduce any of the calculations?  And if so, how would you do that?

sentences:
Weird libGDX BitmapFont Color Change (And Alpha) Bug I want to change the color of my libGDX BitmapFont, but it can't change it. The font is generated with Hiero v5 (Lastest as I Know) but the color of the font doesn't change. Here is the example code, the important part here is how modify the alpha channel for an animation I want.

font = new BitmapFont(game.getAssets().getFont(0.9f).getData(), game.getAssets().getFont(0.9f).getRegion(), false);
textLayout = new GlyphLayout(font, "Tap to Start");
textPosition = new Vector2();
textPosition.x = Constants.HALF_WIDTH - (textLayout.width/2);
textPosition.y = 150;
//font.setColor(255f/255f, 183f/255f, 77f/255f, 0.3f); This doesn't work as well
font.getCache().setColor(255f/255f, 183f/255f, 77f/255f, 0.3f);

//Font Drawing in render Method
font.draw(batch, textLayout, textPosition.x, textPosition.y);

Here is a screen of the result of this code (color doesn't change).

Font resource image has white letters and transparent background.

sentences:
(2D) Take player speed into account while shooting bullets In my top down 2D game, there is a plane as shown below:

The plane shoots bullets forward. For firing bullets, I use:

obj.GetComponent<Rigidbody2D>().AddForce(transform.up*500);

However, when player presses up arrow or A key, plane speed increases. At this point, bullets are slower than the plane and appear to move backwards when plane moves at maximum speed.

How do I take into account player speed so that force applied takes into account player speed?

sentences:
How to make Scriptable Objects derive from other Gameobejcts? I encountered a problem where I want to make a Scriptable Object that derives from another class, but C# does not support multiple inheritance. Further, I do not think it would not make sense to make interfaces for this example. There is a lot of duplicate code within methods that only an abstract class could contain implementations of.

Basically, I want an abstract class that models "anything that can take a turn." I call it a TurnTakeable. But I also want the TurnTakeable to be split into friend and foe derived types, as the two are slightly different. Yet they mostly have the same behavior.

Is there a workaround, or do I have to make an interface? :(

sentences:
How to create a correct Unity package copy, which will not be replaced when you import? I create a "Package 1" consisting of section A (unique) + section B (which will be repeated in all my other packages). This package works correctly is he is alone.

Next, I create a "Package 2" consisting of: section C (unique)  + Section B (from Package 1).

To save time, I replaced the texture maps in the materials belong to old section A parts and replace this part on section C (directly on models in the Mesh.)

I renamed most objects in the scene and in the package as a whole.

I delete all prefabs of «section A» and create prefabs «section C», because they are not pick up name changes. The prefabs of «section B», I left as is.

Now when I import «Package 2» in the scene that already contains the «Package 1», it begins the mess: «Package 1» Files are replaced by «Package 2», even them are named differently.

How to avoid it?

I can’t create each scene from scratch, unfortunately it will lead to the insane time-consuming.

Huge thanks for your support!

sentences:
Converting Doom maps to JSON This is a really cool demo of a Canvas Doom Engine made back in 2006:

http://canvex.lazyilluminati.com/84/play.xhtml

Here is the e1m1 map in JSON format:

http://canvex.lazyilluminati.com/84/map1.js

Does anyone know of the tool used to convert Doom maps into JSON? I can't imagine this was done by hand :)

sentences:
PVRCT Texture Format with glTexStorage2D on Open GL 3.0 ES How? I've looked everywhere and I can't seem to find the answer.

How can I use glTexStorage2D with PVRCT textures? I've done this:

#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02

glTexStorage2D(GL_TEXTURE_2D, 1, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, m_uPixelsWide, m_uPixelsHigh );

Where the GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG internal format works for glTexImage2D, but when I run that Tex Storage command, my pvr textures come out black. There are no errors posted, and when I query glGetTexParameteriv, my texture is indeed set to Immutable.

Does PVRCT not work for opengl 3.0?

sentences:
Simplifying Object Factory I'm making a game for Android using Libgdx with Android Studio in Java. In my game, I have a class called ObjectFactory which has a method createGameObject(int objectType) which receives an integer from ObjectIds (a static class that hold a final static numbers for every object type: PLAYER = 0, BULLET = 1, ENEMY = 2 and etc...).

This method has a switch condition and 'till now I have reached 69 types of objects. The method gets the id, looks for it using the switch, creating that object and returns it. At the beginning it was comfortable using this way, but now it's really annoying looking for stuff over there because the switch statement is huge. This is an example of a case:

        case Rules.GameObjectIds.EXPLOSION:
            Explosion explosion = Pools.obtain(Explosion.class);
            explosion.init(getTextureAtlas(explosion, AssetsPaths.Gfx.Sheets.Misc.Explosion.DATA_FILE), AssetsPaths.Gfx.Sheets.ImagesNames.BIG_EXP, x, y, AssetsPaths.Configs.ParticleEffects.EXPLOSION);
            explosion.setDistanceInteraction(Rules.Misc.Explosion.BLAST_RADIUS);
            gameObject = explosion;
            listName = Rules.System.GameObjectTypes.EXPLOSIONS;
            createEffect(AssetsPaths.Configs.ParticleEffects.BLAST_RING, gameObject);
            createLight(explosion);
            break;

I'm thinking about a way to simplify the Object Factory, any suggestions?
Thanks in advance

sentences:
Character getting slow when reached to speific path point I have manually placed some cube on the floor and aim to walk my character on those cube as they are appearing in the hirarchey and here is the walk code.

 if (Vector3.Distance(pathPositions[pathIndex], walkingCharacter.transform.position) > 0.5f)
        {
            Vector3 newPosition = pathPositions[pathIndex] - walkingCharacter.transform.position;
            walkingCharacter.transform.position += newPosition * Time.deltaTime * walkingSpeed;
            walkingCharacter.transform.rotation = Quaternion.LookRotation(newPosition);
        }
        else {
            pathIndex++;
        }

I have walk in place animation which is working fine and the above code moving my character to specific points but not smoothly. As my character approach to specific path point it get slow then suddenly move towards next point. What i am doing wrong. Here is the video of the problem maybe it will helpful to understand the problem.

sentences: Fastest way to render image data from buffer Currently I am doing my rendering by using a 3D array window_width x window_height x rgb as a buffer, then looping through the buffer and plotting pixels on screen using SDL2 (SDL_RenderDrawPoint). I know this is horrible and stupidly slow but I am not well experienced in graphics techniques. What is the better way to do this?

sentences:
Settings object with singleton pattern I need to build an object that will have only one instance because this Object is dedicated to the storage of vital settings for my application and I would like to avoid a misuse of this type or a conflict at run-time.

The most popular solution for this, according to the internet, is the Singleton pattern. But I would like to know about other ideas or solutions for this; also I would like to know if other solutions can be much more easy to grasp for an user of this hypothetical library.

Thanks.

sentences:
"Compose PSM Master Package" doesn't do anything I made a game for PlayStation Mobile, and I'm ready to build the master for publishing.

Per the mastering instructions, I have filled out all the required information in app.xml, created app keys for this specific application, and built on Release.

And now that I click on "Compose PSM Master Package", the PSM Studio pretty much does nothing. I have .psdp and .pspp files in the Release folder, but I don't get a .psmp file for submission.

I think all my account information is okay, including bank account information.

I also tried deleting and recreating the app keys, but "Compose PSM Master Package" still refuses to do anything.

What am I missing? What kind of interaction should I expect from "Compose PSM Master Package"?

sentences:
Achieving 2D Lighting for Terraria-Like Game I'm trying to achieve the fog-of-war lighting style that Terraria and Starbound have. Terraria's lighting system seems to be more blocky/tile based, but Starbound's is a lot more smooth.

The Desired Effect:

Starbound is using a shader to render its lighting, but how it's going about that is quite a mystery to me.

The idea I had on how to achieve the desired effect is the following: Create a texture that is black and somehow calculate the area that is white, storing this in a light map render texture, finally doing an Additive Blend of both the main texture and the light map texture to achieve a similar effect to Starbound's. (However this does not take into account lights in the world, which I also have absolutely no clue how to include in my calculation to the light map render texture)

I say somehow in italics because I have no clue as to how I can create this "Mask" effect in the light map render texture. How I can do calculations necessary to create the mask is beyond me; I don't even know how I can begin to translate the game world's data, relative to the what the camera sees, and update the texture accordingly.

TLDR: How can I achieve lighting similar to that of either Terraria or Starbound in Unity 2D?

sentences:
What is the efficient way to sync TextureProgress with a Timer not in the UI? I want to use a TextureProgress which reflects the state of a Timer.
I have tried to emit signals:

FROM: the Node2D._process() which owns the Timer with emit_signal("time_left_changed", timer.time_left)
TO: the UI

but it seems to make huge impact on performance.

sentences:
Efficient tile maps in Corona SDK I need to create a tile map based level system for Corona SDK that loads files created with Tiled [1]. It also needs to support user touch scrolling and zooming.

I've searched the Corona forums for possible solutions but the ones they talk about don't convince me. They basically have a matrix of Sprite objects which have an image loaded and a given position. That makes scrolling and zooming a bit hard.

Any better ideas?

[1] http://www.mapeditor.org/

sentences: Can I remove the "powered by COCOS creator" message from my game? Is it legal to remove powered by COCOS creator in the page where the html is exported and also in the splash screen?

sentences:
Limiting the speed of a dragged sprite in Cocos2dx I am trying to drag a row of sprites using ccTouchesMoved. By that I mean that there is a row of sprites (they are colored squares) lined up next to each other and if I grab one with a touch the rest follow it. If a sprite moves off screen I want to append it to the rest of the sprites in formation. However, if the sprite formation moves too fast it creates a slight gap between it and the appended sprites. How do I go about limiting the speed that I can drag the sprite with ccTouchesMoved? This is the only solution I could think of to my problem. If anyone has another suggestion to prevent this sprite gap from happening I would appreciate it.

In ccTouchesBegan I loop through the sprites, mark the one that is touched(used for another part of game), and save the distance between the touch point and every other sprite.

touch = (CCTouch*)(touches->anyObject());
location = touch->getLocation();
for (int i = 0; i < grid->getGridSizeY(); i++) {
    for (int j = 0; j < grid->getGridSizeX(); j++) {
        button = grid->button(i, j);
        button->setDistanceX(location.x-button->getPositionX());
        button->setDistanceY(location.y-button->getPositionY());
        if (button->boundingBox().containsPoint(location)) {
            button->setTouched(true);
        }
    }
}

Then in ccTouchesMoved I loop through all the sprites again and set them to always be the same saved distance from the touch point.

touch = (CCTouch*)(touches->anyObject());
location = touch->getLocation();
for (int i = 0; i < grid->getGridSizeY(); i++) {
    for (int j = 0; j < grid->getGridSizeX(); j++) {
        button = grid->button(i, j);
        button->setPositionX(touchLocation.x - button->getDistanceX());
        button->setPositionY(touchLocation.y - button->getDistanceY());
        }
    }
}

This is the update method code only for a sprite moving off the left side of the screen. No point in writing all the sides until I get one side to work:

for (int i = 0; i < grid->getGridSizeY(); i++) {
    for (int j = 0; j < grid->getGridSizeX(); j++) {
        button = grid->button(i, j);
        //Replaces button if it goes off left side of grid
        if (button->getPositionX() < grid->button(0, 0)->getPositionX() - button->boundingBox().size.height / 2) {
            button->setPositionX(grid->button(grid->getGridSizeY() - 1, 0)->getCoord().x + button->boundingBox().size.height / 2);
            button->setDistanceX(location.x-button->getPositionX());
        }
    }
}

sentences:
DirectX 9 Light projection I am trying to see changes of component 'z' from light space. In vertex shader component 'z' divide 'w' is not 0. But after sending float4 with texcoord1 to pixel shader its 0. All matrices are good. Here is the code:

float4x4 MatWorld;
float4x4 MatView;
float4x4 MatProjection;

float4 LightViewMatrix;
float4 LightProjectionMatrix;
float4 LightPosition;

texture tex0;

sampler2D ShadowMap = sampler_state
{
    texture = tex0;
};

struct VertexOut
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
    float4 lightViewPosition : TEXCOORD1;
};

struct VertexIn
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
};

VertexOut VSLight(VertexIn In)
{
    VertexOut Out;

    In.position.w = 1;
    Out.position = mul(In.position, MatWorld);
    Out.lightViewPosition = Out.position;
    Out.lightViewPosition = mul(Out.lightViewPosition, LightViewMatrix);
    Out.lightViewPosition = mul(Out.lightViewPosition, LightProjectionMatrix);

    Out.position = mul(Out.position, MatView);
    Out.position = mul(Out.position, MatProjection);

    Out.tex = In.tex;
    return Out;
}

float4 PSLight(float4 Color : COLOR, float2 tex : TEXCOORD0, float4 lightViewPosition : TEXCOORD1) : COLOR
{
    float depth = lightViewPosition.z / lightViewPosition.w;
    if (depth == 0)
    {
        return float4(0, 0, 0, 1);
    }
    return float4(depth, 0, 0, 1);
}

technique T1
{
    pass P0
    {
        VertexShader = compile vs_2_0 VSLight();
        PixelShader = compile ps_2_0 PSLight();
    }
};

All objects are black. Sorry my english is slightly poor.

sentences:
How can I fire a bullet from an actor's position? I want to shoot a bullet from an actor.

I know I need a location in space to fire a bullet from, which I've got in the form of a model set as an actor. Now I need to create a new object (in this case, a bullet) with the same starting coordinates as that actor and set its movement direction to be the direction the actor is facing.

(Imagine a gun, a bullet is to be created at the coordinates of the tip of the barrel and the bullet will move forward in the direction that the gun was facing).

I can't figure out how to get the gun to generate the bullet or how to set the speed of the bullet. How can I do that in Unreal?

sentences: Line strokes also adding borders to other shapes? When you run the project, you can see that the first circles have a black border around them. When I remove the Game.drawLines(), the circles don't have the border around them anymore. Any help is appreciated!

sentences:
Slick2D: Changing an Image's colour to Color.white I am working on a game where we would like the enemies to flash white when hit by a bullet. Ideally, we would like to use the same mechanism to render an Image in any colour. Our Images are all png files with transparent backgrounds and these transparent areas must exist in the coloured version of the Image.

Testing shows that Image.draw(x, y, filter) does not change the appearance of the image when given Color.white

Testing has also shown that Graphics.drawImage(Image, x, y, color) has no affect when color is set to Color.white

Is there a way to change an Image to white using existing Slick2D functionality? Failing that, is there an easy way to use LWJGL to perform the colouring that can be easily incorporated into a Slick2D project?

NB Answers that allow an Image to be rendered in an arbitrary colour will be preferred over answers that are specific to Color.white

sentences:
Run script after game start, before scene load I'm making some kind of dependencies solving script. To work this script, it must be run before all other MonoBehaviour scripts.

So I made the script something like this:

public class DependencyController {
    private static Dictionary<string, bool> m_DependencyTable = new Dictionary<string, bool>();

    static DependencyController() {
        SceneManager.sceneUnloaded += ResetDependencyData;
    }

    ... some other stuffs ...
}

I'm using dictionary to compare which dependency script(s) loaded. To can use every script's Awake/Start, I declared as static and instantiated right after.

The system actually work pretty good, all scripts can access DependencyController in Awake/Start without any problem, but have some questions remains:

Is static m_DependencyTable is always created before scene loaded?
Is static DependencyController constructor always called after SceneManager is loaded? As you can see, I attached EventListener in SceneManager.sceneUnloaded so that I can clear the dependency table before scene loads.

Any advice will very appreciate it.

sentences:
Programmatically Modifying Images to Create Morning, Sunrise/Sunset and Night-Time Modes I'm using RPG-Maker-XP-like sprites (any 2D adventure/RPG style sprites). I would like to tint them so that they look different at different times of day.

Times of the day are the set of:

Daytime (normal)
Early morning (bluish?)
Sunrise and Sunset (orangish?)
Night time (dark)

What do I need to do to tint them, and make them look good, during different times of the day? Are there any "known" formulas for any of these times, like "delete the green blue component and tint heavily red+green for a sunrise effect"?

Ideally, I have just the original sprites, with no additional information or images (like spot-highlights or shadows separated out).

Finally, I'm using Silverlight/FlatRedBall for this, so I do have access to per-pixel information, as well as RGB tinting (adding, subtracting, multiplying, etc.)

sentences: Can I use the free version of Construct 2 on Gamejolt? According to Scirra's website, I am not permitted to use the free version of Construct 2 for commercial purposes. If I host a game I created with the free version of Construct 2 on Gamejolt where I can earn money on the game, am I violating Scirra's terms?

sentences:
How should I implement a timer in a strategy game? I'm developing a real strategy game for Android and want to implement timers. Those timers will represent the time remaining until some building is finished.

Say that i have a building in construction that takes 45 minutes to be completed.

How can I communicate this timer information between my client (Android app) my server and my database? Should I communicate to the server every second in which state my timer is?
Should I even do this on the server (i.e., should the timer run on the client)?

I'm inclined to assign this task to the server for security and integrity reasons, but i'm not sure on the way i can accomplish that.

sentences: Collision and gravity problems So this is an easy question. I need to implement gravity in my game but where I'm stuck is what variables do I need in my Entity object for the calculations and a good algorithm that I can use for gravity and collision. The main reason why I'm stuck here is not just I'm implementing this into a huge program that handles the different states, windows, buttons and plenty of other stuff but all I got it the x, y, width, and height for my Entity and every time I try and calculate collision if the object hits a wall it stops, and I have no acceleration variables as I don't know how to use a algorithm with them so I'm guessing as I go and so my whole program is a mess. To make it clear of what I need someone to help me with is can you show me an example of how I would use my x, y, height, and width and move it around, use jumping, use gravity. I never really saw any of this so if someone knows how to do this, and or you have done this is a game before which you could show me what you did that would be great. I'm new to this so even a link is good. Thanks in advance!

sentences:
Difference between rotation methods? My question is in about rotate methods in android.graphics.Camera. In Docs, I saw these comments:

  public void rotateX (float deg) Since: API Level 1
  Applies a rotation
  transform around the X axis.

  public void rotate (float x, float y, float z) Since: API Level 12
  Applies a rotation transform around all three axis.

There is my question:What is difference between using rotate (float x, float y, float z) and a sequence of rotate methods? For example what's the difference between these two snippets A and B?

A)

camera.rotate (x, y, z);

B)

camera.rotateX (x);
camera.rotateY (y);
camera.rotateZ (z);

sentences:
Why do I see spaces between polygons in OpenGL, only on an Nvidia 720M? I'm developing an OpenGL application that renders .obj 3D models.  I use VBOs to render the polygons.  Using the same code, the loaded models appear fine on all PCs, except on my Nvidia 720M.

My laptop sports an Intel HD 4000 embedded graphics GPU, and an Nvidia 720M. When I use the Intel GPU, it looks fine, but when I load it on the Nvidia 720M, spaces appear around polygons like so:

On Nvidia 720M GPU:

On everything else:

No other 3D application that runs on the Nvidia 720M GPU has the same issue.  I am using the latest drivers.

Is this a problem with my application?  How can I fix it?

sentences:
Rectangular selection on isometric map Before we get started I checked the following questions:
Isometric Tile Selection with rectangular bounding boxes
Isometric rendering and picking?
Calculating the number of tiles shown on an isometric map <- this is exactly how I get my top-left and bottom-right tile, but I can't calculate what's between them
I can pick tiles perfectly, I'm struggling with the automatic selection given two tiles (top-left and bottom-right in screen coordinates).

I've attached a drawing to help you visualize:

As you can see it's a Diamond setup, not staggered isometric. I'm struggling with finding the orange tiles, I have the green tiles' coordinates.

Btw, it's not true isometric, it's 2:1 "isometric".

sentences: Lerp UI Color outside update method? I'm able to Lerp the color of a UI panel within the Update method. However I'd like to trigger behavior a single time when needed. If I put it in a method and call it it only changes for a brief time and doesn't fully complete. I could probably set a bool flag within the update method but that seems sloppy.

sentences:
Combining 2D and 3D in game engine I've implemented basic 3D functionality and made little "2.5D" demo in orthographic projection using OpenGL ES 2 and Box2D.

Now I want to make completely two-dimensional game (using sprites) and consider 2 variants:

Implement 2D graphics separately from 3D in separate layer, leave 3D stuff in background, draw 2D using various simplified algorithms (disable depth testing, simplified culling etc.)
Leave everything as is and use billboards for sprites

Currently I use hierarchical system of entities with matrix transformations. I know about computational complexity of 3D and 2D graphics and believe first method should result in faster code, though it's my first engine and my google-fu fails me this time, so I'm not sure about it.

Engine is Desktop/Mobile.

What method would you recommend? Does implementing first method worth it (in performance aspect)?

sentences:
How can I destroy the trigger forever? I have a trigger that plays an animation but when i switch scene and i come back to the original scene, the animation plays again. I want to remember actioned triggers in order to play triggers once per scene. How can I do that?

The GlobalScript

public class GlobalScript : MonoBehaviour
{
    public static GlobalScript Instance;
    public Animator ani;
    void Awake ()
       {
        if (Instance == null)
        {
            DontDestroyOnLoad(gameObject);
            Instance = this;
        }
        else if (Instance != this)
        {
            Destroy (gameObject);
        }
      }
}

The current script (Running every time i load the scene)

    public Animator ani;
    public AudioClip sound;
    public GameObject text;
    private int seconds = 2;
    //var delay = 2.0; //This implies a delay of 2 seconds.

//  public void SavePlayer(){
//      GlobalScript.Instance.ani= ani;
//  }

    // Use this for initialization
    void Start () {
        ani= GlobalScript.Instance.ani;
        ani.enabled = false;
        text.SetActive (false);
    }

    void OnTriggerEnter(Collider other){
        AudioSource.PlayClipAtPoint (sound, transform.position);
        ani.enabled = true;
        text.SetActive (true);
        Destroy (gameObject);
        Destroy (text,3);
        //text.SetActive (true);
        //StartCoroutine(Die());
    }

    //And function itself
    IEnumerator Die(){
        //play your sound
        text.SetActive(true);
        yield return new WaitForSeconds(2); //waits 3 seconds
        Destroy(gameObject); //this will work after 3 seconds.
    }
}

sentences:
Why would a property be returning null? I'm working on learning how pass data from one script to the other in Unity and I'm getting a little confused.  I have two scripts, PlayerData and CreateCharacter.  PlayerData is used to pass persistent data from one scene to another, so it's not going to be attached to any GameObject or Transform.  CreateCharacter, however, is attached to a button which gets the information from user input.  Here are the two scripts:

PlayerData

public class PlayerData{
    private string playerName;

    public string PlayerName{
        get{return playerName;}
        set{playerName = value;}
    }
}

CreateCharacter

public class CreateCharacter:MonoBehaviour{
    public InputField playerName;
    public PlayerData playerData = new PlayerData();
    public void AddStats(){}
    public void SubtractStats(){}

    public void CreateCharacterOnClick(){
        playerData.PlayerName = playerName.text;
        Debug.Log(playerData.PlayerName);
    }
}

What's happening is, when I click the button I'm getting a null reference error on playerData.PlayerName but if I just log playerData I actually get the object to return.  What I'm trying to see is that the character name(playerName) is logged when the button is clicked.  Can anyone explain to me what I'm doing wrong and how to fix it?

sentences:
Variable Problem in GameMaker Studio On obj_player I have a Create and Step event

Create:

/// Intialize Variables
grav = 0.2;
hsp = 0;
vsp = 0;
jumpspeed = 7;
movepseed = 4;
move = key_left + key_right

Step:

//Get the player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x,y+1,obj_wall))
{
    vsp = key_jump * -jumpspeed
}

//Horizontal Collision
if (place_meeting(x+hsp,y,obj_wall))
{
    while(!place_meeting(x+sign(hsp),y,obj_wall))
    {
        x += sign(hsp);
    }
    hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x,y+vsp,obj_wall))
{
    while(!place_meeting(x,y+sign(vsp),obj_wall))
    {
        y += sign(vsp);
    }
    vsp = 0;
}
y += vsp;

Error Message:

FATAL ERROR in
action number 1
of Create Event
for object obj_player:

Variable obj_player.key_left(100007, -2147483648) not set before reading it.
 at gml_Object_obj_player_CreateEvent_1 (line 7) - move = key_left + key_right

Whats wrong with this code? Ive been stuck on it for a couple days now, just really confused as I have seen this code work in action and for other people in this video https://www.youtube.com/watch?v=IysShLIaosk

sentences:
Help with dual quaternion skinning I'm trying to convert my code to use dual quaternion skinning instead of matrix skinning because i just can't get the skinning matrix created correctly from bones+weights using matrices.

Edit: just to clarify, if each vert has only one bone the matrix version did skin correctly.

But it's just not working and i really don't understand why, i'm using code i found here:

http://www.chinedufn.com/dual-quaternion-shader-explained/

http://donw.io/post/dual-quaternion-skinning/

I've looked at the assorted papers often brought up in the answers to these questions, but for the most part i just don't understand them.  I'm not even entirely sure how the [x, y, z, w] of a glm::quat correspond to the [1, i, j, k] of a quaternion--I think that w might be the scalar because it goes first in the actual byte order of the glm::quat struct, but i'm not sure.

Anyway, in my shader bindings i have:

void gltfShader::bindBones(const std::vector<glm::mat4> & bones)
{
    std::vector<glm::fdualquat> dual_quats(std::min<int>(bones.size(), 64));

    glm::quat r;
    glm::vec3 t, s, sk;
    glm::vec4 pr;
    glm::fdualquat dq;

    for(size_t i = 0; i < dual_quats.size(); ++i)
    {
        glm::decompose(bones[i], s, r, t, sk, pr);

        dq[0] = r;
        dq[1] = glm::quat(t.x, t.y, t.z, 0) * r * .5f;

        dual_quats[i] = dq;
    }

    glUniformMatrix2x4fv(u_bones, dual_quats.size(), GL_FALSE, (float*) &dual_quats[0]);
}

In the vertex shader:

mat2x4 GetBoneTransform(ivec4 joints, vec4 weights)
{
    float sum_weight = weights.x + weights.y + weights.z + weights.w;

    // Fetch bones
    mat2x4 dq0 = u_bones[joints.x];
    mat2x4 dq1 = u_bones[joints.y];
    mat2x4 dq2 = u_bones[joints.z];
    mat2x4 dq3 = u_bones[joints.w];

    // Ensure all bone transforms are in the same neighbourhood
    weights.y *= sign(dot(dq0[0], dq1[0]));
    weights.z *= sign(dot(dq0[0], dq2[0]));
    weights.w *= sign(dot(dq0[0], dq3[0]));

    // Blend
    mat2x4 result =
        weights.x * dq0 +
        weights.y * dq1 +
        weights.z * dq2 +
        weights.w * dq3;

    result[0][3] += int(sum_weight < 1) * (1 - sum_weight);

    // Normalise
    float norm = length(result[0]);
    return result / norm;
}

mat4 GetSkinMatrix()
{
    mat2x4 bone = GetBoneTransform(a_joints0, a_weights0);

    vec4 r = bone[0];
    vec4 t = bone[1];

    return mat4(
        1.0 - (2.0 * r.y * r.y) - (2.0 * r.z * r.z),
              (2.0 * r.x * r.y) + (2.0 * r.w * r.z),
              (2.0 * r.x * r.z) - (2.0 * r.w * r.y),
        0.0,

              (2.0 * r.x * r.y) - (2.0 * r.w * r.z),
        1.0 - (2.0 * r.x * r.x) - (2.0 * r.z * r.z),
              (2.0 * r.y * r.z) + (2.0 * r.w * r.x),
        0.0,

              (2.0 * r.x * r.z) + (2.0 * r.w * r.y),
              (2.0 * r.y * r.z) - (2.0 * r.w * r.x),
        1.0 - (2.0 * r.x * r.x) - (2.0 * r.y * r.y),
        0.0,

        2.0 * (-t.w * r.x + t.x * r.w - t.y * r.z + t.z * r.y),
        2.0 * (-t.w * r.y + t.x * r.z + t.y * r.w - t.z * r.x),
        2.0 * (-t.w * r.z - t.x * r.y + t.y * r.x + t.z * r.w),
        1);
}

EDIT: video of the results:

https://youtu.be/8jIt_Xhhffk

The one on the left is supposed to be a walk cycle, the one on the right is supposed to be this:

https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/Monster

sentences:
Pathfinding in non tile-based 2d map (maybe potential field) I am developing a top-down 2d zombie shooter in AS3.
I have implemented collisions against segments (line from point a to point b), polygons (array of points, convex) and round obstacles (center and radius)
Player and enemies are basically moving round obstacles, with different radii.

Now, I'm having trouble with zombie AI's pathfinding.
I have read about potential fields, and I found it fascinating, but I can't figure out how to adapt it to a non tile-based map.
I can calculate the distance from a point to the closest obstacle, and get the obstacle repulsive potential in that point.
I don't know how to get the player's attracting potential in that point though. In tile-based maps you use the A* algorithm, considering every walkable tile as a node. This is my first problem.

Once I have calculated the player's attracting potential in a point, what I get is a Number. In tile-based maps, I would test this number against the potential of the 8 adjacent tiles, and move the enemy to the tile with the lowest potential. In my non-tile based map instead I do not have a fixed set of tiles to test, so I can't understand how to get the moviment vector to apply to the enemy. This is my second problem.

If I, say, set a waypoint every x*y pixels, I could use it as the centre of a tile, but that sounds very unelegant, mainly because enemies would be forced to move along the 8 directions of adjacent nodes.

Should I forget PFs and try a different approach?

sentences:
Finding the normals of an oriented bounding box? Here is my problem.

I'm working on the physics for my 2D game.

All objects are oriented bounding boxes (OBB) based on the separate axis theorem.

In order to do collision resolution, I need to be able to get an object out out of the object it is penetrating.

To do this I need to find the normal of the face(s) that the other OBB is touching.

Example:

The small red OBB is a car lets say, and the big OBB is a static building. I need to determine the unit vector that is the normal of the building edge(s) the car is penetrating to get the car out of there.

Here are my questions:

How do I determine which edges the car is penetrating.
I know how to determine the normal of an edge, but how do I know if I need  (-dy, dx) or (dy, -dx)?
In the case I'm demonstrating the car is penetrating 2 edges, which edge(s) do I use to get it out?

Answers or help with any or all of these is greatly appreciated.

Thank you

sentences:
How to display a lot of small objects using WebGL? Introduction

The game scene contains a lot of 10x10 pixel elements: for 1980x1200 px. screen the number of elements on the scene can vary from 0 to 23760 (elements cannot intersect).

The live example: http://fintank.ru/game/

The entire game space comprised of tiles: each tile is responsible for some area and keeps elements for that area (similar to google maps).

Each tile exist as 2 entities: S and G. S is a set of elements in the tile, G is rendered image of a tile. When the server put/remove elements to the tile, we change S and then re-render the G.

To draw a frame (at 20 fps) I just put the G of each visible tile using the putImageData(). That is done without WebGL.

The question

What is the most CPU effective approach to implement such many-elements management using WebGL? Should I render each tile to a texture or each element may be implemented as a separate textured rectangle? The main concern is that each tile may be updated 30-60 times a second (elements adding/removal).

How to avoid memory leaks (how to reuse buffers?) if we make many new textures every second?

What is the most effective way to manipulate pixels during rendering a 100x100 tile?

How to avoid re-uploading the unchanged textures to graphic card?

sentences:
PBR Metalness Implementation: specColor at Value 1? I am doing a BRDF supporting the metalness/roughness workflow.
I know that in cases of Metalness = 1.0 the reflectance value is taken from the albedo map - so is the specular color to tint the highlights.

My question is if the specular color is taken at the same value that it is in the albedo or is it set to 1.0 first and then used ?

Example:

A Pixel in my Albedo Map has a  Hue/Sat/Value of 0.5/0.5/0.5

With metalness = 1 the reflectance is 0.5.

Is specColor

a) 0.5/0.5/0.5
b) 0.5/0.5/1.0 (to not dim the specular) ?

Thanks,
Jens

sentences:
How do I represent walls in a 2D tile based map? I'm trying to create a simple 3D(2D) Dungeon Crawler but I am going to be using simple flat images to show the user they are in a "3D" world. Now what I mean is something like Sword and Serpents on the Nintendo.

Now as you can see on the right is a map, and on the left is the dungeon screen, I don't need help with the left screen no no. But on the right is the map, now I'm trying to think of a way I could represent this. I was thinking of using a 2D array, and doing something like this

w,w,w
h,o,o
w,w,w

So the H is the hero, and in front of him is two open spaces. so the hero can see two blocks around that is it. But if you look at the game, the player can move like this

h,o,o
o,o,o

so everywhere is open. but there is a wall between some blocks. Do you think an ID system would be better for example

1 = open space with walls on the north and south

2 = open space with walls only on the north

3 = open space with walls only on the south

etc, etc.

Do you think the ID system is way better or the use of W for a wall.

sentences:
Unity game in edit the scene mode all of a sudden became incredibly slow/"laggy" So I recently have been working on a game. So far I have very few assets in the game, which are a point light, a piece of terrain (which is textured), a player controller and a tree. Everything was going well until I put the tree in the scene. I made  tree and started to add some branches I got to about 8 branches, and then I added 35 leafs. Then the edit scene started to become laggy.
When I played the game it was running perfectly. But as soon as I changed the scene back to edit mode it became laggy again. I then deleted the tree to see if that would solve the problem but it seems to have done nothing at all. I would really appreciate if someone could explain why the edit scene is becoming laggy even though there are only a few assets within the game.

Thanks, Nova

sentences:
How to communicate success/failure within an abstract hint system without using sound or words I am designing a hint system for a "game".
The game is an interactive art simulation for multi-touch and although it is rather intuitive to figure out the basics of how to run that simulation there are some more complicated things to it that I would like to help the user discover.
My design rules are that it needs to be abstract and mostly transparent. There can be no sounds or words to this hint system. I am hesitant to use symbols as well.
I realize this makes it quite difficult to effectively communicate with the user but that is sort of the point. It is supposed to be a bit of a puzzle so it is rewarding to solve and in this case it is completely fine if the user does not.
These hints will show up when the user is close to figuring out a new aspect of the simulation. The goal of it is to communicate what the missing piece is for them to get there.
For example on one of the hints I need to get the user to hold a new finger down for more than 1 second under certain conditions.
In order to communicate this I want to show some sort of indicator. When the user puts their finger on the indicator it reacts communicating that that was a good choice but there is still more to do. If the user lifts their finger before 1 second I want to show some sort of "failure animation" however if the user lifts their finger longer than 1 second I want to show some sort of "success animation". The user would also notice that the behavior of the simulation changed.
I have chosen a ring/circle as the core shape for the indicator. This makes sense because generally a hint appears somewhere they are not touching and they begin being "in progress" once their finger is on the indicator. I am good with shaders so I will make it look better later.
So far the hint has been reading but I am concerned about how clear it is whether they failed or were successful at executing whatever the hint was hinting about. I have thought about having the indicator turn "green" for good or "red" for bad but the problem here is that color scheme isn't universal. AND most critically it begs the question of what a "neutral" color is/should be for the indicator before the user has started on the hint and while they are doing it and the indicator is following their finger. Teal was my gut instinct but that color is already pretty close to green.
I am worried about the use of just color and specifically the colors red/green so I am looking for other ideas on how I might be able to get this indicator to communicate success or failure following the rules at the top.
Are there other ways I could communicate success/failure?
In addition does anyone know of any other games/projects that use a non-verbal/written hint system communicating more abstractly/with colors? Would be good to have some reference.
Any related articles are great too.
Here is sort of a state diagram of the indicator if that helps. I have included a simple/mockup of the indicator with very simple shapes but obviously to give you an idea it will look better. In the holding example the hint would start by being in the state "hint start" somewhere on screen and when the user touches it would transition to "hint in progress". If the user releases before 1 second it would then go to "failure" and turn red but if the user releases after 1 second it would go to "green" for success.

sentences:
How can I check if a player-drawn line follows a path? I want to draw an invisible path that the user must follow.  I've stored that path as points.  When a player draws a line, how can I test if it follows the path I've stored?

Here's an example for tracing the letter A.

if((traitSprite.getX()<=Invisible.X  && traitSprite.getX()>=Invisible.X )){...}

(traitSprite is a sprite.)

sentences:
Projectile movement around spheres of varying gravity I found a game on the Internet called Sagittarius. This game is very fun, and I have a question: how can I make the arrow move like it does in this game? I know each sphere has a different gravity, but when I try to use this formula, it's not working as I expect=. Can any one help me resolve this problem? Thanks.

  public List<PlanetABC> p = new List<PlanetABC>() {
    new PlanetABC(){
        x = 0.91f,
        y = -1.28f,
        gravity = 5,
        r = 5
    },
    new PlanetABC(){
        x = 8.12f,
        y = -1.3f,
        gravity = 3,
        r = 10
    }
};
void Start () {

}
void Update () {
    float gravityOnX = 0;
    float gravityOnY = 0;
    foreach (var planet in p)
    {
        if (Vector2.Distance(g.transform.position, new Vector2(planet.x, planet.y)) > planet.r)
            continue;
        if (planet.x > g.transform.position.x)
            gravityOnX += planet.gravity;
        else gravityOnX -= planet.gravity;

        if (planet.y > g.transform.position.y)
            gravityOnY += planet.gravity;
        else gravityOnY -= planet.gravity;
    }

    if (currentGravityX > gravityOnX)
        currentGravityX -= Time.deltaTime;
    else currentGravityX += Time.deltaTime;

    if (currentGravityY > gravityOnY)
        currentGravityY -= Time.deltaTime;
    else currentGravityY += Time.deltaTime;

    Debug.Log(currentGravityX + "/" + currentGravityY);
    var DEG2RAD = Mathf.PI/180;
    float vx1 = Mathf.Cos(angle * DEG2RAD) * power ;
    float vy1 = Mathf.Sin(angle * DEG2RAD) * power;
    float y = (0.5f * currentGravityY * time + vy1) * time;
    float x = (0.5f * currentGravityX * time + vx1) * time;
    Vector3 pos = g.transform.position;
    pos.x = x;
    pos.y = y;
    g.transform.position = Vector3.Lerp(g.transform.position, pos, Time.deltaTime);
    time += Time.deltaTime;
}

Here is the game: https://gprosser.itch.io/sagittarius

sentences:
For PC game development with Visual Studio, how do AAA developers reconcile their dozens-of-GB games with VS's 4 GB memory limits? As far as I understand it, Visual Studio is the de-facto standard for Windows development in C# and C++, but it is limited by the fact that it's a 32-bit application and thus only has access to 4 GB of RAM for loading projects (Microsoft wrote a blog post 10 years ago explaining(?) why there is no 64-bit version). AAA games, however, are dozens of GB large, and even after factoring out the assets (which VS doesn't load), still amount to quite a bit of executable code.

Are AAA developers able to work within those limits for PC development, or do they use other IDEs that have 64-bit versions?

(I am aware that Visual Studio often uses out-of-process facilities for actually building and running projects, but the IDE itself is 32-bit and a lot of its functions, such as CodeLens, run in process).

sentences:
Floor is made up of tiles with their own box colliders. Pushable item gets stuck on the "seams" So I have a scene where the floor is made up of some tiled objects. All of these have the exact same height and exact same Y position. I also have a block with a rigidbody that you can push on the ground. It has a rigidbody with freeze rotation enabled for X, Y, and Z.

My issue is this: when pushing the block around, it sometimes gets stuck when reaching the seams of the tiled objects. I have tried giving it a friction of 0, but it still gets stuck sometimes. Is there any solution for this, other than manually creating a big collider that spans the entire floor?

sentences:
Large FPS vs consistent FPS When optimizing the frame rate of a game, when should I focus on a large
FPS and when should I focus on a consistent frame rate.

This is often a hotly contested issue, so please note I'm not asking which
is better.

What are the pros and cons of each?
In which situations is one preferred over the other?

Also note: my input polling/processing, physics, and game update rates are
independent of my frame rate.  The only thing the FPS affects is how often a
screen is rendered.

sentences:
Resolving Circle-Circle collision If you have a stationary circle with radius x, and a moving circle with radius y, when a collision is detected, how can you resolve the collision, such that the moving circle stop?

I.e. What would be the 'resolved' position of the moving circle?

sentences:
Tilemap Collision Generation - Tracing Polygons with Slopes I've been using Godot for my game, but it has a unfortunate quirks with tilemap collision where physics objects can bounce weirdly near tile seams and kinematic bodies can often get stuck in seams as well. For early alpha work, I've been able to get around this by not using tilemap collision and then tracing the contours by hand... Well this isn't going to scale well to 200 rooms (or whatever I end up having) and could easily lead to mismatched collision data, so I've decided that this process needs to be automated.

Tilemaps have a few different tile types - fully solid, diagonal slopes, and 2:1 slopes.

My first attempt matched each of these types to a half-tile size, marking each vertex as solid or not solid, and then combining all the vertices (with their overlap) into a single grid of vertices. I could then use all of these together by marching along the perimeter and probing ahead to detect corners. Turns out this works well for convex corners but has serious issues in concave corners, plus there isn't enough data to detect slopes properly, so it often resulted in extra slopey parts or cutting into slopes just slightly.

From there I decided to add some extra information on the vertex grid, such as whether a vertex is a slope edge and doing clever things surrounding the properties of how it overlaps, but it's quickly blowing up into a lot of specific cases.

I spent much of today thinking about adding vertex normals to each tile definition, but I realized it wasn't going to work without adding a bunch of different tile solidity types.

Are there better approaches than what I'm thinking that don't involve brittle/lossy intermediate representations or ridiculous amounts of special cases?

sentences:
Merging adjacent cubes into large ones I am currently working on a basic minecraft like game.
I have a list of coordinates using which i render instances of a cube model.
To optimize my rendering, i need to merge similar adjacent cubes into a single largest possible cube so that the total number of polygons that needs to be rendered is reduced

Any suggestions?

sentences:
Create and serve AssetBundle at runtime What I am developing is not a game, but is done in Unity3d, so I believe here is a good place to ask.

Context:

The unity application runs in the WebPlayer inside a web application

Case:

User uploads a file on the website
Webserver processes the file, does conversion and business stuff. Ends up with a DAE(Collada) file
The DAE file that has been generated on the server needs to be loaded and shown in the Web player inside the browser of the one who uploaded it

Now, I am not very well versed in Unity, so I just want to lay out what I expect to do, and then hope to get feedback on whether that is smart, or whether there is a better approach.

So starting from top down, here's my thinking

In order for the Web Player to find the file and use it as an asset, it should be an AssetBundle, which I can load with UnityWebRequestAssetBundle.GetAssetBundle

that shouldn't be much trouble. If the AssetBundle is stored somewhere that the web app can serve it, I expect that to just work? I see in docs that  Unity can load "AssetBundles from the project folder", but I don't expect that "project folder" is part of the game when loading from a URL. How would it?

In order to generate the AssetBundle, I would need to have a Unity application running on the server (a headless build of unity), which would pick up the generated DAE file and use BuildPipeline.BuildAssetBundle to create the AssetBundle and store it where the web app can serve it
The communication between browser, unity web player, web app server, and unity server instance is something I can manage on my own. I can work with sockets and jslibs to sort out my needs, so that doesn't need to be described here
Instantiating the GameObject after loading the AssetBundle into the Web Player, I expect to be simple, just following the docs for the AssetBundle

Extra credit:

Sources for how to do the headless unity instance would be great. Sort of like a game server, but not really caring about clients connecting, but rather working with the filesystem on the server

sentences:
GJK point-in-tetrahedron - capping the number of searches? The very informative mollyrocket video has given me quite a lot to work with, but one thing that the video seems to suggest is that the algorithm should ideally run until it definitely determines whether or not there's a hit.

I was of the idea that if there's no collision, it would be obvious by testing the dot product of the latest point against the search direction; if it is not positive, then we did not pass the origin, so a tetrahedron which encloses the origin simply cannot be built.

In cases where there is a hit OR a clear miss, the routine typically picks up less than 11 loops through. However, as I tend towards 'questionable territory' and the definitive hit/miss is visually less distinct, there are times when the method apparently continues to pass the origin yet construct unsuccessful simplexes.

Is it common to cap this kind of function at a max number of tries? Right now I am somewhat arbitrarily using the number of points in one shape times the number of points in the other shape; in other words:

max_tries = len(shape1.pts) * len(shape2.pts)

It feels a bit hacky and I have to assume that the routine is geared towards simply running ad nauseum until it smacks into a clear hit/miss situation.

Has anyone experienced this before? Is this a problem or an anticipated safety measure in such an algorithm? If it needs to be done I'll gladly share some code, but I think it stands as self-evident that it is kind of a longer read than most code snippets so I've abstained for now.

sentences:
Why is ScreenToWorldPoint always giving same coordinates with mouse position? Whenever I use ScreenToWorldPoint(Input.mousePosition) and display the output in console this always gives me the same coordinates.
MyCode:
Vector3 screenToWorld;

void Update()
{
    screenToWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    Debug.Log(screenToWorld);
}

sentences:
Unity - Set rotation of object using angle between two points? I have a LineRenderer that draws a line between two points, Vector3 startPos and Vector3 endPos. How can I get the angle between these points, and apply it to an objects transform rotation, so that it points in that direction?

Here is my code that draws a line between 2 points by dragging your mouse, if you want to test just Replace the Interact methods with Input.MouseButtonDown(1), hold and up.

Vector3 startPos;
Vector3 endPos;
float angle;

LineRenderer lr;

private void Awake()
{
    lr = GetComponent<LineRenderer>();
    lr.useWorldSpace = true;
}

public override void InteractOnDown()
{
    base.InteractOnDown();

    lr.enabled = true;
    lr.positionCount = 2;
    startPos = PointerHandler.RaycastScreenPoint(Input.mousePosition, UnitManager.instance.movementMask, GameManager.instance.cam).point;
    lr.SetPosition(0, startPos);
}

public override void InteractOnHold()
{
    base.InteractOnHold();

    endPos = PointerHandler.RaycastScreenPoint(Input.mousePosition, UnitManager.instance.movementMask, GameManager.instance.cam).point;
    lr.SetPosition(1, endPos);
}

public override void InteractOnUp()
{
    base.InteractOnUp();

    lr.positionCount = 0;
    lr.enabled = false;
}

sentences:
Making a clone of Starcraft legal? My question is similar to a previous question. Consider the following clone of Starcraft: Change the artwork, sound, music, change the names of units. However, leave the unit hit points unchanged, unit damage unchanged, unit movement speed unchanged, change ability names but not ability effects.

Is that considered illegal? In other words, is copying the unit hit points, damage, etc. considered illegal even if everything else is changed?

sentences:
Organizing objects into groups of 20. C# I am building a game where players can build their own airplanes and fly them around. When the vehicle is spawned, all the buildables used to construct the airplane should be placed into groups of 20 to be merged as a submesh to the airplane. When one of the buildables is hit by a projectile and is destroyed, the mesh is reloaded, this time without the buildable that was hit creating the illusion that it was destroyed.

I have a few scripts

Airplane Core:

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

[System.Serializable]
public class AirplaneCore : MonoBehaviour {

    public GameObject airplaneCore;
    public List<AirplaneBuildable> buildables;
    public List<AirplaneChunk> chunks;

    void Start () {
        AirplaneChunk[] airplaneChunks = airplaneCore.GetComponentsInChildren<AirplaneChunk> ();
        foreach (AirplaneChunk chunk in airplaneChunks) {
            chunks.Add (chunk);
        }
    }
}

AirplaneBuildable:

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

[System.Serializable]
public class AirplaneBuildable {
    public string buildableName;
    public GameObject buildableObject;
    public GameObject buildableNormalPrefab, buildableEditorPrefab, buildablePreviewPrefab;
    public Vector3 pos, rot;
    public bool destroyed = false;
    public float health = 100f, maxHealth = 100f;
}

And Airplane Chunk:

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

[System.Serializable]
public class AirplaneChunk : MonoBehaviour {
    public List<AirplaneBuildable> buildablesInChunk;
}

Anyone know a way I can take the buildables from AirplaneCore and place them in groups of 20 and assign each group to an AirplaneChunk's buildablesInChunk list?

For those who don't know, the gameobjects that are in the AirplaneBuilder script are:
-Buildable Object: The actual object representing the component that was placed on the airplane.
-Buildable Normal Prefab: The buildable that is spawned when spawning the plane.
-Buildable Editor Prefab: The buildable that appears on the airplane in the vehicle builder editor.
-Buildable Preview Prefab: Is simply a preview of the buildable and shows what it will look like when placed on the airplane.

sentences:
Simple Tanks game - Client-Server communication approach doubts I want to create simple a multiplayer 2D game with tanks ( cooperative ) in C# with .NET.
I also want to keep it simple, because it is only a semester project, and unfortunately i don't have time to learn additional game engines like Unity.

So, can i do it without Unity, XNA or other game engine ?
If yes, here is an architecture/design problem that i am facing:
How should i notify the two players regarding the position of the other player on the map, the position of the bullets and the position of the enemies ?

Should i query the server at 50-100 ms intervals and get a list of JSON messages containing positions and states ( a tank exploded ) ?
Should i send a message from server regarding a bullet let's say, bullet no.1 started from x,y heading on axis y, then in the client, i will draw it until i will receive like an interrupt in case it hits an obstacle ( a tank that was passing by) ?

The first option seems more simpler, but it will kill the server in a real life ( 100000 players ) situation.
The second seems like on overkill and over-engineering from client side.

Any other suggestions ?
Thanks

sentences:
The camera does not capture movements in z-axis I want to make a simple drag and drop card in Unity, where the card pops up a bit towards the screen when the drag begins (lifting effect), and then drops down back on the table when the drag ends.

My script looks like this:

public class Draggable : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
    void IBeginDragHandler.OnBeginDrag(PointerEventData eventData)
    {
        this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z - 10);
    }

    public void OnDrag(PointerEventData eventData)
    {
        this.transform.position = new Vector3(Input.mousePosition.x, Input.mousePosition.y, -10);

    }

    public void OnEndDrag(PointerEventData eventData)
    {
        this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z + 10);

    }

}

The card is an image, and it is child of the canvas.
The render mode for the canvas is Screen Space - Overlay.

The drag works correctly, but I cannot capture the movements in the z-axis.
It does capture the movements in the z-axis when I change the render mode. However, then the card is too far away in the z-axis, and it moves with an offset with respect to the mouse pointer.

As far as I understood, I need to do something about realtive distances, but I how can I force the mouse pointer to be on z=0 plane.

sentences:
Finding the site of the potential collision between 2 vehicles I've been trying to implement the unaligned collision avoidance steering behavior. I get what needs to be done on a high level, but struggle with the maths behind it.

On Craig Reynolds site, he describes

  Collision avoidance is obtained for a vehicle by considering each of the other vehicles, and determining (based on current velocities) when and where the two will make their nearest approach. A potential for collision exists if that nearest approach is in the future, and if the distance between the vehicles at nearest approach is small enough. The nearest of these potential collisions, if any, is determined. The vehicle then steers to avoid the site of the predicted collision.

For the trajectory of the vehicles, I simply store a velocity vector (x, y), and to change it an acceleration vector is used. The collision avoidance behavior should return a force (in the form of a vector).

How you would find the nearest approach (Isn't this just where they collide?) and the site of the predicted collision?

sentences:
Pinch in zoom in android In My layout
parent as Relative layout and then am having Scroll view
inside Linear layout
now am having child views as Image view Text View Web view and Recycle view and 2 buttons is there
now i want to pinch in zoom entire layout

please help me out
Regards
Govardhana

sentences:
ray polygon intersection I am looking for an elegant way to do ray and polygon intersections in 2d. I don't care about languages.

Now what I'm doing is taking a line that lies on the ray (with a screen length) and testing line-to-line intersections between this derived-ray and all lines formed by each consecutive vertices in the polygon.

This, for now, is good even if I don't know which parts of the ray are inside or outside the polygon (in cases it is concave one). But for now I don't need this information, even if a general approach could maybe give it.

I don't care about self-intersection polygons.

Any advice? Maybe triangulating the polygons could be an idea?

sentences:
How to "undraw" a SetPosition on LineRenderer? I'm animating the SetPosition on a line renderer to show a laser site quickly "spin up" so the user sees the laser head outward. I'd like to do the reverse and when a user switches off the laser sight and it also quickly retracts.
I have the spin up working good, but I can't figure out how to "undraw" the line when a user toggles the sight off. Once its "undrawn" a user can just spin it up again when they turn it back on.
Here is the code (ignore the weapons checks)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WeaponAimAlignment : MonoBehaviour
{
    // weapon assignments
    [SerializeField] private Transform rocketBarrel;

    // laser sight assignments
    [SerializeField] private float aimOnSpeed;
    [SerializeField] private Transform aimLaser;
    [SerializeField] private LineRenderer lineRend;
    private bool aimOn = false;

    private float counter;
    private float dist;

    void start()
    {
        lineRend.enabled = false;
    }

    void FixedUpdate()
    {

        if (Input.GetKeyDown(KeyCode.B) && aimOn == false)
        {
            aimOn = true;
            lineRend.enabled = true;
            lineRend.SetPosition(0, aimLaser.transform.position);
        }
        else if (Input.GetKeyDown(KeyCode.B) && aimOn == true)
        {
            lineRend.enabled = false;
            aimOn = false;
        }

        Ray rayOrigin = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hitInfo;

        if (Physics.Raycast(rayOrigin, out hitInfo))
        {
            if (hitInfo.collider != null)
            {
                Vector3 direction = hitInfo.point - rocketBarrel.position;
                //machineGunBarrel.rotation = Quaternion.LookRotation(direction);
                //grenadeBarrel.rotation = Quaternion.LookRotation(direction);
                rocketBarrel.rotation = Quaternion.LookRotation(direction);

                if (aimOn == true)
                {
                    dist = Vector3.Distance(aimLaser.transform.position, hitInfo.point);

                    if (counter < dist)
                    {
                        counter += .1f / aimOnSpeed;

                        float x = Mathf.Lerp(0, dist, counter);

                        Vector3 pointA = aimLaser.transform.position;
                        Vector3 pointB = hitInfo.point;

                        Vector3 pointAlongLine = x * Vector3.Normalize(pointB - pointA) + pointA;

                        lineRend.SetPosition(1, pointAlongLine);
                    }
                }
            }
        }
    }
}
```

sentences:
C# - console application, array problem I have problem in very simple console app, code looks like this.

int x - player moving and changing axis "x" and I want make full history of moving via array. See code(only example) below...

Thank you for your help and answer

  int round = 0;

  while(infinity){

  int[] PosXSave = new int[round + 1]; //theoretically infinity size of arrray.

  PosXSave[round] = x; //every round i want save current value of x, but
                       //only last save have propertly value and rest are
                       //zero or other number

  round++

  }

sentences:
How to save am image of a screen using JOGL Hope this is a better place to ask things like this.
I have a 2D scene with some sprites drawn in Swing frame. I need them to be saved as an image. The problem is every tutorial I found seem to be obsolete.

I found using glReadPixels and putting result to a BufferedImage should help but all those snippets look stale, API has changed. I'm using JOGL 2.1.5 that is current at the moment.

I have a feeling this should be a widely known use-case for professionals.
Any help would be appreciated!

Updated:
I adopted some stale snippets (please, don't tell me API hasn't changed significantly, there're dozens of movings and renamings)
No the problem is I'm getting black screen in png file. It comes from byte buffer being read to with zeros only.

   public static void main(String[] args) {
        TestPNGSaver saver = new TestPNGSaver();
        saver.run();
    }

    private void writeBufferToFile(GLAutoDrawable drawable, File outputFile) {
        int width = drawable.getWidth();
        int height = drawable.getHeight();

        ByteBuffer pixelsRGB = Buffers.newDirectByteBuffer(width * height * 3);

        GL2 gl = drawable.getGL().getGL2();

        gl.glReadBuffer(GL.GL_BACK);
        gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1);

        gl.glReadPixels(0, 0, width, height, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, pixelsRGB);

        int[] pixels = new int[width * height];

        int firstByte = width * height * 3;
        int sourceIndex;
        int targetIndex = 0;
        int rowBytesNumber = width * 3;

        for (int row = 0; row < height; row++) {
            firstByte -= rowBytesNumber;
            sourceIndex = firstByte;
            for (int col = 0; col < width; col++) {
                if (pixelsRGB.get(sourceIndex) != 0) {
                    System.out.println(sourceIndex);
                }

                int iR = pixelsRGB.get(sourceIndex++);
                int iG = pixelsRGB.get(sourceIndex++);
                int iB = pixelsRGB.get(sourceIndex++);

                pixels[targetIndex++] = 0xFF000000
                        | ((iR & 0x000000FF) << 16)
                        | ((iG & 0x000000FF) << 8)
                        | (iB & 0x000000FF);
            }

        }

        BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

        bufferedImage.setRGB(0, 0, width, height, pixels, 0, width);

        try {
            ImageIO.write(bufferedImage, "PNG", outputFile);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    public void display(GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();
        gl.glClear(GL.GL_COLOR_BUFFER_BIT);
        gl.glBegin(GL.GL_TRIANGLES);
        gl.glColor3f(1, 0, 0);
        gl.glVertex2f(-1, -1);
        gl.glColor3f(0, 1, 0);
        gl.glVertex2f(0, 1);
        gl.glColor3f(0, 0, 1);
        gl.glVertex2f(1, -1);
        gl.glEnd();
    }

    private void run() {
        GLProfile.initSingleton();
        GLProfile glp = GLProfile.getDefault();
        GLCapabilities caps = new GLCapabilities(glp);
        final GLCanvas canvas = new GLCanvas(caps);
        canvas.addGLEventListener(this);

        Frame frame = new Frame();
        frame.setSize(400, 400);
        frame.add(canvas);
        frame.setVisible(true);

        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                writeBufferToFile(canvas, new File("/whatever/text.png"));
                System.exit(0);
            }
        });
    }

sentences:
How shader program still works even after detaching shader object? In the following process of shader creation, shader object is detached after linking program (glLinkProgram), how does the shader program still works after detaching and deleting shader objects?

glCreateShader -> glShaderSource -> glCompileShader -> glCreateProgram -> glAttachShader -> glLinkProgram -> glDetachShader -> glDeleteShader -> Use shader.

sentences:
A few questions about Order Independent Transparency I've been looking through several different Order Independent Transparency algorithms. But very few of them seem to answer a few things.

I understand that the idea of OIT is to not worry so much about ordering. But does it still matter in some cases? And is there a way to preserve it if a certain ordering is desired?

For starters, does presorting impact OIT in any way? Such as speeding it up, or producing different visual results?

And is lighting still handled per pixel as normal when you submit your geometry to be rendered. Or does it happen defacto?

A few algorithms I have been looking at.

Intel's OIT solution. This also seems to be fairly popular with AMD as well.
AMD's Powerpoint

Depth Peeling. Can't find a good link.

And then Depth Weighted blending. Which seems to produce muddy results with layers. Linky

I guess I should also ask how necessary, and how fast is this. My main issue isn't layer's of transparent objects with overlaps. Things like holograms and layers upon layers of glass are likely to be rare. But mostly with particles and their drawing order from different particle systems, and them interacting with other transparent objects correctly.

Currently... the engine treats a particle engine like one complete object, and renders them directly to the backbuffer on the transparency pass. Though because the particles are volumes... it causes some graphical errors. For example if there was a huge explosion that covers a massive chunk of land... there will be a random stack of smoke that renders on top of it.

And I don't want to break up all the particle instancing to batch them with the rest of the geometry... as it would likely massively raise the draw calls for every break.

I currently can't provide any pictures right now. The engine is undergoing a serious rewrite to get it more usable. So a good portion of the code is slashed out. I'm just trying to solve problems I have noticed in my first right up.

sentences:
Understanding Unity 5 Car controller As with all Unity versions Unity 5 comes with a set of Standard Assets. This new set of Standard Assets comes with a Car Controller. Either by attaching a Car user controller script or a Car A.I. script the Car is ready to be used within a game. I am using that said Car controller to create my own car in a game. What I am trying to do is increase the cars acceleration and top speed. I did not find any documentation on the mechanics behind the car controller (and since I do not know much about cars) I did not find a way on how to do this. I am reading the script and understand the flow of code but do not understand which variables affect what in the script.

Now for Top speed the car controller exposes a public variable responsible for that precise task.
But what about acceleration?

sentences:
Player object glitching around when there is a low framerate Unity C# I just started to make this game, it runs fine on my computer. 60fps, but when I tested it on another computer, with lower fps, the player just started to jitter and glitch around a lot. The game is basically unplayable like that, and I want to make sure that everyone who plays my game will be able to enjoy the full experience. I have pasted the specific part of the code for the movement below.

void Update () {

    rb.AddForce (Vector3.forward * ForwardSpeed);

    if (Input.GetKeyDown (KeyCode.A) && side > maxSideLeft) {
        rb.AddForce (-Vector3.right * Speed);
        side -= 1;
    } else if (Input.GetKeyDown (KeyCode.D) && side < maxSideRight) {
        rb.AddForce (Vector3.right * Speed);
        side += 1;
    }

    if (Input.GetKeyDown (KeyCode.W) && level < maxLevelHeight) {
        rb.AddForce (Vector3.up * Speed);
        level += 1;
    } else if (Input.GetKeyDown (KeyCode.S) && level > minLevelHeight) {
        rb.AddForce (-Vector3.up * Speed);
        level -= 1;
    }

    if (Input.GetKeyDown (KeyCode.R) || Input.GetKeyDown(KeyCode.Space)) {
        SceneManager.LoadScene ("Scene1");
        Time.timeScale = 1;
    }
}

sentences:
How can I programmatically add a Controller to an Animator during runtime? I am trying to set the Controller of an Animator during runtime using a script.
When I click on the dot in the inspector manually, I can choose one called "Standard Walk", but have not found a way to automate it.

sentences:
on_Tween_tween_completed not triggering I'm using this script to print out my text in a textbox one character at a time, and to do this I'm using a Tween. I have this set up so that when the Tween sends the tween_completed signal, then the variable finished becomes true. But for whatever reason, the tween_completed signal never gets sent. Does anyone see a reason that the signal wouldn't be sent? Thank you!
extends Control

var tempdialog = [
    'Super Animal Racing is shaping up to be a great game!',
    'Thomas is so good at programming omg!',
    'Isn\'t this so exciting?'
]

var dialog_index = 0
var finished = false
var totalcharacters = 0

func _ready():
    load_dialog()

func _process(delta):
    $AnimatedSprite.visible = finished
    print("visible", finished)
    if Input.is_action_just_pressed("jump"):
        load_dialog()

func load_dialog():
    if dialog_index < tempdialog.size():
        finished = false
        $RichTextLabel.bbcode_text = tempdialog[dialog_index]
        $RichTextLabel.percent_visible = 0
        $Tween.interpolate_property(
            $RichTextLabel, "percent_visible", 0, 1, 1,
            Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
        )
        $Tween.start()
    dialog_index += 1

func _on_Tween_tween_completed(object, key):
    print("tweentrigger")
    finished = true
```

sentences: Is FreeGLUT still a good choice? I recently decided to utilize the C++ library called FreeGLUT to have a window be managed from my program, where I can draw things via OpenGL. But at the same time I saw some people telling that it is an old library, not that much reliable and so on... Should I keep using that or move to another one?

sentences:
OpenGL matrix vs DirectX matrix I'm working on an animation and model exporter from Maya to use within my game. Currently, models work perfectly, and animations have some issues with the joints. Since Maya works in an OpenGL environment and my game works with DirectX, to load the mesh in I negated the Z component of all vertex positions, normals, and inverted the UV's V coordinate.

Currently, joints loaded in are reversed along the Z axis. My question is, what do I need to do to get bone matrices working properly from OpenGL to DirectX? My original thought was to just transpose them, but that doesn't work. I've also tried negating the z-column but that causes some odd stretching.

I've only been trying to invert the root bone.

Notice the feet joints pointing backward.
http://i.stack.imgur.com/6kNr2.png

Inverting the root joints Z-Column, weird stretching and it looks like he's slouched.
http://i.stack.imgur.com/KysH8.png

Any thoughts on this?

sentences:
How do graphics evolve so much on the same console hardware? Is it only a matter of code optimization?

Do game developers plan to start small on a new hardware, to have space to evolve while creating a series of that game?

Are computer graphics breakthroughs common enough to happen in a console lifetime?

sentences:
How to make a bar showing the "percentage" of a maximum so Im making a game and I need a 'bar' to show how much time has passed in ms (dont worry about the time 'mechanics' I only work with the correct numbers). So lets say that the bar is 128px wide and that I want the timer (the time passed since start in ms) to be displayed within that bar properly, so that e.g. if the time passed is half way of the maximum, then the bar should be half full. Could anyone please tell me the formula because I cant remember/find it.

(btw. all variables needed are the curTime, maxTime and the progress of the bar/the max bar width)

sentences:
How can I have parent-child transform in a component system? Before when using inheritance, I could draw all my objects using this recursive function:

void Object::innerDraw(sf::RenderTarget& target, sf::RenderStates states)
{
    states.transform *= Object::getTransform(); //translate by this object's position
    this->Draw(target, states); //draw this object
    for (Object *child : m_children)
    {
        if(child->isVisible)
            child->innerDraw(target, states); //draw all children
    }
}

However, I am now looking at a component design where the graphics component pushes it's sprite to the renderer   Renderer::toDraw.push_back(&sprite);

The renderer then draws all the sprites in it's container

for (sf::Drawable *Entity : toDraw)
{
    target.draw(*Entity, state); // (state isn't doing any transforming here)
}

How can I be able to draw things relative to parents position?

sentences:
Have a particle system's particles obey transparency sort mode individually Background

In a top-down game, I have particles that spawn animated textures. I have my 2D renderer settings set-up so that it orders sprites based on their position on th Y-axis via "Transparency Sort Mode > Custom Axis > Y".

The Problem

But instead of sorting for each particle spawned, what happens is the particle system obeys the setting as a whole so that the sort order is only based on the particle's system's center.

Is there a way to have each particle obey Transparency Sort Mode individually?

What I want for each particle:

What actually happens:

Other Solutions

Other people seem to have an old workaround to use GetParticles and setting their "order in layer" individually. See this thread from 2015:

https://forum.unity.com/threads/particle-systems-with-sprites-order-in-layer.464533/

But I'm trying to find if there's a cleaner solution for Unity 2019 without having to fudge with "order in layer".

sentences: What is the game design lingo for the computer's ability to render shiny water? What is the game design lingo for the computer's ability to render shiny water? I am new to game design and I'm trying to write a formal paper to a colleague.

sentences:
How can I fade player character when he goes inside or outside of the area? I want to fade the player when he goes out of the area.

For example, suppose a person enters a building. When a person is outside of the building, he shouldn't be seen, but when he enters he gradually becomes visible (using fading effect).

when elephant is inside green area his alpha should be 1

when elephant is outside of green area his alpha should be 0

sentences:
How to simulate backspin or topspin in a box2d billiard game? I am designing a simple billiard game with box2d. I think I can easily simulate hitting left or right side of a ball. Since box2d is not 3D, however, I am not sure how to simulate hitting upper or lower part of ball with a cue.

In case you are not familiar with the game. If the ball is hit on its upper part, it's still going forward after hitting another ball. But when cue hit on its lower part, it should backspin as soon as striking another ball.

Is this simulation possible with box2d? If so, a hint or reference will be appreciated.

sentences:
Build a convex hull from a given mesh in Bullet According to this tutorial, a convex hull is the most accurate shape one can build from a mesh? I have two questions regarding this:

How do I build a convex hull from a given, complex mesh in Bullet?
Should this be done offline? How do most people do this? (that is, create a collision shape from a mesh in games)

sentences:
Why does my world generation code perform poorly on large inputs? I'm writing some code to procedurally generate some islands in real time. The idea is to choose some points for each chunk, and for each tile calculate the distance from those points, then combine it with a Perlin Noise to decide  if it will be water or land. Anyway here's the code:

local function number()
    local n = math.random()
    if n < .4 then
        return 0
    elseif n < .8 then
        return 1
    end
    return 2
end

Just a custom weighted random function, used to choose how many points will be in each chunk.

chunks = setmetatable({}, {
    __index = function(tab, x)
        local xtab = setmetatable({}, {
            __index = function(xtab, y)
                local xs, ys = x * 32, y * 32
                local islands = {}
                for i = 1, number() do
                    islands[i] = {x = math.random(xs, xs + 31), y = math.random(ys, ys + 31), r = math.random(16, 32)}
                end
                xtab[y] = islands
                return islands
            end})
        tab[x] = xtab
        return xtab
    end})

This block just initializes the chunks table, setting its metatable so that if a non existing chunk is being called, that chunk gets initialized by choosing a number of points the chunk will contain, and for each point choose its position inside the chunk and its range.

However here's the buggy code:

function generatechunk(x, y)
    local xs, ys = x * 32, y * 32
    for xm = xs, xs + 31 do
        for ym = ys, ys * 31 do
            for xc = x - 1, x + 1 do
                for yc = y - 1, y + 1 do
                    local points = chunks[xc][yc]
                    for p = 1, #points do
                        local po = points[p]
                        local d = math.max(0, math.min(math.sqrt((po.x - xm) ^ 2 + (po.y - ym) ^ 2) / po.r, 1))
                    end
                end
            end
        end
    end
end

It isn't even completed yet. Basically what it should do is choosing for each tile if it will be sea or land by combining the Perlin Noise value and the influences of the points of the chunks around its chunk.

But here's the bug: if I call (for testing) generatechunk(n, n) for n <= 0, it executes in little to no time. But as n increases I get results of about n seconds of execution. Why is it?

sentences:
How can I make OpenGL textures scale without becoming blurry? I'm using OpenGL through LWJGL.

I have a 16x16 textured quad rendering at 16x16. When I change it's scale amount, the quad grows, then becomes blurrier as it gets larger.

How can I make it scale without becoming blurry, like in Minecraft.

Here is the code inside my RenderableEntity object:

public void render(){
    Color.white.bind();
    this.spriteSheet.bind();
    GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0,0);
        GL11.glVertex2f(this.x, this.y);
        GL11.glTexCoord2f(1,0);
        GL11.glVertex2f(getDrawingWidth(), this.y);
        GL11.glTexCoord2f(1,1);
        GL11.glVertex2f(getDrawingWidth(), getDrawingHeight());
        GL11.glTexCoord2f(0,1);
        GL11.glVertex2f(this.x, getDrawingHeight());
     GL11.glEnd();

}

And here is code from my initGL method in my game class

GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glClearColor(0.46f,0.46f,0.90f,1.0f);
GL11.glViewport(0,0,width,height);
GL11.glOrtho(0,width,height,0,1,-1);

And here is the code that does the actual drawing

public void start(){
    initGL(800,600);
    init();

    while(true){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

        for(int i=0;i<entities.size();i++){
            ((RenderableEntity)entities.get(i)).render();
        }

        Display.update();
        Display.sync(100);

        if(Display.isCloseRequested()){
            Display.destroy();
            System.exit(0);
        }
    }
}

sentences:
How do I fix a "missing mcp.cfg" error? I am trying to use mod coder pack (MCP) to create mods of my own. I have downloaded MCP 9.4 version from www.modcoderpack.com. The error that I have encountered is that when I try to run a file called decompile.sh in the mac terminal, the terminal responds with an error: ERROR:root:!! Missing mcp.cfg. I have checked my MCP folder and made sure that it contained the file mcp.cfg. The file is in my folder.

I am currently running on a Macbook Pro with MacOS Mojave Version 10.14.4.

sentences:
How do Minecraft know where village's buildings are if the village is not generated yet? I'm trying to understand how chunk generation works in a deep level and all the information I found does not explain how the villages are generated properly without visual glitches during generation.

I mean, if you are in an area where you should see some buildings from a village, how does Minecraft know that they must be rendered?
Minecraft generates villages from a main "structure" that probably it is not generated yet.

This video explains the village's generation properly.

So with that in main what should happen is that you could see builds appear from time to time when the "village center" of a village is generated in a new-generated chunk.

Here you have a visual representation of the circumstances I'm describing. The buildings inside the loaded area shouldn't be shown if the village is not generated yet:

The only explanation I can think about is that Minecraft generates way more chunks than the ones that are visually loaded to avoid this problem.

If this what happens, what is the generation area compared to the visual loaded area?

sentences:
how to convert FoV into zoom 2x, 3x, 4x...? so I have the value of the FoV in degrees,
now I need to convert it to a zoom value of 2x, or 3x, for scopes and  binoculars.

I placed some objects equally distanced between each other,
but when I zoom in from FoV 100 to FoV 90, (and I am calling that a 2x zoom), the visible objects in the edges of the reticle are not the ones I expected.
Yes, I am using this big FoV of 100 to 10 just to try to calculate the 2x, 3x value properly.

So I need the ending/maximum FoV to be at 10 degrees.

what happens in the highest zoom levels, from FoV 30 to 10, is that the zooming becomes too high and hard to control, so I wonder if I am calculating it wrong?

I mean, should the FoV steps, to let results of zoom 2x, zoom 3x, be not a fixed value like:
FoV 100 = zoom 1x
FoV 90 = zoom 2x
FoV 80 = zoom 3x
I should instead use some calculation to give me a result something like (or not like):
FoV 100 = zoom 1x
FoV 85 = zoom 2x
FoV 73 = zoom 3x
and what could be such calculation?

or should I use some other rule, like impose some FoV limits and fixed fov values instead of making any calculation?

sentences:
AI surrounding algorithm suggestions I am building up a simulation where predator groups (tribes) try to hunt other agents in the simulation (whom also are clustered in groups).

Now I got to a point where members of a group follow their leader and wait for any sort of commands (currently passed as strings and vector that they need to move towards).
Anyway the idea is to implement some interesting surrounding behaviour just like predators hunt in group they surround their prey.I shall attach a picture for better explanation:

The green circles are the agents that predators are hunting. The red circle is the leader of the predator group and the black dots are other predators. The sort of behaviours I am looking for should be similar to shown in the picture where on the right side of the picture the predators are surround the pack of green agents as instructed so by the leader of the predator pack.

What I was thinking initially was find the leftmost agent in the green pack and the right most in green agents pack and make members of the predator group move towards them.However at this point I shall mention that predators have a fixed field of view so it may not see all of the pack at first.

So I am wondering if anybody came across something like so or have any good ideas how to go about producing this sort of behaviour.

sentences:
Unity trigger method does nothing I have the following script on my object:

public class PlayMyCube : MonoBehaviour
{
    [SerializeField] private Animator myAnimationController;

    private void onTriggerEnter(Collider other) {
        if (other.CompareTag("Player")) {
            myAnimationController.SetBool("playSpin2", true);
        }
    }

    private void OnTriggerExit(Collider other) {
        if (other.CompareTag("Player")) {
            myAnimationController.SetBool("playSpin2", false);
        }
    }
}

When the player character is inside the first cube's trigger, my second cube should play a spinning animation. When they leave, the second cube should stop.

But what happens in the game now is, when the character runs into the trigger, it does nothing.

I have configured my trigger object like this:

I have configured the object that should spin like this:

And configured the Animation Controller like this:

And configured my Player object like this:

What can I do to make this animation play when the player is inside the trigger?

sentences:
How to stop the RotateAround function to rotate after Keypress in Unity I have a camera follow script and I am rotating the camera with Q and E key to right and left. The Camera is a child of a camHolder object. I came up with this code, which rotates around the player to the right and left, but it's shaking as it tries to keep rotating around the player.

I didn't come up with a solution to stop the RotateAround function, instead I tried setting rotateSpeed to 0 after I let go of the key, but that didn't work either.

public Transform player;
public float smoothSpeed = 0.125f;
public float rotateSpeed;
private Vector3 velocity = Vector3.zero;

[SerializeField]
private Vector3 offset;

[Space]
public Transform camHolder;

void LateUpdate ()
{
    CameraFollowPlayer();
}

void Update()
{
    RotateCamera();
}

void CameraFollowPlayer()
{
    camHolder.position = Vector3.SmoothDamp(transform.position, player.position + offset,
                                             ref velocity, smoothSpeed * Time.deltaTime);
    transform.LookAt(player.position);
}

void RotateCamera()
{
    if(Input.GetKey (KeyCode.E))
    {
        rotateSpeed += 20f;
        if(rotateSpeed >= 20f)
        {
            rotateSpeed = 20f;
        transform.RotateAround(player.position, transform.up, rotateSpeed * Time.deltaTime);
        }
    }
    else
    {
        rotateSpeed = 0f;
    }

    if(Input.GetKey (KeyCode.Q))
    {
        rotateSpeed += 20f;
        if(rotateSpeed >= 20f)
        {
            rotateSpeed = 20f;
            transform.RotateAround(player.position, transform.up, -rotateSpeed * Time.deltaTime);
        }
    }
    else
    {
        rotateSpeed = 0f;
    }
}

sentences:
Unity3D Android - Move your character to a specific x position I want to move my character (which is a cube for now) to a specific x location (on top of a flying floor/ground thingy) but I've been having some troubles with it. I've been using this script:

var jumpSpeed: float = 3.5;
var distToGround: float;

function Start(){
    // get the distance to ground
    distToGround = collider.bounds.extents.y;
}

function IsGrounded(): boolean {
    return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
}

function Update () {
    // Move the object to the right relative to the camera 1 unit/second.
    transform.Translate(Vector3.forward * Time.deltaTime);

    if (Input.anyKeyDown && IsGrounded()){
        rigidbody.velocity.x = jumpSpeed;
    }
}

And this is the result (which is not what I want):

https://www.youtube.com/watch?v=Fj8B6eI4dbE

Does anyone have any idea how to do this? I'm using UnityScript (Javascript).

sentences:
Is transform.forward mutable? Suppose I have a GameObject, and I want it's transform.forward to be facing up. Is it possible to change it as seen below?

public class Main : MonoBehaviour
{
    void Start ()
    {
        Vector3 forward = transform.forward;
        forward = new Vector3 (0, 1, 0);
        transform.forward = forward;
    }
}

sentences:
Must I worry about quad-based rendering in real world scenarios? Most of the time in the first chapters of a random book about rasterization and rendering techniques, I find some phrases about a triangle-based rendering system and a quad-based one.

I have never encountered a quad-based GPU or pipeline. Do I have to worry about that when dealing with OpenGL 3.0+, or is it just legacy stuff?

sentences:
Blood covering ground in Unity 2D platformer I have just started my adventure with Unity so my question may seem silly to experienced users but anyway I'll give it a try. If you could just give me couple of keywords I could search for in order to solve my problem I would be very grateful.

As a sample project I wanted to create 2D pixel platformer, something like Contra. All went well up to the moment when I wanted to add some blood dripping from my enemies. I got stuck on generating the blood particles and simulating them painting over the ground. The effect I want to achieve looks like this: (live example: http://jsfiddle.net/0pg0LpL1/4/embedded/result/ , animated gif: http://imgur.com/oTeDydV)

I am wondering what is the best approach to achieve such effect. I thought about generating the texture of blood stains on the fly and placing it before camera. It would look like this: scene < blood texture < camera. The blood texture would be generated from lines drawn by "flying" blood particles masked by the ground/platforms texture:

Blood particle traces:
http://imgur.com/a/0iIeQ
Ground mask: http://imgur.com/a/YKvCK
Masked traces (what I call blood
texture): http://imgur.com/a/M8z2v

What is the best approach to achieve such effect? I know that generating texture with Texture2D.SetPixels on each frame is not optimal. I also see challenge in having a blood texture large enough to span over entire level to keep memory of all the blood spilled. Also the solution with one blood texture will not work if I wanted to have moving platforms that should also be painted.

Thanks in advance for any suggestions.

sentences:
GLSL shader algorithm to render a sprite map with a single draw call (on a single sprite mesh) I'm trying to render a tile map world on a single sprite mesh (instead of one sprite per tile.) This significantly reduces the array vertex bus labor for extremely large worlds:

In order to do this, you pass two textures to the shader: the sprite sheet itself, and a texture containing tile IDs.

Sprite map (I know some tiles repeat but ignore that, this could be any spritesheet):

Below: Entire tile world represented by a 128 x 128 texture map, where each RGB value holds actual Tile ID for that location on the map. There are more efficient ways to represent the actual tile ID. Here, for the sake of simplicity, it is stored in the R component.

Putting it all together:

The right-most square is the screen output. On the image I just repeat texture... but what should actually happen is a tile world rendered from tiles on the sprite sheet.

I wrote the shader that is supposed to do this, but I'm stuck. I can render the sprite sheet itself, and even scale it on the sprite mesh, but I can't seem to get the tile IDs render at the proper location, matching the tile world data.

I do think I am really close and there are just a couple of modification needed to the shader -- so what am I doing wrong?

The following shader is what I have so far:

tilemap.vs

#version 330 core

layout (location = 0) in vec3 position;
layout (location = 1) in vec3 color;
layout (location = 2) in vec2 texCoord;

out vec2 TexCoord;

uniform sampler2D ourTexture;
uniform sampler2D ourTilemapDataTexture;

uniform mat4 Model;
uniform mat4 View;
uniform mat4 Projection;

void main()
{
    gl_Position = Projection * View * Model * vec4(position, 1.0);

    TexCoord = texCoord;
}

tilemap.frag

#version 330 core

in vec2 TexCoord;

uniform sampler2D ourTexture;
uniform sampler2D ourTilemapDataTexture;

void main() {

    // size of the tile world (128 by 128 tiles on one sprite)
    float cols = 128.0f;
    float rows = 128.0f;

    float tilesPerSide = 8.0f;

    // figure out which tile we´re in from the 3D coordinates
    vec2 tile = vec2(floor(TexCoord.x)/cols, floor(TexCoord.y)/rows);

    // get tile´s texture ID from tile ID texture map
    float tex = texture2D(ourTilemapDataTexture, tile).r;

    vec2 UV = vec2(tex + fract(TexCoord.x), fract(TexCoord.y));

    color = texture2D(ourTexture, UV);

    if (color.a == 0) // remove transparent areas
        discard;
}

PS: I looked at every tutorial I could find on Google, and tried to re-implement it in my shader to no effect. This is as far as I got so far.

Can anyone point out what I'm doing wrong?

Update #1 -- I was able to get position sampling to work.

I painted a bit on the world map:

It's not perfect but definitely a step forward:

Adjustments made to the fragment shader:

float cols = 128.0f;
float rows = 128.0f;

float tex = texture2D(ourTilemapDataTexture, TexCoord).r;
float tey = texture2D(ourTilemapDataTexture, TexCoord).g;

vec2 UV = vec2( (TexCoord.x * (cols) / (tex * 32.0f)),
                (TexCoord.y * (rows) / (tey * 32.0f)) );

color = texture2D(ourTexture, UV);

Sure it's not 100% correct but at least map indexing works now :)

sentences:
Should I start to use DX11 Possible Duplicate:
  learning Direct3D 9, 10 or 11 ?

I have just started game dev and was wondering should I use DX11 or version 10?

I know AMD/nVidia now have DX11 cards but there are not many games using them now.

So should I wait untill they are mainstearm?

sentences:
Iterating through map : need help getting cluster of flags (points) while avoiding duplicates I have a grid style game where I make use of objects called flags which have points attached to them.
I want to be able to look at the map and find the tile(position) where it maximizes the points (using the cardinal flags North,South,West,East of current position and uses radius to give a bigger search area); while trying to avoid using the same flags.
My method works in the sense that it adds the points up correctly based on the position. However, when I move to the next tile over; if the previous tile uses flags (x,y) and the next tile over uses flags (x,y,z)
Example using method below:
Tile 1 @ Position (3,4)

Flags (x,y)

Tile 2 @ Position (3,5)

Flags (x,y,z)

Expected result for Tile 2 : z flag only
    //searches each tile for corresponding flag points
    public Map<Map<Integer, List<Flag>>, Position> checkTilePoints(Player player) {
        List<Flag> localFlags = new ArrayList<>();
        Map<Map<Integer, List<Flag>>, Position>tilePoints = new HashMap<>();
        int diameter = 4; //as much diameter as warfrig
        int radius = diameter / 2;
        int squareRadius = radius;
        for (int i = 0; i < context.getMap().getMap().length; i++) {
            for(int j = 0; j < context.getMap().getMap()[i].length; j++) {
                localFlags.clear();
                int pointTotal = 0;
                if(context.getMap().isRock(i, j, player) || context.getMap().isOutOfBounds(i, j)) {
                    continue;
                }
                for (int x = i - squareRadius; x < i + squareRadius; x++) {
                    for (int y = j - squareRadius; y < j + squareRadius; y++) {
                        if((java.lang.Math.pow(x - i, 2) + java.lang.Math.pow(y - j, 2)) < java.lang.Math.pow(radius, 2)) {
                            Flag checkedFlag = context.getMap().getFlag(x, y);
                            if ((checkedFlag != null) && (!localFlags.contains(checkedFlag))) { // add once only
                              localFlags.add(checkedFlag);
                            }
                        }
                    }
                }

                Flag north = context.getMap().getFlag(i, j + radius);
                Flag south = context.getMap().getFlag(i, j - radius);
                Flag west = context.getMap().getFlag(i - radius, j);
                Flag east = context.getMap().getFlag(i + radius, j);

                if ((north != null) && (!localFlags.contains(north))) {
                    localFlags.add(north);
                }
                if ((south != null) && (!localFlags.contains(south))) {
                    localFlags.add(south);
                }
                if ((west != null) && (!localFlags.contains(west))) {
                    localFlags.add(west);
                }
                if ((east != null) && (!localFlags.contains(east))) {
                    localFlags.add(east);
                }

                for(Flag points : localFlags) {
                    pointTotal += points.getSize().getID();
                }
                if(pointTotal != 0) {
                    //TODO - create hashmap to return
                }
            }
        }
        return null;
    }

I'm not sure if I explained my problem very well, but overall; I want to fix this method to just add the cluster of flags based on the position without using duplicate flag already checked

sentences:
rotating an object from sourceAngle to destAngle, both 0-359, clockwise or counter clockwise? I've got a game object i need to rotate. It's current angle is player.rotation, the destination is targetAngle, both in degress, 0 to 359. I've got a function named rotateDirection(float sourceAngle, float destAngle) that needs to return -1 or 1 depending on whether the shortest way to reach the destination angle would be clockwise or counterclockwise.

For example - for sourceAngle 300 and destAngle 0 the function would return 1 for clockwise.

The solution is most probably going to leave me looking silly, and i usually don't like just asking for code, but my brain is completely broken so please help me with this one :)

sentences:
Move parent according to child axis in Unity? Can I ask my parent to move according to the child axis? This means if I turn right, then right again, the parent has to be at 180° from its original position, and not only at 90° (because "Right" would mean : "stay on the right axis from the parent axis", and what I want is : "move the parent according to the child axis").

The parent has a script to move, and the child has the script to rotate, so I would need to use the new rotation from the child, and not the rotation from the parent.

My attempt so far is this one : in "MoveBody()", oldTr = transform.position works without a bug, but it is using the parent axis. With oldTr = this_objW;, there is a bug, the parent goes somewhere in the scene and move its "z" axis in an odd way :

this_obj = GameObject.Find("this_obj").transform;//the child to rotate
this_objW = this_obj.TransformDirection(this_obj.forward);//world

//...

MoveBody( new Vector3( 3.0f, 0, 0 ) );

//...

private void MoveBody( Vector3 vec ){

      Debug.Log("transform.position : "+transform.position+" / this_objW : "+this_objW); //same value here: Vector3(0,0,1);
      oldTr = this_objW; //transform.position;
      newTr = this_objW;//transform.position;
      newTr += vec;
      transform.position = Vector3.MoveTowards(oldTr, newTr, sideSpeed * Time.deltaTime);
}

Is it possible to do it this way? Or should I translate each axis by hand?

Thanks

sentences:
What is the best way to create a square grid in Unity? So I need to create a square grid like the one below. And be able to click on a square, the square you chose then is filled with a different color as well as all the squares right and below the square you have chose.
My question is what will be the most efficient way to create this grid either in 3D or 2D in Unity.

sentences:
Stencil buffer and transparent pixels Do transparent pixels cause a stencil buffer operation (increment, decrement, etc.) to be executed?

My understanding was that only opaque pixels cause a stencil buffer operation, transparent pixels have no effect on the buffer. However in my application transparent pixels do seem to cause the stencil buffer to be written.

Do I have to set up a special blendstate in order to achieve transparent pixels to have no effect?

sentences:
Unity - Mesh importing as child of armature I'm following along with this tutorial by Sebastian Lague: https://www.youtube.com/watch?v=yhPRkihs-Yg&list=PLFt_AvWsXl0f4c56CbvYi038zmCmoZ4CQ&index=14
However, when I import my character from Blender into Unity, the sword and shield mesh are children of the armature instead of siblings like the shirt/pants/shoes/etc. I'm fairly certain this is because the sword and shield are parented directly to bones on the hands, I'm just not sure why they import as children of the mesh unlike in the video.

sentences:
NullReferenceException in Unity Since many users are facing the NullReferenceException: Object reference not set to an instance of an object error in Unity, I thought that it would be a good idea to gather from multiple source some explanation and ways to fix this error.

Symptoms
I am getting the error below appearing in my console, what does it mean and how do I fix it?

NullReferenceException: Object reference not set to an instance of an
object

sentences:
How to texture a VBO? I'm not sure which way is the best way to do this for my purposes.
My purposes being having a textured (with an image) cube.

Also, I've been following a blend of tutorials, so I'm not sure which way is the most right and what I'm doing wrong (currently I haven't had the texture fit right).

Do I use glDrawArrays or glDrawElements?
For pointers, do I say gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertices); and gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, textureData);
or
gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); and gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0);
When do I bind/unbind the buffers? (gl.glBindBuffer(GL.GL_ARRAY_BUFFER, VBOVertices); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboTextureCoordHandle);) Before I establish the pointers or not in my drawing method at all?
Do I need to specify the UV coordinates/Texture Coordinates in the shader? If I'm getting a weirdly stretched texture, does that mean my fragment shader and setting the uniforms is working correctly?

Thank you!
I can supply more code, but I think I just need more information on the basics.

sentences:
UE4 - storing complex actors in Game Instance I want to make a game where I can hold tools in my hand and inventory. Obviously I want to pass them between levels and maybe even game sessions. Question is, how would I do that?

With simple variables like amount of money or HP, all I do is store a variable in the Game Instance. But what about, for example, a tool that has more data, like the class type, durability, maybe value? Even worse, whole array of them?

The way I use that in game is, there's an actor representing the tool. But even if I store array of those in the game instance, the actors get destroyed while changing level and the array just points empty memory. I could just spawn new ones by using the class type - but that is not enough for me.

My idea is to create something... maybe a struct, that would hold the information and then recreate the inventory item actors according to the data in the struct.

My questions:
What are other ways to do it?
and
Is there something fundamentally wrong with the way I'm storing the items in my inventory now?

sentences: Pixel perfect, sharp uv mapping I'm having trouble understanding how the uv map that Blender gives you works. It gives you a map with outlines which you should color in. But if I have a low-res texture I don't know where should I color in exactly. Should I place my textures between the outlines, or should my textures overlap the outlines?

sentences:
Collision Detection fails with AI cars I am making a car parking game in flash and AS3 wherein I drive my car along with other AI traffic cars moving along a specified path using Guidelines.
I am using CDK for collision detection.
The collision detection works fine with few AI cars, but doesn't seems to be working as required for few AI cars.
When an AI car is moving on a path in a straight line it works fine.... but when the AI Car turns at 90 degress..... my car goes into the AI car (Overlapping) and it hits at the center of that AI car and then collision is Detected....  .....
I made a New path and used a new Sprite for AI car... but still the problem pursues....

I have attached the png of collision.
https://dl.dropbox.com/u/53998590/Collision.png
The AI traffic comes from Top Left corner and moves down towards
bottom right corner.
The problem persist with this kind of movement.
when I change the movement of same AI cars from bottom right corner
and moves up to top left corner then the problem does not exist.
I had used CDK for collision detection.
my code is as follows.
addCollisonItem(mcAICars);

public function addCollisionItem(mc:MovieClip)
    {
        collisionlist.addItem(mc);
    }

var collArray:Array;
collArray = collisionFunction();

if (collArray.length > 0 && isCarCollided==false && game.stopCar ==false)
        {

            trace("Car Collided");

            isCarCollided = true;
            game.stopCar = true;

            if (speed >= 2) {
                speed = 1.5;
            }

            speed = -speed;

            if (accelerate && isCarCollided)
            {
                //reverse = false;
                speed = -1.5;
                //  return;
            }
            else if (reverse && isCarCollided)
            {
                //accelerate = false;
                speed = 2;
                //  return;
            }

            reduceLife();

            setTimeout(startCar, 500);

        }

Regards,
Amit

sentences:
In Unity3D, how can I improve image clarity? The same images that appear clearly in Adobe Flash appear blurry in Unity.

My game uses quads, cubes and sprites. I've tried the game on Android, iPhone, Mac  and PC, but the image appears poor-quality on all of them.

A sample screenshot:

What can I do about this?

sentences:
How to impale and stack targets correctly according to the collider and its coordinate? I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how:

At the start, the falling object (in red) will fall in a vertical direction (in blue)

When aimed properly, the target will fall down along the line of the skewer. (in blue) Then, another target is spawned and will fall vertically. (in red)

When aimed successfully again in a streak, the second target will fall along the skewer and stacked. Same process over and over when another target is spawned.

However, when I test run it on the scene tab in Unity, when impaled several targets, instead of a smooth flow and stacking it ended up overlaying it instead of stacking it up like a pancake. Here's what it look like:

As I noticed when reaching the half-way of my progress, I tried to figure out how to deal with collider bodies without sticking each other so that it will actually stack like in the example of the image at no. 3. Here's the script code I added in the target game object:

using UnityEngine;
using System.Collections;

public class ImpaleStateTest : MonoBehaviour {

    public GameObject target;
    public GameObject skewer;

    public bool drag = false;

    private float stack;
    private float impaleCount;

    void Start () {
        stack = 0;
        impaleCount = 0;
    }

    void Update () {
        if(drag) {
            target.transform.position = new Vector3 (DragTest.dir.transform.position.x, DragTest.dir.transform.position.y - 0.35f, 0);
            target.transform.rotation = DragTest.degrees;
            target.rigidbody2D.fixedAngle = true;
            target.rigidbody2D.isKinematic = true;
            target.rigidbody2D.gravityScale = 0;

            if(Input.GetMouseButton(0)) {
                Debug.Log ("Skewer: " + DragTest.dir.transform.position.x);
                Debug.Log ("Target: " + target.transform.position.x);
            }
        }
    }

    void OnTriggerEnter2D(Collider2D collider) {
        impaleCount++;
        Debug.Log ("Impaled " + impaleCount + " time(s)!");
        drag = true;
        audio.Play ();
    }

}

Aside from that, I'm not sure if it's right but, the only way to stick the impaled targets while dragging the skewer left or right is to get the X coordinates from the skewer only. Is there something else to recommend it in order to improve this behavior as realistic as possible? Please help.

sentences:
How do game engines like Unity and Game Maker exports to other platforms? From what I understand, if you want to export a Unity or GameMaker game from the editor, the game needs to be compiled to create an executable. I thought that to produce a Windows executable, you needed to be on Windows. How does Unity and GameMaker compile to Mac and Linux, if the engine is running on Windows? Likewise, How do they export to Android and iOS? Do they use the NDK for Android? What about WebGL?

How does the export actually work? Do they use a cross-platform framework written in some programming language, and when you do things with the editor it generates code using that programming language and framework, so that when you export, that code gets compiled? For WebGL, since the UnityScript code doesn't get compiled, can we see the .js files with the code?

sentences:
Blender UV unwrapping causes texture to repeat in UDK material I've made pillow kinda thing, unwrapped it in Blender and then I imported my mesh to UDK, applied a material:

The material splits, but I don't want that to happen, I want to cover the mesh with only big texture, like this one for example:

How do I do that?

sentences:
Drawing game objects that are bigger than tiles Problem:

I have 32x32 world tiles, and a 64x64 object. I am only drawing visible tiles around the player.
The object has its x and y coordinates in the tile world. I am drawing the object after I've drawn the visible area.

I'm drawing the object like this :

for (int y = firstY; y < lastY; y++) {
        for (int x = firstX; x < lastX; x++) {
            if (object.visible(x, y))
                object.draw();
            }
        }
    }

The visible(x,y) method :

public boolean visible(int x, int y) {
    if (this.x == x && this.y == y) {
        return true;
    }
    return false;
}

Now what happens is this :

Image 1.
Character stands alongside the object, everything is ok.

Image 2.
Character triggers screen move left, half of the object gets drawn outside the map.

Image 3.
Character triggers screen move right, half of the object should be visible but its not.

I know that this happens because I'm checking only if the upper left corner of the object is visible. I'm stuck. What should I do to remedy this?

Thank you for any ideas.

sentences:
SVG—rendering performance I have created a jump'n'run browser-game based on SVG. The »World« grew large (~80px * ~20000px, before scaled to viewport height) and rendering went slow. In consequence I included  a range searching algorithm to exclude elements from the render tree, if they are out of the visible area. To get all elements inside the viewport, I am using a range query on a AVL-Tree.

Basically the approach was very effective and increased the performance up to 40%, unfortunately it also results in flickering of the graphic if the player is in motion.

The initialization looks like this:

//for each element of type: path, rect, polygon, line, circle, polyline,use,text or tspan

var box = bbox.call(this, element, mtr),
  data = {
    style:    element.style,
    x1:       box[0].x,
    x2:       box[1].x,
    visible:  false
  }
this.tree.insert(box[0].x, data);
this.tree.insert(box[1].x, data);
element.style.display = 'none';

whereby bbox() creates gets the bounding box in global coordinates.

Each time at rendering the following is done:

var x1      = this.viewBox.x - 1,
    x2      = this.viewBox.x + this.viewBox.width + 1,
    result  = this.tree.query(x1, x2),
    visible = this.visible,
    i       = 0,
    n       = result.length,
    data;

for (; i < n; i++) {
  data = result[i];
  if (!data.visible) {
    data.style.display = 'block'
    data.visible = true;
  }
}

for (i = 0, n = visible.length; i < n; i++) {
  data = visible[i];
  if (data.x1 > x2 || data.x2 < x1) {
    data.style.display = 'none';
    data.visible = false;
  }
}

this.visible = result;

As mentioned above, the framerate increased between 20% and 40% on each platform, but flickering and kind of sloppy rendering began.

What could I do to gain a more fluent rendering?

sentences:
How do I tell if an object is currently colliding with another object? I can't figure out how to tell if a GameObject is currently colliding with another in Unity. I've looked online and can't find any tutorials or answers that work.

Also, what's the difference between a Collision and a Collider w.r.t. Unity?

My dilemma:

I have a third person controller set up and want it to wall jump. I already have an isGrounded function, I just need to test if I'm hitting anything other than the floor. Otherwise I want it to wall jump backwards.

I've already tried:

if (this.OnCollisionEnter){
     ...
}

if (Collider.OnCollisionEnter){
     ...
}

But it did not work. I now tried:

function OnCollisionStay(){
   Debug.Log("Collision");
}

I checked my logs, console and still can't find anything.

sentences:
How often do big MMORPG update the physics? As far as I understand, most big games use fixed timestep to have a stable simulation.

Regarding the game server, which "frame rate" do they impose? Or said it another way, what fixed timestep do they tend to use?

I know many would say: "As fast as they can get away with". I'd like to know how fast is that, if you have direct experience of established MMORPG.

sentences: What percentage of game content is normally free on a Free-to-Play game? If I wanted to launch a free-to-play game with different characters, weapons, items and clothes that can be either unlocked through gameplay or bought with real money, what percentage of items should only be available for real money? This isn't "subjective" - I'm interested in examples of real games and estimates of what percentage of their content is free.

sentences:
Move and rotate one object to another C++ [3D] I have two object, need attach 'TWO OBJECT' to 'ONE OBJECT'.

I have vectors 'angle' 'origin' of ONE and TWO objects.

I tried do "TWOOBJECT.origin += ONE.origin - ONE.oldorigin", this just attach coordinates, but not rotate with one object....

sentences:
Spawning entities in groups on a 2d tile-based map I have a 2d game that generates an "infinite" map of tiles based on a "noise" height map. Each time a new "chunk" of 16x16 tiles is loaded, I have code that randomly chooses a "creature" to spawn into the game. Whether or not a creature will spawn on the tile is random, and which creature type is weighted/random.

However, I'd like to take this to the next level and design a creature that can spawn in groups.

I have a few choices:

Spawn additional entities in a random set of surrounding tiles. Multi-chunk groups are impossible unless I write code to base spawns off of what already exists next to it.
Create a new noise/height-map value that I then use to spawn entities with.

There are pros/cons to each, but I'm hoping someone with more experience can suggest which is better, or a third choice.

sentences:
How do I render halfspace fog? How do I render halfspace fog? From my interpretation, I have a transparent plane in the scene. Then I use a function that returns a fog color in my shader.
Do I render the transparent plane by itself or with the other objects in the scene?
And also, do I make the plane transparent?

sentences:
Is there a way to run Unity without rendering the scene on the monitor (headless)? I am doing some machine learning and I get my environment from Unity in the form of images but the training is taking too long and it keeps me from doing anything else on my system. Is there a way to hide the simulation rendering?
Any help will be highly appreciated.

sentences:
How do I get the seed of a randomly generated level? I intend to use the Mersenne twister to generate a level using a seed , but I also want to make fixed levels, so for now I'm using XML to store data of the level (~40 numbers).

However, it would be awesome if I could get the seed of a specific level by reversing the process.

I guess if I used my own pseudo-random number generator I possibly could do it, but my question is can I do it with the Mersenne twister?

Here is an example of what I want to do:

If the seed 1234 gives output 25 65 78 01, can I get the seed 1234 knowing only the generated output?

Thanks in advance! (For those who wonder why I'd want to do this; my XML parsing is a lot slower than generating a level, plus XML files are bigger than seed numbers.)

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

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

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

sentences:
Quaternion.RotateTowards not working as expected when parent object moves/rotates I have a Tank with a rigidbody. A Turret Base is attached to the Tank via a Hinge Joint. The below TurretController script is attached to the Turret Base in order to rotate it to point towards the direction of the mouse.

The turret rotates flawlessly when the tank is stationary. But once I start moving the rotation behavior becomes very erratic: https://youtu.be/v1VuTbMtcCM

If anyone is able to help/explain this behavior it would be much appreciated!

/// <summary>
/// Rotates a turret towards a point at a fixed angular velocity.
/// </summary>
public class TurretController : MonoBehaviour
{
    public float m_DegreesPerSecond = 40f;

    private Vector3 m_TargetPosition;

    // Received from mouse move event
    public void Rotate(PointInputInfo inputInfo)
    {
        m_TargetPosition = inputInfo.Point;
    }

    private void RotateTurret()
    {
        Vector3 direction = Vector3.Scale(m_TargetPosition - transform.position, new Vector3(1, 0, 1));
        Quaternion targetRotation = Quaternion.LookRotation(direction, Vector3.up);
        Debug.DrawLine(transform.position, m_TargetPosition);

        // Rotate at a fixed angular velocity.
        transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime * m_DegreesPerSecond);
    }

    private void FixedUpdate()
    {
        RotateTurret();
    }
}

sentences:
LWJGL 3 - problem with flickering when rendering terrain with colors For while now I m trying to built a terrain generator for my game engine and again I'm stuck with problem.

I'm trying to generate a terrain using colors, so no textures. In short my problem is flickering. Hope this pictures will describe better my problem.

The way I'm generating this is using shared vertices. If I'm generating 2*2 terraing, I'm actually only creating 9 points.
Something like this.

For color , I made that every second point will get slightly darker green.

When I add height generation, there is no flickering.

EDIT:
It probably got something to do with using shared points. I now tried using all unique points for each square and no flickering.

EDIT:
I found was the cause. I was generating indices wrong way.

    public void generateSharedIndices(int rowVertices,int columnVertices){
    for(int row = 0; row < rowVertices - 1 ; ++row){
        for(int column = 0; column < columnVertices -1 ; ++column){
            int leftDownPoint = ((row * columnVertices) + column);
            int rightDownPoint = leftDownPoint + 1;
            int rightUpPoint = rightDownPoint + columnVertices;
            int leftUpPoint = rightUpPoint - 1;

            addNewValueToCurrentPointer(leftDownPoint);
            addNewValueToCurrentPointer(rightDownPoint);
            addNewValueToCurrentPointer(rightUpPoint);
            addNewValueToCurrentPointer(rightUpPoint);
            addNewValueToCurrentPointer(leftUpPoint);
            addNewValueToCurrentPointer(leftDownPoint);
        }
    }
}

In the end indices should look like this
( 0  1  5  5  4  0  )
( 1  2  6  6  5  1  )
( 2  3  7  7  6  2  )
( 4  5  9  9  8  4  )
but I made mistake and it was generating them wrong.

sentences:
How do I set up a bullet to fire towards the mouse pointer? I am making an FPS, in Unity. I have a player with a gun, and I have a bullet prefab. I changed the mouse pointer to look like a crosshair, but I don't know how to place the bullet where the crosshair is aiming.

The player movement is on the x and z axis. I have done lots of research on the Internet, and couldn't find anything suitable; most of what I found, I could not understand enough to change it according to my needs.

How do I set up a bullet to fire towards the mouse pointer?

sentences:
Resizing D3D Buffers within a frame I have a particle system. So far it worked like this: I have a dynamic vertex buffer for a system, which is created with a size that can hold for example 100 000 particles. I map/unmap this and write the new data into it every frame.

But what if the particle count gets bigger than the buffer can hold? I thought of recreating the vertex buffer with the double of its previous capacity (then map/unmap into it). Is this the right direction for this or should I solve it in a different way?

A short example:

ID3D11VertexBuffer* buffer;
ID3D11Device*       graphicsDevice;
//...
D3D11_BUFFER_DESC desc;
buffer->GetDesc(&desc);
if(dataSize>(int)desc.ByteWidth){ //data can't fit, so destroy and recreate
    buffer->Release();
    desc.ByteWidth*=2;
    graphicsDevice->CreateBuffer( &desc, nullptr, &buffer ); //returns S_OK
}

Update:

I want to use it for other things, not just particles but for example instanced meshes. If I spawn a couple of instances, I'd only like to resize a buffer, without creating an other one.

sentences:
Spin camera around origin/focus in Unity editor I have used Blender a bit, and like the way the camera in the editor orbits around the focus/origin when dragging with middle click.

I've recently been using Unity a little and despise the camera controls; right-dragging sort of moves the camera's view a little and middle-dragging moves the camera along a plane. Not very good to get to different angles I'd like to see from.

Is there a way to set the Unity 3D editor's camera to work like Blender's?

sentences:
How do I open the camera in a CCScene node in a Cocos2D application? I am new to Cocos2D and I can't find the way to open the camera from the library. I want to open the camera in the my game, can any one help me with with this?

Thank you in advance.

sentences:
How to ensure new players aren't blocked from the leaderboards? There is a simple word game, where players score points for each game they play. It creates a global chart, ranking players by their score.
The problem is that when a new player comes into the game, there are already old players occupying the chart top. Even if they are no longer active players.
To smooth this inequity, we introduced a super game that happens once a day and is stuffed with multiple bonuses like easier extra time, score x5 multiplication, and some others. It offers upward mobility, allowing players to get to the top if they play long enough.
Now I am thinking of another mechanism. What if all scores are subject to a little inflation, like 0.1% a day? It will affect the "poor" just a little bit and "score-fat cats" are going to be stripped of their score a bit harder. But not too much also.
I am trying to think forward on how such a mechanism could affect players' motivation, and if there some commonly used alternatives to fighting the issue?
P.S. Another idea is to reset the leaderboard at midnight on New Year's Eve, keeping a global all-time leaderboard available but just for historical purposes.
Deleting players after a certain long enough period of inactivity (like a year) is also a considered option. Another option is to reset a score if a player is inactive for a certain period of time (like half a year), but keep their profile. If the player decides to resume playing, all new games are bound to the same existing profile, but the score is counted only for games after a date when activity is restored.

sentences:
How to ensure my Sine Wave movement starts from the middle-line of the wave I am trying to make an enemy for a space game which has Sine style movement. I pretty much have it working how I want, but right now I have to manually fiddle with the 't' value to make  the wave equal on both sides from the starting position x.

I tried first using a real time variable i made from incrementing my 'aliveTime' by Time.deltaTime every update frame.

Then I realised I should probably use its Y position as the timeline because that is what i am trying to base the sideways movement from. But no matter how hard I think (and try random permutations of the formula/code below) I cannot get it to always be 'centred' in the wave (ie. when i change the figures for amplitute and speed_x , it skews the wave off in seemingly unpredictable ways).

Anyone have ideas for what to pass as the 't' parameter in the Mathf Sin line below? (thanks!)

public class Enemy_SineWaveAttack : EnemyBehaviour
{
public float speed_x;
public float amplitute;

protected override void FixedUpdate()
{
    base.FixedUpdate();
    Vector2 vel = rb.velocity;
    vel.x = amplitute * Mathf.Sin(transform.position.y * speed_x); // WHAT CAN I USE HERE TO CENTRE THE WAVE START POSITION?

    vel.y = -Game_Manager.instance.Global_Enemy_Speed * Time.deltaTime;
    rb.velocity = vel;

}
}

Screenshots (if they help to explain what i need) Note, middle enemy is the only one Im talking about here):

See how it moves in wave, but it started the wave from original position and moves to the right from there, and NOT to the left of the original position ever)

Ok, before seeing the answer from DM Gregory I tried my own solution which was to subract half from the overall value of 't' .

I ended up with this and it seems to work with various values for speed and amplitute

 protected override void FixedUpdate()
{
    base.FixedUpdate();
    Vector2 vel = rb.velocity;
    vel.x = amplitute * Mathf.Sin((transform.position.y * speed_x) * 0.5f);
    //vel.x = amplitute * Mathf.Sin(transform.position.y * speed_x - ((transform.position.y * speed_x) / 2f));
    vel.y = -Game_Manager.instance.Global_Enemy_Speed * Time.deltaTime;
    rb.velocity = vel;

}

sentences:
Discrete line inside a 3D matrix First of all a little premise: I'm following this tutorial on YouTube for procedural 2d cave generation in unity using cellular automata and I'm extending it in order to make caves in all three dimensions. With this approach, caves are based on a 3d matrix where if a cell value is 1 it is a wall and if 0 it is an empty space.
The "rooms" created, after being logically connected, need to be "physically" connected by making a path of zeros in the 3d matrix and the tutorial explains how to do this in 2d.

Can you, please, suggest me the approach on how to draw a discrete line (of zeros in this case), in a 3d matrix, that goes from point A to point B?

I'll attach a screen of a map example where rooms are drawn with cubes and red lines are the logical connections.

sentences:
Algorithm for continuously generating a tile map for a topdown 2D game? In essence, what I'm looking for is a procedural 2D tilemap continuously generated in a fashion like Minecraft - which is to say generated as the player approaches the edges of the already explored parts of the map. Map is going to be for a topdown 2D-shooter and the purpose of the map is mostly just for background and determining types of enemies and loot to spawn, so it really doesn't need to be very complex.

I've already researched some into the topic, but most of the answers have honestly been a bit too complicated or seemingly made for pregenerated maps.  Voronoi Diagrams and Simplex Noise, while impressive, I don't really understand how to implement in a continuous fashion in realtime. Or at all, really.

What I'm imagining with the generator would be to create simple biomes, composed of two values determining its 'artificiality' (i.e. how man-made the biome is) and 'life' (which is how populated it is). An example would be a city, with high values of life and artificiality both. The values for each would be skewed towards that of its neighbour to ensure that you don't have completely random values. It'd probably be a good idea to ensure that a 'biome' doesn't get too large too, by limiting the amount of tiles?

My question is, are there any better or simpler algorithms to use for something like this beyond Voronoi and Simplex? The game is programmed in C#, I feel I should mention.

sentences: Unity 3D, Making contiguous looking worlds Im currently involved in making a third person cooperative mobile game in Unity and in said game there will be an area for players to walk around in with various elevations and whatnot throughout the field. Its designed to be set up with 4 biomes in the area to go along with the games theme but I was wondering what would be the best way to mask the "boundaries" or "cut off points" in this area? From certain vantage points  its pretty obvious that the terrain used to make the world simply stops and I was wondering if anyone knew any tips and insights on how to best mask these boundaries without too much "padding" in the game area in order to keep it relatively less taxing on  a mobile device. Thank you in advance.

sentences:
OpenGL pitching problem I've been trying to implement several camera movements for my application. So far yawing, rolling, strafing, walking has been working properly, but I can't get my pitching to work properly. If I continue pitching upwards, it doesn't rotate back 360 degree, and instead gets stuck looking at the top of the screen.

Here's my code for Camera class

class Camera
{
    float m[16];
    Vector dirForward, dirUp, dirRight;

    void loadCameraDirections()
    {
        glGetFloatv(GL_MODELVIEW_MATRIX, m);
        dirForward = Vector(m[2], m[6], m[10]).unitVector();
        dirUp = Vector(m[1], m[5], m[9]).unitVector();
        dirRight = Vector(m[0], m[4], m[8]).unitVector();
    }

public:
    Vector position;
    Vector lookAt;
    Vector up;

    Camera()
    {
        position = Vector(300, 0, 100);
        lookAt = Vector(0, 0, 100);
        up = Vector(0, 0, 1);
    }

    void rotatePitch(double rotationAngle)
    {
        glPushMatrix(); {
            glRotatef(rotationAngle, dirRight.x, dirRight.y, dirRight.z);
            loadCameraDirections();
        } glPopMatrix();

        lookAt = position.repositionBy(dirForward.reverseVector());
    }
}cam;

I call the gluLookAt funtion by-

gluLookAt(cam.position.x, cam.position.y, cam.position.z, cam.lookAt.x, cam.lookAt.y, cam.lookAt.z, cam.up.x, cam.up.y, cam.up.z);

sentences:
WebGL techniques for normal mapping on morph targets? I'm currently morphing some meshes by interpolating their positions and normals between target arrays, on the GPU, in WebGL.

Now I need to apply normal maps to those morphs.

For normal maps on static meshes, I'm computing the vertex tangent vectors in JavaScript, which I then use in the shader for the normal mapping math.

For morphs, what I was about to do was compute those tangents for each morph target, then include those in the morph interpolations within the shader morphing routine, so that at every instant we have interpolated tangents with which to do the normal mapping.

Does anyone have experience with this? Does this seem reasonable? Know any examples out there I should look at?

sentences:
Transparency on pixel level? I'm using java and I do pixel-by-pixel rendering (a pixel array from an ARGB BufferedImage). So a color is 0xAARRGGBB. Now how can I render a transparent color? I guess that I should manipulate the existing pixel and not overwrite it. I can make color addition simply:

public static int additiveColor(int c1, int c2) {
        int red = (c1 & 0x00ff0000) + (c2 & 0x00ff0000);
        int grn = (c1 & 0x0000ff00) + (c2 & 0x0000ff00);
        int blu = (c1 & 0x000000ff) + (c2 & 0x000000ff);
        return 0xff000000 + (red > 0x00ff0000 ? 0x00ff0000 : red) + (grn > 0x0000ff00 ? 0x0000ff00 : grn) + (blu > 0x000000ff ? 0x000000ff : blu);
    }

So to set a pixel to a sum of two colors I just do this:

pixels[i] = additiveColor(c1, c2);

How can I do transparency?

sentences: Controlling the snake in a snake game with the mouse I am trying to implement a snake game in C# using the WPF forms. Well I know to implement the snake game, where the snake is controlled by the keyboard. But how would I do it, if I wanted to control the snake using a mouse rather than a keyboard?

sentences:
Creating big scene and little size chasing camera I would like to create a climb based game, so I need to have a big scene and a camera that cover only a little part of it and chase my player. This image explains easier what I want:

How can I do it? I'm trying to resize my camera size only, but I don't get the desired result.
Thank you.
s.

sentences:
C++&SFML Moving Sprites Smoothly in Tiles As a student, I've always wanted to become a game developer. So far I've managed to learn the basics of C++ and SFML 2.1

For my first project, upon deciding to make a 2D RPG-ish game, I encountered a problem that the game loop refreshes so quickly that if I move them by 1 pixel per frame, the sprite will move more quick than I intended to.

I implemented a frame-determined movement system(not sure what it's called) that whatever the fps is, the character moves at same speed.

However, I couldn't solve the problem(which is what I'm asking) that the sprite won't move smoothly. What's happening in my build is that the player will move about 1px per frame, and can be interrupted by other inputs. What I want the sprite to do is move horizontally 32px per second. How can I do this?

Edit: wasn't being clear enough. What I want the program to do is when I press 'Right' key once, sprite moves towards the positive side of x-axis, for 32px. What's currently functioning in my program is the sprite will move only once, 1px

TL;DR : I want to move my sprite like old-school RPG games, moving predetermined pixels(or tiles) smoothly.

sentences: How do I get the current location when using slick 2D library? I'm developing a map kind of simple game using slick 2D library, and I want to get the current location of the user.  When the user runs into a special location (ex: hole) to indicate that is dangerous. How can I achieve this?  I'm a new comer to games.

sentences:
How to replace if/else/switch with polymorphisim For a long time Robert Martin has been advising against if/else/switch branching logic and instead rely on the polymorphic behavior of different types. if/else/switch should only be used in the factory creating the types with different behaviours. He describes the approach in a recent blog post. I feel I understand the thrust of his argument as applied in his example situation and I really like the concept as it pushes decision making to a single location, DRY & OCP.
However, I'm finding it difficult to apply the principle is some basic game dev situations.
e.g. consider this pseudo-code controlling a ball bouncing around a box (think 'Breakout')
void ball::update(){
  if(collideswith(leftWall))
    velocity.x= +speed;
  else if(collideswith(rightWall))
    velocity.x = -speed;
  else if(collideswith(topWall))
    velocity.y = -speed;
  else if(collideswith(bottomWall))
    velocity.x = +speed;
}

I am unsure what kind of polymorphic class I could build to replace the branching logic here.
Replacing the above code with an Uncle Bob solution might be over-engineering, but am interested in learning more about applying the principle in these kinds of contexts.

sentences:
Isometric camera movement My camera system has two objects: the isometric camera itself, and an empty object it's attached to which handles both movement and rotation. When the player drags the middle mouse button, the camera (or, rather, the empty object) moves like this:

Vector3 diff = lastFramePosition - currFramePosition;

float xchange = diff.x / 5;
float ychange = diff.y / 5;

//flips the direction of movement if the rotation of the object is a certain way
if (transform.rotation.y == 90 || transform.rotation.y == 180)
                ychange *= -1;

if (transform.rotation.y == 270 || transform.rotation.y == 180)
                xchange *= -1;

Vector3 pos = transform.position;

//moves the camera and restrains it within the limits of the map (core.mapx and core.mapy)
transform.position = new Vector3(Mathf.Clamp(xchange + pos.x, 0, core.mapx), 3, Mathf.Clamp(ychange + pos.z, 0, core.mapy));

It turns out, though, that since it moves the empty object along the X and Y axes, dragging up/down or left/right moves it along those axes instead of actually moving the camera view up/down and left/right. The best way I can describe it is like those old isometric games that do the exact same thing. Is there any way I can get it to move like this?

sentences:
Updating games for iOS 6 and new iPhone/iPod Touch Say I have a game that runs full-screen on iPhone 4S and older devices. The balance of the game is just right for the 480 x 320 screen and associated aspect ratio. Now I want to update my game to run full-screen on the new iPhone/iPod Touch where the aspect ratio of the screen is different.

It seems like this can be challenging for some games in terms of maintaining the "balance". For example if the extra screen space was just tacked onto the right side of Jet Pack Joyride the balance would be thrown off since the user now has more time to see and react to obstacles.

Also it could be challenging in terms of code maintenance. Perhaps Jet Pack Joyride would slightly increase the speed of approaching obstacles when the game is played on newer devices. However this quickly becomes messy when extra conditional statements are added all over the code. One solution is to have some parameters that are set in once place at start-up depending on the device type.

What are some strategies for updating iOS games to run on the new iPhone and iPod Touch?

Edit - more info: I wonder what happens with a game like Plants vs Zombies? There's quite a bit of artwork that's probably sized to the 320x480 screen. Perhaps the lawn background's width can be increased while the size of the zombies and the row heights stay the same.

sentences:
Reliability of Google Analytics data I have developed an iOS game and currently the game is in beta phase. I have integrated Google Analytics (GA) to understand the users' behavior. I am distributing the game to my beta testers using TestFlight.

Recently, I found that number of sessions shown by TestFlight data is not matching with that of GA's data.

I have following questions:

Is GA's data is more reliable than the TestFlight's data?
Is GA suitable analytics solution for mobile games? If not, what are the reasons for that? Is Firebase analytics more reliable compared to GA?
I am looking for an analytics solution which can help to analyze behavior of each user (per user tracking instead of aggregated data). Can Firebase analytics provide this feature?

I would appreciate any suggestions and thoughts on this topic. Thank you.

sentences:
How can I install SharpDX for my project? Unfortunately, as an experienced developer, I can not find the download link for SharpDX's binary files on SharpDX's download page here

https://www.nuget.org/packages/SharpDX/4.2.0

I am very surprised about the high download numbers.

How do I actually download/install this?

sentences:
Write Data From List To CSV File I am trying to write to a CSV file the values that I put in lists from a key press in the keyboard. It does work somehow but in my csv file I get the values 2 times. Also, when I put values to only one of the lists, I don't get any data to CSV file. How can I save the values from the lists to my csv file but to be independent from each other? This is my code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System;

public class record : MonoBehaviour
{

public List<string> inventory = new List<string>();
public List<string> OnlyX = new List<string>();

void Update()
{
    if (Input.GetKeyDown(KeyCode.F))
    {
        inventory.Add("F");
    }
    if (Input.GetKeyDown(KeyCode.J))
    {
        inventory.Add("J");
    }
    if (Input.GetKeyDown(KeyCode.X))
    {
        OnlyX.Add("X");
    }
    string filePath = getPath();
    StreamWriter writer = new StreamWriter(filePath);
    writer.WriteLine("Inventory,OnlyX");

    for (int i = 0; i < inventory.Count; ++i)
    {
        for (int j = 0; j < OnlyX.Count; ++j) {

            writer.WriteLine(inventory[i] + "," + OnlyX[j]);
        }
    }
    writer.Flush();
    writer.Close();
}
private string getPath()
{
 #if UNITY_EDITOR
    return Application.dataPath + "/Data/"  + "Saved_Inventory.csv";
 #elif UNITY_ANDROID
    return Application.persistentDataPath+"Saved_Inventory.csv";
 #elif UNITY_IPHONE
    return Application.persistentDataPath+"/"+"Saved_Inventory.csv";
 #else
    return Application.dataPath +"/"+"Saved_Inventory.csv";
 #endif
}
}

sentences:
How can I make my character 'flip' in Game Maker? I want my character to 'flip' or 'mirror' when I press 'A' or 'S'.
Thing is, I've placed the origin everywhere on the character and he seems to only face one direction.

Video showing what I see: https://www.youtube.com/watch?v=1zZEDpO0yAM&feature=youtu.be

(This video shows the character not 'mirroring' or 'flipping' properly.)

I have done hours of research into this, and I get the same results: "Make sure the sprite has the center origin."

How would I accomplish this?

sentences:
How to transition between states and mix states in a finite state machine? I don't understand how to use a finite state machine with the entity controlled by the player.

For example I have a Mario style game (2d platform). I can jump, run, walk, take damage, swim, etc. So my first thought was to use this actions as states. But what happens, if you are running when you take damage? Or jumping, taking damage and shooting at the same time?

I just want to add functionalities (actions) to the player in a clean way (not using it for all the actions in the entity update) .

sentences:
Creating a Slide-Up Menu How can I create a menu that slides up while "un-fading" as illustrated in this video?

As you can see in the video, the menu also falls down a bit in the end which gives it a realistic feel. I really have no idea on how to approach this, and searching the web did not help either.

Any help is appreciated.

sentences:
How do I detect collision between movie clips? I know there are some methods you can use, like hittestPoint and so on, but I want to see where my movie clip collides with another another movie clip. Are there any other methods I can use?

I have had trouble finding a good introduction to game physics, and I would like to know how to something like this, properly.

sentences:
Explanation of matrix transformations I've been looking for something that can help me understand matrix transformations.  I've been to multiple different sites, including Wikipedia and quite a lot of related questions on SE and other forums.  I also posted a similar question in another forum and was unable to get results. Oh, and I visited a number of learning sites like Khan Academy to no avail.

The linked websites all provide methods to calculate transformed pixel-perfect collisions, but they require matrices for input.  Some of the sites tell you to ignore how matrices work and focus on the collision methods, but how can you do that if you need to use matrices for input?

In trying to figure out how to convert my data into matrices and use XNA's mysterious matrix transformation tools, I ran into one of math's famous jargon-barriers with such head-scratchers as vector space and linearity, among plenty others.

So the question is, can you explain how to create position, rotation, and scaling matrices, as well as how to combine them and why they work?

As I've explained, I wouldn't be asking this question if I hadn't exhausted all of my searching queries.  I am no more advanced in my mathematical understanding than Pre-Calculus.

sentences: What are the advantages and disadvantages to using a game engine? How do I know whether or not to use a game engine? I want to make a relatively complex 2D game for Android. What factors should I weigh to decide whether to find, install and learn a game engine or just do everything manually?

sentences:
How to resize animation in libgdx? I want to draw an animation, the size of each frame is 500x500px but when I try to resize, the animation seems to rotate...

Here the code to load frames and create animation:

    Texture fireSheet = new Texture(Gdx.files.internal("fire_sheet.png"));

    TextureRegion[] fireFrames = new TextureRegion[4];

    fireFrames[0] = new TextureRegion(fireSheet,0,0,500,500);
    fireFrames[1] = new TextureRegion(fireSheet,700,0,1200,500);
    fireFrames[2] = new TextureRegion(fireSheet,1450,0,1950,500);
    fireFrames[3] = new TextureRegion(fireSheet,2250,0,2750,500);

    fireAnimation = new Animation(0.5f, fireFrames);

In draw method I resize the animation in this way:

    public void draw(Batch batch, float parentAlpha) {

        batch.enableBlending();
        stateTime += Gdx.graphics.getDeltaTime();

        currentFrame = Assets.fireAnimation.getKeyFrame(stateTime, true);

        batch.draw(currentFrame, getX(), getY(), 200, 200 );

    }

So if I use:

batch.draw(currentFrame, getX(), getY() ); // WORKS!!! But too Big for me 500x500px

Instead if I use:

batch.draw(currentFrame, getX(), getY(), 200, 200 ); // Animation doesn't work properly

What Can I do?

Thank you in advance

sentences: How to make a Wii game with SDL? I am trying to find a way to create a Wii game using SDL2, but I can't find any tutorials on how to do it. How can I use SDL2 to build and privately distribute a Wii game without hacking/modding the Wii?

sentences:
Seamless tilemap rendering (borderless adjacent images) I have a 2D game engine that draws tilemaps by drawing tiles from a tileset image. Because by default OpenGL can only wrap the entire texture (GL_REPEAT), and not just part of it, each tile is split off in to a separate texture. Then regions of the same tile are rendered adjacent to each other. Here's what it looks like when it's working as intended:

However as soon as you introduce fractional scaling, seams appear:

Why does this happen? I thought it was due to linear filtering blending the borders of the quads, but it still happens with point filtering. The only solution I've found so far is to ensure all positioning and scaling only happens at integer values, and use point filtering. This can degrade the visual quality of the game (particularly that sub-pixel positioning no longer works so motion is not so smooth).

Things I have tried/considered:

antialiasing reduces, but does not entirely eliminate, the seams
turning off mipmapping, has no effect
render each tile individually and extrude the edges by 1px - but this is a de-optimisation, since it can no longer render regions of tiles in one go, and creates other artefacts along the edges of areas of transparency
add a 1px border around source images and repeat the last pixels - but then they are no longer power-of-two, causing compatibility problems with systems without NPOT support
writing a custom shader to handle tiled images - but then what would you do differently? GL_REPEAT should be grabbing the pixel from the opposite side of the image at the borders, and not pick transparency.
the geometry is exactly adjacent, there are no floating point rounding errors.
if the fragment shader is hard coded to return the same color, the seams disappear.
if the textures are set to GL_CLAMP instead of GL_REPEAT, the seams disappear (although the rendering is wrong).
if the textures are set to GL_MIRRORED_REPEAT, the seams disappear (although the rendering is wrong again).
if I make the background red, the seams are still white. This suggests it's sampling opaque white from somewhere rather than transparency.

So the seams appear only when GL_REPEAT is set. For some reason in this mode only, at the edges of the geometry there is some bleed/leakage/transparency. How can that be? The entire texture is opaque.

sentences: Importing a .x file to 3D Studio Max? I've been googling this for a while and haven't been able to find anything (blenders importer does not work). How can I import a .x file to 3D Studio Max? There are heaps of resources in converting formats readable by Max to .x but not the other way around.

sentences:
D3D11CreateDevice leads to syntax error I'm following the book Introduction to 3D Game Programming with DirectX 11 by Frank Luna (link) and I'm trying to make the empty project in Chapter 4 (don't worry, I don't expect you to read the book)

I'm getting to the point in code where I need to create the Direct3D device context. My code looks at this so far:

#include <Windows.h>
#include <D3D11.h>
#include <D3Dcompiler.h>

UINT createDeviceFlags = 0;

#ifdef DEBUG
    createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
#endif

D3D_FEATURE_LEVEL featureLevel;
ID3D11Device* md3dDevice;
ID3D11DeviceContext* md3dImmediateContext;
HRESULT hr = D3D11CreateDevice(0, D3D_DRIVER_TYPE_HARDWARE, 0, createDeviceFlags, 0, 0, D3D11_SDK_VERSION, &md3dDevice, &featureLevel, &md3dImmediateContext);

if (FAILED(hr)) {
    MessageBox(0, L"D3D11CreateDevice Failed", 0, 0);
}

// I added this as the entrypoint for the program - copied directly from microsoft's website
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow)
{
    return 0;
}

The problem is that I'm getting some errors that make no sense at all. Take a look (by the way, I'm using Visual Studio Community 2015):

Code    Description                                              File       Line
C2059   syntax error: 'if'                                       main.cpp   16
C2143   syntax error: missing ';' before '{'                     main.cpp   16
C2447   '{': missing function header (old-style formal list?)    main.cpp   16

Any help would be greatly appreciated!

sentences:
How should I handle different aspect ratios in a fullscreen game? I am creating a game using C#, GDI+ and Raster images (2D images).  For performance sake, I believe that I should have the game change the user's resolution to 800 x 600 and run the game in that setting.  However, the graphics look distorted in a wide screen since the aspect ratio for 800 x 600 is different than from a wide screen.  I cannot figure out how to determine the aspect ratio.

How is game programming normally handled on different resolutions?  Should I even change the user's resolution?  If I dont change the resolution, the game slows down a lot.

Also, some wide screens will "maintain the aspect ratio" when changing the resolution to 800 x 600 (thus creating black bars on the right and left) and some wide screens will fill up the entire screen.  How do people handle that situation??

sentences:
How to implement A.I. for checkers/draughts? I saw this checkers game and I wondered how the A.I. was implemented.

How should I implement an A.I. for checkers (draughts, dama, dame)? Are there any known algorithms?

Very thnaks full to all. I m very wonder to see this Tic Tac Toe game tutorial blog post.

So, i want dama game algorithm open source code and blog post..  Is there any helpful link or any doc file..? please let me know..

sentences: What is balance needed between testing the game mechanic (play testing) and testing the code I do not work in the industry and I wondered very broadly what percentage is given over to play testing versus getting the bugs out.  Or does no-one really work it like this?

sentences:
Algorithm for spreading labels in a visually appealing and intuitive way Short version

  Is there a design pattern for distributing vehicle labels in a non-overlapping fashion, placing them as close as possible to the vehicle they refer to? If not, is any of the method I suggest viable? How would you implement this yourself?

Extended version

In the game I'm writing I have a bird-eye vision of my airborne vehicles. I also have next to each of the vehicles a small label with key-data about the vehicle. This is an actual screenshot:

Now, since the vehicles could be flying at different altitudes, their icons could overlap. However I would like to never have their labels overlapping (or a label from vehicle 'A' overlap the icon of vehicle 'B').

Currently, I can detect collisions between sprites and I simply push away the offending label in a direction opposite to the otherwise-overlapped sprite. This works in most situations, but when the airspace get crowded, the label can get pushed very far away from its vehicle, even if there was an alternate "smarter" alternative. For example I get:

  B - label
A -----------label
  C - label

where it would be better (= label closer to the vehicle) to get:

          B - label
label - A
          C - label

EDIT: It also has to be considered that beside the overlapping vehicles case, there might be other configurations in which vehicles'labels could overlap (the ASCII-art examples show for example three very close vehicles in which the label of A would overlap the icon of B and C).

I have two ideas on how to improve the present situation, but before spending time implementing them, I thought to turn to the community for advice (after all it seems like a "common enough problem" that a design pattern for it could exist).

For what it's worth, here's the two ideas I was thinking to:

Slot-isation of label space

In this scenario I would divide all the screen into "slots" for the labels. Then, each vehicle would always have its label placed in the closest empty one (empty = no other sprites at that location.

Spiralling search

From the location of the vehicle on the screen, I would try to place the label at increasing angles and then at increasing radiuses, until a non-overlapping location is found. Something down the line of:

try 0°, 10px
try 10°, 10px
try 20°, 10px
...
try 350°, 10px
try 0°, 20px
try 10°, 20px
...

sentences:
Pairing algorithm for the Elo rating system Imagine a 1 on 1 (not teams) competition between AI bots, like the Google AI Challenge.  The various bots are assigned an ELO rating based on the outcome of the various versus matches.  The reason I specify AI bots as they can compete 24/7 without regard for player fatigue, geolocation, etc.

Given limited server resources only so many bouts can be run per day.  I'm looking for a heuristic (or an optimal algorithm) to choose which two bots should compete next.

All the past competitions have been tracked.  By this I mean that the algorithm has more to work with than just the ELO ratings.

The use cases I'm partitularly interested in:

The competition has been pairing randomly for while and now I want to make intelligent pairing decision.
The Elo rating have stabilized and a bot is updated.
The Elo ratings have stabilized and new bot is introduced to the competition.

Update:
I need to clarify.  I'm not looking for an algorithm that will provide fair matches.  I'm looking for an algorithm that will find matches most likely to update the Elo ratings of the bots to their "true" ratings with the least number of matches.

sentences:
Looking for the best way to store game data that is meant to be user editable at runtime I have a broad question, hopefully I'll synthesize it well. I've been looking for the best way to store the standard data of my project. So far, I've found 4 possible answers to my problem: Binary files, Json files, XML files and local DB(using SQLite). While the first 2 seems to be common sense for store data, I would still need some opinions about it, instead of create a bunch of content and code in vain. The chosen option must generate files that can be editable at runtime. Already used some XML files for basic saving and watched tutorials on Json and Binary files but I'm still uncertain about what road to take. I believe DB's are a different animal, but maybe it would worth for my case.
To contextualize, my project is a sports game, so I must start to generate and store virtual players and teams. After that I need to link those virtual players at their respective teams. It happens that I would like to enable human players to edit those generated virtual players and teams attributes at runtime through some kind of editor. Furthermore, I want to enable human players to create their own virtual players and teams, so the chosen method must have scalability, so it's expected to have hundreds of teams and thousands of virtual players at some point. My target platform is PC, so file sizes and general performance isn't so critical as it could be on mobile for example.
Anyway, hopefully my doubts are clear enough. It would be cool if someone have something to say, I would like to know the best choice for my case.
PS: Already take a look at these 2 questions:
How to choose how to store data?
Would it be better to use XML/JSON/Text or a database to store game content?
But most of it's answers have some years now and I still have doubts on this matter.

sentences:
Optimising a bool spread on a 2D Grid/List I'm trying to work out a more efficient way of spreading a bool flag across a 2D tilemap, as the way I currently have it setup works, but has to run far too many times to work properly.  This isn't a massive performance problem as the code doesn't run every tick, but it's still annoying as there must be a better way!  Hopefully somebody on here can help...

At present, the game code grabs a map XML file and deserialises it into a List of "mapsquares" (simple little class that holds all the info about that square in memory, so it can be modified).  This works great for most of what I want to do, but is causing an issue with "power spreading".

Each square that contains a building uses a powered/notpowered bool, with the idea that power spreads from the station along power lines to other buildings.  If it's connected to the grid, it's powered.

However, trying to get this working properly is proving messy, I've already followed the advice on here and generated neighbouring tile co-ordinates for every square when first loading the map file, this is used for exploration, but I thought it would also do power spreading.

It kinda works:

public void RegeneratePower()
    {
        MapSquare msnsq = new MapSquare(0, Vector2.Zero);
        MapSquare msssq = new MapSquare(0, Vector2.Zero);
        MapSquare msesq = new MapSquare(0, Vector2.Zero);
        MapSquare mswsq = new MapSquare(0, Vector2.Zero);

        foreach (MapSquare ms in mapSquares)
        {
            if (ms.HasBuilding)
            {
                Vector2 msn = ms.North;
                Vector2 mss = ms.South;
                Vector2 mse = ms.East;
                Vector2 msw = ms.West;

                foreach (MapSquare msa in mapSquares)
                {
                    if (msa.Location == ms.North) msnsq = msa;
                    if (msa.Location == ms.South) msssq = msa;
                    if (msa.Location == ms.East) msesq = msa;
                    if (msa.Location == ms.West) mswsq = msa;
                }

                if (msnsq.HasPower || msssq.HasPower || msesq.HasPower || mswsq.HasPower) ms.HasPower = true;

            }
        }
    }

However, it has to be run multiple times to actually spread the power more than 1 square at a time - theoretically I might have to run it as many times as the length or height of the map to ensure it covers everything :(.  I thought about using the .Reverse() command to change the List order, or using a different kind of construct instead of a list.  What would be the best way of doing this?

Thanks.

sentences:
10% idle time in WebGL I'm using requestAnimationFrame to handle my frame rate in a WebGL game, and running through the Chrome profile shows that a solid 10% of the time is spent in (idle).  Why is that?  How can I reduce this time, that, unless I'm misunderstanding, is just wasted?

I'm using raw WebGL. Here's part of my rendering code:

Animator.prototype.tick = function() {
  window.requestAnimationFrame(util.bind(this.tick, this));
  if (this.paused) return;
  this.advanceWorld();
  this.drawScene();
};

Full code at: https://github.com/nickgeorge/quantum/blob/master/animator.js

sentences:
How to flip a rectangle I'm curently working on a system that make the player character look towards the mouse pointer.
My system is effective but i'm having an issue while displaying the rectangle.

In the Following code i test the mouse position by translating it in the world and then i test if the world pos of the mouse is greater than the position of the player or not. if the mouse is on left side of the boundary, the player will rotate to look at it. To make the rotation, i put the X coordinate on the other side of the position and i make the width negative. THis normaly should emulate the rotation. but my rectangle does not shows up.

Point MousePos = Vector2.Transform(Mouse.GetState().Position.ToVector2(), Matrix.Invert(Camera.GetViewMatrix())).ToPoint;
if (MousePos.X > Position.ToPoint().X)
{
    EntityDisplayRectangle.X = Position.ToPoint().X - (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor / 2;

    EntityDisplayRectangle.Width = (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor;
}else{
    EntityDisplayRectangle.X = Position.ToPoint().X + (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor / 2;

    EntityDisplayRectangle.Width = -((int)EntitySize.X * (int)TileSize.X * _displayResizeFactor);
}
EntityDisplayRectangle.Y = (int)Position.Y - ((int)EntitySize.Y + 1);

here is two screenshots of what i curently have:

the red dot is a point drawn by this line

spriteBatch.DrawPoint(new Vector2(getEntityDisplayRectangle().X, getEntityDisplayRectangle().Y), Color.Red, 3);

So, is there an other way to do or is it even possible?

The player texture is from a tileSet and i use a source rectangle to pick the correct image from it

here is the code that draws the player:

spriteBatch.Draw(TileSet, EntityDisplayRectangle, TileSetOffsetRectangle, Color.White);

Up:

here is the rectangle drawn with a draw rectangle

Note: the red box is the collision box. it's showwn just for debug purpose

it seems that the rectangle struggle to exist when it's width is negative.

sentences:
gl_VertexID values when calling glDrawElements I am struggling a bit to understand the values that gl_VertexID primitive contains when the vertex shader is executed.

I have the standard modern rendering pipeline, in which after setting up shaders, buffers, etc I call the code below to render a mesh

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, auxMesh->indicesBuffer);
    glDrawElements(GL_TRIANGLES, auxMesh->numIndices, GL_UNSIGNED_INT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

In the vertex shader I want to manually access to the current vertex being rendered retrieving it from the original buffer (I know this sounds nonsense, but I need to do this for a reason), therefore I pass the vertex buffer as the texture buffer u_tbo_tex and I access to the actual coordinates as follows:

vec3 vertex_1 = texelFetch(u_tbo_tex, gl_VertexID + 0).xyz;
vec3 vertex_2 = texelFetch(u_tbo_tex, gl_VertexID + 1).xyz;
vec3 vertex_3 = texelFetch(u_tbo_tex, gl_VertexID + 2).xyz;

And the values of these vertex vertex_1, vertex_2, vertex_3 make perfect sense.

However, I can't really understand what values gl_VertexID got in each iteration. Is gl_VertexID sequentially assigned following the range of [0...auxMesh->numIndices].  Or are the values increased +3 at every iteration because I am drawing triangles?

I need to understand this because I am interested in calling textureFetch(u_tbo_tex, i) where i is a arbitrary triangle in my mesh (or whatever i needs to be to access an arbitrary triangle), but I can't find the right way to access to it.

sentences: How to keep Unity data after reinstall? After the use uninstall/reinstalls my app, all of his serialized data is gone. Is there a way to store a file on a mobile device permanently - which persists through various installs? Without using a server/cloud service or requiring the user to log into Google Play Games?

sentences:
How can I find the direction a sprite is moving? I'm trying to get the direction a sprite is moving (up, down, left, right). My current approach is to get the x and y coordinates of the target and the sprite (the sprite is the thing that I'm trying to get the direction of), and then have booleans be true/false based on the the values of the x/y coordinates (if they are greater than, less than, etc.). I'm not trying to rotate the sprite or change anything about how it's drawn, just find the direction that it's moving in. This is what I'm currently trying (this is more of a general idea of what I'm doing, and is pretty rough):
if (Target.Position.X < Position.X && Target.Position.Y < Position.Y - 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = true;
    IsFacingRight = false;
}
else if (Target.Position.X < Position.X && Target.Position.Y > Position.Y + 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = true;
    IsFacingRight = false;
}
else if (Target.Position.X > Position.X && Target.Position.Y < Position.Y - 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = false;
    IsFacingRight = true;
}
else if (Target.Position.X > Position.X && Target.Position.Y > Position.Y + 500)
{
    IsFacingUp = false;
    IsFacingDown = false;
    IsFacingLeft = false;
    IsFacingRight = true;
}
else if (Target.Position.Y <= Position.Y - 500)
{
    IsFacingUp = true;
    IsFacingDown = false;
    IsFacingLeft = false;
    IsFacingRight = false;
}
else if (Target.Position.Y >= Position.Y + 500)
{
    IsFacingUp = false;
    IsFacingDown = true;
    IsFacingLeft = false;
    IsFacingRight = false;
}

sentences:
Assertion b2Assert(m_bodyCount > 0) showing an error I have the following code for deleting a Box2D body:

void b2World::DestroyBody(b2Body* b)
{
    b2Assert(m_bodyCount > 0);
    b2Assert(IsLocked() == false);
    if (IsLocked())
    {
        return;
    }

    // Delete the attached joints.
    b2JointEdge* je = b->m_jointList;
    while (je)
    {
        b2JointEdge* je0 = je;
        je = je->next;

        if (m_destructionListener)
        {
            m_destructionListener->SayGoodbye(je0->joint);
        }

        DestroyJoint(je0->joint);

        b->m_jointList = je;
    }
    b->m_jointList = NULL;

    // Delete the attached contacts.
    b2ContactEdge* ce = b->m_contactList;
    while (ce)
    {
        b2ContactEdge* ce0 = ce;
        ce = ce->next;
        m_contactManager.Destroy(ce0->contact);
    }
    b->m_contactList = NULL;

    // Delete the attached fixtures. This destroys broad-phase proxies.
    b2Fixture* f = b->m_fixtureList;
    while (f)
    {
        b2Fixture* f0 = f;
        f = f->m_next;

        if (m_destructionListener)
        {
            m_destructionListener->SayGoodbye(f0);
        }

        f0->DestroyProxies(&m_contactManager.m_broadPhase);
        f0->Destroy(&m_blockAllocator);
        f0->~b2Fixture();
        m_blockAllocator.Free(f0, sizeof(b2Fixture));

        b->m_fixtureList = f;
        b->m_fixtureCount -= 1;
    }
    b->m_fixtureList = NULL;
    b->m_fixtureCount = 0;

    // Remove world body list.
    if (b->m_prev)
    {
        b->m_prev->m_next = b->m_next;
    }

    if (b->m_next)
    {
        b->m_next->m_prev = b->m_prev;
    }

    if (b == m_bodyList)
    {
        m_bodyList = b->m_next;
    }

    --m_bodyCount;
    b->~b2Body();
    m_blockAllocator.Free(b, sizeof(b2Body));
}

When I close the game I get an exception, and the debugger points to the first line :

b2Assert(m_bodyCount>0);

What exactly does this mean?

sentences:
How to convert fbx with animations to dae I am making an ARKit app, and I need to implement animations. Our 3D artist has provided these files as fbx with animations.

All resources I find online about animated models in ARKit talk about dae (Collada) files with animation.

Is there a way to convert an fbx file with animations to a dae file containing the animations?

I tried asking our artist to export a DAE file, but that didn't appear to work as he has no experience with DAE files. The animation didn't seem to play.

I have also tried an online converter (http://www.greentoken.de/onlineconv/), but that failed to perform the conversion.

sentences:
Separation of axis theorem implementation at normals This might be more of a math question, but it relates to the development of a simple physics engine I am trying to create.

I have been stumped on this for about a week now, and have been unable to find an answer in any of the SAT tutorials. (http://www.metanetsoftware.com/technique/tutorialA.html#toc, http://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169, etc.)

I understand how SAT is supposed to work, however I am little confused on the math. First, I am finding my normals like so:

Block.prototype.findNormals = function () {

        var axisVectors = new Array();
        var vertices = this.Properties.Vertices;
        var keys = Object.keys(vertices)

        for( var i = 0; i < keys.length; i++) {
            var last = {x: 0, y: 0};

            axisVectors.push({xComponent: -(vertices[keys[i]].y - last.y), yComponent: (vertices[keys[i]].x - last.x) });

            last = {x: this.x, y: this.y};
        }

        return axisVectors;
    }

I am then precede to project each vertex of the shapes I am testing on those normals.

The problem occurs, and the part of the math that I am not fully understanding, is when I have a situation like so:

axis = (-5, 6)
vertex = (6, 5)

math.dot(vertex, axis)

This results in 0.

Thus my min value for shape1 is always 0. And this results in a false collision.

Can anyone explain the math a little better?

sentences:
Why are my target-following objects rotated the wrong way? I writing a script that would make my players reach a target destination. It looks like this so far:

private void MoveTowardsGoal() {
    if (Vector3.Distance (reachGoalTarget.transform.position, transform.position) > 2.0f) {
        rDirection = (reachGoalTarget.transform.position - transform.position).normalized;
        if (rAcceleration < rMaxSpeed) {
            rAcceleration += 0.5f;
        }
        rVelocity = rDirection * Time.deltaTime * rAcceleration;
        transform.Translate (rVelocity,Space.World);
    }
}

It works fine: The objects move towards the destination point. However, I want them to move looking at the target in the forward direction (forward z axis). Currently they move with their x axis facing front.

I tried a simple rotation inside Start() like transform.LookAt(reachGoalTarget.transform). With this, they look in the forward direction but then they completely move off their initial positions by rotating themselves to reach the goal.

What am I doing wrong?

sentences:
How does a BSP tree work for Z sorting? I'm developing a 3D engine in software, and so I must compute Z sorting manually. I'm currently using the painter's algorithm to sort triangles and then drawing them back-to-front. This causes artifacts that I'm trying to correct.

Would using a dynamic BSP-tree ensure "correct Z sorting" of triangles? Why? Because the bounding volumes of triangles would be similar?
Since I would have a single "world" BSP tree, would I have to remove and re-add any moved/scaled/rotated object into the tree?
Is it possible to add triangles into a BSP tree without the expensive cutting process? Why do you need to cut triangles on the axis planes anyway?
Is it faster to traverse a BSP tree from any angle, than to sort all tris each draw like the painters algorithm?

sentences:
How to texture procedurally generated custom terrain mesh I am making an infinite procedural terrain for my game and currently trying to apply textures to it.
The generated terrain has different biomes, so I want to texturize the terrain based on biome and have different textures applied based on the steepness and height of the terrain. I also have different areas generated, such as settlements and also roads so I want to apply specific textures to specific places like those as well.
Unity terrain only supports I think 8 layers, but generally, it should be around 4 for 4 channels? In my case I generate a custom mesh, so I don't really need to worry about this, however, I am trying to figure out how to generate some sort of texture map (splatmap), and have lots of textures in it. I want to use (albedo, normal, height) for each 'layer'. Considering that the biomes are generated based on the noise map and each chunk can have many different biomes in it, I need to have more than 4 layers available. For example, steep areas like cliffs will need to have a rocky texture applied and each biome will have a different rocky texture. So if a chunk has two biomes in it, there are lots of different textures that need to be used, including various misc textures for paths and settlement grounds, etc.
Something like this, where a single chunk mesh has for example two biomes. Also, the terrain has a settlement that has a dirt texture applied to the terrain, which extends to both biomes. So essentially, lots of textures in just one mesh.

The other chunk(s) can have similar biomes or even completely other types of biomes. Also, would like to perhaps add the ability to apply different textures to a specific position on terrain chunk at runtime, for example, if the player would want to create a path or if a specific object is placed that would spread some specific texture around the object on the terrain. Something like this for example, where a placed tree has spread some leaf ground texture around:

So, I am looking for a flexible way in applying various different textures to generated terrain mesh. I would like to do that in the script when I am generating a chunk, so I would know which biomes is it at the position and as well as things like steepness and etc.
I am using Shader Graph to create the terrain shader. I'm not really experienced with shaders, so would like to ask for some help on what would be the correct way to achieve something like this?

sentences:
Discoordinated Chromatic Aberration Effect The game Teleglitch heavily utilizes the CA effect with screen distortion.

I am trying to achieve this effect.

Issue 1. How to not apply the effect onto the floor? (solved)

They render the screen then apply the CA effect.  However, the floor is not rendered with the post processing effect.

Issue 2. How to have discoordinated position for each rendered CA effect?

Currently I have three offsets for each channel: red, green, and blue.  However, I cannot assign different offsets for the channels for certain areas only.  What would be a way to have discoordinated positions?

sentences:
Given a base class and many derived classes with additional features, what's the best practice for accessing those features? This might sound strange, but let me explain. Say I want to write a safari program.
In this safari there is an object pool of 10 animals (Animal*): 2 ostrich, 5 mosquitos, 2 spiders and a snake. Each of these inherits Animal. Both snake and spider are venomous so they have data reflecting it—let's say they additionally inherit IVenomous. The mosquito inherits IFlyer. The ostrich is left out in the cold with none of these additional features.
With venomous animals around, we'd want to prepare antivenom for the safari. So let's have prepareAntidote(). This function's job would be to check what kind of antivenom is needed and simply print it out. As part of implementing IVenomous, spider and snake each have the method const std::string& getVenomName(). The base animal class doesn't have this feature.
The issue then becomes: how do we access the getVenomName() method when all we know we have is a list of Animal, and we don't know which ones implement IVenomous and have a getVenomName() method available? What's considered good practice here?
I've considerd a brute force approach of making use of dynamic_cast<IVenomous*> while iterating over all animals, but this seems wasteful. And as bad is the fact that prepareAntidote() function needs to know what an animal is to handle the pool. So it would most probably be better for it to work on a container<IVenomous*>&, wouldn't it?
My idea is to have each interface's constructor register itself with some storage class which keeps a container of pointers for each interface, and de-registers itself on destruction, so we could access a list of IVenomous animals directly. So far an unordered_map looks the most reasonable for that job, with roughly constant time for access and removal, as well as not invalidating anything except on rehash. The pointer being its own key value.
It's actually the same problem with composition like components for example in games. (That's why I'm writing it here, because of that, chances may be higher to find answers here.) In this case it screams for "object pooling" of course, but let's cast aside memory locality in this case, that should be quite easy to add in later with overloading operator.

sentences:
How to make a Realtime 3D Eulerian Fluid Simulation like "From Dust" in C#/Unity3D? So, for a game project I'm going to be working on I need to make a fully working 3D fluid simulator in Unity3D using C#, that can work in real time.

The only problem is, I've never done anything like fluid simulation. I've been doing tons of research on it, and I think a Eulerian based fluid simulator would fit my needs best (just like this).

Basically what I need is something that can react to changing terrain and move realistically.

The people that made that simulator have a research paper online, and I've read through it. I understand the basics, but I have no idea how I could get that in to C# or Unity3D. So I was wondering if any of you could help me, either by linking to other fluid-simulators where the code is open source, so I can pick it apart and change it to my needs, or by giving me tips on where to start/what I would need to do.

I've spent hours looking online for fluid simulators, but haven't found a single one programmed in C# as of yet, I have a program that can convert C++ to C#, but I don't understand C++ well enough to know where to put the scripts in Unity once they're converted.

Any help at all would be extremely appreciated, I'm really interested in teaching myself how to make this system, but I just have no clue where I should start, or what has already been done that I could build off of.

sentences:
How do I create particles that react to the player and enemies? I'm currently making a game with my own game engine which I've written in C++ and I'm using the most recent directx SDK.

The game is a top down space shooter (with a pretty interesting twist) and I'm looking to have a sort of nebula effect that the player will fly through. I really want to try and nail that nice tactile feel of hundreds of particles moving out of the way of the player ship as it flies into them. Somewhat like how particles would move out the way of the player in Geomtry Wars on XBLA.

I'm an experienced programmer when it comes to C++. I don't know, however, how to start implementing this effect. Does anyone have any cool ideas or design choices I might want to look into? Feel free to answer to any degree of depth you fancy.

sentences:
Is this paint method okay? I dont know why i need to call super.paintComponent() and super.repaint() to make the player's movements update, if i just put paintComponent the game seems like to always be stopped. However I think that my mistake is the render() method, if a remove it, it doesn't make any difference, so it is useless, I've been looking for the error but I still can not see it. I would appreciate some help

Here is the paint method of the drawing class

public void paint(Graphics g) {
    super.paintComponent(g);

    setFocusable(true);
    requestFocusInWindow();
    setBackground(Color.BLACK);
    player.drawPlayer(g, getPosX(), getPosY());
    enemy.drawEnemy(g);
    //I know this should not be here
    super.repaint();
}

Pricipal GameLoop and render method

public void run() {
    long lastLoop = System.nanoTime();
    final int TARGET_FPS = 60;
    final long OPTIM_TIME = 1000000000 / TARGET_FPS;
    long lastFPSTime = 0;
    int fps = 0;
    double delta = 0;

    while (running) {
        long now = System.nanoTime();
        lastLoop = now;
        delta += (now - lastLoop) / ((double) TIEMPO_OPTIMO);

        lastFPSTime += (now - lastLoop);
        fps++;

        if (lastFPSTime >= 1000000000) {
            System.out.println("[FPS : " + fps + " ]");
            lastFPSTime = 0;
            fps = 0;
        }

        while (delta >= 1) {
            render();
            delta--;
        }

        try {
            Thread.sleep((System.nanoTime() - lastLoop + OPTIM_TIME) / 1000000);
        } catch (InterruptedException ex) {
            Logger.getLogger(mainGameLoop.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

public void render() {
    BufferStrategy bs = this.getBufferStrategy();
    if (bs == null) {
        createBufferStrategy(2);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    drawing.paint(g);
    g.dispose();
    bs.show();
}

And as last and least probable, I thought that maybe there is something that is not adding correctly to my window

A normal window class

Drawing drawing = new Drawing();

public Window(String title,int width, int hight, mainGameLoop mainGame){
    JFrame frame = new JFrame(title);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(width, hight);
    frame.setLocationRelativeTo(null);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.add(mainGame);
    frame.add(drawing);

    mainGame.start();
    mainGame.run();

sentences:
Should clients in an online game access the database directly or through a game server? first im total noob about c# and mysql. Just trying to find which way is better. i believe your answers prevents me from losing plenty of time.

Online game(not more than 50 users at pre-alpha. Not expecting than 500+ at the end.)
Text based game / console like ( minimum graphics )
PVP -> Players are able to destroy other players.
Simlpy a hacking simulation.
There will be some servers.(NPC servers and player made servers)
players can reach that servers made by other players.

Q: Which one is the good way to store that servers data?

game client --> Mysql server ?
or
game Client --> a Server Client(which is localy running a mysqL server)

If it's totaly wrong to use mysql server how can i make it?
Thank you...

sentences:
Frame graph in Vulkan: from theory to implementation I've watched the excellent talk from Yuriy[1] and read a blog post[2] multiple times already, but I still cannot find the answers to the questions I have.
I really like the idea of defining a graph of "virtual resources", it gives a lot of flexibility, maintanability, and ease of use (think about synchronization) in the long term. First, I thought that the easier way to solve my problem (described below) is to implement this system so that the graph building and the transformation to the actual graphics API wouldn't be done every frame, only when the conditions (eg. graphics settings) change.
However, extending the "only when the conditions change" statement to include game logic-related decisions, we get to a point where the frame graph must be rebuilt almost every frame. This is also what Yuriy suggested in his talk and I agree with it.
The main problem
In Vulkan the whole pipeline (with the corresponding render pass) must be pre-built. So the rebuilding of the whole graph every frame can be a bottleneck as I can imagine. The pipeline cache could speed up things (in theory) but avoiding sudden frame-rate drops is top priority. However, if a pipeline (especially the shaders) have not yet been built, it could cause a hitch up. And pre-warming the cache(s) with every possible permutations defeat the purpose of the whole system.
The question
So I'm wondering if there is a way to keep the best from both worlds, rebuilding the whole graph every frame while avoiding sudden frame drops from pipeline creation.
If there is no such solution, what would be the closest thing to this kind of dynamic whole frame predefinition? Should I fall back to the rarely rebuild graph, and use another method to skip (sub)passes?
References
[1] FrameGraph: Extensible Rendering Architecture in Frostbite (GDC Vault)
[2] Render graphs and Vulkan — a deep dive (link)

sentences: 2 component unit vector Is it possible to store a 3d unit length vector with only 2 components, for example as coordinates on a unit sphere? It seems possible but I have never seen anyone do this. Would this be at all practical?

sentences:
Platform independent replacement for LuaInterface I'm currently working on a project in C#/XNA, however I'm planning to migrate this to MonoGame so that it can go onto more platforms. The problem is that I am currently using a lot of Lua, and for that in XNA, I am using LuaInterface.

The issue I now have is that LuaInterface only runs on Windows because of the dlls that it requires, but I would like to make this project available on Linux and Macs as well. Does anyone know of a good alternative to LuaInterface that could slot into Mono quite nicely?

Re-writing the parts which are currently in Lua in another language wouldn't be too much of a problem, but I need to be able to use scripting as I want to make large portions of my game open to players for modding.

sentences:
Fixing game loop to 60fps makes animation very jittery ns is 1000000000 / amountOfTicks;

    long now = System.nanoTime();
    delta += (now - lastTime) / ns;
    lastTime = now;

    if (delta >= 1) {
        tick(glad);
        updates++;
        delta--;
        fps_counter = 0;
    }

    if (delta >= fps_counter / FramesPerTick) { // render
        fps_counter++;
        frames++;
        render(glad);
    }

    if (System.currentTimeMillis() - timer > 1000) {
        timer += 1000;
        frame.setTitle("Ticks: " + updates + " Fps: " + frames);
        updates = 0;
        frames = 0;
    }

So if i have 20 ticks and 3 FramesPerTick i get 60fps
it checks whenever delta is bigger than 1/3, 2/3 and 3/3, so every tick has 3 frames

Everything is jittery, movement, mouse look.
Animation gets more and more jittery the lower the FPS, i dont understand why.

Also when i take the render(glad) method out of the if, it goes up to 400 fps and runs very smoothly.

EDIT:
If i put Thread.sleep(13) instead of if (delta>=fpscounter/FramesPerTick){} i get around 60 fps and smooth animations.

sentences:
Unity: Is there a way to edit a Skin file? My project has multiple skins and sometimes we have to deal with skins with many custom styles. Editing them in the editor is difficult, for instance, I cannot delete one style that is not the last one without deleting the ones after it.

Would there be a way to edit a file that represents this skin?

Could I edit a skin file if I use Text in the Asset Serialization Mode (Unity Pro)?

If not, is there something in the Unity Store to help me better edit skins?

sentences:
What are the dangers of self-teaching game development? I am about to embark upon a journey into game development.  Following answers to my last question, I will be using C# and XNA.

However, I don't personally know any other game developers and I don't work in the industry so, as such, will be self-taught.  The exception to this is obviously the asking of questions and reading of online/printed information but I would still class this as being self-taught.

With that, I want to be prepared for issues that I may encounter through not having someone to "keep me under their wing".

As an analogy, when self-teaching myself to play guitar, I played the A major chord in such a manner that it made moving to a chord I learned later more difficult.

If you could share your lessons learned and advice on what might go wrong in my learning of game development I'd be grateful.

I am well aware that making mistakes is the biggest part of learning but, if there're mistakes I can be prepared for then I'd be happier with that.

sentences:
How to achieve light that changes color mid-way? I thought of creating light sources, and some colored windows. Now, the windows are semi-transparent. How could I make it so that when the light (say, pure white) hits the glass and continues through it, but changes the color to the same color as the glass it passed?

I know the effect described here can be faked by using area lights on the "colored" side of the window, but what if I just wanted to have one white point light?

sentences:
Given a ray-intersect position on morphed mesh, how to compute that position at each morph target? I'm working on an annotation system that allows a user to click on a mesh to attach a pin with a label hanging off it.

It must be possible to pin an annotation on an object that's being morphed with keyframe morph targets, so that the pin will move with the surface of the mesh.

It's mainly pretty simple, where I do a ray-intersect to find the pin position on the mesh, for the shape of the mesh at the current time within the morph targets.

Then I have, for that time instance:

the 3D coordinates of the pin
the triangle (ie. the indices and vertex positions of the triangle's vertices) that the pin is within
the time instant

Now, if I had the 3D coordinates of the pin at each of the morph's targets, then I can simply tween the pin position, to animate it in synch with the morph.

However, the challenge I is to somehow compute the position of the pin at each of the morph targets, from these three pieces of information.

Intuitively, it seems to be a matter of somehow finding some sort of coefficient (or set of coefficients) that indicates the pin's position relative to the vertices of its enclosing triangle, at the instant within the morph sequence that we attach the pin.

Then, for each other target within the morph sequence, given the morphed positions of the triangle vertices, which could be anything, somehow use the coefficient(s) to find the updated pin position, relative to the triangle's current vertex positions.

Anybody got any ideas? Math pointers etc?

cheers!

sentences:
Calculation correct position of object after collision (2d) I have a circle, that bounces of walls. The circle is traveling at the speed defined by px/s for x and y. I have collision detection implemented and I use vectors to calculate the new x/y speed (and direction) after the collision. My problem is, that is some cases the circle gets stuck in or is consumed by the wall.

The reason for this is, that when the collision occurs, the circle is actually x pixels inside the wall (as illustrated by the image below) and not just at the "border" of the wall. This occurs because the circle might move multiple pixels on each redraw (tick). The circle doesn't move enough pixels during the next redraw in order to get loose from the wall, thus triggering a new collision. Direction changes again towards the wall leading to a shaking motion of the circle, either finally getting loose of the wall or being consumed by the wall.

The solution for this is to reposition the circle so that it is loose from the wall after the collision has occurred. My problem is, that with my rusty mathematics, I can't figure out how to calculate the correct position of the circle and that's where I need your help.

I also wonder, how exact I need to be with the position, I mean, I know the minimum distance of the middle of the circle to the wall (and thus also know how much the circle has penetrated the wall), let's call this value d. I could of course move the circle d pixels perpendicular to the wall, this might be a close enough approximation of the position, although not 100% accurate. If you guys think this is a good enough solution, is there a way to achieve this with vectors or do I need to calculate the angles and new position "manually" using cos and sin?

Side note: I'm not using SAT for collision detection because I have concave polygons.

sentences:
Simple Java 2D Game : Player Doesn't Move I'm a beginner at java and I'm trying to make a simple 2D game as a practice, and i have a problem here with the player, I've tried a lot to make it move but it didn't work. These are the classes that contain the player.

Game Class :

package game;

import game.input.Controller;
import game.input.KeyInput;
import game.objects.Player;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.Timer;

public class Game extends JPanel implements ActionListener{

  Timer loopTimer;
  //Objects
  Player p;
  Controller c;

  public Game(){
    addKeyListener(new KeyInput(p));
    setFocusable(true);

    loopTimer = new Timer(10, this);
    loopTimer.start();

    p = new Player(300,200);
    c = new Controller();
  }

  public void paint(Graphics g){
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.white);
    g2d.fillRect(0, 0, 640, 480);
    p.draw(g2d);
    c.draw(g2d);
  }

  public void actionPerformed(ActionEvent ee){
    p.update();
    c.update();
    repaint();
  }
}

Player Class :

package game.objects;

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;

public class Player extends GlobalPosition {

  private String playerimage = "/images/marioR.png";

  int velX = 0;
  int velY = 0;

  public Player(int x, int y) {
    super(x, y);
  }

  public void draw(Graphics2D g2d){
    g2d.drawImage(getPlayerImage(), x, y, null);
  }

  public Image getPlayerImage(){
    ImageIcon i = new ImageIcon(getClass().getResource(playerimage));
    return i.getImage();
  }

  public void update(){
    x += velX;
    y += velY;

    // Collision with outside
    if(x < 0){
      x = 0;
    }
    if(y < 0){
      y = 0;
    }
    if(x > 640){
      x = 640;
    }
    if(y > 480){
      y = 480;
    }
  }

  public void keyPressed(KeyEvent e){
    int c = e.getKeyCode();
    if(c == KeyEvent.VK_LEFT){
      velX = -10;
    }
    if(c == KeyEvent.VK_RIGHT){
      velX = 10;
    }
    if(c == KeyEvent.VK_UP){
      velY = -10;
    }
    if(c == KeyEvent.VK_DOWN){
      velY = 10;
    }
  }

  public void keyReleased(KeyEvent e){
    int c = e.getKeyCode();
    if(c == KeyEvent.VK_LEFT){
      velX = 0;
    }
    if(c == KeyEvent.VK_RIGHT){
      velX = 0;
    }
    if(c == KeyEvent.VK_UP){
      velY = 0;
    }
    if(c == KeyEvent.VK_DOWN){
      velY = 0;
    }
  }

  public void keyTyped(KeyEvent e){
  }
}

KeyInput Class :

package game.input;

import game.objects.Player;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class KeyInput extends KeyAdapter{

  private final Player p;

  public KeyInput(Player p){
    this.p = p;
  }

  public void keyPressed(KeyEvent e){
    p.keyPressed(e);
  }

  public void keyReleased(KeyEvent e){
    p.keyReleased(e);
  }
}

.

sentences:
What determines the hit detection ordering for graphic elements in Unity (2d game)? I have a bunch of overlapping buttons spread across several UI Canvases. The default mouse behaviour only registers hover/click events with one of the overlapping buttons, which is ideal for my project. The problem is the order of which button gets activated, is not tied to the Layer it is on or the Sorting Layer the item is on. I cannot seem to control which button is the top button that gets activated.

Using a RaycastAll() function returns the name of all buttons on any given point, and reflects the problem that for some reason, the buttons are arbitrarily ordered.

How do you control the order in which buttons are registered by the mouse?

sentences:
How do I determine the draw order in an isometric view flash game? This is for a flash game, with isometric view. I need to know how to sort object so that there is no need for z-buffer checking when drawing. This might seem easy but there is another restriction, a scene can have 10,000+ objects so the algorithm needs to be run in less than O(n^2). All objects are rectangular boxes, and there are 3-4 objects moving in the scene. What's the best way to do this?

UPDATE

in each tile there is only object (I mean objects can not stack on top of each other). and we access to both map of Objects and Objects have their own position.

UPDATE2

see these figures:

in first one first blue object should be drawn then green then red. while in second one you have to draw them in reverse order. you need to draw red first and then green and finally blue object. as you can see there is no difference in position of blue and red objects ,they both have different distance from camera and so on. but because of their relative position to green box, you need to change their draw order between two images. that's what makes this problem a mess.

side-note: since all objects are rectangular prism, it's mathematically provable that there is at-least one draw order to satisfy problem needs.

sentences:
Android OpenGL ES 2 framebuffer not working properly I'm trying to understand how framebuffers work. In order to achieve that, I want to draw a very basic triangle to a framebuffer texture and then draw the resulting texture to a quad on the default framebuffer.

However, I only get a fraction of the triangle like below. LE: The triangle's coordinates should be (1) -0.5f, -0.5f, 0 (2) 0.5f, -0.5f, 0 (3) 0, 0.5f, 0

Here's the code to render:

@Override
public void onDrawFrame(GL10 gl) {
    renderNormalStuff();
    renderFramebufferTexture();
}

protected void renderNormalStuff() {
    GLES20.glViewport(0, 0, texWidth, texHeight);
    GLUtils.updateProjectionMatrix(mProjectionMatrix, texWidth, texHeight);

    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]);

    GLES20.glUseProgram(mProgram);

    GLES20.glClearColor(.5f, .5f, .5f, 1);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);

    Matrix.setIdentityM(mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

    GLES20.glUniformMatrix4fv(u_MVPMatrix, 1, false, mMVPMatrix, 0);

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vbo[0]);
    GLES20.glVertexAttribPointer(a_Position, 3, GLES20.GL_FLOAT, false, 12, 0);

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vbo[1]);
    GLES20.glVertexAttribPointer(a_Color, 4, GLES20.GL_FLOAT, false, 16, 0);

    GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, ibo[0]);
    GLES20.glDrawElements(GLES20.GL_TRIANGLES, indexBuffer.capacity(), GLES20.GL_UNSIGNED_BYTE, 0);

    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
    GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);

    GLES20.glUseProgram(0);
}

private void renderFramebufferTexture() {
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);

    GLES20.glUseProgram(fboProgram);

    GLES20.glClearColor(.0f, .5f, .25f, 1);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);

    GLES20.glViewport(0, 0, width, height);

    GLUtils.updateProjectionMatrix(mProjectionMatrix, width, height);

    Matrix.setIdentityM(mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);
    Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);

    GLES20.glUniformMatrix4fv(fbo_u_MVPMatrix, 1, false, mMVPMatrix, 0);

    //draw the texture
    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture[0]);
    GLES20.glUniform1i(fbo_u_Texture, 0);

    GLUtils.sendBufferData(fbo_a_Position, 3, quadPositionBuffer);
    GLUtils.sendBufferData(fbo_a_TexCoordinate, 2, quadTexCoordinate);

    GLES20.glDrawElements(GLES20.GL_TRIANGLES, quadIndexBuffer.capacity(), GLES20.GL_UNSIGNED_BYTE, quadIndexBuffer);

    GLES20.glUseProgram(0);
}

sentences:
Calculating a smooth velocity of interaction touches I have a touch game and it would be beneficial to be able to know the "velocity" of each touch on the screen.  Let me explain.

Right now I am already subtracting current touch position from previous ones to get a dt, however this is not working well. Sometimes the dt will show up as 0 even though the finger is moving.

What would be a good way to measure a smooth velocity of each touch considering that it can release, or touch back down at any moment?

I already have  method to track the position of each finger, I just need a way to get a smooth velocity.

sentences:
How to design and implement turn-based system? Possible Duplicate:
  How to implement turn-based game engine?

I am considering making a game like Master of Orion but I don't know how to start with turn-based systems. If any of you played this game they know what I mean, same system is used in Civilization.
1. You give orders to your units and production queues
2. Click End Turn.
3. Everything moves, go to 1.

I know that some form of state machine is used, but maybe you could point me into some book or manual on the matter.

sentences:
Problem with grid generation in Unity 5.1 Using Unity 5.1 and was following a tutorial for generating a grid for a Minesweeper-style game. Link to the tutorial for reference: http://gamedevelopment.tutsplus.com/tutorials/build-a-grid-based-puzzle-game-like-minesweeper-in-unity-setup--cms-21361

Tutorial is Unity 4, but I don't think it should matter.

Here's my code:

public GameObject tilePrefab;
public int numOfTiles = 10;
public float distanceBetweenTiles = 1f;

void Start () {
    CreateTiles();
}

void CreateTiles () {
    float xOffset = 0f;

    for (int tilesCreated = 0; tilesCreated < numOfTiles; tilesCreated++) {
        Vector3 positionVar = new Vector3(transform.position.x + xOffset, transform.position.y, transform.position.z);
        xOffset += distanceBetweenTiles;
        Instantiate(tilePrefab, positionVar, transform.rotation);
    }
}

Essentially, the problem is that when I coded the spacing algorithm, Unity decided to ignore the spacing of 1f, but instead do 10,000. No matter the number I substitute for "distanceBetweenTiles", Unity spaces the cubes by 10,000 points. I'm assuming it has to do with how Unity is handling the float numbers, but I'm not quite sure, considering the number I substitute doesn't seem to matter. I've included a screenshot of Unity running the script and the inspector view of the giant X position. Thanks so much in advance]1

sentences:
How do I make a 2D character aim their gun toward the mouse? Heli Attack is a perfect example of the shooting mechanic I'd like. The character aims perpetually toward the mouse. What's going on here?

From what I've read so far, you could separate the arm and rotate that. I've also noticed some people use a different sprite for each weapon.

How can I achieve this?

sentences:
Determine whether a shape formed from a series of other shapes is 'unbroken' I have a grid of tiles in a game and each tile can have a certain simple shape on it.

I want to be able to determine whether the combined shape from any given arrangement of these tiles results in an 'unbroken' or 'broken' larger shape.

For example; this is an example of an 'unbroken' shape...

And this is an example of an 'broken' shape...

I'll be able to write the necessary code once I figure out the logic of this problem, but so far I've been struggling.

I've tried data tables associated to each tile that describe it's edges, for example :

var edges = {
    top : false,
    right : true,
    bottom : true,
    left : false
}

And from this I can determine whether each tile is 'connected' to it's neighbours. But this doesn't help for all situations.

EDIT 1:
Multiple clusters of isolated 'unbroken' shapes would be considered a 'broken' shape...

EDIT 2:

Also, an 'unbroken' shape can be achieved if a shape tile's edge is not connected to every neighbouring tile, it can be just one connection. For example I would consider this to be 'unbroken' ...

Anyone got any ideas on this?

sentences:
XNA: Networking gone totally out of sync I'm creating a multiplayer interface for a game in 2D some of my friends made, and I'm stuck with a huge latency or sync problem.

I started by adapting my game to the msdn xna network tutorial and right now when  I join a SystemLink network session (1 host on PC and 1 client on Xbox) I can move two players, everything is ok, but few minutes later the two machines start being totally out of synchronization. When I move one player it takes 10 or 20 seconds (increasing with TIME) to take effect on the second machine.

I've tried to :

Create a thread which calls NetworkSession.Update() continuously as suggested on this forum, didn't worked.

Call the Send() method one frame on 10, and the receive() method at each frame, didn't worked either.

I've cleaned my code, flushed all buffers at each call and switched the host and client but the problem still
remain...

I hope you have a solution because I'm running out of ideas...

Thanks

SendPackets() code :

    protected override void SendPackets()
    {
        if ((NetworkSessionState)m_networkSession.SessionState == NetworkSessionState.Playing) //Only while playing
        {
            //Write in the packet manager
            m_packetWriter.Write(m_packetManager.PacketToSend.ToArray(), 0, (int)m_packetManager.PacketToSend.Position);
            m_packetManager.ResetPacket(); //flush

            //Sends the packets to all remote gamers
            foreach (NetworkGamer l_netGamer in m_networkSession.RemoteGamers)
            {
                if (m_packetWriter.Length != 0)
                {
                    FirstLocalNetGamer.SendData(m_packetWriter, SendDataOptions.None, l_netGamer);
                }
                }
            m_packetWriter.Flush();//m
            m_packetWriter.Seek(0, 0);
        }
    }

ReceivePackets() code :

    public override void ReceivePackets()
    {
        base.ReceivePackets();

        if ((NetworkSessionState)m_networkSession.SessionState == NetworkSessionState.Playing) //Only while playing
        {
            if (m_networkSession.LocalGamers.Count > 0) //Verify that there's at least one local gamer
            {
                foreach (LocalNetworkGamer l_localGamer in m_networkSession.LocalGamers)
                { //every LocalNetworkGamer must read to flush their stream
                    // Keep reading while packets are available.
                    NetworkGamer l_oldSender = null;
                    while (l_localGamer.IsDataAvailable)
                    {
                        // Read a single packet, even if we are the host, we must read to clear the queue
                        NetworkGamer l_newSender;
                        l_localGamer.ReceiveData(m_packetReader, out l_newSender);
                        if (l_newSender != l_oldSender)
                        {
                            if ((!l_newSender.IsLocal) && (l_localGamer == FirstLocalNetGamer))
                            {
                                //Parsing PacketReader to MemoryStream

                                m_packetManager.Receive(new MemoryStream(m_packetReader.ReadBytes(m_packetReader.Length)));
                            }
                        }
                        l_oldSender = l_newSender;
                        m_packetReader.BaseStream.Flush();
                        m_packetReader.BaseStream.Seek(0, SeekOrigin.Begin);
                    }
                }
                m_packetManager.ParsePackets();
            }
        }
    }

sentences:
How do I generate a 3D race track from a spline? I want to generate a 3-dimensional race track around a spline that describes its shape.  Here's an illustrative video.

The track should be an endless tunnel that sweeps along a 3D spline, with some obstacles thrown in.  My best idea so far has been to loft a circle shape along the spline.

I would also like some pointers into how to manage the geometry i.e. how to create it from the loft operation, manage its 'lifecycle' in memory, collision and texturing.

sentences:
XNA drawing textures on random positions I'm trying to reproduce this tutorial, but each time I try to implement it into my code, I always get a lot of errors. Now I finally managed to code something like this, the game runs, but nothing happens at all, my screen remains black without any texture drawn on it, and I just can't figure out what am I doing wrong here.
Here's my background class:

public class background
{
    public Vector2 position;
    public Texture2D texture;
    private List<Star> stars;
    private Random _Random;

    private int MaxX;
    private int MaxY;
    private int _Intensity;

    public background(ContentManager content, int Intensity)
    {
        this.texture = content.Load<Texture2D>("star2");
        _Intensity = Intensity;
        this.MaxX = 1280;
        this.MaxY = 720;
        stars = new List<Star>();
        _Random = new Random(DateTime.Now.Millisecond);

        for (int i = 0; i < Intensity; i++)
        {
            int StarColorR = _Random.Next(25, 100);
            int StarColorG = _Random.Next(10, 100);
            int StarColorB = _Random.Next(90, 150);
            int StarColorA = _Random.Next(10, 50);

            stars.Add(new Star(new Vector2(_Random.Next(MaxX / -2 - 1280, MaxX / 2 + 720), _Random.Next(MaxY / -2 - 1280, MaxY / 2 + 720)),
                new Color(StarColorR / 3, StarColorG / 3, StarColorB / 3, StarColorA / 3)));

        }
    }

    public void Update(GameTime gameTime)
    {

    }

    public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        foreach (Star s in stars)
        {
            spriteBatch.Draw(texture, s.Position, s.Color);
        }
        spriteBatch.End();
    }

}

And the stars class:

class Star
{
    public Vector2 Position;
    public Color Color;
    public Star(Vector2 Position, Color Color)
    {
        this.Position = Position;
        this.Color = Color;
    }
}

As you can see I'm not using the exact same Star class as it is in the original code. First, I'm just trying to achieve the stars to appear on the game screen in random positions.

sentences:
HTML5 Canvas Tileset Animation How to do in HTML5 canvas Image animating?

I am have this code now: http://jsfiddle.net/WnjB6/1/

In here I am can add animations something like -> Animation.add('stand', [0, 1, 2, 3, 4, 5]);

But how to play this animation? My image drawing function is -> drawTile(canvasX, canvasY, tile, tileWidth, tileHeight);

Animation['stand']; return 0, 1, 2, 3, 4, 5

I am need something like when I am run Animation.play('stand') run animation from 'stand' array.

I am try to do this something like one day, but no have more idea how. :(

Thanks and sorry for my bad English language.

sentences:
How can i do a "Crouch" with only a Character Controller with no rigidbody? I was following Bracky's fps tutorial but he didn't add crouching as an option. I took a stab at it but came up empty handed. Here is my script for player movement.
public class PlayerMovment : MonoBehaviour
{
public CharacterController controller;
public float speed = 12f;
public float gravity = -9.81f;
public float jumpHeight = 3f;

public Transform groundCheck;
public float groundDistance = 0.4f;
public LayerMask groundMask;

Vector3 velocity;
bool isGrounded;

// Update is called once per frame
void Update()
{
    isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

    if(isGrounded && velocity.y < 0)
    {
        velocity.y = -2f;
    }

    float x = Input.GetAxis("Horizontal");
    float z = Input.GetAxis("Vertical");

    Vector3 move = transform.right * x + transform.forward * z;

    controller.Move(move * speed * Time.deltaTime);

    if(Input.GetButtonDown("Jump") && isGrounded)
    {
        velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
    }

    velocity.y += gravity * Time.deltaTime;

    controller.Move(velocity * Time.deltaTime);
}

And also have a separate script for mouselook, here that is aswell.
public class Mouselook : MonoBehaviour
{
public float mouseSensitivity = 100f;

public Transform playerBody;

float xRotation = 0f;

// Start is called before the first frame update
void Start()
{
    Cursor.lockState = CursorLockMode.Locked;
}

// Update is called once per frame
void Update()
{
    float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

    xRotation -= mouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);

    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
    playerBody.Rotate(Vector3.up * mouseX);
}

}
How would I go about adding one without adding a rigidbody or changing my script fully to follow other tutorials? Thank you!

sentences: How to create a over world map with multiple sub maps my game's idea is to use a open world map consisting of say 4096x4096 size, and multiple grids of 64x64 size. When I click on any grid, the map zooms in to show that grid(either creating in from scratch or loading off a JSON) because saving all the grids could not be memory efficient. Is there any algorithm to do like this?

sentences:
How to avoid players getting lost in and/or bored by the meta game? Yesterday, I noticed something that I had never noticed consciously before, but which had "ruined" more or less all games that I have ever played:

The longer you play a game, the more you get lost in and bored by the meta game. What I mean is that the longer you play, the more you know the meta game. Once you know the meta game by heart, you basically stop playing the game and instead only play the meta game anymore.

Here are a few examples from different genres to show what I mean:

DotA: In the beginning, DotA is super fun, although you totally suck at it. You learn new heros, you are happy when you are able to buy an expensive item and so on. After being "pro" in DotA, you basically only play the meta game anymore: You pick exactly the hero that can counter the enemy and play exactly a perfect meta game for your hero (e.g., go to jungle until you are fat, time creep spawns to stack, and so on). You know basically exactly at which time you will be able to buy which item and you execute this. You no longer play the game, you just play the meta game. You execute a well-thought-out choreography, which you perfected by executing it 100 or more times. Eventually this gets boring!

Anno XXXX:
In the beginning, you build an island and have to master more and more challenges to keep you citizens happy. Cool! Once you know the meta game the whole game becomes a "Oh, I need these 10 resources in these proportions, then the people are happy. I build a fleet and capture the enemy or keep on playing until my island is full".

Cities: Skylines (or any Sim City):
In the beginning, it is fun to master what your people need. In the end, you know exactly what they need, so it becomes more or less a burden: E.g., for each new residential district, I need a police station, a fire station, garbage incineration plant, crematory, a hospital, I connect everything to the highway, add a subway station and add bus lines. Done. Lame. It starts feeling totally mechanic. I no longer feel like building a real city. I feel like building a mathematically simulation of a city and just responding to optimize all parameters for this simulation.

Civilizations:
A super nice game to explore in the beginning! So many technologies, just wow! In the end: I know exactly which technology to develop when. I have a more or less complete ordering among the technologies. I know where exactly to place the next city and which units to build. Heck, I think I could even write an AI that does more than 95% of the things I do, since everything has become so mechanic.

I could go on forever. Almost all games have this. For some players, this is where the game gets really cool. Some players want to play the meta game! But for others, including me, it gets boring. I want to feel like playing a game, like exploring. Not optimizing a numerical simulation.

So, when designing a game, how can you avoid that this will happen? Is it possible to hide the meta game to such an extent that the player no longer feels it, even when playing the game for long.

sentences:
Click to move interaction with UI In my game I have a simple click to move character. On GetMouseButtonDown(0) (when mouse is clicked) I want the character to move to the location of the click, as long as the click does not occur on a UI element.

That's simple enough, I can use if(Input.GetMouseButtonDown(0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())

However, in every GetMouseButton(0) case except when mouse is initially clicked (when mouse button is held down), I want to be able to move even if my mouse is positioned behind a UI element.

So let's say I have an inventory open. I do not want clicking on the inventory to move my character. But if I click somewhere else and begin to move my character, and then move my mouse cursor behind the inventory, I want the character to continue moving. That is why I can't just do if(Input.GetMouseButton(0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()).

I also can't do if(Input.GetMouseButtonDown(0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()) || !Input.GetMouseButtonDown(0) && Input.GetMouseButton(0))

Using a counter to measure elapsed time and then doing something like if(Input.GetMouseButton(0) && timer > 0.2f) doesn't seem to solve the problem either because I never want to move if the click origin is on a UI object, despite how much time has elapsed.

sentences:
Compute cone angle (cos) given side and hypotenuse vectors at time 0 and world matrix at time 1 I need a formula for the cosine of a cone, given normalized side vector, normalized hypotenuse vector at time 0 and world matrix at time 1. This is needed to implement custom spotlights in a level editor which can be tweaked by user via standard translation/rotation/scale gizmo.

The cosine of the cone at time 0 (when world matrix is Identity) can be computed via this formula:

Vector3.Dot(side, hypotenuse);

I tried this formula for time 1:

Vector3.Dot(Vector3.Normalize(Vector3.Transform(side, matrix)), Vector3.Normalize(Vector3.Transform(hypotenuse, matrix)));

but it does not work.

sentences:
Rotate directly towards a target at a constant speed I've written a program (see on JS Fiddle) that rotates my player towards the mouse cursor at a constant speed. I've computed the angle to the point using the Math.atan2 function, but when incrementing or decrementing the player's rotation towards that value, it does not always take the shortest path.

This image describes the logic I intend to evaluate:

The problem appears when you cross a specific angle, the player rotates the long way around to reach the cursor, instead of taking the shortest path. How can I always take the shortest path at a constant speed?

Many thanks.

sentences:
Quaternion.Lerp does not actually rotate object when called inside an "if" clause Let's say I have a RotatableObject class, which inherits from MonoBehaviour. Here is its Start() method:

private void Start() {
    this.startingLocalRotation = this.transform.localRotation;
    this.finalLocalRotation = Quaternion.Euler(this.startingLocalRotation.eulerAngles.x, -150f, this.startingLocalRotation.eulerAngles.z);

    // Initialize other private fields
}

It has a method called Rotate(), defined as follows:

private void Rotate() {
    this.transform.localRotation = Quaternion.Lerp(this.startingLocalRotation, this.finalLocalRotation, 0.2f);
}

Given the following Update() method, the object rotates as expected:

private void Update() {
    this.Rotate();
}

However, if I make the following changes to Update(), then the object does not actually rotate, even though the Rotate() method is hit:

private void Update() {
    if (this.SomeCondition) {
        this.Rotate();
    }
}

this.SomeCondition always has the value true over multiple frames.

What is my mistake, and how can I fix it?

EDIT:

In response to this comment:

  When you say "the object rotates as expected" do you mean that the
  object rotates from starting angles until final angles and then stops
  rotating (without the if) ?

Yes.

  could you provide some more details about what SomeCondition is?

this.SomeCondition is determined by the state of another object, say, Puppy. E.g. if puppyInstance.Mood == Mood.Happy, then this.SomeCondition is true.

  Did you try replacing the condition with the word true

No, I have not tried that. However, when stepping through the call stack in debug mode, I can see that this.SomeCondition is true and Rotate() is called -- I managed to step into the Rotate() method itself.

EDIT:

I tried the first approach described in this answer. However, it did not produce the effects that I was aiming for.

I set a breakpoint here:

transform.localRotation = Quaternion.Lerp(
   startingLocalRotation,
   finalLocalRotation,
   _rotationProgress
);

Every single time the breakpoint was hit in the Update() call, I could see that the value of _rotationProgress was steadily increasing. However, the value of transform.localRotation never actually changed -- it was always (-0.7, 0.7, 0.0, 0.0).

If I updated transform.localRotation outside of an if clause, however, that game object rotates as expected -- transform.localRotation gets updated as _rotationProgress gets updated.

EDIT:

Never mind, I am an idiot. The problem lies elsewhere in the code. The suggested approach works and I have accepted it as the answer.

sentences:
PlayerCenteredScores in LeaderBoards Games.Leaderboards.loadPlayerCenteredScores(mGoogleApiClient,leaderboardId, LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC, 5).setResultCallback(new ResultCallback<Leaderboards.LoadScoresResult>()
{
    public void onResult(Leaderboards.LoadScoresResult arg0) {
    // TODO Auto-generated method stub

       int size = arg0.getScores().getCount();
        Log.e("ACHGOD", "SIZE="+Integer.toString(size));

        for (int i = 0; i < 3; i++) {
            LeaderboardScore lbs = arg0.getScores().get(i);
            // String name = lbs.getScoreHolderDisplayName();
            String score = lbs.getDisplayScore();
            Log.e("ACHGOD", "SCORE="+score);
            //Uri urlimage = lbs.getScoreHolderHiResImageUri();
        }
        // arg0.getScores().close();
        arg0.getScores().release();
    }
});

I am getting the integer score value here. But, I could not find any proper documentation regarding the score value, which I get.

Is it the high score? Or, is it the last submitted score? I am looking to get the highest score made by the currently logged-in user from the leaderboard.

Thanks in advance.

sentences:
How can I handle rendering on multiple monitors with differing refresh rates? What's the best way to deal with a situation that may arise, where a user has two or more monitors with different resolutions and vertical sync intervals?

This would apply when a game has a fixed timestep, and is running in windowed mode: if one monitor has a frame rate of 60.056, and the other has a frame rate of 59.94, vertical sync will ultimately fail to do its job, if the game window is moved from the primary screen to another.

Temporal aliasing will also occur, as the timestep is not properly attuned to the other sync rate. How do games typically deal with this issue, if at all?

sentences:
What does ddx (hlsl) actually do? I'm a bit confused.  The official documentation (http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588(v=vs.85).aspx) says that ddx(input) is the partial derivative of the input with respect to the "screen-space x-coordinate."

My calculus is fine, but how can it tell what the input is coming from?  If I passed it a function, fine, I can imagine what it would do, but the derivative of a number is always zero...?

Is it just a scaling?  Like, this would get scaled to one tenth of its size at this distance, so it returns one tenth?  But then it doesn't need an input...

Can someone give a quick explanation of what's actually happening?

sentences:
SDL 2.0 OpenGL not drawing anything except background My 'hello triangle' compiles well, no errors, but doesn't drawing anything. Here's my code:

main.cpp

#include "src/App.h"

int main( int argc, char* args[] )
{
    App app(600, 400, false);
    app.Run();
    return 0;
}

App.h

#ifndef APP_H
#define APP_H

#include <SDL.h>

class App
{
public:
    explicit App(size_t win_width, size_t win_height, bool fullscreen_mode)
            : m_window_width(win_width), m_window_height(win_height),
            m_fullscreen(fullscreen_mode) {
        };

     void Run();

private:
    void Draw();
    void Update(double dt);
    void Resize(size_t width, size_t height);
    void ProcessEvents();

private:
    size_t m_window_width;
    size_t m_window_height;
    bool m_fullscreen;
    bool is_done;
    SDL_Window* m_window;
    SDL_GLContext m_glcontext;
};

#endif // APP_H

App.cpp

#include "../App.h"
#include <SDL_opengl.h>
#include <cassert>

void App::Run()
{
    SDL_Init(SDL_INIT_VIDEO);
    m_window = SDL_CreateWindow("Okno gry",
                                SDL_WINDOWPOS_CENTERED,
                                SDL_WINDOWPOS_CENTERED,
                                m_window_width, m_window_height,
                                SDL_WINDOW_OPENGL | (m_fullscreen?SDL_WINDOW_FULLSCREEN:SDL_WINDOW_RESIZABLE));

    m_glcontext = SDL_GL_CreateContext(m_window);
    Resize(m_window_width, m_window_height);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);

    glClearColor(0, 0, 1, 0);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_EQUAL);

    is_done = false;
    size_t last_ticks = SDL_GetTicks();
    while(!is_done)
    {
        ProcessEvents();

        size_t ticks = SDL_GetTicks();
        double delta_time = (ticks - last_ticks) / 1000;
        last_ticks = ticks;

        if (delta_time > 0 )
        {
            Update(delta_time);
        }

        Draw();
    }
    SDL_Quit();
}

void App::Draw()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();
    glBegin(GL_TRIANGLES);
    {
        glColor3f(1, 1, 0);
        glVertex2f(1, 1);
        glVertex2f(0, 1);
        glVertex2f(0, 0);
    }
    glEnd();
    SDL_GL_SwapWindow(m_window);
}

void App::ProcessEvents()
{
    if (is_done) return;

    SDL_Event event;
    while (SDL_PollEvent(&event))
    {
        if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
        {
            Resize(event.window.data1, event.window.data2);
        }
        else if (event.type == SDL_QUIT)
        {
            is_done = true;
            break;
        }
    }
}

void App::Resize(size_t width, size_t height)
{
    m_window_width = width;
    m_window_height = height;

    glViewport(0, 0, static_cast<int>(width), static_cast<int>(height));
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    glOrtho(0, 1, 0, 1, -1, 10);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}

void App::Update(double dt)
{
    //printf("%d", dt);
}

Can anyone help? I don't know why it's not running.

sentences:
DirectX shader - how to spread raytracer computation over multiple frames? I'm playing around making a shadertoy style SDF raytracer in HLSL and to make it run faster on high resolutions (1080p and up) I'd like to spread the computation over multiple frames.

Right now I have a fragment shader that does raytracing for every pixel of a screen sized quad. I've noticed that if I discard (clip()) the fragment for every second pixel, I get 0 framerate improvement despite effectively only rendering half the image. But if I lower the render texture resolution to half, I see improvement obviously. Also if I clip a contiguous half of the fragment and render the other half, I get a similar performance boost.

This must mean that the gpu thread groups are by default allocated in a tiled fashion on the screen, and that all threads of a group must be done computing before the (other) resources of the thread group can be used again.

Does anyone know of any magic that can force a fragment shader to only allocate resources for say half the pixels of the screen? (but keep the render target size)

Alternatively I suppose I could assign my own thread groups in a Compute shader system where I manage all this stuff myself. Is that the only way to do it? And how would I handle the render target then? (know any resources?)

I'm also pretty sure I've seen people make this kind of grainy multi-frame raytracers years ago before compute shaders were a thing.

sentences:
How to move my character by itself but I can still move its direction or where it is going, using Mobile Joystick? So, I am making a 2D airplane game right now and I wanted to know how to move my player automatically but I can still control where it should go or the direction. How do I code this using Mobile joystick?

CODE:

public float moveSpeed;

Rigidbody2D myBody;

protected Joystick joystick;

void Start()
{
    myBody = GetComponent<Rigidbody2D>();
    joystick = FindObjectOfType<Joystick>();
}

// Update is called once per frame

void Update()
{
    myBody.velocity = new Vector2( joystick.Horizontal * moveSpeed, joystick.Vertical * moveSpeed );
}

sentences:
I need my timer to go up every 30 seconds I wrote code for a jackpot to increase from one date to the next, and it works beautifully. The client wants the numbers to stay put for a while, and then increase.

This is the code:

if (timerRunning1)
{
    timerValue1 += Time.deltaTime * 14.4 * (timerValue1F - timerValue1)
                / (finish1 - start).TotalSeconds;

    Jack1.text = timerValue1.ToString ("F2");

    //PlayerPrefs.SetFloat ("Jackpot1", float.Parse(Jackpot1.text));
    //PlayerPrefs.SetFloat ("Jackpot1f", float.Parse(Jackpot1F.text));

    if (timerValue1 > (timerValue1F - 0.1))
    {
        timerRunning1 = false;
        print ("ALTO");

        PagPrincipal.SetActive (false);
        Victoria.SetActive (true);

        Debug.Log ("FUNCIONA!!!");

        Invoke ("apagavictoria", 10f);

    }
}

I tried WaitForSeconds(30f), and it didn't work. How can I make my timer go up every 30 seconds?

sentences:
How to only allow one space in an InputField? I've been messing with this for a while now and I can't get this to work 100%. I'm using an InputField for players to enter a character name, and I want to allow a first and last name. Here's how I've been trying this:

private void CharNameRestrictions() {
    Debug.Log(spaceCount);

    if (Input.GetKeyUp(KeyCode.Space)) {
        spaceCount++;
        if (spaceCount > 1) {
            spaceCount = 1;
            playerNameInput.text = playerNameInput.text.Remove(playerNameInput.text.Length - 1);
        }
    }

    if (!(playerNameInput.text.Contains(" "))) spaceCount = 0;
    if (playerNameInput.text.Length > 15) playerNameInput.text = playerNameInput.text.Remove(playerNameInput.text.Length - 1);

}

This sort of works, but if you press and hold space while typing another character, it still lets you add additional spaces. Is there a way to simply ignore the space keycode when there is already a space in the field?

sentences:
Why do games have consumables? Thinking along the lines of this question, and the too awesome to use trope in general.  Why do game designers want to include consumable items in their games?

Mortal Kombat 11 got me thinking...  Why include consumables that give you an edge in battle at all?

I’m looking for concrete answers for what it is that consumables add to gameplay, whether it be about those that one can buy with real money, or those that you just get by playing the game, or whether they are available in limited or unlimited quantities.

sentences:
What's the best way of transforming a 2D vector into the closest 8-way compass direction? If you have a 2D vector expressed as x and y, what's a good way of transforming that into the closest compass direction?

e.g.

x:+1,  y:+1 => NE
x:0,   y:+3 => N
x:+10, y:-2 => E   // closest compass direction

sentences:
How to create a repeating gif style imagery for a game tutorial dialog I want to create a gif style video that shows up in a tutorial window using Unity. How can I make this? Do I record the thing I want to show and then put it in a texture?

Example:

sentences: Field of view settings for first person shooter Are there any industry standards for setting the field of view (FOV) for FPS games or is it solely based on trial and error? Are there any guidelines for choosing the correct value?

sentences:
LibGDX Box2dlights - Body Shadow Problem While playing around with the box2dlights with libGDX, I have managed to get it all up and running, but have a problem with the shadow rendering.

This is what I currently have atm:

With the lighting on:

With the lighting off:

What I want is to have the shadow be rendered so that the body is visible when the light is shone upon it, so that the platform is visible.

Here's some of my code that I use to create and render my lighting:

    // world lighting creation
    rayHandler = new RayHandler(physicsWorld, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    rayHandler.setBlurNum(0);
    rayHandler.setBlur(false);
    rayHandler.setAmbientLight(.05f);

    // world lighting rendering
    rayHandler.setCombinedMatrix(cameraWorld.combined.scale(PIXELS_TO_METERS / SCALE_TO_SIZE, PIXELS_TO_METERS / SCALE_TO_SIZE, 0),
            cameraWorld.position.x / PIXELS_TO_METERS * SCALE_TO_SIZE, cameraWorld.position.y / PIXELS_TO_METERS * SCALE_TO_SIZE,
            cameraWorld.viewportWidth, cameraWorld.viewportHeight);
    rayHandler.updateAndRender();

    // player torch light creation
    torchLight = new ConeLight(rayHandler, 50, Color.WHITE, 50 / SCALE_TO_SIZE, x / SCALE_TO_SIZE, y / SCALE_TO_SIZE, angle, 35);
    torchLight.setStaticLight(false);
    torchLight.setSoft(false);

Any thoughts?

sentences:
XNA `tex2Dlod` always returns transparent black I want to sample a texture in a vertex shader, so at first I just tried using

float2 texcoords = ...;
color = tex2D(texture, texcoords);

But apparently I cannot use tex2D in a vertex shader, and must use tex2Dlod. So then I changed the above code to

color = tex2Dlod(texture, float4(texcoords, 0, 0));

But now color is always float4(0, 0, 0, 0) (i.e. transparent black).

Why is this, and how can I fix it?

EDIT: I know for a fact that the texture does not contain just transparent black pixels.

sentences:
How to make character gain acceleration? I want to create more realistic physics for my 2D games.

Currently, the character and the other game objects in my games start moving instantly (achieve maximum speed instantly) and stop instantly (achieve 0 speed instantly).

There is no transition between speed levels - resting and moving, moving and resting.

I heard about 'steering behaviors', but am pretty sure they're mostly for designing AI agents' movements.

Should I learn steering behaviors to make more realistic character movements in general? (In the physics-aspect). Is this the way to go?

If the answer is 'yes', could you recommend a good source to learn them?

sentences:
Better way to generate enemies of different sub-classes So lets pretend I have an enemy class that has some generic implementation and inheriting from it I have all the specific enemies of my game.  There are points in my code that I need to check whether an enemy is a specific type, but in Java I have found no easier way than this monstrosity...

//Must be a better way to do this
if ( enemy.class.isAssignableFrom(Ninja.class) ) { ... }

My partner on the project saw these and changed them to use an enum system instead

public class Ninja extends Enemy {
    //EnemyType is an enum containing all our enemy types
    public EnemyType = EnemyTypes.NINJA;
}

if (enemy.EnemyType = EnemyTypes.NINJA) { ... }

I also have found no way to generate enemies on varying probabilities besides this

for (EnemyTypes types : enemyTypes) {
    if ( (randomNext = (randomNext - types.getFrequency())) < 0 ) {
        enemy = createEnemy(types.getEnemyType());
        break;
    }
}

private static Enemy createEnemy(EnemyType type) {
    switch (type) {
        case NINJA:
            return new Ninja(new Vector2D(rand.nextInt(getScreenWidth()), 0), determineSpeed());
        case GORILLA:
            return new Gorilla(new Vector2D(rand.nextInt(getScreenWidth()), 0), determineSpeed());
        case TREX:
            return new TRex(new Vector2D(rand.nextInt(getScreenWidth()), 0), determineSpeed());
     //etc
    }
return null
}

I know java is a little weak at dynamic object creation, but is there a better way to implement this in a way such like this

for (EnemyTypes types : enemyTypes) {
    if ( (randomNext = (randomNext - types.getFrequency())) < 0 ) {
        //Change enemyTypes to hold the classes of the enemies I can spawn
        enemy = types.getEnemyType().class.newInstance()
        break;
    }
}

Is the above possible?  How would I declare enemyTypes to hold the classes if so?  Everything I have tried so far as generated compile errors and general frustration, but I figured I might ask here before I completely give up to the huge mass that is the createEveryEnemy() method.  All the enemies do inherit from the Enemy class (which is what the enemy variable is declared as).  Also is there a better way to check which type a particular enemy that is shorter than enemy.class.isAssignableFrom(Ninja.class)?

I'd like to ditch the enums entirely if possible, since they seem repetitive when the class name itself holds that information.

sentences:
How to design a useful scripting system? I have decided to use the Squirrel (probably doesn't matter much for this question) scripting language in my C++ project. I'm wondering how game developers usually handle scripting in their games. I've managed to run scripts, bind functions etc. - that is not the problem. I'm just not sure how a scripting system is actually implemented in a sensible way.

So far I have got a singleton ScriptManager, which owns a virtual machine and can interact with it.

Some specific questions:

Does every functionality, that you want to control with scripts, need to be bound manually or can you somehow make all functions/classes available to your scripts? (I do not intend to use scripting everywhere in the final game, but it would make the development  process a whole lot easier.)
How should squirrel scripts be structured? Should they represent some kind of library, that you load, or just a set of commands that get executed whenever a game object wants to? If the former approach is better, how would such a library look like and how would the execution of the script be triggered?

I would be great if you could point me into the right direction!
Thanks!

sentences:
How can I remove enemies from my ArrayList after they have died? Possible Duplicate:
  How do I best remove an entity from my game loop when it is dead?

Right now, I have an ArrayList like this:

List<Enemy> enemies = new ArrayList<Enemy>();

When an enemy dies, how can I remove it? Should I use a different type of list, array, or set?

sentences:
unity android output is about 120mb even with just an empty scene there is a lot of content in my project but as a test I just chose a empty scene with one sprite to build but the apk output size is about 120mb.

I think there is an options or setting or platform support that makes it much big but I don't know what it is.

thank you for helping

sentences: Reverse Movie in Unity 5 guys! Is it possible to reverse video or apply a rewind in Unity 5? I searched in the web but could not find the solution.

sentences:
Where to start for implementing vehicle physics? A little background for myself. I am relatively experienced with 3rd part physics engines such as Havok, Box2D, Bullet and have successfully integrated them in custom engine(s). I have also made a simple physics engine by following a few known books.

Now I am interested in diving into vehicle physics. There are a couple of books that skim over the topic but do not go over in enough detail for me to grasp anything useful. So I would like to know of good books/resources that are not too heavy (by that I mean a book that is pure vehicles and made for engineers rather than game developers) that help me get started on vehicle physics. Here get started = at least guide me through creating a simple vehicle in 3D with modern features found in most games (suspension/transmission etc.)

Note: I searched for a similar question but did not find one, but if one exists, please post the link and feel free to close the question.

sentences:
Additional dependencies in XNA/Monogame I made a game in monogame recently, using the XNA content pipleline. I then sent the whole folder (The release folder in visual studio) to a friend of mine who does not have visual studio or monogame. He said he can't open the game. What the are files I need to give my friend for him to be able to play it?

He has Windows 8

sentences:
How do I create user-friendly, unique game IDs? How do I create unique game IDs which are also user friendly -- so that one user can easily give that game ID to someone else for joining the game.

I am creating my game in Silverlight with C#.

sentences:
Flexible Controller Support I am developing a platformer in Pygame with the eventual hope of releasing it on Steam.

I am currently trying to add input support for multiple controllers.

To do this, I am using the Pygame joystick module, which allows a connected controller to send input events to my event queue (the event types are JOYBUTTONDOWN, JOYBUTTONUP, and JOYAXISMOTION).

I want to have input support for at least keyboards, Xbox 360 controllers, Xbox One controllers, and PS4 controllers.

The problem, of course, is that these controllers all use different button IDs.

One way I thought of getting around this was to call a function in my event processing code which could convert input from any of these devices to a more abstract event tag. For example, keyboard presses of "a", Xbox 360 controller presses of left on the D-pad, and negative motion on the seventh axis of a PS4 controller would all set an abstract "mapped_event" attribute to "left". I could then use this "mapped_event" attribute in my player sprite's process_event() method, which moves him based on event input.

Here's a sketch of how that conversion code would look:

def map_event(event):

    # KEYBOARD BUTTON PRESSES

    if event.type == pg.KEYDOWN:
        if event.key = K_RIGHT:
            mapped_event = "right"
        elif event.key == K_LEFT:
            mapped_event = "left"

    # CONTROLLER BUTTON PRESSES

    elif event.type == pg.JOYBUTTONDOWN:

        if joystick == "Xbox360 controller":
            if event.button == 3:
                mapped_event = "right"
            elif event.button == 2:
                mapped_event = "left"

    # CONTROLLER AXIS MOTION

    elif event.type == pg.JOYAXISMOTION:

        if joystick == "Xbox360 controller":
            if event.axis == 1:
                if event.value == 1:
                    mapped_event = "left"
                elif event.value == -1:
                    mapped_event = "right"

        elif joystick == "PS4 controller":
            if event.axis == 3:
                if event.value == 1:
                    mapped_event = "left"
                elif event.value == -1:
                    mapped_event = "right"

    return mapped_event

From what I can tell, this is the way a lot of people recommend getting around the inconsistent controller issue. For example, I think this is what is meant when people speak about an "intermediate layer" of input processing and "mapping from real buttons to game concepts". Please correct me if I'm interpretting this wrong.

My question is:

How can I extend this method, (or an alternative), to also support all controllers which use, say, XInput/DirectX (according to this answer, a lot of aftermarket controllers use these), while handling multiple OSes?

I am open to using a different framework for processing joystick events, provided the language is Python.

Related Questions

How can one impliment multiple control schemes for a single player?

Correct way to abstract an XBox Controller

Unity3D Joystick Buttons Xbox360 & PS3 have Inconsistent Button Inputs?

sentences:
How to draw HUD in DirectX12? I would like to draw reference frame to see how my camera moves around scene. I want these arrows to always be on the top of other geometry. How can I achieve it?

I think I need to disable depth test for this draw calls. Should I use just another PSO with changed DepthStencilState?

EDIT: Well, it works for me like that.

// opaquePsoDesc defined somewhere above
D3D12_GRAPHICS_PIPELINE_STATE_DESC opaqueHudPsoDesc = opaquePsoDesc;
opaqueHudPsoDesc.DepthStencilState.DepthEnable = false;
THROW_IF_FAILED(g_device->CreateGraphicsPipelineState(&opaqueHudPsoDesc, IID_PPV_ARGS(&psos_["opaque_HUD"])));

And then before drawing your HUD you can:

commandList->SetPipelineState(psos_["opaque_HUD"].Get());

I'll leave this answer here, in case someone will need it.

Well, that works fine if you don't want depth test for the HUD objects.

sentences:
How can I implement (almost) infinitely large maps in Unreal Engine 4? I'm making a game where a helicopter travels around.

I'd like that the environment around be as realistic as possible. For instance, since the helicopter can travel at speeds up to 200 km/h, I want the player to see very far away, in a realistic fashion.

I'm talking about a map where let's say there is a "real" mountain 50km away and you could "walk" there, as well as the mountain looking like a mountain in game from the any distance (no matter the quality).

How could I manage my map in UE4 that would allow me to implement such a "real" world?

sentences:
Electricity and Magnetism: Relevant? The computer science major at my university requires that I take a sequence in either biology, chemistry, and physics, plus an additional natural science course (which I might fill with meteorology).  Since I'm into game development, physics is the obvious choice.  That, and I go to a big pre-med school; why damage my GPA being weeded out from a path I never wanted to take?

There are two main versions of the physics sequence, both covering the same material; one in three semesters, one in two, which I'm interested in.  The course descriptions (the best info I can get right now) follow;

  PHY 131: Classical Physics I

  First part of a two-semester physics sequence for physical-sciences or
  engineering majors who have a strong mathematics background and are
  ready for a fast learning pace. It covers mechanics, wave motion,
  kinetic theory, and thermodynamics. Calculus is used concurrently with
  its development in MAT 131. Three lecture hours and one recitation
  hour per week. The Laboratory component, PHY 133 (Lab 1), could be
  taken concurrently.

Since that's motion, waves, etc. it's obviously extremely useful, and therefore worthy of my attention.  No question there.  I'm going to take this in Spring of '13.

  PHY 132: Classical Physics II

  Second part of a two-semester physics sequence for physical-sciences
  or engineering majors who have a strong mathematics background and are
  ready for a fast learning pace. It covers electromagnetism, electric
  circuit theory, and optics. Calculus is used concurrently with its
  development in MAT 132. Three lecture hours and one recitation hour
  per week. The Laboratory component, PHY 134, may be taken
  concurrently.

(For reference, the descriptions for the three-semester versions are at this link, because they're a bit more descriptive.)

What I want to know is this; besides the obvious things like possible game design elements, does the material in PHY 132 play any significant role in game physics or similar?  If so, what are some examples?

I ask because if I can skimp on the material, I might take a PHY 132 equivalent online next summer at some community college.  That way I can ease the pressure on myself and free up a slot for something interesting.

At the very least, I might take a PHY 126 (part 2/3) equivalent online so I can take the more relaxed PHY 127 (part 3/3) that fall.  But I'd prefer the former option.

Any tips?

sentences:
Mahjong solitaire - navigating between open tiles I am looking for an algorithm to help me navigate between 'open' tiles in a Mahjong solitaire game. The game is to be played on a limited device with only left-right-up-down buttons and I want to speed up the time it takes to reach the appropriate tile. Toward this goal, I have made the movement work between 'open' tiles (tiles that you could move).

For example, pressing down will find the closest open tile below the one you are on, etc... The problem is that some tiles are really tough to get to. I am sure there are some known algos for this soft of things, but I can't find anything online since searching for 'Mahjong' returns 10 pages of free flash games.

Anyone has any idea?

sentences:
How do I use render targets in XNA? I'm trying to render text (or whatever) off screen. But I have a strange issue where the render target size matches the window size and not the render targets size. Yes, it is a contradiction! Here's the render target:

And here's the code, chopped up and put together to demonstrate what's happening in one place :

UserInterface.SpriteBatch.Begin(SpriteSortMode.Immediate,
                                BlendState.AlphaBlend,
                                SamplerState.PointClamp,
                                DepthStencilState.None,
                                RasterizerState.CullNone);

RenderTarget2D rt = new RenderTarget2D(UserInterface.GraphicsDevice, 200, 200);
UserInterface.GraphicsDevice.SetRenderTarget(rt);

UserInterface.GraphicsDevice.Clear(Color.Blue);

Rectangle rect = new Rectangle(0, 0, 200, 200);
UserInterface.SpriteBatch.Draw(pixel, rect, Color.White);

renderTarget.GraphicsDevice.SetRenderTarget(null);

UserInterface.SpriteBatch.End();

if (frame == 0)
    rt.SaveAsJpeg(File.OpenWrite("renderTarget.jpg"), rt.Width, rt.Height);

The render target is created at 200x200, I then set the render target on the graphics device. I clear it to blue and draw a pixel at 200x200 (in white). Lastly, I save off the render target.

But why does the sprite batch render the pixel in proportion to the window (just take my word that it is rectSize / WindowSize * RTSize) rather than filling the render target which I believe it should do in this case?

sentences:
Unsupported API version on Spigot 1.14 snapshot I'm (trying to) develop a plugin for Spigot Minecraft 1.14.2. I have tried putting both api-version: 1.14.2 and api-version: 1.14.2-R0.1-SNAPSHOT in my plugin.yml file however it always comes up with the following error:

org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.14.2-R0.1-SNAPSHOT
    at org.bukkit.craftbukkit.v1_14_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:252) ~[spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:333) ~[spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:252) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.craftbukkit.v1_14_R1.CraftServer.loadPlugins(CraftServer.java:347) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.craftbukkit.v1_14_R1.CraftServer.reload(CraftServer.java:803) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.Bukkit.reload(Bukkit.java:576) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.craftbukkit.v1_14_R1.CraftServer.dispatchCommand(CraftServer.java:707) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at org.bukkit.craftbukkit.v1_14_R1.CraftServer.dispatchServerCommand(CraftServer.java:692) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at net.minecraft.server.v1_14_R1.DedicatedServer.handleCommandQueue(DedicatedServer.java:433) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at net.minecraft.server.v1_14_R1.DedicatedServer.b(DedicatedServer.java:397) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at net.minecraft.server.v1_14_R1.MinecraftServer.a(MinecraftServer.java:956) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:801) [spigot-1.14.2.jar:git-Spigot-df0eb25-649921e]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]

however I am using the correct API version. Whenever I change the api-version in plugin.yml the error message changes accordingly.

What have I done wrong?

EDIT: https://termbin.com/u5a8 - full server log
plugin.yml:

name: choruschaos
main: com.cospox.choruschaos.main
version: 0.1
api-version: 1.14.2-R0.1-SNAPSHOT
commands:

main.java:

package com.cospox.choruschaos;

import org.bukkit.plugin.java.JavaPlugin;

public class main extends JavaPlugin {
    // Fired when plugin is first enabled
    @Override
    public void onEnable() {
    }
    // Fired when plugin is disabled
    @Override
    public void onDisable() {

    }
}

sentences:
World texturing techniques in FPS game Texturing for small objects (pickups and enimies) can easily be done UV-unwrapping the model, and use a texture of reasonable size to make the model look good. But how can texturing be done for the world? Covering a large building with one texture would require a huge texture (otherwise it will look blurry), and a lot of it will be repeated (brickwall textures, wallpapers ...), so that approach seems inefficient. Assigning different textures to different faces may be slow, since there cannot be a texture switch within the draw call.

I am targeting OpenGL 4 or later. I prefer good looking stuff rather than extremely high framerate: I aim for 30 fps, but perhaps with motion blur (which I guess requires four times that).

About tiling:

Tiling would work, but then there are some parts of the mesh which requires some other texture. And then I need to switch texture.

sentences:
Godot: How to get mouse button input for a Tilemap for Cellular Automata Conway's Game of Life
I have been working with a tilemap for the implementation of a cellular automata game. My current method for getting mouse button input is using an Area2D as a child of the Tilemap and detecting mouse button input like that.
I have done this and have since been wondering if there is something built in that I can use for this. I have looked into it and cannot find anything better.
Is there something built-in to Node2Ds or Canvas Items that I can use.

sentences:
Problems with Rotation Matrices on Certain Axes Here is what my rotation matrix looks like:

public Matrix4f initRotation(float x, float y, float z)
{
    Matrix4f rx = new Matrix4f();
    Matrix4f ry = new Matrix4f();
    Matrix4f rz = new Matrix4f();

    x = (float)Math.toRadians(x);
    y = (float)Math.toRadians(y);
    z = (float)Math.toRadians(z);

    rz.m[0][0] = (float)Math.cos(z);rz.m[0][1] = -(float)Math.sin(z);rz.m[0][2] = 0;                rz.m[0][3] = 0;
    rz.m[1][0] = (float)Math.sin(z);rz.m[1][1] = (float)Math.cos(z);rz.m[1][2] = 0;                 rz.m[1][3] = 0;
    rz.m[2][0] = 0;                 rz.m[2][1] = 0;                 rz.m[2][2] = 1;                 rz.m[2][3] = 0;
    rz.m[3][0] = 0;                 rz.m[3][1] = 0;                 rz.m[3][2] = 0;                 rz.m[3][3] = 1;

    rx.m[0][0] = 1;                 rx.m[0][1] = 0;                 rx.m[0][2] = 0;                 rx.m[0][3] = 0;
    rx.m[1][0] = 0;                 rx.m[1][1] = (float)Math.cos(x);rx.m[1][2] = -(float)Math.sin(x);rx.m[1][3] = 0;
    rx.m[2][0] = 0;                 rx.m[2][1] = (float)Math.sin(x);rx.m[2][2] = (float)Math.cos(x);rx.m[2][3] = 0;
    rx.m[3][0] = 0;                 rx.m[3][1] = 0;                 rx.m[3][2] = 0;                 rx.m[3][3] = 1;

    ry.m[0][0] = (float)Math.cos(y);ry.m[0][1] = 0;                 ry.m[0][2] = -(float)Math.sin(y);ry.m[0][3] = 0;
    ry.m[1][0] = 0;                 ry.m[1][1] = 1;                 ry.m[1][2] = 0;                 ry.m[1][3] = 0;
    ry.m[2][0] = (float)Math.sin(y);ry.m[2][1] = 0;                 ry.m[2][2] = (float)Math.cos(y);ry.m[2][3] = 0;
    ry.m[3][0] = 0;                 ry.m[3][1] = 0;                 ry.m[3][2] = 0;                 ry.m[3][3] = 1;

    m = rz.mult(ry.mult(rx)).getM();

    return this;
}

And here is how I've been implementing it for tests (using default orthographic perspective):

public class Renderer {

private WorldMesh mesh;
private Mesh _mesh;

private Matrix4f transform;

private Shader shader;

public Renderer(){

//Setup Meshes

    mesh = new WorldMesh();

    _mesh = ResLoader.loadMesh("pyramid.obj");

    mesh.addToBuffers(_mesh);

//setup Shader

    shader = new Shader();

    shader.addVertexShader(ResLoader.loadShader("basicVertex.vs"));
    shader.addFragmentShader(ResLoader.loadShader("basicFragment.fs"));
    shader.compileShader();

    shader.addUniform("transformation");

//temporary transformation matrix

    Matrix4f tran = new Matrix4f().initTranslation(0, 0, 0);
    Matrix4f rot = new Matrix4f().initRotation(0, 0, 0);     //problem is definitely with the rotation matrix;
    Matrix4f scale = new Matrix4f().initScale(1, 1, 1);

    transform = tran.mult(rot.mult(scale));

}

public void update(){}

public void render(){

    RenderUtils.clearScreen();

    shader.setUniform("transformation", transform);

    shader.bind();

    mesh.draw(true);
}

}

and finally here is my vertex shader:

#version 330

layout (location = 0) in vec3 position;

uniform mat4 transformation;

void main(){

    gl_Position = transformation * vec4(position, 1.0);
}

The problem is that setting a rotation on any other axis other than Z (for some reason z axis rotation is working fine) does not function properly. An X axis rotation seems to be doing both an x and y rotation at the same time, causing a weird stretching affect. A Y axis rotation causes the mesh to completely disappear.

The funny thing is that I've used this code over and over again and some projects don't give me a problem.

The order of multiplication seems in order, and I made sure that OpenGL knows to transpose the matrix I give it when setting the uniform.

Any ideas as to what could be causing the x and y axis rotations to completely fail?

sentences:
Smooth seams and banding of overlapping lights in deferred rendering I have finally managed to get on screen multiple lights with a deferred renderer, but the result is somehow disappointing. In particular I have severe banding problem

Other than having clear banding for a single light, the seam of overlapping light volumes are in some case disturbing.

Currently my bounding sphere scale is calculated solving the quadratic equation with a min light intensity of 0.01 and using the attenuation terms of each light source (in the screen above, every light have an equivalent volume).

The attenuation in the shader is simply  1 / (const + linear * dist + quadr * dist * dist) . The position is reconstructed from a 32bit depth buffer and the lighting is in view space.

The light passes are blended together with simply

glEnable(GL_BLEND);
glBlendEquation(GL_FUNC_ADD);
glBlendFunc(GL_ONE,GL_ONE);

Is there a way to fix this issue easily?

Thank you!

sentences:
How to use Monogame Content Pipeline with XML I have an XML file that I'm trying to import into my MonoGame project using the content pipeline.  I'm having trouble getting the MonoGame Pipeline tool to convert the XML file into a .xnb file before I can even run the program.

The XML file is as follows:

<?xml version="1.0" encoding="utf-8"?>
<XnaContent>
  <Asset Type="GameObjects.ObjectInstruction">
    <FrameNames>
      <Item>Image_1</Item>
      <Item>Image_2</Item>
    </FrameNames>
    <FrameSpeed>10</FrameSpeed>
    <HorizontalOrigin>0.5</HorizontalOrigin>
    <VerticalOrigin>0.5</VerticalOrigin>
    <HorizontalScaling>1</HorizontalScaling>
    <VerticalScaling>1</VerticalScaling>
    <HorizontalOffset>0</HorizontalOffset>
    <VerticalOffset>0</VerticalOffset>
    <Subset Null="true" />
    <RotationRadians>0</RotationRadians>
    <Tint>
      255
      <G>255</G>
      <R>255</R>
      255
      <PackedValue>4294967295</PackedValue>
    </Tint>
  </Asset>
</XnaContent>

The GameObjects namespace is in a Visual Studio project that creates a .dll file, and I have another MonoGame project that references GameObjects and is the one in which I'm trying to do all the content stuff.

Inside the Pipeline tool I've got a reference set to the GameObjects.dll file.  This file shows up in several places, and if I pick the wrong one the Pipeline tool fails with the error "Assembly is either corrupt or built using a different target platform than this process. Reference another target architecture (x86, x64, AnyCPU, etc.) of this assembly."

If I change the reference to the .dll file in the GameObjects project folder, the Pipeline tool still fails when trying to process my XML file.  The error message looks like "System.Xml.XmlException: 'Element' is an invalid XmlNodeType. Line 19, position 8."  This part of the XML file would be the G field of the Tint part of the ObjectInstruction object (Tint is a Color).

I've been knocking my head against this problem and getting nowhere.  How do I use the Monogame Pipeline tool with XML files?  How do I get it to recognize the definition of ObjectInstruction and process the XML file into a .xnb file?  I'm pretty sure the rest of my program will run if I can solve this bit.  Thanks for any help.

sentences:
How can I split my entity manager class into a gameworld class and gamerenderer class? I currently have a libGDX game where I have an entity manager class which is called in the gamescreen. Instead, I would like to utilise it in a gameworld class and a gamerenderer class, but I cannot figure out how to split it up (if that makes sense). I want to do this so that I can manipulate my player class separately and not as a part of the entity manager. Previous attempts have failed because taking 'player' away meant that checkCollisions stopped working (hence why I want to use gameworld and gamerenderer classes instead). Does anyone have any ideas on how to achieve this?

Here is my entity manager class:

public class EntityManager {
    private final Array<Entity> entities = new Array<Entity>();
    private final Player player;

    public EntityManager(int amount) {
        player = new Player(new Vector2(110, 15), new Vector2(0, 35));
        for (int i = 0; i < amount; i++) {
            float x = MathUtils.random(0, ManicMeltdowns.WIDTH - TextureManager.DROPS.getWidth());
            float y = MathUtils.random(ManicMeltdowns.HEIGHT, ManicMeltdowns.HEIGHT * 3);
            float speed = 2;
            addEntity(new Drops(new Vector2 (x, y), new Vector2(0, -speed)));
        }
    }

    public void update() {
        for (Entity e : entities)
            e.update();
        player.update();
        checkCollisions();
    }

    public void render(SpriteBatch sb) {
        for (Entity e : entities)
            e.render(sb);
        player.render(sb);
    }

    private void checkCollisions() {
        for (Drops e : getDrops()) {
            if (e.getBounds().overlaps(player.rectangle)) {
                ScreenManager.setScreen(new GameOverScreen());
            }
        }
    }

    public void addEntity(Entity entity) {
        entities.add(entity);
    }

    private Array<Drops> getDrops() {
        Array<Drops> ret = new Array<Drops>();
        for (Entity e : entities)
            if (e instanceof Drops)
                ret.add((Drops)e);
        return ret;
    }
}

Thanks.

sentences:
Mobile game - different actions based on different tap input? I am creating a mobile game in which you can destroy blocks and interact with blocks like in Minecraft.

However, the problem is, in Minecraft you destroy blocks using left mouse button click and interact using right mouse button click, but on mobile I don't have 2 buttons, only 1 - the screen tap.

Of course, I could create a button to toggle between 2 modes, but I am sure there is a more elegant way that would not be so annoying for players.

What are the options?

sentences:
When using deferred rendering technique, what space should my normals be? Why? I'm implementing a deferred shading technique and the following question arose:

When storing the normals, should I transform to view space, or may I keep them in world space? Why?

Will any of the alternatives be better than the other for calculating lighting?

sentences:
How to set ortho projection / model view matrix without a camera? I'm trying to create the correct projection and model view matrix for rendering without a camera.

_orthoCamera is a camera I set up in the scene view. Using the _orthoCamera projection matrix and modelView matrix works but I don't know exactly how to recreate these. My attempt is the commented code.

    //not correct
    //var projection = Matrix4x4.Ortho(-512, 512, -512, 512, 0.3f, 1000);
    //var modelView = Matrix4x4.LookAt(new Vector3(512, 512, -5), new Vector3(512, 512, 0), Vector3.up); //inverse?

    //correct result
    var projection = _orthoCamera.projectionMatrix;
    var modelView = _orthoCamera.worldToCameraMatrix;

    GL.LoadProjectionMatrix(projection);
    GL.modelview = (modelView);

This is how I set the camera up in the scene.

sentences:
Game lags when my player collides with a specific object (solution known, unsure how to implement) I'm developing a game in Android using LibGDX (although this is more of a JAVA problem than an engine problem). My aim is to have my player bounce off one spring onto another that will eventually take him over an obstacle like so:

I have a feeling the lag is because im creating new objects in a method that gets called in update(). This is because I had the same issue with coins in the game until I stopped initialising the Coinobject in a method that gets called by update() - now they work smoothly.

However, I'm not sure how to implement the spring collision without initialising Spring objects. Currently, objects are initialised through a text file - however, Spring is only initialised in a Box object rather than the text file. In my update() method I loop through the objects and if an object is a Box which contains a Spring, the following method is called:

public void playerSpringCollision(Box containsSpring) {
        // first spring (on the box)
        Spring boxSpring = containsSpring.getSpring();
        // second spring (on the platform)
        Spring platformSpring = containsSpring.getPartnerPlatform().getSpring();
        // distance in x between first & second spring
        float dx = platformSpring.getxPos()
                + platformSpring.getSprite().getWidth() - boxSpring.getxPos()
                - player.getSprite().getWidth();
        // distance in y between first & second spring
        float dy = platformSpring.getyPos() - boxSpring.getyPos();
        directionToSpring.x = dx;
        directionToSpring.y = dy;
        // if player collides with first spring
        if (player.getRectangle().overlaps(boxSpring.getRectangle())) {
            player.springImpulse(directionToSpring); // send player to platform spring
        }
        // if player collides with second spring
        if (player.getRectangle().overlaps(platformSpring.getRectangle())) {
            directionToObstacle.x = -directionToSpring.x;
            directionToObstacle.y = directionToSpring.y;
            player.springImpulse(directionToObstacle); // send player over obstacle
        }
}

I'm not sure how to do this without initialising Spring and Vector2 objects in the method - any ideas? Highly grateful for any help, thanks.

sentences:
OpenGL flickerinng near the edges I am trying to simulate particles moving around the scene with OpenCL for computation and OpenGL for rendering with GLUT. There is no OpenCL-OpenGL interop yet, so the drawing is done in the older fixed pipeline way. Whenever circles get close to the edges, they start to flicker. The drawing should draw a part of the circle on the top of the scene and a part on the bottom.

The effect is the following:

The balls you see on the bottom should be one part on the bottom and one part on the top. Wrapping around the scene, so to say, but they constantly flicker.

The code for drawing them is:

void
Scene::drawCircle(GLuint index){
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glTranslatef(pos.at(2*index),pos.at(2*index+1),  0.0f);

    glBegin(GL_TRIANGLE_FAN);
    GLfloat incr = (2.0 * M_PI) / (GLfloat) slices;
    glColor3f(0.8f, 0.255f, 0.26f);
    glVertex2f(0.0f, 0.0f);
    glColor3f(1.0f, 0.0f, 0.0f);
    for(GLint i = 0; i <=slices; ++i){
        GLfloat x = radius * sin((GLfloat) i * incr);
        GLfloat y = radius * cos((GLfloat) i * incr);

        glVertex2f(x, y);
    }
    glEnd();
}

If it helps, this is the reshape method:

 void
 Scene::reshape(GLint width, GLint height){
     if(0 == height) height = 1; //Prevent division by zero

     glViewport(0, 0, width, height);

     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();

     gluOrtho2D(xmin, xmax, ymin, ymax);
     std::cout << xmin << " " << xmax << " " << ymin << " " << ymax << std::endl;
 }

sentences:
Where are the files UnityEngine.dll and UnityEditor.dll located on a Windows filesystem? Visual Studio can't find the UnityX.dll files after I copied my assets folder from one computer to another. Where can I find these .DLLs?

UnityEditor.dll
UnityEditor.iOS.Extensions.XCode.dll
UnityEngine.dll
UnityEngine.UI.dll

sentences:
Unity animations not transitioning properly I am currently trying to animate transitions between four different directions. I have four total animations for walking, and another four for the idle state. I cannot seem to figure out why when I try to transition from a walking state to another walking state in a different direction (not the direction I am idling in) it must wait for the walking animation to finish, and then play the walking animation in the new direction.

You can see my sprite begin to walk forward, and then when I attempt to turn south the animation it continually plays the north animation until the animation is finished. What I am trying to achieve is a smooth transition that switches immediately.

I know very little about animating and much more about programming. My list of attempted solutions is very short, and limited to only changing the length of each animation.

sentences:
LightMap not working properly I've made a chips bag model for my game:

http://imgur.com/JcumRF4

And I textured it like this:

http://imgur.com/wpyeACZ

and I googled on how to make lightmaps all of them say "Smart UV project" but when I do that, texture on my model gets broken, so thats why I dont want to use smart uv project

Is there another way?, it has to be.

sentences:
How to get neigbor pixel coordinates in Unity HLSL shader I am writing Mandelbrot set shader for Unity.
I wrote an Image Effect shader and it works.
Unfortunately, each point "shimmers" on translate scale. This is because, for each shader call I compute value for only one mathematical point, which is infinitesimal. On even small translation, the value can change drastically.
So, I would like to compute math value not for one point, but for several. But for this I need to know, which aother points belong to my pixel, and for this I need to know the distance to neighbor pixel. Unfortunately, my incoming values are float and I don't know, how to step to next pixel.
How to accomplish?

sentences: How Would I Design Realistic Fluid Handling? I'm making a game that is like a mix of many other games (Minecraft, Factorio, Don't Starve, Terraria, etc). I want to make pipes and fluid handling like it works in Factorio. I can't seem to find much information on it. I thought about making fluid even out across all connect pipes with less fluid than this pipe, but the order in which I processed pipes would matter a lot. So, how exactly does Factorio work? I also want pumps, if that changes anything.

sentences:
Applying a getButtonDown & getButtonUp on a GUI button for touch input I have a GUI interface with a button for the character's attack, however I want to implement a defense button where the user can hold the button down to block incoming attacks, when the user stops touching the button then the player goes back to idle.

Right now I have the attack button working correctly, whenever the button gets pressed, it triggers a method where the animator gets called and performs the action. I want to implement the getButtonDown("") and getButtonUp("") used commonly with the keyboard input. How can i implement such fucntions to a GUI button?

sentences:
Mini Game Platform for PC - similar to Warcraft III Custom Games I think it would be fun to make a game for pc that has an online community like Warcraft III (the RTS, not the MMORPG), aka there's lobbies and chat rooms and users can host games to play with eachother. And there's no seriousness, just fun mini games that last on average 30-60 minutes, more or less depending on the game.

I searched google but it's really hard to find anything. Is there anything similar to this idea that's already out there? Or is this a first?

Also, in making this, any recommendations, flaming, or random comments? (yes I know it is hard to make an online game and such, especially since I have no experience with networking. I do have 2-3 years of programming experience, however).

Some more info on what I want to create.

I want it to be easy for users to create games and play with friends. All of us game creators have ideas, and we probably draw them out on paper (graph paper for me). Wouldn't it be amazing if it was a matter of a couple hours to transfer that idea to a fully working game, even if it is in 3d?

sentences:
Normal map causing certain faces to get shaded I added a normal map to a MR arch & design material in Max 2012. I have a specular in the reflection color slot and a diffuse in the diffuse slot. As i increase the intensity of the normal map i certain faces get darker and they get really "obvious". Last time i was fiddling with this the exact same thing happened which made me quit normal maps and all. Some UV's are overlapping and the normal map is made with the Nvidia photoshop plugin. My scene just has a daylight system with a MR sun and MR sky.

Does anyone have an idea what is causing this?

As you can see the face gets shadowed as a whole. The face next to it has the same problem on the opposite corner you see the same effect but much less hard.

sentences:
Texture animation/coordinates in VBOs Situation

I've got a large map divided into 16*16 parts (comparable to Minecraft) for x and z. For every part a VBO is generated and stored using GL_STATIC_DRAW.

Problem

The technique described above works fine and with good performance, however it restricts (due to the nature of GL_STATIC_DRAW) modifications that may happen frequently, especially texture animations (that is incrementing texture coordinates to select another sub rectangle in the texture).

Now I'm asking myself how to solve that problem. Switching to GL_DYNAMIC_DRAW seems like an overkill to me, since most of the geometry is static, thus better placed in GPU's memory.

Generating a separate VBO (or even a vertex array?) is an option that came into my mind, however this would greatly increase complexity. Any ideas?

sentences:
Game ideas for a platformer I have created a platformer which currently has the features listed below. I would greatly appreciate any further ideas which I could implement! (I don't play a lot of games which is why I require help)

Walking/jumping/movement
player can shoot lasers
enemies also walk, fly, and shoot lasers
water (you can swim in this)
mud (slows you down on contact, and stops you from jumping)
ladders
damage when falling from a large height, unless falling into water
moving platforms
springboards (jumping on them shoot you into the air)
growing platforms (allow you to reach new places)
key and door system
gem and coin collection system
teleporting
turrets

sentences:
Using an interpolated game loop (such as Gaffer's final game loop), will the frame be rendered out of sync? A highly recommended game loop is one from an article called Fix Your Timestep. It presents a method to update using a semi-fixed time step with interpolated rendering.

The problem with this is that, by interpolating the rendering, you are effectively averaging two states in the game - the current and the previous. If the previous frame is averaged with the current frame, the player will be shown the game slightly delayed.

If the player is stationary in one update, then teleports in the next, the interpolation will show a state where the player is mid-way between a teleport very briefly.

For time-critical games, is my thinking correct that the player may see a different/slightly lagged state on screen (the interpolated state) than what is actually stored in memory?

The only fix I can think of is to interpolate the current state + the next, not yet calculated, state. This gives the correct image on screen instead of a slightly delayed previous image... but then we are stuck in a paradox of calculating the next future update.

Or perhaps the time difference is so minimal that it doesn't matter?

I am referring to the following line, the current state is where we are at this moment in time and not fully displayed:

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

sentences:
Intercepting DirectX calls and optimizing the overal performance of games I would like to use a DirectX proxy dll to intercept (and possibly optimize) the graphics calls being made by normal PC games. I am going to "screen cast" a game with ffmpeg or something similar and then stream it to a handheld, so a lot of things should be skipped to reach a a reasonable balance of encoding time on the server side, as well as keep it reasonably low-bandwith

adaptive things like:

entire frame skipping
skipping shader phases
reducing texture size
nearing the far view plane (resp. culling more objects than usually)
are on my TODO list. I already checked out a few implementations of DirectX proxies (even the DirectX SDK has one - PIX), but most of them are used for logging and debugging purposes, and not really for runtime hacking and quality degradation.

I was curious what other existing implementations there could eb out there. I guess, I am not the only one who came with the idea of "screwing up" the graphics quality post-factum, in order to increase better overal performance.

sentences:
How can I find the minimum required radius to draw a visible circle? The problem is that if for example xradius and yradius are set to 5 and the object is too big the circle will be hide under the object and won't be visible.
So I want to find the minimum radius require to draw a visible circle.

So I'm trying to use a recurse and loop over all the childs including the root objects to find what is the biggest radius and then to draw a circle according to the biggest radius.

I created a new method FindRadius.
The problem is how to get from this method the biggest radius from the List and then how to draw the circle on this radius size ? What xradius and yardius will be after finding the biggest radius ?

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

[RequireComponent(typeof(LineRenderer))]
public class DrawCircle : MonoBehaviour
{
    [Range(0, 50)]
    public int segments = 50;
    [Range(0, 50)]
    public float xradius = 5;
    [Range(0, 50)]
    public float yradius = 5;
    public bool minimumRequireRadius = false;
    LineRenderer line;
    private List<float> radiusList = new List<float>();

    void Start()
    {
        FindRadius(transform);

        line = gameObject.GetComponent<LineRenderer>();
        line.positionCount = segments + 1;
        line.useWorldSpace = false;
        CreatePoints();
    }

    void Update()
    {
        CreatePoints();
    }

    void CreatePoints()
    {
        float x;
        float y;
        float z;

        float angle = 20f;

        for (int i = 0; i < (segments + 1); i++)
        {
            x = Mathf.Sin(Mathf.Deg2Rad * angle) * xradius;
            z = Mathf.Cos(Mathf.Deg2Rad * angle) * yradius;

            line.SetPosition(i, new Vector3(x, 0, z));

            angle += (360f / segments + 1);
        }
    }

    private float FindRadius(Transform root)
    {
        foreach (Transform child in root)
        {
            TraverseHierarchy(child);

            var rend = child.GetComponent<Renderer>();
            if (rend != null)
            {
                float radius = rend.bounds.extents.magnitude;
                radiusList.Add(radius);
            }
        }

        return radiusList[0];
    }
}

This is for RTS games too when selecting a unit and there should be a circle around it mark that the unit have been selected.

For example now there is a circle drawn on the MissilesTurret the problem is that the circle radius is xradius 5 and yradius 5 the circle is too short and hiding under the turret base part so it can't be seen only if I will make a lot of zoom in:

And this is after making zoom in to the base part:

Now if before running the game I'm changing the radius of the circle from 5/5 to for example xradius and yradius to 10 now you can see the circle:

My problem is how do I know what radius the circle should be drawn for each unit/s ? Each unit have another radius/size. I don't want to draw it with the mouse for selecting yet I want it to be drawn and selected automatic. So I thought to calculate the minimum required radius for drawing the circle to be see it.

sentences: GL_CLAMP_TO_BORDER - OpenGL ES 3 W want to use GL_CLAMP_TO_BORDER in my GL ES 3 app. Based on documentation (https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glTexParameter.xhtml), it seems to be supported, however, on iOS this #define is not present. Is it named differently? Maybe some extension?

sentences:
Refresh UI after changing source code I was trying following things.
GameManager :
bool gameHasEnded = false;
public GameObject completeLevelUI;

public void CompleteLevel(){
    completeLevelUI.SetActive(true);
}

public void EndGame(){
    if(gameHasEnded == false){
        gameHasEnded = true;
        Invoke("Restart",2f);
    }
}

void Restart(){
    SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

EndTrigger :
public GameManager gameManager;

void OnTriggerEnter(){
    gameManager.CompleteLevel();
}

I get a log in the console "END". Earlier I was using Console.Log("END"); on CompleteLevel(), but I changed that source code. The old code seems to be working and not the new one. It's like Unity couldn't refresh that source code. (And I am sure that I have successfully saved the C# file.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerCollision : MonoBehaviour
{

    public PlayerMovement movement;

    void OnCollisionEnter(Collision collisionInfo)
    {
        Debug.Log(collisionInfo.collider.name);
        if (collisionInfo.collider.tag == "obstacle")
        {
            movement.enabled = false;
            FindObjectOfType<GameManager>().EndGame();
        }
    }

}
```

sentences:
Point Light shows black box & rect (PointLight not working) - libgdx 3D I am creating a 3d scene currently a box and rect, and trying to enable lighting.

  When i create a PointLight and add it to Environment everything turns to  black color?

all i want to do is create a 3d scene and enable point light, like a sun or rays coming from a point and shading the objects.

Code:

environment = new Environment();
environment.add(new PointLight().set(1f, 1f, 1f, 0, 0, 20f, 100f));

modelBatch=new ModelBatch();

..

square=new ModelBuilder().createBox(300,300,300,new Material(ColorAttribute.createDiffuse(Color.GREEN)),
                VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
squareinst=new ModelInstance(square);
squareinst.transform.setTranslation(-500,0,0);

--

sprites.get(0).setRotationY(sprites.get(0).getRotationY() + 1f);
sprites.get(1).setRotationY(sprites.get(1).getRotationY() - 1f);
squareinst.transform.rotate(1,0,0,1);

modelBatch.begin(camera);
for(Sprite3D sp:sprites)// has 3d rect models
     sp.draw(modelBatch,environment);
modelBatch.render(squareinst,environment);
modelBatch.end();

PointLight turning everything black

Without using environment or lights

as per my investigation, here if pointlight is not working then everything should be black as currently, because the environment needs light, it works fine with Directional light (only the backface of rect is black even after rotations, i don't know why)

libgdx version 1.6.1 - android studio
i checked it on both android device and desktop

please i really need to get this PointLight working, i don't know if it will take a custom shader, if so please guide me to some links because i am not experienced in shaders. I also read about PointLight not working on some device or not working in opengl 2.0 enabled, but i am not sure.

sentences: How to disable an object after it goes outside camera's viewport? I have a gameobject at a certain position in the game. I want the gameobject to be disabled once it is outside the camera's viewport, and it should become visible only when the camera focuses at that position.

sentences:
Detect which monitor an SDL window uses I have some SDL code that, before creating a Window and a Renderer, detects the display DPI using SDL_GetDisplayDPI, to properly scale textures late on for different types of monitors (for instance my MacBook Pro's monitor returns a DPI of 258, while my external Dell monitor returns 93).

When I use 2 monitors, SDL_GetNumVideoDisplays properly returns 2, but I couldn't find any function in SDL that would get me which monitor the window is running in, to call SDL_GetDisplayDPI with the correct index, nor any way to detect when the window is dragged from one monitor to the other.

Is there a way to do those things in SDL, or is there a tutorial somewhere that would explain how to do that (hopefully in a platform-independent way)?

sentences: Do I need to learn C++ to use Open GL? Do I need to learn C++ to use Open GL?

sentences:
LibGDX Overlay Game with Stage I have been working on a 2d game that is similar to billiards/pool. I've got the basic game down and now I'm working on some visual effects. One of the things I would like to do is have have numbers pop up on the screen where a scoring event occurs and then have that number "swoosh up" to the main score at the top of the screen. To accomplish this I have been trying to overlay a Stage onto my main game area so that I can add score text and then let the LibGDX Scene2d take over. I am adding the text as an actor to the stage and then assigning some actions to it to achieve the desired effect. The problem I'm having is that when I add the object I need to convert from world to stage coordinates. This is because I want to place the score popup where two balls touch, which is in world coordinates. I have tried to use the "project" method of the stage's viewport (it is a FitViewport) but the coordinates never translate correctly.

Now that I've explained what I'm trying to do, I was hoping that someone would know how I could pull this off. I'm sure it isn't difficult and that I'm missing some small detail.

Here is the relevant code:
This is the class that will be used to overlay a stage onto the main game screen.

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.actions.Actions;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.utils.viewport.Viewport;

public class UIOverlay {

    private Skin skin = new Skin(   Gdx.files.internal("skins/gamePlaySkin.json"));
    private Stage stage = new Stage();

    public void init (Viewport viewport) {

        stage.setViewport(viewport);
        stage.getViewport().update(GameWorld.WIDTH, GameWorld.HEIGHT, true);
    }

    public void render () {

        stage.act();
        stage.draw();
    }

    public Stage getStage () {

        return this.stage;
    }

    public void addScorePopup (int score, Vector2 worldPos) {

        Viewport vp = stage.getViewport();
        Vector2 screenPos = new Vector2(worldPos.x, worldPos.y);
        vp.project(screenPos);

        // Some sample vectors after projection:
        // worldPos.x = 0.88585174, worldPos.y = 1.6051532
        // screenPos.x = 0.885849, screenPos.y = 1022.39484
        // Another Set:
        // worldPos.x = 0.63776636, worldPos.y = 0.8991218
        // screenPos.x = 0.63777924, screenPos.y = 1023.1009

        Label popLabel = new Label(String.valueOf(score), skin, "popupScore");
        stage.addActor(popLabel);
        popLabel.setPosition(screenPos.x, screenPos.y);

        float time = 0.5f;
        popLabel.addAction(Actions.delay(1000, Actions.sequence(Actions.moveTo(0.0f, 0.0f, time, Interpolation.sineIn), Actions.alpha(0, 0.1f))));
    }
}

This is where I set up the main game viewport:

public static void init(){
    // GameWorld.WIDTH and HEIGHT are 1280 and 1024
    m_camera = new OrthographicCamera();
    m_camera.setToOrtho(true, GameWorld.WIDTH, GameWorld.HEIGHT);
    m_viewport = new FitViewport(GameWorld.WIDTH, GameWorld.HEIGHT, m_camera);
}

When creating the UIOverlay I pass the game's m_viewport into UIOverlay.init(). I have also tried creating a new FitViewport in UIOverlay with the same dimensions as the game's viewport, but have the same behavior.

sentences:
can't make my unity character move so I'm starting with Unity , I followed the john lemon tutorial , and I wanted to apply what I learn on a model on my own coming from blender.
Everythings works , animation , rotation , but not translation . For some reasons my character doesn't move at all .
It might have to do something with root motion since I have apply root motion in grey with written just after "handled by script" . Not sure what to do ..
I found something about character in place,  I think I'm in this case but I'm not sure how to use it in my script ..
https://docs.unity3d.com/Manual/ScriptingRootMotion.html

If you ask I'll give you my project .

EDIT :

ok so I made some advances :

 void OnAnimatorMove()
{
        m_Rigidbody.MovePosition(m_Rigidbody.position + m_Movement * m_Animator.deltaPosition.magnitude * 10000);
        m_Rigidbody.MoveRotation(m_Rotation);
        Debug.Log("m_Animator.deltaPosition.magnitude: " + m_Animator.deltaPosition.magnitude);

}

m_Animator.deltaPosition.magnitude is actually always equal to 0 , explaining why my charachter doesn't translate but why is it always equal to zero ?

sentences:
unity lag while moving a sprite I'm trying to build a 2D game for android and after I finished developing the game I noticed that there was lag present when moving objects around. I tested it on a phone much more powerful than my own Sony Xperia z2 and it had more lag, therefore I believe it's not related to RAM.

I've disabled vsync using profiler putting the movement in fixedupdate, lateupdate, and even built a new project.
This new project has only 1 scene and 3 scripts. One of scripts are attached  to this sprite to move it.
When running this project I still have lag; both on my laptop and on my mobile phone!

This is the script:

using UnityEngine;
using System.Collections;

public class PlayerMove : MonoBehaviour {
    public Vector2 movement;
    public Vector2 speed;
    private float myTimer;
// Use this for initialization
void Start () {
    speed=new Vector2(2,0);
}

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

}
public void handleMove(){
    if (Input.GetKey (KeyCode.UpArrow)) {
        speed.y=2;
        this.gameObject.rigidbody2D.velocity=speed;
        myTimer=.3f;
    }
    if (Input.GetKey (KeyCode.DownArrow)) {
        speed.y=-2;
        this.gameObject.rigidbody2D.velocity=speed;
        myTimer=.3f;
    }
    if (myTimer > 0)
        myTimer -= Time.deltaTime;
    else {
        speed.y=0;
        this.gameObject.rigidbody2D.velocity=speed;
    }
}
}

this is results of profiler

sentences:
How to rotate one object around another moving object in 3-d? i was wondering if anyone could give me some advice on how to rotate one object around another moving object. After a bit of googling i found some code on another website that worked perfectly but it would only work on staitionary objects. The code that i used:

Vector3 temp = objectPosition - objectToRotateAboutPosition;
temp = Vector3.Transform(temp, Matrix.CreateRotationX(angle));
objectPosition = objectToRotateAboutPosition + temp;

It works perfectly on the staitionary object but on a moving object it seems to object that is orbiting the main object seems to distance itself a great distance before it returns to the original position. I was wondering if anyone knew a way that i could tweak this code blocka and make it work, or maybe a different way to rotate one object around a moving object.

sentences:
Cube world rendering optimizations I'm making a Minecraft like game and I would like to apply some optimizations. Firstly I didn't and I rendered the world using a vbo in which I stored a cube model and I drow all blocks of the worlds and off course it caused lag if there were too many blocks.
Then I decided to draw the world face-by-face and check if a face is hidden from another one.

This concept is simple if I have the world made only by cubes of the same size, like this:

Blue and black block are two blocks of the same size and the red face is the face to ignore since is hidden (overlapped) by another opaque face.

As I said if I want to make blocks of different sizes (scale)/position/rotation but by always drawing them from faces, the matter is different since I can't know if a face is completely visible or not. Here's an image of a normal block with a "custom" block on it:

Blue block is the custom block, the black a "normal" block and the red is the face overlapped by the biggest one (then it should be ignored during rendering).

Here the rotation is null but if there's no way to check rotated faces I can simply ignore it and draws all rotated blocks by default (I don't rotate all the world lol)... that's not what I'd like to do but if there's no way or the way is too difficult...

Anyway, finally, how can I check (using GL functions or doing it in my code) if a face is hidden and to ignore it on rendering?

I forgot to say that another optimization I did is if a block is hidden (has a block relative to each face) by other blocks I don't draw it.

sentences:
Inventory Item Exist checker I have a question regarding declaring my inventory. I made it a string named inventory, with a constant number as its max value. The thing is, I want the user to use an item if he / she gains an item. The problem is, I do not know what syntax should I use to determine if the user has an item and use that item. Here's my code I just started:

so declaring the inventory:

    const int MAX_ITEMS = 15;
    string game_inventory [MAX_ITEMS];
    int itemnum = 0;

I have some items like potion, antidote, gems and others. I use the:

game_inventory[itemnum++] = "Potion"

to place items in my inventory. If I want to use the potion, IF I HAVE one, how can i make a function to check whether I have a potion or anything and use it?

sentences:
Having troubles with LibNoise.XNA and generating tileable maps Following up on my previous post, I found a wonderful port of LibNoise for XNA. I've been working with it for about 8 hours straight and I'm tearing my hair out - I just can not get maps to tile, I can't figure out how to do this.

Here's my attempt:

            Perlin perlin = new Perlin(1.2, 1.95, 0.56, 12, 2353, QualityMode.Medium);
        RiggedMultifractal rigged = new RiggedMultifractal();

        Add add = new Add(perlin, rigged);

        // Initialize the noise map
        int mapSize = 64;
        this.m_noiseMap = new Noise2D(mapSize, perlin);
        //this.m_noiseMap.GeneratePlanar(0, 1, -1, 1);

        // Generate the textures

        this.m_noiseMap.GeneratePlanar(-1,1,-1,1);
        this.m_textures[0] = this.m_noiseMap.GetTexture(this.graphics.GraphicsDevice, Gradient.Grayscale);

        this.m_noiseMap.GeneratePlanar(mapSize, mapSize * 2, mapSize, mapSize * 2);
        this.m_textures[1] = this.m_noiseMap.GetTexture(this.graphics.GraphicsDevice, Gradient.Grayscale);

        this.m_noiseMap.GeneratePlanar(-1, 1, -1, 1);
        this.m_textures[2] = this.m_noiseMap.GetTexture(this.graphics.GraphicsDevice, Gradient.Grayscale);

The first and third ones generate fine, they create a perlin noise map - however the middle one, which I wanted to be a continuation of the first (As per my original post), is just a bunch of static.

How exactly do I get this to generate maps that connect to each other, by entering in the mapsize * tile, using the same seed, settings, etc.?

sentences:
Starting with shaders and particles I'm working on a flow field with particle systems and starting to learn about shaders in three.js.

Current state of my work is available here.

As such amount of calculations is quite heavy for a big amount of particles I am wondering is it possible to move it to the vertex shader? (Im just a beginner, no experience with shaders, only what i've read, so please be patient)

The calculations requires previous position to add further displacement and to move the particle further according to the noise value on given position, but i don't think it is possible to output anything from the shader?

sentences: What is the best way to animate a jumping motion in Unity 3D? I am creating a a simple 3D game in Unity with a character who runs, walks, jumps, swims, shoots etc. I am pretty satisfied with my results in all the motions except jump. I need to know at what height my character is at in relation to the ground at all times (The height of my terrain varies) in order for me to be able to tell the Animator Controller when to transition. I have done some research on the matter and I found out about Raycast but I'm not sure how to use it. Any help would be great, thanks!

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

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

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

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

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

sentences:
How can I avoid a stack overflow when recursively checking adjacent game objects? I am building a simple game on Unity to learn the system. I am using C#.

The game is a basic "blocks" game, whereby when the player clicks on a block, the block and its neighbours of the same colour all disappear (get destroyed).

My process is this:

To keep a track of which blocks are neighbours of the same colour, on each refresh each block checks their details on the event OnCollisionEnter and adds these collision neighbours to a List of valid neighbouring gameobjects.
When a block is clicked, this list is checked and each neighbour has its own neighbours list checked, after list checking each block is distroyed.

Somehow, this process is causing a StackOverflowException

  StackOverflowException
  UnityEngine.GameObject.GetComponent[setupscript] () (at
  C:/buildslave/unity/build/artifacts/generated/common/runtime/GameObjectBindings.gen.cs:35)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:86)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  ....

Here is my script, first my List establishment:

 private List<GameObject> neighbours = new List<GameObject>();

Next, here is how the neighbours list is populated:

void OnCollisionEnter (Collision other)
{
    Rigidbody other_rb = other.rigidbody;
    if(rb.velocity.magnitude < 1f && other_rb.velocity.magnitude < 1f
        && other.gameObject.tag == tagName && !neighbours.Contains(other.gameObject)) {
    /***
     * Same tag so add to list of valid neighbours
     ***/
        neighbours.Add(other.gameObject);
    }
}

Now, there are four conditions [above] to check when adding to the list:

Is the current block stationary.
Is the "other" colliding block stationary (so they're at rest next to each other).
do these blocks have the same tag (so they're the same type/colour)
does this block not already exist in this list.

So once all four conditions are met, the block GameObject is added to the List.

( On conditions of OnCollisionExit blocks are removed from the List in a  similar fashion.  )

Now, my CheckNeighbours() script:

public void checkNeighbours(){
    if (neighbours.Count > 0) {
        foreach (GameObject othercube in neighbours) {
            setupscript otherCubeScript = othercube.GetComponent<setupscript>();
            otherCubeScript.checkNeighbours();
        }
    }

    Destroy (gameObject);
}

This should, as far as I understand it, run once through each List element and check that element for any neighbours who match.

As I write this question out I think I'm realising that the issue is that we're in a loop as block 1 references neighbour block 2, which references neighbour block 3, which references neighbour block 1, etc. etc.

But my StackOverflow exception occurs when there are only two blocks, so one refers to the other, refers to the first, etc. But as they should destroy after running the reference, this shouldn't (ideally) be an issue? Do I need to make the checkNeighbour() a Corountine to allow it to not hold up destroying the GameObject?

If this [repetition cycling] is indeed what's going on, what would be the best way of getting each neighbour to be checked only once? Or checking that the GameObject referenced in the List still exists in the game itself?

I have a quick edit here:

foreach (GameObject othercube in neighbours) {
    if (othercube != null){
        setupscript otherCubeScript = othercube.GetComponent<setupscript>();
        otherCubeScript.checkNeighbours();
    }
}

But I'm not sure this will work as I feel this List will purely be a reference rather than the actual GameObject in the level?

sentences:
Entity component system: how and where store pointers to system resources or third-party lib's objects? I'm migrating my game pet-project to ECS. I use C# (custom-made engine, not Unity). It goes pretty well, but one big thing is making me worry.
This is how and where to store pointers to system resources or third party libraries' objects?
For example, I have object with Transform and RenderModel component.
Transform contains data like matrices, quaternions etc (like described in any ECS paper :)
RenderModel contains path to FBX scene and some data how to render this model (materials, overrides, flags, scaling, etc).
For model rendering I use existing rendering library. To render the model I need to create object, add it to this library, update its transform if necessary and destroy it when I don't need to draw this model any more.
The question is where to store pointer to such rendering objects?
I see three approaches:

Any component that holds such resources implements methods OnAdd and OnRemove which are called when component added or removed respectively. On addition the component create lib's object and destroys it on removal. I've focused on this approach because it's pretty straightforward and simple to implement. Main drawback of such approach that I need to implement some kind of workaround to feed transformation to this models.

Systems are stateful and keep tracking of component addition and removal. When given combination of components is added (i.e. RenderModel and Transform) system that handle object drawing creates internal representation of the model and destroys when components are removed. Main drawback that I have no idea how efficiently track multiple component addition and removal.

Some kind of "imperative" approach. For each entity with RenderModel and Transform components system calls method like DrawModel(...). At the end of the frame the internal representation is destroyed and created again on next frame. Such approach looks like most convenient approach from game logic view, but suffer from obvious performance issues, because rendering library might build internal structures, cache visibility data, use interleaved shadow maps etc. Furthermore, updating this systems in parallel threads obviously will become nightmare.

Same issues I've also encountered with physics library and FMOD sound, because such libs also offer some long-living objects (non-POD) and build internal data structures.
Could you suggest better approach to solve such issue?
P.S. I use custom (made from scratch) engine (not Unity)

sentences:
Unintended sliding blocks Unity (5) physics A game I'm working on right now relies on the Unity physics system for collisions, gravity etc. This all works well except for one strange thing. When an explosive is placed on a stone cube, it'll slide right off.

A video displaying the sliding behavior: https://www.dropbox.com/s/lr6lhnn30x61tvf/Unity%202015-02-19%2013-41-39-54.avi?dl=0

The stone gameobject settings: http://puu.sh/g3BFn/c15483b8ea.jpg The explosive has the same settings except for that the Mass is 1.

What could cause this weird sliding and how can it be fixed?

sentences:
XNA - Accessing primary View, Project, World matrices from a game component In XNA4, I have an EnemyManager class that takes care of all of the enemies.  When it comes time to draw, however, it needs access to the game's main View, Projection, and World matrices.

I could just pass a reference to my DavesGame object down in there, but that seems like bad design.  I could put them in an interface and expose them as a game service.

I'm leaning towards the latter, but I'm wondering what the correct & elegant way to do it is.

Thanks!
Dave

sentences:
3d isometric projection matrix? I have 3d vectors that I want to project as 2d vectors to draw my shapes. I got a 3d vector cameraPosition, a 3d vector cameraDirection, a float renderDistance. I need to create an orthogonal / isometric matrix with those values to project my 3d vectors.

Here is what I currently have :

matrix4x4(vec3 camera, vec3 camreaDir, vec3 camreraScale){
    //get isometric projection matrix
    vec3 xImage = vec3(-sinf(camreaDir.x), cosf(camreaDir.x), 0) *
camreraScale.x; //unused member : z
    vec3 zImage = vec3(-sinf(camreaDir.x + camreaDir.z), cosf(camreaDir.x + camreaDir.z), 0) * camreraScale.z; //unused member : z

    matrix[0][0] = xImage.x;
    matrix[1][0] = 0;
    matrix[2][0] = zImage.x;
    matrix[0][1] = xImage.y;
    matrix[1][1] = camreraScale.y;
    matrix[2][1] = zImage.y;
}

sentences:
Network Message Registering message handler Problem I have a confusion about when and where to use NetworkServer.RegisterHandler() and NetworkManager.singleton.client.RegisterHandler()? And also I am getting Unknown message ID 1002 error.

I have a message class

public class NetworkMsgHandler : NetworkBehaviour {

public const short movement_msg = 1002;

public class BulletMovementMsg : MessageBase {

    public string objectName;
    public Vector3 objectPosition;
    public Quaternion objectRotation;
    public float time;
}

}

I have ServerRelay which has ServerOnly authority has Script ServerRelay for registering Message Handler on Server.

public class NetworkServerRelay : NetworkMsgHandler {
private void Start()
{
    if(isServer)
    {
        RegisterNetworkMessages();
    }
}

private void RegisterNetworkMessages()
{
    NetworkServer.RegisterHandler(movement_msg, OnReceivePlayerMovementMessage);
}

private void OnReceivePlayerMovementMessage(NetworkMessage _message)
{

    BulletMovementMsg _msg = _message.ReadMessage<BulletMovementMsg>();
    NetworkServer.SendToAll(movement_msg, _msg);
}

}

Then I have Bullet GameObject it has script Projectile which is sending movement message this class is derived from NetworkMsgHandler.

public class NetworkProjectile : NetworkMsgHandler {

private void Start() {

    if (localPlayerAuthority) {

        canSendNetworkMovement = false;
        RegisterNetworkMsg();
    }
    else {

        isLerpingPosition = false;
        isLerpingRotation = false;

        realPosition = transform.position;
        realRotation = transform.rotation;
    }
}

private void RegisterNetworkMsg() {

    NetworkManager.singleton.client.RegisterHandler(movement_msg, OnReceiveMovementMsg);
}

private void OnReceiveMovementMsg(NetworkMessage networkMessage) {

    Debug.Log("Message received");
    BulletMovementMsg msg = networkMessage.ReadMessage<BulletMovementMsg>();

    if(msg.objectName != transform.name) {

        ProjectileManager.Instance.SpawnedBullets[msg.objectName].GetComponent<NetworkProjectile>().ReceiveMovementMsg(msg.objectPosition, msg.objectRotation, msg.time);
    }
}

public void ReceiveMovementMsg(Vector3 position, Quaternion rotation, float _timeToLerp) {

    //lerping between position
}

private void Update() {

        if(!canSendNetworkMovement) {

            canSendNetworkMovement = true;
            StartCoroutine(StartNetworkSendCoolDown());
        }
}

private IEnumerator StartNetworkSendCoolDown() {

    timeBetweenMovementStart = Time.time;
    yield return new WaitForSeconds((1 / networkSendRate));
    SendNetworkMovement();
}

public void SendNetworkMovement() {

    timeBetweenMovementEnd = Time.time;
    SendMovementMsg(bulletID, transform.position,transform.rotation, (timeBetweenMovementEnd - timeBetweenMovementStart));
    canSendNetworkMovement = false;
}

public void SendMovementMsg(string _bulletID, Vector3 position, Quaternion rotation, float timeToLerp) {

    BulletMovementMsg _msg = new BulletMovementMsg() {

        objectRotation = rotation,
        objectPosition = position,
        objectName = bulletID,
        time = timeToLerp
    };

    NetworkManager.singleton.client.Send(movement_msg, _msg);
}

}

So whenever a bullet spawns it generates an error on client side saying Unknown message ID 1002 connId:1
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

sentences: Add object to a Terrain? It's possible to add object made by blender to unity terrain ? this object will become a part of it. I can add grass and trees on it.

sentences:
Is this converting from or to premultiplied alpha? I found this code buried under some rocks:

var divAlpha = 0xff00/color.A;
var r = (byte) (color.R*divAlpha >> 8);
var g = (byte) (color.G*divAlpha >> 8);
var b = (byte) (color.B*divAlpha >> 8);

The fields on color are bytes, of course. My guess would be it's avoiding using floating point operations to handle premultiplied alpha, but is it converting from or to? How does this work out?

Example output:

0x44112233 -> a: 0x44, r: 0x3f, g: 0x7f, b: 0xbf

sentences:
Examples of RESTful Web Services for Browser Games Can anyone point me towards examples of Browser Games / Browser Game Sites that use RESTful web services?

I have been convinced time and again that building web sites using RESTful principles is a good idea. And I agree.  But I just can't wrap my head around what RESTful means when the service you're providing is just a single (or a few) games.

Any ideas or thoughts would be nice, but I'd also love to see some solid examples.

sentences:
Algorithm for making sets in a Rummikub game I'm developing an Okey game (a Turkish version of Rummikub/Rummy). In it, each players has a bunch of tiles. Tiles have a colour and a number, like playing cards. Now, the player needs to make sets of these tiles, with three options:

Groups: Same number, different colours (Red 1, Blue 1, Black 1)
Straights: Same colour, sequence of numbers (Red 1, Red 2, Red 3)
Doubles: Two identical tiles

I'm now trying to create a simple AI for the game. I want it to be able to find and create sets in/from its own tiles.

I already have a TileSet class. Feed it a list of tiles and it will say whether it's a valid set and of what type.

Using this, what kind of algorithm can I use to find the sets in an unordered heap of tiles?

sentences:
Civilization 4: time in own scenario runs up too quickly In Civilization 4 (Beyond the Sword) I started making a scenario that focuses on the colonization of North America. For added realism, I set the StartYear=1780.
Everytime I run the scenario, the time runs up far too quickly–probably because I set Era=ERA_ANCIENT and GameTurn=0–so that after just twenty turns the clock nears present day.

I'm not really sure how to go fix this, other than by playing an actual marathon game from the start up to the year 1780 and copy over the values.

Is there any way to calculate/know the right values for my scenario?

sentences:
When should I load my resources? I'm making a game, and right now I'm working on the user interface. I'm just wondering when I should be loading my resources.

Should I do it in small pieces at a time?

Load resources for part 1 of menu
Run part 1 of menu
Free resources for part 1 of menu
Load resources for part 2 of menu
Run part 2 of menu
Free resources for part 2 of menu
(So on)

Or all at once?

Load resources for all parts of menu
Run part 1 of menu
Run part 2 of menu
(So on)
Free resources for all of menu

It would seem to me that the pros of the first method are that my code can be much cleaner, as I can isolate the resources to specific parts of my class:

class UI {
    method run() {
         part1();
         part2();
    }
    method part1() {
         // part1's resources can be declared here
    }
    method part2() {
         // part2's resources can be declared here
    }
}

Whereas with the second method, it will probably run faster, but then all my resources have to be global:

class UI {
    // resources are declared here
    method run() {
        part1();
        part2();
    }
}

I'm using OpenGL, so right now what I'm doing is loading all my textures and audio at once, but I'm allocating and freeing my Vertex Buffer Objects as they're needed. For those of you who have more experience writing games, what method do you think I should use?

sentences:
Why is it that there are invalid "dt" values in physics simulations? I'm utilising some of NeHe's spring code, and after getting some pretty weird results I eventually realised the source of my error - my "dt" value in my Update function; the value that everything is multiplied against to speed up/slow down the calculations, hopefully based on frame rate. For example:

public void Update(GameTime gt) {
   float dt = gt.ElapsedGameTime.Milliseconds / 160.0f;
   velocity += (force / mass) * dt;
   position += velocity * dt;
}

160.0f seems to work pretty well for the player's update function, but for my spring simulation I need a value of about 3000, or I end up with my springs located at (NaN,NaN) pretty much instantly.

Why do bad values for this cause everything to go so crazy? I thought it would just slow down or speed up my simulation but it seems to cause some weird cascading failure.

Edit: Sorry, forgot to link to NeHe's post on this: http://nehe.gamedev.net/tutorial/introduction_to_physical_simulations/18005/

sentences:
Does XNA have a built-in GUI library? Does such a thing exist or do I have to code one?

My project needs textboxes, buttons, input capture, timings for "press and hold keys" and so on. These are quite standard for a GUI library but hard to code from scratch.

What options do I have?

sentences:
Creating custom collision map for 2D I have a 2D level that I have built in my map editor, and I was wondering the best way to create a collision map for it.

I have a collision map layer in my map editor, which saves each node (for example, a rectangle would be just 0,0 0,50 50,60 0,60)

I was just wondering how I could take my node locations and convert it to a collision map for Unity.

Thanks!
I feel this has to be able to be done, I can think of how I would do it in flash... but I am not sure how to manipulate it in Unity.

EDIT PICTURE: So I have a node at each one of these red dots (surrounding my terrain lets say)  I want to build a collider from those nodes

sentences:
Architecture of networked game engine So after working on my game engine for 2 years, I've decided to step into the networking environment. I just don't know if it's a good idea to rewrite the engine, or how much work it will take (but still want to try it). I'm little bit confused by some approaches, so that's why I'm here.

In short I have an architecture like this:
There is a main object, that controls the whole engine world (physics steps, rendering, audio, input, entities). Then there is a Game instance that is running inside the loop and "creating the content of the game".

I already started with ENet, created a small console chatting app - but packets were just strings.  But I'm not sure if I understand the concept of game networking, so here is my idea:

There is a server and clients. Server is controlling everything. Client sends messages.

So basically:
When client connects to the server, server creates new entity. Now, for example, when client presses A, packet is sent to a server containing this information. Server will process it, moves the entity.

Am I right?

So basically, clients does not have anything, except input controller and keyboard. So when they press keys, action is done. And rendering for the scene render, but all they receive is just a "image" of the scene from the server? Or is there something I miss?

Thanks in advance.

Edit1
And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?

sentences:
How to draw geometric shapes to a texture? How can I create a texture containing a geometric figure using SDL2?

I saw there is a way to convert Surface to Texture, and I also saw that there is a way to draw directly to the screen using DrawRect() / FillRect() functions... I'm not sure if the geometry has something similar. Ultimately I want to have a texture to render.

The way I'm making my engine draw is to read game objects' texture and copy it to the render using render.Copy(texture, rect1, rect2).

This makes me wonder if there's a way for my game object to hold a texture containing a rect, circle, or triangle texture. I couldn't find in the SDL wiki or tutorials online.

sentences:
How to make a character that moves like a slinky? I have a school assignment to make a 2D platformer game, with a character that moves like a slinky:

(Animated example from the assignment linked above)

At first, the character needs to grow in height over time
When the player presses a button, the character starts to bend toward the next platform
Its height when you press the button determines whether it will hit the next platform
After that it must shrink to its initial size, and it goes over again.

How can I approach this?

sentences:
"_SRGB" suffix for BC texture format doesn't result in sRGB-to-linear correction at sampling I am working on a 3D engine as a hobby (Direct3D 11). Currently I am trying to implement sRGB -> linear -> sRGB color space conversions via texture formats with "_SRGB" suffix. So, my textures are supposed to be sRGB images (for example, DDS-files compressed in BC1_UNORM_SRGB format), output is also gamma-corrected (thanks to R8G8B8A8_UNORM_SRGB frame buffer) and all shader calculations are made in linear color space.
The problem is, whether I use sRGB or non-sRGB format for the DDS-file, after sampling the texture I get exactly the same color values inside the shader that are stored in original image. But if I get it correctly, sampler should apply implicit gamma correction (pow(color, 2.2f)) for the input values. So, for example, if I want to output the same color as is in the map (lets say, 0.5f for R channel), I sample it from the texture (0.5f becomes 0.218f after transferring to linear color space by sampler), then I do nothing with it inside the shader and send to output. As the frame buffer has sRGB format, merger (or some other part of pipeline, that does it) will apply gamma re-correction to our value (pow(color, 1.0f / 2.2f)), and 0.218f will become 0.5f again. I will get the same image as I had on the input.
The output colors are definitely gamma corrected, as I see clear difference when I change frame buffer format from sRGB to non-sRGB. But as no input correction is applied, the final image looks brightened comparing to the input one. As I said, I checked the value in pixel shader after texture.Sample() call, and it is exactly the same as colorpicker shows for the source texture. When I swap the texture format to non-sRGB, nothing changes (I use Visual Studio 2013 Update 4 for format changing).
To load DDS files I use DDSTextureLoader. I also called Direct3D methods directly to create resource and view from the file, but nothing changed. Both resource and shader resource view have "_SRGB" format, as I can see in Graphics Debugger, so they are definitely sRGB ones.
I've read at MSDN that in Direct3D 11 setting texture format is enough for sampler to recognize sRGB image. Is there something I am doing wrong or missing, or understand incorrectly? Maybe someone had similar issues? Any advice would be highly appreciated!

sentences:
How to keep triangles from connecting across voxel mesh I am working on a voxel engine and have just started learning webgl. I have generated a list of Vertices and Indices by using Array.concat() on a template array and adding a value based on my position in loop.

var verticesTemplate = [
    // Front face
    -0.5, -0.5,  0.5,
     0.5, -0.5,  0.5,
     0.5,  0.5,  0.5,
    -0.5,  0.5,  0.5,

    // Top face
    -0.5,  0.5, -0.5,
    -0.5,  0.5,  0.5,
     0.5,  0.5,  0.5,
     0.5,  0.5, -0.5,

    // Right face
    0.5, -0.5, -0.5,
    0.5,  0.5, -0.5,
    0.5,  0.5,  0.5,
    0.5, -0.5,  0.5,

    // Bottom face
    -0.5, -0.5, -0.5,
     0.5, -0.5, -0.5,
     0.5, -0.5,  0.5,
    -0.5, -0.5,  0.5,

    // Left face
    -0.5, -0.5, -0.5,
    -0.5, -0.5,  0.5,
    -0.5,  0.5,  0.5,
    -0.5,  0.5, -0.5,

    // Back face
    -0.5, -0.5, -0.5,
    -0.5,  0.5, -0.5,
     0.5,  0.5, -0.5,
     0.5, -0.5, -0.5,
];
var indicesTemplate = [
    0, 1, 2,      0, 2, 3,    // Front face
    4, 5, 6,      4, 6, 7,    // Back face
    8, 9, 10,     8, 10, 11,  // Top face
    12, 13, 14,   12, 14, 15, // Bottom face
    16, 17, 18,   16, 18, 19, // Right face
    20, 21, 22,   20, 22, 23  // Left face
];
var WorldVertices = [];
var WorldIndices = [];
var IndexLoopIndex = 0;

function generateMeshData() {
    for(var x = 0; x < 4; x++) {
        var blockVertices = [].concat(verticesTemplate);
        addToX(verticesTemplate, blockVertices, x);
        for(var y = 0; y < 4; y++) {
            addToY(verticesTemplate, blockVertices, y);
            for(var z = 0; z < 4; z++) {
                var block = blocks[x][y][z];
                if(block.isActive === true) {
                    // adds a value of 1(The blockSize) to all z coordinates in verticesTemplate and adds to end of WorldVertices
                    addToZ(verticesTemplate, blockVertices, z);
                    WorldVertices = WorldVertices.concat(blockVertices);

                    var indices = [].concat(indicesTemplate);
                    addToXYZ(indicesTemplate, indices, 24*IndexLoopIndex);
                    WorldIndices = WorldIndices.concat(indices);
                    IndexLoopIndex++;
                }
            }
        }
    }
}

The problem is that the triangles are skewed after the mesh is rendered using gl.drawElements. And I can't figure out why. So how can I keep triangles from being drawn that connect cubes?

sentences:
Animation in OpenGL using 3D Models I have created a model in Blender. Now i want to read that 3D model in my c++ program. I figured that a model can be exported to various file formats e.g. .obj, .3ds or COLLADA and then can be read in a c++ program. I have been searching web for doing that for quite a while and found many tutorials. But i ran into issues with most of them. For example, IN the Nehe tutorial they are using glaux which I don't want to use in my program. And the remaining tutorials use md2 which is not supported by Blender.

So can anyone guide me which file format to use for exporting 3D model and how to load that in my OpenGL program? Also how can I animate that model? Is it possible to add extra effects like tone mapping after it has been loaded in the c++ program using OpenGL? if yes then how?

P.S. I am using Linux for game developement

sentences:
Verb+Noun Parsers and Old School Visual Novels Hi
I'm working on a simple old school visual novel engine in Lua. Basically I have most of the code set up besides one important feature. The Text Parser.

Lets get into how words are generally structured.
In the screenshot I input the command "my wish is for you to die"

--How would a human understand this?

my = noun/object

wish = verb

is = connective_equator similar to =

for = connective_object (for all objects of ..)

you = noun/object

to = connective_action similar to do

die = verb

--the computer can then parse this and understand it like this (pseudo example)

my = user

you = get_current_label()

you = "Lost Coatl"

wish = user_command

user_command = for all_objects of "Lost Coatl" do die() end

execute user_command()

What other ways do videogames use text parsers, what would be the simplest way for a newbie coder such as myself?

sentences:
How can I make background elements wrap around the screen? I'm looking to make my clouds wrap around the screen in my game (like the picture).

Right now it just continues off the screen. The current movement code is:

Cloud.center = CGPointMake(Cloud.center.x +0.032, Cloud.center.y)

sentences:
Blend Tree animation problems at rotation I have a Blend tree animation  with two floats ( VelocityX, VelocityZ) that have idle, run , run right, run left ,
I use a pad to move it at world space

When VelocityX is -1 it run left, +1 it run right
When VelocityZ is -1 it run back, +1 it run foward

It is working fine but the problem comes when I rotate the character in his Y axis,  If I rotate the character 90 degrees on the Y axis, This system 'breaks' since blend tree is calculating VelocityX and VelocityZ from world space and not local space, So character is doing 'run foward' animation to go top but hi should do 'run right' animation since from character prespective he is moving to the right

How I can implement that local rotation into my blend system?

Any help or guide will be apreciated

sentences:
Generating mesh along path I'm currently trying to generate a path along an array of points (Vector3)
This is the result I'm currently getting:

The dark gray points are the given path
The red points are the generated vertices
And the triangles are obviously the mesh I failed to generate correctly

And from the bottom it looks like this, which is odd, because I'd expect all the missing triangles to be at the bottom. But some of them just don't exist:

here's the code i wrote that generates the path mesh

//Removed code since there's no need in showing something that doesn't work

And here's a quick example of what it looks like when I drag a path:

SOLUTION FOUND

As the accepted answer states, I was skipping triangles in my triangle for loop.
Here is my new working code:

public static Mesh extrudeAlongPath(Vector3[] points, float width){
    if (points.Length < 2)
        return null;
    Mesh m = new Mesh();
    List<Vector3> verts = new List<Vector3>();
    List<Vector3> norms = new List<Vector3>();

    for (int i = 0; i < points.Length; i++) {
        if(i != points.Length-1){
            Vector3 perpendicularDirection = new Vector3(-( points[i+1].z-points[i].z ), points[i].y, points[i+1].x -points[i].x).normalized;
            verts.Add (points[i]+perpendicularDirection*width);
            norms.Add (Vector3.up);
            verts.Add (points[i]+perpendicularDirection*-width);
            norms.Add (Vector3.up);
        }else{
            Vector3 perpendicularDirection = new Vector3(-( points[i].z-points[i-1].z ), points[i].y, points[i].x -points[i-1].x).normalized;
            verts.Add (points[i]+perpendicularDirection*-width);
            norms.Add (Vector3.up);
            verts.Add (points[i]+perpendicularDirection*width);
            norms.Add (Vector3.up);
        }
    }
    m.vertices = verts.ToArray ();
    m.normals = norms.ToArray ();

    List<int> tris = new List<int> ();
    //Changed i+=3 to i++
    for(int i = 0; i < m.vertices.Length-3; i++){
        if(i%2 == 0){
        tris.Add(i+2);
        tris.Add(i+1);
        tris.Add(i);
        }else{
            tris.Add(i);
            tris.Add(i+1);
            tris.Add(i+2);
        }
    }
    m.triangles = tris.ToArray ();

    m.name = "pathMesh";
    m.RecalculateNormals ();
    m.RecalculateBounds ();
    m.Optimize ();
    return m;
}

sentences:
Strange behavior in collision detection I am making a 2d platform game with a tiled map,i now avoid passing through the walls an the ground but when the character hit the ground it shakes vertically,and when i make it walk on a wall it shakes horizontally.
the atualization code:

public void atualizar() {

    this.detectarColisoes(mapa.getTilesAdjacentes(this.getXAbsoluto(),this.getYAbsoluto(),this.getXAbsoluto()+this.getWidth(),this.getYAbsoluto()+this.getHeight()));
    if(movendo){

        this.setVelX(direcao*5);
        if(this.getVelX()>0 && colisaoLateral==1){
            this.setVelX(0);
        }
        if(this.getVelX()<0 && colisaoLateral==-1){
            this.setVelX(0);
        }
    }else if(this.getVelX()!=0){
        if(this.getVelX()>0){
            this.setVelX(this.getVelX()-1);
        }else{
            this.setVelX(this.getVelX()+1);
        }

    }
    if(this.getXRelativo()>490 && this.getVelX()>0){
        mapa.moveMapX(this.getVelX());
    }
    if(this.getXRelativo()<150 &&this.getVelX()<0){
        mapa.moveMapX(this.getVelX());
    }
    if(estadoSalto==2 && this.getVelY()>0){
        estadoSalto=1;
    }

    super.atualizar();
    if(estadoSalto!=0){
        this.gravidade();
    }
    System.out.println(estadoSalto);

}

the code for the collision detection:

public void detectarColisoes(ArrayList<Rectangle> adjTiles){
    Rectangle chara=new Rectangle(this.getXAbsoluto(),this.getYAbsoluto(),this.getWidth(),this.getHeight());
    if(adjTiles.isEmpty()){
        if(estadoSalto!=2){
            estadoSalto=1;
        }
    }
    boolean caindo=true;
    this.colisaoLateral=0;
    for(Rectangle aux:adjTiles){
        Rectangle ints=aux.intersection(chara);
        if(!ints.isEmpty()){

            if(ints.height<ints.width){

                if(ints.y>chara.y ){

                    estadoSalto=0;
                    this.setVelY(0);
                    this.setY(this.getYAbsoluto()-ints.height);
                    nSaltos=1;

                    caindo=false;

                }

            }else{
                if(ints.x>chara.x){
                    this.setX(this.getXAbsoluto()-ints.width+1);
                    this.colisaoLateral=1;

                }else{
                    this.setX(this.getXAbsoluto()+ints.width-1);
                    this.colisaoLateral=-1;
                }

            }
        }
    }
    if(caindo){
        estadoSalto=1;
    }

}

sentences:
How to set up bloom in Unity Last time I used image effects in Unity it was back when 3.0 was released and for bloom you used the object's alpha to indicate whether it should glow or not. Now in 4.2 I couldn't grasp how to apply the image effect properly. It seemed to put the whole scene to glow and alpha did not affect it.

There was no help from the Unity docs which are pretty much just spec sheets for the effects and no proper tutorials around. This leads to couple of questions:

How do you create something like the screenshots in the Bloom page in the docs? Only the car windows and metal parts glow, but no glow on the concrete.
How do you make a light source like the second image on the above link? I tried different shaders and lights on a gameobject but none of them produced anything like that.
What does the HDR checkbox in the camera actually do?

sentences:
Advantage of Using Addressable Over Asset Bundles in Unity I have a project that already uses asset bundles. I download assets when the game starts and show them to the user when needed.
I see that Unity provides addressables as new solution for asset management. As its new (not very new as its accessible from 2018.2, but official docs dont say a lot) there is not so much about it on the web.
From what it seems, in addressables you dont need to care about the bundle version, or which asset is in which bundle. In addresables, Unity automatically uploads assets to your host, and Unity automatically correctly manages local caching or downloads from a server, so objects behave like they are in the main game package but you have to check if they are loaded or downloaded. Am I right?
Are there any other features that addressables offer?

sentences:
How can I check if the player clicks (or doesn't) on a target within a time limit? In GameMaker, I'm trying to set up something like this:

The player will need to click on some object within three seconds. If they click on it within the timeframe, I'll do one thing (call room_restart()). Otherwise the game is over.

How can I set this up?

sentences:
How to rotate a rectangle body around a fixed point? How to rotate a body around a point?
The body has x, y, speed and angle. Coordinates of the body relative to its center. Additional conditions: point position and distance from body to point.

sentences:
Embedding Pygame to C++ If embedding Pygame to C++ to have a game be an executable, is there any extra process I would have to use in order to use Pygame functions when embedding into C++? As opposed to just writing embedding code in C++ for normal Python code?

To clear cut the question I want to know if it's the same process without having to call different functions.

EDIT: My question is if I have to call different functions in C++ when embedding Python code that uses Pygame modules. I am NOT using pygame2exe nor py2exe. I never even mentioned those. My question is solely about code embedding.

sentences:
How BufferStrategy works I've used this piece of code a lot in my games, but I still don't know exactly how it works.

 // Main loop
while (!done) {
     // Prepare for rendering the next frame
     // ...

     // Render single frame
    do {
        // The following loop ensures that the contents of the drawing buffer
        // are consistent in case the underlying surface was recreated
        do {
            // Get a new graphics context every time through the loop
            // to make sure the strategy is validated
            Graphics graphics = strategy.getDrawGraphics();

            // Render to graphics
            // ...

            // Dispose the graphics
            graphics.dispose();

            // Repeat the rendering if the drawing buffer contents
            // were restored
        } while (strategy.contentsRestored());

        // Display the buffer
        strategy.show();

        // Repeat the rendering if the drawing buffer was lost
    } while (strategy.contentsLost());
}

Why should I use those two do-while loops? What does it achieve? Well, I know why because of the comments, but I want to know exactly what happens

BufferStrategy: http://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferStrategy.html

sentences:
How to code shaders in C# without resorting to other programming languages? I'm working on game and game engine and want a way to prototype shaders. I'm not skilled with C++ or GLSL or HLSL or STH, but I can code in C#.

My question is: How can I code shaders in C#, without using the other mentioned languages?

sentences:
Unity - Accessing a UI's text through a Transform I have this in my player's component list. The HungerTarget transform is the text box in the UI canvas. How would I change the UI's text here?

using UnityEngine;
using System.Collections;

public class HealthHunger : MonoBehaviour {
    //public Transform HealthTarget; Not being used yet...
    public Transform HungerTarget;

void Start () {
}

void Update () {
    //set HungerTarget's text to ...
}

}

sentences: Android multiplayer via bluetooth How do I transfer game commands between 2 android devices via bluetooth first of all is possible to do this??If possible then someone please help in doing so.Thank u

sentences: What is the best way to make a main menu system? I know that's it's easy to make buttons that highlight when you move your mouse over them, but when it comes to sub-menus I'm kinda stuck. Anyone got some tips on the best way to have a main menu with sub-menus? (like Singleplayer -> Load Save -> Save 1-5? -> Start game etc.)

sentences:
How would a turn based RPG game store move information in a reusable way? Suppose I create a turn based RPG in the veins of Pokémon, with a lot of moves and abilities, that would have elements of hand made code, in cases for special effects after a successful attack or status effect, for example, a status buff every turn, or an automatic attack every turn (think rollout or outrage from Pokémon).
def move_name():
    do_primary_effect()//damage, status effect
    do_secondary_effect()//on hit effects, side-effects,
    //delayed buffs/debuffs, setting next move, i.e. rollout, etc.
    set_flags()//flags like invulnerability from moves like dig, fly, etc.

Now suppose I wanted to make this game open source and allowed people to make their own builds/rebuilds or online versions, where they might use a different language. How can I program my moves/abilities in such a way that it can be interpreted by any compiler, regardless of language, so that there is no re-coding moves for different languages?
tldr; how would I go about a format for moves/abilities such that it is compiler independent(might be the wrong word, but means can be read and translated). Now I'm not asking for a direct answer, though those are greatly appreciated, I'm talking mostly about how such a format would look like, so real life examples for existing videogames are greatly appreciated. I've heard my friend say that Pokémon does this  with a data structure, so data structures are also appreciated.

sentences:
Camera closes in on the fixed point I've been trying to create a camera that is controlled by the mouse and rotates around a fixed point (read (0, 0, 0)), both vertical and horizontal. This is what I've come up with:

camera.Eye = Vector3.Transform(camera.Eye, Matrix.CreateRotationY(camRotYFloat));

Vector3 customAxis = new Vector3(-camera.Eye.Z, 0, camera.Eye.X);
camera.Eye = Vector3.Transform(camera.Eye, Matrix.CreateFromAxisAngle(customAxis, camRotXFloat * 0.0001f));

This works quite well, except for the fact that when I 'use' the second transformation (go up and down with the mouse) the camera not only goes up and down, it also closes in on the point. It zooms in.

How do I prevent this?

Thanks in advance.

sentences:
Unity - Creating light that's visible to a shader but not to the camera/player? I'm writing a vertex deformation shader that can react to the presence of certain objects. Originally I was passing coordinates to the shader with SetVector, but from my understanding having the CPU set properties on a shader is somewhat expensive. So another idea I had was to have the shader react to light, and do some matrix multiplication to have the shader deform itself based on the intensity of the light hitting it. My question is, how could I approach writing a shader that would react to a light source, when that light would be invisible to the camera/player? In such a scenario I could write a fast & reasonably simple shader that could react to a special light source that would allow it to dynamically react to the light's location and distance. Only, such a light source would need to be invisible to the player, since its just being used as a representation of location and distance (with the added benefit of mixing multiple different sources easily). Or is there some other equally fast better way to do this that I'm not thinking of?

Thanks for the help!

EDIT: Imagine a shader that causes a surface to grow outwards when a certain type of object is near it, and its extrusion distance is proportional to the distance and "intensity" (some float) of the object. If there were several of these objects near the surface then it will form a pattern taking into account all of these nearby objects.

sentences: How to get all tiles from a Tilemap? I have been trying a little bit the new TileMap system in Unity and I was looking for a way to access the tiles as a List or 2D array but I can't find anything other than GetTile(Vector3Int vector) which returns only one tile ... Is there any way to do this ?

sentences:
How can I connect 2D skeletal animation to the physics engine? I'd like to use skeletal animations in my 2D game, and since I already use Box2D as the physics engine, I'd like to enable (but not enforce) ragdoll animations as well. I need some help in figuring out how the Animation and Physics entity components relate to each other.

How should data be represented on disk? Should the actual model/ skeleton be different from the animation? Here's what I currently have in mind: each texture has a corresponding Box2D body (forearm.jpg and forearm.body, for example). I also have a separate hero.model file that references the *.body files, and several *.anim files that reference the model and the textures.

The reason I don't think I should reference the textures in the model directly, but reference them in the animation, is so I can have the character blink (for example): its head would be one body, but different sprites can be pasted over it at different keyframes as to make it blink.

Should I actually move the limbs while animating? While the character is still alive (and ragdoll should be off), what should I do with the physical limbs? When I animate, should I just render the sprites with the correct transform, or should I actually move the physical limbs to their current position according to the animation? If yes, how can I get over the fact that Box2D doesn't handle moving bodies directly too well?

How to enable more complex communication? Architecturally speaking, how should I implement communication between the Animation and Physics components so that interaction is kept to a minimum, but to also be able to do create more complex entities, like for example a wheel on a robot being rendered with the rotation of the physical wheel, while the rest of the robot is rendered according to the animation's keyframes.

sentences:
C++ entity component system framework I have found several entity system frameworks for other languages besides C++, like Ash and Rush for ActionScript and Artemis for Java and C#.

My question is whether there exists a framework like one of the ones mentioned above for C++?

sentences:
XNA 2 3D Objects Depth Convergence Error Gah! I have a scene with 2 3D objects - a plane and a sphere;

the plane sits on the xy axis with a depth if -100 and diameter of 200;

the sphere diameter is 32 and sits on the xyz = 0 position;

when rendering using indexedprimitive all appears fine.
the sphere appears in front of the plane.

however as i decrease the world z component of the sphere
and the sphere passes through the plane and becomes hidden
it shows the front of the sphere passing through first.

as if the plane were moving down over the sphere but only displaying
the parts of the sphere that should be hidden.

the most puzzling aspect is that this problem only appears as
one object passes through the other. when behind it is hidden,
when in front visible?

Help please :)

Edit 20/12/2015

Has been suggested I upload a sequence of pics to better illustrate my problem so... Hope these help

.

        GlobeTarget = new RenderTarget2D(graphicsDevice, GlobeDiameter, GlobeDiameter, false,
                          SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
        graphicsDevice.SetRenderTarget(GlobeTarget);
        graphicsDevice.BlendState = BlendState.Opaque;
        graphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
        graphicsDevice.DepthStencilState = new DepthStencilState
            { DepthBufferEnable = true, DepthBufferFunction = CompareFunction.Less };
        graphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1, 0);

sentences:
Moving and rotating object with another object Sorry i bad painter))

Need move and rotate 'OBJECT №2' with 'OBJECT №1'

I have origin point(also rotation point) and angles of two object. (Also min and max coordinates of these objects)

Vector origin, Vector angles, Vector absmin and Vector absmax.

I tried next simple code, and it works nice, if object angles not changed:

object2.origin += object1.origin - object1.oldorigin;

(without rotation)

But i need also rotation, I was rarely attend geometry at school, and can't do it without help )))

sentences:
I need help in Unity OnTriggerEnter not changing my bool in an other script C# I want to change a bool in 2 separate scripts in Unity but it's not changing OnTriggerEnter or stay or exit. I've tried everything but nothing helped me.

This is the script where I store the bool and the animator script:

public Animator _T1anim;
public bool Open;

void Awake()
{
    _T1anim = GetComponent<Animator>();
    _T1anim.SetBool("Open", false);
    _T1anim.SetBool("Close", true);
}
public void Update()
{
    if (Open != true)
    {
        CloseDoor();
    }
    else
        OpenDoor();
}
public void OpenDoor() {
        _T1anim.SetBool("Open", true);
        _T1anim.SetBool("Close", false);
}
public void CloseDoor()
{
    _T1anim.SetBool("Close", true);
    _T1anim.SetBool("Open", false);
}

and I want to change the "Open" Bool to true with the OnTriggerEnter in a different script. The T1_1 T11 is the reference to the first script.

T1_1 T11;

void Awake()
{
    T11 = GetComponentInParent<T1_1>();
}
public void OnTriggerEneter(Collider other)
{

    if (other.tag == "Player")
    {
        T11.Open = true;
    }

}
}

This is the animator controller:

sentences:
How do I load/use substances with libgdx? I've been looking at some substances (.sbsar file format) but I have no clue how to load or use these files. The links I find brings me to Unity & Unreal Engine, but if I search up anything related to libgdx or opengl, I can't get any results.
Does anyone know how I can use these textures in my libgdx java game?

sentences: Can we access the internal array of a Android Bitmap? Does an Android Bitmap function similar to a BufferedImage? When you get the internal pixel buffer as an int[] or as a byte[] and update the values inside them, the image changes. Is that the same case as a Bitmap?

sentences: XNA project won't target .NET 4.0 I am trying to reference the System.Threading.Task assembly. If I am not mistaken, it should be part of mscorlib. But no matter what I do, my project always defaults to the .net 2.0 runtime. Even if I create a brand new XNA 4.0 Windows Phone project, it wants to use the .net 2.0 runtime. Any ideas what I could be missing?

sentences:
Documentation on 2D space partitioning I am looking for documentation that explains the different kinds of (well the major ones anyway) 2D space partitioning algorithms & data structures.

Any pointers besides 'Google it and sift through hundreds of papers'. A book perhaps?

sentences:
Rotating a 3rd person camera toward a target I have a 3rd person camera that doesn't look directly at the player but somewhere in front of him.

When the user enter shooting mode, I want the camera to turn around the player to face the target.

In the image above. "O" is the player (Origin), "L" is the lookat, "C" is the camera position and "T" is the target. I want to rotate the lookat line C->L so that it passes by T (C'->L'->T') around the Origin ("O").

Basically I need to find the angle alpha that I put in red in the picture.

I store my camera position in a structure like such :

struct CameraTarget {
     Quaternion absoluteRotation;
     Vec3 absolutePosition;
     Vec3 cameraOffset;
     Vec3 lookatOffset;
     float FOV;
}

So if I could find the angle I'm looking for I could do something like :

cam->absoluteRotation = cam->absoluteRotation * alpha;

To get the player to always look at the target.

If the lookat was passing by the Origin I could simply do

Vec3 origDir = cam->lookAtOffset - cam->absolutePosition;
origDir.normalize();
Vec3 newDir = cam->target - cam->absolutePosition;
newDir.normalize();
Quaternion q(origDir, newDir); // from->to
cam->absoluteRotation = cam->absoluteRotation * q;

However in the diagram above this doesn't quite work since the rotation is offset from the Origin.

sentences:
How can I use shaders in Unity to write a scientific computing program? I want to write a GPU shallow water code on Unity3D. For sure, performance matters a lot. I've done this before using DirectX and C++. But for a couple of reasons I want to redo it in Unity3D.

I have some hands on experiences with Unity3D, but I have no idea how I can write GPGPU codes, like what I did in DirectX.

In DirectX I am using textures as my data structure for the properties of water cells (height, x-velocity, y-velocity, etc.) and HLSL shaders as my parallel computational functions (kernels).

Furthermore, I prefer my code to be [near] cross-platform. Is it possible to do something similar in Unity3D using OpenGL?

I am an engineer, and not a game developer, so please keep it simple ...

sentences:
Making Scene at editor mode On Button click at editor mode I am trying to make a scene of selected Hierarchy game-object but the problem is as i click the button new scene
     become upon and I lost the scene where i were selected the Game-object. My code given below:

 if (GUILayout.Button("Generate Scene"))
        {
            Scene newScene = EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects);;
            SceneManager.MoveGameObjectToScene(Selection.activeGameObject, newScene);
            EditorApplication.SaveScene("Assets/RegionScene/" + gameObjectSelected[gameObjectSelected.Count - 1].name + ".unity"); //newScene

        }

sentences:
Second Animation is not working after Collision? I want to show an accident of Character with car. so I wrote this code
and in update function I wrote this...

        if (Once) {

                    Criminal.GetComponent<Animation> ().Play ("Running"); // after collision This animation will work
                    Criminal.GetComponent<BezierMover> ().enabled = true;
                    TrafficCar.GetComponent<BezierMover> ().enabled = true;
        }
void OnCollisionEnter (Collision col)
{
    if (col.gameObject.tag == "Vehicle") {
        if (!Criminal.GetComponent<Animation> ().IsPlaying ("Stumbling"))
            Criminal.GetComponent<Animation> ().Play ("Stumbling"); // Animation for Accident
        Criminal.GetComponent<BezierMover> ().enabled = false; // to Deactivate the AI Script.
        TrafficCar.GetComponent<BezierMover> ().enabled = false; //to Deactivate the Trrafic cars Path Script.
        Once = true;
    }
}

but after first animation second animation should work but this is not happening..

sentences:
HLSL DXGI_FORMAT_A8_UNORM Texture - dark colors appear less opaque than white I am trying to render a DXGI_FORMAT_A8_UNORM texture (precisely, a font bitmap) in multiple colors by specifying the color per vertex and then apply the alpha value from the sampled texture in the pixel shader. When white is specified as the vertex color, the rendered texture looks as expected, however with darker colors the texture looks "thinned" or less opaque, as displayed in the attached picture.
These are the used shaders, with fontSampler using D3D11_FILTER_MIN_MAG_MIP_POINT as filter:

Texture2D shaderTexture : register(t0);
SamplerState fontSampler : register(s0);

struct VS_INPUT
{
    float2 pos : POSITION;
    float4 col : COLOR;
    float2 tex : TEXCOORD0;
};

struct VS_OUTPUT
{
    float4 pos : SV_POSITION;
    float4 col : COLOR;
    float2 tex : TEXCOORD0;
};

VS_OUTPUT VS(VS_INPUT input)
{
    VS_OUTPUT output;
    output.pos = mul(projection, float4(input.pos.xy, 0.f, 1.f));
    output.col = input.col;
    output.tex = input.tex;
    return output;
}

float4 PS(VS_OUTPUT input) : SV_TARGET
{
    input.col.a = shaderTexture.Sample(fontSampler, input.tex).a;
    return input.col;
}

sentences:
How to shoot on direction of touch I'm new to the Corona SDK(and I also suck in trigonometry) and I'm trying to achieve this:

Shoot a bullet from the player, towards the direction of the point the user touched, but always with ethe same speed, regardless of how far the touch was from the player.

I have tried several solutions. After some research I saw that I should calculate the angle from the two deltas in degrees, and then use the cos and sin of the angle as the x and y values respectively. But when I try to do so, I get pretty random results.

The closer I was able to get from what I want to achieve was to use the delta variables as the X and Y (multiplied by the speed factor). It worked, but then the speed varied based on how far from the player I touched and I want the speed to be fixed.

Here's my latest code(using sin and cos)

local math, physics = require("math"), require('physics')

physics.start()
physics.setGravity( 0, 0 )

display.setStatusBar( display.HiddenStatusBar )

local screenW, screenH = display.contentWidth, display.contentHeight
local playerX, playerY = (screenW / 2), (screenH / 2)

local player = display.newRect( 0, 0, 30, 30 )
player.x = playerX
player.y = playerY

-- local sinT = display.newText("", 100, 10)
-- local cosT = display.newText("", 100, 30)
local angleT = display.newText("", 100, 70)

local function onScreenTouch( event )
  if (event.phase == "began") then
    speed = 3
    deltaX = event.x - playerX
    deltaY = event.y - playerY

    angle = math.atan2( deltaY, deltaX ) * 180 / math.pi

    -- sin, cos = math.sin( angle ), math.cos( angle )

    -- sinT.text = sin
    -- cosT.text = cos
    angleT.text = angle

    bullet = display.newRect( 0, 0, 6, 6 )
    bullet.x = playerX
    bullet.y = playerY

    physics.addBody( bullet )

    bullet:setLinearVelocity( math.cos( angle ) * speed, math.sin( angle ) * speed )
  end
end

Runtime:addEventListener( "touch", onScreenTouch )

sentences:
Java/Libgdx Pixel game with individual pixel changing I am currently trying to make a game with pixelated graphics. The game is supposed to run with as few textures as possible. Instead of this it is supposed to generate the levels randomly, and fill in the pixels accordingly.

I would like to change pixels individually, since this way, I only can change the pixels that have to be changed, which seems to me to be the most efficient way.

What would be the fastest way in which I could achieve individual pixel updating/changing?

I have tried Pixmaps but they seem  to be very slow and in order to draw them as far as I could find you have to create a new texture from the pixmap for every frame.

Drawing each 'pixel' as a square texture also seems to be a very inefficient way.

Does java/Libgdx have a 'fast' way of doing this?

I also saw a lot of people in other Posts recommending to use bufferedimage from the Java2D library. However, I am not sure if this can be combined with Libgdx functions and textures, which I will need for some entities. As far as I could see it requires you to use a Java2D graphics window.

Can you still use some textures in java2D?

sentences:
What is Ogre::String? I was working with the OGRE .NET bindings (MOGRE) for quite a long time. To improve my (not that good) C++ skills, I am switching from C# to C++.

After implementing a basic OGRE application, I was curious why Ogre has it's own String class Ogre::String?
Why is it used and not std:string?

Can/shall I mix these String types and what shall I use in my OGRE application for non-OGRE tasks/methods?

sentences:
Collision detected at different times depending on speed? Imagine a scenario where there are four cubes. Two blacks that do not move, one red moving at a constant speed of two (2) straight and the other blue moving at a constant speed of five (5) also straight.

They all have equal bounding boxes.

By doing a test, I realized that if I put a command so that as soon as the red cube strikes against the black it turns left, the command does not run as soon as they collide ...

With the blue he wanted him to turn right as soon as he hit. The command takes longer to happen, I think because it is faster than red ...

Illustration of the incident:

It seems that the faster the object is, the longer it responds to the collision command. I would like you to give me a solution to this problem.

I've already moved with some bounding box options, but nothing that has given the desired result.

I also moved at the speed of the room, but it did not work either.

Sorry for any translation error. Thanks in advance!

sentences:
What data should a generic collision detection system gather? I'm working on a relatively generic 2D AABB collision detection system for a game engine, and I've re-written it more times than I'd like to admit, due to not calculating or recording specific details of each collision. Right now, this is what I'm collecting:

Collision time as a fraction of an update cycle in the game loop.
Location of the collision.
ID of the colliding object.

Each object has a Set that holds this data for each collision (I'm working with a component/entity system) so other systems can use the recorded data. The problem I just ran into was that I needed to know which side of the object the collision takes place on.

What other values or points of interest should I calculate or record, per collision? What do you look for in a standard collision detection system?

sentences:
Change animation speed through the editor in Unity How can I change the speed of the animation through the editor if I have the following animation structure?

I would like Adult1@walk to play faster.

sentences:
How to display a hierarchical skill tree in php If I have skill data set up in a tree format (where earlier skills are prerequisites for later ones), how would I display it as a tree, using php?  The parent would be on top and have 3 children. Each of these children can then have one more child so its parent would be directly above it.

I'm having trouble figuring out how to add the root element in the middle of the top div, and the child of the children below each child of the root.  I'm not looking for code, but an explanation of how to do it. My data in array form is this:

Data:

Array
(
    [1] => Array
        (
            [id] => 1
            [title] => Jutsu
            [description] => Skill that makes you awesomer at using ninjutsu
            [tiers] => 1
            [prereq] =>
            [image] => images/skills/jutsu.png
            [children] => Array
                (
                    [2] => Array
                        (
                            [id] => 2
                            [title] => fireball
                            [description] => Increase your damage with fire jutsu and weapons
                            [tiers] => 5
                            [prereq] => 1
                            [image] => images/skills/fireball.png
                            [children] => Array
                                (
                                    [5] => Array
                                        (
                                            [id] => 5
                                            [title] => pin point
                                            [description] => Increases jutsu accuracy
                                            [tiers] => 5
                                            [prereq] => 2
                                            [image] => images/skills/pinpoint.png
                                        )

                                )

                        )

                    [3] => Array
                        (
                            [id] => 3
                            [title] => synergy
                            [description] => Reduce the amount of chakra needed to use ninjutsu
                            [tiers] => 1
                            [prereq] => 1
                            [image] => images/skills/synergy.png
                        )

                    [4] => Array
                        (
                            [id] => 4
                            [title] => ebb & flow
                            [description] => Increase the damage of water jutsu, water weapons, and reduce the damage of jutsu and weapons that use water element
                            [tiers] => 5
                            [prereq] => 1
                            [image] => images/skills/ebbandflow.png
                            [children] => Array
                                (
                                    [6] => Array
                                        (
                                            [id] => 6
                                            [title] => IQ
                                            [description] => Decrease the time it takes to learn a jutsu
                                            [tiers] => 5
                                            [prereq] => 4
                                            [image] => images/skills/iq.png
                                        )

                                )

                        )

                )

        )

)

An example would be this demo image minus the hover stuff.

sentences:
Bullet: Get steepness or slope between positions In a CharacterController object, there is

setMaxSlope(btScalar slopeRadians)
The max slope determines the maximum angle that the controller can walk up.

But how about knowing it in advance? Like check if the position where the character will move next is walkable (i don't know the correct word) or not? Is that possible? Any suggestions on how should I go about this?

sentences:
Trying to better understand Unity gameobjects New to Unity, but develop in C# normally.  I can't seem to get how / why / where to grab certain elements.  For simplicity, I have a top-level game object, say a cube.  I add a sphere to the scene as child to the cube. The child sphere (actually more complex), has navigation mesh, animation object, collider and finally a script in C#.

Now, my C# class is comprised of an instance of an C# class on the class.  Something like

public class CMyGeneric
{
   public void someMethod()
   {
      // invalid getting to "gameObject" reference
   }
}

public class CMyMainScript
{
   public CMyGeneric myGeneric;

   void Start()
   {
      myGeneric = new CMyGeneric();
   }

   void Update()
   {
      myGeneric.someMethod();
   }
}

So, the parent game object is the cube, the child is the sphere, and the CMyMainScript script is attached to the sphere.  However, when I try to reference "gameObject" via the CMyGeneric (instance), call within the "someMethod", the "someMethod" doesn't appear to see the overall "gameObject".

Now, how/what am I missing as each thing that gets attached, unity adds to these game objects, and I don't know how to get respective hierarchical levels of where things are even though I know where they are from a relative perspective.

sentences:
Why does releasing a pressed "f" key not prevent the coroutine from spinning? I am learning Unity and the following is my simplification of the code presented on Coroutines.

My expectation is that the Fade() just spins in a very very short period of time because the GetKeyDown("f") is true only at the transition from "unpressed" to "pressed" states.

However in the following code, the Fade() spins from f=0 to f=999 continuously (non stop in one go) rather than for example, from f=0 to f=100 at the first key press and from f=101
to f=159 at the second key press, etc.

IEnumerator Fade()
{
    for (int f = 0; f < 1000; f++)
    {
        Debug.Log($"{f}");
        yield return null;
    }
}

void Update()
{
    if (Input.GetKeyDown("f"))
    {
        StartCoroutine("Fade");
    }
}

Question

What causes this unexpected result and how to solve it?

sentences:
Programatically Build List of Custom Class Objects (prefabs) This seems like it should be a simple thing, but I cannot seem to figure out a method.

Currently, I have a public List<MapGraphItem> roomList variable, and in the inspector, I add prefabs from Tiled2Unity for a given biome - currently a list of nine tiles for my test biome.  Map generation works great via this method. MapGraphItem is a custom class that is applied to these prefabs via script.

I'd like to programmatically build the list so that I can build it appropriately based on the biome that's being called (dungeon, forest, desert, et cetera).  I seem to be having trouble getting unity to put together a list of the items anyhow (they are in a specific assets folder and also have a specific prefix, in this case "dng_").

I tried this and some variations on it:

List<GameObject> _obj = GameObject.FindObjectsOfType(typeof(GameObject)).Select(g => g as GameObject).Where(g => g.name.StartsWith("dng_")).ToList();

But it seems the objects need to be loaded first (plus, I'd need to convert it to a List<MapGraphItem> before using it).

I could add another field to the MapGraphItem class for biome type and basically load ALL of the assets, but that's a huge waste of resources.  Manually adding these for each biome is really not ideal, and really not efficient.

Thanks!

sentences:
Transitioning Heightmaps Using Voronoi Cells I'm partitioning a procedurally generated world into regions using voronoi noise. The goal is to create individual regions in a world each unique from each other. Each region has a distinct set of properties, one of which is having a procedurally generated heightmap.
The issue I am having is transitioning from one region's heightmap to another. Each region's heightmap  is composed of multiple 'layers' of simplex fractal noise. Because the regions are using voronoi cells, and each region has its own distinct heightmap, they do not smoothly transition into each other.
Any guidance on how to solve this issue would be greatly appreciated!

sentences:
How can I create a wind visual effect like Ori? I'm working on a mobile game in Cocos2D. The game mechanic is very similar to Ori and the Blind Forest's parachute (Kuro's feather) mechanic. I want to be able to render a visual effect for wind similar to Ori's (see here) to make parachuting feel better, but I'm a bit at a loss on how to do it.

Do I make a custom shader that draws everything from scratch? Do I start with a wind texture and apply some transformations to it?

I think adding particles that blow around in the wind is pretty simple but the ribbony wind field look in addition to particles would feel much better.

In case the video dies (but an image doesn't do the effect justice, it's very dynamic):

sentences:
Meaning of offset in pygame Mask.overlap methods I have a situation in which two rectangles collide, and I have to detect how much did they collide so I can redraw the objects in a way that they are only touching each other's edges.

It's a situation in which a moving ball should hit a completely unmovable wall and instantly stop moving. Since the ball sometimes moves multiple pixels per screen refresh, it is possible that it enters the wall with more than half its surface when the collision is detected, in which case I want to shift its position back to the point where it only touches the edges of the wall.

Here is the conceptual image it:

I decided to implement this with masks, and thought that I could supply the masks of both objects (wall and ball) and get the surface (as a square) of their intersection. However, there is also the offset parameter which I don't understand.

Here are the docs for the method:

Mask.overlap

    Returns the point of intersection if the masks
    overlap with the given offset - or None if it does not overlap.
    Mask.overlap(othermask, offset) -> x,y

    The overlap tests uses the following offsets (which may be negative):

   +----+----------..
   |A   | yoffset
   |  +-+----------..
   +--|B
   |xoffset
   |  |
   :  :

sentences:
Trouble with Raylib install on Arch Linux I am learning Raylib game library, but in the "First Person Maze" example the images cannot be found, for example:
`Image imMap = LoadImage("cubicmap.png");`

returns a File not Found by the compiler/linker, it´s the same with the other image. I am using CodeLite IDE, but I don't know how to add assets, right now I have them in a virtual folder named "resources".
Any help would be nice, I have googled the problem but I can't find anything. But now I don't know what's wrong because I have compiled the library with make and make install and also added Raylib package from Arch Linux and I can't even run the My first window example from the site.

sentences:
Unreal Engine 4 - AI MoveTo always fails I try to move a character with AI MoveTo, but it always fails. I tried to do this with standart ThirdPersonController and a custom one. The blueprint is simple

When the event happens, it starts printing "failed". I checked many times if I have a NavMesh on the level or any other problems with it, but I don't think there are any problems with that. Any ideas?

sentences:
How can I cancel a contact in a b2ContactListener? To know when contacts happen we can derive from b2ContactListener and implement our own solution which is great. I'm wondering is there anyway we can cancel a contact, that is to say when we hit begin contact we call a function or do something to destroy the contact before it has a chance to be resolved?

My game logic relies on setting any number of collision groups (which are basically integers). Collision groups can have settings to interact with one another, for example collision group 41 and 13 may be set to never collide while group 41 and 56 will collide. Some groups which are set not to collide are still meant to generate an OnContact callback (but will obviously never get to end contact).

sentences:
How do I convert DirectX's .X from binary encoding to text encoding and back As far as I know, .X format can be text encoded and binary-encoded.

I basically want to look into the model I'm playing with, get a better understanding of .X, possibly make some changes in it and convert back.

sentences: Why is there almost never online multiplayer in indie games? There are alot of which are local but very few who have online.

sentences:
Unity3D: Efficiently loading chunks in an infinite voxel engine I'm developing a voxel engine in C# using Unity and I'm currently trying to implement infinite terrain, so I took a look at other Unity voxel engines that have infinite terrain. I've seen three different ways of doing it:

Using a dictionary to store the chunks and store the block data in another dictionary
Using a dictionary to store the chunks and store the block data on every chunk
Using a fixed size array and shifting it every time the player moves

The engines using approach 1 and 2 were pretty slow at chunk loading.
The engines using approach 3 were faster but produced lag every time the player entered a new chunk.

I've already tried to implement it using approach 1, but my chunk loading speed got slower by about 10 times, so it was really unplayable.

How is it done in efficient or popular voxel engines like Minecraft or VoxelFarm?
Do you have experience with voxel rendering and know a better approach?

Thanks in advance!

sentences:
Selective Image Effects with Stencils I am trying to create an image effect where only a part of the image has the effect applied to.

One way I can think of to do this is to define the portion of the image using the stencil buffer.

Stencil Mask Shader:

Stencil
{
    Ref 1
    Comp always
    Pass replace
}

Image Effect Shader:

Stencil
{
    Ref 1
    Comp equal
    Pass keep
}

OnRenderImage Function

void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    saturationPassMat = CheckShaderAndCreateMaterial(saturationShader, saturationPassMat);

    saturationPassTex = RenderTexture.GetTemporary(source.width, source.height, 24);
    Graphics.SetRenderTarget(saturationPassTex.colorBuffer, source.depthBuffer);

    Desaturate(source, saturationPassTex, saturation);

    Graphics.Blit(saturationPassTex, destination);

}

Applying the stencil portion of the image effect shader to any other object produces a desirable stencil effect (aka: it works).

The Problem:

By the time OnRenderImage is called, it seems that the stencil buffer has already been cleared. Changing Ref to 0 in the Image Effect shader will apply the effect to the entire screen. Any other value will result in a black screen. This can only mean that the stencil buffer has been cleared to 0.

Is there a way to prevent the stencil buffer from clearing? Or is this the right method to use the stencil buffer with image effects? Or perhaps there are other solutions that are still efficient, without the use of Stencils?

sentences:
Procedural generation of jagged peaks I would like to generate random cave type backgrounds similar to the one shown below.

I doubt anything I generate will look as good as the image, but something with that feel of sharp, jagged peak should be possible.

I don't have any experience in procedural generation and as such have no idea where to start....

Note: I am using libGdx on Android

sentences:
How can I inspect 3D model exactness? I am neither a game designer nor a graphic designer. I am a .Net and C#
software developer. I have a game project and I've still been studying to learn
game concepts and technolgies for a year.

I've decided to create a 3D based and networked MMO game with Unity3D.
I've planned to hire graphic artists to do my game assets.
However, I only know what I want? In other words, I only know concept of 3D models.

What I have to request from graphic artists and how can inspect their work?
Do I have to determine some quality criterias or something like this?
Same questions are also valid for humanoid and NPC animations.

Thanks

sentences: What is Ramp Shading or Lighting? What is ramp shading or lighting and how does it work? Is it different than toon shading or is it the same concept? How is specularity calculated differently for ramp shading versus blinn-phong or lambert?

sentences:
(Java) Trying to animate an arraylist of coins with a (working) animation class I have a coin class which takes in an integer numOfCoinsand an enum LayoutType, which can be linear or curved. A linear layout displays the coins in a straight line one after the other - we'll work with this since the method is small and straight forward.

My constructor looks like this:

public Coin(float xPos, float yPos, int numOfCoins, LayoutType layout) {
        setType(ObjectType.COIN);
        coinList = new ArrayList<Coin>(); // arraylist of coins
        setPos(xPos, yPos); // set starting position of coin(s)
        if (layout == LayoutType.LINEAR)) {
            linearLayout(); // display coins in a straight line
        } else if (layout == LayoutType.CURVE{
            curveLayout();
        }

}

And my linearLayout() method looks like this

public void linearLayout() {
        //draw numOfCoins amount of coins in a straight line
        for (int i = 0; i < numOfCoins; i++) {
            Coin coin = new Coin(xPos, yPos);
            coinList.add(coin);
            xPos += 50; // place coins 50 pixels apart
        }
}

I have a working animation class and a spritesheet for the coins - however, the way I have modelled my coins is in such a way that 1 coin object can contain numOfCoins amount of coins, so I can't just directly call the animation in the draw method.

The class' draw() method is in an abstract class GameObject which Coin extends. It looks like this:

public void draw(SpriteBatch batch) {
    // if the object is a coin iterate through the list of coins
    // and draw the sprites, if it isn't a coin, simply draw the objects sprite
    if (type == ObjectType.COIN) {
        for (Coin coin : getCoinList()) {
            coin.getCoinList().draw(batch);
        }
    } else {
        sprite.draw(batch);
    }
}

This draw() method is called in World.render().

How would I create an animation using my Animatorclass for each coin if I have 6 coins in a straight line for instance? I can't seem to find a way. Highly grateful for any help, thanks.

sentences:
Has there been any research done on ideal values for loot drop tables? I doubt many people want to grind for an item that has a 0.00001% chance to drop from a boss that takes 30 minutes to kill. I'd imagine there are certain factors that play into how rare an item should be. For example

if an item is part of a set
if the item comes from a boss vs a regular mob
how many stats/magical properties an item has

does anyone know of some research that has already been done or some data on this sort of idea. I can't be the first person to think of this.

sentences:
DirectX D3DXVec3Normalize unresolved external symbol I have simple DirectX project:

#include <d3dx10.h>
#include <d3dx10math.h>

#pragma comment(lib, "d3d10.lib")
#pragma comment(lib, "d3dx10.lib")

int main()
{
    D3DXVECTOR3 u(1.0f, 2.0f, 3.0f);
    D3DXVECTOR3 v(2.0f, 1.0f, 3.0f);
    D3DXVECTOR3 a, b, c, d, e;

    float l = D3DXVec3Length(&u);
    float s = D3DXVec3Dot(&u, &v);

    D3DXVec3Normalize(&d, &u); // <- problem is here

    return 0;
 }

I added "include" and "lib" directories in my project properties and everything works fine, except D3DXVec3Normalize line. When I run the program it says: "error LNK2019: unresolved external symbol _D3DXVec3Normalize@8 referenced in function _main".

Can anyone explain why D3DXVec3Length and D3DXVec3Dot functions work OK (without Normalize line) and D3DXVec3Normalize produces error?

P.S. I use DirectX SDK June 2010 and Visual Studio 2012.

sentences:
How to check if a specific instance of a prefab is pressed? This one is hard to explain, so I'll show the code first -

for (var i = 0; i < Input.touchCount; ++i)
{
    if (Input.GetTouch(i).phase == TouchPhase.Began)
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);
        RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction);

        if (hit)
        {
            clicksNeeded -= 1;
            GetComponentInChildren<TextMesh>().text = "" + clicksNeeded;
            Debug.Log(clicksNeeded);
            print("was a hit");
        }
    }
}

I need to check if hit touches the specific game object that the script is linked to, as at the moment if any of the circles are clicked, clicksneeded -= 1 to all objects currently instantiated.

Thanks for the help!

sentences:
Automating the process of creating a steam lobby (for dota) and inviting users to it I'm working on a Ruby on Rails web-application and I want to create lobbies and send invitations to users to join these lobbies. Simply, I want to achieve ISteamMatchmaking Interface functionality of Steam SDK but the problem is that sdk in written in C/C++ and I would have to write wrapper to integrate sdk in my application.

My question is that is there some easy and less time consuming approach to achieve ISteamMatchmaking Interface functionality in web-application?

I'm using RoR but I'm open to use other technologies too.

sentences:
Am I allowed to push my Unity based game's source code to github? I got the Personal version of Unity 5.5 to play around with it1. Let's say I own the rights on all the assets I use in my project, or they are licensed in a way that allows me to use, modify and republish them. That includes all the scripts, models, images, sounds and whatnot. But what about the fact that it's built with a commercial game engine?

Do the Unity terms allow me to host my project's source folder (including the assets) on github? Do I need to include a certain license for that?

Note that I don't care about releasing the game, I'm just talking about sources of stuff I am making to learn the technology.

1) no pun intended

sentences:
In a semi-infinite procedural (chunk based) map, how do you handle objects larger than a single chunk? I'll use an example to try and be more specific. Assume this is for a 2D top-down game. Chunks in this are made up of 32x32 tiles.

If procedural buildings were to be generated based on some kind of noise algorithm and a building was typically 3x3 chunks in size, how do you ensure the seed for this map will always produce the same buildings?

Given two adjacent chunks: chunk A and chunk B, what if they both meet the noise algorithm's requirement for being a spawn point for a building?

If they are both far from the player's current view range, it could depend on how the player approaches these chunks as far as which one gets generated first.

My first thought was to only check for buildings every so many chunks, however, I'd also like to have some objects that may span tens of chunks. I don't think this is a proper solution.

Should I simply be using a different type of algorithm to identify where buildings should be able to be spawned at, an ever expanding Voronoi diagram as an example, or is there something else I'm just not considering with how I'm already trying to attempt this? Perhaps I should be handling cross chunk objects on a grander scale (like a collection of 32x32 chunks)?

Thanks!

sentences:
Is "Check your surroundings" warning on splash screen really needed for geolocation games? I'm currently building an Android game as a solo dev. It follows the trend of geolocation-based games (like Niantic), but with more unique aspects.

Anyway, I noticed that in Niantic games - Ingress, Pokemon Go - there's always a "check your surroundings" or "don't drive and play" kind of warning to the player in the splash screen. I'm afraid that it might have something to do with legal implications regarding people being trampled or fall to their death while playing.

While I'm definitely not a fan of losing my player base / cause pain and sorrow to their families, I still see no reason to add this to my game. Because let's face it, people promptly ignore warnings like that and play the way the want in the end.

My case is somehow different from most geolocation games, in the sense that one of its unique features is that you don't need to keep looking at the screen to play. In case it helps to clarify how it works here is the play store's link: https://play.google.com/store/apps/details?id=com.arvere.theforage (I'm not sure if this is compliant with SE's rules, if it isn't, I ask to some mod to remove it, please)

So, would there be any reason (besides legal security) to do this in a game like mine?

sentences:
How can I compute the orbit of one body around another? I'm attempting to have a planet (with a known mass and radius) orbit it's sun (also with a known mass and radius). It doesn't have to be 100% realistic, but it should be possible that the sun have more than one planet orbit it at a time.

What equations should I use to accomplish this?

sentences:
When attaching AI to a vehicle should I define all steps or try Line of Sight? This problem is related to an intersection simulation I am building for university. I will try to make it as general as possible.

I am trying to assign AI to a vehicle using the JMonkeyEngine platform. AIGama_JmonkeyEngine explains that if you wish to create a car that follows a path you can define the path in steps. If there was no physics attached whatsoever then all you need to do is define the x,y,z values of where you want the object to appear in all subsequent steps. I am attaching the vehicleControl that implements jBullet. In this case the author mentions that I would need to define the steering and accelerating behaviors at each step.

I was trying to use ghost controls that represented waypoints and when on colliding the car would decide what to do next like stopping at a red light. This didn't work so well. Car doesn't face right.

public void update(float tpf) {
    Vector3f currentPos = aiVehicle.getPhysicsLocation();
    Vector3f baseforwardVector = currentPos.clone();
    Vector3f forwardVector;
    Vector3f subsVector;

    if (currentState == ObjectState.Running) {
        aiVehicle.accelerate(-800);
    } else if (currentState == ObjectState.Seeking) {

        baseforwardVector = baseforwardVector.normalize();
        forwardVector = aiVehicle.getForwardVector(baseforwardVector);
        subsVector = pointToSeek.subtract(currentPos.clone());
        System.out.printf("baseforwardVector: %f, %f, %f\n", baseforwardVector.x, baseforwardVector.y, baseforwardVector.z);
        System.out.printf("subsVector: %f, %f, %f\n", subsVector.x, subsVector.y, subsVector.z);
        System.out.printf("ForwardVector: %f, %f, %f\n", forwardVector.x, forwardVector.y, forwardVector.z);

        if (pointToSeek != null && pointToSeek.x + 3 >= currentPos.x && pointToSeek.x - 3 <= currentPos.x) {
            aiVehicle.steer(0.0f);
            aiVehicle.accelerate(-40);

        } else if (pointToSeek != null && pointToSeek.x > currentPos.x) {
            aiVehicle.steer(-0.5f);
            aiVehicle.accelerate(-40);
        } else if (pointToSeek != null && pointToSeek.x < currentPos.x) {
            aiVehicle.steer(0.5f);
            aiVehicle.accelerate(-40);
        }
    } else if (currentState == ObjectState.Stopped) {
        aiVehicle.accelerate(0);
        aiVehicle.brake(40);

    }
}

sentences:
Finding coordinate in radius Hello i have two points (Vector3) A and B. And have a radius r

How can i find a coords of point P in a circle by angle?

sentences:
How do you construct a node map for pathfinding in a non-tiled 2D environment? A* and Dijkstra's pathfinding algorithms work by navigating a node map. In a tile-based 2D environment, these nodes could easily be inferred to be the literal x,y positions of the map.

For example, the agent is at (0,0), an obstacle is at (0,1), and the agent wants to go to (0,2).

However, in a 2D environment where locations are represented using floating point variables float x, float y, agents and obstacles can exist between the traditional style nodes (0,0) and (0,1).

How do you create a node map from such an environment?

sentences:
Change unity physics engine speed Is there a simple way to change the speed* of unity's physics engine like in the game SuperHot?

Any script language is ok but javascript is preferred.

*I am not sure if speed is the correct term.

sentences: How do you calculate the nearest point on 2 curves? Given the points of a line and a quadratic bezier curve, how do you calculate their nearest point? .... Similarly, given the points of 2 curves, how do you get the nearest point?

sentences:
How do I add an "offset" to LookAt? I have created a Third Person Controller.
The camera is behind the player:

I would like to make it so that the player aims at the mouse pointer position.
To do that, I use the following code to rotate the chest towards the position:
        var mousePos = Input.mousePosition;
        mousePos.z = 10; // Make sure to add some "depth" to the screen point
        var aim = Camera.main.ScreenToWorldPoint(mousePos);
        Chest.LookAt(aim);

The hands do not perfectly straightly point forwards, so I need to add an "offset" to the LookAt.
I tried this approach:
var mousePos = Input.mousePosition;
mousePos.z = 10; // Make sure to add some "depth" to the screen point
var aim = Camera.main.ScreenToWorldPoint(mousePos);
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Chest.LookAt(aim);

Of course I do all rotation patching in LateUpdate(). In Update(), it would simply be erased by the animation itself.
It does work, but when the model is rotated around the Y axis, something goes wrong: The offset is "wrong", it doesn't have the same effect.
This surprises me because all I do is rotate the entire model.
So I think this line is not correct:
aim += new Vector3(ChestAimCenterOffsetForLookatBecauseChestIsNotStraightForward, 0, 0);

Is this not the way to offset the LookAt results?

sentences:
pygame - avoiding sprite 'jitters' on rotating the image Is there a common trick for getting around sprites that are changing directions 'too quickly' and causing their sprite to display erratically?

In this project, the player moves in 8 directions by determining the abs() distance between the mouse's X and Y coordinates and its own obj.rect.center. If the absolute value is less than obj.speed, it simply moves to that point. If it is greater, it moves the distance its speed allows it to move in that direction. When it's time to draw the sprite, PyGame rotates it in accordance to obj.direction by using a dict called SPINNER with stored default values to pass to pygame.transform.rotate.

def draw(obj):
    drawImg = pygame.rotate.transform(obj.img, SPINNER[obj.direction])
    drawCtr = drawImg.get_rect(center=obj.rect.center)
    DISPLAYSURF.blit(drawImg, drawCtr)

This is fine for the foolish AI characters which typically make very few course corrections - however, small movements of the mouse can cause the player's obj.direction to update very quickly, which looks chaotic.

Is there a simple way to curb this behavior? My first guess is to bog down the player object with values that retain its previous state and then determine the amount of rotation to apply, but I have a feeling the better solution is to assign that responsibility to the 'view' and not the 'model'. I'm not sticking to any hard and fast rules regarding MVC, but I am trying to engage in enough separation of concerns that 'view-like methods' don't make 'controller-like' changes to 'model-like' objects, if that makes sense.

sentences:
Set parent by property In the editor's hierarchy, if I drag and drop one object onto another, the second becomes the parent of the first, and moving the parent will cause the child to move. I see I can set this relationship in code by setting the transform.parent property. So I wrote a component to help with doing that from code:

public class ParentTo: MonoBehaviour
{
    public GameObject _parent;

    public GameObject Parent {
        get { return _parent; }
        set {
            this.transform.parent = value.transform;
            this._parent = value;
            Debug.Log("Set parent");
        }
    }
}

So to test it, I have 2 cubes in the scene. On cube 2 I put the ParentTo script, leaving it with no parent set, then start the game and use the editor to drop Cube 1 on that field in the inspector. According to the inspector, it seems to have been set right, but the debug statement doesn't appear in the console and moving Cube 1 doesn't move Cube 2. What am I doing wrong?

sentences:
How to combine objects in a rendered scene with and without bloom effect? I'm working on a game and engine as I go under OpenGL.

I've had a bloom effect in place for a while that works as a post-procesing effect on the entire screen. It's been fine up until now.

I have an object that is made up of a few meshes, and one of these meshes is mostly white. The result is it blooms like crazy, but I really don't want it to.

The only way around it I can see is that the objects I do want to have bloom would need to be rendered to a bloom-framebuffer from which I can bloom (and store the depths) to then mix back in with the rest of my scene.

Is this the only way to go about it? It seems like a lot of work to simply isolate something from a screen-wide affect.

sentences:
LibGDX buttons bounds are wrong I am making a simple gui in libgdx and run into this problem ; when you click on the button it's bounds (?) are wrong since if I click under it, the game registers it as a click.

On the other end, if I click it at the top it won't get the click. It seems like the bounds are a bit under the button. I tried to set manually but nothing.

Also i tried changing sizes.

Looked here : too this is almost the same but no answer..

tabl = new Table();
    stage =new Stage();
    tabl.setSize(stage.getWidth()/2, stage.getHeight()/2);
    tabl.defaults().size(500, 40);

    g = game;

    Gdx.input.setInputProcessor(stage);

    skin = new Skin();

    TextureAtlas te = new TextureAtlas(Gdx.files.internal("uiskin.atlas"));

    skin.addRegions(te);
    skin.add("default-font", new BitmapFont());
    skin.load(Gdx.files.internal("uiskin.json"));

    Pixmap r = new Pixmap(100,100,Format.RGBA8888);
    r.setColor(0xff0000ff);

    r.fillRectangle(1, 1, 13, 13);
    Texture s = new Texture(r);
    SpriteDrawable s1 = new SpriteDrawable(new Sprite(s));

    TextButton gam = new TextButton("new games",skin);

    gam.addListener(new InputListener() {
        @Override
        public boolean touchDown(InputEvent event, float x, float y,
                int pointer, int button) {
            // TODO Auto-generated method stub
            //g.setScreen(null);
            new Logger("e").setLevel(10);
            return true;
        }
    });

    /*super.getS*/
    LabelStyle tt = new LabelStyle(new BitmapFont(), Color.BLUE);
    Label l = new Label("d",tt);

    tabl.add(gam);

    tabl.setDebug(true);

    stage.addActor(tabl);

sentences:
Scale sprite between two points I need to start a sprite at a scale .6 (scale1) at a y position 40 (yPos1). Knowing the end y position 560 (yPos2) and the end scale 1 (scale2):

How do I calculate the scale at various y positions between yPos1 and yPos2?

sentences:
Simulating Gas Density and Pressure in a 2D World I'm building a small spaceship simulation app that looks a lot like a game for an upcoming talk I'm giving where I use this sample app to teach the F# programming language.

This small app is something like FTL meets Oxygen Not Included where you have a top-down 2D grid of tiles (similar to an old RPG) where each tile has its own mixture of gasses - right now oxygen and carbon dioxide, but potentially others.

I've got a few things I'm trying to simulate:

When new gasses are added to a tile by something like a vent or a life support system, that gas should expand to neighboring tiles if possible
When a pressure changes (e.g. opening a door to another area of the ship or a hull breach), air should flow from the high pressure tile to the low pressure tile next to it.

Given this, and given that some gasses naturally sift to the top of others, I'm trying to figure out a small set of simple rules to govern this behavior.

Previously I had all gasses equalizing with their neighbors and no concept of pressure, but that made it very difficult to treat scenarios like hull ruptures, so I'm looking for something a bit more realistic without getting complex or hyper-accurate.

For example, given tile A with 15g oxygen and 6g CO2 and neighboring tile B of 3g oxygen and 1g CO2, some air should clearly flow from A to B. However, what flows? Is it the lightest gasses? The heaviest gasses? A random or representative sampling of gasses in A? Are there any relevant physics principles I should be aware of?

Note: I posted here instead of in physics because I don't care extremely about nuanced accuracy, just something simple and believable

sentences:
Make players Rigibody move in direction its going? I have my snowboard character which I am trying to fix the movement for. At the moment, The player is using transform.forward on the rigidbody to move forward. If my player turns around and faces up the hill, it keeps going no matter what. I need a way that my player goes in the direction that the gravity is pushing it, This will also mean my player can ride switch.

Also, My player is a capsule not a sphere so it doesnt roll around.

I have tried playing around with rigidbody.velocity but nothing seems to want to work.

if(Input.GetButton("Jump")){
transform.localPosition += transform.forward * Time.deltaTime * force; //force is the speed of the character
}

This is also Javascript ( yes I know i should use C# I'm learning it currently)

sentences:
Tiled object layer draw sprites I added some tiles to some object layers in my tiled map and now I want to draw them in game.
I tried to render everything with

mapRender.render();

but the tiles doesn't show up.
Then I tried to render just one object layer and all of its objects with

mapRenderer.renderObjects(tiledMap.getLayers().get(0));

but it wasn't working.

Ingame:

Tiled:

Could someone please tell me how to make the tiles show up?
Thank you very much!

sentences:
Unity Animator not properly following animation transitions I have an Animator that has 3 different states. Walking, Climbing, and End of Climb.
The diagram is shown below:

I have 2 bools, isClimbing and isWalking. When isClimbing is set to false it transitions to End of Climb. Then when I set isWalking to true, it transitions to Walking. However, when I do this, for some reason the animator starts back at Climbing then moves to End of Climb then moves to Walking.
It seems everytime I change a parameter, it completely  restarts the state machine back to the default Climbing state and then moves forward.
I do not have code, and have been triggering this through the UI.
What am I doing wrong?

sentences: Grid Based AI Pathfinding I'm creating a top-down RPG and I have the movement system set up for the player character - it is alike to Pokemon in the movement sense in that it looks smooth but it is aligned to a grid. Since I have the player sorted I was trying to figure out how to use this movement principle for the Enemy AI's Pathfinding but I haven't figured out how to do it; I was wondering if anyone has a possible solution to this.

sentences:
ball reflection angles Xna c# I'm trying to find a way to handle reflections for a breakout clone.

I would upload an image to the post instead of the following paragraph, however i have not yet gained the privilege of that yet.

If the ball intersects the left hand side i want it to bounce off to the left. if the ball intersects the right hand side i want it to bounce off to the right. if the ball intersects the middle section i want it to bounce up the way. i want to learn how to make it bounce in a varying direction dependant on what side of the left, right, or middle section was intersected

I would like to not use three separate rectangles for this, i want to learn how to do it with one.

I use a Vector2 for ball velocity, projVel.

It's position is projPos.

A rectangle for the paddle lightRect.

The reason I use proj.collRect for the beginning of the if is because I cannot use the intersect method with Vector2.

This is my makeshift collision handler at present, which does work but the speed changes to an extent which renders the game unplayable. The speed clamp i have only slightly slows it down i think. i have a variable for projSpeed i cannot clamp that or it will never be able to stop.

if (proj.collRect.Intersects(lightSaber.lightRect))
{
            proj.projPos.Y = lightSaber.lightRect.Y - proj.projTxr.Height;
            proj.projVel.Y *= -1;

    proj.projVel.X = 10 * (proj.projPos.X - lightSaber.lightRect.Center.X) / (lightSaber.lightRect.Center.X);
}

        proj.projVel.X = Math.Max(-4, Math.Min(proj.projVel.X, 4));
        proj.projVel.Y = Math.Max(-4, Math.Min(proj.projVel.Y, 4));

Help me by showing me how I could do this, maybe in the Math. method, or even an alternative to .Intersects so I can use projPos instead of collRect.

I really am not sure where to start, if there is another way I could do it an example would be great.

sentences:
Detect collisions for each instantiated objects I want to instantiate cube at a random position when I click mouse and do something (change color or freeze position ..) for each cube when detect collision on the plane.
I tried first few steps:
public Rigidbody cube;

void OnCollisionEnter(Collision collision)
{
    if (collision.gameObject.name == "Plane")
    {
        //Do somthing for each cube
        cube.constraints = RigidbodyConstraints.FreezePositionY;
    }
}

void Update()
{
    Vector3 position = new Vector3(Random.Range(-5f, 5f), 8,Random.Range(-5, 5));

    if (Input.GetMouseButtonDown(0))
    {
        Rigidbody clone;
        clone = Instantiate(cube,position, Quaternion.identity);
    }
}

sentences:
Want event to occur when button is held but not when clicked I'm wondering if there is a way to have an event occur when the left mouse button is held down, but not to occur when it is initially clicked. I think you can do something like...

if (Input.GetMouseButtonDown(0))
{
    // do stuff
}
else if (Input.GetMouseButton(0))
{
    // do other stuff
}

It looks at first like this would work because when left click is clicked it would execute the first if statement and not test for the second. And if left click is held it would fail the first if condition. But, does this in fact work? Do you actually enter the second if statement when attempting to click because you actually hold it down for slightly longer than a true click since this is happening in Update?

Now, I want to do this in one condition. Something like...

if (!Input.GetMouseButtonDown(0) && Input.GetMouseButton(0))
{
    // do the stuff that should happen when mouse is held but not clicked
}

but I don't think this works either. Any pointers?

For Context, I want to have something happen in every case when mouse button is held down, and only happen in some cases when mouse button is clicked.

if (Input.GetMouseButtonDown(0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject()
|| !Input.GetMouseButton(0) && Input.GetMouseButton(0))

This doesn't work though

sentences:
Editor-Assignable function pointer in UE4 C++? So I have a TriggerBox that I'm using as a pressure pad, and I want to be able to attach objects to it that, when the TriggerBox is activated, will have specific functions called. Similar to unity's UI buttons, where you can assign a function to be called when the button is clicked.

I am working as the sole programmer, and the rest of my team are designers. They need to be able to assign the object's function to the TriggerBox from within the editor.

I have attempted to use C++'s function pointers, but I have not been able to find a way to make them assignable in the editor.

Is there a solution to this? If not, any suggestions on better ways to do this?

sentences:
Unity: Smooth collision I'm making a topdown 2D RPG in Unity.
All moveable objects have Rigidbody2D-components with gravity set to 0, linear drag set to 5 and different masses.
Walls are stationary boxes with BoxCollider2Ds.

Here's my problem:
http://a.pomf.se/nifmcn.webm
The rock is not particularly easy to see, but if you watch when I'm trying to walk into a wall, the player kind of jags in and out of the wall.

Of course, this is because I'm moving the player by moving it's Rigidbody2D, for example:

rigidbody2D.transform.position += Vector3.up*Time.deltaTime*speed;

The box then throws the player in the opposite direction of what he was going.

What's a good way of stopping a player from moving in the direction he's trying to go?
More specifically, how do you detect which way he's going? Do you find the angle between the player and the object/wall?

This is kind of an open question, but I think it's extremely important.

sentences:
How to apply a visual filter to what I am drawing? I'm looking to apply a sepia filter to what I'm rendering. Perhaps we could just apply the filter to the view or pass it to the draw method to draw everything with the filter (I'm using one draw method, everything that is visible gets drawn by one draw system).

Would I use a shader for this? I honestly don't know how to implement shaders or how to learn.

I'm using sfml.

How would you apply other filters, not just sepia? For example greyscale, moonlight (I would love this one), or the other filter styles you commonly see on the photo editing section of your (i)phone?

I've done some research into it and didn't really find anything useful. However, I assume you use shaders - but I don't really know how to program a shader, so I'll have to learn that if that's the case.

Thanks :)

sentences:
How to receive a Knock Back when the player touched the enemy I'm still new to C#, making my 2D game atm and my problem is how can I give my player a Knock Back when it touches the enemy. How to add it with this code?

public int health;

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Enemy"))
    {
        health -= 20;
        //Check for death
        if (health <= 0)
        {
            gameObject.SetActive(false);
        }
    }
}

sentences:
Mobile 3D engine renders alpha as full-object transparency I am running a iOS project using the isgl3d framework for showing pod files.

I have a stylish car with 0.5 alpha windows, that I wish to render on a camera background, seeking some augmented reality goodness.

The alpha on the windows looks okay, but when I add the object, I notice that it renders the entire object transparently, where the windows are. Including interior of the car.

Like so (in example, keyboard can be seen through the dashboard, seats and so on. should be solid)

The car interior is a seperate object with alpha 1.0.

I would rather not show a "ghost car" in my project, but I haven't found a way around this.

Have anyone encountered the same issue, and eventually reached a solution ?

sentences:
Can game replays be used as cheat protection? Say you're writing a complex turn based multiplayer strategy game in the browser (i.e. JavaScript). The game state is big and complicated (think line of sight calculations in a 3d world). There can be many simultaneous games on different maps. Thus keeping all of those maps in memory on the server and verifying every single client action as it happens would quickly become prohibitively expensive. So we're faced with the situation that we cannot trust anything from the client and we cannot verify every individual client action on the server due to cost.

Has anyone experimented with recording game sessions and running offline/asynchronous verification on them as a cheat deterrent? Ideally, the players themselves would get suspicious and spot check each others' replays. Obviously there would be a significant delay between the cheat happening and the player getting flagged, but in a long-running strategy game with persistent state, I think this would be a significant disincentive.

Do you know of such examples? Have they worked well?

sentences:
Browser-based MMOs (WebGL, WebSocket) Do you think it is technically possible to write a fully-fledged 3D MMO client with Browser JavaScript - WebGL for graphics, and WebSocket for Networking?

Do you think future MMOs (and games generally) will be written with WebGL?
Does today's JavaScript performance allow this?
Let's say your development team was you as a developer, and another model creator (artist). Would you use a library like SceneJS for the game, or write straight WebGL? If you would use a library, but not SceneJS, please specify which.

UPDATE (September 2012): RuneScape, which is a very popular 3D browser-based MMORPG that used Java Applets so far has announced that it will use HTML5 for their client (source).

Java (left) and HTML5 (right)

UPDATE (June 2013): I have wrriten a prototype of a WebGL/WebSocket based MMO:
https://github.com/alongubkin/xylose

sentences:
How to mitigate this strange pattern shown in Phong lighting? I am creating an entire lighting scene in OpenGL. The entire scene consist of only one point light. I noticed some strange z-fighting like pattern. This flickers when I move the camera.

Can anyone tell me what is the potential cause of the problem? How should I mitigate this problem? Thank you.

===

EDIT: The problem is solved. It was primarily caused by normal transform computation error and my ill made model might have been aggravated this speckle flickering effect.

sentences:
Thread problem updating Windows Forms control in XNA C# I'm development a network card game, and for now i've two players connected but there is a problem with one of them, this one can't do anything on the game. Looks that screen was blocked. I'm think that is because a code i used before.

That code is:

if (InvokeRequired)
            {
                this.Invoke(new MethodInvoker(delegate
                {

                   ...

            }));
                return;
            }

The code above is surrounding code to changing Button values, make connection with server and create game window. Without this code a warning is shown.

InvalidOperationException was unhandled

Cross-thread operation not valid: Control 'startGameButton' accessed from a thread other than the thread it was created on.

sentences: How to create a looping or spherical world? I wish to create a 3D first person world, in which the player, once they reach one end of the map are unknowingly transported back to the opposite end, or a spherical world with a surface where the player can walk on while still experiencing gravity like normal. Unfortunately I couldn't find a good solution for doing that in either unity or ue. Any ideas would be appreciated.

sentences:
memorizing button tap code iOS game I'm using a single view app in Xcode 6.1 for my game with Storyboards. Not unity or sprite kit. It's a small game not even 3MB. Anyways, I created un-lockable characters with a BOOLEAN.

-(void)hidden{
 if(scoreNumber  > 9  || HighScoreNumber >9){
 BlueChar=YES;
 }

 -(IBAction)Blue{

  bird.image=[UIImage imageNamed:@"BLUE.png"];

 if(BlueChar ==YES){       //BlueChar=BOOL
 BlueChar.hidden=NO;
 }

When you click on BlueChar button, the UIImageView is connected to BlueChar character. So when you tap START GAME button game starts and you play as BlueChar. Then when it's GameOver and you click START GAME button again, the BlueChar button that was clicked isn't saved and instead you play as Original Character.

How do I make it that if you click BlueChar button ONCE, now you can play as BlueChar forever unless you click on another button that represents another character? How do I make the game save the last button clicked unless user clicks on another button in Objective-C code?

sentences:
How to run my game outside of visual c++ I am having trouble running my game. It works fine when I run it from Visual C++, but when I try to open the .exe, it complains that it can't find SDL.dll.

What should I do in order to play the game?

sentences:
How to calculate IsGrounded more effective? if (SimpleInput.GetButtonDown(jumpButton) && IsGrounded())
    {
        rb.AddForce(0f, 8f, 0f, ForceMode.Impulse);
    }

bool IsGrounded()
    {
        return Physics.CheckCapsule(Char_Collider.bounds.center, new Vector3(Char_Collider.bounds.center.x, Char_Collider.bounds.min.y, Char_Collider.bounds.center.z), Char_Collider.radius * 0.27f, GroundLayers);
    }

I've multiplied Char_Collider.radius with 0.27f 'cause in the tutorial that guy said You need to multiply this with %90 of your character's actual size That might be the problem because i don't actually know my character's size, i've made it in blender and scaled it down at the unity.

So if you look at the inspector panel you'll see it's 0.1 0.1 0.1 but it's actually not. I tried to spawn a cube and match them together roughly, cube's size was 0.3 1.2 0.3, that's way the number is 0.27f 'cause i just simply calculated it with the 0.3.

And finally my problem is:

I get return values from IsGrounded delayed, sometimes doesn't even get a value. Like example when i jump, sometimes it returns the value of IsGrounded False when i'm just about the hit the ground, and sometimes it doesn't returns the value of IsGrounded False. Because of this i can't make jump animation properly.

This is my HandleAnimation() method (I call that from FixedUpdate()):

void HandleAnimation()
{
    if (!IsGrounded())
    {
        anim.SetBool("Jumping", true);
    }
    else
    {
        anim.SetBool("Jumping", false);
    }
}

And this is my animator:

I am also adding those because sometimes when IsGrounded() returns false, animation doesn't works.

sentences:
How does MMO flash games works? I want to know how does MMO flash games work, for example: Dofus and Club Penguin.

I want to know if by ony using Adobe Flash and ActionScript you can do MMO games, or if there is other way to work with ActionScript and Flash beyond Adobe Flash.

sentences: Is it possible to load asset bundle dependencies manually in Unity 5.0? Is it possible to tell Unity to not load asset bundle dependencies automatically so they can be loaded manually. If so, how can this be done?

sentences:
How can I calculate a terrain's normals? Im trying to implement basic lighting in Opengl 3+ (a sun) with this tutorial :

http://www.mbsoftworks.sk/index.php?page=tutorials&series=1&tutorial=11

Im building a basic terrain and its working well. Now im trying to add normals, and I think its not working well :

Terrain in wireframe

As you can see I dont think my normals are good.

This is how I get them :

for(x = 0; x < this.m_size.width - 1 ; x++)
    {
        for(y = 0; y < this.m_size.height - 1 ; y++)
        {
            immutable uint indice1 = y * this.m_size.width + x;
            immutable uint indice2 = y * this.m_size.width + (x + 1);
            immutable uint indice3 = (y + 1) * this.m_size.width + x;
            immutable uint indice4 = (y + 1) * this.m_size.width + x;
            immutable uint indice5 = y * this.m_size.width + (x + 1);
            immutable uint indice6 = (y + 1) * this.m_size.width + (x + 1);

            Vector3 v1 = vertexes[indice3] - vertexes[indice1];
            Vector3 v2 = vertexes[indice2] - vertexes[indice1];
            Vector3 normal = v1.cross(v2);
            normal.normalize();

            normals[indice1] = normal;

            indices ~= [indice1,
                        indice2,
                        indice3,
                        indice4,
                        indice5,
                        indice6];
        }
    }

I use this basic shader : http://ogldev.atspace.co.uk/www/tutorial18/tutorial18.html   or in the link I posted at the top.

Thanks.

sentences: Is there a successor to RenderMonkey? I'm starting with GLSL shader programming and have been looking into RenderMonkey. Sadly, AMD no longer supports it. Why? Is there a successor to it?

sentences:
How to convert Texture2DContent to Texture2D in custom ContentTypeReader I'm trying to implement a custom ContentPipeline extension that writes a Surface object with a Texture2D member.

My input file is an xml with fields for all of my Surfaces and their members. In the xml, my Surface's Texture2D is represented by a path to an image file.
In my ContentProcessor, I want to load the Texture2D from the image file path, then write that texture data straight into my object's xnb with the rest of a Surface's members.

Right now, I've got the ContentTypeWriter writing a different ("CompiledSurface") object with a Texture2DContent member. The Texture2DContent is created in the ContentProcessor using BuildAndLoadAsset(string path).

My importer, processor, and writer all seem to be doing their jobs. But in my ContentTypeReader, I can't figure out how to convert the Texture2DContent back to a Texture2D in order to create my runtime object.

Any help is much appreciated.

class Surface
{
    protected Rectangle bounding_box;
    protected Texture2D texture;
    ...
}

class CompiledSurface
{
    public Texture2DContent texture;
    public int x;
    public int y;
    ...
}

sentences:
What are the main requirements to port a game to Linux Steam for Linux is out today and I was surprised to see many games already being sold, which made me wonder what are going to be the difficulties for all those games to be ported to Linux. I broke this though into 3 questions:

Is it a matter of basically make the game run in OpenGL?
Are there any engines that build to Linux?
Did Valve have any hand on the development of some framework/toolset/OpenGL to make porting easier?

sentences:
Maya name clash with FBX motion capture file and FBX avatar on the 'root' I'm attempting to re-target motion capture data from radical motion to an avatar I created with Character Creator. After creating a character definition for one, I import the other and it appears they are merging their 'roots'. Both their hierarchies contain a :root with no namespace. I tried modifying namespaces before importing but that isn't working either.
Any thoughts?

sentences:
How can I handle fighting game collisions for complex animations? Imagine that I have an animation like this.

As you can see, this attack hits in three horizontal places.
The opponent facing this player could be hit mid and low (standing or crouching).

The same goes for this move:

If the opponent is crouching, standing or in air it gets hit because the fire circle hits all areas (low, mid and high)

How can I handle hit detection with this sort of animation?

sentences:
How can I use imprecise accelerometer data for controls? I want to rotate an object with respect to the phone's position. I use the accelerometer output to detect orientation:

float roll = Gdx.input.getRoll();
float pitch = Gdx.input.getPitch();
float azimuth = Gdx.input.getAzimuth();

Vector3 accel=new Vector3(accelX, accelY, accelZ);
bat.transform.setToRotation(0f, -1f, 0f, pitch);

bat.transform.setFromEulerAngles(azimuth, -pitch, -roll);

However, the accelerometer data fluctuates so strongly that the object jitters.

How can I deal with this?

sentences:
Unprojeting a line on the screen I have a line connecting two points of my model. I see a projection of this line on my screen and a want to map a point of that projection to the corresponding point in my model PoV.

Let A = (x_a, y_a, z_a, 1.) and B=(x_b, y_b, z_b, 1.) be the coordinates of two points of my line in the model PoV.

Let M,V and  P be the model, view and projection matrices.
Let A_s = NDC_to_screen(P*V*M*A) and B_s = NDC_to_screen(P*V*M*B) be the coordinates of A and B projections on my screen (assume that those two points are distinct).
Let vec_AB_s = B_s - A-s be the vector from A_sto B_s and let C_s = A_s + lambda_s * vec_AB_s be a point that lie on the line's projection on my screen.

How can I get the 3D coordinates of C so that C_s = NDC_to_screen(P*V*M*C) ? Something that would be usefull for me would be to have it in the form C = A + lambda * vec_AB

sentences:
How can I develop Flash games without expensive software? I've been playing with writing flash games in my spare time, but up to this point, I've just been using a trial version of Adobe Flash Professional. I'm aware of FlashDevelop, but their documentation is basically non-existent when it comes to the workflow of developing purely with FlashDevelop.

Does anyone know of any good tutorials for developing Flash games purely with FlashDevelop?

Alternatively, does anyone have any other free/cheap software recommendations to use in place of Flash Professional?

sentences:
Understanding the rendering of the raycasting on flat screen I have a misunderstanding of the raycasting formulas on flat screen because my rendering is not what I expected, this is some parts of the code to show my projection formulas that I wrote by myself

This is the code for the function intersection

int         intersection(t_wolf3d *w, int i, t_vec2f *dir, int iter){
int             mapx;
int             mapy;
unsigned int    length;

length = -1;
while (++length < w->cam->raylength)
{
    mapx = (int)(w->cam->position.x + (length * dir->x));
    mapy = (int)(w->cam->position.y + (length * dir->y));
    if ((mapy / BLOC_SIZE < w->map->h && w->map->board[mapy / BLOC_SIZE]
                    [mapx / BLOC_SIZE]) || (i == 1 && mapy >= HEIGHT_MM))
    {
        w->cam->intersection.x = mapx;
        w->cam->intersection.y = mapy;
        return (1);
    }
}
return (0);

}

Code used for the raycasting algorithm:

void                    raycasting(t_wolf3d *w, int limit){
int         i;
int         hit;
t_vec2f     dir;
t_vec2f     forward;
t_vec2f     right;
double      halfwidth;
double      offset;

i = -1;
forward.x = tcos(w->cam->angle);
forward.y = tsin(w->cam->angle);
right.x = forward.y;
right.y = -forward.x;
halfwidth = ttan(w->cam->fov / 2.0);
while (++i < limit && !(hit = 0))
{
    w->cam->rays[i].startpoint = w->cam->position;
    w->cam->rays[i].startpoint.color = 0xff0000;
    offset = ((i * 2.0 / (limit - 1.0)) - 1.0) * halfwidth;
    dir.x = forward.x + offset * right.x;
    dir.y = forward.y + offset * right.y;
    if ((hit = intersection(w, limit, &dir)))
        w->cam->rays[i].endpoint = w->cam->intersection;
    else
    {
        w->cam->rays[i].endpoint.x = w->cam->position.x + w->cam->raylength
            * dir.x;
        w->cam->rays[i].endpoint.y = w->cam->position.y + w->cam->raylength
            * dir.y;
    }
    limit == w->width ? render(w, i, hit) : 0;
}

}

For non-straight walls, I thought it was my variable types, it seems like not, I changed them from integers to double and i still got the same result, this is a look of my structures :

typedef struct      s_point{
int             x;
int             y;
int             color;}                 t_point;

typedef struct      s_vec2f{
double          x;
double          y;}                 t_vec2f;
typedef struct      s_camera{
double          radius;
double          angle;
double          fov;
double          raylength;
double          speedmove;
double          speedangle;
t_point         position;
t_point         intersection;
t_point         rays[WIDTH];}                   t_camera;
typedef struct      s_map{
int             **board;
int             w;
int             h;}                 t_map;
typedef struct      s_wolf3d{
t_map           *map;
t_camera        *cam;
int             hit;
t_image         *img;
void            *mlx_ptr;
void            *win_ptr;
char            texture;
t_image         *textures[3];
int             colors[3];
int             mini_h;
int             mini_w;
int             width;
int             height;}                    t_wolf3d;

sentences:
Limitations of p2p multiplayer games vs client-server I am reading up on multiplayer game architecture.

So far most of the articles i've found deal with the client-server model.

I'd like to know what are the limitations for using a p2p architecture? what "class" of games are possible (or more common) to implement using it? which aren't? and in general, what are its main differences and limitations against the client-server model.

sentences:
Distributed Rendering in the UDK and Unity At the moment I'm looking at getting a game engine to run in a CAVE environment. So far, during my research I've seen a lot of people being able to get both Unity and the Unreal engine up and running in a CAVE (someone did get CryEngine to work in one, but there is little research data about it).

As of yet, I have not cemented my final choice of engine for use in the next stage of my project. I've experience in both, so the learning curve will be gentle on both. And both of the engines offer stereoscopic rendering, either already inbuilt with ReadD (Unreal) or by doing it yourself (Unity). Both can also make use of other input devices as well, such as the kinect or other devices. So again, both engines are still on the table.

For the last bit of my preliminary research, I was advised to see if either, or both engines could do distributed rendering.

I was advised this, as the final game we make could go into a variety of differently sized CAVEs. The one I have access to is roughly 2.4m x 3m cubed, and have been duly informed that this one is a "baby" compared to others.

So, finally onto my question:

Can either the Unreal Engine, or Unity Engine make it possible for developers to allow distributed rendering? Either through in built devices, or by creating my own plugin / script?

sentences:
What is inertia in a physics engine? Inertia seems to be useful in a physics engine, so useful that even in Box2DLite, a demo of Box2D it hasn't been omitted.

See this Body class from Box2DLite:

struct Body
{
    Body();
    void Set(const Vec2& w, float m);

    void AddForce(const Vec2& f)
    {
        force += f;
    }

    Vec2 position;
    float rotation;

    Vec2 velocity;
    float angularVelocity;

    Vec2 force;
    float torque;

    Vec2 width;

    float friction;
    float mass, invMass;
    float I, invI; //inertia and reverse inertia
};

In the implementation of the class, inertia is set as the mass multipled by something:

I = mass * (width.x * width.x + width.y * width.y) / 12.0f;
invI = 1.0f / I;

What does this formula means ? I understood from wikipedia that Inertia is how much something doesn't want to move but there's not much formulas in this article. Why is it useful in a physics engine ? How is it used in the context of a collision ? Is it compared to other bodies ?

sentences:
Pass data down to components In the game I have, I'm using an architecture close to what I've seen of Unity components :

Basically, the universe implements the game loop, entities implement and update method, which always delegates to each entity's components.

Components are where the actual data and behaviors sit, quite like a MonoBehavior in Unity I guess.

And I use this architecture to model my whole game.

I use child classes of Entity as prefabs:

class Player extends Entity {
   constructor() {
      this.addComponent(new Transform())
      this.addComponent(new KeyboardControlledMovement(()
      this.addComponent(new PlayerCanvasRender())
      this.addComponent(new Gun())
   }
}

So, I get this kind of Universe - Entity - Component tree :

Question time!

Aside from the entities and the components, there exist Settings, such as ell the key bindings, the reference to the output canvas, the player buffs, ...

They all have to reach various components, and I don't know how to get them there.

So far, I've thought of several possible solutions:

Passing data in parameter of the entities' and components' constructor would be a KISS way of cascading external values. It looks like — if it isn't actually — manual dependency injection. However, in order to — as an example — feed the BulletCanvasRender with a reference on the canvas it has to draw on, it has to be passed through the Gun component, which has nothing to do with rendering; I'm mainly afraid of code cluttering here.
Until now, I've been using the universe as a global crap-bag. This is great since it eliminates the boilerplate associated with manual dependency injection, but it makes the universe initialization function quite large — plus, I have to come up with names for all those new settings properties...
Another option would be to switch to real ECS architecture by completely separating the raw data, which would stay in the components, from the behavior, which would go into external systems, and make use of the external settings from only within the systems. I would still have to perform some kind of manual dependency injection, but it would be limited to a set of non-nested systems. I don't like this solution either since it would cause quite a big change in the code.
Using an DIC, or a service locator to create all the components — or at least those that require injected data.

sentences: How to add a texture in jmonkey Hello I have a pretty simple question, I'm new to jmonkey and I want to add a .jpg file to the /assets/textures folder and dragging and dropping the file doesn't appear to work for me.

sentences:
Missing UI options in Inspector window when I import FBX files I am missing all the animation options in the Animation tab in the Inspector Window when importing FBX files.

In the picture below, there are only 2 checkboxes. I can't see the list of animations, options, animation events etc., but you can see on the lower left window that the animations we're imported. Also, the Materials tab is empty as well.

This FBX was exported from Blender. If I directly drag the .blend file to Unity, all those tabs appear normally, but when dragging an FBX, they become empty. I am using Unity 2019.3.0f6.

sentences:
Legalities of using song names in a music guessing trivia game I have an idea for a new new music trivia game with a table top skirmish twist. My question is related to the trivia part of the game: are there any copyright laws against me using names of songs in my trivia questions?
The way the game works is that questions will be based on different genres of music (E.G. pop, hip hop, RnB, heavy metal, etc.) and players will be asked to describe it and have other players guess its name without saying the song name, but by quoting a lyric, humming the melody/harmony or base line.  Much like in the game Articulate, but you'd be describing music rather than people and things and there would be song names on the question cards for each category.
Am I able to do from a legal point of view or not.

sentences: How do I determine which side of the player has collided with an object? I have some static bodies (platforms) and a dynamic body (the player) in my world. The collision between them works great, but I would like to know which side of the player (rectangle) collides with the platform. How do I get this information?

sentences:
Giving one controler button two functions I'm currently working on a game that allows the player to do some different actions.

Dodge (X button)
Attack (A button)
Use Item (Y Button)
Block (BButton)

I would like to be able to use the "Y" button to both use items and pick items up. This dual functionality would be determined by how long the player held the button and if the player was standing next to an item. I'm sure there have been studies on this and how long the player expects for a delay to use the second functionality but I'm worried that I have become biased in my testing and I can't find anything online.

My question is: Is there some sort of standard for this type of a time delay for the button? If so where can I learn more about it?

sentences:
Algorithm for constructing the corners of a regular, n-sided polygon I've googled this using a lot of keyword combinations, but to my great surprise I could not find an algorithm for constructing a regular, n-sided polygon into a given circle, i.e., finding the coordinates for the n corner points. All I could find were instructions how to do it by physical compass and straightedge, or interactive browser plug-ins without source.

So where could I find such an algorithm?

sentences:
Move Background in AndEngine for a Racing Game I am new to game development and AndEngine. I have small query about racing game. I am going to develop a bike racing game. For bike racing game we will move the background or the player. I am tried with andengine autoparallax background. But I didn't got the correct answer.

I need to do a background  like these screenshots in SpeedMoto.

Can anyone help me to set the background.

sentences:
XNA: Texture2D.GetData runtime error I am trying to get the colors of the top left pixel in an image, I use this code:

 using (FileStream stream = File.OpenRead(animationFile))
 {
     animation = Texture2D.FromStream(graphicsDevice, stream);
 }

 Color[] animationData = new Color[1];
 animation.GetData<Color>(animationData, 0, 1);

When i run it I get an System.Argument exception saying: The date passed in is too large or too small for this resource"

Anyone know what I'm doing wrong?

Edit: Added code where i load the texture, I have also tried using the Content.Load method, but the result was the same.

sentences:
How can I scroll/animate up lines reading from a string to ui text? This is the reading lines code :
if (primaryTarget != null)
            {
                var lines = primaryTarget.description.Split('\n');
                text.text = "Item found: " + primaryTarget.description;
            }
            else
            {
                text.text = "";
            }

And this is the script of the description :
The script is attached to each interactable target(item) :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class InteractableItem : MonoBehaviour
{
    public enum InteractableMode // your custom enumeration
    {
        Description,
        Action
    };

    public InteractableMode interactableMode = InteractableMode.Description;

    public float distance;

    private bool action = true;

    [TextArea(1, 10)]
    public string description = "";

    public void ActionOnItem()
    {
        if(interactableMode == InteractableMode.Action && distance <= 5f && action == true)
        {

            action = false;
        }
    }
}

Depending on the amount of text in the string I want to show it in the ui Text.
If there is one line then just show the text or even if there are two lines.
but if there is a lot of text then split the lines and scroll the lines smooth up so the first line will be disappear or pushed up and bottom lines will come up.
In the screenshot you can see on the left the text that show in the ui text on the right the text of the description. The ui text can't show all the text and I don't want the text to overlap other ui's or objects so the idea is to make the text slowly smooth scrolling up.

sentences:
Procedural planet to sphere texture I'm making a 4x space game. I have a procedurally generated galaxy with planets in 3D space. The view is above the planet plane at -45 dec y-up i.e 45 deg isometric. I procedurally generate the planet surfaces on a hex grid which can be viewed 2D / 2.5D when clicking on the planets, ala GalCiv etc by placing meshes for mountains, seas, forest and so on on the hex grid.

For realism, I'd like the textures of the planets when viewed from space to (at least roughly) mirror the view you get in the surface view. I'm struggling to think how this might be achieved in Unity.

I figure I could create a render texture after generating the planet's surface and store it on the users HD. This has a few problems though - taking up HD space and not mapping well to a sphere (unless I always make the poles a uniform colour, which doesn't look good as the rest of the surface is quite highly detailed).

Another idea would be to create many generic textures for the space view of roughly each type of planet generated (blue / green / large continent / archipelago etc) and select a texture which most closely fits the procedurally generated map at run time. As long as the same texture isn't used for planets close to each other and the user doesn't compare the 3D view with the 2D view to closely then hopefully they won't notice!

So, any other ideas of how this might be achieved? I'm not looking for code, just a brainstorm of how I might get a procedural 2D map to be represented on a 3D sphere, or at least create a convincing illusion.

sentences:
Following a set of points? Lets assume that i have a set of path that an entity should follow :

const int Paths = 2
Vector2D<float> Path[Paths] = { Vector2D(100,0),Vector2D(100,50)   };

Now i define my entity's position in a 2D vector as follows :

Vector2D<float> FollowerPosition(0,0);

And now i would like to move the "follower" to the path at index 1 :

int PathPosition = 0; //Start with path 1

Currently i do this :

Vector2D<float>& Target = Path[PathPosition];
bool Changed = false;

if (FollowerPosition.X < Target.X) FollowerPosition.X += Vel,Changed = true;
if (FollowerPosition.X > Target.X) FollowerPosition.X -= Vel,Changed = true;
if (FollowerPosition.Y < Target.Y) FollowerPosition.Y += Vel;,Changed = true;
if (FollowerPosition.Y > Target.Y) FollowerPosition.Y -= Vel,Changed = true;

if (!Changed)
{
    PathPosition = PathPosition + 1;
    if (PathPosition > Paths) PathPosition = 0;
}

Which works except for one little detail : The movement is not smooth!! ...So i would like to ask if anyone sees anything wrong with my code.

Thanks and sorry for my english.

sentences:
Why do these textures tile rather than just overlap? It might help to provide all the details, so here is the YouTube tutorial which sparked my question.

There's a prefab of the background tile called "Tile Background." This prefab has the default settings, except that Pixels Per Unit is set to 512, and that it has a script attached to it called BackgroundTile which hasn't even been opened. It's just there for the other script to reference.

An empty object was created called Board, which has Tile Background as its tile prefab. It also has a script, Board.cs, the contents of which are here:

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

public class Board : MonoBehaviour
{
    public int width;
    public int height;
    public GameObject tilePrefab;
    private Backgroundtile[,] allTiles;

    // Start is called before the first frame update
    void Start()
    {
        allTiles = new Backgroundtile[width,height];
        Setup();
    }

    private void Setup() {
        for(int i = 0; i < width; i++) {
            for(int j = 0; j < height; j++) {
                Vector2 tempPosition = new Vector2(i, j);
                Instantiate(tilePrefab, tempPosition, Quaternion.identity);
            }
        }
    }
}

Width is set to 4. Height is set to 7.
Other than that, the camera position is X:1.5,Y:3 and the aspect ratio is 9:16.

My question is this: why, when this is run, does Vector2(i,j) get interpreted as tiling the sprites, rather than placing the sources of the sprites in a 4x7 pixel grid, where they overlap almost entirely? There's no place where their positions get multiplied by the size of the tiles, right? Halving the pixels per unit doesn't even just halve the height of the board - it stays a constant size and looks really weird, despite the board not having set dimension attributes.

What's going on here?

sentences:
XNA Transparency depending on drawing order? I am drawing two 3D objects, both of them can fade from opaque to transparent independently, and they can intersect between them (so you cannot say when one of them is before the other one). Look at the image for a better understanding (one of the object is a terrain and the other one an area):

Now, if I apply transparency to both of them, and draw the terrain before the area, the terrain is not transparent respecting to the area, but the area is:

And finally, if I draw the area before the terrain, then the area is not transparent respecting of the terrain:

QUESTION: How can I make all the objects transparent to the rest of objects without depending on the drawing order?

sentences:
Can't get simple OpenGL texture working using SDL2 and FreeImage3 I created a simple OpenGL program that display a quad with texture, but it doesn't seem to be working as it only displays a white quad. What could possibly be wrong? I checked everything I could think of that could cause the issue. The bitmap is also 256x256. Any clues?

Here's the source code: http://pastebin.com/5nVbMPVp

I'm also on Linux if that helps. Thanks!

sentences:
How to do monster AI movement and attacks server side? I have my web based rpg game already created. Inventory management, equipment system, character stats, skill tree, and etc. It's almost complete.

For the game world, I am creating a top-down rpg character movement and combat. With point and click. You click on a part of the map (in this case, it's a image, and your character .png image transitions to that spot). It's with Javascript and PHP. I'm using a PHP Websocket server. I have it where players can only move up to 200 pixels per each click. Each click is essentially a packet being sent to my gameserver. Then the gameserver validates if it's a valid input (1235x1235) format, and spits it out to other players in that specific game. (So it's a consistent world/map). This works perfect.

My question is:  If I want to incorporate a monster that has AI and starts to attack the character... I can do that with javascript easily with setInterval or setTimeout functions (to make the mob move and then attack the character). But how do I do that serverside? Because a user could just press F12 and edit the javascript to stop the mob from attacking. But, I need the mob to attack the player every xxx milliseconds serverside as well. How is this done with PHP? I feel like I need some type of heartbeat going on where it's a constant check between client and server every xxx seconds? I might be going off on the deep end and I'll stop talking lol. But I hope you get the jist of it. Any ideas are greatly appreciated.

Another thought: Think of Diablo 2 or Path of Exile, and using a hack that just stops mobs from moving towards your character and attacking it. Is that just an illusion? And the "auto attacking" is done serverside regardless if you've stopped that mob on the client, right? If so, how to accomplisgh this with a PHP Websocket server, and some JS?  I'm not looking for code, just an application theory or design process would help! :)

P.S. It's either I go this route, or the game becomes a simple real time strategy pokemon style combat. Which I really, really don't want...

sentences:
Implementing traffic conditions in TORCS I am working on a project about "Effects of Traffic conditions and Track Complexity on Car Driving Behavior".

Is it possible to implement traffic in TORCS, or should I use another car simulator? By the word "traffic" I mean there are cars running on both tracks in both directions and I can detect the distances, direction and speed of these cars. Depending on this information I can decide whether I should slow down, speed up and calculate the correct timing to overtake.

sentences:
XNA GameComponent.Initialize() not called I have a game which creates an object in its Initialize() method:

    private GameComponent1 _thingy;
    protected override void Initialize() //Game1.Initialize()
    {
        base.Initialize();
        _thing = new GameComponent1(this);
    }

In the GameComponent1 class:

    public GameComponent1(Game1 game) : base(game)
    {
        _game = game;
        game.Components.Add(this);
    }

    public override void Initialize() //GameComponent1.Initialize()
    {
        //Do stuff here
        base.Initialize();
    }

However, in this case, _thing's Initialize method is not called. Why is this?

It behaves fine when the object is created in, say, Game1's Update method...

sentences:
How can I run a Unity game in a window larger than the desktop resolution? I am exploring a research problem using Unity. I require a game resolution of at least 4096 x 786. There seems to be no option under build settings for setting a fixed screen size window. (The default screen width and height options are unhelpful here.)

How can I make a window even larger than the desktop?

sentences:
How I add gap between Instantiated objects? using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class SavedGamesSlots : MonoBehaviour
{
    public GameObject saveSlotPrefab;
    public float gap;

    private Transform slots;
    private string[] imagesToLoad;

    // Start is called before the first frame update
    void Start()
    {
        imagesToLoad = Directory.GetFiles(Application.dataPath + "/screenshots", "*.png");
        slots = GameObject.FindGameObjectWithTag("Slots Content").transform;

        for (int i = 0; i < imagesToLoad.Length; i++)
        {
            var go = Instantiate(saveSlotPrefab);
            go.transform.SetParent(slots);

            Texture2D thisTexture = new Texture2D(100, 100); //NOW INSIDE THE FOR LOOP
            string fileName = imagesToLoad[i];
            byte[] bytes = File.ReadAllBytes(fileName);
            thisTexture.LoadImage(bytes);
            thisTexture.name = fileName;
            GameObject ChildGameObject = go.transform.GetChild(1).gameObject;
            ChildGameObject.GetComponent<RawImage>().texture = thisTexture;
            var raw = go.GetComponent<RectTransform>();
            raw.anchoredPosition = new Vector3(1 + 1 * gap, 6, 0);

        }
    }

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

    }
}

The way I'm doing it now is not working it's moving all the objects to the same position and not adding
equal gap's between them.
In the loop I tried to do it this way in this line :
raw.anchoredPosition = new Vector3(1 + 1 * gap, 6, 0);

sentences:
When accessing components, is it better to do so in a script or to create a reference to them in the inspector? I am accessing the variable of one script from within another and I noticed there are multiple ways to do this, but two that are very similar.  The first is to simply find the game object and reference it within the other script like so:

void Start(){
    private int bye = 1;
    GameObject player = GameObject.Find("Meh");
    Test2 externalScript = player.GetComponent<Test2>();
    externalScript.hello *= bye;
    Debug.Log(externalScript.hello);
}

The other way is to create a global instance of the object the script is attached to and reference it within the inspector, like so:

private int bye = 1;
public GameObject player;
void Start(){
    Test2 externalScript = player.GetComponent<Test2>();
    externalScript.hello *= bye;
    Debug.Log(externalScript.hello);
}

Which way would be best in terms of performance and practice?  Would one way be better than the other when it comes to larger games and/or scripts?

sentences:
Javascript Jumping Physics I have asked questions for this project before, but the jumping physics are a bit messed up. I cannot jump unless I hold down the W key, and then it just teleports me upwards. Does anybody know how to fix this glitch? Here's the code:

var canvas = document.getElementById("canvas")
            var ctx = canvas.getContext("2d")
            var x = 1
            var y = 0
            var xPos = 0
            var yPos = 0

            function updateVariables() {
            x = x * 0.9
            y = y * -0.9
            y = y + 0.5
            xPos += x
            yPos += y
            }

            function clear() {
            ctx.clearRect(0,0,600,600)
            }

            function Draw() {
            collisionCheck();
            clear();
            ctx.fillRect(xPos,yPos,10,10)
            ctx.fillRect(0,canvas.offsetHeight * 0.7,600,200)
            window.requestAnimationFrame(Draw)
            }

            function collisionCheck() {
            if (yPos > canvas.offsetHeight * 0.7 - 10) {
                yPos = canvas.offsetHeight * 0.7 - 10
            }
            }

            function right() {
                x = 2
            }

            function left() {
                x = -2
            }

            function jump() {
                y =+ 20
            }

            function detectKeys() {
                document.onkeypress = function (e) {
                    e = e || window.event;
                    console.log(e.key)
                    if (e.key == "d") {
                        right()
                    }
                    if (e.key == "a") {
                        left()
                    }
                    if (e.key == "w") {
                        jump()
                    }
                }
            }

            window.requestAnimationFrame(Draw)
            setInterval(updateVariables, 1)
            setInterval(detectKeys, 1)
<canvas id="canvas" width="500" height="140"></canvas>

sentences:
Rigidbody2D without pushing eachother on collision TLDR; How to stop movement if two Rigidbodies collides?

Also,  here's a potato video of the problem: https://gfycat.com/ComposedArcticBetafish

Say I have three objects in a scene:

Player
Enemy
Rock

The player and enemies is moving freely, but the rock is static. So I attached a Rigidbody2D on player and enemy to move them around with script. All of them has a Box Collider 2D.

Now, if I (Player) move into an Enemy, I will start to push it (changing its position). I don't want this.
I can set the Enemy's mass to something large, but then two enemies can still push eachother. I don't want this. If I try kinematic solutions I've found, but then they can move through the rock.

I want:

Player can not move enemies
Enemies can not move players
Enemies can not move each other
Nothing can move or go through the rock
Enemies can not move through player
Player can not move through enemies

I keep reading that if I'm moving colliders, I should also use Rigidbodies for performance. But I can't see how I get this to work with Rigidbodies.

How do I set it up? Or should I move away from rigidbodies and set it up myself?

sentences: Optimization for Normal maps with lots of wasted space? I'm working on level/character assets where I'm finding that I use only very little amounts of normal mapping on them, resulting in 2048x2048 textures that are mostly blue/purple. Is there any method to better optimize this, perhaps use one normal map for several assets?

sentences:
How do I avoid big switches in my message system? I've been implementing a message system for my small engine, and I have started to think about optimizing and maintaining it. Right now, my message class looks like this (at its simplest - only member variables):

typedef unsigned int MessageID;

class Message
{
    std::string message;
    MessageID messageID;
    MessageData* data;
};

At first I was only using std::string to recognize each event, and handling was done in cascade-if style:

void GUI_system::handleMessage(Message* message)
{
    if (message->message == "DELETE_HP")
    {
        deleteHearth(static_cast<AttInfo*>(message->data));

    }
    else if (message->message == "PAUSE_GAME")
    {
        showPauseIcon();
    }
}

However, I felt it is uncomfortable to work with, and for a switch I needed a numeric variable. This is why is MessageID is generated from unordered_map each time a message is created; each message has its own ID, and if not, a new one is created. So now it looks like this:

void GUI_system::handleMessage(Message* message)
{
    switch(message->messageID)
    {
        case 1 :
        {
            deleteHearth(static_cast<AttInfo*>(message->data));
            break;
        }
        case 2 :
        {
            showPauseIcon();
            break;
        }
    }
}

However, this was more confusing than the cascade-if style, where I at least had a little knowledge of what is going on, internally, apart from a plain int. I know enumerations are easier to use and implement, but this was the first method I tried, and I also wanted to try it the other way.

This brings me to my question; how do I avoid big switches in my message system? Should I just use enums?

My first suggestion was to create an unordered map of function pointers that define the behavior for a message, where the MessageIDs would act as keys, so the initialisation function would be defined in some init function, like this:

typedef void* func(Message*) messageF;

std::unordered_map<MessageID,messageF> _messageMap;

void GUI_system::InitBehaviorFunctions()
{
    _messageMap[MessageIDMapper::findID("DELETE_HP")] = deleteHearth;
    _messageMap[MessageIDMapper::findID("PAUSE_GAME")] = showPauseIcon;
}

void GUI_system::handleMessage(Message* message)
{
    //Or the right way as this is just a sketch
    _messageMap[message->messageID](message);
}

sentences:
Transform the mouse coordinates to the GLSL plane I am creating a 2D map editor in C ++ with GLFW. I want move and drag entities with the mouse, but I have a problem, the mouse coords are in the window size range (1200, 720) and the entity is in the GLSL range (100x100 I think), I compare the mouse coord with the 4 entity edges. How can I do this?
PD: Sorry for bad english.
Edit:
There is the code for set position and size to entities:
model = glm::mat4(1.0f);
model = glm::translate(model, glm::vec3(translate, 0.0f));
model = glm::scale(model, glm::vec3(scale, 1.0f));

And this is the GLSL code:
#version 330

layout (location = 0) in vec2 position;
layout (location = 1) in vec2 textureCoord;

out vec2 TexCoord;

uniform mat4 model;
uniform mat4 projection;
uniform mat4 view;

void main() {
    TexCoord = textureCoord;

    gl_Position = projection * view * model * vec4(position, 1.0, 1.0);
}

sentences:
Why do my game objects jitter when moving the camera? I'm moving from Qt Widgets' QGraphicsScene to Qt Quick's QQuickItem for rendering my game objects. One of the things this involves is setting up a scene and the view onto that scene, as this was previously managed by QGraphicsScene and QGraphicsView.

My naive attempt was to do the following:

void SceneView::centerOn(const QPointF &pos)
{
    if (mScene) {
        mScene->setX(-(pos.x() - width() / 2));
        mScene->setY(-(pos.y() - height() / 2));
    }
}

This works, but it produces this odd effect where some game objects "jump around" between neighbouring pixels while the camera comes to a halt while following the player:

The player's movement is fine. The crate also does not seem to exhibit this problem (though its Box2D debug drawing marker does).

This is what it looks like when the player moves without the camera following it:

This is what I'd expect from the other game objects when the camera is moving; no movement whatsoever relative to the scene.

The old, correct movement looked like this:

The old code:

void MapView::centerOverFollowedItem()
{
    QRectF geometry(mFollowing->pos(), mFollowing->boundingRect().size());
    centerOn(geometry.center());
}

(QGraphicsView::centerOn implementation)

What could be causing this?

sentences:
Developing games in Go? Google's new Go language is still in its infancy, and it has yet to find widespread real-world use or support.  Even so, it seems like a promising experiment, and I wonder if it could have a future in game development.  I haven't been able to find much game-specific discussion of Go elsewhere, and figured a CW discussion may be appropriate.

Some thoughts:

According to golang.org, Go programs "run nearly as quickly as comparable C or C++ code"--quick enough?
Is Go's garbage collection well suited for games?
How much mental re-tooling is necessary to create games in the land of concurrent goroutines?
Go is frequently called a "systems"-level language, with server software given as an example.  It's hard not to think of multiplayer game servers when hearing this.

Your thoughts?

sentences:
Uploading half-made games to itch.io I am teaching game development, and would like my students to upload their homework assignments to a place in which I and the other students can easily see them, so that I can comment on them along the way. Itch.io seems like a good option, since it allows anyone to upload games and make them immediately playable in the browser. However, there are several potential problems:

The homework assignments are not games yet - they are only solutions to specific programming exercises, that some day may become games. Here is an example from my own account. Is it allowed to upload such material to itch.io? I read their terms of service and did not find any clause against it, but I am not sure.
Even if it is allowed, I am not sure it is good for the students' reputation to upload such half-made games. Ideally, it should be possible to create, for each game, a URL that is not published in the itch.io website, but can be opened by anyone that has the URL. Youtube.com has such an option. But I did not find this option in itch.io. I found only three options: Draft - which is available only to the owner, Restricted - which allows only download (not play in browser), and Public - which is available to all but can also be found in searches in itch.io.

So my question is: is there a way to use itch.io (or another similar service) for uploading rough drafts of games, such that the drafts will be available to the teacher and to other students in the course, but will not be published to the entire world?

sentences:
Is there a reason online video games don't have "benches"? 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?

sentences:
Is nVidia's CUDA suited to performing pathfinding calculations? I want to know if it would be worth executing pathfinding on the GPU (using nVidia's CUDA, or an equivalent) in certain situations, or whether it would be a wasted effort. The situation I imagine would be a headless multiplayer server responsible for finding paths for bots.

I'm specifically interested in A* pathfinding using navigation meshes, but if there is another pathfinding algorithm that would benefit more from GPU execution I'd love to hear it.

sentences:
Data structure to store map layers in each Tile while keeping the order of terrain, items and monsters intact My game represents its map as a 2D array of tiles, each of which stores a stack of layers. I'm looking for a data structure to efficiently represent this .

I want to be able to add layers dynamically, so fixed arrays won't do.

Additionally, the layers are applied in zones, to make sure that terrain is always drawn before items and monsters, and that items/monsters are drawn before the player. This is the order:

terrainlayer
terraineffectlayers
itemlayers
monsterlayers
playerlayers
specialeffectslayers

I want to store all those zones in the same data structure, so I can traverse it from end to end in either direction. I also need to be able to add a monster layer that would automatically go at the end of monsterlayers data structure while still having a global object that would let me traverse from the all the layers. I also need the ability to access the data structure with index, so I can get the 3rd monster in the tile easily or remove the 3rd monster. Add will always be sequential, but remove are at random indexes.

Does a data structure like this already exist or do I need to make some sort of vector/doubly linked list/deque hybrid?

I have already seen this question but it doesn't help me.

sentences:
How to create a minecraft style world that is based of a heightmap For my game I am trying to create a Minecraft style world that is based off a heightmap that I made In Photoshop. I am trying to make the map which is 7km squared where each cube is 1m cubed but I haven't found a way to do it. The heightmap converts to a terrain file(in unity), but my problem is that I can't create the Minecraft look.

what I have done so far looks like this

what i want looks like this

sentences:
Heightmap Physics Optimization/Improvement I'm working on implementing the physics surrounding a player walking on a heightmap. A heightmap is a grid of points which are evenly spaced on the x and z axes, with varying heights. The physical representation of my player (what is exposed to my physics engine/manager) is simply a point-mass where his feet are, rather than complicating the problem by treating him as a sphere or a box.

This image should help further explain heightmaps and show how triangles are generated from the points. This picture would be looking straight down on a heightmap, and each intersection would be a vertex that has some height.

Feel free to move this over to math, physics, or stack overflow, but I'm pretty sure this is where it belongs as it is a programming question related to games.

Here's my current algorithm:

Calculate the player's velocity from input/gravity/previous velocity/etc
Move the player's position (nextPos = prevPos + velocity * timeSinceLastFrame)
Figure out which triangle (all graphics is done in triangles!) of my heightmap the player's new position is vertically aligned with
Use the three vertices of that triangle to calculate the equation for the plane which that triangle lies in
Plug in the player's x and z coordinates into the plane's equation to get the y coordinate for the player's position on that plane
Set the y coordinate of the player's position to this (if newPos.y < y)

This is all fine and dandy, but I'm wondering if there's anything that I can optimize. For example, my first thought is to store the plane's equation with the triangle's vertex information. This way all I have to do is plug in the x and z values to the equation to get the y. However, this would require adding 4 floats to every vertex of the heightmap which is a little ridiculous memory wise. Also, my heightmaps are dynamic (meaning the heights will change at runtime), which would mean changing the plane equations every time a vertex's height changes.

Is there a faster way to calculate that point than digging up the plane's equation and then plugging in x and z? Should I store the plane equations and update them on vertex height change or should I just regenerate the plane equations for every triangle every time the player moves on that triangle? Is there a better way to do heightmap physics that maintains this simplicity? (this seems very simple to me as far as physics engines go)

labels: c++ c++ ios input xna 2d tilemap mmo opengl unity directx11 input udk javascript iphone unity unity unity unity shaders textures xna game-design c# collision-detection coordinates collision-detection databases c# opengl shaders unity web unity unity unreal-4 directx c# javascript unity libgdx unity algorithm xna-4.0 pyglet xna fragment-shader javascript opengl xna opengl c++ c++ javascript fonts xna c++ java camera unity quake2 modding unity signed-distance-field collision-detection rpg unity algorithm opengl unity mathematics unity glsl unity windows xna unity game-design xna libgdx java allegro 2d terrain-rendering unity opengl blender-game-engine opengl opengl android xna architecture unity game-design lua copyright libgdx java javascript unity graphics opengl opengl c++ android rotation xna 3d c++ project-management graphics-programming tiles networking unity cocos2d-x ai c++ java unity 2d opengl textures xna timer c++ game-design 3d unity unity unity unity graphics java opengl c# sdl 2d collision-detection javascript unity ai unity opengl game-design cocos2d opengl directx11 unity python cocos2d-x unity directx movement 2d c# c# physics 3dsmax 2d mathematics libgdx collision-detection xna c++ android ranking game-design mathematics c++ 3d legal c++ java algorithm directx directx11 unity procedural-generation unity cocos2d-x opengl unity unity javascript unity unity java collision-detection architecture unity unity c# optimization iphone android xna opengl unity java textures mesh opengl html5 unity multiplayer unity opengl unity directx11 unreal-4 c++ unity unity textures unity coordinates xna opengl physics mathematics unity android unity architecture java unity javascript browser-based-games opengl java 2d c unity algorithm raytracing models multiplayer java architecture opengl directx java javascript c# animation unity unity first-person-shooter unity monogame directx performance textures legal unity networking 2d textures game-design architecture c# ai networking unity game-design multiplayer game-design unity opengl mathematics unity c# procedural-generation shaders unity c++ box2d unity 2d xna c# unity android android mmo project-management ios unity monogame libgdx c++ game-design unity unity rendering sprites c# first-person-shooter physics game-design unity opengl unity google-play directx opengl unity unity compute-shader physics graphics java java mathematics game-industry xna textures c++ unity xna unity android movement unity c# lwjgl homebrew 2d graphic-effects unity c++ sharpdx c++ mathematics python mathematics android game-mechanics networking java javascript c# directx c++ unity 2d game-design javascript unity unity gpu opengl java rotation unity unity javascript physics unity c++ sdl2 graphics unity unity unity opengl android cocos2d-iphone c# udk turn-based unity xna terminology c++ opengl physics unity unity directx11 3d ai java animation shaders 3d java c# opengl c# c++ unity c# mathematics ios procedural-generation unity collision-detection 2d opengl chess game-design c# xna architecture fmod c++ unity unity opengl unity xna collision-detection flash line-of-sight blender unity unity xna procedural-generation xna unity c++ unity unity android multiplayer tilemap mathematics architecture libgdx unity 3d java unity physics android xna game-design unity libgdx c++ unity c# android javascript android unity sprites unity unity opengl multiplayer entity-component multiplayer graphics xna xna xna xna c++ graphics-programming c# c# xna mathematics xna modding c# unity 2d c# multiplayer unity unity unity 3d transparency assets opengl algorithm ios xna performance legal terrain rendering 2d physics javascript physics c++ c# opengl shaders java architecture java rotation unity 2d xna iphone unity game-design collision-detection unity unity architecture c++ unity xna physics unity monogame unity unity box2d javascript android 3d actionscript-3 c++ xna game-design unity mathematics rendering unity monetization webgl java opengl c++ opengl physics mathematics iphone 2d open-source unity opengl synchronization mmo java java android spaces unity godot unity physics c# open-source c# 2d unity unity parallax-scrolling unity unity opengl-es libgdx ai c++ unity ai unity unity javascript 2d opengl collision-detection directx11 opengl 3d c# unity c# unity xna algorithm architecture ios unity javascript component-based 3d performance android xna collision-detection unity unity voice unity opengl c++ unity architecture collision-detection opengl xna unity uv-mapping java unity unity directx11 architecture multiplayer unity opengl unity architecture unreal-4 unity unity c# java directx11 unity c++ iphone opengl geometry performance unity path-finding physics opengl c++ unity java fonts opengl grid camera opengl profiling game-design actionscript-3 unity libgdx 2d unity unity hlsl unity microsoft scripting business 3d unity libgdx c++ box2d unity physics animation c# java graphics 3d unity business animation unity 3d-meshes java collision-detection libgdx physics xna opengl projectile-physics ai collision-detection unity javascript unity c# unity legal 2d opengl unity unreal-4 unity java directx unity java opengl unity javascript c# architecture collision-detection unity unity xna unity animation shaders java java unity java android xbox360 java java .net c# graphics assets xna sprites unity unity opengl procedural-generation client-server game-design architecture terrain unity opengl opengl unity image c# libgdx opengl c# c# algorithm 3d unity opengl algorithm game-design game-mechanics 2d xna-4.0 unity collision-detection 2d unity 2d opengl unity collision-resolution unity xna directx algorithm architecture unity index-buffer libgdx c++ python iphone rendering xna game-loop c++ books c# color animation c++ unity data-structure html5 c++ c++ jobs unity xna ios directx 3d java modding unity algorithm unity c++ c++ android unity mathematics cocos2d-iphone software-engineering windows collision-detection opengl unity mathematics rotation opengl javascript unity libgdx animation physics unity c# java android unity game-design networking c++ unity opengl architecture software-engineering c++ movement xna 3d-modeling mmo textures networking unity unreal-4 game-design architecture 3d java algorithm savegame tilemap shaders 2d unity path-finding 3d unity 2d unity 2d unity unity game-design xna c# unity unity multiplayer c++ unity procedural-generation libgdx unreal-4 unreal libgdx opengl javascript actionscript-3 2d collision-detection libgdx unity directx11 tiles unity opengl 3d box2d unity camera xna unity 3d game-design c# level-design textures java ai unity opengl android javascript game-mechanics opengl monogame performance content-rating libgdx game-design opengl xna geometry opengl unity geometry box2d directx10 game-maker unity physics unity mathematics architecture unity unity shaders terrain opengl xna architecture 2d java 2d c++ xna testing opengl unity unity unity c++ game-design unity c++ xna unity networking animation mathematics unity networking mathematics game-industry c# andengine unity architecture opengl xna state c# software-engineering java tools unity maps unity opengl 3d game-design c# xna unity algorithm unity 2d opengl 2d xna rendering unity floating-point networking timestep c# opengl opengl collision-detection c# unity c# c++ hlsl opengl rendering physics udk physics java java java opengl libgdx unity opengl-es mmo global-illumination animation directx xna unity unity godot unity graphics-programming xna 2d box2d entity-system java c++ c# unity flash input c# unity opengl c++ c# opengl unity c++ xna c# c# opengl-es c++ opengl xna-4.0 unity xna c++ education java c++ java c++ unity corona-sdk opengl c++ xna unreal-4 unity unity unity xna splines path-finding xna javascript android c# unity c++ unity xna shaders graphics physics c++ collider unity collision-detection collision-detection ios xna algorithm java c# unity unity android unity unity unity c++ physics actionscript-3 javascript unity pc sprites xna game-design opengl java andengine c# unity sdl opengl c# xna collision-detection unity game-design shaders camera game-design box2d opengl directx11 animation simulations unity directx11 c++ graphics unity architecture unreal-4 turn-based 2d mathematics unity networking xna javascript architecture javascript sprites mathematics animation directx xna architecture unreal-4 python opengl unity 2d opengl unity physics 2d opengl java opengl shaders unity path-finding text-based databases input unity unity c++ unity game-maker xna unity shaders unity c# unity unity opengl textures java unity xna 2d c# graphics c++ game-maker unity unity c++ c# 2d unity android java javascript 2d skeletal-animation rendering 2d xna xna unity mathematics camera c# java path-finding unity c# unity unity networking unity unity android procedural-generation multiplayer unity physics collision-detection unity 2d collision-detection c# unity game-industry 3d unity unity unity libgdx unity unity java unity directx xna android unity opengl unity xna unity unity actionscript-3 mvc unity xna android software-engineering accessibility unity mathematics c# opengl udk path-finding rts scripting unity unity opengl opengl unity path-finding server animation mmo unity unity java mathematics unity directx c++ nintendo android rotation rotation xna xna performance android c# c++ coordinates xna rendering unity 3d unity unity steam java python unity slick legal c++ libgdx path-finding javascript multiplayer unity collision-detection c++ collision-detection shaders libgdx collision-detection udk physics android opengl glsl levels unity unity rpg unity javascript procedural-generation android matrix c# unity game-design physics 2d 3d opengl xna architecture collision-detection unity graphics c# xna php libgdx c# unity godot unity android xna-4.0 java opengl opengl 2d java mathematics windows game-industry flash directx xna unity unity graphics graphic-effects 2d rendering java unity box2d unity unity xna mathematics opengl javascript unity unity javascript ai ios c++ collision-detection fonts lighting java unity 2d c++ software-engineering unity java unity alpha-blending unity lua collision-detection game-design unity java ios libgdx unity libgdx unity unity unity unity legal procedural-generation game-design xna opengl c++ xna unity unity networking collision-detection mathematics opengl graphics timer unity databases java software-engineering java unity directx javascript physics unity ai opengl game-design graphics algorithm c++ fragment-shader unity opengl flash opengl android game-design unity c# unity xna xna-4.0 mathematics legal algorithm assimp analytics blender c++ unity unity cocos2d-iphone open-source legal optimization multithreading xna-4.0 fsm java xna flash collision-detection android minecraft-modding c++ unity c++ java c++ game-maker unity 2d shaders 3d c++ game-design xna unity 2d architecture mathematics physics unity c++ c++ unity legal mathematics 2d 3d jobs java business opengl-es text android 2d java java monetization android c++ c# c++ unity art unity unity java unity revenue c++ xbox360 architecture unity unity lumberyard-engine c# c# mathematics java mathematics algorithm content-rating 3d java unity mathematics libgdx java 2d opengl unity unity 2d architecture opengl xna client-server unity xna keyboard unity javascript 3d unity python lwjgl c# xna modding unity unity java mathematics tiles c# c++ c++ collision-detection java unity unity xna unity unity 2d vector game-maker unity java java unity unity xna game-design textures unity unity mmo game-mechanics unity unity c# opengl rotation directx9 android procedural-generation unity collision-detection game-maker textures unity c# gui unity xna unity architecture c++ rendering marketing playstation4 unity opengl c++ scripting unity mathematics unity game-design javascript opengl java methodology rotation game-design architecture java c++ iphone collision-detection python game-mechanics algorithm sdl textures flash architecture education xna c++ collision-detection unity unity client-server rpg opengl unity c# opengl unity textures flash iphone starcraft-2 2d ai software-engineering java difficulty android architecture 3d xna unity-ads unity art java unity procedural-generation game-maker architecture 3d multiplayer unity c++ procedural-generation 2d java c++ unity java cocos2d modding java unity 2d java unity android image opengl 3d javascript marketing directx matrix web c# shaders unity unity open-source unity unity networking cocos2d android unity mathematics graphics facebook unity unity c++ unity java unity rendering 2d 2d unity gameobject c# unity algorithm unity java android shaders xna mathematics collision-detection collision-detection unity graphics game-loop unity cocos2d-iphone unity animation textures unity unity algorithm unity legal marketing textures unity unity planning mathematics xna input unity textures unity modding unity android path-finding collision-detection unity algorithm java 3d architecture c++ unity networking opengl textures unity business opengl collision-detection c++ procedural-generation android sfml game-design opengl c# python 2d unity c# xna-4.0 mathematics physics unity java c++ javascript unity unity mathematics sdl matrix unity xna unity collision-detection unity c++ xna xna c++ game-mechanics mathematics opengl ranking unity lua xna 2d unity opengl unity c++ game-design opengl android unity libgdx unity unity unity java xna xna libgdx unity unity opengl unity c# opengl game-maker algorithm unity unity unity 3d architecture unity shaders xna textures collision-detection c++ mathematics collision-detection unity unity unity xna shaders rendering xna unity unity 2d unity unity opengl maps unity unity game-maker algorithm physics c++ unity opengl java java unity c++ unity algorithm unity animation glsl unity game-maker c# xna android unity art java algorithm c++ unity c# c# unity animation python unity android textures unity unity xna-4.0 c# assets shaders opengl game-design game-design shaders xna geometry unity c# 2d rendering marmalade unity unity xna unity c++ opengl xna unity animation unity opengl c++ xna opengl java audio unity unity collision-detection android licensing directx11 architecture c# unity 3d javascript java unity unity opengl unity unreal opengl networking c# unity software-engineering javascript xna xna physics image-processing animation android unity unity java economy opengl procedural-generation testing unity savegame unity opengl raycasting c# unity javascript modding c# c# sdl2 gpu java mathematics unity 2d unity unity opengl component-based unity javascript directx unity c++ unity graph unity camera c# unity unity vbo 2d unity opengl c++ game-maker collision-detection collision-detection unity 2d java xna animation opengl opengl unity unity ai xna android unity unity libgdx opengl-es unity deferred-rendering opengl directx unity game-maker-dnd unity c++ game-design unity frame-rate path-finding opengl unity unity unity unity unity opengl mathematics steam unity java unity unity android game-design android joystick architecture 3d unity unity 3d game-design c++ word-games keyboard component-based interpolation unity c++ iphone unity android blender monogame python unity opengl java unity unity tilemap 2d java architecture collision-detection websocket animation opengl architecture game-design physics unity unity unity android android opengl unity rendering flash c++ unity unity android java libgdx unity opengl cocos2d textures c++ ios unity c++ pixel-art webgl textures c++ android performance unity physics transformation unity unity unity c++ unity 2d c++ android c# camera unity xna legal iphone unity unity xna unity c# algorithm unity unity mathematics unity iphone mmo monogame opengl java opengl 2d movement rendering c++ udk c# android algorithm unity libgdx c# unity c++ c# ai unity unreal-4 xna 3d graphics maya rendering game-mechanics unreal-4 2d xna unity architecture sprites xna textures xna sprites java 3d shaders algorithm opengl physics xna opengl opengl unity android game-design java c++ game-design opengl unity c# unity unity unity game-design xna unity opengl unity procedural-generation c# xna-4.0 c# unity unity assets tilemap unity assets unity c++ software-engineering architecture c# unity opengl c# algorithm libgdx c++ directx11 java unity game-loop xna textures algorithm 3d xna game-design models rendering software-engineering 3d algorithm xna game-design unity opengl 2d game-design c++ opengl c++ unity unity c++ game-mechanics algorithm unreal-4 unity c++ mathematics unity 2d phaser xna unity unity xna c++ hlsl algorithm logic shaders unity architecture unity android java directx libgdx unity unity java unity vector unity xna c++ xna game-design html-canvas collision-detection c++ opengl models unity c# java c# shaders 2d opengl c++ libgdx opengl game-design unity actionscript-3 c# models education javascript opengl iphone textures physics unity architecture unity opengl collision-detection opengl unity unity c++ unity c# opengl c# collision-detection unity c++ game-maker multiplayer mathematics java c++ collision-detection ogre unity cocos2d-iphone scripting mathematics unity physics mathematics 2d xna licensing path-finding box2d unity unity box2d xna unity skyrim-modding javascript c# java unity c# android unity multiplayer ai rpg c++ unity xna unity 2d unity physics unity c++ architecture 3d game-design shaders unity unity opengl tiles unity business procedural-generation 2d opengl bukkit directx unity architecture unity unity ios opengl unity unity libgdx collision-detection unity rotation android game-design unity java tiles unity 3d user-experience special-effects unity unity unity java xna unity c# ai c# java unity unity xna android opengl 3d-meshes 2d matrix javascript unity models unity cocos2d-iphone game-industry unity java networking xna python unity mathematics lwjgl c# game-design ai unity raytracing unreal-4 unity cross-platform architecture c# game-maker c# libgdx unity xna unity architecture shaders c++ algorithm textures game-design textures camera unity tilemap xna virtual-battlespace terminology 2d unity game-design libgdx 2d c++ xna directx11 unity collision-detection unity game-mechanics xna opengl unity unity unity physics c# sdl unity collision-detection directx 2d mathematics unity c# java rts c++ xna unity opengl graphics unity depth-buffer graphics opengl animation game-design c++ java c++ xna frame-rate 2d unity unity c++ unity algorithm performance shadows physics html-canvas xna 2d unity xna glsl collision-detection xna c++ 2d unity random libgdx unity mathematics unity unity resolution c++ unity c# unity unity directx iphone collision-detection opengl java sprites jobs game-industry lighting software-engineering unity 3d unity opengl graphics unity unity mathematics java iphone multithreading collision-detection unity performance java unity ios c++ unity networking collision-detection android mathematics libgdx textures 3d unity unity unity unity character frame-rate roblox c# path-finding 3d directx collision-detection mathematics unity unity game-maker opengl c++ unity java java c++ game-design opengl procedural-generation unity c++ c++ unity cocos2d-iphone cocos2d game-design unity unity c++ unity unreal c++ path-finding level-design cocos2d-iphone c++ game-design rotation fixed-timestep unity libgdx javascript c++ android actionscript-3 streaming algorithm logic blender opengl c# game-design sfml c++ android java unity bullet-physics unity multiplayer xna unity c# unity c++ unity javascript opengl-es2 xna direct3d12 unity c# graphics architecture unity unity unity unity first-person-shooter xna animation java java input unity ios actionscript unity libgdx unity game-maker xna unity unity opengl unity opengl xna xna 3d c++ javascript java xna algorithm c# c++ unity opengl c# c++ tools unity matrix cocos2d-iphone unity unity unity unity video 2d c++ graphics unity c++ android opengl java xna unity sound unity textures mathematics algorithm javascript hardware game-design optimization unity 2d java unity hlsl xna optimization unity cocos2d-iphone unity marketing opengl unity unity opengl android physics unity opengl algorithm c++ voxels 2d java unity shaders xna 2d opengl libgdx unity game-design libgdx unity collision-detection android java animation javascript entity-system opengl 3d unity c++ particles c++ accessibility client-server camera unity collision-detection opengl libgdx game-design 2d xna-4.0 unity directx11 opengl unity server unity java architecture 2d physics unity fbx collision-detection shaders xna xna java unity collision-detection opengl unity unity physics unity architecture c++ libgdx unity 2d java art ai networking unity entity-system unity c++ opengl unreal-4 algorithm unity unity unity ai libgdx social unity 3d unity unity unity matrix state c++ unity ruby sdl2 movement c++ c# unity game-design libgdx unity textures unity opengl c# c++ unity unity sfml unity opengl openal terrain unity 2d unity android unity graphics c++ mathematics javascript java terrain java 2d c# opengl android java 2d unity shaders unity c++ c# game-design testing xna c++ javascript c++ unity server maps unity xna networking html5 assimp unity 2d android unity java opengl procedural-generation unity xna unity c++ point-cloud xna unity ajax unity rotation unity unity opengl opengl 3d java software-engineering unity xna unity java unity opengl algorithm modelling-techniques javascript android java java multiplayer unity normal-mapping unity unity game-design unity opengl unityscript maps networking directx9 color 3d opengl unity 2d opengl c# unity java c# unity pico-8 unity 2d unity unity 2d javascript javascript matrix mathematics legal modding unity blender c++ java graphic-effects xna mobile networking unity unity c++ unity bot resource-management xna unity camera unity c++ unity unity java architecture unity unity architecture unity c# opengl physics opengl 2d opengl iphone 3d flash unity c# c++ java opengl procedural-generation unity c# 3d unity game-design directx10 ios java mathematics game-design collision-detection xna unity opengl oop unity c# xna community-management shaders unity opengl java networking unity physics xna game-maker unity unity architecture opengl xna unity collision-detection java xna java rendering unity unity spritekit 3d unity frame-rate collision-detection mmo textures puzzle unity unity c# python quaternion unity geometry collision-resolution java unity java physics opengl unity architecture rts c++ lighting rendering unity java unity collision-resolution multiplayer java models box2d game-design xna java c++ opengl unity game-mechanics opengl directx11 unity animation ios opengl directx opengl path-finding unity books entity-system minecraft-modding unity game-maker c++ isometric javascript libgdx unity directx java c# opengl game-design opengl ios 2d unity game-maker shaders c++ unity c++ java collision-detection unity physics java unity android mobile 3d unity camera c++ opengl c++ unity c puzzle software-engineering c++ unity unity unity unity android opengl c++ unity legal opengl mathematics collision-detection architecture unity rendering xna opengl terrain-rendering unity textures c++ outsourcing input unity opengl godot c# java opengl 2d maps unity unity graphics-programming platformer physics xna algorithm xna unity javascript c# unity java c++ libgdx unity 3d-meshes scripting monogame game-design glsl algorithm 3d rendering mathematics pixel-art mathematics xna lua c# path-finding opengl c++ java game-design legal opengl unity unity unity xna cocos2d-x android opengl directx voxels unity 3dsmax python 2d unity 3d unity unreal java java flixel unity c# libgdx unreal-4 unity unity unity java java unity game-mechanics distribution terminology game-design opengl unity rpg game-design xna tilemap collision-detection c++ unity component-based unity 2d testing unity python unity directx unity vector unity unity unity unity architecture unity collision-detection opengl java multiplayer unity directx unity data-structure unity java directx11 c animation unity java game-mechanics c# networking unity unity algorithm networking xna graphics optimization game-maker unity unity opengl architecture unity libgdx pygame unity shaders directx11 directx physics-engine legal c# unity python unity javascript unity unity modding minecraft-modding 3d rendering unity libgdx animation glsl 3d pygame c++ android game-design udk directx path-finding 2d game-design facebook c++ opengl javascript matrix android android unity unity procedural-generation 3d unity game-loop mathematics unity glsl xna unity unity c++ javascript unity unreal-4 matrix unity algorithm c# ios unity architecture unity unity unity path-finding c# unity ai 2d unity unity copyright input java bullet-physics android unity unity c# unity architecture unity c# models unity unity c++ 3d ios browser-based-games unity unity unity java ai animation collision-detection 3d ai unity physics animation unity c# unity xna opengl collision-detection algorithm collision-detection game-design c# unity 3d c# unity shaders performance game-design textures c# windows-forms animation unity c++ flash c++ opengl hlsl java graphics opengl opengl c++ ios c++ unity java ios architecture unity unity libgdx java android c++ unity sprites libgdx unity unity rendering algorithm opengl mmo opengl 2d unity libgdx 2d unity unity business c# c++ unity java unity xna iphone xna unity unity directx unity opengl c# unity 2d game-design unity unity shaders c++ opengl unity unity xna 2d c# unity opengl box2d advertisements directx blender mathematics ios physics xna ndk sdl2 unity legal software-engineering unity java opengl collision-detection unity unity xna directx unity python 2d opengl-es2 c++ c++ xna javascript java android opengl terminology physics unity xna rpg unity path-finding transformation game-industry rendering xna unity sharpdx unity unity c++ events google-play-services c++ unity animation javascript opengl unity physics shaders 2d ios unity 2d opengl unity opengl collision-detection rendering opengl c++ unity minecraft-modding unity networking game-design flash box2d ai c++ unity opengl android android unity graphics unity rendering game-design c++ c++ textures c# javascript java ai client-server xna databases c++ c# unity godot xna opengl unity java architecture unity movement minecraft-modding c# c# andengine java unity 2d movement game-design opengl unity unity platformer unity unity godot directx11 opengl html5 c# unity xna unity multithreading c++ game-loop unity shaders c# unreal collision-detection unity java java opengl directx directx libgdx opengl c++ c++ 2d opengl 2d java algorithm unity 3d javascript c++ 3d javascript xna-4.0 debugging shaders unity unity opengl facebook unity xna bullet-physics 2d libgdx android 3d unity unity 2d file-format opengl opengl andengine unity game-mechanics xna-4.0 c++ java java opengl java graphics opengl collision-detection c# unity xna unity java game-design physics databases java 3d directx opengl c++ projection collision-detection assets unity collision-detection functional algorithm flash python unity 2d textures unity android objective-c game-mechanics android modding android unity unity collision-detection c# unity android unity collision-detection unity unity 3d unreal-4 unity data-structure opengl libgdx physics c++ xna unity collision-detection c# libgdx java unity mathematics javascript unity game-mechanics lighting c++ xna steam c++ unity directx11 opengl software-engineering xna c++ unity unity c++ c# unity matrix c# algorithm normal-generation godot unity c++ unity xna opengl xna ios unity unity game-design libgdx unity iphone mathematics unity xna unity 3d 3d unity c++ physics performance character game-maker opengl unity unity ai godot sprites animation android unity c++ unity game-design graphics unity geometry lighting separating-axis-theorem 3d 2d opengl 3d c++ unity xna-4.0 xna unity unity rpg game-design unity c# xna unity opengl unity unity xna unity maps java c++ unity opengl ai directx9 unity javascript unity opengl project-management c++ opengl javascript unity java directx opengl physics unity sound c# iphone java statistics 3d unity unity 2d c++ xna android java c# libgdx opengl c++ 3d c# opengl unity unity unity java c++ c++ tessellation mathematics xna legal game-maker graphics html5 collision-detection unity graphics unity shaders unity unity multithreading mathematics unity databases unity unity project-management java graphics path-finding phaser education mathematics performance unity 3d c# xna c++ 2d libgdx movement libgdx unity libgdx resolution unity xna unity java javascript c# opengl unity unity xna sprites 3d path-finding android opengl xna java opengl xna unity collision-detection xna game-design xna android opengl software-engineering software-engineering c# xna unity 3d graphics-programming iphone unity unity libgdx algorithm facebook unity xna java xna unity c# opengl unity opengl unity marketing libgdx opengl libgdx unity xna unity unity collision-detection synchronization c# physics andengine javascript unity opengl box2d c++ rotation unity 3d c++ libgdx c++ java unity mathematics c# directx android game-maker shaders collision-detection art javascript c++ rendering maze ai opengl opengl unity unity opengl physics physics unity browser-based-games c# unity opengl game-mechanics c++ algorithm opengl software-engineering c# directx11 unity c++ matrix graphics-programming game-design unity unity 2d xna xna camera unity 2d unity godot unity unity unity c# xna unity android directx python unity unity unity unity opengl android unity unity unity unity directx11 c# 2d libgdx xna unity game-mechanics xna c unity unity unity unity business 3d game-design unity opengl 3d libgdx collision-detection opengl opengl game-design opengl mathematics networking xna java physics opengl mathematics rendering 2d iphone graphics unity lwjgl unity vector android networking unreal game-mechanics animation c++ unity c++ unity java xna unity unity state libgdx terrain algorithm maps c++ c++ java unity libgdx xna 2d java sdl2 unity unity unity performance collision-detection xna architecture unity unity rotation unity 3d c# flash sound fonts directx unity opengl java unity fund-raising movement unity unity c++ multiplayer unity javascript java xna java javascript unity game-design mathematics browser-based-games game-design c++ ai unity networking client-server c++ cocos2d-iphone sdl opengl unity java rotation c++ unity animation opengl rotation graphics graphics sql directx11 mathematics java game-design c++ java path-finding unity legal terminology opengl ai unity unity java rotation c++ unity c++ game-design user-generated-content performance flash steam publishing unity collision-detection unity unity 2d unity java 3d-meshes textures unity ios sdl c# unity opengl server java unity cocos2d-x unity unity opengl opengl java java unity libgdx opengl graphics libgdx opengl unity c++ java c unity java opengl xna software-engineering collision-detection unity unity directx xna c# actionscript-3 xna unity directx11 opengl c# animation flash unity c++ opengl game-maker timer html-canvas unity unity physics c# 2d spherical-harmonics unity c++ game-loop unity collision-detection directx architecture node.js xna unity graphics c++ unity unity 3d xna c# unity opengl android licensing architecture unity c++ java game-design tools modding 2d xbox360 unity networking unity camera java unity opengl unity unity unity opengl xna c++ game-design c++ android java bullet-physics opengl-es opengl c# unity unity unity unity c++ xna procedural-generation opengl-es2 monogame c# algorithm java python mathematics heightmap unity animation libgdx software-engineering c++ javascript java android java modding controllers python java directx11 opengl opengl unity 2d tiles 3d unity unity graphic-effects game-loop unity textures xna optimization architecture unity unity c# unity unity collision-detection software-engineering unity c++ multiplayer unity unity xna unity javascript mathematics iphone c++ game-design opengl unity opengl opengl actionscript-3 opengl architecture unity unity python path-finding unity unity java path-finding memory-efficiency android shaders 3d security animation windows opengl unity opengl networking game-maker unity c# 3dsmax procedural-generation game-industry game-design unity game-design unity unity unity music browser-based-games turn-based mmo rendering android c# java spritesheet libgdx java game-maker unity leaderboards c++ c# unity console opengl 2d libgdx opengl unity collision-detection mathematics collision-detection tools xna procedural-generation opengl xna lighting c++ android xna terminology libgdx c# c++ android revenue c++ game-design unity 2d xna collision-detection physics android sdl2 procedural-generation unity physics java unity unity unity architecture events java mathematics directx unity unity algorithm unity shaders xna xna unity graphics unity tessellation multithreading android graphics game-maker collision-detection c++ c++ html5 graphics c++ physics c++ c++ textures unity xna unity unity opengl opengl mathematics monogame 3d unity video mathematics events opengl unity opengl 2d 3d xna unreal-4 c++ rock-paper-scissors mathematics collision-detection opengl movement android unity xna 2d sdl c++ opengl unity unity andengine unity unity game-design 2d sdl2 architecture opengl javascript unity c++ game-design algorithm unity unity c++ fsm monogame xna directx11 android unity collision-detection interpolation game-design c++ android optimization algorithm animation c# audio movement libgdx textures unreal-4 unity 2d javascript textures java terminology unity unity opengl architecture xna c++ mathematics unity game-design vector mathematics c# algorithm opengl collision-detection c# unity algorithm opengl unity xna design-patterns unity unity collision-detection unity legal glfw unity c# java camera 2d unity server collision-detection android unity java html5 android unity rendering unity legal c++ unity tiles java unity flash video java game-mechanics unity unity java java color c# c# unity c# 2d 3d javascript game-design security unity maps c++ unity tiles 2d networking unity directx9 unity architecture java textures directx c++ opengl ai graphics assets game-design unity business unity content-rating opengl directx simulations xna-4.0 opengl loading c++ opengl unity android opengl-es opengl c++ directx11 mathematics c++ 2d corona-sdk networking tiles game-design c++ unity networking unity javascript unity unity python c++ unity random c++ 2d opengl opengl unity unity opengl unity opengl savegame c++ java mathematics unity xna unity directx rendering unity java libgdx opengl unity 2d unity 3d 3d c++ c++ procedural-generation libgdx shaders c++ textures javascript unity c# software-engineering java algorithm python collision-detection java physics graphics-design unity-networking opengl collision-detection xna c++ android architecture libgdx unity game-maker multiplayer java textures procedural-generation unity java raycasting java graphics game-design collision-detection xna unity 3d unity unity unity udk unity 3d java c# opengl physics libgdx java directx11 unity textures unity directx11 java unity unity opengl unity 2d matrix 2d javascript unity libgdx c++ web starcraft-2 unity xna unity algorithm collision-detection movement ai mathematics c# random unity unity animation javascript unity modding legal xna unity game-design sprites unity unity physics opengl mathematics unity vector 2d c# c++ opengl box2d cocos2d unity game-design allegro unity unity java unity unity 2d unity unity opengl algorithm unity unity javascript directx10 unity gui coordinates unity java game-design java java libgdx c# c# unity xna unity opengl unity gui c++ python unity java anti-cheat unity unity xna unity lwjgl unity unity python lua node.js xna unity opengl movement c++ projectile-physics unity opengl xna opengl shaders directx11 game-design xna mathematics game-maker java opengl opengl xna iphone unity unity unity cocos2d-iphone opengl c# unity java unity game-design unity c++ libgdx 2d directx mathematics unity game-design xna opengl 2d unity unity c# xna 2d unity libgdx javascript android html5 unity unity unity mathematics multiplayer xna 2d software-engineering c++ xna unity procedural-generation textures tiled unreal-4 unity 2d c++ collision-detection terminology unity box2d unity shaders directx9 c++ graphics c# copyright android game-maker c# opengl collision-detection c# education hlsl xna c# c++ c++ jquery xna xna game-design unity java 3d c++ mathematics unity cross-platform unity xna unity c# xna unity javascript 2d camera 2d unity libgdx legal tiles mmo xna opengl xna xna unity flash isometric opengl mathematics unity algorithm opengl unity legal java c++ actionscript-3 xna unity unity c++ c++ unity unity unity unity c# unity android 2d actionscript-3 opengl physics c++ opengl c++ unity unity unity 2d c++ unity unity java unity ios unity java c# c# server software-engineering unity godot collision-detection sprites xna java unity textures andengine c++ c++ unity unity c++ unity mesh game-design java rendering opengl-es c++ unity architecture ai unity unity c++ xna unity c++ c# java xna rendering 2d unity opengl unity opengl source-engine android 2d directx c# unity opengl 3d multiplayer unity mmo unity graphics game-design unity xna voxels opengl java tiles unity opengl 2d scene-graph opengl c# performance shaders unity android unity unity networking education game-design ai c# opengl javascript marketing unity 3d cocos2d-iphone unity 2d adventure-games movement unity c# 3d unity minecraft-modding 2d unity unity unity game-design xna c++ unreal-4 client-server mathematics unity tiles unity opengl business opengl game-design java assets c++ directx javascript unity game-maker shaders unity c# c++ textures unity xna unity marketing libgdx art unity java opengl normals game-design unity animation opengl opengl unity textures collision-detection c++ unity ios xna 2d c++ unreal unity algorithm copyright 2d python game-maker unity unity component-based appstore javascript xna unity legal ai c# box2d unity unity xna game-design android c++ java javascript c++ cocos2d 2d xna hlsl unity c# ogre unity unity c++ 3d physics shaders camera networking sdl simulations opengl unity opengl-es xna models unity 2d java c++ node.js unity books webgl unity iphone opengl unity unity iphone opengl physics kinect unity xna-4.0 minecraft-modding unity opengl box2d unity xna movement unity libgdx c# software-engineering c# game-design planning career c# xna-4.0 unity directx javascript c# unity unity unity virtual-reality game-design unity component-based unity c# animation c# opengl logic physics unity directx c# c++ opengl architecture sound unity c# movement 2d ogre unity rendering physics unity animation c# c# game-design c++ directx xna unity cocos2d-iphone opengl animation mathematics collision-detection networking shaders unity unity intersection c++ game-design android adventure-games unity java opengl unity unity mathematics javascript game-design box2d opengl 2d video unity graphics unity models networking lwjgl c++ game-design 2d architecture multiplayer opengl unity c# unity 2d libgdx unity c# unity unity unity cocos2d-x unity unity directx path-finding collision-detection java opengl unity unity animation unity unity android c++ unity c++ unity 2d mathematics unity flash tiles c++ design-patterns android shaders unity c++ c++ c++ unity 2d collision-detection opengl-es2 opengl opengl html5 unreal-4 java xna game-design textures tiles unity algorithm unity rpg-maker-mv collision-detection c# collision-detection unity ai andengine opengl unity opengl opengl unity xna mathematics unity unity libgdx opengl unity windows c++ libgdx xna unity javascript libgdx opengl unity unity unity tiles animation game-design 2d shaders xna sprites 2d projection opengl 2d unity architecture maps sdl libgdx unity libgdx rpg android c++ opengl directx unity networking unity unity tilemap unity unity unity game-design c++ godot python c++ godot opengl unity unity javascript game-mechanics libgdx collision-detection game-maker unity libgdx game-design unity opengl game-design mmo deployment 2d design-patterns opengl collision-detection architecture c# xna opengl shaders unity c++ xna-4.0 c# algorithm android java unity performance physics xna game-design game-design mobile terrain opengl xbox360 input game-design c# java c++ directx mathematics collision-detection unity mathematics unity libgdx mmo xna unity c# unity xna 3dsmax xna unity c camera textures game-design unity unity minecraft-modding directx11 publishing java unity 2d game-maker cocos2d-iphone libgdx physics unity unity java opengl unity c# xna game-design opengl unity skeletal-animation unity 3d box2d art javascript xna c++ udk c++ 2d c# graphics tiles xna java mathematics unity javascript unity 3d 2d xna c++ c++ physics-engine modding game-design 2d unity c++ xna unity flash c# unity unity xna iphone 3d unity c++ opengl sprites java xna unity c++ mathematics legal c++ opengl c++ mathematics unity javascript java box2d java movement sprites unity simulations unity collision-detection unity physics physics java animation java xna xna-4.0 mathematics box2d opengl-es mathematics software-engineering unity unity opengl mathematics android c# mathematics libgdx php textures xna physics unity c# javascript c++ unity unity unity opengl unity unity project-management rendering career android unity modding java unity legal unity sdl2 unity unity opengl movement c++ terrain-rendering android unity javascript algorithm opengl unity 2d unity c# flash ai game-design unity java networking 2d unity collision-detection unity c# unity path-finding xna architecture unity unity physics unity single-player directx unity java game-loop path-finding c++ c++ unreal-4 xna unity c# mmo unity opengl xna unity android performance opengl c++ shaders directx unity balance tiles opengl c# opengl java legal silverlight 2d unity unity unity flash opengl godot 3d physics unity c# opengl xna c++ xna directx11 xna graphics opengl-es game-design c++ unity unity 3d unity multiplayer 2d java javascript libgdx lwjgl 3d movement xna opengl c++ camera unity databases directx11 vector java java xna xna opengl 2d c++ textures architecture unity 2d unity unity graphics unity c# models xna unity unity graphics unity c++ xna unity c# unity c# gui monogame c# java unity unity opengl unity unity mmo unreal-4 unity unity movement html5 unity game-mechanics java architecture mathematics matrix c# unity java opengl-es xna unity unity c++ rotation unity opengl graphics javascript c++ java unity music actionscript-3 unity gui unity unity unity unity opengl animation timing unity java xna unity textures graphics scene unity unity c# opengl input c++ 2d physics unity unity unity animation input scripting game-design entity-system libgdx unity xna unity unity blender opengl open-source collision-detection c# c++ unity graphics unity materials 2d c# game-design roguelikes c++ mathematics opengl opengl opengl unity marketing collision-detection libgdx procedural-generation unity 3d unity music 2d opengl c# java java xna opengl graphics assets unity game-design unity c# unity python rendering unity opengl unity xna unity direct3d12 flash unity opengl procedural-generation directx unity physics mathematics sdl android unity cross-platform 3d mathematics unity opengl android unity mathematics unity php unity unity libgdx directx unity c++ isometric c++ game-design java java javascript java unreal-4 libgdx java mathematics xna game-maker vector-art architecture unity game-design hardware 3d unity unity unity java unity javascript xna unity c++ opengl opengl unity unity lighting networking browser-based-games unity 3d opengl java unity c# serialization java unity opengl opengl c++ java physics 2d unity unity unity gui c++ xna 3d opengl movement opengl android textures unity java iphone android java android unreal-4 iphone unity unity unity path-finding unity textures unity mathematics collision-detection c++ unity architecture opengl unity keyboard mmo c++ opengl lua architecture libgdx 2d opengl unity opengl c++ opengl textures c++ 2d unity unity unity c# c++ lighting animation windows android udk opengl animation 2d lua unity community-management gpu unity opengl libgdx c# c++ unity unity xna 3d 3d multiplayer unity networking collision-detection c# unity 2d unity unity unity ai libgdx roguelikes mathematics game-design udk unity java ai unity c++ opengl c# physics unity unity opengl android 3d-meshes 2d godot cocos2d-iphone 2d game-design javascript unity unity opengl-es2 blender opengl unity architecture android software-engineering physics authentication xna c opengl xna android unity unity java unity xna server ai unity opengl-es2 game-design unity android c++ java xna android licensing opengl collision-detection java unity unity unreal-4 2d vector opengl matrix unity unity 2d opengl unity android unity graphics unity architecture c++ ios user-generated-content 2d 3d websocket android physics 3d opengl libgdx unity 2d java browser-based-games architecture libgdx mathematics xna collision-detection browser-based-games unity opengl xna jquery coordinates ios unity spritesheet ios game-design c# monogame c++ user-generated-content collision-detection java opengl directx11 c++ html5 optimization javascript matrix performance animation unity unity libgdx 2d opengl xna libgdx savegame opengl architecture godot xna unity shaders c# unity opengl opengl movement javascript c++ c++ unity collision-detection unity cross-platform gui shaders java game-design unity android unity unity unity c++ 3d c++ java unity unity unity unity android java unity c# java game-design unity animation c# unity java android assets unity webgl unity 3d animation 2d unity entity-system c# opengl unity opengl game-industry ai c++ levels unity game-maker steam unity ai unreal-4 unity game-maker unity pygame pixel unity physics c# libgdx performance c# c++ javascript unity shading unity collision-resolution xna unity ios libgdx python unity unity java unity process directx9 c++ unity unity opengl collision-detection xna cocos2d-iphone java software-engineering mathematics 3d c++ mmo tilemap scripting unity glsl c# unity unity unity camera vector face c++ unity c# unity c++ unity ios rotation rendering 2d 3d shaders opengl c++ opengl opengl c# 2d unity unity unity libgdx game-design particles 2d movement unity architecture xna xna java android opengl c# c# unity unity game-maker xna 2d unity mathematics c++ xna opengl c# unity unity unity google-play mathematics unity c++ game-design libgdx unity 2d voxels unity mathematics keyboard 2d path-finding unity java unity unity textures opengl transformation unity unity android c++ unity collision-detection rts architecture java physics collision-detection java unity collision-detection server physics tiles android unity c# c# xna libgdx unity c# rendering 2d mobile opengl unreal-4 c++ geometry c# algorithm opengl c++ c++ mmo software-engineering iphone java game-design unity unity collision-detection game-design unity java ios unity rendering java unity unreal-4 c++ unity methodology c++ unity iphone c++ java 3d unity monogame unity education collision-detection directx unity libgdx android 2d directx 3d 3d-meshes c# platformer opengl unity rotation game-design opengl algorithm unity architecture opengl opengl-es unity java 2d xna opengl opengl opengl voxels unity opengl c++ game-design java networking rope-physics opengl unity unity unity tilemap xna c++ unity unity ai c# user-experience 2d udk animation unity physics unity unity unity unity opengl opengl ai unity java ios unity c# 2d xbox360 unity physics unity legal 3d software-engineering minecraft-modding unity unity unity opengl unity java 2d audio javascript 2d algorithm unity xna networking unity 3d matrix libgdx algorithm opengl architecture collision-detection ios java c# unity matrix android javascript android unity unity 2d 2d sprites opengl unity windows directx10 physics unity unity 2d graphics-programming tiles rendering unity collision-detection architecture java 3d ios opengl path-finding 2d unity opengl c++ c# opengl java unity javascript unity opengl c++ c# opengl unity xna 3d unity android opengl networking networking opengl unity mathematics libgdx unity mathematics c# mathematics 3d java opengl unity opengl c++ unity unity xna actionscript-3 android c++ mathematics animation xna opengl game-design opengl c# opengl directx11 education c++ android game-design unity opengl jobs unity unity iphone unity unity tilemap savegame unity level-design unity shaders unity unity unity blender c# c++ opengl multithreading unity modding savegame unity java unity javascript xna c++ text performance java c# 2d opengl opengl unity 3d c++ unity xna corona-sdk collision-detection unity libgdx c++ tiles unity networking libgdx unity mathematics unity ios cocos2d-x-js graphics opengl directx11 mathematics opengl unity java c++ unity c# architecture java hlsl server terminology assembly architecture libgdx c++ unity c++ physics game-mechanics game-design box2d unity 2d hacks android unity unity javascript xna xna unity cocos2d-iphone xna box2d c# art opengl graphics libgdx unity c++ unity collision-detection 2d c# 2d architecture mathematics graphics 3d interpolation android coordinates libgdx java c# libgdx xna 3d libgdx opengl xna opengl xna unity unity 2d c++ networking ai unity c# unity unity sdl c++ gui architecture xna-4.0 c# unity unity mathematics unity path-finding waypoints opengl simulations marketing 3d opengl andengine unity c# shaders unity animation 2d opengl opengl vulkan shaders unity c++ xna xna-4.0 c++ c# c++ unity geometry unity c++ networking java collision-detection xna unity unity 3d opengl unity mathematics mathematics 3d java tiles xna c# 3d c++ game-design unity unreal c++ libgdx opengl lwjgl iphone xna collision-detection graphics unity 2d physics configuration animation unity xna unity input memory-efficiency physics java java unity architecture xna opengl opengl scripting libgdx libgdx mathematics java unity physics libgdx java unity unity xna unity procedural-generation unity projection xna xna education unity 3d networking opengl unity camera tiles box2d unity opengl unity c# 2d javascript unity unity unity unity godot camera xna multiplayer mathematics android pixel-art cocos2d-iphone 2d 2d xna c++ shaders unity xna-4.0 java collision-detection unity c# 3d unity unreal-4 java c++ rotation xna java game-maker ai java xna java java 2d collision-detection unity android box2d unity physics unity textures c# efficiency mathematics opengl unity unity opengl andengine unity unity unity 3d xna unity c++ xna-4.0 xna architecture unity java java unity entity-system directx animation isometric shaders 3d-meshes box2d unity 2d 2d opengl python c++ unity game-maker java rpg javascript c# server c# animation xna unity side-scroller unity animation lighting 3d xna java xna libgdx 2d java unity unity android unity unity xna opengl c# opengl opengl java unity windows-phone-7 opengl game-design rendering xna unity mathematics java c# 3d c# path-finding unity c# java unity vector hlsl mathematics animation c++ game-design unity testing unity physics directx11 2d opengl-es java unity python c# c++ algorithm ai c# c# xna unity entity-system java c++ iphone client-server unity javascript java iphone java c++ iphone rotation nvidia unity mathematics unity cocos2d-iphone c++ unity unreal c# c# c# xna unity xna collision-detection physics iphone unity opengl xna unity game-design directx unity game-design javafx unity game-design collision-detection windows java c++ gui xna c++ mathematics opengl libgdx xna shaders actionscript-3 unity lighting java c++ blender unity xna algorithm architecture unity physics unity trigonometry unityscript opengl 3d quaternion xna java java unity models unity unity directx java multiplayer game-maker algorithm unity javascript mathematics collision-detection legal c++ c++ xna entity-component-system collision-detection xna sprites java shadows unity unity unity unity xna unity terrain java lighting unity 3d-meshes unity networking c++ procedural-generation networking android java c# collision-detection algorithm game-maker unity shaders unity architecture c++ unity xna c# shaders c# c# unity javascript unity c# c++ javascript xna unity unity unity directx11 unity algorithm xna opengl-es java unity xna physics java xna opengl unity c# opengl xna assets directx11 unity unity xna shaders unity 3d unity movement unity directx11 c# c# education c# shaders software-engineering opengl java rotation opengl unity unity unity mathematics unity c# c# opengl scripting spritekit glsl 3d 2.5d unity xna opengl unity unity unity sprites c++ opengl antialiasing c# unity c# shaders c# 2d graphics procedural-generation unity c++ unity collision-detection java c# javascript unity scripting opengl-es movement physics opengl-es c# 2d libgdx jbox2d textures unity opengl-es opengl-es2 opengl textures 3d unity 2d logic collision-detection unity game-design unity c++ c++ unity unity game-design c# libgdx android xna modding 2d quaternion 2d javascript java c++ 2d 3d java game-design box2d xna opengl security xna-4.0 java opengl box2d unity c# unity game-mechanics architecture graphics 2d c# physics physics unity unity ios unity graphics javascript 2d mobile unity c# c++ component-based xna unity java c# c++ physics xna box2d unity xna ai c# unity c# spritekit xna opengl python porting unity opengl c# opengl java android mathematics unity c# server python xna scoring marketing 3d legal opengl unity networking android android matrix 2d multiplayer ios minecraft-modding game-maker unreal-4 unity c++ pygame game-design love2d shaders unity unity procedural-generation java algorithm unity opengl c++ opengl java c++ blender 2d javascript java javascript c++ c++ java game-design unity directx opengl mathematics unity unity java opengl graphics unreal-4 procedural-generation java unity box2d unity opengl-es movement xna java unity unity 2d procedural-generation unity mmo unity 2d opengl c# c++ unity opengl unity iphone maya c++ opengl community-management unity multiplayer unity unity unity sdl c++ unity unity unity game-design c++ javascript xna unity movement opengl opengl quaternion opengl 3d unity 3d unity maps timer unity game-design shadow-mapping xna xna collision-detection javascript opengl java xna-4.0 unity c# javascript 2d unity c++ xna 2d procedural-generation libgdx game-design opengl-es c++ game-design unity game-design architecture xna unity xna c# java unity unreal c# unity textures unity opengl xna unity java animation android c# unity unity unity opengl card-game c++ game-design physics unity unity path-finding xna shaders unity tools xna opengl tiles c# minecraft-modding c++ iphone java unity-networking physics java 2d software-engineering java memory-efficiency unity unity physics opengl c# unity unreal-4 unity 2d unity multithreading architecture unity unity unity unreal-4 c# xna level-of-detail unity unity web unity unity unity unity xna c++ 2d c++ unity 2d xna android android xna flixel unity graphics-programming collision-detection unity c++ procedural-generation c++ textures java unity architecture game-design udk databases graphics 2d licensing unity c++ unity opengl architecture 2d collision-resolution unity scene-graph unity c++ c# sprites libgdx lighting java javascript lighting software-engineering game-design xna-4.0 legal raytracing c# 2d unity c++ unity box2d opengl unity mathematics unity ai xna unity unity unity architecture c# unity entity-system opengl xna iphone unity unity java c# mobile c++ tiles xna-4.0 unity 2d xna opengl architecture unity directx11 component-based coordinates unity unity java unity c++ java physics server game-design unity 3d c++ unity java opengl opengl opengl iphone 3d 2d unity ios mathematics c++ c++ unity networking performance c++ graphics game-design opengl sprites android physics path-finding c# opengl architecture libgdx libgdx python algorithm c++ unity java xna c++ xna unity unity c# c# java architecture javascript unity 3d 2d shaders java c++ opengl terrain-rendering textures android level-design architecture unity procedural-generation 3d-modeling opengl-es architecture unity libgdx unity unity 3d textures graphics-programming opengl-es2 c++ sdl2 collision-detection 3dsmax game-design 2d 2d game-maker unity unity ai opengl 3d c# 2d rotation unity 2d libgdx unity game-design unity c# c# architecture isometric android unity java opengl unity unity architecture unity java opengl performance multiplayer unity unity c++ 2d software-engineering unity vector xna android path-finding unity xna entity-system cocos2d-iphone 2d java unity java java unity unity unity ruby opengl geometry xna unity mathematics unity xna java collision-detection java javascript unity physics unity unity input physics android 2d actionscript-3 matrix opengl shaders mathematics unity android animation unity architecture unity unity java opengl space-partitioning unity textures unity unity lwjgl algorithm java flash opengl collision-detection unity unity godot libgdx python c++ opengl xna opengl 3d-meshes legal unity unity unity tilemap costs unity libgdx unity xna unity architecture audio box2d unity opengl opengl unity directx c# xna algorithm networking c# unity unity game-industry unity unity graphics-programming 2d game-design models unity c++ libgdx java unity collision-detection 3d javascript isometric mathematics business unity c++ java opengl mathematics data-structure game-industry java xna unity c++ unity unity unity java unity 3d libgdx cocos2d-x c# unity game-maker graphics unity data-structure unity unity java opengl unity xna unity python unity mathematics unity opengl unity unity opengl collision-detection game-design xna unity opengl unity angles 2d opengl c# unity java vector unity opengl algorithm cocos2d-x unreal unity game-design unity html5 unity collision-detection c# opengl opengl mathematics iphone opengl textures unity unity c# xna unity graphics unity matrix xna xna mmo unity android unity unity javascript unity c++ unity networking c# java open-source unreal performance opengl xna copyright game-loop xna c++ libgdx textures game-industry unity ios mathematics udk unity java entity-system opengl procedural-generation trajectory shaders 3d textures unity opengl android javascript xna twine 2d ai java xna python architecture iphone xna c unity graphics unity mathematics scripting game-design unity collision-detection c++ java cocos2d-iphone mathematics opengl c# c++ opengl design-patterns unity server unity unity unity movement unity data opengl blender xna java sprites modding xna iphone shaders opengl c++ unity game-maker legal game-design opengl turn-based javascript unity networking unity 2d unity networking xna xna unity c++ opengl 2d unity unity networking c# xna unity collision-detection c++ java opengl udk unity game-design box2d unity unity legal c++ maps java c++ lighting xna-4.0 html5 unity c# xna android 2d xna collision-detection unity godot java c++ game-design java 3d unity maps mathematics procedural-generation 2d unreal-4 unity c++ algorithm c++ sdl unity animation unity opengl unity camera xna javascript c++ opengl unity first-person-shooter c++ opengl 2d animation rotation architecture 2d multithreading c++ matchmaking godot xna unity unity flash unity android xna-4.0 opengl game-design unity unreal-4 javascript libgdx c++ java software-engineering monogame sharpdx unity opengl unity php 2d unity java frame-rate algorithm path-finding c++ directx opengl-es procedural-generation collision-detection c++ algorithm unity voxels game-design textures opengl shaders animation performance unity 3d c++ game-design c++ networking python unity education unity unity unity opengl architecture scripting unity game-design 2d unity unity unity movement opengl matrix python unity java c++ c# unity c++ java isometric animation c# unity unity opengl animation software-engineering ios libgdx ios opengl c++ unity java 3d c# c# unity unity unity ios networking tools xna c# unity c# unity unity unity component-based game-design java c++ java c++ xna java c# google-play xna libgdx unity multiplayer opengl java 2d unity game-design unity xna unity c# unity unity c++ c# mathematics algorithm mmo game-design unity windows unity javascript 3d unity opengl shaders publishing unity unity flash 3d unity java unity 2d data-structure xna-4.0 scripting unity lighting geometry unity transformation unity hardware xna geometry sprites lighting game-maker mathematics opengl unity python game-design sprites xna unity c++ c# java 3d-meshes physx opengl unity java javascript java mesh gui java c# ipad unity unity unity c++ architecture unity xna shaders javascript mathematics unity mathematics unity tiles android unity android c++ graphics 3d c# unity algorithm animation models architecture unity c++ three.js box2d c++ windows-phone-7 mathematics physics browser-based-games physics game-design unity career ai 3d-meshes android graphics-programming unity c# ai iphone phaser java xna-4.0 unity c++ xna unity tools 2d unity unity path-finding animation monogame sdl2 c# raycasting online c++ directx11 unity game-loop c# android physics game-design opengl java slick android tiles c++ c++ opengl android unity unity physics opengl libgdx c# unity c# textures unity collision-detection xna unity opengl collision-detection opengl unity path-finding c++ project-management opengl html5 javascript sfml graphics unity c# flash c++ java c++ flash android java unity unity c# game-design unity unity intersection copyright c# unity java performance unity android xna c++ unity texture-atlas java collision-detection unity camera c++ game-industry unity opengl mmo unity c++ unity unity java xna xna-4.0 unity ai c++ legal unity rendering unity camera xna unity unity unity tilemap opengl android opengl c# c++ opengl-es unity opengl opengl 3d unity xna optimization box2d animation c++ text unity opengl java java 2d architecture vector unity java open-source unity c++ pygame movement business physics multiplayer unity c# physics xna unity opengl game-design ai game-design unity graphics-programming xna 3d xna opengl shaders mathematics unity c++ unity c++ java unity unity unity legal unity c++ macos sound unity unity unity xna python unity physics unity c++ unity architecture xna entity-system sdl directx11 iphone tilemap unity animation algorithm unity unity java networking mmo unity unity aabb animation networking character xna c# java textures browser-based-games libgdx unity unity c++ collision-detection c# ios unity c# xna 2d java havok collision-detection c++ unity opengl mathematics timing c# game-design unity animation server unity unity collision-detection c# unity opengl android models unity unity directx 2d unity unity camera monogame multiplayer c# unity unity java java architecture unity java c++ textures libgdx unity java xna android android c# c# procedural-generation opengl movement c# c# unity game-design xna-4.0 tiles unity unity unity libgdx xna hlsl unity c# libgdx shaders vector c# networking ai java c++ unity unity unity unity phaser unity textures algorithm unity android unity camera c++ tiles opengl unity asset-management opengl c# unity javascript game-design xna c++ tilemap unity unity sdl unity 2d cocos2d unity game-design performance c++ unity 3d java path-finding c# ios xna algorithm box2d xna java xna game-design marketing c++ unity ai computational-geometry unity unity mathematics java javascript c++ c# c++ unity javascript unity scoring multiplayer c# xna unity mathematics unity glsl unity java c# unity unity android sdl2 textures java unity first-person-shooter 3d opengl box2d android functional box2d unity unity unity collision-detection 2d xna unity 3d unity sdl andengine unity cocos2d game-design normals 2d procedural-generation camera opengl blender javascript unity game-loop unity unity xna c++ game-design xna unity unity mmo textures c++ cocos2d xna c++ unity directx xna 2d optimization terminology unity input unity unity java c++ xna multiplayer game-design mathematics opengl tools camera android camera 2d unity movement 2d unity opengl android unity unity architecture legal unity javascript java physics java sprites opengl collision-detection unity opengl-es loading android textures component-based rendering architecture xna opengl unity procedural-generation architecture game-design android unity android sprites architecture ai online android path-finding unity unity opengl html5 android opengl-es unity xna xna actionscript-3 unity opengl unity directx animation 3d terrain-rendering unity android flash architecture unity c# mobile c# android collision-detection c# game-design graphics-programming unity vector unity c++ unity opengl libgdx mathematics physics opengl gui monogame java unity unity xna unity c# java c++ 2d platform unity vector c# unity ai mathematics unity models game-design unity architecture unity javascript javascript networking 2d mathematics unity opengl java opengl textures xna opengl java unity xna opengl input lighting legal collision-detection unreal-4 java c++ unity unity c++ xna opengl 2d unity xna-4.0 xna 2d c++ game-design c++ collision-detection physics udk harlowe ogre unity javascript opengl c# tiles android libgdx camera libgdx 2d javascript gui 3d unity c++ camera opengl unity javascript game-design xbox360 input frame-rate game-design opengl flash c# unity actionscript 3d c# unity libgdx c# c# unity opengl java xna unity camera unity 2d javascript xna android xna unity 2d 2d procedural opengl ios java unity unity unity unity c++ ai terrain unity unity android collision-detection java unity xna libgdx unity unity unity unity server xna c# collision-detection xna graphics opengl graphics-programming unity 2d unity java unity unity performance java xna unity tiles opengl lighting 2d level-design c# xna unity directx11 unity unity unity unity c# rotation physics java performance physics xna-4.0 terminology unity sdl architecture unity bullet-physics networking opengl performance c++ unity unity shaders unreal-4 c++ graphic-effects architecture c++ c++ xna c++ rotation opengl c++ c++ c++ architecture xna 2d collision-detection unity unity color c++ logic unity c isometric unity cocos2d-iphone opengl javascript xna xna unity opengl lighting unity unity mathematics directx11 procedural-generation unity opengl java c# xna java opengl 3d opengl unity opengl 2d legal education mathematics movement c++ opengl shaders unity physics unity java shaders c++ algorithm unity unity c# javascript collision-detection unity c++ networking server unity unity unity c# unity graphics c++ collision-detection unity xna path-finding xna architecture libgdx libgdx architecture unity shaders unity unity game-industry c# unity unity physics intersection animation mathematics libgdx algorithm collision-detection unity unity 2d modding graphics unity three.js mathematics physics cocos2d-iphone xna unity unity rpg java unity unity opengl opengl marketing unity unity opengl 3d algorithm opengl c++ hlsl directx11 2d game-design game-industry unity unity mmo shadows xna unity animation unity python unity 3d terrain unity android android android glsl education textures google-play unity architecture unity geometry mathematics unity opengl java c++ isometric java unity c++ unity unity 2d opengl camera unity opengl assets unity android directx11 unity c# textures unity c++ loading c++ game-design architecture c# game-design java unity opengl xna javascript rendering physics unity c++ iphone multiplayer rts collision-detection game-mechanics unity unity unity unity c# physics game-mechanics physics unity c# game-design performance unity unity 2d 3d unity c++ unity algorithm geometry c++ c# unity c# rendering game-design unity game-design networking hiring opengl collision-resolution java game-design opengl unity java c++ events xna c# libgdx 2d unity opengl java libgdx licensing 3d c++ c++ c# c++ c++ unity c# ios path-finding unity game-design c# game-design opengl collision-detection vector 2d c++ skeletal-animation collision-detection directx opengl rendering c# unity unity unity frame-rate camera xna javascript c++ javascript unity movement collision-detection xna android unity opengl java godot unity c# opengl unity mathematics unity opengl c# unity 3d unity collision-detection shaders mathematics java raytracing unity opengl c++ opengl models architecture networking component-based mathematics rendering unity unity collision-detection opengl opengl java java lua opengl directx game-industry cocos2d-iphone unity c++ java unity shaders unity probability c++ visual-studio legal collision-detection unity unity graphics unity opengl file-format rigging java animation opengl sharpdx algorithm android unity voice unity unity unity libgdx camera unity unity unity sdl optimization movement opengl directx11 c++ unity unity directx java unity unity unity javascript textures java unity rendering c++ psm unity godot lua cocos2d-x sprites shaders c++ javascript java unity 2d licensing server 2d android opengl algorithm unity 2d unity unity game-maker opengl 2d geometry javascript opengl 2d unity game-design libgdx unity visual-studio unity optimization collision-detection geometry architecture unity collision-detection unity unity legal unity c# unity mathematics android geometry unity c# opengl opengl opengl c# unity unity godot opengl opengl hardware java component-based unity terminology unity physics physics procedural-generation opengl minecraft-modding procedural-generation mathematics java unity unity unity c# opengl unity opengl directx java mathematics unity unity directx unity unity textures unreal-4 blender collision-detection unity c# unity udk rendering rendering unity mmo free-to-play c++ java c++ unity random libgdx unity opengl unity directx11 unity iphone leaderboards unity unity c# unity opengl animation java c# 2d c++ java architecture unity iphone ios sharpdx unity sprites animation c# collision-detection c# game-design libgdx sdl2 opengl 3d c++ c# algorithm game-design algorithm game-design unity xna webgl c# opengl unity c# c++ animation collision-detection unity software-rendering c# unity c++ c# c++ java c# vulkan 3d xna java unity c# opengl 3d 2d java unity algorithm opengl-es2 physics turn-based-strategy unity 2d tiles xna opengl xna animation unity game-mechanics game-design unity lighting mathematics unity android vsync hlsl opengl shaders unity unity unity game-design algorithm unity camera java xna physics java c++ java unity unity physics xna c# input hud maps mathematics game-design xna java opengl tilemap opengl opengl xna java game-design rendering unity java opengl windows unity textures unity fluid-dynamics unity game-design 3d c++ game-design architecture directx unity ios unity opengl unity sdl2 c++ libgdx unity unity 3d opengl c++ xna shaders 3d java unity architecture unity xna c++ unity unity c# browser-based-games algorithm modding assets xna xna 2d c++ rendering unity textures 3d opengl lua animation unity unity java unity unity timer mathematics c++ java c# unity android gui game-mechanics xna unity unity physics c++ c# 3d unity opengl java xna algorithm c++ unity unity unity textures corona-sdk java c++ collision-detection collision-detection unity php bullet-physics c# unity unity procedural-generation shaders collision-detection c++ unreal-4 collision-detection directx game-design unity unity procedural-generation unity shaders java mathematics c++ unity steam unity xna mobile opengl java mathematics 2d unity mathematics unity sprites unity graphics libgdx transformation 2d unity libgdx unity ai c# unity unity c++ unity c++ unity 3d multiplayer mmo opengl c# unity game-design c++ unity flash unity opengl shaders xna linux character 2d android 3d flash raycasting software-engineering unity box2d component-based jmonkeyengine unity copyright xna control algorithm android c# unity unity mathematics unity xna-4.0 opengl javascript game-design xna unity unity c# physics unity optimization c++ opengl 2d go publishing game-design performance xna unity opengl